summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.codeclimate.yml58
-rw-r--r--.gitignore1
-rw-r--r--.gitlab/CODEOWNERS (renamed from .gitlab/CODEOWNERS.disabled)4
-rw-r--r--.gitlab/ci/qa.gitlab-ci.yml2
-rw-r--r--.gitlab/ci/review.gitlab-ci.yml5
-rw-r--r--.gitlab/issue_templates/Bug.md6
-rw-r--r--.gitlab/issue_templates/Security developer workflow.md4
-rw-r--r--.haml-lint.yml6
-rw-r--r--.haml-lint_todo.yml523
-rw-r--r--.pkgr.yml4
-rw-r--r--CHANGELOG.md185
-rw-r--r--CONTRIBUTING.md6
-rw-r--r--GITALY_SERVER_VERSION2
-rw-r--r--GITLAB_ELASTICSEARCH_INDEXER_VERSION1
-rw-r--r--GITLAB_SHELL_VERSION2
-rw-r--r--Gemfile15
-rw-r--r--Gemfile.lock56
-rw-r--r--VERSION2
-rw-r--r--app/assets/images/favicon-yellow.pngbin1667 -> 1481 bytes
-rw-r--r--app/assets/javascripts/batch_comments/mixins/resolved_status.js2
-rw-r--r--app/assets/javascripts/behaviors/markdown/render_mermaid.js2
-rw-r--r--app/assets/javascripts/boards/stores/actions.js65
-rw-r--r--app/assets/javascripts/boards/stores/index.js14
-rw-r--r--app/assets/javascripts/boards/stores/mutation_types.js21
-rw-r--r--app/assets/javascripts/boards/stores/mutations.js91
-rw-r--r--app/assets/javascripts/boards/stores/state.js3
-rw-r--r--app/assets/javascripts/contextual_sidebar.js3
-rw-r--r--app/assets/javascripts/create_merge_request_dropdown.js6
-rw-r--r--app/assets/javascripts/diffs/components/app.vue12
-rw-r--r--app/assets/javascripts/diffs/components/tree_list.vue9
-rw-r--r--app/assets/javascripts/diffs/store/actions.js9
-rw-r--r--app/assets/javascripts/dirty_submit/dirty_submit_form.js11
-rw-r--r--app/assets/javascripts/dropzone_input.js15
-rw-r--r--app/assets/javascripts/filtered_search/dropdown_user.js14
-rw-r--r--app/assets/javascripts/fly_out_nav.js3
-rw-r--r--app/assets/javascripts/gl_field_error.js3
-rw-r--r--app/assets/javascripts/gpg_badges.js2
-rw-r--r--app/assets/javascripts/groups_select.js3
-rw-r--r--app/assets/javascripts/import_projects/store/getters.js6
-rw-r--r--app/assets/javascripts/issuable_bulk_update_actions.js3
-rw-r--r--app/assets/javascripts/issuable_index.js8
-rw-r--r--app/assets/javascripts/issue.js11
-rw-r--r--app/assets/javascripts/issue_status_select.js3
-rw-r--r--app/assets/javascripts/label_manager.js3
-rw-r--r--app/assets/javascripts/labels_select.js16
-rw-r--r--app/assets/javascripts/lib/utils/highlight.js6
-rw-r--r--app/assets/javascripts/locale/index.js2
-rw-r--r--app/assets/javascripts/main.js7
-rw-r--r--app/assets/javascripts/merge_request_tabs.js5
-rw-r--r--app/assets/javascripts/milestone.js3
-rw-r--r--app/assets/javascripts/milestone_select.js15
-rw-r--r--app/assets/javascripts/mini_pipeline_graph_dropdown.js3
-rw-r--r--app/assets/javascripts/monitoring/components/charts/area.vue16
-rw-r--r--app/assets/javascripts/namespace_select.js3
-rw-r--r--app/assets/javascripts/notes.js42
-rw-r--r--app/assets/javascripts/notes/components/note_actions.vue9
-rw-r--r--app/assets/javascripts/notes/components/note_awards_list.vue6
-rw-r--r--app/assets/javascripts/pages/milestones/shared/components/promote_milestone_modal.vue8
-rw-r--r--app/assets/javascripts/pages/projects/show/index.js8
-rw-r--r--app/assets/javascripts/pages/projects/tree/show/index.js8
-rw-r--r--app/assets/javascripts/pdf/index.vue4
-rw-r--r--app/assets/javascripts/project_label_subscription.js4
-rw-r--r--app/assets/javascripts/project_select.js5
-rw-r--r--app/assets/javascripts/reports/components/issues_list.vue6
-rw-r--r--app/assets/javascripts/reports/components/report_item.vue12
-rw-r--r--app/assets/javascripts/reports/components/report_section.vue8
-rw-r--r--app/assets/javascripts/reports/store/state.js5
-rw-r--r--app/assets/javascripts/repository/components/app.vue3
-rw-r--r--app/assets/javascripts/repository/components/table/header.vue9
-rw-r--r--app/assets/javascripts/repository/components/table/index.vue75
-rw-r--r--app/assets/javascripts/repository/components/table/row.vue60
-rw-r--r--app/assets/javascripts/repository/graphql.js46
-rw-r--r--app/assets/javascripts/repository/index.js25
-rw-r--r--app/assets/javascripts/repository/mixins/get_ref.js14
-rw-r--r--app/assets/javascripts/repository/pages/index.vue18
-rw-r--r--app/assets/javascripts/repository/pages/tree.vue20
-rw-r--r--app/assets/javascripts/repository/queries/getFiles.graphql7
-rw-r--r--app/assets/javascripts/repository/queries/getRef.graphql3
-rw-r--r--app/assets/javascripts/repository/router.js36
-rw-r--r--app/assets/javascripts/repository/utils/icon.js99
-rw-r--r--app/assets/javascripts/right_sidebar.js7
-rw-r--r--app/assets/javascripts/search_autocomplete.js5
-rw-r--r--app/assets/javascripts/set_status_modal/set_status_modal_wrapper.vue6
-rw-r--r--app/assets/javascripts/star.js2
-rw-r--r--app/assets/javascripts/subscription_select.js3
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/components/deployment.vue37
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline_container.vue38
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/components/review_app_link.vue2
-rw-r--r--app/assets/javascripts/vue_shared/components/clipboard_button.vue2
-rw-r--r--app/assets/stylesheets/components/toast.scss54
-rw-r--r--app/assets/stylesheets/framework/awards.scss5
-rw-r--r--app/assets/stylesheets/framework/blocks.scss14
-rw-r--r--app/assets/stylesheets/framework/common.scss7
-rw-r--r--app/assets/stylesheets/framework/filters.scss2
-rw-r--r--app/assets/stylesheets/framework/header.scss16
-rw-r--r--app/assets/stylesheets/framework/mixins.scss4
-rw-r--r--app/assets/stylesheets/framework/modal.scss6
-rw-r--r--app/assets/stylesheets/framework/timeline.scss1
-rw-r--r--app/assets/stylesheets/framework/variables.scss13
-rw-r--r--app/assets/stylesheets/pages/detail_page.scss1
-rw-r--r--app/assets/stylesheets/pages/events.scss4
-rw-r--r--app/assets/stylesheets/pages/members.scss2
-rw-r--r--app/assets/stylesheets/pages/merge_requests.scss4
-rw-r--r--app/assets/stylesheets/pages/notes.scss3
-rw-r--r--app/assets/stylesheets/pages/pipelines.scss2
-rw-r--r--app/controllers/admin/application_settings_controller.rb7
-rw-r--r--app/controllers/concerns/enforces_two_factor_authentication.rb2
-rw-r--r--app/controllers/concerns/project_unauthorized.rb14
-rw-r--r--app/controllers/concerns/routable_actions.rb18
-rw-r--r--app/controllers/projects/application_controller.rb3
-rw-r--r--app/controllers/projects/clusters/applications_controller.rb4
-rw-r--r--app/controllers/projects/clusters_controller.rb4
-rw-r--r--app/controllers/projects/environments_controller.rb1
-rw-r--r--app/controllers/projects/serverless/functions_controller.rb2
-rw-r--r--app/controllers/registrations_controller.rb25
-rw-r--r--app/controllers/uploads_controller.rb2
-rw-r--r--app/finders/issuable_finder.rb2
-rw-r--r--app/finders/projects/serverless/functions_finder.rb12
-rw-r--r--app/graphql/resolvers/issues_resolver.rb2
-rw-r--r--app/graphql/resolvers/tree_resolver.rb26
-rw-r--r--app/graphql/types/group_type.rb6
-rw-r--r--app/graphql/types/project_type.rb2
-rw-r--r--app/graphql/types/repository_type.rb14
-rw-r--r--app/graphql/types/tree/blob_type.rb10
-rw-r--r--app/graphql/types/tree/entry_type.rb14
-rw-r--r--app/graphql/types/tree/submodule_type.rb10
-rw-r--r--app/graphql/types/tree/tree_entry_type.rb11
-rw-r--r--app/graphql/types/tree/tree_type.rb12
-rw-r--r--app/graphql/types/tree/type_enum.rb14
-rw-r--r--app/helpers/dashboard_helper.rb4
-rw-r--r--app/helpers/emails_helper.rb22
-rw-r--r--app/helpers/groups/group_members_helper.rb7
-rw-r--r--app/helpers/nav_helper.rb8
-rw-r--r--app/helpers/page_layout_helper.rb3
-rw-r--r--app/helpers/projects_helper.rb4
-rw-r--r--app/helpers/storage_helper.rb2
-rw-r--r--app/mailers/devise_mailer.rb1
-rw-r--r--app/mailers/emails/issues.rb7
-rw-r--r--app/mailers/emails/merge_requests.rb4
-rw-r--r--app/models/active_session.rb49
-rw-r--r--app/models/application_record.rb4
-rw-r--r--app/models/ci/build.rb4
-rw-r--r--app/models/clusters/applications/jupyter.rb11
-rw-r--r--app/models/clusters/applications/runner.rb2
-rw-r--r--app/models/clusters/cluster.rb21
-rw-r--r--app/models/clusters/concerns/application_data.rb74
-rw-r--r--app/models/clusters/platforms/kubernetes.rb60
-rw-r--r--app/models/clusters/project.rb1
-rw-r--r--app/models/environment.rb4
-rw-r--r--app/models/merge_request.rb2
-rw-r--r--app/models/project_services/kubernetes_service.rb18
-rw-r--r--app/models/repository.rb27
-rw-r--r--app/models/user.rb9
-rw-r--r--app/serializers/test_case_entity.rb1
-rw-r--r--app/services/ci/register_job_service.rb7
-rw-r--r--app/services/clusters/refresh_service.rb6
-rw-r--r--app/services/git/base_hooks_service.rb9
-rw-r--r--app/services/git/branch_push_service.rb1
-rw-r--r--app/services/issues/close_service.rb13
-rw-r--r--app/services/notification_service.rb8
-rw-r--r--app/services/projects/create_service.rb6
-rw-r--r--app/services/projects/git_deduplication_service.rb64
-rw-r--r--app/services/projects/transfer_service.rb5
-rw-r--r--app/services/system_note_service.rb12
-rw-r--r--app/uploaders/attachment_uploader.rb2
-rw-r--r--app/uploaders/avatar_uploader.rb2
-rw-r--r--app/uploaders/file_uploader.rb12
-rw-r--r--app/uploaders/personal_file_uploader.rb70
-rw-r--r--app/views/admin/application_settings/_pages.html.haml5
-rw-r--r--app/views/admin/broadcast_messages/index.html.haml4
-rw-r--r--app/views/admin/groups/_form.html.haml2
-rw-r--r--app/views/admin/health_check/show.html.haml2
-rw-r--r--app/views/admin/projects/_projects.html.haml2
-rw-r--r--app/views/admin/projects/show.html.haml8
-rw-r--r--app/views/admin/users/_access_levels.html.haml2
-rw-r--r--app/views/admin/users/_form.html.haml6
-rw-r--r--app/views/admin/users/_head.html.haml1
-rw-r--r--app/views/award_emoji/_awards_block.html.haml6
-rw-r--r--app/views/ci/variables/_variable_row.html.haml2
-rw-r--r--app/views/clusters/platforms/kubernetes/_form.html.haml8
-rw-r--r--app/views/dashboard/projects/_zero_authorized_projects.html.haml15
-rw-r--r--app/views/devise/confirmations/new.html.haml2
-rw-r--r--app/views/devise/passwords/edit.html.haml2
-rw-r--r--app/views/devise/passwords/new.html.haml2
-rw-r--r--app/views/devise/registrations/edit.html.erb2
-rw-r--r--app/views/devise/shared/_signin_box.html.haml8
-rw-r--r--app/views/devise/shared/_signup_box.html.haml3
-rw-r--r--app/views/devise/shared/_tabs_ldap.html.haml1
-rw-r--r--app/views/devise/unlocks/new.html.haml2
-rw-r--r--app/views/events/event/_push.html.haml3
-rw-r--r--app/views/groups/group_members/_new_group_member.html.haml2
-rw-r--r--app/views/groups/settings/_general.html.haml20
-rw-r--r--app/views/help/index.html.haml3
-rw-r--r--app/views/help/ui.html.haml2
-rw-r--r--app/views/import/github/new.html.haml2
-rw-r--r--app/views/issues/_issue.atom.builder1
-rw-r--r--app/views/layouts/_head.html.haml1
-rw-r--r--app/views/layouts/_mailer.html.haml2
-rw-r--r--app/views/layouts/_page.html.haml1
-rw-r--r--app/views/layouts/devise.html.haml3
-rw-r--r--app/views/layouts/header/_default.html.haml5
-rw-r--r--app/views/layouts/header/_help_dropdown.html.haml1
-rw-r--r--app/views/layouts/mailer.text.erb1
-rw-r--r--app/views/layouts/nav/_dashboard.html.haml1
-rw-r--r--app/views/layouts/nav/sidebar/_admin.html.haml9
-rw-r--r--app/views/layouts/nav/sidebar/_group.html.haml3
-rw-r--r--app/views/layouts/nav/sidebar/_profile.html.haml4
-rw-r--r--app/views/layouts/nav/sidebar/_project.html.haml6
-rw-r--r--app/views/layouts/notify.html.haml2
-rw-r--r--app/views/layouts/notify.text.erb1
-rw-r--r--app/views/notify/closed_issue_email.html.haml2
-rw-r--r--app/views/notify/closed_issue_email.text.haml2
-rw-r--r--app/views/profiles/show.html.haml6
-rw-r--r--app/views/projects/_files.html.haml10
-rw-r--r--app/views/projects/_flash_messages.html.haml1
-rw-r--r--app/views/projects/_home_panel.html.haml2
-rw-r--r--app/views/projects/branches/_branch.html.haml2
-rw-r--r--app/views/projects/branches/index.html.haml3
-rw-r--r--app/views/projects/buttons/_download_links.html.haml2
-rw-r--r--app/views/projects/commits/_commit.html.haml4
-rw-r--r--app/views/projects/commits/show.html.haml2
-rw-r--r--app/views/projects/diffs/_content.html.haml2
-rw-r--r--app/views/projects/mirrors/_mirror_repos.html.haml2
-rw-r--r--app/views/projects/notes/_actions.html.haml6
-rw-r--r--app/views/projects/project_members/_new_project_member.html.haml3
-rw-r--r--app/views/projects/protected_branches/_protected_branch.html.haml2
-rw-r--r--app/views/projects/settings/_general.html.haml2
-rw-r--r--app/views/projects/tree/_readme.html.haml2
-rw-r--r--app/views/shared/_clone_panel.html.haml5
-rw-r--r--app/views/shared/_import_form.html.haml3
-rw-r--r--app/views/shared/_label_row.html.haml1
-rw-r--r--app/views/shared/_mini_pipeline_graph.html.haml4
-rw-r--r--app/views/shared/icons/_emoji_slightly_smiling_face.svg1
-rw-r--r--app/views/shared/icons/_emoji_smile.svg1
-rw-r--r--app/views/shared/icons/_emoji_smiley.svg1
-rw-r--r--app/views/shared/issuable/_sidebar.html.haml2
-rw-r--r--app/views/shared/milestones/_top.html.haml27
-rw-r--r--app/views/snippets/_actions.html.haml2
-rw-r--r--app/views/snippets/notes/_actions.html.haml6
-rw-r--r--app/views/users/show.html.haml6
-rw-r--r--app/workers/build_finished_worker.rb1
-rw-r--r--app/workers/cluster_configure_worker.rb2
-rw-r--r--app/workers/git_garbage_collect_worker.rb4
-rw-r--r--app/workers/pages_domain_removal_cron_worker.rb2
-rw-r--r--app/workers/process_commit_worker.rb2
-rw-r--r--changelogs/unreleased/10012-move-ee-diff-for-boards-issue-card-inner.yml5
-rw-r--r--changelogs/unreleased/10083-dropdown-ce-ee-difference.yml5
-rw-r--r--changelogs/unreleased/10327-enable-reliable-fetcher-by-default.yml5
-rw-r--r--changelogs/unreleased/10798-remove-dind-req-for-dast.yml5
-rw-r--r--changelogs/unreleased/10808-allow-license-import-during-install.yml5
-rw-r--r--changelogs/unreleased/10921-display-scoped-labels-ce.yml5
-rw-r--r--changelogs/unreleased/11254-overflow-ce.yml5
-rw-r--r--changelogs/unreleased/1340-request-job-with-age.yml5
-rw-r--r--changelogs/unreleased/13453_minimal_atom_fix.yml5
-rw-r--r--changelogs/unreleased/18432-switch-to-sassc-rails.yml5
-rw-r--r--changelogs/unreleased/19569-include-information-if-issue-was-closed-via-mr.yml5
-rw-r--r--changelogs/unreleased/237-style-toast-component.yml5
-rw-r--r--changelogs/unreleased/24704-download-repository-path.yml5
-rw-r--r--changelogs/unreleased/24985-align-urlvalidator-to-validate_url-gem-implementation.yml5
-rw-r--r--changelogs/unreleased/25604-add-dotnet-core-yaml-template.yml5
-rw-r--r--changelogs/unreleased/26021-added-write_repository-scope-for-personal-access-token.yml5
-rw-r--r--changelogs/unreleased/27383-added_omniauth_openid_connect_startegy.yml5
-rw-r--r--changelogs/unreleased/27424-tklk-gitea-logo.yml5
-rw-r--r--changelogs/unreleased/28119-remove-note-multi-line-suggestions.yml5
-rw-r--r--changelogs/unreleased/28741-play-all-manual-jobs.yml5
-rw-r--r--changelogs/unreleased/30093-apply-bfg-object-map-to-database.yml5
-rw-r--r--changelogs/unreleased/30157-api-expose-single-environment.yml5
-rw-r--r--changelogs/unreleased/31331-add-time-tracking-issue-boards-sidebar.yml5
-rw-r--r--changelogs/unreleased/39304-broadcast-message-buttons.yml5
-rw-r--r--changelogs/unreleased/46048-canary-next.yml5
-rw-r--r--changelogs/unreleased/46806-typed-ci-variables.yml5
-rw-r--r--changelogs/unreleased/47327-fix-github-import-visibility.yml5
-rw-r--r--changelogs/unreleased/47584-label-text-color.yml5
-rw-r--r--changelogs/unreleased/48479-auto-direction-for-issue-title.yml5
-rw-r--r--changelogs/unreleased/49041-issue-board-input-height.yml5
-rw-r--r--changelogs/unreleased/49517-fix-notes-import-export.yml5
-rw-r--r--changelogs/unreleased/49915-fix-error-500-admin-projects-nil-storage.yml5
-rw-r--r--changelogs/unreleased/50926-sort-by-due-date-and-popularity.yml5
-rw-r--r--changelogs/unreleased/51963-support-prometheus-for-group-level-clusters.yml5
-rw-r--r--changelogs/unreleased/53064-bypassing-pipeline-jobs-by-canceling-the-pipeline-and-manually-running-later-jobs.yml5
-rw-r--r--changelogs/unreleased/53138-add-metrics-usage-ping.yml5
-rw-r--r--changelogs/unreleased/53279-fix-updated_at-api.yml5
-rw-r--r--changelogs/unreleased/53973-fix-subpixel-border-issue.yml5
-rw-r--r--changelogs/unreleased/54405-resolve-discussion-when-applying-a-suggested-change.yml5
-rw-r--r--changelogs/unreleased/55127-add-delay-after-mr-creation-for-async-tasks-to-complete.yml5
-rw-r--r--changelogs/unreleased/55948-help-text-formatting-wiki.yml5
-rw-r--r--changelogs/unreleased/56557-disable-kubernetes-namespace-service-account-backend.yml5
-rw-r--r--changelogs/unreleased/56838-allow-guest-access-to-releases.yml5
-rw-r--r--changelogs/unreleased/57017-add-toast-success-message.yml5
-rw-r--r--changelogs/unreleased/57077-add-salesforce-omniauth.yml5
-rw-r--r--changelogs/unreleased/57171-add-dashboard-settings.yml5
-rw-r--r--changelogs/unreleased/57247-show-prioritized-labels-to-guests.yml5
-rw-r--r--changelogs/unreleased/57293-fix-image-rename.yml5
-rw-r--r--changelogs/unreleased/57654-add-time-preferences-for-user-fe.yml5
-rw-r--r--changelogs/unreleased/57815.yml5
-rw-r--r--changelogs/unreleased/58105-pipeline-author-and-commit-author-too-close-together-in-pipeline-list.yml5
-rw-r--r--changelogs/unreleased/58252-web-ide-dropdown-duplicates.yml5
-rw-r--r--changelogs/unreleased/58293-extract-discussion-actions.yml5
-rw-r--r--changelogs/unreleased/58294-discussion-notes-component.yml5
-rw-r--r--changelogs/unreleased/58361-issue-create-system-note-timestamp.yml5
-rw-r--r--changelogs/unreleased/58538-discussion-top-radius.yml5
-rw-r--r--changelogs/unreleased/58748-update-nodejs-to-10-15-3.yml5
-rw-r--r--changelogs/unreleased/58850-fix-misplaced-swipe-view-26969.yml5
-rw-r--r--changelogs/unreleased/59026-replace-favicon.yml5
-rw-r--r--changelogs/unreleased/59034-external-link-button.yml5
-rw-r--r--changelogs/unreleased/59105-padding-unclickable-pipeline-job.yml5
-rw-r--r--changelogs/unreleased/59275-cluster-form-hints.yml5
-rw-r--r--changelogs/unreleased/59514-uploading-images-base64.yml5
-rw-r--r--changelogs/unreleased/5966-rebase-with-block.yml5
-rw-r--r--changelogs/unreleased/59708-vendor-css.yml5
-rw-r--r--changelogs/unreleased/59921-pipeline-schedule.yml5
-rw-r--r--changelogs/unreleased/60026-group-member-count-bg.yml5
-rw-r--r--changelogs/unreleased/60224-btn-env.yml5
-rw-r--r--changelogs/unreleased/60250-remove-mr_push_options-flag.yml5
-rw-r--r--changelogs/unreleased/60261-save-btn-env.yml5
-rw-r--r--changelogs/unreleased/60379-remove-ci-preparing-state-feature-flag.yml5
-rw-r--r--changelogs/unreleased/60387-use-icons-in-user-popovers.yml5
-rw-r--r--changelogs/unreleased/60462-empty-pipeline-section.yml5
-rw-r--r--changelogs/unreleased/60552-period-dropdown.yml5
-rw-r--r--changelogs/unreleased/60750-milestone-header.yml5
-rw-r--r--changelogs/unreleased/60777-uninstall-button.yml5
-rw-r--r--changelogs/unreleased/60808-only-show-target-branch-advanced-error-before-merge.yml6
-rw-r--r--changelogs/unreleased/60818_yamllint_project_root.yml5
-rw-r--r--changelogs/unreleased/60874-fix-suggestion-misalignment.yml5
-rw-r--r--changelogs/unreleased/61036-fix-ingress-base-domain-text.yml5
-rw-r--r--changelogs/unreleased/61049-links-activity-stream.yml5
-rw-r--r--changelogs/unreleased/61203-fix-lfs-ui-upload.yml5
-rw-r--r--changelogs/unreleased/61278-next.yml5
-rw-r--r--changelogs/unreleased/61313-fix-dropdown-searchbar.yml5
-rw-r--r--changelogs/unreleased/61324-non-project-snippet-new-snippet-button-should-be-green-outline.yml5
-rw-r--r--changelogs/unreleased/61393-emoji-button.yml5
-rw-r--r--changelogs/unreleased/61441.yml5
-rw-r--r--changelogs/unreleased/61469-align-play-icon.yml5
-rw-r--r--changelogs/unreleased/61494-set-status-modal-visual-bugs.yml5
-rw-r--r--changelogs/unreleased/61550-next-badge.yml5
-rw-r--r--changelogs/unreleased/61629-dependency-installation-error-on-fsevents-1-2-4-with-node-js-12.yml5
-rw-r--r--changelogs/unreleased/61697-add-project-id-to-le-common-name.yml5
-rw-r--r--changelogs/unreleased/61795-fix-error-when-moving-issues.yml5
-rw-r--r--changelogs/unreleased/61880-download-btn-group.yml5
-rw-r--r--changelogs/unreleased/61914-fix-emojis-urls.yml5
-rw-r--r--changelogs/unreleased/61928-remove-throttle-from-dirty-submit.yml6
-rw-r--r--changelogs/unreleased/61990-spinner.yml5
-rw-r--r--changelogs/unreleased/62061-note-icon-color.yml5
-rw-r--r--changelogs/unreleased/62107-fix-detail-page-header-height.yml5
-rw-r--r--changelogs/unreleased/62116-performance-issue-502-errors-on-rendering-of-issues-with-heavy-markdown-contents.yml6
-rw-r--r--changelogs/unreleased/8723-geo-remove-gitlab-lfstoken-legacyredisdevisetoken-implementation-and-usage-geo.yml5
-rw-r--r--changelogs/unreleased/ac-package-storage-stats.yml5
-rw-r--r--changelogs/unreleased/add-allow_failure-to-job-api.yml5
-rw-r--r--changelogs/unreleased/add-branch-to-project-search-api.yml5
-rw-r--r--changelogs/unreleased/add-ci-variable-protected-ref.yml5
-rw-r--r--changelogs/unreleased/add-runner-access-level-registration.yml5
-rw-r--r--changelogs/unreleased/allow-replying-to-individual-notes-from-api.yml5
-rw-r--r--changelogs/unreleased/always-link-instance-configuration.yml5
-rw-r--r--changelogs/unreleased/an-use-labkit.yml5
-rw-r--r--changelogs/unreleased/api_masked_variables.yml5
-rw-r--r--changelogs/unreleased/autodevops_remote_private_helm_repository.yml6
-rw-r--r--changelogs/unreleased/bw-add-graphql-groups.yml5
-rw-r--r--changelogs/unreleased/ce-10725-restructure-project-merge-request-settings-page.yml5
-rw-r--r--changelogs/unreleased/ce-11430-update_clair_local_scan.yml5
-rw-r--r--changelogs/unreleased/ce-11542-remove-non-semantic-use-of-row-in-member-listing-controls.yml5
-rw-r--r--changelogs/unreleased/ce-4681-autosave.yml5
-rw-r--r--changelogs/unreleased/ce-57402-add-issues-statistics-api-endpoints.yml5
-rw-r--r--changelogs/unreleased/ce-its-simple-just-destroy-the-mirrors.yml5
-rw-r--r--changelogs/unreleased/ce-quick-fix-58727-collapsed-sidebar-flyout-menu-items-don-t-appear-in-1200px-screen-size.yml5
-rw-r--r--changelogs/unreleased/ce-remove-already-signed-in.yml5
-rw-r--r--changelogs/unreleased/ci-lint-ssl-error.yml6
-rw-r--r--changelogs/unreleased/da-sentry-client-side-settings.yml5
-rw-r--r--changelogs/unreleased/delay-update-statictics.yml5
-rw-r--r--changelogs/unreleased/diff-whitespace-setting-changes.yml5
-rw-r--r--changelogs/unreleased/display-junit-classname-in-modal.yml5
-rw-r--r--changelogs/unreleased/do-not-reopen-merged-mr.yml5
-rw-r--r--changelogs/unreleased/downloading-expired-artifacts.yml5
-rw-r--r--changelogs/unreleased/dz-patch-58.yml5
-rw-r--r--changelogs/unreleased/dz-scope-project-routes.yml5
-rw-r--r--changelogs/unreleased/expand-diff-performance.yml5
-rw-r--r--changelogs/unreleased/expose-pipeline-variables-via-api.yml5
-rw-r--r--changelogs/unreleased/feat-sentry-environment.yml5
-rw-r--r--changelogs/unreleased/fix-api-group-visibility.yml5
-rw-r--r--changelogs/unreleased/fix-api-ide-relative-url-root.yml5
-rw-r--r--changelogs/unreleased/fix-db-migrate-is-failed-on-mysql8.yml5
-rw-r--r--changelogs/unreleased/fix-extra-emails-for-custom-notifications.yml5
-rw-r--r--changelogs/unreleased/fix-ide-relative-url-bug.yml5
-rw-r--r--changelogs/unreleased/fix-import-member-access.yml5
-rw-r--r--changelogs/unreleased/fix-js-error-ssh-key-view.yml5
-rw-r--r--changelogs/unreleased/fix-lazy-blobs-requesting-all-previous-blobs.yml6
-rw-r--r--changelogs/unreleased/fix-merge-request-pipeline-exist-method.yml5
-rw-r--r--changelogs/unreleased/fix-project-visibility-level-validation.yml5
-rw-r--r--changelogs/unreleased/fix-schedule-head-pipeline-update-method.yml5
-rw-r--r--changelogs/unreleased/fix-too-many-loops-cron-error.yml5
-rw-r--r--changelogs/unreleased/fix-webpack-assets-relative-url-bug.yml5
-rw-r--r--changelogs/unreleased/fj-53523-add-option-avoid-loading-wiki-page-content.yml5
-rw-r--r--changelogs/unreleased/fj-59522-improve-search-controller-performance.yml5
-rw-r--r--changelogs/unreleased/fj-bump-workhorse-version-8-6-0.yml5
-rw-r--r--changelogs/unreleased/friendly-wrap-component.yml5
-rw-r--r--changelogs/unreleased/frozen-string-spec-some.yml5
-rw-r--r--changelogs/unreleased/gitaly-version-v1.36.0.yml5
-rw-r--r--changelogs/unreleased/gitaly-version-v1.42.0.yml5
-rw-r--r--changelogs/unreleased/gitlab-issue-54894.yml6
-rw-r--r--changelogs/unreleased/graphql-resolvers-complexity.yml6
-rw-r--r--changelogs/unreleased/include-ee-fixtures.yml5
-rw-r--r--changelogs/unreleased/instance-configuration-artifact-size.yml5
-rw-r--r--changelogs/unreleased/instance_level_clusters.yml5
-rw-r--r--changelogs/unreleased/issue-42692-deployment-chat-notifications.yml5
-rw-r--r--changelogs/unreleased/issue-58418-release-notes.yml5
-rw-r--r--changelogs/unreleased/issue-61038-deploy-chat-message-update.yml5
-rw-r--r--changelogs/unreleased/issue_57906_fix_github_import.yml5
-rw-r--r--changelogs/unreleased/jc-client-gitaly-session-id.yml5
-rw-r--r--changelogs/unreleased/jc-omit-count-diverging-commits-max.yml5
-rw-r--r--changelogs/unreleased/jc-update-list-last-commits.yml5
-rw-r--r--changelogs/unreleased/jupyter_pre_spawn_hook_v2.yml5
-rw-r--r--changelogs/unreleased/jv-dedup-activerecord.yml6
-rw-r--r--changelogs/unreleased/kinolaev-master-patch-13154.yml5
-rw-r--r--changelogs/unreleased/knative-0-5.yml5
-rw-r--r--changelogs/unreleased/leipert-node-12-compatibility.yml5
-rw-r--r--changelogs/unreleased/make-autocomplete-faster-with-lots-of-results.yml5
-rw-r--r--changelogs/unreleased/mark-comment-resolved.yml5
-rw-r--r--changelogs/unreleased/markdown-autocomplete-escaping.yml5
-rw-r--r--changelogs/unreleased/member-access-granted-leave-email-fe.yml5
-rw-r--r--changelogs/unreleased/mm12935.yml5
-rw-r--r--changelogs/unreleased/patch-49.yml5
-rw-r--r--changelogs/unreleased/patch-55.yml5
-rw-r--r--changelogs/unreleased/pl-upgrade-letter_opener_web.yml5
-rw-r--r--changelogs/unreleased/rails5-1.yml5
-rw-r--r--changelogs/unreleased/refactor-58827-migrate-issue-spec-to-jest.yml5
-rw-r--r--changelogs/unreleased/refactor-58829-migrate-notes-spec-to-jest.yml5
-rw-r--r--changelogs/unreleased/refactor-58830-migrate-sidebar-spec-to-jest.yml5
-rw-r--r--changelogs/unreleased/relative-urls-for-system-notes.yml5
-rw-r--r--changelogs/unreleased/remove-disabled-pages-domains-part-2.yml5
-rw-r--r--changelogs/unreleased/remove-disabled-pages-domains.yml5
-rw-r--r--changelogs/unreleased/rename_auto_deploy_app_links.yml5
-rw-r--r--changelogs/unreleased/require-all-templates-to-include-default-stages.yml5
-rw-r--r--changelogs/unreleased/rewind-iid-on-pipelines.yml5
-rw-r--r--changelogs/unreleased/sh-add-gitaly-backtrace.yml5
-rw-r--r--changelogs/unreleased/sh-allow-equal-level-in-subgroup-membership.yml5
-rw-r--r--changelogs/unreleased/sh-avoid-fetching-temp-refs-within-project.yml5
-rw-r--r--changelogs/unreleased/sh-cleanup-import-export.yml5
-rw-r--r--changelogs/unreleased/sh-disable-batch-load-replace-methods.yml5
-rw-r--r--changelogs/unreleased/sh-disable-internal-ids-available-check.yml5
-rw-r--r--changelogs/unreleased/sh-fix-autocomplete-mirror-repo.yml5
-rw-r--r--changelogs/unreleased/sh-fix-invited-members.yml5
-rw-r--r--changelogs/unreleased/sh-fix-lfs-download-errors.yml5
-rw-r--r--changelogs/unreleased/sh-fix-pipeline-delete-caching.yml5
-rw-r--r--changelogs/unreleased/sh-fix-rebase-error-clearing.yml5
-rw-r--r--changelogs/unreleased/sh-fix-related-merge-requests-path.yml5
-rw-r--r--changelogs/unreleased/sh-fix-tag-push-remote-mirror.yml5
-rw-r--r--changelogs/unreleased/sh-project-import-visibility-error.yml5
-rw-r--r--changelogs/unreleased/sh-upgrade-grpc-and-protobuf.yml5
-rw-r--r--changelogs/unreleased/sh-validate-ref-name-in-commit.yml5
-rw-r--r--changelogs/unreleased/shell-9-1-0.yml5
-rw-r--r--changelogs/unreleased/show-disabled-mirrors.yml5
-rw-r--r--changelogs/unreleased/support-negative-matches.yml5
-rw-r--r--changelogs/unreleased/tc-raw-log-in-plaintext-mail.yml5
-rw-r--r--changelogs/unreleased/tortuetorche-gitlab-ce-patch-auto-deploy-extra-values.yml5
-rw-r--r--changelogs/unreleased/update-babel-to-7-4-4.yml5
-rw-r--r--changelogs/unreleased/update-gitaly-to-v1-42-1.yml5
-rw-r--r--changelogs/unreleased/update-gitlab-runner-helm-chart-to-0-4-0.yml5
-rw-r--r--changelogs/unreleased/update-gitlab-runner-helm-chart-to-0-4-1.yml5
-rw-r--r--changelogs/unreleased/update-gitlab-runner-helm-chart-to-0-5-0.yml5
-rw-r--r--changelogs/unreleased/update-smileys-new.yml5
-rw-r--r--changelogs/unreleased/update-workhorse-master.yml5
-rw-r--r--changelogs/unreleased/use-pg-10-7.yml5
-rw-r--r--changelogs/unreleased/weimeng-user-autocomplete-fix.yml5
-rw-r--r--changelogs/unreleased/wiki-search-results-fix.yml5
-rw-r--r--changelogs/unreleased/xanf-gitlab-ce-add-template-link.yml5
-rw-r--r--changelogs/unreleased/xanf-gitlab-ce-improve-project-overview.yml5
-rw-r--r--changelogs/unreleased/zj-fsck-no-timeout.yml5
-rw-r--r--changelogs/unreleased/zj-git-2-21-tests.yml5
-rw-r--r--changelogs/unreleased/zj-usage-ping-pool-repository.yml5
-rw-r--r--config/environments/test.rb2
-rw-r--r--config/initializers/8_devise.rb5
-rw-r--r--config/initializers/action_dispatch_http_mime_negotiation.rb2
-rw-r--r--config/karma.config.js28
-rw-r--r--config/puma.rb.example70
-rw-r--r--config/routes/admin.rb1
-rw-r--r--config/routes/project.rb45
-rw-r--r--config/routes/repository.rb2
-rw-r--r--config/unicorn.rb.example.development1
-rw-r--r--db/migrate/20150509180749_convert_legacy_reference_notes.rb3
-rw-r--r--db/migrate/20170330141723_disable_invalid_service_templates2.rb2
-rw-r--r--db/migrate/20190515125613_add_application_settings_elasticsearch_shards.rb10
-rw-r--r--db/migrate/20190516011213_add_build_queued_at_index.rb19
-rw-r--r--db/post_migrate/20190301081611_migrate_project_migrate_sidekiq_queue.rb2
-rw-r--r--db/post_migrate/20190424134256_drop_projects_ci_id.rb9
-rw-r--r--db/schema.rb5
-rw-r--r--doc/README.md115
-rw-r--r--doc/administration/dependency_proxy.md150
-rw-r--r--doc/administration/high_availability/nfs.md5
-rw-r--r--doc/administration/high_availability/nfs_host_client_setup.md2
-rw-r--r--doc/administration/img/high_availability/fully-distributed.pngbin46918 -> 0 bytes
-rw-r--r--doc/administration/img/high_availability/geo-ha-diagram.pngbin43826 -> 0 bytes
-rw-r--r--doc/administration/img/high_availability/horizontal.pngbin18660 -> 0 bytes
-rw-r--r--doc/administration/img/high_availability/hybrid.pngbin20698 -> 0 bytes
-rw-r--r--doc/administration/monitoring/prometheus/gitlab_metrics.md13
-rw-r--r--doc/api/README.md2
-rw-r--r--doc/api/epic_issues.md412
-rw-r--r--doc/api/epic_links.md252
-rw-r--r--doc/api/epics.md360
-rw-r--r--doc/api/geo_nodes.md408
-rw-r--r--doc/api/graphql/index.md15
-rw-r--r--doc/api/issue_links.md215
-rw-r--r--doc/api/issues.md66
-rw-r--r--doc/api/issues_statistics.md177
-rw-r--r--doc/api/jobs.md10
-rw-r--r--doc/api/license.md176
-rw-r--r--doc/api/license_templates.md5
-rw-r--r--doc/api/managed_licenses.md136
-rw-r--r--doc/api/merge_request_approvals.md425
-rw-r--r--doc/api/packages.md152
-rw-r--r--doc/api/project_level_variables.md12
-rw-r--r--doc/api/repository_files.md2
-rw-r--r--doc/api/scim.md235
-rw-r--r--doc/api/search.md5
-rw-r--r--doc/api/vulnerabilities.md113
-rw-r--r--doc/ci/ci_cd_for_external_repos/img/github_omniauth_list.pngbin9613 -> 0 bytes
-rw-r--r--doc/ci/environments.md4
-rw-r--r--doc/ci/examples/README.md48
-rw-r--r--doc/ci/examples/deploy_spring_boot_to_cloud_foundry/index.md6
-rw-r--r--doc/ci/examples/laravel_with_gitlab_and_envoy/img/laravel_with_gitlab_and_envoy.pngbin177704 -> 0 bytes
-rw-r--r--doc/ci/examples/test-and-deploy-python-application-to-heroku.md9
-rw-r--r--doc/ci/examples/test_phoenix_app_with_gitlab_ci_cd/img/job-succeeded.pngbin23148 -> 0 bytes
-rw-r--r--doc/ci/introduction/index.md2
-rw-r--r--doc/ci/merge_request_pipelines/img/pipeline_detail.pngbin15556 -> 0 bytes
-rw-r--r--doc/ci/merge_request_pipelines/index.md15
-rw-r--r--doc/ci/pipelines.md13
-rw-r--r--doc/ci/runners/shared_to_specific_admin.pngbin5715 -> 0 bytes
-rw-r--r--doc/ci/services/mysql.md27
-rw-r--r--doc/ci/variables/README.md25
-rw-r--r--doc/ci/variables/img/new_custom_variables_example.pngbin70758 -> 216497 bytes
-rw-r--r--doc/ci/variables/img/variable_types_usage_example.pngbin0 -> 67003 bytes
-rw-r--r--doc/ci/yaml/README.md8
-rw-r--r--doc/development/README.md6
-rw-r--r--doc/development/architecture.md608
-rw-r--r--doc/development/changelog.md1
-rw-r--r--doc/development/contributing/issue_workflow.md52
-rw-r--r--doc/development/documentation/index.md55
-rw-r--r--doc/development/ee_features.md24
-rw-r--r--doc/development/fe_guide/vuex.md4
-rw-r--r--doc/development/feature_flags.md8
-rw-r--r--doc/development/gitlab_architecture_diagram.pngbin34253 -> 0 bytes
-rw-r--r--doc/development/go_guide/index.md4
-rw-r--r--doc/development/i18n/externalization.md1
-rw-r--r--doc/development/i18n/proofreader.md3
-rw-r--r--doc/development/migration_style_guide.md6
-rw-r--r--doc/development/rolling_out_changes_using_feature_flags.md11
-rw-r--r--doc/development/session.md65
-rw-r--r--doc/development/testing_guide/best_practices.md30
-rw-r--r--doc/development/testing_guide/frontend_testing.md17
-rw-r--r--doc/development/testing_guide/review_apps.md22
-rw-r--r--doc/development/ux_guide/img/animation-autoscroll.gifbin302217 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/animation-dropdown.gifbin22483 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/animation-hover.gifbin247388 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/animation-quickupdate.gifbin6441 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/animation-reorder.gifbin70515 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-close--active.pngbin1120 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-close--hover.pngbin765 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-close--resting.pngbin915 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-danger--active.pngbin1117 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-danger--hover.pngbin797 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-danger--resting.pngbin932 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-info--active.pngbin1109 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-info--hover.pngbin795 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-info--resting.pngbin930 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-primary.pngbin1550 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-secondary.pngbin2683 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-spam--active.pngbin1107 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-spam--hover.pngbin777 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-spam--resting.pngbin941 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-success--active.pngbin1153 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-success--hover.pngbin892 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-success--resting.pngbin1045 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-success-secondary--active.pngbin1107 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-success-secondary--hover.pngbin774 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-success-secondary--resting.pngbin945 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-warning--active.pngbin1124 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-warning--hover.pngbin790 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/button-warning--resting.pngbin925 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/color-blue.pngbin1751 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/color-green.pngbin1916 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/color-grey.pngbin1681 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/color-orange.pngbin2094 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/color-red.pngbin1739 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/color-textprimary.pngbin2553 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/color-textsecondary.pngbin2956 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-alerts.pngbin27342 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-anchorlinks.pngbin16457 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-contentblock.pngbin14190 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-counts.pngbin2438 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-coverblock.pngbin10110 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-dateexact.pngbin4157 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-daterelative.pngbin4189 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-dropdown.pngbin31760 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-fileholder.pngbin3884 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-horizontalform.pngbin4310 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-listinsidepanel.pngbin3380 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-listwithavatar.pngbin5749 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-listwithhover.pngbin2722 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-panels.pngbin21822 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-referencehover.pngbin6890 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-referenceissues.pngbin10002 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-referencelabels.pngbin4099 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-referencemilestone.pngbin2412 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-referencemrs.pngbin8857 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-referencepeople.pngbin5600 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-rowcontentblock.pngbin14315 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-searchbox.pngbin3596 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-searchboxscoped.pngbin6027 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-simplelist.pngbin2776 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-table.pngbin6081 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/components-verticalform.pngbin4964 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/cursors-default.pngbin567 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/cursors-ibeam.pngbin383 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/cursors-move.pngbin276 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/cursors-panclosed.pngbin483 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/cursors-panopened.pngbin622 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/cursors-pointer.pngbin574 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/features-contextualnav.pngbin5911 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/features-emptystates.pngbin61644 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/features-filters.pngbin3924 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/features-globalnav.pngbin5780 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/harry-robison.pngbin10712 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/icon-add.pngbin239 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/icon-close.pngbin301 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/icon-edit.pngbin315 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/icon-notification.pngbin379 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/icon-rss.pngbin528 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/icon-spec.pngbin7523 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/icon-subscribe.pngbin537 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/icon-trash.pngbin281 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/illustration-size-large-horizontal.pngbin55272 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/illustration-size-large-vertical.pngbin59217 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/illustration-size-medium.pngbin20994 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/illustration-size-small.pngbin43536 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/illustrations-border-radius.pngbin7779 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/illustrations-caps-do.pngbin3671 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/illustrations-caps-don't.pngbin3624 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/illustrations-color-grey.pngbin251 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/illustrations-color-orange.pngbin275 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/illustrations-color-purple.pngbin275 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/illustrations-geometric.pngbin5057 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/illustrations-palette-oragne.pngbin10439 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/illustrations-palette-purple.pngbin10002 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/james-mackey.pngbin11869 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/karolina-plaskaty.pngbin10355 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/matthieu-poirier.pngbin11483 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/modals-general-confimation-dialog.pngbin15650 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/modals-layout-for-modals.pngbin20060 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/modals-special-confimation-dialog.pngbin31419 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/modals-three-buttons.pngbin17457 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/monospacefont-sample.pngbin14282 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/nazim-ramesh.pngbin10488 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/popover-placement-above.pngbin20184 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/popover-placement-below.pngbin19967 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/skeleton-loading.gifbin1093917 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/sourcesanspro-sample.pngbin10948 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/steven-lyons.pngbin9323 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/surfaces-contentitemtitle.pngbin5139 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/surfaces-header.pngbin4095 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/surfaces-systeminformationblock.pngbin10422 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/surfaces-ux.pngbin4017 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/tooltip-placement.pngbin2066 -> 0 bytes
-rw-r--r--doc/development/ux_guide/img/tooltip-usage.pngbin5985 -> 0 bytes
-rw-r--r--doc/gitlab-basics/README.md6
-rw-r--r--doc/gitlab-basics/command-line-commands.md4
-rw-r--r--doc/gitlab-basics/img/new_issue_button.pngbin2010 -> 0 bytes
-rw-r--r--doc/gitlab-basics/img/new_issue_page.pngbin21386 -> 0 bytes
-rw-r--r--doc/gitlab-basics/img/public_file_link.pngbin3023 -> 0 bytes
-rw-r--r--doc/gitlab-basics/start-using-git.md24
-rw-r--r--doc/install/aws/img/add_tags.pngbin17834 -> 0 bytes
-rw-r--r--doc/install/aws/img/create_route_table.pngbin8293 -> 0 bytes
-rw-r--r--doc/install/azure/img/azure-vm-management-settings-network-interfaces.pngbin35849 -> 0 bytes
-rw-r--r--doc/install/azure/img/azure-vm-management.pngbin35363 -> 0 bytes
-rw-r--r--doc/install/installation.md48
-rw-r--r--doc/install/ldap.md4
-rw-r--r--doc/install/openshift_and_gitlab/img/pods-overview.pngbin42617 -> 0 bytes
-rw-r--r--doc/install/openshift_and_gitlab/img/storage-volumes.pngbin20007 -> 0 bytes
-rw-r--r--doc/integration/elasticsearch.md28
-rw-r--r--doc/integration/img/google_app.pngbin18853 -> 0 bytes
-rw-r--r--doc/license/README.md2
-rw-r--r--doc/monitoring/performance/img/grafana_dashboard_dropdown.pngbin7761 -> 0 bytes
-rw-r--r--doc/monitoring/performance/img/grafana_dashboard_import.pngbin11835 -> 0 bytes
-rw-r--r--doc/monitoring/performance/img/grafana_data_source_configuration.pngbin14695 -> 0 bytes
-rw-r--r--doc/monitoring/performance/img/grafana_data_source_empty.pngbin11960 -> 0 bytes
-rw-r--r--doc/monitoring/performance/img/grafana_save_icon.pngbin4598 -> 0 bytes
-rw-r--r--doc/monitoring/performance/img/metrics_gitlab_configuration_settings.pngbin21382 -> 0 bytes
-rw-r--r--doc/topics/authentication/index.md10
-rw-r--r--doc/topics/autodevops/img/autodevops_domain_variables.pngbin8456 -> 0 bytes
-rw-r--r--doc/topics/autodevops/img/guide_connect_cluster.pngbin15225 -> 0 bytes
-rw-r--r--doc/topics/autodevops/img/guide_create_cluster.pngbin18915 -> 0 bytes
-rw-r--r--doc/topics/autodevops/img/guide_gke_apis_after.pngbin26811 -> 0 bytes
-rw-r--r--doc/topics/autodevops/img/guide_gke_apis_before.pngbin14882 -> 0 bytes
-rw-r--r--doc/topics/autodevops/img/guide_merge_request_ide.pngbin35052 -> 0 bytes
-rw-r--r--doc/topics/autodevops/index.md5
-rw-r--r--doc/university/high-availability/aws/img/elastic-file-system.pngbin34582 -> 0 bytes
-rw-r--r--doc/update/patch_versions.md2
-rw-r--r--doc/update/upgrading_from_source.md16
-rw-r--r--doc/user/admin_area/img/license_no_license_message.pngbin5778 -> 0 bytes
-rw-r--r--doc/user/admin_area/index.md28
-rw-r--r--doc/user/admin_area/settings/continuous_integration.md26
-rw-r--r--doc/user/admin_area/settings/email.md24
-rw-r--r--doc/user/admin_area/settings/external_authorization.md16
-rw-r--r--doc/user/admin_area/settings/img/admin_area_default_artifacts_expiration.pngbin5360 -> 0 bytes
-rw-r--r--doc/user/admin_area/settings/img/admin_area_group_edit.pngbin5869 -> 0 bytes
-rw-r--r--doc/user/admin_area/settings/img/admin_area_groups.pngbin12088 -> 0 bytes
-rw-r--r--doc/user/admin_area/settings/img/admin_area_maximum_artifacts_size.pngbin4771 -> 0 bytes
-rw-r--r--doc/user/admin_area/settings/img/ci_shared_runners_build_minutes_quota.pngbin6000 -> 0 bytes
-rw-r--r--doc/user/admin_area/settings/img/group_quota_view.pngbin1797 -> 0 bytes
-rw-r--r--doc/user/admin_area/settings/img/group_settings.pngbin3345 -> 0 bytes
-rw-r--r--doc/user/application_security/container_scanning/index.md6
-rw-r--r--doc/user/application_security/dast/index.md7
-rw-r--r--doc/user/application_security/dependency_scanning/index.md3
-rw-r--r--doc/user/application_security/security_dashboard/img/dashboard.pngbin66467 -> 58585 bytes
-rw-r--r--doc/user/group/clusters/index.md8
-rw-r--r--doc/user/group/custom_project_templates.md2
-rw-r--r--doc/user/group/dependency_proxy/img/group_dependency_proxy.pngbin0 -> 40162 bytes
-rw-r--r--doc/user/group/dependency_proxy/index.md74
-rw-r--r--doc/user/group/img/group_issue_board.pngbin63528 -> 0 bytes
-rw-r--r--doc/user/group/img/new_group_form.pngbin32510 -> 0 bytes
-rw-r--r--doc/user/group/index.md208
-rw-r--r--doc/user/group/insights/img/insights_sidebar_link.pngbin0 -> 18826 bytes
-rw-r--r--doc/user/group/insights/index.md11
-rw-r--r--doc/user/group/saml_sso/index.md12
-rw-r--r--doc/user/instance/clusters/index.md23
-rw-r--r--doc/user/markdown.md10
-rw-r--r--doc/user/permissions.md2
-rw-r--r--doc/user/project/clusters/index.md23
-rw-r--r--doc/user/project/code_owners.md2
-rw-r--r--doc/user/project/img/assignee_lists.pngbin134635 -> 0 bytes
-rw-r--r--doc/user/project/img/issue_board.pngbin284759 -> 0 bytes
-rw-r--r--doc/user/project/img/labels_sidebar_inline.pngbin11083 -> 0 bytes
-rw-r--r--doc/user/project/img/priority_sort_order.pngbin69978 -> 0 bytes
-rw-r--r--doc/user/project/img/project_security_dashboard.pngbin49062 -> 0 bytes
-rw-r--r--doc/user/project/img/protected_branches_choose_branch.pngbin7009 -> 0 bytes
-rw-r--r--doc/user/project/img/protected_branches_error_ui.pngbin13117 -> 0 bytes
-rw-r--r--doc/user/project/import/img/import_projects_from_github_select_auth_method.pngbin17611 -> 0 bytes
-rw-r--r--doc/user/project/insights/img/insights_sidebar_link.pngbin0 -> 21463 bytes
-rw-r--r--doc/user/project/insights/index.md16
-rw-r--r--doc/user/project/integrations/img/jira_project_name.pngbin26680 -> 0 bytes
-rw-r--r--doc/user/project/integrations/img/jira_service.pngbin36976 -> 0 bytes
-rw-r--r--doc/user/project/integrations/img/mattermost_configuration.pngbin101151 -> 67672 bytes
-rw-r--r--doc/user/project/integrations/img/prometheus_yaml_deploy.pngbin9456 -> 0 bytes
-rw-r--r--doc/user/project/integrations/img/slack_configuration.pngbin92179 -> 64873 bytes
-rw-r--r--doc/user/project/integrations/mattermost.md2
-rw-r--r--doc/user/project/integrations/prometheus.md2
-rw-r--r--doc/user/project/integrations/webhooks.md2
-rw-r--r--doc/user/project/issues/csv_import.md20
-rw-r--r--doc/user/project/issues/img/group_issues_list_view.pngbin46595 -> 0 bytes
-rw-r--r--doc/user/project/issues/img/issue_template.pngbin25019 -> 0 bytes
-rw-r--r--doc/user/project/labels.md2
-rw-r--r--doc/user/project/members/img/add_new_user_to_project_settings.pngbin11004 -> 0 bytes
-rw-r--r--doc/user/project/members/img/add_user_members_menu.pngbin28988 -> 0 bytes
-rw-r--r--doc/user/project/members/img/max_access_level.pngbin34710 -> 0 bytes
-rw-r--r--doc/user/project/merge_requests/img/container_scanning.pngbin32549 -> 0 bytes
-rw-r--r--doc/user/project/merge_requests/img/create-issue-with-list-hover.pngbin106954 -> 0 bytes
-rw-r--r--doc/user/project/merge_requests/img/dast_all.pngbin25844 -> 0 bytes
-rw-r--r--doc/user/project/merge_requests/img/dast_single.pngbin69353 -> 0 bytes
-rw-r--r--doc/user/project/merge_requests/img/dependency_scanning.pngbin16167 -> 0 bytes
-rw-r--r--doc/user/project/merge_requests/img/interactive_reports.pngbin23190 -> 0 bytes
-rw-r--r--doc/user/project/merge_requests/img/license_management.pngbin5184 -> 0 bytes
-rw-r--r--doc/user/project/merge_requests/img/license_management_decision.pngbin5981 -> 0 bytes
-rw-r--r--doc/user/project/merge_requests/img/license_management_pipeline_tab.pngbin12115 -> 0 bytes
-rw-r--r--doc/user/project/merge_requests/img/license_management_settings.pngbin13300 -> 0 bytes
-rw-r--r--doc/user/project/merge_requests/img/revert_changes_commit.pngbin95647 -> 0 bytes
-rw-r--r--doc/user/project/merge_requests/img/revert_changes_mr.pngbin104954 -> 0 bytes
-rw-r--r--doc/user/project/merge_requests/img/sast.pngbin24876 -> 0 bytes
-rw-r--r--doc/user/project/merge_requests/img/security_report.pngbin38475 -> 0 bytes
-rw-r--r--doc/user/project/merge_requests/img/vulnerability_solution.pngbin3421 -> 0 bytes
-rw-r--r--doc/user/project/merge_requests/index.md14
-rw-r--r--doc/user/project/merge_requests/merge_request_approvals.md17
-rw-r--r--doc/user/project/pages/img/pages_create_project.pngbin6062 -> 0 bytes
-rw-r--r--doc/user/project/pages/img/pages_create_user_page.pngbin14435 -> 0 bytes
-rw-r--r--doc/user/project/pages/img/pages_dns_details.pngbin5350 -> 0 bytes
-rw-r--r--doc/user/project/pages/img/pages_multiple_domains.pngbin12930 -> 0 bytes
-rw-r--r--doc/user/project/pages/img/pages_new_domain_button.pngbin8763 -> 0 bytes
-rw-r--r--doc/user/project/pages/img/pages_upload_cert.pngbin22888 -> 0 bytes
-rw-r--r--doc/user/project/repository/index.md12
-rw-r--r--doc/user/project/settings/import_export.md1
-rw-r--r--doc/user/project/web_ide/img/enable_web_ide.pngbin11364 -> 0 bytes
-rw-r--r--doc/user/project/web_ide/index.md39
-rw-r--r--doc/user/project/wiki/index.md10
-rw-r--r--doc/user/search/img/issues_any_assignee.pngbin90455 -> 0 bytes
-rw-r--r--doc/user/search/img/issues_author.pngbin55217 -> 0 bytes
-rw-r--r--doc/workflow/award_emoji.pngbin5268 -> 0 bytes
-rw-r--r--doc/workflow/img/new_branch_from_issue.pngbin33584 -> 0 bytes
-rw-r--r--doc/workflow/lfs/manage_large_binaries_with_git_lfs.md5
-rw-r--r--doc/workflow/share_with_group.pngbin50450 -> 0 bytes
-rw-r--r--doc/workflow/timezone.md26
-rw-r--r--fixtures/emojis/index.json2
-rw-r--r--haml_lint/inline_javascript.rb (renamed from lib/haml_lint/inline_javascript.rb)2
-rw-r--r--haml_lint/linter/no_plain_nodes.rb84
-rw-r--r--lib/api/entities.rb22
-rw-r--r--lib/api/groups.rb24
-rw-r--r--lib/api/helpers/groups_helpers.rb9
-rw-r--r--lib/api/helpers/internal_helpers.rb2
-rw-r--r--lib/api/helpers/issues_helpers.rb33
-rw-r--r--lib/api/internal.rb8
-rw-r--r--lib/api/issues.rb101
-rw-r--r--lib/api/merge_requests.rb4
-rw-r--r--lib/api/runner.rb1
-rw-r--r--lib/api/search.rb3
-rw-r--r--lib/api/validations/check_assignees_count.rb32
-rw-r--r--lib/api/variables.rb2
-rw-r--r--lib/bitbucket_server/representation/repo.rb2
-rw-r--r--lib/gitlab/background_migration/fix_cross_project_label_links.rb2
-rw-r--r--lib/gitlab/ci/pipeline/chain/limit/activity.rb4
-rw-r--r--lib/gitlab/ci/pipeline/chain/limit/size.rb4
-rw-r--r--lib/gitlab/ci/templates/Docker.gitlab-ci.yml21
-rw-r--r--lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml9
-rw-r--r--lib/gitlab/ci/templates/Security/DAST.gitlab-ci.yml57
-rw-r--r--lib/gitlab/ci/templates/dotNET-Core.yml91
-rw-r--r--lib/gitlab/config/entry/validators.rb6
-rw-r--r--lib/gitlab/danger/helper.rb2
-rw-r--r--lib/gitlab/git/repository.rb2
-rw-r--r--lib/gitlab/git/rugged_impl/tree.rb2
-rw-r--r--lib/gitlab/gitaly_client/commit_service.rb2
-rw-r--r--lib/gitlab/import_export/import_export.yml2
-rw-r--r--lib/gitlab/import_export/members_mapper.rb6
-rw-r--r--lib/gitlab/import_export/project_tree_restorer.rb2
-rw-r--r--lib/gitlab/lets_encrypt/challenge.rb17
-rw-r--r--lib/gitlab/lets_encrypt/client.rb74
-rw-r--r--lib/gitlab/lets_encrypt/order.rb23
-rw-r--r--lib/gitlab/lfs_token.rb42
-rw-r--r--lib/gitlab/metrics/samplers/ruby_sampler.rb31
-rw-r--r--lib/gitlab/metrics/samplers/unicorn_sampler.rb32
-rw-r--r--lib/gitlab/metrics/system.rb23
-rw-r--r--lib/gitlab/path_regex.rb1
-rw-r--r--lib/gitlab/prometheus/query_variables.rb3
-rw-r--r--lib/gitlab/routing.rb2
-rw-r--r--lib/gitlab/sentry.rb15
-rw-r--r--lib/gitlab/usage_data.rb11
-rw-r--r--lib/mattermost/session.rb2
-rwxr-xr-xlib/support/init.d/gitlab37
-rw-r--r--lib/support/init.d/gitlab.default.example3
-rw-r--r--lib/system_check/base_check.rb2
-rw-r--r--lib/tasks/haml-lint.rake2
-rw-r--r--lib/tasks/lint.rake35
-rw-r--r--locale/gitlab.pot131
-rw-r--r--package.json15
-rw-r--r--public/visual-review-toolbar.js626
-rw-r--r--qa/docs/BEST_PRACTICES.md2
-rw-r--r--qa/docs/WRITING_TESTS_FROM_SCRATCH.md112
-rw-r--r--qa/qa/resource/README.md2
-rw-r--r--qa/qa/resource/ci_variable.rb27
-rw-r--r--qa/qa/resource/project.rb1
-rw-r--r--qa/qa/runtime/browser.rb6
-rw-r--r--qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb3
-rw-r--r--qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb2
-rw-r--r--qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_ci_variable_spec.rb14
-rw-r--r--qa/spec/spec_helper.rb8
-rw-r--r--rubocop/cop/code_reuse/active_record.rb3
-rwxr-xr-xscripts/clean-old-cached-assets4
-rw-r--r--scripts/frontend/stylelint/stylelint-utility-map.js2
-rwxr-xr-xscripts/frontend/test.js114
-rw-r--r--spec/controllers/application_controller_spec.rb21
-rw-r--r--spec/controllers/concerns/project_unauthorized_spec.rb2
-rw-r--r--spec/controllers/concerns/routable_actions_spec.rb156
-rw-r--r--spec/controllers/concerns/send_file_upload_spec.rb3
-rw-r--r--spec/controllers/projects/environments_controller_spec.rb22
-rw-r--r--spec/controllers/registrations_controller_spec.rb19
-rw-r--r--spec/factories/uploads.rb2
-rw-r--r--spec/features/admin/admin_sees_project_statistics_spec.rb29
-rw-r--r--spec/features/admin/admin_sees_projects_statistics_spec.rb20
-rw-r--r--spec/features/projects/files/files_sort_submodules_with_folders_spec.rb2
-rw-r--r--spec/features/projects/files/user_browses_files_spec.rb1
-rw-r--r--spec/features/projects/files/user_browses_lfs_files_spec.rb2
-rw-r--r--spec/features/projects/files/user_creates_directory_spec.rb2
-rw-r--r--spec/features/projects/files/user_deletes_files_spec.rb2
-rw-r--r--spec/features/projects/files/user_edits_files_spec.rb1
-rw-r--r--spec/features/projects/files/user_replaces_files_spec.rb2
-rw-r--r--spec/features/projects/files/user_uploads_files_spec.rb2
-rw-r--r--spec/features/projects/tree/tree_show_spec.rb1
-rw-r--r--spec/features/projects_spec.rb1
-rw-r--r--spec/fixtures/api/schemas/entities/test_case.json1
-rw-r--r--spec/fixtures/api/schemas/public_api/v4/job.json1
-rw-r--r--spec/fixtures/api/schemas/public_api/v4/label_basic.json24
-rw-r--r--spec/frontend/boards/stores/actions_spec.js67
-rw-r--r--spec/frontend/boards/stores/mutations_spec.js91
-rw-r--r--spec/frontend/boards/stores/state_spec.js11
-rw-r--r--spec/frontend/environment.js10
-rw-r--r--spec/frontend/gfm_auto_complete_spec.js3
-rw-r--r--spec/frontend/helpers/text_helper.js (renamed from spec/frontend/helpers/vue_component_helper.js)0
-rw-r--r--spec/frontend/helpers/timeout.js27
-rw-r--r--spec/frontend/lib/utils/text_utility_spec.js4
-rw-r--r--spec/frontend/notes/components/discussion_notes_spec.js3
-rw-r--r--spec/frontend/pages/admin/abuse_reports/abuse_reports_spec.js3
-rw-r--r--spec/frontend/reports/components/report_item_spec.js33
-rw-r--r--spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap33
-rw-r--r--spec/frontend/repository/components/table/index_spec.js47
-rw-r--r--spec/frontend/repository/components/table/row_spec.js85
-rw-r--r--spec/frontend/repository/router_spec.js23
-rw-r--r--spec/frontend/repository/utils/icon_spec.js23
-rw-r--r--spec/frontend/serverless/components/function_row_spec.js29
-rw-r--r--spec/frontend/serverless/components/functions_spec.js9
-rw-r--r--spec/frontend/serverless/components/missing_prometheus_spec.js15
-rw-r--r--spec/frontend/serverless/components/url_spec.js8
-rw-r--r--spec/frontend/test_setup.js11
-rw-r--r--spec/graphql/resolvers/group_resolver_spec.rb32
-rw-r--r--spec/graphql/resolvers/tree_resolver_spec.rb35
-rw-r--r--spec/graphql/types/project_type_spec.rb2
-rw-r--r--spec/graphql/types/repository_type_spec.rb11
-rw-r--r--spec/graphql/types/tree/blob_type_spec.rb9
-rw-r--r--spec/graphql/types/tree/submodule_type_spec.rb9
-rw-r--r--spec/graphql/types/tree/tree_entry_type_spec.rb9
-rw-r--r--spec/graphql/types/tree/tree_type_spec.rb9
-rw-r--r--spec/graphql/types/tree/type_enum_spec.rb11
-rw-r--r--spec/haml_lint/linter/no_plain_nodes_spec.rb56
-rw-r--r--spec/helpers/dashboard_helper_spec.rb6
-rw-r--r--spec/helpers/emails_helper_spec.rb39
-rw-r--r--spec/helpers/groups/group_members_helper_spec.rb17
-rw-r--r--spec/helpers/nav_helper_spec.rb12
-rw-r--r--spec/helpers/page_layout_helper_spec.rb8
-rw-r--r--spec/helpers/projects_helper_spec.rb20
-rw-r--r--spec/javascripts/api_spec.js2
-rw-r--r--spec/javascripts/diffs/components/commit_item_spec.js2
-rw-r--r--spec/javascripts/diffs/store/actions_spec.js30
-rw-r--r--spec/javascripts/dirty_submit/dirty_submit_form_spec.js111
-rw-r--r--spec/javascripts/environments/folder/environments_folder_view_spec.js2
-rw-r--r--spec/javascripts/fly_out_nav_spec.js5
-rw-r--r--spec/javascripts/frequent_items/components/frequent_items_list_item_spec.js2
-rw-r--r--spec/javascripts/helpers/text_helper.js (renamed from spec/javascripts/helpers/vue_component_helper.js)0
-rw-r--r--spec/javascripts/ide/components/commit_sidebar/list_collapsed_spec.js2
-rw-r--r--spec/javascripts/ide/components/ide_review_spec.js2
-rw-r--r--spec/javascripts/ide/components/nav_dropdown_button_spec.js2
-rw-r--r--spec/javascripts/jobs/components/artifacts_block_spec.js2
-rw-r--r--spec/javascripts/jobs/components/sidebar_spec.js2
-rw-r--r--spec/javascripts/jobs/components/stages_dropdown_spec.js2
-rw-r--r--spec/javascripts/pdf/index_spec.js4
-rw-r--r--spec/javascripts/pdf/page_spec.js4
-rw-r--r--spec/javascripts/reports/components/modal_spec.js2
-rw-r--r--spec/javascripts/reports/components/test_issue_body_spec.js2
-rw-r--r--spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_container_spec.js4
-rw-r--r--spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js2
-rw-r--r--spec/javascripts/vue_mr_widget/components/states/mr_widget_conflicts_spec.js2
-rw-r--r--spec/javascripts/vue_mr_widget/components/states/mr_widget_pipeline_blocked_spec.js2
-rw-r--r--spec/javascripts/vue_mr_widget/components/states/mr_widget_pipeline_failed_spec.js2
-rw-r--r--spec/javascripts/vue_mr_widget/components/states/mr_widget_sha_mismatch_spec.js2
-rw-r--r--spec/javascripts/vue_mr_widget/mock_data.js37
-rw-r--r--spec/javascripts/vue_shared/components/project_selector/project_list_item_spec.js2
-rw-r--r--spec/javascripts/vue_shared/components/project_selector/project_selector_spec.js4
-rw-r--r--spec/javascripts/vue_shared/translate_spec.js2
-rw-r--r--spec/lib/banzai/filter/syntax_highlight_filter_spec.rb2
-rw-r--r--spec/lib/gitlab/ci/cron_parser_spec.rb7
-rw-r--r--spec/lib/gitlab/git/tree_spec.rb4
-rw-r--r--spec/lib/gitlab/import_export/members_mapper_spec.rb7
-rw-r--r--spec/lib/gitlab/import_export/project_tree_restorer_spec.rb13
-rw-r--r--spec/lib/gitlab/import_export/project_tree_saver_spec.rb7
-rw-r--r--spec/lib/gitlab/lets_encrypt/challenge_spec.rb29
-rw-r--r--spec/lib/gitlab/lets_encrypt/client_spec.rb120
-rw-r--r--spec/lib/gitlab/lets_encrypt/order_spec.rb39
-rw-r--r--spec/lib/gitlab/lfs_token_spec.rb98
-rw-r--r--spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb30
-rw-r--r--spec/lib/gitlab/metrics/samplers/unicorn_sampler_spec.rb25
-rw-r--r--spec/lib/gitlab/metrics/system_spec.rb24
-rw-r--r--spec/lib/gitlab/prometheus/query_variables_spec.rb2
-rw-r--r--spec/lib/gitlab/sentry_spec.rb5
-rw-r--r--spec/lib/gitlab/usage_data_spec.rb19
-rw-r--r--spec/models/active_session_spec.rb46
-rw-r--r--spec/models/application_record_spec.rb6
-rw-r--r--spec/models/ci/build_spec.rb20
-rw-r--r--spec/models/ci/pipeline_schedule_spec.rb2
-rw-r--r--spec/models/clusters/cluster_spec.rb3
-rw-r--r--spec/models/clusters/platforms/kubernetes_spec.rb29
-rw-r--r--spec/models/clusters/project_spec.rb1
-rw-r--r--spec/models/deployment_spec.rb4
-rw-r--r--spec/models/environment_spec.rb6
-rw-r--r--spec/models/project_services/kubernetes_service_spec.rb22
-rw-r--r--spec/models/repository_spec.rb37
-rw-r--r--spec/presenters/merge_request_presenter_spec.rb4
-rw-r--r--spec/requests/api/discussions_spec.rb4
-rw-r--r--spec/requests/api/graphql/project/repository_spec.rb37
-rw-r--r--spec/requests/api/graphql/project/tree/tree_spec.rb73
-rw-r--r--spec/requests/api/helpers_spec.rb5
-rw-r--r--spec/requests/api/internal_spec.rb12
-rw-r--r--spec/requests/api/issues/get_group_issues_spec.rb652
-rw-r--r--spec/requests/api/issues/get_project_issues_spec.rb805
-rw-r--r--spec/requests/api/issues/issues_spec.rb796
-rw-r--r--spec/requests/api/issues/post_projects_issues_spec.rb549
-rw-r--r--spec/requests/api/issues/put_projects_issues_spec.rb392
-rw-r--r--spec/requests/api/issues_spec.rb2265
-rw-r--r--spec/requests/api/jobs_spec.rb1
-rw-r--r--spec/requests/api/merge_requests_spec.rb27
-rw-r--r--spec/requests/api/project_clusters_spec.rb2
-rw-r--r--spec/requests/api/runner_spec.rb24
-rw-r--r--spec/requests/api/search_spec.rb7
-rw-r--r--spec/requests/api/variables_spec.rb5
-rw-r--r--spec/routing/project_routing_spec.rb55
-rw-r--r--spec/rubocop/cop/code_reuse/active_record_spec.rb6
-rw-r--r--spec/serializers/test_case_entity_spec.rb2
-rw-r--r--spec/services/auth/container_registry_authentication_service_spec.rb2
-rw-r--r--spec/services/clusters/gcp/kubernetes/create_or_update_namespace_service_spec.rb2
-rw-r--r--spec/services/clusters/refresh_service_spec.rb26
-rw-r--r--spec/services/git/base_hooks_service_spec.rb90
-rw-r--r--spec/services/git/branch_hooks_service_spec.rb6
-rw-r--r--spec/services/git/branch_push_service_spec.rb66
-rw-r--r--spec/services/git/tag_hooks_service_spec.rb6
-rw-r--r--spec/services/issues/close_service_spec.rb44
-rw-r--r--spec/services/merge_requests/rebase_service_spec.rb26
-rw-r--r--spec/services/projects/create_service_spec.rb27
-rw-r--r--spec/services/projects/git_deduplication_service_spec.rb90
-rw-r--r--spec/services/projects/transfer_service_spec.rb27
-rw-r--r--spec/services/system_note_service_spec.rb4
-rw-r--r--spec/support/helpers/kubernetes_helpers.rb24
-rw-r--r--spec/support/helpers/lets_encrypt_helpers.rb19
-rw-r--r--spec/support/helpers/stub_configuration.rb3
-rw-r--r--spec/support/helpers/test_env.rb14
-rw-r--r--spec/support/prometheus/additional_metrics_shared_examples.rb2
-rw-r--r--spec/support/shared_examples/legacy_path_redirect_shared_examples.rb8
-rw-r--r--spec/support/shared_examples/requests/api/discussions.rb4
-rw-r--r--spec/support/shared_examples/requests/api/issues_shared_example_spec.rb44
-rw-r--r--spec/support/shoulda/matchers/rails_shim.rb27
-rw-r--r--spec/uploaders/object_storage_spec.rb2
-rw-r--r--spec/uploaders/personal_file_uploader_spec.rb60
-rw-r--r--spec/views/help/index.html.haml_spec.rb2
-rw-r--r--spec/views/projects/tree/show.html.haml_spec.rb2
-rw-r--r--spec/workers/build_finished_worker_spec.rb1
-rw-r--r--spec/workers/cluster_configure_worker_spec.rb21
-rw-r--r--spec/workers/pages_domain_removal_cron_worker_spec.rb15
-rw-r--r--vendor/assets/javascripts/pdf.js19365
-rw-r--r--vendor/assets/javascripts/pdf.min.js1
-rw-r--r--vendor/assets/javascripts/pdf.worker.js47057
-rw-r--r--vendor/assets/javascripts/pdf.worker.min.js1
-rw-r--r--vendor/jupyter/values.yaml20
-rw-r--r--yarn.lock650
1022 files changed, 15171 insertions, 72055 deletions
diff --git a/.codeclimate.yml b/.codeclimate.yml
index 9998ddba643..2be8e63e842 100644
--- a/.codeclimate.yml
+++ b/.codeclimate.yml
@@ -6,35 +6,35 @@ engines:
enabled: true
config:
languages:
- - ruby
- - javascript
+ - ruby
+ - javascript
ratings:
paths:
- - Gemfile.lock
- - "**.erb"
- - "**.haml"
- - "**.rb"
- - "**.rhtml"
- - "**.slim"
- - "**.inc"
- - "**.js"
- - "**.jsx"
- - "**.module"
+ - Gemfile.lock
+ - "**.erb"
+ - "**.haml"
+ - "**.rb"
+ - "**.rhtml"
+ - "**.slim"
+ - "**.inc"
+ - "**.js"
+ - "**.jsx"
+ - "**.module"
exclude_paths:
-- config/
-- db/
-- features/
-- node_modules/
-- spec/
-- vendor/
-- .yarn-cache/
-- tmp/
-- builds/
-- coverage/
-- public/
-- shared/
-- webpack-report/
-- log/
-- backups/
-- coverage-javascript/
-- plugins/
+ - config/
+ - db/
+ - features/
+ - node_modules/
+ - spec/
+ - vendor/
+ - .yarn-cache/
+ - tmp/
+ - builds/
+ - coverage/
+ - public/
+ - shared/
+ - webpack-report/
+ - log/
+ - backups/
+ - coverage-javascript/
+ - plugins/
diff --git a/.gitignore b/.gitignore
index 627c806787b..cb718a6939f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -79,3 +79,4 @@ package-lock.json
/junit_*.xml
/coverage-frontend/
jsdoc/
+**/tmp/rubocop_cache/** \ No newline at end of file
diff --git a/.gitlab/CODEOWNERS.disabled b/.gitlab/CODEOWNERS
index 52fb651f551..0156a4d749a 100644
--- a/.gitlab/CODEOWNERS.disabled
+++ b/.gitlab/CODEOWNERS
@@ -1,6 +1,6 @@
# Backend Maintainers are the default for all ruby files
-*.rb @ashmckenzie @ayufan @dbalexandre @DouweM @dzaporozhets @godfat @grzesiek @mkozono @nick.thomas @rspeicher @rymai @smcgivern @mayra-cabrera
-*.rake @ashmckenzie @ayufan @dbalexandre @DouweM @dzaporozhets @godfat @grzesiek @mkozono @nick.thomas @rspeicher @rymai @smcgivern @mayra-cabrera
+*.rb @ashmckenzie @ayufan @dbalexandre @DouweM @dzaporozhets @godfat @grzesiek @mkozono @nick.thomas @rspeicher @rymai @smcgivern @mayra-cabrera @reprazent
+*.rake @ashmckenzie @ayufan @dbalexandre @DouweM @dzaporozhets @godfat @grzesiek @mkozono @nick.thomas @rspeicher @rymai @smcgivern @mayra-cabrera @reprazent
# Technical writing team are the default reviewers for everything in `doc/`
/doc/ @axil @marcia
diff --git a/.gitlab/ci/qa.gitlab-ci.yml b/.gitlab/ci/qa.gitlab-ci.yml
index 122ed622ee2..6b23af952e6 100644
--- a/.gitlab/ci/qa.gitlab-ci.yml
+++ b/.gitlab/ci/qa.gitlab-ci.yml
@@ -1,6 +1,6 @@
package-and-qa:
image: ruby:2.6-alpine
- stage: qa
+ stage: review # So even if review-deploy failed we can still run this
when: manual
before_script: []
dependencies: []
diff --git a/.gitlab/ci/review.gitlab-ci.yml b/.gitlab/ci/review.gitlab-ci.yml
index 3a024c44fe2..80356fa1dc2 100644
--- a/.gitlab/ci/review.gitlab-ci.yml
+++ b/.gitlab/ci/review.gitlab-ci.yml
@@ -78,7 +78,6 @@ schedule:review-build-cng:
<<: *review-base
stage: review
retry: 2
- allow_failure: true
variables:
HOST_SUFFIX: "${CI_ENVIRONMENT_SLUG}"
DOMAIN: "-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN}"
@@ -130,7 +129,6 @@ review-stop:
.review-qa-base: &review-qa-base
<<: *review-docker
stage: qa
- allow_failure: true
variables:
<<: *review-docker-variables
QA_ARTIFACTS_DIR: "${CI_PROJECT_DIR}/qa"
@@ -165,13 +163,14 @@ review-qa-smoke:
review-qa-all:
<<: *review-qa-base
+ allow_failure: true
when: manual
script:
- gitlab-qa Test::Instance::Any "${QA_IMAGE}" "${CI_ENVIRONMENT_URL}"
.review-performance-base: &review-performance-base
<<: *review-qa-base
- stage: qa
+ allow_failure: true
before_script:
- export CI_ENVIRONMENT_URL="$(cat review_app_url.txt)"
- echo "${CI_ENVIRONMENT_URL}"
diff --git a/.gitlab/issue_templates/Bug.md b/.gitlab/issue_templates/Bug.md
index 3e58d2a867e..3adea22b33a 100644
--- a/.gitlab/issue_templates/Bug.md
+++ b/.gitlab/issue_templates/Bug.md
@@ -27,9 +27,9 @@ and verify the issue you're about to submit isn't a duplicate.
### Example Project
-(If possible, please create an example project here on GitLab.com that exhibits the problematic behaviour, and link to it here in the bug report)
+(If possible, please create an example project here on GitLab.com that exhibits the problematic behavior, and link to it here in the bug report)
-(If you are using an older version of GitLab, this will also determine whether the bug has been fixed in a more recent version)
+(If you are using an older version of GitLab, this will also determine whether the bug is fixed in a more recent version)
### What is the current *bug* behavior?
@@ -42,7 +42,7 @@ and verify the issue you're about to submit isn't a duplicate.
### Relevant logs and/or screenshots
(Paste any relevant logs - please use code blocks (```) to format console output,
-logs, and code as it's very hard to read otherwise.)
+logs, and code as it's tough to read otherwise.)
### Output of checks
diff --git a/.gitlab/issue_templates/Security developer workflow.md b/.gitlab/issue_templates/Security developer workflow.md
index 9946651075f..7857afb66c2 100644
--- a/.gitlab/issue_templates/Security developer workflow.md
+++ b/.gitlab/issue_templates/Security developer workflow.md
@@ -17,10 +17,10 @@ Set the title to: `Description of the original issue`
#### Backports
-- [ ] Once the MR is ready to be merged, create MRs targetting the last 3 releases, plus the current RC if between the 7th and 22nd of the month.
+- [ ] Once the MR is ready to be merged, create MRs targeting the last 3 releases, plus the current RC if between the 7th and 22nd of the month.
- [ ] At this point, it might be easy to squash the commits from the MR into one
- You can use the script `bin/secpick` instead of the following steps, to help you cherry-picking. See the [secpick documentation]
- - [ ] Create each MR targetting the stable branch `X-Y-stable`, using the "Security Release" merge request template.
+ - [ ] Create each MR targeting the stable branch `X-Y-stable`, using the "Security Release" merge request template.
- Every merge request will have its own set of TODOs, so make sure to
complete those.
- [ ] Make sure all MRs have a link in the [links section](#links)
diff --git a/.haml-lint.yml b/.haml-lint.yml
index e9cc4a91a21..0412b24a48c 100644
--- a/.haml-lint.yml
+++ b/.haml-lint.yml
@@ -1,9 +1,13 @@
+inherits_from:
+ - .haml-lint_todo.yml
# Whether to ignore frontmatter at the beginning of HAML documents for
# frameworks such as Jekyll/Middleman
skip_frontmatter: false
exclude:
- 'vendor/**/*'
- 'spec/**/*'
+require:
+ - './haml_lint/linter/no_plain_nodes.rb'
linters:
AltText:
@@ -153,7 +157,7 @@ linters:
Indentation:
enabled: true
- character: space # or tab
+ character: space # or tab
TagName:
enabled: true
diff --git a/.haml-lint_todo.yml b/.haml-lint_todo.yml
new file mode 100644
index 00000000000..61805c2d8d2
--- /dev/null
+++ b/.haml-lint_todo.yml
@@ -0,0 +1,523 @@
+# This configuration was generated by
+# `haml-lint --auto-gen-config`
+# on 2019-05-07 19:04:08 +0100 using Haml-Lint version 0.30.0.
+# The point is for the user to remove these configuration records
+# one by one as the lints are removed from the code base.
+# Note that changes in the inspected code, or installation of new
+# versions of Haml-Lint, may require this file to be generated again.
+
+linters:
+
+ # Offense count: 2075
+ NoPlainNodes:
+ enabled: true
+ exclude:
+ - "app/views/admin/abuse_reports/_abuse_report.html.haml"
+ - "app/views/admin/abuse_reports/index.html.haml"
+ - "app/views/admin/appearances/_form.html.haml"
+ - "app/views/admin/application_settings/_abuse.html.haml"
+ - "app/views/admin/application_settings/_diff_limits.html.haml"
+ - "app/views/admin/application_settings/_gitaly.html.haml"
+ - "app/views/admin/application_settings/_influx.html.haml"
+ - "app/views/admin/application_settings/_ip_limits.html.haml"
+ - "app/views/admin/application_settings/_logging.html.haml"
+ - "app/views/admin/application_settings/_performance.html.haml"
+ - "app/views/admin/application_settings/_plantuml.html.haml"
+ - "app/views/admin/application_settings/_prometheus.html.haml"
+ - "app/views/admin/application_settings/_realtime.html.haml"
+ - "app/views/admin/application_settings/_repository_check.html.haml"
+ - "app/views/admin/application_settings/_repository_storage.html.haml"
+ - "app/views/admin/application_settings/_signin.html.haml"
+ - "app/views/admin/application_settings/_signup.html.haml"
+ - "app/views/admin/application_settings/_spam.html.haml"
+ - "app/views/admin/application_settings/_terminal.html.haml"
+ - "app/views/admin/application_settings/_usage.html.haml"
+ - "app/views/admin/application_settings/_visibility_and_access.html.haml"
+ - "app/views/admin/applications/_delete_form.html.haml"
+ - "app/views/admin/applications/_form.html.haml"
+ - "app/views/admin/applications/edit.html.haml"
+ - "app/views/admin/applications/index.html.haml"
+ - "app/views/admin/applications/new.html.haml"
+ - "app/views/admin/applications/show.html.haml"
+ - "app/views/admin/background_jobs/show.html.haml"
+ - "app/views/admin/broadcast_messages/index.html.haml"
+ - "app/views/admin/dashboard/index.html.haml"
+ - "app/views/admin/deploy_keys/new.html.haml"
+ - "app/views/admin/groups/show.html.haml"
+ - "app/views/admin/health_check/show.html.haml"
+ - "app/views/admin/hook_logs/_index.html.haml"
+ - "app/views/admin/hook_logs/show.html.haml"
+ - "app/views/admin/hooks/_form.html.haml"
+ - "app/views/admin/hooks/edit.html.haml"
+ - "app/views/admin/hooks/index.html.haml"
+ - "app/views/admin/labels/_form.html.haml"
+ - "app/views/admin/logs/show.html.haml"
+ - "app/views/admin/projects/_projects.html.haml"
+ - "app/views/admin/projects/show.html.haml"
+ - "app/views/admin/requests_profiles/index.html.haml"
+ - "app/views/admin/runners/_runner.html.haml"
+ - "app/views/admin/runners/index.html.haml"
+ - "app/views/admin/runners/show.html.haml"
+ - "app/views/admin/services/_form.html.haml"
+ - "app/views/admin/services/index.html.haml"
+ - "app/views/admin/spam_logs/_spam_log.html.haml"
+ - "app/views/admin/spam_logs/index.html.haml"
+ - "app/views/admin/system_info/show.html.haml"
+ - "app/views/admin/users/_access_levels.html.haml"
+ - "app/views/admin/users/_form.html.haml"
+ - "app/views/admin/users/_head.html.haml"
+ - "app/views/admin/users/_profile.html.haml"
+ - "app/views/admin/users/_projects.html.haml"
+ - "app/views/admin/users/new.html.haml"
+ - "app/views/admin/users/projects.html.haml"
+ - "app/views/admin/users/show.html.haml"
+ - "app/views/clusters/clusters/_cluster.html.haml"
+ - "app/views/clusters/clusters/_form.html.haml"
+ - "app/views/clusters/clusters/_gcp_signup_offer_banner.html.haml"
+ - "app/views/clusters/clusters/gcp/_form.html.haml"
+ - "app/views/clusters/clusters/new.html.haml"
+ - "app/views/dashboard/milestones/index.html.haml"
+ - "app/views/dashboard/projects/_blank_state_admin_welcome.html.haml"
+ - "app/views/dashboard/projects/_blank_state_welcome.html.haml"
+ - "app/views/dashboard/projects/_zero_authorized_projects.html.haml"
+ - "app/views/dashboard/snippets/index.html.haml"
+ - "app/views/dashboard/todos/_todo.html.haml"
+ - "app/views/dashboard/todos/index.html.haml"
+ - "app/views/devise/confirmations/almost_there.haml"
+ - "app/views/devise/mailer/_confirmation_instructions_account.html.haml"
+ - "app/views/devise/mailer/_confirmation_instructions_secondary.html.haml"
+ - "app/views/devise/mailer/email_changed.html.haml"
+ - "app/views/devise/mailer/password_change.html.haml"
+ - "app/views/devise/mailer/reset_password_instructions.html.haml"
+ - "app/views/devise/mailer/unlock_instructions.html.haml"
+ - "app/views/devise/passwords/edit.html.haml"
+ - "app/views/devise/sessions/_new_base.html.haml"
+ - "app/views/devise/sessions/_new_crowd.html.haml"
+ - "app/views/devise/sessions/_new_ldap.html.haml"
+ - "app/views/devise/sessions/new.html.haml"
+ - "app/views/devise/sessions/two_factor.html.haml"
+ - "app/views/devise/shared/_omniauth_box.html.haml"
+ - "app/views/devise/shared/_sign_in_link.html.haml"
+ - "app/views/devise/shared/_signup_box.html.haml"
+ - "app/views/devise/shared/_tabs_normal.html.haml"
+ - "app/views/discussions/_discussion.html.haml"
+ - "app/views/discussions/_headline.html.haml"
+ - "app/views/discussions/_notes.html.haml"
+ - "app/views/discussions/_resolve_all.html.haml"
+ - "app/views/doorkeeper/applications/_delete_form.html.haml"
+ - "app/views/doorkeeper/authorized_applications/_delete_form.html.haml"
+ - "app/views/errors/encoding.html.haml"
+ - "app/views/errors/git_not_found.html.haml"
+ - "app/views/errors/omniauth_error.html.haml"
+ - "app/views/errors/precondition_failed.html.haml"
+ - "app/views/events/_commit.html.haml"
+ - "app/views/events/_event_push.atom.haml"
+ - "app/views/events/event/_push.html.haml"
+ - "app/views/groups/_create_chat_team.html.haml"
+ - "app/views/groups/_group_admin_settings.html.haml"
+ - "app/views/groups/group_members/_new_group_member.html.haml"
+ - "app/views/groups/group_members/index.html.haml"
+ - "app/views/groups/labels/edit.html.haml"
+ - "app/views/groups/labels/new.html.haml"
+ - "app/views/groups/milestones/edit.html.haml"
+ - "app/views/groups/milestones/index.html.haml"
+ - "app/views/groups/milestones/new.html.haml"
+ - "app/views/groups/projects.html.haml"
+ - "app/views/groups/runners/edit.html.haml"
+ - "app/views/groups/settings/_advanced.html.haml"
+ - "app/views/groups/settings/_lfs.html.haml"
+ - "app/views/help/_shortcuts.html.haml"
+ - "app/views/help/index.html.haml"
+ - "app/views/help/instance_configuration.html.haml"
+ - "app/views/help/instance_configuration/_gitlab_ci.html.haml"
+ - "app/views/help/instance_configuration/_gitlab_pages.html.haml"
+ - "app/views/help/instance_configuration/_ssh_info.html.haml"
+ - "app/views/help/ui.html.haml"
+ - "app/views/import/bitbucket/status.html.haml"
+ - "app/views/import/bitbucket_server/status.html.haml"
+ - "app/views/instance_statistics/cohorts/_cohorts_table.html.haml"
+ - "app/views/instance_statistics/cohorts/_usage_ping.html.haml"
+ - "app/views/invites/show.html.haml"
+ - "app/views/layouts/_mailer.html.haml"
+ - "app/views/layouts/header/_default.html.haml"
+ - "app/views/layouts/header/_new_dropdown.haml"
+ - "app/views/layouts/mailer/devise.html.haml"
+ - "app/views/layouts/nav/sidebar/_profile.html.haml"
+ - "app/views/layouts/notify.html.haml"
+ - "app/views/notify/_failed_builds.html.haml"
+ - "app/views/notify/_reassigned_issuable_email.html.haml"
+ - "app/views/notify/_removal_notification.html.haml"
+ - "app/views/notify/autodevops_disabled_email.html.haml"
+ - "app/views/notify/changed_milestone_email.html.haml"
+ - "app/views/notify/import_issues_csv_email.html.haml"
+ - "app/views/notify/issue_moved_email.html.haml"
+ - "app/views/notify/member_access_denied_email.html.haml"
+ - "app/views/notify/member_invite_accepted_email.html.haml"
+ - "app/views/notify/member_invite_declined_email.html.haml"
+ - "app/views/notify/member_invited_email.html.haml"
+ - "app/views/notify/new_gpg_key_email.html.haml"
+ - "app/views/notify/new_mention_in_issue_email.html.haml"
+ - "app/views/notify/new_ssh_key_email.html.haml"
+ - "app/views/notify/new_user_email.html.haml"
+ - "app/views/notify/pages_domain_disabled_email.html.haml"
+ - "app/views/notify/pages_domain_enabled_email.html.haml"
+ - "app/views/notify/pages_domain_verification_failed_email.html.haml"
+ - "app/views/notify/pages_domain_verification_succeeded_email.html.haml"
+ - "app/views/notify/pipeline_failed_email.html.haml"
+ - "app/views/notify/pipeline_success_email.html.haml"
+ - "app/views/notify/project_was_exported_email.html.haml"
+ - "app/views/notify/project_was_moved_email.html.haml"
+ - "app/views/notify/project_was_not_exported_email.html.haml"
+ - "app/views/notify/push_to_merge_request_email.html.haml"
+ - "app/views/notify/remote_mirror_update_failed_email.html.haml"
+ - "app/views/notify/removed_milestone_issue_email.html.haml"
+ - "app/views/notify/removed_milestone_merge_request_email.html.haml"
+ - "app/views/notify/repository_push_email.html.haml"
+ - "app/views/peek/views/_gc.html.haml"
+ - "app/views/peek/views/_redis.html.haml"
+ - "app/views/peek/views/_sidekiq.html.haml"
+ - "app/views/profiles/_event_table.html.haml"
+ - "app/views/profiles/active_sessions/_active_session.html.haml"
+ - "app/views/profiles/active_sessions/index.html.haml"
+ - "app/views/profiles/audit_log.html.haml"
+ - "app/views/profiles/chat_names/_chat_name.html.haml"
+ - "app/views/profiles/chat_names/index.html.haml"
+ - "app/views/profiles/chat_names/new.html.haml"
+ - "app/views/profiles/emails/index.html.haml"
+ - "app/views/profiles/gpg_keys/_key.html.haml"
+ - "app/views/profiles/gpg_keys/index.html.haml"
+ - "app/views/profiles/keys/_key.html.haml"
+ - "app/views/profiles/keys/_key_details.html.haml"
+ - "app/views/profiles/keys/index.html.haml"
+ - "app/views/profiles/notifications/show.html.haml"
+ - "app/views/profiles/passwords/edit.html.haml"
+ - "app/views/profiles/personal_access_tokens/index.html.haml"
+ - "app/views/profiles/preferences/show.html.haml"
+ - "app/views/profiles/show.html.haml"
+ - "app/views/profiles/two_factor_auths/_codes.html.haml"
+ - "app/views/profiles/two_factor_auths/codes.html.haml"
+ - "app/views/profiles/two_factor_auths/create.html.haml"
+ - "app/views/profiles/two_factor_auths/show.html.haml"
+ - "app/views/projects/_bitbucket_import_modal.html.haml"
+ - "app/views/projects/_customize_workflow.html.haml"
+ - "app/views/projects/_deletion_failed.html.haml"
+ - "app/views/projects/_fork_suggestion.html.haml"
+ - "app/views/projects/_gitlab_import_modal.html.haml"
+ - "app/views/projects/_home_panel.html.haml"
+ - "app/views/projects/_import_project_pane.html.haml"
+ - "app/views/projects/_issuable_by_email.html.haml"
+ - "app/views/projects/_md_preview.html.haml"
+ - "app/views/projects/_new_project_fields.html.haml"
+ - "app/views/projects/_readme.html.haml"
+ - "app/views/projects/artifacts/_tree_file.html.haml"
+ - "app/views/projects/artifacts/browse.html.haml"
+ - "app/views/projects/blame/_age_map_legend.html.haml"
+ - "app/views/projects/blame/show.html.haml"
+ - "app/views/projects/blob/_editor.html.haml"
+ - "app/views/projects/blob/_header_content.html.haml"
+ - "app/views/projects/blob/_new_dir.html.haml"
+ - "app/views/projects/blob/_remove.html.haml"
+ - "app/views/projects/blob/_render_error.html.haml"
+ - "app/views/projects/blob/_template_selectors.html.haml"
+ - "app/views/projects/blob/_upload.html.haml"
+ - "app/views/projects/blob/edit.html.haml"
+ - "app/views/projects/blob/new.html.haml"
+ - "app/views/projects/blob/preview.html.haml"
+ - "app/views/projects/blob/viewers/_empty.html.haml"
+ - "app/views/projects/blob/viewers/_stl.html.haml"
+ - "app/views/projects/branches/_branch.html.haml"
+ - "app/views/projects/branches/_commit.html.haml"
+ - "app/views/projects/branches/_delete_protected_modal.html.haml"
+ - "app/views/projects/branches/new.html.haml"
+ - "app/views/projects/ci/builds/_build.html.haml"
+ - "app/views/projects/ci/lints/_create.html.haml"
+ - "app/views/projects/commit/_change.html.haml"
+ - "app/views/projects/commits/_commit.html.haml"
+ - "app/views/projects/commits/_inline_commit.html.haml"
+ - "app/views/projects/compare/_form.html.haml"
+ - "app/views/projects/compare/index.html.haml"
+ - "app/views/projects/cycle_analytics/_empty_stage.html.haml"
+ - "app/views/projects/cycle_analytics/_no_access.html.haml"
+ - "app/views/projects/cycle_analytics/_overview.html.haml"
+ - "app/views/projects/cycle_analytics/show.html.haml"
+ - "app/views/projects/deploy_keys/_form.html.haml"
+ - "app/views/projects/deploy_keys/_index.html.haml"
+ - "app/views/projects/deploy_keys/edit.html.haml"
+ - "app/views/projects/deploy_tokens/_revoke_modal.html.haml"
+ - "app/views/projects/deploy_tokens/_table.html.haml"
+ - "app/views/projects/deployments/_deployment.html.haml"
+ - "app/views/projects/diffs/_file_header.html.haml"
+ - "app/views/projects/diffs/_replaced_image_diff.html.haml"
+ - "app/views/projects/diffs/_stats.html.haml"
+ - "app/views/projects/empty.html.haml"
+ - "app/views/projects/environments/show.html.haml"
+ - "app/views/projects/forks/error.html.haml"
+ - "app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml"
+ - "app/views/projects/graphs/charts.html.haml"
+ - "app/views/projects/hook_logs/_index.html.haml"
+ - "app/views/projects/hook_logs/show.html.haml"
+ - "app/views/projects/hooks/_index.html.haml"
+ - "app/views/projects/hooks/edit.html.haml"
+ - "app/views/projects/imports/new.html.haml"
+ - "app/views/projects/imports/show.html.haml"
+ - "app/views/projects/issues/_issue.html.haml"
+ - "app/views/projects/issues/_new_branch.html.haml"
+ - "app/views/projects/issues/import_csv/_modal.html.haml"
+ - "app/views/projects/issues/show.html.haml"
+ - "app/views/projects/jobs/_header.html.haml"
+ - "app/views/projects/jobs/_table.html.haml"
+ - "app/views/projects/jobs/index.html.haml"
+ - "app/views/projects/labels/edit.html.haml"
+ - "app/views/projects/labels/new.html.haml"
+ - "app/views/projects/mattermosts/_no_teams.html.haml"
+ - "app/views/projects/mattermosts/_team_selection.html.haml"
+ - "app/views/projects/mattermosts/new.html.haml"
+ - "app/views/projects/merge_requests/_commits.html.haml"
+ - "app/views/projects/merge_requests/_discussion.html.haml"
+ - "app/views/projects/merge_requests/_how_to_merge.html.haml"
+ - "app/views/projects/merge_requests/_merge_request.html.haml"
+ - "app/views/projects/merge_requests/_mr_title.html.haml"
+ - "app/views/projects/merge_requests/conflicts/_commit_stats.html.haml"
+ - "app/views/projects/merge_requests/conflicts/_file_actions.html.haml"
+ - "app/views/projects/merge_requests/conflicts/_submit_form.html.haml"
+ - "app/views/projects/merge_requests/conflicts/components/_diff_file_editor.html.haml"
+ - "app/views/projects/merge_requests/conflicts/components/_inline_conflict_lines.html.haml"
+ - "app/views/projects/merge_requests/conflicts/show.html.haml"
+ - "app/views/projects/merge_requests/creations/_diffs.html.haml"
+ - "app/views/projects/merge_requests/creations/_new_compare.html.haml"
+ - "app/views/projects/merge_requests/creations/_new_submit.html.haml"
+ - "app/views/projects/merge_requests/diffs/_different_base.html.haml"
+ - "app/views/projects/merge_requests/diffs/_diffs.html.haml"
+ - "app/views/projects/merge_requests/diffs/_version_controls.html.haml"
+ - "app/views/projects/merge_requests/invalid.html.haml"
+ - "app/views/projects/merge_requests/widget/open/_error.html.haml"
+ - "app/views/projects/mirrors/_regenerate_public_ssh_key_confirm_modal.html.haml"
+ - "app/views/projects/mirrors/_ssh_host_keys.html.haml"
+ - "app/views/projects/new.html.haml"
+ - "app/views/projects/no_repo.html.haml"
+ - "app/views/projects/pages/_access.html.haml"
+ - "app/views/projects/pages/_destroy.haml"
+ - "app/views/projects/pages/_https_only.html.haml"
+ - "app/views/projects/pages/_list.html.haml"
+ - "app/views/projects/pages/_no_domains.html.haml"
+ - "app/views/projects/pages/_use.html.haml"
+ - "app/views/projects/pages/show.html.haml"
+ - "app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml"
+ - "app/views/projects/pipelines/_info.html.haml"
+ - "app/views/projects/pipelines/charts/_pipelines.haml"
+ - "app/views/projects/protected_branches/shared/_branches_list.html.haml"
+ - "app/views/projects/protected_branches/shared/_create_protected_branch.html.haml"
+ - "app/views/projects/protected_branches/shared/_dropdown.html.haml"
+ - "app/views/projects/protected_branches/shared/_index.html.haml"
+ - "app/views/projects/protected_branches/shared/_matching_branch.html.haml"
+ - "app/views/projects/protected_branches/shared/_protected_branch.html.haml"
+ - "app/views/projects/protected_branches/show.html.haml"
+ - "app/views/projects/protected_tags/shared/_create_protected_tag.html.haml"
+ - "app/views/projects/protected_tags/shared/_dropdown.html.haml"
+ - "app/views/projects/protected_tags/shared/_index.html.haml"
+ - "app/views/projects/protected_tags/shared/_matching_tag.html.haml"
+ - "app/views/projects/protected_tags/shared/_protected_tag.html.haml"
+ - "app/views/projects/protected_tags/shared/_tags_list.html.haml"
+ - "app/views/projects/protected_tags/show.html.haml"
+ - "app/views/projects/registry/repositories/_tag.html.haml"
+ - "app/views/projects/repositories/_feed.html.haml"
+ - "app/views/projects/runners/_shared_runners.html.haml"
+ - "app/views/projects/runners/edit.html.haml"
+ - "app/views/projects/services/_form.html.haml"
+ - "app/views/projects/services/_index.html.haml"
+ - "app/views/projects/services/mattermost_slash_commands/_detailed_help.html.haml"
+ - "app/views/projects/services/mattermost_slash_commands/_help.html.haml"
+ - "app/views/projects/services/prometheus/_metrics.html.haml"
+ - "app/views/projects/services/slack_slash_commands/_help.html.haml"
+ - "app/views/projects/settings/ci_cd/_badge.html.haml"
+ - "app/views/projects/settings/ci_cd/_form.html.haml"
+ - "app/views/projects/stage/_stage.html.haml"
+ - "app/views/projects/tags/index.html.haml"
+ - "app/views/projects/tags/new.html.haml"
+ - "app/views/projects/tags/releases/edit.html.haml"
+ - "app/views/projects/tree/_tree_row.html.haml"
+ - "app/views/projects/tree/_truncated_notice_tree_row.html.haml"
+ - "app/views/projects/triggers/_content.html.haml"
+ - "app/views/projects/triggers/_form.html.haml"
+ - "app/views/projects/triggers/_index.html.haml"
+ - "app/views/projects/triggers/_trigger.html.haml"
+ - "app/views/projects/triggers/edit.html.haml"
+ - "app/views/projects/wikis/_new.html.haml"
+ - "app/views/projects/wikis/_pages_wiki_page.html.haml"
+ - "app/views/projects/wikis/edit.html.haml"
+ - "app/views/projects/wikis/history.html.haml"
+ - "app/views/repository_check_mailer/notify.html.haml"
+ - "app/views/search/_form.html.haml"
+ - "app/views/search/results/_issue.html.haml"
+ - "app/views/search/results/_note.html.haml"
+ - "app/views/search/results/_snippet_blob.html.haml"
+ - "app/views/search/results/_snippet_title.html.haml"
+ - "app/views/shared/_auto_devops_implicitly_enabled_banner.html.haml"
+ - "app/views/shared/_commit_message_container.html.haml"
+ - "app/views/shared/_confirm_modal.html.haml"
+ - "app/views/shared/_delete_label_modal.html.haml"
+ - "app/views/shared/_group_form.html.haml"
+ - "app/views/shared/_group_tips.html.haml"
+ - "app/views/shared/_milestone_expired.html.haml"
+ - "app/views/shared/_no_password.html.haml"
+ - "app/views/shared/_no_ssh.html.haml"
+ - "app/views/shared/_outdated_browser.html.haml"
+ - "app/views/shared/_personal_access_tokens_created_container.html.haml"
+ - "app/views/shared/_personal_access_tokens_table.html.haml"
+ - "app/views/shared/_ping_consent.html.haml"
+ - "app/views/shared/_project_limit.html.haml"
+ - "app/views/shared/_service_settings.html.haml"
+ - "app/views/shared/boards/components/_board.html.haml"
+ - "app/views/shared/boards/components/_sidebar.html.haml"
+ - "app/views/shared/boards/components/sidebar/_due_date.html.haml"
+ - "app/views/shared/boards/components/sidebar/_labels.html.haml"
+ - "app/views/shared/boards/components/sidebar/_milestone.html.haml"
+ - "app/views/shared/empty_states/_priority_labels.html.haml"
+ - "app/views/shared/hook_logs/_content.html.haml"
+ - "app/views/shared/issuable/_assignees.html.haml"
+ - "app/views/shared/issuable/_board_create_list_dropdown.html.haml"
+ - "app/views/shared/issuable/_bulk_update_sidebar.html.haml"
+ - "app/views/shared/issuable/_close_reopen_report_toggle.html.haml"
+ - "app/views/shared/issuable/_form.html.haml"
+ - "app/views/shared/issuable/_search_bar.html.haml"
+ - "app/views/shared/issuable/_sidebar.html.haml"
+ - "app/views/shared/issuable/form/_default_templates.html.haml"
+ - "app/views/shared/issuable/form/_issue_assignee.html.haml"
+ - "app/views/shared/issuable/form/_template_selector.html.haml"
+ - "app/views/shared/issuable/form/_title.html.haml"
+ - "app/views/shared/labels/_form.html.haml"
+ - "app/views/shared/members/_member.html.haml"
+ - "app/views/shared/milestones/_form_dates.html.haml"
+ - "app/views/shared/milestones/_issuable.html.haml"
+ - "app/views/shared/milestones/_milestone.html.haml"
+ - "app/views/shared/milestones/_sidebar.html.haml"
+ - "app/views/shared/milestones/_top.html.haml"
+ - "app/views/shared/notes/_hints.html.haml"
+ - "app/views/shared/notes/_note.html.haml"
+ - "app/views/shared/notifications/_button.html.haml"
+ - "app/views/shared/notifications/_custom_notifications.html.haml"
+ - "app/views/shared/notifications/_new_button.html.haml"
+ - "app/views/shared/notifications/_notification_dropdown.html.haml"
+ - "app/views/shared/plugins/_index.html.haml"
+ - "app/views/shared/projects/_dropdown.html.haml"
+ - "app/views/shared/projects/_list.html.haml"
+ - "app/views/shared/projects/_project.html.haml"
+ - "app/views/shared/runners/_runner_description.html.haml"
+ - "app/views/shared/runners/show.html.haml"
+ - "app/views/shared/snippets/_embed.html.haml"
+ - "app/views/shared/snippets/_header.html.haml"
+ - "app/views/shared/snippets/_snippet.html.haml"
+ - "app/views/shared/tokens/_scopes_list.html.haml"
+ - "app/views/shared/web_hooks/_form.html.haml"
+ - "app/views/shared/web_hooks/_test_button.html.haml"
+ - "app/views/u2f/_authenticate.html.haml"
+ - "app/views/u2f/_register.html.haml"
+ - "app/views/users/_deletion_guidance.html.haml"
+ - "ee/app/views/admin/_namespace_plan_info.html.haml"
+ - "ee/app/views/admin/application_settings/_elasticsearch_form.html.haml"
+ - "ee/app/views/admin/application_settings/_slack.html.haml"
+ - "ee/app/views/admin/application_settings/_snowplow.html.haml"
+ - "ee/app/views/admin/application_settings/_templates.html.haml"
+ - "ee/app/views/admin/audit_logs/index.html.haml"
+ - "ee/app/views/admin/dashboard/stats.html.haml"
+ - "ee/app/views/admin/emails/show.html.haml"
+ - "ee/app/views/admin/geo/nodes/edit.html.haml"
+ - "ee/app/views/admin/geo/nodes/new.html.haml"
+ - "ee/app/views/admin/geo/projects/_registry_failed.html.haml"
+ - "ee/app/views/admin/geo/projects/_registry_never.html.haml"
+ - "ee/app/views/admin/licenses/_breakdown.html.haml"
+ - "ee/app/views/admin/licenses/_upload_trial_license.html.haml"
+ - "ee/app/views/admin/licenses/missing.html.haml"
+ - "ee/app/views/admin/licenses/new.html.haml"
+ - "ee/app/views/admin/licenses/show.html.haml"
+ - "ee/app/views/admin/monitoring/ee/_nav.html.haml"
+ - "ee/app/views/admin/projects/_shared_runner_status.html.haml"
+ - "ee/app/views/admin/push_rules/show.html.haml"
+ - "ee/app/views/admin/users/_limits.html.haml"
+ - "ee/app/views/admin/users/_user_detail_note.html.haml"
+ - "ee/app/views/dashboard/projects/_blank_state_ee_trial.html.haml"
+ - "ee/app/views/errors/kerberos_denied.html.haml"
+ - "ee/app/views/groups/analytics/show.html.haml"
+ - "ee/app/views/groups/audit_events/index.html.haml"
+ - "ee/app/views/groups/ee/_settings_nav.html.haml"
+ - "ee/app/views/groups/epics/_epic.html.haml"
+ - "ee/app/views/groups/group_members/_ldap_sync.html.haml"
+ - "ee/app/views/groups/group_members/_sync_button.html.haml"
+ - "ee/app/views/groups/hooks/_project_hook.html.haml"
+ - "ee/app/views/groups/hooks/index.html.haml"
+ - "ee/app/views/groups/ldap_group_links/index.html.haml"
+ - "ee/app/views/groups/pipeline_quota/index.html.haml"
+ - "ee/app/views/jira_connect/subscriptions/index.html.haml"
+ - "ee/app/views/layouts/jira_connect.html.haml"
+ - "ee/app/views/layouts/nav/ee/_epic_link.html.haml"
+ - "ee/app/views/layouts/nav/ee/admin/_new_monitoring_sidebar.html.haml"
+ - "ee/app/views/layouts/service_desk.html.haml"
+ - "ee/app/views/ldap_group_links/_form.html.haml"
+ - "ee/app/views/ldap_group_links/_ldap_group_link.html.haml"
+ - "ee/app/views/ldap_group_links/_ldap_group_links.html.haml"
+ - "ee/app/views/ldap_group_links/_ldap_group_links_show.html.haml"
+ - "ee/app/views/ldap_group_links/_ldap_group_links_synchronizations.html.haml"
+ - "ee/app/views/namespaces/_shared_runner_status.html.haml"
+ - "ee/app/views/namespaces/_shared_runners_minutes_setting.html.haml"
+ - "ee/app/views/namespaces/pipelines_quota/_extra_shared_runners_minutes_quota.html.haml"
+ - "ee/app/views/namespaces/pipelines_quota/_list.haml"
+ - "ee/app/views/notify/approved_merge_request_email.html.haml"
+ - "ee/app/views/notify/epic_status_changed_email.html.haml"
+ - "ee/app/views/notify/issues_csv_email.html.haml"
+ - "ee/app/views/notify/new_review_email.html.haml"
+ - "ee/app/views/notify/prometheus_alert_fired_email.html.haml"
+ - "ee/app/views/notify/send_admin_notification.html.haml"
+ - "ee/app/views/notify/send_unsubscribed_notification.html.haml"
+ - "ee/app/views/notify/unapproved_merge_request_email.html.haml"
+ - "ee/app/views/oauth/geo_auth/error.html.haml"
+ - "ee/app/views/profiles/pipeline_quota/index.haml"
+ - "ee/app/views/projects/audit_events/index.html.haml"
+ - "ee/app/views/projects/blob/_owners.html.haml"
+ - "ee/app/views/projects/commits/_mirror_status.html.haml"
+ - "ee/app/views/projects/feature_flags/_configure_feature_flags_modal.html.haml"
+ - "ee/app/views/projects/issues/_issue_weight.html.haml"
+ - "ee/app/views/projects/issues/_related_issues.html.haml"
+ - "ee/app/views/projects/issues/export_csv/_modal.html.haml"
+ - "ee/app/views/projects/jobs/_shared_runner_limit_warning.html.haml"
+ - "ee/app/views/projects/merge_requests/_approvals_count.html.haml"
+ - "ee/app/views/projects/merge_requests/widget/open/_geo.html.haml"
+ - "ee/app/views/projects/mirrors/_mirrored_repositories_count.html.haml"
+ - "ee/app/views/projects/protected_branches/ee/_create_protected_branch.html.haml"
+ - "ee/app/views/projects/protected_branches/ee/_dropdown.html.haml"
+ - "ee/app/views/projects/protected_branches/ee/_fallback_update_protected_branch.html.haml"
+ - "ee/app/views/projects/protected_tags/_protected_tag_extra_create_access_levels.haml"
+ - "ee/app/views/projects/protected_tags/ee/_create_protected_tag.html.haml"
+ - "ee/app/views/projects/push_rules/_index.html.haml"
+ - "ee/app/views/projects/services/gitlab_slack_application/_help.html.haml"
+ - "ee/app/views/projects/services/gitlab_slack_application/_slack_integration_form.html.haml"
+ - "ee/app/views/projects/services/prometheus/_metrics.html.haml"
+ - "ee/app/views/projects/settings/slacks/edit.html.haml"
+ - "ee/app/views/shared/_additional_email_text.html.haml"
+ - "ee/app/views/shared/_geo_info_modal.html.haml"
+ - "ee/app/views/shared/_mirror_update_button.html.haml"
+ - "ee/app/views/shared/_shared_runners_minutes_limit.html.haml"
+ - "ee/app/views/shared/audit_events/_event_table.html.haml"
+ - "ee/app/views/shared/boards/components/_list_weight.html.haml"
+ - "ee/app/views/shared/boards/components/sidebar/_epic.html.haml"
+ - "ee/app/views/shared/ee/_import_form.html.haml"
+ - "ee/app/views/shared/epic/_search_bar.html.haml"
+ - "ee/app/views/shared/issuable/_approvals.html.haml"
+ - "ee/app/views/shared/issuable/_board_create_list_dropdown.html.haml"
+ - "ee/app/views/shared/issuable/_filter_weight.html.haml"
+ - "ee/app/views/shared/issuable/_sidebar_item_epic.haml"
+ - "ee/app/views/shared/members/ee/_ldap_tag.html.haml"
+ - "ee/app/views/shared/members/ee/_override_member_buttons.html.haml"
+ - "ee/app/views/shared/members/ee/_sso_badge.html.haml"
+ - "ee/app/views/shared/milestones/_burndown.html.haml"
+ - "ee/app/views/shared/milestones/_weight.html.haml"
+ - "ee/app/views/shared/promotions/_promote_audit_events.html.haml"
+ - "ee/app/views/shared/promotions/_promote_burndown_charts.html.haml"
+ - "ee/app/views/shared/promotions/_promote_csv_export.html.haml"
+ - "ee/app/views/shared/promotions/_promote_issue_weights.html.haml"
+ - "ee/app/views/shared/promotions/_promote_repository_features.html.haml"
+ - "ee/app/views/shared/promotions/_promote_servicedesk.html.haml"
+ - "ee/app/views/shared/push_rules/_form.html.haml"
+ - "ee/app/views/unsubscribes/show.html.haml"
+ - "ee/app/views/admin/users/_auditor_access_level_radio.html.haml"
+ - "ee/app/views/admin/users/_auditor_user_badge.html.haml"
+ - "ee/app/views/projects/protected_branches/_update_protected_branch.html.haml"
diff --git a/.pkgr.yml b/.pkgr.yml
index 10bcd7bd4bd..2e741f41a9e 100644
--- a/.pkgr.yml
+++ b/.pkgr.yml
@@ -3,8 +3,8 @@ group: git
services:
- postgres
before_precompile: ./bin/pkgr_before_precompile.sh
-env:
- - SKIP_STORAGE_VALIDATION=true
+env:
+ - SKIP_STORAGE_VALIDATION=true
targets:
debian-7: &wheezy
build_dependencies:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 17b185358ed..88521222b8a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,191 @@
documentation](doc/development/changelog.md) for instructions on adding your own
entry.
+## 11.11.0 (2019-05-22)
+
+### Security (1 change)
+
+- Destroy project remote mirrors instead of disabling. !27087
+
+### Fixed (74 changes, 19 of them are from the community)
+
+- Don't create a temp reference for branch comparisons within project. !24038
+- Fix some label links not appearing on group labels page and label title being a link on project labels page. !24060 (Tanya Pazitny)
+- Fix extra emails for custom notifications. !25607
+- Rewind IID on Ci::Pipelines. !26490
+- Fix duplicate merge request pipelines created by Sidekiq worker retry. !26643
+- Catch and report OpenSSL exceptions while fetching external configuration files in CI::Config. !26750 (Drew Cimino)
+- stop rendering download links for expired artifacts on the project tags page. !26753 (Drew Cimino)
+- Format extra help page text like wiki. !26782 (Bastian Blank)
+- Always show instance configuration link. !26783 (Bastian Blank)
+- Display maximum artifact size from runtime config. !26784 (Bastian Blank)
+- Resolve issue where list labels did not have the correct text color on creation. !26794 (Tucker Chapman)
+- Set release name when adding release notes to an existing tag. !26807
+- Fix the bug that the project statistics is not updated. !26854 (Hiroyuki Sato)
+- Client side changes for ListLastCommitsForTree response update. !26880
+- Fix api group visibility. !26896
+- Require all templates to use default stages. !26954
+- Remove a "reopen merge request button" on a "merged" merge request. !26965 (Hiroyuki Sato)
+- Fix misaligned image diff swipe view. !26969 (ftab)
+- Add badge-pill class on group member count. !27019
+- Remove leading / trailing spaces from heading when generating header ids. !27025 (Willian Balmant)
+- Respect updated_at attribute in notes produced by API calls. !27124 (Ben Gamari)
+- Fix GitHub project import visibility. !27133 (Daniel Wyatt)
+- Fixes actions dropdowns in environments page. !27160
+- Fixes create button background for Environments form. !27161
+- Display scoped labels in Issue Boards. !27164
+- Align UrlValidator to validate_url gem implementation. !27194 (Horatiu Eugen Vlad)
+- Resolve Web IDE template dropdown showing duplicates. !27237
+- Update GitLab Workhorse to v8.6.0. !27260
+- Only show in autocomplete when author active. !27292
+- Remove deadline for Git fsck. !27299
+- Show prioritized labels to guests. !27307
+- Properly expire all pipeline caches when pipeline is deleted. !27334
+- Replaced icon for external URL with doc-text icon. !27365
+- Add auto direction for issue title. !27378 (Ahmad Haghighi)
+- fix wiki search result links in titles. !27400 (khm)
+- Fix system notes timestamp when creating issue in the past. !27406
+- Fix approvals sometimes being reset after a merge request is rebased. !27446
+- Fix empty block in MR widget when user doesn't have permission. !27462
+- Fix wrong use of ActiveRecord in PoolRepository. !27464
+- Show proper preview for uploaded images in Web IDE. !27471
+- Resolve Renaming an image via Web IDE corrupts it. !27486
+- Clean up CarrierWave's import/export files. !27487
+- Fix autocomplete dropdown for usernames starting with period. !27533 (Jan Beckmann)
+- Disable password autocomplete in mirror repository form. !27542
+- Always use internal ID tables in development and production. !27544
+- Only show the "target branch has advanced" message when the merge request is open. !27588
+- Resolve Misalignment on suggested changes diff table. !27612
+- Update Workhorse to v8.7.0. !27630
+- Fix FE API and IDE handling of '/' relative_url_root. !27635
+- Hide ScopedBadge overflow notes. !27651
+- Fix base domain help text update. !27746
+- Upgrade letter_opener_web to support Rails 5.1. !27829
+- Fix webpack assets handling when relative url root is '/'. !27909
+- Fix IDE get file data with '/' as relative root. !27911
+- Allow a member to have an access level equal to parent group. !27913
+- Fix issuables state_id nil when importing projects from GitHub. !28027
+- Fix uploading of LFS tracked file through UI. !28052
+- Render Next badge only for gitlab.com. !28056
+- Fix update head pipeline process of Pipelines for merge requests. !28057
+- Fix visual issues in set status modal. !28147
+- Use a path for the related merge requests endpoint. !28171
+- disable SSH key validation in key details view. !28180 (Roger Meier)
+- Fix MR discussion border missing in chrome sometimes. !28185
+- Fix Error 500 when inviting user already present. !28198
+- Remove non-semantic use of `.row` in member listing controls. !28204
+- Properly handle LFS Batch API response in project import. !28223
+- Fix project visibility level validation. !28305 (Peter Marko)
+- Fix incorrect prefix used in new uploads for personal snippets. !28337
+- Fix Rugged get_tree_entries recursive flag not working. !28494
+- Fixes next badge being always visible.
+- Next badge must visible when canary flag is true.
+- Adds arrow icons to select option in CI/CD settings.
+- Vertically aligns the play button for stages.
+- Allow replying to individual notes from API.
+
+### Changed (19 changes, 3 of them are from the community)
+
+- Sort by due date and popularity in both directions for Issues and Merge requests. !25502 (Nermin Vehabovic)
+- Improve pipelines table spacing, add triggerer column. !26136
+- Allow extra arguments in helm commands when deploying the application in Auto-DevOps.gitlab-ci.yml. !26171 (tortuetorche)
+- Switch to sassc-rails for faster stylesheet compilation. !26224
+- Reorganize project merge request settings. !26834
+- Display a toast message when the Kubernetes runner has successfully upgraded. !27206
+- Allow guests users to access project releases. !27247
+- Add help texts to K8 form fields. !27274
+- Support prometheus for group level clusters. !27280
+- Include link to raw job log in plain-text emails. !27409
+- Only escape Markdown emphasis characters in autocomplete when necessary. !27457
+- Move location of charts/auto-deploy-app -> gitlab-org/charts/auto-deploy-app. !27477
+- Make canceled jobs not retryable. !27503
+- Upgrade to Gitaly v1.36.0. !27831
+- Update deployment event chat notification message. !27972
+- Upgrade to Gitaly v1.42.0. !28135
+- Resolve discussion when apply suggestion. !28160
+- Improve expanding diff to full file performance.
+- Knative version bump 0.3 -> 0.5. (Chris Baumbauer <cab@cabnetworks.net>)
+
+### Performance (5 changes)
+
+- Added list_pages method to avoid loading all wiki pages content. !22801
+- Add gitaly session id & catfile-cache feature flag. !27472
+- Add improvements to global search of issues and merge requests. !27817
+- Disable method replacement in avatar loading. !27866
+- Fix Blob.lazy always loading all previously-requested blobs when a new request is made.
+
+### Added (36 changes, 10 of them are from the community)
+
+- Add time preferences for user. !25381
+- Added write_repository scope for personal access token. !26021 (Horatiu Eugen Vlad)
+- Mark disabled pages domains for removal, but don't remove them yet. !26212
+- Remove pages domains if they weren't verified for 1 week. !26227
+- Expose pipeline variables via API. !26501 (Agustin Henze <tin@redhat.com>)
+- Download a folder from repository. !26532 (kiameisomabes)
+- Remove cleaned up OIDs from database and cache. !26555
+- Disables kubernetes resources creation if a cluster is not managed. !26565
+- Add CI_COMMIT_REF_PROTECTED CI variable. !26716 (Jason van den Hurk)
+- Add new API endpoint to expose a single environment. !26887
+- Allow Sentry configuration to be passed on gitlab.yml. !27091 (Roger Meier)
+- CI variables of type file. !27112
+- Allow linking to a private helm repository by providing credentials, and customisation of repository name. !27123 (Stuart Moore @stjm-cc)
+- Add time tracking information to Issue Boards sidebar. !27166
+- Play all manual jobs in a stage. !27188
+- Instance level kubernetes clusters. !27196
+- Adds if InfluxDB and Prometheus metrics are enabled to usage ping data. !27238
+- Autosave description in epics. !27296
+- Add deployment events to chat notification services. !27338
+- Add packages_size to ProjectStatistics. !27373
+- Added OmniAuth OpenID Connect strategy. !27383 (Horatiu Eugen Vlad)
+- Test using Git 2.21. !27418
+- Use official Gitea logo in importer. !27424 (Matti Ranta (@techknowlogick))
+- Add option to set access_level of runners upon registration. !27490 (Zelin L)
+- Add initial GraphQL query for Groups. !27492
+- Enable Sidekiq Reliable Fetcher for background jobs by default. !27530
+- Add backend support for a External Dashboard URL setting. !27550
+- Implement UI for uninstalling Cluster’s managed apps. !27559
+- Resolve Salesforce.com omniauth support. !27834
+- Leave project/group from access granted email. !27892
+- Allow Sentry client-side DSN to be passed on gitlab.yml. !27967
+- GraphQL: improve evaluation of query complexity based on arguments and query limits. !28017
+- Adds badge for Canary environment and help link.
+- Support negative matches.
+- Show category icons in user popover.
+- Added Omniauth UltraAuth strategy to GitLab. (Kartikey Tanna)
+
+### Other (29 changes, 8 of them are from the community)
+
+- Validate refs used in controllers don't have spaces. !24037
+- Migrate correlation and tracing code to LabKit. !25379
+- Update node.js to 10.15.3 in CI template for Hexo. !25943 (Takuya Noguchi)
+- Improve icons and button order in project overview. !26796
+- Add instructions on how to contribute a Built-In template for project. !26976
+- Extract DiscussionNotes component from NoteableDiscussion. !27066
+- Bump gRPC to 1.19.0 and protobuf to 3.7.1. !27086
+- Extract DiscussionActions component from NoteableDiscussion. !27227
+- Show disabled project repo mirrors in settings. !27326
+- Add backtrace to Gitaly performance bar. !27345
+- Moved EE/CE differences for dropdown_value_collapsed into CE. !27367
+- Remove "You are already signed in" banner. !27377
+- Move ee-specific code from boards/components/issue_card_inner.vue. !27394 (Roman Rodionov)
+- Upgrade to Rails 5.1. !27480 (Jasper Maes)
+- Update GitLab Runner Helm Chart to 0.4.0. !27508
+- Update GitLab Runner Helm Chart to 0.4.1. !27627
+- Refactored notes tests from Karma to Jest. !27648 (Martin Hobert)
+- refactor(issue): Refactored issue tests from Karma to Jest. !27673 (Martin Hobert)
+- Refactored Karma spec files to Jest. !27688 (Martin Hobert)
+- Add CSS fix for <wbr> elements on IE11. !27846
+- Update clair-local-scan to v2.0.8 for container scanning. !27977
+- Use PostgreSQL 10.7 in tests. !28020
+- Document EE License Auto Import During Install. !28106
+- Remove the note in the docs that multi-line suggestions are not yet available. !28119 (hardysim)
+- Update gitlab-shell to v9.1.0. !28184
+- Add EE fixtures to SeedFu list. !28241
+- Replaces CSS with BS4 utility class for pipeline schedules.
+- Creates a vendors folder for external CSS.
+- Add some frozen string to spec/**/*.rb. (gfyoung)
+
+
## 11.10.4 (2019-05-01)
### Fixed (12 changes)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 82e16b4fbf4..e4c954448a5 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -18,11 +18,11 @@ _This notice should stay as the first item in the CONTRIBUTING.md file._
## Contributing Documentation has been moved
As of July 2018, all the documentation for contributing to the GitLab project has been moved to a new location.
-[View the new documentation](doc/development/contributing/index.md) to find the latest information.
+[View the new documentation](https://about.gitlab.com/community/contribute/) to find the latest information.
## Contribute to GitLab
-This [documentation](doc/development/contributing/index.md#contribute-to-gitlab) has been moved.
+[View the new documentation](https://about.gitlab.com/community/contribute/) to find the latest information.
## Security vulnerability disclosure
@@ -42,7 +42,7 @@ This [documentation](doc/development/contributing/index.md#helping-others) has b
## I want to contribute!
-This [documentation](doc/development/contributing/index.md#i-want-to-contribute) has been moved.
+[View the new documentation](https://about.gitlab.com/community/contribute/) to find the latest information.
## Contribution Flow
diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION
index a50908ca3da..e640847f99c 100644
--- a/GITALY_SERVER_VERSION
+++ b/GITALY_SERVER_VERSION
@@ -1 +1 @@
-1.42.0
+1.42.1
diff --git a/GITLAB_ELASTICSEARCH_INDEXER_VERSION b/GITLAB_ELASTICSEARCH_INDEXER_VERSION
new file mode 100644
index 00000000000..9084fa2f716
--- /dev/null
+++ b/GITLAB_ELASTICSEARCH_INDEXER_VERSION
@@ -0,0 +1 @@
+1.1.0
diff --git a/GITLAB_SHELL_VERSION b/GITLAB_SHELL_VERSION
index 47da986f86f..deeb3d66ef0 100644
--- a/GITLAB_SHELL_VERSION
+++ b/GITLAB_SHELL_VERSION
@@ -1 +1 @@
-9.1.0
+9.2.0
diff --git a/Gemfile b/Gemfile
index 19432758b34..e2842ca27db 100644
--- a/Gemfile
+++ b/Gemfile
@@ -23,7 +23,7 @@ gem 'grape-path-helpers', '~> 1.1'
gem 'faraday', '~> 0.12'
# Authentication libraries
-gem 'devise', '~> 4.4'
+gem 'devise', '~> 4.6'
gem 'doorkeeper', '~> 4.3'
gem 'doorkeeper-openid_connect', '~> 1.5'
gem 'omniauth', '~> 1.8'
@@ -60,6 +60,8 @@ gem 'u2f', '~> 0.2.1'
# GitLab Pages
gem 'validates_hostname', '~> 1.0.6'
gem 'rubyzip', '~> 1.2.2', require: 'zip'
+# GitLab Pages letsencrypt support
+gem 'acme-client', '~> 2.0.2'
# Browser detection
gem 'browser', '~> 2.5'
@@ -167,7 +169,7 @@ gem 'redis-namespace', '~> 1.6.0'
gem 'gitlab-sidekiq-fetcher', '~> 0.4.0', require: 'sidekiq-reliable-fetch'
# Cron Parser
-gem 'fugit', '~> 1.1'
+gem 'fugit', '~> 1.2.1'
# HTTP requests
gem 'httparty', '~> 0.16.4'
@@ -351,14 +353,14 @@ group :development, :test do
gem 'spring', '~> 2.0.0'
gem 'spring-commands-rspec', '~> 1.0.4'
- gem 'gitlab-styles', '~> 2.6', require: false
+ gem 'gitlab-styles', '~> 2.7', require: false
# Pin these dependencies, otherwise a new rule could break the CI pipelines
- gem 'rubocop', '~> 0.68.1'
+ gem 'rubocop', '~> 0.69.0'
gem 'rubocop-performance', '~> 1.1.0'
gem 'rubocop-rspec', '~> 1.22.1'
gem 'scss_lint', '~> 0.56.0', require: false
- gem 'haml_lint', '~> 0.30.0', require: false
+ gem 'haml_lint', '~> 0.31.0', require: false
gem 'simplecov', '~> 0.14.0', require: false
gem 'bundler-audit', '~> 0.5.0', require: false
@@ -377,7 +379,7 @@ group :development, :test do
end
group :test do
- gem 'shoulda-matchers', '~> 3.1.2', require: false
+ gem 'shoulda-matchers', '~> 4.0.1', require: false
gem 'email_spec', '~> 2.2.0'
gem 'json-schema', '~> 2.8.0'
gem 'webmock', '~> 3.5.1'
@@ -407,7 +409,6 @@ gem 'health_check', '~> 2.6.0'
# System information
gem 'vmstat', '~> 2.3.0'
gem 'sys-filesystem', '~> 1.1.6'
-gem 'sys-proctable', '~> 1.2'
# SSH host key support
gem 'net-ssh', '~> 5.0'
diff --git a/Gemfile.lock b/Gemfile.lock
index 1bd88b65124..a63b7cc84aa 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -4,6 +4,8 @@ GEM
RedCloth (4.3.2)
abstract_type (0.0.7)
ace-rails-ap (4.1.2)
+ acme-client (2.0.2)
+ faraday (~> 0.9, >= 0.9.1)
actioncable (5.1.7)
actionpack (= 5.1.7)
nio4r (~> 2.0)
@@ -85,7 +87,7 @@ GEM
erubi (>= 1.0.0)
rack (>= 0.9.0)
bindata (2.4.3)
- binding_ninja (0.2.2)
+ binding_ninja (0.2.3)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
bootsnap (1.4.1)
@@ -156,7 +158,7 @@ GEM
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
device_detector (1.0.0)
- devise (4.4.3)
+ devise (4.6.2)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 6.0)
@@ -190,7 +192,7 @@ GEM
equalizer (0.0.11)
erubi (1.8.0)
escape_utils (1.2.1)
- et-orbi (1.1.7)
+ et-orbi (1.2.1)
tzinfo
eventmachine (1.2.7)
excon (0.62.0)
@@ -264,8 +266,8 @@ GEM
foreman (0.84.0)
thor (~> 0.19.1)
formatador (0.2.5)
- fugit (1.1.9)
- et-orbi (~> 1.1, >= 1.1.7)
+ fugit (1.2.1)
+ et-orbi (~> 1.1, >= 1.1.8)
raabro (~> 1.1)
fuubar (2.2.0)
rspec-core (~> 3.0)
@@ -297,8 +299,8 @@ GEM
gitlab-markup (1.7.0)
gitlab-sidekiq-fetcher (0.4.0)
sidekiq (~> 5)
- gitlab-styles (2.6.2)
- rubocop (~> 0.68.1)
+ gitlab-styles (2.7.0)
+ rubocop (~> 0.69.0)
rubocop-gitlab-security (~> 0.1.0)
rubocop-performance (~> 1.1.0)
rubocop-rspec (~> 1.19)
@@ -358,7 +360,7 @@ GEM
haml (5.0.4)
temple (>= 0.8.0)
tilt
- haml_lint (0.30.0)
+ haml_lint (0.31.0)
haml (>= 4.0, < 5.1)
rainbow
rake (>= 10, < 13)
@@ -591,7 +593,7 @@ GEM
orm_adapter (0.5.0)
os (1.0.0)
parallel (1.17.0)
- parser (2.5.3.0)
+ parser (2.6.3.0)
ast (~> 2.4.0)
parslet (1.8.2)
peek (1.0.1)
@@ -766,8 +768,8 @@ GEM
rspec-mocks (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
- rspec-parameterized (0.4.1)
- binding_ninja (>= 0.2.1)
+ rspec-parameterized (0.4.2)
+ binding_ninja (>= 0.2.3)
parser
proc_to_ast
rspec (>= 2.13, < 4)
@@ -791,13 +793,13 @@ GEM
pg
rails
sqlite3
- rubocop (0.68.1)
+ rubocop (0.69.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
- parser (>= 2.5, != 2.5.1.1)
+ parser (>= 2.6)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
- unicode-display_width (>= 1.4.0, < 1.6)
+ unicode-display_width (>= 1.4.0, < 1.7)
rubocop-gitlab-security (0.1.1)
rubocop (>= 0.51)
rubocop-performance (1.1.0)
@@ -855,8 +857,8 @@ GEM
sexp_processor (4.12.0)
sham_rack (1.3.6)
rack
- shoulda-matchers (3.1.2)
- activesupport (>= 4.0.0)
+ shoulda-matchers (4.0.1)
+ activesupport (>= 4.2.0)
sidekiq (5.2.7)
connection_pool (~> 2.2, >= 2.2.2)
rack (>= 1.5.0)
@@ -904,8 +906,6 @@ GEM
httpclient (>= 2.4)
sys-filesystem (1.1.6)
ffi
- sys-proctable (1.2.1)
- ffi
sysexits (1.2.0)
temple (0.8.0)
test-prof (0.2.5)
@@ -937,7 +937,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
- unicode-display_width (1.5.0)
+ unicode-display_width (1.6.0)
unicorn (5.4.1)
kgio (~> 2.6)
raindrops (~> 0.7)
@@ -945,13 +945,13 @@ GEM
get_process_mem (~> 0)
unicorn (>= 4, < 6)
uniform_notifier (1.10.0)
- unparser (0.4.2)
+ unparser (0.4.5)
abstract_type (~> 0.0.7)
adamantium (~> 0.2.0)
concord (~> 0.1.5)
diff-lcs (~> 1.3)
equalizer (~> 0.0.9)
- parser (>= 2.3.1.2, < 2.6)
+ parser (~> 2.6.3)
procto (~> 0.0.2)
validate_email (0.1.6)
activemodel (>= 3.0)
@@ -998,6 +998,7 @@ PLATFORMS
DEPENDENCIES
RedCloth (~> 4.3.2)
ace-rails-ap (~> 4.1.0)
+ acme-client (~> 2.0.2)
activerecord_sane_schema_dumper (= 1.0)
acts-as-taggable-on (~> 6.0)
addressable (~> 2.5.2)
@@ -1034,7 +1035,7 @@ DEPENDENCIES
database_cleaner (~> 1.7.0)
deckar01-task_list (= 2.2.0)
device_detector
- devise (~> 4.4)
+ devise (~> 4.6)
devise-two-factor (~> 3.0.0)
diffy (~> 3.1.0)
discordrb-webhooks-blackst0ne (~> 3.3)
@@ -1061,7 +1062,7 @@ DEPENDENCIES
fog-rackspace (~> 0.1.1)
font-awesome-rails (~> 4.7)
foreman (~> 0.84.0)
- fugit (~> 1.1)
+ fugit (~> 1.2.1)
fuubar (~> 2.2.0)
gemojione (~> 3.3)
gettext (~> 3.2.2)
@@ -1073,7 +1074,7 @@ DEPENDENCIES
gitlab-labkit (~> 0.2.0)
gitlab-markup (~> 1.7.0)
gitlab-sidekiq-fetcher (~> 0.4.0)
- gitlab-styles (~> 2.6)
+ gitlab-styles (~> 2.7)
gitlab_omniauth-ldap (~> 2.1.1)
gon (~> 6.2)
google-api-client (~> 0.23)
@@ -1086,7 +1087,7 @@ DEPENDENCIES
graphiql-rails (~> 1.4.10)
graphql (~> 1.8.0)
grpc (~> 1.19.0)
- haml_lint (~> 0.30.0)
+ haml_lint (~> 0.31.0)
hamlit (~> 2.8.8)
hangouts-chat (~> 0.0.5)
hashie-forbidden_attributes
@@ -1181,7 +1182,7 @@ DEPENDENCIES
rspec-set (~> 0.1.3)
rspec_junit_formatter
rspec_profiling (~> 0.0.5)
- rubocop (~> 0.68.1)
+ rubocop (~> 0.69.0)
rubocop-performance (~> 1.1.0)
rubocop-rspec (~> 1.22.1)
ruby-fogbugz (~> 0.2.1)
@@ -1198,7 +1199,7 @@ DEPENDENCIES
sentry-raven (~> 2.7)
settingslogic (~> 2.0.9)
sham_rack (~> 1.3.6)
- shoulda-matchers (~> 3.1.2)
+ shoulda-matchers (~> 4.0.1)
sidekiq (~> 5.2.7)
sidekiq-cron (~> 1.0)
simple_po_parser (~> 1.1.2)
@@ -1211,7 +1212,6 @@ DEPENDENCIES
stackprof (~> 0.2.10)
state_machines-activerecord (~> 0.5.1)
sys-filesystem (~> 1.1.6)
- sys-proctable (~> 1.2)
test-prof (~> 0.2.5)
thin (~> 1.7.0)
timecop (~> 0.8.0)
diff --git a/VERSION b/VERSION
index fd59314f1ad..6a02cfa7c06 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-11.11.0-pre
+11.12.0-pre
diff --git a/app/assets/images/favicon-yellow.png b/app/assets/images/favicon-yellow.png
index 2d5289818b4..a80827808fc 100644
--- a/app/assets/images/favicon-yellow.png
+++ b/app/assets/images/favicon-yellow.png
Binary files differ
diff --git a/app/assets/javascripts/batch_comments/mixins/resolved_status.js b/app/assets/javascripts/batch_comments/mixins/resolved_status.js
index 20c31d9f8a4..96ee9f62ba4 100644
--- a/app/assets/javascripts/batch_comments/mixins/resolved_status.js
+++ b/app/assets/javascripts/batch_comments/mixins/resolved_status.js
@@ -1,7 +1,7 @@
export default {
computed: {
resolveButtonTitle() {
- let title = 'Mark as resolved';
+ let title = 'Mark comment as resolved';
if (this.resolvedBy) {
title = `Resolved by ${this.resolvedBy.name}`;
diff --git a/app/assets/javascripts/behaviors/markdown/render_mermaid.js b/app/assets/javascripts/behaviors/markdown/render_mermaid.js
index 798114b4b0b..d0b7f3ff7a2 100644
--- a/app/assets/javascripts/behaviors/markdown/render_mermaid.js
+++ b/app/assets/javascripts/behaviors/markdown/render_mermaid.js
@@ -15,7 +15,7 @@ import { sprintf, __ } from '../../locale';
// </pre>
//
-// This is an arbitary number; Can be iterated upon when suitable.
+// This is an arbitrary number; Can be iterated upon when suitable.
const MAX_CHAR_LIMIT = 5000;
export default function renderMermaid($els) {
diff --git a/app/assets/javascripts/boards/stores/actions.js b/app/assets/javascripts/boards/stores/actions.js
new file mode 100644
index 00000000000..da82b52330a
--- /dev/null
+++ b/app/assets/javascripts/boards/stores/actions.js
@@ -0,0 +1,65 @@
+const notImplemented = () => {
+ throw new Error('Not implemented!');
+};
+
+export default {
+ setEndpoints: () => {
+ notImplemented();
+ },
+
+ fetchLists: () => {
+ notImplemented();
+ },
+
+ generateDefaultLists: () => {
+ notImplemented();
+ },
+
+ createList: () => {
+ notImplemented();
+ },
+
+ updateList: () => {
+ notImplemented();
+ },
+
+ deleteList: () => {
+ notImplemented();
+ },
+
+ fetchIssuesForList: () => {
+ notImplemented();
+ },
+
+ moveIssue: () => {
+ notImplemented();
+ },
+
+ createNewIssue: () => {
+ notImplemented();
+ },
+
+ fetchBacklog: () => {
+ notImplemented();
+ },
+
+ bulkUpdateIssues: () => {
+ notImplemented();
+ },
+
+ fetchIssue: () => {
+ notImplemented();
+ },
+
+ toggleIssueSubscription: () => {
+ notImplemented();
+ },
+
+ showPage: () => {
+ notImplemented();
+ },
+
+ toggleEmptyState: () => {
+ notImplemented();
+ },
+};
diff --git a/app/assets/javascripts/boards/stores/index.js b/app/assets/javascripts/boards/stores/index.js
new file mode 100644
index 00000000000..f70395a3771
--- /dev/null
+++ b/app/assets/javascripts/boards/stores/index.js
@@ -0,0 +1,14 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import state from 'ee_else_ce/boards/stores/state';
+import actions from 'ee_else_ce/boards/stores/actions';
+import mutations from 'ee_else_ce/boards/stores/mutations';
+
+Vue.use(Vuex);
+
+export default () =>
+ new Vuex.Store({
+ state,
+ actions,
+ mutations,
+ });
diff --git a/app/assets/javascripts/boards/stores/mutation_types.js b/app/assets/javascripts/boards/stores/mutation_types.js
new file mode 100644
index 00000000000..fcdfa6799b6
--- /dev/null
+++ b/app/assets/javascripts/boards/stores/mutation_types.js
@@ -0,0 +1,21 @@
+export const SET_ENDPOINTS = 'SET_ENDPOINTS';
+export const REQUEST_ADD_LIST = 'REQUEST_ADD_LIST';
+export const RECEIVE_ADD_LIST_SUCCESS = 'RECEIVE_ADD_LIST_SUCCESS';
+export const RECEIVE_ADD_LIST_ERROR = 'RECEIVE_ADD_LIST_ERROR';
+export const REQUEST_UPDATE_LIST = 'REQUEST_UPDATE_LIST';
+export const RECEIVE_UPDATE_LIST_SUCCESS = 'RECEIVE_UPDATE_LIST_SUCCESS';
+export const RECEIVE_UPDATE_LIST_ERROR = 'RECEIVE_UPDATE_LIST_ERROR';
+export const REQUEST_REMOVE_LIST = 'REQUEST_REMOVE_LIST';
+export const RECEIVE_REMOVE_LIST_SUCCESS = 'RECEIVE_REMOVE_LIST_SUCCESS';
+export const RECEIVE_REMOVE_LIST_ERROR = 'RECEIVE_REMOVE_LIST_ERROR';
+export const REQUEST_ADD_ISSUE = 'REQUEST_ADD_ISSUE';
+export const RECEIVE_ADD_ISSUE_SUCCESS = 'RECEIVE_ADD_ISSUE_SUCCESS';
+export const RECEIVE_ADD_ISSUE_ERROR = 'RECEIVE_ADD_ISSUE_ERROR';
+export const REQUEST_MOVE_ISSUE = 'REQUEST_MOVE_ISSUE';
+export const RECEIVE_MOVE_ISSUE_SUCCESS = 'RECEIVE_MOVE_ISSUE_SUCCESS';
+export const RECEIVE_MOVE_ISSUE_ERROR = 'RECEIVE_MOVE_ISSUE_ERROR';
+export const REQUEST_UPDATE_ISSUE = 'REQUEST_UPDATE_ISSUE';
+export const RECEIVE_UPDATE_ISSUE_SUCCESS = 'RECEIVE_UPDATE_ISSUE_SUCCESS';
+export const RECEIVE_UPDATE_ISSUE_ERROR = 'RECEIVE_UPDATE_ISSUE_ERROR';
+export const SET_CURRENT_PAGE = 'SET_CURRENT_PAGE';
+export const TOGGLE_EMPTY_STATE = 'TOGGLE_EMPTY_STATE';
diff --git a/app/assets/javascripts/boards/stores/mutations.js b/app/assets/javascripts/boards/stores/mutations.js
new file mode 100644
index 00000000000..77ba68be07e
--- /dev/null
+++ b/app/assets/javascripts/boards/stores/mutations.js
@@ -0,0 +1,91 @@
+import * as mutationTypes from './mutation_types';
+
+const notImplemented = () => {
+ throw new Error('Not implemented!');
+};
+
+export default {
+ [mutationTypes.SET_ENDPOINTS]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.REQUEST_ADD_LIST]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.RECEIVE_ADD_LIST_SUCCESS]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.RECEIVE_ADD_LIST_ERROR]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.REQUEST_UPDATE_LIST]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.RECEIVE_UPDATE_LIST_SUCCESS]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.RECEIVE_UPDATE_LIST_ERROR]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.REQUEST_REMOVE_LIST]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.RECEIVE_REMOVE_LIST_SUCCESS]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.RECEIVE_REMOVE_LIST_ERROR]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.REQUEST_ADD_ISSUE]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.RECEIVE_ADD_ISSUE_SUCCESS]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.RECEIVE_ADD_ISSUE_ERROR]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.REQUEST_MOVE_ISSUE]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.RECEIVE_MOVE_ISSUE_SUCCESS]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.RECEIVE_MOVE_ISSUE_ERROR]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.REQUEST_UPDATE_ISSUE]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.RECEIVE_UPDATE_ISSUE_SUCCESS]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.RECEIVE_UPDATE_ISSUE_ERROR]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.SET_CURRENT_PAGE]: () => {
+ notImplemented();
+ },
+
+ [mutationTypes.TOGGLE_EMPTY_STATE]: () => {
+ notImplemented();
+ },
+};
diff --git a/app/assets/javascripts/boards/stores/state.js b/app/assets/javascripts/boards/stores/state.js
new file mode 100644
index 00000000000..dd16abb01a5
--- /dev/null
+++ b/app/assets/javascripts/boards/stores/state.js
@@ -0,0 +1,3 @@
+export default () => ({
+ // ...
+});
diff --git a/app/assets/javascripts/contextual_sidebar.js b/app/assets/javascripts/contextual_sidebar.js
index 03dea1ec0a5..b62ec8a651b 100644
--- a/app/assets/javascripts/contextual_sidebar.js
+++ b/app/assets/javascripts/contextual_sidebar.js
@@ -8,6 +8,8 @@ import { parseBoolean } from '~/lib/utils/common_utils';
// https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24555#note_134136110
const NAV_SIDEBAR_BREAKPOINT = 1200;
+export const SIDEBAR_COLLAPSED_CLASS = 'js-sidebar-collapsed';
+
export default class ContextualSidebar {
constructor() {
this.initDomElements();
@@ -62,6 +64,7 @@ export default class ContextualSidebar {
const breakpoint = bp.getBreakpointSize();
const dbp = ContextualSidebar.isDesktopBreakpoint();
+ this.$sidebar.toggleClass(SIDEBAR_COLLAPSED_CLASS, !show);
this.$sidebar.toggleClass('sidebar-expanded-mobile', !dbp ? show : false);
this.$overlay.toggleClass(
'mobile-nav-open',
diff --git a/app/assets/javascripts/create_merge_request_dropdown.js b/app/assets/javascripts/create_merge_request_dropdown.js
index 02aa507ba03..8f5cece0788 100644
--- a/app/assets/javascripts/create_merge_request_dropdown.js
+++ b/app/assets/javascripts/create_merge_request_dropdown.js
@@ -118,7 +118,7 @@ export default class CreateMergeRequestDropdown {
this.branchCreated = true;
window.location.href = data.url;
})
- .catch(() => Flash('Failed to create a branch for this issue. Please try again.'));
+ .catch(() => Flash(__('Failed to create a branch for this issue. Please try again.')));
}
createMergeRequest() {
@@ -130,7 +130,7 @@ export default class CreateMergeRequestDropdown {
this.mergeRequestCreated = true;
window.location.href = data.url;
})
- .catch(() => Flash('Failed to create Merge Request. Please try again.'));
+ .catch(() => Flash(__('Failed to create Merge Request. Please try again.')));
}
disable() {
@@ -227,7 +227,7 @@ export default class CreateMergeRequestDropdown {
.catch(() => {
this.unavailable();
this.disable();
- new Flash('Failed to get ref.');
+ new Flash(__('Failed to get ref.'));
this.isGettingRef = false;
diff --git a/app/assets/javascripts/diffs/components/app.vue b/app/assets/javascripts/diffs/components/app.vue
index 0ed4dcdcd81..11d6672cacf 100644
--- a/app/assets/javascripts/diffs/components/app.vue
+++ b/app/assets/javascripts/diffs/components/app.vue
@@ -157,10 +157,12 @@ export default {
this.adjustView();
eventHub.$once('fetchedNotesData', this.setDiscussions);
eventHub.$once('fetchDiffData', this.fetchData);
+ eventHub.$on('refetchDiffData', this.refetchDiffData);
this.CENTERED_LIMITED_CONTAINER_CLASSES = CENTERED_LIMITED_CONTAINER_CLASSES;
},
beforeDestroy() {
eventHub.$off('fetchDiffData', this.fetchData);
+ eventHub.$off('refetchDiffData', this.refetchDiffData);
this.removeEventListeners();
},
methods: {
@@ -175,10 +177,16 @@ export default {
'scrollToFile',
'toggleShowTreeList',
]),
- fetchData() {
+ refetchDiffData() {
+ this.assignedDiscussions = false;
+ this.fetchData(false);
+ },
+ fetchData(toggleTree = true) {
this.fetchDiffFiles()
.then(() => {
- this.hideTreeListIfJustOneFile();
+ if (toggleTree) {
+ this.hideTreeListIfJustOneFile();
+ }
requestIdleCallback(
() => {
diff --git a/app/assets/javascripts/diffs/components/tree_list.vue b/app/assets/javascripts/diffs/components/tree_list.vue
index 384f33e0983..30be2e68e76 100644
--- a/app/assets/javascripts/diffs/components/tree_list.vue
+++ b/app/assets/javascripts/diffs/components/tree_list.vue
@@ -1,6 +1,7 @@
<script>
import { mapActions, mapGetters, mapState } from 'vuex';
import { GlTooltipDirective } from '@gitlab/ui';
+import { s__, sprintf } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue';
import FileRow from '~/vue_shared/components/file_row.vue';
import FileRowStats from './file_row_stats.vue';
@@ -57,6 +58,9 @@ export default {
this.search = '';
},
},
+ searchPlaceholder: sprintf(s__('MergeRequest|Filter files or search with %{modifier_key}+p'), {
+ modifier_key: /Mac/i.test(navigator.userAgent) ? 'cmd' : 'ctrl',
+ }),
};
</script>
@@ -65,10 +69,13 @@ export default {
<div class="append-bottom-8 position-relative tree-list-search d-flex">
<div class="flex-fill d-flex">
<icon name="search" class="position-absolute tree-list-icon" />
+ <label for="diff-tree-search" class="sr-only">{{ $options.searchPlaceholder }}</label>
<input
+ id="diff-tree-search"
v-model="search"
- :placeholder="s__('MergeRequest|Filter files')"
+ :placeholder="$options.searchPlaceholder"
type="search"
+ name="diff-tree-search"
class="form-control"
/>
<button
diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js
index 386d08aed2b..35297b7c264 100644
--- a/app/assets/javascripts/diffs/store/actions.js
+++ b/app/assets/javascripts/diffs/store/actions.js
@@ -52,7 +52,7 @@ export const fetchDiffFiles = ({ state, commit }) => {
});
return axios
- .get(state.endpoint, { params: { w: state.showWhitespace ? null : '1' } })
+ .get(mergeUrlParams({ w: state.showWhitespace ? '0' : '1' }, state.endpoint))
.then(res => {
commit(types.SET_LOADING, false);
commit(types.SET_MERGE_REQUEST_DIFFS, res.data.merge_request_diffs || []);
@@ -125,7 +125,8 @@ export const startRenderDiffsQueue = ({ state, commit }) => {
new Promise(resolve => {
const nextFile = state.diffFiles.find(
file =>
- !file.renderIt && (!file.viewer.collapsed || !file.viewer.name === diffViewerModes.text),
+ !file.renderIt &&
+ (file.viewer && (!file.viewer.collapsed || !file.viewer.name === diffViewerModes.text)),
);
if (nextFile) {
@@ -315,8 +316,10 @@ export const setShowWhitespace = ({ commit }, { showWhitespace, pushState = fals
localStorage.setItem(WHITESPACE_STORAGE_KEY, showWhitespace);
if (pushState) {
- historyPushState(showWhitespace ? '?w=0' : '?w=1');
+ historyPushState(mergeUrlParams({ w: showWhitespace ? '0' : '1' }, window.location.href));
}
+
+ eventHub.$emit('refetchDiffData');
};
export const toggleFileFinder = ({ commit }, visible) => {
diff --git a/app/assets/javascripts/dirty_submit/dirty_submit_form.js b/app/assets/javascripts/dirty_submit/dirty_submit_form.js
index 765969daa32..0fcaec9531c 100644
--- a/app/assets/javascripts/dirty_submit/dirty_submit_form.js
+++ b/app/assets/javascripts/dirty_submit/dirty_submit_form.js
@@ -21,10 +21,15 @@ class DirtySubmitForm {
}
registerListeners() {
- const throttledUpdateDirtyInput = _.throttle(
- event => this.updateDirtyInput(event),
- DirtySubmitForm.THROTTLE_DURATION,
+ const getThrottledHandlerForInput = _.memoize(() =>
+ _.throttle(event => this.updateDirtyInput(event), DirtySubmitForm.THROTTLE_DURATION),
);
+
+ const throttledUpdateDirtyInput = event => {
+ const throttledHandler = getThrottledHandlerForInput(event.target.name);
+ throttledHandler(event);
+ };
+
this.form.addEventListener('input', throttledUpdateDirtyInput);
this.form.addEventListener('change', throttledUpdateDirtyInput);
$(this.form).on('change.select2', throttledUpdateDirtyInput);
diff --git a/app/assets/javascripts/dropzone_input.js b/app/assets/javascripts/dropzone_input.js
index 9987fbcb6a7..0ff26445a6a 100644
--- a/app/assets/javascripts/dropzone_input.js
+++ b/app/assets/javascripts/dropzone_input.js
@@ -4,6 +4,7 @@ import _ from 'underscore';
import './behaviors/preview_markdown';
import csrf from './lib/utils/csrf';
import axios from './lib/utils/axios_utils';
+import { n__, __ } from '~/locale';
Dropzone.autoDiscover = false;
@@ -90,7 +91,7 @@ export default function dropzoneInput(form) {
if (!processingFileCount) $attachButton.removeClass('hide');
addFileToForm(response.link.url);
},
- error: (file, errorMessage = 'Attaching the file failed.', xhr) => {
+ error: (file, errorMessage = __('Attaching the file failed.'), xhr) => {
// If 'error' event is fired by dropzone, the second parameter is error message.
// If the 'errorMessage' parameter is empty, the default error message is set.
// If the 'error' event is fired by backend (xhr) error response, the third parameter is
@@ -273,19 +274,11 @@ export default function dropzoneInput(form) {
};
updateAttachingMessage = (files, messageContainer) => {
- let attachingMessage;
const filesCount = files.filter(file => file.status === 'uploading' || file.status === 'queued')
.length;
+ const attachingMessage = n__('Attaching a file', 'Attaching %d files', filesCount);
- // Dinamycally change uploading files text depending on files number in
- // dropzone files queue.
- if (filesCount > 1) {
- attachingMessage = `Attaching ${filesCount} files -`;
- } else {
- attachingMessage = 'Attaching a file -';
- }
-
- messageContainer.text(attachingMessage);
+ messageContainer.text(`${attachingMessage} -`);
};
form.find('.markdown-selector').click(function onMarkdownClick(e) {
diff --git a/app/assets/javascripts/filtered_search/dropdown_user.js b/app/assets/javascripts/filtered_search/dropdown_user.js
index f1e7be6bde1..a65c0012b4d 100644
--- a/app/assets/javascripts/filtered_search/dropdown_user.js
+++ b/app/assets/javascripts/filtered_search/dropdown_user.js
@@ -18,6 +18,7 @@ export default class DropdownUser extends DropdownAjaxFilter {
group_id: this.getGroupId(),
project_id: this.getProjectId(),
current_user: true,
+ ...this.projectOrGroupId(),
},
onLoadingFinished: () => {
this.hideCurrentUser();
@@ -36,4 +37,17 @@ export default class DropdownUser extends DropdownAjaxFilter {
getProjectId() {
return this.input.getAttribute('data-project-id');
}
+
+ projectOrGroupId() {
+ const projectId = this.getProjectId();
+ const groupId = this.getGroupId();
+ if (groupId) {
+ return {
+ group_id: groupId,
+ };
+ }
+ return {
+ project_id: projectId,
+ };
+ }
}
diff --git a/app/assets/javascripts/fly_out_nav.js b/app/assets/javascripts/fly_out_nav.js
index 2b6af9060d1..2566ed6b47c 100644
--- a/app/assets/javascripts/fly_out_nav.js
+++ b/app/assets/javascripts/fly_out_nav.js
@@ -1,4 +1,5 @@
import bp from './breakpoints';
+import { SIDEBAR_COLLAPSED_CLASS } from './contextual_sidebar';
const HIDE_INTERVAL_TIMEOUT = 300;
const IS_OVER_CLASS = 'is-over';
@@ -29,7 +30,7 @@ const setHeaderHeight = () => {
};
export const isSidebarCollapsed = () =>
- sidebar && sidebar.classList.contains('sidebar-collapsed-desktop');
+ sidebar && sidebar.classList.contains(SIDEBAR_COLLAPSED_CLASS);
export const canShowActiveSubItems = el => {
if (el.classList.contains('active') && !isSidebarCollapsed()) {
diff --git a/app/assets/javascripts/gl_field_error.js b/app/assets/javascripts/gl_field_error.js
index a5b8c357e8a..04301c9ce12 100644
--- a/app/assets/javascripts/gl_field_error.js
+++ b/app/assets/javascripts/gl_field_error.js
@@ -1,4 +1,5 @@
import $ from 'jquery';
+import { __ } from '~/locale';
/**
* This class overrides the browser's validation error bubbles, displaying custom
@@ -61,7 +62,7 @@ export default class GlFieldError {
this.inputElement = $(input);
this.inputDomElement = this.inputElement.get(0);
this.form = formErrors;
- this.errorMessage = this.inputElement.attr('title') || 'This field is required.';
+ this.errorMessage = this.inputElement.attr('title') || __('This field is required.');
this.fieldErrorElement = $(`<p class='${errorMessageClass} hidden'>${this.errorMessage}</p>`);
this.state = {
diff --git a/app/assets/javascripts/gpg_badges.js b/app/assets/javascripts/gpg_badges.js
index efba6fc1aff..96051b612b5 100644
--- a/app/assets/javascripts/gpg_badges.js
+++ b/app/assets/javascripts/gpg_badges.js
@@ -20,7 +20,7 @@ export default class GpgBadges {
const endpoint = tag.data('signaturesPath');
if (!endpoint) {
displayError();
- return Promise.reject(new Error('Missing commit signatures endpoint!'));
+ return Promise.reject(new Error(__('Missing commit signatures endpoint!')));
}
const params = parseQueryStringIntoObject(tag.serialize());
diff --git a/app/assets/javascripts/groups_select.js b/app/assets/javascripts/groups_select.js
index bdadbb1bb2a..a1263d1cdab 100644
--- a/app/assets/javascripts/groups_select.js
+++ b/app/assets/javascripts/groups_select.js
@@ -2,6 +2,7 @@ import $ from 'jquery';
import axios from './lib/utils/axios_utils';
import Api from './api';
import { normalizeHeaders } from './lib/utils/common_utils';
+import { __ } from '~/locale';
export default function groupsSelect() {
import(/* webpackChunkName: 'select2' */ 'select2/select2')
@@ -18,7 +19,7 @@ export default function groupsSelect() {
: Api.groupsPath;
$select.select2({
- placeholder: 'Search for a group',
+ placeholder: __('Search for a group'),
allowClear: $select.hasClass('allowClear'),
multiple: $select.hasClass('multiselect'),
minimumInputLength: 0,
diff --git a/app/assets/javascripts/import_projects/store/getters.js b/app/assets/javascripts/import_projects/store/getters.js
index f03474a8404..727b80765bd 100644
--- a/app/assets/javascripts/import_projects/store/getters.js
+++ b/app/assets/javascripts/import_projects/store/getters.js
@@ -1,3 +1,5 @@
+import { __ } from '~/locale';
+
export const namespaceSelectOptions = state => {
const serializedNamespaces = state.namespaces.map(({ fullPath }) => ({
id: fullPath,
@@ -5,9 +7,9 @@ export const namespaceSelectOptions = state => {
}));
return [
- { text: 'Groups', children: serializedNamespaces },
+ { text: __('Groups'), children: serializedNamespaces },
{
- text: 'Users',
+ text: __('Users'),
children: [{ id: state.defaultTargetNamespace, text: state.defaultTargetNamespace }],
},
];
diff --git a/app/assets/javascripts/issuable_bulk_update_actions.js b/app/assets/javascripts/issuable_bulk_update_actions.js
index ccbe591a63e..bc9d7fcf30d 100644
--- a/app/assets/javascripts/issuable_bulk_update_actions.js
+++ b/app/assets/javascripts/issuable_bulk_update_actions.js
@@ -4,6 +4,7 @@ import $ from 'jquery';
import _ from 'underscore';
import axios from './lib/utils/axios_utils';
import Flash from './flash';
+import { __ } from './locale';
export default {
init({ container, form, issues, prefixId } = {}) {
@@ -32,7 +33,7 @@ export default {
onFormSubmitFailure() {
this.form.find('[type="submit"]').enable();
- return new Flash('Issue update failed');
+ return new Flash(__('Issue update failed'));
},
getSelectedIssues() {
diff --git a/app/assets/javascripts/issuable_index.js b/app/assets/javascripts/issuable_index.js
index ffcbd7cf28c..f51c7a2f990 100644
--- a/app/assets/javascripts/issuable_index.js
+++ b/app/assets/javascripts/issuable_index.js
@@ -1,7 +1,7 @@
import $ from 'jquery';
import axios from './lib/utils/axios_utils';
import flash from './flash';
-import { __ } from './locale';
+import { s__, __ } from './locale';
import IssuableBulkUpdateSidebar from './issuable_bulk_update_sidebar';
import IssuableBulkUpdateActions from './issuable_bulk_update_actions';
@@ -29,7 +29,7 @@ export default class IssuableIndex {
$resetToken.on('click', e => {
e.preventDefault();
- $resetToken.text('resetting...');
+ $resetToken.text(s__('EmailToken|resetting...'));
axios
.put($resetToken.attr('href'))
@@ -38,12 +38,12 @@ export default class IssuableIndex {
.val(data.new_address)
.focus();
- $resetToken.text('reset it');
+ $resetToken.text(s__('EmailToken|reset it'));
})
.catch(() => {
flash(__('There was an error when reseting email token.'));
- $resetToken.text('reset it');
+ $resetToken.text(s__('EmailToken|reset it'));
});
});
}
diff --git a/app/assets/javascripts/issue.js b/app/assets/javascripts/issue.js
index cd1afb6ba83..db4607ca58d 100644
--- a/app/assets/javascripts/issue.js
+++ b/app/assets/javascripts/issue.js
@@ -7,6 +7,7 @@ import flash from './flash';
import TaskList from './task_list';
import CreateMergeRequestDropdown from './create_merge_request_dropdown';
import IssuablesHelper from './helpers/issuables_helper';
+import { __ } from './locale';
export default class Issue {
constructor() {
@@ -44,7 +45,11 @@ export default class Issue {
* @param {Array} data
* @param {String} issueFailMessage
*/
- updateTopState(isClosed, data, issueFailMessage = 'Unable to update this issue at this time.') {
+ updateTopState(
+ isClosed,
+ data,
+ issueFailMessage = __('Unable to update this issue at this time.'),
+ ) {
if ('id' in data) {
const isClosedBadge = $('div.status-box-issue-closed');
const isOpenBadge = $('div.status-box-open');
@@ -81,7 +86,7 @@ export default class Issue {
}
initIssueBtnEventListeners() {
- const issueFailMessage = 'Unable to update this issue at this time.';
+ const issueFailMessage = __('Unable to update this issue at this time.');
return $(document).on(
'click',
@@ -152,6 +157,6 @@ export default class Issue {
$container.html(data.html);
}
})
- .catch(() => flash('Failed to load related branches'));
+ .catch(() => flash(__('Failed to load related branches')));
}
}
diff --git a/app/assets/javascripts/issue_status_select.js b/app/assets/javascripts/issue_status_select.js
index c14803c80e7..75edff41a89 100644
--- a/app/assets/javascripts/issue_status_select.js
+++ b/app/assets/javascripts/issue_status_select.js
@@ -1,4 +1,5 @@
import $ from 'jquery';
+import { __ } from './locale';
export default function issueStatusSelect() {
$('.js-issue-status').each((i, el) => {
@@ -7,7 +8,7 @@ export default function issueStatusSelect() {
selectable: true,
fieldName,
toggleLabel(selected, element, instance) {
- let label = 'Author';
+ let label = __('Author');
const $item = instance.dropdown.find('.is-active');
if ($item.length) {
label = $item.text();
diff --git a/app/assets/javascripts/label_manager.js b/app/assets/javascripts/label_manager.js
index 4d304c5fe69..c6dd21cd2d4 100644
--- a/app/assets/javascripts/label_manager.js
+++ b/app/assets/javascripts/label_manager.js
@@ -5,13 +5,14 @@ import Sortable from 'sortablejs';
import flash from './flash';
import axios from './lib/utils/axios_utils';
+import { __ } from './locale';
export default class LabelManager {
constructor({ togglePriorityButton, prioritizedLabels, otherLabels } = {}) {
this.togglePriorityButton = togglePriorityButton || $('.js-toggle-priority');
this.prioritizedLabels = prioritizedLabels || $('.js-prioritized-labels');
this.otherLabels = otherLabels || $('.js-other-labels');
- this.errorMessage = 'Unable to update label prioritization at this time';
+ this.errorMessage = __('Unable to update label prioritization at this time');
this.emptyState = document.querySelector('#js-priority-labels-empty-state');
this.$badgeItemTemplate = $('#js-badge-item-template');
diff --git a/app/assets/javascripts/labels_select.js b/app/assets/javascripts/labels_select.js
index 2c30b4ea587..3f954b43ee3 100644
--- a/app/assets/javascripts/labels_select.js
+++ b/app/assets/javascripts/labels_select.js
@@ -4,7 +4,7 @@
import $ from 'jquery';
import _ from 'underscore';
-import { sprintf, __ } from './locale';
+import { sprintf, s__, __ } from './locale';
import axios from './lib/utils/axios_utils';
import IssuableBulkUpdateActions from './issuable_bulk_update_actions';
import CreateLabelDropdown from './create_label';
@@ -178,7 +178,7 @@ export default class LabelsSelect {
});
}
} else {
- template = '<span class="no-value">None</span>';
+ template = `<span class="no-value">${__('None')}</span>`;
}
$value.removeAttr('style').html(template);
$sidebarCollapsedValue.text(labelCount);
@@ -190,7 +190,9 @@ export default class LabelsSelect {
if (labelTitles.length > 5) {
labelTitles = labelTitles.slice(0, 5);
- labelTitles.push('and ' + (data.labels.length - 5) + ' more');
+ labelTitles.push(
+ sprintf(s__('Labels|and %{count} more'), { count: data.labels.length - 5 }),
+ );
}
labelTooltipTitle = labelTitles.join(', ');
@@ -219,13 +221,13 @@ export default class LabelsSelect {
if (showNo) {
extraData.unshift({
id: 0,
- title: 'No Label',
+ title: __('No Label'),
});
}
if (showAny) {
extraData.unshift({
isAny: true,
- title: 'Any Label',
+ title: __('Any Label'),
});
}
if (extraData.length) {
@@ -341,7 +343,7 @@ export default class LabelsSelect {
if (selected && selected.id === 0) {
this.selected = [];
- return 'No Label';
+ return __('No Label');
} else if (isSelected) {
this.selected.push(title);
} else if (!isSelected && title) {
@@ -579,7 +581,7 @@ export default class LabelsSelect {
if ($('.selected-issuable:checked').length) {
return;
}
- return $('.issues-bulk-update .labels-filter .dropdown-toggle-text').text('Label');
+ return $('.issues-bulk-update .labels-filter .dropdown-toggle-text').text(__('Label'));
}
// eslint-disable-next-line class-methods-use-this
enableBulkLabelDropdown() {
diff --git a/app/assets/javascripts/lib/utils/highlight.js b/app/assets/javascripts/lib/utils/highlight.js
index 4f7eff2cca1..8f0afa3467d 100644
--- a/app/assets/javascripts/lib/utils/highlight.js
+++ b/app/assets/javascripts/lib/utils/highlight.js
@@ -27,14 +27,14 @@ export default function highlight(string, match = '', matchPrefix = '<b>', match
const sanitizedValue = sanitize(string.toString(), { allowedTags: [] });
- // occurences is an array of character indices that should be
+ // occurrences is an array of character indices that should be
// highlighted in the original string, i.e. [3, 4, 5, 7]
- const occurences = fuzzaldrinPlus.match(sanitizedValue, match.toString());
+ const occurrences = fuzzaldrinPlus.match(sanitizedValue, match.toString());
return sanitizedValue
.split('')
.map((character, i) => {
- if (_.contains(occurences, i)) {
+ if (_.contains(occurrences, i)) {
return `${matchPrefix}${character}${matchSuffix}`;
}
diff --git a/app/assets/javascripts/locale/index.js b/app/assets/javascripts/locale/index.js
index 1ae3362c4bc..41aa0f4ddb9 100644
--- a/app/assets/javascripts/locale/index.js
+++ b/app/assets/javascripts/locale/index.js
@@ -11,7 +11,7 @@ delete window.translations;
@param text The text to be translated
@returns {String} The translated text
*/
-const gettext = text => locale.gettext.bind(locale)(ensureSingleLine(text));
+const gettext = text => locale.gettext(ensureSingleLine(text));
/**
Translate the text with a number
diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js
index 213d5c6521a..9f30a989295 100644
--- a/app/assets/javascripts/main.js
+++ b/app/assets/javascripts/main.js
@@ -31,6 +31,7 @@ import initPerformanceBar from './performance_bar';
import initSearchAutocomplete from './search_autocomplete';
import GlFieldErrors from './gl_field_errors';
import initUserPopovers from './user_popovers';
+import { __ } from './locale';
// expose jQuery as global (TODO: remove these)
window.jQuery = jQuery;
@@ -147,7 +148,7 @@ function deferredInitialisation() {
const canaryBadge = document.querySelector('.js-canary-badge');
const canaryLink = document.querySelector('.js-canary-link');
if (canaryBadge) {
- canaryBadge.classList.add('hidden');
+ canaryBadge.classList.remove('hidden');
}
if (canaryLink) {
canaryLink.classList.add('hidden');
@@ -219,9 +220,9 @@ document.addEventListener('DOMContentLoaded', () => {
const ref = xhrObj.status;
if (ref === 401) {
- Flash('You need to be logged in.');
+ Flash(__('You need to be logged in.'));
} else if (ref === 404 || ref === 500) {
- Flash('Something went wrong on our end.');
+ Flash(__('Something went wrong on our end.'));
}
});
diff --git a/app/assets/javascripts/merge_request_tabs.js b/app/assets/javascripts/merge_request_tabs.js
index 509f19e6f00..e5cf43e8289 100644
--- a/app/assets/javascripts/merge_request_tabs.js
+++ b/app/assets/javascripts/merge_request_tabs.js
@@ -21,6 +21,7 @@ import { localTimeAgo } from './lib/utils/datetime_utility';
import syntaxHighlight from './syntax_highlight';
import Notes from './notes';
import { polyfillSticky } from './lib/utils/sticky';
+import { __ } from './locale';
// MergeRequestTabs
//
@@ -326,7 +327,7 @@ export default class MergeRequestTabs {
})
.catch(() => {
this.toggleLoading(false);
- flash('An error occurred while fetching this tab.');
+ flash(__('An error occurred while fetching this tab.'));
});
}
@@ -416,7 +417,7 @@ export default class MergeRequestTabs {
})
.catch(() => {
this.toggleLoading(false);
- flash('An error occurred while fetching this tab.');
+ flash(__('An error occurred while fetching this tab.'));
});
}
diff --git a/app/assets/javascripts/milestone.js b/app/assets/javascripts/milestone.js
index f211632cf24..6aaba4e7c74 100644
--- a/app/assets/javascripts/milestone.js
+++ b/app/assets/javascripts/milestone.js
@@ -2,6 +2,7 @@ import $ from 'jquery';
import axios from './lib/utils/axios_utils';
import flash from './flash';
import { mouseenter, debouncedMouseleave, togglePopover } from './shared/popover';
+import { __ } from './locale';
export default class Milestone {
constructor() {
@@ -42,7 +43,7 @@ export default class Milestone {
$(tabElId).html(data.html);
$target.addClass('is-loaded');
})
- .catch(() => flash('Error loading milestone tab'));
+ .catch(() => flash(__('Error loading milestone tab')));
}
}
diff --git a/app/assets/javascripts/milestone_select.js b/app/assets/javascripts/milestone_select.js
index 75c18a9b6a0..43949d5cc86 100644
--- a/app/assets/javascripts/milestone_select.js
+++ b/app/assets/javascripts/milestone_select.js
@@ -56,14 +56,15 @@ export default class MilestoneSelect {
const $value = $block.find('.value');
const $loading = $block.find('.block-loading').fadeOut();
selectedMilestoneDefault = showAny ? '' : null;
- selectedMilestoneDefault = showNo && defaultNo ? 'No Milestone' : selectedMilestoneDefault;
+ selectedMilestoneDefault =
+ showNo && defaultNo ? __('No Milestone') : selectedMilestoneDefault;
selectedMilestone = $dropdown.data('selected') || selectedMilestoneDefault;
if (issueUpdateURL) {
milestoneLinkTemplate = _.template(
'<a href="<%- web_url %>" class="bold has-tooltip" data-container="body" title="<%- remaining %>"><%- title %></a>',
);
- milestoneLinkNoneTemplate = '<span class="no-value">None</span>';
+ milestoneLinkNoneTemplate = `<span class="no-value">${__('None')}</span>`;
}
return $dropdown.glDropdown({
showMenuAbove: showMenuAbove,
@@ -74,28 +75,28 @@ export default class MilestoneSelect {
extraOptions.push({
id: null,
name: null,
- title: 'Any Milestone',
+ title: __('Any Milestone'),
});
}
if (showNo) {
extraOptions.push({
id: -1,
- name: 'No Milestone',
- title: 'No Milestone',
+ name: __('No Milestone'),
+ title: __('No Milestone'),
});
}
if (showUpcoming) {
extraOptions.push({
id: -2,
name: '#upcoming',
- title: 'Upcoming',
+ title: __('Upcoming'),
});
}
if (showStarted) {
extraOptions.push({
id: -3,
name: '#started',
- title: 'Started',
+ title: __('Started'),
});
}
if (extraOptions.length) {
diff --git a/app/assets/javascripts/mini_pipeline_graph_dropdown.js b/app/assets/javascripts/mini_pipeline_graph_dropdown.js
index 81ab9d8be4b..b39ad764f01 100644
--- a/app/assets/javascripts/mini_pipeline_graph_dropdown.js
+++ b/app/assets/javascripts/mini_pipeline_graph_dropdown.js
@@ -1,6 +1,7 @@
import $ from 'jquery';
import flash from './flash';
import axios from './lib/utils/axios_utils';
+import { __ } from './locale';
/**
* In each pipelines table we have a mini pipeline graph for each pipeline.
@@ -98,7 +99,7 @@ export default class MiniPipelineGraph {
) {
$(button).dropdown('toggle');
}
- flash('An error occurred while fetching the builds.', 'alert');
+ flash(__('An error occurred while fetching the builds.'), 'alert');
});
}
diff --git a/app/assets/javascripts/monitoring/components/charts/area.vue b/app/assets/javascripts/monitoring/components/charts/area.vue
index afe8d87a8d6..c43791f2426 100644
--- a/app/assets/javascripts/monitoring/components/charts/area.vue
+++ b/app/assets/javascripts/monitoring/components/charts/area.vue
@@ -125,17 +125,17 @@ export default {
},
earliestDatapoint() {
return this.chartData.reduce((acc, series) => {
- if (!series.data.length) {
+ const { data } = series;
+ const { length } = data;
+ if (!length) {
return acc;
}
- const [[timestamp]] = series.data.sort(([a], [b]) => {
- if (a < b) {
- return -1;
- }
- return a > b ? 1 : 0;
- });
- return timestamp < acc || acc === null ? timestamp : acc;
+ const [first] = data[0];
+ const [last] = data[length - 1];
+ const seriesEarliest = first < last ? first : last;
+
+ return seriesEarliest < acc || acc === null ? seriesEarliest : acc;
}, null);
},
isMultiSeries() {
diff --git a/app/assets/javascripts/namespace_select.js b/app/assets/javascripts/namespace_select.js
index ee1a5274ff7..03d349ac714 100644
--- a/app/assets/javascripts/namespace_select.js
+++ b/app/assets/javascripts/namespace_select.js
@@ -4,6 +4,7 @@ import $ from 'jquery';
import Api from './api';
import { mergeUrlParams } from './lib/utils/url_utility';
import { parseBoolean } from '~/lib/utils/common_utils';
+import { __ } from './locale';
export default class NamespaceSelect {
constructor(opts) {
@@ -29,7 +30,7 @@ export default class NamespaceSelect {
return Api.namespaces(term, function(namespaces) {
if (isFilter) {
const anyNamespace = {
- text: 'Any namespace',
+ text: __('Any namespace'),
id: null,
};
namespaces.unshift(anyNamespace);
diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js
index 36725e22365..d03f4508fb8 100644
--- a/app/assets/javascripts/notes.js
+++ b/app/assets/javascripts/notes.js
@@ -35,6 +35,7 @@ import {
} from './lib/utils/common_utils';
import imageDiffHelper from './image_diff/helpers/index';
import { localTimeAgo } from './lib/utils/datetime_utility';
+import { sprintf, s__, __ } from './locale';
window.autosize = Autosize;
@@ -253,7 +254,7 @@ export default class Notes {
discussionNoteForm = $textarea.closest('.js-discussion-note-form');
if (discussionNoteForm.length) {
if ($textarea.val() !== '') {
- if (!window.confirm('Are you sure you want to cancel creating this comment?')) {
+ if (!window.confirm(__('Are you sure you want to cancel creating this comment?'))) {
return;
}
}
@@ -265,7 +266,7 @@ export default class Notes {
originalText = $textarea.closest('form').data('originalNote');
newText = $textarea.val();
if (originalText !== newText) {
- if (!window.confirm('Are you sure you want to cancel editing this comment?')) {
+ if (!window.confirm(__('Are you sure you want to cancel editing this comment?'))) {
return;
}
}
@@ -636,7 +637,7 @@ export default class Notes {
this.glForm = new GLForm(form, enableGFM);
textarea = form.find('.js-note-text');
key = [
- 'Note',
+ s__('NoteForm|Note'),
form.find('#note_noteable_type').val(),
form.find('#note_noteable_id').val(),
form.find('#note_commit_id').val(),
@@ -670,7 +671,9 @@ export default class Notes {
formParentTimeline = $form.closest('.discussion-notes').find('.notes');
}
return this.addFlash(
- 'Your comment could not be submitted! Please check your network connection and try again.',
+ __(
+ 'Your comment could not be submitted! Please check your network connection and try again.',
+ ),
'alert',
formParentTimeline.get(0),
);
@@ -679,7 +682,7 @@ export default class Notes {
updateNoteError($parentTimeline) {
// eslint-disable-next-line no-new
new Flash(
- 'Your comment could not be updated! Please check your network connection and try again.',
+ __('Your comment could not be updated! Please check your network connection and try again.'),
);
}
@@ -1258,12 +1261,19 @@ export default class Notes {
putConflictEditWarningInPlace(noteEntity, $note) {
if ($note.find('.js-conflict-edit-warning').length === 0) {
+ const open_link = `<a href="#note_${
+ noteEntity.id
+ }" target="_blank" rel="noopener noreferrer">`;
const $alert = $(`<div class="js-conflict-edit-warning alert alert-danger">
- This comment has changed since you started editing, please review the
- <a href="#note_${noteEntity.id}" target="_blank" rel="noopener noreferrer">
- updated comment
- </a>
- to ensure information is not lost
+ ${sprintf(
+ s__(
+ 'Notes|This comment has changed since you started editing, please review the %{open_link}updated comment%{close_link} to ensure information is not lost',
+ ),
+ {
+ open_link,
+ close_link: '</a>',
+ },
+ )}
</div>`);
$alert.insertAfter($note.find('.note-text'));
}
@@ -1491,13 +1501,15 @@ export default class Notes {
if (executedCommands && executedCommands.length) {
if (executedCommands.length > 1) {
- tempFormContent = 'Applying multiple commands';
+ tempFormContent = __('Applying multiple commands');
} else {
const commandDescription = executedCommands[0].description.toLowerCase();
- tempFormContent = `Applying command to ${commandDescription}`;
+ tempFormContent = sprintf(__('Applying command to %{commandDescription}'), {
+ commandDescription,
+ });
}
} else {
- tempFormContent = 'Applying command';
+ tempFormContent = __('Applying command');
}
return tempFormContent;
@@ -1817,7 +1829,9 @@ export default class Notes {
$editingNote
.find('.note-headline-meta a')
.html(
- '<i class="fa fa-spinner fa-spin" aria-label="Comment is being updated" aria-hidden="true"></i>',
+ `<i class="fa fa-spinner fa-spin" aria-label="${__(
+ 'Comment is being updated',
+ )}" aria-hidden="true"></i>`,
);
// Make request to update comment on server
diff --git a/app/assets/javascripts/notes/components/note_actions.vue b/app/assets/javascripts/notes/components/note_actions.vue
index 7e8f23d6a96..5a4ff15d198 100644
--- a/app/assets/javascripts/notes/components/note_actions.vue
+++ b/app/assets/javascripts/notes/components/note_actions.vue
@@ -148,12 +148,9 @@ export default {
href="#"
title="Add reaction"
>
- <icon
- css-classes="link-highlight award-control-icon-neutral"
- name="emoji_slightly_smiling_face"
- />
- <icon css-classes="link-highlight award-control-icon-positive" name="emoji_smiley" />
- <icon css-classes="link-highlight award-control-icon-super-positive" name="emoji_smiley" />
+ <icon css-classes="link-highlight award-control-icon-neutral" name="slight-smile" />
+ <icon css-classes="link-highlight award-control-icon-positive" name="smiley" />
+ <icon css-classes="link-highlight award-control-icon-super-positive" name="smiley" />
</a>
</div>
<reply-button
diff --git a/app/assets/javascripts/notes/components/note_awards_list.vue b/app/assets/javascripts/notes/components/note_awards_list.vue
index 17e5fcab5b7..941b6d5cab3 100644
--- a/app/assets/javascripts/notes/components/note_awards_list.vue
+++ b/app/assets/javascripts/notes/components/note_awards_list.vue
@@ -189,13 +189,13 @@ export default {
type="button"
>
<span class="award-control-icon award-control-icon-neutral">
- <icon name="emoji_slightly_smiling_face" />
+ <icon name="slight-smile" />
</span>
<span class="award-control-icon award-control-icon-positive">
- <icon name="emoji_smiley" />
+ <icon name="smiley" />
</span>
<span class="award-control-icon award-control-icon-super-positive">
- <icon name="emoji_smiley" />
+ <icon name="smiley" />
</span>
<i
aria-hidden="true"
diff --git a/app/assets/javascripts/pages/milestones/shared/components/promote_milestone_modal.vue b/app/assets/javascripts/pages/milestones/shared/components/promote_milestone_modal.vue
index a79ef07f1c5..c563514d36b 100644
--- a/app/assets/javascripts/pages/milestones/shared/components/promote_milestone_modal.vue
+++ b/app/assets/javascripts/pages/milestones/shared/components/promote_milestone_modal.vue
@@ -33,8 +33,7 @@ export default {
text() {
return sprintf(
s__(`Milestones|Promoting %{milestoneTitle} will make it available for all projects inside %{groupName}.
- Existing project milestones with the same title will be merged.
- This action cannot be reversed.`),
+ Existing project milestones with the same title will be merged.`),
{ milestoneTitle: this.milestoneTitle, groupName: this.groupName },
);
},
@@ -72,6 +71,9 @@ export default {
<template slot="title">
{{ title }}
</template>
- {{ text }}
+ <div>
+ <p>{{ text }}</p>
+ <p>{{ s__('Milestones|This action cannot be reversed.') }}</p>
+ </div>
</gl-modal>
</template>
diff --git a/app/assets/javascripts/pages/projects/show/index.js b/app/assets/javascripts/pages/projects/show/index.js
index 869f70e7d33..6aa41d0825b 100644
--- a/app/assets/javascripts/pages/projects/show/index.js
+++ b/app/assets/javascripts/pages/projects/show/index.js
@@ -46,4 +46,12 @@ document.addEventListener('DOMContentLoaded', () => {
GpgBadges.fetch();
leaveByUrl('project');
+
+ if (document.getElementById('js-tree-list')) {
+ import('~/repository')
+ .then(m => m.default())
+ .catch(e => {
+ throw e;
+ });
+ }
});
diff --git a/app/assets/javascripts/pages/projects/tree/show/index.js b/app/assets/javascripts/pages/projects/tree/show/index.js
index 400aed35e32..7b90a3a4f6e 100644
--- a/app/assets/javascripts/pages/projects/tree/show/index.js
+++ b/app/assets/javascripts/pages/projects/tree/show/index.js
@@ -40,4 +40,12 @@ document.addEventListener('DOMContentLoaded', () => {
}
GpgBadges.fetch();
+
+ if (document.getElementById('js-tree-list')) {
+ import('~/repository')
+ .then(m => m.default())
+ .catch(e => {
+ throw e;
+ });
+ }
});
diff --git a/app/assets/javascripts/pdf/index.vue b/app/assets/javascripts/pdf/index.vue
index dc5f9ba9607..6d39abd4a1f 100644
--- a/app/assets/javascripts/pdf/index.vue
+++ b/app/assets/javascripts/pdf/index.vue
@@ -1,6 +1,6 @@
<script>
-import pdfjsLib from 'vendor/pdf';
-import workerSrc from 'vendor/pdf.worker.min';
+import pdfjsLib from 'pdfjs-dist/build/pdf';
+import workerSrc from 'pdfjs-dist/build/pdf.worker.min';
import page from './page/index.vue';
diff --git a/app/assets/javascripts/project_label_subscription.js b/app/assets/javascripts/project_label_subscription.js
index d3c604dcee1..5395e14cc79 100644
--- a/app/assets/javascripts/project_label_subscription.js
+++ b/app/assets/javascripts/project_label_subscription.js
@@ -38,9 +38,9 @@ export default class ProjectLabelSubscription {
let newAction;
if (oldStatus === 'unsubscribed') {
- [newStatus, newAction] = ['subscribed', 'Unsubscribe'];
+ [newStatus, newAction] = ['subscribed', __('Unsubscribe')];
} else {
- [newStatus, newAction] = ['unsubscribed', 'Subscribe'];
+ [newStatus, newAction] = ['unsubscribed', __('Subscribe')];
}
$btn.removeClass('disabled');
diff --git a/app/assets/javascripts/project_select.js b/app/assets/javascripts/project_select.js
index 5ee510eb11d..dbe354a547b 100644
--- a/app/assets/javascripts/project_select.js
+++ b/app/assets/javascripts/project_select.js
@@ -3,6 +3,7 @@
import $ from 'jquery';
import Api from './api';
import ProjectSelectComboButton from './project_select_combo_button';
+import { s__ } from './locale';
export default function projectSelect() {
import(/* webpackChunkName: 'select2' */ 'select2/select2')
@@ -21,9 +22,9 @@ export default function projectSelect() {
this.includeProjectsInSubgroups = $(select).data('includeProjectsInSubgroups') || false;
this.allowClear = $(select).data('allowClear') || false;
- placeholder = 'Search for project';
+ placeholder = s__('ProjectSelect|Search for project');
if (this.includeGroups) {
- placeholder += ' or group';
+ placeholder += s__('ProjectSelect| or group');
}
$(select).select2({
diff --git a/app/assets/javascripts/reports/components/issues_list.vue b/app/assets/javascripts/reports/components/issues_list.vue
index f4243522ef8..50f2910e02d 100644
--- a/app/assets/javascripts/reports/components/issues_list.vue
+++ b/app/assets/javascripts/reports/components/issues_list.vue
@@ -52,6 +52,11 @@ export default {
required: false,
default: '',
},
+ showReportSectionStatus: {
+ type: Boolean,
+ required: false,
+ default: true,
+ },
},
computed: {
issuesWithState() {
@@ -81,6 +86,7 @@ export default {
:status="wrapped.status"
:component="component"
:is-new="wrapped.isNew"
+ :show-report-section-status="showReportSectionStatus"
/>
</smart-virtual-list>
</template>
diff --git a/app/assets/javascripts/reports/components/report_item.vue b/app/assets/javascripts/reports/components/report_item.vue
index d2106f9ad2e..01a30809e1a 100644
--- a/app/assets/javascripts/reports/components/report_item.vue
+++ b/app/assets/javascripts/reports/components/report_item.vue
@@ -34,12 +34,22 @@ export default {
required: false,
default: false,
},
+ showReportSectionStatusIcon: {
+ type: Boolean,
+ required: false,
+ default: true,
+ },
},
};
</script>
<template>
<li :class="{ 'is-dismissed': issue.isDismissed }" class="report-block-list-issue">
- <issue-status-icon :status="status" :status-icon-size="statusIconSize" class="append-right-5" />
+ <issue-status-icon
+ v-if="showReportSectionStatusIcon"
+ :status="status"
+ :status-icon-size="statusIconSize"
+ class="append-right-5"
+ />
<component :is="component" v-if="component" :issue="issue" :status="status" :is-new="isNew" />
</li>
diff --git a/app/assets/javascripts/reports/components/report_section.vue b/app/assets/javascripts/reports/components/report_section.vue
index d6483e95278..241185e3126 100644
--- a/app/assets/javascripts/reports/components/report_section.vue
+++ b/app/assets/javascripts/reports/components/report_section.vue
@@ -73,6 +73,11 @@ export default {
default: () => ({}),
required: false,
},
+ showReportSectionStatusIcon: {
+ type: Boolean,
+ required: false,
+ default: true,
+ },
},
data() {
@@ -151,7 +156,7 @@ export default {
<button
v-if="isCollapsible"
type="button"
- class="js-collapse-btn btn float-right btn-sm"
+ class="js-collapse-btn btn float-right btn-sm qa-expand-report-button"
@click="toggleCollapsed"
>
{{ collapseText }}
@@ -166,6 +171,7 @@ export default {
:resolved-issues="resolvedIssues"
:neutral-issues="neutralIssues"
:component="component"
+ :show-report-section-status-icon="showReportSectionStatusIcon"
/>
</slot>
</div>
diff --git a/app/assets/javascripts/reports/store/state.js b/app/assets/javascripts/reports/store/state.js
index 5484900276c..25f9f70d095 100644
--- a/app/assets/javascripts/reports/store/state.js
+++ b/app/assets/javascripts/reports/store/state.js
@@ -40,6 +40,11 @@ export default () => ({
text: s__('Reports|Class'),
type: fieldTypes.link,
},
+ classname: {
+ value: null,
+ text: s__('Reports|Classname'),
+ type: fieldTypes.text,
+ },
execution_time: {
value: null,
text: s__('Reports|Execution time'),
diff --git a/app/assets/javascripts/repository/components/app.vue b/app/assets/javascripts/repository/components/app.vue
new file mode 100644
index 00000000000..98240aef810
--- /dev/null
+++ b/app/assets/javascripts/repository/components/app.vue
@@ -0,0 +1,3 @@
+<template>
+ <router-view />
+</template>
diff --git a/app/assets/javascripts/repository/components/table/header.vue b/app/assets/javascripts/repository/components/table/header.vue
new file mode 100644
index 00000000000..9d30aa88155
--- /dev/null
+++ b/app/assets/javascripts/repository/components/table/header.vue
@@ -0,0 +1,9 @@
+<template>
+ <thead>
+ <tr>
+ <th id="name" scope="col">{{ s__('ProjectFileTree|Name') }}</th>
+ <th id="last-commit" scope="col" class="d-none d-sm-table-cell">{{ __('Last commit') }}</th>
+ <th id="last-update" scope="col" class="text-right">{{ __('Last update') }}</th>
+ </tr>
+ </thead>
+</template>
diff --git a/app/assets/javascripts/repository/components/table/index.vue b/app/assets/javascripts/repository/components/table/index.vue
new file mode 100644
index 00000000000..ad3d8f9329d
--- /dev/null
+++ b/app/assets/javascripts/repository/components/table/index.vue
@@ -0,0 +1,75 @@
+<script>
+import { GlLoadingIcon } from '@gitlab/ui';
+import { sprintf, __ } from '../../../locale';
+import getRefMixin from '../../mixins/get_ref';
+import getFiles from '../../queries/getFiles.graphql';
+import TableHeader from './header.vue';
+import TableRow from './row.vue';
+
+export default {
+ components: {
+ GlLoadingIcon,
+ TableHeader,
+ TableRow,
+ },
+ mixins: [getRefMixin],
+ apollo: {
+ files: {
+ query: getFiles,
+ variables() {
+ return {
+ ref: this.ref,
+ path: this.path,
+ };
+ },
+ },
+ },
+ props: {
+ path: {
+ type: String,
+ required: true,
+ },
+ },
+ data() {
+ return {
+ files: [],
+ };
+ },
+ computed: {
+ tableCaption() {
+ return sprintf(
+ __('Files, directories, and submodules in the path %{path} for commit reference %{ref}'),
+ { path: this.path, ref: this.ref },
+ );
+ },
+ isLoadingFiles() {
+ return this.$apollo.queries.files.loading;
+ },
+ },
+};
+</script>
+
+<template>
+ <div class="tree-content-holder">
+ <div class="table-holder bordered-box">
+ <table class="table tree-table qa-file-tree" aria-live="polite">
+ <caption class="sr-only">
+ {{
+ tableCaption
+ }}
+ </caption>
+ <table-header />
+ <tbody>
+ <table-row
+ v-for="entry in files"
+ :id="entry.id"
+ :key="entry.id"
+ :path="entry.flatPath"
+ :type="entry.type"
+ />
+ </tbody>
+ </table>
+ <gl-loading-icon v-if="isLoadingFiles" class="my-3" size="md" />
+ </div>
+ </div>
+</template>
diff --git a/app/assets/javascripts/repository/components/table/row.vue b/app/assets/javascripts/repository/components/table/row.vue
new file mode 100644
index 00000000000..0ad0fdbd605
--- /dev/null
+++ b/app/assets/javascripts/repository/components/table/row.vue
@@ -0,0 +1,60 @@
+<script>
+import { getIconName } from '../../utils/icon';
+import getRefMixin from '../../mixins/get_ref';
+
+export default {
+ mixins: [getRefMixin],
+ props: {
+ id: {
+ type: Number,
+ required: true,
+ },
+ path: {
+ type: String,
+ required: true,
+ },
+ type: {
+ type: String,
+ required: true,
+ },
+ },
+ computed: {
+ routerLinkTo() {
+ return this.isFolder ? { path: `/tree/${this.ref}/${this.path}` } : null;
+ },
+ iconName() {
+ return `fa-${getIconName(this.type, this.path)}`;
+ },
+ isFolder() {
+ return this.type === 'folder';
+ },
+ isSubmodule() {
+ return this.type === 'commit';
+ },
+ linkComponent() {
+ return this.isFolder ? 'router-link' : 'a';
+ },
+ },
+ methods: {
+ openRow() {
+ if (this.isFolder) {
+ this.$router.push(this.routerLinkTo);
+ }
+ },
+ },
+};
+</script>
+
+<template>
+ <tr v-once :class="`file_${id}`" class="tree-item" @click="openRow">
+ <td class="tree-item-file-name">
+ <i :aria-label="type" role="img" :class="iconName" class="fa fa-fw"></i>
+ <component :is="linkComponent" :to="routerLinkTo" class="str-truncated">{{ path }}</component>
+ <template v-if="isSubmodule">
+ @ <a href="#" class="commit-sha">{{ id }}</a>
+ </template>
+ </td>
+ <td class="d-none d-sm-table-cell tree-commit"></td>
+ <td class="tree-time-ago text-right"></td>
+ </tr>
+</template>
diff --git a/app/assets/javascripts/repository/graphql.js b/app/assets/javascripts/repository/graphql.js
new file mode 100644
index 00000000000..c85db5c01e5
--- /dev/null
+++ b/app/assets/javascripts/repository/graphql.js
@@ -0,0 +1,46 @@
+import Vue from 'vue';
+import VueApollo from 'vue-apollo';
+import createDefaultClient from '~/lib/graphql';
+
+Vue.use(VueApollo);
+
+const defaultClient = createDefaultClient({
+ Query: {
+ files() {
+ return [
+ {
+ __typename: 'file',
+ id: 1,
+ name: 'app',
+ flatPath: 'app',
+ type: 'folder',
+ },
+ {
+ __typename: 'file',
+ id: 2,
+ name: 'gitlab-svg',
+ flatPath: 'gitlab-svg',
+ type: 'commit',
+ },
+ {
+ __typename: 'file',
+ id: 3,
+ name: 'index.js',
+ flatPath: 'index.js',
+ type: 'blob',
+ },
+ {
+ __typename: 'file',
+ id: 4,
+ name: 'test.pdf',
+ flatPath: 'fixtures/test.pdf',
+ type: 'blob',
+ },
+ ];
+ },
+ },
+});
+
+export default new VueApollo({
+ defaultClient,
+});
diff --git a/app/assets/javascripts/repository/index.js b/app/assets/javascripts/repository/index.js
new file mode 100644
index 00000000000..00b69362312
--- /dev/null
+++ b/app/assets/javascripts/repository/index.js
@@ -0,0 +1,25 @@
+import Vue from 'vue';
+import createRouter from './router';
+import App from './components/app.vue';
+import apolloProvider from './graphql';
+
+export default function setupVueRepositoryList() {
+ const el = document.getElementById('js-tree-list');
+ const { projectPath, ref } = el.dataset;
+
+ apolloProvider.clients.defaultClient.cache.writeData({
+ data: {
+ projectPath,
+ ref,
+ },
+ });
+
+ return new Vue({
+ el,
+ router: createRouter(projectPath, ref),
+ apolloProvider,
+ render(h) {
+ return h(App);
+ },
+ });
+}
diff --git a/app/assets/javascripts/repository/mixins/get_ref.js b/app/assets/javascripts/repository/mixins/get_ref.js
new file mode 100644
index 00000000000..b06087d6f42
--- /dev/null
+++ b/app/assets/javascripts/repository/mixins/get_ref.js
@@ -0,0 +1,14 @@
+import getRef from '../queries/getRef.graphql';
+
+export default {
+ apollo: {
+ ref: {
+ query: getRef,
+ },
+ },
+ data() {
+ return {
+ ref: '',
+ };
+ },
+};
diff --git a/app/assets/javascripts/repository/pages/index.vue b/app/assets/javascripts/repository/pages/index.vue
new file mode 100644
index 00000000000..2d92e9174ca
--- /dev/null
+++ b/app/assets/javascripts/repository/pages/index.vue
@@ -0,0 +1,18 @@
+<script>
+import FileTable from '../components/table/index.vue';
+
+export default {
+ components: {
+ FileTable,
+ },
+ data() {
+ return {
+ ref: '',
+ };
+ },
+};
+</script>
+
+<template>
+ <file-table path="/" />
+</template>
diff --git a/app/assets/javascripts/repository/pages/tree.vue b/app/assets/javascripts/repository/pages/tree.vue
new file mode 100644
index 00000000000..3b898d1aa91
--- /dev/null
+++ b/app/assets/javascripts/repository/pages/tree.vue
@@ -0,0 +1,20 @@
+<script>
+import FileTable from '../components/table/index.vue';
+
+export default {
+ components: {
+ FileTable,
+ },
+ props: {
+ path: {
+ type: String,
+ required: false,
+ default: '/',
+ },
+ },
+};
+</script>
+
+<template>
+ <file-table :path="path" />
+</template>
diff --git a/app/assets/javascripts/repository/queries/getFiles.graphql b/app/assets/javascripts/repository/queries/getFiles.graphql
new file mode 100644
index 00000000000..fb446780ed1
--- /dev/null
+++ b/app/assets/javascripts/repository/queries/getFiles.graphql
@@ -0,0 +1,7 @@
+query getFiles($path: String!, $ref: String!) {
+ files(path: $path, ref: $ref) @client {
+ id
+ flatPath
+ type
+ }
+}
diff --git a/app/assets/javascripts/repository/queries/getRef.graphql b/app/assets/javascripts/repository/queries/getRef.graphql
new file mode 100644
index 00000000000..58c09844c3f
--- /dev/null
+++ b/app/assets/javascripts/repository/queries/getRef.graphql
@@ -0,0 +1,3 @@
+query getRef {
+ ref @client
+}
diff --git a/app/assets/javascripts/repository/router.js b/app/assets/javascripts/repository/router.js
new file mode 100644
index 00000000000..b42a96a4ee2
--- /dev/null
+++ b/app/assets/javascripts/repository/router.js
@@ -0,0 +1,36 @@
+import Vue from 'vue';
+import VueRouter from 'vue-router';
+import { joinPaths } from '../lib/utils/url_utility';
+import IndexPage from './pages/index.vue';
+import TreePage from './pages/tree.vue';
+
+Vue.use(VueRouter);
+
+export default function createRouter(base, baseRef) {
+ return new VueRouter({
+ mode: 'history',
+ base: joinPaths(gon.relative_url_root || '', base),
+ routes: [
+ {
+ path: '/',
+ name: 'projectRoot',
+ component: IndexPage,
+ },
+ {
+ path: `/tree/${baseRef}(/.*)?`,
+ name: 'treePath',
+ component: TreePage,
+ props: route => ({
+ path: route.params.pathMatch,
+ }),
+ beforeEnter(to, from, next) {
+ document
+ .querySelectorAll('.js-hide-on-navigation')
+ .forEach(el => el.classList.add('hidden'));
+
+ next();
+ },
+ },
+ ],
+ });
+}
diff --git a/app/assets/javascripts/repository/utils/icon.js b/app/assets/javascripts/repository/utils/icon.js
new file mode 100644
index 00000000000..3e93ff0ec39
--- /dev/null
+++ b/app/assets/javascripts/repository/utils/icon.js
@@ -0,0 +1,99 @@
+const entryTypeIcons = {
+ folder: 'folder',
+ commit: 'archive',
+};
+
+const fileTypeIcons = [
+ { extensions: ['pdf'], name: 'file-pdf-o' },
+ {
+ extensions: [
+ 'jpg',
+ 'jpeg',
+ 'jif',
+ 'jfif',
+ 'jp2',
+ 'jpx',
+ 'j2k',
+ 'j2c',
+ 'png',
+ 'gif',
+ 'tif',
+ 'tiff',
+ 'svg',
+ 'ico',
+ 'bmp',
+ ],
+ name: 'file-image-o',
+ },
+ {
+ extensions: ['zip', 'zipx', 'tar', 'gz', 'bz', 'bzip', 'xz', 'rar', '7z'],
+ name: 'file-archive-o',
+ },
+ { extensions: ['mp3', 'wma', 'ogg', 'oga', 'wav', 'flac', 'aac'], name: 'file-audio-o' },
+ {
+ extensions: [
+ 'mp4',
+ 'm4p',
+ 'm4v',
+ 'mpg',
+ 'mp2',
+ 'mpeg',
+ 'mpe',
+ 'mpv',
+ 'm2v',
+ 'avi',
+ 'mkv',
+ 'flv',
+ 'ogv',
+ 'mov',
+ '3gp',
+ '3g2',
+ ],
+ name: 'file-video-o',
+ },
+ { extensions: ['doc', 'dot', 'docx', 'docm', 'dotx', 'dotm', 'docb'], name: 'file-word-o' },
+ {
+ extensions: [
+ 'xls',
+ 'xlt',
+ 'xlm',
+ 'xlsx',
+ 'xlsm',
+ 'xltx',
+ 'xltm',
+ 'xlsb',
+ 'xla',
+ 'xlam',
+ 'xll',
+ 'xlw',
+ ],
+ name: 'file-excel-o',
+ },
+ {
+ extensions: [
+ 'ppt',
+ 'pot',
+ 'pps',
+ 'pptx',
+ 'pptm',
+ 'potx',
+ 'potm',
+ 'ppam',
+ 'ppsx',
+ 'ppsm',
+ 'sldx',
+ 'sldm',
+ ],
+ name: 'file-powerpoint-o',
+ },
+];
+
+// eslint-disable-next-line import/prefer-default-export
+export const getIconName = (type, path) => {
+ if (entryTypeIcons[type]) return entryTypeIcons[type];
+
+ const extension = path.split('.').pop();
+ const file = fileTypeIcons.find(t => t.extensions.some(ext => ext === extension));
+
+ return file ? file.name : 'file-text-o';
+};
diff --git a/app/assets/javascripts/right_sidebar.js b/app/assets/javascripts/right_sidebar.js
index 9a0cdc02952..72e061df573 100644
--- a/app/assets/javascripts/right_sidebar.js
+++ b/app/assets/javascripts/right_sidebar.js
@@ -5,7 +5,7 @@ import _ from 'underscore';
import Cookies from 'js-cookie';
import flash from './flash';
import axios from './lib/utils/axios_utils';
-import { __ } from './locale';
+import { sprintf, s__, __ } from './locale';
function Sidebar(currentUser) {
this.toggleTodo = this.toggleTodo.bind(this);
@@ -101,7 +101,10 @@ Sidebar.prototype.toggleTodo = function(e) {
this.todoUpdateDone(data);
})
.catch(() =>
- flash(`There was an error ${ajaxType === 'post' ? 'adding a' : 'deleting the'} todo.`),
+ flash(sprintf(__('There was an error %{message} todo.')), {
+ message:
+ ajaxType === 'post' ? s__('RightSidebar|adding a') : s__('RightSidebar|deleting the'),
+ }),
);
};
diff --git a/app/assets/javascripts/search_autocomplete.js b/app/assets/javascripts/search_autocomplete.js
index 0a4583b5861..ab43c2139bf 100644
--- a/app/assets/javascripts/search_autocomplete.js
+++ b/app/assets/javascripts/search_autocomplete.js
@@ -2,7 +2,7 @@
import $ from 'jquery';
import { escape, throttle } from 'underscore';
-import { s__, sprintf } from '~/locale';
+import { s__, __, sprintf } from '~/locale';
import { getIdenticonBackgroundClass, getIdenticonTitle } from '~/helpers/avatar_helper';
import axios from './lib/utils/axios_utils';
import DropdownUtils from './filtered_search/dropdown_utils';
@@ -407,6 +407,7 @@ export class SearchAutocomplete {
if (this.searchInput.val() === '') {
return this.restoreOriginalState();
}
+ this.dropdownMenu.removeClass('show');
}
restoreOriginalState() {
@@ -439,7 +440,7 @@ export class SearchAutocomplete {
restoreMenu() {
var html;
- html = '<ul><li class="dropdown-menu-empty-item"><a>Loading...</a></li></ul>';
+ html = `<ul><li class="dropdown-menu-empty-item"><a>${__('Loading...')}</a></li></ul>`;
return this.dropdownContent.html(html);
}
diff --git a/app/assets/javascripts/set_status_modal/set_status_modal_wrapper.vue b/app/assets/javascripts/set_status_modal/set_status_modal_wrapper.vue
index 10e2c8453e2..35eba266625 100644
--- a/app/assets/javascripts/set_status_modal/set_status_modal_wrapper.vue
+++ b/app/assets/javascripts/set_status_modal/set_status_modal_wrapper.vue
@@ -194,9 +194,9 @@ export default {
v-show="noEmoji"
class="js-no-emoji-placeholder no-emoji-placeholder position-relative"
>
- <icon name="emoji_slightly_smiling_face" css-classes="award-control-icon-neutral" />
- <icon name="emoji_smiley" css-classes="award-control-icon-positive" />
- <icon name="emoji_smile" css-classes="award-control-icon-super-positive" />
+ <icon name="slight-smile" css-classes="award-control-icon-neutral" />
+ <icon name="smiley" css-classes="award-control-icon-positive" />
+ <icon name="smile" css-classes="award-control-icon-super-positive" />
</span>
</button>
</span>
diff --git a/app/assets/javascripts/star.js b/app/assets/javascripts/star.js
index 7404dfbf22a..70f89152f70 100644
--- a/app/assets/javascripts/star.js
+++ b/app/assets/javascripts/star.js
@@ -31,7 +31,7 @@ export default class Star {
$this.prepend(spriteIcon('star', iconClasses));
}
})
- .catch(() => Flash('Star toggle failed. Try again later.'));
+ .catch(() => Flash(__('Star toggle failed. Try again later.')));
});
}
}
diff --git a/app/assets/javascripts/subscription_select.js b/app/assets/javascripts/subscription_select.js
index ebe1c6dd02d..7206bbd7109 100644
--- a/app/assets/javascripts/subscription_select.js
+++ b/app/assets/javascripts/subscription_select.js
@@ -1,4 +1,5 @@
import $ from 'jquery';
+import { __ } from './locale';
export default function subscriptionSelect() {
$('.js-subscription-event').each((i, element) => {
@@ -8,7 +9,7 @@ export default function subscriptionSelect() {
selectable: true,
fieldName,
toggleLabel(selected, el, instance) {
- let label = 'Subscription';
+ let label = __('Subscription');
const $item = instance.dropdown.find('.is-active');
if ($item.length) {
label = $item.text();
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/deployment.vue b/app/assets/javascripts/vue_merge_request_widget/components/deployment.vue
index da0a9483f8e..8f4cae8ae58 100644
--- a/app/assets/javascripts/vue_merge_request_widget/components/deployment.vue
+++ b/app/assets/javascripts/vue_merge_request_widget/components/deployment.vue
@@ -23,6 +23,8 @@ export default {
TooltipOnTruncate,
FilteredSearchDropdown,
ReviewAppLink,
+ VisualReviewAppLink: () =>
+ import('ee_component/vue_merge_request_widget/components/visual_review_app_link.vue'),
},
directives: {
GlTooltip: GlTooltipDirective,
@@ -37,6 +39,20 @@ export default {
type: Boolean,
required: true,
},
+ showVisualReviewApp: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
+ visualReviewAppMeta: {
+ type: Object,
+ required: false,
+ default: () => ({
+ sourceProjectId: '',
+ issueId: '',
+ appUrl: '',
+ }),
+ },
},
deployedTextMap: {
running: __('Deploying to'),
@@ -168,6 +184,11 @@ export default {
:link="deploymentExternalUrl"
:css-class="`deploy-link js-deploy-url inline ${slotProps.className}`"
/>
+ <visual-review-app-link
+ v-if="showVisualReviewApp"
+ :link="deploymentExternalUrl"
+ :app-metadata="visualReviewAppMeta"
+ />
</template>
<template slot="result" slot-scope="slotProps">
@@ -187,11 +208,17 @@ export default {
</a>
</template>
</filtered-search-dropdown>
- <review-app-link
- v-else
- :link="deploymentExternalUrl"
- css-class="js-deploy-url js-deploy-url-feature-flag deploy-link btn btn-default btn-sm inlin"
- />
+ <template v-else>
+ <review-app-link
+ :link="deploymentExternalUrl"
+ css-class="js-deploy-url js-deploy-url-feature-flag deploy-link btn btn-default btn-sm inline"
+ />
+ <visual-review-app-link
+ v-if="showVisualReviewApp"
+ :link="deploymentExternalUrl"
+ :app-metadata="visualReviewAppMeta"
+ />
+ </template>
</template>
<span
v-if="deployment.stop_url"
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline_container.vue b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline_container.vue
index 5f5fe67b3c1..b9f5f602117 100644
--- a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline_container.vue
+++ b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline_container.vue
@@ -30,9 +30,6 @@ export default {
},
},
computed: {
- pipeline() {
- return this.isPostMerge ? this.mr.mergePipeline : this.mr.pipeline;
- },
branch() {
return this.isPostMerge ? this.mr.targetBranch : this.mr.sourceBranch;
},
@@ -48,6 +45,19 @@ export default {
hasDeploymentMetrics() {
return this.isPostMerge;
},
+ visualReviewAppMeta() {
+ return {
+ appUrl: this.mr.appUrl,
+ issueId: this.mr.iid,
+ sourceProjectId: this.mr.sourceProjectId,
+ };
+ },
+ pipeline() {
+ return this.isPostMerge ? this.mr.mergePipeline : this.mr.pipeline;
+ },
+ showVisualReviewAppLink() {
+ return !!(this.mr.visualReviewFF && this.mr.visualReviewAppAvailable);
+ },
},
};
</script>
@@ -61,14 +71,18 @@ export default {
:source-branch-link="branchLink"
:troubleshooting-docs-path="mr.troubleshootingDocsPath"
/>
- <div v-if="deployments.length" slot="footer" class="mr-widget-extension">
- <deployment
- v-for="deployment in deployments"
- :key="deployment.id"
- :class="deploymentClass"
- :deployment="deployment"
- :show-metrics="hasDeploymentMetrics"
- />
- </div>
+ <template v-slot:footer>
+ <div v-if="deployments.length" class="mr-widget-extension">
+ <deployment
+ v-for="deployment in deployments"
+ :key="deployment.id"
+ :class="deploymentClass"
+ :deployment="deployment"
+ :show-metrics="hasDeploymentMetrics"
+ :show-visual-review-app="true"
+ :visual-review-app-meta="visualReviewAppMeta"
+ />
+ </div>
+ </template>
</mr-widget-container>
</template>
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/review_app_link.vue b/app/assets/javascripts/vue_merge_request_widget/components/review_app_link.vue
index de9c122f268..457a71cab95 100644
--- a/app/assets/javascripts/vue_merge_request_widget/components/review_app_link.vue
+++ b/app/assets/javascripts/vue_merge_request_widget/components/review_app_link.vue
@@ -19,6 +19,6 @@ export default {
</script>
<template>
<a :href="link" target="_blank" rel="noopener noreferrer nofollow" :class="cssClass">
- {{ __('View app') }} <icon name="external-link" />
+ {{ __('View app') }} <icon css-classes="fgray" name="external-link" />
</a>
</template>
diff --git a/app/assets/javascripts/vue_shared/components/clipboard_button.vue b/app/assets/javascripts/vue_shared/components/clipboard_button.vue
index 671b4909839..a620f560b52 100644
--- a/app/assets/javascripts/vue_shared/components/clipboard_button.vue
+++ b/app/assets/javascripts/vue_shared/components/clipboard_button.vue
@@ -7,7 +7,7 @@
*
* @example
* <clipboard-button
- * title="Copy to clipbard"
+ * title="Copy to clipboard"
* text="Content to be copied"
* css-class="btn-transparent"
* />
diff --git a/app/assets/stylesheets/components/toast.scss b/app/assets/stylesheets/components/toast.scss
index 91d16c8e98d..33e1c4e5349 100644
--- a/app/assets/stylesheets/components/toast.scss
+++ b/app/assets/stylesheets/components/toast.scss
@@ -1,3 +1,53 @@
-.toast-close {
- font-size: $default-icon-size !important;
+/*
+* These styles are specific to the gl-toast component.
+* Documentation: https://design.gitlab.com/components/toasts
+* Note: Styles below are nested in order to override some of vue-toasted's default styling
+*/
+.toasted-container {
+
+ max-width: $toast-max-width;
+
+ @include media-breakpoint-down(xs) {
+ width: 100%;
+ padding-right: $toast-padding-right;
+ }
+
+ .toasted.gl-toast {
+ border-radius: $border-radius-default;
+ font-size: $gl-font-size;
+ padding: $gl-padding-8 $gl-padding-24;
+ margin-top: $toast-default-margin;
+ line-height: $gl-line-height;
+ background-color: rgba($gray-900, $toast-background-opacity);
+
+ @include media-breakpoint-down(xs) {
+ .action:first-child {
+ // Ensures actions buttons are right aligned on mobile
+ margin-left: auto;
+ }
+ }
+
+ .action {
+ color: $blue-300;
+ margin: 0 0 0 $toast-action-margin-left;
+ text-transform: none;
+ font-size: $gl-font-size;
+
+ &:first-child {
+ padding-right: 0;
+ }
+ }
+
+ .toast-close {
+ font-size: $default-icon-size;
+ margin-left: $toast-default-margin;
+ padding-left: $gl-padding;
+ }
+ }
+}
+
+// Overrides the default positioning of toasts
+body .toasted-container.bottom-left {
+ bottom: $toast-offset;
+ left: $toast-offset;
}
diff --git a/app/assets/stylesheets/framework/awards.scss b/app/assets/stylesheets/framework/awards.scss
index 648e1944388..a8df7e1bfad 100644
--- a/app/assets/stylesheets/framework/awards.scss
+++ b/app/assets/stylesheets/framework/awards.scss
@@ -151,8 +151,7 @@
outline: 0;
.award-control-icon svg {
- background: $award-emoji-positive-add-bg;
- fill: $award-emoji-positive-add-lines;
+ fill: $blue-500;
}
.award-control-icon-neutral {
@@ -236,7 +235,7 @@
}
path {
- fill: $border-gray-normal;
+ fill: $gray-700;
}
}
diff --git a/app/assets/stylesheets/framework/blocks.scss b/app/assets/stylesheets/framework/blocks.scss
index e6c55252b24..3aabb66f7a6 100644
--- a/app/assets/stylesheets/framework/blocks.scss
+++ b/app/assets/stylesheets/framework/blocks.scss
@@ -22,6 +22,10 @@
}
}
+.oneline {
+ line-height: 35px;
+}
+
.row-content-block {
margin-top: 0;
background-color: $gray-light;
@@ -77,10 +81,6 @@
color: $gl-text-color;
}
- .oneline {
- line-height: 35px;
- }
-
> p:last-child {
margin-bottom: 0;
}
@@ -108,10 +108,6 @@
padding: 11px 0;
margin-bottom: 11px;
- .oneline {
- line-height: 35px;
- }
-
&.no-bottom-space {
border-bottom: 0;
margin-bottom: 0;
@@ -160,8 +156,6 @@
}
.cover-desc {
- color: $gl-text-color;
-
&.username:last-child {
padding-bottom: $gl-padding;
}
diff --git a/app/assets/stylesheets/framework/common.scss b/app/assets/stylesheets/framework/common.scss
index 2b499e50ea3..fc488b85138 100644
--- a/app/assets/stylesheets/framework/common.scss
+++ b/app/assets/stylesheets/framework/common.scss
@@ -5,6 +5,9 @@
.cgreen { color: $green-600; }
.cdark { color: $common-gray-dark; }
+.fwhite { fill: $white-light; }
+.fgray { fill: $gray-700; }
+
.text-plain,
.text-plain:hover {
color: $gl-text-color;
@@ -439,10 +442,6 @@ img.emoji {
.min-height-0 { min-height: 0; }
-.w-3 { width: #{3 * $grid-size}; }
-
-.h-3 { width: #{3 * $grid-size}; }
-
.svg-w-100 {
svg {
width: 100%;
diff --git a/app/assets/stylesheets/framework/filters.scss b/app/assets/stylesheets/framework/filters.scss
index 5bcfd5d1322..26cbb7f5c13 100644
--- a/app/assets/stylesheets/framework/filters.scss
+++ b/app/assets/stylesheets/framework/filters.scss
@@ -218,7 +218,7 @@
min-width: 200px;
padding-right: 25px;
padding-left: 0;
- height: $input-height;
+ height: $input-height - 2;
line-height: inherit;
border-color: transparent;
diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss
index a57cd6737f8..1bc597bd4ae 100644
--- a/app/assets/stylesheets/framework/header.scss
+++ b/app/assets/stylesheets/framework/header.scss
@@ -472,6 +472,22 @@
background-color: $blue-500;
}
}
+
+ .canary-badge {
+ .badge {
+ font-size: $gl-font-size-small;
+ line-height: $gl-line-height;
+ padding: 0 $grid-size;
+ }
+
+ &:hover {
+ text-decoration: none;
+
+ .badge {
+ text-decoration: none;
+ }
+ }
+ }
}
@include media-breakpoint-down(xs) {
diff --git a/app/assets/stylesheets/framework/mixins.scss b/app/assets/stylesheets/framework/mixins.scss
index 18eb10c1f23..97de0c98325 100644
--- a/app/assets/stylesheets/framework/mixins.scss
+++ b/app/assets/stylesheets/framework/mixins.scss
@@ -325,8 +325,8 @@
line-height: 1;
padding: 0;
min-width: 16px;
- color: $gray-darkest;
- fill: $gray-darkest;
+ color: $gray-600;
+ fill: $gray-600;
.fa {
position: relative;
diff --git a/app/assets/stylesheets/framework/modal.scss b/app/assets/stylesheets/framework/modal.scss
index e2bb1eb67c0..f75e5b55506 100644
--- a/app/assets/stylesheets/framework/modal.scss
+++ b/app/assets/stylesheets/framework/modal.scss
@@ -53,7 +53,8 @@
flex-direction: row;
.btn + .btn:not(.dropdown-toggle-split),
- .btn + .btn-group {
+ .btn + .btn-group,
+ .btn-group + .btn {
margin-left: $grid-size;
}
@@ -61,7 +62,8 @@
flex-direction: column;
.btn + .btn:not(.dropdown-toggle-split),
- .btn + .btn-group {
+ .btn + .btn-group,
+ .btn-group + .btn {
margin-left: 0;
margin-top: $grid-size;
}
diff --git a/app/assets/stylesheets/framework/timeline.scss b/app/assets/stylesheets/framework/timeline.scss
index 3d5208c3db5..e8176e59c19 100644
--- a/app/assets/stylesheets/framework/timeline.scss
+++ b/app/assets/stylesheets/framework/timeline.scss
@@ -55,4 +55,5 @@
.discussion .timeline-entry {
margin: 0;
border-right: 0;
+ border-radius: $border-radius-default $border-radius-default 0 0;
}
diff --git a/app/assets/stylesheets/framework/variables.scss b/app/assets/stylesheets/framework/variables.scss
index 4a034e1e547..1cf122102cc 100644
--- a/app/assets/stylesheets/framework/variables.scss
+++ b/app/assets/stylesheets/framework/variables.scss
@@ -432,7 +432,7 @@ $diff-jagged-border-gradient-color: darken($white-normal, 8%);
*/
$monospace-font: 'Menlo', 'DejaVu Sans Mono', 'Liberation Mono', 'Consolas', 'Ubuntu Mono',
'Courier New', 'andale mono', 'lucida console', monospace;
-$regular-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell,
+$regular-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', Ubuntu, Cantarell,
'Helvetica Neue', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji';
@@ -498,6 +498,17 @@ $pagination-line-height: 20px;
$pagination-disabled-color: #cdcdcd;
/*
+* Toasts
+*/
+$toast-offset: 24px;
+$toast-height: 48px;
+$toast-max-width: 586px;
+$toast-padding-right: 42px;
+$toast-default-margin: 8px;
+$toast-action-margin-left: 16px;
+$toast-background-opacity: 0.95;
+
+/*
* Status icons
*/
$status-icon-size: 22px;
diff --git a/app/assets/stylesheets/pages/detail_page.scss b/app/assets/stylesheets/pages/detail_page.scss
index cb5f1a84005..c386493231c 100644
--- a/app/assets/stylesheets/pages/detail_page.scss
+++ b/app/assets/stylesheets/pages/detail_page.scss
@@ -21,7 +21,6 @@
.detail-page-header-body {
position: relative;
- line-height: 35px;
display: flex;
flex: 1 1;
min-width: 0;
diff --git a/app/assets/stylesheets/pages/events.scss b/app/assets/stylesheets/pages/events.scss
index 618f23d81b1..e34628002ac 100644
--- a/app/assets/stylesheets/pages/events.scss
+++ b/app/assets/stylesheets/pages/events.scss
@@ -156,6 +156,10 @@
&:hover {
background: none;
}
+
+ a {
+ color: $blue-600;
+ }
}
}
}
diff --git a/app/assets/stylesheets/pages/members.scss b/app/assets/stylesheets/pages/members.scss
index 47ffdbae4b6..f8e273a2735 100644
--- a/app/assets/stylesheets/pages/members.scss
+++ b/app/assets/stylesheets/pages/members.scss
@@ -14,7 +14,7 @@
}
.member {
- &.is-overriden {
+ &.is-overridden {
.btn-ldap-override {
display: none !important;
}
diff --git a/app/assets/stylesheets/pages/merge_requests.scss b/app/assets/stylesheets/pages/merge_requests.scss
index 709940ba6c8..44b558dd5ff 100644
--- a/app/assets/stylesheets/pages/merge_requests.scss
+++ b/app/assets/stylesheets/pages/merge_requests.scss
@@ -972,10 +972,6 @@
}
}
- .btn svg {
- fill: $gray-700;
- }
-
.dropdown-menu {
width: 400px;
}
diff --git a/app/assets/stylesheets/pages/notes.scss b/app/assets/stylesheets/pages/notes.scss
index f2b67a693c3..50c87e55f56 100644
--- a/app/assets/stylesheets/pages/notes.scss
+++ b/app/assets/stylesheets/pages/notes.scss
@@ -107,6 +107,7 @@ $note-form-margin-left: 72px;
&.collapsed {
color: $gl-text-color-secondary;
+ border-radius: 0 0 $border-radius-default $border-radius-default;
svg {
float: left;
@@ -644,7 +645,7 @@ $note-form-margin-left: 72px;
display: inline-flex;
align-items: center;
margin-left: 10px;
- color: $gray-darkest;
+ color: $gray-600;
@include notes-media('max', map-get($grid-breakpoints, sm) - 1) {
float: none;
diff --git a/app/assets/stylesheets/pages/pipelines.scss b/app/assets/stylesheets/pages/pipelines.scss
index 12a3b8c88f3..aa6bbc8e473 100644
--- a/app/assets/stylesheets/pages/pipelines.scss
+++ b/app/assets/stylesheets/pages/pipelines.scss
@@ -903,7 +903,7 @@ button.mini-pipeline-graph-dropdown-toggle {
// Match dropdown.scss for all `a` tags
&.non-details-job-component {
- padding: 8px 16px;
+ padding: $gl-padding-8 $gl-btn-horz-padding;
}
.ci-job-name-component {
diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb
index d445be0eb19..d5bc723aa8c 100644
--- a/app/controllers/admin/application_settings_controller.rb
+++ b/app/controllers/admin/application_settings_controller.rb
@@ -89,6 +89,13 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
)
end
+ # Getting ToS url requires `directory` api call to Let's Encrypt
+ # which could result in 500 error/slow rendering on settings page
+ # Because of that we use separate controller action
+ def lets_encrypt_terms_of_service
+ redirect_to ::Gitlab::LetsEncrypt.terms_of_service_url
+ end
+
private
def set_application_setting
diff --git a/app/controllers/concerns/enforces_two_factor_authentication.rb b/app/controllers/concerns/enforces_two_factor_authentication.rb
index 71bdef8ce03..0fddf15d197 100644
--- a/app/controllers/concerns/enforces_two_factor_authentication.rb
+++ b/app/controllers/concerns/enforces_two_factor_authentication.rb
@@ -16,7 +16,7 @@ module EnforcesTwoFactorAuthentication
end
def check_two_factor_requirement
- if two_factor_authentication_required? && current_user && !current_user.two_factor_enabled? && !skip_two_factor?
+ if two_factor_authentication_required? && current_user && !current_user.temp_oauth_email? && !current_user.two_factor_enabled? && !skip_two_factor?
redirect_to profile_two_factor_auth_path
end
end
diff --git a/app/controllers/concerns/project_unauthorized.rb b/app/controllers/concerns/project_unauthorized.rb
index d42363b8b17..7238840440f 100644
--- a/app/controllers/concerns/project_unauthorized.rb
+++ b/app/controllers/concerns/project_unauthorized.rb
@@ -1,10 +1,12 @@
# frozen_string_literal: true
module ProjectUnauthorized
- def project_unauthorized_proc
- lambda do |project|
- if project
- label = project.external_authorization_classification_label
+ module ControllerActions
+ def self.on_routable_not_found
+ lambda do |routable|
+ return unless routable.is_a?(Project)
+
+ label = routable.external_authorization_classification_label
rejection_reason = nil
unless ::Gitlab::ExternalAuthorization.access_allowed?(current_user, label)
@@ -12,9 +14,7 @@ module ProjectUnauthorized
rejection_reason ||= _('External authorization denied access to this project')
end
- if rejection_reason
- access_denied!(rejection_reason)
- end
+ access_denied!(rejection_reason) if rejection_reason
end
end
end
diff --git a/app/controllers/concerns/routable_actions.rb b/app/controllers/concerns/routable_actions.rb
index 5624eb3aa45..ff9b0332c97 100644
--- a/app/controllers/concerns/routable_actions.rb
+++ b/app/controllers/concerns/routable_actions.rb
@@ -3,15 +3,13 @@
module RoutableActions
extend ActiveSupport::Concern
- def find_routable!(routable_klass, requested_full_path, extra_authorization_proc: nil, not_found_or_authorized_proc: nil)
+ def find_routable!(routable_klass, requested_full_path, extra_authorization_proc: nil)
routable = routable_klass.find_by_full_path(requested_full_path, follow_redirects: request.get?)
if routable_authorized?(routable, extra_authorization_proc)
ensure_canonical_path(routable, requested_full_path)
routable
else
- if not_found_or_authorized_proc
- not_found_or_authorized_proc.call(routable)
- end
+ perform_not_found_actions(routable, not_found_actions)
route_not_found unless performed?
@@ -19,6 +17,18 @@ module RoutableActions
end
end
+ def not_found_actions
+ [ProjectUnauthorized::ControllerActions.on_routable_not_found]
+ end
+
+ def perform_not_found_actions(routable, actions)
+ actions.each do |action|
+ break if performed?
+
+ instance_exec(routable, &action)
+ end
+ end
+
def routable_authorized?(routable, extra_authorization_proc)
return false unless routable
diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb
index 781eac7f080..80e4f54bbf4 100644
--- a/app/controllers/projects/application_controller.rb
+++ b/app/controllers/projects/application_controller.rb
@@ -3,7 +3,6 @@
class Projects::ApplicationController < ApplicationController
include CookiesHelper
include RoutableActions
- include ProjectUnauthorized
include ChecksCollaboration
skip_before_action :authenticate_user!
@@ -22,7 +21,7 @@ class Projects::ApplicationController < ApplicationController
path = File.join(params[:namespace_id], params[:project_id] || params[:id])
auth_proc = ->(project) { !project.pending_delete? }
- @project = find_routable!(Project, path, extra_authorization_proc: auth_proc, not_found_or_authorized_proc: project_unauthorized_proc)
+ @project = find_routable!(Project, path, extra_authorization_proc: auth_proc)
end
def build_canonical_path(project)
diff --git a/app/controllers/projects/clusters/applications_controller.rb b/app/controllers/projects/clusters/applications_controller.rb
index c7b6218d007..2a04b007304 100644
--- a/app/controllers/projects/clusters/applications_controller.rb
+++ b/app/controllers/projects/clusters/applications_controller.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true
class Projects::Clusters::ApplicationsController < Clusters::ApplicationsController
- include ProjectUnauthorized
-
prepend_before_action :project
private
@@ -12,6 +10,6 @@ class Projects::Clusters::ApplicationsController < Clusters::ApplicationsControl
end
def project
- @project ||= find_routable!(Project, File.join(params[:namespace_id], params[:project_id]), not_found_or_authorized_proc: project_unauthorized_proc)
+ @project ||= find_routable!(Project, File.join(params[:namespace_id], params[:project_id]))
end
end
diff --git a/app/controllers/projects/clusters_controller.rb b/app/controllers/projects/clusters_controller.rb
index feda6deeaa6..cb02581da37 100644
--- a/app/controllers/projects/clusters_controller.rb
+++ b/app/controllers/projects/clusters_controller.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true
class Projects::ClustersController < Clusters::ClustersController
- include ProjectUnauthorized
-
prepend_before_action :project
before_action :repository
@@ -15,7 +13,7 @@ class Projects::ClustersController < Clusters::ClustersController
end
def project
- @project ||= find_routable!(Project, File.join(params[:namespace_id], params[:project_id]), not_found_or_authorized_proc: project_unauthorized_proc)
+ @project ||= find_routable!(Project, File.join(params[:namespace_id], params[:project_id]))
end
def repository
diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb
index 5a4adea497b..c342e1c80b0 100644
--- a/app/controllers/projects/environments_controller.rb
+++ b/app/controllers/projects/environments_controller.rb
@@ -221,7 +221,6 @@ class Projects::EnvironmentsController < Projects::ApplicationController
def metrics_params
return unless Feature.enabled?(:metrics_time_window, project)
- return unless params[:start].present? || params[:end].present?
params.require([:start, :end])
end
diff --git a/app/controllers/projects/serverless/functions_controller.rb b/app/controllers/projects/serverless/functions_controller.rb
index 8c3d141c888..79030da64d3 100644
--- a/app/controllers/projects/serverless/functions_controller.rb
+++ b/app/controllers/projects/serverless/functions_controller.rb
@@ -3,8 +3,6 @@
module Projects
module Serverless
class FunctionsController < Projects::ApplicationController
- include ProjectUnauthorized
-
before_action :authorize_read_cluster!
def index
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
index 0fa4677ced1..07b38371ab9 100644
--- a/app/controllers/registrations_controller.rb
+++ b/app/controllers/registrations_controller.rb
@@ -4,6 +4,7 @@ class RegistrationsController < Devise::RegistrationsController
include Recaptcha::Verify
include AcceptsPendingInvitations
+ prepend_before_action :check_captcha, only: :create
before_action :whitelist_query_limiting, only: [:destroy]
before_action :ensure_terms_accepted,
if: -> { Gitlab::CurrentSettings.current_application_settings.enforce_terms? },
@@ -21,15 +22,10 @@ class RegistrationsController < Devise::RegistrationsController
params[resource_name] = params.delete(:"new_#{resource_name}")
end
- if !Gitlab::Recaptcha.load_configurations! || verify_recaptcha
- accept_pending_invitations
- super do |new_user|
- persist_accepted_terms_if_required(new_user)
- end
- else
- flash[:alert] = s_('Profiles|There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
- flash.delete :recaptcha_error
- render action: 'new'
+ accept_pending_invitations
+
+ super do |new_user|
+ persist_accepted_terms_if_required(new_user)
end
rescue Gitlab::Access::AccessDeniedError
redirect_to(new_user_session_path)
@@ -89,6 +85,17 @@ class RegistrationsController < Devise::RegistrationsController
private
+ def check_captcha
+ return unless Feature.enabled?(:registrations_recaptcha, default_enabled: true)
+ return unless Gitlab::Recaptcha.load_configurations!
+
+ return if verify_recaptcha
+
+ flash[:alert] = _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
+ flash.delete :recaptcha_error
+ render action: 'new'
+ end
+
def sign_up_params
params.require(:user).permit(:username, :email, :email_confirmation, :name, :password)
end
diff --git a/app/controllers/uploads_controller.rb b/app/controllers/uploads_controller.rb
index 060b09f015c..5d28635232b 100644
--- a/app/controllers/uploads_controller.rb
+++ b/app/controllers/uploads_controller.rb
@@ -45,7 +45,7 @@ class UploadsController < ApplicationController
when Appearance
true
else
- permission = "read_#{model.class.to_s.underscore}".to_sym
+ permission = "read_#{model.class.underscore}".to_sym
can?(current_user, permission, model)
end
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb
index 52b6e828cfa..50e9418677c 100644
--- a/app/finders/issuable_finder.rb
+++ b/app/finders/issuable_finder.rb
@@ -346,7 +346,7 @@ class IssuableFinder
def attempt_project_search_optimizations?
params[:attempt_project_search_optimizations] &&
- Feature.enabled?(:attempt_project_search_optimizations)
+ Feature.enabled?(:attempt_project_search_optimizations, default_enabled: true)
end
def count_key(value)
diff --git a/app/finders/projects/serverless/functions_finder.rb b/app/finders/projects/serverless/functions_finder.rb
index d9802598c64..e5bffccabfe 100644
--- a/app/finders/projects/serverless/functions_finder.rb
+++ b/app/finders/projects/serverless/functions_finder.rb
@@ -3,6 +3,8 @@
module Projects
module Serverless
class FunctionsFinder
+ attr_reader :project
+
def initialize(project)
@clusters = project.clusters
@project = project
@@ -27,7 +29,7 @@ module Projects
environment_scope == c.environment_scope
end
- func = ::Serverless::Function.new(@project, name, cluster.platform_kubernetes&.actual_namespace)
+ func = ::Serverless::Function.new(project, name, cluster.kubernetes_namespace_for(project))
prometheus_adapter.query(:knative_invocation, func)
end
@@ -43,7 +45,7 @@ module Projects
clusters_with_knative_installed.preload_knative.map do |cluster|
next if environment_scope != cluster.environment_scope
- services = cluster.application_knative.services_for(ns: cluster.platform_kubernetes&.actual_namespace)
+ services = cluster.application_knative.services_for(ns: cluster.kubernetes_namespace_for(project))
.select { |svc| svc["metadata"]["name"] == name }
add_metadata(cluster, services).first unless services.nil?
@@ -52,7 +54,7 @@ module Projects
def knative_services
clusters_with_knative_installed.preload_knative.map do |cluster|
- services = cluster.application_knative.services_for(ns: cluster.platform_kubernetes&.actual_namespace)
+ services = cluster.application_knative.services_for(ns: cluster.kubernetes_namespace_for(project))
add_metadata(cluster, services) unless services.nil?
end
end
@@ -64,7 +66,7 @@ module Projects
if services.length == 1
s["podcount"] = cluster.application_knative.service_pod_details(
- cluster.platform_kubernetes&.actual_namespace,
+ cluster.kubernetes_namespace_for(project),
s["metadata"]["name"]).length
end
end
@@ -76,7 +78,7 @@ module Projects
# rubocop: disable CodeReuse/ServiceClass
def prometheus_adapter
- @prometheus_adapter ||= ::Prometheus::AdapterService.new(@project).prometheus_adapter
+ @prometheus_adapter ||= ::Prometheus::AdapterService.new(project).prometheus_adapter
end
# rubocop: enable CodeReuse/ServiceClass
end
diff --git a/app/graphql/resolvers/issues_resolver.rb b/app/graphql/resolvers/issues_resolver.rb
index 1c3c24ad6dc..f7e49166ca0 100644
--- a/app/graphql/resolvers/issues_resolver.rb
+++ b/app/graphql/resolvers/issues_resolver.rb
@@ -46,7 +46,7 @@ module Resolvers
def resolve(**args)
# The project could have been loaded in batch by `BatchLoader`.
# At this point we need the `id` of the project to query for issues, so
- # make sure it's loaded and not `nil` before continueing.
+ # make sure it's loaded and not `nil` before continuing.
project.sync if project.respond_to?(:sync)
return Issue.none if project.nil?
diff --git a/app/graphql/resolvers/tree_resolver.rb b/app/graphql/resolvers/tree_resolver.rb
new file mode 100644
index 00000000000..5aad1c71b40
--- /dev/null
+++ b/app/graphql/resolvers/tree_resolver.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+module Resolvers
+ class TreeResolver < BaseResolver
+ argument :path, GraphQL::STRING_TYPE,
+ required: false,
+ default_value: '',
+ description: 'The path to get the tree for. Default value is the root of the repository'
+ argument :ref, GraphQL::STRING_TYPE,
+ required: false,
+ default_value: :head,
+ description: 'The commit ref to get the tree for. Default value is HEAD'
+ argument :recursive, GraphQL::BOOLEAN_TYPE,
+ required: false,
+ default_value: false,
+ description: 'Used to get a recursive tree. Default is false'
+
+ alias_method :repository, :object
+
+ def resolve(**args)
+ return unless repository.exists?
+
+ repository.tree(args[:ref], args[:path], recursive: args[:recursive])
+ end
+ end
+end
diff --git a/app/graphql/types/group_type.rb b/app/graphql/types/group_type.rb
index a2d615ee732..530aecc2bf9 100644
--- a/app/graphql/types/group_type.rb
+++ b/app/graphql/types/group_type.rb
@@ -8,14 +8,16 @@ module Types
expose_permissions Types::PermissionTypes::Group
- field :web_url, GraphQL::STRING_TYPE, null: true
+ field :web_url, GraphQL::STRING_TYPE, null: false
field :avatar_url, GraphQL::STRING_TYPE, null: true, resolve: -> (group, args, ctx) do
group.avatar_url(only_path: false)
end
if ::Group.supports_nested_objects?
- field :parent, GroupType, null: true
+ field :parent, GroupType,
+ null: true,
+ resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Group, obj.parent_id).find }
end
end
end
diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb
index baea6658e05..06a1aab09f6 100644
--- a/app/graphql/types/project_type.rb
+++ b/app/graphql/types/project_type.rb
@@ -69,6 +69,8 @@ module Types
field :namespace, Types::NamespaceType, null: false
field :group, Types::GroupType, null: true
+ field :repository, Types::RepositoryType, null: false
+
field :merge_requests,
Types::MergeRequestType.connection_type,
null: true,
diff --git a/app/graphql/types/repository_type.rb b/app/graphql/types/repository_type.rb
new file mode 100644
index 00000000000..5987467e1ea
--- /dev/null
+++ b/app/graphql/types/repository_type.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+module Types
+ class RepositoryType < BaseObject
+ graphql_name 'Repository'
+
+ authorize :download_code
+
+ field :root_ref, GraphQL::STRING_TYPE, null: true
+ field :empty, GraphQL::BOOLEAN_TYPE, null: false, method: :empty?
+ field :exists, GraphQL::BOOLEAN_TYPE, null: false, method: :exists?
+ field :tree, Types::Tree::TreeType, null: true, resolver: Resolvers::TreeResolver
+ end
+end
diff --git a/app/graphql/types/tree/blob_type.rb b/app/graphql/types/tree/blob_type.rb
new file mode 100644
index 00000000000..230624201b0
--- /dev/null
+++ b/app/graphql/types/tree/blob_type.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+module Types
+ module Tree
+ class BlobType < BaseObject
+ implements Types::Tree::EntryType
+
+ graphql_name 'Blob'
+ end
+ end
+end
diff --git a/app/graphql/types/tree/entry_type.rb b/app/graphql/types/tree/entry_type.rb
new file mode 100644
index 00000000000..d8e8642ddb8
--- /dev/null
+++ b/app/graphql/types/tree/entry_type.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+module Types
+ module Tree
+ module EntryType
+ include Types::BaseInterface
+
+ field :id, GraphQL::ID_TYPE, null: false
+ field :name, GraphQL::STRING_TYPE, null: false
+ field :type, Tree::TypeEnum, null: false
+ field :path, GraphQL::STRING_TYPE, null: false
+ field :flat_path, GraphQL::STRING_TYPE, null: false
+ end
+ end
+end
diff --git a/app/graphql/types/tree/submodule_type.rb b/app/graphql/types/tree/submodule_type.rb
new file mode 100644
index 00000000000..cea76dbfd2a
--- /dev/null
+++ b/app/graphql/types/tree/submodule_type.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+module Types
+ module Tree
+ class SubmoduleType < BaseObject
+ implements Types::Tree::EntryType
+
+ graphql_name 'Submodule'
+ end
+ end
+end
diff --git a/app/graphql/types/tree/tree_entry_type.rb b/app/graphql/types/tree/tree_entry_type.rb
new file mode 100644
index 00000000000..d5cfb898aea
--- /dev/null
+++ b/app/graphql/types/tree/tree_entry_type.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+module Types
+ module Tree
+ class TreeEntryType < BaseObject
+ implements Types::Tree::EntryType
+
+ graphql_name 'TreeEntry'
+ description 'Represents a directory'
+ end
+ end
+end
diff --git a/app/graphql/types/tree/tree_type.rb b/app/graphql/types/tree/tree_type.rb
new file mode 100644
index 00000000000..1eb6c43972e
--- /dev/null
+++ b/app/graphql/types/tree/tree_type.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+module Types
+ module Tree
+ class TreeType < BaseObject
+ graphql_name 'Tree'
+
+ field :trees, Types::Tree::TreeEntryType.connection_type, null: false
+ field :submodules, Types::Tree::SubmoduleType.connection_type, null: false
+ field :blobs, Types::Tree::BlobType.connection_type, null: false
+ end
+ end
+end
diff --git a/app/graphql/types/tree/type_enum.rb b/app/graphql/types/tree/type_enum.rb
new file mode 100644
index 00000000000..6560d91e9e5
--- /dev/null
+++ b/app/graphql/types/tree/type_enum.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+module Types
+ module Tree
+ class TypeEnum < BaseEnum
+ graphql_name 'EntryType'
+ description 'Type of a tree entry'
+
+ value 'tree', value: :tree
+ value 'blob', value: :blob
+ value 'commit', value: :commit
+ end
+ end
+end
diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb
index d90ef8903a7..42732eb93dd 100644
--- a/app/helpers/dashboard_helper.rb
+++ b/app/helpers/dashboard_helper.rb
@@ -21,6 +21,10 @@ module DashboardHelper
links.any? { |link| dashboard_nav_link?(link) }
end
+ def has_start_trial?
+ false
+ end
+
private
def get_dashboard_nav_links
diff --git a/app/helpers/emails_helper.rb b/app/helpers/emails_helper.rb
index 96471d15aac..dc0e5511fcf 100644
--- a/app/helpers/emails_helper.rb
+++ b/app/helpers/emails_helper.rb
@@ -91,6 +91,28 @@ module EmailsHelper
].join(';')
end
+ def closure_reason_text(closed_via, format: nil)
+ case closed_via
+ when MergeRequest
+ merge_request = MergeRequest.find(closed_via[:id]).present
+
+ case format
+ when :html
+ " via merge request #{link_to(merge_request.to_reference, merge_request.web_url)}"
+ else
+ # If it's not HTML nor text then assume it's text to be safe
+ " via merge request #{merge_request.to_reference} (#{merge_request.web_url})"
+ end
+ when String
+ # Technically speaking this should be Commit but per
+ # https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/15610#note_163812339
+ # we can't deserialize Commit without custom serializer for ActiveJob
+ " via #{closed_via}"
+ else
+ ""
+ end
+ end
+
# "You are receiving this email because #{reason}"
def notification_reason_text(reason)
string = case reason
diff --git a/app/helpers/groups/group_members_helper.rb b/app/helpers/groups/group_members_helper.rb
new file mode 100644
index 00000000000..a5d2f76820f
--- /dev/null
+++ b/app/helpers/groups/group_members_helper.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+module Groups::GroupMembersHelper
+ def group_member_select_options
+ { multiple: true, class: 'input-clamp', scope: :all, email_user: true }
+ end
+end
diff --git a/app/helpers/nav_helper.rb b/app/helpers/nav_helper.rb
index 05da5ebdb22..a57ba5f3a4f 100644
--- a/app/helpers/nav_helper.rb
+++ b/app/helpers/nav_helper.rb
@@ -58,6 +58,14 @@ module NavHelper
current_path?('milestones#show')
end
+ def admin_monitoring_nav_links
+ %w(system_info background_jobs logs health_check requests_profiles)
+ end
+
+ def group_issues_sub_menu_items
+ %w(groups#issues labels#index milestones#index boards#index boards#show)
+ end
+
private
def get_header_links
diff --git a/app/helpers/page_layout_helper.rb b/app/helpers/page_layout_helper.rb
index 5038dcf9746..ec1d8577f36 100644
--- a/app/helpers/page_layout_helper.rb
+++ b/app/helpers/page_layout_helper.rb
@@ -1,3 +1,4 @@
+# coding: utf-8
# frozen_string_literal: true
module PageLayoutHelper
@@ -36,7 +37,7 @@ module PageLayoutHelper
if description.present?
@page_description = description.squish
elsif @page_description.present?
- sanitize(@page_description, tags: []).truncate_words(30)
+ sanitize(@page_description.truncate_words(30), tags: [])
end
end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 2c43b1a2067..91d15e0e4ea 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -315,6 +315,10 @@ module ProjectsHelper
) % { default_label: default_label }
end
+ def can_import_members?
+ Ability.allowed?(current_user, :admin_project_member, @project)
+ end
+
private
def get_project_nav_tabs(project, current_user)
diff --git a/app/helpers/storage_helper.rb b/app/helpers/storage_helper.rb
index 15041bd5805..e80b3f2b54a 100644
--- a/app/helpers/storage_helper.rb
+++ b/app/helpers/storage_helper.rb
@@ -2,6 +2,8 @@
module StorageHelper
def storage_counter(size_in_bytes)
+ return s_('StorageSize|Unknown') unless size_in_bytes
+
precision = size_in_bytes < 1.megabyte ? 0 : 1
number_to_human_size(size_in_bytes, delimiter: ',', precision: precision, significant: false)
diff --git a/app/mailers/devise_mailer.rb b/app/mailers/devise_mailer.rb
index 7aa75ee30e6..cbaf53fced1 100644
--- a/app/mailers/devise_mailer.rb
+++ b/app/mailers/devise_mailer.rb
@@ -7,6 +7,7 @@ class DeviseMailer < Devise::Mailer
layout 'mailer/devise'
helper EmailsHelper
+ helper ApplicationHelper
protected
diff --git a/app/mailers/emails/issues.rb b/app/mailers/emails/issues.rb
index d2e334fb856..2b046d17122 100644
--- a/app/mailers/emails/issues.rb
+++ b/app/mailers/emails/issues.rb
@@ -30,8 +30,8 @@ module Emails
end
# rubocop: enable CodeReuse/ActiveRecord
- def closed_issue_email(recipient_id, issue_id, updated_by_user_id, reason = nil)
- setup_issue_mail(issue_id, recipient_id)
+ def closed_issue_email(recipient_id, issue_id, updated_by_user_id, reason: nil, closed_via: nil)
+ setup_issue_mail(issue_id, recipient_id, closed_via: closed_via)
@updated_by = User.find(updated_by_user_id)
mail_answer_thread(@issue, issue_thread_options(updated_by_user_id, recipient_id, reason))
@@ -91,10 +91,11 @@ module Emails
private
- def setup_issue_mail(issue_id, recipient_id)
+ def setup_issue_mail(issue_id, recipient_id, closed_via: nil)
@issue = Issue.find(issue_id)
@project = @issue.project
@target_url = project_issue_url(@project, @issue)
+ @closed_via = closed_via
@sent_notification = SentNotification.record(@issue, recipient_id, reply_key)
end
diff --git a/app/mailers/emails/merge_requests.rb b/app/mailers/emails/merge_requests.rb
index 63148831a24..fc6ed695675 100644
--- a/app/mailers/emails/merge_requests.rb
+++ b/app/mailers/emails/merge_requests.rb
@@ -58,14 +58,14 @@ module Emails
}))
end
- def closed_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason = nil)
+ def closed_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason: nil, closed_via: nil)
setup_merge_request_mail(merge_request_id, recipient_id)
@updated_by = User.find(updated_by_user_id)
mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason))
end
- def merged_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason = nil)
+ def merged_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason: nil, closed_via: nil)
setup_merge_request_mail(merge_request_id, recipient_id)
mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason))
diff --git a/app/models/active_session.rb b/app/models/active_session.rb
index 1e01f1d17e6..f355b02c428 100644
--- a/app/models/active_session.rb
+++ b/app/models/active_session.rb
@@ -53,7 +53,7 @@ class ActiveSession
def self.list(user)
Gitlab::Redis::SharedState.with do |redis|
- cleaned_up_lookup_entries(redis, user.id).map do |entry|
+ cleaned_up_lookup_entries(redis, user).map do |entry|
# rubocop:disable Security/MarshalLoad
Marshal.load(entry)
# rubocop:enable Security/MarshalLoad
@@ -78,7 +78,7 @@ class ActiveSession
def self.cleanup(user)
Gitlab::Redis::SharedState.with do |redis|
- cleaned_up_lookup_entries(redis, user.id)
+ cleaned_up_lookup_entries(redis, user)
end
end
@@ -90,25 +90,52 @@ class ActiveSession
"#{Gitlab::Redis::SharedState::USER_SESSIONS_LOOKUP_NAMESPACE}:#{user_id}"
end
- def self.cleaned_up_lookup_entries(redis, user_id)
- lookup_key = lookup_key_name(user_id)
+ def self.list_sessions(user)
+ sessions_from_ids(session_ids_for_user(user))
+ end
- session_ids = redis.smembers(lookup_key)
+ def self.session_ids_for_user(user)
+ Gitlab::Redis::SharedState.with do |redis|
+ redis.smembers(lookup_key_name(user.id))
+ end
+ end
- entry_keys = session_ids.map { |session_id| key_name(user_id, session_id) }
- return [] if entry_keys.empty?
+ def self.sessions_from_ids(session_ids)
+ return [] if session_ids.empty?
- entries = redis.mget(entry_keys)
+ Gitlab::Redis::SharedState.with do |redis|
+ session_keys = session_ids.map { |session_id| "#{Gitlab::Redis::SharedState::SESSION_NAMESPACE}:#{session_id}" }
- session_ids_and_entries = session_ids.zip(entries)
+ redis.mget(session_keys).compact.map do |raw_session|
+ # rubocop:disable Security/MarshalLoad
+ Marshal.load(raw_session)
+ # rubocop:enable Security/MarshalLoad
+ end
+ end
+ end
+
+ def self.raw_active_session_entries(session_ids, user_id)
+ return [] if session_ids.empty?
+
+ Gitlab::Redis::SharedState.with do |redis|
+ entry_keys = session_ids.map { |session_id| key_name(user_id, session_id) }
+
+ redis.mget(entry_keys)
+ end
+ end
+
+ def self.cleaned_up_lookup_entries(redis, user)
+ session_ids = session_ids_for_user(user)
+ entries = raw_active_session_entries(session_ids, user.id)
# remove expired keys.
# only the single key entries are automatically expired by redis, the
# lookup entries in the set need to be removed manually.
+ session_ids_and_entries = session_ids.zip(entries)
session_ids_and_entries.reject { |_session_id, entry| entry }.each do |session_id, _entry|
- redis.srem(lookup_key, session_id)
+ redis.srem(lookup_key_name(user.id), session_id)
end
- session_ids_and_entries.select { |_session_id, entry| entry }.map { |_session_id, entry| entry }
+ entries.compact
end
end
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
index d1d01368972..0979d03f6e6 100644
--- a/app/models/application_record.rb
+++ b/app/models/application_record.rb
@@ -41,4 +41,8 @@ class ApplicationRecord < ActiveRecord::Base
find_or_create_by(*args)
end
end
+
+ def self.underscore
+ Gitlab::SafeRequestStore.fetch("model:#{self}:underscore") { self.to_s.underscore }
+ end
end
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index d2f5ff13408..1b67a7272bc 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -140,6 +140,8 @@ module Ci
where("EXISTS (?)", matcher)
end
+ scope :queued_before, ->(time) { where(arel_table[:queued_at].lt(time)) }
+
##
# TODO: Remove these mounters when we remove :ci_enable_legacy_artifacts feature flag
mount_uploader :legacy_artifacts_file, LegacyArtifactUploader, mount_on: :artifacts_file
@@ -378,8 +380,6 @@ module Ci
end
def any_unmet_prerequisites?
- return false unless Feature.enabled?(:ci_preparing_state, default_enabled: true)
-
prerequisites.present?
end
diff --git a/app/models/clusters/applications/jupyter.rb b/app/models/clusters/applications/jupyter.rb
index 987c057ad6d..bd9c453e2a4 100644
--- a/app/models/clusters/applications/jupyter.rb
+++ b/app/models/clusters/applications/jupyter.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+require 'securerandom'
+
module Clusters
module Applications
class Jupyter < ApplicationRecord
@@ -39,7 +41,7 @@ module Clusters
end
# Will be addressed in future MRs
- # We need to investigate and document what will be permenantly deleted.
+ # We need to investigate and document what will be permanently deleted.
def allowed_to_uninstall?
false
end
@@ -80,6 +82,9 @@ module Clusters
"secretToken" => secret_token
},
"auth" => {
+ "state" => {
+ "cryptoKey" => crypto_key
+ },
"gitlab" => {
"clientId" => oauth_application.uid,
"clientSecret" => oauth_application.secret,
@@ -95,6 +100,10 @@ module Clusters
}
end
+ def crypto_key
+ @crypto_key ||= SecureRandom.hex(32)
+ end
+
def project_id
cluster&.project&.id
end
diff --git a/app/models/clusters/applications/runner.rb b/app/models/clusters/applications/runner.rb
index ceecd931bba..01711e477b1 100644
--- a/app/models/clusters/applications/runner.rb
+++ b/app/models/clusters/applications/runner.rb
@@ -3,7 +3,7 @@
module Clusters
module Applications
class Runner < ApplicationRecord
- VERSION = '0.4.1'.freeze
+ VERSION = '0.5.0'.freeze
self.table_name = 'clusters_applications_runners'
diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb
index 9299e61dad3..f7ea7accab2 100644
--- a/app/models/clusters/cluster.rb
+++ b/app/models/clusters/cluster.rb
@@ -45,7 +45,6 @@ module Clusters
has_one :application_knative, class_name: 'Clusters::Applications::Knative'
has_many :kubernetes_namespaces
- has_one :kubernetes_namespace, -> { order(id: :desc) }, class_name: 'Clusters::KubernetesNamespace'
accepts_nested_attributes_for :provider_gcp, update_only: true
accepts_nested_attributes_for :platform_kubernetes, update_only: true
@@ -108,7 +107,7 @@ module Clusters
scope :preload_knative, -> {
preload(
- :kubernetes_namespace,
+ :kubernetes_namespaces,
:platform_kubernetes,
:application_knative
)
@@ -187,16 +186,16 @@ module Clusters
platform_kubernetes.kubeclient if kubernetes?
end
+ def kubernetes_namespace_for(project)
+ find_or_initialize_kubernetes_namespace_for_project(project).namespace
+ end
+
def find_or_initialize_kubernetes_namespace_for_project(project)
- if project_type?
- kubernetes_namespaces.find_or_initialize_by(
- project: project,
- cluster_project: cluster_project
- )
- else
- kubernetes_namespaces.find_or_initialize_by(
- project: project
- )
+ attributes = { project: project }
+ attributes[:cluster_project] = cluster_project if project_type?
+
+ kubernetes_namespaces.find_or_initialize_by(attributes).tap do |namespace|
+ namespace.set_defaults
end
end
diff --git a/app/models/clusters/concerns/application_data.rb b/app/models/clusters/concerns/application_data.rb
index a48ee340fac..3479fea415e 100644
--- a/app/models/clusters/concerns/application_data.rb
+++ b/app/models/clusters/concerns/application_data.rb
@@ -3,56 +3,52 @@
module Clusters
module Concerns
module ApplicationData
- extend ActiveSupport::Concern
-
- included do
- def uninstall_command
- Gitlab::Kubernetes::Helm::DeleteCommand.new(
- name: name,
- rbac: cluster.platform_kubernetes_rbac?,
- files: files
- )
- end
+ def uninstall_command
+ Gitlab::Kubernetes::Helm::DeleteCommand.new(
+ name: name,
+ rbac: cluster.platform_kubernetes_rbac?,
+ files: files
+ )
+ end
- def repository
- nil
- end
+ def repository
+ nil
+ end
- def values
- File.read(chart_values_file)
- end
+ def values
+ File.read(chart_values_file)
+ end
- def files
- @files ||= begin
- files = { 'values.yaml': values }
+ def files
+ @files ||= begin
+ files = { 'values.yaml': values }
- files.merge!(certificate_files) if cluster.application_helm.has_ssl?
+ files.merge!(certificate_files) if cluster.application_helm.has_ssl?
- files
- end
+ files
end
+ end
- private
+ private
- def certificate_files
- {
- 'ca.pem': ca_cert,
- 'cert.pem': helm_cert.cert_string,
- 'key.pem': helm_cert.key_string
- }
- end
+ def certificate_files
+ {
+ 'ca.pem': ca_cert,
+ 'cert.pem': helm_cert.cert_string,
+ 'key.pem': helm_cert.key_string
+ }
+ end
- def ca_cert
- cluster.application_helm.ca_cert
- end
+ def ca_cert
+ cluster.application_helm.ca_cert
+ end
- def helm_cert
- @helm_cert ||= cluster.application_helm.issue_client_cert
- end
+ def helm_cert
+ @helm_cert ||= cluster.application_helm.issue_client_cert
+ end
- def chart_values_file
- "#{Rails.root}/vendor/#{name}/values.yaml"
- end
+ def chart_values_file
+ "#{Rails.root}/vendor/#{name}/values.yaml"
end
end
end
diff --git a/app/models/clusters/platforms/kubernetes.rb b/app/models/clusters/platforms/kubernetes.rb
index 3b7b93e7631..9b951578aee 100644
--- a/app/models/clusters/platforms/kubernetes.rb
+++ b/app/models/clusters/platforms/kubernetes.rb
@@ -52,11 +52,14 @@ module Clusters
alias_attribute :ca_pem, :ca_cert
- delegate :project, to: :cluster, allow_nil: true
delegate :enabled?, to: :cluster, allow_nil: true
delegate :provided_by_user?, to: :cluster, allow_nil: true
delegate :allow_user_defined_namespace?, to: :cluster, allow_nil: true
- delegate :kubernetes_namespace, to: :cluster
+
+ # This is just to maintain compatibility with KubernetesService, which
+ # will be removed in https://gitlab.com/gitlab-org/gitlab-ce/issues/39217.
+ # It can be removed once KubernetesService is gone.
+ delegate :kubernetes_namespace_for, to: :cluster, allow_nil: true
alias_method :active?, :enabled?
@@ -68,18 +71,6 @@ module Clusters
default_value_for :authorization_type, :rbac
- def actual_namespace
- if namespace.present?
- namespace
- else
- default_namespace
- end
- end
-
- def namespace_for(project)
- cluster.find_or_initialize_kubernetes_namespace_for_project(project).namespace
- end
-
def predefined_variables(project:)
Gitlab::Ci::Variables::Collection.new.tap do |variables|
variables.append(key: 'KUBE_URL', value: api_url)
@@ -98,11 +89,13 @@ module Clusters
# Once we have marked all project-level clusters that make use of this
# behaviour as "unmanaged", we can remove the `cluster.project_type?`
# check here.
+ project_namespace = cluster.kubernetes_namespace_for(project)
+
variables
.append(key: 'KUBE_URL', value: api_url)
.append(key: 'KUBE_TOKEN', value: token, public: false, masked: true)
- .append(key: 'KUBE_NAMESPACE', value: actual_namespace)
- .append(key: 'KUBECONFIG', value: kubeconfig, public: false, file: true)
+ .append(key: 'KUBE_NAMESPACE', value: project_namespace)
+ .append(key: 'KUBECONFIG', value: kubeconfig(project_namespace), public: false, file: true)
end
variables.concat(cluster.predefined_variables)
@@ -115,8 +108,10 @@ module Clusters
# short time later
def terminals(environment)
with_reactive_cache do |data|
+ project = environment.project
+
pods = filter_by_project_environment(data[:pods], project.full_path_slug, environment.slug)
- terminals = pods.flat_map { |pod| terminals_for_pod(api_url, actual_namespace, pod) }.compact
+ terminals = pods.flat_map { |pod| terminals_for_pod(api_url, cluster.kubernetes_namespace_for(project), pod) }.compact
terminals.each { |terminal| add_terminal_auth(terminal, terminal_auth) }
end
end
@@ -124,7 +119,7 @@ module Clusters
# Caches resources in the namespace so other calls don't need to block on
# network access
def calculate_reactive_cache
- return unless enabled? && project && !project.pending_delete?
+ return unless enabled?
# We may want to cache extra things in the future
{ pods: read_pods }
@@ -136,33 +131,16 @@ module Clusters
private
- def kubeconfig
+ def kubeconfig(namespace)
to_kubeconfig(
url: api_url,
- namespace: actual_namespace,
+ namespace: namespace,
token: token,
ca_pem: ca_pem)
end
- def default_namespace
- kubernetes_namespace&.namespace.presence || fallback_default_namespace
- end
-
- # DEPRECATED
- #
- # On 11.4 Clusters::KubernetesNamespace was introduced, this model will allow to
- # have multiple namespaces per project. This method will be removed after migration
- # has been completed.
- def fallback_default_namespace
- return unless project
-
- slug = "#{project.path}-#{project.id}".downcase
- Gitlab::NamespaceSanitizer.sanitize(slug)
- end
-
def build_kube_client!
raise "Incomplete settings" unless api_url
- raise "No namespace" if cluster.project_type? && actual_namespace.empty? # can probably remove this line once we remove #actual_namespace
unless (username && password) || token
raise "Either username/password or token is required to access API"
@@ -178,9 +156,13 @@ module Clusters
# Returns a hash of all pods in the namespace
def read_pods
- kubeclient = build_kube_client!
+ # TODO: The project lookup here should be moved (to environment?),
+ # which will enable reading pods from the correct namespace for group
+ # and instance clusters.
+ # This will be done in https://gitlab.com/gitlab-org/gitlab-ce/issues/61156
+ return [] unless cluster.project_type?
- kubeclient.get_pods(namespace: actual_namespace).as_json
+ kubeclient.get_pods(namespace: cluster.kubernetes_namespace_for(cluster.first_project)).as_json
rescue Kubeclient::ResourceNotFoundError
[]
end
diff --git a/app/models/clusters/project.rb b/app/models/clusters/project.rb
index d2b68b3f117..e0bf60164ba 100644
--- a/app/models/clusters/project.rb
+++ b/app/models/clusters/project.rb
@@ -8,6 +8,5 @@ module Clusters
belongs_to :project, class_name: '::Project'
has_many :kubernetes_namespaces, class_name: 'Clusters::KubernetesNamespace', foreign_key: :cluster_project_id
- has_one :kubernetes_namespace, -> { order(id: :desc) }, class_name: 'Clusters::KubernetesNamespace', foreign_key: :cluster_project_id
end
end
diff --git a/app/models/environment.rb b/app/models/environment.rb
index 0eda7a2513f..aff20dae09b 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -155,11 +155,11 @@ class Environment < ApplicationRecord
end
def has_terminals?
- project.deployment_platform.present? && available? && last_deployment.present?
+ deployment_platform.present? && available? && last_deployment.present?
end
def terminals
- project.deployment_platform.terminals(self) if has_terminals?
+ deployment_platform.terminals(self) if has_terminals?
end
def has_metrics?
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index df162e4844c..311ba1ce6bd 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -581,6 +581,8 @@ class MergeRequest < ApplicationRecord
end
def validate_branches
+ return unless target_project && source_project
+
if target_project == source_project && target_branch == source_branch
errors.add :branch_conflict, "You can't use same project/branch for source and target"
return
diff --git a/app/models/project_services/kubernetes_service.rb b/app/models/project_services/kubernetes_service.rb
index fc8afa9bead..aa6b4aa1d5e 100644
--- a/app/models/project_services/kubernetes_service.rb
+++ b/app/models/project_services/kubernetes_service.rb
@@ -86,7 +86,7 @@ class KubernetesService < DeploymentService
]
end
- def actual_namespace
+ def kubernetes_namespace_for(project)
if namespace.present?
namespace
else
@@ -94,10 +94,6 @@ class KubernetesService < DeploymentService
end
end
- def namespace_for(project)
- actual_namespace
- end
-
# Check we can connect to the Kubernetes API
def test(*args)
kubeclient = build_kube_client!
@@ -118,7 +114,7 @@ class KubernetesService < DeploymentService
variables
.append(key: 'KUBE_URL', value: api_url)
.append(key: 'KUBE_TOKEN', value: token, public: false, masked: true)
- .append(key: 'KUBE_NAMESPACE', value: actual_namespace)
+ .append(key: 'KUBE_NAMESPACE', value: kubernetes_namespace_for(project))
.append(key: 'KUBECONFIG', value: kubeconfig, public: false, file: true)
if ca_pem.present?
@@ -135,8 +131,10 @@ class KubernetesService < DeploymentService
# short time later
def terminals(environment)
with_reactive_cache do |data|
+ project = environment.project
+
pods = filter_by_project_environment(data[:pods], project.full_path_slug, environment.slug)
- terminals = pods.flat_map { |pod| terminals_for_pod(api_url, actual_namespace, pod) }.compact
+ terminals = pods.flat_map { |pod| terminals_for_pod(api_url, kubernetes_namespace_for(project), pod) }.compact
terminals.each { |terminal| add_terminal_auth(terminal, terminal_auth) }
end
end
@@ -173,7 +171,7 @@ class KubernetesService < DeploymentService
def kubeconfig
to_kubeconfig(
url: api_url,
- namespace: actual_namespace,
+ namespace: kubernetes_namespace_for(project),
token: token,
ca_pem: ca_pem)
end
@@ -190,7 +188,7 @@ class KubernetesService < DeploymentService
end
def build_kube_client!
- raise "Incomplete settings" unless api_url && actual_namespace && token
+ raise "Incomplete settings" unless api_url && kubernetes_namespace_for(project) && token
Gitlab::Kubernetes::KubeClient.new(
api_url,
@@ -204,7 +202,7 @@ class KubernetesService < DeploymentService
def read_pods
kubeclient = build_kube_client!
- kubeclient.get_pods(namespace: actual_namespace).as_json
+ kubeclient.get_pods(namespace: kubernetes_namespace_for(project)).as_json
rescue Kubeclient::ResourceNotFoundError
[]
end
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 1c02e68f2f6..e05d3dd58ac 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -283,14 +283,19 @@ class Repository
end
def diverging_commit_counts(branch)
+ return diverging_commit_counts_without_max(branch) if Feature.enabled?('gitaly_count_diverging_commits_no_max')
+
+ ## TODO: deprecate the below code after 12.0
@root_ref_hash ||= raw_repository.commit(root_ref).id
cache.fetch(:"diverging_commit_counts_#{branch.name}") do
# Rugged seems to throw a `ReferenceError` when given branch_names rather
# than SHA-1 hashes
+ branch_sha = branch.dereferenced_target.sha
+
number_commits_behind, number_commits_ahead =
raw_repository.diverging_commit_count(
@root_ref_hash,
- branch.dereferenced_target.sha,
+ branch_sha,
max_count: MAX_DIVERGING_COUNT)
if number_commits_behind + number_commits_ahead >= MAX_DIVERGING_COUNT
@@ -301,6 +306,22 @@ class Repository
end
end
+ def diverging_commit_counts_without_max(branch)
+ @root_ref_hash ||= raw_repository.commit(root_ref).id
+ cache.fetch(:"diverging_commit_counts_without_max_#{branch.name}") do
+ # Rugged seems to throw a `ReferenceError` when given branch_names rather
+ # than SHA-1 hashes
+ branch_sha = branch.dereferenced_target.sha
+
+ number_commits_behind, number_commits_ahead =
+ raw_repository.diverging_commit_count(
+ @root_ref_hash,
+ branch_sha)
+
+ { behind: number_commits_behind, ahead: number_commits_ahead }
+ end
+ end
+
def archive_metadata(ref, storage_path, format = "tar.gz", append_sha:, path: nil)
raw_repository.archive_metadata(
ref,
@@ -1050,7 +1071,7 @@ class Repository
# To support the full deprecated behaviour, set the
# `rebase_commit_sha` for the merge_request here and return the value
- merge_request.update(rebase_commit_sha: rebase_sha)
+ merge_request.update(rebase_commit_sha: rebase_sha, merge_error: nil)
rebase_sha
end
@@ -1069,7 +1090,7 @@ class Repository
remote_repository: merge_request.target_project.repository.raw,
remote_branch: merge_request.target_branch
) do |commit_id|
- merge_request.update!(rebase_commit_sha: commit_id)
+ merge_request.update!(rebase_commit_sha: commit_id, merge_error: nil)
end
end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 60f69659a6b..2eb5c63a4cc 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1497,15 +1497,6 @@ class User < ApplicationRecord
devise_mailer.__send__(notification, self, *args).deliver_later # rubocop:disable GitlabSecurity/PublicSend
end
- # This works around a bug in Devise 4.2.0 that erroneously causes a user to
- # be considered active in MySQL specs due to a sub-second comparison
- # issue. For more details, see: https://gitlab.com/gitlab-org/gitlab-ee/issues/2362#note_29004709
- def confirmation_period_valid?
- return false if self.class.allow_unconfirmed_access_for == 0.days
-
- super
- end
-
def ensure_user_rights_and_limits
if external?
self.can_create_group = false
diff --git a/app/serializers/test_case_entity.rb b/app/serializers/test_case_entity.rb
index ec60055ba5b..5c915c1302c 100644
--- a/app/serializers/test_case_entity.rb
+++ b/app/serializers/test_case_entity.rb
@@ -3,6 +3,7 @@
class TestCaseEntity < Grape::Entity
expose :status
expose :name
+ expose :classname
expose :execution_time
expose :system_output
expose :stack_trace
diff --git a/app/services/ci/register_job_service.rb b/app/services/ci/register_job_service.rb
index 6707a1363d0..dedab98b56d 100644
--- a/app/services/ci/register_job_service.rb
+++ b/app/services/ci/register_job_service.rb
@@ -6,7 +6,7 @@ module Ci
class RegisterJobService
attr_reader :runner
- JOB_QUEUE_DURATION_SECONDS_BUCKETS = [1, 3, 10, 30].freeze
+ JOB_QUEUE_DURATION_SECONDS_BUCKETS = [1, 3, 10, 30, 60, 300].freeze
JOBS_RUNNING_FOR_PROJECT_MAX_BUCKET = 5.freeze
Result = Struct.new(:build, :valid?)
@@ -36,6 +36,11 @@ module Ci
builds = builds.with_any_tags
end
+ # pick builds that older than specified age
+ if params.key?(:job_age)
+ builds = builds.queued_before(params[:job_age].seconds.ago)
+ end
+
builds.each do |build|
next unless runner.can_pick?(build)
diff --git a/app/services/clusters/refresh_service.rb b/app/services/clusters/refresh_service.rb
index b02bb9c0247..3752a306793 100644
--- a/app/services/clusters/refresh_service.rb
+++ b/app/services/clusters/refresh_service.rb
@@ -21,11 +21,7 @@ module Clusters
private_class_method :projects_with_missing_kubernetes_namespaces_for_cluster
def self.clusters_with_missing_kubernetes_namespaces_for_project(project)
- if Feature.enabled?(:ci_preparing_state, default_enabled: true)
- project.clusters.managed.missing_kubernetes_namespace(project.kubernetes_namespaces)
- else
- project.all_clusters.managed.missing_kubernetes_namespace(project.kubernetes_namespaces)
- end
+ project.clusters.managed.missing_kubernetes_namespace(project.kubernetes_namespaces)
end
private_class_method :clusters_with_missing_kubernetes_namespaces_for_project
diff --git a/app/services/git/base_hooks_service.rb b/app/services/git/base_hooks_service.rb
index 9d371e234ee..d30df34e54b 100644
--- a/app/services/git/base_hooks_service.rb
+++ b/app/services/git/base_hooks_service.rb
@@ -17,6 +17,8 @@ module Git
# Not a hook, but it needs access to the list of changed commits
enqueue_invalidate_cache
+ update_remote_mirrors
+
push_data
end
@@ -92,5 +94,12 @@ module Git
def pipeline_options
{}
end
+
+ def update_remote_mirrors
+ return unless project.has_remote_mirror?
+
+ project.mark_stuck_remote_mirrors_as_failed!
+ project.update_remote_mirrors
+ end
end
end
diff --git a/app/services/git/branch_push_service.rb b/app/services/git/branch_push_service.rb
index abf11f253f6..c4910180787 100644
--- a/app/services/git/branch_push_service.rb
+++ b/app/services/git/branch_push_service.rb
@@ -27,7 +27,6 @@ module Git
execute_related_hooks
perform_housekeeping
- update_remote_mirrors
stop_environments
true
diff --git a/app/services/issues/close_service.rb b/app/services/issues/close_service.rb
index e5cc12e6082..2a19e57a94f 100644
--- a/app/services/issues/close_service.rb
+++ b/app/services/issues/close_service.rb
@@ -7,7 +7,7 @@ module Issues
return issue unless can?(current_user, :update_issue, issue)
close_issue(issue,
- commit: commit,
+ closed_via: commit,
notifications: notifications,
system_note: system_note)
end
@@ -17,9 +17,9 @@ module Issues
#
# The code calling this method is responsible for ensuring that a user is
# allowed to close the given issue.
- def close_issue(issue, commit: nil, notifications: true, system_note: true)
+ def close_issue(issue, closed_via: nil, notifications: true, system_note: true)
if project.jira_tracker? && project.jira_service.active && issue.is_a?(ExternalIssue)
- project.jira_service.close_issue(commit, issue)
+ project.jira_service.close_issue(closed_via, issue)
todo_service.close_issue(issue, current_user)
return issue
end
@@ -27,8 +27,11 @@ module Issues
if project.issues_enabled? && issue.close
issue.update(closed_by: current_user)
event_service.close_issue(issue, current_user)
- create_note(issue, commit) if system_note
- notification_service.async.close_issue(issue, current_user) if notifications
+ create_note(issue, closed_via) if system_note
+
+ closed_via = "commit #{closed_via.id}" if closed_via.is_a?(Commit)
+
+ notification_service.async.close_issue(issue, current_user, closed_via: closed_via) if notifications
todo_service.close_issue(issue, current_user)
execute_hooks(issue, 'close')
invalidate_cache_counts(issue, users: issue.assignees)
diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb
index 8d3b569498f..f797c0f11c6 100644
--- a/app/services/notification_service.rb
+++ b/app/services/notification_service.rb
@@ -89,8 +89,8 @@ class NotificationService
# * project team members with notification level higher then Participating
# * users with custom level checked with "close issue"
#
- def close_issue(issue, current_user)
- close_resource_email(issue, current_user, :closed_issue_email)
+ def close_issue(issue, current_user, closed_via: nil)
+ close_resource_email(issue, current_user, :closed_issue_email, closed_via: closed_via)
end
# When we reassign an issue we should send an email to:
@@ -504,7 +504,7 @@ class NotificationService
end
end
- def close_resource_email(target, current_user, method, skip_current_user: true)
+ def close_resource_email(target, current_user, method, skip_current_user: true, closed_via: nil)
action = method == :merged_merge_request_email ? "merge" : "close"
recipients = NotificationRecipientService.build_recipients(
@@ -515,7 +515,7 @@ class NotificationService
)
recipients.each do |recipient|
- mailer.send(method, recipient.user.id, target.id, current_user.id, recipient.reason).deliver_later
+ mailer.send(method, recipient.user.id, target.id, current_user.id, reason: recipient.reason, closed_via: closed_via).deliver_later
end
end
diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb
index 4ea40e3c8ce..9f335cceb67 100644
--- a/app/services/projects/create_service.rb
+++ b/app/services/projects/create_service.rb
@@ -100,8 +100,6 @@ module Projects
current_user.invalidate_personal_projects_count
create_readme if @initialize_with_readme
-
- configure_group_clusters_for_project
end
# Refresh the current user's authorizations inline (so they can access the
@@ -127,10 +125,6 @@ module Projects
Files::CreateService.new(@project, current_user, commit_attrs).execute
end
- def configure_group_clusters_for_project
- ClusterProjectConfigureWorker.perform_async(@project.id)
- end
-
def skip_wiki?
!@project.feature_available?(:wiki, current_user) || @skip_wiki
end
diff --git a/app/services/projects/git_deduplication_service.rb b/app/services/projects/git_deduplication_service.rb
new file mode 100644
index 00000000000..74d469ecf37
--- /dev/null
+++ b/app/services/projects/git_deduplication_service.rb
@@ -0,0 +1,64 @@
+# frozen_string_literal: true
+
+module Projects
+ class GitDeduplicationService < BaseService
+ include ExclusiveLeaseGuard
+
+ LEASE_TIMEOUT = 86400
+
+ delegate :pool_repository, to: :project
+ attr_reader :project
+
+ def initialize(project)
+ @project = project
+ end
+
+ def execute
+ try_obtain_lease do
+ unless project.has_pool_repository?
+ disconnect_git_alternates
+ break
+ end
+
+ if source_project? && pool_can_fetch_from_source?
+ fetch_from_source
+ end
+
+ project.link_pool_repository if same_storage_as_pool?(project.repository)
+ end
+ end
+
+ private
+
+ def disconnect_git_alternates
+ project.repository.disconnect_alternates
+ end
+
+ def pool_can_fetch_from_source?
+ project.git_objects_poolable? &&
+ same_storage_as_pool?(pool_repository.source_project.repository)
+ end
+
+ def same_storage_as_pool?(repository)
+ pool_repository.object_pool.repository.storage == repository.storage
+ end
+
+ def fetch_from_source
+ project.pool_repository.object_pool.fetch
+ end
+
+ def source_project?
+ return unless project.has_pool_repository?
+
+ project.pool_repository.source_project == project
+ end
+
+ def lease_timeout
+ LEASE_TIMEOUT
+ end
+
+ def lease_key
+ "git_deduplication:#{project.id}"
+ end
+ end
+end
diff --git a/app/services/projects/transfer_service.rb b/app/services/projects/transfer_service.rb
index 91c01eca75c..233dcf37e35 100644
--- a/app/services/projects/transfer_service.rb
+++ b/app/services/projects/transfer_service.rb
@@ -54,7 +54,6 @@ module Projects
end
attempt_transfer_transaction
- configure_group_clusters_for_project
end
# rubocop: enable CodeReuse/ActiveRecord
@@ -164,9 +163,5 @@ module Projects
@new_namespace.full_path
)
end
-
- def configure_group_clusters_for_project
- ClusterProjectConfigureWorker.perform_async(project.id)
- end
end
end
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb
index a39ff76b798..1390f7cdf46 100644
--- a/app/services/system_note_service.rb
+++ b/app/services/system_note_service.rb
@@ -25,7 +25,7 @@ module SystemNoteService
text_parts = ["added #{commits_text}"]
text_parts << commits_list(noteable, new_commits, existing_commits, oldrev)
- text_parts << "[Compare with previous version](#{diff_comparison_url(noteable, project, oldrev)})"
+ text_parts << "[Compare with previous version](#{diff_comparison_path(noteable, project, oldrev)})"
body = text_parts.join("\n\n")
@@ -41,7 +41,7 @@ module SystemNoteService
#
# Returns the created Note object
def tag_commit(noteable, project, author, tag_name)
- link = url_helpers.project_tag_url(project, id: tag_name)
+ link = url_helpers.project_tag_path(project, id: tag_name)
body = "tagged commit #{noteable.sha} to [`#{tag_name}`](#{link})"
create_note(NoteSummary.new(noteable, project, author, body, action: 'tag'))
@@ -272,7 +272,7 @@ module SystemNoteService
text_parts = ["changed this line in"]
if version_params = merge_request.version_params_for(diff_refs)
line_code = change_position.line_code(project.repository)
- url = url_helpers.diffs_project_merge_request_url(project, merge_request, version_params.merge(anchor: line_code))
+ url = url_helpers.diffs_project_merge_request_path(project, merge_request, version_params.merge(anchor: line_code))
text_parts << "[version #{version_index} of the diff](#{url})"
else
@@ -405,7 +405,7 @@ module SystemNoteService
#
# "created branch `201-issue-branch-button`"
def new_issue_branch(issue, project, author, branch)
- link = url_helpers.project_compare_url(project, from: project.default_branch, to: branch)
+ link = url_helpers.project_compare_path(project, from: project.default_branch, to: branch)
body = "created branch [`#{branch}`](#{link}) to address this issue"
@@ -668,10 +668,10 @@ module SystemNoteService
@url_helpers ||= Gitlab::Routing.url_helpers
end
- def diff_comparison_url(merge_request, project, oldrev)
+ def diff_comparison_path(merge_request, project, oldrev)
diff_id = merge_request.merge_request_diff.id
- url_helpers.diffs_project_merge_request_url(
+ url_helpers.diffs_project_merge_request_path(
project,
merge_request,
diff_id: diff_id,
diff --git a/app/uploaders/attachment_uploader.rb b/app/uploaders/attachment_uploader.rb
index 0a166335b4e..b488bba00e9 100644
--- a/app/uploaders/attachment_uploader.rb
+++ b/app/uploaders/attachment_uploader.rb
@@ -9,6 +9,6 @@ class AttachmentUploader < GitlabUploader
private
def dynamic_segment
- File.join(model.class.to_s.underscore, mounted_as.to_s, model.id.to_s)
+ File.join(model.class.underscore, mounted_as.to_s, model.id.to_s)
end
end
diff --git a/app/uploaders/avatar_uploader.rb b/app/uploaders/avatar_uploader.rb
index c0165759203..9af59b0aceb 100644
--- a/app/uploaders/avatar_uploader.rb
+++ b/app/uploaders/avatar_uploader.rb
@@ -25,6 +25,6 @@ class AvatarUploader < GitlabUploader
private
def dynamic_segment
- File.join(model.class.to_s.underscore, mounted_as.to_s, model.id.to_s)
+ File.join(model.class.underscore, mounted_as.to_s, model.id.to_s)
end
end
diff --git a/app/uploaders/file_uploader.rb b/app/uploaders/file_uploader.rb
index 6dfe2bed0ba..1c7582533ad 100644
--- a/app/uploaders/file_uploader.rb
+++ b/app/uploaders/file_uploader.rb
@@ -109,12 +109,20 @@ class FileUploader < GitlabUploader
def upload_path
if file_storage?
# Legacy path relative to project.full_path
- File.join(dynamic_segment, identifier)
+ local_storage_path(identifier)
else
- File.join(store_dir, identifier)
+ remote_storage_path(identifier)
end
end
+ def local_storage_path(file_identifier)
+ File.join(dynamic_segment, file_identifier)
+ end
+
+ def remote_storage_path(file_identifier)
+ File.join(store_dir, file_identifier)
+ end
+
def store_dirs
{
Store::LOCAL => File.join(base_dir, dynamic_segment),
diff --git a/app/uploaders/personal_file_uploader.rb b/app/uploaders/personal_file_uploader.rb
index 272837aa6ce..b43162f0935 100644
--- a/app/uploaders/personal_file_uploader.rb
+++ b/app/uploaders/personal_file_uploader.rb
@@ -6,21 +6,18 @@ class PersonalFileUploader < FileUploader
options.storage_path
end
- def self.base_dir(model, store = nil)
- base_dirs(model)[store || Store::LOCAL]
- end
-
- def self.base_dirs(model)
- {
- Store::LOCAL => File.join(options.base_dir, model_path_segment(model)),
- Store::REMOTE => model_path_segment(model)
- }
+ def self.base_dir(model, _store = nil)
+ # base_dir is the path seen by the user when rendering Markdown, so
+ # it should be the same for both local and object storage. It is
+ # typically prefaced with uploads/-/system, but that prefix
+ # is omitted in the path stored on disk.
+ File.join(options.base_dir, model_path_segment(model))
end
def self.model_path_segment(model)
return 'temp/' unless model
- File.join(model.class.to_s.underscore, model.id.to_s)
+ File.join(model.class.underscore, model.id.to_s)
end
def object_store
@@ -40,8 +37,61 @@ class PersonalFileUploader < FileUploader
store_dirs[object_store]
end
+ # A personal snippet path is stored using FileUploader#upload_path.
+ #
+ # The format for the path:
+ #
+ # Local storage: :random_hex/:filename.
+ # Object storage: personal_snippet/:id/:random_hex/:filename.
+ #
+ # upload_paths represent the possible paths for a given identifier,
+ # which will vary depending on whether the file is stored in local or
+ # object storage. upload_path should match an element in upload_paths.
+ #
+ # base_dir represents the path seen by the user in Markdown, and it
+ # should always be prefixed with uploads/-/system.
+ #
+ # store_dirs represent the paths that are actually used on disk. For
+ # object storage, this should omit the prefix /uploads/-/system.
+ #
+ # For example, consider the requested path /uploads/-/system/personal_snippet/172/ff4ad5c2e40b39ae57cda51577317d20/file.png.
+ #
+ # For local storage:
+ #
+ # File on disk: /opt/gitlab/embedded/service/gitlab-rails/public/uploads/-/system/personal_snippet/172/ff4ad5c2e40b39ae57cda51577317d20/file.png.
+ #
+ # base_dir: uploads/-/system/personal_snippet/172
+ # upload_path: ff4ad5c2e40b39ae57cda51577317d20/file.png
+ # upload_paths: ["ff4ad5c2e40b39ae57cda51577317d20/file.png", "personal_snippet/172/ff4ad5c2e40b39ae57cda51577317d20/file.png"].
+ # store_dirs:
+ # => {1=>"uploads/-/system/personal_snippet/172/ff4ad5c2e40b39ae57cda51577317d20", 2=>"personal_snippet/172/ff4ad5c2e40b39ae57cda51577317d20"}
+ #
+ # For object storage:
+ #
+ # upload_path: personal_snippet/172/ff4ad5c2e40b39ae57cda51577317d20/file.png
+ def upload_paths(identifier)
+ [
+ local_storage_path(identifier),
+ File.join(remote_storage_base_path, identifier)
+ ]
+ end
+
+ def store_dirs
+ {
+ Store::LOCAL => File.join(base_dir, dynamic_segment),
+ Store::REMOTE => remote_storage_base_path
+ }
+ end
+
private
+ # To avoid prefacing the remote storage path with `/uploads/-/system`,
+ # we just drop that part so that the destination path will be
+ # personal_snippet/:id/:random_hex/:filename.
+ def remote_storage_base_path
+ File.join(self.class.model_path_segment(model), dynamic_segment)
+ end
+
def secure_url
File.join('/', base_dir, secret, file.filename)
end
diff --git a/app/views/admin/application_settings/_pages.html.haml b/app/views/admin/application_settings/_pages.html.haml
index 64e01fa2d00..77795dbf913 100644
--- a/app/views/admin/application_settings/_pages.html.haml
+++ b/app/views/admin/application_settings/_pages.html.haml
@@ -30,8 +30,7 @@
.form-check
= f.check_box :lets_encrypt_terms_of_service_accepted, class: 'form-check-input'
= f.label :lets_encrypt_terms_of_service_accepted, class: 'form-check-label' do
- // Terms of Service should actually be a link, but the best way to get the url is using API
- // So it will be done in later MR
- = _("I have read and agree to the Let's Encrypt Terms of Service")
+ - terms_of_service_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: lets_encrypt_terms_of_service_admin_application_settings_path }
+ = _("I have read and agree to the Let's Encrypt %{link_start}Terms of Service%{link_end}").html_safe % { link_start: terms_of_service_link_start, link_end: '</a>'.html_safe }
= f.submit _('Save changes'), class: "btn btn-success"
diff --git a/app/views/admin/broadcast_messages/index.html.haml b/app/views/admin/broadcast_messages/index.html.haml
index 9ef58faf8cc..eb4dfdf2858 100644
--- a/app/views/admin/broadcast_messages/index.html.haml
+++ b/app/views/admin/broadcast_messages/index.html.haml
@@ -32,7 +32,7 @@
%td
= message.ends_at
%td
- = link_to icon('pencil-square-o'), edit_admin_broadcast_message_path(message), title: 'Edit', class: 'btn btn-sm'
- = link_to icon('times'), admin_broadcast_message_path(message), method: :delete, remote: true, title: 'Remove', class: 'js-remove-tr btn btn-sm btn-danger'
+ = link_to sprite_icon('pencil-square'), edit_admin_broadcast_message_path(message), title: 'Edit', class: 'btn'
+ = link_to sprite_icon('remove'), admin_broadcast_message_path(message), method: :delete, remote: true, title: 'Remove', class: 'js-remove-tr btn btn-danger'
= paginate @broadcast_messages, theme: 'gitlab'
diff --git a/app/views/admin/groups/_form.html.haml b/app/views/admin/groups/_form.html.haml
index 8fb38f6a690..62d1d01cc83 100644
--- a/app/views/admin/groups/_form.html.haml
+++ b/app/views/admin/groups/_form.html.haml
@@ -2,7 +2,7 @@
= form_errors(@group)
= render 'shared/group_form', f: f
- = render_if_exists 'shared/repository_size_limit_setting', form: f, type: :group
+ = render_if_exists 'shared/old_repository_size_limit_setting', form: f, type: :group
= render_if_exists 'admin/namespace_plan', f: f
.form-group.row.group-description-holder
diff --git a/app/views/admin/health_check/show.html.haml b/app/views/admin/health_check/show.html.haml
index 0f5e97e288a..ac56e354a4d 100644
--- a/app/views/admin/health_check/show.html.haml
+++ b/app/views/admin/health_check/show.html.haml
@@ -23,7 +23,7 @@
%code= liveness_url(token: Gitlab::CurrentSettings.health_check_access_token)
%li
%code= metrics_url(token: Gitlab::CurrentSettings.health_check_access_token)
-
+ = render_if_exists 'admin/health_check/health_check_url'
%hr
.card
.card-header
diff --git a/app/views/admin/projects/_projects.html.haml b/app/views/admin/projects/_projects.html.haml
index 5bc695aa7b5..9117f63f939 100644
--- a/app/views/admin/projects/_projects.html.haml
+++ b/app/views/admin/projects/_projects.html.haml
@@ -13,7 +13,7 @@
.stats
%span.badge.badge-pill
- = storage_counter(project.statistics.storage_size)
+ = storage_counter(project.statistics&.storage_size)
- if project.archived
%span.badge.badge-warning archived
.title
diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml
index f016a157daf..1e1ad9d5e19 100644
--- a/app/views/admin/projects/show.html.haml
+++ b/app/views/admin/projects/show.html.haml
@@ -74,10 +74,10 @@
%li
%span.light= _('Storage:')
- %strong= storage_counter(@project.statistics.storage_size)
- (
- = storage_counters_details(@project.statistics)
- )
+ %strong= storage_counter(@project.statistics&.storage_size)
+ - if @project.statistics
+ = surround '(', ')' do
+ = storage_counters_details(@project.statistics)
%li
%span.light last commit:
diff --git a/app/views/admin/users/_access_levels.html.haml b/app/views/admin/users/_access_levels.html.haml
index 12e24ddef02..98b6bc7bc46 100644
--- a/app/views/admin/users/_access_levels.html.haml
+++ b/app/views/admin/users/_access_levels.html.haml
@@ -22,6 +22,8 @@
%p.light
Regular users have access to their groups and projects
+ = render_if_exists 'admin/users/auditor_access_level_radio', f: f, disabled: editing_current_user
+
= f.radio_button :access_level, :admin, disabled: editing_current_user
= label_tag :admin, class: 'font-weight-bold' do
Admin
diff --git a/app/views/admin/users/_form.html.haml b/app/views/admin/users/_form.html.haml
index 296ef073144..0656feb79cb 100644
--- a/app/views/admin/users/_form.html.haml
+++ b/app/views/admin/users/_form.html.haml
@@ -48,6 +48,10 @@
= render partial: 'access_levels', locals: { f: f }
+ = render_if_exists 'admin/users/namespace_plan_fieldset', f: f
+
+ = render_if_exists 'admin/users/limits', f: f
+
%fieldset
%legend Profile
.form-group.row
@@ -73,6 +77,8 @@
= f.label :website_url, 'Website', class: 'col-form-label'
.col-sm-10= f.text_field :website_url, class: 'form-control'
+ = render_if_exists 'admin/users/admin_notes', f: f
+
.form-actions
- if @user.new_record?
= f.submit 'Create user', class: "btn btn-success"
diff --git a/app/views/admin/users/_head.html.haml b/app/views/admin/users/_head.html.haml
index a733f420d11..e7dde7985fd 100644
--- a/app/views/admin/users/_head.html.haml
+++ b/app/views/admin/users/_head.html.haml
@@ -6,6 +6,7 @@
%span.cred (Internal)
- if @user.admin
%span.cred (Admin)
+ = render_if_exists 'admin/users/audtior_user_badge'
.float-right
- if impersonation_enabled? && @user != current_user && @user.can?(:log_in)
diff --git a/app/views/award_emoji/_awards_block.html.haml b/app/views/award_emoji/_awards_block.html.haml
index 8d9c083d223..60ca7e4e267 100644
--- a/app/views/award_emoji/_awards_block.html.haml
+++ b/app/views/award_emoji/_awards_block.html.haml
@@ -13,7 +13,7 @@
%button.btn.award-control.has-tooltip.js-add-award{ type: 'button',
'aria-label': _('Add reaction'),
data: { title: _('Add reaction') } }
- %span{ class: "award-control-icon award-control-icon-neutral" }= custom_icon('emoji_slightly_smiling_face')
- %span{ class: "award-control-icon award-control-icon-positive" }= custom_icon('emoji_smiley')
- %span{ class: "award-control-icon award-control-icon-super-positive" }= custom_icon('emoji_smile')
+ %span{ class: "award-control-icon award-control-icon-neutral" }= sprite_icon('slight-smile')
+ %span{ class: "award-control-icon award-control-icon-positive" }= sprite_icon('smiley')
+ %span{ class: "award-control-icon award-control-icon-super-positive" }= sprite_icon('smile')
= icon('spinner spin', class: "award-control-icon award-control-icon-loading")
diff --git a/app/views/ci/variables/_variable_row.html.haml b/app/views/ci/variables/_variable_row.html.haml
index b4930b41c09..89bd7b31352 100644
--- a/app/views/ci/variables/_variable_row.html.haml
+++ b/app/views/ci/variables/_variable_row.html.haml
@@ -23,7 +23,7 @@
.ci-variable-row-body.border-bottom
%input.js-ci-variable-input-id{ type: "hidden", name: id_input_name, value: id }
%input.js-ci-variable-input-destroy{ type: "hidden", name: destroy_input_name }
- %select.js-ci-variable-input-variable-type.ci-variable-body-item.form-control.select-control.table-section.section-15{ name: variable_type_input_name }
+ %select.js-ci-variable-input-variable-type.ci-variable-body-item.form-control.select-control.custom-select.table-section.section-15{ name: variable_type_input_name }
= options_for_select(ci_variable_type_options, variable_type)
%input.js-ci-variable-input-key.ci-variable-body-item.qa-ci-variable-input-key.form-control.table-section.section-15{ type: "text",
name: key_input_name,
diff --git a/app/views/clusters/platforms/kubernetes/_form.html.haml b/app/views/clusters/platforms/kubernetes/_form.html.haml
index 8caa25a7b5e..c1727cf9079 100644
--- a/app/views/clusters/platforms/kubernetes/_form.html.haml
+++ b/app/views/clusters/platforms/kubernetes/_form.html.haml
@@ -1,7 +1,7 @@
= bootstrap_form_for cluster, url: update_cluster_url_path, html: { class: 'gl-show-field-errors' },
as: :cluster do |field|
- copy_name_btn = clipboard_button(text: cluster.name, title: s_('ClusterIntegration|Copy Kubernetes cluster name'),
- class: 'input-group-text btn-default') unless !cluster.read_only_kubernetes_platform_fields?
+ class: 'input-group-text btn-default') if cluster.read_only_kubernetes_platform_fields?
= field.text_field :name, class: 'js-select-on-focus cluster-name', required: true,
title: s_('ClusterIntegration|Cluster name is required.'),
readonly: cluster.read_only_kubernetes_platform_fields?,
@@ -10,7 +10,7 @@
= field.fields_for :platform_kubernetes, platform do |platform_field|
- copy_api_url = clipboard_button(text: platform.api_url, title: s_('ClusterIntegration|Copy API URL'),
- class: 'input-group-text btn-default') unless !cluster.read_only_kubernetes_platform_fields?
+ class: 'input-group-text btn-default') if cluster.read_only_kubernetes_platform_fields?
= platform_field.text_field :api_url, class: 'js-select-on-focus', required: true,
title: s_('ClusterIntegration|API URL should be a valid http/https url.'),
readonly: cluster.read_only_kubernetes_platform_fields?,
@@ -18,7 +18,7 @@
input_group_class: 'gl-field-error-anchor', append: copy_api_url
- copy_ca_cert_btn = clipboard_button(text: platform.ca_cert, title: s_('ClusterIntegration|Copy CA Certificate'),
- class: 'input-group-text btn-default') unless !cluster.read_only_kubernetes_platform_fields?
+ class: 'input-group-text btn-default') if cluster.read_only_kubernetes_platform_fields?
= platform_field.text_area :ca_cert, class: 'js-select-on-focus', rows: '5',
readonly: cluster.read_only_kubernetes_platform_fields?,
placeholder: s_('ClusterIntegration|Certificate Authority bundle (PEM format)'),
@@ -28,7 +28,7 @@
- show_token_btn = (platform_field.button s_('ClusterIntegration|Show'),
type: 'button', class: 'js-show-cluster-token btn btn-default')
- copy_token_btn = clipboard_button(text: platform.token, title: s_('ClusterIntegration|Copy Service Token'),
- class: 'input-group-text btn-default') unless !cluster.read_only_kubernetes_platform_fields?
+ class: 'input-group-text btn-default') if cluster.read_only_kubernetes_platform_fields?
= platform_field.text_field :token, type: 'password', class: 'js-select-on-focus js-cluster-token',
required: true, title: s_('ClusterIntegration|Service token is required.'),
diff --git a/app/views/dashboard/projects/_zero_authorized_projects.html.haml b/app/views/dashboard/projects/_zero_authorized_projects.html.haml
index 18a82feb189..8933c5d7227 100644
--- a/app/views/dashboard/projects/_zero_authorized_projects.html.haml
+++ b/app/views/dashboard/projects/_zero_authorized_projects.html.haml
@@ -1,4 +1,4 @@
-.blank-state-parent-container
+.blank-state-parent-container{ class: ('has-start-trial-container' if has_start_trial?) }
.section-container.section-welcome{ class: "#{ 'section-admin-welcome' if current_user.admin? }" }
.container.section-body
.row
@@ -7,7 +7,12 @@
Welcome to GitLab
%p.blank-state-text
Code, test, and deploy together
- - if current_user.admin?
- = render "blank_state_admin_welcome"
- - else
- = render "blank_state_welcome"
+ .blank-state-row
+ %div{ class: ('column-large' if has_start_trial?) }
+ - if current_user.admin?
+ = render "blank_state_admin_welcome"
+ - else
+ = render "blank_state_welcome"
+ - if has_start_trial?
+ .column-small
+ = render_if_exists "blank_state_ee_trial"
diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml
index 73e70dc63e5..f8aa3cf98dc 100644
--- a/app/views/devise/confirmations/new.html.haml
+++ b/app/views/devise/confirmations/new.html.haml
@@ -3,7 +3,7 @@
.login-body
= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post, class: 'gl-show-field-errors' }) do |f|
.devise-errors
- = devise_error_messages!
+ = render "devise/shared/error_messages", resource: resource
.form-group
= f.label :email
= f.email_field :email, class: "form-control", required: true, title: 'Please provide a valid email address.'
diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml
index dd1edb5fdc9..09ea7716a47 100644
--- a/app/views/devise/passwords/edit.html.haml
+++ b/app/views/devise/passwords/edit.html.haml
@@ -3,7 +3,7 @@
.login-body
= form_for(resource, as: resource_name, url: password_path(:user), html: { method: :put, class: 'gl-show-field-errors' }) do |f|
.devise-errors
- = devise_error_messages!
+ = render "devise/shared/error_messages", resource: resource
= f.hidden_field :reset_password_token
.form-group
= f.label 'New password', for: "user_password"
diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml
index 99ce13adf74..fe999851605 100644
--- a/app/views/devise/passwords/new.html.haml
+++ b/app/views/devise/passwords/new.html.haml
@@ -3,7 +3,7 @@
.login-body
= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post, class: 'gl-show-field-errors' }) do |f|
.devise-errors
- = devise_error_messages!
+ = render "devise/shared/error_messages", resource: resource
.form-group
= f.label :email
= f.email_field :email, class: "form-control", required: true, value: params[:user_email], autofocus: true, title: 'Please provide a valid email address.'
diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb
index f379e71ae5b..5a1388ac7a1 100644
--- a/app/views/devise/registrations/edit.html.erb
+++ b/app/views/devise/registrations/edit.html.erb
@@ -1,7 +1,7 @@
<h2>Edit <%= resource_name.to_s.humanize %></h2>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
- <%= devise_error_messages! %>
+ <%= render "devise/shared/error_messages", resource: resource %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
diff --git a/app/views/devise/shared/_signin_box.html.haml b/app/views/devise/shared/_signin_box.html.haml
index ec968e435cd..f8f36a8bfff 100644
--- a/app/views/devise/shared/_signin_box.html.haml
+++ b/app/views/devise/shared/_signin_box.html.haml
@@ -3,17 +3,21 @@
.login-box.tab-pane{ id: "crowd", role: 'tabpanel', class: active_when(form_based_auth_provider_has_active_class?(:crowd)) }
.login-body
= render 'devise/sessions/new_crowd'
+
+ = render_if_exists 'devise/sessions/new_kerberos_tab'
+
- @ldap_servers.each_with_index do |server, i|
.login-box.tab-pane{ id: "#{server['provider_name']}", role: 'tabpanel', class: active_when(i.zero? && form_based_auth_provider_has_active_class?(:ldapmain)) }
.login-body
= render 'devise/sessions/new_ldap', server: server
+
+ = render_if_exists 'devise/sessions/new_smartcard'
+
- if password_authentication_enabled_for_web?
.login-box.tab-pane{ id: 'login-pane', role: 'tabpanel' }
.login-body
= render 'devise/sessions/new_base'
- = render_if_exists 'devise/sessions/new_smartcard'
-
- elsif password_authentication_enabled_for_web?
.login-box.tab-pane.active{ id: 'login-pane', role: 'tabpanel' }
.login-body
diff --git a/app/views/devise/shared/_signup_box.html.haml b/app/views/devise/shared/_signup_box.html.haml
index 9c7ca6ebbd4..a7434059de4 100644
--- a/app/views/devise/shared/_signup_box.html.haml
+++ b/app/views/devise/shared/_signup_box.html.haml
@@ -2,7 +2,7 @@
.login-body
= form_for(resource, as: "new_#{resource_name}", url: registration_path(resource_name), html: { class: "new_new_user gl-show-field-errors", "aria-live" => "assertive" }) do |f|
.devise-errors
- = devise_error_messages!
+ = render "devise/shared/error_messages", resource: resource
.name.form-group
= f.label :name, 'Full name', class: 'label-bold'
= f.text_field :name, class: "form-control top qa-new-user-name js-block-emoji", required: true, title: _("This field is required.")
@@ -29,6 +29,7 @@
- terms_link = link_to s_("I accept the|Terms of Service and Privacy Policy"), terms_path, target: "_blank"
- accept_terms_label = _("I accept the %{terms_link}") % { terms_link: terms_link }
= accept_terms_label.html_safe
+ = render_if_exists 'devise/shared/email_opted_in', f: f
%div
- if Gitlab::Recaptcha.enabled?
= recaptcha_tags
diff --git a/app/views/devise/shared/_tabs_ldap.html.haml b/app/views/devise/shared/_tabs_ldap.html.haml
index aee05b6c81c..b1a9470cf1c 100644
--- a/app/views/devise/shared/_tabs_ldap.html.haml
+++ b/app/views/devise/shared/_tabs_ldap.html.haml
@@ -2,6 +2,7 @@
- if crowd_enabled?
%li.nav-item
= link_to "Crowd", "#crowd", class: "nav-link #{active_when(form_based_auth_provider_has_active_class?(:crowd))}", 'data-toggle' => 'tab'
+ = render_if_exists "devise/shared/kerberos_tab"
- @ldap_servers.each_with_index do |server, i|
%li.nav-item
= link_to server['label'], "##{server['provider_name']}", class: "nav-link #{active_when(i.zero? && form_based_auth_provider_has_active_class?(:ldapmain))} qa-ldap-tab", 'data-toggle' => 'tab'
diff --git a/app/views/devise/unlocks/new.html.haml b/app/views/devise/unlocks/new.html.haml
index b2f48a4e0bf..1167f1718d6 100644
--- a/app/views/devise/unlocks/new.html.haml
+++ b/app/views/devise/unlocks/new.html.haml
@@ -3,7 +3,7 @@
.login-body
= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post, class: 'gl-show-field-errors' }) do |f|
.devise-errors
- = devise_error_messages!
+ = render "devise/shared/error_messages", resource: resource
.form-group.append-bottom-20
= f.label :email
= f.email_field :email, class: 'form-control', autofocus: 'autofocus', autocapitalize: 'off', autocorrect: 'off', title: 'Please provide a valid email address.'
diff --git a/app/views/events/event/_push.html.haml b/app/views/events/event/_push.html.haml
index 69914fccc48..21c418cb0e4 100644
--- a/app/views/events/event/_push.html.haml
+++ b/app/views/events/event/_push.html.haml
@@ -32,7 +32,8 @@
- from_label = from
= link_to project_compare_path(project, from: from, to: event.commit_to) do
- Compare #{from_label}...#{truncate_sha(event.commit_to)}
+ %span Compare
+ %span.commit-sha #{from_label}...#{truncate_sha(event.commit_to)}
- if create_mr
%span
diff --git a/app/views/groups/group_members/_new_group_member.html.haml b/app/views/groups/group_members/_new_group_member.html.haml
index c8cdc2cc3e4..8b511f6866f 100644
--- a/app/views/groups/group_members/_new_group_member.html.haml
+++ b/app/views/groups/group_members/_new_group_member.html.haml
@@ -1,7 +1,7 @@
= form_for @group_member, url: group_group_members_path(@group), html: { class: 'users-project-form users-group-form' } do |f|
.row
.col-md-4.col-lg-6
- = users_select_tag(:user_ids, multiple: true, class: 'input-clamp', scope: :all, email_user: true)
+ = users_select_tag(:user_ids, group_member_select_options)
.form-text.text-muted.append-bottom-10
Search for members by name, username, or email, or invite new ones using their email address.
diff --git a/app/views/groups/settings/_general.html.haml b/app/views/groups/settings/_general.html.haml
index c382a1ed168..e12748666c8 100644
--- a/app/views/groups/settings/_general.html.haml
+++ b/app/views/groups/settings/_general.html.haml
@@ -17,17 +17,17 @@
= f.label :description, _('Group description (optional)'), class: 'label-bold'
= f.text_area :description, class: 'form-control', rows: 3, maxlength: 250
- = render_if_exists 'shared/repository_size_limit_setting', form: f, type: :group
+ = render_if_exists 'shared/repository_size_limit_setting', form: f, type: :group
- .form-group.prepend-top-default.append-bottom-20
- .avatar-container.rect-avatar.s90
- = group_icon(@group, alt: '', class: 'avatar group-avatar s90')
- = f.label :avatar, _('Group avatar'), class: 'label-bold d-block'
- = render 'shared/choose_avatar_button', f: f
- - if @group.avatar?
- %hr
- = link_to _('Remove avatar'), group_avatar_path(@group.to_param), data: { confirm: _('Avatar will be removed. Are you sure?')}, method: :delete, class: 'btn btn-link'
+ .form-group.prepend-top-default.append-bottom-20
+ .avatar-container.rect-avatar.s90
+ = group_icon(@group, alt: '', class: 'avatar group-avatar s90')
+ = f.label :avatar, _('Group avatar'), class: 'label-bold d-block'
+ = render 'shared/choose_avatar_button', f: f
+ - if @group.avatar?
+ %hr
+ = link_to _('Remove avatar'), group_avatar_path(@group.to_param), data: { confirm: _('Avatar will be removed. Are you sure?')}, method: :delete, class: 'btn btn-link'
- = render 'shared/visibility_level', f: f, visibility_level: @group.visibility_level, can_change_visibility_level: can_change_group_visibility_level?(@group), form_model: @group
+ = render 'shared/visibility_level', f: f, visibility_level: @group.visibility_level, can_change_visibility_level: can_change_group_visibility_level?(@group), form_model: @group
= f.submit _('Save changes'), class: 'btn btn-success mt-4 js-dirty-submit'
diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml
index 75e4dc46c9b..50933c7d434 100644
--- a/app/views/help/index.html.haml
+++ b/app/views/help/index.html.haml
@@ -5,8 +5,7 @@
%hr
%h1
- GitLab
- Community Edition
+ = default_brand_title
- if user_signed_in?
%span= link_to_version
= version_status_badge
diff --git a/app/views/help/ui.html.haml b/app/views/help/ui.html.haml
index 969df69aafb..cdc894ee5a0 100644
--- a/app/views/help/ui.html.haml
+++ b/app/views/help/ui.html.haml
@@ -70,7 +70,7 @@
.cover-title
John Smith
- .cover-desc
+ .cover-desc.cgray
= lorem
.cover-controls
diff --git a/app/views/import/github/new.html.haml b/app/views/import/github/new.html.haml
index cf32c5c9387..72e5934574a 100644
--- a/app/views/import/github/new.html.haml
+++ b/app/views/import/github/new.html.haml
@@ -22,6 +22,8 @@
= text_field_tag :personal_access_token, '', class: 'form-control append-right-8', placeholder: _('Personal Access Token'), size: 40
= submit_tag _('List your GitHub repositories'), class: 'btn btn-success'
+ = render_if_exists 'import/github/ci_cd_only'
+
- unless github_import_configured?
%hr
%p
diff --git a/app/views/issues/_issue.atom.builder b/app/views/issues/_issue.atom.builder
index 21cf6d0dd65..94c32df7c60 100644
--- a/app/views/issues/_issue.atom.builder
+++ b/app/views/issues/_issue.atom.builder
@@ -12,6 +12,7 @@ xml.entry do
xml.summary issue.title
xml.description issue.description if issue.description
+ xml.content issue.description if issue.description
xml.milestone issue.milestone.title if issue.milestone
xml.due_date issue.due_date if issue.due_date
diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml
index 11e83ddfe64..c357207054b 100644
--- a/app/views/layouts/_head.html.haml
+++ b/app/views/layouts/_head.html.haml
@@ -77,3 +77,4 @@
= render 'layouts/google_analytics' if extra_config.has_key?('google_analytics_id')
= render 'layouts/piwik' if extra_config.has_key?('piwik_url') && extra_config.has_key?('piwik_site_id')
+ = render_if_exists 'layouts/snowplow'
diff --git a/app/views/layouts/_mailer.html.haml b/app/views/layouts/_mailer.html.haml
index e13490ed410..6e8294d6adc 100644
--- a/app/views/layouts/_mailer.html.haml
+++ b/app/views/layouts/_mailer.html.haml
@@ -64,6 +64,8 @@
%tbody
= yield
+ = render_if_exists 'layouts/mailer/additional_text'
+
%tr.footer
%td{ style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding:25px 0;font-size:13px;line-height:1.6;color:#5c5c5c;" }
%img{ alt: "GitLab", height: "33", src: image_url('mailers/gitlab_footer_logo.gif'), style: "display:block;margin:0 auto 1em;", width: "90" }/
diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml
index 26a1f1e119c..006334ade07 100644
--- a/app/views/layouts/_page.html.haml
+++ b/app/views/layouts/_page.html.haml
@@ -5,6 +5,7 @@
= render 'shared/outdated_browser'
.mobile-overlay
.alert-wrapper
+ = render_if_exists "layouts/header/ee_license_banner"
= render "layouts/broadcast"
= render "layouts/header/read_only_banner"
= render "layouts/nav/classification_level_banner"
diff --git a/app/views/layouts/devise.html.haml b/app/views/layouts/devise.html.haml
index 2f3c13aaf6e..f7a561afbb3 100644
--- a/app/views/layouts/devise.html.haml
+++ b/app/views/layouts/devise.html.haml
@@ -26,6 +26,9 @@
- if Gitlab::CurrentSettings.sign_in_text.present?
= markdown_field(Gitlab::CurrentSettings.current_application_settings, :sign_in_text)
+
+ = render_if_exists 'layouts/devise_help_text'
+
.col-sm-5.new-session-forms-container
= yield
diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml
index 724c9976954..f8b7d0c530a 100644
--- a/app/views/layouts/header/_default.html.haml
+++ b/app/views/layouts/header/_default.html.haml
@@ -18,8 +18,9 @@
%span.logo-text.d-none.d-lg-block.prepend-left-8
= logo_text
- if Gitlab.com?
- %span.js-canary-badge.badge.badge-pill.green-badge.align-self-center
- = _('Next')
+ = link_to 'https://next.gitlab.com', class: 'label-link js-canary-badge canary-badge bg-transparent hidden', target: :_blank do
+ %span.color-label.has-tooltip.badge.badge-pill.green-badge
+ = _('Next')
- if current_user
= render "layouts/nav/dashboard"
diff --git a/app/views/layouts/header/_help_dropdown.html.haml b/app/views/layouts/header/_help_dropdown.html.haml
index fbec62b02f8..5643a508ddc 100644
--- a/app/views/layouts/header/_help_dropdown.html.haml
+++ b/app/views/layouts/header/_help_dropdown.html.haml
@@ -8,6 +8,7 @@
= link_to _("Submit feedback"), "https://about.gitlab.com/submit-feedback"
- if current_user_menu?(:help) || current_user_menu?(:settings) || current_user_menu?(:profile)
= render 'shared/user_dropdown_contributing_link'
+ = render_if_exists 'shared/user_dropdown_instance_review'
- if Gitlab.com?
%li.js-canary-link
= link_to _("Switch to GitLab Next"), "https://next.gitlab.com/"
diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb
index f8032f3262b..1a06ea68bcd 100644
--- a/app/views/layouts/mailer.text.erb
+++ b/app/views/layouts/mailer.text.erb
@@ -4,5 +4,6 @@
-- <%# signature marker %>
<%= _("You're receiving this email because of your account on %{host}.") % { host: Gitlab.config.gitlab.host } %>
+<%= render_if_exists 'layouts/mailer/additional_text' %>
<%= text_footer_message %>
diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml
index 5a27237bf76..47710b9e9e5 100644
--- a/app/views/layouts/nav/_dashboard.html.haml
+++ b/app/views/layouts/nav/_dashboard.html.haml
@@ -95,3 +95,4 @@
= link_to sherlock_transactions_path, class: 'admin-icon d-none d-lg-block d-xl-block', title: _('Sherlock Transactions'),
data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
= icon('tachometer fw')
+ = render_if_exists 'layouts/nav/geo_primary_node_url'
diff --git a/app/views/layouts/nav/sidebar/_admin.html.haml b/app/views/layouts/nav/sidebar/_admin.html.haml
index 04d67e024ba..83fe871285a 100644
--- a/app/views/layouts/nav/sidebar/_admin.html.haml
+++ b/app/views/layouts/nav/sidebar/_admin.html.haml
@@ -48,7 +48,7 @@
%span
= _('Gitaly Servers')
- = nav_link(controller: %w(system_info background_jobs logs health_check requests_profiles)) do
+ = nav_link(controller: admin_monitoring_nav_links) do
= link_to admin_system_info_path do
.nav-icon-container
= sprite_icon('monitor')
@@ -81,6 +81,7 @@
= link_to admin_requests_profiles_path, title: _('Requests Profiles') do
%span
= _('Requests Profiles')
+ = render_if_exists 'layouts/nav/ee/admin/new_monitoring_sidebar'
= nav_link(controller: :broadcast_messages) do
= link_to admin_broadcast_messages_path do
@@ -132,6 +133,8 @@
= _('Abuse Reports')
%span.badge.badge-pill.count.merge_counter.js-merge-counter.fly-out-badge= number_with_delimiter(AbuseReport.count(:all))
+ = render_if_exists 'layouts/nav/sidebar/licenses_link'
+
- if instance_clusters_enabled?
= nav_link(controller: :clusters) do
= link_to admin_clusters_path do
@@ -158,6 +161,10 @@
%strong.fly-out-top-item-name
= _('Spam Logs')
+ = render_if_exists 'layouts/nav/sidebar/push_rules_link'
+
+ = render_if_exists 'layouts/nav/ee/admin/geo_sidebar'
+
= nav_link(controller: :deploy_keys) do
= link_to admin_deploy_keys_path do
.nav-icon-container
diff --git a/app/views/layouts/nav/sidebar/_group.html.haml b/app/views/layouts/nav/sidebar/_group.html.haml
index c2116ec63dd..0fc5ebbea7e 100644
--- a/app/views/layouts/nav/sidebar/_group.html.haml
+++ b/app/views/layouts/nav/sidebar/_group.html.haml
@@ -1,6 +1,5 @@
- issues_count = group_issues_count(state: 'opened')
- merge_requests_count = group_merge_requests_count(state: 'opened')
-- issues_sub_menu_items = ['groups#issues', 'labels#index', 'milestones#index', 'boards#index', 'boards#show']
.nav-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?) }
.nav-sidebar-inner-scroll
@@ -51,7 +50,7 @@
= render_if_exists "layouts/nav/ee/epic_link", group: @group
- if group_sidebar_link?(:issues)
- = nav_link(path: issues_sub_menu_items) do
+ = nav_link(path: group_issues_sub_menu_items) do
= link_to issues_group_path(@group) do
.nav-icon-container
= sprite_icon('issues')
diff --git a/app/views/layouts/nav/sidebar/_profile.html.haml b/app/views/layouts/nav/sidebar/_profile.html.haml
index 2061eac917f..7dd33f3c641 100644
--- a/app/views/layouts/nav/sidebar/_profile.html.haml
+++ b/app/views/layouts/nav/sidebar/_profile.html.haml
@@ -28,6 +28,8 @@
= link_to profile_account_path do
%strong.fly-out-top-item-name
= _('Account')
+
+ = render_if_exists 'layouts/nav/sidebar/profile_billing_link'
= nav_link(controller: 'oauth/applications') do
= link_to applications_profile_path do
.nav-icon-container
@@ -151,4 +153,6 @@
%strong.fly-out-top-item-name
= _('Authentication Log')
+ = render_if_exists 'layouts/nav/sidebar/profile_pipeline_quota_link'
+
= render 'shared/sidebar_toggle_button'
diff --git a/app/views/layouts/nav/sidebar/_project.html.haml b/app/views/layouts/nav/sidebar/_project.html.haml
index 3a0c2b9c284..399305baec1 100644
--- a/app/views/layouts/nav/sidebar/_project.html.haml
+++ b/app/views/layouts/nav/sidebar/_project.html.haml
@@ -270,6 +270,8 @@
%span= _("Got it!")
= sprite_icon('thumb-up')
+ = render_if_exists 'layouts/nav/sidebar/project_feature_flags_link'
+
- if project_nav_tab? :container_registry
= nav_link(controller: %w[projects/registry/repositories]) do
= link_to project_container_registry_index_path(@project), class: 'shortcuts-container-registry' do
@@ -283,7 +285,9 @@
%strong.fly-out-top-item-name
= _('Registry')
- - if project_nav_tab?(:wiki)
+ = render_if_exists 'layouts/nav/sidebar/project_packages_link'
+
+ - if project_nav_tab? :wiki
- wiki_url = project_wiki_path(@project, :home)
= nav_link(controller: :wikis) do
= link_to wiki_url, class: 'shortcuts-wiki qa-wiki-link' do
diff --git a/app/views/layouts/notify.html.haml b/app/views/layouts/notify.html.haml
index 8dff12c1b7f..de487a94d40 100644
--- a/app/views/layouts/notify.html.haml
+++ b/app/views/layouts/notify.html.haml
@@ -31,4 +31,6 @@
adjust your notification settings.
= email_action @target_url
+
+ = render_if_exists 'layouts/email_additional_text'
= html_footer_message
diff --git a/app/views/layouts/notify.text.erb b/app/views/layouts/notify.text.erb
index 248916fba63..0ee30c2a6cf 100644
--- a/app/views/layouts/notify.text.erb
+++ b/app/views/layouts/notify.text.erb
@@ -12,5 +12,6 @@
<% end -%>
<%= "You're receiving this email because #{notification_reason_text(@reason)}." %>
+<%= render_if_exists 'layouts/mailer/additional_text' %>
<%= text_footer_message -%>
diff --git a/app/views/notify/closed_issue_email.html.haml b/app/views/notify/closed_issue_email.html.haml
index eb148d72da1..f21cf1ad34b 100644
--- a/app/views/notify/closed_issue_email.html.haml
+++ b/app/views/notify/closed_issue_email.html.haml
@@ -1,2 +1,2 @@
%p
- Issue was closed by #{sanitize_name(@updated_by.name)}
+ Issue was closed by #{sanitize_name(@updated_by.name)} #{closure_reason_text(@closed_via, format: formats.first)}.
diff --git a/app/views/notify/closed_issue_email.text.haml b/app/views/notify/closed_issue_email.text.haml
index b1f0a3f37ec..5567adc9165 100644
--- a/app/views/notify/closed_issue_email.text.haml
+++ b/app/views/notify/closed_issue_email.text.haml
@@ -1,3 +1,3 @@
-Issue was closed by #{sanitize_name(@updated_by.name)}
+Issue was closed by #{sanitize_name(@updated_by.name)} #{closure_reason_text(@closed_via, format: formats.first)}.
Issue ##{@issue.iid}: #{project_issue_url(@issue.project, @issue)}
diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml
index 917e7acc353..e36d5192a29 100644
--- a/app/views/profiles/show.html.haml
+++ b/app/views/profiles/show.html.haml
@@ -47,9 +47,9 @@
- if @user.status
= emoji_icon @user.status.emoji
%span#js-no-emoji-placeholder.no-emoji-placeholder{ class: ('hidden' if @user.status) }
- = sprite_icon('emoji_slightly_smiling_face', css_class: 'award-control-icon-neutral')
- = sprite_icon('emoji_smiley', css_class: 'award-control-icon-positive')
- = sprite_icon('emoji_smile', css_class: 'award-control-icon-super-positive')
+ = sprite_icon('slight-smile', css_class: 'award-control-icon-neutral')
+ = sprite_icon('smiley', css_class: 'award-control-icon-positive')
+ = sprite_icon('smile', css_class: 'award-control-icon-super-positive')
- reset_message_button = button_tag type: :button,
id: 'js-clear-user-status-button',
class: 'clear-user-status btn has-tooltip',
diff --git a/app/views/projects/_files.html.haml b/app/views/projects/_files.html.haml
index 22a721ee9ad..0edd8ee5e46 100644
--- a/app/views/projects/_files.html.haml
+++ b/app/views/projects/_files.html.haml
@@ -4,6 +4,7 @@
- project = local_assigns.fetch(:project) { @project }
- content_url = local_assigns.fetch(:content_url) { @tree.readme ? project_blob_path(@project, tree_join(@ref, @tree.readme.path)) : project_tree_path(@project, @ref) }
- show_auto_devops_callout = show_auto_devops_callout?(@project)
+- vue_file_list = Feature.enabled?(:vue_file_list, @project)
#tree-holder.tree-holder.clearfix
.nav-block
@@ -13,7 +14,12 @@
= render 'shared/commit_well', commit: commit, ref: ref, project: project
- if is_project_overview
- .project-buttons.append-bottom-default
+ .project-buttons.append-bottom-default{ class: ("js-hide-on-navigation" if vue_file_list) }
= render 'stat_anchor_list', anchors: @project.statistics_buttons(show_auto_devops_callout: show_auto_devops_callout)
- = render 'projects/tree/tree_content', tree: @tree, content_url: content_url
+ - if vue_file_list
+ #js-tree-list{ data: { project_path: @project.full_path, ref: ref } }
+ - if @tree.readme
+ = render "projects/tree/readme", readme: @tree.readme
+ - else
+ = render 'projects/tree/tree_content', tree: @tree, content_url: content_url
diff --git a/app/views/projects/_flash_messages.html.haml b/app/views/projects/_flash_messages.html.haml
index b72f0e39b23..b2dab0b5348 100644
--- a/app/views/projects/_flash_messages.html.haml
+++ b/app/views/projects/_flash_messages.html.haml
@@ -7,3 +7,4 @@
= render 'shared/no_password'
- unless project.empty_repo?
= render 'shared/auto_devops_implicitly_enabled_banner', project: project
+ = render_if_exists 'projects/above_size_limit_warning', project: project
diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml
index 3ca4abddbb8..a97322dace4 100644
--- a/app/views/projects/_home_panel.html.haml
+++ b/app/views/projects/_home_panel.html.haml
@@ -1,7 +1,7 @@
- empty_repo = @project.empty_repo?
- show_auto_devops_callout = show_auto_devops_callout?(@project)
- max_project_topic_length = 15
-.project-home-panel{ class: ("empty-project" if empty_repo) }
+.project-home-panel{ class: [("empty-project" if empty_repo), ("js-hide-on-navigation" if Feature.enabled?(:vue_file_list, @project))] }
.row.append-bottom-8
.home-panel-title-row.col-md-12.col-lg-6.d-flex
.avatar-container.rect-avatar.s64.home-panel-avatar.append-right-default.float-none
diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml
index 0e15f581ddc..1074cd6bf4e 100644
--- a/app/views/projects/branches/_branch.html.haml
+++ b/app/views/projects/branches/_branch.html.haml
@@ -22,6 +22,8 @@
%span.badge.badge-success.prepend-left-5
= s_('Branches|protected')
+ = render_if_exists 'projects/branches/diverged_from_upstream'
+
.block-truncated
- if commit
= render 'projects/branches/commit', commit: commit, project: @project
diff --git a/app/views/projects/branches/index.html.haml b/app/views/projects/branches/index.html.haml
index 43f1cd01b67..d270e461ac8 100644
--- a/app/views/projects/branches/index.html.haml
+++ b/app/views/projects/branches/index.html.haml
@@ -1,5 +1,6 @@
- @no_container = true
- page_title _('Branches')
+- add_to_breadcrumbs(_('Repository'), project_tree_path(@project))
%div{ class: container_class }
.top-area.adjust
@@ -44,6 +45,8 @@
= link_to new_project_branch_path(@project), class: 'btn btn-success' do
= s_('Branches|New branch')
+ = render_if_exists 'projects/commits/mirror_status'
+
- if can?(current_user, :admin_project, @project)
- project_settings_link = link_to s_('Branches|project settings'), project_protected_branches_path(@project)
.row-content-block
diff --git a/app/views/projects/buttons/_download_links.html.haml b/app/views/projects/buttons/_download_links.html.haml
index 7f2cd8e109e..d344167a6c5 100644
--- a/app/views/projects/buttons/_download_links.html.haml
+++ b/app/views/projects/buttons/_download_links.html.haml
@@ -1,5 +1,5 @@
- formats = [['zip', 'btn-primary'], ['tar.gz'], ['tar.bz2'], ['tar']]
-.d-flex.justify-content-between
+.btn-group.ml-0.w-100
- formats.each do |(fmt, extra_class)|
= link_to fmt, project_archive_path(project, id: tree_join(ref, archive_prefix), path: path, format: fmt), rel: 'nofollow', download: '', class: "btn btn-xs #{extra_class}"
diff --git a/app/views/projects/commits/_commit.html.haml b/app/views/projects/commits/_commit.html.haml
index e2d078855d9..771e1881e94 100644
--- a/app/views/projects/commits/_commit.html.haml
+++ b/app/views/projects/commits/_commit.html.haml
@@ -9,6 +9,9 @@
- commit_status = commit.present(current_user: current_user).status_for(ref)
- link = commit_path(project, commit, merge_request: merge_request)
+
+- show_project_name = local_assigns.fetch(:show_project_name, false)
+
%li.commit.flex-row.js-toggle-container{ id: "commit-#{commit.short_id}" }
.avatar-cell.d-none.d-sm-block
@@ -32,6 +35,7 @@
- commit_timeago = time_ago_with_tooltip(commit.authored_date, placement: 'bottom')
- commit_text = _('%{commit_author_link} authored %{commit_timeago}') % { commit_author_link: commit_author_link, commit_timeago: commit_timeago }
#{ commit_text.html_safe }
+ = render_if_exists 'projects/commits/project_namespace', show_project_name: show_project_name, project: project
- if commit.description?
%pre.commit-row-description.js-toggle-content.append-bottom-8
diff --git a/app/views/projects/commits/show.html.haml b/app/views/projects/commits/show.html.haml
index 9d254463fb6..2db1efdd52f 100644
--- a/app/views/projects/commits/show.html.haml
+++ b/app/views/projects/commits/show.html.haml
@@ -30,6 +30,8 @@
= link_to project_commits_path(@project, @ref, rss_url_options), title: _("Commits feed"), class: 'btn' do
= icon("rss")
+ = render_if_exists 'projects/commits/mirror_status'
+
%div{ id: dom_id(@project) }
%ol#commits-list.list-unstyled.content_list
= render 'commits', project: @project, ref: @ref
diff --git a/app/views/projects/diffs/_content.html.haml b/app/views/projects/diffs/_content.html.haml
index 68f74f702ea..590fcdb0234 100644
--- a/app/views/projects/diffs/_content.html.haml
+++ b/app/views/projects/diffs/_content.html.haml
@@ -1,2 +1,2 @@
.diff-content
- = render 'projects/diffs/viewer', viewer: diff_file.rich_viewer || diff_file.simple_viewer
+ = render 'projects/diffs/viewer', viewer: diff_file.viewer
diff --git a/app/views/projects/mirrors/_mirror_repos.html.haml b/app/views/projects/mirrors/_mirror_repos.html.haml
index 73e2a4ffb8b..e68fa5d08c7 100644
--- a/app/views/projects/mirrors/_mirror_repos.html.haml
+++ b/app/views/projects/mirrors/_mirror_repos.html.haml
@@ -29,7 +29,7 @@
.form-check.append-bottom-10
= check_box_tag :only_protected_branches, '1', false, class: 'js-mirror-protected form-check-input'
= label_tag :only_protected_branches, _('Only mirror protected branches'), class: 'form-check-label'
- = link_to icon('question-circle'), help_page_path('user/project/protected_branches')
+ = link_to icon('question-circle'), help_page_path('user/project/protected_branches'), target: '_blank'
.panel-footer
= f.submit _('Mirror repository'), class: 'btn btn-success js-mirror-submit qa-mirror-repository-button', name: :update_remote_mirror
diff --git a/app/views/projects/notes/_actions.html.haml b/app/views/projects/notes/_actions.html.haml
index eb6838cec8d..044adb75bea 100644
--- a/app/views/projects/notes/_actions.html.haml
+++ b/app/views/projects/notes/_actions.html.haml
@@ -41,9 +41,9 @@
.note-actions-item
= button_tag title: 'Add reaction', class: "note-action-button note-emoji-button js-add-award js-note-emoji} has-tooltip btn btn-transparent", data: { position: 'right', container: 'body' } do
= icon('spinner spin')
- %span{ class: 'link-highlight award-control-icon-neutral' }= custom_icon('emoji_slightly_smiling_face')
- %span{ class: 'link-highlight award-control-icon-positive' }= custom_icon('emoji_smiley')
- %span{ class: 'link-highlight award-control-icon-super-positive' }= custom_icon('emoji_smile')
+ %span{ class: 'link-highlight award-control-icon-neutral' }= sprite_icon('slight-smile')
+ %span{ class: 'link-highlight award-control-icon-positive' }= sprite_icon('smiley')
+ %span{ class: 'link-highlight award-control-icon-super-positive' }= sprite_icon('smile')
- if note_editable
.note-actions-item
diff --git a/app/views/projects/project_members/_new_project_member.html.haml b/app/views/projects/project_members/_new_project_member.html.haml
index 0590578c3fe..efabb7f7b19 100644
--- a/app/views/projects/project_members/_new_project_member.html.haml
+++ b/app/views/projects/project_members/_new_project_member.html.haml
@@ -19,4 +19,5 @@
= text_field_tag :expires_at, nil, class: 'form-control js-access-expiration-date', placeholder: 'Expiration date'
%i.clear-icon.js-clear-input
= f.submit _("Add to project"), class: "btn btn-success qa-add-member-button"
- = link_to _("Import"), import_project_project_members_path(@project), class: "btn btn-default", title: _("Import members from another project")
+ - if can_import_members?
+ = link_to _("Import"), import_project_project_members_path(@project), class: "btn btn-default", title: _("Import members from another project")
diff --git a/app/views/projects/protected_branches/_protected_branch.html.haml b/app/views/projects/protected_branches/_protected_branch.html.haml
index b12ae995ece..366d7a7a2eb 100644
--- a/app/views/projects/protected_branches/_protected_branch.html.haml
+++ b/app/views/projects/protected_branches/_protected_branch.html.haml
@@ -1,2 +1,2 @@
= render layout: 'projects/protected_branches/shared/protected_branch', locals: { protected_branch: protected_branch } do
- = render partial: 'projects/protected_branches/update_protected_branch', locals: { protected_branch: protected_branch }
+ = render_if_exists 'projects/protected_branches/update_protected_branch', protected_branch: protected_branch
diff --git a/app/views/projects/settings/_general.html.haml b/app/views/projects/settings/_general.html.haml
index 380430ff52b..520f342f567 100644
--- a/app/views/projects/settings/_general.html.haml
+++ b/app/views/projects/settings/_general.html.haml
@@ -27,7 +27,7 @@
.row= render_if_exists 'projects/classification_policy_settings', f: f
- .row= render_if_exists 'shared/repository_size_limit_setting', form: f, type: :project
+ = render_if_exists 'shared/repository_size_limit_setting', form: f, type: :project
.form-group.prepend-top-default.append-bottom-20
.avatar-container.s90
diff --git a/app/views/projects/tree/_readme.html.haml b/app/views/projects/tree/_readme.html.haml
index 4daacbe157c..e935af23659 100644
--- a/app/views/projects/tree/_readme.html.haml
+++ b/app/views/projects/tree/_readme.html.haml
@@ -1,5 +1,5 @@
- if readme.rich_viewer
- %article.file-holder.readme-holder{ id: 'readme', class: ("limited-width-container" unless fluid_layout) }
+ %article.file-holder.readme-holder{ id: 'readme', class: [("limited-width-container" unless fluid_layout), ("js-hide-on-navigation" if Feature.enabled?(:vue_file_list, @project))] }
.js-file-title.file-title
= blob_icon readme.mode, readme.name
= link_to project_blob_path(@project, tree_join(@ref, readme.path)) do
diff --git a/app/views/shared/_clone_panel.html.haml b/app/views/shared/_clone_panel.html.haml
index a2df0347fd6..1e509ea0d1f 100644
--- a/app/views/shared/_clone_panel.html.haml
+++ b/app/views/shared/_clone_panel.html.haml
@@ -16,7 +16,12 @@
= ssh_clone_button(project)
%li
= http_clone_button(project)
+ = render_if_exists 'shared/kerberos_clone_button', project: project
= text_field_tag :project_clone, default_url_to_repo(project), class: "js-select-on-focus form-control", readonly: true, aria: { label: 'Project clone URL' }
.input-group-append
= clipboard_button(target: '#project_clone', title: _("Copy URL to clipboard"), class: "input-group-text btn-default btn-clipboard")
+
+ = render_if_exists 'shared/geo_modal_button'
+
+= render_if_exists 'shared/geo_modal', project: project
diff --git a/app/views/shared/_import_form.html.haml b/app/views/shared/_import_form.html.haml
index 7b593ca4f76..3ee713cf499 100644
--- a/app/views/shared/_import_form.html.haml
+++ b/app/views/shared/_import_form.html.haml
@@ -18,3 +18,6 @@
= import_will_timeout_message(ci_cd_only)
%li
= import_svn_message(ci_cd_only)
+ = render_if_exists 'shared/ci_cd_only_link', ci_cd_only: ci_cd_only
+
+= render_if_exists 'shared/ee/import_form', f: f, ci_cd_only: ci_cd_only
diff --git a/app/views/shared/_label_row.html.haml b/app/views/shared/_label_row.html.haml
index a1aab2e6a08..af11ce94ec5 100644
--- a/app/views/shared/_label_row.html.haml
+++ b/app/views/shared/_label_row.html.haml
@@ -22,3 +22,4 @@
&middot;
%li.label-link-item.priority-badge.js-priority-badge.inline.prepend-left-10
.label-badge.label-badge-blue= _('Prioritized label')
+ = render_if_exists 'shared/label_row_epics_link', label: label
diff --git a/app/views/shared/_mini_pipeline_graph.html.haml b/app/views/shared/_mini_pipeline_graph.html.haml
index b46479d9f1a..a1f21c2a83e 100644
--- a/app/views/shared/_mini_pipeline_graph.html.haml
+++ b/app/views/shared/_mini_pipeline_graph.html.haml
@@ -13,5 +13,5 @@
%ul
%li.js-builds-dropdown-loading.hidden
- .text-center
- %i.fa.fa-spinner.fa-spin{ 'aria-hidden': 'true', 'aria-label': 'Loading' }
+ .loading-container.text-center
+ %span.spinner{ 'aria-label': 'Loading' }
diff --git a/app/views/shared/icons/_emoji_slightly_smiling_face.svg b/app/views/shared/icons/_emoji_slightly_smiling_face.svg
deleted file mode 100644
index 56dbad91554..00000000000
--- a/app/views/shared/icons/_emoji_slightly_smiling_face.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"><path d="M13.29 11.098a4.328 4.328 0 0 1-1.618 2.285c-.79.578-1.68.867-2.672.867-.992 0-1.883-.29-2.672-.867a4.328 4.328 0 0 1-1.617-2.285.721.721 0 0 1 .047-.569.715.715 0 0 1 .445-.369.721.721 0 0 1 .568.047.715.715 0 0 1 .37.445c.195.625.556 1.131 1.084 1.518A2.93 2.93 0 0 0 9 12.75a2.93 2.93 0 0 0 1.775-.58 2.913 2.913 0 0 0 1.084-1.518.711.711 0 0 1 .375-.445.737.737 0 0 1 .575-.047c.195.063.34.186.433.37.094.183.11.372.047.568zM7.5 6c0 .414-.146.768-.44 1.06-.292.294-.646.44-1.06.44-.414 0-.768-.146-1.06-.44A1.445 1.445 0 0 1 4.5 6c0-.414.146-.768.44-1.06.292-.294.646-.44 1.06-.44.414 0 .768.146 1.06.44.294.292.44.646.44 1.06zm6 0c0 .414-.146.768-.44 1.06-.292.294-.646.44-1.06.44-.414 0-.768-.146-1.06-.44A1.445 1.445 0 0 1 10.5 6c0-.414.146-.768.44-1.06.292-.294.646-.44 1.06-.44.414 0 .768.146 1.06.44.294.292.44.646.44 1.06zm3 3a7.29 7.29 0 0 0-.598-2.912 7.574 7.574 0 0 0-1.6-2.39 7.574 7.574 0 0 0-2.39-1.6A7.29 7.29 0 0 0 9 1.5a7.29 7.29 0 0 0-2.912.598 7.574 7.574 0 0 0-2.39 1.6 7.574 7.574 0 0 0-1.6 2.39A7.29 7.29 0 0 0 1.5 9c0 1.016.2 1.986.598 2.912a7.574 7.574 0 0 0 1.6 2.39 7.574 7.574 0 0 0 2.39 1.6A7.29 7.29 0 0 0 9 16.5a7.29 7.29 0 0 0 2.912-.598 7.574 7.574 0 0 0 2.39-1.6 7.574 7.574 0 0 0 1.6-2.39A7.29 7.29 0 0 0 16.5 9zM18 9a8.804 8.804 0 0 1-1.207 4.518 8.96 8.96 0 0 1-3.275 3.275A8.804 8.804 0 0 1 9 18a8.804 8.804 0 0 1-4.518-1.207 8.96 8.96 0 0 1-3.275-3.275A8.804 8.804 0 0 1 0 9c0-1.633.402-3.139 1.207-4.518a8.96 8.96 0 0 1 3.275-3.275A8.804 8.804 0 0 1 9 0c1.633 0 3.139.402 4.518 1.207a8.96 8.96 0 0 1 3.275 3.275A8.804 8.804 0 0 1 18 9z" fill-rule="evenodd"/></svg>
diff --git a/app/views/shared/icons/_emoji_smile.svg b/app/views/shared/icons/_emoji_smile.svg
deleted file mode 100644
index ce645fee46f..00000000000
--- a/app/views/shared/icons/_emoji_smile.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"><path d="M13.29 11.098a4.328 4.328 0 0 1-1.618 2.285c-.79.578-1.68.867-2.672.867-.992 0-1.883-.29-2.672-.867a4.328 4.328 0 0 1-1.617-2.285.721.721 0 0 1 .047-.569.715.715 0 0 1 .445-.369c.195-.062 7.41-.062 7.606 0 .195.063.34.186.433.37.094.183.11.372.047.568zM14 6.37c0 .398-.04.755-.513.755-.473 0-.498-.272-1.237-.272-.74 0-.74.215-1.165.215-.425 0-.585-.3-.585-.698 0-.397.17-.736.513-1.017.341-.281.754-.422 1.237-.422.483 0 .896.14 1.237.422.342.28.513.62.513 1.017zm-6.5 0c0 .398-.04.755-.513.755-.473 0-.498-.272-1.237-.272-.74 0-.74.215-1.165.215-.425 0-.585-.3-.585-.698 0-.397.17-.736.513-1.017.341-.281.754-.422 1.237-.422.483 0 .896.14 1.237.422.342.28.513.62.513 1.017zm9 2.63a7.29 7.29 0 0 0-.598-2.912 7.574 7.574 0 0 0-1.6-2.39 7.574 7.574 0 0 0-2.39-1.6A7.29 7.29 0 0 0 9 1.5a7.29 7.29 0 0 0-2.912.598 7.574 7.574 0 0 0-2.39 1.6 7.574 7.574 0 0 0-1.6 2.39A7.29 7.29 0 0 0 1.5 9c0 1.016.2 1.986.598 2.912a7.574 7.574 0 0 0 1.6 2.39 7.574 7.574 0 0 0 2.39 1.6A7.29 7.29 0 0 0 9 16.5a7.29 7.29 0 0 0 2.912-.598 7.574 7.574 0 0 0 2.39-1.6 7.574 7.574 0 0 0 1.6-2.39A7.29 7.29 0 0 0 16.5 9zM18 9a8.804 8.804 0 0 1-1.207 4.518 8.96 8.96 0 0 1-3.275 3.275A8.804 8.804 0 0 1 9 18a8.804 8.804 0 0 1-4.518-1.207 8.96 8.96 0 0 1-3.275-3.275A8.804 8.804 0 0 1 0 9c0-1.633.402-3.139 1.207-4.518a8.96 8.96 0 0 1 3.275-3.275A8.804 8.804 0 0 1 9 0c1.633 0 3.139.402 4.518 1.207a8.96 8.96 0 0 1 3.275 3.275A8.804 8.804 0 0 1 18 9z" fill-rule="evenodd"/></svg>
diff --git a/app/views/shared/icons/_emoji_smiley.svg b/app/views/shared/icons/_emoji_smiley.svg
deleted file mode 100644
index ddfae50e566..00000000000
--- a/app/views/shared/icons/_emoji_smiley.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"><path d="M13.29 11.098a4.328 4.328 0 0 1-1.618 2.285c-.79.578-1.68.867-2.672.867-.992 0-1.883-.29-2.672-.867a4.328 4.328 0 0 1-1.617-2.285.721.721 0 0 1 .047-.569.715.715 0 0 1 .445-.369c.195-.062 7.41-.062 7.606 0 .195.063.34.186.433.37.094.183.11.372.047.568h.001zM7.5 6c0 .414-.146.768-.44 1.06A1.44 1.44 0 0 1 6 7.5a1.44 1.44 0 0 1-1.06-.44A1.445 1.445 0 0 1 4.5 6c0-.414.146-.768.44-1.06A1.44 1.44 0 0 1 6 4.5c.414 0 .768.146 1.06.44.294.292.44.646.44 1.06zm6 0c0 .414-.146.768-.44 1.06A1.44 1.44 0 0 1 12 7.5a1.44 1.44 0 0 1-1.06-.44A1.445 1.445 0 0 1 10.5 6c0-.414.146-.768.44-1.06A1.44 1.44 0 0 1 12 4.5c.414 0 .768.146 1.06.44.294.292.44.646.44 1.06zm3 3a7.29 7.29 0 0 0-.598-2.912 7.574 7.574 0 0 0-1.6-2.39 7.574 7.574 0 0 0-2.39-1.6A7.29 7.29 0 0 0 9 1.5a7.29 7.29 0 0 0-2.912.598 7.574 7.574 0 0 0-2.39 1.6 7.574 7.574 0 0 0-1.6 2.39A7.29 7.29 0 0 0 1.5 9c0 1.016.2 1.986.598 2.912a7.574 7.574 0 0 0 1.6 2.39 7.574 7.574 0 0 0 2.39 1.6c.92.397 1.91.6 2.912.598a7.29 7.29 0 0 0 2.912-.598 7.574 7.574 0 0 0 2.39-1.6 7.574 7.574 0 0 0 1.6-2.39c.397-.92.6-1.91.598-2.912zM18 9a8.804 8.804 0 0 1-1.207 4.518 8.96 8.96 0 0 1-3.275 3.275A8.804 8.804 0 0 1 9 18a8.804 8.804 0 0 1-4.518-1.207 8.96 8.96 0 0 1-3.275-3.275A8.804 8.804 0 0 1 0 9c0-1.633.402-3.139 1.207-4.518a8.96 8.96 0 0 1 3.275-3.275A8.804 8.804 0 0 1 9 0c1.633 0 3.139.402 4.518 1.207a8.96 8.96 0 0 1 3.275 3.275A8.804 8.804 0 0 1 18 9z" fill-rule="nonzero"/></svg>
diff --git a/app/views/shared/issuable/_sidebar.html.haml b/app/views/shared/issuable/_sidebar.html.haml
index 2c185549b24..63557c882f4 100644
--- a/app/views/shared/issuable/_sidebar.html.haml
+++ b/app/views/shared/issuable/_sidebar.html.haml
@@ -164,7 +164,7 @@
= dropdown_content
= dropdown_loading
= dropdown_footer add_content_class: true do
- %button.btn.btn-success.sidebar-move-issue-confirmation-button.js-move-issue-confirmation-button{ disabled: true }
+ %button.btn.btn-success.sidebar-move-issue-confirmation-button.js-move-issue-confirmation-button{ type: 'button', disabled: true }
= _('Move')
= icon('spinner spin', class: 'sidebar-move-issue-confirmation-loading-icon')
diff --git a/app/views/shared/milestones/_top.html.haml b/app/views/shared/milestones/_top.html.haml
index edaeff782de..43503e1d08a 100644
--- a/app/views/shared/milestones/_top.html.haml
+++ b/app/views/shared/milestones/_top.html.haml
@@ -4,10 +4,7 @@
- group = local_assigns[:group]
- is_dynamic_milestone = milestone.legacy_group_milestone? || milestone.dashboard_milestone?
-.detail-page-header
- %a.btn.btn-default.btn-grouped.float-right.d-block.d-sm-none.js-sidebar-toggle{ href: "#" }
- = icon('angle-double-left')
-
+.detail-page-header.milestone-page-header
.status-box{ class: "status-box-#{milestone.closed? ? 'closed' : 'open'}" }
- if milestone.closed?
Closed
@@ -15,14 +12,17 @@
Expired
- else
Open
- %span.identifier
- Milestone #{milestone.title}
- - if milestone.due_date || milestone.start_date
- %span.creator
- &nbsp;&middot;
- = milestone_date_range(milestone)
- - if group
- .float-right
+
+ .header-text-content
+ %span.identifier
+ Milestone #{milestone.title}
+ - if milestone.due_date || milestone.start_date
+ %span.creator
+ &nbsp;&middot;
+ = milestone_date_range(milestone)
+
+ .milestone-buttons
+ - if group
- if can?(current_user, :admin_milestone, group)
- if milestone.group_milestone?
= link_to edit_group_milestone_path(group, milestone), class: "btn btn btn-grouped" do
@@ -35,6 +35,9 @@
- unless is_dynamic_milestone
= render 'shared/milestones/delete_button'
+ %a.btn.btn-default.btn-grouped.float-right.d-block.d-sm-none.js-sidebar-toggle{ href: "#" }
+ = icon('angle-double-left')
+
= render 'shared/milestones/deprecation_message' if is_dynamic_milestone
.detail-page-description.milestone-detail
diff --git a/app/views/snippets/_actions.html.haml b/app/views/snippets/_actions.html.haml
index ef8664e6f47..9952f373156 100644
--- a/app/views/snippets/_actions.html.haml
+++ b/app/views/snippets/_actions.html.haml
@@ -7,7 +7,7 @@
- if can?(current_user, :admin_personal_snippet, @snippet)
= link_to snippet_path(@snippet), method: :delete, data: { confirm: _("Are you sure?") }, class: "btn btn-grouped btn-inverted btn-remove", title: _('Delete Snippet') do
= _("Delete")
- = link_to new_snippet_path, class: "btn btn-grouped btn-inverted btn-create", title: _("New snippet") do
+ = link_to new_snippet_path, class: "btn btn-grouped btn-success btn-inverted", title: _("New snippet") do
= _("New snippet")
- if @snippet.submittable_as_spam_by?(current_user)
= link_to _('Submit as spam'), mark_as_spam_snippet_path(@snippet), method: :post, class: 'btn btn-grouped btn-spam', title: _('Submit as spam')
diff --git a/app/views/snippets/notes/_actions.html.haml b/app/views/snippets/notes/_actions.html.haml
index 01b95145937..6e20890a47f 100644
--- a/app/views/snippets/notes/_actions.html.haml
+++ b/app/views/snippets/notes/_actions.html.haml
@@ -3,9 +3,9 @@
.note-actions-item
= link_to '#', title: _('Add reaction'), class: "note-action-button note-emoji-button js-add-award js-note-emoji has-tooltip", data: { position: 'right' } do
= icon('spinner spin')
- %span{ class: 'link-highlight award-control-icon-neutral' }= custom_icon('emoji_slightly_smiling_face')
- %span{ class: 'link-highlight award-control-icon-positive' }= custom_icon('emoji_smiley')
- %span{ class: 'link-highlight award-control-icon-super-positive' }= custom_icon('emoji_smile')
+ %span{ class: 'link-highlight award-control-icon-neutral' }= sprite_icon('slight-smile')
+ %span{ class: 'link-highlight award-control-icon-positive' }= sprite_icon('smiley')
+ %span{ class: 'link-highlight award-control-icon-super-positive' }= sprite_icon('smile')
- if note_editable
.note-actions-item
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index 211e3eafac6..6dc61088e65 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -45,7 +45,7 @@
= emoji_icon(@user.status.emoji)
= markdown_field(@user.status, :message)
- .cover-desc.member-date
+ .cover-desc.member-date.cgray
%p
%span.middle-dot-divider
@#{@user.username}
@@ -53,7 +53,7 @@
%span.middle-dot-divider
= s_('Member since %{date}') % { date: @user.created_at.to_date.to_s(:long) }
- .cover-desc
+ .cover-desc.cgray
- unless @user.public_email.blank?
.profile-link-holder.middle-dot-divider
= link_to @user.public_email, "mailto:#{@user.public_email}", class: 'text-link'
@@ -82,7 +82,7 @@
= @user.organization
- if @user.bio.present?
- .cover-desc
+ .cover-desc.cgray
%p.profile-user-bio
= @user.bio
diff --git a/app/workers/build_finished_worker.rb b/app/workers/build_finished_worker.rb
index adc38226405..8e2a18a8fd8 100644
--- a/app/workers/build_finished_worker.rb
+++ b/app/workers/build_finished_worker.rb
@@ -30,6 +30,7 @@ class BuildFinishedWorker
# We execute these async as these are independent operations.
BuildHooksWorker.perform_async(build.id)
ArchiveTraceWorker.perform_async(build.id)
+ ExpirePipelineCacheWorker.perform_async(build.pipeline_id)
ChatNotificationWorker.perform_async(build.id) if build.pipeline.chat?
end
end
diff --git a/app/workers/cluster_configure_worker.rb b/app/workers/cluster_configure_worker.rb
index 37ea7dde7a1..6f64b7ea0ab 100644
--- a/app/workers/cluster_configure_worker.rb
+++ b/app/workers/cluster_configure_worker.rb
@@ -6,7 +6,7 @@ class ClusterConfigureWorker
def perform(cluster_id)
Clusters::Cluster.managed.find_by_id(cluster_id).try do |cluster|
- if cluster.project_type? || Feature.disabled?(:ci_preparing_state, default_enabled: true)
+ if cluster.project_type?
Clusters::RefreshService.create_or_update_namespaces_for_cluster(cluster)
end
end
diff --git a/app/workers/git_garbage_collect_worker.rb b/app/workers/git_garbage_collect_worker.rb
index d4a6f53dae5..489d6215774 100644
--- a/app/workers/git_garbage_collect_worker.rb
+++ b/app/workers/git_garbage_collect_worker.rb
@@ -23,7 +23,9 @@ class GitGarbageCollectWorker
end
task = task.to_sym
- project.link_pool_repository
+
+ ::Projects::GitDeduplicationService.new(project).execute
+
gitaly_call(task, project.repository.raw_repository)
# Refresh the branch cache in case garbage collection caused a ref lookup to fail
diff --git a/app/workers/pages_domain_removal_cron_worker.rb b/app/workers/pages_domain_removal_cron_worker.rb
index 3aca123e5ac..79f38e1b89f 100644
--- a/app/workers/pages_domain_removal_cron_worker.rb
+++ b/app/workers/pages_domain_removal_cron_worker.rb
@@ -5,8 +5,6 @@ class PagesDomainRemovalCronWorker
include CronjobQueue
def perform
- return unless Feature.enabled?(:remove_disabled_domains)
-
PagesDomain.for_removal.find_each do |domain|
domain.destroy!
rescue => e
diff --git a/app/workers/process_commit_worker.rb b/app/workers/process_commit_worker.rb
index 29a7f8e691a..3efb5343a96 100644
--- a/app/workers/process_commit_worker.rb
+++ b/app/workers/process_commit_worker.rb
@@ -48,7 +48,7 @@ class ProcessCommitWorker
# Issues::CloseService#execute.
IssueCollection.new(issues).updatable_by_user(user).each do |issue|
Issues::CloseService.new(project, author)
- .close_issue(issue, commit: commit)
+ .close_issue(issue, closed_via: commit)
end
end
diff --git a/changelogs/unreleased/10012-move-ee-diff-for-boards-issue-card-inner.yml b/changelogs/unreleased/10012-move-ee-diff-for-boards-issue-card-inner.yml
deleted file mode 100644
index f15375e83f4..00000000000
--- a/changelogs/unreleased/10012-move-ee-diff-for-boards-issue-card-inner.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Move ee-specific code from boards/components/issue_card_inner.vue
-merge_request: 27394
-author: Roman Rodionov
-type: other
diff --git a/changelogs/unreleased/10083-dropdown-ce-ee-difference.yml b/changelogs/unreleased/10083-dropdown-ce-ee-difference.yml
deleted file mode 100644
index e8594edb76a..00000000000
--- a/changelogs/unreleased/10083-dropdown-ce-ee-difference.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Moved EE/CE differences for dropdown_value_collapsed into CE
-merge_request: 27367
-author:
-type: other
diff --git a/changelogs/unreleased/10327-enable-reliable-fetcher-by-default.yml b/changelogs/unreleased/10327-enable-reliable-fetcher-by-default.yml
deleted file mode 100644
index 89d2fced6e1..00000000000
--- a/changelogs/unreleased/10327-enable-reliable-fetcher-by-default.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Enable Sidekiq Reliable Fetcher for background jobs by default
-merge_request: 27530
-author:
-type: added
diff --git a/changelogs/unreleased/10798-remove-dind-req-for-dast.yml b/changelogs/unreleased/10798-remove-dind-req-for-dast.yml
new file mode 100644
index 00000000000..33545fc7cfd
--- /dev/null
+++ b/changelogs/unreleased/10798-remove-dind-req-for-dast.yml
@@ -0,0 +1,5 @@
+---
+title: Remove dind from DAST template
+merge_request: 28083
+author:
+type: changed
diff --git a/changelogs/unreleased/10808-allow-license-import-during-install.yml b/changelogs/unreleased/10808-allow-license-import-during-install.yml
deleted file mode 100644
index f93edf03d51..00000000000
--- a/changelogs/unreleased/10808-allow-license-import-during-install.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Document EE License Auto Import During Install
-merge_request: 28106
-author:
-type: other
diff --git a/changelogs/unreleased/10921-display-scoped-labels-ce.yml b/changelogs/unreleased/10921-display-scoped-labels-ce.yml
deleted file mode 100644
index 7a0e7fec41b..00000000000
--- a/changelogs/unreleased/10921-display-scoped-labels-ce.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Display scoped labels in Issue Boards
-merge_request: 27164
-author:
-type: fixed
diff --git a/changelogs/unreleased/11254-overflow-ce.yml b/changelogs/unreleased/11254-overflow-ce.yml
deleted file mode 100644
index dcac46000ac..00000000000
--- a/changelogs/unreleased/11254-overflow-ce.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Hide ScopedBadge overflow notes
-merge_request: 27651
-author:
-type: fixed
diff --git a/changelogs/unreleased/1340-request-job-with-age.yml b/changelogs/unreleased/1340-request-job-with-age.yml
new file mode 100644
index 00000000000..766ac008c2e
--- /dev/null
+++ b/changelogs/unreleased/1340-request-job-with-age.yml
@@ -0,0 +1,5 @@
+---
+title: "Added option to filter jobs by age in the /job/request API endpoint."
+merge_request: 1340
+author: Dmitry Chepurovskiy
+type: added
diff --git a/changelogs/unreleased/13453_minimal_atom_fix.yml b/changelogs/unreleased/13453_minimal_atom_fix.yml
new file mode 100644
index 00000000000..e0c18de3b1f
--- /dev/null
+++ b/changelogs/unreleased/13453_minimal_atom_fix.yml
@@ -0,0 +1,5 @@
+---
+title: Added a content field to atom feed
+merge_request: 27652
+author:
+type: fixed
diff --git a/changelogs/unreleased/18432-switch-to-sassc-rails.yml b/changelogs/unreleased/18432-switch-to-sassc-rails.yml
deleted file mode 100644
index 1c9d515c52f..00000000000
--- a/changelogs/unreleased/18432-switch-to-sassc-rails.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Switch to sassc-rails for faster stylesheet compilation
-merge_request: 26224
-author:
-type: changed
diff --git a/changelogs/unreleased/19569-include-information-if-issue-was-closed-via-mr.yml b/changelogs/unreleased/19569-include-information-if-issue-was-closed-via-mr.yml
new file mode 100644
index 00000000000..bb2fc9af2a1
--- /dev/null
+++ b/changelogs/unreleased/19569-include-information-if-issue-was-closed-via-mr.yml
@@ -0,0 +1,5 @@
+---
+title: Include information if issue was clossed via merge request or commit
+merge_request: 15610
+author: Michał Zając
+type: changed
diff --git a/changelogs/unreleased/237-style-toast-component.yml b/changelogs/unreleased/237-style-toast-component.yml
new file mode 100644
index 00000000000..2420df0ee55
--- /dev/null
+++ b/changelogs/unreleased/237-style-toast-component.yml
@@ -0,0 +1,5 @@
+---
+title: Style the toast component according to design specs.
+merge_request: 27734
+author:
+type: added
diff --git a/changelogs/unreleased/24704-download-repository-path.yml b/changelogs/unreleased/24704-download-repository-path.yml
deleted file mode 100644
index ff3082bec45..00000000000
--- a/changelogs/unreleased/24704-download-repository-path.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Download a folder from repository
-merge_request: 26532
-author: kiameisomabes
-type: added
diff --git a/changelogs/unreleased/24985-align-urlvalidator-to-validate_url-gem-implementation.yml b/changelogs/unreleased/24985-align-urlvalidator-to-validate_url-gem-implementation.yml
deleted file mode 100644
index 1143e4effea..00000000000
--- a/changelogs/unreleased/24985-align-urlvalidator-to-validate_url-gem-implementation.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: "Align UrlValidator to validate_url gem implementation"
-merge_request: 27194
-author: Horatiu Eugen Vlad
-type: fixed
diff --git a/changelogs/unreleased/25604-add-dotnet-core-yaml-template.yml b/changelogs/unreleased/25604-add-dotnet-core-yaml-template.yml
deleted file mode 100644
index ef9172aaf3b..00000000000
--- a/changelogs/unreleased/25604-add-dotnet-core-yaml-template.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Add .NET Core YAML template
-merge_request: 25604
-author: Piotr Wosiek
-type: added
diff --git a/changelogs/unreleased/26021-added-write_repository-scope-for-personal-access-token.yml b/changelogs/unreleased/26021-added-write_repository-scope-for-personal-access-token.yml
deleted file mode 100644
index da550d35f12..00000000000
--- a/changelogs/unreleased/26021-added-write_repository-scope-for-personal-access-token.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Added write_repository scope for personal access token
-merge_request: 26021
-author: Horatiu Eugen Vlad
-type: added
diff --git a/changelogs/unreleased/27383-added_omniauth_openid_connect_startegy.yml b/changelogs/unreleased/27383-added_omniauth_openid_connect_startegy.yml
deleted file mode 100644
index c49b201f0de..00000000000
--- a/changelogs/unreleased/27383-added_omniauth_openid_connect_startegy.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Added OmniAuth OpenID Connect strategy
-merge_request: 27383
-author: Horatiu Eugen Vlad
-type: added
diff --git a/changelogs/unreleased/27424-tklk-gitea-logo.yml b/changelogs/unreleased/27424-tklk-gitea-logo.yml
deleted file mode 100644
index 0d41bb39aad..00000000000
--- a/changelogs/unreleased/27424-tklk-gitea-logo.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: "Use official Gitea logo in importer"
-merge_request: 27424
-author: Matti Ranta (@techknowlogick)
-type: added \ No newline at end of file
diff --git a/changelogs/unreleased/28119-remove-note-multi-line-suggestions.yml b/changelogs/unreleased/28119-remove-note-multi-line-suggestions.yml
deleted file mode 100644
index 2fbacbcb011..00000000000
--- a/changelogs/unreleased/28119-remove-note-multi-line-suggestions.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Remove the note in the docs that multi-line suggestions are not yet available
-merge_request: 28119
-author: hardysim
-type: other
diff --git a/changelogs/unreleased/28741-play-all-manual-jobs.yml b/changelogs/unreleased/28741-play-all-manual-jobs.yml
deleted file mode 100644
index 30b26e3c0ed..00000000000
--- a/changelogs/unreleased/28741-play-all-manual-jobs.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Play all manual jobs in a stage
-merge_request: 27188
-author:
-type: added
diff --git a/changelogs/unreleased/30093-apply-bfg-object-map-to-database.yml b/changelogs/unreleased/30093-apply-bfg-object-map-to-database.yml
deleted file mode 100644
index ec851dfcacc..00000000000
--- a/changelogs/unreleased/30093-apply-bfg-object-map-to-database.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Remove cleaned up OIDs from database and cache
-merge_request: 26555
-author:
-type: added
diff --git a/changelogs/unreleased/30157-api-expose-single-environment.yml b/changelogs/unreleased/30157-api-expose-single-environment.yml
deleted file mode 100644
index f9619dbcc7d..00000000000
--- a/changelogs/unreleased/30157-api-expose-single-environment.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: 'Add new API endpoint to expose a single environment.'
-merge_request: 26887
-author:
-type: added
diff --git a/changelogs/unreleased/31331-add-time-tracking-issue-boards-sidebar.yml b/changelogs/unreleased/31331-add-time-tracking-issue-boards-sidebar.yml
deleted file mode 100644
index b3ffb77ccad..00000000000
--- a/changelogs/unreleased/31331-add-time-tracking-issue-boards-sidebar.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Add time tracking information to Issue Boards sidebar
-merge_request: 27166
-author:
-type: added
diff --git a/changelogs/unreleased/39304-broadcast-message-buttons.yml b/changelogs/unreleased/39304-broadcast-message-buttons.yml
new file mode 100644
index 00000000000..7eb289fca1f
--- /dev/null
+++ b/changelogs/unreleased/39304-broadcast-message-buttons.yml
@@ -0,0 +1,5 @@
+---
+title: Update broadcast message action icons
+merge_request: 28496
+author: Jarek Ostrowski @jareko
+type: fixed
diff --git a/changelogs/unreleased/46048-canary-next.yml b/changelogs/unreleased/46048-canary-next.yml
deleted file mode 100644
index 1a702cccff9..00000000000
--- a/changelogs/unreleased/46048-canary-next.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Adds badge for Canary environment and help link
-merge_request:
-author:
-type: added
diff --git a/changelogs/unreleased/46806-typed-ci-variables.yml b/changelogs/unreleased/46806-typed-ci-variables.yml
deleted file mode 100644
index aa15c31bca1..00000000000
--- a/changelogs/unreleased/46806-typed-ci-variables.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: CI variables of type file
-merge_request: 27112
-author:
-type: added
diff --git a/changelogs/unreleased/47327-fix-github-import-visibility.yml b/changelogs/unreleased/47327-fix-github-import-visibility.yml
deleted file mode 100644
index b02318f0e89..00000000000
--- a/changelogs/unreleased/47327-fix-github-import-visibility.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix GitHub project import visibility
-merge_request: 27133
-author: Daniel Wyatt
-type: fixed
diff --git a/changelogs/unreleased/47584-label-text-color.yml b/changelogs/unreleased/47584-label-text-color.yml
deleted file mode 100644
index 7d5eaa62793..00000000000
--- a/changelogs/unreleased/47584-label-text-color.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Resolve issue where list labels did not have the correct text color on creation
-merge_request: 26794
-author: Tucker Chapman
-type: fixed
diff --git a/changelogs/unreleased/48479-auto-direction-for-issue-title.yml b/changelogs/unreleased/48479-auto-direction-for-issue-title.yml
deleted file mode 100644
index 0571f58ab4d..00000000000
--- a/changelogs/unreleased/48479-auto-direction-for-issue-title.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Add auto direction for issue title
-merge_request: 27378
-author: Ahmad Haghighi
-type: fixed
diff --git a/changelogs/unreleased/49041-issue-board-input-height.yml b/changelogs/unreleased/49041-issue-board-input-height.yml
new file mode 100644
index 00000000000..de3fbb2ee11
--- /dev/null
+++ b/changelogs/unreleased/49041-issue-board-input-height.yml
@@ -0,0 +1,5 @@
+---
+title: Reduce height of issue board input to align with buttons
+merge_request:
+author:
+type: other
diff --git a/changelogs/unreleased/49517-fix-notes-import-export.yml b/changelogs/unreleased/49517-fix-notes-import-export.yml
new file mode 100644
index 00000000000..a9f4d736e0b
--- /dev/null
+++ b/changelogs/unreleased/49517-fix-notes-import-export.yml
@@ -0,0 +1,5 @@
+---
+title: Fix diff notes and discussion notes being exported as regular notes
+merge_request: 28401
+author:
+type: fixed
diff --git a/changelogs/unreleased/49915-fix-error-500-admin-projects-nil-storage.yml b/changelogs/unreleased/49915-fix-error-500-admin-projects-nil-storage.yml
new file mode 100644
index 00000000000..307c2bfb49d
--- /dev/null
+++ b/changelogs/unreleased/49915-fix-error-500-admin-projects-nil-storage.yml
@@ -0,0 +1,5 @@
+---
+title: Fix an error in projects admin when statistics are missing
+merge_request: 28355
+author:
+type: fixed
diff --git a/changelogs/unreleased/50926-sort-by-due-date-and-popularity.yml b/changelogs/unreleased/50926-sort-by-due-date-and-popularity.yml
deleted file mode 100644
index 7efc800be1e..00000000000
--- a/changelogs/unreleased/50926-sort-by-due-date-and-popularity.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Sort by due date and popularity in both directions for Issues and Merge requests
-merge_request: 25502
-author: Nermin Vehabovic
-type: changed
diff --git a/changelogs/unreleased/51963-support-prometheus-for-group-level-clusters.yml b/changelogs/unreleased/51963-support-prometheus-for-group-level-clusters.yml
deleted file mode 100644
index ede2e242156..00000000000
--- a/changelogs/unreleased/51963-support-prometheus-for-group-level-clusters.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Support prometheus for group level clusters
-merge_request: 27280
-author:
-type: changed
diff --git a/changelogs/unreleased/53064-bypassing-pipeline-jobs-by-canceling-the-pipeline-and-manually-running-later-jobs.yml b/changelogs/unreleased/53064-bypassing-pipeline-jobs-by-canceling-the-pipeline-and-manually-running-later-jobs.yml
deleted file mode 100644
index 48f0a668982..00000000000
--- a/changelogs/unreleased/53064-bypassing-pipeline-jobs-by-canceling-the-pipeline-and-manually-running-later-jobs.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Make canceled jobs not retryable
-merge_request: 27503
-author:
-type: changed
diff --git a/changelogs/unreleased/53138-add-metrics-usage-ping.yml b/changelogs/unreleased/53138-add-metrics-usage-ping.yml
deleted file mode 100644
index db6af77a647..00000000000
--- a/changelogs/unreleased/53138-add-metrics-usage-ping.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Adds if InfluxDB and Prometheus metrics are enabled to usage ping data
-merge_request: 27238
-author:
-type: added
diff --git a/changelogs/unreleased/53279-fix-updated_at-api.yml b/changelogs/unreleased/53279-fix-updated_at-api.yml
deleted file mode 100644
index c64dada7eaa..00000000000
--- a/changelogs/unreleased/53279-fix-updated_at-api.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: "Respect updated_at attribute in notes produced by API calls"
-merge_request: 27124
-author: Ben Gamari
-type: fixed
diff --git a/changelogs/unreleased/53973-fix-subpixel-border-issue.yml b/changelogs/unreleased/53973-fix-subpixel-border-issue.yml
deleted file mode 100644
index 0dae7047236..00000000000
--- a/changelogs/unreleased/53973-fix-subpixel-border-issue.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix MR discussion border missing in chrome sometimes
-merge_request: 28185
-author:
-type: fixed
diff --git a/changelogs/unreleased/54405-resolve-discussion-when-applying-a-suggested-change.yml b/changelogs/unreleased/54405-resolve-discussion-when-applying-a-suggested-change.yml
deleted file mode 100644
index 862ce623d8c..00000000000
--- a/changelogs/unreleased/54405-resolve-discussion-when-applying-a-suggested-change.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Resolve discussion when apply suggestion
-merge_request: 28160
-author:
-type: changed
diff --git a/changelogs/unreleased/55127-add-delay-after-mr-creation-for-async-tasks-to-complete.yml b/changelogs/unreleased/55127-add-delay-after-mr-creation-for-async-tasks-to-complete.yml
deleted file mode 100644
index ac3bb596842..00000000000
--- a/changelogs/unreleased/55127-add-delay-after-mr-creation-for-async-tasks-to-complete.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Wait for pipeline creation to complete before accepting a MR via API
-merge_request: 27978
-author: kerrizor
-type: fixed
diff --git a/changelogs/unreleased/55948-help-text-formatting-wiki.yml b/changelogs/unreleased/55948-help-text-formatting-wiki.yml
deleted file mode 100644
index e1e0475a117..00000000000
--- a/changelogs/unreleased/55948-help-text-formatting-wiki.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Format extra help page text like wiki
-merge_request: 26782
-author: Bastian Blank
-type: fixed
diff --git a/changelogs/unreleased/56557-disable-kubernetes-namespace-service-account-backend.yml b/changelogs/unreleased/56557-disable-kubernetes-namespace-service-account-backend.yml
deleted file mode 100644
index 6521eb9d1c0..00000000000
--- a/changelogs/unreleased/56557-disable-kubernetes-namespace-service-account-backend.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Disables kubernetes resources creation if a cluster is not managed
-merge_request: 26565
-author:
-type: added
diff --git a/changelogs/unreleased/56838-allow-guest-access-to-releases.yml b/changelogs/unreleased/56838-allow-guest-access-to-releases.yml
deleted file mode 100644
index 701a015b9ac..00000000000
--- a/changelogs/unreleased/56838-allow-guest-access-to-releases.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Allow guests users to access project releases
-merge_request: 27247
-author:
-type: changed
diff --git a/changelogs/unreleased/57017-add-toast-success-message.yml b/changelogs/unreleased/57017-add-toast-success-message.yml
deleted file mode 100644
index 931e7755591..00000000000
--- a/changelogs/unreleased/57017-add-toast-success-message.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Display a toast message when the Kubernetes runner has successfully upgraded.
-merge_request: 27206
-author:
-type: changed
diff --git a/changelogs/unreleased/57077-add-salesforce-omniauth.yml b/changelogs/unreleased/57077-add-salesforce-omniauth.yml
deleted file mode 100644
index ebd0637ddac..00000000000
--- a/changelogs/unreleased/57077-add-salesforce-omniauth.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Resolve Salesforce.com omniauth support
-merge_request: 27834
-author:
-type: added
diff --git a/changelogs/unreleased/57171-add-dashboard-settings.yml b/changelogs/unreleased/57171-add-dashboard-settings.yml
deleted file mode 100644
index f235872b35c..00000000000
--- a/changelogs/unreleased/57171-add-dashboard-settings.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Add backend support for a External Dashboard URL setting
-merge_request: 27550
-author:
-type: added
diff --git a/changelogs/unreleased/57247-show-prioritized-labels-to-guests.yml b/changelogs/unreleased/57247-show-prioritized-labels-to-guests.yml
deleted file mode 100644
index 5210ff0ccef..00000000000
--- a/changelogs/unreleased/57247-show-prioritized-labels-to-guests.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Show prioritized labels to guests
-merge_request: 27307
-author:
-type: fixed
diff --git a/changelogs/unreleased/57293-fix-image-rename.yml b/changelogs/unreleased/57293-fix-image-rename.yml
deleted file mode 100644
index 50dddbdf114..00000000000
--- a/changelogs/unreleased/57293-fix-image-rename.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Resolve Renaming an image via Web IDE corrupts it
-merge_request: 27486
-author:
-type: fixed
diff --git a/changelogs/unreleased/57654-add-time-preferences-for-user-fe.yml b/changelogs/unreleased/57654-add-time-preferences-for-user-fe.yml
deleted file mode 100644
index f4ce3a51724..00000000000
--- a/changelogs/unreleased/57654-add-time-preferences-for-user-fe.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Add time preferences for user
-merge_request: 25381
-author:
-type: added
diff --git a/changelogs/unreleased/57815.yml b/changelogs/unreleased/57815.yml
deleted file mode 100644
index ccf76c99f1e..00000000000
--- a/changelogs/unreleased/57815.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Added Omniauth UltraAuth strategy to GitLab
-merge_request:
-author: Kartikey Tanna
-type: added
diff --git a/changelogs/unreleased/58105-pipeline-author-and-commit-author-too-close-together-in-pipeline-list.yml b/changelogs/unreleased/58105-pipeline-author-and-commit-author-too-close-together-in-pipeline-list.yml
deleted file mode 100644
index aef0a5ad53e..00000000000
--- a/changelogs/unreleased/58105-pipeline-author-and-commit-author-too-close-together-in-pipeline-list.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Improve pipelines table spacing, add triggerer column
-merge_request: 26136
-author:
-type: changed
diff --git a/changelogs/unreleased/58252-web-ide-dropdown-duplicates.yml b/changelogs/unreleased/58252-web-ide-dropdown-duplicates.yml
deleted file mode 100644
index 48b03994586..00000000000
--- a/changelogs/unreleased/58252-web-ide-dropdown-duplicates.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Resolve Web IDE template dropdown showing duplicates
-merge_request: 27237
-author:
-type: fixed
diff --git a/changelogs/unreleased/58293-extract-discussion-actions.yml b/changelogs/unreleased/58293-extract-discussion-actions.yml
deleted file mode 100644
index 2ca4716a6de..00000000000
--- a/changelogs/unreleased/58293-extract-discussion-actions.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Extract DiscussionActions component from NoteableDiscussion
-merge_request: 27227
-author:
-type: other
diff --git a/changelogs/unreleased/58294-discussion-notes-component.yml b/changelogs/unreleased/58294-discussion-notes-component.yml
deleted file mode 100644
index fbe08360a9a..00000000000
--- a/changelogs/unreleased/58294-discussion-notes-component.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Extract DiscussionNotes component from NoteableDiscussion
-merge_request: 27066
-author:
-type: other
diff --git a/changelogs/unreleased/58361-issue-create-system-note-timestamp.yml b/changelogs/unreleased/58361-issue-create-system-note-timestamp.yml
deleted file mode 100644
index d8fe3e4aa48..00000000000
--- a/changelogs/unreleased/58361-issue-create-system-note-timestamp.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix system notes timestamp when creating issue in the past
-merge_request: 27406
-author:
-type: fixed
diff --git a/changelogs/unreleased/58538-discussion-top-radius.yml b/changelogs/unreleased/58538-discussion-top-radius.yml
new file mode 100644
index 00000000000..0fb16055623
--- /dev/null
+++ b/changelogs/unreleased/58538-discussion-top-radius.yml
@@ -0,0 +1,5 @@
+---
+title: Fix border radius of discussions
+merge_request: 28490
+author:
+type: fixed
diff --git a/changelogs/unreleased/58748-update-nodejs-to-10-15-3.yml b/changelogs/unreleased/58748-update-nodejs-to-10-15-3.yml
deleted file mode 100644
index 4c7e4b5c604..00000000000
--- a/changelogs/unreleased/58748-update-nodejs-to-10-15-3.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Update node.js to 10.15.3 in CI template for Hexo
-merge_request: 25943
-author: Takuya Noguchi
-type: other
diff --git a/changelogs/unreleased/58850-fix-misplaced-swipe-view-26969.yml b/changelogs/unreleased/58850-fix-misplaced-swipe-view-26969.yml
deleted file mode 100644
index fa3e81df4e0..00000000000
--- a/changelogs/unreleased/58850-fix-misplaced-swipe-view-26969.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: "Fix misaligned image diff swipe view"
-merge_request: 26969
-author: ftab
-type: fixed
diff --git a/changelogs/unreleased/59026-replace-favicon.yml b/changelogs/unreleased/59026-replace-favicon.yml
new file mode 100644
index 00000000000..34228bb8438
--- /dev/null
+++ b/changelogs/unreleased/59026-replace-favicon.yml
@@ -0,0 +1,5 @@
+---
+title: Update favicon from next
+merge_request: 28601
+author: Jarek Ostrowski @jareko
+type: fixed
diff --git a/changelogs/unreleased/59034-external-link-button.yml b/changelogs/unreleased/59034-external-link-button.yml
deleted file mode 100644
index 3d8e9e82836..00000000000
--- a/changelogs/unreleased/59034-external-link-button.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Replaced icon for external URL with doc-text icon
-merge_request: 27365
-author:
-type: fixed
diff --git a/changelogs/unreleased/59105-padding-unclickable-pipeline-job.yml b/changelogs/unreleased/59105-padding-unclickable-pipeline-job.yml
new file mode 100644
index 00000000000..95f08af3cb1
--- /dev/null
+++ b/changelogs/unreleased/59105-padding-unclickable-pipeline-job.yml
@@ -0,0 +1,5 @@
+---
+title: Fix padding of unclickable pipeline dropdown items to match links
+merge_request:
+author:
+type: fixed
diff --git a/changelogs/unreleased/59275-cluster-form-hints.yml b/changelogs/unreleased/59275-cluster-form-hints.yml
deleted file mode 100644
index 0031b9557f4..00000000000
--- a/changelogs/unreleased/59275-cluster-form-hints.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Add help texts to K8 form fields
-merge_request: 27274
-author:
-type: changed
diff --git a/changelogs/unreleased/59514-uploading-images-base64.yml b/changelogs/unreleased/59514-uploading-images-base64.yml
deleted file mode 100644
index 905b00db06a..00000000000
--- a/changelogs/unreleased/59514-uploading-images-base64.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Show proper preview for uploaded images in Web IDE
-merge_request: 27471
-author:
-type: fixed
diff --git a/changelogs/unreleased/5966-rebase-with-block.yml b/changelogs/unreleased/5966-rebase-with-block.yml
deleted file mode 100644
index 9272a02977f..00000000000
--- a/changelogs/unreleased/5966-rebase-with-block.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix approvals sometimes being reset after a merge request is rebased
-merge_request: 27446
-author:
-type: fixed
diff --git a/changelogs/unreleased/59708-vendor-css.yml b/changelogs/unreleased/59708-vendor-css.yml
deleted file mode 100644
index ec7def7a9e6..00000000000
--- a/changelogs/unreleased/59708-vendor-css.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Creates a vendors folder for external CSS
-merge_request:
-author:
-type: other
diff --git a/changelogs/unreleased/59921-pipeline-schedule.yml b/changelogs/unreleased/59921-pipeline-schedule.yml
deleted file mode 100644
index 4227a047913..00000000000
--- a/changelogs/unreleased/59921-pipeline-schedule.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Replaces CSS with BS4 utility class for pipeline schedules
-merge_request:
-author:
-type: other
diff --git a/changelogs/unreleased/60026-group-member-count-bg.yml b/changelogs/unreleased/60026-group-member-count-bg.yml
deleted file mode 100644
index 0a1f6eac2ea..00000000000
--- a/changelogs/unreleased/60026-group-member-count-bg.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Add badge-pill class on group member count
-merge_request: 27019
-author:
-type: fixed
diff --git a/changelogs/unreleased/60224-btn-env.yml b/changelogs/unreleased/60224-btn-env.yml
deleted file mode 100644
index 5053ddb31fa..00000000000
--- a/changelogs/unreleased/60224-btn-env.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fixes actions dropdowns in environments page
-merge_request: 27160
-author:
-type: fixed
diff --git a/changelogs/unreleased/60250-remove-mr_push_options-flag.yml b/changelogs/unreleased/60250-remove-mr_push_options-flag.yml
new file mode 100644
index 00000000000..b429d83dcc7
--- /dev/null
+++ b/changelogs/unreleased/60250-remove-mr_push_options-flag.yml
@@ -0,0 +1,5 @@
+---
+title: Remove the mr_push_options feature flag
+merge_request: 28278
+author:
+type: changed
diff --git a/changelogs/unreleased/60261-save-btn-env.yml b/changelogs/unreleased/60261-save-btn-env.yml
deleted file mode 100644
index b0936198d2e..00000000000
--- a/changelogs/unreleased/60261-save-btn-env.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fixes create button background for Environments form
-merge_request: 27161
-author:
-type: fixed
diff --git a/changelogs/unreleased/60379-remove-ci-preparing-state-feature-flag.yml b/changelogs/unreleased/60379-remove-ci-preparing-state-feature-flag.yml
new file mode 100644
index 00000000000..a9b7aeb3024
--- /dev/null
+++ b/changelogs/unreleased/60379-remove-ci-preparing-state-feature-flag.yml
@@ -0,0 +1,5 @@
+---
+title: Remove ability for group clusters to be automatically configured on creation
+merge_request: 27245
+author:
+type: removed
diff --git a/changelogs/unreleased/60387-use-icons-in-user-popovers.yml b/changelogs/unreleased/60387-use-icons-in-user-popovers.yml
deleted file mode 100644
index 100d33690b3..00000000000
--- a/changelogs/unreleased/60387-use-icons-in-user-popovers.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Show category icons in user popover
-merge_request:
-author:
-type: added
diff --git a/changelogs/unreleased/60462-empty-pipeline-section.yml b/changelogs/unreleased/60462-empty-pipeline-section.yml
deleted file mode 100644
index 7d90215e20c..00000000000
--- a/changelogs/unreleased/60462-empty-pipeline-section.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix empty block in MR widget when user doesn't have permission
-merge_request: 27462
-author:
-type: fixed
diff --git a/changelogs/unreleased/60552-period-dropdown.yml b/changelogs/unreleased/60552-period-dropdown.yml
deleted file mode 100644
index e1b4a098ab0..00000000000
--- a/changelogs/unreleased/60552-period-dropdown.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix autocomplete dropdown for usernames starting with period
-merge_request: 27533
-author: Jan Beckmann
-type: fixed
diff --git a/changelogs/unreleased/60750-milestone-header.yml b/changelogs/unreleased/60750-milestone-header.yml
new file mode 100644
index 00000000000..62cfdaf6ea7
--- /dev/null
+++ b/changelogs/unreleased/60750-milestone-header.yml
@@ -0,0 +1,5 @@
+---
+title: Fix layout of group milestone header
+merge_request:
+author:
+type: fixed
diff --git a/changelogs/unreleased/60777-uninstall-button.yml b/changelogs/unreleased/60777-uninstall-button.yml
deleted file mode 100644
index a2727b16ef1..00000000000
--- a/changelogs/unreleased/60777-uninstall-button.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Implement UI for uninstalling Cluster’s managed apps
-merge_request: 27559
-author:
-type: added
diff --git a/changelogs/unreleased/60808-only-show-target-branch-advanced-error-before-merge.yml b/changelogs/unreleased/60808-only-show-target-branch-advanced-error-before-merge.yml
deleted file mode 100644
index b340f8408f3..00000000000
--- a/changelogs/unreleased/60808-only-show-target-branch-advanced-error-before-merge.yml
+++ /dev/null
@@ -1,6 +0,0 @@
----
-title: Only show the "target branch has advanced" message when the merge request is
- open
-merge_request: 27588
-author:
-type: fixed
diff --git a/changelogs/unreleased/60818_yamllint_project_root.yml b/changelogs/unreleased/60818_yamllint_project_root.yml
new file mode 100644
index 00000000000..b34a50e6a9c
--- /dev/null
+++ b/changelogs/unreleased/60818_yamllint_project_root.yml
@@ -0,0 +1,5 @@
+---
+title: Fix yaml linting for project root *.yml files
+merge_request: 27579
+author: Will Hall
+type: fixed
diff --git a/changelogs/unreleased/60874-fix-suggestion-misalignment.yml b/changelogs/unreleased/60874-fix-suggestion-misalignment.yml
deleted file mode 100644
index f5717ac19fd..00000000000
--- a/changelogs/unreleased/60874-fix-suggestion-misalignment.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Resolve Misalignment on suggested changes diff table
-merge_request: 27612
-author:
-type: fixed
diff --git a/changelogs/unreleased/61036-fix-ingress-base-domain-text.yml b/changelogs/unreleased/61036-fix-ingress-base-domain-text.yml
deleted file mode 100644
index 32f0e023923..00000000000
--- a/changelogs/unreleased/61036-fix-ingress-base-domain-text.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix base domain help text update
-merge_request: 27746
-author:
-type: fixed
diff --git a/changelogs/unreleased/61049-links-activity-stream.yml b/changelogs/unreleased/61049-links-activity-stream.yml
new file mode 100644
index 00000000000..3aac84adc31
--- /dev/null
+++ b/changelogs/unreleased/61049-links-activity-stream.yml
@@ -0,0 +1,5 @@
+---
+title: Use blue for activity stream links; use monospace font for commit sha
+merge_request:
+author:
+type: other
diff --git a/changelogs/unreleased/61203-fix-lfs-ui-upload.yml b/changelogs/unreleased/61203-fix-lfs-ui-upload.yml
deleted file mode 100644
index 66afe9f0597..00000000000
--- a/changelogs/unreleased/61203-fix-lfs-ui-upload.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix uploading of LFS tracked file through UI
-merge_request: 28052
-author:
-type: fixed
diff --git a/changelogs/unreleased/61278-next.yml b/changelogs/unreleased/61278-next.yml
deleted file mode 100644
index 829f37f75ba..00000000000
--- a/changelogs/unreleased/61278-next.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Render Next badge only for gitlab.com
-merge_request: 28056
-author:
-type: fixed
diff --git a/changelogs/unreleased/61313-fix-dropdown-searchbar.yml b/changelogs/unreleased/61313-fix-dropdown-searchbar.yml
new file mode 100644
index 00000000000..ba191a89da2
--- /dev/null
+++ b/changelogs/unreleased/61313-fix-dropdown-searchbar.yml
@@ -0,0 +1,5 @@
+---
+title: Fix loading.. dropdown at search field
+merge_request: 28275
+author: Pavel Chausov
+type: fixed
diff --git a/changelogs/unreleased/61324-non-project-snippet-new-snippet-button-should-be-green-outline.yml b/changelogs/unreleased/61324-non-project-snippet-new-snippet-button-should-be-green-outline.yml
new file mode 100644
index 00000000000..350fd525a30
--- /dev/null
+++ b/changelogs/unreleased/61324-non-project-snippet-new-snippet-button-should-be-green-outline.yml
@@ -0,0 +1,5 @@
+---
+title: Give New Snippet button green outline
+merge_request: 28559
+author: Marcel van Remmerden
+type: other
diff --git a/changelogs/unreleased/61393-emoji-button.yml b/changelogs/unreleased/61393-emoji-button.yml
new file mode 100644
index 00000000000..2bcfde308db
--- /dev/null
+++ b/changelogs/unreleased/61393-emoji-button.yml
@@ -0,0 +1,5 @@
+---
+title: Change default color of award emoji button
+merge_request:
+author:
+type: other
diff --git a/changelogs/unreleased/61441.yml b/changelogs/unreleased/61441.yml
new file mode 100644
index 00000000000..2ad0c6f62d3
--- /dev/null
+++ b/changelogs/unreleased/61441.yml
@@ -0,0 +1,5 @@
+---
+title: Allow user to set primary email first when 2FA is required
+merge_request: 28097
+author: Kartikey Tanna
+type: fixed
diff --git a/changelogs/unreleased/61469-align-play-icon.yml b/changelogs/unreleased/61469-align-play-icon.yml
deleted file mode 100644
index a118da29703..00000000000
--- a/changelogs/unreleased/61469-align-play-icon.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Vertically aligns the play button for stages
-merge_request:
-author:
-type: fixed
diff --git a/changelogs/unreleased/61494-set-status-modal-visual-bugs.yml b/changelogs/unreleased/61494-set-status-modal-visual-bugs.yml
deleted file mode 100644
index 4126b8f93c1..00000000000
--- a/changelogs/unreleased/61494-set-status-modal-visual-bugs.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix visual issues in set status modal
-merge_request: 28147
-author:
-type: fixed
diff --git a/changelogs/unreleased/61550-next-badge.yml b/changelogs/unreleased/61550-next-badge.yml
deleted file mode 100644
index 122e394a68c..00000000000
--- a/changelogs/unreleased/61550-next-badge.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fixes next badge being always visible
-merge_request:
-author:
-type: fixed
diff --git a/changelogs/unreleased/61629-dependency-installation-error-on-fsevents-1-2-4-with-node-js-12.yml b/changelogs/unreleased/61629-dependency-installation-error-on-fsevents-1-2-4-with-node-js-12.yml
new file mode 100644
index 00000000000..bbe43760953
--- /dev/null
+++ b/changelogs/unreleased/61629-dependency-installation-error-on-fsevents-1-2-4-with-node-js-12.yml
@@ -0,0 +1,5 @@
+---
+title: Update indirect dependency fsevents from 1.2.4 to 1.2.9
+merge_request: 28220
+author: Takuya Noguchi
+type: other
diff --git a/changelogs/unreleased/61697-add-project-id-to-le-common-name.yml b/changelogs/unreleased/61697-add-project-id-to-le-common-name.yml
new file mode 100644
index 00000000000..8ffa8d0a51a
--- /dev/null
+++ b/changelogs/unreleased/61697-add-project-id-to-le-common-name.yml
@@ -0,0 +1,5 @@
+---
+title: Prevent common name collisions when requesting multiple Let's Encrypt certificates concurrently
+merge_request: 28373
+author:
+type: fixed
diff --git a/changelogs/unreleased/61795-fix-error-when-moving-issues.yml b/changelogs/unreleased/61795-fix-error-when-moving-issues.yml
new file mode 100644
index 00000000000..6812baa07c3
--- /dev/null
+++ b/changelogs/unreleased/61795-fix-error-when-moving-issues.yml
@@ -0,0 +1,5 @@
+---
+title: Remove unintended error message shown when moving issues
+merge_request: 28317
+author:
+type: fixed
diff --git a/changelogs/unreleased/61880-download-btn-group.yml b/changelogs/unreleased/61880-download-btn-group.yml
new file mode 100644
index 00000000000..c1f6b2767c6
--- /dev/null
+++ b/changelogs/unreleased/61880-download-btn-group.yml
@@ -0,0 +1,5 @@
+---
+title: Group download buttons into a .btn-group
+merge_request:
+author:
+type: other
diff --git a/changelogs/unreleased/61914-fix-emojis-urls.yml b/changelogs/unreleased/61914-fix-emojis-urls.yml
new file mode 100644
index 00000000000..578edf4a063
--- /dev/null
+++ b/changelogs/unreleased/61914-fix-emojis-urls.yml
@@ -0,0 +1,5 @@
+---
+title: Fix emojis URLs
+merge_request: 28371
+author:
+type: fixed
diff --git a/changelogs/unreleased/61928-remove-throttle-from-dirty-submit.yml b/changelogs/unreleased/61928-remove-throttle-from-dirty-submit.yml
new file mode 100644
index 00000000000..f8ef5dbb53b
--- /dev/null
+++ b/changelogs/unreleased/61928-remove-throttle-from-dirty-submit.yml
@@ -0,0 +1,6 @@
+---
+title: Fix issue that causes "Save changes" button in project settings pages to be
+ enabled/disabled incorrectly when changes are made to the form
+merge_request: 28377
+author:
+type: fixed
diff --git a/changelogs/unreleased/61990-spinner.yml b/changelogs/unreleased/61990-spinner.yml
new file mode 100644
index 00000000000..27d35e56cc9
--- /dev/null
+++ b/changelogs/unreleased/61990-spinner.yml
@@ -0,0 +1,5 @@
+---
+title: Updates loading icon in commits page
+merge_request: 28475
+author:
+type: fixed
diff --git a/changelogs/unreleased/62061-note-icon-color.yml b/changelogs/unreleased/62061-note-icon-color.yml
new file mode 100644
index 00000000000..5bfea1a9ed3
--- /dev/null
+++ b/changelogs/unreleased/62061-note-icon-color.yml
@@ -0,0 +1,5 @@
+---
+title: Update icon color to match design system, pass accessibility
+merge_request: 28498
+author: Jarek Ostrowski @jareko
+type: fixed
diff --git a/changelogs/unreleased/62107-fix-detail-page-header-height.yml b/changelogs/unreleased/62107-fix-detail-page-header-height.yml
new file mode 100644
index 00000000000..3723f323bcc
--- /dev/null
+++ b/changelogs/unreleased/62107-fix-detail-page-header-height.yml
@@ -0,0 +1,5 @@
+---
+title: Fix the height of the page headers on issues/merge request/snippets pages
+merge_request: 28650
+author: Erik van der Gaag
+type: fixed
diff --git a/changelogs/unreleased/62116-performance-issue-502-errors-on-rendering-of-issues-with-heavy-markdown-contents.yml b/changelogs/unreleased/62116-performance-issue-502-errors-on-rendering-of-issues-with-heavy-markdown-contents.yml
new file mode 100644
index 00000000000..9596f487116
--- /dev/null
+++ b/changelogs/unreleased/62116-performance-issue-502-errors-on-rendering-of-issues-with-heavy-markdown-contents.yml
@@ -0,0 +1,6 @@
+---
+title: Fix performance issue with large Markdown content in issue or merge request
+ description
+merge_request: 28597
+author:
+type: performance
diff --git a/changelogs/unreleased/8723-geo-remove-gitlab-lfstoken-legacyredisdevisetoken-implementation-and-usage-geo.yml b/changelogs/unreleased/8723-geo-remove-gitlab-lfstoken-legacyredisdevisetoken-implementation-and-usage-geo.yml
new file mode 100644
index 00000000000..173c7d9383e
--- /dev/null
+++ b/changelogs/unreleased/8723-geo-remove-gitlab-lfstoken-legacyredisdevisetoken-implementation-and-usage-geo.yml
@@ -0,0 +1,5 @@
+---
+title: 'Geo: Remove Gitlab::LfsToken::LegacyRedisDeviseToken implementation and usage'
+merge_request: 28546
+author:
+type: changed
diff --git a/changelogs/unreleased/ac-package-storage-stats.yml b/changelogs/unreleased/ac-package-storage-stats.yml
deleted file mode 100644
index fedffb41597..00000000000
--- a/changelogs/unreleased/ac-package-storage-stats.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Add packages_size to ProjectStatistics
-merge_request: 27373
-author:
-type: added
diff --git a/changelogs/unreleased/add-allow_failure-to-job-api.yml b/changelogs/unreleased/add-allow_failure-to-job-api.yml
new file mode 100644
index 00000000000..5dd2b9708c5
--- /dev/null
+++ b/changelogs/unreleased/add-allow_failure-to-job-api.yml
@@ -0,0 +1,5 @@
+---
+title: Add allow_failure attribute to Job API
+merge_request: 28406
+author:
+type: added
diff --git a/changelogs/unreleased/add-branch-to-project-search-api.yml b/changelogs/unreleased/add-branch-to-project-search-api.yml
new file mode 100644
index 00000000000..74cff94ab76
--- /dev/null
+++ b/changelogs/unreleased/add-branch-to-project-search-api.yml
@@ -0,0 +1,5 @@
+---
+title: Added ref querystring parameter to project search API to allow searching on branches/tags other than the default
+merge_request: 28069
+author: Lee Tickett
+type: added
diff --git a/changelogs/unreleased/add-ci-variable-protected-ref.yml b/changelogs/unreleased/add-ci-variable-protected-ref.yml
deleted file mode 100644
index 150ddcc21ad..00000000000
--- a/changelogs/unreleased/add-ci-variable-protected-ref.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Add CI_COMMIT_REF_PROTECTED CI variable
-merge_request: 26716
-author: Jason van den Hurk
-type: added
diff --git a/changelogs/unreleased/add-runner-access-level-registration.yml b/changelogs/unreleased/add-runner-access-level-registration.yml
deleted file mode 100644
index 7ae95025abb..00000000000
--- a/changelogs/unreleased/add-runner-access-level-registration.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Add option to set access_level of runners upon registration
-merge_request: 27490
-author: Zelin L
-type: added
diff --git a/changelogs/unreleased/allow-replying-to-individual-notes-from-api.yml b/changelogs/unreleased/allow-replying-to-individual-notes-from-api.yml
deleted file mode 100644
index b268b0689ad..00000000000
--- a/changelogs/unreleased/allow-replying-to-individual-notes-from-api.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Allow replying to individual notes from API
-merge_request:
-author:
-type: fixed
diff --git a/changelogs/unreleased/always-link-instance-configuration.yml b/changelogs/unreleased/always-link-instance-configuration.yml
deleted file mode 100644
index 3f08747edf7..00000000000
--- a/changelogs/unreleased/always-link-instance-configuration.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Always show instance configuration link
-merge_request: 26783
-author: Bastian Blank
-type: fixed
diff --git a/changelogs/unreleased/an-use-labkit.yml b/changelogs/unreleased/an-use-labkit.yml
deleted file mode 100644
index ab293c15787..00000000000
--- a/changelogs/unreleased/an-use-labkit.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Migrate correlation and tracing code to LabKit
-merge_request: 25379
-author:
-type: other
diff --git a/changelogs/unreleased/api_masked_variables.yml b/changelogs/unreleased/api_masked_variables.yml
new file mode 100644
index 00000000000..3605339cb91
--- /dev/null
+++ b/changelogs/unreleased/api_masked_variables.yml
@@ -0,0 +1,5 @@
+---
+title: 'API: Allow to get and set "masked" attribute for variables'
+merge_request: 28381
+author: Mathieu Parent
+type: added
diff --git a/changelogs/unreleased/autodevops_remote_private_helm_repository.yml b/changelogs/unreleased/autodevops_remote_private_helm_repository.yml
deleted file mode 100644
index 5341abb1095..00000000000
--- a/changelogs/unreleased/autodevops_remote_private_helm_repository.yml
+++ /dev/null
@@ -1,6 +0,0 @@
----
-title: Allow linking to a private helm repository by providing credentials, and customisation
- of repository name
-merge_request: 27123
-author: Stuart Moore @stjm-cc
-type: added
diff --git a/changelogs/unreleased/bw-add-graphql-groups.yml b/changelogs/unreleased/bw-add-graphql-groups.yml
deleted file mode 100644
index f72ee1cf2b7..00000000000
--- a/changelogs/unreleased/bw-add-graphql-groups.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Add initial GraphQL query for Groups
-merge_request: 27492
-author:
-type: added
diff --git a/changelogs/unreleased/ce-10725-restructure-project-merge-request-settings-page.yml b/changelogs/unreleased/ce-10725-restructure-project-merge-request-settings-page.yml
deleted file mode 100644
index 7aa9204fe4e..00000000000
--- a/changelogs/unreleased/ce-10725-restructure-project-merge-request-settings-page.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Reorganize project merge request settings
-merge_request: 26834
-author:
-type: changed
diff --git a/changelogs/unreleased/ce-11430-update_clair_local_scan.yml b/changelogs/unreleased/ce-11430-update_clair_local_scan.yml
deleted file mode 100644
index 04bb04c3919..00000000000
--- a/changelogs/unreleased/ce-11430-update_clair_local_scan.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Update clair-local-scan to v2.0.8 for container scanning
-merge_request: 27977
-author:
-type: other
diff --git a/changelogs/unreleased/ce-11542-remove-non-semantic-use-of-row-in-member-listing-controls.yml b/changelogs/unreleased/ce-11542-remove-non-semantic-use-of-row-in-member-listing-controls.yml
deleted file mode 100644
index c2dcd309abd..00000000000
--- a/changelogs/unreleased/ce-11542-remove-non-semantic-use-of-row-in-member-listing-controls.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Remove non-semantic use of `.row` in member listing controls
-merge_request: 28204
-author:
-type: fixed
diff --git a/changelogs/unreleased/ce-4681-autosave.yml b/changelogs/unreleased/ce-4681-autosave.yml
deleted file mode 100644
index 029954ec92b..00000000000
--- a/changelogs/unreleased/ce-4681-autosave.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Autosave description in epics
-merge_request: 27296
-author:
-type: added
diff --git a/changelogs/unreleased/ce-57402-add-issues-statistics-api-endpoints.yml b/changelogs/unreleased/ce-57402-add-issues-statistics-api-endpoints.yml
new file mode 100644
index 00000000000..a626193dc27
--- /dev/null
+++ b/changelogs/unreleased/ce-57402-add-issues-statistics-api-endpoints.yml
@@ -0,0 +1,5 @@
+---
+title: Add issues_statistics api endpoints and extend issues search api
+merge_request: 27366
+author:
+type: added
diff --git a/changelogs/unreleased/ce-its-simple-just-destroy-the-mirrors.yml b/changelogs/unreleased/ce-its-simple-just-destroy-the-mirrors.yml
deleted file mode 100644
index ac5fc27cf36..00000000000
--- a/changelogs/unreleased/ce-its-simple-just-destroy-the-mirrors.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Destroy project remote mirrors instead of disabling
-merge_request: 27087
-author:
-type: security
diff --git a/changelogs/unreleased/ce-quick-fix-58727-collapsed-sidebar-flyout-menu-items-don-t-appear-in-1200px-screen-size.yml b/changelogs/unreleased/ce-quick-fix-58727-collapsed-sidebar-flyout-menu-items-don-t-appear-in-1200px-screen-size.yml
new file mode 100644
index 00000000000..332105bb269
--- /dev/null
+++ b/changelogs/unreleased/ce-quick-fix-58727-collapsed-sidebar-flyout-menu-items-don-t-appear-in-1200px-screen-size.yml
@@ -0,0 +1,5 @@
+---
+title: Fix flyout nav on small viewports
+merge_request: 25998
+author:
+type: fixed
diff --git a/changelogs/unreleased/ce-remove-already-signed-in.yml b/changelogs/unreleased/ce-remove-already-signed-in.yml
deleted file mode 100644
index 70bed136ced..00000000000
--- a/changelogs/unreleased/ce-remove-already-signed-in.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Remove "You are already signed in" banner
-merge_request: 27377
-author:
-type: other
diff --git a/changelogs/unreleased/ci-lint-ssl-error.yml b/changelogs/unreleased/ci-lint-ssl-error.yml
deleted file mode 100644
index d59b9204357..00000000000
--- a/changelogs/unreleased/ci-lint-ssl-error.yml
+++ /dev/null
@@ -1,6 +0,0 @@
----
-title: Catch and report OpenSSL exceptions while fetching external configuration files
- in CI::Config
-merge_request: 26750
-author: Drew Cimino
-type: fixed
diff --git a/changelogs/unreleased/da-sentry-client-side-settings.yml b/changelogs/unreleased/da-sentry-client-side-settings.yml
deleted file mode 100644
index e36ac7c354b..00000000000
--- a/changelogs/unreleased/da-sentry-client-side-settings.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Allow Sentry client-side DSN to be passed on gitlab.yml
-merge_request: 27967
-author:
-type: added
diff --git a/changelogs/unreleased/delay-update-statictics.yml b/changelogs/unreleased/delay-update-statictics.yml
deleted file mode 100644
index d0201fb6db8..00000000000
--- a/changelogs/unreleased/delay-update-statictics.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix the bug that the project statistics is not updated
-merge_request: 26854
-author: Hiroyuki Sato
-type: fixed
diff --git a/changelogs/unreleased/diff-whitespace-setting-changes.yml b/changelogs/unreleased/diff-whitespace-setting-changes.yml
new file mode 100644
index 00000000000..640e9e589df
--- /dev/null
+++ b/changelogs/unreleased/diff-whitespace-setting-changes.yml
@@ -0,0 +1,5 @@
+---
+title: Fixed show whitespace button not refetching diff content
+merge_request:
+author:
+type: fixed
diff --git a/changelogs/unreleased/display-junit-classname-in-modal.yml b/changelogs/unreleased/display-junit-classname-in-modal.yml
new file mode 100644
index 00000000000..c5140456e4e
--- /dev/null
+++ b/changelogs/unreleased/display-junit-classname-in-modal.yml
@@ -0,0 +1,5 @@
+---
+title: Display classname JUnit attribute in report modal
+merge_request: 28376
+author:
+type: added
diff --git a/changelogs/unreleased/do-not-reopen-merged-mr.yml b/changelogs/unreleased/do-not-reopen-merged-mr.yml
deleted file mode 100644
index 14d1455cca4..00000000000
--- a/changelogs/unreleased/do-not-reopen-merged-mr.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Remove a "reopen merge request button" on a "merged" merge request
-merge_request: 26965
-author: Hiroyuki Sato
-type: fixed
diff --git a/changelogs/unreleased/downloading-expired-artifacts.yml b/changelogs/unreleased/downloading-expired-artifacts.yml
deleted file mode 100644
index 2f4b79ca106..00000000000
--- a/changelogs/unreleased/downloading-expired-artifacts.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: stop rendering download links for expired artifacts on the project tags page
-merge_request: 26753
-author: Drew Cimino
-type: fixed
diff --git a/changelogs/unreleased/dz-patch-58.yml b/changelogs/unreleased/dz-patch-58.yml
new file mode 100644
index 00000000000..97ceadd303d
--- /dev/null
+++ b/changelogs/unreleased/dz-patch-58.yml
@@ -0,0 +1,5 @@
+---
+title: Replace Oxygen-Sans font with Noto Sans
+merge_request: 28322
+author:
+type: changed
diff --git a/changelogs/unreleased/dz-scope-project-routes.yml b/changelogs/unreleased/dz-scope-project-routes.yml
new file mode 100644
index 00000000000..66eb5d928f0
--- /dev/null
+++ b/changelogs/unreleased/dz-scope-project-routes.yml
@@ -0,0 +1,5 @@
+---
+title: Move some project routes under /-/ scope
+merge_request: 28435
+author:
+type: changed
diff --git a/changelogs/unreleased/expand-diff-performance.yml b/changelogs/unreleased/expand-diff-performance.yml
deleted file mode 100644
index 134ea4081e4..00000000000
--- a/changelogs/unreleased/expand-diff-performance.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Improve expanding diff to full file performance
-merge_request:
-author:
-type: changed
diff --git a/changelogs/unreleased/expose-pipeline-variables-via-api.yml b/changelogs/unreleased/expose-pipeline-variables-via-api.yml
deleted file mode 100644
index f37bf0c5cd8..00000000000
--- a/changelogs/unreleased/expose-pipeline-variables-via-api.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Expose pipeline variables via API
-merge_request: 26501
-author: Agustin Henze <tin@redhat.com>
-type: added
diff --git a/changelogs/unreleased/feat-sentry-environment.yml b/changelogs/unreleased/feat-sentry-environment.yml
deleted file mode 100644
index 44ea19375f8..00000000000
--- a/changelogs/unreleased/feat-sentry-environment.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Allow Sentry configuration to be passed on gitlab.yml
-merge_request: 27091
-author: Roger Meier
-type: added
diff --git a/changelogs/unreleased/fix-api-group-visibility.yml b/changelogs/unreleased/fix-api-group-visibility.yml
deleted file mode 100644
index 7fbdcd729c6..00000000000
--- a/changelogs/unreleased/fix-api-group-visibility.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix api group visibility
-merge_request: 26896
-author:
-type: fixed
diff --git a/changelogs/unreleased/fix-api-ide-relative-url-root.yml b/changelogs/unreleased/fix-api-ide-relative-url-root.yml
deleted file mode 100644
index 8c058645f3e..00000000000
--- a/changelogs/unreleased/fix-api-ide-relative-url-root.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix FE API and IDE handling of '/' relative_url_root
-merge_request: 27635
-author:
-type: fixed
diff --git a/changelogs/unreleased/fix-db-migrate-is-failed-on-mysql8.yml b/changelogs/unreleased/fix-db-migrate-is-failed-on-mysql8.yml
new file mode 100644
index 00000000000..63f134808e3
--- /dev/null
+++ b/changelogs/unreleased/fix-db-migrate-is-failed-on-mysql8.yml
@@ -0,0 +1,5 @@
+---
+title: Fix. `db:migrate` is failed on MySQL 8
+merge_request: 28351
+author: sue445
+type: fixed
diff --git a/changelogs/unreleased/fix-extra-emails-for-custom-notifications.yml b/changelogs/unreleased/fix-extra-emails-for-custom-notifications.yml
deleted file mode 100644
index 6eb3225e4a1..00000000000
--- a/changelogs/unreleased/fix-extra-emails-for-custom-notifications.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix extra emails for custom notifications
-merge_request: 25607
-author:
-type: fixed
diff --git a/changelogs/unreleased/fix-ide-relative-url-bug.yml b/changelogs/unreleased/fix-ide-relative-url-bug.yml
deleted file mode 100644
index 183af722657..00000000000
--- a/changelogs/unreleased/fix-ide-relative-url-bug.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix IDE get file data with '/' as relative root
-merge_request: 27911
-author:
-type: fixed
diff --git a/changelogs/unreleased/fix-import-member-access.yml b/changelogs/unreleased/fix-import-member-access.yml
new file mode 100644
index 00000000000..5dc4ae738f8
--- /dev/null
+++ b/changelogs/unreleased/fix-import-member-access.yml
@@ -0,0 +1,5 @@
+---
+title: Fix issue importing members with owner access
+merge_request: 28636
+author:
+type: fixed
diff --git a/changelogs/unreleased/fix-js-error-ssh-key-view.yml b/changelogs/unreleased/fix-js-error-ssh-key-view.yml
deleted file mode 100644
index 0615f2ee217..00000000000
--- a/changelogs/unreleased/fix-js-error-ssh-key-view.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: disable SSH key validation in key details view
-merge_request: 28180
-author: Roger Meier
-type: fixed
diff --git a/changelogs/unreleased/fix-lazy-blobs-requesting-all-previous-blobs.yml b/changelogs/unreleased/fix-lazy-blobs-requesting-all-previous-blobs.yml
deleted file mode 100644
index 58f5a9c943c..00000000000
--- a/changelogs/unreleased/fix-lazy-blobs-requesting-all-previous-blobs.yml
+++ /dev/null
@@ -1,6 +0,0 @@
----
-title: Fix Blob.lazy always loading all previously-requested blobs when a new request
- is made
-merge_request:
-author:
-type: performance
diff --git a/changelogs/unreleased/fix-merge-request-pipeline-exist-method.yml b/changelogs/unreleased/fix-merge-request-pipeline-exist-method.yml
deleted file mode 100644
index 294a665ff3e..00000000000
--- a/changelogs/unreleased/fix-merge-request-pipeline-exist-method.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix duplicate merge request pipelines created by Sidekiq worker retry
-merge_request: 26643
-author:
-type: fixed
diff --git a/changelogs/unreleased/fix-project-visibility-level-validation.yml b/changelogs/unreleased/fix-project-visibility-level-validation.yml
deleted file mode 100644
index 9581a475842..00000000000
--- a/changelogs/unreleased/fix-project-visibility-level-validation.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix project visibility level validation
-merge_request: 28305
-author: Peter Marko
-type: fixed
diff --git a/changelogs/unreleased/fix-schedule-head-pipeline-update-method.yml b/changelogs/unreleased/fix-schedule-head-pipeline-update-method.yml
deleted file mode 100644
index 5e574ef686c..00000000000
--- a/changelogs/unreleased/fix-schedule-head-pipeline-update-method.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix update head pipeline process of Pipelines for merge requests
-merge_request: 28057
-author:
-type: fixed
diff --git a/changelogs/unreleased/fix-too-many-loops-cron-error.yml b/changelogs/unreleased/fix-too-many-loops-cron-error.yml
new file mode 100644
index 00000000000..a9b5b761439
--- /dev/null
+++ b/changelogs/unreleased/fix-too-many-loops-cron-error.yml
@@ -0,0 +1,5 @@
+---
+title: Fix "too many loops" error by handling gracefully cron schedules for non existent days
+merge_request: 28002
+author:
+type: fixed
diff --git a/changelogs/unreleased/fix-webpack-assets-relative-url-bug.yml b/changelogs/unreleased/fix-webpack-assets-relative-url-bug.yml
deleted file mode 100644
index 80936245f3e..00000000000
--- a/changelogs/unreleased/fix-webpack-assets-relative-url-bug.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix webpack assets handling when relative url root is '/'
-merge_request: 27909
-author:
-type: fixed
diff --git a/changelogs/unreleased/fj-53523-add-option-avoid-loading-wiki-page-content.yml b/changelogs/unreleased/fj-53523-add-option-avoid-loading-wiki-page-content.yml
deleted file mode 100644
index 49eaff52e5a..00000000000
--- a/changelogs/unreleased/fj-53523-add-option-avoid-loading-wiki-page-content.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Added list_pages method to avoid loading all wiki pages content
-merge_request: 22801
-author:
-type: performance
diff --git a/changelogs/unreleased/fj-59522-improve-search-controller-performance.yml b/changelogs/unreleased/fj-59522-improve-search-controller-performance.yml
deleted file mode 100644
index c513f3c3aeb..00000000000
--- a/changelogs/unreleased/fj-59522-improve-search-controller-performance.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Add improvements to global search of issues and merge requests
-merge_request: 27817
-author:
-type: performance
diff --git a/changelogs/unreleased/fj-bump-workhorse-version-8-6-0.yml b/changelogs/unreleased/fj-bump-workhorse-version-8-6-0.yml
deleted file mode 100644
index e53499e21ba..00000000000
--- a/changelogs/unreleased/fj-bump-workhorse-version-8-6-0.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Update GitLab Workhorse to v8.6.0
-merge_request: 27260
-author:
-type: fixed
diff --git a/changelogs/unreleased/friendly-wrap-component.yml b/changelogs/unreleased/friendly-wrap-component.yml
deleted file mode 100644
index c16ca0af287..00000000000
--- a/changelogs/unreleased/friendly-wrap-component.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Add CSS fix for <wbr> elements on IE11
-merge_request: 27846
-author:
-type: other
diff --git a/changelogs/unreleased/frozen-string-spec-some.yml b/changelogs/unreleased/frozen-string-spec-some.yml
deleted file mode 100644
index 55381d7ccbe..00000000000
--- a/changelogs/unreleased/frozen-string-spec-some.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Add some frozen string to spec/**/*.rb
-merge_request:
-author: gfyoung
-type: other
diff --git a/changelogs/unreleased/gitaly-version-v1.36.0.yml b/changelogs/unreleased/gitaly-version-v1.36.0.yml
deleted file mode 100644
index 22fdca8da80..00000000000
--- a/changelogs/unreleased/gitaly-version-v1.36.0.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Upgrade to Gitaly v1.36.0
-merge_request: 27831
-author:
-type: changed
diff --git a/changelogs/unreleased/gitaly-version-v1.42.0.yml b/changelogs/unreleased/gitaly-version-v1.42.0.yml
deleted file mode 100644
index 38621fa071e..00000000000
--- a/changelogs/unreleased/gitaly-version-v1.42.0.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Upgrade to Gitaly v1.42.0
-merge_request: 28135
-author:
-type: changed
diff --git a/changelogs/unreleased/gitlab-issue-54894.yml b/changelogs/unreleased/gitlab-issue-54894.yml
deleted file mode 100644
index 513c0163c0e..00000000000
--- a/changelogs/unreleased/gitlab-issue-54894.yml
+++ /dev/null
@@ -1,6 +0,0 @@
----
-title: Fix some label links not appearing on group labels page and label title being
- a link on project labels page
-merge_request: 24060
-author: Tanya Pazitny
-type: fixed
diff --git a/changelogs/unreleased/graphql-resolvers-complexity.yml b/changelogs/unreleased/graphql-resolvers-complexity.yml
deleted file mode 100644
index 503ffbd97f2..00000000000
--- a/changelogs/unreleased/graphql-resolvers-complexity.yml
+++ /dev/null
@@ -1,6 +0,0 @@
----
-title: 'GraphQL: improve evaluation of query complexity based on arguments and query
- limits.'
-merge_request: 28017
-author:
-type: added
diff --git a/changelogs/unreleased/include-ee-fixtures.yml b/changelogs/unreleased/include-ee-fixtures.yml
deleted file mode 100644
index ba500d92de3..00000000000
--- a/changelogs/unreleased/include-ee-fixtures.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Add EE fixtures to SeedFu list
-merge_request: 28241
-author:
-type: other
diff --git a/changelogs/unreleased/instance-configuration-artifact-size.yml b/changelogs/unreleased/instance-configuration-artifact-size.yml
deleted file mode 100644
index 077f8631af5..00000000000
--- a/changelogs/unreleased/instance-configuration-artifact-size.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Display maximum artifact size from runtime config
-merge_request: 26784
-author: Bastian Blank
-type: fixed
diff --git a/changelogs/unreleased/instance_level_clusters.yml b/changelogs/unreleased/instance_level_clusters.yml
deleted file mode 100644
index afd06a4e05f..00000000000
--- a/changelogs/unreleased/instance_level_clusters.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Instance level kubernetes clusters
-merge_request: 27196
-author:
-type: added
diff --git a/changelogs/unreleased/issue-42692-deployment-chat-notifications.yml b/changelogs/unreleased/issue-42692-deployment-chat-notifications.yml
deleted file mode 100644
index 3f0a96ad50e..00000000000
--- a/changelogs/unreleased/issue-42692-deployment-chat-notifications.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Add deployment events to chat notification services
-merge_request: 27338
-author:
-type: added
diff --git a/changelogs/unreleased/issue-58418-release-notes.yml b/changelogs/unreleased/issue-58418-release-notes.yml
deleted file mode 100644
index 80e6529eb12..00000000000
--- a/changelogs/unreleased/issue-58418-release-notes.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Set release name when adding release notes to an existing tag
-merge_request: 26807
-author:
-type: fixed
diff --git a/changelogs/unreleased/issue-61038-deploy-chat-message-update.yml b/changelogs/unreleased/issue-61038-deploy-chat-message-update.yml
deleted file mode 100644
index c85ddc7b91c..00000000000
--- a/changelogs/unreleased/issue-61038-deploy-chat-message-update.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Update deployment event chat notification message
-merge_request: 27972
-author:
-type: changed
diff --git a/changelogs/unreleased/issue_57906_fix_github_import.yml b/changelogs/unreleased/issue_57906_fix_github_import.yml
deleted file mode 100644
index d28a78d5d11..00000000000
--- a/changelogs/unreleased/issue_57906_fix_github_import.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix issuables state_id nil when importing projects from GitHub
-merge_request: 28027
-author:
-type: fixed
diff --git a/changelogs/unreleased/jc-client-gitaly-session-id.yml b/changelogs/unreleased/jc-client-gitaly-session-id.yml
deleted file mode 100644
index ae5b7144b98..00000000000
--- a/changelogs/unreleased/jc-client-gitaly-session-id.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Add gitaly session id & catfile-cache feature flag
-merge_request: 27472
-author:
-type: performance
diff --git a/changelogs/unreleased/jc-omit-count-diverging-commits-max.yml b/changelogs/unreleased/jc-omit-count-diverging-commits-max.yml
new file mode 100644
index 00000000000..23235060a98
--- /dev/null
+++ b/changelogs/unreleased/jc-omit-count-diverging-commits-max.yml
@@ -0,0 +1,5 @@
+---
+title: Omit max-count for diverging_commit_counts behind feature flag
+merge_request: 28157
+author:
+type: other
diff --git a/changelogs/unreleased/jc-update-list-last-commits.yml b/changelogs/unreleased/jc-update-list-last-commits.yml
deleted file mode 100644
index 0e72c4255ae..00000000000
--- a/changelogs/unreleased/jc-update-list-last-commits.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Client side changes for ListLastCommitsForTree response update
-merge_request: 26880
-author:
-type: fixed
diff --git a/changelogs/unreleased/jupyter_pre_spawn_hook_v2.yml b/changelogs/unreleased/jupyter_pre_spawn_hook_v2.yml
new file mode 100644
index 00000000000..c5918df8193
--- /dev/null
+++ b/changelogs/unreleased/jupyter_pre_spawn_hook_v2.yml
@@ -0,0 +1,5 @@
+---
+title: Pass user's identity and token from JupyterHub to user's Jupyter environment
+merge_request: 27314
+author: Amit Rathi
+type: added
diff --git a/changelogs/unreleased/jv-dedup-activerecord.yml b/changelogs/unreleased/jv-dedup-activerecord.yml
deleted file mode 100644
index 7b440c7c0db..00000000000
--- a/changelogs/unreleased/jv-dedup-activerecord.yml
+++ /dev/null
@@ -1,6 +0,0 @@
----
-title: Fix wrong use of ActiveRecord in PoolRepository
-merge_request: 27464
-author:
-type: fixed
-
diff --git a/changelogs/unreleased/kinolaev-master-patch-13154.yml b/changelogs/unreleased/kinolaev-master-patch-13154.yml
new file mode 100644
index 00000000000..3292ff797e2
--- /dev/null
+++ b/changelogs/unreleased/kinolaev-master-patch-13154.yml
@@ -0,0 +1,5 @@
+---
+title: 'Auto-DevOps: allow to disable rollout status check'
+merge_request: 28130
+author: Sergej Nikolaev <kinolaev@gmail.com>
+type: fixed
diff --git a/changelogs/unreleased/knative-0-5.yml b/changelogs/unreleased/knative-0-5.yml
deleted file mode 100644
index c7112b957e9..00000000000
--- a/changelogs/unreleased/knative-0-5.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Knative version bump 0.3 -> 0.5
-merge_request:
-author: Chris Baumbauer <cab@cabnetworks.net>
-type: changed
diff --git a/changelogs/unreleased/leipert-node-12-compatibility.yml b/changelogs/unreleased/leipert-node-12-compatibility.yml
new file mode 100644
index 00000000000..18025d33a6d
--- /dev/null
+++ b/changelogs/unreleased/leipert-node-12-compatibility.yml
@@ -0,0 +1,5 @@
+---
+title: Upgrade dependencies for node 12 compatibility
+merge_request: 28323
+author:
+type: fixed
diff --git a/changelogs/unreleased/make-autocomplete-faster-with-lots-of-results.yml b/changelogs/unreleased/make-autocomplete-faster-with-lots-of-results.yml
new file mode 100644
index 00000000000..daeefd3ffd7
--- /dev/null
+++ b/changelogs/unreleased/make-autocomplete-faster-with-lots-of-results.yml
@@ -0,0 +1,5 @@
+---
+title: Improve performance of users autocomplete when there are lots of results
+merge_request:
+author:
+type: performance
diff --git a/changelogs/unreleased/mark-comment-resolved.yml b/changelogs/unreleased/mark-comment-resolved.yml
new file mode 100644
index 00000000000..3343d18d16f
--- /dev/null
+++ b/changelogs/unreleased/mark-comment-resolved.yml
@@ -0,0 +1,5 @@
+---
+title: Change resolve button text to mark comment as resolved
+merge_request:
+author:
+type: fixed
diff --git a/changelogs/unreleased/markdown-autocomplete-escaping.yml b/changelogs/unreleased/markdown-autocomplete-escaping.yml
deleted file mode 100644
index 0ea034b14ee..00000000000
--- a/changelogs/unreleased/markdown-autocomplete-escaping.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Only escape Markdown emphasis characters in autocomplete when necessary
-merge_request: 27457
-author:
-type: changed
diff --git a/changelogs/unreleased/member-access-granted-leave-email-fe.yml b/changelogs/unreleased/member-access-granted-leave-email-fe.yml
deleted file mode 100644
index 919a2464a4d..00000000000
--- a/changelogs/unreleased/member-access-granted-leave-email-fe.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Leave project/group from access granted email
-merge_request: 27892
-author:
-type: added
diff --git a/changelogs/unreleased/mm12935.yml b/changelogs/unreleased/mm12935.yml
new file mode 100644
index 00000000000..782586c514e
--- /dev/null
+++ b/changelogs/unreleased/mm12935.yml
@@ -0,0 +1,5 @@
+---
+title: Remove Content-Type override for Mattermost OAuth login
+merge_request:
+author: Harrison Healey
+type: removed
diff --git a/changelogs/unreleased/patch-49.yml b/changelogs/unreleased/patch-49.yml
deleted file mode 100644
index 2c8af1e5c48..00000000000
--- a/changelogs/unreleased/patch-49.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Remove leading / trailing spaces from heading when generating header ids
-merge_request: 27025
-author: Willian Balmant
-type: fixed
diff --git a/changelogs/unreleased/patch-55.yml b/changelogs/unreleased/patch-55.yml
new file mode 100644
index 00000000000..7a6d6bfed2f
--- /dev/null
+++ b/changelogs/unreleased/patch-55.yml
@@ -0,0 +1,5 @@
+---
+title: Better isolated `Docker.gitlab-ci.yml` to avoid interference with other job configurations.
+merge_request: 28213
+author: lrkwz
+type: changed
diff --git a/changelogs/unreleased/pl-upgrade-letter_opener_web.yml b/changelogs/unreleased/pl-upgrade-letter_opener_web.yml
deleted file mode 100644
index 9891344215a..00000000000
--- a/changelogs/unreleased/pl-upgrade-letter_opener_web.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Upgrade letter_opener_web to support Rails 5.1
-merge_request: 27829
-author:
-type: fixed
diff --git a/changelogs/unreleased/rails5-1.yml b/changelogs/unreleased/rails5-1.yml
deleted file mode 100644
index da16735bb0d..00000000000
--- a/changelogs/unreleased/rails5-1.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Upgrade to Rails 5.1
-merge_request: 27480
-author: Jasper Maes
-type: other
diff --git a/changelogs/unreleased/refactor-58827-migrate-issue-spec-to-jest.yml b/changelogs/unreleased/refactor-58827-migrate-issue-spec-to-jest.yml
deleted file mode 100644
index 03d94c39c10..00000000000
--- a/changelogs/unreleased/refactor-58827-migrate-issue-spec-to-jest.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: 'refactor(issue): Refactored issue tests from Karma to Jest'
-merge_request: 27673
-author: Martin Hobert
-type: other
diff --git a/changelogs/unreleased/refactor-58829-migrate-notes-spec-to-jest.yml b/changelogs/unreleased/refactor-58829-migrate-notes-spec-to-jest.yml
deleted file mode 100644
index 9a1886797da..00000000000
--- a/changelogs/unreleased/refactor-58829-migrate-notes-spec-to-jest.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: 'Refactored notes tests from Karma to Jest'
-merge_request: 27648
-author: Martin Hobert
-type: other
diff --git a/changelogs/unreleased/refactor-58830-migrate-sidebar-spec-to-jest.yml b/changelogs/unreleased/refactor-58830-migrate-sidebar-spec-to-jest.yml
deleted file mode 100644
index 20a4be8c9ad..00000000000
--- a/changelogs/unreleased/refactor-58830-migrate-sidebar-spec-to-jest.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: 'Refactored Karma spec files to Jest'
-merge_request: 27688
-author: Martin Hobert
-type: other
diff --git a/changelogs/unreleased/relative-urls-for-system-notes.yml b/changelogs/unreleased/relative-urls-for-system-notes.yml
new file mode 100644
index 00000000000..ec834e9f277
--- /dev/null
+++ b/changelogs/unreleased/relative-urls-for-system-notes.yml
@@ -0,0 +1,5 @@
+---
+title: Change links in system notes to use relative paths
+merge_request: 28588
+author: Luke Picciau
+type: fixed
diff --git a/changelogs/unreleased/remove-disabled-pages-domains-part-2.yml b/changelogs/unreleased/remove-disabled-pages-domains-part-2.yml
deleted file mode 100644
index 9b208cbaa0e..00000000000
--- a/changelogs/unreleased/remove-disabled-pages-domains-part-2.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Remove pages domains if they weren't verified for 1 week
-merge_request: 26227
-author:
-type: added
diff --git a/changelogs/unreleased/remove-disabled-pages-domains.yml b/changelogs/unreleased/remove-disabled-pages-domains.yml
deleted file mode 100644
index e23561329ef..00000000000
--- a/changelogs/unreleased/remove-disabled-pages-domains.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Mark disabled pages domains for removal, but don't remove them yet
-merge_request: 26212
-author:
-type: added
diff --git a/changelogs/unreleased/rename_auto_deploy_app_links.yml b/changelogs/unreleased/rename_auto_deploy_app_links.yml
deleted file mode 100644
index c56b5fb5e5c..00000000000
--- a/changelogs/unreleased/rename_auto_deploy_app_links.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Move location of charts/auto-deploy-app -> gitlab-org/charts/auto-deploy-app
-merge_request: 27477
-author:
-type: changed
diff --git a/changelogs/unreleased/require-all-templates-to-include-default-stages.yml b/changelogs/unreleased/require-all-templates-to-include-default-stages.yml
deleted file mode 100644
index de8b07160ba..00000000000
--- a/changelogs/unreleased/require-all-templates-to-include-default-stages.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Require all templates to use default stages
-merge_request: 26954
-author:
-type: fixed
diff --git a/changelogs/unreleased/rewind-iid-on-pipelines.yml b/changelogs/unreleased/rewind-iid-on-pipelines.yml
deleted file mode 100644
index b5738860024..00000000000
--- a/changelogs/unreleased/rewind-iid-on-pipelines.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Rewind IID on Ci::Pipelines
-merge_request: 26490
-author:
-type: fixed
diff --git a/changelogs/unreleased/sh-add-gitaly-backtrace.yml b/changelogs/unreleased/sh-add-gitaly-backtrace.yml
deleted file mode 100644
index 1515edd6db9..00000000000
--- a/changelogs/unreleased/sh-add-gitaly-backtrace.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Add backtrace to Gitaly performance bar
-merge_request: 27345
-author:
-type: other
diff --git a/changelogs/unreleased/sh-allow-equal-level-in-subgroup-membership.yml b/changelogs/unreleased/sh-allow-equal-level-in-subgroup-membership.yml
deleted file mode 100644
index adbed52db81..00000000000
--- a/changelogs/unreleased/sh-allow-equal-level-in-subgroup-membership.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Allow a member to have an access level equal to parent group
-merge_request: 27913
-author:
-type: fixed
diff --git a/changelogs/unreleased/sh-avoid-fetching-temp-refs-within-project.yml b/changelogs/unreleased/sh-avoid-fetching-temp-refs-within-project.yml
deleted file mode 100644
index 7511543f7f6..00000000000
--- a/changelogs/unreleased/sh-avoid-fetching-temp-refs-within-project.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Don't create a temp reference for branch comparisons within project
-merge_request: 24038
-author:
-type: fixed
diff --git a/changelogs/unreleased/sh-cleanup-import-export.yml b/changelogs/unreleased/sh-cleanup-import-export.yml
deleted file mode 100644
index 3d5d6f3c907..00000000000
--- a/changelogs/unreleased/sh-cleanup-import-export.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Clean up CarrierWave's import/export files
-merge_request: 27487
-author:
-type: fixed
diff --git a/changelogs/unreleased/sh-disable-batch-load-replace-methods.yml b/changelogs/unreleased/sh-disable-batch-load-replace-methods.yml
deleted file mode 100644
index 00f897ac4b1..00000000000
--- a/changelogs/unreleased/sh-disable-batch-load-replace-methods.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Disable method replacement in avatar loading
-merge_request: 27866
-author:
-type: performance
diff --git a/changelogs/unreleased/sh-disable-internal-ids-available-check.yml b/changelogs/unreleased/sh-disable-internal-ids-available-check.yml
deleted file mode 100644
index 069a9ba7d69..00000000000
--- a/changelogs/unreleased/sh-disable-internal-ids-available-check.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Always use internal ID tables in development and production
-merge_request: 27544
-author:
-type: fixed
diff --git a/changelogs/unreleased/sh-fix-autocomplete-mirror-repo.yml b/changelogs/unreleased/sh-fix-autocomplete-mirror-repo.yml
deleted file mode 100644
index e855684bab1..00000000000
--- a/changelogs/unreleased/sh-fix-autocomplete-mirror-repo.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Disable password autocomplete in mirror repository form
-merge_request: 27542
-author:
-type: fixed
diff --git a/changelogs/unreleased/sh-fix-invited-members.yml b/changelogs/unreleased/sh-fix-invited-members.yml
deleted file mode 100644
index 96e43e1aa53..00000000000
--- a/changelogs/unreleased/sh-fix-invited-members.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix Error 500 when inviting user already present
-merge_request: 28198
-author:
-type: fixed
diff --git a/changelogs/unreleased/sh-fix-lfs-download-errors.yml b/changelogs/unreleased/sh-fix-lfs-download-errors.yml
deleted file mode 100644
index ad67df6bb06..00000000000
--- a/changelogs/unreleased/sh-fix-lfs-download-errors.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Properly handle LFS Batch API response in project import
-merge_request: 28223
-author:
-type: fixed
diff --git a/changelogs/unreleased/sh-fix-pipeline-delete-caching.yml b/changelogs/unreleased/sh-fix-pipeline-delete-caching.yml
deleted file mode 100644
index 98846ea9825..00000000000
--- a/changelogs/unreleased/sh-fix-pipeline-delete-caching.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Properly expire all pipeline caches when pipeline is deleted
-merge_request: 27334
-author:
-type: fixed
diff --git a/changelogs/unreleased/sh-fix-rebase-error-clearing.yml b/changelogs/unreleased/sh-fix-rebase-error-clearing.yml
new file mode 100644
index 00000000000..4f5f2779e7f
--- /dev/null
+++ b/changelogs/unreleased/sh-fix-rebase-error-clearing.yml
@@ -0,0 +1,5 @@
+---
+title: Properly clear the merge error upon rebase failure
+merge_request: 28319
+author:
+type: fixed
diff --git a/changelogs/unreleased/sh-fix-related-merge-requests-path.yml b/changelogs/unreleased/sh-fix-related-merge-requests-path.yml
deleted file mode 100644
index 4b4108feda4..00000000000
--- a/changelogs/unreleased/sh-fix-related-merge-requests-path.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Use a path for the related merge requests endpoint
-merge_request: 28171
-author:
-type: fixed
diff --git a/changelogs/unreleased/sh-fix-tag-push-remote-mirror.yml b/changelogs/unreleased/sh-fix-tag-push-remote-mirror.yml
new file mode 100644
index 00000000000..7f33ab28e3d
--- /dev/null
+++ b/changelogs/unreleased/sh-fix-tag-push-remote-mirror.yml
@@ -0,0 +1,5 @@
+---
+title: Fix remote mirrors not updating after tag push
+merge_request:
+author:
+type: fixed
diff --git a/changelogs/unreleased/sh-project-import-visibility-error.yml b/changelogs/unreleased/sh-project-import-visibility-error.yml
new file mode 100644
index 00000000000..eb7e001c6aa
--- /dev/null
+++ b/changelogs/unreleased/sh-project-import-visibility-error.yml
@@ -0,0 +1,5 @@
+---
+title: Fix invalid visibility string comparison in project import
+merge_request: 28612
+author:
+type: fixed
diff --git a/changelogs/unreleased/sh-upgrade-grpc-and-protobuf.yml b/changelogs/unreleased/sh-upgrade-grpc-and-protobuf.yml
deleted file mode 100644
index a43a59a4f8a..00000000000
--- a/changelogs/unreleased/sh-upgrade-grpc-and-protobuf.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Bump gRPC to 1.19.0 and protobuf to 3.7.1
-merge_request: 27086
-author:
-type: other
diff --git a/changelogs/unreleased/sh-validate-ref-name-in-commit.yml b/changelogs/unreleased/sh-validate-ref-name-in-commit.yml
deleted file mode 100644
index 399529556bc..00000000000
--- a/changelogs/unreleased/sh-validate-ref-name-in-commit.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Validate refs used in controllers don't have spaces
-merge_request: 24037
-author:
-type: other
diff --git a/changelogs/unreleased/shell-9-1-0.yml b/changelogs/unreleased/shell-9-1-0.yml
deleted file mode 100644
index d5a01ee57ee..00000000000
--- a/changelogs/unreleased/shell-9-1-0.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Update gitlab-shell to v9.1.0
-merge_request: 28184
-author:
-type: other
diff --git a/changelogs/unreleased/show-disabled-mirrors.yml b/changelogs/unreleased/show-disabled-mirrors.yml
deleted file mode 100644
index a401606b331..00000000000
--- a/changelogs/unreleased/show-disabled-mirrors.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Show disabled project repo mirrors in settings
-merge_request: 27326
-author:
-type: other
diff --git a/changelogs/unreleased/support-negative-matches.yml b/changelogs/unreleased/support-negative-matches.yml
deleted file mode 100644
index 8d3f2d3cbae..00000000000
--- a/changelogs/unreleased/support-negative-matches.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Support negative matches
-merge_request:
-author:
-type: added
diff --git a/changelogs/unreleased/tc-raw-log-in-plaintext-mail.yml b/changelogs/unreleased/tc-raw-log-in-plaintext-mail.yml
deleted file mode 100644
index 373c2847ef2..00000000000
--- a/changelogs/unreleased/tc-raw-log-in-plaintext-mail.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Include link to raw job log in plain-text emails
-merge_request: 27409
-author:
-type: changed
diff --git a/changelogs/unreleased/tortuetorche-gitlab-ce-patch-auto-deploy-extra-values.yml b/changelogs/unreleased/tortuetorche-gitlab-ce-patch-auto-deploy-extra-values.yml
deleted file mode 100644
index 84ed4a8fccb..00000000000
--- a/changelogs/unreleased/tortuetorche-gitlab-ce-patch-auto-deploy-extra-values.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Allow extra arguments in helm commands when deploying the application in Auto-DevOps.gitlab-ci.yml
-merge_request: 26171
-author: tortuetorche
-type: changed
diff --git a/changelogs/unreleased/update-babel-to-7-4-4.yml b/changelogs/unreleased/update-babel-to-7-4-4.yml
new file mode 100644
index 00000000000..0d4b4700bb2
--- /dev/null
+++ b/changelogs/unreleased/update-babel-to-7-4-4.yml
@@ -0,0 +1,5 @@
+---
+title: Upgrade babel to 7.4.4
+merge_request: 28437
+author: Takuya Noguchi
+type: other
diff --git a/changelogs/unreleased/update-gitaly-to-v1-42-1.yml b/changelogs/unreleased/update-gitaly-to-v1-42-1.yml
new file mode 100644
index 00000000000..ff42bdd9c0b
--- /dev/null
+++ b/changelogs/unreleased/update-gitaly-to-v1-42-1.yml
@@ -0,0 +1,5 @@
+---
+title: "Update Gitaly to v1.42.1"
+merge_request: 28425
+author:
+type: other
diff --git a/changelogs/unreleased/update-gitlab-runner-helm-chart-to-0-4-0.yml b/changelogs/unreleased/update-gitlab-runner-helm-chart-to-0-4-0.yml
deleted file mode 100644
index 7eb5bd58035..00000000000
--- a/changelogs/unreleased/update-gitlab-runner-helm-chart-to-0-4-0.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Update GitLab Runner Helm Chart to 0.4.0
-merge_request: 27508
-author:
-type: other
diff --git a/changelogs/unreleased/update-gitlab-runner-helm-chart-to-0-4-1.yml b/changelogs/unreleased/update-gitlab-runner-helm-chart-to-0-4-1.yml
deleted file mode 100644
index f36c1d0e77e..00000000000
--- a/changelogs/unreleased/update-gitlab-runner-helm-chart-to-0-4-1.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Update GitLab Runner Helm Chart to 0.4.1
-merge_request: 27627
-author:
-type: other
diff --git a/changelogs/unreleased/update-gitlab-runner-helm-chart-to-0-5-0.yml b/changelogs/unreleased/update-gitlab-runner-helm-chart-to-0-5-0.yml
new file mode 100644
index 00000000000..494331158fb
--- /dev/null
+++ b/changelogs/unreleased/update-gitlab-runner-helm-chart-to-0-5-0.yml
@@ -0,0 +1,5 @@
+---
+title: Update GitLab Runner Helm Chart to 0.5.0
+merge_request: 28497
+author:
+type: other
diff --git a/changelogs/unreleased/update-smileys-new.yml b/changelogs/unreleased/update-smileys-new.yml
new file mode 100644
index 00000000000..0e3f606c81b
--- /dev/null
+++ b/changelogs/unreleased/update-smileys-new.yml
@@ -0,0 +1,5 @@
+---
+title: Update new smiley icons, find n replace old names with new ones
+merge_request: 28338
+author: Jarek Ostrowski
+type: changed
diff --git a/changelogs/unreleased/update-workhorse-master.yml b/changelogs/unreleased/update-workhorse-master.yml
deleted file mode 100644
index 97e2e891ab1..00000000000
--- a/changelogs/unreleased/update-workhorse-master.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Update Workhorse to v8.7.0
-merge_request: 27630
-author:
-type: fixed
diff --git a/changelogs/unreleased/use-pg-10-7.yml b/changelogs/unreleased/use-pg-10-7.yml
deleted file mode 100644
index aa57c3a6a17..00000000000
--- a/changelogs/unreleased/use-pg-10-7.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Use PostgreSQL 10.7 in tests
-merge_request: 28020
-author:
-type: other
diff --git a/changelogs/unreleased/weimeng-user-autocomplete-fix.yml b/changelogs/unreleased/weimeng-user-autocomplete-fix.yml
deleted file mode 100644
index aca9fc4be30..00000000000
--- a/changelogs/unreleased/weimeng-user-autocomplete-fix.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Only show in autocomplete when author active
-merge_request: 27292
-author:
-type: fixed
diff --git a/changelogs/unreleased/wiki-search-results-fix.yml b/changelogs/unreleased/wiki-search-results-fix.yml
deleted file mode 100644
index 693867eb385..00000000000
--- a/changelogs/unreleased/wiki-search-results-fix.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: fix wiki search result links in titles
-merge_request: 27400
-author: khm
-type: fixed
diff --git a/changelogs/unreleased/xanf-gitlab-ce-add-template-link.yml b/changelogs/unreleased/xanf-gitlab-ce-add-template-link.yml
deleted file mode 100644
index b868758dcd2..00000000000
--- a/changelogs/unreleased/xanf-gitlab-ce-add-template-link.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Add instructions on how to contribute a Built-In template for project
-merge_request: 26976
-author:
-type: other
diff --git a/changelogs/unreleased/xanf-gitlab-ce-improve-project-overview.yml b/changelogs/unreleased/xanf-gitlab-ce-improve-project-overview.yml
deleted file mode 100644
index 9755540953a..00000000000
--- a/changelogs/unreleased/xanf-gitlab-ce-improve-project-overview.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Improve icons and button order in project overview
-merge_request: 26796
-author:
-type: other
diff --git a/changelogs/unreleased/zj-fsck-no-timeout.yml b/changelogs/unreleased/zj-fsck-no-timeout.yml
deleted file mode 100644
index 044f269bb4d..00000000000
--- a/changelogs/unreleased/zj-fsck-no-timeout.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Remove deadline for Git fsck
-merge_request: 27299
-author:
-type: fixed
diff --git a/changelogs/unreleased/zj-git-2-21-tests.yml b/changelogs/unreleased/zj-git-2-21-tests.yml
deleted file mode 100644
index 56711379368..00000000000
--- a/changelogs/unreleased/zj-git-2-21-tests.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Test using Git 2.21
-merge_request: 27418
-author:
-type: added
diff --git a/changelogs/unreleased/zj-usage-ping-pool-repository.yml b/changelogs/unreleased/zj-usage-ping-pool-repository.yml
new file mode 100644
index 00000000000..62044a933d0
--- /dev/null
+++ b/changelogs/unreleased/zj-usage-ping-pool-repository.yml
@@ -0,0 +1,5 @@
+---
+title: Add Pool repository to the usage ping
+merge_request: 28267
+author:
+type: other
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 3461099253a..e7166882eea 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -11,7 +11,7 @@ Rails.application.configure do
# and recreated between test runs. Don't rely on the data there!
# Enabling caching of classes slows start-up time because all controllers
- # are loaded at initalization, but it reduces memory and load because files
+ # are loaded at initialization, but it reduces memory and load because files
# are not reloaded with every request. For example, caching is not necessary
# for loading database migrations but useful for handling Knapsack specs.
config.cache_classes = ENV['CACHE_CLASSES'] == 'true'
diff --git a/config/initializers/8_devise.rb b/config/initializers/8_devise.rb
index 4683b02f300..3dd12c7e64d 100644
--- a/config/initializers/8_devise.rb
+++ b/config/initializers/8_devise.rb
@@ -100,6 +100,11 @@ Devise.setup do |config|
# secure: true in order to force SSL only cookies.
# config.cookie_options = {}
+ # When set to false, does not sign a user in automatically after their password is
+ # changed. Defaults to true, so a user is signed in automatically after a password
+ # is changed.
+ config.sign_in_after_change_password = false
+
# Send a notification email when the user's password is changed
config.send_password_change_notification = true
diff --git a/config/initializers/action_dispatch_http_mime_negotiation.rb b/config/initializers/action_dispatch_http_mime_negotiation.rb
index bdf5b0babfb..6c31de2de55 100644
--- a/config/initializers/action_dispatch_http_mime_negotiation.rb
+++ b/config/initializers/action_dispatch_http_mime_negotiation.rb
@@ -2,7 +2,7 @@
# the extension of the full URL path if no explicit `format` param or `Accept`
# header is provided, like when simply browsing to a page in your browser.
#
-# This is undesireable in GitLab, because many of our paths will end in a ref or
+# This is undesirable in GitLab, because many of our paths will end in a ref or
# blob name that can end with any extension, while these pages should still be
# presented as HTML unless otherwise specified.
diff --git a/config/karma.config.js b/config/karma.config.js
index 83ba46345f2..2a5bf3581e0 100644
--- a/config/karma.config.js
+++ b/config/karma.config.js
@@ -9,11 +9,22 @@ const IS_EE = require('./helpers/is_ee_env');
const ROOT_PATH = path.resolve(__dirname, '..');
const SPECS_PATH = /^(?:\.[\\\/])?(ee[\\\/])?spec[\\\/]javascripts[\\\/]/;
-function fatalError(message) {
+function exitError(message) {
console.error(chalk.red(`\nError: ${message}\n`));
process.exit(1);
}
+function exitWarn(message) {
+ console.error(chalk.yellow(`\nWarn: ${message}\n`));
+ process.exit(0);
+}
+
+function exit(message, isError = true) {
+ const fn = isError ? exitError : exitWarn;
+
+ fn(message);
+}
+
// disable problematic options
webpackConfig.entry = undefined;
webpackConfig.mode = 'development';
@@ -31,7 +42,8 @@ webpackConfig.plugins.push(
}),
);
-const specFilters = argumentsParser
+const options = argumentsParser
+ .option('--no-fail-on-empty-test-suite')
.option(
'-f, --filter-spec [filter]',
'Filter run spec files by path. Multiple filters are like a logical OR.',
@@ -41,7 +53,9 @@ const specFilters = argumentsParser
},
[],
)
- .parse(process.argv).filterSpec;
+ .parse(process.argv);
+
+const specFilters = options.filterSpec;
const createContext = (specFiles, regex, suffix) => {
const newContext = specFiles.reduce((context, file) => {
@@ -73,11 +87,13 @@ if (specFilters.length) {
filteredSpecFiles = [...new Set(filteredSpecFiles)];
if (filteredSpecFiles.length < 1) {
- fatalError('Your filter did not match any test files.');
+ const isError = options.failOnEmptyTestSuite;
+
+ exit('Your filter did not match any test files.', isError);
}
if (!filteredSpecFiles.every(file => SPECS_PATH.test(file))) {
- fatalError('Test files must be located within /spec/javascripts.');
+ exitError('Test files must be located within /spec/javascripts.');
}
const CE_FILES = filteredSpecFiles.filter(file => !file.startsWith('ee'));
@@ -107,6 +123,8 @@ module.exports = function(config) {
// chrome cannot run in sandboxed mode inside a docker container unless it is run with
// escalated kernel privileges (e.g. docker run --cap-add=CAP_SYS_ADMIN)
'--no-sandbox',
+ // https://bugs.chromium.org/p/chromedriver/issues/detail?id=2870
+ '--enable-features=NetworkService,NetworkServiceInProcess',
],
},
},
diff --git a/config/puma.rb.example b/config/puma.rb.example
new file mode 100644
index 00000000000..6558dbc6cfe
--- /dev/null
+++ b/config/puma.rb.example
@@ -0,0 +1,70 @@
+# frozen_string_literal: true
+
+# Load "path" as a rackup file.
+#
+# The default is "config.ru".
+#
+rackup 'config.ru'
+pidfile '/home/git/gitlab/tmp/pids/puma.pid'
+state_path '/home/git/gitlab/tmp/pids/puma.state'
+
+stdout_redirect '/home/git/gitlab/log/puma.stdout.log',
+ '/home/git/gitlab/log/puma.stderr.log',
+ true
+
+# Configure "min" to be the minimum number of threads to use to answer
+# requests and "max" the maximum.
+#
+# The default is "0, 16".
+#
+threads 1, 16
+
+# By default, workers accept all requests and queue them to pass to handlers.
+# When false, workers accept the number of simultaneous requests configured.
+#
+# Queueing requests generally improves performance, but can cause deadlocks if
+# the app is waiting on a request to itself. See https://github.com/puma/puma/issues/612
+#
+# When set to false this may require a reverse proxy to handle slow clients and
+# queue requests before they reach puma. This is due to disabling HTTP keepalive
+queue_requests false
+
+# Bind the server to "url". "tcp://", "unix://" and "ssl://" are the only
+# accepted protocols.
+bind 'unix:///home/git/gitlab/tmp/sockets/gitlab.socket'
+
+workers 3
+
+require_relative "/home/git/gitlab/lib/gitlab/cluster/lifecycle_events"
+require_relative "/home/git/gitlab/lib/gitlab/cluster/puma_worker_killer_initializer"
+
+on_restart do
+ # Signal application hooks that we're about to restart
+ Gitlab::Cluster::LifecycleEvents.do_master_restart
+end
+
+before_fork do
+ # Signal to the puma killer
+ Gitlab::Cluster::PumaWorkerKillerInitializer.start @config.options unless ENV['DISABLE_PUMA_WORKER_KILLER']
+
+ # Signal application hooks that we're about to fork
+ Gitlab::Cluster::LifecycleEvents.do_before_fork
+end
+
+Gitlab::Cluster::LifecycleEvents.set_puma_options @config.options
+on_worker_boot do
+ # Signal application hooks of worker start
+ Gitlab::Cluster::LifecycleEvents.do_worker_start
+end
+
+# Preload the application before starting the workers; this conflicts with
+# phased restart feature. (off by default)
+preload_app!
+
+tag 'gitlab-puma-worker'
+
+# Verifies that all workers have checked in to the master process within
+# the given timeout. If not the worker process will be restarted. Default
+# value is 60 seconds.
+#
+worker_timeout 60
diff --git a/config/routes/admin.rb b/config/routes/admin.rb
index 90d7f4a04d4..bc19219a0b8 100644
--- a/config/routes/admin.rb
+++ b/config/routes/admin.rb
@@ -111,6 +111,7 @@ namespace :admin do
put :reset_health_check_token
put :clear_repository_check_states
get :integrations, :repository, :templates, :ci_cd, :reporting, :metrics_and_profiling, :network, :geo, :preferences
+ get :lets_encrypt_terms_of_service
end
resources :labels
diff --git a/config/routes/project.rb b/config/routes/project.rb
index 93d746f3282..fdc2a3c0086 100644
--- a/config/routes/project.rb
+++ b/config/routes/project.rb
@@ -442,16 +442,23 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
end
- namespace :settings do
- get :members, to: redirect("%{namespace_id}/%{project_id}/project_members")
- resource :ci_cd, only: [:show, :update], controller: 'ci_cd' do
- post :reset_cache
- put :reset_registration_token
- end
- resource :integrations, only: [:show]
- resource :repository, only: [:show], controller: :repository do
- post :create_deploy_token, path: 'deploy_token/create'
- post :cleanup
+
+ scope '-' do
+ namespace :settings do
+ get :members, to: redirect("%{namespace_id}/%{project_id}/project_members")
+
+ resource :ci_cd, only: [:show, :update], controller: 'ci_cd' do
+ post :reset_cache
+ put :reset_registration_token
+ end
+
+ resource :operations, only: [:show, :update]
+ resource :integrations, only: [:show]
+
+ resource :repository, only: [:show], controller: :repository do
+ post :create_deploy_token, path: 'deploy_token/create'
+ post :cleanup
+ end
end
end
@@ -465,10 +472,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
# its preferable to keep it below all other project routes
draw :wiki
draw :repository
-
- namespace :settings do
- resource :operations, only: [:show, :update]
- end
end
resources(:projects,
@@ -493,4 +496,18 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
end
+
+ # Legacy routes.
+ # Introduced in 12.0.
+ # Should be removed after 12.1
+ scope(path: '*namespace_id',
+ as: :namespace,
+ namespace_id: Gitlab::PathRegex.full_namespace_route_regex) do
+ scope(path: ':project_id',
+ constraints: { project_id: Gitlab::PathRegex.project_route_regex },
+ module: :projects,
+ as: :project) do
+ Gitlab::Routing.redirect_legacy_paths(self, :settings, :branches, :tags, :network, :graphs)
+ end
+ end
end
diff --git a/config/routes/repository.rb b/config/routes/repository.rb
index f5201b9ddbb..b96315bfe8b 100644
--- a/config/routes/repository.rb
+++ b/config/routes/repository.rb
@@ -39,7 +39,7 @@ scope format: false do
end
end
- scope constraints: { id: Gitlab::PathRegex.git_reference_regex } do
+ scope path: '-', constraints: { id: Gitlab::PathRegex.git_reference_regex } do
resources :network, only: [:show]
resources :graphs, only: [:show] do
diff --git a/config/unicorn.rb.example.development b/config/unicorn.rb.example.development
index f7541bb9d55..ae3dc2e37e1 100644
--- a/config/unicorn.rb.example.development
+++ b/config/unicorn.rb.example.development
@@ -58,4 +58,3 @@ after_fork do |server, worker|
# addr = "127.0.0.1:#{9293 + worker.nr}"
# server.listen(addr, :tries => -1, :delay => 5, :tcp_nopush => true)
end
-
diff --git a/db/migrate/20150509180749_convert_legacy_reference_notes.rb b/db/migrate/20150509180749_convert_legacy_reference_notes.rb
index a44a908c2f5..84d4eb9e51f 100644
--- a/db/migrate/20150509180749_convert_legacy_reference_notes.rb
+++ b/db/migrate/20150509180749_convert_legacy_reference_notes.rb
@@ -7,7 +7,8 @@
# mentioned in 54f7727c850972f0401c1312a7c4a6a380de5666
class ConvertLegacyReferenceNotes < ActiveRecord::Migration[4.2]
def up
- execute %q{UPDATE notes SET note = trim(both '_' from note) WHERE system = true AND note LIKE '\_%\_'}
+ quoted_column_name = ActiveRecord::Base.connection.quote_column_name('system')
+ execute %Q{UPDATE notes SET note = trim(both '_' from note) WHERE #{quoted_column_name} = true AND note LIKE '\_%\_'}
end
def down
diff --git a/db/migrate/20170330141723_disable_invalid_service_templates2.rb b/db/migrate/20170330141723_disable_invalid_service_templates2.rb
index 91ec19dfa87..f09f3b3e355 100644
--- a/db/migrate/20170330141723_disable_invalid_service_templates2.rb
+++ b/db/migrate/20170330141723_disable_invalid_service_templates2.rb
@@ -1,5 +1,5 @@
# This is the same as DisableInvalidServiceTemplates. Later migrations may have
-# inadventently enabled some invalid templates again.
+# inadvertently enabled some invalid templates again.
#
class DisableInvalidServiceTemplates2 < ActiveRecord::Migration[4.2]
DOWNTIME = false
diff --git a/db/migrate/20190515125613_add_application_settings_elasticsearch_shards.rb b/db/migrate/20190515125613_add_application_settings_elasticsearch_shards.rb
new file mode 100644
index 00000000000..9cebc0f8db4
--- /dev/null
+++ b/db/migrate/20190515125613_add_application_settings_elasticsearch_shards.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class AddApplicationSettingsElasticsearchShards < ActiveRecord::Migration[5.1]
+ DOWNTIME = false
+
+ def change
+ add_column :application_settings, :elasticsearch_shards, :integer, null: false, default: 5
+ add_column :application_settings, :elasticsearch_replicas, :integer, null: false, default: 1
+ end
+end
diff --git a/db/migrate/20190516011213_add_build_queued_at_index.rb b/db/migrate/20190516011213_add_build_queued_at_index.rb
new file mode 100644
index 00000000000..77ffa7cd4e9
--- /dev/null
+++ b/db/migrate/20190516011213_add_build_queued_at_index.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+# This migration make queued_at field indexed to speed up builds filtering by job_age
+
+class AddBuildQueuedAtIndex < ActiveRecord::Migration[5.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :ci_builds, :queued_at
+ end
+
+ def down
+ remove_concurrent_index :ci_builds, :queued_at
+ end
+end
diff --git a/db/post_migrate/20190301081611_migrate_project_migrate_sidekiq_queue.rb b/db/post_migrate/20190301081611_migrate_project_migrate_sidekiq_queue.rb
index 6af7902e0c4..46108d142b5 100644
--- a/db/post_migrate/20190301081611_migrate_project_migrate_sidekiq_queue.rb
+++ b/db/post_migrate/20190301081611_migrate_project_migrate_sidekiq_queue.rb
@@ -5,8 +5,6 @@ class MigrateProjectMigrateSidekiqQueue < ActiveRecord::Migration[5.0]
DOWNTIME = false
- DOWNTIME = false
-
def up
sidekiq_queue_migrate 'project_migrate_hashed_storage', to: 'hashed_storage:hashed_storage_project_migrate'
end
diff --git a/db/post_migrate/20190424134256_drop_projects_ci_id.rb b/db/post_migrate/20190424134256_drop_projects_ci_id.rb
index 79fa9704f1f..44e8f316393 100644
--- a/db/post_migrate/20190424134256_drop_projects_ci_id.rb
+++ b/db/post_migrate/20190424134256_drop_projects_ci_id.rb
@@ -22,7 +22,12 @@ class DropProjectsCiId < ActiveRecord::Migration[5.1]
end
def down
- add_column :projects, :ci_id, :integer
- add_concurrent_index :projects, :ci_id
+ unless column_exists?(:projects, :ci_id)
+ add_column :projects, :ci_id, :integer
+ end
+
+ unless index_exists?(:projects, :ci_id)
+ add_concurrent_index :projects, :ci_id
+ end
end
end
diff --git a/db/schema.rb b/db/schema.rb
index 159e7e03cf4..412b5313b69 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20190506135400) do
+ActiveRecord::Schema.define(version: 20190516011213) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -189,6 +189,8 @@ ActiveRecord::Schema.define(version: 20190506135400) do
t.string "encrypted_external_auth_client_key_pass_iv"
t.string "lets_encrypt_notification_email"
t.boolean "lets_encrypt_terms_of_service_accepted", default: false, null: false
+ t.integer "elasticsearch_shards", default: 5, null: false
+ t.integer "elasticsearch_replicas", default: 1, null: false
t.index ["usage_stats_set_by_user_id"], name: "index_application_settings_on_usage_stats_set_by_user_id", using: :btree
end
@@ -378,6 +380,7 @@ ActiveRecord::Schema.define(version: 20190506135400) do
t.index ["project_id", "id"], name: "index_ci_builds_on_project_id_and_id", using: :btree
t.index ["project_id", "status"], name: "index_ci_builds_project_id_and_status_for_live_jobs_partial2", where: "(((type)::text = 'Ci::Build'::text) AND ((status)::text = ANY (ARRAY[('running'::character varying)::text, ('pending'::character varying)::text, ('created'::character varying)::text])))", using: :btree
t.index ["protected"], name: "index_ci_builds_on_protected", using: :btree
+ t.index ["queued_at"], name: "index_ci_builds_on_queued_at", using: :btree
t.index ["runner_id"], name: "index_ci_builds_on_runner_id", using: :btree
t.index ["scheduled_at"], name: "partial_index_ci_builds_on_scheduled_at_with_scheduled_jobs", where: "((scheduled_at IS NOT NULL) AND ((type)::text = 'Ci::Build'::text) AND ((status)::text = 'scheduled'::text))", using: :btree
t.index ["stage_id", "stage_idx"], name: "tmp_build_stage_position_index", where: "(stage_idx IS NOT NULL)", using: :btree
diff --git a/doc/README.md b/doc/README.md
index dd4909ce303..3863e17c268 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -4,7 +4,7 @@ description: 'Learn how to use and administer GitLab, the most scalable Git-base
---
<div class="display-none">
- <em>Visit <a href="https://docs.gitlab.com/ce/">docs.gitlab.com</a> for optimized
+ <em>Visit <a href="https://docs.gitlab.com/ee/">docs.gitlab.com</a> for optimized
navigation, discoverability, and readability.</em>
</div>
<!-- the div above will not display on the docs site but will display on /help -->
@@ -107,13 +107,18 @@ The following documentation relates to the DevOps **Plan** stage:
| Plan Topics | Description |
|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------|
+| [Burndown Charts](user/project/milestones/burndown_charts.md) **[STARTER]** | Watch your project's progress throughout a specific milestone. |
| [Discussions](user/discussions/index.md) | Threads, comments, and resolvable discussions in issues, commits, and merge requests. |
| [Due Dates](user/project/issues/due_dates.md) | Keep track of issue deadlines. |
-| [Quick Actions](user/project/quick_actions.md) | Shortcuts for common actions on issues or merge requests, replacing the need to click buttons or use dropdowns in GitLab's UI. |
+| [Epics](user/group/epics/index.md) **[ULTIMATE]** | Tracking groups of issues that share a theme. |
| [Issues](user/project/issues/index.md), including [confidential issues](user/project/issues/confidential_issues.md),<br/>[issue and merge request templates](user/project/description_templates.md),<br/>and [moving issues](user/project/issues/moving_issues.md) | Project issues, restricting access to issues, create templates for submitting new issues and merge requests, and moving issues between projects. |
| [Labels](user/project/labels.md) | Categorize issues or merge requests with descriptive labels. |
| [Milestones](user/project/milestones/index.md) | Set milestones for delivery of issues and merge requests, with optional due date. |
| [Project Issue Board](user/project/issue_board.md) | Display issues on a Scrum or Kanban board. |
+| [Quick Actions](user/project/quick_actions.md) | Shortcuts for common actions on issues or merge requests, replacing the need to click buttons or use dropdowns in GitLab's UI. |
+| [Related Issues](user/project/issues/related_issues.md) **[STARTER]** | Create a relationship between issues. |
+| [Roadmap](user/group/roadmap/index.md) **[ULTIMATE]** | Visualize epic timelines. |
+| [Service Desk](user/project/service_desk.md) **[PREMIUM]** | A simple way to allow people to create issues in your GitLab instance without needing their own user account. |
| [Time Tracking](workflow/time_tracking.md) | Track time spent on issues and merge requests. |
| [Todos](workflow/todos.md) | Keep track of work requiring attention with a chronological list displayed on a simple dashboard. |
@@ -136,16 +141,21 @@ The following documentation relates to the DevOps **Create** stage:
#### Projects and Groups
-| Create Topics - Projects and Groups | Description |
-|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------|
-| [Create](gitlab-basics/create-project.md) and [fork](gitlab-basics/fork-project.md) projects, and<br/>[import and export<br/>projects between instances](user/project/settings/import_export.md) | Create, duplicate, and move projects. |
-| [GitLab Pages](user/project/pages/index.md) | Build, test, and deploy your static website with GitLab Pages. |
-| [Groups](user/group/index.md) and [Subgroups](user/group/subgroups/index.md) | Organize your projects in groups. |
-| [Projects](user/project/index.md), including [project access](public_access/public_access.md)<br/>and [settings](user/project/settings/index.md) | Host source code, and control your project's visibility and set configuration. |
-| [Search through GitLab](user/search/index.md) | Search for issues, merge requests, projects, groups, and todos. |
-| [Snippets](user/snippets.md) | Snippets allow you to create little bits of code. |
-| [Web IDE](user/project/web_ide/index.md) | Edit files within GitLab's user interface. |
-| [Wikis](user/project/wiki/index.md) | Enhance your repository documentation with built-in wikis. |
+| Create Topics - Projects and Groups | Description |
+|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------|
+| [Advanced global search](user/search/advanced_global_search.md) **[STARTER]** | Leverage Elasticsearch for faster, more advanced code search across your entire GitLab instance. |
+| [Advanced syntax search](user/search/advanced_search_syntax.md) **[STARTER]** | Use advanced queries for more targeted search results. |
+| [Contribution analytics](user/group/contribution_analytics/index.md) **[STARTER]** | See detailed statistics of group contributors. |
+| [Create](gitlab-basics/create-project.md) and [fork](gitlab-basics/fork-project.md) projects, and<br/>[import and export projects<br/>between instances](user/project/settings/import_export.md) | Create, duplicate, and move projects. |
+| [File locking](user/project/file_lock.md) **[PREMIUM]** | Lock files to avoid merge conflicts. |
+| [GitLab Pages](user/project/pages/index.md) | Build, test, and deploy your static website with GitLab Pages. |
+| [Groups](user/group/index.md) and [Subgroups](user/group/subgroups/index.md) | Organize your projects in groups. |
+| [Issues Analytics](user/group/issues_analytics/index.md) **[PREMIUM]** | Check how many issues were created per month. |
+| [Projects](user/project/index.md), including [project access](public_access/public_access.md)<br/>and [settings](user/project/settings/index.md) | Host source code, and control your project's visibility and set configuration. |
+| [Search through GitLab](user/search/index.md) | Search for issues, merge requests, projects, groups, and todos. |
+| [Snippets](user/snippets.md) | Snippets allow you to create little bits of code. |
+| [Web IDE](user/project/web_ide/index.md) | Edit files within GitLab's user interface. |
+| [Wikis](user/project/wiki/index.md) | Enhance your repository documentation with built-in wikis. |
<div align="right">
<a type="button" class="btn btn-default" href="#overview">
@@ -165,7 +175,9 @@ The following documentation relates to the DevOps **Create** stage:
| [Files](user/project/repository/index.md#files) | Files management. |
| [Jupyter Notebook files](user/project/repository/index.md#jupyter-notebook-files) | GitLab's support for `.ipynb` files. |
| [Protected branches](user/project/protected_branches.md) | Use protected branches. |
+| [Push rules](push_rules/push_rules.md) **[STARTER]** | Additional control over pushes to your projects. |
| [Repositories](user/project/repository/index.md) | Manage source code repositories in GitLab's user interface. |
+| [Repository mirroring](workflow/repository_mirroring.md) **[STARTER]** | Push to or pull from repositories outside of GitLab |
| [Start a merge request](user/project/repository/web_editor.md#tips) | Start merge request when committing via GitLab's user interface. |
<div align="right">
@@ -192,13 +204,14 @@ The following documentation relates to the DevOps **Create** stage:
#### Integration and Automation
-| Create Topics - Integration and Automation | Description |
-|:------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------|
-| [GitLab API](api/README.md) | Integrate GitLab via a simple and powerful API. |
-| [GitLab Integration](integration/README.md) | Integrate with multiple third-party services with GitLab to allow external issue trackers and external authentication. |
-| [GitLab Webhooks](user/project/integrations/webhooks.md) | Let GitLab notify you when new code has been pushed to your project. |
-| [Project Services](user/project/integrations/project_services.md) | Integrate a project with external services, such as CI and chat. |
-| [Trello Power-Up](integration/trello_power_up.md) | Integrate with GitLab's Trello Power-Up. |
+| Create Topics - Integration and Automation | Description |
+|:------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------|
+| [GitLab API](api/README.md) | Integrate GitLab via a simple and powerful API. |
+| [GitLab Integration](integration/README.md) | Integrate with multiple third-party services with GitLab to allow external issue trackers and external authentication. |
+| [GitLab Webhooks](user/project/integrations/webhooks.md) | Let GitLab notify you when new code has been pushed to your project. |
+| [JIRA Development Panel](integration/jira_development_panel.md) **[PREMIUM]** | See GitLab information in the JIRA Development Panel. |
+| [Project Services](user/project/integrations/project_services.md) | Integrate a project with external services, such as CI and chat. |
+| [Trello Power-Up](integration/trello_power_up.md) | Integrate with GitLab's Trello Power-Up. |
<div align="right">
<a type="button" class="btn btn-default" href="#overview">
@@ -218,12 +231,14 @@ scales to run your tests faster.
The following documentation relates to the DevOps **Verify** stage:
-| Verify Topics | Description |
-|:---------------------------------------------------------|:-----------------------------------------------------------------------------|
-| [GitLab CI/CD](ci/README.md) | Explore the features and capabilities of Continuous Integration with GitLab. |
-| [JUnit test reports](ci/junit_test_reports.md) | Display JUnit test reports on merge requests. |
-| [Pipeline Graphs](ci/pipelines.md#visualizing-pipelines) | Visualize builds. |
-| [Review Apps](ci/review_apps/index.md) | Preview changes to your application right from a merge request. |
+| Verify Topics | Description |
+|:----------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------|
+| [Code Quality reports](user/project/merge_requests/code_quality.md) **[STARTER]** | Analyze source code quality. |
+| [GitLab CI/CD](ci/README.md) | Explore the features and capabilities of Continuous Integration with GitLab. |
+| [JUnit test reports](ci/junit_test_reports.md) | Display JUnit test reports on merge requests. |
+| [Multi-project pipelines](ci/multi_project_pipelines.md) **[PREMIUM]** | Visualize entire pipelines that span multiple projects, including all cross-project inter-dependencies. |
+| [Pipeline Graphs](ci/pipelines.md#visualizing-pipelines) | Visualize builds. |
+| [Review Apps](ci/review_apps/index.md) | Preview changes to your application right from a merge request. |
<div align="right">
<a type="button" class="btn btn-default" href="#overview">
@@ -242,6 +257,7 @@ The following documentation relates to the DevOps **Package** stage:
| Package Topics | Description |
|:----------------------------------------------------------------|:-------------------------------------------------------|
| [GitLab Container Registry](user/project/container_registry.md) | Learn how to use GitLab's built-in Container Registry. |
+| [GitLab Packages](administration/packages.md) **[PREMIUM]** | Use GitLab as an NPM registry or Maven repository. |
<div align="right">
<a type="button" class="btn btn-default" href="#overview">
@@ -257,14 +273,17 @@ confidently and securely with GitLab’s built-in Continuous Delivery and Deploy
The following documentation relates to the DevOps **Release** stage:
-| Release Topics | Description |
-|:------------------------------------------------------------|:---------------------------------------------------------------------------------------------|
-| [Auto Deploy](topics/autodevops/index.md#auto-deploy) | Configure GitLab for the deployment of your application. |
-| [Environments and deployments](ci/environments.md) | With environments, you can control the continuous deployment of your software within GitLab. |
-| [GitLab CI/CD](ci/README.md) | Explore the features and capabilities of Continuous Deployment and Delivery with GitLab. |
-| [GitLab Pages](user/project/pages/index.md) | Build, test, and deploy a static site directly from GitLab. |
-| [Protected Runners](ci/runners/README.md#protected-runners) | Select Runners to only pick jobs for protected branches and tags. |
-| [Scheduled Pipelines](user/project/pipelines/schedules.md) | Execute pipelines on a schedule. |
+| Release Topics | Description |
+|:------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------|
+| [Auto Deploy](topics/autodevops/index.md#auto-deploy) | Configure GitLab for the deployment of your application. |
+| [Canary Deployments](user/project/canary_deployments.md) **[PREMIUM]** | Employ a popular CI strategy where a small portion of the fleet is updated to the new version first. |
+| [Deploy Boards](user/project/deploy_boards.md) **[PREMIUM]** | View the current health and status of each CI environment running on Kubernetes, displaying the status of the pods in the deployment. |
+| [Environments and deployments](ci/environments.md) | With environments, you can control the continuous deployment of your software within GitLab. |
+| [Environment-specific variables](ci/variables/README.md#limiting-environment-scopes-of-environment-variables-premium) **[PREMIUM]** | Limit scope of variables to specific environments. |
+| [GitLab CI/CD](ci/README.md) | Explore the features and capabilities of Continuous Deployment and Delivery with GitLab. |
+| [GitLab Pages](user/project/pages/index.md) | Build, test, and deploy a static site directly from GitLab. |
+| [Protected Runners](ci/runners/README.md#protected-runners) | Select Runners to only pick jobs for protected branches and tags. |
+| [Scheduled Pipelines](user/project/pipelines/schedules.md) | Execute pipelines on a schedule. |
<div align="right">
<a type="button" class="btn btn-default" href="#overview">
@@ -288,6 +307,7 @@ The following documentation relates to the DevOps **Configure** stage:
| [GitLab ChatOps](ci/chatops/README.md) | Interact with CI/CD jobs through chat services. |
| [Installing Applications](user/project/clusters/index.md#installing-applications) | Deploy Helm, Ingress, and Prometheus on Kubernetes. |
| [Mattermost slash commands](user/project/integrations/mattermost_slash_commands.md) | Enable and use slash commands from within Mattermost. |
+| [Multiple Kubernetes Clusters](user/project/clusters/index.md#multiple-kubernetes-clusters-premium) **[PREMIUM]** | Associate more than one Kubernetes clusters to your project. |
| [Protected variables](ci/variables/README.md#protected-environment-variables) | Restrict variables to protected branches and tags. |
| [Serverless](user/project/clusters/serverless/index.md) | Run serverless workloads on Kubernetes. |
| [Slack slash commands](user/project/integrations/slack_slash_commands.md) | Enable and use slash commands from within Slack. |
@@ -323,16 +343,23 @@ The following documentation relates to the DevOps **Monitor** stage:
### Secure
-GitLab can help you secure your applications from within your development lifecycle.
+Check your application for security vulnerabilities that may lead to unauthorized access,
+data leaks, and denial of services. GitLab will perform static and dynamic tests on the
+code of your application, looking for known flaws and report them in the merge request
+so you can fix them before merging. Security teams can use dashboards to get a
+high-level view on projects and groups, and start remediation processes when needed.
The following documentation relates to the DevOps **Secure** stage:
-| Monitor Topics | Description |
-|:----------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------|
-| [Container Scanning example](ci/examples/container_scanning.md) | `.gitlab-ci.yml` example of using Clair and clair-scanner to scan docker images for known vulnerabilities. |
-
-NOTE: **Note:**
-Viewing [Container Scanning reports](https://docs.gitlab.com/ee/user/project/merge_requests/container_scanning.html) within merge requests requires [GitLab Ultimate](https://about.gitlab.com/pricing/).
+| Secure Topics | Description |
+|:------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------|
+| [Container Scanning](user/application_security/container_scanning/index.md) **[ULTIMATE]** | Use Clair to scan docker images for known vulnerabilities. |
+| [Dependency Scanning](user/application_security/dependency_scanning/index.md) **[ULTIMATE]** | Analyze your dependencies for known vulnerabilities. |
+| [Dynamic Application Security Testing (DAST)](user/application_security/dast/index.md) **[ULTIMATE]** | Analyze running web applications for known vulnerabilities. |
+| [Group Security Dashboard](user/application_security/security_dashboard/index.md) **[ULTIMATE]** | View vulnerabilities in all the projects in a group and its subgroups. |
+| [License Management](user/application_security/license_management/index.md) **[ULTIMATE]** | Search your project's dependencies for their licenses. |
+| [Project Security Dashboard](user/application_security/security_dashboard/index.md) **[ULTIMATE]** | View the latest security reports for your project. |
+| [Static Application Security Testing (SAST)](user/application_security/sast/index.md) **[ULTIMATE]** | Analyze source code for known vulnerabilities. |
## Subscribe to GitLab
@@ -342,6 +369,8 @@ There are two ways to use GitLab:
- [GitLab.com](#gitlabcom): GitLab's SaaS offering. You don't need to install anything to use GitLab.com,
you only need to [sign up](https://gitlab.com/users/sign_in) and start using GitLab straight away.
+For more information on managing your subscription and [Customers Portal](https://customers.gitlab.com) account, please see [Getting Started with Subscriptions](getting-started/subscription.md).
+
The following sections outline tiers and features within GitLab self-managed and GitLab.com.
<div align="right">
@@ -393,6 +422,12 @@ GitLab.com subscriptions grant access
to the same features available in GitLab self-managed, **except
[administration](administration/index.md) tools and settings**.
+GitLab.com allows you to apply your subscription to a group or your personal user.
+
+When applied to a **group**, the group, all subgroups, and all projects under the selected group on GitLab.com will have the features of the associated plan. It is recommended to go with a group plan when managing projects and users of an organization.
+
+When associated with a **personal userspace** instead, all projects will have features with the subscription applied, but as it is not a group, group features will not be available.
+
TIP: **Tip:**
To support the open source community and encourage the development of open source projects, GitLab grants access to **Gold** features for all GitLab.com **public** projects, regardless of the subscription.
diff --git a/doc/administration/dependency_proxy.md b/doc/administration/dependency_proxy.md
new file mode 100644
index 00000000000..4dc1f4dcba4
--- /dev/null
+++ b/doc/administration/dependency_proxy.md
@@ -0,0 +1,150 @@
+# GitLab Dependency Proxy administration **[PREMIUM ONLY]**
+
+> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/7934) in [GitLab Premium](https://about.gitlab.com/pricing) 11.11.
+
+GitLab can be utilized as a dependency proxy for a variety of common package managers.
+
+This is the administration documentation. If you want to learn how to use the
+dependency proxies, see the [user guide](../user/group/dependency_proxy/index.md).
+
+## Enabling the Dependency Proxy feature
+
+NOTE: **Note:**
+Dependency proxy requires the Puma web server to be enabled.
+Puma support is EXPERIMENTAL at this time.
+
+To enable the Dependency proxy feature:
+
+**Omnibus GitLab installations**
+
+1. Edit `/etc/gitlab/gitlab.rb` and add the following line:
+
+ ```ruby
+ gitlab_rails['dependency_proxy_enabled'] = true
+ ```
+
+1. Save the file and [reconfigure GitLab][] for the changes to take effect.
+1. Enable the [Puma web server](https://docs.gitlab.com/omnibus/settings/puma.html).
+
+**Installations from source**
+
+1. After the installation is complete, you will have to configure the `dependency_proxy`
+ section in `config/gitlab.yml`. Set to `true` to enable it:
+
+ ```yaml
+ dependency_proxy:
+ enabled: true
+ ```
+
+1. [Restart GitLab] for the changes to take effect.
+1. Enable the [Puma web server](../install/installation.md#using-puma).
+
+## Changing the storage path
+
+By default, the dependency proxy files are stored locally, but you can change the default
+local location or even use object storage.
+
+### Changing the local storage path
+
+The dependency proxy files for Omnibus GitLab installations are stored under
+`/var/opt/gitlab/gitlab-rails/shared/dependency_proxy/` and for source
+installations under `shared/dependency_proxy/` (relative to the git home directory).
+To change the local storage path:
+
+**Omnibus GitLab installations**
+
+1. Edit `/etc/gitlab/gitlab.rb` and add the following line:
+
+ ```ruby
+ gitlab_rails['dependency_proxy_storage_path'] = "/mnt/dependency_proxy"
+ ```
+
+1. Save the file and [reconfigure GitLab][] for the changes to take effect.
+
+**Installations from source**
+
+1. Edit the `dependency_proxy` section in `config/gitlab.yml`:
+
+ ```yaml
+ dependency_proxy:
+ enabled: true
+ storage_path: shared/dependency_proxy
+ ```
+1. [Restart GitLab] for the changes to take effect.
+
+### Using object storage
+
+Instead of relying on the local storage, you can use an object storage to
+upload the blobs of the dependency proxy:
+
+**Omnibus GitLab installations**
+
+1. Edit `/etc/gitlab/gitlab.rb` and add the following lines (uncomment where
+ necessary):
+
+ ```ruby
+ gitlab_rails['dependency_proxy_enabled'] = true
+ gitlab_rails['dependency_proxy_storage_path'] = "/var/opt/gitlab/gitlab-rails/shared/dependency_proxy"
+ gitlab_rails['dependency_proxy_object_store_enabled'] = true
+ gitlab_rails['dependency_proxy_object_store_remote_directory'] = "dependency_proxy" # The bucket name.
+ gitlab_rails['dependency_proxy_object_store_direct_upload'] = false # Use Object Storage directly for uploads instead of background uploads if enabled (Default: false).
+ gitlab_rails['dependency_proxy_object_store_background_upload'] = true # Temporary option to limit automatic upload (Default: true).
+ gitlab_rails['dependency_proxy_object_store_proxy_download'] = false # Passthrough all downloads via GitLab instead of using Redirects to Object Storage.
+ gitlab_rails['dependency_proxy_object_store_connection'] = {
+ ##
+ ## If the provider is AWS S3, uncomment the following
+ ##
+ #'provider' => 'AWS',
+ #'region' => 'eu-west-1',
+ #'aws_access_key_id' => 'AWS_ACCESS_KEY_ID',
+ #'aws_secret_access_key' => 'AWS_SECRET_ACCESS_KEY',
+ ##
+ ## If the provider is other than AWS (an S3-compatible one), uncomment the following
+ ##
+ #'host' => 's3.amazonaws.com',
+ #'aws_signature_version' => 4 # For creation of signed URLs. Set to 2 if provider does not support v4.
+ #'endpoint' => 'https://s3.amazonaws.com' # Useful for S3-compliant services such as DigitalOcean Spaces.
+ #'path_style' => false # If true, use 'host/bucket_name/object' instead of 'bucket_name.host/object'.
+ }
+ ```
+
+1. Save the file and [reconfigure GitLab][] for the changes to take effect.
+
+**Installations from source**
+
+1. Edit the `dependency_proxy` section in `config/gitlab.yml` (uncomment where necessary):
+
+ ```yaml
+ dependency_proxy:
+ enabled: true
+ ##
+ ## The location where build dependency_proxy are stored (default: shared/dependency_proxy).
+ ##
+ #storage_path: shared/dependency_proxy
+ object_store:
+ enabled: false
+ remote_directory: dependency_proxy # The bucket name.
+ #direct_upload: false # Use Object Storage directly for uploads instead of background uploads if enabled (Default: false).
+ #background_upload: true # Temporary option to limit automatic upload (Default: true).
+ #proxy_download: false # Passthrough all downloads via GitLab instead of using Redirects to Object Storage.
+ connection:
+ ##
+ ## If the provider is AWS S3, uncomment the following
+ ##
+ #provider: AWS
+ #region: us-east-1
+ #aws_access_key_id: AWS_ACCESS_KEY_ID
+ #aws_secret_access_key: AWS_SECRET_ACCESS_KEY
+ ##
+ ## If the provider is other than AWS (an S3-compatible one), uncomment the following
+ ##
+ #host: 's3.amazonaws.com' # default: s3.amazonaws.com.
+ #aws_signature_version: 4 # For creation of signed URLs. Set to 2 if provider does not support v4.
+ #endpoint: 'https://s3.amazonaws.com' # Useful for S3-compliant services such as DigitalOcean Spaces.
+ #path_style: false # If true, use 'host/bucket_name/object' instead of 'bucket_name.host/object'.
+ ```
+
+1. [Restart GitLab] for the changes to take effect.
+
+[reconfigure gitlab]: restart_gitlab.md#omnibus-gitlab-reconfigure "How to reconfigure Omnibus GitLab"
+[restart gitlab]: restart_gitlab.md#omnibus-gitlab-reconfigure "How to reconfigure Omnibus GitLab"
diff --git a/doc/administration/high_availability/nfs.md b/doc/administration/high_availability/nfs.md
index d0e0e320019..caadec3ac4e 100644
--- a/doc/administration/high_availability/nfs.md
+++ b/doc/administration/high_availability/nfs.md
@@ -41,7 +41,6 @@ options:
NOTE: **Note:**
This is only available starting in certain versions of GitLab:
-
* 11.5.11
* 11.6.11
* 11.7.12
@@ -59,13 +58,13 @@ details.
To do this, run the Rake task:
```sh
-gitlab-rake gitlab:features:enable_rugged
+sudo gitlab-rake gitlab:features:enable_rugged
```
If you need to undo this setting for some reason, run:
```sh
-gitlab-rake gitlab:features:disable_rugged
+sudo gitlab-rake gitlab:features:disable_rugged
```
### Known issues
diff --git a/doc/administration/high_availability/nfs_host_client_setup.md b/doc/administration/high_availability/nfs_host_client_setup.md
index a8bc101dee6..a8d69b9ab0a 100644
--- a/doc/administration/high_availability/nfs_host_client_setup.md
+++ b/doc/administration/high_availability/nfs_host_client_setup.md
@@ -67,7 +67,7 @@ apt-get install nfs-common
### Step 2 - Create Mount Points on Client
-Create a directroy on the client that we can mount the shared directory from the host.
+Create a directory on the client that we can mount the shared directory from the host.
Please note that if your mount point directory contains any files they will be hidden
once the remote shares are mounted. An empty/new directory on the client is recommended
for this purpose.
diff --git a/doc/administration/img/high_availability/fully-distributed.png b/doc/administration/img/high_availability/fully-distributed.png
deleted file mode 100644
index ad23207134e..00000000000
--- a/doc/administration/img/high_availability/fully-distributed.png
+++ /dev/null
Binary files differ
diff --git a/doc/administration/img/high_availability/geo-ha-diagram.png b/doc/administration/img/high_availability/geo-ha-diagram.png
deleted file mode 100644
index da5d612827c..00000000000
--- a/doc/administration/img/high_availability/geo-ha-diagram.png
+++ /dev/null
Binary files differ
diff --git a/doc/administration/img/high_availability/horizontal.png b/doc/administration/img/high_availability/horizontal.png
deleted file mode 100644
index c3bd489d96f..00000000000
--- a/doc/administration/img/high_availability/horizontal.png
+++ /dev/null
Binary files differ
diff --git a/doc/administration/img/high_availability/hybrid.png b/doc/administration/img/high_availability/hybrid.png
deleted file mode 100644
index 7d4a56bf0ea..00000000000
--- a/doc/administration/img/high_availability/hybrid.png
+++ /dev/null
Binary files differ
diff --git a/doc/administration/monitoring/prometheus/gitlab_metrics.md b/doc/administration/monitoring/prometheus/gitlab_metrics.md
index 48bd709a2b7..c243dd9edbb 100644
--- a/doc/administration/monitoring/prometheus/gitlab_metrics.md
+++ b/doc/administration/monitoring/prometheus/gitlab_metrics.md
@@ -43,11 +43,10 @@ The following metrics are available:
| redis_ping_latency_seconds | Gauge | 9.4 | Round trip time of the redis ping |
| user_session_logins_total | Counter | 9.4 | Counter of how many users have logged in |
| upload_file_does_not_exist | Counter | 10.7 in EE, 11.5 in CE | Number of times an upload record could not find its file |
-| failed_login_captcha_total | Gauge | 11.0 | Counter of failed CAPTCHA attempts during login |
-| successful_login_captcha_total | Gauge | 11.0 | Counter of successful CAPTCHA attempts during login |
-| unicorn_active_connections | Gauge | 11.0 | The number of active Unicorn connections (workers) |
-| unicorn_queued_connections | Gauge | 11.0 | The number of queued Unicorn connections |
-| unicorn_workers | Gauge | 11.11 | The number of Unicorn workers |
+| failed_login_captcha_total | Gauge | 11.0 | Counter of failed CAPTCHA attempts during login |
+| successful_login_captcha_total | Gauge | 11.0 | Counter of successful CAPTCHA attempts during login |
+| unicorn_active_connections | Gauge | 11.0 | The number of active Unicorn connections (workers) |
+| unicorn_queued_connections | Gauge | 11.0 | The number of queued Unicorn connections |
## Sidekiq Metrics available for Geo **[PREMIUM]**
@@ -101,10 +100,6 @@ Some basic Ruby runtime metrics are available:
| ruby_file_descriptors | Gauge | 11.1 | File descriptors per process |
| ruby_memory_bytes | Gauge | 11.1 | Memory usage by process |
| ruby_sampler_duration_seconds_total | Counter | 11.1 | Time spent collecting stats |
-| ruby_process_cpu_seconds_total | Gauge | 11.11 | Total amount of CPU time per process |
-| ruby_process_max_fds | Gauge | 11.11 | Maximum number of open file descriptors per process |
-| ruby_process_resident_memory_bytes | Gauge | 11.11 | Memory usage by process, measured in bytes |
-| ruby_process_start_time_seconds | Gauge | 11.11 | The elapsed time between system boot and the process started, measured in seconds |
[GC.stat]: https://ruby-doc.org/core-2.3.0/GC.html#method-c-stat
diff --git a/doc/api/README.md b/doc/api/README.md
index 7ec7955c596..439f58c1253 100644
--- a/doc/api/README.md
+++ b/doc/api/README.md
@@ -186,6 +186,8 @@ curl "https://gitlab.example.com/api/v4/projects"
The API uses JSON to serialize data. You don't need to specify `.json` at the
end of an API URL.
+All of the API endpoints that use the `POST`, `PUT` or `PATCH` method support params in the request body, with `Content-Type` `application/x-www-form-urlencoded`, `multipart/form-data` or `application/json`.
+
## Authentication
Most API requests require authentication, or will only return public data when
diff --git a/doc/api/epic_issues.md b/doc/api/epic_issues.md
new file mode 100644
index 00000000000..438a3361dcc
--- /dev/null
+++ b/doc/api/epic_issues.md
@@ -0,0 +1,412 @@
+# Epic Issues API **[ULTIMATE]**
+
+Every API call to epic_issues must be authenticated.
+
+If a user is not a member of a group and the group is private, a `GET` request on that group will result to a `404` status code.
+
+Epics are available only in Ultimate. If epics feature is not available a `403` status code will be returned.
+
+## List issues for an epic
+Gets all issues that are assigned to an epic and the authenticated user has access to.
+
+```
+GET /groups/:id/epics/:epic_iid/issues
+```
+
+| Attribute | Type | Required | Description |
+| ------------------- | ---------------- | ---------- | ---------------------------------------------------------------------------------------|
+| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `epic_iid` | integer/string | yes | The internal ID of the epic. |
+
+```bash
+curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/1/epics/5/issues/
+```
+
+Example response:
+
+```json
+[
+ {
+ "id": 76,
+ "iid": 6,
+ "project_id": 8,
+ "title" : "Consequatur vero maxime deserunt laboriosam est voluptas dolorem.",
+ "description" : "Ratione dolores corrupti mollitia soluta quia.",
+ "state": "opened",
+ "created_at": "2017-11-15T13:39:24.670Z",
+ "updated_at": "2018-01-04T10:49:19.506Z",
+ "closed_at": null,
+ "labels": [],
+ "milestone": {
+ "id": 38,
+ "iid": 3,
+ "project_id": 8,
+ "title": "v2.0",
+ "description": "In tempore culpa inventore quo accusantium.",
+ "state": "closed",
+ "created_at": "2017-11-15T13:39:13.825Z",
+ "updated_at": "2017-11-15T13:39:13.825Z",
+ "due_date": null,
+ "start_date": null
+ },
+ "assignees": [{
+ "id": 7,
+ "name": "Pamella Huel",
+ "username": "arnita",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
+ "web_url": "http://localhost:3001/arnita"
+ }],
+ "assignee": {
+ "id": 7,
+ "name": "Pamella Huel",
+ "username": "arnita",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
+ "web_url": "http://localhost:3001/arnita"
+ },
+ "author": {
+ "id": 13,
+ "name": "Michell Johns",
+ "username": "chris_hahn",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/30e3b2122ccd6b8e45e8e14a3ffb58fc?s=80&d=identicon",
+ "web_url": "http://localhost:3001/chris_hahn"
+ },
+ "user_notes_count": 8,
+ "upvotes": 0,
+ "downvotes": 0,
+ "due_date": null,
+ "confidential": false,
+ "weight": null,
+ "discussion_locked": null,
+ "web_url": "http://localhost:3001/h5bp/html5-boilerplate/issues/6",
+ "time_stats": {
+ "time_estimate": 0,
+ "total_time_spent": 0,
+ "human_time_estimate": null,
+ "human_total_time_spent": null
+ },
+ "_links":{
+ "self": "http://localhost:3001/api/v4/projects/8/issues/6",
+ "notes": "http://localhost:3001/api/v4/projects/8/issues/6/notes",
+ "award_emoji": "http://localhost:3001/api/v4/projects/8/issues/6/award_emoji",
+ "project": "http://localhost:3001/api/v4/projects/8"
+ },
+ "subscribed": true,
+ "epic_issue_id": 2
+ }
+]
+```
+
+**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
+
+## Assign an issue to the epic
+
+Creates an epic - issue association. If the issue in question belongs to another epic it is unassigned from that epic.
+
+```
+POST /groups/:id/epics/:epic_iid/issues/:issue_id
+```
+
+| Attribute | Type | Required | Description |
+| ------------------- | ---------------- | ---------- | ---------------------------------------------------------------------------------------|
+| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `epic_iid` | integer/string | yes | The internal ID of the epic. |
+| `issue_id` | integer/string | yes | The ID of the issue. |
+
+```bash
+curl --header POST "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/1/epics/5/issues/55
+```
+
+Example response:
+
+```json
+{
+ "id": 11,
+ "epic": {
+ "id": 30,
+ "iid": 5,
+ "title": "Ea cupiditate dolores ut vero consequatur quasi veniam voluptatem et non.",
+ "description": "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",
+ "author": {
+ "id": 7,
+ "name": "Pamella Huel",
+ "username": "arnita",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
+ "web_url": "http://localhost:3001/arnita"
+ },
+ "start_date": null,
+ "end_date": null
+ },
+ "issue": {
+ "id": 55,
+ "iid": 13,
+ "project_id": 8,
+ "title": "Beatae laborum voluptatem voluptate eligendi ex accusamus.",
+ "description": "Quam veritatis debitis omnis aliquam sit.",
+ "state": "opened",
+ "created_at": "2017-11-05T13:59:12.782Z",
+ "updated_at": "2018-01-05T10:33:03.900Z",
+ "closed_at": null,
+ "labels": [],
+ "milestone": {
+ "id": 48,
+ "iid": 6,
+ "project_id": 8,
+ "title": "Sprint - Sed sed maxime temporibus ipsa ullam qui sit.",
+ "description": "Quos veritatis qui expedita sunt deleniti accusamus.",
+ "state": "active",
+ "created_at": "2017-11-05T13:59:12.445Z",
+ "updated_at": "2017-11-05T13:59:12.445Z",
+ "due_date": "2017-11-13",
+ "start_date": "2017-11-05"
+ },
+ "assignees": [{
+ "id": 10,
+ "name": "Lu Mayer",
+ "username": "kam",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/018729e129a6f31c80a6327a30196823?s=80&d=identicon",
+ "web_url": "http://localhost:3001/kam"
+ }],
+ "assignee": {
+ "id": 10,
+ "name": "Lu Mayer",
+ "username": "kam",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/018729e129a6f31c80a6327a30196823?s=80&d=identicon",
+ "web_url": "http://localhost:3001/kam"
+ },
+ "author": {
+ "id": 25,
+ "name": "User 3",
+ "username": "user3",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/97d6d9441ff85fdc730e02a6068d267b?s=80&d=identicon",
+ "web_url": "http://localhost:3001/user3"
+ },
+ "user_notes_count": 0,
+ "upvotes": 0,
+ "downvotes": 0,
+ "due_date": null,
+ "confidential": false,
+ "weight": null,
+ "discussion_locked": null,
+ "web_url": "http://localhost:3001/h5bp/html5-boilerplate/issues/13",
+ "time_stats": {
+ "time_estimate": 0,
+ "total_time_spent": 0,
+ "human_time_estimate": null,
+ "human_total_time_spent": null
+ }
+ }
+}
+```
+
+**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
+
+## Remove an issue from the epic
+
+Removes an epic - issue association.
+
+```
+DELETE /groups/:id/epics/:epic_iid/issues/:epic_issue_id
+```
+
+| Attribute | Type | Required | Description |
+| ------------------- | ---------------- | ---------- | -----------------------------------------------------------------------------------------------------|
+| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `epic_iid` | integer/string | yes | The internal ID of the epic. |
+| `epic_issue_id` | integer/string | yes | The ID of the issue - epic association. |
+
+```bash
+curl --header DELETE "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/1/epics/5/issues/11
+```
+
+Example response:
+
+```json
+{
+ "id": 11,
+ "epic": {
+ "id": 30,
+ "iid": 5,
+ "title": "Ea cupiditate dolores ut vero consequatur quasi veniam voluptatem et non.",
+ "description": "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",
+ "author": {
+ "id": 7,
+ "name": "Pamella Huel",
+ "username": "arnita",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
+ "web_url": "http://localhost:3001/arnita"
+ },
+ "start_date": null,
+ "end_date": null
+ },
+ "issue": {
+ "id": 223,
+ "iid": 13,
+ "project_id": 8,
+ "title": "Beatae laborum voluptatem voluptate eligendi ex accusamus.",
+ "description": "Quam veritatis debitis omnis aliquam sit.",
+ "state": "opened",
+ "created_at": "2017-11-05T13:59:12.782Z",
+ "updated_at": "2018-01-05T10:33:03.900Z",
+ "closed_at": null,
+ "labels": [],
+ "milestone": {
+ "id": 48,
+ "iid": 6,
+ "project_id": 8,
+ "title": "Sprint - Sed sed maxime temporibus ipsa ullam qui sit.",
+ "description": "Quos veritatis qui expedita sunt deleniti accusamus.",
+ "state": "active",
+ "created_at": "2017-11-05T13:59:12.445Z",
+ "updated_at": "2017-11-05T13:59:12.445Z",
+ "due_date": "2017-11-13",
+ "start_date": "2017-11-05"
+ },
+ "assignees": [{
+ "id": 10,
+ "name": "Lu Mayer",
+ "username": "kam",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/018729e129a6f31c80a6327a30196823?s=80&d=identicon",
+ "web_url": "http://localhost:3001/kam"
+ }],
+ "assignee": {
+ "id": 10,
+ "name": "Lu Mayer",
+ "username": "kam",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/018729e129a6f31c80a6327a30196823?s=80&d=identicon",
+ "web_url": "http://localhost:3001/kam"
+ },
+ "author": {
+ "id": 25,
+ "name": "User 3",
+ "username": "user3",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/97d6d9441ff85fdc730e02a6068d267b?s=80&d=identicon",
+ "web_url": "http://localhost:3001/user3"
+ },
+ "user_notes_count": 0,
+ "upvotes": 0,
+ "downvotes": 0,
+ "due_date": null,
+ "confidential": false,
+ "weight": null,
+ "discussion_locked": null,
+ "web_url": "http://localhost:3001/h5bp/html5-boilerplate/issues/13",
+ "time_stats": {
+ "time_estimate": 0,
+ "total_time_spent": 0,
+ "human_time_estimate": null,
+ "human_total_time_spent": null
+ }
+ }
+}
+```
+
+**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
+
+## Update epic - issue association
+
+Updates an epic - issue association.
+
+```
+PUT /groups/:id/epics/:epic_iid/issues/:epic_issue_id
+```
+
+| Attribute | Type | Required | Description |
+| ------------------- | ---------------- | ---------- | -----------------------------------------------------------------------------------------------------|
+| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `epic_iid` | integer/string | yes | The internal ID of the epic. |
+| `epic_issue_id` | integer/string | yes | The ID of the issue - epic association. |
+| `move_before_id` | integer/string | no | The ID of the issue - epic association that should be placed before the link in the question. |
+| `move_after_id` | integer/string | no | The ID of the issue - epic association that should be placed after the link in the question. |
+
+```bash
+curl --header PUT "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/1/epics/5/issues/11?move_before_id=20
+```
+
+Example response:
+
+```json
+[
+ {
+ "id": 30,
+ "iid": 6,
+ "project_id": 8,
+ "title" : "Consequatur vero maxime deserunt laboriosam est voluptas dolorem.",
+ "description" : "Ratione dolores corrupti mollitia soluta quia.",
+ "state": "opened",
+ "created_at": "2017-11-15T13:39:24.670Z",
+ "updated_at": "2018-01-04T10:49:19.506Z",
+ "closed_at": null,
+ "labels": [],
+ "milestone": {
+ "id": 38,
+ "iid": 3,
+ "project_id": 8,
+ "title": "v2.0",
+ "description": "In tempore culpa inventore quo accusantium.",
+ "state": "closed",
+ "created_at": "2017-11-15T13:39:13.825Z",
+ "updated_at": "2017-11-15T13:39:13.825Z",
+ "due_date": null,
+ "start_date": null
+ },
+ "assignees": [{
+ "id": 7,
+ "name": "Pamella Huel",
+ "username": "arnita",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
+ "web_url": "http://localhost:3001/arnita"
+ }],
+ "assignee": {
+ "id": 7,
+ "name": "Pamella Huel",
+ "username": "arnita",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
+ "web_url": "http://localhost:3001/arnita"
+ },
+ "author": {
+ "id": 13,
+ "name": "Michell Johns",
+ "username": "chris_hahn",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/30e3b2122ccd6b8e45e8e14a3ffb58fc?s=80&d=identicon",
+ "web_url": "http://localhost:3001/chris_hahn"
+ },
+ "user_notes_count": 8,
+ "upvotes": 0,
+ "downvotes": 0,
+ "due_date": null,
+ "confidential": false,
+ "weight": null,
+ "discussion_locked": null,
+ "web_url": "http://localhost:3001/h5bp/html5-boilerplate/issues/6",
+ "time_stats": {
+ "time_estimate": 0,
+ "total_time_spent": 0,
+ "human_time_estimate": null,
+ "human_total_time_spent": null
+ },
+ "_links":{
+ "self": "http://localhost:3001/api/v4/projects/8/issues/6",
+ "notes": "http://localhost:3001/api/v4/projects/8/issues/6/notes",
+ "award_emoji": "http://localhost:3001/api/v4/projects/8/issues/6/award_emoji",
+ "project": "http://localhost:3001/api/v4/projects/8"
+ },
+ "subscribed": true,
+ "epic_issue_id": 11,
+ "relative_position": 55
+ }
+]
+```
diff --git a/doc/api/epic_links.md b/doc/api/epic_links.md
new file mode 100644
index 00000000000..619ae6ea2dc
--- /dev/null
+++ b/doc/api/epic_links.md
@@ -0,0 +1,252 @@
+# Epic Links API **[ULTIMATE]**
+
+>**Note:**
+> This endpoint was [introduced](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9188) in GitLab 11.8.
+
+Manages parent-child [epic relationships](../user/group/epics/index.md#multi-level-child-epics).
+
+Every API call to `epic_links` must be authenticated.
+
+If a user is not a member of a group and the group is private, a `GET` request on that group will result to a `404` status code.
+
+Epics are available only in the [Ultimate/Gold tier](https://about.gitlab.com/pricing/). If the epics feature is not available, a `403` status code will be returned.
+
+## List epics related to a given epic
+Gets all child epics of an epic.
+
+```
+GET /groups/:id/epics/:epic_iid/epics
+```
+
+| Attribute | Type | Required | Description |
+| ---------- | -------------- | -------- | ------------------------------------------------------------------------------------------------------------- |
+| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `epic_iid` | integer | yes | The internal ID of the epic. |
+
+```bash
+curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/1/epics/5/epics/
+```
+
+Example response:
+
+```json
+[
+ {
+ "id": 29,
+ "iid": 6,
+ "group_id": 1,
+ "parent_id": 5,
+ "title": "Accusamus iste et ullam ratione voluptatem omnis debitis dolor est.",
+ "description": "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",
+ "author": {
+ "id": 10,
+ "name": "Lu Mayer",
+ "username": "kam",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/018729e129a6f31c80a6327a30196823?s=80&d=identicon",
+ "web_url": "http://localhost:3001/kam"
+ },
+ "start_date": null,
+ "start_date_is_fixed": false,
+ "start_date_fixed": null,
+ "start_date_from_milestones": null,
+ "end_date": "2018-07-31",
+ "due_date": "2018-07-31",
+ "due_date_is_fixed": false,
+ "due_date_fixed": null,
+ "due_date_from_milestones": "2018-07-31",
+ "created_at": "2018-07-17T13:36:22.770Z",
+ "updated_at": "2018-07-18T12:22:05.239Z",
+ "labels": []
+ }
+]
+```
+
+## Assign a child epic
+
+Creates an association between two epics, designating one as the parent epic and the other as the child epic. A parent epic can have multiple child epics. If the new child epic already belonged to another epic, it is unassigned from that previous parent.
+
+```
+POST /groups/:id/epics/:epic_iid/epics
+```
+
+| Attribute | Type | Required | Description |
+| --------------- | -------------- | -------- | ------------------------------------------------------------------------------------------------------------------ |
+| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `epic_iid` | integer | yes | The internal ID of the epic. |
+| `child_epic_id` | integer | yes | The global ID of the child epic. Internal ID can't be used because they can conflict with epics from other groups. |
+
+```bash
+curl --header POST "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/1/epics/5/epics/6
+```
+
+Example response:
+
+```json
+{
+ "id": 6,
+ "iid": 38,
+ "group_id": 1,
+ "parent_id": 5
+ "title": "Accusamus iste et ullam ratione voluptatem omnis debitis dolor est.",
+ "description": "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",
+ "author": {
+ "id": 10,
+ "name": "Lu Mayer",
+ "username": "kam",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/018729e129a6f31c80a6327a30196823?s=80&d=identicon",
+ "web_url": "http://localhost:3001/kam"
+ },
+ "start_date": null,
+ "start_date_is_fixed": false,
+ "start_date_fixed": null,
+ "start_date_from_milestones": null,
+ "end_date": "2018-07-31",
+ "due_date": "2018-07-31",
+ "due_date_is_fixed": false,
+ "due_date_fixed": null,
+ "due_date_from_milestones": "2018-07-31",
+ "created_at": "2018-07-17T13:36:22.770Z",
+ "updated_at": "2018-07-18T12:22:05.239Z",
+ "labels": []
+}
+```
+
+## Create and assign a child epic
+
+Creates a a new epic and associates it with provided parent epic. The response is LinkedEpic object.
+
+```
+POST /groups/:id/epics/:epic_iid/epics
+```
+
+| Attribute | Type | Required | Description |
+| --------------- | -------------- | -------- | ------------------------------------------------------------------------------------------------------------------ |
+| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `epic_iid` | integer | yes | The internal ID of the (future parent) epic. |
+| `title` | integer | yes | The global ID of the child epic. Internal ID can't be used because they can conflict with epics from other groups. |
+
+```bash
+curl --header POST "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/1/epics/5/epics?title=Newpic
+```
+
+Example response:
+
+```json
+{
+ "id": 24,
+ "iid": 2,
+ "title": "child epic",
+ "group_id": 49,
+ "parent_id": 23,
+ "has_children": false,
+ "reference": "&2",
+ "url": "http://localhost/groups/group16/-/epics/2",
+ "relation_url": "http://localhost/groups/group16/-/epics/1/links/24"
+}
+```
+
+## Re-order a child epic
+
+```
+PUT /groups/:id/epics/:epic_iid/epics/:child_epic_id
+```
+
+| Attribute | Type | Required | Description |
+| ---------------- | -------------- | -------- | ------------------------------------------------------------------------------------------------------------------ |
+| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user. |
+| `epic_iid` | integer | yes | The internal ID of the epic. |
+| `child_epic_id` | integer | yes | The global ID of the child epic. Internal ID can't be used because they can conflict with epics from other groups. |
+| `move_before_id` | integer | no | The global ID of a sibling epic that should be placed before the child epic. |
+| `move_after_id` | integer | no | The global ID of a sibling epic that should be placed after the child epic. |
+
+```bash
+curl --header PUT "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/1/epics/4/epics/5
+```
+
+Example response:
+
+```json
+[
+ {
+ "id": 29,
+ "iid": 6,
+ "group_id": 1,
+ "parent_id": 5,
+ "title": "Accusamus iste et ullam ratione voluptatem omnis debitis dolor est.",
+ "description": "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",
+ "author": {
+ "id": 10,
+ "name": "Lu Mayer",
+ "username": "kam",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/018729e129a6f31c80a6327a30196823?s=80&d=identicon",
+ "web_url": "http://localhost:3001/kam"
+ },
+ "start_date": null,
+ "start_date_is_fixed": false,
+ "start_date_fixed": null,
+ "start_date_from_milestones": null,
+ "end_date": "2018-07-31",
+ "due_date": "2018-07-31",
+ "due_date_is_fixed": false,
+ "due_date_fixed": null,
+ "due_date_from_milestones": "2018-07-31",
+ "created_at": "2018-07-17T13:36:22.770Z",
+ "updated_at": "2018-07-18T12:22:05.239Z",
+ "labels": []
+ }
+]
+```
+
+## Unassign a child epic
+
+Unassigns a child epic from a parent epic.
+
+```
+DELETE /groups/:id/epics/:epic_iid/epics/:child_epic_id
+```
+
+| Attribute | Type | Required | Description |
+| --------------- | -------------- | -------- | ------------------------------------------------------------------------------------------------------------------ |
+| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user. |
+| `epic_iid` | integer | yes | The internal ID of the epic. |
+| `child_epic_id` | integer | yes | The global ID of the child epic. Internal ID can't be used because they can conflict with epics from other groups. |
+
+```bash
+curl --header DELETE "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/1/epics/4/epics/5
+```
+
+Example response:
+
+```json
+{
+ "id": 5,
+ "iid": 38,
+ "group_id": 1,
+ "parent_id": null,
+ "title": "Accusamus iste et ullam ratione voluptatem omnis debitis dolor est.",
+ "description": "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",
+ "author": {
+ "id": 10,
+ "name": "Lu Mayer",
+ "username": "kam",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/018729e129a6f31c80a6327a30196823?s=80&d=identicon",
+ "web_url": "http://localhost:3001/kam"
+ },
+ "start_date": null,
+ "start_date_is_fixed": false,
+ "start_date_fixed": null,
+ "start_date_from_milestones": null,
+ "end_date": "2018-07-31",
+ "due_date": "2018-07-31",
+ "due_date_is_fixed": false,
+ "due_date_fixed": null,
+ "due_date_from_milestones": "2018-07-31",
+ "created_at": "2018-07-17T13:36:22.770Z",
+ "updated_at": "2018-07-18T12:22:05.239Z",
+ "labels": []
+}
+```
diff --git a/doc/api/epics.md b/doc/api/epics.md
new file mode 100644
index 00000000000..0541cfaa715
--- /dev/null
+++ b/doc/api/epics.md
@@ -0,0 +1,360 @@
+# Epics API **[ULTIMATE]**
+
+Every API call to epic must be authenticated.
+
+If a user is not a member of a group and the group is private, a `GET` request on that group will result to a `404` status code.
+
+If epics feature is not available a `403` status code will be returned.
+
+## Epic issues API
+
+The [epic issues API](epic_issues.md) allows you to interact with issues associated with an epic.
+
+# Milestone dates integration
+
+> [Introduced][ee-6448] in GitLab 11.3.
+
+Since start date and due date can be dynamically sourced from related issue milestones, when user has edit permission, additional fields will be shown. These include two boolean fields `start_date_is_fixed` and `due_date_is_fixed`, and four date fields `start_date_fixed`, `start_date_from_milestones`, `due_date_fixed` and `due_date_from_milestones`.
+
+`end_date` has been deprecated in favor of `due_date`.
+
+## Epics pagination
+
+By default, `GET` requests return 20 results at a time because the API results
+are paginated.
+
+Read more on [pagination](README.md#pagination).
+
+## List epics for a group
+
+Gets all epics of the requested group and its subgroups.
+
+```
+GET /groups/:id/epics
+GET /groups/:id/epics?author_id=5
+GET /groups/:id/epics?labels=bug,reproduced
+GET /groups/:id/epics?state=opened
+```
+
+| Attribute | Type | Required | Description |
+| ------------------- | ---------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------- |
+| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `author_id` | integer | no | Return epics created by the given user `id` |
+| `labels` | string | no | Return epics matching a comma separated list of labels names. Label names from the epic group or a parent group can be used |
+| `order_by` | string | no | Return epics ordered by `created_at` or `updated_at` fields. Default is `created_at` |
+| `sort` | string | no | Return epics sorted in `asc` or `desc` order. Default is `desc` |
+| `search` | string | no | Search epics against their `title` and `description` |
+| `state` | string | no | Search epics against their `state`, possible filters: `opened`, `closed` and `all`, default: `all` |
+| `created_after` | datetime | no | Return epics created on or after the given time |
+| `created_before` | datetime | no | Return epics created on or before the given time |
+| `updated_after` | datetime | no | Return epics updated on or after the given time |
+| `updated_before` | datetime | no | Return epics updated on or before the given time |
+
+```bash
+curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/1/epics
+```
+
+Example response:
+
+```json
+[
+ {
+ "id": 29,
+ "iid": 4,
+ "group_id": 7,
+ "title": "Accusamus iste et ullam ratione voluptatem omnis debitis dolor est.",
+ "description": "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",
+ "state": "opened",
+ "author": {
+ "id": 10,
+ "name": "Lu Mayer",
+ "username": "kam",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/018729e129a6f31c80a6327a30196823?s=80&d=identicon",
+ "web_url": "http://localhost:3001/kam"
+ },
+ "start_date": null,
+ "start_date_is_fixed": false,
+ "start_date_fixed": null,
+ "start_date_from_milestones": null,
+ "end_date": "2018-07-31",
+ "due_date": "2018-07-31",
+ "due_date_is_fixed": false,
+ "due_date_fixed": null,
+ "due_date_from_milestones": "2018-07-31",
+ "created_at": "2018-07-17T13:36:22.770Z",
+ "updated_at": "2018-07-18T12:22:05.239Z",
+ "labels": [],
+ "upvotes": 4,
+ "downvotes": 0
+ }
+]
+```
+
+## Single epic
+
+Gets a single epic
+
+```
+GET /groups/:id/epics/:epic_iid
+```
+
+| Attribute | Type | Required | Description |
+| ------------------- | ---------------- | ---------- | ---------------------------------------------------------------------------------------|
+| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `epic_iid` | integer/string | yes | The internal ID of the epic. |
+
+```bash
+curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/1/epics/5
+```
+
+Example response:
+
+```json
+{
+ "id": 30,
+ "iid": 5,
+ "group_id": 7,
+ "title": "Ea cupiditate dolores ut vero consequatur quasi veniam voluptatem et non.",
+ "description": "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",
+ "state": "opened",
+ "author":{
+ "id": 7,
+ "name": "Pamella Huel",
+ "username": "arnita",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
+ "web_url": "http://localhost:3001/arnita"
+ },
+ "start_date": null,
+ "start_date_is_fixed": false,
+ "start_date_fixed": null,
+ "start_date_from_milestones": null,
+ "end_date": "2018-07-31",
+ "due_date": "2018-07-31",
+ "due_date_is_fixed": false,
+ "due_date_fixed": null,
+ "due_date_from_milestones": "2018-07-31",
+ "created_at": "2018-07-17T13:36:22.770Z",
+ "updated_at": "2018-07-18T12:22:05.239Z",
+ "labels": [],
+ "upvotes": 4,
+ "downvotes": 0
+}
+```
+
+## New epic
+
+Creates a new epic.
+
+NOTE: **Note:**
+Starting with GitLab [11.3][ee-6448], `start_date` and `end_date` should no longer be assigned
+directly, as they now represent composite values. You can configure it via the `*_is_fixed` and
+`*_fixed` fields instead.
+
+```
+POST /groups/:id/epics
+```
+
+| Attribute | Type | Required | Description |
+| ------------------- | ---------------- | ---------- | ---------------------------------------------------------------------------------------|
+| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `title` | string | yes | The title of the epic |
+| `labels` | string | no | The comma separated list of labels |
+| `description` | string | no | The description of the epic |
+| `start_date_is_fixed` | boolean | no | Whether start date should be sourced from `start_date_fixed` or from milestones (since 11.3) |
+| `start_date_fixed` | string | no | The fixed start date of an epic (since 11.3) |
+| `due_date_is_fixed` | boolean | no | Whether due date should be sourced from `due_date_fixed` or from milestones (since 11.3) |
+| `due_date_fixed` | string | no | The fixed due date of an epic (since 11.3) |
+| `parent_id` | integer/string | no | The id of a parent epic (since 11.11) |
+
+```bash
+curl --header POST "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/1/epics?title=Epic&description=Epic%20description
+```
+
+Example response:
+
+```json
+{
+ "id": 33,
+ "iid": 6,
+ "group_id": 7,
+ "title": "Epic",
+ "description": "Epic description",
+ "state": "opened",
+ "author": {
+ "name" : "Alexandra Bashirian",
+ "avatar_url" : null,
+ "state" : "active",
+ "web_url" : "https://gitlab.example.com/eileen.lowe",
+ "id" : 18,
+ "username" : "eileen.lowe"
+ },
+ "start_date": null,
+ "start_date_is_fixed": false,
+ "start_date_fixed": null,
+ "start_date_from_milestones": null,
+ "end_date": "2018-07-31",
+ "due_date": "2018-07-31",
+ "due_date_is_fixed": false,
+ "due_date_fixed": null,
+ "due_date_from_milestones": "2018-07-31",
+ "created_at": "2018-07-17T13:36:22.770Z",
+ "updated_at": "2018-07-18T12:22:05.239Z",
+ "labels": [],
+ "upvotes": 4,
+ "downvotes": 0
+}
+```
+
+## Update epic
+
+Updates an epic.
+
+NOTE: **Note:**
+Starting with GitLab [11.3][ee-6448], `start_date` and `end_date` should no longer be assigned
+directly, as they now represent composite values. You can configure it via the `*_is_fixed` and
+`*_fixed` fields instead.
+
+```
+PUT /groups/:id/epics/:epic_iid
+```
+
+| Attribute | Type | Required | Description |
+| ------------------- | ---------------- | ---------- | ---------------------------------------------------------------------------------------|
+| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `epic_iid` | integer/string | yes | The internal ID of the epic |
+| `title` | string | no | The title of an epic |
+| `description` | string | no | The description of an epic |
+| `labels` | string | no | The comma separated list of labels |
+| `start_date_is_fixed` | boolean | no | Whether start date should be sourced from `start_date_fixed` or from milestones (since 11.3) |
+| `start_date_fixed` | string | no | The fixed start date of an epic (since 11.3) |
+| `due_date_is_fixed` | boolean | no | Whether due date should be sourced from `due_date_fixed` or from milestones (since 11.3) |
+| `due_date_fixed` | string | no | The fixed due date of an epic (since 11.3) |
+| `state_event` | string | no | State event for an epic. Set `close` to close the epic and `reopen` to reopen it (since 11.4) |
+
+```bash
+curl --header PUT "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/1/epics/5?title=New%20Title
+```
+
+Example response:
+
+```json
+{
+ "id": 33,
+ "iid": 6,
+ "group_id": 7,
+ "title": "New Title",
+ "description": "Epic description",
+ "state": "opened",
+ "author": {
+ "name" : "Alexandra Bashirian",
+ "avatar_url" : null,
+ "state" : "active",
+ "web_url" : "https://gitlab.example.com/eileen.lowe",
+ "id" : 18,
+ "username" : "eileen.lowe"
+ },
+ "start_date": null,
+ "start_date_is_fixed": false,
+ "start_date_fixed": null,
+ "start_date_from_milestones": null,
+ "end_date": "2018-07-31",
+ "due_date": "2018-07-31",
+ "due_date_is_fixed": false,
+ "due_date_fixed": null,
+ "due_date_from_milestones": "2018-07-31",
+ "created_at": "2018-07-17T13:36:22.770Z",
+ "updated_at": "2018-07-18T12:22:05.239Z",
+ "labels": [],
+ "upvotes": 4,
+ "downvotes": 0
+}
+```
+
+## Delete epic
+
+Deletes an epic
+
+```
+DELETE /groups/:id/epics/:epic_iid
+```
+
+| Attribute | Type | Required | Description |
+| ------------------- | ---------------- | ---------- | ---------------------------------------------------------------------------------------|
+| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `epic_iid` | integer/string | yes | The internal ID of the epic. |
+
+```bash
+curl --header DELETE "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/1/epics/5
+```
+
+## Create a todo
+
+Manually creates a todo for the current user on an epic. If
+there already exists a todo for the user on that epic, status code `304` is
+returned.
+
+```
+POST /groups/:id/epics/:epic_iid/todo
+```
+
+| Attribute | Type | Required | Description |
+|-------------|---------|----------|--------------------------------------|
+| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `epic_iid ` | integer | yes | The internal ID of a group's epic |
+
+```bash
+curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/1/epics/5/todo
+```
+
+Example response:
+
+```json
+{
+ "id": 112,
+ "group": {
+ "id": 1,
+ "name": "Gitlab",
+ "path": "gitlab",
+ "kind": "group",
+ "full_path": "base/gitlab",
+ "parent_id": null
+ },
+ "author": {
+ "name": "Administrator",
+ "username": "root",
+ "id": 1,
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
+ "web_url": "https://gitlab.example.com/root"
+ },
+ "action_name": "marked",
+ "target_type": "epic",
+ "target": {
+ "id": 30,
+ "iid": 5,
+ "group_id": 1,
+ "title": "Ea cupiditate dolores ut vero consequatur quasi veniam voluptatem et non.",
+ "description": "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",
+ "author":{
+ "id": 7,
+ "name": "Pamella Huel",
+ "username": "arnita",
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
+ "web_url": "http://localhost:3001/arnita"
+ },
+ "start_date": null,
+ "end_date": null,
+ "created_at": "2018-01-21T06:21:13.165Z",
+ "updated_at": "2018-01-22T12:41:41.166Z"
+ },
+ "target_url": "https://gitlab.example.com/groups/epics/5",
+ "body": "Vel voluptas atque dicta mollitia adipisci qui at.",
+ "state": "pending",
+ "created_at": "2016-07-01T11:09:13.992Z"
+}
+```
+
+[ee-6448]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/6448
diff --git a/doc/api/geo_nodes.md b/doc/api/geo_nodes.md
new file mode 100644
index 00000000000..a1cb524499f
--- /dev/null
+++ b/doc/api/geo_nodes.md
@@ -0,0 +1,408 @@
+# Geo Nodes API **[PREMIUM ONLY]**
+
+In order to interact with Geo node endpoints, you need to authenticate yourself
+as an admin.
+
+## Retrieve configuration about all Geo nodes
+
+```
+GET /geo_nodes
+```
+
+```bash
+curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/geo_nodes
+```
+
+Example response:
+
+```json
+[
+ {
+ "id": 1,
+ "name": "us-node",
+ "url": "https://primary.example.com/",
+ "internal_url": "https://internal.example.com/",
+ "primary": true,
+ "enabled": true,
+ "current": true,
+ "files_max_capacity": 10,
+ "repos_max_capacity": 25,
+ "verification_max_capacity": 100,
+ "clone_protocol": "http"
+ },
+ {
+ "id": 2,
+ "name": "cn-node",
+ "url": "https://secondary.example.com/",
+ "internal_url": "https://secondary.example.com/",
+ "primary": false,
+ "enabled": true,
+ "current": false,
+ "files_max_capacity": 10,
+ "repos_max_capacity": 25,
+ "verification_max_capacity": 100,
+ "clone_protocol": "http"
+ }
+]
+```
+
+## Retrieve configuration about a specific Geo node
+
+```
+GET /geo_nodes/:id
+```
+
+```bash
+curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/geo_nodes/1
+```
+
+Example response:
+
+```json
+{
+ "id": 1,
+ "name": "us-node",
+ "url": "https://primary.example.com/",
+ "internal_url": "https://primary.example.com/",
+ "primary": true,
+ "enabled": true,
+ "current": true,
+ "files_max_capacity": 10,
+ "repos_max_capacity": 25,
+ "verification_max_capacity": 100,
+ "clone_protocol": "http"
+}
+```
+
+## Edit a Geo node
+
+Updates settings of an existing Geo node.
+
+_This can only be run against a primary Geo node._
+
+```
+PUT /geo_nodes/:id
+```
+
+| Attribute | Type | Required | Description |
+|----------------------|---------|-----------|---------------------------------------------------------------------------|
+| `id` | integer | yes | The ID of the Geo node. |
+| `enabled` | boolean | no | Flag indicating if the Geo node is enabled. |
+| `name` | string | yes | The unique identifier for the Geo node. Must match `geo_node_name` if it is set in gitlab.rb, otherwise it must match `external_url`. |
+| `url` | string | yes | The user-facing URL of the Geo node. |
+| `internal_url` | string | no | The URL defined on the primary node that secondary nodes should use to contact it. Returns `url` if not set.|
+| `files_max_capacity` | integer | no | Control the maximum concurrency of LFS/attachment backfill for this secondary node. |
+| `repos_max_capacity` | integer | no | Control the maximum concurrency of repository backfill for this secondary node. |
+| `verification_max_capacity` | integer | no | Control the maximum concurrency of verification for this node. |
+
+Example response:
+
+```json
+{
+ "id": 1,
+ "name": "cn-node",
+ "url": "https://secondary.example.com/",
+ "internal_url": "https://secondary.example.com/",
+ "primary": false,
+ "enabled": true,
+ "current": true,
+ "files_max_capacity": 10,
+ "repos_max_capacity": 25,
+ "verification_max_capacity": 100,
+ "clone_protocol": "http"
+}
+```
+
+## Delete a Geo node
+
+Removes the Geo node.
+
+NOTE: **Note:**
+Only a Geo primary node will accept this request.
+
+```
+DELETE /geo_nodes/:id
+```
+
+| Attribute | Type | Required | Description |
+|-----------|---------|----------|-------------------------|
+| `id` | integer | yes | The ID of the Geo node. |
+
+## Repair a Geo node
+
+To repair the OAuth authentication of a Geo node.
+
+_This can only be run against a primary Geo node._
+
+```
+POST /geo_nodes/:id/repair
+```
+
+Example response:
+
+```json
+{
+ "id": 1,
+ "name": "us-node",
+ "url": "https://primary.example.com/",
+ "internal_url": "https://primary.example.com/",
+ "primary": true,
+ "enabled": true,
+ "current": true,
+ "files_max_capacity": 10,
+ "repos_max_capacity": 25,
+ "verification_max_capacity": 100,
+ "clone_protocol": "http"
+}
+```
+
+## Retrieve status about all Geo nodes
+
+```
+GET /geo_nodes/status
+```
+
+```bash
+curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/geo_nodes/status
+```
+
+Example response:
+
+```json
+[
+ {
+ "geo_node_id": 1,
+ "healthy": true,
+ "health": "Healthy",
+ "health_status": "Healthy",
+ "missing_oauth_application": false,
+ "attachments_count": 1,
+ "attachments_synced_count": nil,
+ "attachments_failed_count": nil,
+ "attachments_synced_missing_on_primary_count": 0,
+ "attachments_synced_in_percentage": "0.00%",
+ "db_replication_lag_seconds": nil,
+ "lfs_objects_count": 0,
+ "lfs_objects_synced_count": nil,
+ "lfs_objects_failed_count": nil,
+ "lfs_objects_synced_missing_on_primary_count": 0,
+ "lfs_objects_synced_in_percentage": "0.00%",
+ "job_artifacts_count": 2,
+ "job_artifacts_synced_count": nil,
+ "job_artifacts_failed_count": nil,
+ "job_artifacts_synced_missing_on_primary_count": 0,
+ "job_artifacts_synced_in_percentage": "0.00%",
+ "repositories_count": 41,
+ "projects_count": 41,
+ "repositories_failed_count": nil,
+ "repositories_synced_count": nil,
+ "repositories_synced_in_percentage": "0.00%",
+ "wikis_count": 41,
+ "wikis_failed_count": nil,
+ "wikis_synced_count": nil,
+ "wikis_synced_in_percentage": "0.00%",
+ "replication_slots_count": 1,
+ "replication_slots_used_count": 1,
+ "replication_slots_used_in_percentage": "100.00%",
+ "replication_slots_max_retained_wal_bytes": 0,
+ "repositories_checked_count": 20,
+ "repositories_checked_failed_count": 20,
+ "repositories_checked_in_percentage": "100.00%",
+ "repositories_checksummed_count": 20,
+ "repositories_checksum_failed_count": 5,
+ "repositories_checksummed_in_percentage": "48.78%",
+ "wikis_checksummed_count": 10,
+ "wikis_checksum_failed_count": 3,
+ "wikis_checksummed_in_percentage": "24.39%",
+ "repositories_verified_count": 20,
+ "repositories_verification_failed_count": 5,
+ "repositories_verified_in_percentage": "48.78%",
+ "repositories_checksum_mismatch_count": 3,
+ "wikis_verified_count": 10,
+ "wikis_verification_failed_count": 3,
+ "wikis_verified_in_percentage": "24.39%",
+ "wikis_checksum_mismatch_count": 1,
+ "repositories_retrying_verification_count": 1,
+ "wikis_retrying_verification_count": 3,
+ "repositories_checked_count": 7,
+ "repositories_checked_failed_count": 2,
+ "repositories_checked_in_percentage": "17.07%",
+ "last_event_id": 23,
+ "last_event_timestamp": 1509681166,
+ "cursor_last_event_id": nil,
+ "cursor_last_event_timestamp": 0,
+ "last_successful_status_check_timestamp": 1510125024,
+ "version": "10.3.0",
+ "revision": "33d33a096a",
+ },
+ {
+ "geo_node_id": 2,
+ "healthy": true,
+ "health": "Healthy",
+ "health_status": "Healthy",
+ "missing_oauth_application": false,
+ "attachments_count": 1,
+ "attachments_synced_count": 1,
+ "attachments_failed_count": 0,
+ "attachments_synced_missing_on_primary_count": 0,
+ "attachments_synced_in_percentage": "100.00%",
+ "db_replication_lag_seconds": 0,
+ "lfs_objects_count": 0,
+ "lfs_objects_synced_count": 0,
+ "lfs_objects_failed_count": 0,
+ "lfs_objects_synced_missing_on_primary_count": 0,
+ "lfs_objects_synced_in_percentage": "0.00%",
+ "job_artifacts_count": 2,
+ "job_artifacts_synced_count": 1,
+ "job_artifacts_failed_count": 1,
+ "job_artifacts_synced_missing_on_primary_count": 0,
+ "job_artifacts_synced_in_percentage": "50.00%",
+ "repositories_count": 41,
+ "projects_count": 41,
+ "repositories_failed_count": 1,
+ "repositories_synced_count": 40,
+ "repositories_synced_in_percentage": "97.56%",
+ "wikis_count": 41,
+ "wikis_failed_count": 0,
+ "wikis_synced_count": 41,
+ "wikis_synced_in_percentage": "100.00%",
+ "replication_slots_count": nil,
+ "replication_slots_used_count": nil,
+ "replication_slots_used_in_percentage": "0.00%",
+ "replication_slots_max_retained_wal_bytes": nil,
+ "repositories_checksummed_count": 20,
+ "repositories_checksum_failed_count": 5,
+ "repositories_checksummed_in_percentage": "48.78%",
+ "wikis_checksummed_count": 10,
+ "wikis_checksum_failed_count": 3,
+ "wikis_checksummed_in_percentage": "24.39%",
+ "repositories_verified_count": 20,
+ "repositories_verification_failed_count": 5,
+ "repositories_verified_in_percentage": "48.78%",
+ "repositories_checksum_mismatch_count": 3,
+ "wikis_verified_count": 10,
+ "wikis_verification_failed_count": 3,
+ "wikis_verified_in_percentage": "24.39%",
+ "wikis_checksum_mismatch_count": 1,
+ "repositories_retrying_verification_count": 4,
+ "wikis_retrying_verification_count": 2,
+ "repositories_checked_count": 5,
+ "repositories_checked_failed_count": 1,
+ "repositories_checked_in_percentage": "12.20%",
+ "last_event_id": 23,
+ "last_event_timestamp": 1509681166,
+ "cursor_last_event_id": 23,
+ "cursor_last_event_timestamp": 1509681166,
+ "last_successful_status_check_timestamp": 1510125024,
+ "version": "10.3.0",
+ "revision": "33d33a096a"
+ }
+]
+```
+
+Note: fields `wikis_count` and `repositories_count` are deprecated and will be deleted soon. Please use `projects_count` instead.
+
+## Retrieve status about a specific Geo node
+
+```
+GET /geo_nodes/:id/status
+```
+
+```bash
+curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/geo_nodes/2/status
+```
+
+Example response:
+
+```json
+{
+ "geo_node_id": 2,
+ "healthy": true,
+ "health": "Healthy",
+ "health_status": "Healthy",
+ "missing_oauth_application": false,
+ "attachments_count": 1,
+ "attachments_synced_count": 1,
+ "attachments_failed_count": 0,
+ "attachments_synced_missing_on_primary_count": 0,
+ "attachments_synced_in_percentage": "100.00%",
+ "db_replication_lag_seconds": 0,
+ "lfs_objects_count": 0,
+ "lfs_objects_synced_count": 0,
+ "lfs_objects_failed_count": 0,
+ "lfs_objects_synced_missing_on_primary_count": 0,
+ "lfs_objects_synced_in_percentage": "0.00%",
+ "job_artifacts_count": 2,
+ "job_artifacts_synced_count": 1,
+ "job_artifacts_failed_count": 1,
+ "job_artifacts_synced_missing_on_primary_count": 0,
+ "job_artifacts_synced_in_percentage": "50.00%",
+ "repositories_count": 41,
+ "projects_count": 41,
+ "repositories_failed_count": 1,
+ "repositories_synced_count": 40,
+ "repositories_synced_in_percentage": "97.56%",
+ "wikis_count": 41,
+ "wikis_failed_count": 0,
+ "wikis_synced_count": 41,
+ "wikis_synced_in_percentage": "100.00%",
+ "replication_slots_count": nil,
+ "replication_slots_used_count": nil,
+ "replication_slots_used_in_percentage": "0.00%",
+ "replication_slots_max_retained_wal_bytes": nil,
+ "last_event_id": 23,
+ "last_event_timestamp": 1509681166,
+ "cursor_last_event_id": 23,
+ "cursor_last_event_timestamp": 1509681166,
+ "last_successful_status_check_timestamp": 1510125268,
+ "version": "10.3.0",
+ "revision": "33d33a096a"
+}
+```
+
+Note: The `health_status` parameter can only be in an "Healthy" or "Unhealthy" state, while the `health` parameter can be empty, "Healthy", or contain the actual error message.
+
+Note: Fields `wikis_count` and `repositories_count` are deprecated and will be deleted soon. Please use `projects_count` instead.
+
+## Retrieve project sync or verification failures that occurred on the current node
+
+This only works on a secondary node.
+
+```
+GET /geo_nodes/current/failures
+```
+
+| Attribute | Type | Required | Description |
+| --------- | ---- | -------- | ----------- |
+| `type` | string | no | Type of failed objects (`repository`/`wiki`) |
+| `failure_type` | string | no | Type of failures (`sync`/`checksum_mismatch`/`verification`) |
+
+This endpoint uses [Pagination](README.md#pagination).
+
+```bash
+curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/geo_nodes/current/failures
+```
+
+Example response:
+
+```json
+[
+ {
+ "project_id": 3,
+ "last_repository_synced_at": "2017-10-31 14:25:55 UTC",
+ "last_repository_successful_sync_at": "2017-10-31 14:26:04 UTC",
+ "last_wiki_synced_at": "2017-10-31 14:26:04 UTC",
+ "last_wiki_successful_sync_at": "2017-10-31 14:26:11 UTC",
+ "repository_retry_count": null,
+ "wiki_retry_count": 1,
+ "last_repository_sync_failure": null,
+ "last_wiki_sync_failure": "Error syncing Wiki repository",
+ "last_repository_verification_failure": "",
+ "last_wiki_verification_failure": "",
+ "repository_verification_checksum_sha": "da39a3ee5e6b4b0d32e5bfef9a601890afd80709",
+ "wiki_verification_checksum_sha": "da39a3ee5e6b4b0d3255bfef9ef0189aafd80709",
+ "repository_checksum_mismatch": false,
+ "wiki_checksum_mismatch": false
+ }
+]
+```
diff --git a/doc/api/graphql/index.md b/doc/api/graphql/index.md
index cf02bbd9c92..10e1ef0e533 100644
--- a/doc/api/graphql/index.md
+++ b/doc/api/graphql/index.md
@@ -16,6 +16,20 @@ added to the API without creating breaking changes. This allows us to
have a versionless API as described in [the GraphQL
documentation](https://graphql.org/learn/best-practices/#versioning).
+## Vision
+
+We want the GraphQL API to be the **primary** means of interacting
+programmatically with GitLab. To achieve this, it needs full coverage - anything
+possible in the REST API should also be possible in the GraphQL API.
+
+To help us meet this vision, the frontend should use GraphQL in preference to
+the REST API for new features, although the alpha status of GraphQL may prevent
+this from being a possibility at times.
+
+There are no plans to deprecate the REST API. To reduce the technical burden of
+supporting two APIs in parallel, they should share implementations as much as
+possible.
+
## Enabling the GraphQL feature
The GraphQL API itself is currently in Alpha, and therefore hidden behind a
@@ -32,7 +46,6 @@ curl --data "value=100" --header "PRIVATE-TOKEN: <your_access_token>" https://gi
A first iteration of a GraphQL API includes the following queries
1. `project` : Within a project it is also possible to fetch a `mergeRequest` by IID.
-
1. `group` : Only basic group information is currently supported.
## GraphiQL
diff --git a/doc/api/issue_links.md b/doc/api/issue_links.md
new file mode 100644
index 00000000000..1c7db6a8e4c
--- /dev/null
+++ b/doc/api/issue_links.md
@@ -0,0 +1,215 @@
+# Issue links API **[STARTER]**
+
+## List issue relations
+
+Get a list of related issues of a given issue, sorted by the relationship creation datetime (ascending).
+Issues will be filtered according to the user authorizations.
+
+```
+GET /projects/:id/issues/:issue_iid/links
+```
+
+Parameters:
+
+| Attribute | Type | Required | Description |
+|-------------|---------|----------|--------------------------------------|
+| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `issue_iid` | integer | yes | The internal ID of a project's issue |
+
+```json
+[
+ {
+ "id" : 84,
+ "iid" : 14,
+ "issue_link_id": 1
+ "project_id" : 4,
+ "created_at" : "2016-01-07T12:44:33.959Z",
+ "title" : "Issues with auth",
+ "state" : "opened",
+ "assignees" : [],
+ "assignee" : null,
+ "labels" : [
+ "bug"
+ ],
+ "author" : {
+ "name" : "Alexandra Bashirian",
+ "avatar_url" : null,
+ "state" : "active",
+ "web_url" : "https://gitlab.example.com/eileen.lowe",
+ "id" : 18,
+ "username" : "eileen.lowe"
+ },
+ "description" : null,
+ "updated_at" : "2016-01-07T12:44:33.959Z",
+ "milestone" : null,
+ "subscribed" : true,
+ "user_notes_count": 0,
+ "due_date": null,
+ "web_url": "http://example.com/example/example/issues/14",
+ "confidential": false,
+ "weight": null,
+ }
+]
+```
+
+## Create an issue link
+
+Creates a two-way relation between two issues. User must be allowed to update both issues in order to succeed.
+
+```
+POST /projects/:id/issues/:issue_iid/links
+```
+
+| Attribute | Type | Required | Description |
+|-------------|---------|----------|--------------------------------------|
+| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `issue_iid` | integer | yes | The internal ID of a project's issue |
+| `target_project_id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) of a target project |
+| `target_issue_iid` | integer/string | yes | The internal ID of a target project's issue |
+
+
+```json
+{
+ "source_issue" : {
+ "id" : 83,
+ "iid" : 11,
+ "project_id" : 4,
+ "created_at" : "2016-01-07T12:44:33.959Z",
+ "title" : "Issues with auth",
+ "state" : "opened",
+ "assignees" : [],
+ "assignee" : null,
+ "labels" : [
+ "bug"
+ ],
+ "author" : {
+ "name" : "Alexandra Bashirian",
+ "avatar_url" : null,
+ "state" : "active",
+ "web_url" : "https://gitlab.example.com/eileen.lowe",
+ "id" : 18,
+ "username" : "eileen.lowe"
+ },
+ "description" : null,
+ "updated_at" : "2016-01-07T12:44:33.959Z",
+ "milestone" : null,
+ "subscribed" : true,
+ "user_notes_count": 0,
+ "due_date": null,
+ "web_url": "http://example.com/example/example/issues/11",
+ "confidential": false,
+ "weight": null,
+ },
+ "target_issue" : {
+ "id" : 84,
+ "iid" : 14,
+ "project_id" : 4,
+ "created_at" : "2016-01-07T12:44:33.959Z",
+ "title" : "Issues with auth",
+ "state" : "opened",
+ "assignees" : [],
+ "assignee" : null,
+ "labels" : [
+ "bug"
+ ],
+ "author" : {
+ "name" : "Alexandra Bashirian",
+ "avatar_url" : null,
+ "state" : "active",
+ "web_url" : "https://gitlab.example.com/eileen.lowe",
+ "id" : 18,
+ "username" : "eileen.lowe"
+ },
+ "description" : null,
+ "updated_at" : "2016-01-07T12:44:33.959Z",
+ "milestone" : null,
+ "subscribed" : true,
+ "user_notes_count": 0,
+ "due_date": null,
+ "web_url": "http://example.com/example/example/issues/14",
+ "confidential": false,
+ "weight": null,
+ }
+}
+```
+
+## Delete an issue link
+
+Deletes an issue link, thus removes the two-way relationship.
+
+```
+DELETE /projects/:id/issues/:issue_iid/links/:issue_link_id
+```
+
+
+| Attribute | Type | Required | Description |
+|-------------|---------|----------|--------------------------------------|
+| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `issue_iid` | integer | yes | The internal ID of a project's issue |
+| `issue_link_id` | integer/string | yes | The ID of an issue relationship |
+
+
+```json
+{
+ "source_issue" : {
+ "id" : 83,
+ "iid" : 11,
+ "project_id" : 4,
+ "created_at" : "2016-01-07T12:44:33.959Z",
+ "title" : "Issues with auth",
+ "state" : "opened",
+ "assignees" : [],
+ "assignee" : null,
+ "labels" : [
+ "bug"
+ ],
+ "author" : {
+ "name" : "Alexandra Bashirian",
+ "avatar_url" : null,
+ "state" : "active",
+ "web_url" : "https://gitlab.example.com/eileen.lowe",
+ "id" : 18,
+ "username" : "eileen.lowe"
+ },
+ "description" : null,
+ "updated_at" : "2016-01-07T12:44:33.959Z",
+ "milestone" : null,
+ "subscribed" : true,
+ "user_notes_count": 0,
+ "due_date": null,
+ "web_url": "http://example.com/example/example/issues/11",
+ "confidential": false,
+ "weight": null,
+ },
+ "target_issue" : {
+ "id" : 84,
+ "iid" : 14,
+ "project_id" : 4,
+ "created_at" : "2016-01-07T12:44:33.959Z",
+ "title" : "Issues with auth",
+ "state" : "opened",
+ "assignees" : [],
+ "assignee" : null,
+ "labels" : [
+ "bug"
+ ],
+ "author" : {
+ "name" : "Alexandra Bashirian",
+ "avatar_url" : null,
+ "state" : "active",
+ "web_url" : "https://gitlab.example.com/eileen.lowe",
+ "id" : 18,
+ "username" : "eileen.lowe"
+ },
+ "description" : null,
+ "updated_at" : "2016-01-07T12:44:33.959Z",
+ "milestone" : null,
+ "subscribed" : true,
+ "user_notes_count": 0,
+ "due_date": null,
+ "web_url": "http://example.com/example/example/issues/14",
+ "confidential": false,
+ "weight": null,
+ }
+}
+```
diff --git a/doc/api/issues.md b/doc/api/issues.md
index cb5789e76b7..4fb3626f637 100644
--- a/doc/api/issues.md
+++ b/doc/api/issues.md
@@ -37,23 +37,26 @@ GET /issues?confidential=true
| Attribute | Type | Required | Description |
| ------------------- | ---------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `state` | string | no | Return all issues or just those that are `opened` or `closed` |
+| `state` | string | no | Return `all` issues or just those that are `opened` or `closed` |
| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `None` lists all issues with no labels. `Any` lists all issues with at least one label. `No+Label` (Deprecated) lists all issues with no labels. Predefined names are case-insensitive. |
+| `with_labels_details`| Boolean | no | If `true`, response will return more details for each label in labels field: `:name`, `:color`, `:description`, `:text_color`. Default is `false`. |
| `milestone` | string | no | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone. |
| `scope` | string | no | Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`. Defaults to `created_by_me`<br> For versions before 11.0, use the now deprecated `created-by-me` or `assigned-to-me` scopes instead.<br> _([Introduced][ce-13004] in GitLab 9.5. [Changed to snake_case][ce-18935] in GitLab 11.0)_ |
-| `author_id` | integer | no | Return issues created by the given user `id`. Combine with `scope=all` or `scope=assigned_to_me`. _([Introduced][ce-13004] in GitLab 9.5)_ |
-| `assignee_id` | integer | no | Return issues assigned to the given user `id`. `None` returns unassigned issues. `Any` returns issues with an assignee. _([Introduced][ce-13004] in GitLab 9.5)_ |
+| `author_id` | integer | no | Return issues created by the given user `id`. Mutually exclusive with `author_username`. Combine with `scope=all` or `scope=assigned_to_me`. _([Introduced][ce-13004] in GitLab 9.5)_ |
+| `author_username` | string | no | Return issues created by the given `username`. Simillar to `author_id` and mutually exclusive with `author_id`. |
+| `assignee_id` | integer | no | Return issues assigned to the given user `id`. Mutually exclusive with `assignee_username`. `None` returns unassigned issues. `Any` returns issues with an assignee. _([Introduced][ce-13004] in GitLab 9.5)_ |
+| `assignee_username` | Array[String] | no | Return issues assigned to the given `username`. Simillar to `assignee_id` and mutually exclusive with `assignee_id`. In CE version `assignee_username` array should only contain a single value or an invalid param error will be returned otherwise. |
| `my_reaction_emoji` | string | no | Return issues reacted by the authenticated user by the given `emoji`. `None` returns issues not given a reaction. `Any` returns issues given at least one reaction. _([Introduced][ce-14016] in GitLab 10.0)_ |
| `iids[]` | Array[integer] | no | Return only the issues having the given `iid` |
| `order_by` | string | no | Return issues ordered by `created_at` or `updated_at` fields. Default is `created_at` |
| `sort` | string | no | Return issues sorted in `asc` or `desc` order. Default is `desc` |
| `search` | string | no | Search issues against their `title` and `description` |
-| `in` | string | no | Modify the scope of the `search` attribute. `title`, `description`, or a string joining them with comma. Default is `title,description` |
+| `in` | string | no | Modify the scope of the `search` attribute. `title`, `description`, or a string joining them with comma. Default is `title,description` |
| `created_after` | datetime | no | Return issues created on or after the given time |
| `created_before` | datetime | no | Return issues created on or before the given time |
| `updated_after` | datetime | no | Return issues updated on or after the given time |
| `updated_before` | datetime | no | Return issues updated on or before the given time |
-| `confidential ` | Boolean | no | Filter confidential or public issues. |
+| `confidential ` | Boolean | no | Filter confidential or public issues. |
```bash
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/issues
@@ -109,7 +112,7 @@ Example response:
"title" : "Consequatur vero maxime deserunt laboriosam est voluptas dolorem.",
"created_at" : "2016-01-04T15:31:51.081Z",
"iid" : 6,
- "labels" : [],
+ "labels" : ["foo", "bar"],
"upvotes": 4,
"downvotes": 0,
"merge_requests_count": 0,
@@ -122,8 +125,17 @@ Example response:
"human_time_estimate": null,
"human_total_time_spent": null
},
+ "has_tasks": true,
+ "task_status": "10 of 15 tasks completed",
"confidential": false,
- "discussion_locked": false
+ "discussion_locked": false,
+ "_links":{
+ "self":"http://example.com/api/v4/projects/1/issues/76",
+ "notes":"`http://example.com/`api/v4/projects/1/issues/76/notes",
+ "award_emoji":"http://example.com/api/v4/projects/1/issues/76/award_emoji",
+ "project":"http://example.com/api/v4/projects/1"
+ },
+ "subscribed": false
}
]
```
@@ -158,11 +170,14 @@ GET /groups/:id/issues?confidential=true
| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
| `state` | string | no | Return all issues or just those that are `opened` or `closed` |
| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `None` lists all issues with no labels. `Any` lists all issues with at least one label. `No+Label` (Deprecated) lists all issues with no labels. Predefined names are case-insensitive. |
+| `with_labels_details`| Boolean | no | If `true`, response will return more details for each label in labels field: `:name`, `:color`, `:description`, `:text_color`. Default is `false`. |
| `iids[]` | Array[integer] | no | Return only the issues having the given `iid` |
| `milestone` | string | no | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone. |
| `scope` | string | no | Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`.<br> For versions before 11.0, use the now deprecated `created-by-me` or `assigned-to-me` scopes instead.<br> _([Introduced][ce-13004] in GitLab 9.5. [Changed to snake_case][ce-18935] in GitLab 11.0)_ |
-| `author_id` | integer | no | Return issues created by the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_ |
-| `assignee_id` | integer | no | Return issues assigned to the given user `id`. `None` returns unassigned issues. `Any` returns issues with an assignee. _([Introduced][ce-13004] in GitLab 9.5)_ |
+| `author_id` | integer | no | Return issues created by the given user `id`. Mutually exclusive with `author_username`. Combine with `scope=all` or `scope=assigned_to_me`. _([Introduced][ce-13004] in GitLab 9.5)_ |
+| `author_username` | string | no | Return issues created by the given `username`. Simillar to `author_id` and mutually exclusive with `author_id`. |
+| `assignee_id` | integer | no | Return issues assigned to the given user `id`. Mutually exclusive with `assignee_username`. `None` returns unassigned issues. `Any` returns issues with an assignee. _([Introduced][ce-13004] in GitLab 9.5)_ |
+| `assignee_username` | Array[String] | no | Return issues assigned to the given `username`. Simillar to `assignee_id` and mutually exclusive with `assignee_id`. In CE version `assignee_username` array should only contain a single value or an invalid param error will be returned otherwise. |
| `my_reaction_emoji` | string | no | Return issues reacted by the authenticated user by the given `emoji`. `None` returns issues not given a reaction. `Any` returns issues given at least one reaction. _([Introduced][ce-14016] in GitLab 10.0)_ |
| `order_by` | string | no | Return issues ordered by `created_at` or `updated_at` fields. Default is `created_at` |
| `sort` | string | no | Return issues sorted in `asc` or `desc` order. Default is `desc` |
@@ -221,7 +236,7 @@ Example response:
"id" : 9,
"name" : "Dr. Luella Kovacek"
},
- "labels" : [],
+ "labels" : ["foo", "bar"],
"upvotes": 4,
"downvotes": 0,
"merge_requests_count": 0,
@@ -240,8 +255,17 @@ Example response:
"human_time_estimate": null,
"human_total_time_spent": null
},
+ "has_tasks": true,
+ "task_status": "10 of 15 tasks completed",
"confidential": false,
- "discussion_locked": false
+ "discussion_locked": false,
+ "_links":{
+ "self":"http://example.com/api/v4/projects/4/issues/41",
+ "notes":"`http://example.com/`api/v4/projects/4/issues/41/notes",
+ "award_emoji":"http://example.com/api/v4/projects/4/issues/41/award_emoji",
+ "project":"http://example.com/api/v4/projects/4"
+ },
+ "subscribed": false
}
]
```
@@ -277,10 +301,13 @@ GET /projects/:id/issues?confidential=true
| `iids[]` | Array[integer] | no | Return only the milestone having the given `iid` |
| `state` | string | no | Return all issues or just those that are `opened` or `closed` |
| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `None` lists all issues with no labels. `Any` lists all issues with at least one label. `No+Label` (Deprecated) lists all issues with no labels. Predefined names are case-insensitive. |
+| `with_labels_details`| Boolean | no | If `true`, response will return more details for each label in labels field: `:name`, `:color`, `:description`, `:text_color`. Default is `false`. |
| `milestone` | string | no | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone. |
| `scope` | string | no | Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`.<br> For versions before 11.0, use the now deprecated `created-by-me` or `assigned-to-me` scopes instead.<br> _([Introduced][ce-13004] in GitLab 9.5. [Changed to snake_case][ce-18935] in GitLab 11.0)_ |
-| `author_id` | integer | no | Return issues created by the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_ |
-| `assignee_id` | integer | no | Return issues assigned to the given user `id`. `None` returns unassigned issues. `Any` returns issues with an assignee. _([Introduced][ce-13004] in GitLab 9.5)_ |
+| `author_id` | integer | no | Return issues created by the given user `id`. Mutually exclusive with `author_username`. Combine with `scope=all` or `scope=assigned_to_me`. _([Introduced][ce-13004] in GitLab 9.5)_ |
+| `author_username` | string | no | Return issues created by the given `username`. Simillar to `author_id` and mutually exclusive with `author_id`. |
+| `assignee_id` | integer | no | Return issues assigned to the given user `id`. Mutually exclusive with `assignee_username`. `None` returns unassigned issues. `Any` returns issues with an assignee. _([Introduced][ce-13004] in GitLab 9.5)_ |
+| `assignee_username` | Array[String] | no | Return issues assigned to the given `username`. Simillar to `assignee_id` and mutually exclusive with `assignee_id`. In CE version `assignee_username` array should only contain a single value or an invalid param error will be returned otherwise. |
| `my_reaction_emoji` | string | no | Return issues reacted by the authenticated user by the given `emoji`. `None` returns issues not given a reaction. `Any` returns issues given at least one reaction. _([Introduced][ce-14016] in GitLab 10.0)_ |
| `order_by` | string | no | Return issues ordered by `created_at` or `updated_at` fields. Default is `created_at` |
| `sort` | string | no | Return issues sorted in `asc` or `desc` order. Default is `desc` |
@@ -340,7 +367,7 @@ Example response:
"id" : 9,
"name" : "Dr. Luella Kovacek"
},
- "labels" : [],
+ "labels" : ["foo", "bar"],
"upvotes": 4,
"downvotes": 0,
"merge_requests_count": 0,
@@ -366,8 +393,17 @@ Example response:
"human_time_estimate": null,
"human_total_time_spent": null
},
+ "has_tasks": true,
+ "task_status": "10 of 15 tasks completed",
"confidential": false,
- "discussion_locked": false
+ "discussion_locked": false,
+ "_links":{
+ "self":"http://example.com/api/v4/projects/4/issues/41",
+ "notes":"`http://example.com/`api/v4/projects/4/issues/41/notes",
+ "award_emoji":"http://example.com/api/v4/projects/4/issues/41/award_emoji",
+ "project":"http://example.com/api/v4/projects/4"
+ },
+ "subscribed": false
}
]
```
diff --git a/doc/api/issues_statistics.md b/doc/api/issues_statistics.md
new file mode 100644
index 00000000000..82bc9c142cc
--- /dev/null
+++ b/doc/api/issues_statistics.md
@@ -0,0 +1,177 @@
+# Issues Statistics API
+
+Every API call to issues_statistics must be authenticated.
+
+If a user is not a member of a project and the project is private, a `GET`
+request on that project will result to a `404` status code.
+
+## Get issues statistics
+
+Gets issues count statistics on all issues the authenticated user has access to. By default it
+returns only issues created by the current user. To get all issues,
+use parameter `scope=all`.
+
+```
+GET /issues_statistics
+GET /issues_statistics?labels=foo
+GET /issues_statistics?labels=foo,bar
+GET /issues_statistics?labels=foo,bar&state=opened
+GET /issues_statistics?milestone=1.0.0
+GET /issues_statistics?milestone=1.0.0&state=opened
+GET /issues_statistics?iids[]=42&iids[]=43
+GET /issues_statistics?author_id=5
+GET /issues_statistics?assignee_id=5
+GET /issues_statistics?my_reaction_emoji=star
+GET /issues_statistics?search=foo&in=title
+GET /issues_statistics?confidential=true
+```
+
+| Attribute | Type | Required | Description |
+| ------------------- | ---------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `None` lists all issues with no labels. `Any` lists all issues with at least one label. |
+| `milestone` | string | no | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone. |
+| `scope` | string | no | Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`. Defaults to `created_by_me` |
+| `author_id` | integer | no | Return issues created by the given user `id`. Mutually exclusive with `author_username`. Combine with `scope=all` or `scope=assigned_to_me`. |
+| `author_username` | string | no | Return issues created by the given `username`. Similar to `author_id` and mutually exclusive with `author_id`. |
+| `assignee_id` | integer | no | Return issues assigned to the given user `id`. Mutually exclusive with `assignee_username`. `None` returns unassigned issues. `Any` returns issues with an assignee. |
+| `assignee_username` | Array[String] | no | Return issues assigned to the given `username`. Similar to `assignee_id` and mutually exclusive with `assignee_id`. In CE version `assignee_username` array should only contain a single value or an invalid param error will be returned otherwise. |
+| `my_reaction_emoji` | string | no | Return issues reacted by the authenticated user by the given `emoji`. `None` returns issues not given a reaction. `Any` returns issues given at least one reaction. |
+| `iids[]` | Array[integer] | no | Return only the issues having the given `iid` |
+| `search` | string | no | Search issues against their `title` and `description` |
+| `in` | string | no | Modify the scope of the `search` attribute. `title`, `description`, or a string joining them with comma. Default is `title,description` |
+| `created_after` | datetime | no | Return issues created on or after the given time |
+| `created_before` | datetime | no | Return issues created on or before the given time |
+| `updated_after` | datetime | no | Return issues updated on or after the given time |
+| `updated_before` | datetime | no | Return issues updated on or before the given time |
+| `confidential ` | Boolean | no | Filter confidential or public issues. |
+
+```bash
+curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/issues_statistics
+```
+
+Example response:
+
+```json
+{
+ "statistics": {
+ "counts": {
+ "all": 20,
+ "closed": 5,
+ "opened": 15
+ }
+ }
+}
+```
+
+## Get group issues statistics
+
+Gets issues count statistics for given group.
+
+```
+GET /groups/:id/issues_statistics
+GET /groups/:id/issues_statistics?labels=foo
+GET /groups/:id/issues_statistics?labels=foo,bar
+GET /groups/:id/issues_statistics?labels=foo,bar&state=opened
+GET /groups/:id/issues_statistics?milestone=1.0.0
+GET /groups/:id/issues_statistics?milestone=1.0.0&state=opened
+GET /groups/:id/issues_statistics?iids[]=42&iids[]=43
+GET /groups/:id/issues_statistics?search=issue+title+or+description
+GET /groups/:id/issues_statistics?author_id=5
+GET /groups/:id/issues_statistics?assignee_id=5
+GET /groups/:id/issues_statistics?my_reaction_emoji=star
+GET /groups/:id/issues_statistics?confidential=true
+```
+
+| Attribute | Type | Required | Description |
+| ------------------- | ---------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------- |
+| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `None` lists all issues with no labels. `Any` lists all issues with at least one label. |
+| `iids[]` | Array[integer] | no | Return only the issues having the given `iid` |
+| `milestone` | string | no | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone. |
+| `scope` | string | no | Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`. |
+| `author_id` | integer | no | Return issues created by the given user `id`. Mutually exclusive with `author_username`. Combine with `scope=all` or `scope=assigned_to_me`. |
+| `author_username` | string | no | Return issues created by the given `username`. Similar to `author_id` and mutually exclusive with `author_id`. |
+| `assignee_id` | integer | no | Return issues assigned to the given user `id`. Mutually exclusive with `assignee_username`. `None` returns unassigned issues. `Any` returns issues with an assignee. |
+| `assignee_username` | Array[String] | no | Return issues assigned to the given `username`. Similar to `assignee_id` and mutually exclusive with `assignee_id`. In CE version `assignee_username` array should only contain a single value or an invalid param error will be returned otherwise. |
+| `my_reaction_emoji` | string | no | Return issues reacted by the authenticated user by the given `emoji`. `None` returns issues not given a reaction. `Any` returns issues given at least one reaction. |
+| `search` | string | no | Search group issues against their `title` and `description` |
+| `created_after` | datetime | no | Return issues created on or after the given time |
+| `created_before` | datetime | no | Return issues created on or before the given time |
+| `updated_after` | datetime | no | Return issues updated on or after the given time |
+| `updated_before` | datetime | no | Return issues updated on or before the given time |
+| `confidential ` | Boolean | no | Filter confidential or public issues. |
+
+```bash
+curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/4/issues_statistics
+```
+
+Example response:
+
+```json
+{
+ "statistics": {
+ "counts": {
+ "all": 20,
+ "closed": 5,
+ "opened": 15
+ }
+ }
+}
+```
+
+## Get project issues statistics
+
+Gets issues count statistics for given project.
+
+```
+GET /projects/:id/issues_statistics
+GET /projects/:id/issues_statistics?labels=foo
+GET /projects/:id/issues_statistics?labels=foo,bar
+GET /projects/:id/issues_statistics?labels=foo,bar&state=opened
+GET /projects/:id/issues_statistics?milestone=1.0.0
+GET /projects/:id/issues_statistics?milestone=1.0.0&state=opened
+GET /projects/:id/issues_statistics?iids[]=42&iids[]=43
+GET /projects/:id/issues_statistics?search=issue+title+or+description
+GET /projects/:id/issues_statistics?author_id=5
+GET /projects/:id/issues_statistics?assignee_id=5
+GET /projects/:id/issues_statistics?my_reaction_emoji=star
+GET /projects/:id/issues_statistics?confidential=true
+```
+
+| Attribute | Type | Required | Description |
+| ------------------- | ---------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------- |
+| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `iids[]` | Array[integer] | no | Return only the milestone having the given `iid` |
+| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `None` lists all issues with no labels. `Any` lists all issues with at least one label. |
+| `milestone` | string | no | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone. |
+| `scope` | string | no | Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`. |
+| `author_id` | integer | no | Return issues created by the given user `id`. Mutually exclusive with `author_username`. Combine with `scope=all` or `scope=assigned_to_me`. |
+| `author_username` | string | no | Return issues created by the given `username`. Similar to `author_id` and mutually exclusive with `author_id`. |
+| `assignee_id` | integer | no | Return issues assigned to the given user `id`. Mutually exclusive with `assignee_username`. `None` returns unassigned issues. `Any` returns issues with an assignee. |
+| `assignee_username` | Array[String] | no | Return issues assigned to the given `username`. Similar to `assignee_id` and mutually exclusive with `assignee_id`. In CE version `assignee_username` array should only contain a single value or an invalid param error will be returned otherwise. |
+| `my_reaction_emoji` | string | no | Return issues reacted by the authenticated user by the given `emoji`. `None` returns issues not given a reaction. `Any` returns issues given at least one reaction. |
+| `search` | string | no | Search project issues against their `title` and `description` |
+| `created_after` | datetime | no | Return issues created on or after the given time |
+| `created_before` | datetime | no | Return issues created on or before the given time |
+| `updated_after` | datetime | no | Return issues updated on or after the given time |
+| `updated_before` | datetime | no | Return issues updated on or before the given time |
+| `confidential ` | Boolean | no | Filter confidential or public issues. |
+
+
+```bash
+curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/4/issues_statistics
+```
+
+Example response:
+
+```json
+{
+ "statistics": {
+ "counts": {
+ "all": 20,
+ "closed": 5,
+ "opened": 15
+ }
+ }
+}
+```
diff --git a/doc/api/jobs.md b/doc/api/jobs.md
index 877cd99723a..d51451b9c83 100644
--- a/doc/api/jobs.md
+++ b/doc/api/jobs.md
@@ -32,6 +32,7 @@ Example of response
"title": "Test the CI integration."
},
"coverage": null,
+ "allow_failure": false,
"created_at": "2015-12-24T15:51:21.727Z",
"started_at": "2015-12-24T17:54:24.729Z",
"finished_at": "2015-12-24T17:54:24.921Z",
@@ -81,6 +82,7 @@ Example of response
"title": "Test the CI integration."
},
"coverage": null,
+ "allow_failure": false,
"created_at": "2015-12-24T15:51:21.802Z",
"started_at": "2015-12-24T17:54:27.722Z",
"finished_at": "2015-12-24T17:54:27.895Z",
@@ -165,6 +167,7 @@ Example of response
"title": "Test the CI integration."
},
"coverage": null,
+ "allow_failure": false,
"created_at": "2015-12-24T15:51:21.727Z",
"started_at": "2015-12-24T17:54:24.729Z",
"finished_at": "2015-12-24T17:54:24.921Z",
@@ -214,6 +217,7 @@ Example of response
"title": "Test the CI integration."
},
"coverage": null,
+ "allow_failure": false,
"created_at": "2015-12-24T15:51:21.802Z",
"started_at": "2015-12-24T17:54:27.722Z",
"finished_at": "2015-12-24T17:54:27.895Z",
@@ -296,6 +300,7 @@ Example of response
"title": "Test the CI integration."
},
"coverage": null,
+ "allow_failure": false,
"created_at": "2015-12-24T15:51:21.880Z",
"started_at": "2015-12-24T17:54:30.733Z",
"finished_at": "2015-12-24T17:54:31.198Z",
@@ -528,6 +533,7 @@ Example of response
"title": "Test the CI integration."
},
"coverage": null,
+ "allow_failure": false,
"created_at": "2016-01-11T10:13:33.506Z",
"started_at": "2016-01-11T10:14:09.526Z",
"finished_at": null,
@@ -576,6 +582,7 @@ Example of response
"title": "Test the CI integration."
},
"coverage": null,
+ "allow_failure": false,
"created_at": "2016-01-11T10:13:33.506Z",
"started_at": null,
"finished_at": null,
@@ -628,6 +635,7 @@ Example of response
"title": "Test the CI integration."
},
"coverage": null,
+ "allow_failure": false,
"download_url": null,
"id": 42,
"name": "rubocop",
@@ -681,6 +689,7 @@ Example response:
"title": "Test the CI integration."
},
"coverage": null,
+ "allow_failure": false,
"download_url": null,
"id": 42,
"name": "rubocop",
@@ -757,6 +766,7 @@ Example of response
"title": "Test the CI integration."
},
"coverage": null,
+ "allow_failure": false,
"created_at": "2016-01-11T10:13:33.506Z",
"started_at": null,
"finished_at": null,
diff --git a/doc/api/license.md b/doc/api/license.md
new file mode 100644
index 00000000000..2a8de64bdbf
--- /dev/null
+++ b/doc/api/license.md
@@ -0,0 +1,176 @@
+# License **[CORE ONLY]**
+
+In order to interact with license endpoints, you need to authenticate yourself
+as an admin.
+
+## Retrieve information about the current license
+
+```
+GET /license
+```
+
+```json
+{
+ "id": 2,
+ "plan": "gold",
+ "created_at": "2018-02-27T23:21:58.674Z",
+ "starts_at": "2018-01-27",
+ "expires_at": "2022-01-27",
+ "historical_max": 300,
+ "expired": false,
+ "overage": 200,
+ "user_limit": 100,
+ "active_users": 300,
+ "licensee": {
+ "Name": "John Doe1"
+ },
+ "add_ons": {
+ "GitLab_FileLocks": 1,
+ "GitLab_Auditor_User": 1
+ }
+}
+```
+
+## Retrieve information about all licenses
+
+```
+GET /licenses
+```
+
+```json
+[
+ {
+ "id": 1,
+ "plan": "silver",
+ "created_at": "2018-02-27T23:21:58.674Z",
+ "starts_at": "2018-01-27",
+ "expires_at": "2022-01-27",
+ "historical_max": 300,
+ "expired": false,
+ "overage": 200,
+ "user_limit": 100,
+ "licensee": {
+ "Name": "John Doe1"
+ },
+ "add_ons": {
+ "GitLab_FileLocks": 1,
+ "GitLab_Auditor_User": 1
+ }
+ },
+ {
+ "id": 2,
+ "plan": "gold",
+ "created_at": "2018-02-27T23:21:58.674Z",
+ "starts_at": "2018-01-27",
+ "expires_at": "2022-01-27",
+ "historical_max": 300,
+ "expired": false,
+ "overage": 200,
+ "user_limit": 100,
+ "licensee": {
+ "Name": "Doe John"
+ },
+ "add_ons": {
+ "GitLab_FileLocks": 1,
+ }
+ }
+]
+```
+
+Overage is the difference between the number of active users and the licensed number of users.
+This is calculated differently depending on whether the license has expired or not.
+
+- If the license has expired, it uses the historical maximum active user count (`historical_max`).
+- If the license has not expired, it uses the current active users count.
+
+Returns:
+
+- `200 OK` with response containing the licenses in JSON format. This will be an empty JSON array if there are no licenses.
+- `403 Forbidden` if the current user in not permitted to read the licenses.
+
+## Add a new license
+
+```
+POST /license
+```
+
+| Attribute | Type | Required | Description |
+| --------- | ---- | -------- | ----------- |
+| `license` | string | yes | The license string |
+
+```bash
+curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/license?license=eyJkYXRhIjoiMHM5Q...S01Udz09XG4ifQ=="
+```
+
+Example response:
+
+```json
+{
+ "id": 1,
+ "plan": "gold",
+ "created_at": "2018-02-27T23:21:58.674Z",
+ "starts_at": "2018-01-27",
+ "expires_at": "2022-01-27",
+ "historical_max": 300,
+ "expired": false,
+ "overage": 200,
+ "user_limit": 100,
+ "active_users": 300,
+ "licensee": {
+ "Name": "John Doe1"
+ },
+ "add_ons": {
+ "GitLab_FileLocks": 1,
+ "GitLab_Auditor_User": 1
+ }
+}
+```
+
+Returns:
+
+- `201 Created` if the license is successfully added.
+- `400 Bad Request` if the license couldn't be added, with an error message explaining the reason.
+
+
+## Delete a license
+
+```
+DELETE /license/:id
+```
+
+| Attribute | Type | Required | Description |
+| --------- | ---- | -------- | ----------- |
+| `id` | integer | yes | ID of the GitLab license. |
+
+```bash
+curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/license/:id"
+```
+
+Example response:
+
+```json
+{
+ "id": 2,
+ "plan": "gold",
+ "created_at": "2018-02-27T23:21:58.674Z",
+ "starts_at": "2018-01-27",
+ "expires_at": "2022-01-27",
+ "historical_max": 300,
+ "expired": false,
+ "overage": 200,
+ "user_limit": 100,
+ "licensee": {
+ "Name": "John Doe"
+ },
+ "add_ons": {
+ "GitLab_FileLocks": 1,
+ "GitLab_Auditor_User": 1
+ }
+}
+```
+
+Returns:
+
+- `204 No Content` if the license is successfully deleted.
+- `403 Forbidden` if the current user in not permitted to delete the license.
+- `404 Not Found` if the license to delete could not be found.
diff --git a/doc/api/license_templates.md b/doc/api/license_templates.md
new file mode 100644
index 00000000000..1b68af9ce31
--- /dev/null
+++ b/doc/api/license_templates.md
@@ -0,0 +1,5 @@
+---
+redirect_to: 'templates/licenses.md'
+---
+
+This document was moved to [another location](templates/licenses.md).
diff --git a/doc/api/managed_licenses.md b/doc/api/managed_licenses.md
new file mode 100644
index 00000000000..47b193111b6
--- /dev/null
+++ b/doc/api/managed_licenses.md
@@ -0,0 +1,136 @@
+# Managed Licenses API **[ULTIMATE]**
+
+## List managed licenses
+
+Get all managed licenses for a given project.
+
+```
+GET /projects/:id/managed_licenses
+```
+
+| Attribute | Type | Required | Description |
+| --------- | ------- | -------- | --------------------- |
+| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
+
+```bash
+curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/managed_licenses
+```
+
+Example response:
+
+```json
+[
+ {
+ "id": 1,
+ "name": "MIT",
+ "approval_status": "approved"
+ },
+ {
+ "id": 3,
+ "name": "ISC",
+ "approval_status": "blacklisted"
+ }
+]
+```
+
+## Show an existing managed license
+
+Shows an existing managed license.
+
+```
+GET /projects/:id/managed_licenses/:managed_license_id
+```
+
+| Attribute | Type | Required | Description |
+| --------------- | ------- | --------------------------------- | ------------------------------- |
+| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `managed_license_id` | integer/string | yes | The ID or URL-encoded name of the license belonging to the project |
+
+```bash
+curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/managed_licenses/6"
+```
+
+Example response:
+
+```json
+{
+ "id": 1,
+ "name": "MIT",
+ "approval_status": "blacklisted"
+}
+```
+
+## Create a new managed license
+
+Creates a new managed license for the given project with the given name and approval status.
+
+```
+POST /projects/:id/managed_licenses
+```
+
+| Attribute | Type | Required | Description |
+| ------------- | ------- | -------- | ---------------------------- |
+| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `name` | string | yes | The name of the managed license |
+| `approval_status` | string | yes | The approval status. "approved" or "blacklisted" |
+
+```bash
+curl --data "name=MIT&approval_status=blacklisted" --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/managed_licenses"
+```
+
+Example response:
+
+```json
+{
+ "id": 1,
+ "name": "MIT",
+ "approval_status": "approved"
+}
+```
+
+## Delete a managed license
+
+Deletes a managed license with a given id.
+
+```
+DELETE /projects/:id/managed_licenses/:managed_license_id
+```
+
+| Attribute | Type | Required | Description |
+| --------- | ------- | -------- | --------------------- |
+| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `managed_license_id` | integer/string | yes | The ID or URL-encoded name of the license belonging to the project |
+
+```bash
+curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/managed_licenses/4"
+```
+
+When successful, it replies with an HTTP 204 response.
+
+## Edit an existing managed license
+
+Updates an existing managed license with a new approval status.
+
+```
+PATCH /projects/:id/managed_licenses/:managed_license_id
+```
+
+| Attribute | Type | Required | Description |
+| --------------- | ------- | --------------------------------- | ------------------------------- |
+| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
+| `managed_license_id` | integer/string | yes | The ID or URL-encoded name of the license belonging to the project |
+| `approval_status` | string | yes | The approval status. "approved" or "blacklisted" |
+
+```bash
+curl --request PATCH --data "approval_status=blacklisted" --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/managed_licenses/6"
+```
+
+Example response:
+
+```json
+{
+ "id": 1,
+ "name": "MIT",
+ "approval_status": "blacklisted"
+}
+```
diff --git a/doc/api/merge_request_approvals.md b/doc/api/merge_request_approvals.md
new file mode 100644
index 00000000000..ddac81328b9
--- /dev/null
+++ b/doc/api/merge_request_approvals.md
@@ -0,0 +1,425 @@
+# Merge request approvals API **[STARTER]**
+
+Configuration for approvals on all Merge Requests (MR) in the project. Must be authenticated for all endpoints.
+
+## Project-level MR approvals
+
+### Get Configuration
+
+>**Note:** This API endpoint is only available on 10.6 Starter and above.
+
+You can request information about a project's approval configuration using the
+following endpoint:
+
+```
+GET /projects/:id/approvals
+```
+
+**Parameters:**
+
+| Attribute | Type | Required | Description |
+| --------- | ------- | -------- | ------------------- |
+| `id` | integer | yes | The ID of a project |
+
+```json
+{
+ "approvers": [
+ {
+ "user": {
+ "id": 5,
+ "name": "John Doe6",
+ "username": "user5",
+ "state":"active","avatar_url":"https://www.gravatar.com/avatar/4aea8cf834ed91844a2da4ff7ae6b491?s=80\u0026d=identicon","web_url":"http://localhost/user5"
+ }
+ }
+ ],
+ "approver_groups": [
+ {
+ "group": {
+ "id": 1,
+ "name": "group1",
+ "path": "group1",
+ "description": "",
+ "visibility": "public",
+ "lfs_enabled": false,
+ "avatar_url": null,
+ "web_url": "http://localhost/groups/group1",
+ "request_access_enabled": false,
+ "full_name": "group1",
+ "full_path": "group1",
+ "parent_id": null,
+ "ldap_cn": null,
+ "ldap_access": null
+ }
+ }
+ ],
+ "approvals_before_merge": 2,
+ "reset_approvals_on_push": true,
+ "disable_overriding_approvers_per_merge_request": false
+}
+```
+
+### Change configuration
+
+>**Note:** This API endpoint is only available on 10.6 Starter and above.
+
+If you are allowed to, you can change approval configuration using the following
+endpoint:
+
+```
+POST /projects/:id/approvals
+```
+
+**Parameters:**
+
+| Attribute | Type | Required | Description |
+| ------------------------------------------------ | ------- | -------- | ---------------------------------------------------------- |
+| `id` | integer | yes | The ID of a project |
+| `approvals_before_merge` | integer | no | How many approvals are required before an MR can be merged |
+| `reset_approvals_on_push` | boolean | no | Reset approvals on a new push |
+| `disable_overriding_approvers_per_merge_request` | boolean | no | Allow/Disallow overriding approvers per MR |
+| `merge_requests_author_approval` | boolean | no | Allow/Disallow authors be able to self approve merge requests |
+
+```json
+{
+ "approvers": [
+ {
+ "user": {
+ "id": 5,
+ "name": "John Doe6",
+ "username": "user5",
+ "state":"active","avatar_url":"https://www.gravatar.com/avatar/4aea8cf834ed91844a2da4ff7ae6b491?s=80\u0026d=identicon","web_url":"http://localhost/user5"
+ }
+ }
+ ],
+ "approver_groups": [
+ {
+ "group": {
+ "id": 1,
+ "name": "group1",
+ "path": "group1",
+ "description": "",
+ "visibility": "public",
+ "lfs_enabled": false,
+ "avatar_url": null,
+ "web_url": "http://localhost/groups/group1",
+ "request_access_enabled": false,
+ "full_name": "group1",
+ "full_path": "group1",
+ "parent_id": null,
+ "ldap_cn": null,
+ "ldap_access": null
+ }
+ }
+ ],
+ "approvals_before_merge": 2,
+ "reset_approvals_on_push": true,
+ "disable_overriding_approvers_per_merge_request": false,
+ "merge_requests_author_approval": false
+}
+```
+
+### Change allowed approvers
+
+>**Note:** This API endpoint is only available on 10.6 Starter and above.
+
+If you are allowed to, you can change approvers and approver groups using
+the following endpoint:
+
+```
+PUT /projects/:id/approvers
+```
+
+**Important:** Approvers and groups not in the request will be **removed**
+
+**Parameters:**
+
+| Attribute | Type | Required | Description |
+| -------------------- | ------- | -------- | --------------------------------------------------- |
+| `id` | integer | yes | The ID of a project |
+| `approver_ids` | Array | yes | An array of User IDs that can approve MRs |
+| `approver_group_ids` | Array | yes | An array of Group IDs whose members can approve MRs |
+
+```json
+{
+ "approvers": [
+ {
+ "user": {
+ "id": 5,
+ "name": "John Doe6",
+ "username": "user5",
+ "state":"active","avatar_url":"https://www.gravatar.com/avatar/4aea8cf834ed91844a2da4ff7ae6b491?s=80\u0026d=identicon","web_url":"http://localhost/user5"
+ }
+ }
+ ],
+ "approver_groups": [
+ {
+ "group": {
+ "id": 1,
+ "name": "group1",
+ "path": "group1",
+ "description": "",
+ "visibility": "public",
+ "lfs_enabled": false,
+ "avatar_url": null,
+ "web_url": "http://localhost/groups/group1",
+ "request_access_enabled": false,
+ "full_name": "group1",
+ "full_path": "group1",
+ "parent_id": null,
+ "ldap_cn": null,
+ "ldap_access": null
+ }
+ }
+ ],
+ "approvals_before_merge": 2,
+ "reset_approvals_on_push": true,
+ "disable_overriding_approvers_per_merge_request": false
+}
+```
+
+
+## Merge Request-level MR approvals
+
+Configuration for approvals on a specific Merge Request. Must be authenticated for all endpoints.
+
+### Get Configuration
+
+>**Note:** This API endpoint is only available on 8.9 Starter and above.
+
+You can request information about a merge request's approval status using the
+following endpoint:
+
+```
+GET /projects/:id/merge_requests/:merge_request_iid/approvals
+```
+
+**Parameters:**
+
+| Attribute | Type | Required | Description |
+|---------------------|---------|----------|---------------------|
+| `id` | integer | yes | The ID of a project |
+| `merge_request_iid` | integer | yes | The IID of MR |
+
+```json
+{
+ "id": 5,
+ "iid": 5,
+ "project_id": 1,
+ "title": "Approvals API",
+ "description": "Test",
+ "state": "opened",
+ "created_at": "2016-06-08T00:19:52.638Z",
+ "updated_at": "2016-06-08T21:20:42.470Z",
+ "merge_status": "cannot_be_merged",
+ "approvals_required": 2,
+ "approvals_left": 1,
+ "approved_by": [
+ {
+ "user": {
+ "name": "Administrator",
+ "username": "root",
+ "id": 1,
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
+ "web_url": "http://localhost:3000/u/root"
+ }
+ }
+ ],
+ "approvers": [],
+ "approver_groups": []
+}
+```
+
+### Change approval configuration
+
+>**Note:** This API endpoint is only available on 10.6 Starter and above.
+
+If you are allowed to, you can change `approvals_required` using the following
+endpoint:
+
+```
+POST /projects/:id/merge_requests/:merge_request_iid/approvals
+```
+
+**Parameters:**
+
+| Attribute | Type | Required | Description |
+|----------------------|---------|----------|--------------------------------------------|
+| `id` | integer | yes | The ID of a project |
+| `merge_request_iid` | integer | yes | The IID of MR |
+| `approvals_required` | integer | yes | Approvals required before MR can be merged |
+
+
+```json
+{
+ "id": 5,
+ "iid": 5,
+ "project_id": 1,
+ "title": "Approvals API",
+ "description": "Test",
+ "state": "opened",
+ "created_at": "2016-06-08T00:19:52.638Z",
+ "updated_at": "2016-06-08T21:20:42.470Z",
+ "merge_status": "cannot_be_merged",
+ "approvals_required": 2,
+ "approvals_left": 2,
+ "approved_by": [],
+ "approvers": [],
+ "approver_groups": []
+}
+```
+
+### Change allowed approvers for Merge Request
+
+>**Note:** This API endpoint is only available on 10.6 Starter and above.
+
+If you are allowed to, you can change approvers and approver groups using
+the following endpoint:
+
+```
+PUT /projects/:id/merge_requests/:merge_request_iid/approvers
+```
+
+**Important:** Approvers and groups not in the request will be **removed**
+
+**Parameters:**
+
+| Attribute | Type | Required | Description |
+|----------------------|---------|----------|-----------------------------------------------------------|
+| `id` | integer | yes | The ID of a project |
+| `merge_request_iid` | integer | yes | The IID of MR |
+| `approver_ids` | Array | yes | An array of User IDs that can approve the MR |
+| `approver_group_ids` | Array | yes | An array of Group IDs whose members can approve the MR |
+
+```json
+{
+ "id": 5,
+ "iid": 5,
+ "project_id": 1,
+ "title": "Approvals API",
+ "description": "Test",
+ "state": "opened",
+ "created_at": "2016-06-08T00:19:52.638Z",
+ "updated_at": "2016-06-08T21:20:42.470Z",
+ "merge_status": "cannot_be_merged",
+ "approvals_required": 2,
+ "approvals_left": 2,
+ "approved_by": [],
+ "approvers": [
+ {
+ "user": {
+ "name": "Administrator",
+ "username": "root",
+ "id": 1,
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
+ "web_url": "http://localhost:3000/u/root"
+ }
+ }
+ ],
+ "approver_groups": [
+ {
+ "group": {
+ "id": 5,
+ "name": "group1",
+ "path": "group1",
+ "description": "",
+ "visibility": "public",
+ "lfs_enabled": false,
+ "avatar_url": null,
+ "web_url": "http://localhost/groups/group1",
+ "request_access_enabled": false,
+ "full_name": "group1",
+ "full_path": "group1",
+ "parent_id": null,
+ "ldap_cn": null,
+ "ldap_access": null
+ }
+ }
+ ]
+}
+```
+
+## Approve Merge Request
+
+>**Note:** This API endpoint is only available on 8.9 Starter and above.
+
+If you are allowed to, you can approve a merge request using the following
+endpoint:
+
+```
+POST /projects/:id/merge_requests/:merge_request_iid/approve
+```
+
+**Parameters:**
+
+| Attribute | Type | Required | Description |
+|---------------------|---------|----------|-------------------------|
+| `id` | integer | yes | The ID of a project |
+| `merge_request_iid` | integer | yes | The IID of MR |
+| `sha` | string | no | The HEAD of the MR |
+| `approval_password` **[STARTER]** | string | no | Current user's password. Required if [**Require user password to approve**](../user/project/merge_requests/merge_request_approvals.md#require-authentication-when-approving-a-merge-request-starter) is enabled in the project settings. |
+
+The `sha` parameter works in the same way as
+when [accepting a merge request](merge_requests.md#accept-mr): if it is passed, then it must
+match the current HEAD of the merge request for the approval to be added. If it
+does not match, the response code will be `409`.
+
+```json
+{
+ "id": 5,
+ "iid": 5,
+ "project_id": 1,
+ "title": "Approvals API",
+ "description": "Test",
+ "state": "opened",
+ "created_at": "2016-06-08T00:19:52.638Z",
+ "updated_at": "2016-06-09T21:32:14.105Z",
+ "merge_status": "can_be_merged",
+ "approvals_required": 2,
+ "approvals_left": 0,
+ "approved_by": [
+ {
+ "user": {
+ "name": "Administrator",
+ "username": "root",
+ "id": 1,
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
+ "web_url": "http://localhost:3000/u/root"
+ }
+ },
+ {
+ "user": {
+ "name": "Nico Cartwright",
+ "username": "ryley",
+ "id": 2,
+ "state": "active",
+ "avatar_url": "http://www.gravatar.com/avatar/cf7ad14b34162a76d593e3affca2adca?s=80\u0026d=identicon",
+ "web_url": "http://localhost:3000/u/ryley"
+ }
+ }
+ ],
+ "approvers": [],
+ "approver_groups": []
+}
+```
+
+## Unapprove Merge Request
+
+>**Note:** This API endpoint is only available on 9.0 Starter and above.
+
+If you did approve a merge request, you can unapprove it using the following
+endpoint:
+
+```
+POST /projects/:id/merge_requests/:merge_request_iid/unapprove
+```
+
+**Parameters:**
+
+| Attribute | Type | Required | Description |
+|---------------------|---------|----------|---------------------|
+| `id` | integer | yes | The ID of a project |
+| `merge_request_iid` | integer | yes | The IID of MR |
diff --git a/doc/api/packages.md b/doc/api/packages.md
new file mode 100644
index 00000000000..618e5c3056a
--- /dev/null
+++ b/doc/api/packages.md
@@ -0,0 +1,152 @@
+# Packages API **[PREMIUM]**
+
+This is the API docs of [GitLab Packages](../administration/packages.md).
+
+## List project packages
+
+> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9259) in GitLab 11.8.
+
+Get a list of project packages. Both Maven and NPM packages are included in results.
+When accessed without authentication, only packages of public projects are returned.
+
+```
+GET /projects/:id/packages
+```
+
+| Attribute | Type | Required | Description |
+| --------- | ---- | -------- | ----------- |
+| `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
+
+```bash
+curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/:id/packages
+```
+
+Example response:
+
+```json
+[
+ {
+ "id": 1,
+ "name": "com/mycompany/my-app",
+ "version": "1.0-SNAPSHOT",
+ "package_type": "maven"
+ },
+ {
+ "id": 2,
+ "name": "@foo/bar",
+ "version": "1.0.3",
+ "package_type": "npm"
+ }
+]
+```
+
+By default, the `GET` request will return 20 results, since the API is [paginated](README.md#pagination).
+
+## Get a project package
+
+> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9667) in GitLab 11.9.
+
+Get a single project package.
+
+```
+GET /projects/:id/packages/:package_id
+```
+
+| Attribute | Type | Required | Description |
+| --------- | ---- | -------- | ----------- |
+| `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding). |
+| `package_id` | integer | yes | ID of a package. |
+
+```bash
+curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/:id/packages/:package_id
+```
+
+Example response:
+
+```json
+{
+ "id": 1,
+ "name": "com/mycompany/my-app",
+ "version": "1.0-SNAPSHOT",
+ "package_type": "maven"
+}
+```
+
+## List package files
+
+> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9305) in GitLab 11.8.
+
+Get a list of package files of a single package.
+
+```
+GET /projects/:id/packages/:package_id/package_files
+```
+
+| Attribute | Type | Required | Description |
+| --------- | ---- | -------- | ----------- |
+| `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
+| `package_id` | integer | yes | ID of a package. |
+
+```bash
+curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/packages/4/package_files
+```
+
+Example response:
+
+```json
+[
+ {
+ "id": 25,
+ "package_id": 4,
+ "created_at": "2018-11-07T15:25:52.199Z",
+ "file_name": "my-app-1.5-20181107.152550-1.jar",
+ "size": 2421,
+ "file_md5": "58e6a45a629910c6ff99145a688971ac",
+ "file_sha1": "ebd193463d3915d7e22219f52740056dfd26cbfe"
+ },
+ {
+ "id": 26,
+ "package_id": 4,
+ "created_at": "2018-11-07T15:25:56.776Z",
+ "file_name": "my-app-1.5-20181107.152550-1.pom",
+ "size": 1122,
+ "file_md5": "d90f11d851e17c5513586b4a7e98f1b2",
+ "file_sha1": "9608d068fe88aff85781811a42f32d97feb440b5"
+ },
+ {
+ "id": 27,
+ "package_id": 4,
+ "created_at": "2018-11-07T15:26:00.556Z",
+ "file_name": "maven-metadata.xml",
+ "size": 767,
+ "file_md5": "6dfd0cce1203145a927fef5e3a1c650c",
+ "file_sha1": "d25932de56052d320a8ac156f745ece73f6a8cd2"
+ }
+]
+```
+
+By default, the `GET` request will return 20 results, since the API is [paginated](README.md#pagination).
+
+## Delete a project package
+
+> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9623) in GitLab 11.9.
+
+Deletes a project package.
+
+```
+DELETE /projects/:id/packages/:package_id
+```
+
+| Attribute | Type | Required | Description |
+| --------- | ---- | -------- | ----------- |
+| `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
+| `package_id` | integer | yes | ID of a package. |
+
+```bash
+curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/:id/packages/:package_id
+```
+
+Can return the following status codes:
+
+- `204 No Content`, if the package was deleted successfully.
+- `404 Not Found`, if the package was not found.
diff --git a/doc/api/project_level_variables.md b/doc/api/project_level_variables.md
index 4a6f5624394..3b00f6f140e 100644
--- a/doc/api/project_level_variables.md
+++ b/doc/api/project_level_variables.md
@@ -52,7 +52,9 @@ curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/a
{
"key": "TEST_VARIABLE_1",
"variable_type": "env_var",
- "value": "TEST_1"
+ "value": "TEST_1",
+ "protected": false,
+ "masked": true
}
```
@@ -71,6 +73,7 @@ POST /projects/:id/variables
| `value` | string | yes | The `value` of a variable |
| `variable_type` | string | no | The type of a variable. Available types are: `env_var` (default) and `file` |
| `protected` | boolean | no | Whether the variable is protected |
+| `masked` | boolean | no | Whether the variable is masked |
```
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/variables" --form "key=NEW_VARIABLE" --form "value=new value"
@@ -81,7 +84,8 @@ curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitla
"key": "NEW_VARIABLE",
"value": "new value",
"variable_type": "env_var",
- "protected": false
+ "protected": false,
+ "masked": false
}
```
@@ -100,6 +104,7 @@ PUT /projects/:id/variables/:key
| `value` | string | yes | The `value` of a variable |
| `variable_type` | string | no | The type of a variable. Available types are: `env_var` (default) and `file` |
| `protected` | boolean | no | Whether the variable is protected |
+| `masked` | boolean | no | Whether the variable is masked |
```
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/variables/NEW_VARIABLE" --form "value=updated value"
@@ -110,7 +115,8 @@ curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab
"key": "NEW_VARIABLE",
"value": "updated value",
"variable_type": "env_var",
- "protected": true
+ "protected": true,
+ "masked": false
}
```
diff --git a/doc/api/repository_files.md b/doc/api/repository_files.md
index 6fcc06ea8cd..87c7f371de1 100644
--- a/doc/api/repository_files.md
+++ b/doc/api/repository_files.md
@@ -181,7 +181,7 @@ Currently gitlab-shell has a boolean return code, preventing GitLab from specify
## Delete existing file in repository
-This allows you to delete a single file. For deleting multiple files with a singleh request see the [commits API](commits.html#create-a-commit-with-multiple-files-and-actions).
+This allows you to delete a single file. For deleting multiple files with a single request, see the [commits API](commits.html#create-a-commit-with-multiple-files-and-actions).
```
DELETE /projects/:id/repository/files/:file_path
diff --git a/doc/api/scim.md b/doc/api/scim.md
new file mode 100644
index 00000000000..4595c6f2ed3
--- /dev/null
+++ b/doc/api/scim.md
@@ -0,0 +1,235 @@
+# SCIM API
+
+> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9388) in [GitLab Silver](https://about.gitlab.com/pricing/) 11.10.
+
+The SCIM API implements the [the RFC7644 protocol](https://tools.ietf.org/html/rfc7644).
+
+NOTE: **Note:**
+[Group SSO](../user/group/saml_sso/index.md) and the feature
+flag `:group_scim` must be enabled for the group. For more information, see [SCIM setup documentation](../user/group/saml_sso/scim_setup.md#requirements).
+
+## Get a list of SAML users
+
+NOTE: **Note:**
+This endpoint is used as part of the SCIM syncing mechanism and it only returns
+a single user based on a unique ID which should match the `extern_uid` of the user.
+
+```text
+GET /api/scim/v2/groups/:group_path/Users
+```
+
+Parameters:
+
+| Attribute | Type | Required | Description |
+|:----------|:--------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------|
+| `filter` | string | yes | A [filter](#available-filters) expression. |
+| `group_path` | string | yes | Full path to the group. |
+
+Example request:
+
+```sh
+curl 'https://example.gitlab.com/api/scim/v2/groups/test_group/Users?filter=id%20eq%20"0b1d561c-21ff-4092-beab-8154b17f82f2"' --header "Authorization: Bearer <your_scim_token>" --header "Content-Type: application/scim+json"
+```
+
+Example response:
+
+```json
+{
+ "schemas": [
+ "urn:ietf:params:scim:api:messages:2.0:ListResponse"
+ ],
+ "totalResults": 1,
+ "itemsPerPage": 20,
+ "startIndex": 1,
+ "Resources": [
+ {
+ "schemas": [
+ "urn:ietf:params:scim:schemas:core:2.0:User"
+ ],
+ "id": "0b1d561c-21ff-4092-beab-8154b17f82f2",
+ "active": true,
+ "name.formatted": "Test User",
+ "userName": "username",
+ "meta": { "resourceType":"User" },
+ "emails": [
+ {
+ "type": "work",
+ "value": "name@example.com",
+ "primary": true
+ }
+ ]
+ }
+ ]
+}
+```
+
+## Get a single SAML user
+
+```text
+GET /api/scim/v2/groups/:group_path/Users/:id
+```
+
+Parameters:
+
+| Attribute | Type | Required | Description |
+|:----------|:--------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------|
+| `id` | string | yes | External UID of the user. |
+| `group_path` | string | yes | Full path to the group. |
+
+Example request:
+
+```sh
+curl 'https://example.gitlab.com/api/scim/v2/groups/test_group/Users/f0b1d561c-21ff-4092-beab-8154b17f82f2' --header "Authorization: Bearer <your_scim_token>" --header "Content-Type: application/scim+json"
+```
+
+Example response:
+
+```json
+{
+ "schemas": [
+ "urn:ietf:params:scim:schemas:core:2.0:User"
+ ],
+ "id": "0b1d561c-21ff-4092-beab-8154b17f82f2",
+ "active": true,
+ "name.formatted": "Test User",
+ "userName": "username",
+ "meta": { "resourceType":"User" },
+ "emails": [
+ {
+ "type": "work",
+ "value": "name@example.com",
+ "primary": true
+ }
+ ]
+}
+```
+
+## Create a SAML user
+
+```text
+POST /api/scim/v2/groups/:group_path/Users/
+```
+
+Parameters:
+
+| Attribute | Type | Required | Description |
+|:---------------|:----------|:----|:--------------------------|
+| `externalId` | string | yes | External UID of the user. |
+| `userName` | string | yes | Username of the user. |
+| `emails` | JSON string | yes | Work email. |
+| `name` | JSON string | yes | Name of the user. |
+| `meta` | string | no | Resource type (`User'). |
+
+Example request:
+
+```sh
+curl --verbose --request POST 'https://example.gitlab.com/api/scim/v2/groups/test_group/Users' --data '{"externalId":"test_uid","active":null,"userName":"username","emails":[{"primary":true,"type":"work","value":"name@example.com"}],"name":{"formatted":"Test User","familyName":"User","givenName":"Test"},"schemas":["urn:ietf:params:scim:schemas:core:2.0:User"],"meta":{"resourceType":"User"}}' --header "Authorization: Bearer <your_scim_token>" --header "Content-Type: application/scim+json"
+```
+
+Example response:
+
+```json
+{
+ "schemas": [
+ "urn:ietf:params:scim:schemas:core:2.0:User"
+ ],
+ "id": "0b1d561c-21ff-4092-beab-8154b17f82f2",
+ "active": true,
+ "name.formatted": "Test User",
+ "userName": "username",
+ "meta": { "resourceType":"User" },
+ "emails": [
+ {
+ "type": "work",
+ "value": "name@example.com",
+ "primary": true
+ }
+ ]
+}
+```
+
+Returns a `201` status code if successful.
+
+## Update a single SAML user
+
+Fields that can be updated are:
+
+| SCIM/IdP field | GitLab field |
+|:----------|:--------|
+| id/externalId | extern_uid |
+| name.formatted | name |
+| emails\[type eq "work"\].value | email |
+| active | Identity removal if `active = false` |
+| userName | username |
+
+```text
+PATCH /api/scim/v2/groups/:group_path/Users/:id
+```
+
+Parameters:
+
+| Attribute | Type | Required | Description |
+|:----------|:--------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------|
+| `id` | string | yes | External UID of the user. |
+| `group_path` | string | yes | Full path to the group. |
+| `Operations` | JSON string | yes | An [operations](#available-operations) expression. |
+
+Example request:
+
+```sh
+curl --verbose --request PATCH 'https://example.gitlab.com/api/scim/v2/groups/test_group/Users/f0b1d561c-21ff-4092-beab-8154b17f82f2' --data '{ "Operations": [{"op":"Add","path":"name.formatted","value":"New Name"}] }' --header "Authorization: Bearer <your_scim_token>" --header "Content-Type: application/scim+json"
+```
+
+Returns an empty response with a `204` status code if successful.
+
+## Remove a single SAML user
+
+Removes the user's SSO identity and group membership.
+
+```text
+DELETE /api/scim/v2/groups/:group_path/Users/:id
+```
+
+Parameters:
+
+| Attribute | Type | Required | Description |
+|:----------|:--------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------|
+| `id` | string | yes | External UID of the user. |
+| `group_path` | string | yes | Full path to the group. |
+
+Example request:
+
+```sh
+curl --verbose --request DELETE 'https://example.gitlab.com/api/scim/v2/groups/test_group/Users/f0b1d561c-21ff-4092-beab-8154b17f82f2' --header "Authorization: Bearer <your_scim_token>" --header "Content-Type: application/scim+json"
+```
+
+Returns an empty response with a `204` status code if successful.
+
+## Available filters
+
+They match an expression as specified in [the RFC7644 filtering section](https://tools.ietf.org/html/rfc7644#section-3.4.2.2).
+
+| Filter | Description |
+| ----- | ----------- |
+| `eq` | The attribute matches exactly the specified value. |
+
+Example:
+
+```
+id eq a-b-c-d
+```
+
+## Available operations
+
+They perform an operation as specified in [the RFC7644 update section](https://tools.ietf.org/html/rfc7644#section-3.5.2).
+
+| Operator | Description |
+| ----- | ----------- |
+| `Replace` | The attribute's value is updated. |
+| `Add` | The attribute has a new value. |
+
+Example:
+
+```json
+{ "op": "Add", "path": "name.formatted", "value": "New Name" }
+```
diff --git a/doc/api/search.md b/doc/api/search.md
index 6ee3d32d8bc..c2dd72479c1 100644
--- a/doc/api/search.md
+++ b/doc/api/search.md
@@ -556,6 +556,7 @@ GET /projects/:id/search
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
| `scope` | string | yes | The scope to search in |
| `search` | string | yes | The search query |
+| `ref` | string | no | The name of a repository branch or tag to search on. The project's default branch is used by default. This is only applicable for scopes: commits, blobs, and wiki_blobs. |
Search the expression within the specified scope. Currently these scopes are supported: issues, merge_requests, milestones, notes, wiki_blobs, commits, blobs, users.
@@ -850,7 +851,7 @@ Blobs searches are performed on both filenames and contents. Search results:
times in the content.
```bash
-curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/6/search?scope=blobs&search=installation
+curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/6/search?scope=blobs&search=installation&ref=feature
```
Example response:
@@ -863,7 +864,7 @@ Example response:
"data": "```\n\n## Installation\n\nQuick start using the [pre-built",
"filename": "README.md",
"id": null,
- "ref": "master",
+ "ref": "feature",
"startline": 46,
"project_id": 6
}
diff --git a/doc/api/vulnerabilities.md b/doc/api/vulnerabilities.md
new file mode 100644
index 00000000000..87f77613ad3
--- /dev/null
+++ b/doc/api/vulnerabilities.md
@@ -0,0 +1,113 @@
+# Vulnerabilities API
+
+Every API call to vulnerabilities must be authenticated.
+
+If a user is not a member of a project and the project is private, a `GET`
+request on that project will result in a `404` status code.
+
+CAUTION: **Caution:**
+This API is in an alpha stage and considered unstable.
+The response payload may be subject to change or breakage
+across GitLab releases.
+
+## Vulnerabilities pagination
+
+By default, `GET` requests return 20 results at a time because the API results
+are paginated.
+
+Read more on [pagination](README.md#pagination).
+
+## List project vulnerabilities
+
+List all of a project's vulnerabilities.
+
+```
+GET /projects/:id/vulnerabilities
+GET /projects/:id/vulnerabilities?report_type=sast
+GET /projects/:id/vulnerabilities?report_type=container_scanning
+GET /projects/:id/vulnerabilities?report_type=sast,dast
+GET /projects/:id/vulnerabilities?scope=all
+GET /projects/:id/vulnerabilities?scope=dismissed
+GET /projects/:id/vulnerabilities?severity=high
+GET /projects/:id/vulnerabilities?confidence=unknown,experimental
+```
+
+| Attribute | Type | Required | Description |
+| ------------------- | ---------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. |
+| `report_type` | Array[string] | no | Returns vulnerabilities belonging to specified report type. Valid values: `sast`, `dast`, `dependency_scanning`, or `container_scanning`. |
+| `scope` | string | no | Returns vulnerabilities for the given scope: `all` or `dismissed`. Defaults to `dismissed` |
+| `severity` | Array[string] | no | Returns vulnerabilities belonging to specified severity level: `undefined`, `info`, `unknown`, `low`, `medium`, `high`, or `critical`. Defaults to all' |
+| `confidence` | Array[string] | no | Returns vulnerabilities belonging to specified confidence level: `undefined`, `ignore`, `unknown`, `experimental`, `low`, `medium`, `high`, or `confirmed`. Defaults to all |
+
+```bash
+curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/4/vulnerabilities
+```
+
+Example response:
+
+```json
+[
+ {
+ "id": null,
+ "report_type": "dependency_scanning",
+ "name": "Authentication bypass via incorrect DOM traversal and canonicalization in saml2-js",
+ "severity": "unknown",
+ "confidence": "undefined",
+ "scanner": {
+ "external_id": "gemnasium",
+ "name": "Gemnasium"
+ },
+ "identifiers": [
+ {
+ "external_type": "gemnasium",
+ "external_id": "9952e574-7b5b-46fa-a270-aeb694198a98",
+ "name": "Gemnasium-9952e574-7b5b-46fa-a270-aeb694198a98",
+ "url": "https://deps.sec.gitlab.com/packages/npm/saml2-js/versions/1.5.0/advisories"
+ },
+ {
+ "external_type": "cve",
+ "external_id": "CVE-2017-11429",
+ "name": "CVE-2017-11429",
+ "url": "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-11429"
+ }
+ ],
+ "project_fingerprint": "fa6f5b6c5d240b834ac5e901dc69f9484cef89ec",
+ "create_vulnerability_feedback_issue_path": "/tests/yarn-remediation-test/vulnerability_feedback",
+ "create_vulnerability_feedback_merge_request_path": "/tests/yarn-remediation-test/vulnerability_feedback",
+ "create_vulnerability_feedback_dismissal_path": "/tests/yarn-remediation-test/vulnerability_feedback",
+ "project": {
+ "id": 31,
+ "name": "yarn-remediation-test",
+ "full_path": "/tests/yarn-remediation-test",
+ "full_name": "tests / yarn-remediation-test"
+ },
+ "dismissal_feedback": null,
+ "issue_feedback": null,
+ "merge_request_feedback": null,
+ "description": "Some XML DOM traversal and canonicalization APIs may be inconsistent in handling of comments within XML nodes. Incorrect use of these APIs by some SAML libraries results in incorrect parsing of the inner text of XML nodes such that any inner text after the comment is lost prior to cryptographically signing the SAML message. Text after the comment therefore has no impact on the signature on the SAML message.\r\n\r\nA remote attacker can modify SAML content for a SAML service provider without invalidating the cryptographic signature, which may allow attackers to bypass primary authentication for the affected SAML service provider.",
+ "links": [
+ {
+ "url": "https://github.com/Clever/saml2/commit/3546cb61fd541f219abda364c5b919633609ef3d#diff-af730f9f738de1c9ad87596df3f6de84R279"
+ },
+ {
+ "url": "https://www.kb.cert.org/vuls/id/475445"
+ },
+ {
+ "url": "https://github.com/Clever/saml2/issues/127"
+ }
+ ],
+ "location": {
+ "file": "yarn.lock",
+ "dependency": {
+ "package": {
+ "name": "saml2-js"
+ },
+ "version": "1.5.0"
+ }
+ },
+ "solution": "Upgrade to fixed version.\r\n",
+ "blob_path": "/tests/yarn-remediation-test/blob/cc6c4a0778460455ae5d16ca7025ca9ca1ca75ac/yarn.lock"
+ }
+]
+```
diff --git a/doc/ci/ci_cd_for_external_repos/img/github_omniauth_list.png b/doc/ci/ci_cd_for_external_repos/img/github_omniauth_list.png
deleted file mode 100644
index 3f2059504f5..00000000000
--- a/doc/ci/ci_cd_for_external_repos/img/github_omniauth_list.png
+++ /dev/null
Binary files differ
diff --git a/doc/ci/environments.md b/doc/ci/environments.md
index d5e6fbe8113..5a14ac17aec 100644
--- a/doc/ci/environments.md
+++ b/doc/ci/environments.md
@@ -268,7 +268,7 @@ For the value of:
which receives the value of the branch name.
- `environment:url`, we want a specific and distinct URL for each branch. `$CI_COMMIT_REF_NAME`
may contain a `/` or other characters that would be invalid in a domain name or URL,
- so we use `$CI_ENVIRONMENT_SLUG` to get a "clean" or "safe" URL.
+ so we use `$CI_ENVIRONMENT_SLUG` to guarantee that we get a valid URL.
For example, given a `$CI_COMMIT_REF_NAME` of `100-Do-The-Thing`, the URL will be something
like `https://100-do-the-4f99a2.example.com`. Again, the way you set up
@@ -351,7 +351,7 @@ deploy_prod:
```
A more realistic example would also include copying files to a location where a
-webserver (for example, NGINX) could then acess and serve them.
+webserver (for example, NGINX) could then access and serve them.
The example below will copy the `public` directory to `/srv/nginx/$CI_COMMIT_REF_SLUG/public`:
diff --git a/doc/ci/examples/README.md b/doc/ci/examples/README.md
index 6b9f8181d1d..340a41c196b 100644
--- a/doc/ci/examples/README.md
+++ b/doc/ci/examples/README.md
@@ -18,30 +18,30 @@ Examples are available in several forms. As a collection of:
The following table lists examples for different use cases:
-| Use case | Resource |
-|:-----------------------------------------------|:---------------------------------------------------------------------------------------------------------------------|
-| Browser performance testing | [Browser Performance Testing with the Sitespeed.io container](browser_performance.md). |
-| Clojure | [Test a Clojure application with GitLab CI/CD](test-clojure-application.md). |
-| Code quality analysis | [Analyze your project's Code Quality](code_quality.md). **[STARTER]** |
-| Container scanning | [Container Scanning with GitLab CI/CD](container_scanning.md). |
-| Dependency scanning | [Dependency Scanning with GitLab CI/CD](dependency_scanning.md). **[ULTIMATE]** |
-| Deployment with `dpl` | [Using `dpl` as deployment tool](deployment/README.md). |
-| Dynamic application<br>security testing (DAST) | [Dynamic Application Security Testing with GitLab CI/CD](dast.md) **[ULTIMATE]** |
-| Elixir | [Testing a Phoenix application with GitLab CI/CD](test_phoenix_app_with_gitlab_ci_cd/index.md). |
-| Game development | [DevOps and Game Dev with GitLab CI/CD](devops_and_game_dev_with_gitlab_ci_cd/index.md). |
-| GitLab Pages | See the [GitLab Pages](../../user/project/pages/index.md) documentation for a complete example. |
-| Java | [Deploy a Spring Boot application to Cloud Foundry with GitLab CI/CD](deploy_spring_boot_to_cloud_foundry/index.md). |
-| JUnit | [JUnit test reports](../junit_test_reports.md). |
-| License management | [Dependencies license management with GitLab CI/CD](license_management.md) **[ULTIMATE]** |
-| Maven | [How to deploy Maven projects to Artifactory with GitLab CI/CD](artifactory_and_gitlab/index.md). |
-| PHP | [Testing PHP projects](php.md). |
-| PHP | [Running Composer and NPM scripts with deployment via SCP in GitLab CI/CD](deployment/composer-npm-deploy.md). |
-| PHP | [Test and deploy Laravel applications with GitLab CI/CD and Envoy](laravel_with_gitlab_and_envoy/index.md). |
-| Python | [Test and deploy a Python application with GitLab CI/CD](test-and-deploy-python-application-to-heroku.md). |
-| Ruby | [Test and deploy a Ruby application with GitLab CI/CD](test-and-deploy-ruby-application-to-heroku.md). |
-| Scala | [Test and deploy a Scala application to Heroku](test-scala-application.md). |
-| Static application<br>security testing (SAST) | [Static Application Security Testing with GitLab CI/CD](sast.md) **[ULTIMATE]** |
-| Testing | [End-to-end testing with GitLab CI/CD and WebdriverIO](end_to_end_testing_webdriverio/index.md). |
+| Use case | Resource |
+|:-----------------------------------------------|:------------------------------------------------------------------------------------------------------------------------|
+| Browser performance testing | [Browser Performance Testing with the Sitespeed.io container](browser_performance.md). |
+| Clojure | [Test a Clojure application with GitLab CI/CD](test-clojure-application.md). |
+| Code quality analysis | [Analyze your project's Code Quality](code_quality.md). **[STARTER]** |
+| Container scanning | [Container Scanning with GitLab CI/CD](../../user/application_security/container_scanning/index.md). **[ULTIMATE]** |
+| Dependency scanning | [Dependency Scanning with GitLab CI/CD](../../user/application_security/dependency_scanning/index.md). **[ULTIMATE]** |
+| Deployment with `dpl` | [Using `dpl` as deployment tool](deployment/README.md). |
+| Dynamic application<br>security testing (DAST) | [Dynamic Application Security Testing with GitLab CI/CD](../../user/application_security/dast/index.md). **[ULTIMATE]** |
+| Elixir | [Testing a Phoenix application with GitLab CI/CD](test_phoenix_app_with_gitlab_ci_cd/index.md). |
+| Game development | [DevOps and Game Dev with GitLab CI/CD](devops_and_game_dev_with_gitlab_ci_cd/index.md). |
+| GitLab Pages | See the [GitLab Pages](../../user/project/pages/index.md) documentation for a complete example. |
+| Java | [Deploy a Spring Boot application to Cloud Foundry with GitLab CI/CD](deploy_spring_boot_to_cloud_foundry/index.md). |
+| JUnit | [JUnit test reports](../junit_test_reports.md). |
+| License management | [Dependencies license management with GitLab CI/CD](../../user/application_security/license_management/index.md). **[ULTIMATE]** |
+| Maven | [How to deploy Maven projects to Artifactory with GitLab CI/CD](artifactory_and_gitlab/index.md). |
+| PHP | [Testing PHP projects](php.md). |
+| PHP | [Running Composer and NPM scripts with deployment via SCP in GitLab CI/CD](deployment/composer-npm-deploy.md). |
+| PHP | [Test and deploy Laravel applications with GitLab CI/CD and Envoy](laravel_with_gitlab_and_envoy/index.md). |
+| Python | [Test and deploy a Python application with GitLab CI/CD](test-and-deploy-python-application-to-heroku.md). |
+| Ruby | [Test and deploy a Ruby application with GitLab CI/CD](test-and-deploy-ruby-application-to-heroku.md). |
+| Scala | [Test and deploy a Scala application to Heroku](test-scala-application.md). |
+| Static application<br>security testing (SAST) | [Static Application Security Testing with GitLab CI/CD](../../user/application_security/sast/index.md). **[ULTIMATE]** |
+| Testing | [End-to-end testing with GitLab CI/CD and WebdriverIO](end_to_end_testing_webdriverio/index.md). |
### Contributing examples
diff --git a/doc/ci/examples/deploy_spring_boot_to_cloud_foundry/index.md b/doc/ci/examples/deploy_spring_boot_to_cloud_foundry/index.md
index cf281605f5e..c622dd86828 100644
--- a/doc/ci/examples/deploy_spring_boot_to_cloud_foundry/index.md
+++ b/doc/ci/examples/deploy_spring_boot_to_cloud_foundry/index.md
@@ -4,6 +4,7 @@ author_gitlab: DylanGriffith
level: intermediate
article_type: tutorial
date: 2018-06-07
+last_updated: 2019-04-08
description: "Continuous Deployment of a Spring Boot application to Cloud Foundry with GitLab CI/CD"
---
@@ -77,7 +78,10 @@ image: java:8
stages:
- build
- deploy
-
+
+before_script:
+ - chmod +x mvnw
+
build:
stage: build
script: ./mvnw package
diff --git a/doc/ci/examples/laravel_with_gitlab_and_envoy/img/laravel_with_gitlab_and_envoy.png b/doc/ci/examples/laravel_with_gitlab_and_envoy/img/laravel_with_gitlab_and_envoy.png
deleted file mode 100644
index bc188f83fb1..00000000000
--- a/doc/ci/examples/laravel_with_gitlab_and_envoy/img/laravel_with_gitlab_and_envoy.png
+++ /dev/null
Binary files differ
diff --git a/doc/ci/examples/test-and-deploy-python-application-to-heroku.md b/doc/ci/examples/test-and-deploy-python-application-to-heroku.md
index 99a4316ab0d..47d20a4e1c1 100644
--- a/doc/ci/examples/test-and-deploy-python-application-to-heroku.md
+++ b/doc/ci/examples/test-and-deploy-python-application-to-heroku.md
@@ -9,7 +9,12 @@ You can checkout the [example source](https://gitlab.com/ayufan/python-getting-s
This is what the `.gitlab-ci.yml` file looks like for this project:
```yaml
+stages:
+ - test
+ - deploy
+
test:
+ stage: test
script:
# this configures Django application to use attached postgres database that is run on `postgres` host
- export DATABASE_URL=postgres://postgres:@postgres:5432/python-test-app
@@ -19,7 +24,7 @@ test:
- python manage.py test
staging:
- type: deploy
+ stage: deploy
script:
- apt-get update -qy
- apt-get install -y ruby-dev
@@ -29,7 +34,7 @@ staging:
- master
production:
- type: deploy
+ stage: deploy
script:
- apt-get update -qy
- apt-get install -y ruby-dev
diff --git a/doc/ci/examples/test_phoenix_app_with_gitlab_ci_cd/img/job-succeeded.png b/doc/ci/examples/test_phoenix_app_with_gitlab_ci_cd/img/job-succeeded.png
deleted file mode 100644
index 77b05f55f88..00000000000
--- a/doc/ci/examples/test_phoenix_app_with_gitlab_ci_cd/img/job-succeeded.png
+++ /dev/null
Binary files differ
diff --git a/doc/ci/introduction/index.md b/doc/ci/introduction/index.md
index 14ea648c00b..0045fa2fb1f 100644
--- a/doc/ci/introduction/index.md
+++ b/doc/ci/introduction/index.md
@@ -156,7 +156,7 @@ Once you're happy with your implementation:
![GitLab workflow example](img/gitlab_workflow_example_11_9.png)
-GitLab CI/CD is capable of a doing a lot more, but this workflow
+GitLab CI/CD is capable of doing a lot more, but this workflow
exemplifies GitLab's ability to track the entire process,
without the need of any external tool to deliver your software.
And, most usefully, you can visualize all the steps through
diff --git a/doc/ci/merge_request_pipelines/img/pipeline_detail.png b/doc/ci/merge_request_pipelines/img/pipeline_detail.png
deleted file mode 100644
index 90e7c449a66..00000000000
--- a/doc/ci/merge_request_pipelines/img/pipeline_detail.png
+++ /dev/null
Binary files differ
diff --git a/doc/ci/merge_request_pipelines/index.md b/doc/ci/merge_request_pipelines/index.md
index 3c26a38e3de..b3ff55daea2 100644
--- a/doc/ci/merge_request_pipelines/index.md
+++ b/doc/ci/merge_request_pipelines/index.md
@@ -70,15 +70,18 @@ when a merge request was created or updated. For example:
## Pipelines for Merged Results **[PREMIUM]**
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/7380) in [GitLab Premium](https://about.gitlab.com/pricing/) 11.10.
+> This feature is disabled by default until we resolve issues with [contention handling](https://gitlab.com/gitlab-org/gitlab-ee/issues/9186), but [can be enabled manually](#enabling-pipelines-for-merged-results).
It's possible for your source and target branches to diverge, which can result
in the scenario that source branch's pipeline was green, the target's pipeline was green,
-but the combined output fails. By having your merge request pipeline automatically
+but the combined output fails.
+
+By having your merge request pipeline automatically
create a new ref that contains the merge result of the source and target branch
(then running a pipeline on that ref), we can better test that the combined result
is also valid.
-From GitLab 11.10, pipelines for merge requests run by default
+GitLab can run pipelines for merge requests
on this merged result. That is, where the source and target branches are combined into a
new ref and a pipeline for this ref validates the result prior to merging.
@@ -95,7 +98,7 @@ get out of WIP status or resolve merge conflicts as soon as possible.
### Enabling Pipelines for Merged Results
-This feature disabled by default until we resolve issues with [contention handling](https://gitlab.com/gitlab-org/gitlab-ee/issues/9186). It can be enabled at the project level:
+To enable pipelines on merged results at the project level:
1. Visit your project's **Settings > General** and expand **Merge requests**.
1. Check **Merge pipelines will try to validate the post-merge result prior to merging**.
@@ -103,6 +106,10 @@ This feature disabled by default until we resolve issues with [contention handli
![Merge request pipeline config](img/merge_request_pipeline_config.png)
+CAUTION: **Warning:**
+Make sure your `gitlab-ci.yml` file is [configured properly for pipelines for merge requests](#configuring-pipelines-for-merge-requests),
+otherwise pipelines for merged results won't run and your merge requests will be stuck in an unresolved state.
+
### Pipelines for Merged Result's limitations
- This feature requires [GitLab Runner](https://gitlab.com/gitlab-org/gitlab-runner) 11.9 or newer.
@@ -193,5 +200,5 @@ By using pipelines for merge requests, GitLab exposes additional predefined vari
Those variables contain information of the associated merge request, so that it's useful
to integrate your job with [GitLab Merge Request API](../../api/merge_requests.md).
-You can find the list of avilable variables in [the reference sheet](../variables/predefined_variables.md).
+You can find the list of available variables in [the reference sheet](../variables/predefined_variables.md).
The variable names begin with the `CI_MERGE_REQUEST_` prefix.
diff --git a/doc/ci/pipelines.md b/doc/ci/pipelines.md
index 342c2ab972a..4dbe1a85588 100644
--- a/doc/ci/pipelines.md
+++ b/doc/ci/pipelines.md
@@ -330,6 +330,19 @@ GitLab provides API endpoints to:
- [Triggering pipelines through the API](triggers/README.md).
- [Pipeline triggers API](../api/pipeline_triggers.md).
+### Start multiple manual actions in a stage
+
+> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/27188) in GitLab 11.11.
+
+Multiple manual actions in a single stage can be started at the same time using the "Play all manual" button.
+Once the user clicks this button, each individual manual action will be triggered and refreshed
+to an updated status.
+
+This functionality is only available:
+
+- For users with at least Developer access.
+- If the the stage contains [manual actions](#manual-actions-from-pipeline-graphs).
+
## Security on protected branches
A strict security model is enforced when pipelines are executed on
diff --git a/doc/ci/runners/shared_to_specific_admin.png b/doc/ci/runners/shared_to_specific_admin.png
deleted file mode 100644
index 8f4010a5849..00000000000
--- a/doc/ci/runners/shared_to_specific_admin.png
+++ /dev/null
Binary files differ
diff --git a/doc/ci/services/mysql.md b/doc/ci/services/mysql.md
index 2902c30c7c0..5fa378fc4c2 100644
--- a/doc/ci/services/mysql.md
+++ b/doc/ci/services/mysql.md
@@ -17,8 +17,8 @@ services:
variables:
# Configure mysql environment variables (https://hub.docker.com/_/mysql/)
- MYSQL_DATABASE: el_duderino
- MYSQL_ROOT_PASSWORD: mysql_strong_password
+ MYSQL_DATABASE: "<your_mysql_database>"
+ MYSQL_ROOT_PASSWORD: "<your_mysql_password>"
```
And then configure your application to use the database, for example:
@@ -26,18 +26,18 @@ And then configure your application to use the database, for example:
```yaml
Host: mysql
User: root
-Password: mysql_strong_password
-Database: el_duderino
+Password: <your_mysql_password>
+Database: <your_mysql_database>
```
If you are wondering why we used `mysql` for the `Host`, read more at
[How services are linked to the job](../docker/using_docker_images.md#how-services-are-linked-to-the-job).
-You can also use any other docker image available on [Docker Hub][hub-mysql].
+You can also use any other docker image available on [Docker Hub](https://hub.docker.com/_/mysql/).
For example, to use MySQL 5.5 the service becomes `mysql:5.5`.
The `mysql` image can accept some environment variables. For more details
-check the documentation on [Docker Hub][hub-mysql].
+check the documentation on [Docker Hub](https://hub.docker.com/_/mysql/).
## Use MySQL with the Shell executor
@@ -74,13 +74,13 @@ mysql> CREATE USER 'runner'@'localhost' IDENTIFIED BY '$password';
Create the database:
```bash
-mysql> CREATE DATABASE IF NOT EXISTS `el_duderino` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
+mysql> CREATE DATABASE IF NOT EXISTS `<your_mysql_database>` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
```
Grant the necessary permissions on the database:
```bash
-mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, CREATE TEMPORARY TABLES, DROP, INDEX, ALTER, LOCK TABLES ON `el_duderino`.* TO 'runner'@'localhost';
+mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, CREATE TEMPORARY TABLES, DROP, INDEX, ALTER, LOCK TABLES ON `<your_mysql_database>`.* TO 'runner'@'localhost';
```
If all went well you can now quit the database session:
@@ -93,7 +93,7 @@ Now, try to connect to the newly created database to check that everything is
in place:
```bash
-mysql -u runner -p -D el_duderino
+mysql -u runner -p -D <your_mysql_database>
```
As a final step, configure your application to use the database, for example:
@@ -102,17 +102,14 @@ As a final step, configure your application to use the database, for example:
Host: localhost
User: runner
Password: $password
-Database: el_duderino
+Database: <your_mysql_database>
```
## Example project
-We have set up an [Example MySQL Project][mysql-example-repo] for your
+We have set up an [Example MySQL Project](https://gitlab.com/gitlab-examples/mysql) for your
convenience that runs on [GitLab.com](https://gitlab.com) using our publicly
available [shared runners](../runners/README.md).
-Want to hack on it? Simply fork it, commit and push your changes. Within a few
+Want to hack on it? Simply fork it, commit and push your changes. Within a few
moments the changes will be picked by a public runner and the job will begin.
-
-[hub-mysql]: https://hub.docker.com/_/mysql/
-[mysql-example-repo]: https://gitlab.com/gitlab-examples/mysql
diff --git a/doc/ci/variables/README.md b/doc/ci/variables/README.md
index 1ba22070abe..67e1d316f02 100644
--- a/doc/ci/variables/README.md
+++ b/doc/ci/variables/README.md
@@ -58,8 +58,29 @@ the need to specify the value itself.
There are two types of variables supported by GitLab:
-- `env_var`: the runner will create environment variable named same as the variable key and set its value to the variable value.
-- `file`: the runner will write the variable value to a temporary file and set the path to this file as the value of an environment variable named same as the variable key.
+- "Variable": the Runner will create an environment variable named same as the variable key and set its value to the variable value.
+- "File": the Runner will write the variable value to a temporary file and set the path to this file as the value of an environment variable named same as the variable key.
+
+Many tools (like [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html) and [kubectl](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#the-kubeconfig-environment-variable)) provide the ability to customise configuration using files by either providing the file path as a command line argument or an environment variable. Prior to the introduction of variable types, the common pattern was to use the value of a CI variable, save it in a file, and then use the newly created file in your script:
+
+```bash
+# Save the content of variable in a file
+echo "$KUBE_CA_PEM" > "$(pwd)/kube.ca.pem"
+ # Use the newly created file
+kubectl config set-cluster e2e --server="$KUBE_URL" --certificate-authority="$(pwd)/kube.ca.pem"
+```
+
+This can be simplified by creating a variable of type "File" and using it directly. For example, let's say we have the following variables.
+
+![CI/CD settings - variable types usage example](img/variable_types_usage_example.png)
+
+We can then call them from `.gitlab-ci.yml` like this:
+
+```bash
+kubectl config set-cluster e2e --server="$KUBE_URL" --certificate-authority="$KUBE_CA_PEM"
+```
+
+Variable types can be set via the [UI](#via-the-ui) or the [API](../../api/project_level_variables.md#create-variable), but not in `.gitlab-ci.yml`.
#### Masked variables
diff --git a/doc/ci/variables/img/new_custom_variables_example.png b/doc/ci/variables/img/new_custom_variables_example.png
index 4b78e0ff587..efe104efe4c 100644
--- a/doc/ci/variables/img/new_custom_variables_example.png
+++ b/doc/ci/variables/img/new_custom_variables_example.png
Binary files differ
diff --git a/doc/ci/variables/img/variable_types_usage_example.png b/doc/ci/variables/img/variable_types_usage_example.png
new file mode 100644
index 00000000000..0e8bde891fe
--- /dev/null
+++ b/doc/ci/variables/img/variable_types_usage_example.png
Binary files differ
diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md
index dca2d953286..31ff56e06f8 100644
--- a/doc/ci/yaml/README.md
+++ b/doc/ci/yaml/README.md
@@ -337,6 +337,7 @@ In addition, `only` and `except` allow the use of special keywords:
| `triggers` | For pipelines created using a trigger token. |
| `web` | For pipelines created using **Run pipeline** button in GitLab UI (under your project's **Pipelines**). |
| `merge_requests` | When a merge request is created or updated (See [pipelines for merge requests](../merge_request_pipelines/index.md)). |
+| `chats` | For jobs created using a [GitLab ChatOps](../chatops/README.md) command. |
In the example below, `job` will run only for refs that start with `issue-`,
whereas all branches will be skipped:
@@ -1446,7 +1447,7 @@ be automatically shown in merge requests.
> Introduced in GitLab 11.5. Requires GitLab Runner 11.5 and above.
-The `sast` report collects [SAST vulnerabilities](https://docs.gitlab.com/ee/user/project/merge_requests/sast.html)
+The `sast` report collects [SAST vulnerabilities](https://docs.gitlab.com/ee/user/application_security/sast/index.html)
as artifacts.
The collected SAST report will be uploaded to GitLab as an artifact and will
@@ -1509,6 +1510,8 @@ be automatically shown in merge requests.
##### `artifacts:reports:metrics` **[PREMIUM]**
+> Introduced in GitLab 11.10.
+
The `metrics` report collects [Metrics](../../ci/metrics_reports.md)
as artifacts.
@@ -1764,9 +1767,6 @@ TIP: **Tip:**
Use merging to customize and override included CI/CD configurations with local
definitions.
-Recursive includes are not supported. Your external files should not use the
-`include` keyword as it will be ignored.
-
NOTE: **Note:**
Using YAML aliases across different YAML files sourced by `include` is not
supported. You must only refer to aliases in the same file. Instead
diff --git a/doc/development/README.md b/doc/development/README.md
index 83a1145c020..2ff38d68a47 100644
--- a/doc/development/README.md
+++ b/doc/development/README.md
@@ -44,6 +44,7 @@ description: 'Learn how to contribute to GitLab.'
- [`Gemfile` guidelines](gemfile.md)
- [Pry debugging](pry_debugging.md)
- [Sidekiq debugging](sidekiq_debugging.md)
+- [Accessing session data](session.md)
- [Gotchas](gotchas.md) to avoid
- [Avoid modules with instance variables](module_with_instance_variables.md) if possible
- [How to dump production data to staging](db_dump.md)
@@ -136,3 +137,8 @@ description: 'Learn how to contribute to GitLab.'
## Go guides
- [Go Guidelines](go_guide/index.md)
+
+## Other GitLab Development Kit (GDK) guides
+
+- [Run full Auto DevOps cycle in a GDK instance](https://gitlab.com/gitlab-org/gitlab-development-kit/blob/master/doc/howto/auto_devops.md)
+- [Using GitLab Runner with GDK](https://gitlab.com/gitlab-org/gitlab-development-kit/blob/master/doc/howto/runner.md)
diff --git a/doc/development/architecture.md b/doc/development/architecture.md
index 1e59b59b312..9a012f4299b 100644
--- a/doc/development/architecture.md
+++ b/doc/development/architecture.md
@@ -10,34 +10,147 @@ For information, see the [GitLab Release Process](https://gitlab.com/gitlab-org/
Both EE and CE require some add-on components called gitlab-shell and Gitaly. These components are available from the [gitlab-shell](https://gitlab.com/gitlab-org/gitlab-shell/tree/master) and [gitaly](https://gitlab.com/gitlab-org/gitaly/tree/master) repositories respectively. New versions are usually tags but staying on the master branch will give you the latest stable version. New releases are generally around the same time as GitLab CE releases with exception for informal security updates deemed critical.
-## GitLab Omnibus Component by Component
+## Components
-This document is designed to be consumed by systems adminstrators and GitLab Support Engineers who want to understand more about the internals of GitLab and how they work together.
+A typical install of GitLab will be on GNU/Linux. It uses Nginx or Apache as a web front end to proxypass the Unicorn web server. By default, communication between Unicorn and the front end is via a Unix domain socket but forwarding requests via TCP is also supported. The web front end accesses `/home/git/gitlab/public` bypassing the Unicorn server to serve static pages, uploads (e.g. avatar images or attachments), and precompiled assets. GitLab serves web pages and a [GitLab API](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/api) using the Unicorn web server. It uses Sidekiq as a job queue which, in turn, uses redis as a non-persistent database backend for job information, meta data, and incoming jobs.
-When deployed, GitLab should be considered the amalgamation of the below processes. When troubleshooting or debugging, be as specific as possible as to which component you are referencing. That should increase clarity and reduce confusion.
+We also support deploying GitLab on Kubernetes using our [gitlab Helm chart](https://docs.gitlab.com/charts/).
-### GitLab Process Descriptions
+The GitLab web app uses MySQL or PostgreSQL for persistent database information (e.g. users, permissions, issues, other meta data). GitLab stores the bare git repositories it serves in `/home/git/repositories` by default. It also keeps default branch and hook information with the bare repository.
-As of this writing, a fresh GitLab 11.3.0 install will show the following processes with `gitlab-ctl status`:
+When serving repositories over HTTP/HTTPS GitLab utilizes the GitLab API to resolve authorization and access as well as serving git objects.
+The add-on component gitlab-shell serves repositories over SSH. It manages the SSH keys within `/home/git/.ssh/authorized_keys` which should not be manually edited. gitlab-shell accesses the bare repositories through Gitaly to serve git objects and communicates with redis to submit jobs to Sidekiq for GitLab to process. gitlab-shell queries the GitLab API to determine authorization and access.
+
+Gitaly executes git operations from gitlab-shell and the GitLab web app, and provides an API to the GitLab web app to get attributes from git (e.g. title, branches, tags, other meta data), and to get blobs (e.g. diffs, commits, files).
+
+You may also be interested in the [production architecture of GitLab.com](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/).
+
+### Component diagram
+
+```mermaid
+graph TB
+
+ HTTP[HTTP/HTTPS] -- TCP 80, 443 --> NGINX[NGINX]
+ SSH -- TCP 22 --> GitLabShell[GitLab Shell]
+ SMTP[SMTP Gateway]
+ Geo[GitLab Geo Node] -- TCP 22, 80, 443 --> NGINX
+
+ GitLabShell --TCP 8080 -->Unicorn["Unicorn (GitLab Rails)"]
+ GitLabShell --> Gitaly
+ GitLabShell --> Redis
+ Unicorn --> PgBouncer[PgBouncer]
+ Unicorn --> Redis
+ Unicorn --> Gitaly
+ Redis --> Sidekiq
+ Sidekiq["Sidekiq (GitLab Rails, ES Indexer)"] --> PgBouncer
+ GitLabWorkhorse[GitLab Workhorse] --> Unicorn
+ GitLabWorkhorse --> Redis
+ GitLabWorkhorse --> Gitaly
+ Gitaly --> Redis
+ NGINX --> GitLabWorkhorse
+ NGINX -- TCP 8090 --> GitLabPages[GitLab Pages]
+ NGINX --> Grafana[Grafana]
+ Grafana -- TCP 9090 --> Prometheus[Prometheus]
+ Prometheus -- TCP 80, 443 --> Unicorn
+ RedisExporter[Redis Exporter] --> Redis
+ Prometheus -- TCP 9121 --> RedisExporter
+ PostgreSQLExporter[PostgreSQL Exporter] --> PostgreSQL
+ PgBouncerExporter[PgBouncer Exporter] --> PgBouncer
+ Prometheus -- TCP 9187 --> PostgreSQLExporter
+ Prometheus -- TCP 9100 --> NodeExporter[Node Exporter]
+ Prometheus -- TCP 9168 --> GitLabMonito[GitLab Monitor]
+ Prometheus -- TCP 9127 --> PgBouncerExporter
+ GitLabMonitor --> PostgreSQL
+ GitLabMonitor --> GitLabShell
+ GitLabMonitor --> Sidekiq
+ PgBouncer --> Consul
+ PostgreSQL --> Consul
+ PgBouncer --> PostgreSQL
+ NGINX --> Registry
+ Unicorn --> Registry
+ NGINX --> Mattermost
+ Mattermost --- Unicorn
+ Prometheus --> Alertmanager
+ Migrations --> PostgreSQL
+ Runner -- TCP 443 --> NGINX
+ Unicorn -- TCP 9200 --> ElasticSearch
+ Sidekiq -- TCP 9200 --> ElasticSearch
+ Sidekiq -- TCP 80, 443 --> Sentry
+ Unicorn -- TCP 80, 443 --> Sentry
+ Sidekiq -- UDP 6831 --> Jaeger
+ Unicorn -- UDP 6831 --> Jaeger
+ Gitaly -- UDP 6831 --> Jaeger
+ GitLabShell -- UDP 6831 --> Jaeger
+ GitLabWorkhorse -- UDP 6831 --> Jaeger
+ Alertmanager -- TCP 25 --> SMTP
+ Sidekiq -- TCP 25 --> SMTP
+ Unicorn -- TCP 25 --> SMTP
+ Unicorn -- TCP 369 --> LDAP
+ Sidekiq -- TCP 369 --> LDAP
+ Unicorn -- TCP 443 --> ObjectStorage["Object Storage"]
+ Sidekiq -- TCP 443 --> ObjectStorage
+ GitLabWorkhorse -- TCP 443 --> ObjectStorage
+ Registry -- TCP 443 --> ObjectStorage
+ Geo -- TCP 5432 --> PostgreSQL
```
-run: alertmanager: (pid 30829) 14207s; run: log: (pid 13906) 2432044s
-run: gitaly: (pid 30771) 14210s; run: log: (pid 13843) 2432046s
-run: gitlab-monitor: (pid 30788) 14209s; run: log: (pid 13868) 2432045s
-run: gitlab-workhorse: (pid 30758) 14210s; run: log: (pid 13855) 2432046s
-run: logrotate: (pid 30246) 3407s; run: log: (pid 13825) 2432047s
-run: nginx: (pid 30849) 14207s; run: log: (pid 13856) 2432046s
-run: node-exporter: (pid 30929) 14206s; run: log: (pid 13877) 2432045s
-run: postgres-exporter: (pid 30935) 14206s; run: log: (pid 13931) 2432044s
-run: postgresql: (pid 13133) 2432214s; run: log: (pid 13848) 2432046s
-run: prometheus: (pid 30807) 14209s; run: log: (pid 13884) 2432045s
-run: redis: (pid 30560) 14274s; run: log: (pid 13807) 2432047s
-run: redis-exporter: (pid 30946) 14205s; run: log: (pid 13869) 2432045s
-run: sidekiq: (pid 30953) 14205s; run: log: (pid 13810) 2432047s
-run: unicorn: (pid 30960) 14204s; run: log: (pid 13809) 2432047s
-```
-### Layers
+### Component legend
+
+* ✅ - Installed by default
+* ⚙ - Requires additional configuration, or GitLab Managed Apps
+* ⤓ - Manual installation required
+* ❌ - Not supported or no instructions available
+
+Component statuses are linked to configuration documentation for each component.
+
+### Component list
+
+| Component | Description | [Omnibus GitLab](https://docs.gitlab.com/omnibus/README.html) | [GitLab chart](https://docs.gitlab.com/charts/) | [Minikube Minimal](https://docs.gitlab.com/charts/development/minikube/#deploying-gitlab-with-minimal-settings) | [GitLab.com](https://gitlab.com) | CE/EE |
+| --------- | ----------- |:--------------------:|:------------------:|:-----:|:--------:|:--------:|
+| [NGINX](#nginx) | Routes requests to appropriate components, terminates SSL | [✅][nginx-omnibus] | [✅][nginx-charts] | [⚙][nginx-charts] | [✅](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/#service-architecture) | CE & EE |
+| [Unicorn (GitLab Rails)](#unicorn) | Handles requests for the web interface and API | [✅][unicorn-omnibus] | [✅][unicorn-charts] | [✅][unicorn-charts] | [✅](https://docs.gitlab.com/ee/user/gitlab_com/#unicorn) | CE & EE |
+| [Sidekiq](#sidekiq) | Background jobs processor | [✅][sidekiq-omnibus] | [✅][sidekiq-charts] | [✅](https://docs.gitlab.com/charts/charts/gitlab/sidekiq/index.html) | [✅](https://docs.gitlab.com/ee/user/gitlab_com/#sidekiq) | CE & EE |
+| [Gitaly](#gitaly) | Git RPC service for handling all git calls made by GitLab | [✅][gitaly-omnibus] | [✅][gitaly-charts] | [✅][gitaly-charts] | [✅](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/#service-architecture) | CE & EE |
+| [GitLab Workhorse](#gitlab-workhorse) | Smart reverse proxy, handles large HTTP requests | [✅][workhorse-omnibus] | [✅][workhorse-charts] | [✅][workhorse-charts] | [✅](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/#service-architecture) | CE & EE |
+| [GitLab Shell](#gitlab-shell) | Handles `git` over SSH sessions | [✅][shell-omnibus] | [✅][shell-charts] | [✅][shell-charts] | [✅](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/#service-architecture) | CE & EE |
+| [GitLab Pages](#gitlab-pages) | Hosts static websites | [⚙][pages-omnibus] | [❌][pages-charts] | [❌][pages-charts] | [✅](https://docs.gitlab.com/ee/user/gitlab_com/#gitlab-pages) | CE & EE |
+| [Registry](#registry) | Container registry, allows pushing and pulling of images | [⚙][registry-omnibus] | [✅][registry-charts] | [✅][registry-charts] | [✅](https://docs.gitlab.com/ee/user/project/container_registry.html#build-and-push-images) | CE & EE |
+| [Redis](#redis) | Caching service | [✅][redis-omnibus] | [✅][redis-omnibus] | [✅][redis-charts] | [✅](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/#service-architecture) | CE & EE |
+| [PostgreSQL](#postgresql) | Database | [✅][postgres-omnibus] | [✅][postgres-charts] | [✅][postgres-charts] | [✅](https://docs.gitlab.com/ee/user/gitlab_com/#postgresql) | CE & EE |
+| [PgBouncer](#pgbouncer) | Database connection pooling, failover | [⚙][pgbouncer-omnibus] | [❌][pgbouncer-charts] | [❌][pgbouncer-charts] | [✅](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/#database-architecture) | EE Only |
+| [Consul](#consul) | Database node discovery, failover | [⚙][consul-omnibus] | [❌][consul-charts] | [❌][consul-charts] | [✅](https://docs.gitlab.com/ee/user/gitlab_com/#consul) | EE Only |
+| [GitLab self-monitoring: Prometheus](#prometheus) | Time-series database, metrics collection, and query service | [✅][prometheus-omnibus] | [✅][prometheus-charts] | [⚙][prometheus-charts] | [✅](https://docs.gitlab.com/ee/user/gitlab_com/#prometheus) | CE & EE |
+| [GitLab self-monitoring: Alertmanager](#alertmanager) | Deduplicates, groups, and routes alerts from Prometheus | [✅][alertmanager-omnibus] | [✅][alertmanager-charts] | [⚙][alertmanager-charts] | [✅](https://about.gitlab.com/handbook/engineering/monitoring/) | CE & EE |
+| [GitLab self-monitoring: Grafana](#grafana) | Metrics dashboard | [⚙][grafana-omnibus] | [⤓][grafana-charts] | [⤓][grafana-charts] | [✅](https://dashboards.gitlab.com/d/RZmbBr7mk/gitlab-triage?refresh=30s) | CE & EE |
+| [GitLab self-monitoring: Sentry](#sentry) | Track errors generated by the GitLab instance | [⤓][sentry-omnibus] | [❌][sentry-charts] | [❌][sentry-charts] | [✅](https://about.gitlab.com/handbook/support/workflows/services/gitlab_com/500_errors.html#searching-sentry) | CE & EE |
+| [GitLab self-monitoring: Jaeger](#jaeger) | View traces generated by the GitLab instance | [❌][jaeger-omnibus] | [❌][jaeger-charts] | [❌][jaeger-charts] | [❌](https://gitlab.com/gitlab-org/omnibus-gitlab/issues/4104) | CE & EE |
+| [Redis Exporter](#redis-exporter) | Prometheus endpoint with Redis metrics | [✅][redis-exporter-omnibus] | [✅][redis-exporter-charts] | [✅][redis-exporter-charts] | [✅](https://about.gitlab.com/handbook/engineering/monitoring/) | CE & EE |
+| [Postgres Exporter](#postgres-exporter) | Prometheus endpoint with PostgreSQL metrics | [✅][postgres-exporter-omnibus] | [✅][postgres-exporter-charts] | [✅][postgres-exporter-charts] | [✅](https://about.gitlab.com/handbook/engineering/monitoring/) | CE & EE |
+| [PgBouncer Exporter](#pgbouncer-exporter) | Prometheus endpoint with PgBouncer metrics | [⚙][pgbouncer-exporter-omnibus] | [❌][pgbouncer-exporter-charts] | [❌][pgbouncer-exporter-charts] | [✅](https://about.gitlab.com/handbook/engineering/monitoring/) | CE & EE |
+| [GitLab Monitor](#gitlab-monitor) | Generates a variety of GitLab metrics | [✅][gitlab-monitor-omnibus] | [❌][gitab-monitor-charts] | [❌][gitab-monitor-charts] | [✅](https://about.gitlab.com/handbook/engineering/monitoring/) | CE & EE |
+| [Node Exporter](#node-exporter) | Prometheus endpoint with system metrics | [✅][node-exporter-omnibus] | [❌][node-exporter-charts] | [❌][node-exporter-charts] | [✅](https://about.gitlab.com/handbook/engineering/monitoring/) | CE & EE |
+| [Mattermost](#mattermost) | Open-source Slack alternative | [⚙][mattermost-omnibus] | [⤓][mattermost-charts] | [⤓][mattermost-charts] | [⤓](https://docs.gitlab.com/ee/user/project/integrations/mattermost_slash_commands.html#manual-configuration), [⤓](https://docs.gitlab.com/ee/user/project/integrations/mattermost.html) | CE & EE |
+| [Minio](#minio) | Object storage service | [⤓][minio-omnibus] | [✅][minio-charts] | [✅][minio-charts] | [✅](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/#storage-architecture) | CE & EE |
+| [Runner](#gitlab-runner) | Executes GitLab CI jobs | [⤓][runner-omnibus] | [✅][runner-charts] | [⚙][runner-charts] | [✅](https://docs.gitlab.com/ee/user/gitlab_com/#shared-runners) | CE & EE |
+| [Database Migrations](#database-migrations) | Database migrations | [✅][database-migrations-omnibus] | [✅]() | [✅][database-migrations-charts] | [✅][database-migrations-charts] | CE & EE |
+| [Certificate Management](#certificate-management) | TLS Settings, Let's Encrypt | [✅][certificate-management-omnibus] | [✅][certificate-management-charts] | [⚙][certificate-management-charts] | [✅](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/#secrets-management) | CE & EE |
+| [GitLab Geo Node](#gitlab-geo) | Geographically distributed GitLab nodes | [⚙][geo-omnibus] | [❌][geo-charts] | [❌][geo-charts] | ✅ | EE Only |
+| [LDAP Authentication](#ldap-authentication) | Authenticate users against centralized LDAP directory | [⤓][ldap-omnibus] | [⤓][ldap-charts] | [⤓][ldap-charts] | [❌](https://about.gitlab.com/pricing/#gitlab-com) | CE & EE |
+| [Outbound email (SMTP)](#outbound-email) | Send email messages to users | [⤓][outbound-email-omnibus] | [⤓][outbound-email-charts] | [⤓][outbound-email-charts] | [✅](https://docs.gitlab.com/ee/user/gitlab_com/#mail-configuration) | CE & EE |
+| [Inbound email (SMTP)](#inbound-email) | Receive messages to update issues | [⤓][inbound-email-omnibus] | [⤓][inbound-email-charts] | [⤓][inbound-email-charts] | [✅](https://docs.gitlab.com/ee/user/gitlab_com/#mail-configuration) | CE & EE |
+| [ElasticSearch](#elasticsearch) | Improved search within GitLab | [⤓][elasticsearch-omnibus] | [⤓][elasticsearch-charts] | [⤓][elasticsearch-charts] | [❌](https://gitlab.com/groups/gitlab-org/-/epics/153) | EE Only |
+| [Sentry integration](#sentry) | Error tracking for deployed apps | [⤓][sentry-integration] | [⤓][sentry-integration] | [⤓][sentry-integration] | [⤓][sentry-integration] | CE & EE |
+| [Jaeger integration](#jaeger) | Distributed tracing for deployed apps | [⤓][jaeger-integration] | [⤓][jaeger-integration] | [⤓][jaeger-integration] | [⤓][jaeger-integration] | EE Only |
+| [Kubernetes cluster apps](#kubernetes-cluster-apps) | Deploy [Helm](https://docs.helm.sh/), [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/), [Cert-Manager](https://docs.cert-manager.io/en/latest/), [Prometheus](https://prometheus.io/docs/introduction/overview/), a [Runner](https://docs.gitlab.com/runner/), [JupyterHub](http://jupyter.org/), [Knative](https://cloud.google.com/knative) to a cluster | [⤓][managed-k8s-apps] | [⤓][managed-k8s-apps] | [⤓][managed-k8s-apps] | [⤓][managed-k8s-apps] | CE & EE |
+
+### Component details
+
+This document is designed to be consumed by systems administrators and GitLab Support Engineers who want to understand more about the internals of GitLab and how they work together.
+
+When deployed, GitLab should be considered the amalgamation of the below processes. When troubleshooting or debugging, be as specific as possible as to which component you are referencing. That should increase clarity and reduce confusion.
+
+**Layers**
GitLab can be considered to have two layers from a process perspective:
@@ -46,129 +159,274 @@ GitLab can be considered to have two layers from a process perspective:
- **Processors**: These processes are responsible for actually performing operations and presenting the service.
- **Data**: These services store/expose structured data for the GitLab service.
-### alertmanager
+#### Alertmanager
-- Omnibus configuration options
+- [Project page](https://github.com/prometheus/alertmanager/blob/master/README.md)
+- Configuration: [Omnibus][alertmanager-omnibus], [Charts][alertmanager-charts]
- Layer: Monitoring
-[Alert manager](https://prometheus.io/docs/alerting/alertmanager/) is a tool provided by prometheus that _"handles alerts sent by client applications such as the Prometheus server. It takes care of deduplicating, grouping, and routing them to the correct receiver integration such as email, PagerDuty, or OpsGenie. It also takes care of silencing and inhibition of alerts."_ You can read more in [issue gitlab-ce#45740](https://gitlab.com/gitlab-org/gitlab-ce/issues/45740) about what we will be alerting on.
+[Alert manager](https://prometheus.io/docs/alerting/alertmanager/) is a tool provided by Prometheus that _"handles alerts sent by client applications such as the Prometheus server. It takes care of deduplicating, grouping, and routing them to the correct receiver integration such as email, PagerDuty, or OpsGenie. It also takes care of silencing and inhibition of alerts."_ You can read more in [issue gitlab-ce#45740](https://gitlab.com/gitlab-org/gitlab-ce/issues/45740) about what we will be alerting on.
+
+#### Certificate management
+
+- Project page: [Omnibus](https://github.com/certbot/certbot/blob/master/README.rst), [Charts](https://github.com/jetstack/cert-manager/blob/master/README.md)
+- Configuration: [Omnibus][certificate-management-omnibus], [Charts][certificate-management-charts]
+- Layer: Core Service (Processor)
+
+#### Consul
+
+- [Project page](https://github.com/hashicorp/consul/blob/master/README.md)
+- Configuration: [Omnibus][consul-omnibus], [Charts][consul-charts]
+- Layer: Core Service (Data)
+
+Consul is a tool for service discovery and configuration. Consul is distributed, highly available, and extremely scalable.
+
+#### Database migrations
+
+- Configuration: [Omnibus][registry-omnibus], [Charts][registry-charts]
+- Layer: Core Service (Data)
+
+#### Elasticsearch
+
+- [Project page](https://github.com/elastic/elasticsearch/blob/master/README.textile)
+- Configuration: [Omnibus][elasticsearch-omnibus], [Charts][elasticsearch-charts]
+- Layer: Core Service (Data)
+
+Elasticsearch is a distributed RESTful search engine built for the cloud.
-### gitaly
+#### Gitaly
-- [Omnibus configuration options](https://gitlab.com/gitlab-org/gitaly/tree/master/doc/configuration)
+- [Project page](https://gitlab.com/gitlab-org/gitaly/blob/master/README.md)
+- Configuration: [Omnibus][gitaly-omnibus], [Charts][gitaly-charts]
- Layer: Core Service (Data)
-Gitaly is a service designed by GitLab to remove our need for NFS for Git storage in distributed deployments of GitLab (Think GitLab.com or High Availability Deployments). As of 11.3.0, this service handles all Git level access in GitLab. You can read more about the project [in the project's readme](https://gitlab.com/gitlab-org/gitaly).
+Gitaly is a service designed by GitLab to remove our need for NFS for Git storage in distributed deployments of GitLab (think GitLab.com or High Availability Deployments). As of 11.3.0, this service handles all Git level access in GitLab. You can read more about the project [in the project's readme](https://gitlab.com/gitlab-org/gitaly).
+
+#### Gitlab Geo
+
+- Configuration: [Omnibus][geo-omnibus], [Charts][geo-charts]
+- Layer: Core Service (Processor)
-### gitlab-monitor
+#### Gitlab Monitor
-- Omnibus configuration options
+- [Project page](https://gitlab.com/gitlab-org/gitlab-monitor)
+- Configuration: [Omnibus][gitlab-monitor-omnibus], [Charts][gitlab-monitor-charts]
- Layer: Monitoring
-GitLab Monitor is a process designed in house that allows us to export metrics about GitLab application internals to prometheus. You can read more [in the project's readme](https://gitlab.com/gitlab-org/gitlab-monitor)
+GitLab Monitor is a process designed in house that allows us to export metrics about GitLab application internals to Prometheus. You can read more [in the project's readme](https://gitlab.com/gitlab-org/gitlab-monitor).
-### gitlab-workhorse
+#### Gitlab Pages
-- Omnibus configuration options
+- Configuration: [Omnibus][pages-omnibus], [Charts][pages-charts]
- Layer: Core Service (Processor)
-[GitLab Workhorse](https://gitlab.com/gitlab-org/gitlab-workhorse) is a program designed at GitLab to help alleviate pressure from unicorn. You can read more about the [historical reasons for developing](https://about.gitlab.com/2016/04/12/a-brief-history-of-gitlab-workhorse/). It's designed to act as a smart reverse proxy to help speed up GitLab as a whole.
+GitLab Pages is a feature that allows you to publish static websites directly from a repository in GitLab.
+
+You can use it either for personal or business websites, such as portfolios, documentation, manifestos, and business presentations. You can also attribute any license to your content.
+
+#### Gitlab Runner
+
+- [Project page](https://gitlab.com/gitlab-org/gitlab-runner/blob/master/README.md)
+- Configuration: [Omnibus][runner-omnibus], [Charts][runner-charts]
+- Layer: Core Service (Processor)
-### logrotate
+GitLab Runner runs tests and sends the results to GitLab.
+
+GitLab CI is the open-source continuous integration service included with GitLab that coordinates the testing. The old name of this project was GitLab CI Multi Runner but please use "GitLab Runner" (without CI) from now on.
+
+#### Gitlab Shell
+
+- [Project page](https://gitlab.com/gitlab-org/gitlab-shell/blob/master/README.md)
+- Configuration: [Omnibus][shell-omnibus], [Charts][shell-charts]
+- Layer: Core Service (Processor)
+
+[GitLab Shell](https://gitlab.com/gitlab-org/gitlab-shell) is a program designed at GitLab to handle ssh-based `git` sessions, and modifies the list of authorized keys. GitLab Shell is not a Unix shell nor a replacement for Bash or Zsh.
+
+#### Gitlab Workhorse
+
+- [Project page](https://gitlab.com/gitlab-org/gitlab-workhorse/blob/master/README.md)
+- Configuration: [Omnibus][gitlab-workhorse-omnibus], [Charts][gitlab-workhorse-charts]
+- Layer: Core Service (Processor)
-- [Omnibus configuration options](https://docs.gitlab.com/omnibus/settings/logs.html#logrotate)
+[GitLab Workhorse](https://gitlab.com/gitlab-org/gitlab-workhorse) is a program designed at GitLab to help alleviate pressure from Unicorn. You can read more about the [historical reasons for developing](https://about.gitlab.com/2016/04/12/a-brief-history-of-gitlab-workhorse/). It's designed to act as a smart reverse proxy to help speed up GitLab as a whole.
+
+#### Grafana
+
+- [Project page](https://github.com/grafana/grafana/blob/master/README.md)
+- Configuration: [Omnibus][grafana-omnibus], [Charts][grafana-charts]
+- Layer: Monitoring
+
+Grafana is an open source, feature rich metrics dashboard and graph editor for Graphite, Elasticsearch, OpenTSDB, Prometheus and InfluxDB.
+
+#### Jaeger
+
+- [Project page](https://github.com/jaegertracing/jaeger/blob/master/README.md)
+- Configuration: [Omnibus][jaeger-omnibus], [Charts][jaeger-charts]
+- Layer: Monitoring
+
+Jaeger, inspired by Dapper and OpenZipkin, is a distributed tracing system. It can be used for monitoring microservices-based distributed systems.
+
+#### Logrotate
+
+- [Project page](https://github.com/logrotate/logrotate/blob/master/README.md)
+- Configuration: [Omnibus](https://docs.gitlab.com/omnibus/settings/logs.html#logrotate)
- Layer: Core Service
-GitLab is comprised of a large number of services that all log. We started bundling our own logrotate as of 7.4 to make sure we were logging responsibly. This is just a packaged version of the common opensource offering.
+GitLab is comprised of a large number of services that all log. We started bundling our own logrotate as of 7.4 to make sure we were logging responsibly. This is just a packaged version of the common open source offering.
+
+#### Mattermost
+
+- [Project page](https://github.com/mattermost/mattermost-server/blob/master/README.md)
+- Configuration: [Omnibus][mattermost-omnibus], [Charts][mattermost-charts]
+- Layer: Core Service (Processor)
+
+Mattermost is an open source, private cloud, Slack-alternative from https://mattermost.com.
+
+#### MinIO
+
+- [Project page](https://github.com/minio/minio/blob/master/README.md)
+- Configuration: [Omnibus][minio-omnibus], [Charts][minio-charts]
+- Layer: Core Service (Data)
+
+MinIO is an object storage server released under Apache License v2.0. It is compatible with Amazon S3 cloud storage service. It is best suited for storing unstructured data such as photos, videos, log files, backups and container / VM images. Size of an object can range from a few KBs to a maximum of 5TB.
-### nginx
+#### NGINX
-- [Omnibus configuration options](https://docs.gitlab.com/omnibus/settings/nginx.html)
+- Project page: [Omnibus](https://github.com/nginx/nginx), [Charts](https://github.com/kubernetes/ingress-nginx/blob/master/README.md)
+- Configuration: [Omnibus][nginx-omnibus], [Charts][nginx-charts]
- Layer: Core Service (Processor)
Nginx as an ingress port for all HTTP requests and routes them to the approriate sub-systems within GitLab. We are bundling an unmodified version of the popular open source webserver.
-### node-exporter
+#### Node Exporter
-- [Omnibus configuration options](https://docs.gitlab.com/ee/administration/monitoring/prometheus/node_exporter.html)
+- [Project page](https://github.com/prometheus/node_exporter/blob/master/README.md)
+- Configuration: [Omnibus][node-exporter-omnibus], [Charts][node-exporter-charts]
- Layer: Monitoring
-[Node Exporter](https://github.com/prometheus/node_exporter) is a Prometheus tool that gives us metrics on the underlying machine. (Think CPU/Disk/Load) It's just a packaged version of the common open source offering from the Prometheus project.
+[Node Exporter](https://github.com/prometheus/node_exporter) is a Prometheus tool that gives us metrics on the underlying machine (think CPU/Disk/Load). It's just a packaged version of the common open source offering from the Prometheus project.
+
+#### PgBouncer
+
+- [Project page](https://github.com/pgbouncer/pgbouncer/blob/master/README.md)
+- Configuration: [Omnibus][pgbouncer-omnibus], [Charts][pgbouncer-charts]
+- Layer: Core Service (Data)
-### postgres-exporter
+Lightweight connection pooler for PostgreSQL.
-- [Omnibus configuration options](https://docs.gitlab.com/ee/administration/monitoring/prometheus/postgres_exporter.html)
+#### PgBouncer Exporter
+
+- [Project page](https://github.com/stanhu/pgbouncer_exporter/blob/master/README.md)
+- Configuration: [Omnibus][pgbouncer-exporter-omnibus], [Charts][pgbouncer-exporter-charts]
- Layer: Monitoring
-[Postgres-exporter](https://github.com/wrouesnel/postgres_exporter) is the community provided Prometheus exporter that will deliver data about Postgres to prometheus for use in Grafana Dashboards.
+Prometheus exporter for PgBouncer. Exports metrics at 9127/metrics.
-### postgresql
+#### Postgresql
-- [Omnibus configuration options](https://docs.gitlab.com/omnibus/settings/database.html)
+- [Project page](https://github.com/postgres/postgres/blob/master/README)
+- Configuration: [Omnibus][postgres-omnibus], [Charts][postgres-charts]
- Layer: Core Service (Data)
GitLab packages the popular Database to provide storage for Application meta data and user information.
-### prometheus
+#### Postgres Exporter
-- [Omnibus configuration options](https://docs.gitlab.com/ee/administration/monitoring/prometheus/)
+- [Project page](https://github.com/wrouesnel/postgres_exporter/blob/master/README.md)
+- Configuration: [Omnibus][postgres-exporter-omnibus], [Charts][postgres-exporter-charts]
+- Layer: Monitoring
+
+[Postgres-exporter](https://github.com/wrouesnel/postgres_exporter) is the community provided Prometheus exporter that will deliver data about Postgres to Prometheus for use in Grafana Dashboards.
+
+#### Prometheus
+
+- [Project page](https://github.com/prometheus/prometheus/blob/master/README.md)
+- Configuration: [Omnibus][prometheus-omnibus], [Charts][prometheus-charts]
- Layer: Monitoring
Prometheus is a time-series tool that helps GitLab administrators expose metrics about the individual processes used to provide GitLab the service.
-### redis
+#### Redis
-- [Omnibus configuration options](https://docs.gitlab.com/omnibus/settings/redis.html)
+- [Project page](https://github.com/antirez/redis/blob/unstable/README.md)
+- Configuration: [Omnibus][redis-omnibus], [Charts][redis-charts]
- Layer: Core Service (Data)
Redis is packaged to provide a place to store:
- session data
- temporary cache information
-- background job queues.
+- background job queues
-### redis-exporter
+#### Redis Exporter
-- [Omnibus configuration options](https://docs.gitlab.com/ee/administration/monitoring/prometheus/redis_exporter.html)
+- [Project page](https://github.com/oliver006/redis_exporter/blob/master/README.md)
+- Configuration: [Omnibus][redis-exporter-omnibus], [Charts][redis-exporter-charts]
- Layer: Monitoring
-[Redis Exporter](https://github.com/oliver006/redis_exporter) is designed to give specific metrics about the Redis process to Prometheus so that we can graph these metrics in Graphana.
+[Redis Exporter](https://github.com/oliver006/redis_exporter) is designed to give specific metrics about the Redis process to Prometheus so that we can graph these metrics in Grafana.
-### sidekiq
+#### Registry
-- Omnibus configuration options
+- [Project page](https://github.com/docker/distribution/blob/master/README.md)
+- Configuration: [Omnibus][registry-omnibus], [Charts][registry-charts]
+- Layer: Core Service (Processor)
+
+The registry is what users use to store their own Docker images. The bundled
+registry uses nginx as a load balancer and GitLab as an authentication manager.
+Whenever a client requests to pull or push an image from the registry, it will
+return a `401` response along with a header detailing where to get an
+authentication token, in this case the GitLab instance. The client will then
+request a pull or push auth token from GitLab and retry the original request
+to the registry. Learn more about [token authentication](https://docs.docker.com/registry/spec/auth/token/).
+
+An external registry can also be configured to use GitLab as an auth endpoint.
+
+#### Sentry
+
+- [Project page](https://github.com/getsentry/sentry/blob/master/README.rst)
+- Configuration: [Omnibus][sentry-omnibus], [Charts][sentry-charts]
+- Layer: Monitoring
+
+Sentry fundamentally is a service that helps you monitor and fix crashes in realtime. The server is in Python, but it contains a full API for sending events from any language, in any application.
+
+#### Sidekiq
+
+- [Project page](https://github.com/mperham/sidekiq/blob/master/README.md)
+- Configuration: [Omnibus][sidekiq-omnibus], [Charts][sidekiq-charts]
- Layer: Core Service (Processor)
Sidekiq is a Ruby background job processor that pulls jobs from the redis queue and processes them. Background jobs allow GitLab to provide a faster request/response cycle by moving work into the background.
-### unicorn
+#### Unicorn
-- [Omnibus configuration options](https://docs.gitlab.com/omnibus/settings/unicorn.html)
+- [Project page](https://gitlab.com/gitlab-org/gitlab-ee/blob/master/README.md)
+- Configuration: [Omnibus][unicorn-omnibus], [Charts][unicorn-charts]
- Layer: Core Service (Processor)
[Unicorn](https://bogomips.org/unicorn/) is a Ruby application server that is used to run the core Rails Application that provides the user facing features in GitLab. Often process output you will see this as `bundle` or `config.ru` depending on the GitLab version.
-### Additional Processes
+#### LDAP Authentication
-### GitLab Pages
+- Configuration: [Omnibus][ldap-omnibus], [Charts][ldap-charts]
+- Layer: Core Service (Processor)
-TODO
+#### Outbound Email
-### Mattermost
+- Configuration: [Omnibus][outbound-email-omnibus], [Charts][outbound-email-charts]
+- Layer: Core Service (Processor)
-TODO
+#### Inbound Email
-### Registry
+- Configuration: [Omnibus][inbound-email-omnibus], [Charts][inbound-email-charts]
+- Layer: Core Service (Processor)
-The registry is what users use to store their own Docker images. The bundled
-registry uses nginx as a load balancer and GitLab as an authentication manager.
-Whenever a client requests to pull or push an image from the registry, it will
-return a `401` response along with a header detailing where to get an
-authentication token, in this case the GitLab instance. The client will then
-request a pull or push auth token from GitLab and retry the original request
-to the registry. Learn more about [token authentication](https://docs.docker.com/registry/spec/auth/token/).
+#### Kubernetes Cluster Apps
-An external registry can also be configured to use GitLab as an auth endpoint.
+- Configuration: [Omnibus][managed-k8s-apps], [Charts][managed-k8s-apps]
+- Layer: Core Service (Processor)
+
+GitLab provides [GitLab Managed Apps](https://docs.gitlab.com/ee/user/project/clusters/#installing-applications), a one-click install for various applications which can be added directly to your configured cluster. These applications are needed for Review Apps and deployments when using Auto DevOps. You can install them after you create a cluster.
## GitLab by Request Type
@@ -181,10 +439,10 @@ It's important to understand the distinction as some processes are used in both
### GitLab Web HTTP Request Cycle
-When making a request to an HTTP Endpoint (Think `/users/sign_in`) the request will take the following path through the GitLab Service:
+When making a request to an HTTP Endpoint (think `/users/sign_in`) the request will take the following path through the GitLab Service:
-- nginx - Acts as our first line reverse proxy
-- gitlab-workhorse - This determines if it needs to go to the Rails application or somewhere else to reduce load on unicorn.
+- nginx - Acts as our first line reverse proxy.
+- gitlab-workhorse - This determines if it needs to go to the Rails application or somewhere else to reduce load on Unicorn.
- unicorn - Since this is a web request, and it needs to access the application it will go to Unicorn.
- Postgres/Gitaly/Redis - Depending on the type of request, it may hit these services to store or retrieve data.
@@ -200,7 +458,7 @@ TODO
## System Layout
-When referring to `~git` in the pictures it means the home directory of the git user which is typically /home/git.
+When referring to `~git` in the pictures it means the home directory of the git user which is typically `/home/git`.
GitLab is primarily installed within the `/home/git` user home directory as `git` user. Within the home directory is where the gitlabhq server software resides as well as the repositories (though the repository location is configurable).
@@ -208,136 +466,6 @@ The bare repositories are located in `/home/git/repositories`. GitLab is a ruby
To serve repositories over SSH there's an add-on application called gitlab-shell which is installed in `/home/git/gitlab-shell`.
-### Components
-
-```mermaid
-graph TB
-
- HTTP[HTTP/HTTPS] -- TCP 80, 443 --> NGINX[NGINX]
- SSH -- TCP 22 --> GitLabShell[GitLab Shell]
- SMTP[SMTP Gateway]
- Geo[GitLab Geo Node] -- TCP 22, 80, 443 --> NGINX
-
- GitLabShell --TCP 8080 -->Unicorn["Unicorn (GitLab Rails)"]
- GitLabShell --> Gitaly
- GitLabShell --> Redis
- Unicorn --> PgBouncer[PgBouncer]
- Unicorn --> Redis
- Unicorn --> Gitaly
- Redis --> Sidekiq
- Sidekiq["Sidekiq (GitLab Rails, ES Indexer)"] --> PgBouncer
- GitLabWorkhorse[GitLab Workhorse] --> Unicorn
- GitLabWorkhorse --> Redis
- GitLabWorkhorse --> Gitaly
- Gitaly --> Redis
- NGINX --> GitLabWorkhorse
- NGINX -- TCP 8090 --> GitLabPages[GitLab Pages]
- NGINX --> Grafana[Grafana]
- Grafana -- TCP 9090 --> Prometheus[Prometheus]
- Prometheus -- TCP 80, 443 --> Unicorn
- RedisExporter[Redis Exporter] --> Redis
- Prometheus -- TCP 9121 --> RedisExporter
- PostgreSQLExporter[PostgreSQL Exporter] --> PostgreSQL
- PgBouncerExporter[PgBouncer Exporter] --> PgBouncer
- Prometheus -- TCP 9187 --> PostgreSQLExporter
- Prometheus -- TCP 9100 --> NodeExporter[Node Exporter]
- Prometheus -- TCP 9168 --> GitLabMonito[GitLab Monitor]
- Prometheus -- TCP 9127 --> PgBouncerExporter
- GitLabMonitor --> PostgreSQL
- GitLabMonitor --> GitLabShell
- GitLabMonitor --> Sidekiq
- PgBouncer --> Consul
- PostgreSQL --> Consul
- PgBouncer --> PostgreSQL
- NGINX --> Registry
- Unicorn --> Registry
- NGINX --> Mattermost
- Mattermost --- Unicorn
- Prometheus --> Alertmanager
- Migrations --> PostgreSQL
- Runner -- TCP 443 --> NGINX
- Unicorn -- TCP 9200 --> ElasticSearch
- Sidekiq -- TCP 9200 --> ElasticSearch
- Sidekiq -- TCP 80, 443 --> Sentry
- Unicorn -- TCP 80, 443 --> Sentry
- Sidekiq -- UDP 6831 --> Jaeger
- Unicorn -- UDP 6831 --> Jaeger
- Gitaly -- UDP 6831 --> Jaeger
- GitLabShell -- UDP 6831 --> Jaeger
- GitLabWorkhorse -- UDP 6831 --> Jaeger
- Alertmanager -- TCP 25 --> SMTP
- Sidekiq -- TCP 25 --> SMTP
- Unicorn -- TCP 25 --> SMTP
- Unicorn -- TCP 369 --> LDAP
- Sidekiq -- TCP 369 --> LDAP
- Unicorn -- TCP 443 --> ObjectStorage["Object Storage"]
- Sidekiq -- TCP 443 --> ObjectStorage
- GitLabWorkhorse -- TCP 443 --> ObjectStorage
- Registry -- TCP 443 --> ObjectStorage
- Geo -- TCP 5432 --> PostgreSQL
-
-```
-
----
-
-**Legend**:
-
-* ✅ - Automatically configured
-* ⚙ - Requires additional configuration
-* ⤓ - Additional software/service required
-* ❌ - Not available
-
-| Component | Description | [Omnibus GitLab](https://docs.gitlab.com/omnibus/README.html) | [GitLab chart](https://docs.gitlab.com/charts/) | [Minikube Minimal](https://docs.gitlab.com/charts/development/minikube/#deploying-gitlab-with-minimal-settings) | [GitLab.com](https://gitlab.com) | CE/EE |
-| --------- | ----------- |:--------------------:|:------------------:|:-----:|:--------:|:--------:|
-| NGINX | Routes requests to appropriate components, terminates SSL | [✅](https://docs.gitlab.com/omnibus/settings/nginx.html) | [✅](https://docs.gitlab.com/charts/charts/nginx/index.html) | [⚙](https://docs.gitlab.com/charts/charts/nginx/index.html) | [✅](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/#service-architecture) | CE & EE |
-| Unicorn (GitLab Rails) | Handles requests for the web interface and API | [✅](https://docs.gitlab.com/omnibus/settings/unicorn.html) | [✅](https://docs.gitlab.com/charts/charts/gitlab/unicorn/index.html) | [✅](https://docs.gitlab.com/charts/charts/gitlab/unicorn/index.html) | [✅](https://docs.gitlab.com/ee/user/gitlab_com/#unicorn) | CE & EE |
-| Sidekiq | Background jobs processor | [✅](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template) | [✅](https://docs.gitlab.com/charts/charts/gitlab/sidekiq/index.html) | [✅](https://docs.gitlab.com/charts/charts/gitlab/sidekiq/index.html) | [✅](https://docs.gitlab.com/ee/user/gitlab_com/#sidekiq) | CE & EE |
-| Gitaly | Git RPC service for handling all git calls made by GitLab | [✅](https://docs.gitlab.com/ee/administration/gitaly/) | [✅](https://docs.gitlab.com/charts/charts/gitlab/gitaly/index.html) | [✅](https://docs.gitlab.com/charts/charts/gitlab/gitaly/index.html) | [✅](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/#service-architecture) | CE & EE |
-| GitLab Workhorse | Smart reverse proxy, handles large HTTP requests | [✅](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template) | [✅](https://docs.gitlab.com/charts/charts/gitlab/unicorn/index.html) | [✅](https://docs.gitlab.com/charts/charts/gitlab/unicorn/index.html) | [✅](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/#service-architecture) | CE & EE |
-| GitLab Shell | Handles `git` over SSH sessions | [✅](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template) | [✅](https://docs.gitlab.com/charts/charts/gitlab/gitlab-shell/index.html) | [✅](https://docs.gitlab.com/charts/charts/gitlab/gitlab-shell/index.html) | [✅](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/#service-architecture) | CE & EE |
-| GitLab Pages | Hosts static websites | [⚙](https://docs.gitlab.com/ee/administration/pages/) | [❌](https://gitlab.com/charts/gitlab/issues/37) | [❌](https://gitlab.com/charts/gitlab/issues/37) | [✅](https://docs.gitlab.com/ee/user/gitlab_com/#gitlab-pages) | CE & EE |
-| Registry | Container registry, allows pushing and pulling of images | [⚙](https://docs.gitlab.com/ee/administration/container_registry.html#container-registry-domain-configuration) | [✅](https://docs.gitlab.com/charts/charts/registry/index.html) | [✅](https://docs.gitlab.com/charts/charts/registry/index.html) | [✅](https://docs.gitlab.com/ee/user/project/container_registry.html#build-and-push-images) | CE & EE |
-| Redis | Caching service | [✅](https://docs.gitlab.com/omnibus/settings/redis.html) | [✅](https://docs.gitlab.com/charts/charts/redis/index.html) | [✅](https://docs.gitlab.com/charts/charts/redis/index.html) | [✅](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/#service-architecture) | CE & EE |
-| PostgreSQL | Database | [✅](https://docs.gitlab.com/omnibus/settings/database.html) | [✅](https://github.com/helm/charts/tree/master/stable/postgresql) | [✅](https://github.com/helm/charts/tree/master/stable/postgresql) | [✅](https://docs.gitlab.com/ee/user/gitlab_com/#postgresql) | CE & EE |
-| PgBouncer | Database connection pooling, failover | [⚙](https://docs.gitlab.com/ee/administration/high_availability/pgbouncer.html) | [❌](https://docs.gitlab.com/charts/installation/deployment.html#postgresql) | [❌](https://docs.gitlab.com/charts/installation/deployment.html#postgresql) | [✅](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/#database-architecture) | EE Only |
-| Consul | Database node discovery, failover | [⚙](https://docs.gitlab.com/ee/administration/high_availability/consul.html) | [❌](https://docs.gitlab.com/charts/installation/deployment.html#postgresql) | [❌](https://docs.gitlab.com/charts/installation/deployment.html#postgresql) | [✅](https://docs.gitlab.com/ee/user/gitlab_com/#consul) | EE Only |
-| Prometheus | Time-series database, metrics collection, and query service | [✅](https://docs.gitlab.com/ee/administration/monitoring/prometheus/) | [✅](https://github.com/helm/charts/tree/master/stable/prometheus) | [⚙](https://github.com/helm/charts/tree/master/stable/prometheus) | [✅](https://docs.gitlab.com/ee/user/gitlab_com/#prometheus) | CE & EE |
-| Prometheus Alertmanager | Deduplicates, groups, and routes alerts from Prometheus | [✅](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template) | [✅](https://github.com/helm/charts/tree/master/stable/prometheus) | [✅](https://github.com/helm/charts/tree/master/stable/prometheus) | [✅](https://about.gitlab.com/handbook/engineering/monitoring/) | CE & EE |
-| Grafana | Metrics dashboard | [⚙](https://docs.gitlab.com/ee/administration/monitoring/performance/grafana_configuration.html) | [⤓](https://github.com/helm/charts/tree/master/stable/grafana) | [⤓](https://github.com/helm/charts/tree/master/stable/grafana) | [✅](https://dashboards.gitlab.com/d/RZmbBr7mk/gitlab-triage?refresh=30s) | CE & EE |
-| Redis Exporter | Prometheus endpoint with Redis metrics | [✅](https://docs.gitlab.com/ee/administration/monitoring/prometheus/redis_exporter.html) | [✅](https://docs.gitlab.com/charts/charts/redis/index.html) | [✅](https://docs.gitlab.com/charts/charts/redis/index.html) | [✅](https://about.gitlab.com/handbook/engineering/monitoring/) | CE & EE |
-| PostgreSQL Exporter | Prometheus endpoint with PostgreSQL metrics | [✅](https://docs.gitlab.com/ee/administration/monitoring/prometheus/postgres_exporter.html) | [✅](https://github.com/helm/charts/tree/master/stable/postgresql) | [✅](https://github.com/helm/charts/tree/master/stable/postgresql) | [✅](https://about.gitlab.com/handbook/engineering/monitoring/) | CE & EE |
-| PgBouncer Exporter | Prometheus endpoint with PgBouncer metrics | [⚙](https://docs.gitlab.com/ee/administration/monitoring/prometheus/pgbouncer_exporter.html) | [❌](https://docs.gitlab.com/charts/installation/deployment.html#postgresql) | [❌](https://docs.gitlab.com/charts/installation/deployment.html#postgresql) | [✅](https://about.gitlab.com/handbook/engineering/monitoring/) | CE & EE |
-| GitLab Monitor | Generates a variety of GitLab metrics | [✅](https://docs.gitlab.com/ee/administration/monitoring/prometheus/gitlab_monitor_exporter.html) | [❌](https://gitlab.com/charts/gitlab/issues/319) | [❌](https://gitlab.com/charts/gitlab/issues/319) | [✅](https://about.gitlab.com/handbook/engineering/monitoring/) | CE & EE |
-| Mattermost | Open-source Slack alternative | [⚙](https://docs.gitlab.com/omnibus/gitlab-mattermost/) | [⤓](https://docs.mattermost.com/install/install-mmte-helm-gitlab-helm.html) | [⤓](https://docs.mattermost.com/install/install-mmte-helm-gitlab-helm.html) | [⤓](https://docs.gitlab.com/ee/user/project/integrations/mattermost_slash_commands.html#manual-configuration), [⤓](https://docs.gitlab.com/ee/user/project/integrations/mattermost.html) | CE & EE |
-| Minio | Object storage service | [⤓](https://min.io/download) | [✅](https://docs.gitlab.com/charts/charts/minio/index.html) | [✅](https://docs.gitlab.com/charts/charts/minio/index.html) | [✅](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/#storage-architecture) | CE & EE |
-| Runner | Executes GitLab CI jobs | [⤓](https://docs.gitlab.com/runner/) | [✅](https://docs.gitlab.com/runner/) | [⚙](https://docs.gitlab.com/runner/) | [✅](https://docs.gitlab.com/ee/user/gitlab_com/#shared-runners) | CE & EE |
-| DB Migrations | Database migrations | [✅](https://docs.gitlab.com/omnibus/settings/database.html#disabling-automatic-database-migration) | [✅](https://docs.gitlab.com/charts/charts/gitlab/migrations/index.html) | [✅](https://docs.gitlab.com/charts/charts/gitlab/migrations/index.html) | [✅](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/#database-architecture) | CE & EE |
-| Certificate Management | TLS Settings, Let's Encrypt | [✅](https://docs.gitlab.com/omnibus/settings/ssl.html) | [✅](https://docs.gitlab.com/charts/installation/tls.html) | [⚙](https://docs.gitlab.com/charts/installation/tls.html) | [✅](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/#secrets-management) | CE & EE |
-| GitLab Geo Node | Geographically distributed GitLab nodes | [⚙](https://docs.gitlab.com/ee/administration/geo/replication/index.html#setup-instructions) | [❌](https://gitlab.com/charts/gitlab/issues/8) | [❌](https://gitlab.com/charts/gitlab/issues/8) | ✅ | EE Only |
-| LDAP Authentication | Authenticate users against centralized LDAP directory | [⤓](https://docs.gitlab.com/ee/administration/auth/ldap.html) | [⤓](https://docs.gitlab.com/charts/charts/globals.html#ldap) | [⤓](https://docs.gitlab.com/charts/charts/globals.html#ldap) | [❌](https://about.gitlab.com/pricing/#gitlab-com) | CE & EE |
-| Outbound email (SMTP) | Send email messages to users | [⤓](https://docs.gitlab.com/omnibus/settings/smtp.html) | [⤓](https://docs.gitlab.com/charts/installation/command-line-options.html#outgoing-email-configuration) | [⤓](https://docs.gitlab.com/charts/installation/command-line-options.html#outgoing-email-configuration) | [✅](https://docs.gitlab.com/ee/user/gitlab_com/#mail-configuration) | CE & EE |
-| Inbound email (SMTP) | Receive messages to update issues | [⤓](https://docs.gitlab.com/ee/administration/incoming_email.html) | [⤓](https://docs.gitlab.com/charts/installation/command-line-options.html#incoming-email-configuration) | [⤓](https://docs.gitlab.com/charts/installation/command-line-options.html#incoming-email-configuration) | [✅](https://docs.gitlab.com/ee/user/gitlab_com/#mail-configuration) | CE & EE |
-| ElasticSearch | Improved search within GitLab | [⤓](https://docs.gitlab.com/ee/integration/elasticsearch.html) | [⤓](https://docs.gitlab.com/ee/integration/elasticsearch.html) | [⤓](https://docs.gitlab.com/ee/integration/elasticsearch.html) | [❌](https://gitlab.com/groups/gitlab-org/-/epics/153) | EE Only |
-| Sentry: GitLab instance | Track errors generated by the GitLab instance | [⤓](https://docs.gitlab.com/omnibus/settings/configuration.html#error-reporting-and-logging-with-sentry) | [❌](https://gitlab.com/charts/gitlab/issues/1319) | [❌](https://gitlab.com/charts/gitlab/issues/1319) | [✅](https://about.gitlab.com/handbook/support/workflows/services/gitlab_com/500_errors.html#searching-sentry) | CE & EE |
-| Jaeger: GitLab instance | View traces generated by the GitLab instance | [❌](https://gitlab.com/gitlab-org/omnibus-gitlab/issues/4104) | [❌](https://gitlab.com/charts/gitlab/issues/1320) | [❌](https://gitlab.com/charts/gitlab/issues/1320) | [❌](https://gitlab.com/gitlab-org/omnibus-gitlab/issues/4104) | CE & EE |
-| Sentry: deployed apps | Error tracking for deployed apps | [⤓](https://docs.gitlab.com/ee/user/project/operations/error_tracking.html) | [⤓](https://docs.gitlab.com/ee/user/project/operations/error_tracking.html) | [⤓](https://docs.gitlab.com/ee/user/project/operations/error_tracking.html) | [⤓](https://docs.gitlab.com/ee/user/project/operations/error_tracking.html) | CE & EE |
-| Jaeger: deployed apps | Distributed tracing for deployed apps | [⤓](https://docs.gitlab.com/ee/user/project/operations/tracing.html) | [⤓](https://docs.gitlab.com/ee/user/project/operations/tracing.html) | [⤓](https://docs.gitlab.com/ee/user/project/operations/tracing.html) | [⤓](https://docs.gitlab.com/ee/user/project/operations/tracing.html) | EE Only |
-| Kubernetes cluster apps | Deploy [Helm](https://docs.helm.sh/), [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/), [Cert-Manager](https://docs.cert-manager.io/en/latest/), [Prometheus](https://prometheus.io/docs/introduction/overview/), a [Runner](https://docs.gitlab.com/runner/), [JupyterHub](http://jupyter.org/), [Knative](https://cloud.google.com/knative) to a cluster | [✅](https://docs.gitlab.com/ee/user/project/clusters/#installing-applications) | [✅](https://docs.gitlab.com/ee/user/project/clusters/#installing-applications) | [✅](https://docs.gitlab.com/ee/user/project/clusters/#installing-applications) | [✅](https://docs.gitlab.com/ee/user/project/clusters/#installing-applications) | CE & EE |
-
-A typical install of GitLab will be on GNU/Linux. It uses Nginx or Apache as a web front end to proxypass the Unicorn web server. By default, communication between Unicorn and the front end is via a Unix domain socket but forwarding requests via TCP is also supported. The web front end accesses `/home/git/gitlab/public` bypassing the Unicorn server to serve static pages, uploads (e.g. avatar images or attachments), and precompiled assets. GitLab serves web pages and a [GitLab API](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/api) using the Unicorn web server. It uses Sidekiq as a job queue which, in turn, uses redis as a non-persistent database backend for job information, meta data, and incoming jobs.
-
-We also support deploying GitLab on Kubernetes using our [gitlab Helm chart](https://docs.gitlab.com/charts/).
-
-The GitLab web app uses MySQL or PostgreSQL for persistent database information (e.g. users, permissions, issues, other meta data). GitLab stores the bare git repositories it serves in `/home/git/repositories` by default. It also keeps default branch and hook information with the bare repository.
-
-When serving repositories over HTTP/HTTPS GitLab utilizes the GitLab API to resolve authorization and access as well as serving git objects.
-
-The add-on component gitlab-shell serves repositories over SSH. It manages the SSH keys within `/home/git/.ssh/authorized_keys` which should not be manually edited. gitlab-shell accesses the bare repositories through Gitaly to serve git objects and communicates with redis to submit jobs to Sidekiq for GitLab to process. gitlab-shell queries the GitLab API to determine authorization and access.
-
-Gitaly executes git operations from gitlab-shell and the GitLab web app, and provides an API to the GitLab web app to get attributes from git (e.g. title, branches, tags, other meta data), and to get blobs (e.g. diffs, commits, files).
-
-You may also be interested in the [production architecture of GitLab.com](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/).
-
### Installation Folder Summary
To summarize here's the [directory structure of the `git` user home directory](../install/structure.md).
@@ -464,3 +592,71 @@ Note: It is recommended to log into the `git` user using `sudo -i -u git` or `su
## GitLab.com
We've also detailed [our architecture of GitLab.com](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/) but this is probably over the top unless you have millions of users.
+
+[alertmanager-omnibus]: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template
+[alertmanager-charts]: https://github.com/helm/charts/tree/master/stable/prometheus
+[nginx-omnibus]: https://docs.gitlab.com/omnibus/settings/nginx.html
+[nginx-charts]: https://docs.gitlab.com/charts/charts/nginx/index.html
+[unicorn-omnibus]: https://docs.gitlab.com/omnibus/settings/unicorn.html
+[unicorn-charts]: https://docs.gitlab.com/charts/charts/gitlab/unicorn/index.html
+[sidekiq-omnibus]: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template
+[sidekiq-charts]: https://docs.gitlab.com/charts/charts/gitlab/sidekiq/index.html
+[gitaly-omnibus]: https://docs.gitlab.com/ee/administration/gitaly/
+[gitaly-charts]: https://docs.gitlab.com/charts/charts/gitlab/gitaly/index.html
+[workhorse-omnibus]: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template
+[workhorse-charts]: https://docs.gitlab.com/charts/charts/gitlab/unicorn/index.html
+[shell-omnibus]: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template
+[shell-charts]: https://docs.gitlab.com/charts/charts/gitlab/gitlab-shell/index.html
+[pages-omnibus]: https://docs.gitlab.com/ee/administration/pages/
+[pages-charts]: https://gitlab.com/charts/gitlab/issues/37
+[registry-omnibus]: https://docs.gitlab.com/ee/administration/container_registry.html#container-registry-domain-configuration
+[registry-charts]: https://docs.gitlab.com/charts/charts/registry/index.html
+[redis-omnibus]: https://docs.gitlab.com/omnibus/settings/redis.html
+[redis-charts]: https://docs.gitlab.com/charts/charts/redis/index.html
+[postgres-omnibus]: https://docs.gitlab.com/omnibus/settings/database.html
+[postgres-charts]: https://github.com/helm/charts/tree/master/stable/postgresql
+[pgbouncer-omnibus]: https://docs.gitlab.com/ee/administration/high_availability/pgbouncer.html
+[pgbouncer-charts]: https://docs.gitlab.com/charts/installation/deployment.html#postgresql
+[consul-omnibus]: https://docs.gitlab.com/ee/administration/high_availability/consul.html
+[consul-charts]: https://docs.gitlab.com/charts/installation/deployment.html#postgresql
+[prometheus-omnibus]: https://docs.gitlab.com/ee/administration/monitoring/prometheus/
+[prometheus-charts]: https://github.com/helm/charts/tree/master/stable/prometheus
+[grafana-omnibus]: https://docs.gitlab.com/ee/administration/monitoring/performance/grafana_configuration.html
+[grafana-charts]: https://github.com/helm/charts/tree/master/stable/grafana
+[sentry-omnibus]: https://docs.gitlab.com/omnibus/settings/configuration.html#error-reporting-and-logging-with-sentry
+[sentry-charts]: https://gitlab.com/charts/gitlab/issues/1319
+[jaeger-omnibus]: https://gitlab.com/gitlab-org/omnibus-gitlab/issues/4104
+[jaeger-charts]: https://gitlab.com/charts/gitlab/issues/1320
+[redis-exporter-omnibus]: https://docs.gitlab.com/ee/administration/monitoring/prometheus/redis_exporter.html
+[redis-exporter-charts]: https://docs.gitlab.com/charts/charts/redis/index.html
+[postgres-exporter-omnibus]: https://docs.gitlab.com/ee/administration/monitoring/prometheus/postgres_exporter.html
+[postgres-exporter-charts]: https://github.com/helm/charts/tree/master/stable/postgresql
+[pgbouncer-exporter-omnibus]: https://docs.gitlab.com/ee/administration/monitoring/prometheus/pgbouncer_exporter.html
+[pgbouncer-exporter-charts]: https://docs.gitlab.com/charts/installation/deployment.html#postgresql
+[gitlab-monitor-omnibus]: https://docs.gitlab.com/ee/administration/monitoring/prometheus/gitlab_monitor_exporter.html
+[gitab-monitor-charts]: https://gitlab.com/charts/gitlab/issues/319
+[node-exporter-omnibus]: https://docs.gitlab.com/ee/administration/monitoring/prometheus/node_exporter.html
+[node-exporter-charts]: https://gitlab.com/charts/gitlab/issues/1332
+[mattermost-omnibus]: https://docs.gitlab.com/omnibus/gitlab-mattermost/
+[mattermost-charts]: https://docs.mattermost.com/install/install-mmte-helm-gitlab-helm.html
+[minio-omnibus]: https://min.io/download
+[minio-charts]: https://docs.gitlab.com/charts/charts/minio/index.html
+[runner-omnibus]: https://docs.gitlab.com/runner/
+[runner-charts]: https://docs.gitlab.com/runner/install/kubernetes.html
+[database-migrations-omnibus]: https://docs.gitlab.com/omnibus/settings/database.html#disabling-automatic-database-migration
+[database-migrations-charts]: https://docs.gitlab.com/charts/charts/gitlab/migrations/index.html
+[certificate-management-omnibus]: https://docs.gitlab.com/omnibus/settings/ssl.html
+[certificate-management-charts]: https://docs.gitlab.com/charts/installation/tls.html
+[geo-omnibus]: https://docs.gitlab.com/ee/administration/geo/replication/index.html#setup-instructions
+[geo-charts]: https://gitlab.com/charts/gitlab/issues/8
+[ldap-omnibus]: https://docs.gitlab.com/ee/administration/auth/ldap.html
+[ldap-charts]: https://docs.gitlab.com/charts/charts/globals.html#ldap
+[outbound-email-omnibus]: https://docs.gitlab.com/omnibus/settings/smtp.html
+[outbound-email-charts]: https://docs.gitlab.com/charts/installation/command-line-options.html#outgoing-email-configuration
+[inbound-email-omnibus]: https://docs.gitlab.com/ee/administration/incoming_email.html
+[inbound-email-charts]: https://docs.gitlab.com/charts/installation/command-line-options.html#incoming-email-configuration
+[elasticsearch-omnibus]: https://docs.gitlab.com/ee/integration/elasticsearch.html
+[elasticsearch-charts]: https://docs.gitlab.com/ee/integration/elasticsearch.html
+[sentry-integration]: https://docs.gitlab.com/ee/user/project/operations/error_tracking.html
+[jaeger-integration]: https://docs.gitlab.com/ee/user/project/operations/tracing.html
+[managed-k8s-apps]: https://docs.gitlab.com/ee/user/project/clusters/#installing-applications
diff --git a/doc/development/changelog.md b/doc/development/changelog.md
index 273a7fceaf5..45b3d5a23a1 100644
--- a/doc/development/changelog.md
+++ b/doc/development/changelog.md
@@ -35,6 +35,7 @@ the `author` field. GitLab team members **should not**.
- Any user-facing change **should** have a changelog entry. Example: "GitLab now
uses system fonts for all text."
+- Any change behind a feature flag **should not** have a changelog entry. The entry should be added [in the merge request removing the feature flags](https://docs.gitlab.com/ee/development/feature_flags.html#developing-with-feature-flags).
- A fix for a regression introduced and then fixed in the same release (i.e.,
fixing a bug introduced during a monthly release candidate) **should not**
have a changelog entry.
diff --git a/doc/development/contributing/issue_workflow.md b/doc/development/contributing/issue_workflow.md
index 0e1ab8663ed..e3a1dc711fd 100644
--- a/doc/development/contributing/issue_workflow.md
+++ b/doc/development/contributing/issue_workflow.md
@@ -7,7 +7,7 @@ scheduling into milestones. Labelling is a task for everyone.
Most issues will have labels for at least one of the following:
- Type: ~feature, ~bug, ~customer, etc.
-- Subject: ~wiki, ~"container registry", ~ldap, ~api, ~frontend, etc.
+- Subject: ~wiki, ~"Container Registry", ~ldap, ~api, ~frontend, etc.
- Team: ~Plan, ~Manage, ~Quality, etc.
- Stage: ~"devops:plan", ~"devops:create", etc.
- Release Scoping: ~Deliverable, ~Stretch, ~"Next Patch Release"
@@ -44,7 +44,7 @@ Subject labels are labels that define what area or feature of GitLab this issue
hits. They are not always necessary, but very convenient.
Examples of subject labels are ~wiki, ~ldap, ~api,
-~issues, ~"merge requests", ~labels, and ~"container registry".
+~issues, ~"merge requests", ~labels, and ~"Container Registry".
If you are an expert in a particular area, it makes it easier to find issues to
work on. You can also subscribe to those labels to receive an email each time an
@@ -92,20 +92,21 @@ Stage labels specify which [DevOps stage][devops-stages] the issue belongs to.
The current stage labels are:
-- ~"devops:manage"
-- ~"devops:plan"
-- ~"devops:create"
-- ~"devops:verify"
-- ~"devops:package"
-- ~"devops:release"
-- ~"devops:configure"
-- ~"devops:monitor"
-- ~"devops:secure"
-- ~"devops:defend"
-- ~"devops:enablement"
-
-These labels should be mutually exclusive. If an issue belongs to multiple
-stages, the most relevant should be used.
+- ~"devops::manage"
+- ~"devops::plan"
+- ~"devops::create"
+- ~"devops::verify"
+- ~"devops::package"
+- ~"devops::release"
+- ~"devops::configure"
+- ~"devops::monitor"
+- ~"devops::secure"
+- ~"devops::defend"
+- ~"devops::growth"
+- ~"devops::enablement"
+
+These labels are [scoped labels](../../user/project/labels.md#scoped-labels-premium)
+and thus are mutually exclusive.
They differ from the [Team labels](#team-labels) because teams may work on
issues outside their stage.
@@ -121,6 +122,25 @@ The Stage labels are used to generate the [direction pages][direction-pages] aut
[devops-stages]: https://about.gitlab.com/direction/#devops-stages
[direction-pages]: https://about.gitlab.com/direction/
+## Group labels
+
+Group labels specify which [groups][structure-groups] the issue belongs to.
+
+Examples include:
+
+- ~"group::control"
+- ~"group::editor"
+
+These labels are [scoped labels](../../user/project/labels.md#scoped-labels-premium)
+and thus are mutually exclusive.
+
+Groups are nested beneath a particular stage, so only one stage label and one group label
+can be applied to a single issue. You can find the groups listed in the
+[Product Categories pages][product-categories].
+
+[structure-groups]: https://about.gitlab.com/company/team/structure/#groups
+[product-categories]: https://about.gitlab.com/handbook/product/categories/
+
## Release Scoping labels
Release Scoping labels help us clearly communicate expectations of the work for the
diff --git a/doc/development/documentation/index.md b/doc/development/documentation/index.md
index 52a4bb27817..4bf8401c0e8 100644
--- a/doc/development/documentation/index.md
+++ b/doc/development/documentation/index.md
@@ -52,6 +52,57 @@ Adhere to the [Documentation Style Guide](styleguide.md). If a style standard is
See the [Structure](styleguide.md#structure) section of the [Documentation Style Guide](styleguide.md).
+## Single codebase
+
+We currently maintain two sets of docs: one in the
+[gitlab-ce](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc) repo and
+one in [gitlab-ee](https://gitlab.com/gitlab-org/gitlab-ee/tree/master/doc).
+They are similar, and most pages are identical, but they are different repositories.
+With the single codebase effort, we want to make those two sets identical, so when the
+time comes to have only one codebase, we'll be ready.
+
+Here are some links to get you up to speed with the current effort:
+
+- [CE/EE codebases blueprint](https://about.gitlab.com/handbook/engineering/infrastructure/blueprint/ce-ee-codebases/)
+- [CE/EE codebases merge design](https://about.gitlab.com/handbook/engineering/infrastructure/design/merge-ce-ee-codebases/)
+- [Single docs codebase epic](https://gitlab.com/groups/gitlab-org/-/epics/199)
+- [Issue board of related issues](https://gitlab.com/groups/gitlab-org/-/boards/981090?&label_name[]=Documentation&label_name[]=single%20codebase)
+- [Related merge requests](https://gitlab.com/groups/gitlab-org/-/merge_requests?scope=all&utf8=%E2%9C%93&state=all&label_name[]=Documentation&label_name[]=single%20codebase)
+- [Visualize the existing diffs](https://leipert-projects.gitlab.io/is-gitlab-pretty-yet/diff/?search=%5Edoc)
+
+### CE first
+
+After a given documentation path is aligned across CE and EE, all merge requests
+affecting that path must be submitted to CE, regardless of the content it has.
+This means that for EE-only features which are being added only to the EE codebase,
+you have to submit a separate merge request in CE that contains the docs.
+This might seem like a duplicate effort, but it's for the short term.
+A list of the already aligned docs can be found in
+[the epic description](https://gitlab.com/groups/gitlab-org/-/epics/199#ee-specific-lines-check).
+
+Since the docs will be combined, it's crucial to add the relevant
+[product badges](styleguide.md#product-badges) for all EE documentation, so that
+we can discern which features belong to which tier.
+
+### EE specific lines check
+
+There's a special test in place
+([`ee_specific_check.rb`](https://gitlab.com/gitlab-org/gitlab-ee/blob/master/scripts/ee_specific_check/ee_specific_check.rb)),
+which, among others, checks and prevents creating/editing new files and directories
+in EE under `doc/`.
+
+We have a long list of documentation paths that are either whitelisted or not.
+Paths in the whitelist (not commented out) will not be subject to the test,
+which means you are allowed to create/change docs content in EE for the time
+being. The goal is to not have any doc whitelisted.
+
+At the time of this writing, the only items left to be aligned are the API docs:
+
+- `doc/api/*` ([issue](https://gitlab.com/gitlab-org/gitlab-ce/issues/60045) / [merge request](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/27491))
+
+Eventually, once all docs are aligned, we'll remove any doc reference from that
+script, so it catches everything.
+
## Changing document location
Changing a document's location requires specific steps to be followed to ensure that
@@ -438,6 +489,10 @@ Currently, the following tests are in place:
As CE is merged into EE once a day, it's important to avoid merge conflicts.
Submitting an EE-equivalent merge request cherry-picking all commits from CE to EE is
essential to avoid them.
+1. [`ee-files-location-check`/`ee-specific-lines-check`](#ee-specific-lines-check) (runs on EE only):
+ This test ensures that no new files/directories are created/changed in EE.
+ All docs should be submitted in CE instead, regardless the tier they are on.
+ This is for the [single codebase](#single-codebase) effort.
1. In a full pipeline, tests for [`/help`](#gitlab-help-tests).
### Linting
diff --git a/doc/development/ee_features.md b/doc/development/ee_features.md
index 9853b38b8e9..bc472bb5b0a 100644
--- a/doc/development/ee_features.md
+++ b/doc/development/ee_features.md
@@ -446,6 +446,28 @@ The disadvantage of this:
port `render_if_exists` to CE.
- If we have typos in the partial name, it would be silently ignored.
+
+##### Caveats
+
+The `render_if_exists` view path argument must be relative to `app/views/` and `ee/app/views`.
+Resolving an EE template path that is relative to the CE view path will not work.
+
+```haml
+- # app/views/projects/index.html.haml
+
+= render_if_exists 'button' # Will not render `ee/app/views/projects/_button` and will quietly fail
+= render_if_exists 'projects/button' # Will render `ee/app/views/projects/_button`
+```
+
+You should not explicitly set render options like `partial` or provide a `locals` hash.
+The first argument should be a path string and the second can be a hash replacing `locals`.
+
+```ruby
+render partial: 'projects/button', locals: { project: project }
+# becomes
+render_if_exists 'projects/button', project: project
+```
+
#### Using `render_ce`
For `render` and `render_if_exists`, they search for the EE partial first,
@@ -888,7 +910,7 @@ information on managing page-specific javascript within EE.
### script tag
#### Child Component only used in EE
-To seperate Vue template differences we should [async import the components](https://vuejs.org/v2/guide/components-dynamic-async.html#Async-Components).
+To separate Vue template differences we should [async import the components](https://vuejs.org/v2/guide/components-dynamic-async.html#Async-Components).
Doing this allows for us to load the correct component in EE whilst in CE
we can load a empty component that renders nothing. This code **should**
diff --git a/doc/development/fe_guide/vuex.md b/doc/development/fe_guide/vuex.md
index 7d52cac5f7e..bf248b7f8af 100644
--- a/doc/development/fe_guide/vuex.md
+++ b/doc/development/fe_guide/vuex.md
@@ -186,7 +186,7 @@ Remember that actions only describe that something happened, they don't describe
state.users.push(user);
},
[types.REQUEST_ADD_USER_ERROR](state, error) {
- state.isAddingUser = true;
+ state.isAddingUser = false;
state.errorAddingUser = error;
},
};
@@ -231,7 +231,7 @@ The store should be included in the main component of your application:
```javascript
// app.vue
- import store from 'store'; // it will include the index.js file
+ import store from './store'; // it will include the index.js file
export default {
name: 'application',
diff --git a/doc/development/feature_flags.md b/doc/development/feature_flags.md
index 3271f9a7fb3..82b09cc0224 100644
--- a/doc/development/feature_flags.md
+++ b/doc/development/feature_flags.md
@@ -108,11 +108,11 @@ so we make sure behavior under feature flag doesn't go untested in some non-spec
contexts.
Whenever a feature flag is present, make sure to test _both_ states of the
-feature flag. You can stub a feature flag as follows:
+feature flag.
-```ruby
-stub_feature_flags(my_feature_flag: false)
-```
+See the
+[testing guide](testing_guide/best_practices.html#feature-flags-in-tests)
+for information and examples on how to stub feature flags in tests.
## Enabling a feature flag (in development)
diff --git a/doc/development/gitlab_architecture_diagram.png b/doc/development/gitlab_architecture_diagram.png
deleted file mode 100644
index 90e27d5462a..00000000000
--- a/doc/development/gitlab_architecture_diagram.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/go_guide/index.md b/doc/development/go_guide/index.md
index b9dc3797e5b..cf78b792ffd 100644
--- a/doc/development/go_guide/index.md
+++ b/doc/development/go_guide/index.md
@@ -40,7 +40,7 @@ of possible security breaches in our code:
- SQL injections
Remember to run
-[SAST](https://docs.gitlab.com/ee/user/project/merge_requests/sast.html)
+[SAST](https://docs.gitlab.com/ee/user/application_security/sast/index)
**[ULTIMATE]** on your project (or at least the [gosec
analyzer](https://gitlab.com/gitlab-org/security-products/analyzers/gosec)),
and to follow our [Security
@@ -96,7 +96,7 @@ dependency should be argued in the merge request, as per our [Approval
Guidelines](../code_review.md#approval-guidelines). Both [License
Management](https://docs.gitlab.com/ee/user/project/merge_requests/license_management.html)
**[ULTIMATE]** and [Dependency
-Scanning](https://docs.gitlab.com/ee/user/project/merge_requests/dependency_scanning.html)
+Scanning](https://docs.gitlab.com/ee/user/application_security/dependency_scanning/index)
**[ULTIMATE]** should be activated on all projects to ensure new dependencies
security status and license compatibility.
diff --git a/doc/development/i18n/externalization.md b/doc/development/i18n/externalization.md
index 38d56322de8..38425674567 100644
--- a/doc/development/i18n/externalization.md
+++ b/doc/development/i18n/externalization.md
@@ -195,6 +195,7 @@ For example use `%{created_at}` in Ruby but `%{createdAt}` in JavaScript.
Sometimes you need to add some context to the text that you want to translate
(if the word occurs in a sentence and/or the word is ambiguous).
+Namespaces should be PascalCase.
- In Ruby/HAML:
diff --git a/doc/development/i18n/proofreader.md b/doc/development/i18n/proofreader.md
index ac04a21b37a..eb492c9818b 100644
--- a/doc/development/i18n/proofreader.md
+++ b/doc/development/i18n/proofreader.md
@@ -56,8 +56,8 @@ are very appreciative of the work done by translators and proofreaders!
- Italian
- Paolo Falomo - [GitLab](https://gitlab.com/paolofalomo), [Crowdin](https://crowdin.com/profile/paolo.falomo)
- Japanese
- - Yamana Tokiuji - [GitLab](https://gitlab.com/tokiuji), [Crowdin](https://crowdin.com/profile/yamana)
- Hiroyuki Sato - [GitLab](https://gitlab.com/hiroponz), [Crowdin](https://crowdin.com/profile/hiroponz)
+ - Tomo Dote - [Gitlab](https://gitlab.com/fu7mu4), [Crowdin](https://crowdin.com/profile/fu7mu4)
- Korean
- Chang-Ho Cha - [GitLab](https://gitlab.com/changho-cha), [Crowdin](https://crowdin.com/profile/zzazang)
- Ji Hun Oh - [GitLab](https://gitlab.com/Baw-Appie), [Crowdin](https://crowdin.com/profile/BawAppie)
@@ -71,6 +71,7 @@ are very appreciative of the work done by translators and proofreaders!
- Maksymilian Roman - [GitLab](https://gitlab.com/villaincandle), [Crowdin](https://crowdin.com/profile/villaincandle)
- Portuguese
- Proofreaders needed.
+ - Diogo Trindade - [GitLab](https://gitlab.com/luisdiogo2071317), [Crowdin](https://crowdin.com/profile/ldiogotrindade)
- Portuguese, Brazilian
- Paulo George Gomes Bezerra - [GitLab](https://gitlab.com/paulobezerra), [Crowdin](https://crowdin.com/profile/paulogomes.rep)
- André Gama - [GitLab](https://gitlab.com/andregamma), [Crowdin](https://crowdin.com/profile/ToeOficial)
diff --git a/doc/development/migration_style_guide.md b/doc/development/migration_style_guide.md
index 0c326eeb851..9b26f691b55 100644
--- a/doc/development/migration_style_guide.md
+++ b/doc/development/migration_style_guide.md
@@ -186,7 +186,11 @@ end
When adding a foreign-key constraint to either an existing or new
column remember to also add a index on the column.
-This is _required_ for all foreign-keys.
+This is **required** for all foreign-keys, e.g., to support efficient cascading
+deleting: when a lot of rows in a table get deleted, the referenced records need
+to be deleted too. The database has to look for corresponding records in the
+referenced table. Without an index, this will result in a sequential scan on the
+table which can take a long time.
Here's an example where we add a new column with a foreign key
constraint. Note it includes `index: true` to create an index for it.
diff --git a/doc/development/rolling_out_changes_using_feature_flags.md b/doc/development/rolling_out_changes_using_feature_flags.md
index 8d35a4ecee2..8e4e07c4319 100644
--- a/doc/development/rolling_out_changes_using_feature_flags.md
+++ b/doc/development/rolling_out_changes_using_feature_flags.md
@@ -65,15 +65,14 @@ the worst case scenario, which we should optimise for, our total cost is now 20.
If we had used a feature flag, things would have been very different. We don't
need to revert a release, and because feature flags are disabled by default we
don't need to revert and pick any Git commits. In fact, all we have to do is
-disable the feature, and _maybe_ perform some cleanup. Let's say that the cost
-of this is 1. In this case, our best case cost is 11: 10 to build the feature,
-and 1 to add the feature flag. The worst case cost is now 12: 10 to build the
-feature, 1 to add the feature flag, and 1 to disable it.
+disable the feature, and in the worst case, perform cleanup. Let's say that
+the cost of this is 2. In this case, our best case cost is 11: 10 to build the
+feature, and 1 to add the feature flag. The worst case cost is now 13: 10 to
+build the feature, 1 to add the feature flag, and 2 to disable and clean up.
Here we can see that in the best case scenario the work necessary is only a tiny
bit more compared to not using a feature flag. Meanwhile, the process of
-reverting our changes has been made significantly cheaper, to the point of being
-trivial.
+reverting our changes has been made significantly and reliably cheaper.
In other words, feature flags do not slow down the development process. Instead,
they speed up the process as managing incidents now becomes _much_ easier. Once
diff --git a/doc/development/session.md b/doc/development/session.md
new file mode 100644
index 00000000000..9edce3dbda0
--- /dev/null
+++ b/doc/development/session.md
@@ -0,0 +1,65 @@
+# Accessing session data
+
+Session data in GitLab is stored in Redis and can be accessed in a variety of ways.
+
+During a web request, for example:
+
+- Rails provides access to the session from within controllers through [`ActionDispatch::Session`](https://guides.rubyonrails.org/action_controller_overview.html#session).
+- Outside of controllers, it is possible to access the session through `Gitlab::Session`.
+
+Outside of a web request it is still possible to access sessions stored in Redis. For example:
+
+- Session IDs and contents can be [looked up directly in Redis](#redis).
+- Data about the UserAgent associated with the session can be accessed through `ActiveSession`.
+
+When storing values in a session it is best to:
+
+- Use simple primitives and avoid storing objects to avoid marshaling complications.
+- Clean up after unneeded variables to keep memory usage in Redis down.
+
+## Gitlab::Session
+
+Sometimes you might want to persist data in the session instead of another store like the database. `Gitlab::Session` lets you access this without passing the session around extensively. For example, you could access it from within a policy without having to pass the session through to each place permissions are checked from.
+
+The session has a hash-like interface, just like when using it from a controller. There is also `NamespacedSessionStore` for storing key-value data in a hash.
+
+```ruby
+# Lookup a value stored in the current session
+Gitlab::Session.current[:my_feature]
+
+# Modify the current session stored in redis
+Gitlab::Session.current[:my_feature] = value
+
+# Store key-value data namespaced under a key
+Gitlab::NamespacedSessionStore.new(:my_feature)[some_key] = value
+
+# Set the session for a block of code, such as for tests
+Gitlab::Session.with_session(my_feature: value) do
+ # Code that uses Session.current[:my_feature]
+end
+```
+
+## Redis
+
+Session data can be accessed directly through Redis. This can let you check up on a browser session when debugging.
+
+```ruby
+# Get a list of sessions
+session_ids = Gitlab::Redis::SharedState.with do |redis|
+ redis.smembers("#{Gitlab::Redis::SharedState::USER_SESSIONS_LOOKUP_NAMESPACE}:#{user.id}")
+end
+
+# Retrieve a specific session
+session_data = Gitlab::Redis::SharedState.with { |redis| redis.get("#{Gitlab::Redis::SharedState::SESSION_NAMESPACE}:#{session_id}") }
+Marshal.load(session_data)
+```
+
+## Getting device information with ActiveSession
+
+The [**Active Sessions** page on a user's profile](../user/profile/active_sessions.md) displays information about the device used to access each session. The methods used there to list sessions can also be useful for development.
+
+```ruby
+# Get list of sessions for a given user
+# Includes session_id and data from the UserAgent
+ActiveSession.list(user)
+```
diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md
index e41148360f2..63ec9755462 100644
--- a/doc/development/testing_guide/best_practices.md
+++ b/doc/development/testing_guide/best_practices.md
@@ -240,6 +240,36 @@ it 'is overdue' do
end
```
+### Feature flags in tests
+
+All feature flags are stubbed to be enabled by default in our Ruby-based
+tests.
+
+To disable a feature flag in a test, use the `stub_feature_flags`
+helper. For example, to globally disable the `ci_live_trace` feature
+flag in a test:
+
+```ruby
+stub_feature_flags(ci_live_trace: false)
+
+Feature.enabled?(:ci_live_trace) # => false
+```
+
+If you wish to set up a test where a feature flag is disabled for some
+actors and not others, you can specify this in options passed to the
+helper. For example, to disable the `ci_live_trace` feature flag for a
+specifc project:
+
+```ruby
+project1, project2 = build_list(:project, 2)
+
+# Feature will only be disabled for project1
+stub_feature_flags(ci_live_trace: { enabled: false, thing: project1 })
+
+Feature.enabled?(:ci_live_trace, project1) # => false
+Feature.enabled?(:ci_live_trace, project2) # => true
+```
+
### Pristine test environments
The code exercised by a single GitLab test may access and modify many items of
diff --git a/doc/development/testing_guide/frontend_testing.md b/doc/development/testing_guide/frontend_testing.md
index 9bd99e80357..58d6f08954d 100644
--- a/doc/development/testing_guide/frontend_testing.md
+++ b/doc/development/testing_guide/frontend_testing.md
@@ -15,10 +15,8 @@ information on general testing practices at GitLab.
## Jest
-GitLab has started to migrate tests to the [Jest](https://jestjs.io)
-testing framework. You can read a [detailed evaluation](https://gitlab.com/gitlab-org/gitlab-ce/issues/49171)
-of Jest compared to our use of Karma and Jasmine. In summary, it will allow us
-to improve the performance and consistency of our frontend tests.
+We have started to migrate frontend tests to the [Jest](https://jestjs.io) testing framework (see also the corresponding
+[epic](https://gitlab.com/groups/gitlab-org/-/epics/895)).
Jest tests can be found in `/spec/frontend` and `/ee/spec/frontend` in EE.
@@ -26,6 +24,17 @@ It is not yet a requirement to use Jest. You can view the
[epic](https://gitlab.com/groups/gitlab-org/-/epics/873) of issues
we need to solve before being able to use Jest for all our needs.
+### Differences to Karma
+
+- Jest runs in a Node.js environment, not in a browser. Support for running Jest tests in a browser [is planned](https://gitlab.com/gitlab-org/gitlab-ce/issues/58205).
+- Because Jest runs in a Node.js environment, it uses [jsdom](https://github.com/jsdom/jsdom) by default.
+- All calls to `setTimeout` and `setInterval` are mocked away. See also [Jest Timer Mocks](https://jestjs.io/docs/en/timer-mocks).
+- `rewire` is not required because Jest supports mocking modules. See also [Manual Mocks](https://jestjs.io/docs/en/manual-mocks).
+- The following will cause tests to fail in Jest:
+ - Unmocked requests.
+ - Unhandled Promise rejections.
+ - Calls to `console.warn`, including warnings from libraries like Vue.
+
### Debugging Jest tests
Running `yarn jest-debug` will run Jest in debug mode, allowing you to debug/inspect as described in the [Jest docs](https://jestjs.io/docs/en/troubleshooting#tests-are-failing-and-you-don-t-know-why).
diff --git a/doc/development/testing_guide/review_apps.md b/doc/development/testing_guide/review_apps.md
index 7ad33f05f77..f34793c11f4 100644
--- a/doc/development/testing_guide/review_apps.md
+++ b/doc/development/testing_guide/review_apps.md
@@ -78,17 +78,27 @@ subgraph CNG-mirror pipeline
**Additional notes:**
-- The Kubernetes cluster is connected to the `gitlab-{ce,ee}` projects using
- [GitLab's Kubernetes integration][gitlab-k8s-integration]. This basically
- allows to have a link to the Review App directly from the merge request
- widget.
-- If the Review App deployment fails, you can simply retry it (there's no need
- to run the [`review-stop`][gitlab-ci-yml] job first).
+- If the `review-deploy` job keep failing (note that we already retry it twice),
+ please post a message in the `#quality` channel and/or create a ~Quality ~bug
+ issue with a link to your merge request. Note that the deployment failure can
+ reveal an actual problem introduced in your merge request (i.e. this isn't
+ necessarily a transient failure)!
+- If the `review-qa-smoke` job keep failing (note that we already retry it twice),
+ please check the job's logs: you could discover an actual problem introduced in
+ your merge request. You can also download the artifacts to see screenshots of
+ the page at the time the failures occurred. If you don't find the cause of the
+ failure or if it seems unrelated to your change, please post a message in the
+ `#quality` channel and/or create a ~Quality ~bug issue with a link to your
+ merge request.
- The manual [`review-stop`][gitlab-ci-yml] in the `test` stage can be used to
stop a Review App manually, and is also started by GitLab once a merge
request's branch is deleted after being merged.
- Review Apps are cleaned up regularly via a pipeline schedule that runs
the [`schedule:review-cleanup`][gitlab-ci-yml] job.
+- The Kubernetes cluster is connected to the `gitlab-{ce,ee}` projects using
+ [GitLab's Kubernetes integration][gitlab-k8s-integration]. This basically
+ allows to have a link to the Review App directly from the merge request
+ widget.
## QA runs
diff --git a/doc/development/ux_guide/img/animation-autoscroll.gif b/doc/development/ux_guide/img/animation-autoscroll.gif
deleted file mode 100644
index 155b0234c64..00000000000
--- a/doc/development/ux_guide/img/animation-autoscroll.gif
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/animation-dropdown.gif b/doc/development/ux_guide/img/animation-dropdown.gif
deleted file mode 100644
index c9b31d26165..00000000000
--- a/doc/development/ux_guide/img/animation-dropdown.gif
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/animation-hover.gif b/doc/development/ux_guide/img/animation-hover.gif
deleted file mode 100644
index 37ad9c76828..00000000000
--- a/doc/development/ux_guide/img/animation-hover.gif
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/animation-quickupdate.gif b/doc/development/ux_guide/img/animation-quickupdate.gif
deleted file mode 100644
index 8db70bc3d24..00000000000
--- a/doc/development/ux_guide/img/animation-quickupdate.gif
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/animation-reorder.gif b/doc/development/ux_guide/img/animation-reorder.gif
deleted file mode 100644
index ccdeb3d396f..00000000000
--- a/doc/development/ux_guide/img/animation-reorder.gif
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-close--active.png b/doc/development/ux_guide/img/button-close--active.png
deleted file mode 100644
index 97a5301fb91..00000000000
--- a/doc/development/ux_guide/img/button-close--active.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-close--hover.png b/doc/development/ux_guide/img/button-close--hover.png
deleted file mode 100644
index 6b8fdf5695b..00000000000
--- a/doc/development/ux_guide/img/button-close--hover.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-close--resting.png b/doc/development/ux_guide/img/button-close--resting.png
deleted file mode 100644
index 5679b51687c..00000000000
--- a/doc/development/ux_guide/img/button-close--resting.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-danger--active.png b/doc/development/ux_guide/img/button-danger--active.png
deleted file mode 100644
index 6a9aab0fcc2..00000000000
--- a/doc/development/ux_guide/img/button-danger--active.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-danger--hover.png b/doc/development/ux_guide/img/button-danger--hover.png
deleted file mode 100644
index 13e21c28779..00000000000
--- a/doc/development/ux_guide/img/button-danger--hover.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-danger--resting.png b/doc/development/ux_guide/img/button-danger--resting.png
deleted file mode 100644
index 0ff192bc463..00000000000
--- a/doc/development/ux_guide/img/button-danger--resting.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-info--active.png b/doc/development/ux_guide/img/button-info--active.png
deleted file mode 100644
index 12ecdc72a31..00000000000
--- a/doc/development/ux_guide/img/button-info--active.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-info--hover.png b/doc/development/ux_guide/img/button-info--hover.png
deleted file mode 100644
index 3bf93bf2b32..00000000000
--- a/doc/development/ux_guide/img/button-info--hover.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-info--resting.png b/doc/development/ux_guide/img/button-info--resting.png
deleted file mode 100644
index a37a37033bf..00000000000
--- a/doc/development/ux_guide/img/button-info--resting.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-primary.png b/doc/development/ux_guide/img/button-primary.png
deleted file mode 100644
index eda5ed84aec..00000000000
--- a/doc/development/ux_guide/img/button-primary.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-secondary.png b/doc/development/ux_guide/img/button-secondary.png
deleted file mode 100644
index 26d4e8cf43d..00000000000
--- a/doc/development/ux_guide/img/button-secondary.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-spam--active.png b/doc/development/ux_guide/img/button-spam--active.png
deleted file mode 100644
index a9e115f49c1..00000000000
--- a/doc/development/ux_guide/img/button-spam--active.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-spam--hover.png b/doc/development/ux_guide/img/button-spam--hover.png
deleted file mode 100644
index 3b2c16430a6..00000000000
--- a/doc/development/ux_guide/img/button-spam--hover.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-spam--resting.png b/doc/development/ux_guide/img/button-spam--resting.png
deleted file mode 100644
index 4f9f18ca68a..00000000000
--- a/doc/development/ux_guide/img/button-spam--resting.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-success--active.png b/doc/development/ux_guide/img/button-success--active.png
deleted file mode 100644
index b99f6f5e70e..00000000000
--- a/doc/development/ux_guide/img/button-success--active.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-success--hover.png b/doc/development/ux_guide/img/button-success--hover.png
deleted file mode 100644
index 0d0a61c679a..00000000000
--- a/doc/development/ux_guide/img/button-success--hover.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-success--resting.png b/doc/development/ux_guide/img/button-success--resting.png
deleted file mode 100644
index 53b955c650a..00000000000
--- a/doc/development/ux_guide/img/button-success--resting.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-success-secondary--active.png b/doc/development/ux_guide/img/button-success-secondary--active.png
deleted file mode 100644
index 333a91f2217..00000000000
--- a/doc/development/ux_guide/img/button-success-secondary--active.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-success-secondary--hover.png b/doc/development/ux_guide/img/button-success-secondary--hover.png
deleted file mode 100644
index 0cce59212e3..00000000000
--- a/doc/development/ux_guide/img/button-success-secondary--hover.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-success-secondary--resting.png b/doc/development/ux_guide/img/button-success-secondary--resting.png
deleted file mode 100644
index 2779a4949f8..00000000000
--- a/doc/development/ux_guide/img/button-success-secondary--resting.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-warning--active.png b/doc/development/ux_guide/img/button-warning--active.png
deleted file mode 100644
index f5760cd7c12..00000000000
--- a/doc/development/ux_guide/img/button-warning--active.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-warning--hover.png b/doc/development/ux_guide/img/button-warning--hover.png
deleted file mode 100644
index a1f4c5cbcc6..00000000000
--- a/doc/development/ux_guide/img/button-warning--hover.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/button-warning--resting.png b/doc/development/ux_guide/img/button-warning--resting.png
deleted file mode 100644
index 3d62fed5930..00000000000
--- a/doc/development/ux_guide/img/button-warning--resting.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/color-blue.png b/doc/development/ux_guide/img/color-blue.png
deleted file mode 100644
index 77c1a2cab31..00000000000
--- a/doc/development/ux_guide/img/color-blue.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/color-green.png b/doc/development/ux_guide/img/color-green.png
deleted file mode 100644
index 51600584c96..00000000000
--- a/doc/development/ux_guide/img/color-green.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/color-grey.png b/doc/development/ux_guide/img/color-grey.png
deleted file mode 100644
index f0f0b9d80bb..00000000000
--- a/doc/development/ux_guide/img/color-grey.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/color-orange.png b/doc/development/ux_guide/img/color-orange.png
deleted file mode 100644
index f16435c0a64..00000000000
--- a/doc/development/ux_guide/img/color-orange.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/color-red.png b/doc/development/ux_guide/img/color-red.png
deleted file mode 100644
index 5008e75da78..00000000000
--- a/doc/development/ux_guide/img/color-red.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/color-textprimary.png b/doc/development/ux_guide/img/color-textprimary.png
deleted file mode 100644
index 90f2821f0cf..00000000000
--- a/doc/development/ux_guide/img/color-textprimary.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/color-textsecondary.png b/doc/development/ux_guide/img/color-textsecondary.png
deleted file mode 100644
index 61cb8a13c45..00000000000
--- a/doc/development/ux_guide/img/color-textsecondary.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-alerts.png b/doc/development/ux_guide/img/components-alerts.png
deleted file mode 100644
index 66a43ac69e1..00000000000
--- a/doc/development/ux_guide/img/components-alerts.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-anchorlinks.png b/doc/development/ux_guide/img/components-anchorlinks.png
deleted file mode 100644
index bd8d30f5905..00000000000
--- a/doc/development/ux_guide/img/components-anchorlinks.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-contentblock.png b/doc/development/ux_guide/img/components-contentblock.png
deleted file mode 100644
index 58d87729701..00000000000
--- a/doc/development/ux_guide/img/components-contentblock.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-counts.png b/doc/development/ux_guide/img/components-counts.png
deleted file mode 100644
index 19280e988a0..00000000000
--- a/doc/development/ux_guide/img/components-counts.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-coverblock.png b/doc/development/ux_guide/img/components-coverblock.png
deleted file mode 100644
index 61160de5613..00000000000
--- a/doc/development/ux_guide/img/components-coverblock.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-dateexact.png b/doc/development/ux_guide/img/components-dateexact.png
deleted file mode 100644
index cc1fb8216bf..00000000000
--- a/doc/development/ux_guide/img/components-dateexact.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-daterelative.png b/doc/development/ux_guide/img/components-daterelative.png
deleted file mode 100644
index 4954dfb51b3..00000000000
--- a/doc/development/ux_guide/img/components-daterelative.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-dropdown.png b/doc/development/ux_guide/img/components-dropdown.png
deleted file mode 100644
index 7f9a701c089..00000000000
--- a/doc/development/ux_guide/img/components-dropdown.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-fileholder.png b/doc/development/ux_guide/img/components-fileholder.png
deleted file mode 100644
index 5bf8565346a..00000000000
--- a/doc/development/ux_guide/img/components-fileholder.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-horizontalform.png b/doc/development/ux_guide/img/components-horizontalform.png
deleted file mode 100644
index e6cbc69d20a..00000000000
--- a/doc/development/ux_guide/img/components-horizontalform.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-listinsidepanel.png b/doc/development/ux_guide/img/components-listinsidepanel.png
deleted file mode 100644
index 6b773a19954..00000000000
--- a/doc/development/ux_guide/img/components-listinsidepanel.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-listwithavatar.png b/doc/development/ux_guide/img/components-listwithavatar.png
deleted file mode 100644
index f6db575433c..00000000000
--- a/doc/development/ux_guide/img/components-listwithavatar.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-listwithhover.png b/doc/development/ux_guide/img/components-listwithhover.png
deleted file mode 100644
index 0826848ff34..00000000000
--- a/doc/development/ux_guide/img/components-listwithhover.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-panels.png b/doc/development/ux_guide/img/components-panels.png
deleted file mode 100644
index c1391ca07e5..00000000000
--- a/doc/development/ux_guide/img/components-panels.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-referencehover.png b/doc/development/ux_guide/img/components-referencehover.png
deleted file mode 100644
index af5405d3e0b..00000000000
--- a/doc/development/ux_guide/img/components-referencehover.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-referenceissues.png b/doc/development/ux_guide/img/components-referenceissues.png
deleted file mode 100644
index 4e175dc169d..00000000000
--- a/doc/development/ux_guide/img/components-referenceissues.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-referencelabels.png b/doc/development/ux_guide/img/components-referencelabels.png
deleted file mode 100644
index 29a985bbaa0..00000000000
--- a/doc/development/ux_guide/img/components-referencelabels.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-referencemilestone.png b/doc/development/ux_guide/img/components-referencemilestone.png
deleted file mode 100644
index 47c76a9d60f..00000000000
--- a/doc/development/ux_guide/img/components-referencemilestone.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-referencemrs.png b/doc/development/ux_guide/img/components-referencemrs.png
deleted file mode 100644
index 9a5032a1516..00000000000
--- a/doc/development/ux_guide/img/components-referencemrs.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-referencepeople.png b/doc/development/ux_guide/img/components-referencepeople.png
deleted file mode 100644
index f9ef11be853..00000000000
--- a/doc/development/ux_guide/img/components-referencepeople.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-rowcontentblock.png b/doc/development/ux_guide/img/components-rowcontentblock.png
deleted file mode 100644
index c66a50f9564..00000000000
--- a/doc/development/ux_guide/img/components-rowcontentblock.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-searchbox.png b/doc/development/ux_guide/img/components-searchbox.png
deleted file mode 100644
index 5c19024bfb0..00000000000
--- a/doc/development/ux_guide/img/components-searchbox.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-searchboxscoped.png b/doc/development/ux_guide/img/components-searchboxscoped.png
deleted file mode 100644
index d4a35977658..00000000000
--- a/doc/development/ux_guide/img/components-searchboxscoped.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-simplelist.png b/doc/development/ux_guide/img/components-simplelist.png
deleted file mode 100644
index 8d11c674e84..00000000000
--- a/doc/development/ux_guide/img/components-simplelist.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-table.png b/doc/development/ux_guide/img/components-table.png
deleted file mode 100644
index cedc55758a9..00000000000
--- a/doc/development/ux_guide/img/components-table.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/components-verticalform.png b/doc/development/ux_guide/img/components-verticalform.png
deleted file mode 100644
index 489ae6f862f..00000000000
--- a/doc/development/ux_guide/img/components-verticalform.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/cursors-default.png b/doc/development/ux_guide/img/cursors-default.png
deleted file mode 100644
index c188ec4e351..00000000000
--- a/doc/development/ux_guide/img/cursors-default.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/cursors-ibeam.png b/doc/development/ux_guide/img/cursors-ibeam.png
deleted file mode 100644
index 86f28639982..00000000000
--- a/doc/development/ux_guide/img/cursors-ibeam.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/cursors-move.png b/doc/development/ux_guide/img/cursors-move.png
deleted file mode 100644
index a9c610eaa88..00000000000
--- a/doc/development/ux_guide/img/cursors-move.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/cursors-panclosed.png b/doc/development/ux_guide/img/cursors-panclosed.png
deleted file mode 100644
index 6d247a765ac..00000000000
--- a/doc/development/ux_guide/img/cursors-panclosed.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/cursors-panopened.png b/doc/development/ux_guide/img/cursors-panopened.png
deleted file mode 100644
index 76f2eeda831..00000000000
--- a/doc/development/ux_guide/img/cursors-panopened.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/cursors-pointer.png b/doc/development/ux_guide/img/cursors-pointer.png
deleted file mode 100644
index d86dd955fa7..00000000000
--- a/doc/development/ux_guide/img/cursors-pointer.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/features-contextualnav.png b/doc/development/ux_guide/img/features-contextualnav.png
deleted file mode 100644
index aa816776fad..00000000000
--- a/doc/development/ux_guide/img/features-contextualnav.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/features-emptystates.png b/doc/development/ux_guide/img/features-emptystates.png
deleted file mode 100644
index 50f31f5e523..00000000000
--- a/doc/development/ux_guide/img/features-emptystates.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/features-filters.png b/doc/development/ux_guide/img/features-filters.png
deleted file mode 100644
index 41db76db938..00000000000
--- a/doc/development/ux_guide/img/features-filters.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/features-globalnav.png b/doc/development/ux_guide/img/features-globalnav.png
deleted file mode 100644
index 73294d1b524..00000000000
--- a/doc/development/ux_guide/img/features-globalnav.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/harry-robison.png b/doc/development/ux_guide/img/harry-robison.png
deleted file mode 100644
index 702a8b02262..00000000000
--- a/doc/development/ux_guide/img/harry-robison.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/icon-add.png b/doc/development/ux_guide/img/icon-add.png
deleted file mode 100644
index f66525cc1b4..00000000000
--- a/doc/development/ux_guide/img/icon-add.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/icon-close.png b/doc/development/ux_guide/img/icon-close.png
deleted file mode 100644
index af6c30ebe6a..00000000000
--- a/doc/development/ux_guide/img/icon-close.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/icon-edit.png b/doc/development/ux_guide/img/icon-edit.png
deleted file mode 100644
index b9649f4aeec..00000000000
--- a/doc/development/ux_guide/img/icon-edit.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/icon-notification.png b/doc/development/ux_guide/img/icon-notification.png
deleted file mode 100644
index 5cf8f8ab59a..00000000000
--- a/doc/development/ux_guide/img/icon-notification.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/icon-rss.png b/doc/development/ux_guide/img/icon-rss.png
deleted file mode 100644
index 7e2987a2656..00000000000
--- a/doc/development/ux_guide/img/icon-rss.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/icon-spec.png b/doc/development/ux_guide/img/icon-spec.png
deleted file mode 100644
index 5bb85c5be98..00000000000
--- a/doc/development/ux_guide/img/icon-spec.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/icon-subscribe.png b/doc/development/ux_guide/img/icon-subscribe.png
deleted file mode 100644
index 7e2f5e6a1c6..00000000000
--- a/doc/development/ux_guide/img/icon-subscribe.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/icon-trash.png b/doc/development/ux_guide/img/icon-trash.png
deleted file mode 100644
index bc46638fb2e..00000000000
--- a/doc/development/ux_guide/img/icon-trash.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/illustration-size-large-horizontal.png b/doc/development/ux_guide/img/illustration-size-large-horizontal.png
deleted file mode 100644
index 8aa835adccc..00000000000
--- a/doc/development/ux_guide/img/illustration-size-large-horizontal.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/illustration-size-large-vertical.png b/doc/development/ux_guide/img/illustration-size-large-vertical.png
deleted file mode 100644
index 813b6a065e5..00000000000
--- a/doc/development/ux_guide/img/illustration-size-large-vertical.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/illustration-size-medium.png b/doc/development/ux_guide/img/illustration-size-medium.png
deleted file mode 100644
index 55cfe1dcb91..00000000000
--- a/doc/development/ux_guide/img/illustration-size-medium.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/illustration-size-small.png b/doc/development/ux_guide/img/illustration-size-small.png
deleted file mode 100644
index 0124f58f48e..00000000000
--- a/doc/development/ux_guide/img/illustration-size-small.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/illustrations-border-radius.png b/doc/development/ux_guide/img/illustrations-border-radius.png
deleted file mode 100644
index 4e2fef5c7f5..00000000000
--- a/doc/development/ux_guide/img/illustrations-border-radius.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/illustrations-caps-do.png b/doc/development/ux_guide/img/illustrations-caps-do.png
deleted file mode 100644
index f1030769b94..00000000000
--- a/doc/development/ux_guide/img/illustrations-caps-do.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/illustrations-caps-don't.png b/doc/development/ux_guide/img/illustrations-caps-don't.png
deleted file mode 100644
index ab7abcaaf6f..00000000000
--- a/doc/development/ux_guide/img/illustrations-caps-don't.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/illustrations-color-grey.png b/doc/development/ux_guide/img/illustrations-color-grey.png
deleted file mode 100644
index 63855026c2b..00000000000
--- a/doc/development/ux_guide/img/illustrations-color-grey.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/illustrations-color-orange.png b/doc/development/ux_guide/img/illustrations-color-orange.png
deleted file mode 100644
index 96765c8c28c..00000000000
--- a/doc/development/ux_guide/img/illustrations-color-orange.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/illustrations-color-purple.png b/doc/development/ux_guide/img/illustrations-color-purple.png
deleted file mode 100644
index 745d2c853ba..00000000000
--- a/doc/development/ux_guide/img/illustrations-color-purple.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/illustrations-geometric.png b/doc/development/ux_guide/img/illustrations-geometric.png
deleted file mode 100644
index 33f05547bac..00000000000
--- a/doc/development/ux_guide/img/illustrations-geometric.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/illustrations-palette-oragne.png b/doc/development/ux_guide/img/illustrations-palette-oragne.png
deleted file mode 100644
index 15f35912646..00000000000
--- a/doc/development/ux_guide/img/illustrations-palette-oragne.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/illustrations-palette-purple.png b/doc/development/ux_guide/img/illustrations-palette-purple.png
deleted file mode 100644
index e0f5839705e..00000000000
--- a/doc/development/ux_guide/img/illustrations-palette-purple.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/james-mackey.png b/doc/development/ux_guide/img/james-mackey.png
deleted file mode 100644
index f51a45c437b..00000000000
--- a/doc/development/ux_guide/img/james-mackey.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/karolina-plaskaty.png b/doc/development/ux_guide/img/karolina-plaskaty.png
deleted file mode 100644
index d1c9528dd5a..00000000000
--- a/doc/development/ux_guide/img/karolina-plaskaty.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/matthieu-poirier.png b/doc/development/ux_guide/img/matthieu-poirier.png
deleted file mode 100644
index 0ecc2d670d6..00000000000
--- a/doc/development/ux_guide/img/matthieu-poirier.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/modals-general-confimation-dialog.png b/doc/development/ux_guide/img/modals-general-confimation-dialog.png
deleted file mode 100644
index 4ea0ea10ca7..00000000000
--- a/doc/development/ux_guide/img/modals-general-confimation-dialog.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/modals-layout-for-modals.png b/doc/development/ux_guide/img/modals-layout-for-modals.png
deleted file mode 100644
index c481edd8250..00000000000
--- a/doc/development/ux_guide/img/modals-layout-for-modals.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/modals-special-confimation-dialog.png b/doc/development/ux_guide/img/modals-special-confimation-dialog.png
deleted file mode 100644
index d966010158b..00000000000
--- a/doc/development/ux_guide/img/modals-special-confimation-dialog.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/modals-three-buttons.png b/doc/development/ux_guide/img/modals-three-buttons.png
deleted file mode 100644
index 157d1b650bf..00000000000
--- a/doc/development/ux_guide/img/modals-three-buttons.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/monospacefont-sample.png b/doc/development/ux_guide/img/monospacefont-sample.png
deleted file mode 100644
index 1cd290b713c..00000000000
--- a/doc/development/ux_guide/img/monospacefont-sample.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/nazim-ramesh.png b/doc/development/ux_guide/img/nazim-ramesh.png
deleted file mode 100644
index dad2b37010b..00000000000
--- a/doc/development/ux_guide/img/nazim-ramesh.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/popover-placement-above.png b/doc/development/ux_guide/img/popover-placement-above.png
deleted file mode 100644
index 84c9c878ec2..00000000000
--- a/doc/development/ux_guide/img/popover-placement-above.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/popover-placement-below.png b/doc/development/ux_guide/img/popover-placement-below.png
deleted file mode 100644
index f6f18199ab6..00000000000
--- a/doc/development/ux_guide/img/popover-placement-below.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/skeleton-loading.gif b/doc/development/ux_guide/img/skeleton-loading.gif
deleted file mode 100644
index 5877139171d..00000000000
--- a/doc/development/ux_guide/img/skeleton-loading.gif
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/sourcesanspro-sample.png b/doc/development/ux_guide/img/sourcesanspro-sample.png
deleted file mode 100644
index f7ecf0c7c66..00000000000
--- a/doc/development/ux_guide/img/sourcesanspro-sample.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/steven-lyons.png b/doc/development/ux_guide/img/steven-lyons.png
deleted file mode 100644
index 2efe1d0b168..00000000000
--- a/doc/development/ux_guide/img/steven-lyons.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/surfaces-contentitemtitle.png b/doc/development/ux_guide/img/surfaces-contentitemtitle.png
deleted file mode 100644
index f6cd212ecfd..00000000000
--- a/doc/development/ux_guide/img/surfaces-contentitemtitle.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/surfaces-header.png b/doc/development/ux_guide/img/surfaces-header.png
deleted file mode 100644
index ba616388003..00000000000
--- a/doc/development/ux_guide/img/surfaces-header.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/surfaces-systeminformationblock.png b/doc/development/ux_guide/img/surfaces-systeminformationblock.png
deleted file mode 100644
index f3313add2b8..00000000000
--- a/doc/development/ux_guide/img/surfaces-systeminformationblock.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/surfaces-ux.png b/doc/development/ux_guide/img/surfaces-ux.png
deleted file mode 100644
index eaa7f70c0c7..00000000000
--- a/doc/development/ux_guide/img/surfaces-ux.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/tooltip-placement.png b/doc/development/ux_guide/img/tooltip-placement.png
deleted file mode 100644
index da49c192878..00000000000
--- a/doc/development/ux_guide/img/tooltip-placement.png
+++ /dev/null
Binary files differ
diff --git a/doc/development/ux_guide/img/tooltip-usage.png b/doc/development/ux_guide/img/tooltip-usage.png
deleted file mode 100644
index 4f5884c4b48..00000000000
--- a/doc/development/ux_guide/img/tooltip-usage.png
+++ /dev/null
Binary files differ
diff --git a/doc/gitlab-basics/README.md b/doc/gitlab-basics/README.md
index aa008d6f768..28ba20bec09 100644
--- a/doc/gitlab-basics/README.md
+++ b/doc/gitlab-basics/README.md
@@ -27,9 +27,11 @@ The following are guides to basic GitLab functionality:
## Git basics
-If you're unfamiliar with the command line, these resources will help:
+If you're familiar with Git on the command line, you can interact with your GitLab projects just as you would with any other Git repository.
+
+These resources will help get further acclimated to working on the command line.
-- [Command line basics](command-line-commands.md), for those unfamiliar with the command line interface.
- [Start using Git on the command line](start-using-git.md), for some simple Git commands.
+- [Command line basics](command-line-commands.md), to create and edit files using the command line.
More Git resources are available at GitLab's [Git documentation](../topics/git/index.md).
diff --git a/doc/gitlab-basics/command-line-commands.md b/doc/gitlab-basics/command-line-commands.md
index a0111be0767..1cf883679d7 100644
--- a/doc/gitlab-basics/command-line-commands.md
+++ b/doc/gitlab-basics/command-line-commands.md
@@ -13,10 +13,12 @@ button (you'll have to paste it on your shell in the next step).
![Copy the HTTPS or SSH](img/project_clone_url.png)
-## On the command line
+## Working with project files on the command line
This section has examples of some basic shell commands that you might find useful. For more information, search the web for _bash commands_.
+Alternatively, you can edit files using your choice of editor (IDE) or the GitLab user interface.
+
### Clone your project
Go to your computer's shell and type the following command with your SSH or HTTPS URL:
diff --git a/doc/gitlab-basics/img/new_issue_button.png b/doc/gitlab-basics/img/new_issue_button.png
deleted file mode 100644
index 3b113471f0c..00000000000
--- a/doc/gitlab-basics/img/new_issue_button.png
+++ /dev/null
Binary files differ
diff --git a/doc/gitlab-basics/img/new_issue_page.png b/doc/gitlab-basics/img/new_issue_page.png
deleted file mode 100644
index ce3e60df276..00000000000
--- a/doc/gitlab-basics/img/new_issue_page.png
+++ /dev/null
Binary files differ
diff --git a/doc/gitlab-basics/img/public_file_link.png b/doc/gitlab-basics/img/public_file_link.png
deleted file mode 100644
index f60df6807f4..00000000000
--- a/doc/gitlab-basics/img/public_file_link.png
+++ /dev/null
Binary files differ
diff --git a/doc/gitlab-basics/start-using-git.md b/doc/gitlab-basics/start-using-git.md
index e30afdf8a40..b3c5d32f2f5 100644
--- a/doc/gitlab-basics/start-using-git.md
+++ b/doc/gitlab-basics/start-using-git.md
@@ -71,6 +71,18 @@ git config --global --list
Start using Git via the command line with the most basic
commands as described below.
+## Initialize a local directory for Git version control
+
+If you have an existing local directory that you want to *initialize* for version control, use the `init` command to instruct Git to begin tracking the directory:
+
+```bash
+git init
+```
+
+This creates a `.git` directory that contains the Git configuration files.
+
+Once the directory has been initialized, you can [add a remote repository](#add-a-remote-repository) and [send changes to GitLab.com](#send-changes-to-gitlabcom). View the instructions on [Create a project](../gitlab-basics/create-project.html#push-to-create-a-new-project) to create a new project on GitLab with your changes.
+
### Clone a repository
To start working locally on an existing remote repository,
@@ -140,6 +152,16 @@ To view your remote repositories, type:
git remote -v
```
+### Add a remote repository
+
+To add a link to a remote repository:
+
+```bash
+git remote add SOURCE-NAME REPOSITORY-PATH
+```
+
+You'll use this source name every time you [push changes to GitLab.com](#send-changes-to-gitlabcom), so use something easy to remember and type.
+
### Create a branch
To create a branch, type the following (spaces won't be recognized in the branch name, so you will need to use a hyphen or underscore):
@@ -193,7 +215,7 @@ git commit -m "COMMENT TO DESCRIBE THE INTENTION OF THE COMMIT"
NOTE: **Note:**
The `.` character typically means _all_ in Git.
-### Send changes to gitlab.com
+### Send changes to GitLab.com
To push all local commits to the remote repository:
diff --git a/doc/install/aws/img/add_tags.png b/doc/install/aws/img/add_tags.png
deleted file mode 100644
index 3572cd5daa1..00000000000
--- a/doc/install/aws/img/add_tags.png
+++ /dev/null
Binary files differ
diff --git a/doc/install/aws/img/create_route_table.png b/doc/install/aws/img/create_route_table.png
deleted file mode 100644
index ea72c57257e..00000000000
--- a/doc/install/aws/img/create_route_table.png
+++ /dev/null
Binary files differ
diff --git a/doc/install/azure/img/azure-vm-management-settings-network-interfaces.png b/doc/install/azure/img/azure-vm-management-settings-network-interfaces.png
deleted file mode 100644
index 4ff10718059..00000000000
--- a/doc/install/azure/img/azure-vm-management-settings-network-interfaces.png
+++ /dev/null
Binary files differ
diff --git a/doc/install/azure/img/azure-vm-management.png b/doc/install/azure/img/azure-vm-management.png
deleted file mode 100644
index a0e0067258c..00000000000
--- a/doc/install/azure/img/azure-vm-management.png
+++ /dev/null
Binary files differ
diff --git a/doc/install/installation.md b/doc/install/installation.md
index 1fff3e92280..6b24dc8abdc 100644
--- a/doc/install/installation.md
+++ b/doc/install/installation.md
@@ -99,7 +99,20 @@ sudo apt-get install -y git-core
git --version
```
-Is the system packaged Git too old? Remove it and compile from source.
+Starting with GitLab 12.0, Git is required to be compiled with `libpcre2`.
+Find out if that's the case:
+
+```sh
+ldd /usr/local/bin/git | grep pcre2
+```
+
+The output should be similar to:
+
+```
+libpcre2-8.so.0 => /usr/lib/libpcre2-8.so.0 (0x00007f08461c3000)
+```
+
+Is the system packaged Git too old, or not compiled with pcre2? Remove it and compile from source:
```sh
# Remove packaged Git
@@ -108,12 +121,21 @@ sudo apt-get remove git-core
# Install dependencies
sudo apt-get install -y libcurl4-openssl-dev libexpat1-dev gettext libz-dev libssl-dev build-essential
+# Download and compile pcre2 from source
+curl --silent --show-error --location https://ftp.pcre.org/pub/pcre/pcre2-10.33.tar.gz --output pcre2.tar.gz
+tar -xzf pcre2.tar.gz
+cd pcre2-10.33
+chmod +x configure
+./configure --prefix=/usr --enable-jit
+make
+make install
+
# Download and compile from source
cd /tmp
curl --remote-name --location --progress https://www.kernel.org/pub/software/scm/git/git-2.21.0.tar.gz
echo '85eca51c7404da75e353eba587f87fea9481ba41e162206a6f70ad8118147bee git-2.21.0.tar.gz' | shasum -a256 -c - && tar -xzf git-2.21.0.tar.gz
cd git-2.21.0/
-./configure
+./configure --with-libpcre
make prefix=/usr/local all
# Install into /usr/local/bin
@@ -434,7 +456,8 @@ sudo -u git -H editor config/resque.yml
```
CAUTION: **Caution:**
-Make sure to edit both `gitlab.yml` and `unicorn.rb` to match your setup.
+Make sure to edit both `gitlab.yml` and `unicorn.rb` to match your setup.
+If you want to use Puma web server, see [Using Puma](#using-puma) for the additional steps.
NOTE: **Note:**
If you want to use HTTPS, see [Using HTTPS](#using-https) for the additional steps.
@@ -875,6 +898,25 @@ You also need to change the corresponding options (e.g. `ssh_user`, `ssh_host`,
Apart from the always supported markdown style, there are other rich text files that GitLab can display. But you might have to install a dependency to do so. See the [github-markup gem README](https://github.com/gitlabhq/markup#markups) for more information.
+### Using Puma
+
+Puma is a multi-threaded HTTP 1.1 server for Ruby applications.
+
+To use GitLab with Puma:
+
+1. Finish GitLab setup so you have it up and running.
+1. Copy the supplied example Puma config file into place:
+
+ ```sh
+ cd /home/git/gitlab
+
+ # Copy config file for the web server
+ sudo -u git -H config/puma.rb.example config/puma.rb
+ ```
+
+1. Edit the system `init.d` script to use `EXPERIMENTAL_PUMA=1` flag. If you have `/etc/default/gitlab`, then you should edit it instead.
+1. Restart GitLab.
+
## Troubleshooting
### "You appear to have cloned an empty repository."
diff --git a/doc/install/ldap.md b/doc/install/ldap.md
index a19f0342b65..d8d54864586 100644
--- a/doc/install/ldap.md
+++ b/doc/install/ldap.md
@@ -2,6 +2,4 @@
redirect_to: '../administration/auth/ldap.md'
---
-# GitLab LDAP integration
-
-This document was moved under [`administration/auth/ldap`](../administration/auth/ldap.md).
+This document was moved to [another location](../administration/auth/ldap.md).
diff --git a/doc/install/openshift_and_gitlab/img/pods-overview.png b/doc/install/openshift_and_gitlab/img/pods-overview.png
deleted file mode 100644
index 65927f65f4f..00000000000
--- a/doc/install/openshift_and_gitlab/img/pods-overview.png
+++ /dev/null
Binary files differ
diff --git a/doc/install/openshift_and_gitlab/img/storage-volumes.png b/doc/install/openshift_and_gitlab/img/storage-volumes.png
deleted file mode 100644
index 3fd092919bb..00000000000
--- a/doc/install/openshift_and_gitlab/img/storage-volumes.png
+++ /dev/null
Binary files differ
diff --git a/doc/integration/elasticsearch.md b/doc/integration/elasticsearch.md
index 7cef664bc98..15176ede733 100644
--- a/doc/integration/elasticsearch.md
+++ b/doc/integration/elasticsearch.md
@@ -85,7 +85,7 @@ To build and install the indexer, run:
```sh
git clone https://gitlab.com/gitlab-org/gitlab-elasticsearch-indexer.git
-cd /gitlab-elasticsearch-indexer
+cd gitlab-elasticsearch-indexer
make
sudo make install
```
@@ -131,6 +131,8 @@ The following Elasticsearch settings are available:
| `Use the new repository indexer (beta)` | Perform repository indexing using [GitLab Elasticsearch Indexer](https://gitlab.com/gitlab-org/gitlab-elasticsearch-indexer). |
| `Search with Elasticsearch enabled` | Enables/disables using Elasticsearch in search. |
| `URL` | The URL to use for connecting to Elasticsearch. Use a comma-separated list to support clustering (e.g., "http://host1, https://host2:9200"). If your Elasticsearch instance is password protected, pass the `username:password` in the URL (e.g., `http://<username>:<password>@<elastic_host>:9200/`). |
+| `Number of Elasticsearch shards` | Elasticsearch indexes are split into multiple shards for performance reasons. In general, larger indexes need to have more shards. Changes to this value do not take effect until the index is recreated. You can read more about tradeoffs in the [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html#create-index-settings) |
+| `Number of Elasticsearch replicas` | Each Elasticsearch shard can have a number of replicas. These are a complete copy of the shard, and can provide increased query performance or resilience against hardware failure. Increasing this value will greatly increase total disk space required by the index. |
| `Limit namespaces and projects that can be indexed` | Enabling this will allow you to select namespaces and projects to index. All other namespaces and projects will use database search instead. Please note that if you enable this option but do not select any namespaces or projects, none will be indexed. [Read more below](#limiting-namespaces-and-projects).
| `Using AWS hosted Elasticsearch with IAM credentials` | Sign your Elasticsearch requests using [AWS IAM authorization](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html) or [AWS EC2 Instance Profile Credentials](http://docs.aws.amazon.com/codedeploy/latest/userguide/getting-started-create-iam-instance-profile.html#getting-started-create-iam-instance-profile-cli). The policies must be configured to allow `es:*` actions. |
| `AWS Region` | The AWS region your Elasticsearch service is located in. |
@@ -338,10 +340,30 @@ curl --request PUT localhost:9200/gitlab-production/_settings --data '{
} }'
```
-A force merge should be called after enabling the refreshing above:
+A force merge should be called after enabling the refreshing above.
+
+For Elasticsearch 6.x, before proceeding with the force merge, the index should be in read-only mode:
+
+```bash
+curl --request PUT localhost:9200/gitlab-production/_settings --data '{
+ "settings": {
+ "index.blocks.write": true
+ } }'
+```
+
+Then, initiate the force merge:
```bash
-curl --request POST 'http://localhost:9200/_forcemerge?max_num_segments=5'
+curl --request POST 'http://localhost:9200/gitlab-production/_forcemerge?max_num_segments=5'
+```
+
+After this, if your index is in read-only, switch back to read-write:
+
+```bash
+curl --request PUT localhost:9200/gitlab-production/_settings --data '{
+ "settings": {
+ "index.blocks.write": false
+ } }'
```
Enable Elasticsearch search in **Admin > Settings > Integrations**. That's it. Enjoy it!
diff --git a/doc/integration/img/google_app.png b/doc/integration/img/google_app.png
deleted file mode 100644
index 08f230452b4..00000000000
--- a/doc/integration/img/google_app.png
+++ /dev/null
Binary files differ
diff --git a/doc/license/README.md b/doc/license/README.md
index 4cc387ba95f..b9281fd5299 100644
--- a/doc/license/README.md
+++ b/doc/license/README.md
@@ -2,4 +2,4 @@
redirect_to: 'https://docs.gitlab.com/ee/user/admin_area/license.html'
---
-This document was moved to [user/admin_area/license](https://docs.gitlab.com/ee/user/admin_area/license.html).
+This document was moved to [another location](https://docs.gitlab.com/ee/user/admin_area/license.html).
diff --git a/doc/monitoring/performance/img/grafana_dashboard_dropdown.png b/doc/monitoring/performance/img/grafana_dashboard_dropdown.png
deleted file mode 100644
index 51eef90068d..00000000000
--- a/doc/monitoring/performance/img/grafana_dashboard_dropdown.png
+++ /dev/null
Binary files differ
diff --git a/doc/monitoring/performance/img/grafana_dashboard_import.png b/doc/monitoring/performance/img/grafana_dashboard_import.png
deleted file mode 100644
index fd639ee0eb8..00000000000
--- a/doc/monitoring/performance/img/grafana_dashboard_import.png
+++ /dev/null
Binary files differ
diff --git a/doc/monitoring/performance/img/grafana_data_source_configuration.png b/doc/monitoring/performance/img/grafana_data_source_configuration.png
deleted file mode 100644
index a98e0ed1e7d..00000000000
--- a/doc/monitoring/performance/img/grafana_data_source_configuration.png
+++ /dev/null
Binary files differ
diff --git a/doc/monitoring/performance/img/grafana_data_source_empty.png b/doc/monitoring/performance/img/grafana_data_source_empty.png
deleted file mode 100644
index 549ada8343e..00000000000
--- a/doc/monitoring/performance/img/grafana_data_source_empty.png
+++ /dev/null
Binary files differ
diff --git a/doc/monitoring/performance/img/grafana_save_icon.png b/doc/monitoring/performance/img/grafana_save_icon.png
deleted file mode 100644
index 68a071f5ae2..00000000000
--- a/doc/monitoring/performance/img/grafana_save_icon.png
+++ /dev/null
Binary files differ
diff --git a/doc/monitoring/performance/img/metrics_gitlab_configuration_settings.png b/doc/monitoring/performance/img/metrics_gitlab_configuration_settings.png
deleted file mode 100644
index b9563a00e97..00000000000
--- a/doc/monitoring/performance/img/metrics_gitlab_configuration_settings.png
+++ /dev/null
Binary files differ
diff --git a/doc/topics/authentication/index.md b/doc/topics/authentication/index.md
index 0531627b7b3..00b6c1dfdc2 100644
--- a/doc/topics/authentication/index.md
+++ b/doc/topics/authentication/index.md
@@ -17,11 +17,11 @@ This page gathers all the resources for the topic **Authentication** within GitL
## GitLab administrators
- [LDAP (Community Edition)](../../administration/auth/ldap.md)
-- [LDAP (Enterprise Edition)](https://docs.gitlab.com/ee/administration/auth/ldap-ee.html)
+- [LDAP (Enterprise Edition)](https://docs.gitlab.com/ee/administration/auth/ldap-ee.html) **[STARTER]**
- [Enforce Two-factor Authentication (2FA)](../../security/two_factor_authentication.md#enforce-two-factor-authentication-2fa)
- **Articles:**
- [How to Configure LDAP with GitLab CE](../../administration/auth/how_to_configure_ldap_gitlab_ce/index.md)
- - [How to Configure LDAP with GitLab EE](https://docs.gitlab.com/ee/administration/auth/how_to_configure_ldap_gitlab_ee/index.html)
+ - [How to Configure LDAP with GitLab EE](https://docs.gitlab.com/ee/administration/auth/how_to_configure_ldap_gitlab_ee/index.html) **[STARTER]**
- [Feature Highlight: LDAP Integration](https://about.gitlab.com/2014/07/10/feature-highlight-ldap-sync/)
- [Debugging LDAP](https://about.gitlab.com/handbook/support/workflows/support-engineering/ldap/debugging_ldap.html)
- **Integrations:**
@@ -30,10 +30,10 @@ This page gathers all the resources for the topic **Authentication** within GitL
- [Atlassian Crowd OmniAuth Provider](../../administration/auth/crowd.md)
- [CAS OmniAuth Provider](../../integration/cas.md)
- [SAML OmniAuth Provider](../../integration/saml.md)
- - [SAML for GitLab.com Groups](https://docs.gitlab.com/ee/user/group/saml_sso/index.html)
- - [SCIM user provisioning for GitLab.com Groups](https://docs.gitlab.com/ee/user/group/saml_sso/scim_setup.html)
+ - [SAML for GitLab.com Groups](https://docs.gitlab.com/ee/user/group/saml_sso/index.html) **[SILVER ONLY]**
+ - [SCIM user provisioning for GitLab.com Groups](https://docs.gitlab.com/ee/user/group/saml_sso/scim_setup.html) **[SILVER ONLY]**
- [Okta SSO provider](../../administration/auth/okta.md)
- - [Kerberos integration (GitLab EE)](https://docs.gitlab.com/ee/integration/kerberos.html)
+ - [Kerberos integration (GitLab EE)](https://docs.gitlab.com/ee/integration/kerberos.html) **[STARTER]**
## API
diff --git a/doc/topics/autodevops/img/autodevops_domain_variables.png b/doc/topics/autodevops/img/autodevops_domain_variables.png
deleted file mode 100644
index b6f8864796f..00000000000
--- a/doc/topics/autodevops/img/autodevops_domain_variables.png
+++ /dev/null
Binary files differ
diff --git a/doc/topics/autodevops/img/guide_connect_cluster.png b/doc/topics/autodevops/img/guide_connect_cluster.png
deleted file mode 100644
index 703d536f37a..00000000000
--- a/doc/topics/autodevops/img/guide_connect_cluster.png
+++ /dev/null
Binary files differ
diff --git a/doc/topics/autodevops/img/guide_create_cluster.png b/doc/topics/autodevops/img/guide_create_cluster.png
deleted file mode 100644
index cd1d0fdd8da..00000000000
--- a/doc/topics/autodevops/img/guide_create_cluster.png
+++ /dev/null
Binary files differ
diff --git a/doc/topics/autodevops/img/guide_gke_apis_after.png b/doc/topics/autodevops/img/guide_gke_apis_after.png
deleted file mode 100644
index 380de958867..00000000000
--- a/doc/topics/autodevops/img/guide_gke_apis_after.png
+++ /dev/null
Binary files differ
diff --git a/doc/topics/autodevops/img/guide_gke_apis_before.png b/doc/topics/autodevops/img/guide_gke_apis_before.png
deleted file mode 100644
index d06fc707887..00000000000
--- a/doc/topics/autodevops/img/guide_gke_apis_before.png
+++ /dev/null
Binary files differ
diff --git a/doc/topics/autodevops/img/guide_merge_request_ide.png b/doc/topics/autodevops/img/guide_merge_request_ide.png
deleted file mode 100644
index c825b0849e1..00000000000
--- a/doc/topics/autodevops/img/guide_merge_request_ide.png
+++ /dev/null
Binary files differ
diff --git a/doc/topics/autodevops/index.md b/doc/topics/autodevops/index.md
index 2884458a44c..5a8744d71f9 100644
--- a/doc/topics/autodevops/index.md
+++ b/doc/topics/autodevops/index.md
@@ -771,6 +771,7 @@ also be customized, and you can easily use a [custom buildpack](#custom-buildpac
| `K8S_SECRET_*` | From GitLab 11.7, any variable prefixed with [`K8S_SECRET_`](#application-secret-variables) will be made available by Auto DevOps as environment variables to the deployed application. |
| `KUBE_INGRESS_BASE_DOMAIN` | From GitLab 11.8, this variable can be used to set a domain per cluster. See [cluster domains](../../user/project/clusters/index.md#base-domain) for more information. |
| `ROLLOUT_RESOURCE_TYPE` | From GitLab 11.9, this variable allows specification of the resource type being deployed when using a custom helm chart. Default value is `deployment`. |
+| `ROLLOUT_STATUS_DISABLED` | From GitLab 12.0, this variable allows to disable rollout status check because it doesn't support all resource types, for example, `cronjob`. |
| `HELM_UPGRADE_EXTRA_ARGS` | From GitLab 11.11, this variable allows extra arguments in `helm` commands when deploying the application. Note that using quotes will not prevent word splitting. |
TIP: **Tip:**
@@ -1099,3 +1100,7 @@ curl --data "value=true" --header "PRIVATE-TOKEN: personal_access_token" https:/
[ee]: https://about.gitlab.com/pricing/
[ce-21955]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21955
[ce-19507]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/19507
+
+## Development guides
+
+Configuring [GDK for Auto DevOps](https://gitlab.com/gitlab-org/gitlab-development-kit/blob/master/doc/howto/auto_devops.md).
diff --git a/doc/university/high-availability/aws/img/elastic-file-system.png b/doc/university/high-availability/aws/img/elastic-file-system.png
deleted file mode 100644
index 5bcfb8d0588..00000000000
--- a/doc/university/high-availability/aws/img/elastic-file-system.png
+++ /dev/null
Binary files differ
diff --git a/doc/update/patch_versions.md b/doc/update/patch_versions.md
index f90bff662e2..c2dff21b028 100644
--- a/doc/update/patch_versions.md
+++ b/doc/update/patch_versions.md
@@ -67,7 +67,7 @@ sudo -u git -H bundle exec rake gettext:pack RAILS_ENV=production
sudo -u git -H bundle exec rake gettext:po_to_json RAILS_ENV=production
# Clean up assets and cache
-sudo -u git -H bundle exec rake yarn:install gitlab:assets:clean gitlab:assets:compile cache:clear RAILS_ENV=production NODE_ENV=production
+sudo -u git -H bundle exec rake yarn:install gitlab:assets:clean gitlab:assets:compile cache:clear RAILS_ENV=production NODE_ENV=production NODE_OPTIONS="--max_old_space_size=4096"
```
### 4. Update gitlab-workhorse to the corresponding version
diff --git a/doc/update/upgrading_from_source.md b/doc/update/upgrading_from_source.md
index 5118726cb0a..82a86f3f343 100644
--- a/doc/update/upgrading_from_source.md
+++ b/doc/update/upgrading_from_source.md
@@ -25,13 +25,7 @@ This section contains all the steps necessary to upgrade Community Edition or
Enterprise Edition, regardless of the version you are upgrading to. Version
specific guidelines (should there be any) are covered separately.
-### 1. Stop server
-
-```bash
-sudo service gitlab stop
-```
-
-### 2. Backup
+### 1. Backup
NOTE: If you installed GitLab from source, make sure `rsync` is installed.
@@ -41,6 +35,12 @@ cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
```
+### 2. Stop server
+
+```bash
+sudo service gitlab stop
+```
+
### 3. Update Ruby
NOTE: Beginning in GitLab 11.6, we only support Ruby 2.5 or higher, and dropped
@@ -314,7 +314,7 @@ sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
sudo -u git -H bundle exec rake gettext:compile RAILS_ENV=production
# Update node dependencies and recompile assets
-sudo -u git -H bundle exec rake yarn:install gitlab:assets:clean gitlab:assets:compile RAILS_ENV=production NODE_ENV=production
+sudo -u git -H bundle exec rake yarn:install gitlab:assets:clean gitlab:assets:compile RAILS_ENV=production NODE_ENV=production NODE_OPTIONS="--max_old_space_size=4096"
# Clean up cache
sudo -u git -H bundle exec rake cache:clear RAILS_ENV=production
diff --git a/doc/user/admin_area/img/license_no_license_message.png b/doc/user/admin_area/img/license_no_license_message.png
deleted file mode 100644
index 87b397f7905..00000000000
--- a/doc/user/admin_area/img/license_no_license_message.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/admin_area/index.md b/doc/user/admin_area/index.md
index dd4e96c1f4a..d2995d48833 100644
--- a/doc/user/admin_area/index.md
+++ b/doc/user/admin_area/index.md
@@ -61,16 +61,32 @@ Click the **All**, **Private**, **Internal**, or **Public** tab to list only pro
criteria.
By default, all projects are listed, in reverse order of when they were last updated. For each
-project, the name, namespace, description, and size is listed, also options to **Edit** or
-**Delete** it.
+project, the following information is listed:
-Sort projects by **Name**, **Last created**, **Oldest created**, **Last updated**, **Oldest
-updated**, **Owner**, and choose to hide or show archived projects.
+- Name.
+- Namespace.
+- Description.
+- Size, updated every 15 minutes at most.
+
+Projects can be edited or deleted.
+
+The list of projects can be sorted by:
+
+- Name.
+- Last created.
+- Oldest created.
+- Last updated.
+- Oldest updated.
+- Owner.
+
+A user can choose to hide or show archived projects in the list.
In the **Filter by name** field, type the project name you want to find, and GitLab will filter
them as you type.
Select from the **Namespace** dropdown to filter only projects in that namespace.
-You can combine the filter options. For example, click the **Public** tab, and enter `score` in
-the **Filter by name...** input box to list only public projects with `score` in their name.
+You can combine the filter options. For example, to list only public projects with `score` in their name:
+
+1. Click the **Public** tab.
+1. Enter `score` in the **Filter by name...** input box.
diff --git a/doc/user/admin_area/settings/continuous_integration.md b/doc/user/admin_area/settings/continuous_integration.md
index 42fc4efa4ce..6c4abce83c2 100644
--- a/doc/user/admin_area/settings/continuous_integration.md
+++ b/doc/user/admin_area/settings/continuous_integration.md
@@ -1,3 +1,7 @@
+---
+type: reference
+---
+
# Continuous Integration and Deployment Admin settings **[CORE ONLY]**
In this area, you will find settings for Auto DevOps, Runners and job artifacts.
@@ -118,7 +122,15 @@ will be synced to your Group and you can visualize it from the
![Additional minutes](img/additional_minutes.png)
-NOTE: **Important note**: If you have some minutes used over your default quota, these minutes will
+Be aware that:
+
+1. If you have purchased extra CI minutes before the purchase of a paid plan,
+we will calculate a pro-rated charge for your paid plan. That means you may
+be charged for less than one year since your subscription was previously
+created with the extra CI minutes.
+1. Once the extra CI minutes has been assigned to a Group they cannot be transferred
+to a different Group.
+1. If you have some minutes used over your default quota, these minutes will
be deducted from your Additional Minutes quota immediately after your purchase of additional
minutes.
@@ -137,3 +149,15 @@ To set the duration for which the jobs will be considered as old and expired:
Once that time passes, the jobs will be archived and no longer able to be
retried. Make it empty to never expire jobs. It has to be no less than 1 day,
for example: <code>15 days</code>, <code>1 month</code>, <code>2 years</code>.
+
+<!-- ## Troubleshooting
+
+Include any troubleshooting steps that you can foresee. If you know beforehand what issues
+one might have when setting this up, or when something is changed, or on upgrading, it's
+important to describe those, too. Think of things that may go wrong and include them here.
+This is important to minimize requests for support, and to avoid doc comments with
+questions that you know someone might ask.
+
+Each scenario can be a third-level heading, e.g. `### Getting error message X`.
+If you have none to add when creating a doc, leave this section in place
+but commented out to help encourage others to add to it in the future. --> \ No newline at end of file
diff --git a/doc/user/admin_area/settings/email.md b/doc/user/admin_area/settings/email.md
index 01a98cf15dc..912c2cff481 100644
--- a/doc/user/admin_area/settings/email.md
+++ b/doc/user/admin_area/settings/email.md
@@ -1,12 +1,18 @@
+---
+type: reference
+---
+
# Email
+You can customize some of the content in emails sent from your GitLab instance.
+
## Custom logo
The logo in the header of some emails can be customized, see the [logo customization section](../../../customization/branded_page_and_email_header.md).
## Custom additional text **[PREMIUM ONLY]**
->[Introduced][ee-5031] in [GitLab Premium][eep] 10.7.
+> [Introduced][ee-5031] in [GitLab Premium][eep] 10.7.
The additional text will appear at the bottom of any email and can be used for
legal/auditing/compliance reasons.
@@ -24,8 +30,8 @@ legal/auditing/compliance reasons.
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22560) in GitLab 11.5.
-This configuration option sets the email hostname for [private commit emails](../../profile/index.md#private-commit-email),
-and it's, by default, set to `users.noreply.YOUR_CONFIGURED_HOSTNAME`.
+This configuration option sets the email hostname for [private commit emails](../../profile/index.md#private-commit-email).
+ By default it is set to `users.noreply.YOUR_CONFIGURED_HOSTNAME`.
In order to change this option:
@@ -36,3 +42,15 @@ In order to change this option:
NOTE: **Note**: Once the hostname gets configured, every private commit email using the previous hostname, will not get
recognized by GitLab. This can directly conflict with certain [Push rules](https://docs.gitlab.com/ee/push_rules/push_rules.html) such as
`Check whether author is a GitLab user` and `Check whether committer is the current authenticated user`.
+
+<!-- ## Troubleshooting
+
+Include any troubleshooting steps that you can foresee. If you know beforehand what issues
+one might have when setting this up, or when something is changed, or on upgrading, it's
+important to describe those, too. Think of things that may go wrong and include them here.
+This is important to minimize requests for support, and to avoid doc comments with
+questions that you know someone might ask.
+
+Each scenario can be a third-level heading, e.g. `### Getting error message X`.
+If you have none to add when creating a doc, leave this section in place
+but commented out to help encourage others to add to it in the future. --> \ No newline at end of file
diff --git a/doc/user/admin_area/settings/external_authorization.md b/doc/user/admin_area/settings/external_authorization.md
index 06e00e02f3d..11c0867da17 100644
--- a/doc/user/admin_area/settings/external_authorization.md
+++ b/doc/user/admin_area/settings/external_authorization.md
@@ -1,3 +1,7 @@
+---
+type: reference
+---
+
# External authorization control **[CORE ONLY]**
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/4216) in
@@ -108,5 +112,17 @@ The label will be shown on all project pages in the upper right corner.
![classification label on project page](img/classification_label_on_project_page.png)
+<!-- ## Troubleshooting
+
+Include any troubleshooting steps that you can foresee. If you know beforehand what issues
+one might have when setting this up, or when something is changed, or on upgrading, it's
+important to describe those, too. Think of things that may go wrong and include them here.
+This is important to minimize requests for support, and to avoid doc comments with
+questions that you know someone might ask.
+
+Each scenario can be a third-level heading, e.g. `### Getting error message X`.
+If you have none to add when creating a doc, leave this section in place
+but commented out to help encourage others to add to it in the future. -->
+
[omnibus-ssl-docs]: https://docs.gitlab.com/omnibus/settings/ssl.html
[omnibus-log-docs]: https://docs.gitlab.com/omnibus/settings/logs.html
diff --git a/doc/user/admin_area/settings/img/admin_area_default_artifacts_expiration.png b/doc/user/admin_area/settings/img/admin_area_default_artifacts_expiration.png
deleted file mode 100644
index 723be23e77b..00000000000
--- a/doc/user/admin_area/settings/img/admin_area_default_artifacts_expiration.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/admin_area/settings/img/admin_area_group_edit.png b/doc/user/admin_area/settings/img/admin_area_group_edit.png
deleted file mode 100644
index c9bd2f10b36..00000000000
--- a/doc/user/admin_area/settings/img/admin_area_group_edit.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/admin_area/settings/img/admin_area_groups.png b/doc/user/admin_area/settings/img/admin_area_groups.png
deleted file mode 100644
index ebdee0eafdc..00000000000
--- a/doc/user/admin_area/settings/img/admin_area_groups.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/admin_area/settings/img/admin_area_maximum_artifacts_size.png b/doc/user/admin_area/settings/img/admin_area_maximum_artifacts_size.png
deleted file mode 100644
index 3f827f1f7a3..00000000000
--- a/doc/user/admin_area/settings/img/admin_area_maximum_artifacts_size.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/admin_area/settings/img/ci_shared_runners_build_minutes_quota.png b/doc/user/admin_area/settings/img/ci_shared_runners_build_minutes_quota.png
deleted file mode 100644
index 269a3cf1fbc..00000000000
--- a/doc/user/admin_area/settings/img/ci_shared_runners_build_minutes_quota.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/admin_area/settings/img/group_quota_view.png b/doc/user/admin_area/settings/img/group_quota_view.png
deleted file mode 100644
index 791bfd868e0..00000000000
--- a/doc/user/admin_area/settings/img/group_quota_view.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/admin_area/settings/img/group_settings.png b/doc/user/admin_area/settings/img/group_settings.png
deleted file mode 100644
index a849d9cfdc1..00000000000
--- a/doc/user/admin_area/settings/img/group_settings.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/application_security/container_scanning/index.md b/doc/user/application_security/container_scanning/index.md
index ce86ade3c1a..5c635b09503 100644
--- a/doc/user/application_security/container_scanning/index.md
+++ b/doc/user/application_security/container_scanning/index.md
@@ -122,12 +122,13 @@ container_scanning:
## https://docs.gitlab.com/ee/ci/variables/#predefined-environment-variables
CI_APPLICATION_REPOSITORY: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG
CI_APPLICATION_TAG: $CI_COMMIT_SHA
+ CLAIR_LOCAL_SCAN_VERSION: v2.0.8_fe9b059d930314b54c78f75afe265955faf4fdc1
allow_failure: true
services:
- docker:stable-dind
script:
- docker run -d --name db arminc/clair-db:latest
- - docker run -p 6060:6060 --link db:postgres -d --name clair --restart on-failure arminc/clair-local-scan:v2.0.6
+ - docker run -p 6060:6060 --link db:postgres -d --name clair --restart on-failure arminc/clair-local-scan:${CLAIR_LOCAL_SCAN_VERSION}
- apk add -U wget ca-certificates
- docker pull ${CI_APPLICATION_REPOSITORY}:${CI_APPLICATION_TAG}
- wget https://github.com/arminc/clair-scanner/releases/download/v8/clair-scanner_linux_amd64
@@ -164,12 +165,13 @@ container_scanning:
## https://docs.gitlab.com/ee/ci/variables/#predefined-environment-variables
CI_APPLICATION_REPOSITORY: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG
CI_APPLICATION_TAG: $CI_COMMIT_SHA
+ CLAIR_LOCAL_SCAN_VERSION: v2.0.8_fe9b059d930314b54c78f75afe265955faf4fdc1
allow_failure: true
services:
- docker:stable-dind
script:
- docker run -d --name db arminc/clair-db:latest
- - docker run -p 6060:6060 --link db:postgres -d --name clair --restart on-failure arminc/clair-local-scan:v2.0.6
+ - docker run -p 6060:6060 --link db:postgres -d --name clair --restart on-failure arminc/clair-local-scan:${CLAIR_LOCAL_SCAN_VERSION}
- apk add -U wget ca-certificates
- docker pull ${CI_APPLICATION_REPOSITORY}:${CI_APPLICATION_TAG}
- wget https://github.com/arminc/clair-scanner/releases/download/v8/clair-scanner_linux_amd64
diff --git a/doc/user/application_security/dast/index.md b/doc/user/application_security/dast/index.md
index 904c9e8fefe..abc6e771b0f 100644
--- a/doc/user/application_security/dast/index.md
+++ b/doc/user/application_security/dast/index.md
@@ -47,10 +47,7 @@ applications while you are developing and testing your applications.
## Requirements
To run a DAST job, you need GitLab Runner with the
-[`docker`](https://docs.gitlab.com/runner/executors/docker.html#use-docker-in-docker-with-privileged-mode) or
-[`kubernetes`](https://docs.gitlab.com/runner/install/kubernetes.html#running-privileged-containers-for-the-runners)
-executor running in privileged mode. If you're using the shared Runners on GitLab.com,
-this is enabled by default.
+[`docker` executor](https://docs.gitlab.com/runner/executors/docker.html).
## Configuring DAST
@@ -138,7 +135,7 @@ variables:
#### Customizing the DAST settings
-The SAST settings can be changed through environment variables by using the
+The DAST settings can be changed through environment variables by using the
[`variables`](../../../ci/yaml/README.md#variables) parameter in `.gitlab-ci.yml`.
These variables are documented in the [DAST README](https://gitlab.com/gitlab-org/security-products/dast#settings).
diff --git a/doc/user/application_security/dependency_scanning/index.md b/doc/user/application_security/dependency_scanning/index.md
index 2d0c2be4233..5d2bb4e572b 100644
--- a/doc/user/application_security/dependency_scanning/index.md
+++ b/doc/user/application_security/dependency_scanning/index.md
@@ -19,8 +19,9 @@ merge request.
![Dependency Scanning Widget](img/dependency_scanning.png)
-The results are sorted by the priority of the vulnerability:
+The results are sorted by the severity of the vulnerability:
+1. Critical
1. High
1. Medium
1. Low
diff --git a/doc/user/application_security/security_dashboard/img/dashboard.png b/doc/user/application_security/security_dashboard/img/dashboard.png
index d52a6dacdbf..a75168b1ce4 100644
--- a/doc/user/application_security/security_dashboard/img/dashboard.png
+++ b/doc/user/application_security/security_dashboard/img/dashboard.png
Binary files differ
diff --git a/doc/user/group/clusters/index.md b/doc/user/group/clusters/index.md
index 53c82169e15..ff6aa4f5930 100644
--- a/doc/user/group/clusters/index.md
+++ b/doc/user/group/clusters/index.md
@@ -5,10 +5,10 @@
## Overview
-Similar to [project Kubernetes
-clusters](../../project/clusters/index.md), Group-level Kubernetes
-clusters allow you to connect a Kubernetes cluster to your group,
-enabling you to use the same cluster across multiple projects.
+Similar to [project-level](../../project/clusters/index.md) and
+[instance-level](../../instance/clusters/index.md) Kubernetes clusters,
+group-level Kubernetes clusters allow you to connect a Kubernetes cluster to
+your group, enabling you to use the same cluster across multiple projects.
## Installing applications
diff --git a/doc/user/group/custom_project_templates.md b/doc/user/group/custom_project_templates.md
index 8e101407ac0..f67325272a6 100644
--- a/doc/user/group/custom_project_templates.md
+++ b/doc/user/group/custom_project_templates.md
@@ -1,4 +1,4 @@
-# Custom group-level project templates **[PREMIUM ONLY]**
+# Custom group-level project templates **[PREMIUM]**
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/6861) in [GitLab Premium](https://about.gitlab.com/pricing) 11.6.
diff --git a/doc/user/group/dependency_proxy/img/group_dependency_proxy.png b/doc/user/group/dependency_proxy/img/group_dependency_proxy.png
new file mode 100644
index 00000000000..035aff0b6c4
--- /dev/null
+++ b/doc/user/group/dependency_proxy/img/group_dependency_proxy.png
Binary files differ
diff --git a/doc/user/group/dependency_proxy/index.md b/doc/user/group/dependency_proxy/index.md
new file mode 100644
index 00000000000..4fc2d8e9509
--- /dev/null
+++ b/doc/user/group/dependency_proxy/index.md
@@ -0,0 +1,74 @@
+# Dependency Proxy **[PREMIUM]**
+
+> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/7934) in [GitLab Premium](https://about.gitlab.com/pricing/) 11.11.
+
+NOTE: **Note:**
+This is the user guide. In order to use the dependency proxy, an administrator
+must first [configure it](../../../administration/dependency_proxy.md).
+
+For many organizations, it is desirable to have a local proxy for frequently used
+upstream images/packages. In the case of CI/CD, the proxy is responsible for
+receiving a request and returning the upstream image from a registry, acting
+as a pull-through cache.
+
+The dependency proxy is available in the group level. To access it, navigate to
+a group's **Overview > Dependency Proxy**.
+
+![Dependency Proxy group page](img/group_dependency_proxy.png)
+
+## Supported dependency proxies
+
+NOTE: **Note:**
+For a list of the upcoming additions to the proxies, visit the
+[direction page](https://about.gitlab.com/direction/package/dependency_proxy/#top-vision-items).
+
+The following dependency proxies are supported.
+
+| Dependency proxy | GitLab version |
+| ---------------- | -------------- |
+| Docker | 11.11+ |
+
+## Using the Docker dependency proxy
+
+With the Docker dependency proxy, you can use GitLab as a source for a Docker image.
+To get a Docker image into the dependency proxy:
+
+1. Find the proxy URL on your group's page under **Overview > Dependency Proxy**,
+ for example `gitlab.com/groupname/dependency_proxy/containers`.
+1. Trigger GitLab to pull the Docker image you want (e.g., `alpine:latest` or
+ `linuxserver/nextcloud:latest`) and store it in the proxy storage by using
+ one of the following ways:
+
+ - Manually pulling the Docker image:
+
+ ```bash
+ docker pull gitlab.com/groupname/dependency_proxy/containers/alpine:latest
+ ```
+
+ - From a `Dockerfile`:
+
+ ```bash
+ FROM gitlab.com/groupname/dependency_proxy/containers/alpine:latest
+ ```
+
+ - In [`.gitlab-ci.yml`](../../../ci/yaml/README.md#image):
+
+ ```bash
+ image: gitlab.com/groupname/dependency_proxy/containers/alpine:latest
+ ```
+
+GitLab will then pull the Docker image from Docker Hub and will cache the blobs
+on the GitLab server. The next time you pull the same image, it will get the latest
+information about the image from Docker Hub but will serve the existing blobs
+from GitLab.
+
+The blobs are kept forever, and there is no hard limit on how much data can be
+stored.
+
+## Limitations
+
+The following limitations apply:
+
+- Only public groups are supported (authentication is not supported yet).
+- Only Docker Hub is supported.
+- This feature requires Docker Hub being available.
diff --git a/doc/user/group/img/group_issue_board.png b/doc/user/group/img/group_issue_board.png
deleted file mode 100644
index a0da74a320f..00000000000
--- a/doc/user/group/img/group_issue_board.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/group/img/new_group_form.png b/doc/user/group/img/new_group_form.png
deleted file mode 100644
index 1c4d3ec6ceb..00000000000
--- a/doc/user/group/img/new_group_form.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/group/index.md b/doc/user/group/index.md
index 06564fd6cd1..7493e65e237 100644
--- a/doc/user/group/index.md
+++ b/doc/user/group/index.md
@@ -5,33 +5,35 @@ and grant members access to several projects at once.
Groups can also be nested in [subgroups](subgroups/index.md).
-Find your groups by clicking **Groups** in the top navigation.
+Find your groups by clicking **Groups > Your Groups** in the top navigation.
![GitLab Groups](img/groups.png)
> The groups dropdown in the top navigation was [introduced][ce-36234] in [GitLab 11.1](https://about.gitlab.com/2018/07/22/gitlab-11-1-released/#groups-dropdown-in-navigation).
-The Groups page displays all groups you are a member of, how many projects it holds,
-how many members it has, the group visibility, and, if you have enough permissions,
-a link to the group settings. By clicking the last button you can leave that group.
+The Groups page displays:
+
+- All groups you are a member of.
+- How many projects each group contains.
+- How many members a group has.
+- The group visibility.
+- A link to the group settings if you have sufficient permissions.
+
+By clicking the last button, you can leave that group.
## Use cases
-You can create groups for numerous reasons. To name a few:
-
-- Organize related projects under the same [namespace](#namespaces), add members to that
- group and grant access to all their projects at once
-- Create a group, include members of your team, and make it easier to
- `@mention` all the team at once in issues and merge requests
- - Create a group for your company members, and create [subgroups](subgroups/index.md)
- for each individual team. Let's say you create a group called `company-team`, and among others,
- you created subgroups in this group for each individual team `backend-team`,
- `frontend-team`, and `production-team`:
- 1. When you start a new implementation from an issue, you add a comment:
+You can create groups for numerous reasons. To name a couple:
+
+- Grant access to multiple projects and multiple team members in fewer steps by organizing related projects under the same [namespace](#namespaces) and adding members to the top-level group.
+- Make it easier to `@mention` all of your team at once in issues and merge requests by creating a group and including the appropriate members.
+
+For example, you could create a group for your company members, and create a [subgroup](subgroups/index.md) for each individual team. Let's say you create a group called `company-team`, and you create subgroups in this group for the individual teams `backend-team`, `frontend-team`, and `production-team`.
+ - When you start a new implementation from an issue, you add a comment:
_"`@company-team`, let's do it! `@company-team/backend-team` you're good to go!"_
- 1. When your backend team needs help from frontend, they add a comment:
+ - When your backend team needs help from frontend, they add a comment:
_"`@company-team/frontend-team` could you help us here please?"_
- 1. When the frontend team completes their implementation, they comment:
+ - When the frontend team completes their implementation, they comment:
_"`@company-team/backend-team`, it's done! Let's ship it `@company-team/production-team`!"_
## Namespaces
@@ -59,8 +61,8 @@ By doing so:
## Issues and merge requests within a group
-Issues and merge requests are part of projects. For a given group, view all the
-[issues](../project/issues/index.md#issues-list) and [merge requests](../project/merge_requests/index.md#merge-requests-per-group) across all the projects in that group,
+Issues and merge requests are part of projects. For a given group, you can view all of the
+[issues](../project/issues/index.md#issues-list) and [merge requests](../project/merge_requests/index.md#merge-requests-per-group) across all projects in that group,
together in a single list view.
## Create a new group
@@ -68,13 +70,13 @@ together in a single list view.
> For a list of words that are not allowed to be used as group names see the
> [reserved names](../reserved_names.md).
-You can create a group in GitLab from:
+To create a new Group, either:
-1. The Groups page: from the top menu, click **Groups**, and click the green button **New group**:
+- In the top menu, click **Groups** and then **Your Groups**, and click the green button **New group**.
![new group from groups page](img/new_group_from_groups.png)
-1. Elsewhere: expand the `plus` sign button on the top navbar and choose **New group**:
+- Or, in the top menu, expand the `plus` sign and choose **New group**.
![new group from elsewhere](img/new_group_from_other_pages.png)
@@ -82,18 +84,18 @@ Add the following information:
![new group info](img/create_new_group_info.png)
-1. The **Group name** will populate the URL automatically. Optionally, you can change it.
- This is the name that is displayed in the group views.
+1. The **Group name** will automatically populate the URL. Optionally, you can change it.
+ This is the name that displays in group views.
The name can contain only:
- - Alphanumeric characters.
- - Underscores.
- - Dashes and dots.
- - Spaces.
-1. The **Group URL**, which will be the namespace under which your projects will be hosted.
+ - Alphanumeric characters
+ - Underscores
+ - Dashes and dots
+ - Spaces
+1. The **Group URL** is the namespace under which your projects will be hosted.
The URL can contain only:
- - Alphanumeric characters.
- - Underscores.
- - Dashes and dots. It cannot start with dashes or end in dot.
+ - Alphanumeric characters
+ - Underscores
+ - Dashes and dots (it cannot start with dashes or end in a dot)
1. Optionally, you can add a brief description to tell others
what this group is about.
1. Optionally, choose an avatar for your group.
@@ -101,45 +103,39 @@ Add the following information:
## Add users to a group
-Add members to a group by navigating to the group's dashboard, and clicking **Members**:
+A benefit of putting multiple projects in one group is that you can
+give a user to access to all projects in the group with one action.
-![add members to group](img/add_new_members.png)
+Add members to a group by navigating to the group's dashboard and clicking **Members**.
-Select the [permission level](../permissions.md#permissions) and add the new member. You can also set the expiring
-date for that user, from which they will no longer have access to your group.
+![add members to group](img/add_new_members.png)
-One of the benefits of putting multiple projects in one group is that you can
-give a user to access to all projects in the group with one action.
+Select the [permission level](../permissions.md#permissions), and add the new member. You can also set the expiring date for that user; this is the date on which they will no longer have access to your group.
-Consider we have a group with two projects:
+Consider a group with two projects:
-- On the **Group Members** page we can now add a new user to the group.
-- Now because this user is a **Developer** member of the group, he automatically
+- On the **Group Members** page, you can now add a new user to the group.
+- Now, because this user is a **Developer** member of the group, they automatically
gets **Developer** access to **all projects** within that group.
-If necessary, you can increase the access level of an individual user for a specific project,
-by adding them again as a new member to the project with the new permission levels.
+To increase the access level of an existing user for a specific project,
+add them again as a new member to the project with the desired permission level.
## Request access to a group
-As a group owner you can enable or disable non members to request access to
-your group. Go to the group settings and click on **Allow users to request access**.
+As a group owner, you can enable or disable the ability for non members to request access to
+your group. Go to the group settings, and click **Allow users to request access**.
-As a user, you can request to be a member of a group. Go to the group you'd
-like to be a member of, and click the **Request Access** button on the right
+As a user, you can request to be a member of a group, if that setting is enabled. Go to the group for which you'd like to be a member, and click the **Request Access** button on the right
side of your screen.
![Request access button](img/request_access_button.png)
----
-
Group owners and maintainers will be notified of your request and will be able to approve or
decline it on the members page.
![Manage access requests](img/access_requests_management.png)
----
-
If you change your mind before your request is approved, just click the
**Withdraw Access Request** button.
@@ -149,29 +145,27 @@ If you change your mind before your request is approved, just click the
There are two different ways to add a new project to a group:
-- Select a group and then click on the **New project** button.
+- Select a group, and then click **New project**. You can then continue [creating your project](../../gitlab-basics/create-project.md).
![New project](img/create_new_project_from_group.png)
- You can then continue on [creating a project](../../gitlab-basics/create-project.md).
-
- While you are creating a project, select a group namespace
you've already created from the dropdown menu.
![Select group](img/select_group_dropdown.png)
-### Default project creation level
+### Default project-creation level
> [Introduced][ee-2534] in [GitLab Premium][ee] 10.5.
> Brought to [GitLab Starter][ee] in 10.7.
> [Moved](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/25975) to [GitLab Core](https://about.gitlab.com/pricing/) in 11.10.
-Group owners or administrators can allow users with the
+Group owners and administrators can allow users with the
Developer role to create projects under groups.
-By default, [Developers and Maintainers](../permissions.md#group-members-permissions) can create projects under a group, but this can be changed either within the group settings for a group, or
-be set globally by a GitLab administrator in the Admin area
-at **Settings > General > Visibility and access controls**.
+By default, [Developers and Maintainers](../permissions.md#group-members-permissions) can create projects under a group. You can change this setting for a specific group within the group settings, or
+you can set this option globally in the Admin area
+at **Settings > General > Visibility and access controls** (you must be a GitLab administrator).
Available settings are `No one`, `Maintainers`, or `Developers + Maintainers`.
@@ -182,13 +176,13 @@ Learn how to [transfer a project into a group](../project/settings/index.md#tran
## Sharing a project with a group
You can [share your projects with a group](../project/members/share_project_with_groups.md)
-and give your group members access to the project all at once.
+and give all group members access to the project at once.
Alternatively, you can [lock the sharing with group feature](#share-with-group-lock).
## Manage group memberships via LDAP
-In GitLab Enterprise Edition it is possible to manage GitLab group memberships using LDAP groups.
+In GitLab Enterprise Edition, it is possible to manage GitLab group memberships using LDAP groups.
See [the GitLab Enterprise Edition documentation](../../integration/ldap.md) for more information.
## Epics **[ULTIMATE]**
@@ -211,38 +205,42 @@ Get an overview of the vulnerabilities of all the projects in a group and its su
> Introduced in [GitLab Ultimate][ee] 11.9 behind the `insights` feature flag.
-Configure the Insights that matter for your groups or projects to explore data
-such as triage hygiene, issues created/closed per a given period, average time
-for merge requests to be merged and much more.
+Configure the Insights that matter for your groups or projects, allowing users to explore data
+such as:
+
+- Triage hygiene
+- Issues created/closed per a given period
+- Average time for merge requests to be merged
+- Much more
[Learn more about Insights](insights/index.md).
## Transferring groups
-From GitLab 10.5, groups can be transferred in the following ways:
+From GitLab 10.5, you can transfer groups in the following ways:
-- Top-level groups can be transferred to a group, converting them into subgroups.
-- Subgroups can be transferred to a new parent group.
-- Subgroups can be transferred out from a parent group, converting them into top-level groups.
+- Transfer a subgroup to a new parent group.
+- Convert a top-level group into a subgroup by transfering it to the desired group.
+- Convert a subgroup into a top-level group by transfering it out of its current group.
When transferring groups, note:
- Changing a group's parent can have unintended side effects. See [Redirects when changing repository paths](../project/index.md#redirects-when-changing-repository-paths).
- You can only transfer groups to groups you manage.
-- You will need to update your local repositories to point to the new location.
-- If the parent group's visibility is lower than the group's current visibility, visibility levels for subgroups and projects will be changed to match the new parent group's visibility.
-- Only explicit group membership is transferred, not inherited membership. If the group's owners have only inherited membership, this would leave the group without an owner. In this case, the user transferring the group becomes the group's owner.
+- You must update your local repositories to point to the new location.
+- If the parent group's visibility is lower than the group's current visibility, visibility levels for subgroups and projects will change to match the new parent group's visibility.
+- Only explicit group membership is transferred, not inherited membership. If the group's owners have only inherited membership, this leaves the group without an owner. In this case, the user transferring the group becomes the group's owner.
## Group settings
-Once you have created a group, you can manage its settings by navigating to
+After creating a group, you can manage its settings by navigating to
the group's dashboard, and clicking **Settings**.
![group settings](img/group_settings.png)
### General settings
-Besides giving you the option to edit any settings you've previously
+In addition to editing any settings you previously
set when [creating the group](#create-a-new-group), you can also
access further configurations for your group.
@@ -253,14 +251,14 @@ Changing a group's path can have unintended side effects. Read
before proceeding.
If you are vacating the path so it can be claimed by another group or user,
-you may need to rename the group name as well since both names and paths must
+you may need to rename the group, too, since both names and paths must
be unique.
To change your group path:
1. Navigate to your group's **Settings > General**.
-1. Enter a new name under "Group path".
-1. Hit **Save group**.
+1. Enter a new name under **Group path**.
+1. Click **Save group**.
CAUTION: **Caution:**
It is currently not possible to rename a namespace if it contains a
@@ -276,20 +274,17 @@ username, you can create a new group and transfer projects to it.
Add a security layer to your group by
[enforcing two-factor authentication (2FA)](../../security/two_factor_authentication.md#enforcing-2fa-for-all-users-in-a-group)
-to all group members.
+for all group members.
#### Share with group lock
Prevent projects in a group from [sharing
-a project with another group](../project/members/share_project_with_groups.md).
-This allows for tighter control over project access.
+a project with another group](../project/members/share_project_with_groups.md) to enable tighter control over project access.
-For example, consider you have two distinct teams (Group A and Group B)
-working together in a project.
-To inherit the group membership, you share the project between the
+For example, let's say you have two distinct teams (Group A and Group B) working together in a project, and to inherit the group membership, you share the project between the
two groups A and B. **Share with group lock** prevents any project within
-the group from being shared with another group. By doing so, you
-guarantee only the right group members have access to those projects.
+the group from being shared with another group,
+guaranteeing that only the right group members have access to those projects.
To enable this feature, navigate to the group settings page. Select
**Share with group lock** and **Save the group**.
@@ -298,25 +293,22 @@ To enable this feature, navigate to the group settings page. Select
#### Member Lock **[STARTER]**
-With Member lock, it is possible to lock membership in a project to the
-level of members in the group.
+Member lock lets a group owner prevent any new project membership to all of the
+projects within a group, allowing tighter control over project membership.
-Member lock lets a group owner lock down any new project membership to all the
-projects within the group, allowing tighter control over project membership.
-
-For instance, if you want to lock the group for an [Audit Event](https://docs.gitlab.com/ee/administration/audit_events.html),
-you enable Member lock to guarantee that membership of a project cannot be modified during that audit.
+For example, if you want to lock the group for an [Audit Event](https://docs.gitlab.com/ee/administration/audit_events.html),
+enable Member lock to guarantee that project membership cannot be modified during that audit.
To enable this feature:
1. Navigate to the group's **Settings > General** page.
-1. Expand the **Permissions, LFS, 2FA** section and select **Member lock**.
-1. Click the **Save changes** button.
+1. Expand the **Permissions, LFS, 2FA** section, and select **Member lock**.
+1. Click **Save changes**.
![Checkbox for membership lock](img/member_lock.png)
This will disable the option for all users who previously had permissions to
-operate project memberships so no new users can be added. Furthermore, any
+operate project memberships, so no new users can be added. Furthermore, any
request to add a new user to a project through API will not be possible.
#### Group file templates **[PREMIUM]**
@@ -327,11 +319,11 @@ types with every project in a group. It is analogous to the
feature, and the selected project should follow the same naming conventions as
are documented on that page.
-Only projects that are in the group may be chosen as the source of templates.
-This includes projects shared with the group, but **excludes** projects in
+You can only choose projects in the group as the template source.
+This includes projects shared with the group, but it **excludes** projects in
subgroups or parent groups of the group being configured.
-This feature may be configured for subgroups as well as parent groups. A project
+You can configure this feature for both subgroups and parent groups. A project
in a subgroup will have access to the templates for that subgroup, as well as
any parent groups.
@@ -345,28 +337,32 @@ To enable this feature, navigate to the group settings page, expand the
#### Group-level project templates **[PREMIUM]**
-Define project templates at a group-level by setting a group as a template source.
+Define project templates at a group level by setting a group as the template source.
[Learn more about group-level project templates](custom_project_templates.md).
### Advanced settings
-- **Projects**: view all projects within that group, add members to each project,
- access each project's settings, and remove any project from the same screen.
-- **Webhooks**: configure [webhooks](../project/integrations/webhooks.md) to your group.
-- **Kubernetes cluster integration**: connect your GitLab group with [Kubernetes clusters](clusters/index.md).
-- **Audit Events**: view [Audit Events](https://docs.gitlab.com/ee/administration/audit_events.html)
+- **Projects**: View all projects within that group, add members to each project,
+ access each project's settings, and remove any project, all from the same screen.
+- **Webhooks**: Configure [webhooks](../project/integrations/webhooks.md) for your group.
+- **Kubernetes cluster integration**: Connect your GitLab group with [Kubernetes clusters](clusters/index.md).
+- **Audit Events**: View [Audit Events](https://docs.gitlab.com/ee/administration/audit_events.html)
for the group. **[STARTER ONLY]**
-- **Pipelines quota**: keep track of the [pipeline quota](../admin_area/settings/continuous_integration.md) for the group.
+- **Pipelines quota**: Keep track of the [pipeline quota](../admin_area/settings/continuous_integration.md) for the group.
## User contribution analysis **[STARTER]**
-With [GitLab Contribution Analytics](contribution_analytics/index.md)
+With [GitLab Contribution Analytics](contribution_analytics/index.md),
you have an overview of the contributions (pushes, merge requests,
and issues) performed by your group members.
## Issues analytics **[PREMIUM]**
-With [GitLab Issues Analytics](issues_analytics/index.md), in groups, you can see a bar chart of the number of issues created each month.
+With [GitLab Issues Analytics](issues_analytics/index.md), you can see a bar chart of the number of issues created each month in your groups.
+
+## Dependency Proxy **[PREMIUM]**
+
+Use GitLab as a [dependency proxy](dependency_proxy/index.md) for upstream Docker images.
[ee]: https://about.gitlab.com/pricing/
[ee-2534]: https://gitlab.com/gitlab-org/gitlab-ee/issues/2534
diff --git a/doc/user/group/insights/img/insights_sidebar_link.png b/doc/user/group/insights/img/insights_sidebar_link.png
new file mode 100644
index 00000000000..64bbd1fc4d3
--- /dev/null
+++ b/doc/user/group/insights/img/insights_sidebar_link.png
Binary files differ
diff --git a/doc/user/group/insights/index.md b/doc/user/group/insights/index.md
index 5283d8da77d..20f76c54ae7 100644
--- a/doc/user/group/insights/index.md
+++ b/doc/user/group/insights/index.md
@@ -4,8 +4,8 @@
CAUTION: **Beta:**
Insights is considered beta, and is not ready for production use.
-Follow [gitlab-org&725](https://gitlab.com/groups/gitlab-org/-/epics/725) for
-updates.
+Follow [gitlab-org/quality/team-tasks#137](https://gitlab.com/gitlab-org/quality/team-tasks/issues/137#general-availability)
+for updates.
Configure the Insights that matter for your groups to explore data such as
triage hygiene, issues created/closed per a given period, average time for merge
@@ -13,6 +13,13 @@ requests to be merged and much more.
![Insights example stacked bar chart](img/insights_example_stacked_bar_chart.png)
+## View your group's Insights
+
+You can access your group's Insights by clicking the **Overview > Insights**
+link in the left sidebar:
+
+![Insights sidebar link](img/insights_sidebar_link.png)
+
## Configure your Insights
Navigate to your group's **Settings > General**, expand **Insights**, and choose
diff --git a/doc/user/group/saml_sso/index.md b/doc/user/group/saml_sso/index.md
index ee3137d032e..53116606201 100644
--- a/doc/user/group/saml_sso/index.md
+++ b/doc/user/group/saml_sso/index.md
@@ -22,8 +22,16 @@ SAML SSO for groups is used only as a convenient way to add users and does not s
![Issuer and callback for configuring SAML identity provider with GitLab.com](img/group_saml_configuration_information.png)
-NOTE: **Note:**
-Partial SSO enforcement was introduced in [11.8](https://gitlab.com/gitlab-org/gitlab-ee/issues/5291). With this option enabled, users must use your group's GitLab single sign on URL to be added to the group or be added via SCIM. Users can no longer be added manually. After a user has been added to the group, GitLab does not continue to enforce the use of SSO, but we'll [add a persistent check](https://gitlab.com/gitlab-org/gitlab-ee/issues/9255) in a later version.
+### SSO enforcement
+
+SSO enforcement was:
+
+- [Introduced in GitLab 11.8](https://gitlab.com/gitlab-org/gitlab-ee/issues/5291).
+- [Improved upon in GitLab 11.11 with ongoing enforcement in the GitLab UI](https://gitlab.com/gitlab-org/gitlab-ee/issues/9255).
+
+With this option enabled, users must use your group's GitLab single sign on URL to be added to the group or be added via SCIM. Users cannot be added manually, and may only access project/group resources via the UI by signing in through the SSO URL.
+
+We intend to add a similar SSO requirement for [Git and API activity](https://gitlab.com/gitlab-org/gitlab-ee/issues/9152) in the future.
### NameID
diff --git a/doc/user/instance/clusters/index.md b/doc/user/instance/clusters/index.md
new file mode 100644
index 00000000000..894f83d3c75
--- /dev/null
+++ b/doc/user/instance/clusters/index.md
@@ -0,0 +1,23 @@
+# Instance-level Kubernetes clusters
+
+> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/39840) in GitLab 11.11.
+> Instance-level cluster integration is currently in [Beta](https://about.gitlab.com/handbook/product/#alpha-beta-ga).
+
+## Overview
+
+Similar to [project-level](../../project/clusters/index.md)
+and [group-level](../../group/clusters/index.md) Kubernetes clusters,
+instance-level Kubernetes clusters allow you to connect a Kubernetes cluster to
+the GitLab instance, which enables you to use the same cluster across multiple
+projects.
+
+## Cluster precedence
+
+GitLab will try match to clusters in the following order:
+
+- Project-level clusters
+- Group-level clusters
+- Instance level
+
+To be selected, the cluster must be enabled and
+match the [environment selector](../../../ci/environments.md#scoping-environments-with-specs-premium).
diff --git a/doc/user/markdown.md b/doc/user/markdown.md
index c4f9fe45211..5dad9621802 100644
--- a/doc/user/markdown.md
+++ b/doc/user/markdown.md
@@ -286,15 +286,15 @@ On Linux, you can download [Noto Color Emoji](https://www.google.com/get/noto/he
Ubuntu 18.04 (like many modern Linux distros) has this font installed by default.
```
-Sometimes you want to <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/public/-/emojis/1/monkey.png" width="20px" height="20px" style="display:inline;margin:0"> around a bit and add some <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/public/-/emojis/1/star2.png" width="20px" height="20px" style="display:inline;margin:0"> to your <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/public/-/emojis/1/speech_balloon.png" width="20px" height="20px" style="display:inline;margin:0">. Well we have a gift for you:
+Sometimes you want to <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/app/assets/images/emoji/monkey.png" width="20px" height="20px" style="display:inline;margin:0"> around a bit and add some <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/app/assets/images/emoji/star2.png" width="20px" height="20px" style="display:inline;margin:0"> to your <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/app/assets/images/emoji/speech_balloon.png" width="20px" height="20px" style="display:inline;margin:0">. Well we have a gift for you:
-<img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/public/-/emojis/1/zap.png" width="20px" height="20px" style="display:inline;margin:0">You can use emoji anywhere GFM is supported. <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/public/-/emojis/1/v.png" width="20px" height="20px" style="display:inline;margin:0">
+<img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/app/assets/images/emoji/zap.png" width="20px" height="20px" style="display:inline;margin:0">You can use emoji anywhere GFM is supported. <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/app/assets/images/emoji/v.png" width="20px" height="20px" style="display:inline;margin:0">
-You can use it to point out a <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/public/-/emojis/1/bug.png" width="20px" height="20px" style="display:inline;margin:0"> or warn about <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/public/-/emojis/1/speak_no_evil.png" width="20px" height="20px" style="display:inline;margin:0"> patches. And if someone improves your really <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/public/-/emojis/1/snail.png" width="20px" height="20px" style="display:inline;margin:0"> code, send them some <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/public/-/emojis/1/birthday.png" width="20px" height="20px" style="display:inline;margin:0">. People will <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/public/-/emojis/1/heart.png" width="20px" height="20px" style="display:inline;margin:0"> you for that.
+You can use it to point out a <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/app/assets/images/emoji/bug.png" width="20px" height="20px" style="display:inline;margin:0"> or warn about <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/app/assets/images/emoji/speak_no_evil.png" width="20px" height="20px" style="display:inline;margin:0"> patches. And if someone improves your really <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/app/assets/images/emoji/snail.png" width="20px" height="20px" style="display:inline;margin:0"> code, send them some <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/app/assets/images/emoji/birthday.png" width="20px" height="20px" style="display:inline;margin:0">. People will <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/app/assets/images/emoji/heart.png" width="20px" height="20px" style="display:inline;margin:0"> you for that.
-If you are new to this, don't be <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/public/-/emojis/1/fearful.png" width="20px" height="20px" style="display:inline;margin:0">. You can easily join the emoji <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/public/-/emojis/1/family.png" width="20px" height="20px" style="display:inline;margin:0">. All you need to do is to look up one of the supported codes.
+If you are new to this, don't be <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/app/assets/images/emoji/fearful.png" width="20px" height="20px" style="display:inline;margin:0">. You can easily join the emoji <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/app/assets/images/emoji/family.png" width="20px" height="20px" style="display:inline;margin:0">. All you need to do is to look up one of the supported codes.
-Consult the [Emoji Cheat Sheet](https://www.webfx.com/tools/emoji-cheat-sheet/) for a list of all supported emoji codes. <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/public/-/emojis/1/thumbsup.png" width="20px" height="20px" style="display:inline;margin:0">
+Consult the [Emoji Cheat Sheet](https://www.webfx.com/tools/emoji-cheat-sheet/) for a list of all supported emoji codes. <img src="https://gitlab.com/gitlab-org/gitlab-ce/raw/master/app/assets/images/emoji/thumbsup.png" width="20px" height="20px" style="display:inline;margin:0">
Most emoji are natively supported on macOS, Windows, iOS, Android and will fallback to image-based emoji where there is lack of support.
diff --git a/doc/user/permissions.md b/doc/user/permissions.md
index 9b298e4eb30..318053fdabb 100644
--- a/doc/user/permissions.md
+++ b/doc/user/permissions.md
@@ -11,7 +11,7 @@ project itself, the highest permission level is used.
On public and internal projects the Guest role is not enforced. All users will
be able to create issues, leave comments, and clone or download the project code.
-When a member leaves the team all the assigned [Issues](project/issues/index.md) and [Merge Requests](project/merge_requests/index.md)
+When a member leaves a team's project, all the assigned [Issues](project/issues/index.md) and [Merge Requests](project/merge_requests/index.md)
will be unassigned automatically.
GitLab [administrators](../administration/index.md) receive all permissions.
diff --git a/doc/user/project/clusters/index.md b/doc/user/project/clusters/index.md
index 157afb3a78c..3bc3beb2055 100644
--- a/doc/user/project/clusters/index.md
+++ b/doc/user/project/clusters/index.md
@@ -19,8 +19,10 @@ or provide the credentials to an [existing Kubernetes cluster](#adding-an-existi
NOTE: **Note:**
From [GitLab 11.6](https://gitlab.com/gitlab-org/gitlab-ce/issues/34758) you
-can also associate a Kubernetes cluster to your groups. Learn more about
-[group Kubernetes clusters](../../group/clusters/index.md).
+can also associate a Kubernetes cluster to your groups and from
+[GitLab 11.11](https://gitlab.com/gitlab-org/gitlab-ce/issues/39840),
+to the GitLab instance. Learn more about [group-level](../../group/clusters/index.md)
+and [instance-level](../../instance/clusters/index.md) Kubernetes clusters.
## Adding and creating a new GKE cluster via GitLab
@@ -423,9 +425,9 @@ To uninstall an application:
1. Select your cluster.
1. Click the **Uninstall** button for the application.
-Support for uninstalling all applications will be progressively
-introduced (see [related
-epic](https://gitlab.com/groups/gitlab-org/-/epics/1201)).
+Support for uninstalling all applications is planned for progressive rollout.
+To follow progress, see [the relevant
+epic](https://gitlab.com/groups/gitlab-org/-/epics/1201).
### Troubleshooting applications
@@ -674,11 +676,6 @@ To remove the Kubernetes cluster integration from your project, simply click the
**Remove integration** button. You will then be able to follow the procedure
and add a Kubernetes cluster again.
-## View Kubernetes pod logs from GitLab **[ULTIMATE]**
-
-Learn how to easily
-[view the logs of running pods in connected Kubernetes clusters](kubernetes_pod_logs.md).
-
## What you can get with the Kubernetes integration
Here's what you can do with GitLab if you enable the Kubernetes integration.
@@ -701,6 +698,12 @@ the need to leave GitLab.
[Read more about Canary Deployments](https://docs.gitlab.com/ee/user/project/canary_deployments.html)
+### Pod logs **[ULTIMATE]**
+
+GitLab makes it easy to view the logs of running pods in connected Kubernetes clusters. By displaying the logs directly in GitLab, developers can avoid having to manage console tools or jump to a different interface.
+
+[Read more about Kubernetes pod logs](kubernetes_pod_logs.md)
+
### Kubernetes monitoring
Automatically detect and monitor Kubernetes metrics. Automatic monitoring of
diff --git a/doc/user/project/code_owners.md b/doc/user/project/code_owners.md
index a4937e6cf6b..ae04616943f 100644
--- a/doc/user/project/code_owners.md
+++ b/doc/user/project/code_owners.md
@@ -43,7 +43,7 @@ Example `CODEOWNERS` file:
# app/ @commented-rule
-# We can specifiy a default match using wildcards:
+# We can specify a default match using wildcards:
* @default-codeowner
# Rules defined later in the file take precedence over the rules
diff --git a/doc/user/project/img/assignee_lists.png b/doc/user/project/img/assignee_lists.png
deleted file mode 100644
index f2660cd8f80..00000000000
--- a/doc/user/project/img/assignee_lists.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/img/issue_board.png b/doc/user/project/img/issue_board.png
deleted file mode 100644
index b753593d212..00000000000
--- a/doc/user/project/img/issue_board.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/img/labels_sidebar_inline.png b/doc/user/project/img/labels_sidebar_inline.png
deleted file mode 100644
index 2186f14ea92..00000000000
--- a/doc/user/project/img/labels_sidebar_inline.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/img/priority_sort_order.png b/doc/user/project/img/priority_sort_order.png
deleted file mode 100644
index cd1dd8237c0..00000000000
--- a/doc/user/project/img/priority_sort_order.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/img/project_security_dashboard.png b/doc/user/project/img/project_security_dashboard.png
deleted file mode 100644
index 3294e59e943..00000000000
--- a/doc/user/project/img/project_security_dashboard.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/img/protected_branches_choose_branch.png b/doc/user/project/img/protected_branches_choose_branch.png
deleted file mode 100644
index c2848db9c96..00000000000
--- a/doc/user/project/img/protected_branches_choose_branch.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/img/protected_branches_error_ui.png b/doc/user/project/img/protected_branches_error_ui.png
deleted file mode 100644
index 62839e49d89..00000000000
--- a/doc/user/project/img/protected_branches_error_ui.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/import/img/import_projects_from_github_select_auth_method.png b/doc/user/project/import/img/import_projects_from_github_select_auth_method.png
deleted file mode 100644
index 90e6243aec0..00000000000
--- a/doc/user/project/import/img/import_projects_from_github_select_auth_method.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/insights/img/insights_sidebar_link.png b/doc/user/project/insights/img/insights_sidebar_link.png
new file mode 100644
index 00000000000..aadb5745992
--- /dev/null
+++ b/doc/user/project/insights/img/insights_sidebar_link.png
Binary files differ
diff --git a/doc/user/project/insights/index.md b/doc/user/project/insights/index.md
index 720f4c6604e..b6cc1862cc2 100644
--- a/doc/user/project/insights/index.md
+++ b/doc/user/project/insights/index.md
@@ -4,18 +4,25 @@
CAUTION: **Beta:**
Insights is considered beta, and is not ready for production use.
-Follow [gitlab-org&725](https://gitlab.com/groups/gitlab-org/-/epics/725) for
-updates.
+Follow [gitlab-org/quality/team-tasks#137](https://gitlab.com/gitlab-org/quality/team-tasks/issues/137#general-availability)
+for updates.
Configure the Insights that matter for your projects to explore data such as
triage hygiene, issues created/closed per a given period, average time for merge
requests to be merged and much more.
-![Insights example stacked bar chart](img/project_insights.png)
+![Insights example bar chart](img/project_insights.png)
NOTE: **Note:**
This feature is [also available at the group level](https://docs.gitlab.com/ee/user/group/insights/index.html).
+## View your project's Insights
+
+You can access your project's Insights by clicking the **Project > Insights**
+link in the left sidebar:
+
+![Insights sidebar link](img/insights_sidebar_link.png)
+
## Configure your Insights
Insights are configured using a YAML file called `.gitlab/insights.yml` within
@@ -74,8 +81,7 @@ Each chart definition is made up of a hash composed of key-value pairs.
For example, here's single chart definition:
```yaml
-monthlyBugsCreated:
- title: Monthly Bugs Created (bar)
+- title: Monthly Bugs Created (bar)
type: bar
query:
issuable_type: issue
diff --git a/doc/user/project/integrations/img/jira_project_name.png b/doc/user/project/integrations/img/jira_project_name.png
deleted file mode 100644
index 981c7f7ca18..00000000000
--- a/doc/user/project/integrations/img/jira_project_name.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/integrations/img/jira_service.png b/doc/user/project/integrations/img/jira_service.png
deleted file mode 100644
index 0ae2fa28756..00000000000
--- a/doc/user/project/integrations/img/jira_service.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/integrations/img/mattermost_configuration.png b/doc/user/project/integrations/img/mattermost_configuration.png
index e0b55b23520..75ef0310f2d 100644
--- a/doc/user/project/integrations/img/mattermost_configuration.png
+++ b/doc/user/project/integrations/img/mattermost_configuration.png
Binary files differ
diff --git a/doc/user/project/integrations/img/prometheus_yaml_deploy.png b/doc/user/project/integrations/img/prometheus_yaml_deploy.png
deleted file mode 100644
index 78dd178a077..00000000000
--- a/doc/user/project/integrations/img/prometheus_yaml_deploy.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/integrations/img/slack_configuration.png b/doc/user/project/integrations/img/slack_configuration.png
index 53b30e0e8cd..a14d2969488 100644
--- a/doc/user/project/integrations/img/slack_configuration.png
+++ b/doc/user/project/integrations/img/slack_configuration.png
Binary files differ
diff --git a/doc/user/project/integrations/mattermost.md b/doc/user/project/integrations/mattermost.md
index 8c5461de42f..d7fd75fd728 100644
--- a/doc/user/project/integrations/mattermost.md
+++ b/doc/user/project/integrations/mattermost.md
@@ -27,9 +27,11 @@ There, you will see a checkbox with the following events that can be triggered:
- Confidential issue
- Merge request
- Note
+- Confidential note
- Tag push
- Pipeline
- Wiki page
+- Deployment
Below each of these event checkboxes, you have an input field to enter
which Mattermost channel you want to send that event message. Enter your preferred channel handle (the hash sign `#` is optional).
diff --git a/doc/user/project/integrations/prometheus.md b/doc/user/project/integrations/prometheus.md
index 40113624430..751e8e44e60 100644
--- a/doc/user/project/integrations/prometheus.md
+++ b/doc/user/project/integrations/prometheus.md
@@ -168,7 +168,7 @@ Alerts can be used to trigger actions, like open an issue automatically. To conf
1. Optionally, select whether to send an email notification to the developers of the project.
1. Click **Save changes**.
-Once enabled, an issue will be opened automatically when an alert is triggered. To further customize the issue, you can add labels, mentions, or any other supported [quick action](../quick_actions.md) in the selected issue template.
+Once enabled, an issue will be opened automatically when an alert is triggered. The author of the issue will be the GitLab Alert Bot. To further customize the issue, you can add labels, mentions, or any other supported [quick action](../quick_actions.md) in the selected issue template.
If the metric exceeds the threshold of the alert for over 5 minutes, an email will be sent to all [Maintainers and Owners](../../permissions.md#project-members-permissions) of the project.
diff --git a/doc/user/project/integrations/webhooks.md b/doc/user/project/integrations/webhooks.md
index 10eb3a4f3b7..a0f500a939f 100644
--- a/doc/user/project/integrations/webhooks.md
+++ b/doc/user/project/integrations/webhooks.md
@@ -1016,7 +1016,7 @@ X-Gitlab-Event: Pipeline Hook
"email": "user@gitlab.com"
}
},
- "jobs":[
+ "builds":[
{
"id": 380,
"stage": "deploy",
diff --git a/doc/user/project/issues/csv_import.md b/doc/user/project/issues/csv_import.md
index 032e3a73ad0..b0b1cfcfdf7 100644
--- a/doc/user/project/issues/csv_import.md
+++ b/doc/user/project/issues/csv_import.md
@@ -1,17 +1,23 @@
-# Importing Issues from CSV
+# Importing issues from CSV
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23532) in GitLab 11.7.
-Issues can be imported to a project by uploading a CSV file. Supported fields are
-`title` and `description`.
+Issues can be imported to a project by uploading a CSV file with the columns
+`title` and `description`, in that order.
The user uploading the CSV file will be set as the author of the imported issues.
> **Note:** A permission level of `Developer` or higher is required to import issues.
+## Prepare for the import
+
+- Consider importing a test file containing only a few issues. There is no way to undo a large import without using the GitLab API.
+- Ensure your CSV file meets the [file format](#csv-file-format) requirements.
+
+## Import the file
+
To import issues:
-1. Ensure your CSV file meets the [file format](#csv-file-format) requirements.
1. Navigate to a project's Issues list page.
1. If existing issues are present, click the import icon at the top right, next to the **Edit issues** button.
1. For a project without any issues, click the button labeled **Import CSV** in the middle of the page.
@@ -20,11 +26,11 @@ To import issues:
The file is processed in the background and a notification email is sent
to you once the import is completed.
-## CSV File Format
+## CSV file format
### Header row
-CSV files must contain a header row beginning with at least two columns, `title` and `description`, in that order.
+CSV files must contain a header row where the first column header is `title` and the second is `description`.
If additional columns are present, they will be ignored.
### Column separator
@@ -53,7 +59,7 @@ The limit depends on the configuration value of Max Attachment Size for the GitL
For GitLab.com, it is set to 10 MB.
-## Sample Data
+## Sample data
```csv
title,description
diff --git a/doc/user/project/issues/img/group_issues_list_view.png b/doc/user/project/issues/img/group_issues_list_view.png
deleted file mode 100644
index c951a9e2dcd..00000000000
--- a/doc/user/project/issues/img/group_issues_list_view.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/issues/img/issue_template.png b/doc/user/project/issues/img/issue_template.png
deleted file mode 100644
index 6cb2c07d27e..00000000000
--- a/doc/user/project/issues/img/issue_template.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/labels.md b/doc/user/project/labels.md
index ac91cd4ea98..8e9e9aa79cf 100644
--- a/doc/user/project/labels.md
+++ b/doc/user/project/labels.md
@@ -131,7 +131,7 @@ From the project issue list page and the project merge request list page, you ca
From the group issue list page and the group merge request list page, you can [filter](../search/index.md#issues-and-merge-requests) by both group labels (including subgroup ancestors and subgroup descendants) and project labels.
-From the group epic list page, you can [filter](../search/index.md#issues-and-merge-requests) by both current group labels as well as decendent group labels.
+From the group epic list page, you can [filter](../search/index.md#issues-and-merge-requests) by both current group labels as well as descendant group labels.
![Labels group issues](img/labels_group_issues.png)
diff --git a/doc/user/project/members/img/add_new_user_to_project_settings.png b/doc/user/project/members/img/add_new_user_to_project_settings.png
deleted file mode 100644
index e49ea1a3e3d..00000000000
--- a/doc/user/project/members/img/add_new_user_to_project_settings.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/members/img/add_user_members_menu.png b/doc/user/project/members/img/add_user_members_menu.png
deleted file mode 100644
index 6f08088b52f..00000000000
--- a/doc/user/project/members/img/add_user_members_menu.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/members/img/max_access_level.png b/doc/user/project/members/img/max_access_level.png
deleted file mode 100644
index 42a0416ffbb..00000000000
--- a/doc/user/project/members/img/max_access_level.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/merge_requests/img/container_scanning.png b/doc/user/project/merge_requests/img/container_scanning.png
deleted file mode 100644
index e47f62acd9d..00000000000
--- a/doc/user/project/merge_requests/img/container_scanning.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/merge_requests/img/create-issue-with-list-hover.png b/doc/user/project/merge_requests/img/create-issue-with-list-hover.png
deleted file mode 100644
index 7d70e8299f5..00000000000
--- a/doc/user/project/merge_requests/img/create-issue-with-list-hover.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/merge_requests/img/dast_all.png b/doc/user/project/merge_requests/img/dast_all.png
deleted file mode 100644
index b6edc928dc3..00000000000
--- a/doc/user/project/merge_requests/img/dast_all.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/merge_requests/img/dast_single.png b/doc/user/project/merge_requests/img/dast_single.png
deleted file mode 100644
index 26ca4bde786..00000000000
--- a/doc/user/project/merge_requests/img/dast_single.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/merge_requests/img/dependency_scanning.png b/doc/user/project/merge_requests/img/dependency_scanning.png
deleted file mode 100644
index 18df356f846..00000000000
--- a/doc/user/project/merge_requests/img/dependency_scanning.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/merge_requests/img/interactive_reports.png b/doc/user/project/merge_requests/img/interactive_reports.png
deleted file mode 100644
index 9f9812dc69d..00000000000
--- a/doc/user/project/merge_requests/img/interactive_reports.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/merge_requests/img/license_management.png b/doc/user/project/merge_requests/img/license_management.png
deleted file mode 100644
index cdce6b5fe38..00000000000
--- a/doc/user/project/merge_requests/img/license_management.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/merge_requests/img/license_management_decision.png b/doc/user/project/merge_requests/img/license_management_decision.png
deleted file mode 100644
index 0763130c375..00000000000
--- a/doc/user/project/merge_requests/img/license_management_decision.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/merge_requests/img/license_management_pipeline_tab.png b/doc/user/project/merge_requests/img/license_management_pipeline_tab.png
deleted file mode 100644
index 80ffca815b9..00000000000
--- a/doc/user/project/merge_requests/img/license_management_pipeline_tab.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/merge_requests/img/license_management_settings.png b/doc/user/project/merge_requests/img/license_management_settings.png
deleted file mode 100644
index b5490e59074..00000000000
--- a/doc/user/project/merge_requests/img/license_management_settings.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/merge_requests/img/revert_changes_commit.png b/doc/user/project/merge_requests/img/revert_changes_commit.png
deleted file mode 100644
index c9dd0019024..00000000000
--- a/doc/user/project/merge_requests/img/revert_changes_commit.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/merge_requests/img/revert_changes_mr.png b/doc/user/project/merge_requests/img/revert_changes_mr.png
deleted file mode 100644
index 06b841b3002..00000000000
--- a/doc/user/project/merge_requests/img/revert_changes_mr.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/merge_requests/img/sast.png b/doc/user/project/merge_requests/img/sast.png
deleted file mode 100644
index 2c75592c32a..00000000000
--- a/doc/user/project/merge_requests/img/sast.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/merge_requests/img/security_report.png b/doc/user/project/merge_requests/img/security_report.png
deleted file mode 100644
index ba41b707238..00000000000
--- a/doc/user/project/merge_requests/img/security_report.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/merge_requests/img/vulnerability_solution.png b/doc/user/project/merge_requests/img/vulnerability_solution.png
deleted file mode 100644
index 7443b9b6eea..00000000000
--- a/doc/user/project/merge_requests/img/vulnerability_solution.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/merge_requests/index.md b/doc/user/project/merge_requests/index.md
index 2bb2d906453..09736c7fc7e 100644
--- a/doc/user/project/merge_requests/index.md
+++ b/doc/user/project/merge_requests/index.md
@@ -397,6 +397,14 @@ GitLab can scan and report any vulnerabilities found in your project.
[Read more about security reports.](https://docs.gitlab.com/ee/user/application_security/index.html)
+## JUnit test reports
+
+Configure your CI jobs to use JUnit test reports, and let GitLab display a report
+on the merge request so that it’s easier and faster to identify the failure
+without having to check the entire job log.
+
+[Read more about JUnit test reports](../../../ci/junit_test_reports.md).
+
## Live preview with Review Apps
If you configured [Review Apps](https://about.gitlab.com/features/review-apps/) for your project,
@@ -539,13 +547,13 @@ Add the following alias to your `~/.gitconfig`:
Now you can check out a particular merge request from any repository and any
remote. For example, to check out the merge request with ID 5 as shown in GitLab
-from the `upstream` remote, do:
+from the `origin` remote, do:
```
-git mr upstream 5
+git mr origin 5
```
-This will fetch the merge request into a local `mr-upstream-5` branch and check
+This will fetch the merge request into a local `mr-origin-5` branch and check
it out.
#### Checkout locally by modifying `.git/config` for a given repository
diff --git a/doc/user/project/merge_requests/merge_request_approvals.md b/doc/user/project/merge_requests/merge_request_approvals.md
index 265871a7b4b..d0291c4cef5 100644
--- a/doc/user/project/merge_requests/merge_request_approvals.md
+++ b/doc/user/project/merge_requests/merge_request_approvals.md
@@ -77,7 +77,7 @@ request approval rules:
1. Navigate to your project's **Settings > General** and expand **Merge request approvals**.
1. Click **Add approvers** to create a new approval rule.
-1. Just like in [GitLab Starter](#editing-approvals), select the approval members and aprovals required.
+1. Just like in [GitLab Starter](#editing-approvals), select the approval members and approvals required.
1. Give the approval rule a name that describes the set of approvers selected.
1. Click **Add approvers** to submit the new rule.
@@ -173,8 +173,7 @@ the merge request. To enable this feature:
1. Navigate to your project's **Settings > General** and expand
**Merge request approvals**.
-1. Tick the **Require approval from code owners** checkbox
- checkbox.
+1. Tick the **Require approval from code owners** checkbox.
1. Click **Save changes**.
When this feature is enabled, all merge requests will need approval
@@ -294,6 +293,18 @@ enabling [**Prevent approval of merge requests by their committers**](#prevent-a
1. Tick the checkbox **Prevent approval of merge requests by their committers**.
1. Click **Save changes**.
+## Require authentication when approving a merge request **[STARTER]**
+
+> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/5981) in [GitLab Starter](https://about.gitlab.com/pricing/) 12.0.
+
+You can force the approver to enter a password in order to authenticate who is approving the merge request by
+enabling **Require user password to approve**. This enables an Electronic Signature
+for approvals such as the one defined by [CFR Part 11](https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfcfr/CFRSearch.cfm?CFRPart=11&showFR=1&subpartNode=21:1.0.1.1.8.3)):
+
+1. Navigate to your project's **Settings > General** and expand **Merge request approvals**.
+1. Tick the checkbox **Require user password to approve**.
+1. Click **Save changes**.
+
## Merge requests with different source branch and target branch projects
If the merge request source branch and target branch belong to different
diff --git a/doc/user/project/pages/img/pages_create_project.png b/doc/user/project/pages/img/pages_create_project.png
deleted file mode 100644
index 69e84b84984..00000000000
--- a/doc/user/project/pages/img/pages_create_project.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/pages/img/pages_create_user_page.png b/doc/user/project/pages/img/pages_create_user_page.png
deleted file mode 100644
index 2f1a19ae424..00000000000
--- a/doc/user/project/pages/img/pages_create_user_page.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/pages/img/pages_dns_details.png b/doc/user/project/pages/img/pages_dns_details.png
deleted file mode 100644
index 3e57f43f7ba..00000000000
--- a/doc/user/project/pages/img/pages_dns_details.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/pages/img/pages_multiple_domains.png b/doc/user/project/pages/img/pages_multiple_domains.png
deleted file mode 100644
index 76c39101439..00000000000
--- a/doc/user/project/pages/img/pages_multiple_domains.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/pages/img/pages_new_domain_button.png b/doc/user/project/pages/img/pages_new_domain_button.png
deleted file mode 100644
index cd59defa006..00000000000
--- a/doc/user/project/pages/img/pages_new_domain_button.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/pages/img/pages_upload_cert.png b/doc/user/project/pages/img/pages_upload_cert.png
deleted file mode 100644
index 64e5f8eced1..00000000000
--- a/doc/user/project/pages/img/pages_upload_cert.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/repository/index.md b/doc/user/project/repository/index.md
index 97ecc4c0d65..cb514b76a4e 100644
--- a/doc/user/project/repository/index.md
+++ b/doc/user/project/repository/index.md
@@ -173,11 +173,15 @@ Via command line, you can commit multiple times before pushing.
## Repository size
-On GitLab.com, your [repository size limit is 10GB](../../gitlab_com/index.md#repository-size-limit)
-(including LFS). For other instances, the repository size is limited by your
-system administrators.
+A project's repository size is reported on the project's **Details** page. The reported size is
+updated every 15 minutes at most, so may not reflect recent activity.
-You can also [reduce a repository size using Git](reducing_the_repo_size_using_git.md).
+The repository size for:
+
+- GitLab.com [is set by GitLab](../../gitlab_com/index.md#repository-size-limit).
+- Self-managed instances is set by your GitLab administrators.
+
+You can [reduce a repository's size using Git](reducing_the_repo_size_using_git.md).
## Contributors
diff --git a/doc/user/project/settings/import_export.md b/doc/user/project/settings/import_export.md
index 89008fd15b9..db4f8fbd8d3 100644
--- a/doc/user/project/settings/import_export.md
+++ b/doc/user/project/settings/import_export.md
@@ -23,6 +23,7 @@
> in the import side is required to map the users, based on email or username.
> Otherwise, a supplementary comment is left to mention the original author and
> the MRs, notes or issues will be owned by the importer.
+> - Project members with owner access will get imported as maintainers.
> - Control project Import/Export with the [API](../../../api/project_import_export.md).
> - If an imported project contains merge requests originated from forks,
> then new branches associated with such merge requests will be created
diff --git a/doc/user/project/web_ide/img/enable_web_ide.png b/doc/user/project/web_ide/img/enable_web_ide.png
deleted file mode 100644
index 196baa82ad2..00000000000
--- a/doc/user/project/web_ide/img/enable_web_ide.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/web_ide/index.md b/doc/user/project/web_ide/index.md
index 2a2507d98a3..a634a8b2f54 100644
--- a/doc/user/project/web_ide/index.md
+++ b/doc/user/project/web_ide/index.md
@@ -8,7 +8,7 @@ projects by providing an advanced editor with commit staging.
## Open the Web IDE
-The Web IDE can be opened when viewing a file, from the repository file list,
+You can open the Web IDE when viewing a file, from the repository file list,
and from merge requests.
![Open Web IDE](img/open_web_ide.png)
@@ -45,7 +45,7 @@ Single file editing is based on the [Ace Editor](https://ace.c9.io).
## Stage and commit changes
-After making your changes, click the Commit button in the bottom left to
+After making your changes, click the **Commit** button in the bottom left to
review the list of changed files. Click on each file to review the changes and
click the tick icon to stage the file.
@@ -67,10 +67,11 @@ shows you a preview of the merge request diff if you commit your changes.
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/19279) in [GitLab Core][ce] 11.0.
-The Web IDE can be used to quickly fix failing tests by opening the branch or
-merge request in the Web IDE and opening the logs of the failed job. The status
-of all jobs for the most recent pipeline and job traces for the current commit
-can be accessed by clicking the **Pipelines** button in the top right.
+You can use the Web IDE to quickly fix failing tests by opening
+the branch or merge request in the Web IDE and opening the logs of the failed
+job. You can access the status of all jobs for the most recent pipeline and job
+traces for the current commit by clicking the **Pipelines** button in the top
+right.
The pipeline status is also shown at all times in the status bar in the bottom
left.
@@ -79,31 +80,31 @@ left.
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/19318) in [GitLab Core][ce] 11.0.
-Switching between your authored and assigned merge requests can be done without
-leaving the Web IDE. Click the dropdown in the top of the sidebar to open a list
-of merge requests. You will need to commit or discard all your changes before
-switching to a different merge request.
+To switch between your authored and assigned merge requests, click the
+dropdown in the top of the sidebar to open a list of merge requests. You will
+need to commit or discard all your changes before switching to a different merge
+request.
## Switching branches
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/20850) in [GitLab Core][ce] 11.2.
-Switching between branches of the current project repository can be done without
-leaving the Web IDE. Click the dropdown in the top of the sidebar to open a list
-of branches. You will need to commit or discard all your changes before
-switching to a different branch.
+To switch between branches of the current project repository, click the dropdown
+in the top of the sidebar to open a list of branches.
+You will need to commit or discard all your changes before switching to a
+different branch.
## Client Side Evaluation
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/19764) in [GitLab Core][ce] 11.2.
-The Web IDE can be used to preview JavaScript projects right in the browser.
+You can use the Web IDE to preview JavaScript projects right in the browser.
This feature uses CodeSandbox to compile and bundle the JavaScript used to
preview the web application.
![Web IDE Client Side Evaluation](img/clientside_evaluation.png)
-Additionally, for public projects an `Open in CodeSandbox` button is available
+Additionally, for public projects an **Open in CodeSandbox** button is available
to transfer the contents of the project into a public CodeSandbox project to
quickly share your project with others.
@@ -115,9 +116,9 @@ GitLab.com
![Admin Client Side Evaluation setting](img/admin_clientside_evaluation.png)
-Once it has been enabled in application settings, projects with a
-`package.json` file and a `main` entry point can be previewed inside of the Web
-IDE. An example `package.json` is below.
+Once you have done that, you can preview projects with a `package.json` file and
+a `main` entry point inside the Web IDE. An example `package.json` is shown
+below.
```json
{
diff --git a/doc/user/project/wiki/index.md b/doc/user/project/wiki/index.md
index 95f606fd786..e3c6cd6d6ff 100644
--- a/doc/user/project/wiki/index.md
+++ b/doc/user/project/wiki/index.md
@@ -116,7 +116,9 @@ instructions.
## Customizing sidebar
-By default, the wiki would render a sidebar which lists all the pages for the
-wiki. You could as well provide a `_sidebar` page to replace this default
-sidebar. When this customized sidebar page is provided, the default sidebar
-would not be rendered, but the customized one.
+On the project's Wiki page, there is a right side navigation that renders the full Wiki pages list by default, with hierarchy.
+
+If the Wiki repository contains a `_sidebar` page, the file of this page replaces the default side navigation.
+This custom file serves to render it's custom content, fully replacing the standard sidebar.
+
+Support for displaying a generated TOC with a custom side navigation is planned.
diff --git a/doc/user/search/img/issues_any_assignee.png b/doc/user/search/img/issues_any_assignee.png
deleted file mode 100644
index 2f902bcc66c..00000000000
--- a/doc/user/search/img/issues_any_assignee.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/search/img/issues_author.png b/doc/user/search/img/issues_author.png
deleted file mode 100644
index 792f9746db6..00000000000
--- a/doc/user/search/img/issues_author.png
+++ /dev/null
Binary files differ
diff --git a/doc/workflow/award_emoji.png b/doc/workflow/award_emoji.png
deleted file mode 100644
index 1ad634a343e..00000000000
--- a/doc/workflow/award_emoji.png
+++ /dev/null
Binary files differ
diff --git a/doc/workflow/img/new_branch_from_issue.png b/doc/workflow/img/new_branch_from_issue.png
deleted file mode 100644
index 286d775bb9e..00000000000
--- a/doc/workflow/img/new_branch_from_issue.png
+++ /dev/null
Binary files differ
diff --git a/doc/workflow/lfs/manage_large_binaries_with_git_lfs.md b/doc/workflow/lfs/manage_large_binaries_with_git_lfs.md
index da0243705aa..202f2e39975 100644
--- a/doc/workflow/lfs/manage_large_binaries_with_git_lfs.md
+++ b/doc/workflow/lfs/manage_large_binaries_with_git_lfs.md
@@ -250,6 +250,7 @@ If you are storing LFS files outside of GitLab you can disable LFS on the projec
It is possible to host LFS objects externally by setting a custom LFS url with `git config -f .lfsconfig lfs.url https://example.com/<project>.git/info/lfs`.
-Because GitLab verifies the existence of objects referenced by LFS pointers, push will fail when LFS is enabled for the project.
+You might choose to do this if you are using an appliance like a Sonatype Nexus to store LFS data. If you choose to use an external LFS store,
+GitLab will not be able to verify LFS objects which means that pushes will fail if you have GitLab LFS support enabled.
-LFS can be disabled from the [Project settings](../../user/project/settings/index.md).
+To stop push failure, LFS support can be disabled in the [Project settings](../../user/project/settings/index.md). This means you will lose GitLab LFS value-adds (Verifying LFS objects, UI integration for LFS).
diff --git a/doc/workflow/share_with_group.png b/doc/workflow/share_with_group.png
deleted file mode 100644
index 2c47625e29a..00000000000
--- a/doc/workflow/share_with_group.png
+++ /dev/null
Binary files differ
diff --git a/doc/workflow/timezone.md b/doc/workflow/timezone.md
index 338b3a32265..da51c0f2c93 100644
--- a/doc/workflow/timezone.md
+++ b/doc/workflow/timezone.md
@@ -1,31 +1,39 @@
# Changing your time zone
The global time zone configuration parameter can be changed in `config/gitlab.yml`:
+
```
- # time_zone: 'UTC'
+# time_zone: 'UTC'
```
-Uncomment and customize if you want to change the default time zone of GitLab application.
+Uncomment and customize if you want to change the default time zone of the GitLab application.
+
+
+## Viewing available timezones
To see all available time zones, run `bundle exec rake time:zones:all`.
-With Omnibus installations, run `gitlab-rake time:zones:all`.
+For Omnibus installations, run `gitlab-rake time:zones:all`.
+
+NOTE: **Note:**
+Currently, this rake task does not list timezones in TZInfo format required by GitLab Omnibus during a reconfigure: [#58672](https://gitlab.com/gitlab-org/gitlab-ce/issues/58672).
## Changing time zone in omnibus installations
GitLab defaults its time zone to UTC. It has a global timezone configuration parameter in `/etc/gitlab/gitlab.rb`.
-To update, add the time zone that best applies to your location. Here are two examples:
+To obtain a list of timezones, log in to your GitLab application server and run a command that generates a list of timezones in TZInfo format for the server. For example, install `timedatectl` and run `timedatectl list-timezones`.
+
+To update, add the timezone that best applies to your location. For example:
+
```
gitlab_rails['time_zone'] = 'America/New_York'
```
-or
-```
-gitlab_rails['time_zone'] = 'Europe/Brussels'
-```
-After you added this field, reconfigure and restart:
+After adding the configuration parameter, reconfigure and restart your GitLab instance:
+
```
gitlab-ctl reconfigure
gitlab-ctl restart
```
+
diff --git a/fixtures/emojis/index.json b/fixtures/emojis/index.json
index f55571d31fa..0406d404532 100644
--- a/fixtures/emojis/index.json
+++ b/fixtures/emojis/index.json
@@ -16344,7 +16344,7 @@
"aliases": [],
"aliases_ascii": [],
"keywords": [
- "accomodation",
+ "accommodation",
"building",
"checkin",
"whotel",
diff --git a/lib/haml_lint/inline_javascript.rb b/haml_lint/inline_javascript.rb
index 1b17162f71d..da6af92e82b 100644
--- a/lib/haml_lint/inline_javascript.rb
+++ b/haml_lint/inline_javascript.rb
@@ -7,7 +7,7 @@ unless Rails.env.production?
module HamlLint
class Linter::InlineJavaScript < Linter
- include LinterRegistry
+ include ::HamlLint::LinterRegistry
def visit_filter(node)
return unless node.filter_type == 'javascript'
diff --git a/haml_lint/linter/no_plain_nodes.rb b/haml_lint/linter/no_plain_nodes.rb
new file mode 100644
index 00000000000..c39f61fa80d
--- /dev/null
+++ b/haml_lint/linter/no_plain_nodes.rb
@@ -0,0 +1,84 @@
+# frozen_string_literal: true
+
+require 'active_support/core_ext/array/grouping'
+
+module HamlLint
+ class Linter
+ class NoPlainNodes < Linter
+ include ::HamlLint::LinterRegistry
+
+ def visit_tag(node)
+ if inline_plain_node?(node)
+ check_inline(node)
+ elsif !node.script.empty?
+ check_script(node)
+ else
+ check(node)
+ end
+ end
+
+ private
+
+ def check(node)
+ text_in_node(node).each { |string| record(node, string) }
+ end
+
+ def check_inline(node)
+ text = inline_text(node)
+ record(node, text) unless text.empty?
+ end
+
+ def check_script(node)
+ text = inline_text(node)
+ record(node, text) unless text.start_with?('=') || text.empty?
+ end
+
+ # Build an array of all strings in child text nodes.
+ # non text nodes are nil, where we'll split the sentences.
+ def text_in_node(node)
+ texts = node.children.map do |child|
+ child.text.strip if text_node?(child)
+ end
+
+ texts.split(nil).map { |sentence| sentence.join(' ') unless sentence.empty? }.compact
+ end
+
+ # Removes a node's attributes and tag from the source code,
+ # returning the inline text of a node.
+ def inline_text(node)
+ text = node.source_code.gsub("%#{node.tag_name}", '')
+
+ attributes = node.attributes_source.map(&:last)
+ attributes.each { |attribute| text = text.gsub(attribute, '') }
+
+ text.strip
+ end
+
+ def record(node, string)
+ record_lint(node, message(string))
+ end
+
+ def message(string)
+ "`#{string}` is a plain node. Please use an i18n method like `#{fixed(string)}`"
+ end
+
+ def fixed(string)
+ "= _('#{string}')"
+ end
+
+ def inline_plain_node?(node)
+ node.children.empty? && node.script.empty?
+ end
+
+ def plain_node?(node)
+ node.is_a?(::HamlLint::Tree::PlainNode)
+ end
+
+ def text_node?(node)
+ return false unless plain_node?(node)
+
+ !node.text.empty?
+ end
+ end
+ end
+end
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 296688ba25b..96a1ccefbe5 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -542,10 +542,15 @@ module API
class IssueBasic < ProjectEntity
expose :closed_at
expose :closed_by, using: Entities::UserBasic
- expose :labels do |issue|
- # Avoids an N+1 query since labels are preloaded
- issue.labels.map(&:title).sort
+
+ expose :labels do |issue, options|
+ if options[:with_labels_details]
+ ::API::Entities::LabelBasic.represent(issue.labels.sort_by(&:title))
+ else
+ issue.labels.map(&:title).sort
+ end
end
+
expose :milestone, using: Entities::Milestone
expose :assignees, :author, using: Entities::UserBasic
@@ -573,6 +578,14 @@ module API
class Issue < IssueBasic
include ::API::Helpers::RelatedResourcesHelpers
+ expose(:has_tasks) do |issue, _|
+ !issue.task_list_items.empty?
+ end
+
+ expose :task_status, if: -> (issue, _) do
+ !issue.task_list_items.empty?
+ end
+
expose :_links do
expose :self do |issue|
expose_url(api_v4_project_issue_path(id: issue.project_id, issue_iid: issue.iid))
@@ -1253,7 +1266,7 @@ module API
end
class JobBasic < Grape::Entity
- expose :id, :status, :stage, :name, :ref, :tag, :coverage
+ expose :id, :status, :stage, :name, :ref, :tag, :coverage, :allow_failure
expose :created_at, :started_at, :finished_at
expose :duration
expose :user, with: User
@@ -1290,6 +1303,7 @@ module API
class Variable < Grape::Entity
expose :variable_type, :key, :value
expose :protected?, as: :protected, if: -> (entity, _) { entity.respond_to?(:protected?) }
+ expose :masked?, as: :masked, if: -> (entity, _) { entity.respond_to?(:masked?) }
end
class Pipeline < PipelineBasic
diff --git a/lib/api/groups.rb b/lib/api/groups.rb
index ad16f26f5cc..6893c8c40be 100644
--- a/lib/api/groups.rb
+++ b/lib/api/groups.rb
@@ -20,20 +20,19 @@ module API
optional :share_with_group_lock, type: Boolean, desc: 'Prevent sharing a project with another group within this group'
end
- if Gitlab.ee?
- params :optional_params_ee do
- optional :membership_lock, type: Boolean, desc: 'Prevent adding new members to project membership within this group'
- optional :ldap_cn, type: String, desc: 'LDAP Common Name'
- optional :ldap_access, type: Integer, desc: 'A valid access level'
- optional :shared_runners_minutes_limit, type: Integer, desc: '(admin-only) Pipeline minutes quota for this group'
- optional :extra_shared_runners_minutes_limit, type: Integer, desc: '(admin-only) Extra pipeline minutes quota for this group'
- all_or_none_of :ldap_cn, :ldap_access
- end
+ params :optional_params_ee do
+ end
+
+ params :optional_update_params_ee do
end
+ end
+ include ::API::Helpers::GroupsHelpers
+
+ helpers do
params :optional_params do
use :optional_params_ce
- use :optional_params_ee if Gitlab.ee?
+ use :optional_params_ee
end
params :statistics_params do
@@ -176,10 +175,7 @@ module API
optional :name, type: String, desc: 'The name of the group'
optional :path, type: String, desc: 'The path of the group'
use :optional_params
-
- if Gitlab.ee?
- optional :file_template_project_id, type: Integer, desc: 'The ID of a project to use for custom templates in this group'
- end
+ use :optional_update_params_ee
end
put ':id' do
group = find_group!(params[:id])
diff --git a/lib/api/helpers/groups_helpers.rb b/lib/api/helpers/groups_helpers.rb
new file mode 100644
index 00000000000..ae677547760
--- /dev/null
+++ b/lib/api/helpers/groups_helpers.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+module API
+ module Helpers
+ module GroupsHelpers
+ extend ActiveSupport::Concern
+ end
+ end
+end
diff --git a/lib/api/helpers/internal_helpers.rb b/lib/api/helpers/internal_helpers.rb
index 71c30ec99a5..c318f5b9127 100644
--- a/lib/api/helpers/internal_helpers.rb
+++ b/lib/api/helpers/internal_helpers.rb
@@ -46,6 +46,8 @@ module API
def process_mr_push_options(push_options, project, user, changes)
output = {}
+ Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/61359')
+
service = ::MergeRequests::PushOptionsHandlerService.new(
project,
user,
diff --git a/lib/api/helpers/issues_helpers.rb b/lib/api/helpers/issues_helpers.rb
index f6762910b0c..fc66cec5341 100644
--- a/lib/api/helpers/issues_helpers.rb
+++ b/lib/api/helpers/issues_helpers.rb
@@ -18,6 +18,39 @@ module API
:title
]
end
+
+ def issue_finder(args = {})
+ args = declared_params.merge(args)
+
+ args.delete(:id)
+ args[:milestone_title] ||= args.delete(:milestone)
+ args[:label_name] ||= args.delete(:labels)
+ args[:scope] = args[:scope].underscore if args[:scope]
+
+ IssuesFinder.new(current_user, args)
+ end
+
+ def find_issues(args = {})
+ finder = issue_finder(args)
+ issues = finder.execute.with_api_entity_associations
+
+ issues.reorder(order_options_with_tie_breaker) # rubocop: disable CodeReuse/ActiveRecord
+ end
+
+ def issues_statistics(args = {})
+ finder = issue_finder(args)
+ counter = Gitlab::IssuablesCountForState.new(finder)
+
+ {
+ statistics: {
+ counts: {
+ all: counter[:all],
+ closed: counter[:closed],
+ opened: counter[:opened]
+ }
+ }
+ }
+ end
end
end
end
diff --git a/lib/api/internal.rb b/lib/api/internal.rb
index c82fd230d7a..224aaaaf006 100644
--- a/lib/api/internal.rb
+++ b/lib/api/internal.rb
@@ -264,12 +264,8 @@ module API
PostReceive.perform_async(params[:gl_repository], params[:identifier],
params[:changes], push_options.as_json)
- if Feature.enabled?(:mr_push_options, default_enabled: true)
- Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/61359')
-
- mr_options = push_options.get(:merge_request)
- output.merge!(process_mr_push_options(mr_options, project, user, params[:changes])) if mr_options.present?
- end
+ mr_options = push_options.get(:merge_request)
+ output.merge!(process_mr_push_options(mr_options, project, user, params[:changes])) if mr_options.present?
broadcast_message = BroadcastMessage.current&.last&.message
reference_counter_decreased = Gitlab::ReferenceCounter.new(params[:gl_repository]).decrease
diff --git a/lib/api/issues.rb b/lib/api/issues.rb
index d0a93b77951..0b4da01f3c8 100644
--- a/lib/api/issues.rb
+++ b/lib/api/issues.rb
@@ -3,27 +3,12 @@
module API
class Issues < Grape::API
include PaginationParams
+ helpers Helpers::IssuesHelpers
+ helpers ::Gitlab::IssuableMetadata
before { authenticate_non_get! }
- helpers ::Gitlab::IssuableMetadata
-
helpers do
- # rubocop: disable CodeReuse/ActiveRecord
- def find_issues(args = {})
- args = declared_params.merge(args)
-
- args.delete(:id)
- args[:milestone_title] = args.delete(:milestone)
- args[:label_name] = args.delete(:labels)
- args[:scope] = args[:scope].underscore if args[:scope]
-
- issues = IssuesFinder.new(current_user, args).execute
- .with_api_entity_associations
- issues.reorder(order_options_with_tie_breaker)
- end
- # rubocop: enable CodeReuse/ActiveRecord
-
if Gitlab.ee?
params :issues_params_ee do
optional :weight, types: [Integer, String], integer_none_any: true, desc: 'The weight of the issue'
@@ -34,13 +19,9 @@ module API
end
end
- params :issues_params do
+ params :issues_stats_params do
optional :labels, type: Array[String], coerce_with: Validations::Types::LabelsList.coerce, desc: 'Comma-separated list of label names'
optional :milestone, type: String, desc: 'Milestone title'
- optional :order_by, type: String, values: %w[created_at updated_at], default: 'created_at',
- desc: 'Return issues ordered by `created_at` or `updated_at` fields.'
- optional :sort, type: String, values: %w[asc desc], default: 'desc',
- desc: 'Return issues sorted in `asc` or `desc` order.'
optional :milestone, type: String, desc: 'Return issues for a specific milestone'
optional :iids, type: Array[Integer], desc: 'The IID array of issues'
optional :search, type: String, desc: 'Search issues for text present in the title, description, or any combination of these'
@@ -49,18 +30,39 @@ module API
optional :created_before, type: DateTime, desc: 'Return issues created before the specified time'
optional :updated_after, type: DateTime, desc: 'Return issues updated after the specified time'
optional :updated_before, type: DateTime, desc: 'Return issues updated before the specified time'
+
optional :author_id, type: Integer, desc: 'Return issues which are authored by the user with the given ID'
+ optional :author_username, type: String, desc: 'Return issues which are authored by the user with the given username'
+ mutually_exclusive :author_id, :author_username
+
optional :assignee_id, types: [Integer, String], integer_none_any: true,
desc: 'Return issues which are assigned to the user with the given ID'
+ optional :assignee_username, type: Array[String], check_assignees_count: true,
+ coerce_with: Validations::CheckAssigneesCount.coerce,
+ desc: 'Return issues which are assigned to the user with the given username'
+ mutually_exclusive :assignee_id, :assignee_username
+
optional :scope, type: String, values: %w[created-by-me assigned-to-me created_by_me assigned_to_me all],
desc: 'Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`'
optional :my_reaction_emoji, type: String, desc: 'Return issues reacted by the authenticated user by the given emoji'
optional :confidential, type: Boolean, desc: 'Filter confidential or public issues'
- use :pagination
use :issues_params_ee if Gitlab.ee?
end
+ params :issues_params do
+ optional :with_labels_details, type: Boolean, desc: 'Return more label data than just lable title', default: false
+ optional :state, type: String, values: %w[opened closed all], default: 'all',
+ desc: 'Return opened, closed, or all issues'
+ optional :order_by, type: String, values: %w[created_at updated_at], default: 'created_at',
+ desc: 'Return issues ordered by `created_at` or `updated_at` fields.'
+ optional :sort, type: String, values: %w[asc desc], default: 'desc',
+ desc: 'Return issues sorted in `asc` or `desc` order.'
+
+ use :issues_stats_params
+ use :pagination
+ end
+
params :issue_params do
optional :description, type: String, desc: 'The description of an issue'
optional :assignee_ids, type: Array[Integer], desc: 'The array of user IDs to assign issue'
@@ -75,13 +77,23 @@ module API
end
end
+ desc "Get currently authenticated user's issues statistics"
+ params do
+ use :issues_stats_params
+ optional :scope, type: String, values: %w[created_by_me assigned_to_me all], default: 'created_by_me',
+ desc: 'Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`'
+ end
+ get '/issues_statistics' do
+ authenticate! unless params[:scope] == 'all'
+
+ present issues_statistics, with: Grape::Presenters::Presenter
+ end
+
resource :issues do
desc "Get currently authenticated user's issues" do
- success Entities::IssueBasic
+ success Entities::Issue
end
params do
- optional :state, type: String, values: %w[opened closed all], default: 'all',
- desc: 'Return opened, closed, or all issues'
use :issues_params
optional :scope, type: String, values: %w[created-by-me assigned-to-me created_by_me assigned_to_me all], default: 'created_by_me',
desc: 'Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`'
@@ -91,7 +103,8 @@ module API
issues = paginate(find_issues)
options = {
- with: Entities::IssueBasic,
+ with: Entities::Issue,
+ with_labels_details: declared_params[:with_labels_details],
current_user: current_user,
issuable_metadata: issuable_meta_data(issues, 'Issue')
}
@@ -105,11 +118,9 @@ module API
end
resource :groups, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
desc 'Get a list of group issues' do
- success Entities::IssueBasic
+ success Entities::Issue
end
params do
- optional :state, type: String, values: %w[opened closed all], default: 'all',
- desc: 'Return opened, closed, or all issues'
use :issues_params
end
get ":id/issues" do
@@ -118,13 +129,24 @@ module API
issues = paginate(find_issues(group_id: group.id, include_subgroups: true))
options = {
- with: Entities::IssueBasic,
+ with: Entities::Issue,
+ with_labels_details: declared_params[:with_labels_details],
current_user: current_user,
issuable_metadata: issuable_meta_data(issues, 'Issue')
}
present issues, options
end
+
+ desc 'Get statistics for the list of group issues'
+ params do
+ use :issues_stats_params
+ end
+ get ":id/issues_statistics" do
+ group = find_group!(params[:id])
+
+ present issues_statistics(group_id: group.id, include_subgroups: true), with: Grape::Presenters::Presenter
+ end
end
params do
@@ -134,11 +156,9 @@ module API
include TimeTrackingEndpoints
desc 'Get a list of project issues' do
- success Entities::IssueBasic
+ success Entities::Issue
end
params do
- optional :state, type: String, values: %w[opened closed all], default: 'all',
- desc: 'Return opened, closed, or all issues'
use :issues_params
end
get ":id/issues" do
@@ -147,7 +167,8 @@ module API
issues = paginate(find_issues(project_id: project.id))
options = {
- with: Entities::IssueBasic,
+ with: Entities::Issue,
+ with_labels_details: declared_params[:with_labels_details],
current_user: current_user,
project: user_project,
issuable_metadata: issuable_meta_data(issues, 'Issue')
@@ -156,6 +177,16 @@ module API
present issues, options
end
+ desc 'Get statistics for the list of project issues'
+ params do
+ use :issues_stats_params
+ end
+ get ":id/issues_statistics" do
+ project = find_project!(params[:id])
+
+ present issues_statistics(project_id: project.id), with: Grape::Presenters::Presenter
+ end
+
desc 'Get a single project issue' do
success Entities::Issue
end
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb
index daa98c22e5e..ce85772e4ed 100644
--- a/lib/api/merge_requests.rb
+++ b/lib/api/merge_requests.rb
@@ -367,10 +367,6 @@ module API
merge_request = find_project_merge_request(params[:merge_request_iid])
merge_when_pipeline_succeeds = to_boolean(params[:merge_when_pipeline_succeeds])
- if merge_when_pipeline_succeeds || merge_request.merge_when_pipeline_succeeds
- render_api_error!('Not allowed: pipeline does not exist', 405) unless merge_request.head_pipeline
- end
-
# Merge request can not be merged
# because user dont have permissions to push into target branch
unauthorized! unless merge_request.can_be_merged_by?(current_user)
diff --git a/lib/api/runner.rb b/lib/api/runner.rb
index ea36c24eca2..fdf4904e9f5 100644
--- a/lib/api/runner.rb
+++ b/lib/api/runner.rb
@@ -98,6 +98,7 @@ module API
optional :certificate, type: String, desc: %q(Session's certificate)
optional :authorization, type: String, desc: %q(Session's authorization)
end
+ optional :job_age, type: Integer, desc: %q(Job should be older than passed age in seconds to be ran on runner)
end
post '/request' do
authenticate_runner!
diff --git a/lib/api/search.rb b/lib/api/search.rb
index 60095300ea1..1cab1a97186 100644
--- a/lib/api/search.rb
+++ b/lib/api/search.rb
@@ -112,12 +112,13 @@ module API
type: String,
desc: 'The scope of the search',
values: Helpers::SearchHelpers.project_search_scopes
+ optional :ref, type: String, desc: 'The name of a repository branch or tag. If not given, the default branch is used'
use :pagination
end
get ':id/(-/)search' do
check_users_search_allowed!
- present search(project_id: user_project.id), with: entity
+ present search({ project_id: user_project.id, repository_ref: params[:ref] }), with: entity
end
end
end
diff --git a/lib/api/validations/check_assignees_count.rb b/lib/api/validations/check_assignees_count.rb
new file mode 100644
index 00000000000..836ec936b31
--- /dev/null
+++ b/lib/api/validations/check_assignees_count.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+module API
+ module Validations
+ class CheckAssigneesCount < Grape::Validations::Base
+ def self.coerce
+ lambda do |value|
+ case value
+ when String, Array
+ Array.wrap(value)
+ else
+ []
+ end
+ end
+ end
+
+ def validate_param!(attr_name, params)
+ return if param_allowed?(attr_name, params)
+
+ raise Grape::Exceptions::Validation,
+ params: [@scope.full_name(attr_name)],
+ message: "allows one value, but found #{params[attr_name].size}: #{params[attr_name].join(", ")}"
+ end
+
+ private
+
+ def param_allowed?(attr_name, params)
+ params[attr_name].size <= 1
+ end
+ end
+ end
+end
diff --git a/lib/api/variables.rb b/lib/api/variables.rb
index a1bb21b3a06..b07dd1bab79 100644
--- a/lib/api/variables.rb
+++ b/lib/api/variables.rb
@@ -55,6 +55,7 @@ module API
requires :key, type: String, desc: 'The key of the variable'
requires :value, type: String, desc: 'The value of the variable'
optional :protected, type: String, desc: 'Whether the variable is protected'
+ optional :masked, type: String, desc: 'Whether the variable is masked'
optional :variable_type, type: String, values: Ci::Variable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file. Defaults to env_var'
if Gitlab.ee?
@@ -81,6 +82,7 @@ module API
optional :key, type: String, desc: 'The key of the variable'
optional :value, type: String, desc: 'The value of the variable'
optional :protected, type: String, desc: 'Whether the variable is protected'
+ optional :masked, type: String, desc: 'Whether the variable is masked'
optional :variable_type, type: String, values: Ci::Variable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file'
if Gitlab.ee?
diff --git a/lib/bitbucket_server/representation/repo.rb b/lib/bitbucket_server/representation/repo.rb
index 6c494b79166..dab7f8f22a1 100644
--- a/lib/bitbucket_server/representation/repo.rb
+++ b/lib/bitbucket_server/representation/repo.rb
@@ -20,7 +20,7 @@ module BitbucketServer
end
def browse_url
- # The JSON reponse contains an array of 1 element. Not sure if there
+ # The JSON response contains an array of 1 element. Not sure if there
# are cases where multiple links would be provided.
raw.dig('links', 'self').first.fetch('href')
end
diff --git a/lib/gitlab/background_migration/fix_cross_project_label_links.rb b/lib/gitlab/background_migration/fix_cross_project_label_links.rb
index 0a12401c35f..bf5d7f5f322 100644
--- a/lib/gitlab/background_migration/fix_cross_project_label_links.rb
+++ b/lib/gitlab/background_migration/fix_cross_project_label_links.rb
@@ -95,7 +95,7 @@ module Gitlab
local_labels = available_labels(project_id)
# get all label links for the given resource (issue/MR)
- # which reference a label not included in avaiable_labels
+ # which reference a label not included in available_labels
# (other than its project labels and labels of ancestor groups)
cross_labels = LabelLink
.select('label_id, labels.title as title, labels.color as color, label_links.id as label_link_id')
diff --git a/lib/gitlab/ci/pipeline/chain/limit/activity.rb b/lib/gitlab/ci/pipeline/chain/limit/activity.rb
index fe7c8738cc0..68482cf08a9 100644
--- a/lib/gitlab/ci/pipeline/chain/limit/activity.rb
+++ b/lib/gitlab/ci/pipeline/chain/limit/activity.rb
@@ -7,11 +7,11 @@ module Gitlab
module Limit
class Activity < Chain::Base
def perform!
- # to be overriden in EE
+ # to be overridden in EE
end
def break?
- false # to be overriden in EE
+ false # to be overridden in EE
end
end
end
diff --git a/lib/gitlab/ci/pipeline/chain/limit/size.rb b/lib/gitlab/ci/pipeline/chain/limit/size.rb
index b4d51437cd6..cd330c58406 100644
--- a/lib/gitlab/ci/pipeline/chain/limit/size.rb
+++ b/lib/gitlab/ci/pipeline/chain/limit/size.rb
@@ -7,11 +7,11 @@ module Gitlab
module Limit
class Size < Chain::Base
def perform!
- # to be overriden in EE
+ # to be overridden in EE
end
def break?
- false # to be overriden in EE
+ false # to be overridden in EE
end
end
end
diff --git a/lib/gitlab/ci/templates/Docker.gitlab-ci.yml b/lib/gitlab/ci/templates/Docker.gitlab-ci.yml
index eeefadaa019..f6d240b7b6d 100644
--- a/lib/gitlab/ci/templates/Docker.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Docker.gitlab-ci.yml
@@ -1,14 +1,11 @@
-# Official docker image.
-image: docker:latest
-
-services:
- - docker:dind
-
-before_script:
- - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
-
build-master:
+ # Official docker image.
+ image: docker:latest
stage: build
+ services:
+ - docker:dind
+ before_script:
+ - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE"
@@ -16,7 +13,13 @@ build-master:
- master
build:
+ # Official docker image.
+ image: docker:latest
stage: build
+ services:
+ - docker:dind
+ before_script:
+ - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
diff --git a/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml b/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml
index 9d99d04d263..779f4b5f006 100644
--- a/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml
@@ -338,7 +338,6 @@ rollout 100%:
image_tag=${CI_APPLICATION_TAG:-$CI_COMMIT_TAG}
fi
- replicas="1"
service_enabled="true"
postgres_enabled="$POSTGRES_ENABLED"
@@ -383,7 +382,7 @@ rollout 100%:
--set application.database_url="$DATABASE_URL" \
--set application.secretName="$APPLICATION_SECRET_NAME" \
--set application.secretChecksum="$APPLICATION_SECRET_CHECKSUM" \
- --set service.commonName="le.$KUBE_INGRESS_BASE_DOMAIN" \
+ --set service.commonName="le-$CI_PROJECT_ID.$KUBE_INGRESS_BASE_DOMAIN" \
--set service.url="$CI_ENVIRONMENT_URL" \
--set service.additionalHosts="$additional_hosts" \
--set replicaCount="$replicas" \
@@ -424,7 +423,7 @@ rollout 100%:
--set application.database_url="$DATABASE_URL" \
--set application.secretName="$APPLICATION_SECRET_NAME" \
--set application.secretChecksum="$APPLICATION_SECRET_CHECKSUM" \
- --set service.commonName="le.$KUBE_INGRESS_BASE_DOMAIN" \
+ --set service.commonName="le-$CI_PROJECT_ID.$KUBE_INGRESS_BASE_DOMAIN" \
--set service.url="$CI_ENVIRONMENT_URL" \
--set service.additionalHosts="$additional_hosts" \
--set replicaCount="$replicas" \
@@ -440,7 +439,9 @@ rollout 100%:
chart/
fi
- kubectl rollout status -n "$KUBE_NAMESPACE" -w "$ROLLOUT_RESOURCE_TYPE/$name"
+ if [[ -z "$ROLLOUT_STATUS_DISABLED" ]]; then
+ kubectl rollout status -n "$KUBE_NAMESPACE" -w "$ROLLOUT_RESOURCE_TYPE/$name"
+ fi
}
function scale() {
diff --git a/lib/gitlab/ci/templates/Security/DAST.gitlab-ci.yml b/lib/gitlab/ci/templates/Security/DAST.gitlab-ci.yml
index fd7fac5dcab..27a498b2daf 100644
--- a/lib/gitlab/ci/templates/Security/DAST.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Security/DAST.gitlab-ci.yml
@@ -1,4 +1,4 @@
-# Read more about this feature here: https://docs.gitlab.com/ee/user/project/merge_requests/dast.html
+# Read more about this feature here: https://docs.gitlab.com/ee/user/application_security/dast/
# Configure the scanning tool through the environment variables.
# List of the variables: https://gitlab.com/gitlab-org/security-products/dast#settings
@@ -12,46 +12,29 @@ stages:
dast:
stage: dast
- image: docker:stable
+ image:
+ name: "registry.gitlab.com/gitlab-org/security-products/dast:$CI_SERVER_VERSION_MAJOR-$CI_SERVER_VERSION_MINOR-stable"
variables:
- DOCKER_DRIVER: overlay2
+ # URL to scan:
+ # DAST_WEBSITE: https://example.com/
+ #
+ # Time limit for target availability (scan is attempted even when timeout):
+ # DAST_TARGET_AVAILABILITY_TIMEOUT: 60
+ #
+ # Set these variables to scan with an authenticated user:
+ # DAST_AUTH_URL: https://example.com/sign-in
+ # DAST_USERNAME: john.doe@example.com
+ # DAST_PASSWORD: john-doe-password
+ # DAST_USERNAME_FIELD: session[user] # the name of username field at the sign-in HTML form
+ # DAST_PASSWORD_FIELD: session[password] # the name of password field at the sign-in HTML form
+ # DAST_AUTH_EXCLUDE_URLS: http://example.com/sign-out,http://example.com/sign-out-2 # optional: URLs to skip during the authenticated scan; comma-separated, no spaces in between
+ #
+ # Perform ZAP Full Scan, which includes both passive and active scanning:
+ # DAST_FULL_SCAN_ENABLED: "true"
allow_failure: true
- services:
- - docker:stable-dind
script:
- export DAST_WEBSITE=${DAST_WEBSITE:-$(cat environment_url.txt)}
- - export DAST_VERSION=${SP_VERSION:-$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')}
- - |
- if ! docker info &>/dev/null; then
- if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then
- export DOCKER_HOST='tcp://localhost:2375'
- fi
- fi
- - |
- function dast_run() {
- docker run \
- --env DAST_FULL_SCAN_ENABLED \
- --env DAST_TARGET_AVAILABILITY_TIMEOUT \
- --volume "$PWD:/output" \
- --volume /var/run/docker.sock:/var/run/docker.sock \
- -w /output \
- "registry.gitlab.com/gitlab-org/security-products/dast:$DAST_VERSION" \
- /analyze -t $DAST_WEBSITE \
- "$@"
- }
- - |
- if [ -n "$DAST_AUTH_URL" ]
- then
- dast_run \
- --auth-url $DAST_AUTH_URL \
- --auth-username $DAST_USERNAME \
- --auth-password $DAST_PASSWORD \
- --auth-username-field $DAST_USERNAME_FIELD \
- --auth-password-field $DAST_PASSWORD_FIELD \
- --auth-exclude-urls $DAST_AUTH_EXCLUDE_URLS
- else
- dast_run
- fi
+ - /analyze -t $DAST_WEBSITE
artifacts:
reports:
dast: gl-dast-report.json
diff --git a/lib/gitlab/ci/templates/dotNET-Core.yml b/lib/gitlab/ci/templates/dotNET-Core.yml
index 558ca3d22e1..708b75f83e8 100644
--- a/lib/gitlab/ci/templates/dotNET-Core.yml
+++ b/lib/gitlab/ci/templates/dotNET-Core.yml
@@ -3,10 +3,11 @@
# ### Specify the Docker image
#
-# Instead of installing .NET Core SDK manually, a docker image is used
-# with already pre-installed .NET Core SDK.
-# The 'latest' tag targets the latest available version of .NET Core SDK image.
-# If preferred, you can explicitly specify version of .NET Core e.g. using '2.2-sdk' tag.
+# Instead of installing .NET Core SDK manually, a docker image is used
+# with already pre-installed .NET Core SDK.
+#
+# The 'latest' tag targets the latest available version of .NET Core SDK image.
+# If preferred, you can explicitly specify version of .NET Core (e.g. using '2.2-sdk' tag).
#
# See other available tags for .NET Core: https://hub.docker.com/r/microsoft/dotnet
# Learn more about Docker tags: https://docs.docker.com/glossary/?term=tag
@@ -17,16 +18,16 @@ image: microsoft/dotnet:latest
#
variables:
# 1) Name of directory where restore and build objects are stored.
- OBJECTS_DIRECTORY: 'obj'
- # 2) Name of directory used for keeping restored dependencies.
+ OBJECTS_DIRECTORY: 'obj'
+ # 2) Name of directory used for keeping restored dependencies.
NUGET_PACKAGES_DIRECTORY: '.nuget'
# 3) A relative path to the source code from project repository root.
# NOTE: Please edit this path so it matches the structure of your project!
- SOURCE_CODE_PATH: '*/*/'
+ SOURCE_CODE_PATH: '*/*/'
# ### Define stage list
#
-# In this example there are only two stages.
+# In this example there are only two stages.
# Initially, the project will be built and then tested.
stages:
- build
@@ -34,47 +35,55 @@ stages:
# ### Define global cache rule
#
-# Before building the project, all dependencies (e.g. third-party NuGet packages)
-# must be restored. Jobs on GitLab.com's Shared Runners are executed on autoscaled machines.
-# Each machine is used only once (for security reasons) and after that it is removed.
-# What that means is that before every job a dependency restore must be performed
+# Before building the project, all dependencies (e.g. third-party NuGet packages)
+# must be restored. Jobs on GitLab.com's Shared Runners are executed on autoscaled machines.
+#
+# Each machine is used only once (for security reasons) and after that is removed.
+# This means that, before every job, a dependency restore must be performed
# because restored dependencies are removed along with machines. Fortunately,
# GitLab provides cache mechanism with the aim of keeping restored dependencies
-# for other jobs. This example shows how to configure cache to pass over restored
+# for other jobs.
+#
+# This example shows how to configure cache to pass over restored
# dependencies for re-use.
#
# With global cache rule, cached dependencies will be downloaded before every job
# and then unpacked to the paths as specified below.
cache:
# Per-stage and per-branch caching.
- key: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
+ key: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
paths:
# Specify three paths that should be cached:
#
# 1) Main JSON file holding information about package dependency tree, packages versions,
# frameworks etc. It also holds information where to the dependencies were restored.
- - '$SOURCE_CODE_PATH$OBJECTS_DIRECTORY/project.assets.json'
+ - '$SOURCE_CODE_PATH$OBJECTS_DIRECTORY/project.assets.json'
# 2) Other NuGet and MSBuild related files. Also needed.
- - '$SOURCE_CODE_PATH$OBJECTS_DIRECTORY/*.csproj.nuget.*'
+ - '$SOURCE_CODE_PATH$OBJECTS_DIRECTORY/*.csproj.nuget.*'
# 3) Path to the directory where restored dependencies are kept.
- - '$NUGET_PACKAGES_DIRECTORY'
- # 'pull-push' policy means that latest cache will be downloaded (if exists)
- # before executing the job, and a newer version will be uploaded afterwards.
- # Such setting saves time when there are no changes in referenced third-party
- # packages. For example if you run a pipeline with changes in your code,
- # but with no changes within third-party packages which your project is using,
- # then project restore will happen in next to no time as all required dependencies
- # will already be there — unzipped from cache. 'pull-push' policy is a default
- # cache policy, you do not have to specify it explicitly.
- policy: pull-push
+ - '$NUGET_PACKAGES_DIRECTORY'
+ #
+ # 'pull-push' policy means that latest cache will be downloaded (if it exists)
+ # before executing the job, and a newer version will be uploaded afterwards.
+ # Such a setting saves time when there are no changes in referenced third-party
+ # packages.
+ #
+ # For example, if you run a pipeline with changes in your code,
+ # but with no changes within third-party packages which your project is using,
+ # then project restore will happen quickly as all required dependencies
+ # will already be there — unzipped from cache.
+
+ # 'pull-push' policy is the default cache policy, you do not have to specify it explicitly.
+ policy: pull-push
# ### Restore project dependencies
#
-# NuGet packages by default are restored to '.nuget/packages' directory
-# in the user's home directory. That directory is out of scope of GitLab caching.
-# To get around this a custom path can be specified using '--packages <PATH>' option
-# for 'dotnet restore' command. In this example a temporary directory is created
-# in the root of project repository, so it's content can be cached.
+# NuGet packages by default are restored to '.nuget/packages' directory
+# in the user's home directory. That directory is out of scope of GitLab caching.
+#
+# To get around this, a custom path can be specified using the '--packages <PATH>' option
+# for 'dotnet restore' command. In this example, a temporary directory is created
+# in the root of project repository, so its content can be cached.
#
# Learn more about GitLab cache: https://docs.gitlab.com/ee/ci/caching/index.html
before_script:
@@ -82,26 +91,26 @@ before_script:
build:
stage: build
- # ### Build all projects discovered from solution file.
+ # ### Build all projects discovered from solution file.
#
- # Note: this will fail if you have any projects in your solution that are not
- # .NET Core based projects e.g. WCF service, which is based on .NET Framework,
- # not .NET Core. In such scenario you will need to build every .NET Core based
- # project by explicitly specifying a relative path to the directory
- # where it is located e.g. 'dotnet build ./src/ConsoleApp'.
+ # Note: this will fail if you have any projects in your solution that are not
+ # .NET Core-based projects (e.g. WCF service), which is based on .NET Framework,
+ # not .NET Core. In this scenario, you will need to build every .NET Core-based
+ # project by explicitly specifying a relative path to the directory
+ # where it is located (e.g. 'dotnet build ./src/ConsoleApp').
# Only one project path can be passed as a parameter to 'dotnet build' command.
script:
- - 'dotnet build --no-restore'
+ - 'dotnet build --no-restore'
tests:
stage: test
# ### Run the tests
#
- # You can either run tests for all test projects that are defined in your solution
+ # You can either run tests for all test projects that are defined in your solution
# with 'dotnet test' or run tests only for specific project by specifying
- # a relative path to the directory where it is located e.g. 'dotnet test ./test/UnitTests'.
+ # a relative path to the directory where it is located (e.g. 'dotnet test ./test/UnitTests').
#
# You may want to define separate testing jobs for different types of testing
- # e.g. integration tests, unit tests etc.
+ # (e.g. integration tests, unit tests etc).
script:
- 'dotnet test --no-restore'
diff --git a/lib/gitlab/config/entry/validators.rb b/lib/gitlab/config/entry/validators.rb
index df34d254c65..6796fcce75f 100644
--- a/lib/gitlab/config/entry/validators.rb
+++ b/lib/gitlab/config/entry/validators.rb
@@ -36,10 +36,10 @@ module Gitlab
class AllowedArrayValuesValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
- unkown_values = value - options[:in]
- unless unkown_values.empty?
+ unknown_values = value - options[:in]
+ unless unknown_values.empty?
record.errors.add(attribute, "contains unknown values: " +
- unkown_values.join(', '))
+ unknown_values.join(', '))
end
end
end
diff --git a/lib/gitlab/danger/helper.rb b/lib/gitlab/danger/helper.rb
index 3ef19d801b7..f0ca397609d 100644
--- a/lib/gitlab/danger/helper.rb
+++ b/lib/gitlab/danger/helper.rb
@@ -121,6 +121,8 @@ module Gitlab
\.prettierrc |
\.scss-lint.yml |
\.stylelintrc |
+ \.haml-lint.yml |
+ \.haml-lint_todo.yml |
babel\.config\.js |
jest\.config\.js |
karma\.config\.js |
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index fc9bcbdcca2..455588f3c66 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -500,7 +500,7 @@ module Gitlab
end
# Return total diverging commits count
- def diverging_commit_count(from, to, max_count:)
+ def diverging_commit_count(from, to, max_count: 0)
wrapped_gitaly_errors do
gitaly_commit_client.diverging_commit_count(from, to, max_count: max_count)
end
diff --git a/lib/gitlab/git/rugged_impl/tree.rb b/lib/gitlab/git/rugged_impl/tree.rb
index bb13d114d46..9c37bb01961 100644
--- a/lib/gitlab/git/rugged_impl/tree.rb
+++ b/lib/gitlab/git/rugged_impl/tree.rb
@@ -43,6 +43,8 @@ module Gitlab
ordered_entries.concat(tree_entries_from_rugged(repository, sha, entry.path, true))
end
end
+
+ ordered_entries
end
def rugged_populate_flat_path(repository, sha, path, entries)
diff --git a/lib/gitlab/gitaly_client/commit_service.rb b/lib/gitlab/gitaly_client/commit_service.rb
index 2896b7e1ce0..d21b98d36ea 100644
--- a/lib/gitlab/gitaly_client/commit_service.rb
+++ b/lib/gitlab/gitaly_client/commit_service.rb
@@ -79,7 +79,7 @@ module Gitlab
def tree_entry(ref, path, limit = nil)
if Pathname.new(path).cleanpath.to_s.start_with?('../')
- # The TreeEntry RPC should return an empty reponse in this case but in
+ # The TreeEntry RPC should return an empty response in this case but in
# Gitaly 0.107.0 and earlier we get an exception instead. This early return
# saves us a Gitaly roundtrip while also avoiding the exception.
return
diff --git a/lib/gitlab/import_export/import_export.yml b/lib/gitlab/import_export/import_export.yml
index c6d4fda4af5..7bbcb53f016 100644
--- a/lib/gitlab/import_export/import_export.yml
+++ b/lib/gitlab/import_export/import_export.yml
@@ -176,6 +176,8 @@ excluded_attributes:
- :enabled
methods:
+ notes:
+ - :type
labels:
- :type
label:
diff --git a/lib/gitlab/import_export/members_mapper.rb b/lib/gitlab/import_export/members_mapper.rb
index 6be95a16513..5ab5059165e 100644
--- a/lib/gitlab/import_export/members_mapper.rb
+++ b/lib/gitlab/import_export/members_mapper.rb
@@ -59,7 +59,11 @@ module Gitlab
end
def member_hash(member)
- parsed_hash(member).merge('source_id' => @project.id, 'importing' => true)
+ parsed_hash(member).merge(
+ 'source_id' => @project.id,
+ 'importing' => true,
+ 'access_level' => [member['access_level'], ProjectMember::MAINTAINER].min
+ )
end
def parsed_hash(member)
diff --git a/lib/gitlab/import_export/project_tree_restorer.rb b/lib/gitlab/import_export/project_tree_restorer.rb
index 51001750a6c..20caadb89c0 100644
--- a/lib/gitlab/import_export/project_tree_restorer.rb
+++ b/lib/gitlab/import_export/project_tree_restorer.rb
@@ -129,7 +129,7 @@ module Gitlab
def visibility_level
level = override_params['visibility_level'] || json_params['visibility_level'] || @project.visibility_level
- level = @project.group.visibility_level if @project.group && level > @project.group.visibility_level
+ level = @project.group.visibility_level if @project.group && level.to_i > @project.group.visibility_level
{ 'visibility_level' => level }
end
diff --git a/lib/gitlab/lets_encrypt/challenge.rb b/lib/gitlab/lets_encrypt/challenge.rb
new file mode 100644
index 00000000000..6a7f5e965c5
--- /dev/null
+++ b/lib/gitlab/lets_encrypt/challenge.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module LetsEncrypt
+ class Challenge
+ def initialize(acme_challenge)
+ @acme_challenge = acme_challenge
+ end
+
+ delegate :url, :token, :file_content, :status, :request_validation, to: :acme_challenge
+
+ private
+
+ attr_reader :acme_challenge
+ end
+ end
+end
diff --git a/lib/gitlab/lets_encrypt/client.rb b/lib/gitlab/lets_encrypt/client.rb
new file mode 100644
index 00000000000..d7468b06767
--- /dev/null
+++ b/lib/gitlab/lets_encrypt/client.rb
@@ -0,0 +1,74 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module LetsEncrypt
+ class Client
+ PRODUCTION_DIRECTORY_URL = 'https://acme-v02.api.letsencrypt.org/directory'
+ STAGING_DIRECTORY_URL = 'https://acme-staging-v02.api.letsencrypt.org/directory'
+
+ def new_order(domain_name)
+ ensure_account
+
+ acme_order = acme_client.new_order(identifiers: [domain_name])
+
+ ::Gitlab::LetsEncrypt::Order.new(acme_order)
+ end
+
+ def load_order(url)
+ ensure_account
+
+ # rubocop: disable CodeReuse/ActiveRecord
+ ::Gitlab::LetsEncrypt::Order.new(acme_client.order(url: url))
+ # rubocop: enable CodeReuse/ActiveRecord
+ end
+
+ def load_challenge(url)
+ ensure_account
+
+ ::Gitlab::LetsEncrypt::Challenge.new(acme_client.challenge(url: url))
+ end
+
+ def terms_of_service_url
+ acme_client.terms_of_service
+ end
+
+ def enabled?
+ return false unless Feature.enabled?(:pages_auto_ssl)
+
+ Gitlab::CurrentSettings.lets_encrypt_terms_of_service_accepted
+ end
+
+ private
+
+ def acme_client
+ @acme_client ||= ::Acme::Client.new(private_key: private_key, directory: acme_api_directory_url)
+ end
+
+ def private_key
+ @private_key ||= OpenSSL::PKey.read(Gitlab::Application.secrets.lets_encrypt_private_key)
+ end
+
+ def admin_email
+ Gitlab::CurrentSettings.lets_encrypt_notification_email
+ end
+
+ def contact
+ "mailto:#{admin_email}"
+ end
+
+ def ensure_account
+ raise 'Acme integration is disabled' unless enabled?
+
+ @acme_account ||= acme_client.new_account(contact: contact, terms_of_service_agreed: true)
+ end
+
+ def acme_api_directory_url
+ if Rails.env.production?
+ PRODUCTION_DIRECTORY_URL
+ else
+ STAGING_DIRECTORY_URL
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/lets_encrypt/order.rb b/lib/gitlab/lets_encrypt/order.rb
new file mode 100644
index 00000000000..5109b5e9843
--- /dev/null
+++ b/lib/gitlab/lets_encrypt/order.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module LetsEncrypt
+ class Order
+ def initialize(acme_order)
+ @acme_order = acme_order
+ end
+
+ def new_challenge
+ authorization = @acme_order.authorizations.first
+ challenge = authorization.http
+ ::Gitlab::LetsEncrypt::Challenge.new(challenge)
+ end
+
+ delegate :url, :status, to: :acme_order
+
+ private
+
+ attr_reader :acme_order
+ end
+ end
+end
diff --git a/lib/gitlab/lfs_token.rb b/lib/gitlab/lfs_token.rb
index 31e6fc9d8c7..124e34562c1 100644
--- a/lib/gitlab/lfs_token.rb
+++ b/lib/gitlab/lfs_token.rb
@@ -35,8 +35,7 @@ module Gitlab
end
def token_valid?(token_to_check)
- HMACToken.new(actor).token_valid?(token_to_check) ||
- LegacyRedisDeviseToken.new(actor).token_valid?(token_to_check)
+ HMACToken.new(actor).token_valid?(token_to_check)
end
def deploy_key_pushable?(project)
@@ -103,44 +102,5 @@ module Gitlab
Settings.attr_encrypted_db_key_base.first(16)
end
end
-
- # TODO: LegacyRedisDeviseToken and references need to be removed after
- # next released milestone
- #
- class LegacyRedisDeviseToken
- TOKEN_LENGTH = 50
- DEFAULT_EXPIRY_TIME = 1800 * 1000 # 30 mins
-
- def initialize(actor)
- @actor = actor
- end
-
- def token_valid?(token_to_check)
- Devise.secure_compare(stored_token, token_to_check)
- end
-
- def stored_token
- Gitlab::Redis::SharedState.with { |redis| redis.get(state_key) }
- end
-
- # This method exists purely to facilitate legacy testing to ensure the
- # same redis key is used.
- #
- def store_new_token(expiry_time_in_ms = DEFAULT_EXPIRY_TIME)
- Gitlab::Redis::SharedState.with do |redis|
- new_token = Devise.friendly_token(TOKEN_LENGTH)
- redis.set(state_key, new_token, px: expiry_time_in_ms)
- new_token
- end
- end
-
- private
-
- attr_reader :actor
-
- def state_key
- "gitlab:lfs_token:#{actor.class.name.underscore}_#{actor.id}"
- end
- end
end
end
diff --git a/lib/gitlab/metrics/samplers/ruby_sampler.rb b/lib/gitlab/metrics/samplers/ruby_sampler.rb
index 4d9c43f37e7..18a69321905 100644
--- a/lib/gitlab/metrics/samplers/ruby_sampler.rb
+++ b/lib/gitlab/metrics/samplers/ruby_sampler.rb
@@ -23,32 +23,25 @@ module Gitlab
end
def init_metrics
- metrics = {
- file_descriptors: ::Gitlab::Metrics.gauge(with_prefix(:file, :descriptors), 'File descriptors used', labels, :livesum),
- memory_bytes: ::Gitlab::Metrics.gauge(with_prefix(:memory, :bytes), 'Memory used', labels, :livesum),
- process_cpu_seconds_total: ::Gitlab::Metrics.gauge(with_prefix(:process, :cpu_seconds_total), 'Process CPU seconds total'),
- process_max_fds: ::Gitlab::Metrics.gauge(with_prefix(:process, :max_fds), 'Process max fds'),
- process_resident_memory_bytes: ::Gitlab::Metrics.gauge(with_prefix(:process, :resident_memory_bytes), 'Memory used', labels, :livesum),
- process_start_time_seconds: ::Gitlab::Metrics.gauge(with_prefix(:process, :start_time_seconds), 'Process start time seconds'),
- sampler_duration: ::Gitlab::Metrics.counter(with_prefix(:sampler, :duration_seconds_total), 'Sampler time', labels),
- total_time: ::Gitlab::Metrics.counter(with_prefix(:gc, :duration_seconds_total), 'Total GC time', labels)
- }
-
+ metrics = {}
+ metrics[:sampler_duration] = ::Gitlab::Metrics.counter(with_prefix(:sampler, :duration_seconds_total), 'Sampler time', labels)
+ metrics[:total_time] = ::Gitlab::Metrics.counter(with_prefix(:gc, :duration_seconds_total), 'Total GC time', labels)
GC.stat.keys.each do |key|
metrics[key] = ::Gitlab::Metrics.gauge(with_prefix(:gc_stat, key), to_doc_string(key), labels, :livesum)
end
+ metrics[:memory_usage] = ::Gitlab::Metrics.gauge(with_prefix(:memory, :bytes), 'Memory used', labels, :livesum)
+ metrics[:file_descriptors] = ::Gitlab::Metrics.gauge(with_prefix(:file, :descriptors), 'File descriptors used', labels, :livesum)
+
metrics
end
def sample
start_time = System.monotonic_time
+ metrics[:memory_usage].set(labels.merge(worker_label), System.memory_usage)
metrics[:file_descriptors].set(labels.merge(worker_label), System.file_descriptor_count)
- metrics[:process_cpu_seconds_total].set(labels.merge(worker_label), ::Gitlab::Metrics::System.cpu_time)
- metrics[:process_max_fds].set(labels.merge(worker_label), ::Gitlab::Metrics::System.max_open_file_descriptors)
- metrics[:process_start_time_seconds].set(labels.merge(worker_label), ::Gitlab::Metrics::System.process_start_time)
- set_memory_usage_metrics
+
sample_gc
metrics[:sampler_duration].increment(labels, System.monotonic_time - start_time)
@@ -68,14 +61,6 @@ module Gitlab
metrics[:total_time].increment(labels, GC::Profiler.total_time)
end
- def set_memory_usage_metrics
- memory_usage = System.memory_usage
- memory_labels = labels.merge(worker_label)
-
- metrics[:memory_bytes].set(memory_labels, memory_usage)
- metrics[:process_resident_memory_bytes].set(memory_labels, memory_usage)
- end
-
def worker_label
return {} unless defined?(Unicorn::Worker)
diff --git a/lib/gitlab/metrics/samplers/unicorn_sampler.rb b/lib/gitlab/metrics/samplers/unicorn_sampler.rb
index 1b6c52ac0bf..bec64e864b3 100644
--- a/lib/gitlab/metrics/samplers/unicorn_sampler.rb
+++ b/lib/gitlab/metrics/samplers/unicorn_sampler.rb
@@ -8,16 +8,12 @@ module Gitlab
super(interval)
end
- def metrics
- @metrics ||= init_metrics
+ def unicorn_active_connections
+ @unicorn_active_connections ||= ::Gitlab::Metrics.gauge(:unicorn_active_connections, 'Unicorn active connections', {}, :max)
end
- def init_metrics
- {
- unicorn_active_connections: ::Gitlab::Metrics.gauge(:unicorn_active_connections, 'Unicorn active connections', {}, :max),
- unicorn_queued_connections: ::Gitlab::Metrics.gauge(:unicorn_queued_connections, 'Unicorn queued connections', {}, :max),
- unicorn_workers: ::Gitlab::Metrics.gauge(:unicorn_workers, 'Unicorn workers')
- }
+ def unicorn_queued_connections
+ @unicorn_queued_connections ||= ::Gitlab::Metrics.gauge(:unicorn_queued_connections, 'Unicorn queued connections', {}, :max)
end
def enabled?
@@ -27,13 +23,14 @@ module Gitlab
def sample
Raindrops::Linux.tcp_listener_stats(tcp_listeners).each do |addr, stats|
- set_unicorn_connection_metrics('tcp', addr, stats)
+ unicorn_active_connections.set({ socket_type: 'tcp', socket_address: addr }, stats.active)
+ unicorn_queued_connections.set({ socket_type: 'tcp', socket_address: addr }, stats.queued)
end
+
Raindrops::Linux.unix_listener_stats(unix_listeners).each do |addr, stats|
- set_unicorn_connection_metrics('unix', addr, stats)
+ unicorn_active_connections.set({ socket_type: 'unix', socket_address: addr }, stats.active)
+ unicorn_queued_connections.set({ socket_type: 'unix', socket_address: addr }, stats.queued)
end
-
- metrics[:unicorn_workers].set({}, unicorn_workers_count)
end
private
@@ -42,13 +39,6 @@ module Gitlab
@tcp_listeners ||= Unicorn.listener_names.grep(%r{\A[^/]+:\d+\z})
end
- def set_unicorn_connection_metrics(type, addr, stats)
- labels = { socket_type: type, socket_address: addr }
-
- metrics[:unicorn_active_connections].set(labels, stats.active)
- metrics[:unicorn_queued_connections].set(labels, stats.queued)
- end
-
def unix_listeners
@unix_listeners ||= Unicorn.listener_names - tcp_listeners
end
@@ -56,10 +46,6 @@ module Gitlab
def unicorn_with_listeners?
defined?(Unicorn) && Unicorn.listener_names.any?
end
-
- def unicorn_workers_count
- Sys::ProcTable.ps.select {|p| p.cmdline.match(/unicorn_rails worker.+ #{Rails.root.to_s}/)}.count
- end
end
end
end
diff --git a/lib/gitlab/metrics/system.rb b/lib/gitlab/metrics/system.rb
index ce0bb82d138..426496855e3 100644
--- a/lib/gitlab/metrics/system.rb
+++ b/lib/gitlab/metrics/system.rb
@@ -23,21 +23,6 @@ module Gitlab
def self.file_descriptor_count
Dir.glob('/proc/self/fd/*').length
end
-
- def self.max_open_file_descriptors
- match = File.read('/proc/self/limits').match(/Max open files\s*(\d+)/)
-
- return unless match && match[1]
-
- match[1].to_i
- end
-
- def self.process_start_time
- start_time_in_jiffies = Sys::ProcTable.ps(pid: Process.pid).starttime
- return 0 unless start_time_in_jiffies
-
- start_time_in_jiffies / 100
- end
else
def self.memory_usage
0.0
@@ -46,14 +31,6 @@ module Gitlab
def self.file_descriptor_count
0
end
-
- def self.max_open_file_descriptors
- 0
- end
-
- def self.process_start_time
- 0
- end
end
# THREAD_CPUTIME is not supported on OS X
diff --git a/lib/gitlab/path_regex.rb b/lib/gitlab/path_regex.rb
index a07b1246bee..aa2c1ac9cef 100644
--- a/lib/gitlab/path_regex.rb
+++ b/lib/gitlab/path_regex.rb
@@ -58,6 +58,7 @@ module Gitlab
uploads
users
v2
+ visual-review-toolbar.js
].freeze
# This list should contain all words following `/*namespace_id/:project_id` in
diff --git a/lib/gitlab/prometheus/query_variables.rb b/lib/gitlab/prometheus/query_variables.rb
index dca09aef47d..9cc21129547 100644
--- a/lib/gitlab/prometheus/query_variables.rb
+++ b/lib/gitlab/prometheus/query_variables.rb
@@ -5,8 +5,7 @@ module Gitlab
module QueryVariables
def self.call(environment)
deployment_platform = environment.deployment_platform
- namespace = deployment_platform&.namespace_for(environment.project) ||
- deployment_platform&.actual_namespace || ''
+ namespace = deployment_platform&.kubernetes_namespace_for(environment.project) || ''
{
ci_environment_slug: environment.slug,
diff --git a/lib/gitlab/routing.rb b/lib/gitlab/routing.rb
index 3b05f181ed2..84885be9bda 100644
--- a/lib/gitlab/routing.rb
+++ b/lib/gitlab/routing.rb
@@ -45,7 +45,7 @@ module Gitlab
def self.redirect_legacy_paths(router, *paths)
build_redirect_path = lambda do |request, _params, path|
- # Only replace the last occurence of `path`.
+ # Only replace the last occurrence of `path`.
#
# `request.fullpath` includes the querystring
new_path = request.path.sub(%r{/#{path}(/*)(?!.*#{path})}, "/-/#{path}\\1")
diff --git a/lib/gitlab/sentry.rb b/lib/gitlab/sentry.rb
index 356e6445e0e..72c44114001 100644
--- a/lib/gitlab/sentry.rb
+++ b/lib/gitlab/sentry.rb
@@ -10,7 +10,7 @@ module Gitlab
def self.context(current_user = nil)
return unless enabled?
- Raven.tags_context(locale: I18n.locale)
+ Raven.tags_context(default_tags)
if current_user
Raven.user_context(
@@ -44,16 +44,19 @@ module Gitlab
extra[:issue_url] = issue_url if issue_url
context # Make sure we've set everything we know in the context
- tags = {
- Labkit::Correlation::CorrelationId::LOG_KEY.to_sym => Labkit::Correlation::CorrelationId.current_id
- }
-
- Raven.capture_exception(exception, tags: tags, extra: extra)
+ Raven.capture_exception(exception, tags: default_tags, extra: extra)
end
end
def self.should_raise_for_dev?
Rails.env.development? || Rails.env.test?
end
+
+ def self.default_tags
+ {
+ Labkit::Correlation::CorrelationId::LOG_KEY.to_sym => Labkit::Correlation::CorrelationId.current_id,
+ locale: I18n.locale
+ }
+ end
end
end
diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb
index 08156d7ffa6..9aa2e972adf 100644
--- a/lib/gitlab/usage_data.rb
+++ b/lib/gitlab/usage_data.rb
@@ -26,7 +26,7 @@ module Gitlab
uuid: Gitlab::CurrentSettings.uuid,
hostname: Gitlab.config.gitlab.host,
version: Gitlab::VERSION,
- installation_type: Gitlab::INSTALLATION_TYPE,
+ installation_type: installation_type,
active_user_count: count(User.active),
recorded_at: Time.now,
edition: 'CE'
@@ -81,6 +81,7 @@ module Gitlab
milestone_lists: count(List.milestone),
milestones: count(Milestone),
pages_domains: count(PagesDomain),
+ pool_repositories: count(PoolRepository),
projects: count(Project),
projects_imported_from_github: count(Project.where(import_type: 'github')),
projects_with_repositories_enabled: count(ProjectFeature.where('repository_access_level > ?', ProjectFeature::DISABLED)),
@@ -190,6 +191,14 @@ module Gitlab
result[key] = approx_counts[model] || -1
end
end
+
+ def installation_type
+ if Rails.env.production?
+ Gitlab::INSTALLATION_TYPE
+ else
+ "gitlab-development-kit"
+ end
+ end
end
end
end
diff --git a/lib/mattermost/session.rb b/lib/mattermost/session.rb
index e2083848a8d..722e3e04d1c 100644
--- a/lib/mattermost/session.rb
+++ b/lib/mattermost/session.rb
@@ -122,7 +122,7 @@ module Mattermost
@oauth_uri = nil
- response = get('/oauth/gitlab/login', follow_redirects: false, format: 'text/html')
+ response = get('/oauth/gitlab/login', follow_redirects: false)
return unless (300...400) === response.code
redirect_uri = response.headers['location']
diff --git a/lib/support/init.d/gitlab b/lib/support/init.d/gitlab
index 2f2de083dc0..32df74f104a 100755
--- a/lib/support/init.d/gitlab
+++ b/lib/support/init.d/gitlab
@@ -1,8 +1,8 @@
#! /bin/sh
# GITLAB
-# Maintainer: @randx
-# Authors: rovanion.luckey@gmail.com, @randx
+# Maintainer: @dzaporozhets
+# Authors: rovanion.luckey@gmail.com, @dzaporozhets
### BEGIN INIT INFO
# Provides: gitlab
@@ -26,6 +26,7 @@
### Environment variables
RAILS_ENV="production"
+EXPERIMENTAL_PUMA=""
# Script variable names should be lower-case not to conflict with
# internal /bin/sh variables such as PATH, EDITOR or SHELL.
@@ -75,7 +76,7 @@ check_pids(){
echo "Could not create the path $pid_path needed to store the pids."
exit 1
fi
- # If there exists a file which should hold the value of the Unicorn pid: read it.
+ # If there exists a file which should hold the value of the web server pid: read it.
if [ -f "$web_server_pid_path" ]; then
wpid=$(cat "$web_server_pid_path")
else
@@ -198,7 +199,7 @@ check_stale_pids(){
# If there is a pid it is something else than 0, the service is running if
# *_status is == 0.
if [ "$wpid" != "0" ] && [ "$web_status" != "0" ]; then
- echo "Removing stale Unicorn web server pid. This is most likely caused by the web server crashing the last time it ran."
+ echo "Removing stale web server pid. This is most likely caused by the web server crashing the last time it ran."
if ! rm "$web_server_pid_path"; then
echo "Unable to remove stale pid, exiting."
exit 1
@@ -250,12 +251,12 @@ exit_if_not_running(){
fi
}
-## Starts Unicorn and Sidekiq if they're not running.
+## Starts web server and Sidekiq if they're not running.
start_gitlab() {
check_stale_pids
if [ "$web_status" != "0" ]; then
- echo "Starting GitLab Unicorn"
+ echo "Starting GitLab web server"
fi
if [ "$sidekiq_status" != "0" ]; then
echo "Starting GitLab Sidekiq"
@@ -275,12 +276,12 @@ start_gitlab() {
# Then check if the service is running. If it is: don't start again.
if [ "$web_status" = "0" ]; then
- echo "The Unicorn web server already running with pid $wpid, not restarting."
+ echo "The web server already running with pid $wpid, not restarting."
else
# Remove old socket if it exists
rm -f "$rails_socket" 2>/dev/null
# Start the web server
- RAILS_ENV=$RAILS_ENV bin/web start
+ RAILS_ENV=$RAILS_ENV EXPERIMENTAL_PUMA=$EXPERIMENTAL_PUMA bin/web start
fi
# If sidekiq is already running, don't start it again.
@@ -336,13 +337,13 @@ start_gitlab() {
print_status
}
-## Asks Unicorn, Sidekiq and MailRoom if they would be so kind as to stop, if not kills them.
+## Asks web server, Sidekiq and MailRoom if they would be so kind as to stop, if not kills them.
stop_gitlab() {
exit_if_not_running
if [ "$web_status" = "0" ]; then
- echo "Shutting down GitLab Unicorn"
- RAILS_ENV=$RAILS_ENV bin/web stop
+ echo "Shutting down GitLab web server"
+ RAILS_ENV=$RAILS_ENV EXPERIMENTAL_PUMA=$EXPERIMENTAL_PUMA bin/web stop
fi
if [ "$sidekiq_status" = "0" ]; then
echo "Shutting down GitLab Sidekiq"
@@ -398,9 +399,9 @@ print_status() {
return
fi
if [ "$web_status" = "0" ]; then
- echo "The GitLab Unicorn web server with pid $wpid is running."
+ echo "The GitLab web server with pid $wpid is running."
else
- printf "The GitLab Unicorn web server is \033[31mnot running\033[0m.\n"
+ printf "The GitLab web server is \033[31mnot running\033[0m.\n"
fi
if [ "$sidekiq_status" = "0" ]; then
echo "The GitLab Sidekiq job dispatcher with pid $spid is running."
@@ -438,15 +439,15 @@ print_status() {
fi
}
-## Tells unicorn to reload its config and Sidekiq to restart
+## Tells web server to reload its config and Sidekiq to restart
reload_gitlab(){
exit_if_not_running
if [ "$wpid" = "0" ];then
- echo "The GitLab Unicorn Web server is not running thus its configuration can't be reloaded."
+ echo "The GitLab web server Web server is not running thus its configuration can't be reloaded."
exit 1
fi
- printf "Reloading GitLab Unicorn configuration... "
- RAILS_ENV=$RAILS_ENV bin/web reload
+ printf "Reloading GitLab web server configuration... "
+ RAILS_ENV=$RAILS_ENV EXPERIMENTAL_PUMA=$EXPERIMENTAL_PUMA bin/web reload
echo "Done."
echo "Restarting GitLab Sidekiq since it isn't capable of reloading its config..."
@@ -461,7 +462,7 @@ reload_gitlab(){
print_status
}
-## Restarts Sidekiq and Unicorn.
+## Restarts Sidekiq and web server.
restart_gitlab(){
check_status
if [ "$web_status" = "0" ] || [ "$sidekiq_status" = "0" ] || [ "$gitlab_workhorse" = "0" ] || { [ "$mail_room_enabled" = true ] && [ "$mail_room_status" = "0" ]; } || { [ "$gitlab_pages_enabled" = true ] && [ "$gitlab_pages_status" = "0" ]; } || { [ "$gitaly_enabled" = true ] && [ "$gitaly_status" = "0" ]; }; then
diff --git a/lib/support/init.d/gitlab.default.example b/lib/support/init.d/gitlab.default.example
index 295c79fccfc..ab41dba3017 100644
--- a/lib/support/init.d/gitlab.default.example
+++ b/lib/support/init.d/gitlab.default.example
@@ -5,6 +5,9 @@
# Normal values are "production", "test" and "development".
RAILS_ENV="production"
+# Uncomment the line below to enable Puma web server instead of Unicorn.
+# EXPERIMENTAL_PUMA=1
+
# app_user defines the user that GitLab is run as.
# The default is "git".
app_user="git"
diff --git a/lib/system_check/base_check.rb b/lib/system_check/base_check.rb
index 46aad8aa885..c36cacbaf4f 100644
--- a/lib/system_check/base_check.rb
+++ b/lib/system_check/base_check.rb
@@ -121,7 +121,7 @@ module SystemCheck
#
# @see #try_fixing_it
# @see #fix_and_rerun
- # @see #for_more_infromation
+ # @see #for_more_information
def show_error
raise NotImplementedError
end
diff --git a/lib/tasks/haml-lint.rake b/lib/tasks/haml-lint.rake
index 786efd14b1a..305e15d69d5 100644
--- a/lib/tasks/haml-lint.rake
+++ b/lib/tasks/haml-lint.rake
@@ -1,6 +1,6 @@
unless Rails.env.production?
require 'haml_lint/rake_task'
- require 'haml_lint/inline_javascript'
+ require Rails.root.join('haml_lint/inline_javascript')
# Workaround for warnings from parser/current
# Keep it even if it no longer emits any warnings,
diff --git a/lib/tasks/lint.rake b/lib/tasks/lint.rake
index c5d0f2c292f..2353b2dc659 100644
--- a/lib/tasks/lint.rake
+++ b/lib/tasks/lint.rake
@@ -37,32 +37,15 @@ unless Rails.env.production?
lint:static_verification
].each do |task|
pid = Process.fork do
- rd_out, wr_out = IO.pipe
- rd_err, wr_err = IO.pipe
- stdout = $stdout.dup
- stderr = $stderr.dup
- $stdout.reopen(wr_out)
- $stderr.reopen(wr_err)
-
- begin
- Rake::Task[task].invoke
- rescue SystemExit => ex
- msg = "*** Rake task #{task} exited:"
- raise ex
- rescue => ex
- msg = "*** Rake task #{task} raised #{ex.class}:"
- raise ex
- ensure
- $stdout.reopen(stdout)
- $stderr.reopen(stderr)
- wr_out.close
- wr_err.close
-
- warn "\n#{msg}\n\n" if msg
-
- IO.copy_stream(rd_out, $stdout)
- IO.copy_stream(rd_err, $stderr)
- end
+ puts "*** Running rake task: #{task} ***"
+
+ Rake::Task[task].invoke
+ rescue SystemExit => ex
+ warn "!!! Rake task #{task} exited:"
+ raise ex
+ rescue StandardError, ScriptError => ex
+ warn "!!! Rake task #{task} raised #{ex.class}:"
+ raise ex
end
Process.waitpid(pid)
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 71ec8bcb9ba..6209530deab 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -868,6 +868,9 @@ msgstr ""
msgid "An error occurred while fetching the board lists. Please try again."
msgstr ""
+msgid "An error occurred while fetching the builds."
+msgstr ""
+
msgid "An error occurred while fetching the job log."
msgstr ""
@@ -883,6 +886,9 @@ msgstr ""
msgid "An error occurred while fetching the releases. Please try again."
msgstr ""
+msgid "An error occurred while fetching this tab."
+msgstr ""
+
msgid "An error occurred while getting projects"
msgstr ""
@@ -970,9 +976,18 @@ msgstr ""
msgid "Any"
msgstr ""
+msgid "Any Label"
+msgstr ""
+
+msgid "Any Milestone"
+msgstr ""
+
msgid "Any encrypted tokens"
msgstr ""
+msgid "Any namespace"
+msgstr ""
+
msgid "Appearance"
msgstr ""
@@ -1060,6 +1075,12 @@ msgstr ""
msgid "Are you sure that you want to unarchive this project?"
msgstr ""
+msgid "Are you sure you want to cancel creating this comment?"
+msgstr ""
+
+msgid "Are you sure you want to cancel editing this comment?"
+msgstr ""
+
msgid "Are you sure you want to delete this list?"
msgstr ""
@@ -1168,6 +1189,14 @@ msgstr ""
msgid "Attach a file by drag &amp; drop or %{upload_link}"
msgstr ""
+msgid "Attaching a file"
+msgid_plural "Attaching %d files"
+msgstr[0] ""
+msgstr[1] ""
+
+msgid "Attaching the file failed."
+msgstr ""
+
msgid "Aug"
msgstr ""
@@ -2578,6 +2607,9 @@ msgstr ""
msgid "Comment form position"
msgstr ""
+msgid "Comment is being updated"
+msgstr ""
+
msgid "Comments"
msgstr ""
@@ -3599,6 +3631,12 @@ msgstr ""
msgid "EmailError|Your account has been blocked. If you believe this is in error, contact a staff member."
msgstr ""
+msgid "EmailToken|reset it"
+msgstr ""
+
+msgid "EmailToken|resetting..."
+msgstr ""
+
msgid "Emails"
msgstr ""
@@ -3905,6 +3943,9 @@ msgstr ""
msgid "Error loading merge requests."
msgstr ""
+msgid "Error loading milestone tab"
+msgstr ""
+
msgid "Error loading project data. Please try again."
msgstr ""
@@ -4175,6 +4216,12 @@ msgstr ""
msgid "Failed to connect to the prometheus server"
msgstr ""
+msgid "Failed to create Merge Request. Please try again."
+msgstr ""
+
+msgid "Failed to create a branch for this issue. Please try again."
+msgstr ""
+
msgid "Failed to create repository via gitlab-shell"
msgstr ""
@@ -4184,6 +4231,9 @@ msgstr ""
msgid "Failed to deploy to"
msgstr ""
+msgid "Failed to get ref."
+msgstr ""
+
msgid "Failed to install."
msgstr ""
@@ -4193,6 +4243,9 @@ msgstr ""
msgid "Failed to load errors from Sentry. Error message: %{errorMessage}"
msgstr ""
+msgid "Failed to load related branches"
+msgstr ""
+
msgid "Failed to promote label due to internal error. Please contact administrators."
msgstr ""
@@ -4294,6 +4347,9 @@ msgstr ""
msgid "Files"
msgstr ""
+msgid "Files, directories, and submodules in the path %{path} for commit reference %{ref}"
+msgstr ""
+
msgid "Filter"
msgstr ""
@@ -4872,7 +4928,7 @@ msgstr ""
msgid "I accept the|Terms of Service and Privacy Policy"
msgstr ""
-msgid "I have read and agree to the Let's Encrypt Terms of Service"
+msgid "I have read and agree to the Let's Encrypt %{link_start}Terms of Service%{link_end}"
msgstr ""
msgid "ID"
@@ -5217,6 +5273,9 @@ msgstr ""
msgid "Issue events"
msgstr ""
+msgid "Issue update failed"
+msgstr ""
+
msgid "IssueBoards|Board"
msgstr ""
@@ -5487,6 +5546,9 @@ msgstr ""
msgid "Labels|Promoting %{labelTitle} will make it available for all projects inside %{groupName}. Existing project labels with the same title will be merged. This action cannot be reversed."
msgstr ""
+msgid "Labels|and %{count} more"
+msgstr ""
+
msgid "Language"
msgstr ""
@@ -5899,7 +5961,7 @@ msgstr ""
msgid "MergeRequest|Error loading full diff. Please try again."
msgstr ""
-msgid "MergeRequest|Filter files"
+msgid "MergeRequest|Filter files or search with %{modifier_key}+p"
msgstr ""
msgid "MergeRequest|No files found"
@@ -6001,7 +6063,10 @@ msgstr ""
msgid "Milestones|Promote Milestone"
msgstr ""
-msgid "Milestones|Promoting %{milestoneTitle} will make it available for all projects inside %{groupName}. Existing project milestones with the same title will be merged. This action cannot be reversed."
+msgid "Milestones|Promoting %{milestoneTitle} will make it available for all projects inside %{groupName}. Existing project milestones with the same title will be merged."
+msgstr ""
+
+msgid "Milestones|This action cannot be reversed."
msgstr ""
msgid "Mirror a repository"
@@ -6022,6 +6087,9 @@ msgstr ""
msgid "Mirroring settings were successfully updated."
msgstr ""
+msgid "Missing commit signatures endpoint!"
+msgstr ""
+
msgid "MissingSSHKeyWarningLink|add an SSH key"
msgstr ""
@@ -6252,6 +6320,9 @@ msgstr ""
msgid "No %{providerTitle} repositories available to import"
msgstr ""
+msgid "No Label"
+msgstr ""
+
msgid "No Milestone"
msgstr ""
@@ -6387,6 +6458,9 @@ msgstr ""
msgid "Note: Consider asking your GitLab administrator to configure %{github_integration_link}, which will allow login via GitHub and allow importing repositories without generating a Personal Access Token."
msgstr ""
+msgid "NoteForm|Note"
+msgstr ""
+
msgid "Notes|Are you sure you want to cancel creating this comment?"
msgstr ""
@@ -6402,6 +6476,9 @@ msgstr ""
msgid "Notes|Show history only"
msgstr ""
+msgid "Notes|This comment has changed since you started editing, please review the %{open_link}updated comment%{close_link} to ensure information is not lost"
+msgstr ""
+
msgid "Nothing to preview."
msgstr ""
@@ -7238,9 +7315,6 @@ msgstr ""
msgid "Profiles|The maximum file size allowed is 200KB."
msgstr ""
-msgid "Profiles|There was an error with the reCAPTCHA. Please solve the reCAPTCHA again."
-msgstr ""
-
msgid "Profiles|This doesn't look like a public SSH key, are you sure you want to add it?"
msgstr ""
@@ -7499,6 +7573,12 @@ msgstr ""
msgid "ProjectPage|Project ID: %{project_id}"
msgstr ""
+msgid "ProjectSelect| or group"
+msgstr ""
+
+msgid "ProjectSelect|Search for project"
+msgstr ""
+
msgid "ProjectSettings|Additional merge request capabilities that influence how and when merges will be performed"
msgstr ""
@@ -8026,6 +8106,9 @@ msgstr ""
msgid "Reports|Class"
msgstr ""
+msgid "Reports|Classname"
+msgstr ""
+
msgid "Reports|Execution time"
msgstr ""
@@ -8187,6 +8270,12 @@ msgstr ""
msgid "Revoked personal access token %{personal_access_token_name}!"
msgstr ""
+msgid "RightSidebar|adding a"
+msgstr ""
+
+msgid "RightSidebar|deleting the"
+msgstr ""
+
msgid "Run housekeeping"
msgstr ""
@@ -8337,6 +8426,9 @@ msgstr ""
msgid "Search files"
msgstr ""
+msgid "Search for a group"
+msgstr ""
+
msgid "Search for projects, issues, etc."
msgstr ""
@@ -9008,6 +9100,9 @@ msgstr ""
msgid "Star a label to make it a priority label. Order the prioritized labels to change their relative priority, by dragging."
msgstr ""
+msgid "Star toggle failed. Try again later."
+msgstr ""
+
msgid "StarProject|Star"
msgstr ""
@@ -9104,6 +9199,9 @@ msgstr ""
msgid "Storage:"
msgstr ""
+msgid "StorageSize|Unknown"
+msgstr ""
+
msgid "Subgroups"
msgstr ""
@@ -9137,6 +9235,9 @@ msgstr ""
msgid "Subscribed"
msgstr ""
+msgid "Subscription"
+msgstr ""
+
msgid "Subtracts"
msgstr ""
@@ -9622,6 +9723,9 @@ msgstr ""
msgid "There was a problem communicating with your device."
msgstr ""
+msgid "There was an error %{message} todo."
+msgstr ""
+
msgid "There was an error loading users activity calendar."
msgstr ""
@@ -10310,6 +10414,12 @@ msgstr ""
msgid "Unable to schedule a pipeline to run immediately"
msgstr ""
+msgid "Unable to update label prioritization at this time"
+msgstr ""
+
+msgid "Unable to update this issue at this time."
+msgstr ""
+
msgid "Unarchive project"
msgstr ""
@@ -11149,6 +11259,9 @@ msgstr ""
msgid "You need permission."
msgstr ""
+msgid "You need to be logged in."
+msgstr ""
+
msgid "You need to register a two-factor authentication app before you can set up a U2F device."
msgstr ""
@@ -11275,6 +11388,12 @@ msgstr ""
msgid "Your changes have been successfully committed."
msgstr ""
+msgid "Your comment could not be submitted! Please check your network connection and try again."
+msgstr ""
+
+msgid "Your comment could not be updated! Please check your network connection and try again."
+msgstr ""
+
msgid "Your comment will not be visible to the public."
msgstr ""
diff --git a/package.json b/package.json
index f19baac0229..381accff23b 100644
--- a/package.json
+++ b/package.json
@@ -23,20 +23,20 @@
"stylelint": "node node_modules/stylelint/bin/stylelint.js app/assets/stylesheets/**/*.* ee/app/assets/stylesheets/**/*.* !**/vendors/** --custom-formatter node_modules/stylelint-error-string-formatter",
"stylelint-file": "node node_modules/stylelint/bin/stylelint.js",
"stylelint-create-utility-map": "node scripts/frontend/stylelint/stylelint-utility-map.js",
- "test": "yarn jest && yarn karma",
+ "test": "node scripts/frontend/test",
"webpack": "NODE_OPTIONS=\"--max-old-space-size=3584\" webpack --config config/webpack.config.js",
"webpack-prod": "NODE_OPTIONS=\"--max-old-space-size=3584\" NODE_ENV=production webpack --config config/webpack.config.js"
},
"dependencies": {
- "@babel/core": "^7.2.2",
- "@babel/plugin-proposal-class-properties": "^7.3.0",
+ "@babel/core": "^7.4.4",
+ "@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/plugin-proposal-json-strings": "^7.2.0",
- "@babel/plugin-proposal-private-methods": "^7.3.0",
+ "@babel/plugin-proposal-private-methods": "^7.4.4",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-syntax-import-meta": "^7.2.0",
- "@babel/preset-env": "^7.3.1",
+ "@babel/preset-env": "^7.4.4",
"@gitlab/csslab": "^1.9.0",
- "@gitlab/svgs": "^1.60.0",
+ "@gitlab/svgs": "^1.62.0",
"@gitlab/ui": "^3.10.0",
"apollo-cache-inmemory": "^1.5.1",
"apollo-client": "^2.5.1",
@@ -97,6 +97,7 @@
"monaco-editor": "^0.15.6",
"monaco-editor-webpack-plugin": "^1.7.0",
"mousetrap": "^1.4.6",
+ "pdfjs-dist": "^2.0.943",
"pikaday": "^1.6.1",
"popper.js": "^1.14.7",
"prismjs": "^1.6.0",
@@ -182,7 +183,7 @@
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^4.0.0-beta.0",
"md5": "^2.2.1",
- "node-sass": "^4.11.0",
+ "node-sass": "^4.12.0",
"nodemon": "^1.18.9",
"pixelmatch": "^4.0.2",
"postcss": "^7.0.14",
diff --git a/public/visual-review-toolbar.js b/public/visual-review-toolbar.js
new file mode 100644
index 00000000000..dc21197bda9
--- /dev/null
+++ b/public/visual-review-toolbar.js
@@ -0,0 +1,626 @@
+///////////////////////////////////////////////
+/////////////////// STYLES ////////////////////
+///////////////////////////////////////////////
+
+const buttonClearStyles = `
+ -webkit-appearance: none;
+`;
+
+const buttonBaseStyles = `
+ cursor: pointer;
+ transition: background-color 100ms linear, border-color 100ms linear, color 100ms linear, box-shadow 100ms linear;
+`;
+
+const buttonSuccessActiveStyles = `
+ background-color: #168f48;
+ border-color: #12753a;
+ color: #fff;
+`;
+
+const buttonSuccessHoverStyles = `
+ color: #fff;
+ background-color: #137e3f;
+ border-color: #127339;
+`;
+
+const buttonSuccessStyles = `
+ ${buttonBaseStyles}
+ background-color: #1aaa55;
+ border: 1px solid #168f48;
+ color: #fff;
+`;
+
+const buttonSecondaryStyles = `
+ ${buttonBaseStyles}
+ background: none #fff;
+ margin: 0 .5rem;
+ border: 1px solid #e3e3e3;
+`;
+
+const buttonSecondaryActiveStyles = `
+ color: #2e2e2e;
+ background-color: #e1e1e1;
+ border-color: #dadada;
+`;
+
+const buttonSecondaryHoverStyles = `
+ background-color: #f0f0f0;
+ border-color: #e3e3e3;
+ color: #2e2e2e;
+`;
+
+const buttonWideStyles = `
+ width: 100%;
+`;
+
+const buttonWrapperStyles = `
+ margin-top: 1rem;
+ display: flex;
+ align-items: baseline;
+ justify-content: flex-end;
+`;
+
+const collapseStyles = `
+ ${buttonBaseStyles}
+ width: 2.4rem;
+ height: 2.2rem;
+ margin-left: 1rem;
+ padding: .5rem;
+`;
+
+const collapseClosedStyles = `
+ ${collapseStyles}
+ align-self: center;
+`;
+
+const collapseOpenStyles = `
+ ${collapseStyles}
+`;
+
+const checkboxLabelStyles = `
+ padding: 0 .2rem;
+`;
+
+const checkboxWrapperStyles = `
+ display: flex;
+ align-items: baseline;
+`;
+
+const formStyles = `
+ display: flex;
+ flex-direction: column;
+ width: 100%
+`;
+
+const labelStyles = `
+ font-weight: 600;
+ display: inline-block;
+ width: 100%;
+`;
+
+const linkStyles = `
+ color: #1b69b6;
+ text-decoration: none;
+ background-color: transparent;
+ background-image: none;
+`;
+
+const messageStyles = `
+ padding: .25rem 0;
+ margin: 0;
+ line-height: 1.2rem;
+`;
+
+const metadataNoteStyles = `
+ font-size: .7rem;
+ line-height: 1rem;
+ color: #666;
+ margin-bottom: 0;
+`;
+
+const inputStyles = `
+ width: 100%;
+ border: 1px solid #dfdfdf;
+ border-radius: 4px;
+ padding: .1rem .2rem;
+ min-height: 2rem;
+ max-width: 17rem;
+`;
+
+const svgInnerStyles = `
+ pointer-events: none;
+`;
+
+const wrapperClosedStyles = `
+ max-width: 3.4rem;
+ max-height: 3.4rem;
+`;
+
+const wrapperOpenStyles = `
+ max-width: 22rem;
+ max-height: 22rem;
+`;
+
+const wrapperStyles = `
+ max-width: 22rem;
+ max-height: 22rem;
+ overflow: scroll;
+ position: fixed;
+ bottom: 1rem;
+ right: 1rem;
+ display: flex;
+ flex-direction: row-reverse;
+ padding: 1rem;
+ background-color: #fff;
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell,
+ 'Helvetica Neue', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
+ 'Noto Color Emoji';
+ font-size: .8rem;
+ font-weight: 400;
+ color: #2e2e2e;
+`;
+
+const gitlabStyles = `
+ #gitlab-collapse > * {
+ ${svgInnerStyles}
+ }
+
+ #gitlab-form-wrapper {
+ ${formStyles}
+ }
+
+ #gitlab-review-container {
+ ${wrapperStyles}
+ }
+
+ .gitlab-open-wrapper {
+ ${wrapperOpenStyles}
+ }
+
+ .gitlab-closed-wrapper {
+ ${wrapperClosedStyles}
+ }
+
+ .gitlab-button-secondary {
+ ${buttonSecondaryStyles}
+ }
+
+ .gitlab-button-secondary:hover {
+ ${buttonSecondaryHoverStyles}
+ }
+
+ .gitlab-button-secondary:active {
+ ${buttonSecondaryActiveStyles}
+ }
+
+ .gitlab-button-success:hover {
+ ${buttonSuccessHoverStyles}
+ }
+
+ .gitlab-button-success:active {
+ ${buttonSuccessActiveStyles}
+ }
+
+ .gitlab-button-success {
+ ${buttonSuccessStyles}
+ }
+
+ .gitlab-button-wide {
+ ${buttonWideStyles}
+ }
+
+ .gitlab-button-wrapper {
+ ${buttonWrapperStyles}
+ }
+
+ .gitlab-collapse-closed {
+ ${collapseClosedStyles}
+ }
+
+ .gitlab-collapse-open {
+ ${collapseOpenStyles}
+ }
+
+ .gitlab-checkbox-label {
+ ${checkboxLabelStyles}
+ }
+
+ .gitlab-checkbox-wrapper {
+ ${checkboxWrapperStyles}
+ }
+
+ .gitlab-label {
+ ${labelStyles}
+ }
+
+ .gitlab-link {
+ ${linkStyles}
+ }
+
+ .gitlab-message {
+ ${messageStyles}
+ }
+
+ .gitlab-metadata-note {
+ ${metadataNoteStyles}
+ }
+
+ .gitlab-input {
+ ${inputStyles}
+ }
+`;
+
+function addStylesheet() {
+ const styleEl = document.createElement('style');
+ styleEl.insertAdjacentHTML('beforeend', gitlabStyles);
+ document.head.appendChild(styleEl);
+}
+
+///////////////////////////////////////////////
+/////////////////// STATE ////////////////////
+///////////////////////////////////////////////
+const data = {};
+
+///////////////////////////////////////////////
+///////////////// COMPONENTS //////////////////
+///////////////////////////////////////////////
+const note = `
+ <p id='gitlab-validation-note' class='gitlab-message'></p>
+`;
+
+const comment = `
+ <div>
+ <textarea id='gitlab-comment' name='gitlab-comment' rows='3' placeholder='Enter your feedback or idea' class='gitlab-input'></textarea>
+ ${note}
+ <p class='gitlab-metadata-note'>Additional metadata will be included: browser, OS, current page, user agent, and viewport dimensions.</p>
+ </div>
+ <div class='gitlab-button-wrapper''>
+ <button class='gitlab-button-secondary' style='${buttonClearStyles}' type='button' id='gitlab-logout-button'> Logout </button>
+ <button class='gitlab-button-success' style='${buttonClearStyles}' type='button' id='gitlab-comment-button'> Send feedback </button>
+ </div>
+`;
+
+const commentIcon = `
+ <svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><title>icn/comment</title><path d="M4 11.132l1.446-.964A1 1 0 0 1 6 10h5a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v6.132zM6.303 12l-2.748 1.832A1 1 0 0 1 2 13V5a3 3 0 0 1 3-3h6a3 3 0 0 1 3 3v4a3 3 0 0 1-3 3H6.303z" id="gitlab-comment-icon"/></svg>
+`
+
+const compressIcon = `
+ <svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><title>icn/compress</title><path d="M5.27 12.182l-1.562 1.561a1 1 0 0 1-1.414 0h-.001a1 1 0 0 1 0-1.415l1.56-1.56L2.44 9.353a.5.5 0 0 1 .353-.854H7.09a.5.5 0 0 1 .5.5v4.294a.5.5 0 0 1-.853.353l-1.467-1.465zm6.911-6.914l1.464 1.464a.5.5 0 0 1-.353.854H8.999a.5.5 0 0 1-.5-.5V2.793a.5.5 0 0 1 .854-.354l1.414 1.415 1.56-1.561a1 1 0 1 1 1.415 1.414l-1.561 1.56z" id="gitlab-compress-icon"/></svg>
+`;
+
+const collapseButton = `
+ <button id='gitlab-collapse' style='${buttonClearStyles}' class='gitlab-collapse-open gitlab-button-secondary'>${compressIcon}</button>
+`;
+
+
+const form = (content) => `
+ <div id='gitlab-form-wrapper'>
+ ${content}
+ </div>
+`;
+
+const login = `
+ <div>
+ <label for='gitlab-token' class='gitlab-label'>Enter your <a class='gitlab-link' href="https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html">personal access token</a></label>
+ <input class='gitlab-input' type='password' id='gitlab-token' name='gitlab-token'>
+ ${note}
+ </div>
+ <div class='gitlab-checkbox-wrapper'>
+ <input type="checkbox" id="remember_token" name="remember_token" value="remember">
+ <label for="remember_token" class='gitlab-checkbox-label'>Remember me</label>
+ </div>
+ <div class='gitlab-button-wrapper'>
+ <button class='gitlab-button-wide gitlab-button-success' style='${buttonClearStyles}' type='button' id='gitlab-login'> Submit </button>
+ </div>
+`;
+
+///////////////////////////////////////////////
+//////////////// INTERACTIONS /////////////////
+///////////////////////////////////////////////
+
+// from https://developer.mozilla.org/en-US/docs/Web/API/Window/navigator
+function getBrowserId (sUsrAg) {
+ var aKeys = ["MSIE", "Edge", "Firefox", "Safari", "Chrome", "Opera"],
+ nIdx = aKeys.length - 1;
+
+ for (nIdx; nIdx > -1 && sUsrAg.indexOf(aKeys[nIdx]) === -1; nIdx--);
+ return aKeys[nIdx];
+}
+
+function addCommentForm () {
+ const formWrapper = document.getElementById('gitlab-form-wrapper');
+ formWrapper.innerHTML = comment;
+}
+
+function addLoginForm () {
+ const formWrapper = document.getElementById('gitlab-form-wrapper');
+ formWrapper.innerHTML = login;
+}
+
+function authorizeUser () {
+ // Clear any old errors
+ clearNote('gitlab-token');
+
+ const token = document.getElementById('gitlab-token').value;
+ const rememberMe = document.getElementById('remember_token').checked;
+
+ if (!token) {
+ postError('Please enter your token.', 'gitlab-token');
+ return;
+ }
+
+ if (rememberMe) {
+ storeToken(token);
+ }
+
+ authSuccess(token);
+ return;
+}
+
+function authSuccess (token) {
+ data.token = token;
+ addCommentForm();
+}
+
+
+function clearNote (inputId) {
+ const note = document.getElementById('gitlab-validation-note');
+ note.innerText = '';
+ note.style.color = '';
+
+ if (inputId) {
+ const field = document.getElementById(inputId);
+ field.style.borderColor = '';
+ }
+}
+
+function confirmAndClear (discussionId) {
+ const commentButton = document.getElementById('gitlab-comment-button');
+ const note = document.getElementById('gitlab-validation-note');
+
+ commentButton.innerText = 'Feedback sent';
+ note.innerText = `Your comment was successfully posted to issue #${discussionId}`;
+
+ setTimeout(resetCommentButton, 1000);
+}
+
+function getInitialState () {
+ const { localStorage } = window;
+
+ try {
+ let token = localStorage.getItem('token');
+
+ if (token) {
+ data.token = token;
+ return comment;
+ }
+
+ return login;
+
+ } catch (err) {
+ return login;
+ }
+}
+
+function getProjectDetails () {
+ const { innerWidth,
+ innerHeight,
+ location: { href },
+ navigator: {
+ platform, userAgent
+ } } = window;
+ const browser = getBrowserId(userAgent);
+
+ const scriptEl = document.getElementById('review-app-toolbar-script')
+ const { projectId, discussionId, mrUrl } = scriptEl.dataset;
+
+ return {
+ href,
+ platform,
+ browser,
+ userAgent,
+ innerWidth,
+ innerHeight,
+ projectId,
+ discussionId,
+ mrUrl,
+ };
+}
+
+function logoutUser () {
+ const { localStorage } = window;
+
+ // All the browsers we support have localStorage, so let's silently fail
+ // and go on with the rest of the functionality.
+ try {
+ localStorage.removeItem('token');
+ } catch (err) {
+ return;
+ }
+
+ addLoginForm();
+}
+
+function postComment ({
+ href,
+ platform,
+ browser,
+ userAgent,
+ innerWidth,
+ innerHeight,
+ projectId,
+ discussionId,
+ mrUrl,
+}) {
+ // Clear any old errors
+ clearNote('gitlab-comment');
+
+ setInProgressState();
+
+ const commentText = document.getElementById('gitlab-comment').value.trim();
+
+ if (!commentText) {
+ postError('Your comment appears to be empty.', 'gitlab-comment');
+ resetCommentBox();
+ return;
+ }
+
+ const detailText = `
+ <details>
+ <summary>Metadata</summary>
+ Posted from ${href} | ${platform} | ${browser} | ${innerWidth} x ${innerHeight}.
+ <br /><br />
+ *User agent: ${userAgent}*
+ </details>
+ `;
+
+ const url = `
+ ${mrUrl}/api/v4/projects/${projectId}/issues/${discussionId}/discussions`;
+
+ const body = `${commentText}${detailText}`;
+
+ fetch(url, {
+ method: 'POST',
+ headers: {
+ 'PRIVATE-TOKEN': data.token,
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({ body }),
+ })
+ .then((response) => {
+ if (response.ok) {
+ confirmAndClear(discussionId);
+ return;
+ }
+
+ throw new Error(`${response.status}: ${response.statusText}`)
+ })
+ .catch((err) => {
+ postError(`The feedback was not sent successfully. Please try again. Error: ${err.message}`, 'gitlab-comment');
+ resetCommentBox();
+ });
+}
+
+function postError (message, inputId) {
+ const note = document.getElementById('gitlab-validation-note');
+ const field = document.getElementById(inputId);
+ field.style.borderColor = '#db3b21';
+ note.style.color = '#db3b21';
+ note.innerText = message;
+}
+
+function resetCommentBox() {
+ const commentBox = document.getElementById('gitlab-comment');
+ const commentButton = document.getElementById('gitlab-comment-button');
+
+ commentButton.innerText = 'Send feedback';
+ commentButton.classList.replace('gitlab-button-secondary', 'gitlab-button-success');
+ commentButton.style.opacity = 1;
+
+ commentBox.style.pointerEvents = 'auto';
+ commentBox.style.color = 'rgba(0, 0, 0, 1)';
+}
+
+function resetCommentButton() {
+ const commentBox = document.getElementById('gitlab-comment');
+ const note = document.getElementById('gitlab-validation-note');
+
+ commentBox.value = '';
+ note.innerText = '';
+ resetCommentBox();
+}
+
+function setInProgressState() {
+ const commentButton = document.getElementById('gitlab-comment-button');
+ const commentBox = document.getElementById('gitlab-comment');
+
+ commentButton.innerText = 'Sending feedback';
+ commentButton.classList.replace('gitlab-button-success', 'gitlab-button-secondary');
+ commentButton.style.opacity = 0.5;
+ commentBox.style.color = 'rgba(223, 223, 223, 0.5)';
+ commentBox.style.pointerEvents = 'none';
+}
+
+function storeToken (token) {
+
+ const { localStorage } = window;
+
+ // All the browsers we support have localStorage, so let's silently fail
+ // and go on with the rest of the functionality.
+ try {
+ localStorage.setItem('token', token);
+ } catch (err) {
+ return;
+ }
+}
+
+function toggleForm () {
+ const container = document.getElementById('gitlab-review-container');
+ const collapseButton = document.getElementById('gitlab-collapse');
+ const form = document.getElementById('gitlab-form-wrapper');
+ const OPEN = 'open';
+ const CLOSED = 'closed';
+
+ const stateVals = {
+ [OPEN]: {
+ buttonClasses: ['gitlab-collapse-closed', 'gitlab-collapse-open'],
+ containerClasses: ['gitlab-closed-wrapper', 'gitlab-open-wrapper'],
+ icon: compressIcon,
+ display: 'flex',
+ backgroundColor: 'rgba(255, 255, 255, 1)',
+ },
+ [CLOSED]: {
+ buttonClasses: ['gitlab-collapse-open', 'gitlab-collapse-closed'],
+ containerClasses: ['gitlab-open-wrapper', 'gitlab-closed-wrapper'],
+ icon: commentIcon,
+ display: 'none',
+ backgroundColor: 'rgba(255, 255, 255, 0)',
+ },
+ }
+
+ const nextState = collapseButton.classList.contains('gitlab-collapse-open') ? CLOSED : OPEN;
+
+ container.classList.replace(...stateVals[nextState].containerClasses);
+ container.style.backgroundColor = stateVals[nextState].backgroundColor;
+ form.style.display = stateVals[nextState].display;
+ collapseButton.classList.replace(...stateVals[nextState].buttonClasses);
+ collapseButton.innerHTML = stateVals[nextState].icon;
+}
+
+///////////////////////////////////////////////
+///////////////// INJECTION //////////////////
+///////////////////////////////////////////////
+
+function noop() {};
+
+const eventLookup = ({target: { id }}) => {
+ switch (id) {
+ case 'gitlab-collapse':
+ return toggleForm;
+ case 'gitlab-comment-button':
+ const projectDetails = getProjectDetails();
+ return postComment.bind(null, projectDetails);
+ case 'gitlab-login':
+ return authorizeUser;
+ case 'gitlab-logout-button':
+ return logoutUser;
+ default:
+ return noop;
+ }
+};
+
+window.addEventListener('load', () => {
+ const content = getInitialState();
+ const container = document.createElement('div');
+
+ container.setAttribute('id', 'gitlab-review-container');
+ container.insertAdjacentHTML('beforeend', collapseButton);
+ container.insertAdjacentHTML('beforeend', form(content));
+
+ document.body.insertBefore(container, document.body.firstChild);
+ addStylesheet();
+
+ document.getElementById('gitlab-review-container').addEventListener('click', (event) => {
+ eventLookup(event)();
+ });
+});
diff --git a/qa/docs/BEST_PRACTICES.md b/qa/docs/BEST_PRACTICES.md
index a872b915926..3a2640607e4 100644
--- a/qa/docs/BEST_PRACTICES.md
+++ b/qa/docs/BEST_PRACTICES.md
@@ -6,7 +6,7 @@ A good example is a user being logged in as a pre-condition for testing the feat
But if the login feature is already covered with end-to-end tests through the GUI, there is no reason to perform such an expensive task to test the functionality of creating a project, or importing a repo, even if this features depend on a user being logged in. Let's see an example to make things clear.
-Let's say that, on average, the process to perform a successfull login through the GUI takes 2 seconds.
+Let's say that, on average, the process to perform a successful login through the GUI takes 2 seconds.
Now, realize that almost all tests need the user to be logged in, and that we need every test to run in isolation, meaning that tests cannot interfere with each other. This would mean that for every test the user needs to log in, and "waste 2 seconds".
diff --git a/qa/docs/WRITING_TESTS_FROM_SCRATCH.md b/qa/docs/WRITING_TESTS_FROM_SCRATCH.md
index a6daffc964e..309fcc4064c 100644
--- a/qa/docs/WRITING_TESTS_FROM_SCRATCH.md
+++ b/qa/docs/WRITING_TESTS_FROM_SCRATCH.md
@@ -188,7 +188,7 @@ def select_label_and_refresh(label)
end
```
-By creating a reusable `select_label_and_refresh` method we remove the code duplication, and later we can move this method to a Page Object class that will be created for easier maintenance purposes.
+By creating a reusable `select_label_and_refresh` method, we remove the code duplication, and later we can move this method to a Page Object class that will be created for easier maintenance purposes.
> Notice that the reusable method is created in the bottom of the file. The reason for that is that reading the code should be similar to reading a newspaper, where high-level information is at the top, like the title and summary of the news, while low level, or more specific information, is at the bottom.
@@ -271,7 +271,7 @@ end
In the `before :all` block we create all the application state needed for the tests to run. We do that by fabricating resources via APIs (`project`, `@issue`, and `@labels`), by using the `Runtime::Browser.visit` method to go to the login page, and by performing a `sign_in_using_credentials` from the `Login` Page Object.
-> When creating the resources, notice that when calling the `fabricate_via_api` method, we pass some attribute:values, like `name` for the `project` resoruce, `project`, `title`, and `labels` for the the issue resource, and `project`, and `title` for `label` resources.
+> When creating the resources, notice that when calling the `fabricate_via_api` method, we pass some attribute:values, like `name` for the `project` resource; `project`, `title`, and `labels` for the `issue` resource; and `project`, and `title` for `label` resources.
> What's important to understand here is that by creating the application state mostly using the public APIs we save a lot of time in the test suite setup stage.
@@ -279,7 +279,7 @@ In the `before :all` block we create all the application state needed for the te
### 6. Optimization
-As already mentioned in the [best practices](./BEST_PRACTICES.md) document, end-to-end tests are very costly in terms of execution time, and it's our responsibility as software engineers to ensure that we optimize them as max as possible.
+As already mentioned in the [best practices](./BEST_PRACTICES.md) document, end-to-end tests are very costly in terms of execution time, and it's our responsibility as software engineers to ensure that we optimize them as much as possible.
> Differently than unit tests, that exercise every little piece of the application in isolation, usually having only one assertion per test, and being very fast to run, end-to-end tests can have more actions and assertions in a single test to help on speeding up the test's feedback since they are much slower when comparing to unit tests.
@@ -361,7 +361,109 @@ Finally, the `select_label_and_refresh` method is changed to `select_labels_and_
### 7. Resources
-TBD.
+You can think of resources as anything that can be created on GitLab CE or EE, either through the GUI, the API, or the CLI.
+
+With that in mind, resources can be a project, an epic, an issue, a label, a commit, etc.
+
+As you saw in the tests' pre-conditions and the optimization sections, we're already creating some of these resources, and we are doing that by calling the `fabricate_via_api!` method.
+
+> We could be using the `fabricate!` method instead, which would use the `fabricate_via_api!` method if it exists, and fallback to GUI fabrication otherwise, but we recommend being explicit to make it clear what the test does. Also, we recommend fabricating resources via API since this makes tests faster and more reliable, unless the test is focusing on the GUI itself, or there's no GUI coverage for that specific part in any other test.
+
+For our test suite example, the [project resource](https://gitlab.com/gitlab-org/gitlab-ee/blob/d3584e80b4236acdf393d815d604801573af72cc/qa/qa/resource/project.rb#L55) already had a `fabricate_via_api!` method available, while other resources don't have it, so we will have to create them, like for the issue and label resources. Also, we will have to make a small change in the project resource to expose its `id` attribute so that we can refer to it when fabricating the issue.
+
+#### Implementation
+
+Following we describe the changes needed in every of the before-mentioned resource files.
+
+**Project resource**
+
+Let's start with the smallest change.
+
+In the [project resource](https://gitlab.com/gitlab-org/gitlab-ee/blob/master/qa/qa/resource/project.rb), let's expose its `id` attribute.
+
+Add the following `attribute :id` right below the [`attribute :description`](https://gitlab.com/gitlab-org/gitlab-ee/blob/d3584e80b4236acdf393d815d604801573af72cc/qa/qa/resource/project.rb#L11).
+
+> This line is needed to allow for issues and labels to be automatically added to a project when fabricating them via API.
+
+**Issue resource**
+
+Now, let's make it possible to create an issue resource through the API.
+
+First, in the [issue resource](https://gitlab.com/gitlab-org/gitlab-ee/blob/d3584e80b4236acdf393d815d604801573af72cc/qa/qa/resource/issue.rb), let's expose its labels attribute.
+
+Add the following `attribute :labels` right below the [`attribute :title`](https://gitlab.com/gitlab-org/gitlab-ee/blob/d3584e80b4236acdf393d815d604801573af72cc/qa/qa/resource/issue.rb#L15).
+
+> This line is needed to allow for labels to be automatically added to an issue when fabricating it via API.
+
+Next, add the following code right below the [`fabricate!`](https://gitlab.com/gitlab-org/gitlab-ee/blob/d3584e80b4236acdf393d815d604801573af72cc/qa/qa/resource/issue.rb#L27) method.
+
+```ruby
+def api_get_path
+ "/projects/#{project.id}/issues/#{id}"
+end
+
+def api_post_path
+ "/projects/#{project.id}/issues"
+end
+
+def api_post_body
+ {
+ title: title,
+ labels: [labels]
+ }
+end
+```
+
+By defining the `api_get_path` method, we allow the [`ApiFabricator`](https://gitlab.com/gitlab-org/gitlab-ee/blob/master/qa/qa/resource/api_fabricator.rb) module to know which path to use to get a single issue.
+
+> This `GET` path can be found in the [public API documentation](https://docs.gitlab.com/ee/api/issues.html#single-issue).
+
+By defining the `api_post_path` method, we allow the [`ApiFabricator`](https://gitlab.com/gitlab-org/gitlab-ee/blob/master/qa/qa/resource/api_fabricator.rb) module to know which path to use to create a new issue in a specific project.
+
+> This `POST` path can be found in the [public API documentation](https://docs.gitlab.com/ee/api/issues.html#new-issue).
+
+By defining the `api_post_body` method, we allow the [`ApiFabricator.api_post`](https://gitlab.com/gitlab-org/gitlab-ee/blob/a9177ca1812bac57e2b2fa4560e1d5dd8ffac38b/qa/qa/resource/api_fabricator.rb#L68) method to know which data to send when making the `POST` request.
+
+> Notice that we pass both `title` and `labels` attributes in the `api_post_body`, where `labels` receives an array of labels, and [`title` is required](https://docs.gitlab.com/ee/api/issues.html#new-issue).
+
+**Label resource**
+
+Finally, let's make it possible to create label resources through the API.
+
+Add the following code right below the [`fabricate!`](https://gitlab.com/gitlab-org/gitlab-ee/blob/a9177ca1812bac57e2b2fa4560e1d5dd8ffac38b/qa/qa/resource/label.rb#L36) method.
+
+```ruby
+def resource_web_url(resource)
+ super
+rescue ResourceURLMissingError
+ # this particular resource does not expose a web_url property
+end
+
+def api_get_path
+ raise NotImplementedError, "The Labels API doesn't expose a single-resource endpoint so this method cannot be properly implemented."
+end
+
+def api_post_path
+ "/projects/#{project}/labels"
+end
+
+def api_post_body
+ {
+ name: @title,
+ color: @color
+ }
+end
+```
+
+By defining the `resource_web_url(resource)` method, we override the one from the [`ApiFabricator`](https://gitlab.com/gitlab-org/gitlab-ee/blob/master/qa/qa/resource/api_fabricator.rb#L44) module. We do that to avoid failing the test due to this particular resource not exposing a `web_url` property.
+
+By defining the `api_get_path` method, we **would** allow for the [`ApiFabricator`](https://gitlab.com/gitlab-org/gitlab-ee/blob/master/qa/qa/resource/api_fabricator.rb) module to know which path to use to get a single label, but since there's no path available for that in the publich API, we raise a `NotImplementedError` instead.
+
+By defining the `api_post_path` method, we allow for the [`ApiFabricator `](https://gitlab.com/gitlab-org/gitlab-ee/blob/master/qa/qa/resource/api_fabricator.rb) module to know which path to use to create a new label in a specific project.
+
+By defining the `api_post_body` method, we we allow for the [`ApiFabricator.api_post`](https://gitlab.com/gitlab-org/gitlab-ee/blob/a9177ca1812bac57e2b2fa4560e1d5dd8ffac38b/qa/qa/resource/api_fabricator.rb#L68) method to know which data to send when making the `POST` request.
+
+> Notice that we pass both `name` and `color` attributes in the `api_post_body` since [those are required](https://docs.gitlab.com/ee/api/labels.html#create-a-new-label).
### 8. Page Objects
@@ -377,4 +479,4 @@ Now, let's go back to our examples.
#### Adding testability
-TBD. \ No newline at end of file
+TBD.
diff --git a/qa/qa/resource/README.md b/qa/qa/resource/README.md
index 4cdeb3f42a2..2c8859b6599 100644
--- a/qa/qa/resource/README.md
+++ b/qa/qa/resource/README.md
@@ -1,7 +1,7 @@
# Resource class in GitLab QA
Resources are primarily created using Browser UI steps, but can also
-be created via the API.
+be created via the API or the CLI.
## How to properly implement a resource class?
diff --git a/qa/qa/resource/ci_variable.rb b/qa/qa/resource/ci_variable.rb
index d82de4cb816..341d3c1ed7e 100644
--- a/qa/qa/resource/ci_variable.rb
+++ b/qa/qa/resource/ci_variable.rb
@@ -25,6 +25,33 @@ module QA
end
end
end
+
+ def fabricate_via_api!
+ resource_web_url(api_get)
+ rescue ResourceNotFoundError
+ super
+ end
+
+ def resource_web_url(resource)
+ super
+ rescue ResourceURLMissingError
+ # this particular resource does not expose a web_url property
+ end
+
+ def api_get_path
+ "/projects/#{project.id}/variables/#{key}"
+ end
+
+ def api_post_path
+ "/projects/#{project.id}/variables"
+ end
+
+ def api_post_body
+ {
+ key: key,
+ value: value
+ }
+ end
end
end
end
diff --git a/qa/qa/resource/project.rb b/qa/qa/resource/project.rb
index de1e9f04c36..c1a0cff86d8 100644
--- a/qa/qa/resource/project.rb
+++ b/qa/qa/resource/project.rb
@@ -7,6 +7,7 @@ module QA
class Project < Base
include Events::Project
+ attribute :id
attribute :name
attribute :description
diff --git a/qa/qa/runtime/browser.rb b/qa/qa/runtime/browser.rb
index a5218fc9ab1..174a52bd376 100644
--- a/qa/qa/runtime/browser.rb
+++ b/qa/qa/runtime/browser.rb
@@ -76,6 +76,9 @@ module QA
# https://developers.google.com/web/updates/2017/04/headless-chrome#cli
options.add_argument("disable-gpu")
end
+
+ # Disable /dev/shm use in CI. See https://gitlab.com/gitlab-org/gitlab-ee/issues/4252
+ options.add_argument("disable-dev-shm-usage") if QA::Runtime::Env.running_in_ci?
end
# Use the same profile on QA runs if CHROME_REUSE_PROFILE is true.
@@ -85,9 +88,6 @@ module QA
options.add_argument("user-data-dir=#{qa_profile_dir}")
end
- # Disable /dev/shm use in CI. See https://gitlab.com/gitlab-org/gitlab-ee/issues/4252
- options.add_argument("disable-dev-shm-usage") if QA::Runtime::Env.running_in_ci?
-
selenium_options = {
browser: QA::Runtime::Env.browser,
clear_local_storage: true,
diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb
index 358ab04eadc..9b083d59a5e 100644
--- a/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb
+++ b/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb
@@ -13,7 +13,8 @@ module QA
expect(page).to have_content(issue_title)
end
- context 'when using attachments in comments', :object_storage do
+ # Failure issue: https://gitlab.com/gitlab-org/quality/nightly/issues/101
+ context 'when using attachments in comments', :object_storage, :quarantine do
let(:file_to_attach) do
File.absolute_path(File.join('spec', 'fixtures', 'banana_sample.gif'))
end
diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb
index ac34f72bb8f..c0d597af076 100644
--- a/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb
+++ b/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb
@@ -5,7 +5,7 @@ module QA
describe 'filter issue comments activities' do
let(:issue_title) { 'issue title' }
- it 'user filters comments and activites in an issue' do
+ it 'user filters comments and activities in an issue' do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials }
diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_ci_variable_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_ci_variable_spec.rb
index 33f342edb08..561a8895329 100644
--- a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_ci_variable_spec.rb
+++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_ci_variable_spec.rb
@@ -3,15 +3,25 @@
module QA
context 'Verify' do
describe 'CI variable support' do
- it 'user adds a CI variable' do
+ it 'user adds a CI variable', :smoke do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
- Page::Main::Login.act { sign_in_using_credentials }
+ Page::Main::Login.perform(&:sign_in_using_credentials)
+
+ project = Resource::Project.fabricate! do |project|
+ project.name = 'project-with-ci-variables'
+ project.description = 'project with CI variables'
+ end
Resource::CiVariable.fabricate! do |resource|
+ resource.project = project
resource.key = 'VARIABLE_KEY'
resource.value = 'some_CI_variable'
end
+ project.visit!
+
+ Page::Project::Menu.perform(&:go_to_ci_cd_settings)
+
Page::Project::Settings::CICD.perform do |settings|
settings.expand_ci_variables do |page|
expect(page).to have_field(with: 'VARIABLE_KEY')
diff --git a/qa/spec/spec_helper.rb b/qa/spec/spec_helper.rb
index 24ff1523ba7..a368ffba711 100644
--- a/qa/spec/spec_helper.rb
+++ b/qa/spec/spec_helper.rb
@@ -35,8 +35,10 @@ RSpec.configure do |config|
# show exception that triggers a retry if verbose_retry is set to true
config.display_try_failure_messages = true
- config.around do |example|
- retry_times = example.metadata.keys.include?(:quarantine) ? 1 : 2
- example.run_with_retry retry: retry_times
+ if ENV['CI']
+ config.around do |example|
+ retry_times = example.metadata.keys.include?(:quarantine) ? 1 : 2
+ example.run_with_retry retry: retry_times
+ end
end
end
diff --git a/rubocop/cop/code_reuse/active_record.rb b/rubocop/cop/code_reuse/active_record.rb
index 2be8f7c11aa..1e650abfceb 100644
--- a/rubocop/cop/code_reuse/active_record.rb
+++ b/rubocop/cop/code_reuse/active_record.rb
@@ -9,7 +9,8 @@ module RuboCop
class ActiveRecord < RuboCop::Cop::Cop
include CodeReuseHelpers
- MSG = 'This method can only be used inside an ActiveRecord model'
+ MSG = 'This method can only be used inside an ActiveRecord model: ' \
+ 'https://gitlab.com/gitlab-org/gitlab-ce/issues/49653'
# Various methods from ActiveRecord::Querying that are blacklisted. We
# exclude some generic ones such as `any?` and `first`, as these may
diff --git a/scripts/clean-old-cached-assets b/scripts/clean-old-cached-assets
index 7a3a62a477a..8bdd3a9cdb6 100755
--- a/scripts/clean-old-cached-assets
+++ b/scripts/clean-old-cached-assets
@@ -1,6 +1,6 @@
#!/bin/bash
-# Clean up cached files that are older than 1 week
-find tmp/cache/assets/sprockets/ -type f -mtime +7 -execdir rm -- "{}" \;
+# Clean up cached files that are older than 4 days
+find tmp/cache/assets/sprockets/ -type f -mtime +4 -execdir rm -- "{}" \;
du -d 0 -h tmp/cache/assets/sprockets | cut -f1 | xargs -I % echo "tmp/cache/assets/sprockets/ is currently %"
diff --git a/scripts/frontend/stylelint/stylelint-utility-map.js b/scripts/frontend/stylelint/stylelint-utility-map.js
index 7e012b157b3..941198e82a4 100644
--- a/scripts/frontend/stylelint/stylelint-utility-map.js
+++ b/scripts/frontend/stylelint/stylelint-utility-map.js
@@ -29,7 +29,7 @@ sass.render(
// We just use postcss to create a CSS tree
postcss([])
.process(cssResult, {
- // This supresses a postcss warning
+ // This suppresses a postcss warning
from: undefined,
})
.then(result => {
diff --git a/scripts/frontend/test.js b/scripts/frontend/test.js
new file mode 100755
index 00000000000..dab7176f8c1
--- /dev/null
+++ b/scripts/frontend/test.js
@@ -0,0 +1,114 @@
+#!/usr/bin/env node
+
+const { spawn } = require('child_process');
+const { EOL } = require('os');
+const program = require('commander');
+const chalk = require('chalk');
+
+const JEST_ROUTE = 'spec/frontend';
+const KARMA_ROUTE = 'spec/javascripts';
+const COMMON_ARGS = ['--colors'];
+const JEST_ARGS = ['--passWithNoTests'];
+const KARMA_ARGS = ['--no-fail-on-empty-test-suite'];
+const SUCCESS_CODE = 0;
+
+program
+ .version('0.1.0')
+ .usage('[options] <file ...>')
+ .option('-p, --parallel', 'Run tests suites in parallel')
+ .parse(process.argv);
+
+const isSuccess = code => code === SUCCESS_CODE;
+
+const combineExitCodes = codes => {
+ const firstFail = codes.find(x => !isSuccess(x));
+
+ return firstFail === undefined ? SUCCESS_CODE : firstFail;
+};
+
+const skipIfFail = fn => code => (isSuccess(code) ? fn() : code);
+
+const endWithEOL = str => (str[str.length - 1] === '\n' ? str : `${str}${EOL}`);
+
+const runTests = paths => {
+ if (program.parallel) {
+ return Promise.all([runJest(paths), runKarma(paths)]).then(combineExitCodes);
+ } else {
+ return runJest(paths).then(skipIfFail(() => runKarma(paths)));
+ }
+};
+
+const spawnYarnScript = (cmd, args) => {
+ return new Promise((resolve, reject) => {
+ const proc = spawn('yarn', ['run', cmd, ...args]);
+ const output = data => {
+ const text = data
+ .toString()
+ .split(/\r?\n/g)
+ .map((line, idx, { length }) =>
+ idx === length - 1 && !line ? line : `${chalk.gray(cmd)}: ${line}`,
+ )
+ .join(EOL);
+
+ return endWithEOL(text);
+ };
+
+ proc.stdout.on('data', data => {
+ process.stdout.write(output(data));
+ });
+
+ proc.stderr.on('data', data => {
+ process.stderr.write(output(data));
+ });
+
+ proc.on('close', code => {
+ process.stdout.write(output(`exited with code ${code}`));
+
+ // We resolve even on a failure code because a `reject` would cause
+ // Promise.all to reject immediately (without waiting for other promises)
+ // to finish.
+ resolve(code);
+ });
+ });
+};
+
+const runJest = args => {
+ return spawnYarnScript('jest', [...JEST_ARGS, ...COMMON_ARGS, ...toJestArgs(args)]);
+};
+
+const runKarma = args => {
+ return spawnYarnScript('karma', [...KARMA_ARGS, ...COMMON_ARGS, ...toKarmaArgs(args)]);
+};
+
+const replacePath = to => path =>
+ path
+ .replace(JEST_ROUTE, to)
+ .replace(KARMA_ROUTE, to)
+ .replace('app/assets/javascripts', to);
+
+const replacePathForJest = replacePath(JEST_ROUTE);
+
+const replacePathForKarma = replacePath(KARMA_ROUTE);
+
+const toJestArgs = paths => paths.map(replacePathForJest);
+
+const toKarmaArgs = paths =>
+ paths.reduce((acc, path) => acc.concat('-f', replacePathForKarma(path)), []);
+
+const main = paths => {
+ runTests(paths).then(code => {
+ console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
+ if (isSuccess(code)) {
+ console.log(chalk.bgGreen(chalk.black('All tests passed :)')));
+ } else {
+ console.log(chalk.bgRed(chalk.white(`Some tests failed :(`)));
+ }
+ console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
+
+ if (!isSuccess(code)) {
+ process.exit(code);
+ }
+ });
+};
+
+main(program.args);
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index 7296a4b4526..5ecd1b6b7c8 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -206,8 +206,19 @@ describe ApplicationController do
describe '#check_two_factor_requirement' do
subject { controller.send :check_two_factor_requirement }
+ it 'does not redirect if user has temporary oauth email' do
+ oauth_user = create(:user, email: 'temp-email-for-oauth@email.com')
+ allow(controller).to receive(:two_factor_authentication_required?).and_return(true)
+ allow(controller).to receive(:current_user).and_return(oauth_user)
+
+ expect(controller).not_to receive(:redirect_to)
+
+ subject
+ end
+
it 'does not redirect if 2FA is not required' do
allow(controller).to receive(:two_factor_authentication_required?).and_return(false)
+
expect(controller).not_to receive(:redirect_to)
subject
@@ -216,6 +227,7 @@ describe ApplicationController do
it 'does not redirect if user is not logged in' do
allow(controller).to receive(:two_factor_authentication_required?).and_return(true)
allow(controller).to receive(:current_user).and_return(nil)
+
expect(controller).not_to receive(:redirect_to)
subject
@@ -223,8 +235,9 @@ describe ApplicationController do
it 'does not redirect if user has 2FA enabled' do
allow(controller).to receive(:two_factor_authentication_required?).and_return(true)
- allow(controller).to receive(:current_user).twice.and_return(user)
+ allow(controller).to receive(:current_user).thrice.and_return(user)
allow(user).to receive(:two_factor_enabled?).and_return(true)
+
expect(controller).not_to receive(:redirect_to)
subject
@@ -232,9 +245,10 @@ describe ApplicationController do
it 'does not redirect if 2FA setup can be skipped' do
allow(controller).to receive(:two_factor_authentication_required?).and_return(true)
- allow(controller).to receive(:current_user).twice.and_return(user)
+ allow(controller).to receive(:current_user).thrice.and_return(user)
allow(user).to receive(:two_factor_enabled?).and_return(false)
allow(controller).to receive(:skip_two_factor?).and_return(true)
+
expect(controller).not_to receive(:redirect_to)
subject
@@ -242,10 +256,11 @@ describe ApplicationController do
it 'redirects to 2FA setup otherwise' do
allow(controller).to receive(:two_factor_authentication_required?).and_return(true)
- allow(controller).to receive(:current_user).twice.and_return(user)
+ allow(controller).to receive(:current_user).thrice.and_return(user)
allow(user).to receive(:two_factor_enabled?).and_return(false)
allow(controller).to receive(:skip_two_factor?).and_return(false)
allow(controller).to receive(:profile_two_factor_auth_path)
+
expect(controller).to receive(:redirect_to)
subject
diff --git a/spec/controllers/concerns/project_unauthorized_spec.rb b/spec/controllers/concerns/project_unauthorized_spec.rb
index 57ac00cf4dd..5834b1ef37f 100644
--- a/spec/controllers/concerns/project_unauthorized_spec.rb
+++ b/spec/controllers/concerns/project_unauthorized_spec.rb
@@ -12,7 +12,7 @@ describe ProjectUnauthorized do
render_views
- describe '#project_unauthorized_proc' do
+ describe '.on_routable_not_found' do
controller(::Projects::ApplicationController) do
def show
head :ok
diff --git a/spec/controllers/concerns/routable_actions_spec.rb b/spec/controllers/concerns/routable_actions_spec.rb
new file mode 100644
index 00000000000..59d48c68b9c
--- /dev/null
+++ b/spec/controllers/concerns/routable_actions_spec.rb
@@ -0,0 +1,156 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe RoutableActions do
+ controller(::ApplicationController) do
+ include RoutableActions # rubocop:disable RSpec/DescribedClass
+
+ before_action :routable
+
+ def routable
+ @klass = params[:type].constantize
+ @routable = find_routable!(params[:type].constantize, params[:id])
+ end
+
+ def show
+ head :ok
+ end
+ end
+
+ def get_routable(routable)
+ get :show, params: { id: routable.full_path, type: routable.class }
+ end
+
+ describe '#find_routable!' do
+ context 'when signed in' do
+ let(:user) { create(:user) }
+
+ before do
+ sign_in(user)
+ end
+
+ context 'with a project' do
+ let(:routable) { create(:project) }
+
+ context 'when authorized' do
+ before do
+ routable.add_guest(user)
+ end
+
+ it 'returns the project' do
+ get_routable(routable)
+
+ expect(assigns[:routable]).to be_a(Project)
+ end
+
+ it 'allows access' do
+ get_routable(routable)
+
+ expect(response).to have_gitlab_http_status(200)
+ end
+ end
+
+ it 'prevents access when not authorized' do
+ get_routable(routable)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+ end
+
+ context 'with a group' do
+ let(:routable) { create(:group, :private) }
+
+ context 'when authorized' do
+ before do
+ routable.add_guest(user)
+ end
+
+ it 'returns the group' do
+ get_routable(routable)
+
+ expect(assigns[:routable]).to be_a(Group)
+ end
+
+ it 'allows access' do
+ get_routable(routable)
+
+ expect(response).to have_gitlab_http_status(200)
+ end
+ end
+
+ it 'prevents access when not authorized' do
+ get_routable(routable)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+ end
+
+ context 'with a user' do
+ let(:routable) { user }
+
+ it 'allows access when authorized' do
+ get_routable(routable)
+
+ expect(response).to have_gitlab_http_status(200)
+ end
+
+ it 'prevents access when unauthorized' do
+ allow(subject).to receive(:can?).and_return(false)
+
+ get_routable(user)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+ end
+ end
+
+ context 'when not signed in' do
+ it 'redirects to sign in for private resouces' do
+ routable = create(:project, :private)
+
+ get_routable(routable)
+
+ expect(response).to have_gitlab_http_status(302)
+ expect(response.location).to end_with('/users/sign_in')
+ end
+ end
+ end
+
+ describe '#perform_not_found_actions' do
+ let(:routable) { create(:project) }
+
+ before do
+ sign_in(create(:user))
+ end
+
+ it 'performs multiple checks' do
+ last_check_called = false
+ checks = [proc {}, proc { last_check_called = true }]
+ allow(subject).to receive(:not_found_actions).and_return(checks)
+
+ get_routable(routable)
+
+ expect(last_check_called).to eq(true)
+ end
+
+ it 'performs checks in the context of the controller' do
+ check = lambda { |routable| redirect_to routable }
+ allow(subject).to receive(:not_found_actions).and_return([check])
+
+ get_routable(routable)
+
+ expect(response.location).to end_with(routable.to_param)
+ end
+
+ it 'skips checks once one has resulted in a render/redirect' do
+ first_check = proc { render plain: 'first' }
+ second_check = proc { render plain: 'second' }
+ allow(subject).to receive(:not_found_actions).and_return([first_check, second_check])
+
+ get_routable(routable)
+
+ expect(response.body).to eq('first')
+ end
+ end
+end
diff --git a/spec/controllers/concerns/send_file_upload_spec.rb b/spec/controllers/concerns/send_file_upload_spec.rb
index 8408578a7db..a3ce08f736c 100644
--- a/spec/controllers/concerns/send_file_upload_spec.rb
+++ b/spec/controllers/concerns/send_file_upload_spec.rb
@@ -1,3 +1,4 @@
+# coding: utf-8
# frozen_string_literal: true
require 'spec_helper'
@@ -13,7 +14,7 @@ describe SendFileUpload do
# user/:id
def dynamic_segment
- File.join(model.class.to_s.underscore, model.id.to_s)
+ File.join(model.class.underscore, model.id.to_s)
end
end
end
diff --git a/spec/controllers/projects/environments_controller_spec.rb b/spec/controllers/projects/environments_controller_spec.rb
index cf23d937037..d5eea5b0439 100644
--- a/spec/controllers/projects/environments_controller_spec.rb
+++ b/spec/controllers/projects/environments_controller_spec.rb
@@ -383,6 +383,8 @@ describe Projects::EnvironmentsController do
end
describe 'GET #additional_metrics' do
+ let(:window_params) { { start: '1554702993.5398998', end: '1554717396.996232' } }
+
before do
allow(controller).to receive(:environment).and_return(environment)
end
@@ -394,7 +396,7 @@ describe Projects::EnvironmentsController do
context 'when requesting metrics as JSON' do
it 'returns a metrics JSON document' do
- additional_metrics
+ additional_metrics(window_params)
expect(response).to have_gitlab_http_status(204)
expect(json_response).to eq({})
@@ -414,23 +416,19 @@ describe Projects::EnvironmentsController do
end
it 'returns a metrics JSON document' do
- additional_metrics
+ additional_metrics(window_params)
expect(response).to be_ok
expect(json_response['success']).to be(true)
expect(json_response['data']).to eq({})
expect(json_response['last_update']).to eq(42)
end
+ end
- context 'when time params are provided' do
- it 'returns a metrics JSON document' do
- additional_metrics(start: '1554702993.5398998', end: '1554717396.996232')
-
- expect(response).to be_ok
- expect(json_response['success']).to be(true)
- expect(json_response['data']).to eq({})
- expect(json_response['last_update']).to eq(42)
- end
+ context 'when time params are missing' do
+ it 'raises an error when window params are missing' do
+ expect { additional_metrics }
+ .to raise_error(ActionController::ParameterMissing)
end
end
@@ -450,7 +448,7 @@ describe Projects::EnvironmentsController do
end
it 'raises an error when start is missing' do
- expect { additional_metrics(start: '1552647300.651094') }
+ expect { additional_metrics(end: '1552647300.651094') }
.to raise_error(ActionController::ParameterMissing)
end
diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb
index 088c515c3a6..9a598790ff2 100644
--- a/spec/controllers/registrations_controller_spec.rb
+++ b/spec/controllers/registrations_controller_spec.rb
@@ -46,13 +46,17 @@ describe RegistrationsController do
end
context 'when reCAPTCHA is enabled' do
+ def fail_recaptcha
+ # Without this, `verify_recaptcha` arbitrarily returns true in test env
+ Recaptcha.configuration.skip_verify_env.delete('test')
+ end
+
before do
stub_application_setting(recaptcha_enabled: true)
end
it 'displays an error when the reCAPTCHA is not solved' do
- # Without this, `verify_recaptcha` arbitrarily returns true in test env
- Recaptcha.configuration.skip_verify_env.delete('test')
+ fail_recaptcha
post(:create, params: user_params)
@@ -70,6 +74,17 @@ describe RegistrationsController do
expect(flash[:notice]).to include 'Welcome! You have signed up successfully.'
end
+
+ it 'does not require reCAPTCHA if disabled by feature flag' do
+ stub_feature_flags(registrations_recaptcha: false)
+ fail_recaptcha
+
+ post(:create, params: user_params)
+
+ expect(controller).not_to receive(:verify_recaptcha)
+ expect(flash[:alert]).to be_nil
+ expect(flash[:notice]).to include 'Welcome! You have signed up successfully.'
+ end
end
context 'when terms are enforced' do
diff --git a/spec/factories/uploads.rb b/spec/factories/uploads.rb
index 7256f785e1f..426abdc2a6c 100644
--- a/spec/factories/uploads.rb
+++ b/spec/factories/uploads.rb
@@ -13,7 +13,7 @@ FactoryBot.define do
end
# this needs to comply with RecordsUpload::Concern#upload_path
- path { File.join("uploads/-/system", model.class.to_s.underscore, mount_point.to_s, 'avatar.jpg') }
+ path { File.join("uploads/-/system", model.class.underscore, mount_point.to_s, 'avatar.jpg') }
trait :personal_snippet_upload do
uploader "PersonalFileUploader"
diff --git a/spec/features/admin/admin_sees_project_statistics_spec.rb b/spec/features/admin/admin_sees_project_statistics_spec.rb
new file mode 100644
index 00000000000..95d1fc5b57a
--- /dev/null
+++ b/spec/features/admin/admin_sees_project_statistics_spec.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe "Admin > Admin sees project statistics" do
+ let(:current_user) { create(:admin) }
+
+ before do
+ sign_in(current_user)
+
+ visit admin_project_path(project)
+ end
+
+ context 'when project has statistics' do
+ let(:project) { create(:project, :repository) }
+
+ it "shows project statistics" do
+ expect(page).to have_content("Storage: 0 Bytes (0 Bytes repositories, 0 Bytes build artifacts, 0 Bytes LFS)")
+ end
+ end
+
+ context 'when project has no statistics' do
+ let(:project) { create(:project, :repository) { |project| project.statistics.destroy } }
+
+ it "shows 'Storage: Unknown'" do
+ expect(page).to have_content("Storage: Unknown")
+ end
+ end
+end
diff --git a/spec/features/admin/admin_sees_projects_statistics_spec.rb b/spec/features/admin/admin_sees_projects_statistics_spec.rb
new file mode 100644
index 00000000000..6a6f369ac7c
--- /dev/null
+++ b/spec/features/admin/admin_sees_projects_statistics_spec.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe "Admin > Admin sees projects statistics" do
+ let(:current_user) { create(:admin) }
+
+ before do
+ create(:project, :repository)
+ create(:project, :repository) { |project| project.statistics.destroy }
+
+ sign_in(current_user)
+
+ visit admin_projects_path
+ end
+
+ it "shows project statistics for projects that have them" do
+ expect(page.all('.stats').map(&:text)).to contain_exactly("0 Bytes", "Unknown")
+ end
+end
diff --git a/spec/features/projects/files/files_sort_submodules_with_folders_spec.rb b/spec/features/projects/files/files_sort_submodules_with_folders_spec.rb
index b6dbf76bc9b..51c884201a6 100644
--- a/spec/features/projects/files/files_sort_submodules_with_folders_spec.rb
+++ b/spec/features/projects/files/files_sort_submodules_with_folders_spec.rb
@@ -5,6 +5,8 @@ describe 'Projects > Files > User views files page' do
let(:user) { project.owner }
before do
+ stub_feature_flags(vue_file_list: false)
+
sign_in user
visit project_tree_path(project, project.repository.root_ref)
end
diff --git a/spec/features/projects/files/user_browses_files_spec.rb b/spec/features/projects/files/user_browses_files_spec.rb
index 66268355345..a5d849db8a3 100644
--- a/spec/features/projects/files/user_browses_files_spec.rb
+++ b/spec/features/projects/files/user_browses_files_spec.rb
@@ -11,6 +11,7 @@ describe "User browses files" do
let(:user) { project.owner }
before do
+ stub_feature_flags(vue_file_list: false)
stub_feature_flags(csslab: false)
sign_in(user)
end
diff --git a/spec/features/projects/files/user_browses_lfs_files_spec.rb b/spec/features/projects/files/user_browses_lfs_files_spec.rb
index d56476adb05..d5cb8f9212d 100644
--- a/spec/features/projects/files/user_browses_lfs_files_spec.rb
+++ b/spec/features/projects/files/user_browses_lfs_files_spec.rb
@@ -5,6 +5,8 @@ describe 'Projects > Files > User browses LFS files' do
let(:user) { project.owner }
before do
+ stub_feature_flags(vue_file_list: false)
+
sign_in(user)
end
diff --git a/spec/features/projects/files/user_creates_directory_spec.rb b/spec/features/projects/files/user_creates_directory_spec.rb
index 847b5f0860f..e29e867492e 100644
--- a/spec/features/projects/files/user_creates_directory_spec.rb
+++ b/spec/features/projects/files/user_creates_directory_spec.rb
@@ -11,6 +11,8 @@ describe 'Projects > Files > User creates a directory', :js do
let(:user) { create(:user) }
before do
+ stub_feature_flags(vue_file_list: false)
+
project.add_developer(user)
sign_in(user)
visit project_tree_path(project, 'master')
diff --git a/spec/features/projects/files/user_deletes_files_spec.rb b/spec/features/projects/files/user_deletes_files_spec.rb
index 614b11fa5c8..11ee87f245b 100644
--- a/spec/features/projects/files/user_deletes_files_spec.rb
+++ b/spec/features/projects/files/user_deletes_files_spec.rb
@@ -12,6 +12,8 @@ describe 'Projects > Files > User deletes files', :js do
let(:user) { create(:user) }
before do
+ stub_feature_flags(vue_file_list: false)
+
sign_in(user)
end
diff --git a/spec/features/projects/files/user_edits_files_spec.rb b/spec/features/projects/files/user_edits_files_spec.rb
index 2de22582b2c..26efb5e6787 100644
--- a/spec/features/projects/files/user_edits_files_spec.rb
+++ b/spec/features/projects/files/user_edits_files_spec.rb
@@ -10,6 +10,7 @@ describe 'Projects > Files > User edits files', :js do
before do
stub_feature_flags(web_ide_default: false)
+ stub_feature_flags(vue_file_list: false)
sign_in(user)
end
diff --git a/spec/features/projects/files/user_replaces_files_spec.rb b/spec/features/projects/files/user_replaces_files_spec.rb
index e3da28d73c3..bfd612e4cc8 100644
--- a/spec/features/projects/files/user_replaces_files_spec.rb
+++ b/spec/features/projects/files/user_replaces_files_spec.rb
@@ -14,6 +14,8 @@ describe 'Projects > Files > User replaces files', :js do
let(:user) { create(:user) }
before do
+ stub_feature_flags(vue_file_list: false)
+
sign_in(user)
end
diff --git a/spec/features/projects/files/user_uploads_files_spec.rb b/spec/features/projects/files/user_uploads_files_spec.rb
index af3fc528a20..25ff3fdf411 100644
--- a/spec/features/projects/files/user_uploads_files_spec.rb
+++ b/spec/features/projects/files/user_uploads_files_spec.rb
@@ -14,6 +14,8 @@ describe 'Projects > Files > User uploads files' do
let(:project2_tree_path_root_ref) { project_tree_path(project2, project2.repository.root_ref) }
before do
+ stub_feature_flags(vue_file_list: false)
+
project.add_maintainer(user)
sign_in(user)
end
diff --git a/spec/features/projects/tree/tree_show_spec.rb b/spec/features/projects/tree/tree_show_spec.rb
index 45e81e1c040..3ccea2db705 100644
--- a/spec/features/projects/tree/tree_show_spec.rb
+++ b/spec/features/projects/tree/tree_show_spec.rb
@@ -8,6 +8,7 @@ describe 'Projects tree', :js do
let(:test_sha) { '7975be0116940bf2ad4321f79d02a55c5f7779aa' }
before do
+ stub_feature_flags(vue_file_list: false)
project.add_maintainer(user)
sign_in(user)
end
diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb
index ff4e6197746..4fe45311b2d 100644
--- a/spec/features/projects_spec.rb
+++ b/spec/features/projects_spec.rb
@@ -5,6 +5,7 @@ describe 'Project' do
include MobileHelpers
before do
+ stub_feature_flags(vue_file_list: false)
stub_feature_flags(approval_rules: false)
end
diff --git a/spec/fixtures/api/schemas/entities/test_case.json b/spec/fixtures/api/schemas/entities/test_case.json
index c9ba1f3ad18..70f6edeeeb7 100644
--- a/spec/fixtures/api/schemas/entities/test_case.json
+++ b/spec/fixtures/api/schemas/entities/test_case.json
@@ -7,6 +7,7 @@
"properties": {
"status": { "type": "string" },
"name": { "type": "string" },
+ "classname": { "type": "string" },
"execution_time": { "type": "float" },
"system_output": { "type": ["string", "null"] },
"stack_trace": { "type": ["string", "null"] }
diff --git a/spec/fixtures/api/schemas/public_api/v4/job.json b/spec/fixtures/api/schemas/public_api/v4/job.json
index 454935422a0..c038ae0a664 100644
--- a/spec/fixtures/api/schemas/public_api/v4/job.json
+++ b/spec/fixtures/api/schemas/public_api/v4/job.json
@@ -28,6 +28,7 @@
"ref": { "type": "string" },
"tag": { "type": "boolean" },
"coverage": { "type": ["number", "null"] },
+ "allow_failure": { "type": "boolean" },
"created_at": { "type": "string" },
"started_at": { "type": ["null", "string"] },
"finished_at": { "type": ["null", "string"] },
diff --git a/spec/fixtures/api/schemas/public_api/v4/label_basic.json b/spec/fixtures/api/schemas/public_api/v4/label_basic.json
new file mode 100644
index 00000000000..37bbdcb14fe
--- /dev/null
+++ b/spec/fixtures/api/schemas/public_api/v4/label_basic.json
@@ -0,0 +1,24 @@
+{
+ "type": "object",
+ "required": [
+ "id",
+ "name",
+ "color",
+ "description",
+ "text_color"
+ ],
+ "properties": {
+ "id": { "type": "integer" },
+ "name": { "type": "string" },
+ "color": {
+ "type": "string",
+ "pattern": "^#[0-9A-Fa-f]{3}{1,2}$"
+ },
+ "description": { "type": ["string", "null"] },
+ "text_color": {
+ "type": "string",
+ "pattern": "^#[0-9A-Fa-f]{3}{1,2}$"
+ }
+ },
+ "additionalProperties": false
+}
diff --git a/spec/frontend/boards/stores/actions_spec.js b/spec/frontend/boards/stores/actions_spec.js
new file mode 100644
index 00000000000..d23393db60d
--- /dev/null
+++ b/spec/frontend/boards/stores/actions_spec.js
@@ -0,0 +1,67 @@
+import actions from '~/boards/stores/actions';
+
+const expectNotImplemented = action => {
+ it('is not implemented', () => {
+ expect(action).toThrow(new Error('Not implemented!'));
+ });
+};
+
+describe('setEndpoints', () => {
+ expectNotImplemented(actions.setEndpoints);
+});
+
+describe('fetchLists', () => {
+ expectNotImplemented(actions.fetchLists);
+});
+
+describe('generateDefaultLists', () => {
+ expectNotImplemented(actions.generateDefaultLists);
+});
+
+describe('createList', () => {
+ expectNotImplemented(actions.createList);
+});
+
+describe('updateList', () => {
+ expectNotImplemented(actions.updateList);
+});
+
+describe('deleteList', () => {
+ expectNotImplemented(actions.deleteList);
+});
+
+describe('fetchIssuesForList', () => {
+ expectNotImplemented(actions.fetchIssuesForList);
+});
+
+describe('moveIssue', () => {
+ expectNotImplemented(actions.moveIssue);
+});
+
+describe('createNewIssue', () => {
+ expectNotImplemented(actions.createNewIssue);
+});
+
+describe('fetchBacklog', () => {
+ expectNotImplemented(actions.fetchBacklog);
+});
+
+describe('bulkUpdateIssues', () => {
+ expectNotImplemented(actions.bulkUpdateIssues);
+});
+
+describe('fetchIssue', () => {
+ expectNotImplemented(actions.fetchIssue);
+});
+
+describe('toggleIssueSubscription', () => {
+ expectNotImplemented(actions.toggleIssueSubscription);
+});
+
+describe('showPage', () => {
+ expectNotImplemented(actions.showPage);
+});
+
+describe('toggleEmptyState', () => {
+ expectNotImplemented(actions.toggleEmptyState);
+});
diff --git a/spec/frontend/boards/stores/mutations_spec.js b/spec/frontend/boards/stores/mutations_spec.js
new file mode 100644
index 00000000000..aa477766978
--- /dev/null
+++ b/spec/frontend/boards/stores/mutations_spec.js
@@ -0,0 +1,91 @@
+import mutations from '~/boards/stores/mutations';
+
+const expectNotImplemented = action => {
+ it('is not implemented', () => {
+ expect(action).toThrow(new Error('Not implemented!'));
+ });
+};
+
+describe('SET_ENDPOINTS', () => {
+ expectNotImplemented(mutations.SET_ENDPOINTS);
+});
+
+describe('REQUEST_ADD_LIST', () => {
+ expectNotImplemented(mutations.REQUEST_ADD_LIST);
+});
+
+describe('RECEIVE_ADD_LIST_SUCCESS', () => {
+ expectNotImplemented(mutations.RECEIVE_ADD_LIST_SUCCESS);
+});
+
+describe('RECEIVE_ADD_LIST_ERROR', () => {
+ expectNotImplemented(mutations.RECEIVE_ADD_LIST_ERROR);
+});
+
+describe('REQUEST_UPDATE_LIST', () => {
+ expectNotImplemented(mutations.REQUEST_UPDATE_LIST);
+});
+
+describe('RECEIVE_UPDATE_LIST_SUCCESS', () => {
+ expectNotImplemented(mutations.RECEIVE_UPDATE_LIST_SUCCESS);
+});
+
+describe('RECEIVE_UPDATE_LIST_ERROR', () => {
+ expectNotImplemented(mutations.RECEIVE_UPDATE_LIST_ERROR);
+});
+
+describe('REQUEST_REMOVE_LIST', () => {
+ expectNotImplemented(mutations.REQUEST_REMOVE_LIST);
+});
+
+describe('RECEIVE_REMOVE_LIST_SUCCESS', () => {
+ expectNotImplemented(mutations.RECEIVE_REMOVE_LIST_SUCCESS);
+});
+
+describe('RECEIVE_REMOVE_LIST_ERROR', () => {
+ expectNotImplemented(mutations.RECEIVE_REMOVE_LIST_ERROR);
+});
+
+describe('REQUEST_ADD_ISSUE', () => {
+ expectNotImplemented(mutations.REQUEST_ADD_ISSUE);
+});
+
+describe('RECEIVE_ADD_ISSUE_SUCCESS', () => {
+ expectNotImplemented(mutations.RECEIVE_ADD_ISSUE_SUCCESS);
+});
+
+describe('RECEIVE_ADD_ISSUE_ERROR', () => {
+ expectNotImplemented(mutations.RECEIVE_ADD_ISSUE_ERROR);
+});
+
+describe('REQUEST_MOVE_ISSUE', () => {
+ expectNotImplemented(mutations.REQUEST_MOVE_ISSUE);
+});
+
+describe('RECEIVE_MOVE_ISSUE_SUCCESS', () => {
+ expectNotImplemented(mutations.RECEIVE_MOVE_ISSUE_SUCCESS);
+});
+
+describe('RECEIVE_MOVE_ISSUE_ERROR', () => {
+ expectNotImplemented(mutations.RECEIVE_MOVE_ISSUE_ERROR);
+});
+
+describe('REQUEST_UPDATE_ISSUE', () => {
+ expectNotImplemented(mutations.REQUEST_UPDATE_ISSUE);
+});
+
+describe('RECEIVE_UPDATE_ISSUE_SUCCESS', () => {
+ expectNotImplemented(mutations.RECEIVE_UPDATE_ISSUE_SUCCESS);
+});
+
+describe('RECEIVE_UPDATE_ISSUE_ERROR', () => {
+ expectNotImplemented(mutations.RECEIVE_UPDATE_ISSUE_ERROR);
+});
+
+describe('SET_CURRENT_PAGE', () => {
+ expectNotImplemented(mutations.SET_CURRENT_PAGE);
+});
+
+describe('TOGGLE_EMPTY_STATE', () => {
+ expectNotImplemented(mutations.TOGGLE_EMPTY_STATE);
+});
diff --git a/spec/frontend/boards/stores/state_spec.js b/spec/frontend/boards/stores/state_spec.js
new file mode 100644
index 00000000000..35490a63567
--- /dev/null
+++ b/spec/frontend/boards/stores/state_spec.js
@@ -0,0 +1,11 @@
+import createState from '~/boards/stores/state';
+
+describe('createState', () => {
+ it('is a function', () => {
+ expect(createState).toEqual(expect.any(Function));
+ });
+
+ it('returns an object', () => {
+ expect(createState()).toEqual(expect.any(Object));
+ });
+});
diff --git a/spec/frontend/environment.js b/spec/frontend/environment.js
index 9612162ad0c..a8c8688441d 100644
--- a/spec/frontend/environment.js
+++ b/spec/frontend/environment.js
@@ -38,6 +38,16 @@ class CustomEnvironment extends JSDOMEnvironment {
this.global.fixturesBasePath = `${process.cwd()}/${
IS_EE ? 'ee/' : ''
}spec/javascripts/fixtures`;
+
+ // Not yet supported by JSDOM: https://github.com/jsdom/jsdom/issues/317
+ this.global.document.createRange = () => ({
+ setStart: () => {},
+ setEnd: () => {},
+ commonAncestorContainer: {
+ nodeName: 'BODY',
+ ownerDocument: this.global.document,
+ },
+ });
}
async teardown() {
diff --git a/spec/frontend/gfm_auto_complete_spec.js b/spec/frontend/gfm_auto_complete_spec.js
index 3886853f3c1..8af49fd47a2 100644
--- a/spec/frontend/gfm_auto_complete_spec.js
+++ b/spec/frontend/gfm_auto_complete_spec.js
@@ -7,11 +7,8 @@ import 'jquery.caret';
import 'at.js';
import { TEST_HOST } from 'helpers/test_constants';
-import { setTestTimeout } from 'helpers/timeout';
import { getJSONFixture } from 'helpers/fixtures';
-setTestTimeout(500);
-
const labelsFixture = getJSONFixture('autocomplete_sources/labels.json');
describe('GfmAutoComplete', () => {
diff --git a/spec/frontend/helpers/vue_component_helper.js b/spec/frontend/helpers/text_helper.js
index e0fe18e5560..e0fe18e5560 100644
--- a/spec/frontend/helpers/vue_component_helper.js
+++ b/spec/frontend/helpers/text_helper.js
diff --git a/spec/frontend/helpers/timeout.js b/spec/frontend/helpers/timeout.js
index 318593a48a4..b30b7f1ce1e 100644
--- a/spec/frontend/helpers/timeout.js
+++ b/spec/frontend/helpers/timeout.js
@@ -1,24 +1,31 @@
-let testTimeoutInMs;
+const NS_PER_SEC = 1e9;
+const NS_PER_MS = 1e6;
-export const setTestTimeout = newTimeoutInMs => {
- testTimeoutInMs = newTimeoutInMs;
- jest.setTimeout(newTimeoutInMs);
+let testTimeoutNS;
+
+export const setTestTimeout = newTimeoutMS => {
+ testTimeoutNS = newTimeoutMS * NS_PER_MS;
+ jest.setTimeout(newTimeoutMS);
};
-export const initializeTestTimeout = defaultTimeoutInMs => {
- setTestTimeout(defaultTimeoutInMs);
+export const initializeTestTimeout = defaultTimeoutMS => {
+ setTestTimeout(defaultTimeoutMS);
let testStartTime;
// https://github.com/facebook/jest/issues/6947
beforeEach(() => {
- testStartTime = Date.now();
+ testStartTime = process.hrtime();
});
afterEach(() => {
- const elapsedTimeInMs = Date.now() - testStartTime;
- if (elapsedTimeInMs > testTimeoutInMs) {
- throw new Error(`Test took too long (${elapsedTimeInMs}ms > ${testTimeoutInMs}ms)!`);
+ const [seconds, remainingNs] = process.hrtime(testStartTime);
+ const elapsedNS = seconds * NS_PER_SEC + remainingNs;
+
+ if (elapsedNS > testTimeoutNS) {
+ throw new Error(
+ `Test took too long (${elapsedNS / NS_PER_MS}ms > ${testTimeoutNS / NS_PER_MS}ms)!`,
+ );
}
});
};
diff --git a/spec/frontend/lib/utils/text_utility_spec.js b/spec/frontend/lib/utils/text_utility_spec.js
index 0878c1de095..9e920d59093 100644
--- a/spec/frontend/lib/utils/text_utility_spec.js
+++ b/spec/frontend/lib/utils/text_utility_spec.js
@@ -155,11 +155,11 @@ describe('text_utility', () => {
expect(textUtils.truncateNamespace('a / b')).toBe('a');
});
- it(`should return the first 2 namespaces if the namespace inlcudes exactly 2 levels`, () => {
+ it(`should return the first 2 namespaces if the namespace includes exactly 2 levels`, () => {
expect(textUtils.truncateNamespace('a / b / c')).toBe('a / b');
});
- it(`should return the first and last namespaces, separated by "...", if the namespace inlcudes more than 2 levels`, () => {
+ it(`should return the first and last namespaces, separated by "...", if the namespace includes more than 2 levels`, () => {
expect(textUtils.truncateNamespace('a / b / c / d')).toBe('a / ... / c');
expect(textUtils.truncateNamespace('a / b / c / d / e / f / g / h / i')).toBe('a / ... / h');
});
diff --git a/spec/frontend/notes/components/discussion_notes_spec.js b/spec/frontend/notes/components/discussion_notes_spec.js
index 7e037beca9d..c3204b3aaa0 100644
--- a/spec/frontend/notes/components/discussion_notes_spec.js
+++ b/spec/frontend/notes/components/discussion_notes_spec.js
@@ -8,7 +8,6 @@ import PlaceholderSystemNote from '~/vue_shared/components/notes/placeholder_sys
import SystemNote from '~/vue_shared/components/notes/system_note.vue';
import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue';
import createStore from '~/notes/stores';
-import { setTestTimeout } from 'helpers/timeout';
import {
noteableDataMock,
discussionMock,
@@ -18,8 +17,6 @@ import {
const localVue = createLocalVue();
describe('DiscussionNotes', () => {
- setTestTimeout(500);
-
let wrapper;
const createComponent = props => {
diff --git a/spec/frontend/pages/admin/abuse_reports/abuse_reports_spec.js b/spec/frontend/pages/admin/abuse_reports/abuse_reports_spec.js
index f163bdd9913..7e9aec84016 100644
--- a/spec/frontend/pages/admin/abuse_reports/abuse_reports_spec.js
+++ b/spec/frontend/pages/admin/abuse_reports/abuse_reports_spec.js
@@ -1,9 +1,6 @@
import $ from 'jquery';
import '~/lib/utils/text_utility';
import AbuseReports from '~/pages/admin/abuse_reports/abuse_reports';
-import { setTestTimeout } from 'helpers/timeout';
-
-setTestTimeout(500);
describe('Abuse Reports', () => {
const FIXTURE = 'abuse_reports/abuse_reports_list.html';
diff --git a/spec/frontend/reports/components/report_item_spec.js b/spec/frontend/reports/components/report_item_spec.js
new file mode 100644
index 00000000000..bacbb399513
--- /dev/null
+++ b/spec/frontend/reports/components/report_item_spec.js
@@ -0,0 +1,33 @@
+import { shallowMount } from '@vue/test-utils';
+import { STATUS_SUCCESS } from '~/reports/constants';
+import ReportItem from '~/reports/components/report_item.vue';
+import { componentNames } from '~/reports/components/issue_body';
+
+describe('ReportItem', () => {
+ describe('showReportSectionStatusIcon', () => {
+ it('does not render CI Status Icon when showReportSectionStatusIcon is false', () => {
+ const wrapper = shallowMount(ReportItem, {
+ propsData: {
+ issue: { foo: 'bar' },
+ component: componentNames.TestIssueBody,
+ status: STATUS_SUCCESS,
+ showReportSectionStatusIcon: false,
+ },
+ });
+
+ expect(wrapper.find('issuestatusicon-stub').exists()).toBe(false);
+ });
+
+ it('shows status icon when unspecified', () => {
+ const wrapper = shallowMount(ReportItem, {
+ propsData: {
+ issue: { foo: 'bar' },
+ component: componentNames.TestIssueBody,
+ status: STATUS_SUCCESS,
+ },
+ });
+
+ expect(wrapper.find('issuestatusicon-stub').exists()).toBe(true);
+ });
+ });
+});
diff --git a/spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap b/spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap
new file mode 100644
index 00000000000..f0b72343b6e
--- /dev/null
+++ b/spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap
@@ -0,0 +1,33 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Repository table row component renders table row 1`] = `
+<tr
+ class="tree-item file_1"
+>
+ <td
+ class="tree-item-file-name"
+ >
+ <i
+ aria-label="file"
+ class="fa fa-fw fa-file-text-o"
+ role="img"
+ />
+
+ <a
+ class="str-truncated"
+ >
+ test
+ </a>
+
+ <!---->
+ </td>
+
+ <td
+ class="d-none d-sm-table-cell tree-commit"
+ />
+
+ <td
+ class="tree-time-ago text-right"
+ />
+</tr>
+`;
diff --git a/spec/frontend/repository/components/table/index_spec.js b/spec/frontend/repository/components/table/index_spec.js
new file mode 100644
index 00000000000..6f52cffe077
--- /dev/null
+++ b/spec/frontend/repository/components/table/index_spec.js
@@ -0,0 +1,47 @@
+import { shallowMount } from '@vue/test-utils';
+import { GlLoadingIcon } from '@gitlab/ui';
+import Table from '~/repository/components/table/index.vue';
+
+let vm;
+
+function factory(path, loading = false) {
+ vm = shallowMount(Table, {
+ propsData: {
+ path,
+ },
+ mocks: {
+ $apollo: {
+ queries: {
+ files: { loading },
+ },
+ },
+ },
+ });
+}
+
+describe('Repository table component', () => {
+ afterEach(() => {
+ vm.destroy();
+ });
+
+ it.each`
+ path | ref
+ ${'/'} | ${'master'}
+ ${'app/assets'} | ${'master'}
+ ${'/'} | ${'test'}
+ `('renders table caption for $ref in $path', ({ path, ref }) => {
+ factory(path);
+
+ vm.setData({ ref });
+
+ expect(vm.find('caption').text()).toEqual(
+ `Files, directories, and submodules in the path ${path} for commit reference ${ref}`,
+ );
+ });
+
+ it('renders loading icon', () => {
+ factory('/', true);
+
+ expect(vm.find(GlLoadingIcon).exists()).toBe(true);
+ });
+});
diff --git a/spec/frontend/repository/components/table/row_spec.js b/spec/frontend/repository/components/table/row_spec.js
new file mode 100644
index 00000000000..216128dce25
--- /dev/null
+++ b/spec/frontend/repository/components/table/row_spec.js
@@ -0,0 +1,85 @@
+import { shallowMount, RouterLinkStub } from '@vue/test-utils';
+import TableRow from '~/repository/components/table/row.vue';
+
+let vm;
+let $router;
+
+function factory(propsData = {}) {
+ $router = {
+ push: jest.fn(),
+ };
+
+ vm = shallowMount(TableRow, {
+ propsData,
+ mocks: {
+ $router,
+ },
+ stubs: {
+ RouterLink: RouterLinkStub,
+ },
+ });
+
+ vm.setData({ ref: 'master' });
+}
+
+describe('Repository table row component', () => {
+ afterEach(() => {
+ vm.destroy();
+ });
+
+ it('renders table row', () => {
+ factory({
+ id: 1,
+ path: 'test',
+ type: 'file',
+ });
+
+ expect(vm.element).toMatchSnapshot();
+ });
+
+ it.each`
+ type | component | componentName
+ ${'folder'} | ${RouterLinkStub} | ${'RouterLink'}
+ ${'file'} | ${'a'} | ${'hyperlink'}
+ ${'commit'} | ${'a'} | ${'hyperlink'}
+ `('renders a $componentName for type $type', ({ type, component }) => {
+ factory({
+ id: 1,
+ path: 'test',
+ type,
+ });
+
+ expect(vm.find(component).exists()).toBe(true);
+ });
+
+ it.each`
+ type | pushes
+ ${'folder'} | ${true}
+ ${'file'} | ${false}
+ ${'commit'} | ${false}
+ `('pushes new router if type $type is folder', ({ type, pushes }) => {
+ factory({
+ id: 1,
+ path: 'test',
+ type,
+ });
+
+ vm.trigger('click');
+
+ if (pushes) {
+ expect($router.push).toHaveBeenCalledWith({ path: '/tree/master/test' });
+ } else {
+ expect($router.push).not.toHaveBeenCalled();
+ }
+ });
+
+ it('renders commit ID for submodule', () => {
+ factory({
+ id: 1,
+ path: 'test',
+ type: 'commit',
+ });
+
+ expect(vm.find('.commit-sha').text()).toContain('1');
+ });
+});
diff --git a/spec/frontend/repository/router_spec.js b/spec/frontend/repository/router_spec.js
new file mode 100644
index 00000000000..f61a0ccd1e6
--- /dev/null
+++ b/spec/frontend/repository/router_spec.js
@@ -0,0 +1,23 @@
+import IndexPage from '~/repository/pages/index.vue';
+import TreePage from '~/repository/pages/tree.vue';
+import createRouter from '~/repository/router';
+
+describe('Repository router spec', () => {
+ it.each`
+ path | component | componentName
+ ${'/'} | ${IndexPage} | ${'IndexPage'}
+ ${'/tree/master'} | ${TreePage} | ${'TreePage'}
+ ${'/tree/master/app/assets'} | ${TreePage} | ${'TreePage'}
+ ${'/tree/123/app/assets'} | ${null} | ${'null'}
+ `('sets component as $componentName for path "$path"', ({ path, component }) => {
+ const router = createRouter('', 'master');
+
+ const componentsForRoute = router.getMatchedComponents(path);
+
+ expect(componentsForRoute.length).toBe(component ? 1 : 0);
+
+ if (component) {
+ expect(componentsForRoute).toContain(component);
+ }
+ });
+});
diff --git a/spec/frontend/repository/utils/icon_spec.js b/spec/frontend/repository/utils/icon_spec.js
new file mode 100644
index 00000000000..52787327bef
--- /dev/null
+++ b/spec/frontend/repository/utils/icon_spec.js
@@ -0,0 +1,23 @@
+import { getIconName } from '~/repository/utils/icon';
+
+describe('getIconName', () => {
+ // Tests the returning font awesome icon name
+ // We only test one for each file type to save testing a lot of different
+ // file types
+ it.each`
+ type | path | icon
+ ${'folder'} | ${''} | ${'folder'}
+ ${'commit'} | ${''} | ${'archive'}
+ ${'file'} | ${'test.pdf'} | ${'file-pdf-o'}
+ ${'file'} | ${'test.jpg'} | ${'file-image-o'}
+ ${'file'} | ${'test.zip'} | ${'file-archive-o'}
+ ${'file'} | ${'test.mp3'} | ${'file-audio-o'}
+ ${'file'} | ${'test.flv'} | ${'file-video-o'}
+ ${'file'} | ${'test.dotx'} | ${'file-word-o'}
+ ${'file'} | ${'test.xlsb'} | ${'file-excel-o'}
+ ${'file'} | ${'test.ppam'} | ${'file-powerpoint-o'}
+ ${'file'} | ${'test.js'} | ${'file-text-o'}
+ `('returns $icon for $type with path $path', ({ type, path, icon }) => {
+ expect(getIconName(type, path)).toEqual(icon);
+ });
+});
diff --git a/spec/frontend/serverless/components/function_row_spec.js b/spec/frontend/serverless/components/function_row_spec.js
index 414fdc5cd82..979f98c4832 100644
--- a/spec/frontend/serverless/components/function_row_spec.js
+++ b/spec/frontend/serverless/components/function_row_spec.js
@@ -1,27 +1,32 @@
import functionRowComponent from '~/serverless/components/function_row.vue';
import { shallowMount } from '@vue/test-utils';
+import Timeago from '~/vue_shared/components/time_ago_tooltip.vue';
import { mockServerlessFunction } from '../mock_data';
-const createComponent = func =>
- shallowMount(functionRowComponent, { propsData: { func }, sync: false }).vm;
-
describe('functionRowComponent', () => {
- it('Parses the function details correctly', () => {
- const vm = createComponent(mockServerlessFunction);
+ let wrapper;
- expect(vm.$el.querySelector('b').innerHTML).toEqual(mockServerlessFunction.name);
- expect(vm.$el.querySelector('span').innerHTML).toEqual(mockServerlessFunction.image);
- expect(vm.$el.querySelector('timeago-stub').getAttribute('time')).not.toBe(null);
+ const createComponent = func => {
+ wrapper = shallowMount(functionRowComponent, { propsData: { func }, sync: false });
+ };
- vm.$destroy();
+ afterEach(() => {
+ wrapper.destroy();
+ });
+
+ it('Parses the function details correctly', () => {
+ createComponent(mockServerlessFunction);
+
+ expect(wrapper.find('b').text()).toBe(mockServerlessFunction.name);
+ expect(wrapper.find('span').text()).toBe(mockServerlessFunction.image);
+ expect(wrapper.find(Timeago).attributes('time')).not.toBe(null);
});
it('handles clicks correctly', () => {
- const vm = createComponent(mockServerlessFunction);
+ createComponent(mockServerlessFunction);
+ const { vm } = wrapper;
expect(vm.checkClass(vm.$el.querySelector('p'))).toBe(true); // check somewhere inside the row
-
- vm.$destroy();
});
});
diff --git a/spec/frontend/serverless/components/functions_spec.js b/spec/frontend/serverless/components/functions_spec.js
index 7af33ceaadc..6924fb9e91f 100644
--- a/spec/frontend/serverless/components/functions_spec.js
+++ b/spec/frontend/serverless/components/functions_spec.js
@@ -1,9 +1,12 @@
import Vuex from 'vuex';
+import { GlLoadingIcon } from '@gitlab/ui';
import AxiosMockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils';
import functionsComponent from '~/serverless/components/functions.vue';
import { createLocalVue, shallowMount } from '@vue/test-utils';
import { createStore } from '~/serverless/store';
+import EmptyState from '~/serverless/components/empty_state.vue';
+import EnvironmentRow from '~/serverless/components/environment_row.vue';
import { TEST_HOST } from 'helpers/test_constants';
import { mockServerlessFunctions } from '../mock_data';
@@ -43,7 +46,7 @@ describe('functionsComponent', () => {
sync: false,
});
- expect(component.vm.$el.querySelector('emptystate-stub')).not.toBe(null);
+ expect(component.find(EmptyState).exists()).toBe(true);
});
it('should render a loading component', () => {
@@ -60,7 +63,7 @@ describe('functionsComponent', () => {
sync: false,
});
- expect(component.vm.$el.querySelector('glloadingicon-stub')).not.toBe(null);
+ expect(component.find(GlLoadingIcon).exists()).toBe(true);
});
it('should render empty state when there is no function data', () => {
@@ -104,7 +107,7 @@ describe('functionsComponent', () => {
component.vm.$store.dispatch('receiveFunctionsSuccess', mockServerlessFunctions);
return component.vm.$nextTick().then(() => {
- expect(component.vm.$el.querySelector('environmentrow-stub')).not.toBe(null);
+ expect(component.find(EnvironmentRow).exists()).toBe(true);
});
});
});
diff --git a/spec/frontend/serverless/components/missing_prometheus_spec.js b/spec/frontend/serverless/components/missing_prometheus_spec.js
index d0df6125290..5dbdccde2de 100644
--- a/spec/frontend/serverless/components/missing_prometheus_spec.js
+++ b/spec/frontend/serverless/components/missing_prometheus_spec.js
@@ -1,3 +1,4 @@
+import { GlButton } from '@gitlab/ui';
import missingPrometheusComponent from '~/serverless/components/missing_prometheus.vue';
import { shallowMount } from '@vue/test-utils';
@@ -9,27 +10,29 @@ const createComponent = missingData =>
missingData,
},
sync: false,
- }).vm;
+ });
describe('missingPrometheusComponent', () => {
- let vm;
+ let wrapper;
afterEach(() => {
- vm.$destroy();
+ wrapper.destroy();
});
it('should render missing prometheus message', () => {
- vm = createComponent(false);
+ wrapper = createComponent(false);
+ const { vm } = wrapper;
expect(vm.$el.querySelector('.state-description').innerHTML.trim()).toContain(
'Function invocation metrics require Prometheus to be installed first.',
);
- expect(vm.$el.querySelector('glbutton-stub').getAttribute('variant')).toEqual('success');
+ expect(wrapper.find(GlButton).attributes('variant')).toBe('success');
});
it('should render no prometheus data message', () => {
- vm = createComponent(true);
+ wrapper = createComponent(true);
+ const { vm } = wrapper;
expect(vm.$el.querySelector('.state-description').innerHTML.trim()).toContain(
'Invocation metrics loading or not available at this time.',
diff --git a/spec/frontend/serverless/components/url_spec.js b/spec/frontend/serverless/components/url_spec.js
index d05a9bba103..706441e8a8b 100644
--- a/spec/frontend/serverless/components/url_spec.js
+++ b/spec/frontend/serverless/components/url_spec.js
@@ -1,6 +1,7 @@
import Vue from 'vue';
import urlComponent from '~/serverless/components/url.vue';
import { shallowMount } from '@vue/test-utils';
+import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
const createComponent = uri =>
shallowMount(Vue.extend(urlComponent), {
@@ -8,15 +9,16 @@ const createComponent = uri =>
uri,
},
sync: false,
- }).vm;
+ });
describe('urlComponent', () => {
it('should render correctly', () => {
const uri = 'http://testfunc.apps.example.com';
- const vm = createComponent(uri);
+ const wrapper = createComponent(uri);
+ const { vm } = wrapper;
expect(vm.$el.classList.contains('clipboard-group')).toBe(true);
- expect(vm.$el.querySelector('clipboardbutton-stub').getAttribute('text')).toEqual(uri);
+ expect(wrapper.find(ClipboardButton).attributes('text')).toEqual(uri);
expect(vm.$el.querySelector('.url-text-field').innerHTML).toEqual(uri);
diff --git a/spec/frontend/test_setup.js b/spec/frontend/test_setup.js
index c57e0e7cfc6..c24f0bc4776 100644
--- a/spec/frontend/test_setup.js
+++ b/spec/frontend/test_setup.js
@@ -3,7 +3,7 @@ import * as jqueryMatchers from 'custom-jquery-matchers';
import Translate from '~/vue_shared/translate';
import axios from '~/lib/utils/axios_utils';
import { initializeTestTimeout } from './helpers/timeout';
-import { getJSONFixture, loadHTMLFixture, setHTMLFixture } from './helpers/fixtures';
+import { loadHTMLFixture, setHTMLFixture } from './helpers/fixtures';
process.on('unhandledRejection', global.promiseRejectionHandler);
@@ -15,7 +15,7 @@ afterEach(() =>
}),
);
-initializeTestTimeout(300);
+initializeTestTimeout(500);
// fail tests for unmocked requests
beforeEach(done => {
@@ -46,9 +46,12 @@ Object.defineProperty(global.Element.prototype, 'innerText', {
// convenience wrapper for migration from Karma
Object.assign(global, {
loadFixtures: loadHTMLFixture,
- loadJSONFixtures: getJSONFixture,
- preloadFixtures() {},
setFixtures: setHTMLFixture,
+
+ // The following functions fill the fixtures cache in Karma.
+ // This is not necessary in Jest because we make no Ajax request.
+ loadJSONFixtures() {},
+ preloadFixtures() {},
});
// custom-jquery-matchers was written for an old Jest version, we need to make it compatible
diff --git a/spec/graphql/resolvers/group_resolver_spec.rb b/spec/graphql/resolvers/group_resolver_spec.rb
new file mode 100644
index 00000000000..5eb9cd06d15
--- /dev/null
+++ b/spec/graphql/resolvers/group_resolver_spec.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Resolvers::GroupResolver do
+ include GraphqlHelpers
+
+ set(:group1) { create(:group) }
+ set(:group2) { create(:group) }
+
+ describe '#resolve' do
+ it 'batch-resolves groups by full path' do
+ paths = [group1.full_path, group2.full_path]
+
+ result = batch(max_queries: 1) do
+ paths.map { |path| resolve_group(path) }
+ end
+
+ expect(result).to contain_exactly(group1, group2)
+ end
+
+ it 'resolves an unknown full_path to nil' do
+ result = batch { resolve_group('unknown/project') }
+
+ expect(result).to be_nil
+ end
+ end
+
+ def resolve_group(full_path)
+ resolve(described_class, args: { full_path: full_path })
+ end
+end
diff --git a/spec/graphql/resolvers/tree_resolver_spec.rb b/spec/graphql/resolvers/tree_resolver_spec.rb
new file mode 100644
index 00000000000..9f95b740ab1
--- /dev/null
+++ b/spec/graphql/resolvers/tree_resolver_spec.rb
@@ -0,0 +1,35 @@
+require 'spec_helper'
+
+describe Resolvers::TreeResolver do
+ include GraphqlHelpers
+
+ let(:repository) { create(:project, :repository).repository }
+
+ describe '#resolve' do
+ it 'resolves to a tree' do
+ result = resolve_repository({ ref: "master" })
+
+ expect(result).to be_an_instance_of(Tree)
+ end
+
+ it 'resolve to a recursive tree' do
+ result = resolve_repository({ ref: "master", recursive: true })
+
+ expect(result.trees[4].path).to eq('files/html')
+ end
+
+ context 'when repository does not exist' do
+ it 'returns nil' do
+ allow(repository).to receive(:exists?).and_return(false)
+
+ result = resolve_repository({ ref: "master" })
+
+ expect(result).to be(nil)
+ end
+ end
+ end
+
+ def resolve_repository(args)
+ resolve(described_class, obj: repository, args: args)
+ end
+end
diff --git a/spec/graphql/types/project_type_spec.rb b/spec/graphql/types/project_type_spec.rb
index e0ad09bdf22..075fa7c7e43 100644
--- a/spec/graphql/types/project_type_spec.rb
+++ b/spec/graphql/types/project_type_spec.rb
@@ -17,4 +17,6 @@ describe GitlabSchema.types['Project'] do
end
it { is_expected.to have_graphql_field(:pipelines) }
+
+ it { is_expected.to have_graphql_field(:repository) }
end
diff --git a/spec/graphql/types/repository_type_spec.rb b/spec/graphql/types/repository_type_spec.rb
new file mode 100644
index 00000000000..8a8238f2a2a
--- /dev/null
+++ b/spec/graphql/types/repository_type_spec.rb
@@ -0,0 +1,11 @@
+require 'spec_helper'
+
+describe GitlabSchema.types['Repository'] do
+ it { expect(described_class.graphql_name).to eq('Repository') }
+
+ it { expect(described_class).to require_graphql_authorizations(:download_code) }
+
+ it { is_expected.to have_graphql_field(:root_ref) }
+
+ it { is_expected.to have_graphql_field(:tree) }
+end
diff --git a/spec/graphql/types/tree/blob_type_spec.rb b/spec/graphql/types/tree/blob_type_spec.rb
new file mode 100644
index 00000000000..fa29bb5fff7
--- /dev/null
+++ b/spec/graphql/types/tree/blob_type_spec.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Types::Tree::BlobType do
+ it { expect(described_class.graphql_name).to eq('Blob') }
+
+ it { expect(described_class).to have_graphql_fields(:id, :name, :type, :path, :flat_path) }
+end
diff --git a/spec/graphql/types/tree/submodule_type_spec.rb b/spec/graphql/types/tree/submodule_type_spec.rb
new file mode 100644
index 00000000000..bdb3149b41c
--- /dev/null
+++ b/spec/graphql/types/tree/submodule_type_spec.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Types::Tree::SubmoduleType do
+ it { expect(described_class.graphql_name).to eq('Submodule') }
+
+ it { expect(described_class).to have_graphql_fields(:id, :name, :type, :path, :flat_path) }
+end
diff --git a/spec/graphql/types/tree/tree_entry_type_spec.rb b/spec/graphql/types/tree/tree_entry_type_spec.rb
new file mode 100644
index 00000000000..397cabde8e5
--- /dev/null
+++ b/spec/graphql/types/tree/tree_entry_type_spec.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Types::Tree::TreeEntryType do
+ it { expect(described_class.graphql_name).to eq('TreeEntry') }
+
+ it { expect(described_class).to have_graphql_fields(:id, :name, :type, :path, :flat_path) }
+end
diff --git a/spec/graphql/types/tree/tree_type_spec.rb b/spec/graphql/types/tree/tree_type_spec.rb
new file mode 100644
index 00000000000..b9c5570115e
--- /dev/null
+++ b/spec/graphql/types/tree/tree_type_spec.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Types::Tree::TreeType do
+ it { expect(described_class.graphql_name).to eq('Tree') }
+
+ it { expect(described_class).to have_graphql_fields(:trees, :submodules, :blobs) }
+end
diff --git a/spec/graphql/types/tree/type_enum_spec.rb b/spec/graphql/types/tree/type_enum_spec.rb
new file mode 100644
index 00000000000..4caf9e1c457
--- /dev/null
+++ b/spec/graphql/types/tree/type_enum_spec.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Types::Tree::TypeEnum do
+ it { expect(described_class.graphql_name).to eq('EntryType') }
+
+ it 'exposes all tree entry types' do
+ expect(described_class.values.keys).to include(*%w[tree blob commit])
+ end
+end
diff --git a/spec/haml_lint/linter/no_plain_nodes_spec.rb b/spec/haml_lint/linter/no_plain_nodes_spec.rb
new file mode 100644
index 00000000000..08deb5a4e9e
--- /dev/null
+++ b/spec/haml_lint/linter/no_plain_nodes_spec.rb
@@ -0,0 +1,56 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+require 'haml_lint'
+require 'haml_lint/spec'
+require Rails.root.join('haml_lint/linter/no_plain_nodes')
+
+describe HamlLint::Linter::NoPlainNodes do
+ include_context 'linter'
+
+ context 'reports when a tag has an inline plain node' do
+ let(:haml) { '%tag Hello Tanuki' }
+ let(:message) { "`Hello Tanuki` is a plain node. Please use an i18n method like `= _('Hello Tanuki')`" }
+
+ it { is_expected.to report_lint message: message }
+ end
+
+ context 'reports when a tag has multiline plain nodes' do
+ let(:haml) { <<-HAML }
+ %tag
+ Hello
+ Tanuki
+ HAML
+
+ it { is_expected.to report_lint count: 1 }
+ end
+
+ context 'reports when a tag has an inline plain node with interpolation' do
+ let(:haml) { '%tag Hello #{"Tanuki"}!' } # rubocop:disable Lint/InterpolationCheck
+
+ it { is_expected.to report_lint }
+ end
+
+ context 'does not report when a tag has an inline script' do
+ let(:haml) { '%tag= "Hello Tanuki"' }
+
+ it { is_expected.not_to report_lint }
+ end
+
+ context 'does not report when a tag is empty' do
+ let(:haml) { '%tag' }
+
+ it { is_expected.not_to report_lint }
+ end
+
+ context 'reports multiple when a tag has multiline plain nodes split by non-text nodes' do
+ let(:haml) { <<-HAML }
+ %tag
+ Hello
+ .split-node There
+ Tanuki
+ HAML
+
+ it { is_expected.to report_lint count: 3 }
+ end
+end
diff --git a/spec/helpers/dashboard_helper_spec.rb b/spec/helpers/dashboard_helper_spec.rb
index 7ba24ba2956..023238ee0ae 100644
--- a/spec/helpers/dashboard_helper_spec.rb
+++ b/spec/helpers/dashboard_helper_spec.rb
@@ -21,4 +21,10 @@ describe DashboardHelper do
expect(helper.dashboard_nav_links).not_to include(:activity, :milestones)
end
end
+
+ describe '.has_start_trial?' do
+ subject { helper.has_start_trial? }
+
+ it { is_expected.to eq(false) }
+ end
end
diff --git a/spec/helpers/emails_helper_spec.rb b/spec/helpers/emails_helper_spec.rb
index 03b4c19ec22..0434af25866 100644
--- a/spec/helpers/emails_helper_spec.rb
+++ b/spec/helpers/emails_helper_spec.rb
@@ -1,6 +1,45 @@
require 'spec_helper'
describe EmailsHelper do
+ describe 'closure_reason_text' do
+ context 'when given a MergeRequest' do
+ let(:merge_request) { create(:merge_request) }
+ let(:merge_request_presenter) { merge_request.present }
+
+ context "and format is text" do
+ it "returns plain text" do
+ expect(closure_reason_text(merge_request, format: :text)).to eq(" via merge request #{merge_request.to_reference} (#{merge_request_presenter.web_url})")
+ end
+ end
+
+ context "and format is HTML" do
+ it "returns HTML" do
+ expect(closure_reason_text(merge_request, format: :html)).to eq(" via merge request #{link_to(merge_request.to_reference, merge_request_presenter.web_url)}")
+ end
+ end
+
+ context "and format is unknown" do
+ it "returns plain text" do
+ expect(closure_reason_text(merge_request, format: :text)).to eq(" via merge request #{merge_request.to_reference} (#{merge_request_presenter.web_url})")
+ end
+ end
+ end
+
+ context 'when given a String' do
+ let(:closed_via) { "5a0eb6fd7e0f133044378c662fcbbc0d0c16dbfa" }
+
+ it "returns plain text" do
+ expect(closure_reason_text(closed_via)).to eq(" via #{closed_via}")
+ end
+ end
+
+ context 'when not given anything' do
+ it "returns empty string" do
+ expect(closure_reason_text(nil)).to eq("")
+ end
+ end
+ end
+
describe 'sanitize_name' do
context 'when name contains a valid URL string' do
it 'returns name with `.` replaced with `_` to prevent mail clients from auto-linking URLs' do
diff --git a/spec/helpers/groups/group_members_helper_spec.rb b/spec/helpers/groups/group_members_helper_spec.rb
new file mode 100644
index 00000000000..898c330c498
--- /dev/null
+++ b/spec/helpers/groups/group_members_helper_spec.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+require "spec_helper"
+
+describe Groups::GroupMembersHelper do
+ describe '.group_member_select_options' do
+ let(:group) { create(:group) }
+
+ before do
+ helper.instance_variable_set(:@group, group)
+ end
+
+ it 'returns an options hash' do
+ expect(helper.group_member_select_options).to include(multiple: true, scope: :all, email_user: true)
+ end
+ end
+end
diff --git a/spec/helpers/nav_helper_spec.rb b/spec/helpers/nav_helper_spec.rb
index e840c927d59..979d89812f5 100644
--- a/spec/helpers/nav_helper_spec.rb
+++ b/spec/helpers/nav_helper_spec.rb
@@ -50,4 +50,16 @@ describe NavHelper do
expect(helper.header_links).to contain_exactly(:sign_in, :search)
end
end
+
+ context '.admin_monitoring_nav_links' do
+ subject { helper.admin_monitoring_nav_links }
+
+ it { is_expected.to all(be_a(String)) }
+ end
+
+ context '.group_issues_sub_menu_items' do
+ subject { helper.group_issues_sub_menu_items }
+
+ it { is_expected.to all(be_a(String)) }
+ end
end
diff --git a/spec/helpers/page_layout_helper_spec.rb b/spec/helpers/page_layout_helper_spec.rb
index cf98eed27f1..bf50763d06f 100644
--- a/spec/helpers/page_layout_helper_spec.rb
+++ b/spec/helpers/page_layout_helper_spec.rb
@@ -38,6 +38,14 @@ describe PageLayoutHelper do
expect(helper.page_description).to eq 'Bold Header'
end
+
+ it 'truncates before sanitizing' do
+ helper.page_description('<b>Bold</b> <img> <img> <img> <h1>Header</h1> ' * 10)
+
+ # 12 words because <img> was counted as a word
+ expect(helper.page_description)
+ .to eq('Bold Header Bold Header Bold Header Bold Header Bold Header Bold Header...')
+ end
end
describe 'page_image' do
diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb
index 554cb861563..83271aa24a3 100644
--- a/spec/helpers/projects_helper_spec.rb
+++ b/spec/helpers/projects_helper_spec.rb
@@ -799,4 +799,24 @@ describe ProjectsHelper do
it { is_expected.to eq(result) }
end
end
+
+ describe '#can_import_members?' do
+ let(:project) { create(:project) }
+ let(:user) { create(:user) }
+ let(:owner) { project.owner }
+
+ before do
+ helper.instance_variable_set(:@project, project)
+ end
+
+ it 'returns false if user cannot admin_project_member' do
+ allow(helper).to receive(:current_user) { user }
+ expect(helper.can_import_members?).to eq false
+ end
+
+ it 'returns true if user can admin_project_member' do
+ allow(helper).to receive(:current_user) { owner }
+ expect(helper.can_import_members?).to eq true
+ end
+ end
end
diff --git a/spec/javascripts/api_spec.js b/spec/javascripts/api_spec.js
index 494b3b934a8..805bb10bda6 100644
--- a/spec/javascripts/api_spec.js
+++ b/spec/javascripts/api_spec.js
@@ -288,7 +288,7 @@ describe('Api', () => {
it('creates a group label', done => {
const namespace = 'group/subgroup';
const labelData = { some: 'data' };
- const expectedUrl = `${dummyUrlRoot}/groups/${namespace}/-/labels`;
+ const expectedUrl = Api.buildUrl(Api.groupLabelsPath).replace(':namespace_path', namespace);
const expectedData = {
label: labelData,
};
diff --git a/spec/javascripts/diffs/components/commit_item_spec.js b/spec/javascripts/diffs/components/commit_item_spec.js
index 50e45f48af3..8fc9b10dd0b 100644
--- a/spec/javascripts/diffs/components/commit_item_spec.js
+++ b/spec/javascripts/diffs/components/commit_item_spec.js
@@ -1,7 +1,7 @@
import Vue from 'vue';
import { TEST_HOST } from 'spec/test_constants';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
-import { trimText } from 'spec/helpers/vue_component_helper';
+import { trimText } from 'spec/helpers/text_helper';
import { getTimeago } from '~/lib/utils/datetime_utility';
import CommitItem from '~/diffs/components/commit_item.vue';
import getDiffWithCommit from '../mock_data/diff_with_commit';
diff --git a/spec/javascripts/diffs/store/actions_spec.js b/spec/javascripts/diffs/store/actions_spec.js
index c82dcadd2f1..6309a8823d7 100644
--- a/spec/javascripts/diffs/store/actions_spec.js
+++ b/spec/javascripts/diffs/store/actions_spec.js
@@ -82,7 +82,7 @@ describe('DiffsStoreActions', () => {
describe('fetchDiffFiles', () => {
it('should fetch diff files', done => {
- const endpoint = '/fetch/diff/files';
+ const endpoint = '/fetch/diff/files?w=1';
const mock = new MockAdapter(axios);
const res = { diff_files: 1, merge_request_diffs: [] };
mock.onGet(endpoint).reply(200, res);
@@ -828,6 +828,10 @@ describe('DiffsStoreActions', () => {
});
describe('setShowWhitespace', () => {
+ beforeEach(() => {
+ spyOn(eventHub, '$emit').and.stub();
+ });
+
it('commits SET_SHOW_WHITESPACE', done => {
testAction(
setShowWhitespace,
@@ -855,6 +859,30 @@ describe('DiffsStoreActions', () => {
expect(window.history.pushState).toHaveBeenCalled();
});
+
+ it('calls history pushState with merged params', () => {
+ const originalPushState = window.history;
+
+ originalPushState.pushState({}, '', '?test=1');
+
+ spyOn(localStorage, 'setItem').and.stub();
+ spyOn(window.history, 'pushState').and.stub();
+
+ setShowWhitespace({ commit() {} }, { showWhitespace: true, pushState: true });
+
+ expect(window.history.pushState.calls.mostRecent().args[2]).toMatch(/(.*)\?test=1&w=0/);
+
+ originalPushState.pushState({}, '', '?');
+ });
+
+ it('emits eventHub event', () => {
+ spyOn(localStorage, 'setItem').and.stub();
+ spyOn(window.history, 'pushState').and.stub();
+
+ setShowWhitespace({ commit() {} }, { showWhitespace: true, pushState: true });
+
+ expect(eventHub.$emit).toHaveBeenCalledWith('refetchDiffData');
+ });
});
describe('setRenderIt', () => {
diff --git a/spec/javascripts/dirty_submit/dirty_submit_form_spec.js b/spec/javascripts/dirty_submit/dirty_submit_form_spec.js
index 95cc90dcb0f..b1017e0c4f0 100644
--- a/spec/javascripts/dirty_submit/dirty_submit_form_spec.js
+++ b/spec/javascripts/dirty_submit/dirty_submit_form_spec.js
@@ -1,3 +1,4 @@
+import _ from 'underscore';
import DirtySubmitForm from '~/dirty_submit/dirty_submit_form';
import { getInputValue, setInputValue, createForm } from './helper';
@@ -13,46 +14,100 @@ function expectToToggleDisableOnDirtyUpdate(submit, input) {
}
describe('DirtySubmitForm', () => {
- DirtySubmitForm.THROTTLE_DURATION = 0;
+ const originalThrottleDuration = DirtySubmitForm.THROTTLE_DURATION;
- it('disables submit until there are changes', done => {
- const { form, input, submit } = createForm();
+ describe('submit button tests', () => {
+ beforeEach(() => {
+ DirtySubmitForm.THROTTLE_DURATION = 0;
+ });
- new DirtySubmitForm(form); // eslint-disable-line no-new
+ afterEach(() => {
+ DirtySubmitForm.THROTTLE_DURATION = originalThrottleDuration;
+ });
- return expectToToggleDisableOnDirtyUpdate(submit, input)
- .then(done)
- .catch(done.fail);
- });
+ it('disables submit until there are changes', done => {
+ const { form, input, submit } = createForm();
- it('disables submit until there are changes when initializing with a falsy value', done => {
- const { form, input, submit } = createForm();
- input.value = '';
+ new DirtySubmitForm(form); // eslint-disable-line no-new
- new DirtySubmitForm(form); // eslint-disable-line no-new
+ return expectToToggleDisableOnDirtyUpdate(submit, input)
+ .then(done)
+ .catch(done.fail);
+ });
- return expectToToggleDisableOnDirtyUpdate(submit, input)
- .then(done)
- .catch(done.fail);
- });
+ it('disables submit until there are changes when initializing with a falsy value', done => {
+ const { form, input, submit } = createForm();
+ input.value = '';
+
+ new DirtySubmitForm(form); // eslint-disable-line no-new
+
+ return expectToToggleDisableOnDirtyUpdate(submit, input)
+ .then(done)
+ .catch(done.fail);
+ });
- it('disables submit until there are changes for radio inputs', done => {
- const { form, input, submit } = createForm('radio');
+ it('disables submit until there are changes for radio inputs', done => {
+ const { form, input, submit } = createForm('radio');
- new DirtySubmitForm(form); // eslint-disable-line no-new
+ new DirtySubmitForm(form); // eslint-disable-line no-new
- return expectToToggleDisableOnDirtyUpdate(submit, input)
- .then(done)
- .catch(done.fail);
+ return expectToToggleDisableOnDirtyUpdate(submit, input)
+ .then(done)
+ .catch(done.fail);
+ });
+
+ it('disables submit until there are changes for checkbox inputs', done => {
+ const { form, input, submit } = createForm('checkbox');
+
+ new DirtySubmitForm(form); // eslint-disable-line no-new
+
+ return expectToToggleDisableOnDirtyUpdate(submit, input)
+ .then(done)
+ .catch(done.fail);
+ });
});
- it('disables submit until there are changes for checkbox inputs', done => {
- const { form, input, submit } = createForm('checkbox');
+ describe('throttling tests', () => {
+ beforeEach(() => {
+ jasmine.clock().install();
+ DirtySubmitForm.THROTTLE_DURATION = 100;
+ });
+
+ afterEach(() => {
+ jasmine.clock().uninstall();
+ DirtySubmitForm.THROTTLE_DURATION = originalThrottleDuration;
+ });
+
+ it('throttles updates when rapid changes are made to a single form element', () => {
+ const { form, input } = createForm();
+ const updateDirtyInputSpy = spyOn(new DirtySubmitForm(form), 'updateDirtyInput');
+
+ _.range(10).forEach(i => {
+ setInputValue(input, `change ${i}`, false);
+ });
+
+ jasmine.clock().tick(101);
+
+ expect(updateDirtyInputSpy).toHaveBeenCalledTimes(2);
+ });
+
+ it('does not throttle updates when rapid changes are made to different form elements', () => {
+ const form = document.createElement('form');
+ const range = _.range(10);
+ range.forEach(i => {
+ form.innerHTML += `<input type="text" name="input-${i}" class="js-input-${i}"/>`;
+ });
+
+ const updateDirtyInputSpy = spyOn(new DirtySubmitForm(form), 'updateDirtyInput');
+
+ range.forEach(i => {
+ const input = form.querySelector(`.js-input-${i}`);
+ setInputValue(input, `change`, false);
+ });
- new DirtySubmitForm(form); // eslint-disable-line no-new
+ jasmine.clock().tick(101);
- return expectToToggleDisableOnDirtyUpdate(submit, input)
- .then(done)
- .catch(done.fail);
+ expect(updateDirtyInputSpy).toHaveBeenCalledTimes(range.length);
+ });
});
});
diff --git a/spec/javascripts/environments/folder/environments_folder_view_spec.js b/spec/javascripts/environments/folder/environments_folder_view_spec.js
index ff15067aeac..f1c323df4be 100644
--- a/spec/javascripts/environments/folder/environments_folder_view_spec.js
+++ b/spec/javascripts/environments/folder/environments_folder_view_spec.js
@@ -3,7 +3,7 @@ import MockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils';
import environmentsFolderViewComponent from '~/environments/folder/environments_folder_view.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
-import { removeBreakLine, removeWhitespace } from 'spec/helpers/vue_component_helper';
+import { removeBreakLine, removeWhitespace } from 'spec/helpers/text_helper';
import { environmentsList } from '../mock_data';
describe('Environments Folder View', () => {
diff --git a/spec/javascripts/fly_out_nav_spec.js b/spec/javascripts/fly_out_nav_spec.js
index 7ef44f29c5b..4772f754937 100644
--- a/spec/javascripts/fly_out_nav_spec.js
+++ b/spec/javascripts/fly_out_nav_spec.js
@@ -14,6 +14,7 @@ import {
setSidebar,
subItemsMouseLeave,
} from '~/fly_out_nav';
+import { SIDEBAR_COLLAPSED_CLASS } from '~/contextual_sidebar';
import bp from '~/breakpoints';
describe('Fly out sidebar navigation', () => {
@@ -219,7 +220,7 @@ describe('Fly out sidebar navigation', () => {
it('shows collapsed only sub-items if icon only sidebar', () => {
const subItems = el.querySelector('.sidebar-sub-level-items');
const sidebar = document.createElement('div');
- sidebar.classList.add('sidebar-collapsed-desktop');
+ sidebar.classList.add(SIDEBAR_COLLAPSED_CLASS);
subItems.classList.add('is-fly-out-only');
setSidebar(sidebar);
@@ -296,7 +297,7 @@ describe('Fly out sidebar navigation', () => {
it('returns true when active & collapsed sidebar', () => {
const sidebar = document.createElement('div');
- sidebar.classList.add('sidebar-collapsed-desktop');
+ sidebar.classList.add(SIDEBAR_COLLAPSED_CLASS);
el.classList.add('active');
setSidebar(sidebar);
diff --git a/spec/javascripts/frequent_items/components/frequent_items_list_item_spec.js b/spec/javascripts/frequent_items/components/frequent_items_list_item_spec.js
index f00bc2eeb6d..dce8e3be148 100644
--- a/spec/javascripts/frequent_items/components/frequent_items_list_item_spec.js
+++ b/spec/javascripts/frequent_items/components/frequent_items_list_item_spec.js
@@ -1,7 +1,7 @@
import Vue from 'vue';
import frequentItemsListItemComponent from '~/frequent_items/components/frequent_items_list_item.vue';
import { shallowMount } from '@vue/test-utils';
-import { trimText } from 'spec/helpers/vue_component_helper';
+import { trimText } from 'spec/helpers/text_helper';
import { mockProject } from '../mock_data'; // can also use 'mockGroup', but not useful to test here
const createComponent = () => {
diff --git a/spec/javascripts/helpers/vue_component_helper.js b/spec/javascripts/helpers/text_helper.js
index e0fe18e5560..e0fe18e5560 100644
--- a/spec/javascripts/helpers/vue_component_helper.js
+++ b/spec/javascripts/helpers/text_helper.js
diff --git a/spec/javascripts/ide/components/commit_sidebar/list_collapsed_spec.js b/spec/javascripts/ide/components/commit_sidebar/list_collapsed_spec.js
index 9af3c15a4e3..3c7d6192e2c 100644
--- a/spec/javascripts/ide/components/commit_sidebar/list_collapsed_spec.js
+++ b/spec/javascripts/ide/components/commit_sidebar/list_collapsed_spec.js
@@ -3,7 +3,7 @@ import store from '~/ide/stores';
import listCollapsed from '~/ide/components/commit_sidebar/list_collapsed.vue';
import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import { file } from '../../helpers';
-import { removeWhitespace } from '../../../helpers/vue_component_helper';
+import { removeWhitespace } from '../../../helpers/text_helper';
describe('Multi-file editor commit sidebar list collapsed', () => {
let vm;
diff --git a/spec/javascripts/ide/components/ide_review_spec.js b/spec/javascripts/ide/components/ide_review_spec.js
index b9ee22b7c1a..396c5d282d4 100644
--- a/spec/javascripts/ide/components/ide_review_spec.js
+++ b/spec/javascripts/ide/components/ide_review_spec.js
@@ -2,7 +2,7 @@ import Vue from 'vue';
import IdeReview from '~/ide/components/ide_review.vue';
import store from '~/ide/stores';
import { createComponentWithStore } from '../../helpers/vue_mount_component_helper';
-import { trimText } from '../../helpers/vue_component_helper';
+import { trimText } from '../../helpers/text_helper';
import { resetStore, file } from '../helpers';
import { projectData } from '../mock_data';
diff --git a/spec/javascripts/ide/components/nav_dropdown_button_spec.js b/spec/javascripts/ide/components/nav_dropdown_button_spec.js
index 0a58e260280..19b0071567a 100644
--- a/spec/javascripts/ide/components/nav_dropdown_button_spec.js
+++ b/spec/javascripts/ide/components/nav_dropdown_button_spec.js
@@ -1,7 +1,7 @@
import Vue from 'vue';
import NavDropdownButton from '~/ide/components/nav_dropdown_button.vue';
import store from '~/ide/stores';
-import { trimText } from 'spec/helpers/vue_component_helper';
+import { trimText } from 'spec/helpers/text_helper';
import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import { resetStore } from '../helpers';
diff --git a/spec/javascripts/jobs/components/artifacts_block_spec.js b/spec/javascripts/jobs/components/artifacts_block_spec.js
index 27d480ef2ea..58998d038e5 100644
--- a/spec/javascripts/jobs/components/artifacts_block_spec.js
+++ b/spec/javascripts/jobs/components/artifacts_block_spec.js
@@ -2,7 +2,7 @@ import Vue from 'vue';
import { getTimeago } from '~/lib/utils/datetime_utility';
import component from '~/jobs/components/artifacts_block.vue';
import mountComponent from '../../helpers/vue_mount_component_helper';
-import { trimText } from '../../helpers/vue_component_helper';
+import { trimText } from '../../helpers/text_helper';
describe('Artifacts block', () => {
const Component = Vue.extend(component);
diff --git a/spec/javascripts/jobs/components/sidebar_spec.js b/spec/javascripts/jobs/components/sidebar_spec.js
index 3a02351460c..26d9effcac5 100644
--- a/spec/javascripts/jobs/components/sidebar_spec.js
+++ b/spec/javascripts/jobs/components/sidebar_spec.js
@@ -3,7 +3,7 @@ import sidebarDetailsBlock from '~/jobs/components/sidebar.vue';
import createStore from '~/jobs/store';
import job, { stages, jobsInStage } from '../mock_data';
import { mountComponentWithStore } from '../../helpers/vue_mount_component_helper';
-import { trimText } from '../../helpers/vue_component_helper';
+import { trimText } from '../../helpers/text_helper';
describe('Sidebar details block', () => {
const SidebarComponent = Vue.extend(sidebarDetailsBlock);
diff --git a/spec/javascripts/jobs/components/stages_dropdown_spec.js b/spec/javascripts/jobs/components/stages_dropdown_spec.js
index eccb4e13d67..52bb5161123 100644
--- a/spec/javascripts/jobs/components/stages_dropdown_spec.js
+++ b/spec/javascripts/jobs/components/stages_dropdown_spec.js
@@ -1,6 +1,6 @@
import Vue from 'vue';
import component from '~/jobs/components/stages_dropdown.vue';
-import { trimText } from 'spec/helpers/vue_component_helper';
+import { trimText } from 'spec/helpers/text_helper';
import mountComponent from '../../helpers/vue_mount_component_helper';
describe('Stages Dropdown', () => {
diff --git a/spec/javascripts/pdf/index_spec.js b/spec/javascripts/pdf/index_spec.js
index 7191b65b4cd..c746d5644e8 100644
--- a/spec/javascripts/pdf/index_spec.js
+++ b/spec/javascripts/pdf/index_spec.js
@@ -1,6 +1,6 @@
import Vue from 'vue';
-import { GlobalWorkerOptions } from 'vendor/pdf';
-import workerSrc from 'vendor/pdf.worker.min';
+import { GlobalWorkerOptions } from 'pdfjs-dist/build/pdf';
+import workerSrc from 'pdfjs-dist/build/pdf.worker.min';
import PDFLab from '~/pdf/index.vue';
import { FIXTURES_PATH } from 'spec/test_constants';
diff --git a/spec/javascripts/pdf/page_spec.js b/spec/javascripts/pdf/page_spec.js
index f899b5b3a0d..6dea570266b 100644
--- a/spec/javascripts/pdf/page_spec.js
+++ b/spec/javascripts/pdf/page_spec.js
@@ -1,6 +1,6 @@
import Vue from 'vue';
-import pdfjsLib from 'vendor/pdf';
-import workerSrc from 'vendor/pdf.worker.min';
+import pdfjsLib from 'pdfjs-dist/build/pdf';
+import workerSrc from 'pdfjs-dist/build/pdf.worker.min';
import PageComponent from '~/pdf/page/index.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
diff --git a/spec/javascripts/reports/components/modal_spec.js b/spec/javascripts/reports/components/modal_spec.js
index 6b8471381de..d42c509e5b5 100644
--- a/spec/javascripts/reports/components/modal_spec.js
+++ b/spec/javascripts/reports/components/modal_spec.js
@@ -2,7 +2,7 @@ import Vue from 'vue';
import component from '~/reports/components/modal.vue';
import state from '~/reports/store/state';
import mountComponent from '../../helpers/vue_mount_component_helper';
-import { trimText } from '../../helpers/vue_component_helper';
+import { trimText } from '../../helpers/text_helper';
describe('Grouped Test Reports Modal', () => {
const Component = Vue.extend(component);
diff --git a/spec/javascripts/reports/components/test_issue_body_spec.js b/spec/javascripts/reports/components/test_issue_body_spec.js
index 32baf904ad7..9c1cec4c9bc 100644
--- a/spec/javascripts/reports/components/test_issue_body_spec.js
+++ b/spec/javascripts/reports/components/test_issue_body_spec.js
@@ -2,7 +2,7 @@ import Vue from 'vue';
import component from '~/reports/components/test_issue_body.vue';
import createStore from '~/reports/store';
import { mountComponentWithStore } from '../../helpers/vue_mount_component_helper';
-import { trimText } from '../../helpers/vue_component_helper';
+import { trimText } from '../../helpers/text_helper';
import { issue } from '../mock_data/mock_data';
describe('Test Issue body', () => {
diff --git a/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_container_spec.js b/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_container_spec.js
index e5155573f6f..dfbc68c48b9 100644
--- a/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_container_spec.js
+++ b/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_container_spec.js
@@ -1,4 +1,4 @@
-import { shallowMount, createLocalVue } from '@vue/test-utils';
+import { mount, createLocalVue } from '@vue/test-utils';
import MrWidgetPipelineContainer from '~/vue_merge_request_widget/components/mr_widget_pipeline_container.vue';
import MrWidgetPipeline from '~/vue_merge_request_widget/components/mr_widget_pipeline.vue';
import { mockStore } from '../mock_data';
@@ -9,7 +9,7 @@ describe('MrWidgetPipelineContainer', () => {
const factory = (props = {}) => {
const localVue = createLocalVue();
- wrapper = shallowMount(localVue.extend(MrWidgetPipelineContainer), {
+ wrapper = mount(localVue.extend(MrWidgetPipelineContainer), {
propsData: {
mr: Object.assign({}, mockStore),
...props,
diff --git a/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js b/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js
index 8ac6e6a7b44..75017d20473 100644
--- a/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js
+++ b/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js
@@ -1,7 +1,7 @@
import Vue from 'vue';
import pipelineComponent from '~/vue_merge_request_widget/components/mr_widget_pipeline.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
-import { trimText } from 'spec/helpers/vue_component_helper';
+import { trimText } from 'spec/helpers/text_helper';
import mockData from '../mock_data';
describe('MRWidgetPipeline', () => {
diff --git a/spec/javascripts/vue_mr_widget/components/states/mr_widget_conflicts_spec.js b/spec/javascripts/vue_mr_widget/components/states/mr_widget_conflicts_spec.js
index 0ddbdf67d8b..39b879612ae 100644
--- a/spec/javascripts/vue_mr_widget/components/states/mr_widget_conflicts_spec.js
+++ b/spec/javascripts/vue_mr_widget/components/states/mr_widget_conflicts_spec.js
@@ -1,7 +1,7 @@
import $ from 'jquery';
import { createLocalVue, shallowMount } from '@vue/test-utils';
import ConflictsComponent from '~/vue_merge_request_widget/components/states/mr_widget_conflicts.vue';
-import { removeBreakLine } from 'spec/helpers/vue_component_helper';
+import { removeBreakLine } from 'spec/helpers/text_helper';
describe('MRWidgetConflicts', () => {
let vm;
diff --git a/spec/javascripts/vue_mr_widget/components/states/mr_widget_pipeline_blocked_spec.js b/spec/javascripts/vue_mr_widget/components/states/mr_widget_pipeline_blocked_spec.js
index 477041fa383..1d2f3e41509 100644
--- a/spec/javascripts/vue_mr_widget/components/states/mr_widget_pipeline_blocked_spec.js
+++ b/spec/javascripts/vue_mr_widget/components/states/mr_widget_pipeline_blocked_spec.js
@@ -1,7 +1,7 @@
import Vue from 'vue';
import pipelineBlockedComponent from '~/vue_merge_request_widget/components/states/mr_widget_pipeline_blocked.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
-import { removeBreakLine } from 'spec/helpers/vue_component_helper';
+import { removeBreakLine } from 'spec/helpers/text_helper';
describe('MRWidgetPipelineBlocked', () => {
let vm;
diff --git a/spec/javascripts/vue_mr_widget/components/states/mr_widget_pipeline_failed_spec.js b/spec/javascripts/vue_mr_widget/components/states/mr_widget_pipeline_failed_spec.js
index f7523a01963..3e4ce2c3696 100644
--- a/spec/javascripts/vue_mr_widget/components/states/mr_widget_pipeline_failed_spec.js
+++ b/spec/javascripts/vue_mr_widget/components/states/mr_widget_pipeline_failed_spec.js
@@ -1,6 +1,6 @@
import Vue from 'vue';
import PipelineFailed from '~/vue_merge_request_widget/components/states/pipeline_failed.vue';
-import { removeBreakLine } from 'spec/helpers/vue_component_helper';
+import { removeBreakLine } from 'spec/helpers/text_helper';
describe('PipelineFailed', () => {
describe('template', () => {
diff --git a/spec/javascripts/vue_mr_widget/components/states/mr_widget_sha_mismatch_spec.js b/spec/javascripts/vue_mr_widget/components/states/mr_widget_sha_mismatch_spec.js
index 36f8c7a9683..9324c83bf4b 100644
--- a/spec/javascripts/vue_mr_widget/components/states/mr_widget_sha_mismatch_spec.js
+++ b/spec/javascripts/vue_mr_widget/components/states/mr_widget_sha_mismatch_spec.js
@@ -1,7 +1,7 @@
import Vue from 'vue';
import ShaMismatch from '~/vue_merge_request_widget/components/states/sha_mismatch.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
-import { removeBreakLine } from 'spec/helpers/vue_component_helper';
+import { removeBreakLine } from 'spec/helpers/text_helper';
describe('ShaMismatch', () => {
let vm;
diff --git a/spec/javascripts/vue_mr_widget/mock_data.js b/spec/javascripts/vue_mr_widget/mock_data.js
index dda16375103..bec16b0aab0 100644
--- a/spec/javascripts/vue_mr_widget/mock_data.js
+++ b/spec/javascripts/vue_mr_widget/mock_data.js
@@ -235,11 +235,44 @@ export default {
troubleshooting_docs_path: 'help',
merge_request_pipelines_docs_path: '/help/ci/merge_request_pipelines/index.md',
squash: true,
+ visual_review_app_available: true,
};
export const mockStore = {
- pipeline: { id: 0 },
- mergePipeline: { id: 1 },
+ pipeline: {
+ id: 0,
+ details: {
+ status: {
+ details_path: '/root/review-app-tester/pipelines/66',
+ favicon:
+ '/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2. png',
+ group: 'success-with-warnings',
+ has_details: true,
+ icon: 'status_warning',
+ illustration: null,
+ label: 'passed with warnings',
+ text: 'passed',
+ tooltip: 'passed',
+ },
+ },
+ },
+ mergePipeline: {
+ id: 1,
+ details: {
+ status: {
+ details_path: '/root/review-app-tester/pipelines/66',
+ favicon:
+ '/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2. png',
+ group: 'success-with-warnings',
+ has_details: true,
+ icon: 'status_warning',
+ illustration: null,
+ label: 'passed with warnings',
+ text: 'passed',
+ tooltip: 'passed',
+ },
+ },
+ },
targetBranch: 'target-branch',
sourceBranch: 'source-branch',
sourceBranchLink: 'source-branch-link',
diff --git a/spec/javascripts/vue_shared/components/project_selector/project_list_item_spec.js b/spec/javascripts/vue_shared/components/project_selector/project_list_item_spec.js
index 268ced38f40..47964a1702a 100644
--- a/spec/javascripts/vue_shared/components/project_selector/project_list_item_spec.js
+++ b/spec/javascripts/vue_shared/components/project_selector/project_list_item_spec.js
@@ -1,6 +1,6 @@
import ProjectListItem from '~/vue_shared/components/project_selector/project_list_item.vue';
import { shallowMount, createLocalVue } from '@vue/test-utils';
-import { trimText } from 'spec/helpers/vue_component_helper';
+import { trimText } from 'spec/helpers/text_helper';
const localVue = createLocalVue();
diff --git a/spec/javascripts/vue_shared/components/project_selector/project_selector_spec.js b/spec/javascripts/vue_shared/components/project_selector/project_selector_spec.js
index 34c0cd435cd..7f5f1a778d7 100644
--- a/spec/javascripts/vue_shared/components/project_selector/project_selector_spec.js
+++ b/spec/javascripts/vue_shared/components/project_selector/project_selector_spec.js
@@ -3,7 +3,7 @@ import _ from 'underscore';
import ProjectSelector from '~/vue_shared/components/project_selector/project_selector.vue';
import ProjectListItem from '~/vue_shared/components/project_selector/project_list_item.vue';
import { shallowMount } from '@vue/test-utils';
-import { trimText } from 'spec/helpers/vue_component_helper';
+import { trimText } from 'spec/helpers/text_helper';
describe('ProjectSelector component', () => {
let wrapper;
@@ -99,7 +99,7 @@ describe('ProjectSelector component', () => {
expect(trimText(noResultsEl.text())).toEqual('Sorry, no projects matched your search');
});
- it(`shows a "minimum seach query" message if showMinimumSearchQueryMessage === true`, () => {
+ it(`shows a "minimum search query" message if showMinimumSearchQueryMessage === true`, () => {
wrapper.setProps({ showMinimumSearchQueryMessage: true });
expect(wrapper.contains('.js-minimum-search-query-message')).toBe(true);
diff --git a/spec/javascripts/vue_shared/translate_spec.js b/spec/javascripts/vue_shared/translate_spec.js
index adb5ff682f0..0aaa4050cba 100644
--- a/spec/javascripts/vue_shared/translate_spec.js
+++ b/spec/javascripts/vue_shared/translate_spec.js
@@ -3,7 +3,7 @@ import Jed from 'jed';
import locale from '~/locale';
import Translate from '~/vue_shared/translate';
-import { trimText } from 'spec/helpers/vue_component_helper';
+import { trimText } from 'spec/helpers/text_helper';
describe('Vue translate filter', () => {
let el;
diff --git a/spec/lib/banzai/filter/syntax_highlight_filter_spec.rb b/spec/lib/banzai/filter/syntax_highlight_filter_spec.rb
index 05057789cc1..80ca7a63435 100644
--- a/spec/lib/banzai/filter/syntax_highlight_filter_spec.rb
+++ b/spec/lib/banzai/filter/syntax_highlight_filter_spec.rb
@@ -80,7 +80,7 @@ describe Banzai::Filter::SyntaxHighlightFilter do
let(:lang) { 'suggestion' }
let(:lang_params) { '-1+10' }
- it "delimits on the first appearence" do
+ it "delimits on the first appearance" do
result = filter(%{<pre><code lang="#{lang}#{delimiter}#{lang_params}#{delimiter}more-things">This is a test</code></pre>})
expect(result.to_html).to eq(%{<pre class="code highlight js-syntax-highlight #{lang}" lang="#{lang}" #{data_attr}="#{lang_params}#{delimiter}more-things" v-pre="true"><code><span id="LC1" class="line" lang="#{lang}">This is a test</span></code></pre>})
diff --git a/spec/lib/gitlab/ci/cron_parser_spec.rb b/spec/lib/gitlab/ci/cron_parser_spec.rb
index 2a3f7807fdb..491e3fba9d9 100644
--- a/spec/lib/gitlab/ci/cron_parser_spec.rb
+++ b/spec/lib/gitlab/ci/cron_parser_spec.rb
@@ -174,6 +174,13 @@ describe Gitlab::Ci::CronParser do
it { expect(subject).to be_nil }
end
+
+ context 'when cron is scheduled to a non existent day' do
+ let(:cron) { '0 12 31 2 *' }
+ let(:cron_timezone) { 'UTC' }
+
+ it { expect(subject).to be_nil }
+ end
end
describe '#cron_valid?' do
diff --git a/spec/lib/gitlab/git/tree_spec.rb b/spec/lib/gitlab/git/tree_spec.rb
index 7ad3cde97f8..7e169cfe270 100644
--- a/spec/lib/gitlab/git/tree_spec.rb
+++ b/spec/lib/gitlab/git/tree_spec.rb
@@ -19,7 +19,9 @@ describe Gitlab::Git::Tree, :seed_helper do
it 'returns a list of tree objects' do
entries = described_class.where(repository, SeedRepo::Commit::ID, 'files', true)
- expect(entries.count).to be >= 5
+ expect(entries.map(&:path)).to include('files/html',
+ 'files/markdown/ruby-style-guide.md')
+ expect(entries.count).to be >= 10
expect(entries).to all(be_a(Gitlab::Git::Tree))
end
diff --git a/spec/lib/gitlab/import_export/members_mapper_spec.rb b/spec/lib/gitlab/import_export/members_mapper_spec.rb
index 67e4c289906..c663cf42a83 100644
--- a/spec/lib/gitlab/import_export/members_mapper_spec.rb
+++ b/spec/lib/gitlab/import_export/members_mapper_spec.rb
@@ -73,6 +73,13 @@ describe Gitlab::ImportExport::MembersMapper do
expect(user2.authorized_project?(project)).to be true
end
+ it 'maps an owner as a maintainer' do
+ exported_members.first['access_level'] = ProjectMember::OWNER
+
+ expect(members_mapper.map[exported_user_id]).to eq(user2.id)
+ expect(ProjectMember.find_by_user_id(user2.id).access_level).to eq(ProjectMember::MAINTAINER)
+ end
+
context 'user is not an admin' do
let(:user) { create(:user) }
diff --git a/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb b/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
index 6084dc96410..651aa600fb2 100644
--- a/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
+++ b/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
@@ -328,6 +328,19 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
end
context 'when the project has overridden params in import data' do
+ it 'handles string versions of visibility_level' do
+ # Project needs to be in a group for visibility level comparison
+ # to happen
+ group = create(:group)
+ project.group = group
+
+ project.create_import_data(data: { override_params: { visibility_level: Gitlab::VisibilityLevel::INTERNAL.to_s } })
+
+ restored_project_json
+
+ expect(project.visibility_level).to eq(Gitlab::VisibilityLevel::INTERNAL)
+ end
+
it 'overwrites the params stored in the JSON' do
project.create_import_data(data: { override_params: { description: "Overridden" } })
diff --git a/spec/lib/gitlab/import_export/project_tree_saver_spec.rb b/spec/lib/gitlab/import_export/project_tree_saver_spec.rb
index cfc3e0ce926..bc4f867e891 100644
--- a/spec/lib/gitlab/import_export/project_tree_saver_spec.rb
+++ b/spec/lib/gitlab/import_export/project_tree_saver_spec.rb
@@ -91,7 +91,10 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
end
it 'has issue comments' do
- expect(saved_project_json['issues'].first['notes']).not_to be_empty
+ notes = saved_project_json['issues'].first['notes']
+
+ expect(notes).not_to be_empty
+ expect(notes.first['type']).to eq('DiscussionNote')
end
it 'has issue assignees' do
@@ -299,7 +302,7 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
create(:commit_status, project: project, pipeline: ci_build.pipeline)
create(:milestone, project: project)
- create(:note, noteable: issue, project: project)
+ create(:discussion_note, noteable: issue, project: project)
create(:note, noteable: merge_request, project: project)
create(:note, noteable: snippet, project: project)
create(:note_on_commit,
diff --git a/spec/lib/gitlab/lets_encrypt/challenge_spec.rb b/spec/lib/gitlab/lets_encrypt/challenge_spec.rb
new file mode 100644
index 00000000000..74622f356de
--- /dev/null
+++ b/spec/lib/gitlab/lets_encrypt/challenge_spec.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe ::Gitlab::LetsEncrypt::Challenge do
+ delegated_methods = {
+ url: 'https://example.com/',
+ status: 'pending',
+ token: 'tokenvalue',
+ file_content: 'hereisfilecontent',
+ request_validation: true
+ }
+
+ let(:acme_challenge) do
+ acme_challenge = instance_double('Acme::Client::Resources::Challenge')
+ allow(acme_challenge).to receive_messages(delegated_methods)
+ acme_challenge
+ end
+
+ let(:challenge) { described_class.new(acme_challenge) }
+
+ delegated_methods.each do |method, value|
+ describe "##{method}" do
+ it 'delegates to Acme::Client::Resources::Challenge' do
+ expect(challenge.public_send(method)).to eq(value)
+ end
+ end
+ end
+end
diff --git a/spec/lib/gitlab/lets_encrypt/client_spec.rb b/spec/lib/gitlab/lets_encrypt/client_spec.rb
new file mode 100644
index 00000000000..16a16acfd25
--- /dev/null
+++ b/spec/lib/gitlab/lets_encrypt/client_spec.rb
@@ -0,0 +1,120 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe ::Gitlab::LetsEncrypt::Client do
+ include LetsEncryptHelpers
+
+ let(:client) { described_class.new }
+
+ before do
+ stub_application_setting(
+ lets_encrypt_notification_email: 'myemail@test.example.com',
+ lets_encrypt_terms_of_service_accepted: true
+ )
+ end
+
+ let!(:stub_client) { stub_lets_encrypt_client }
+
+ shared_examples 'ensures account registration' do
+ it 'ensures account registration' do
+ subject
+
+ expect(stub_client).to have_received(:new_account).with(
+ contact: 'mailto:myemail@test.example.com',
+ terms_of_service_agreed: true
+ )
+ end
+
+ context 'when acme integration is disabled' do
+ before do
+ stub_application_setting(lets_encrypt_terms_of_service_accepted: false)
+ end
+
+ it 'raises error' do
+ expect do
+ subject
+ end.to raise_error('Acme integration is disabled')
+ end
+ end
+ end
+
+ describe '#new_order' do
+ subject(:new_order) { client.new_order('example.com') }
+
+ before do
+ order_double = instance_double('Acme::Order')
+ allow(stub_client).to receive(:new_order).and_return(order_double)
+ end
+
+ include_examples 'ensures account registration'
+
+ it 'returns order' do
+ is_expected.to be_a(::Gitlab::LetsEncrypt::Order)
+ end
+ end
+
+ describe '#load_order' do
+ let(:url) { 'https://example.com/order' }
+ subject { client.load_order(url) }
+
+ before do
+ acme_order = instance_double('Acme::Client::Resources::Order')
+ allow(stub_client).to receive(:order).with(url: url).and_return(acme_order)
+ end
+
+ include_examples 'ensures account registration'
+
+ it 'loads order' do
+ is_expected.to be_a(::Gitlab::LetsEncrypt::Order)
+ end
+ end
+
+ describe '#load_challenge' do
+ let(:url) { 'https://example.com/challenge' }
+ subject { client.load_challenge(url) }
+
+ before do
+ acme_challenge = instance_double('Acme::Client::Resources::Challenge')
+ allow(stub_client).to receive(:challenge).with(url: url).and_return(acme_challenge)
+ end
+
+ include_examples 'ensures account registration'
+
+ it 'loads challenge' do
+ is_expected.to be_a(::Gitlab::LetsEncrypt::Challenge)
+ end
+ end
+
+ describe '#enabled?' do
+ subject { client.enabled? }
+
+ context 'when terms of service are accepted' do
+ it { is_expected.to eq(true) }
+
+ context 'when feature flag is disabled' do
+ before do
+ stub_feature_flags(pages_auto_ssl: false)
+ end
+
+ it { is_expected.to eq(false) }
+ end
+ end
+
+ context 'when terms of service are not accepted' do
+ before do
+ stub_application_setting(lets_encrypt_terms_of_service_accepted: false)
+ end
+
+ it { is_expected.to eq(false) }
+ end
+ end
+
+ describe '#terms_of_service_url' do
+ subject { client.terms_of_service_url }
+
+ it 'returns valid url' do
+ is_expected.to eq("https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf")
+ end
+ end
+end
diff --git a/spec/lib/gitlab/lets_encrypt/order_spec.rb b/spec/lib/gitlab/lets_encrypt/order_spec.rb
new file mode 100644
index 00000000000..ee7058baf8d
--- /dev/null
+++ b/spec/lib/gitlab/lets_encrypt/order_spec.rb
@@ -0,0 +1,39 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe ::Gitlab::LetsEncrypt::Order do
+ delegated_methods = {
+ url: 'https://example.com/',
+ status: 'valid'
+ }
+
+ let(:acme_order) do
+ acme_order = instance_double('Acme::Client::Resources::Order')
+ allow(acme_order).to receive_messages(delegated_methods)
+ acme_order
+ end
+
+ let(:order) { described_class.new(acme_order) }
+
+ delegated_methods.each do |method, value|
+ describe "##{method}" do
+ it 'delegates to Acme::Client::Resources::Order' do
+ expect(order.public_send(method)).to eq(value)
+ end
+ end
+ end
+
+ describe '#new_challenge' do
+ before do
+ challenge = instance_double('Acme::Client::Resources::Challenges::HTTP01')
+ authorization = instance_double('Acme::Client::Resources::Authorization')
+ allow(authorization).to receive(:http).and_return(challenge)
+ allow(acme_order).to receive(:authorizations).and_return([authorization])
+ end
+
+ it 'returns challenge' do
+ expect(order.new_challenge).to be_a(::Gitlab::LetsEncrypt::Challenge)
+ end
+ end
+end
diff --git a/spec/lib/gitlab/lfs_token_spec.rb b/spec/lib/gitlab/lfs_token_spec.rb
index 8961ecc4be0..701ed1f3a1b 100644
--- a/spec/lib/gitlab/lfs_token_spec.rb
+++ b/spec/lib/gitlab/lfs_token_spec.rb
@@ -77,96 +77,42 @@ describe Gitlab::LfsToken, :clean_gitlab_redis_shared_state do
let(:actor) { create(:user, username: 'test_user_lfs_1') }
let(:lfs_token) { described_class.new(actor) }
- context 'for an HMAC token' do
- before do
- # We're not interested in testing LegacyRedisDeviseToken here
- allow(Gitlab::LfsToken::LegacyRedisDeviseToken).to receive_message_chain(:new, :token_valid?).and_return(false)
- end
-
- context 'where the token is invalid' do
- context "because it's junk" do
- it 'returns false' do
- expect(lfs_token.token_valid?('junk')).to be_falsey
- end
- end
-
- context "because it's been fiddled with" do
- it 'returns false' do
- fiddled_token = lfs_token.token.tap { |token| token[0] = 'E' }
- expect(lfs_token.token_valid?(fiddled_token)).to be_falsey
- end
- end
-
- context "because it was generated with a different secret" do
- it 'returns false' do
- different_actor = create(:user, username: 'test_user_lfs_2')
- different_secret_token = described_class.new(different_actor).token
- expect(lfs_token.token_valid?(different_secret_token)).to be_falsey
- end
- end
-
- context "because it's expired" do
- it 'returns false' do
- expired_token = lfs_token.token
- # Needs to be at least 1860 seconds, because the default expiry is
- # 1800 seconds with an additional 60 second leeway.
- Timecop.freeze(Time.now + 1865) do
- expect(lfs_token.token_valid?(expired_token)).to be_falsey
- end
- end
+ context 'where the token is invalid' do
+ context "because it's junk" do
+ it 'returns false' do
+ expect(lfs_token.token_valid?('junk')).to be_falsey
end
end
- context 'where the token is valid' do
- it 'returns true' do
- expect(lfs_token.token_valid?(lfs_token.token)).to be_truthy
+ context "because it's been fiddled with" do
+ it 'returns false' do
+ fiddled_token = lfs_token.token.tap { |token| token[0] = 'E' }
+ expect(lfs_token.token_valid?(fiddled_token)).to be_falsey
end
end
- end
-
- context 'for a LegacyRedisDevise token' do
- before do
- # We're not interested in testing HMACToken here
- allow_any_instance_of(Gitlab::LfsToken::HMACToken).to receive(:token_valid?).and_return(false)
- end
-
- context 'where the token is invalid' do
- context "because it's junk" do
- it 'returns false' do
- expect(lfs_token.token_valid?('junk')).to be_falsey
- end
- end
- context "because it's been fiddled with" do
- it 'returns false' do
- generated_token = Gitlab::LfsToken::LegacyRedisDeviseToken.new(actor).store_new_token
- fiddled_token = generated_token.tap { |token| token[0] = 'E' }
- expect(lfs_token.token_valid?(fiddled_token)).to be_falsey
- end
- end
-
- context "because it was generated with a different secret" do
- it 'returns false' do
- different_actor = create(:user, username: 'test_user_lfs_2')
- different_secret_token = described_class.new(different_actor).token
- expect(lfs_token.token_valid?(different_secret_token)).to be_falsey
- end
+ context "because it was generated with a different secret" do
+ it 'returns false' do
+ different_actor = create(:user, username: 'test_user_lfs_2')
+ different_secret_token = described_class.new(different_actor).token
+ expect(lfs_token.token_valid?(different_secret_token)).to be_falsey
end
+ end
- context "because it's expired" do
- it 'returns false' do
- generated_token = Gitlab::LfsToken::LegacyRedisDeviseToken.new(actor).store_new_token(1)
- # We need a real sleep here because we need to wait for redis to expire the key.
- sleep(0.01)
- expect(lfs_token.token_valid?(generated_token)).to be_falsey
+ context "because it's expired" do
+ it 'returns false' do
+ expired_token = lfs_token.token
+ # Needs to be at least 1860 seconds, because the default expiry is
+ # 1800 seconds with an additional 60 second leeway.
+ Timecop.freeze(Time.now + 1865) do
+ expect(lfs_token.token_valid?(expired_token)).to be_falsey
end
end
end
context 'where the token is valid' do
it 'returns true' do
- generated_token = Gitlab::LfsToken::LegacyRedisDeviseToken.new(actor).store_new_token
- expect(lfs_token.token_valid?(generated_token)).to be_truthy
+ expect(lfs_token.token_valid?(lfs_token.token)).to be_truthy
end
end
end
diff --git a/spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb b/spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
index aaf8c9fa2a0..7972ff253fe 100644
--- a/spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
+++ b/spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
@@ -10,20 +10,17 @@ describe Gitlab::Metrics::Samplers::RubySampler do
describe '#sample' do
it 'samples various statistics' do
- expect(Gitlab::Metrics::System).to receive(:cpu_time)
- expect(Gitlab::Metrics::System).to receive(:file_descriptor_count)
expect(Gitlab::Metrics::System).to receive(:memory_usage)
- expect(Gitlab::Metrics::System).to receive(:process_start_time)
- expect(Gitlab::Metrics::System).to receive(:max_open_file_descriptors)
+ expect(Gitlab::Metrics::System).to receive(:file_descriptor_count)
expect(sampler).to receive(:sample_gc)
sampler.sample
end
- it 'adds a metric containing the process resident memory bytes' do
+ it 'adds a metric containing the memory usage' do
expect(Gitlab::Metrics::System).to receive(:memory_usage).and_return(9000)
- expect(sampler.metrics[:process_resident_memory_bytes]).to receive(:set).with({}, 9000)
+ expect(sampler.metrics[:memory_usage]).to receive(:set).with({}, 9000)
sampler.sample
end
@@ -37,27 +34,6 @@ describe Gitlab::Metrics::Samplers::RubySampler do
sampler.sample
end
- it 'adds a metric containing the process total cpu time' do
- expect(Gitlab::Metrics::System).to receive(:cpu_time).and_return(0.51)
- expect(sampler.metrics[:process_cpu_seconds_total]).to receive(:set).with({}, 0.51)
-
- sampler.sample
- end
-
- it 'adds a metric containing the process start time' do
- expect(Gitlab::Metrics::System).to receive(:process_start_time).and_return(12345)
- expect(sampler.metrics[:process_start_time_seconds]).to receive(:set).with({}, 12345)
-
- sampler.sample
- end
-
- it 'adds a metric containing the process max file descriptors' do
- expect(Gitlab::Metrics::System).to receive(:max_open_file_descriptors).and_return(1024)
- expect(sampler.metrics[:process_max_fds]).to receive(:set).with({}, 1024)
-
- sampler.sample
- end
-
it 'clears any GC profiles' do
expect(GC::Profiler).to receive(:clear)
diff --git a/spec/lib/gitlab/metrics/samplers/unicorn_sampler_spec.rb b/spec/lib/gitlab/metrics/samplers/unicorn_sampler_spec.rb
index 090e456644f..4b03f3c2532 100644
--- a/spec/lib/gitlab/metrics/samplers/unicorn_sampler_spec.rb
+++ b/spec/lib/gitlab/metrics/samplers/unicorn_sampler_spec.rb
@@ -39,8 +39,8 @@ describe Gitlab::Metrics::Samplers::UnicornSampler do
it 'updates metrics type unix and with addr' do
labels = { socket_type: 'unix', socket_address: socket_address }
- expect(subject.metrics[:unicorn_active_connections]).to receive(:set).with(labels, 'active')
- expect(subject.metrics[:unicorn_queued_connections]).to receive(:set).with(labels, 'queued')
+ expect(subject).to receive_message_chain(:unicorn_active_connections, :set).with(labels, 'active')
+ expect(subject).to receive_message_chain(:unicorn_queued_connections, :set).with(labels, 'queued')
subject.sample
end
@@ -50,6 +50,7 @@ describe Gitlab::Metrics::Samplers::UnicornSampler do
context 'unicorn listens on tcp sockets' do
let(:tcp_socket_address) { '0.0.0.0:8080' }
let(:tcp_sockets) { [tcp_socket_address] }
+
before do
allow(unicorn).to receive(:listener_names).and_return(tcp_sockets)
end
@@ -70,29 +71,13 @@ describe Gitlab::Metrics::Samplers::UnicornSampler do
it 'updates metrics type unix and with addr' do
labels = { socket_type: 'tcp', socket_address: tcp_socket_address }
- expect(subject.metrics[:unicorn_active_connections]).to receive(:set).with(labels, 'active')
- expect(subject.metrics[:unicorn_queued_connections]).to receive(:set).with(labels, 'queued')
+ expect(subject).to receive_message_chain(:unicorn_active_connections, :set).with(labels, 'active')
+ expect(subject).to receive_message_chain(:unicorn_queued_connections, :set).with(labels, 'queued')
subject.sample
end
end
end
-
- context 'additional metrics' do
- let(:unicorn_workers) { 2 }
-
- before do
- allow(unicorn).to receive(:listener_names).and_return([""])
- allow(::Gitlab::Metrics::System).to receive(:cpu_time).and_return(3.14)
- allow(subject).to receive(:unicorn_workers_count).and_return(unicorn_workers)
- end
-
- it "sets additional metrics" do
- expect(subject.metrics[:unicorn_workers]).to receive(:set).with({}, unicorn_workers)
-
- subject.sample
- end
- end
end
describe '#start' do
diff --git a/spec/lib/gitlab/metrics/system_spec.rb b/spec/lib/gitlab/metrics/system_spec.rb
index b0603d96eb2..14afcdf5daa 100644
--- a/spec/lib/gitlab/metrics/system_spec.rb
+++ b/spec/lib/gitlab/metrics/system_spec.rb
@@ -13,18 +13,6 @@ describe Gitlab::Metrics::System do
expect(described_class.file_descriptor_count).to be > 0
end
end
-
- describe '.max_open_file_descriptors' do
- it 'returns the max allowed open file descriptors' do
- expect(described_class.max_open_file_descriptors).to be > 0
- end
- end
-
- describe '.process_start_time' do
- it 'returns the process start time' do
- expect(described_class.process_start_time).to be > 0
- end
- end
else
describe '.memory_usage' do
it 'returns 0.0' do
@@ -37,18 +25,6 @@ describe Gitlab::Metrics::System do
expect(described_class.file_descriptor_count).to eq(0)
end
end
-
- describe '.max_open_file_descriptors' do
- it 'returns 0' do
- expect(described_class.max_open_file_descriptors).to eq(0)
- end
- end
-
- describe 'process_start_time' do
- it 'returns 0' do
- expect(described_class.process_start_time).to eq(0)
- end
- end
end
describe '.cpu_time' do
diff --git a/spec/lib/gitlab/prometheus/query_variables_spec.rb b/spec/lib/gitlab/prometheus/query_variables_spec.rb
index 048f4af6020..6dc99ef26ec 100644
--- a/spec/lib/gitlab/prometheus/query_variables_spec.rb
+++ b/spec/lib/gitlab/prometheus/query_variables_spec.rb
@@ -23,7 +23,7 @@ describe Gitlab::Prometheus::QueryVariables do
context 'with deployment platform' do
context 'with project cluster' do
- let(:kube_namespace) { environment.deployment_platform.actual_namespace }
+ let(:kube_namespace) { environment.deployment_platform.cluster.kubernetes_namespace_for(project) }
before do
create(:cluster, :project, :provided_by_user, projects: [project])
diff --git a/spec/lib/gitlab/sentry_spec.rb b/spec/lib/gitlab/sentry_spec.rb
index ae522a588ee..af8b059b984 100644
--- a/spec/lib/gitlab/sentry_spec.rb
+++ b/spec/lib/gitlab/sentry_spec.rb
@@ -2,12 +2,15 @@ require 'spec_helper'
describe Gitlab::Sentry do
describe '.context' do
- it 'adds the locale to the tags' do
+ it 'adds the expected tags' do
expect(described_class).to receive(:enabled?).and_return(true)
+ allow(Labkit::Correlation::CorrelationId).to receive(:current_id).and_return('cid')
described_class.context(nil)
expect(Raven.tags_context[:locale].to_s).to eq(I18n.locale.to_s)
+ expect(Raven.tags_context[Labkit::Correlation::CorrelationId::LOG_KEY.to_sym].to_s)
+ .to eq('cid')
end
end
diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb
index aa975c8bb0b..e44463dd767 100644
--- a/spec/lib/gitlab/usage_data_spec.rb
+++ b/spec/lib/gitlab/usage_data_spec.rb
@@ -63,12 +63,7 @@ describe Gitlab::UsageData do
end
it "gathers usage counts" do
- count_data = subject[:counts]
-
- expect(count_data[:boards]).to eq(1)
- expect(count_data[:projects]).to eq(3)
-
- expect(count_data.keys).to include(*%i(
+ expected_keys = %i(
assignee_lists
boards
ci_builds
@@ -112,6 +107,7 @@ describe Gitlab::UsageData do
milestone_lists
milestones
notes
+ pool_repositories
projects
projects_imported_from_github
projects_jira_active
@@ -132,7 +128,14 @@ describe Gitlab::UsageData do
uploads
web_hooks
user_preferences
- ))
+ )
+
+ count_data = subject[:counts]
+
+ expect(count_data[:boards]).to eq(1)
+ expect(count_data[:projects]).to eq(3)
+ expect(count_data.keys).to include(*expected_keys)
+ expect(expected_keys - count_data.keys).to be_empty
end
it 'does not gather user preferences usage data when the feature is disabled' do
@@ -211,7 +214,7 @@ describe Gitlab::UsageData do
it "gathers license data" do
expect(subject[:uuid]).to eq(Gitlab::CurrentSettings.uuid)
expect(subject[:version]).to eq(Gitlab::VERSION)
- expect(subject[:installation_type]).to eq(Gitlab::INSTALLATION_TYPE)
+ expect(subject[:installation_type]).to eq('gitlab-development-kit')
expect(subject[:active_user_count]).to eq(User.active.count)
expect(subject[:recorded_at]).to be_a(Time)
end
diff --git a/spec/models/active_session_spec.rb b/spec/models/active_session_spec.rb
index b523f393ece..2762eaeccd3 100644
--- a/spec/models/active_session_spec.rb
+++ b/spec/models/active_session_spec.rb
@@ -88,6 +88,52 @@ RSpec.describe ActiveSession, :clean_gitlab_redis_shared_state do
end
end
+ describe '.list_sessions' do
+ it 'uses the ActiveSession lookup to return original sessions' do
+ Gitlab::Redis::SharedState.with do |redis|
+ redis.set("session:gitlab:6919a6f1bb119dd7396fadc38fd18d0d", Marshal.dump({ _csrf_token: 'abcd' }))
+
+ redis.sadd(
+ "session:lookup:user:gitlab:#{user.id}",
+ %w[
+ 6919a6f1bb119dd7396fadc38fd18d0d
+ 59822c7d9fcdfa03725eff41782ad97d
+ ]
+ )
+ end
+
+ expect(ActiveSession.list_sessions(user)).to eq [{ _csrf_token: 'abcd' }]
+ end
+ end
+
+ describe '.session_ids_for_user' do
+ it 'uses the user lookup table to return session ids' do
+ session_ids = ['59822c7d9fcdfa03725eff41782ad97d']
+
+ Gitlab::Redis::SharedState.with do |redis|
+ redis.sadd("session:lookup:user:gitlab:#{user.id}", session_ids)
+ end
+
+ expect(ActiveSession.session_ids_for_user(user)).to eq(session_ids)
+ end
+ end
+
+ describe '.sessions_from_ids' do
+ it 'uses the ActiveSession lookup to return original sessions' do
+ Gitlab::Redis::SharedState.with do |redis|
+ redis.set("session:gitlab:6919a6f1bb119dd7396fadc38fd18d0d", Marshal.dump({ _csrf_token: 'abcd' }))
+ end
+
+ expect(ActiveSession.sessions_from_ids(['6919a6f1bb119dd7396fadc38fd18d0d'])).to eq [{ _csrf_token: 'abcd' }]
+ end
+
+ it 'avoids a redis lookup for an empty array' do
+ expect(Gitlab::Redis::SharedState).not_to receive(:with)
+
+ expect(ActiveSession.sessions_from_ids([])).to eq([])
+ end
+ end
+
describe '.set' do
it 'sets a new redis entry for the user session and a lookup entry' do
ActiveSession.set(user, request)
diff --git a/spec/models/application_record_spec.rb b/spec/models/application_record_spec.rb
index cc90a998d3f..74573d0941c 100644
--- a/spec/models/application_record_spec.rb
+++ b/spec/models/application_record_spec.rb
@@ -52,4 +52,10 @@ describe ApplicationRecord do
expect { Suggestion.find_or_create_by!(note: nil) }.to raise_error(ActiveRecord::RecordInvalid)
end
end
+
+ describe '.underscore' do
+ it 'returns the underscored value of the class as a string' do
+ expect(MergeRequest.underscore).to eq('merge_request')
+ end
+ end
end
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index 9b489baf163..5f2e8aa0baa 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -2925,26 +2925,18 @@ describe Ci::Build do
subject { build.any_unmet_prerequisites? }
+ before do
+ allow(build).to receive(:prerequisites).and_return(prerequisites)
+ end
+
context 'build has prerequisites' do
- before do
- allow(build).to receive(:prerequisites).and_return([double])
- end
+ let(:prerequisites) { [double] }
it { is_expected.to be_truthy }
-
- context 'and the ci_preparing_state feature is disabled' do
- before do
- stub_feature_flags(ci_preparing_state: false)
- end
-
- it { is_expected.to be_falsey }
- end
end
context 'build does not have prerequisites' do
- before do
- allow(build).to receive(:prerequisites).and_return([])
- end
+ let(:prerequisites) { [] }
it { is_expected.to be_falsey }
end
diff --git a/spec/models/ci/pipeline_schedule_spec.rb b/spec/models/ci/pipeline_schedule_spec.rb
index 1bfc14d2839..42d4769a921 100644
--- a/spec/models/ci/pipeline_schedule_spec.rb
+++ b/spec/models/ci/pipeline_schedule_spec.rb
@@ -3,6 +3,8 @@
require 'spec_helper'
describe Ci::PipelineSchedule do
+ subject { build(:ci_pipeline_schedule) }
+
it { is_expected.to belong_to(:project) }
it { is_expected.to belong_to(:owner) }
diff --git a/spec/models/clusters/cluster_spec.rb b/spec/models/clusters/cluster_spec.rb
index 58203da5b22..3ee8c340bfe 100644
--- a/spec/models/clusters/cluster_spec.rb
+++ b/spec/models/clusters/cluster_spec.rb
@@ -5,6 +5,8 @@ require 'spec_helper'
describe Clusters::Cluster do
it_behaves_like 'having unique enum values'
+ subject { build(:cluster) }
+
it { is_expected.to belong_to(:user) }
it { is_expected.to have_many(:cluster_projects) }
it { is_expected.to have_many(:projects) }
@@ -17,7 +19,6 @@ describe Clusters::Cluster do
it { is_expected.to have_one(:application_prometheus) }
it { is_expected.to have_one(:application_runner) }
it { is_expected.to have_many(:kubernetes_namespaces) }
- it { is_expected.to have_one(:kubernetes_namespace) }
it { is_expected.to have_one(:cluster_project) }
it { is_expected.to delegate_method(:status).to(:provider) }
diff --git a/spec/models/clusters/platforms/kubernetes_spec.rb b/spec/models/clusters/platforms/kubernetes_spec.rb
index e35d14f2282..c485850c16e 100644
--- a/spec/models/clusters/platforms/kubernetes_spec.rb
+++ b/spec/models/clusters/platforms/kubernetes_spec.rb
@@ -15,10 +15,8 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
it { is_expected.to validate_presence_of(:api_url) }
it { is_expected.to validate_presence_of(:token) }
- it { is_expected.to delegate_method(:project).to(:cluster) }
it { is_expected.to delegate_method(:enabled?).to(:cluster) }
it { is_expected.to delegate_method(:provided_by_user?).to(:cluster) }
- it { is_expected.to delegate_method(:kubernetes_namespace).to(:cluster) }
it_behaves_like 'having unique enum values'
@@ -209,7 +207,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
it { is_expected.to be_truthy }
end
- describe '#actual_namespace' do
+ describe '#kubernetes_namespace_for' do
let(:cluster) { create(:cluster, :project) }
let(:project) { cluster.project }
@@ -219,7 +217,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
namespace: namespace)
end
- subject { platform.actual_namespace }
+ subject { platform.kubernetes_namespace_for(project) }
context 'with a namespace assigned' do
let(:namespace) { 'namespace-123' }
@@ -305,8 +303,6 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
end
context 'no namespace provided' do
- let(:namespace) { kubernetes.actual_namespace }
-
it_behaves_like 'setting variables'
it 'sets KUBE_TOKEN' do
@@ -389,7 +385,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
end
context 'with valid pods' do
- let(:pod) { kube_pod(environment_slug: environment.slug, project_slug: project.full_path_slug) }
+ let(:pod) { kube_pod(environment_slug: environment.slug, namespace: cluster.kubernetes_namespace_for(project), project_slug: project.full_path_slug) }
let(:pod_with_no_terminal) { kube_pod(environment_slug: environment.slug, project_slug: project.full_path_slug, status: "Pending") }
let(:terminals) { kube_terminals(service, pod) }
@@ -419,6 +415,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
let!(:cluster) { create(:cluster, :project, enabled: enabled, platform_kubernetes: service) }
let(:service) { create(:cluster_platform_kubernetes, :configured) }
let(:enabled) { true }
+ let(:namespace) { cluster.kubernetes_namespace_for(cluster.project) }
context 'when cluster is disabled' do
let(:enabled) { false }
@@ -428,8 +425,8 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
context 'when kubernetes responds with valid pods and deployments' do
before do
- stub_kubeclient_pods
- stub_kubeclient_deployments
+ stub_kubeclient_pods(namespace)
+ stub_kubeclient_deployments(namespace)
end
it { is_expected.to include(pods: [kube_pod]) }
@@ -437,8 +434,8 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
context 'when kubernetes responds with 500s' do
before do
- stub_kubeclient_pods(status: 500)
- stub_kubeclient_deployments(status: 500)
+ stub_kubeclient_pods(namespace, status: 500)
+ stub_kubeclient_deployments(namespace, status: 500)
end
it { expect { subject }.to raise_error(Kubeclient::HttpError) }
@@ -446,12 +443,18 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
context 'when kubernetes responds with 404s' do
before do
- stub_kubeclient_pods(status: 404)
- stub_kubeclient_deployments(status: 404)
+ stub_kubeclient_pods(namespace, status: 404)
+ stub_kubeclient_deployments(namespace, status: 404)
end
it { is_expected.to include(pods: []) }
end
+
+ context 'when the cluster is not project level' do
+ let(:cluster) { create(:cluster, :group, platform_kubernetes: service) }
+
+ it { is_expected.to include(pods: []) }
+ end
end
describe '#update_kubernetes_namespace' do
diff --git a/spec/models/clusters/project_spec.rb b/spec/models/clusters/project_spec.rb
index 2f017e69251..671af085d10 100644
--- a/spec/models/clusters/project_spec.rb
+++ b/spec/models/clusters/project_spec.rb
@@ -6,5 +6,4 @@ describe Clusters::Project do
it { is_expected.to belong_to(:cluster) }
it { is_expected.to belong_to(:project) }
it { is_expected.to have_many(:kubernetes_namespaces) }
- it { is_expected.to have_one(:kubernetes_namespace) }
end
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb
index f51322e1404..1dceef3fc00 100644
--- a/spec/models/deployment_spec.rb
+++ b/spec/models/deployment_spec.rb
@@ -5,8 +5,8 @@ require 'spec_helper'
describe Deployment do
subject { build(:deployment) }
- it { is_expected.to belong_to(:project) }
- it { is_expected.to belong_to(:environment) }
+ it { is_expected.to belong_to(:project).required }
+ it { is_expected.to belong_to(:environment).required }
it { is_expected.to belong_to(:user) }
it { is_expected.to belong_to(:deployable) }
diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb
index cfe7c7ef0b0..7233d2454c6 100644
--- a/spec/models/environment_spec.rb
+++ b/spec/models/environment_spec.rb
@@ -6,7 +6,7 @@ describe Environment do
let(:project) { create(:project, :stubbed_repository) }
subject(:environment) { create(:environment, project: project) }
- it { is_expected.to belong_to(:project) }
+ it { is_expected.to belong_to(:project).required }
it { is_expected.to have_many(:deployments) }
it { is_expected.to delegate_method(:stop_action).to(:last_deployment) }
@@ -592,9 +592,7 @@ describe Environment do
shared_examples 'same behavior between KubernetesService and Platform::Kubernetes' do
it 'returns the terminals from the deployment service' do
- deployment_platform_target = Gitlab.ee? ? environment : project
-
- expect(deployment_platform_target.deployment_platform)
+ expect(environment.deployment_platform)
.to receive(:terminals).with(environment)
.and_return(:fake_terminals)
diff --git a/spec/models/project_services/kubernetes_service_spec.rb b/spec/models/project_services/kubernetes_service_spec.rb
index 3a381cb405d..2fce120381b 100644
--- a/spec/models/project_services/kubernetes_service_spec.rb
+++ b/spec/models/project_services/kubernetes_service_spec.rb
@@ -161,8 +161,8 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do
end
end
- describe '#actual_namespace' do
- subject { service.actual_namespace }
+ describe '#kubernetes_namespace_for' do
+ subject { service.kubernetes_namespace_for(project) }
shared_examples 'a correctly formatted namespace' do
it 'returns a valid Kubernetes namespace name' do
@@ -298,7 +298,7 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do
end
context 'no namespace provided' do
- let(:namespace) { subject.actual_namespace }
+ let(:namespace) { subject.kubernetes_namespace_for(project) }
it_behaves_like 'setting variables'
@@ -325,7 +325,7 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do
end
context 'with valid pods' do
- let(:pod) { kube_pod(environment_slug: environment.slug, project_slug: project.full_path_slug) }
+ let(:pod) { kube_pod(environment_slug: environment.slug, namespace: service.kubernetes_namespace_for(project), project_slug: project.full_path_slug) }
let(:pod_with_no_terminal) { kube_pod(environment_slug: environment.slug, project_slug: project.full_path_slug, status: "Pending") }
let(:terminals) { kube_terminals(service, pod) }
@@ -352,6 +352,8 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do
describe '#calculate_reactive_cache' do
subject { service.calculate_reactive_cache }
+ let(:namespace) { service.kubernetes_namespace_for(project) }
+
context 'when service is inactive' do
before do
service.active = false
@@ -362,8 +364,8 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do
context 'when kubernetes responds with valid pods' do
before do
- stub_kubeclient_pods
- stub_kubeclient_deployments # Used by EE
+ stub_kubeclient_pods(namespace)
+ stub_kubeclient_deployments(namespace) # Used by EE
end
it { is_expected.to include(pods: [kube_pod]) }
@@ -371,8 +373,8 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do
context 'when kubernetes responds with 500s' do
before do
- stub_kubeclient_pods(status: 500)
- stub_kubeclient_deployments(status: 500) # Used by EE
+ stub_kubeclient_pods(namespace, status: 500)
+ stub_kubeclient_deployments(namespace, status: 500) # Used by EE
end
it { expect { subject }.to raise_error(Kubeclient::HttpError) }
@@ -380,8 +382,8 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do
context 'when kubernetes responds with 404s' do
before do
- stub_kubeclient_pods(status: 404)
- stub_kubeclient_deployments(status: 404) # Used by EE
+ stub_kubeclient_pods(namespace, status: 404)
+ stub_kubeclient_deployments(namespace, status: 404) # Used by EE
end
it { is_expected.to include(pods: []) }
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index 9ff0f355fd4..c5ab7e57272 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -2286,12 +2286,45 @@ describe Repository do
end
describe '#diverging_commit_counts' do
+ let(:diverged_branch) { repository.find_branch('fix') }
+ let(:root_ref_sha) { repository.raw_repository.commit(repository.root_ref).id }
+ let(:diverged_branch_sha) { diverged_branch.dereferenced_target.sha }
+
it 'returns the commit counts behind and ahead of default branch' do
- result = repository.diverging_commit_counts(
- repository.find_branch('fix'))
+ result = repository.diverging_commit_counts(diverged_branch)
expect(result).to eq(behind: 29, ahead: 2)
end
+
+ context 'when gitaly_count_diverging_commits_no_max is enabled' do
+ before do
+ stub_feature_flags(gitaly_count_diverging_commits_no_max: true)
+ end
+
+ it 'calls diverging_commit_count without max count' do
+ expect(repository.raw_repository)
+ .to receive(:diverging_commit_count)
+ .with(root_ref_sha, diverged_branch_sha)
+ .and_return([29, 2])
+
+ repository.diverging_commit_counts(diverged_branch)
+ end
+ end
+
+ context 'when gitaly_count_diverging_commits_no_max is disabled' do
+ before do
+ stub_feature_flags(gitaly_count_diverging_commits_no_max: false)
+ end
+
+ it 'calls diverging_commit_count with max count' do
+ expect(repository.raw_repository)
+ .to receive(:diverging_commit_count)
+ .with(root_ref_sha, diverged_branch_sha, max_count: Repository::MAX_DIVERGING_COUNT)
+ .and_return([29, 2])
+
+ repository.diverging_commit_counts(diverged_branch)
+ end
+ end
end
describe '#refresh_method_caches' do
diff --git a/spec/presenters/merge_request_presenter_spec.rb b/spec/presenters/merge_request_presenter_spec.rb
index 451dc88880c..0e1aed42cc5 100644
--- a/spec/presenters/merge_request_presenter_spec.rb
+++ b/spec/presenters/merge_request_presenter_spec.rb
@@ -403,7 +403,7 @@ describe MergeRequestPresenter do
allow(resource).to receive(:source_branch_exists?) { true }
is_expected
- .to eq("/#{resource.source_project.full_path}/branches/#{resource.source_branch}")
+ .to eq("/#{resource.source_project.full_path}/-/branches/#{resource.source_branch}")
end
end
@@ -426,7 +426,7 @@ describe MergeRequestPresenter do
allow(resource).to receive(:target_branch_exists?) { true }
is_expected
- .to eq("/#{resource.source_project.full_path}/branches/#{resource.target_branch}")
+ .to eq("/#{resource.source_project.full_path}/-/branches/#{resource.target_branch}")
end
end
diff --git a/spec/requests/api/discussions_spec.rb b/spec/requests/api/discussions_spec.rb
index 16036297ec7..ca1ffe3c524 100644
--- a/spec/requests/api/discussions_spec.rb
+++ b/spec/requests/api/discussions_spec.rb
@@ -13,7 +13,7 @@ describe API::Discussions do
let!(:issue) { create(:issue, project: project, author: user) }
let!(:issue_note) { create(:discussion_note_on_issue, noteable: issue, project: project, author: user) }
- it_behaves_like 'discussions API', 'projects', 'issues', 'iid', can_reply_to_invididual_notes: true do
+ it_behaves_like 'discussions API', 'projects', 'issues', 'iid', can_reply_to_individual_notes: true do
let(:parent) { project }
let(:noteable) { issue }
let(:note) { issue_note }
@@ -37,7 +37,7 @@ describe API::Discussions do
let!(:diff_note) { create(:diff_note_on_merge_request, noteable: noteable, project: project, author: user) }
let(:parent) { project }
- it_behaves_like 'discussions API', 'projects', 'merge_requests', 'iid', can_reply_to_invididual_notes: true
+ it_behaves_like 'discussions API', 'projects', 'merge_requests', 'iid', can_reply_to_individual_notes: true
it_behaves_like 'diff discussions API', 'projects', 'merge_requests', 'iid'
it_behaves_like 'resolvable discussions API', 'projects', 'merge_requests', 'iid'
end
diff --git a/spec/requests/api/graphql/project/repository_spec.rb b/spec/requests/api/graphql/project/repository_spec.rb
new file mode 100644
index 00000000000..67af612a4a0
--- /dev/null
+++ b/spec/requests/api/graphql/project/repository_spec.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+require 'spec_helper'
+
+describe 'getting a repository in a project' do
+ include GraphqlHelpers
+
+ let(:project) { create(:project, :repository) }
+ let(:current_user) { project.owner }
+ let(:fields) do
+ <<~QUERY
+ #{all_graphql_fields_for('repository'.classify)}
+ QUERY
+ end
+ let(:query) do
+ graphql_query_for(
+ 'project',
+ { 'fullPath' => project.full_path },
+ query_graphql_field('repository', {}, fields)
+ )
+ end
+
+ it 'returns repository' do
+ post_graphql(query, current_user: current_user)
+
+ expect(graphql_data['project']['repository']).to be_present
+ end
+
+ context 'as a non-authorized user' do
+ let(:current_user) { create(:user) }
+
+ it 'returns nil' do
+ post_graphql(query, current_user: current_user)
+
+ expect(graphql_data['project']).to be(nil)
+ end
+ end
+end
diff --git a/spec/requests/api/graphql/project/tree/tree_spec.rb b/spec/requests/api/graphql/project/tree/tree_spec.rb
new file mode 100644
index 00000000000..b07aa1e12d3
--- /dev/null
+++ b/spec/requests/api/graphql/project/tree/tree_spec.rb
@@ -0,0 +1,73 @@
+# frozen_string_literal: true
+require 'spec_helper'
+
+describe 'getting a tree in a project' do
+ include GraphqlHelpers
+
+ let(:project) { create(:project, :repository) }
+ let(:current_user) { project.owner }
+ let(:path) { "" }
+ let(:ref) { "master" }
+ let(:fields) do
+ <<~QUERY
+ tree(path:"#{path}", ref:"#{ref}") {
+ #{all_graphql_fields_for('tree'.classify)}
+ }
+ QUERY
+ end
+ let(:query) do
+ graphql_query_for(
+ 'project',
+ { 'fullPath' => project.full_path },
+ query_graphql_field('repository', {}, fields)
+ )
+ end
+
+ context 'when path does not exist' do
+ let(:path) { "testing123" }
+
+ it 'returns empty tree' do
+ post_graphql(query, current_user: current_user)
+
+ expect(graphql_data['project']['repository']['tree']['trees']['edges']).to eq([])
+ expect(graphql_data['project']['repository']['tree']['submodules']['edges']).to eq([])
+ expect(graphql_data['project']['repository']['tree']['blobs']['edges']).to eq([])
+ end
+ end
+
+ context 'when ref does not exist' do
+ let(:ref) { "testing123" }
+
+ it 'returns empty tree' do
+ post_graphql(query, current_user: current_user)
+
+ expect(graphql_data['project']['repository']['tree']['trees']['edges']).to eq([])
+ expect(graphql_data['project']['repository']['tree']['submodules']['edges']).to eq([])
+ expect(graphql_data['project']['repository']['tree']['blobs']['edges']).to eq([])
+ end
+ end
+
+ context 'when ref and path exist' do
+ it 'returns tree' do
+ post_graphql(query, current_user: current_user)
+
+ expect(graphql_data['project']['repository']['tree']).to be_present
+ end
+
+ it 'returns blobs, subtrees and submodules inside tree' do
+ post_graphql(query, current_user: current_user)
+
+ expect(graphql_data['project']['repository']['tree']['trees']['edges'].size).to be > 0
+ expect(graphql_data['project']['repository']['tree']['blobs']['edges'].size).to be > 0
+ expect(graphql_data['project']['repository']['tree']['submodules']['edges'].size).to be > 0
+ end
+ end
+
+ context 'when current user is nil' do
+ it 'returns empty project' do
+ post_graphql(query, current_user: nil)
+
+ expect(graphql_data['project']).to be(nil)
+ end
+ end
+end
diff --git a/spec/requests/api/helpers_spec.rb b/spec/requests/api/helpers_spec.rb
index 25a312cb734..ed907841bd8 100644
--- a/spec/requests/api/helpers_spec.rb
+++ b/spec/requests/api/helpers_spec.rb
@@ -247,9 +247,8 @@ describe API::Helpers do
exception = RuntimeError.new('test error')
allow(exception).to receive(:backtrace).and_return(caller)
- expect(Raven).to receive(:capture_exception).with(exception, tags: {
- correlation_id: 'new-correlation-id'
- }, extra: {})
+ expect(Raven).to receive(:capture_exception).with(exception, tags:
+ a_hash_including(correlation_id: 'new-correlation-id'), extra: {})
Labkit::Correlation::CorrelationId.use_id('new-correlation-id') do
handle_api_exception(exception)
diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb
index bae0302f3ff..fcbff19bd61 100644
--- a/spec/requests/api/internal_spec.rb
+++ b/spec/requests/api/internal_spec.rb
@@ -997,18 +997,6 @@ describe API::Internal do
expect(json_response['warnings']).to eq('Error encountered with push options \'merge_request.create\': my error')
end
-
- context 'when the feature is disabled' do
- it 'does not invoke MergeRequests::PushOptionsHandlerService' do
- stub_feature_flags(mr_push_options: false)
-
- expect(MergeRequests::PushOptionsHandlerService).not_to receive(:new)
-
- expect do
- post api('/internal/post_receive'), params: valid_params
- end.not_to change { MergeRequest.count }
- end
- end
end
context 'broadcast message exists' do
diff --git a/spec/requests/api/issues/get_group_issues_spec.rb b/spec/requests/api/issues/get_group_issues_spec.rb
new file mode 100644
index 00000000000..8b02cf56e9f
--- /dev/null
+++ b/spec/requests/api/issues/get_group_issues_spec.rb
@@ -0,0 +1,652 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe API::Issues do
+ set(:user) { create(:user) }
+ let(:user2) { create(:user) }
+ let(:non_member) { create(:user) }
+ set(:guest) { create(:user) }
+ set(:author) { create(:author) }
+ set(:assignee) { create(:assignee) }
+ let(:admin) { create(:user, :admin) }
+
+ let(:issue_title) { 'foo' }
+ let(:issue_description) { 'closed' }
+
+ let(:no_milestone_title) { 'None' }
+ let(:any_milestone_title) { 'Any' }
+
+ before do
+ stub_licensed_features(multiple_issue_assignees: false, issue_weights: false)
+ end
+
+ describe 'GET /groups/:id/issues' do
+ let!(:group) { create(:group) }
+ let!(:group_project) { create(:project, :public, creator_id: user.id, namespace: group) }
+ let!(:group_closed_issue) do
+ create :closed_issue,
+ author: user,
+ assignees: [user],
+ project: group_project,
+ state: :closed,
+ milestone: group_milestone,
+ updated_at: 3.hours.ago,
+ created_at: 1.day.ago
+ end
+ let!(:group_confidential_issue) do
+ create :issue,
+ :confidential,
+ project: group_project,
+ author: author,
+ assignees: [assignee],
+ updated_at: 2.hours.ago,
+ created_at: 2.days.ago
+ end
+ let!(:group_issue) do
+ create :issue,
+ author: user,
+ assignees: [user],
+ project: group_project,
+ milestone: group_milestone,
+ updated_at: 1.hour.ago,
+ title: issue_title,
+ description: issue_description,
+ created_at: 5.days.ago
+ end
+ let!(:group_label) do
+ create(:label, title: 'group_lbl', color: '#FFAABB', project: group_project)
+ end
+ let!(:group_label_link) { create(:label_link, label: group_label, target: group_issue) }
+ let!(:group_milestone) { create(:milestone, title: '3.0.0', project: group_project) }
+ let!(:group_empty_milestone) do
+ create(:milestone, title: '4.0.0', project: group_project)
+ end
+ let!(:group_note) { create(:note_on_issue, author: user, project: group_project, noteable: group_issue) }
+
+ let(:base_url) { "/groups/#{group.id}/issues" }
+
+ shared_examples 'group issues statistics' do
+ it 'returns issues statistics' do
+ get api("/groups/#{group.id}/issues_statistics", user), params: params
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['statistics']).not_to be_nil
+ expect(json_response['statistics']['counts']['all']).to eq counts[:all]
+ expect(json_response['statistics']['counts']['closed']).to eq counts[:closed]
+ expect(json_response['statistics']['counts']['opened']).to eq counts[:opened]
+ end
+ end
+
+ context 'when group has subgroups', :nested_groups do
+ let(:subgroup_1) { create(:group, parent: group) }
+ let(:subgroup_2) { create(:group, parent: subgroup_1) }
+
+ let(:subgroup_1_project) { create(:project, :public, namespace: subgroup_1) }
+ let(:subgroup_2_project) { create(:project, namespace: subgroup_2) }
+
+ let!(:issue_1) { create(:issue, project: subgroup_1_project) }
+ let!(:issue_2) { create(:issue, project: subgroup_2_project) }
+
+ context 'when user is unauthenticated' do
+ it 'also returns subgroups public projects issues' do
+ get api(base_url)
+
+ expect_paginated_array_response([issue_1.id, group_closed_issue.id, group_issue.id])
+ end
+
+ it 'also returns subgroups public projects issues filtered by milestone' do
+ get api(base_url), params: { milestone: group_milestone.title }
+
+ expect_paginated_array_response([group_closed_issue.id, group_issue.id])
+ end
+
+ context 'issues_statistics' do
+ context 'no state is treated as all state' do
+ let(:params) { {} }
+ let(:counts) { { all: 3, closed: 1, opened: 2 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'statistics when all state is passed' do
+ let(:params) { { state: :all } }
+ let(:counts) { { all: 3, closed: 1, opened: 2 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'closed state is treated as all state' do
+ let(:params) { { state: :closed } }
+ let(:counts) { { all: 3, closed: 1, opened: 2 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'opened state is treated as all state' do
+ let(:params) { { state: :opened } }
+ let(:counts) { { all: 3, closed: 1, opened: 2 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'when filtering by milestone and no state treated as all state' do
+ let(:params) { { milestone: group_milestone.title } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'when filtering by milestone and all state' do
+ let(:params) { { milestone: group_milestone.title, state: :all } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'when filtering by milestone and closed state treated as all state' do
+ let(:params) { { milestone: group_milestone.title, state: :closed } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'when filtering by milestone and opened state treated as all state' do
+ let(:params) { { milestone: group_milestone.title, state: :opened } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+ end
+ end
+
+ context 'when user is a group member' do
+ before do
+ group.add_developer(user)
+ end
+
+ it 'also returns subgroups projects issues' do
+ get api(base_url, user)
+
+ expect_paginated_array_response([issue_2.id, issue_1.id, group_closed_issue.id, group_confidential_issue.id, group_issue.id])
+ end
+
+ it 'also returns subgroups public projects issues filtered by milestone' do
+ get api(base_url, user), params: { milestone: group_milestone.title }
+
+ expect_paginated_array_response([group_closed_issue.id, group_issue.id])
+ end
+
+ context 'issues_statistics' do
+ context 'no state is treated as all state' do
+ let(:params) { {} }
+ let(:counts) { { all: 5, closed: 1, opened: 4 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'statistics when all state is passed' do
+ let(:params) { { state: :all } }
+ let(:counts) { { all: 5, closed: 1, opened: 4 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'closed state is treated as all state' do
+ let(:params) { { state: :closed } }
+ let(:counts) { { all: 5, closed: 1, opened: 4 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'opened state is treated as all state' do
+ let(:params) { { state: :opened } }
+ let(:counts) { { all: 5, closed: 1, opened: 4 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'when filtering by milestone and no state treated as all state' do
+ let(:params) { { milestone: group_milestone.title } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'when filtering by milestone and all state' do
+ let(:params) { { milestone: group_milestone.title, state: :all } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'when filtering by milestone and closed state treated as all state' do
+ let(:params) { { milestone: group_milestone.title, state: :closed } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'when filtering by milestone and opened state treated as all state' do
+ let(:params) { { milestone: group_milestone.title, state: :opened } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+ end
+ end
+ end
+
+ context 'when user is unauthenticated' do
+ it 'lists all issues in public projects' do
+ get api(base_url)
+
+ expect_paginated_array_response([group_closed_issue.id, group_issue.id])
+ end
+
+ it 'also returns subgroups public projects issues filtered by milestone' do
+ get api(base_url), params: { milestone: group_milestone.title }
+
+ expect_paginated_array_response([group_closed_issue.id, group_issue.id])
+ end
+
+ context 'issues_statistics' do
+ context 'no state is treated as all state' do
+ let(:params) { {} }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'statistics when all state is passed' do
+ let(:params) { { state: :all } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'closed state is treated as all state' do
+ let(:params) { { state: :closed } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'opened state is treated as all state' do
+ let(:params) { { state: :opened } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'when filtering by milestone and no state treated as all state' do
+ let(:params) { { milestone: group_milestone.title } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'when filtering by milestone and all state' do
+ let(:params) { { milestone: group_milestone.title, state: :all } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'when filtering by milestone and closed state treated as all state' do
+ let(:params) { { milestone: group_milestone.title, state: :closed } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'when filtering by milestone and opened state treated as all state' do
+ let(:params) { { milestone: group_milestone.title, state: :opened } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+ end
+ end
+
+ context 'when user is a group member' do
+ before do
+ group_project.add_reporter(user)
+ end
+
+ it 'returns all group issues (including opened and closed)' do
+ get api(base_url, admin)
+
+ expect_paginated_array_response([group_closed_issue.id, group_confidential_issue.id, group_issue.id])
+ end
+
+ it 'returns group issues without confidential issues for non project members' do
+ get api(base_url, non_member), params: { state: :opened }
+
+ expect_paginated_array_response(group_issue.id)
+ end
+
+ it 'returns group confidential issues for author' do
+ get api(base_url, author), params: { state: :opened }
+
+ expect_paginated_array_response([group_confidential_issue.id, group_issue.id])
+ end
+
+ it 'returns group confidential issues for assignee' do
+ get api(base_url, assignee), params: { state: :opened }
+
+ expect_paginated_array_response([group_confidential_issue.id, group_issue.id])
+ end
+
+ it 'returns group issues with confidential issues for project members' do
+ get api(base_url, user), params: { state: :opened }
+
+ expect_paginated_array_response([group_confidential_issue.id, group_issue.id])
+ end
+
+ it 'returns group confidential issues for admin' do
+ get api(base_url, admin), params: { state: :opened }
+
+ expect_paginated_array_response([group_confidential_issue.id, group_issue.id])
+ end
+
+ it 'returns only confidential issues' do
+ get api(base_url, user), params: { confidential: true }
+
+ expect_paginated_array_response(group_confidential_issue.id)
+ end
+
+ it 'returns only public issues' do
+ get api(base_url, user), params: { confidential: false }
+
+ expect_paginated_array_response([group_closed_issue.id, group_issue.id])
+ end
+
+ it 'returns an array of labeled group issues' do
+ get api(base_url, user), params: { labels: group_label.title }
+
+ expect_paginated_array_response(group_issue.id)
+ expect(json_response.first['labels']).to eq([group_label.title])
+ end
+
+ it 'returns an array of labeled group issues with labels param as array' do
+ get api(base_url, user), params: { labels: [group_label.title] }
+
+ expect_paginated_array_response(group_issue.id)
+ expect(json_response.first['labels']).to eq([group_label.title])
+ end
+
+ it 'returns an array of labeled group issues where all labels match' do
+ get api(base_url, user), params: { labels: "#{group_label.title},foo,bar" }
+
+ expect_paginated_array_response([])
+ end
+
+ it 'returns an array of labeled group issues where all labels match with labels param as array' do
+ get api(base_url, user), params: { labels: [group_label.title, 'foo', 'bar'] }
+
+ expect_paginated_array_response([])
+ end
+
+ it 'returns issues matching given search string for title' do
+ get api(base_url, user), params: { search: group_issue.title }
+
+ expect_paginated_array_response(group_issue.id)
+ end
+
+ it 'returns issues matching given search string for description' do
+ get api(base_url, user), params: { search: group_issue.description }
+
+ expect_paginated_array_response(group_issue.id)
+ end
+
+ context 'with labeled issues' do
+ let(:label_b) { create(:label, title: 'foo', project: group_project) }
+ let(:label_c) { create(:label, title: 'bar', project: group_project) }
+
+ before do
+ create(:label_link, label: label_b, target: group_issue)
+ create(:label_link, label: label_c, target: group_issue)
+
+ get api(base_url, user), params: params
+ end
+
+ let(:issue) { group_issue }
+ let(:label) { group_label }
+
+ it_behaves_like 'labeled issues with labels and label_name params'
+ end
+
+ it 'returns an array of issues found by iids' do
+ get api(base_url, user), params: { iids: [group_issue.iid] }
+
+ expect_paginated_array_response(group_issue.id)
+ expect(json_response.first['id']).to eq(group_issue.id)
+ end
+
+ it 'returns an empty array if iid does not exist' do
+ get api(base_url, user), params: { iids: [0] }
+
+ expect_paginated_array_response([])
+ end
+
+ it 'returns an empty array if no group issue matches labels' do
+ get api(base_url, user), params: { labels: 'foo,bar' }
+
+ expect_paginated_array_response([])
+ end
+
+ it 'returns an array of group issues with any label' do
+ get api(base_url, user), params: { labels: IssuesFinder::FILTER_ANY }
+
+ expect_paginated_array_response(group_issue.id)
+ expect(json_response.first['id']).to eq(group_issue.id)
+ end
+
+ it 'returns an array of group issues with any label with labels param as array' do
+ get api(base_url, user), params: { labels: [IssuesFinder::FILTER_ANY] }
+
+ expect_paginated_array_response(group_issue.id)
+ expect(json_response.first['id']).to eq(group_issue.id)
+ end
+
+ it 'returns an array of group issues with no label' do
+ get api(base_url, user), params: { labels: IssuesFinder::FILTER_NONE }
+
+ expect_paginated_array_response([group_closed_issue.id, group_confidential_issue.id])
+ end
+
+ it 'returns an array of group issues with no label with labels param as array' do
+ get api(base_url, user), params: { labels: [IssuesFinder::FILTER_NONE] }
+
+ expect_paginated_array_response([group_closed_issue.id, group_confidential_issue.id])
+ end
+
+ it 'returns an empty array if no issue matches milestone' do
+ get api(base_url, user), params: { milestone: group_empty_milestone.title }
+
+ expect_paginated_array_response([])
+ end
+
+ it 'returns an empty array if milestone does not exist' do
+ get api(base_url, user), params: { milestone: 'foo' }
+
+ expect_paginated_array_response([])
+ end
+
+ it 'returns an array of issues in given milestone' do
+ get api(base_url, user), params: { state: :opened, milestone: group_milestone.title }
+
+ expect_paginated_array_response(group_issue.id)
+ end
+
+ it 'returns an array of issues matching state in milestone' do
+ get api(base_url, user), params: { milestone: group_milestone.title, state: :closed }
+
+ expect_paginated_array_response(group_closed_issue.id)
+ end
+
+ it 'returns an array of issues with no milestone' do
+ get api(base_url, user), params: { milestone: no_milestone_title }
+
+ expect(response).to have_gitlab_http_status(200)
+
+ expect_paginated_array_response(group_confidential_issue.id)
+ end
+
+ context 'without sort params' do
+ it 'sorts by created_at descending by default' do
+ get api(base_url, user)
+
+ expect_paginated_array_response([group_closed_issue.id, group_confidential_issue.id, group_issue.id])
+ end
+
+ context 'with 2 issues with same created_at' do
+ let!(:group_issue2) do
+ create :issue,
+ author: user,
+ assignees: [user],
+ project: group_project,
+ milestone: group_milestone,
+ updated_at: 1.hour.ago,
+ title: issue_title,
+ description: issue_description,
+ created_at: group_issue.created_at
+ end
+
+ it 'page breaks first page correctly' do
+ get api("#{base_url}?per_page=3", user)
+
+ expect_paginated_array_response([group_closed_issue.id, group_confidential_issue.id, group_issue2.id])
+ end
+
+ it 'page breaks second page correctly' do
+ get api("#{base_url}?per_page=3&page=2", user)
+
+ expect_paginated_array_response([group_issue.id])
+ end
+ end
+ end
+
+ it 'sorts ascending when requested' do
+ get api("#{base_url}?sort=asc", user)
+
+ expect_paginated_array_response([group_issue.id, group_confidential_issue.id, group_closed_issue.id])
+ end
+
+ it 'sorts by updated_at descending when requested' do
+ get api("#{base_url}?order_by=updated_at", user)
+
+ group_issue.touch(:updated_at)
+
+ expect_paginated_array_response([group_issue.id, group_confidential_issue.id, group_closed_issue.id])
+ end
+
+ it 'sorts by updated_at ascending when requested' do
+ get api(base_url, user), params: { order_by: :updated_at, sort: :asc }
+
+ expect_paginated_array_response([group_closed_issue.id, group_confidential_issue.id, group_issue.id])
+ end
+
+ context 'issues_statistics' do
+ context 'no state is treated as all state' do
+ let(:params) { {} }
+ let(:counts) { { all: 3, closed: 1, opened: 2 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'statistics when all state is passed' do
+ let(:params) { { state: :all } }
+ let(:counts) { { all: 3, closed: 1, opened: 2 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'closed state is treated as all state' do
+ let(:params) { { state: :closed } }
+ let(:counts) { { all: 3, closed: 1, opened: 2 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'opened state is treated as all state' do
+ let(:params) { { state: :opened } }
+ let(:counts) { { all: 3, closed: 1, opened: 2 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'when filtering by milestone and no state treated as all state' do
+ let(:params) { { milestone: group_milestone.title } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'when filtering by milestone and all state' do
+ let(:params) { { milestone: group_milestone.title, state: :all } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'when filtering by milestone and closed state treated as all state' do
+ let(:params) { { milestone: group_milestone.title, state: :closed } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'when filtering by milestone and opened state treated as all state' do
+ let(:params) { { milestone: group_milestone.title, state: :opened } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+
+ context 'sort does not affect statistics ' do
+ let(:params) { { state: :opened, order_by: 'updated_at' } }
+ let(:counts) { { all: 3, closed: 1, opened: 2 } }
+
+ it_behaves_like 'group issues statistics'
+ end
+ end
+
+ context 'filtering by assignee_username' do
+ let(:another_assignee) { create(:assignee) }
+ let!(:issue1) { create(:issue, author: user2, project: group_project, created_at: 3.days.ago) }
+ let!(:issue2) { create(:issue, author: user2, project: group_project, created_at: 2.days.ago) }
+ let!(:issue3) { create(:issue, author: user2, assignees: [assignee, another_assignee], project: group_project, created_at: 1.day.ago) }
+
+ it 'returns issues with by assignee_username' do
+ get api(base_url, user), params: { assignee_username: [assignee.username], scope: 'all' }
+
+ expect(issue3.reload.assignees.pluck(:id)).to match_array([assignee.id, another_assignee.id])
+ expect_paginated_array_response([issue3.id, group_confidential_issue.id])
+ end
+
+ it 'returns issues by assignee_username as string' do
+ get api(base_url, user), params: { assignee_username: assignee.username, scope: 'all' }
+
+ expect(issue3.reload.assignees.pluck(:id)).to match_array([assignee.id, another_assignee.id])
+ expect_paginated_array_response([issue3.id, group_confidential_issue.id])
+ end
+
+ it 'returns error when multiple assignees are passed' do
+ get api(base_url, user), params: { assignee_username: [assignee.username, another_assignee.username], scope: 'all' }
+
+ expect(response).to have_gitlab_http_status(400)
+ expect(json_response["error"]).to include("allows one value, but found 2")
+ end
+
+ it 'returns error when assignee_username and assignee_id are passed together' do
+ get api(base_url, user), params: { assignee_username: [assignee.username], assignee_id: another_assignee.id, scope: 'all' }
+
+ expect(response).to have_gitlab_http_status(400)
+ expect(json_response["error"]).to include("mutually exclusive")
+ end
+ end
+ end
+ end
+end
diff --git a/spec/requests/api/issues/get_project_issues_spec.rb b/spec/requests/api/issues/get_project_issues_spec.rb
new file mode 100644
index 00000000000..a07d7673345
--- /dev/null
+++ b/spec/requests/api/issues/get_project_issues_spec.rb
@@ -0,0 +1,805 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe API::Issues do
+ set(:user) { create(:user) }
+ set(:project) do
+ create(:project, :public, creator_id: user.id, namespace: user.namespace)
+ end
+
+ let(:user2) { create(:user) }
+ let(:non_member) { create(:user) }
+ set(:guest) { create(:user) }
+ set(:author) { create(:author) }
+ set(:assignee) { create(:assignee) }
+ let(:admin) { create(:user, :admin) }
+ let(:issue_title) { 'foo' }
+ let(:issue_description) { 'closed' }
+ let!(:closed_issue) do
+ create :closed_issue,
+ author: user,
+ assignees: [user],
+ project: project,
+ state: :closed,
+ milestone: milestone,
+ created_at: generate(:past_time),
+ updated_at: 3.hours.ago,
+ closed_at: 1.hour.ago
+ end
+ let!(:confidential_issue) do
+ create :issue,
+ :confidential,
+ project: project,
+ author: author,
+ assignees: [assignee],
+ created_at: generate(:past_time),
+ updated_at: 2.hours.ago
+ end
+ let!(:issue) do
+ create :issue,
+ author: user,
+ assignees: [user],
+ project: project,
+ milestone: milestone,
+ created_at: generate(:past_time),
+ updated_at: 1.hour.ago,
+ title: issue_title,
+ description: issue_description
+ end
+ set(:label) do
+ create(:label, title: 'label', color: '#FFAABB', project: project)
+ end
+ let!(:label_link) { create(:label_link, label: label, target: issue) }
+ let(:milestone) { create(:milestone, title: '1.0.0', project: project) }
+ set(:empty_milestone) do
+ create(:milestone, title: '2.0.0', project: project)
+ end
+ let!(:note) { create(:note_on_issue, author: user, project: project, noteable: issue) }
+
+ let(:no_milestone_title) { 'None' }
+ let(:any_milestone_title) { 'Any' }
+
+ before(:all) do
+ project.add_reporter(user)
+ project.add_guest(guest)
+ end
+
+ before do
+ stub_licensed_features(multiple_issue_assignees: false, issue_weights: false)
+ end
+
+ shared_examples 'project issues statistics' do
+ it 'returns project issues statistics' do
+ get api("/issues_statistics", user), params: params
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['statistics']).not_to be_nil
+ expect(json_response['statistics']['counts']['all']).to eq counts[:all]
+ expect(json_response['statistics']['counts']['closed']).to eq counts[:closed]
+ expect(json_response['statistics']['counts']['opened']).to eq counts[:opened]
+ end
+ end
+
+ describe "GET /projects/:id/issues" do
+ let(:base_url) { "/projects/#{project.id}" }
+
+ context 'when unauthenticated' do
+ it 'returns public project issues' do
+ get api("/projects/#{project.id}/issues")
+
+ expect_paginated_array_response([issue.id, closed_issue.id])
+ end
+
+ context 'issues_statistics' do
+ context 'no state is treated as all state' do
+ let(:params) { {} }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'project issues statistics'
+ end
+
+ context 'statistics when all state is passed' do
+ let(:params) { { state: :all } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'project issues statistics'
+ end
+
+ context 'closed state is treated as all state' do
+ let(:params) { { state: :closed } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'project issues statistics'
+ end
+
+ context 'opened state is treated as all state' do
+ let(:params) { { state: :opened } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'project issues statistics'
+ end
+
+ context 'when filtering by milestone and no state treated as all state' do
+ let(:params) { { milestone: milestone.title } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'project issues statistics'
+ end
+
+ context 'when filtering by milestone and all state' do
+ let(:params) { { milestone: milestone.title, state: :all } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'project issues statistics'
+ end
+
+ context 'when filtering by milestone and closed state treated as all state' do
+ let(:params) { { milestone: milestone.title, state: :closed } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'project issues statistics'
+ end
+
+ context 'when filtering by milestone and opened state treated as all state' do
+ let(:params) { { milestone: milestone.title, state: :opened } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'project issues statistics'
+ end
+
+ context 'sort does not affect statistics ' do
+ let(:params) { { state: :opened, order_by: 'updated_at' } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'project issues statistics'
+ end
+ end
+ end
+
+ it 'avoids N+1 queries' do
+ get api("/projects/#{project.id}/issues", user)
+
+ create_list(:issue, 3, project: project)
+
+ control_count = ActiveRecord::QueryRecorder.new(skip_cached: false) do
+ get api("/projects/#{project.id}/issues", user)
+ end.count
+
+ expect do
+ get api("/projects/#{project.id}/issues", user)
+ end.not_to exceed_all_query_limit(control_count)
+ end
+
+ it 'returns 404 when project does not exist' do
+ get api('/projects/1000/issues', non_member)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+
+ it 'returns 404 on private projects for other users' do
+ private_project = create(:project, :private)
+ create(:issue, project: private_project)
+
+ get api("/projects/#{private_project.id}/issues", non_member)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+
+ it 'returns no issues when user has access to project but not issues' do
+ restricted_project = create(:project, :public, :issues_private)
+ create(:issue, project: restricted_project)
+
+ get api("/projects/#{restricted_project.id}/issues", non_member)
+
+ expect_paginated_array_response([])
+ end
+
+ it 'returns project issues without confidential issues for non project members' do
+ get api("#{base_url}/issues", non_member)
+
+ expect_paginated_array_response([issue.id, closed_issue.id])
+ end
+
+ it 'returns project issues without confidential issues for project members with guest role' do
+ get api("#{base_url}/issues", guest)
+
+ expect_paginated_array_response([issue.id, closed_issue.id])
+ end
+
+ it 'returns project confidential issues for author' do
+ get api("#{base_url}/issues", author)
+
+ expect_paginated_array_response([issue.id, confidential_issue.id, closed_issue.id])
+ end
+
+ it 'returns only confidential issues' do
+ get api("#{base_url}/issues", author), params: { confidential: true }
+
+ expect_paginated_array_response(confidential_issue.id)
+ end
+
+ it 'returns only public issues' do
+ get api("#{base_url}/issues", author), params: { confidential: false }
+
+ expect_paginated_array_response([issue.id, closed_issue.id])
+ end
+
+ it 'returns project confidential issues for assignee' do
+ get api("#{base_url}/issues", assignee)
+
+ expect_paginated_array_response([issue.id, confidential_issue.id, closed_issue.id])
+ end
+
+ it 'returns project issues with confidential issues for project members' do
+ get api("#{base_url}/issues", user)
+
+ expect_paginated_array_response([issue.id, confidential_issue.id, closed_issue.id])
+ end
+
+ it 'returns project confidential issues for admin' do
+ get api("#{base_url}/issues", admin)
+
+ expect_paginated_array_response([issue.id, confidential_issue.id, closed_issue.id])
+ end
+
+ it 'returns an array of labeled project issues' do
+ get api("#{base_url}/issues", user), params: { labels: label.title }
+
+ expect_paginated_array_response(issue.id)
+ end
+
+ it 'returns an array of labeled project issues with labels param as array' do
+ get api("#{base_url}/issues", user), params: { labels: [label.title] }
+
+ expect_paginated_array_response(issue.id)
+ end
+
+ context 'with labeled issues' do
+ let(:label_b) { create(:label, title: 'foo', project: project) }
+ let(:label_c) { create(:label, title: 'bar', project: project) }
+
+ before do
+ create(:label_link, label: label_b, target: issue)
+ create(:label_link, label: label_c, target: issue)
+
+ get api('/issues', user), params: params
+ end
+
+ it_behaves_like 'labeled issues with labels and label_name params'
+ end
+
+ it 'returns issues matching given search string for title' do
+ get api("#{base_url}/issues?search=#{issue.title}", user)
+
+ expect_paginated_array_response(issue.id)
+ end
+
+ it 'returns issues matching given search string for description' do
+ get api("#{base_url}/issues?search=#{issue.description}", user)
+
+ expect_paginated_array_response(issue.id)
+ end
+
+ it 'returns an array of issues found by iids' do
+ get api("#{base_url}/issues", user), params: { iids: [issue.iid] }
+
+ expect_paginated_array_response(issue.id)
+ end
+
+ it 'returns an empty array if iid does not exist' do
+ get api("#{base_url}/issues", user), params: { iids: [0] }
+
+ expect_paginated_array_response([])
+ end
+
+ it 'returns an empty array if not all labels matches' do
+ get api("#{base_url}/issues?labels=#{label.title},foo", user)
+
+ expect_paginated_array_response([])
+ end
+
+ it 'returns an array of project issues with any label' do
+ get api("#{base_url}/issues", user), params: { labels: IssuesFinder::FILTER_ANY }
+
+ expect_paginated_array_response(issue.id)
+ end
+
+ it 'returns an array of project issues with any label with labels param as array' do
+ get api("#{base_url}/issues", user), params: { labels: [IssuesFinder::FILTER_ANY] }
+
+ expect_paginated_array_response(issue.id)
+ end
+
+ it 'returns an array of project issues with no label' do
+ get api("#{base_url}/issues", user), params: { labels: IssuesFinder::FILTER_NONE }
+
+ expect_paginated_array_response([confidential_issue.id, closed_issue.id])
+ end
+
+ it 'returns an array of project issues with no label with labels param as array' do
+ get api("#{base_url}/issues", user), params: { labels: [IssuesFinder::FILTER_NONE] }
+
+ expect_paginated_array_response([confidential_issue.id, closed_issue.id])
+ end
+
+ it 'returns an empty array if no project issue matches labels' do
+ get api("#{base_url}/issues", user), params: { labels: 'foo,bar' }
+
+ expect_paginated_array_response([])
+ end
+
+ it 'returns an empty array if no issue matches milestone' do
+ get api("#{base_url}/issues", user), params: { milestone: empty_milestone.title }
+
+ expect_paginated_array_response([])
+ end
+
+ it 'returns an empty array if milestone does not exist' do
+ get api("#{base_url}/issues", user), params: { milestone: :foo }
+
+ expect_paginated_array_response([])
+ end
+
+ it 'returns an array of issues in given milestone' do
+ get api("#{base_url}/issues", user), params: { milestone: milestone.title }
+
+ expect_paginated_array_response([issue.id, closed_issue.id])
+ end
+
+ it 'returns an array of issues matching state in milestone' do
+ get api("#{base_url}/issues", user), params: { milestone: milestone.title, state: :closed }
+
+ expect_paginated_array_response(closed_issue.id)
+ end
+
+ it 'returns an array of issues with no milestone' do
+ get api("#{base_url}/issues", user), params: { milestone: no_milestone_title }
+
+ expect_paginated_array_response(confidential_issue.id)
+ end
+
+ it 'returns an array of issues with any milestone' do
+ get api("#{base_url}/issues", user), params: { milestone: any_milestone_title }
+
+ expect_paginated_array_response([issue.id, closed_issue.id])
+ end
+
+ context 'without sort params' do
+ it 'sorts by created_at descending by default' do
+ get api("#{base_url}/issues", user)
+
+ expect_paginated_array_response([issue.id, confidential_issue.id, closed_issue.id])
+ end
+
+ context 'with 2 issues with same created_at' do
+ let!(:closed_issue2) do
+ create :closed_issue,
+ author: user,
+ assignees: [user],
+ project: project,
+ milestone: milestone,
+ created_at: closed_issue.created_at,
+ updated_at: 1.hour.ago,
+ title: issue_title,
+ description: issue_description
+ end
+
+ it 'page breaks first page correctly' do
+ get api("#{base_url}/issues?per_page=3", user)
+
+ expect_paginated_array_response([issue.id, confidential_issue.id, closed_issue2.id])
+ end
+
+ it 'page breaks second page correctly' do
+ get api("#{base_url}/issues?per_page=3&page=2", user)
+
+ expect_paginated_array_response([closed_issue.id])
+ end
+ end
+ end
+
+ it 'sorts ascending when requested' do
+ get api("#{base_url}/issues", user), params: { sort: :asc }
+
+ expect_paginated_array_response([closed_issue.id, confidential_issue.id, issue.id])
+ end
+
+ it 'sorts by updated_at descending when requested' do
+ get api("#{base_url}/issues", user), params: { order_by: :updated_at }
+
+ issue.touch(:updated_at)
+
+ expect_paginated_array_response([issue.id, confidential_issue.id, closed_issue.id])
+ end
+
+ it 'sorts by updated_at ascending when requested' do
+ get api("#{base_url}/issues", user), params: { order_by: :updated_at, sort: :asc }
+
+ expect_paginated_array_response([closed_issue.id, confidential_issue.id, issue.id])
+ end
+
+ context 'issues_statistics' do
+ context 'no state is treated as all state' do
+ let(:params) { {} }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'project issues statistics'
+ end
+
+ context 'statistics when all state is passed' do
+ let(:params) { { state: :all } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'project issues statistics'
+ end
+
+ context 'closed state is treated as all state' do
+ let(:params) { { state: :closed } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'project issues statistics'
+ end
+
+ context 'opened state is treated as all state' do
+ let(:params) { { state: :opened } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'project issues statistics'
+ end
+
+ context 'when filtering by milestone and no state treated as all state' do
+ let(:params) { { milestone: milestone.title } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'project issues statistics'
+ end
+
+ context 'when filtering by milestone and all state' do
+ let(:params) { { milestone: milestone.title, state: :all } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'project issues statistics'
+ end
+
+ context 'when filtering by milestone and closed state treated as all state' do
+ let(:params) { { milestone: milestone.title, state: :closed } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'project issues statistics'
+ end
+
+ context 'when filtering by milestone and opened state treated as all state' do
+ let(:params) { { milestone: milestone.title, state: :opened } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'project issues statistics'
+ end
+
+ context 'sort does not affect statistics ' do
+ let(:params) { { state: :opened, order_by: 'updated_at' } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'project issues statistics'
+ end
+ end
+
+ context 'filtering by assignee_username' do
+ let(:another_assignee) { create(:assignee) }
+ let!(:issue1) { create(:issue, author: user2, project: project, created_at: 3.days.ago) }
+ let!(:issue2) { create(:issue, author: user2, project: project, created_at: 2.days.ago) }
+ let!(:issue3) { create(:issue, author: user2, assignees: [assignee, another_assignee], project: project, created_at: 1.day.ago) }
+
+ it 'returns issues by assignee_username' do
+ get api("/issues", user), params: { assignee_username: [assignee.username], scope: 'all' }
+
+ expect(issue3.reload.assignees.pluck(:id)).to match_array([assignee.id, another_assignee.id])
+ expect_paginated_array_response([confidential_issue.id, issue3.id])
+ end
+
+ it 'returns issues by assignee_username as string' do
+ get api("/issues", user), params: { assignee_username: assignee.username, scope: 'all' }
+
+ expect(issue3.reload.assignees.pluck(:id)).to match_array([assignee.id, another_assignee.id])
+ expect_paginated_array_response([confidential_issue.id, issue3.id])
+ end
+
+ it 'returns error when multiple assignees are passed' do
+ get api("/issues", user), params: { assignee_username: [assignee.username, another_assignee.username], scope: 'all' }
+
+ expect(response).to have_gitlab_http_status(400)
+ expect(json_response["error"]).to include("allows one value, but found 2")
+ end
+
+ it 'returns error when assignee_username and assignee_id are passed together' do
+ get api("/issues", user), params: { assignee_username: [assignee.username], assignee_id: another_assignee.id, scope: 'all' }
+
+ expect(response).to have_gitlab_http_status(400)
+ expect(json_response["error"]).to include("mutually exclusive")
+ end
+ end
+ end
+
+ describe 'GET /projects/:id/issues/:issue_iid' do
+ context 'when unauthenticated' do
+ it 'returns public issues' do
+ get api("/projects/#{project.id}/issues/#{issue.iid}")
+
+ expect(response).to have_gitlab_http_status(200)
+ end
+ end
+
+ it 'exposes known attributes' do
+ get api("/projects/#{project.id}/issues/#{issue.iid}", user)
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['id']).to eq(issue.id)
+ expect(json_response['iid']).to eq(issue.iid)
+ expect(json_response['project_id']).to eq(issue.project.id)
+ expect(json_response['title']).to eq(issue.title)
+ expect(json_response['description']).to eq(issue.description)
+ expect(json_response['state']).to eq(issue.state)
+ expect(json_response['closed_at']).to be_falsy
+ expect(json_response['created_at']).to be_present
+ expect(json_response['updated_at']).to be_present
+ expect(json_response['labels']).to eq(issue.label_names)
+ expect(json_response['milestone']).to be_a Hash
+ expect(json_response['assignees']).to be_a Array
+ expect(json_response['assignee']).to be_a Hash
+ expect(json_response['author']).to be_a Hash
+ expect(json_response['confidential']).to be_falsy
+ end
+
+ it 'exposes the closed_at attribute' do
+ get api("/projects/#{project.id}/issues/#{closed_issue.iid}", user)
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['closed_at']).to be_present
+ end
+
+ context 'links exposure' do
+ it 'exposes related resources full URIs' do
+ get api("/projects/#{project.id}/issues/#{issue.iid}", user)
+
+ links = json_response['_links']
+
+ expect(links['self']).to end_with("/api/v4/projects/#{project.id}/issues/#{issue.iid}")
+ expect(links['notes']).to end_with("/api/v4/projects/#{project.id}/issues/#{issue.iid}/notes")
+ expect(links['award_emoji']).to end_with("/api/v4/projects/#{project.id}/issues/#{issue.iid}/award_emoji")
+ expect(links['project']).to end_with("/api/v4/projects/#{project.id}")
+ end
+ end
+
+ it 'returns a project issue by internal id' do
+ get api("/projects/#{project.id}/issues/#{issue.iid}", user)
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['title']).to eq(issue.title)
+ expect(json_response['iid']).to eq(issue.iid)
+ end
+
+ it 'returns 404 if issue id not found' do
+ get api("/projects/#{project.id}/issues/54321", user)
+ expect(response).to have_gitlab_http_status(404)
+ end
+
+ it 'returns 404 if the issue ID is used' do
+ get api("/projects/#{project.id}/issues/#{issue.id}", user)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+
+ context 'confidential issues' do
+ it 'returns 404 for non project members' do
+ get api("/projects/#{project.id}/issues/#{confidential_issue.iid}", non_member)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+
+ it 'returns 404 for project members with guest role' do
+ get api("/projects/#{project.id}/issues/#{confidential_issue.iid}", guest)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+
+ it 'returns confidential issue for project members' do
+ get api("/projects/#{project.id}/issues/#{confidential_issue.iid}", user)
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['title']).to eq(confidential_issue.title)
+ expect(json_response['iid']).to eq(confidential_issue.iid)
+ end
+
+ it 'returns confidential issue for author' do
+ get api("/projects/#{project.id}/issues/#{confidential_issue.iid}", author)
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['title']).to eq(confidential_issue.title)
+ expect(json_response['iid']).to eq(confidential_issue.iid)
+ end
+
+ it 'returns confidential issue for assignee' do
+ get api("/projects/#{project.id}/issues/#{confidential_issue.iid}", assignee)
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['title']).to eq(confidential_issue.title)
+ expect(json_response['iid']).to eq(confidential_issue.iid)
+ end
+
+ it 'returns confidential issue for admin' do
+ get api("/projects/#{project.id}/issues/#{confidential_issue.iid}", admin)
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['title']).to eq(confidential_issue.title)
+ expect(json_response['iid']).to eq(confidential_issue.iid)
+ end
+ end
+ end
+
+ describe 'GET :id/issues/:issue_iid/closed_by' do
+ let(:merge_request) do
+ create(:merge_request,
+ :simple,
+ author: user,
+ source_project: project,
+ target_project: project,
+ description: "closes #{issue.to_reference}")
+ end
+
+ before do
+ create(:merge_requests_closing_issues, issue: issue, merge_request: merge_request)
+ end
+
+ context 'when unauthenticated' do
+ it 'return public project issues' do
+ get api("/projects/#{project.id}/issues/#{issue.iid}/closed_by")
+
+ expect_paginated_array_response(merge_request.id)
+ end
+ end
+
+ it 'returns merge requests that will close issue on merge' do
+ get api("/projects/#{project.id}/issues/#{issue.iid}/closed_by", user)
+
+ expect_paginated_array_response(merge_request.id)
+ end
+
+ context 'when no merge requests will close issue' do
+ it 'returns empty array' do
+ get api("/projects/#{project.id}/issues/#{closed_issue.iid}/closed_by", user)
+
+ expect_paginated_array_response([])
+ end
+ end
+
+ it "returns 404 when issue doesn't exists" do
+ get api("/projects/#{project.id}/issues/0/closed_by", user)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+ end
+
+ describe 'GET :id/issues/:issue_iid/related_merge_requests' do
+ def get_related_merge_requests(project_id, issue_iid, user = nil)
+ get api("/projects/#{project_id}/issues/#{issue_iid}/related_merge_requests", user)
+ end
+
+ def create_referencing_mr(user, project, issue)
+ attributes = {
+ author: user,
+ source_project: project,
+ target_project: project,
+ source_branch: 'master',
+ target_branch: 'test',
+ description: "See #{issue.to_reference}"
+ }
+ create(:merge_request, attributes).tap do |merge_request|
+ create(:note, :system, project: issue.project, noteable: issue, author: user, note: merge_request.to_reference(full: true))
+ end
+ end
+
+ let!(:related_mr) { create_referencing_mr(user, project, issue) }
+
+ context 'when unauthenticated' do
+ it 'return list of referenced merge requests from issue' do
+ get_related_merge_requests(project.id, issue.iid)
+
+ expect_paginated_array_response(related_mr.id)
+ end
+
+ it 'renders 404 if project is not visible' do
+ private_project = create(:project, :private)
+ private_issue = create(:issue, project: private_project)
+ create_referencing_mr(user, private_project, private_issue)
+
+ get_related_merge_requests(private_project.id, private_issue.iid)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+ end
+
+ it 'returns merge requests that mentioned a issue' do
+ create(:merge_request,
+ :simple,
+ author: user,
+ source_project: project,
+ target_project: project,
+ description: 'Some description')
+
+ get_related_merge_requests(project.id, issue.iid, user)
+
+ expect_paginated_array_response(related_mr.id)
+ end
+
+ it 'returns merge requests cross-project wide' do
+ project2 = create(:project, :public, creator_id: user.id, namespace: user.namespace)
+ merge_request = create_referencing_mr(user, project2, issue)
+
+ get_related_merge_requests(project.id, issue.iid, user)
+
+ expect_paginated_array_response([related_mr.id, merge_request.id])
+ end
+
+ it 'does not generate references to projects with no access' do
+ private_project = create(:project, :private)
+ create_referencing_mr(private_project.creator, private_project, issue)
+
+ get_related_merge_requests(project.id, issue.iid, user)
+
+ expect_paginated_array_response(related_mr.id)
+ end
+
+ context 'no merge request mentioned a issue' do
+ it 'returns empty array' do
+ get_related_merge_requests(project.id, closed_issue.iid, user)
+
+ expect_paginated_array_response([])
+ end
+ end
+
+ it "returns 404 when issue doesn't exists" do
+ get_related_merge_requests(project.id, 0, user)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+ end
+
+ describe 'GET /projects/:id/issues/:issue_iid/user_agent_detail' do
+ let!(:user_agent_detail) { create(:user_agent_detail, subject: issue) }
+
+ context 'when unauthenticated' do
+ it 'returns unauthorized' do
+ get api("/projects/#{project.id}/issues/#{issue.iid}/user_agent_detail")
+
+ expect(response).to have_gitlab_http_status(401)
+ end
+ end
+
+ it 'exposes known attributes' do
+ get api("/projects/#{project.id}/issues/#{issue.iid}/user_agent_detail", admin)
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['user_agent']).to eq(user_agent_detail.user_agent)
+ expect(json_response['ip_address']).to eq(user_agent_detail.ip_address)
+ expect(json_response['akismet_submitted']).to eq(user_agent_detail.submitted)
+ end
+
+ it 'returns unauthorized for non-admin users' do
+ get api("/projects/#{project.id}/issues/#{issue.iid}/user_agent_detail", user)
+
+ expect(response).to have_gitlab_http_status(403)
+ end
+ end
+
+ describe 'GET projects/:id/issues/:issue_iid/participants' do
+ it_behaves_like 'issuable participants endpoint' do
+ let(:entity) { issue }
+ end
+
+ it 'returns 404 if the issue is confidential' do
+ post api("/projects/#{project.id}/issues/#{confidential_issue.iid}/participants", non_member)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+ end
+end
diff --git a/spec/requests/api/issues/issues_spec.rb b/spec/requests/api/issues/issues_spec.rb
new file mode 100644
index 00000000000..9b9cc778fb3
--- /dev/null
+++ b/spec/requests/api/issues/issues_spec.rb
@@ -0,0 +1,796 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe API::Issues do
+ set(:user) { create(:user) }
+ set(:project) do
+ create(:project, :public, creator_id: user.id, namespace: user.namespace)
+ end
+
+ let(:user2) { create(:user) }
+ let(:non_member) { create(:user) }
+ set(:guest) { create(:user) }
+ set(:author) { create(:author) }
+ set(:assignee) { create(:assignee) }
+ let(:admin) { create(:user, :admin) }
+ let(:issue_title) { 'foo' }
+ let(:issue_description) { 'closed' }
+ let!(:closed_issue) do
+ create :closed_issue,
+ author: user,
+ assignees: [user],
+ project: project,
+ state: :closed,
+ milestone: milestone,
+ created_at: generate(:past_time),
+ updated_at: 3.hours.ago,
+ closed_at: 1.hour.ago
+ end
+ let!(:confidential_issue) do
+ create :issue,
+ :confidential,
+ project: project,
+ author: author,
+ assignees: [assignee],
+ created_at: generate(:past_time),
+ updated_at: 2.hours.ago
+ end
+ let!(:issue) do
+ create :issue,
+ author: user,
+ assignees: [user],
+ project: project,
+ milestone: milestone,
+ created_at: generate(:past_time),
+ updated_at: 1.hour.ago,
+ title: issue_title,
+ description: issue_description
+ end
+ set(:label) do
+ create(:label, title: 'label', color: '#FFAABB', project: project)
+ end
+ let!(:label_link) { create(:label_link, label: label, target: issue) }
+ let(:milestone) { create(:milestone, title: '1.0.0', project: project) }
+ set(:empty_milestone) do
+ create(:milestone, title: '2.0.0', project: project)
+ end
+ let!(:note) { create(:note_on_issue, author: user, project: project, noteable: issue) }
+
+ let(:no_milestone_title) { 'None' }
+ let(:any_milestone_title) { 'Any' }
+
+ before(:all) do
+ project.add_reporter(user)
+ project.add_guest(guest)
+ end
+
+ before do
+ stub_licensed_features(multiple_issue_assignees: false, issue_weights: false)
+ end
+
+ shared_examples 'issues statistics' do
+ it 'returns issues statistics' do
+ get api("/issues_statistics", user), params: params
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['statistics']).not_to be_nil
+ expect(json_response['statistics']['counts']['all']).to eq counts[:all]
+ expect(json_response['statistics']['counts']['closed']).to eq counts[:closed]
+ expect(json_response['statistics']['counts']['opened']).to eq counts[:opened]
+ end
+ end
+
+ describe 'GET /issues' do
+ context 'when unauthenticated' do
+ it 'returns an array of all issues' do
+ get api('/issues'), params: { scope: 'all' }
+
+ expect(response).to have_http_status(200)
+ expect(json_response).to be_an Array
+ end
+
+ it 'returns authentication error without any scope' do
+ get api('/issues')
+
+ expect(response).to have_http_status(401)
+ end
+
+ it 'returns authentication error when scope is assigned-to-me' do
+ get api('/issues'), params: { scope: 'assigned-to-me' }
+
+ expect(response).to have_http_status(401)
+ end
+
+ it 'returns authentication error when scope is created-by-me' do
+ get api('/issues'), params: { scope: 'created-by-me' }
+
+ expect(response).to have_http_status(401)
+ end
+
+ it 'returns an array of issues matching state in milestone' do
+ get api('/issues'), params: { milestone: 'foo', scope: 'all' }
+
+ expect(response).to have_http_status(200)
+ expect_paginated_array_response([])
+ end
+
+ it 'returns an array of issues matching state in milestone' do
+ get api('/issues'), params: { milestone: milestone.title, scope: 'all' }
+
+ expect(response).to have_http_status(200)
+ expect_paginated_array_response([issue.id, closed_issue.id])
+ end
+
+ context 'issues_statistics' do
+ it 'returns authentication error without any scope' do
+ get api('/issues_statistics')
+
+ expect(response).to have_http_status(401)
+ end
+
+ it 'returns authentication error when scope is assigned_to_me' do
+ get api('/issues_statistics'), params: { scope: 'assigned_to_me' }
+
+ expect(response).to have_http_status(401)
+ end
+
+ it 'returns authentication error when scope is created_by_me' do
+ get api('/issues_statistics'), params: { scope: 'created_by_me' }
+
+ expect(response).to have_http_status(401)
+ end
+
+ context 'no state is treated as all state' do
+ let(:params) { {} }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'issues statistics'
+ end
+
+ context 'statistics when all state is passed' do
+ let(:params) { { state: :all } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'issues statistics'
+ end
+
+ context 'closed state is treated as all state' do
+ let(:params) { { state: :closed } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'issues statistics'
+ end
+
+ context 'opened state is treated as all state' do
+ let(:params) { { state: :opened } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'issues statistics'
+ end
+
+ context 'when filtering by milestone and no state treated as all state' do
+ let(:params) { { milestone: milestone.title } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'issues statistics'
+ end
+
+ context 'when filtering by milestone and all state' do
+ let(:params) { { milestone: milestone.title, state: :all } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'issues statistics'
+ end
+
+ context 'when filtering by milestone and closed state treated as all state' do
+ let(:params) { { milestone: milestone.title, state: :closed } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'issues statistics'
+ end
+
+ context 'when filtering by milestone and opened state treated as all state' do
+ let(:params) { { milestone: milestone.title, state: :opened } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'issues statistics'
+ end
+
+ context 'sort does not affect statistics ' do
+ let(:params) { { state: :opened, order_by: 'updated_at' } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'issues statistics'
+ end
+ end
+ end
+
+ context 'when authenticated' do
+ it 'returns an array of issues' do
+ get api('/issues', user)
+
+ expect_paginated_array_response([issue.id, closed_issue.id])
+ expect(json_response.first['title']).to eq(issue.title)
+ expect(json_response.last).to have_key('web_url')
+ end
+
+ it 'returns an array of closed issues' do
+ get api('/issues', user), params: { state: :closed }
+
+ expect_paginated_array_response(closed_issue.id)
+ end
+
+ it 'returns an array of opened issues' do
+ get api('/issues', user), params: { state: :opened }
+
+ expect_paginated_array_response(issue.id)
+ end
+
+ it 'returns an array of all issues' do
+ get api('/issues', user), params: { state: :all }
+
+ expect_paginated_array_response([issue.id, closed_issue.id])
+ end
+
+ it 'returns issues assigned to me' do
+ issue2 = create(:issue, assignees: [user2], project: project)
+
+ get api('/issues', user2), params: { scope: 'assigned_to_me' }
+
+ expect_paginated_array_response(issue2.id)
+ end
+
+ it 'returns issues assigned to me (kebab-case)' do
+ issue2 = create(:issue, assignees: [user2], project: project)
+
+ get api('/issues', user2), params: { scope: 'assigned-to-me' }
+
+ expect_paginated_array_response(issue2.id)
+ end
+
+ it 'returns issues authored by the given author id' do
+ issue2 = create(:issue, author: user2, project: project)
+
+ get api('/issues', user), params: { author_id: user2.id, scope: 'all' }
+
+ expect_paginated_array_response(issue2.id)
+ end
+
+ it 'returns issues assigned to the given assignee id' do
+ issue2 = create(:issue, assignees: [user2], project: project)
+
+ get api('/issues', user), params: { assignee_id: user2.id, scope: 'all' }
+
+ expect_paginated_array_response(issue2.id)
+ end
+
+ it 'returns issues authored by the given author id and assigned to the given assignee id' do
+ issue2 = create(:issue, author: user2, assignees: [user2], project: project)
+
+ get api('/issues', user), params: { author_id: user2.id, assignee_id: user2.id, scope: 'all' }
+
+ expect_paginated_array_response(issue2.id)
+ end
+
+ it 'returns issues with no assignee' do
+ issue2 = create(:issue, author: user2, project: project)
+
+ get api('/issues', user), params: { assignee_id: 0, scope: 'all' }
+
+ expect_paginated_array_response(issue2.id)
+ end
+
+ it 'returns issues with no assignee' do
+ issue2 = create(:issue, author: user2, project: project)
+
+ get api('/issues', user), params: { assignee_id: 'None', scope: 'all' }
+
+ expect_paginated_array_response(issue2.id)
+ end
+
+ it 'returns issues with any assignee' do
+ # This issue without assignee should not be returned
+ create(:issue, author: user2, project: project)
+
+ get api('/issues', user), params: { assignee_id: 'Any', scope: 'all' }
+
+ expect_paginated_array_response([issue.id, confidential_issue.id, closed_issue.id])
+ end
+
+ it 'returns only confidential issues' do
+ get api('/issues', user), params: { confidential: true, scope: 'all' }
+
+ expect_paginated_array_response(confidential_issue.id)
+ end
+
+ it 'returns only public issues' do
+ get api('/issues', user), params: { confidential: false }
+
+ expect_paginated_array_response([issue.id, closed_issue.id])
+ end
+
+ it 'returns issues reacted by the authenticated user' do
+ issue2 = create(:issue, project: project, author: user, assignees: [user])
+ create(:award_emoji, awardable: issue2, user: user2, name: 'star')
+ create(:award_emoji, awardable: issue, user: user2, name: 'thumbsup')
+
+ get api('/issues', user2), params: { my_reaction_emoji: 'Any', scope: 'all' }
+
+ expect_paginated_array_response([issue2.id, issue.id])
+ end
+
+ it 'returns issues not reacted by the authenticated user' do
+ issue2 = create(:issue, project: project, author: user, assignees: [user])
+ create(:award_emoji, awardable: issue2, user: user2, name: 'star')
+
+ get api('/issues', user2), params: { my_reaction_emoji: 'None', scope: 'all' }
+
+ expect_paginated_array_response([issue.id, closed_issue.id])
+ end
+
+ it 'returns issues matching given search string for title' do
+ get api('/issues', user), params: { search: issue.title }
+
+ expect_paginated_array_response(issue.id)
+ end
+
+ it 'returns issues matching given search string for title and scoped in title' do
+ get api('/issues', user), params: { search: issue.title, in: 'title' }
+
+ expect_paginated_array_response(issue.id)
+ end
+
+ it 'returns an empty array if no issue matches given search string for title and scoped in description' do
+ get api('/issues', user), params: { search: issue.title, in: 'description' }
+
+ expect_paginated_array_response([])
+ end
+
+ it 'returns issues matching given search string for description' do
+ get api('/issues', user), params: { search: issue.description }
+
+ expect_paginated_array_response(issue.id)
+ end
+
+ context 'filtering before a specific date' do
+ let!(:issue2) { create(:issue, project: project, author: user, created_at: Date.new(2000, 1, 1), updated_at: Date.new(2000, 1, 1)) }
+
+ it 'returns issues created before a specific date' do
+ get api('/issues?created_before=2000-01-02T00:00:00.060Z', user)
+
+ expect_paginated_array_response(issue2.id)
+ end
+
+ it 'returns issues updated before a specific date' do
+ get api('/issues?updated_before=2000-01-02T00:00:00.060Z', user)
+
+ expect_paginated_array_response(issue2.id)
+ end
+ end
+
+ context 'filtering after a specific date' do
+ let!(:issue2) { create(:issue, project: project, author: user, created_at: 1.week.from_now, updated_at: 1.week.from_now) }
+
+ it 'returns issues created after a specific date' do
+ get api("/issues?created_after=#{issue2.created_at}", user)
+
+ expect_paginated_array_response(issue2.id)
+ end
+
+ it 'returns issues updated after a specific date' do
+ get api("/issues?updated_after=#{issue2.updated_at}", user)
+
+ expect_paginated_array_response(issue2.id)
+ end
+ end
+
+ context 'filter by labels or label_name param' do
+ context 'N+1' do
+ let(:label_b) { create(:label, title: 'foo', project: project) }
+ let(:label_c) { create(:label, title: 'bar', project: project) }
+
+ before do
+ create(:label_link, label: label_b, target: issue)
+ create(:label_link, label: label_c, target: issue)
+ end
+ it 'tests N+1' do
+ control = ActiveRecord::QueryRecorder.new do
+ get api('/issues', user), params: { labels: [label.title, label_b.title, label_c.title] }
+ end
+
+ label_d = create(:label, title: 'dar', project: project)
+ label_e = create(:label, title: 'ear', project: project)
+ create(:label_link, label: label_d, target: issue)
+ create(:label_link, label: label_e, target: issue)
+
+ expect do
+ get api('/issues', user), params: { labels: [label.title, label_b.title, label_c.title] }
+ end.not_to exceed_query_limit(control)
+ expect(issue.labels.count).to eq(5)
+ end
+ end
+
+ it 'returns an array of labeled issues' do
+ get api('/issues', user), params: { labels: label.title }
+
+ expect_paginated_array_response(issue.id)
+ expect(json_response.first['labels']).to eq([label.title])
+ end
+
+ it 'returns an array of labeled issues with labels param as array' do
+ get api('/issues', user), params: { labels: [label.title] }
+
+ expect_paginated_array_response(issue.id)
+ expect(json_response.first['labels']).to eq([label.title])
+ end
+
+ context 'with labeled issues' do
+ let(:label_b) { create(:label, title: 'foo', project: project) }
+ let(:label_c) { create(:label, title: 'bar', project: project) }
+
+ before do
+ create(:label_link, label: label_b, target: issue)
+ create(:label_link, label: label_c, target: issue)
+
+ get api('/issues', user), params: params
+ end
+
+ it_behaves_like 'labeled issues with labels and label_name params'
+ end
+
+ it 'returns an empty array if no issue matches labels' do
+ get api('/issues', user), params: { labels: 'foo,bar' }
+
+ expect_paginated_array_response([])
+ end
+
+ it 'returns an empty array if no issue matches labels with labels param as array' do
+ get api('/issues', user), params: { labels: %w(foo bar) }
+
+ expect_paginated_array_response([])
+ end
+
+ it 'returns an array of labeled issues matching given state' do
+ get api('/issues', user), params: { labels: label.title, state: :opened }
+
+ expect_paginated_array_response(issue.id)
+ expect(json_response.first['labels']).to eq([label.title])
+ expect(json_response.first['state']).to eq('opened')
+ end
+
+ it 'returns an array of labeled issues matching given state with labels param as array' do
+ get api('/issues', user), params: { labels: [label.title], state: :opened }
+
+ expect_paginated_array_response(issue.id)
+ expect(json_response.first['labels']).to eq([label.title])
+ expect(json_response.first['state']).to eq('opened')
+ end
+
+ it 'returns an empty array if no issue matches labels and state filters' do
+ get api('/issues', user), params: { labels: label.title, state: :closed }
+
+ expect_paginated_array_response([])
+ end
+
+ it 'returns an array of issues with any label' do
+ get api('/issues', user), params: { labels: IssuesFinder::FILTER_ANY }
+
+ expect_paginated_array_response(issue.id)
+ end
+
+ it 'returns an array of issues with any label with labels param as array' do
+ get api('/issues', user), params: { labels: [IssuesFinder::FILTER_ANY] }
+
+ expect_paginated_array_response(issue.id)
+ end
+
+ it 'returns an array of issues with no label' do
+ get api('/issues', user), params: { labels: IssuesFinder::FILTER_NONE }
+
+ expect_paginated_array_response(closed_issue.id)
+ end
+
+ it 'returns an array of issues with no label with labels param as array' do
+ get api('/issues', user), params: { labels: [IssuesFinder::FILTER_NONE] }
+
+ expect_paginated_array_response(closed_issue.id)
+ end
+
+ it 'returns an array of issues with no label when using the legacy No+Label filter' do
+ get api('/issues', user), params: { labels: 'No Label' }
+
+ expect_paginated_array_response(closed_issue.id)
+ end
+
+ it 'returns an array of issues with no label when using the legacy No+Label filter with labels param as array' do
+ get api('/issues', user), params: { labels: ['No Label'] }
+
+ expect_paginated_array_response(closed_issue.id)
+ end
+ end
+
+ it 'returns an empty array if no issue matches milestone' do
+ get api("/issues?milestone=#{empty_milestone.title}", user)
+
+ expect_paginated_array_response([])
+ end
+
+ it 'returns an empty array if milestone does not exist' do
+ get api('/issues?milestone=foo', user)
+
+ expect_paginated_array_response([])
+ end
+
+ it 'returns an array of issues in given milestone' do
+ get api("/issues?milestone=#{milestone.title}", user)
+
+ expect_paginated_array_response([issue.id, closed_issue.id])
+ end
+
+ it 'returns an array of issues in given milestone_title param' do
+ get api("/issues?milestone_title=#{milestone.title}", user)
+
+ expect_paginated_array_response([issue.id, closed_issue.id])
+ end
+
+ it 'returns an array of issues matching state in milestone' do
+ get api("/issues?milestone=#{milestone.title}&state=closed", user)
+
+ expect_paginated_array_response(closed_issue.id)
+ end
+
+ it 'returns an array of issues with no milestone' do
+ get api("/issues?milestone=#{no_milestone_title}", author)
+
+ expect_paginated_array_response(confidential_issue.id)
+ end
+
+ it 'returns an array of issues with no milestone using milestone_title param' do
+ get api("/issues?milestone_title=#{no_milestone_title}", author)
+
+ expect_paginated_array_response(confidential_issue.id)
+ end
+
+ it 'returns an array of issues found by iids' do
+ get api('/issues', user), params: { iids: [closed_issue.iid] }
+
+ expect_paginated_array_response(closed_issue.id)
+ end
+
+ it 'returns an empty array if iid does not exist' do
+ get api('/issues', user), params: { iids: [0] }
+
+ expect_paginated_array_response([])
+ end
+
+ context 'without sort params' do
+ it 'sorts by created_at descending by default' do
+ get api('/issues', user)
+
+ expect_paginated_array_response([issue.id, closed_issue.id])
+ end
+
+ context 'with 2 issues with same created_at' do
+ let!(:closed_issue2) do
+ create :closed_issue,
+ author: user,
+ assignees: [user],
+ project: project,
+ milestone: milestone,
+ created_at: closed_issue.created_at,
+ updated_at: 1.hour.ago,
+ title: issue_title,
+ description: issue_description
+ end
+
+ it 'page breaks first page correctly' do
+ get api('/issues?per_page=2', user)
+
+ expect_paginated_array_response([issue.id, closed_issue2.id])
+ end
+
+ it 'page breaks second page correctly' do
+ get api('/issues?per_page=2&page=2', user)
+
+ expect_paginated_array_response([closed_issue.id])
+ end
+ end
+ end
+
+ it 'sorts ascending when requested' do
+ get api('/issues?sort=asc', user)
+
+ expect_paginated_array_response([closed_issue.id, issue.id])
+ end
+
+ it 'sorts by updated_at descending when requested' do
+ get api('/issues?order_by=updated_at', user)
+
+ issue.touch(:updated_at)
+
+ expect_paginated_array_response([issue.id, closed_issue.id])
+ end
+
+ it 'sorts by updated_at ascending when requested' do
+ get api('/issues?order_by=updated_at&sort=asc', user)
+
+ issue.touch(:updated_at)
+
+ expect_paginated_array_response([closed_issue.id, issue.id])
+ end
+
+ it 'matches V4 response schema' do
+ get api('/issues', user)
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(response).to match_response_schema('public_api/v4/issues')
+ end
+
+ it 'returns a related merge request count of 0 if there are no related merge requests' do
+ get api('/issues', user)
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(response).to match_response_schema('public_api/v4/issues')
+ expect(json_response.first).to include('merge_requests_count' => 0)
+ end
+
+ it 'returns a related merge request count > 0 if there are related merge requests' do
+ create(:merge_requests_closing_issues, issue: issue)
+
+ get api('/issues', user)
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(response).to match_response_schema('public_api/v4/issues')
+ expect(json_response.first).to include('merge_requests_count' => 1)
+ end
+
+ context 'issues_statistics' do
+ context 'no state is treated as all state' do
+ let(:params) { {} }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'issues statistics'
+ end
+
+ context 'statistics when all state is passed' do
+ let(:params) { { state: :all } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'issues statistics'
+ end
+
+ context 'closed state is treated as all state' do
+ let(:params) { { state: :closed } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'issues statistics'
+ end
+
+ context 'opened state is treated as all state' do
+ let(:params) { { state: :opened } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'issues statistics'
+ end
+
+ context 'when filtering by milestone and no state treated as all state' do
+ let(:params) { { milestone: milestone.title } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'issues statistics'
+ end
+
+ context 'when filtering by milestone and all state' do
+ let(:params) { { milestone: milestone.title, state: :all } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'issues statistics'
+ end
+
+ context 'when filtering by milestone and closed state treated as all state' do
+ let(:params) { { milestone: milestone.title, state: :closed } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'issues statistics'
+ end
+
+ context 'when filtering by milestone and opened state treated as all state' do
+ let(:params) { { milestone: milestone.title, state: :opened } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'issues statistics'
+ end
+
+ context 'sort does not affect statistics ' do
+ let(:params) { { state: :opened, order_by: 'updated_at' } }
+ let(:counts) { { all: 2, closed: 1, opened: 1 } }
+
+ it_behaves_like 'issues statistics'
+ end
+ end
+
+ context 'filtering by assignee_username' do
+ let(:another_assignee) { create(:assignee) }
+ let!(:issue1) { create(:issue, author: user2, project: project, created_at: 3.days.ago) }
+ let!(:issue2) { create(:issue, author: user2, project: project, created_at: 2.days.ago) }
+ let!(:issue3) { create(:issue, author: user2, assignees: [assignee, another_assignee], project: project, created_at: 1.day.ago) }
+
+ it 'returns issues with by assignee_username' do
+ get api("/issues", user), params: { assignee_username: [assignee.username], scope: 'all' }
+
+ expect(issue3.reload.assignees.pluck(:id)).to match_array([assignee.id, another_assignee.id])
+ expect_paginated_array_response([confidential_issue.id, issue3.id])
+ end
+
+ it 'returns issues by assignee_username as string' do
+ get api("/issues", user), params: { assignee_username: assignee.username, scope: 'all' }
+
+ expect(issue3.reload.assignees.pluck(:id)).to match_array([assignee.id, another_assignee.id])
+ expect_paginated_array_response([confidential_issue.id, issue3.id])
+ end
+
+ it 'returns error when multiple assignees are passed' do
+ get api("/issues", user), params: { assignee_username: [assignee.username, another_assignee.username], scope: 'all' }
+
+ expect(response).to have_gitlab_http_status(400)
+ expect(json_response["error"]).to include("allows one value, but found 2")
+ end
+
+ it 'returns error when assignee_username and assignee_id are passed together' do
+ get api("/issues", user), params: { assignee_username: [assignee.username], assignee_id: another_assignee.id, scope: 'all' }
+
+ expect(response).to have_gitlab_http_status(400)
+ expect(json_response["error"]).to include("mutually exclusive")
+ end
+ end
+ end
+ end
+
+ describe 'DELETE /projects/:id/issues/:issue_iid' do
+ it 'rejects a non member from deleting an issue' do
+ delete api("/projects/#{project.id}/issues/#{issue.iid}", non_member)
+ expect(response).to have_gitlab_http_status(403)
+ end
+
+ it 'rejects a developer from deleting an issue' do
+ delete api("/projects/#{project.id}/issues/#{issue.iid}", author)
+ expect(response).to have_gitlab_http_status(403)
+ end
+
+ context 'when the user is project owner' do
+ let(:owner) { create(:user) }
+ let(:project) { create(:project, namespace: owner.namespace) }
+
+ it 'deletes the issue if an admin requests it' do
+ delete api("/projects/#{project.id}/issues/#{issue.iid}", owner)
+
+ expect(response).to have_gitlab_http_status(204)
+ end
+
+ it_behaves_like '412 response' do
+ let(:request) { api("/projects/#{project.id}/issues/#{issue.iid}", owner) }
+ end
+ end
+
+ context 'when issue does not exist' do
+ it 'returns 404 when trying to move an issue' do
+ delete api("/projects/#{project.id}/issues/123", user)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+ end
+
+ it 'returns 404 when using the issue ID instead of IID' do
+ delete api("/projects/#{project.id}/issues/#{issue.id}", user)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+ end
+
+ describe 'time tracking endpoints' do
+ let(:issuable) { issue }
+
+ include_examples 'time tracking endpoints', 'issue'
+ end
+end
diff --git a/spec/requests/api/issues/post_projects_issues_spec.rb b/spec/requests/api/issues/post_projects_issues_spec.rb
new file mode 100644
index 00000000000..b74e8867310
--- /dev/null
+++ b/spec/requests/api/issues/post_projects_issues_spec.rb
@@ -0,0 +1,549 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe API::Issues do
+ set(:user) { create(:user) }
+ set(:project) do
+ create(:project, :public, creator_id: user.id, namespace: user.namespace)
+ end
+
+ let(:user2) { create(:user) }
+ let(:non_member) { create(:user) }
+ set(:guest) { create(:user) }
+ set(:author) { create(:author) }
+ set(:assignee) { create(:assignee) }
+ let(:admin) { create(:user, :admin) }
+ let(:issue_title) { 'foo' }
+ let(:issue_description) { 'closed' }
+ let!(:closed_issue) do
+ create :closed_issue,
+ author: user,
+ assignees: [user],
+ project: project,
+ state: :closed,
+ milestone: milestone,
+ created_at: generate(:past_time),
+ updated_at: 3.hours.ago,
+ closed_at: 1.hour.ago
+ end
+ let!(:confidential_issue) do
+ create :issue,
+ :confidential,
+ project: project,
+ author: author,
+ assignees: [assignee],
+ created_at: generate(:past_time),
+ updated_at: 2.hours.ago
+ end
+ let!(:issue) do
+ create :issue,
+ author: user,
+ assignees: [user],
+ project: project,
+ milestone: milestone,
+ created_at: generate(:past_time),
+ updated_at: 1.hour.ago,
+ title: issue_title,
+ description: issue_description
+ end
+ set(:label) do
+ create(:label, title: 'label', color: '#FFAABB', project: project)
+ end
+ let!(:label_link) { create(:label_link, label: label, target: issue) }
+ let(:milestone) { create(:milestone, title: '1.0.0', project: project) }
+ set(:empty_milestone) do
+ create(:milestone, title: '2.0.0', project: project)
+ end
+ let!(:note) { create(:note_on_issue, author: user, project: project, noteable: issue) }
+
+ let(:no_milestone_title) { 'None' }
+ let(:any_milestone_title) { 'Any' }
+
+ before(:all) do
+ project.add_reporter(user)
+ project.add_guest(guest)
+ end
+
+ before do
+ stub_licensed_features(multiple_issue_assignees: false, issue_weights: false)
+ end
+
+ describe 'POST /projects/:id/issues' do
+ context 'support for deprecated assignee_id' do
+ it 'creates a new project issue' do
+ post api("/projects/#{project.id}/issues", user),
+ params: { title: 'new issue', assignee_id: user2.id }
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(json_response['title']).to eq('new issue')
+ expect(json_response['assignee']['name']).to eq(user2.name)
+ expect(json_response['assignees'].first['name']).to eq(user2.name)
+ end
+
+ it 'creates a new project issue when assignee_id is empty' do
+ post api("/projects/#{project.id}/issues", user),
+ params: { title: 'new issue', assignee_id: '' }
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(json_response['title']).to eq('new issue')
+ expect(json_response['assignee']).to be_nil
+ end
+ end
+
+ context 'single assignee restrictions' do
+ it 'creates a new project issue with no more than one assignee' do
+ post api("/projects/#{project.id}/issues", user),
+ params: { title: 'new issue', assignee_ids: [user2.id, guest.id] }
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(json_response['title']).to eq('new issue')
+ expect(json_response['assignees'].count).to eq(1)
+ end
+ end
+
+ context 'user does not have permissions to create issue' do
+ let(:not_member) { create(:user) }
+
+ before do
+ project.project_feature.update(issues_access_level: ProjectFeature::PRIVATE)
+ end
+
+ it 'renders 403' do
+ post api("/projects/#{project.id}/issues", not_member), params: { title: 'new issue' }
+
+ expect(response).to have_gitlab_http_status(403)
+ end
+ end
+
+ context 'an internal ID is provided' do
+ context 'by an admin' do
+ it 'sets the internal ID on the new issue' do
+ post api("/projects/#{project.id}/issues", admin),
+ params: { title: 'new issue', iid: 9001 }
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(json_response['iid']).to eq 9001
+ end
+ end
+
+ context 'by an owner' do
+ it 'sets the internal ID on the new issue' do
+ post api("/projects/#{project.id}/issues", user),
+ params: { title: 'new issue', iid: 9001 }
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(json_response['iid']).to eq 9001
+ end
+ end
+
+ context 'by a group owner' do
+ let(:group) { create(:group) }
+ let(:group_project) { create(:project, :public, namespace: group) }
+
+ it 'sets the internal ID on the new issue' do
+ group.add_owner(user2)
+ post api("/projects/#{group_project.id}/issues", user2),
+ params: { title: 'new issue', iid: 9001 }
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(json_response['iid']).to eq 9001
+ end
+ end
+
+ context 'by another user' do
+ it 'ignores the given internal ID' do
+ post api("/projects/#{project.id}/issues", user2),
+ params: { title: 'new issue', iid: 9001 }
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(json_response['iid']).not_to eq 9001
+ end
+ end
+ end
+
+ it 'creates a new project issue' do
+ post api("/projects/#{project.id}/issues", user),
+ params: { title: 'new issue', labels: 'label, label2', weight: 3, assignee_ids: [user2.id] }
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(json_response['title']).to eq('new issue')
+ expect(json_response['description']).to be_nil
+ expect(json_response['labels']).to eq(%w(label label2))
+ expect(json_response['confidential']).to be_falsy
+ expect(json_response['assignee']['name']).to eq(user2.name)
+ expect(json_response['assignees'].first['name']).to eq(user2.name)
+ end
+
+ it 'creates a new project issue with labels param as array' do
+ post api("/projects/#{project.id}/issues", user),
+ params: { title: 'new issue', labels: %w(label label2), weight: 3, assignee_ids: [user2.id] }
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(json_response['title']).to eq('new issue')
+ expect(json_response['description']).to be_nil
+ expect(json_response['labels']).to eq(%w(label label2))
+ expect(json_response['confidential']).to be_falsy
+ expect(json_response['assignee']['name']).to eq(user2.name)
+ expect(json_response['assignees'].first['name']).to eq(user2.name)
+ end
+
+ it 'creates a new confidential project issue' do
+ post api("/projects/#{project.id}/issues", user),
+ params: { title: 'new issue', confidential: true }
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(json_response['title']).to eq('new issue')
+ expect(json_response['confidential']).to be_truthy
+ end
+
+ it 'creates a new confidential project issue with a different param' do
+ post api("/projects/#{project.id}/issues", user),
+ params: { title: 'new issue', confidential: 'y' }
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(json_response['title']).to eq('new issue')
+ expect(json_response['confidential']).to be_truthy
+ end
+
+ it 'creates a public issue when confidential param is false' do
+ post api("/projects/#{project.id}/issues", user),
+ params: { title: 'new issue', confidential: false }
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(json_response['title']).to eq('new issue')
+ expect(json_response['confidential']).to be_falsy
+ end
+
+ it 'creates a public issue when confidential param is invalid' do
+ post api("/projects/#{project.id}/issues", user),
+ params: { title: 'new issue', confidential: 'foo' }
+
+ expect(response).to have_gitlab_http_status(400)
+ expect(json_response['error']).to eq('confidential is invalid')
+ end
+
+ it 'returns a 400 bad request if title not given' do
+ post api("/projects/#{project.id}/issues", user), params: { labels: 'label, label2' }
+ expect(response).to have_gitlab_http_status(400)
+ end
+
+ it 'allows special label names' do
+ post api("/projects/#{project.id}/issues", user),
+ params: {
+ title: 'new issue',
+ labels: 'label, label?, label&foo, ?, &'
+ }
+ expect(response.status).to eq(201)
+ expect(json_response['labels']).to include 'label'
+ expect(json_response['labels']).to include 'label?'
+ expect(json_response['labels']).to include 'label&foo'
+ expect(json_response['labels']).to include '?'
+ expect(json_response['labels']).to include '&'
+ end
+
+ it 'allows special label names with labels param as array' do
+ post api("/projects/#{project.id}/issues", user),
+ params: {
+ title: 'new issue',
+ labels: ['label', 'label?', 'label&foo, ?, &']
+ }
+ expect(response.status).to eq(201)
+ expect(json_response['labels']).to include 'label'
+ expect(json_response['labels']).to include 'label?'
+ expect(json_response['labels']).to include 'label&foo'
+ expect(json_response['labels']).to include '?'
+ expect(json_response['labels']).to include '&'
+ end
+
+ it 'returns 400 if title is too long' do
+ post api("/projects/#{project.id}/issues", user),
+ params: { title: 'g' * 256 }
+ expect(response).to have_gitlab_http_status(400)
+ expect(json_response['message']['title']).to eq([
+ 'is too long (maximum is 255 characters)'
+ ])
+ end
+
+ context 'resolving discussions' do
+ let(:discussion) { create(:diff_note_on_merge_request).to_discussion }
+ let(:merge_request) { discussion.noteable }
+ let(:project) { merge_request.source_project }
+
+ before do
+ project.add_maintainer(user)
+ end
+
+ context 'resolving all discussions in a merge request' do
+ before do
+ post api("/projects/#{project.id}/issues", user),
+ params: {
+ title: 'New Issue',
+ merge_request_to_resolve_discussions_of: merge_request.iid
+ }
+ end
+
+ it_behaves_like 'creating an issue resolving discussions through the API'
+ end
+
+ context 'resolving a single discussion' do
+ before do
+ post api("/projects/#{project.id}/issues", user),
+ params: {
+ title: 'New Issue',
+ merge_request_to_resolve_discussions_of: merge_request.iid,
+ discussion_to_resolve: discussion.id
+ }
+ end
+
+ it_behaves_like 'creating an issue resolving discussions through the API'
+ end
+ end
+
+ context 'with due date' do
+ it 'creates a new project issue' do
+ due_date = 2.weeks.from_now.strftime('%Y-%m-%d')
+
+ post api("/projects/#{project.id}/issues", user),
+ params: { title: 'new issue', due_date: due_date }
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(json_response['title']).to eq('new issue')
+ expect(json_response['description']).to be_nil
+ expect(json_response['due_date']).to eq(due_date)
+ end
+ end
+
+ context 'setting created_at' do
+ let(:creation_time) { 2.weeks.ago }
+ let(:params) { { title: 'new issue', labels: 'label, label2', created_at: creation_time } }
+
+ context 'by an admin' do
+ it 'sets the creation time on the new issue' do
+ post api("/projects/#{project.id}/issues", admin), params: params
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(Time.parse(json_response['created_at'])).to be_like_time(creation_time)
+ end
+ end
+
+ context 'by a project owner' do
+ it 'sets the creation time on the new issue' do
+ post api("/projects/#{project.id}/issues", user), params: params
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(Time.parse(json_response['created_at'])).to be_like_time(creation_time)
+ end
+ end
+
+ context 'by a group owner' do
+ it 'sets the creation time on the new issue' do
+ group = create(:group)
+ group_project = create(:project, :public, namespace: group)
+ group.add_owner(user2)
+ post api("/projects/#{group_project.id}/issues", user2), params: params
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(Time.parse(json_response['created_at'])).to be_like_time(creation_time)
+ end
+ end
+
+ context 'by another user' do
+ it 'ignores the given creation time' do
+ post api("/projects/#{project.id}/issues", user2), params: params
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(Time.parse(json_response['created_at'])).not_to be_like_time(creation_time)
+ end
+ end
+ end
+
+ context 'the user can only read the issue' do
+ it 'cannot create new labels' do
+ expect do
+ post api("/projects/#{project.id}/issues", non_member), params: { title: 'new issue', labels: 'label, label2' }
+ end.not_to change { project.labels.count }
+ end
+
+ it 'cannot create new labels with labels param as array' do
+ expect do
+ post api("/projects/#{project.id}/issues", non_member), params: { title: 'new issue', labels: %w(label label2) }
+ end.not_to change { project.labels.count }
+ end
+ end
+ end
+
+ describe 'POST /projects/:id/issues with spam filtering' do
+ before do
+ allow_any_instance_of(SpamService).to receive(:check_for_spam?).and_return(true)
+ allow_any_instance_of(AkismetService).to receive_messages(spam?: true)
+ end
+
+ let(:params) do
+ {
+ title: 'new issue',
+ description: 'content here',
+ labels: 'label, label2'
+ }
+ end
+
+ it 'does not create a new project issue' do
+ expect { post api("/projects/#{project.id}/issues", user), params: params }.not_to change(Issue, :count)
+ expect(response).to have_gitlab_http_status(400)
+ expect(json_response['message']).to eq({ 'error' => 'Spam detected' })
+
+ spam_logs = SpamLog.all
+ expect(spam_logs.count).to eq(1)
+ expect(spam_logs[0].title).to eq('new issue')
+ expect(spam_logs[0].description).to eq('content here')
+ expect(spam_logs[0].user).to eq(user)
+ expect(spam_logs[0].noteable_type).to eq('Issue')
+ end
+ end
+
+ describe '/projects/:id/issues/:issue_iid/move' do
+ let!(:target_project) { create(:project, creator_id: user.id, namespace: user.namespace ) }
+ let!(:target_project2) { create(:project, creator_id: non_member.id, namespace: non_member.namespace ) }
+
+ it 'moves an issue' do
+ post api("/projects/#{project.id}/issues/#{issue.iid}/move", user),
+ params: { to_project_id: target_project.id }
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(json_response['project_id']).to eq(target_project.id)
+ end
+
+ context 'when source and target projects are the same' do
+ it 'returns 400 when trying to move an issue' do
+ post api("/projects/#{project.id}/issues/#{issue.iid}/move", user),
+ params: { to_project_id: project.id }
+
+ expect(response).to have_gitlab_http_status(400)
+ expect(json_response['message']).to eq('Cannot move issue to project it originates from!')
+ end
+ end
+
+ context 'when the user does not have the permission to move issues' do
+ it 'returns 400 when trying to move an issue' do
+ post api("/projects/#{project.id}/issues/#{issue.iid}/move", user),
+ params: { to_project_id: target_project2.id }
+
+ expect(response).to have_gitlab_http_status(400)
+ expect(json_response['message']).to eq('Cannot move issue due to insufficient permissions!')
+ end
+ end
+
+ it 'moves the issue to another namespace if I am admin' do
+ post api("/projects/#{project.id}/issues/#{issue.iid}/move", admin),
+ params: { to_project_id: target_project2.id }
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(json_response['project_id']).to eq(target_project2.id)
+ end
+
+ context 'when using the issue ID instead of iid' do
+ it 'returns 404 when trying to move an issue' do
+ post api("/projects/#{project.id}/issues/#{issue.id}/move", user),
+ params: { to_project_id: target_project.id }
+
+ expect(response).to have_gitlab_http_status(404)
+ expect(json_response['message']).to eq('404 Issue Not Found')
+ end
+ end
+
+ context 'when issue does not exist' do
+ it 'returns 404 when trying to move an issue' do
+ post api("/projects/#{project.id}/issues/123/move", user),
+ params: { to_project_id: target_project.id }
+
+ expect(response).to have_gitlab_http_status(404)
+ expect(json_response['message']).to eq('404 Issue Not Found')
+ end
+ end
+
+ context 'when source project does not exist' do
+ it 'returns 404 when trying to move an issue' do
+ post api("/projects/0/issues/#{issue.iid}/move", user),
+ params: { to_project_id: target_project.id }
+
+ expect(response).to have_gitlab_http_status(404)
+ expect(json_response['message']).to eq('404 Project Not Found')
+ end
+ end
+
+ context 'when target project does not exist' do
+ it 'returns 404 when trying to move an issue' do
+ post api("/projects/#{project.id}/issues/#{issue.iid}/move", user),
+ params: { to_project_id: 0 }
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+ end
+ end
+
+ describe 'POST :id/issues/:issue_iid/subscribe' do
+ it 'subscribes to an issue' do
+ post api("/projects/#{project.id}/issues/#{issue.iid}/subscribe", user2)
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(json_response['subscribed']).to eq(true)
+ end
+
+ it 'returns 304 if already subscribed' do
+ post api("/projects/#{project.id}/issues/#{issue.iid}/subscribe", user)
+
+ expect(response).to have_gitlab_http_status(304)
+ end
+
+ it 'returns 404 if the issue is not found' do
+ post api("/projects/#{project.id}/issues/123/subscribe", user)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+
+ it 'returns 404 if the issue ID is used instead of the iid' do
+ post api("/projects/#{project.id}/issues/#{issue.id}/subscribe", user)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+
+ it 'returns 404 if the issue is confidential' do
+ post api("/projects/#{project.id}/issues/#{confidential_issue.iid}/subscribe", non_member)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+ end
+
+ describe 'POST :id/issues/:issue_id/unsubscribe' do
+ it 'unsubscribes from an issue' do
+ post api("/projects/#{project.id}/issues/#{issue.iid}/unsubscribe", user)
+
+ expect(response).to have_gitlab_http_status(201)
+ expect(json_response['subscribed']).to eq(false)
+ end
+
+ it 'returns 304 if not subscribed' do
+ post api("/projects/#{project.id}/issues/#{issue.iid}/unsubscribe", user2)
+
+ expect(response).to have_gitlab_http_status(304)
+ end
+
+ it 'returns 404 if the issue is not found' do
+ post api("/projects/#{project.id}/issues/123/unsubscribe", user)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+
+ it 'returns 404 if using the issue ID instead of iid' do
+ post api("/projects/#{project.id}/issues/#{issue.id}/unsubscribe", user)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+
+ it 'returns 404 if the issue is confidential' do
+ post api("/projects/#{project.id}/issues/#{confidential_issue.iid}/unsubscribe", non_member)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+ end
+end
diff --git a/spec/requests/api/issues/put_projects_issues_spec.rb b/spec/requests/api/issues/put_projects_issues_spec.rb
new file mode 100644
index 00000000000..267cba93713
--- /dev/null
+++ b/spec/requests/api/issues/put_projects_issues_spec.rb
@@ -0,0 +1,392 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe API::Issues do
+ set(:user) { create(:user) }
+ set(:project) do
+ create(:project, :public, creator_id: user.id, namespace: user.namespace)
+ end
+
+ let(:user2) { create(:user) }
+ let(:non_member) { create(:user) }
+ set(:guest) { create(:user) }
+ set(:author) { create(:author) }
+ set(:assignee) { create(:assignee) }
+ let(:admin) { create(:user, :admin) }
+ let(:issue_title) { 'foo' }
+ let(:issue_description) { 'closed' }
+ let!(:closed_issue) do
+ create :closed_issue,
+ author: user,
+ assignees: [user],
+ project: project,
+ state: :closed,
+ milestone: milestone,
+ created_at: generate(:past_time),
+ updated_at: 3.hours.ago,
+ closed_at: 1.hour.ago
+ end
+ let!(:confidential_issue) do
+ create :issue,
+ :confidential,
+ project: project,
+ author: author,
+ assignees: [assignee],
+ created_at: generate(:past_time),
+ updated_at: 2.hours.ago
+ end
+ let!(:issue) do
+ create :issue,
+ author: user,
+ assignees: [user],
+ project: project,
+ milestone: milestone,
+ created_at: generate(:past_time),
+ updated_at: 1.hour.ago,
+ title: issue_title,
+ description: issue_description
+ end
+ set(:label) do
+ create(:label, title: 'label', color: '#FFAABB', project: project)
+ end
+ let!(:label_link) { create(:label_link, label: label, target: issue) }
+ let(:milestone) { create(:milestone, title: '1.0.0', project: project) }
+ set(:empty_milestone) do
+ create(:milestone, title: '2.0.0', project: project)
+ end
+ let!(:note) { create(:note_on_issue, author: user, project: project, noteable: issue) }
+
+ let(:no_milestone_title) { 'None' }
+ let(:any_milestone_title) { 'Any' }
+
+ before(:all) do
+ project.add_reporter(user)
+ project.add_guest(guest)
+ end
+
+ before do
+ stub_licensed_features(multiple_issue_assignees: false, issue_weights: false)
+ end
+
+ describe 'PUT /projects/:id/issues/:issue_iid to update only title' do
+ it 'updates a project issue' do
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user),
+ params: { title: 'updated title' }
+ expect(response).to have_gitlab_http_status(200)
+
+ expect(json_response['title']).to eq('updated title')
+ end
+
+ it 'returns 404 error if issue iid not found' do
+ put api("/projects/#{project.id}/issues/44444", user),
+ params: { title: 'updated title' }
+ expect(response).to have_gitlab_http_status(404)
+ end
+
+ it 'returns 404 error if issue id is used instead of the iid' do
+ put api("/projects/#{project.id}/issues/#{issue.id}", user),
+ params: { title: 'updated title' }
+ expect(response).to have_gitlab_http_status(404)
+ end
+
+ it 'allows special label names' do
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user),
+ params: {
+ title: 'updated title',
+ labels: 'label, label?, label&foo, ?, &'
+ }
+
+ expect(response.status).to eq(200)
+ expect(json_response['labels']).to include 'label'
+ expect(json_response['labels']).to include 'label?'
+ expect(json_response['labels']).to include 'label&foo'
+ expect(json_response['labels']).to include '?'
+ expect(json_response['labels']).to include '&'
+ end
+
+ it 'allows special label names with labels param as array' do
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user),
+ params: {
+ title: 'updated title',
+ labels: ['label', 'label?', 'label&foo, ?, &']
+ }
+
+ expect(response.status).to eq(200)
+ expect(json_response['labels']).to include 'label'
+ expect(json_response['labels']).to include 'label?'
+ expect(json_response['labels']).to include 'label&foo'
+ expect(json_response['labels']).to include '?'
+ expect(json_response['labels']).to include '&'
+ end
+
+ context 'confidential issues' do
+ it 'returns 403 for non project members' do
+ put api("/projects/#{project.id}/issues/#{confidential_issue.iid}", non_member),
+ params: { title: 'updated title' }
+ expect(response).to have_gitlab_http_status(403)
+ end
+
+ it 'returns 403 for project members with guest role' do
+ put api("/projects/#{project.id}/issues/#{confidential_issue.iid}", guest),
+ params: { title: 'updated title' }
+ expect(response).to have_gitlab_http_status(403)
+ end
+
+ it 'updates a confidential issue for project members' do
+ put api("/projects/#{project.id}/issues/#{confidential_issue.iid}", user),
+ params: { title: 'updated title' }
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['title']).to eq('updated title')
+ end
+
+ it 'updates a confidential issue for author' do
+ put api("/projects/#{project.id}/issues/#{confidential_issue.iid}", author),
+ params: { title: 'updated title' }
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['title']).to eq('updated title')
+ end
+
+ it 'updates a confidential issue for admin' do
+ put api("/projects/#{project.id}/issues/#{confidential_issue.iid}", admin),
+ params: { title: 'updated title' }
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['title']).to eq('updated title')
+ end
+
+ it 'sets an issue to confidential' do
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user),
+ params: { confidential: true }
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['confidential']).to be_truthy
+ end
+
+ it 'makes a confidential issue public' do
+ put api("/projects/#{project.id}/issues/#{confidential_issue.iid}", user),
+ params: { confidential: false }
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['confidential']).to be_falsy
+ end
+
+ it 'does not update a confidential issue with wrong confidential flag' do
+ put api("/projects/#{project.id}/issues/#{confidential_issue.iid}", user),
+ params: { confidential: 'foo' }
+
+ expect(response).to have_gitlab_http_status(400)
+ expect(json_response['error']).to eq('confidential is invalid')
+ end
+ end
+ end
+
+ describe 'PUT /projects/:id/issues/:issue_iid with spam filtering' do
+ let(:params) do
+ {
+ title: 'updated title',
+ description: 'content here',
+ labels: 'label, label2'
+ }
+ end
+
+ it 'does not create a new project issue' do
+ allow_any_instance_of(SpamService).to receive_messages(check_for_spam?: true)
+ allow_any_instance_of(AkismetService).to receive_messages(spam?: true)
+
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user), params: params
+
+ expect(response).to have_gitlab_http_status(400)
+ expect(json_response['message']).to eq({ 'error' => 'Spam detected' })
+
+ spam_logs = SpamLog.all
+ expect(spam_logs.count).to eq(1)
+ expect(spam_logs[0].title).to eq('updated title')
+ expect(spam_logs[0].description).to eq('content here')
+ expect(spam_logs[0].user).to eq(user)
+ expect(spam_logs[0].noteable_type).to eq('Issue')
+ end
+ end
+
+ describe 'PUT /projects/:id/issues/:issue_iid to update assignee' do
+ context 'support for deprecated assignee_id' do
+ it 'removes assignee' do
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user),
+ params: { assignee_id: 0 }
+
+ expect(response).to have_gitlab_http_status(200)
+
+ expect(json_response['assignee']).to be_nil
+ end
+
+ it 'updates an issue with new assignee' do
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user),
+ params: { assignee_id: user2.id }
+
+ expect(response).to have_gitlab_http_status(200)
+
+ expect(json_response['assignee']['name']).to eq(user2.name)
+ end
+ end
+
+ it 'removes assignee' do
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user),
+ params: { assignee_ids: [0] }
+
+ expect(response).to have_gitlab_http_status(200)
+
+ expect(json_response['assignees']).to be_empty
+ end
+
+ it 'updates an issue with new assignee' do
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user),
+ params: { assignee_ids: [user2.id] }
+
+ expect(response).to have_gitlab_http_status(200)
+
+ expect(json_response['assignees'].first['name']).to eq(user2.name)
+ end
+
+ context 'single assignee restrictions' do
+ it 'updates an issue with several assignees but only one has been applied' do
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user),
+ params: { assignee_ids: [user2.id, guest.id] }
+
+ expect(response).to have_gitlab_http_status(200)
+
+ expect(json_response['assignees'].size).to eq(1)
+ end
+ end
+ end
+
+ describe 'PUT /projects/:id/issues/:issue_iid to update labels' do
+ let!(:label) { create(:label, title: 'dummy', project: project) }
+ let!(:label_link) { create(:label_link, label: label, target: issue) }
+
+ it 'does not update labels if not present' do
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user),
+ params: { title: 'updated title' }
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['labels']).to eq([label.title])
+ end
+
+ it 'removes all labels and touches the record' do
+ Timecop.travel(1.minute.from_now) do
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user), params: { labels: '' }
+ end
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['labels']).to eq([])
+ expect(json_response['updated_at']).to be > Time.now
+ end
+
+ it 'removes all labels and touches the record with labels param as array' do
+ Timecop.travel(1.minute.from_now) do
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user), params: { labels: [''] }
+ end
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['labels']).to eq([])
+ expect(json_response['updated_at']).to be > Time.now
+ end
+
+ it 'updates labels and touches the record' do
+ Timecop.travel(1.minute.from_now) do
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user),
+ params: { labels: 'foo,bar' }
+ end
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['labels']).to include 'foo'
+ expect(json_response['labels']).to include 'bar'
+ expect(json_response['updated_at']).to be > Time.now
+ end
+
+ it 'updates labels and touches the record with labels param as array' do
+ Timecop.travel(1.minute.from_now) do
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user),
+ params: { labels: %w(foo bar) }
+ end
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['labels']).to include 'foo'
+ expect(json_response['labels']).to include 'bar'
+ expect(json_response['updated_at']).to be > Time.now
+ end
+
+ it 'allows special label names' do
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user),
+ params: { labels: 'label:foo, label-bar,label_bar,label/bar,label?bar,label&bar,?,&' }
+ expect(response.status).to eq(200)
+ expect(json_response['labels']).to include 'label:foo'
+ expect(json_response['labels']).to include 'label-bar'
+ expect(json_response['labels']).to include 'label_bar'
+ expect(json_response['labels']).to include 'label/bar'
+ expect(json_response['labels']).to include 'label?bar'
+ expect(json_response['labels']).to include 'label&bar'
+ expect(json_response['labels']).to include '?'
+ expect(json_response['labels']).to include '&'
+ end
+
+ it 'allows special label names with labels param as array' do
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user),
+ params: { labels: ['label:foo', 'label-bar', 'label_bar', 'label/bar,label?bar,label&bar,?,&'] }
+ expect(response.status).to eq(200)
+ expect(json_response['labels']).to include 'label:foo'
+ expect(json_response['labels']).to include 'label-bar'
+ expect(json_response['labels']).to include 'label_bar'
+ expect(json_response['labels']).to include 'label/bar'
+ expect(json_response['labels']).to include 'label?bar'
+ expect(json_response['labels']).to include 'label&bar'
+ expect(json_response['labels']).to include '?'
+ expect(json_response['labels']).to include '&'
+ end
+
+ it 'returns 400 if title is too long' do
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user),
+ params: { title: 'g' * 256 }
+ expect(response).to have_gitlab_http_status(400)
+ expect(json_response['message']['title']).to eq([
+ 'is too long (maximum is 255 characters)'
+ ])
+ end
+ end
+
+ describe 'PUT /projects/:id/issues/:issue_iid to update state and label' do
+ it 'updates a project issue' do
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user),
+ params: { labels: 'label2', state_event: 'close' }
+ expect(response).to have_gitlab_http_status(200)
+
+ expect(json_response['labels']).to include 'label2'
+ expect(json_response['state']).to eq 'closed'
+ end
+
+ it 'reopens a project isssue' do
+ put api("/projects/#{project.id}/issues/#{closed_issue.iid}", user), params: { state_event: 'reopen' }
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['state']).to eq 'opened'
+ end
+
+ context 'when an admin or owner makes the request' do
+ it 'accepts the update date to be set' do
+ update_time = 2.weeks.ago
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user),
+ params: { labels: 'label3', state_event: 'close', updated_at: update_time }
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['labels']).to include 'label3'
+ expect(Time.parse(json_response['updated_at'])).to be_like_time(update_time)
+ end
+ end
+ end
+
+ describe 'PUT /projects/:id/issues/:issue_iid to update due date' do
+ it 'creates a new project issue' do
+ due_date = 2.weeks.from_now.strftime('%Y-%m-%d')
+
+ put api("/projects/#{project.id}/issues/#{issue.iid}", user), params: { due_date: due_date }
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['due_date']).to eq(due_date)
+ end
+ end
+end
diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb
deleted file mode 100644
index 0fa34688371..00000000000
--- a/spec/requests/api/issues_spec.rb
+++ /dev/null
@@ -1,2265 +0,0 @@
-require 'spec_helper'
-
-describe API::Issues do
- set(:user) { create(:user) }
- set(:project) do
- create(:project, :public, creator_id: user.id, namespace: user.namespace)
- end
-
- let(:user2) { create(:user) }
- let(:non_member) { create(:user) }
- set(:guest) { create(:user) }
- set(:author) { create(:author) }
- set(:assignee) { create(:assignee) }
- let(:admin) { create(:user, :admin) }
- let(:issue_title) { 'foo' }
- let(:issue_description) { 'closed' }
- let!(:closed_issue) do
- create :closed_issue,
- author: user,
- assignees: [user],
- project: project,
- state: :closed,
- milestone: milestone,
- created_at: generate(:past_time),
- updated_at: 3.hours.ago,
- closed_at: 1.hour.ago
- end
- let!(:confidential_issue) do
- create :issue,
- :confidential,
- project: project,
- author: author,
- assignees: [assignee],
- created_at: generate(:past_time),
- updated_at: 2.hours.ago
- end
- let!(:issue) do
- create :issue,
- author: user,
- assignees: [user],
- project: project,
- milestone: milestone,
- created_at: generate(:past_time),
- updated_at: 1.hour.ago,
- title: issue_title,
- description: issue_description
- end
- set(:label) do
- create(:label, title: 'label', color: '#FFAABB', project: project)
- end
- let!(:label_link) { create(:label_link, label: label, target: issue) }
- let(:milestone) { create(:milestone, title: '1.0.0', project: project) }
- set(:empty_milestone) do
- create(:milestone, title: '2.0.0', project: project)
- end
- let!(:note) { create(:note_on_issue, author: user, project: project, noteable: issue) }
-
- let(:no_milestone_title) { "None" }
- let(:any_milestone_title) { "Any" }
-
- before(:all) do
- project.add_reporter(user)
- project.add_guest(guest)
- end
-
- describe "GET /issues" do
- context "when unauthenticated" do
- it "returns an array of all issues" do
- get api("/issues"), params: { scope: 'all' }
-
- expect(response).to have_http_status(200)
- expect(json_response).to be_an Array
- end
-
- it "returns authentication error without any scope" do
- get api("/issues")
-
- expect(response).to have_http_status(401)
- end
-
- it "returns authentication error when scope is assigned-to-me" do
- get api("/issues"), params: { scope: 'assigned-to-me' }
-
- expect(response).to have_http_status(401)
- end
-
- it "returns authentication error when scope is created-by-me" do
- get api("/issues"), params: { scope: 'created-by-me' }
-
- expect(response).to have_http_status(401)
- end
- end
-
- context "when authenticated" do
- it "returns an array of issues" do
- get api("/issues", user)
-
- expect_paginated_array_response([issue.id, closed_issue.id])
- expect(json_response.first['title']).to eq(issue.title)
- expect(json_response.last).to have_key('web_url')
- end
-
- it 'returns an array of closed issues' do
- get api('/issues', user), params: { state: :closed }
-
- expect_paginated_array_response(closed_issue.id)
- end
-
- it 'returns an array of opened issues' do
- get api('/issues', user), params: { state: :opened }
-
- expect_paginated_array_response(issue.id)
- end
-
- it 'returns an array of all issues' do
- get api('/issues', user), params: { state: :all }
-
- expect_paginated_array_response([issue.id, closed_issue.id])
- end
-
- it 'returns issues assigned to me' do
- issue2 = create(:issue, assignees: [user2], project: project)
-
- get api('/issues', user2), params: { scope: 'assigned_to_me' }
-
- expect_paginated_array_response(issue2.id)
- end
-
- it 'returns issues assigned to me (kebab-case)' do
- issue2 = create(:issue, assignees: [user2], project: project)
-
- get api('/issues', user2), params: { scope: 'assigned-to-me' }
-
- expect_paginated_array_response(issue2.id)
- end
-
- it 'returns issues authored by the given author id' do
- issue2 = create(:issue, author: user2, project: project)
-
- get api('/issues', user), params: { author_id: user2.id, scope: 'all' }
-
- expect_paginated_array_response(issue2.id)
- end
-
- it 'returns issues assigned to the given assignee id' do
- issue2 = create(:issue, assignees: [user2], project: project)
-
- get api('/issues', user), params: { assignee_id: user2.id, scope: 'all' }
-
- expect_paginated_array_response(issue2.id)
- end
-
- it 'returns issues authored by the given author id and assigned to the given assignee id' do
- issue2 = create(:issue, author: user2, assignees: [user2], project: project)
-
- get api('/issues', user), params: { author_id: user2.id, assignee_id: user2.id, scope: 'all' }
-
- expect_paginated_array_response(issue2.id)
- end
-
- it 'returns issues with no assignee' do
- issue2 = create(:issue, author: user2, project: project)
-
- get api('/issues', user), params: { assignee_id: 0, scope: 'all' }
-
- expect_paginated_array_response(issue2.id)
- end
-
- it 'returns issues with no assignee' do
- issue2 = create(:issue, author: user2, project: project)
-
- get api('/issues', user), params: { assignee_id: 'None', scope: 'all' }
-
- expect_paginated_array_response(issue2.id)
- end
-
- it 'returns issues with any assignee' do
- # This issue without assignee should not be returned
- create(:issue, author: user2, project: project)
-
- get api('/issues', user), params: { assignee_id: 'Any', scope: 'all' }
-
- expect_paginated_array_response([issue.id, confidential_issue.id, closed_issue.id])
- end
-
- it 'returns only confidential issues' do
- get api('/issues', user), params: { confidential: true, scope: 'all' }
-
- expect_paginated_array_response(confidential_issue.id)
- end
-
- it 'returns only public issues' do
- get api('/issues', user), params: { confidential: false }
-
- expect_paginated_array_response([issue.id, closed_issue.id])
- end
-
- it 'returns issues reacted by the authenticated user' do
- issue2 = create(:issue, project: project, author: user, assignees: [user])
- create(:award_emoji, awardable: issue2, user: user2, name: 'star')
- create(:award_emoji, awardable: issue, user: user2, name: 'thumbsup')
-
- get api('/issues', user2), params: { my_reaction_emoji: 'Any', scope: 'all' }
-
- expect_paginated_array_response([issue2.id, issue.id])
- end
-
- it 'returns issues not reacted by the authenticated user' do
- issue2 = create(:issue, project: project, author: user, assignees: [user])
- create(:award_emoji, awardable: issue2, user: user2, name: 'star')
-
- get api('/issues', user2), params: { my_reaction_emoji: 'None', scope: 'all' }
-
- expect_paginated_array_response([issue.id, closed_issue.id])
- end
-
- it 'returns issues matching given search string for title' do
- get api("/issues", user), params: { search: issue.title }
-
- expect_paginated_array_response(issue.id)
- end
-
- it 'returns issues matching given search string for title and scoped in title' do
- get api("/issues", user), params: { search: issue.title, in: 'title' }
-
- expect_paginated_array_response(issue.id)
- end
-
- it 'returns an empty array if no issue matches given search string for title and scoped in description' do
- get api("/issues", user), params: { search: issue.title, in: 'description' }
-
- expect_paginated_array_response([])
- end
-
- it 'returns issues matching given search string for description' do
- get api("/issues", user), params: { search: issue.description }
-
- expect_paginated_array_response(issue.id)
- end
-
- context 'filtering before a specific date' do
- let!(:issue2) { create(:issue, project: project, author: user, created_at: Date.new(2000, 1, 1), updated_at: Date.new(2000, 1, 1)) }
-
- it 'returns issues created before a specific date' do
- get api('/issues?created_before=2000-01-02T00:00:00.060Z', user)
-
- expect_paginated_array_response(issue2.id)
- end
-
- it 'returns issues updated before a specific date' do
- get api('/issues?updated_before=2000-01-02T00:00:00.060Z', user)
-
- expect_paginated_array_response(issue2.id)
- end
- end
-
- context 'filtering after a specific date' do
- let!(:issue2) { create(:issue, project: project, author: user, created_at: 1.week.from_now, updated_at: 1.week.from_now) }
-
- it 'returns issues created after a specific date' do
- get api("/issues?created_after=#{issue2.created_at}", user)
-
- expect_paginated_array_response(issue2.id)
- end
-
- it 'returns issues updated after a specific date' do
- get api("/issues?updated_after=#{issue2.updated_at}", user)
-
- expect_paginated_array_response(issue2.id)
- end
- end
-
- it 'returns an array of labeled issues' do
- get api('/issues', user), params: { labels: label.title }
-
- expect_paginated_array_response(issue.id)
- expect(json_response.first['labels']).to eq([label.title])
- end
-
- it 'returns an array of labeled issues with labels param as array' do
- get api('/issues', user), params: { labels: [label.title] }
-
- expect_paginated_array_response(issue.id)
- expect(json_response.first['labels']).to eq([label.title])
- end
-
- it 'returns an array of labeled issues when all labels matches' do
- label_b = create(:label, title: 'foo', project: project)
- label_c = create(:label, title: 'bar', project: project)
-
- create(:label_link, label: label_b, target: issue)
- create(:label_link, label: label_c, target: issue)
-
- get api('/issues', user), params: { labels: "#{label.title},#{label_b.title},#{label_c.title}" }
-
- expect_paginated_array_response(issue.id)
- expect(json_response.first['labels']).to eq([label_c.title, label_b.title, label.title])
- end
-
- it 'returns an array of labeled issues when all labels matches with labels param as array' do
- label_b = create(:label, title: 'foo', project: project)
- label_c = create(:label, title: 'bar', project: project)
-
- create(:label_link, label: label_b, target: issue)
- create(:label_link, label: label_c, target: issue)
-
- get api('/issues', user), params: { labels: [label.title, label_b.title, label_c.title] }
-
- expect_paginated_array_response(issue.id)
- expect(json_response.first['labels']).to eq([label_c.title, label_b.title, label.title])
- end
-
- it 'returns an empty array if no issue matches labels' do
- get api('/issues', user), params: { labels: 'foo,bar' }
-
- expect_paginated_array_response([])
- end
-
- it 'returns an empty array if no issue matches labels with labels param as array' do
- get api('/issues', user), params: { labels: %w(foo bar) }
-
- expect_paginated_array_response([])
- end
-
- it 'returns an array of labeled issues matching given state' do
- get api('/issues', user), params: { labels: label.title, state: :opened }
-
- expect_paginated_array_response(issue.id)
- expect(json_response.first['labels']).to eq([label.title])
- expect(json_response.first['state']).to eq('opened')
- end
-
- it 'returns an array of labeled issues matching given state with labels param as array' do
- get api('/issues', user), params: { labels: [label.title], state: :opened }
-
- expect_paginated_array_response(issue.id)
- expect(json_response.first['labels']).to eq([label.title])
- expect(json_response.first['state']).to eq('opened')
- end
-
- it 'returns an empty array if no issue matches labels and state filters' do
- get api('/issues', user), params: { labels: label.title, state: :closed }
-
- expect_paginated_array_response([])
- end
-
- it 'returns an array of issues with any label' do
- get api('/issues', user), params: { labels: IssuesFinder::FILTER_ANY }
-
- expect_paginated_array_response(issue.id)
- end
-
- it 'returns an array of issues with any label with labels param as array' do
- get api('/issues', user), params: { labels: [IssuesFinder::FILTER_ANY] }
-
- expect_paginated_array_response(issue.id)
- end
-
- it 'returns an array of issues with no label' do
- get api('/issues', user), params: { labels: IssuesFinder::FILTER_NONE }
-
- expect_paginated_array_response(closed_issue.id)
- end
-
- it 'returns an array of issues with no label with labels param as array' do
- get api('/issues', user), params: { labels: [IssuesFinder::FILTER_NONE] }
-
- expect_paginated_array_response(closed_issue.id)
- end
-
- it 'returns an array of issues with no label when using the legacy No+Label filter' do
- get api('/issues', user), params: { labels: 'No Label' }
-
- expect_paginated_array_response(closed_issue.id)
- end
-
- it 'returns an array of issues with no label when using the legacy No+Label filter with labels param as array' do
- get api('/issues', user), params: { labels: ['No Label'] }
-
- expect_paginated_array_response(closed_issue.id)
- end
-
- it 'returns an empty array if no issue matches milestone' do
- get api("/issues?milestone=#{empty_milestone.title}", user)
-
- expect_paginated_array_response([])
- end
-
- it 'returns an empty array if milestone does not exist' do
- get api("/issues?milestone=foo", user)
-
- expect_paginated_array_response([])
- end
-
- it 'returns an array of issues in given milestone' do
- get api("/issues?milestone=#{milestone.title}", user)
-
- expect_paginated_array_response([issue.id, closed_issue.id])
- end
-
- it 'returns an array of issues matching state in milestone' do
- get api("/issues?milestone=#{milestone.title}"\
- '&state=closed', user)
-
- expect_paginated_array_response(closed_issue.id)
- end
-
- it 'returns an array of issues with no milestone' do
- get api("/issues?milestone=#{no_milestone_title}", author)
-
- expect_paginated_array_response(confidential_issue.id)
- end
-
- it 'returns an array of issues found by iids' do
- get api('/issues', user), params: { iids: [closed_issue.iid] }
-
- expect_paginated_array_response(closed_issue.id)
- end
-
- it 'returns an empty array if iid does not exist' do
- get api("/issues", user), params: { iids: [0] }
-
- expect_paginated_array_response([])
- end
-
- context 'without sort params' do
- it 'sorts by created_at descending by default' do
- get api('/issues', user)
-
- expect_paginated_array_response([issue.id, closed_issue.id])
- end
-
- context 'with 2 issues with same created_at' do
- let!(:closed_issue2) do
- create :closed_issue,
- author: user,
- assignees: [user],
- project: project,
- milestone: milestone,
- created_at: closed_issue.created_at,
- updated_at: 1.hour.ago,
- title: issue_title,
- description: issue_description
- end
-
- it 'page breaks first page correctly' do
- get api('/issues?per_page=2', user)
-
- expect_paginated_array_response([issue.id, closed_issue2.id])
- end
-
- it 'page breaks second page correctly' do
- get api('/issues?per_page=2&page=2', user)
-
- expect_paginated_array_response([closed_issue.id])
- end
- end
- end
-
- it 'sorts ascending when requested' do
- get api('/issues?sort=asc', user)
-
- expect_paginated_array_response([closed_issue.id, issue.id])
- end
-
- it 'sorts by updated_at descending when requested' do
- get api('/issues?order_by=updated_at', user)
-
- issue.touch(:updated_at)
-
- expect_paginated_array_response([issue.id, closed_issue.id])
- end
-
- it 'sorts by updated_at ascending when requested' do
- get api('/issues?order_by=updated_at&sort=asc', user)
-
- issue.touch(:updated_at)
-
- expect_paginated_array_response([closed_issue.id, issue.id])
- end
-
- it 'matches V4 response schema' do
- get api('/issues', user)
-
- expect(response).to have_gitlab_http_status(200)
- expect(response).to match_response_schema('public_api/v4/issues')
- end
-
- it 'returns a related merge request count of 0 if there are no related merge requests' do
- get api('/issues', user)
-
- expect(response).to have_gitlab_http_status(200)
- expect(response).to match_response_schema('public_api/v4/issues')
- expect(json_response.first).to include('merge_requests_count' => 0)
- end
-
- it 'returns a related merge request count > 0 if there are related merge requests' do
- create(:merge_requests_closing_issues, issue: issue)
-
- get api('/issues', user)
-
- expect(response).to have_gitlab_http_status(200)
- expect(response).to match_response_schema('public_api/v4/issues')
- expect(json_response.first).to include('merge_requests_count' => 1)
- end
- end
- end
-
- describe "GET /groups/:id/issues" do
- let!(:group) { create(:group) }
- let!(:group_project) { create(:project, :public, creator_id: user.id, namespace: group) }
- let!(:group_closed_issue) do
- create :closed_issue,
- author: user,
- assignees: [user],
- project: group_project,
- state: :closed,
- milestone: group_milestone,
- updated_at: 3.hours.ago,
- created_at: 1.day.ago
- end
- let!(:group_confidential_issue) do
- create :issue,
- :confidential,
- project: group_project,
- author: author,
- assignees: [assignee],
- updated_at: 2.hours.ago,
- created_at: 2.days.ago
- end
- let!(:group_issue) do
- create :issue,
- author: user,
- assignees: [user],
- project: group_project,
- milestone: group_milestone,
- updated_at: 1.hour.ago,
- title: issue_title,
- description: issue_description,
- created_at: 5.days.ago
- end
- let!(:group_label) do
- create(:label, title: 'group_lbl', color: '#FFAABB', project: group_project)
- end
- let!(:group_label_link) { create(:label_link, label: group_label, target: group_issue) }
- let!(:group_milestone) { create(:milestone, title: '3.0.0', project: group_project) }
- let!(:group_empty_milestone) do
- create(:milestone, title: '4.0.0', project: group_project)
- end
- let!(:group_note) { create(:note_on_issue, author: user, project: group_project, noteable: group_issue) }
-
- let(:base_url) { "/groups/#{group.id}/issues" }
-
- context 'when group has subgroups', :nested_groups do
- let(:subgroup_1) { create(:group, parent: group) }
- let(:subgroup_2) { create(:group, parent: subgroup_1) }
-
- let(:subgroup_1_project) { create(:project, namespace: subgroup_1) }
- let(:subgroup_2_project) { create(:project, namespace: subgroup_2) }
-
- let!(:issue_1) { create(:issue, project: subgroup_1_project) }
- let!(:issue_2) { create(:issue, project: subgroup_2_project) }
-
- before do
- group.add_developer(user)
- end
-
- it 'also returns subgroups projects issues' do
- get api(base_url, user)
-
- expect_paginated_array_response([issue_2.id, issue_1.id, group_closed_issue.id, group_confidential_issue.id, group_issue.id])
- end
- end
-
- context 'when user is unauthenticated' do
- it 'lists all issues in public projects' do
- get api(base_url)
-
- expect_paginated_array_response([group_closed_issue.id, group_issue.id])
- end
- end
-
- context 'when user is a group member' do
- before do
- group_project.add_reporter(user)
- end
-
- it 'returns all group issues (including opened and closed)' do
- get api(base_url, admin)
-
- expect_paginated_array_response([group_closed_issue.id, group_confidential_issue.id, group_issue.id])
- end
-
- it 'returns group issues without confidential issues for non project members' do
- get api(base_url, non_member), params: { state: :opened }
-
- expect_paginated_array_response(group_issue.id)
- end
-
- it 'returns group confidential issues for author' do
- get api(base_url, author), params: { state: :opened }
-
- expect_paginated_array_response([group_confidential_issue.id, group_issue.id])
- end
-
- it 'returns group confidential issues for assignee' do
- get api(base_url, assignee), params: { state: :opened }
-
- expect_paginated_array_response([group_confidential_issue.id, group_issue.id])
- end
-
- it 'returns group issues with confidential issues for project members' do
- get api(base_url, user), params: { state: :opened }
-
- expect_paginated_array_response([group_confidential_issue.id, group_issue.id])
- end
-
- it 'returns group confidential issues for admin' do
- get api(base_url, admin), params: { state: :opened }
-
- expect_paginated_array_response([group_confidential_issue.id, group_issue.id])
- end
-
- it 'returns only confidential issues' do
- get api(base_url, user), params: { confidential: true }
-
- expect_paginated_array_response(group_confidential_issue.id)
- end
-
- it 'returns only public issues' do
- get api(base_url, user), params: { confidential: false }
-
- expect_paginated_array_response([group_closed_issue.id, group_issue.id])
- end
-
- it 'returns an array of labeled group issues' do
- get api(base_url, user), params: { labels: group_label.title }
-
- expect_paginated_array_response(group_issue.id)
- expect(json_response.first['labels']).to eq([group_label.title])
- end
-
- it 'returns an array of labeled group issues with labels param as array' do
- get api(base_url, user), params: { labels: [group_label.title] }
-
- expect_paginated_array_response(group_issue.id)
- expect(json_response.first['labels']).to eq([group_label.title])
- end
-
- it 'returns an array of labeled group issues where all labels match' do
- get api(base_url, user), params: { labels: "#{group_label.title},foo,bar" }
-
- expect_paginated_array_response([])
- end
-
- it 'returns an array of labeled group issues where all labels match with labels param as array' do
- get api(base_url, user), params: { labels: [group_label.title, 'foo', 'bar'] }
-
- expect_paginated_array_response([])
- end
-
- it 'returns issues matching given search string for title' do
- get api(base_url, user), params: { search: group_issue.title }
-
- expect_paginated_array_response(group_issue.id)
- end
-
- it 'returns issues matching given search string for description' do
- get api(base_url, user), params: { search: group_issue.description }
-
- expect_paginated_array_response(group_issue.id)
- end
-
- it 'returns an array of labeled issues when all labels matches' do
- label_b = create(:label, title: 'foo', project: group_project)
- label_c = create(:label, title: 'bar', project: group_project)
-
- create(:label_link, label: label_b, target: group_issue)
- create(:label_link, label: label_c, target: group_issue)
-
- get api(base_url, user), params: { labels: "#{group_label.title},#{label_b.title},#{label_c.title}" }
-
- expect_paginated_array_response(group_issue.id)
- expect(json_response.first['labels']).to eq([label_c.title, label_b.title, group_label.title])
- end
-
- it 'returns an array of labeled issues when all labels matches with labels param as array' do
- label_b = create(:label, title: 'foo', project: group_project)
- label_c = create(:label, title: 'bar', project: group_project)
-
- create(:label_link, label: label_b, target: group_issue)
- create(:label_link, label: label_c, target: group_issue)
-
- get api(base_url, user), params: { labels: [group_label.title, label_b.title, label_c.title] }
-
- expect_paginated_array_response(group_issue.id)
- expect(json_response.first['labels']).to eq([label_c.title, label_b.title, group_label.title])
- end
-
- it 'returns an array of issues found by iids' do
- get api(base_url, user), params: { iids: [group_issue.iid] }
-
- expect_paginated_array_response(group_issue.id)
- expect(json_response.first['id']).to eq(group_issue.id)
- end
-
- it 'returns an empty array if iid does not exist' do
- get api(base_url, user), params: { iids: [0] }
-
- expect_paginated_array_response([])
- end
-
- it 'returns an empty array if no group issue matches labels' do
- get api(base_url, user), params: { labels: 'foo,bar' }
-
- expect_paginated_array_response([])
- end
-
- it 'returns an array of group issues with any label' do
- get api(base_url, user), params: { labels: IssuesFinder::FILTER_ANY }
-
- expect_paginated_array_response(group_issue.id)
- expect(json_response.first['id']).to eq(group_issue.id)
- end
-
- it 'returns an array of group issues with any label with labels param as array' do
- get api(base_url, user), params: { labels: [IssuesFinder::FILTER_ANY] }
-
- expect_paginated_array_response(group_issue.id)
- expect(json_response.first['id']).to eq(group_issue.id)
- end
-
- it 'returns an array of group issues with no label' do
- get api(base_url, user), params: { labels: IssuesFinder::FILTER_NONE }
-
- expect_paginated_array_response([group_closed_issue.id, group_confidential_issue.id])
- end
-
- it 'returns an array of group issues with no label with labels param as array' do
- get api(base_url, user), params: { labels: [IssuesFinder::FILTER_NONE] }
-
- expect_paginated_array_response([group_closed_issue.id, group_confidential_issue.id])
- end
-
- it 'returns an empty array if no issue matches milestone' do
- get api(base_url, user), params: { milestone: group_empty_milestone.title }
-
- expect_paginated_array_response([])
- end
-
- it 'returns an empty array if milestone does not exist' do
- get api(base_url, user), params: { milestone: 'foo' }
-
- expect_paginated_array_response([])
- end
-
- it 'returns an array of issues in given milestone' do
- get api(base_url, user), params: { state: :opened, milestone: group_milestone.title }
-
- expect_paginated_array_response(group_issue.id)
- end
-
- it 'returns an array of issues matching state in milestone' do
- get api(base_url, user), params: { milestone: group_milestone.title, state: :closed }
-
- expect_paginated_array_response(group_closed_issue.id)
- end
-
- it 'returns an array of issues with no milestone' do
- get api(base_url, user), params: { milestone: no_milestone_title }
-
- expect(response).to have_gitlab_http_status(200)
-
- expect_paginated_array_response(group_confidential_issue.id)
- end
-
- context 'without sort params' do
- it 'sorts by created_at descending by default' do
- get api(base_url, user)
-
- expect_paginated_array_response([group_closed_issue.id, group_confidential_issue.id, group_issue.id])
- end
-
- context 'with 2 issues with same created_at' do
- let!(:group_issue2) do
- create :issue,
- author: user,
- assignees: [user],
- project: group_project,
- milestone: group_milestone,
- updated_at: 1.hour.ago,
- title: issue_title,
- description: issue_description,
- created_at: group_issue.created_at
- end
-
- it 'page breaks first page correctly' do
- get api("#{base_url}?per_page=3", user)
-
- expect_paginated_array_response([group_closed_issue.id, group_confidential_issue.id, group_issue2.id])
- end
-
- it 'page breaks second page correctly' do
- get api("#{base_url}?per_page=3&page=2", user)
-
- expect_paginated_array_response([group_issue.id])
- end
- end
- end
-
- it 'sorts ascending when requested' do
- get api("#{base_url}?sort=asc", user)
-
- expect_paginated_array_response([group_issue.id, group_confidential_issue.id, group_closed_issue.id])
- end
-
- it 'sorts by updated_at descending when requested' do
- get api("#{base_url}?order_by=updated_at", user)
-
- group_issue.touch(:updated_at)
-
- expect_paginated_array_response([group_issue.id, group_confidential_issue.id, group_closed_issue.id])
- end
-
- it 'sorts by updated_at ascending when requested' do
- get api(base_url, user), params: { order_by: :updated_at, sort: :asc }
-
- expect_paginated_array_response([group_closed_issue.id, group_confidential_issue.id, group_issue.id])
- end
- end
- end
-
- describe "GET /projects/:id/issues" do
- let(:base_url) { "/projects/#{project.id}" }
-
- context 'when unauthenticated' do
- it 'returns public project issues' do
- get api("/projects/#{project.id}/issues")
-
- expect_paginated_array_response([issue.id, closed_issue.id])
- end
- end
-
- it 'avoids N+1 queries' do
- get api("/projects/#{project.id}/issues", user)
-
- control_count = ActiveRecord::QueryRecorder.new(skip_cached: false) do
- get api("/projects/#{project.id}/issues", user)
- end.count
-
- create_list(:issue, 3, project: project)
-
- expect do
- get api("/projects/#{project.id}/issues", user)
- end.not_to exceed_all_query_limit(control_count)
- end
-
- it 'returns 404 when project does not exist' do
- get api('/projects/1000/issues', non_member)
-
- expect(response).to have_gitlab_http_status(404)
- end
-
- it "returns 404 on private projects for other users" do
- private_project = create(:project, :private)
- create(:issue, project: private_project)
-
- get api("/projects/#{private_project.id}/issues", non_member)
-
- expect(response).to have_gitlab_http_status(404)
- end
-
- it 'returns no issues when user has access to project but not issues' do
- restricted_project = create(:project, :public, :issues_private)
- create(:issue, project: restricted_project)
-
- get api("/projects/#{restricted_project.id}/issues", non_member)
-
- expect_paginated_array_response([])
- end
-
- it 'returns project issues without confidential issues for non project members' do
- get api("#{base_url}/issues", non_member)
-
- expect_paginated_array_response([issue.id, closed_issue.id])
- end
-
- it 'returns project issues without confidential issues for project members with guest role' do
- get api("#{base_url}/issues", guest)
-
- expect_paginated_array_response([issue.id, closed_issue.id])
- end
-
- it 'returns project confidential issues for author' do
- get api("#{base_url}/issues", author)
-
- expect_paginated_array_response([issue.id, confidential_issue.id, closed_issue.id])
- end
-
- it 'returns only confidential issues' do
- get api("#{base_url}/issues", author), params: { confidential: true }
-
- expect_paginated_array_response(confidential_issue.id)
- end
-
- it 'returns only public issues' do
- get api("#{base_url}/issues", author), params: { confidential: false }
-
- expect_paginated_array_response([issue.id, closed_issue.id])
- end
-
- it 'returns project confidential issues for assignee' do
- get api("#{base_url}/issues", assignee)
-
- expect_paginated_array_response([issue.id, confidential_issue.id, closed_issue.id])
- end
-
- it 'returns project issues with confidential issues for project members' do
- get api("#{base_url}/issues", user)
-
- expect_paginated_array_response([issue.id, confidential_issue.id, closed_issue.id])
- end
-
- it 'returns project confidential issues for admin' do
- get api("#{base_url}/issues", admin)
-
- expect_paginated_array_response([issue.id, confidential_issue.id, closed_issue.id])
- end
-
- it 'returns an array of labeled project issues' do
- get api("#{base_url}/issues", user), params: { labels: label.title }
-
- expect_paginated_array_response(issue.id)
- end
-
- it 'returns an array of labeled project issues with labels param as array' do
- get api("#{base_url}/issues", user), params: { labels: [label.title] }
-
- expect_paginated_array_response(issue.id)
- end
-
- it 'returns an array of labeled issues when all labels matches' do
- label_b = create(:label, title: 'foo', project: project)
- label_c = create(:label, title: 'bar', project: project)
-
- create(:label_link, label: label_b, target: issue)
- create(:label_link, label: label_c, target: issue)
-
- get api("#{base_url}/issues", user), params: { labels: "#{label.title},#{label_b.title},#{label_c.title}" }
-
- expect_paginated_array_response(issue.id)
- end
-
- it 'returns an array of labeled issues when all labels matches with labels param as array' do
- label_b = create(:label, title: 'foo', project: project)
- label_c = create(:label, title: 'bar', project: project)
-
- create(:label_link, label: label_b, target: issue)
- create(:label_link, label: label_c, target: issue)
-
- get api("#{base_url}/issues", user), params: { labels: [label.title, label_b.title, label_c.title] }
-
- expect_paginated_array_response(issue.id)
- end
-
- it 'returns issues matching given search string for title' do
- get api("#{base_url}/issues?search=#{issue.title}", user)
-
- expect_paginated_array_response(issue.id)
- end
-
- it 'returns issues matching given search string for description' do
- get api("#{base_url}/issues?search=#{issue.description}", user)
-
- expect_paginated_array_response(issue.id)
- end
-
- it 'returns an array of issues found by iids' do
- get api("#{base_url}/issues", user), params: { iids: [issue.iid] }
-
- expect_paginated_array_response(issue.id)
- end
-
- it 'returns an empty array if iid does not exist' do
- get api("#{base_url}/issues", user), params: { iids: [0] }
-
- expect_paginated_array_response([])
- end
-
- it 'returns an empty array if not all labels matches' do
- get api("#{base_url}/issues?labels=#{label.title},foo", user)
-
- expect_paginated_array_response([])
- end
-
- it 'returns an array of project issues with any label' do
- get api("#{base_url}/issues", user), params: { labels: IssuesFinder::FILTER_ANY }
-
- expect_paginated_array_response(issue.id)
- end
-
- it 'returns an array of project issues with any label with labels param as array' do
- get api("#{base_url}/issues", user), params: { labels: [IssuesFinder::FILTER_ANY] }
-
- expect_paginated_array_response(issue.id)
- end
-
- it 'returns an array of project issues with no label' do
- get api("#{base_url}/issues", user), params: { labels: IssuesFinder::FILTER_NONE }
-
- expect_paginated_array_response([confidential_issue.id, closed_issue.id])
- end
-
- it 'returns an array of project issues with no label with labels param as array' do
- get api("#{base_url}/issues", user), params: { labels: [IssuesFinder::FILTER_NONE] }
-
- expect_paginated_array_response([confidential_issue.id, closed_issue.id])
- end
-
- it 'returns an empty array if no project issue matches labels' do
- get api("#{base_url}/issues", user), params: { labels: 'foo,bar' }
-
- expect_paginated_array_response([])
- end
-
- it 'returns an empty array if no issue matches milestone' do
- get api("#{base_url}/issues", user), params: { milestone: empty_milestone.title }
-
- expect_paginated_array_response([])
- end
-
- it 'returns an empty array if milestone does not exist' do
- get api("#{base_url}/issues", user), params: { milestone: :foo }
-
- expect_paginated_array_response([])
- end
-
- it 'returns an array of issues in given milestone' do
- get api("#{base_url}/issues", user), params: { milestone: milestone.title }
-
- expect_paginated_array_response([issue.id, closed_issue.id])
- end
-
- it 'returns an array of issues matching state in milestone' do
- get api("#{base_url}/issues", user), params: { milestone: milestone.title, state: :closed }
-
- expect_paginated_array_response(closed_issue.id)
- end
-
- it 'returns an array of issues with no milestone' do
- get api("#{base_url}/issues", user), params: { milestone: no_milestone_title }
-
- expect_paginated_array_response(confidential_issue.id)
- end
-
- it 'returns an array of issues with any milestone' do
- get api("#{base_url}/issues", user), params: { milestone: any_milestone_title }
-
- expect_paginated_array_response([issue.id, closed_issue.id])
- end
-
- context 'without sort params' do
- it 'sorts by created_at descending by default' do
- get api("#{base_url}/issues", user)
-
- expect_paginated_array_response([issue.id, confidential_issue.id, closed_issue.id])
- end
-
- context 'with 2 issues with same created_at' do
- let!(:closed_issue2) do
- create :closed_issue,
- author: user,
- assignees: [user],
- project: project,
- milestone: milestone,
- created_at: closed_issue.created_at,
- updated_at: 1.hour.ago,
- title: issue_title,
- description: issue_description
- end
-
- it 'page breaks first page correctly' do
- get api("#{base_url}/issues?per_page=3", user)
-
- expect_paginated_array_response([issue.id, confidential_issue.id, closed_issue2.id])
- end
-
- it 'page breaks second page correctly' do
- get api("#{base_url}/issues?per_page=3&page=2", user)
-
- expect_paginated_array_response([closed_issue.id])
- end
- end
- end
-
- it 'sorts ascending when requested' do
- get api("#{base_url}/issues", user), params: { sort: :asc }
-
- expect_paginated_array_response([closed_issue.id, confidential_issue.id, issue.id])
- end
-
- it 'sorts by updated_at descending when requested' do
- get api("#{base_url}/issues", user), params: { order_by: :updated_at }
-
- issue.touch(:updated_at)
-
- expect_paginated_array_response([issue.id, confidential_issue.id, closed_issue.id])
- end
-
- it 'sorts by updated_at ascending when requested' do
- get api("#{base_url}/issues", user), params: { order_by: :updated_at, sort: :asc }
-
- expect_paginated_array_response([closed_issue.id, confidential_issue.id, issue.id])
- end
- end
-
- describe "GET /projects/:id/issues/:issue_iid" do
- context 'when unauthenticated' do
- it 'returns public issues' do
- get api("/projects/#{project.id}/issues/#{issue.iid}")
-
- expect(response).to have_gitlab_http_status(200)
- end
- end
-
- it 'exposes known attributes' do
- get api("/projects/#{project.id}/issues/#{issue.iid}", user)
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['id']).to eq(issue.id)
- expect(json_response['iid']).to eq(issue.iid)
- expect(json_response['project_id']).to eq(issue.project.id)
- expect(json_response['title']).to eq(issue.title)
- expect(json_response['description']).to eq(issue.description)
- expect(json_response['state']).to eq(issue.state)
- expect(json_response['closed_at']).to be_falsy
- expect(json_response['created_at']).to be_present
- expect(json_response['updated_at']).to be_present
- expect(json_response['labels']).to eq(issue.label_names)
- expect(json_response['milestone']).to be_a Hash
- expect(json_response['assignees']).to be_a Array
- expect(json_response['assignee']).to be_a Hash
- expect(json_response['author']).to be_a Hash
- expect(json_response['confidential']).to be_falsy
- end
-
- it "exposes the 'closed_at' attribute" do
- get api("/projects/#{project.id}/issues/#{closed_issue.iid}", user)
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['closed_at']).to be_present
- end
-
- context 'links exposure' do
- it 'exposes related resources full URIs' do
- get api("/projects/#{project.id}/issues/#{issue.iid}", user)
-
- links = json_response['_links']
-
- expect(links['self']).to end_with("/api/v4/projects/#{project.id}/issues/#{issue.iid}")
- expect(links['notes']).to end_with("/api/v4/projects/#{project.id}/issues/#{issue.iid}/notes")
- expect(links['award_emoji']).to end_with("/api/v4/projects/#{project.id}/issues/#{issue.iid}/award_emoji")
- expect(links['project']).to end_with("/api/v4/projects/#{project.id}")
- end
- end
-
- it "returns a project issue by internal id" do
- get api("/projects/#{project.id}/issues/#{issue.iid}", user)
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['title']).to eq(issue.title)
- expect(json_response['iid']).to eq(issue.iid)
- end
-
- it "returns 404 if issue id not found" do
- get api("/projects/#{project.id}/issues/54321", user)
- expect(response).to have_gitlab_http_status(404)
- end
-
- it "returns 404 if the issue ID is used" do
- get api("/projects/#{project.id}/issues/#{issue.id}", user)
-
- expect(response).to have_gitlab_http_status(404)
- end
-
- context 'confidential issues' do
- it "returns 404 for non project members" do
- get api("/projects/#{project.id}/issues/#{confidential_issue.iid}", non_member)
-
- expect(response).to have_gitlab_http_status(404)
- end
-
- it "returns 404 for project members with guest role" do
- get api("/projects/#{project.id}/issues/#{confidential_issue.iid}", guest)
-
- expect(response).to have_gitlab_http_status(404)
- end
-
- it "returns confidential issue for project members" do
- get api("/projects/#{project.id}/issues/#{confidential_issue.iid}", user)
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['title']).to eq(confidential_issue.title)
- expect(json_response['iid']).to eq(confidential_issue.iid)
- end
-
- it "returns confidential issue for author" do
- get api("/projects/#{project.id}/issues/#{confidential_issue.iid}", author)
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['title']).to eq(confidential_issue.title)
- expect(json_response['iid']).to eq(confidential_issue.iid)
- end
-
- it "returns confidential issue for assignee" do
- get api("/projects/#{project.id}/issues/#{confidential_issue.iid}", assignee)
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['title']).to eq(confidential_issue.title)
- expect(json_response['iid']).to eq(confidential_issue.iid)
- end
-
- it "returns confidential issue for admin" do
- get api("/projects/#{project.id}/issues/#{confidential_issue.iid}", admin)
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['title']).to eq(confidential_issue.title)
- expect(json_response['iid']).to eq(confidential_issue.iid)
- end
- end
- end
-
- describe "POST /projects/:id/issues" do
- context 'support for deprecated assignee_id' do
- it 'creates a new project issue' do
- post api("/projects/#{project.id}/issues", user),
- params: { title: 'new issue', assignee_id: user2.id }
-
- expect(response).to have_gitlab_http_status(201)
- expect(json_response['title']).to eq('new issue')
- expect(json_response['assignee']['name']).to eq(user2.name)
- expect(json_response['assignees'].first['name']).to eq(user2.name)
- end
-
- it 'creates a new project issue when assignee_id is empty' do
- post api("/projects/#{project.id}/issues", user),
- params: { title: 'new issue', assignee_id: '' }
-
- expect(response).to have_gitlab_http_status(201)
- expect(json_response['title']).to eq('new issue')
- expect(json_response['assignee']).to be_nil
- end
- end
-
- context 'single assignee restrictions' do
- it 'creates a new project issue with no more than one assignee' do
- post api("/projects/#{project.id}/issues", user),
- params: { title: 'new issue', assignee_ids: [user2.id, guest.id] }
-
- expect(response).to have_gitlab_http_status(201)
- expect(json_response['title']).to eq('new issue')
- expect(json_response['assignees'].count).to eq(1)
- end
- end
-
- context 'user does not have permissions to create issue' do
- let(:not_member) { create(:user) }
-
- before do
- project.project_feature.update(issues_access_level: ProjectFeature::PRIVATE)
- end
-
- it 'renders 403' do
- post api("/projects/#{project.id}/issues", not_member), params: { title: 'new issue' }
-
- expect(response).to have_gitlab_http_status(403)
- end
- end
-
- context 'an internal ID is provided' do
- context 'by an admin' do
- it 'sets the internal ID on the new issue' do
- post api("/projects/#{project.id}/issues", admin),
- params: { title: 'new issue', iid: 9001 }
-
- expect(response).to have_gitlab_http_status(201)
- expect(json_response['iid']).to eq 9001
- end
- end
-
- context 'by an owner' do
- it 'sets the internal ID on the new issue' do
- post api("/projects/#{project.id}/issues", user),
- params: { title: 'new issue', iid: 9001 }
-
- expect(response).to have_gitlab_http_status(201)
- expect(json_response['iid']).to eq 9001
- end
- end
-
- context 'by a group owner' do
- let(:group) { create(:group) }
- let(:group_project) { create(:project, :public, namespace: group) }
-
- it 'sets the internal ID on the new issue' do
- group.add_owner(user2)
- post api("/projects/#{group_project.id}/issues", user2),
- params: { title: 'new issue', iid: 9001 }
-
- expect(response).to have_gitlab_http_status(201)
- expect(json_response['iid']).to eq 9001
- end
- end
-
- context 'by another user' do
- it 'ignores the given internal ID' do
- post api("/projects/#{project.id}/issues", user2),
- params: { title: 'new issue', iid: 9001 }
-
- expect(response).to have_gitlab_http_status(201)
- expect(json_response['iid']).not_to eq 9001
- end
- end
- end
-
- it 'creates a new project issue' do
- post api("/projects/#{project.id}/issues", user),
- params: { title: 'new issue', labels: 'label, label2', weight: 3, assignee_ids: [user2.id] }
-
- expect(response).to have_gitlab_http_status(201)
- expect(json_response['title']).to eq('new issue')
- expect(json_response['description']).to be_nil
- expect(json_response['labels']).to eq(%w(label label2))
- expect(json_response['confidential']).to be_falsy
- expect(json_response['assignee']['name']).to eq(user2.name)
- expect(json_response['assignees'].first['name']).to eq(user2.name)
- end
-
- it 'creates a new project issue with labels param as array' do
- post api("/projects/#{project.id}/issues", user),
- params: { title: 'new issue', labels: %w(label label2), weight: 3, assignee_ids: [user2.id] }
-
- expect(response).to have_gitlab_http_status(201)
- expect(json_response['title']).to eq('new issue')
- expect(json_response['description']).to be_nil
- expect(json_response['labels']).to eq(%w(label label2))
- expect(json_response['confidential']).to be_falsy
- expect(json_response['assignee']['name']).to eq(user2.name)
- expect(json_response['assignees'].first['name']).to eq(user2.name)
- end
-
- it 'creates a new confidential project issue' do
- post api("/projects/#{project.id}/issues", user),
- params: { title: 'new issue', confidential: true }
-
- expect(response).to have_gitlab_http_status(201)
- expect(json_response['title']).to eq('new issue')
- expect(json_response['confidential']).to be_truthy
- end
-
- it 'creates a new confidential project issue with a different param' do
- post api("/projects/#{project.id}/issues", user),
- params: { title: 'new issue', confidential: 'y' }
-
- expect(response).to have_gitlab_http_status(201)
- expect(json_response['title']).to eq('new issue')
- expect(json_response['confidential']).to be_truthy
- end
-
- it 'creates a public issue when confidential param is false' do
- post api("/projects/#{project.id}/issues", user),
- params: { title: 'new issue', confidential: false }
-
- expect(response).to have_gitlab_http_status(201)
- expect(json_response['title']).to eq('new issue')
- expect(json_response['confidential']).to be_falsy
- end
-
- it 'creates a public issue when confidential param is invalid' do
- post api("/projects/#{project.id}/issues", user),
- params: { title: 'new issue', confidential: 'foo' }
-
- expect(response).to have_gitlab_http_status(400)
- expect(json_response['error']).to eq('confidential is invalid')
- end
-
- it "returns a 400 bad request if title not given" do
- post api("/projects/#{project.id}/issues", user), params: { labels: 'label, label2' }
- expect(response).to have_gitlab_http_status(400)
- end
-
- it 'allows special label names' do
- post api("/projects/#{project.id}/issues", user),
- params: {
- title: 'new issue',
- labels: 'label, label?, label&foo, ?, &'
- }
- expect(response.status).to eq(201)
- expect(json_response['labels']).to include 'label'
- expect(json_response['labels']).to include 'label?'
- expect(json_response['labels']).to include 'label&foo'
- expect(json_response['labels']).to include '?'
- expect(json_response['labels']).to include '&'
- end
-
- it 'allows special label names with labels param as array' do
- post api("/projects/#{project.id}/issues", user),
- params: {
- title: 'new issue',
- labels: ['label', 'label?', 'label&foo, ?, &']
- }
- expect(response.status).to eq(201)
- expect(json_response['labels']).to include 'label'
- expect(json_response['labels']).to include 'label?'
- expect(json_response['labels']).to include 'label&foo'
- expect(json_response['labels']).to include '?'
- expect(json_response['labels']).to include '&'
- end
-
- it 'returns 400 if title is too long' do
- post api("/projects/#{project.id}/issues", user),
- params: { title: 'g' * 256 }
- expect(response).to have_gitlab_http_status(400)
- expect(json_response['message']['title']).to eq([
- 'is too long (maximum is 255 characters)'
- ])
- end
-
- context 'resolving discussions' do
- let(:discussion) { create(:diff_note_on_merge_request).to_discussion }
- let(:merge_request) { discussion.noteable }
- let(:project) { merge_request.source_project }
-
- before do
- project.add_maintainer(user)
- end
-
- context 'resolving all discussions in a merge request' do
- before do
- post api("/projects/#{project.id}/issues", user),
- params: {
- title: 'New Issue',
- merge_request_to_resolve_discussions_of: merge_request.iid
- }
- end
-
- it_behaves_like 'creating an issue resolving discussions through the API'
- end
-
- context 'resolving a single discussion' do
- before do
- post api("/projects/#{project.id}/issues", user),
- params: {
- title: 'New Issue',
- merge_request_to_resolve_discussions_of: merge_request.iid,
- discussion_to_resolve: discussion.id
- }
- end
-
- it_behaves_like 'creating an issue resolving discussions through the API'
- end
- end
-
- context 'with due date' do
- it 'creates a new project issue' do
- due_date = 2.weeks.from_now.strftime('%Y-%m-%d')
-
- post api("/projects/#{project.id}/issues", user),
- params: { title: 'new issue', due_date: due_date }
-
- expect(response).to have_gitlab_http_status(201)
- expect(json_response['title']).to eq('new issue')
- expect(json_response['description']).to be_nil
- expect(json_response['due_date']).to eq(due_date)
- end
- end
-
- context 'setting created_at' do
- let(:creation_time) { 2.weeks.ago }
- let(:params) { { title: 'new issue', labels: 'label, label2', created_at: creation_time } }
-
- context 'by an admin' do
- before do
- post api("/projects/#{project.id}/issues", admin), params: params
- end
-
- it 'sets the creation time on the new issue' do
- expect(response).to have_gitlab_http_status(201)
- expect(Time.parse(json_response['created_at'])).to be_like_time(creation_time)
- end
-
- it 'sets the system notes timestamp based on creation time' do
- issue = Issue.find(json_response['id'])
-
- expect(issue.resource_label_events.last.created_at).to be_like_time(creation_time)
- end
- end
-
- context 'by a project owner' do
- it 'sets the creation time on the new issue' do
- post api("/projects/#{project.id}/issues", user), params: params
-
- expect(response).to have_gitlab_http_status(201)
- expect(Time.parse(json_response['created_at'])).to be_like_time(creation_time)
- end
- end
-
- context 'by a group owner' do
- it 'sets the creation time on the new issue' do
- group = create(:group)
- group_project = create(:project, :public, namespace: group)
- group.add_owner(user2)
- post api("/projects/#{group_project.id}/issues", user2), params: params
-
- expect(response).to have_gitlab_http_status(201)
- expect(Time.parse(json_response['created_at'])).to be_like_time(creation_time)
- end
- end
-
- context 'by another user' do
- it 'ignores the given creation time' do
- post api("/projects/#{project.id}/issues", user2), params: params
-
- expect(response).to have_gitlab_http_status(201)
- expect(Time.parse(json_response['created_at'])).not_to be_like_time(creation_time)
- end
- end
- end
-
- context 'the user can only read the issue' do
- it 'cannot create new labels' do
- expect do
- post api("/projects/#{project.id}/issues", non_member), params: { title: 'new issue', labels: 'label, label2' }
- end.not_to change { project.labels.count }
- end
-
- it 'cannot create new labels with labels param as array' do
- expect do
- post api("/projects/#{project.id}/issues", non_member), params: { title: 'new issue', labels: %w(label label2) }
- end.not_to change { project.labels.count }
- end
- end
- end
-
- describe 'POST /projects/:id/issues with spam filtering' do
- before do
- allow_any_instance_of(SpamService).to receive(:check_for_spam?).and_return(true)
- allow_any_instance_of(AkismetService).to receive_messages(spam?: true)
- end
-
- let(:params) do
- {
- title: 'new issue',
- description: 'content here',
- labels: 'label, label2'
- }
- end
-
- it "does not create a new project issue" do
- expect { post api("/projects/#{project.id}/issues", user), params: params }.not_to change(Issue, :count)
- expect(response).to have_gitlab_http_status(400)
- expect(json_response['message']).to eq({ "error" => "Spam detected" })
-
- spam_logs = SpamLog.all
- expect(spam_logs.count).to eq(1)
- expect(spam_logs[0].title).to eq('new issue')
- expect(spam_logs[0].description).to eq('content here')
- expect(spam_logs[0].user).to eq(user)
- expect(spam_logs[0].noteable_type).to eq('Issue')
- end
- end
-
- describe "PUT /projects/:id/issues/:issue_iid to update only title" do
- it "updates a project issue" do
- put api("/projects/#{project.id}/issues/#{issue.iid}", user),
- params: { title: 'updated title' }
- expect(response).to have_gitlab_http_status(200)
-
- expect(json_response['title']).to eq('updated title')
- end
-
- it "returns 404 error if issue iid not found" do
- put api("/projects/#{project.id}/issues/44444", user),
- params: { title: 'updated title' }
- expect(response).to have_gitlab_http_status(404)
- end
-
- it "returns 404 error if issue id is used instead of the iid" do
- put api("/projects/#{project.id}/issues/#{issue.id}", user),
- params: { title: 'updated title' }
- expect(response).to have_gitlab_http_status(404)
- end
-
- it 'allows special label names' do
- put api("/projects/#{project.id}/issues/#{issue.iid}", user),
- params: {
- title: 'updated title',
- labels: 'label, label?, label&foo, ?, &'
- }
-
- expect(response.status).to eq(200)
- expect(json_response['labels']).to include 'label'
- expect(json_response['labels']).to include 'label?'
- expect(json_response['labels']).to include 'label&foo'
- expect(json_response['labels']).to include '?'
- expect(json_response['labels']).to include '&'
- end
-
- it 'allows special label names with labels param as array' do
- put api("/projects/#{project.id}/issues/#{issue.iid}", user),
- params: {
- title: 'updated title',
- labels: ['label', 'label?', 'label&foo, ?, &']
- }
-
- expect(response.status).to eq(200)
- expect(json_response['labels']).to include 'label'
- expect(json_response['labels']).to include 'label?'
- expect(json_response['labels']).to include 'label&foo'
- expect(json_response['labels']).to include '?'
- expect(json_response['labels']).to include '&'
- end
-
- context 'confidential issues' do
- it "returns 403 for non project members" do
- put api("/projects/#{project.id}/issues/#{confidential_issue.iid}", non_member),
- params: { title: 'updated title' }
- expect(response).to have_gitlab_http_status(403)
- end
-
- it "returns 403 for project members with guest role" do
- put api("/projects/#{project.id}/issues/#{confidential_issue.iid}", guest),
- params: { title: 'updated title' }
- expect(response).to have_gitlab_http_status(403)
- end
-
- it "updates a confidential issue for project members" do
- put api("/projects/#{project.id}/issues/#{confidential_issue.iid}", user),
- params: { title: 'updated title' }
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['title']).to eq('updated title')
- end
-
- it "updates a confidential issue for author" do
- put api("/projects/#{project.id}/issues/#{confidential_issue.iid}", author),
- params: { title: 'updated title' }
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['title']).to eq('updated title')
- end
-
- it "updates a confidential issue for admin" do
- put api("/projects/#{project.id}/issues/#{confidential_issue.iid}", admin),
- params: { title: 'updated title' }
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['title']).to eq('updated title')
- end
-
- it 'sets an issue to confidential' do
- put api("/projects/#{project.id}/issues/#{issue.iid}", user),
- params: { confidential: true }
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['confidential']).to be_truthy
- end
-
- it 'makes a confidential issue public' do
- put api("/projects/#{project.id}/issues/#{confidential_issue.iid}", user),
- params: { confidential: false }
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['confidential']).to be_falsy
- end
-
- it 'does not update a confidential issue with wrong confidential flag' do
- put api("/projects/#{project.id}/issues/#{confidential_issue.iid}", user),
- params: { confidential: 'foo' }
-
- expect(response).to have_gitlab_http_status(400)
- expect(json_response['error']).to eq('confidential is invalid')
- end
- end
- end
-
- describe 'PUT /projects/:id/issues/:issue_iid with spam filtering' do
- let(:params) do
- {
- title: 'updated title',
- description: 'content here',
- labels: 'label, label2'
- }
- end
-
- it "does not create a new project issue" do
- allow_any_instance_of(SpamService).to receive_messages(check_for_spam?: true)
- allow_any_instance_of(AkismetService).to receive_messages(spam?: true)
-
- put api("/projects/#{project.id}/issues/#{issue.iid}", user), params: params
-
- expect(response).to have_gitlab_http_status(400)
- expect(json_response['message']).to eq({ "error" => "Spam detected" })
-
- spam_logs = SpamLog.all
- expect(spam_logs.count).to eq(1)
- expect(spam_logs[0].title).to eq('updated title')
- expect(spam_logs[0].description).to eq('content here')
- expect(spam_logs[0].user).to eq(user)
- expect(spam_logs[0].noteable_type).to eq('Issue')
- end
- end
-
- describe 'PUT /projects/:id/issues/:issue_iid to update assignee' do
- context 'support for deprecated assignee_id' do
- it 'removes assignee' do
- put api("/projects/#{project.id}/issues/#{issue.iid}", user),
- params: { assignee_id: 0 }
-
- expect(response).to have_gitlab_http_status(200)
-
- expect(json_response['assignee']).to be_nil
- end
-
- it 'updates an issue with new assignee' do
- put api("/projects/#{project.id}/issues/#{issue.iid}", user),
- params: { assignee_id: user2.id }
-
- expect(response).to have_gitlab_http_status(200)
-
- expect(json_response['assignee']['name']).to eq(user2.name)
- end
- end
-
- it 'removes assignee' do
- put api("/projects/#{project.id}/issues/#{issue.iid}", user),
- params: { assignee_ids: [0] }
-
- expect(response).to have_gitlab_http_status(200)
-
- expect(json_response['assignees']).to be_empty
- end
-
- it 'updates an issue with new assignee' do
- put api("/projects/#{project.id}/issues/#{issue.iid}", user),
- params: { assignee_ids: [user2.id] }
-
- expect(response).to have_gitlab_http_status(200)
-
- expect(json_response['assignees'].first['name']).to eq(user2.name)
- end
-
- context 'single assignee restrictions' do
- it 'updates an issue with several assignees but only one has been applied' do
- put api("/projects/#{project.id}/issues/#{issue.iid}", user),
- params: { assignee_ids: [user2.id, guest.id] }
-
- expect(response).to have_gitlab_http_status(200)
-
- expect(json_response['assignees'].size).to eq(1)
- end
- end
- end
-
- describe 'PUT /projects/:id/issues/:issue_iid to update labels' do
- let!(:label) { create(:label, title: 'dummy', project: project) }
- let!(:label_link) { create(:label_link, label: label, target: issue) }
-
- it 'does not update labels if not present' do
- put api("/projects/#{project.id}/issues/#{issue.iid}", user),
- params: { title: 'updated title' }
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['labels']).to eq([label.title])
- end
-
- it 'removes all labels and touches the record' do
- Timecop.travel(1.minute.from_now) do
- put api("/projects/#{project.id}/issues/#{issue.iid}", user), params: { labels: '' }
- end
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['labels']).to eq([])
- expect(json_response['updated_at']).to be > Time.now
- end
-
- it 'removes all labels and touches the record with labels param as array' do
- Timecop.travel(1.minute.from_now) do
- put api("/projects/#{project.id}/issues/#{issue.iid}", user), params: { labels: [''] }
- end
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['labels']).to eq([])
- expect(json_response['updated_at']).to be > Time.now
- end
-
- it 'updates labels and touches the record' do
- Timecop.travel(1.minute.from_now) do
- put api("/projects/#{project.id}/issues/#{issue.iid}", user),
- params: { labels: 'foo,bar' }
- end
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['labels']).to include 'foo'
- expect(json_response['labels']).to include 'bar'
- expect(json_response['updated_at']).to be > Time.now
- end
-
- it 'updates labels and touches the record with labels param as array' do
- Timecop.travel(1.minute.from_now) do
- put api("/projects/#{project.id}/issues/#{issue.iid}", user),
- params: { labels: %w(foo bar) }
- end
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['labels']).to include 'foo'
- expect(json_response['labels']).to include 'bar'
- expect(json_response['updated_at']).to be > Time.now
- end
-
- it 'allows special label names' do
- put api("/projects/#{project.id}/issues/#{issue.iid}", user),
- params: { labels: 'label:foo, label-bar,label_bar,label/bar,label?bar,label&bar,?,&' }
- expect(response.status).to eq(200)
- expect(json_response['labels']).to include 'label:foo'
- expect(json_response['labels']).to include 'label-bar'
- expect(json_response['labels']).to include 'label_bar'
- expect(json_response['labels']).to include 'label/bar'
- expect(json_response['labels']).to include 'label?bar'
- expect(json_response['labels']).to include 'label&bar'
- expect(json_response['labels']).to include '?'
- expect(json_response['labels']).to include '&'
- end
-
- it 'allows special label names with labels param as array' do
- put api("/projects/#{project.id}/issues/#{issue.iid}", user),
- params: { labels: ['label:foo', 'label-bar', 'label_bar', 'label/bar,label?bar,label&bar,?,&'] }
- expect(response.status).to eq(200)
- expect(json_response['labels']).to include 'label:foo'
- expect(json_response['labels']).to include 'label-bar'
- expect(json_response['labels']).to include 'label_bar'
- expect(json_response['labels']).to include 'label/bar'
- expect(json_response['labels']).to include 'label?bar'
- expect(json_response['labels']).to include 'label&bar'
- expect(json_response['labels']).to include '?'
- expect(json_response['labels']).to include '&'
- end
-
- it 'returns 400 if title is too long' do
- put api("/projects/#{project.id}/issues/#{issue.iid}", user),
- params: { title: 'g' * 256 }
- expect(response).to have_gitlab_http_status(400)
- expect(json_response['message']['title']).to eq([
- 'is too long (maximum is 255 characters)'
- ])
- end
- end
-
- describe "PUT /projects/:id/issues/:issue_iid to update state and label" do
- it "updates a project issue" do
- put api("/projects/#{project.id}/issues/#{issue.iid}", user),
- params: { labels: 'label2', state_event: "close" }
- expect(response).to have_gitlab_http_status(200)
-
- expect(json_response['labels']).to include 'label2'
- expect(json_response['state']).to eq "closed"
- end
-
- it 'reopens a project isssue' do
- put api("/projects/#{project.id}/issues/#{closed_issue.iid}", user), params: { state_event: 'reopen' }
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['state']).to eq 'opened'
- end
-
- context 'when an admin or owner makes the request' do
- it 'accepts the update date to be set' do
- update_time = 2.weeks.ago
- put api("/projects/#{project.id}/issues/#{issue.iid}", user),
- params: { labels: 'label3', state_event: 'close', updated_at: update_time }
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['labels']).to include 'label3'
- expect(Time.parse(json_response['updated_at'])).to be_like_time(update_time)
- end
- end
- end
-
- describe 'PUT /projects/:id/issues/:issue_iid to update due date' do
- it 'creates a new project issue' do
- due_date = 2.weeks.from_now.strftime('%Y-%m-%d')
-
- put api("/projects/#{project.id}/issues/#{issue.iid}", user), params: { due_date: due_date }
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['due_date']).to eq(due_date)
- end
- end
-
- describe "DELETE /projects/:id/issues/:issue_iid" do
- it "rejects a non member from deleting an issue" do
- delete api("/projects/#{project.id}/issues/#{issue.iid}", non_member)
- expect(response).to have_gitlab_http_status(403)
- end
-
- it "rejects a developer from deleting an issue" do
- delete api("/projects/#{project.id}/issues/#{issue.iid}", author)
- expect(response).to have_gitlab_http_status(403)
- end
-
- context "when the user is project owner" do
- let(:owner) { create(:user) }
- let(:project) { create(:project, namespace: owner.namespace) }
-
- it "deletes the issue if an admin requests it" do
- delete api("/projects/#{project.id}/issues/#{issue.iid}", owner)
-
- expect(response).to have_gitlab_http_status(204)
- end
-
- it_behaves_like '412 response' do
- let(:request) { api("/projects/#{project.id}/issues/#{issue.iid}", owner) }
- end
- end
-
- context 'when issue does not exist' do
- it 'returns 404 when trying to move an issue' do
- delete api("/projects/#{project.id}/issues/123", user)
-
- expect(response).to have_gitlab_http_status(404)
- end
- end
-
- it 'returns 404 when using the issue ID instead of IID' do
- delete api("/projects/#{project.id}/issues/#{issue.id}", user)
-
- expect(response).to have_gitlab_http_status(404)
- end
- end
-
- describe '/projects/:id/issues/:issue_iid/move' do
- let!(:target_project) { create(:project, creator_id: user.id, namespace: user.namespace ) }
- let!(:target_project2) { create(:project, creator_id: non_member.id, namespace: non_member.namespace ) }
-
- it 'moves an issue' do
- post api("/projects/#{project.id}/issues/#{issue.iid}/move", user),
- params: { to_project_id: target_project.id }
-
- expect(response).to have_gitlab_http_status(201)
- expect(json_response['project_id']).to eq(target_project.id)
- end
-
- context 'when source and target projects are the same' do
- it 'returns 400 when trying to move an issue' do
- post api("/projects/#{project.id}/issues/#{issue.iid}/move", user),
- params: { to_project_id: project.id }
-
- expect(response).to have_gitlab_http_status(400)
- expect(json_response['message']).to eq('Cannot move issue to project it originates from!')
- end
- end
-
- context 'when the user does not have the permission to move issues' do
- it 'returns 400 when trying to move an issue' do
- post api("/projects/#{project.id}/issues/#{issue.iid}/move", user),
- params: { to_project_id: target_project2.id }
-
- expect(response).to have_gitlab_http_status(400)
- expect(json_response['message']).to eq('Cannot move issue due to insufficient permissions!')
- end
- end
-
- it 'moves the issue to another namespace if I am admin' do
- post api("/projects/#{project.id}/issues/#{issue.iid}/move", admin),
- params: { to_project_id: target_project2.id }
-
- expect(response).to have_gitlab_http_status(201)
- expect(json_response['project_id']).to eq(target_project2.id)
- end
-
- context 'when using the issue ID instead of iid' do
- it 'returns 404 when trying to move an issue' do
- post api("/projects/#{project.id}/issues/#{issue.id}/move", user),
- params: { to_project_id: target_project.id }
-
- expect(response).to have_gitlab_http_status(404)
- expect(json_response['message']).to eq('404 Issue Not Found')
- end
- end
-
- context 'when issue does not exist' do
- it 'returns 404 when trying to move an issue' do
- post api("/projects/#{project.id}/issues/123/move", user),
- params: { to_project_id: target_project.id }
-
- expect(response).to have_gitlab_http_status(404)
- expect(json_response['message']).to eq('404 Issue Not Found')
- end
- end
-
- context 'when source project does not exist' do
- it 'returns 404 when trying to move an issue' do
- post api("/projects/0/issues/#{issue.iid}/move", user),
- params: { to_project_id: target_project.id }
-
- expect(response).to have_gitlab_http_status(404)
- expect(json_response['message']).to eq('404 Project Not Found')
- end
- end
-
- context 'when target project does not exist' do
- it 'returns 404 when trying to move an issue' do
- post api("/projects/#{project.id}/issues/#{issue.iid}/move", user),
- params: { to_project_id: 0 }
-
- expect(response).to have_gitlab_http_status(404)
- end
- end
- end
-
- describe 'POST :id/issues/:issue_iid/subscribe' do
- it 'subscribes to an issue' do
- post api("/projects/#{project.id}/issues/#{issue.iid}/subscribe", user2)
-
- expect(response).to have_gitlab_http_status(201)
- expect(json_response['subscribed']).to eq(true)
- end
-
- it 'returns 304 if already subscribed' do
- post api("/projects/#{project.id}/issues/#{issue.iid}/subscribe", user)
-
- expect(response).to have_gitlab_http_status(304)
- end
-
- it 'returns 404 if the issue is not found' do
- post api("/projects/#{project.id}/issues/123/subscribe", user)
-
- expect(response).to have_gitlab_http_status(404)
- end
-
- it 'returns 404 if the issue ID is used instead of the iid' do
- post api("/projects/#{project.id}/issues/#{issue.id}/subscribe", user)
-
- expect(response).to have_gitlab_http_status(404)
- end
-
- it 'returns 404 if the issue is confidential' do
- post api("/projects/#{project.id}/issues/#{confidential_issue.iid}/subscribe", non_member)
-
- expect(response).to have_gitlab_http_status(404)
- end
- end
-
- describe 'POST :id/issues/:issue_id/unsubscribe' do
- it 'unsubscribes from an issue' do
- post api("/projects/#{project.id}/issues/#{issue.iid}/unsubscribe", user)
-
- expect(response).to have_gitlab_http_status(201)
- expect(json_response['subscribed']).to eq(false)
- end
-
- it 'returns 304 if not subscribed' do
- post api("/projects/#{project.id}/issues/#{issue.iid}/unsubscribe", user2)
-
- expect(response).to have_gitlab_http_status(304)
- end
-
- it 'returns 404 if the issue is not found' do
- post api("/projects/#{project.id}/issues/123/unsubscribe", user)
-
- expect(response).to have_gitlab_http_status(404)
- end
-
- it 'returns 404 if using the issue ID instead of iid' do
- post api("/projects/#{project.id}/issues/#{issue.id}/unsubscribe", user)
-
- expect(response).to have_gitlab_http_status(404)
- end
-
- it 'returns 404 if the issue is confidential' do
- post api("/projects/#{project.id}/issues/#{confidential_issue.iid}/unsubscribe", non_member)
-
- expect(response).to have_gitlab_http_status(404)
- end
- end
-
- describe 'time tracking endpoints' do
- let(:issuable) { issue }
-
- include_examples 'time tracking endpoints', 'issue'
- end
-
- describe 'GET :id/issues/:issue_iid/closed_by' do
- let(:merge_request) do
- create(:merge_request,
- :simple,
- author: user,
- source_project: project,
- target_project: project,
- description: "closes #{issue.to_reference}")
- end
-
- before do
- create(:merge_requests_closing_issues, issue: issue, merge_request: merge_request)
- end
-
- context 'when unauthenticated' do
- it 'return public project issues' do
- get api("/projects/#{project.id}/issues/#{issue.iid}/closed_by")
-
- expect_paginated_array_response(merge_request.id)
- end
- end
-
- it 'returns merge requests that will close issue on merge' do
- get api("/projects/#{project.id}/issues/#{issue.iid}/closed_by", user)
-
- expect_paginated_array_response(merge_request.id)
- end
-
- context 'when no merge requests will close issue' do
- it 'returns empty array' do
- get api("/projects/#{project.id}/issues/#{closed_issue.iid}/closed_by", user)
-
- expect_paginated_array_response([])
- end
- end
-
- it "returns 404 when issue doesn't exists" do
- get api("/projects/#{project.id}/issues/0/closed_by", user)
-
- expect(response).to have_gitlab_http_status(404)
- end
- end
-
- describe 'GET :id/issues/:issue_iid/related_merge_requests' do
- def get_related_merge_requests(project_id, issue_iid, user = nil)
- get api("/projects/#{project_id}/issues/#{issue_iid}/related_merge_requests", user)
- end
-
- def create_referencing_mr(user, project, issue)
- attributes = {
- author: user,
- source_project: project,
- target_project: project,
- source_branch: "master",
- target_branch: "test",
- description: "See #{issue.to_reference}"
- }
- create(:merge_request, attributes).tap do |merge_request|
- create(:note, :system, project: issue.project, noteable: issue, author: user, note: merge_request.to_reference(full: true))
- end
- end
-
- let!(:related_mr) { create_referencing_mr(user, project, issue) }
-
- context 'when unauthenticated' do
- it 'return list of referenced merge requests from issue' do
- get_related_merge_requests(project.id, issue.iid)
-
- expect_paginated_array_response(related_mr.id)
- end
-
- it 'renders 404 if project is not visible' do
- private_project = create(:project, :private)
- private_issue = create(:issue, project: private_project)
- create_referencing_mr(user, private_project, private_issue)
-
- get_related_merge_requests(private_project.id, private_issue.iid)
-
- expect(response).to have_gitlab_http_status(404)
- end
- end
-
- it 'returns merge requests that mentioned a issue' do
- create(:merge_request,
- :simple,
- author: user,
- source_project: project,
- target_project: project,
- description: "Some description")
-
- get_related_merge_requests(project.id, issue.iid, user)
-
- expect_paginated_array_response(related_mr.id)
- end
-
- it 'returns merge requests cross-project wide' do
- project2 = create(:project, :public, creator_id: user.id, namespace: user.namespace)
- merge_request = create_referencing_mr(user, project2, issue)
-
- get_related_merge_requests(project.id, issue.iid, user)
-
- expect_paginated_array_response([related_mr.id, merge_request.id])
- end
-
- it 'does not generate references to projects with no access' do
- private_project = create(:project, :private)
- create_referencing_mr(private_project.creator, private_project, issue)
-
- get_related_merge_requests(project.id, issue.iid, user)
-
- expect_paginated_array_response(related_mr.id)
- end
-
- context 'merge request closes an issue' do
- let!(:closing_issue_mr_rel) do
- create(:merge_requests_closing_issues, issue: issue, merge_request: related_mr)
- end
-
- it 'returns closing MR only once' do
- get_related_merge_requests(project.id, issue.iid, user)
-
- expect_paginated_array_response([related_mr.id])
- end
- end
-
- context 'no merge request mentioned a issue' do
- it 'returns empty array' do
- get_related_merge_requests(project.id, closed_issue.iid, user)
-
- expect_paginated_array_response([])
- end
- end
-
- it "returns 404 when issue doesn't exists" do
- get_related_merge_requests(project.id, 0, user)
-
- expect(response).to have_gitlab_http_status(404)
- end
- end
-
- describe "GET /projects/:id/issues/:issue_iid/user_agent_detail" do
- let!(:user_agent_detail) { create(:user_agent_detail, subject: issue) }
-
- context 'when unauthenticated' do
- it "returns unauthorized" do
- get api("/projects/#{project.id}/issues/#{issue.iid}/user_agent_detail")
-
- expect(response).to have_gitlab_http_status(401)
- end
- end
-
- it 'exposes known attributes' do
- get api("/projects/#{project.id}/issues/#{issue.iid}/user_agent_detail", admin)
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['user_agent']).to eq(user_agent_detail.user_agent)
- expect(json_response['ip_address']).to eq(user_agent_detail.ip_address)
- expect(json_response['akismet_submitted']).to eq(user_agent_detail.submitted)
- end
-
- it "returns unauthorized for non-admin users" do
- get api("/projects/#{project.id}/issues/#{issue.iid}/user_agent_detail", user)
-
- expect(response).to have_gitlab_http_status(403)
- end
- end
-
- describe 'GET projects/:id/issues/:issue_iid/participants' do
- it_behaves_like 'issuable participants endpoint' do
- let(:entity) { issue }
- end
-
- it 'returns 404 if the issue is confidential' do
- post api("/projects/#{project.id}/issues/#{confidential_issue.iid}/participants", non_member)
-
- expect(response).to have_gitlab_http_status(404)
- end
- end
-end
diff --git a/spec/requests/api/jobs_spec.rb b/spec/requests/api/jobs_spec.rb
index c14507de186..43462913497 100644
--- a/spec/requests/api/jobs_spec.rb
+++ b/spec/requests/api/jobs_spec.rb
@@ -286,6 +286,7 @@ describe API::Jobs do
expect(json_response['ref']).to eq(job.ref)
expect(json_response['tag']).to eq(job.tag)
expect(json_response['coverage']).to eq(job.coverage)
+ expect(json_response['allow_failure']).to eq(job.allow_failure)
expect(Time.parse(json_response['created_at'])).to be_like_time(job.created_at)
expect(Time.parse(json_response['started_at'])).to be_like_time(job.started_at)
expect(Time.parse(json_response['finished_at'])).to be_like_time(job.finished_at)
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb
index 007f3517e64..5c94a87529b 100644
--- a/spec/requests/api/merge_requests_spec.rb
+++ b/spec/requests/api/merge_requests_spec.rb
@@ -1495,33 +1495,6 @@ describe API::MergeRequests do
expect(json_response['merge_when_pipeline_succeeds']).to eq(true)
end
- context 'when the MR requires pipeline success' do
- it 'returns 405 if the pipeline is missing' do
- allow_any_instance_of(MergeRequest)
- .to receive(:merge_when_pipeline_succeeds).and_return(true)
- allow_any_instance_of(MergeRequest).to receive(:head_pipeline).and_return(nil)
-
- put api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/merge", user)
-
- expect(response).to have_gitlab_http_status(405)
- expect(json_response['message']).to eq('Not allowed: pipeline does not exist')
- end
- end
-
- context 'when the request requires pipeline success' do
- it 'returns 405 if the pipeline is missing' do
- allow_any_instance_of(MergeRequest)
- .to receive(:merge_when_pipeline_succeeds).and_return(true)
- allow_any_instance_of(MergeRequest).to receive(:head_pipeline).and_return(nil)
-
- put api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/merge", user),
- params: { merge_when_pipeline_succeeds: true }
-
- expect(response).to have_gitlab_http_status(405)
- expect(json_response['message']).to eq('Not allowed: pipeline does not exist')
- end
- end
-
it "returns 404 for an invalid merge request IID" do
put api("/projects/#{project.id}/merge_requests/12345/merge", user)
diff --git a/spec/requests/api/project_clusters_spec.rb b/spec/requests/api/project_clusters_spec.rb
index 5357be3cdee..fc0381159dd 100644
--- a/spec/requests/api/project_clusters_spec.rb
+++ b/spec/requests/api/project_clusters_spec.rb
@@ -351,7 +351,7 @@ describe API::ProjectClusters do
it 'does not update cluster attributes' do
expect(cluster.domain).not_to eq('new_domain.com')
expect(cluster.platform_kubernetes.namespace).not_to eq('invalid_namespace')
- expect(cluster.kubernetes_namespace.namespace).not_to eq('invalid_namespace')
+ expect(cluster.kubernetes_namespace_for(project)).not_to eq('invalid_namespace')
end
it 'returns validation errors' do
diff --git a/spec/requests/api/runner_spec.rb b/spec/requests/api/runner_spec.rb
index b331da1acba..4006e697a41 100644
--- a/spec/requests/api/runner_spec.rb
+++ b/spec/requests/api/runner_spec.rb
@@ -542,6 +542,30 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
end
end
+ context 'when job filtered by job_age' do
+ let!(:job) { create(:ci_build, :tag, pipeline: pipeline, name: 'spinach', stage: 'test', stage_idx: 0, queued_at: 60.seconds.ago) }
+
+ context 'job is queued less than job_age parameter' do
+ let(:job_age) { 120 }
+
+ it 'gives 204' do
+ request_job(job_age: job_age)
+
+ expect(response).to have_gitlab_http_status(204)
+ end
+ end
+
+ context 'job is queued more than job_age parameter' do
+ let(:job_age) { 30 }
+
+ it 'picks a job' do
+ request_job(job_age: job_age)
+
+ expect(response).to have_gitlab_http_status(201)
+ end
+ end
+ end
+
context 'when job is made for branch' do
it 'sets tag as ref_type' do
request_job
diff --git a/spec/requests/api/search_spec.rb b/spec/requests/api/search_spec.rb
index 49672591b3b..7d61ec9c4d8 100644
--- a/spec/requests/api/search_spec.rb
+++ b/spec/requests/api/search_spec.rb
@@ -414,6 +414,13 @@ describe API::Search do
expect(response).to have_gitlab_http_status(200)
expect(json_response.size).to eq(11)
end
+
+ it 'by ref' do
+ get api("/projects/#{repo_project.id}/search", user), params: { scope: 'blobs', search: 'This file is used in tests for ci_environments_status', ref: 'pages-deploy' }
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response.size).to eq(1)
+ end
end
end
end
diff --git a/spec/requests/api/variables_spec.rb b/spec/requests/api/variables_spec.rb
index cc07869a744..55b1419a004 100644
--- a/spec/requests/api/variables_spec.rb
+++ b/spec/requests/api/variables_spec.rb
@@ -43,6 +43,7 @@ describe API::Variables do
expect(response).to have_gitlab_http_status(200)
expect(json_response['value']).to eq(variable.value)
expect(json_response['protected']).to eq(variable.protected?)
+ expect(json_response['masked']).to eq(variable.masked?)
expect(json_response['variable_type']).to eq('env_var')
end
@@ -74,13 +75,14 @@ describe API::Variables do
context 'authorized user with proper permissions' do
it 'creates variable' do
expect do
- post api("/projects/#{project.id}/variables", user), params: { key: 'TEST_VARIABLE_2', value: 'PROTECTED_VALUE_2', protected: true }
+ post api("/projects/#{project.id}/variables", user), params: { key: 'TEST_VARIABLE_2', value: 'PROTECTED_VALUE_2', protected: true, masked: true }
end.to change {project.variables.count}.by(1)
expect(response).to have_gitlab_http_status(201)
expect(json_response['key']).to eq('TEST_VARIABLE_2')
expect(json_response['value']).to eq('PROTECTED_VALUE_2')
expect(json_response['protected']).to be_truthy
+ expect(json_response['masked']).to be_truthy
expect(json_response['variable_type']).to eq('env_var')
end
@@ -93,6 +95,7 @@ describe API::Variables do
expect(json_response['key']).to eq('TEST_VARIABLE_2')
expect(json_response['value']).to eq('VALUE_2')
expect(json_response['protected']).to be_falsey
+ expect(json_response['masked']).to be_falsey
expect(json_response['variable_type']).to eq('file')
end
diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb
index a0d01fc8263..dd9540c11d1 100644
--- a/spec/routing/project_routing_spec.rb
+++ b/spec/routing/project_routing_spec.rb
@@ -204,25 +204,27 @@ describe 'project routing' do
describe Projects::BranchesController, 'routing' do
it 'to #branches' do
- expect(get('/gitlab/gitlabhq/branches')).to route_to('projects/branches#index', namespace_id: 'gitlab', project_id: 'gitlabhq')
- expect(delete('/gitlab/gitlabhq/branches/feature%2345')).to route_to('projects/branches#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature#45')
- expect(delete('/gitlab/gitlabhq/branches/feature%2B45')).to route_to('projects/branches#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature+45')
- expect(delete('/gitlab/gitlabhq/branches/feature@45')).to route_to('projects/branches#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature@45')
- expect(delete('/gitlab/gitlabhq/branches/feature%2345/foo/bar/baz')).to route_to('projects/branches#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature#45/foo/bar/baz')
- expect(delete('/gitlab/gitlabhq/branches/feature%2B45/foo/bar/baz')).to route_to('projects/branches#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature+45/foo/bar/baz')
- expect(delete('/gitlab/gitlabhq/branches/feature@45/foo/bar/baz')).to route_to('projects/branches#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature@45/foo/bar/baz')
+ expect(get('/gitlab/gitlabhq/-/branches')).to route_to('projects/branches#index', namespace_id: 'gitlab', project_id: 'gitlabhq')
+ expect(delete('/gitlab/gitlabhq/-/branches/feature%2345')).to route_to('projects/branches#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature#45')
+ expect(delete('/gitlab/gitlabhq/-/branches/feature%2B45')).to route_to('projects/branches#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature+45')
+ expect(delete('/gitlab/gitlabhq/-/branches/feature@45')).to route_to('projects/branches#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature@45')
+ expect(delete('/gitlab/gitlabhq/-/branches/feature%2345/foo/bar/baz')).to route_to('projects/branches#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature#45/foo/bar/baz')
+ expect(delete('/gitlab/gitlabhq/-/branches/feature%2B45/foo/bar/baz')).to route_to('projects/branches#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature+45/foo/bar/baz')
+ expect(delete('/gitlab/gitlabhq/-/branches/feature@45/foo/bar/baz')).to route_to('projects/branches#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature@45/foo/bar/baz')
end
+
+ it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/branches", "/gitlab/gitlabhq/-/branches"
end
describe Projects::TagsController, 'routing' do
it 'to #tags' do
- expect(get('/gitlab/gitlabhq/tags')).to route_to('projects/tags#index', namespace_id: 'gitlab', project_id: 'gitlabhq')
- expect(delete('/gitlab/gitlabhq/tags/feature%2345')).to route_to('projects/tags#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature#45')
- expect(delete('/gitlab/gitlabhq/tags/feature%2B45')).to route_to('projects/tags#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature+45')
- expect(delete('/gitlab/gitlabhq/tags/feature@45')).to route_to('projects/tags#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature@45')
- expect(delete('/gitlab/gitlabhq/tags/feature%2345/foo/bar/baz')).to route_to('projects/tags#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature#45/foo/bar/baz')
- expect(delete('/gitlab/gitlabhq/tags/feature%2B45/foo/bar/baz')).to route_to('projects/tags#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature+45/foo/bar/baz')
- expect(delete('/gitlab/gitlabhq/tags/feature@45/foo/bar/baz')).to route_to('projects/tags#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature@45/foo/bar/baz')
+ expect(get('/gitlab/gitlabhq/-/tags')).to route_to('projects/tags#index', namespace_id: 'gitlab', project_id: 'gitlabhq')
+ expect(delete('/gitlab/gitlabhq/-/tags/feature%2345')).to route_to('projects/tags#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature#45')
+ expect(delete('/gitlab/gitlabhq/-/tags/feature%2B45')).to route_to('projects/tags#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature+45')
+ expect(delete('/gitlab/gitlabhq/-/tags/feature@45')).to route_to('projects/tags#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature@45')
+ expect(delete('/gitlab/gitlabhq/-/tags/feature%2345/foo/bar/baz')).to route_to('projects/tags#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature#45/foo/bar/baz')
+ expect(delete('/gitlab/gitlabhq/-/tags/feature%2B45/foo/bar/baz')).to route_to('projects/tags#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature+45/foo/bar/baz')
+ expect(delete('/gitlab/gitlabhq/-/tags/feature@45/foo/bar/baz')).to route_to('projects/tags#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature@45/foo/bar/baz')
end
end
@@ -247,6 +249,7 @@ describe 'project routing' do
it_behaves_like 'RESTful project resources' do
let(:actions) { [:index, :create, :destroy] }
let(:controller) { 'protected_branches' }
+ let(:controller_path) { '/-/protected_branches' }
end
end
@@ -592,18 +595,22 @@ describe 'project routing' do
describe Projects::NetworkController, 'routing' do
it 'to #show' do
- expect(get('/gitlab/gitlabhq/network/master')).to route_to('projects/network#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master')
- expect(get('/gitlab/gitlabhq/network/ends-with.json')).to route_to('projects/network#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'ends-with.json')
- expect(get('/gitlab/gitlabhq/network/master?format=json')).to route_to('projects/network#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master', format: 'json')
+ expect(get('/gitlab/gitlabhq/-/network/master')).to route_to('projects/network#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master')
+ expect(get('/gitlab/gitlabhq/-/network/ends-with.json')).to route_to('projects/network#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'ends-with.json')
+ expect(get('/gitlab/gitlabhq/-/network/master?format=json')).to route_to('projects/network#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master', format: 'json')
end
+
+ it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/network/master", "/gitlab/gitlabhq/-/network/master"
end
describe Projects::GraphsController, 'routing' do
it 'to #show' do
- expect(get('/gitlab/gitlabhq/graphs/master')).to route_to('projects/graphs#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master')
- expect(get('/gitlab/gitlabhq/graphs/ends-with.json')).to route_to('projects/graphs#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'ends-with.json')
- expect(get('/gitlab/gitlabhq/graphs/master?format=json')).to route_to('projects/graphs#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master', format: 'json')
+ expect(get('/gitlab/gitlabhq/-/graphs/master')).to route_to('projects/graphs#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master')
+ expect(get('/gitlab/gitlabhq/-/graphs/ends-with.json')).to route_to('projects/graphs#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'ends-with.json')
+ expect(get('/gitlab/gitlabhq/-/graphs/master?format=json')).to route_to('projects/graphs#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master', format: 'json')
end
+
+ it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/graphs/master", "/gitlab/gitlabhq/-/graphs/master"
end
describe Projects::ForksController, 'routing' do
@@ -661,4 +668,12 @@ describe 'project routing' do
end
end
end
+
+ describe Projects::Settings::RepositoryController, 'routing' do
+ it 'to #show' do
+ expect(get('/gitlab/gitlabhq/-/settings/repository')).to route_to('projects/settings/repository#show', namespace_id: 'gitlab', project_id: 'gitlabhq')
+ end
+
+ it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/settings/repository", "/gitlab/gitlabhq/-/settings/repository"
+ end
end
diff --git a/spec/rubocop/cop/code_reuse/active_record_spec.rb b/spec/rubocop/cop/code_reuse/active_record_spec.rb
index a30fc52d26f..8f3a3690d88 100644
--- a/spec/rubocop/cop/code_reuse/active_record_spec.rb
+++ b/spec/rubocop/cop/code_reuse/active_record_spec.rb
@@ -14,7 +14,7 @@ describe RuboCop::Cop::CodeReuse::ActiveRecord do
expect_offense(<<~SOURCE)
def foo
User.where
- ^^^^^ This method can only be used inside an ActiveRecord model
+ ^^^^^ This method can only be used inside an ActiveRecord model: https://gitlab.com/gitlab-org/gitlab-ce/issues/49653
end
SOURCE
end
@@ -23,7 +23,7 @@ describe RuboCop::Cop::CodeReuse::ActiveRecord do
expect_offense(<<~SOURCE)
def foo
User.where(id: 10)
- ^^^^^ This method can only be used inside an ActiveRecord model
+ ^^^^^ This method can only be used inside an ActiveRecord model: https://gitlab.com/gitlab-org/gitlab-ce/issues/49653
end
SOURCE
end
@@ -40,7 +40,7 @@ describe RuboCop::Cop::CodeReuse::ActiveRecord do
expect_offense(<<~SOURCE)
def foo
project.group(:name)
- ^^^^^ This method can only be used inside an ActiveRecord model
+ ^^^^^ This method can only be used inside an ActiveRecord model: https://gitlab.com/gitlab-org/gitlab-ce/issues/49653
end
SOURCE
end
diff --git a/spec/serializers/test_case_entity_spec.rb b/spec/serializers/test_case_entity_spec.rb
index a55910f98bb..986c9feb07b 100644
--- a/spec/serializers/test_case_entity_spec.rb
+++ b/spec/serializers/test_case_entity_spec.rb
@@ -14,6 +14,7 @@ describe TestCaseEntity do
it 'contains correct test case details' do
expect(subject[:status]).to eq('success')
expect(subject[:name]).to eq('Test#sum when a is 1 and b is 3 returns summary')
+ expect(subject[:classname]).to eq('spec.test_spec')
expect(subject[:execution_time]).to eq(1.11)
end
end
@@ -24,6 +25,7 @@ describe TestCaseEntity do
it 'contains correct test case details' do
expect(subject[:status]).to eq('failed')
expect(subject[:name]).to eq('Test#sum when a is 2 and b is 2 returns summary')
+ expect(subject[:classname]).to eq('spec.test_spec')
expect(subject[:execution_time]).to eq(2.22)
end
end
diff --git a/spec/services/auth/container_registry_authentication_service_spec.rb b/spec/services/auth/container_registry_authentication_service_spec.rb
index e24fe60f059..4f4776bbb27 100644
--- a/spec/services/auth/container_registry_authentication_service_spec.rb
+++ b/spec/services/auth/container_registry_authentication_service_spec.rb
@@ -285,7 +285,7 @@ describe Auth::ContainerRegistryAuthenticationService do
it_behaves_like 'not a container repository factory'
end
- context 'disallow guest to delete images since regsitry 2.7' do
+ context 'disallow guest to delete images since registry 2.7' do
before do
project.add_guest(current_user)
end
diff --git a/spec/services/clusters/gcp/kubernetes/create_or_update_namespace_service_spec.rb b/spec/services/clusters/gcp/kubernetes/create_or_update_namespace_service_spec.rb
index 18f218fc236..be052a07da7 100644
--- a/spec/services/clusters/gcp/kubernetes/create_or_update_namespace_service_spec.rb
+++ b/spec/services/clusters/gcp/kubernetes/create_or_update_namespace_service_spec.rb
@@ -113,7 +113,7 @@ describe Clusters::Gcp::Kubernetes::CreateOrUpdateNamespaceService, '#execute' d
it 'does not create any Clusters::KubernetesNamespace' do
subject
- expect(cluster.kubernetes_namespace).to eq(kubernetes_namespace)
+ expect(cluster.kubernetes_namespaces).to eq([kubernetes_namespace])
end
it 'creates project service account' do
diff --git a/spec/services/clusters/refresh_service_spec.rb b/spec/services/clusters/refresh_service_spec.rb
index 94c35228955..5bc8a709941 100644
--- a/spec/services/clusters/refresh_service_spec.rb
+++ b/spec/services/clusters/refresh_service_spec.rb
@@ -93,32 +93,14 @@ describe Clusters::RefreshService do
let(:group) { cluster.group }
let(:project) { create(:project, group: group) }
- context 'when ci_preparing_state feature flag is enabled' do
- include_examples 'does not create a kubernetes namespace'
-
- context 'when project already has kubernetes namespace' do
- before do
- create(:cluster_kubernetes_namespace, project: project, cluster: cluster)
- end
-
- include_examples 'does not create a kubernetes namespace'
- end
- end
+ include_examples 'does not create a kubernetes namespace'
- context 'when ci_preparing_state feature flag is disabled' do
+ context 'when project already has kubernetes namespace' do
before do
- stub_feature_flags(ci_preparing_state: false)
+ create(:cluster_kubernetes_namespace, project: project, cluster: cluster)
end
- include_examples 'creates a kubernetes namespace'
-
- context 'when project already has kubernetes namespace' do
- before do
- create(:cluster_kubernetes_namespace, project: project, cluster: cluster)
- end
-
- include_examples 'does not create a kubernetes namespace'
- end
+ include_examples 'does not create a kubernetes namespace'
end
end
diff --git a/spec/services/git/base_hooks_service_spec.rb b/spec/services/git/base_hooks_service_spec.rb
new file mode 100644
index 00000000000..4a2ec769116
--- /dev/null
+++ b/spec/services/git/base_hooks_service_spec.rb
@@ -0,0 +1,90 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Git::BaseHooksService do
+ include RepoHelpers
+ include GitHelpers
+
+ let(:user) { create(:user) }
+ let(:project) { create(:project, :repository) }
+ let(:service) { described_class.new(project, user, oldrev: oldrev, newrev: newrev, ref: ref) }
+
+ let(:oldrev) { Gitlab::Git::BLANK_SHA }
+ let(:newrev) { "8a2a6eb295bb170b34c24c76c49ed0e9b2eaf34b" } # gitlab-test: git rev-parse refs/tags/v1.1.0
+ let(:ref) { 'refs/tags/v1.1.0' }
+
+ describe 'with remote mirrors' do
+ class TestService < described_class
+ def commits
+ []
+ end
+ end
+
+ let(:project) { create(:project, :repository, :remote_mirror) }
+
+ subject { TestService.new(project, user, oldrev: oldrev, newrev: newrev, ref: ref) }
+
+ before do
+ expect(subject).to receive(:execute_project_hooks)
+ end
+
+ context 'when remote mirror feature is enabled' do
+ it 'fails stuck remote mirrors' do
+ allow(project).to receive(:update_remote_mirrors).and_return(project.remote_mirrors)
+ expect(project).to receive(:mark_stuck_remote_mirrors_as_failed!)
+
+ subject.execute
+ end
+
+ it 'updates remote mirrors' do
+ expect(project).to receive(:update_remote_mirrors)
+
+ subject.execute
+ end
+ end
+
+ context 'when remote mirror feature is disabled' do
+ before do
+ stub_application_setting(mirror_available: false)
+ end
+
+ context 'with remote mirrors global setting overridden' do
+ before do
+ project.remote_mirror_available_overridden = true
+ end
+
+ it 'fails stuck remote mirrors' do
+ allow(project).to receive(:update_remote_mirrors).and_return(project.remote_mirrors)
+ expect(project).to receive(:mark_stuck_remote_mirrors_as_failed!)
+
+ subject.execute
+ end
+
+ it 'updates remote mirrors' do
+ expect(project).to receive(:update_remote_mirrors)
+
+ subject.execute
+ end
+ end
+
+ context 'without remote mirrors global setting overridden' do
+ before do
+ project.remote_mirror_available_overridden = false
+ end
+
+ it 'does not fails stuck remote mirrors' do
+ expect(project).not_to receive(:mark_stuck_remote_mirrors_as_failed!)
+
+ subject.execute
+ end
+
+ it 'does not updates remote mirrors' do
+ expect(project).not_to receive(:update_remote_mirrors)
+
+ subject.execute
+ end
+ end
+ end
+ end
+end
diff --git a/spec/services/git/branch_hooks_service_spec.rb b/spec/services/git/branch_hooks_service_spec.rb
index 4895e762602..22faa996015 100644
--- a/spec/services/git/branch_hooks_service_spec.rb
+++ b/spec/services/git/branch_hooks_service_spec.rb
@@ -18,6 +18,12 @@ describe Git::BranchHooksService do
described_class.new(project, user, oldrev: oldrev, newrev: newrev, ref: ref)
end
+ it 'update remote mirrors' do
+ expect(service).to receive(:update_remote_mirrors).and_call_original
+
+ service.execute
+ end
+
describe "Git Push Data" do
subject(:push_data) { service.execute }
diff --git a/spec/services/git/branch_push_service_spec.rb b/spec/services/git/branch_push_service_spec.rb
index ad21f710833..6e39fa6b3c0 100644
--- a/spec/services/git/branch_push_service_spec.rb
+++ b/spec/services/git/branch_push_service_spec.rb
@@ -17,72 +17,6 @@ describe Git::BranchPushService, services: true do
project.add_maintainer(user)
end
- describe 'with remote mirrors' do
- let(:project) { create(:project, :repository, :remote_mirror) }
-
- subject do
- described_class.new(project, user, oldrev: oldrev, newrev: newrev, ref: ref)
- end
-
- context 'when remote mirror feature is enabled' do
- it 'fails stuck remote mirrors' do
- allow(project).to receive(:update_remote_mirrors).and_return(project.remote_mirrors)
- expect(project).to receive(:mark_stuck_remote_mirrors_as_failed!)
-
- subject.execute
- end
-
- it 'updates remote mirrors' do
- expect(project).to receive(:update_remote_mirrors)
-
- subject.execute
- end
- end
-
- context 'when remote mirror feature is disabled' do
- before do
- stub_application_setting(mirror_available: false)
- end
-
- context 'with remote mirrors global setting overridden' do
- before do
- project.remote_mirror_available_overridden = true
- end
-
- it 'fails stuck remote mirrors' do
- allow(project).to receive(:update_remote_mirrors).and_return(project.remote_mirrors)
- expect(project).to receive(:mark_stuck_remote_mirrors_as_failed!)
-
- subject.execute
- end
-
- it 'updates remote mirrors' do
- expect(project).to receive(:update_remote_mirrors)
-
- subject.execute
- end
- end
-
- context 'without remote mirrors global setting overridden' do
- before do
- project.remote_mirror_available_overridden = false
- end
-
- it 'does not fails stuck remote mirrors' do
- expect(project).not_to receive(:mark_stuck_remote_mirrors_as_failed!)
-
- subject.execute
- end
-
- it 'does not updates remote mirrors' do
- expect(project).not_to receive(:update_remote_mirrors)
-
- subject.execute
- end
- end
- end
- end
-
describe 'Push branches' do
subject do
execute_service(project, user, oldrev, newrev, ref)
diff --git a/spec/services/git/tag_hooks_service_spec.rb b/spec/services/git/tag_hooks_service_spec.rb
index f4c02932f98..f5938a5c708 100644
--- a/spec/services/git/tag_hooks_service_spec.rb
+++ b/spec/services/git/tag_hooks_service_spec.rb
@@ -18,6 +18,12 @@ describe Git::TagHooksService, :service do
described_class.new(project, user, oldrev: oldrev, newrev: newrev, ref: ref)
end
+ it 'update remote mirrors' do
+ expect(service).to receive(:update_remote_mirrors).and_call_original
+
+ service.execute
+ end
+
describe 'System hooks' do
it 'Executes system hooks' do
push_data = service.execute
diff --git a/spec/services/issues/close_service_spec.rb b/spec/services/issues/close_service_spec.rb
index fce9eed8b08..6874a8a0929 100644
--- a/spec/services/issues/close_service_spec.rb
+++ b/spec/services/issues/close_service_spec.rb
@@ -3,11 +3,13 @@
require 'spec_helper'
describe Issues::CloseService do
- let(:user) { create(:user) }
- let(:user2) { create(:user) }
+ let(:project) { create(:project, :repository) }
+ let(:user) { create(:user, email: "user@example.com") }
+ let(:user2) { create(:user, email: "user2@example.com") }
let(:guest) { create(:user) }
- let(:issue) { create(:issue, assignees: [user2], author: create(:user)) }
- let(:project) { issue.project }
+ let(:issue) { create(:issue, title: "My issue", project: project, assignees: [user2], author: create(:user)) }
+ let(:closing_merge_request) { create(:merge_request, source_project: project) }
+ let(:closing_commit) { create(:commit, project: project) }
let!(:todo) { create(:todo, :assigned, user: user, project: project, target: issue, author: user2) }
before do
@@ -39,7 +41,7 @@ describe Issues::CloseService do
.and_return(true)
expect(service).to receive(:close_issue)
- .with(issue, commit: nil, notifications: true, system_note: true)
+ .with(issue, closed_via: nil, notifications: true, system_note: true)
service.execute(issue)
end
@@ -57,6 +59,38 @@ describe Issues::CloseService do
end
describe '#close_issue' do
+ context "closed by a merge request" do
+ before do
+ perform_enqueued_jobs do
+ described_class.new(project, user).close_issue(issue, closed_via: closing_merge_request)
+ end
+ end
+
+ it 'mentions closure via a merge request' do
+ email = ActionMailer::Base.deliveries.last
+
+ expect(email.to.first).to eq(user2.email)
+ expect(email.subject).to include(issue.title)
+ expect(email.body.parts.map(&:body)).to all(include(closing_merge_request.to_reference))
+ end
+ end
+
+ context "closed by a commit" do
+ before do
+ perform_enqueued_jobs do
+ described_class.new(project, user).close_issue(issue, closed_via: closing_commit)
+ end
+ end
+
+ it 'mentions closure via a commit' do
+ email = ActionMailer::Base.deliveries.last
+
+ expect(email.to.first).to eq(user2.email)
+ expect(email.subject).to include(issue.title)
+ expect(email.body.parts.map(&:body)).to all(include(closing_commit.id))
+ end
+ end
+
context "valid params" do
before do
perform_enqueued_jobs do
diff --git a/spec/services/merge_requests/rebase_service_spec.rb b/spec/services/merge_requests/rebase_service_spec.rb
index a443e4588d9..7e2f03d1097 100644
--- a/spec/services/merge_requests/rebase_service_spec.rb
+++ b/spec/services/merge_requests/rebase_service_spec.rb
@@ -38,6 +38,32 @@ describe MergeRequests::RebaseService do
end
end
+ shared_examples 'sequence of failure and success' do
+ it 'properly clears the error message' do
+ allow(repository).to receive(:gitaly_operation_client).and_raise('Something went wrong')
+
+ service.execute(merge_request)
+
+ expect(merge_request.reload.merge_error).to eq described_class::REBASE_ERROR
+
+ allow(repository).to receive(:gitaly_operation_client).and_call_original
+
+ service.execute(merge_request)
+
+ expect(merge_request.reload.merge_error).to eq nil
+ end
+ end
+
+ it_behaves_like 'sequence of failure and success'
+
+ context 'with deprecated step rebase feature' do
+ before do
+ stub_feature_flags(two_step_rebase: false)
+ end
+
+ it_behaves_like 'sequence of failure and success'
+ end
+
context 'when unexpected error occurs' do
before do
allow(repository).to receive(:gitaly_operation_client).and_raise('Something went wrong')
diff --git a/spec/services/projects/create_service_spec.rb b/spec/services/projects/create_service_spec.rb
index bd7a0c68766..f54f9200661 100644
--- a/spec/services/projects/create_service_spec.rb
+++ b/spec/services/projects/create_service_spec.rb
@@ -268,33 +268,6 @@ describe Projects::CreateService, '#execute' do
end
end
- context 'when group has kubernetes cluster' do
- let(:group_cluster) { create(:cluster, :group, :provided_by_gcp) }
- let(:group) { group_cluster.group }
-
- let(:token) { 'aaaa' }
- let(:service_account_creator) { double(Clusters::Gcp::Kubernetes::CreateOrUpdateServiceAccountService, execute: true) }
- let(:secrets_fetcher) { double(Clusters::Gcp::Kubernetes::FetchKubernetesTokenService, execute: token) }
-
- before do
- group.add_owner(user)
-
- stub_feature_flags(ci_preparing_state: false)
- expect(Clusters::Gcp::Kubernetes::CreateOrUpdateServiceAccountService).to receive(:namespace_creator).and_return(service_account_creator)
- expect(Clusters::Gcp::Kubernetes::FetchKubernetesTokenService).to receive(:new).and_return(secrets_fetcher)
- end
-
- it 'creates kubernetes namespace for the project' do
- project = create_project(user, opts.merge!(namespace_id: group.id))
-
- expect(project).to be_valid
-
- kubernetes_namespace = group_cluster.kubernetes_namespaces.first
- expect(kubernetes_namespace).to be_present
- expect(kubernetes_namespace.project).to eq(project)
- end
- end
-
context 'when there is an active service template' do
before do
create(:service, project: nil, template: true, active: true)
diff --git a/spec/services/projects/git_deduplication_service_spec.rb b/spec/services/projects/git_deduplication_service_spec.rb
new file mode 100644
index 00000000000..3acbc46b473
--- /dev/null
+++ b/spec/services/projects/git_deduplication_service_spec.rb
@@ -0,0 +1,90 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Projects::GitDeduplicationService do
+ include ExclusiveLeaseHelpers
+
+ let(:pool) { create(:pool_repository, :ready) }
+ let(:project) { create(:project, :repository) }
+ let(:lease_key) { "git_deduplication:#{project.id}" }
+ let(:lease_timeout) { Projects::GitDeduplicationService::LEASE_TIMEOUT }
+
+ subject(:service) { described_class.new(project) }
+
+ describe '#execute' do
+ context 'when there is not already a lease' do
+ context 'when the project does not have a pool repository' do
+ it 'calls disconnect_git_alternates' do
+ stub_exclusive_lease(lease_key, timeout: lease_timeout)
+
+ expect(project.repository).to receive(:disconnect_alternates)
+
+ service.execute
+ end
+ end
+
+ context 'when the project has a pool repository' do
+ let(:project) { create(:project, :repository, pool_repository: pool) }
+
+ context 'when the project is a source project' do
+ let(:lease_key) { "git_deduplication:#{pool.source_project.id}" }
+
+ subject(:service) { described_class.new(pool.source_project) }
+
+ it 'calls fetch' do
+ stub_exclusive_lease(lease_key, timeout: lease_timeout)
+ allow(pool.source_project).to receive(:git_objects_poolable?).and_return(true)
+
+ expect(pool.object_pool).to receive(:fetch)
+
+ service.execute
+ end
+
+ it 'does not call fetch if git objects are not poolable' do
+ stub_exclusive_lease(lease_key, timeout: lease_timeout)
+ allow(pool.source_project).to receive(:git_objects_poolable?).and_return(false)
+
+ expect(pool.object_pool).not_to receive(:fetch)
+
+ service.execute
+ end
+
+ it 'does not call fetch if pool and project are not on the same storage' do
+ stub_exclusive_lease(lease_key, timeout: lease_timeout)
+ allow(pool.source_project.repository).to receive(:storage).and_return('special_storage_001')
+
+ expect(pool.object_pool).not_to receive(:fetch)
+
+ service.execute
+ end
+ end
+
+ it 'links the repository to the object pool' do
+ expect(project).to receive(:link_pool_repository)
+
+ service.execute
+ end
+
+ it 'does not link the repository to the object pool if they are not on the same storage' do
+ allow(project.repository).to receive(:storage).and_return('special_storage_001')
+ expect(project).not_to receive(:link_pool_repository)
+
+ service.execute
+ end
+ end
+
+ context 'when a lease is already out' do
+ before do
+ stub_exclusive_lease_taken(lease_key, timeout: lease_timeout)
+ end
+
+ it 'fails when a lease is already out' do
+ expect(service).to receive(:log_error).with('Cannot obtain an exclusive lease. There must be another instance already in execution.')
+
+ service.execute
+ end
+ end
+ end
+ end
+end
diff --git a/spec/services/projects/transfer_service_spec.rb b/spec/services/projects/transfer_service_spec.rb
index 9acc3657fa9..a47c10d991a 100644
--- a/spec/services/projects/transfer_service_spec.rb
+++ b/spec/services/projects/transfer_service_spec.rb
@@ -73,33 +73,6 @@ describe Projects::TransferService do
shard_name: project.repository_storage
)
end
-
- context 'new group has a kubernetes cluster' do
- let(:group_cluster) { create(:cluster, :group, :provided_by_gcp) }
- let(:group) { group_cluster.group }
-
- let(:token) { 'aaaa' }
- let(:service_account_creator) { double(Clusters::Gcp::Kubernetes::CreateOrUpdateServiceAccountService, execute: true) }
- let(:secrets_fetcher) { double(Clusters::Gcp::Kubernetes::FetchKubernetesTokenService, execute: token) }
-
- subject { transfer_project(project, user, group) }
-
- before do
- stub_feature_flags(ci_preparing_state: false)
- expect(Clusters::Gcp::Kubernetes::CreateOrUpdateServiceAccountService).to receive(:namespace_creator).and_return(service_account_creator)
- expect(Clusters::Gcp::Kubernetes::FetchKubernetesTokenService).to receive(:new).and_return(secrets_fetcher)
- end
-
- it 'creates kubernetes namespace for the project' do
- subject
-
- expect(project.kubernetes_namespaces.count).to eq(1)
-
- kubernetes_namespace = group_cluster.kubernetes_namespaces.first
- expect(kubernetes_namespace).to be_present
- expect(kubernetes_namespace.project).to eq(project)
- end
- end
end
context 'when transfer fails' do
diff --git a/spec/services/system_note_service_spec.rb b/spec/services/system_note_service_spec.rb
index 51c5a803dbd..2420817e1f7 100644
--- a/spec/services/system_note_service_spec.rb
+++ b/spec/services/system_note_service_spec.rb
@@ -132,7 +132,7 @@ describe SystemNoteService do
end
it 'sets the note text' do
- link = "http://localhost/#{project.full_path}/tags/#{tag_name}"
+ link = "/#{project.full_path}/-/tags/#{tag_name}"
expect(subject.note).to eq "tagged commit #{noteable.sha} to [`#{tag_name}`](#{link})"
end
@@ -1139,7 +1139,7 @@ describe SystemNoteService do
diff_id = merge_request.merge_request_diff.id
line_code = change_position.line_code(project.repository)
- expect(subject.note).to include(diffs_project_merge_request_url(project, merge_request, diff_id: diff_id, anchor: line_code))
+ expect(subject.note).to include(diffs_project_merge_request_path(project, merge_request, diff_id: diff_id, anchor: line_code))
end
end
diff --git a/spec/support/helpers/kubernetes_helpers.rb b/spec/support/helpers/kubernetes_helpers.rb
index ac52acb6570..78b7ae9c00c 100644
--- a/spec/support/helpers/kubernetes_helpers.rb
+++ b/spec/support/helpers/kubernetes_helpers.rb
@@ -24,30 +24,34 @@ module KubernetesHelpers
WebMock.stub_request(:get, api_url + '/apis/serving.knative.dev/v1alpha1').to_return(kube_response(kube_v1alpha1_serving_knative_discovery_body))
end
- def stub_kubeclient_service_pods(response = nil)
+ def stub_kubeclient_service_pods(status: nil)
stub_kubeclient_discover(service.api_url)
pods_url = service.api_url + "/api/v1/pods"
+ response = { status: status } if status
WebMock.stub_request(:get, pods_url).to_return(response || kube_pods_response)
end
- def stub_kubeclient_pods(response = nil)
+ def stub_kubeclient_pods(namespace, status: nil)
stub_kubeclient_discover(service.api_url)
- pods_url = service.api_url + "/api/v1/namespaces/#{service.actual_namespace}/pods"
+ pods_url = service.api_url + "/api/v1/namespaces/#{namespace}/pods"
+ response = { status: status } if status
WebMock.stub_request(:get, pods_url).to_return(response || kube_pods_response)
end
- def stub_kubeclient_logs(pod_name, response = nil)
+ def stub_kubeclient_logs(pod_name, namespace, status: nil)
stub_kubeclient_discover(service.api_url)
- logs_url = service.api_url + "/api/v1/namespaces/#{service.actual_namespace}/pods/#{pod_name}/log?tailLines=#{Clusters::Platforms::Kubernetes::LOGS_LIMIT}"
+ logs_url = service.api_url + "/api/v1/namespaces/#{namespace}/pods/#{pod_name}/log?tailLines=#{Clusters::Platforms::Kubernetes::LOGS_LIMIT}"
+ response = { status: status } if status
WebMock.stub_request(:get, logs_url).to_return(response || kube_logs_response)
end
- def stub_kubeclient_deployments(response = nil)
+ def stub_kubeclient_deployments(namespace, status: nil)
stub_kubeclient_discover(service.api_url)
- deployments_url = service.api_url + "/apis/extensions/v1beta1/namespaces/#{service.actual_namespace}/deployments"
+ deployments_url = service.api_url + "/apis/extensions/v1beta1/namespaces/#{namespace}/deployments"
+ response = { status: status } if status
WebMock.stub_request(:get, deployments_url).to_return(response || kube_deployments_response)
end
@@ -250,10 +254,11 @@ module KubernetesHelpers
# This is a partial response, it will have many more elements in reality but
# these are the ones we care about at the moment
- def kube_pod(name: "kube-pod", environment_slug: "production", project_slug: "project-path-slug", status: "Running", track: nil)
+ def kube_pod(name: "kube-pod", environment_slug: "production", namespace: "project-namespace", project_slug: "project-path-slug", status: "Running", track: nil)
{
"metadata" => {
"name" => name,
+ "namespace" => namespace,
"generate_name" => "generated-name-with-suffix",
"creationTimestamp" => "2016-11-25T19:55:19Z",
"annotations" => {
@@ -369,12 +374,13 @@ module KubernetesHelpers
def kube_terminals(service, pod)
pod_name = pod['metadata']['name']
+ pod_namespace = pod['metadata']['namespace']
containers = pod['spec']['containers']
containers.map do |container|
terminal = {
selectors: { pod: pod_name, container: container['name'] },
- url: container_exec_url(service.api_url, service.actual_namespace, pod_name, container['name']),
+ url: container_exec_url(service.api_url, pod_namespace, pod_name, container['name']),
subprotocols: ['channel.k8s.io'],
headers: { 'Authorization' => ["Bearer #{service.token}"] },
created_at: DateTime.parse(pod['metadata']['creationTimestamp']),
diff --git a/spec/support/helpers/lets_encrypt_helpers.rb b/spec/support/helpers/lets_encrypt_helpers.rb
new file mode 100644
index 00000000000..7f0886b451c
--- /dev/null
+++ b/spec/support/helpers/lets_encrypt_helpers.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+module LetsEncryptHelpers
+ def stub_lets_encrypt_client
+ client = instance_double('Acme::Client')
+
+ allow(client).to receive(:new_account)
+ allow(client).to receive(:terms_of_service).and_return(
+ "https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf"
+ )
+
+ allow(Acme::Client).to receive(:new).with(
+ private_key: kind_of(OpenSSL::PKey::RSA),
+ directory: ::Gitlab::LetsEncrypt::Client::STAGING_DIRECTORY_URL
+ ).and_return(client)
+
+ client
+ end
+end
diff --git a/spec/support/helpers/stub_configuration.rb b/spec/support/helpers/stub_configuration.rb
index 3e507fb133e..f6c613ad5aa 100644
--- a/spec/support/helpers/stub_configuration.rb
+++ b/spec/support/helpers/stub_configuration.rb
@@ -2,7 +2,8 @@ require 'active_support/core_ext/hash/transform_values'
require 'active_support/hash_with_indifferent_access'
require 'active_support/dependencies'
-require_dependency 'gitlab'
+# check gets rid of already initialized constant warnings when using spring
+require_dependency 'gitlab' unless defined?(Gitlab)
module StubConfiguration
def stub_application_setting(messages)
diff --git a/spec/support/helpers/test_env.rb b/spec/support/helpers/test_env.rb
index dc902d373b8..06b5ecdf150 100644
--- a/spec/support/helpers/test_env.rb
+++ b/spec/support/helpers/test_env.rb
@@ -135,7 +135,7 @@ module TestEnv
def clean_gitlab_test_path
Dir[TMP_TEST_PATH].each do |entry|
- if File.basename(entry) =~ /\A(gitlab-(test|test_bare|test-fork|test-fork_bare))\z/
+ unless test_dirs.include?(File.basename(entry))
FileUtils.rm_rf(entry)
end
end
@@ -312,6 +312,18 @@ module TestEnv
private
+ # These are directories that should be preserved at cleanup time
+ def test_dirs
+ @test_dirs ||= %w[
+ gitaly
+ gitlab-shell
+ gitlab-test
+ gitlab-test_bare
+ gitlab-test-fork
+ gitlab-test-fork_bare
+ ]
+ end
+
def factory_repo_path
@factory_repo_path ||= Rails.root.join('tmp', 'tests', factory_repo_name)
end
diff --git a/spec/support/prometheus/additional_metrics_shared_examples.rb b/spec/support/prometheus/additional_metrics_shared_examples.rb
index 0fd67531c3b..8044b061ca5 100644
--- a/spec/support/prometheus/additional_metrics_shared_examples.rb
+++ b/spec/support/prometheus/additional_metrics_shared_examples.rb
@@ -46,7 +46,7 @@ RSpec.shared_examples 'additional metrics query' do
describe 'project has Kubernetes service' do
shared_examples 'same behavior between KubernetesService and Platform::Kubernetes' do
let(:environment) { create(:environment, slug: 'environment-slug', project: project) }
- let(:kube_namespace) { project.deployment_platform.actual_namespace }
+ let(:kube_namespace) { project.deployment_platform.kubernetes_namespace_for(project) }
it_behaves_like 'query context containing environment slug and filter'
diff --git a/spec/support/shared_examples/legacy_path_redirect_shared_examples.rb b/spec/support/shared_examples/legacy_path_redirect_shared_examples.rb
index f300bdd48b1..f326e502092 100644
--- a/spec/support/shared_examples/legacy_path_redirect_shared_examples.rb
+++ b/spec/support/shared_examples/legacy_path_redirect_shared_examples.rb
@@ -11,3 +11,11 @@ shared_examples 'redirecting a legacy path' do |source, target|
expect(get(source)).not_to redirect_to(target)
end
end
+
+shared_examples 'redirecting a legacy project path' do |source, target|
+ include RSpec::Rails::RequestExampleGroup
+
+ it "redirects #{source} to #{target}" do
+ expect(get(source)).to redirect_to(target)
+ end
+end
diff --git a/spec/support/shared_examples/requests/api/discussions.rb b/spec/support/shared_examples/requests/api/discussions.rb
index 96f79081d26..c3132c41f5b 100644
--- a/spec/support/shared_examples/requests/api/discussions.rb
+++ b/spec/support/shared_examples/requests/api/discussions.rb
@@ -1,4 +1,4 @@
-shared_examples 'discussions API' do |parent_type, noteable_type, id_name, can_reply_to_invididual_notes: false|
+shared_examples 'discussions API' do |parent_type, noteable_type, id_name, can_reply_to_individual_notes: false|
describe "GET /#{parent_type}/:id/#{noteable_type}/:noteable_id/discussions" do
it "returns an array of discussions" do
get api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/discussions", user)
@@ -144,7 +144,7 @@ shared_examples 'discussions API' do |parent_type, noteable_type, id_name, can_r
"discussions/#{note.discussion_id}/notes", user), params: { body: 'hi!' }
end
- if can_reply_to_invididual_notes
+ if can_reply_to_individual_notes
it 'creates a new discussion' do
expect(response).to have_gitlab_http_status(201)
expect(json_response['body']).to eq('hi!')
diff --git a/spec/support/shared_examples/requests/api/issues_shared_example_spec.rb b/spec/support/shared_examples/requests/api/issues_shared_example_spec.rb
new file mode 100644
index 00000000000..1133e95e44e
--- /dev/null
+++ b/spec/support/shared_examples/requests/api/issues_shared_example_spec.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+shared_examples 'labeled issues with labels and label_name params' do
+ shared_examples 'returns label names' do
+ it 'returns label names' do
+ expect_paginated_array_response(issue.id)
+ expect(json_response.first['labels']).to eq([label_c.title, label_b.title, label.title])
+ end
+ end
+
+ shared_examples 'returns basic label entity' do
+ it 'returns basic label entity' do
+ expect_paginated_array_response(issue.id)
+ expect(json_response.first['labels'].pluck('name')).to eq([label_c.title, label_b.title, label.title])
+ expect(json_response.first['labels'].first).to match_schema('/public_api/v4/label_basic')
+ end
+ end
+
+ context 'array of labeled issues when all labels match' do
+ let(:params) { { labels: "#{label.title},#{label_b.title},#{label_c.title}" } }
+
+ it_behaves_like 'returns label names'
+ end
+
+ context 'array of labeled issues when all labels match with labels param as array' do
+ let(:params) { { labels: [label.title, label_b.title, label_c.title] } }
+
+ it_behaves_like 'returns label names'
+ end
+
+ context 'when with_labels_details provided' do
+ context 'array of labeled issues when all labels match' do
+ let(:params) { { labels: "#{label.title},#{label_b.title},#{label_c.title}", with_labels_details: true } }
+
+ it_behaves_like 'returns basic label entity'
+ end
+
+ context 'array of labeled issues when all labels match with labels param as array' do
+ let(:params) { { labels: [label.title, label_b.title, label_c.title], with_labels_details: true } }
+
+ it_behaves_like 'returns basic label entity'
+ end
+ end
+end
diff --git a/spec/support/shoulda/matchers/rails_shim.rb b/spec/support/shoulda/matchers/rails_shim.rb
deleted file mode 100644
index 8d70598beb5..00000000000
--- a/spec/support/shoulda/matchers/rails_shim.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# monkey patch which fixes serialization matcher in Rails 5
-# https://github.com/thoughtbot/shoulda-matchers/issues/913
-# This can be removed when a new version of shoulda-matchers
-# is released
-module Shoulda
- module Matchers
- class RailsShim
- def self.serialized_attributes_for(model)
- if defined?(::ActiveRecord::Type::Serialized)
- # Rails 5+
- serialized_columns = model.columns.select do |column|
- model.type_for_attribute(column.name).is_a?(
- ::ActiveRecord::Type::Serialized
- )
- end
-
- serialized_columns.inject({}) do |hash, column| # rubocop:disable Style/EachWithObject
- hash[column.name.to_s] = model.type_for_attribute(column.name).coder
- hash
- end
- else
- model.serialized_attributes
- end
- end
- end
- end
-end
diff --git a/spec/uploaders/object_storage_spec.rb b/spec/uploaders/object_storage_spec.rb
index a62830c35f1..6bad5d49b1c 100644
--- a/spec/uploaders/object_storage_spec.rb
+++ b/spec/uploaders/object_storage_spec.rb
@@ -12,7 +12,7 @@ class Implementation < GitlabUploader
# user/:id
def dynamic_segment
- File.join(model.class.to_s.underscore, model.id.to_s)
+ File.join(model.class.underscore, model.id.to_s)
end
end
diff --git a/spec/uploaders/personal_file_uploader_spec.rb b/spec/uploaders/personal_file_uploader_spec.rb
index 97758f0243e..d9f0e2f3cb7 100644
--- a/spec/uploaders/personal_file_uploader_spec.rb
+++ b/spec/uploaders/personal_file_uploader_spec.rb
@@ -7,33 +7,19 @@ describe PersonalFileUploader do
subject { uploader }
- it_behaves_like 'builds correct paths',
- store_dir: %r[uploads/-/system/personal_snippet/\d+],
- upload_path: %r[\h+/\S+],
- absolute_path: %r[#{CarrierWave.root}/uploads/-/system/personal_snippet\/\d+\/\h+\/\S+$]
-
- context "object_store is REMOTE" do
+ shared_examples '#base_dir' do
before do
- stub_uploads_object_storage
+ subject.instance_variable_set(:@secret, 'secret')
end
- include_context 'with storage', described_class::Store::REMOTE
-
- it_behaves_like 'builds correct paths',
- store_dir: %r[\d+/\h+],
- upload_path: %r[^personal_snippet\/\d+\/\h+\/<filename>]
- end
-
- describe '#upload_paths' do
- it 'builds correct paths for both local and remote storage' do
- paths = uploader.upload_paths('test.jpg')
+ it 'is prefixed with uploads/-/system' do
+ allow(uploader).to receive(:file).and_return(double(extension: 'txt', filename: 'file_name'))
- expect(paths.first).to match(%r[\h+\/test.jpg])
- expect(paths.second).to match(%r[^personal_snippet\/\d+\/\h+\/test.jpg])
+ expect(described_class.base_dir(model)).to eq("uploads/-/system/personal_snippet/#{model.id}")
end
end
- describe '#to_h' do
+ shared_examples '#to_h' do
before do
subject.instance_variable_set(:@secret, 'secret')
end
@@ -50,6 +36,40 @@ describe PersonalFileUploader do
end
end
+ describe '#upload_paths' do
+ it 'builds correct paths for both local and remote storage' do
+ paths = uploader.upload_paths('test.jpg')
+
+ expect(paths.first).to match(%r[\h+\/test.jpg])
+ expect(paths.second).to match(%r[^personal_snippet\/\d+\/\h+\/test.jpg])
+ end
+ end
+
+ context 'object_store is LOCAL' do
+ it_behaves_like 'builds correct paths',
+ store_dir: %r[uploads/-/system/personal_snippet/\d+/\h+],
+ upload_path: %r[\h+/\S+],
+ absolute_path: %r[#{CarrierWave.root}/uploads/-/system/personal_snippet\/\d+\/\h+\/\S+$]
+
+ it_behaves_like '#base_dir'
+ it_behaves_like '#to_h'
+ end
+
+ context "object_store is REMOTE" do
+ before do
+ stub_uploads_object_storage
+ end
+
+ include_context 'with storage', described_class::Store::REMOTE
+
+ it_behaves_like 'builds correct paths',
+ store_dir: %r[\d+/\h+],
+ upload_path: %r[^personal_snippet\/\d+\/\h+\/<filename>]
+
+ it_behaves_like '#base_dir'
+ it_behaves_like '#to_h'
+ end
+
describe "#migrate!" do
before do
uploader.store!(fixture_file_upload('spec/fixtures/doc_sample.txt'))
diff --git a/spec/views/help/index.html.haml_spec.rb b/spec/views/help/index.html.haml_spec.rb
index 34e93d929a7..257991549a9 100644
--- a/spec/views/help/index.html.haml_spec.rb
+++ b/spec/views/help/index.html.haml_spec.rb
@@ -31,7 +31,7 @@ describe 'help/index' do
render
expect(rendered).to match '8.0.2'
- expect(rendered).to have_link('8.0.2', href: %r{https://gitlab.com/gitlab-org/gitlab-(ce|ee)/tags/v8.0.2})
+ expect(rendered).to have_link('8.0.2', href: %r{https://gitlab.com/gitlab-org/gitlab-(ce|ee)/-/tags/v8.0.2})
end
it 'shows a link to the commit for pre-releases' do
diff --git a/spec/views/projects/tree/show.html.haml_spec.rb b/spec/views/projects/tree/show.html.haml_spec.rb
index 3b098320ad7..5bb0173ab89 100644
--- a/spec/views/projects/tree/show.html.haml_spec.rb
+++ b/spec/views/projects/tree/show.html.haml_spec.rb
@@ -7,6 +7,8 @@ describe 'projects/tree/show' do
let(:repository) { project.repository }
before do
+ stub_feature_flags(vue_file_list: false)
+
assign(:project, project)
assign(:repository, repository)
assign(:lfs_blob_ids, [])
diff --git a/spec/workers/build_finished_worker_spec.rb b/spec/workers/build_finished_worker_spec.rb
index 33f327d4a0c..4adb795b1d6 100644
--- a/spec/workers/build_finished_worker_spec.rb
+++ b/spec/workers/build_finished_worker_spec.rb
@@ -17,6 +17,7 @@ describe BuildFinishedWorker do
expect_any_instance_of(BuildCoverageWorker).to receive(:perform)
expect(BuildHooksWorker).to receive(:perform_async)
expect(ArchiveTraceWorker).to receive(:perform_async)
+ expect(ExpirePipelineCacheWorker).to receive(:perform_async)
described_class.new.perform(build.id)
end
diff --git a/spec/workers/cluster_configure_worker_spec.rb b/spec/workers/cluster_configure_worker_spec.rb
index daf014ac574..975088f3ee6 100644
--- a/spec/workers/cluster_configure_worker_spec.rb
+++ b/spec/workers/cluster_configure_worker_spec.rb
@@ -4,11 +4,6 @@ require 'spec_helper'
describe ClusterConfigureWorker, '#perform' do
let(:worker) { described_class.new }
- let(:ci_preparing_state_enabled) { false }
-
- before do
- stub_feature_flags(ci_preparing_state: ci_preparing_state_enabled)
- end
shared_examples 'configured cluster' do
it 'creates a namespace' do
@@ -33,26 +28,14 @@ describe ClusterConfigureWorker, '#perform' do
context 'when group has a project' do
let!(:project) { create(:project, group: group) }
- it_behaves_like 'configured cluster'
-
- context 'ci_preparing_state feature is enabled' do
- let(:ci_preparing_state_enabled) { true }
-
- it_behaves_like 'unconfigured cluster'
- end
+ it_behaves_like 'unconfigured cluster'
end
context 'when group has project in a sub-group' do
let!(:subgroup) { create(:group, parent: group) }
let!(:project) { create(:project, group: subgroup) }
- it_behaves_like 'configured cluster'
-
- context 'ci_preparing_state feature is enabled' do
- let(:ci_preparing_state_enabled) { true }
-
- it_behaves_like 'unconfigured cluster'
- end
+ it_behaves_like 'unconfigured cluster'
end
end
diff --git a/spec/workers/pages_domain_removal_cron_worker_spec.rb b/spec/workers/pages_domain_removal_cron_worker_spec.rb
index 0e1171e8491..2408ad54189 100644
--- a/spec/workers/pages_domain_removal_cron_worker_spec.rb
+++ b/spec/workers/pages_domain_removal_cron_worker_spec.rb
@@ -9,25 +9,10 @@ describe PagesDomainRemovalCronWorker do
context 'when there is domain which should be removed' do
let!(:domain_for_removal) { create(:pages_domain, :should_be_removed) }
- before do
- stub_feature_flags(remove_disabled_domains: true)
- end
-
it 'removes domain' do
expect { worker.perform }.to change { PagesDomain.count }.by(-1)
expect(PagesDomain.exists?).to eq(false)
end
-
- context 'when domain removal is disabled' do
- before do
- stub_feature_flags(remove_disabled_domains: false)
- end
-
- it 'does not remove pages domain' do
- expect { worker.perform }.not_to change { PagesDomain.count }
- expect(PagesDomain.find_by(domain: domain_for_removal.domain)).to be_present
- end
- end
end
context 'where there is a domain which scheduled for removal in the future' do
diff --git a/vendor/assets/javascripts/pdf.js b/vendor/assets/javascripts/pdf.js
deleted file mode 100644
index 4d8adb0f2c9..00000000000
--- a/vendor/assets/javascripts/pdf.js
+++ /dev/null
@@ -1,19365 +0,0 @@
-/**
- * @licstart The following is the entire license notice for the
- * Javascript code in this page
- *
- * Copyright 2018 Mozilla Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * @licend The above is the entire license notice for the
- * Javascript code in this page
- */
-
-(function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory();
- else if(typeof define === 'function' && define.amd)
- define("pdfjs-dist/build/pdf", [], factory);
- else if(typeof exports === 'object')
- exports["pdfjs-dist/build/pdf"] = factory();
- else
- root["pdfjs-dist/build/pdf"] = root.pdfjsLib = factory();
-})(this, function() {
-return /******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
-/******/
-/******/ // The require function
-/******/ function __w_pdfjs_require__(moduleId) {
-/******/
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId]) {
-/******/ return installedModules[moduleId].exports;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ i: moduleId,
-/******/ l: false,
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);
-/******/
-/******/ // Flag the module as loaded
-/******/ module.l = true;
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/******/
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __w_pdfjs_require__.m = modules;
-/******/
-/******/ // expose the module cache
-/******/ __w_pdfjs_require__.c = installedModules;
-/******/
-/******/ // define getter function for harmony exports
-/******/ __w_pdfjs_require__.d = function(exports, name, getter) {
-/******/ if(!__w_pdfjs_require__.o(exports, name)) {
-/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
-/******/ }
-/******/ };
-/******/
-/******/ // define __esModule on exports
-/******/ __w_pdfjs_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/
-/******/ // create a fake namespace object
-/******/ // mode & 1: value is a module id, require it
-/******/ // mode & 2: merge all properties of value into the ns
-/******/ // mode & 4: return value when already ns object
-/******/ // mode & 8|1: behave like require
-/******/ __w_pdfjs_require__.t = function(value, mode) {
-/******/ if(mode & 1) value = __w_pdfjs_require__(value);
-/******/ if(mode & 8) return value;
-/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
-/******/ var ns = Object.create(null);
-/******/ __w_pdfjs_require__.r(ns);
-/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
-/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __w_pdfjs_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
-/******/ return ns;
-/******/ };
-/******/
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __w_pdfjs_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function getDefault() { return module['default']; } :
-/******/ function getModuleExports() { return module; };
-/******/ __w_pdfjs_require__.d(getter, 'a', getter);
-/******/ return getter;
-/******/ };
-/******/
-/******/ // Object.prototype.hasOwnProperty.call
-/******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
-/******/
-/******/ // __webpack_public_path__
-/******/ __w_pdfjs_require__.p = "";
-/******/
-/******/
-/******/ // Load entry module and return exports
-/******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var pdfjsVersion = '2.0.943';
-var pdfjsBuild = 'dc98bf76';
-var pdfjsSharedUtil = __w_pdfjs_require__(1);
-var pdfjsDisplayAPI = __w_pdfjs_require__(129);
-var pdfjsDisplayTextLayer = __w_pdfjs_require__(145);
-var pdfjsDisplayAnnotationLayer = __w_pdfjs_require__(146);
-var pdfjsDisplayDOMUtils = __w_pdfjs_require__(130);
-var pdfjsDisplaySVG = __w_pdfjs_require__(147);
-var pdfjsDisplayWorkerOptions = __w_pdfjs_require__(135);
-var pdfjsDisplayAPICompatibility = __w_pdfjs_require__(132);
-{
- var isNodeJS = __w_pdfjs_require__(4);
- if (isNodeJS()) {
- var PDFNodeStream = __w_pdfjs_require__(148).PDFNodeStream;
- pdfjsDisplayAPI.setPDFNetworkStreamFactory(function (params) {
- return new PDFNodeStream(params);
- });
- } else if (typeof Response !== 'undefined' && 'body' in Response.prototype && typeof ReadableStream !== 'undefined') {
- var PDFFetchStream = __w_pdfjs_require__(151).PDFFetchStream;
- pdfjsDisplayAPI.setPDFNetworkStreamFactory(function (params) {
- return new PDFFetchStream(params);
- });
- } else {
- var PDFNetworkStream = __w_pdfjs_require__(152).PDFNetworkStream;
- pdfjsDisplayAPI.setPDFNetworkStreamFactory(function (params) {
- return new PDFNetworkStream(params);
- });
- }
-}
-exports.build = pdfjsDisplayAPI.build;
-exports.version = pdfjsDisplayAPI.version;
-exports.getDocument = pdfjsDisplayAPI.getDocument;
-exports.LoopbackPort = pdfjsDisplayAPI.LoopbackPort;
-exports.PDFDataRangeTransport = pdfjsDisplayAPI.PDFDataRangeTransport;
-exports.PDFWorker = pdfjsDisplayAPI.PDFWorker;
-exports.renderTextLayer = pdfjsDisplayTextLayer.renderTextLayer;
-exports.AnnotationLayer = pdfjsDisplayAnnotationLayer.AnnotationLayer;
-exports.createPromiseCapability = pdfjsSharedUtil.createPromiseCapability;
-exports.PasswordResponses = pdfjsSharedUtil.PasswordResponses;
-exports.InvalidPDFException = pdfjsSharedUtil.InvalidPDFException;
-exports.MissingPDFException = pdfjsSharedUtil.MissingPDFException;
-exports.SVGGraphics = pdfjsDisplaySVG.SVGGraphics;
-exports.NativeImageDecoding = pdfjsSharedUtil.NativeImageDecoding;
-exports.CMapCompressionType = pdfjsSharedUtil.CMapCompressionType;
-exports.PermissionFlag = pdfjsSharedUtil.PermissionFlag;
-exports.UnexpectedResponseException = pdfjsSharedUtil.UnexpectedResponseException;
-exports.OPS = pdfjsSharedUtil.OPS;
-exports.VerbosityLevel = pdfjsSharedUtil.VerbosityLevel;
-exports.UNSUPPORTED_FEATURES = pdfjsSharedUtil.UNSUPPORTED_FEATURES;
-exports.createValidAbsoluteUrl = pdfjsSharedUtil.createValidAbsoluteUrl;
-exports.createObjectURL = pdfjsSharedUtil.createObjectURL;
-exports.removeNullCharacters = pdfjsSharedUtil.removeNullCharacters;
-exports.shadow = pdfjsSharedUtil.shadow;
-exports.Util = pdfjsSharedUtil.Util;
-exports.ReadableStream = pdfjsSharedUtil.ReadableStream;
-exports.URL = pdfjsSharedUtil.URL;
-exports.RenderingCancelledException = pdfjsDisplayDOMUtils.RenderingCancelledException;
-exports.getFilenameFromUrl = pdfjsDisplayDOMUtils.getFilenameFromUrl;
-exports.LinkTarget = pdfjsDisplayDOMUtils.LinkTarget;
-exports.addLinkAttributes = pdfjsDisplayDOMUtils.addLinkAttributes;
-exports.loadScript = pdfjsDisplayDOMUtils.loadScript;
-exports.GlobalWorkerOptions = pdfjsDisplayWorkerOptions.GlobalWorkerOptions;
-exports.apiCompatibilityParams = pdfjsDisplayAPICompatibility.apiCompatibilityParams;
-
-/***/ }),
-/* 1 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.URL = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.getInheritableProperty = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.toRomanNumerals = 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 = undefined;
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-__w_pdfjs_require__(2);
-
-var _streams_polyfill = __w_pdfjs_require__(125);
-
-var _url_polyfill = __w_pdfjs_require__(127);
-
-var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
-var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
-var NativeImageDecoding = {
- NONE: 'none',
- DECODE: 'decode',
- DISPLAY: 'display'
-};
-var PermissionFlag = {
- PRINT: 0x04,
- MODIFY_CONTENTS: 0x08,
- COPY: 0x10,
- MODIFY_ANNOTATIONS: 0x20,
- FILL_INTERACTIVE_FORMS: 0x100,
- COPY_FOR_ACCESSIBILITY: 0x200,
- ASSEMBLE: 0x400,
- PRINT_HIGH_QUALITY: 0x800
-};
-var TextRenderingMode = {
- FILL: 0,
- STROKE: 1,
- FILL_STROKE: 2,
- INVISIBLE: 3,
- FILL_ADD_TO_PATH: 4,
- STROKE_ADD_TO_PATH: 5,
- FILL_STROKE_ADD_TO_PATH: 6,
- ADD_TO_PATH: 7,
- FILL_STROKE_MASK: 3,
- ADD_TO_PATH_FLAG: 4
-};
-var ImageKind = {
- GRAYSCALE_1BPP: 1,
- RGB_24BPP: 2,
- RGBA_32BPP: 3
-};
-var AnnotationType = {
- TEXT: 1,
- LINK: 2,
- FREETEXT: 3,
- LINE: 4,
- SQUARE: 5,
- CIRCLE: 6,
- POLYGON: 7,
- POLYLINE: 8,
- HIGHLIGHT: 9,
- UNDERLINE: 10,
- SQUIGGLY: 11,
- STRIKEOUT: 12,
- STAMP: 13,
- CARET: 14,
- INK: 15,
- POPUP: 16,
- FILEATTACHMENT: 17,
- SOUND: 18,
- MOVIE: 19,
- WIDGET: 20,
- SCREEN: 21,
- PRINTERMARK: 22,
- TRAPNET: 23,
- WATERMARK: 24,
- THREED: 25,
- REDACT: 26
-};
-var AnnotationFlag = {
- INVISIBLE: 0x01,
- HIDDEN: 0x02,
- PRINT: 0x04,
- NOZOOM: 0x08,
- NOROTATE: 0x10,
- NOVIEW: 0x20,
- READONLY: 0x40,
- LOCKED: 0x80,
- TOGGLENOVIEW: 0x100,
- LOCKEDCONTENTS: 0x200
-};
-var AnnotationFieldFlag = {
- READONLY: 0x0000001,
- REQUIRED: 0x0000002,
- NOEXPORT: 0x0000004,
- MULTILINE: 0x0001000,
- PASSWORD: 0x0002000,
- NOTOGGLETOOFF: 0x0004000,
- RADIO: 0x0008000,
- PUSHBUTTON: 0x0010000,
- COMBO: 0x0020000,
- EDIT: 0x0040000,
- SORT: 0x0080000,
- FILESELECT: 0x0100000,
- MULTISELECT: 0x0200000,
- DONOTSPELLCHECK: 0x0400000,
- DONOTSCROLL: 0x0800000,
- COMB: 0x1000000,
- RICHTEXT: 0x2000000,
- RADIOSINUNISON: 0x2000000,
- COMMITONSELCHANGE: 0x4000000
-};
-var AnnotationBorderStyleType = {
- SOLID: 1,
- DASHED: 2,
- BEVELED: 3,
- INSET: 4,
- UNDERLINE: 5
-};
-var StreamType = {
- UNKNOWN: 0,
- FLATE: 1,
- LZW: 2,
- DCT: 3,
- JPX: 4,
- JBIG: 5,
- A85: 6,
- AHX: 7,
- CCF: 8,
- RL: 9
-};
-var FontType = {
- UNKNOWN: 0,
- TYPE1: 1,
- TYPE1C: 2,
- CIDFONTTYPE0: 3,
- CIDFONTTYPE0C: 4,
- TRUETYPE: 5,
- CIDFONTTYPE2: 6,
- TYPE3: 7,
- OPENTYPE: 8,
- TYPE0: 9,
- MMTYPE1: 10
-};
-var VerbosityLevel = {
- ERRORS: 0,
- WARNINGS: 1,
- INFOS: 5
-};
-var CMapCompressionType = {
- NONE: 0,
- BINARY: 1,
- STREAM: 2
-};
-var OPS = {
- dependency: 1,
- setLineWidth: 2,
- setLineCap: 3,
- setLineJoin: 4,
- setMiterLimit: 5,
- setDash: 6,
- setRenderingIntent: 7,
- setFlatness: 8,
- setGState: 9,
- save: 10,
- restore: 11,
- transform: 12,
- moveTo: 13,
- lineTo: 14,
- curveTo: 15,
- curveTo2: 16,
- curveTo3: 17,
- closePath: 18,
- rectangle: 19,
- stroke: 20,
- closeStroke: 21,
- fill: 22,
- eoFill: 23,
- fillStroke: 24,
- eoFillStroke: 25,
- closeFillStroke: 26,
- closeEOFillStroke: 27,
- endPath: 28,
- clip: 29,
- eoClip: 30,
- beginText: 31,
- endText: 32,
- setCharSpacing: 33,
- setWordSpacing: 34,
- setHScale: 35,
- setLeading: 36,
- setFont: 37,
- setTextRenderingMode: 38,
- setTextRise: 39,
- moveText: 40,
- setLeadingMoveText: 41,
- setTextMatrix: 42,
- nextLine: 43,
- showText: 44,
- showSpacedText: 45,
- nextLineShowText: 46,
- nextLineSetSpacingShowText: 47,
- setCharWidth: 48,
- setCharWidthAndBounds: 49,
- setStrokeColorSpace: 50,
- setFillColorSpace: 51,
- setStrokeColor: 52,
- setStrokeColorN: 53,
- setFillColor: 54,
- setFillColorN: 55,
- setStrokeGray: 56,
- setFillGray: 57,
- setStrokeRGBColor: 58,
- setFillRGBColor: 59,
- setStrokeCMYKColor: 60,
- setFillCMYKColor: 61,
- shadingFill: 62,
- beginInlineImage: 63,
- beginImageData: 64,
- endInlineImage: 65,
- paintXObject: 66,
- markPoint: 67,
- markPointProps: 68,
- beginMarkedContent: 69,
- beginMarkedContentProps: 70,
- endMarkedContent: 71,
- beginCompat: 72,
- endCompat: 73,
- paintFormXObjectBegin: 74,
- paintFormXObjectEnd: 75,
- beginGroup: 76,
- endGroup: 77,
- beginAnnotations: 78,
- endAnnotations: 79,
- beginAnnotation: 80,
- endAnnotation: 81,
- paintJpegXObject: 82,
- paintImageMaskXObject: 83,
- paintImageMaskXObjectGroup: 84,
- paintImageXObject: 85,
- paintInlineImageXObject: 86,
- paintInlineImageXObjectGroup: 87,
- paintImageXObjectRepeat: 88,
- paintImageMaskXObjectRepeat: 89,
- paintSolidColorImageMask: 90,
- constructPath: 91
-};
-var UNSUPPORTED_FEATURES = {
- unknown: 'unknown',
- forms: 'forms',
- javaScript: 'javaScript',
- smask: 'smask',
- shadingPattern: 'shadingPattern',
- font: 'font'
-};
-var PasswordResponses = {
- NEED_PASSWORD: 1,
- INCORRECT_PASSWORD: 2
-};
-var verbosity = VerbosityLevel.WARNINGS;
-function setVerbosityLevel(level) {
- if (Number.isInteger(level)) {
- verbosity = level;
- }
-}
-function getVerbosityLevel() {
- return verbosity;
-}
-function info(msg) {
- if (verbosity >= VerbosityLevel.INFOS) {
- console.log('Info: ' + msg);
- }
-}
-function warn(msg) {
- if (verbosity >= VerbosityLevel.WARNINGS) {
- console.log('Warning: ' + msg);
- }
-}
-function deprecated(details) {
- console.log('Deprecated API usage: ' + details);
-}
-function unreachable(msg) {
- throw new Error(msg);
-}
-function assert(cond, msg) {
- if (!cond) {
- unreachable(msg);
- }
-}
-function isSameOrigin(baseUrl, otherUrl) {
- try {
- var base = new _url_polyfill.URL(baseUrl);
- if (!base.origin || base.origin === 'null') {
- return false;
- }
- } catch (e) {
- return false;
- }
- var other = new _url_polyfill.URL(otherUrl, base);
- return base.origin === other.origin;
-}
-function _isValidProtocol(url) {
- if (!url) {
- return false;
- }
- switch (url.protocol) {
- case 'http:':
- case 'https:':
- case 'ftp:':
- case 'mailto:':
- case 'tel:':
- return true;
- default:
- return false;
- }
-}
-function createValidAbsoluteUrl(url, baseUrl) {
- if (!url) {
- return null;
- }
- try {
- var absoluteUrl = baseUrl ? new _url_polyfill.URL(url, baseUrl) : new _url_polyfill.URL(url);
- if (_isValidProtocol(absoluteUrl)) {
- return absoluteUrl;
- }
- } catch (ex) {}
- return null;
-}
-function shadow(obj, prop, value) {
- Object.defineProperty(obj, prop, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: false
- });
- 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';
- this.message = msg;
- this.code = code;
- }
- PasswordException.prototype = new Error();
- PasswordException.constructor = PasswordException;
- return PasswordException;
-}();
-var UnknownErrorException = function UnknownErrorExceptionClosure() {
- function UnknownErrorException(msg, details) {
- this.name = 'UnknownErrorException';
- this.message = msg;
- this.details = details;
- }
- UnknownErrorException.prototype = new Error();
- UnknownErrorException.constructor = UnknownErrorException;
- return UnknownErrorException;
-}();
-var InvalidPDFException = function InvalidPDFExceptionClosure() {
- function InvalidPDFException(msg) {
- this.name = 'InvalidPDFException';
- this.message = msg;
- }
- InvalidPDFException.prototype = new Error();
- InvalidPDFException.constructor = InvalidPDFException;
- return InvalidPDFException;
-}();
-var MissingPDFException = function MissingPDFExceptionClosure() {
- function MissingPDFException(msg) {
- this.name = 'MissingPDFException';
- this.message = msg;
- }
- MissingPDFException.prototype = new Error();
- MissingPDFException.constructor = MissingPDFException;
- return MissingPDFException;
-}();
-var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() {
- function UnexpectedResponseException(msg, status) {
- this.name = 'UnexpectedResponseException';
- this.message = msg;
- this.status = status;
- }
- UnexpectedResponseException.prototype = new Error();
- UnexpectedResponseException.constructor = UnexpectedResponseException;
- return 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;
-}();
-var XRefParseException = function XRefParseExceptionClosure() {
- function XRefParseException(msg) {
- this.message = msg;
- }
- XRefParseException.prototype = new Error();
- XRefParseException.prototype.name = 'XRefParseException';
- XRefParseException.constructor = XRefParseException;
- return XRefParseException;
-}();
-var FormatError = function FormatErrorClosure() {
- function FormatError(msg) {
- this.message = msg;
- }
- FormatError.prototype = new Error();
- FormatError.prototype.name = 'FormatError';
- FormatError.constructor = FormatError;
- return FormatError;
-}();
-var AbortException = function AbortExceptionClosure() {
- function AbortException(msg) {
- this.name = 'AbortException';
- this.message = msg;
- }
- AbortException.prototype = new Error();
- AbortException.constructor = AbortException;
- return AbortException;
-}();
-var NullCharactersRegExp = /\x00/g;
-function removeNullCharacters(str) {
- if (typeof str !== 'string') {
- warn('The argument for removeNullCharacters must be a string.');
- return str;
- }
- return str.replace(NullCharactersRegExp, '');
-}
-function bytesToString(bytes) {
- assert(bytes !== null && (typeof bytes === 'undefined' ? 'undefined' : _typeof(bytes)) === 'object' && bytes.length !== undefined, 'Invalid argument for bytesToString');
- var length = bytes.length;
- var MAX_ARGUMENT_COUNT = 8192;
- if (length < MAX_ARGUMENT_COUNT) {
- return String.fromCharCode.apply(null, bytes);
- }
- var strBuf = [];
- for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
- var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
- var chunk = bytes.subarray(i, chunkEnd);
- strBuf.push(String.fromCharCode.apply(null, chunk));
- }
- return strBuf.join('');
-}
-function stringToBytes(str) {
- assert(typeof str === 'string', 'Invalid argument for stringToBytes');
- var length = str.length;
- var bytes = new Uint8Array(length);
- for (var i = 0; i < length; ++i) {
- bytes[i] = str.charCodeAt(i) & 0xFF;
- }
- return bytes;
-}
-function arrayByteLength(arr) {
- if (arr.length !== undefined) {
- return arr.length;
- }
- assert(arr.byteLength !== undefined);
- return arr.byteLength;
-}
-function arraysToBytes(arr) {
- if (arr.length === 1 && arr[0] instanceof Uint8Array) {
- return arr[0];
- }
- var resultLength = 0;
- var i,
- ii = arr.length;
- var item, itemLength;
- for (i = 0; i < ii; i++) {
- item = arr[i];
- itemLength = arrayByteLength(item);
- resultLength += itemLength;
- }
- var pos = 0;
- var data = new Uint8Array(resultLength);
- for (i = 0; i < ii; i++) {
- item = arr[i];
- if (!(item instanceof Uint8Array)) {
- if (typeof item === 'string') {
- item = stringToBytes(item);
- } else {
- item = new Uint8Array(item);
- }
- }
- itemLength = item.byteLength;
- data.set(item, pos);
- pos += itemLength;
- }
- return data;
-}
-function string32(value) {
- return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
-}
-function log2(x) {
- if (x <= 0) {
- return 0;
- }
- return Math.ceil(Math.log2(x));
-}
-function readInt8(data, start) {
- return data[start] << 24 >> 24;
-}
-function readUint16(data, offset) {
- return data[offset] << 8 | data[offset + 1];
-}
-function readUint32(data, offset) {
- return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
-}
-function isLittleEndian() {
- var buffer8 = new Uint8Array(4);
- buffer8[0] = 1;
- var view32 = new Uint32Array(buffer8.buffer, 0, 1);
- return view32[0] === 1;
-}
-function isEvalSupported() {
- try {
- new Function('');
- return true;
- } catch (e) {
- return false;
- }
-}
-function getInheritableProperty(_ref) {
- var dict = _ref.dict,
- key = _ref.key,
- _ref$getArray = _ref.getArray,
- getArray = _ref$getArray === undefined ? false : _ref$getArray,
- _ref$stopWhenFound = _ref.stopWhenFound,
- stopWhenFound = _ref$stopWhenFound === undefined ? true : _ref$stopWhenFound;
-
- var LOOP_LIMIT = 100;
- var loopCount = 0;
- var values = void 0;
- 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 "' + key + '"');
- break;
- }
- dict = dict.get('Parent');
- }
- return values;
-}
-var Util = function UtilClosure() {
- function Util() {}
- var rgbBuf = ['rgb(', 0, ',', 0, ',', 0, ')'];
- Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {
- rgbBuf[1] = r;
- rgbBuf[3] = g;
- rgbBuf[5] = b;
- return rgbBuf.join('');
- };
- Util.transform = function Util_transform(m1, m2) {
- return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
- };
- Util.applyTransform = function Util_applyTransform(p, m) {
- var xt = p[0] * m[0] + p[1] * m[2] + m[4];
- var yt = p[0] * m[1] + p[1] * m[3] + m[5];
- return [xt, yt];
- };
- Util.applyInverseTransform = function Util_applyInverseTransform(p, m) {
- var d = m[0] * m[3] - m[1] * m[2];
- var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
- var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
- return [xt, yt];
- };
- Util.getAxialAlignedBoundingBox = function Util_getAxialAlignedBoundingBox(r, m) {
- var p1 = Util.applyTransform(r, m);
- var p2 = Util.applyTransform(r.slice(2, 4), m);
- var p3 = Util.applyTransform([r[0], r[3]], m);
- var p4 = Util.applyTransform([r[2], r[1]], m);
- return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])];
- };
- Util.inverseTransform = function Util_inverseTransform(m) {
- var d = m[0] * m[3] - m[1] * m[2];
- return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];
- };
- Util.apply3dTransform = function Util_apply3dTransform(m, v) {
- return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]];
- };
- Util.singularValueDecompose2dScale = function Util_singularValueDecompose2dScale(m) {
- var transpose = [m[0], m[2], m[1], m[3]];
- var a = m[0] * transpose[0] + m[1] * transpose[2];
- var b = m[0] * transpose[1] + m[1] * transpose[3];
- var c = m[2] * transpose[0] + m[3] * transpose[2];
- var d = m[2] * transpose[1] + m[3] * transpose[3];
- var first = (a + d) / 2;
- var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
- var sx = first + second || 1;
- var sy = first - second || 1;
- return [Math.sqrt(sx), Math.sqrt(sy)];
- };
- Util.normalizeRect = function Util_normalizeRect(rect) {
- var r = rect.slice(0);
- if (rect[0] > rect[2]) {
- r[0] = rect[2];
- r[2] = rect[0];
- }
- if (rect[1] > rect[3]) {
- r[1] = rect[3];
- r[3] = rect[1];
- }
- return r;
- };
- Util.intersect = function Util_intersect(rect1, rect2) {
- function compare(a, b) {
- return a - b;
- }
- var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare),
- orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare),
- result = [];
- rect1 = Util.normalizeRect(rect1);
- rect2 = Util.normalizeRect(rect2);
- if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
- result[0] = orderedX[1];
- result[2] = orderedX[2];
- } else {
- return false;
- }
- if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
- result[1] = orderedY[1];
- result[3] = orderedY[2];
- } else {
- return false;
- }
- return result;
- };
- return 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 = void 0,
- 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) {
- var i,
- n = str.length,
- strBuf = [];
- if (str[0] === '\xFE' && str[1] === '\xFF') {
- for (i = 2; i < n; i += 2) {
- strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
- }
- } else {
- for (i = 0; i < n; ++i) {
- var code = PDFStringTranslateTable[str.charCodeAt(i)];
- strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
- }
- }
- return strBuf.join('');
-}
-function stringToUTF8String(str) {
- return decodeURIComponent(escape(str));
-}
-function utf8StringToString(str) {
- return unescape(encodeURIComponent(str));
-}
-function isEmptyObj(obj) {
- for (var key in obj) {
- return false;
- }
- return true;
-}
-function isBool(v) {
- return typeof v === 'boolean';
-}
-function isNum(v) {
- return typeof v === 'number';
-}
-function isString(v) {
- return typeof v === 'string';
-}
-function isArrayBuffer(v) {
- return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' && v !== null && v.byteLength !== undefined;
-}
-function isSpace(ch) {
- return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
-}
-function createPromiseCapability() {
- var capability = {};
- capability.promise = new Promise(function (resolve, reject) {
- capability.resolve = resolve;
- capability.reject = reject;
- });
- return capability;
-}
-var createObjectURL = function createObjectURLClosure() {
- var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
- return function createObjectURL(data, contentType) {
- var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
-
- if (!forceDataSchema && _url_polyfill.URL.createObjectURL) {
- var blob = new Blob([data], { type: contentType });
- return _url_polyfill.URL.createObjectURL(blob);
- }
- var buffer = 'data:' + contentType + ';base64,';
- for (var i = 0, ii = data.length; i < ii; i += 3) {
- var b1 = data[i] & 0xFF;
- var b2 = data[i + 1] & 0xFF;
- var b3 = data[i + 2] & 0xFF;
- var d1 = b1 >> 2,
- d2 = (b1 & 3) << 4 | b2 >> 4;
- var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
- var d4 = i + 2 < ii ? b3 & 0x3F : 64;
- buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
- }
- return buffer;
- };
-}();
-exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
-exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
-exports.OPS = OPS;
-exports.VerbosityLevel = VerbosityLevel;
-exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
-exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
-exports.AnnotationFieldFlag = AnnotationFieldFlag;
-exports.AnnotationFlag = AnnotationFlag;
-exports.AnnotationType = AnnotationType;
-exports.FontType = FontType;
-exports.ImageKind = ImageKind;
-exports.CMapCompressionType = CMapCompressionType;
-exports.AbortException = AbortException;
-exports.InvalidPDFException = InvalidPDFException;
-exports.MissingDataException = MissingDataException;
-exports.MissingPDFException = MissingPDFException;
-exports.NativeImageDecoding = NativeImageDecoding;
-exports.PasswordException = PasswordException;
-exports.PasswordResponses = PasswordResponses;
-exports.PermissionFlag = PermissionFlag;
-exports.StreamType = StreamType;
-exports.TextRenderingMode = TextRenderingMode;
-exports.UnexpectedResponseException = UnexpectedResponseException;
-exports.UnknownErrorException = UnknownErrorException;
-exports.Util = Util;
-exports.toRomanNumerals = toRomanNumerals;
-exports.XRefParseException = XRefParseException;
-exports.FormatError = FormatError;
-exports.arrayByteLength = arrayByteLength;
-exports.arraysToBytes = arraysToBytes;
-exports.assert = assert;
-exports.bytesToString = bytesToString;
-exports.createPromiseCapability = createPromiseCapability;
-exports.createObjectURL = createObjectURL;
-exports.deprecated = deprecated;
-exports.getInheritableProperty = getInheritableProperty;
-exports.getLookupTableFactory = getLookupTableFactory;
-exports.getVerbosityLevel = getVerbosityLevel;
-exports.info = info;
-exports.isArrayBuffer = isArrayBuffer;
-exports.isBool = isBool;
-exports.isEmptyObj = isEmptyObj;
-exports.isNum = isNum;
-exports.isString = isString;
-exports.isSpace = isSpace;
-exports.isSameOrigin = isSameOrigin;
-exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
-exports.isLittleEndian = isLittleEndian;
-exports.isEvalSupported = isEvalSupported;
-exports.log2 = log2;
-exports.readInt8 = readInt8;
-exports.readUint16 = readUint16;
-exports.readUint32 = readUint32;
-exports.removeNullCharacters = removeNullCharacters;
-exports.ReadableStream = _streams_polyfill.ReadableStream;
-exports.URL = _url_polyfill.URL;
-exports.setVerbosityLevel = setVerbosityLevel;
-exports.shadow = shadow;
-exports.string32 = string32;
-exports.stringToBytes = stringToBytes;
-exports.stringToPDFString = stringToPDFString;
-exports.stringToUTF8String = stringToUTF8String;
-exports.utf8StringToString = utf8StringToString;
-exports.warn = warn;
-exports.unreachable = unreachable;
-
-/***/ }),
-/* 2 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-var globalScope = __w_pdfjs_require__(3);
-if (!globalScope._pdfjsCompatibilityChecked) {
- globalScope._pdfjsCompatibilityChecked = true;
- var isNodeJS = __w_pdfjs_require__(4);
- var hasDOM = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) === 'object' && (typeof document === 'undefined' ? 'undefined' : _typeof(document)) === 'object';
- (function checkNodeBtoa() {
- if (globalScope.btoa || !isNodeJS()) {
- return;
- }
- globalScope.btoa = function (chars) {
- return Buffer.from(chars, 'binary').toString('base64');
- };
- })();
- (function checkNodeAtob() {
- if (globalScope.atob || !isNodeJS()) {
- return;
- }
- globalScope.atob = function (input) {
- return Buffer.from(input, 'base64').toString('binary');
- };
- })();
- (function checkCurrentScript() {
- if (!hasDOM) {
- return;
- }
- if ('currentScript' in document) {
- return;
- }
- Object.defineProperty(document, 'currentScript', {
- get: function get() {
- var scripts = document.getElementsByTagName('script');
- return scripts[scripts.length - 1];
- },
-
- enumerable: true,
- configurable: true
- });
- })();
- (function checkChildNodeRemove() {
- if (!hasDOM) {
- return;
- }
- if (typeof Element.prototype.remove !== 'undefined') {
- return;
- }
- Element.prototype.remove = function () {
- if (this.parentNode) {
- this.parentNode.removeChild(this);
- }
- };
- })();
- (function checkDOMTokenListToggle() {
- if (!hasDOM || isNodeJS()) {
- return;
- }
- var div = document.createElement('div');
- if (div.classList.toggle('test', 0) === false) {
- return;
- }
- var originalDOMTokenListToggle = DOMTokenList.prototype.toggle;
- DOMTokenList.prototype.toggle = function (token) {
- if (arguments.length > 1) {
- var force = !!arguments[1];
- return this[force ? 'add' : 'remove'](token), force;
- }
- return originalDOMTokenListToggle(token);
- };
- })();
- (function checkStringIncludes() {
- if (String.prototype.includes) {
- return;
- }
- __w_pdfjs_require__(5);
- })();
- (function checkArrayIncludes() {
- if (Array.prototype.includes) {
- return;
- }
- __w_pdfjs_require__(33);
- })();
- (function checkObjectAssign() {
- if (Object.assign) {
- return;
- }
- __w_pdfjs_require__(42);
- })();
- (function checkMathLog2() {
- if (Math.log2) {
- return;
- }
- Math.log2 = __w_pdfjs_require__(52);
- })();
- (function checkNumberIsNaN() {
- if (Number.isNaN) {
- return;
- }
- Number.isNaN = __w_pdfjs_require__(54);
- })();
- (function checkNumberIsInteger() {
- if (Number.isInteger) {
- return;
- }
- Number.isInteger = __w_pdfjs_require__(56);
- })();
- (function checkPromise() {
- if (globalScope.Promise) {
- return;
- }
- globalScope.Promise = __w_pdfjs_require__(59);
- })();
- (function checkWeakMap() {
- if (globalScope.WeakMap) {
- return;
- }
- globalScope.WeakMap = __w_pdfjs_require__(94);
- })();
- (function checkStringCodePointAt() {
- if (String.codePointAt) {
- return;
- }
- String.codePointAt = __w_pdfjs_require__(111);
- })();
- (function checkStringFromCodePoint() {
- if (String.fromCodePoint) {
- return;
- }
- String.fromCodePoint = __w_pdfjs_require__(113);
- })();
- (function checkSymbol() {
- if (globalScope.Symbol) {
- return;
- }
- __w_pdfjs_require__(115);
- })();
- (function checkObjectValues() {
- if (Object.values) {
- return;
- }
- Object.values = __w_pdfjs_require__(122);
- })();
-}
-
-/***/ }),
-/* 3 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = typeof window !== 'undefined' && window.Math === Math ? window : typeof global !== 'undefined' && global.Math === Math ? global : typeof self !== 'undefined' && self.Math === Math ? self : {};
-
-/***/ }),
-/* 4 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-module.exports = function isNodeJS() {
- return (typeof process === 'undefined' ? 'undefined' : _typeof(process)) === 'object' && process + '' === '[object process]';
-};
-
-/***/ }),
-/* 5 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(6);
-module.exports = __w_pdfjs_require__(9).String.includes;
-
-/***/ }),
-/* 6 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(7);
-var context = __w_pdfjs_require__(25);
-var INCLUDES = 'includes';
-$export($export.P + $export.F * __w_pdfjs_require__(32)(INCLUDES), 'String', {
- includes: function includes(searchString) {
- return !!~context(this, searchString, INCLUDES).indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);
- }
-});
-
-/***/ }),
-/* 7 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var global = __w_pdfjs_require__(8);
-var core = __w_pdfjs_require__(9);
-var hide = __w_pdfjs_require__(10);
-var redefine = __w_pdfjs_require__(20);
-var ctx = __w_pdfjs_require__(23);
-var PROTOTYPE = 'prototype';
-var $export = function $export(type, name, source) {
- var IS_FORCED = type & $export.F;
- var IS_GLOBAL = type & $export.G;
- var IS_STATIC = type & $export.S;
- var IS_PROTO = type & $export.P;
- var IS_BIND = type & $export.B;
- var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];
- var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
- var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
- var key, own, out, exp;
- if (IS_GLOBAL) source = name;
- for (key in source) {
- own = !IS_FORCED && target && target[key] !== undefined;
- out = (own ? target : source)[key];
- exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
- if (target) redefine(target, key, out, type & $export.U);
- if (exports[key] != out) hide(exports, key, exp);
- if (IS_PROTO && expProto[key] != out) expProto[key] = out;
- }
-};
-global.core = core;
-$export.F = 1;
-$export.G = 2;
-$export.S = 4;
-$export.P = 8;
-$export.B = 16;
-$export.W = 32;
-$export.U = 64;
-$export.R = 128;
-module.exports = $export;
-
-/***/ }),
-/* 8 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
-if (typeof __g == 'number') __g = global;
-
-/***/ }),
-/* 9 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var core = module.exports = { version: '2.5.7' };
-if (typeof __e == 'number') __e = core;
-
-/***/ }),
-/* 10 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var dP = __w_pdfjs_require__(11);
-var createDesc = __w_pdfjs_require__(19);
-module.exports = __w_pdfjs_require__(15) ? function (object, key, value) {
- return dP.f(object, key, createDesc(1, value));
-} : function (object, key, value) {
- object[key] = value;
- return object;
-};
-
-/***/ }),
-/* 11 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var anObject = __w_pdfjs_require__(12);
-var IE8_DOM_DEFINE = __w_pdfjs_require__(14);
-var toPrimitive = __w_pdfjs_require__(18);
-var dP = Object.defineProperty;
-exports.f = __w_pdfjs_require__(15) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
- anObject(O);
- P = toPrimitive(P, true);
- anObject(Attributes);
- if (IE8_DOM_DEFINE) try {
- return dP(O, P, Attributes);
- } catch (e) {}
- if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
- if ('value' in Attributes) O[P] = Attributes.value;
- return O;
-};
-
-/***/ }),
-/* 12 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isObject = __w_pdfjs_require__(13);
-module.exports = function (it) {
- if (!isObject(it)) throw TypeError(it + ' is not an object!');
- return it;
-};
-
-/***/ }),
-/* 13 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-module.exports = function (it) {
- return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) === 'object' ? it !== null : typeof it === 'function';
-};
-
-/***/ }),
-/* 14 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = !__w_pdfjs_require__(15) && !__w_pdfjs_require__(16)(function () {
- return Object.defineProperty(__w_pdfjs_require__(17)('div'), 'a', {
- get: function get() {
- return 7;
- }
- }).a != 7;
-});
-
-/***/ }),
-/* 15 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = !__w_pdfjs_require__(16)(function () {
- return Object.defineProperty({}, 'a', {
- get: function get() {
- return 7;
- }
- }).a != 7;
-});
-
-/***/ }),
-/* 16 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = function (exec) {
- try {
- return !!exec();
- } catch (e) {
- return true;
- }
-};
-
-/***/ }),
-/* 17 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isObject = __w_pdfjs_require__(13);
-var document = __w_pdfjs_require__(8).document;
-var is = isObject(document) && isObject(document.createElement);
-module.exports = function (it) {
- return is ? document.createElement(it) : {};
-};
-
-/***/ }),
-/* 18 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isObject = __w_pdfjs_require__(13);
-module.exports = function (it, S) {
- if (!isObject(it)) return it;
- var fn, val;
- if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
- if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
- if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
- throw TypeError("Can't convert object to primitive value");
-};
-
-/***/ }),
-/* 19 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = function (bitmap, value) {
- return {
- enumerable: !(bitmap & 1),
- configurable: !(bitmap & 2),
- writable: !(bitmap & 4),
- value: value
- };
-};
-
-/***/ }),
-/* 20 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var global = __w_pdfjs_require__(8);
-var hide = __w_pdfjs_require__(10);
-var has = __w_pdfjs_require__(21);
-var SRC = __w_pdfjs_require__(22)('src');
-var TO_STRING = 'toString';
-var $toString = Function[TO_STRING];
-var TPL = ('' + $toString).split(TO_STRING);
-__w_pdfjs_require__(9).inspectSource = function (it) {
- return $toString.call(it);
-};
-(module.exports = function (O, key, val, safe) {
- var isFunction = typeof val == 'function';
- if (isFunction) has(val, 'name') || hide(val, 'name', key);
- if (O[key] === val) return;
- if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
- if (O === global) {
- O[key] = val;
- } else if (!safe) {
- delete O[key];
- hide(O, key, val);
- } else if (O[key]) {
- O[key] = val;
- } else {
- hide(O, key, val);
- }
-})(Function.prototype, TO_STRING, function toString() {
- return typeof this == 'function' && this[SRC] || $toString.call(this);
-});
-
-/***/ }),
-/* 21 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var hasOwnProperty = {}.hasOwnProperty;
-module.exports = function (it, key) {
- return hasOwnProperty.call(it, key);
-};
-
-/***/ }),
-/* 22 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var id = 0;
-var px = Math.random();
-module.exports = function (key) {
- return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
-};
-
-/***/ }),
-/* 23 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var aFunction = __w_pdfjs_require__(24);
-module.exports = function (fn, that, length) {
- aFunction(fn);
- if (that === undefined) return fn;
- switch (length) {
- case 1:
- return function (a) {
- return fn.call(that, a);
- };
- case 2:
- return function (a, b) {
- return fn.call(that, a, b);
- };
- case 3:
- return function (a, b, c) {
- return fn.call(that, a, b, c);
- };
- }
- return function () {
- return fn.apply(that, arguments);
- };
-};
-
-/***/ }),
-/* 24 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = function (it) {
- if (typeof it != 'function') throw TypeError(it + ' is not a function!');
- return it;
-};
-
-/***/ }),
-/* 25 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isRegExp = __w_pdfjs_require__(26);
-var defined = __w_pdfjs_require__(31);
-module.exports = function (that, searchString, NAME) {
- if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!");
- return String(defined(that));
-};
-
-/***/ }),
-/* 26 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isObject = __w_pdfjs_require__(13);
-var cof = __w_pdfjs_require__(27);
-var MATCH = __w_pdfjs_require__(28)('match');
-module.exports = function (it) {
- var isRegExp;
- return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');
-};
-
-/***/ }),
-/* 27 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var toString = {}.toString;
-module.exports = function (it) {
- return toString.call(it).slice(8, -1);
-};
-
-/***/ }),
-/* 28 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var store = __w_pdfjs_require__(29)('wks');
-var uid = __w_pdfjs_require__(22);
-var _Symbol = __w_pdfjs_require__(8).Symbol;
-var USE_SYMBOL = typeof _Symbol == 'function';
-var $exports = module.exports = function (name) {
- return store[name] || (store[name] = USE_SYMBOL && _Symbol[name] || (USE_SYMBOL ? _Symbol : uid)('Symbol.' + name));
-};
-$exports.store = store;
-
-/***/ }),
-/* 29 */
-/***/ (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__(30) ? 'pure' : 'global',
- copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
-});
-
-/***/ }),
-/* 30 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = false;
-
-/***/ }),
-/* 31 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = function (it) {
- if (it == undefined) throw TypeError("Can't call method on " + it);
- return it;
-};
-
-/***/ }),
-/* 32 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var MATCH = __w_pdfjs_require__(28)('match');
-module.exports = function (KEY) {
- var re = /./;
- try {
- '/./'[KEY](re);
- } catch (e) {
- try {
- re[MATCH] = false;
- return !'/./'[KEY](re);
- } catch (f) {}
- }
- return true;
-};
-
-/***/ }),
-/* 33 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(34);
-module.exports = __w_pdfjs_require__(9).Array.includes;
-
-/***/ }),
-/* 34 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(7);
-var $includes = __w_pdfjs_require__(35)(true);
-$export($export.P, 'Array', {
- includes: function includes(el) {
- return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
- }
-});
-__w_pdfjs_require__(41)('includes');
-
-/***/ }),
-/* 35 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var toIObject = __w_pdfjs_require__(36);
-var toLength = __w_pdfjs_require__(38);
-var toAbsoluteIndex = __w_pdfjs_require__(40);
-module.exports = function (IS_INCLUDES) {
- return function ($this, el, fromIndex) {
- var O = toIObject($this);
- var length = toLength(O.length);
- var index = toAbsoluteIndex(fromIndex, length);
- var value;
- if (IS_INCLUDES && el != el) while (length > index) {
- value = O[index++];
- if (value != value) return true;
- } else for (; length > index; index++) {
- if (IS_INCLUDES || index in O) {
- if (O[index] === el) return IS_INCLUDES || index || 0;
- }
- }return !IS_INCLUDES && -1;
- };
-};
-
-/***/ }),
-/* 36 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var IObject = __w_pdfjs_require__(37);
-var defined = __w_pdfjs_require__(31);
-module.exports = function (it) {
- return IObject(defined(it));
-};
-
-/***/ }),
-/* 37 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var cof = __w_pdfjs_require__(27);
-module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
- return cof(it) == 'String' ? it.split('') : Object(it);
-};
-
-/***/ }),
-/* 38 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var toInteger = __w_pdfjs_require__(39);
-var min = Math.min;
-module.exports = function (it) {
- return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0;
-};
-
-/***/ }),
-/* 39 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var ceil = Math.ceil;
-var floor = Math.floor;
-module.exports = function (it) {
- return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
-};
-
-/***/ }),
-/* 40 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var toInteger = __w_pdfjs_require__(39);
-var max = Math.max;
-var min = Math.min;
-module.exports = function (index, length) {
- index = toInteger(index);
- return index < 0 ? max(index + length, 0) : min(index, length);
-};
-
-/***/ }),
-/* 41 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var UNSCOPABLES = __w_pdfjs_require__(28)('unscopables');
-var ArrayProto = Array.prototype;
-if (ArrayProto[UNSCOPABLES] == undefined) __w_pdfjs_require__(10)(ArrayProto, UNSCOPABLES, {});
-module.exports = function (key) {
- ArrayProto[UNSCOPABLES][key] = true;
-};
-
-/***/ }),
-/* 42 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(43);
-module.exports = __w_pdfjs_require__(9).Object.assign;
-
-/***/ }),
-/* 43 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(7);
-$export($export.S + $export.F, 'Object', { assign: __w_pdfjs_require__(44) });
-
-/***/ }),
-/* 44 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var getKeys = __w_pdfjs_require__(45);
-var gOPS = __w_pdfjs_require__(49);
-var pIE = __w_pdfjs_require__(50);
-var toObject = __w_pdfjs_require__(51);
-var IObject = __w_pdfjs_require__(37);
-var $assign = Object.assign;
-module.exports = !$assign || __w_pdfjs_require__(16)(function () {
- var A = {};
- var B = {};
- var S = Symbol();
- var K = 'abcdefghijklmnopqrst';
- A[S] = 7;
- K.split('').forEach(function (k) {
- B[k] = k;
- });
- return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
-}) ? function assign(target, source) {
- var T = toObject(target);
- var aLen = arguments.length;
- var index = 1;
- var getSymbols = gOPS.f;
- var isEnum = pIE.f;
- while (aLen > index) {
- var S = IObject(arguments[index++]);
- var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
- var length = keys.length;
- var j = 0;
- var key;
- while (length > j) {
- if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
- }
- }
- return T;
-} : $assign;
-
-/***/ }),
-/* 45 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $keys = __w_pdfjs_require__(46);
-var enumBugKeys = __w_pdfjs_require__(48);
-module.exports = Object.keys || function keys(O) {
- return $keys(O, enumBugKeys);
-};
-
-/***/ }),
-/* 46 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var has = __w_pdfjs_require__(21);
-var toIObject = __w_pdfjs_require__(36);
-var arrayIndexOf = __w_pdfjs_require__(35)(false);
-var IE_PROTO = __w_pdfjs_require__(47)('IE_PROTO');
-module.exports = function (object, names) {
- var O = toIObject(object);
- var i = 0;
- var result = [];
- var key;
- for (key in O) {
- if (key != IE_PROTO) has(O, key) && result.push(key);
- }while (names.length > i) {
- if (has(O, key = names[i++])) {
- ~arrayIndexOf(result, key) || result.push(key);
- }
- }return result;
-};
-
-/***/ }),
-/* 47 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var shared = __w_pdfjs_require__(29)('keys');
-var uid = __w_pdfjs_require__(22);
-module.exports = function (key) {
- return shared[key] || (shared[key] = uid(key));
-};
-
-/***/ }),
-/* 48 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'.split(',');
-
-/***/ }),
-/* 49 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-exports.f = Object.getOwnPropertySymbols;
-
-/***/ }),
-/* 50 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-exports.f = {}.propertyIsEnumerable;
-
-/***/ }),
-/* 51 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var defined = __w_pdfjs_require__(31);
-module.exports = function (it) {
- return Object(defined(it));
-};
-
-/***/ }),
-/* 52 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(53);
-module.exports = __w_pdfjs_require__(9).Math.log2;
-
-/***/ }),
-/* 53 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(7);
-$export($export.S, 'Math', {
- log2: function log2(x) {
- return Math.log(x) / Math.LN2;
- }
-});
-
-/***/ }),
-/* 54 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(55);
-module.exports = __w_pdfjs_require__(9).Number.isNaN;
-
-/***/ }),
-/* 55 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(7);
-$export($export.S, 'Number', {
- isNaN: function isNaN(number) {
- return number != number;
- }
-});
-
-/***/ }),
-/* 56 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(57);
-module.exports = __w_pdfjs_require__(9).Number.isInteger;
-
-/***/ }),
-/* 57 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(7);
-$export($export.S, 'Number', { isInteger: __w_pdfjs_require__(58) });
-
-/***/ }),
-/* 58 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isObject = __w_pdfjs_require__(13);
-var floor = Math.floor;
-module.exports = function isInteger(it) {
- return !isObject(it) && isFinite(it) && floor(it) === it;
-};
-
-/***/ }),
-/* 59 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(60);
-__w_pdfjs_require__(62);
-__w_pdfjs_require__(72);
-__w_pdfjs_require__(75);
-__w_pdfjs_require__(92);
-__w_pdfjs_require__(93);
-module.exports = __w_pdfjs_require__(9).Promise;
-
-/***/ }),
-/* 60 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var classof = __w_pdfjs_require__(61);
-var test = {};
-test[__w_pdfjs_require__(28)('toStringTag')] = 'z';
-if (test + '' != '[object z]') {
- __w_pdfjs_require__(20)(Object.prototype, 'toString', function toString() {
- return '[object ' + classof(this) + ']';
- }, true);
-}
-
-/***/ }),
-/* 61 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var cof = __w_pdfjs_require__(27);
-var TAG = __w_pdfjs_require__(28)('toStringTag');
-var ARG = cof(function () {
- return arguments;
-}()) == 'Arguments';
-var tryGet = function tryGet(it, key) {
- try {
- return it[key];
- } catch (e) {}
-};
-module.exports = function (it) {
- var O, T, B;
- return it === undefined ? 'Undefined' : it === null ? 'Null' : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T : ARG ? cof(O) : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
-};
-
-/***/ }),
-/* 62 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $at = __w_pdfjs_require__(63)(true);
-__w_pdfjs_require__(64)(String, 'String', function (iterated) {
- this._t = String(iterated);
- this._i = 0;
-}, function () {
- var O = this._t;
- var index = this._i;
- var point;
- if (index >= O.length) return {
- value: undefined,
- done: true
- };
- point = $at(O, index);
- this._i += point.length;
- return {
- value: point,
- done: false
- };
-});
-
-/***/ }),
-/* 63 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var toInteger = __w_pdfjs_require__(39);
-var defined = __w_pdfjs_require__(31);
-module.exports = function (TO_STRING) {
- return function (that, pos) {
- var s = String(defined(that));
- var i = toInteger(pos);
- var l = s.length;
- var a, b;
- if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
- a = s.charCodeAt(i);
- return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
- };
-};
-
-/***/ }),
-/* 64 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var LIBRARY = __w_pdfjs_require__(30);
-var $export = __w_pdfjs_require__(7);
-var redefine = __w_pdfjs_require__(20);
-var hide = __w_pdfjs_require__(10);
-var Iterators = __w_pdfjs_require__(65);
-var $iterCreate = __w_pdfjs_require__(66);
-var setToStringTag = __w_pdfjs_require__(70);
-var getPrototypeOf = __w_pdfjs_require__(71);
-var ITERATOR = __w_pdfjs_require__(28)('iterator');
-var BUGGY = !([].keys && 'next' in [].keys());
-var FF_ITERATOR = '@@iterator';
-var KEYS = 'keys';
-var VALUES = 'values';
-var returnThis = function returnThis() {
- return this;
-};
-module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
- $iterCreate(Constructor, NAME, next);
- var getMethod = function getMethod(kind) {
- if (!BUGGY && kind in proto) return proto[kind];
- switch (kind) {
- case KEYS:
- return function keys() {
- return new Constructor(this, kind);
- };
- case VALUES:
- return function values() {
- return new Constructor(this, kind);
- };
- }
- return function entries() {
- return new Constructor(this, kind);
- };
- };
- var TAG = NAME + ' Iterator';
- var DEF_VALUES = DEFAULT == VALUES;
- var VALUES_BUG = false;
- var proto = Base.prototype;
- var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
- var $default = $native || getMethod(DEFAULT);
- var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
- var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
- var methods, key, IteratorPrototype;
- if ($anyNative) {
- IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
- if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
- setToStringTag(IteratorPrototype, TAG, true);
- if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
- }
- }
- if (DEF_VALUES && $native && $native.name !== VALUES) {
- VALUES_BUG = true;
- $default = function values() {
- return $native.call(this);
- };
- }
- if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
- hide(proto, ITERATOR, $default);
- }
- Iterators[NAME] = $default;
- Iterators[TAG] = returnThis;
- if (DEFAULT) {
- methods = {
- values: DEF_VALUES ? $default : getMethod(VALUES),
- keys: IS_SET ? $default : getMethod(KEYS),
- entries: $entries
- };
- if (FORCED) for (key in methods) {
- if (!(key in proto)) redefine(proto, key, methods[key]);
- } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
- }
- return methods;
-};
-
-/***/ }),
-/* 65 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = {};
-
-/***/ }),
-/* 66 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var create = __w_pdfjs_require__(67);
-var descriptor = __w_pdfjs_require__(19);
-var setToStringTag = __w_pdfjs_require__(70);
-var IteratorPrototype = {};
-__w_pdfjs_require__(10)(IteratorPrototype, __w_pdfjs_require__(28)('iterator'), function () {
- return this;
-});
-module.exports = function (Constructor, NAME, next) {
- Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
- setToStringTag(Constructor, NAME + ' Iterator');
-};
-
-/***/ }),
-/* 67 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var anObject = __w_pdfjs_require__(12);
-var dPs = __w_pdfjs_require__(68);
-var enumBugKeys = __w_pdfjs_require__(48);
-var IE_PROTO = __w_pdfjs_require__(47)('IE_PROTO');
-var Empty = function Empty() {};
-var PROTOTYPE = 'prototype';
-var _createDict = function createDict() {
- var iframe = __w_pdfjs_require__(17)('iframe');
- var i = enumBugKeys.length;
- var lt = '<';
- var gt = '>';
- var iframeDocument;
- iframe.style.display = 'none';
- __w_pdfjs_require__(69).appendChild(iframe);
- iframe.src = 'javascript:';
- iframeDocument = iframe.contentWindow.document;
- iframeDocument.open();
- iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
- iframeDocument.close();
- _createDict = iframeDocument.F;
- while (i--) {
- delete _createDict[PROTOTYPE][enumBugKeys[i]];
- }return _createDict();
-};
-module.exports = Object.create || function create(O, Properties) {
- var result;
- if (O !== null) {
- Empty[PROTOTYPE] = anObject(O);
- result = new Empty();
- Empty[PROTOTYPE] = null;
- result[IE_PROTO] = O;
- } else result = _createDict();
- return Properties === undefined ? result : dPs(result, Properties);
-};
-
-/***/ }),
-/* 68 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var dP = __w_pdfjs_require__(11);
-var anObject = __w_pdfjs_require__(12);
-var getKeys = __w_pdfjs_require__(45);
-module.exports = __w_pdfjs_require__(15) ? Object.defineProperties : function defineProperties(O, Properties) {
- anObject(O);
- var keys = getKeys(Properties);
- var length = keys.length;
- var i = 0;
- var P;
- while (length > i) {
- dP.f(O, P = keys[i++], Properties[P]);
- }return O;
-};
-
-/***/ }),
-/* 69 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var document = __w_pdfjs_require__(8).document;
-module.exports = document && document.documentElement;
-
-/***/ }),
-/* 70 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var def = __w_pdfjs_require__(11).f;
-var has = __w_pdfjs_require__(21);
-var TAG = __w_pdfjs_require__(28)('toStringTag');
-module.exports = function (it, tag, stat) {
- if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, {
- configurable: true,
- value: tag
- });
-};
-
-/***/ }),
-/* 71 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var has = __w_pdfjs_require__(21);
-var toObject = __w_pdfjs_require__(51);
-var IE_PROTO = __w_pdfjs_require__(47)('IE_PROTO');
-var ObjectProto = Object.prototype;
-module.exports = Object.getPrototypeOf || function (O) {
- O = toObject(O);
- if (has(O, IE_PROTO)) return O[IE_PROTO];
- if (typeof O.constructor == 'function' && O instanceof O.constructor) {
- return O.constructor.prototype;
- }
- return O instanceof Object ? ObjectProto : null;
-};
-
-/***/ }),
-/* 72 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $iterators = __w_pdfjs_require__(73);
-var getKeys = __w_pdfjs_require__(45);
-var redefine = __w_pdfjs_require__(20);
-var global = __w_pdfjs_require__(8);
-var hide = __w_pdfjs_require__(10);
-var Iterators = __w_pdfjs_require__(65);
-var wks = __w_pdfjs_require__(28);
-var ITERATOR = wks('iterator');
-var TO_STRING_TAG = wks('toStringTag');
-var ArrayValues = Iterators.Array;
-var DOMIterables = {
- CSSRuleList: true,
- CSSStyleDeclaration: false,
- CSSValueList: false,
- ClientRectList: false,
- DOMRectList: false,
- DOMStringList: false,
- DOMTokenList: true,
- DataTransferItemList: false,
- FileList: false,
- HTMLAllCollection: false,
- HTMLCollection: false,
- HTMLFormElement: false,
- HTMLSelectElement: false,
- MediaList: true,
- MimeTypeArray: false,
- NamedNodeMap: false,
- NodeList: true,
- PaintRequestList: false,
- Plugin: false,
- PluginArray: false,
- SVGLengthList: false,
- SVGNumberList: false,
- SVGPathSegList: false,
- SVGPointList: false,
- SVGStringList: false,
- SVGTransformList: false,
- SourceBufferList: false,
- StyleSheetList: true,
- TextTrackCueList: false,
- TextTrackList: false,
- TouchList: false
-};
-for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) {
- var NAME = collections[i];
- var explicit = DOMIterables[NAME];
- var Collection = global[NAME];
- var proto = Collection && Collection.prototype;
- var key;
- if (proto) {
- if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues);
- if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
- Iterators[NAME] = ArrayValues;
- if (explicit) for (key in $iterators) {
- if (!proto[key]) redefine(proto, key, $iterators[key], true);
- }
- }
-}
-
-/***/ }),
-/* 73 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var addToUnscopables = __w_pdfjs_require__(41);
-var step = __w_pdfjs_require__(74);
-var Iterators = __w_pdfjs_require__(65);
-var toIObject = __w_pdfjs_require__(36);
-module.exports = __w_pdfjs_require__(64)(Array, 'Array', function (iterated, kind) {
- this._t = toIObject(iterated);
- this._i = 0;
- this._k = kind;
-}, function () {
- var O = this._t;
- var kind = this._k;
- var index = this._i++;
- if (!O || index >= O.length) {
- this._t = undefined;
- return step(1);
- }
- if (kind == 'keys') return step(0, index);
- if (kind == 'values') return step(0, O[index]);
- return step(0, [index, O[index]]);
-}, 'values');
-Iterators.Arguments = Iterators.Array;
-addToUnscopables('keys');
-addToUnscopables('values');
-addToUnscopables('entries');
-
-/***/ }),
-/* 74 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = function (done, value) {
- return {
- value: value,
- done: !!done
- };
-};
-
-/***/ }),
-/* 75 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var LIBRARY = __w_pdfjs_require__(30);
-var global = __w_pdfjs_require__(8);
-var ctx = __w_pdfjs_require__(23);
-var classof = __w_pdfjs_require__(61);
-var $export = __w_pdfjs_require__(7);
-var isObject = __w_pdfjs_require__(13);
-var aFunction = __w_pdfjs_require__(24);
-var anInstance = __w_pdfjs_require__(76);
-var forOf = __w_pdfjs_require__(77);
-var speciesConstructor = __w_pdfjs_require__(81);
-var task = __w_pdfjs_require__(82).set;
-var microtask = __w_pdfjs_require__(84)();
-var newPromiseCapabilityModule = __w_pdfjs_require__(85);
-var perform = __w_pdfjs_require__(86);
-var userAgent = __w_pdfjs_require__(87);
-var promiseResolve = __w_pdfjs_require__(88);
-var PROMISE = 'Promise';
-var TypeError = global.TypeError;
-var process = global.process;
-var versions = process && process.versions;
-var v8 = versions && versions.v8 || '';
-var $Promise = global[PROMISE];
-var isNode = classof(process) == 'process';
-var empty = function empty() {};
-var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
-var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;
-var USE_NATIVE = !!function () {
- try {
- var promise = $Promise.resolve(1);
- var FakePromise = (promise.constructor = {})[__w_pdfjs_require__(28)('species')] = function (exec) {
- exec(empty, empty);
- };
- return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise && v8.indexOf('6.6') !== 0 && userAgent.indexOf('Chrome/66') === -1;
- } catch (e) {}
-}();
-var isThenable = function isThenable(it) {
- var then;
- return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
-};
-var notify = function notify(promise, isReject) {
- if (promise._n) return;
- promise._n = true;
- var chain = promise._c;
- microtask(function () {
- var value = promise._v;
- var ok = promise._s == 1;
- var i = 0;
- var run = function run(reaction) {
- var handler = ok ? reaction.ok : reaction.fail;
- var resolve = reaction.resolve;
- var reject = reaction.reject;
- var domain = reaction.domain;
- var result, then, exited;
- try {
- if (handler) {
- if (!ok) {
- if (promise._h == 2) onHandleUnhandled(promise);
- promise._h = 1;
- }
- if (handler === true) result = value;else {
- if (domain) domain.enter();
- result = handler(value);
- if (domain) {
- domain.exit();
- exited = true;
- }
- }
- if (result === reaction.promise) {
- reject(TypeError('Promise-chain cycle'));
- } else if (then = isThenable(result)) {
- then.call(result, resolve, reject);
- } else resolve(result);
- } else reject(value);
- } catch (e) {
- if (domain && !exited) domain.exit();
- reject(e);
- }
- };
- while (chain.length > i) {
- run(chain[i++]);
- }promise._c = [];
- promise._n = false;
- if (isReject && !promise._h) onUnhandled(promise);
- });
-};
-var onUnhandled = function onUnhandled(promise) {
- task.call(global, function () {
- var value = promise._v;
- var unhandled = isUnhandled(promise);
- var result, handler, console;
- if (unhandled) {
- result = perform(function () {
- if (isNode) {
- process.emit('unhandledRejection', value, promise);
- } else if (handler = global.onunhandledrejection) {
- handler({
- promise: promise,
- reason: value
- });
- } else if ((console = global.console) && console.error) {
- console.error('Unhandled promise rejection', value);
- }
- });
- promise._h = isNode || isUnhandled(promise) ? 2 : 1;
- }
- promise._a = undefined;
- if (unhandled && result.e) throw result.v;
- });
-};
-var isUnhandled = function isUnhandled(promise) {
- return promise._h !== 1 && (promise._a || promise._c).length === 0;
-};
-var onHandleUnhandled = function onHandleUnhandled(promise) {
- task.call(global, function () {
- var handler;
- if (isNode) {
- process.emit('rejectionHandled', promise);
- } else if (handler = global.onrejectionhandled) {
- handler({
- promise: promise,
- reason: promise._v
- });
- }
- });
-};
-var $reject = function $reject(value) {
- var promise = this;
- if (promise._d) return;
- promise._d = true;
- promise = promise._w || promise;
- promise._v = value;
- promise._s = 2;
- if (!promise._a) promise._a = promise._c.slice();
- notify(promise, true);
-};
-var $resolve = function $resolve(value) {
- var promise = this;
- var then;
- if (promise._d) return;
- promise._d = true;
- promise = promise._w || promise;
- try {
- if (promise === value) throw TypeError("Promise can't be resolved itself");
- if (then = isThenable(value)) {
- microtask(function () {
- var wrapper = {
- _w: promise,
- _d: false
- };
- try {
- then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
- } catch (e) {
- $reject.call(wrapper, e);
- }
- });
- } else {
- promise._v = value;
- promise._s = 1;
- notify(promise, false);
- }
- } catch (e) {
- $reject.call({
- _w: promise,
- _d: false
- }, e);
- }
-};
-if (!USE_NATIVE) {
- $Promise = function Promise(executor) {
- anInstance(this, $Promise, PROMISE, '_h');
- aFunction(executor);
- Internal.call(this);
- try {
- executor(ctx($resolve, this, 1), ctx($reject, this, 1));
- } catch (err) {
- $reject.call(this, err);
- }
- };
- Internal = function Promise(executor) {
- this._c = [];
- this._a = undefined;
- this._s = 0;
- this._d = false;
- this._v = undefined;
- this._h = 0;
- this._n = false;
- };
- Internal.prototype = __w_pdfjs_require__(89)($Promise.prototype, {
- then: function then(onFulfilled, onRejected) {
- var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
- reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
- reaction.fail = typeof onRejected == 'function' && onRejected;
- reaction.domain = isNode ? process.domain : undefined;
- this._c.push(reaction);
- if (this._a) this._a.push(reaction);
- if (this._s) notify(this, false);
- return reaction.promise;
- },
- 'catch': function _catch(onRejected) {
- return this.then(undefined, onRejected);
- }
- });
- OwnPromiseCapability = function OwnPromiseCapability() {
- var promise = new Internal();
- this.promise = promise;
- this.resolve = ctx($resolve, promise, 1);
- this.reject = ctx($reject, promise, 1);
- };
- newPromiseCapabilityModule.f = newPromiseCapability = function newPromiseCapability(C) {
- return C === $Promise || C === Wrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C);
- };
-}
-$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise });
-__w_pdfjs_require__(70)($Promise, PROMISE);
-__w_pdfjs_require__(90)(PROMISE);
-Wrapper = __w_pdfjs_require__(9)[PROMISE];
-$export($export.S + $export.F * !USE_NATIVE, PROMISE, {
- reject: function reject(r) {
- var capability = newPromiseCapability(this);
- var $$reject = capability.reject;
- $$reject(r);
- return capability.promise;
- }
-});
-$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
- resolve: function resolve(x) {
- return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);
- }
-});
-$export($export.S + $export.F * !(USE_NATIVE && __w_pdfjs_require__(91)(function (iter) {
- $Promise.all(iter)['catch'](empty);
-})), PROMISE, {
- all: function all(iterable) {
- var C = this;
- var capability = newPromiseCapability(C);
- var resolve = capability.resolve;
- var reject = capability.reject;
- var result = perform(function () {
- var values = [];
- var index = 0;
- var remaining = 1;
- forOf(iterable, false, function (promise) {
- var $index = index++;
- var alreadyCalled = false;
- values.push(undefined);
- remaining++;
- C.resolve(promise).then(function (value) {
- if (alreadyCalled) return;
- alreadyCalled = true;
- values[$index] = value;
- --remaining || resolve(values);
- }, reject);
- });
- --remaining || resolve(values);
- });
- if (result.e) reject(result.v);
- return capability.promise;
- },
- race: function race(iterable) {
- var C = this;
- var capability = newPromiseCapability(C);
- var reject = capability.reject;
- var result = perform(function () {
- forOf(iterable, false, function (promise) {
- C.resolve(promise).then(capability.resolve, reject);
- });
- });
- if (result.e) reject(result.v);
- return capability.promise;
- }
-});
-
-/***/ }),
-/* 76 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = function (it, Constructor, name, forbiddenField) {
- if (!(it instanceof Constructor) || forbiddenField !== undefined && forbiddenField in it) {
- throw TypeError(name + ': incorrect invocation!');
- }
- return it;
-};
-
-/***/ }),
-/* 77 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var ctx = __w_pdfjs_require__(23);
-var call = __w_pdfjs_require__(78);
-var isArrayIter = __w_pdfjs_require__(79);
-var anObject = __w_pdfjs_require__(12);
-var toLength = __w_pdfjs_require__(38);
-var getIterFn = __w_pdfjs_require__(80);
-var BREAK = {};
-var RETURN = {};
-var _exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
- var iterFn = ITERATOR ? function () {
- return iterable;
- } : getIterFn(iterable);
- var f = ctx(fn, that, entries ? 2 : 1);
- var index = 0;
- var length, step, iterator, result;
- if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
- if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
- result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
- if (result === BREAK || result === RETURN) return result;
- } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
- result = call(iterator, f, step.value, entries);
- if (result === BREAK || result === RETURN) return result;
- }
-};
-_exports.BREAK = BREAK;
-_exports.RETURN = RETURN;
-
-/***/ }),
-/* 78 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var anObject = __w_pdfjs_require__(12);
-module.exports = function (iterator, fn, value, entries) {
- try {
- return entries ? fn(anObject(value)[0], value[1]) : fn(value);
- } catch (e) {
- var ret = iterator['return'];
- if (ret !== undefined) anObject(ret.call(iterator));
- throw e;
- }
-};
-
-/***/ }),
-/* 79 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var Iterators = __w_pdfjs_require__(65);
-var ITERATOR = __w_pdfjs_require__(28)('iterator');
-var ArrayProto = Array.prototype;
-module.exports = function (it) {
- return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
-};
-
-/***/ }),
-/* 80 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var classof = __w_pdfjs_require__(61);
-var ITERATOR = __w_pdfjs_require__(28)('iterator');
-var Iterators = __w_pdfjs_require__(65);
-module.exports = __w_pdfjs_require__(9).getIteratorMethod = function (it) {
- if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)];
-};
-
-/***/ }),
-/* 81 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var anObject = __w_pdfjs_require__(12);
-var aFunction = __w_pdfjs_require__(24);
-var SPECIES = __w_pdfjs_require__(28)('species');
-module.exports = function (O, D) {
- var C = anObject(O).constructor;
- var S;
- return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
-};
-
-/***/ }),
-/* 82 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var ctx = __w_pdfjs_require__(23);
-var invoke = __w_pdfjs_require__(83);
-var html = __w_pdfjs_require__(69);
-var cel = __w_pdfjs_require__(17);
-var global = __w_pdfjs_require__(8);
-var process = global.process;
-var setTask = global.setImmediate;
-var clearTask = global.clearImmediate;
-var MessageChannel = global.MessageChannel;
-var Dispatch = global.Dispatch;
-var counter = 0;
-var queue = {};
-var ONREADYSTATECHANGE = 'onreadystatechange';
-var defer, channel, port;
-var run = function run() {
- var id = +this;
- if (queue.hasOwnProperty(id)) {
- var fn = queue[id];
- delete queue[id];
- fn();
- }
-};
-var listener = function listener(event) {
- run.call(event.data);
-};
-if (!setTask || !clearTask) {
- setTask = function setImmediate(fn) {
- var args = [];
- var i = 1;
- while (arguments.length > i) {
- args.push(arguments[i++]);
- }queue[++counter] = function () {
- invoke(typeof fn == 'function' ? fn : Function(fn), args);
- };
- defer(counter);
- return counter;
- };
- clearTask = function clearImmediate(id) {
- delete queue[id];
- };
- if (__w_pdfjs_require__(27)(process) == 'process') {
- defer = function defer(id) {
- process.nextTick(ctx(run, id, 1));
- };
- } else if (Dispatch && Dispatch.now) {
- defer = function defer(id) {
- Dispatch.now(ctx(run, id, 1));
- };
- } else if (MessageChannel) {
- channel = new MessageChannel();
- port = channel.port2;
- channel.port1.onmessage = listener;
- defer = ctx(port.postMessage, port, 1);
- } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
- defer = function defer(id) {
- global.postMessage(id + '', '*');
- };
- global.addEventListener('message', listener, false);
- } else if (ONREADYSTATECHANGE in cel('script')) {
- defer = function defer(id) {
- html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {
- html.removeChild(this);
- run.call(id);
- };
- };
- } else {
- defer = function defer(id) {
- setTimeout(ctx(run, id, 1), 0);
- };
- }
-}
-module.exports = {
- set: setTask,
- clear: clearTask
-};
-
-/***/ }),
-/* 83 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = function (fn, args, that) {
- var un = that === undefined;
- switch (args.length) {
- case 0:
- return un ? fn() : fn.call(that);
- case 1:
- return un ? fn(args[0]) : fn.call(that, args[0]);
- case 2:
- return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]);
- case 3:
- return un ? fn(args[0], args[1], args[2]) : fn.call(that, args[0], args[1], args[2]);
- case 4:
- return un ? fn(args[0], args[1], args[2], args[3]) : fn.call(that, args[0], args[1], args[2], args[3]);
- }
- return fn.apply(that, args);
-};
-
-/***/ }),
-/* 84 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var global = __w_pdfjs_require__(8);
-var macrotask = __w_pdfjs_require__(82).set;
-var Observer = global.MutationObserver || global.WebKitMutationObserver;
-var process = global.process;
-var Promise = global.Promise;
-var isNode = __w_pdfjs_require__(27)(process) == 'process';
-module.exports = function () {
- var head, last, notify;
- var flush = function flush() {
- var parent, fn;
- if (isNode && (parent = process.domain)) parent.exit();
- while (head) {
- fn = head.fn;
- head = head.next;
- try {
- fn();
- } catch (e) {
- if (head) notify();else last = undefined;
- throw e;
- }
- }
- last = undefined;
- if (parent) parent.enter();
- };
- if (isNode) {
- notify = function notify() {
- process.nextTick(flush);
- };
- } else if (Observer && !(global.navigator && global.navigator.standalone)) {
- var toggle = true;
- var node = document.createTextNode('');
- new Observer(flush).observe(node, { characterData: true });
- notify = function notify() {
- node.data = toggle = !toggle;
- };
- } else if (Promise && Promise.resolve) {
- var promise = Promise.resolve(undefined);
- notify = function notify() {
- promise.then(flush);
- };
- } else {
- notify = function notify() {
- macrotask.call(global, flush);
- };
- }
- return function (fn) {
- var task = {
- fn: fn,
- next: undefined
- };
- if (last) last.next = task;
- if (!head) {
- head = task;
- notify();
- }
- last = task;
- };
-};
-
-/***/ }),
-/* 85 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var aFunction = __w_pdfjs_require__(24);
-function PromiseCapability(C) {
- var resolve, reject;
- this.promise = new C(function ($$resolve, $$reject) {
- if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
- resolve = $$resolve;
- reject = $$reject;
- });
- this.resolve = aFunction(resolve);
- this.reject = aFunction(reject);
-}
-module.exports.f = function (C) {
- return new PromiseCapability(C);
-};
-
-/***/ }),
-/* 86 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = function (exec) {
- try {
- return {
- e: false,
- v: exec()
- };
- } catch (e) {
- return {
- e: true,
- v: e
- };
- }
-};
-
-/***/ }),
-/* 87 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var global = __w_pdfjs_require__(8);
-var navigator = global.navigator;
-module.exports = navigator && navigator.userAgent || '';
-
-/***/ }),
-/* 88 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var anObject = __w_pdfjs_require__(12);
-var isObject = __w_pdfjs_require__(13);
-var newPromiseCapability = __w_pdfjs_require__(85);
-module.exports = function (C, x) {
- anObject(C);
- if (isObject(x) && x.constructor === C) return x;
- var promiseCapability = newPromiseCapability.f(C);
- var resolve = promiseCapability.resolve;
- resolve(x);
- return promiseCapability.promise;
-};
-
-/***/ }),
-/* 89 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var redefine = __w_pdfjs_require__(20);
-module.exports = function (target, src, safe) {
- for (var key in src) {
- redefine(target, key, src[key], safe);
- }return target;
-};
-
-/***/ }),
-/* 90 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var global = __w_pdfjs_require__(8);
-var dP = __w_pdfjs_require__(11);
-var DESCRIPTORS = __w_pdfjs_require__(15);
-var SPECIES = __w_pdfjs_require__(28)('species');
-module.exports = function (KEY) {
- var C = global[KEY];
- if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
- configurable: true,
- get: function get() {
- return this;
- }
- });
-};
-
-/***/ }),
-/* 91 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var ITERATOR = __w_pdfjs_require__(28)('iterator');
-var SAFE_CLOSING = false;
-try {
- var riter = [7][ITERATOR]();
- riter['return'] = function () {
- SAFE_CLOSING = true;
- };
- Array.from(riter, function () {
- throw 2;
- });
-} catch (e) {}
-module.exports = function (exec, skipClosing) {
- if (!skipClosing && !SAFE_CLOSING) return false;
- var safe = false;
- try {
- var arr = [7];
- var iter = arr[ITERATOR]();
- iter.next = function () {
- return { done: safe = true };
- };
- arr[ITERATOR] = function () {
- return iter;
- };
- exec(arr);
- } catch (e) {}
- return safe;
-};
-
-/***/ }),
-/* 92 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(7);
-var core = __w_pdfjs_require__(9);
-var global = __w_pdfjs_require__(8);
-var speciesConstructor = __w_pdfjs_require__(81);
-var promiseResolve = __w_pdfjs_require__(88);
-$export($export.P + $export.R, 'Promise', {
- 'finally': function _finally(onFinally) {
- var C = speciesConstructor(this, core.Promise || global.Promise);
- var isFunction = typeof onFinally == 'function';
- return this.then(isFunction ? function (x) {
- return promiseResolve(C, onFinally()).then(function () {
- return x;
- });
- } : onFinally, isFunction ? function (e) {
- return promiseResolve(C, onFinally()).then(function () {
- throw e;
- });
- } : onFinally);
- }
-});
-
-/***/ }),
-/* 93 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(7);
-var newPromiseCapability = __w_pdfjs_require__(85);
-var perform = __w_pdfjs_require__(86);
-$export($export.S, 'Promise', {
- 'try': function _try(callbackfn) {
- var promiseCapability = newPromiseCapability.f(this);
- var result = perform(callbackfn);
- (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
- return promiseCapability.promise;
- }
-});
-
-/***/ }),
-/* 94 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(60);
-__w_pdfjs_require__(72);
-__w_pdfjs_require__(95);
-__w_pdfjs_require__(107);
-__w_pdfjs_require__(109);
-module.exports = __w_pdfjs_require__(9).WeakMap;
-
-/***/ }),
-/* 95 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var each = __w_pdfjs_require__(96)(0);
-var redefine = __w_pdfjs_require__(20);
-var meta = __w_pdfjs_require__(100);
-var assign = __w_pdfjs_require__(44);
-var weak = __w_pdfjs_require__(101);
-var isObject = __w_pdfjs_require__(13);
-var fails = __w_pdfjs_require__(16);
-var validate = __w_pdfjs_require__(102);
-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) {
- return function WeakMap() {
- return get(this, arguments.length > 0 ? arguments[0] : undefined);
- };
-};
-var methods = {
- get: function get(key) {
- if (isObject(key)) {
- var data = getWeak(key);
- if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key);
- return data ? data[this._i] : undefined;
- }
- },
- set: function set(key, value) {
- return weak.def(validate(this, WEAK_MAP), key, value);
- }
-};
-var $WeakMap = module.exports = __w_pdfjs_require__(103)(WEAK_MAP, wrapper, methods, weak, true, true);
-if (fails(function () {
- return new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7;
-})) {
- InternalMap = weak.getConstructor(wrapper, WEAK_MAP);
- assign(InternalMap.prototype, methods);
- meta.NEED = true;
- each(['delete', 'has', 'get', 'set'], function (key) {
- var proto = $WeakMap.prototype;
- var method = proto[key];
- redefine(proto, key, function (a, b) {
- if (isObject(a) && !isExtensible(a)) {
- if (!this._f) this._f = new InternalMap();
- var result = this._f[key](a, b);
- return key == 'set' ? this : result;
- }
- return method.call(this, a, b);
- });
- });
-}
-
-/***/ }),
-/* 96 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var ctx = __w_pdfjs_require__(23);
-var IObject = __w_pdfjs_require__(37);
-var toObject = __w_pdfjs_require__(51);
-var toLength = __w_pdfjs_require__(38);
-var asc = __w_pdfjs_require__(97);
-module.exports = function (TYPE, $create) {
- var IS_MAP = TYPE == 1;
- var IS_FILTER = TYPE == 2;
- var IS_SOME = TYPE == 3;
- var IS_EVERY = TYPE == 4;
- var IS_FIND_INDEX = TYPE == 6;
- var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
- var create = $create || asc;
- return function ($this, callbackfn, that) {
- var O = toObject($this);
- var self = IObject(O);
- var f = ctx(callbackfn, that, 3);
- var length = toLength(self.length);
- var index = 0;
- var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
- var val, res;
- for (; length > index; index++) {
- if (NO_HOLES || index in self) {
- val = self[index];
- res = f(val, index, O);
- if (TYPE) {
- if (IS_MAP) result[index] = res;else if (res) switch (TYPE) {
- case 3:
- return true;
- case 5:
- return val;
- case 6:
- return index;
- case 2:
- result.push(val);
- } else if (IS_EVERY) return false;
- }
- }
- }return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
- };
-};
-
-/***/ }),
-/* 97 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var speciesConstructor = __w_pdfjs_require__(98);
-module.exports = function (original, length) {
- return new (speciesConstructor(original))(length);
-};
-
-/***/ }),
-/* 98 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isObject = __w_pdfjs_require__(13);
-var isArray = __w_pdfjs_require__(99);
-var SPECIES = __w_pdfjs_require__(28)('species');
-module.exports = function (original) {
- var C;
- if (isArray(original)) {
- C = original.constructor;
- if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
- if (isObject(C)) {
- C = C[SPECIES];
- if (C === null) C = undefined;
- }
- }
- return C === undefined ? Array : C;
-};
-
-/***/ }),
-/* 99 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var cof = __w_pdfjs_require__(27);
-module.exports = Array.isArray || function isArray(arg) {
- return cof(arg) == 'Array';
-};
-
-/***/ }),
-/* 100 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-var META = __w_pdfjs_require__(22)('meta');
-var isObject = __w_pdfjs_require__(13);
-var has = __w_pdfjs_require__(21);
-var setDesc = __w_pdfjs_require__(11).f;
-var id = 0;
-var isExtensible = Object.isExtensible || function () {
- return true;
-};
-var FREEZE = !__w_pdfjs_require__(16)(function () {
- return isExtensible(Object.preventExtensions({}));
-});
-var setMeta = function setMeta(it) {
- setDesc(it, META, {
- value: {
- i: 'O' + ++id,
- w: {}
- }
- });
-};
-var fastKey = function fastKey(it, create) {
- if (!isObject(it)) return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
- if (!has(it, META)) {
- if (!isExtensible(it)) return 'F';
- if (!create) return 'E';
- setMeta(it);
- }
- return it[META].i;
-};
-var getWeak = function getWeak(it, create) {
- if (!has(it, META)) {
- if (!isExtensible(it)) return true;
- if (!create) return false;
- setMeta(it);
- }
- return it[META].w;
-};
-var onFreeze = function onFreeze(it) {
- if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
- return it;
-};
-var meta = module.exports = {
- KEY: META,
- NEED: false,
- fastKey: fastKey,
- getWeak: getWeak,
- onFreeze: onFreeze
-};
-
-/***/ }),
-/* 101 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var redefineAll = __w_pdfjs_require__(89);
-var getWeak = __w_pdfjs_require__(100).getWeak;
-var anObject = __w_pdfjs_require__(12);
-var isObject = __w_pdfjs_require__(13);
-var anInstance = __w_pdfjs_require__(76);
-var forOf = __w_pdfjs_require__(77);
-var createArrayMethod = __w_pdfjs_require__(96);
-var $has = __w_pdfjs_require__(21);
-var validate = __w_pdfjs_require__(102);
-var arrayFind = createArrayMethod(5);
-var arrayFindIndex = createArrayMethod(6);
-var id = 0;
-var uncaughtFrozenStore = function uncaughtFrozenStore(that) {
- return that._l || (that._l = new UncaughtFrozenStore());
-};
-var UncaughtFrozenStore = function UncaughtFrozenStore() {
- this.a = [];
-};
-var findUncaughtFrozen = function findUncaughtFrozen(store, key) {
- return arrayFind(store.a, function (it) {
- return it[0] === key;
- });
-};
-UncaughtFrozenStore.prototype = {
- get: function get(key) {
- var entry = findUncaughtFrozen(this, key);
- if (entry) return entry[1];
- },
- has: function has(key) {
- return !!findUncaughtFrozen(this, key);
- },
- set: function set(key, value) {
- var entry = findUncaughtFrozen(this, key);
- if (entry) entry[1] = value;else this.a.push([key, value]);
- },
- 'delete': function _delete(key) {
- var index = arrayFindIndex(this.a, function (it) {
- return it[0] === key;
- });
- if (~index) this.a.splice(index, 1);
- return !!~index;
- }
-};
-module.exports = {
- getConstructor: function getConstructor(wrapper, NAME, IS_MAP, ADDER) {
- var C = wrapper(function (that, iterable) {
- anInstance(that, C, NAME, '_i');
- that._t = NAME;
- that._i = id++;
- that._l = undefined;
- if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
- });
- redefineAll(C.prototype, {
- 'delete': function _delete(key) {
- if (!isObject(key)) return false;
- var data = getWeak(key);
- if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key);
- return data && $has(data, this._i) && delete data[this._i];
- },
- has: function has(key) {
- if (!isObject(key)) return false;
- var data = getWeak(key);
- if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key);
- return data && $has(data, this._i);
- }
- });
- return C;
- },
- def: function def(that, key, value) {
- var data = getWeak(anObject(key), true);
- if (data === true) uncaughtFrozenStore(that).set(key, value);else data[that._i] = value;
- return that;
- },
- ufstore: uncaughtFrozenStore
-};
-
-/***/ }),
-/* 102 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isObject = __w_pdfjs_require__(13);
-module.exports = function (it, TYPE) {
- if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
- return it;
-};
-
-/***/ }),
-/* 103 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var global = __w_pdfjs_require__(8);
-var $export = __w_pdfjs_require__(7);
-var redefine = __w_pdfjs_require__(20);
-var redefineAll = __w_pdfjs_require__(89);
-var meta = __w_pdfjs_require__(100);
-var forOf = __w_pdfjs_require__(77);
-var anInstance = __w_pdfjs_require__(76);
-var isObject = __w_pdfjs_require__(13);
-var fails = __w_pdfjs_require__(16);
-var $iterDetect = __w_pdfjs_require__(91);
-var setToStringTag = __w_pdfjs_require__(70);
-var inheritIfRequired = __w_pdfjs_require__(104);
-module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
- var Base = global[NAME];
- var C = Base;
- var ADDER = IS_MAP ? 'set' : 'add';
- var proto = C && C.prototype;
- var O = {};
- var fixMethod = function fixMethod(KEY) {
- var fn = proto[KEY];
- redefine(proto, KEY, KEY == 'delete' ? function (a) {
- return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
- } : KEY == 'has' ? function has(a) {
- return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
- } : KEY == 'get' ? function get(a) {
- return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a);
- } : KEY == 'add' ? function add(a) {
- fn.call(this, a === 0 ? 0 : a);
- return this;
- } : function set(a, b) {
- fn.call(this, a === 0 ? 0 : a, b);
- return this;
- });
- };
- if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () {
- new C().entries().next();
- }))) {
- C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
- redefineAll(C.prototype, methods);
- meta.NEED = true;
- } else {
- var instance = new C();
- var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
- var THROWS_ON_PRIMITIVES = fails(function () {
- instance.has(1);
- });
- var ACCEPT_ITERABLES = $iterDetect(function (iter) {
- new C(iter);
- });
- var BUGGY_ZERO = !IS_WEAK && fails(function () {
- var $instance = new C();
- var index = 5;
- while (index--) {
- $instance[ADDER](index, index);
- }return !$instance.has(-0);
- });
- if (!ACCEPT_ITERABLES) {
- C = wrapper(function (target, iterable) {
- anInstance(target, C, NAME);
- var that = inheritIfRequired(new Base(), target, C);
- if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
- return that;
- });
- C.prototype = proto;
- proto.constructor = C;
- }
- if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
- fixMethod('delete');
- fixMethod('has');
- IS_MAP && fixMethod('get');
- }
- if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);
- if (IS_WEAK && proto.clear) delete proto.clear;
- }
- setToStringTag(C, NAME);
- O[NAME] = C;
- $export($export.G + $export.W + $export.F * (C != Base), O);
- if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);
- return C;
-};
-
-/***/ }),
-/* 104 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isObject = __w_pdfjs_require__(13);
-var setPrototypeOf = __w_pdfjs_require__(105).set;
-module.exports = function (that, target, C) {
- var S = target.constructor;
- var P;
- if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) {
- setPrototypeOf(that, P);
- }
- return that;
-};
-
-/***/ }),
-/* 105 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isObject = __w_pdfjs_require__(13);
-var anObject = __w_pdfjs_require__(12);
-var check = function check(O, proto) {
- anObject(O);
- if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
-};
-module.exports = {
- set: Object.setPrototypeOf || ('__proto__' in {} ? function (test, buggy, set) {
- try {
- set = __w_pdfjs_require__(23)(Function.call, __w_pdfjs_require__(106).f(Object.prototype, '__proto__').set, 2);
- set(test, []);
- buggy = !(test instanceof Array);
- } catch (e) {
- buggy = true;
- }
- return function setPrototypeOf(O, proto) {
- check(O, proto);
- if (buggy) O.__proto__ = proto;else set(O, proto);
- return O;
- };
- }({}, false) : undefined),
- check: check
-};
-
-/***/ }),
-/* 106 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var pIE = __w_pdfjs_require__(50);
-var createDesc = __w_pdfjs_require__(19);
-var toIObject = __w_pdfjs_require__(36);
-var toPrimitive = __w_pdfjs_require__(18);
-var has = __w_pdfjs_require__(21);
-var IE8_DOM_DEFINE = __w_pdfjs_require__(14);
-var gOPD = Object.getOwnPropertyDescriptor;
-exports.f = __w_pdfjs_require__(15) ? gOPD : function getOwnPropertyDescriptor(O, P) {
- O = toIObject(O);
- P = toPrimitive(P, true);
- if (IE8_DOM_DEFINE) try {
- return gOPD(O, P);
- } catch (e) {}
- if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
-};
-
-/***/ }),
-/* 107 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(108)('WeakMap');
-
-/***/ }),
-/* 108 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(7);
-module.exports = function (COLLECTION) {
- $export($export.S, COLLECTION, {
- of: function of() {
- var length = arguments.length;
- var A = new Array(length);
- while (length--) {
- A[length] = arguments[length];
- }return new this(A);
- }
- });
-};
-
-/***/ }),
-/* 109 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(110)('WeakMap');
-
-/***/ }),
-/* 110 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(7);
-var aFunction = __w_pdfjs_require__(24);
-var ctx = __w_pdfjs_require__(23);
-var forOf = __w_pdfjs_require__(77);
-module.exports = function (COLLECTION) {
- $export($export.S, COLLECTION, {
- from: function from(source) {
- var mapFn = arguments[1];
- var mapping, A, n, cb;
- aFunction(this);
- mapping = mapFn !== undefined;
- if (mapping) aFunction(mapFn);
- if (source == undefined) return new this();
- A = [];
- if (mapping) {
- n = 0;
- cb = ctx(mapFn, arguments[2], 2);
- forOf(source, false, function (nextItem) {
- A.push(cb(nextItem, n++));
- });
- } else {
- forOf(source, false, A.push, A);
- }
- return new this(A);
- }
- });
-};
-
-/***/ }),
-/* 111 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(112);
-module.exports = __w_pdfjs_require__(9).String.codePointAt;
-
-/***/ }),
-/* 112 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(7);
-var $at = __w_pdfjs_require__(63)(false);
-$export($export.P, 'String', {
- codePointAt: function codePointAt(pos) {
- return $at(this, pos);
- }
-});
-
-/***/ }),
-/* 113 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(114);
-module.exports = __w_pdfjs_require__(9).String.fromCodePoint;
-
-/***/ }),
-/* 114 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(7);
-var toAbsoluteIndex = __w_pdfjs_require__(40);
-var fromCharCode = String.fromCharCode;
-var $fromCodePoint = String.fromCodePoint;
-$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
- fromCodePoint: function fromCodePoint(x) {
- var res = [];
- var aLen = arguments.length;
- var i = 0;
- var code;
- while (aLen > i) {
- code = +arguments[i++];
- if (toAbsoluteIndex(code, 0x10ffff) !== code) throw RangeError(code + ' is not a valid code point');
- res.push(code < 0x10000 ? fromCharCode(code) : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00));
- }
- return res.join('');
- }
-});
-
-/***/ }),
-/* 115 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(116);
-__w_pdfjs_require__(60);
-module.exports = __w_pdfjs_require__(9).Symbol;
-
-/***/ }),
-/* 116 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-var global = __w_pdfjs_require__(8);
-var has = __w_pdfjs_require__(21);
-var DESCRIPTORS = __w_pdfjs_require__(15);
-var $export = __w_pdfjs_require__(7);
-var redefine = __w_pdfjs_require__(20);
-var META = __w_pdfjs_require__(100).KEY;
-var $fails = __w_pdfjs_require__(16);
-var shared = __w_pdfjs_require__(29);
-var setToStringTag = __w_pdfjs_require__(70);
-var uid = __w_pdfjs_require__(22);
-var wks = __w_pdfjs_require__(28);
-var wksExt = __w_pdfjs_require__(117);
-var wksDefine = __w_pdfjs_require__(118);
-var enumKeys = __w_pdfjs_require__(119);
-var isArray = __w_pdfjs_require__(99);
-var anObject = __w_pdfjs_require__(12);
-var isObject = __w_pdfjs_require__(13);
-var toIObject = __w_pdfjs_require__(36);
-var toPrimitive = __w_pdfjs_require__(18);
-var createDesc = __w_pdfjs_require__(19);
-var _create = __w_pdfjs_require__(67);
-var gOPNExt = __w_pdfjs_require__(120);
-var $GOPD = __w_pdfjs_require__(106);
-var $DP = __w_pdfjs_require__(11);
-var $keys = __w_pdfjs_require__(45);
-var gOPD = $GOPD.f;
-var dP = $DP.f;
-var gOPN = gOPNExt.f;
-var $Symbol = global.Symbol;
-var $JSON = global.JSON;
-var _stringify = $JSON && $JSON.stringify;
-var PROTOTYPE = 'prototype';
-var HIDDEN = wks('_hidden');
-var TO_PRIMITIVE = wks('toPrimitive');
-var isEnum = {}.propertyIsEnumerable;
-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 QObject = global.QObject;
-var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
-var setSymbolDesc = DESCRIPTORS && $fails(function () {
- return _create(dP({}, 'a', {
- get: function get() {
- return dP(this, 'a', { value: 7 }).a;
- }
- })).a != 7;
-}) ? function (it, key, D) {
- var protoDesc = gOPD(ObjectProto, key);
- if (protoDesc) delete ObjectProto[key];
- dP(it, key, D);
- if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
-} : dP;
-var wrap = function wrap(tag) {
- var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
- sym._k = tag;
- return sym;
-};
-var isSymbol = USE_NATIVE && _typeof($Symbol.iterator) == 'symbol' ? function (it) {
- return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) == 'symbol';
-} : function (it) {
- return it instanceof $Symbol;
-};
-var $defineProperty = function defineProperty(it, key, D) {
- if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
- anObject(it);
- key = toPrimitive(key, true);
- anObject(D);
- if (has(AllSymbols, key)) {
- if (!D.enumerable) {
- if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
- it[HIDDEN][key] = true;
- } else {
- if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
- D = _create(D, { enumerable: createDesc(0, false) });
- }
- return setSymbolDesc(it, key, D);
- }
- return dP(it, key, D);
-};
-var $defineProperties = function defineProperties(it, P) {
- anObject(it);
- var keys = enumKeys(P = toIObject(P));
- var i = 0;
- var l = keys.length;
- var key;
- while (l > i) {
- $defineProperty(it, key = keys[i++], P[key]);
- }return it;
-};
-var $create = function create(it, P) {
- return P === undefined ? _create(it) : $defineProperties(_create(it), P);
-};
-var $propertyIsEnumerable = function propertyIsEnumerable(key) {
- var E = isEnum.call(this, key = toPrimitive(key, true));
- if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
- return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
-};
-var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
- it = toIObject(it);
- key = toPrimitive(key, true);
- if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
- var D = gOPD(it, key);
- if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
- return D;
-};
-var $getOwnPropertyNames = function getOwnPropertyNames(it) {
- var names = gOPN(toIObject(it));
- var result = [];
- var i = 0;
- var key;
- while (names.length > i) {
- if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
- }
- return result;
-};
-var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
- var IS_OP = it === ObjectProto;
- var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
- var result = [];
- var i = 0;
- var key;
- while (names.length > i) {
- if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
- }
- return result;
-};
-if (!USE_NATIVE) {
- $Symbol = function _Symbol() {
- if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
- var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
- var $set = function $set(value) {
- if (this === ObjectProto) $set.call(OPSymbols, value);
- if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
- setSymbolDesc(this, tag, createDesc(1, value));
- };
- if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, {
- configurable: true,
- set: $set
- });
- return wrap(tag);
- };
- redefine($Symbol[PROTOTYPE], 'toString', function toString() {
- return this._k;
- });
- $GOPD.f = $getOwnPropertyDescriptor;
- $DP.f = $defineProperty;
- __w_pdfjs_require__(121).f = gOPNExt.f = $getOwnPropertyNames;
- __w_pdfjs_require__(50).f = $propertyIsEnumerable;
- __w_pdfjs_require__(49).f = $getOwnPropertySymbols;
- if (DESCRIPTORS && !__w_pdfjs_require__(30)) {
- redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
- }
- wksExt.f = function (name) {
- return wrap(wks(name));
- };
-}
-$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });
-for (var es6Symbols = 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'.split(','), j = 0; es6Symbols.length > j;) {
- wks(es6Symbols[j++]);
-}for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) {
- wksDefine(wellKnownSymbols[k++]);
-}$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
- 'for': function _for(key) {
- return has(SymbolRegistry, key += '') ? SymbolRegistry[key] : SymbolRegistry[key] = $Symbol(key);
- },
- keyFor: function keyFor(sym) {
- if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
- for (var key in SymbolRegistry) {
- if (SymbolRegistry[key] === sym) return key;
- }
- },
- useSetter: function useSetter() {
- setter = true;
- },
- useSimple: function useSimple() {
- setter = false;
- }
-});
-$export($export.S + $export.F * !USE_NATIVE, 'Object', {
- create: $create,
- defineProperty: $defineProperty,
- defineProperties: $defineProperties,
- getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
- getOwnPropertyNames: $getOwnPropertyNames,
- getOwnPropertySymbols: $getOwnPropertySymbols
-});
-$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
- var S = $Symbol();
- return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
-})), 'JSON', {
- stringify: function stringify(it) {
- var args = [it];
- var i = 1;
- var replacer, $replacer;
- while (arguments.length > i) {
- args.push(arguments[i++]);
- }$replacer = replacer = args[1];
- if (!isObject(replacer) && it === undefined || isSymbol(it)) return;
- if (!isArray(replacer)) replacer = function replacer(key, value) {
- if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
- if (!isSymbol(value)) return value;
- };
- args[1] = replacer;
- return _stringify.apply($JSON, args);
- }
-});
-$Symbol[PROTOTYPE][TO_PRIMITIVE] || __w_pdfjs_require__(10)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
-setToStringTag($Symbol, 'Symbol');
-setToStringTag(Math, 'Math', true);
-setToStringTag(global.JSON, 'JSON', true);
-
-/***/ }),
-/* 117 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-exports.f = __w_pdfjs_require__(28);
-
-/***/ }),
-/* 118 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var global = __w_pdfjs_require__(8);
-var core = __w_pdfjs_require__(9);
-var LIBRARY = __w_pdfjs_require__(30);
-var wksExt = __w_pdfjs_require__(117);
-var defineProperty = __w_pdfjs_require__(11).f;
-module.exports = function (name) {
- var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
- if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });
-};
-
-/***/ }),
-/* 119 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var getKeys = __w_pdfjs_require__(45);
-var gOPS = __w_pdfjs_require__(49);
-var pIE = __w_pdfjs_require__(50);
-module.exports = function (it) {
- var result = getKeys(it);
- var getSymbols = gOPS.f;
- if (getSymbols) {
- var symbols = getSymbols(it);
- var isEnum = pIE.f;
- var i = 0;
- var key;
- while (symbols.length > i) {
- if (isEnum.call(it, key = symbols[i++])) result.push(key);
- }
- }
- return result;
-};
-
-/***/ }),
-/* 120 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-var toIObject = __w_pdfjs_require__(36);
-var gOPN = __w_pdfjs_require__(121).f;
-var toString = {}.toString;
-var windowNames = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
-var getWindowNames = function getWindowNames(it) {
- try {
- return gOPN(it);
- } catch (e) {
- return windowNames.slice();
- }
-};
-module.exports.f = function getOwnPropertyNames(it) {
- return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
-};
-
-/***/ }),
-/* 121 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $keys = __w_pdfjs_require__(46);
-var hiddenKeys = __w_pdfjs_require__(48).concat('length', 'prototype');
-exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
- return $keys(O, hiddenKeys);
-};
-
-/***/ }),
-/* 122 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(123);
-module.exports = __w_pdfjs_require__(9).Object.values;
-
-/***/ }),
-/* 123 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(7);
-var $values = __w_pdfjs_require__(124)(false);
-$export($export.S, 'Object', {
- values: function values(it) {
- return $values(it);
- }
-});
-
-/***/ }),
-/* 124 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var getKeys = __w_pdfjs_require__(45);
-var toIObject = __w_pdfjs_require__(36);
-var isEnum = __w_pdfjs_require__(50).f;
-module.exports = function (isEntries) {
- return function (it) {
- var O = toIObject(it);
- var keys = getKeys(O);
- var length = keys.length;
- var i = 0;
- var result = [];
- var key;
- while (length > i) {
- if (isEnum.call(O, key = keys[i++])) {
- result.push(isEntries ? [key, O[key]] : O[key]);
- }
- }return result;
- };
-};
-
-/***/ }),
-/* 125 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isReadableStreamSupported = false;
-if (typeof ReadableStream !== 'undefined') {
- try {
- new ReadableStream({
- start: function start(controller) {
- controller.close();
- }
- });
- isReadableStreamSupported = true;
- } catch (e) {}
-}
-if (isReadableStreamSupported) {
- exports.ReadableStream = ReadableStream;
-} else {
- exports.ReadableStream = __w_pdfjs_require__(126).ReadableStream;
-}
-
-/***/ }),
-/* 126 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-(function (e, a) {
- for (var i in a) {
- e[i] = a[i];
- }
-})(exports, function (modules) {
- var installedModules = {};
- function __w_pdfjs_require__(moduleId) {
- if (installedModules[moduleId]) return installedModules[moduleId].exports;
- var module = installedModules[moduleId] = {
- i: moduleId,
- l: false,
- exports: {}
- };
- modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);
- module.l = true;
- return module.exports;
- }
- __w_pdfjs_require__.m = modules;
- __w_pdfjs_require__.c = installedModules;
- __w_pdfjs_require__.i = function (value) {
- return value;
- };
- __w_pdfjs_require__.d = function (exports, name, getter) {
- if (!__w_pdfjs_require__.o(exports, name)) {
- Object.defineProperty(exports, name, {
- configurable: false,
- enumerable: true,
- get: getter
- });
- }
- };
- __w_pdfjs_require__.n = function (module) {
- var getter = module && module.__esModule ? function getDefault() {
- return module['default'];
- } : function getModuleExports() {
- return module;
- };
- __w_pdfjs_require__.d(getter, 'a', getter);
- return getter;
- };
- __w_pdfjs_require__.o = function (object, property) {
- return Object.prototype.hasOwnProperty.call(object, property);
- };
- __w_pdfjs_require__.p = "";
- return __w_pdfjs_require__(__w_pdfjs_require__.s = 7);
-}([function (module, exports, __w_pdfjs_require__) {
- "use strict";
-
- var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
- return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
- } : function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
- };
- var _require = __w_pdfjs_require__(1),
- assert = _require.assert;
- function IsPropertyKey(argument) {
- return typeof argument === 'string' || (typeof argument === 'undefined' ? 'undefined' : _typeof(argument)) === 'symbol';
- }
- exports.typeIsObject = function (x) {
- return (typeof x === 'undefined' ? 'undefined' : _typeof(x)) === 'object' && x !== null || typeof x === 'function';
- };
- exports.createDataProperty = function (o, p, v) {
- assert(exports.typeIsObject(o));
- Object.defineProperty(o, p, {
- value: v,
- writable: true,
- enumerable: true,
- configurable: true
- });
- };
- exports.createArrayFromList = function (elements) {
- return elements.slice();
- };
- exports.ArrayBufferCopy = function (dest, destOffset, src, srcOffset, n) {
- new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);
- };
- exports.CreateIterResultObject = function (value, done) {
- assert(typeof done === 'boolean');
- var obj = {};
- Object.defineProperty(obj, 'value', {
- value: value,
- enumerable: true,
- writable: true,
- configurable: true
- });
- Object.defineProperty(obj, 'done', {
- value: done,
- enumerable: true,
- writable: true,
- configurable: true
- });
- return obj;
- };
- exports.IsFiniteNonNegativeNumber = function (v) {
- if (Number.isNaN(v)) {
- return false;
- }
- if (v === Infinity) {
- return false;
- }
- if (v < 0) {
- return false;
- }
- return true;
- };
- function Call(F, V, args) {
- if (typeof F !== 'function') {
- throw new TypeError('Argument is not a function');
- }
- return Function.prototype.apply.call(F, V, args);
- }
- exports.InvokeOrNoop = function (O, P, args) {
- assert(O !== undefined);
- assert(IsPropertyKey(P));
- assert(Array.isArray(args));
- var method = O[P];
- if (method === undefined) {
- return undefined;
- }
- return Call(method, O, args);
- };
- exports.PromiseInvokeOrNoop = function (O, P, args) {
- assert(O !== undefined);
- assert(IsPropertyKey(P));
- assert(Array.isArray(args));
- try {
- return Promise.resolve(exports.InvokeOrNoop(O, P, args));
- } catch (returnValueE) {
- return Promise.reject(returnValueE);
- }
- };
- exports.PromiseInvokeOrPerformFallback = function (O, P, args, F, argsF) {
- assert(O !== undefined);
- assert(IsPropertyKey(P));
- assert(Array.isArray(args));
- assert(Array.isArray(argsF));
- var method = void 0;
- try {
- method = O[P];
- } catch (methodE) {
- return Promise.reject(methodE);
- }
- if (method === undefined) {
- return F.apply(null, argsF);
- }
- try {
- return Promise.resolve(Call(method, O, args));
- } catch (e) {
- return Promise.reject(e);
- }
- };
- exports.TransferArrayBuffer = function (O) {
- return O.slice();
- };
- exports.ValidateAndNormalizeHighWaterMark = function (highWaterMark) {
- highWaterMark = Number(highWaterMark);
- if (Number.isNaN(highWaterMark) || highWaterMark < 0) {
- throw new RangeError('highWaterMark property of a queuing strategy must be non-negative and non-NaN');
- }
- return highWaterMark;
- };
- exports.ValidateAndNormalizeQueuingStrategy = function (size, highWaterMark) {
- if (size !== undefined && typeof size !== 'function') {
- throw new TypeError('size property of a queuing strategy must be a function');
- }
- highWaterMark = exports.ValidateAndNormalizeHighWaterMark(highWaterMark);
- return {
- size: size,
- highWaterMark: highWaterMark
- };
- };
-}, function (module, exports, __w_pdfjs_require__) {
- "use strict";
-
- function rethrowAssertionErrorRejection(e) {
- if (e && e.constructor === AssertionError) {
- setTimeout(function () {
- throw e;
- }, 0);
- }
- }
- function AssertionError(message) {
- this.name = 'AssertionError';
- this.message = message || '';
- this.stack = new Error().stack;
- }
- AssertionError.prototype = Object.create(Error.prototype);
- AssertionError.prototype.constructor = AssertionError;
- function assert(value, message) {
- if (!value) {
- throw new AssertionError(message);
- }
- }
- module.exports = {
- rethrowAssertionErrorRejection: rethrowAssertionErrorRejection,
- AssertionError: AssertionError,
- assert: assert
- };
-}, function (module, exports, __w_pdfjs_require__) {
- "use strict";
-
- var _createClass = 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);
- }
- }
- return function (Constructor, protoProps, staticProps) {
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
- if (staticProps) defineProperties(Constructor, staticProps);
- return Constructor;
- };
- }();
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- var _require = __w_pdfjs_require__(0),
- InvokeOrNoop = _require.InvokeOrNoop,
- PromiseInvokeOrNoop = _require.PromiseInvokeOrNoop,
- ValidateAndNormalizeQueuingStrategy = _require.ValidateAndNormalizeQueuingStrategy,
- typeIsObject = _require.typeIsObject;
- var _require2 = __w_pdfjs_require__(1),
- assert = _require2.assert,
- rethrowAssertionErrorRejection = _require2.rethrowAssertionErrorRejection;
- var _require3 = __w_pdfjs_require__(3),
- DequeueValue = _require3.DequeueValue,
- EnqueueValueWithSize = _require3.EnqueueValueWithSize,
- PeekQueueValue = _require3.PeekQueueValue,
- ResetQueue = _require3.ResetQueue;
- var WritableStream = function () {
- function WritableStream() {
- var underlyingSink = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- size = _ref.size,
- _ref$highWaterMark = _ref.highWaterMark,
- highWaterMark = _ref$highWaterMark === undefined ? 1 : _ref$highWaterMark;
- _classCallCheck(this, WritableStream);
- this._state = 'writable';
- this._storedError = undefined;
- this._writer = undefined;
- this._writableStreamController = undefined;
- this._writeRequests = [];
- this._inFlightWriteRequest = undefined;
- this._closeRequest = undefined;
- this._inFlightCloseRequest = undefined;
- this._pendingAbortRequest = undefined;
- this._backpressure = false;
- var type = underlyingSink.type;
- if (type !== undefined) {
- throw new RangeError('Invalid type is specified');
- }
- this._writableStreamController = new WritableStreamDefaultController(this, underlyingSink, size, highWaterMark);
- this._writableStreamController.__startSteps();
- }
- _createClass(WritableStream, [{
- key: 'abort',
- value: function abort(reason) {
- if (IsWritableStream(this) === false) {
- return Promise.reject(streamBrandCheckException('abort'));
- }
- if (IsWritableStreamLocked(this) === true) {
- return Promise.reject(new TypeError('Cannot abort a stream that already has a writer'));
- }
- return WritableStreamAbort(this, reason);
- }
- }, {
- key: 'getWriter',
- value: function getWriter() {
- if (IsWritableStream(this) === false) {
- throw streamBrandCheckException('getWriter');
- }
- return AcquireWritableStreamDefaultWriter(this);
- }
- }, {
- key: 'locked',
- get: function get() {
- if (IsWritableStream(this) === false) {
- throw streamBrandCheckException('locked');
- }
- return IsWritableStreamLocked(this);
- }
- }]);
- return WritableStream;
- }();
- module.exports = {
- AcquireWritableStreamDefaultWriter: AcquireWritableStreamDefaultWriter,
- IsWritableStream: IsWritableStream,
- IsWritableStreamLocked: IsWritableStreamLocked,
- WritableStream: WritableStream,
- WritableStreamAbort: WritableStreamAbort,
- WritableStreamDefaultControllerError: WritableStreamDefaultControllerError,
- WritableStreamDefaultWriterCloseWithErrorPropagation: WritableStreamDefaultWriterCloseWithErrorPropagation,
- WritableStreamDefaultWriterRelease: WritableStreamDefaultWriterRelease,
- WritableStreamDefaultWriterWrite: WritableStreamDefaultWriterWrite,
- WritableStreamCloseQueuedOrInFlight: WritableStreamCloseQueuedOrInFlight
- };
- function AcquireWritableStreamDefaultWriter(stream) {
- return new WritableStreamDefaultWriter(stream);
- }
- function IsWritableStream(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_writableStreamController')) {
- return false;
- }
- return true;
- }
- function IsWritableStreamLocked(stream) {
- assert(IsWritableStream(stream) === true, 'IsWritableStreamLocked should only be used on known writable streams');
- if (stream._writer === undefined) {
- return false;
- }
- return true;
- }
- function WritableStreamAbort(stream, reason) {
- var state = stream._state;
- if (state === 'closed') {
- return Promise.resolve(undefined);
- }
- if (state === 'errored') {
- return Promise.reject(stream._storedError);
- }
- var error = new TypeError('Requested to abort');
- if (stream._pendingAbortRequest !== undefined) {
- return Promise.reject(error);
- }
- assert(state === 'writable' || state === 'erroring', 'state must be writable or erroring');
- var wasAlreadyErroring = false;
- if (state === 'erroring') {
- wasAlreadyErroring = true;
- reason = undefined;
- }
- var promise = new Promise(function (resolve, reject) {
- stream._pendingAbortRequest = {
- _resolve: resolve,
- _reject: reject,
- _reason: reason,
- _wasAlreadyErroring: wasAlreadyErroring
- };
- });
- if (wasAlreadyErroring === false) {
- WritableStreamStartErroring(stream, error);
- }
- return promise;
- }
- function WritableStreamAddWriteRequest(stream) {
- assert(IsWritableStreamLocked(stream) === true);
- assert(stream._state === 'writable');
- var promise = new Promise(function (resolve, reject) {
- var writeRequest = {
- _resolve: resolve,
- _reject: reject
- };
- stream._writeRequests.push(writeRequest);
- });
- return promise;
- }
- function WritableStreamDealWithRejection(stream, error) {
- var state = stream._state;
- if (state === 'writable') {
- WritableStreamStartErroring(stream, error);
- return;
- }
- assert(state === 'erroring');
- WritableStreamFinishErroring(stream);
- }
- function WritableStreamStartErroring(stream, reason) {
- assert(stream._storedError === undefined, 'stream._storedError === undefined');
- assert(stream._state === 'writable', 'state must be writable');
- var controller = stream._writableStreamController;
- assert(controller !== undefined, 'controller must not be undefined');
- stream._state = 'erroring';
- stream._storedError = reason;
- var writer = stream._writer;
- if (writer !== undefined) {
- WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason);
- }
- if (WritableStreamHasOperationMarkedInFlight(stream) === false && controller._started === true) {
- WritableStreamFinishErroring(stream);
- }
- }
- function WritableStreamFinishErroring(stream) {
- assert(stream._state === 'erroring', 'stream._state === erroring');
- assert(WritableStreamHasOperationMarkedInFlight(stream) === false, 'WritableStreamHasOperationMarkedInFlight(stream) === false');
- stream._state = 'errored';
- stream._writableStreamController.__errorSteps();
- var storedError = stream._storedError;
- for (var i = 0; i < stream._writeRequests.length; i++) {
- var writeRequest = stream._writeRequests[i];
- writeRequest._reject(storedError);
- }
- stream._writeRequests = [];
- if (stream._pendingAbortRequest === undefined) {
- WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
- return;
- }
- var abortRequest = stream._pendingAbortRequest;
- stream._pendingAbortRequest = undefined;
- if (abortRequest._wasAlreadyErroring === true) {
- abortRequest._reject(storedError);
- WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
- return;
- }
- var promise = stream._writableStreamController.__abortSteps(abortRequest._reason);
- promise.then(function () {
- abortRequest._resolve();
- WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
- }, function (reason) {
- abortRequest._reject(reason);
- WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
- });
- }
- function WritableStreamFinishInFlightWrite(stream) {
- assert(stream._inFlightWriteRequest !== undefined);
- stream._inFlightWriteRequest._resolve(undefined);
- stream._inFlightWriteRequest = undefined;
- }
- function WritableStreamFinishInFlightWriteWithError(stream, error) {
- assert(stream._inFlightWriteRequest !== undefined);
- stream._inFlightWriteRequest._reject(error);
- stream._inFlightWriteRequest = undefined;
- assert(stream._state === 'writable' || stream._state === 'erroring');
- WritableStreamDealWithRejection(stream, error);
- }
- function WritableStreamFinishInFlightClose(stream) {
- assert(stream._inFlightCloseRequest !== undefined);
- stream._inFlightCloseRequest._resolve(undefined);
- stream._inFlightCloseRequest = undefined;
- var state = stream._state;
- assert(state === 'writable' || state === 'erroring');
- if (state === 'erroring') {
- stream._storedError = undefined;
- if (stream._pendingAbortRequest !== undefined) {
- stream._pendingAbortRequest._resolve();
- stream._pendingAbortRequest = undefined;
- }
- }
- stream._state = 'closed';
- var writer = stream._writer;
- if (writer !== undefined) {
- defaultWriterClosedPromiseResolve(writer);
- }
- assert(stream._pendingAbortRequest === undefined, 'stream._pendingAbortRequest === undefined');
- assert(stream._storedError === undefined, 'stream._storedError === undefined');
- }
- function WritableStreamFinishInFlightCloseWithError(stream, error) {
- assert(stream._inFlightCloseRequest !== undefined);
- stream._inFlightCloseRequest._reject(error);
- stream._inFlightCloseRequest = undefined;
- assert(stream._state === 'writable' || stream._state === 'erroring');
- if (stream._pendingAbortRequest !== undefined) {
- stream._pendingAbortRequest._reject(error);
- stream._pendingAbortRequest = undefined;
- }
- WritableStreamDealWithRejection(stream, error);
- }
- function WritableStreamCloseQueuedOrInFlight(stream) {
- if (stream._closeRequest === undefined && stream._inFlightCloseRequest === undefined) {
- return false;
- }
- return true;
- }
- function WritableStreamHasOperationMarkedInFlight(stream) {
- if (stream._inFlightWriteRequest === undefined && stream._inFlightCloseRequest === undefined) {
- return false;
- }
- return true;
- }
- function WritableStreamMarkCloseRequestInFlight(stream) {
- assert(stream._inFlightCloseRequest === undefined);
- assert(stream._closeRequest !== undefined);
- stream._inFlightCloseRequest = stream._closeRequest;
- stream._closeRequest = undefined;
- }
- function WritableStreamMarkFirstWriteRequestInFlight(stream) {
- assert(stream._inFlightWriteRequest === undefined, 'there must be no pending write request');
- assert(stream._writeRequests.length !== 0, 'writeRequests must not be empty');
- stream._inFlightWriteRequest = stream._writeRequests.shift();
- }
- function WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream) {
- assert(stream._state === 'errored', '_stream_.[[state]] is `"errored"`');
- if (stream._closeRequest !== undefined) {
- assert(stream._inFlightCloseRequest === undefined);
- stream._closeRequest._reject(stream._storedError);
- stream._closeRequest = undefined;
- }
- var writer = stream._writer;
- if (writer !== undefined) {
- defaultWriterClosedPromiseReject(writer, stream._storedError);
- writer._closedPromise.catch(function () {});
- }
- }
- function WritableStreamUpdateBackpressure(stream, backpressure) {
- assert(stream._state === 'writable');
- assert(WritableStreamCloseQueuedOrInFlight(stream) === false);
- var writer = stream._writer;
- if (writer !== undefined && backpressure !== stream._backpressure) {
- if (backpressure === true) {
- defaultWriterReadyPromiseReset(writer);
- } else {
- assert(backpressure === false);
- defaultWriterReadyPromiseResolve(writer);
- }
- }
- stream._backpressure = backpressure;
- }
- var WritableStreamDefaultWriter = function () {
- function WritableStreamDefaultWriter(stream) {
- _classCallCheck(this, WritableStreamDefaultWriter);
- if (IsWritableStream(stream) === false) {
- throw new TypeError('WritableStreamDefaultWriter can only be constructed with a WritableStream instance');
- }
- if (IsWritableStreamLocked(stream) === true) {
- throw new TypeError('This stream has already been locked for exclusive writing by another writer');
- }
- this._ownerWritableStream = stream;
- stream._writer = this;
- var state = stream._state;
- if (state === 'writable') {
- if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._backpressure === true) {
- defaultWriterReadyPromiseInitialize(this);
- } else {
- defaultWriterReadyPromiseInitializeAsResolved(this);
- }
- defaultWriterClosedPromiseInitialize(this);
- } else if (state === 'erroring') {
- defaultWriterReadyPromiseInitializeAsRejected(this, stream._storedError);
- this._readyPromise.catch(function () {});
- defaultWriterClosedPromiseInitialize(this);
- } else if (state === 'closed') {
- defaultWriterReadyPromiseInitializeAsResolved(this);
- defaultWriterClosedPromiseInitializeAsResolved(this);
- } else {
- assert(state === 'errored', 'state must be errored');
- var storedError = stream._storedError;
- defaultWriterReadyPromiseInitializeAsRejected(this, storedError);
- this._readyPromise.catch(function () {});
- defaultWriterClosedPromiseInitializeAsRejected(this, storedError);
- this._closedPromise.catch(function () {});
- }
- }
- _createClass(WritableStreamDefaultWriter, [{
- key: 'abort',
- value: function abort(reason) {
- if (IsWritableStreamDefaultWriter(this) === false) {
- return Promise.reject(defaultWriterBrandCheckException('abort'));
- }
- if (this._ownerWritableStream === undefined) {
- return Promise.reject(defaultWriterLockException('abort'));
- }
- return WritableStreamDefaultWriterAbort(this, reason);
- }
- }, {
- key: 'close',
- value: function close() {
- if (IsWritableStreamDefaultWriter(this) === false) {
- return Promise.reject(defaultWriterBrandCheckException('close'));
- }
- var stream = this._ownerWritableStream;
- if (stream === undefined) {
- return Promise.reject(defaultWriterLockException('close'));
- }
- if (WritableStreamCloseQueuedOrInFlight(stream) === true) {
- return Promise.reject(new TypeError('cannot close an already-closing stream'));
- }
- return WritableStreamDefaultWriterClose(this);
- }
- }, {
- key: 'releaseLock',
- value: function releaseLock() {
- if (IsWritableStreamDefaultWriter(this) === false) {
- throw defaultWriterBrandCheckException('releaseLock');
- }
- var stream = this._ownerWritableStream;
- if (stream === undefined) {
- return;
- }
- assert(stream._writer !== undefined);
- WritableStreamDefaultWriterRelease(this);
- }
- }, {
- key: 'write',
- value: function write(chunk) {
- if (IsWritableStreamDefaultWriter(this) === false) {
- return Promise.reject(defaultWriterBrandCheckException('write'));
- }
- if (this._ownerWritableStream === undefined) {
- return Promise.reject(defaultWriterLockException('write to'));
- }
- return WritableStreamDefaultWriterWrite(this, chunk);
- }
- }, {
- key: 'closed',
- get: function get() {
- if (IsWritableStreamDefaultWriter(this) === false) {
- return Promise.reject(defaultWriterBrandCheckException('closed'));
- }
- return this._closedPromise;
- }
- }, {
- key: 'desiredSize',
- get: function get() {
- if (IsWritableStreamDefaultWriter(this) === false) {
- throw defaultWriterBrandCheckException('desiredSize');
- }
- if (this._ownerWritableStream === undefined) {
- throw defaultWriterLockException('desiredSize');
- }
- return WritableStreamDefaultWriterGetDesiredSize(this);
- }
- }, {
- key: 'ready',
- get: function get() {
- if (IsWritableStreamDefaultWriter(this) === false) {
- return Promise.reject(defaultWriterBrandCheckException('ready'));
- }
- return this._readyPromise;
- }
- }]);
- return WritableStreamDefaultWriter;
- }();
- function IsWritableStreamDefaultWriter(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_ownerWritableStream')) {
- return false;
- }
- return true;
- }
- function WritableStreamDefaultWriterAbort(writer, reason) {
- var stream = writer._ownerWritableStream;
- assert(stream !== undefined);
- return WritableStreamAbort(stream, reason);
- }
- function WritableStreamDefaultWriterClose(writer) {
- var stream = writer._ownerWritableStream;
- assert(stream !== undefined);
- var state = stream._state;
- if (state === 'closed' || state === 'errored') {
- return Promise.reject(new TypeError('The stream (in ' + state + ' state) is not in the writable state and cannot be closed'));
- }
- assert(state === 'writable' || state === 'erroring');
- assert(WritableStreamCloseQueuedOrInFlight(stream) === false);
- var promise = new Promise(function (resolve, reject) {
- var closeRequest = {
- _resolve: resolve,
- _reject: reject
- };
- stream._closeRequest = closeRequest;
- });
- if (stream._backpressure === true && state === 'writable') {
- defaultWriterReadyPromiseResolve(writer);
- }
- WritableStreamDefaultControllerClose(stream._writableStreamController);
- return promise;
- }
- function WritableStreamDefaultWriterCloseWithErrorPropagation(writer) {
- var stream = writer._ownerWritableStream;
- assert(stream !== undefined);
- var state = stream._state;
- if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === 'closed') {
- return Promise.resolve();
- }
- if (state === 'errored') {
- return Promise.reject(stream._storedError);
- }
- assert(state === 'writable' || state === 'erroring');
- return WritableStreamDefaultWriterClose(writer);
- }
- function WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, error) {
- if (writer._closedPromiseState === 'pending') {
- defaultWriterClosedPromiseReject(writer, error);
- } else {
- defaultWriterClosedPromiseResetToRejected(writer, error);
- }
- writer._closedPromise.catch(function () {});
- }
- function WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, error) {
- if (writer._readyPromiseState === 'pending') {
- defaultWriterReadyPromiseReject(writer, error);
- } else {
- defaultWriterReadyPromiseResetToRejected(writer, error);
- }
- writer._readyPromise.catch(function () {});
- }
- function WritableStreamDefaultWriterGetDesiredSize(writer) {
- var stream = writer._ownerWritableStream;
- var state = stream._state;
- if (state === 'errored' || state === 'erroring') {
- return null;
- }
- if (state === 'closed') {
- return 0;
- }
- return WritableStreamDefaultControllerGetDesiredSize(stream._writableStreamController);
- }
- function WritableStreamDefaultWriterRelease(writer) {
- var stream = writer._ownerWritableStream;
- assert(stream !== undefined);
- assert(stream._writer === writer);
- var releasedError = new TypeError('Writer was released and can no longer be used to monitor the stream\'s closedness');
- WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, releasedError);
- WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, releasedError);
- stream._writer = undefined;
- writer._ownerWritableStream = undefined;
- }
- function WritableStreamDefaultWriterWrite(writer, chunk) {
- var stream = writer._ownerWritableStream;
- assert(stream !== undefined);
- var controller = stream._writableStreamController;
- var chunkSize = WritableStreamDefaultControllerGetChunkSize(controller, chunk);
- if (stream !== writer._ownerWritableStream) {
- return Promise.reject(defaultWriterLockException('write to'));
- }
- var state = stream._state;
- if (state === 'errored') {
- return Promise.reject(stream._storedError);
- }
- if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === 'closed') {
- return Promise.reject(new TypeError('The stream is closing or closed and cannot be written to'));
- }
- if (state === 'erroring') {
- return Promise.reject(stream._storedError);
- }
- assert(state === 'writable');
- var promise = WritableStreamAddWriteRequest(stream);
- WritableStreamDefaultControllerWrite(controller, chunk, chunkSize);
- return promise;
- }
- var WritableStreamDefaultController = function () {
- function WritableStreamDefaultController(stream, underlyingSink, size, highWaterMark) {
- _classCallCheck(this, WritableStreamDefaultController);
- if (IsWritableStream(stream) === false) {
- throw new TypeError('WritableStreamDefaultController can only be constructed with a WritableStream instance');
- }
- if (stream._writableStreamController !== undefined) {
- throw new TypeError('WritableStreamDefaultController instances can only be created by the WritableStream constructor');
- }
- this._controlledWritableStream = stream;
- this._underlyingSink = underlyingSink;
- this._queue = undefined;
- this._queueTotalSize = undefined;
- ResetQueue(this);
- this._started = false;
- var normalizedStrategy = ValidateAndNormalizeQueuingStrategy(size, highWaterMark);
- this._strategySize = normalizedStrategy.size;
- this._strategyHWM = normalizedStrategy.highWaterMark;
- var backpressure = WritableStreamDefaultControllerGetBackpressure(this);
- WritableStreamUpdateBackpressure(stream, backpressure);
- }
- _createClass(WritableStreamDefaultController, [{
- key: 'error',
- value: function error(e) {
- if (IsWritableStreamDefaultController(this) === false) {
- throw new TypeError('WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController');
- }
- var state = this._controlledWritableStream._state;
- if (state !== 'writable') {
- return;
- }
- WritableStreamDefaultControllerError(this, e);
- }
- }, {
- key: '__abortSteps',
- value: function __abortSteps(reason) {
- return PromiseInvokeOrNoop(this._underlyingSink, 'abort', [reason]);
- }
- }, {
- key: '__errorSteps',
- value: function __errorSteps() {
- ResetQueue(this);
- }
- }, {
- key: '__startSteps',
- value: function __startSteps() {
- var _this = this;
- var startResult = InvokeOrNoop(this._underlyingSink, 'start', [this]);
- var stream = this._controlledWritableStream;
- Promise.resolve(startResult).then(function () {
- assert(stream._state === 'writable' || stream._state === 'erroring');
- _this._started = true;
- WritableStreamDefaultControllerAdvanceQueueIfNeeded(_this);
- }, function (r) {
- assert(stream._state === 'writable' || stream._state === 'erroring');
- _this._started = true;
- WritableStreamDealWithRejection(stream, r);
- }).catch(rethrowAssertionErrorRejection);
- }
- }]);
- return WritableStreamDefaultController;
- }();
- function WritableStreamDefaultControllerClose(controller) {
- EnqueueValueWithSize(controller, 'close', 0);
- WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
- }
- function WritableStreamDefaultControllerGetChunkSize(controller, chunk) {
- var strategySize = controller._strategySize;
- if (strategySize === undefined) {
- return 1;
- }
- try {
- return strategySize(chunk);
- } catch (chunkSizeE) {
- WritableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE);
- return 1;
- }
- }
- function WritableStreamDefaultControllerGetDesiredSize(controller) {
- return controller._strategyHWM - controller._queueTotalSize;
- }
- function WritableStreamDefaultControllerWrite(controller, chunk, chunkSize) {
- var writeRecord = { chunk: chunk };
- try {
- EnqueueValueWithSize(controller, writeRecord, chunkSize);
- } catch (enqueueE) {
- WritableStreamDefaultControllerErrorIfNeeded(controller, enqueueE);
- return;
- }
- var stream = controller._controlledWritableStream;
- if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._state === 'writable') {
- var backpressure = WritableStreamDefaultControllerGetBackpressure(controller);
- WritableStreamUpdateBackpressure(stream, backpressure);
- }
- WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
- }
- function IsWritableStreamDefaultController(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_underlyingSink')) {
- return false;
- }
- return true;
- }
- function WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller) {
- var stream = controller._controlledWritableStream;
- if (controller._started === false) {
- return;
- }
- if (stream._inFlightWriteRequest !== undefined) {
- return;
- }
- var state = stream._state;
- if (state === 'closed' || state === 'errored') {
- return;
- }
- if (state === 'erroring') {
- WritableStreamFinishErroring(stream);
- return;
- }
- if (controller._queue.length === 0) {
- return;
- }
- var writeRecord = PeekQueueValue(controller);
- if (writeRecord === 'close') {
- WritableStreamDefaultControllerProcessClose(controller);
- } else {
- WritableStreamDefaultControllerProcessWrite(controller, writeRecord.chunk);
- }
- }
- function WritableStreamDefaultControllerErrorIfNeeded(controller, error) {
- if (controller._controlledWritableStream._state === 'writable') {
- WritableStreamDefaultControllerError(controller, error);
- }
- }
- function WritableStreamDefaultControllerProcessClose(controller) {
- var stream = controller._controlledWritableStream;
- WritableStreamMarkCloseRequestInFlight(stream);
- DequeueValue(controller);
- assert(controller._queue.length === 0, 'queue must be empty once the final write record is dequeued');
- var sinkClosePromise = PromiseInvokeOrNoop(controller._underlyingSink, 'close', []);
- sinkClosePromise.then(function () {
- WritableStreamFinishInFlightClose(stream);
- }, function (reason) {
- WritableStreamFinishInFlightCloseWithError(stream, reason);
- }).catch(rethrowAssertionErrorRejection);
- }
- function WritableStreamDefaultControllerProcessWrite(controller, chunk) {
- var stream = controller._controlledWritableStream;
- WritableStreamMarkFirstWriteRequestInFlight(stream);
- var sinkWritePromise = PromiseInvokeOrNoop(controller._underlyingSink, 'write', [chunk, controller]);
- sinkWritePromise.then(function () {
- WritableStreamFinishInFlightWrite(stream);
- var state = stream._state;
- assert(state === 'writable' || state === 'erroring');
- DequeueValue(controller);
- if (WritableStreamCloseQueuedOrInFlight(stream) === false && state === 'writable') {
- var backpressure = WritableStreamDefaultControllerGetBackpressure(controller);
- WritableStreamUpdateBackpressure(stream, backpressure);
- }
- WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
- }, function (reason) {
- WritableStreamFinishInFlightWriteWithError(stream, reason);
- }).catch(rethrowAssertionErrorRejection);
- }
- function WritableStreamDefaultControllerGetBackpressure(controller) {
- var desiredSize = WritableStreamDefaultControllerGetDesiredSize(controller);
- return desiredSize <= 0;
- }
- function WritableStreamDefaultControllerError(controller, error) {
- var stream = controller._controlledWritableStream;
- assert(stream._state === 'writable');
- WritableStreamStartErroring(stream, error);
- }
- function streamBrandCheckException(name) {
- return new TypeError('WritableStream.prototype.' + name + ' can only be used on a WritableStream');
- }
- function defaultWriterBrandCheckException(name) {
- return new TypeError('WritableStreamDefaultWriter.prototype.' + name + ' can only be used on a WritableStreamDefaultWriter');
- }
- function defaultWriterLockException(name) {
- return new TypeError('Cannot ' + name + ' a stream using a released writer');
- }
- function defaultWriterClosedPromiseInitialize(writer) {
- writer._closedPromise = new Promise(function (resolve, reject) {
- writer._closedPromise_resolve = resolve;
- writer._closedPromise_reject = reject;
- writer._closedPromiseState = 'pending';
- });
- }
- function defaultWriterClosedPromiseInitializeAsRejected(writer, reason) {
- writer._closedPromise = Promise.reject(reason);
- writer._closedPromise_resolve = undefined;
- writer._closedPromise_reject = undefined;
- writer._closedPromiseState = 'rejected';
- }
- function defaultWriterClosedPromiseInitializeAsResolved(writer) {
- writer._closedPromise = Promise.resolve(undefined);
- writer._closedPromise_resolve = undefined;
- writer._closedPromise_reject = undefined;
- writer._closedPromiseState = 'resolved';
- }
- function defaultWriterClosedPromiseReject(writer, reason) {
- assert(writer._closedPromise_resolve !== undefined, 'writer._closedPromise_resolve !== undefined');
- assert(writer._closedPromise_reject !== undefined, 'writer._closedPromise_reject !== undefined');
- assert(writer._closedPromiseState === 'pending', 'writer._closedPromiseState is pending');
- writer._closedPromise_reject(reason);
- writer._closedPromise_resolve = undefined;
- writer._closedPromise_reject = undefined;
- writer._closedPromiseState = 'rejected';
- }
- function defaultWriterClosedPromiseResetToRejected(writer, reason) {
- assert(writer._closedPromise_resolve === undefined, 'writer._closedPromise_resolve === undefined');
- assert(writer._closedPromise_reject === undefined, 'writer._closedPromise_reject === undefined');
- assert(writer._closedPromiseState !== 'pending', 'writer._closedPromiseState is not pending');
- writer._closedPromise = Promise.reject(reason);
- writer._closedPromiseState = 'rejected';
- }
- function defaultWriterClosedPromiseResolve(writer) {
- assert(writer._closedPromise_resolve !== undefined, 'writer._closedPromise_resolve !== undefined');
- assert(writer._closedPromise_reject !== undefined, 'writer._closedPromise_reject !== undefined');
- assert(writer._closedPromiseState === 'pending', 'writer._closedPromiseState is pending');
- writer._closedPromise_resolve(undefined);
- writer._closedPromise_resolve = undefined;
- writer._closedPromise_reject = undefined;
- writer._closedPromiseState = 'resolved';
- }
- function defaultWriterReadyPromiseInitialize(writer) {
- writer._readyPromise = new Promise(function (resolve, reject) {
- writer._readyPromise_resolve = resolve;
- writer._readyPromise_reject = reject;
- });
- writer._readyPromiseState = 'pending';
- }
- function defaultWriterReadyPromiseInitializeAsRejected(writer, reason) {
- writer._readyPromise = Promise.reject(reason);
- writer._readyPromise_resolve = undefined;
- writer._readyPromise_reject = undefined;
- writer._readyPromiseState = 'rejected';
- }
- function defaultWriterReadyPromiseInitializeAsResolved(writer) {
- writer._readyPromise = Promise.resolve(undefined);
- writer._readyPromise_resolve = undefined;
- writer._readyPromise_reject = undefined;
- writer._readyPromiseState = 'fulfilled';
- }
- function defaultWriterReadyPromiseReject(writer, reason) {
- assert(writer._readyPromise_resolve !== undefined, 'writer._readyPromise_resolve !== undefined');
- assert(writer._readyPromise_reject !== undefined, 'writer._readyPromise_reject !== undefined');
- writer._readyPromise_reject(reason);
- writer._readyPromise_resolve = undefined;
- writer._readyPromise_reject = undefined;
- writer._readyPromiseState = 'rejected';
- }
- function defaultWriterReadyPromiseReset(writer) {
- assert(writer._readyPromise_resolve === undefined, 'writer._readyPromise_resolve === undefined');
- assert(writer._readyPromise_reject === undefined, 'writer._readyPromise_reject === undefined');
- writer._readyPromise = new Promise(function (resolve, reject) {
- writer._readyPromise_resolve = resolve;
- writer._readyPromise_reject = reject;
- });
- writer._readyPromiseState = 'pending';
- }
- function defaultWriterReadyPromiseResetToRejected(writer, reason) {
- assert(writer._readyPromise_resolve === undefined, 'writer._readyPromise_resolve === undefined');
- assert(writer._readyPromise_reject === undefined, 'writer._readyPromise_reject === undefined');
- writer._readyPromise = Promise.reject(reason);
- writer._readyPromiseState = 'rejected';
- }
- function defaultWriterReadyPromiseResolve(writer) {
- assert(writer._readyPromise_resolve !== undefined, 'writer._readyPromise_resolve !== undefined');
- assert(writer._readyPromise_reject !== undefined, 'writer._readyPromise_reject !== undefined');
- writer._readyPromise_resolve(undefined);
- writer._readyPromise_resolve = undefined;
- writer._readyPromise_reject = undefined;
- writer._readyPromiseState = 'fulfilled';
- }
-}, function (module, exports, __w_pdfjs_require__) {
- "use strict";
-
- var _require = __w_pdfjs_require__(0),
- IsFiniteNonNegativeNumber = _require.IsFiniteNonNegativeNumber;
- var _require2 = __w_pdfjs_require__(1),
- assert = _require2.assert;
- exports.DequeueValue = function (container) {
- assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: DequeueValue should only be used on containers with [[queue]] and [[queueTotalSize]].');
- assert(container._queue.length > 0, 'Spec-level failure: should never dequeue from an empty queue.');
- var pair = container._queue.shift();
- container._queueTotalSize -= pair.size;
- if (container._queueTotalSize < 0) {
- container._queueTotalSize = 0;
- }
- return pair.value;
- };
- exports.EnqueueValueWithSize = function (container, value, size) {
- assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: EnqueueValueWithSize should only be used on containers with [[queue]] and ' + '[[queueTotalSize]].');
- size = Number(size);
- if (!IsFiniteNonNegativeNumber(size)) {
- throw new RangeError('Size must be a finite, non-NaN, non-negative number.');
- }
- container._queue.push({
- value: value,
- size: size
- });
- container._queueTotalSize += size;
- };
- exports.PeekQueueValue = function (container) {
- assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: PeekQueueValue should only be used on containers with [[queue]] and [[queueTotalSize]].');
- assert(container._queue.length > 0, 'Spec-level failure: should never peek at an empty queue.');
- var pair = container._queue[0];
- return pair.value;
- };
- exports.ResetQueue = function (container) {
- assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: ResetQueue should only be used on containers with [[queue]] and [[queueTotalSize]].');
- container._queue = [];
- container._queueTotalSize = 0;
- };
-}, function (module, exports, __w_pdfjs_require__) {
- "use strict";
-
- var _createClass = 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);
- }
- }
- return function (Constructor, protoProps, staticProps) {
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
- if (staticProps) defineProperties(Constructor, staticProps);
- return Constructor;
- };
- }();
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- var _require = __w_pdfjs_require__(0),
- ArrayBufferCopy = _require.ArrayBufferCopy,
- CreateIterResultObject = _require.CreateIterResultObject,
- IsFiniteNonNegativeNumber = _require.IsFiniteNonNegativeNumber,
- InvokeOrNoop = _require.InvokeOrNoop,
- PromiseInvokeOrNoop = _require.PromiseInvokeOrNoop,
- TransferArrayBuffer = _require.TransferArrayBuffer,
- ValidateAndNormalizeQueuingStrategy = _require.ValidateAndNormalizeQueuingStrategy,
- ValidateAndNormalizeHighWaterMark = _require.ValidateAndNormalizeHighWaterMark;
- var _require2 = __w_pdfjs_require__(0),
- createArrayFromList = _require2.createArrayFromList,
- createDataProperty = _require2.createDataProperty,
- typeIsObject = _require2.typeIsObject;
- var _require3 = __w_pdfjs_require__(1),
- assert = _require3.assert,
- rethrowAssertionErrorRejection = _require3.rethrowAssertionErrorRejection;
- var _require4 = __w_pdfjs_require__(3),
- DequeueValue = _require4.DequeueValue,
- EnqueueValueWithSize = _require4.EnqueueValueWithSize,
- ResetQueue = _require4.ResetQueue;
- var _require5 = __w_pdfjs_require__(2),
- AcquireWritableStreamDefaultWriter = _require5.AcquireWritableStreamDefaultWriter,
- IsWritableStream = _require5.IsWritableStream,
- IsWritableStreamLocked = _require5.IsWritableStreamLocked,
- WritableStreamAbort = _require5.WritableStreamAbort,
- WritableStreamDefaultWriterCloseWithErrorPropagation = _require5.WritableStreamDefaultWriterCloseWithErrorPropagation,
- WritableStreamDefaultWriterRelease = _require5.WritableStreamDefaultWriterRelease,
- WritableStreamDefaultWriterWrite = _require5.WritableStreamDefaultWriterWrite,
- WritableStreamCloseQueuedOrInFlight = _require5.WritableStreamCloseQueuedOrInFlight;
- var ReadableStream = function () {
- function ReadableStream() {
- var underlyingSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- size = _ref.size,
- highWaterMark = _ref.highWaterMark;
- _classCallCheck(this, ReadableStream);
- this._state = 'readable';
- this._reader = undefined;
- this._storedError = undefined;
- this._disturbed = false;
- this._readableStreamController = undefined;
- var type = underlyingSource.type;
- var typeString = String(type);
- if (typeString === 'bytes') {
- if (highWaterMark === undefined) {
- highWaterMark = 0;
- }
- this._readableStreamController = new ReadableByteStreamController(this, underlyingSource, highWaterMark);
- } else if (type === undefined) {
- if (highWaterMark === undefined) {
- highWaterMark = 1;
- }
- this._readableStreamController = new ReadableStreamDefaultController(this, underlyingSource, size, highWaterMark);
- } else {
- throw new RangeError('Invalid type is specified');
- }
- }
- _createClass(ReadableStream, [{
- key: 'cancel',
- value: function cancel(reason) {
- if (IsReadableStream(this) === false) {
- return Promise.reject(streamBrandCheckException('cancel'));
- }
- if (IsReadableStreamLocked(this) === true) {
- return Promise.reject(new TypeError('Cannot cancel a stream that already has a reader'));
- }
- return ReadableStreamCancel(this, reason);
- }
- }, {
- key: 'getReader',
- value: function getReader() {
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- mode = _ref2.mode;
- if (IsReadableStream(this) === false) {
- throw streamBrandCheckException('getReader');
- }
- if (mode === undefined) {
- return AcquireReadableStreamDefaultReader(this);
- }
- mode = String(mode);
- if (mode === 'byob') {
- return AcquireReadableStreamBYOBReader(this);
- }
- throw new RangeError('Invalid mode is specified');
- }
- }, {
- key: 'pipeThrough',
- value: function pipeThrough(_ref3, options) {
- var writable = _ref3.writable,
- readable = _ref3.readable;
- var promise = this.pipeTo(writable, options);
- ifIsObjectAndHasAPromiseIsHandledInternalSlotSetPromiseIsHandledToTrue(promise);
- return readable;
- }
- }, {
- key: 'pipeTo',
- value: function pipeTo(dest) {
- var _this = this;
- var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- preventClose = _ref4.preventClose,
- preventAbort = _ref4.preventAbort,
- preventCancel = _ref4.preventCancel;
- if (IsReadableStream(this) === false) {
- return Promise.reject(streamBrandCheckException('pipeTo'));
- }
- if (IsWritableStream(dest) === false) {
- return Promise.reject(new TypeError('ReadableStream.prototype.pipeTo\'s first argument must be a WritableStream'));
- }
- preventClose = Boolean(preventClose);
- preventAbort = Boolean(preventAbort);
- preventCancel = Boolean(preventCancel);
- if (IsReadableStreamLocked(this) === true) {
- return Promise.reject(new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream'));
- }
- if (IsWritableStreamLocked(dest) === true) {
- return Promise.reject(new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream'));
- }
- var reader = AcquireReadableStreamDefaultReader(this);
- var writer = AcquireWritableStreamDefaultWriter(dest);
- var shuttingDown = false;
- var currentWrite = Promise.resolve();
- return new Promise(function (resolve, reject) {
- function pipeLoop() {
- currentWrite = Promise.resolve();
- if (shuttingDown === true) {
- return Promise.resolve();
- }
- return writer._readyPromise.then(function () {
- return ReadableStreamDefaultReaderRead(reader).then(function (_ref5) {
- var value = _ref5.value,
- done = _ref5.done;
- if (done === true) {
- return;
- }
- currentWrite = WritableStreamDefaultWriterWrite(writer, value).catch(function () {});
- });
- }).then(pipeLoop);
- }
- isOrBecomesErrored(_this, reader._closedPromise, function (storedError) {
- if (preventAbort === false) {
- shutdownWithAction(function () {
- return WritableStreamAbort(dest, storedError);
- }, true, storedError);
- } else {
- shutdown(true, storedError);
- }
- });
- isOrBecomesErrored(dest, writer._closedPromise, function (storedError) {
- if (preventCancel === false) {
- shutdownWithAction(function () {
- return ReadableStreamCancel(_this, storedError);
- }, true, storedError);
- } else {
- shutdown(true, storedError);
- }
- });
- isOrBecomesClosed(_this, reader._closedPromise, function () {
- if (preventClose === false) {
- shutdownWithAction(function () {
- return WritableStreamDefaultWriterCloseWithErrorPropagation(writer);
- });
- } else {
- shutdown();
- }
- });
- if (WritableStreamCloseQueuedOrInFlight(dest) === true || dest._state === 'closed') {
- var destClosed = new TypeError('the destination writable stream closed before all data could be piped to it');
- if (preventCancel === false) {
- shutdownWithAction(function () {
- return ReadableStreamCancel(_this, destClosed);
- }, true, destClosed);
- } else {
- shutdown(true, destClosed);
- }
- }
- pipeLoop().catch(function (err) {
- currentWrite = Promise.resolve();
- rethrowAssertionErrorRejection(err);
- });
- function waitForWritesToFinish() {
- var oldCurrentWrite = currentWrite;
- return currentWrite.then(function () {
- return oldCurrentWrite !== currentWrite ? waitForWritesToFinish() : undefined;
- });
- }
- function isOrBecomesErrored(stream, promise, action) {
- if (stream._state === 'errored') {
- action(stream._storedError);
- } else {
- promise.catch(action).catch(rethrowAssertionErrorRejection);
- }
- }
- function isOrBecomesClosed(stream, promise, action) {
- if (stream._state === 'closed') {
- action();
- } else {
- promise.then(action).catch(rethrowAssertionErrorRejection);
- }
- }
- function shutdownWithAction(action, originalIsError, originalError) {
- if (shuttingDown === true) {
- return;
- }
- shuttingDown = true;
- if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) {
- waitForWritesToFinish().then(doTheRest);
- } else {
- doTheRest();
- }
- function doTheRest() {
- action().then(function () {
- return finalize(originalIsError, originalError);
- }, function (newError) {
- return finalize(true, newError);
- }).catch(rethrowAssertionErrorRejection);
- }
- }
- function shutdown(isError, error) {
- if (shuttingDown === true) {
- return;
- }
- shuttingDown = true;
- if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) {
- waitForWritesToFinish().then(function () {
- return finalize(isError, error);
- }).catch(rethrowAssertionErrorRejection);
- } else {
- finalize(isError, error);
- }
- }
- function finalize(isError, error) {
- WritableStreamDefaultWriterRelease(writer);
- ReadableStreamReaderGenericRelease(reader);
- if (isError) {
- reject(error);
- } else {
- resolve(undefined);
- }
- }
- });
- }
- }, {
- key: 'tee',
- value: function tee() {
- if (IsReadableStream(this) === false) {
- throw streamBrandCheckException('tee');
- }
- var branches = ReadableStreamTee(this, false);
- return createArrayFromList(branches);
- }
- }, {
- key: 'locked',
- get: function get() {
- if (IsReadableStream(this) === false) {
- throw streamBrandCheckException('locked');
- }
- return IsReadableStreamLocked(this);
- }
- }]);
- return ReadableStream;
- }();
- module.exports = {
- ReadableStream: ReadableStream,
- IsReadableStreamDisturbed: IsReadableStreamDisturbed,
- ReadableStreamDefaultControllerClose: ReadableStreamDefaultControllerClose,
- ReadableStreamDefaultControllerEnqueue: ReadableStreamDefaultControllerEnqueue,
- ReadableStreamDefaultControllerError: ReadableStreamDefaultControllerError,
- ReadableStreamDefaultControllerGetDesiredSize: ReadableStreamDefaultControllerGetDesiredSize
- };
- function AcquireReadableStreamBYOBReader(stream) {
- return new ReadableStreamBYOBReader(stream);
- }
- function AcquireReadableStreamDefaultReader(stream) {
- return new ReadableStreamDefaultReader(stream);
- }
- function IsReadableStream(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_readableStreamController')) {
- return false;
- }
- return true;
- }
- function IsReadableStreamDisturbed(stream) {
- assert(IsReadableStream(stream) === true, 'IsReadableStreamDisturbed should only be used on known readable streams');
- return stream._disturbed;
- }
- function IsReadableStreamLocked(stream) {
- assert(IsReadableStream(stream) === true, 'IsReadableStreamLocked should only be used on known readable streams');
- if (stream._reader === undefined) {
- return false;
- }
- return true;
- }
- function ReadableStreamTee(stream, cloneForBranch2) {
- assert(IsReadableStream(stream) === true);
- assert(typeof cloneForBranch2 === 'boolean');
- var reader = AcquireReadableStreamDefaultReader(stream);
- var teeState = {
- closedOrErrored: false,
- canceled1: false,
- canceled2: false,
- reason1: undefined,
- reason2: undefined
- };
- teeState.promise = new Promise(function (resolve) {
- teeState._resolve = resolve;
- });
- var pull = create_ReadableStreamTeePullFunction();
- pull._reader = reader;
- pull._teeState = teeState;
- pull._cloneForBranch2 = cloneForBranch2;
- var cancel1 = create_ReadableStreamTeeBranch1CancelFunction();
- cancel1._stream = stream;
- cancel1._teeState = teeState;
- var cancel2 = create_ReadableStreamTeeBranch2CancelFunction();
- cancel2._stream = stream;
- cancel2._teeState = teeState;
- var underlyingSource1 = Object.create(Object.prototype);
- createDataProperty(underlyingSource1, 'pull', pull);
- createDataProperty(underlyingSource1, 'cancel', cancel1);
- var branch1Stream = new ReadableStream(underlyingSource1);
- var underlyingSource2 = Object.create(Object.prototype);
- createDataProperty(underlyingSource2, 'pull', pull);
- createDataProperty(underlyingSource2, 'cancel', cancel2);
- var branch2Stream = new ReadableStream(underlyingSource2);
- pull._branch1 = branch1Stream._readableStreamController;
- pull._branch2 = branch2Stream._readableStreamController;
- reader._closedPromise.catch(function (r) {
- if (teeState.closedOrErrored === true) {
- return;
- }
- ReadableStreamDefaultControllerError(pull._branch1, r);
- ReadableStreamDefaultControllerError(pull._branch2, r);
- teeState.closedOrErrored = true;
- });
- return [branch1Stream, branch2Stream];
- }
- function create_ReadableStreamTeePullFunction() {
- function f() {
- var reader = f._reader,
- branch1 = f._branch1,
- branch2 = f._branch2,
- teeState = f._teeState;
- return ReadableStreamDefaultReaderRead(reader).then(function (result) {
- assert(typeIsObject(result));
- var value = result.value;
- var done = result.done;
- assert(typeof done === 'boolean');
- if (done === true && teeState.closedOrErrored === false) {
- if (teeState.canceled1 === false) {
- ReadableStreamDefaultControllerClose(branch1);
- }
- if (teeState.canceled2 === false) {
- ReadableStreamDefaultControllerClose(branch2);
- }
- teeState.closedOrErrored = true;
- }
- if (teeState.closedOrErrored === true) {
- return;
- }
- var value1 = value;
- var value2 = value;
- if (teeState.canceled1 === false) {
- ReadableStreamDefaultControllerEnqueue(branch1, value1);
- }
- if (teeState.canceled2 === false) {
- ReadableStreamDefaultControllerEnqueue(branch2, value2);
- }
- });
- }
- return f;
- }
- function create_ReadableStreamTeeBranch1CancelFunction() {
- function f(reason) {
- var stream = f._stream,
- teeState = f._teeState;
- teeState.canceled1 = true;
- teeState.reason1 = reason;
- if (teeState.canceled2 === true) {
- var compositeReason = createArrayFromList([teeState.reason1, teeState.reason2]);
- var cancelResult = ReadableStreamCancel(stream, compositeReason);
- teeState._resolve(cancelResult);
- }
- return teeState.promise;
- }
- return f;
- }
- function create_ReadableStreamTeeBranch2CancelFunction() {
- function f(reason) {
- var stream = f._stream,
- teeState = f._teeState;
- teeState.canceled2 = true;
- teeState.reason2 = reason;
- if (teeState.canceled1 === true) {
- var compositeReason = createArrayFromList([teeState.reason1, teeState.reason2]);
- var cancelResult = ReadableStreamCancel(stream, compositeReason);
- teeState._resolve(cancelResult);
- }
- return teeState.promise;
- }
- return f;
- }
- function ReadableStreamAddReadIntoRequest(stream) {
- assert(IsReadableStreamBYOBReader(stream._reader) === true);
- assert(stream._state === 'readable' || stream._state === 'closed');
- var promise = new Promise(function (resolve, reject) {
- var readIntoRequest = {
- _resolve: resolve,
- _reject: reject
- };
- stream._reader._readIntoRequests.push(readIntoRequest);
- });
- return promise;
- }
- function ReadableStreamAddReadRequest(stream) {
- assert(IsReadableStreamDefaultReader(stream._reader) === true);
- assert(stream._state === 'readable');
- var promise = new Promise(function (resolve, reject) {
- var readRequest = {
- _resolve: resolve,
- _reject: reject
- };
- stream._reader._readRequests.push(readRequest);
- });
- return promise;
- }
- function ReadableStreamCancel(stream, reason) {
- stream._disturbed = true;
- if (stream._state === 'closed') {
- return Promise.resolve(undefined);
- }
- if (stream._state === 'errored') {
- return Promise.reject(stream._storedError);
- }
- ReadableStreamClose(stream);
- var sourceCancelPromise = stream._readableStreamController.__cancelSteps(reason);
- return sourceCancelPromise.then(function () {
- return undefined;
- });
- }
- function ReadableStreamClose(stream) {
- assert(stream._state === 'readable');
- stream._state = 'closed';
- var reader = stream._reader;
- if (reader === undefined) {
- return undefined;
- }
- if (IsReadableStreamDefaultReader(reader) === true) {
- for (var i = 0; i < reader._readRequests.length; i++) {
- var _resolve = reader._readRequests[i]._resolve;
- _resolve(CreateIterResultObject(undefined, true));
- }
- reader._readRequests = [];
- }
- defaultReaderClosedPromiseResolve(reader);
- return undefined;
- }
- function ReadableStreamError(stream, e) {
- assert(IsReadableStream(stream) === true, 'stream must be ReadableStream');
- assert(stream._state === 'readable', 'state must be readable');
- stream._state = 'errored';
- stream._storedError = e;
- var reader = stream._reader;
- if (reader === undefined) {
- return undefined;
- }
- if (IsReadableStreamDefaultReader(reader) === true) {
- for (var i = 0; i < reader._readRequests.length; i++) {
- var readRequest = reader._readRequests[i];
- readRequest._reject(e);
- }
- reader._readRequests = [];
- } else {
- assert(IsReadableStreamBYOBReader(reader), 'reader must be ReadableStreamBYOBReader');
- for (var _i = 0; _i < reader._readIntoRequests.length; _i++) {
- var readIntoRequest = reader._readIntoRequests[_i];
- readIntoRequest._reject(e);
- }
- reader._readIntoRequests = [];
- }
- defaultReaderClosedPromiseReject(reader, e);
- reader._closedPromise.catch(function () {});
- }
- function ReadableStreamFulfillReadIntoRequest(stream, chunk, done) {
- var reader = stream._reader;
- assert(reader._readIntoRequests.length > 0);
- var readIntoRequest = reader._readIntoRequests.shift();
- readIntoRequest._resolve(CreateIterResultObject(chunk, done));
- }
- function ReadableStreamFulfillReadRequest(stream, chunk, done) {
- var reader = stream._reader;
- assert(reader._readRequests.length > 0);
- var readRequest = reader._readRequests.shift();
- readRequest._resolve(CreateIterResultObject(chunk, done));
- }
- function ReadableStreamGetNumReadIntoRequests(stream) {
- return stream._reader._readIntoRequests.length;
- }
- function ReadableStreamGetNumReadRequests(stream) {
- return stream._reader._readRequests.length;
- }
- function ReadableStreamHasBYOBReader(stream) {
- var reader = stream._reader;
- if (reader === undefined) {
- return false;
- }
- if (IsReadableStreamBYOBReader(reader) === false) {
- return false;
- }
- return true;
- }
- function ReadableStreamHasDefaultReader(stream) {
- var reader = stream._reader;
- if (reader === undefined) {
- return false;
- }
- if (IsReadableStreamDefaultReader(reader) === false) {
- return false;
- }
- return true;
- }
- var ReadableStreamDefaultReader = function () {
- function ReadableStreamDefaultReader(stream) {
- _classCallCheck(this, ReadableStreamDefaultReader);
- if (IsReadableStream(stream) === false) {
- throw new TypeError('ReadableStreamDefaultReader can only be constructed with a ReadableStream instance');
- }
- if (IsReadableStreamLocked(stream) === true) {
- throw new TypeError('This stream has already been locked for exclusive reading by another reader');
- }
- ReadableStreamReaderGenericInitialize(this, stream);
- this._readRequests = [];
- }
- _createClass(ReadableStreamDefaultReader, [{
- key: 'cancel',
- value: function cancel(reason) {
- if (IsReadableStreamDefaultReader(this) === false) {
- return Promise.reject(defaultReaderBrandCheckException('cancel'));
- }
- if (this._ownerReadableStream === undefined) {
- return Promise.reject(readerLockException('cancel'));
- }
- return ReadableStreamReaderGenericCancel(this, reason);
- }
- }, {
- key: 'read',
- value: function read() {
- if (IsReadableStreamDefaultReader(this) === false) {
- return Promise.reject(defaultReaderBrandCheckException('read'));
- }
- if (this._ownerReadableStream === undefined) {
- return Promise.reject(readerLockException('read from'));
- }
- return ReadableStreamDefaultReaderRead(this);
- }
- }, {
- key: 'releaseLock',
- value: function releaseLock() {
- if (IsReadableStreamDefaultReader(this) === false) {
- throw defaultReaderBrandCheckException('releaseLock');
- }
- if (this._ownerReadableStream === undefined) {
- return;
- }
- if (this._readRequests.length > 0) {
- throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled');
- }
- ReadableStreamReaderGenericRelease(this);
- }
- }, {
- key: 'closed',
- get: function get() {
- if (IsReadableStreamDefaultReader(this) === false) {
- return Promise.reject(defaultReaderBrandCheckException('closed'));
- }
- return this._closedPromise;
- }
- }]);
- return ReadableStreamDefaultReader;
- }();
- var ReadableStreamBYOBReader = function () {
- function ReadableStreamBYOBReader(stream) {
- _classCallCheck(this, ReadableStreamBYOBReader);
- if (!IsReadableStream(stream)) {
- throw new TypeError('ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a ' + 'byte source');
- }
- if (IsReadableByteStreamController(stream._readableStreamController) === false) {
- throw new TypeError('Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte ' + 'source');
- }
- if (IsReadableStreamLocked(stream)) {
- throw new TypeError('This stream has already been locked for exclusive reading by another reader');
- }
- ReadableStreamReaderGenericInitialize(this, stream);
- this._readIntoRequests = [];
- }
- _createClass(ReadableStreamBYOBReader, [{
- key: 'cancel',
- value: function cancel(reason) {
- if (!IsReadableStreamBYOBReader(this)) {
- return Promise.reject(byobReaderBrandCheckException('cancel'));
- }
- if (this._ownerReadableStream === undefined) {
- return Promise.reject(readerLockException('cancel'));
- }
- return ReadableStreamReaderGenericCancel(this, reason);
- }
- }, {
- key: 'read',
- value: function read(view) {
- if (!IsReadableStreamBYOBReader(this)) {
- return Promise.reject(byobReaderBrandCheckException('read'));
- }
- if (this._ownerReadableStream === undefined) {
- return Promise.reject(readerLockException('read from'));
- }
- if (!ArrayBuffer.isView(view)) {
- return Promise.reject(new TypeError('view must be an array buffer view'));
- }
- if (view.byteLength === 0) {
- return Promise.reject(new TypeError('view must have non-zero byteLength'));
- }
- return ReadableStreamBYOBReaderRead(this, view);
- }
- }, {
- key: 'releaseLock',
- value: function releaseLock() {
- if (!IsReadableStreamBYOBReader(this)) {
- throw byobReaderBrandCheckException('releaseLock');
- }
- if (this._ownerReadableStream === undefined) {
- return;
- }
- if (this._readIntoRequests.length > 0) {
- throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled');
- }
- ReadableStreamReaderGenericRelease(this);
- }
- }, {
- key: 'closed',
- get: function get() {
- if (!IsReadableStreamBYOBReader(this)) {
- return Promise.reject(byobReaderBrandCheckException('closed'));
- }
- return this._closedPromise;
- }
- }]);
- return ReadableStreamBYOBReader;
- }();
- function IsReadableStreamBYOBReader(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_readIntoRequests')) {
- return false;
- }
- return true;
- }
- function IsReadableStreamDefaultReader(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_readRequests')) {
- return false;
- }
- return true;
- }
- function ReadableStreamReaderGenericInitialize(reader, stream) {
- reader._ownerReadableStream = stream;
- stream._reader = reader;
- if (stream._state === 'readable') {
- defaultReaderClosedPromiseInitialize(reader);
- } else if (stream._state === 'closed') {
- defaultReaderClosedPromiseInitializeAsResolved(reader);
- } else {
- assert(stream._state === 'errored', 'state must be errored');
- defaultReaderClosedPromiseInitializeAsRejected(reader, stream._storedError);
- reader._closedPromise.catch(function () {});
- }
- }
- function ReadableStreamReaderGenericCancel(reader, reason) {
- var stream = reader._ownerReadableStream;
- assert(stream !== undefined);
- return ReadableStreamCancel(stream, reason);
- }
- function ReadableStreamReaderGenericRelease(reader) {
- assert(reader._ownerReadableStream !== undefined);
- assert(reader._ownerReadableStream._reader === reader);
- if (reader._ownerReadableStream._state === 'readable') {
- defaultReaderClosedPromiseReject(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\'s closedness'));
- } else {
- defaultReaderClosedPromiseResetToRejected(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\'s closedness'));
- }
- reader._closedPromise.catch(function () {});
- reader._ownerReadableStream._reader = undefined;
- reader._ownerReadableStream = undefined;
- }
- function ReadableStreamBYOBReaderRead(reader, view) {
- var stream = reader._ownerReadableStream;
- assert(stream !== undefined);
- stream._disturbed = true;
- if (stream._state === 'errored') {
- return Promise.reject(stream._storedError);
- }
- return ReadableByteStreamControllerPullInto(stream._readableStreamController, view);
- }
- function ReadableStreamDefaultReaderRead(reader) {
- var stream = reader._ownerReadableStream;
- assert(stream !== undefined);
- stream._disturbed = true;
- if (stream._state === 'closed') {
- return Promise.resolve(CreateIterResultObject(undefined, true));
- }
- if (stream._state === 'errored') {
- return Promise.reject(stream._storedError);
- }
- assert(stream._state === 'readable');
- return stream._readableStreamController.__pullSteps();
- }
- var ReadableStreamDefaultController = function () {
- function ReadableStreamDefaultController(stream, underlyingSource, size, highWaterMark) {
- _classCallCheck(this, ReadableStreamDefaultController);
- if (IsReadableStream(stream) === false) {
- throw new TypeError('ReadableStreamDefaultController can only be constructed with a ReadableStream instance');
- }
- if (stream._readableStreamController !== undefined) {
- throw new TypeError('ReadableStreamDefaultController instances can only be created by the ReadableStream constructor');
- }
- this._controlledReadableStream = stream;
- this._underlyingSource = underlyingSource;
- this._queue = undefined;
- this._queueTotalSize = undefined;
- ResetQueue(this);
- this._started = false;
- this._closeRequested = false;
- this._pullAgain = false;
- this._pulling = false;
- var normalizedStrategy = ValidateAndNormalizeQueuingStrategy(size, highWaterMark);
- this._strategySize = normalizedStrategy.size;
- this._strategyHWM = normalizedStrategy.highWaterMark;
- var controller = this;
- var startResult = InvokeOrNoop(underlyingSource, 'start', [this]);
- Promise.resolve(startResult).then(function () {
- controller._started = true;
- assert(controller._pulling === false);
- assert(controller._pullAgain === false);
- ReadableStreamDefaultControllerCallPullIfNeeded(controller);
- }, function (r) {
- ReadableStreamDefaultControllerErrorIfNeeded(controller, r);
- }).catch(rethrowAssertionErrorRejection);
- }
- _createClass(ReadableStreamDefaultController, [{
- key: 'close',
- value: function close() {
- if (IsReadableStreamDefaultController(this) === false) {
- throw defaultControllerBrandCheckException('close');
- }
- if (this._closeRequested === true) {
- throw new TypeError('The stream has already been closed; do not close it again!');
- }
- var state = this._controlledReadableStream._state;
- if (state !== 'readable') {
- throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be closed');
- }
- ReadableStreamDefaultControllerClose(this);
- }
- }, {
- key: 'enqueue',
- value: function enqueue(chunk) {
- if (IsReadableStreamDefaultController(this) === false) {
- throw defaultControllerBrandCheckException('enqueue');
- }
- if (this._closeRequested === true) {
- throw new TypeError('stream is closed or draining');
- }
- var state = this._controlledReadableStream._state;
- if (state !== 'readable') {
- throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be enqueued to');
- }
- return ReadableStreamDefaultControllerEnqueue(this, chunk);
- }
- }, {
- key: 'error',
- value: function error(e) {
- if (IsReadableStreamDefaultController(this) === false) {
- throw defaultControllerBrandCheckException('error');
- }
- var stream = this._controlledReadableStream;
- if (stream._state !== 'readable') {
- throw new TypeError('The stream is ' + stream._state + ' and so cannot be errored');
- }
- ReadableStreamDefaultControllerError(this, e);
- }
- }, {
- key: '__cancelSteps',
- value: function __cancelSteps(reason) {
- ResetQueue(this);
- return PromiseInvokeOrNoop(this._underlyingSource, 'cancel', [reason]);
- }
- }, {
- key: '__pullSteps',
- value: function __pullSteps() {
- var stream = this._controlledReadableStream;
- if (this._queue.length > 0) {
- var chunk = DequeueValue(this);
- if (this._closeRequested === true && this._queue.length === 0) {
- ReadableStreamClose(stream);
- } else {
- ReadableStreamDefaultControllerCallPullIfNeeded(this);
- }
- return Promise.resolve(CreateIterResultObject(chunk, false));
- }
- var pendingPromise = ReadableStreamAddReadRequest(stream);
- ReadableStreamDefaultControllerCallPullIfNeeded(this);
- return pendingPromise;
- }
- }, {
- key: 'desiredSize',
- get: function get() {
- if (IsReadableStreamDefaultController(this) === false) {
- throw defaultControllerBrandCheckException('desiredSize');
- }
- return ReadableStreamDefaultControllerGetDesiredSize(this);
- }
- }]);
- return ReadableStreamDefaultController;
- }();
- function IsReadableStreamDefaultController(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_underlyingSource')) {
- return false;
- }
- return true;
- }
- function ReadableStreamDefaultControllerCallPullIfNeeded(controller) {
- var shouldPull = ReadableStreamDefaultControllerShouldCallPull(controller);
- if (shouldPull === false) {
- return undefined;
- }
- if (controller._pulling === true) {
- controller._pullAgain = true;
- return undefined;
- }
- assert(controller._pullAgain === false);
- controller._pulling = true;
- var pullPromise = PromiseInvokeOrNoop(controller._underlyingSource, 'pull', [controller]);
- pullPromise.then(function () {
- controller._pulling = false;
- if (controller._pullAgain === true) {
- controller._pullAgain = false;
- return ReadableStreamDefaultControllerCallPullIfNeeded(controller);
- }
- return undefined;
- }, function (e) {
- ReadableStreamDefaultControllerErrorIfNeeded(controller, e);
- }).catch(rethrowAssertionErrorRejection);
- return undefined;
- }
- function ReadableStreamDefaultControllerShouldCallPull(controller) {
- var stream = controller._controlledReadableStream;
- if (stream._state === 'closed' || stream._state === 'errored') {
- return false;
- }
- if (controller._closeRequested === true) {
- return false;
- }
- if (controller._started === false) {
- return false;
- }
- if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {
- return true;
- }
- var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller);
- if (desiredSize > 0) {
- return true;
- }
- return false;
- }
- function ReadableStreamDefaultControllerClose(controller) {
- var stream = controller._controlledReadableStream;
- assert(controller._closeRequested === false);
- assert(stream._state === 'readable');
- controller._closeRequested = true;
- if (controller._queue.length === 0) {
- ReadableStreamClose(stream);
- }
- }
- function ReadableStreamDefaultControllerEnqueue(controller, chunk) {
- var stream = controller._controlledReadableStream;
- assert(controller._closeRequested === false);
- assert(stream._state === 'readable');
- if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {
- ReadableStreamFulfillReadRequest(stream, chunk, false);
- } else {
- var chunkSize = 1;
- if (controller._strategySize !== undefined) {
- var strategySize = controller._strategySize;
- try {
- chunkSize = strategySize(chunk);
- } catch (chunkSizeE) {
- ReadableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE);
- throw chunkSizeE;
- }
- }
- try {
- EnqueueValueWithSize(controller, chunk, chunkSize);
- } catch (enqueueE) {
- ReadableStreamDefaultControllerErrorIfNeeded(controller, enqueueE);
- throw enqueueE;
- }
- }
- ReadableStreamDefaultControllerCallPullIfNeeded(controller);
- return undefined;
- }
- function ReadableStreamDefaultControllerError(controller, e) {
- var stream = controller._controlledReadableStream;
- assert(stream._state === 'readable');
- ResetQueue(controller);
- ReadableStreamError(stream, e);
- }
- function ReadableStreamDefaultControllerErrorIfNeeded(controller, e) {
- if (controller._controlledReadableStream._state === 'readable') {
- ReadableStreamDefaultControllerError(controller, e);
- }
- }
- function ReadableStreamDefaultControllerGetDesiredSize(controller) {
- var stream = controller._controlledReadableStream;
- var state = stream._state;
- if (state === 'errored') {
- return null;
- }
- if (state === 'closed') {
- return 0;
- }
- return controller._strategyHWM - controller._queueTotalSize;
- }
- var ReadableStreamBYOBRequest = function () {
- function ReadableStreamBYOBRequest(controller, view) {
- _classCallCheck(this, ReadableStreamBYOBRequest);
- this._associatedReadableByteStreamController = controller;
- this._view = view;
- }
- _createClass(ReadableStreamBYOBRequest, [{
- key: 'respond',
- value: function respond(bytesWritten) {
- if (IsReadableStreamBYOBRequest(this) === false) {
- throw byobRequestBrandCheckException('respond');
- }
- if (this._associatedReadableByteStreamController === undefined) {
- throw new TypeError('This BYOB request has been invalidated');
- }
- ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController, bytesWritten);
- }
- }, {
- key: 'respondWithNewView',
- value: function respondWithNewView(view) {
- if (IsReadableStreamBYOBRequest(this) === false) {
- throw byobRequestBrandCheckException('respond');
- }
- if (this._associatedReadableByteStreamController === undefined) {
- throw new TypeError('This BYOB request has been invalidated');
- }
- if (!ArrayBuffer.isView(view)) {
- throw new TypeError('You can only respond with array buffer views');
- }
- ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view);
- }
- }, {
- key: 'view',
- get: function get() {
- return this._view;
- }
- }]);
- return ReadableStreamBYOBRequest;
- }();
- var ReadableByteStreamController = function () {
- function ReadableByteStreamController(stream, underlyingByteSource, highWaterMark) {
- _classCallCheck(this, ReadableByteStreamController);
- if (IsReadableStream(stream) === false) {
- throw new TypeError('ReadableByteStreamController can only be constructed with a ReadableStream instance given ' + 'a byte source');
- }
- if (stream._readableStreamController !== undefined) {
- throw new TypeError('ReadableByteStreamController instances can only be created by the ReadableStream constructor given a byte ' + 'source');
- }
- this._controlledReadableStream = stream;
- this._underlyingByteSource = underlyingByteSource;
- this._pullAgain = false;
- this._pulling = false;
- ReadableByteStreamControllerClearPendingPullIntos(this);
- this._queue = this._queueTotalSize = undefined;
- ResetQueue(this);
- this._closeRequested = false;
- this._started = false;
- this._strategyHWM = ValidateAndNormalizeHighWaterMark(highWaterMark);
- var autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;
- if (autoAllocateChunkSize !== undefined) {
- if (Number.isInteger(autoAllocateChunkSize) === false || autoAllocateChunkSize <= 0) {
- throw new RangeError('autoAllocateChunkSize must be a positive integer');
- }
- }
- this._autoAllocateChunkSize = autoAllocateChunkSize;
- this._pendingPullIntos = [];
- var controller = this;
- var startResult = InvokeOrNoop(underlyingByteSource, 'start', [this]);
- Promise.resolve(startResult).then(function () {
- controller._started = true;
- assert(controller._pulling === false);
- assert(controller._pullAgain === false);
- ReadableByteStreamControllerCallPullIfNeeded(controller);
- }, function (r) {
- if (stream._state === 'readable') {
- ReadableByteStreamControllerError(controller, r);
- }
- }).catch(rethrowAssertionErrorRejection);
- }
- _createClass(ReadableByteStreamController, [{
- key: 'close',
- value: function close() {
- if (IsReadableByteStreamController(this) === false) {
- throw byteStreamControllerBrandCheckException('close');
- }
- if (this._closeRequested === true) {
- throw new TypeError('The stream has already been closed; do not close it again!');
- }
- var state = this._controlledReadableStream._state;
- if (state !== 'readable') {
- throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be closed');
- }
- ReadableByteStreamControllerClose(this);
- }
- }, {
- key: 'enqueue',
- value: function enqueue(chunk) {
- if (IsReadableByteStreamController(this) === false) {
- throw byteStreamControllerBrandCheckException('enqueue');
- }
- if (this._closeRequested === true) {
- throw new TypeError('stream is closed or draining');
- }
- var state = this._controlledReadableStream._state;
- if (state !== 'readable') {
- throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be enqueued to');
- }
- if (!ArrayBuffer.isView(chunk)) {
- throw new TypeError('You can only enqueue array buffer views when using a ReadableByteStreamController');
- }
- ReadableByteStreamControllerEnqueue(this, chunk);
- }
- }, {
- key: 'error',
- value: function error(e) {
- if (IsReadableByteStreamController(this) === false) {
- throw byteStreamControllerBrandCheckException('error');
- }
- var stream = this._controlledReadableStream;
- if (stream._state !== 'readable') {
- throw new TypeError('The stream is ' + stream._state + ' and so cannot be errored');
- }
- ReadableByteStreamControllerError(this, e);
- }
- }, {
- key: '__cancelSteps',
- value: function __cancelSteps(reason) {
- if (this._pendingPullIntos.length > 0) {
- var firstDescriptor = this._pendingPullIntos[0];
- firstDescriptor.bytesFilled = 0;
- }
- ResetQueue(this);
- return PromiseInvokeOrNoop(this._underlyingByteSource, 'cancel', [reason]);
- }
- }, {
- key: '__pullSteps',
- value: function __pullSteps() {
- var stream = this._controlledReadableStream;
- assert(ReadableStreamHasDefaultReader(stream) === true);
- if (this._queueTotalSize > 0) {
- assert(ReadableStreamGetNumReadRequests(stream) === 0);
- var entry = this._queue.shift();
- this._queueTotalSize -= entry.byteLength;
- ReadableByteStreamControllerHandleQueueDrain(this);
- var view = void 0;
- try {
- view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);
- } catch (viewE) {
- return Promise.reject(viewE);
- }
- return Promise.resolve(CreateIterResultObject(view, false));
- }
- var autoAllocateChunkSize = this._autoAllocateChunkSize;
- if (autoAllocateChunkSize !== undefined) {
- var buffer = void 0;
- try {
- buffer = new ArrayBuffer(autoAllocateChunkSize);
- } catch (bufferE) {
- return Promise.reject(bufferE);
- }
- var pullIntoDescriptor = {
- buffer: buffer,
- byteOffset: 0,
- byteLength: autoAllocateChunkSize,
- bytesFilled: 0,
- elementSize: 1,
- ctor: Uint8Array,
- readerType: 'default'
- };
- this._pendingPullIntos.push(pullIntoDescriptor);
- }
- var promise = ReadableStreamAddReadRequest(stream);
- ReadableByteStreamControllerCallPullIfNeeded(this);
- return promise;
- }
- }, {
- key: 'byobRequest',
- get: function get() {
- if (IsReadableByteStreamController(this) === false) {
- throw byteStreamControllerBrandCheckException('byobRequest');
- }
- if (this._byobRequest === undefined && this._pendingPullIntos.length > 0) {
- var firstDescriptor = this._pendingPullIntos[0];
- var view = new Uint8Array(firstDescriptor.buffer, firstDescriptor.byteOffset + firstDescriptor.bytesFilled, firstDescriptor.byteLength - firstDescriptor.bytesFilled);
- this._byobRequest = new ReadableStreamBYOBRequest(this, view);
- }
- return this._byobRequest;
- }
- }, {
- key: 'desiredSize',
- get: function get() {
- if (IsReadableByteStreamController(this) === false) {
- throw byteStreamControllerBrandCheckException('desiredSize');
- }
- return ReadableByteStreamControllerGetDesiredSize(this);
- }
- }]);
- return ReadableByteStreamController;
- }();
- function IsReadableByteStreamController(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_underlyingByteSource')) {
- return false;
- }
- return true;
- }
- function IsReadableStreamBYOBRequest(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_associatedReadableByteStreamController')) {
- return false;
- }
- return true;
- }
- function ReadableByteStreamControllerCallPullIfNeeded(controller) {
- var shouldPull = ReadableByteStreamControllerShouldCallPull(controller);
- if (shouldPull === false) {
- return undefined;
- }
- if (controller._pulling === true) {
- controller._pullAgain = true;
- return undefined;
- }
- assert(controller._pullAgain === false);
- controller._pulling = true;
- var pullPromise = PromiseInvokeOrNoop(controller._underlyingByteSource, 'pull', [controller]);
- pullPromise.then(function () {
- controller._pulling = false;
- if (controller._pullAgain === true) {
- controller._pullAgain = false;
- ReadableByteStreamControllerCallPullIfNeeded(controller);
- }
- }, function (e) {
- if (controller._controlledReadableStream._state === 'readable') {
- ReadableByteStreamControllerError(controller, e);
- }
- }).catch(rethrowAssertionErrorRejection);
- return undefined;
- }
- function ReadableByteStreamControllerClearPendingPullIntos(controller) {
- ReadableByteStreamControllerInvalidateBYOBRequest(controller);
- controller._pendingPullIntos = [];
- }
- function ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor) {
- assert(stream._state !== 'errored', 'state must not be errored');
- var done = false;
- if (stream._state === 'closed') {
- assert(pullIntoDescriptor.bytesFilled === 0);
- done = true;
- }
- var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);
- if (pullIntoDescriptor.readerType === 'default') {
- ReadableStreamFulfillReadRequest(stream, filledView, done);
- } else {
- assert(pullIntoDescriptor.readerType === 'byob');
- ReadableStreamFulfillReadIntoRequest(stream, filledView, done);
- }
- }
- function ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor) {
- var bytesFilled = pullIntoDescriptor.bytesFilled;
- var elementSize = pullIntoDescriptor.elementSize;
- assert(bytesFilled <= pullIntoDescriptor.byteLength);
- assert(bytesFilled % elementSize === 0);
- return new pullIntoDescriptor.ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, bytesFilled / elementSize);
- }
- function ReadableByteStreamControllerEnqueueChunkToQueue(controller, buffer, byteOffset, byteLength) {
- controller._queue.push({
- buffer: buffer,
- byteOffset: byteOffset,
- byteLength: byteLength
- });
- controller._queueTotalSize += byteLength;
- }
- function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) {
- var elementSize = pullIntoDescriptor.elementSize;
- var currentAlignedBytes = pullIntoDescriptor.bytesFilled - pullIntoDescriptor.bytesFilled % elementSize;
- var maxBytesToCopy = Math.min(controller._queueTotalSize, pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled);
- var maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy;
- var maxAlignedBytes = maxBytesFilled - maxBytesFilled % elementSize;
- var totalBytesToCopyRemaining = maxBytesToCopy;
- var ready = false;
- if (maxAlignedBytes > currentAlignedBytes) {
- totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled;
- ready = true;
- }
- var queue = controller._queue;
- while (totalBytesToCopyRemaining > 0) {
- var headOfQueue = queue[0];
- var bytesToCopy = Math.min(totalBytesToCopyRemaining, headOfQueue.byteLength);
- var destStart = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
- ArrayBufferCopy(pullIntoDescriptor.buffer, destStart, headOfQueue.buffer, headOfQueue.byteOffset, bytesToCopy);
- if (headOfQueue.byteLength === bytesToCopy) {
- queue.shift();
- } else {
- headOfQueue.byteOffset += bytesToCopy;
- headOfQueue.byteLength -= bytesToCopy;
- }
- controller._queueTotalSize -= bytesToCopy;
- ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesToCopy, pullIntoDescriptor);
- totalBytesToCopyRemaining -= bytesToCopy;
- }
- if (ready === false) {
- assert(controller._queueTotalSize === 0, 'queue must be empty');
- assert(pullIntoDescriptor.bytesFilled > 0);
- assert(pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize);
- }
- return ready;
- }
- function ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, size, pullIntoDescriptor) {
- assert(controller._pendingPullIntos.length === 0 || controller._pendingPullIntos[0] === pullIntoDescriptor);
- ReadableByteStreamControllerInvalidateBYOBRequest(controller);
- pullIntoDescriptor.bytesFilled += size;
- }
- function ReadableByteStreamControllerHandleQueueDrain(controller) {
- assert(controller._controlledReadableStream._state === 'readable');
- if (controller._queueTotalSize === 0 && controller._closeRequested === true) {
- ReadableStreamClose(controller._controlledReadableStream);
- } else {
- ReadableByteStreamControllerCallPullIfNeeded(controller);
- }
- }
- function ReadableByteStreamControllerInvalidateBYOBRequest(controller) {
- if (controller._byobRequest === undefined) {
- return;
- }
- controller._byobRequest._associatedReadableByteStreamController = undefined;
- controller._byobRequest._view = undefined;
- controller._byobRequest = undefined;
- }
- function ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller) {
- assert(controller._closeRequested === false);
- while (controller._pendingPullIntos.length > 0) {
- if (controller._queueTotalSize === 0) {
- return;
- }
- var pullIntoDescriptor = controller._pendingPullIntos[0];
- if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) {
- ReadableByteStreamControllerShiftPendingPullInto(controller);
- ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableStream, pullIntoDescriptor);
- }
- }
- }
- function ReadableByteStreamControllerPullInto(controller, view) {
- var stream = controller._controlledReadableStream;
- var elementSize = 1;
- if (view.constructor !== DataView) {
- elementSize = view.constructor.BYTES_PER_ELEMENT;
- }
- var ctor = view.constructor;
- var pullIntoDescriptor = {
- buffer: view.buffer,
- byteOffset: view.byteOffset,
- byteLength: view.byteLength,
- bytesFilled: 0,
- elementSize: elementSize,
- ctor: ctor,
- readerType: 'byob'
- };
- if (controller._pendingPullIntos.length > 0) {
- pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer);
- controller._pendingPullIntos.push(pullIntoDescriptor);
- return ReadableStreamAddReadIntoRequest(stream);
- }
- if (stream._state === 'closed') {
- var emptyView = new view.constructor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, 0);
- return Promise.resolve(CreateIterResultObject(emptyView, true));
- }
- if (controller._queueTotalSize > 0) {
- if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) {
- var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);
- ReadableByteStreamControllerHandleQueueDrain(controller);
- return Promise.resolve(CreateIterResultObject(filledView, false));
- }
- if (controller._closeRequested === true) {
- var e = new TypeError('Insufficient bytes to fill elements in the given buffer');
- ReadableByteStreamControllerError(controller, e);
- return Promise.reject(e);
- }
- }
- pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer);
- controller._pendingPullIntos.push(pullIntoDescriptor);
- var promise = ReadableStreamAddReadIntoRequest(stream);
- ReadableByteStreamControllerCallPullIfNeeded(controller);
- return promise;
- }
- function ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor) {
- firstDescriptor.buffer = TransferArrayBuffer(firstDescriptor.buffer);
- assert(firstDescriptor.bytesFilled === 0, 'bytesFilled must be 0');
- var stream = controller._controlledReadableStream;
- if (ReadableStreamHasBYOBReader(stream) === true) {
- while (ReadableStreamGetNumReadIntoRequests(stream) > 0) {
- var pullIntoDescriptor = ReadableByteStreamControllerShiftPendingPullInto(controller);
- ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor);
- }
- }
- }
- function ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, pullIntoDescriptor) {
- if (pullIntoDescriptor.bytesFilled + bytesWritten > pullIntoDescriptor.byteLength) {
- throw new RangeError('bytesWritten out of range');
- }
- ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor);
- if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize) {
- return;
- }
- ReadableByteStreamControllerShiftPendingPullInto(controller);
- var remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize;
- if (remainderSize > 0) {
- var end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
- var remainder = pullIntoDescriptor.buffer.slice(end - remainderSize, end);
- ReadableByteStreamControllerEnqueueChunkToQueue(controller, remainder, 0, remainder.byteLength);
- }
- pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer);
- pullIntoDescriptor.bytesFilled -= remainderSize;
- ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableStream, pullIntoDescriptor);
- ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);
- }
- function ReadableByteStreamControllerRespondInternal(controller, bytesWritten) {
- var firstDescriptor = controller._pendingPullIntos[0];
- var stream = controller._controlledReadableStream;
- if (stream._state === 'closed') {
- if (bytesWritten !== 0) {
- throw new TypeError('bytesWritten must be 0 when calling respond() on a closed stream');
- }
- ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor);
- } else {
- assert(stream._state === 'readable');
- ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor);
- }
- }
- function ReadableByteStreamControllerShiftPendingPullInto(controller) {
- var descriptor = controller._pendingPullIntos.shift();
- ReadableByteStreamControllerInvalidateBYOBRequest(controller);
- return descriptor;
- }
- function ReadableByteStreamControllerShouldCallPull(controller) {
- var stream = controller._controlledReadableStream;
- if (stream._state !== 'readable') {
- return false;
- }
- if (controller._closeRequested === true) {
- return false;
- }
- if (controller._started === false) {
- return false;
- }
- if (ReadableStreamHasDefaultReader(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {
- return true;
- }
- if (ReadableStreamHasBYOBReader(stream) === true && ReadableStreamGetNumReadIntoRequests(stream) > 0) {
- return true;
- }
- if (ReadableByteStreamControllerGetDesiredSize(controller) > 0) {
- return true;
- }
- return false;
- }
- function ReadableByteStreamControllerClose(controller) {
- var stream = controller._controlledReadableStream;
- assert(controller._closeRequested === false);
- assert(stream._state === 'readable');
- if (controller._queueTotalSize > 0) {
- controller._closeRequested = true;
- return;
- }
- if (controller._pendingPullIntos.length > 0) {
- var firstPendingPullInto = controller._pendingPullIntos[0];
- if (firstPendingPullInto.bytesFilled > 0) {
- var e = new TypeError('Insufficient bytes to fill elements in the given buffer');
- ReadableByteStreamControllerError(controller, e);
- throw e;
- }
- }
- ReadableStreamClose(stream);
- }
- function ReadableByteStreamControllerEnqueue(controller, chunk) {
- var stream = controller._controlledReadableStream;
- assert(controller._closeRequested === false);
- assert(stream._state === 'readable');
- var buffer = chunk.buffer;
- var byteOffset = chunk.byteOffset;
- var byteLength = chunk.byteLength;
- var transferredBuffer = TransferArrayBuffer(buffer);
- if (ReadableStreamHasDefaultReader(stream) === true) {
- if (ReadableStreamGetNumReadRequests(stream) === 0) {
- ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
- } else {
- assert(controller._queue.length === 0);
- var transferredView = new Uint8Array(transferredBuffer, byteOffset, byteLength);
- ReadableStreamFulfillReadRequest(stream, transferredView, false);
- }
- } else if (ReadableStreamHasBYOBReader(stream) === true) {
- ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
- ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);
- } else {
- assert(IsReadableStreamLocked(stream) === false, 'stream must not be locked');
- ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
- }
- }
- function ReadableByteStreamControllerError(controller, e) {
- var stream = controller._controlledReadableStream;
- assert(stream._state === 'readable');
- ReadableByteStreamControllerClearPendingPullIntos(controller);
- ResetQueue(controller);
- ReadableStreamError(stream, e);
- }
- function ReadableByteStreamControllerGetDesiredSize(controller) {
- var stream = controller._controlledReadableStream;
- var state = stream._state;
- if (state === 'errored') {
- return null;
- }
- if (state === 'closed') {
- return 0;
- }
- return controller._strategyHWM - controller._queueTotalSize;
- }
- function ReadableByteStreamControllerRespond(controller, bytesWritten) {
- bytesWritten = Number(bytesWritten);
- if (IsFiniteNonNegativeNumber(bytesWritten) === false) {
- throw new RangeError('bytesWritten must be a finite');
- }
- assert(controller._pendingPullIntos.length > 0);
- ReadableByteStreamControllerRespondInternal(controller, bytesWritten);
- }
- function ReadableByteStreamControllerRespondWithNewView(controller, view) {
- assert(controller._pendingPullIntos.length > 0);
- var firstDescriptor = controller._pendingPullIntos[0];
- if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !== view.byteOffset) {
- throw new RangeError('The region specified by view does not match byobRequest');
- }
- if (firstDescriptor.byteLength !== view.byteLength) {
- throw new RangeError('The buffer of view has different capacity than byobRequest');
- }
- firstDescriptor.buffer = view.buffer;
- ReadableByteStreamControllerRespondInternal(controller, view.byteLength);
- }
- function streamBrandCheckException(name) {
- return new TypeError('ReadableStream.prototype.' + name + ' can only be used on a ReadableStream');
- }
- function readerLockException(name) {
- return new TypeError('Cannot ' + name + ' a stream using a released reader');
- }
- function defaultReaderBrandCheckException(name) {
- return new TypeError('ReadableStreamDefaultReader.prototype.' + name + ' can only be used on a ReadableStreamDefaultReader');
- }
- function defaultReaderClosedPromiseInitialize(reader) {
- reader._closedPromise = new Promise(function (resolve, reject) {
- reader._closedPromise_resolve = resolve;
- reader._closedPromise_reject = reject;
- });
- }
- function defaultReaderClosedPromiseInitializeAsRejected(reader, reason) {
- reader._closedPromise = Promise.reject(reason);
- reader._closedPromise_resolve = undefined;
- reader._closedPromise_reject = undefined;
- }
- function defaultReaderClosedPromiseInitializeAsResolved(reader) {
- reader._closedPromise = Promise.resolve(undefined);
- reader._closedPromise_resolve = undefined;
- reader._closedPromise_reject = undefined;
- }
- function defaultReaderClosedPromiseReject(reader, reason) {
- assert(reader._closedPromise_resolve !== undefined);
- assert(reader._closedPromise_reject !== undefined);
- reader._closedPromise_reject(reason);
- reader._closedPromise_resolve = undefined;
- reader._closedPromise_reject = undefined;
- }
- function defaultReaderClosedPromiseResetToRejected(reader, reason) {
- assert(reader._closedPromise_resolve === undefined);
- assert(reader._closedPromise_reject === undefined);
- reader._closedPromise = Promise.reject(reason);
- }
- function defaultReaderClosedPromiseResolve(reader) {
- assert(reader._closedPromise_resolve !== undefined);
- assert(reader._closedPromise_reject !== undefined);
- reader._closedPromise_resolve(undefined);
- reader._closedPromise_resolve = undefined;
- reader._closedPromise_reject = undefined;
- }
- function byobReaderBrandCheckException(name) {
- return new TypeError('ReadableStreamBYOBReader.prototype.' + name + ' can only be used on a ReadableStreamBYOBReader');
- }
- function defaultControllerBrandCheckException(name) {
- return new TypeError('ReadableStreamDefaultController.prototype.' + name + ' can only be used on a ReadableStreamDefaultController');
- }
- function byobRequestBrandCheckException(name) {
- return new TypeError('ReadableStreamBYOBRequest.prototype.' + name + ' can only be used on a ReadableStreamBYOBRequest');
- }
- function byteStreamControllerBrandCheckException(name) {
- return new TypeError('ReadableByteStreamController.prototype.' + name + ' can only be used on a ReadableByteStreamController');
- }
- function ifIsObjectAndHasAPromiseIsHandledInternalSlotSetPromiseIsHandledToTrue(promise) {
- try {
- Promise.prototype.then.call(promise, undefined, function () {});
- } catch (e) {}
- }
-}, function (module, exports, __w_pdfjs_require__) {
- "use strict";
-
- var transformStream = __w_pdfjs_require__(6);
- var readableStream = __w_pdfjs_require__(4);
- var writableStream = __w_pdfjs_require__(2);
- exports.TransformStream = transformStream.TransformStream;
- exports.ReadableStream = readableStream.ReadableStream;
- exports.IsReadableStreamDisturbed = readableStream.IsReadableStreamDisturbed;
- exports.ReadableStreamDefaultControllerClose = readableStream.ReadableStreamDefaultControllerClose;
- exports.ReadableStreamDefaultControllerEnqueue = readableStream.ReadableStreamDefaultControllerEnqueue;
- exports.ReadableStreamDefaultControllerError = readableStream.ReadableStreamDefaultControllerError;
- exports.ReadableStreamDefaultControllerGetDesiredSize = readableStream.ReadableStreamDefaultControllerGetDesiredSize;
- exports.AcquireWritableStreamDefaultWriter = writableStream.AcquireWritableStreamDefaultWriter;
- exports.IsWritableStream = writableStream.IsWritableStream;
- exports.IsWritableStreamLocked = writableStream.IsWritableStreamLocked;
- exports.WritableStream = writableStream.WritableStream;
- exports.WritableStreamAbort = writableStream.WritableStreamAbort;
- exports.WritableStreamDefaultControllerError = writableStream.WritableStreamDefaultControllerError;
- exports.WritableStreamDefaultWriterCloseWithErrorPropagation = writableStream.WritableStreamDefaultWriterCloseWithErrorPropagation;
- exports.WritableStreamDefaultWriterRelease = writableStream.WritableStreamDefaultWriterRelease;
- exports.WritableStreamDefaultWriterWrite = writableStream.WritableStreamDefaultWriterWrite;
-}, function (module, exports, __w_pdfjs_require__) {
- "use strict";
-
- var _createClass = 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);
- }
- }
- return function (Constructor, protoProps, staticProps) {
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
- if (staticProps) defineProperties(Constructor, staticProps);
- return Constructor;
- };
- }();
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- var _require = __w_pdfjs_require__(1),
- assert = _require.assert;
- var _require2 = __w_pdfjs_require__(0),
- InvokeOrNoop = _require2.InvokeOrNoop,
- PromiseInvokeOrPerformFallback = _require2.PromiseInvokeOrPerformFallback,
- PromiseInvokeOrNoop = _require2.PromiseInvokeOrNoop,
- typeIsObject = _require2.typeIsObject;
- var _require3 = __w_pdfjs_require__(4),
- ReadableStream = _require3.ReadableStream,
- ReadableStreamDefaultControllerClose = _require3.ReadableStreamDefaultControllerClose,
- ReadableStreamDefaultControllerEnqueue = _require3.ReadableStreamDefaultControllerEnqueue,
- ReadableStreamDefaultControllerError = _require3.ReadableStreamDefaultControllerError,
- ReadableStreamDefaultControllerGetDesiredSize = _require3.ReadableStreamDefaultControllerGetDesiredSize;
- var _require4 = __w_pdfjs_require__(2),
- WritableStream = _require4.WritableStream,
- WritableStreamDefaultControllerError = _require4.WritableStreamDefaultControllerError;
- function TransformStreamCloseReadable(transformStream) {
- if (transformStream._errored === true) {
- throw new TypeError('TransformStream is already errored');
- }
- if (transformStream._readableClosed === true) {
- throw new TypeError('Readable side is already closed');
- }
- TransformStreamCloseReadableInternal(transformStream);
- }
- function TransformStreamEnqueueToReadable(transformStream, chunk) {
- if (transformStream._errored === true) {
- throw new TypeError('TransformStream is already errored');
- }
- if (transformStream._readableClosed === true) {
- throw new TypeError('Readable side is already closed');
- }
- var controller = transformStream._readableController;
- try {
- ReadableStreamDefaultControllerEnqueue(controller, chunk);
- } catch (e) {
- transformStream._readableClosed = true;
- TransformStreamErrorIfNeeded(transformStream, e);
- throw transformStream._storedError;
- }
- var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller);
- var maybeBackpressure = desiredSize <= 0;
- if (maybeBackpressure === true && transformStream._backpressure === false) {
- TransformStreamSetBackpressure(transformStream, true);
- }
- }
- function TransformStreamError(transformStream, e) {
- if (transformStream._errored === true) {
- throw new TypeError('TransformStream is already errored');
- }
- TransformStreamErrorInternal(transformStream, e);
- }
- function TransformStreamCloseReadableInternal(transformStream) {
- assert(transformStream._errored === false);
- assert(transformStream._readableClosed === false);
- try {
- ReadableStreamDefaultControllerClose(transformStream._readableController);
- } catch (e) {
- assert(false);
- }
- transformStream._readableClosed = true;
- }
- function TransformStreamErrorIfNeeded(transformStream, e) {
- if (transformStream._errored === false) {
- TransformStreamErrorInternal(transformStream, e);
- }
- }
- function TransformStreamErrorInternal(transformStream, e) {
- assert(transformStream._errored === false);
- transformStream._errored = true;
- transformStream._storedError = e;
- if (transformStream._writableDone === false) {
- WritableStreamDefaultControllerError(transformStream._writableController, e);
- }
- if (transformStream._readableClosed === false) {
- ReadableStreamDefaultControllerError(transformStream._readableController, e);
- }
- }
- function TransformStreamReadableReadyPromise(transformStream) {
- assert(transformStream._backpressureChangePromise !== undefined, '_backpressureChangePromise should have been initialized');
- if (transformStream._backpressure === false) {
- return Promise.resolve();
- }
- assert(transformStream._backpressure === true, '_backpressure should have been initialized');
- return transformStream._backpressureChangePromise;
- }
- function TransformStreamSetBackpressure(transformStream, backpressure) {
- assert(transformStream._backpressure !== backpressure, 'TransformStreamSetBackpressure() should be called only when backpressure is changed');
- if (transformStream._backpressureChangePromise !== undefined) {
- transformStream._backpressureChangePromise_resolve(backpressure);
- }
- transformStream._backpressureChangePromise = new Promise(function (resolve) {
- transformStream._backpressureChangePromise_resolve = resolve;
- });
- transformStream._backpressureChangePromise.then(function (resolution) {
- assert(resolution !== backpressure, '_backpressureChangePromise should be fulfilled only when backpressure is changed');
- });
- transformStream._backpressure = backpressure;
- }
- function TransformStreamDefaultTransform(chunk, transformStreamController) {
- var transformStream = transformStreamController._controlledTransformStream;
- TransformStreamEnqueueToReadable(transformStream, chunk);
- return Promise.resolve();
- }
- function TransformStreamTransform(transformStream, chunk) {
- assert(transformStream._errored === false);
- assert(transformStream._transforming === false);
- assert(transformStream._backpressure === false);
- transformStream._transforming = true;
- var transformer = transformStream._transformer;
- var controller = transformStream._transformStreamController;
- var transformPromise = PromiseInvokeOrPerformFallback(transformer, 'transform', [chunk, controller], TransformStreamDefaultTransform, [chunk, controller]);
- return transformPromise.then(function () {
- transformStream._transforming = false;
- return TransformStreamReadableReadyPromise(transformStream);
- }, function (e) {
- TransformStreamErrorIfNeeded(transformStream, e);
- return Promise.reject(e);
- });
- }
- function IsTransformStreamDefaultController(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_controlledTransformStream')) {
- return false;
- }
- return true;
- }
- function IsTransformStream(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_transformStreamController')) {
- return false;
- }
- return true;
- }
- var TransformStreamSink = function () {
- function TransformStreamSink(transformStream, startPromise) {
- _classCallCheck(this, TransformStreamSink);
- this._transformStream = transformStream;
- this._startPromise = startPromise;
- }
- _createClass(TransformStreamSink, [{
- key: 'start',
- value: function start(c) {
- var transformStream = this._transformStream;
- transformStream._writableController = c;
- return this._startPromise.then(function () {
- return TransformStreamReadableReadyPromise(transformStream);
- });
- }
- }, {
- key: 'write',
- value: function write(chunk) {
- var transformStream = this._transformStream;
- return TransformStreamTransform(transformStream, chunk);
- }
- }, {
- key: 'abort',
- value: function abort() {
- var transformStream = this._transformStream;
- transformStream._writableDone = true;
- TransformStreamErrorInternal(transformStream, new TypeError('Writable side aborted'));
- }
- }, {
- key: 'close',
- value: function close() {
- var transformStream = this._transformStream;
- assert(transformStream._transforming === false);
- transformStream._writableDone = true;
- var flushPromise = PromiseInvokeOrNoop(transformStream._transformer, 'flush', [transformStream._transformStreamController]);
- return flushPromise.then(function () {
- if (transformStream._errored === true) {
- return Promise.reject(transformStream._storedError);
- }
- if (transformStream._readableClosed === false) {
- TransformStreamCloseReadableInternal(transformStream);
- }
- return Promise.resolve();
- }).catch(function (r) {
- TransformStreamErrorIfNeeded(transformStream, r);
- return Promise.reject(transformStream._storedError);
- });
- }
- }]);
- return TransformStreamSink;
- }();
- var TransformStreamSource = function () {
- function TransformStreamSource(transformStream, startPromise) {
- _classCallCheck(this, TransformStreamSource);
- this._transformStream = transformStream;
- this._startPromise = startPromise;
- }
- _createClass(TransformStreamSource, [{
- key: 'start',
- value: function start(c) {
- var transformStream = this._transformStream;
- transformStream._readableController = c;
- return this._startPromise.then(function () {
- assert(transformStream._backpressureChangePromise !== undefined, '_backpressureChangePromise should have been initialized');
- if (transformStream._backpressure === true) {
- return Promise.resolve();
- }
- assert(transformStream._backpressure === false, '_backpressure should have been initialized');
- return transformStream._backpressureChangePromise;
- });
- }
- }, {
- key: 'pull',
- value: function pull() {
- var transformStream = this._transformStream;
- assert(transformStream._backpressure === true, 'pull() should be never called while _backpressure is false');
- assert(transformStream._backpressureChangePromise !== undefined, '_backpressureChangePromise should have been initialized');
- TransformStreamSetBackpressure(transformStream, false);
- return transformStream._backpressureChangePromise;
- }
- }, {
- key: 'cancel',
- value: function cancel() {
- var transformStream = this._transformStream;
- transformStream._readableClosed = true;
- TransformStreamErrorInternal(transformStream, new TypeError('Readable side canceled'));
- }
- }]);
- return TransformStreamSource;
- }();
- var TransformStreamDefaultController = function () {
- function TransformStreamDefaultController(transformStream) {
- _classCallCheck(this, TransformStreamDefaultController);
- if (IsTransformStream(transformStream) === false) {
- throw new TypeError('TransformStreamDefaultController can only be ' + 'constructed with a TransformStream instance');
- }
- if (transformStream._transformStreamController !== undefined) {
- throw new TypeError('TransformStreamDefaultController instances can ' + 'only be created by the TransformStream constructor');
- }
- this._controlledTransformStream = transformStream;
- }
- _createClass(TransformStreamDefaultController, [{
- key: 'enqueue',
- value: function enqueue(chunk) {
- if (IsTransformStreamDefaultController(this) === false) {
- throw defaultControllerBrandCheckException('enqueue');
- }
- TransformStreamEnqueueToReadable(this._controlledTransformStream, chunk);
- }
- }, {
- key: 'close',
- value: function close() {
- if (IsTransformStreamDefaultController(this) === false) {
- throw defaultControllerBrandCheckException('close');
- }
- TransformStreamCloseReadable(this._controlledTransformStream);
- }
- }, {
- key: 'error',
- value: function error(reason) {
- if (IsTransformStreamDefaultController(this) === false) {
- throw defaultControllerBrandCheckException('error');
- }
- TransformStreamError(this._controlledTransformStream, reason);
- }
- }, {
- key: 'desiredSize',
- get: function get() {
- if (IsTransformStreamDefaultController(this) === false) {
- throw defaultControllerBrandCheckException('desiredSize');
- }
- var transformStream = this._controlledTransformStream;
- var readableController = transformStream._readableController;
- return ReadableStreamDefaultControllerGetDesiredSize(readableController);
- }
- }]);
- return TransformStreamDefaultController;
- }();
- var TransformStream = function () {
- function TransformStream() {
- var transformer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- _classCallCheck(this, TransformStream);
- this._transformer = transformer;
- var readableStrategy = transformer.readableStrategy,
- writableStrategy = transformer.writableStrategy;
- this._transforming = false;
- this._errored = false;
- this._storedError = undefined;
- this._writableController = undefined;
- this._readableController = undefined;
- this._transformStreamController = undefined;
- this._writableDone = false;
- this._readableClosed = false;
- this._backpressure = undefined;
- this._backpressureChangePromise = undefined;
- this._backpressureChangePromise_resolve = undefined;
- this._transformStreamController = new TransformStreamDefaultController(this);
- var startPromise_resolve = void 0;
- var startPromise = new Promise(function (resolve) {
- startPromise_resolve = resolve;
- });
- var source = new TransformStreamSource(this, startPromise);
- this._readable = new ReadableStream(source, readableStrategy);
- var sink = new TransformStreamSink(this, startPromise);
- this._writable = new WritableStream(sink, writableStrategy);
- assert(this._writableController !== undefined);
- assert(this._readableController !== undefined);
- var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(this._readableController);
- TransformStreamSetBackpressure(this, desiredSize <= 0);
- var transformStream = this;
- var startResult = InvokeOrNoop(transformer, 'start', [transformStream._transformStreamController]);
- startPromise_resolve(startResult);
- startPromise.catch(function (e) {
- if (transformStream._errored === false) {
- transformStream._errored = true;
- transformStream._storedError = e;
- }
- });
- }
- _createClass(TransformStream, [{
- key: 'readable',
- get: function get() {
- if (IsTransformStream(this) === false) {
- throw streamBrandCheckException('readable');
- }
- return this._readable;
- }
- }, {
- key: 'writable',
- get: function get() {
- if (IsTransformStream(this) === false) {
- throw streamBrandCheckException('writable');
- }
- return this._writable;
- }
- }]);
- return TransformStream;
- }();
- module.exports = { TransformStream: TransformStream };
- function defaultControllerBrandCheckException(name) {
- return new TypeError('TransformStreamDefaultController.prototype.' + name + ' can only be used on a TransformStreamDefaultController');
- }
- function streamBrandCheckException(name) {
- return new TypeError('TransformStream.prototype.' + name + ' can only be used on a TransformStream');
- }
-}, function (module, exports, __w_pdfjs_require__) {
- module.exports = __w_pdfjs_require__(5);
-}]));
-
-/***/ }),
-/* 127 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-{
- var isURLSupported = false;
- try {
- if (typeof URL === 'function' && _typeof(URL.prototype) === 'object' && 'origin' in URL.prototype) {
- var u = new URL('b', 'http://a');
- u.pathname = 'c%20d';
- isURLSupported = u.href === 'http://a/c%20d';
- }
- } catch (ex) {}
- if (isURLSupported) {
- exports.URL = URL;
- } else {
- var PolyfillURL = __w_pdfjs_require__(128).URL;
- var OriginalURL = __w_pdfjs_require__(3).URL;
- if (OriginalURL) {
- PolyfillURL.createObjectURL = function (blob) {
- return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
- };
- PolyfillURL.revokeObjectURL = function (url) {
- OriginalURL.revokeObjectURL(url);
- };
- }
- exports.URL = PolyfillURL;
- }
-}
-
-/***/ }),
-/* 128 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-(function URLConstructorClosure() {
- 'use strict';
-
- var relative = Object.create(null);
- relative['ftp'] = 21;
- relative['file'] = 0;
- relative['gopher'] = 70;
- relative['http'] = 80;
- relative['https'] = 443;
- relative['ws'] = 80;
- relative['wss'] = 443;
- var relativePathDotMapping = Object.create(null);
- relativePathDotMapping['%2e'] = '.';
- relativePathDotMapping['.%2e'] = '..';
- relativePathDotMapping['%2e.'] = '..';
- relativePathDotMapping['%2e%2e'] = '..';
- function isRelativeScheme(scheme) {
- return relative[scheme] !== undefined;
- }
- function invalid() {
- clear.call(this);
- this._isInvalid = true;
- }
- function IDNAToASCII(h) {
- if (h === '') {
- invalid.call(this);
- }
- return h.toLowerCase();
- }
- function percentEscape(c) {
- var unicode = c.charCodeAt(0);
- if (unicode > 0x20 && unicode < 0x7F && [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) === -1) {
- return c;
- }
- return encodeURIComponent(c);
- }
- function percentEscapeQuery(c) {
- var unicode = c.charCodeAt(0);
- if (unicode > 0x20 && unicode < 0x7F && [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) === -1) {
- return c;
- }
- return encodeURIComponent(c);
- }
- var EOF,
- ALPHA = /[a-zA-Z]/,
- ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
- function parse(input, stateOverride, base) {
- function err(message) {
- errors.push(message);
- }
- var state = stateOverride || 'scheme start',
- cursor = 0,
- buffer = '',
- seenAt = false,
- seenBracket = false,
- errors = [];
- loop: while ((input[cursor - 1] !== EOF || cursor === 0) && !this._isInvalid) {
- var c = input[cursor];
- switch (state) {
- case 'scheme start':
- if (c && ALPHA.test(c)) {
- buffer += c.toLowerCase();
- state = 'scheme';
- } else if (!stateOverride) {
- buffer = '';
- state = 'no scheme';
- continue;
- } else {
- err('Invalid scheme.');
- break loop;
- }
- break;
- case 'scheme':
- if (c && ALPHANUMERIC.test(c)) {
- buffer += c.toLowerCase();
- } else if (c === ':') {
- this._scheme = buffer;
- buffer = '';
- if (stateOverride) {
- break loop;
- }
- if (isRelativeScheme(this._scheme)) {
- this._isRelative = true;
- }
- if (this._scheme === 'file') {
- state = 'relative';
- } else if (this._isRelative && base && base._scheme === this._scheme) {
- state = 'relative or authority';
- } else if (this._isRelative) {
- state = 'authority first slash';
- } else {
- state = 'scheme data';
- }
- } else if (!stateOverride) {
- buffer = '';
- cursor = 0;
- state = 'no scheme';
- continue;
- } else if (c === EOF) {
- break loop;
- } else {
- err('Code point not allowed in scheme: ' + c);
- break loop;
- }
- break;
- case 'scheme data':
- if (c === '?') {
- this._query = '?';
- state = 'query';
- } else if (c === '#') {
- this._fragment = '#';
- state = 'fragment';
- } else {
- if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') {
- this._schemeData += percentEscape(c);
- }
- }
- break;
- case 'no scheme':
- if (!base || !isRelativeScheme(base._scheme)) {
- err('Missing scheme.');
- invalid.call(this);
- } else {
- state = 'relative';
- continue;
- }
- break;
- case 'relative or authority':
- if (c === '/' && input[cursor + 1] === '/') {
- state = 'authority ignore slashes';
- } else {
- err('Expected /, got: ' + c);
- state = 'relative';
- continue;
- }
- break;
- case 'relative':
- this._isRelative = true;
- if (this._scheme !== 'file') {
- this._scheme = base._scheme;
- }
- if (c === EOF) {
- this._host = base._host;
- this._port = base._port;
- this._path = base._path.slice();
- this._query = base._query;
- this._username = base._username;
- this._password = base._password;
- break loop;
- } else if (c === '/' || c === '\\') {
- if (c === '\\') {
- err('\\ is an invalid code point.');
- }
- state = 'relative slash';
- } else if (c === '?') {
- this._host = base._host;
- this._port = base._port;
- this._path = base._path.slice();
- this._query = '?';
- this._username = base._username;
- this._password = base._password;
- state = 'query';
- } else if (c === '#') {
- this._host = base._host;
- this._port = base._port;
- this._path = base._path.slice();
- this._query = base._query;
- this._fragment = '#';
- this._username = base._username;
- this._password = base._password;
- state = 'fragment';
- } else {
- var nextC = input[cursor + 1];
- var nextNextC = input[cursor + 2];
- if (this._scheme !== 'file' || !ALPHA.test(c) || nextC !== ':' && nextC !== '|' || nextNextC !== EOF && nextNextC !== '/' && nextNextC !== '\\' && nextNextC !== '?' && nextNextC !== '#') {
- this._host = base._host;
- this._port = base._port;
- this._username = base._username;
- this._password = base._password;
- this._path = base._path.slice();
- this._path.pop();
- }
- state = 'relative path';
- continue;
- }
- break;
- case 'relative slash':
- if (c === '/' || c === '\\') {
- if (c === '\\') {
- err('\\ is an invalid code point.');
- }
- if (this._scheme === 'file') {
- state = 'file host';
- } else {
- state = 'authority ignore slashes';
- }
- } else {
- if (this._scheme !== 'file') {
- this._host = base._host;
- this._port = base._port;
- this._username = base._username;
- this._password = base._password;
- }
- state = 'relative path';
- continue;
- }
- break;
- case 'authority first slash':
- if (c === '/') {
- state = 'authority second slash';
- } else {
- err('Expected \'/\', got: ' + c);
- state = 'authority ignore slashes';
- continue;
- }
- break;
- case 'authority second slash':
- state = 'authority ignore slashes';
- if (c !== '/') {
- err('Expected \'/\', got: ' + c);
- continue;
- }
- break;
- case 'authority ignore slashes':
- if (c !== '/' && c !== '\\') {
- state = 'authority';
- continue;
- } else {
- err('Expected authority, got: ' + c);
- }
- break;
- case 'authority':
- if (c === '@') {
- if (seenAt) {
- err('@ already seen.');
- buffer += '%40';
- }
- seenAt = true;
- for (var i = 0; i < buffer.length; i++) {
- var cp = buffer[i];
- if (cp === '\t' || cp === '\n' || cp === '\r') {
- err('Invalid whitespace in authority.');
- continue;
- }
- if (cp === ':' && this._password === null) {
- this._password = '';
- continue;
- }
- var tempC = percentEscape(cp);
- if (this._password !== null) {
- this._password += tempC;
- } else {
- this._username += tempC;
- }
- }
- buffer = '';
- } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
- cursor -= buffer.length;
- buffer = '';
- state = 'host';
- continue;
- } else {
- buffer += c;
- }
- break;
- case 'file host':
- if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
- if (buffer.length === 2 && ALPHA.test(buffer[0]) && (buffer[1] === ':' || buffer[1] === '|')) {
- state = 'relative path';
- } else if (buffer.length === 0) {
- state = 'relative path start';
- } else {
- this._host = IDNAToASCII.call(this, buffer);
- buffer = '';
- state = 'relative path start';
- }
- continue;
- } else if (c === '\t' || c === '\n' || c === '\r') {
- err('Invalid whitespace in file host.');
- } else {
- buffer += c;
- }
- break;
- case 'host':
- case 'hostname':
- if (c === ':' && !seenBracket) {
- this._host = IDNAToASCII.call(this, buffer);
- buffer = '';
- state = 'port';
- if (stateOverride === 'hostname') {
- break loop;
- }
- } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
- this._host = IDNAToASCII.call(this, buffer);
- buffer = '';
- state = 'relative path start';
- if (stateOverride) {
- break loop;
- }
- continue;
- } else if (c !== '\t' && c !== '\n' && c !== '\r') {
- if (c === '[') {
- seenBracket = true;
- } else if (c === ']') {
- seenBracket = false;
- }
- buffer += c;
- } else {
- err('Invalid code point in host/hostname: ' + c);
- }
- break;
- case 'port':
- if (/[0-9]/.test(c)) {
- buffer += c;
- } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#' || stateOverride) {
- if (buffer !== '') {
- var temp = parseInt(buffer, 10);
- if (temp !== relative[this._scheme]) {
- this._port = temp + '';
- }
- buffer = '';
- }
- if (stateOverride) {
- break loop;
- }
- state = 'relative path start';
- continue;
- } else if (c === '\t' || c === '\n' || c === '\r') {
- err('Invalid code point in port: ' + c);
- } else {
- invalid.call(this);
- }
- break;
- case 'relative path start':
- if (c === '\\') {
- err('\'\\\' not allowed in path.');
- }
- state = 'relative path';
- if (c !== '/' && c !== '\\') {
- continue;
- }
- break;
- case 'relative path':
- if (c === EOF || c === '/' || c === '\\' || !stateOverride && (c === '?' || c === '#')) {
- if (c === '\\') {
- err('\\ not allowed in relative path.');
- }
- var tmp;
- if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
- buffer = tmp;
- }
- if (buffer === '..') {
- this._path.pop();
- if (c !== '/' && c !== '\\') {
- this._path.push('');
- }
- } else if (buffer === '.' && c !== '/' && c !== '\\') {
- this._path.push('');
- } else if (buffer !== '.') {
- if (this._scheme === 'file' && this._path.length === 0 && buffer.length === 2 && ALPHA.test(buffer[0]) && buffer[1] === '|') {
- buffer = buffer[0] + ':';
- }
- this._path.push(buffer);
- }
- buffer = '';
- if (c === '?') {
- this._query = '?';
- state = 'query';
- } else if (c === '#') {
- this._fragment = '#';
- state = 'fragment';
- }
- } else if (c !== '\t' && c !== '\n' && c !== '\r') {
- buffer += percentEscape(c);
- }
- break;
- case 'query':
- if (!stateOverride && c === '#') {
- this._fragment = '#';
- state = 'fragment';
- } else if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') {
- this._query += percentEscapeQuery(c);
- }
- break;
- case 'fragment':
- if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') {
- this._fragment += c;
- }
- break;
- }
- cursor++;
- }
- }
- function clear() {
- this._scheme = '';
- this._schemeData = '';
- this._username = '';
- this._password = null;
- this._host = '';
- this._port = '';
- this._path = [];
- this._query = '';
- this._fragment = '';
- this._isInvalid = false;
- this._isRelative = false;
- }
- function JURL(url, base) {
- if (base !== undefined && !(base instanceof JURL)) {
- base = new JURL(String(base));
- }
- this._url = url;
- clear.call(this);
- var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, '');
- parse.call(this, input, null, base);
- }
- JURL.prototype = {
- toString: function toString() {
- return this.href;
- },
-
- get href() {
- if (this._isInvalid) {
- return this._url;
- }
- var authority = '';
- if (this._username !== '' || this._password !== null) {
- authority = this._username + (this._password !== null ? ':' + this._password : '') + '@';
- }
- return this.protocol + (this._isRelative ? '//' + authority + this.host : '') + this.pathname + this._query + this._fragment;
- },
- set href(value) {
- clear.call(this);
- parse.call(this, value);
- },
- get protocol() {
- return this._scheme + ':';
- },
- set protocol(value) {
- if (this._isInvalid) {
- return;
- }
- parse.call(this, value + ':', 'scheme start');
- },
- get host() {
- return this._isInvalid ? '' : this._port ? this._host + ':' + this._port : this._host;
- },
- set host(value) {
- if (this._isInvalid || !this._isRelative) {
- return;
- }
- parse.call(this, value, 'host');
- },
- get hostname() {
- return this._host;
- },
- set hostname(value) {
- if (this._isInvalid || !this._isRelative) {
- return;
- }
- parse.call(this, value, 'hostname');
- },
- get port() {
- return this._port;
- },
- set port(value) {
- if (this._isInvalid || !this._isRelative) {
- return;
- }
- parse.call(this, value, 'port');
- },
- get pathname() {
- return this._isInvalid ? '' : this._isRelative ? '/' + this._path.join('/') : this._schemeData;
- },
- set pathname(value) {
- if (this._isInvalid || !this._isRelative) {
- return;
- }
- this._path = [];
- parse.call(this, value, 'relative path start');
- },
- get search() {
- return this._isInvalid || !this._query || this._query === '?' ? '' : this._query;
- },
- set search(value) {
- if (this._isInvalid || !this._isRelative) {
- return;
- }
- this._query = '?';
- if (value[0] === '?') {
- value = value.slice(1);
- }
- parse.call(this, value, 'query');
- },
- get hash() {
- return this._isInvalid || !this._fragment || this._fragment === '#' ? '' : this._fragment;
- },
- set hash(value) {
- if (this._isInvalid) {
- return;
- }
- this._fragment = '#';
- if (value[0] === '#') {
- value = value.slice(1);
- }
- parse.call(this, value, 'fragment');
- },
- get origin() {
- var host;
- if (this._isInvalid || !this._scheme) {
- return '';
- }
- switch (this._scheme) {
- case 'data':
- case 'file':
- case 'javascript':
- case 'mailto':
- return 'null';
- case 'blob':
- try {
- return new JURL(this._schemeData).origin || 'null';
- } catch (_) {}
- return 'null';
- }
- host = this.host;
- if (!host) {
- return '';
- }
- return this._scheme + '://' + host;
- }
- };
- exports.URL = JURL;
-})();
-
-/***/ }),
-/* 129 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.build = exports.version = exports.setPDFNetworkStreamFactory = exports.PDFPageProxy = exports.PDFDocumentProxy = exports.PDFWorker = exports.PDFDataRangeTransport = exports.LoopbackPort = exports.getDocument = undefined;
-
-var _slicedToArray = function () { function sliceIterator(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"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-var _util = __w_pdfjs_require__(1);
-
-var _dom_utils = __w_pdfjs_require__(130);
-
-var _font_loader = __w_pdfjs_require__(131);
-
-var _api_compatibility = __w_pdfjs_require__(132);
-
-var _canvas = __w_pdfjs_require__(133);
-
-var _global_scope = __w_pdfjs_require__(3);
-
-var _global_scope2 = _interopRequireDefault(_global_scope);
-
-var _worker_options = __w_pdfjs_require__(135);
-
-var _message_handler = __w_pdfjs_require__(136);
-
-var _metadata = __w_pdfjs_require__(141);
-
-var _transport_stream = __w_pdfjs_require__(143);
-
-var _webgl = __w_pdfjs_require__(144);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var DEFAULT_RANGE_CHUNK_SIZE = 65536;
-var isWorkerDisabled = false;
-var fallbackWorkerSrc = void 0;
-var fakeWorkerFilesLoader = null;
-{
- var useRequireEnsure = false;
- if (typeof window === 'undefined') {
- isWorkerDisabled = true;
- if (typeof require.ensure === 'undefined') {
- require.ensure = require('node-ensure');
- }
- useRequireEnsure = true;
- } else if (typeof require !== 'undefined' && typeof require.ensure === 'function') {
- useRequireEnsure = true;
- }
- if (typeof requirejs !== 'undefined' && requirejs.toUrl) {
- fallbackWorkerSrc = requirejs.toUrl('pdfjs-dist/build/pdf.worker.js');
- }
- var dynamicLoaderSupported = typeof requirejs !== 'undefined' && requirejs.load;
- fakeWorkerFilesLoader = useRequireEnsure ? function () {
- return new Promise(function (resolve, reject) {
- require.ensure([], function () {
- try {
- var worker = void 0;
- worker = require('./pdf.worker.js');
- resolve(worker.WorkerMessageHandler);
- } catch (ex) {
- reject(ex);
- }
- }, reject, 'pdfjsWorker');
- });
- } : dynamicLoaderSupported ? function () {
- return new Promise(function (resolve, reject) {
- requirejs(['pdfjs-dist/build/pdf.worker'], function (worker) {
- try {
- resolve(worker.WorkerMessageHandler);
- } catch (ex) {
- reject(ex);
- }
- }, reject);
- });
- } : null;
- if (!fallbackWorkerSrc && typeof document !== 'undefined') {
- var pdfjsFilePath = document.currentScript && document.currentScript.src;
- if (pdfjsFilePath) {
- fallbackWorkerSrc = pdfjsFilePath.replace(/(\.(?:min\.)?js)(\?.*)?$/i, '.worker$1$2');
- }
- }
-}
-var createPDFNetworkStream;
-function setPDFNetworkStreamFactory(pdfNetworkStreamFactory) {
- createPDFNetworkStream = pdfNetworkStreamFactory;
-}
-function getDocument(src) {
- var task = new PDFDocumentLoadingTask();
- var source;
- if (typeof src === 'string') {
- source = { url: src };
- } else if ((0, _util.isArrayBuffer)(src)) {
- source = { data: src };
- } else if (src instanceof PDFDataRangeTransport) {
- source = { range: src };
- } else {
- if ((typeof src === 'undefined' ? 'undefined' : _typeof(src)) !== 'object') {
- throw new Error('Invalid parameter in getDocument, ' + 'need either Uint8Array, string or a parameter object');
- }
- if (!src.url && !src.data && !src.range) {
- throw new Error('Invalid parameter object: need either .data, .range or .url');
- }
- source = src;
- }
- var params = Object.create(null);
- var rangeTransport = null;
- var worker = null;
- for (var key in source) {
- if (key === 'url' && typeof window !== 'undefined') {
- params[key] = new _util.URL(source[key], window.location).href;
- continue;
- } else if (key === 'range') {
- rangeTransport = source[key];
- continue;
- } else if (key === 'worker') {
- worker = source[key];
- continue;
- } else if (key === 'data' && !(source[key] instanceof Uint8Array)) {
- var pdfBytes = source[key];
- if (typeof pdfBytes === 'string') {
- params[key] = (0, _util.stringToBytes)(pdfBytes);
- } else if ((typeof pdfBytes === 'undefined' ? 'undefined' : _typeof(pdfBytes)) === 'object' && pdfBytes !== null && !isNaN(pdfBytes.length)) {
- params[key] = new Uint8Array(pdfBytes);
- } else if ((0, _util.isArrayBuffer)(pdfBytes)) {
- params[key] = new Uint8Array(pdfBytes);
- } else {
- throw new Error('Invalid PDF binary data: either typed array, ' + 'string or array-like object is expected in the ' + 'data property.');
- }
- continue;
- }
- params[key] = source[key];
- }
- params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE;
- params.CMapReaderFactory = params.CMapReaderFactory || _dom_utils.DOMCMapReaderFactory;
- params.ignoreErrors = params.stopAtErrors !== true;
- params.pdfBug = params.pdfBug === true;
- var NativeImageDecoderValues = Object.values(_util.NativeImageDecoding);
- if (params.nativeImageDecoderSupport === undefined || !NativeImageDecoderValues.includes(params.nativeImageDecoderSupport)) {
- params.nativeImageDecoderSupport = _api_compatibility.apiCompatibilityParams.nativeImageDecoderSupport || _util.NativeImageDecoding.DECODE;
- }
- if (!Number.isInteger(params.maxImageSize)) {
- params.maxImageSize = -1;
- }
- if (typeof params.isEvalSupported !== 'boolean') {
- params.isEvalSupported = true;
- }
- if (typeof params.disableFontFace !== 'boolean') {
- params.disableFontFace = _api_compatibility.apiCompatibilityParams.disableFontFace || false;
- }
- if (typeof params.disableRange !== 'boolean') {
- params.disableRange = false;
- }
- if (typeof params.disableStream !== 'boolean') {
- params.disableStream = false;
- }
- if (typeof params.disableAutoFetch !== 'boolean') {
- params.disableAutoFetch = false;
- }
- if (typeof params.disableCreateObjectURL !== 'boolean') {
- params.disableCreateObjectURL = _api_compatibility.apiCompatibilityParams.disableCreateObjectURL || false;
- }
- (0, _util.setVerbosityLevel)(params.verbosity);
- if (!worker) {
- var workerParams = {
- postMessageTransfers: params.postMessageTransfers,
- verbosity: params.verbosity
- };
- var workerPort = _worker_options.GlobalWorkerOptions.workerPort;
- if (workerPort) {
- workerParams.port = workerPort;
- worker = PDFWorker.fromPort(workerParams);
- } else {
- worker = new PDFWorker(workerParams);
- }
- task._worker = worker;
- }
- var docId = task.docId;
- worker.promise.then(function () {
- if (task.destroyed) {
- throw new Error('Loading aborted');
- }
- return _fetchDocument(worker, params, rangeTransport, docId).then(function (workerId) {
- if (task.destroyed) {
- throw new Error('Loading aborted');
- }
- var networkStream = void 0;
- if (rangeTransport) {
- networkStream = new _transport_stream.PDFDataTransportStream({
- length: params.length,
- initialData: params.initialData,
- disableRange: params.disableRange,
- disableStream: params.disableStream
- }, rangeTransport);
- } else if (!params.data) {
- networkStream = createPDFNetworkStream({
- url: params.url,
- length: params.length,
- httpHeaders: params.httpHeaders,
- withCredentials: params.withCredentials,
- rangeChunkSize: params.rangeChunkSize,
- disableRange: params.disableRange,
- disableStream: params.disableStream
- });
- }
- var messageHandler = new _message_handler.MessageHandler(docId, workerId, worker.port);
- messageHandler.postMessageTransfers = worker.postMessageTransfers;
- var transport = new WorkerTransport(messageHandler, task, networkStream, params);
- task._transport = transport;
- messageHandler.send('Ready', null);
- });
- }).catch(task._capability.reject);
- return task;
-}
-function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
- if (worker.destroyed) {
- return Promise.reject(new Error('Worker was destroyed'));
- }
- if (pdfDataRangeTransport) {
- source.length = pdfDataRangeTransport.length;
- source.initialData = pdfDataRangeTransport.initialData;
- }
- return worker.messageHandler.sendWithPromise('GetDocRequest', {
- docId: docId,
- apiVersion: '2.0.943',
- source: {
- data: source.data,
- url: source.url,
- password: source.password,
- disableAutoFetch: source.disableAutoFetch,
- rangeChunkSize: source.rangeChunkSize,
- length: source.length
- },
- maxImageSize: source.maxImageSize,
- disableFontFace: source.disableFontFace,
- disableCreateObjectURL: source.disableCreateObjectURL,
- postMessageTransfers: worker.postMessageTransfers,
- docBaseUrl: source.docBaseUrl,
- nativeImageDecoderSupport: source.nativeImageDecoderSupport,
- ignoreErrors: source.ignoreErrors,
- isEvalSupported: source.isEvalSupported
- }).then(function (workerId) {
- if (worker.destroyed) {
- throw new Error('Worker was destroyed');
- }
- return workerId;
- });
-}
-var PDFDocumentLoadingTask = function PDFDocumentLoadingTaskClosure() {
- var nextDocumentId = 0;
- function PDFDocumentLoadingTask() {
- this._capability = (0, _util.createPromiseCapability)();
- this._transport = null;
- this._worker = null;
- this.docId = 'd' + nextDocumentId++;
- this.destroyed = false;
- this.onPassword = null;
- this.onProgress = null;
- this.onUnsupportedFeature = null;
- }
- PDFDocumentLoadingTask.prototype = {
- get promise() {
- return this._capability.promise;
- },
- destroy: function destroy() {
- var _this = this;
-
- this.destroyed = true;
- var transportDestroyed = !this._transport ? Promise.resolve() : this._transport.destroy();
- return transportDestroyed.then(function () {
- _this._transport = null;
- if (_this._worker) {
- _this._worker.destroy();
- _this._worker = null;
- }
- });
- },
-
- then: function PDFDocumentLoadingTask_then(onFulfilled, onRejected) {
- return this.promise.then.apply(this.promise, arguments);
- }
- };
- return PDFDocumentLoadingTask;
-}();
-
-var PDFDataRangeTransport = function () {
- function PDFDataRangeTransport(length, initialData) {
- _classCallCheck(this, PDFDataRangeTransport);
-
- this.length = length;
- this.initialData = initialData;
- this._rangeListeners = [];
- this._progressListeners = [];
- this._progressiveReadListeners = [];
- this._readyCapability = (0, _util.createPromiseCapability)();
- }
-
- _createClass(PDFDataRangeTransport, [{
- key: 'addRangeListener',
- value: function addRangeListener(listener) {
- this._rangeListeners.push(listener);
- }
- }, {
- key: 'addProgressListener',
- value: function addProgressListener(listener) {
- this._progressListeners.push(listener);
- }
- }, {
- key: 'addProgressiveReadListener',
- value: function addProgressiveReadListener(listener) {
- this._progressiveReadListeners.push(listener);
- }
- }, {
- key: 'onDataRange',
- value: function onDataRange(begin, chunk) {
- var _iteratorNormalCompletion = true;
- var _didIteratorError = false;
- var _iteratorError = undefined;
-
- try {
- for (var _iterator = this._rangeListeners[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
- var listener = _step.value;
-
- listener(begin, chunk);
- }
- } catch (err) {
- _didIteratorError = true;
- _iteratorError = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion && _iterator.return) {
- _iterator.return();
- }
- } finally {
- if (_didIteratorError) {
- throw _iteratorError;
- }
- }
- }
- }
- }, {
- key: 'onDataProgress',
- value: function onDataProgress(loaded) {
- var _this2 = this;
-
- this._readyCapability.promise.then(function () {
- var _iteratorNormalCompletion2 = true;
- var _didIteratorError2 = false;
- var _iteratorError2 = undefined;
-
- try {
- for (var _iterator2 = _this2._progressListeners[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
- var listener = _step2.value;
-
- listener(loaded);
- }
- } catch (err) {
- _didIteratorError2 = true;
- _iteratorError2 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion2 && _iterator2.return) {
- _iterator2.return();
- }
- } finally {
- if (_didIteratorError2) {
- throw _iteratorError2;
- }
- }
- }
- });
- }
- }, {
- key: 'onDataProgressiveRead',
- value: function onDataProgressiveRead(chunk) {
- var _this3 = this;
-
- this._readyCapability.promise.then(function () {
- var _iteratorNormalCompletion3 = true;
- var _didIteratorError3 = false;
- var _iteratorError3 = undefined;
-
- try {
- for (var _iterator3 = _this3._progressiveReadListeners[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
- var listener = _step3.value;
-
- listener(chunk);
- }
- } catch (err) {
- _didIteratorError3 = true;
- _iteratorError3 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion3 && _iterator3.return) {
- _iterator3.return();
- }
- } finally {
- if (_didIteratorError3) {
- throw _iteratorError3;
- }
- }
- }
- });
- }
- }, {
- key: 'transportReady',
- value: function transportReady() {
- this._readyCapability.resolve();
- }
- }, {
- key: 'requestDataRange',
- value: function requestDataRange(begin, end) {
- (0, _util.unreachable)('Abstract method PDFDataRangeTransport.requestDataRange');
- }
- }, {
- key: 'abort',
- value: function abort() {}
- }]);
-
- return PDFDataRangeTransport;
-}();
-
-var PDFDocumentProxy = function () {
- function PDFDocumentProxy(pdfInfo, transport, loadingTask) {
- _classCallCheck(this, PDFDocumentProxy);
-
- this.loadingTask = loadingTask;
- this._pdfInfo = pdfInfo;
- this._transport = transport;
- }
-
- _createClass(PDFDocumentProxy, [{
- key: 'getPage',
- value: function getPage(pageNumber) {
- return this._transport.getPage(pageNumber);
- }
- }, {
- key: 'getPageIndex',
- value: function getPageIndex(ref) {
- return this._transport.getPageIndex(ref);
- }
- }, {
- key: 'getDestinations',
- value: function getDestinations() {
- return this._transport.getDestinations();
- }
- }, {
- key: 'getDestination',
- value: function getDestination(id) {
- return this._transport.getDestination(id);
- }
- }, {
- key: 'getPageLabels',
- value: function getPageLabels() {
- return this._transport.getPageLabels();
- }
- }, {
- key: 'getPageMode',
- value: function getPageMode() {
- return this._transport.getPageMode();
- }
- }, {
- key: 'getAttachments',
- value: function getAttachments() {
- return this._transport.getAttachments();
- }
- }, {
- key: 'getJavaScript',
- value: function getJavaScript() {
- return this._transport.getJavaScript();
- }
- }, {
- key: 'getOutline',
- value: function getOutline() {
- return this._transport.getOutline();
- }
- }, {
- key: 'getPermissions',
- value: function getPermissions() {
- return this._transport.getPermissions();
- }
- }, {
- key: 'getMetadata',
- value: function getMetadata() {
- return this._transport.getMetadata();
- }
- }, {
- key: 'getData',
- value: function getData() {
- return this._transport.getData();
- }
- }, {
- key: 'getDownloadInfo',
- value: function getDownloadInfo() {
- return this._transport.downloadInfoCapability.promise;
- }
- }, {
- key: 'getStats',
- value: function getStats() {
- return this._transport.getStats();
- }
- }, {
- key: 'cleanup',
- value: function cleanup() {
- this._transport.startCleanup();
- }
- }, {
- key: 'destroy',
- value: function destroy() {
- return this.loadingTask.destroy();
- }
- }, {
- key: 'numPages',
- get: function get() {
- return this._pdfInfo.numPages;
- }
- }, {
- key: 'fingerprint',
- get: function get() {
- return this._pdfInfo.fingerprint;
- }
- }, {
- key: 'loadingParams',
- get: function get() {
- return this._transport.loadingParams;
- }
- }]);
-
- return PDFDocumentProxy;
-}();
-
-var PDFPageProxy = function PDFPageProxyClosure() {
- function PDFPageProxy(pageIndex, pageInfo, transport) {
- var pdfBug = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
-
- this.pageIndex = pageIndex;
- this._pageInfo = pageInfo;
- this.transport = transport;
- this._stats = pdfBug ? new _dom_utils.StatTimer() : _dom_utils.DummyStatTimer;
- this._pdfBug = pdfBug;
- this.commonObjs = transport.commonObjs;
- this.objs = new PDFObjects();
- this.cleanupAfterRender = false;
- this.pendingCleanup = false;
- this.intentStates = Object.create(null);
- this.destroyed = false;
- }
- PDFPageProxy.prototype = {
- get pageNumber() {
- return this.pageIndex + 1;
- },
- get rotate() {
- return this._pageInfo.rotate;
- },
- get ref() {
- return this._pageInfo.ref;
- },
- get userUnit() {
- return this._pageInfo.userUnit;
- },
- get view() {
- return this._pageInfo.view;
- },
- getViewport: function getViewport(scale) {
- var rotate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.rotate;
- var dontFlip = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
-
- return new _dom_utils.PageViewport({
- viewBox: this.view,
- scale: scale,
- rotation: rotate,
- dontFlip: dontFlip
- });
- },
-
- getAnnotations: function PDFPageProxy_getAnnotations(params) {
- var intent = params && params.intent || null;
- if (!this.annotationsPromise || this.annotationsIntent !== intent) {
- this.annotationsPromise = this.transport.getAnnotations(this.pageIndex, intent);
- this.annotationsIntent = intent;
- }
- return this.annotationsPromise;
- },
- render: function PDFPageProxy_render(params) {
- var _this4 = this;
-
- var stats = this._stats;
- stats.time('Overall');
- this.pendingCleanup = false;
- var renderingIntent = params.intent === 'print' ? 'print' : 'display';
- var canvasFactory = params.canvasFactory || new _dom_utils.DOMCanvasFactory();
- var webGLContext = new _webgl.WebGLContext({ enable: params.enableWebGL });
- if (!this.intentStates[renderingIntent]) {
- this.intentStates[renderingIntent] = Object.create(null);
- }
- var intentState = this.intentStates[renderingIntent];
- if (!intentState.displayReadyCapability) {
- intentState.receivingOperatorList = true;
- intentState.displayReadyCapability = (0, _util.createPromiseCapability)();
- intentState.operatorList = {
- fnArray: [],
- argsArray: [],
- lastChunk: false
- };
- stats.time('Page Request');
- this.transport.messageHandler.send('RenderPageRequest', {
- pageIndex: this.pageNumber - 1,
- intent: renderingIntent,
- renderInteractiveForms: params.renderInteractiveForms === true
- });
- }
- var complete = function complete(error) {
- var i = intentState.renderTasks.indexOf(internalRenderTask);
- if (i >= 0) {
- intentState.renderTasks.splice(i, 1);
- }
- if (_this4.cleanupAfterRender) {
- _this4.pendingCleanup = true;
- }
- _this4._tryCleanup();
- if (error) {
- internalRenderTask.capability.reject(error);
- } else {
- internalRenderTask.capability.resolve();
- }
- stats.timeEnd('Rendering');
- stats.timeEnd('Overall');
- };
- var internalRenderTask = new InternalRenderTask(complete, params, this.objs, this.commonObjs, intentState.operatorList, this.pageNumber, canvasFactory, webGLContext, this._pdfBug);
- internalRenderTask.useRequestAnimationFrame = renderingIntent !== 'print';
- if (!intentState.renderTasks) {
- intentState.renderTasks = [];
- }
- intentState.renderTasks.push(internalRenderTask);
- var renderTask = internalRenderTask.task;
- intentState.displayReadyCapability.promise.then(function (transparency) {
- if (_this4.pendingCleanup) {
- complete();
- return;
- }
- stats.time('Rendering');
- internalRenderTask.initializeGraphics(transparency);
- internalRenderTask.operatorListChanged();
- }).catch(complete);
- return renderTask;
- },
- getOperatorList: function PDFPageProxy_getOperatorList() {
- function operatorListChanged() {
- if (intentState.operatorList.lastChunk) {
- intentState.opListReadCapability.resolve(intentState.operatorList);
- var i = intentState.renderTasks.indexOf(opListTask);
- if (i >= 0) {
- intentState.renderTasks.splice(i, 1);
- }
- }
- }
- var renderingIntent = 'oplist';
- if (!this.intentStates[renderingIntent]) {
- this.intentStates[renderingIntent] = Object.create(null);
- }
- var intentState = this.intentStates[renderingIntent];
- var opListTask;
- if (!intentState.opListReadCapability) {
- opListTask = {};
- opListTask.operatorListChanged = operatorListChanged;
- intentState.receivingOperatorList = true;
- intentState.opListReadCapability = (0, _util.createPromiseCapability)();
- intentState.renderTasks = [];
- intentState.renderTasks.push(opListTask);
- intentState.operatorList = {
- fnArray: [],
- argsArray: [],
- lastChunk: false
- };
- this._stats.time('Page Request');
- this.transport.messageHandler.send('RenderPageRequest', {
- pageIndex: this.pageIndex,
- intent: renderingIntent
- });
- }
- return intentState.opListReadCapability.promise;
- },
- streamTextContent: function streamTextContent() {
- var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
-
- var TEXT_CONTENT_CHUNK_SIZE = 100;
- return this.transport.messageHandler.sendWithStream('GetTextContent', {
- pageIndex: this.pageNumber - 1,
- normalizeWhitespace: params.normalizeWhitespace === true,
- combineTextItems: params.disableCombineTextItems !== true
- }, {
- highWaterMark: TEXT_CONTENT_CHUNK_SIZE,
- size: function size(textContent) {
- return textContent.items.length;
- }
- });
- },
-
- getTextContent: function PDFPageProxy_getTextContent(params) {
- params = params || {};
- var readableStream = this.streamTextContent(params);
- return new Promise(function (resolve, reject) {
- function pump() {
- reader.read().then(function (_ref) {
- var _textContent$items;
-
- var value = _ref.value,
- done = _ref.done;
-
- if (done) {
- resolve(textContent);
- return;
- }
- Object.assign(textContent.styles, value.styles);
- (_textContent$items = textContent.items).push.apply(_textContent$items, _toConsumableArray(value.items));
- pump();
- }, reject);
- }
- var reader = readableStream.getReader();
- var textContent = {
- items: [],
- styles: Object.create(null)
- };
- pump();
- });
- },
- _destroy: function PDFPageProxy_destroy() {
- this.destroyed = true;
- this.transport.pageCache[this.pageIndex] = null;
- var waitOn = [];
- Object.keys(this.intentStates).forEach(function (intent) {
- if (intent === 'oplist') {
- return;
- }
- var intentState = this.intentStates[intent];
- intentState.renderTasks.forEach(function (renderTask) {
- var renderCompleted = renderTask.capability.promise.catch(function () {});
- waitOn.push(renderCompleted);
- renderTask.cancel();
- });
- }, this);
- this.objs.clear();
- this.annotationsPromise = null;
- this.pendingCleanup = false;
- return Promise.all(waitOn);
- },
- cleanup: function cleanup() {
- var resetStats = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
-
- this.pendingCleanup = true;
- this._tryCleanup(resetStats);
- },
- _tryCleanup: function _tryCleanup() {
- var resetStats = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
-
- if (!this.pendingCleanup || Object.keys(this.intentStates).some(function (intent) {
- var intentState = this.intentStates[intent];
- return intentState.renderTasks.length !== 0 || intentState.receivingOperatorList;
- }, this)) {
- return;
- }
- Object.keys(this.intentStates).forEach(function (intent) {
- delete this.intentStates[intent];
- }, this);
- this.objs.clear();
- this.annotationsPromise = null;
- if (resetStats && this._stats instanceof _dom_utils.StatTimer) {
- this._stats = new _dom_utils.StatTimer();
- }
- this.pendingCleanup = false;
- },
-
- _startRenderPage: function PDFPageProxy_startRenderPage(transparency, intent) {
- var intentState = this.intentStates[intent];
- if (intentState.displayReadyCapability) {
- intentState.displayReadyCapability.resolve(transparency);
- }
- },
- _renderPageChunk: function PDFPageProxy_renderPageChunk(operatorListChunk, intent) {
- var intentState = this.intentStates[intent];
- var i, ii;
- for (i = 0, ii = operatorListChunk.length; i < ii; i++) {
- intentState.operatorList.fnArray.push(operatorListChunk.fnArray[i]);
- intentState.operatorList.argsArray.push(operatorListChunk.argsArray[i]);
- }
- intentState.operatorList.lastChunk = operatorListChunk.lastChunk;
- for (i = 0; i < intentState.renderTasks.length; i++) {
- intentState.renderTasks[i].operatorListChanged();
- }
- if (operatorListChunk.lastChunk) {
- intentState.receivingOperatorList = false;
- this._tryCleanup();
- }
- },
- get stats() {
- return this._stats instanceof _dom_utils.StatTimer ? this._stats : null;
- }
- };
- return PDFPageProxy;
-}();
-
-var LoopbackPort = function () {
- function LoopbackPort() {
- var defer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
-
- _classCallCheck(this, LoopbackPort);
-
- this._listeners = [];
- this._defer = defer;
- this._deferred = Promise.resolve(undefined);
- }
-
- _createClass(LoopbackPort, [{
- key: 'postMessage',
- value: function postMessage(obj, transfers) {
- var _this5 = this;
-
- function cloneValue(value) {
- if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) !== 'object' || value === null) {
- return value;
- }
- if (cloned.has(value)) {
- return cloned.get(value);
- }
- var result;
- var buffer;
- if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) {
- var transferable = transfers && transfers.includes(buffer);
- if (value === buffer) {
- result = value;
- } else if (transferable) {
- result = new value.constructor(buffer, value.byteOffset, value.byteLength);
- } else {
- result = new value.constructor(value);
- }
- cloned.set(value, result);
- return result;
- }
- result = Array.isArray(value) ? [] : {};
- cloned.set(value, result);
- for (var i in value) {
- var desc,
- p = value;
- while (!(desc = Object.getOwnPropertyDescriptor(p, i))) {
- p = Object.getPrototypeOf(p);
- }
- if (typeof desc.value === 'undefined' || typeof desc.value === 'function') {
- continue;
- }
- result[i] = cloneValue(desc.value);
- }
- return result;
- }
- if (!this._defer) {
- this._listeners.forEach(function (listener) {
- listener.call(this, { data: obj });
- }, this);
- return;
- }
- var cloned = new WeakMap();
- var e = { data: cloneValue(obj) };
- this._deferred.then(function () {
- _this5._listeners.forEach(function (listener) {
- listener.call(this, e);
- }, _this5);
- });
- }
- }, {
- key: 'addEventListener',
- value: function addEventListener(name, listener) {
- this._listeners.push(listener);
- }
- }, {
- key: 'removeEventListener',
- value: function removeEventListener(name, listener) {
- var i = this._listeners.indexOf(listener);
- this._listeners.splice(i, 1);
- }
- }, {
- key: 'terminate',
- value: function terminate() {
- this._listeners = [];
- }
- }]);
-
- return LoopbackPort;
-}();
-
-var PDFWorker = function PDFWorkerClosure() {
- var nextFakeWorkerId = 0;
- function getWorkerSrc() {
- if (_worker_options.GlobalWorkerOptions.workerSrc) {
- return _worker_options.GlobalWorkerOptions.workerSrc;
- }
- if (typeof fallbackWorkerSrc !== 'undefined') {
- return fallbackWorkerSrc;
- }
- throw new Error('No "GlobalWorkerOptions.workerSrc" specified.');
- }
- function getMainThreadWorkerMessageHandler() {
- try {
- if (typeof window !== 'undefined') {
- return window.pdfjsWorker && window.pdfjsWorker.WorkerMessageHandler;
- }
- } catch (ex) {}
- return null;
- }
- var fakeWorkerFilesLoadedCapability = void 0;
- function setupFakeWorkerGlobal() {
- if (fakeWorkerFilesLoadedCapability) {
- return fakeWorkerFilesLoadedCapability.promise;
- }
- fakeWorkerFilesLoadedCapability = (0, _util.createPromiseCapability)();
- var mainWorkerMessageHandler = getMainThreadWorkerMessageHandler();
- if (mainWorkerMessageHandler) {
- fakeWorkerFilesLoadedCapability.resolve(mainWorkerMessageHandler);
- return fakeWorkerFilesLoadedCapability.promise;
- }
- var loader = fakeWorkerFilesLoader || function () {
- return (0, _dom_utils.loadScript)(getWorkerSrc()).then(function () {
- return window.pdfjsWorker.WorkerMessageHandler;
- });
- };
- loader().then(fakeWorkerFilesLoadedCapability.resolve, fakeWorkerFilesLoadedCapability.reject);
- return fakeWorkerFilesLoadedCapability.promise;
- }
- function createCDNWrapper(url) {
- var wrapper = 'importScripts(\'' + url + '\');';
- return _util.URL.createObjectURL(new Blob([wrapper]));
- }
- var pdfWorkerPorts = new WeakMap();
- function PDFWorker() {
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- _ref2$name = _ref2.name,
- name = _ref2$name === undefined ? null : _ref2$name,
- _ref2$port = _ref2.port,
- port = _ref2$port === undefined ? null : _ref2$port,
- _ref2$postMessageTran = _ref2.postMessageTransfers,
- postMessageTransfers = _ref2$postMessageTran === undefined ? true : _ref2$postMessageTran,
- _ref2$verbosity = _ref2.verbosity,
- verbosity = _ref2$verbosity === undefined ? (0, _util.getVerbosityLevel)() : _ref2$verbosity;
-
- if (port && pdfWorkerPorts.has(port)) {
- throw new Error('Cannot use more than one PDFWorker per port');
- }
- this.name = name;
- this.destroyed = false;
- this.postMessageTransfers = postMessageTransfers !== false;
- this.verbosity = verbosity;
- this._readyCapability = (0, _util.createPromiseCapability)();
- this._port = null;
- this._webWorker = null;
- this._messageHandler = null;
- if (port) {
- pdfWorkerPorts.set(port, this);
- this._initializeFromPort(port);
- return;
- }
- this._initialize();
- }
- PDFWorker.prototype = {
- get promise() {
- return this._readyCapability.promise;
- },
- get port() {
- return this._port;
- },
- get messageHandler() {
- return this._messageHandler;
- },
- _initializeFromPort: function PDFWorker_initializeFromPort(port) {
- this._port = port;
- this._messageHandler = new _message_handler.MessageHandler('main', 'worker', port);
- this._messageHandler.on('ready', function () {});
- this._readyCapability.resolve();
- },
- _initialize: function PDFWorker_initialize() {
- var _this6 = this;
-
- if (typeof Worker !== 'undefined' && !isWorkerDisabled && !getMainThreadWorkerMessageHandler()) {
- var workerSrc = getWorkerSrc();
- try {
- if (!(0, _util.isSameOrigin)(window.location.href, workerSrc)) {
- workerSrc = createCDNWrapper(new _util.URL(workerSrc, window.location).href);
- }
- var worker = new Worker(workerSrc);
- var messageHandler = new _message_handler.MessageHandler('main', 'worker', worker);
- var terminateEarly = function terminateEarly() {
- worker.removeEventListener('error', onWorkerError);
- messageHandler.destroy();
- worker.terminate();
- if (_this6.destroyed) {
- _this6._readyCapability.reject(new Error('Worker was destroyed'));
- } else {
- _this6._setupFakeWorker();
- }
- };
- var onWorkerError = function onWorkerError() {
- if (!_this6._webWorker) {
- terminateEarly();
- }
- };
- worker.addEventListener('error', onWorkerError);
- messageHandler.on('test', function (data) {
- worker.removeEventListener('error', onWorkerError);
- if (_this6.destroyed) {
- terminateEarly();
- return;
- }
- if (data && data.supportTypedArray) {
- _this6._messageHandler = messageHandler;
- _this6._port = worker;
- _this6._webWorker = worker;
- if (!data.supportTransfers) {
- _this6.postMessageTransfers = false;
- }
- _this6._readyCapability.resolve();
- messageHandler.send('configure', { verbosity: _this6.verbosity });
- } else {
- _this6._setupFakeWorker();
- messageHandler.destroy();
- worker.terminate();
- }
- });
- messageHandler.on('ready', function (data) {
- worker.removeEventListener('error', onWorkerError);
- if (_this6.destroyed) {
- terminateEarly();
- return;
- }
- try {
- sendTest();
- } catch (e) {
- _this6._setupFakeWorker();
- }
- });
- var sendTest = function sendTest() {
- var testObj = new Uint8Array([_this6.postMessageTransfers ? 255 : 0]);
- try {
- messageHandler.send('test', testObj, [testObj.buffer]);
- } catch (ex) {
- (0, _util.info)('Cannot use postMessage transfers');
- testObj[0] = 0;
- messageHandler.send('test', testObj);
- }
- };
- sendTest();
- return;
- } catch (e) {
- (0, _util.info)('The worker has been disabled.');
- }
- }
- this._setupFakeWorker();
- },
- _setupFakeWorker: function PDFWorker_setupFakeWorker() {
- var _this7 = this;
-
- if (!isWorkerDisabled) {
- (0, _util.warn)('Setting up fake worker.');
- isWorkerDisabled = true;
- }
- setupFakeWorkerGlobal().then(function (WorkerMessageHandler) {
- if (_this7.destroyed) {
- _this7._readyCapability.reject(new Error('Worker was destroyed'));
- return;
- }
- var port = new LoopbackPort();
- _this7._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;
- _this7._readyCapability.resolve();
- }).catch(function (reason) {
- _this7._readyCapability.reject(new Error('Setting up fake worker failed: "' + reason.message + '".'));
- });
- },
- destroy: function PDFWorker_destroy() {
- this.destroyed = true;
- if (this._webWorker) {
- this._webWorker.terminate();
- this._webWorker = null;
- }
- pdfWorkerPorts.delete(this._port);
- this._port = null;
- if (this._messageHandler) {
- this._messageHandler.destroy();
- this._messageHandler = null;
- }
- }
- };
- PDFWorker.fromPort = function (params) {
- if (!params || !params.port) {
- throw new Error('PDFWorker.fromPort - invalid method signature.');
- }
- if (pdfWorkerPorts.has(params.port)) {
- return pdfWorkerPorts.get(params.port);
- }
- return new PDFWorker(params);
- };
- PDFWorker.getWorkerSrc = function () {
- return getWorkerSrc();
- };
- return PDFWorker;
-}();
-
-var WorkerTransport = function () {
- function WorkerTransport(messageHandler, loadingTask, networkStream, params) {
- _classCallCheck(this, WorkerTransport);
-
- this.messageHandler = messageHandler;
- this.loadingTask = loadingTask;
- this.commonObjs = new PDFObjects();
- this.fontLoader = new _font_loader.FontLoader(loadingTask.docId);
- this._params = params;
- this.CMapReaderFactory = new params.CMapReaderFactory({
- baseUrl: params.cMapUrl,
- isCompressed: params.cMapPacked
- });
- this.destroyed = false;
- this.destroyCapability = null;
- this._passwordCapability = null;
- this._networkStream = networkStream;
- this._fullReader = null;
- this._lastProgress = null;
- this.pageCache = [];
- this.pagePromises = [];
- this.downloadInfoCapability = (0, _util.createPromiseCapability)();
- this.setupMessageHandler();
- }
-
- _createClass(WorkerTransport, [{
- key: 'destroy',
- value: function destroy() {
- var _this8 = this;
-
- if (this.destroyCapability) {
- return this.destroyCapability.promise;
- }
- this.destroyed = true;
- this.destroyCapability = (0, _util.createPromiseCapability)();
- if (this._passwordCapability) {
- this._passwordCapability.reject(new Error('Worker was destroyed during onPassword callback'));
- }
- var waitOn = [];
- this.pageCache.forEach(function (page) {
- if (page) {
- waitOn.push(page._destroy());
- }
- });
- this.pageCache = [];
- this.pagePromises = [];
- var terminated = this.messageHandler.sendWithPromise('Terminate', null);
- waitOn.push(terminated);
- Promise.all(waitOn).then(function () {
- _this8.fontLoader.clear();
- if (_this8._networkStream) {
- _this8._networkStream.cancelAllRequests();
- }
- if (_this8.messageHandler) {
- _this8.messageHandler.destroy();
- _this8.messageHandler = null;
- }
- _this8.destroyCapability.resolve();
- }, this.destroyCapability.reject);
- return this.destroyCapability.promise;
- }
- }, {
- key: 'setupMessageHandler',
- value: function setupMessageHandler() {
- var messageHandler = this.messageHandler,
- loadingTask = this.loadingTask;
-
- messageHandler.on('GetReader', function (data, sink) {
- var _this9 = this;
-
- (0, _util.assert)(this._networkStream);
- this._fullReader = this._networkStream.getFullReader();
- this._fullReader.onProgress = function (evt) {
- _this9._lastProgress = {
- loaded: evt.loaded,
- total: evt.total
- };
- };
- sink.onPull = function () {
- _this9._fullReader.read().then(function (_ref3) {
- var value = _ref3.value,
- done = _ref3.done;
-
- if (done) {
- sink.close();
- return;
- }
- (0, _util.assert)((0, _util.isArrayBuffer)(value));
- sink.enqueue(new Uint8Array(value), 1, [value]);
- }).catch(function (reason) {
- sink.error(reason);
- });
- };
- sink.onCancel = function (reason) {
- _this9._fullReader.cancel(reason);
- };
- }, this);
- messageHandler.on('ReaderHeadersReady', function (data) {
- var _this10 = 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);
- }
- fullReader.onProgress = function (evt) {
- if (loadingTask.onProgress) {
- loadingTask.onProgress({
- loaded: evt.loaded,
- total: evt.total
- });
- }
- };
- }
- headersCapability.resolve({
- isStreamingSupported: fullReader.isStreamingSupported,
- isRangeSupported: fullReader.isRangeSupported,
- contentLength: fullReader.contentLength
- });
- }, headersCapability.reject);
- return headersCapability.promise;
- }, this);
- messageHandler.on('GetRangeReader', function (data, sink) {
- (0, _util.assert)(this._networkStream);
- var rangeReader = this._networkStream.getRangeReader(data.begin, data.end);
- sink.onPull = function () {
- rangeReader.read().then(function (_ref4) {
- var value = _ref4.value,
- done = _ref4.done;
-
- if (done) {
- sink.close();
- return;
- }
- (0, _util.assert)((0, _util.isArrayBuffer)(value));
- sink.enqueue(new Uint8Array(value), 1, [value]);
- }).catch(function (reason) {
- sink.error(reason);
- });
- };
- sink.onCancel = function (reason) {
- rangeReader.cancel(reason);
- };
- }, this);
- messageHandler.on('GetDoc', function (_ref5) {
- var pdfInfo = _ref5.pdfInfo;
-
- this.numPages = pdfInfo.numPages;
- this.pdfDocument = new PDFDocumentProxy(pdfInfo, this, loadingTask);
- loadingTask._capability.resolve(this.pdfDocument);
- }, this);
- messageHandler.on('PasswordRequest', function (exception) {
- var _this11 = this;
-
- this._passwordCapability = (0, _util.createPromiseCapability)();
- if (loadingTask.onPassword) {
- var updatePassword = function updatePassword(password) {
- _this11._passwordCapability.resolve({ password: password });
- };
- try {
- loadingTask.onPassword(updatePassword, exception.code);
- } catch (ex) {
- this._passwordCapability.reject(ex);
- }
- } else {
- this._passwordCapability.reject(new _util.PasswordException(exception.message, exception.code));
- }
- return this._passwordCapability.promise;
- }, this);
- messageHandler.on('PasswordException', function (exception) {
- loadingTask._capability.reject(new _util.PasswordException(exception.message, exception.code));
- }, this);
- messageHandler.on('InvalidPDF', function (exception) {
- loadingTask._capability.reject(new _util.InvalidPDFException(exception.message));
- }, this);
- messageHandler.on('MissingPDF', function (exception) {
- loadingTask._capability.reject(new _util.MissingPDFException(exception.message));
- }, this);
- messageHandler.on('UnexpectedResponse', function (exception) {
- loadingTask._capability.reject(new _util.UnexpectedResponseException(exception.message, exception.status));
- }, this);
- messageHandler.on('UnknownError', function (exception) {
- loadingTask._capability.reject(new _util.UnknownErrorException(exception.message, exception.details));
- }, this);
- messageHandler.on('DataLoaded', function (data) {
- if (loadingTask.onProgress) {
- loadingTask.onProgress({
- loaded: data.length,
- total: data.length
- });
- }
- this.downloadInfoCapability.resolve(data);
- }, this);
- messageHandler.on('StartRenderPage', function (data) {
- if (this.destroyed) {
- return;
- }
- var page = this.pageCache[data.pageIndex];
- page._stats.timeEnd('Page Request');
- page._startRenderPage(data.transparency, data.intent);
- }, this);
- messageHandler.on('RenderPageChunk', function (data) {
- if (this.destroyed) {
- return;
- }
- var page = this.pageCache[data.pageIndex];
- page._renderPageChunk(data.operatorList, data.intent);
- }, this);
- messageHandler.on('commonobj', function (data) {
- var _this12 = this;
-
- if (this.destroyed) {
- return;
- }
-
- var _data = _slicedToArray(data, 3),
- id = _data[0],
- type = _data[1],
- exportedData = _data[2];
-
- if (this.commonObjs.hasData(id)) {
- return;
- }
- switch (type) {
- case 'Font':
- var params = this._params;
- if ('error' in exportedData) {
- var exportedError = exportedData.error;
- (0, _util.warn)('Error during font loading: ' + exportedError);
- this.commonObjs.resolve(id, exportedError);
- break;
- }
- var fontRegistry = null;
- if (params.pdfBug && _global_scope2.default.FontInspector && _global_scope2.default.FontInspector.enabled) {
- fontRegistry = {
- registerFont: function registerFont(font, url) {
- _global_scope2.default['FontInspector'].fontAdded(font, url);
- }
- };
- }
- var font = new _font_loader.FontFaceObject(exportedData, {
- isEvalSupported: params.isEvalSupported,
- disableFontFace: params.disableFontFace,
- ignoreErrors: params.ignoreErrors,
- onUnsupportedFeature: this._onUnsupportedFeature.bind(this),
- fontRegistry: fontRegistry
- });
- var fontReady = function fontReady(fontObjs) {
- _this12.commonObjs.resolve(id, font);
- };
- this.fontLoader.bind([font], fontReady);
- break;
- case 'FontPath':
- this.commonObjs.resolve(id, exportedData);
- break;
- default:
- throw new Error('Got unknown common object type ' + type);
- }
- }, this);
- messageHandler.on('obj', function (data) {
- if (this.destroyed) {
- return;
- }
-
- var _data2 = _slicedToArray(data, 4),
- id = _data2[0],
- pageIndex = _data2[1],
- type = _data2[2],
- imageData = _data2[3];
-
- var pageProxy = this.pageCache[pageIndex];
- if (pageProxy.objs.hasData(id)) {
- return;
- }
- switch (type) {
- case 'JpegStream':
- return new Promise(function (resolve, reject) {
- var img = new Image();
- img.onload = function () {
- resolve(img);
- };
- img.onerror = function () {
- reject(new Error('Error during JPEG image loading'));
- };
- img.src = imageData;
- }).then(function (img) {
- pageProxy.objs.resolve(id, img);
- });
- case 'Image':
- pageProxy.objs.resolve(id, imageData);
- var MAX_IMAGE_SIZE_TO_STORE = 8000000;
- if (imageData && 'data' in imageData && imageData.data.length > MAX_IMAGE_SIZE_TO_STORE) {
- pageProxy.cleanupAfterRender = true;
- }
- break;
- default:
- throw new Error('Got unknown object type ' + type);
- }
- }, this);
- messageHandler.on('DocProgress', function (data) {
- if (this.destroyed) {
- return;
- }
- if (loadingTask.onProgress) {
- loadingTask.onProgress({
- loaded: data.loaded,
- total: data.total
- });
- }
- }, this);
- messageHandler.on('PageError', function (data) {
- if (this.destroyed) {
- return;
- }
- var page = this.pageCache[data.pageNum - 1];
- var intentState = page.intentStates[data.intent];
- if (intentState.displayReadyCapability) {
- intentState.displayReadyCapability.reject(data.error);
- } else {
- throw new Error(data.error);
- }
- if (intentState.operatorList) {
- intentState.operatorList.lastChunk = true;
- for (var i = 0; i < intentState.renderTasks.length; i++) {
- intentState.renderTasks[i].operatorListChanged();
- }
- }
- }, this);
- messageHandler.on('UnsupportedFeature', this._onUnsupportedFeature, this);
- messageHandler.on('JpegDecode', function (data) {
- if (this.destroyed) {
- return Promise.reject(new Error('Worker was destroyed'));
- }
- if (typeof document === 'undefined') {
- return Promise.reject(new Error('"document" is not defined.'));
- }
-
- var _data3 = _slicedToArray(data, 2),
- imageUrl = _data3[0],
- components = _data3[1];
-
- if (components !== 3 && components !== 1) {
- return Promise.reject(new Error('Only 3 components or 1 component can be returned'));
- }
- return new Promise(function (resolve, reject) {
- var img = new Image();
- img.onload = function () {
- var width = img.width;
- var height = img.height;
- var size = width * height;
- var rgbaLength = size * 4;
- var buf = new Uint8ClampedArray(size * components);
- var tmpCanvas = document.createElement('canvas');
- tmpCanvas.width = width;
- tmpCanvas.height = height;
- var tmpCtx = tmpCanvas.getContext('2d');
- tmpCtx.drawImage(img, 0, 0);
- var data = tmpCtx.getImageData(0, 0, width, height).data;
- if (components === 3) {
- for (var i = 0, j = 0; i < rgbaLength; i += 4, j += 3) {
- buf[j] = data[i];
- buf[j + 1] = data[i + 1];
- buf[j + 2] = data[i + 2];
- }
- } else if (components === 1) {
- for (var _i = 0, _j = 0; _i < rgbaLength; _i += 4, _j++) {
- buf[_j] = data[_i];
- }
- }
- resolve({
- data: buf,
- width: width,
- height: height
- });
- };
- img.onerror = function () {
- reject(new Error('JpegDecode failed to load image'));
- };
- img.src = imageUrl;
- });
- }, this);
- messageHandler.on('FetchBuiltInCMap', function (data) {
- if (this.destroyed) {
- return Promise.reject(new Error('Worker was destroyed'));
- }
- return this.CMapReaderFactory.fetch({ name: data.name });
- }, this);
- }
- }, {
- key: '_onUnsupportedFeature',
- value: function _onUnsupportedFeature(_ref6) {
- var featureId = _ref6.featureId;
-
- if (this.destroyed) {
- return;
- }
- if (this.loadingTask.onUnsupportedFeature) {
- this.loadingTask.onUnsupportedFeature(featureId);
- }
- }
- }, {
- key: 'getData',
- value: function getData() {
- return this.messageHandler.sendWithPromise('GetData', null);
- }
- }, {
- key: 'getPage',
- value: function getPage(pageNumber) {
- var _this13 = this;
-
- if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this.numPages) {
- return Promise.reject(new Error('Invalid page request'));
- }
- var pageIndex = pageNumber - 1;
- if (pageIndex in this.pagePromises) {
- return this.pagePromises[pageIndex];
- }
- var promise = this.messageHandler.sendWithPromise('GetPage', { pageIndex: pageIndex }).then(function (pageInfo) {
- if (_this13.destroyed) {
- throw new Error('Transport destroyed');
- }
- var page = new PDFPageProxy(pageIndex, pageInfo, _this13, _this13._params.pdfBug);
- _this13.pageCache[pageIndex] = page;
- return page;
- });
- this.pagePromises[pageIndex] = promise;
- return promise;
- }
- }, {
- key: 'getPageIndex',
- value: function getPageIndex(ref) {
- return this.messageHandler.sendWithPromise('GetPageIndex', { ref: ref }).catch(function (reason) {
- return Promise.reject(new Error(reason));
- });
- }
- }, {
- key: 'getAnnotations',
- value: function getAnnotations(pageIndex, intent) {
- return this.messageHandler.sendWithPromise('GetAnnotations', {
- pageIndex: pageIndex,
- intent: intent
- });
- }
- }, {
- key: 'getDestinations',
- value: function getDestinations() {
- return this.messageHandler.sendWithPromise('GetDestinations', null);
- }
- }, {
- key: 'getDestination',
- value: function getDestination(id) {
- if (typeof id !== 'string') {
- return Promise.reject(new Error('Invalid destination request.'));
- }
- return this.messageHandler.sendWithPromise('GetDestination', { id: id });
- }
- }, {
- key: 'getPageLabels',
- value: function getPageLabels() {
- return this.messageHandler.sendWithPromise('GetPageLabels', null);
- }
- }, {
- key: 'getPageMode',
- value: function getPageMode() {
- return this.messageHandler.sendWithPromise('GetPageMode', null);
- }
- }, {
- key: 'getAttachments',
- value: function getAttachments() {
- return this.messageHandler.sendWithPromise('GetAttachments', null);
- }
- }, {
- key: 'getJavaScript',
- value: function getJavaScript() {
- return this.messageHandler.sendWithPromise('GetJavaScript', null);
- }
- }, {
- key: 'getOutline',
- value: function getOutline() {
- return this.messageHandler.sendWithPromise('GetOutline', null);
- }
- }, {
- key: 'getPermissions',
- value: function getPermissions() {
- return this.messageHandler.sendWithPromise('GetPermissions', null);
- }
- }, {
- key: 'getMetadata',
- value: function getMetadata() {
- var _this14 = 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
- };
- });
- }
- }, {
- key: 'getStats',
- value: function getStats() {
- return this.messageHandler.sendWithPromise('GetStats', null);
- }
- }, {
- key: 'startCleanup',
- value: function startCleanup() {
- var _this15 = this;
-
- this.messageHandler.sendWithPromise('Cleanup', null).then(function () {
- for (var i = 0, ii = _this15.pageCache.length; i < ii; i++) {
- var page = _this15.pageCache[i];
- if (page) {
- page.cleanup();
- }
- }
- _this15.commonObjs.clear();
- _this15.fontLoader.clear();
- });
- }
- }, {
- key: 'loadingParams',
- get: function get() {
- var params = this._params;
- return (0, _util.shadow)(this, 'loadingParams', {
- disableAutoFetch: params.disableAutoFetch,
- disableCreateObjectURL: params.disableCreateObjectURL,
- disableFontFace: params.disableFontFace,
- nativeImageDecoderSupport: params.nativeImageDecoderSupport
- });
- }
- }]);
-
- return WorkerTransport;
-}();
-
-var PDFObjects = function PDFObjectsClosure() {
- function PDFObjects() {
- this.objs = Object.create(null);
- }
- PDFObjects.prototype = {
- ensureObj: function PDFObjects_ensureObj(objId) {
- if (this.objs[objId]) {
- return this.objs[objId];
- }
- var obj = {
- capability: (0, _util.createPromiseCapability)(),
- data: null,
- resolved: false
- };
- this.objs[objId] = obj;
- return obj;
- },
- get: function PDFObjects_get(objId, callback) {
- if (callback) {
- this.ensureObj(objId).capability.promise.then(callback);
- return null;
- }
- var obj = this.objs[objId];
- if (!obj || !obj.resolved) {
- throw new Error('Requesting object that isn\'t resolved yet ' + objId);
- }
- return obj.data;
- },
- resolve: function PDFObjects_resolve(objId, data) {
- var obj = this.ensureObj(objId);
- obj.resolved = true;
- obj.data = data;
- obj.capability.resolve(data);
- },
- isResolved: function PDFObjects_isResolved(objId) {
- var objs = this.objs;
- if (!objs[objId]) {
- return false;
- }
- return objs[objId].resolved;
- },
- hasData: function PDFObjects_hasData(objId) {
- return this.isResolved(objId);
- },
- getData: function PDFObjects_getData(objId) {
- var objs = this.objs;
- if (!objs[objId] || !objs[objId].resolved) {
- return null;
- }
- return objs[objId].data;
- },
- clear: function PDFObjects_clear() {
- this.objs = Object.create(null);
- }
- };
- return PDFObjects;
-}();
-var RenderTask = function RenderTaskClosure() {
- function RenderTask(internalRenderTask) {
- this._internalRenderTask = internalRenderTask;
- this.onContinue = null;
- }
- RenderTask.prototype = {
- get promise() {
- return this._internalRenderTask.capability.promise;
- },
- cancel: function RenderTask_cancel() {
- this._internalRenderTask.cancel();
- },
- then: function RenderTask_then(onFulfilled, onRejected) {
- return this.promise.then.apply(this.promise, arguments);
- }
- };
- return RenderTask;
-}();
-var InternalRenderTask = function InternalRenderTaskClosure() {
- var canvasInRendering = new WeakMap();
- function InternalRenderTask(callback, params, objs, commonObjs, operatorList, pageNumber, canvasFactory, webGLContext) {
- var pdfBug = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
-
- this.callback = callback;
- this.params = params;
- this.objs = objs;
- this.commonObjs = commonObjs;
- this.operatorListIdx = null;
- this.operatorList = operatorList;
- this.pageNumber = pageNumber;
- this.canvasFactory = canvasFactory;
- this.webGLContext = webGLContext;
- this._pdfBug = pdfBug;
- this.running = false;
- this.graphicsReadyCallback = null;
- this.graphicsReady = false;
- this.useRequestAnimationFrame = false;
- this.cancelled = false;
- this.capability = (0, _util.createPromiseCapability)();
- this.task = new RenderTask(this);
- this._continueBound = this._continue.bind(this);
- this._scheduleNextBound = this._scheduleNext.bind(this);
- this._nextBound = this._next.bind(this);
- this._canvas = params.canvasContext.canvas;
- }
- InternalRenderTask.prototype = {
- initializeGraphics: function initializeGraphics(transparency) {
- if (this.cancelled) {
- return;
- }
- if (this._canvas) {
- if (canvasInRendering.has(this._canvas)) {
- throw new Error('Cannot use the same canvas during multiple render() operations. ' + 'Use different canvas or ensure previous operations were ' + 'cancelled or completed.');
- }
- canvasInRendering.set(this._canvas, this);
- }
- if (this._pdfBug && _global_scope2.default.StepperManager && _global_scope2.default.StepperManager.enabled) {
- this.stepper = _global_scope2.default.StepperManager.create(this.pageNumber - 1);
- this.stepper.init(this.operatorList);
- this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();
- }
- var params = this.params;
- this.gfx = new _canvas.CanvasGraphics(params.canvasContext, this.commonObjs, this.objs, this.canvasFactory, this.webGLContext, params.imageLayer);
- this.gfx.beginDrawing({
- transform: params.transform,
- viewport: params.viewport,
- transparency: transparency,
- background: params.background
- });
- this.operatorListIdx = 0;
- this.graphicsReady = true;
- if (this.graphicsReadyCallback) {
- this.graphicsReadyCallback();
- }
- },
-
- cancel: function InternalRenderTask_cancel() {
- this.running = false;
- this.cancelled = true;
- if (this._canvas) {
- canvasInRendering.delete(this._canvas);
- }
- this.callback(new _dom_utils.RenderingCancelledException('Rendering cancelled, page ' + this.pageNumber, 'canvas'));
- },
- operatorListChanged: function InternalRenderTask_operatorListChanged() {
- if (!this.graphicsReady) {
- if (!this.graphicsReadyCallback) {
- this.graphicsReadyCallback = this._continueBound;
- }
- return;
- }
- if (this.stepper) {
- this.stepper.updateOperatorList(this.operatorList);
- }
- if (this.running) {
- return;
- }
- this._continue();
- },
- _continue: function InternalRenderTask__continue() {
- this.running = true;
- if (this.cancelled) {
- return;
- }
- if (this.task.onContinue) {
- this.task.onContinue(this._scheduleNextBound);
- } else {
- this._scheduleNext();
- }
- },
- _scheduleNext: function InternalRenderTask__scheduleNext() {
- var _this16 = this;
-
- if (this.useRequestAnimationFrame && typeof window !== 'undefined') {
- window.requestAnimationFrame(function () {
- _this16._nextBound().catch(_this16.callback);
- });
- } else {
- Promise.resolve().then(this._nextBound).catch(this.callback);
- }
- },
- _next: function InternalRenderTask__next() {
- var _this17 = this;
-
- return new Promise(function () {
- if (_this17.cancelled) {
- return;
- }
- _this17.operatorListIdx = _this17.gfx.executeOperatorList(_this17.operatorList, _this17.operatorListIdx, _this17._continueBound, _this17.stepper);
- if (_this17.operatorListIdx === _this17.operatorList.argsArray.length) {
- _this17.running = false;
- if (_this17.operatorList.lastChunk) {
- _this17.gfx.endDrawing();
- if (_this17._canvas) {
- canvasInRendering.delete(_this17._canvas);
- }
- _this17.callback();
- }
- }
- });
- }
- };
- return InternalRenderTask;
-}();
-var version, build;
-{
- exports.version = version = '2.0.943';
- exports.build = build = 'dc98bf76';
-}
-exports.getDocument = getDocument;
-exports.LoopbackPort = LoopbackPort;
-exports.PDFDataRangeTransport = PDFDataRangeTransport;
-exports.PDFWorker = PDFWorker;
-exports.PDFDocumentProxy = PDFDocumentProxy;
-exports.PDFPageProxy = PDFPageProxy;
-exports.setPDFNetworkStreamFactory = setPDFNetworkStreamFactory;
-exports.version = version;
-exports.build = build;
-
-/***/ }),
-/* 130 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.loadScript = exports.DummyStatTimer = exports.StatTimer = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.LinkTarget = exports.getFilenameFromUrl = exports.addLinkAttributes = exports.RenderingCancelledException = exports.PageViewport = undefined;
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _util = __w_pdfjs_require__(1);
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var DEFAULT_LINK_REL = 'noopener noreferrer nofollow';
-var SVG_NS = 'http://www.w3.org/2000/svg';
-
-var DOMCanvasFactory = function () {
- function DOMCanvasFactory() {
- _classCallCheck(this, DOMCanvasFactory);
- }
-
- _createClass(DOMCanvasFactory, [{
- key: 'create',
- value: function create(width, height) {
- if (width <= 0 || height <= 0) {
- throw new Error('invalid canvas size');
- }
- var canvas = document.createElement('canvas');
- var context = canvas.getContext('2d');
- canvas.width = width;
- canvas.height = height;
- return {
- canvas: canvas,
- context: context
- };
- }
- }, {
- key: 'reset',
- value: function reset(canvasAndContext, width, height) {
- if (!canvasAndContext.canvas) {
- throw new Error('canvas is not specified');
- }
- if (width <= 0 || height <= 0) {
- throw new Error('invalid canvas size');
- }
- canvasAndContext.canvas.width = width;
- canvasAndContext.canvas.height = height;
- }
- }, {
- key: 'destroy',
- value: function destroy(canvasAndContext) {
- if (!canvasAndContext.canvas) {
- throw new Error('canvas is not specified');
- }
- canvasAndContext.canvas.width = 0;
- canvasAndContext.canvas.height = 0;
- canvasAndContext.canvas = null;
- canvasAndContext.context = null;
- }
- }]);
-
- return DOMCanvasFactory;
-}();
-
-var DOMCMapReaderFactory = function () {
- function DOMCMapReaderFactory(_ref) {
- var _ref$baseUrl = _ref.baseUrl,
- baseUrl = _ref$baseUrl === undefined ? null : _ref$baseUrl,
- _ref$isCompressed = _ref.isCompressed,
- isCompressed = _ref$isCompressed === undefined ? false : _ref$isCompressed;
-
- _classCallCheck(this, DOMCMapReaderFactory);
-
- this.baseUrl = baseUrl;
- this.isCompressed = isCompressed;
- }
-
- _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.'));
- }
- if (!name) {
- return Promise.reject(new Error('CMap name must be specified.'));
- }
- return new Promise(function (resolve, reject) {
- var url = _this.baseUrl + name + (_this.isCompressed ? '.bcmap' : '');
- 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 data = void 0;
- if (_this.isCompressed && request.response) {
- data = new Uint8Array(request.response);
- } else if (!_this.isCompressed && request.responseText) {
- data = (0, _util.stringToBytes)(request.responseText);
- }
- if (data) {
- resolve({
- cMapData: data,
- compressionType: _this.isCompressed ? _util.CMapCompressionType.BINARY : _util.CMapCompressionType.NONE
- });
- return;
- }
- }
- reject(new Error('Unable to load ' + (_this.isCompressed ? 'binary ' : '') + 'CMap at: ' + url));
- };
- request.send(null);
- });
- }
- }]);
-
- return DOMCMapReaderFactory;
-}();
-
-var DOMSVGFactory = function () {
- function DOMSVGFactory() {
- _classCallCheck(this, DOMSVGFactory);
- }
-
- _createClass(DOMSVGFactory, [{
- key: 'create',
- value: function create(width, height) {
- (0, _util.assert)(width > 0 && height > 0, 'Invalid SVG dimensions');
- var svg = document.createElementNS(SVG_NS, 'svg:svg');
- svg.setAttribute('version', '1.1');
- svg.setAttribute('width', width + 'px');
- svg.setAttribute('height', height + 'px');
- svg.setAttribute('preserveAspectRatio', 'none');
- svg.setAttribute('viewBox', '0 0 ' + width + ' ' + height);
- return svg;
- }
- }, {
- key: 'createElement',
- value: function createElement(type) {
- (0, _util.assert)(typeof type === 'string', 'Invalid SVG element type');
- return document.createElementNS(SVG_NS, type);
- }
- }]);
-
- return DOMSVGFactory;
-}();
-
-var PageViewport = function () {
- function PageViewport(_ref3) {
- var viewBox = _ref3.viewBox,
- scale = _ref3.scale,
- rotation = _ref3.rotation,
- _ref3$offsetX = _ref3.offsetX,
- offsetX = _ref3$offsetX === undefined ? 0 : _ref3$offsetX,
- _ref3$offsetY = _ref3.offsetY,
- offsetY = _ref3$offsetY === undefined ? 0 : _ref3$offsetY,
- _ref3$dontFlip = _ref3.dontFlip,
- dontFlip = _ref3$dontFlip === undefined ? false : _ref3$dontFlip;
-
- _classCallCheck(this, PageViewport);
-
- this.viewBox = viewBox;
- this.scale = scale;
- this.rotation = rotation;
- this.offsetX = offsetX;
- this.offsetY = offsetY;
- var centerX = (viewBox[2] + viewBox[0]) / 2;
- var centerY = (viewBox[3] + viewBox[1]) / 2;
- var rotateA = void 0,
- rotateB = void 0,
- rotateC = void 0,
- rotateD = void 0;
- rotation = rotation % 360;
- rotation = rotation < 0 ? rotation + 360 : rotation;
- switch (rotation) {
- case 180:
- rotateA = -1;
- rotateB = 0;
- rotateC = 0;
- rotateD = 1;
- break;
- case 90:
- rotateA = 0;
- rotateB = 1;
- rotateC = 1;
- rotateD = 0;
- break;
- case 270:
- rotateA = 0;
- rotateB = -1;
- rotateC = -1;
- rotateD = 0;
- break;
- default:
- rotateA = 1;
- rotateB = 0;
- rotateC = 0;
- rotateD = -1;
- break;
- }
- if (dontFlip) {
- rotateC = -rotateC;
- rotateD = -rotateD;
- }
- var offsetCanvasX = void 0,
- offsetCanvasY = void 0;
- var width = void 0,
- height = void 0;
- if (rotateA === 0) {
- offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
- offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
- width = Math.abs(viewBox[3] - viewBox[1]) * scale;
- height = Math.abs(viewBox[2] - viewBox[0]) * scale;
- } else {
- offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
- offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
- width = Math.abs(viewBox[2] - viewBox[0]) * scale;
- height = Math.abs(viewBox[3] - viewBox[1]) * scale;
- }
- this.transform = [rotateA * scale, rotateB * scale, rotateC * scale, rotateD * scale, offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY];
- this.width = width;
- this.height = height;
- }
-
- _createClass(PageViewport, [{
- key: 'clone',
- value: function clone() {
- var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- _ref4$scale = _ref4.scale,
- scale = _ref4$scale === undefined ? this.scale : _ref4$scale,
- _ref4$rotation = _ref4.rotation,
- rotation = _ref4$rotation === undefined ? this.rotation : _ref4$rotation,
- _ref4$dontFlip = _ref4.dontFlip,
- dontFlip = _ref4$dontFlip === undefined ? false : _ref4$dontFlip;
-
- return new PageViewport({
- viewBox: this.viewBox.slice(),
- scale: scale,
- rotation: rotation,
- offsetX: this.offsetX,
- offsetY: this.offsetY,
- dontFlip: dontFlip
- });
- }
- }, {
- key: 'convertToViewportPoint',
- value: function convertToViewportPoint(x, y) {
- return _util.Util.applyTransform([x, y], this.transform);
- }
- }, {
- key: 'convertToViewportRectangle',
- value: function convertToViewportRectangle(rect) {
- var tl = _util.Util.applyTransform([rect[0], rect[1]], this.transform);
- var br = _util.Util.applyTransform([rect[2], rect[3]], this.transform);
- return [tl[0], tl[1], br[0], br[1]];
- }
- }, {
- key: 'convertToPdfPoint',
- value: function convertToPdfPoint(x, y) {
- return _util.Util.applyInverseTransform([x, y], this.transform);
- }
- }]);
-
- return PageViewport;
-}();
-
-var RenderingCancelledException = function RenderingCancelledException() {
- function RenderingCancelledException(msg, type) {
- this.message = msg;
- this.type = type;
- }
- RenderingCancelledException.prototype = new Error();
- RenderingCancelledException.prototype.name = 'RenderingCancelledException';
- RenderingCancelledException.constructor = RenderingCancelledException;
- return RenderingCancelledException;
-}();
-var LinkTarget = {
- NONE: 0,
- SELF: 1,
- BLANK: 2,
- PARENT: 3,
- TOP: 4
-};
-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;
-
- link.href = link.title = url ? (0, _util.removeNullCharacters)(url) : '';
- if (url) {
- var LinkTargetValues = Object.values(LinkTarget);
- var targetIndex = LinkTargetValues.includes(target) ? target : LinkTarget.NONE;
- link.target = LinkTargetStringMap[targetIndex];
- link.rel = typeof rel === 'string' ? rel : DEFAULT_LINK_REL;
- }
-}
-function getFilenameFromUrl(url) {
- var anchor = url.indexOf('#');
- var query = url.indexOf('?');
- var end = Math.min(anchor > 0 ? anchor : url.length, query > 0 ? query : url.length);
- return url.substring(url.lastIndexOf('/', end) + 1, end);
-}
-
-var StatTimer = function () {
- function StatTimer() {
- var enable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
-
- _classCallCheck(this, StatTimer);
-
- this.enabled = !!enable;
- this.started = Object.create(null);
- this.times = [];
- }
-
- _createClass(StatTimer, [{
- key: 'time',
- value: function time(name) {
- if (!this.enabled) {
- return;
- }
- if (name in this.started) {
- (0, _util.warn)('Timer is already running for ' + name);
- }
- this.started[name] = Date.now();
- }
- }, {
- key: 'timeEnd',
- value: function timeEnd(name) {
- if (!this.enabled) {
- return;
- }
- if (!(name in this.started)) {
- (0, _util.warn)('Timer has not been started for ' + name);
- }
- this.times.push({
- 'name': name,
- 'start': this.started[name],
- 'end': Date.now()
- });
- delete this.started[name];
- }
- }, {
- key: 'toString',
- value: function toString() {
- var times = this.times;
- var out = '',
- longest = 0;
- for (var i = 0, ii = times.length; i < ii; ++i) {
- var name = times[i]['name'];
- if (name.length > longest) {
- longest = name.length;
- }
- }
- for (var _i = 0, _ii = times.length; _i < _ii; ++_i) {
- var span = times[_i];
- var duration = span.end - span.start;
- out += span['name'].padEnd(longest) + ' ' + duration + 'ms\n';
- }
- return out;
- }
- }]);
-
- return StatTimer;
-}();
-
-var DummyStatTimer = function () {
- function DummyStatTimer() {
- _classCallCheck(this, DummyStatTimer);
-
- (0, _util.unreachable)('Cannot initialize DummyStatTimer.');
- }
-
- _createClass(DummyStatTimer, null, [{
- key: 'time',
- value: function time(name) {}
- }, {
- key: 'timeEnd',
- value: function timeEnd(name) {}
- }, {
- key: 'toString',
- value: function toString() {
- return '';
- }
- }]);
-
- return DummyStatTimer;
-}();
-
-function loadScript(src) {
- return new Promise(function (resolve, reject) {
- var script = document.createElement('script');
- script.src = src;
- script.onload = resolve;
- script.onerror = function () {
- reject(new Error('Cannot load script at: ' + script.src));
- };
- (document.head || document.documentElement).appendChild(script);
- });
-}
-exports.PageViewport = PageViewport;
-exports.RenderingCancelledException = RenderingCancelledException;
-exports.addLinkAttributes = addLinkAttributes;
-exports.getFilenameFromUrl = getFilenameFromUrl;
-exports.LinkTarget = LinkTarget;
-exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL;
-exports.DOMCanvasFactory = DOMCanvasFactory;
-exports.DOMCMapReaderFactory = DOMCMapReaderFactory;
-exports.DOMSVGFactory = DOMSVGFactory;
-exports.StatTimer = StatTimer;
-exports.DummyStatTimer = DummyStatTimer;
-exports.loadScript = loadScript;
-
-/***/ }),
-/* 131 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.FontLoader = exports.FontFaceObject = undefined;
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _util = __w_pdfjs_require__(1);
-
-function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
-
-function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var BaseFontLoader = function () {
- function BaseFontLoader(docId) {
- _classCallCheck(this, BaseFontLoader);
-
- if (this.constructor === BaseFontLoader) {
- (0, _util.unreachable)('Cannot initialize BaseFontLoader.');
- }
- this.docId = docId;
- this.nativeFontFaces = [];
- this.styleElement = null;
- this.loadingContext = {
- requests: [],
- nextRequestId: 0
- };
- }
-
- _createClass(BaseFontLoader, [{
- key: 'addNativeFontFace',
- value: function addNativeFontFace(nativeFontFace) {
- this.nativeFontFaces.push(nativeFontFace);
- document.fonts.add(nativeFontFace);
- }
- }, {
- key: 'insertRule',
- value: function insertRule(rule) {
- var styleElement = this.styleElement;
- if (!styleElement) {
- styleElement = this.styleElement = document.createElement('style');
- styleElement.id = 'PDFJS_FONT_STYLE_TAG_' + this.docId;
- document.documentElement.getElementsByTagName('head')[0].appendChild(styleElement);
- }
- var styleSheet = styleElement.sheet;
- styleSheet.insertRule(rule, styleSheet.cssRules.length);
- }
- }, {
- key: 'clear',
- value: function clear() {
- this.nativeFontFaces.forEach(function (nativeFontFace) {
- document.fonts.delete(nativeFontFace);
- });
- this.nativeFontFaces.length = 0;
- if (this.styleElement) {
- this.styleElement.remove();
- this.styleElement = null;
- }
- }
- }, {
- key: 'bind',
- value: function bind(fonts, callback) {
- var rules = [];
- var fontsToLoad = [];
- var fontLoadPromises = [];
- var getNativeFontPromise = function getNativeFontPromise(nativeFontFace) {
- return nativeFontFace.loaded.catch(function (reason) {
- (0, _util.warn)('Failed to load font "' + nativeFontFace.family + '": ' + reason);
- });
- };
- var _iteratorNormalCompletion = true;
- var _didIteratorError = false;
- var _iteratorError = undefined;
-
- try {
- for (var _iterator = fonts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
- var font = _step.value;
-
- if (font.attached || font.missingFile) {
- continue;
- }
- font.attached = true;
- if (this.isFontLoadingAPISupported) {
- var nativeFontFace = font.createNativeFontFace();
- if (nativeFontFace) {
- this.addNativeFontFace(nativeFontFace);
- fontLoadPromises.push(getNativeFontPromise(nativeFontFace));
- }
- } else {
- var rule = font.createFontFaceRule();
- if (rule) {
- this.insertRule(rule);
- rules.push(rule);
- fontsToLoad.push(font);
- }
- }
- }
- } catch (err) {
- _didIteratorError = true;
- _iteratorError = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion && _iterator.return) {
- _iterator.return();
- }
- } finally {
- if (_didIteratorError) {
- throw _iteratorError;
- }
- }
- }
-
- var request = this._queueLoadingCallback(callback);
- if (this.isFontLoadingAPISupported) {
- Promise.all(fontLoadPromises).then(request.complete);
- } else if (rules.length > 0 && !this.isSyncFontLoadingSupported) {
- this._prepareFontLoadEvent(rules, fontsToLoad, request);
- } else {
- request.complete();
- }
- }
- }, {
- key: '_queueLoadingCallback',
- value: function _queueLoadingCallback(callback) {
- function completeRequest() {
- (0, _util.assert)(!request.done, 'completeRequest() cannot be called twice.');
- request.done = true;
- while (context.requests.length > 0 && context.requests[0].done) {
- var otherRequest = context.requests.shift();
- setTimeout(otherRequest.callback, 0);
- }
- }
- var context = this.loadingContext;
- var request = {
- id: 'pdfjs-font-loading-' + context.nextRequestId++,
- done: false,
- complete: completeRequest,
- callback: callback
- };
- context.requests.push(request);
- return request;
- }
- }, {
- key: '_prepareFontLoadEvent',
- value: function _prepareFontLoadEvent(rules, fontsToLoad, request) {
- (0, _util.unreachable)('Abstract method `_prepareFontLoadEvent`.');
- }
- }, {
- key: 'isFontLoadingAPISupported',
- get: function get() {
- (0, _util.unreachable)('Abstract method `isFontLoadingAPISupported`.');
- }
- }, {
- key: 'isSyncFontLoadingSupported',
- get: function get() {
- (0, _util.unreachable)('Abstract method `isSyncFontLoadingSupported`.');
- }
- }, {
- key: '_loadTestFont',
- get: function get() {
- (0, _util.unreachable)('Abstract method `_loadTestFont`.');
- }
- }]);
-
- return BaseFontLoader;
-}();
-
-var FontLoader = void 0;
-{
- exports.FontLoader = FontLoader = function (_BaseFontLoader) {
- _inherits(GenericFontLoader, _BaseFontLoader);
-
- function GenericFontLoader(docId) {
- _classCallCheck(this, GenericFontLoader);
-
- var _this = _possibleConstructorReturn(this, (GenericFontLoader.__proto__ || Object.getPrototypeOf(GenericFontLoader)).call(this, docId));
-
- _this.loadTestFontId = 0;
- return _this;
- }
-
- _createClass(GenericFontLoader, [{
- key: '_prepareFontLoadEvent',
- value: function _prepareFontLoadEvent(rules, fonts, request) {
- function int32(data, offset) {
- return data.charCodeAt(offset) << 24 | data.charCodeAt(offset + 1) << 16 | data.charCodeAt(offset + 2) << 8 | data.charCodeAt(offset + 3) & 0xff;
- }
- function spliceString(s, offset, remove, insert) {
- var chunk1 = s.substring(0, offset);
- var chunk2 = s.substring(offset + remove);
- return chunk1 + insert + chunk2;
- }
- var i = void 0,
- ii = void 0;
- var canvas = document.createElement('canvas');
- canvas.width = 1;
- canvas.height = 1;
- var ctx = canvas.getContext('2d');
- var called = 0;
- function isFontReady(name, callback) {
- called++;
- if (called > 30) {
- (0, _util.warn)('Load test font never loaded.');
- callback();
- return;
- }
- ctx.font = '30px ' + name;
- ctx.fillText('.', 0, 20);
- var imageData = ctx.getImageData(0, 0, 1, 1);
- if (imageData.data[3] > 0) {
- callback();
- return;
- }
- setTimeout(isFontReady.bind(null, name, callback));
- }
- var loadTestFontId = 'lt' + Date.now() + this.loadTestFontId++;
- var data = this._loadTestFont;
- var COMMENT_OFFSET = 976;
- data = spliceString(data, COMMENT_OFFSET, loadTestFontId.length, loadTestFontId);
- var CFF_CHECKSUM_OFFSET = 16;
- var XXXX_VALUE = 0x58585858;
- var checksum = int32(data, CFF_CHECKSUM_OFFSET);
- for (i = 0, ii = loadTestFontId.length - 3; i < ii; i += 4) {
- checksum = checksum - XXXX_VALUE + int32(loadTestFontId, i) | 0;
- }
- if (i < loadTestFontId.length) {
- checksum = checksum - XXXX_VALUE + int32(loadTestFontId + 'XXX', i) | 0;
- }
- data = spliceString(data, CFF_CHECKSUM_OFFSET, 4, (0, _util.string32)(checksum));
- var url = 'url(data:font/opentype;base64,' + btoa(data) + ');';
- var rule = '@font-face {font-family:"' + loadTestFontId + '";src:' + url + '}';
- this.insertRule(rule);
- var names = [];
- for (i = 0, ii = fonts.length; i < ii; i++) {
- names.push(fonts[i].loadedName);
- }
- names.push(loadTestFontId);
- var div = document.createElement('div');
- div.setAttribute('style', 'visibility: hidden;' + 'width: 10px; height: 10px;' + 'position: absolute; top: 0px; left: 0px;');
- for (i = 0, ii = names.length; i < ii; ++i) {
- var span = document.createElement('span');
- span.textContent = 'Hi';
- span.style.fontFamily = names[i];
- div.appendChild(span);
- }
- document.body.appendChild(div);
- isFontReady(loadTestFontId, function () {
- document.body.removeChild(div);
- request.complete();
- });
- }
- }, {
- key: 'isFontLoadingAPISupported',
- get: function get() {
- var supported = typeof document !== 'undefined' && !!document.fonts;
- if (supported && typeof navigator !== 'undefined') {
- var m = /Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent);
- if (m && m[1] < 63) {
- supported = false;
- }
- }
- return (0, _util.shadow)(this, 'isFontLoadingAPISupported', supported);
- }
- }, {
- key: 'isSyncFontLoadingSupported',
- get: function get() {
- var supported = false;
- if (typeof navigator === 'undefined') {
- supported = true;
- } else {
- var m = /Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent);
- if (m && m[1] >= 14) {
- supported = true;
- }
- }
- return (0, _util.shadow)(this, 'isSyncFontLoadingSupported', supported);
- }
- }, {
- key: '_loadTestFont',
- get: function get() {
- var getLoadTestFont = function getLoadTestFont() {
- return atob('T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQA' + 'FQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAA' + 'ALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgA' + 'AAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1' + 'AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD' + '6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACM' + 'AooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4D' + 'IP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAA' + 'AAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUA' + 'AQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgAB' + 'AAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABY' + 'AAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAA' + 'AC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAA' + 'AAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQAC' + 'AQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3' + 'Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTj' + 'FQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==');
- };
- return (0, _util.shadow)(this, '_loadTestFont', getLoadTestFont());
- }
- }]);
-
- return GenericFontLoader;
- }(BaseFontLoader);
-}
-var IsEvalSupportedCached = {
- get value() {
- return (0, _util.shadow)(this, 'value', (0, _util.isEvalSupported)());
- }
-};
-
-var FontFaceObject = function () {
- function FontFaceObject(translatedData, _ref) {
- var _ref$isEvalSupported = _ref.isEvalSupported,
- isEvalSupported = _ref$isEvalSupported === undefined ? true : _ref$isEvalSupported,
- _ref$disableFontFace = _ref.disableFontFace,
- disableFontFace = _ref$disableFontFace === undefined ? false : _ref$disableFontFace,
- _ref$ignoreErrors = _ref.ignoreErrors,
- ignoreErrors = _ref$ignoreErrors === undefined ? false : _ref$ignoreErrors,
- _ref$onUnsupportedFea = _ref.onUnsupportedFeature,
- onUnsupportedFeature = _ref$onUnsupportedFea === undefined ? null : _ref$onUnsupportedFea,
- _ref$fontRegistry = _ref.fontRegistry,
- fontRegistry = _ref$fontRegistry === undefined ? null : _ref$fontRegistry;
-
- _classCallCheck(this, FontFaceObject);
-
- this.compiledGlyphs = Object.create(null);
- for (var i in translatedData) {
- this[i] = translatedData[i];
- }
- this.isEvalSupported = isEvalSupported !== false;
- this.disableFontFace = disableFontFace === true;
- this.ignoreErrors = ignoreErrors === true;
- this._onUnsupportedFeature = onUnsupportedFeature;
- this.fontRegistry = fontRegistry;
- }
-
- _createClass(FontFaceObject, [{
- key: 'createNativeFontFace',
- value: function createNativeFontFace() {
- if (!this.data || this.disableFontFace) {
- return null;
- }
- var nativeFontFace = new FontFace(this.loadedName, this.data, {});
- if (this.fontRegistry) {
- this.fontRegistry.registerFont(this);
- }
- return nativeFontFace;
- }
- }, {
- key: 'createFontFaceRule',
- value: function createFontFaceRule() {
- if (!this.data || this.disableFontFace) {
- return null;
- }
- var data = (0, _util.bytesToString)(new Uint8Array(this.data));
- var url = 'url(data:' + this.mimetype + ';base64,' + btoa(data) + ');';
- var rule = '@font-face {font-family:"' + this.loadedName + '";src:' + url + '}';
- if (this.fontRegistry) {
- this.fontRegistry.registerFont(this, url);
- }
- return rule;
- }
- }, {
- key: 'getPathGenerator',
- value: function getPathGenerator(objs, character) {
- if (this.compiledGlyphs[character] !== undefined) {
- return this.compiledGlyphs[character];
- }
- var cmds = void 0,
- current = void 0;
- try {
- cmds = objs.get(this.loadedName + '_path_' + character);
- } catch (ex) {
- if (!this.ignoreErrors) {
- throw ex;
- }
- if (this._onUnsupportedFeature) {
- this._onUnsupportedFeature({ featureId: _util.UNSUPPORTED_FEATURES.font });
- }
- (0, _util.warn)('getPathGenerator - ignoring character: "' + ex + '".');
- return this.compiledGlyphs[character] = function (c, size) {};
- }
- if (this.isEvalSupported && IsEvalSupportedCached.value) {
- var args = void 0,
- js = '';
- for (var i = 0, ii = cmds.length; i < ii; i++) {
- current = cmds[i];
- if (current.args !== undefined) {
- args = current.args.join(',');
- } else {
- args = '';
- }
- js += 'c.' + current.cmd + '(' + args + ');\n';
- }
- return this.compiledGlyphs[character] = new Function('c', 'size', js);
- }
- return this.compiledGlyphs[character] = function (c, size) {
- for (var _i = 0, _ii = cmds.length; _i < _ii; _i++) {
- current = cmds[_i];
- if (current.cmd === 'scale') {
- current.args = [size, -size];
- }
- c[current.cmd].apply(c, current.args);
- }
- };
- }
- }]);
-
- return FontFaceObject;
-}();
-
-exports.FontFaceObject = FontFaceObject;
-exports.FontLoader = FontLoader;
-
-/***/ }),
-/* 132 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var compatibilityParams = Object.create(null);
-{
- var isNodeJS = __w_pdfjs_require__(4);
- var userAgent = typeof navigator !== 'undefined' && navigator.userAgent || '';
- var isIE = /Trident/.test(userAgent);
- var isIOSChrome = /CriOS/.test(userAgent);
- (function checkOnBlobSupport() {
- if (isIE || isIOSChrome) {
- compatibilityParams.disableCreateObjectURL = true;
- }
- })();
- (function checkFontFaceAndImage() {
- if (isNodeJS()) {
- compatibilityParams.disableFontFace = true;
- compatibilityParams.nativeImageDecoderSupport = 'none';
- }
- })();
-}
-exports.apiCompatibilityParams = Object.freeze(compatibilityParams);
-
-/***/ }),
-/* 133 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.CanvasGraphics = undefined;
-
-var _util = __w_pdfjs_require__(1);
-
-var _pattern_helper = __w_pdfjs_require__(134);
-
-var MIN_FONT_SIZE = 16;
-var MAX_FONT_SIZE = 100;
-var MAX_GROUP_SIZE = 4096;
-var MIN_WIDTH_FACTOR = 0.65;
-var COMPILE_TYPE3_GLYPHS = true;
-var MAX_SIZE_TO_COMPILE = 1000;
-var FULL_CHUNK_HEIGHT = 16;
-var IsLittleEndianCached = {
- get value() {
- return (0, _util.shadow)(IsLittleEndianCached, 'value', (0, _util.isLittleEndian)());
- }
-};
-function addContextCurrentTransform(ctx) {
- if (!ctx.mozCurrentTransform) {
- ctx._originalSave = ctx.save;
- ctx._originalRestore = ctx.restore;
- ctx._originalRotate = ctx.rotate;
- ctx._originalScale = ctx.scale;
- ctx._originalTranslate = ctx.translate;
- ctx._originalTransform = ctx.transform;
- ctx._originalSetTransform = ctx.setTransform;
- ctx._transformMatrix = ctx._transformMatrix || [1, 0, 0, 1, 0, 0];
- ctx._transformStack = [];
- Object.defineProperty(ctx, 'mozCurrentTransform', {
- get: function getCurrentTransform() {
- return this._transformMatrix;
- }
- });
- Object.defineProperty(ctx, 'mozCurrentTransformInverse', {
- get: function getCurrentTransformInverse() {
- var m = this._transformMatrix;
- var a = m[0],
- b = m[1],
- c = m[2],
- d = m[3],
- e = m[4],
- f = m[5];
- var ad_bc = a * d - b * c;
- var bc_ad = b * c - a * d;
- return [d / ad_bc, b / bc_ad, c / bc_ad, a / ad_bc, (d * e - c * f) / bc_ad, (b * e - a * f) / ad_bc];
- }
- });
- ctx.save = function ctxSave() {
- var old = this._transformMatrix;
- this._transformStack.push(old);
- this._transformMatrix = old.slice(0, 6);
- this._originalSave();
- };
- ctx.restore = function ctxRestore() {
- var prev = this._transformStack.pop();
- if (prev) {
- this._transformMatrix = prev;
- this._originalRestore();
- }
- };
- ctx.translate = function ctxTranslate(x, y) {
- var m = this._transformMatrix;
- m[4] = m[0] * x + m[2] * y + m[4];
- m[5] = m[1] * x + m[3] * y + m[5];
- this._originalTranslate(x, y);
- };
- ctx.scale = function ctxScale(x, y) {
- var m = this._transformMatrix;
- m[0] = m[0] * x;
- m[1] = m[1] * x;
- m[2] = m[2] * y;
- m[3] = m[3] * y;
- this._originalScale(x, y);
- };
- ctx.transform = function ctxTransform(a, b, c, d, e, f) {
- var m = this._transformMatrix;
- this._transformMatrix = [m[0] * a + m[2] * b, m[1] * a + m[3] * b, m[0] * c + m[2] * d, m[1] * c + m[3] * d, m[0] * e + m[2] * f + m[4], m[1] * e + m[3] * f + m[5]];
- ctx._originalTransform(a, b, c, d, e, f);
- };
- ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) {
- this._transformMatrix = [a, b, c, d, e, f];
- ctx._originalSetTransform(a, b, c, d, e, f);
- };
- ctx.rotate = function ctxRotate(angle) {
- var cosValue = Math.cos(angle);
- var sinValue = Math.sin(angle);
- var m = this._transformMatrix;
- this._transformMatrix = [m[0] * cosValue + m[2] * sinValue, m[1] * cosValue + m[3] * sinValue, m[0] * -sinValue + m[2] * cosValue, m[1] * -sinValue + m[3] * cosValue, m[4], m[5]];
- this._originalRotate(angle);
- };
- }
-}
-var CachedCanvases = function CachedCanvasesClosure() {
- function CachedCanvases(canvasFactory) {
- this.canvasFactory = canvasFactory;
- this.cache = Object.create(null);
- }
- CachedCanvases.prototype = {
- getCanvas: function CachedCanvases_getCanvas(id, width, height, trackTransform) {
- var canvasEntry;
- if (this.cache[id] !== undefined) {
- canvasEntry = this.cache[id];
- this.canvasFactory.reset(canvasEntry, width, height);
- canvasEntry.context.setTransform(1, 0, 0, 1, 0, 0);
- } else {
- canvasEntry = this.canvasFactory.create(width, height);
- this.cache[id] = canvasEntry;
- }
- if (trackTransform) {
- addContextCurrentTransform(canvasEntry.context);
- }
- return canvasEntry;
- },
- clear: function clear() {
- for (var id in this.cache) {
- var canvasEntry = this.cache[id];
- this.canvasFactory.destroy(canvasEntry);
- delete this.cache[id];
- }
- }
- };
- return CachedCanvases;
-}();
-function compileType3Glyph(imgData) {
- var POINT_TO_PROCESS_LIMIT = 1000;
- var width = imgData.width,
- height = imgData.height;
- var i,
- j,
- j0,
- width1 = width + 1;
- var points = new Uint8Array(width1 * (height + 1));
- var POINT_TYPES = new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]);
- var lineSize = width + 7 & ~7,
- data0 = imgData.data;
- var data = new Uint8Array(lineSize * height),
- pos = 0,
- ii;
- for (i = 0, ii = data0.length; i < ii; i++) {
- var mask = 128,
- elem = data0[i];
- while (mask > 0) {
- data[pos++] = elem & mask ? 0 : 255;
- mask >>= 1;
- }
- }
- var count = 0;
- pos = 0;
- if (data[pos] !== 0) {
- points[0] = 1;
- ++count;
- }
- for (j = 1; j < width; j++) {
- if (data[pos] !== data[pos + 1]) {
- points[j] = data[pos] ? 2 : 1;
- ++count;
- }
- pos++;
- }
- if (data[pos] !== 0) {
- points[j] = 2;
- ++count;
- }
- for (i = 1; i < height; i++) {
- pos = i * lineSize;
- j0 = i * width1;
- if (data[pos - lineSize] !== data[pos]) {
- points[j0] = data[pos] ? 1 : 8;
- ++count;
- }
- var sum = (data[pos] ? 4 : 0) + (data[pos - lineSize] ? 8 : 0);
- for (j = 1; j < width; j++) {
- sum = (sum >> 2) + (data[pos + 1] ? 4 : 0) + (data[pos - lineSize + 1] ? 8 : 0);
- if (POINT_TYPES[sum]) {
- points[j0 + j] = POINT_TYPES[sum];
- ++count;
- }
- pos++;
- }
- if (data[pos - lineSize] !== data[pos]) {
- points[j0 + j] = data[pos] ? 2 : 4;
- ++count;
- }
- if (count > POINT_TO_PROCESS_LIMIT) {
- return null;
- }
- }
- pos = lineSize * (height - 1);
- j0 = i * width1;
- if (data[pos] !== 0) {
- points[j0] = 8;
- ++count;
- }
- for (j = 1; j < width; j++) {
- if (data[pos] !== data[pos + 1]) {
- points[j0 + j] = data[pos] ? 4 : 8;
- ++count;
- }
- pos++;
- }
- if (data[pos] !== 0) {
- points[j0 + j] = 4;
- ++count;
- }
- if (count > POINT_TO_PROCESS_LIMIT) {
- return null;
- }
- var steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]);
- var outlines = [];
- for (i = 0; count && i <= height; i++) {
- var p = i * width1;
- var end = p + width;
- while (p < end && !points[p]) {
- p++;
- }
- if (p === end) {
- continue;
- }
- var coords = [p % width1, i];
- var type = points[p],
- p0 = p,
- pp;
- do {
- var step = steps[type];
- do {
- p += step;
- } while (!points[p]);
- pp = points[p];
- if (pp !== 5 && pp !== 10) {
- type = pp;
- points[p] = 0;
- } else {
- type = pp & 0x33 * type >> 4;
- points[p] &= type >> 2 | type << 2;
- }
- coords.push(p % width1);
- coords.push(p / width1 | 0);
- --count;
- } while (p0 !== p);
- outlines.push(coords);
- --i;
- }
- var drawOutline = function drawOutline(c) {
- c.save();
- c.scale(1 / width, -1 / height);
- c.translate(0, -height);
- c.beginPath();
- for (var i = 0, ii = outlines.length; i < ii; i++) {
- var o = outlines[i];
- c.moveTo(o[0], o[1]);
- for (var j = 2, jj = o.length; j < jj; j += 2) {
- c.lineTo(o[j], o[j + 1]);
- }
- }
- c.fill();
- c.beginPath();
- c.restore();
- };
- return drawOutline;
-}
-var CanvasExtraState = function CanvasExtraStateClosure() {
- function CanvasExtraState() {
- this.alphaIsShape = false;
- this.fontSize = 0;
- this.fontSizeScale = 1;
- this.textMatrix = _util.IDENTITY_MATRIX;
- this.textMatrixScale = 1;
- this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
- this.leading = 0;
- this.x = 0;
- this.y = 0;
- this.lineX = 0;
- this.lineY = 0;
- this.charSpacing = 0;
- this.wordSpacing = 0;
- this.textHScale = 1;
- this.textRenderingMode = _util.TextRenderingMode.FILL;
- this.textRise = 0;
- this.fillColor = '#000000';
- this.strokeColor = '#000000';
- this.patternFill = false;
- this.fillAlpha = 1;
- this.strokeAlpha = 1;
- this.lineWidth = 1;
- this.activeSMask = null;
- this.resumeSMaskCtx = null;
- }
- CanvasExtraState.prototype = {
- clone: function CanvasExtraState_clone() {
- return Object.create(this);
- },
- setCurrentPoint: function CanvasExtraState_setCurrentPoint(x, y) {
- this.x = x;
- this.y = y;
- }
- };
- return CanvasExtraState;
-}();
-var CanvasGraphics = function CanvasGraphicsClosure() {
- var EXECUTION_TIME = 15;
- var EXECUTION_STEPS = 10;
- function CanvasGraphics(canvasCtx, commonObjs, objs, canvasFactory, webGLContext, imageLayer) {
- this.ctx = canvasCtx;
- this.current = new CanvasExtraState();
- this.stateStack = [];
- this.pendingClip = null;
- this.pendingEOFill = false;
- this.res = null;
- this.xobjs = null;
- this.commonObjs = commonObjs;
- this.objs = objs;
- this.canvasFactory = canvasFactory;
- this.webGLContext = webGLContext;
- this.imageLayer = imageLayer;
- this.groupStack = [];
- this.processingType3 = null;
- this.baseTransform = null;
- this.baseTransformStack = [];
- this.groupLevel = 0;
- this.smaskStack = [];
- this.smaskCounter = 0;
- this.tempSMask = null;
- this.cachedCanvases = new CachedCanvases(this.canvasFactory);
- if (canvasCtx) {
- addContextCurrentTransform(canvasCtx);
- }
- this._cachedGetSinglePixelWidth = null;
- }
- function putBinaryImageData(ctx, imgData) {
- if (typeof ImageData !== 'undefined' && imgData instanceof ImageData) {
- ctx.putImageData(imgData, 0, 0);
- return;
- }
- var height = imgData.height,
- width = imgData.width;
- var partialChunkHeight = height % FULL_CHUNK_HEIGHT;
- var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;
- var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;
- var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);
- var srcPos = 0,
- destPos;
- var src = imgData.data;
- var dest = chunkImgData.data;
- var i, j, thisChunkHeight, elemsInThisChunk;
- if (imgData.kind === _util.ImageKind.GRAYSCALE_1BPP) {
- var srcLength = src.byteLength;
- var dest32 = new Uint32Array(dest.buffer, 0, dest.byteLength >> 2);
- var dest32DataLength = dest32.length;
- var fullSrcDiff = width + 7 >> 3;
- var white = 0xFFFFFFFF;
- var black = IsLittleEndianCached.value ? 0xFF000000 : 0x000000FF;
- for (i = 0; i < totalChunks; i++) {
- thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;
- destPos = 0;
- for (j = 0; j < thisChunkHeight; j++) {
- var srcDiff = srcLength - srcPos;
- var k = 0;
- var kEnd = srcDiff > fullSrcDiff ? width : srcDiff * 8 - 7;
- var kEndUnrolled = kEnd & ~7;
- var mask = 0;
- var srcByte = 0;
- for (; k < kEndUnrolled; k += 8) {
- srcByte = src[srcPos++];
- dest32[destPos++] = srcByte & 128 ? white : black;
- dest32[destPos++] = srcByte & 64 ? white : black;
- dest32[destPos++] = srcByte & 32 ? white : black;
- dest32[destPos++] = srcByte & 16 ? white : black;
- dest32[destPos++] = srcByte & 8 ? white : black;
- dest32[destPos++] = srcByte & 4 ? white : black;
- dest32[destPos++] = srcByte & 2 ? white : black;
- dest32[destPos++] = srcByte & 1 ? white : black;
- }
- for (; k < kEnd; k++) {
- if (mask === 0) {
- srcByte = src[srcPos++];
- mask = 128;
- }
- dest32[destPos++] = srcByte & mask ? white : black;
- mask >>= 1;
- }
- }
- while (destPos < dest32DataLength) {
- dest32[destPos++] = 0;
- }
- ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
- }
- } else if (imgData.kind === _util.ImageKind.RGBA_32BPP) {
- j = 0;
- elemsInThisChunk = width * FULL_CHUNK_HEIGHT * 4;
- for (i = 0; i < fullChunks; i++) {
- dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
- srcPos += elemsInThisChunk;
- ctx.putImageData(chunkImgData, 0, j);
- j += FULL_CHUNK_HEIGHT;
- }
- if (i < totalChunks) {
- elemsInThisChunk = width * partialChunkHeight * 4;
- dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
- ctx.putImageData(chunkImgData, 0, j);
- }
- } else if (imgData.kind === _util.ImageKind.RGB_24BPP) {
- thisChunkHeight = FULL_CHUNK_HEIGHT;
- elemsInThisChunk = width * thisChunkHeight;
- for (i = 0; i < totalChunks; i++) {
- if (i >= fullChunks) {
- thisChunkHeight = partialChunkHeight;
- elemsInThisChunk = width * thisChunkHeight;
- }
- destPos = 0;
- for (j = elemsInThisChunk; j--;) {
- dest[destPos++] = src[srcPos++];
- dest[destPos++] = src[srcPos++];
- dest[destPos++] = src[srcPos++];
- dest[destPos++] = 255;
- }
- ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
- }
- } else {
- throw new Error('bad image kind: ' + imgData.kind);
- }
- }
- function putBinaryImageMask(ctx, imgData) {
- var height = imgData.height,
- width = imgData.width;
- var partialChunkHeight = height % FULL_CHUNK_HEIGHT;
- var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;
- var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;
- var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);
- var srcPos = 0;
- var src = imgData.data;
- var dest = chunkImgData.data;
- for (var i = 0; i < totalChunks; i++) {
- var thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;
- var destPos = 3;
- for (var j = 0; j < thisChunkHeight; j++) {
- var mask = 0;
- for (var k = 0; k < width; k++) {
- if (!mask) {
- var elem = src[srcPos++];
- mask = 128;
- }
- dest[destPos] = elem & mask ? 0 : 255;
- destPos += 4;
- mask >>= 1;
- }
- }
- ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
- }
- }
- function copyCtxState(sourceCtx, destCtx) {
- var properties = ['strokeStyle', 'fillStyle', 'fillRule', 'globalAlpha', 'lineWidth', 'lineCap', 'lineJoin', 'miterLimit', 'globalCompositeOperation', 'font'];
- for (var i = 0, ii = properties.length; i < ii; i++) {
- var property = properties[i];
- if (sourceCtx[property] !== undefined) {
- destCtx[property] = sourceCtx[property];
- }
- }
- if (sourceCtx.setLineDash !== undefined) {
- destCtx.setLineDash(sourceCtx.getLineDash());
- destCtx.lineDashOffset = sourceCtx.lineDashOffset;
- }
- }
- function resetCtxToDefault(ctx) {
- ctx.strokeStyle = '#000000';
- ctx.fillStyle = '#000000';
- ctx.fillRule = 'nonzero';
- ctx.globalAlpha = 1;
- ctx.lineWidth = 1;
- ctx.lineCap = 'butt';
- ctx.lineJoin = 'miter';
- ctx.miterLimit = 10;
- ctx.globalCompositeOperation = 'source-over';
- ctx.font = '10px sans-serif';
- if (ctx.setLineDash !== undefined) {
- ctx.setLineDash([]);
- ctx.lineDashOffset = 0;
- }
- }
- function composeSMaskBackdrop(bytes, r0, g0, b0) {
- var length = bytes.length;
- for (var i = 3; i < length; i += 4) {
- var alpha = bytes[i];
- if (alpha === 0) {
- bytes[i - 3] = r0;
- bytes[i - 2] = g0;
- bytes[i - 1] = b0;
- } else if (alpha < 255) {
- var alpha_ = 255 - alpha;
- bytes[i - 3] = bytes[i - 3] * alpha + r0 * alpha_ >> 8;
- bytes[i - 2] = bytes[i - 2] * alpha + g0 * alpha_ >> 8;
- bytes[i - 1] = bytes[i - 1] * alpha + b0 * alpha_ >> 8;
- }
- }
- }
- function composeSMaskAlpha(maskData, layerData, transferMap) {
- var length = maskData.length;
- var scale = 1 / 255;
- for (var i = 3; i < length; i += 4) {
- var alpha = transferMap ? transferMap[maskData[i]] : maskData[i];
- layerData[i] = layerData[i] * alpha * scale | 0;
- }
- }
- function composeSMaskLuminosity(maskData, layerData, transferMap) {
- var length = maskData.length;
- for (var i = 3; i < length; i += 4) {
- var y = maskData[i - 3] * 77 + maskData[i - 2] * 152 + maskData[i - 1] * 28;
- layerData[i] = transferMap ? layerData[i] * transferMap[y >> 8] >> 8 : layerData[i] * y >> 16;
- }
- }
- function genericComposeSMask(maskCtx, layerCtx, width, height, subtype, backdrop, transferMap) {
- var hasBackdrop = !!backdrop;
- var r0 = hasBackdrop ? backdrop[0] : 0;
- var g0 = hasBackdrop ? backdrop[1] : 0;
- var b0 = hasBackdrop ? backdrop[2] : 0;
- var composeFn;
- if (subtype === 'Luminosity') {
- composeFn = composeSMaskLuminosity;
- } else {
- composeFn = composeSMaskAlpha;
- }
- var PIXELS_TO_PROCESS = 1048576;
- var chunkSize = Math.min(height, Math.ceil(PIXELS_TO_PROCESS / width));
- for (var row = 0; row < height; row += chunkSize) {
- var chunkHeight = Math.min(chunkSize, height - row);
- var maskData = maskCtx.getImageData(0, row, width, chunkHeight);
- var layerData = layerCtx.getImageData(0, row, width, chunkHeight);
- if (hasBackdrop) {
- composeSMaskBackdrop(maskData.data, r0, g0, b0);
- }
- composeFn(maskData.data, layerData.data, transferMap);
- maskCtx.putImageData(layerData, 0, row);
- }
- }
- function composeSMask(ctx, smask, layerCtx, webGLContext) {
- var mask = smask.canvas;
- var maskCtx = smask.context;
- ctx.setTransform(smask.scaleX, 0, 0, smask.scaleY, smask.offsetX, smask.offsetY);
- var backdrop = smask.backdrop || null;
- if (!smask.transferMap && webGLContext.isEnabled) {
- var composed = webGLContext.composeSMask({
- layer: layerCtx.canvas,
- mask: mask,
- properties: {
- subtype: smask.subtype,
- backdrop: backdrop
- }
- });
- ctx.setTransform(1, 0, 0, 1, 0, 0);
- ctx.drawImage(composed, smask.offsetX, smask.offsetY);
- return;
- }
- genericComposeSMask(maskCtx, layerCtx, mask.width, mask.height, smask.subtype, backdrop, smask.transferMap);
- ctx.drawImage(mask, 0, 0);
- }
- var LINE_CAP_STYLES = ['butt', 'round', 'square'];
- var LINE_JOIN_STYLES = ['miter', 'round', 'bevel'];
- var NORMAL_CLIP = {};
- var EO_CLIP = {};
- CanvasGraphics.prototype = {
- beginDrawing: function beginDrawing(_ref) {
- var transform = _ref.transform,
- viewport = _ref.viewport,
- transparency = _ref.transparency,
- _ref$background = _ref.background,
- background = _ref$background === undefined ? null : _ref$background;
-
- var width = this.ctx.canvas.width;
- var height = this.ctx.canvas.height;
- this.ctx.save();
- this.ctx.fillStyle = background || 'rgb(255, 255, 255)';
- this.ctx.fillRect(0, 0, width, height);
- this.ctx.restore();
- if (transparency) {
- var transparentCanvas = this.cachedCanvases.getCanvas('transparent', width, height, true);
- this.compositeCtx = this.ctx;
- this.transparentCanvas = transparentCanvas.canvas;
- this.ctx = transparentCanvas.context;
- this.ctx.save();
- this.ctx.transform.apply(this.ctx, this.compositeCtx.mozCurrentTransform);
- }
- this.ctx.save();
- resetCtxToDefault(this.ctx);
- if (transform) {
- this.ctx.transform.apply(this.ctx, transform);
- }
- this.ctx.transform.apply(this.ctx, viewport.transform);
- this.baseTransform = this.ctx.mozCurrentTransform.slice();
- if (this.imageLayer) {
- this.imageLayer.beginLayout();
- }
- },
-
- executeOperatorList: function CanvasGraphics_executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper) {
- var argsArray = operatorList.argsArray;
- var fnArray = operatorList.fnArray;
- var i = executionStartIdx || 0;
- var argsArrayLen = argsArray.length;
- if (argsArrayLen === i) {
- return i;
- }
- var chunkOperations = argsArrayLen - i > EXECUTION_STEPS && typeof continueCallback === 'function';
- var endTime = chunkOperations ? Date.now() + EXECUTION_TIME : 0;
- var steps = 0;
- var commonObjs = this.commonObjs;
- var objs = this.objs;
- var fnId;
- while (true) {
- if (stepper !== undefined && i === stepper.nextBreakPoint) {
- stepper.breakIt(i, continueCallback);
- return i;
- }
- fnId = fnArray[i];
- if (fnId !== _util.OPS.dependency) {
- this[fnId].apply(this, argsArray[i]);
- } else {
- var deps = argsArray[i];
- 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;
- if (!objsPool.isResolved(depObjId)) {
- objsPool.get(depObjId, continueCallback);
- return i;
- }
- }
- }
- i++;
- if (i === argsArrayLen) {
- return i;
- }
- if (chunkOperations && ++steps > EXECUTION_STEPS) {
- if (Date.now() > endTime) {
- continueCallback();
- return i;
- }
- steps = 0;
- }
- }
- },
- endDrawing: function CanvasGraphics_endDrawing() {
- if (this.current.activeSMask !== null) {
- this.endSMaskGroup();
- }
- this.ctx.restore();
- if (this.transparentCanvas) {
- this.ctx = this.compositeCtx;
- this.ctx.save();
- this.ctx.setTransform(1, 0, 0, 1, 0, 0);
- this.ctx.drawImage(this.transparentCanvas, 0, 0);
- this.ctx.restore();
- this.transparentCanvas = null;
- }
- this.cachedCanvases.clear();
- this.webGLContext.clear();
- if (this.imageLayer) {
- this.imageLayer.endLayout();
- }
- },
- setLineWidth: function CanvasGraphics_setLineWidth(width) {
- this.current.lineWidth = width;
- this.ctx.lineWidth = width;
- },
- setLineCap: function CanvasGraphics_setLineCap(style) {
- this.ctx.lineCap = LINE_CAP_STYLES[style];
- },
- setLineJoin: function CanvasGraphics_setLineJoin(style) {
- this.ctx.lineJoin = LINE_JOIN_STYLES[style];
- },
- setMiterLimit: function CanvasGraphics_setMiterLimit(limit) {
- this.ctx.miterLimit = limit;
- },
- setDash: function CanvasGraphics_setDash(dashArray, dashPhase) {
- var ctx = this.ctx;
- if (ctx.setLineDash !== undefined) {
- ctx.setLineDash(dashArray);
- ctx.lineDashOffset = dashPhase;
- }
- },
- setRenderingIntent: function CanvasGraphics_setRenderingIntent(intent) {},
- setFlatness: function CanvasGraphics_setFlatness(flatness) {},
- setGState: function CanvasGraphics_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;
- case 'LC':
- this.setLineCap(value);
- break;
- case 'LJ':
- this.setLineJoin(value);
- break;
- case 'ML':
- this.setMiterLimit(value);
- break;
- case 'D':
- this.setDash(value[0], value[1]);
- break;
- case 'RI':
- this.setRenderingIntent(value);
- break;
- case 'FL':
- this.setFlatness(value);
- break;
- case 'Font':
- this.setFont(value[0], value[1]);
- break;
- case 'CA':
- this.current.strokeAlpha = state[1];
- break;
- case 'ca':
- this.current.fillAlpha = state[1];
- this.ctx.globalAlpha = state[1];
- break;
- case 'BM':
- this.ctx.globalCompositeOperation = value;
- break;
- case 'SMask':
- if (this.current.activeSMask) {
- if (this.stateStack.length > 0 && this.stateStack[this.stateStack.length - 1].activeSMask === this.current.activeSMask) {
- this.suspendSMaskGroup();
- } else {
- this.endSMaskGroup();
- }
- }
- this.current.activeSMask = value ? this.tempSMask : null;
- if (this.current.activeSMask) {
- this.beginSMaskGroup();
- }
- this.tempSMask = null;
- break;
- }
- }
- },
- beginSMaskGroup: function CanvasGraphics_beginSMaskGroup() {
- var activeSMask = this.current.activeSMask;
- var drawnWidth = activeSMask.canvas.width;
- var drawnHeight = activeSMask.canvas.height;
- var cacheId = 'smaskGroupAt' + this.groupLevel;
- var scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true);
- var currentCtx = this.ctx;
- var currentTransform = currentCtx.mozCurrentTransform;
- this.ctx.save();
- var groupCtx = scratchCanvas.context;
- groupCtx.scale(1 / activeSMask.scaleX, 1 / activeSMask.scaleY);
- groupCtx.translate(-activeSMask.offsetX, -activeSMask.offsetY);
- groupCtx.transform.apply(groupCtx, currentTransform);
- activeSMask.startTransformInverse = groupCtx.mozCurrentTransformInverse;
- copyCtxState(currentCtx, groupCtx);
- this.ctx = groupCtx;
- this.setGState([['BM', 'source-over'], ['ca', 1], ['CA', 1]]);
- this.groupStack.push(currentCtx);
- this.groupLevel++;
- },
- suspendSMaskGroup: function CanvasGraphics_endSMaskGroup() {
- var groupCtx = this.ctx;
- this.groupLevel--;
- this.ctx = this.groupStack.pop();
- composeSMask(this.ctx, this.current.activeSMask, groupCtx, this.webGLContext);
- this.ctx.restore();
- this.ctx.save();
- copyCtxState(groupCtx, this.ctx);
- this.current.resumeSMaskCtx = groupCtx;
- var deltaTransform = _util.Util.transform(this.current.activeSMask.startTransformInverse, groupCtx.mozCurrentTransform);
- this.ctx.transform.apply(this.ctx, deltaTransform);
- groupCtx.save();
- groupCtx.setTransform(1, 0, 0, 1, 0, 0);
- groupCtx.clearRect(0, 0, groupCtx.canvas.width, groupCtx.canvas.height);
- groupCtx.restore();
- },
- resumeSMaskGroup: function CanvasGraphics_endSMaskGroup() {
- var groupCtx = this.current.resumeSMaskCtx;
- var currentCtx = this.ctx;
- this.ctx = groupCtx;
- this.groupStack.push(currentCtx);
- this.groupLevel++;
- },
- endSMaskGroup: function CanvasGraphics_endSMaskGroup() {
- var groupCtx = this.ctx;
- this.groupLevel--;
- this.ctx = this.groupStack.pop();
- composeSMask(this.ctx, this.current.activeSMask, groupCtx, this.webGLContext);
- this.ctx.restore();
- copyCtxState(groupCtx, this.ctx);
- var deltaTransform = _util.Util.transform(this.current.activeSMask.startTransformInverse, groupCtx.mozCurrentTransform);
- this.ctx.transform.apply(this.ctx, deltaTransform);
- },
- save: function CanvasGraphics_save() {
- this.ctx.save();
- var old = this.current;
- this.stateStack.push(old);
- this.current = old.clone();
- this.current.resumeSMaskCtx = null;
- },
- restore: function CanvasGraphics_restore() {
- if (this.current.resumeSMaskCtx) {
- this.resumeSMaskGroup();
- }
- if (this.current.activeSMask !== null && (this.stateStack.length === 0 || this.stateStack[this.stateStack.length - 1].activeSMask !== this.current.activeSMask)) {
- this.endSMaskGroup();
- }
- if (this.stateStack.length !== 0) {
- this.current = this.stateStack.pop();
- this.ctx.restore();
- this.pendingClip = null;
- this._cachedGetSinglePixelWidth = null;
- }
- },
- transform: function CanvasGraphics_transform(a, b, c, d, e, f) {
- this.ctx.transform(a, b, c, d, e, f);
- this._cachedGetSinglePixelWidth = null;
- },
- constructPath: function CanvasGraphics_constructPath(ops, args) {
- var ctx = this.ctx;
- var current = this.current;
- var x = current.x,
- y = current.y;
- for (var i = 0, j = 0, ii = ops.length; i < ii; i++) {
- switch (ops[i] | 0) {
- case _util.OPS.rectangle:
- x = args[j++];
- y = args[j++];
- var width = args[j++];
- var height = args[j++];
- if (width === 0) {
- width = this.getSinglePixelWidth();
- }
- if (height === 0) {
- height = this.getSinglePixelWidth();
- }
- var xw = x + width;
- var yh = y + height;
- this.ctx.moveTo(x, y);
- this.ctx.lineTo(xw, y);
- this.ctx.lineTo(xw, yh);
- this.ctx.lineTo(x, yh);
- this.ctx.lineTo(x, y);
- this.ctx.closePath();
- break;
- case _util.OPS.moveTo:
- x = args[j++];
- y = args[j++];
- ctx.moveTo(x, y);
- break;
- case _util.OPS.lineTo:
- x = args[j++];
- y = args[j++];
- ctx.lineTo(x, y);
- break;
- case _util.OPS.curveTo:
- x = args[j + 4];
- y = args[j + 5];
- ctx.bezierCurveTo(args[j], args[j + 1], args[j + 2], args[j + 3], x, y);
- j += 6;
- break;
- case _util.OPS.curveTo2:
- ctx.bezierCurveTo(x, y, args[j], args[j + 1], args[j + 2], args[j + 3]);
- x = args[j + 2];
- y = args[j + 3];
- j += 4;
- break;
- case _util.OPS.curveTo3:
- x = args[j + 2];
- y = args[j + 3];
- ctx.bezierCurveTo(args[j], args[j + 1], x, y, x, y);
- j += 4;
- break;
- case _util.OPS.closePath:
- ctx.closePath();
- break;
- }
- }
- current.setCurrentPoint(x, y);
- },
- closePath: function CanvasGraphics_closePath() {
- this.ctx.closePath();
- },
- stroke: function CanvasGraphics_stroke(consumePath) {
- consumePath = typeof consumePath !== 'undefined' ? consumePath : true;
- var ctx = this.ctx;
- var strokeColor = this.current.strokeColor;
- ctx.lineWidth = Math.max(this.getSinglePixelWidth() * MIN_WIDTH_FACTOR, this.current.lineWidth);
- ctx.globalAlpha = this.current.strokeAlpha;
- if (strokeColor && strokeColor.hasOwnProperty('type') && strokeColor.type === 'Pattern') {
- ctx.save();
- ctx.strokeStyle = strokeColor.getPattern(ctx, this);
- ctx.stroke();
- ctx.restore();
- } else {
- ctx.stroke();
- }
- if (consumePath) {
- this.consumePath();
- }
- ctx.globalAlpha = this.current.fillAlpha;
- },
- closeStroke: function CanvasGraphics_closeStroke() {
- this.closePath();
- this.stroke();
- },
- fill: function CanvasGraphics_fill(consumePath) {
- consumePath = typeof consumePath !== 'undefined' ? consumePath : true;
- var ctx = this.ctx;
- var fillColor = this.current.fillColor;
- var isPatternFill = this.current.patternFill;
- var needRestore = false;
- if (isPatternFill) {
- ctx.save();
- if (this.baseTransform) {
- ctx.setTransform.apply(ctx, this.baseTransform);
- }
- ctx.fillStyle = fillColor.getPattern(ctx, this);
- needRestore = true;
- }
- if (this.pendingEOFill) {
- ctx.fill('evenodd');
- this.pendingEOFill = false;
- } else {
- ctx.fill();
- }
- if (needRestore) {
- ctx.restore();
- }
- if (consumePath) {
- this.consumePath();
- }
- },
- eoFill: function CanvasGraphics_eoFill() {
- this.pendingEOFill = true;
- this.fill();
- },
- fillStroke: function CanvasGraphics_fillStroke() {
- this.fill(false);
- this.stroke(false);
- this.consumePath();
- },
- eoFillStroke: function CanvasGraphics_eoFillStroke() {
- this.pendingEOFill = true;
- this.fillStroke();
- },
- closeFillStroke: function CanvasGraphics_closeFillStroke() {
- this.closePath();
- this.fillStroke();
- },
- closeEOFillStroke: function CanvasGraphics_closeEOFillStroke() {
- this.pendingEOFill = true;
- this.closePath();
- this.fillStroke();
- },
- endPath: function CanvasGraphics_endPath() {
- this.consumePath();
- },
- clip: function CanvasGraphics_clip() {
- this.pendingClip = NORMAL_CLIP;
- },
- eoClip: function CanvasGraphics_eoClip() {
- this.pendingClip = EO_CLIP;
- },
- beginText: function CanvasGraphics_beginText() {
- this.current.textMatrix = _util.IDENTITY_MATRIX;
- this.current.textMatrixScale = 1;
- this.current.x = this.current.lineX = 0;
- this.current.y = this.current.lineY = 0;
- },
- endText: function CanvasGraphics_endText() {
- var paths = this.pendingTextPaths;
- var ctx = this.ctx;
- if (paths === undefined) {
- ctx.beginPath();
- return;
- }
- ctx.save();
- ctx.beginPath();
- for (var i = 0; i < paths.length; i++) {
- var path = paths[i];
- ctx.setTransform.apply(ctx, path.transform);
- ctx.translate(path.x, path.y);
- path.addToPath(ctx, path.fontSize);
- }
- ctx.restore();
- ctx.clip();
- ctx.beginPath();
- delete this.pendingTextPaths;
- },
- setCharSpacing: function CanvasGraphics_setCharSpacing(spacing) {
- this.current.charSpacing = spacing;
- },
- setWordSpacing: function CanvasGraphics_setWordSpacing(spacing) {
- this.current.wordSpacing = spacing;
- },
- setHScale: function CanvasGraphics_setHScale(scale) {
- this.current.textHScale = scale / 100;
- },
- setLeading: function CanvasGraphics_setLeading(leading) {
- this.current.leading = -leading;
- },
- setFont: function CanvasGraphics_setFont(fontRefName, size) {
- var fontObj = this.commonObjs.get(fontRefName);
- var current = this.current;
- if (!fontObj) {
- throw new Error('Can\'t find font for ' + fontRefName);
- }
- current.fontMatrix = fontObj.fontMatrix ? fontObj.fontMatrix : _util.FONT_IDENTITY_MATRIX;
- if (current.fontMatrix[0] === 0 || current.fontMatrix[3] === 0) {
- (0, _util.warn)('Invalid font matrix for font ' + fontRefName);
- }
- if (size < 0) {
- size = -size;
- current.fontDirection = -1;
- } else {
- current.fontDirection = 1;
- }
- this.current.font = fontObj;
- this.current.fontSize = size;
- if (fontObj.isType3Font) {
- return;
- }
- var name = fontObj.loadedName || 'sans-serif';
- var bold = fontObj.black ? '900' : fontObj.bold ? 'bold' : 'normal';
- var italic = fontObj.italic ? 'italic' : 'normal';
- var typeface = '"' + name + '", ' + fontObj.fallbackName;
- var browserFontSize = size < MIN_FONT_SIZE ? MIN_FONT_SIZE : size > MAX_FONT_SIZE ? MAX_FONT_SIZE : size;
- this.current.fontSizeScale = size / browserFontSize;
- var rule = italic + ' ' + bold + ' ' + browserFontSize + 'px ' + typeface;
- this.ctx.font = rule;
- },
- setTextRenderingMode: function CanvasGraphics_setTextRenderingMode(mode) {
- this.current.textRenderingMode = mode;
- },
- setTextRise: function CanvasGraphics_setTextRise(rise) {
- this.current.textRise = rise;
- },
- moveText: function CanvasGraphics_moveText(x, y) {
- this.current.x = this.current.lineX += x;
- this.current.y = this.current.lineY += y;
- },
- setLeadingMoveText: function CanvasGraphics_setLeadingMoveText(x, y) {
- this.setLeading(-y);
- this.moveText(x, y);
- },
- setTextMatrix: function CanvasGraphics_setTextMatrix(a, b, c, d, e, f) {
- this.current.textMatrix = [a, b, c, d, e, f];
- this.current.textMatrixScale = Math.sqrt(a * a + b * b);
- this.current.x = this.current.lineX = 0;
- this.current.y = this.current.lineY = 0;
- },
- nextLine: function CanvasGraphics_nextLine() {
- this.moveText(0, this.current.leading);
- },
- paintChar: function paintChar(character, x, y, patternTransform) {
- var ctx = this.ctx;
- var current = this.current;
- var font = current.font;
- var textRenderingMode = current.textRenderingMode;
- var fontSize = current.fontSize / current.fontSizeScale;
- var fillStrokeMode = textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK;
- var isAddToPathSet = !!(textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
- var patternFill = current.patternFill && font.data;
- var addToPath;
- if (font.disableFontFace || isAddToPathSet || patternFill) {
- addToPath = font.getPathGenerator(this.commonObjs, character);
- }
- if (font.disableFontFace || patternFill) {
- ctx.save();
- ctx.translate(x, y);
- ctx.beginPath();
- addToPath(ctx, fontSize);
- if (patternTransform) {
- ctx.setTransform.apply(ctx, patternTransform);
- }
- if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
- ctx.fill();
- }
- if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
- ctx.stroke();
- }
- ctx.restore();
- } else {
- if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
- ctx.fillText(character, x, y);
- }
- if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
- ctx.strokeText(character, x, y);
- }
- }
- if (isAddToPathSet) {
- var paths = this.pendingTextPaths || (this.pendingTextPaths = []);
- paths.push({
- transform: ctx.mozCurrentTransform,
- x: x,
- y: y,
- fontSize: fontSize,
- addToPath: addToPath
- });
- }
- },
-
- get isFontSubpixelAAEnabled() {
- var ctx = this.canvasFactory.create(10, 10).context;
- ctx.scale(1.5, 1);
- ctx.fillText('I', 0, 10);
- var data = ctx.getImageData(0, 0, 10, 10).data;
- var enabled = false;
- for (var i = 3; i < data.length; i += 4) {
- if (data[i] > 0 && data[i] < 255) {
- enabled = true;
- break;
- }
- }
- return (0, _util.shadow)(this, 'isFontSubpixelAAEnabled', enabled);
- },
- showText: function CanvasGraphics_showText(glyphs) {
- var current = this.current;
- var font = current.font;
- if (font.isType3Font) {
- return this.showType3Text(glyphs);
- }
- var fontSize = current.fontSize;
- if (fontSize === 0) {
- return;
- }
- var ctx = this.ctx;
- var fontSizeScale = current.fontSizeScale;
- var charSpacing = current.charSpacing;
- var wordSpacing = current.wordSpacing;
- var fontDirection = current.fontDirection;
- var textHScale = current.textHScale * fontDirection;
- var glyphsLength = glyphs.length;
- var vertical = font.vertical;
- var spacingDir = vertical ? 1 : -1;
- var defaultVMetrics = font.defaultVMetrics;
- var widthAdvanceScale = fontSize * current.fontMatrix[0];
- var simpleFillText = current.textRenderingMode === _util.TextRenderingMode.FILL && !font.disableFontFace && !current.patternFill;
- ctx.save();
- var patternTransform = void 0;
- if (current.patternFill) {
- ctx.save();
- var pattern = current.fillColor.getPattern(ctx, this);
- patternTransform = ctx.mozCurrentTransform;
- ctx.restore();
- ctx.fillStyle = pattern;
- }
- ctx.transform.apply(ctx, current.textMatrix);
- ctx.translate(current.x, current.y + current.textRise);
- if (fontDirection > 0) {
- ctx.scale(textHScale, -1);
- } else {
- ctx.scale(textHScale, 1);
- }
- var lineWidth = current.lineWidth;
- var scale = current.textMatrixScale;
- if (scale === 0 || lineWidth === 0) {
- var fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK;
- if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
- this._cachedGetSinglePixelWidth = null;
- lineWidth = this.getSinglePixelWidth() * MIN_WIDTH_FACTOR;
- }
- } else {
- lineWidth /= scale;
- }
- if (fontSizeScale !== 1.0) {
- ctx.scale(fontSizeScale, fontSizeScale);
- lineWidth /= fontSizeScale;
- }
- ctx.lineWidth = lineWidth;
- var x = 0,
- i;
- for (i = 0; i < glyphsLength; ++i) {
- var glyph = glyphs[i];
- if ((0, _util.isNum)(glyph)) {
- x += spacingDir * glyph * fontSize / 1000;
- continue;
- }
- var restoreNeeded = false;
- var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
- var character = glyph.fontChar;
- var accent = glyph.accent;
- var scaledX, scaledY, scaledAccentX, scaledAccentY;
- var width = glyph.width;
- if (vertical) {
- var vmetric, vx, vy;
- vmetric = glyph.vmetric || defaultVMetrics;
- vx = glyph.vmetric ? vmetric[1] : width * 0.5;
- vx = -vx * widthAdvanceScale;
- vy = vmetric[2] * widthAdvanceScale;
- width = vmetric ? -vmetric[0] : width;
- scaledX = vx / fontSizeScale;
- scaledY = (x + vy) / fontSizeScale;
- } else {
- scaledX = x / fontSizeScale;
- scaledY = 0;
- }
- if (font.remeasure && width > 0) {
- var measuredWidth = ctx.measureText(character).width * 1000 / fontSize * fontSizeScale;
- if (width < measuredWidth && this.isFontSubpixelAAEnabled) {
- var characterScaleX = width / measuredWidth;
- restoreNeeded = true;
- ctx.save();
- ctx.scale(characterScaleX, 1);
- scaledX /= characterScaleX;
- } else if (width !== measuredWidth) {
- scaledX += (width - measuredWidth) / 2000 * fontSize / fontSizeScale;
- }
- }
- if (glyph.isInFont || font.missingFile) {
- if (simpleFillText && !accent) {
- ctx.fillText(character, scaledX, scaledY);
- } else {
- this.paintChar(character, scaledX, scaledY, patternTransform);
- if (accent) {
- scaledAccentX = scaledX + accent.offset.x / fontSizeScale;
- scaledAccentY = scaledY - accent.offset.y / fontSizeScale;
- this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY, patternTransform);
- }
- }
- }
- var charWidth = width * widthAdvanceScale + spacing * fontDirection;
- x += charWidth;
- if (restoreNeeded) {
- ctx.restore();
- }
- }
- if (vertical) {
- current.y -= x * textHScale;
- } else {
- current.x += x * textHScale;
- }
- ctx.restore();
- },
- showType3Text: function CanvasGraphics_showType3Text(glyphs) {
- var ctx = this.ctx;
- var current = this.current;
- var font = current.font;
- var fontSize = current.fontSize;
- var fontDirection = current.fontDirection;
- var spacingDir = font.vertical ? 1 : -1;
- var charSpacing = current.charSpacing;
- var wordSpacing = current.wordSpacing;
- var textHScale = current.textHScale * fontDirection;
- var fontMatrix = current.fontMatrix || _util.FONT_IDENTITY_MATRIX;
- var glyphsLength = glyphs.length;
- var isTextInvisible = current.textRenderingMode === _util.TextRenderingMode.INVISIBLE;
- var i, glyph, width, spacingLength;
- if (isTextInvisible || fontSize === 0) {
- return;
- }
- this._cachedGetSinglePixelWidth = null;
- ctx.save();
- ctx.transform.apply(ctx, current.textMatrix);
- ctx.translate(current.x, current.y);
- ctx.scale(textHScale, fontDirection);
- for (i = 0; i < glyphsLength; ++i) {
- glyph = glyphs[i];
- if ((0, _util.isNum)(glyph)) {
- spacingLength = spacingDir * glyph * fontSize / 1000;
- this.ctx.translate(spacingLength, 0);
- current.x += spacingLength * textHScale;
- continue;
- }
- var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
- var operatorList = font.charProcOperatorList[glyph.operatorListId];
- if (!operatorList) {
- (0, _util.warn)('Type3 character "' + glyph.operatorListId + '" is not available.');
- continue;
- }
- this.processingType3 = glyph;
- this.save();
- ctx.scale(fontSize, fontSize);
- ctx.transform.apply(ctx, fontMatrix);
- this.executeOperatorList(operatorList);
- this.restore();
- var transformed = _util.Util.applyTransform([glyph.width, 0], fontMatrix);
- width = transformed[0] * fontSize + spacing;
- ctx.translate(width, 0);
- current.x += width * textHScale;
- }
- ctx.restore();
- this.processingType3 = null;
- },
- setCharWidth: function CanvasGraphics_setCharWidth(xWidth, yWidth) {},
- setCharWidthAndBounds: function CanvasGraphics_setCharWidthAndBounds(xWidth, yWidth, llx, lly, urx, ury) {
- this.ctx.rect(llx, lly, urx - llx, ury - lly);
- this.clip();
- this.endPath();
- },
- getColorN_Pattern: function CanvasGraphics_getColorN_Pattern(IR) {
- var _this = this;
-
- var pattern;
- if (IR[0] === 'TilingPattern') {
- var color = IR[1];
- var baseTransform = this.baseTransform || this.ctx.mozCurrentTransform.slice();
- var canvasGraphicsFactory = {
- createCanvasGraphics: function createCanvasGraphics(ctx) {
- return new CanvasGraphics(ctx, _this.commonObjs, _this.objs, _this.canvasFactory, _this.webGLContext);
- }
- };
- pattern = new _pattern_helper.TilingPattern(IR, color, this.ctx, canvasGraphicsFactory, baseTransform);
- } else {
- pattern = (0, _pattern_helper.getShadingPatternFromIR)(IR);
- }
- return pattern;
- },
- setStrokeColorN: function CanvasGraphics_setStrokeColorN() {
- this.current.strokeColor = this.getColorN_Pattern(arguments);
- },
- setFillColorN: function CanvasGraphics_setFillColorN() {
- this.current.fillColor = this.getColorN_Pattern(arguments);
- this.current.patternFill = true;
- },
- setStrokeRGBColor: function CanvasGraphics_setStrokeRGBColor(r, g, b) {
- var color = _util.Util.makeCssRgb(r, g, b);
- this.ctx.strokeStyle = color;
- this.current.strokeColor = color;
- },
- setFillRGBColor: function CanvasGraphics_setFillRGBColor(r, g, b) {
- var color = _util.Util.makeCssRgb(r, g, b);
- this.ctx.fillStyle = color;
- this.current.fillColor = color;
- this.current.patternFill = false;
- },
- shadingFill: function CanvasGraphics_shadingFill(patternIR) {
- var ctx = this.ctx;
- this.save();
- var pattern = (0, _pattern_helper.getShadingPatternFromIR)(patternIR);
- ctx.fillStyle = pattern.getPattern(ctx, this, true);
- var inv = ctx.mozCurrentTransformInverse;
- if (inv) {
- var canvas = ctx.canvas;
- var width = canvas.width;
- var height = canvas.height;
- 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]);
- this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0);
- } else {
- this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10);
- }
- this.restore();
- },
- beginInlineImage: function CanvasGraphics_beginInlineImage() {
- (0, _util.unreachable)('Should not call beginInlineImage');
- },
- beginImageData: function CanvasGraphics_beginImageData() {
- (0, _util.unreachable)('Should not call beginImageData');
- },
- paintFormXObjectBegin: function CanvasGraphics_paintFormXObjectBegin(matrix, bbox) {
- this.save();
- this.baseTransformStack.push(this.baseTransform);
- if (Array.isArray(matrix) && matrix.length === 6) {
- this.transform.apply(this, matrix);
- }
- this.baseTransform = this.ctx.mozCurrentTransform;
- if (Array.isArray(bbox) && bbox.length === 4) {
- var width = bbox[2] - bbox[0];
- var height = bbox[3] - bbox[1];
- this.ctx.rect(bbox[0], bbox[1], width, height);
- this.clip();
- this.endPath();
- }
- },
- paintFormXObjectEnd: function CanvasGraphics_paintFormXObjectEnd() {
- this.restore();
- this.baseTransform = this.baseTransformStack.pop();
- },
- beginGroup: function CanvasGraphics_beginGroup(group) {
- this.save();
- var currentCtx = this.ctx;
- if (!group.isolated) {
- (0, _util.info)('TODO: Support non-isolated groups.');
- }
- if (group.knockout) {
- (0, _util.warn)('Knockout groups not supported.');
- }
- var currentTransform = currentCtx.mozCurrentTransform;
- if (group.matrix) {
- currentCtx.transform.apply(currentCtx, group.matrix);
- }
- if (!group.bbox) {
- throw new Error('Bounding box is required.');
- }
- var bounds = _util.Util.getAxialAlignedBoundingBox(group.bbox, currentCtx.mozCurrentTransform);
- var canvasBounds = [0, 0, currentCtx.canvas.width, currentCtx.canvas.height];
- bounds = _util.Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0];
- var offsetX = Math.floor(bounds[0]);
- var offsetY = Math.floor(bounds[1]);
- var drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1);
- var drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1);
- var scaleX = 1,
- scaleY = 1;
- if (drawnWidth > MAX_GROUP_SIZE) {
- scaleX = drawnWidth / MAX_GROUP_SIZE;
- drawnWidth = MAX_GROUP_SIZE;
- }
- if (drawnHeight > MAX_GROUP_SIZE) {
- scaleY = drawnHeight / MAX_GROUP_SIZE;
- drawnHeight = MAX_GROUP_SIZE;
- }
- var cacheId = 'groupAt' + this.groupLevel;
- if (group.smask) {
- cacheId += '_smask_' + this.smaskCounter++ % 2;
- }
- var scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true);
- var groupCtx = scratchCanvas.context;
- groupCtx.scale(1 / scaleX, 1 / scaleY);
- groupCtx.translate(-offsetX, -offsetY);
- groupCtx.transform.apply(groupCtx, currentTransform);
- if (group.smask) {
- this.smaskStack.push({
- canvas: scratchCanvas.canvas,
- context: groupCtx,
- offsetX: offsetX,
- offsetY: offsetY,
- scaleX: scaleX,
- scaleY: scaleY,
- subtype: group.smask.subtype,
- backdrop: group.smask.backdrop,
- transferMap: group.smask.transferMap || null,
- startTransformInverse: null
- });
- } else {
- currentCtx.setTransform(1, 0, 0, 1, 0, 0);
- currentCtx.translate(offsetX, offsetY);
- currentCtx.scale(scaleX, scaleY);
- }
- copyCtxState(currentCtx, groupCtx);
- this.ctx = groupCtx;
- this.setGState([['BM', 'source-over'], ['ca', 1], ['CA', 1]]);
- this.groupStack.push(currentCtx);
- this.groupLevel++;
- this.current.activeSMask = null;
- },
- endGroup: function CanvasGraphics_endGroup(group) {
- this.groupLevel--;
- var groupCtx = this.ctx;
- this.ctx = this.groupStack.pop();
- if (this.ctx.imageSmoothingEnabled !== undefined) {
- this.ctx.imageSmoothingEnabled = false;
- } else {
- this.ctx.mozImageSmoothingEnabled = false;
- }
- if (group.smask) {
- this.tempSMask = this.smaskStack.pop();
- } else {
- this.ctx.drawImage(groupCtx.canvas, 0, 0);
- }
- this.restore();
- },
- beginAnnotations: function CanvasGraphics_beginAnnotations() {
- this.save();
- if (this.baseTransform) {
- this.ctx.setTransform.apply(this.ctx, this.baseTransform);
- }
- },
- endAnnotations: function CanvasGraphics_endAnnotations() {
- this.restore();
- },
- beginAnnotation: function CanvasGraphics_beginAnnotation(rect, transform, matrix) {
- this.save();
- resetCtxToDefault(this.ctx);
- this.current = new CanvasExtraState();
- if (Array.isArray(rect) && rect.length === 4) {
- var width = rect[2] - rect[0];
- var height = rect[3] - rect[1];
- this.ctx.rect(rect[0], rect[1], width, height);
- this.clip();
- this.endPath();
- }
- this.transform.apply(this, transform);
- this.transform.apply(this, matrix);
- },
- endAnnotation: function CanvasGraphics_endAnnotation() {
- this.restore();
- },
- paintJpegXObject: function CanvasGraphics_paintJpegXObject(objId, w, h) {
- var domImage = this.objs.get(objId);
- if (!domImage) {
- (0, _util.warn)('Dependent image isn\'t ready yet');
- return;
- }
- this.save();
- var ctx = this.ctx;
- ctx.scale(1 / w, -1 / h);
- ctx.drawImage(domImage, 0, 0, domImage.width, domImage.height, 0, -h, w, h);
- if (this.imageLayer) {
- var currentTransform = ctx.mozCurrentTransformInverse;
- var position = this.getCanvasPosition(0, 0);
- this.imageLayer.appendImage({
- objId: objId,
- left: position[0],
- top: position[1],
- width: w / currentTransform[0],
- height: h / currentTransform[3]
- });
- }
- this.restore();
- },
- paintImageMaskXObject: function CanvasGraphics_paintImageMaskXObject(img) {
- var ctx = this.ctx;
- var width = img.width,
- height = img.height;
- var fillColor = this.current.fillColor;
- var isPatternFill = this.current.patternFill;
- var glyph = this.processingType3;
- if (COMPILE_TYPE3_GLYPHS && glyph && glyph.compiled === undefined) {
- if (width <= MAX_SIZE_TO_COMPILE && height <= MAX_SIZE_TO_COMPILE) {
- glyph.compiled = compileType3Glyph({
- data: img.data,
- width: width,
- height: height
- });
- } else {
- glyph.compiled = null;
- }
- }
- if (glyph && glyph.compiled) {
- glyph.compiled(ctx);
- return;
- }
- var maskCanvas = this.cachedCanvases.getCanvas('maskCanvas', width, height);
- var maskCtx = maskCanvas.context;
- maskCtx.save();
- putBinaryImageMask(maskCtx, img);
- maskCtx.globalCompositeOperation = 'source-in';
- maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor;
- maskCtx.fillRect(0, 0, width, height);
- maskCtx.restore();
- this.paintInlineImageXObject(maskCanvas.canvas);
- },
- paintImageMaskXObjectRepeat: function CanvasGraphics_paintImageMaskXObjectRepeat(imgData, scaleX, scaleY, positions) {
- var width = imgData.width;
- var height = imgData.height;
- var fillColor = this.current.fillColor;
- var isPatternFill = this.current.patternFill;
- var maskCanvas = this.cachedCanvases.getCanvas('maskCanvas', width, height);
- var maskCtx = maskCanvas.context;
- maskCtx.save();
- putBinaryImageMask(maskCtx, imgData);
- maskCtx.globalCompositeOperation = 'source-in';
- maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor;
- maskCtx.fillRect(0, 0, width, height);
- maskCtx.restore();
- var ctx = this.ctx;
- for (var i = 0, ii = positions.length; i < ii; i += 2) {
- ctx.save();
- ctx.transform(scaleX, 0, 0, scaleY, positions[i], positions[i + 1]);
- ctx.scale(1, -1);
- ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1);
- ctx.restore();
- }
- },
- paintImageMaskXObjectGroup: function CanvasGraphics_paintImageMaskXObjectGroup(images) {
- var ctx = this.ctx;
- var fillColor = this.current.fillColor;
- var isPatternFill = this.current.patternFill;
- for (var i = 0, ii = images.length; i < ii; i++) {
- var image = images[i];
- var width = image.width,
- height = image.height;
- var maskCanvas = this.cachedCanvases.getCanvas('maskCanvas', width, height);
- var maskCtx = maskCanvas.context;
- maskCtx.save();
- putBinaryImageMask(maskCtx, image);
- maskCtx.globalCompositeOperation = 'source-in';
- maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor;
- maskCtx.fillRect(0, 0, width, height);
- maskCtx.restore();
- ctx.save();
- ctx.transform.apply(ctx, image.transform);
- ctx.scale(1, -1);
- ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1);
- ctx.restore();
- }
- },
- paintImageXObject: function CanvasGraphics_paintImageXObject(objId) {
- var imgData = this.objs.get(objId);
- if (!imgData) {
- (0, _util.warn)('Dependent image isn\'t ready yet');
- return;
- }
- this.paintInlineImageXObject(imgData);
- },
- paintImageXObjectRepeat: function CanvasGraphics_paintImageXObjectRepeat(objId, scaleX, scaleY, positions) {
- var imgData = this.objs.get(objId);
- if (!imgData) {
- (0, _util.warn)('Dependent image isn\'t ready yet');
- return;
- }
- var width = imgData.width;
- var height = imgData.height;
- var map = [];
- for (var i = 0, ii = positions.length; i < ii; i += 2) {
- map.push({
- transform: [scaleX, 0, 0, scaleY, positions[i], positions[i + 1]],
- x: 0,
- y: 0,
- w: width,
- h: height
- });
- }
- this.paintInlineImageXObjectGroup(imgData, map);
- },
- paintInlineImageXObject: function CanvasGraphics_paintInlineImageXObject(imgData) {
- var width = imgData.width;
- var height = imgData.height;
- var ctx = this.ctx;
- this.save();
- ctx.scale(1 / width, -1 / height);
- var currentTransform = ctx.mozCurrentTransformInverse;
- var a = currentTransform[0],
- b = currentTransform[1];
- var widthScale = Math.max(Math.sqrt(a * a + b * b), 1);
- var c = currentTransform[2],
- d = currentTransform[3];
- var heightScale = Math.max(Math.sqrt(c * c + d * d), 1);
- var imgToPaint, tmpCanvas;
- if (typeof HTMLElement === 'function' && imgData instanceof HTMLElement || !imgData.data) {
- imgToPaint = imgData;
- } else {
- tmpCanvas = this.cachedCanvases.getCanvas('inlineImage', width, height);
- var tmpCtx = tmpCanvas.context;
- putBinaryImageData(tmpCtx, imgData);
- imgToPaint = tmpCanvas.canvas;
- }
- var paintWidth = width,
- paintHeight = height;
- var tmpCanvasId = 'prescale1';
- while (widthScale > 2 && paintWidth > 1 || heightScale > 2 && paintHeight > 1) {
- var newWidth = paintWidth,
- newHeight = paintHeight;
- if (widthScale > 2 && paintWidth > 1) {
- newWidth = Math.ceil(paintWidth / 2);
- widthScale /= paintWidth / newWidth;
- }
- if (heightScale > 2 && paintHeight > 1) {
- newHeight = Math.ceil(paintHeight / 2);
- heightScale /= paintHeight / newHeight;
- }
- tmpCanvas = this.cachedCanvases.getCanvas(tmpCanvasId, newWidth, newHeight);
- tmpCtx = tmpCanvas.context;
- tmpCtx.clearRect(0, 0, newWidth, newHeight);
- tmpCtx.drawImage(imgToPaint, 0, 0, paintWidth, paintHeight, 0, 0, newWidth, newHeight);
- imgToPaint = tmpCanvas.canvas;
- paintWidth = newWidth;
- paintHeight = newHeight;
- tmpCanvasId = tmpCanvasId === 'prescale1' ? 'prescale2' : 'prescale1';
- }
- ctx.drawImage(imgToPaint, 0, 0, paintWidth, paintHeight, 0, -height, width, height);
- if (this.imageLayer) {
- var position = this.getCanvasPosition(0, -height);
- this.imageLayer.appendImage({
- imgData: imgData,
- left: position[0],
- top: position[1],
- width: width / currentTransform[0],
- height: height / currentTransform[3]
- });
- }
- this.restore();
- },
- paintInlineImageXObjectGroup: function CanvasGraphics_paintInlineImageXObjectGroup(imgData, map) {
- var ctx = this.ctx;
- var w = imgData.width;
- var h = imgData.height;
- var tmpCanvas = this.cachedCanvases.getCanvas('inlineImage', w, h);
- var tmpCtx = tmpCanvas.context;
- putBinaryImageData(tmpCtx, imgData);
- for (var i = 0, ii = map.length; i < ii; i++) {
- var entry = map[i];
- ctx.save();
- ctx.transform.apply(ctx, entry.transform);
- ctx.scale(1, -1);
- ctx.drawImage(tmpCanvas.canvas, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1);
- if (this.imageLayer) {
- var position = this.getCanvasPosition(entry.x, entry.y);
- this.imageLayer.appendImage({
- imgData: imgData,
- left: position[0],
- top: position[1],
- width: w,
- height: h
- });
- }
- ctx.restore();
- }
- },
- paintSolidColorImageMask: function CanvasGraphics_paintSolidColorImageMask() {
- this.ctx.fillRect(0, 0, 1, 1);
- },
- paintXObject: function CanvasGraphics_paintXObject() {
- (0, _util.warn)('Unsupported \'paintXObject\' command.');
- },
- markPoint: function CanvasGraphics_markPoint(tag) {},
- markPointProps: function CanvasGraphics_markPointProps(tag, properties) {},
- beginMarkedContent: function CanvasGraphics_beginMarkedContent(tag) {},
- beginMarkedContentProps: function CanvasGraphics_beginMarkedContentProps(tag, properties) {},
- endMarkedContent: function CanvasGraphics_endMarkedContent() {},
- beginCompat: function CanvasGraphics_beginCompat() {},
- endCompat: function CanvasGraphics_endCompat() {},
- consumePath: function CanvasGraphics_consumePath() {
- var ctx = this.ctx;
- if (this.pendingClip) {
- if (this.pendingClip === EO_CLIP) {
- ctx.clip('evenodd');
- } else {
- ctx.clip();
- }
- this.pendingClip = null;
- }
- ctx.beginPath();
- },
- getSinglePixelWidth: function getSinglePixelWidth(scale) {
- if (this._cachedGetSinglePixelWidth === null) {
- var inverse = this.ctx.mozCurrentTransformInverse;
- this._cachedGetSinglePixelWidth = Math.sqrt(Math.max(inverse[0] * inverse[0] + inverse[1] * inverse[1], inverse[2] * inverse[2] + inverse[3] * inverse[3]));
- }
- return this._cachedGetSinglePixelWidth;
- },
-
- getCanvasPosition: function CanvasGraphics_getCanvasPosition(x, y) {
- var transform = this.ctx.mozCurrentTransform;
- return [transform[0] * x + transform[2] * y + transform[4], transform[1] * x + transform[3] * y + transform[5]];
- }
- };
- for (var op in _util.OPS) {
- CanvasGraphics.prototype[_util.OPS[op]] = CanvasGraphics.prototype[op];
- }
- return CanvasGraphics;
-}();
-exports.CanvasGraphics = CanvasGraphics;
-
-/***/ }),
-/* 134 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.TilingPattern = exports.getShadingPatternFromIR = undefined;
-
-var _util = __w_pdfjs_require__(1);
-
-var ShadingIRs = {};
-ShadingIRs.RadialAxial = {
- fromIR: function RadialAxial_fromIR(raw) {
- var type = raw[1];
- var colorStops = raw[2];
- var p0 = raw[3];
- var p1 = raw[4];
- var r0 = raw[5];
- var r1 = raw[6];
- return {
- type: 'Pattern',
- getPattern: function RadialAxial_getPattern(ctx) {
- var grad;
- if (type === 'axial') {
- grad = ctx.createLinearGradient(p0[0], p0[1], p1[0], p1[1]);
- } else if (type === 'radial') {
- grad = ctx.createRadialGradient(p0[0], p0[1], r0, p1[0], p1[1], r1);
- }
- for (var i = 0, ii = colorStops.length; i < ii; ++i) {
- var c = colorStops[i];
- grad.addColorStop(c[0], c[1]);
- }
- return grad;
- }
- };
- }
-};
-var createMeshCanvas = function createMeshCanvasClosure() {
- function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) {
- var coords = context.coords,
- colors = context.colors;
- var bytes = data.data,
- rowSize = data.width * 4;
- var tmp;
- if (coords[p1 + 1] > coords[p2 + 1]) {
- tmp = p1;
- p1 = p2;
- p2 = tmp;
- tmp = c1;
- c1 = c2;
- c2 = tmp;
- }
- if (coords[p2 + 1] > coords[p3 + 1]) {
- tmp = p2;
- p2 = p3;
- p3 = tmp;
- tmp = c2;
- c2 = c3;
- c3 = tmp;
- }
- if (coords[p1 + 1] > coords[p2 + 1]) {
- tmp = p1;
- p1 = p2;
- p2 = tmp;
- tmp = c1;
- c1 = c2;
- c2 = tmp;
- }
- var x1 = (coords[p1] + context.offsetX) * context.scaleX;
- var y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY;
- var x2 = (coords[p2] + context.offsetX) * context.scaleX;
- var y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY;
- var x3 = (coords[p3] + context.offsetX) * context.scaleX;
- var y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY;
- if (y1 >= y3) {
- return;
- }
- var c1r = colors[c1],
- c1g = colors[c1 + 1],
- c1b = colors[c1 + 2];
- var c2r = colors[c2],
- c2g = colors[c2 + 1],
- c2b = colors[c2 + 2];
- var c3r = colors[c3],
- c3g = colors[c3 + 1],
- c3b = colors[c3 + 2];
- var minY = Math.round(y1),
- maxY = Math.round(y3);
- var xa, car, cag, cab;
- var xb, cbr, cbg, cbb;
- var k;
- for (var y = minY; y <= maxY; y++) {
- if (y < y2) {
- k = y < y1 ? 0 : y1 === y2 ? 1 : (y1 - y) / (y1 - y2);
- xa = x1 - (x1 - x2) * k;
- car = c1r - (c1r - c2r) * k;
- cag = c1g - (c1g - c2g) * k;
- cab = c1b - (c1b - c2b) * k;
- } else {
- k = y > y3 ? 1 : y2 === y3 ? 0 : (y2 - y) / (y2 - y3);
- xa = x2 - (x2 - x3) * k;
- car = c2r - (c2r - c3r) * k;
- cag = c2g - (c2g - c3g) * k;
- cab = c2b - (c2b - c3b) * k;
- }
- k = y < y1 ? 0 : y > y3 ? 1 : (y1 - y) / (y1 - y3);
- xb = x1 - (x1 - x3) * k;
- cbr = c1r - (c1r - c3r) * k;
- cbg = c1g - (c1g - c3g) * k;
- cbb = c1b - (c1b - c3b) * k;
- var x1_ = Math.round(Math.min(xa, xb));
- var x2_ = Math.round(Math.max(xa, xb));
- var j = rowSize * y + x1_ * 4;
- for (var x = x1_; x <= x2_; x++) {
- k = (xa - x) / (xa - xb);
- k = k < 0 ? 0 : k > 1 ? 1 : k;
- bytes[j++] = car - (car - cbr) * k | 0;
- bytes[j++] = cag - (cag - cbg) * k | 0;
- bytes[j++] = cab - (cab - cbb) * k | 0;
- bytes[j++] = 255;
- }
- }
- }
- function drawFigure(data, figure, context) {
- var ps = figure.coords;
- var cs = figure.colors;
- var i, ii;
- switch (figure.type) {
- case 'lattice':
- var verticesPerRow = figure.verticesPerRow;
- var rows = Math.floor(ps.length / verticesPerRow) - 1;
- var cols = verticesPerRow - 1;
- for (i = 0; i < rows; i++) {
- var q = i * verticesPerRow;
- for (var j = 0; j < cols; j++, q++) {
- drawTriangle(data, context, ps[q], ps[q + 1], ps[q + verticesPerRow], cs[q], cs[q + 1], cs[q + verticesPerRow]);
- drawTriangle(data, context, ps[q + verticesPerRow + 1], ps[q + 1], ps[q + verticesPerRow], cs[q + verticesPerRow + 1], cs[q + 1], cs[q + verticesPerRow]);
- }
- }
- break;
- case 'triangles':
- for (i = 0, ii = ps.length; i < ii; i += 3) {
- drawTriangle(data, context, ps[i], ps[i + 1], ps[i + 2], cs[i], cs[i + 1], cs[i + 2]);
- }
- break;
- default:
- throw new Error('illegal figure');
- }
- }
- function createMeshCanvas(bounds, combinesScale, coords, colors, figures, backgroundColor, cachedCanvases, webGLContext) {
- var EXPECTED_SCALE = 1.1;
- var MAX_PATTERN_SIZE = 3000;
- var BORDER_SIZE = 2;
- var offsetX = Math.floor(bounds[0]);
- var offsetY = Math.floor(bounds[1]);
- var boundsWidth = Math.ceil(bounds[2]) - offsetX;
- var boundsHeight = Math.ceil(bounds[3]) - offsetY;
- var width = Math.min(Math.ceil(Math.abs(boundsWidth * combinesScale[0] * EXPECTED_SCALE)), MAX_PATTERN_SIZE);
- var height = Math.min(Math.ceil(Math.abs(boundsHeight * combinesScale[1] * EXPECTED_SCALE)), MAX_PATTERN_SIZE);
- var scaleX = boundsWidth / width;
- var scaleY = boundsHeight / height;
- var context = {
- coords: coords,
- colors: colors,
- offsetX: -offsetX,
- offsetY: -offsetY,
- scaleX: 1 / scaleX,
- scaleY: 1 / scaleY
- };
- var paddedWidth = width + BORDER_SIZE * 2;
- var paddedHeight = height + BORDER_SIZE * 2;
- var canvas, tmpCanvas, i, ii;
- if (webGLContext.isEnabled) {
- canvas = webGLContext.drawFigures({
- width: width,
- height: height,
- backgroundColor: backgroundColor,
- figures: figures,
- context: context
- });
- tmpCanvas = cachedCanvases.getCanvas('mesh', paddedWidth, paddedHeight, false);
- tmpCanvas.context.drawImage(canvas, BORDER_SIZE, BORDER_SIZE);
- canvas = tmpCanvas.canvas;
- } else {
- tmpCanvas = cachedCanvases.getCanvas('mesh', paddedWidth, paddedHeight, false);
- var tmpCtx = tmpCanvas.context;
- var data = tmpCtx.createImageData(width, height);
- if (backgroundColor) {
- var bytes = data.data;
- for (i = 0, ii = bytes.length; i < ii; i += 4) {
- bytes[i] = backgroundColor[0];
- bytes[i + 1] = backgroundColor[1];
- bytes[i + 2] = backgroundColor[2];
- bytes[i + 3] = 255;
- }
- }
- for (i = 0; i < figures.length; i++) {
- drawFigure(data, figures[i], context);
- }
- tmpCtx.putImageData(data, BORDER_SIZE, BORDER_SIZE);
- canvas = tmpCanvas.canvas;
- }
- return {
- canvas: canvas,
- offsetX: offsetX - BORDER_SIZE * scaleX,
- offsetY: offsetY - BORDER_SIZE * scaleY,
- scaleX: scaleX,
- scaleY: scaleY
- };
- }
- return createMeshCanvas;
-}();
-ShadingIRs.Mesh = {
- fromIR: function Mesh_fromIR(raw) {
- var coords = raw[2];
- var colors = raw[3];
- var figures = raw[4];
- var bounds = raw[5];
- var matrix = raw[6];
- var background = raw[8];
- return {
- type: 'Pattern',
- getPattern: function Mesh_getPattern(ctx, owner, shadingFill) {
- var scale;
- if (shadingFill) {
- scale = _util.Util.singularValueDecompose2dScale(ctx.mozCurrentTransform);
- } else {
- scale = _util.Util.singularValueDecompose2dScale(owner.baseTransform);
- if (matrix) {
- var matrixScale = _util.Util.singularValueDecompose2dScale(matrix);
- scale = [scale[0] * matrixScale[0], scale[1] * matrixScale[1]];
- }
- }
- var temporaryPatternCanvas = createMeshCanvas(bounds, scale, coords, colors, figures, shadingFill ? null : background, owner.cachedCanvases, owner.webGLContext);
- if (!shadingFill) {
- ctx.setTransform.apply(ctx, owner.baseTransform);
- if (matrix) {
- ctx.transform.apply(ctx, matrix);
- }
- }
- ctx.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY);
- ctx.scale(temporaryPatternCanvas.scaleX, temporaryPatternCanvas.scaleY);
- return ctx.createPattern(temporaryPatternCanvas.canvas, 'no-repeat');
- }
- };
- }
-};
-ShadingIRs.Dummy = {
- fromIR: function Dummy_fromIR() {
- return {
- type: 'Pattern',
- getPattern: function Dummy_fromIR_getPattern() {
- return 'hotpink';
- }
- };
- }
-};
-function getShadingPatternFromIR(raw) {
- var shadingIR = ShadingIRs[raw[0]];
- if (!shadingIR) {
- throw new Error('Unknown IR type: ' + raw[0]);
- }
- return shadingIR.fromIR(raw);
-}
-var TilingPattern = function TilingPatternClosure() {
- var PaintType = {
- COLORED: 1,
- UNCOLORED: 2
- };
- var MAX_PATTERN_SIZE = 3000;
- function TilingPattern(IR, color, ctx, canvasGraphicsFactory, baseTransform) {
- this.operatorList = IR[2];
- this.matrix = IR[3] || [1, 0, 0, 1, 0, 0];
- this.bbox = IR[4];
- this.xstep = IR[5];
- this.ystep = IR[6];
- this.paintType = IR[7];
- this.tilingType = IR[8];
- this.color = color;
- this.canvasGraphicsFactory = canvasGraphicsFactory;
- this.baseTransform = baseTransform;
- this.type = 'Pattern';
- this.ctx = ctx;
- }
- TilingPattern.prototype = {
- createPatternCanvas: function TilinPattern_createPatternCanvas(owner) {
- var operatorList = this.operatorList;
- var bbox = this.bbox;
- var xstep = this.xstep;
- var ystep = this.ystep;
- var paintType = this.paintType;
- var tilingType = this.tilingType;
- var color = this.color;
- var canvasGraphicsFactory = this.canvasGraphicsFactory;
- (0, _util.info)('TilingType: ' + tilingType);
- var x0 = bbox[0],
- 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 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);
- this.clipBbox(graphics, bbox, x0, y0, x1, y1);
- graphics.executeOperatorList(operatorList);
- 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]);
- },
- clipBbox: function clipBbox(graphics, bbox, x0, y0, x1, y1) {
- if (Array.isArray(bbox) && bbox.length === 4) {
- var bboxWidth = x1 - x0;
- var bboxHeight = y1 - y0;
- graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight);
- graphics.clip();
- graphics.endPath();
- }
- },
- setFillAndStrokeStyleToContext: function setFillAndStrokeStyleToContext(graphics, paintType, color) {
- var context = graphics.ctx,
- current = graphics.current;
- switch (paintType) {
- case PaintType.COLORED:
- var ctx = this.ctx;
- context.fillStyle = ctx.fillStyle;
- context.strokeStyle = ctx.strokeStyle;
- current.fillColor = ctx.fillStyle;
- current.strokeColor = ctx.strokeStyle;
- break;
- case PaintType.UNCOLORED:
- var cssColor = _util.Util.makeCssRgb(color[0], color[1], color[2]);
- context.fillStyle = cssColor;
- context.strokeStyle = cssColor;
- current.fillColor = cssColor;
- current.strokeColor = cssColor;
- break;
- default:
- throw new _util.FormatError('Unsupported paint type: ' + paintType);
- }
- },
- 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();
- return ctx.createPattern(temporaryPatternCanvas, 'repeat');
- }
- };
- return TilingPattern;
-}();
-exports.getShadingPatternFromIR = getShadingPatternFromIR;
-exports.TilingPattern = TilingPattern;
-
-/***/ }),
-/* 135 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-var GlobalWorkerOptions = Object.create(null);
-GlobalWorkerOptions.workerPort = GlobalWorkerOptions.workerPort === undefined ? null : GlobalWorkerOptions.workerPort;
-GlobalWorkerOptions.workerSrc = GlobalWorkerOptions.workerSrc === undefined ? '' : GlobalWorkerOptions.workerSrc;
-exports.GlobalWorkerOptions = GlobalWorkerOptions;
-
-/***/ }),
-/* 136 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.MessageHandler = undefined;
-
-var _regenerator = __w_pdfjs_require__(137);
-
-var _regenerator2 = _interopRequireDefault(_regenerator);
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-var resolveCall = function () {
- var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee(fn, args) {
- var thisArg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
- return _regenerator2.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- if (fn) {
- _context.next = 2;
- break;
- }
-
- return _context.abrupt('return');
-
- case 2:
- return _context.abrupt('return', fn.apply(thisArg, args));
-
- case 3:
- case 'end':
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
-
- return function resolveCall(_x2, _x3) {
- return _ref.apply(this, arguments);
- };
-}();
-
-var _util = __w_pdfjs_require__(1);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
-
-function wrapReason(reason) {
- if ((typeof reason === 'undefined' ? 'undefined' : _typeof(reason)) !== 'object') {
- return reason;
- }
- switch (reason.name) {
- case 'AbortException':
- return new _util.AbortException(reason.message);
- case 'MissingPDFException':
- return new _util.MissingPDFException(reason.message);
- case 'UnexpectedResponseException':
- return new _util.UnexpectedResponseException(reason.message, reason.status);
- default:
- return new _util.UnknownErrorException(reason.message, reason.details);
- }
-}
-function makeReasonSerializable(reason) {
- if (!(reason instanceof Error) || reason instanceof _util.AbortException || reason instanceof _util.MissingPDFException || reason instanceof _util.UnexpectedResponseException || reason instanceof _util.UnknownErrorException) {
- return reason;
- }
- return new _util.UnknownErrorException(reason.message, reason.toString());
-}
-function resolveOrReject(capability, success, reason) {
- if (success) {
- capability.resolve();
- } else {
- capability.reject(reason);
- }
-}
-function finalize(promise) {
- return Promise.resolve(promise).catch(function () {});
-}
-function MessageHandler(sourceName, targetName, comObj) {
- var _this = this;
-
- this.sourceName = sourceName;
- this.targetName = targetName;
- this.comObj = comObj;
- this.callbackId = 1;
- this.streamId = 1;
- this.postMessageTransfers = true;
- this.streamSinks = Object.create(null);
- this.streamControllers = Object.create(null);
- var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
- var ah = this.actionHandler = Object.create(null);
- this._onComObjOnMessage = function (event) {
- var data = event.data;
- if (data.targetName !== _this.sourceName) {
- return;
- }
- if (data.stream) {
- _this._processStreamMessage(data);
- } else if (data.isReply) {
- var callbackId = data.callbackId;
- if (data.callbackId in callbacksCapabilities) {
- var callback = callbacksCapabilities[callbackId];
- delete callbacksCapabilities[callbackId];
- if ('error' in data) {
- callback.reject(wrapReason(data.error));
- } else {
- callback.resolve(data.data);
- }
- } else {
- throw new Error('Cannot resolve callback ' + callbackId);
- }
- } else if (data.action in ah) {
- var action = ah[data.action];
- if (data.callbackId) {
- var _sourceName = _this.sourceName;
- var _targetName = data.sourceName;
- Promise.resolve().then(function () {
- return action[0].call(action[1], data.data);
- }).then(function (result) {
- comObj.postMessage({
- sourceName: _sourceName,
- targetName: _targetName,
- isReply: true,
- callbackId: data.callbackId,
- data: result
- });
- }, function (reason) {
- comObj.postMessage({
- sourceName: _sourceName,
- targetName: _targetName,
- isReply: true,
- callbackId: data.callbackId,
- error: makeReasonSerializable(reason)
- });
- });
- } else if (data.streamId) {
- _this._createStreamSink(data);
- } else {
- action[0].call(action[1], data.data);
- }
- } else {
- throw new Error('Unknown action from worker: ' + data.action);
- }
- };
- comObj.addEventListener('message', this._onComObjOnMessage);
-}
-MessageHandler.prototype = {
- on: function on(actionName, handler, scope) {
- var ah = this.actionHandler;
- if (ah[actionName]) {
- throw new Error('There is already an actionName called "' + actionName + '"');
- }
- ah[actionName] = [handler, scope];
- },
- send: function send(actionName, data, transfers) {
- var message = {
- sourceName: this.sourceName,
- targetName: this.targetName,
- action: actionName,
- data: data
- };
- this.postMessage(message, transfers);
- },
- sendWithPromise: function sendWithPromise(actionName, data, transfers) {
- var callbackId = this.callbackId++;
- var message = {
- sourceName: this.sourceName,
- targetName: this.targetName,
- action: actionName,
- data: data,
- callbackId: callbackId
- };
- var capability = (0, _util.createPromiseCapability)();
- this.callbacksCapabilities[callbackId] = capability;
- try {
- this.postMessage(message, transfers);
- } catch (e) {
- capability.reject(e);
- }
- return capability.promise;
- },
- sendWithStream: function sendWithStream(actionName, data, queueingStrategy, transfers) {
- var _this2 = this;
-
- var streamId = this.streamId++;
- var sourceName = this.sourceName;
- var targetName = this.targetName;
- return new _util.ReadableStream({
- start: function start(controller) {
- var startCapability = (0, _util.createPromiseCapability)();
- _this2.streamControllers[streamId] = {
- controller: controller,
- startCall: startCapability,
- isClosed: false
- };
- _this2.postMessage({
- sourceName: sourceName,
- targetName: targetName,
- action: actionName,
- streamId: streamId,
- data: data,
- desiredSize: controller.desiredSize
- });
- return startCapability.promise;
- },
- pull: function pull(controller) {
- var pullCapability = (0, _util.createPromiseCapability)();
- _this2.streamControllers[streamId].pullCall = pullCapability;
- _this2.postMessage({
- sourceName: sourceName,
- targetName: targetName,
- stream: 'pull',
- streamId: streamId,
- desiredSize: controller.desiredSize
- });
- return pullCapability.promise;
- },
- cancel: function cancel(reason) {
- var cancelCapability = (0, _util.createPromiseCapability)();
- _this2.streamControllers[streamId].cancelCall = cancelCapability;
- _this2.streamControllers[streamId].isClosed = true;
- _this2.postMessage({
- sourceName: sourceName,
- targetName: targetName,
- stream: 'cancel',
- reason: reason,
- streamId: streamId
- });
- return cancelCapability.promise;
- }
- }, queueingStrategy);
- },
- _createStreamSink: function _createStreamSink(data) {
- var _this3 = this;
-
- var self = this;
- var action = this.actionHandler[data.action];
- var streamId = data.streamId;
- var desiredSize = data.desiredSize;
- var sourceName = this.sourceName;
- var targetName = data.sourceName;
- var capability = (0, _util.createPromiseCapability)();
- var sendStreamRequest = function sendStreamRequest(_ref2) {
- var stream = _ref2.stream,
- chunk = _ref2.chunk,
- transfers = _ref2.transfers,
- success = _ref2.success,
- reason = _ref2.reason;
-
- _this3.postMessage({
- sourceName: sourceName,
- targetName: targetName,
- stream: stream,
- streamId: streamId,
- chunk: chunk,
- success: success,
- reason: reason
- }, transfers);
- };
- var streamSink = {
- enqueue: function enqueue(chunk) {
- var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
- var transfers = arguments[2];
-
- if (this.isCancelled) {
- return;
- }
- var lastDesiredSize = this.desiredSize;
- this.desiredSize -= size;
- if (lastDesiredSize > 0 && this.desiredSize <= 0) {
- this.sinkCapability = (0, _util.createPromiseCapability)();
- this.ready = this.sinkCapability.promise;
- }
- sendStreamRequest({
- stream: 'enqueue',
- chunk: chunk,
- transfers: transfers
- });
- },
- close: function close() {
- if (this.isCancelled) {
- return;
- }
- this.isCancelled = true;
- sendStreamRequest({ stream: 'close' });
- delete self.streamSinks[streamId];
- },
- error: function error(reason) {
- if (this.isCancelled) {
- return;
- }
- this.isCancelled = true;
- sendStreamRequest({
- stream: 'error',
- reason: reason
- });
- },
-
- sinkCapability: capability,
- onPull: null,
- onCancel: null,
- isCancelled: false,
- desiredSize: desiredSize,
- ready: null
- };
- streamSink.sinkCapability.resolve();
- streamSink.ready = streamSink.sinkCapability.promise;
- this.streamSinks[streamId] = streamSink;
- resolveCall(action[0], [data.data, streamSink], action[1]).then(function () {
- sendStreamRequest({
- stream: 'start_complete',
- success: true
- });
- }, function (reason) {
- sendStreamRequest({
- stream: 'start_complete',
- success: false,
- reason: reason
- });
- });
- },
- _processStreamMessage: function _processStreamMessage(data) {
- var _this4 = this;
-
- var sourceName = this.sourceName;
- var targetName = data.sourceName;
- var streamId = data.streamId;
- var sendStreamResponse = function sendStreamResponse(_ref3) {
- var stream = _ref3.stream,
- success = _ref3.success,
- reason = _ref3.reason;
-
- _this4.comObj.postMessage({
- sourceName: sourceName,
- targetName: targetName,
- stream: stream,
- success: success,
- streamId: streamId,
- reason: reason
- });
- };
- var deleteStreamController = function deleteStreamController() {
- Promise.all([_this4.streamControllers[data.streamId].startCall, _this4.streamControllers[data.streamId].pullCall, _this4.streamControllers[data.streamId].cancelCall].map(function (capability) {
- return capability && finalize(capability.promise);
- })).then(function () {
- delete _this4.streamControllers[data.streamId];
- });
- };
- switch (data.stream) {
- case 'start_complete':
- resolveOrReject(this.streamControllers[data.streamId].startCall, data.success, wrapReason(data.reason));
- break;
- case 'pull_complete':
- resolveOrReject(this.streamControllers[data.streamId].pullCall, data.success, wrapReason(data.reason));
- break;
- case 'pull':
- if (!this.streamSinks[data.streamId]) {
- sendStreamResponse({
- stream: 'pull_complete',
- success: true
- });
- break;
- }
- if (this.streamSinks[data.streamId].desiredSize <= 0 && data.desiredSize > 0) {
- this.streamSinks[data.streamId].sinkCapability.resolve();
- }
- this.streamSinks[data.streamId].desiredSize = data.desiredSize;
- resolveCall(this.streamSinks[data.streamId].onPull).then(function () {
- sendStreamResponse({
- stream: 'pull_complete',
- success: true
- });
- }, function (reason) {
- sendStreamResponse({
- stream: 'pull_complete',
- success: false,
- reason: reason
- });
- });
- break;
- case 'enqueue':
- (0, _util.assert)(this.streamControllers[data.streamId], 'enqueue should have stream controller');
- if (!this.streamControllers[data.streamId].isClosed) {
- this.streamControllers[data.streamId].controller.enqueue(data.chunk);
- }
- break;
- case 'close':
- (0, _util.assert)(this.streamControllers[data.streamId], 'close should have stream controller');
- if (this.streamControllers[data.streamId].isClosed) {
- break;
- }
- this.streamControllers[data.streamId].isClosed = true;
- this.streamControllers[data.streamId].controller.close();
- deleteStreamController();
- break;
- case 'error':
- (0, _util.assert)(this.streamControllers[data.streamId], 'error should have stream controller');
- this.streamControllers[data.streamId].controller.error(wrapReason(data.reason));
- deleteStreamController();
- break;
- case 'cancel_complete':
- resolveOrReject(this.streamControllers[data.streamId].cancelCall, data.success, wrapReason(data.reason));
- deleteStreamController();
- break;
- case 'cancel':
- if (!this.streamSinks[data.streamId]) {
- break;
- }
- resolveCall(this.streamSinks[data.streamId].onCancel, [wrapReason(data.reason)]).then(function () {
- sendStreamResponse({
- stream: 'cancel_complete',
- success: true
- });
- }, function (reason) {
- sendStreamResponse({
- stream: 'cancel_complete',
- success: false,
- reason: reason
- });
- });
- this.streamSinks[data.streamId].sinkCapability.reject(wrapReason(data.reason));
- this.streamSinks[data.streamId].isCancelled = true;
- delete this.streamSinks[data.streamId];
- break;
- default:
- throw new Error('Unexpected stream case');
- }
- },
- postMessage: function postMessage(message, transfers) {
- if (transfers && this.postMessageTransfers) {
- this.comObj.postMessage(message, transfers);
- } else {
- this.comObj.postMessage(message);
- }
- },
- destroy: function destroy() {
- this.comObj.removeEventListener('message', this._onComObjOnMessage);
- }
-};
-exports.MessageHandler = MessageHandler;
-
-/***/ }),
-/* 137 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = __w_pdfjs_require__(138);
-
-/***/ }),
-/* 138 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var g = function () {
- return this;
-}() || 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__(139);
-if (hadRuntime) {
- g.regeneratorRuntime = oldRuntime;
-} else {
- try {
- delete g.regeneratorRuntime;
- } catch (e) {
- g.regeneratorRuntime = undefined;
- }
-}
-
-/***/ }),
-/* 139 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(module) {
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-!function (global) {
- "use strict";
-
- var Op = Object.prototype;
- var hasOwn = Op.hasOwnProperty;
- var undefined;
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
- 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;
- var generator = Object.create(protoGenerator.prototype);
- var context = new Context(tryLocsList || []);
- generator._invoke = makeInvokeMethod(innerFn, self, context);
- return generator;
- }
- runtime.wrap = wrap;
- function tryCatch(fn, obj, arg) {
- try {
- return {
- type: "normal",
- arg: fn.call(obj, arg)
- };
- } catch (err) {
- return {
- type: "throw",
- arg: err
- };
- }
- }
- var GenStateSuspendedStart = "suspendedStart";
- var GenStateSuspendedYield = "suspendedYield";
- var GenStateExecuting = "executing";
- var GenStateCompleted = "completed";
- var ContinueSentinel = {};
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
- var IteratorPrototype = {};
- IteratorPrototype[iteratorSymbol] = function () {
- return this;
- };
- var getProto = Object.getPrototypeOf;
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
- if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
- IteratorPrototype = NativeIteratorPrototype;
- }
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
- GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
- GeneratorFunctionPrototype.constructor = GeneratorFunction;
- GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction";
- function defineIteratorMethods(prototype) {
- ["next", "throw", "return"].forEach(function (method) {
- prototype[method] = function (arg) {
- return this._invoke(method, arg);
- };
- });
- }
- runtime.isGeneratorFunction = function (genFun) {
- var ctor = typeof genFun === "function" && genFun.constructor;
- return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
- };
- runtime.mark = function (genFun) {
- if (Object.setPrototypeOf) {
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
- } else {
- genFun.__proto__ = GeneratorFunctionPrototype;
- if (!(toStringTagSymbol in genFun)) {
- genFun[toStringTagSymbol] = "GeneratorFunction";
- }
- }
- genFun.prototype = Object.create(Gp);
- return genFun;
- };
- runtime.awrap = function (arg) {
- return { __await: arg };
- };
- function AsyncIterator(generator) {
- function invoke(method, arg, resolve, reject) {
- var record = tryCatch(generator[method], generator, arg);
- if (record.type === "throw") {
- reject(record.arg);
- } else {
- var result = record.arg;
- var value = result.value;
- if (value && (typeof value === "undefined" ? "undefined" : _typeof(value)) === "object" && hasOwn.call(value, "__await")) {
- return Promise.resolve(value.__await).then(function (value) {
- invoke("next", value, resolve, reject);
- }, function (err) {
- invoke("throw", err, resolve, reject);
- });
- }
- return Promise.resolve(value).then(function (unwrapped) {
- result.value = unwrapped;
- resolve(result);
- }, reject);
- }
- }
- var previousPromise;
- function enqueue(method, arg) {
- function callInvokeWithMethodAndArg() {
- return new Promise(function (resolve, reject) {
- invoke(method, arg, resolve, reject);
- });
- }
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
- }
- this._invoke = enqueue;
- }
- defineIteratorMethods(AsyncIterator.prototype);
- AsyncIterator.prototype[asyncIteratorSymbol] = function () {
- return this;
- };
- runtime.AsyncIterator = AsyncIterator;
- runtime.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 result.done ? result.value : iter.next();
- });
- };
- function makeInvokeMethod(innerFn, self, context) {
- var state = GenStateSuspendedStart;
- return function invoke(method, arg) {
- if (state === GenStateExecuting) {
- throw new Error("Generator is already running");
- }
- if (state === GenStateCompleted) {
- if (method === "throw") {
- throw arg;
- }
- return doneResult();
- }
- context.method = method;
- context.arg = arg;
- while (true) {
- var delegate = context.delegate;
- if (delegate) {
- var delegateResult = maybeInvokeDelegate(delegate, context);
- if (delegateResult) {
- if (delegateResult === ContinueSentinel) continue;
- return delegateResult;
- }
- }
- if (context.method === "next") {
- context.sent = context._sent = context.arg;
- } else if (context.method === "throw") {
- if (state === GenStateSuspendedStart) {
- state = GenStateCompleted;
- throw context.arg;
- }
- context.dispatchException(context.arg);
- } else if (context.method === "return") {
- context.abrupt("return", context.arg);
- }
- state = GenStateExecuting;
- var record = tryCatch(innerFn, self, context);
- if (record.type === "normal") {
- state = context.done ? GenStateCompleted : GenStateSuspendedYield;
- if (record.arg === ContinueSentinel) {
- continue;
- }
- return {
- value: record.arg,
- done: context.done
- };
- } else if (record.type === "throw") {
- state = GenStateCompleted;
- context.method = "throw";
- context.arg = record.arg;
- }
- }
- };
- }
- function maybeInvokeDelegate(delegate, context) {
- var method = delegate.iterator[context.method];
- if (method === undefined) {
- context.delegate = null;
- if (context.method === "throw") {
- if (delegate.iterator.return) {
- context.method = "return";
- context.arg = undefined;
- maybeInvokeDelegate(delegate, context);
- if (context.method === "throw") {
- return ContinueSentinel;
- }
- }
- context.method = "throw";
- context.arg = new TypeError("The iterator does not provide a 'throw' method");
- }
- return ContinueSentinel;
- }
- var record = tryCatch(method, delegate.iterator, context.arg);
- if (record.type === "throw") {
- context.method = "throw";
- context.arg = record.arg;
- context.delegate = null;
- return ContinueSentinel;
- }
- var info = record.arg;
- if (!info) {
- context.method = "throw";
- context.arg = new TypeError("iterator result is not an object");
- context.delegate = null;
- return ContinueSentinel;
- }
- if (info.done) {
- context[delegate.resultName] = info.value;
- context.next = delegate.nextLoc;
- if (context.method !== "return") {
- context.method = "next";
- context.arg = undefined;
- }
- } else {
- return info;
- }
- context.delegate = null;
- return ContinueSentinel;
- }
- defineIteratorMethods(Gp);
- Gp[toStringTagSymbol] = "Generator";
- Gp[iteratorSymbol] = function () {
- return this;
- };
- Gp.toString = function () {
- return "[object Generator]";
- };
- function pushTryEntry(locs) {
- var entry = { tryLoc: locs[0] };
- if (1 in locs) {
- entry.catchLoc = locs[1];
- }
- if (2 in locs) {
- entry.finallyLoc = locs[2];
- entry.afterLoc = locs[3];
- }
- this.tryEntries.push(entry);
- }
- function resetTryEntry(entry) {
- var record = entry.completion || {};
- record.type = "normal";
- delete record.arg;
- entry.completion = record;
- }
- function Context(tryLocsList) {
- this.tryEntries = [{ tryLoc: "root" }];
- tryLocsList.forEach(pushTryEntry, this);
- this.reset(true);
- }
- runtime.keys = function (object) {
- var keys = [];
- for (var key in object) {
- keys.push(key);
- }
- keys.reverse();
- return function next() {
- while (keys.length) {
- var key = keys.pop();
- if (key in object) {
- next.value = key;
- next.done = false;
- return next;
- }
- }
- next.done = true;
- return next;
- };
- };
- function values(iterable) {
- if (iterable) {
- var iteratorMethod = iterable[iteratorSymbol];
- if (iteratorMethod) {
- return iteratorMethod.call(iterable);
- }
- if (typeof iterable.next === "function") {
- return iterable;
- }
- if (!isNaN(iterable.length)) {
- var i = -1,
- next = function next() {
- while (++i < iterable.length) {
- if (hasOwn.call(iterable, i)) {
- next.value = iterable[i];
- next.done = false;
- return next;
- }
- }
- next.value = undefined;
- next.done = true;
- return next;
- };
- return next.next = next;
- }
- }
- return { next: doneResult };
- }
- runtime.values = values;
- function doneResult() {
- return {
- value: undefined,
- done: true
- };
- }
- Context.prototype = {
- constructor: Context,
- reset: function reset(skipTempReset) {
- this.prev = 0;
- this.next = 0;
- this.sent = this._sent = undefined;
- this.done = false;
- this.delegate = null;
- this.method = "next";
- this.arg = undefined;
- this.tryEntries.forEach(resetTryEntry);
- if (!skipTempReset) {
- for (var name in this) {
- if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
- this[name] = undefined;
- }
- }
- }
- },
- stop: function stop() {
- this.done = true;
- var rootEntry = this.tryEntries[0];
- var rootRecord = rootEntry.completion;
- if (rootRecord.type === "throw") {
- throw rootRecord.arg;
- }
- return this.rval;
- },
- dispatchException: function dispatchException(exception) {
- if (this.done) {
- throw exception;
- }
- var context = this;
- function handle(loc, caught) {
- record.type = "throw";
- record.arg = exception;
- context.next = loc;
- if (caught) {
- context.method = "next";
- context.arg = undefined;
- }
- return !!caught;
- }
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- var record = entry.completion;
- if (entry.tryLoc === "root") {
- return handle("end");
- }
- if (entry.tryLoc <= this.prev) {
- var hasCatch = hasOwn.call(entry, "catchLoc");
- var hasFinally = hasOwn.call(entry, "finallyLoc");
- if (hasCatch && hasFinally) {
- if (this.prev < entry.catchLoc) {
- return handle(entry.catchLoc, true);
- } else if (this.prev < entry.finallyLoc) {
- return handle(entry.finallyLoc);
- }
- } else if (hasCatch) {
- if (this.prev < entry.catchLoc) {
- return handle(entry.catchLoc, true);
- }
- } else if (hasFinally) {
- if (this.prev < entry.finallyLoc) {
- return handle(entry.finallyLoc);
- }
- } else {
- throw new Error("try statement without catch or finally");
- }
- }
- }
- },
- abrupt: function abrupt(type, arg) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
- var finallyEntry = entry;
- break;
- }
- }
- if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
- finallyEntry = null;
- }
- var record = finallyEntry ? finallyEntry.completion : {};
- record.type = type;
- record.arg = arg;
- if (finallyEntry) {
- this.method = "next";
- this.next = finallyEntry.finallyLoc;
- return ContinueSentinel;
- }
- return this.complete(record);
- },
- complete: function complete(record, afterLoc) {
- if (record.type === "throw") {
- throw record.arg;
- }
- if (record.type === "break" || record.type === "continue") {
- this.next = record.arg;
- } else if (record.type === "return") {
- this.rval = this.arg = record.arg;
- this.method = "return";
- this.next = "end";
- } else if (record.type === "normal" && afterLoc) {
- this.next = afterLoc;
- }
- return ContinueSentinel;
- },
- finish: function finish(finallyLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.finallyLoc === finallyLoc) {
- this.complete(entry.completion, entry.afterLoc);
- resetTryEntry(entry);
- return ContinueSentinel;
- }
- }
- },
- "catch": function _catch(tryLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc === tryLoc) {
- var record = entry.completion;
- if (record.type === "throw") {
- var thrown = record.arg;
- resetTryEntry(entry);
- }
- return thrown;
- }
- }
- throw new Error("illegal catch attempt");
- },
- delegateYield: function delegateYield(iterable, resultName, nextLoc) {
- this.delegate = {
- iterator: values(iterable),
- resultName: resultName,
- nextLoc: nextLoc
- };
- if (this.method === "next") {
- this.arg = undefined;
- }
- return ContinueSentinel;
- }
- };
-}(function () {
- return this;
-}() || Function("return this")());
-/* WEBPACK VAR INJECTION */}.call(this, __w_pdfjs_require__(140)(module)))
-
-/***/ }),
-/* 140 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = function (module) {
- if (!module.webpackPolyfill) {
- module.deprecate = function () {};
- module.paths = [];
- if (!module.children) module.children = [];
- Object.defineProperty(module, "loaded", {
- enumerable: true,
- get: function get() {
- return module.l;
- }
- });
- Object.defineProperty(module, "id", {
- enumerable: true,
- get: function get() {
- return module.i;
- }
- });
- module.webpackPolyfill = 1;
- }
- return module;
-};
-
-/***/ }),
-/* 141 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.Metadata = undefined;
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _util = __w_pdfjs_require__(1);
-
-var _xml_parser = __w_pdfjs_require__(142);
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var Metadata = function () {
- function Metadata(data) {
- _classCallCheck(this, Metadata);
-
- (0, _util.assert)(typeof data === 'string', 'Metadata: input is not a string');
- data = this._repair(data);
- var parser = new _xml_parser.SimpleXMLParser();
- var xmlDocument = parser.parseFromString(data);
- this._metadata = Object.create(null);
- if (xmlDocument) {
- this._parse(xmlDocument);
- }
- }
-
- _createClass(Metadata, [{
- key: '_repair',
- value: function _repair(data) {
- return data.replace(/>\\376\\377([^<]+)/g, function (all, codes) {
- var bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
- return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
- }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
- switch (name) {
- case 'amp':
- return '&';
- case 'apos':
- return '\'';
- case 'gt':
- return '>';
- case 'lt':
- return '<';
- case 'quot':
- return '\"';
- }
- throw new Error('_repair: ' + name + ' isn\'t defined.');
- });
- var chars = '';
- for (var i = 0, ii = bytes.length; i < ii; i += 2) {
- var code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
- if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
- chars += String.fromCharCode(code);
- } else {
- chars += '&#x' + (0x10000 + code).toString(16).substring(1) + ';';
- }
- }
- return '>' + chars;
- });
- }
- }, {
- key: '_parse',
- value: function _parse(xmlDocument) {
- var rdf = xmlDocument.documentElement;
- if (rdf.nodeName.toLowerCase() !== 'rdf:rdf') {
- rdf = rdf.firstChild;
- while (rdf && rdf.nodeName.toLowerCase() !== 'rdf:rdf') {
- rdf = rdf.nextSibling;
- }
- }
- var nodeName = rdf ? rdf.nodeName.toLowerCase() : null;
- if (!rdf || nodeName !== 'rdf:rdf' || !rdf.hasChildNodes()) {
- return;
- }
- var children = rdf.childNodes;
- for (var i = 0, ii = children.length; i < ii; i++) {
- var desc = children[i];
- if (desc.nodeName.toLowerCase() !== 'rdf:description') {
- continue;
- }
- for (var j = 0, jj = desc.childNodes.length; j < jj; j++) {
- if (desc.childNodes[j].nodeName.toLowerCase() !== '#text') {
- var entry = desc.childNodes[j];
- var name = entry.nodeName.toLowerCase();
- this._metadata[name] = entry.textContent.trim();
- }
- }
- }
- }
- }, {
- key: 'get',
- value: function get(name) {
- return this._metadata[name] || null;
- }
- }, {
- key: 'getAll',
- value: function getAll() {
- return this._metadata;
- }
- }, {
- key: 'has',
- value: function has(name) {
- return typeof this._metadata[name] !== 'undefined';
- }
- }]);
-
- return Metadata;
-}();
-
-exports.Metadata = Metadata;
-
-/***/ }),
-/* 142 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _slicedToArray = function () { function sliceIterator(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"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
-
-var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
-
-function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var XMLParserErrorCode = {
- NoError: 0,
- EndOfDocument: -1,
- UnterminatedCdat: -2,
- UnterminatedXmlDeclaration: -3,
- UnterminatedDoctypeDeclaration: -4,
- UnterminatedComment: -5,
- MalformedElement: -6,
- OutOfMemory: -7,
- UnterminatedAttributeValue: -8,
- UnterminatedElement: -9,
- ElementNeverBegun: -10
-};
-function isWhitespace(s, index) {
- var ch = s[index];
- return ch === ' ' || ch === '\n' || ch === '\r' || ch === '\t';
-}
-function isWhitespaceString(s) {
- for (var i = 0, ii = s.length; i < ii; i++) {
- if (!isWhitespace(s, i)) {
- return false;
- }
- }
- return true;
-}
-
-var XMLParserBase = function () {
- function XMLParserBase() {
- _classCallCheck(this, XMLParserBase);
- }
-
- _createClass(XMLParserBase, [{
- key: '_resolveEntities',
- value: function _resolveEntities(s) {
- return s.replace(/&([^;]+);/g, function (all, entity) {
- if (entity.substring(0, 2) === '#x') {
- return String.fromCharCode(parseInt(entity.substring(2), 16));
- } else if (entity.substring(0, 1) === '#') {
- return String.fromCharCode(parseInt(entity.substring(1), 10));
- }
- switch (entity) {
- case 'lt':
- return '<';
- case 'gt':
- return '>';
- case 'amp':
- return '&';
- case 'quot':
- return '\"';
- }
- return this.onResolveEntity(entity);
- });
- }
- }, {
- key: '_parseContent',
- value: function _parseContent(s, start) {
- var pos = start,
- name = void 0,
- attributes = [];
- function skipWs() {
- while (pos < s.length && isWhitespace(s, pos)) {
- ++pos;
- }
- }
- while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== '>' && s[pos] !== '/') {
- ++pos;
- }
- name = s.substring(start, pos);
- skipWs();
- while (pos < s.length && s[pos] !== '>' && s[pos] !== '/' && s[pos] !== '?') {
- skipWs();
- var attrName = '',
- attrValue = '';
- while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== '=') {
- attrName += s[pos];
- ++pos;
- }
- skipWs();
- if (s[pos] !== '=') {
- return null;
- }
- ++pos;
- skipWs();
- var attrEndChar = s[pos];
- if (attrEndChar !== '\"' && attrEndChar !== '\'') {
- return null;
- }
- var attrEndIndex = s.indexOf(attrEndChar, ++pos);
- if (attrEndIndex < 0) {
- return null;
- }
- attrValue = s.substring(pos, attrEndIndex);
- attributes.push({
- name: attrName,
- value: this._resolveEntities(attrValue)
- });
- pos = attrEndIndex + 1;
- skipWs();
- }
- return {
- name: name,
- attributes: attributes,
- parsed: pos - start
- };
- }
- }, {
- key: '_parseProcessingInstruction',
- value: function _parseProcessingInstruction(s, start) {
- var pos = start,
- name = void 0,
- value = void 0;
- function skipWs() {
- while (pos < s.length && isWhitespace(s, pos)) {
- ++pos;
- }
- }
- while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== '>' && s[pos] !== '/') {
- ++pos;
- }
- name = s.substring(start, pos);
- skipWs();
- var attrStart = pos;
- while (pos < s.length && (s[pos] !== '?' || s[pos + 1] !== '>')) {
- ++pos;
- }
- value = s.substring(attrStart, pos);
- return {
- name: name,
- value: value,
- parsed: pos - start
- };
- }
- }, {
- key: 'parseXml',
- value: function parseXml(s) {
- var i = 0;
- while (i < s.length) {
- var ch = s[i];
- var j = i;
- if (ch === '<') {
- ++j;
- var ch2 = s[j];
- var q = void 0;
- switch (ch2) {
- case '/':
- ++j;
- q = s.indexOf('>', j);
- if (q < 0) {
- this.onError(XMLParserErrorCode.UnterminatedElement);
- return;
- }
- this.onEndElement(s.substring(j, q));
- j = q + 1;
- break;
- case '?':
- ++j;
- var pi = this._parseProcessingInstruction(s, j);
- if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== '?>') {
- this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
- return;
- }
- this.onPi(pi.name, pi.value);
- j += pi.parsed + 2;
- break;
- case '!':
- if (s.substring(j + 1, j + 3) === '--') {
- q = s.indexOf('-->', j + 3);
- if (q < 0) {
- this.onError(XMLParserErrorCode.UnterminatedComment);
- return;
- }
- this.onComment(s.substring(j + 3, q));
- j = q + 3;
- } else if (s.substring(j + 1, j + 8) === '[CDATA[') {
- q = s.indexOf(']]>', j + 8);
- if (q < 0) {
- this.onError(XMLParserErrorCode.UnterminatedCdat);
- return;
- }
- this.onCdata(s.substring(j + 8, q));
- j = q + 3;
- } else if (s.substring(j + 1, j + 8) === 'DOCTYPE') {
- var q2 = s.indexOf('[', j + 8);
- var complexDoctype = false;
- q = s.indexOf('>', j + 8);
- if (q < 0) {
- this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
- return;
- }
- if (q2 > 0 && q > q2) {
- q = s.indexOf(']>', j + 8);
- if (q < 0) {
- this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
- return;
- }
- complexDoctype = true;
- }
- var doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
- this.onDoctype(doctypeContent);
- j = q + (complexDoctype ? 2 : 1);
- } else {
- this.onError(XMLParserErrorCode.MalformedElement);
- return;
- }
- break;
- default:
- var content = this._parseContent(s, j);
- if (content === null) {
- this.onError(XMLParserErrorCode.MalformedElement);
- return;
- }
- var isClosed = false;
- if (s.substring(j + content.parsed, j + content.parsed + 2) === '/>') {
- isClosed = true;
- } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== '>') {
- this.onError(XMLParserErrorCode.UnterminatedElement);
- return;
- }
- this.onBeginElement(content.name, content.attributes, isClosed);
- j += content.parsed + (isClosed ? 2 : 1);
- break;
- }
- } else {
- while (j < s.length && s[j] !== '<') {
- j++;
- }
- var text = s.substring(i, j);
- this.onText(this._resolveEntities(text));
- }
- i = j;
- }
- }
- }, {
- key: 'onResolveEntity',
- value: function onResolveEntity(name) {
- return '&' + name + ';';
- }
- }, {
- key: 'onPi',
- value: function onPi(name, value) {}
- }, {
- key: 'onComment',
- value: function onComment(text) {}
- }, {
- key: 'onCdata',
- value: function onCdata(text) {}
- }, {
- key: 'onDoctype',
- value: function onDoctype(doctypeContent) {}
- }, {
- key: 'onText',
- value: function onText(text) {}
- }, {
- key: 'onBeginElement',
- value: function onBeginElement(name, attributes, isEmpty) {}
- }, {
- key: 'onEndElement',
- value: function onEndElement(name) {}
- }, {
- key: 'onError',
- value: function onError(code) {}
- }]);
-
- return XMLParserBase;
-}();
-
-var SimpleDOMNode = function () {
- function SimpleDOMNode(nodeName, nodeValue) {
- _classCallCheck(this, SimpleDOMNode);
-
- this.nodeName = nodeName;
- this.nodeValue = nodeValue;
- Object.defineProperty(this, 'parentNode', {
- value: null,
- writable: true
- });
- }
-
- _createClass(SimpleDOMNode, [{
- key: 'hasChildNodes',
- value: function hasChildNodes() {
- return this.childNodes && this.childNodes.length > 0;
- }
- }, {
- key: 'firstChild',
- get: function get() {
- return this.childNodes[0];
- }
- }, {
- key: 'nextSibling',
- get: function get() {
- var index = this.parentNode.childNodes.indexOf(this);
- return this.parentNode.childNodes[index + 1];
- }
- }, {
- key: 'textContent',
- get: function get() {
- if (!this.childNodes) {
- return this.nodeValue || '';
- }
- return this.childNodes.map(function (child) {
- return child.textContent;
- }).join('');
- }
- }]);
-
- return SimpleDOMNode;
-}();
-
-var SimpleXMLParser = function (_XMLParserBase) {
- _inherits(SimpleXMLParser, _XMLParserBase);
-
- function SimpleXMLParser() {
- _classCallCheck(this, SimpleXMLParser);
-
- var _this = _possibleConstructorReturn(this, (SimpleXMLParser.__proto__ || Object.getPrototypeOf(SimpleXMLParser)).call(this));
-
- _this._currentFragment = null;
- _this._stack = null;
- _this._errorCode = XMLParserErrorCode.NoError;
- return _this;
- }
-
- _createClass(SimpleXMLParser, [{
- key: 'parseFromString',
- value: function parseFromString(data) {
- this._currentFragment = [];
- this._stack = [];
- this._errorCode = XMLParserErrorCode.NoError;
- this.parseXml(data);
- if (this._errorCode !== XMLParserErrorCode.NoError) {
- return undefined;
- }
-
- var _currentFragment = _slicedToArray(this._currentFragment, 1),
- documentElement = _currentFragment[0];
-
- if (!documentElement) {
- return undefined;
- }
- return { documentElement: documentElement };
- }
- }, {
- key: 'onResolveEntity',
- value: function onResolveEntity(name) {
- switch (name) {
- case 'apos':
- return '\'';
- }
- return _get(SimpleXMLParser.prototype.__proto__ || Object.getPrototypeOf(SimpleXMLParser.prototype), 'onResolveEntity', this).call(this, name);
- }
- }, {
- key: 'onText',
- value: function onText(text) {
- if (isWhitespaceString(text)) {
- return;
- }
- var node = new SimpleDOMNode('#text', text);
- this._currentFragment.push(node);
- }
- }, {
- key: 'onCdata',
- value: function onCdata(text) {
- var node = new SimpleDOMNode('#text', text);
- this._currentFragment.push(node);
- }
- }, {
- key: 'onBeginElement',
- value: function onBeginElement(name, attributes, isEmpty) {
- var node = new SimpleDOMNode(name);
- node.childNodes = [];
- this._currentFragment.push(node);
- if (isEmpty) {
- return;
- }
- this._stack.push(this._currentFragment);
- this._currentFragment = node.childNodes;
- }
- }, {
- key: 'onEndElement',
- value: function onEndElement(name) {
- this._currentFragment = this._stack.pop();
- var lastElement = this._currentFragment[this._currentFragment.length - 1];
- for (var i = 0, ii = lastElement.childNodes.length; i < ii; i++) {
- lastElement.childNodes[i].parentNode = lastElement;
- }
- }
- }, {
- key: 'onError',
- value: function onError(code) {
- this._errorCode = code;
- }
- }]);
-
- return SimpleXMLParser;
-}(XMLParserBase);
-
-exports.SimpleXMLParser = SimpleXMLParser;
-
-/***/ }),
-/* 143 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.PDFDataTransportStream = undefined;
-
-var _regenerator = __w_pdfjs_require__(137);
-
-var _regenerator2 = _interopRequireDefault(_regenerator);
-
-var _util = __w_pdfjs_require__(1);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
-
-var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
- function PDFDataTransportStream(params, pdfDataRangeTransport) {
- var _this = this;
-
- (0, _util.assert)(pdfDataRangeTransport);
- this._queuedChunks = [];
- var initialData = params.initialData;
- if (initialData && initialData.length > 0) {
- var buffer = new Uint8Array(initialData).buffer;
- this._queuedChunks.push(buffer);
- }
- this._pdfDataRangeTransport = pdfDataRangeTransport;
- this._isStreamingSupported = !params.disableStream;
- this._isRangeSupported = !params.disableRange;
- this._contentLength = params.length;
- this._fullRequestReader = null;
- this._rangeReaders = [];
- this._pdfDataRangeTransport.addRangeListener(function (begin, chunk) {
- _this._onReceiveData({
- begin: begin,
- chunk: chunk
- });
- });
- this._pdfDataRangeTransport.addProgressListener(function (loaded) {
- _this._onProgress({ loaded: loaded });
- });
- this._pdfDataRangeTransport.addProgressiveReadListener(function (chunk) {
- _this._onReceiveData({ chunk: chunk });
- });
- this._pdfDataRangeTransport.transportReady();
- }
- PDFDataTransportStream.prototype = {
- _onReceiveData: function PDFDataTransportStream_onReceiveData(args) {
- var buffer = new Uint8Array(args.chunk).buffer;
- if (args.begin === undefined) {
- if (this._fullRequestReader) {
- this._fullRequestReader._enqueue(buffer);
- } else {
- this._queuedChunks.push(buffer);
- }
- } else {
- var found = this._rangeReaders.some(function (rangeReader) {
- if (rangeReader._begin !== args.begin) {
- return false;
- }
- rangeReader._enqueue(buffer);
- return true;
- });
- (0, _util.assert)(found);
- }
- },
- _onProgress: function PDFDataTransportStream_onDataProgress(evt) {
- if (this._rangeReaders.length > 0) {
- var firstReader = this._rangeReaders[0];
- if (firstReader.onProgress) {
- firstReader.onProgress({ loaded: evt.loaded });
- }
- }
- },
- _removeRangeReader: function PDFDataTransportStream_removeRangeReader(reader) {
- var i = this._rangeReaders.indexOf(reader);
- if (i >= 0) {
- this._rangeReaders.splice(i, 1);
- }
- },
- getFullReader: function PDFDataTransportStream_getFullReader() {
- (0, _util.assert)(!this._fullRequestReader);
- var queuedChunks = this._queuedChunks;
- this._queuedChunks = null;
- return new PDFDataTransportStreamReader(this, queuedChunks);
- },
- getRangeReader: function PDFDataTransportStream_getRangeReader(begin, end) {
- var reader = new PDFDataTransportStreamRangeReader(this, begin, end);
- this._pdfDataRangeTransport.requestDataRange(begin, end);
- this._rangeReaders.push(reader);
- return reader;
- },
- cancelAllRequests: function PDFDataTransportStream_cancelAllRequests(reason) {
- if (this._fullRequestReader) {
- this._fullRequestReader.cancel(reason);
- }
- var readers = this._rangeReaders.slice(0);
- readers.forEach(function (rangeReader) {
- rangeReader.cancel(reason);
- });
- this._pdfDataRangeTransport.abort();
- }
- };
- function PDFDataTransportStreamReader(stream, queuedChunks) {
- this._stream = stream;
- this._done = false;
- this._filename = null;
- this._queuedChunks = queuedChunks || [];
- this._requests = [];
- this._headersReady = Promise.resolve();
- stream._fullRequestReader = this;
- this.onProgress = null;
- }
- PDFDataTransportStreamReader.prototype = {
- _enqueue: function PDFDataTransportStreamReader_enqueue(chunk) {
- if (this._done) {
- return;
- }
- if (this._requests.length > 0) {
- var requestCapability = this._requests.shift();
- requestCapability.resolve({
- value: chunk,
- done: false
- });
- return;
- }
- 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 () {
- var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
- var chunk, requestCapability;
- return _regenerator2.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- if (!(this._queuedChunks.length > 0)) {
- _context.next = 3;
- break;
- }
-
- chunk = this._queuedChunks.shift();
- return _context.abrupt('return', {
- value: chunk,
- done: false
- });
-
- case 3:
- if (!this._done) {
- _context.next = 5;
- break;
- }
-
- return _context.abrupt('return', {
- value: undefined,
- done: true
- });
-
- case 5:
- requestCapability = (0, _util.createPromiseCapability)();
-
- this._requests.push(requestCapability);
- return _context.abrupt('return', requestCapability.promise);
-
- case 8:
- case 'end':
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
-
- function read() {
- return _ref.apply(this, arguments);
- }
-
- return read;
- }(),
-
- cancel: function PDFDataTransportStreamReader_cancel(reason) {
- this._done = true;
- this._requests.forEach(function (requestCapability) {
- requestCapability.resolve({
- value: undefined,
- done: true
- });
- });
- 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) {
- 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;
- this._stream._removeRangeReader(this);
- },
- get isStreamingSupported() {
- return false;
- },
- read: function () {
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2() {
- var chunk, requestCapability;
- return _regenerator2.default.wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- if (!this._queuedChunk) {
- _context2.next = 4;
- break;
- }
-
- chunk = this._queuedChunk;
-
- this._queuedChunk = null;
- return _context2.abrupt('return', {
- value: chunk,
- done: false
- });
-
- case 4:
- if (!this._done) {
- _context2.next = 6;
- break;
- }
-
- return _context2.abrupt('return', {
- value: undefined,
- done: true
- });
-
- case 6:
- requestCapability = (0, _util.createPromiseCapability)();
-
- this._requests.push(requestCapability);
- return _context2.abrupt('return', requestCapability.promise);
-
- case 9:
- case 'end':
- return _context2.stop();
- }
- }
- }, _callee2, this);
- }));
-
- function read() {
- return _ref2.apply(this, arguments);
- }
-
- return read;
- }(),
-
- cancel: function PDFDataTransportStreamRangeReader_cancel(reason) {
- this._done = true;
- this._requests.forEach(function (requestCapability) {
- requestCapability.resolve({
- value: undefined,
- done: true
- });
- });
- this._requests = [];
- this._stream._removeRangeReader(this);
- }
- };
- return PDFDataTransportStream;
-}();
-exports.PDFDataTransportStream = PDFDataTransportStream;
-
-/***/ }),
-/* 144 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.WebGLContext = undefined;
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _util = __w_pdfjs_require__(1);
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var WebGLContext = function () {
- function WebGLContext(_ref) {
- var _ref$enable = _ref.enable,
- enable = _ref$enable === undefined ? false : _ref$enable;
-
- _classCallCheck(this, WebGLContext);
-
- this._enabled = enable === true;
- }
-
- _createClass(WebGLContext, [{
- key: 'composeSMask',
- value: function composeSMask(_ref2) {
- var layer = _ref2.layer,
- mask = _ref2.mask,
- properties = _ref2.properties;
-
- return WebGLUtils.composeSMask(layer, mask, properties);
- }
- }, {
- key: 'drawFigures',
- value: function drawFigures(_ref3) {
- var width = _ref3.width,
- height = _ref3.height,
- backgroundColor = _ref3.backgroundColor,
- figures = _ref3.figures,
- context = _ref3.context;
-
- return WebGLUtils.drawFigures(width, height, backgroundColor, figures, context);
- }
- }, {
- key: 'clear',
- value: function clear() {
- WebGLUtils.cleanup();
- }
- }, {
- key: 'isEnabled',
- get: function get() {
- var enabled = this._enabled;
- if (enabled) {
- enabled = WebGLUtils.tryInitGL();
- }
- return (0, _util.shadow)(this, 'isEnabled', enabled);
- }
- }]);
-
- return WebGLContext;
-}();
-
-var WebGLUtils = function WebGLUtilsClosure() {
- function loadShader(gl, code, shaderType) {
- var shader = gl.createShader(shaderType);
- gl.shaderSource(shader, code);
- gl.compileShader(shader);
- var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
- if (!compiled) {
- var errorMsg = gl.getShaderInfoLog(shader);
- throw new Error('Error during shader compilation: ' + errorMsg);
- }
- return shader;
- }
- function createVertexShader(gl, code) {
- return loadShader(gl, code, gl.VERTEX_SHADER);
- }
- function createFragmentShader(gl, code) {
- return loadShader(gl, code, gl.FRAGMENT_SHADER);
- }
- function createProgram(gl, shaders) {
- var program = gl.createProgram();
- for (var i = 0, ii = shaders.length; i < ii; ++i) {
- gl.attachShader(program, shaders[i]);
- }
- gl.linkProgram(program);
- var linked = gl.getProgramParameter(program, gl.LINK_STATUS);
- if (!linked) {
- var errorMsg = gl.getProgramInfoLog(program);
- throw new Error('Error during program linking: ' + errorMsg);
- }
- return program;
- }
- function createTexture(gl, image, textureId) {
- gl.activeTexture(textureId);
- var texture = gl.createTexture();
- gl.bindTexture(gl.TEXTURE_2D, texture);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
- return texture;
- }
- var currentGL, currentCanvas;
- function generateGL() {
- if (currentGL) {
- return;
- }
- currentCanvas = document.createElement('canvas');
- currentGL = currentCanvas.getContext('webgl', { premultipliedalpha: false });
- }
- var smaskVertexShaderCode = '\
- attribute vec2 a_position; \
- attribute vec2 a_texCoord; \
- \
- uniform vec2 u_resolution; \
- \
- varying vec2 v_texCoord; \
- \
- void main() { \
- vec2 clipSpace = (a_position / u_resolution) * 2.0 - 1.0; \
- gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \
- \
- v_texCoord = a_texCoord; \
- } ';
- var smaskFragmentShaderCode = '\
- precision mediump float; \
- \
- uniform vec4 u_backdrop; \
- uniform int u_subtype; \
- uniform sampler2D u_image; \
- uniform sampler2D u_mask; \
- \
- varying vec2 v_texCoord; \
- \
- void main() { \
- vec4 imageColor = texture2D(u_image, v_texCoord); \
- vec4 maskColor = texture2D(u_mask, v_texCoord); \
- if (u_backdrop.a > 0.0) { \
- maskColor.rgb = maskColor.rgb * maskColor.a + \
- u_backdrop.rgb * (1.0 - maskColor.a); \
- } \
- float lum; \
- if (u_subtype == 0) { \
- lum = maskColor.a; \
- } else { \
- lum = maskColor.r * 0.3 + maskColor.g * 0.59 + \
- maskColor.b * 0.11; \
- } \
- imageColor.a *= lum; \
- imageColor.rgb *= imageColor.a; \
- gl_FragColor = imageColor; \
- } ';
- var smaskCache = null;
- function initSmaskGL() {
- var canvas, gl;
- generateGL();
- canvas = currentCanvas;
- currentCanvas = null;
- gl = currentGL;
- currentGL = null;
- var vertexShader = createVertexShader(gl, smaskVertexShaderCode);
- var fragmentShader = createFragmentShader(gl, smaskFragmentShaderCode);
- var program = createProgram(gl, [vertexShader, fragmentShader]);
- gl.useProgram(program);
- var cache = {};
- cache.gl = gl;
- cache.canvas = canvas;
- cache.resolutionLocation = gl.getUniformLocation(program, 'u_resolution');
- cache.positionLocation = gl.getAttribLocation(program, 'a_position');
- cache.backdropLocation = gl.getUniformLocation(program, 'u_backdrop');
- cache.subtypeLocation = gl.getUniformLocation(program, 'u_subtype');
- var texCoordLocation = gl.getAttribLocation(program, 'a_texCoord');
- var texLayerLocation = gl.getUniformLocation(program, 'u_image');
- var texMaskLocation = gl.getUniformLocation(program, 'u_mask');
- var texCoordBuffer = gl.createBuffer();
- gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer);
- gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0]), gl.STATIC_DRAW);
- gl.enableVertexAttribArray(texCoordLocation);
- gl.vertexAttribPointer(texCoordLocation, 2, gl.FLOAT, false, 0, 0);
- gl.uniform1i(texLayerLocation, 0);
- gl.uniform1i(texMaskLocation, 1);
- smaskCache = cache;
- }
- function composeSMask(layer, mask, properties) {
- var width = layer.width,
- height = layer.height;
- if (!smaskCache) {
- initSmaskGL();
- }
- var cache = smaskCache,
- canvas = cache.canvas,
- gl = cache.gl;
- canvas.width = width;
- canvas.height = height;
- gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
- gl.uniform2f(cache.resolutionLocation, width, height);
- if (properties.backdrop) {
- gl.uniform4f(cache.resolutionLocation, properties.backdrop[0], properties.backdrop[1], properties.backdrop[2], 1);
- } else {
- gl.uniform4f(cache.resolutionLocation, 0, 0, 0, 0);
- }
- gl.uniform1i(cache.subtypeLocation, properties.subtype === 'Luminosity' ? 1 : 0);
- var texture = createTexture(gl, layer, gl.TEXTURE0);
- var maskTexture = createTexture(gl, mask, gl.TEXTURE1);
- var buffer = gl.createBuffer();
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
- gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0, 0, width, 0, 0, height, 0, height, width, 0, width, height]), gl.STATIC_DRAW);
- gl.enableVertexAttribArray(cache.positionLocation);
- gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0);
- gl.clearColor(0, 0, 0, 0);
- gl.enable(gl.BLEND);
- gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
- gl.clear(gl.COLOR_BUFFER_BIT);
- gl.drawArrays(gl.TRIANGLES, 0, 6);
- gl.flush();
- gl.deleteTexture(texture);
- gl.deleteTexture(maskTexture);
- gl.deleteBuffer(buffer);
- return canvas;
- }
- var figuresVertexShaderCode = '\
- attribute vec2 a_position; \
- attribute vec3 a_color; \
- \
- uniform vec2 u_resolution; \
- uniform vec2 u_scale; \
- uniform vec2 u_offset; \
- \
- varying vec4 v_color; \
- \
- void main() { \
- vec2 position = (a_position + u_offset) * u_scale; \
- vec2 clipSpace = (position / u_resolution) * 2.0 - 1.0; \
- gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \
- \
- v_color = vec4(a_color / 255.0, 1.0); \
- } ';
- var figuresFragmentShaderCode = '\
- precision mediump float; \
- \
- varying vec4 v_color; \
- \
- void main() { \
- gl_FragColor = v_color; \
- } ';
- var figuresCache = null;
- function initFiguresGL() {
- var canvas, gl;
- generateGL();
- canvas = currentCanvas;
- currentCanvas = null;
- gl = currentGL;
- currentGL = null;
- var vertexShader = createVertexShader(gl, figuresVertexShaderCode);
- var fragmentShader = createFragmentShader(gl, figuresFragmentShaderCode);
- var program = createProgram(gl, [vertexShader, fragmentShader]);
- gl.useProgram(program);
- var cache = {};
- cache.gl = gl;
- cache.canvas = canvas;
- cache.resolutionLocation = gl.getUniformLocation(program, 'u_resolution');
- cache.scaleLocation = gl.getUniformLocation(program, 'u_scale');
- cache.offsetLocation = gl.getUniformLocation(program, 'u_offset');
- cache.positionLocation = gl.getAttribLocation(program, 'a_position');
- cache.colorLocation = gl.getAttribLocation(program, 'a_color');
- figuresCache = cache;
- }
- function drawFigures(width, height, backgroundColor, figures, context) {
- if (!figuresCache) {
- initFiguresGL();
- }
- var cache = figuresCache,
- canvas = cache.canvas,
- gl = cache.gl;
- canvas.width = width;
- canvas.height = height;
- gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
- gl.uniform2f(cache.resolutionLocation, width, height);
- var count = 0;
- var i, ii, rows;
- for (i = 0, ii = figures.length; i < ii; i++) {
- switch (figures[i].type) {
- case 'lattice':
- rows = figures[i].coords.length / figures[i].verticesPerRow | 0;
- count += (rows - 1) * (figures[i].verticesPerRow - 1) * 6;
- break;
- case 'triangles':
- count += figures[i].coords.length;
- break;
- }
- }
- var coords = new Float32Array(count * 2);
- var colors = new Uint8Array(count * 3);
- var coordsMap = context.coords,
- colorsMap = context.colors;
- var pIndex = 0,
- cIndex = 0;
- for (i = 0, ii = figures.length; i < ii; i++) {
- var figure = figures[i],
- ps = figure.coords,
- cs = figure.colors;
- switch (figure.type) {
- case 'lattice':
- var cols = figure.verticesPerRow;
- rows = ps.length / cols | 0;
- for (var row = 1; row < rows; row++) {
- var offset = row * cols + 1;
- for (var col = 1; col < cols; col++, offset++) {
- coords[pIndex] = coordsMap[ps[offset - cols - 1]];
- coords[pIndex + 1] = coordsMap[ps[offset - cols - 1] + 1];
- coords[pIndex + 2] = coordsMap[ps[offset - cols]];
- coords[pIndex + 3] = coordsMap[ps[offset - cols] + 1];
- coords[pIndex + 4] = coordsMap[ps[offset - 1]];
- coords[pIndex + 5] = coordsMap[ps[offset - 1] + 1];
- colors[cIndex] = colorsMap[cs[offset - cols - 1]];
- colors[cIndex + 1] = colorsMap[cs[offset - cols - 1] + 1];
- colors[cIndex + 2] = colorsMap[cs[offset - cols - 1] + 2];
- colors[cIndex + 3] = colorsMap[cs[offset - cols]];
- colors[cIndex + 4] = colorsMap[cs[offset - cols] + 1];
- colors[cIndex + 5] = colorsMap[cs[offset - cols] + 2];
- colors[cIndex + 6] = colorsMap[cs[offset - 1]];
- colors[cIndex + 7] = colorsMap[cs[offset - 1] + 1];
- colors[cIndex + 8] = colorsMap[cs[offset - 1] + 2];
- coords[pIndex + 6] = coords[pIndex + 2];
- coords[pIndex + 7] = coords[pIndex + 3];
- coords[pIndex + 8] = coords[pIndex + 4];
- coords[pIndex + 9] = coords[pIndex + 5];
- coords[pIndex + 10] = coordsMap[ps[offset]];
- coords[pIndex + 11] = coordsMap[ps[offset] + 1];
- colors[cIndex + 9] = colors[cIndex + 3];
- colors[cIndex + 10] = colors[cIndex + 4];
- colors[cIndex + 11] = colors[cIndex + 5];
- colors[cIndex + 12] = colors[cIndex + 6];
- colors[cIndex + 13] = colors[cIndex + 7];
- colors[cIndex + 14] = colors[cIndex + 8];
- colors[cIndex + 15] = colorsMap[cs[offset]];
- colors[cIndex + 16] = colorsMap[cs[offset] + 1];
- colors[cIndex + 17] = colorsMap[cs[offset] + 2];
- pIndex += 12;
- cIndex += 18;
- }
- }
- break;
- case 'triangles':
- for (var j = 0, jj = ps.length; j < jj; j++) {
- coords[pIndex] = coordsMap[ps[j]];
- coords[pIndex + 1] = coordsMap[ps[j] + 1];
- colors[cIndex] = colorsMap[cs[j]];
- colors[cIndex + 1] = colorsMap[cs[j] + 1];
- colors[cIndex + 2] = colorsMap[cs[j] + 2];
- pIndex += 2;
- cIndex += 3;
- }
- break;
- }
- }
- if (backgroundColor) {
- gl.clearColor(backgroundColor[0] / 255, backgroundColor[1] / 255, backgroundColor[2] / 255, 1.0);
- } else {
- gl.clearColor(0, 0, 0, 0);
- }
- gl.clear(gl.COLOR_BUFFER_BIT);
- var coordsBuffer = gl.createBuffer();
- gl.bindBuffer(gl.ARRAY_BUFFER, coordsBuffer);
- gl.bufferData(gl.ARRAY_BUFFER, coords, gl.STATIC_DRAW);
- gl.enableVertexAttribArray(cache.positionLocation);
- gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0);
- var colorsBuffer = gl.createBuffer();
- gl.bindBuffer(gl.ARRAY_BUFFER, colorsBuffer);
- gl.bufferData(gl.ARRAY_BUFFER, colors, gl.STATIC_DRAW);
- gl.enableVertexAttribArray(cache.colorLocation);
- gl.vertexAttribPointer(cache.colorLocation, 3, gl.UNSIGNED_BYTE, false, 0, 0);
- gl.uniform2f(cache.scaleLocation, context.scaleX, context.scaleY);
- gl.uniform2f(cache.offsetLocation, context.offsetX, context.offsetY);
- gl.drawArrays(gl.TRIANGLES, 0, count);
- gl.flush();
- gl.deleteBuffer(coordsBuffer);
- gl.deleteBuffer(colorsBuffer);
- return canvas;
- }
- return {
- tryInitGL: function tryInitGL() {
- try {
- generateGL();
- return !!currentGL;
- } catch (ex) {}
- return false;
- },
-
- composeSMask: composeSMask,
- drawFigures: drawFigures,
- cleanup: function cleanup() {
- if (smaskCache && smaskCache.canvas) {
- smaskCache.canvas.width = 0;
- smaskCache.canvas.height = 0;
- }
- if (figuresCache && figuresCache.canvas) {
- figuresCache.canvas.width = 0;
- figuresCache.canvas.height = 0;
- }
- smaskCache = null;
- figuresCache = null;
- }
- };
-}();
-exports.WebGLContext = WebGLContext;
-
-/***/ }),
-/* 145 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.renderTextLayer = undefined;
-
-var _util = __w_pdfjs_require__(1);
-
-var _global_scope = __w_pdfjs_require__(3);
-
-var _global_scope2 = _interopRequireDefault(_global_scope);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-var renderTextLayer = function renderTextLayerClosure() {
- var MAX_TEXT_DIVS_TO_RENDER = 100000;
- var NonWhitespaceRegexp = /\S/;
- function isAllWhitespace(str) {
- return !NonWhitespaceRegexp.test(str);
- }
- var styleBuf = ['left: ', 0, 'px; top: ', 0, 'px; font-size: ', 0, 'px; font-family: ', '', ';'];
- function appendText(task, geom, styles) {
- var textDiv = document.createElement('div');
- var textDivProperties = {
- style: null,
- angle: 0,
- canvasWidth: 0,
- isWhitespace: false,
- originalTransform: null,
- paddingBottom: 0,
- paddingLeft: 0,
- paddingRight: 0,
- paddingTop: 0,
- scale: 1
- };
- task._textDivs.push(textDiv);
- if (isAllWhitespace(geom.str)) {
- textDivProperties.isWhitespace = true;
- task._textDivProperties.set(textDiv, textDivProperties);
- return;
- }
- var tx = _util.Util.transform(task._viewport.transform, geom.transform);
- var angle = Math.atan2(tx[1], tx[0]);
- var style = styles[geom.fontName];
- if (style.vertical) {
- angle += Math.PI / 2;
- }
- var fontHeight = Math.sqrt(tx[2] * tx[2] + tx[3] * tx[3]);
- var fontAscent = fontHeight;
- if (style.ascent) {
- fontAscent = style.ascent * fontAscent;
- } else if (style.descent) {
- fontAscent = (1 + style.descent) * fontAscent;
- }
- var left;
- var top;
- if (angle === 0) {
- left = tx[4];
- top = tx[5] - fontAscent;
- } else {
- left = tx[4] + fontAscent * Math.sin(angle);
- top = tx[5] - fontAscent * Math.cos(angle);
- }
- styleBuf[1] = left;
- styleBuf[3] = top;
- styleBuf[5] = fontHeight;
- styleBuf[7] = style.fontFamily;
- textDivProperties.style = styleBuf.join('');
- textDiv.setAttribute('style', textDivProperties.style);
- textDiv.textContent = geom.str;
- if (task._fontInspectorEnabled) {
- textDiv.dataset.fontName = geom.fontName;
- }
- if (angle !== 0) {
- textDivProperties.angle = angle * (180 / Math.PI);
- }
- if (geom.str.length > 1) {
- if (style.vertical) {
- textDivProperties.canvasWidth = geom.height * task._viewport.scale;
- } else {
- textDivProperties.canvasWidth = geom.width * task._viewport.scale;
- }
- }
- task._textDivProperties.set(textDiv, textDivProperties);
- if (task._textContentStream) {
- task._layoutText(textDiv);
- }
- if (task._enhanceTextSelection) {
- var angleCos = 1,
- angleSin = 0;
- if (angle !== 0) {
- angleCos = Math.cos(angle);
- angleSin = Math.sin(angle);
- }
- var divWidth = (style.vertical ? geom.height : geom.width) * task._viewport.scale;
- var divHeight = fontHeight;
- var m, b;
- if (angle !== 0) {
- m = [angleCos, angleSin, -angleSin, angleCos, left, top];
- b = _util.Util.getAxialAlignedBoundingBox([0, 0, divWidth, divHeight], m);
- } else {
- b = [left, top, left + divWidth, top + divHeight];
- }
- task._bounds.push({
- left: b[0],
- top: b[1],
- right: b[2],
- bottom: b[3],
- div: textDiv,
- size: [divWidth, divHeight],
- m: m
- });
- }
- }
- function render(task) {
- if (task._canceled) {
- return;
- }
- var textDivs = task._textDivs;
- var capability = task._capability;
- var textDivsLength = textDivs.length;
- if (textDivsLength > MAX_TEXT_DIVS_TO_RENDER) {
- task._renderingDone = true;
- capability.resolve();
- return;
- }
- if (!task._textContentStream) {
- for (var i = 0; i < textDivsLength; i++) {
- task._layoutText(textDivs[i]);
- }
- }
- task._renderingDone = true;
- capability.resolve();
- }
- function expand(task) {
- var bounds = task._bounds;
- var viewport = task._viewport;
- var expanded = expandBounds(viewport.width, viewport.height, bounds);
- for (var i = 0; i < expanded.length; i++) {
- var div = bounds[i].div;
- var divProperties = task._textDivProperties.get(div);
- if (divProperties.angle === 0) {
- divProperties.paddingLeft = bounds[i].left - expanded[i].left;
- divProperties.paddingTop = bounds[i].top - expanded[i].top;
- divProperties.paddingRight = expanded[i].right - bounds[i].right;
- divProperties.paddingBottom = expanded[i].bottom - bounds[i].bottom;
- task._textDivProperties.set(div, divProperties);
- continue;
- }
- var e = expanded[i],
- b = bounds[i];
- var m = b.m,
- c = m[0],
- s = m[1];
- var points = [[0, 0], [0, b.size[1]], [b.size[0], 0], b.size];
- var ts = new Float64Array(64);
- points.forEach(function (p, i) {
- var t = _util.Util.applyTransform(p, m);
- ts[i + 0] = c && (e.left - t[0]) / c;
- ts[i + 4] = s && (e.top - t[1]) / s;
- ts[i + 8] = c && (e.right - t[0]) / c;
- ts[i + 12] = s && (e.bottom - t[1]) / s;
- ts[i + 16] = s && (e.left - t[0]) / -s;
- ts[i + 20] = c && (e.top - t[1]) / c;
- ts[i + 24] = s && (e.right - t[0]) / -s;
- ts[i + 28] = c && (e.bottom - t[1]) / c;
- ts[i + 32] = c && (e.left - t[0]) / -c;
- ts[i + 36] = s && (e.top - t[1]) / -s;
- ts[i + 40] = c && (e.right - t[0]) / -c;
- ts[i + 44] = s && (e.bottom - t[1]) / -s;
- ts[i + 48] = s && (e.left - t[0]) / s;
- ts[i + 52] = c && (e.top - t[1]) / -c;
- ts[i + 56] = s && (e.right - t[0]) / s;
- ts[i + 60] = c && (e.bottom - t[1]) / -c;
- });
- var findPositiveMin = function findPositiveMin(ts, offset, count) {
- var result = 0;
- for (var i = 0; i < count; i++) {
- var t = ts[offset++];
- if (t > 0) {
- result = result ? Math.min(t, result) : t;
- }
- }
- return result;
- };
- var boxScale = 1 + Math.min(Math.abs(c), Math.abs(s));
- divProperties.paddingLeft = findPositiveMin(ts, 32, 16) / boxScale;
- divProperties.paddingTop = findPositiveMin(ts, 48, 16) / boxScale;
- divProperties.paddingRight = findPositiveMin(ts, 0, 16) / boxScale;
- divProperties.paddingBottom = findPositiveMin(ts, 16, 16) / boxScale;
- task._textDivProperties.set(div, divProperties);
- }
- }
- function expandBounds(width, height, boxes) {
- var bounds = boxes.map(function (box, i) {
- return {
- x1: box.left,
- y1: box.top,
- x2: box.right,
- y2: box.bottom,
- index: i,
- x1New: undefined,
- x2New: undefined
- };
- });
- expandBoundsLTR(width, bounds);
- var expanded = new Array(boxes.length);
- bounds.forEach(function (b) {
- var i = b.index;
- expanded[i] = {
- left: b.x1New,
- top: 0,
- right: b.x2New,
- bottom: 0
- };
- });
- boxes.map(function (box, i) {
- var e = expanded[i],
- b = bounds[i];
- b.x1 = box.top;
- b.y1 = width - e.right;
- b.x2 = box.bottom;
- b.y2 = width - e.left;
- b.index = i;
- b.x1New = undefined;
- b.x2New = undefined;
- });
- expandBoundsLTR(height, bounds);
- bounds.forEach(function (b) {
- var i = b.index;
- expanded[i].top = b.x1New;
- expanded[i].bottom = b.x2New;
- });
- return expanded;
- }
- function expandBoundsLTR(width, bounds) {
- bounds.sort(function (a, b) {
- return a.x1 - b.x1 || a.index - b.index;
- });
- var fakeBoundary = {
- x1: -Infinity,
- y1: -Infinity,
- x2: 0,
- y2: Infinity,
- index: -1,
- x1New: 0,
- x2New: 0
- };
- var horizon = [{
- start: -Infinity,
- end: Infinity,
- boundary: fakeBoundary
- }];
- bounds.forEach(function (boundary) {
- var i = 0;
- while (i < horizon.length && horizon[i].end <= boundary.y1) {
- i++;
- }
- var j = horizon.length - 1;
- while (j >= 0 && horizon[j].start >= boundary.y2) {
- j--;
- }
- var horizonPart, affectedBoundary;
- var q,
- k,
- maxXNew = -Infinity;
- for (q = i; q <= j; q++) {
- horizonPart = horizon[q];
- affectedBoundary = horizonPart.boundary;
- var xNew;
- if (affectedBoundary.x2 > boundary.x1) {
- xNew = affectedBoundary.index > boundary.index ? affectedBoundary.x1New : boundary.x1;
- } else if (affectedBoundary.x2New === undefined) {
- xNew = (affectedBoundary.x2 + boundary.x1) / 2;
- } else {
- xNew = affectedBoundary.x2New;
- }
- if (xNew > maxXNew) {
- maxXNew = xNew;
- }
- }
- boundary.x1New = maxXNew;
- for (q = i; q <= j; q++) {
- horizonPart = horizon[q];
- affectedBoundary = horizonPart.boundary;
- if (affectedBoundary.x2New === undefined) {
- if (affectedBoundary.x2 > boundary.x1) {
- if (affectedBoundary.index > boundary.index) {
- affectedBoundary.x2New = affectedBoundary.x2;
- }
- } else {
- affectedBoundary.x2New = maxXNew;
- }
- } else if (affectedBoundary.x2New > maxXNew) {
- affectedBoundary.x2New = Math.max(maxXNew, affectedBoundary.x2);
- }
- }
- var changedHorizon = [],
- lastBoundary = null;
- for (q = i; q <= j; q++) {
- horizonPart = horizon[q];
- affectedBoundary = horizonPart.boundary;
- var useBoundary = affectedBoundary.x2 > boundary.x2 ? affectedBoundary : boundary;
- if (lastBoundary === useBoundary) {
- changedHorizon[changedHorizon.length - 1].end = horizonPart.end;
- } else {
- changedHorizon.push({
- start: horizonPart.start,
- end: horizonPart.end,
- boundary: useBoundary
- });
- lastBoundary = useBoundary;
- }
- }
- if (horizon[i].start < boundary.y1) {
- changedHorizon[0].start = boundary.y1;
- changedHorizon.unshift({
- start: horizon[i].start,
- end: boundary.y1,
- boundary: horizon[i].boundary
- });
- }
- if (boundary.y2 < horizon[j].end) {
- changedHorizon[changedHorizon.length - 1].end = boundary.y2;
- changedHorizon.push({
- start: boundary.y2,
- end: horizon[j].end,
- boundary: horizon[j].boundary
- });
- }
- for (q = i; q <= j; q++) {
- horizonPart = horizon[q];
- affectedBoundary = horizonPart.boundary;
- if (affectedBoundary.x2New !== undefined) {
- continue;
- }
- var used = false;
- for (k = i - 1; !used && k >= 0 && horizon[k].start >= affectedBoundary.y1; k--) {
- used = horizon[k].boundary === affectedBoundary;
- }
- for (k = j + 1; !used && k < horizon.length && horizon[k].end <= affectedBoundary.y2; k++) {
- used = horizon[k].boundary === affectedBoundary;
- }
- for (k = 0; !used && k < changedHorizon.length; k++) {
- used = changedHorizon[k].boundary === affectedBoundary;
- }
- if (!used) {
- affectedBoundary.x2New = maxXNew;
- }
- }
- Array.prototype.splice.apply(horizon, [i, j - i + 1].concat(changedHorizon));
- });
- horizon.forEach(function (horizonPart) {
- var affectedBoundary = horizonPart.boundary;
- if (affectedBoundary.x2New === undefined) {
- affectedBoundary.x2New = Math.max(width, affectedBoundary.x2);
- }
- });
- }
- function TextLayerRenderTask(_ref) {
- var textContent = _ref.textContent,
- textContentStream = _ref.textContentStream,
- container = _ref.container,
- viewport = _ref.viewport,
- textDivs = _ref.textDivs,
- textContentItemsStr = _ref.textContentItemsStr,
- enhanceTextSelection = _ref.enhanceTextSelection;
-
- this._textContent = textContent;
- this._textContentStream = textContentStream;
- this._container = container;
- this._viewport = viewport;
- this._textDivs = textDivs || [];
- this._textContentItemsStr = textContentItemsStr || [];
- this._enhanceTextSelection = !!enhanceTextSelection;
- this._fontInspectorEnabled = !!(_global_scope2.default.FontInspector && _global_scope2.default.FontInspector.enabled);
- this._reader = null;
- this._layoutTextLastFontSize = null;
- this._layoutTextLastFontFamily = null;
- this._layoutTextCtx = null;
- this._textDivProperties = new WeakMap();
- this._renderingDone = false;
- this._canceled = false;
- this._capability = (0, _util.createPromiseCapability)();
- this._renderTimer = null;
- this._bounds = [];
- }
- TextLayerRenderTask.prototype = {
- get promise() {
- return this._capability.promise;
- },
- cancel: function TextLayer_cancel() {
- if (this._reader) {
- this._reader.cancel(new _util.AbortException('text layer task cancelled'));
- this._reader = null;
- }
- this._canceled = true;
- if (this._renderTimer !== null) {
- clearTimeout(this._renderTimer);
- this._renderTimer = null;
- }
- this._capability.reject('canceled');
- },
- _processItems: function _processItems(items, styleCache) {
- for (var i = 0, len = items.length; i < len; i++) {
- this._textContentItemsStr.push(items[i].str);
- appendText(this, items[i], styleCache);
- }
- },
- _layoutText: function _layoutText(textDiv) {
- var textLayerFrag = this._container;
- var textDivProperties = this._textDivProperties.get(textDiv);
- if (textDivProperties.isWhitespace) {
- return;
- }
- var fontSize = textDiv.style.fontSize;
- var fontFamily = textDiv.style.fontFamily;
- if (fontSize !== this._layoutTextLastFontSize || fontFamily !== this._layoutTextLastFontFamily) {
- this._layoutTextCtx.font = fontSize + ' ' + fontFamily;
- this._layoutTextLastFontSize = fontSize;
- this._layoutTextLastFontFamily = fontFamily;
- }
- var width = this._layoutTextCtx.measureText(textDiv.textContent).width;
- var transform = '';
- if (textDivProperties.canvasWidth !== 0 && width > 0) {
- textDivProperties.scale = textDivProperties.canvasWidth / width;
- transform = 'scaleX(' + textDivProperties.scale + ')';
- }
- if (textDivProperties.angle !== 0) {
- transform = 'rotate(' + textDivProperties.angle + 'deg) ' + transform;
- }
- if (transform !== '') {
- textDivProperties.originalTransform = transform;
- textDiv.style.transform = transform;
- }
- this._textDivProperties.set(textDiv, textDivProperties);
- textLayerFrag.appendChild(textDiv);
- },
-
- _render: function TextLayer_render(timeout) {
- var _this = this;
-
- var capability = (0, _util.createPromiseCapability)();
- var styleCache = Object.create(null);
- var canvas = document.createElement('canvas');
- canvas.mozOpaque = true;
- this._layoutTextCtx = canvas.getContext('2d', { alpha: false });
- if (this._textContent) {
- var textItems = this._textContent.items;
- var textStyles = this._textContent.styles;
- this._processItems(textItems, textStyles);
- capability.resolve();
- } else if (this._textContentStream) {
- var pump = function pump() {
- _this._reader.read().then(function (_ref2) {
- var value = _ref2.value,
- done = _ref2.done;
-
- if (done) {
- capability.resolve();
- return;
- }
- Object.assign(styleCache, value.styles);
- _this._processItems(value.items, styleCache);
- pump();
- }, capability.reject);
- };
- this._reader = this._textContentStream.getReader();
- pump();
- } else {
- throw new Error('Neither "textContent" nor "textContentStream"' + ' parameters specified.');
- }
- capability.promise.then(function () {
- styleCache = null;
- if (!timeout) {
- render(_this);
- } else {
- _this._renderTimer = setTimeout(function () {
- render(_this);
- _this._renderTimer = null;
- }, timeout);
- }
- }, this._capability.reject);
- },
- expandTextDivs: function TextLayer_expandTextDivs(expandDivs) {
- if (!this._enhanceTextSelection || !this._renderingDone) {
- return;
- }
- if (this._bounds !== null) {
- expand(this);
- this._bounds = null;
- }
- for (var i = 0, ii = this._textDivs.length; i < ii; i++) {
- var div = this._textDivs[i];
- var divProperties = this._textDivProperties.get(div);
- if (divProperties.isWhitespace) {
- continue;
- }
- if (expandDivs) {
- var transform = '',
- padding = '';
- if (divProperties.scale !== 1) {
- transform = 'scaleX(' + divProperties.scale + ')';
- }
- if (divProperties.angle !== 0) {
- transform = 'rotate(' + divProperties.angle + 'deg) ' + transform;
- }
- if (divProperties.paddingLeft !== 0) {
- padding += ' padding-left: ' + divProperties.paddingLeft / divProperties.scale + 'px;';
- transform += ' translateX(' + -divProperties.paddingLeft / divProperties.scale + 'px)';
- }
- if (divProperties.paddingTop !== 0) {
- padding += ' padding-top: ' + divProperties.paddingTop + 'px;';
- transform += ' translateY(' + -divProperties.paddingTop + 'px)';
- }
- if (divProperties.paddingRight !== 0) {
- padding += ' padding-right: ' + divProperties.paddingRight / divProperties.scale + 'px;';
- }
- if (divProperties.paddingBottom !== 0) {
- padding += ' padding-bottom: ' + divProperties.paddingBottom + 'px;';
- }
- if (padding !== '') {
- div.setAttribute('style', divProperties.style + padding);
- }
- if (transform !== '') {
- div.style.transform = transform;
- }
- } else {
- div.style.padding = 0;
- div.style.transform = divProperties.originalTransform || '';
- }
- }
- }
- };
- function renderTextLayer(renderParameters) {
- var task = new TextLayerRenderTask({
- textContent: renderParameters.textContent,
- textContentStream: renderParameters.textContentStream,
- container: renderParameters.container,
- viewport: renderParameters.viewport,
- textDivs: renderParameters.textDivs,
- textContentItemsStr: renderParameters.textContentItemsStr,
- enhanceTextSelection: renderParameters.enhanceTextSelection
- });
- task._render(renderParameters.timeout);
- return task;
- }
- return renderTextLayer;
-}();
-exports.renderTextLayer = renderTextLayer;
-
-/***/ }),
-/* 146 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.AnnotationLayer = undefined;
-
-var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _dom_utils = __w_pdfjs_require__(130);
-
-var _util = __w_pdfjs_require__(1);
-
-function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
-
-function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var AnnotationElementFactory = function () {
- function AnnotationElementFactory() {
- _classCallCheck(this, AnnotationElementFactory);
- }
-
- _createClass(AnnotationElementFactory, null, [{
- key: 'create',
- value: function create(parameters) {
- var subtype = parameters.data.annotationType;
- switch (subtype) {
- case _util.AnnotationType.LINK:
- return new LinkAnnotationElement(parameters);
- case _util.AnnotationType.TEXT:
- return new TextAnnotationElement(parameters);
- case _util.AnnotationType.WIDGET:
- var fieldType = parameters.data.fieldType;
- switch (fieldType) {
- case 'Tx':
- return new TextWidgetAnnotationElement(parameters);
- case 'Btn':
- if (parameters.data.radioButton) {
- return new RadioButtonWidgetAnnotationElement(parameters);
- } else if (parameters.data.checkBox) {
- return new CheckboxWidgetAnnotationElement(parameters);
- }
- return new PushButtonWidgetAnnotationElement(parameters);
- case 'Ch':
- return new ChoiceWidgetAnnotationElement(parameters);
- }
- return new WidgetAnnotationElement(parameters);
- case _util.AnnotationType.POPUP:
- return new PopupAnnotationElement(parameters);
- case _util.AnnotationType.LINE:
- return new LineAnnotationElement(parameters);
- case _util.AnnotationType.SQUARE:
- return new SquareAnnotationElement(parameters);
- case _util.AnnotationType.CIRCLE:
- return new CircleAnnotationElement(parameters);
- case _util.AnnotationType.POLYLINE:
- return new PolylineAnnotationElement(parameters);
- case _util.AnnotationType.INK:
- return new InkAnnotationElement(parameters);
- case _util.AnnotationType.POLYGON:
- return new PolygonAnnotationElement(parameters);
- case _util.AnnotationType.HIGHLIGHT:
- return new HighlightAnnotationElement(parameters);
- case _util.AnnotationType.UNDERLINE:
- return new UnderlineAnnotationElement(parameters);
- case _util.AnnotationType.SQUIGGLY:
- return new SquigglyAnnotationElement(parameters);
- case _util.AnnotationType.STRIKEOUT:
- return new StrikeOutAnnotationElement(parameters);
- case _util.AnnotationType.STAMP:
- return new StampAnnotationElement(parameters);
- case _util.AnnotationType.FILEATTACHMENT:
- return new FileAttachmentAnnotationElement(parameters);
- default:
- return new AnnotationElement(parameters);
- }
- }
- }]);
-
- return AnnotationElementFactory;
-}();
-
-var AnnotationElement = function () {
- function AnnotationElement(parameters) {
- var isRenderable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var ignoreBorder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
-
- _classCallCheck(this, AnnotationElement);
-
- this.isRenderable = isRenderable;
- this.data = parameters.data;
- this.layer = parameters.layer;
- this.page = parameters.page;
- this.viewport = parameters.viewport;
- this.linkService = parameters.linkService;
- this.downloadManager = parameters.downloadManager;
- this.imageResourcesPath = parameters.imageResourcesPath;
- this.renderInteractiveForms = parameters.renderInteractiveForms;
- this.svgFactory = parameters.svgFactory;
- if (isRenderable) {
- this.container = this._createContainer(ignoreBorder);
- }
- }
-
- _createClass(AnnotationElement, [{
- key: '_createContainer',
- value: function _createContainer() {
- var ignoreBorder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
-
- var data = this.data,
- page = this.page,
- viewport = this.viewport;
- var container = document.createElement('section');
- var width = data.rect[2] - data.rect[0];
- var height = data.rect[3] - data.rect[1];
- container.setAttribute('data-annotation-id', data.id);
- var rect = _util.Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], data.rect[2], page.view[3] - data.rect[3] + page.view[1]]);
- container.style.transform = 'matrix(' + viewport.transform.join(',') + ')';
- container.style.transformOrigin = -rect[0] + 'px ' + -rect[1] + 'px';
- if (!ignoreBorder && data.borderStyle.width > 0) {
- container.style.borderWidth = data.borderStyle.width + 'px';
- if (data.borderStyle.style !== _util.AnnotationBorderStyleType.UNDERLINE) {
- width = width - 2 * data.borderStyle.width;
- height = height - 2 * data.borderStyle.width;
- }
- var horizontalRadius = data.borderStyle.horizontalCornerRadius;
- var verticalRadius = data.borderStyle.verticalCornerRadius;
- if (horizontalRadius > 0 || verticalRadius > 0) {
- var radius = horizontalRadius + 'px / ' + verticalRadius + 'px';
- container.style.borderRadius = radius;
- }
- switch (data.borderStyle.style) {
- case _util.AnnotationBorderStyleType.SOLID:
- container.style.borderStyle = 'solid';
- break;
- case _util.AnnotationBorderStyleType.DASHED:
- container.style.borderStyle = 'dashed';
- break;
- case _util.AnnotationBorderStyleType.BEVELED:
- (0, _util.warn)('Unimplemented border style: beveled');
- break;
- case _util.AnnotationBorderStyleType.INSET:
- (0, _util.warn)('Unimplemented border style: inset');
- break;
- case _util.AnnotationBorderStyleType.UNDERLINE:
- container.style.borderBottomStyle = 'solid';
- break;
- default:
- break;
- }
- if (data.color) {
- container.style.borderColor = _util.Util.makeCssRgb(data.color[0] | 0, data.color[1] | 0, data.color[2] | 0);
- } else {
- container.style.borderWidth = 0;
- }
- }
- container.style.left = rect[0] + 'px';
- container.style.top = rect[1] + 'px';
- container.style.width = width + 'px';
- container.style.height = height + 'px';
- return container;
- }
- }, {
- key: '_createPopup',
- value: function _createPopup(container, trigger, data) {
- if (!trigger) {
- trigger = document.createElement('div');
- trigger.style.height = container.style.height;
- trigger.style.width = container.style.width;
- container.appendChild(trigger);
- }
- var popupElement = new PopupElement({
- container: container,
- trigger: trigger,
- color: data.color,
- title: data.title,
- contents: data.contents,
- hideWrapper: true
- });
- var popup = popupElement.render();
- popup.style.left = container.style.width;
- container.appendChild(popup);
- }
- }, {
- key: 'render',
- value: function render() {
- (0, _util.unreachable)('Abstract method `AnnotationElement.render` called');
- }
- }]);
-
- return AnnotationElement;
-}();
-
-var LinkAnnotationElement = function (_AnnotationElement) {
- _inherits(LinkAnnotationElement, _AnnotationElement);
-
- function LinkAnnotationElement(parameters) {
- _classCallCheck(this, LinkAnnotationElement);
-
- var isRenderable = !!(parameters.data.url || parameters.data.dest || parameters.data.action);
- return _possibleConstructorReturn(this, (LinkAnnotationElement.__proto__ || Object.getPrototypeOf(LinkAnnotationElement)).call(this, parameters, isRenderable));
- }
-
- _createClass(LinkAnnotationElement, [{
- key: 'render',
- value: function render() {
- this.container.className = 'linkAnnotation';
- var data = this.data,
- linkService = this.linkService;
-
- var link = document.createElement('a');
- (0, _dom_utils.addLinkAttributes)(link, {
- url: data.url,
- target: data.newWindow ? _dom_utils.LinkTarget.BLANK : linkService.externalLinkTarget,
- rel: linkService.externalLinkRel
- });
- if (!data.url) {
- if (data.action) {
- this._bindNamedAction(link, data.action);
- } else {
- this._bindLink(link, data.dest);
- }
- }
- this.container.appendChild(link);
- return this.container;
- }
- }, {
- key: '_bindLink',
- value: function _bindLink(link, destination) {
- var _this2 = this;
-
- link.href = this.linkService.getDestinationHash(destination);
- link.onclick = function () {
- if (destination) {
- _this2.linkService.navigateTo(destination);
- }
- return false;
- };
- if (destination) {
- link.className = 'internalLink';
- }
- }
- }, {
- key: '_bindNamedAction',
- value: function _bindNamedAction(link, action) {
- var _this3 = this;
-
- link.href = this.linkService.getAnchorUrl('');
- link.onclick = function () {
- _this3.linkService.executeNamedAction(action);
- return false;
- };
- link.className = 'internalLink';
- }
- }]);
-
- return LinkAnnotationElement;
-}(AnnotationElement);
-
-var TextAnnotationElement = function (_AnnotationElement2) {
- _inherits(TextAnnotationElement, _AnnotationElement2);
-
- function TextAnnotationElement(parameters) {
- _classCallCheck(this, TextAnnotationElement);
-
- var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
- return _possibleConstructorReturn(this, (TextAnnotationElement.__proto__ || Object.getPrototypeOf(TextAnnotationElement)).call(this, parameters, isRenderable));
- }
-
- _createClass(TextAnnotationElement, [{
- key: 'render',
- value: function render() {
- this.container.className = 'textAnnotation';
- var image = document.createElement('img');
- image.style.height = this.container.style.height;
- image.style.width = this.container.style.width;
- image.src = this.imageResourcesPath + 'annotation-' + this.data.name.toLowerCase() + '.svg';
- image.alt = '[{{type}} Annotation]';
- image.dataset.l10nId = 'text_annotation_type';
- image.dataset.l10nArgs = JSON.stringify({ type: this.data.name });
- if (!this.data.hasPopup) {
- this._createPopup(this.container, image, this.data);
- }
- this.container.appendChild(image);
- return this.container;
- }
- }]);
-
- return TextAnnotationElement;
-}(AnnotationElement);
-
-var WidgetAnnotationElement = function (_AnnotationElement3) {
- _inherits(WidgetAnnotationElement, _AnnotationElement3);
-
- function WidgetAnnotationElement() {
- _classCallCheck(this, WidgetAnnotationElement);
-
- return _possibleConstructorReturn(this, (WidgetAnnotationElement.__proto__ || Object.getPrototypeOf(WidgetAnnotationElement)).apply(this, arguments));
- }
-
- _createClass(WidgetAnnotationElement, [{
- key: 'render',
- value: function render() {
- return this.container;
- }
- }]);
-
- return WidgetAnnotationElement;
-}(AnnotationElement);
-
-var TextWidgetAnnotationElement = function (_WidgetAnnotationElem) {
- _inherits(TextWidgetAnnotationElement, _WidgetAnnotationElem);
-
- function TextWidgetAnnotationElement(parameters) {
- _classCallCheck(this, TextWidgetAnnotationElement);
-
- var isRenderable = parameters.renderInteractiveForms || !parameters.data.hasAppearance && !!parameters.data.fieldValue;
- return _possibleConstructorReturn(this, (TextWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(TextWidgetAnnotationElement)).call(this, parameters, isRenderable));
- }
-
- _createClass(TextWidgetAnnotationElement, [{
- key: 'render',
- value: function render() {
- var TEXT_ALIGNMENT = ['left', 'center', 'right'];
- this.container.className = 'textWidgetAnnotation';
- var element = null;
- if (this.renderInteractiveForms) {
- if (this.data.multiLine) {
- element = document.createElement('textarea');
- element.textContent = this.data.fieldValue;
- } else {
- element = document.createElement('input');
- element.type = 'text';
- element.setAttribute('value', this.data.fieldValue);
- }
- element.disabled = this.data.readOnly;
- if (this.data.maxLen !== null) {
- element.maxLength = this.data.maxLen;
- }
- if (this.data.comb) {
- var fieldWidth = this.data.rect[2] - this.data.rect[0];
- var combWidth = fieldWidth / this.data.maxLen;
- element.classList.add('comb');
- element.style.letterSpacing = 'calc(' + combWidth + 'px - 1ch)';
- }
- } else {
- element = document.createElement('div');
- element.textContent = this.data.fieldValue;
- element.style.verticalAlign = 'middle';
- element.style.display = 'table-cell';
- var font = null;
- if (this.data.fontRefName) {
- font = this.page.commonObjs.getData(this.data.fontRefName);
- }
- this._setTextStyle(element, font);
- }
- if (this.data.textAlignment !== null) {
- element.style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment];
- }
- this.container.appendChild(element);
- return this.container;
- }
- }, {
- key: '_setTextStyle',
- value: function _setTextStyle(element, font) {
- var style = element.style;
- style.fontSize = this.data.fontSize + 'px';
- style.direction = this.data.fontDirection < 0 ? 'rtl' : 'ltr';
- if (!font) {
- return;
- }
- style.fontWeight = font.black ? font.bold ? '900' : 'bold' : font.bold ? 'bold' : 'normal';
- style.fontStyle = font.italic ? 'italic' : 'normal';
- var fontFamily = font.loadedName ? '"' + font.loadedName + '", ' : '';
- var fallbackName = font.fallbackName || 'Helvetica, sans-serif';
- style.fontFamily = fontFamily + fallbackName;
- }
- }]);
-
- return TextWidgetAnnotationElement;
-}(WidgetAnnotationElement);
-
-var CheckboxWidgetAnnotationElement = function (_WidgetAnnotationElem2) {
- _inherits(CheckboxWidgetAnnotationElement, _WidgetAnnotationElem2);
-
- function CheckboxWidgetAnnotationElement(parameters) {
- _classCallCheck(this, CheckboxWidgetAnnotationElement);
-
- return _possibleConstructorReturn(this, (CheckboxWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(CheckboxWidgetAnnotationElement)).call(this, parameters, parameters.renderInteractiveForms));
- }
-
- _createClass(CheckboxWidgetAnnotationElement, [{
- key: 'render',
- value: function render() {
- this.container.className = 'buttonWidgetAnnotation checkBox';
- var element = document.createElement('input');
- element.disabled = this.data.readOnly;
- element.type = 'checkbox';
- if (this.data.fieldValue && this.data.fieldValue !== 'Off') {
- element.setAttribute('checked', true);
- }
- this.container.appendChild(element);
- return this.container;
- }
- }]);
-
- return CheckboxWidgetAnnotationElement;
-}(WidgetAnnotationElement);
-
-var RadioButtonWidgetAnnotationElement = function (_WidgetAnnotationElem3) {
- _inherits(RadioButtonWidgetAnnotationElement, _WidgetAnnotationElem3);
-
- function RadioButtonWidgetAnnotationElement(parameters) {
- _classCallCheck(this, RadioButtonWidgetAnnotationElement);
-
- return _possibleConstructorReturn(this, (RadioButtonWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(RadioButtonWidgetAnnotationElement)).call(this, parameters, parameters.renderInteractiveForms));
- }
-
- _createClass(RadioButtonWidgetAnnotationElement, [{
- key: 'render',
- value: function render() {
- this.container.className = 'buttonWidgetAnnotation radioButton';
- var element = document.createElement('input');
- element.disabled = this.data.readOnly;
- element.type = 'radio';
- element.name = this.data.fieldName;
- if (this.data.fieldValue === this.data.buttonValue) {
- element.setAttribute('checked', true);
- }
- this.container.appendChild(element);
- return this.container;
- }
- }]);
-
- return RadioButtonWidgetAnnotationElement;
-}(WidgetAnnotationElement);
-
-var PushButtonWidgetAnnotationElement = function (_LinkAnnotationElemen) {
- _inherits(PushButtonWidgetAnnotationElement, _LinkAnnotationElemen);
-
- function PushButtonWidgetAnnotationElement() {
- _classCallCheck(this, PushButtonWidgetAnnotationElement);
-
- return _possibleConstructorReturn(this, (PushButtonWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(PushButtonWidgetAnnotationElement)).apply(this, arguments));
- }
-
- _createClass(PushButtonWidgetAnnotationElement, [{
- key: 'render',
- value: function render() {
- var container = _get(PushButtonWidgetAnnotationElement.prototype.__proto__ || Object.getPrototypeOf(PushButtonWidgetAnnotationElement.prototype), 'render', this).call(this);
- container.className = 'buttonWidgetAnnotation pushButton';
- return container;
- }
- }]);
-
- return PushButtonWidgetAnnotationElement;
-}(LinkAnnotationElement);
-
-var ChoiceWidgetAnnotationElement = function (_WidgetAnnotationElem4) {
- _inherits(ChoiceWidgetAnnotationElement, _WidgetAnnotationElem4);
-
- function ChoiceWidgetAnnotationElement(parameters) {
- _classCallCheck(this, ChoiceWidgetAnnotationElement);
-
- return _possibleConstructorReturn(this, (ChoiceWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(ChoiceWidgetAnnotationElement)).call(this, parameters, parameters.renderInteractiveForms));
- }
-
- _createClass(ChoiceWidgetAnnotationElement, [{
- key: 'render',
- value: function render() {
- this.container.className = 'choiceWidgetAnnotation';
- var selectElement = document.createElement('select');
- selectElement.disabled = this.data.readOnly;
- if (!this.data.combo) {
- selectElement.size = this.data.options.length;
- if (this.data.multiSelect) {
- selectElement.multiple = true;
- }
- }
- for (var i = 0, ii = this.data.options.length; i < ii; i++) {
- var option = this.data.options[i];
- var optionElement = document.createElement('option');
- optionElement.textContent = option.displayValue;
- optionElement.value = option.exportValue;
- if (this.data.fieldValue.includes(option.displayValue)) {
- optionElement.setAttribute('selected', true);
- }
- selectElement.appendChild(optionElement);
- }
- this.container.appendChild(selectElement);
- return this.container;
- }
- }]);
-
- return ChoiceWidgetAnnotationElement;
-}(WidgetAnnotationElement);
-
-var PopupAnnotationElement = function (_AnnotationElement4) {
- _inherits(PopupAnnotationElement, _AnnotationElement4);
-
- function PopupAnnotationElement(parameters) {
- _classCallCheck(this, PopupAnnotationElement);
-
- var isRenderable = !!(parameters.data.title || parameters.data.contents);
- return _possibleConstructorReturn(this, (PopupAnnotationElement.__proto__ || Object.getPrototypeOf(PopupAnnotationElement)).call(this, parameters, isRenderable));
- }
-
- _createClass(PopupAnnotationElement, [{
- key: 'render',
- value: function render() {
- var IGNORE_TYPES = ['Line', 'Square', 'Circle', 'PolyLine', 'Polygon', 'Ink'];
- this.container.className = 'popupAnnotation';
- if (IGNORE_TYPES.includes(this.data.parentType)) {
- return this.container;
- }
- var selector = '[data-annotation-id="' + this.data.parentId + '"]';
- var parentElement = this.layer.querySelector(selector);
- if (!parentElement) {
- return this.container;
- }
- var popup = new PopupElement({
- container: this.container,
- trigger: parentElement,
- color: this.data.color,
- title: this.data.title,
- contents: this.data.contents
- });
- var parentLeft = parseFloat(parentElement.style.left);
- var parentWidth = parseFloat(parentElement.style.width);
- this.container.style.transformOrigin = -(parentLeft + parentWidth) + 'px -' + parentElement.style.top;
- this.container.style.left = parentLeft + parentWidth + 'px';
- this.container.appendChild(popup.render());
- return this.container;
- }
- }]);
-
- return PopupAnnotationElement;
-}(AnnotationElement);
-
-var PopupElement = function () {
- function PopupElement(parameters) {
- _classCallCheck(this, PopupElement);
-
- this.container = parameters.container;
- this.trigger = parameters.trigger;
- this.color = parameters.color;
- this.title = parameters.title;
- this.contents = parameters.contents;
- this.hideWrapper = parameters.hideWrapper || false;
- this.pinned = false;
- }
-
- _createClass(PopupElement, [{
- key: 'render',
- value: function render() {
- var BACKGROUND_ENLIGHT = 0.7;
- var wrapper = document.createElement('div');
- wrapper.className = 'popupWrapper';
- this.hideElement = this.hideWrapper ? wrapper : this.container;
- this.hideElement.setAttribute('hidden', true);
- var popup = document.createElement('div');
- popup.className = 'popup';
- var color = this.color;
- if (color) {
- var r = BACKGROUND_ENLIGHT * (255 - color[0]) + color[0];
- var g = BACKGROUND_ENLIGHT * (255 - color[1]) + color[1];
- var b = BACKGROUND_ENLIGHT * (255 - color[2]) + color[2];
- 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;
- 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;
- }
- }, {
- key: '_formatContents',
- value: function _formatContents(contents) {
- var p = document.createElement('p');
- var lines = contents.split(/(?:\r\n?|\n)/);
- for (var i = 0, ii = lines.length; i < ii; ++i) {
- var line = lines[i];
- p.appendChild(document.createTextNode(line));
- if (i < ii - 1) {
- p.appendChild(document.createElement('br'));
- }
- }
- return p;
- }
- }, {
- key: '_toggle',
- value: function _toggle() {
- if (this.pinned) {
- this._hide(true);
- } else {
- this._show(true);
- }
- }
- }, {
- key: '_show',
- value: function _show() {
- var pin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
-
- if (pin) {
- this.pinned = true;
- }
- if (this.hideElement.hasAttribute('hidden')) {
- this.hideElement.removeAttribute('hidden');
- this.container.style.zIndex += 1;
- }
- }
- }, {
- key: '_hide',
- value: function _hide() {
- var unpin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
-
- if (unpin) {
- this.pinned = false;
- }
- if (!this.hideElement.hasAttribute('hidden') && !this.pinned) {
- this.hideElement.setAttribute('hidden', true);
- this.container.style.zIndex -= 1;
- }
- }
- }]);
-
- return PopupElement;
-}();
-
-var LineAnnotationElement = function (_AnnotationElement5) {
- _inherits(LineAnnotationElement, _AnnotationElement5);
-
- function LineAnnotationElement(parameters) {
- _classCallCheck(this, LineAnnotationElement);
-
- var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
- return _possibleConstructorReturn(this, (LineAnnotationElement.__proto__ || Object.getPrototypeOf(LineAnnotationElement)).call(this, parameters, isRenderable, true));
- }
-
- _createClass(LineAnnotationElement, [{
- key: 'render',
- value: function render() {
- this.container.className = 'lineAnnotation';
- var data = this.data;
- var width = data.rect[2] - data.rect[0];
- var height = data.rect[3] - data.rect[1];
- var svg = this.svgFactory.create(width, height);
- var line = this.svgFactory.createElement('svg:line');
- line.setAttribute('x1', data.rect[2] - data.lineCoordinates[0]);
- line.setAttribute('y1', data.rect[3] - data.lineCoordinates[1]);
- line.setAttribute('x2', data.rect[2] - data.lineCoordinates[2]);
- line.setAttribute('y2', data.rect[3] - data.lineCoordinates[3]);
- line.setAttribute('stroke-width', data.borderStyle.width);
- line.setAttribute('stroke', 'transparent');
- svg.appendChild(line);
- this.container.append(svg);
- this._createPopup(this.container, line, data);
- return this.container;
- }
- }]);
-
- return LineAnnotationElement;
-}(AnnotationElement);
-
-var SquareAnnotationElement = function (_AnnotationElement6) {
- _inherits(SquareAnnotationElement, _AnnotationElement6);
-
- function SquareAnnotationElement(parameters) {
- _classCallCheck(this, SquareAnnotationElement);
-
- var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
- return _possibleConstructorReturn(this, (SquareAnnotationElement.__proto__ || Object.getPrototypeOf(SquareAnnotationElement)).call(this, parameters, isRenderable, true));
- }
-
- _createClass(SquareAnnotationElement, [{
- key: 'render',
- value: function render() {
- this.container.className = 'squareAnnotation';
- var data = this.data;
- var width = data.rect[2] - data.rect[0];
- var height = data.rect[3] - data.rect[1];
- var svg = this.svgFactory.create(width, height);
- var borderWidth = data.borderStyle.width;
- var square = this.svgFactory.createElement('svg:rect');
- square.setAttribute('x', borderWidth / 2);
- square.setAttribute('y', borderWidth / 2);
- square.setAttribute('width', width - borderWidth);
- square.setAttribute('height', height - borderWidth);
- square.setAttribute('stroke-width', borderWidth);
- square.setAttribute('stroke', 'transparent');
- square.setAttribute('fill', 'none');
- svg.appendChild(square);
- this.container.append(svg);
- this._createPopup(this.container, square, data);
- return this.container;
- }
- }]);
-
- return SquareAnnotationElement;
-}(AnnotationElement);
-
-var CircleAnnotationElement = function (_AnnotationElement7) {
- _inherits(CircleAnnotationElement, _AnnotationElement7);
-
- function CircleAnnotationElement(parameters) {
- _classCallCheck(this, CircleAnnotationElement);
-
- var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
- return _possibleConstructorReturn(this, (CircleAnnotationElement.__proto__ || Object.getPrototypeOf(CircleAnnotationElement)).call(this, parameters, isRenderable, true));
- }
-
- _createClass(CircleAnnotationElement, [{
- key: 'render',
- value: function render() {
- this.container.className = 'circleAnnotation';
- var data = this.data;
- var width = data.rect[2] - data.rect[0];
- var height = data.rect[3] - data.rect[1];
- var svg = this.svgFactory.create(width, height);
- var borderWidth = data.borderStyle.width;
- var circle = this.svgFactory.createElement('svg:ellipse');
- circle.setAttribute('cx', width / 2);
- circle.setAttribute('cy', height / 2);
- circle.setAttribute('rx', width / 2 - borderWidth / 2);
- circle.setAttribute('ry', height / 2 - borderWidth / 2);
- circle.setAttribute('stroke-width', borderWidth);
- circle.setAttribute('stroke', 'transparent');
- circle.setAttribute('fill', 'none');
- svg.appendChild(circle);
- this.container.append(svg);
- this._createPopup(this.container, circle, data);
- return this.container;
- }
- }]);
-
- return CircleAnnotationElement;
-}(AnnotationElement);
-
-var PolylineAnnotationElement = function (_AnnotationElement8) {
- _inherits(PolylineAnnotationElement, _AnnotationElement8);
-
- function PolylineAnnotationElement(parameters) {
- _classCallCheck(this, PolylineAnnotationElement);
-
- var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
-
- var _this15 = _possibleConstructorReturn(this, (PolylineAnnotationElement.__proto__ || Object.getPrototypeOf(PolylineAnnotationElement)).call(this, parameters, isRenderable, true));
-
- _this15.containerClassName = 'polylineAnnotation';
- _this15.svgElementName = 'svg:polyline';
- return _this15;
- }
-
- _createClass(PolylineAnnotationElement, [{
- key: 'render',
- value: function render() {
- this.container.className = this.containerClassName;
- var data = this.data;
- var width = data.rect[2] - data.rect[0];
- var height = data.rect[3] - data.rect[1];
- var svg = this.svgFactory.create(width, height);
- var vertices = data.vertices;
- var points = [];
- for (var i = 0, ii = vertices.length; i < ii; i++) {
- var x = vertices[i].x - data.rect[0];
- var y = data.rect[3] - vertices[i].y;
- points.push(x + ',' + y);
- }
- points = points.join(' ');
- var borderWidth = data.borderStyle.width;
- var polyline = this.svgFactory.createElement(this.svgElementName);
- polyline.setAttribute('points', points);
- polyline.setAttribute('stroke-width', borderWidth);
- polyline.setAttribute('stroke', 'transparent');
- polyline.setAttribute('fill', 'none');
- svg.appendChild(polyline);
- this.container.append(svg);
- this._createPopup(this.container, polyline, data);
- return this.container;
- }
- }]);
-
- return PolylineAnnotationElement;
-}(AnnotationElement);
-
-var PolygonAnnotationElement = function (_PolylineAnnotationEl) {
- _inherits(PolygonAnnotationElement, _PolylineAnnotationEl);
-
- function PolygonAnnotationElement(parameters) {
- _classCallCheck(this, PolygonAnnotationElement);
-
- var _this16 = _possibleConstructorReturn(this, (PolygonAnnotationElement.__proto__ || Object.getPrototypeOf(PolygonAnnotationElement)).call(this, parameters));
-
- _this16.containerClassName = 'polygonAnnotation';
- _this16.svgElementName = 'svg:polygon';
- return _this16;
- }
-
- return PolygonAnnotationElement;
-}(PolylineAnnotationElement);
-
-var InkAnnotationElement = function (_AnnotationElement9) {
- _inherits(InkAnnotationElement, _AnnotationElement9);
-
- function InkAnnotationElement(parameters) {
- _classCallCheck(this, InkAnnotationElement);
-
- var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
-
- var _this17 = _possibleConstructorReturn(this, (InkAnnotationElement.__proto__ || Object.getPrototypeOf(InkAnnotationElement)).call(this, parameters, isRenderable, true));
-
- _this17.containerClassName = 'inkAnnotation';
- _this17.svgElementName = 'svg:polyline';
- return _this17;
- }
-
- _createClass(InkAnnotationElement, [{
- key: 'render',
- value: function render() {
- this.container.className = this.containerClassName;
- var data = this.data;
- var width = data.rect[2] - data.rect[0];
- var height = data.rect[3] - data.rect[1];
- var svg = this.svgFactory.create(width, height);
- var inkLists = data.inkLists;
- for (var i = 0, ii = inkLists.length; i < ii; i++) {
- var inkList = inkLists[i];
- var points = [];
- for (var j = 0, jj = inkList.length; j < jj; j++) {
- var x = inkList[j].x - data.rect[0];
- var y = data.rect[3] - inkList[j].y;
- points.push(x + ',' + y);
- }
- points = points.join(' ');
- var borderWidth = data.borderStyle.width;
- var polyline = this.svgFactory.createElement(this.svgElementName);
- polyline.setAttribute('points', points);
- polyline.setAttribute('stroke-width', borderWidth);
- polyline.setAttribute('stroke', 'transparent');
- polyline.setAttribute('fill', 'none');
- this._createPopup(this.container, polyline, data);
- svg.appendChild(polyline);
- }
- this.container.append(svg);
- return this.container;
- }
- }]);
-
- return InkAnnotationElement;
-}(AnnotationElement);
-
-var HighlightAnnotationElement = function (_AnnotationElement10) {
- _inherits(HighlightAnnotationElement, _AnnotationElement10);
-
- function HighlightAnnotationElement(parameters) {
- _classCallCheck(this, HighlightAnnotationElement);
-
- var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
- return _possibleConstructorReturn(this, (HighlightAnnotationElement.__proto__ || Object.getPrototypeOf(HighlightAnnotationElement)).call(this, parameters, isRenderable, true));
- }
-
- _createClass(HighlightAnnotationElement, [{
- key: 'render',
- value: function render() {
- this.container.className = 'highlightAnnotation';
- if (!this.data.hasPopup) {
- this._createPopup(this.container, null, this.data);
- }
- return this.container;
- }
- }]);
-
- return HighlightAnnotationElement;
-}(AnnotationElement);
-
-var UnderlineAnnotationElement = function (_AnnotationElement11) {
- _inherits(UnderlineAnnotationElement, _AnnotationElement11);
-
- function UnderlineAnnotationElement(parameters) {
- _classCallCheck(this, UnderlineAnnotationElement);
-
- var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
- return _possibleConstructorReturn(this, (UnderlineAnnotationElement.__proto__ || Object.getPrototypeOf(UnderlineAnnotationElement)).call(this, parameters, isRenderable, true));
- }
-
- _createClass(UnderlineAnnotationElement, [{
- key: 'render',
- value: function render() {
- this.container.className = 'underlineAnnotation';
- if (!this.data.hasPopup) {
- this._createPopup(this.container, null, this.data);
- }
- return this.container;
- }
- }]);
-
- return UnderlineAnnotationElement;
-}(AnnotationElement);
-
-var SquigglyAnnotationElement = function (_AnnotationElement12) {
- _inherits(SquigglyAnnotationElement, _AnnotationElement12);
-
- function SquigglyAnnotationElement(parameters) {
- _classCallCheck(this, SquigglyAnnotationElement);
-
- var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
- return _possibleConstructorReturn(this, (SquigglyAnnotationElement.__proto__ || Object.getPrototypeOf(SquigglyAnnotationElement)).call(this, parameters, isRenderable, true));
- }
-
- _createClass(SquigglyAnnotationElement, [{
- key: 'render',
- value: function render() {
- this.container.className = 'squigglyAnnotation';
- if (!this.data.hasPopup) {
- this._createPopup(this.container, null, this.data);
- }
- return this.container;
- }
- }]);
-
- return SquigglyAnnotationElement;
-}(AnnotationElement);
-
-var StrikeOutAnnotationElement = function (_AnnotationElement13) {
- _inherits(StrikeOutAnnotationElement, _AnnotationElement13);
-
- function StrikeOutAnnotationElement(parameters) {
- _classCallCheck(this, StrikeOutAnnotationElement);
-
- var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
- return _possibleConstructorReturn(this, (StrikeOutAnnotationElement.__proto__ || Object.getPrototypeOf(StrikeOutAnnotationElement)).call(this, parameters, isRenderable, true));
- }
-
- _createClass(StrikeOutAnnotationElement, [{
- key: 'render',
- value: function render() {
- this.container.className = 'strikeoutAnnotation';
- if (!this.data.hasPopup) {
- this._createPopup(this.container, null, this.data);
- }
- return this.container;
- }
- }]);
-
- return StrikeOutAnnotationElement;
-}(AnnotationElement);
-
-var StampAnnotationElement = function (_AnnotationElement14) {
- _inherits(StampAnnotationElement, _AnnotationElement14);
-
- function StampAnnotationElement(parameters) {
- _classCallCheck(this, StampAnnotationElement);
-
- var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
- return _possibleConstructorReturn(this, (StampAnnotationElement.__proto__ || Object.getPrototypeOf(StampAnnotationElement)).call(this, parameters, isRenderable, true));
- }
-
- _createClass(StampAnnotationElement, [{
- key: 'render',
- value: function render() {
- this.container.className = 'stampAnnotation';
- if (!this.data.hasPopup) {
- this._createPopup(this.container, null, this.data);
- }
- return this.container;
- }
- }]);
-
- return StampAnnotationElement;
-}(AnnotationElement);
-
-var FileAttachmentAnnotationElement = function (_AnnotationElement15) {
- _inherits(FileAttachmentAnnotationElement, _AnnotationElement15);
-
- function FileAttachmentAnnotationElement(parameters) {
- _classCallCheck(this, FileAttachmentAnnotationElement);
-
- var _this23 = _possibleConstructorReturn(this, (FileAttachmentAnnotationElement.__proto__ || Object.getPrototypeOf(FileAttachmentAnnotationElement)).call(this, parameters, true));
-
- var _this23$data$file = _this23.data.file,
- filename = _this23$data$file.filename,
- content = _this23$data$file.content;
-
- _this23.filename = (0, _dom_utils.getFilenameFromUrl)(filename);
- _this23.content = content;
- if (_this23.linkService.eventBus) {
- _this23.linkService.eventBus.dispatch('fileattachmentannotation', {
- source: _this23,
- id: (0, _util.stringToPDFString)(filename),
- filename: filename,
- content: content
- });
- }
- return _this23;
- }
-
- _createClass(FileAttachmentAnnotationElement, [{
- key: 'render',
- value: function render() {
- this.container.className = 'fileAttachmentAnnotation';
- var trigger = document.createElement('div');
- trigger.style.height = this.container.style.height;
- trigger.style.width = this.container.style.width;
- trigger.addEventListener('dblclick', this._download.bind(this));
- if (!this.data.hasPopup && (this.data.title || this.data.contents)) {
- this._createPopup(this.container, trigger, this.data);
- }
- this.container.appendChild(trigger);
- return this.container;
- }
- }, {
- key: '_download',
- value: function _download() {
- if (!this.downloadManager) {
- (0, _util.warn)('Download cannot be started due to unavailable download manager');
- return;
- }
- this.downloadManager.downloadData(this.content, this.filename, '');
- }
- }]);
-
- return FileAttachmentAnnotationElement;
-}(AnnotationElement);
-
-var AnnotationLayer = function () {
- function AnnotationLayer() {
- _classCallCheck(this, AnnotationLayer);
- }
-
- _createClass(AnnotationLayer, null, [{
- key: 'render',
- value: function render(parameters) {
- for (var i = 0, ii = parameters.annotations.length; i < ii; i++) {
- var data = parameters.annotations[i];
- if (!data) {
- continue;
- }
- var element = AnnotationElementFactory.create({
- data: data,
- layer: parameters.div,
- page: parameters.page,
- viewport: parameters.viewport,
- linkService: parameters.linkService,
- downloadManager: parameters.downloadManager,
- imageResourcesPath: parameters.imageResourcesPath || '',
- renderInteractiveForms: parameters.renderInteractiveForms || false,
- svgFactory: new _dom_utils.DOMSVGFactory()
- });
- if (element.isRenderable) {
- parameters.div.appendChild(element.render());
- }
- }
- }
- }, {
- key: 'update',
- value: function update(parameters) {
- for (var i = 0, ii = parameters.annotations.length; i < ii; i++) {
- var data = parameters.annotations[i];
- var element = parameters.div.querySelector('[data-annotation-id="' + data.id + '"]');
- if (element) {
- element.style.transform = 'matrix(' + parameters.viewport.transform.join(',') + ')';
- }
- }
- parameters.div.removeAttribute('hidden');
- }
- }]);
-
- return AnnotationLayer;
-}();
-
-exports.AnnotationLayer = AnnotationLayer;
-
-/***/ }),
-/* 147 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.SVGGraphics = undefined;
-
-var _util = __w_pdfjs_require__(1);
-
-var _dom_utils = __w_pdfjs_require__(130);
-
-var _is_node = __w_pdfjs_require__(4);
-
-var _is_node2 = _interopRequireDefault(_is_node);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-var SVGGraphics = function SVGGraphics() {
- throw new Error('Not implemented: SVGGraphics');
-};
-{
- var SVG_DEFAULTS = {
- fontStyle: 'normal',
- fontWeight: 'normal',
- fillColor: '#000000'
- };
- var convertImgDataToPng = function convertImgDataToPngClosure() {
- var PNG_HEADER = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
- var CHUNK_WRAPPER_SIZE = 12;
- var crcTable = new Int32Array(256);
- for (var i = 0; i < 256; i++) {
- var c = i;
- for (var h = 0; h < 8; h++) {
- if (c & 1) {
- c = 0xedB88320 ^ c >> 1 & 0x7fffffff;
- } else {
- c = c >> 1 & 0x7fffffff;
- }
- }
- crcTable[i] = c;
- }
- function crc32(data, start, end) {
- var crc = -1;
- for (var i = start; i < end; i++) {
- var a = (crc ^ data[i]) & 0xff;
- var b = crcTable[a];
- crc = crc >>> 8 ^ b;
- }
- return crc ^ -1;
- }
- function writePngChunk(type, body, data, offset) {
- var p = offset;
- var len = body.length;
- data[p] = len >> 24 & 0xff;
- data[p + 1] = len >> 16 & 0xff;
- data[p + 2] = len >> 8 & 0xff;
- data[p + 3] = len & 0xff;
- p += 4;
- data[p] = type.charCodeAt(0) & 0xff;
- data[p + 1] = type.charCodeAt(1) & 0xff;
- data[p + 2] = type.charCodeAt(2) & 0xff;
- data[p + 3] = type.charCodeAt(3) & 0xff;
- p += 4;
- data.set(body, p);
- p += body.length;
- var crc = crc32(data, offset + 4, p);
- data[p] = crc >> 24 & 0xff;
- data[p + 1] = crc >> 16 & 0xff;
- data[p + 2] = crc >> 8 & 0xff;
- data[p + 3] = crc & 0xff;
- }
- function adler32(data, start, end) {
- var a = 1;
- var b = 0;
- for (var i = start; i < end; ++i) {
- a = (a + (data[i] & 0xff)) % 65521;
- b = (b + a) % 65521;
- }
- return b << 16 | a;
- }
- function deflateSync(literals) {
- if (!(0, _is_node2.default)()) {
- return deflateSyncUncompressed(literals);
- }
- try {
- var input;
- if (parseInt(process.versions.node) >= 8) {
- input = literals;
- } else {
- input = new Buffer(literals);
- }
- var output = require('zlib').deflateSync(input, { level: 9 });
- return output instanceof Uint8Array ? output : new Uint8Array(output);
- } catch (e) {
- (0, _util.warn)('Not compressing PNG because zlib.deflateSync is unavailable: ' + e);
- }
- return deflateSyncUncompressed(literals);
- }
- function deflateSyncUncompressed(literals) {
- var len = literals.length;
- var maxBlockLength = 0xFFFF;
- var deflateBlocks = Math.ceil(len / maxBlockLength);
- var idat = new Uint8Array(2 + len + deflateBlocks * 5 + 4);
- var pi = 0;
- idat[pi++] = 0x78;
- idat[pi++] = 0x9c;
- var pos = 0;
- while (len > maxBlockLength) {
- idat[pi++] = 0x00;
- idat[pi++] = 0xff;
- idat[pi++] = 0xff;
- idat[pi++] = 0x00;
- idat[pi++] = 0x00;
- idat.set(literals.subarray(pos, pos + maxBlockLength), pi);
- pi += maxBlockLength;
- pos += maxBlockLength;
- len -= maxBlockLength;
- }
- idat[pi++] = 0x01;
- idat[pi++] = len & 0xff;
- idat[pi++] = len >> 8 & 0xff;
- idat[pi++] = ~len & 0xffff & 0xff;
- idat[pi++] = (~len & 0xffff) >> 8 & 0xff;
- idat.set(literals.subarray(pos), pi);
- pi += literals.length - pos;
- var adler = adler32(literals, 0, literals.length);
- idat[pi++] = adler >> 24 & 0xff;
- idat[pi++] = adler >> 16 & 0xff;
- idat[pi++] = adler >> 8 & 0xff;
- idat[pi++] = adler & 0xff;
- return idat;
- }
- function encode(imgData, kind, forceDataSchema, isMask) {
- var width = imgData.width;
- var height = imgData.height;
- var bitDepth, colorType, lineSize;
- var bytes = imgData.data;
- switch (kind) {
- case _util.ImageKind.GRAYSCALE_1BPP:
- colorType = 0;
- bitDepth = 1;
- lineSize = width + 7 >> 3;
- break;
- case _util.ImageKind.RGB_24BPP:
- colorType = 2;
- bitDepth = 8;
- lineSize = width * 3;
- break;
- case _util.ImageKind.RGBA_32BPP:
- colorType = 6;
- bitDepth = 8;
- lineSize = width * 4;
- break;
- default:
- throw new Error('invalid format');
- }
- var literals = new Uint8Array((1 + lineSize) * height);
- var offsetLiterals = 0,
- offsetBytes = 0;
- var y, i;
- for (y = 0; y < height; ++y) {
- literals[offsetLiterals++] = 0;
- literals.set(bytes.subarray(offsetBytes, offsetBytes + lineSize), offsetLiterals);
- offsetBytes += lineSize;
- offsetLiterals += lineSize;
- }
- if (kind === _util.ImageKind.GRAYSCALE_1BPP && isMask) {
- offsetLiterals = 0;
- for (y = 0; y < height; y++) {
- offsetLiterals++;
- for (i = 0; i < lineSize; i++) {
- literals[offsetLiterals++] ^= 0xFF;
- }
- }
- }
- var ihdr = new Uint8Array([width >> 24 & 0xff, width >> 16 & 0xff, width >> 8 & 0xff, width & 0xff, height >> 24 & 0xff, height >> 16 & 0xff, height >> 8 & 0xff, height & 0xff, bitDepth, colorType, 0x00, 0x00, 0x00]);
- var idat = deflateSync(literals);
- var pngLength = PNG_HEADER.length + CHUNK_WRAPPER_SIZE * 3 + ihdr.length + idat.length;
- var data = new Uint8Array(pngLength);
- var offset = 0;
- data.set(PNG_HEADER, offset);
- offset += PNG_HEADER.length;
- writePngChunk('IHDR', ihdr, data, offset);
- offset += CHUNK_WRAPPER_SIZE + ihdr.length;
- writePngChunk('IDATA', idat, data, offset);
- offset += CHUNK_WRAPPER_SIZE + idat.length;
- writePngChunk('IEND', new Uint8Array(0), data, offset);
- return (0, _util.createObjectURL)(data, 'image/png', forceDataSchema);
- }
- return function convertImgDataToPng(imgData, forceDataSchema, isMask) {
- var kind = imgData.kind === undefined ? _util.ImageKind.GRAYSCALE_1BPP : imgData.kind;
- return encode(imgData, kind, forceDataSchema, isMask);
- };
- }();
- var SVGExtraState = function SVGExtraStateClosure() {
- function SVGExtraState() {
- this.fontSizeScale = 1;
- this.fontWeight = SVG_DEFAULTS.fontWeight;
- this.fontSize = 0;
- this.textMatrix = _util.IDENTITY_MATRIX;
- this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
- this.leading = 0;
- this.textRenderingMode = _util.TextRenderingMode.FILL;
- this.x = 0;
- this.y = 0;
- this.lineX = 0;
- this.lineY = 0;
- this.charSpacing = 0;
- this.wordSpacing = 0;
- this.textHScale = 1;
- this.textRise = 0;
- this.fillColor = SVG_DEFAULTS.fillColor;
- this.strokeColor = '#000000';
- this.fillAlpha = 1;
- this.strokeAlpha = 1;
- this.lineWidth = 1;
- this.lineJoin = '';
- this.lineCap = '';
- this.miterLimit = 0;
- this.dashArray = [];
- this.dashPhase = 0;
- this.dependencies = [];
- this.activeClipUrl = null;
- this.clipGroup = null;
- this.maskId = '';
- }
- SVGExtraState.prototype = {
- clone: function SVGExtraState_clone() {
- return Object.create(this);
- },
- setCurrentPoint: function SVGExtraState_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]) + ')';
- }
- function SVGGraphics(commonObjs, objs, forceDataSchema) {
- this.svgFactory = new _dom_utils.DOMSVGFactory();
- this.current = new SVGExtraState();
- this.transformMatrix = _util.IDENTITY_MATRIX;
- this.transformStack = [];
- this.extraStack = [];
- this.commonObjs = commonObjs;
- this.objs = objs;
- this.pendingClip = null;
- this.pendingEOFill = false;
- this.embedFonts = false;
- this.embeddedFonts = Object.create(null);
- this.cssStyle = null;
- this.forceDataSchema = !!forceDataSchema;
- }
- 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() {
- this.transformStack.push(this.transformMatrix);
- var old = this.current;
- this.extraStack.push(old);
- this.current = old.clone();
- },
- restore: function SVGGraphics_restore() {
- this.transformMatrix = this.transformStack.pop();
- this.current = this.extraStack.pop();
- this.pendingClip = null;
- this.tgrp = null;
- },
- group: function SVGGraphics_group(items) {
- this.save();
- this.executeOpTree(items);
- this.restore();
- },
- loadDependencies: function SVGGraphics_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 n = 0, nn = deps.length; n < nn; n++) {
- var obj = deps[n];
- var common = obj.substring(0, 2) === 'g_';
- var promise;
- 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);
- }
- }
- }
- return Promise.all(this.current.dependencies);
- },
- transform: function SVGGraphics_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) {
- var _this2 = this;
-
- this.viewport = viewport;
- var svgElement = this._initialize(viewport);
- return this.loadDependencies(operatorList).then(function () {
- _this2.transformMatrix = _util.IDENTITY_MATRIX;
- var opTree = _this2.convertOpList(operatorList);
- _this2.executeOpTree(opTree);
- return svgElement;
- });
- },
- convertOpList: function SVGGraphics_convertOpList(operatorList) {
- 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];
- opList.push({
- 'fnId': fnId,
- 'fn': REVOPS[fnId],
- 'args': argsArray[x]
- });
- }
- return opListToTree(opList);
- },
- executeOpTree: function SVGGraphics_executeOpTree(opTree) {
- var opTreeLen = opTree.length;
- for (var x = 0; x < opTreeLen; x++) {
- var fn = opTree[x].fn;
- var fnId = opTree[x].fnId;
- var args = opTree[x].args;
- switch (fnId | 0) {
- case _util.OPS.beginText:
- this.beginText();
- break;
- case _util.OPS.dependency:
- break;
- case _util.OPS.setLeading:
- this.setLeading(args);
- break;
- case _util.OPS.setLeadingMoveText:
- this.setLeadingMoveText(args[0], args[1]);
- break;
- case _util.OPS.setFont:
- this.setFont(args);
- break;
- case _util.OPS.showText:
- this.showText(args[0]);
- break;
- case _util.OPS.showSpacedText:
- this.showText(args[0]);
- break;
- case _util.OPS.endText:
- this.endText();
- break;
- case _util.OPS.moveText:
- this.moveText(args[0], args[1]);
- break;
- case _util.OPS.setCharSpacing:
- this.setCharSpacing(args[0]);
- break;
- case _util.OPS.setWordSpacing:
- this.setWordSpacing(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.setTextRise:
- this.setTextRise(args[0]);
- break;
- case _util.OPS.setTextRenderingMode:
- this.setTextRenderingMode(args[0]);
- break;
- case _util.OPS.setLineWidth:
- this.setLineWidth(args[0]);
- break;
- case _util.OPS.setLineJoin:
- this.setLineJoin(args[0]);
- break;
- case _util.OPS.setLineCap:
- this.setLineCap(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.setStrokeRGBColor:
- this.setStrokeRGBColor(args[0], args[1], args[2]);
- break;
- case _util.OPS.setDash:
- this.setDash(args[0], args[1]);
- break;
- case _util.OPS.setGState:
- this.setGState(args[0]);
- break;
- case _util.OPS.fill:
- this.fill();
- break;
- case _util.OPS.eoFill:
- this.eoFill();
- break;
- case _util.OPS.stroke:
- this.stroke();
- break;
- case _util.OPS.fillStroke:
- this.fillStroke();
- break;
- case _util.OPS.eoFillStroke:
- this.eoFillStroke();
- break;
- case _util.OPS.clip:
- this.clip('nonzero');
- break;
- case _util.OPS.eoClip:
- this.clip('evenodd');
- break;
- case _util.OPS.paintSolidColorImageMask:
- this.paintSolidColorImageMask();
- break;
- case _util.OPS.paintJpegXObject:
- this.paintJpegXObject(args[0], args[1], args[2]);
- break;
- case _util.OPS.paintImageXObject:
- this.paintImageXObject(args[0]);
- break;
- case _util.OPS.paintInlineImageXObject:
- this.paintInlineImageXObject(args[0]);
- break;
- case _util.OPS.paintImageMaskXObject:
- this.paintImageMaskXObject(args[0]);
- break;
- case _util.OPS.paintFormXObjectBegin:
- this.paintFormXObjectBegin(args[0], args[1]);
- break;
- case _util.OPS.paintFormXObjectEnd:
- this.paintFormXObjectEnd();
- break;
- case _util.OPS.closePath:
- this.closePath();
- break;
- case _util.OPS.closeStroke:
- this.closeStroke();
- break;
- case _util.OPS.closeFillStroke:
- this.closeFillStroke();
- break;
- case _util.OPS.closeEOFillStroke:
- this.closeEOFillStroke();
- break;
- case _util.OPS.nextLine:
- this.nextLine();
- 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(opTree[x].items);
- break;
- default:
- (0, _util.warn)('Unimplemented operator ' + fn);
- break;
- }
- }
- },
- setWordSpacing: function SVGGraphics_setWordSpacing(wordSpacing) {
- this.current.wordSpacing = wordSpacing;
- },
- setCharSpacing: function SVGGraphics_setCharSpacing(charSpacing) {
- this.current.charSpacing = charSpacing;
- },
- nextLine: function SVGGraphics_nextLine() {
- this.moveText(0, this.current.leading);
- },
- setTextMatrix: function SVGGraphics_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.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, '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) {
- var current = this.current;
- this.current.x = this.current.lineX += x;
- this.current.y = this.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, 'y', pf(-current.y));
- },
- showText: function SVGGraphics_showText(glyphs) {
- var current = this.current;
- var font = current.font;
- var fontSize = current.fontSize;
- if (fontSize === 0) {
- return;
- }
- var charSpacing = current.charSpacing;
- 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;
- for (i = 0; i < glyphsLength; ++i) {
- var glyph = glyphs[i];
- 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;
- if (!glyph.isInFont && !font.missingFile) {
- x += charWidth;
- continue;
- }
- current.xcoords.push(current.x + x * textHScale);
- current.tspan.textContent += character;
- x += charWidth;
- }
- if (vertical) {
- current.y -= x * textHScale;
- } else {
- current.x += x * textHScale;
- }
- 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');
- if (current.fontStyle !== SVG_DEFAULTS.fontStyle) {
- current.tspan.setAttributeNS(null, 'font-style', current.fontStyle);
- }
- if (current.fontWeight !== SVG_DEFAULTS.fontWeight) {
- current.tspan.setAttributeNS(null, 'font-weight', current.fontWeight);
- }
- var fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK;
- if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
- if (current.fillColor !== SVG_DEFAULTS.fillColor) {
- current.tspan.setAttributeNS(null, 'fill', current.fillColor);
- }
- if (current.fillAlpha < 1) {
- current.tspan.setAttributeNS(null, 'fill-opacity', current.fillAlpha);
- }
- } else if (current.textRenderingMode === _util.TextRenderingMode.ADD_TO_PATH) {
- current.tspan.setAttributeNS(null, 'fill', 'transparent');
- } else {
- current.tspan.setAttributeNS(null, 'fill', 'none');
- }
- if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
- this._setStrokeAttributes(current.tspan);
- }
- var textMatrix = current.textMatrix;
- if (current.textRise !== 0) {
- textMatrix = textMatrix.slice();
- textMatrix[5] += current.textRise;
- }
- current.txtElement.setAttributeNS(null, 'transform', 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) {
- this.setLeading(-y);
- this.moveText(x, y);
- },
- addFontStyle: function SVGGraphics_addFontStyle(fontObj) {
- if (!this.cssStyle) {
- this.cssStyle = this.svgFactory.createElement('svg:style');
- this.cssStyle.setAttributeNS(null, 'type', 'text/css');
- this.defs.appendChild(this.cssStyle);
- }
- 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) {
- var current = this.current;
- var fontObj = this.commonObjs.get(details[0]);
- var size = details[1];
- this.current.font = fontObj;
- if (this.embedFonts && fontObj.data && !this.embeddedFonts[fontObj.loadedName]) {
- this.addFontStyle(fontObj);
- this.embeddedFonts[fontObj.loadedName] = fontObj;
- }
- current.fontMatrix = fontObj.fontMatrix ? fontObj.fontMatrix : _util.FONT_IDENTITY_MATRIX;
- var bold = fontObj.black ? fontObj.bold ? 'bolder' : 'bold' : fontObj.bold ? 'bold' : 'normal';
- var italic = fontObj.italic ? 'italic' : 'normal';
- if (size < 0) {
- size = -size;
- current.fontDirection = -1;
- } else {
- current.fontDirection = 1;
- }
- current.fontSize = size;
- current.fontFamily = fontObj.loadedName;
- current.fontWeight = bold;
- current.fontStyle = italic;
- current.tspan = this.svgFactory.createElement('svg:tspan');
- current.tspan.setAttributeNS(null, 'y', pf(-current.y));
- current.xcoords = [];
- },
- endText: function endText() {
- var current = this.current;
- if (current.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG && current.txtElement && current.txtElement.hasChildNodes()) {
- current.element = current.txtElement;
- this.clip('nonzero');
- this.endPath();
- }
- },
-
- setLineWidth: function SVGGraphics_setLineWidth(width) {
- this.current.lineWidth = width;
- },
- setLineCap: function SVGGraphics_setLineCap(style) {
- this.current.lineCap = LINE_CAP_STYLES[style];
- },
- setLineJoin: function SVGGraphics_setLineJoin(style) {
- this.current.lineJoin = LINE_JOIN_STYLES[style];
- },
- setMiterLimit: function SVGGraphics_setMiterLimit(limit) {
- this.current.miterLimit = limit;
- },
- setStrokeAlpha: function SVGGraphics_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) {
- this.current.fillAlpha = fillAlpha;
- },
- setFillRGBColor: function SVGGraphics_setFillRGBColor(r, g, b) {
- var color = _util.Util.makeCssRgb(r, g, b);
- this.current.fillColor = color;
- this.current.tspan = this.svgFactory.createElement('svg:tspan');
- this.current.xcoords = [];
- },
- setDash: function SVGGraphics_setDash(dashArray, dashPhase) {
- this.current.dashArray = dashArray;
- this.current.dashPhase = dashPhase;
- },
- constructPath: function SVGGraphics_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;
- case _util.OPS.moveTo:
- x = args[j++];
- y = args[j++];
- d.push('M', pf(x), pf(y));
- break;
- case _util.OPS.lineTo:
- x = args[j++];
- y = args[j++];
- d.push('L', 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.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.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;
- }
- }
- current.path.setAttributeNS(null, 'd', d.join(' '));
- current.path.setAttributeNS(null, 'fill', 'none');
- this._ensureTransformGroup().appendChild(current.path);
- current.element = current.path;
- current.setCurrentPoint(x, y);
- },
- endPath: function SVGGraphics_endPath() {
- if (!this.pendingClip) {
- return;
- }
- var current = this.current;
- var clipId = 'clippath' + clipCount;
- clipCount++;
- var clipPath = this.svgFactory.createElement('svg:clipPath');
- clipPath.setAttributeNS(null, 'id', clipId);
- clipPath.setAttributeNS(null, 'transform', pm(this.transformMatrix));
- var clipElement = current.element.cloneNode(true);
- if (this.pendingClip === 'evenodd') {
- clipElement.setAttributeNS(null, 'clip-rule', 'evenodd');
- } else {
- clipElement.setAttributeNS(null, 'clip-rule', 'nonzero');
- }
- this.pendingClip = null;
- clipPath.appendChild(clipElement);
- this.defs.appendChild(clipPath);
- if (current.activeClipUrl) {
- current.clipGroup = null;
- this.extraStack.forEach(function (prev) {
- prev.clipGroup = null;
- });
- clipPath.setAttributeNS(null, 'clip-path', current.activeClipUrl);
- }
- current.activeClipUrl = 'url(#' + clipId + ')';
- this.tgrp = null;
- },
- clip: function SVGGraphics_clip(type) {
- this.pendingClip = type;
- },
- closePath: function SVGGraphics_closePath() {
- var current = this.current;
- if (current.path) {
- var d = current.path.getAttributeNS(null, 'd');
- d += 'Z';
- current.path.setAttributeNS(null, 'd', d);
- }
- },
- setLeading: function SVGGraphics_setLeading(leading) {
- this.current.leading = -leading;
- },
- setTextRise: function SVGGraphics_setTextRise(textRise) {
- this.current.textRise = textRise;
- },
- setTextRenderingMode: function setTextRenderingMode(textRenderingMode) {
- this.current.textRenderingMode = textRenderingMode;
- },
-
- setHScale: function SVGGraphics_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;
- case 'LC':
- this.setLineCap(value);
- break;
- case 'LJ':
- this.setLineJoin(value);
- break;
- case 'ML':
- this.setMiterLimit(value);
- break;
- case 'D':
- this.setDash(value[0], value[1]);
- 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 ' + key);
- break;
- }
- }
- },
- fill: function SVGGraphics_fill() {
- var current = this.current;
- if (current.element) {
- current.element.setAttributeNS(null, 'fill', current.fillColor);
- current.element.setAttributeNS(null, 'fill-opacity', current.fillAlpha);
- this.endPath();
- }
- },
- stroke: function SVGGraphics_stroke() {
- var current = this.current;
- if (current.element) {
- this._setStrokeAttributes(current.element);
- current.element.setAttributeNS(null, 'fill', 'none');
- this.endPath();
- }
- },
- _setStrokeAttributes: function _setStrokeAttributes(element) {
- var current = this.current;
- 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() {
- if (this.current.element) {
- this.current.element.setAttributeNS(null, 'fill-rule', 'evenodd');
- }
- this.fill();
- },
- fillStroke: function SVGGraphics_fillStroke() {
- this.stroke();
- this.fill();
- },
- eoFillStroke: function SVGGraphics_eoFillStroke() {
- if (this.current.element) {
- this.current.element.setAttributeNS(null, 'fill-rule', 'evenodd');
- }
- this.fillStroke();
- },
- closeStroke: function SVGGraphics_closeStroke() {
- this.closePath();
- this.stroke();
- },
- closeFillStroke: function SVGGraphics_closeFillStroke() {
- this.closePath();
- this.fillStroke();
- },
- closeEOFillStroke: function closeEOFillStroke() {
- this.closePath();
- this.eoFillStroke();
- },
-
- paintSolidColorImageMask: function SVGGraphics_paintSolidColorImageMask() {
- var current = this.current;
- 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);
- this._ensureTransformGroup().appendChild(rect);
- },
- paintJpegXObject: function SVGGraphics_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);
- imgEl.setAttributeNS(null, 'width', pf(w));
- 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) + ')');
- this._ensureTransformGroup().appendChild(imgEl);
- },
- paintImageXObject: function SVGGraphics_paintImageXObject(objId) {
- var imgData = this.objs.get(objId);
- if (!imgData) {
- (0, _util.warn)('Dependent image isn\'t ready yet');
- return;
- }
- this.paintInlineImageXObject(imgData);
- },
- paintInlineImageXObject: function SVGGraphics_paintInlineImageXObject(imgData, mask) {
- var width = imgData.width;
- var height = imgData.height;
- var imgSrc = convertImgDataToPng(imgData, this.forceDataSchema, !!mask);
- var cliprect = this.svgFactory.createElement('svg:rect');
- cliprect.setAttributeNS(null, 'x', '0');
- cliprect.setAttributeNS(null, 'y', '0');
- cliprect.setAttributeNS(null, 'width', pf(width));
- cliprect.setAttributeNS(null, 'height', pf(height));
- this.current.element = cliprect;
- this.clip('nonzero');
- var imgEl = this.svgFactory.createElement('svg:image');
- imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgSrc);
- imgEl.setAttributeNS(null, 'x', '0');
- 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) + ')');
- if (mask) {
- mask.appendChild(imgEl);
- } else {
- this._ensureTransformGroup().appendChild(imgEl);
- }
- },
- paintImageMaskXObject: function SVGGraphics_paintImageMaskXObject(imgData) {
- var current = this.current;
- var width = imgData.width;
- var height = imgData.height;
- var fillColor = current.fillColor;
- current.maskId = 'mask' + maskCount++;
- var mask = this.svgFactory.createElement('svg:mask');
- mask.setAttributeNS(null, 'id', current.maskId);
- var rect = this.svgFactory.createElement('svg:rect');
- rect.setAttributeNS(null, 'x', '0');
- rect.setAttributeNS(null, 'y', '0');
- rect.setAttributeNS(null, 'width', pf(width));
- rect.setAttributeNS(null, 'height', pf(height));
- rect.setAttributeNS(null, 'fill', fillColor);
- rect.setAttributeNS(null, 'mask', 'url(#' + current.maskId + ')');
- this.defs.appendChild(mask);
- this._ensureTransformGroup().appendChild(rect);
- this.paintInlineImageXObject(imgData, mask);
- },
- paintFormXObjectBegin: function SVGGraphics_paintFormXObjectBegin(matrix, bbox) {
- if (Array.isArray(matrix) && matrix.length === 6) {
- this.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
- }
- if (Array.isArray(bbox) && bbox.length === 4) {
- var width = bbox[2] - bbox[0];
- var height = bbox[3] - bbox[1];
- var cliprect = this.svgFactory.createElement('svg:rect');
- cliprect.setAttributeNS(null, 'x', bbox[0]);
- cliprect.setAttributeNS(null, 'y', bbox[1]);
- cliprect.setAttributeNS(null, 'width', pf(width));
- cliprect.setAttributeNS(null, 'height', pf(height));
- this.current.element = cliprect;
- this.clip('nonzero');
- this.endPath();
- }
- },
- paintFormXObjectEnd: function SVGGraphics_paintFormXObjectEnd() {},
- _initialize: function _initialize(viewport) {
- var svg = this.svgFactory.create(viewport.width, viewport.height);
- var definitions = this.svgFactory.createElement('svg:defs');
- svg.appendChild(definitions);
- this.defs = definitions;
- var rootGroup = this.svgFactory.createElement('svg:g');
- rootGroup.setAttributeNS(null, 'transform', pm(viewport.transform));
- svg.appendChild(rootGroup);
- this.svg = rootGroup;
- return svg;
- },
-
- _ensureClipGroup: function SVGGraphics_ensureClipGroup() {
- if (!this.current.clipGroup) {
- var clipGroup = this.svgFactory.createElement('svg:g');
- clipGroup.setAttributeNS(null, 'clip-path', this.current.activeClipUrl);
- this.svg.appendChild(clipGroup);
- this.current.clipGroup = clipGroup;
- }
- return this.current.clipGroup;
- },
- _ensureTransformGroup: function SVGGraphics_ensureTransformGroup() {
- if (!this.tgrp) {
- this.tgrp = this.svgFactory.createElement('svg:g');
- this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
- if (this.current.activeClipUrl) {
- this._ensureClipGroup().appendChild(this.tgrp);
- } else {
- this.svg.appendChild(this.tgrp);
- }
- }
- return this.tgrp;
- }
- };
- return SVGGraphics;
- }();
-}
-exports.SVGGraphics = SVGGraphics;
-
-/***/ }),
-/* 148 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.PDFNodeStream = undefined;
-
-var _regenerator = __w_pdfjs_require__(137);
-
-var _regenerator2 = _interopRequireDefault(_regenerator);
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _util = __w_pdfjs_require__(1);
-
-var _network_utils = __w_pdfjs_require__(149);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
-
-function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
-
-function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var fs = require('fs');
-var http = require('http');
-var https = require('https');
-var url = require('url');
-
-var fileUriRegex = /^file:\/\/\/[a-zA-Z]:\//;
-function parseUrl(sourceUrl) {
- var parsedUrl = url.parse(sourceUrl);
- if (parsedUrl.protocol === 'file:' || parsedUrl.host) {
- return parsedUrl;
- }
- if (/^[a-z]:[/\\]/i.test(sourceUrl)) {
- return url.parse('file:///' + sourceUrl);
- }
- if (!parsedUrl.host) {
- parsedUrl.protocol = 'file:';
- }
- return parsedUrl;
-}
-
-var PDFNodeStream = function () {
- function PDFNodeStream(source) {
- _classCallCheck(this, PDFNodeStream);
-
- this.source = source;
- this.url = parseUrl(source.url);
- 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._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;
- }
- }, {
- key: 'getRangeReader',
- value: function getRangeReader(start, end) {
- var rangeReader = this.isFsUrl ? new PDFNodeStreamFsRangeReader(this, start, end) : new PDFNodeStreamRangeReader(this, start, end);
- this._rangeRequestReaders.push(rangeReader);
- return rangeReader;
- }
- }, {
- key: 'cancelAllRequests',
- value: function cancelAllRequests(reason) {
- if (this._fullRequest) {
- this._fullRequest.cancel(reason);
- }
- var readers = this._rangeRequestReaders.slice(0);
- readers.forEach(function (reader) {
- reader.cancel(reason);
- });
- }
- }]);
-
- return PDFNodeStream;
-}();
-
-var BaseFullReader = function () {
- function BaseFullReader(stream) {
- _classCallCheck(this, BaseFullReader);
-
- this._url = stream.url;
- this._done = false;
- this._storedError = null;
- this.onProgress = null;
- var source = stream.source;
- this._contentLength = source.length;
- this._loaded = 0;
- this._filename = null;
- this._disableRange = source.disableRange || false;
- this._rangeChunkSize = source.rangeChunkSize;
- if (!this._rangeChunkSize && !this._disableRange) {
- this._disableRange = true;
- }
- this._isStreamingSupported = !source.disableStream;
- this._isRangeSupported = !source.disableRange;
- this._readableStream = null;
- this._readCapability = (0, _util.createPromiseCapability)();
- this._headersCapability = (0, _util.createPromiseCapability)();
- }
-
- _createClass(BaseFullReader, [{
- key: 'read',
- value: function () {
- var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
- var chunk, buffer;
- return _regenerator2.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- _context.next = 2;
- return this._readCapability.promise;
-
- case 2:
- if (!this._done) {
- _context.next = 4;
- break;
- }
-
- return _context.abrupt('return', {
- value: undefined,
- done: true
- });
-
- case 4:
- if (!this._storedError) {
- _context.next = 6;
- break;
- }
-
- throw this._storedError;
-
- case 6:
- chunk = this._readableStream.read();
-
- if (!(chunk === null)) {
- _context.next = 10;
- break;
- }
-
- this._readCapability = (0, _util.createPromiseCapability)();
- return _context.abrupt('return', this.read());
-
- case 10:
- this._loaded += chunk.length;
- if (this.onProgress) {
- this.onProgress({
- loaded: this._loaded,
- total: this._contentLength
- });
- }
- buffer = new Uint8Array(chunk).buffer;
- return _context.abrupt('return', {
- value: buffer,
- done: false
- });
-
- case 14:
- case 'end':
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
-
- function read() {
- return _ref.apply(this, arguments);
- }
-
- return read;
- }()
- }, {
- key: 'cancel',
- value: function cancel(reason) {
- if (!this._readableStream) {
- this._error(reason);
- return;
- }
- this._readableStream.destroy(reason);
- }
- }, {
- key: '_error',
- value: function _error(reason) {
- this._storedError = reason;
- this._readCapability.resolve();
- }
- }, {
- key: '_setReadableStream',
- value: function _setReadableStream(readableStream) {
- var _this = this;
-
- this._readableStream = readableStream;
- readableStream.on('readable', function () {
- _this._readCapability.resolve();
- });
- readableStream.on('end', function () {
- readableStream.destroy();
- _this._done = true;
- _this._readCapability.resolve();
- });
- readableStream.on('error', function (reason) {
- _this._error(reason);
- });
- if (!this._isStreamingSupported && this._isRangeSupported) {
- this._error(new _util.AbortException('streaming is disabled'));
- }
- if (this._storedError) {
- this._readableStream.destroy(this._storedError);
- }
- }
- }, {
- key: 'headersReady',
- get: function get() {
- return this._headersCapability.promise;
- }
- }, {
- key: 'filename',
- get: function get() {
- return this._filename;
- }
- }, {
- key: 'contentLength',
- get: function get() {
- return this._contentLength;
- }
- }, {
- key: 'isRangeSupported',
- get: function get() {
- return this._isRangeSupported;
- }
- }, {
- key: 'isStreamingSupported',
- get: function get() {
- return this._isStreamingSupported;
- }
- }]);
-
- return BaseFullReader;
-}();
-
-var BaseRangeReader = function () {
- function BaseRangeReader(stream) {
- _classCallCheck(this, BaseRangeReader);
-
- this._url = stream.url;
- this._done = false;
- this._storedError = null;
- this.onProgress = null;
- this._loaded = 0;
- this._readableStream = null;
- this._readCapability = (0, _util.createPromiseCapability)();
- var source = stream.source;
- this._isStreamingSupported = !source.disableStream;
- }
-
- _createClass(BaseRangeReader, [{
- key: 'read',
- value: function () {
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2() {
- var chunk, buffer;
- return _regenerator2.default.wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- _context2.next = 2;
- return this._readCapability.promise;
-
- case 2:
- if (!this._done) {
- _context2.next = 4;
- break;
- }
-
- return _context2.abrupt('return', {
- value: undefined,
- done: true
- });
-
- case 4:
- if (!this._storedError) {
- _context2.next = 6;
- break;
- }
-
- throw this._storedError;
-
- case 6:
- chunk = this._readableStream.read();
-
- if (!(chunk === null)) {
- _context2.next = 10;
- break;
- }
-
- this._readCapability = (0, _util.createPromiseCapability)();
- return _context2.abrupt('return', this.read());
-
- case 10:
- this._loaded += chunk.length;
- if (this.onProgress) {
- this.onProgress({ loaded: this._loaded });
- }
- buffer = new Uint8Array(chunk).buffer;
- return _context2.abrupt('return', {
- value: buffer,
- done: false
- });
-
- case 14:
- case 'end':
- return _context2.stop();
- }
- }
- }, _callee2, this);
- }));
-
- function read() {
- return _ref2.apply(this, arguments);
- }
-
- return read;
- }()
- }, {
- key: 'cancel',
- value: function cancel(reason) {
- if (!this._readableStream) {
- this._error(reason);
- return;
- }
- this._readableStream.destroy(reason);
- }
- }, {
- key: '_error',
- value: function _error(reason) {
- this._storedError = reason;
- this._readCapability.resolve();
- }
- }, {
- key: '_setReadableStream',
- value: function _setReadableStream(readableStream) {
- var _this2 = this;
-
- this._readableStream = readableStream;
- readableStream.on('readable', function () {
- _this2._readCapability.resolve();
- });
- readableStream.on('end', function () {
- readableStream.destroy();
- _this2._done = true;
- _this2._readCapability.resolve();
- });
- readableStream.on('error', function (reason) {
- _this2._error(reason);
- });
- if (this._storedError) {
- this._readableStream.destroy(this._storedError);
- }
- }
- }, {
- key: 'isStreamingSupported',
- get: function get() {
- return this._isStreamingSupported;
- }
- }]);
-
- return BaseRangeReader;
-}();
-
-function createRequestOptions(url, headers) {
- return {
- protocol: url.protocol,
- auth: url.auth,
- host: url.hostname,
- port: url.port,
- path: url.path,
- method: 'GET',
- headers: headers
- };
-}
-
-var PDFNodeStreamFullReader = function (_BaseFullReader) {
- _inherits(PDFNodeStreamFullReader, _BaseFullReader);
-
- function PDFNodeStreamFullReader(stream) {
- _classCallCheck(this, PDFNodeStreamFullReader);
-
- var _this3 = _possibleConstructorReturn(this, (PDFNodeStreamFullReader.__proto__ || Object.getPrototypeOf(PDFNodeStreamFullReader)).call(this, stream));
-
- var handleResponse = function handleResponse(response) {
- if (response.statusCode === 404) {
- var error = new _util.MissingPDFException('Missing PDF "' + _this3._url + '".');
- _this3._storedError = error;
- _this3._headersCapability.reject(error);
- return;
- }
- _this3._headersCapability.resolve();
- _this3._setReadableStream(response);
- var getResponseHeader = function getResponseHeader(name) {
- return _this3._readableStream.headers[name.toLowerCase()];
- };
-
- var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
- getResponseHeader: getResponseHeader,
- isHttp: stream.isHttp,
- rangeChunkSize: _this3._rangeChunkSize,
- disableRange: _this3._disableRange
- }),
- allowRangeRequests = _validateRangeRequest.allowRangeRequests,
- suggestedLength = _validateRangeRequest.suggestedLength;
-
- _this3._isRangeSupported = allowRangeRequests;
- _this3._contentLength = suggestedLength || _this3._contentLength;
- _this3._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
- };
- _this3._request = null;
- if (_this3._url.protocol === 'http:') {
- _this3._request = http.request(createRequestOptions(_this3._url, stream.httpHeaders), handleResponse);
- } else {
- _this3._request = https.request(createRequestOptions(_this3._url, stream.httpHeaders), handleResponse);
- }
- _this3._request.on('error', function (reason) {
- _this3._storedError = reason;
- _this3._headersCapability.reject(reason);
- });
- _this3._request.end();
- return _this3;
- }
-
- return PDFNodeStreamFullReader;
-}(BaseFullReader);
-
-var PDFNodeStreamRangeReader = function (_BaseRangeReader) {
- _inherits(PDFNodeStreamRangeReader, _BaseRangeReader);
-
- function PDFNodeStreamRangeReader(stream, start, end) {
- _classCallCheck(this, PDFNodeStreamRangeReader);
-
- var _this4 = _possibleConstructorReturn(this, (PDFNodeStreamRangeReader.__proto__ || Object.getPrototypeOf(PDFNodeStreamRangeReader)).call(this, stream));
-
- _this4._httpHeaders = {};
- for (var property in stream.httpHeaders) {
- var value = stream.httpHeaders[property];
- if (typeof value === 'undefined') {
- continue;
- }
- _this4._httpHeaders[property] = value;
- }
- _this4._httpHeaders['Range'] = 'bytes=' + start + '-' + (end - 1);
- var handleResponse = function handleResponse(response) {
- if (response.statusCode === 404) {
- var error = new _util.MissingPDFException('Missing PDF "' + _this4._url + '".');
- _this4._storedError = error;
- return;
- }
- _this4._setReadableStream(response);
- };
- _this4._request = null;
- if (_this4._url.protocol === 'http:') {
- _this4._request = http.request(createRequestOptions(_this4._url, _this4._httpHeaders), handleResponse);
- } else {
- _this4._request = https.request(createRequestOptions(_this4._url, _this4._httpHeaders), handleResponse);
- }
- _this4._request.on('error', function (reason) {
- _this4._storedError = reason;
- });
- _this4._request.end();
- return _this4;
- }
-
- return PDFNodeStreamRangeReader;
-}(BaseRangeReader);
-
-var PDFNodeStreamFsFullReader = function (_BaseFullReader2) {
- _inherits(PDFNodeStreamFsFullReader, _BaseFullReader2);
-
- function PDFNodeStreamFsFullReader(stream) {
- _classCallCheck(this, PDFNodeStreamFsFullReader);
-
- var _this5 = _possibleConstructorReturn(this, (PDFNodeStreamFsFullReader.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsFullReader)).call(this, stream));
-
- var path = decodeURIComponent(_this5._url.path);
- if (fileUriRegex.test(_this5._url.href)) {
- path = path.replace(/^\//, '');
- }
- fs.lstat(path, function (error, stat) {
- if (error) {
- if (error.code === 'ENOENT') {
- error = new _util.MissingPDFException('Missing PDF "' + path + '".');
- }
- _this5._storedError = error;
- _this5._headersCapability.reject(error);
- return;
- }
- _this5._contentLength = stat.size;
- _this5._setReadableStream(fs.createReadStream(path));
- _this5._headersCapability.resolve();
- });
- return _this5;
- }
-
- return PDFNodeStreamFsFullReader;
-}(BaseFullReader);
-
-var PDFNodeStreamFsRangeReader = function (_BaseRangeReader2) {
- _inherits(PDFNodeStreamFsRangeReader, _BaseRangeReader2);
-
- function PDFNodeStreamFsRangeReader(stream, start, end) {
- _classCallCheck(this, PDFNodeStreamFsRangeReader);
-
- var _this6 = _possibleConstructorReturn(this, (PDFNodeStreamFsRangeReader.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsRangeReader)).call(this, stream));
-
- var path = decodeURIComponent(_this6._url.path);
- if (fileUriRegex.test(_this6._url.href)) {
- path = path.replace(/^\//, '');
- }
- _this6._setReadableStream(fs.createReadStream(path, {
- start: start,
- end: end - 1
- }));
- return _this6;
- }
-
- return PDFNodeStreamFsRangeReader;
-}(BaseRangeReader);
-
-exports.PDFNodeStream = PDFNodeStream;
-
-/***/ }),
-/* 149 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.validateResponseStatus = exports.validateRangeRequestCapabilities = exports.extractFilenameFromHeader = exports.createResponseStatusError = undefined;
-
-var _util = __w_pdfjs_require__(1);
-
-var _content_disposition = __w_pdfjs_require__(150);
-
-function validateRangeRequestCapabilities(_ref) {
- var getResponseHeader = _ref.getResponseHeader,
- isHttp = _ref.isHttp,
- rangeChunkSize = _ref.rangeChunkSize,
- disableRange = _ref.disableRange;
-
- (0, _util.assert)(rangeChunkSize > 0, 'Range chunk size must be larger than zero');
- var returnValues = {
- allowRangeRequests: false,
- suggestedLength: undefined
- };
- var length = parseInt(getResponseHeader('Content-Length'), 10);
- if (!Number.isInteger(length)) {
- return returnValues;
- }
- returnValues.suggestedLength = length;
- if (length <= 2 * rangeChunkSize) {
- return returnValues;
- }
- if (disableRange || !isHttp) {
- return returnValues;
- }
- if (getResponseHeader('Accept-Ranges') !== 'bytes') {
- return returnValues;
- }
- var contentEncoding = getResponseHeader('Content-Encoding') || 'identity';
- if (contentEncoding !== 'identity') {
- return returnValues;
- }
- returnValues.allowRangeRequests = true;
- return returnValues;
-}
-function extractFilenameFromHeader(getResponseHeader) {
- var contentDisposition = getResponseHeader('Content-Disposition');
- if (contentDisposition) {
- var filename = (0, _content_disposition.getFilenameFromContentDispositionHeader)(contentDisposition);
- if (/\.pdf$/i.test(filename)) {
- return filename;
- }
- }
- return null;
-}
-function createResponseStatusError(status, url) {
- if (status === 404 || status === 0 && /^file:/.test(url)) {
- return new _util.MissingPDFException('Missing PDF "' + url + '".');
- }
- return new _util.UnexpectedResponseException('Unexpected server response (' + status + ') while retrieving PDF "' + url + '".', status);
-}
-function validateResponseStatus(status) {
- return status === 200 || status === 206;
-}
-exports.createResponseStatusError = createResponseStatusError;
-exports.extractFilenameFromHeader = extractFilenameFromHeader;
-exports.validateRangeRequestCapabilities = validateRangeRequestCapabilities;
-exports.validateResponseStatus = validateResponseStatus;
-
-/***/ }),
-/* 150 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _slicedToArray = function () { function sliceIterator(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"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
-
-function getFilenameFromContentDispositionHeader(contentDisposition) {
- var needsEncodingFixup = true;
- var tmp = toParamRegExp('filename\\*', 'i').exec(contentDisposition);
- if (tmp) {
- tmp = tmp[1];
- var filename = rfc2616unquote(tmp);
- filename = unescape(filename);
- filename = rfc5987decode(filename);
- filename = rfc2047decode(filename);
- return fixupEncoding(filename);
- }
- tmp = rfc2231getparam(contentDisposition);
- if (tmp) {
- var _filename = rfc2047decode(tmp);
- return fixupEncoding(_filename);
- }
- tmp = toParamRegExp('filename', 'i').exec(contentDisposition);
- if (tmp) {
- tmp = tmp[1];
- var _filename2 = rfc2616unquote(tmp);
- _filename2 = rfc2047decode(_filename2);
- return fixupEncoding(_filename2);
- }
- function toParamRegExp(attributePattern, flags) {
- return new RegExp('(?:^|;)\\s*' + attributePattern + '\\s*=\\s*' + '(' + '[^";\\s][^;\\s]*' + '|' + '"(?:[^"\\\\]|\\\\"?)+"?' + ')', flags);
- }
- function textdecode(encoding, value) {
- if (encoding) {
- if (!/^[\x00-\xFF]+$/.test(value)) {
- return value;
- }
- try {
- var decoder = new TextDecoder(encoding, { fatal: true });
- var bytes = new Array(value.length);
- for (var i = 0; i < value.length; ++i) {
- bytes[i] = value.charCodeAt(i);
- }
- value = decoder.decode(new Uint8Array(bytes));
- needsEncodingFixup = false;
- } catch (e) {
- if (/^utf-?8$/i.test(encoding)) {
- try {
- value = decodeURIComponent(escape(value));
- needsEncodingFixup = false;
- } catch (err) {}
- }
- }
- }
- return value;
- }
- function fixupEncoding(value) {
- if (needsEncodingFixup && /[\x80-\xff]/.test(value)) {
- value = textdecode('utf-8', value);
- if (needsEncodingFixup) {
- value = textdecode('iso-8859-1', value);
- }
- }
- return value;
- }
- function rfc2231getparam(contentDisposition) {
- var matches = [],
- match = void 0;
- var iter = toParamRegExp('filename\\*((?!0\\d)\\d+)(\\*?)', 'ig');
- while ((match = iter.exec(contentDisposition)) !== null) {
- var _match = match,
- _match2 = _slicedToArray(_match, 4),
- n = _match2[1],
- quot = _match2[2],
- part = _match2[3];
-
- n = parseInt(n, 10);
- if (n in matches) {
- if (n === 0) {
- break;
- }
- continue;
- }
- matches[n] = [quot, part];
- }
- var parts = [];
- for (var _n = 0; _n < matches.length; ++_n) {
- if (!(_n in matches)) {
- break;
- }
-
- var _matches$_n = _slicedToArray(matches[_n], 2),
- _quot = _matches$_n[0],
- _part = _matches$_n[1];
-
- _part = rfc2616unquote(_part);
- if (_quot) {
- _part = unescape(_part);
- if (_n === 0) {
- _part = rfc5987decode(_part);
- }
- }
- parts.push(_part);
- }
- return parts.join('');
- }
- function rfc2616unquote(value) {
- if (value.charAt(0) === '"') {
- var parts = value.slice(1).split('\\"');
- for (var i = 0; i < parts.length; ++i) {
- var quotindex = parts[i].indexOf('"');
- if (quotindex !== -1) {
- parts[i] = parts[i].slice(0, quotindex);
- parts.length = i + 1;
- }
- parts[i] = parts[i].replace(/\\(.)/g, '$1');
- }
- value = parts.join('"');
- }
- return value;
- }
- function rfc5987decode(extvalue) {
- var encodingend = extvalue.indexOf('\'');
- if (encodingend === -1) {
- return extvalue;
- }
- var encoding = extvalue.slice(0, encodingend);
- var langvalue = extvalue.slice(encodingend + 1);
- var value = langvalue.replace(/^[^']*'/, '');
- return textdecode(encoding, value);
- }
- function rfc2047decode(value) {
- if (value.slice(0, 2) !== '=?' || /[\x00-\x19\x80-\xff]/.test(value)) {
- return value;
- }
- return value.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function (_, charset, encoding, text) {
- if (encoding === 'q' || encoding === 'Q') {
- text = text.replace(/_/g, ' ');
- text = text.replace(/=([0-9a-fA-F]{2})/g, function (_, hex) {
- return String.fromCharCode(parseInt(hex, 16));
- });
- return textdecode(charset, text);
- }
- try {
- text = atob(text);
- } catch (e) {}
- return textdecode(charset, text);
- });
- }
- return '';
-}
-exports.getFilenameFromContentDispositionHeader = getFilenameFromContentDispositionHeader;
-
-/***/ }),
-/* 151 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.PDFFetchStream = undefined;
-
-var _regenerator = __w_pdfjs_require__(137);
-
-var _regenerator2 = _interopRequireDefault(_regenerator);
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _util = __w_pdfjs_require__(1);
-
-var _network_utils = __w_pdfjs_require__(149);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-function createFetchOptions(headers, withCredentials, abortController) {
- return {
- method: 'GET',
- headers: headers,
- signal: abortController && abortController.signal,
- mode: 'cors',
- credentials: withCredentials ? 'include' : 'same-origin',
- redirect: 'follow'
- };
-}
-
-var PDFFetchStream = function () {
- function PDFFetchStream(source) {
- _classCallCheck(this, PDFFetchStream);
-
- this.source = source;
- this.isHttp = /^https?:/i.test(source.url);
- this.httpHeaders = this.isHttp && source.httpHeaders || {};
- this._fullRequestReader = null;
- this._rangeRequestReaders = [];
- }
-
- _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) {
- var reader = new PDFFetchStreamRangeReader(this, begin, end);
- 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 PDFFetchStream;
-}();
-
-var PDFFetchStreamReader = function () {
- function PDFFetchStreamReader(stream) {
- var _this = this;
-
- _classCallCheck(this, PDFFetchStreamReader);
-
- 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._disableRange = source.disableRange || false;
- 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._reader = response.body.getReader();
- _this._headersCapability.resolve();
- var getResponseHeader = function getResponseHeader(name) {
- return response.headers.get(name);
- };
-
- var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
- getResponseHeader: getResponseHeader,
- isHttp: _this._stream.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 (!_this._isStreamingSupported && _this._isRangeSupported) {
- _this.cancel(new _util.AbortException('streaming is disabled'));
- }
- }).catch(this._headersCapability.reject);
- this.onProgress = null;
- }
-
- _createClass(PDFFetchStreamReader, [{
- key: 'read',
- value: function () {
- var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
- var _ref2, value, done, buffer;
-
- return _regenerator2.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();
-
- case 4:
- _ref2 = _context.sent;
- value = _ref2.value;
- done = _ref2.done;
-
- if (!done) {
- _context.next = 9;
- break;
- }
-
- return _context.abrupt('return', {
- value: value,
- done: done
- });
-
- case 9:
- this._loaded += value.byteLength;
- if (this.onProgress) {
- this.onProgress({
- loaded: this._loaded,
- total: this._contentLength
- });
- }
- buffer = new Uint8Array(value).buffer;
- return _context.abrupt('return', {
- value: buffer,
- done: false
- });
-
- case 13:
- case 'end':
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
-
- function read() {
- return _ref.apply(this, arguments);
- }
-
- return read;
- }()
- }, {
- key: 'cancel',
- value: function cancel(reason) {
- if (this._reader) {
- this._reader.cancel(reason);
- }
- if (this._abortController) {
- this._abortController.abort();
- }
- }
- }, {
- key: 'headersReady',
- get: function get() {
- return this._headersCapability.promise;
- }
- }, {
- key: 'filename',
- get: function get() {
- return this._filename;
- }
- }, {
- key: 'contentLength',
- get: function get() {
- return this._contentLength;
- }
- }, {
- key: 'isRangeSupported',
- get: function get() {
- return this._isRangeSupported;
- }
- }, {
- key: 'isStreamingSupported',
- get: function get() {
- return this._isStreamingSupported;
- }
- }]);
-
- return PDFFetchStreamReader;
-}();
-
-var PDFFetchStreamRangeReader = function () {
- function PDFFetchStreamRangeReader(stream, begin, end) {
- var _this2 = this;
-
- _classCallCheck(this, PDFFetchStreamRangeReader);
-
- 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;
- if (typeof AbortController !== 'undefined') {
- this._abortController = new AbortController();
- }
- 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 rangeStr = begin + '-' + (end - 1);
- this._headers.append('Range', 'bytes=' + rangeStr);
- 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);
- }
- _this2._readCapability.resolve();
- _this2._reader = response.body.getReader();
- });
- this.onProgress = null;
- }
-
- _createClass(PDFFetchStreamRangeReader, [{
- key: 'read',
- value: function () {
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2() {
- var _ref4, value, done, buffer;
-
- return _regenerator2.default.wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- _context2.next = 2;
- return this._readCapability.promise;
-
- case 2:
- _context2.next = 4;
- return this._reader.read();
-
- case 4:
- _ref4 = _context2.sent;
- value = _ref4.value;
- done = _ref4.done;
-
- if (!done) {
- _context2.next = 9;
- break;
- }
-
- return _context2.abrupt('return', {
- value: value,
- done: done
- });
-
- case 9:
- this._loaded += value.byteLength;
- if (this.onProgress) {
- this.onProgress({ loaded: this._loaded });
- }
- buffer = new Uint8Array(value).buffer;
- return _context2.abrupt('return', {
- value: buffer,
- done: false
- });
-
- case 13:
- case 'end':
- return _context2.stop();
- }
- }
- }, _callee2, this);
- }));
-
- function read() {
- return _ref3.apply(this, arguments);
- }
-
- return read;
- }()
- }, {
- key: 'cancel',
- value: function cancel(reason) {
- if (this._reader) {
- this._reader.cancel(reason);
- }
- if (this._abortController) {
- this._abortController.abort();
- }
- }
- }, {
- key: 'isStreamingSupported',
- get: function get() {
- return this._isStreamingSupported;
- }
- }]);
-
- return PDFFetchStreamRangeReader;
-}();
-
-exports.PDFFetchStream = PDFFetchStream;
-
-/***/ }),
-/* 152 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.NetworkManager = exports.PDFNetworkStream = undefined;
-
-var _regenerator = __w_pdfjs_require__(137);
-
-var _regenerator2 = _interopRequireDefault(_regenerator);
-
-var _util = __w_pdfjs_require__(1);
-
-var _network_utils = __w_pdfjs_require__(149);
-
-var _global_scope = __w_pdfjs_require__(3);
-
-var _global_scope2 = _interopRequireDefault(_global_scope);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
-
-;
-var OK_RESPONSE = 200;
-var PARTIAL_CONTENT_RESPONSE = 206;
-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;
- this.getXhr = args.getXhr || function NetworkManager_getXhr() {
- return new XMLHttpRequest();
- };
- this.currXhrId = 0;
- this.pendingRequests = Object.create(null);
- this.loadedRequests = Object.create(null);
-}
-function getArrayBuffer(xhr) {
- var data = xhr.response;
- if (typeof data !== 'string') {
- return data;
- }
- var array = (0, _util.stringToBytes)(data);
- return array.buffer;
-}
-var supportsMozChunked = function supportsMozChunkedClosure() {
- try {
- var x = new XMLHttpRequest();
- x.open('GET', _global_scope2.default.location.href);
- x.responseType = 'moz-chunked-arraybuffer';
- return x.responseType === 'moz-chunked-arraybuffer';
- } catch (e) {
- return false;
- }
-}();
-NetworkManager.prototype = {
- requestRange: function NetworkManager_requestRange(begin, end, listeners) {
- var args = {
- begin: begin,
- end: end
- };
- for (var prop in listeners) {
- args[prop] = listeners[prop];
- }
- 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];
- 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;
- }
- var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData;
- if (useMozChunkedLoading) {
- xhr.responseType = 'moz-chunked-arraybuffer';
- pendingRequest.onProgressiveData = args.onProgressiveData;
- pendingRequest.mozChunked = true;
- } else {
- 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;
- },
- onProgress: function NetworkManager_onProgress(xhrId, evt) {
- var pendingRequest = this.pendingRequests[xhrId];
- if (!pendingRequest) {
- return;
- }
- if (pendingRequest.mozChunked) {
- var chunk = getArrayBuffer(pendingRequest.xhr);
- pendingRequest.onProgressiveData(chunk);
- }
- var onProgress = pendingRequest.onProgress;
- if (onProgress) {
- onProgress(evt);
- }
- },
- onStateChange: function NetworkManager_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;
- }
- this.loadedRequests[xhrId] = true;
- var chunk = getArrayBuffer(xhr);
- 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;
- }
- 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();
- }
-};
-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 = [];
-}
-PDFNetworkStream.prototype = {
- _onRangeRequestReaderClosed: function PDFNetworkStream_onRangeRequestReaderClosed(reader) {
- var i = this._rangeRequestReaders.indexOf(reader);
- 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);
- this._rangeRequestReaders.push(reader);
- return reader;
- },
- cancelAllRequests: function PDFNetworkStream_cancelAllRequests(reason) {
- if (this._fullRequestReader) {
- this._fullRequestReader.cancel(reason);
- }
- var readers = this._rangeRequestReaders.slice(0);
- readers.forEach(function (reader) {
- reader.cancel(reason);
- });
- }
-};
-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;
-}
-PDFNetworkStreamFullRequestReader.prototype = {
- _onHeadersReceived: function PDFNetworkStreamFullRequestReader_onHeadersReceived() {
- var fullRequestXhrId = this._fullRequestId;
- var fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId);
- var getResponseHeader = function getResponseHeader(name) {
- return fullRequestXhr.getResponseHeader(name);
- };
-
- var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
- getResponseHeader: getResponseHeader,
- isHttp: this._manager.isHttp,
- rangeChunkSize: this._rangeChunkSize,
- disableRange: this._disableRange
- }),
- allowRangeRequests = _validateRangeRequest.allowRangeRequests,
- suggestedLength = _validateRangeRequest.suggestedLength;
-
- if (allowRangeRequests) {
- this._isRangeSupported = true;
- }
- 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);
- }
- 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);
- }
- },
- _onDone: function PDFNetworkStreamFullRequestReader_onDone(args) {
- if (args) {
- this._onProgressiveData(args.chunk);
- }
- this._done = true;
- if (this._cachedChunks.length > 0) {
- return;
- }
- 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
- });
- }
- },
- 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 _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
- var chunk, requestCapability;
- return _regenerator2.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)();
-
- this._requests.push(requestCapability);
- return _context.abrupt('return', requestCapability.promise);
-
- case 10:
- case 'end':
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
-
- function read() {
- return _ref.apply(this, arguments);
- }
-
- 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._fullRequestReader = null;
- }
-};
-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;
-}
-PDFNetworkStreamRangeRequestReader.prototype = {
- _close: function PDFNetworkStreamRangeRequestReader_close() {
- if (this.onClosed) {
- this.onClosed(this);
- }
- },
- _onDone: function PDFNetworkStreamRangeRequestReader_onDone(data) {
- var chunk = data.chunk;
- if (this._requests.length > 0) {
- var requestCapability = this._requests.shift();
- requestCapability.resolve({
- value: chunk,
- done: false
- });
- } else {
- this._queuedChunk = chunk;
- }
- this._done = true;
- this._requests.forEach(function (requestCapability) {
- requestCapability.resolve({
- value: undefined,
- done: true
- });
- });
- this._requests = [];
- this._close();
- },
- _onProgress: function PDFNetworkStreamRangeRequestReader_onProgress(evt) {
- if (!this.isStreamingSupported && this.onProgress) {
- this.onProgress({ loaded: evt.loaded });
- }
- },
- get isStreamingSupported() {
- return false;
- },
- read: function () {
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2() {
- var chunk, requestCapability;
- return _regenerator2.default.wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- if (!(this._queuedChunk !== null)) {
- _context2.next = 4;
- break;
- }
-
- chunk = this._queuedChunk;
-
- this._queuedChunk = null;
- return _context2.abrupt('return', {
- value: chunk,
- done: false
- });
-
- case 4:
- if (!this._done) {
- _context2.next = 6;
- break;
- }
-
- return _context2.abrupt('return', {
- value: undefined,
- done: true
- });
-
- case 6:
- requestCapability = (0, _util.createPromiseCapability)();
-
- this._requests.push(requestCapability);
- return _context2.abrupt('return', requestCapability.promise);
-
- case 9:
- case 'end':
- return _context2.stop();
- }
- }
- }, _callee2, this);
- }));
-
- function read() {
- return _ref2.apply(this, arguments);
- }
-
- return read;
- }(),
-
- cancel: function PDFNetworkStreamRangeRequestReader_cancel(reason) {
- this._done = true;
- 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();
- }
-};
-exports.PDFNetworkStream = PDFNetworkStream;
-exports.NetworkManager = NetworkManager;
-
-/***/ })
-/******/ ]);
-});
-//# sourceMappingURL=pdf.js.map \ No newline at end of file
diff --git a/vendor/assets/javascripts/pdf.min.js b/vendor/assets/javascripts/pdf.min.js
deleted file mode 100644
index 43ab356bfec..00000000000
--- a/vendor/assets/javascripts/pdf.min.js
+++ /dev/null
@@ -1 +0,0 @@
-!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("pdfjs-dist/build/pdf",[],t):"object"==typeof exports?exports["pdfjs-dist/build/pdf"]=t():e["pdfjs-dist/build/pdf"]=e.pdfjsLib=t()}(this,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";var n=r(1),i=r(129),a=r(145),o=r(146),s=r(130),u=r(147),l=r(135),c=r(132);if(r(4)()){var h=r(148).PDFNodeStream;i.setPDFNetworkStreamFactory(function(e){return new h(e)})}else if("undefined"!=typeof Response&&"body"in Response.prototype&&"undefined"!=typeof ReadableStream){var d=r(151).PDFFetchStream;i.setPDFNetworkStreamFactory(function(e){return new d(e)})}else{var f=r(152).PDFNetworkStream;i.setPDFNetworkStreamFactory(function(e){return new f(e)})}t.build=i.build,t.version=i.version,t.getDocument=i.getDocument,t.LoopbackPort=i.LoopbackPort,t.PDFDataRangeTransport=i.PDFDataRangeTransport,t.PDFWorker=i.PDFWorker,t.renderTextLayer=a.renderTextLayer,t.AnnotationLayer=o.AnnotationLayer,t.createPromiseCapability=n.createPromiseCapability,t.PasswordResponses=n.PasswordResponses,t.InvalidPDFException=n.InvalidPDFException,t.MissingPDFException=n.MissingPDFException,t.SVGGraphics=u.SVGGraphics,t.NativeImageDecoding=n.NativeImageDecoding,t.CMapCompressionType=n.CMapCompressionType,t.PermissionFlag=n.PermissionFlag,t.UnexpectedResponseException=n.UnexpectedResponseException,t.OPS=n.OPS,t.VerbosityLevel=n.VerbosityLevel,t.UNSUPPORTED_FEATURES=n.UNSUPPORTED_FEATURES,t.createValidAbsoluteUrl=n.createValidAbsoluteUrl,t.createObjectURL=n.createObjectURL,t.removeNullCharacters=n.removeNullCharacters,t.shadow=n.shadow,t.Util=n.Util,t.ReadableStream=n.ReadableStream,t.URL=n.URL,t.RenderingCancelledException=s.RenderingCancelledException,t.getFilenameFromUrl=s.getFilenameFromUrl,t.LinkTarget=s.LinkTarget,t.addLinkAttributes=s.addLinkAttributes,t.loadScript=s.loadScript,t.GlobalWorkerOptions=l.GlobalWorkerOptions,t.apiCompatibilityParams=c.apiCompatibilityParams},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unreachable=t.warn=t.utf8StringToString=t.stringToUTF8String=t.stringToPDFString=t.stringToBytes=t.string32=t.shadow=t.setVerbosityLevel=t.URL=t.ReadableStream=t.removeNullCharacters=t.readUint32=t.readUint16=t.readInt8=t.log2=t.isEvalSupported=t.isLittleEndian=t.createValidAbsoluteUrl=t.isSameOrigin=t.isSpace=t.isString=t.isNum=t.isEmptyObj=t.isBool=t.isArrayBuffer=t.info=t.getVerbosityLevel=t.getLookupTableFactory=t.getInheritableProperty=t.deprecated=t.createObjectURL=t.createPromiseCapability=t.bytesToString=t.assert=t.arraysToBytes=t.arrayByteLength=t.FormatError=t.XRefParseException=t.toRomanNumerals=t.Util=t.UnknownErrorException=t.UnexpectedResponseException=t.TextRenderingMode=t.StreamType=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.NativeImageDecoding=t.MissingPDFException=t.MissingDataException=t.InvalidPDFException=t.AbortException=t.CMapCompressionType=t.ImageKind=t.FontType=t.AnnotationType=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationBorderStyleType=t.UNSUPPORTED_FEATURES=t.VerbosityLevel=t.OPS=t.IDENTITY_MATRIX=t.FONT_IDENTITY_MATRIX=void 0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r(2);var i=r(125),a=r(127),o={ERRORS:0,WARNINGS:1,INFOS:5},s=o.WARNINGS;function u(e){s>=o.WARNINGS&&console.log("Warning: "+e)}function l(e){throw new Error(e)}function c(e,t){e||l(t)}var h=function(){function e(e,t){this.name="PasswordException",this.message=e,this.code=t}return e.prototype=new Error,e.constructor=e,e}(),d=function(){function e(e,t){this.name="UnknownErrorException",this.message=e,this.details=t}return e.prototype=new Error,e.constructor=e,e}(),f=function(){function e(e){this.name="InvalidPDFException",this.message=e}return e.prototype=new Error,e.constructor=e,e}(),p=function(){function e(e){this.name="MissingPDFException",this.message=e}return e.prototype=new Error,e.constructor=e,e}(),v=function(){function e(e,t){this.name="UnexpectedResponseException",this.message=e,this.status=t}return e.prototype=new Error,e.constructor=e,e}(),m=function(){function e(e,t){this.begin=e,this.end=t,this.message="Missing data ["+e+", "+t+")"}return e.prototype=new Error,e.prototype.name="MissingDataException",e.constructor=e,e}(),g=function(){function e(e){this.message=e}return e.prototype=new Error,e.prototype.name="XRefParseException",e.constructor=e,e}(),y=function(){function e(e){this.message=e}return e.prototype=new Error,e.prototype.name="FormatError",e.constructor=e,e}(),b=function(){function e(e){this.name="AbortException",this.message=e}return e.prototype=new Error,e.constructor=e,e}(),_=/\x00/g;function A(e){c("string"==typeof e,"Invalid argument for stringToBytes");for(var t=e.length,r=new Uint8Array(t),n=0;n<t;++n)r[n]=255&e.charCodeAt(n);return r}function S(e){return void 0!==e.length?e.length:(c(void 0!==e.byteLength),e.byteLength)}var w=function(){function e(){}var t=["rgb(",0,",",0,",",0,")"];return e.makeCssRgb=function(e,r,n){return t[1]=e,t[3]=r,t[5]=n,t.join("")},e.transform=function(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]},e.applyTransform=function(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]},e.applyInverseTransform=function(e,t){var r=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/r,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/r]},e.getAxialAlignedBoundingBox=function(t,r){var n=e.applyTransform(t,r),i=e.applyTransform(t.slice(2,4),r),a=e.applyTransform([t[0],t[3]],r),o=e.applyTransform([t[2],t[1]],r);return[Math.min(n[0],i[0],a[0],o[0]),Math.min(n[1],i[1],a[1],o[1]),Math.max(n[0],i[0],a[0],o[0]),Math.max(n[1],i[1],a[1],o[1])]},e.inverseTransform=function(e){var t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]},e.apply3dTransform=function(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2],e[3]*t[0]+e[4]*t[1]+e[5]*t[2],e[6]*t[0]+e[7]*t[1]+e[8]*t[2]]},e.singularValueDecompose2dScale=function(e){var t=[e[0],e[2],e[1],e[3]],r=e[0]*t[0]+e[1]*t[2],n=e[0]*t[1]+e[1]*t[3],i=e[2]*t[0]+e[3]*t[2],a=e[2]*t[1]+e[3]*t[3],o=(r+a)/2,s=Math.sqrt((r+a)*(r+a)-4*(r*a-i*n))/2,u=o+s||1,l=o-s||1;return[Math.sqrt(u),Math.sqrt(l)]},e.normalizeRect=function(e){var t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t},e.intersect=function(t,r){function n(e,t){return e-t}var i=[t[0],t[2],r[0],r[2]].sort(n),a=[t[1],t[3],r[1],r[3]].sort(n),o=[];return t=e.normalizeRect(t),r=e.normalizeRect(r),(i[0]===t[0]&&i[1]===r[0]||i[0]===r[0]&&i[1]===t[0])&&(o[0]=i[1],o[2]=i[2],(a[0]===t[1]&&a[1]===r[1]||a[0]===r[1]&&a[1]===t[1])&&(o[1]=a[1],o[3]=a[2],o))},e}(),k=["","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"];var P=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];var x,C=(x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",function(e,t){if(!(arguments.length>2&&void 0!==arguments[2]&&arguments[2])&&a.URL.createObjectURL){var r=new Blob([e],{type:t});return a.URL.createObjectURL(r)}for(var n="data:"+t+";base64,",i=0,o=e.length;i<o;i+=3){var s=255&e[i],u=255&e[i+1],l=255&e[i+2];n+=x[s>>2]+x[(3&s)<<4|u>>4]+x[i+1<o?(15&u)<<2|l>>6:64]+x[i+2<o?63&l:64]}return n});t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0],t.IDENTITY_MATRIX=[1,0,0,1,0,0],t.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91},t.VerbosityLevel=o,t.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",smask:"smask",shadingPattern:"shadingPattern",font:"font"},t.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},t.AnnotationFieldFlag={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864},t.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512},t.AnnotationType={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},t.FontType={UNKNOWN:0,TYPE1:1,TYPE1C:2,CIDFONTTYPE0:3,CIDFONTTYPE0C:4,TRUETYPE:5,CIDFONTTYPE2:6,TYPE3:7,OPENTYPE:8,TYPE0:9,MMTYPE1:10},t.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},t.CMapCompressionType={NONE:0,BINARY:1,STREAM:2},t.AbortException=b,t.InvalidPDFException=f,t.MissingDataException=m,t.MissingPDFException=p,t.NativeImageDecoding={NONE:"none",DECODE:"decode",DISPLAY:"display"},t.PasswordException=h,t.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},t.PermissionFlag={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},t.StreamType={UNKNOWN:0,FLATE:1,LZW:2,DCT:3,JPX:4,JBIG:5,A85:6,AHX:7,CCF:8,RL:9},t.TextRenderingMode={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},t.UnexpectedResponseException=v,t.UnknownErrorException=d,t.Util=w,t.toRomanNumerals=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];c(Number.isInteger(e)&&e>0,"The number should be a positive integer.");for(var r=void 0,n=[];e>=1e3;)e-=1e3,n.push("M");r=e/100|0,e%=100,n.push(k[r]),r=e/10|0,e%=10,n.push(k[10+r]),n.push(k[20+e]);var i=n.join("");return t?i.toLowerCase():i},t.XRefParseException=g,t.FormatError=y,t.arrayByteLength=S,t.arraysToBytes=function(e){if(1===e.length&&e[0]instanceof Uint8Array)return e[0];var t,r,n,i=0,a=e.length;for(t=0;t<a;t++)i+=n=S(r=e[t]);var o=0,s=new Uint8Array(i);for(t=0;t<a;t++)(r=e[t])instanceof Uint8Array||(r="string"==typeof r?A(r):new Uint8Array(r)),n=r.byteLength,s.set(r,o),o+=n;return s},t.assert=c,t.bytesToString=function(e){c(null!==e&&"object"===(void 0===e?"undefined":n(e))&&void 0!==e.length,"Invalid argument for bytesToString");var t=e.length;if(t<8192)return String.fromCharCode.apply(null,e);for(var r=[],i=0;i<t;i+=8192){var a=Math.min(i+8192,t),o=e.subarray(i,a);r.push(String.fromCharCode.apply(null,o))}return r.join("")},t.createPromiseCapability=function(){var e={};return e.promise=new Promise(function(t,r){e.resolve=t,e.reject=r}),e},t.createObjectURL=C,t.deprecated=function(e){console.log("Deprecated API usage: "+e)},t.getInheritableProperty=function(e){for(var t=e.dict,r=e.key,n=e.getArray,i=void 0!==n&&n,a=e.stopWhenFound,o=void 0===a||a,s=0,l=void 0;t;){var c=i?t.getArray(r):t.get(r);if(void 0!==c){if(o)return c;l||(l=[]),l.push(c)}if(++s>100){u('getInheritableProperty: maximum loop count exceeded for "'+r+'"');break}t=t.get("Parent")}return l},t.getLookupTableFactory=function(e){var t;return function(){return e&&(t=Object.create(null),e(t),e=null),t}},t.getVerbosityLevel=function(){return s},t.info=function(e){s>=o.INFOS&&console.log("Info: "+e)},t.isArrayBuffer=function(e){return"object"===(void 0===e?"undefined":n(e))&&null!==e&&void 0!==e.byteLength},t.isBool=function(e){return"boolean"==typeof e},t.isEmptyObj=function(e){for(var t in e)return!1;return!0},t.isNum=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSpace=function(e){return 32===e||9===e||13===e||10===e},t.isSameOrigin=function(e,t){try{var r=new a.URL(e);if(!r.origin||"null"===r.origin)return!1}catch(e){return!1}var n=new a.URL(t,r);return r.origin===n.origin},t.createValidAbsoluteUrl=function(e,t){if(!e)return null;try{var r=t?new a.URL(e,t):new a.URL(e);if(function(e){if(!e)return!1;switch(e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(r))return r}catch(e){}return null},t.isLittleEndian=function(){var e=new Uint8Array(4);return e[0]=1,1===new Uint32Array(e.buffer,0,1)[0]},t.isEvalSupported=function(){try{return new Function(""),!0}catch(e){return!1}},t.log2=function(e){return e<=0?0:Math.ceil(Math.log2(e))},t.readInt8=function(e,t){return e[t]<<24>>24},t.readUint16=function(e,t){return e[t]<<8|e[t+1]},t.readUint32=function(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0},t.removeNullCharacters=function(e){return"string"!=typeof e?(u("The argument for removeNullCharacters must be a string."),e):e.replace(_,"")},t.ReadableStream=i.ReadableStream,t.URL=a.URL,t.setVerbosityLevel=function(e){Number.isInteger(e)&&(s=e)},t.shadow=function(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!1}),r},t.string32=function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)},t.stringToBytes=A,t.stringToPDFString=function(e){var t,r=e.length,n=[];if("þ"===e[0]&&"ÿ"===e[1])for(t=2;t<r;t+=2)n.push(String.fromCharCode(e.charCodeAt(t)<<8|e.charCodeAt(t+1)));else for(t=0;t<r;++t){var i=P[e.charCodeAt(t)];n.push(i?String.fromCharCode(i):e.charAt(t))}return n.join("")},t.stringToUTF8String=function(e){return decodeURIComponent(escape(e))},t.utf8StringToString=function(e){return unescape(encodeURIComponent(e))},t.warn=u,t.unreachable=l},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(3);if(!i._pdfjsCompatibilityChecked){i._pdfjsCompatibilityChecked=!0;var a=r(4),o="object"===("undefined"==typeof window?"undefined":n(window))&&"object"===("undefined"==typeof document?"undefined":n(document));!i.btoa&&a()&&(i.btoa=function(e){return Buffer.from(e,"binary").toString("base64")}),!i.atob&&a()&&(i.atob=function(e){return Buffer.from(e,"base64").toString("binary")}),o&&("currentScript"in document||Object.defineProperty(document,"currentScript",{get:function(){var e=document.getElementsByTagName("script");return e[e.length-1]},enumerable:!0,configurable:!0})),o&&void 0===Element.prototype.remove&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)}),function(){if(o&&!a()&&!1!==document.createElement("div").classList.toggle("test",0)){var e=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(t){if(arguments.length>1){var r=!!arguments[1];return this[r?"add":"remove"](t),r}return e(t)}}}(),String.prototype.includes||r(5),Array.prototype.includes||r(33),Object.assign||r(42),Math.log2||(Math.log2=r(52)),Number.isNaN||(Number.isNaN=r(54)),Number.isInteger||(Number.isInteger=r(56)),i.Promise||(i.Promise=r(59)),i.WeakMap||(i.WeakMap=r(94)),String.codePointAt||(String.codePointAt=r(111)),String.fromCodePoint||(String.fromCodePoint=r(113)),i.Symbol||r(115),Object.values||(Object.values=r(122))}},function(e,t,r){"use strict";e.exports="undefined"!=typeof window&&window.Math===Math?window:"undefined"!=typeof global&&global.Math===Math?global:"undefined"!=typeof self&&self.Math===Math?self:{}},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};e.exports=function(){return"object"===("undefined"==typeof process?"undefined":n(process))&&process+""=="[object process]"}},function(e,t,r){"use strict";r(6),e.exports=r(9).String.includes},function(e,t,r){"use strict";var n=r(7),i=r(25);n(n.P+n.F*r(32)("includes"),"String",{includes:function(e){return!!~i(this,e,"includes").indexOf(e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,r){"use strict";var n=r(8),i=r(9),a=r(10),o=r(20),s=r(23),u=function e(t,r,u){var l,c,h,d,f=t&e.F,p=t&e.G,v=t&e.P,m=t&e.B,g=p?n:t&e.S?n[r]||(n[r]={}):(n[r]||{}).prototype,y=p?i:i[r]||(i[r]={}),b=y.prototype||(y.prototype={});for(l in p&&(u=r),u)h=((c=!f&&g&&void 0!==g[l])?g:u)[l],d=m&&c?s(h,n):v&&"function"==typeof h?s(Function.call,h):h,g&&o(g,l,h,t&e.U),y[l]!=h&&a(y,l,d),v&&b[l]!=h&&(b[l]=h)};n.core=i,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,e.exports=u},function(e,t,r){"use strict";var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,r){"use strict";var n=e.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},function(e,t,r){"use strict";var n=r(11),i=r(19);e.exports=r(15)?function(e,t,r){return n.f(e,t,i(1,r))}:function(e,t,r){return e[t]=r,e}},function(e,t,r){"use strict";var n=r(12),i=r(14),a=r(18),o=Object.defineProperty;t.f=r(15)?Object.defineProperty:function(e,t,r){if(n(e),t=a(t,!0),n(r),i)try{return o(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e}},function(e,t,r){"use strict";var n=r(13);e.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};e.exports=function(e){return"object"===(void 0===e?"undefined":n(e))?null!==e:"function"==typeof e}},function(e,t,r){"use strict";e.exports=!r(15)&&!r(16)(function(){return 7!=Object.defineProperty(r(17)("div"),"a",{get:function(){return 7}}).a})},function(e,t,r){"use strict";e.exports=!r(16)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,r){"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,r){"use strict";var n=r(13),i=r(8).document,a=n(i)&&n(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,r){"use strict";var n=r(13);e.exports=function(e,t){if(!n(e))return e;var r,i;if(t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;if("function"==typeof(r=e.valueOf)&&!n(i=r.call(e)))return i;if(!t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t,r){"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,r){"use strict";var n=r(8),i=r(10),a=r(21),o=r(22)("src"),s=Function.toString,u=(""+s).split("toString");r(9).inspectSource=function(e){return s.call(e)},(e.exports=function(e,t,r,s){var l="function"==typeof r;l&&(a(r,"name")||i(r,"name",t)),e[t]!==r&&(l&&(a(r,o)||i(r,o,e[t]?""+e[t]:u.join(String(t)))),e===n?e[t]=r:s?e[t]?e[t]=r:i(e,t,r):(delete e[t],i(e,t,r)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[o]||s.call(this)})},function(e,t,r){"use strict";var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,r){"use strict";var n=0,i=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+i).toString(36))}},function(e,t,r){"use strict";var n=r(24);e.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,r){"use strict";e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,r){"use strict";var n=r(26),i=r(31);e.exports=function(e,t,r){if(n(t))throw TypeError("String#"+r+" doesn't accept regex!");return String(i(e))}},function(e,t,r){"use strict";var n=r(13),i=r(27),a=r(28)("match");e.exports=function(e){var t;return n(e)&&(void 0!==(t=e[a])?!!t:"RegExp"==i(e))}},function(e,t,r){"use strict";var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,r){"use strict";var n=r(29)("wks"),i=r(22),a=r(8).Symbol,o="function"==typeof a;(e.exports=function(e){return n[e]||(n[e]=o&&a[e]||(o?a:i)("Symbol."+e))}).store=n},function(e,t,r){"use strict";var n=r(9),i=r(8),a=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(e.exports=function(e,t){return a[e]||(a[e]=void 0!==t?t:{})})("versions",[]).push({version:n.version,mode:r(30)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(e,t,r){"use strict";e.exports=!1},function(e,t,r){"use strict";e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,r){"use strict";var n=r(28)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[n]=!1,!"/./"[e](t)}catch(e){}}return!0}},function(e,t,r){"use strict";r(34),e.exports=r(9).Array.includes},function(e,t,r){"use strict";var n=r(7),i=r(35)(!0);n(n.P,"Array",{includes:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),r(41)("includes")},function(e,t,r){"use strict";var n=r(36),i=r(38),a=r(40);e.exports=function(e){return function(t,r,o){var s,u=n(t),l=i(u.length),c=a(o,l);if(e&&r!=r){for(;l>c;)if((s=u[c++])!=s)return!0}else for(;l>c;c++)if((e||c in u)&&u[c]===r)return e||c||0;return!e&&-1}}},function(e,t,r){"use strict";var n=r(37),i=r(31);e.exports=function(e){return n(i(e))}},function(e,t,r){"use strict";var n=r(27);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==n(e)?e.split(""):Object(e)}},function(e,t,r){"use strict";var n=r(39),i=Math.min;e.exports=function(e){return e>0?i(n(e),9007199254740991):0}},function(e,t,r){"use strict";var n=Math.ceil,i=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?i:n)(e)}},function(e,t,r){"use strict";var n=r(39),i=Math.max,a=Math.min;e.exports=function(e,t){return(e=n(e))<0?i(e+t,0):a(e,t)}},function(e,t,r){"use strict";var n=r(28)("unscopables"),i=Array.prototype;void 0==i[n]&&r(10)(i,n,{}),e.exports=function(e){i[n][e]=!0}},function(e,t,r){"use strict";r(43),e.exports=r(9).Object.assign},function(e,t,r){"use strict";var n=r(7);n(n.S+n.F,"Object",{assign:r(44)})},function(e,t,r){"use strict";var n=r(45),i=r(49),a=r(50),o=r(51),s=r(37),u=Object.assign;e.exports=!u||r(16)(function(){var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach(function(e){t[e]=e}),7!=u({},e)[r]||Object.keys(u({},t)).join("")!=n})?function(e,t){for(var r=o(e),u=arguments.length,l=1,c=i.f,h=a.f;u>l;)for(var d,f=s(arguments[l++]),p=c?n(f).concat(c(f)):n(f),v=p.length,m=0;v>m;)h.call(f,d=p[m++])&&(r[d]=f[d]);return r}:u},function(e,t,r){"use strict";var n=r(46),i=r(48);e.exports=Object.keys||function(e){return n(e,i)}},function(e,t,r){"use strict";var n=r(21),i=r(36),a=r(35)(!1),o=r(47)("IE_PROTO");e.exports=function(e,t){var r,s=i(e),u=0,l=[];for(r in s)r!=o&&n(s,r)&&l.push(r);for(;t.length>u;)n(s,r=t[u++])&&(~a(l,r)||l.push(r));return l}},function(e,t,r){"use strict";var n=r(29)("keys"),i=r(22);e.exports=function(e){return n[e]||(n[e]=i(e))}},function(e,t,r){"use strict";e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,r){"use strict";t.f=Object.getOwnPropertySymbols},function(e,t,r){"use strict";t.f={}.propertyIsEnumerable},function(e,t,r){"use strict";var n=r(31);e.exports=function(e){return Object(n(e))}},function(e,t,r){"use strict";r(53),e.exports=r(9).Math.log2},function(e,t,r){"use strict";var n=r(7);n(n.S,"Math",{log2:function(e){return Math.log(e)/Math.LN2}})},function(e,t,r){"use strict";r(55),e.exports=r(9).Number.isNaN},function(e,t,r){"use strict";var n=r(7);n(n.S,"Number",{isNaN:function(e){return e!=e}})},function(e,t,r){"use strict";r(57),e.exports=r(9).Number.isInteger},function(e,t,r){"use strict";var n=r(7);n(n.S,"Number",{isInteger:r(58)})},function(e,t,r){"use strict";var n=r(13),i=Math.floor;e.exports=function(e){return!n(e)&&isFinite(e)&&i(e)===e}},function(e,t,r){"use strict";r(60),r(62),r(72),r(75),r(92),r(93),e.exports=r(9).Promise},function(e,t,r){"use strict";var n=r(61),i={};i[r(28)("toStringTag")]="z",i+""!="[object z]"&&r(20)(Object.prototype,"toString",function(){return"[object "+n(this)+"]"},!0)},function(e,t,r){"use strict";var n=r(27),i=r(28)("toStringTag"),a="Arguments"==n(function(){return arguments}());e.exports=function(e){var t,r,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?r:a?n(t):"Object"==(o=n(t))&&"function"==typeof t.callee?"Arguments":o}},function(e,t,r){"use strict";var n=r(63)(!0);r(64)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,r=this._i;return r>=t.length?{value:void 0,done:!0}:(e=n(t,r),this._i+=e.length,{value:e,done:!1})})},function(e,t,r){"use strict";var n=r(39),i=r(31);e.exports=function(e){return function(t,r){var a,o,s=String(i(t)),u=n(r),l=s.length;return u<0||u>=l?e?"":void 0:(a=s.charCodeAt(u))<55296||a>56319||u+1===l||(o=s.charCodeAt(u+1))<56320||o>57343?e?s.charAt(u):a:e?s.slice(u,u+2):o-56320+(a-55296<<10)+65536}}},function(e,t,r){"use strict";var n=r(30),i=r(7),a=r(20),o=r(10),s=r(65),u=r(66),l=r(70),c=r(71),h=r(28)("iterator"),d=!([].keys&&"next"in[].keys()),f=function(){return this};e.exports=function(e,t,r,p,v,m,g){u(r,t,p);var y,b,_,A=function(e){if(!d&&e in P)return P[e];switch(e){case"keys":case"values":return function(){return new r(this,e)}}return function(){return new r(this,e)}},S=t+" Iterator",w="values"==v,k=!1,P=e.prototype,x=P[h]||P["@@iterator"]||v&&P[v],C=x||A(v),R=v?w?A("entries"):C:void 0,E="Array"==t&&P.entries||x;if(E&&(_=c(E.call(new e)))!==Object.prototype&&_.next&&(l(_,S,!0),n||"function"==typeof _[h]||o(_,h,f)),w&&x&&"values"!==x.name&&(k=!0,C=function(){return x.call(this)}),n&&!g||!d&&!k&&P[h]||o(P,h,C),s[t]=C,s[S]=f,v)if(y={values:w?C:A("values"),keys:m?C:A("keys"),entries:R},g)for(b in y)b in P||a(P,b,y[b]);else i(i.P+i.F*(d||k),t,y);return y}},function(e,t,r){"use strict";e.exports={}},function(e,t,r){"use strict";var n=r(67),i=r(19),a=r(70),o={};r(10)(o,r(28)("iterator"),function(){return this}),e.exports=function(e,t,r){e.prototype=n(o,{next:i(1,r)}),a(e,t+" Iterator")}},function(e,t,r){"use strict";var n=r(12),i=r(68),a=r(48),o=r(47)("IE_PROTO"),s=function(){},u=function(){var e,t=r(17)("iframe"),n=a.length;for(t.style.display="none",r(69).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),u=e.F;n--;)delete u.prototype[a[n]];return u()};e.exports=Object.create||function(e,t){var r;return null!==e?(s.prototype=n(e),r=new s,s.prototype=null,r[o]=e):r=u(),void 0===t?r:i(r,t)}},function(e,t,r){"use strict";var n=r(11),i=r(12),a=r(45);e.exports=r(15)?Object.defineProperties:function(e,t){i(e);for(var r,o=a(t),s=o.length,u=0;s>u;)n.f(e,r=o[u++],t[r]);return e}},function(e,t,r){"use strict";var n=r(8).document;e.exports=n&&n.documentElement},function(e,t,r){"use strict";var n=r(11).f,i=r(21),a=r(28)("toStringTag");e.exports=function(e,t,r){e&&!i(e=r?e:e.prototype,a)&&n(e,a,{configurable:!0,value:t})}},function(e,t,r){"use strict";var n=r(21),i=r(51),a=r(47)("IE_PROTO"),o=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=i(e),n(e,a)?e[a]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?o:null}},function(e,t,r){"use strict";for(var n=r(73),i=r(45),a=r(20),o=r(8),s=r(10),u=r(65),l=r(28),c=l("iterator"),h=l("toStringTag"),d=u.Array,f={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},p=i(f),v=0;v<p.length;v++){var m,g=p[v],y=f[g],b=o[g],_=b&&b.prototype;if(_&&(_[c]||s(_,c,d),_[h]||s(_,h,g),u[g]=d,y))for(m in n)_[m]||a(_,m,n[m],!0)}},function(e,t,r){"use strict";var n=r(41),i=r(74),a=r(65),o=r(36);e.exports=r(64)(Array,"Array",function(e,t){this._t=o(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,r=this._i++;return!e||r>=e.length?(this._t=void 0,i(1)):i(0,"keys"==t?r:"values"==t?e[r]:[r,e[r]])},"values"),a.Arguments=a.Array,n("keys"),n("values"),n("entries")},function(e,t,r){"use strict";e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,r){"use strict";var n,i,a,o,s=r(30),u=r(8),l=r(23),c=r(61),h=r(7),d=r(13),f=r(24),p=r(76),v=r(77),m=r(81),g=r(82).set,y=r(84)(),b=r(85),_=r(86),A=r(87),S=r(88),w=u.TypeError,k=u.process,P=k&&k.versions,x=P&&P.v8||"",C=u.Promise,R="process"==c(k),E=function(){},T=i=b.f,O=!!function(){try{var e=C.resolve(1),t=(e.constructor={})[r(28)("species")]=function(e){e(E,E)};return(R||"function"==typeof PromiseRejectionEvent)&&e.then(E)instanceof t&&0!==x.indexOf("6.6")&&-1===A.indexOf("Chrome/66")}catch(e){}}(),I=function(e){var t;return!(!d(e)||"function"!=typeof(t=e.then))&&t},F=function(e,t){if(!e._n){e._n=!0;var r=e._c;y(function(){for(var n=e._v,i=1==e._s,a=0,o=function(t){var r,a,o,s=i?t.ok:t.fail,u=t.resolve,l=t.reject,c=t.domain;try{s?(i||(2==e._h&&M(e),e._h=1),!0===s?r=n:(c&&c.enter(),r=s(n),c&&(c.exit(),o=!0)),r===t.promise?l(w("Promise-chain cycle")):(a=I(r))?a.call(r,u,l):u(r)):l(n)}catch(e){c&&!o&&c.exit(),l(e)}};r.length>a;)o(r[a++]);e._c=[],e._n=!1,t&&!e._h&&L(e)})}},L=function(e){g.call(u,function(){var t,r,n,i=e._v,a=j(e);if(a&&(t=_(function(){R?k.emit("unhandledRejection",i,e):(r=u.onunhandledrejection)?r({promise:e,reason:i}):(n=u.console)&&n.error&&n.error("Unhandled promise rejection",i)}),e._h=R||j(e)?2:1),e._a=void 0,a&&t.e)throw t.v})},j=function(e){return 1!==e._h&&0===(e._a||e._c).length},M=function(e){g.call(u,function(){var t;R?k.emit("rejectionHandled",e):(t=u.onrejectionhandled)&&t({promise:e,reason:e._v})})},D=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),F(t,!0))},N=function e(t){var r,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===t)throw w("Promise can't be resolved itself");(r=I(t))?y(function(){var i={_w:n,_d:!1};try{r.call(t,l(e,i,1),l(D,i,1))}catch(e){D.call(i,e)}}):(n._v=t,n._s=1,F(n,!1))}catch(e){D.call({_w:n,_d:!1},e)}}};O||(C=function(e){p(this,C,"Promise","_h"),f(e),n.call(this);try{e(l(N,this,1),l(D,this,1))}catch(e){D.call(this,e)}},(n=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=r(89)(C.prototype,{then:function(e,t){var r=T(m(this,C));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=R?k.domain:void 0,this._c.push(r),this._a&&this._a.push(r),this._s&&F(this,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),a=function(){var e=new n;this.promise=e,this.resolve=l(N,e,1),this.reject=l(D,e,1)},b.f=T=function(e){return e===C||e===o?new a(e):i(e)}),h(h.G+h.W+h.F*!O,{Promise:C}),r(70)(C,"Promise"),r(90)("Promise"),o=r(9).Promise,h(h.S+h.F*!O,"Promise",{reject:function(e){var t=T(this);return(0,t.reject)(e),t.promise}}),h(h.S+h.F*(s||!O),"Promise",{resolve:function(e){return S(s&&this===o?C:this,e)}}),h(h.S+h.F*!(O&&r(91)(function(e){C.all(e).catch(E)})),"Promise",{all:function(e){var t=this,r=T(t),n=r.resolve,i=r.reject,a=_(function(){var r=[],a=0,o=1;v(e,!1,function(e){var s=a++,u=!1;r.push(void 0),o++,t.resolve(e).then(function(e){u||(u=!0,r[s]=e,--o||n(r))},i)}),--o||n(r)});return a.e&&i(a.v),r.promise},race:function(e){var t=this,r=T(t),n=r.reject,i=_(function(){v(e,!1,function(e){t.resolve(e).then(r.resolve,n)})});return i.e&&n(i.v),r.promise}})},function(e,t,r){"use strict";e.exports=function(e,t,r,n){if(!(e instanceof t)||void 0!==n&&n in e)throw TypeError(r+": incorrect invocation!");return e}},function(e,t,r){"use strict";var n=r(23),i=r(78),a=r(79),o=r(12),s=r(38),u=r(80),l={},c={},h=e.exports=function(e,t,r,h,d){var f,p,v,m,g=d?function(){return e}:u(e),y=n(r,h,t?2:1),b=0;if("function"!=typeof g)throw TypeError(e+" is not iterable!");if(a(g)){for(f=s(e.length);f>b;b++)if((m=t?y(o(p=e[b])[0],p[1]):y(e[b]))===l||m===c)return m}else for(v=g.call(e);!(p=v.next()).done;)if((m=i(v,y,p.value,t))===l||m===c)return m};h.BREAK=l,h.RETURN=c},function(e,t,r){"use strict";var n=r(12);e.exports=function(e,t,r,i){try{return i?t(n(r)[0],r[1]):t(r)}catch(t){var a=e.return;throw void 0!==a&&n(a.call(e)),t}}},function(e,t,r){"use strict";var n=r(65),i=r(28)("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(n.Array===e||a[i]===e)}},function(e,t,r){"use strict";var n=r(61),i=r(28)("iterator"),a=r(65);e.exports=r(9).getIteratorMethod=function(e){if(void 0!=e)return e[i]||e["@@iterator"]||a[n(e)]}},function(e,t,r){"use strict";var n=r(12),i=r(24),a=r(28)("species");e.exports=function(e,t){var r,o=n(e).constructor;return void 0===o||void 0==(r=n(o)[a])?t:i(r)}},function(e,t,r){"use strict";var n,i,a,o=r(23),s=r(83),u=r(69),l=r(17),c=r(8),h=c.process,d=c.setImmediate,f=c.clearImmediate,p=c.MessageChannel,v=c.Dispatch,m=0,g={},y=function(){var e=+this;if(g.hasOwnProperty(e)){var t=g[e];delete g[e],t()}},b=function(e){y.call(e.data)};d&&f||(d=function(e){for(var t=[],r=1;arguments.length>r;)t.push(arguments[r++]);return g[++m]=function(){s("function"==typeof e?e:Function(e),t)},n(m),m},f=function(e){delete g[e]},"process"==r(27)(h)?n=function(e){h.nextTick(o(y,e,1))}:v&&v.now?n=function(e){v.now(o(y,e,1))}:p?(a=(i=new p).port2,i.port1.onmessage=b,n=o(a.postMessage,a,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScripts?(n=function(e){c.postMessage(e+"","*")},c.addEventListener("message",b,!1)):n="onreadystatechange"in l("script")?function(e){u.appendChild(l("script")).onreadystatechange=function(){u.removeChild(this),y.call(e)}}:function(e){setTimeout(o(y,e,1),0)}),e.exports={set:d,clear:f}},function(e,t,r){"use strict";e.exports=function(e,t,r){var n=void 0===r;switch(t.length){case 0:return n?e():e.call(r);case 1:return n?e(t[0]):e.call(r,t[0]);case 2:return n?e(t[0],t[1]):e.call(r,t[0],t[1]);case 3:return n?e(t[0],t[1],t[2]):e.call(r,t[0],t[1],t[2]);case 4:return n?e(t[0],t[1],t[2],t[3]):e.call(r,t[0],t[1],t[2],t[3])}return e.apply(r,t)}},function(e,t,r){"use strict";var n=r(8),i=r(82).set,a=n.MutationObserver||n.WebKitMutationObserver,o=n.process,s=n.Promise,u="process"==r(27)(o);e.exports=function(){var e,t,r,l=function(){var n,i;for(u&&(n=o.domain)&&n.exit();e;){i=e.fn,e=e.next;try{i()}catch(n){throw e?r():t=void 0,n}}t=void 0,n&&n.enter()};if(u)r=function(){o.nextTick(l)};else if(!a||n.navigator&&n.navigator.standalone)if(s&&s.resolve){var c=s.resolve(void 0);r=function(){c.then(l)}}else r=function(){i.call(n,l)};else{var h=!0,d=document.createTextNode("");new a(l).observe(d,{characterData:!0}),r=function(){d.data=h=!h}}return function(n){var i={fn:n,next:void 0};t&&(t.next=i),e||(e=i,r()),t=i}}},function(e,t,r){"use strict";var n=r(24);e.exports.f=function(e){return new function(e){var t,r;this.promise=new e(function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n}),this.resolve=n(t),this.reject=n(r)}(e)}},function(e,t,r){"use strict";e.exports=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}}},function(e,t,r){"use strict";var n=r(8).navigator;e.exports=n&&n.userAgent||""},function(e,t,r){"use strict";var n=r(12),i=r(13),a=r(85);e.exports=function(e,t){if(n(e),i(t)&&t.constructor===e)return t;var r=a.f(e);return(0,r.resolve)(t),r.promise}},function(e,t,r){"use strict";var n=r(20);e.exports=function(e,t,r){for(var i in t)n(e,i,t[i],r);return e}},function(e,t,r){"use strict";var n=r(8),i=r(11),a=r(15),o=r(28)("species");e.exports=function(e){var t=n[e];a&&t&&!t[o]&&i.f(t,o,{configurable:!0,get:function(){return this}})}},function(e,t,r){"use strict";var n=r(28)("iterator"),i=!1;try{var a=[7][n]();a.return=function(){i=!0},Array.from(a,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!i)return!1;var r=!1;try{var a=[7],o=a[n]();o.next=function(){return{done:r=!0}},a[n]=function(){return o},e(a)}catch(e){}return r}},function(e,t,r){"use strict";var n=r(7),i=r(9),a=r(8),o=r(81),s=r(88);n(n.P+n.R,"Promise",{finally:function(e){var t=o(this,i.Promise||a.Promise),r="function"==typeof e;return this.then(r?function(r){return s(t,e()).then(function(){return r})}:e,r?function(r){return s(t,e()).then(function(){throw r})}:e)}})},function(e,t,r){"use strict";var n=r(7),i=r(85),a=r(86);n(n.S,"Promise",{try:function(e){var t=i.f(this),r=a(e);return(r.e?t.reject:t.resolve)(r.v),t.promise}})},function(e,t,r){"use strict";r(60),r(72),r(95),r(107),r(109),e.exports=r(9).WeakMap},function(e,t,r){"use strict";var n,i=r(96)(0),a=r(20),o=r(100),s=r(44),u=r(101),l=r(13),c=r(16),h=r(102),d=o.getWeak,f=Object.isExtensible,p=u.ufstore,v={},m=function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},g={get:function(e){if(l(e)){var t=d(e);return!0===t?p(h(this,"WeakMap")).get(e):t?t[this._i]:void 0}},set:function(e,t){return u.def(h(this,"WeakMap"),e,t)}},y=e.exports=r(103)("WeakMap",m,g,u,!0,!0);c(function(){return 7!=(new y).set((Object.freeze||Object)(v),7).get(v)})&&(s((n=u.getConstructor(m,"WeakMap")).prototype,g),o.NEED=!0,i(["delete","has","get","set"],function(e){var t=y.prototype,r=t[e];a(t,e,function(t,i){if(l(t)&&!f(t)){this._f||(this._f=new n);var a=this._f[e](t,i);return"set"==e?this:a}return r.call(this,t,i)})}))},function(e,t,r){"use strict";var n=r(23),i=r(37),a=r(51),o=r(38),s=r(97);e.exports=function(e,t){var r=1==e,u=2==e,l=3==e,c=4==e,h=6==e,d=5==e||h,f=t||s;return function(t,s,p){for(var v,m,g=a(t),y=i(g),b=n(s,p,3),_=o(y.length),A=0,S=r?f(t,_):u?f(t,0):void 0;_>A;A++)if((d||A in y)&&(m=b(v=y[A],A,g),e))if(r)S[A]=m;else if(m)switch(e){case 3:return!0;case 5:return v;case 6:return A;case 2:S.push(v)}else if(c)return!1;return h?-1:l||c?c:S}}},function(e,t,r){"use strict";var n=r(98);e.exports=function(e,t){return new(n(e))(t)}},function(e,t,r){"use strict";var n=r(13),i=r(99),a=r(28)("species");e.exports=function(e){var t;return i(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!i(t.prototype)||(t=void 0),n(t)&&null===(t=t[a])&&(t=void 0)),void 0===t?Array:t}},function(e,t,r){"use strict";var n=r(27);e.exports=Array.isArray||function(e){return"Array"==n(e)}},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(22)("meta"),a=r(13),o=r(21),s=r(11).f,u=0,l=Object.isExtensible||function(){return!0},c=!r(16)(function(){return l(Object.preventExtensions({}))}),h=function(e){s(e,i,{value:{i:"O"+ ++u,w:{}}})},d=e.exports={KEY:i,NEED:!1,fastKey:function(e,t){if(!a(e))return"symbol"==(void 0===e?"undefined":n(e))?e:("string"==typeof e?"S":"P")+e;if(!o(e,i)){if(!l(e))return"F";if(!t)return"E";h(e)}return e[i].i},getWeak:function(e,t){if(!o(e,i)){if(!l(e))return!0;if(!t)return!1;h(e)}return e[i].w},onFreeze:function(e){return c&&d.NEED&&l(e)&&!o(e,i)&&h(e),e}}},function(e,t,r){"use strict";var n=r(89),i=r(100).getWeak,a=r(12),o=r(13),s=r(76),u=r(77),l=r(96),c=r(21),h=r(102),d=l(5),f=l(6),p=0,v=function(e){return e._l||(e._l=new m)},m=function(){this.a=[]},g=function(e,t){return d(e.a,function(e){return e[0]===t})};m.prototype={get:function(e){var t=g(this,e);if(t)return t[1]},has:function(e){return!!g(this,e)},set:function(e,t){var r=g(this,e);r?r[1]=t:this.a.push([e,t])},delete:function(e){var t=f(this.a,function(t){return t[0]===e});return~t&&this.a.splice(t,1),!!~t}},e.exports={getConstructor:function(e,t,r,a){var l=e(function(e,n){s(e,l,t,"_i"),e._t=t,e._i=p++,e._l=void 0,void 0!=n&&u(n,r,e[a],e)});return n(l.prototype,{delete:function(e){if(!o(e))return!1;var r=i(e);return!0===r?v(h(this,t)).delete(e):r&&c(r,this._i)&&delete r[this._i]},has:function(e){if(!o(e))return!1;var r=i(e);return!0===r?v(h(this,t)).has(e):r&&c(r,this._i)}}),l},def:function(e,t,r){var n=i(a(t),!0);return!0===n?v(e).set(t,r):n[e._i]=r,e},ufstore:v}},function(e,t,r){"use strict";var n=r(13);e.exports=function(e,t){if(!n(e)||e._t!==t)throw TypeError("Incompatible receiver, "+t+" required!");return e}},function(e,t,r){"use strict";var n=r(8),i=r(7),a=r(20),o=r(89),s=r(100),u=r(77),l=r(76),c=r(13),h=r(16),d=r(91),f=r(70),p=r(104);e.exports=function(e,t,r,v,m,g){var y=n[e],b=y,_=m?"set":"add",A=b&&b.prototype,S={},w=function(e){var t=A[e];a(A,e,"delete"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:"has"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return g&&!c(e)?void 0:t.call(this,0===e?0:e)}:"add"==e?function(e){return t.call(this,0===e?0:e),this}:function(e,r){return t.call(this,0===e?0:e,r),this})};if("function"==typeof b&&(g||A.forEach&&!h(function(){(new b).entries().next()}))){var k=new b,P=k[_](g?{}:-0,1)!=k,x=h(function(){k.has(1)}),C=d(function(e){new b(e)}),R=!g&&h(function(){for(var e=new b,t=5;t--;)e[_](t,t);return!e.has(-0)});C||((b=t(function(t,r){l(t,b,e);var n=p(new y,t,b);return void 0!=r&&u(r,m,n[_],n),n})).prototype=A,A.constructor=b),(x||R)&&(w("delete"),w("has"),m&&w("get")),(R||P)&&w(_),g&&A.clear&&delete A.clear}else b=v.getConstructor(t,e,m,_),o(b.prototype,r),s.NEED=!0;return f(b,e),S[e]=b,i(i.G+i.W+i.F*(b!=y),S),g||v.setStrong(b,e,m),b}},function(e,t,r){"use strict";var n=r(13),i=r(105).set;e.exports=function(e,t,r){var a,o=t.constructor;return o!==r&&"function"==typeof o&&(a=o.prototype)!==r.prototype&&n(a)&&i&&i(e,a),e}},function(e,t,r){"use strict";var n=r(13),i=r(12),a=function(e,t){if(i(e),!n(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,n){try{(n=r(23)(Function.call,r(106).f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,r){return a(e,r),t?e.__proto__=r:n(e,r),e}}({},!1):void 0),check:a}},function(e,t,r){"use strict";var n=r(50),i=r(19),a=r(36),o=r(18),s=r(21),u=r(14),l=Object.getOwnPropertyDescriptor;t.f=r(15)?l:function(e,t){if(e=a(e),t=o(t,!0),u)try{return l(e,t)}catch(e){}if(s(e,t))return i(!n.f.call(e,t),e[t])}},function(e,t,r){"use strict";r(108)("WeakMap")},function(e,t,r){"use strict";var n=r(7);e.exports=function(e){n(n.S,e,{of:function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];return new this(t)}})}},function(e,t,r){"use strict";r(110)("WeakMap")},function(e,t,r){"use strict";var n=r(7),i=r(24),a=r(23),o=r(77);e.exports=function(e){n(n.S,e,{from:function(e){var t,r,n,s,u=arguments[1];return i(this),(t=void 0!==u)&&i(u),void 0==e?new this:(r=[],t?(n=0,s=a(u,arguments[2],2),o(e,!1,function(e){r.push(s(e,n++))})):o(e,!1,r.push,r),new this(r))}})}},function(e,t,r){"use strict";r(112),e.exports=r(9).String.codePointAt},function(e,t,r){"use strict";var n=r(7),i=r(63)(!1);n(n.P,"String",{codePointAt:function(e){return i(this,e)}})},function(e,t,r){"use strict";r(114),e.exports=r(9).String.fromCodePoint},function(e,t,r){"use strict";var n=r(7),i=r(40),a=String.fromCharCode,o=String.fromCodePoint;n(n.S+n.F*(!!o&&1!=o.length),"String",{fromCodePoint:function(e){for(var t,r=[],n=arguments.length,o=0;n>o;){if(t=+arguments[o++],i(t,1114111)!==t)throw RangeError(t+" is not a valid code point");r.push(t<65536?a(t):a(55296+((t-=65536)>>10),t%1024+56320))}return r.join("")}})},function(e,t,r){"use strict";r(116),r(60),e.exports=r(9).Symbol},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(8),a=r(21),o=r(15),s=r(7),u=r(20),l=r(100).KEY,c=r(16),h=r(29),d=r(70),f=r(22),p=r(28),v=r(117),m=r(118),g=r(119),y=r(99),b=r(12),_=r(13),A=r(36),S=r(18),w=r(19),k=r(67),P=r(120),x=r(106),C=r(11),R=r(45),E=x.f,T=C.f,O=P.f,I=i.Symbol,F=i.JSON,L=F&&F.stringify,j=p("_hidden"),M=p("toPrimitive"),D={}.propertyIsEnumerable,N=h("symbol-registry"),q=h("symbols"),W=h("op-symbols"),U=Object.prototype,B="function"==typeof I,z=i.QObject,G=!z||!z.prototype||!z.prototype.findChild,H=o&&c(function(){return 7!=k(T({},"a",{get:function(){return T(this,"a",{value:7}).a}})).a})?function(e,t,r){var n=E(U,t);n&&delete U[t],T(e,t,r),n&&e!==U&&T(U,t,n)}:T,X=function(e){var t=q[e]=k(I.prototype);return t._k=e,t},Y=B&&"symbol"==n(I.iterator)?function(e){return"symbol"==(void 0===e?"undefined":n(e))}:function(e){return e instanceof I},V=function(e,t,r){return e===U&&V(W,t,r),b(e),t=S(t,!0),b(r),a(q,t)?(r.enumerable?(a(e,j)&&e[j][t]&&(e[j][t]=!1),r=k(r,{enumerable:w(0,!1)})):(a(e,j)||T(e,j,w(1,{})),e[j][t]=!0),H(e,t,r)):T(e,t,r)},Q=function(e,t){b(e);for(var r,n=g(t=A(t)),i=0,a=n.length;a>i;)V(e,r=n[i++],t[r]);return e},K=function(e){var t=D.call(this,e=S(e,!0));return!(this===U&&a(q,e)&&!a(W,e))&&(!(t||!a(this,e)||!a(q,e)||a(this,j)&&this[j][e])||t)},J=function(e,t){if(e=A(e),t=S(t,!0),e!==U||!a(q,t)||a(W,t)){var r=E(e,t);return!r||!a(q,t)||a(e,j)&&e[j][t]||(r.enumerable=!0),r}},Z=function(e){for(var t,r=O(A(e)),n=[],i=0;r.length>i;)a(q,t=r[i++])||t==j||t==l||n.push(t);return n},$=function(e){for(var t,r=e===U,n=O(r?W:A(e)),i=[],o=0;n.length>o;)!a(q,t=n[o++])||r&&!a(U,t)||i.push(q[t]);return i};B||(u((I=function(){if(this instanceof I)throw TypeError("Symbol is not a constructor!");var e=f(arguments.length>0?arguments[0]:void 0);return o&&G&&H(U,e,{configurable:!0,set:function t(r){this===U&&t.call(W,r),a(this,j)&&a(this[j],e)&&(this[j][e]=!1),H(this,e,w(1,r))}}),X(e)}).prototype,"toString",function(){return this._k}),x.f=J,C.f=V,r(121).f=P.f=Z,r(50).f=K,r(49).f=$,o&&!r(30)&&u(U,"propertyIsEnumerable",K,!0),v.f=function(e){return X(p(e))}),s(s.G+s.W+s.F*!B,{Symbol:I});for(var ee="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),te=0;ee.length>te;)p(ee[te++]);for(var re=R(p.store),ne=0;re.length>ne;)m(re[ne++]);s(s.S+s.F*!B,"Symbol",{for:function(e){return a(N,e+="")?N[e]:N[e]=I(e)},keyFor:function(e){if(!Y(e))throw TypeError(e+" is not a symbol!");for(var t in N)if(N[t]===e)return t},useSetter:function(){G=!0},useSimple:function(){G=!1}}),s(s.S+s.F*!B,"Object",{create:function(e,t){return void 0===t?k(e):Q(k(e),t)},defineProperty:V,defineProperties:Q,getOwnPropertyDescriptor:J,getOwnPropertyNames:Z,getOwnPropertySymbols:$}),F&&s(s.S+s.F*(!B||c(function(){var e=I();return"[null]"!=L([e])||"{}"!=L({a:e})||"{}"!=L(Object(e))})),"JSON",{stringify:function(e){for(var t,r,n=[e],i=1;arguments.length>i;)n.push(arguments[i++]);if(r=t=n[1],(_(t)||void 0!==e)&&!Y(e))return y(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!Y(t))return t}),n[1]=t,L.apply(F,n)}}),I.prototype[M]||r(10)(I.prototype,M,I.prototype.valueOf),d(I,"Symbol"),d(Math,"Math",!0),d(i.JSON,"JSON",!0)},function(e,t,r){"use strict";t.f=r(28)},function(e,t,r){"use strict";var n=r(8),i=r(9),a=r(30),o=r(117),s=r(11).f;e.exports=function(e){var t=i.Symbol||(i.Symbol=a?{}:n.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:o.f(e)})}},function(e,t,r){"use strict";var n=r(45),i=r(49),a=r(50);e.exports=function(e){var t=n(e),r=i.f;if(r)for(var o,s=r(e),u=a.f,l=0;s.length>l;)u.call(e,o=s[l++])&&t.push(o);return t}},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(36),a=r(121).f,o={}.toString,s="object"==("undefined"==typeof window?"undefined":n(window))&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return s&&"[object Window]"==o.call(e)?function(e){try{return a(e)}catch(e){return s.slice()}}(e):a(i(e))}},function(e,t,r){"use strict";var n=r(46),i=r(48).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return n(e,i)}},function(e,t,r){"use strict";r(123),e.exports=r(9).Object.values},function(e,t,r){"use strict";var n=r(7),i=r(124)(!1);n(n.S,"Object",{values:function(e){return i(e)}})},function(e,t,r){"use strict";var n=r(45),i=r(36),a=r(50).f;e.exports=function(e){return function(t){for(var r,o=i(t),s=n(o),u=s.length,l=0,c=[];u>l;)a.call(o,r=s[l++])&&c.push(e?[r,o[r]]:o[r]);return c}}},function(e,t,r){"use strict";var n=!1;if("undefined"!=typeof ReadableStream)try{new ReadableStream({start:function(e){e.close()}}),n=!0}catch(e){}t.ReadableStream=n?ReadableStream:r(126).ReadableStream},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t){for(var r in t)e[r]=t[r]}(t,function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=7)}([function(e,t,r){var i="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(e){return void 0===e?"undefined":n(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":n(e)},a=r(1).assert;function o(e){return"string"==typeof e||"symbol"===(void 0===e?"undefined":i(e))}function s(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}t.typeIsObject=function(e){return"object"===(void 0===e?"undefined":i(e))&&null!==e||"function"==typeof e},t.createDataProperty=function(e,r,n){a(t.typeIsObject(e)),Object.defineProperty(e,r,{value:n,writable:!0,enumerable:!0,configurable:!0})},t.createArrayFromList=function(e){return e.slice()},t.ArrayBufferCopy=function(e,t,r,n,i){new Uint8Array(e).set(new Uint8Array(r,n,i),t)},t.CreateIterResultObject=function(e,t){a("boolean"==typeof t);var r={};return Object.defineProperty(r,"value",{value:e,enumerable:!0,writable:!0,configurable:!0}),Object.defineProperty(r,"done",{value:t,enumerable:!0,writable:!0,configurable:!0}),r},t.IsFiniteNonNegativeNumber=function(e){return!Number.isNaN(e)&&(e!==1/0&&!(e<0))},t.InvokeOrNoop=function(e,t,r){a(void 0!==e),a(o(t)),a(Array.isArray(r));var n=e[t];if(void 0!==n)return s(n,e,r)},t.PromiseInvokeOrNoop=function(e,r,n){a(void 0!==e),a(o(r)),a(Array.isArray(n));try{return Promise.resolve(t.InvokeOrNoop(e,r,n))}catch(e){return Promise.reject(e)}},t.PromiseInvokeOrPerformFallback=function(e,t,r,n,i){a(void 0!==e),a(o(t)),a(Array.isArray(r)),a(Array.isArray(i));var u=void 0;try{u=e[t]}catch(e){return Promise.reject(e)}if(void 0===u)return n.apply(null,i);try{return Promise.resolve(s(u,e,r))}catch(e){return Promise.reject(e)}},t.TransferArrayBuffer=function(e){return e.slice()},t.ValidateAndNormalizeHighWaterMark=function(e){if(e=Number(e),Number.isNaN(e)||e<0)throw new RangeError("highWaterMark property of a queuing strategy must be non-negative and non-NaN");return e},t.ValidateAndNormalizeQueuingStrategy=function(e,r){if(void 0!==e&&"function"!=typeof e)throw new TypeError("size property of a queuing strategy must be a function");return{size:e,highWaterMark:r=t.ValidateAndNormalizeHighWaterMark(r)}}},function(e,t,r){function n(e){this.name="AssertionError",this.message=e||"",this.stack=(new Error).stack}n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,e.exports={rethrowAssertionErrorRejection:function(e){e&&e.constructor===n&&setTimeout(function(){throw e},0)},AssertionError:n,assert:function(e,t){if(!e)throw new n(t)}}},function(e,t,r){var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=r(0),o=a.InvokeOrNoop,s=a.PromiseInvokeOrNoop,u=a.ValidateAndNormalizeQueuingStrategy,l=a.typeIsObject,c=r(1),h=c.assert,d=c.rethrowAssertionErrorRejection,f=r(3),p=f.DequeueValue,v=f.EnqueueValueWithSize,m=f.PeekQueueValue,g=f.ResetQueue,y=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.size,a=r.highWaterMark,o=void 0===a?1:a;if(i(this,e),this._state="writable",this._storedError=void 0,this._writer=void 0,this._writableStreamController=void 0,this._writeRequests=[],this._inFlightWriteRequest=void 0,this._closeRequest=void 0,this._inFlightCloseRequest=void 0,this._pendingAbortRequest=void 0,this._backpressure=!1,void 0!==t.type)throw new RangeError("Invalid type is specified");this._writableStreamController=new N(this,t,n,o),this._writableStreamController.__startSteps()}return n(e,[{key:"abort",value:function(e){return!1===_(this)?Promise.reject(G("abort")):!0===A(this)?Promise.reject(new TypeError("Cannot abort a stream that already has a writer")):S(this,e)}},{key:"getWriter",value:function(){if(!1===_(this))throw G("getWriter");return b(this)}},{key:"locked",get:function(){if(!1===_(this))throw G("locked");return A(this)}}]),e}();function b(e){return new O(e)}function _(e){return!!l(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")}function A(e){return h(!0===_(e),"IsWritableStreamLocked should only be used on known writable streams"),void 0!==e._writer}function S(e,t){var r=e._state;if("closed"===r)return Promise.resolve(void 0);if("errored"===r)return Promise.reject(e._storedError);var n=new TypeError("Requested to abort");if(void 0!==e._pendingAbortRequest)return Promise.reject(n);h("writable"===r||"erroring"===r,"state must be writable or erroring");var i=!1;"erroring"===r&&(i=!0,t=void 0);var a=new Promise(function(r,n){e._pendingAbortRequest={_resolve:r,_reject:n,_reason:t,_wasAlreadyErroring:i}});return!1===i&&k(e,n),a}function w(e,t){var r=e._state;"writable"!==r?(h("erroring"===r),P(e)):k(e,t)}function k(e,t){h(void 0===e._storedError,"stream._storedError === undefined"),h("writable"===e._state,"state must be writable");var r=e._writableStreamController;h(void 0!==r,"controller must not be undefined"),e._state="erroring",e._storedError=t;var n=e._writer;void 0!==n&&j(n,t),!1===R(e)&&!0===r._started&&P(e)}function P(e){h("erroring"===e._state,"stream._state === erroring"),h(!1===R(e),"WritableStreamHasOperationMarkedInFlight(stream) === false"),e._state="errored",e._writableStreamController.__errorSteps();for(var t=e._storedError,r=0;r<e._writeRequests.length;r++){e._writeRequests[r]._reject(t)}if(e._writeRequests=[],void 0!==e._pendingAbortRequest){var n=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,!0===n._wasAlreadyErroring)return n._reject(t),void E(e);e._writableStreamController.__abortSteps(n._reason).then(function(){n._resolve(),E(e)},function(t){n._reject(t),E(e)})}else E(e)}function x(e){h(void 0!==e._inFlightCloseRequest),e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0;var t=e._state;h("writable"===t||"erroring"===t),"erroring"===t&&(e._storedError=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";var r=e._writer;void 0!==r&&function(e){h(void 0!==e._closedPromise_resolve,"writer._closedPromise_resolve !== undefined"),h(void 0!==e._closedPromise_reject,"writer._closedPromise_reject !== undefined"),h("pending"===e._closedPromiseState,"writer._closedPromiseState is pending"),e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved"}(r),h(void 0===e._pendingAbortRequest,"stream._pendingAbortRequest === undefined"),h(void 0===e._storedError,"stream._storedError === undefined")}function C(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function R(e){return void 0!==e._inFlightWriteRequest||void 0!==e._inFlightCloseRequest}function E(e){h("errored"===e._state,'_stream_.[[state]] is `"errored"`'),void 0!==e._closeRequest&&(h(void 0===e._inFlightCloseRequest),e._closeRequest._reject(e._storedError),e._closeRequest=void 0);var t=e._writer;void 0!==t&&(V(t,e._storedError),t._closedPromise.catch(function(){}))}function T(e,t){h("writable"===e._state),h(!1===C(e));var r=e._writer;void 0!==r&&t!==e._backpressure&&(!0===t?function(e){h(void 0===e._readyPromise_resolve,"writer._readyPromise_resolve === undefined"),h(void 0===e._readyPromise_reject,"writer._readyPromise_reject === undefined"),e._readyPromise=new Promise(function(t,r){e._readyPromise_resolve=t,e._readyPromise_reject=r}),e._readyPromiseState="pending"}(r):(h(!1===t),J(r))),e._backpressure=t}e.exports={AcquireWritableStreamDefaultWriter:b,IsWritableStream:_,IsWritableStreamLocked:A,WritableStream:y,WritableStreamAbort:S,WritableStreamDefaultControllerError:z,WritableStreamDefaultWriterCloseWithErrorPropagation:function(e){var t=e._ownerWritableStream;h(void 0!==t);var r=t._state;if(!0===C(t)||"closed"===r)return Promise.resolve();if("errored"===r)return Promise.reject(t._storedError);return h("writable"===r||"erroring"===r),F(e)},WritableStreamDefaultWriterRelease:M,WritableStreamDefaultWriterWrite:D,WritableStreamCloseQueuedOrInFlight:C};var O=function(){function e(t){if(i(this,e),!1===_(t))throw new TypeError("WritableStreamDefaultWriter can only be constructed with a WritableStream instance");if(!0===A(t))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=t,t._writer=this;var r,n=t._state;if("writable"===n)!1===C(t)&&!0===t._backpressure?((r=this)._readyPromise=new Promise(function(e,t){r._readyPromise_resolve=e,r._readyPromise_reject=t}),r._readyPromiseState="pending"):K(this),Y(this);else if("erroring"===n)Q(this,t._storedError),this._readyPromise.catch(function(){}),Y(this);else if("closed"===n)K(this),function(e){e._closedPromise=Promise.resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved"}(this);else{h("errored"===n,"state must be errored");var a=t._storedError;Q(this,a),this._readyPromise.catch(function(){}),function(e,t){e._closedPromise=Promise.reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected"}(this,a),this._closedPromise.catch(function(){})}}return n(e,[{key:"abort",value:function(e){return!1===I(this)?Promise.reject(H("abort")):void 0===this._ownerWritableStream?Promise.reject(X("abort")):function(e,t){var r=e._ownerWritableStream;return h(void 0!==r),S(r,t)}(this,e)}},{key:"close",value:function(){if(!1===I(this))return Promise.reject(H("close"));var e=this._ownerWritableStream;return void 0===e?Promise.reject(X("close")):!0===C(e)?Promise.reject(new TypeError("cannot close an already-closing stream")):F(this)}},{key:"releaseLock",value:function(){if(!1===I(this))throw H("releaseLock");var e=this._ownerWritableStream;void 0!==e&&(h(void 0!==e._writer),M(this))}},{key:"write",value:function(e){return!1===I(this)?Promise.reject(H("write")):void 0===this._ownerWritableStream?Promise.reject(X("write to")):D(this,e)}},{key:"closed",get:function(){return!1===I(this)?Promise.reject(H("closed")):this._closedPromise}},{key:"desiredSize",get:function(){if(!1===I(this))throw H("desiredSize");if(void 0===this._ownerWritableStream)throw X("desiredSize");return function(e){var t=e._ownerWritableStream,r=t._state;if("errored"===r||"erroring"===r)return null;if("closed"===r)return 0;return q(t._writableStreamController)}(this)}},{key:"ready",get:function(){return!1===I(this)?Promise.reject(H("ready")):this._readyPromise}}]),e}();function I(e){return!!l(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")}function F(e){var t=e._ownerWritableStream;h(void 0!==t);var r=t._state;if("closed"===r||"errored"===r)return Promise.reject(new TypeError("The stream (in "+r+" state) is not in the writable state and cannot be closed"));h("writable"===r||"erroring"===r),h(!1===C(t));var n,i=new Promise(function(e,r){var n={_resolve:e,_reject:r};t._closeRequest=n});return!0===t._backpressure&&"writable"===r&&J(e),n=t._writableStreamController,v(n,"close",0),W(n),i}function L(e,t){"pending"===e._closedPromiseState?V(e,t):function(e,t){h(void 0===e._closedPromise_resolve,"writer._closedPromise_resolve === undefined"),h(void 0===e._closedPromise_reject,"writer._closedPromise_reject === undefined"),h("pending"!==e._closedPromiseState,"writer._closedPromiseState is not pending"),e._closedPromise=Promise.reject(t),e._closedPromiseState="rejected"}(e,t),e._closedPromise.catch(function(){})}function j(e,t){"pending"===e._readyPromiseState?function(e,t){h(void 0!==e._readyPromise_resolve,"writer._readyPromise_resolve !== undefined"),h(void 0!==e._readyPromise_reject,"writer._readyPromise_reject !== undefined"),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected"}(e,t):function(e,t){h(void 0===e._readyPromise_resolve,"writer._readyPromise_resolve === undefined"),h(void 0===e._readyPromise_reject,"writer._readyPromise_reject === undefined"),e._readyPromise=Promise.reject(t),e._readyPromiseState="rejected"}(e,t),e._readyPromise.catch(function(){})}function M(e){var t=e._ownerWritableStream;h(void 0!==t),h(t._writer===e);var r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");j(e,r),L(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function D(e,t){var r=e._ownerWritableStream;h(void 0!==r);var n=r._writableStreamController,i=function(e,t){var r=e._strategySize;if(void 0===r)return 1;try{return r(t)}catch(t){return U(e,t),1}}(n,t);if(r!==e._ownerWritableStream)return Promise.reject(X("write to"));var a=r._state;if("errored"===a)return Promise.reject(r._storedError);if(!0===C(r)||"closed"===a)return Promise.reject(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===a)return Promise.reject(r._storedError);h("writable"===a);var o=function(e){return h(!0===A(e)),h("writable"===e._state),new Promise(function(t,r){var n={_resolve:t,_reject:r};e._writeRequests.push(n)})}(r);return function(e,t,r){var n={chunk:t};try{v(e,n,r)}catch(t){return void U(e,t)}var i=e._controlledWritableStream;if(!1===C(i)&&"writable"===i._state){var a=B(e);T(i,a)}W(e)}(n,t,i),o}var N=function(){function e(t,r,n,a){if(i(this,e),!1===_(t))throw new TypeError("WritableStreamDefaultController can only be constructed with a WritableStream instance");if(void 0!==t._writableStreamController)throw new TypeError("WritableStreamDefaultController instances can only be created by the WritableStream constructor");this._controlledWritableStream=t,this._underlyingSink=r,this._queue=void 0,this._queueTotalSize=void 0,g(this),this._started=!1;var o=u(n,a);this._strategySize=o.size,this._strategyHWM=o.highWaterMark,T(t,B(this))}return n(e,[{key:"error",value:function(e){if(!1===function(e){if(!l(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_underlyingSink"))return!1;return!0}(this))throw new TypeError("WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController");"writable"===this._controlledWritableStream._state&&z(this,e)}},{key:"__abortSteps",value:function(e){return s(this._underlyingSink,"abort",[e])}},{key:"__errorSteps",value:function(){g(this)}},{key:"__startSteps",value:function(){var e=this,t=o(this._underlyingSink,"start",[this]),r=this._controlledWritableStream;Promise.resolve(t).then(function(){h("writable"===r._state||"erroring"===r._state),e._started=!0,W(e)},function(t){h("writable"===r._state||"erroring"===r._state),e._started=!0,w(r,t)}).catch(d)}}]),e}();function q(e){return e._strategyHWM-e._queueTotalSize}function W(e){var t=e._controlledWritableStream;if(!1!==e._started&&void 0===t._inFlightWriteRequest){var r=t._state;if("closed"!==r&&"errored"!==r)if("erroring"!==r){if(0!==e._queue.length){var n=m(e);"close"===n?function(e){var t=e._controlledWritableStream;(function(e){h(void 0===e._inFlightCloseRequest),h(void 0!==e._closeRequest),e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),p(e),h(0===e._queue.length,"queue must be empty once the final write record is dequeued"),s(e._underlyingSink,"close",[]).then(function(){x(t)},function(e){!function(e,t){h(void 0!==e._inFlightCloseRequest),e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,h("writable"===e._state||"erroring"===e._state),void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),w(e,t)}(t,e)}).catch(d)}(e):function(e,t){var r=e._controlledWritableStream;(function(e){h(void 0===e._inFlightWriteRequest,"there must be no pending write request"),h(0!==e._writeRequests.length,"writeRequests must not be empty"),e._inFlightWriteRequest=e._writeRequests.shift()})(r),s(e._underlyingSink,"write",[t,e]).then(function(){!function(e){h(void 0!==e._inFlightWriteRequest),e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(r);var t=r._state;if(h("writable"===t||"erroring"===t),p(e),!1===C(r)&&"writable"===t){var n=B(e);T(r,n)}W(e)},function(e){!function(e,t){h(void 0!==e._inFlightWriteRequest),e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,h("writable"===e._state||"erroring"===e._state),w(e,t)}(r,e)}).catch(d)}(e,n.chunk)}}else P(t)}}function U(e,t){"writable"===e._controlledWritableStream._state&&z(e,t)}function B(e){return q(e)<=0}function z(e,t){var r=e._controlledWritableStream;h("writable"===r._state),k(r,t)}function G(e){return new TypeError("WritableStream.prototype."+e+" can only be used on a WritableStream")}function H(e){return new TypeError("WritableStreamDefaultWriter.prototype."+e+" can only be used on a WritableStreamDefaultWriter")}function X(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function Y(e){e._closedPromise=new Promise(function(t,r){e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"})}function V(e,t){h(void 0!==e._closedPromise_resolve,"writer._closedPromise_resolve !== undefined"),h(void 0!==e._closedPromise_reject,"writer._closedPromise_reject !== undefined"),h("pending"===e._closedPromiseState,"writer._closedPromiseState is pending"),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected"}function Q(e,t){e._readyPromise=Promise.reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected"}function K(e){e._readyPromise=Promise.resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled"}function J(e){h(void 0!==e._readyPromise_resolve,"writer._readyPromise_resolve !== undefined"),h(void 0!==e._readyPromise_reject,"writer._readyPromise_reject !== undefined"),e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled"}},function(e,t,r){var n=r(0).IsFiniteNonNegativeNumber,i=r(1).assert;t.DequeueValue=function(e){i("_queue"in e&&"_queueTotalSize"in e,"Spec-level failure: DequeueValue should only be used on containers with [[queue]] and [[queueTotalSize]]."),i(e._queue.length>0,"Spec-level failure: should never dequeue from an empty queue.");var t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value},t.EnqueueValueWithSize=function(e,t,r){if(i("_queue"in e&&"_queueTotalSize"in e,"Spec-level failure: EnqueueValueWithSize should only be used on containers with [[queue]] and [[queueTotalSize]]."),r=Number(r),!n(r))throw new RangeError("Size must be a finite, non-NaN, non-negative number.");e._queue.push({value:t,size:r}),e._queueTotalSize+=r},t.PeekQueueValue=function(e){return i("_queue"in e&&"_queueTotalSize"in e,"Spec-level failure: PeekQueueValue should only be used on containers with [[queue]] and [[queueTotalSize]]."),i(e._queue.length>0,"Spec-level failure: should never peek at an empty queue."),e._queue[0].value},t.ResetQueue=function(e){i("_queue"in e&&"_queueTotalSize"in e,"Spec-level failure: ResetQueue should only be used on containers with [[queue]] and [[queueTotalSize]]."),e._queue=[],e._queueTotalSize=0}},function(e,t,r){var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=r(0),o=a.ArrayBufferCopy,s=a.CreateIterResultObject,u=a.IsFiniteNonNegativeNumber,l=a.InvokeOrNoop,c=a.PromiseInvokeOrNoop,h=a.TransferArrayBuffer,d=a.ValidateAndNormalizeQueuingStrategy,f=a.ValidateAndNormalizeHighWaterMark,p=r(0),v=p.createArrayFromList,m=p.createDataProperty,g=p.typeIsObject,y=r(1),b=y.assert,_=y.rethrowAssertionErrorRejection,A=r(3),S=A.DequeueValue,w=A.EnqueueValueWithSize,k=A.ResetQueue,P=r(2),x=P.AcquireWritableStreamDefaultWriter,C=P.IsWritableStream,R=P.IsWritableStreamLocked,E=P.WritableStreamAbort,T=P.WritableStreamDefaultWriterCloseWithErrorPropagation,O=P.WritableStreamDefaultWriterRelease,I=P.WritableStreamDefaultWriterWrite,F=P.WritableStreamCloseQueuedOrInFlight,L=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.size,a=r.highWaterMark;i(this,e),this._state="readable",this._reader=void 0,this._storedError=void 0,this._disturbed=!1,this._readableStreamController=void 0;var o=t.type;if("bytes"===String(o))void 0===a&&(a=0),this._readableStreamController=new de(this,t,a);else{if(void 0!==o)throw new RangeError("Invalid type is specified");void 0===a&&(a=1),this._readableStreamController=new ne(this,t,n,a)}}return n(e,[{key:"cancel",value:function(e){return!1===M(this)?Promise.reject(Ee("cancel")):!0===D(this)?Promise.reject(new TypeError("Cannot cancel a stream that already has a reader")):U(this,e)}},{key:"getReader",value:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).mode;if(!1===M(this))throw Ee("getReader");if(void 0===e)return j(this);if("byob"===(e=String(e)))return new K(this);throw new RangeError("Invalid mode is specified")}},{key:"pipeThrough",value:function(e,t){var r=e.writable,n=e.readable;return function(e){try{Promise.prototype.then.call(e,void 0,function(){})}catch(e){}}(this.pipeTo(r,t)),n}},{key:"pipeTo",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.preventClose,i=r.preventAbort,a=r.preventCancel;if(!1===M(this))return Promise.reject(Ee("pipeTo"));if(!1===C(e))return Promise.reject(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));if(n=Boolean(n),i=Boolean(i),a=Boolean(a),!0===D(this))return Promise.reject(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream"));if(!0===R(e))return Promise.reject(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream"));var o=j(this),s=x(e),u=!1,l=Promise.resolve();return new Promise(function(r,c){var h,d,f;if(m(t,o._closedPromise,function(t){!1===i?g(function(){return E(e,t)},!0,t):y(!0,t)}),m(e,s._closedPromise,function(e){!1===a?g(function(){return U(t,e)},!0,e):y(!0,e)}),h=t,d=o._closedPromise,f=function(){!1===n?g(function(){return T(s)}):y()},"closed"===h._state?f():d.then(f).catch(_),!0===F(e)||"closed"===e._state){var p=new TypeError("the destination writable stream closed before all data could be piped to it");!1===a?g(function(){return U(t,p)},!0,p):y(!0,p)}function v(){var e=l;return l.then(function(){return e!==l?v():void 0})}function m(e,t,r){"errored"===e._state?r(e._storedError):t.catch(r).catch(_)}function g(t,r,n){function i(){t().then(function(){return b(r,n)},function(e){return b(!0,e)}).catch(_)}!0!==u&&(u=!0,"writable"===e._state&&!1===F(e)?v().then(i):i())}function y(t,r){!0!==u&&(u=!0,"writable"===e._state&&!1===F(e)?v().then(function(){return b(t,r)}).catch(_):b(t,r))}function b(e,t){O(s),te(o),e?c(t):r(void 0)}(function e(){return l=Promise.resolve(),!0===u?Promise.resolve():s._readyPromise.then(function(){return re(o).then(function(e){var t=e.value;!0!==e.done&&(l=I(s,t).catch(function(){}))})}).then(e)})().catch(function(e){l=Promise.resolve(),_(e)})})}},{key:"tee",value:function(){if(!1===M(this))throw Ee("tee");var e=N(this,!1);return v(e)}},{key:"locked",get:function(){if(!1===M(this))throw Ee("locked");return D(this)}}]),e}();function j(e){return new Q(e)}function M(e){return!!g(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")}function D(e){return b(!0===M(e),"IsReadableStreamLocked should only be used on known readable streams"),void 0!==e._reader}function N(e,t){b(!0===M(e)),b("boolean"==typeof t);var r=j(e),n={closedOrErrored:!1,canceled1:!1,canceled2:!1,reason1:void 0,reason2:void 0};n.promise=new Promise(function(e){n._resolve=e});var i=function(){return function e(){var t=e._reader,r=e._branch1,n=e._branch2,i=e._teeState;return re(t).then(function(e){b(g(e));var t=e.value,a=e.done;if(b("boolean"==typeof a),!0===a&&!1===i.closedOrErrored&&(!1===i.canceled1&&oe(r),!1===i.canceled2&&oe(n),i.closedOrErrored=!0),!0!==i.closedOrErrored){var o=t,s=t;!1===i.canceled1&&se(r,o),!1===i.canceled2&&se(n,s)}})}}();i._reader=r,i._teeState=n,i._cloneForBranch2=t;var a=function(){return function e(t){var r=e._stream,n=e._teeState;n.canceled1=!0;n.reason1=t;if(!0===n.canceled2){var i=v([n.reason1,n.reason2]),a=U(r,i);n._resolve(a)}return n.promise}}();a._stream=e,a._teeState=n;var o=function(){return function e(t){var r=e._stream,n=e._teeState;n.canceled2=!0;n.reason2=t;if(!0===n.canceled1){var i=v([n.reason1,n.reason2]),a=U(r,i);n._resolve(a)}return n.promise}}();o._stream=e,o._teeState=n;var s=Object.create(Object.prototype);m(s,"pull",i),m(s,"cancel",a);var u=new L(s),l=Object.create(Object.prototype);m(l,"pull",i),m(l,"cancel",o);var c=new L(l);return i._branch1=u._readableStreamController,i._branch2=c._readableStreamController,r._closedPromise.catch(function(e){!0!==n.closedOrErrored&&(ue(i._branch1,e),ue(i._branch2,e),n.closedOrErrored=!0)}),[u,c]}function q(e){return b(!0===J(e._reader)),b("readable"===e._state||"closed"===e._state),new Promise(function(t,r){var n={_resolve:t,_reject:r};e._reader._readIntoRequests.push(n)})}function W(e){return b(!0===Z(e._reader)),b("readable"===e._state),new Promise(function(t,r){var n={_resolve:t,_reject:r};e._reader._readRequests.push(n)})}function U(e,t){return e._disturbed=!0,"closed"===e._state?Promise.resolve(void 0):"errored"===e._state?Promise.reject(e._storedError):(B(e),e._readableStreamController.__cancelSteps(t).then(function(){}))}function B(e){b("readable"===e._state),e._state="closed";var t=e._reader;if(void 0!==t){if(!0===Z(t)){for(var r=0;r<t._readRequests.length;r++){(0,t._readRequests[r]._resolve)(s(void 0,!0))}t._readRequests=[]}!function(e){b(void 0!==e._closedPromise_resolve),b(void 0!==e._closedPromise_reject),e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0}(t)}}function z(e,t){b(!0===M(e),"stream must be ReadableStream"),b("readable"===e._state,"state must be readable"),e._state="errored",e._storedError=t;var r=e._reader;if(void 0!==r){if(!0===Z(r)){for(var n=0;n<r._readRequests.length;n++){r._readRequests[n]._reject(t)}r._readRequests=[]}else{b(J(r),"reader must be ReadableStreamBYOBReader");for(var i=0;i<r._readIntoRequests.length;i++){r._readIntoRequests[i]._reject(t)}r._readIntoRequests=[]}Ie(r,t),r._closedPromise.catch(function(){})}}function G(e,t,r){var n=e._reader;b(n._readRequests.length>0),n._readRequests.shift()._resolve(s(t,r))}function H(e){return e._reader._readIntoRequests.length}function X(e){return e._reader._readRequests.length}function Y(e){var t=e._reader;return void 0!==t&&!1!==J(t)}function V(e){var t=e._reader;return void 0!==t&&!1!==Z(t)}e.exports={ReadableStream:L,IsReadableStreamDisturbed:function(e){return b(!0===M(e),"IsReadableStreamDisturbed should only be used on known readable streams"),e._disturbed},ReadableStreamDefaultControllerClose:oe,ReadableStreamDefaultControllerEnqueue:se,ReadableStreamDefaultControllerError:ue,ReadableStreamDefaultControllerGetDesiredSize:ce};var Q=function(){function e(t){if(i(this,e),!1===M(t))throw new TypeError("ReadableStreamDefaultReader can only be constructed with a ReadableStream instance");if(!0===D(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");$(this,t),this._readRequests=[]}return n(e,[{key:"cancel",value:function(e){return!1===Z(this)?Promise.reject(Oe("cancel")):void 0===this._ownerReadableStream?Promise.reject(Te("cancel")):ee(this,e)}},{key:"read",value:function(){return!1===Z(this)?Promise.reject(Oe("read")):void 0===this._ownerReadableStream?Promise.reject(Te("read from")):re(this)}},{key:"releaseLock",value:function(){if(!1===Z(this))throw Oe("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");te(this)}}},{key:"closed",get:function(){return!1===Z(this)?Promise.reject(Oe("closed")):this._closedPromise}}]),e}(),K=function(){function e(t){if(i(this,e),!M(t))throw new TypeError("ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a byte source");if(!1===fe(t._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");if(D(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");$(this,t),this._readIntoRequests=[]}return n(e,[{key:"cancel",value:function(e){return J(this)?void 0===this._ownerReadableStream?Promise.reject(Te("cancel")):ee(this,e):Promise.reject(Fe("cancel"))}},{key:"read",value:function(e){return J(this)?void 0===this._ownerReadableStream?Promise.reject(Te("read from")):ArrayBuffer.isView(e)?0===e.byteLength?Promise.reject(new TypeError("view must have non-zero byteLength")):function(e,t){var r=e._ownerReadableStream;if(b(void 0!==r),r._disturbed=!0,"errored"===r._state)return Promise.reject(r._storedError);return function(e,t){var r=e._controlledReadableStream,n=1;t.constructor!==DataView&&(n=t.constructor.BYTES_PER_ELEMENT);var i=t.constructor,a={buffer:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength,bytesFilled:0,elementSize:n,ctor:i,readerType:"byob"};if(e._pendingPullIntos.length>0)return a.buffer=h(a.buffer),e._pendingPullIntos.push(a),q(r);if("closed"===r._state){var o=new t.constructor(a.buffer,a.byteOffset,0);return Promise.resolve(s(o,!0))}if(e._queueTotalSize>0){if(!0===_e(e,a)){var u=ye(a);return Se(e),Promise.resolve(s(u,!1))}if(!0===e._closeRequested){var l=new TypeError("Insufficient bytes to fill elements in the given buffer");return Ce(e,l),Promise.reject(l)}}a.buffer=h(a.buffer),e._pendingPullIntos.push(a);var c=q(r);return ve(e),c}(r._readableStreamController,t)}(this,e):Promise.reject(new TypeError("view must be an array buffer view")):Promise.reject(Fe("read"))}},{key:"releaseLock",value:function(){if(!J(this))throw Fe("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");te(this)}}},{key:"closed",get:function(){return J(this)?this._closedPromise:Promise.reject(Fe("closed"))}}]),e}();function J(e){return!!g(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")}function Z(e){return!!g(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")}function $(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?function(e){e._closedPromise=new Promise(function(t,r){e._closedPromise_resolve=t,e._closedPromise_reject=r})}(e):"closed"===t._state?function(e){e._closedPromise=Promise.resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0}(e):(b("errored"===t._state,"state must be errored"),function(e,t){e._closedPromise=Promise.reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0}(e,t._storedError),e._closedPromise.catch(function(){}))}function ee(e,t){var r=e._ownerReadableStream;return b(void 0!==r),U(r,t)}function te(e){b(void 0!==e._ownerReadableStream),b(e._ownerReadableStream._reader===e),"readable"===e._ownerReadableStream._state?Ie(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e,t){b(void 0===e._closedPromise_resolve),b(void 0===e._closedPromise_reject),e._closedPromise=Promise.reject(t)}(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),e._closedPromise.catch(function(){}),e._ownerReadableStream._reader=void 0,e._ownerReadableStream=void 0}function re(e){var t=e._ownerReadableStream;return b(void 0!==t),t._disturbed=!0,"closed"===t._state?Promise.resolve(s(void 0,!0)):"errored"===t._state?Promise.reject(t._storedError):(b("readable"===t._state),t._readableStreamController.__pullSteps())}var ne=function(){function e(t,r,n,a){if(i(this,e),!1===M(t))throw new TypeError("ReadableStreamDefaultController can only be constructed with a ReadableStream instance");if(void 0!==t._readableStreamController)throw new TypeError("ReadableStreamDefaultController instances can only be created by the ReadableStream constructor");this._controlledReadableStream=t,this._underlyingSource=r,this._queue=void 0,this._queueTotalSize=void 0,k(this),this._started=!1,this._closeRequested=!1,this._pullAgain=!1,this._pulling=!1;var o=d(n,a);this._strategySize=o.size,this._strategyHWM=o.highWaterMark;var s=this,u=l(r,"start",[this]);Promise.resolve(u).then(function(){s._started=!0,b(!1===s._pulling),b(!1===s._pullAgain),ae(s)},function(e){le(s,e)}).catch(_)}return n(e,[{key:"close",value:function(){if(!1===ie(this))throw Le("close");if(!0===this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");var e=this._controlledReadableStream._state;if("readable"!==e)throw new TypeError("The stream (in "+e+" state) is not in the readable state and cannot be closed");oe(this)}},{key:"enqueue",value:function(e){if(!1===ie(this))throw Le("enqueue");if(!0===this._closeRequested)throw new TypeError("stream is closed or draining");var t=this._controlledReadableStream._state;if("readable"!==t)throw new TypeError("The stream (in "+t+" state) is not in the readable state and cannot be enqueued to");return se(this,e)}},{key:"error",value:function(e){if(!1===ie(this))throw Le("error");var t=this._controlledReadableStream;if("readable"!==t._state)throw new TypeError("The stream is "+t._state+" and so cannot be errored");ue(this,e)}},{key:"__cancelSteps",value:function(e){return k(this),c(this._underlyingSource,"cancel",[e])}},{key:"__pullSteps",value:function(){var e=this._controlledReadableStream;if(this._queue.length>0){var t=S(this);return!0===this._closeRequested&&0===this._queue.length?B(e):ae(this),Promise.resolve(s(t,!1))}var r=W(e);return ae(this),r}},{key:"desiredSize",get:function(){if(!1===ie(this))throw Le("desiredSize");return ce(this)}}]),e}();function ie(e){return!!g(e)&&!!Object.prototype.hasOwnProperty.call(e,"_underlyingSource")}function ae(e){!1!==function(e){var t=e._controlledReadableStream;if("closed"===t._state||"errored"===t._state)return!1;if(!0===e._closeRequested)return!1;if(!1===e._started)return!1;if(!0===D(t)&&X(t)>0)return!0;if(ce(e)>0)return!0;return!1}(e)&&(!0!==e._pulling?(b(!1===e._pullAgain),e._pulling=!0,c(e._underlyingSource,"pull",[e]).then(function(){if(e._pulling=!1,!0===e._pullAgain)return e._pullAgain=!1,ae(e)},function(t){le(e,t)}).catch(_)):e._pullAgain=!0)}function oe(e){var t=e._controlledReadableStream;b(!1===e._closeRequested),b("readable"===t._state),e._closeRequested=!0,0===e._queue.length&&B(t)}function se(e,t){var r=e._controlledReadableStream;if(b(!1===e._closeRequested),b("readable"===r._state),!0===D(r)&&X(r)>0)G(r,t,!1);else{var n=1;if(void 0!==e._strategySize){var i=e._strategySize;try{n=i(t)}catch(t){throw le(e,t),t}}try{w(e,t,n)}catch(t){throw le(e,t),t}}ae(e)}function ue(e,t){var r=e._controlledReadableStream;b("readable"===r._state),k(e),z(r,t)}function le(e,t){"readable"===e._controlledReadableStream._state&&ue(e,t)}function ce(e){var t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}var he=function(){function e(t,r){i(this,e),this._associatedReadableByteStreamController=t,this._view=r}return n(e,[{key:"respond",value:function(e){if(!1===pe(this))throw je("respond");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");!function(e,t){if(t=Number(t),!1===u(t))throw new RangeError("bytesWritten must be a finite");b(e._pendingPullIntos.length>0),Pe(e,t)}(this._associatedReadableByteStreamController,e)}},{key:"respondWithNewView",value:function(e){if(!1===pe(this))throw je("respond");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");!function(e,t){b(e._pendingPullIntos.length>0);var r=e._pendingPullIntos[0];if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.byteLength!==t.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");r.buffer=t.buffer,Pe(e,t.byteLength)}(this._associatedReadableByteStreamController,e)}},{key:"view",get:function(){return this._view}}]),e}(),de=function(){function e(t,r,n){if(i(this,e),!1===M(t))throw new TypeError("ReadableByteStreamController can only be constructed with a ReadableStream instance given a byte source");if(void 0!==t._readableStreamController)throw new TypeError("ReadableByteStreamController instances can only be created by the ReadableStream constructor given a byte source");this._controlledReadableStream=t,this._underlyingByteSource=r,this._pullAgain=!1,this._pulling=!1,me(this),this._queue=this._queueTotalSize=void 0,k(this),this._closeRequested=!1,this._started=!1,this._strategyHWM=f(n);var a=r.autoAllocateChunkSize;if(void 0!==a&&(!1===Number.isInteger(a)||a<=0))throw new RangeError("autoAllocateChunkSize must be a positive integer");this._autoAllocateChunkSize=a,this._pendingPullIntos=[];var o=this,s=l(r,"start",[this]);Promise.resolve(s).then(function(){o._started=!0,b(!1===o._pulling),b(!1===o._pullAgain),ve(o)},function(e){"readable"===t._state&&Ce(o,e)}).catch(_)}return n(e,[{key:"close",value:function(){if(!1===fe(this))throw Me("close");if(!0===this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");var e=this._controlledReadableStream._state;if("readable"!==e)throw new TypeError("The stream (in "+e+" state) is not in the readable state and cannot be closed");!function(e){var t=e._controlledReadableStream;if(b(!1===e._closeRequested),b("readable"===t._state),e._queueTotalSize>0)return void(e._closeRequested=!0);if(e._pendingPullIntos.length>0){var r=e._pendingPullIntos[0];if(r.bytesFilled>0){var n=new TypeError("Insufficient bytes to fill elements in the given buffer");throw Ce(e,n),n}}B(t)}(this)}},{key:"enqueue",value:function(e){if(!1===fe(this))throw Me("enqueue");if(!0===this._closeRequested)throw new TypeError("stream is closed or draining");var t=this._controlledReadableStream._state;if("readable"!==t)throw new TypeError("The stream (in "+t+" state) is not in the readable state and cannot be enqueued to");if(!ArrayBuffer.isView(e))throw new TypeError("You can only enqueue array buffer views when using a ReadableByteStreamController");!function(e,t){var r=e._controlledReadableStream;b(!1===e._closeRequested),b("readable"===r._state);var n=t.buffer,i=t.byteOffset,a=t.byteLength,o=h(n);if(!0===V(r))if(0===X(r))be(e,o,i,a);else{b(0===e._queue.length);var s=new Uint8Array(o,i,a);G(r,s,!1)}else!0===Y(r)?(be(e,o,i,a),ke(e)):(b(!1===D(r),"stream must not be locked"),be(e,o,i,a))}(this,e)}},{key:"error",value:function(e){if(!1===fe(this))throw Me("error");var t=this._controlledReadableStream;if("readable"!==t._state)throw new TypeError("The stream is "+t._state+" and so cannot be errored");Ce(this,e)}},{key:"__cancelSteps",value:function(e){this._pendingPullIntos.length>0&&(this._pendingPullIntos[0].bytesFilled=0);return k(this),c(this._underlyingByteSource,"cancel",[e])}},{key:"__pullSteps",value:function(){var e=this._controlledReadableStream;if(b(!0===V(e)),this._queueTotalSize>0){b(0===X(e));var t=this._queue.shift();this._queueTotalSize-=t.byteLength,Se(this);var r=void 0;try{r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}catch(e){return Promise.reject(e)}return Promise.resolve(s(r,!1))}var n=this._autoAllocateChunkSize;if(void 0!==n){var i=void 0;try{i=new ArrayBuffer(n)}catch(e){return Promise.reject(e)}var a={buffer:i,byteOffset:0,byteLength:n,bytesFilled:0,elementSize:1,ctor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(a)}var o=W(e);return ve(this),o}},{key:"byobRequest",get:function(){if(!1===fe(this))throw Me("byobRequest");if(void 0===this._byobRequest&&this._pendingPullIntos.length>0){var e=this._pendingPullIntos[0],t=new Uint8Array(e.buffer,e.byteOffset+e.bytesFilled,e.byteLength-e.bytesFilled);this._byobRequest=new he(this,t)}return this._byobRequest}},{key:"desiredSize",get:function(){if(!1===fe(this))throw Me("desiredSize");return Re(this)}}]),e}();function fe(e){return!!g(e)&&!!Object.prototype.hasOwnProperty.call(e,"_underlyingByteSource")}function pe(e){return!!g(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")}function ve(e){!1!==function(e){var t=e._controlledReadableStream;if("readable"!==t._state)return!1;if(!0===e._closeRequested)return!1;if(!1===e._started)return!1;if(!0===V(t)&&X(t)>0)return!0;if(!0===Y(t)&&H(t)>0)return!0;if(Re(e)>0)return!0;return!1}(e)&&(!0!==e._pulling?(b(!1===e._pullAgain),e._pulling=!0,c(e._underlyingByteSource,"pull",[e]).then(function(){e._pulling=!1,!0===e._pullAgain&&(e._pullAgain=!1,ve(e))},function(t){"readable"===e._controlledReadableStream._state&&Ce(e,t)}).catch(_)):e._pullAgain=!0)}function me(e){we(e),e._pendingPullIntos=[]}function ge(e,t){b("errored"!==e._state,"state must not be errored");var r=!1;"closed"===e._state&&(b(0===t.bytesFilled),r=!0);var n=ye(t);"default"===t.readerType?G(e,n,r):(b("byob"===t.readerType),function(e,t,r){var n=e._reader;b(n._readIntoRequests.length>0),n._readIntoRequests.shift()._resolve(s(t,r))}(e,n,r))}function ye(e){var t=e.bytesFilled,r=e.elementSize;return b(t<=e.byteLength),b(t%r==0),new e.ctor(e.buffer,e.byteOffset,t/r)}function be(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function _e(e,t){var r=t.elementSize,n=t.bytesFilled-t.bytesFilled%r,i=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),a=t.bytesFilled+i,s=a-a%r,u=i,l=!1;s>n&&(u=s-t.bytesFilled,l=!0);for(var c=e._queue;u>0;){var h=c[0],d=Math.min(u,h.byteLength),f=t.byteOffset+t.bytesFilled;o(t.buffer,f,h.buffer,h.byteOffset,d),h.byteLength===d?c.shift():(h.byteOffset+=d,h.byteLength-=d),e._queueTotalSize-=d,Ae(e,d,t),u-=d}return!1===l&&(b(0===e._queueTotalSize,"queue must be empty"),b(t.bytesFilled>0),b(t.bytesFilled<t.elementSize)),l}function Ae(e,t,r){b(0===e._pendingPullIntos.length||e._pendingPullIntos[0]===r),we(e),r.bytesFilled+=t}function Se(e){b("readable"===e._controlledReadableStream._state),0===e._queueTotalSize&&!0===e._closeRequested?B(e._controlledReadableStream):ve(e)}function we(e){void 0!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=void 0,e._byobRequest=void 0)}function ke(e){for(b(!1===e._closeRequested);e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;var t=e._pendingPullIntos[0];!0===_e(e,t)&&(xe(e),ge(e._controlledReadableStream,t))}}function Pe(e,t){var r=e._pendingPullIntos[0],n=e._controlledReadableStream;if("closed"===n._state){if(0!==t)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream");!function(e,t){t.buffer=h(t.buffer),b(0===t.bytesFilled,"bytesFilled must be 0");var r=e._controlledReadableStream;if(!0===Y(r))for(;H(r)>0;)ge(r,xe(e))}(e,r)}else b("readable"===n._state),function(e,t,r){if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range");if(Ae(e,t,r),!(r.bytesFilled<r.elementSize)){xe(e);var n=r.bytesFilled%r.elementSize;if(n>0){var i=r.byteOffset+r.bytesFilled,a=r.buffer.slice(i-n,i);be(e,a,0,a.byteLength)}r.buffer=h(r.buffer),r.bytesFilled-=n,ge(e._controlledReadableStream,r),ke(e)}}(e,t,r)}function xe(e){var t=e._pendingPullIntos.shift();return we(e),t}function Ce(e,t){var r=e._controlledReadableStream;b("readable"===r._state),me(e),k(e),z(r,t)}function Re(e){var t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Ee(e){return new TypeError("ReadableStream.prototype."+e+" can only be used on a ReadableStream")}function Te(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function Oe(e){return new TypeError("ReadableStreamDefaultReader.prototype."+e+" can only be used on a ReadableStreamDefaultReader")}function Ie(e,t){b(void 0!==e._closedPromise_resolve),b(void 0!==e._closedPromise_reject),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0}function Fe(e){return new TypeError("ReadableStreamBYOBReader.prototype."+e+" can only be used on a ReadableStreamBYOBReader")}function Le(e){return new TypeError("ReadableStreamDefaultController.prototype."+e+" can only be used on a ReadableStreamDefaultController")}function je(e){return new TypeError("ReadableStreamBYOBRequest.prototype."+e+" can only be used on a ReadableStreamBYOBRequest")}function Me(e){return new TypeError("ReadableByteStreamController.prototype."+e+" can only be used on a ReadableByteStreamController")}},function(e,t,r){var n=r(6),i=r(4),a=r(2);t.TransformStream=n.TransformStream,t.ReadableStream=i.ReadableStream,t.IsReadableStreamDisturbed=i.IsReadableStreamDisturbed,t.ReadableStreamDefaultControllerClose=i.ReadableStreamDefaultControllerClose,t.ReadableStreamDefaultControllerEnqueue=i.ReadableStreamDefaultControllerEnqueue,t.ReadableStreamDefaultControllerError=i.ReadableStreamDefaultControllerError,t.ReadableStreamDefaultControllerGetDesiredSize=i.ReadableStreamDefaultControllerGetDesiredSize,t.AcquireWritableStreamDefaultWriter=a.AcquireWritableStreamDefaultWriter,t.IsWritableStream=a.IsWritableStream,t.IsWritableStreamLocked=a.IsWritableStreamLocked,t.WritableStream=a.WritableStream,t.WritableStreamAbort=a.WritableStreamAbort,t.WritableStreamDefaultControllerError=a.WritableStreamDefaultControllerError,t.WritableStreamDefaultWriterCloseWithErrorPropagation=a.WritableStreamDefaultWriterCloseWithErrorPropagation,t.WritableStreamDefaultWriterRelease=a.WritableStreamDefaultWriterRelease,t.WritableStreamDefaultWriterWrite=a.WritableStreamDefaultWriterWrite},function(e,t,r){var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=r(1).assert,o=r(0),s=o.InvokeOrNoop,u=o.PromiseInvokeOrPerformFallback,l=o.PromiseInvokeOrNoop,c=o.typeIsObject,h=r(4),d=h.ReadableStream,f=h.ReadableStreamDefaultControllerClose,p=h.ReadableStreamDefaultControllerEnqueue,v=h.ReadableStreamDefaultControllerError,m=h.ReadableStreamDefaultControllerGetDesiredSize,g=r(2),y=g.WritableStream,b=g.WritableStreamDefaultControllerError;function _(e,t){if(!0===e._errored)throw new TypeError("TransformStream is already errored");if(!0===e._readableClosed)throw new TypeError("Readable side is already closed");var r=e._readableController;try{p(r,t)}catch(t){throw e._readableClosed=!0,S(e,t),e._storedError}!0===m(r)<=0&&!1===e._backpressure&&P(e,!0)}function A(e){a(!1===e._errored),a(!1===e._readableClosed);try{f(e._readableController)}catch(e){a(!1)}e._readableClosed=!0}function S(e,t){!1===e._errored&&w(e,t)}function w(e,t){a(!1===e._errored),e._errored=!0,e._storedError=t,!1===e._writableDone&&b(e._writableController,t),!1===e._readableClosed&&v(e._readableController,t)}function k(e){return a(void 0!==e._backpressureChangePromise,"_backpressureChangePromise should have been initialized"),!1===e._backpressure?Promise.resolve():(a(!0===e._backpressure,"_backpressure should have been initialized"),e._backpressureChangePromise)}function P(e,t){a(e._backpressure!==t,"TransformStreamSetBackpressure() should be called only when backpressure is changed"),void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(t),e._backpressureChangePromise=new Promise(function(t){e._backpressureChangePromise_resolve=t}),e._backpressureChangePromise.then(function(e){a(e!==t,"_backpressureChangePromise should be fulfilled only when backpressure is changed")}),e._backpressure=t}function x(e,t){return _(t._controlledTransformStream,e),Promise.resolve()}function C(e){return!!c(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")}function R(e){return!!c(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")}var E=function(){function e(t,r){i(this,e),this._transformStream=t,this._startPromise=r}return n(e,[{key:"start",value:function(e){var t=this._transformStream;return t._writableController=e,this._startPromise.then(function(){return k(t)})}},{key:"write",value:function(e){return function(e,t){a(!1===e._errored),a(!1===e._transforming),a(!1===e._backpressure),e._transforming=!0;var r=e._transformer,n=e._transformStreamController;return u(r,"transform",[t,n],x,[t,n]).then(function(){return e._transforming=!1,k(e)},function(t){return S(e,t),Promise.reject(t)})}(this._transformStream,e)}},{key:"abort",value:function(){var e=this._transformStream;e._writableDone=!0,w(e,new TypeError("Writable side aborted"))}},{key:"close",value:function(){var e=this._transformStream;return a(!1===e._transforming),e._writableDone=!0,l(e._transformer,"flush",[e._transformStreamController]).then(function(){return!0===e._errored?Promise.reject(e._storedError):(!1===e._readableClosed&&A(e),Promise.resolve())}).catch(function(t){return S(e,t),Promise.reject(e._storedError)})}}]),e}(),T=function(){function e(t,r){i(this,e),this._transformStream=t,this._startPromise=r}return n(e,[{key:"start",value:function(e){var t=this._transformStream;return t._readableController=e,this._startPromise.then(function(){return a(void 0!==t._backpressureChangePromise,"_backpressureChangePromise should have been initialized"),!0===t._backpressure?Promise.resolve():(a(!1===t._backpressure,"_backpressure should have been initialized"),t._backpressureChangePromise)})}},{key:"pull",value:function(){var e=this._transformStream;return a(!0===e._backpressure,"pull() should be never called while _backpressure is false"),a(void 0!==e._backpressureChangePromise,"_backpressureChangePromise should have been initialized"),P(e,!1),e._backpressureChangePromise}},{key:"cancel",value:function(){var e=this._transformStream;e._readableClosed=!0,w(e,new TypeError("Readable side canceled"))}}]),e}(),O=function(){function e(t){if(i(this,e),!1===R(t))throw new TypeError("TransformStreamDefaultController can only be constructed with a TransformStream instance");if(void 0!==t._transformStreamController)throw new TypeError("TransformStreamDefaultController instances can only be created by the TransformStream constructor");this._controlledTransformStream=t}return n(e,[{key:"enqueue",value:function(e){if(!1===C(this))throw F("enqueue");_(this._controlledTransformStream,e)}},{key:"close",value:function(){if(!1===C(this))throw F("close");!function(e){if(!0===e._errored)throw new TypeError("TransformStream is already errored");if(!0===e._readableClosed)throw new TypeError("Readable side is already closed");A(e)}(this._controlledTransformStream)}},{key:"error",value:function(e){if(!1===C(this))throw F("error");!function(e,t){if(!0===e._errored)throw new TypeError("TransformStream is already errored");w(e,t)}(this._controlledTransformStream,e)}},{key:"desiredSize",get:function(){if(!1===C(this))throw F("desiredSize");var e=this._controlledTransformStream._readableController;return m(e)}}]),e}(),I=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e),this._transformer=t;var r=t.readableStrategy,n=t.writableStrategy;this._transforming=!1,this._errored=!1,this._storedError=void 0,this._writableController=void 0,this._readableController=void 0,this._transformStreamController=void 0,this._writableDone=!1,this._readableClosed=!1,this._backpressure=void 0,this._backpressureChangePromise=void 0,this._backpressureChangePromise_resolve=void 0,this._transformStreamController=new O(this);var o=void 0,u=new Promise(function(e){o=e}),l=new T(this,u);this._readable=new d(l,r);var c=new E(this,u);this._writable=new y(c,n),a(void 0!==this._writableController),a(void 0!==this._readableController),P(this,m(this._readableController)<=0);var h=this,f=s(t,"start",[h._transformStreamController]);o(f),u.catch(function(e){!1===h._errored&&(h._errored=!0,h._storedError=e)})}return n(e,[{key:"readable",get:function(){if(!1===R(this))throw L("readable");return this._readable}},{key:"writable",get:function(){if(!1===R(this))throw L("writable");return this._writable}}]),e}();function F(e){return new TypeError("TransformStreamDefaultController.prototype."+e+" can only be used on a TransformStreamDefaultController")}function L(e){return new TypeError("TransformStream.prototype."+e+" can only be used on a TransformStream")}e.exports={TransformStream:I}},function(e,t,r){e.exports=r(5)}]))},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=!1;try{if("function"==typeof URL&&"object"===n(URL.prototype)&&"origin"in URL.prototype){var a=new URL("b","http://a");a.pathname="c%20d",i="http://a/c%20d"===a.href}}catch(e){}if(i)t.URL=URL;else{var o=r(128).URL,s=r(3).URL;s&&(o.createObjectURL=function(e){return s.createObjectURL.apply(s,arguments)},o.revokeObjectURL=function(e){s.revokeObjectURL(e)}),t.URL=o}},function(e,t,r){"use strict";!function(){var e=Object.create(null);e.ftp=21,e.file=0,e.gopher=70,e.http=80,e.https=443,e.ws=80,e.wss=443;var r=Object.create(null);function n(t){return void 0!==e[t]}function i(){d.call(this),this._isInvalid=!0}function a(e){return""===e&&i.call(this),e.toLowerCase()}function o(e){var t=e.charCodeAt(0);return t>32&&t<127&&-1===[34,35,60,62,63,96].indexOf(t)?e:encodeURIComponent(e)}function s(e){var t=e.charCodeAt(0);return t>32&&t<127&&-1===[34,35,60,62,96].indexOf(t)?e:encodeURIComponent(e)}r["%2e"]=".",r[".%2e"]="..",r["%2e."]="..",r["%2e%2e"]="..";var u,l=/[a-zA-Z]/,c=/[a-zA-Z0-9\+\-\.]/;function h(t,h,d){function f(e){b.push(e)}var p=h||"scheme start",v=0,m="",g=!1,y=!1,b=[];e:for(;(t[v-1]!==u||0===v)&&!this._isInvalid;){var _=t[v];switch(p){case"scheme start":if(!_||!l.test(_)){if(h){f("Invalid scheme.");break e}m="",p="no scheme";continue}m+=_.toLowerCase(),p="scheme";break;case"scheme":if(_&&c.test(_))m+=_.toLowerCase();else{if(":"!==_){if(h){if(_===u)break e;f("Code point not allowed in scheme: "+_);break e}m="",v=0,p="no scheme";continue}if(this._scheme=m,m="",h)break e;n(this._scheme)&&(this._isRelative=!0),p="file"===this._scheme?"relative":this._isRelative&&d&&d._scheme===this._scheme?"relative or authority":this._isRelative?"authority first slash":"scheme data"}break;case"scheme data":"?"===_?(this._query="?",p="query"):"#"===_?(this._fragment="#",p="fragment"):_!==u&&"\t"!==_&&"\n"!==_&&"\r"!==_&&(this._schemeData+=o(_));break;case"no scheme":if(d&&n(d._scheme)){p="relative";continue}f("Missing scheme."),i.call(this);break;case"relative or authority":if("/"!==_||"/"!==t[v+1]){f("Expected /, got: "+_),p="relative";continue}p="authority ignore slashes";break;case"relative":if(this._isRelative=!0,"file"!==this._scheme&&(this._scheme=d._scheme),_===u){this._host=d._host,this._port=d._port,this._path=d._path.slice(),this._query=d._query,this._username=d._username,this._password=d._password;break e}if("/"===_||"\\"===_)"\\"===_&&f("\\ is an invalid code point."),p="relative slash";else if("?"===_)this._host=d._host,this._port=d._port,this._path=d._path.slice(),this._query="?",this._username=d._username,this._password=d._password,p="query";else{if("#"!==_){var A=t[v+1],S=t[v+2];("file"!==this._scheme||!l.test(_)||":"!==A&&"|"!==A||S!==u&&"/"!==S&&"\\"!==S&&"?"!==S&&"#"!==S)&&(this._host=d._host,this._port=d._port,this._username=d._username,this._password=d._password,this._path=d._path.slice(),this._path.pop()),p="relative path";continue}this._host=d._host,this._port=d._port,this._path=d._path.slice(),this._query=d._query,this._fragment="#",this._username=d._username,this._password=d._password,p="fragment"}break;case"relative slash":if("/"!==_&&"\\"!==_){"file"!==this._scheme&&(this._host=d._host,this._port=d._port,this._username=d._username,this._password=d._password),p="relative path";continue}"\\"===_&&f("\\ is an invalid code point."),p="file"===this._scheme?"file host":"authority ignore slashes";break;case"authority first slash":if("/"!==_){f("Expected '/', got: "+_),p="authority ignore slashes";continue}p="authority second slash";break;case"authority second slash":if(p="authority ignore slashes","/"!==_){f("Expected '/', got: "+_);continue}break;case"authority ignore slashes":if("/"!==_&&"\\"!==_){p="authority";continue}f("Expected authority, got: "+_);break;case"authority":if("@"===_){g&&(f("@ already seen."),m+="%40"),g=!0;for(var w=0;w<m.length;w++){var k=m[w];if("\t"!==k&&"\n"!==k&&"\r"!==k)if(":"!==k||null!==this._password){var P=o(k);null!==this._password?this._password+=P:this._username+=P}else this._password="";else f("Invalid whitespace in authority.")}m=""}else{if(_===u||"/"===_||"\\"===_||"?"===_||"#"===_){v-=m.length,m="",p="host";continue}m+=_}break;case"file host":if(_===u||"/"===_||"\\"===_||"?"===_||"#"===_){2!==m.length||!l.test(m[0])||":"!==m[1]&&"|"!==m[1]?0===m.length?p="relative path start":(this._host=a.call(this,m),m="",p="relative path start"):p="relative path";continue}"\t"===_||"\n"===_||"\r"===_?f("Invalid whitespace in file host."):m+=_;break;case"host":case"hostname":if(":"!==_||y){if(_===u||"/"===_||"\\"===_||"?"===_||"#"===_){if(this._host=a.call(this,m),m="",p="relative path start",h)break e;continue}"\t"!==_&&"\n"!==_&&"\r"!==_?("["===_?y=!0:"]"===_&&(y=!1),m+=_):f("Invalid code point in host/hostname: "+_)}else if(this._host=a.call(this,m),m="",p="port","hostname"===h)break e;break;case"port":if(/[0-9]/.test(_))m+=_;else{if(_===u||"/"===_||"\\"===_||"?"===_||"#"===_||h){if(""!==m){var x=parseInt(m,10);x!==e[this._scheme]&&(this._port=x+""),m=""}if(h)break e;p="relative path start";continue}"\t"===_||"\n"===_||"\r"===_?f("Invalid code point in port: "+_):i.call(this)}break;case"relative path start":if("\\"===_&&f("'\\' not allowed in path."),p="relative path","/"!==_&&"\\"!==_)continue;break;case"relative path":var C;if(_!==u&&"/"!==_&&"\\"!==_&&(h||"?"!==_&&"#"!==_))"\t"!==_&&"\n"!==_&&"\r"!==_&&(m+=o(_));else"\\"===_&&f("\\ not allowed in relative path."),(C=r[m.toLowerCase()])&&(m=C),".."===m?(this._path.pop(),"/"!==_&&"\\"!==_&&this._path.push("")):"."===m&&"/"!==_&&"\\"!==_?this._path.push(""):"."!==m&&("file"===this._scheme&&0===this._path.length&&2===m.length&&l.test(m[0])&&"|"===m[1]&&(m=m[0]+":"),this._path.push(m)),m="","?"===_?(this._query="?",p="query"):"#"===_&&(this._fragment="#",p="fragment");break;case"query":h||"#"!==_?_!==u&&"\t"!==_&&"\n"!==_&&"\r"!==_&&(this._query+=s(_)):(this._fragment="#",p="fragment");break;case"fragment":_!==u&&"\t"!==_&&"\n"!==_&&"\r"!==_&&(this._fragment+=_)}v++}}function d(){this._scheme="",this._schemeData="",this._username="",this._password=null,this._host="",this._port="",this._path=[],this._query="",this._fragment="",this._isInvalid=!1,this._isRelative=!1}function f(e,t){void 0===t||t instanceof f||(t=new f(String(t))),this._url=e,d.call(this);var r=e.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g,"");h.call(this,r,null,t)}f.prototype={toString:function(){return this.href},get href(){if(this._isInvalid)return this._url;var e="";return""===this._username&&null===this._password||(e=this._username+(null!==this._password?":"+this._password:"")+"@"),this.protocol+(this._isRelative?"//"+e+this.host:"")+this.pathname+this._query+this._fragment},set href(e){d.call(this),h.call(this,e)},get protocol(){return this._scheme+":"},set protocol(e){this._isInvalid||h.call(this,e+":","scheme start")},get host(){return this._isInvalid?"":this._port?this._host+":"+this._port:this._host},set host(e){!this._isInvalid&&this._isRelative&&h.call(this,e,"host")},get hostname(){return this._host},set hostname(e){!this._isInvalid&&this._isRelative&&h.call(this,e,"hostname")},get port(){return this._port},set port(e){!this._isInvalid&&this._isRelative&&h.call(this,e,"port")},get pathname(){return this._isInvalid?"":this._isRelative?"/"+this._path.join("/"):this._schemeData},set pathname(e){!this._isInvalid&&this._isRelative&&(this._path=[],h.call(this,e,"relative path start"))},get search(){return this._isInvalid||!this._query||"?"===this._query?"":this._query},set search(e){!this._isInvalid&&this._isRelative&&(this._query="?","?"===e[0]&&(e=e.slice(1)),h.call(this,e,"query"))},get hash(){return this._isInvalid||!this._fragment||"#"===this._fragment?"":this._fragment},set hash(e){this._isInvalid||(this._fragment="#","#"===e[0]&&(e=e.slice(1)),h.call(this,e,"fragment"))},get origin(){var e;if(this._isInvalid||!this._scheme)return"";switch(this._scheme){case"data":case"file":case"javascript":case"mailto":return"null";case"blob":try{return new f(this._schemeData).origin||"null"}catch(e){}return"null"}return(e=this.host)?this._scheme+"://"+e:""}},t.URL=f}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.build=t.version=t.setPDFNetworkStreamFactory=t.PDFPageProxy=t.PDFDocumentProxy=t.PDFWorker=t.PDFDataRangeTransport=t.LoopbackPort=t.getDocument=void 0;var n,i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(i)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=r(1),u=r(130),l=r(131),c=r(132),h=r(133),d=r(3),f=(n=d)&&n.__esModule?n:{default:n},p=r(135),v=r(136),m=r(141),g=r(143),y=r(144);function b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _=65536,A=!1,S=void 0,w=null,k=!1;"undefined"==typeof window?(A=!0,void 0===require.ensure&&(require.ensure=require("node-ensure")),k=!0):"undefined"!=typeof require&&"function"==typeof require.ensure&&(k=!0),"undefined"!=typeof requirejs&&requirejs.toUrl&&(S=requirejs.toUrl("pdfjs-dist/build/pdf.worker.js"));var P,x="undefined"!=typeof requirejs&&requirejs.load;if(w=k?function(){return new Promise(function(e,t){require.ensure([],function(){try{var r;r=require("./pdf.worker.js"),e(r.WorkerMessageHandler)}catch(e){t(e)}},t,"pdfjsWorker")})}:x?function(){return new Promise(function(e,t){requirejs(["pdfjs-dist/build/pdf.worker"],function(r){try{e(r.WorkerMessageHandler)}catch(e){t(e)}},t)})}:null,!S&&"undefined"!=typeof document){var C=document.currentScript&&document.currentScript.src;C&&(S=C.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}var R=function(){var e=0;function t(){this._capability=(0,s.createPromiseCapability)(),this._transport=null,this._worker=null,this.docId="d"+e++,this.destroyed=!1,this.onPassword=null,this.onProgress=null,this.onUnsupportedFeature=null}return t.prototype={get promise(){return this._capability.promise},destroy:function(){var e=this;return this.destroyed=!0,(this._transport?this._transport.destroy():Promise.resolve()).then(function(){e._transport=null,e._worker&&(e._worker.destroy(),e._worker=null)})},then:function(e,t){return this.promise.then.apply(this.promise,arguments)}},t}(),E=function(){function e(t,r){b(this,e),this.length=t,this.initialData=r,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._readyCapability=(0,s.createPromiseCapability)()}return a(e,[{key:"addRangeListener",value:function(e){this._rangeListeners.push(e)}},{key:"addProgressListener",value:function(e){this._progressListeners.push(e)}},{key:"addProgressiveReadListener",value:function(e){this._progressiveReadListeners.push(e)}},{key:"onDataRange",value:function(e,t){var r=!0,n=!1,i=void 0;try{for(var a,o=this._rangeListeners[Symbol.iterator]();!(r=(a=o.next()).done);r=!0){(0,a.value)(e,t)}}catch(e){n=!0,i=e}finally{try{!r&&o.return&&o.return()}finally{if(n)throw i}}}},{key:"onDataProgress",value:function(e){var t=this;this._readyCapability.promise.then(function(){var r=!0,n=!1,i=void 0;try{for(var a,o=t._progressListeners[Symbol.iterator]();!(r=(a=o.next()).done);r=!0){(0,a.value)(e)}}catch(e){n=!0,i=e}finally{try{!r&&o.return&&o.return()}finally{if(n)throw i}}})}},{key:"onDataProgressiveRead",value:function(e){var t=this;this._readyCapability.promise.then(function(){var r=!0,n=!1,i=void 0;try{for(var a,o=t._progressiveReadListeners[Symbol.iterator]();!(r=(a=o.next()).done);r=!0){(0,a.value)(e)}}catch(e){n=!0,i=e}finally{try{!r&&o.return&&o.return()}finally{if(n)throw i}}})}},{key:"transportReady",value:function(){this._readyCapability.resolve()}},{key:"requestDataRange",value:function(e,t){(0,s.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}},{key:"abort",value:function(){}}]),e}(),T=function(){function e(t,r,n){b(this,e),this.loadingTask=n,this._pdfInfo=t,this._transport=r}return a(e,[{key:"getPage",value:function(e){return this._transport.getPage(e)}},{key:"getPageIndex",value:function(e){return this._transport.getPageIndex(e)}},{key:"getDestinations",value:function(){return this._transport.getDestinations()}},{key:"getDestination",value:function(e){return this._transport.getDestination(e)}},{key:"getPageLabels",value:function(){return this._transport.getPageLabels()}},{key:"getPageMode",value:function(){return this._transport.getPageMode()}},{key:"getAttachments",value:function(){return this._transport.getAttachments()}},{key:"getJavaScript",value:function(){return this._transport.getJavaScript()}},{key:"getOutline",value:function(){return this._transport.getOutline()}},{key:"getPermissions",value:function(){return this._transport.getPermissions()}},{key:"getMetadata",value:function(){return this._transport.getMetadata()}},{key:"getData",value:function(){return this._transport.getData()}},{key:"getDownloadInfo",value:function(){return this._transport.downloadInfoCapability.promise}},{key:"getStats",value:function(){return this._transport.getStats()}},{key:"cleanup",value:function(){this._transport.startCleanup()}},{key:"destroy",value:function(){return this.loadingTask.destroy()}},{key:"numPages",get:function(){return this._pdfInfo.numPages}},{key:"fingerprint",get:function(){return this._pdfInfo.fingerprint}},{key:"loadingParams",get:function(){return this._transport.loadingParams}}]),e}(),O=function(){function e(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.pageIndex=e,this._pageInfo=t,this.transport=r,this._stats=n?new u.StatTimer:u.DummyStatTimer,this._pdfBug=n,this.commonObjs=r.commonObjs,this.objs=new j,this.cleanupAfterRender=!1,this.pendingCleanup=!1,this.intentStates=Object.create(null),this.destroyed=!1}return e.prototype={get pageNumber(){return this.pageIndex+1},get rotate(){return this._pageInfo.rotate},get ref(){return this._pageInfo.ref},get userUnit(){return this._pageInfo.userUnit},get view(){return this._pageInfo.view},getViewport:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.rotate,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return new u.PageViewport({viewBox:this.view,scale:e,rotation:t,dontFlip:r})},getAnnotations:function(e){var t=e&&e.intent||null;return this.annotationsPromise&&this.annotationsIntent===t||(this.annotationsPromise=this.transport.getAnnotations(this.pageIndex,t),this.annotationsIntent=t),this.annotationsPromise},render:function(e){var t=this,r=this._stats;r.time("Overall"),this.pendingCleanup=!1;var n="print"===e.intent?"print":"display",i=e.canvasFactory||new u.DOMCanvasFactory,a=new y.WebGLContext({enable:e.enableWebGL});this.intentStates[n]||(this.intentStates[n]=Object.create(null));var o=this.intentStates[n];o.displayReadyCapability||(o.receivingOperatorList=!0,o.displayReadyCapability=(0,s.createPromiseCapability)(),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1},r.time("Page Request"),this.transport.messageHandler.send("RenderPageRequest",{pageIndex:this.pageNumber-1,intent:n,renderInteractiveForms:!0===e.renderInteractiveForms}));var l=function(e){var n=o.renderTasks.indexOf(c);n>=0&&o.renderTasks.splice(n,1),t.cleanupAfterRender&&(t.pendingCleanup=!0),t._tryCleanup(),e?c.capability.reject(e):c.capability.resolve(),r.timeEnd("Rendering"),r.timeEnd("Overall")},c=new D(l,e,this.objs,this.commonObjs,o.operatorList,this.pageNumber,i,a,this._pdfBug);c.useRequestAnimationFrame="print"!==n,o.renderTasks||(o.renderTasks=[]),o.renderTasks.push(c);var h=c.task;return o.displayReadyCapability.promise.then(function(e){t.pendingCleanup?l():(r.time("Rendering"),c.initializeGraphics(e),c.operatorListChanged())}).catch(l),h},getOperatorList:function(){this.intentStates.oplist||(this.intentStates.oplist=Object.create(null));var e,t=this.intentStates.oplist;return t.opListReadCapability||((e={}).operatorListChanged=function(){if(t.operatorList.lastChunk){t.opListReadCapability.resolve(t.operatorList);var r=t.renderTasks.indexOf(e);r>=0&&t.renderTasks.splice(r,1)}},t.receivingOperatorList=!0,t.opListReadCapability=(0,s.createPromiseCapability)(),t.renderTasks=[],t.renderTasks.push(e),t.operatorList={fnArray:[],argsArray:[],lastChunk:!1},this._stats.time("Page Request"),this.transport.messageHandler.send("RenderPageRequest",{pageIndex:this.pageIndex,intent:"oplist"})),t.opListReadCapability.promise},streamTextContent:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this.pageNumber-1,normalizeWhitespace:!0===e.normalizeWhitespace,combineTextItems:!0!==e.disableCombineTextItems},{highWaterMark:100,size:function(e){return e.items.length}})},getTextContent:function(e){e=e||{};var t=this.streamTextContent(e);return new Promise(function(e,r){var n=t.getReader(),i={items:[],styles:Object.create(null)};!function t(){n.read().then(function(r){var n,a=r.value;r.done?e(i):(Object.assign(i.styles,a.styles),(n=i.items).push.apply(n,function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}(a.items)),t())},r)}()})},_destroy:function(){this.destroyed=!0,this.transport.pageCache[this.pageIndex]=null;var e=[];return Object.keys(this.intentStates).forEach(function(t){"oplist"!==t&&this.intentStates[t].renderTasks.forEach(function(t){var r=t.capability.promise.catch(function(){});e.push(r),t.cancel()})},this),this.objs.clear(),this.annotationsPromise=null,this.pendingCleanup=!1,Promise.all(e)},cleanup:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.pendingCleanup=!0,this._tryCleanup(e)},_tryCleanup:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.pendingCleanup&&!Object.keys(this.intentStates).some(function(e){var t=this.intentStates[e];return 0!==t.renderTasks.length||t.receivingOperatorList},this)&&(Object.keys(this.intentStates).forEach(function(e){delete this.intentStates[e]},this),this.objs.clear(),this.annotationsPromise=null,e&&this._stats instanceof u.StatTimer&&(this._stats=new u.StatTimer),this.pendingCleanup=!1)},_startRenderPage:function(e,t){var r=this.intentStates[t];r.displayReadyCapability&&r.displayReadyCapability.resolve(e)},_renderPageChunk:function(e,t){var r,n,i=this.intentStates[t];for(r=0,n=e.length;r<n;r++)i.operatorList.fnArray.push(e.fnArray[r]),i.operatorList.argsArray.push(e.argsArray[r]);for(i.operatorList.lastChunk=e.lastChunk,r=0;r<i.renderTasks.length;r++)i.renderTasks[r].operatorListChanged();e.lastChunk&&(i.receivingOperatorList=!1,this._tryCleanup())},get stats(){return this._stats instanceof u.StatTimer?this._stats:null}},e}(),I=function(){function e(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];b(this,e),this._listeners=[],this._defer=t,this._deferred=Promise.resolve(void 0)}return a(e,[{key:"postMessage",value:function(e,t){var r=this;if(this._defer){var n=new WeakMap,i={data:function e(r){if("object"!==(void 0===r?"undefined":o(r))||null===r)return r;if(n.has(r))return n.get(r);var i,a;if((a=r.buffer)&&(0,s.isArrayBuffer)(a)){var u=t&&t.includes(a);return i=r===a?r:u?new r.constructor(a,r.byteOffset,r.byteLength):new r.constructor(r),n.set(r,i),i}for(var l in i=Array.isArray(r)?[]:{},n.set(r,i),r){for(var c,h=r;!(c=Object.getOwnPropertyDescriptor(h,l));)h=Object.getPrototypeOf(h);void 0!==c.value&&"function"!=typeof c.value&&(i[l]=e(c.value))}return i}(e)};this._deferred.then(function(){r._listeners.forEach(function(e){e.call(this,i)},r)})}else this._listeners.forEach(function(t){t.call(this,{data:e})},this)}},{key:"addEventListener",value:function(e,t){this._listeners.push(t)}},{key:"removeEventListener",value:function(e,t){var r=this._listeners.indexOf(t);this._listeners.splice(r,1)}},{key:"terminate",value:function(){this._listeners=[]}}]),e}(),F=function(){var e=0;function t(){if(p.GlobalWorkerOptions.workerSrc)return p.GlobalWorkerOptions.workerSrc;if(void 0!==S)return S;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}function r(){try{if("undefined"!=typeof window)return window.pdfjsWorker&&window.pdfjsWorker.WorkerMessageHandler}catch(e){}return null}var n=void 0;var i=new WeakMap;function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.name,r=void 0===t?null:t,n=e.port,a=void 0===n?null:n,o=e.postMessageTransfers,u=void 0===o||o,l=e.verbosity,c=void 0===l?(0,s.getVerbosityLevel)():l;if(a&&i.has(a))throw new Error("Cannot use more than one PDFWorker per port");if(this.name=r,this.destroyed=!1,this.postMessageTransfers=!1!==u,this.verbosity=c,this._readyCapability=(0,s.createPromiseCapability)(),this._port=null,this._webWorker=null,this._messageHandler=null,a)return i.set(a,this),void this._initializeFromPort(a);this._initialize()}return a.prototype={get promise(){return this._readyCapability.promise},get port(){return this._port},get messageHandler(){return this._messageHandler},_initializeFromPort:function(e){this._port=e,this._messageHandler=new v.MessageHandler("main","worker",e),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve()},_initialize:function(){var e,n,i=this;if("undefined"!=typeof Worker&&!A&&!r()){var a=t();try{(0,s.isSameOrigin)(window.location.href,a)||(e=new s.URL(a,window.location).href,n="importScripts('"+e+"');",a=s.URL.createObjectURL(new Blob([n])));var o=new Worker(a),u=new v.MessageHandler("main","worker",o),l=function(){o.removeEventListener("error",c),u.destroy(),o.terminate(),i.destroyed?i._readyCapability.reject(new Error("Worker was destroyed")):i._setupFakeWorker()},c=function(){i._webWorker||l()};o.addEventListener("error",c),u.on("test",function(e){o.removeEventListener("error",c),i.destroyed?l():e&&e.supportTypedArray?(i._messageHandler=u,i._port=o,i._webWorker=o,e.supportTransfers||(i.postMessageTransfers=!1),i._readyCapability.resolve(),u.send("configure",{verbosity:i.verbosity})):(i._setupFakeWorker(),u.destroy(),o.terminate())}),u.on("ready",function(e){if(o.removeEventListener("error",c),i.destroyed)l();else try{h()}catch(e){i._setupFakeWorker()}});var h=function(){var e=new Uint8Array([i.postMessageTransfers?255:0]);try{u.send("test",e,[e.buffer])}catch(t){(0,s.info)("Cannot use postMessage transfers"),e[0]=0,u.send("test",e)}};return void h()}catch(e){(0,s.info)("The worker has been disabled.")}}this._setupFakeWorker()},_setupFakeWorker:function(){var i=this;A||((0,s.warn)("Setting up fake worker."),A=!0),function(){if(n)return n.promise;n=(0,s.createPromiseCapability)();var e=r();return e?(n.resolve(e),n.promise):((w||function(){return(0,u.loadScript)(t()).then(function(){return window.pdfjsWorker.WorkerMessageHandler})})().then(n.resolve,n.reject),n.promise)}().then(function(t){if(i.destroyed)i._readyCapability.reject(new Error("Worker was destroyed"));else{var r=new I;i._port=r;var n="fake"+e++,a=new v.MessageHandler(n+"_worker",n,r);t.setup(a,r);var o=new v.MessageHandler(n,n+"_worker",r);i._messageHandler=o,i._readyCapability.resolve()}}).catch(function(e){i._readyCapability.reject(new Error('Setting up fake worker failed: "'+e.message+'".'))})},destroy:function(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),i.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}},a.fromPort=function(e){if(!e||!e.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return i.has(e.port)?i.get(e.port):new a(e)},a.getWorkerSrc=function(){return t()},a}(),L=function(){function e(t,r,n,i){b(this,e),this.messageHandler=t,this.loadingTask=r,this.commonObjs=new j,this.fontLoader=new l.FontLoader(r.docId),this._params=i,this.CMapReaderFactory=new i.CMapReaderFactory({baseUrl:i.cMapUrl,isCompressed:i.cMapPacked}),this.destroyed=!1,this.destroyCapability=null,this._passwordCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.pageCache=[],this.pagePromises=[],this.downloadInfoCapability=(0,s.createPromiseCapability)(),this.setupMessageHandler()}return a(e,[{key:"destroy",value:function(){var e=this;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=(0,s.createPromiseCapability)(),this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));var t=[];this.pageCache.forEach(function(e){e&&t.push(e._destroy())}),this.pageCache=[],this.pagePromises=[];var r=this.messageHandler.sendWithPromise("Terminate",null);return t.push(r),Promise.all(t).then(function(){e.fontLoader.clear(),e._networkStream&&e._networkStream.cancelAllRequests(),e.messageHandler&&(e.messageHandler.destroy(),e.messageHandler=null),e.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}},{key:"setupMessageHandler",value:function(){var e=this.messageHandler,t=this.loadingTask;e.on("GetReader",function(e,t){var r=this;(0,s.assert)(this._networkStream),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=function(e){r._lastProgress={loaded:e.loaded,total:e.total}},t.onPull=function(){r._fullReader.read().then(function(e){var r=e.value;e.done?t.close():((0,s.assert)((0,s.isArrayBuffer)(r)),t.enqueue(new Uint8Array(r),1,[r]))}).catch(function(e){t.error(e)})},t.onCancel=function(e){r._fullReader.cancel(e)}},this),e.on("ReaderHeadersReady",function(e){var r=this,n=(0,s.createPromiseCapability)(),i=this._fullReader;return i.headersReady.then(function(){i.isStreamingSupported&&i.isRangeSupported||(r._lastProgress&&t.onProgress&&t.onProgress(r._lastProgress),i.onProgress=function(e){t.onProgress&&t.onProgress({loaded:e.loaded,total:e.total})}),n.resolve({isStreamingSupported:i.isStreamingSupported,isRangeSupported:i.isRangeSupported,contentLength:i.contentLength})},n.reject),n.promise},this),e.on("GetRangeReader",function(e,t){(0,s.assert)(this._networkStream);var r=this._networkStream.getRangeReader(e.begin,e.end);t.onPull=function(){r.read().then(function(e){var r=e.value;e.done?t.close():((0,s.assert)((0,s.isArrayBuffer)(r)),t.enqueue(new Uint8Array(r),1,[r]))}).catch(function(e){t.error(e)})},t.onCancel=function(e){r.cancel(e)}},this),e.on("GetDoc",function(e){var r=e.pdfInfo;this.numPages=r.numPages,this.pdfDocument=new T(r,this,t),t._capability.resolve(this.pdfDocument)},this),e.on("PasswordRequest",function(e){var r=this;if(this._passwordCapability=(0,s.createPromiseCapability)(),t.onPassword){try{t.onPassword(function(e){r._passwordCapability.resolve({password:e})},e.code)}catch(e){this._passwordCapability.reject(e)}}else this._passwordCapability.reject(new s.PasswordException(e.message,e.code));return this._passwordCapability.promise},this),e.on("PasswordException",function(e){t._capability.reject(new s.PasswordException(e.message,e.code))},this),e.on("InvalidPDF",function(e){t._capability.reject(new s.InvalidPDFException(e.message))},this),e.on("MissingPDF",function(e){t._capability.reject(new s.MissingPDFException(e.message))},this),e.on("UnexpectedResponse",function(e){t._capability.reject(new s.UnexpectedResponseException(e.message,e.status))},this),e.on("UnknownError",function(e){t._capability.reject(new s.UnknownErrorException(e.message,e.details))},this),e.on("DataLoaded",function(e){t.onProgress&&t.onProgress({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)},this),e.on("StartRenderPage",function(e){if(!this.destroyed){var t=this.pageCache[e.pageIndex];t._stats.timeEnd("Page Request"),t._startRenderPage(e.transparency,e.intent)}},this),e.on("RenderPageChunk",function(e){this.destroyed||this.pageCache[e.pageIndex]._renderPageChunk(e.operatorList,e.intent)},this),e.on("commonobj",function(e){var t=this;if(!this.destroyed){var r=i(e,3),n=r[0],a=r[1],o=r[2];if(!this.commonObjs.hasData(n))switch(a){case"Font":var u=this._params;if("error"in o){var c=o.error;(0,s.warn)("Error during font loading: "+c),this.commonObjs.resolve(n,c);break}var h=null;u.pdfBug&&f.default.FontInspector&&f.default.FontInspector.enabled&&(h={registerFont:function(e,t){f.default.FontInspector.fontAdded(e,t)}});var d=new l.FontFaceObject(o,{isEvalSupported:u.isEvalSupported,disableFontFace:u.disableFontFace,ignoreErrors:u.ignoreErrors,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),fontRegistry:h});this.fontLoader.bind([d],function(e){t.commonObjs.resolve(n,d)});break;case"FontPath":this.commonObjs.resolve(n,o);break;default:throw new Error("Got unknown common object type "+a)}}},this),e.on("obj",function(e){if(!this.destroyed){var t=i(e,4),r=t[0],n=t[1],a=t[2],o=t[3],s=this.pageCache[n];if(!s.objs.hasData(r))switch(a){case"JpegStream":return new Promise(function(e,t){var r=new Image;r.onload=function(){e(r)},r.onerror=function(){t(new Error("Error during JPEG image loading"))},r.src=o}).then(function(e){s.objs.resolve(r,e)});case"Image":s.objs.resolve(r,o);o&&"data"in o&&o.data.length>8e6&&(s.cleanupAfterRender=!0);break;default:throw new Error("Got unknown object type "+a)}}},this),e.on("DocProgress",function(e){this.destroyed||t.onProgress&&t.onProgress({loaded:e.loaded,total:e.total})},this),e.on("PageError",function(e){if(!this.destroyed){var t=this.pageCache[e.pageNum-1].intentStates[e.intent];if(!t.displayReadyCapability)throw new Error(e.error);if(t.displayReadyCapability.reject(e.error),t.operatorList){t.operatorList.lastChunk=!0;for(var r=0;r<t.renderTasks.length;r++)t.renderTasks[r].operatorListChanged()}}},this),e.on("UnsupportedFeature",this._onUnsupportedFeature,this),e.on("JpegDecode",function(e){if(this.destroyed)return Promise.reject(new Error("Worker was destroyed"));if("undefined"==typeof document)return Promise.reject(new Error('"document" is not defined.'));var t=i(e,2),r=t[0],n=t[1];return 3!==n&&1!==n?Promise.reject(new Error("Only 3 components or 1 component can be returned")):new Promise(function(e,t){var i=new Image;i.onload=function(){var t=i.width,r=i.height,a=t*r,o=4*a,s=new Uint8ClampedArray(a*n),u=document.createElement("canvas");u.width=t,u.height=r;var l=u.getContext("2d");l.drawImage(i,0,0);var c=l.getImageData(0,0,t,r).data;if(3===n)for(var h=0,d=0;h<o;h+=4,d+=3)s[d]=c[h],s[d+1]=c[h+1],s[d+2]=c[h+2];else if(1===n)for(var f=0,p=0;f<o;f+=4,p++)s[p]=c[f];e({data:s,width:t,height:r})},i.onerror=function(){t(new Error("JpegDecode failed to load image"))},i.src=r})},this),e.on("FetchBuiltInCMap",function(e){return this.destroyed?Promise.reject(new Error("Worker was destroyed")):this.CMapReaderFactory.fetch({name:e.name})},this)}},{key:"_onUnsupportedFeature",value:function(e){var t=e.featureId;this.destroyed||this.loadingTask.onUnsupportedFeature&&this.loadingTask.onUnsupportedFeature(t)}},{key:"getData",value:function(){return this.messageHandler.sendWithPromise("GetData",null)}},{key:"getPage",value:function(e){var t=this;if(!Number.isInteger(e)||e<=0||e>this.numPages)return Promise.reject(new Error("Invalid page request"));var r=e-1;if(r in this.pagePromises)return this.pagePromises[r];var n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:r}).then(function(e){if(t.destroyed)throw new Error("Transport destroyed");var n=new O(r,e,t,t._params.pdfBug);return t.pageCache[r]=n,n});return this.pagePromises[r]=n,n}},{key:"getPageIndex",value:function(e){return this.messageHandler.sendWithPromise("GetPageIndex",{ref:e}).catch(function(e){return Promise.reject(new Error(e))})}},{key:"getAnnotations",value:function(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}},{key:"getDestinations",value:function(){return this.messageHandler.sendWithPromise("GetDestinations",null)}},{key:"getDestination",value:function(e){return"string"!=typeof e?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}},{key:"getPageLabels",value:function(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}},{key:"getPageMode",value:function(){return this.messageHandler.sendWithPromise("GetPageMode",null)}},{key:"getAttachments",value:function(){return this.messageHandler.sendWithPromise("GetAttachments",null)}},{key:"getJavaScript",value:function(){return this.messageHandler.sendWithPromise("GetJavaScript",null)}},{key:"getOutline",value:function(){return this.messageHandler.sendWithPromise("GetOutline",null)}},{key:"getPermissions",value:function(){return this.messageHandler.sendWithPromise("GetPermissions",null)}},{key:"getMetadata",value:function(){var e=this;return this.messageHandler.sendWithPromise("GetMetadata",null).then(function(t){return{info:t[0],metadata:t[1]?new m.Metadata(t[1]):null,contentDispositionFilename:e._fullReader?e._fullReader.filename:null}})}},{key:"getStats",value:function(){return this.messageHandler.sendWithPromise("GetStats",null)}},{key:"startCleanup",value:function(){var e=this;this.messageHandler.sendWithPromise("Cleanup",null).then(function(){for(var t=0,r=e.pageCache.length;t<r;t++){var n=e.pageCache[t];n&&n.cleanup()}e.commonObjs.clear(),e.fontLoader.clear()})}},{key:"loadingParams",get:function(){var e=this._params;return(0,s.shadow)(this,"loadingParams",{disableAutoFetch:e.disableAutoFetch,disableCreateObjectURL:e.disableCreateObjectURL,disableFontFace:e.disableFontFace,nativeImageDecoderSupport:e.nativeImageDecoderSupport})}}]),e}(),j=function(){function e(){this.objs=Object.create(null)}return e.prototype={ensureObj:function(e){if(this.objs[e])return this.objs[e];var t={capability:(0,s.createPromiseCapability)(),data:null,resolved:!1};return this.objs[e]=t,t},get:function(e,t){if(t)return this.ensureObj(e).capability.promise.then(t),null;var r=this.objs[e];if(!r||!r.resolved)throw new Error("Requesting object that isn't resolved yet "+e);return r.data},resolve:function(e,t){var r=this.ensureObj(e);r.resolved=!0,r.data=t,r.capability.resolve(t)},isResolved:function(e){var t=this.objs;return!!t[e]&&t[e].resolved},hasData:function(e){return this.isResolved(e)},getData:function(e){var t=this.objs;return t[e]&&t[e].resolved?t[e].data:null},clear:function(){this.objs=Object.create(null)}},e}(),M=function(){function e(e){this._internalRenderTask=e,this.onContinue=null}return e.prototype={get promise(){return this._internalRenderTask.capability.promise},cancel:function(){this._internalRenderTask.cancel()},then:function(e,t){return this.promise.then.apply(this.promise,arguments)}},e}(),D=function(){var e=new WeakMap;function t(e,t,r,n,i,a,o,u){var l=arguments.length>8&&void 0!==arguments[8]&&arguments[8];this.callback=e,this.params=t,this.objs=r,this.commonObjs=n,this.operatorListIdx=null,this.operatorList=i,this.pageNumber=a,this.canvasFactory=o,this.webGLContext=u,this._pdfBug=l,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this.useRequestAnimationFrame=!1,this.cancelled=!1,this.capability=(0,s.createPromiseCapability)(),this.task=new M(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=t.canvasContext.canvas}return t.prototype={initializeGraphics:function(t){if(!this.cancelled){if(this._canvas){if(e.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");e.set(this._canvas,this)}this._pdfBug&&f.default.StepperManager&&f.default.StepperManager.enabled&&(this.stepper=f.default.StepperManager.create(this.pageNumber-1),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());var r=this.params;this.gfx=new h.CanvasGraphics(r.canvasContext,this.commonObjs,this.objs,this.canvasFactory,this.webGLContext,r.imageLayer),this.gfx.beginDrawing({transform:r.transform,viewport:r.viewport,transparency:t,background:r.background}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback&&this.graphicsReadyCallback()}},cancel:function(){this.running=!1,this.cancelled=!0,this._canvas&&e.delete(this._canvas),this.callback(new u.RenderingCancelledException("Rendering cancelled, page "+this.pageNumber,"canvas"))},operatorListChanged:function(){this.graphicsReady?(this.stepper&&this.stepper.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)},_continue:function(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())},_scheduleNext:function(){var e=this;this.useRequestAnimationFrame&&"undefined"!=typeof window?window.requestAnimationFrame(function(){e._nextBound().catch(e.callback)}):Promise.resolve().then(this._nextBound).catch(this.callback)},_next:function(){var t=this;return new Promise(function(){t.cancelled||(t.operatorListIdx=t.gfx.executeOperatorList(t.operatorList,t.operatorListIdx,t._continueBound,t.stepper),t.operatorListIdx===t.operatorList.argsArray.length&&(t.running=!1,t.operatorList.lastChunk&&(t.gfx.endDrawing(),t._canvas&&e.delete(t._canvas),t.callback())))})}},t}();t.version="2.0.943",t.build="dc98bf76",t.getDocument=function(e){var t,r=new R;if("string"==typeof e)t={url:e};else if((0,s.isArrayBuffer)(e))t={data:e};else if(e instanceof E)t={range:e};else{if("object"!==(void 0===e?"undefined":o(e)))throw new Error("Invalid parameter in getDocument, need either Uint8Array, string or a parameter object");if(!e.url&&!e.data&&!e.range)throw new Error("Invalid parameter object: need either .data, .range or .url");t=e}var n=Object.create(null),i=null,a=null;for(var l in t)if("url"!==l||"undefined"==typeof window)if("range"!==l)if("worker"!==l)if("data"!==l||t[l]instanceof Uint8Array)n[l]=t[l];else{var h=t[l];if("string"==typeof h)n[l]=(0,s.stringToBytes)(h);else if("object"!==(void 0===h?"undefined":o(h))||null===h||isNaN(h.length)){if(!(0,s.isArrayBuffer)(h))throw new Error("Invalid PDF binary data: either typed array, string or array-like object is expected in the data property.");n[l]=new Uint8Array(h)}else n[l]=new Uint8Array(h)}else a=t[l];else i=t[l];else n[l]=new s.URL(t[l],window.location).href;n.rangeChunkSize=n.rangeChunkSize||_,n.CMapReaderFactory=n.CMapReaderFactory||u.DOMCMapReaderFactory,n.ignoreErrors=!0!==n.stopAtErrors,n.pdfBug=!0===n.pdfBug;var d=Object.values(s.NativeImageDecoding);if(void 0!==n.nativeImageDecoderSupport&&d.includes(n.nativeImageDecoderSupport)||(n.nativeImageDecoderSupport=c.apiCompatibilityParams.nativeImageDecoderSupport||s.NativeImageDecoding.DECODE),Number.isInteger(n.maxImageSize)||(n.maxImageSize=-1),"boolean"!=typeof n.isEvalSupported&&(n.isEvalSupported=!0),"boolean"!=typeof n.disableFontFace&&(n.disableFontFace=c.apiCompatibilityParams.disableFontFace||!1),"boolean"!=typeof n.disableRange&&(n.disableRange=!1),"boolean"!=typeof n.disableStream&&(n.disableStream=!1),"boolean"!=typeof n.disableAutoFetch&&(n.disableAutoFetch=!1),"boolean"!=typeof n.disableCreateObjectURL&&(n.disableCreateObjectURL=c.apiCompatibilityParams.disableCreateObjectURL||!1),(0,s.setVerbosityLevel)(n.verbosity),!a){var f={postMessageTransfers:n.postMessageTransfers,verbosity:n.verbosity},m=p.GlobalWorkerOptions.workerPort;m?(f.port=m,a=F.fromPort(f)):a=new F(f),r._worker=a}var y=r.docId;return a.promise.then(function(){if(r.destroyed)throw new Error("Loading aborted");return function(e,t,r,n){return e.destroyed?Promise.reject(new Error("Worker was destroyed")):(r&&(t.length=r.length,t.initialData=r.initialData),e.messageHandler.sendWithPromise("GetDocRequest",{docId:n,apiVersion:"2.0.943",source:{data:t.data,url:t.url,password:t.password,disableAutoFetch:t.disableAutoFetch,rangeChunkSize:t.rangeChunkSize,length:t.length},maxImageSize:t.maxImageSize,disableFontFace:t.disableFontFace,disableCreateObjectURL:t.disableCreateObjectURL,postMessageTransfers:e.postMessageTransfers,docBaseUrl:t.docBaseUrl,nativeImageDecoderSupport:t.nativeImageDecoderSupport,ignoreErrors:t.ignoreErrors,isEvalSupported:t.isEvalSupported}).then(function(t){if(e.destroyed)throw new Error("Worker was destroyed");return t}))}(a,n,i,y).then(function(e){if(r.destroyed)throw new Error("Loading aborted");var t=void 0;i?t=new g.PDFDataTransportStream({length:n.length,initialData:n.initialData,disableRange:n.disableRange,disableStream:n.disableStream},i):n.data||(t=P({url:n.url,length:n.length,httpHeaders:n.httpHeaders,withCredentials:n.withCredentials,rangeChunkSize:n.rangeChunkSize,disableRange:n.disableRange,disableStream:n.disableStream}));var o=new v.MessageHandler(y,e,a.port);o.postMessageTransfers=a.postMessageTransfers;var s=new L(o,r,t,n);r._transport=s,o.send("Ready",null)})}).catch(r._capability.reject),r},t.LoopbackPort=I,t.PDFDataRangeTransport=E,t.PDFWorker=F,t.PDFDocumentProxy=T,t.PDFPageProxy=O,t.setPDFNetworkStreamFactory=function(e){P=e},t.version="2.0.943",t.build="dc98bf76"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadScript=t.DummyStatTimer=t.StatTimer=t.DOMSVGFactory=t.DOMCMapReaderFactory=t.DOMCanvasFactory=t.DEFAULT_LINK_REL=t.LinkTarget=t.getFilenameFromUrl=t.addLinkAttributes=t.RenderingCancelledException=t.PageViewport=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(1);function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o="noopener noreferrer nofollow",s="http://www.w3.org/2000/svg",u=function(){function e(){a(this,e)}return n(e,[{key:"create",value:function(e,t){if(e<=0||t<=0)throw new Error("invalid canvas size");var r=document.createElement("canvas"),n=r.getContext("2d");return r.width=e,r.height=t,{canvas:r,context:n}}},{key:"reset",value:function(e,t,r){if(!e.canvas)throw new Error("canvas is not specified");if(t<=0||r<=0)throw new Error("invalid canvas size");e.canvas.width=t,e.canvas.height=r}},{key:"destroy",value:function(e){if(!e.canvas)throw new Error("canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}}]),e}(),l=function(){function e(t){var r=t.baseUrl,n=void 0===r?null:r,i=t.isCompressed,o=void 0!==i&&i;a(this,e),this.baseUrl=n,this.isCompressed=o}return n(e,[{key:"fetch",value:function(e){var t=this,r=e.name;return this.baseUrl?r?new Promise(function(e,n){var a=t.baseUrl+r+(t.isCompressed?".bcmap":""),o=new XMLHttpRequest;o.open("GET",a,!0),t.isCompressed&&(o.responseType="arraybuffer"),o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE){if(200===o.status||0===o.status){var r=void 0;if(t.isCompressed&&o.response?r=new Uint8Array(o.response):!t.isCompressed&&o.responseText&&(r=(0,i.stringToBytes)(o.responseText)),r)return void e({cMapData:r,compressionType:t.isCompressed?i.CMapCompressionType.BINARY:i.CMapCompressionType.NONE})}n(new Error("Unable to load "+(t.isCompressed?"binary ":"")+"CMap at: "+a))}},o.send(null)}):Promise.reject(new Error("CMap name must be specified.")):Promise.reject(new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.'))}}]),e}(),c=function(){function e(){a(this,e)}return n(e,[{key:"create",value:function(e,t){(0,i.assert)(e>0&&t>0,"Invalid SVG dimensions");var r=document.createElementNS(s,"svg:svg");return r.setAttribute("version","1.1"),r.setAttribute("width",e+"px"),r.setAttribute("height",t+"px"),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox","0 0 "+e+" "+t),r}},{key:"createElement",value:function(e){return(0,i.assert)("string"==typeof e,"Invalid SVG element type"),document.createElementNS(s,e)}}]),e}(),h=function(){function e(t){var r=t.viewBox,n=t.scale,i=t.rotation,o=t.offsetX,s=void 0===o?0:o,u=t.offsetY,l=void 0===u?0:u,c=t.dontFlip,h=void 0!==c&&c;a(this,e),this.viewBox=r,this.scale=n,this.rotation=i,this.offsetX=s,this.offsetY=l;var d=(r[2]+r[0])/2,f=(r[3]+r[1])/2,p=void 0,v=void 0,m=void 0,g=void 0;switch(i=(i%=360)<0?i+360:i){case 180:p=-1,v=0,m=0,g=1;break;case 90:p=0,v=1,m=1,g=0;break;case 270:p=0,v=-1,m=-1,g=0;break;default:p=1,v=0,m=0,g=-1}h&&(m=-m,g=-g);var y=void 0,b=void 0,_=void 0,A=void 0;0===p?(y=Math.abs(f-r[1])*n+s,b=Math.abs(d-r[0])*n+l,_=Math.abs(r[3]-r[1])*n,A=Math.abs(r[2]-r[0])*n):(y=Math.abs(d-r[0])*n+s,b=Math.abs(f-r[1])*n+l,_=Math.abs(r[2]-r[0])*n,A=Math.abs(r[3]-r[1])*n),this.transform=[p*n,v*n,m*n,g*n,y-p*n*d-m*n*f,b-v*n*d-g*n*f],this.width=_,this.height=A}return n(e,[{key:"clone",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.scale,n=void 0===r?this.scale:r,i=t.rotation,a=void 0===i?this.rotation:i,o=t.dontFlip,s=void 0!==o&&o;return new e({viewBox:this.viewBox.slice(),scale:n,rotation:a,offsetX:this.offsetX,offsetY:this.offsetY,dontFlip:s})}},{key:"convertToViewportPoint",value:function(e,t){return i.Util.applyTransform([e,t],this.transform)}},{key:"convertToViewportRectangle",value:function(e){var t=i.Util.applyTransform([e[0],e[1]],this.transform),r=i.Util.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],r[0],r[1]]}},{key:"convertToPdfPoint",value:function(e,t){return i.Util.applyInverseTransform([e,t],this.transform)}}]),e}(),d=function(){function e(e,t){this.message=e,this.type=t}return e.prototype=new Error,e.prototype.name="RenderingCancelledException",e.constructor=e,e}(),f={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4},p=["","_self","_blank","_parent","_top"];var v=function(){function e(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];a(this,e),this.enabled=!!t,this.started=Object.create(null),this.times=[]}return n(e,[{key:"time",value:function(e){this.enabled&&(e in this.started&&(0,i.warn)("Timer is already running for "+e),this.started[e]=Date.now())}},{key:"timeEnd",value:function(e){this.enabled&&(e in this.started||(0,i.warn)("Timer has not been started for "+e),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e])}},{key:"toString",value:function(){for(var e=this.times,t="",r=0,n=0,i=e.length;n<i;++n){var a=e[n].name;a.length>r&&(r=a.length)}for(var o=0,s=e.length;o<s;++o){var u=e[o],l=u.end-u.start;t+=u.name.padEnd(r)+" "+l+"ms\n"}return t}}]),e}(),m=function(){function e(){a(this,e),(0,i.unreachable)("Cannot initialize DummyStatTimer.")}return n(e,null,[{key:"time",value:function(e){}},{key:"timeEnd",value:function(e){}},{key:"toString",value:function(){return""}}]),e}();t.PageViewport=h,t.RenderingCancelledException=d,t.addLinkAttributes=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.url,n=t.target,a=t.rel;if(e.href=e.title=r?(0,i.removeNullCharacters)(r):"",r){var s=Object.values(f).includes(n)?n:f.NONE;e.target=p[s],e.rel="string"==typeof a?a:o}},t.getFilenameFromUrl=function(e){var t=e.indexOf("#"),r=e.indexOf("?"),n=Math.min(t>0?t:e.length,r>0?r:e.length);return e.substring(e.lastIndexOf("/",n)+1,n)},t.LinkTarget=f,t.DEFAULT_LINK_REL=o,t.DOMCanvasFactory=u,t.DOMCMapReaderFactory=l,t.DOMSVGFactory=c,t.StatTimer=v,t.DummyStatTimer=m,t.loadScript=function(e){return new Promise(function(t,r){var n=document.createElement("script");n.src=e,n.onload=t,n.onerror=function(){r(new Error("Cannot load script at: "+n.src))},(document.head||document.documentElement).appendChild(n)})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FontLoader=t.FontFaceObject=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(1);function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o,s=function(){function e(t){a(this,e),this.constructor===e&&(0,i.unreachable)("Cannot initialize BaseFontLoader."),this.docId=t,this.nativeFontFaces=[],this.styleElement=null,this.loadingContext={requests:[],nextRequestId:0}}return n(e,[{key:"addNativeFontFace",value:function(e){this.nativeFontFaces.push(e),document.fonts.add(e)}},{key:"insertRule",value:function(e){var t=this.styleElement;t||((t=this.styleElement=document.createElement("style")).id="PDFJS_FONT_STYLE_TAG_"+this.docId,document.documentElement.getElementsByTagName("head")[0].appendChild(t));var r=t.sheet;r.insertRule(e,r.cssRules.length)}},{key:"clear",value:function(){this.nativeFontFaces.forEach(function(e){document.fonts.delete(e)}),this.nativeFontFaces.length=0,this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}},{key:"bind",value:function(e,t){var r=[],n=[],a=[],o=function(e){return e.loaded.catch(function(t){(0,i.warn)('Failed to load font "'+e.family+'": '+t)})},s=!0,u=!1,l=void 0;try{for(var c,h=e[Symbol.iterator]();!(s=(c=h.next()).done);s=!0){var d=c.value;if(!d.attached&&!d.missingFile)if(d.attached=!0,this.isFontLoadingAPISupported){var f=d.createNativeFontFace();f&&(this.addNativeFontFace(f),a.push(o(f)))}else{var p=d.createFontFaceRule();p&&(this.insertRule(p),r.push(p),n.push(d))}}}catch(e){u=!0,l=e}finally{try{!s&&h.return&&h.return()}finally{if(u)throw l}}var v=this._queueLoadingCallback(t);this.isFontLoadingAPISupported?Promise.all(a).then(v.complete):r.length>0&&!this.isSyncFontLoadingSupported?this._prepareFontLoadEvent(r,n,v):v.complete()}},{key:"_queueLoadingCallback",value:function(e){var t=this.loadingContext,r={id:"pdfjs-font-loading-"+t.nextRequestId++,done:!1,complete:function(){for((0,i.assert)(!r.done,"completeRequest() cannot be called twice."),r.done=!0;t.requests.length>0&&t.requests[0].done;){var e=t.requests.shift();setTimeout(e.callback,0)}},callback:e};return t.requests.push(r),r}},{key:"_prepareFontLoadEvent",value:function(e,t,r){(0,i.unreachable)("Abstract method `_prepareFontLoadEvent`.")}},{key:"isFontLoadingAPISupported",get:function(){(0,i.unreachable)("Abstract method `isFontLoadingAPISupported`.")}},{key:"isSyncFontLoadingSupported",get:function(){(0,i.unreachable)("Abstract method `isSyncFontLoadingSupported`.")}},{key:"_loadTestFont",get:function(){(0,i.unreachable)("Abstract method `_loadTestFont`.")}}]),e}();t.FontLoader=o=function(e){function t(e){a(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.loadTestFontId=0,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s),n(t,[{key:"_prepareFontLoadEvent",value:function(e,t,r){function n(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|255&e.charCodeAt(t+3)}function a(e,t,r,n){return e.substring(0,t)+n+e.substring(t+r)}var o=void 0,s=void 0,u=document.createElement("canvas");u.width=1,u.height=1;var l=u.getContext("2d"),c=0;var h="lt"+Date.now()+this.loadTestFontId++,d=this._loadTestFont,f=n(d=a(d,976,h.length,h),16);for(o=0,s=h.length-3;o<s;o+=4)f=f-1482184792+n(h,o)|0;o<h.length&&(f=f-1482184792+n(h+"XXX",o)|0),d=a(d,16,4,(0,i.string32)(f));var p='@font-face {font-family:"'+h+'";src:'+("url(data:font/opentype;base64,"+btoa(d)+");")+"}";this.insertRule(p);var v=[];for(o=0,s=t.length;o<s;o++)v.push(t[o].loadedName);v.push(h);var m=document.createElement("div");for(m.setAttribute("style","visibility: hidden;width: 10px; height: 10px;position: absolute; top: 0px; left: 0px;"),o=0,s=v.length;o<s;++o){var g=document.createElement("span");g.textContent="Hi",g.style.fontFamily=v[o],m.appendChild(g)}document.body.appendChild(m),function e(t,r){if(++c>30)return(0,i.warn)("Load test font never loaded."),void r();l.font="30px "+t,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0?r():setTimeout(e.bind(null,t,r))}(h,function(){document.body.removeChild(m),r.complete()})}},{key:"isFontLoadingAPISupported",get:function(){var e="undefined"!=typeof document&&!!document.fonts;if(e&&"undefined"!=typeof navigator){var t=/Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent);t&&t[1]<63&&(e=!1)}return(0,i.shadow)(this,"isFontLoadingAPISupported",e)}},{key:"isSyncFontLoadingSupported",get:function(){var e=!1;if("undefined"==typeof navigator)e=!0;else{var t=/Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent);t&&t[1]>=14&&(e=!0)}return(0,i.shadow)(this,"isSyncFontLoadingSupported",e)}},{key:"_loadTestFont",get:function(){return(0,i.shadow)(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}}]),t}();var u={get value(){return(0,i.shadow)(this,"value",(0,i.isEvalSupported)())}},l=function(){function e(t,r){var n=r.isEvalSupported,i=void 0===n||n,o=r.disableFontFace,s=void 0!==o&&o,u=r.ignoreErrors,l=void 0!==u&&u,c=r.onUnsupportedFeature,h=void 0===c?null:c,d=r.fontRegistry,f=void 0===d?null:d;for(var p in a(this,e),this.compiledGlyphs=Object.create(null),t)this[p]=t[p];this.isEvalSupported=!1!==i,this.disableFontFace=!0===s,this.ignoreErrors=!0===l,this._onUnsupportedFeature=h,this.fontRegistry=f}return n(e,[{key:"createNativeFontFace",value:function(){if(!this.data||this.disableFontFace)return null;var e=new FontFace(this.loadedName,this.data,{});return this.fontRegistry&&this.fontRegistry.registerFont(this),e}},{key:"createFontFaceRule",value:function(){if(!this.data||this.disableFontFace)return null;var e=(0,i.bytesToString)(new Uint8Array(this.data)),t="url(data:"+this.mimetype+";base64,"+btoa(e)+");",r='@font-face {font-family:"'+this.loadedName+'";src:'+t+"}";return this.fontRegistry&&this.fontRegistry.registerFont(this,t),r}},{key:"getPathGenerator",value:function(e,t){if(void 0!==this.compiledGlyphs[t])return this.compiledGlyphs[t];var r=void 0,n=void 0;try{r=e.get(this.loadedName+"_path_"+t)}catch(e){if(!this.ignoreErrors)throw e;return this._onUnsupportedFeature&&this._onUnsupportedFeature({featureId:i.UNSUPPORTED_FEATURES.font}),(0,i.warn)('getPathGenerator - ignoring character: "'+e+'".'),this.compiledGlyphs[t]=function(e,t){}}if(this.isEvalSupported&&u.value){for(var a=void 0,o="",s=0,l=r.length;s<l;s++)a=void 0!==(n=r[s]).args?n.args.join(","):"",o+="c."+n.cmd+"("+a+");\n";return this.compiledGlyphs[t]=new Function("c","size",o)}return this.compiledGlyphs[t]=function(e,t){for(var i=0,a=r.length;i<a;i++)"scale"===(n=r[i]).cmd&&(n.args=[t,-t]),e[n.cmd].apply(e,n.args)}}}]),e}();t.FontFaceObject=l,t.FontLoader=o},function(e,t,r){"use strict";var n=Object.create(null),i=r(4),a="undefined"!=typeof navigator&&navigator.userAgent||"",o=/Trident/.test(a),s=/CriOS/.test(a);(o||s)&&(n.disableCreateObjectURL=!0),i()&&(n.disableFontFace=!0,n.nativeImageDecoderSupport="none"),t.apiCompatibilityParams=Object.freeze(n)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CanvasGraphics=void 0;var n=r(1),i=r(134),a=16,o={get value(){return(0,n.shadow)(o,"value",(0,n.isLittleEndian)())}};function s(e){e.mozCurrentTransform||(e._originalSave=e.save,e._originalRestore=e.restore,e._originalRotate=e.rotate,e._originalScale=e.scale,e._originalTranslate=e.translate,e._originalTransform=e.transform,e._originalSetTransform=e.setTransform,e._transformMatrix=e._transformMatrix||[1,0,0,1,0,0],e._transformStack=[],Object.defineProperty(e,"mozCurrentTransform",{get:function(){return this._transformMatrix}}),Object.defineProperty(e,"mozCurrentTransformInverse",{get:function(){var e=this._transformMatrix,t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=t*i-r*n,u=r*n-t*i;return[i/s,r/u,n/u,t/s,(i*a-n*o)/u,(r*a-t*o)/s]}}),e.save=function(){var e=this._transformMatrix;this._transformStack.push(e),this._transformMatrix=e.slice(0,6),this._originalSave()},e.restore=function(){var e=this._transformStack.pop();e&&(this._transformMatrix=e,this._originalRestore())},e.translate=function(e,t){var r=this._transformMatrix;r[4]=r[0]*e+r[2]*t+r[4],r[5]=r[1]*e+r[3]*t+r[5],this._originalTranslate(e,t)},e.scale=function(e,t){var r=this._transformMatrix;r[0]=r[0]*e,r[1]=r[1]*e,r[2]=r[2]*t,r[3]=r[3]*t,this._originalScale(e,t)},e.transform=function(t,r,n,i,a,o){var s=this._transformMatrix;this._transformMatrix=[s[0]*t+s[2]*r,s[1]*t+s[3]*r,s[0]*n+s[2]*i,s[1]*n+s[3]*i,s[0]*a+s[2]*o+s[4],s[1]*a+s[3]*o+s[5]],e._originalTransform(t,r,n,i,a,o)},e.setTransform=function(t,r,n,i,a,o){this._transformMatrix=[t,r,n,i,a,o],e._originalSetTransform(t,r,n,i,a,o)},e.rotate=function(e){var t=Math.cos(e),r=Math.sin(e),n=this._transformMatrix;this._transformMatrix=[n[0]*t+n[2]*r,n[1]*t+n[3]*r,n[0]*-r+n[2]*t,n[1]*-r+n[3]*t,n[4],n[5]],this._originalRotate(e)})}var u=function(){function e(e){this.canvasFactory=e,this.cache=Object.create(null)}return e.prototype={getCanvas:function(e,t,r,n){var i;return void 0!==this.cache[e]?(i=this.cache[e],this.canvasFactory.reset(i,t,r),i.context.setTransform(1,0,0,1,0,0)):(i=this.canvasFactory.create(t,r),this.cache[e]=i),n&&s(i.context),i},clear:function(){for(var e in this.cache){var t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}},e}();var l=function(){function e(){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=n.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=n.FONT_IDENTITY_MATRIX,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=n.TextRenderingMode.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.resumeSMaskCtx=null}return e.prototype={clone:function(){return Object.create(this)},setCurrentPoint:function(e,t){this.x=e,this.y=t}},e}(),c=function(){function e(e,t,r,n,i,a){this.ctx=e,this.current=new l,this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=r,this.canvasFactory=n,this.webGLContext=i,this.imageLayer=a,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.cachedCanvases=new u(this.canvasFactory),e&&s(e),this._cachedGetSinglePixelWidth=null}function t(e,t){if("undefined"!=typeof ImageData&&t instanceof ImageData)e.putImageData(t,0,0);else{var r,i,s,u,l,c=t.height,h=t.width,d=c%a,f=(c-d)/a,p=0===d?f:f+1,v=e.createImageData(h,a),m=0,g=t.data,y=v.data;if(t.kind===n.ImageKind.GRAYSCALE_1BPP){var b=g.byteLength,_=new Uint32Array(y.buffer,0,y.byteLength>>2),A=_.length,S=h+7>>3,w=4294967295,k=o.value?4278190080:255;for(i=0;i<p;i++){for(u=i<f?a:d,r=0,s=0;s<u;s++){for(var P=b-m,x=0,C=P>S?h:8*P-7,R=-8&C,E=0,T=0;x<R;x+=8)T=g[m++],_[r++]=128&T?w:k,_[r++]=64&T?w:k,_[r++]=32&T?w:k,_[r++]=16&T?w:k,_[r++]=8&T?w:k,_[r++]=4&T?w:k,_[r++]=2&T?w:k,_[r++]=1&T?w:k;for(;x<C;x++)0===E&&(T=g[m++],E=128),_[r++]=T&E?w:k,E>>=1}for(;r<A;)_[r++]=0;e.putImageData(v,0,i*a)}}else if(t.kind===n.ImageKind.RGBA_32BPP){for(s=0,l=h*a*4,i=0;i<f;i++)y.set(g.subarray(m,m+l)),m+=l,e.putImageData(v,0,s),s+=a;i<p&&(l=h*d*4,y.set(g.subarray(m,m+l)),e.putImageData(v,0,s))}else{if(t.kind!==n.ImageKind.RGB_24BPP)throw new Error("bad image kind: "+t.kind);for(l=h*(u=a),i=0;i<p;i++){for(i>=f&&(l=h*(u=d)),r=0,s=l;s--;)y[r++]=g[m++],y[r++]=g[m++],y[r++]=g[m++],y[r++]=255;e.putImageData(v,0,i*a)}}}}function r(e,t){for(var r=t.height,n=t.width,i=r%a,o=(r-i)/a,s=0===i?o:o+1,u=e.createImageData(n,a),l=0,c=t.data,h=u.data,d=0;d<s;d++){for(var f=d<o?a:i,p=3,v=0;v<f;v++)for(var m=0,g=0;g<n;g++){if(!m){var y=c[l++];m=128}h[p]=y&m?0:255,p+=4,m>>=1}e.putImageData(u,0,d*a)}}function c(e,t){for(var r=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"],n=0,i=r.length;n<i;n++){var a=r[n];void 0!==e[a]&&(t[a]=e[a])}void 0!==e.setLineDash&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function h(e){e.strokeStyle="#000000",e.fillStyle="#000000",e.fillRule="nonzero",e.globalAlpha=1,e.lineWidth=1,e.lineCap="butt",e.lineJoin="miter",e.miterLimit=10,e.globalCompositeOperation="source-over",e.font="10px sans-serif",void 0!==e.setLineDash&&(e.setLineDash([]),e.lineDashOffset=0)}function d(e,t,r,n){for(var i=e.length,a=3;a<i;a+=4){var o=e[a];if(0===o)e[a-3]=t,e[a-2]=r,e[a-1]=n;else if(o<255){var s=255-o;e[a-3]=e[a-3]*o+t*s>>8,e[a-2]=e[a-2]*o+r*s>>8,e[a-1]=e[a-1]*o+n*s>>8}}}function f(e,t,r){for(var n=e.length,i=3;i<n;i+=4){var a=r?r[e[i]]:e[i];t[i]=t[i]*a*(1/255)|0}}function p(e,t,r){for(var n=e.length,i=3;i<n;i+=4){var a=77*e[i-3]+152*e[i-2]+28*e[i-1];t[i]=r?t[i]*r[a>>8]>>8:t[i]*a>>16}}function v(e,t,r,n){var i=t.canvas,a=t.context;e.setTransform(t.scaleX,0,0,t.scaleY,t.offsetX,t.offsetY);var o=t.backdrop||null;if(!t.transferMap&&n.isEnabled){var s=n.composeSMask({layer:r.canvas,mask:i,properties:{subtype:t.subtype,backdrop:o}});return e.setTransform(1,0,0,1,0,0),void e.drawImage(s,t.offsetX,t.offsetY)}!function(e,t,r,n,i,a,o){var s,u=!!a,l=u?a[0]:0,c=u?a[1]:0,h=u?a[2]:0;s="Luminosity"===i?p:f;for(var v=Math.min(n,Math.ceil(1048576/r)),m=0;m<n;m+=v){var g=Math.min(v,n-m),y=e.getImageData(0,m,r,g),b=t.getImageData(0,m,r,g);u&&d(y.data,l,c,h),s(y.data,b.data,o),e.putImageData(b,0,m)}}(a,r,i.width,i.height,t.subtype,o,t.transferMap),e.drawImage(i,0,0)}var m=["butt","round","square"],g=["miter","round","bevel"],y={},b={};for(var _ in e.prototype={beginDrawing:function(e){var t=e.transform,r=e.viewport,n=e.transparency,i=e.background,a=void 0===i?null:i,o=this.ctx.canvas.width,s=this.ctx.canvas.height;if(this.ctx.save(),this.ctx.fillStyle=a||"rgb(255, 255, 255)",this.ctx.fillRect(0,0,o,s),this.ctx.restore(),n){var u=this.cachedCanvases.getCanvas("transparent",o,s,!0);this.compositeCtx=this.ctx,this.transparentCanvas=u.canvas,this.ctx=u.context,this.ctx.save(),this.ctx.transform.apply(this.ctx,this.compositeCtx.mozCurrentTransform)}this.ctx.save(),h(this.ctx),t&&this.ctx.transform.apply(this.ctx,t),this.ctx.transform.apply(this.ctx,r.transform),this.baseTransform=this.ctx.mozCurrentTransform.slice(),this.imageLayer&&this.imageLayer.beginLayout()},executeOperatorList:function(e,t,r,i){var a=e.argsArray,o=e.fnArray,s=t||0,u=a.length;if(u===s)return s;for(var l,c=u-s>10&&"function"==typeof r,h=c?Date.now()+15:0,d=0,f=this.commonObjs,p=this.objs;;){if(void 0!==i&&s===i.nextBreakPoint)return i.breakIt(s,r),s;if((l=o[s])!==n.OPS.dependency)this[l].apply(this,a[s]);else for(var v=a[s],m=0,g=v.length;m<g;m++){var y=v[m],b="g"===y[0]&&"_"===y[1]?f:p;if(!b.isResolved(y))return b.get(y,r),s}if(++s===u)return s;if(c&&++d>10){if(Date.now()>h)return r(),s;d=0}}},endDrawing:function(){null!==this.current.activeSMask&&this.endSMaskGroup(),this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null),this.cachedCanvases.clear(),this.webGLContext.clear(),this.imageLayer&&this.imageLayer.endLayout()},setLineWidth:function(e){this.current.lineWidth=e,this.ctx.lineWidth=e},setLineCap:function(e){this.ctx.lineCap=m[e]},setLineJoin:function(e){this.ctx.lineJoin=g[e]},setMiterLimit:function(e){this.ctx.miterLimit=e},setDash:function(e,t){var r=this.ctx;void 0!==r.setLineDash&&(r.setLineDash(e),r.lineDashOffset=t)},setRenderingIntent:function(e){},setFlatness:function(e){},setGState:function(e){for(var t=0,r=e.length;t<r;t++){var n=e[t],i=n[0],a=n[1];switch(i){case"LW":this.setLineWidth(a);break;case"LC":this.setLineCap(a);break;case"LJ":this.setLineJoin(a);break;case"ML":this.setMiterLimit(a);break;case"D":this.setDash(a[0],a[1]);break;case"RI":this.setRenderingIntent(a);break;case"FL":this.setFlatness(a);break;case"Font":this.setFont(a[0],a[1]);break;case"CA":this.current.strokeAlpha=n[1];break;case"ca":this.current.fillAlpha=n[1],this.ctx.globalAlpha=n[1];break;case"BM":this.ctx.globalCompositeOperation=a;break;case"SMask":this.current.activeSMask&&(this.stateStack.length>0&&this.stateStack[this.stateStack.length-1].activeSMask===this.current.activeSMask?this.suspendSMaskGroup():this.endSMaskGroup()),this.current.activeSMask=a?this.tempSMask:null,this.current.activeSMask&&this.beginSMaskGroup(),this.tempSMask=null}}},beginSMaskGroup:function(){var e=this.current.activeSMask,t=e.canvas.width,r=e.canvas.height,n="smaskGroupAt"+this.groupLevel,i=this.cachedCanvases.getCanvas(n,t,r,!0),a=this.ctx,o=a.mozCurrentTransform;this.ctx.save();var s=i.context;s.scale(1/e.scaleX,1/e.scaleY),s.translate(-e.offsetX,-e.offsetY),s.transform.apply(s,o),e.startTransformInverse=s.mozCurrentTransformInverse,c(a,s),this.ctx=s,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(a),this.groupLevel++},suspendSMaskGroup:function(){var e=this.ctx;this.groupLevel--,this.ctx=this.groupStack.pop(),v(this.ctx,this.current.activeSMask,e,this.webGLContext),this.ctx.restore(),this.ctx.save(),c(e,this.ctx),this.current.resumeSMaskCtx=e;var t=n.Util.transform(this.current.activeSMask.startTransformInverse,e.mozCurrentTransform);this.ctx.transform.apply(this.ctx,t),e.save(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,e.canvas.width,e.canvas.height),e.restore()},resumeSMaskGroup:function(){var e=this.current.resumeSMaskCtx,t=this.ctx;this.ctx=e,this.groupStack.push(t),this.groupLevel++},endSMaskGroup:function(){var e=this.ctx;this.groupLevel--,this.ctx=this.groupStack.pop(),v(this.ctx,this.current.activeSMask,e,this.webGLContext),this.ctx.restore(),c(e,this.ctx);var t=n.Util.transform(this.current.activeSMask.startTransformInverse,e.mozCurrentTransform);this.ctx.transform.apply(this.ctx,t)},save:function(){this.ctx.save();var e=this.current;this.stateStack.push(e),this.current=e.clone(),this.current.resumeSMaskCtx=null},restore:function(){this.current.resumeSMaskCtx&&this.resumeSMaskGroup(),null===this.current.activeSMask||0!==this.stateStack.length&&this.stateStack[this.stateStack.length-1].activeSMask===this.current.activeSMask||this.endSMaskGroup(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.ctx.restore(),this.pendingClip=null,this._cachedGetSinglePixelWidth=null)},transform:function(e,t,r,n,i,a){this.ctx.transform(e,t,r,n,i,a),this._cachedGetSinglePixelWidth=null},constructPath:function(e,t){for(var r=this.ctx,i=this.current,a=i.x,o=i.y,s=0,u=0,l=e.length;s<l;s++)switch(0|e[s]){case n.OPS.rectangle:a=t[u++],o=t[u++];var c=t[u++],h=t[u++];0===c&&(c=this.getSinglePixelWidth()),0===h&&(h=this.getSinglePixelWidth());var d=a+c,f=o+h;this.ctx.moveTo(a,o),this.ctx.lineTo(d,o),this.ctx.lineTo(d,f),this.ctx.lineTo(a,f),this.ctx.lineTo(a,o),this.ctx.closePath();break;case n.OPS.moveTo:a=t[u++],o=t[u++],r.moveTo(a,o);break;case n.OPS.lineTo:a=t[u++],o=t[u++],r.lineTo(a,o);break;case n.OPS.curveTo:a=t[u+4],o=t[u+5],r.bezierCurveTo(t[u],t[u+1],t[u+2],t[u+3],a,o),u+=6;break;case n.OPS.curveTo2:r.bezierCurveTo(a,o,t[u],t[u+1],t[u+2],t[u+3]),a=t[u+2],o=t[u+3],u+=4;break;case n.OPS.curveTo3:a=t[u+2],o=t[u+3],r.bezierCurveTo(t[u],t[u+1],a,o,a,o),u+=4;break;case n.OPS.closePath:r.closePath()}i.setCurrentPoint(a,o)},closePath:function(){this.ctx.closePath()},stroke:function(e){e=void 0===e||e;var t=this.ctx,r=this.current.strokeColor;t.lineWidth=Math.max(.65*this.getSinglePixelWidth(),this.current.lineWidth),t.globalAlpha=this.current.strokeAlpha,r&&r.hasOwnProperty("type")&&"Pattern"===r.type?(t.save(),t.strokeStyle=r.getPattern(t,this),t.stroke(),t.restore()):t.stroke(),e&&this.consumePath(),t.globalAlpha=this.current.fillAlpha},closeStroke:function(){this.closePath(),this.stroke()},fill:function(e){e=void 0===e||e;var t=this.ctx,r=this.current.fillColor,n=!1;this.current.patternFill&&(t.save(),this.baseTransform&&t.setTransform.apply(t,this.baseTransform),t.fillStyle=r.getPattern(t,this),n=!0),this.pendingEOFill?(t.fill("evenodd"),this.pendingEOFill=!1):t.fill(),n&&t.restore(),e&&this.consumePath()},eoFill:function(){this.pendingEOFill=!0,this.fill()},fillStroke:function(){this.fill(!1),this.stroke(!1),this.consumePath()},eoFillStroke:function(){this.pendingEOFill=!0,this.fillStroke()},closeFillStroke:function(){this.closePath(),this.fillStroke()},closeEOFillStroke:function(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()},endPath:function(){this.consumePath()},clip:function(){this.pendingClip=y},eoClip:function(){this.pendingClip=b},beginText:function(){this.current.textMatrix=n.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0},endText:function(){var e=this.pendingTextPaths,t=this.ctx;if(void 0!==e){t.save(),t.beginPath();for(var r=0;r<e.length;r++){var n=e[r];t.setTransform.apply(t,n.transform),t.translate(n.x,n.y),n.addToPath(t,n.fontSize)}t.restore(),t.clip(),t.beginPath(),delete this.pendingTextPaths}else t.beginPath()},setCharSpacing:function(e){this.current.charSpacing=e},setWordSpacing:function(e){this.current.wordSpacing=e},setHScale:function(e){this.current.textHScale=e/100},setLeading:function(e){this.current.leading=-e},setFont:function(e,t){var r=this.commonObjs.get(e),i=this.current;if(!r)throw new Error("Can't find font for "+e);if(i.fontMatrix=r.fontMatrix?r.fontMatrix:n.FONT_IDENTITY_MATRIX,0!==i.fontMatrix[0]&&0!==i.fontMatrix[3]||(0,n.warn)("Invalid font matrix for font "+e),t<0?(t=-t,i.fontDirection=-1):i.fontDirection=1,this.current.font=r,this.current.fontSize=t,!r.isType3Font){var a=r.loadedName||"sans-serif",o=r.black?"900":r.bold?"bold":"normal",s=r.italic?"italic":"normal",u='"'+a+'", '+r.fallbackName,l=t<16?16:t>100?100:t;this.current.fontSizeScale=t/l;var c=s+" "+o+" "+l+"px "+u;this.ctx.font=c}},setTextRenderingMode:function(e){this.current.textRenderingMode=e},setTextRise:function(e){this.current.textRise=e},moveText:function(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t},setLeadingMoveText:function(e,t){this.setLeading(-t),this.moveText(e,t)},setTextMatrix:function(e,t,r,n,i,a){this.current.textMatrix=[e,t,r,n,i,a],this.current.textMatrixScale=Math.sqrt(e*e+t*t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0},nextLine:function(){this.moveText(0,this.current.leading)},paintChar:function(e,t,r,i){var a,o=this.ctx,s=this.current,u=s.font,l=s.textRenderingMode,c=s.fontSize/s.fontSizeScale,h=l&n.TextRenderingMode.FILL_STROKE_MASK,d=!!(l&n.TextRenderingMode.ADD_TO_PATH_FLAG),f=s.patternFill&&u.data;((u.disableFontFace||d||f)&&(a=u.getPathGenerator(this.commonObjs,e)),u.disableFontFace||f?(o.save(),o.translate(t,r),o.beginPath(),a(o,c),i&&o.setTransform.apply(o,i),h!==n.TextRenderingMode.FILL&&h!==n.TextRenderingMode.FILL_STROKE||o.fill(),h!==n.TextRenderingMode.STROKE&&h!==n.TextRenderingMode.FILL_STROKE||o.stroke(),o.restore()):(h!==n.TextRenderingMode.FILL&&h!==n.TextRenderingMode.FILL_STROKE||o.fillText(e,t,r),h!==n.TextRenderingMode.STROKE&&h!==n.TextRenderingMode.FILL_STROKE||o.strokeText(e,t,r)),d)&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:o.mozCurrentTransform,x:t,y:r,fontSize:c,addToPath:a})},get isFontSubpixelAAEnabled(){var e=this.canvasFactory.create(10,10).context;e.scale(1.5,1),e.fillText("I",0,10);for(var t=e.getImageData(0,0,10,10).data,r=!1,i=3;i<t.length;i+=4)if(t[i]>0&&t[i]<255){r=!0;break}return(0,n.shadow)(this,"isFontSubpixelAAEnabled",r)},showText:function(e){var t=this.current,r=t.font;if(r.isType3Font)return this.showType3Text(e);var i=t.fontSize;if(0!==i){var a=this.ctx,o=t.fontSizeScale,s=t.charSpacing,u=t.wordSpacing,l=t.fontDirection,c=t.textHScale*l,h=e.length,d=r.vertical,f=d?1:-1,p=r.defaultVMetrics,v=i*t.fontMatrix[0],m=t.textRenderingMode===n.TextRenderingMode.FILL&&!r.disableFontFace&&!t.patternFill;a.save();var g=void 0;if(t.patternFill){a.save();var y=t.fillColor.getPattern(a,this);g=a.mozCurrentTransform,a.restore(),a.fillStyle=y}a.transform.apply(a,t.textMatrix),a.translate(t.x,t.y+t.textRise),l>0?a.scale(c,-1):a.scale(c,1);var b=t.lineWidth,_=t.textMatrixScale;if(0===_||0===b){var A=t.textRenderingMode&n.TextRenderingMode.FILL_STROKE_MASK;A!==n.TextRenderingMode.STROKE&&A!==n.TextRenderingMode.FILL_STROKE||(this._cachedGetSinglePixelWidth=null,b=.65*this.getSinglePixelWidth())}else b/=_;1!==o&&(a.scale(o,o),b/=o),a.lineWidth=b;var S,w=0;for(S=0;S<h;++S){var k=e[S];if((0,n.isNum)(k))w+=f*k*i/1e3;else{var P,x,C,R,E,T,O,I=!1,F=(k.isSpace?u:0)+s,L=k.fontChar,j=k.accent,M=k.width;if(d)E=k.vmetric||p,T=-(T=k.vmetric?E[1]:.5*M)*v,O=E[2]*v,M=E?-E[0]:M,P=T/o,x=(w+O)/o;else P=w/o,x=0;if(r.remeasure&&M>0){var D=1e3*a.measureText(L).width/i*o;if(M<D&&this.isFontSubpixelAAEnabled){var N=M/D;I=!0,a.save(),a.scale(N,1),P/=N}else M!==D&&(P+=(M-D)/2e3*i/o)}(k.isInFont||r.missingFile)&&(m&&!j?a.fillText(L,P,x):(this.paintChar(L,P,x,g),j&&(C=P+j.offset.x/o,R=x-j.offset.y/o,this.paintChar(j.fontChar,C,R,g)))),w+=M*v+F*l,I&&a.restore()}}d?t.y-=w*c:t.x+=w*c,a.restore()}},showType3Text:function(e){var t,r,i,a,o=this.ctx,s=this.current,u=s.font,l=s.fontSize,c=s.fontDirection,h=u.vertical?1:-1,d=s.charSpacing,f=s.wordSpacing,p=s.textHScale*c,v=s.fontMatrix||n.FONT_IDENTITY_MATRIX,m=e.length;if(!(s.textRenderingMode===n.TextRenderingMode.INVISIBLE)&&0!==l){for(this._cachedGetSinglePixelWidth=null,o.save(),o.transform.apply(o,s.textMatrix),o.translate(s.x,s.y),o.scale(p,c),t=0;t<m;++t)if(r=e[t],(0,n.isNum)(r))a=h*r*l/1e3,this.ctx.translate(a,0),s.x+=a*p;else{var g=(r.isSpace?f:0)+d,y=u.charProcOperatorList[r.operatorListId];if(y)this.processingType3=r,this.save(),o.scale(l,l),o.transform.apply(o,v),this.executeOperatorList(y),this.restore(),i=n.Util.applyTransform([r.width,0],v)[0]*l+g,o.translate(i,0),s.x+=i*p;else(0,n.warn)('Type3 character "'+r.operatorListId+'" is not available.')}o.restore(),this.processingType3=null}},setCharWidth:function(e,t){},setCharWidthAndBounds:function(e,t,r,n,i,a){this.ctx.rect(r,n,i-r,a-n),this.clip(),this.endPath()},getColorN_Pattern:function(t){var r,n=this;if("TilingPattern"===t[0]){var a=t[1],o=this.baseTransform||this.ctx.mozCurrentTransform.slice(),s={createCanvasGraphics:function(t){return new e(t,n.commonObjs,n.objs,n.canvasFactory,n.webGLContext)}};r=new i.TilingPattern(t,a,this.ctx,s,o)}else r=(0,i.getShadingPatternFromIR)(t);return r},setStrokeColorN:function(){this.current.strokeColor=this.getColorN_Pattern(arguments)},setFillColorN:function(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0},setStrokeRGBColor:function(e,t,r){var i=n.Util.makeCssRgb(e,t,r);this.ctx.strokeStyle=i,this.current.strokeColor=i},setFillRGBColor:function(e,t,r){var i=n.Util.makeCssRgb(e,t,r);this.ctx.fillStyle=i,this.current.fillColor=i,this.current.patternFill=!1},shadingFill:function(e){var t=this.ctx;this.save();var r=(0,i.getShadingPatternFromIR)(e);t.fillStyle=r.getPattern(t,this,!0);var a=t.mozCurrentTransformInverse;if(a){var o=t.canvas,s=o.width,u=o.height,l=n.Util.applyTransform([0,0],a),c=n.Util.applyTransform([0,u],a),h=n.Util.applyTransform([s,0],a),d=n.Util.applyTransform([s,u],a),f=Math.min(l[0],c[0],h[0],d[0]),p=Math.min(l[1],c[1],h[1],d[1]),v=Math.max(l[0],c[0],h[0],d[0]),m=Math.max(l[1],c[1],h[1],d[1]);this.ctx.fillRect(f,p,v-f,m-p)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.restore()},beginInlineImage:function(){(0,n.unreachable)("Should not call beginInlineImage")},beginImageData:function(){(0,n.unreachable)("Should not call beginImageData")},paintFormXObjectBegin:function(e,t){if(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(e)&&6===e.length&&this.transform.apply(this,e),this.baseTransform=this.ctx.mozCurrentTransform,Array.isArray(t)&&4===t.length){var r=t[2]-t[0],n=t[3]-t[1];this.ctx.rect(t[0],t[1],r,n),this.clip(),this.endPath()}},paintFormXObjectEnd:function(){this.restore(),this.baseTransform=this.baseTransformStack.pop()},beginGroup:function(e){this.save();var t=this.ctx;e.isolated||(0,n.info)("TODO: Support non-isolated groups."),e.knockout&&(0,n.warn)("Knockout groups not supported.");var r=t.mozCurrentTransform;if(e.matrix&&t.transform.apply(t,e.matrix),!e.bbox)throw new Error("Bounding box is required.");var i=n.Util.getAxialAlignedBoundingBox(e.bbox,t.mozCurrentTransform),a=[0,0,t.canvas.width,t.canvas.height];i=n.Util.intersect(i,a)||[0,0,0,0];var o=Math.floor(i[0]),s=Math.floor(i[1]),u=Math.max(Math.ceil(i[2])-o,1),l=Math.max(Math.ceil(i[3])-s,1),h=1,d=1;u>4096&&(h=u/4096,u=4096),l>4096&&(d=l/4096,l=4096);var f="groupAt"+this.groupLevel;e.smask&&(f+="_smask_"+this.smaskCounter++%2);var p=this.cachedCanvases.getCanvas(f,u,l,!0),v=p.context;v.scale(1/h,1/d),v.translate(-o,-s),v.transform.apply(v,r),e.smask?this.smaskStack.push({canvas:p.canvas,context:v,offsetX:o,offsetY:s,scaleX:h,scaleY:d,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(o,s),t.scale(h,d)),c(t,v),this.ctx=v,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++,this.current.activeSMask=null},endGroup:function(e){this.groupLevel--;var t=this.ctx;this.ctx=this.groupStack.pop(),void 0!==this.ctx.imageSmoothingEnabled?this.ctx.imageSmoothingEnabled=!1:this.ctx.mozImageSmoothingEnabled=!1,e.smask?this.tempSMask=this.smaskStack.pop():this.ctx.drawImage(t.canvas,0,0),this.restore()},beginAnnotations:function(){this.save(),this.baseTransform&&this.ctx.setTransform.apply(this.ctx,this.baseTransform)},endAnnotations:function(){this.restore()},beginAnnotation:function(e,t,r){if(this.save(),h(this.ctx),this.current=new l,Array.isArray(e)&&4===e.length){var n=e[2]-e[0],i=e[3]-e[1];this.ctx.rect(e[0],e[1],n,i),this.clip(),this.endPath()}this.transform.apply(this,t),this.transform.apply(this,r)},endAnnotation:function(){this.restore()},paintJpegXObject:function(e,t,r){var i=this.objs.get(e);if(i){this.save();var a=this.ctx;if(a.scale(1/t,-1/r),a.drawImage(i,0,0,i.width,i.height,0,-r,t,r),this.imageLayer){var o=a.mozCurrentTransformInverse,s=this.getCanvasPosition(0,0);this.imageLayer.appendImage({objId:e,left:s[0],top:s[1],width:t/o[0],height:r/o[3]})}this.restore()}else(0,n.warn)("Dependent image isn't ready yet")},paintImageMaskXObject:function(e){var t=this.ctx,n=e.width,i=e.height,a=this.current.fillColor,o=this.current.patternFill,s=this.processingType3;if(s&&void 0===s.compiled&&(s.compiled=n<=1e3&&i<=1e3?function(e){var t,r,n,i,a=e.width,o=e.height,s=a+1,u=new Uint8Array(s*(o+1)),l=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),c=a+7&-8,h=e.data,d=new Uint8Array(c*o),f=0;for(t=0,i=h.length;t<i;t++)for(var p=128,v=h[t];p>0;)d[f++]=v&p?0:255,p>>=1;var m=0;for(0!==d[f=0]&&(u[0]=1,++m),r=1;r<a;r++)d[f]!==d[f+1]&&(u[r]=d[f]?2:1,++m),f++;for(0!==d[f]&&(u[r]=2,++m),t=1;t<o;t++){n=t*s,d[(f=t*c)-c]!==d[f]&&(u[n]=d[f]?1:8,++m);var g=(d[f]?4:0)+(d[f-c]?8:0);for(r=1;r<a;r++)l[g=(g>>2)+(d[f+1]?4:0)+(d[f-c+1]?8:0)]&&(u[n+r]=l[g],++m),f++;if(d[f-c]!==d[f]&&(u[n+r]=d[f]?2:4,++m),m>1e3)return null}for(n=t*s,0!==d[f=c*(o-1)]&&(u[n]=8,++m),r=1;r<a;r++)d[f]!==d[f+1]&&(u[n+r]=d[f]?4:8,++m),f++;if(0!==d[f]&&(u[n+r]=4,++m),m>1e3)return null;var y=new Int32Array([0,s,-1,0,-s,0,0,0,1]),b=[];for(t=0;m&&t<=o;t++){for(var _=t*s,A=_+a;_<A&&!u[_];)_++;if(_!==A){var S,w=[_%s,t],k=u[_],P=_;do{var x=y[k];do{_+=x}while(!u[_]);5!==(S=u[_])&&10!==S?(k=S,u[_]=0):(k=S&51*k>>4,u[_]&=k>>2|k<<2),w.push(_%s),w.push(_/s|0),--m}while(P!==_);b.push(w),--t}}return function(e){e.save(),e.scale(1/a,-1/o),e.translate(0,-o),e.beginPath();for(var t=0,r=b.length;t<r;t++){var n=b[t];e.moveTo(n[0],n[1]);for(var i=2,s=n.length;i<s;i+=2)e.lineTo(n[i],n[i+1])}e.fill(),e.beginPath(),e.restore()}}({data:e.data,width:n,height:i}):null),s&&s.compiled)s.compiled(t);else{var u=this.cachedCanvases.getCanvas("maskCanvas",n,i),l=u.context;l.save(),r(l,e),l.globalCompositeOperation="source-in",l.fillStyle=o?a.getPattern(l,this):a,l.fillRect(0,0,n,i),l.restore(),this.paintInlineImageXObject(u.canvas)}},paintImageMaskXObjectRepeat:function(e,t,n,i){var a=e.width,o=e.height,s=this.current.fillColor,u=this.current.patternFill,l=this.cachedCanvases.getCanvas("maskCanvas",a,o),c=l.context;c.save(),r(c,e),c.globalCompositeOperation="source-in",c.fillStyle=u?s.getPattern(c,this):s,c.fillRect(0,0,a,o),c.restore();for(var h=this.ctx,d=0,f=i.length;d<f;d+=2)h.save(),h.transform(t,0,0,n,i[d],i[d+1]),h.scale(1,-1),h.drawImage(l.canvas,0,0,a,o,0,-1,1,1),h.restore()},paintImageMaskXObjectGroup:function(e){for(var t=this.ctx,n=this.current.fillColor,i=this.current.patternFill,a=0,o=e.length;a<o;a++){var s=e[a],u=s.width,l=s.height,c=this.cachedCanvases.getCanvas("maskCanvas",u,l),h=c.context;h.save(),r(h,s),h.globalCompositeOperation="source-in",h.fillStyle=i?n.getPattern(h,this):n,h.fillRect(0,0,u,l),h.restore(),t.save(),t.transform.apply(t,s.transform),t.scale(1,-1),t.drawImage(c.canvas,0,0,u,l,0,-1,1,1),t.restore()}},paintImageXObject:function(e){var t=this.objs.get(e);t?this.paintInlineImageXObject(t):(0,n.warn)("Dependent image isn't ready yet")},paintImageXObjectRepeat:function(e,t,r,i){var a=this.objs.get(e);if(a){for(var o=a.width,s=a.height,u=[],l=0,c=i.length;l<c;l+=2)u.push({transform:[t,0,0,r,i[l],i[l+1]],x:0,y:0,w:o,h:s});this.paintInlineImageXObjectGroup(a,u)}else(0,n.warn)("Dependent image isn't ready yet")},paintInlineImageXObject:function(e){var r=e.width,n=e.height,i=this.ctx;this.save(),i.scale(1/r,-1/n);var a,o,s=i.mozCurrentTransformInverse,u=s[0],l=s[1],c=Math.max(Math.sqrt(u*u+l*l),1),h=s[2],d=s[3],f=Math.max(Math.sqrt(h*h+d*d),1);if("function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)a=e;else{var p=(o=this.cachedCanvases.getCanvas("inlineImage",r,n)).context;t(p,e),a=o.canvas}for(var v=r,m=n,g="prescale1";c>2&&v>1||f>2&&m>1;){var y=v,b=m;c>2&&v>1&&(c/=v/(y=Math.ceil(v/2))),f>2&&m>1&&(f/=m/(b=Math.ceil(m/2))),(p=(o=this.cachedCanvases.getCanvas(g,y,b)).context).clearRect(0,0,y,b),p.drawImage(a,0,0,v,m,0,0,y,b),a=o.canvas,v=y,m=b,g="prescale1"===g?"prescale2":"prescale1"}if(i.drawImage(a,0,0,v,m,0,-n,r,n),this.imageLayer){var _=this.getCanvasPosition(0,-n);this.imageLayer.appendImage({imgData:e,left:_[0],top:_[1],width:r/s[0],height:n/s[3]})}this.restore()},paintInlineImageXObjectGroup:function(e,r){var n=this.ctx,i=e.width,a=e.height,o=this.cachedCanvases.getCanvas("inlineImage",i,a);t(o.context,e);for(var s=0,u=r.length;s<u;s++){var l=r[s];if(n.save(),n.transform.apply(n,l.transform),n.scale(1,-1),n.drawImage(o.canvas,l.x,l.y,l.w,l.h,0,-1,1,1),this.imageLayer){var c=this.getCanvasPosition(l.x,l.y);this.imageLayer.appendImage({imgData:e,left:c[0],top:c[1],width:i,height:a})}n.restore()}},paintSolidColorImageMask:function(){this.ctx.fillRect(0,0,1,1)},paintXObject:function(){(0,n.warn)("Unsupported 'paintXObject' command.")},markPoint:function(e){},markPointProps:function(e,t){},beginMarkedContent:function(e){},beginMarkedContentProps:function(e,t){},endMarkedContent:function(){},beginCompat:function(){},endCompat:function(){},consumePath:function(){var e=this.ctx;this.pendingClip&&(this.pendingClip===b?e.clip("evenodd"):e.clip(),this.pendingClip=null),e.beginPath()},getSinglePixelWidth:function(e){if(null===this._cachedGetSinglePixelWidth){var t=this.ctx.mozCurrentTransformInverse;this._cachedGetSinglePixelWidth=Math.sqrt(Math.max(t[0]*t[0]+t[1]*t[1],t[2]*t[2]+t[3]*t[3]))}return this._cachedGetSinglePixelWidth},getCanvasPosition:function(e,t){var r=this.ctx.mozCurrentTransform;return[r[0]*e+r[2]*t+r[4],r[1]*e+r[3]*t+r[5]]}},n.OPS)e.prototype[n.OPS[_]]=e.prototype[_];return e}();t.CanvasGraphics=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TilingPattern=t.getShadingPatternFromIR=void 0;var n=r(1),i={RadialAxial:{fromIR:function(e){var t=e[1],r=e[2],n=e[3],i=e[4],a=e[5],o=e[6];return{type:"Pattern",getPattern:function(e){var s;"axial"===t?s=e.createLinearGradient(n[0],n[1],i[0],i[1]):"radial"===t&&(s=e.createRadialGradient(n[0],n[1],a,i[0],i[1],o));for(var u=0,l=r.length;u<l;++u){var c=r[u];s.addColorStop(c[0],c[1])}return s}}}}},a=function(){function e(e,t,r,n,i,a,o,s){var u,l=t.coords,c=t.colors,h=e.data,d=4*e.width;l[r+1]>l[n+1]&&(u=r,r=n,n=u,u=a,a=o,o=u),l[n+1]>l[i+1]&&(u=n,n=i,i=u,u=o,o=s,s=u),l[r+1]>l[n+1]&&(u=r,r=n,n=u,u=a,a=o,o=u);var f=(l[r]+t.offsetX)*t.scaleX,p=(l[r+1]+t.offsetY)*t.scaleY,v=(l[n]+t.offsetX)*t.scaleX,m=(l[n+1]+t.offsetY)*t.scaleY,g=(l[i]+t.offsetX)*t.scaleX,y=(l[i+1]+t.offsetY)*t.scaleY;if(!(p>=y))for(var b,_,A,S,w,k,P,x,C,R=c[a],E=c[a+1],T=c[a+2],O=c[o],I=c[o+1],F=c[o+2],L=c[s],j=c[s+1],M=c[s+2],D=Math.round(p),N=Math.round(y),q=D;q<=N;q++){q<m?(b=f-(f-v)*(C=q<p?0:p===m?1:(p-q)/(p-m)),_=R-(R-O)*C,A=E-(E-I)*C,S=T-(T-F)*C):(b=v-(v-g)*(C=q>y?1:m===y?0:(m-q)/(m-y)),_=O-(O-L)*C,A=I-(I-j)*C,S=F-(F-M)*C),w=f-(f-g)*(C=q<p?0:q>y?1:(p-q)/(p-y)),k=R-(R-L)*C,P=E-(E-j)*C,x=T-(T-M)*C;for(var W=Math.round(Math.min(b,w)),U=Math.round(Math.max(b,w)),B=d*q+4*W,z=W;z<=U;z++)C=(C=(b-z)/(b-w))<0?0:C>1?1:C,h[B++]=_-(_-k)*C|0,h[B++]=A-(A-P)*C|0,h[B++]=S-(S-x)*C|0,h[B++]=255}}function t(t,r,n){var i,a,o=r.coords,s=r.colors;switch(r.type){case"lattice":var u=r.verticesPerRow,l=Math.floor(o.length/u)-1,c=u-1;for(i=0;i<l;i++)for(var h=i*u,d=0;d<c;d++,h++)e(t,n,o[h],o[h+1],o[h+u],s[h],s[h+1],s[h+u]),e(t,n,o[h+u+1],o[h+1],o[h+u],s[h+u+1],s[h+1],s[h+u]);break;case"triangles":for(i=0,a=o.length;i<a;i+=3)e(t,n,o[i],o[i+1],o[i+2],s[i],s[i+1],s[i+2]);break;default:throw new Error("illegal figure")}}return function(e,r,n,i,a,o,s,u){var l,c,h,d,f=Math.floor(e[0]),p=Math.floor(e[1]),v=Math.ceil(e[2])-f,m=Math.ceil(e[3])-p,g=Math.min(Math.ceil(Math.abs(v*r[0]*1.1)),3e3),y=Math.min(Math.ceil(Math.abs(m*r[1]*1.1)),3e3),b=v/g,_=m/y,A={coords:n,colors:i,offsetX:-f,offsetY:-p,scaleX:1/b,scaleY:1/_},S=g+4,w=y+4;if(u.isEnabled)l=u.drawFigures({width:g,height:y,backgroundColor:o,figures:a,context:A}),(c=s.getCanvas("mesh",S,w,!1)).context.drawImage(l,2,2),l=c.canvas;else{var k=(c=s.getCanvas("mesh",S,w,!1)).context,P=k.createImageData(g,y);if(o){var x=P.data;for(h=0,d=x.length;h<d;h+=4)x[h]=o[0],x[h+1]=o[1],x[h+2]=o[2],x[h+3]=255}for(h=0;h<a.length;h++)t(P,a[h],A);k.putImageData(P,2,2),l=c.canvas}return{canvas:l,offsetX:f-2*b,offsetY:p-2*_,scaleX:b,scaleY:_}}}();i.Mesh={fromIR:function(e){var t=e[2],r=e[3],i=e[4],o=e[5],s=e[6],u=e[8];return{type:"Pattern",getPattern:function(e,l,c){var h;if(c)h=n.Util.singularValueDecompose2dScale(e.mozCurrentTransform);else if(h=n.Util.singularValueDecompose2dScale(l.baseTransform),s){var d=n.Util.singularValueDecompose2dScale(s);h=[h[0]*d[0],h[1]*d[1]]}var f=a(o,h,t,r,i,c?null:u,l.cachedCanvases,l.webGLContext);return c||(e.setTransform.apply(e,l.baseTransform),s&&e.transform.apply(e,s)),e.translate(f.offsetX,f.offsetY),e.scale(f.scaleX,f.scaleY),e.createPattern(f.canvas,"no-repeat")}}}},i.Dummy={fromIR:function(){return{type:"Pattern",getPattern:function(){return"hotpink"}}}};var o=function(){var e=1,t=2;function r(e,t,r,n,i){this.operatorList=e[2],this.matrix=e[3]||[1,0,0,1,0,0],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=t,this.canvasGraphicsFactory=n,this.baseTransform=i,this.type="Pattern",this.ctx=r}return r.prototype={createPatternCanvas:function(e){var t=this.operatorList,r=this.bbox,i=this.xstep,a=this.ystep,o=this.paintType,s=this.tilingType,u=this.color,l=this.canvasGraphicsFactory;(0,n.info)("TilingType: "+s);var c=r[0],h=r[1],d=r[2],f=r[3],p=[c,h],v=[c+i,h+a],m=v[0]-p[0],g=v[1]-p[1],y=n.Util.singularValueDecompose2dScale(this.matrix),b=n.Util.singularValueDecompose2dScale(this.baseTransform),_=[y[0]*b[0],y[1]*b[1]];m=Math.min(Math.ceil(Math.abs(m*_[0])),3e3),g=Math.min(Math.ceil(Math.abs(g*_[1])),3e3);var A=e.cachedCanvases.getCanvas("pattern",m,g,!0),S=A.context,w=l.createCanvasGraphics(S);w.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(w,o,u),this.setScale(m,g,i,a),this.transformToScale(w);var k=[1,0,0,1,-p[0],-p[1]];return w.transform.apply(w,k),this.clipBbox(w,r,c,h,d,f),w.executeOperatorList(t),A.canvas},setScale:function(e,t,r,n){this.scale=[e/r,t/n]},transformToScale:function(e){var t=this.scale,r=[t[0],0,0,t[1],0,0];e.transform.apply(e,r)},scaleToContext:function(){var e=this.scale;this.ctx.scale(1/e[0],1/e[1])},clipBbox:function(e,t,r,n,i,a){if(Array.isArray(t)&&4===t.length){var o=i-r,s=a-n;e.ctx.rect(r,n,o,s),e.clip(),e.endPath()}},setFillAndStrokeStyleToContext:function(r,i,a){var o=r.ctx,s=r.current;switch(i){case e:var u=this.ctx;o.fillStyle=u.fillStyle,o.strokeStyle=u.strokeStyle,s.fillColor=u.fillStyle,s.strokeColor=u.strokeStyle;break;case t:var l=n.Util.makeCssRgb(a[0],a[1],a[2]);o.fillStyle=l,o.strokeStyle=l,s.fillColor=l,s.strokeColor=l;break;default:throw new n.FormatError("Unsupported paint type: "+i)}},getPattern:function(e,t){var r=this.createPatternCanvas(t);return(e=this.ctx).setTransform.apply(e,this.baseTransform),e.transform.apply(e,this.matrix),this.scaleToContext(),e.createPattern(r,"repeat")}},r}();t.getShadingPatternFromIR=function(e){var t=i[e[0]];if(!t)throw new Error("Unknown IR type: "+e[0]);return t.fromIR(e)},t.TilingPattern=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.create(null);n.workerPort=void 0===n.workerPort?null:n.workerPort,n.workerSrc=void 0===n.workerSrc?"":n.workerSrc,t.GlobalWorkerOptions=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageHandler=void 0;var n,i,a,o=r(137),s=(n=o)&&n.__esModule?n:{default:n},u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l=(i=s.default.mark(function e(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return");case 2:return e.abrupt("return",t.apply(n,r));case 3:case"end":return e.stop()}},e,this)}),a=function(){var e=i.apply(this,arguments);return new Promise(function(t,r){return function n(i,a){try{var o=e[i](a),s=o.value}catch(e){return void r(e)}if(!o.done)return Promise.resolve(s).then(function(e){n("next",e)},function(e){n("throw",e)});t(s)}("next")})},function(e,t){return a.apply(this,arguments)}),c=r(1);function h(e){if("object"!==(void 0===e?"undefined":u(e)))return e;switch(e.name){case"AbortException":return new c.AbortException(e.message);case"MissingPDFException":return new c.MissingPDFException(e.message);case"UnexpectedResponseException":return new c.UnexpectedResponseException(e.message,e.status);default:return new c.UnknownErrorException(e.message,e.details)}}function d(e,t,r){t?e.resolve():e.reject(r)}function f(e,t,r){var n=this;this.sourceName=e,this.targetName=t,this.comObj=r,this.callbackId=1,this.streamId=1,this.postMessageTransfers=!0,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null);var i=this.callbacksCapabilities=Object.create(null),a=this.actionHandler=Object.create(null);this._onComObjOnMessage=function(e){var t=e.data;if(t.targetName===n.sourceName)if(t.stream)n._processStreamMessage(t);else if(t.isReply){var o=t.callbackId;if(!(t.callbackId in i))throw new Error("Cannot resolve callback "+o);var s=i[o];delete i[o],"error"in t?s.reject(h(t.error)):s.resolve(t.data)}else{if(!(t.action in a))throw new Error("Unknown action from worker: "+t.action);var u=a[t.action];if(t.callbackId){var l=n.sourceName,d=t.sourceName;Promise.resolve().then(function(){return u[0].call(u[1],t.data)}).then(function(e){r.postMessage({sourceName:l,targetName:d,isReply:!0,callbackId:t.callbackId,data:e})},function(e){r.postMessage({sourceName:l,targetName:d,isReply:!0,callbackId:t.callbackId,error:function(e){return!(e instanceof Error)||e instanceof c.AbortException||e instanceof c.MissingPDFException||e instanceof c.UnexpectedResponseException||e instanceof c.UnknownErrorException?e:new c.UnknownErrorException(e.message,e.toString())}(e)})})}else t.streamId?n._createStreamSink(t):u[0].call(u[1],t.data)}},r.addEventListener("message",this._onComObjOnMessage)}f.prototype={on:function(e,t,r){var n=this.actionHandler;if(n[e])throw new Error('There is already an actionName called "'+e+'"');n[e]=[t,r]},send:function(e,t,r){var n={sourceName:this.sourceName,targetName:this.targetName,action:e,data:t};this.postMessage(n,r)},sendWithPromise:function(e,t,r){var n=this.callbackId++,i={sourceName:this.sourceName,targetName:this.targetName,action:e,data:t,callbackId:n},a=(0,c.createPromiseCapability)();this.callbacksCapabilities[n]=a;try{this.postMessage(i,r)}catch(e){a.reject(e)}return a.promise},sendWithStream:function(e,t,r,n){var i=this,a=this.streamId++,o=this.sourceName,s=this.targetName;return new c.ReadableStream({start:function(r){var n=(0,c.createPromiseCapability)();return i.streamControllers[a]={controller:r,startCall:n,isClosed:!1},i.postMessage({sourceName:o,targetName:s,action:e,streamId:a,data:t,desiredSize:r.desiredSize}),n.promise},pull:function(e){var t=(0,c.createPromiseCapability)();return i.streamControllers[a].pullCall=t,i.postMessage({sourceName:o,targetName:s,stream:"pull",streamId:a,desiredSize:e.desiredSize}),t.promise},cancel:function(e){var t=(0,c.createPromiseCapability)();return i.streamControllers[a].cancelCall=t,i.streamControllers[a].isClosed=!0,i.postMessage({sourceName:o,targetName:s,stream:"cancel",reason:e,streamId:a}),t.promise}},r)},_createStreamSink:function(e){var t=this,r=this,n=this.actionHandler[e.action],i=e.streamId,a=e.desiredSize,o=this.sourceName,s=e.sourceName,u=function(e){var r=e.stream,n=e.chunk,a=e.transfers,u=e.success,l=e.reason;t.postMessage({sourceName:o,targetName:s,stream:r,streamId:i,chunk:n,success:u,reason:l},a)},h={enqueue:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments[2];if(!this.isCancelled){var n=this.desiredSize;this.desiredSize-=t,n>0&&this.desiredSize<=0&&(this.sinkCapability=(0,c.createPromiseCapability)(),this.ready=this.sinkCapability.promise),u({stream:"enqueue",chunk:e,transfers:r})}},close:function(){this.isCancelled||(this.isCancelled=!0,u({stream:"close"}),delete r.streamSinks[i])},error:function(e){this.isCancelled||(this.isCancelled=!0,u({stream:"error",reason:e}))},sinkCapability:(0,c.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:a,ready:null};h.sinkCapability.resolve(),h.ready=h.sinkCapability.promise,this.streamSinks[i]=h,l(n[0],[e.data,h],n[1]).then(function(){u({stream:"start_complete",success:!0})},function(e){u({stream:"start_complete",success:!1,reason:e})})},_processStreamMessage:function(e){var t=this,r=this.sourceName,n=e.sourceName,i=e.streamId,a=function(e){var a=e.stream,o=e.success,s=e.reason;t.comObj.postMessage({sourceName:r,targetName:n,stream:a,success:o,streamId:i,reason:s})},o=function(){Promise.all([t.streamControllers[e.streamId].startCall,t.streamControllers[e.streamId].pullCall,t.streamControllers[e.streamId].cancelCall].map(function(e){return e&&(t=e.promise,Promise.resolve(t).catch(function(){}));var t})).then(function(){delete t.streamControllers[e.streamId]})};switch(e.stream){case"start_complete":d(this.streamControllers[e.streamId].startCall,e.success,h(e.reason));break;case"pull_complete":d(this.streamControllers[e.streamId].pullCall,e.success,h(e.reason));break;case"pull":if(!this.streamSinks[e.streamId]){a({stream:"pull_complete",success:!0});break}this.streamSinks[e.streamId].desiredSize<=0&&e.desiredSize>0&&this.streamSinks[e.streamId].sinkCapability.resolve(),this.streamSinks[e.streamId].desiredSize=e.desiredSize,l(this.streamSinks[e.streamId].onPull).then(function(){a({stream:"pull_complete",success:!0})},function(e){a({stream:"pull_complete",success:!1,reason:e})});break;case"enqueue":(0,c.assert)(this.streamControllers[e.streamId],"enqueue should have stream controller"),this.streamControllers[e.streamId].isClosed||this.streamControllers[e.streamId].controller.enqueue(e.chunk);break;case"close":if((0,c.assert)(this.streamControllers[e.streamId],"close should have stream controller"),this.streamControllers[e.streamId].isClosed)break;this.streamControllers[e.streamId].isClosed=!0,this.streamControllers[e.streamId].controller.close(),o();break;case"error":(0,c.assert)(this.streamControllers[e.streamId],"error should have stream controller"),this.streamControllers[e.streamId].controller.error(h(e.reason)),o();break;case"cancel_complete":d(this.streamControllers[e.streamId].cancelCall,e.success,h(e.reason)),o();break;case"cancel":if(!this.streamSinks[e.streamId])break;l(this.streamSinks[e.streamId].onCancel,[h(e.reason)]).then(function(){a({stream:"cancel_complete",success:!0})},function(e){a({stream:"cancel_complete",success:!1,reason:e})}),this.streamSinks[e.streamId].sinkCapability.reject(h(e.reason)),this.streamSinks[e.streamId].isCancelled=!0,delete this.streamSinks[e.streamId];break;default:throw new Error("Unexpected stream case")}},postMessage:function(e,t){t&&this.postMessageTransfers?this.comObj.postMessage(e,t):this.comObj.postMessage(e)},destroy:function(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}},t.MessageHandler=f},function(e,t,r){"use strict";e.exports=r(138)},function(e,t,r){"use strict";var n=function(){return this}()||Function("return this")(),i=n.regeneratorRuntime&&Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime")>=0,a=i&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,e.exports=r(139),i)n.regeneratorRuntime=a;else try{delete n.regeneratorRuntime}catch(e){n.regeneratorRuntime=void 0}},function(e,t,r){"use strict";(function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(r){var n,i=Object.prototype,a=i.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag",c="object"===t(e),h=r.regeneratorRuntime;if(h)c&&(e.exports=h);else{(h=r.regeneratorRuntime=c?e.exports:{}).wrap=A;var d="suspendedStart",f="suspendedYield",p="executing",v="completed",m={},g={};g[s]=function(){return this};var y=Object.getPrototypeOf,b=y&&y(y(I([])));b&&b!==i&&a.call(b,s)&&(g=b);var _=P.prototype=w.prototype=Object.create(g);k.prototype=_.constructor=P,P.constructor=k,P[l]=k.displayName="GeneratorFunction",h.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===k||"GeneratorFunction"===(t.displayName||t.name))},h.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,P):(e.__proto__=P,l in e||(e[l]="GeneratorFunction")),e.prototype=Object.create(_),e},h.awrap=function(e){return{__await:e}},x(C.prototype),C.prototype[u]=function(){return this},h.AsyncIterator=C,h.async=function(e,t,r,n){var i=new C(A(e,t,r,n));return h.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},x(_),_[l]="Generator",_[s]=function(){return this},_.toString=function(){return"[object Generator]"},h.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},h.values=I,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,i){return s.type="throw",s.arg=e,t.next=r,i&&(t.method="next",t.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=a.call(o,"catchLoc"),l=a.call(o,"finallyLoc");if(u&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;T(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:I(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),m}}}function A(e,t,r,n){var i=t&&t.prototype instanceof w?t:w,a=Object.create(i.prototype),o=new O(n||[]);return a._invoke=function(e,t,r){var n=d;return function(i,a){if(n===p)throw new Error("Generator is already running");if(n===v){if("throw"===i)throw a;return F()}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=R(o,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===d)throw n=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var u=S(e,t,r);if("normal"===u.type){if(n=r.done?v:f,u.arg===m)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=v,r.method="throw",r.arg=u.arg)}}}(e,r,o),a}function S(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function w(){}function k(){}function P(){}function x(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function C(e){var r;this._invoke=function(n,i){function o(){return new Promise(function(r,o){!function r(n,i,o,s){var u=S(e[n],e,i);if("throw"!==u.type){var l=u.arg,c=l.value;return c&&"object"===(void 0===c?"undefined":t(c))&&a.call(c,"__await")?Promise.resolve(c.__await).then(function(e){r("next",e,o,s)},function(e){r("throw",e,o,s)}):Promise.resolve(c).then(function(e){l.value=e,o(l)},s)}s(u.arg)}(n,i,r,o)})}return r=r?r.then(o,o):o()}}function R(e,t){var r=e.iterator[t.method];if(r===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,R(e,t),"throw"===t.method))return m;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var i=S(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,m;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,m):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,m)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function I(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(a.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=n,t.done=!0,t};return i.next=i}}return{next:F}}function F(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(140)(e))},function(e,t,r){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Metadata=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(1),a=r(142);var o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(0,i.assert)("string"==typeof t,"Metadata: input is not a string"),t=this._repair(t);var r=(new a.SimpleXMLParser).parseFromString(t);this._metadata=Object.create(null),r&&this._parse(r)}return n(e,[{key:"_repair",value:function(e){return e.replace(/>\\376\\377([^<]+)/g,function(e,t){for(var r=t.replace(/\\([0-3])([0-7])([0-7])/g,function(e,t,r,n){return String.fromCharCode(64*t+8*r+1*n)}).replace(/&(amp|apos|gt|lt|quot);/g,function(e,t){switch(t){case"amp":return"&";case"apos":return"'";case"gt":return">";case"lt":return"<";case"quot":return'"'}throw new Error("_repair: "+t+" isn't defined.")}),n="",i=0,a=r.length;i<a;i+=2){var o=256*r.charCodeAt(i)+r.charCodeAt(i+1);n+=o>=32&&o<127&&60!==o&&62!==o&&38!==o?String.fromCharCode(o):"&#x"+(65536+o).toString(16).substring(1)+";"}return">"+n})}},{key:"_parse",value:function(e){var t=e.documentElement;if("rdf:rdf"!==t.nodeName.toLowerCase())for(t=t.firstChild;t&&"rdf:rdf"!==t.nodeName.toLowerCase();)t=t.nextSibling;var r=t?t.nodeName.toLowerCase():null;if(t&&"rdf:rdf"===r&&t.hasChildNodes())for(var n=t.childNodes,i=0,a=n.length;i<a;i++){var o=n[i];if("rdf:description"===o.nodeName.toLowerCase())for(var s=0,u=o.childNodes.length;s<u;s++)if("#text"!==o.childNodes[s].nodeName.toLowerCase()){var l=o.childNodes[s],c=l.nodeName.toLowerCase();this._metadata[c]=l.textContent.trim()}}}},{key:"get",value:function(e){return this._metadata[e]||null}},{key:"getAll",value:function(){return this._metadata}},{key:"has",value:function(e){return void 0!==this._metadata[e]}}]),e}();t.Metadata=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(i)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o={NoError:0,EndOfDocument:-1,UnterminatedCdat:-2,UnterminatedXmlDeclaration:-3,UnterminatedDoctypeDeclaration:-4,UnterminatedComment:-5,MalformedElement:-6,OutOfMemory:-7,UnterminatedAttributeValue:-8,UnterminatedElement:-9,ElementNeverBegun:-10};function s(e,t){var r=e[t];return" "===r||"\n"===r||"\r"===r||"\t"===r}var u=function(){function e(){a(this,e)}return i(e,[{key:"_resolveEntities",value:function(e){return e.replace(/&([^;]+);/g,function(e,t){if("#x"===t.substring(0,2))return String.fromCharCode(parseInt(t.substring(2),16));if("#"===t.substring(0,1))return String.fromCharCode(parseInt(t.substring(1),10));switch(t){case"lt":return"<";case"gt":return">";case"amp":return"&";case"quot":return'"'}return this.onResolveEntity(t)})}},{key:"_parseContent",value:function(e,t){var r,n=t,i=[];function a(){for(;n<e.length&&s(e,n);)++n}for(;n<e.length&&!s(e,n)&&">"!==e[n]&&"/"!==e[n];)++n;for(r=e.substring(t,n),a();n<e.length&&">"!==e[n]&&"/"!==e[n]&&"?"!==e[n];){a();for(var o,u="";n<e.length&&!s(e,n)&&"="!==e[n];)u+=e[n],++n;if(a(),"="!==e[n])return null;++n,a();var l=e[n];if('"'!==l&&"'"!==l)return null;var c=e.indexOf(l,++n);if(c<0)return null;o=e.substring(n,c),i.push({name:u,value:this._resolveEntities(o)}),n=c+1,a()}return{name:r,attributes:i,parsed:n-t}}},{key:"_parseProcessingInstruction",value:function(e,t){var r,n=t;for(;n<e.length&&!s(e,n)&&">"!==e[n]&&"/"!==e[n];)++n;r=e.substring(t,n),function(){for(;n<e.length&&s(e,n);)++n}();for(var i=n;n<e.length&&("?"!==e[n]||">"!==e[n+1]);)++n;return{name:r,value:e.substring(i,n),parsed:n-t}}},{key:"parseXml",value:function(e){for(var t=0;t<e.length;){var r=t;if("<"===e[t]){var n=void 0;switch(e[++r]){case"/":if(++r,(n=e.indexOf(">",r))<0)return void this.onError(o.UnterminatedElement);this.onEndElement(e.substring(r,n)),r=n+1;break;case"?":++r;var i=this._parseProcessingInstruction(e,r);if("?>"!==e.substring(r+i.parsed,r+i.parsed+2))return void this.onError(o.UnterminatedXmlDeclaration);this.onPi(i.name,i.value),r+=i.parsed+2;break;case"!":if("--"===e.substring(r+1,r+3)){if((n=e.indexOf("--\x3e",r+3))<0)return void this.onError(o.UnterminatedComment);this.onComment(e.substring(r+3,n)),r=n+3}else if("[CDATA["===e.substring(r+1,r+8)){if((n=e.indexOf("]]>",r+8))<0)return void this.onError(o.UnterminatedCdat);this.onCdata(e.substring(r+8,n)),r=n+3}else{if("DOCTYPE"!==e.substring(r+1,r+8))return void this.onError(o.MalformedElement);var a=e.indexOf("[",r+8),s=!1;if((n=e.indexOf(">",r+8))<0)return void this.onError(o.UnterminatedDoctypeDeclaration);if(a>0&&n>a){if((n=e.indexOf("]>",r+8))<0)return void this.onError(o.UnterminatedDoctypeDeclaration);s=!0}var u=e.substring(r+8,n+(s?1:0));this.onDoctype(u),r=n+(s?2:1)}break;default:var l=this._parseContent(e,r);if(null===l)return void this.onError(o.MalformedElement);var c=!1;if("/>"===e.substring(r+l.parsed,r+l.parsed+2))c=!0;else if(">"!==e.substring(r+l.parsed,r+l.parsed+1))return void this.onError(o.UnterminatedElement);this.onBeginElement(l.name,l.attributes,c),r+=l.parsed+(c?2:1)}}else{for(;r<e.length&&"<"!==e[r];)r++;var h=e.substring(t,r);this.onText(this._resolveEntities(h))}t=r}}},{key:"onResolveEntity",value:function(e){return"&"+e+";"}},{key:"onPi",value:function(e,t){}},{key:"onComment",value:function(e){}},{key:"onCdata",value:function(e){}},{key:"onDoctype",value:function(e){}},{key:"onText",value:function(e){}},{key:"onBeginElement",value:function(e,t,r){}},{key:"onEndElement",value:function(e){}},{key:"onError",value:function(e){}}]),e}(),l=function(){function e(t,r){a(this,e),this.nodeName=t,this.nodeValue=r,Object.defineProperty(this,"parentNode",{value:null,writable:!0})}return i(e,[{key:"hasChildNodes",value:function(){return this.childNodes&&this.childNodes.length>0}},{key:"firstChild",get:function(){return this.childNodes[0]}},{key:"nextSibling",get:function(){var e=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[e+1]}},{key:"textContent",get:function(){return this.childNodes?this.childNodes.map(function(e){return e.textContent}).join(""):this.nodeValue||""}}]),e}(),c=function(e){function t(){a(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._currentFragment=null,e._stack=null,e._errorCode=o.NoError,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,u),i(t,[{key:"parseFromString",value:function(e){if(this._currentFragment=[],this._stack=[],this._errorCode=o.NoError,this.parseXml(e),this._errorCode===o.NoError){var t=n(this._currentFragment,1)[0];if(t)return{documentElement:t}}}},{key:"onResolveEntity",value:function(e){switch(e){case"apos":return"'"}return function e(t,r,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in i)return i.value;var o=i.get;return void 0!==o?o.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"onResolveEntity",this).call(this,e)}},{key:"onText",value:function(e){if(!function(e){for(var t=0,r=e.length;t<r;t++)if(!s(e,t))return!1;return!0}(e)){var t=new l("#text",e);this._currentFragment.push(t)}}},{key:"onCdata",value:function(e){var t=new l("#text",e);this._currentFragment.push(t)}},{key:"onBeginElement",value:function(e,t,r){var n=new l(e);n.childNodes=[],this._currentFragment.push(n),r||(this._stack.push(this._currentFragment),this._currentFragment=n.childNodes)}},{key:"onEndElement",value:function(e){this._currentFragment=this._stack.pop();for(var t=this._currentFragment[this._currentFragment.length-1],r=0,n=t.childNodes.length;r<n;r++)t.childNodes[r].parentNode=t}},{key:"onError",value:function(e){this._errorCode=e}}]),t}();t.SimpleXMLParser=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFDataTransportStream=void 0;var n,i=r(137),a=(n=i)&&n.__esModule?n:{default:n},o=r(1);function s(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,a){try{var o=t[i](a),s=o.value}catch(e){return void r(e)}if(!o.done)return Promise.resolve(s).then(function(e){n("next",e)},function(e){n("throw",e)});e(s)}("next")})}}var u=function(){function e(e,t){var r=this;(0,o.assert)(t),this._queuedChunks=[];var n=e.initialData;if(n&&n.length>0){var i=new Uint8Array(n).buffer;this._queuedChunks.push(i)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._contentLength=e.length,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener(function(e,t){r._onReceiveData({begin:e,chunk:t})}),this._pdfDataRangeTransport.addProgressListener(function(e){r._onProgress({loaded:e})}),this._pdfDataRangeTransport.addProgressiveReadListener(function(e){r._onReceiveData({chunk:e})}),this._pdfDataRangeTransport.transportReady()}function t(e,t){this._stream=e,this._done=!1,this._filename=null,this._queuedChunks=t||[],this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}function r(e,t,r){this._stream=e,this._begin=t,this._end=r,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}return e.prototype={_onReceiveData:function(e){var t=new Uint8Array(e.chunk).buffer;if(void 0===e.begin)this._fullRequestReader?this._fullRequestReader._enqueue(t):this._queuedChunks.push(t);else{var r=this._rangeReaders.some(function(r){return r._begin===e.begin&&(r._enqueue(t),!0)});(0,o.assert)(r)}},_onProgress:function(e){if(this._rangeReaders.length>0){var t=this._rangeReaders[0];t.onProgress&&t.onProgress({loaded:e.loaded})}},_removeRangeReader:function(e){var t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)},getFullReader:function(){(0,o.assert)(!this._fullRequestReader);var e=this._queuedChunks;return this._queuedChunks=null,new t(this,e)},getRangeReader:function(e,t){var n=new r(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(n),n},cancelAllRequests:function(e){this._fullRequestReader&&this._fullRequestReader.cancel(e),this._rangeReaders.slice(0).forEach(function(t){t.cancel(e)}),this._pdfDataRangeTransport.abort()}},t.prototype={_enqueue:function(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e))},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(){var e=s(a.default.mark(function e(){var t,r;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this._queuedChunks.length>0)){e.next=3;break}return t=this._queuedChunks.shift(),e.abrupt("return",{value:t,done:!1});case 3:if(!this._done){e.next=5;break}return e.abrupt("return",{value:void 0,done:!0});case 5:return r=(0,o.createPromiseCapability)(),this._requests.push(r),e.abrupt("return",r.promise);case 8:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}(),cancel:function(e){this._done=!0,this._requests.forEach(function(e){e.resolve({value:void 0,done:!0})}),this._requests=[]}},r.prototype={_enqueue:function(e){if(!this._done){if(0===this._requests.length)this._queuedChunk=e;else this._requests.shift().resolve({value:e,done:!1}),this._requests.forEach(function(e){e.resolve({value:void 0,done:!0})}),this._requests=[];this._done=!0,this._stream._removeRangeReader(this)}},get isStreamingSupported(){return!1},read:function(){var e=s(a.default.mark(function e(){var t,r;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._queuedChunk){e.next=4;break}return t=this._queuedChunk,this._queuedChunk=null,e.abrupt("return",{value:t,done:!1});case 4:if(!this._done){e.next=6;break}return e.abrupt("return",{value:void 0,done:!0});case 6:return r=(0,o.createPromiseCapability)(),this._requests.push(r),e.abrupt("return",r.promise);case 9:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}(),cancel:function(e){this._done=!0,this._requests.forEach(function(e){e.resolve({value:void 0,done:!0})}),this._requests=[],this._stream._removeRangeReader(this)}},e}();t.PDFDataTransportStream=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebGLContext=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(1);var a=function(){function e(t){var r=t.enable,n=void 0!==r&&r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._enabled=!0===n}return n(e,[{key:"composeSMask",value:function(e){var t=e.layer,r=e.mask,n=e.properties;return o.composeSMask(t,r,n)}},{key:"drawFigures",value:function(e){var t=e.width,r=e.height,n=e.backgroundColor,i=e.figures,a=e.context;return o.drawFigures(t,r,n,i,a)}},{key:"clear",value:function(){o.cleanup()}},{key:"isEnabled",get:function(){var e=this._enabled;return e&&(e=o.tryInitGL()),(0,i.shadow)(this,"isEnabled",e)}}]),e}(),o=function(){function e(e,t,r){var n=e.createShader(r);if(e.shaderSource(n,t),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS)){var i=e.getShaderInfoLog(n);throw new Error("Error during shader compilation: "+i)}return n}function t(t,r){return e(t,r,t.VERTEX_SHADER)}function r(t,r){return e(t,r,t.FRAGMENT_SHADER)}function n(e,t){for(var r=e.createProgram(),n=0,i=t.length;n<i;++n)e.attachShader(r,t[n]);if(e.linkProgram(r),!e.getProgramParameter(r,e.LINK_STATUS)){var a=e.getProgramInfoLog(r);throw new Error("Error during program linking: "+a)}return r}function i(e,t,r){e.activeTexture(r);var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),n}var a,o;function s(){a||(o=document.createElement("canvas"),a=o.getContext("webgl",{premultipliedalpha:!1}))}var u=" attribute vec2 a_position; attribute vec2 a_texCoord; uniform vec2 u_resolution; varying vec2 v_texCoord; void main() { vec2 clipSpace = (a_position / u_resolution) * 2.0 - 1.0; gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); v_texCoord = a_texCoord; } ",l=" precision mediump float; uniform vec4 u_backdrop; uniform int u_subtype; uniform sampler2D u_image; uniform sampler2D u_mask; varying vec2 v_texCoord; void main() { vec4 imageColor = texture2D(u_image, v_texCoord); vec4 maskColor = texture2D(u_mask, v_texCoord); if (u_backdrop.a > 0.0) { maskColor.rgb = maskColor.rgb * maskColor.a + u_backdrop.rgb * (1.0 - maskColor.a); } float lum; if (u_subtype == 0) { lum = maskColor.a; } else { lum = maskColor.r * 0.3 + maskColor.g * 0.59 + maskColor.b * 0.11; } imageColor.a *= lum; imageColor.rgb *= imageColor.a; gl_FragColor = imageColor; } ",c=null;var h=" attribute vec2 a_position; attribute vec3 a_color; uniform vec2 u_resolution; uniform vec2 u_scale; uniform vec2 u_offset; varying vec4 v_color; void main() { vec2 position = (a_position + u_offset) * u_scale; vec2 clipSpace = (position / u_resolution) * 2.0 - 1.0; gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); v_color = vec4(a_color / 255.0, 1.0); } ",d=" precision mediump float; varying vec4 v_color; void main() { gl_FragColor = v_color; } ",f=null;return{tryInitGL:function(){try{return s(),!!a}catch(e){}return!1},composeSMask:function(e,h,d){var f=e.width,p=e.height;c||function(){var e,i;s(),e=o,o=null,i=a,a=null;var h=n(i,[t(i,u),r(i,l)]);i.useProgram(h);var d={};d.gl=i,d.canvas=e,d.resolutionLocation=i.getUniformLocation(h,"u_resolution"),d.positionLocation=i.getAttribLocation(h,"a_position"),d.backdropLocation=i.getUniformLocation(h,"u_backdrop"),d.subtypeLocation=i.getUniformLocation(h,"u_subtype");var f=i.getAttribLocation(h,"a_texCoord"),p=i.getUniformLocation(h,"u_image"),v=i.getUniformLocation(h,"u_mask"),m=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,m),i.bufferData(i.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),i.STATIC_DRAW),i.enableVertexAttribArray(f),i.vertexAttribPointer(f,2,i.FLOAT,!1,0,0),i.uniform1i(p,0),i.uniform1i(v,1),c=d}();var v=c,m=v.canvas,g=v.gl;m.width=f,m.height=p,g.viewport(0,0,g.drawingBufferWidth,g.drawingBufferHeight),g.uniform2f(v.resolutionLocation,f,p),d.backdrop?g.uniform4f(v.resolutionLocation,d.backdrop[0],d.backdrop[1],d.backdrop[2],1):g.uniform4f(v.resolutionLocation,0,0,0,0),g.uniform1i(v.subtypeLocation,"Luminosity"===d.subtype?1:0);var y=i(g,e,g.TEXTURE0),b=i(g,h,g.TEXTURE1),_=g.createBuffer();return g.bindBuffer(g.ARRAY_BUFFER,_),g.bufferData(g.ARRAY_BUFFER,new Float32Array([0,0,f,0,0,p,0,p,f,0,f,p]),g.STATIC_DRAW),g.enableVertexAttribArray(v.positionLocation),g.vertexAttribPointer(v.positionLocation,2,g.FLOAT,!1,0,0),g.clearColor(0,0,0,0),g.enable(g.BLEND),g.blendFunc(g.ONE,g.ONE_MINUS_SRC_ALPHA),g.clear(g.COLOR_BUFFER_BIT),g.drawArrays(g.TRIANGLES,0,6),g.flush(),g.deleteTexture(y),g.deleteTexture(b),g.deleteBuffer(_),m},drawFigures:function(e,i,u,l,c){f||function(){var e,i;s(),e=o,o=null,i=a,a=null;var u=n(i,[t(i,h),r(i,d)]);i.useProgram(u);var l={};l.gl=i,l.canvas=e,l.resolutionLocation=i.getUniformLocation(u,"u_resolution"),l.scaleLocation=i.getUniformLocation(u,"u_scale"),l.offsetLocation=i.getUniformLocation(u,"u_offset"),l.positionLocation=i.getAttribLocation(u,"a_position"),l.colorLocation=i.getAttribLocation(u,"a_color"),f=l}();var p=f,v=p.canvas,m=p.gl;v.width=e,v.height=i,m.viewport(0,0,m.drawingBufferWidth,m.drawingBufferHeight),m.uniform2f(p.resolutionLocation,e,i);var g,y,b,_=0;for(g=0,y=l.length;g<y;g++)switch(l[g].type){case"lattice":_+=((b=l[g].coords.length/l[g].verticesPerRow|0)-1)*(l[g].verticesPerRow-1)*6;break;case"triangles":_+=l[g].coords.length}var A=new Float32Array(2*_),S=new Uint8Array(3*_),w=c.coords,k=c.colors,P=0,x=0;for(g=0,y=l.length;g<y;g++){var C=l[g],R=C.coords,E=C.colors;switch(C.type){case"lattice":var T=C.verticesPerRow;b=R.length/T|0;for(var O=1;O<b;O++)for(var I=O*T+1,F=1;F<T;F++,I++)A[P]=w[R[I-T-1]],A[P+1]=w[R[I-T-1]+1],A[P+2]=w[R[I-T]],A[P+3]=w[R[I-T]+1],A[P+4]=w[R[I-1]],A[P+5]=w[R[I-1]+1],S[x]=k[E[I-T-1]],S[x+1]=k[E[I-T-1]+1],S[x+2]=k[E[I-T-1]+2],S[x+3]=k[E[I-T]],S[x+4]=k[E[I-T]+1],S[x+5]=k[E[I-T]+2],S[x+6]=k[E[I-1]],S[x+7]=k[E[I-1]+1],S[x+8]=k[E[I-1]+2],A[P+6]=A[P+2],A[P+7]=A[P+3],A[P+8]=A[P+4],A[P+9]=A[P+5],A[P+10]=w[R[I]],A[P+11]=w[R[I]+1],S[x+9]=S[x+3],S[x+10]=S[x+4],S[x+11]=S[x+5],S[x+12]=S[x+6],S[x+13]=S[x+7],S[x+14]=S[x+8],S[x+15]=k[E[I]],S[x+16]=k[E[I]+1],S[x+17]=k[E[I]+2],P+=12,x+=18;break;case"triangles":for(var L=0,j=R.length;L<j;L++)A[P]=w[R[L]],A[P+1]=w[R[L]+1],S[x]=k[E[L]],S[x+1]=k[E[L]+1],S[x+2]=k[E[L]+2],P+=2,x+=3}}u?m.clearColor(u[0]/255,u[1]/255,u[2]/255,1):m.clearColor(0,0,0,0),m.clear(m.COLOR_BUFFER_BIT);var M=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,M),m.bufferData(m.ARRAY_BUFFER,A,m.STATIC_DRAW),m.enableVertexAttribArray(p.positionLocation),m.vertexAttribPointer(p.positionLocation,2,m.FLOAT,!1,0,0);var D=m.createBuffer();return m.bindBuffer(m.ARRAY_BUFFER,D),m.bufferData(m.ARRAY_BUFFER,S,m.STATIC_DRAW),m.enableVertexAttribArray(p.colorLocation),m.vertexAttribPointer(p.colorLocation,3,m.UNSIGNED_BYTE,!1,0,0),m.uniform2f(p.scaleLocation,c.scaleX,c.scaleY),m.uniform2f(p.offsetLocation,c.offsetX,c.offsetY),m.drawArrays(m.TRIANGLES,0,_),m.flush(),m.deleteBuffer(M),m.deleteBuffer(D),v},cleanup:function(){c&&c.canvas&&(c.canvas.width=0,c.canvas.height=0),f&&f.canvas&&(f.canvas.width=0,f.canvas.height=0),c=null,f=null}}}();t.WebGLContext=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.renderTextLayer=void 0;var n,i=r(1),a=r(3),o=(n=a)&&n.__esModule?n:{default:n};var s=function(){var e=1e5,t=/\S/;var r=["left: ",0,"px; top: ",0,"px; font-size: ",0,"px; font-family: ","",";"];function n(e,n,a){var o,s=document.createElement("div"),u={style:null,angle:0,canvasWidth:0,isWhitespace:!1,originalTransform:null,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,scale:1};if(e._textDivs.push(s),o=n.str,!t.test(o))return u.isWhitespace=!0,void e._textDivProperties.set(s,u);var l=i.Util.transform(e._viewport.transform,n.transform),c=Math.atan2(l[1],l[0]),h=a[n.fontName];h.vertical&&(c+=Math.PI/2);var d,f,p=Math.sqrt(l[2]*l[2]+l[3]*l[3]),v=p;if(h.ascent?v=h.ascent*v:h.descent&&(v=(1+h.descent)*v),0===c?(d=l[4],f=l[5]-v):(d=l[4]+v*Math.sin(c),f=l[5]-v*Math.cos(c)),r[1]=d,r[3]=f,r[5]=p,r[7]=h.fontFamily,u.style=r.join(""),s.setAttribute("style",u.style),s.textContent=n.str,e._fontInspectorEnabled&&(s.dataset.fontName=n.fontName),0!==c&&(u.angle=c*(180/Math.PI)),n.str.length>1&&(h.vertical?u.canvasWidth=n.height*e._viewport.scale:u.canvasWidth=n.width*e._viewport.scale),e._textDivProperties.set(s,u),e._textContentStream&&e._layoutText(s),e._enhanceTextSelection){var m=1,g=0;0!==c&&(m=Math.cos(c),g=Math.sin(c));var y,b,_=(h.vertical?n.height:n.width)*e._viewport.scale,A=p;0!==c?(y=[m,g,-g,m,d,f],b=i.Util.getAxialAlignedBoundingBox([0,0,_,A],y)):b=[d,f,d+_,f+A],e._bounds.push({left:b[0],top:b[1],right:b[2],bottom:b[3],div:s,size:[_,A],m:y})}}function a(t){if(!t._canceled){var r=t._textDivs,n=t._capability,i=r.length;if(i>e)return t._renderingDone=!0,void n.resolve();if(!t._textContentStream)for(var a=0;a<i;a++)t._layoutText(r[a]);t._renderingDone=!0,n.resolve()}}function s(e){for(var t=e._bounds,r=e._viewport,n=function(e,t,r){var n=r.map(function(e,t){return{x1:e.left,y1:e.top,x2:e.right,y2:e.bottom,index:t,x1New:void 0,x2New:void 0}});u(e,n);var i=new Array(r.length);return n.forEach(function(e){var t=e.index;i[t]={left:e.x1New,top:0,right:e.x2New,bottom:0}}),r.map(function(t,r){var a=i[r],o=n[r];o.x1=t.top,o.y1=e-a.right,o.x2=t.bottom,o.y2=e-a.left,o.index=r,o.x1New=void 0,o.x2New=void 0}),u(t,n),n.forEach(function(e){var t=e.index;i[t].top=e.x1New,i[t].bottom=e.x2New}),i}(r.width,r.height,t),a=0;a<n.length;a++){var o=t[a].div,s=e._textDivProperties.get(o);if(0!==s.angle){var l=n[a],c=t[a],h=c.m,d=h[0],f=h[1],p=[[0,0],[0,c.size[1]],[c.size[0],0],c.size],v=new Float64Array(64);p.forEach(function(e,t){var r=i.Util.applyTransform(e,h);v[t+0]=d&&(l.left-r[0])/d,v[t+4]=f&&(l.top-r[1])/f,v[t+8]=d&&(l.right-r[0])/d,v[t+12]=f&&(l.bottom-r[1])/f,v[t+16]=f&&(l.left-r[0])/-f,v[t+20]=d&&(l.top-r[1])/d,v[t+24]=f&&(l.right-r[0])/-f,v[t+28]=d&&(l.bottom-r[1])/d,v[t+32]=d&&(l.left-r[0])/-d,v[t+36]=f&&(l.top-r[1])/-f,v[t+40]=d&&(l.right-r[0])/-d,v[t+44]=f&&(l.bottom-r[1])/-f,v[t+48]=f&&(l.left-r[0])/f,v[t+52]=d&&(l.top-r[1])/-d,v[t+56]=f&&(l.right-r[0])/f,v[t+60]=d&&(l.bottom-r[1])/-d});var m=function(e,t,r){for(var n=0,i=0;i<r;i++){var a=e[t++];a>0&&(n=n?Math.min(a,n):a)}return n},g=1+Math.min(Math.abs(d),Math.abs(f));s.paddingLeft=m(v,32,16)/g,s.paddingTop=m(v,48,16)/g,s.paddingRight=m(v,0,16)/g,s.paddingBottom=m(v,16,16)/g,e._textDivProperties.set(o,s)}else s.paddingLeft=t[a].left-n[a].left,s.paddingTop=t[a].top-n[a].top,s.paddingRight=n[a].right-t[a].right,s.paddingBottom=n[a].bottom-t[a].bottom,e._textDivProperties.set(o,s)}}function u(e,t){t.sort(function(e,t){return e.x1-t.x1||e.index-t.index});var r=[{start:-1/0,end:1/0,boundary:{x1:-1/0,y1:-1/0,x2:0,y2:1/0,index:-1,x1New:0,x2New:0}}];t.forEach(function(e){for(var t=0;t<r.length&&r[t].end<=e.y1;)t++;for(var n,i,a=r.length-1;a>=0&&r[a].start>=e.y2;)a--;var o,s,u=-1/0;for(o=t;o<=a;o++){var l;(l=(i=(n=r[o]).boundary).x2>e.x1?i.index>e.index?i.x1New:e.x1:void 0===i.x2New?(i.x2+e.x1)/2:i.x2New)>u&&(u=l)}for(e.x1New=u,o=t;o<=a;o++)void 0===(i=(n=r[o]).boundary).x2New?i.x2>e.x1?i.index>e.index&&(i.x2New=i.x2):i.x2New=u:i.x2New>u&&(i.x2New=Math.max(u,i.x2));var c=[],h=null;for(o=t;o<=a;o++){var d=(i=(n=r[o]).boundary).x2>e.x2?i:e;h===d?c[c.length-1].end=n.end:(c.push({start:n.start,end:n.end,boundary:d}),h=d)}for(r[t].start<e.y1&&(c[0].start=e.y1,c.unshift({start:r[t].start,end:e.y1,boundary:r[t].boundary})),e.y2<r[a].end&&(c[c.length-1].end=e.y2,c.push({start:e.y2,end:r[a].end,boundary:r[a].boundary})),o=t;o<=a;o++)if(void 0===(i=(n=r[o]).boundary).x2New){var f=!1;for(s=t-1;!f&&s>=0&&r[s].start>=i.y1;s--)f=r[s].boundary===i;for(s=a+1;!f&&s<r.length&&r[s].end<=i.y2;s++)f=r[s].boundary===i;for(s=0;!f&&s<c.length;s++)f=c[s].boundary===i;f||(i.x2New=u)}Array.prototype.splice.apply(r,[t,a-t+1].concat(c))}),r.forEach(function(t){var r=t.boundary;void 0===r.x2New&&(r.x2New=Math.max(e,r.x2))})}function l(e){var t=e.textContent,r=e.textContentStream,n=e.container,a=e.viewport,s=e.textDivs,u=e.textContentItemsStr,l=e.enhanceTextSelection;this._textContent=t,this._textContentStream=r,this._container=n,this._viewport=a,this._textDivs=s||[],this._textContentItemsStr=u||[],this._enhanceTextSelection=!!l,this._fontInspectorEnabled=!(!o.default.FontInspector||!o.default.FontInspector.enabled),this._reader=null,this._layoutTextLastFontSize=null,this._layoutTextLastFontFamily=null,this._layoutTextCtx=null,this._textDivProperties=new WeakMap,this._renderingDone=!1,this._canceled=!1,this._capability=(0,i.createPromiseCapability)(),this._renderTimer=null,this._bounds=[]}return l.prototype={get promise(){return this._capability.promise},cancel:function(){this._reader&&(this._reader.cancel(new i.AbortException("text layer task cancelled")),this._reader=null),this._canceled=!0,null!==this._renderTimer&&(clearTimeout(this._renderTimer),this._renderTimer=null),this._capability.reject("canceled")},_processItems:function(e,t){for(var r=0,i=e.length;r<i;r++)this._textContentItemsStr.push(e[r].str),n(this,e[r],t)},_layoutText:function(e){var t=this._container,r=this._textDivProperties.get(e);if(!r.isWhitespace){var n=e.style.fontSize,i=e.style.fontFamily;n===this._layoutTextLastFontSize&&i===this._layoutTextLastFontFamily||(this._layoutTextCtx.font=n+" "+i,this._layoutTextLastFontSize=n,this._layoutTextLastFontFamily=i);var a=this._layoutTextCtx.measureText(e.textContent).width,o="";0!==r.canvasWidth&&a>0&&(r.scale=r.canvasWidth/a,o="scaleX("+r.scale+")"),0!==r.angle&&(o="rotate("+r.angle+"deg) "+o),""!==o&&(r.originalTransform=o,e.style.transform=o),this._textDivProperties.set(e,r),t.appendChild(e)}},_render:function(e){var t=this,r=(0,i.createPromiseCapability)(),n=Object.create(null),o=document.createElement("canvas");if(o.mozOpaque=!0,this._layoutTextCtx=o.getContext("2d",{alpha:!1}),this._textContent){var s=this._textContent.items,u=this._textContent.styles;this._processItems(s,u),r.resolve()}else{if(!this._textContentStream)throw new Error('Neither "textContent" nor "textContentStream" parameters specified.');this._reader=this._textContentStream.getReader(),function e(){t._reader.read().then(function(i){var a=i.value;i.done?r.resolve():(Object.assign(n,a.styles),t._processItems(a.items,n),e())},r.reject)}()}r.promise.then(function(){n=null,e?t._renderTimer=setTimeout(function(){a(t),t._renderTimer=null},e):a(t)},this._capability.reject)},expandTextDivs:function(e){if(this._enhanceTextSelection&&this._renderingDone){null!==this._bounds&&(s(this),this._bounds=null);for(var t=0,r=this._textDivs.length;t<r;t++){var n=this._textDivs[t],i=this._textDivProperties.get(n);if(!i.isWhitespace)if(e){var a="",o="";1!==i.scale&&(a="scaleX("+i.scale+")"),0!==i.angle&&(a="rotate("+i.angle+"deg) "+a),0!==i.paddingLeft&&(o+=" padding-left: "+i.paddingLeft/i.scale+"px;",a+=" translateX("+-i.paddingLeft/i.scale+"px)"),0!==i.paddingTop&&(o+=" padding-top: "+i.paddingTop+"px;",a+=" translateY("+-i.paddingTop+"px)"),0!==i.paddingRight&&(o+=" padding-right: "+i.paddingRight/i.scale+"px;"),0!==i.paddingBottom&&(o+=" padding-bottom: "+i.paddingBottom+"px;"),""!==o&&n.setAttribute("style",i.style+o),""!==a&&(n.style.transform=a)}else n.style.padding=0,n.style.transform=i.originalTransform||""}}}},function(e){var t=new l({textContent:e.textContent,textContentStream:e.textContentStream,container:e.container,viewport:e.viewport,textDivs:e.textDivs,textContentItemsStr:e.textContentItemsStr,enhanceTextSelection:e.enhanceTextSelection});return t._render(e.timeout),t}}();t.renderTextLayer=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationLayer=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(130),a=r(1);function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var l=function(){function e(){u(this,e)}return n(e,null,[{key:"create",value:function(e){switch(e.data.annotationType){case a.AnnotationType.LINK:return new h(e);case a.AnnotationType.TEXT:return new d(e);case a.AnnotationType.WIDGET:switch(e.data.fieldType){case"Tx":return new p(e);case"Btn":return e.data.radioButton?new m(e):e.data.checkBox?new v(e):new g(e);case"Ch":return new y(e)}return new f(e);case a.AnnotationType.POPUP:return new b(e);case a.AnnotationType.LINE:return new A(e);case a.AnnotationType.SQUARE:return new S(e);case a.AnnotationType.CIRCLE:return new w(e);case a.AnnotationType.POLYLINE:return new k(e);case a.AnnotationType.INK:return new x(e);case a.AnnotationType.POLYGON:return new P(e);case a.AnnotationType.HIGHLIGHT:return new C(e);case a.AnnotationType.UNDERLINE:return new R(e);case a.AnnotationType.SQUIGGLY:return new E(e);case a.AnnotationType.STRIKEOUT:return new T(e);case a.AnnotationType.STAMP:return new O(e);case a.AnnotationType.FILEATTACHMENT:return new I(e);default:return new c(e)}}}]),e}(),c=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];u(this,e),this.isRenderable=r,this.data=t.data,this.layer=t.layer,this.page=t.page,this.viewport=t.viewport,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderInteractiveForms=t.renderInteractiveForms,this.svgFactory=t.svgFactory,r&&(this.container=this._createContainer(n))}return n(e,[{key:"_createContainer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.data,r=this.page,n=this.viewport,i=document.createElement("section"),o=t.rect[2]-t.rect[0],s=t.rect[3]-t.rect[1];i.setAttribute("data-annotation-id",t.id);var u=a.Util.normalizeRect([t.rect[0],r.view[3]-t.rect[1]+r.view[1],t.rect[2],r.view[3]-t.rect[3]+r.view[1]]);if(i.style.transform="matrix("+n.transform.join(",")+")",i.style.transformOrigin=-u[0]+"px "+-u[1]+"px",!e&&t.borderStyle.width>0){i.style.borderWidth=t.borderStyle.width+"px",t.borderStyle.style!==a.AnnotationBorderStyleType.UNDERLINE&&(o-=2*t.borderStyle.width,s-=2*t.borderStyle.width);var l=t.borderStyle.horizontalCornerRadius,c=t.borderStyle.verticalCornerRadius;if(l>0||c>0){var h=l+"px / "+c+"px";i.style.borderRadius=h}switch(t.borderStyle.style){case a.AnnotationBorderStyleType.SOLID:i.style.borderStyle="solid";break;case a.AnnotationBorderStyleType.DASHED:i.style.borderStyle="dashed";break;case a.AnnotationBorderStyleType.BEVELED:(0,a.warn)("Unimplemented border style: beveled");break;case a.AnnotationBorderStyleType.INSET:(0,a.warn)("Unimplemented border style: inset");break;case a.AnnotationBorderStyleType.UNDERLINE:i.style.borderBottomStyle="solid"}t.color?i.style.borderColor=a.Util.makeCssRgb(0|t.color[0],0|t.color[1],0|t.color[2]):i.style.borderWidth=0}return i.style.left=u[0]+"px",i.style.top=u[1]+"px",i.style.width=o+"px",i.style.height=s+"px",i}},{key:"_createPopup",value:function(e,t,r){t||((t=document.createElement("div")).style.height=e.style.height,t.style.width=e.style.width,e.appendChild(t));var n=new _({container:e,trigger:t,color:r.color,title:r.title,contents:r.contents,hideWrapper:!0}).render();n.style.left=e.style.width,e.appendChild(n)}},{key:"render",value:function(){(0,a.unreachable)("Abstract method `AnnotationElement.render` called")}}]),e}(),h=function(e){function t(e){u(this,t);var r=!!(e.data.url||e.data.dest||e.data.action);return o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r))}return s(t,c),n(t,[{key:"render",value:function(){this.container.className="linkAnnotation";var e=this.data,t=this.linkService,r=document.createElement("a");return(0,i.addLinkAttributes)(r,{url:e.url,target:e.newWindow?i.LinkTarget.BLANK:t.externalLinkTarget,rel:t.externalLinkRel}),e.url||(e.action?this._bindNamedAction(r,e.action):this._bindLink(r,e.dest)),this.container.appendChild(r),this.container}},{key:"_bindLink",value:function(e,t){var r=this;e.href=this.linkService.getDestinationHash(t),e.onclick=function(){return t&&r.linkService.navigateTo(t),!1},t&&(e.className="internalLink")}},{key:"_bindNamedAction",value:function(e,t){var r=this;e.href=this.linkService.getAnchorUrl(""),e.onclick=function(){return r.linkService.executeNamedAction(t),!1},e.className="internalLink"}}]),t}(),d=function(e){function t(e){u(this,t);var r=!!(e.data.hasPopup||e.data.title||e.data.contents);return o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r))}return s(t,c),n(t,[{key:"render",value:function(){this.container.className="textAnnotation";var e=document.createElement("img");return e.style.height=this.container.style.height,e.style.width=this.container.style.width,e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.alt="[{{type}} Annotation]",e.dataset.l10nId="text_annotation_type",e.dataset.l10nArgs=JSON.stringify({type:this.data.name}),this.data.hasPopup||this._createPopup(this.container,e,this.data),this.container.appendChild(e),this.container}}]),t}(),f=function(e){function t(){return u(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,c),n(t,[{key:"render",value:function(){return this.container}}]),t}(),p=function(e){function t(e){u(this,t);var r=e.renderInteractiveForms||!e.data.hasAppearance&&!!e.data.fieldValue;return o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r))}return s(t,f),n(t,[{key:"render",value:function(){this.container.className="textWidgetAnnotation";var e=null;if(this.renderInteractiveForms){if(this.data.multiLine?(e=document.createElement("textarea")).textContent=this.data.fieldValue:((e=document.createElement("input")).type="text",e.setAttribute("value",this.data.fieldValue)),e.disabled=this.data.readOnly,null!==this.data.maxLen&&(e.maxLength=this.data.maxLen),this.data.comb){var t=(this.data.rect[2]-this.data.rect[0])/this.data.maxLen;e.classList.add("comb"),e.style.letterSpacing="calc("+t+"px - 1ch)"}}else{(e=document.createElement("div")).textContent=this.data.fieldValue,e.style.verticalAlign="middle",e.style.display="table-cell";var r=null;this.data.fontRefName&&(r=this.page.commonObjs.getData(this.data.fontRefName)),this._setTextStyle(e,r)}return null!==this.data.textAlignment&&(e.style.textAlign=["left","center","right"][this.data.textAlignment]),this.container.appendChild(e),this.container}},{key:"_setTextStyle",value:function(e,t){var r=e.style;if(r.fontSize=this.data.fontSize+"px",r.direction=this.data.fontDirection<0?"rtl":"ltr",t){r.fontWeight=t.black?t.bold?"900":"bold":t.bold?"bold":"normal",r.fontStyle=t.italic?"italic":"normal";var n=t.loadedName?'"'+t.loadedName+'", ':"",i=t.fallbackName||"Helvetica, sans-serif";r.fontFamily=n+i}}}]),t}(),v=function(e){function t(e){return u(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,e.renderInteractiveForms))}return s(t,f),n(t,[{key:"render",value:function(){this.container.className="buttonWidgetAnnotation checkBox";var e=document.createElement("input");return e.disabled=this.data.readOnly,e.type="checkbox",this.data.fieldValue&&"Off"!==this.data.fieldValue&&e.setAttribute("checked",!0),this.container.appendChild(e),this.container}}]),t}(),m=function(e){function t(e){return u(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,e.renderInteractiveForms))}return s(t,f),n(t,[{key:"render",value:function(){this.container.className="buttonWidgetAnnotation radioButton";var e=document.createElement("input");return e.disabled=this.data.readOnly,e.type="radio",e.name=this.data.fieldName,this.data.fieldValue===this.data.buttonValue&&e.setAttribute("checked",!0),this.container.appendChild(e),this.container}}]),t}(),g=function(e){function t(){return u(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,h),n(t,[{key:"render",value:function(){var e=function e(t,r,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in i)return i.value;var o=i.get;return void 0!==o?o.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"render",this).call(this);return e.className="buttonWidgetAnnotation pushButton",e}}]),t}(),y=function(e){function t(e){return u(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,e.renderInteractiveForms))}return s(t,f),n(t,[{key:"render",value:function(){this.container.className="choiceWidgetAnnotation";var e=document.createElement("select");e.disabled=this.data.readOnly,this.data.combo||(e.size=this.data.options.length,this.data.multiSelect&&(e.multiple=!0));for(var t=0,r=this.data.options.length;t<r;t++){var n=this.data.options[t],i=document.createElement("option");i.textContent=n.displayValue,i.value=n.exportValue,this.data.fieldValue.includes(n.displayValue)&&i.setAttribute("selected",!0),e.appendChild(i)}return this.container.appendChild(e),this.container}}]),t}(),b=function(e){function t(e){u(this,t);var r=!(!e.data.title&&!e.data.contents);return o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r))}return s(t,c),n(t,[{key:"render",value:function(){if(this.container.className="popupAnnotation",["Line","Square","Circle","PolyLine","Polygon","Ink"].includes(this.data.parentType))return this.container;var e='[data-annotation-id="'+this.data.parentId+'"]',t=this.layer.querySelector(e);if(!t)return this.container;var r=new _({container:this.container,trigger:t,color:this.data.color,title:this.data.title,contents:this.data.contents}),n=parseFloat(t.style.left),i=parseFloat(t.style.width);return this.container.style.transformOrigin=-(n+i)+"px -"+t.style.top,this.container.style.left=n+i+"px",this.container.appendChild(r.render()),this.container}}]),t}(),_=function(){function e(t){u(this,e),this.container=t.container,this.trigger=t.trigger,this.color=t.color,this.title=t.title,this.contents=t.contents,this.hideWrapper=t.hideWrapper||!1,this.pinned=!1}return n(e,[{key:"render",value:function(){var e=document.createElement("div");e.className="popupWrapper",this.hideElement=this.hideWrapper?e:this.container,this.hideElement.setAttribute("hidden",!0);var t=document.createElement("div");t.className="popup";var r=this.color;if(r){var n=.7*(255-r[0])+r[0],i=.7*(255-r[1])+r[1],o=.7*(255-r[2])+r[2];t.style.backgroundColor=a.Util.makeCssRgb(0|n,0|i,0|o)}var s=this._formatContents(this.contents),u=document.createElement("h1");return u.textContent=this.title,this.trigger.addEventListener("click",this._toggle.bind(this)),this.trigger.addEventListener("mouseover",this._show.bind(this,!1)),this.trigger.addEventListener("mouseout",this._hide.bind(this,!1)),t.addEventListener("click",this._hide.bind(this,!0)),t.appendChild(u),t.appendChild(s),e.appendChild(t),e}},{key:"_formatContents",value:function(e){for(var t=document.createElement("p"),r=e.split(/(?:\r\n?|\n)/),n=0,i=r.length;n<i;++n){var a=r[n];t.appendChild(document.createTextNode(a)),n<i-1&&t.appendChild(document.createElement("br"))}return t}},{key:"_toggle",value:function(){this.pinned?this._hide(!0):this._show(!0)}},{key:"_show",value:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this.pinned=!0),this.hideElement.hasAttribute("hidden")&&(this.hideElement.removeAttribute("hidden"),this.container.style.zIndex+=1)}},{key:"_hide",value:function(){(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&(this.pinned=!1),this.hideElement.hasAttribute("hidden")||this.pinned||(this.hideElement.setAttribute("hidden",!0),this.container.style.zIndex-=1)}}]),e}(),A=function(e){function t(e){u(this,t);var r=!!(e.data.hasPopup||e.data.title||e.data.contents);return o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r,!0))}return s(t,c),n(t,[{key:"render",value:function(){this.container.className="lineAnnotation";var e=this.data,t=e.rect[2]-e.rect[0],r=e.rect[3]-e.rect[1],n=this.svgFactory.create(t,r),i=this.svgFactory.createElement("svg:line");return i.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),i.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),i.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),i.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),i.setAttribute("stroke-width",e.borderStyle.width),i.setAttribute("stroke","transparent"),n.appendChild(i),this.container.append(n),this._createPopup(this.container,i,e),this.container}}]),t}(),S=function(e){function t(e){u(this,t);var r=!!(e.data.hasPopup||e.data.title||e.data.contents);return o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r,!0))}return s(t,c),n(t,[{key:"render",value:function(){this.container.className="squareAnnotation";var e=this.data,t=e.rect[2]-e.rect[0],r=e.rect[3]-e.rect[1],n=this.svgFactory.create(t,r),i=e.borderStyle.width,a=this.svgFactory.createElement("svg:rect");return a.setAttribute("x",i/2),a.setAttribute("y",i/2),a.setAttribute("width",t-i),a.setAttribute("height",r-i),a.setAttribute("stroke-width",i),a.setAttribute("stroke","transparent"),a.setAttribute("fill","none"),n.appendChild(a),this.container.append(n),this._createPopup(this.container,a,e),this.container}}]),t}(),w=function(e){function t(e){u(this,t);var r=!!(e.data.hasPopup||e.data.title||e.data.contents);return o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r,!0))}return s(t,c),n(t,[{key:"render",value:function(){this.container.className="circleAnnotation";var e=this.data,t=e.rect[2]-e.rect[0],r=e.rect[3]-e.rect[1],n=this.svgFactory.create(t,r),i=e.borderStyle.width,a=this.svgFactory.createElement("svg:ellipse");return a.setAttribute("cx",t/2),a.setAttribute("cy",r/2),a.setAttribute("rx",t/2-i/2),a.setAttribute("ry",r/2-i/2),a.setAttribute("stroke-width",i),a.setAttribute("stroke","transparent"),a.setAttribute("fill","none"),n.appendChild(a),this.container.append(n),this._createPopup(this.container,a,e),this.container}}]),t}(),k=function(e){function t(e){u(this,t);var r=!!(e.data.hasPopup||e.data.title||e.data.contents),n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r,!0));return n.containerClassName="polylineAnnotation",n.svgElementName="svg:polyline",n}return s(t,c),n(t,[{key:"render",value:function(){this.container.className=this.containerClassName;for(var e=this.data,t=e.rect[2]-e.rect[0],r=e.rect[3]-e.rect[1],n=this.svgFactory.create(t,r),i=e.vertices,a=[],o=0,s=i.length;o<s;o++){var u=i[o].x-e.rect[0],l=e.rect[3]-i[o].y;a.push(u+","+l)}a=a.join(" ");var c=e.borderStyle.width,h=this.svgFactory.createElement(this.svgElementName);return h.setAttribute("points",a),h.setAttribute("stroke-width",c),h.setAttribute("stroke","transparent"),h.setAttribute("fill","none"),n.appendChild(h),this.container.append(n),this._createPopup(this.container,h,e),this.container}}]),t}(),P=function(e){function t(e){u(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.containerClassName="polygonAnnotation",r.svgElementName="svg:polygon",r}return s(t,k),t}(),x=function(e){function t(e){u(this,t);var r=!!(e.data.hasPopup||e.data.title||e.data.contents),n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r,!0));return n.containerClassName="inkAnnotation",n.svgElementName="svg:polyline",n}return s(t,c),n(t,[{key:"render",value:function(){this.container.className=this.containerClassName;for(var e=this.data,t=e.rect[2]-e.rect[0],r=e.rect[3]-e.rect[1],n=this.svgFactory.create(t,r),i=e.inkLists,a=0,o=i.length;a<o;a++){for(var s=i[a],u=[],l=0,c=s.length;l<c;l++){var h=s[l].x-e.rect[0],d=e.rect[3]-s[l].y;u.push(h+","+d)}u=u.join(" ");var f=e.borderStyle.width,p=this.svgFactory.createElement(this.svgElementName);p.setAttribute("points",u),p.setAttribute("stroke-width",f),p.setAttribute("stroke","transparent"),p.setAttribute("fill","none"),this._createPopup(this.container,p,e),n.appendChild(p)}return this.container.append(n),this.container}}]),t}(),C=function(e){function t(e){u(this,t);var r=!!(e.data.hasPopup||e.data.title||e.data.contents);return o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r,!0))}return s(t,c),n(t,[{key:"render",value:function(){return this.container.className="highlightAnnotation",this.data.hasPopup||this._createPopup(this.container,null,this.data),this.container}}]),t}(),R=function(e){function t(e){u(this,t);var r=!!(e.data.hasPopup||e.data.title||e.data.contents);return o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r,!0))}return s(t,c),n(t,[{key:"render",value:function(){return this.container.className="underlineAnnotation",this.data.hasPopup||this._createPopup(this.container,null,this.data),this.container}}]),t}(),E=function(e){function t(e){u(this,t);var r=!!(e.data.hasPopup||e.data.title||e.data.contents);return o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r,!0))}return s(t,c),n(t,[{key:"render",value:function(){return this.container.className="squigglyAnnotation",this.data.hasPopup||this._createPopup(this.container,null,this.data),this.container}}]),t}(),T=function(e){function t(e){u(this,t);var r=!!(e.data.hasPopup||e.data.title||e.data.contents);return o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r,!0))}return s(t,c),n(t,[{key:"render",value:function(){return this.container.className="strikeoutAnnotation",this.data.hasPopup||this._createPopup(this.container,null,this.data),this.container}}]),t}(),O=function(e){function t(e){u(this,t);var r=!!(e.data.hasPopup||e.data.title||e.data.contents);return o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r,!0))}return s(t,c),n(t,[{key:"render",value:function(){return this.container.className="stampAnnotation",this.data.hasPopup||this._createPopup(this.container,null,this.data),this.container}}]),t}(),I=function(e){function t(e){u(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,!0)),n=r.data.file,s=n.filename,l=n.content;return r.filename=(0,i.getFilenameFromUrl)(s),r.content=l,r.linkService.eventBus&&r.linkService.eventBus.dispatch("fileattachmentannotation",{source:r,id:(0,a.stringToPDFString)(s),filename:s,content:l}),r}return s(t,c),n(t,[{key:"render",value:function(){this.container.className="fileAttachmentAnnotation";var e=document.createElement("div");return e.style.height=this.container.style.height,e.style.width=this.container.style.width,e.addEventListener("dblclick",this._download.bind(this)),this.data.hasPopup||!this.data.title&&!this.data.contents||this._createPopup(this.container,e,this.data),this.container.appendChild(e),this.container}},{key:"_download",value:function(){this.downloadManager?this.downloadManager.downloadData(this.content,this.filename,""):(0,a.warn)("Download cannot be started due to unavailable download manager")}}]),t}(),F=function(){function e(){u(this,e)}return n(e,null,[{key:"render",value:function(e){for(var t=0,r=e.annotations.length;t<r;t++){var n=e.annotations[t];if(n){var a=l.create({data:n,layer:e.div,page:e.page,viewport:e.viewport,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderInteractiveForms:e.renderInteractiveForms||!1,svgFactory:new i.DOMSVGFactory});a.isRenderable&&e.div.appendChild(a.render())}}}},{key:"update",value:function(e){for(var t=0,r=e.annotations.length;t<r;t++){var n=e.annotations[t],i=e.div.querySelector('[data-annotation-id="'+n.id+'"]');i&&(i.style.transform="matrix("+e.viewport.transform.join(",")+")")}e.div.removeAttribute("hidden")}}]),e}();t.AnnotationLayer=F},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SVGGraphics=void 0;var n,i=r(1),a=r(130),o=r(4),s=(n=o)&&n.__esModule?n:{default:n};var u,l={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},c=function(){for(var e=new Uint8Array([137,80,78,71,13,10,26,10]),t=12,r=new Int32Array(256),n=0;n<256;n++){for(var a=n,o=0;o<8;o++)a=1&a?3988292384^a>>1&2147483647:a>>1&2147483647;r[n]=a}function u(e,t,n,i){var a=i,o=t.length;n[a]=o>>24&255,n[a+1]=o>>16&255,n[a+2]=o>>8&255,n[a+3]=255&o,n[a+=4]=255&e.charCodeAt(0),n[a+1]=255&e.charCodeAt(1),n[a+2]=255&e.charCodeAt(2),n[a+3]=255&e.charCodeAt(3),a+=4,n.set(t,a);var s=function(e,t,n){for(var i=-1,a=t;a<n;a++){var o=255&(i^e[a]);i=i>>>8^r[o]}return-1^i}(n,i+4,a+=t.length);n[a]=s>>24&255,n[a+1]=s>>16&255,n[a+2]=s>>8&255,n[a+3]=255&s}function l(e){var t=e.length,r=Math.ceil(t/65535),n=new Uint8Array(2+t+5*r+4),i=0;n[i++]=120,n[i++]=156;for(var a=0;t>65535;)n[i++]=0,n[i++]=255,n[i++]=255,n[i++]=0,n[i++]=0,n.set(e.subarray(a,a+65535),i),i+=65535,a+=65535,t-=65535;n[i++]=1,n[i++]=255&t,n[i++]=t>>8&255,n[i++]=255&~t,n[i++]=(65535&~t)>>8&255,n.set(e.subarray(a),i),i+=e.length-a;var o=function(e,t,r){for(var n=1,i=0,a=t;a<r;++a)i=(i+(n=(n+(255&e[a]))%65521))%65521;return i<<16|n}(e,0,e.length);return n[i++]=o>>24&255,n[i++]=o>>16&255,n[i++]=o>>8&255,n[i++]=255&o,n}function c(r,n,a,o){var c,h,d,f=r.width,p=r.height,v=r.data;switch(n){case i.ImageKind.GRAYSCALE_1BPP:h=0,c=1,d=f+7>>3;break;case i.ImageKind.RGB_24BPP:h=2,c=8,d=3*f;break;case i.ImageKind.RGBA_32BPP:h=6,c=8,d=4*f;break;default:throw new Error("invalid format")}var m,g,y=new Uint8Array((1+d)*p),b=0,_=0;for(m=0;m<p;++m)y[b++]=0,y.set(v.subarray(_,_+d),b),_+=d,b+=d;if(n===i.ImageKind.GRAYSCALE_1BPP&&o)for(b=0,m=0;m<p;m++)for(b++,g=0;g<d;g++)y[b++]^=255;var A=new Uint8Array([f>>24&255,f>>16&255,f>>8&255,255&f,p>>24&255,p>>16&255,p>>8&255,255&p,c,h,0,0,0]),S=function(e){if(!(0,s.default)())return l(e);try{var t;t=parseInt(process.versions.node)>=8?e:new Buffer(e);var r=require("zlib").deflateSync(t,{level:9});return r instanceof Uint8Array?r:new Uint8Array(r)}catch(e){(0,i.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+e)}return l(e)}(y),w=e.length+3*t+A.length+S.length,k=new Uint8Array(w),P=0;return k.set(e,P),u("IHDR",A,k,P+=e.length),u("IDATA",S,k,P+=t+A.length),P+=t+S.length,u("IEND",new Uint8Array(0),k,P),(0,i.createObjectURL)(k,"image/png",a)}return function(e,t,r){return c(e,void 0===e.kind?i.ImageKind.GRAYSCALE_1BPP:e.kind,t,r)}}(),h=function(){function e(){this.fontSizeScale=1,this.fontWeight=l.fontWeight,this.fontSize=0,this.textMatrix=i.IDENTITY_MATRIX,this.fontMatrix=i.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=i.TextRenderingMode.FILL,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=l.fillColor,this.strokeColor="#000000",this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin="",this.lineCap="",this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.activeClipUrl=null,this.clipGroup=null,this.maskId=""}return e.prototype={clone:function(){return Object.create(this)},setCurrentPoint:function(e,t){this.x=e,this.y=t}},e}();t.SVGGraphics=u=function(){function e(e){if(Number.isInteger(e))return e.toString();var t=e.toFixed(10),r=t.length-1;if("0"!==t[r])return t;do{r--}while("0"===t[r]);return t.substring(0,"."===t[r]?r:r+1)}function t(t){if(0===t[4]&&0===t[5]){if(0===t[1]&&0===t[2])return 1===t[0]&&1===t[3]?"":"scale("+e(t[0])+" "+e(t[3])+")";if(t[0]===t[3]&&t[1]===-t[2])return"rotate("+e(180*Math.acos(t[0])/Math.PI)+")"}else if(1===t[0]&&0===t[1]&&0===t[2]&&1===t[3])return"translate("+e(t[4])+" "+e(t[5])+")";return"matrix("+e(t[0])+" "+e(t[1])+" "+e(t[2])+" "+e(t[3])+" "+e(t[4])+" "+e(t[5])+")"}function r(e,t,r){this.svgFactory=new a.DOMSVGFactory,this.current=new h,this.transformMatrix=i.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=e,this.objs=t,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!r}var n="http://www.w3.org/1999/xlink",o=["butt","round","square"],s=["miter","round","bevel"],u=0,d=0;return r.prototype={save:function(){this.transformStack.push(this.transformMatrix);var e=this.current;this.extraStack.push(e),this.current=e.clone()},restore:function(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null},group:function(e){this.save(),this.executeOpTree(e),this.restore()},loadDependencies:function(e){for(var t=this,r=e.fnArray,n=r.length,a=e.argsArray,o=0;o<n;o++)if(i.OPS.dependency===r[o])for(var s=a[o],u=0,l=s.length;u<l;u++){var c,h=s[u];c="g_"===h.substring(0,2)?new Promise(function(e){t.commonObjs.get(h,e)}):new Promise(function(e){t.objs.get(h,e)}),this.current.dependencies.push(c)}return Promise.all(this.current.dependencies)},transform:function(e,t,r,n,a,o){var s=[e,t,r,n,a,o];this.transformMatrix=i.Util.transform(this.transformMatrix,s),this.tgrp=null},getSVG:function(e,t){var r=this;this.viewport=t;var n=this._initialize(t);return this.loadDependencies(e).then(function(){r.transformMatrix=i.IDENTITY_MATRIX;var t=r.convertOpList(e);return r.executeOpTree(t),n})},convertOpList:function(e){var t=e.argsArray,r=e.fnArray,n=r.length,a=[],o=[];for(var s in i.OPS)a[i.OPS[s]]=s;for(var u=0;u<n;u++){var l=r[u];o.push({fnId:l,fn:a[l],args:t[u]})}return function(e){for(var t=[],r=[],n=e.length,i=0;i<n;i++)"save"!==e[i].fn?"restore"===e[i].fn?t=r.pop():t.push(e[i]):(t.push({fnId:92,fn:"group",items:[]}),r.push(t),t=t[t.length-1].items);return t}(o)},executeOpTree:function(e){for(var t=e.length,r=0;r<t;r++){var n=e[r].fn,a=e[r].fnId,o=e[r].args;switch(0|a){case i.OPS.beginText:this.beginText();break;case i.OPS.dependency:break;case i.OPS.setLeading:this.setLeading(o);break;case i.OPS.setLeadingMoveText:this.setLeadingMoveText(o[0],o[1]);break;case i.OPS.setFont:this.setFont(o);break;case i.OPS.showText:case i.OPS.showSpacedText:this.showText(o[0]);break;case i.OPS.endText:this.endText();break;case i.OPS.moveText:this.moveText(o[0],o[1]);break;case i.OPS.setCharSpacing:this.setCharSpacing(o[0]);break;case i.OPS.setWordSpacing:this.setWordSpacing(o[0]);break;case i.OPS.setHScale:this.setHScale(o[0]);break;case i.OPS.setTextMatrix:this.setTextMatrix(o[0],o[1],o[2],o[3],o[4],o[5]);break;case i.OPS.setTextRise:this.setTextRise(o[0]);break;case i.OPS.setTextRenderingMode:this.setTextRenderingMode(o[0]);break;case i.OPS.setLineWidth:this.setLineWidth(o[0]);break;case i.OPS.setLineJoin:this.setLineJoin(o[0]);break;case i.OPS.setLineCap:this.setLineCap(o[0]);break;case i.OPS.setMiterLimit:this.setMiterLimit(o[0]);break;case i.OPS.setFillRGBColor:this.setFillRGBColor(o[0],o[1],o[2]);break;case i.OPS.setStrokeRGBColor:this.setStrokeRGBColor(o[0],o[1],o[2]);break;case i.OPS.setDash:this.setDash(o[0],o[1]);break;case i.OPS.setGState:this.setGState(o[0]);break;case i.OPS.fill:this.fill();break;case i.OPS.eoFill:this.eoFill();break;case i.OPS.stroke:this.stroke();break;case i.OPS.fillStroke:this.fillStroke();break;case i.OPS.eoFillStroke:this.eoFillStroke();break;case i.OPS.clip:this.clip("nonzero");break;case i.OPS.eoClip:this.clip("evenodd");break;case i.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case i.OPS.paintJpegXObject:this.paintJpegXObject(o[0],o[1],o[2]);break;case i.OPS.paintImageXObject:this.paintImageXObject(o[0]);break;case i.OPS.paintInlineImageXObject:this.paintInlineImageXObject(o[0]);break;case i.OPS.paintImageMaskXObject:this.paintImageMaskXObject(o[0]);break;case i.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(o[0],o[1]);break;case i.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case i.OPS.closePath:this.closePath();break;case i.OPS.closeStroke:this.closeStroke();break;case i.OPS.closeFillStroke:this.closeFillStroke();break;case i.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case i.OPS.nextLine:this.nextLine();break;case i.OPS.transform:this.transform(o[0],o[1],o[2],o[3],o[4],o[5]);break;case i.OPS.constructPath:this.constructPath(o[0],o[1]);break;case i.OPS.endPath:this.endPath();break;case 92:this.group(e[r].items);break;default:(0,i.warn)("Unimplemented operator "+n)}}},setWordSpacing:function(e){this.current.wordSpacing=e},setCharSpacing:function(e){this.current.charSpacing=e},nextLine:function(){this.moveText(0,this.current.leading)},setTextMatrix:function(t,r,n,i,a,o){var s=this.current;this.current.textMatrix=this.current.lineMatrix=[t,r,n,i,a,o],this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,s.xcoords=[],s.tspan=this.svgFactory.createElement("svg:tspan"),s.tspan.setAttributeNS(null,"font-family",s.fontFamily),s.tspan.setAttributeNS(null,"font-size",e(s.fontSize)+"px"),s.tspan.setAttributeNS(null,"y",e(-s.y)),s.txtElement=this.svgFactory.createElement("svg:text"),s.txtElement.appendChild(s.tspan)},beginText:function(){this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,this.current.textMatrix=i.IDENTITY_MATRIX,this.current.lineMatrix=i.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(t,r){var n=this.current;this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=r,n.xcoords=[],n.tspan=this.svgFactory.createElement("svg:tspan"),n.tspan.setAttributeNS(null,"font-family",n.fontFamily),n.tspan.setAttributeNS(null,"font-size",e(n.fontSize)+"px"),n.tspan.setAttributeNS(null,"y",e(-n.y))},showText:function(r){var n=this.current,a=n.font,o=n.fontSize;if(0!==o){var s,u=n.charSpacing,c=n.wordSpacing,h=n.fontDirection,d=n.textHScale*h,f=r.length,p=a.vertical,v=o*n.fontMatrix[0],m=0;for(s=0;s<f;++s){var g=r[s];if(null!==g)if((0,i.isNum)(g))m+=-g*o*.001;else{var y=g.width,b=g.fontChar,_=y*v+((g.isSpace?c:0)+u)*h;g.isInFont||a.missingFile?(n.xcoords.push(n.x+m*d),n.tspan.textContent+=b,m+=_):m+=_}else m+=h*c}p?n.y-=m*d:n.x+=m*d,n.tspan.setAttributeNS(null,"x",n.xcoords.map(e).join(" ")),n.tspan.setAttributeNS(null,"y",e(-n.y)),n.tspan.setAttributeNS(null,"font-family",n.fontFamily),n.tspan.setAttributeNS(null,"font-size",e(n.fontSize)+"px"),n.fontStyle!==l.fontStyle&&n.tspan.setAttributeNS(null,"font-style",n.fontStyle),n.fontWeight!==l.fontWeight&&n.tspan.setAttributeNS(null,"font-weight",n.fontWeight);var A=n.textRenderingMode&i.TextRenderingMode.FILL_STROKE_MASK;A===i.TextRenderingMode.FILL||A===i.TextRenderingMode.FILL_STROKE?(n.fillColor!==l.fillColor&&n.tspan.setAttributeNS(null,"fill",n.fillColor),n.fillAlpha<1&&n.tspan.setAttributeNS(null,"fill-opacity",n.fillAlpha)):n.textRenderingMode===i.TextRenderingMode.ADD_TO_PATH?n.tspan.setAttributeNS(null,"fill","transparent"):n.tspan.setAttributeNS(null,"fill","none"),A!==i.TextRenderingMode.STROKE&&A!==i.TextRenderingMode.FILL_STROKE||this._setStrokeAttributes(n.tspan);var S=n.textMatrix;0!==n.textRise&&((S=S.slice())[5]+=n.textRise),n.txtElement.setAttributeNS(null,"transform",t(S)+" scale(1, -1)"),n.txtElement.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),n.txtElement.appendChild(n.tspan),n.txtgrp.appendChild(n.txtElement),this._ensureTransformGroup().appendChild(n.txtElement)}},setLeadingMoveText:function(e,t){this.setLeading(-t),this.moveText(e,t)},addFontStyle:function(e){this.cssStyle||(this.cssStyle=this.svgFactory.createElement("svg:style"),this.cssStyle.setAttributeNS(null,"type","text/css"),this.defs.appendChild(this.cssStyle));var t=(0,i.createObjectURL)(e.data,e.mimetype,this.forceDataSchema);this.cssStyle.textContent+='@font-face { font-family: "'+e.loadedName+'"; src: url('+t+"); }\n"},setFont:function(t){var r=this.current,n=this.commonObjs.get(t[0]),a=t[1];this.current.font=n,this.embedFonts&&n.data&&!this.embeddedFonts[n.loadedName]&&(this.addFontStyle(n),this.embeddedFonts[n.loadedName]=n),r.fontMatrix=n.fontMatrix?n.fontMatrix:i.FONT_IDENTITY_MATRIX;var o=n.black?n.bold?"bolder":"bold":n.bold?"bold":"normal",s=n.italic?"italic":"normal";a<0?(a=-a,r.fontDirection=-1):r.fontDirection=1,r.fontSize=a,r.fontFamily=n.loadedName,r.fontWeight=o,r.fontStyle=s,r.tspan=this.svgFactory.createElement("svg:tspan"),r.tspan.setAttributeNS(null,"y",e(-r.y)),r.xcoords=[]},endText:function(){var e=this.current;e.textRenderingMode&i.TextRenderingMode.ADD_TO_PATH_FLAG&&e.txtElement&&e.txtElement.hasChildNodes()&&(e.element=e.txtElement,this.clip("nonzero"),this.endPath())},setLineWidth:function(e){this.current.lineWidth=e},setLineCap:function(e){this.current.lineCap=o[e]},setLineJoin:function(e){this.current.lineJoin=s[e]},setMiterLimit:function(e){this.current.miterLimit=e},setStrokeAlpha:function(e){this.current.strokeAlpha=e},setStrokeRGBColor:function(e,t,r){var n=i.Util.makeCssRgb(e,t,r);this.current.strokeColor=n},setFillAlpha:function(e){this.current.fillAlpha=e},setFillRGBColor:function(e,t,r){var n=i.Util.makeCssRgb(e,t,r);this.current.fillColor=n,this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[]},setDash:function(e,t){this.current.dashArray=e,this.current.dashPhase=t},constructPath:function(t,r){var n=this.current,a=n.x,o=n.y;n.path=this.svgFactory.createElement("svg:path");for(var s=[],u=t.length,l=0,c=0;l<u;l++)switch(0|t[l]){case i.OPS.rectangle:a=r[c++],o=r[c++];var h=a+r[c++],d=o+r[c++];s.push("M",e(a),e(o),"L",e(h),e(o),"L",e(h),e(d),"L",e(a),e(d),"Z");break;case i.OPS.moveTo:a=r[c++],o=r[c++],s.push("M",e(a),e(o));break;case i.OPS.lineTo:a=r[c++],o=r[c++],s.push("L",e(a),e(o));break;case i.OPS.curveTo:a=r[c+4],o=r[c+5],s.push("C",e(r[c]),e(r[c+1]),e(r[c+2]),e(r[c+3]),e(a),e(o)),c+=6;break;case i.OPS.curveTo2:a=r[c+2],o=r[c+3],s.push("C",e(a),e(o),e(r[c]),e(r[c+1]),e(r[c+2]),e(r[c+3])),c+=4;break;case i.OPS.curveTo3:a=r[c+2],o=r[c+3],s.push("C",e(r[c]),e(r[c+1]),e(a),e(o),e(a),e(o)),c+=4;break;case i.OPS.closePath:s.push("Z")}n.path.setAttributeNS(null,"d",s.join(" ")),n.path.setAttributeNS(null,"fill","none"),this._ensureTransformGroup().appendChild(n.path),n.element=n.path,n.setCurrentPoint(a,o)},endPath:function(){if(this.pendingClip){var e=this.current,r="clippath"+u;u++;var n=this.svgFactory.createElement("svg:clipPath");n.setAttributeNS(null,"id",r),n.setAttributeNS(null,"transform",t(this.transformMatrix));var i=e.element.cloneNode(!0);"evenodd"===this.pendingClip?i.setAttributeNS(null,"clip-rule","evenodd"):i.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,n.appendChild(i),this.defs.appendChild(n),e.activeClipUrl&&(e.clipGroup=null,this.extraStack.forEach(function(e){e.clipGroup=null}),n.setAttributeNS(null,"clip-path",e.activeClipUrl)),e.activeClipUrl="url(#"+r+")",this.tgrp=null}},clip:function(e){this.pendingClip=e},closePath:function(){var e=this.current;if(e.path){var t=e.path.getAttributeNS(null,"d");t+="Z",e.path.setAttributeNS(null,"d",t)}},setLeading:function(e){this.current.leading=-e},setTextRise:function(e){this.current.textRise=e},setTextRenderingMode:function(e){this.current.textRenderingMode=e},setHScale:function(e){this.current.textHScale=e/100},setGState:function(e){for(var t=0,r=e.length;t<r;t++){var n=e[t],a=n[0],o=n[1];switch(a){case"LW":this.setLineWidth(o);break;case"LC":this.setLineCap(o);break;case"LJ":this.setLineJoin(o);break;case"ML":this.setMiterLimit(o);break;case"D":this.setDash(o[0],o[1]);break;case"Font":this.setFont(o);break;case"CA":this.setStrokeAlpha(o);break;case"ca":this.setFillAlpha(o);break;default:(0,i.warn)("Unimplemented graphic state "+a)}}},fill:function(){var e=this.current;e.element&&(e.element.setAttributeNS(null,"fill",e.fillColor),e.element.setAttributeNS(null,"fill-opacity",e.fillAlpha),this.endPath())},stroke:function(){var e=this.current;e.element&&(this._setStrokeAttributes(e.element),e.element.setAttributeNS(null,"fill","none"),this.endPath())},_setStrokeAttributes:function(t){var r=this.current;t.setAttributeNS(null,"stroke",r.strokeColor),t.setAttributeNS(null,"stroke-opacity",r.strokeAlpha),t.setAttributeNS(null,"stroke-miterlimit",e(r.miterLimit)),t.setAttributeNS(null,"stroke-linecap",r.lineCap),t.setAttributeNS(null,"stroke-linejoin",r.lineJoin),t.setAttributeNS(null,"stroke-width",e(r.lineWidth)+"px"),t.setAttributeNS(null,"stroke-dasharray",r.dashArray.map(e).join(" ")),t.setAttributeNS(null,"stroke-dashoffset",e(r.dashPhase)+"px")},eoFill:function(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fill()},fillStroke:function(){this.stroke(),this.fill()},eoFillStroke:function(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()},closeStroke:function(){this.closePath(),this.stroke()},closeFillStroke:function(){this.closePath(),this.fillStroke()},closeEOFillStroke:function(){this.closePath(),this.eoFillStroke()},paintSolidColorImageMask:function(){var e=this.current,t=this.svgFactory.createElement("svg:rect");t.setAttributeNS(null,"x","0"),t.setAttributeNS(null,"y","0"),t.setAttributeNS(null,"width","1px"),t.setAttributeNS(null,"height","1px"),t.setAttributeNS(null,"fill",e.fillColor),this._ensureTransformGroup().appendChild(t)},paintJpegXObject:function(t,r,i){var a=this.objs.get(t),o=this.svgFactory.createElement("svg:image");o.setAttributeNS(n,"xlink:href",a.src),o.setAttributeNS(null,"width",e(r)),o.setAttributeNS(null,"height",e(i)),o.setAttributeNS(null,"x","0"),o.setAttributeNS(null,"y",e(-i)),o.setAttributeNS(null,"transform","scale("+e(1/r)+" "+e(-1/i)+")"),this._ensureTransformGroup().appendChild(o)},paintImageXObject:function(e){var t=this.objs.get(e);t?this.paintInlineImageXObject(t):(0,i.warn)("Dependent image isn't ready yet")},paintInlineImageXObject:function(t,r){var i=t.width,a=t.height,o=c(t,this.forceDataSchema,!!r),s=this.svgFactory.createElement("svg:rect");s.setAttributeNS(null,"x","0"),s.setAttributeNS(null,"y","0"),s.setAttributeNS(null,"width",e(i)),s.setAttributeNS(null,"height",e(a)),this.current.element=s,this.clip("nonzero");var u=this.svgFactory.createElement("svg:image");u.setAttributeNS(n,"xlink:href",o),u.setAttributeNS(null,"x","0"),u.setAttributeNS(null,"y",e(-a)),u.setAttributeNS(null,"width",e(i)+"px"),u.setAttributeNS(null,"height",e(a)+"px"),u.setAttributeNS(null,"transform","scale("+e(1/i)+" "+e(-1/a)+")"),r?r.appendChild(u):this._ensureTransformGroup().appendChild(u)},paintImageMaskXObject:function(t){var r=this.current,n=t.width,i=t.height,a=r.fillColor;r.maskId="mask"+d++;var o=this.svgFactory.createElement("svg:mask");o.setAttributeNS(null,"id",r.maskId);var s=this.svgFactory.createElement("svg:rect");s.setAttributeNS(null,"x","0"),s.setAttributeNS(null,"y","0"),s.setAttributeNS(null,"width",e(n)),s.setAttributeNS(null,"height",e(i)),s.setAttributeNS(null,"fill",a),s.setAttributeNS(null,"mask","url(#"+r.maskId+")"),this.defs.appendChild(o),this._ensureTransformGroup().appendChild(s),this.paintInlineImageXObject(t,o)},paintFormXObjectBegin:function(t,r){if(Array.isArray(t)&&6===t.length&&this.transform(t[0],t[1],t[2],t[3],t[4],t[5]),Array.isArray(r)&&4===r.length){var n=r[2]-r[0],i=r[3]-r[1],a=this.svgFactory.createElement("svg:rect");a.setAttributeNS(null,"x",r[0]),a.setAttributeNS(null,"y",r[1]),a.setAttributeNS(null,"width",e(n)),a.setAttributeNS(null,"height",e(i)),this.current.element=a,this.clip("nonzero"),this.endPath()}},paintFormXObjectEnd:function(){},_initialize:function(e){var r=this.svgFactory.create(e.width,e.height),n=this.svgFactory.createElement("svg:defs");r.appendChild(n),this.defs=n;var i=this.svgFactory.createElement("svg:g");return i.setAttributeNS(null,"transform",t(e.transform)),r.appendChild(i),this.svg=i,r},_ensureClipGroup:function(){if(!this.current.clipGroup){var e=this.svgFactory.createElement("svg:g");e.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.appendChild(e),this.current.clipGroup=e}return this.current.clipGroup},_ensureTransformGroup:function(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",t(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().appendChild(this.tgrp):this.svg.appendChild(this.tgrp)),this.tgrp}},r}(),t.SVGGraphics=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNodeStream=void 0;var n,i=r(137),a=(n=i)&&n.__esModule?n:{default:n},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(1),u=r(149);function l(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function h(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,a){try{var o=t[i](a),s=o.value}catch(e){return void r(e)}if(!o.done)return Promise.resolve(s).then(function(e){n("next",e)},function(e){n("throw",e)});e(s)}("next")})}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var f=require("fs"),p=require("http"),v=require("https"),m=require("url"),g=/^file:\/\/\/[a-zA-Z]:\//;var y=function(){function e(t){var r,n;d(this,e),this.source=t,this.url=(r=t.url,"file:"===(n=m.parse(r)).protocol||n.host?n:/^[a-z]:[/\\]/i.test(r)?m.parse("file:///"+r):(n.host||(n.protocol="file:"),n)),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequest=null,this._rangeRequestReaders=[]}return o(e,[{key:"getFullReader",value:function(){return(0,s.assert)(!this._fullRequest),this._fullRequest=this.isFsUrl?new k(this):new S(this),this._fullRequest}},{key:"getRangeReader",value:function(e,t){var r=this.isFsUrl?new P(this,e,t):new w(this,e,t);return this._rangeRequestReaders.push(r),r}},{key:"cancelAllRequests",value:function(e){this._fullRequest&&this._fullRequest.cancel(e),this._rangeRequestReaders.slice(0).forEach(function(t){t.cancel(e)})}}]),e}(),b=function(){function e(t){d(this,e),this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;var r=t.source;this._contentLength=r.length,this._loaded=0,this._filename=null,this._disableRange=r.disableRange||!1,this._rangeChunkSize=r.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!r.disableStream,this._isRangeSupported=!r.disableRange,this._readableStream=null,this._readCapability=(0,s.createPromiseCapability)(),this._headersCapability=(0,s.createPromiseCapability)()}return o(e,[{key:"read",value:function(){var e=h(a.default.mark(function e(){var t,r;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._readCapability.promise;case 2:if(!this._done){e.next=4;break}return e.abrupt("return",{value:void 0,done:!0});case 4:if(!this._storedError){e.next=6;break}throw this._storedError;case 6:if(null!==(t=this._readableStream.read())){e.next=10;break}return this._readCapability=(0,s.createPromiseCapability)(),e.abrupt("return",this.read());case 10:return this._loaded+=t.length,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),r=new Uint8Array(t).buffer,e.abrupt("return",{value:r,done:!1});case 14:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}},{key:"_error",value:function(e){this._storedError=e,this._readCapability.resolve()}},{key:"_setReadableStream",value:function(e){var t=this;this._readableStream=e,e.on("readable",function(){t._readCapability.resolve()}),e.on("end",function(){e.destroy(),t._done=!0,t._readCapability.resolve()}),e.on("error",function(e){t._error(e)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new s.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}},{key:"headersReady",get:function(){return this._headersCapability.promise}},{key:"filename",get:function(){return this._filename}},{key:"contentLength",get:function(){return this._contentLength}},{key:"isRangeSupported",get:function(){return this._isRangeSupported}},{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}}]),e}(),_=function(){function e(t){d(this,e),this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=(0,s.createPromiseCapability)();var r=t.source;this._isStreamingSupported=!r.disableStream}return o(e,[{key:"read",value:function(){var e=h(a.default.mark(function e(){var t,r;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._readCapability.promise;case 2:if(!this._done){e.next=4;break}return e.abrupt("return",{value:void 0,done:!0});case 4:if(!this._storedError){e.next=6;break}throw this._storedError;case 6:if(null!==(t=this._readableStream.read())){e.next=10;break}return this._readCapability=(0,s.createPromiseCapability)(),e.abrupt("return",this.read());case 10:return this._loaded+=t.length,this.onProgress&&this.onProgress({loaded:this._loaded}),r=new Uint8Array(t).buffer,e.abrupt("return",{value:r,done:!1});case 14:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}},{key:"_error",value:function(e){this._storedError=e,this._readCapability.resolve()}},{key:"_setReadableStream",value:function(e){var t=this;this._readableStream=e,e.on("readable",function(){t._readCapability.resolve()}),e.on("end",function(){e.destroy(),t._done=!0,t._readCapability.resolve()}),e.on("error",function(e){t._error(e)}),this._storedError&&this._readableStream.destroy(this._storedError)}},{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}}]),e}();function A(e,t){return{protocol:e.protocol,auth:e.auth,host:e.hostname,port:e.port,path:e.path,method:"GET",headers:t}}var S=function(e){function t(e){d(this,t);var r=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),n=function(t){if(404===t.statusCode){var n=new s.MissingPDFException('Missing PDF "'+r._url+'".');return r._storedError=n,void r._headersCapability.reject(n)}r._headersCapability.resolve(),r._setReadableStream(t);var i=function(e){return r._readableStream.headers[e.toLowerCase()]},a=(0,u.validateRangeRequestCapabilities)({getResponseHeader:i,isHttp:e.isHttp,rangeChunkSize:r._rangeChunkSize,disableRange:r._disableRange}),o=a.allowRangeRequests,l=a.suggestedLength;r._isRangeSupported=o,r._contentLength=l||r._contentLength,r._filename=(0,u.extractFilenameFromHeader)(i)};return r._request=null,"http:"===r._url.protocol?r._request=p.request(A(r._url,e.httpHeaders),n):r._request=v.request(A(r._url,e.httpHeaders),n),r._request.on("error",function(e){r._storedError=e,r._headersCapability.reject(e)}),r._request.end(),r}return c(t,b),t}(),w=function(e){function t(e,r,n){d(this,t);var i=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));for(var a in i._httpHeaders={},e.httpHeaders){var o=e.httpHeaders[a];void 0!==o&&(i._httpHeaders[a]=o)}i._httpHeaders.Range="bytes="+r+"-"+(n-1);var u=function(e){if(404!==e.statusCode)i._setReadableStream(e);else{var t=new s.MissingPDFException('Missing PDF "'+i._url+'".');i._storedError=t}};return i._request=null,"http:"===i._url.protocol?i._request=p.request(A(i._url,i._httpHeaders),u):i._request=v.request(A(i._url,i._httpHeaders),u),i._request.on("error",function(e){i._storedError=e}),i._request.end(),i}return c(t,_),t}(),k=function(e){function t(e){d(this,t);var r=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),n=decodeURIComponent(r._url.path);return g.test(r._url.href)&&(n=n.replace(/^\//,"")),f.lstat(n,function(e,t){if(e)return"ENOENT"===e.code&&(e=new s.MissingPDFException('Missing PDF "'+n+'".')),r._storedError=e,void r._headersCapability.reject(e);r._contentLength=t.size,r._setReadableStream(f.createReadStream(n)),r._headersCapability.resolve()}),r}return c(t,b),t}(),P=function(e){function t(e,r,n){d(this,t);var i=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),a=decodeURIComponent(i._url.path);return g.test(i._url.href)&&(a=a.replace(/^\//,"")),i._setReadableStream(f.createReadStream(a,{start:r,end:n-1})),i}return c(t,_),t}();t.PDFNodeStream=y},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateResponseStatus=t.validateRangeRequestCapabilities=t.extractFilenameFromHeader=t.createResponseStatusError=void 0;var n=r(1),i=r(150);t.createResponseStatusError=function(e,t){return 404===e||0===e&&/^file:/.test(t)?new n.MissingPDFException('Missing PDF "'+t+'".'):new n.UnexpectedResponseException("Unexpected server response ("+e+') while retrieving PDF "'+t+'".',e)},t.extractFilenameFromHeader=function(e){var t=e("Content-Disposition");if(t){var r=(0,i.getFilenameFromContentDispositionHeader)(t);if(/\.pdf$/i.test(r))return r}return null},t.validateRangeRequestCapabilities=function(e){var t=e.getResponseHeader,r=e.isHttp,i=e.rangeChunkSize,a=e.disableRange;(0,n.assert)(i>0,"Range chunk size must be larger than zero");var o={allowRangeRequests:!1,suggestedLength:void 0},s=parseInt(t("Content-Length"),10);return Number.isInteger(s)?(o.suggestedLength=s,s<=2*i?o:a||!r?o:"bytes"!==t("Accept-Ranges")?o:"identity"!==(t("Content-Encoding")||"identity")?o:(o.allowRangeRequests=!0,o)):o},t.validateResponseStatus=function(e){return 200===e||206===e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(i)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.getFilenameFromContentDispositionHeader=function(e){var t=!0,r=o("filename\\*","i").exec(e);if(r){var i=l(r=r[1]);return u(i=h(i=c(i=unescape(i))))}if(r=function(e){for(var t=[],r=void 0,i=o("filename\\*((?!0\\d)\\d+)(\\*?)","ig");null!==(r=i.exec(e));){var a=r,s=n(a,4),u=s[1],h=s[2],d=s[3];if((u=parseInt(u,10))in t){if(0===u)break}else t[u]=[h,d]}for(var f=[],p=0;p<t.length&&p in t;++p){var v=n(t[p],2),m=v[0],g=v[1];g=l(g),m&&(g=unescape(g),0===p&&(g=c(g))),f.push(g)}return f.join("")}(e))return u(h(r));if(r=o("filename","i").exec(e)){var a=l(r=r[1]);return u(a=h(a))}function o(e,t){return new RegExp("(?:^|;)\\s*"+e+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',t)}function s(e,r){if(e){if(!/^[\x00-\xFF]+$/.test(r))return r;try{for(var n=new TextDecoder(e,{fatal:!0}),i=new Array(r.length),a=0;a<r.length;++a)i[a]=r.charCodeAt(a);r=n.decode(new Uint8Array(i)),t=!1}catch(n){if(/^utf-?8$/i.test(e))try{r=decodeURIComponent(escape(r)),t=!1}catch(e){}}}return r}function u(e){return t&&/[\x80-\xff]/.test(e)&&(e=s("utf-8",e),t&&(e=s("iso-8859-1",e))),e}function l(e){if('"'===e.charAt(0)){for(var t=e.slice(1).split('\\"'),r=0;r<t.length;++r){var n=t[r].indexOf('"');-1!==n&&(t[r]=t[r].slice(0,n),t.length=r+1),t[r]=t[r].replace(/\\(.)/g,"$1")}e=t.join('"')}return e}function c(e){var t=e.indexOf("'");return-1===t?e:s(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,""))}function h(e){return"=?"!==e.slice(0,2)||/[\x00-\x19\x80-\xff]/.test(e)?e:e.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(e,t,r,n){if("q"===r||"Q"===r)return s(t,n=(n=n.replace(/_/g," ")).replace(/=([0-9a-fA-F]{2})/g,function(e,t){return String.fromCharCode(parseInt(t,16))}));try{n=atob(n)}catch(e){}return s(t,n)})}return""}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFetchStream=void 0;var n,i=r(137),a=(n=i)&&n.__esModule?n:{default:n},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(1),u=r(149);function l(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,a){try{var o=t[i](a),s=o.value}catch(e){return void r(e)}if(!o.done)return Promise.resolve(s).then(function(e){n("next",e)},function(e){n("throw",e)});e(s)}("next")})}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t,r){return{method:"GET",headers:e,signal:r&&r.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}var d=function(){function e(t){c(this,e),this.source=t,this.isHttp=/^https?:/i.test(t.url),this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}return o(e,[{key:"getFullReader",value:function(){return(0,s.assert)(!this._fullRequestReader),this._fullRequestReader=new f(this),this._fullRequestReader}},{key:"getRangeReader",value:function(e,t){var r=new p(this,e,t);return this._rangeRequestReaders.push(r),r}},{key:"cancelAllRequests",value:function(e){this._fullRequestReader&&this._fullRequestReader.cancel(e),this._rangeRequestReaders.slice(0).forEach(function(t){t.cancel(e)})}}]),e}(),f=function(){function e(t){var r=this;c(this,e),this._stream=t,this._reader=null,this._loaded=0,this._filename=null;var n=t.source;for(var i in this._withCredentials=n.withCredentials,this._contentLength=n.length,this._headersCapability=(0,s.createPromiseCapability)(),this._disableRange=n.disableRange||!1,this._rangeChunkSize=n.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),"undefined"!=typeof AbortController&&(this._abortController=new AbortController),this._isStreamingSupported=!n.disableStream,this._isRangeSupported=!n.disableRange,this._headers=new Headers,this._stream.httpHeaders){var a=this._stream.httpHeaders[i];void 0!==a&&this._headers.append(i,a)}var o=n.url;fetch(o,h(this._headers,this._withCredentials,this._abortController)).then(function(e){if(!(0,u.validateResponseStatus)(e.status))throw(0,u.createResponseStatusError)(e.status,o);r._reader=e.body.getReader(),r._headersCapability.resolve();var t=function(t){return e.headers.get(t)},n=(0,u.validateRangeRequestCapabilities)({getResponseHeader:t,isHttp:r._stream.isHttp,rangeChunkSize:r._rangeChunkSize,disableRange:r._disableRange}),i=n.allowRangeRequests,a=n.suggestedLength;r._isRangeSupported=i,r._contentLength=a||r._contentLength,r._filename=(0,u.extractFilenameFromHeader)(t),!r._isStreamingSupported&&r._isRangeSupported&&r.cancel(new s.AbortException("streaming is disabled"))}).catch(this._headersCapability.reject),this.onProgress=null}return o(e,[{key:"read",value:function(){var e=l(a.default.mark(function e(){var t,r,n,i;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._headersCapability.promise;case 2:return e.next=4,this._reader.read();case 4:if(t=e.sent,r=t.value,!(n=t.done)){e.next=9;break}return e.abrupt("return",{value:r,done:n});case 9:return this._loaded+=r.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),i=new Uint8Array(r).buffer,e.abrupt("return",{value:i,done:!1});case 13:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){this._reader&&this._reader.cancel(e),this._abortController&&this._abortController.abort()}},{key:"headersReady",get:function(){return this._headersCapability.promise}},{key:"filename",get:function(){return this._filename}},{key:"contentLength",get:function(){return this._contentLength}},{key:"isRangeSupported",get:function(){return this._isRangeSupported}},{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}}]),e}(),p=function(){function e(t,r,n){var i=this;c(this,e),this._stream=t,this._reader=null,this._loaded=0;var a=t.source;for(var o in this._withCredentials=a.withCredentials,this._readCapability=(0,s.createPromiseCapability)(),this._isStreamingSupported=!a.disableStream,"undefined"!=typeof AbortController&&(this._abortController=new AbortController),this._headers=new Headers,this._stream.httpHeaders){var l=this._stream.httpHeaders[o];void 0!==l&&this._headers.append(o,l)}var d=r+"-"+(n-1);this._headers.append("Range","bytes="+d);var f=a.url;fetch(f,h(this._headers,this._withCredentials,this._abortController)).then(function(e){if(!(0,u.validateResponseStatus)(e.status))throw(0,u.createResponseStatusError)(e.status,f);i._readCapability.resolve(),i._reader=e.body.getReader()}),this.onProgress=null}return o(e,[{key:"read",value:function(){var e=l(a.default.mark(function e(){var t,r,n,i;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._readCapability.promise;case 2:return e.next=4,this._reader.read();case 4:if(t=e.sent,r=t.value,!(n=t.done)){e.next=9;break}return e.abrupt("return",{value:r,done:n});case 9:return this._loaded+=r.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded}),i=new Uint8Array(r).buffer,e.abrupt("return",{value:i,done:!1});case 13:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){this._reader&&this._reader.cancel(e),this._abortController&&this._abortController.abort()}},{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}}]),e}();t.PDFFetchStream=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkManager=t.PDFNetworkStream=void 0;var n=s(r(137)),i=r(1),a=r(149),o=s(r(3));function s(e){return e&&e.__esModule?e:{default:e}}function u(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,a){try{var o=t[i](a),s=o.value}catch(e){return void r(e)}if(!o.done)return Promise.resolve(s).then(function(e){n("next",e)},function(e){n("throw",e)});e(s)}("next")})}}function l(e,t){this.url=e,t=t||{},this.isHttp=/^https?:/i.test(e),this.httpHeaders=this.isHttp&&t.httpHeaders||{},this.withCredentials=t.withCredentials||!1,this.getXhr=t.getXhr||function(){return new XMLHttpRequest},this.currXhrId=0,this.pendingRequests=Object.create(null),this.loadedRequests=Object.create(null)}function c(e){var t=e.response;return"string"!=typeof t?t:(0,i.stringToBytes)(t).buffer}var h=function(){try{var e=new XMLHttpRequest;return e.open("GET",o.default.location.href),e.responseType="moz-chunked-arraybuffer","moz-chunked-arraybuffer"===e.responseType}catch(e){return!1}}();function d(e){this._source=e,this._manager=new l(e.url,{httpHeaders:e.httpHeaders,withCredentials:e.withCredentials}),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}function f(e,t){this._manager=e;var r={onHeadersReceived:this._onHeadersReceived.bind(this),onProgressiveData:t.disableStream?null:this._onProgressiveData.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._fullRequestId=e.requestFull(r),this._headersReceivedCapability=(0,i.createPromiseCapability)(),this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}function p(e,t,r){this._manager=e;var n={onDone:this._onDone.bind(this),onProgress:this._onProgress.bind(this)};this._requestId=e.requestRange(t,r,n),this._requests=[],this._queuedChunk=null,this._done=!1,this.onProgress=null,this.onClosed=null}l.prototype={requestRange:function(e,t,r){var n={begin:e,end:t};for(var i in r)n[i]=r[i];return this.request(n)},requestFull:function(e){return this.request(e)},request:function(e){var t=this.getXhr(),r=this.currXhrId++,n=this.pendingRequests[r]={xhr:t};for(var i in t.open("GET",this.url),t.withCredentials=this.withCredentials,this.httpHeaders){var a=this.httpHeaders[i];void 0!==a&&t.setRequestHeader(i,a)}if(this.isHttp&&"begin"in e&&"end"in e){var o=e.begin+"-"+(e.end-1);t.setRequestHeader("Range","bytes="+o),n.expectedStatus=206}else n.expectedStatus=200;return h&&!!e.onProgressiveData?(t.responseType="moz-chunked-arraybuffer",n.onProgressiveData=e.onProgressiveData,n.mozChunked=!0):t.responseType="arraybuffer",e.onError&&(t.onerror=function(r){e.onError(t.status)}),t.onreadystatechange=this.onStateChange.bind(this,r),t.onprogress=this.onProgress.bind(this,r),n.onHeadersReceived=e.onHeadersReceived,n.onDone=e.onDone,n.onError=e.onError,n.onProgress=e.onProgress,t.send(null),r},onProgress:function(e,t){var r=this.pendingRequests[e];if(r){if(r.mozChunked){var n=c(r.xhr);r.onProgressiveData(n)}var i=r.onProgress;i&&i(t)}},onStateChange:function(e,t){var r=this.pendingRequests[e];if(r){var n=r.xhr;if(n.readyState>=2&&r.onHeadersReceived&&(r.onHeadersReceived(),delete r.onHeadersReceived),4===n.readyState&&e in this.pendingRequests)if(delete this.pendingRequests[e],0===n.status&&this.isHttp)r.onError&&r.onError(n.status);else{var i=n.status||200;if(200===i&&206===r.expectedStatus||i===r.expectedStatus){this.loadedRequests[e]=!0;var a=c(n);if(206===i){var o=n.getResponseHeader("Content-Range"),s=/bytes (\d+)-(\d+)\/(\d+)/.exec(o),u=parseInt(s[1],10);r.onDone({begin:u,chunk:a})}else r.onProgressiveData?r.onDone(null):a?r.onDone({begin:0,chunk:a}):r.onError&&r.onError(n.status)}else r.onError&&r.onError(n.status)}}},hasPendingRequests:function(){for(var e in this.pendingRequests)return!0;return!1},getRequestXhr:function(e){return this.pendingRequests[e].xhr},isStreamingRequest:function(e){return!!this.pendingRequests[e].onProgressiveData},isPendingRequest:function(e){return e in this.pendingRequests},isLoadedRequest:function(e){return e in this.loadedRequests},abortAllRequests:function(){for(var e in this.pendingRequests)this.abortRequest(0|e)},abortRequest:function(e){var t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}},d.prototype={_onRangeRequestReaderClosed:function(e){var t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)},getFullReader:function(){return(0,i.assert)(!this._fullRequestReader),this._fullRequestReader=new f(this._manager,this._source),this._fullRequestReader},getRangeReader:function(e,t){var r=new p(this._manager,e,t);return r.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(r),r},cancelAllRequests:function(e){this._fullRequestReader&&this._fullRequestReader.cancel(e),this._rangeRequestReaders.slice(0).forEach(function(t){t.cancel(e)})}},f.prototype={_onHeadersReceived:function(){var e=this._fullRequestId,t=this._manager.getRequestXhr(e),r=function(e){return t.getResponseHeader(e)},n=(0,a.validateRangeRequestCapabilities)({getResponseHeader:r,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange}),i=n.allowRangeRequests,o=n.suggestedLength;i&&(this._isRangeSupported=!0),this._contentLength=o||this._contentLength,this._filename=(0,a.extractFilenameFromHeader)(r);var s=this._manager;s.isStreamingRequest(e)?this._isStreamingSupported=!0:this._isRangeSupported&&s.abortRequest(e),this._headersReceivedCapability.resolve()},_onProgressiveData:function(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._cachedChunks.push(e)},_onDone:function(e){e&&this._onProgressiveData(e.chunk),this._done=!0,this._cachedChunks.length>0||(this._requests.forEach(function(e){e.resolve({value:void 0,done:!0})}),this._requests=[])},_onError:function(e){var t=this._url,r=(0,a.createResponseStatusError)(e,t);this._storedError=r,this._headersReceivedCapability.reject(r),this._requests.forEach(function(e){e.reject(r)}),this._requests=[],this._cachedChunks=[]},_onProgress:function(e){this.onProgress&&this.onProgress({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})},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 e=u(n.default.mark(function e(){var t,r;return n.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._storedError){e.next=2;break}throw this._storedError;case 2:if(!(this._cachedChunks.length>0)){e.next=5;break}return t=this._cachedChunks.shift(),e.abrupt("return",{value:t,done:!1});case 5:if(!this._done){e.next=7;break}return e.abrupt("return",{value:void 0,done:!0});case 7:return r=(0,i.createPromiseCapability)(),this._requests.push(r),e.abrupt("return",r.promise);case 10:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}(),cancel:function(e){this._done=!0,this._headersReceivedCapability.reject(e),this._requests.forEach(function(e){e.resolve({value:void 0,done:!0})}),this._requests=[],this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}},p.prototype={_close:function(){this.onClosed&&this.onClosed(this)},_onDone:function(e){var t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t;this._done=!0,this._requests.forEach(function(e){e.resolve({value:void 0,done:!0})}),this._requests=[],this._close()},_onProgress:function(e){!this.isStreamingSupported&&this.onProgress&&this.onProgress({loaded:e.loaded})},get isStreamingSupported(){return!1},read:function(){var e=u(n.default.mark(function e(){var t,r;return n.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null===this._queuedChunk){e.next=4;break}return t=this._queuedChunk,this._queuedChunk=null,e.abrupt("return",{value:t,done:!1});case 4:if(!this._done){e.next=6;break}return e.abrupt("return",{value:void 0,done:!0});case 6:return r=(0,i.createPromiseCapability)(),this._requests.push(r),e.abrupt("return",r.promise);case 9:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}(),cancel:function(e){this._done=!0,this._requests.forEach(function(e){e.resolve({value:void 0,done:!0})}),this._requests=[],this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}},t.PDFNetworkStream=d,t.NetworkManager=l}])}); \ No newline at end of file
diff --git a/vendor/assets/javascripts/pdf.worker.js b/vendor/assets/javascripts/pdf.worker.js
deleted file mode 100644
index 57ff1ff8e57..00000000000
--- a/vendor/assets/javascripts/pdf.worker.js
+++ /dev/null
@@ -1,47057 +0,0 @@
-/**
- * @licstart The following is the entire license notice for the
- * Javascript code in this page
- *
- * Copyright 2018 Mozilla Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * @licend The above is the entire license notice for the
- * Javascript code in this page
- */
-
-(function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory();
- else if(typeof define === 'function' && define.amd)
- define("pdfjs-dist/build/pdf.worker", [], factory);
- else if(typeof exports === 'object')
- exports["pdfjs-dist/build/pdf.worker"] = factory();
- else
- root["pdfjs-dist/build/pdf.worker"] = root.pdfjsWorker = factory();
-})(this, function() {
-return /******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
-/******/
-/******/ // The require function
-/******/ function __w_pdfjs_require__(moduleId) {
-/******/
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId]) {
-/******/ return installedModules[moduleId].exports;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ i: moduleId,
-/******/ l: false,
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);
-/******/
-/******/ // Flag the module as loaded
-/******/ module.l = true;
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/******/
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __w_pdfjs_require__.m = modules;
-/******/
-/******/ // expose the module cache
-/******/ __w_pdfjs_require__.c = installedModules;
-/******/
-/******/ // define getter function for harmony exports
-/******/ __w_pdfjs_require__.d = function(exports, name, getter) {
-/******/ if(!__w_pdfjs_require__.o(exports, name)) {
-/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
-/******/ }
-/******/ };
-/******/
-/******/ // define __esModule on exports
-/******/ __w_pdfjs_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/
-/******/ // create a fake namespace object
-/******/ // mode & 1: value is a module id, require it
-/******/ // mode & 2: merge all properties of value into the ns
-/******/ // mode & 4: return value when already ns object
-/******/ // mode & 8|1: behave like require
-/******/ __w_pdfjs_require__.t = function(value, mode) {
-/******/ if(mode & 1) value = __w_pdfjs_require__(value);
-/******/ if(mode & 8) return value;
-/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
-/******/ var ns = Object.create(null);
-/******/ __w_pdfjs_require__.r(ns);
-/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
-/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __w_pdfjs_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
-/******/ return ns;
-/******/ };
-/******/
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __w_pdfjs_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function getDefault() { return module['default']; } :
-/******/ function getModuleExports() { return module; };
-/******/ __w_pdfjs_require__.d(getter, 'a', getter);
-/******/ return getter;
-/******/ };
-/******/
-/******/ // Object.prototype.hasOwnProperty.call
-/******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
-/******/
-/******/ // __webpack_public_path__
-/******/ __w_pdfjs_require__.p = "";
-/******/
-/******/
-/******/ // Load entry module and return exports
-/******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var pdfjsVersion = '2.0.943';
-var pdfjsBuild = 'dc98bf76';
-var pdfjsCoreWorker = __w_pdfjs_require__(1);
-exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
-
-/***/ }),
-/* 1 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.WorkerMessageHandler = exports.WorkerTask = undefined;
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-var _slicedToArray = function () { function sliceIterator(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"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
-
-var _util = __w_pdfjs_require__(2);
-
-var _pdf_manager = __w_pdfjs_require__(130);
-
-var _is_node = __w_pdfjs_require__(5);
-
-var _is_node2 = _interopRequireDefault(_is_node);
-
-var _message_handler = __w_pdfjs_require__(172);
-
-var _primitives = __w_pdfjs_require__(138);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-var WorkerTask = function WorkerTaskClosure() {
- function WorkerTask(name) {
- this.name = name;
- this.terminated = false;
- this._capability = (0, _util.createPromiseCapability)();
- }
- WorkerTask.prototype = {
- get finished() {
- return this._capability.promise;
- },
- finish: function finish() {
- this._capability.resolve();
- },
- terminate: function terminate() {
- this.terminated = true;
- },
- ensureNotTerminated: function ensureNotTerminated() {
- if (this.terminated) {
- throw new Error('Worker task was terminated');
- }
- }
- };
- return 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;
- handler.on('test', function wphSetupTest(data) {
- if (testMessageProcessed) {
- return;
- }
- testMessageProcessed = true;
- if (!(data instanceof Uint8Array)) {
- handler.send('test', false);
- return;
- }
- var supportTransfers = data[0] === 255;
- handler.postMessageTransfers = supportTransfers;
- var xhr = new XMLHttpRequest();
- var responseExists = 'response' in xhr;
- try {
- xhr.responseType;
- } catch (e) {
- responseExists = false;
- }
- if (!responseExists) {
- handler.send('test', false);
- return;
- }
- handler.send('test', {
- supportTypedArray: true,
- supportTransfers: supportTransfers
- });
- });
- handler.on('configure', function wphConfigure(data) {
- (0, _util.setVerbosityLevel)(data.verbosity);
- });
- handler.on('GetDocRequest', function wphSetupDoc(data) {
- return WorkerMessageHandler.createDocumentHandler(data, port);
- });
- },
- createDocumentHandler: function createDocumentHandler(docParams, port) {
- var pdfManager;
- var terminated = false;
- var cancelXHRs = null;
- var WorkerTasks = [];
- var apiVersion = docParams.apiVersion;
- var workerVersion = '2.0.943';
- if (apiVersion !== workerVersion) {
- throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".'));
- }
- var docId = docParams.docId;
- var docBaseUrl = docParams.docBaseUrl;
- var workerHandlerName = docParams.docId + '_worker';
- var handler = new _message_handler.MessageHandler(workerHandlerName, docId, port);
- handler.postMessageTransfers = docParams.postMessageTransfers;
- function ensureNotTerminated() {
- if (terminated) {
- throw new Error('Worker was terminated');
- }
- }
- function startWorkerTask(task) {
- WorkerTasks.push(task);
- }
- function finishWorkerTask(task) {
- task.finish();
- var i = WorkerTasks.indexOf(task);
- WorkerTasks.splice(i, 1);
- }
- function loadDocument(recoveryMode) {
- var loadDocumentCapability = (0, _util.createPromiseCapability)();
- var parseSuccess = function parseSuccess() {
- Promise.all([pdfManager.ensureDoc('numPages'), pdfManager.ensureDoc('fingerprint')]).then(function (_ref3) {
- var _ref4 = _slicedToArray(_ref3, 2),
- numPages = _ref4[0],
- fingerprint = _ref4[1];
-
- loadDocumentCapability.resolve({
- numPages: numPages,
- fingerprint: fingerprint
- });
- }, parseFailure);
- };
- var parseFailure = function parseFailure(e) {
- loadDocumentCapability.reject(e);
- };
- pdfManager.ensureDoc('checkHeader', []).then(function () {
- pdfManager.ensureDoc('parseStartXRef', []).then(function () {
- pdfManager.ensureDoc('parse', [recoveryMode]).then(parseSuccess, parseFailure);
- }, parseFailure);
- }, parseFailure);
- return loadDocumentCapability.promise;
- }
- function getPdfManager(data, evaluatorOptions) {
- var pdfManagerCapability = (0, _util.createPromiseCapability)();
- var pdfManager;
- var source = data.source;
- if (source.data) {
- try {
- pdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl);
- pdfManagerCapability.resolve(pdfManager);
- } catch (ex) {
- pdfManagerCapability.reject(ex);
- }
- return pdfManagerCapability.promise;
- }
- var pdfStream,
- cachedChunks = [];
- try {
- pdfStream = new PDFWorkerStream(handler);
- } catch (ex) {
- pdfManagerCapability.reject(ex);
- return pdfManagerCapability.promise;
- }
- var fullRequest = pdfStream.getFullReader();
- fullRequest.headersReady.then(function () {
- if (!fullRequest.isRangeSupported) {
- return;
- }
- var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
- pdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
- msgHandler: handler,
- url: source.url,
- password: source.password,
- length: fullRequest.contentLength,
- disableAutoFetch: disableAutoFetch,
- rangeChunkSize: source.rangeChunkSize
- }, evaluatorOptions, docBaseUrl);
- for (var i = 0; i < cachedChunks.length; i++) {
- pdfManager.sendProgressiveData(cachedChunks[i]);
- }
- cachedChunks = [];
- pdfManagerCapability.resolve(pdfManager);
- cancelXHRs = null;
- }).catch(function (reason) {
- pdfManagerCapability.reject(reason);
- cancelXHRs = null;
- });
- var loaded = 0;
- var flushChunks = function flushChunks() {
- var pdfFile = (0, _util.arraysToBytes)(cachedChunks);
- if (source.length && pdfFile.length !== source.length) {
- (0, _util.warn)('reported HTTP length is different from actual');
- }
- try {
- pdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl);
- pdfManagerCapability.resolve(pdfManager);
- } catch (ex) {
- pdfManagerCapability.reject(ex);
- }
- cachedChunks = [];
- };
- var readPromise = new Promise(function (resolve, reject) {
- var readChunk = function readChunk(chunk) {
- try {
- ensureNotTerminated();
- if (chunk.done) {
- if (!pdfManager) {
- flushChunks();
- }
- cancelXHRs = null;
- return;
- }
- var data = chunk.value;
- loaded += (0, _util.arrayByteLength)(data);
- if (!fullRequest.isStreamingSupported) {
- handler.send('DocProgress', {
- loaded: loaded,
- total: Math.max(loaded, fullRequest.contentLength || 0)
- });
- }
- if (pdfManager) {
- pdfManager.sendProgressiveData(data);
- } else {
- cachedChunks.push(data);
- }
- fullRequest.read().then(readChunk, reject);
- } catch (e) {
- reject(e);
- }
- };
- fullRequest.read().then(readChunk, reject);
- });
- readPromise.catch(function (e) {
- pdfManagerCapability.reject(e);
- cancelXHRs = null;
- });
- cancelXHRs = function cancelXHRs() {
- pdfStream.cancelAllRequests('abort');
- };
- return pdfManagerCapability.promise;
- }
- function setupDoc(data) {
- function onSuccess(doc) {
- ensureNotTerminated();
- handler.send('GetDoc', { pdfInfo: doc });
- }
- function onFailure(e) {
- ensureNotTerminated();
- if (e instanceof _util.PasswordException) {
- var task = new WorkerTask('PasswordException: response ' + e.code);
- startWorkerTask(task);
- handler.sendWithPromise('PasswordRequest', e).then(function (data) {
- finishWorkerTask(task);
- pdfManager.updatePassword(data.password);
- pdfManagerReady();
- }).catch(function (boundException) {
- finishWorkerTask(task);
- handler.send('PasswordException', boundException);
- }.bind(null, e));
- } else if (e instanceof _util.InvalidPDFException) {
- handler.send('InvalidPDF', e);
- } else if (e instanceof _util.MissingPDFException) {
- handler.send('MissingPDF', e);
- } else if (e instanceof _util.UnexpectedResponseException) {
- handler.send('UnexpectedResponse', e);
- } else {
- handler.send('UnknownError', new _util.UnknownErrorException(e.message, e.toString()));
- }
- }
- function pdfManagerReady() {
- ensureNotTerminated();
- loadDocument(false).then(onSuccess, function loadFailure(ex) {
- ensureNotTerminated();
- if (!(ex instanceof _util.XRefParseException)) {
- onFailure(ex);
- return;
- }
- pdfManager.requestLoadedStream();
- pdfManager.onLoadedStream().then(function () {
- ensureNotTerminated();
- loadDocument(true).then(onSuccess, onFailure);
- });
- }, onFailure);
- }
- ensureNotTerminated();
- var evaluatorOptions = {
- forceDataSchema: data.disableCreateObjectURL,
- maxImageSize: data.maxImageSize,
- disableFontFace: data.disableFontFace,
- nativeImageDecoderSupport: data.nativeImageDecoderSupport,
- ignoreErrors: data.ignoreErrors,
- isEvalSupported: data.isEvalSupported
- };
- getPdfManager(data, evaluatorOptions).then(function (newPdfManager) {
- if (terminated) {
- newPdfManager.terminate();
- throw new Error('Worker was terminated');
- }
- pdfManager = newPdfManager;
- pdfManager.onLoadedStream().then(function (stream) {
- handler.send('DataLoaded', { length: stream.bytes.byteLength });
- });
- }).then(pdfManagerReady, onFailure);
- }
- 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 (_ref5) {
- var _ref6 = _slicedToArray(_ref5, 4),
- rotate = _ref6[0],
- ref = _ref6[1],
- userUnit = _ref6[2],
- view = _ref6[3];
-
- return {
- rotate: rotate,
- ref: ref,
- userUnit: userUnit,
- view: view
- };
- });
- });
- });
- handler.on('GetPageIndex', function wphSetupGetPageIndex(data) {
- var ref = new _primitives.Ref(data.ref.num, data.ref.gen);
- var catalog = pdfManager.pdfDocument.catalog;
- return catalog.getPageIndex(ref);
- });
- handler.on('GetDestinations', function wphSetupGetDestinations(data) {
- return pdfManager.ensureCatalog('destinations');
- });
- handler.on('GetDestination', function wphSetupGetDestination(data) {
- return pdfManager.ensureCatalog('getDestination', [data.id]);
- });
- handler.on('GetPageLabels', function wphSetupGetPageLabels(data) {
- return pdfManager.ensureCatalog('pageLabels');
- });
- handler.on('GetPageMode', function wphSetupGetPageMode(data) {
- return pdfManager.ensureCatalog('pageMode');
- });
- handler.on('GetAttachments', function wphSetupGetAttachments(data) {
- return pdfManager.ensureCatalog('attachments');
- });
- handler.on('GetJavaScript', function wphSetupGetJavaScript(data) {
- return pdfManager.ensureCatalog('javaScript');
- });
- handler.on('GetOutline', function wphSetupGetOutline(data) {
- return pdfManager.ensureCatalog('documentOutline');
- });
- handler.on('GetPermissions', function (data) {
- return pdfManager.ensureCatalog('permissions');
- });
- handler.on('GetMetadata', function wphSetupGetMetadata(data) {
- return Promise.all([pdfManager.ensureDoc('documentInfo'), pdfManager.ensureCatalog('metadata')]);
- });
- handler.on('GetData', function wphSetupGetData(data) {
- pdfManager.requestLoadedStream();
- return pdfManager.onLoadedStream().then(function (stream) {
- return stream.bytes;
- });
- });
- handler.on('GetStats', function wphSetupGetStats(data) {
- return pdfManager.pdfDocument.xref.stats;
- });
- handler.on('GetAnnotations', function (_ref7) {
- var pageIndex = _ref7.pageIndex,
- intent = _ref7.intent;
-
- return pdfManager.getPage(pageIndex).then(function (page) {
- return page.getAnnotationsData(intent);
- });
- });
- handler.on('RenderPageRequest', function wphSetupRenderPage(data) {
- var pageIndex = data.pageIndex;
- pdfManager.getPage(pageIndex).then(function (page) {
- var task = new WorkerTask('RenderPageRequest: page ' + pageIndex);
- startWorkerTask(task);
- var pageNum = pageIndex + 1;
- var start = Date.now();
- page.getOperatorList({
- handler: handler,
- task: task,
- intent: data.intent,
- renderInteractiveForms: data.renderInteractiveForms
- }).then(function (operatorList) {
- finishWorkerTask(task);
- (0, _util.info)('page=' + pageNum + ' - getOperatorList: time=' + (Date.now() - start) + 'ms, len=' + operatorList.totalLength);
- }, function (e) {
- finishWorkerTask(task);
- if (task.terminated) {
- return;
- }
- handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.unknown });
- var minimumStackMessage = 'worker.js: while trying to getPage() and getOperatorList()';
- var wrappedException;
- if (typeof e === 'string') {
- wrappedException = {
- message: e,
- stack: minimumStackMessage
- };
- } else if ((typeof e === 'undefined' ? 'undefined' : _typeof(e)) === 'object') {
- wrappedException = {
- message: e.message || e.toString(),
- stack: e.stack || minimumStackMessage
- };
- } else {
- wrappedException = {
- message: 'Unknown exception type: ' + (typeof e === 'undefined' ? 'undefined' : _typeof(e)),
- stack: minimumStackMessage
- };
- }
- handler.send('PageError', {
- pageNum: pageNum,
- error: wrappedException,
- intent: data.intent
- });
- });
- });
- }, this);
- handler.on('GetTextContent', function wphExtractText(data, sink) {
- var pageIndex = data.pageIndex;
- sink.onPull = function (desiredSize) {};
- sink.onCancel = function (reason) {};
- pdfManager.getPage(pageIndex).then(function (page) {
- var task = new WorkerTask('GetTextContent: page ' + pageIndex);
- startWorkerTask(task);
- var pageNum = pageIndex + 1;
- var start = Date.now();
- page.extractTextContent({
- handler: handler,
- task: task,
- sink: sink,
- normalizeWhitespace: data.normalizeWhitespace,
- combineTextItems: data.combineTextItems
- }).then(function () {
- finishWorkerTask(task);
- (0, _util.info)('text indexing: page=' + pageNum + ' - time=' + (Date.now() - start) + 'ms');
- sink.close();
- }, function (reason) {
- finishWorkerTask(task);
- if (task.terminated) {
- return;
- }
- sink.error(reason);
- throw reason;
- });
- });
- });
- handler.on('Cleanup', function wphCleanup(data) {
- return pdfManager.cleanup();
- });
- handler.on('Terminate', function wphTerminate(data) {
- terminated = true;
- if (pdfManager) {
- pdfManager.terminate();
- pdfManager = null;
- }
- if (cancelXHRs) {
- cancelXHRs();
- }
- var waitOn = [];
- WorkerTasks.forEach(function (task) {
- waitOn.push(task.finished);
- task.terminate();
- });
- return Promise.all(waitOn).then(function () {
- handler.destroy();
- handler = null;
- });
- });
- handler.on('Ready', function wphReady(data) {
- setupDoc(docParams);
- docParams = null;
- });
- return workerHandlerName;
- },
- initializeFromPort: function initializeFromPort(port) {
- var handler = new _message_handler.MessageHandler('worker', 'main', port);
- WorkerMessageHandler.setup(handler, port);
- handler.send('ready', null);
- }
-};
-function isMessagePort(maybePort) {
- return typeof maybePort.postMessage === 'function' && 'onmessage' in maybePort;
-}
-if (typeof window === 'undefined' && !(0, _is_node2.default)() && typeof self !== 'undefined' && isMessagePort(self)) {
- WorkerMessageHandler.initializeFromPort(self);
-}
-exports.WorkerTask = WorkerTask;
-exports.WorkerMessageHandler = WorkerMessageHandler;
-
-/***/ }),
-/* 2 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.URL = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.getInheritableProperty = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.toRomanNumerals = 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 = undefined;
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-__w_pdfjs_require__(3);
-
-var _streams_polyfill = __w_pdfjs_require__(126);
-
-var _url_polyfill = __w_pdfjs_require__(128);
-
-var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
-var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
-var NativeImageDecoding = {
- NONE: 'none',
- DECODE: 'decode',
- DISPLAY: 'display'
-};
-var PermissionFlag = {
- PRINT: 0x04,
- MODIFY_CONTENTS: 0x08,
- COPY: 0x10,
- MODIFY_ANNOTATIONS: 0x20,
- FILL_INTERACTIVE_FORMS: 0x100,
- COPY_FOR_ACCESSIBILITY: 0x200,
- ASSEMBLE: 0x400,
- PRINT_HIGH_QUALITY: 0x800
-};
-var TextRenderingMode = {
- FILL: 0,
- STROKE: 1,
- FILL_STROKE: 2,
- INVISIBLE: 3,
- FILL_ADD_TO_PATH: 4,
- STROKE_ADD_TO_PATH: 5,
- FILL_STROKE_ADD_TO_PATH: 6,
- ADD_TO_PATH: 7,
- FILL_STROKE_MASK: 3,
- ADD_TO_PATH_FLAG: 4
-};
-var ImageKind = {
- GRAYSCALE_1BPP: 1,
- RGB_24BPP: 2,
- RGBA_32BPP: 3
-};
-var AnnotationType = {
- TEXT: 1,
- LINK: 2,
- FREETEXT: 3,
- LINE: 4,
- SQUARE: 5,
- CIRCLE: 6,
- POLYGON: 7,
- POLYLINE: 8,
- HIGHLIGHT: 9,
- UNDERLINE: 10,
- SQUIGGLY: 11,
- STRIKEOUT: 12,
- STAMP: 13,
- CARET: 14,
- INK: 15,
- POPUP: 16,
- FILEATTACHMENT: 17,
- SOUND: 18,
- MOVIE: 19,
- WIDGET: 20,
- SCREEN: 21,
- PRINTERMARK: 22,
- TRAPNET: 23,
- WATERMARK: 24,
- THREED: 25,
- REDACT: 26
-};
-var AnnotationFlag = {
- INVISIBLE: 0x01,
- HIDDEN: 0x02,
- PRINT: 0x04,
- NOZOOM: 0x08,
- NOROTATE: 0x10,
- NOVIEW: 0x20,
- READONLY: 0x40,
- LOCKED: 0x80,
- TOGGLENOVIEW: 0x100,
- LOCKEDCONTENTS: 0x200
-};
-var AnnotationFieldFlag = {
- READONLY: 0x0000001,
- REQUIRED: 0x0000002,
- NOEXPORT: 0x0000004,
- MULTILINE: 0x0001000,
- PASSWORD: 0x0002000,
- NOTOGGLETOOFF: 0x0004000,
- RADIO: 0x0008000,
- PUSHBUTTON: 0x0010000,
- COMBO: 0x0020000,
- EDIT: 0x0040000,
- SORT: 0x0080000,
- FILESELECT: 0x0100000,
- MULTISELECT: 0x0200000,
- DONOTSPELLCHECK: 0x0400000,
- DONOTSCROLL: 0x0800000,
- COMB: 0x1000000,
- RICHTEXT: 0x2000000,
- RADIOSINUNISON: 0x2000000,
- COMMITONSELCHANGE: 0x4000000
-};
-var AnnotationBorderStyleType = {
- SOLID: 1,
- DASHED: 2,
- BEVELED: 3,
- INSET: 4,
- UNDERLINE: 5
-};
-var StreamType = {
- UNKNOWN: 0,
- FLATE: 1,
- LZW: 2,
- DCT: 3,
- JPX: 4,
- JBIG: 5,
- A85: 6,
- AHX: 7,
- CCF: 8,
- RL: 9
-};
-var FontType = {
- UNKNOWN: 0,
- TYPE1: 1,
- TYPE1C: 2,
- CIDFONTTYPE0: 3,
- CIDFONTTYPE0C: 4,
- TRUETYPE: 5,
- CIDFONTTYPE2: 6,
- TYPE3: 7,
- OPENTYPE: 8,
- TYPE0: 9,
- MMTYPE1: 10
-};
-var VerbosityLevel = {
- ERRORS: 0,
- WARNINGS: 1,
- INFOS: 5
-};
-var CMapCompressionType = {
- NONE: 0,
- BINARY: 1,
- STREAM: 2
-};
-var OPS = {
- dependency: 1,
- setLineWidth: 2,
- setLineCap: 3,
- setLineJoin: 4,
- setMiterLimit: 5,
- setDash: 6,
- setRenderingIntent: 7,
- setFlatness: 8,
- setGState: 9,
- save: 10,
- restore: 11,
- transform: 12,
- moveTo: 13,
- lineTo: 14,
- curveTo: 15,
- curveTo2: 16,
- curveTo3: 17,
- closePath: 18,
- rectangle: 19,
- stroke: 20,
- closeStroke: 21,
- fill: 22,
- eoFill: 23,
- fillStroke: 24,
- eoFillStroke: 25,
- closeFillStroke: 26,
- closeEOFillStroke: 27,
- endPath: 28,
- clip: 29,
- eoClip: 30,
- beginText: 31,
- endText: 32,
- setCharSpacing: 33,
- setWordSpacing: 34,
- setHScale: 35,
- setLeading: 36,
- setFont: 37,
- setTextRenderingMode: 38,
- setTextRise: 39,
- moveText: 40,
- setLeadingMoveText: 41,
- setTextMatrix: 42,
- nextLine: 43,
- showText: 44,
- showSpacedText: 45,
- nextLineShowText: 46,
- nextLineSetSpacingShowText: 47,
- setCharWidth: 48,
- setCharWidthAndBounds: 49,
- setStrokeColorSpace: 50,
- setFillColorSpace: 51,
- setStrokeColor: 52,
- setStrokeColorN: 53,
- setFillColor: 54,
- setFillColorN: 55,
- setStrokeGray: 56,
- setFillGray: 57,
- setStrokeRGBColor: 58,
- setFillRGBColor: 59,
- setStrokeCMYKColor: 60,
- setFillCMYKColor: 61,
- shadingFill: 62,
- beginInlineImage: 63,
- beginImageData: 64,
- endInlineImage: 65,
- paintXObject: 66,
- markPoint: 67,
- markPointProps: 68,
- beginMarkedContent: 69,
- beginMarkedContentProps: 70,
- endMarkedContent: 71,
- beginCompat: 72,
- endCompat: 73,
- paintFormXObjectBegin: 74,
- paintFormXObjectEnd: 75,
- beginGroup: 76,
- endGroup: 77,
- beginAnnotations: 78,
- endAnnotations: 79,
- beginAnnotation: 80,
- endAnnotation: 81,
- paintJpegXObject: 82,
- paintImageMaskXObject: 83,
- paintImageMaskXObjectGroup: 84,
- paintImageXObject: 85,
- paintInlineImageXObject: 86,
- paintInlineImageXObjectGroup: 87,
- paintImageXObjectRepeat: 88,
- paintImageMaskXObjectRepeat: 89,
- paintSolidColorImageMask: 90,
- constructPath: 91
-};
-var UNSUPPORTED_FEATURES = {
- unknown: 'unknown',
- forms: 'forms',
- javaScript: 'javaScript',
- smask: 'smask',
- shadingPattern: 'shadingPattern',
- font: 'font'
-};
-var PasswordResponses = {
- NEED_PASSWORD: 1,
- INCORRECT_PASSWORD: 2
-};
-var verbosity = VerbosityLevel.WARNINGS;
-function setVerbosityLevel(level) {
- if (Number.isInteger(level)) {
- verbosity = level;
- }
-}
-function getVerbosityLevel() {
- return verbosity;
-}
-function info(msg) {
- if (verbosity >= VerbosityLevel.INFOS) {
- console.log('Info: ' + msg);
- }
-}
-function warn(msg) {
- if (verbosity >= VerbosityLevel.WARNINGS) {
- console.log('Warning: ' + msg);
- }
-}
-function deprecated(details) {
- console.log('Deprecated API usage: ' + details);
-}
-function unreachable(msg) {
- throw new Error(msg);
-}
-function assert(cond, msg) {
- if (!cond) {
- unreachable(msg);
- }
-}
-function isSameOrigin(baseUrl, otherUrl) {
- try {
- var base = new _url_polyfill.URL(baseUrl);
- if (!base.origin || base.origin === 'null') {
- return false;
- }
- } catch (e) {
- return false;
- }
- var other = new _url_polyfill.URL(otherUrl, base);
- return base.origin === other.origin;
-}
-function _isValidProtocol(url) {
- if (!url) {
- return false;
- }
- switch (url.protocol) {
- case 'http:':
- case 'https:':
- case 'ftp:':
- case 'mailto:':
- case 'tel:':
- return true;
- default:
- return false;
- }
-}
-function createValidAbsoluteUrl(url, baseUrl) {
- if (!url) {
- return null;
- }
- try {
- var absoluteUrl = baseUrl ? new _url_polyfill.URL(url, baseUrl) : new _url_polyfill.URL(url);
- if (_isValidProtocol(absoluteUrl)) {
- return absoluteUrl;
- }
- } catch (ex) {}
- return null;
-}
-function shadow(obj, prop, value) {
- Object.defineProperty(obj, prop, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: false
- });
- 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';
- this.message = msg;
- this.code = code;
- }
- PasswordException.prototype = new Error();
- PasswordException.constructor = PasswordException;
- return PasswordException;
-}();
-var UnknownErrorException = function UnknownErrorExceptionClosure() {
- function UnknownErrorException(msg, details) {
- this.name = 'UnknownErrorException';
- this.message = msg;
- this.details = details;
- }
- UnknownErrorException.prototype = new Error();
- UnknownErrorException.constructor = UnknownErrorException;
- return UnknownErrorException;
-}();
-var InvalidPDFException = function InvalidPDFExceptionClosure() {
- function InvalidPDFException(msg) {
- this.name = 'InvalidPDFException';
- this.message = msg;
- }
- InvalidPDFException.prototype = new Error();
- InvalidPDFException.constructor = InvalidPDFException;
- return InvalidPDFException;
-}();
-var MissingPDFException = function MissingPDFExceptionClosure() {
- function MissingPDFException(msg) {
- this.name = 'MissingPDFException';
- this.message = msg;
- }
- MissingPDFException.prototype = new Error();
- MissingPDFException.constructor = MissingPDFException;
- return MissingPDFException;
-}();
-var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() {
- function UnexpectedResponseException(msg, status) {
- this.name = 'UnexpectedResponseException';
- this.message = msg;
- this.status = status;
- }
- UnexpectedResponseException.prototype = new Error();
- UnexpectedResponseException.constructor = UnexpectedResponseException;
- return 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;
-}();
-var XRefParseException = function XRefParseExceptionClosure() {
- function XRefParseException(msg) {
- this.message = msg;
- }
- XRefParseException.prototype = new Error();
- XRefParseException.prototype.name = 'XRefParseException';
- XRefParseException.constructor = XRefParseException;
- return XRefParseException;
-}();
-var FormatError = function FormatErrorClosure() {
- function FormatError(msg) {
- this.message = msg;
- }
- FormatError.prototype = new Error();
- FormatError.prototype.name = 'FormatError';
- FormatError.constructor = FormatError;
- return FormatError;
-}();
-var AbortException = function AbortExceptionClosure() {
- function AbortException(msg) {
- this.name = 'AbortException';
- this.message = msg;
- }
- AbortException.prototype = new Error();
- AbortException.constructor = AbortException;
- return AbortException;
-}();
-var NullCharactersRegExp = /\x00/g;
-function removeNullCharacters(str) {
- if (typeof str !== 'string') {
- warn('The argument for removeNullCharacters must be a string.');
- return str;
- }
- return str.replace(NullCharactersRegExp, '');
-}
-function bytesToString(bytes) {
- assert(bytes !== null && (typeof bytes === 'undefined' ? 'undefined' : _typeof(bytes)) === 'object' && bytes.length !== undefined, 'Invalid argument for bytesToString');
- var length = bytes.length;
- var MAX_ARGUMENT_COUNT = 8192;
- if (length < MAX_ARGUMENT_COUNT) {
- return String.fromCharCode.apply(null, bytes);
- }
- var strBuf = [];
- for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
- var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
- var chunk = bytes.subarray(i, chunkEnd);
- strBuf.push(String.fromCharCode.apply(null, chunk));
- }
- return strBuf.join('');
-}
-function stringToBytes(str) {
- assert(typeof str === 'string', 'Invalid argument for stringToBytes');
- var length = str.length;
- var bytes = new Uint8Array(length);
- for (var i = 0; i < length; ++i) {
- bytes[i] = str.charCodeAt(i) & 0xFF;
- }
- return bytes;
-}
-function arrayByteLength(arr) {
- if (arr.length !== undefined) {
- return arr.length;
- }
- assert(arr.byteLength !== undefined);
- return arr.byteLength;
-}
-function arraysToBytes(arr) {
- if (arr.length === 1 && arr[0] instanceof Uint8Array) {
- return arr[0];
- }
- var resultLength = 0;
- var i,
- ii = arr.length;
- var item, itemLength;
- for (i = 0; i < ii; i++) {
- item = arr[i];
- itemLength = arrayByteLength(item);
- resultLength += itemLength;
- }
- var pos = 0;
- var data = new Uint8Array(resultLength);
- for (i = 0; i < ii; i++) {
- item = arr[i];
- if (!(item instanceof Uint8Array)) {
- if (typeof item === 'string') {
- item = stringToBytes(item);
- } else {
- item = new Uint8Array(item);
- }
- }
- itemLength = item.byteLength;
- data.set(item, pos);
- pos += itemLength;
- }
- return data;
-}
-function string32(value) {
- return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
-}
-function log2(x) {
- if (x <= 0) {
- return 0;
- }
- return Math.ceil(Math.log2(x));
-}
-function readInt8(data, start) {
- return data[start] << 24 >> 24;
-}
-function readUint16(data, offset) {
- return data[offset] << 8 | data[offset + 1];
-}
-function readUint32(data, offset) {
- return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
-}
-function isLittleEndian() {
- var buffer8 = new Uint8Array(4);
- buffer8[0] = 1;
- var view32 = new Uint32Array(buffer8.buffer, 0, 1);
- return view32[0] === 1;
-}
-function isEvalSupported() {
- try {
- new Function('');
- return true;
- } catch (e) {
- return false;
- }
-}
-function getInheritableProperty(_ref) {
- var dict = _ref.dict,
- key = _ref.key,
- _ref$getArray = _ref.getArray,
- getArray = _ref$getArray === undefined ? false : _ref$getArray,
- _ref$stopWhenFound = _ref.stopWhenFound,
- stopWhenFound = _ref$stopWhenFound === undefined ? true : _ref$stopWhenFound;
-
- var LOOP_LIMIT = 100;
- var loopCount = 0;
- var values = void 0;
- 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 "' + key + '"');
- break;
- }
- dict = dict.get('Parent');
- }
- return values;
-}
-var Util = function UtilClosure() {
- function Util() {}
- var rgbBuf = ['rgb(', 0, ',', 0, ',', 0, ')'];
- Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {
- rgbBuf[1] = r;
- rgbBuf[3] = g;
- rgbBuf[5] = b;
- return rgbBuf.join('');
- };
- Util.transform = function Util_transform(m1, m2) {
- return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
- };
- Util.applyTransform = function Util_applyTransform(p, m) {
- var xt = p[0] * m[0] + p[1] * m[2] + m[4];
- var yt = p[0] * m[1] + p[1] * m[3] + m[5];
- return [xt, yt];
- };
- Util.applyInverseTransform = function Util_applyInverseTransform(p, m) {
- var d = m[0] * m[3] - m[1] * m[2];
- var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
- var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
- return [xt, yt];
- };
- Util.getAxialAlignedBoundingBox = function Util_getAxialAlignedBoundingBox(r, m) {
- var p1 = Util.applyTransform(r, m);
- var p2 = Util.applyTransform(r.slice(2, 4), m);
- var p3 = Util.applyTransform([r[0], r[3]], m);
- var p4 = Util.applyTransform([r[2], r[1]], m);
- return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])];
- };
- Util.inverseTransform = function Util_inverseTransform(m) {
- var d = m[0] * m[3] - m[1] * m[2];
- return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];
- };
- Util.apply3dTransform = function Util_apply3dTransform(m, v) {
- return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]];
- };
- Util.singularValueDecompose2dScale = function Util_singularValueDecompose2dScale(m) {
- var transpose = [m[0], m[2], m[1], m[3]];
- var a = m[0] * transpose[0] + m[1] * transpose[2];
- var b = m[0] * transpose[1] + m[1] * transpose[3];
- var c = m[2] * transpose[0] + m[3] * transpose[2];
- var d = m[2] * transpose[1] + m[3] * transpose[3];
- var first = (a + d) / 2;
- var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
- var sx = first + second || 1;
- var sy = first - second || 1;
- return [Math.sqrt(sx), Math.sqrt(sy)];
- };
- Util.normalizeRect = function Util_normalizeRect(rect) {
- var r = rect.slice(0);
- if (rect[0] > rect[2]) {
- r[0] = rect[2];
- r[2] = rect[0];
- }
- if (rect[1] > rect[3]) {
- r[1] = rect[3];
- r[3] = rect[1];
- }
- return r;
- };
- Util.intersect = function Util_intersect(rect1, rect2) {
- function compare(a, b) {
- return a - b;
- }
- var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare),
- orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare),
- result = [];
- rect1 = Util.normalizeRect(rect1);
- rect2 = Util.normalizeRect(rect2);
- if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
- result[0] = orderedX[1];
- result[2] = orderedX[2];
- } else {
- return false;
- }
- if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
- result[1] = orderedY[1];
- result[3] = orderedY[2];
- } else {
- return false;
- }
- return result;
- };
- return 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 = void 0,
- 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) {
- var i,
- n = str.length,
- strBuf = [];
- if (str[0] === '\xFE' && str[1] === '\xFF') {
- for (i = 2; i < n; i += 2) {
- strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
- }
- } else {
- for (i = 0; i < n; ++i) {
- var code = PDFStringTranslateTable[str.charCodeAt(i)];
- strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
- }
- }
- return strBuf.join('');
-}
-function stringToUTF8String(str) {
- return decodeURIComponent(escape(str));
-}
-function utf8StringToString(str) {
- return unescape(encodeURIComponent(str));
-}
-function isEmptyObj(obj) {
- for (var key in obj) {
- return false;
- }
- return true;
-}
-function isBool(v) {
- return typeof v === 'boolean';
-}
-function isNum(v) {
- return typeof v === 'number';
-}
-function isString(v) {
- return typeof v === 'string';
-}
-function isArrayBuffer(v) {
- return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' && v !== null && v.byteLength !== undefined;
-}
-function isSpace(ch) {
- return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
-}
-function createPromiseCapability() {
- var capability = {};
- capability.promise = new Promise(function (resolve, reject) {
- capability.resolve = resolve;
- capability.reject = reject;
- });
- return capability;
-}
-var createObjectURL = function createObjectURLClosure() {
- var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
- return function createObjectURL(data, contentType) {
- var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
-
- if (!forceDataSchema && _url_polyfill.URL.createObjectURL) {
- var blob = new Blob([data], { type: contentType });
- return _url_polyfill.URL.createObjectURL(blob);
- }
- var buffer = 'data:' + contentType + ';base64,';
- for (var i = 0, ii = data.length; i < ii; i += 3) {
- var b1 = data[i] & 0xFF;
- var b2 = data[i + 1] & 0xFF;
- var b3 = data[i + 2] & 0xFF;
- var d1 = b1 >> 2,
- d2 = (b1 & 3) << 4 | b2 >> 4;
- var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
- var d4 = i + 2 < ii ? b3 & 0x3F : 64;
- buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
- }
- return buffer;
- };
-}();
-exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
-exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
-exports.OPS = OPS;
-exports.VerbosityLevel = VerbosityLevel;
-exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
-exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
-exports.AnnotationFieldFlag = AnnotationFieldFlag;
-exports.AnnotationFlag = AnnotationFlag;
-exports.AnnotationType = AnnotationType;
-exports.FontType = FontType;
-exports.ImageKind = ImageKind;
-exports.CMapCompressionType = CMapCompressionType;
-exports.AbortException = AbortException;
-exports.InvalidPDFException = InvalidPDFException;
-exports.MissingDataException = MissingDataException;
-exports.MissingPDFException = MissingPDFException;
-exports.NativeImageDecoding = NativeImageDecoding;
-exports.PasswordException = PasswordException;
-exports.PasswordResponses = PasswordResponses;
-exports.PermissionFlag = PermissionFlag;
-exports.StreamType = StreamType;
-exports.TextRenderingMode = TextRenderingMode;
-exports.UnexpectedResponseException = UnexpectedResponseException;
-exports.UnknownErrorException = UnknownErrorException;
-exports.Util = Util;
-exports.toRomanNumerals = toRomanNumerals;
-exports.XRefParseException = XRefParseException;
-exports.FormatError = FormatError;
-exports.arrayByteLength = arrayByteLength;
-exports.arraysToBytes = arraysToBytes;
-exports.assert = assert;
-exports.bytesToString = bytesToString;
-exports.createPromiseCapability = createPromiseCapability;
-exports.createObjectURL = createObjectURL;
-exports.deprecated = deprecated;
-exports.getInheritableProperty = getInheritableProperty;
-exports.getLookupTableFactory = getLookupTableFactory;
-exports.getVerbosityLevel = getVerbosityLevel;
-exports.info = info;
-exports.isArrayBuffer = isArrayBuffer;
-exports.isBool = isBool;
-exports.isEmptyObj = isEmptyObj;
-exports.isNum = isNum;
-exports.isString = isString;
-exports.isSpace = isSpace;
-exports.isSameOrigin = isSameOrigin;
-exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
-exports.isLittleEndian = isLittleEndian;
-exports.isEvalSupported = isEvalSupported;
-exports.log2 = log2;
-exports.readInt8 = readInt8;
-exports.readUint16 = readUint16;
-exports.readUint32 = readUint32;
-exports.removeNullCharacters = removeNullCharacters;
-exports.ReadableStream = _streams_polyfill.ReadableStream;
-exports.URL = _url_polyfill.URL;
-exports.setVerbosityLevel = setVerbosityLevel;
-exports.shadow = shadow;
-exports.string32 = string32;
-exports.stringToBytes = stringToBytes;
-exports.stringToPDFString = stringToPDFString;
-exports.stringToUTF8String = stringToUTF8String;
-exports.utf8StringToString = utf8StringToString;
-exports.warn = warn;
-exports.unreachable = unreachable;
-
-/***/ }),
-/* 3 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-var globalScope = __w_pdfjs_require__(4);
-if (!globalScope._pdfjsCompatibilityChecked) {
- globalScope._pdfjsCompatibilityChecked = true;
- var isNodeJS = __w_pdfjs_require__(5);
- var hasDOM = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) === 'object' && (typeof document === 'undefined' ? 'undefined' : _typeof(document)) === 'object';
- (function checkNodeBtoa() {
- if (globalScope.btoa || !isNodeJS()) {
- return;
- }
- globalScope.btoa = function (chars) {
- return Buffer.from(chars, 'binary').toString('base64');
- };
- })();
- (function checkNodeAtob() {
- if (globalScope.atob || !isNodeJS()) {
- return;
- }
- globalScope.atob = function (input) {
- return Buffer.from(input, 'base64').toString('binary');
- };
- })();
- (function checkCurrentScript() {
- if (!hasDOM) {
- return;
- }
- if ('currentScript' in document) {
- return;
- }
- Object.defineProperty(document, 'currentScript', {
- get: function get() {
- var scripts = document.getElementsByTagName('script');
- return scripts[scripts.length - 1];
- },
-
- enumerable: true,
- configurable: true
- });
- })();
- (function checkChildNodeRemove() {
- if (!hasDOM) {
- return;
- }
- if (typeof Element.prototype.remove !== 'undefined') {
- return;
- }
- Element.prototype.remove = function () {
- if (this.parentNode) {
- this.parentNode.removeChild(this);
- }
- };
- })();
- (function checkDOMTokenListToggle() {
- if (!hasDOM || isNodeJS()) {
- return;
- }
- var div = document.createElement('div');
- if (div.classList.toggle('test', 0) === false) {
- return;
- }
- var originalDOMTokenListToggle = DOMTokenList.prototype.toggle;
- DOMTokenList.prototype.toggle = function (token) {
- if (arguments.length > 1) {
- var force = !!arguments[1];
- return this[force ? 'add' : 'remove'](token), force;
- }
- return originalDOMTokenListToggle(token);
- };
- })();
- (function checkStringIncludes() {
- if (String.prototype.includes) {
- return;
- }
- __w_pdfjs_require__(6);
- })();
- (function checkArrayIncludes() {
- if (Array.prototype.includes) {
- return;
- }
- __w_pdfjs_require__(34);
- })();
- (function checkObjectAssign() {
- if (Object.assign) {
- return;
- }
- __w_pdfjs_require__(43);
- })();
- (function checkMathLog2() {
- if (Math.log2) {
- return;
- }
- Math.log2 = __w_pdfjs_require__(53);
- })();
- (function checkNumberIsNaN() {
- if (Number.isNaN) {
- return;
- }
- Number.isNaN = __w_pdfjs_require__(55);
- })();
- (function checkNumberIsInteger() {
- if (Number.isInteger) {
- return;
- }
- Number.isInteger = __w_pdfjs_require__(57);
- })();
- (function checkPromise() {
- if (globalScope.Promise) {
- return;
- }
- globalScope.Promise = __w_pdfjs_require__(60);
- })();
- (function checkWeakMap() {
- if (globalScope.WeakMap) {
- return;
- }
- globalScope.WeakMap = __w_pdfjs_require__(95);
- })();
- (function checkStringCodePointAt() {
- if (String.codePointAt) {
- return;
- }
- String.codePointAt = __w_pdfjs_require__(112);
- })();
- (function checkStringFromCodePoint() {
- if (String.fromCodePoint) {
- return;
- }
- String.fromCodePoint = __w_pdfjs_require__(114);
- })();
- (function checkSymbol() {
- if (globalScope.Symbol) {
- return;
- }
- __w_pdfjs_require__(116);
- })();
- (function checkObjectValues() {
- if (Object.values) {
- return;
- }
- Object.values = __w_pdfjs_require__(123);
- })();
-}
-
-/***/ }),
-/* 4 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = typeof window !== 'undefined' && window.Math === Math ? window : typeof global !== 'undefined' && global.Math === Math ? global : typeof self !== 'undefined' && self.Math === Math ? self : {};
-
-/***/ }),
-/* 5 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-module.exports = function isNodeJS() {
- return (typeof process === 'undefined' ? 'undefined' : _typeof(process)) === 'object' && process + '' === '[object process]';
-};
-
-/***/ }),
-/* 6 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(7);
-module.exports = __w_pdfjs_require__(10).String.includes;
-
-/***/ }),
-/* 7 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(8);
-var context = __w_pdfjs_require__(26);
-var INCLUDES = 'includes';
-$export($export.P + $export.F * __w_pdfjs_require__(33)(INCLUDES), 'String', {
- includes: function includes(searchString) {
- return !!~context(this, searchString, INCLUDES).indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);
- }
-});
-
-/***/ }),
-/* 8 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var global = __w_pdfjs_require__(9);
-var core = __w_pdfjs_require__(10);
-var hide = __w_pdfjs_require__(11);
-var redefine = __w_pdfjs_require__(21);
-var ctx = __w_pdfjs_require__(24);
-var PROTOTYPE = 'prototype';
-var $export = function $export(type, name, source) {
- var IS_FORCED = type & $export.F;
- var IS_GLOBAL = type & $export.G;
- var IS_STATIC = type & $export.S;
- var IS_PROTO = type & $export.P;
- var IS_BIND = type & $export.B;
- var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];
- var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
- var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
- var key, own, out, exp;
- if (IS_GLOBAL) source = name;
- for (key in source) {
- own = !IS_FORCED && target && target[key] !== undefined;
- out = (own ? target : source)[key];
- exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
- if (target) redefine(target, key, out, type & $export.U);
- if (exports[key] != out) hide(exports, key, exp);
- if (IS_PROTO && expProto[key] != out) expProto[key] = out;
- }
-};
-global.core = core;
-$export.F = 1;
-$export.G = 2;
-$export.S = 4;
-$export.P = 8;
-$export.B = 16;
-$export.W = 32;
-$export.U = 64;
-$export.R = 128;
-module.exports = $export;
-
-/***/ }),
-/* 9 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
-if (typeof __g == 'number') __g = global;
-
-/***/ }),
-/* 10 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var core = module.exports = { version: '2.5.7' };
-if (typeof __e == 'number') __e = core;
-
-/***/ }),
-/* 11 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var dP = __w_pdfjs_require__(12);
-var createDesc = __w_pdfjs_require__(20);
-module.exports = __w_pdfjs_require__(16) ? function (object, key, value) {
- return dP.f(object, key, createDesc(1, value));
-} : function (object, key, value) {
- object[key] = value;
- return object;
-};
-
-/***/ }),
-/* 12 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var anObject = __w_pdfjs_require__(13);
-var IE8_DOM_DEFINE = __w_pdfjs_require__(15);
-var toPrimitive = __w_pdfjs_require__(19);
-var dP = Object.defineProperty;
-exports.f = __w_pdfjs_require__(16) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
- anObject(O);
- P = toPrimitive(P, true);
- anObject(Attributes);
- if (IE8_DOM_DEFINE) try {
- return dP(O, P, Attributes);
- } catch (e) {}
- if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
- if ('value' in Attributes) O[P] = Attributes.value;
- return O;
-};
-
-/***/ }),
-/* 13 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isObject = __w_pdfjs_require__(14);
-module.exports = function (it) {
- if (!isObject(it)) throw TypeError(it + ' is not an object!');
- return it;
-};
-
-/***/ }),
-/* 14 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-module.exports = function (it) {
- return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) === 'object' ? it !== null : typeof it === 'function';
-};
-
-/***/ }),
-/* 15 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = !__w_pdfjs_require__(16) && !__w_pdfjs_require__(17)(function () {
- return Object.defineProperty(__w_pdfjs_require__(18)('div'), 'a', {
- get: function get() {
- return 7;
- }
- }).a != 7;
-});
-
-/***/ }),
-/* 16 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = !__w_pdfjs_require__(17)(function () {
- return Object.defineProperty({}, 'a', {
- get: function get() {
- return 7;
- }
- }).a != 7;
-});
-
-/***/ }),
-/* 17 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = function (exec) {
- try {
- return !!exec();
- } catch (e) {
- return true;
- }
-};
-
-/***/ }),
-/* 18 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isObject = __w_pdfjs_require__(14);
-var document = __w_pdfjs_require__(9).document;
-var is = isObject(document) && isObject(document.createElement);
-module.exports = function (it) {
- return is ? document.createElement(it) : {};
-};
-
-/***/ }),
-/* 19 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isObject = __w_pdfjs_require__(14);
-module.exports = function (it, S) {
- if (!isObject(it)) return it;
- var fn, val;
- if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
- if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
- if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
- throw TypeError("Can't convert object to primitive value");
-};
-
-/***/ }),
-/* 20 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = function (bitmap, value) {
- return {
- enumerable: !(bitmap & 1),
- configurable: !(bitmap & 2),
- writable: !(bitmap & 4),
- value: value
- };
-};
-
-/***/ }),
-/* 21 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var global = __w_pdfjs_require__(9);
-var hide = __w_pdfjs_require__(11);
-var has = __w_pdfjs_require__(22);
-var SRC = __w_pdfjs_require__(23)('src');
-var TO_STRING = 'toString';
-var $toString = Function[TO_STRING];
-var TPL = ('' + $toString).split(TO_STRING);
-__w_pdfjs_require__(10).inspectSource = function (it) {
- return $toString.call(it);
-};
-(module.exports = function (O, key, val, safe) {
- var isFunction = typeof val == 'function';
- if (isFunction) has(val, 'name') || hide(val, 'name', key);
- if (O[key] === val) return;
- if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
- if (O === global) {
- O[key] = val;
- } else if (!safe) {
- delete O[key];
- hide(O, key, val);
- } else if (O[key]) {
- O[key] = val;
- } else {
- hide(O, key, val);
- }
-})(Function.prototype, TO_STRING, function toString() {
- return typeof this == 'function' && this[SRC] || $toString.call(this);
-});
-
-/***/ }),
-/* 22 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var hasOwnProperty = {}.hasOwnProperty;
-module.exports = function (it, key) {
- return hasOwnProperty.call(it, key);
-};
-
-/***/ }),
-/* 23 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var id = 0;
-var px = Math.random();
-module.exports = function (key) {
- return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
-};
-
-/***/ }),
-/* 24 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var aFunction = __w_pdfjs_require__(25);
-module.exports = function (fn, that, length) {
- aFunction(fn);
- if (that === undefined) return fn;
- switch (length) {
- case 1:
- return function (a) {
- return fn.call(that, a);
- };
- case 2:
- return function (a, b) {
- return fn.call(that, a, b);
- };
- case 3:
- return function (a, b, c) {
- return fn.call(that, a, b, c);
- };
- }
- return function () {
- return fn.apply(that, arguments);
- };
-};
-
-/***/ }),
-/* 25 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = function (it) {
- if (typeof it != 'function') throw TypeError(it + ' is not a function!');
- return it;
-};
-
-/***/ }),
-/* 26 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isRegExp = __w_pdfjs_require__(27);
-var defined = __w_pdfjs_require__(32);
-module.exports = function (that, searchString, NAME) {
- if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!");
- return String(defined(that));
-};
-
-/***/ }),
-/* 27 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isObject = __w_pdfjs_require__(14);
-var cof = __w_pdfjs_require__(28);
-var MATCH = __w_pdfjs_require__(29)('match');
-module.exports = function (it) {
- var isRegExp;
- return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');
-};
-
-/***/ }),
-/* 28 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var toString = {}.toString;
-module.exports = function (it) {
- return toString.call(it).slice(8, -1);
-};
-
-/***/ }),
-/* 29 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var store = __w_pdfjs_require__(30)('wks');
-var uid = __w_pdfjs_require__(23);
-var _Symbol = __w_pdfjs_require__(9).Symbol;
-var USE_SYMBOL = typeof _Symbol == 'function';
-var $exports = module.exports = function (name) {
- return store[name] || (store[name] = USE_SYMBOL && _Symbol[name] || (USE_SYMBOL ? _Symbol : uid)('Symbol.' + name));
-};
-$exports.store = store;
-
-/***/ }),
-/* 30 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var core = __w_pdfjs_require__(10);
-var global = __w_pdfjs_require__(9);
-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__(31) ? 'pure' : 'global',
- copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
-});
-
-/***/ }),
-/* 31 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = false;
-
-/***/ }),
-/* 32 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = function (it) {
- if (it == undefined) throw TypeError("Can't call method on " + it);
- return it;
-};
-
-/***/ }),
-/* 33 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var MATCH = __w_pdfjs_require__(29)('match');
-module.exports = function (KEY) {
- var re = /./;
- try {
- '/./'[KEY](re);
- } catch (e) {
- try {
- re[MATCH] = false;
- return !'/./'[KEY](re);
- } catch (f) {}
- }
- return true;
-};
-
-/***/ }),
-/* 34 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(35);
-module.exports = __w_pdfjs_require__(10).Array.includes;
-
-/***/ }),
-/* 35 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(8);
-var $includes = __w_pdfjs_require__(36)(true);
-$export($export.P, 'Array', {
- includes: function includes(el) {
- return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
- }
-});
-__w_pdfjs_require__(42)('includes');
-
-/***/ }),
-/* 36 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var toIObject = __w_pdfjs_require__(37);
-var toLength = __w_pdfjs_require__(39);
-var toAbsoluteIndex = __w_pdfjs_require__(41);
-module.exports = function (IS_INCLUDES) {
- return function ($this, el, fromIndex) {
- var O = toIObject($this);
- var length = toLength(O.length);
- var index = toAbsoluteIndex(fromIndex, length);
- var value;
- if (IS_INCLUDES && el != el) while (length > index) {
- value = O[index++];
- if (value != value) return true;
- } else for (; length > index; index++) {
- if (IS_INCLUDES || index in O) {
- if (O[index] === el) return IS_INCLUDES || index || 0;
- }
- }return !IS_INCLUDES && -1;
- };
-};
-
-/***/ }),
-/* 37 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var IObject = __w_pdfjs_require__(38);
-var defined = __w_pdfjs_require__(32);
-module.exports = function (it) {
- return IObject(defined(it));
-};
-
-/***/ }),
-/* 38 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var cof = __w_pdfjs_require__(28);
-module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
- return cof(it) == 'String' ? it.split('') : Object(it);
-};
-
-/***/ }),
-/* 39 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var toInteger = __w_pdfjs_require__(40);
-var min = Math.min;
-module.exports = function (it) {
- return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0;
-};
-
-/***/ }),
-/* 40 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var ceil = Math.ceil;
-var floor = Math.floor;
-module.exports = function (it) {
- return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
-};
-
-/***/ }),
-/* 41 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var toInteger = __w_pdfjs_require__(40);
-var max = Math.max;
-var min = Math.min;
-module.exports = function (index, length) {
- index = toInteger(index);
- return index < 0 ? max(index + length, 0) : min(index, length);
-};
-
-/***/ }),
-/* 42 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var UNSCOPABLES = __w_pdfjs_require__(29)('unscopables');
-var ArrayProto = Array.prototype;
-if (ArrayProto[UNSCOPABLES] == undefined) __w_pdfjs_require__(11)(ArrayProto, UNSCOPABLES, {});
-module.exports = function (key) {
- ArrayProto[UNSCOPABLES][key] = true;
-};
-
-/***/ }),
-/* 43 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(44);
-module.exports = __w_pdfjs_require__(10).Object.assign;
-
-/***/ }),
-/* 44 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(8);
-$export($export.S + $export.F, 'Object', { assign: __w_pdfjs_require__(45) });
-
-/***/ }),
-/* 45 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var getKeys = __w_pdfjs_require__(46);
-var gOPS = __w_pdfjs_require__(50);
-var pIE = __w_pdfjs_require__(51);
-var toObject = __w_pdfjs_require__(52);
-var IObject = __w_pdfjs_require__(38);
-var $assign = Object.assign;
-module.exports = !$assign || __w_pdfjs_require__(17)(function () {
- var A = {};
- var B = {};
- var S = Symbol();
- var K = 'abcdefghijklmnopqrst';
- A[S] = 7;
- K.split('').forEach(function (k) {
- B[k] = k;
- });
- return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
-}) ? function assign(target, source) {
- var T = toObject(target);
- var aLen = arguments.length;
- var index = 1;
- var getSymbols = gOPS.f;
- var isEnum = pIE.f;
- while (aLen > index) {
- var S = IObject(arguments[index++]);
- var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
- var length = keys.length;
- var j = 0;
- var key;
- while (length > j) {
- if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
- }
- }
- return T;
-} : $assign;
-
-/***/ }),
-/* 46 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $keys = __w_pdfjs_require__(47);
-var enumBugKeys = __w_pdfjs_require__(49);
-module.exports = Object.keys || function keys(O) {
- return $keys(O, enumBugKeys);
-};
-
-/***/ }),
-/* 47 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var has = __w_pdfjs_require__(22);
-var toIObject = __w_pdfjs_require__(37);
-var arrayIndexOf = __w_pdfjs_require__(36)(false);
-var IE_PROTO = __w_pdfjs_require__(48)('IE_PROTO');
-module.exports = function (object, names) {
- var O = toIObject(object);
- var i = 0;
- var result = [];
- var key;
- for (key in O) {
- if (key != IE_PROTO) has(O, key) && result.push(key);
- }while (names.length > i) {
- if (has(O, key = names[i++])) {
- ~arrayIndexOf(result, key) || result.push(key);
- }
- }return result;
-};
-
-/***/ }),
-/* 48 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var shared = __w_pdfjs_require__(30)('keys');
-var uid = __w_pdfjs_require__(23);
-module.exports = function (key) {
- return shared[key] || (shared[key] = uid(key));
-};
-
-/***/ }),
-/* 49 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'.split(',');
-
-/***/ }),
-/* 50 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-exports.f = Object.getOwnPropertySymbols;
-
-/***/ }),
-/* 51 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-exports.f = {}.propertyIsEnumerable;
-
-/***/ }),
-/* 52 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var defined = __w_pdfjs_require__(32);
-module.exports = function (it) {
- return Object(defined(it));
-};
-
-/***/ }),
-/* 53 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(54);
-module.exports = __w_pdfjs_require__(10).Math.log2;
-
-/***/ }),
-/* 54 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(8);
-$export($export.S, 'Math', {
- log2: function log2(x) {
- return Math.log(x) / Math.LN2;
- }
-});
-
-/***/ }),
-/* 55 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(56);
-module.exports = __w_pdfjs_require__(10).Number.isNaN;
-
-/***/ }),
-/* 56 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(8);
-$export($export.S, 'Number', {
- isNaN: function isNaN(number) {
- return number != number;
- }
-});
-
-/***/ }),
-/* 57 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(58);
-module.exports = __w_pdfjs_require__(10).Number.isInteger;
-
-/***/ }),
-/* 58 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(8);
-$export($export.S, 'Number', { isInteger: __w_pdfjs_require__(59) });
-
-/***/ }),
-/* 59 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isObject = __w_pdfjs_require__(14);
-var floor = Math.floor;
-module.exports = function isInteger(it) {
- return !isObject(it) && isFinite(it) && floor(it) === it;
-};
-
-/***/ }),
-/* 60 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(61);
-__w_pdfjs_require__(63);
-__w_pdfjs_require__(73);
-__w_pdfjs_require__(76);
-__w_pdfjs_require__(93);
-__w_pdfjs_require__(94);
-module.exports = __w_pdfjs_require__(10).Promise;
-
-/***/ }),
-/* 61 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var classof = __w_pdfjs_require__(62);
-var test = {};
-test[__w_pdfjs_require__(29)('toStringTag')] = 'z';
-if (test + '' != '[object z]') {
- __w_pdfjs_require__(21)(Object.prototype, 'toString', function toString() {
- return '[object ' + classof(this) + ']';
- }, true);
-}
-
-/***/ }),
-/* 62 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var cof = __w_pdfjs_require__(28);
-var TAG = __w_pdfjs_require__(29)('toStringTag');
-var ARG = cof(function () {
- return arguments;
-}()) == 'Arguments';
-var tryGet = function tryGet(it, key) {
- try {
- return it[key];
- } catch (e) {}
-};
-module.exports = function (it) {
- var O, T, B;
- return it === undefined ? 'Undefined' : it === null ? 'Null' : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T : ARG ? cof(O) : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
-};
-
-/***/ }),
-/* 63 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $at = __w_pdfjs_require__(64)(true);
-__w_pdfjs_require__(65)(String, 'String', function (iterated) {
- this._t = String(iterated);
- this._i = 0;
-}, function () {
- var O = this._t;
- var index = this._i;
- var point;
- if (index >= O.length) return {
- value: undefined,
- done: true
- };
- point = $at(O, index);
- this._i += point.length;
- return {
- value: point,
- done: false
- };
-});
-
-/***/ }),
-/* 64 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var toInteger = __w_pdfjs_require__(40);
-var defined = __w_pdfjs_require__(32);
-module.exports = function (TO_STRING) {
- return function (that, pos) {
- var s = String(defined(that));
- var i = toInteger(pos);
- var l = s.length;
- var a, b;
- if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
- a = s.charCodeAt(i);
- return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
- };
-};
-
-/***/ }),
-/* 65 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var LIBRARY = __w_pdfjs_require__(31);
-var $export = __w_pdfjs_require__(8);
-var redefine = __w_pdfjs_require__(21);
-var hide = __w_pdfjs_require__(11);
-var Iterators = __w_pdfjs_require__(66);
-var $iterCreate = __w_pdfjs_require__(67);
-var setToStringTag = __w_pdfjs_require__(71);
-var getPrototypeOf = __w_pdfjs_require__(72);
-var ITERATOR = __w_pdfjs_require__(29)('iterator');
-var BUGGY = !([].keys && 'next' in [].keys());
-var FF_ITERATOR = '@@iterator';
-var KEYS = 'keys';
-var VALUES = 'values';
-var returnThis = function returnThis() {
- return this;
-};
-module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
- $iterCreate(Constructor, NAME, next);
- var getMethod = function getMethod(kind) {
- if (!BUGGY && kind in proto) return proto[kind];
- switch (kind) {
- case KEYS:
- return function keys() {
- return new Constructor(this, kind);
- };
- case VALUES:
- return function values() {
- return new Constructor(this, kind);
- };
- }
- return function entries() {
- return new Constructor(this, kind);
- };
- };
- var TAG = NAME + ' Iterator';
- var DEF_VALUES = DEFAULT == VALUES;
- var VALUES_BUG = false;
- var proto = Base.prototype;
- var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
- var $default = $native || getMethod(DEFAULT);
- var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
- var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
- var methods, key, IteratorPrototype;
- if ($anyNative) {
- IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
- if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
- setToStringTag(IteratorPrototype, TAG, true);
- if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
- }
- }
- if (DEF_VALUES && $native && $native.name !== VALUES) {
- VALUES_BUG = true;
- $default = function values() {
- return $native.call(this);
- };
- }
- if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
- hide(proto, ITERATOR, $default);
- }
- Iterators[NAME] = $default;
- Iterators[TAG] = returnThis;
- if (DEFAULT) {
- methods = {
- values: DEF_VALUES ? $default : getMethod(VALUES),
- keys: IS_SET ? $default : getMethod(KEYS),
- entries: $entries
- };
- if (FORCED) for (key in methods) {
- if (!(key in proto)) redefine(proto, key, methods[key]);
- } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
- }
- return methods;
-};
-
-/***/ }),
-/* 66 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = {};
-
-/***/ }),
-/* 67 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var create = __w_pdfjs_require__(68);
-var descriptor = __w_pdfjs_require__(20);
-var setToStringTag = __w_pdfjs_require__(71);
-var IteratorPrototype = {};
-__w_pdfjs_require__(11)(IteratorPrototype, __w_pdfjs_require__(29)('iterator'), function () {
- return this;
-});
-module.exports = function (Constructor, NAME, next) {
- Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
- setToStringTag(Constructor, NAME + ' Iterator');
-};
-
-/***/ }),
-/* 68 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var anObject = __w_pdfjs_require__(13);
-var dPs = __w_pdfjs_require__(69);
-var enumBugKeys = __w_pdfjs_require__(49);
-var IE_PROTO = __w_pdfjs_require__(48)('IE_PROTO');
-var Empty = function Empty() {};
-var PROTOTYPE = 'prototype';
-var _createDict = function createDict() {
- var iframe = __w_pdfjs_require__(18)('iframe');
- var i = enumBugKeys.length;
- var lt = '<';
- var gt = '>';
- var iframeDocument;
- iframe.style.display = 'none';
- __w_pdfjs_require__(70).appendChild(iframe);
- iframe.src = 'javascript:';
- iframeDocument = iframe.contentWindow.document;
- iframeDocument.open();
- iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
- iframeDocument.close();
- _createDict = iframeDocument.F;
- while (i--) {
- delete _createDict[PROTOTYPE][enumBugKeys[i]];
- }return _createDict();
-};
-module.exports = Object.create || function create(O, Properties) {
- var result;
- if (O !== null) {
- Empty[PROTOTYPE] = anObject(O);
- result = new Empty();
- Empty[PROTOTYPE] = null;
- result[IE_PROTO] = O;
- } else result = _createDict();
- return Properties === undefined ? result : dPs(result, Properties);
-};
-
-/***/ }),
-/* 69 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var dP = __w_pdfjs_require__(12);
-var anObject = __w_pdfjs_require__(13);
-var getKeys = __w_pdfjs_require__(46);
-module.exports = __w_pdfjs_require__(16) ? Object.defineProperties : function defineProperties(O, Properties) {
- anObject(O);
- var keys = getKeys(Properties);
- var length = keys.length;
- var i = 0;
- var P;
- while (length > i) {
- dP.f(O, P = keys[i++], Properties[P]);
- }return O;
-};
-
-/***/ }),
-/* 70 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var document = __w_pdfjs_require__(9).document;
-module.exports = document && document.documentElement;
-
-/***/ }),
-/* 71 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var def = __w_pdfjs_require__(12).f;
-var has = __w_pdfjs_require__(22);
-var TAG = __w_pdfjs_require__(29)('toStringTag');
-module.exports = function (it, tag, stat) {
- if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, {
- configurable: true,
- value: tag
- });
-};
-
-/***/ }),
-/* 72 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var has = __w_pdfjs_require__(22);
-var toObject = __w_pdfjs_require__(52);
-var IE_PROTO = __w_pdfjs_require__(48)('IE_PROTO');
-var ObjectProto = Object.prototype;
-module.exports = Object.getPrototypeOf || function (O) {
- O = toObject(O);
- if (has(O, IE_PROTO)) return O[IE_PROTO];
- if (typeof O.constructor == 'function' && O instanceof O.constructor) {
- return O.constructor.prototype;
- }
- return O instanceof Object ? ObjectProto : null;
-};
-
-/***/ }),
-/* 73 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $iterators = __w_pdfjs_require__(74);
-var getKeys = __w_pdfjs_require__(46);
-var redefine = __w_pdfjs_require__(21);
-var global = __w_pdfjs_require__(9);
-var hide = __w_pdfjs_require__(11);
-var Iterators = __w_pdfjs_require__(66);
-var wks = __w_pdfjs_require__(29);
-var ITERATOR = wks('iterator');
-var TO_STRING_TAG = wks('toStringTag');
-var ArrayValues = Iterators.Array;
-var DOMIterables = {
- CSSRuleList: true,
- CSSStyleDeclaration: false,
- CSSValueList: false,
- ClientRectList: false,
- DOMRectList: false,
- DOMStringList: false,
- DOMTokenList: true,
- DataTransferItemList: false,
- FileList: false,
- HTMLAllCollection: false,
- HTMLCollection: false,
- HTMLFormElement: false,
- HTMLSelectElement: false,
- MediaList: true,
- MimeTypeArray: false,
- NamedNodeMap: false,
- NodeList: true,
- PaintRequestList: false,
- Plugin: false,
- PluginArray: false,
- SVGLengthList: false,
- SVGNumberList: false,
- SVGPathSegList: false,
- SVGPointList: false,
- SVGStringList: false,
- SVGTransformList: false,
- SourceBufferList: false,
- StyleSheetList: true,
- TextTrackCueList: false,
- TextTrackList: false,
- TouchList: false
-};
-for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) {
- var NAME = collections[i];
- var explicit = DOMIterables[NAME];
- var Collection = global[NAME];
- var proto = Collection && Collection.prototype;
- var key;
- if (proto) {
- if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues);
- if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
- Iterators[NAME] = ArrayValues;
- if (explicit) for (key in $iterators) {
- if (!proto[key]) redefine(proto, key, $iterators[key], true);
- }
- }
-}
-
-/***/ }),
-/* 74 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var addToUnscopables = __w_pdfjs_require__(42);
-var step = __w_pdfjs_require__(75);
-var Iterators = __w_pdfjs_require__(66);
-var toIObject = __w_pdfjs_require__(37);
-module.exports = __w_pdfjs_require__(65)(Array, 'Array', function (iterated, kind) {
- this._t = toIObject(iterated);
- this._i = 0;
- this._k = kind;
-}, function () {
- var O = this._t;
- var kind = this._k;
- var index = this._i++;
- if (!O || index >= O.length) {
- this._t = undefined;
- return step(1);
- }
- if (kind == 'keys') return step(0, index);
- if (kind == 'values') return step(0, O[index]);
- return step(0, [index, O[index]]);
-}, 'values');
-Iterators.Arguments = Iterators.Array;
-addToUnscopables('keys');
-addToUnscopables('values');
-addToUnscopables('entries');
-
-/***/ }),
-/* 75 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = function (done, value) {
- return {
- value: value,
- done: !!done
- };
-};
-
-/***/ }),
-/* 76 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var LIBRARY = __w_pdfjs_require__(31);
-var global = __w_pdfjs_require__(9);
-var ctx = __w_pdfjs_require__(24);
-var classof = __w_pdfjs_require__(62);
-var $export = __w_pdfjs_require__(8);
-var isObject = __w_pdfjs_require__(14);
-var aFunction = __w_pdfjs_require__(25);
-var anInstance = __w_pdfjs_require__(77);
-var forOf = __w_pdfjs_require__(78);
-var speciesConstructor = __w_pdfjs_require__(82);
-var task = __w_pdfjs_require__(83).set;
-var microtask = __w_pdfjs_require__(85)();
-var newPromiseCapabilityModule = __w_pdfjs_require__(86);
-var perform = __w_pdfjs_require__(87);
-var userAgent = __w_pdfjs_require__(88);
-var promiseResolve = __w_pdfjs_require__(89);
-var PROMISE = 'Promise';
-var TypeError = global.TypeError;
-var process = global.process;
-var versions = process && process.versions;
-var v8 = versions && versions.v8 || '';
-var $Promise = global[PROMISE];
-var isNode = classof(process) == 'process';
-var empty = function empty() {};
-var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
-var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;
-var USE_NATIVE = !!function () {
- try {
- var promise = $Promise.resolve(1);
- var FakePromise = (promise.constructor = {})[__w_pdfjs_require__(29)('species')] = function (exec) {
- exec(empty, empty);
- };
- return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise && v8.indexOf('6.6') !== 0 && userAgent.indexOf('Chrome/66') === -1;
- } catch (e) {}
-}();
-var isThenable = function isThenable(it) {
- var then;
- return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
-};
-var notify = function notify(promise, isReject) {
- if (promise._n) return;
- promise._n = true;
- var chain = promise._c;
- microtask(function () {
- var value = promise._v;
- var ok = promise._s == 1;
- var i = 0;
- var run = function run(reaction) {
- var handler = ok ? reaction.ok : reaction.fail;
- var resolve = reaction.resolve;
- var reject = reaction.reject;
- var domain = reaction.domain;
- var result, then, exited;
- try {
- if (handler) {
- if (!ok) {
- if (promise._h == 2) onHandleUnhandled(promise);
- promise._h = 1;
- }
- if (handler === true) result = value;else {
- if (domain) domain.enter();
- result = handler(value);
- if (domain) {
- domain.exit();
- exited = true;
- }
- }
- if (result === reaction.promise) {
- reject(TypeError('Promise-chain cycle'));
- } else if (then = isThenable(result)) {
- then.call(result, resolve, reject);
- } else resolve(result);
- } else reject(value);
- } catch (e) {
- if (domain && !exited) domain.exit();
- reject(e);
- }
- };
- while (chain.length > i) {
- run(chain[i++]);
- }promise._c = [];
- promise._n = false;
- if (isReject && !promise._h) onUnhandled(promise);
- });
-};
-var onUnhandled = function onUnhandled(promise) {
- task.call(global, function () {
- var value = promise._v;
- var unhandled = isUnhandled(promise);
- var result, handler, console;
- if (unhandled) {
- result = perform(function () {
- if (isNode) {
- process.emit('unhandledRejection', value, promise);
- } else if (handler = global.onunhandledrejection) {
- handler({
- promise: promise,
- reason: value
- });
- } else if ((console = global.console) && console.error) {
- console.error('Unhandled promise rejection', value);
- }
- });
- promise._h = isNode || isUnhandled(promise) ? 2 : 1;
- }
- promise._a = undefined;
- if (unhandled && result.e) throw result.v;
- });
-};
-var isUnhandled = function isUnhandled(promise) {
- return promise._h !== 1 && (promise._a || promise._c).length === 0;
-};
-var onHandleUnhandled = function onHandleUnhandled(promise) {
- task.call(global, function () {
- var handler;
- if (isNode) {
- process.emit('rejectionHandled', promise);
- } else if (handler = global.onrejectionhandled) {
- handler({
- promise: promise,
- reason: promise._v
- });
- }
- });
-};
-var $reject = function $reject(value) {
- var promise = this;
- if (promise._d) return;
- promise._d = true;
- promise = promise._w || promise;
- promise._v = value;
- promise._s = 2;
- if (!promise._a) promise._a = promise._c.slice();
- notify(promise, true);
-};
-var $resolve = function $resolve(value) {
- var promise = this;
- var then;
- if (promise._d) return;
- promise._d = true;
- promise = promise._w || promise;
- try {
- if (promise === value) throw TypeError("Promise can't be resolved itself");
- if (then = isThenable(value)) {
- microtask(function () {
- var wrapper = {
- _w: promise,
- _d: false
- };
- try {
- then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
- } catch (e) {
- $reject.call(wrapper, e);
- }
- });
- } else {
- promise._v = value;
- promise._s = 1;
- notify(promise, false);
- }
- } catch (e) {
- $reject.call({
- _w: promise,
- _d: false
- }, e);
- }
-};
-if (!USE_NATIVE) {
- $Promise = function Promise(executor) {
- anInstance(this, $Promise, PROMISE, '_h');
- aFunction(executor);
- Internal.call(this);
- try {
- executor(ctx($resolve, this, 1), ctx($reject, this, 1));
- } catch (err) {
- $reject.call(this, err);
- }
- };
- Internal = function Promise(executor) {
- this._c = [];
- this._a = undefined;
- this._s = 0;
- this._d = false;
- this._v = undefined;
- this._h = 0;
- this._n = false;
- };
- Internal.prototype = __w_pdfjs_require__(90)($Promise.prototype, {
- then: function then(onFulfilled, onRejected) {
- var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
- reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
- reaction.fail = typeof onRejected == 'function' && onRejected;
- reaction.domain = isNode ? process.domain : undefined;
- this._c.push(reaction);
- if (this._a) this._a.push(reaction);
- if (this._s) notify(this, false);
- return reaction.promise;
- },
- 'catch': function _catch(onRejected) {
- return this.then(undefined, onRejected);
- }
- });
- OwnPromiseCapability = function OwnPromiseCapability() {
- var promise = new Internal();
- this.promise = promise;
- this.resolve = ctx($resolve, promise, 1);
- this.reject = ctx($reject, promise, 1);
- };
- newPromiseCapabilityModule.f = newPromiseCapability = function newPromiseCapability(C) {
- return C === $Promise || C === Wrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C);
- };
-}
-$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise });
-__w_pdfjs_require__(71)($Promise, PROMISE);
-__w_pdfjs_require__(91)(PROMISE);
-Wrapper = __w_pdfjs_require__(10)[PROMISE];
-$export($export.S + $export.F * !USE_NATIVE, PROMISE, {
- reject: function reject(r) {
- var capability = newPromiseCapability(this);
- var $$reject = capability.reject;
- $$reject(r);
- return capability.promise;
- }
-});
-$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
- resolve: function resolve(x) {
- return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);
- }
-});
-$export($export.S + $export.F * !(USE_NATIVE && __w_pdfjs_require__(92)(function (iter) {
- $Promise.all(iter)['catch'](empty);
-})), PROMISE, {
- all: function all(iterable) {
- var C = this;
- var capability = newPromiseCapability(C);
- var resolve = capability.resolve;
- var reject = capability.reject;
- var result = perform(function () {
- var values = [];
- var index = 0;
- var remaining = 1;
- forOf(iterable, false, function (promise) {
- var $index = index++;
- var alreadyCalled = false;
- values.push(undefined);
- remaining++;
- C.resolve(promise).then(function (value) {
- if (alreadyCalled) return;
- alreadyCalled = true;
- values[$index] = value;
- --remaining || resolve(values);
- }, reject);
- });
- --remaining || resolve(values);
- });
- if (result.e) reject(result.v);
- return capability.promise;
- },
- race: function race(iterable) {
- var C = this;
- var capability = newPromiseCapability(C);
- var reject = capability.reject;
- var result = perform(function () {
- forOf(iterable, false, function (promise) {
- C.resolve(promise).then(capability.resolve, reject);
- });
- });
- if (result.e) reject(result.v);
- return capability.promise;
- }
-});
-
-/***/ }),
-/* 77 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = function (it, Constructor, name, forbiddenField) {
- if (!(it instanceof Constructor) || forbiddenField !== undefined && forbiddenField in it) {
- throw TypeError(name + ': incorrect invocation!');
- }
- return it;
-};
-
-/***/ }),
-/* 78 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var ctx = __w_pdfjs_require__(24);
-var call = __w_pdfjs_require__(79);
-var isArrayIter = __w_pdfjs_require__(80);
-var anObject = __w_pdfjs_require__(13);
-var toLength = __w_pdfjs_require__(39);
-var getIterFn = __w_pdfjs_require__(81);
-var BREAK = {};
-var RETURN = {};
-var _exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
- var iterFn = ITERATOR ? function () {
- return iterable;
- } : getIterFn(iterable);
- var f = ctx(fn, that, entries ? 2 : 1);
- var index = 0;
- var length, step, iterator, result;
- if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
- if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
- result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
- if (result === BREAK || result === RETURN) return result;
- } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
- result = call(iterator, f, step.value, entries);
- if (result === BREAK || result === RETURN) return result;
- }
-};
-_exports.BREAK = BREAK;
-_exports.RETURN = RETURN;
-
-/***/ }),
-/* 79 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var anObject = __w_pdfjs_require__(13);
-module.exports = function (iterator, fn, value, entries) {
- try {
- return entries ? fn(anObject(value)[0], value[1]) : fn(value);
- } catch (e) {
- var ret = iterator['return'];
- if (ret !== undefined) anObject(ret.call(iterator));
- throw e;
- }
-};
-
-/***/ }),
-/* 80 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var Iterators = __w_pdfjs_require__(66);
-var ITERATOR = __w_pdfjs_require__(29)('iterator');
-var ArrayProto = Array.prototype;
-module.exports = function (it) {
- return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
-};
-
-/***/ }),
-/* 81 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var classof = __w_pdfjs_require__(62);
-var ITERATOR = __w_pdfjs_require__(29)('iterator');
-var Iterators = __w_pdfjs_require__(66);
-module.exports = __w_pdfjs_require__(10).getIteratorMethod = function (it) {
- if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)];
-};
-
-/***/ }),
-/* 82 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var anObject = __w_pdfjs_require__(13);
-var aFunction = __w_pdfjs_require__(25);
-var SPECIES = __w_pdfjs_require__(29)('species');
-module.exports = function (O, D) {
- var C = anObject(O).constructor;
- var S;
- return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
-};
-
-/***/ }),
-/* 83 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var ctx = __w_pdfjs_require__(24);
-var invoke = __w_pdfjs_require__(84);
-var html = __w_pdfjs_require__(70);
-var cel = __w_pdfjs_require__(18);
-var global = __w_pdfjs_require__(9);
-var process = global.process;
-var setTask = global.setImmediate;
-var clearTask = global.clearImmediate;
-var MessageChannel = global.MessageChannel;
-var Dispatch = global.Dispatch;
-var counter = 0;
-var queue = {};
-var ONREADYSTATECHANGE = 'onreadystatechange';
-var defer, channel, port;
-var run = function run() {
- var id = +this;
- if (queue.hasOwnProperty(id)) {
- var fn = queue[id];
- delete queue[id];
- fn();
- }
-};
-var listener = function listener(event) {
- run.call(event.data);
-};
-if (!setTask || !clearTask) {
- setTask = function setImmediate(fn) {
- var args = [];
- var i = 1;
- while (arguments.length > i) {
- args.push(arguments[i++]);
- }queue[++counter] = function () {
- invoke(typeof fn == 'function' ? fn : Function(fn), args);
- };
- defer(counter);
- return counter;
- };
- clearTask = function clearImmediate(id) {
- delete queue[id];
- };
- if (__w_pdfjs_require__(28)(process) == 'process') {
- defer = function defer(id) {
- process.nextTick(ctx(run, id, 1));
- };
- } else if (Dispatch && Dispatch.now) {
- defer = function defer(id) {
- Dispatch.now(ctx(run, id, 1));
- };
- } else if (MessageChannel) {
- channel = new MessageChannel();
- port = channel.port2;
- channel.port1.onmessage = listener;
- defer = ctx(port.postMessage, port, 1);
- } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
- defer = function defer(id) {
- global.postMessage(id + '', '*');
- };
- global.addEventListener('message', listener, false);
- } else if (ONREADYSTATECHANGE in cel('script')) {
- defer = function defer(id) {
- html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {
- html.removeChild(this);
- run.call(id);
- };
- };
- } else {
- defer = function defer(id) {
- setTimeout(ctx(run, id, 1), 0);
- };
- }
-}
-module.exports = {
- set: setTask,
- clear: clearTask
-};
-
-/***/ }),
-/* 84 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = function (fn, args, that) {
- var un = that === undefined;
- switch (args.length) {
- case 0:
- return un ? fn() : fn.call(that);
- case 1:
- return un ? fn(args[0]) : fn.call(that, args[0]);
- case 2:
- return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]);
- case 3:
- return un ? fn(args[0], args[1], args[2]) : fn.call(that, args[0], args[1], args[2]);
- case 4:
- return un ? fn(args[0], args[1], args[2], args[3]) : fn.call(that, args[0], args[1], args[2], args[3]);
- }
- return fn.apply(that, args);
-};
-
-/***/ }),
-/* 85 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var global = __w_pdfjs_require__(9);
-var macrotask = __w_pdfjs_require__(83).set;
-var Observer = global.MutationObserver || global.WebKitMutationObserver;
-var process = global.process;
-var Promise = global.Promise;
-var isNode = __w_pdfjs_require__(28)(process) == 'process';
-module.exports = function () {
- var head, last, notify;
- var flush = function flush() {
- var parent, fn;
- if (isNode && (parent = process.domain)) parent.exit();
- while (head) {
- fn = head.fn;
- head = head.next;
- try {
- fn();
- } catch (e) {
- if (head) notify();else last = undefined;
- throw e;
- }
- }
- last = undefined;
- if (parent) parent.enter();
- };
- if (isNode) {
- notify = function notify() {
- process.nextTick(flush);
- };
- } else if (Observer && !(global.navigator && global.navigator.standalone)) {
- var toggle = true;
- var node = document.createTextNode('');
- new Observer(flush).observe(node, { characterData: true });
- notify = function notify() {
- node.data = toggle = !toggle;
- };
- } else if (Promise && Promise.resolve) {
- var promise = Promise.resolve(undefined);
- notify = function notify() {
- promise.then(flush);
- };
- } else {
- notify = function notify() {
- macrotask.call(global, flush);
- };
- }
- return function (fn) {
- var task = {
- fn: fn,
- next: undefined
- };
- if (last) last.next = task;
- if (!head) {
- head = task;
- notify();
- }
- last = task;
- };
-};
-
-/***/ }),
-/* 86 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var aFunction = __w_pdfjs_require__(25);
-function PromiseCapability(C) {
- var resolve, reject;
- this.promise = new C(function ($$resolve, $$reject) {
- if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
- resolve = $$resolve;
- reject = $$reject;
- });
- this.resolve = aFunction(resolve);
- this.reject = aFunction(reject);
-}
-module.exports.f = function (C) {
- return new PromiseCapability(C);
-};
-
-/***/ }),
-/* 87 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = function (exec) {
- try {
- return {
- e: false,
- v: exec()
- };
- } catch (e) {
- return {
- e: true,
- v: e
- };
- }
-};
-
-/***/ }),
-/* 88 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var global = __w_pdfjs_require__(9);
-var navigator = global.navigator;
-module.exports = navigator && navigator.userAgent || '';
-
-/***/ }),
-/* 89 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var anObject = __w_pdfjs_require__(13);
-var isObject = __w_pdfjs_require__(14);
-var newPromiseCapability = __w_pdfjs_require__(86);
-module.exports = function (C, x) {
- anObject(C);
- if (isObject(x) && x.constructor === C) return x;
- var promiseCapability = newPromiseCapability.f(C);
- var resolve = promiseCapability.resolve;
- resolve(x);
- return promiseCapability.promise;
-};
-
-/***/ }),
-/* 90 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var redefine = __w_pdfjs_require__(21);
-module.exports = function (target, src, safe) {
- for (var key in src) {
- redefine(target, key, src[key], safe);
- }return target;
-};
-
-/***/ }),
-/* 91 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var global = __w_pdfjs_require__(9);
-var dP = __w_pdfjs_require__(12);
-var DESCRIPTORS = __w_pdfjs_require__(16);
-var SPECIES = __w_pdfjs_require__(29)('species');
-module.exports = function (KEY) {
- var C = global[KEY];
- if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
- configurable: true,
- get: function get() {
- return this;
- }
- });
-};
-
-/***/ }),
-/* 92 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var ITERATOR = __w_pdfjs_require__(29)('iterator');
-var SAFE_CLOSING = false;
-try {
- var riter = [7][ITERATOR]();
- riter['return'] = function () {
- SAFE_CLOSING = true;
- };
- Array.from(riter, function () {
- throw 2;
- });
-} catch (e) {}
-module.exports = function (exec, skipClosing) {
- if (!skipClosing && !SAFE_CLOSING) return false;
- var safe = false;
- try {
- var arr = [7];
- var iter = arr[ITERATOR]();
- iter.next = function () {
- return { done: safe = true };
- };
- arr[ITERATOR] = function () {
- return iter;
- };
- exec(arr);
- } catch (e) {}
- return safe;
-};
-
-/***/ }),
-/* 93 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(8);
-var core = __w_pdfjs_require__(10);
-var global = __w_pdfjs_require__(9);
-var speciesConstructor = __w_pdfjs_require__(82);
-var promiseResolve = __w_pdfjs_require__(89);
-$export($export.P + $export.R, 'Promise', {
- 'finally': function _finally(onFinally) {
- var C = speciesConstructor(this, core.Promise || global.Promise);
- var isFunction = typeof onFinally == 'function';
- return this.then(isFunction ? function (x) {
- return promiseResolve(C, onFinally()).then(function () {
- return x;
- });
- } : onFinally, isFunction ? function (e) {
- return promiseResolve(C, onFinally()).then(function () {
- throw e;
- });
- } : onFinally);
- }
-});
-
-/***/ }),
-/* 94 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(8);
-var newPromiseCapability = __w_pdfjs_require__(86);
-var perform = __w_pdfjs_require__(87);
-$export($export.S, 'Promise', {
- 'try': function _try(callbackfn) {
- var promiseCapability = newPromiseCapability.f(this);
- var result = perform(callbackfn);
- (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
- return promiseCapability.promise;
- }
-});
-
-/***/ }),
-/* 95 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(61);
-__w_pdfjs_require__(73);
-__w_pdfjs_require__(96);
-__w_pdfjs_require__(108);
-__w_pdfjs_require__(110);
-module.exports = __w_pdfjs_require__(10).WeakMap;
-
-/***/ }),
-/* 96 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var each = __w_pdfjs_require__(97)(0);
-var redefine = __w_pdfjs_require__(21);
-var meta = __w_pdfjs_require__(101);
-var assign = __w_pdfjs_require__(45);
-var weak = __w_pdfjs_require__(102);
-var isObject = __w_pdfjs_require__(14);
-var fails = __w_pdfjs_require__(17);
-var validate = __w_pdfjs_require__(103);
-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) {
- return function WeakMap() {
- return get(this, arguments.length > 0 ? arguments[0] : undefined);
- };
-};
-var methods = {
- get: function get(key) {
- if (isObject(key)) {
- var data = getWeak(key);
- if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key);
- return data ? data[this._i] : undefined;
- }
- },
- set: function set(key, value) {
- return weak.def(validate(this, WEAK_MAP), key, value);
- }
-};
-var $WeakMap = module.exports = __w_pdfjs_require__(104)(WEAK_MAP, wrapper, methods, weak, true, true);
-if (fails(function () {
- return new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7;
-})) {
- InternalMap = weak.getConstructor(wrapper, WEAK_MAP);
- assign(InternalMap.prototype, methods);
- meta.NEED = true;
- each(['delete', 'has', 'get', 'set'], function (key) {
- var proto = $WeakMap.prototype;
- var method = proto[key];
- redefine(proto, key, function (a, b) {
- if (isObject(a) && !isExtensible(a)) {
- if (!this._f) this._f = new InternalMap();
- var result = this._f[key](a, b);
- return key == 'set' ? this : result;
- }
- return method.call(this, a, b);
- });
- });
-}
-
-/***/ }),
-/* 97 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var ctx = __w_pdfjs_require__(24);
-var IObject = __w_pdfjs_require__(38);
-var toObject = __w_pdfjs_require__(52);
-var toLength = __w_pdfjs_require__(39);
-var asc = __w_pdfjs_require__(98);
-module.exports = function (TYPE, $create) {
- var IS_MAP = TYPE == 1;
- var IS_FILTER = TYPE == 2;
- var IS_SOME = TYPE == 3;
- var IS_EVERY = TYPE == 4;
- var IS_FIND_INDEX = TYPE == 6;
- var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
- var create = $create || asc;
- return function ($this, callbackfn, that) {
- var O = toObject($this);
- var self = IObject(O);
- var f = ctx(callbackfn, that, 3);
- var length = toLength(self.length);
- var index = 0;
- var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
- var val, res;
- for (; length > index; index++) {
- if (NO_HOLES || index in self) {
- val = self[index];
- res = f(val, index, O);
- if (TYPE) {
- if (IS_MAP) result[index] = res;else if (res) switch (TYPE) {
- case 3:
- return true;
- case 5:
- return val;
- case 6:
- return index;
- case 2:
- result.push(val);
- } else if (IS_EVERY) return false;
- }
- }
- }return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
- };
-};
-
-/***/ }),
-/* 98 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var speciesConstructor = __w_pdfjs_require__(99);
-module.exports = function (original, length) {
- return new (speciesConstructor(original))(length);
-};
-
-/***/ }),
-/* 99 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isObject = __w_pdfjs_require__(14);
-var isArray = __w_pdfjs_require__(100);
-var SPECIES = __w_pdfjs_require__(29)('species');
-module.exports = function (original) {
- var C;
- if (isArray(original)) {
- C = original.constructor;
- if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
- if (isObject(C)) {
- C = C[SPECIES];
- if (C === null) C = undefined;
- }
- }
- return C === undefined ? Array : C;
-};
-
-/***/ }),
-/* 100 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var cof = __w_pdfjs_require__(28);
-module.exports = Array.isArray || function isArray(arg) {
- return cof(arg) == 'Array';
-};
-
-/***/ }),
-/* 101 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-var META = __w_pdfjs_require__(23)('meta');
-var isObject = __w_pdfjs_require__(14);
-var has = __w_pdfjs_require__(22);
-var setDesc = __w_pdfjs_require__(12).f;
-var id = 0;
-var isExtensible = Object.isExtensible || function () {
- return true;
-};
-var FREEZE = !__w_pdfjs_require__(17)(function () {
- return isExtensible(Object.preventExtensions({}));
-});
-var setMeta = function setMeta(it) {
- setDesc(it, META, {
- value: {
- i: 'O' + ++id,
- w: {}
- }
- });
-};
-var fastKey = function fastKey(it, create) {
- if (!isObject(it)) return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
- if (!has(it, META)) {
- if (!isExtensible(it)) return 'F';
- if (!create) return 'E';
- setMeta(it);
- }
- return it[META].i;
-};
-var getWeak = function getWeak(it, create) {
- if (!has(it, META)) {
- if (!isExtensible(it)) return true;
- if (!create) return false;
- setMeta(it);
- }
- return it[META].w;
-};
-var onFreeze = function onFreeze(it) {
- if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
- return it;
-};
-var meta = module.exports = {
- KEY: META,
- NEED: false,
- fastKey: fastKey,
- getWeak: getWeak,
- onFreeze: onFreeze
-};
-
-/***/ }),
-/* 102 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var redefineAll = __w_pdfjs_require__(90);
-var getWeak = __w_pdfjs_require__(101).getWeak;
-var anObject = __w_pdfjs_require__(13);
-var isObject = __w_pdfjs_require__(14);
-var anInstance = __w_pdfjs_require__(77);
-var forOf = __w_pdfjs_require__(78);
-var createArrayMethod = __w_pdfjs_require__(97);
-var $has = __w_pdfjs_require__(22);
-var validate = __w_pdfjs_require__(103);
-var arrayFind = createArrayMethod(5);
-var arrayFindIndex = createArrayMethod(6);
-var id = 0;
-var uncaughtFrozenStore = function uncaughtFrozenStore(that) {
- return that._l || (that._l = new UncaughtFrozenStore());
-};
-var UncaughtFrozenStore = function UncaughtFrozenStore() {
- this.a = [];
-};
-var findUncaughtFrozen = function findUncaughtFrozen(store, key) {
- return arrayFind(store.a, function (it) {
- return it[0] === key;
- });
-};
-UncaughtFrozenStore.prototype = {
- get: function get(key) {
- var entry = findUncaughtFrozen(this, key);
- if (entry) return entry[1];
- },
- has: function has(key) {
- return !!findUncaughtFrozen(this, key);
- },
- set: function set(key, value) {
- var entry = findUncaughtFrozen(this, key);
- if (entry) entry[1] = value;else this.a.push([key, value]);
- },
- 'delete': function _delete(key) {
- var index = arrayFindIndex(this.a, function (it) {
- return it[0] === key;
- });
- if (~index) this.a.splice(index, 1);
- return !!~index;
- }
-};
-module.exports = {
- getConstructor: function getConstructor(wrapper, NAME, IS_MAP, ADDER) {
- var C = wrapper(function (that, iterable) {
- anInstance(that, C, NAME, '_i');
- that._t = NAME;
- that._i = id++;
- that._l = undefined;
- if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
- });
- redefineAll(C.prototype, {
- 'delete': function _delete(key) {
- if (!isObject(key)) return false;
- var data = getWeak(key);
- if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key);
- return data && $has(data, this._i) && delete data[this._i];
- },
- has: function has(key) {
- if (!isObject(key)) return false;
- var data = getWeak(key);
- if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key);
- return data && $has(data, this._i);
- }
- });
- return C;
- },
- def: function def(that, key, value) {
- var data = getWeak(anObject(key), true);
- if (data === true) uncaughtFrozenStore(that).set(key, value);else data[that._i] = value;
- return that;
- },
- ufstore: uncaughtFrozenStore
-};
-
-/***/ }),
-/* 103 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isObject = __w_pdfjs_require__(14);
-module.exports = function (it, TYPE) {
- if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
- return it;
-};
-
-/***/ }),
-/* 104 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var global = __w_pdfjs_require__(9);
-var $export = __w_pdfjs_require__(8);
-var redefine = __w_pdfjs_require__(21);
-var redefineAll = __w_pdfjs_require__(90);
-var meta = __w_pdfjs_require__(101);
-var forOf = __w_pdfjs_require__(78);
-var anInstance = __w_pdfjs_require__(77);
-var isObject = __w_pdfjs_require__(14);
-var fails = __w_pdfjs_require__(17);
-var $iterDetect = __w_pdfjs_require__(92);
-var setToStringTag = __w_pdfjs_require__(71);
-var inheritIfRequired = __w_pdfjs_require__(105);
-module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
- var Base = global[NAME];
- var C = Base;
- var ADDER = IS_MAP ? 'set' : 'add';
- var proto = C && C.prototype;
- var O = {};
- var fixMethod = function fixMethod(KEY) {
- var fn = proto[KEY];
- redefine(proto, KEY, KEY == 'delete' ? function (a) {
- return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
- } : KEY == 'has' ? function has(a) {
- return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
- } : KEY == 'get' ? function get(a) {
- return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a);
- } : KEY == 'add' ? function add(a) {
- fn.call(this, a === 0 ? 0 : a);
- return this;
- } : function set(a, b) {
- fn.call(this, a === 0 ? 0 : a, b);
- return this;
- });
- };
- if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () {
- new C().entries().next();
- }))) {
- C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
- redefineAll(C.prototype, methods);
- meta.NEED = true;
- } else {
- var instance = new C();
- var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
- var THROWS_ON_PRIMITIVES = fails(function () {
- instance.has(1);
- });
- var ACCEPT_ITERABLES = $iterDetect(function (iter) {
- new C(iter);
- });
- var BUGGY_ZERO = !IS_WEAK && fails(function () {
- var $instance = new C();
- var index = 5;
- while (index--) {
- $instance[ADDER](index, index);
- }return !$instance.has(-0);
- });
- if (!ACCEPT_ITERABLES) {
- C = wrapper(function (target, iterable) {
- anInstance(target, C, NAME);
- var that = inheritIfRequired(new Base(), target, C);
- if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
- return that;
- });
- C.prototype = proto;
- proto.constructor = C;
- }
- if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
- fixMethod('delete');
- fixMethod('has');
- IS_MAP && fixMethod('get');
- }
- if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);
- if (IS_WEAK && proto.clear) delete proto.clear;
- }
- setToStringTag(C, NAME);
- O[NAME] = C;
- $export($export.G + $export.W + $export.F * (C != Base), O);
- if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);
- return C;
-};
-
-/***/ }),
-/* 105 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isObject = __w_pdfjs_require__(14);
-var setPrototypeOf = __w_pdfjs_require__(106).set;
-module.exports = function (that, target, C) {
- var S = target.constructor;
- var P;
- if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) {
- setPrototypeOf(that, P);
- }
- return that;
-};
-
-/***/ }),
-/* 106 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isObject = __w_pdfjs_require__(14);
-var anObject = __w_pdfjs_require__(13);
-var check = function check(O, proto) {
- anObject(O);
- if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
-};
-module.exports = {
- set: Object.setPrototypeOf || ('__proto__' in {} ? function (test, buggy, set) {
- try {
- set = __w_pdfjs_require__(24)(Function.call, __w_pdfjs_require__(107).f(Object.prototype, '__proto__').set, 2);
- set(test, []);
- buggy = !(test instanceof Array);
- } catch (e) {
- buggy = true;
- }
- return function setPrototypeOf(O, proto) {
- check(O, proto);
- if (buggy) O.__proto__ = proto;else set(O, proto);
- return O;
- };
- }({}, false) : undefined),
- check: check
-};
-
-/***/ }),
-/* 107 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var pIE = __w_pdfjs_require__(51);
-var createDesc = __w_pdfjs_require__(20);
-var toIObject = __w_pdfjs_require__(37);
-var toPrimitive = __w_pdfjs_require__(19);
-var has = __w_pdfjs_require__(22);
-var IE8_DOM_DEFINE = __w_pdfjs_require__(15);
-var gOPD = Object.getOwnPropertyDescriptor;
-exports.f = __w_pdfjs_require__(16) ? gOPD : function getOwnPropertyDescriptor(O, P) {
- O = toIObject(O);
- P = toPrimitive(P, true);
- if (IE8_DOM_DEFINE) try {
- return gOPD(O, P);
- } catch (e) {}
- if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
-};
-
-/***/ }),
-/* 108 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(109)('WeakMap');
-
-/***/ }),
-/* 109 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(8);
-module.exports = function (COLLECTION) {
- $export($export.S, COLLECTION, {
- of: function of() {
- var length = arguments.length;
- var A = new Array(length);
- while (length--) {
- A[length] = arguments[length];
- }return new this(A);
- }
- });
-};
-
-/***/ }),
-/* 110 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(111)('WeakMap');
-
-/***/ }),
-/* 111 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(8);
-var aFunction = __w_pdfjs_require__(25);
-var ctx = __w_pdfjs_require__(24);
-var forOf = __w_pdfjs_require__(78);
-module.exports = function (COLLECTION) {
- $export($export.S, COLLECTION, {
- from: function from(source) {
- var mapFn = arguments[1];
- var mapping, A, n, cb;
- aFunction(this);
- mapping = mapFn !== undefined;
- if (mapping) aFunction(mapFn);
- if (source == undefined) return new this();
- A = [];
- if (mapping) {
- n = 0;
- cb = ctx(mapFn, arguments[2], 2);
- forOf(source, false, function (nextItem) {
- A.push(cb(nextItem, n++));
- });
- } else {
- forOf(source, false, A.push, A);
- }
- return new this(A);
- }
- });
-};
-
-/***/ }),
-/* 112 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(113);
-module.exports = __w_pdfjs_require__(10).String.codePointAt;
-
-/***/ }),
-/* 113 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(8);
-var $at = __w_pdfjs_require__(64)(false);
-$export($export.P, 'String', {
- codePointAt: function codePointAt(pos) {
- return $at(this, pos);
- }
-});
-
-/***/ }),
-/* 114 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(115);
-module.exports = __w_pdfjs_require__(10).String.fromCodePoint;
-
-/***/ }),
-/* 115 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(8);
-var toAbsoluteIndex = __w_pdfjs_require__(41);
-var fromCharCode = String.fromCharCode;
-var $fromCodePoint = String.fromCodePoint;
-$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
- fromCodePoint: function fromCodePoint(x) {
- var res = [];
- var aLen = arguments.length;
- var i = 0;
- var code;
- while (aLen > i) {
- code = +arguments[i++];
- if (toAbsoluteIndex(code, 0x10ffff) !== code) throw RangeError(code + ' is not a valid code point');
- res.push(code < 0x10000 ? fromCharCode(code) : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00));
- }
- return res.join('');
- }
-});
-
-/***/ }),
-/* 116 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(117);
-__w_pdfjs_require__(61);
-module.exports = __w_pdfjs_require__(10).Symbol;
-
-/***/ }),
-/* 117 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-var global = __w_pdfjs_require__(9);
-var has = __w_pdfjs_require__(22);
-var DESCRIPTORS = __w_pdfjs_require__(16);
-var $export = __w_pdfjs_require__(8);
-var redefine = __w_pdfjs_require__(21);
-var META = __w_pdfjs_require__(101).KEY;
-var $fails = __w_pdfjs_require__(17);
-var shared = __w_pdfjs_require__(30);
-var setToStringTag = __w_pdfjs_require__(71);
-var uid = __w_pdfjs_require__(23);
-var wks = __w_pdfjs_require__(29);
-var wksExt = __w_pdfjs_require__(118);
-var wksDefine = __w_pdfjs_require__(119);
-var enumKeys = __w_pdfjs_require__(120);
-var isArray = __w_pdfjs_require__(100);
-var anObject = __w_pdfjs_require__(13);
-var isObject = __w_pdfjs_require__(14);
-var toIObject = __w_pdfjs_require__(37);
-var toPrimitive = __w_pdfjs_require__(19);
-var createDesc = __w_pdfjs_require__(20);
-var _create = __w_pdfjs_require__(68);
-var gOPNExt = __w_pdfjs_require__(121);
-var $GOPD = __w_pdfjs_require__(107);
-var $DP = __w_pdfjs_require__(12);
-var $keys = __w_pdfjs_require__(46);
-var gOPD = $GOPD.f;
-var dP = $DP.f;
-var gOPN = gOPNExt.f;
-var $Symbol = global.Symbol;
-var $JSON = global.JSON;
-var _stringify = $JSON && $JSON.stringify;
-var PROTOTYPE = 'prototype';
-var HIDDEN = wks('_hidden');
-var TO_PRIMITIVE = wks('toPrimitive');
-var isEnum = {}.propertyIsEnumerable;
-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 QObject = global.QObject;
-var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
-var setSymbolDesc = DESCRIPTORS && $fails(function () {
- return _create(dP({}, 'a', {
- get: function get() {
- return dP(this, 'a', { value: 7 }).a;
- }
- })).a != 7;
-}) ? function (it, key, D) {
- var protoDesc = gOPD(ObjectProto, key);
- if (protoDesc) delete ObjectProto[key];
- dP(it, key, D);
- if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
-} : dP;
-var wrap = function wrap(tag) {
- var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
- sym._k = tag;
- return sym;
-};
-var isSymbol = USE_NATIVE && _typeof($Symbol.iterator) == 'symbol' ? function (it) {
- return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) == 'symbol';
-} : function (it) {
- return it instanceof $Symbol;
-};
-var $defineProperty = function defineProperty(it, key, D) {
- if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
- anObject(it);
- key = toPrimitive(key, true);
- anObject(D);
- if (has(AllSymbols, key)) {
- if (!D.enumerable) {
- if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
- it[HIDDEN][key] = true;
- } else {
- if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
- D = _create(D, { enumerable: createDesc(0, false) });
- }
- return setSymbolDesc(it, key, D);
- }
- return dP(it, key, D);
-};
-var $defineProperties = function defineProperties(it, P) {
- anObject(it);
- var keys = enumKeys(P = toIObject(P));
- var i = 0;
- var l = keys.length;
- var key;
- while (l > i) {
- $defineProperty(it, key = keys[i++], P[key]);
- }return it;
-};
-var $create = function create(it, P) {
- return P === undefined ? _create(it) : $defineProperties(_create(it), P);
-};
-var $propertyIsEnumerable = function propertyIsEnumerable(key) {
- var E = isEnum.call(this, key = toPrimitive(key, true));
- if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
- return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
-};
-var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
- it = toIObject(it);
- key = toPrimitive(key, true);
- if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
- var D = gOPD(it, key);
- if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
- return D;
-};
-var $getOwnPropertyNames = function getOwnPropertyNames(it) {
- var names = gOPN(toIObject(it));
- var result = [];
- var i = 0;
- var key;
- while (names.length > i) {
- if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
- }
- return result;
-};
-var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
- var IS_OP = it === ObjectProto;
- var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
- var result = [];
- var i = 0;
- var key;
- while (names.length > i) {
- if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
- }
- return result;
-};
-if (!USE_NATIVE) {
- $Symbol = function _Symbol() {
- if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
- var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
- var $set = function $set(value) {
- if (this === ObjectProto) $set.call(OPSymbols, value);
- if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
- setSymbolDesc(this, tag, createDesc(1, value));
- };
- if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, {
- configurable: true,
- set: $set
- });
- return wrap(tag);
- };
- redefine($Symbol[PROTOTYPE], 'toString', function toString() {
- return this._k;
- });
- $GOPD.f = $getOwnPropertyDescriptor;
- $DP.f = $defineProperty;
- __w_pdfjs_require__(122).f = gOPNExt.f = $getOwnPropertyNames;
- __w_pdfjs_require__(51).f = $propertyIsEnumerable;
- __w_pdfjs_require__(50).f = $getOwnPropertySymbols;
- if (DESCRIPTORS && !__w_pdfjs_require__(31)) {
- redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
- }
- wksExt.f = function (name) {
- return wrap(wks(name));
- };
-}
-$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });
-for (var es6Symbols = 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'.split(','), j = 0; es6Symbols.length > j;) {
- wks(es6Symbols[j++]);
-}for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) {
- wksDefine(wellKnownSymbols[k++]);
-}$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
- 'for': function _for(key) {
- return has(SymbolRegistry, key += '') ? SymbolRegistry[key] : SymbolRegistry[key] = $Symbol(key);
- },
- keyFor: function keyFor(sym) {
- if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
- for (var key in SymbolRegistry) {
- if (SymbolRegistry[key] === sym) return key;
- }
- },
- useSetter: function useSetter() {
- setter = true;
- },
- useSimple: function useSimple() {
- setter = false;
- }
-});
-$export($export.S + $export.F * !USE_NATIVE, 'Object', {
- create: $create,
- defineProperty: $defineProperty,
- defineProperties: $defineProperties,
- getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
- getOwnPropertyNames: $getOwnPropertyNames,
- getOwnPropertySymbols: $getOwnPropertySymbols
-});
-$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
- var S = $Symbol();
- return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
-})), 'JSON', {
- stringify: function stringify(it) {
- var args = [it];
- var i = 1;
- var replacer, $replacer;
- while (arguments.length > i) {
- args.push(arguments[i++]);
- }$replacer = replacer = args[1];
- if (!isObject(replacer) && it === undefined || isSymbol(it)) return;
- if (!isArray(replacer)) replacer = function replacer(key, value) {
- if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
- if (!isSymbol(value)) return value;
- };
- args[1] = replacer;
- return _stringify.apply($JSON, args);
- }
-});
-$Symbol[PROTOTYPE][TO_PRIMITIVE] || __w_pdfjs_require__(11)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
-setToStringTag($Symbol, 'Symbol');
-setToStringTag(Math, 'Math', true);
-setToStringTag(global.JSON, 'JSON', true);
-
-/***/ }),
-/* 118 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-exports.f = __w_pdfjs_require__(29);
-
-/***/ }),
-/* 119 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var global = __w_pdfjs_require__(9);
-var core = __w_pdfjs_require__(10);
-var LIBRARY = __w_pdfjs_require__(31);
-var wksExt = __w_pdfjs_require__(118);
-var defineProperty = __w_pdfjs_require__(12).f;
-module.exports = function (name) {
- var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
- if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });
-};
-
-/***/ }),
-/* 120 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var getKeys = __w_pdfjs_require__(46);
-var gOPS = __w_pdfjs_require__(50);
-var pIE = __w_pdfjs_require__(51);
-module.exports = function (it) {
- var result = getKeys(it);
- var getSymbols = gOPS.f;
- if (getSymbols) {
- var symbols = getSymbols(it);
- var isEnum = pIE.f;
- var i = 0;
- var key;
- while (symbols.length > i) {
- if (isEnum.call(it, key = symbols[i++])) result.push(key);
- }
- }
- return result;
-};
-
-/***/ }),
-/* 121 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-var toIObject = __w_pdfjs_require__(37);
-var gOPN = __w_pdfjs_require__(122).f;
-var toString = {}.toString;
-var windowNames = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
-var getWindowNames = function getWindowNames(it) {
- try {
- return gOPN(it);
- } catch (e) {
- return windowNames.slice();
- }
-};
-module.exports.f = function getOwnPropertyNames(it) {
- return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
-};
-
-/***/ }),
-/* 122 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $keys = __w_pdfjs_require__(47);
-var hiddenKeys = __w_pdfjs_require__(49).concat('length', 'prototype');
-exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
- return $keys(O, hiddenKeys);
-};
-
-/***/ }),
-/* 123 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-__w_pdfjs_require__(124);
-module.exports = __w_pdfjs_require__(10).Object.values;
-
-/***/ }),
-/* 124 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var $export = __w_pdfjs_require__(8);
-var $values = __w_pdfjs_require__(125)(false);
-$export($export.S, 'Object', {
- values: function values(it) {
- return $values(it);
- }
-});
-
-/***/ }),
-/* 125 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var getKeys = __w_pdfjs_require__(46);
-var toIObject = __w_pdfjs_require__(37);
-var isEnum = __w_pdfjs_require__(51).f;
-module.exports = function (isEntries) {
- return function (it) {
- var O = toIObject(it);
- var keys = getKeys(O);
- var length = keys.length;
- var i = 0;
- var result = [];
- var key;
- while (length > i) {
- if (isEnum.call(O, key = keys[i++])) {
- result.push(isEntries ? [key, O[key]] : O[key]);
- }
- }return result;
- };
-};
-
-/***/ }),
-/* 126 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var isReadableStreamSupported = false;
-if (typeof ReadableStream !== 'undefined') {
- try {
- new ReadableStream({
- start: function start(controller) {
- controller.close();
- }
- });
- isReadableStreamSupported = true;
- } catch (e) {}
-}
-if (isReadableStreamSupported) {
- exports.ReadableStream = ReadableStream;
-} else {
- exports.ReadableStream = __w_pdfjs_require__(127).ReadableStream;
-}
-
-/***/ }),
-/* 127 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-(function (e, a) {
- for (var i in a) {
- e[i] = a[i];
- }
-})(exports, function (modules) {
- var installedModules = {};
- function __w_pdfjs_require__(moduleId) {
- if (installedModules[moduleId]) return installedModules[moduleId].exports;
- var module = installedModules[moduleId] = {
- i: moduleId,
- l: false,
- exports: {}
- };
- modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);
- module.l = true;
- return module.exports;
- }
- __w_pdfjs_require__.m = modules;
- __w_pdfjs_require__.c = installedModules;
- __w_pdfjs_require__.i = function (value) {
- return value;
- };
- __w_pdfjs_require__.d = function (exports, name, getter) {
- if (!__w_pdfjs_require__.o(exports, name)) {
- Object.defineProperty(exports, name, {
- configurable: false,
- enumerable: true,
- get: getter
- });
- }
- };
- __w_pdfjs_require__.n = function (module) {
- var getter = module && module.__esModule ? function getDefault() {
- return module['default'];
- } : function getModuleExports() {
- return module;
- };
- __w_pdfjs_require__.d(getter, 'a', getter);
- return getter;
- };
- __w_pdfjs_require__.o = function (object, property) {
- return Object.prototype.hasOwnProperty.call(object, property);
- };
- __w_pdfjs_require__.p = "";
- return __w_pdfjs_require__(__w_pdfjs_require__.s = 7);
-}([function (module, exports, __w_pdfjs_require__) {
- "use strict";
-
- var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
- return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
- } : function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
- };
- var _require = __w_pdfjs_require__(1),
- assert = _require.assert;
- function IsPropertyKey(argument) {
- return typeof argument === 'string' || (typeof argument === 'undefined' ? 'undefined' : _typeof(argument)) === 'symbol';
- }
- exports.typeIsObject = function (x) {
- return (typeof x === 'undefined' ? 'undefined' : _typeof(x)) === 'object' && x !== null || typeof x === 'function';
- };
- exports.createDataProperty = function (o, p, v) {
- assert(exports.typeIsObject(o));
- Object.defineProperty(o, p, {
- value: v,
- writable: true,
- enumerable: true,
- configurable: true
- });
- };
- exports.createArrayFromList = function (elements) {
- return elements.slice();
- };
- exports.ArrayBufferCopy = function (dest, destOffset, src, srcOffset, n) {
- new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);
- };
- exports.CreateIterResultObject = function (value, done) {
- assert(typeof done === 'boolean');
- var obj = {};
- Object.defineProperty(obj, 'value', {
- value: value,
- enumerable: true,
- writable: true,
- configurable: true
- });
- Object.defineProperty(obj, 'done', {
- value: done,
- enumerable: true,
- writable: true,
- configurable: true
- });
- return obj;
- };
- exports.IsFiniteNonNegativeNumber = function (v) {
- if (Number.isNaN(v)) {
- return false;
- }
- if (v === Infinity) {
- return false;
- }
- if (v < 0) {
- return false;
- }
- return true;
- };
- function Call(F, V, args) {
- if (typeof F !== 'function') {
- throw new TypeError('Argument is not a function');
- }
- return Function.prototype.apply.call(F, V, args);
- }
- exports.InvokeOrNoop = function (O, P, args) {
- assert(O !== undefined);
- assert(IsPropertyKey(P));
- assert(Array.isArray(args));
- var method = O[P];
- if (method === undefined) {
- return undefined;
- }
- return Call(method, O, args);
- };
- exports.PromiseInvokeOrNoop = function (O, P, args) {
- assert(O !== undefined);
- assert(IsPropertyKey(P));
- assert(Array.isArray(args));
- try {
- return Promise.resolve(exports.InvokeOrNoop(O, P, args));
- } catch (returnValueE) {
- return Promise.reject(returnValueE);
- }
- };
- exports.PromiseInvokeOrPerformFallback = function (O, P, args, F, argsF) {
- assert(O !== undefined);
- assert(IsPropertyKey(P));
- assert(Array.isArray(args));
- assert(Array.isArray(argsF));
- var method = void 0;
- try {
- method = O[P];
- } catch (methodE) {
- return Promise.reject(methodE);
- }
- if (method === undefined) {
- return F.apply(null, argsF);
- }
- try {
- return Promise.resolve(Call(method, O, args));
- } catch (e) {
- return Promise.reject(e);
- }
- };
- exports.TransferArrayBuffer = function (O) {
- return O.slice();
- };
- exports.ValidateAndNormalizeHighWaterMark = function (highWaterMark) {
- highWaterMark = Number(highWaterMark);
- if (Number.isNaN(highWaterMark) || highWaterMark < 0) {
- throw new RangeError('highWaterMark property of a queuing strategy must be non-negative and non-NaN');
- }
- return highWaterMark;
- };
- exports.ValidateAndNormalizeQueuingStrategy = function (size, highWaterMark) {
- if (size !== undefined && typeof size !== 'function') {
- throw new TypeError('size property of a queuing strategy must be a function');
- }
- highWaterMark = exports.ValidateAndNormalizeHighWaterMark(highWaterMark);
- return {
- size: size,
- highWaterMark: highWaterMark
- };
- };
-}, function (module, exports, __w_pdfjs_require__) {
- "use strict";
-
- function rethrowAssertionErrorRejection(e) {
- if (e && e.constructor === AssertionError) {
- setTimeout(function () {
- throw e;
- }, 0);
- }
- }
- function AssertionError(message) {
- this.name = 'AssertionError';
- this.message = message || '';
- this.stack = new Error().stack;
- }
- AssertionError.prototype = Object.create(Error.prototype);
- AssertionError.prototype.constructor = AssertionError;
- function assert(value, message) {
- if (!value) {
- throw new AssertionError(message);
- }
- }
- module.exports = {
- rethrowAssertionErrorRejection: rethrowAssertionErrorRejection,
- AssertionError: AssertionError,
- assert: assert
- };
-}, function (module, exports, __w_pdfjs_require__) {
- "use strict";
-
- var _createClass = 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);
- }
- }
- return function (Constructor, protoProps, staticProps) {
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
- if (staticProps) defineProperties(Constructor, staticProps);
- return Constructor;
- };
- }();
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- var _require = __w_pdfjs_require__(0),
- InvokeOrNoop = _require.InvokeOrNoop,
- PromiseInvokeOrNoop = _require.PromiseInvokeOrNoop,
- ValidateAndNormalizeQueuingStrategy = _require.ValidateAndNormalizeQueuingStrategy,
- typeIsObject = _require.typeIsObject;
- var _require2 = __w_pdfjs_require__(1),
- assert = _require2.assert,
- rethrowAssertionErrorRejection = _require2.rethrowAssertionErrorRejection;
- var _require3 = __w_pdfjs_require__(3),
- DequeueValue = _require3.DequeueValue,
- EnqueueValueWithSize = _require3.EnqueueValueWithSize,
- PeekQueueValue = _require3.PeekQueueValue,
- ResetQueue = _require3.ResetQueue;
- var WritableStream = function () {
- function WritableStream() {
- var underlyingSink = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- size = _ref.size,
- _ref$highWaterMark = _ref.highWaterMark,
- highWaterMark = _ref$highWaterMark === undefined ? 1 : _ref$highWaterMark;
- _classCallCheck(this, WritableStream);
- this._state = 'writable';
- this._storedError = undefined;
- this._writer = undefined;
- this._writableStreamController = undefined;
- this._writeRequests = [];
- this._inFlightWriteRequest = undefined;
- this._closeRequest = undefined;
- this._inFlightCloseRequest = undefined;
- this._pendingAbortRequest = undefined;
- this._backpressure = false;
- var type = underlyingSink.type;
- if (type !== undefined) {
- throw new RangeError('Invalid type is specified');
- }
- this._writableStreamController = new WritableStreamDefaultController(this, underlyingSink, size, highWaterMark);
- this._writableStreamController.__startSteps();
- }
- _createClass(WritableStream, [{
- key: 'abort',
- value: function abort(reason) {
- if (IsWritableStream(this) === false) {
- return Promise.reject(streamBrandCheckException('abort'));
- }
- if (IsWritableStreamLocked(this) === true) {
- return Promise.reject(new TypeError('Cannot abort a stream that already has a writer'));
- }
- return WritableStreamAbort(this, reason);
- }
- }, {
- key: 'getWriter',
- value: function getWriter() {
- if (IsWritableStream(this) === false) {
- throw streamBrandCheckException('getWriter');
- }
- return AcquireWritableStreamDefaultWriter(this);
- }
- }, {
- key: 'locked',
- get: function get() {
- if (IsWritableStream(this) === false) {
- throw streamBrandCheckException('locked');
- }
- return IsWritableStreamLocked(this);
- }
- }]);
- return WritableStream;
- }();
- module.exports = {
- AcquireWritableStreamDefaultWriter: AcquireWritableStreamDefaultWriter,
- IsWritableStream: IsWritableStream,
- IsWritableStreamLocked: IsWritableStreamLocked,
- WritableStream: WritableStream,
- WritableStreamAbort: WritableStreamAbort,
- WritableStreamDefaultControllerError: WritableStreamDefaultControllerError,
- WritableStreamDefaultWriterCloseWithErrorPropagation: WritableStreamDefaultWriterCloseWithErrorPropagation,
- WritableStreamDefaultWriterRelease: WritableStreamDefaultWriterRelease,
- WritableStreamDefaultWriterWrite: WritableStreamDefaultWriterWrite,
- WritableStreamCloseQueuedOrInFlight: WritableStreamCloseQueuedOrInFlight
- };
- function AcquireWritableStreamDefaultWriter(stream) {
- return new WritableStreamDefaultWriter(stream);
- }
- function IsWritableStream(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_writableStreamController')) {
- return false;
- }
- return true;
- }
- function IsWritableStreamLocked(stream) {
- assert(IsWritableStream(stream) === true, 'IsWritableStreamLocked should only be used on known writable streams');
- if (stream._writer === undefined) {
- return false;
- }
- return true;
- }
- function WritableStreamAbort(stream, reason) {
- var state = stream._state;
- if (state === 'closed') {
- return Promise.resolve(undefined);
- }
- if (state === 'errored') {
- return Promise.reject(stream._storedError);
- }
- var error = new TypeError('Requested to abort');
- if (stream._pendingAbortRequest !== undefined) {
- return Promise.reject(error);
- }
- assert(state === 'writable' || state === 'erroring', 'state must be writable or erroring');
- var wasAlreadyErroring = false;
- if (state === 'erroring') {
- wasAlreadyErroring = true;
- reason = undefined;
- }
- var promise = new Promise(function (resolve, reject) {
- stream._pendingAbortRequest = {
- _resolve: resolve,
- _reject: reject,
- _reason: reason,
- _wasAlreadyErroring: wasAlreadyErroring
- };
- });
- if (wasAlreadyErroring === false) {
- WritableStreamStartErroring(stream, error);
- }
- return promise;
- }
- function WritableStreamAddWriteRequest(stream) {
- assert(IsWritableStreamLocked(stream) === true);
- assert(stream._state === 'writable');
- var promise = new Promise(function (resolve, reject) {
- var writeRequest = {
- _resolve: resolve,
- _reject: reject
- };
- stream._writeRequests.push(writeRequest);
- });
- return promise;
- }
- function WritableStreamDealWithRejection(stream, error) {
- var state = stream._state;
- if (state === 'writable') {
- WritableStreamStartErroring(stream, error);
- return;
- }
- assert(state === 'erroring');
- WritableStreamFinishErroring(stream);
- }
- function WritableStreamStartErroring(stream, reason) {
- assert(stream._storedError === undefined, 'stream._storedError === undefined');
- assert(stream._state === 'writable', 'state must be writable');
- var controller = stream._writableStreamController;
- assert(controller !== undefined, 'controller must not be undefined');
- stream._state = 'erroring';
- stream._storedError = reason;
- var writer = stream._writer;
- if (writer !== undefined) {
- WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason);
- }
- if (WritableStreamHasOperationMarkedInFlight(stream) === false && controller._started === true) {
- WritableStreamFinishErroring(stream);
- }
- }
- function WritableStreamFinishErroring(stream) {
- assert(stream._state === 'erroring', 'stream._state === erroring');
- assert(WritableStreamHasOperationMarkedInFlight(stream) === false, 'WritableStreamHasOperationMarkedInFlight(stream) === false');
- stream._state = 'errored';
- stream._writableStreamController.__errorSteps();
- var storedError = stream._storedError;
- for (var i = 0; i < stream._writeRequests.length; i++) {
- var writeRequest = stream._writeRequests[i];
- writeRequest._reject(storedError);
- }
- stream._writeRequests = [];
- if (stream._pendingAbortRequest === undefined) {
- WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
- return;
- }
- var abortRequest = stream._pendingAbortRequest;
- stream._pendingAbortRequest = undefined;
- if (abortRequest._wasAlreadyErroring === true) {
- abortRequest._reject(storedError);
- WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
- return;
- }
- var promise = stream._writableStreamController.__abortSteps(abortRequest._reason);
- promise.then(function () {
- abortRequest._resolve();
- WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
- }, function (reason) {
- abortRequest._reject(reason);
- WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
- });
- }
- function WritableStreamFinishInFlightWrite(stream) {
- assert(stream._inFlightWriteRequest !== undefined);
- stream._inFlightWriteRequest._resolve(undefined);
- stream._inFlightWriteRequest = undefined;
- }
- function WritableStreamFinishInFlightWriteWithError(stream, error) {
- assert(stream._inFlightWriteRequest !== undefined);
- stream._inFlightWriteRequest._reject(error);
- stream._inFlightWriteRequest = undefined;
- assert(stream._state === 'writable' || stream._state === 'erroring');
- WritableStreamDealWithRejection(stream, error);
- }
- function WritableStreamFinishInFlightClose(stream) {
- assert(stream._inFlightCloseRequest !== undefined);
- stream._inFlightCloseRequest._resolve(undefined);
- stream._inFlightCloseRequest = undefined;
- var state = stream._state;
- assert(state === 'writable' || state === 'erroring');
- if (state === 'erroring') {
- stream._storedError = undefined;
- if (stream._pendingAbortRequest !== undefined) {
- stream._pendingAbortRequest._resolve();
- stream._pendingAbortRequest = undefined;
- }
- }
- stream._state = 'closed';
- var writer = stream._writer;
- if (writer !== undefined) {
- defaultWriterClosedPromiseResolve(writer);
- }
- assert(stream._pendingAbortRequest === undefined, 'stream._pendingAbortRequest === undefined');
- assert(stream._storedError === undefined, 'stream._storedError === undefined');
- }
- function WritableStreamFinishInFlightCloseWithError(stream, error) {
- assert(stream._inFlightCloseRequest !== undefined);
- stream._inFlightCloseRequest._reject(error);
- stream._inFlightCloseRequest = undefined;
- assert(stream._state === 'writable' || stream._state === 'erroring');
- if (stream._pendingAbortRequest !== undefined) {
- stream._pendingAbortRequest._reject(error);
- stream._pendingAbortRequest = undefined;
- }
- WritableStreamDealWithRejection(stream, error);
- }
- function WritableStreamCloseQueuedOrInFlight(stream) {
- if (stream._closeRequest === undefined && stream._inFlightCloseRequest === undefined) {
- return false;
- }
- return true;
- }
- function WritableStreamHasOperationMarkedInFlight(stream) {
- if (stream._inFlightWriteRequest === undefined && stream._inFlightCloseRequest === undefined) {
- return false;
- }
- return true;
- }
- function WritableStreamMarkCloseRequestInFlight(stream) {
- assert(stream._inFlightCloseRequest === undefined);
- assert(stream._closeRequest !== undefined);
- stream._inFlightCloseRequest = stream._closeRequest;
- stream._closeRequest = undefined;
- }
- function WritableStreamMarkFirstWriteRequestInFlight(stream) {
- assert(stream._inFlightWriteRequest === undefined, 'there must be no pending write request');
- assert(stream._writeRequests.length !== 0, 'writeRequests must not be empty');
- stream._inFlightWriteRequest = stream._writeRequests.shift();
- }
- function WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream) {
- assert(stream._state === 'errored', '_stream_.[[state]] is `"errored"`');
- if (stream._closeRequest !== undefined) {
- assert(stream._inFlightCloseRequest === undefined);
- stream._closeRequest._reject(stream._storedError);
- stream._closeRequest = undefined;
- }
- var writer = stream._writer;
- if (writer !== undefined) {
- defaultWriterClosedPromiseReject(writer, stream._storedError);
- writer._closedPromise.catch(function () {});
- }
- }
- function WritableStreamUpdateBackpressure(stream, backpressure) {
- assert(stream._state === 'writable');
- assert(WritableStreamCloseQueuedOrInFlight(stream) === false);
- var writer = stream._writer;
- if (writer !== undefined && backpressure !== stream._backpressure) {
- if (backpressure === true) {
- defaultWriterReadyPromiseReset(writer);
- } else {
- assert(backpressure === false);
- defaultWriterReadyPromiseResolve(writer);
- }
- }
- stream._backpressure = backpressure;
- }
- var WritableStreamDefaultWriter = function () {
- function WritableStreamDefaultWriter(stream) {
- _classCallCheck(this, WritableStreamDefaultWriter);
- if (IsWritableStream(stream) === false) {
- throw new TypeError('WritableStreamDefaultWriter can only be constructed with a WritableStream instance');
- }
- if (IsWritableStreamLocked(stream) === true) {
- throw new TypeError('This stream has already been locked for exclusive writing by another writer');
- }
- this._ownerWritableStream = stream;
- stream._writer = this;
- var state = stream._state;
- if (state === 'writable') {
- if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._backpressure === true) {
- defaultWriterReadyPromiseInitialize(this);
- } else {
- defaultWriterReadyPromiseInitializeAsResolved(this);
- }
- defaultWriterClosedPromiseInitialize(this);
- } else if (state === 'erroring') {
- defaultWriterReadyPromiseInitializeAsRejected(this, stream._storedError);
- this._readyPromise.catch(function () {});
- defaultWriterClosedPromiseInitialize(this);
- } else if (state === 'closed') {
- defaultWriterReadyPromiseInitializeAsResolved(this);
- defaultWriterClosedPromiseInitializeAsResolved(this);
- } else {
- assert(state === 'errored', 'state must be errored');
- var storedError = stream._storedError;
- defaultWriterReadyPromiseInitializeAsRejected(this, storedError);
- this._readyPromise.catch(function () {});
- defaultWriterClosedPromiseInitializeAsRejected(this, storedError);
- this._closedPromise.catch(function () {});
- }
- }
- _createClass(WritableStreamDefaultWriter, [{
- key: 'abort',
- value: function abort(reason) {
- if (IsWritableStreamDefaultWriter(this) === false) {
- return Promise.reject(defaultWriterBrandCheckException('abort'));
- }
- if (this._ownerWritableStream === undefined) {
- return Promise.reject(defaultWriterLockException('abort'));
- }
- return WritableStreamDefaultWriterAbort(this, reason);
- }
- }, {
- key: 'close',
- value: function close() {
- if (IsWritableStreamDefaultWriter(this) === false) {
- return Promise.reject(defaultWriterBrandCheckException('close'));
- }
- var stream = this._ownerWritableStream;
- if (stream === undefined) {
- return Promise.reject(defaultWriterLockException('close'));
- }
- if (WritableStreamCloseQueuedOrInFlight(stream) === true) {
- return Promise.reject(new TypeError('cannot close an already-closing stream'));
- }
- return WritableStreamDefaultWriterClose(this);
- }
- }, {
- key: 'releaseLock',
- value: function releaseLock() {
- if (IsWritableStreamDefaultWriter(this) === false) {
- throw defaultWriterBrandCheckException('releaseLock');
- }
- var stream = this._ownerWritableStream;
- if (stream === undefined) {
- return;
- }
- assert(stream._writer !== undefined);
- WritableStreamDefaultWriterRelease(this);
- }
- }, {
- key: 'write',
- value: function write(chunk) {
- if (IsWritableStreamDefaultWriter(this) === false) {
- return Promise.reject(defaultWriterBrandCheckException('write'));
- }
- if (this._ownerWritableStream === undefined) {
- return Promise.reject(defaultWriterLockException('write to'));
- }
- return WritableStreamDefaultWriterWrite(this, chunk);
- }
- }, {
- key: 'closed',
- get: function get() {
- if (IsWritableStreamDefaultWriter(this) === false) {
- return Promise.reject(defaultWriterBrandCheckException('closed'));
- }
- return this._closedPromise;
- }
- }, {
- key: 'desiredSize',
- get: function get() {
- if (IsWritableStreamDefaultWriter(this) === false) {
- throw defaultWriterBrandCheckException('desiredSize');
- }
- if (this._ownerWritableStream === undefined) {
- throw defaultWriterLockException('desiredSize');
- }
- return WritableStreamDefaultWriterGetDesiredSize(this);
- }
- }, {
- key: 'ready',
- get: function get() {
- if (IsWritableStreamDefaultWriter(this) === false) {
- return Promise.reject(defaultWriterBrandCheckException('ready'));
- }
- return this._readyPromise;
- }
- }]);
- return WritableStreamDefaultWriter;
- }();
- function IsWritableStreamDefaultWriter(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_ownerWritableStream')) {
- return false;
- }
- return true;
- }
- function WritableStreamDefaultWriterAbort(writer, reason) {
- var stream = writer._ownerWritableStream;
- assert(stream !== undefined);
- return WritableStreamAbort(stream, reason);
- }
- function WritableStreamDefaultWriterClose(writer) {
- var stream = writer._ownerWritableStream;
- assert(stream !== undefined);
- var state = stream._state;
- if (state === 'closed' || state === 'errored') {
- return Promise.reject(new TypeError('The stream (in ' + state + ' state) is not in the writable state and cannot be closed'));
- }
- assert(state === 'writable' || state === 'erroring');
- assert(WritableStreamCloseQueuedOrInFlight(stream) === false);
- var promise = new Promise(function (resolve, reject) {
- var closeRequest = {
- _resolve: resolve,
- _reject: reject
- };
- stream._closeRequest = closeRequest;
- });
- if (stream._backpressure === true && state === 'writable') {
- defaultWriterReadyPromiseResolve(writer);
- }
- WritableStreamDefaultControllerClose(stream._writableStreamController);
- return promise;
- }
- function WritableStreamDefaultWriterCloseWithErrorPropagation(writer) {
- var stream = writer._ownerWritableStream;
- assert(stream !== undefined);
- var state = stream._state;
- if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === 'closed') {
- return Promise.resolve();
- }
- if (state === 'errored') {
- return Promise.reject(stream._storedError);
- }
- assert(state === 'writable' || state === 'erroring');
- return WritableStreamDefaultWriterClose(writer);
- }
- function WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, error) {
- if (writer._closedPromiseState === 'pending') {
- defaultWriterClosedPromiseReject(writer, error);
- } else {
- defaultWriterClosedPromiseResetToRejected(writer, error);
- }
- writer._closedPromise.catch(function () {});
- }
- function WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, error) {
- if (writer._readyPromiseState === 'pending') {
- defaultWriterReadyPromiseReject(writer, error);
- } else {
- defaultWriterReadyPromiseResetToRejected(writer, error);
- }
- writer._readyPromise.catch(function () {});
- }
- function WritableStreamDefaultWriterGetDesiredSize(writer) {
- var stream = writer._ownerWritableStream;
- var state = stream._state;
- if (state === 'errored' || state === 'erroring') {
- return null;
- }
- if (state === 'closed') {
- return 0;
- }
- return WritableStreamDefaultControllerGetDesiredSize(stream._writableStreamController);
- }
- function WritableStreamDefaultWriterRelease(writer) {
- var stream = writer._ownerWritableStream;
- assert(stream !== undefined);
- assert(stream._writer === writer);
- var releasedError = new TypeError('Writer was released and can no longer be used to monitor the stream\'s closedness');
- WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, releasedError);
- WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, releasedError);
- stream._writer = undefined;
- writer._ownerWritableStream = undefined;
- }
- function WritableStreamDefaultWriterWrite(writer, chunk) {
- var stream = writer._ownerWritableStream;
- assert(stream !== undefined);
- var controller = stream._writableStreamController;
- var chunkSize = WritableStreamDefaultControllerGetChunkSize(controller, chunk);
- if (stream !== writer._ownerWritableStream) {
- return Promise.reject(defaultWriterLockException('write to'));
- }
- var state = stream._state;
- if (state === 'errored') {
- return Promise.reject(stream._storedError);
- }
- if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === 'closed') {
- return Promise.reject(new TypeError('The stream is closing or closed and cannot be written to'));
- }
- if (state === 'erroring') {
- return Promise.reject(stream._storedError);
- }
- assert(state === 'writable');
- var promise = WritableStreamAddWriteRequest(stream);
- WritableStreamDefaultControllerWrite(controller, chunk, chunkSize);
- return promise;
- }
- var WritableStreamDefaultController = function () {
- function WritableStreamDefaultController(stream, underlyingSink, size, highWaterMark) {
- _classCallCheck(this, WritableStreamDefaultController);
- if (IsWritableStream(stream) === false) {
- throw new TypeError('WritableStreamDefaultController can only be constructed with a WritableStream instance');
- }
- if (stream._writableStreamController !== undefined) {
- throw new TypeError('WritableStreamDefaultController instances can only be created by the WritableStream constructor');
- }
- this._controlledWritableStream = stream;
- this._underlyingSink = underlyingSink;
- this._queue = undefined;
- this._queueTotalSize = undefined;
- ResetQueue(this);
- this._started = false;
- var normalizedStrategy = ValidateAndNormalizeQueuingStrategy(size, highWaterMark);
- this._strategySize = normalizedStrategy.size;
- this._strategyHWM = normalizedStrategy.highWaterMark;
- var backpressure = WritableStreamDefaultControllerGetBackpressure(this);
- WritableStreamUpdateBackpressure(stream, backpressure);
- }
- _createClass(WritableStreamDefaultController, [{
- key: 'error',
- value: function error(e) {
- if (IsWritableStreamDefaultController(this) === false) {
- throw new TypeError('WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController');
- }
- var state = this._controlledWritableStream._state;
- if (state !== 'writable') {
- return;
- }
- WritableStreamDefaultControllerError(this, e);
- }
- }, {
- key: '__abortSteps',
- value: function __abortSteps(reason) {
- return PromiseInvokeOrNoop(this._underlyingSink, 'abort', [reason]);
- }
- }, {
- key: '__errorSteps',
- value: function __errorSteps() {
- ResetQueue(this);
- }
- }, {
- key: '__startSteps',
- value: function __startSteps() {
- var _this = this;
- var startResult = InvokeOrNoop(this._underlyingSink, 'start', [this]);
- var stream = this._controlledWritableStream;
- Promise.resolve(startResult).then(function () {
- assert(stream._state === 'writable' || stream._state === 'erroring');
- _this._started = true;
- WritableStreamDefaultControllerAdvanceQueueIfNeeded(_this);
- }, function (r) {
- assert(stream._state === 'writable' || stream._state === 'erroring');
- _this._started = true;
- WritableStreamDealWithRejection(stream, r);
- }).catch(rethrowAssertionErrorRejection);
- }
- }]);
- return WritableStreamDefaultController;
- }();
- function WritableStreamDefaultControllerClose(controller) {
- EnqueueValueWithSize(controller, 'close', 0);
- WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
- }
- function WritableStreamDefaultControllerGetChunkSize(controller, chunk) {
- var strategySize = controller._strategySize;
- if (strategySize === undefined) {
- return 1;
- }
- try {
- return strategySize(chunk);
- } catch (chunkSizeE) {
- WritableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE);
- return 1;
- }
- }
- function WritableStreamDefaultControllerGetDesiredSize(controller) {
- return controller._strategyHWM - controller._queueTotalSize;
- }
- function WritableStreamDefaultControllerWrite(controller, chunk, chunkSize) {
- var writeRecord = { chunk: chunk };
- try {
- EnqueueValueWithSize(controller, writeRecord, chunkSize);
- } catch (enqueueE) {
- WritableStreamDefaultControllerErrorIfNeeded(controller, enqueueE);
- return;
- }
- var stream = controller._controlledWritableStream;
- if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._state === 'writable') {
- var backpressure = WritableStreamDefaultControllerGetBackpressure(controller);
- WritableStreamUpdateBackpressure(stream, backpressure);
- }
- WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
- }
- function IsWritableStreamDefaultController(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_underlyingSink')) {
- return false;
- }
- return true;
- }
- function WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller) {
- var stream = controller._controlledWritableStream;
- if (controller._started === false) {
- return;
- }
- if (stream._inFlightWriteRequest !== undefined) {
- return;
- }
- var state = stream._state;
- if (state === 'closed' || state === 'errored') {
- return;
- }
- if (state === 'erroring') {
- WritableStreamFinishErroring(stream);
- return;
- }
- if (controller._queue.length === 0) {
- return;
- }
- var writeRecord = PeekQueueValue(controller);
- if (writeRecord === 'close') {
- WritableStreamDefaultControllerProcessClose(controller);
- } else {
- WritableStreamDefaultControllerProcessWrite(controller, writeRecord.chunk);
- }
- }
- function WritableStreamDefaultControllerErrorIfNeeded(controller, error) {
- if (controller._controlledWritableStream._state === 'writable') {
- WritableStreamDefaultControllerError(controller, error);
- }
- }
- function WritableStreamDefaultControllerProcessClose(controller) {
- var stream = controller._controlledWritableStream;
- WritableStreamMarkCloseRequestInFlight(stream);
- DequeueValue(controller);
- assert(controller._queue.length === 0, 'queue must be empty once the final write record is dequeued');
- var sinkClosePromise = PromiseInvokeOrNoop(controller._underlyingSink, 'close', []);
- sinkClosePromise.then(function () {
- WritableStreamFinishInFlightClose(stream);
- }, function (reason) {
- WritableStreamFinishInFlightCloseWithError(stream, reason);
- }).catch(rethrowAssertionErrorRejection);
- }
- function WritableStreamDefaultControllerProcessWrite(controller, chunk) {
- var stream = controller._controlledWritableStream;
- WritableStreamMarkFirstWriteRequestInFlight(stream);
- var sinkWritePromise = PromiseInvokeOrNoop(controller._underlyingSink, 'write', [chunk, controller]);
- sinkWritePromise.then(function () {
- WritableStreamFinishInFlightWrite(stream);
- var state = stream._state;
- assert(state === 'writable' || state === 'erroring');
- DequeueValue(controller);
- if (WritableStreamCloseQueuedOrInFlight(stream) === false && state === 'writable') {
- var backpressure = WritableStreamDefaultControllerGetBackpressure(controller);
- WritableStreamUpdateBackpressure(stream, backpressure);
- }
- WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
- }, function (reason) {
- WritableStreamFinishInFlightWriteWithError(stream, reason);
- }).catch(rethrowAssertionErrorRejection);
- }
- function WritableStreamDefaultControllerGetBackpressure(controller) {
- var desiredSize = WritableStreamDefaultControllerGetDesiredSize(controller);
- return desiredSize <= 0;
- }
- function WritableStreamDefaultControllerError(controller, error) {
- var stream = controller._controlledWritableStream;
- assert(stream._state === 'writable');
- WritableStreamStartErroring(stream, error);
- }
- function streamBrandCheckException(name) {
- return new TypeError('WritableStream.prototype.' + name + ' can only be used on a WritableStream');
- }
- function defaultWriterBrandCheckException(name) {
- return new TypeError('WritableStreamDefaultWriter.prototype.' + name + ' can only be used on a WritableStreamDefaultWriter');
- }
- function defaultWriterLockException(name) {
- return new TypeError('Cannot ' + name + ' a stream using a released writer');
- }
- function defaultWriterClosedPromiseInitialize(writer) {
- writer._closedPromise = new Promise(function (resolve, reject) {
- writer._closedPromise_resolve = resolve;
- writer._closedPromise_reject = reject;
- writer._closedPromiseState = 'pending';
- });
- }
- function defaultWriterClosedPromiseInitializeAsRejected(writer, reason) {
- writer._closedPromise = Promise.reject(reason);
- writer._closedPromise_resolve = undefined;
- writer._closedPromise_reject = undefined;
- writer._closedPromiseState = 'rejected';
- }
- function defaultWriterClosedPromiseInitializeAsResolved(writer) {
- writer._closedPromise = Promise.resolve(undefined);
- writer._closedPromise_resolve = undefined;
- writer._closedPromise_reject = undefined;
- writer._closedPromiseState = 'resolved';
- }
- function defaultWriterClosedPromiseReject(writer, reason) {
- assert(writer._closedPromise_resolve !== undefined, 'writer._closedPromise_resolve !== undefined');
- assert(writer._closedPromise_reject !== undefined, 'writer._closedPromise_reject !== undefined');
- assert(writer._closedPromiseState === 'pending', 'writer._closedPromiseState is pending');
- writer._closedPromise_reject(reason);
- writer._closedPromise_resolve = undefined;
- writer._closedPromise_reject = undefined;
- writer._closedPromiseState = 'rejected';
- }
- function defaultWriterClosedPromiseResetToRejected(writer, reason) {
- assert(writer._closedPromise_resolve === undefined, 'writer._closedPromise_resolve === undefined');
- assert(writer._closedPromise_reject === undefined, 'writer._closedPromise_reject === undefined');
- assert(writer._closedPromiseState !== 'pending', 'writer._closedPromiseState is not pending');
- writer._closedPromise = Promise.reject(reason);
- writer._closedPromiseState = 'rejected';
- }
- function defaultWriterClosedPromiseResolve(writer) {
- assert(writer._closedPromise_resolve !== undefined, 'writer._closedPromise_resolve !== undefined');
- assert(writer._closedPromise_reject !== undefined, 'writer._closedPromise_reject !== undefined');
- assert(writer._closedPromiseState === 'pending', 'writer._closedPromiseState is pending');
- writer._closedPromise_resolve(undefined);
- writer._closedPromise_resolve = undefined;
- writer._closedPromise_reject = undefined;
- writer._closedPromiseState = 'resolved';
- }
- function defaultWriterReadyPromiseInitialize(writer) {
- writer._readyPromise = new Promise(function (resolve, reject) {
- writer._readyPromise_resolve = resolve;
- writer._readyPromise_reject = reject;
- });
- writer._readyPromiseState = 'pending';
- }
- function defaultWriterReadyPromiseInitializeAsRejected(writer, reason) {
- writer._readyPromise = Promise.reject(reason);
- writer._readyPromise_resolve = undefined;
- writer._readyPromise_reject = undefined;
- writer._readyPromiseState = 'rejected';
- }
- function defaultWriterReadyPromiseInitializeAsResolved(writer) {
- writer._readyPromise = Promise.resolve(undefined);
- writer._readyPromise_resolve = undefined;
- writer._readyPromise_reject = undefined;
- writer._readyPromiseState = 'fulfilled';
- }
- function defaultWriterReadyPromiseReject(writer, reason) {
- assert(writer._readyPromise_resolve !== undefined, 'writer._readyPromise_resolve !== undefined');
- assert(writer._readyPromise_reject !== undefined, 'writer._readyPromise_reject !== undefined');
- writer._readyPromise_reject(reason);
- writer._readyPromise_resolve = undefined;
- writer._readyPromise_reject = undefined;
- writer._readyPromiseState = 'rejected';
- }
- function defaultWriterReadyPromiseReset(writer) {
- assert(writer._readyPromise_resolve === undefined, 'writer._readyPromise_resolve === undefined');
- assert(writer._readyPromise_reject === undefined, 'writer._readyPromise_reject === undefined');
- writer._readyPromise = new Promise(function (resolve, reject) {
- writer._readyPromise_resolve = resolve;
- writer._readyPromise_reject = reject;
- });
- writer._readyPromiseState = 'pending';
- }
- function defaultWriterReadyPromiseResetToRejected(writer, reason) {
- assert(writer._readyPromise_resolve === undefined, 'writer._readyPromise_resolve === undefined');
- assert(writer._readyPromise_reject === undefined, 'writer._readyPromise_reject === undefined');
- writer._readyPromise = Promise.reject(reason);
- writer._readyPromiseState = 'rejected';
- }
- function defaultWriterReadyPromiseResolve(writer) {
- assert(writer._readyPromise_resolve !== undefined, 'writer._readyPromise_resolve !== undefined');
- assert(writer._readyPromise_reject !== undefined, 'writer._readyPromise_reject !== undefined');
- writer._readyPromise_resolve(undefined);
- writer._readyPromise_resolve = undefined;
- writer._readyPromise_reject = undefined;
- writer._readyPromiseState = 'fulfilled';
- }
-}, function (module, exports, __w_pdfjs_require__) {
- "use strict";
-
- var _require = __w_pdfjs_require__(0),
- IsFiniteNonNegativeNumber = _require.IsFiniteNonNegativeNumber;
- var _require2 = __w_pdfjs_require__(1),
- assert = _require2.assert;
- exports.DequeueValue = function (container) {
- assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: DequeueValue should only be used on containers with [[queue]] and [[queueTotalSize]].');
- assert(container._queue.length > 0, 'Spec-level failure: should never dequeue from an empty queue.');
- var pair = container._queue.shift();
- container._queueTotalSize -= pair.size;
- if (container._queueTotalSize < 0) {
- container._queueTotalSize = 0;
- }
- return pair.value;
- };
- exports.EnqueueValueWithSize = function (container, value, size) {
- assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: EnqueueValueWithSize should only be used on containers with [[queue]] and ' + '[[queueTotalSize]].');
- size = Number(size);
- if (!IsFiniteNonNegativeNumber(size)) {
- throw new RangeError('Size must be a finite, non-NaN, non-negative number.');
- }
- container._queue.push({
- value: value,
- size: size
- });
- container._queueTotalSize += size;
- };
- exports.PeekQueueValue = function (container) {
- assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: PeekQueueValue should only be used on containers with [[queue]] and [[queueTotalSize]].');
- assert(container._queue.length > 0, 'Spec-level failure: should never peek at an empty queue.');
- var pair = container._queue[0];
- return pair.value;
- };
- exports.ResetQueue = function (container) {
- assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: ResetQueue should only be used on containers with [[queue]] and [[queueTotalSize]].');
- container._queue = [];
- container._queueTotalSize = 0;
- };
-}, function (module, exports, __w_pdfjs_require__) {
- "use strict";
-
- var _createClass = 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);
- }
- }
- return function (Constructor, protoProps, staticProps) {
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
- if (staticProps) defineProperties(Constructor, staticProps);
- return Constructor;
- };
- }();
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- var _require = __w_pdfjs_require__(0),
- ArrayBufferCopy = _require.ArrayBufferCopy,
- CreateIterResultObject = _require.CreateIterResultObject,
- IsFiniteNonNegativeNumber = _require.IsFiniteNonNegativeNumber,
- InvokeOrNoop = _require.InvokeOrNoop,
- PromiseInvokeOrNoop = _require.PromiseInvokeOrNoop,
- TransferArrayBuffer = _require.TransferArrayBuffer,
- ValidateAndNormalizeQueuingStrategy = _require.ValidateAndNormalizeQueuingStrategy,
- ValidateAndNormalizeHighWaterMark = _require.ValidateAndNormalizeHighWaterMark;
- var _require2 = __w_pdfjs_require__(0),
- createArrayFromList = _require2.createArrayFromList,
- createDataProperty = _require2.createDataProperty,
- typeIsObject = _require2.typeIsObject;
- var _require3 = __w_pdfjs_require__(1),
- assert = _require3.assert,
- rethrowAssertionErrorRejection = _require3.rethrowAssertionErrorRejection;
- var _require4 = __w_pdfjs_require__(3),
- DequeueValue = _require4.DequeueValue,
- EnqueueValueWithSize = _require4.EnqueueValueWithSize,
- ResetQueue = _require4.ResetQueue;
- var _require5 = __w_pdfjs_require__(2),
- AcquireWritableStreamDefaultWriter = _require5.AcquireWritableStreamDefaultWriter,
- IsWritableStream = _require5.IsWritableStream,
- IsWritableStreamLocked = _require5.IsWritableStreamLocked,
- WritableStreamAbort = _require5.WritableStreamAbort,
- WritableStreamDefaultWriterCloseWithErrorPropagation = _require5.WritableStreamDefaultWriterCloseWithErrorPropagation,
- WritableStreamDefaultWriterRelease = _require5.WritableStreamDefaultWriterRelease,
- WritableStreamDefaultWriterWrite = _require5.WritableStreamDefaultWriterWrite,
- WritableStreamCloseQueuedOrInFlight = _require5.WritableStreamCloseQueuedOrInFlight;
- var ReadableStream = function () {
- function ReadableStream() {
- var underlyingSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- size = _ref.size,
- highWaterMark = _ref.highWaterMark;
- _classCallCheck(this, ReadableStream);
- this._state = 'readable';
- this._reader = undefined;
- this._storedError = undefined;
- this._disturbed = false;
- this._readableStreamController = undefined;
- var type = underlyingSource.type;
- var typeString = String(type);
- if (typeString === 'bytes') {
- if (highWaterMark === undefined) {
- highWaterMark = 0;
- }
- this._readableStreamController = new ReadableByteStreamController(this, underlyingSource, highWaterMark);
- } else if (type === undefined) {
- if (highWaterMark === undefined) {
- highWaterMark = 1;
- }
- this._readableStreamController = new ReadableStreamDefaultController(this, underlyingSource, size, highWaterMark);
- } else {
- throw new RangeError('Invalid type is specified');
- }
- }
- _createClass(ReadableStream, [{
- key: 'cancel',
- value: function cancel(reason) {
- if (IsReadableStream(this) === false) {
- return Promise.reject(streamBrandCheckException('cancel'));
- }
- if (IsReadableStreamLocked(this) === true) {
- return Promise.reject(new TypeError('Cannot cancel a stream that already has a reader'));
- }
- return ReadableStreamCancel(this, reason);
- }
- }, {
- key: 'getReader',
- value: function getReader() {
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- mode = _ref2.mode;
- if (IsReadableStream(this) === false) {
- throw streamBrandCheckException('getReader');
- }
- if (mode === undefined) {
- return AcquireReadableStreamDefaultReader(this);
- }
- mode = String(mode);
- if (mode === 'byob') {
- return AcquireReadableStreamBYOBReader(this);
- }
- throw new RangeError('Invalid mode is specified');
- }
- }, {
- key: 'pipeThrough',
- value: function pipeThrough(_ref3, options) {
- var writable = _ref3.writable,
- readable = _ref3.readable;
- var promise = this.pipeTo(writable, options);
- ifIsObjectAndHasAPromiseIsHandledInternalSlotSetPromiseIsHandledToTrue(promise);
- return readable;
- }
- }, {
- key: 'pipeTo',
- value: function pipeTo(dest) {
- var _this = this;
- var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- preventClose = _ref4.preventClose,
- preventAbort = _ref4.preventAbort,
- preventCancel = _ref4.preventCancel;
- if (IsReadableStream(this) === false) {
- return Promise.reject(streamBrandCheckException('pipeTo'));
- }
- if (IsWritableStream(dest) === false) {
- return Promise.reject(new TypeError('ReadableStream.prototype.pipeTo\'s first argument must be a WritableStream'));
- }
- preventClose = Boolean(preventClose);
- preventAbort = Boolean(preventAbort);
- preventCancel = Boolean(preventCancel);
- if (IsReadableStreamLocked(this) === true) {
- return Promise.reject(new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream'));
- }
- if (IsWritableStreamLocked(dest) === true) {
- return Promise.reject(new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream'));
- }
- var reader = AcquireReadableStreamDefaultReader(this);
- var writer = AcquireWritableStreamDefaultWriter(dest);
- var shuttingDown = false;
- var currentWrite = Promise.resolve();
- return new Promise(function (resolve, reject) {
- function pipeLoop() {
- currentWrite = Promise.resolve();
- if (shuttingDown === true) {
- return Promise.resolve();
- }
- return writer._readyPromise.then(function () {
- return ReadableStreamDefaultReaderRead(reader).then(function (_ref5) {
- var value = _ref5.value,
- done = _ref5.done;
- if (done === true) {
- return;
- }
- currentWrite = WritableStreamDefaultWriterWrite(writer, value).catch(function () {});
- });
- }).then(pipeLoop);
- }
- isOrBecomesErrored(_this, reader._closedPromise, function (storedError) {
- if (preventAbort === false) {
- shutdownWithAction(function () {
- return WritableStreamAbort(dest, storedError);
- }, true, storedError);
- } else {
- shutdown(true, storedError);
- }
- });
- isOrBecomesErrored(dest, writer._closedPromise, function (storedError) {
- if (preventCancel === false) {
- shutdownWithAction(function () {
- return ReadableStreamCancel(_this, storedError);
- }, true, storedError);
- } else {
- shutdown(true, storedError);
- }
- });
- isOrBecomesClosed(_this, reader._closedPromise, function () {
- if (preventClose === false) {
- shutdownWithAction(function () {
- return WritableStreamDefaultWriterCloseWithErrorPropagation(writer);
- });
- } else {
- shutdown();
- }
- });
- if (WritableStreamCloseQueuedOrInFlight(dest) === true || dest._state === 'closed') {
- var destClosed = new TypeError('the destination writable stream closed before all data could be piped to it');
- if (preventCancel === false) {
- shutdownWithAction(function () {
- return ReadableStreamCancel(_this, destClosed);
- }, true, destClosed);
- } else {
- shutdown(true, destClosed);
- }
- }
- pipeLoop().catch(function (err) {
- currentWrite = Promise.resolve();
- rethrowAssertionErrorRejection(err);
- });
- function waitForWritesToFinish() {
- var oldCurrentWrite = currentWrite;
- return currentWrite.then(function () {
- return oldCurrentWrite !== currentWrite ? waitForWritesToFinish() : undefined;
- });
- }
- function isOrBecomesErrored(stream, promise, action) {
- if (stream._state === 'errored') {
- action(stream._storedError);
- } else {
- promise.catch(action).catch(rethrowAssertionErrorRejection);
- }
- }
- function isOrBecomesClosed(stream, promise, action) {
- if (stream._state === 'closed') {
- action();
- } else {
- promise.then(action).catch(rethrowAssertionErrorRejection);
- }
- }
- function shutdownWithAction(action, originalIsError, originalError) {
- if (shuttingDown === true) {
- return;
- }
- shuttingDown = true;
- if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) {
- waitForWritesToFinish().then(doTheRest);
- } else {
- doTheRest();
- }
- function doTheRest() {
- action().then(function () {
- return finalize(originalIsError, originalError);
- }, function (newError) {
- return finalize(true, newError);
- }).catch(rethrowAssertionErrorRejection);
- }
- }
- function shutdown(isError, error) {
- if (shuttingDown === true) {
- return;
- }
- shuttingDown = true;
- if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) {
- waitForWritesToFinish().then(function () {
- return finalize(isError, error);
- }).catch(rethrowAssertionErrorRejection);
- } else {
- finalize(isError, error);
- }
- }
- function finalize(isError, error) {
- WritableStreamDefaultWriterRelease(writer);
- ReadableStreamReaderGenericRelease(reader);
- if (isError) {
- reject(error);
- } else {
- resolve(undefined);
- }
- }
- });
- }
- }, {
- key: 'tee',
- value: function tee() {
- if (IsReadableStream(this) === false) {
- throw streamBrandCheckException('tee');
- }
- var branches = ReadableStreamTee(this, false);
- return createArrayFromList(branches);
- }
- }, {
- key: 'locked',
- get: function get() {
- if (IsReadableStream(this) === false) {
- throw streamBrandCheckException('locked');
- }
- return IsReadableStreamLocked(this);
- }
- }]);
- return ReadableStream;
- }();
- module.exports = {
- ReadableStream: ReadableStream,
- IsReadableStreamDisturbed: IsReadableStreamDisturbed,
- ReadableStreamDefaultControllerClose: ReadableStreamDefaultControllerClose,
- ReadableStreamDefaultControllerEnqueue: ReadableStreamDefaultControllerEnqueue,
- ReadableStreamDefaultControllerError: ReadableStreamDefaultControllerError,
- ReadableStreamDefaultControllerGetDesiredSize: ReadableStreamDefaultControllerGetDesiredSize
- };
- function AcquireReadableStreamBYOBReader(stream) {
- return new ReadableStreamBYOBReader(stream);
- }
- function AcquireReadableStreamDefaultReader(stream) {
- return new ReadableStreamDefaultReader(stream);
- }
- function IsReadableStream(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_readableStreamController')) {
- return false;
- }
- return true;
- }
- function IsReadableStreamDisturbed(stream) {
- assert(IsReadableStream(stream) === true, 'IsReadableStreamDisturbed should only be used on known readable streams');
- return stream._disturbed;
- }
- function IsReadableStreamLocked(stream) {
- assert(IsReadableStream(stream) === true, 'IsReadableStreamLocked should only be used on known readable streams');
- if (stream._reader === undefined) {
- return false;
- }
- return true;
- }
- function ReadableStreamTee(stream, cloneForBranch2) {
- assert(IsReadableStream(stream) === true);
- assert(typeof cloneForBranch2 === 'boolean');
- var reader = AcquireReadableStreamDefaultReader(stream);
- var teeState = {
- closedOrErrored: false,
- canceled1: false,
- canceled2: false,
- reason1: undefined,
- reason2: undefined
- };
- teeState.promise = new Promise(function (resolve) {
- teeState._resolve = resolve;
- });
- var pull = create_ReadableStreamTeePullFunction();
- pull._reader = reader;
- pull._teeState = teeState;
- pull._cloneForBranch2 = cloneForBranch2;
- var cancel1 = create_ReadableStreamTeeBranch1CancelFunction();
- cancel1._stream = stream;
- cancel1._teeState = teeState;
- var cancel2 = create_ReadableStreamTeeBranch2CancelFunction();
- cancel2._stream = stream;
- cancel2._teeState = teeState;
- var underlyingSource1 = Object.create(Object.prototype);
- createDataProperty(underlyingSource1, 'pull', pull);
- createDataProperty(underlyingSource1, 'cancel', cancel1);
- var branch1Stream = new ReadableStream(underlyingSource1);
- var underlyingSource2 = Object.create(Object.prototype);
- createDataProperty(underlyingSource2, 'pull', pull);
- createDataProperty(underlyingSource2, 'cancel', cancel2);
- var branch2Stream = new ReadableStream(underlyingSource2);
- pull._branch1 = branch1Stream._readableStreamController;
- pull._branch2 = branch2Stream._readableStreamController;
- reader._closedPromise.catch(function (r) {
- if (teeState.closedOrErrored === true) {
- return;
- }
- ReadableStreamDefaultControllerError(pull._branch1, r);
- ReadableStreamDefaultControllerError(pull._branch2, r);
- teeState.closedOrErrored = true;
- });
- return [branch1Stream, branch2Stream];
- }
- function create_ReadableStreamTeePullFunction() {
- function f() {
- var reader = f._reader,
- branch1 = f._branch1,
- branch2 = f._branch2,
- teeState = f._teeState;
- return ReadableStreamDefaultReaderRead(reader).then(function (result) {
- assert(typeIsObject(result));
- var value = result.value;
- var done = result.done;
- assert(typeof done === 'boolean');
- if (done === true && teeState.closedOrErrored === false) {
- if (teeState.canceled1 === false) {
- ReadableStreamDefaultControllerClose(branch1);
- }
- if (teeState.canceled2 === false) {
- ReadableStreamDefaultControllerClose(branch2);
- }
- teeState.closedOrErrored = true;
- }
- if (teeState.closedOrErrored === true) {
- return;
- }
- var value1 = value;
- var value2 = value;
- if (teeState.canceled1 === false) {
- ReadableStreamDefaultControllerEnqueue(branch1, value1);
- }
- if (teeState.canceled2 === false) {
- ReadableStreamDefaultControllerEnqueue(branch2, value2);
- }
- });
- }
- return f;
- }
- function create_ReadableStreamTeeBranch1CancelFunction() {
- function f(reason) {
- var stream = f._stream,
- teeState = f._teeState;
- teeState.canceled1 = true;
- teeState.reason1 = reason;
- if (teeState.canceled2 === true) {
- var compositeReason = createArrayFromList([teeState.reason1, teeState.reason2]);
- var cancelResult = ReadableStreamCancel(stream, compositeReason);
- teeState._resolve(cancelResult);
- }
- return teeState.promise;
- }
- return f;
- }
- function create_ReadableStreamTeeBranch2CancelFunction() {
- function f(reason) {
- var stream = f._stream,
- teeState = f._teeState;
- teeState.canceled2 = true;
- teeState.reason2 = reason;
- if (teeState.canceled1 === true) {
- var compositeReason = createArrayFromList([teeState.reason1, teeState.reason2]);
- var cancelResult = ReadableStreamCancel(stream, compositeReason);
- teeState._resolve(cancelResult);
- }
- return teeState.promise;
- }
- return f;
- }
- function ReadableStreamAddReadIntoRequest(stream) {
- assert(IsReadableStreamBYOBReader(stream._reader) === true);
- assert(stream._state === 'readable' || stream._state === 'closed');
- var promise = new Promise(function (resolve, reject) {
- var readIntoRequest = {
- _resolve: resolve,
- _reject: reject
- };
- stream._reader._readIntoRequests.push(readIntoRequest);
- });
- return promise;
- }
- function ReadableStreamAddReadRequest(stream) {
- assert(IsReadableStreamDefaultReader(stream._reader) === true);
- assert(stream._state === 'readable');
- var promise = new Promise(function (resolve, reject) {
- var readRequest = {
- _resolve: resolve,
- _reject: reject
- };
- stream._reader._readRequests.push(readRequest);
- });
- return promise;
- }
- function ReadableStreamCancel(stream, reason) {
- stream._disturbed = true;
- if (stream._state === 'closed') {
- return Promise.resolve(undefined);
- }
- if (stream._state === 'errored') {
- return Promise.reject(stream._storedError);
- }
- ReadableStreamClose(stream);
- var sourceCancelPromise = stream._readableStreamController.__cancelSteps(reason);
- return sourceCancelPromise.then(function () {
- return undefined;
- });
- }
- function ReadableStreamClose(stream) {
- assert(stream._state === 'readable');
- stream._state = 'closed';
- var reader = stream._reader;
- if (reader === undefined) {
- return undefined;
- }
- if (IsReadableStreamDefaultReader(reader) === true) {
- for (var i = 0; i < reader._readRequests.length; i++) {
- var _resolve = reader._readRequests[i]._resolve;
- _resolve(CreateIterResultObject(undefined, true));
- }
- reader._readRequests = [];
- }
- defaultReaderClosedPromiseResolve(reader);
- return undefined;
- }
- function ReadableStreamError(stream, e) {
- assert(IsReadableStream(stream) === true, 'stream must be ReadableStream');
- assert(stream._state === 'readable', 'state must be readable');
- stream._state = 'errored';
- stream._storedError = e;
- var reader = stream._reader;
- if (reader === undefined) {
- return undefined;
- }
- if (IsReadableStreamDefaultReader(reader) === true) {
- for (var i = 0; i < reader._readRequests.length; i++) {
- var readRequest = reader._readRequests[i];
- readRequest._reject(e);
- }
- reader._readRequests = [];
- } else {
- assert(IsReadableStreamBYOBReader(reader), 'reader must be ReadableStreamBYOBReader');
- for (var _i = 0; _i < reader._readIntoRequests.length; _i++) {
- var readIntoRequest = reader._readIntoRequests[_i];
- readIntoRequest._reject(e);
- }
- reader._readIntoRequests = [];
- }
- defaultReaderClosedPromiseReject(reader, e);
- reader._closedPromise.catch(function () {});
- }
- function ReadableStreamFulfillReadIntoRequest(stream, chunk, done) {
- var reader = stream._reader;
- assert(reader._readIntoRequests.length > 0);
- var readIntoRequest = reader._readIntoRequests.shift();
- readIntoRequest._resolve(CreateIterResultObject(chunk, done));
- }
- function ReadableStreamFulfillReadRequest(stream, chunk, done) {
- var reader = stream._reader;
- assert(reader._readRequests.length > 0);
- var readRequest = reader._readRequests.shift();
- readRequest._resolve(CreateIterResultObject(chunk, done));
- }
- function ReadableStreamGetNumReadIntoRequests(stream) {
- return stream._reader._readIntoRequests.length;
- }
- function ReadableStreamGetNumReadRequests(stream) {
- return stream._reader._readRequests.length;
- }
- function ReadableStreamHasBYOBReader(stream) {
- var reader = stream._reader;
- if (reader === undefined) {
- return false;
- }
- if (IsReadableStreamBYOBReader(reader) === false) {
- return false;
- }
- return true;
- }
- function ReadableStreamHasDefaultReader(stream) {
- var reader = stream._reader;
- if (reader === undefined) {
- return false;
- }
- if (IsReadableStreamDefaultReader(reader) === false) {
- return false;
- }
- return true;
- }
- var ReadableStreamDefaultReader = function () {
- function ReadableStreamDefaultReader(stream) {
- _classCallCheck(this, ReadableStreamDefaultReader);
- if (IsReadableStream(stream) === false) {
- throw new TypeError('ReadableStreamDefaultReader can only be constructed with a ReadableStream instance');
- }
- if (IsReadableStreamLocked(stream) === true) {
- throw new TypeError('This stream has already been locked for exclusive reading by another reader');
- }
- ReadableStreamReaderGenericInitialize(this, stream);
- this._readRequests = [];
- }
- _createClass(ReadableStreamDefaultReader, [{
- key: 'cancel',
- value: function cancel(reason) {
- if (IsReadableStreamDefaultReader(this) === false) {
- return Promise.reject(defaultReaderBrandCheckException('cancel'));
- }
- if (this._ownerReadableStream === undefined) {
- return Promise.reject(readerLockException('cancel'));
- }
- return ReadableStreamReaderGenericCancel(this, reason);
- }
- }, {
- key: 'read',
- value: function read() {
- if (IsReadableStreamDefaultReader(this) === false) {
- return Promise.reject(defaultReaderBrandCheckException('read'));
- }
- if (this._ownerReadableStream === undefined) {
- return Promise.reject(readerLockException('read from'));
- }
- return ReadableStreamDefaultReaderRead(this);
- }
- }, {
- key: 'releaseLock',
- value: function releaseLock() {
- if (IsReadableStreamDefaultReader(this) === false) {
- throw defaultReaderBrandCheckException('releaseLock');
- }
- if (this._ownerReadableStream === undefined) {
- return;
- }
- if (this._readRequests.length > 0) {
- throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled');
- }
- ReadableStreamReaderGenericRelease(this);
- }
- }, {
- key: 'closed',
- get: function get() {
- if (IsReadableStreamDefaultReader(this) === false) {
- return Promise.reject(defaultReaderBrandCheckException('closed'));
- }
- return this._closedPromise;
- }
- }]);
- return ReadableStreamDefaultReader;
- }();
- var ReadableStreamBYOBReader = function () {
- function ReadableStreamBYOBReader(stream) {
- _classCallCheck(this, ReadableStreamBYOBReader);
- if (!IsReadableStream(stream)) {
- throw new TypeError('ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a ' + 'byte source');
- }
- if (IsReadableByteStreamController(stream._readableStreamController) === false) {
- throw new TypeError('Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte ' + 'source');
- }
- if (IsReadableStreamLocked(stream)) {
- throw new TypeError('This stream has already been locked for exclusive reading by another reader');
- }
- ReadableStreamReaderGenericInitialize(this, stream);
- this._readIntoRequests = [];
- }
- _createClass(ReadableStreamBYOBReader, [{
- key: 'cancel',
- value: function cancel(reason) {
- if (!IsReadableStreamBYOBReader(this)) {
- return Promise.reject(byobReaderBrandCheckException('cancel'));
- }
- if (this._ownerReadableStream === undefined) {
- return Promise.reject(readerLockException('cancel'));
- }
- return ReadableStreamReaderGenericCancel(this, reason);
- }
- }, {
- key: 'read',
- value: function read(view) {
- if (!IsReadableStreamBYOBReader(this)) {
- return Promise.reject(byobReaderBrandCheckException('read'));
- }
- if (this._ownerReadableStream === undefined) {
- return Promise.reject(readerLockException('read from'));
- }
- if (!ArrayBuffer.isView(view)) {
- return Promise.reject(new TypeError('view must be an array buffer view'));
- }
- if (view.byteLength === 0) {
- return Promise.reject(new TypeError('view must have non-zero byteLength'));
- }
- return ReadableStreamBYOBReaderRead(this, view);
- }
- }, {
- key: 'releaseLock',
- value: function releaseLock() {
- if (!IsReadableStreamBYOBReader(this)) {
- throw byobReaderBrandCheckException('releaseLock');
- }
- if (this._ownerReadableStream === undefined) {
- return;
- }
- if (this._readIntoRequests.length > 0) {
- throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled');
- }
- ReadableStreamReaderGenericRelease(this);
- }
- }, {
- key: 'closed',
- get: function get() {
- if (!IsReadableStreamBYOBReader(this)) {
- return Promise.reject(byobReaderBrandCheckException('closed'));
- }
- return this._closedPromise;
- }
- }]);
- return ReadableStreamBYOBReader;
- }();
- function IsReadableStreamBYOBReader(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_readIntoRequests')) {
- return false;
- }
- return true;
- }
- function IsReadableStreamDefaultReader(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_readRequests')) {
- return false;
- }
- return true;
- }
- function ReadableStreamReaderGenericInitialize(reader, stream) {
- reader._ownerReadableStream = stream;
- stream._reader = reader;
- if (stream._state === 'readable') {
- defaultReaderClosedPromiseInitialize(reader);
- } else if (stream._state === 'closed') {
- defaultReaderClosedPromiseInitializeAsResolved(reader);
- } else {
- assert(stream._state === 'errored', 'state must be errored');
- defaultReaderClosedPromiseInitializeAsRejected(reader, stream._storedError);
- reader._closedPromise.catch(function () {});
- }
- }
- function ReadableStreamReaderGenericCancel(reader, reason) {
- var stream = reader._ownerReadableStream;
- assert(stream !== undefined);
- return ReadableStreamCancel(stream, reason);
- }
- function ReadableStreamReaderGenericRelease(reader) {
- assert(reader._ownerReadableStream !== undefined);
- assert(reader._ownerReadableStream._reader === reader);
- if (reader._ownerReadableStream._state === 'readable') {
- defaultReaderClosedPromiseReject(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\'s closedness'));
- } else {
- defaultReaderClosedPromiseResetToRejected(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\'s closedness'));
- }
- reader._closedPromise.catch(function () {});
- reader._ownerReadableStream._reader = undefined;
- reader._ownerReadableStream = undefined;
- }
- function ReadableStreamBYOBReaderRead(reader, view) {
- var stream = reader._ownerReadableStream;
- assert(stream !== undefined);
- stream._disturbed = true;
- if (stream._state === 'errored') {
- return Promise.reject(stream._storedError);
- }
- return ReadableByteStreamControllerPullInto(stream._readableStreamController, view);
- }
- function ReadableStreamDefaultReaderRead(reader) {
- var stream = reader._ownerReadableStream;
- assert(stream !== undefined);
- stream._disturbed = true;
- if (stream._state === 'closed') {
- return Promise.resolve(CreateIterResultObject(undefined, true));
- }
- if (stream._state === 'errored') {
- return Promise.reject(stream._storedError);
- }
- assert(stream._state === 'readable');
- return stream._readableStreamController.__pullSteps();
- }
- var ReadableStreamDefaultController = function () {
- function ReadableStreamDefaultController(stream, underlyingSource, size, highWaterMark) {
- _classCallCheck(this, ReadableStreamDefaultController);
- if (IsReadableStream(stream) === false) {
- throw new TypeError('ReadableStreamDefaultController can only be constructed with a ReadableStream instance');
- }
- if (stream._readableStreamController !== undefined) {
- throw new TypeError('ReadableStreamDefaultController instances can only be created by the ReadableStream constructor');
- }
- this._controlledReadableStream = stream;
- this._underlyingSource = underlyingSource;
- this._queue = undefined;
- this._queueTotalSize = undefined;
- ResetQueue(this);
- this._started = false;
- this._closeRequested = false;
- this._pullAgain = false;
- this._pulling = false;
- var normalizedStrategy = ValidateAndNormalizeQueuingStrategy(size, highWaterMark);
- this._strategySize = normalizedStrategy.size;
- this._strategyHWM = normalizedStrategy.highWaterMark;
- var controller = this;
- var startResult = InvokeOrNoop(underlyingSource, 'start', [this]);
- Promise.resolve(startResult).then(function () {
- controller._started = true;
- assert(controller._pulling === false);
- assert(controller._pullAgain === false);
- ReadableStreamDefaultControllerCallPullIfNeeded(controller);
- }, function (r) {
- ReadableStreamDefaultControllerErrorIfNeeded(controller, r);
- }).catch(rethrowAssertionErrorRejection);
- }
- _createClass(ReadableStreamDefaultController, [{
- key: 'close',
- value: function close() {
- if (IsReadableStreamDefaultController(this) === false) {
- throw defaultControllerBrandCheckException('close');
- }
- if (this._closeRequested === true) {
- throw new TypeError('The stream has already been closed; do not close it again!');
- }
- var state = this._controlledReadableStream._state;
- if (state !== 'readable') {
- throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be closed');
- }
- ReadableStreamDefaultControllerClose(this);
- }
- }, {
- key: 'enqueue',
- value: function enqueue(chunk) {
- if (IsReadableStreamDefaultController(this) === false) {
- throw defaultControllerBrandCheckException('enqueue');
- }
- if (this._closeRequested === true) {
- throw new TypeError('stream is closed or draining');
- }
- var state = this._controlledReadableStream._state;
- if (state !== 'readable') {
- throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be enqueued to');
- }
- return ReadableStreamDefaultControllerEnqueue(this, chunk);
- }
- }, {
- key: 'error',
- value: function error(e) {
- if (IsReadableStreamDefaultController(this) === false) {
- throw defaultControllerBrandCheckException('error');
- }
- var stream = this._controlledReadableStream;
- if (stream._state !== 'readable') {
- throw new TypeError('The stream is ' + stream._state + ' and so cannot be errored');
- }
- ReadableStreamDefaultControllerError(this, e);
- }
- }, {
- key: '__cancelSteps',
- value: function __cancelSteps(reason) {
- ResetQueue(this);
- return PromiseInvokeOrNoop(this._underlyingSource, 'cancel', [reason]);
- }
- }, {
- key: '__pullSteps',
- value: function __pullSteps() {
- var stream = this._controlledReadableStream;
- if (this._queue.length > 0) {
- var chunk = DequeueValue(this);
- if (this._closeRequested === true && this._queue.length === 0) {
- ReadableStreamClose(stream);
- } else {
- ReadableStreamDefaultControllerCallPullIfNeeded(this);
- }
- return Promise.resolve(CreateIterResultObject(chunk, false));
- }
- var pendingPromise = ReadableStreamAddReadRequest(stream);
- ReadableStreamDefaultControllerCallPullIfNeeded(this);
- return pendingPromise;
- }
- }, {
- key: 'desiredSize',
- get: function get() {
- if (IsReadableStreamDefaultController(this) === false) {
- throw defaultControllerBrandCheckException('desiredSize');
- }
- return ReadableStreamDefaultControllerGetDesiredSize(this);
- }
- }]);
- return ReadableStreamDefaultController;
- }();
- function IsReadableStreamDefaultController(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_underlyingSource')) {
- return false;
- }
- return true;
- }
- function ReadableStreamDefaultControllerCallPullIfNeeded(controller) {
- var shouldPull = ReadableStreamDefaultControllerShouldCallPull(controller);
- if (shouldPull === false) {
- return undefined;
- }
- if (controller._pulling === true) {
- controller._pullAgain = true;
- return undefined;
- }
- assert(controller._pullAgain === false);
- controller._pulling = true;
- var pullPromise = PromiseInvokeOrNoop(controller._underlyingSource, 'pull', [controller]);
- pullPromise.then(function () {
- controller._pulling = false;
- if (controller._pullAgain === true) {
- controller._pullAgain = false;
- return ReadableStreamDefaultControllerCallPullIfNeeded(controller);
- }
- return undefined;
- }, function (e) {
- ReadableStreamDefaultControllerErrorIfNeeded(controller, e);
- }).catch(rethrowAssertionErrorRejection);
- return undefined;
- }
- function ReadableStreamDefaultControllerShouldCallPull(controller) {
- var stream = controller._controlledReadableStream;
- if (stream._state === 'closed' || stream._state === 'errored') {
- return false;
- }
- if (controller._closeRequested === true) {
- return false;
- }
- if (controller._started === false) {
- return false;
- }
- if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {
- return true;
- }
- var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller);
- if (desiredSize > 0) {
- return true;
- }
- return false;
- }
- function ReadableStreamDefaultControllerClose(controller) {
- var stream = controller._controlledReadableStream;
- assert(controller._closeRequested === false);
- assert(stream._state === 'readable');
- controller._closeRequested = true;
- if (controller._queue.length === 0) {
- ReadableStreamClose(stream);
- }
- }
- function ReadableStreamDefaultControllerEnqueue(controller, chunk) {
- var stream = controller._controlledReadableStream;
- assert(controller._closeRequested === false);
- assert(stream._state === 'readable');
- if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {
- ReadableStreamFulfillReadRequest(stream, chunk, false);
- } else {
- var chunkSize = 1;
- if (controller._strategySize !== undefined) {
- var strategySize = controller._strategySize;
- try {
- chunkSize = strategySize(chunk);
- } catch (chunkSizeE) {
- ReadableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE);
- throw chunkSizeE;
- }
- }
- try {
- EnqueueValueWithSize(controller, chunk, chunkSize);
- } catch (enqueueE) {
- ReadableStreamDefaultControllerErrorIfNeeded(controller, enqueueE);
- throw enqueueE;
- }
- }
- ReadableStreamDefaultControllerCallPullIfNeeded(controller);
- return undefined;
- }
- function ReadableStreamDefaultControllerError(controller, e) {
- var stream = controller._controlledReadableStream;
- assert(stream._state === 'readable');
- ResetQueue(controller);
- ReadableStreamError(stream, e);
- }
- function ReadableStreamDefaultControllerErrorIfNeeded(controller, e) {
- if (controller._controlledReadableStream._state === 'readable') {
- ReadableStreamDefaultControllerError(controller, e);
- }
- }
- function ReadableStreamDefaultControllerGetDesiredSize(controller) {
- var stream = controller._controlledReadableStream;
- var state = stream._state;
- if (state === 'errored') {
- return null;
- }
- if (state === 'closed') {
- return 0;
- }
- return controller._strategyHWM - controller._queueTotalSize;
- }
- var ReadableStreamBYOBRequest = function () {
- function ReadableStreamBYOBRequest(controller, view) {
- _classCallCheck(this, ReadableStreamBYOBRequest);
- this._associatedReadableByteStreamController = controller;
- this._view = view;
- }
- _createClass(ReadableStreamBYOBRequest, [{
- key: 'respond',
- value: function respond(bytesWritten) {
- if (IsReadableStreamBYOBRequest(this) === false) {
- throw byobRequestBrandCheckException('respond');
- }
- if (this._associatedReadableByteStreamController === undefined) {
- throw new TypeError('This BYOB request has been invalidated');
- }
- ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController, bytesWritten);
- }
- }, {
- key: 'respondWithNewView',
- value: function respondWithNewView(view) {
- if (IsReadableStreamBYOBRequest(this) === false) {
- throw byobRequestBrandCheckException('respond');
- }
- if (this._associatedReadableByteStreamController === undefined) {
- throw new TypeError('This BYOB request has been invalidated');
- }
- if (!ArrayBuffer.isView(view)) {
- throw new TypeError('You can only respond with array buffer views');
- }
- ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view);
- }
- }, {
- key: 'view',
- get: function get() {
- return this._view;
- }
- }]);
- return ReadableStreamBYOBRequest;
- }();
- var ReadableByteStreamController = function () {
- function ReadableByteStreamController(stream, underlyingByteSource, highWaterMark) {
- _classCallCheck(this, ReadableByteStreamController);
- if (IsReadableStream(stream) === false) {
- throw new TypeError('ReadableByteStreamController can only be constructed with a ReadableStream instance given ' + 'a byte source');
- }
- if (stream._readableStreamController !== undefined) {
- throw new TypeError('ReadableByteStreamController instances can only be created by the ReadableStream constructor given a byte ' + 'source');
- }
- this._controlledReadableStream = stream;
- this._underlyingByteSource = underlyingByteSource;
- this._pullAgain = false;
- this._pulling = false;
- ReadableByteStreamControllerClearPendingPullIntos(this);
- this._queue = this._queueTotalSize = undefined;
- ResetQueue(this);
- this._closeRequested = false;
- this._started = false;
- this._strategyHWM = ValidateAndNormalizeHighWaterMark(highWaterMark);
- var autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;
- if (autoAllocateChunkSize !== undefined) {
- if (Number.isInteger(autoAllocateChunkSize) === false || autoAllocateChunkSize <= 0) {
- throw new RangeError('autoAllocateChunkSize must be a positive integer');
- }
- }
- this._autoAllocateChunkSize = autoAllocateChunkSize;
- this._pendingPullIntos = [];
- var controller = this;
- var startResult = InvokeOrNoop(underlyingByteSource, 'start', [this]);
- Promise.resolve(startResult).then(function () {
- controller._started = true;
- assert(controller._pulling === false);
- assert(controller._pullAgain === false);
- ReadableByteStreamControllerCallPullIfNeeded(controller);
- }, function (r) {
- if (stream._state === 'readable') {
- ReadableByteStreamControllerError(controller, r);
- }
- }).catch(rethrowAssertionErrorRejection);
- }
- _createClass(ReadableByteStreamController, [{
- key: 'close',
- value: function close() {
- if (IsReadableByteStreamController(this) === false) {
- throw byteStreamControllerBrandCheckException('close');
- }
- if (this._closeRequested === true) {
- throw new TypeError('The stream has already been closed; do not close it again!');
- }
- var state = this._controlledReadableStream._state;
- if (state !== 'readable') {
- throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be closed');
- }
- ReadableByteStreamControllerClose(this);
- }
- }, {
- key: 'enqueue',
- value: function enqueue(chunk) {
- if (IsReadableByteStreamController(this) === false) {
- throw byteStreamControllerBrandCheckException('enqueue');
- }
- if (this._closeRequested === true) {
- throw new TypeError('stream is closed or draining');
- }
- var state = this._controlledReadableStream._state;
- if (state !== 'readable') {
- throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be enqueued to');
- }
- if (!ArrayBuffer.isView(chunk)) {
- throw new TypeError('You can only enqueue array buffer views when using a ReadableByteStreamController');
- }
- ReadableByteStreamControllerEnqueue(this, chunk);
- }
- }, {
- key: 'error',
- value: function error(e) {
- if (IsReadableByteStreamController(this) === false) {
- throw byteStreamControllerBrandCheckException('error');
- }
- var stream = this._controlledReadableStream;
- if (stream._state !== 'readable') {
- throw new TypeError('The stream is ' + stream._state + ' and so cannot be errored');
- }
- ReadableByteStreamControllerError(this, e);
- }
- }, {
- key: '__cancelSteps',
- value: function __cancelSteps(reason) {
- if (this._pendingPullIntos.length > 0) {
- var firstDescriptor = this._pendingPullIntos[0];
- firstDescriptor.bytesFilled = 0;
- }
- ResetQueue(this);
- return PromiseInvokeOrNoop(this._underlyingByteSource, 'cancel', [reason]);
- }
- }, {
- key: '__pullSteps',
- value: function __pullSteps() {
- var stream = this._controlledReadableStream;
- assert(ReadableStreamHasDefaultReader(stream) === true);
- if (this._queueTotalSize > 0) {
- assert(ReadableStreamGetNumReadRequests(stream) === 0);
- var entry = this._queue.shift();
- this._queueTotalSize -= entry.byteLength;
- ReadableByteStreamControllerHandleQueueDrain(this);
- var view = void 0;
- try {
- view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);
- } catch (viewE) {
- return Promise.reject(viewE);
- }
- return Promise.resolve(CreateIterResultObject(view, false));
- }
- var autoAllocateChunkSize = this._autoAllocateChunkSize;
- if (autoAllocateChunkSize !== undefined) {
- var buffer = void 0;
- try {
- buffer = new ArrayBuffer(autoAllocateChunkSize);
- } catch (bufferE) {
- return Promise.reject(bufferE);
- }
- var pullIntoDescriptor = {
- buffer: buffer,
- byteOffset: 0,
- byteLength: autoAllocateChunkSize,
- bytesFilled: 0,
- elementSize: 1,
- ctor: Uint8Array,
- readerType: 'default'
- };
- this._pendingPullIntos.push(pullIntoDescriptor);
- }
- var promise = ReadableStreamAddReadRequest(stream);
- ReadableByteStreamControllerCallPullIfNeeded(this);
- return promise;
- }
- }, {
- key: 'byobRequest',
- get: function get() {
- if (IsReadableByteStreamController(this) === false) {
- throw byteStreamControllerBrandCheckException('byobRequest');
- }
- if (this._byobRequest === undefined && this._pendingPullIntos.length > 0) {
- var firstDescriptor = this._pendingPullIntos[0];
- var view = new Uint8Array(firstDescriptor.buffer, firstDescriptor.byteOffset + firstDescriptor.bytesFilled, firstDescriptor.byteLength - firstDescriptor.bytesFilled);
- this._byobRequest = new ReadableStreamBYOBRequest(this, view);
- }
- return this._byobRequest;
- }
- }, {
- key: 'desiredSize',
- get: function get() {
- if (IsReadableByteStreamController(this) === false) {
- throw byteStreamControllerBrandCheckException('desiredSize');
- }
- return ReadableByteStreamControllerGetDesiredSize(this);
- }
- }]);
- return ReadableByteStreamController;
- }();
- function IsReadableByteStreamController(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_underlyingByteSource')) {
- return false;
- }
- return true;
- }
- function IsReadableStreamBYOBRequest(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_associatedReadableByteStreamController')) {
- return false;
- }
- return true;
- }
- function ReadableByteStreamControllerCallPullIfNeeded(controller) {
- var shouldPull = ReadableByteStreamControllerShouldCallPull(controller);
- if (shouldPull === false) {
- return undefined;
- }
- if (controller._pulling === true) {
- controller._pullAgain = true;
- return undefined;
- }
- assert(controller._pullAgain === false);
- controller._pulling = true;
- var pullPromise = PromiseInvokeOrNoop(controller._underlyingByteSource, 'pull', [controller]);
- pullPromise.then(function () {
- controller._pulling = false;
- if (controller._pullAgain === true) {
- controller._pullAgain = false;
- ReadableByteStreamControllerCallPullIfNeeded(controller);
- }
- }, function (e) {
- if (controller._controlledReadableStream._state === 'readable') {
- ReadableByteStreamControllerError(controller, e);
- }
- }).catch(rethrowAssertionErrorRejection);
- return undefined;
- }
- function ReadableByteStreamControllerClearPendingPullIntos(controller) {
- ReadableByteStreamControllerInvalidateBYOBRequest(controller);
- controller._pendingPullIntos = [];
- }
- function ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor) {
- assert(stream._state !== 'errored', 'state must not be errored');
- var done = false;
- if (stream._state === 'closed') {
- assert(pullIntoDescriptor.bytesFilled === 0);
- done = true;
- }
- var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);
- if (pullIntoDescriptor.readerType === 'default') {
- ReadableStreamFulfillReadRequest(stream, filledView, done);
- } else {
- assert(pullIntoDescriptor.readerType === 'byob');
- ReadableStreamFulfillReadIntoRequest(stream, filledView, done);
- }
- }
- function ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor) {
- var bytesFilled = pullIntoDescriptor.bytesFilled;
- var elementSize = pullIntoDescriptor.elementSize;
- assert(bytesFilled <= pullIntoDescriptor.byteLength);
- assert(bytesFilled % elementSize === 0);
- return new pullIntoDescriptor.ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, bytesFilled / elementSize);
- }
- function ReadableByteStreamControllerEnqueueChunkToQueue(controller, buffer, byteOffset, byteLength) {
- controller._queue.push({
- buffer: buffer,
- byteOffset: byteOffset,
- byteLength: byteLength
- });
- controller._queueTotalSize += byteLength;
- }
- function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) {
- var elementSize = pullIntoDescriptor.elementSize;
- var currentAlignedBytes = pullIntoDescriptor.bytesFilled - pullIntoDescriptor.bytesFilled % elementSize;
- var maxBytesToCopy = Math.min(controller._queueTotalSize, pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled);
- var maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy;
- var maxAlignedBytes = maxBytesFilled - maxBytesFilled % elementSize;
- var totalBytesToCopyRemaining = maxBytesToCopy;
- var ready = false;
- if (maxAlignedBytes > currentAlignedBytes) {
- totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled;
- ready = true;
- }
- var queue = controller._queue;
- while (totalBytesToCopyRemaining > 0) {
- var headOfQueue = queue[0];
- var bytesToCopy = Math.min(totalBytesToCopyRemaining, headOfQueue.byteLength);
- var destStart = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
- ArrayBufferCopy(pullIntoDescriptor.buffer, destStart, headOfQueue.buffer, headOfQueue.byteOffset, bytesToCopy);
- if (headOfQueue.byteLength === bytesToCopy) {
- queue.shift();
- } else {
- headOfQueue.byteOffset += bytesToCopy;
- headOfQueue.byteLength -= bytesToCopy;
- }
- controller._queueTotalSize -= bytesToCopy;
- ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesToCopy, pullIntoDescriptor);
- totalBytesToCopyRemaining -= bytesToCopy;
- }
- if (ready === false) {
- assert(controller._queueTotalSize === 0, 'queue must be empty');
- assert(pullIntoDescriptor.bytesFilled > 0);
- assert(pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize);
- }
- return ready;
- }
- function ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, size, pullIntoDescriptor) {
- assert(controller._pendingPullIntos.length === 0 || controller._pendingPullIntos[0] === pullIntoDescriptor);
- ReadableByteStreamControllerInvalidateBYOBRequest(controller);
- pullIntoDescriptor.bytesFilled += size;
- }
- function ReadableByteStreamControllerHandleQueueDrain(controller) {
- assert(controller._controlledReadableStream._state === 'readable');
- if (controller._queueTotalSize === 0 && controller._closeRequested === true) {
- ReadableStreamClose(controller._controlledReadableStream);
- } else {
- ReadableByteStreamControllerCallPullIfNeeded(controller);
- }
- }
- function ReadableByteStreamControllerInvalidateBYOBRequest(controller) {
- if (controller._byobRequest === undefined) {
- return;
- }
- controller._byobRequest._associatedReadableByteStreamController = undefined;
- controller._byobRequest._view = undefined;
- controller._byobRequest = undefined;
- }
- function ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller) {
- assert(controller._closeRequested === false);
- while (controller._pendingPullIntos.length > 0) {
- if (controller._queueTotalSize === 0) {
- return;
- }
- var pullIntoDescriptor = controller._pendingPullIntos[0];
- if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) {
- ReadableByteStreamControllerShiftPendingPullInto(controller);
- ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableStream, pullIntoDescriptor);
- }
- }
- }
- function ReadableByteStreamControllerPullInto(controller, view) {
- var stream = controller._controlledReadableStream;
- var elementSize = 1;
- if (view.constructor !== DataView) {
- elementSize = view.constructor.BYTES_PER_ELEMENT;
- }
- var ctor = view.constructor;
- var pullIntoDescriptor = {
- buffer: view.buffer,
- byteOffset: view.byteOffset,
- byteLength: view.byteLength,
- bytesFilled: 0,
- elementSize: elementSize,
- ctor: ctor,
- readerType: 'byob'
- };
- if (controller._pendingPullIntos.length > 0) {
- pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer);
- controller._pendingPullIntos.push(pullIntoDescriptor);
- return ReadableStreamAddReadIntoRequest(stream);
- }
- if (stream._state === 'closed') {
- var emptyView = new view.constructor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, 0);
- return Promise.resolve(CreateIterResultObject(emptyView, true));
- }
- if (controller._queueTotalSize > 0) {
- if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) {
- var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);
- ReadableByteStreamControllerHandleQueueDrain(controller);
- return Promise.resolve(CreateIterResultObject(filledView, false));
- }
- if (controller._closeRequested === true) {
- var e = new TypeError('Insufficient bytes to fill elements in the given buffer');
- ReadableByteStreamControllerError(controller, e);
- return Promise.reject(e);
- }
- }
- pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer);
- controller._pendingPullIntos.push(pullIntoDescriptor);
- var promise = ReadableStreamAddReadIntoRequest(stream);
- ReadableByteStreamControllerCallPullIfNeeded(controller);
- return promise;
- }
- function ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor) {
- firstDescriptor.buffer = TransferArrayBuffer(firstDescriptor.buffer);
- assert(firstDescriptor.bytesFilled === 0, 'bytesFilled must be 0');
- var stream = controller._controlledReadableStream;
- if (ReadableStreamHasBYOBReader(stream) === true) {
- while (ReadableStreamGetNumReadIntoRequests(stream) > 0) {
- var pullIntoDescriptor = ReadableByteStreamControllerShiftPendingPullInto(controller);
- ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor);
- }
- }
- }
- function ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, pullIntoDescriptor) {
- if (pullIntoDescriptor.bytesFilled + bytesWritten > pullIntoDescriptor.byteLength) {
- throw new RangeError('bytesWritten out of range');
- }
- ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor);
- if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize) {
- return;
- }
- ReadableByteStreamControllerShiftPendingPullInto(controller);
- var remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize;
- if (remainderSize > 0) {
- var end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
- var remainder = pullIntoDescriptor.buffer.slice(end - remainderSize, end);
- ReadableByteStreamControllerEnqueueChunkToQueue(controller, remainder, 0, remainder.byteLength);
- }
- pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer);
- pullIntoDescriptor.bytesFilled -= remainderSize;
- ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableStream, pullIntoDescriptor);
- ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);
- }
- function ReadableByteStreamControllerRespondInternal(controller, bytesWritten) {
- var firstDescriptor = controller._pendingPullIntos[0];
- var stream = controller._controlledReadableStream;
- if (stream._state === 'closed') {
- if (bytesWritten !== 0) {
- throw new TypeError('bytesWritten must be 0 when calling respond() on a closed stream');
- }
- ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor);
- } else {
- assert(stream._state === 'readable');
- ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor);
- }
- }
- function ReadableByteStreamControllerShiftPendingPullInto(controller) {
- var descriptor = controller._pendingPullIntos.shift();
- ReadableByteStreamControllerInvalidateBYOBRequest(controller);
- return descriptor;
- }
- function ReadableByteStreamControllerShouldCallPull(controller) {
- var stream = controller._controlledReadableStream;
- if (stream._state !== 'readable') {
- return false;
- }
- if (controller._closeRequested === true) {
- return false;
- }
- if (controller._started === false) {
- return false;
- }
- if (ReadableStreamHasDefaultReader(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {
- return true;
- }
- if (ReadableStreamHasBYOBReader(stream) === true && ReadableStreamGetNumReadIntoRequests(stream) > 0) {
- return true;
- }
- if (ReadableByteStreamControllerGetDesiredSize(controller) > 0) {
- return true;
- }
- return false;
- }
- function ReadableByteStreamControllerClose(controller) {
- var stream = controller._controlledReadableStream;
- assert(controller._closeRequested === false);
- assert(stream._state === 'readable');
- if (controller._queueTotalSize > 0) {
- controller._closeRequested = true;
- return;
- }
- if (controller._pendingPullIntos.length > 0) {
- var firstPendingPullInto = controller._pendingPullIntos[0];
- if (firstPendingPullInto.bytesFilled > 0) {
- var e = new TypeError('Insufficient bytes to fill elements in the given buffer');
- ReadableByteStreamControllerError(controller, e);
- throw e;
- }
- }
- ReadableStreamClose(stream);
- }
- function ReadableByteStreamControllerEnqueue(controller, chunk) {
- var stream = controller._controlledReadableStream;
- assert(controller._closeRequested === false);
- assert(stream._state === 'readable');
- var buffer = chunk.buffer;
- var byteOffset = chunk.byteOffset;
- var byteLength = chunk.byteLength;
- var transferredBuffer = TransferArrayBuffer(buffer);
- if (ReadableStreamHasDefaultReader(stream) === true) {
- if (ReadableStreamGetNumReadRequests(stream) === 0) {
- ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
- } else {
- assert(controller._queue.length === 0);
- var transferredView = new Uint8Array(transferredBuffer, byteOffset, byteLength);
- ReadableStreamFulfillReadRequest(stream, transferredView, false);
- }
- } else if (ReadableStreamHasBYOBReader(stream) === true) {
- ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
- ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);
- } else {
- assert(IsReadableStreamLocked(stream) === false, 'stream must not be locked');
- ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
- }
- }
- function ReadableByteStreamControllerError(controller, e) {
- var stream = controller._controlledReadableStream;
- assert(stream._state === 'readable');
- ReadableByteStreamControllerClearPendingPullIntos(controller);
- ResetQueue(controller);
- ReadableStreamError(stream, e);
- }
- function ReadableByteStreamControllerGetDesiredSize(controller) {
- var stream = controller._controlledReadableStream;
- var state = stream._state;
- if (state === 'errored') {
- return null;
- }
- if (state === 'closed') {
- return 0;
- }
- return controller._strategyHWM - controller._queueTotalSize;
- }
- function ReadableByteStreamControllerRespond(controller, bytesWritten) {
- bytesWritten = Number(bytesWritten);
- if (IsFiniteNonNegativeNumber(bytesWritten) === false) {
- throw new RangeError('bytesWritten must be a finite');
- }
- assert(controller._pendingPullIntos.length > 0);
- ReadableByteStreamControllerRespondInternal(controller, bytesWritten);
- }
- function ReadableByteStreamControllerRespondWithNewView(controller, view) {
- assert(controller._pendingPullIntos.length > 0);
- var firstDescriptor = controller._pendingPullIntos[0];
- if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !== view.byteOffset) {
- throw new RangeError('The region specified by view does not match byobRequest');
- }
- if (firstDescriptor.byteLength !== view.byteLength) {
- throw new RangeError('The buffer of view has different capacity than byobRequest');
- }
- firstDescriptor.buffer = view.buffer;
- ReadableByteStreamControllerRespondInternal(controller, view.byteLength);
- }
- function streamBrandCheckException(name) {
- return new TypeError('ReadableStream.prototype.' + name + ' can only be used on a ReadableStream');
- }
- function readerLockException(name) {
- return new TypeError('Cannot ' + name + ' a stream using a released reader');
- }
- function defaultReaderBrandCheckException(name) {
- return new TypeError('ReadableStreamDefaultReader.prototype.' + name + ' can only be used on a ReadableStreamDefaultReader');
- }
- function defaultReaderClosedPromiseInitialize(reader) {
- reader._closedPromise = new Promise(function (resolve, reject) {
- reader._closedPromise_resolve = resolve;
- reader._closedPromise_reject = reject;
- });
- }
- function defaultReaderClosedPromiseInitializeAsRejected(reader, reason) {
- reader._closedPromise = Promise.reject(reason);
- reader._closedPromise_resolve = undefined;
- reader._closedPromise_reject = undefined;
- }
- function defaultReaderClosedPromiseInitializeAsResolved(reader) {
- reader._closedPromise = Promise.resolve(undefined);
- reader._closedPromise_resolve = undefined;
- reader._closedPromise_reject = undefined;
- }
- function defaultReaderClosedPromiseReject(reader, reason) {
- assert(reader._closedPromise_resolve !== undefined);
- assert(reader._closedPromise_reject !== undefined);
- reader._closedPromise_reject(reason);
- reader._closedPromise_resolve = undefined;
- reader._closedPromise_reject = undefined;
- }
- function defaultReaderClosedPromiseResetToRejected(reader, reason) {
- assert(reader._closedPromise_resolve === undefined);
- assert(reader._closedPromise_reject === undefined);
- reader._closedPromise = Promise.reject(reason);
- }
- function defaultReaderClosedPromiseResolve(reader) {
- assert(reader._closedPromise_resolve !== undefined);
- assert(reader._closedPromise_reject !== undefined);
- reader._closedPromise_resolve(undefined);
- reader._closedPromise_resolve = undefined;
- reader._closedPromise_reject = undefined;
- }
- function byobReaderBrandCheckException(name) {
- return new TypeError('ReadableStreamBYOBReader.prototype.' + name + ' can only be used on a ReadableStreamBYOBReader');
- }
- function defaultControllerBrandCheckException(name) {
- return new TypeError('ReadableStreamDefaultController.prototype.' + name + ' can only be used on a ReadableStreamDefaultController');
- }
- function byobRequestBrandCheckException(name) {
- return new TypeError('ReadableStreamBYOBRequest.prototype.' + name + ' can only be used on a ReadableStreamBYOBRequest');
- }
- function byteStreamControllerBrandCheckException(name) {
- return new TypeError('ReadableByteStreamController.prototype.' + name + ' can only be used on a ReadableByteStreamController');
- }
- function ifIsObjectAndHasAPromiseIsHandledInternalSlotSetPromiseIsHandledToTrue(promise) {
- try {
- Promise.prototype.then.call(promise, undefined, function () {});
- } catch (e) {}
- }
-}, function (module, exports, __w_pdfjs_require__) {
- "use strict";
-
- var transformStream = __w_pdfjs_require__(6);
- var readableStream = __w_pdfjs_require__(4);
- var writableStream = __w_pdfjs_require__(2);
- exports.TransformStream = transformStream.TransformStream;
- exports.ReadableStream = readableStream.ReadableStream;
- exports.IsReadableStreamDisturbed = readableStream.IsReadableStreamDisturbed;
- exports.ReadableStreamDefaultControllerClose = readableStream.ReadableStreamDefaultControllerClose;
- exports.ReadableStreamDefaultControllerEnqueue = readableStream.ReadableStreamDefaultControllerEnqueue;
- exports.ReadableStreamDefaultControllerError = readableStream.ReadableStreamDefaultControllerError;
- exports.ReadableStreamDefaultControllerGetDesiredSize = readableStream.ReadableStreamDefaultControllerGetDesiredSize;
- exports.AcquireWritableStreamDefaultWriter = writableStream.AcquireWritableStreamDefaultWriter;
- exports.IsWritableStream = writableStream.IsWritableStream;
- exports.IsWritableStreamLocked = writableStream.IsWritableStreamLocked;
- exports.WritableStream = writableStream.WritableStream;
- exports.WritableStreamAbort = writableStream.WritableStreamAbort;
- exports.WritableStreamDefaultControllerError = writableStream.WritableStreamDefaultControllerError;
- exports.WritableStreamDefaultWriterCloseWithErrorPropagation = writableStream.WritableStreamDefaultWriterCloseWithErrorPropagation;
- exports.WritableStreamDefaultWriterRelease = writableStream.WritableStreamDefaultWriterRelease;
- exports.WritableStreamDefaultWriterWrite = writableStream.WritableStreamDefaultWriterWrite;
-}, function (module, exports, __w_pdfjs_require__) {
- "use strict";
-
- var _createClass = 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);
- }
- }
- return function (Constructor, protoProps, staticProps) {
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
- if (staticProps) defineProperties(Constructor, staticProps);
- return Constructor;
- };
- }();
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- var _require = __w_pdfjs_require__(1),
- assert = _require.assert;
- var _require2 = __w_pdfjs_require__(0),
- InvokeOrNoop = _require2.InvokeOrNoop,
- PromiseInvokeOrPerformFallback = _require2.PromiseInvokeOrPerformFallback,
- PromiseInvokeOrNoop = _require2.PromiseInvokeOrNoop,
- typeIsObject = _require2.typeIsObject;
- var _require3 = __w_pdfjs_require__(4),
- ReadableStream = _require3.ReadableStream,
- ReadableStreamDefaultControllerClose = _require3.ReadableStreamDefaultControllerClose,
- ReadableStreamDefaultControllerEnqueue = _require3.ReadableStreamDefaultControllerEnqueue,
- ReadableStreamDefaultControllerError = _require3.ReadableStreamDefaultControllerError,
- ReadableStreamDefaultControllerGetDesiredSize = _require3.ReadableStreamDefaultControllerGetDesiredSize;
- var _require4 = __w_pdfjs_require__(2),
- WritableStream = _require4.WritableStream,
- WritableStreamDefaultControllerError = _require4.WritableStreamDefaultControllerError;
- function TransformStreamCloseReadable(transformStream) {
- if (transformStream._errored === true) {
- throw new TypeError('TransformStream is already errored');
- }
- if (transformStream._readableClosed === true) {
- throw new TypeError('Readable side is already closed');
- }
- TransformStreamCloseReadableInternal(transformStream);
- }
- function TransformStreamEnqueueToReadable(transformStream, chunk) {
- if (transformStream._errored === true) {
- throw new TypeError('TransformStream is already errored');
- }
- if (transformStream._readableClosed === true) {
- throw new TypeError('Readable side is already closed');
- }
- var controller = transformStream._readableController;
- try {
- ReadableStreamDefaultControllerEnqueue(controller, chunk);
- } catch (e) {
- transformStream._readableClosed = true;
- TransformStreamErrorIfNeeded(transformStream, e);
- throw transformStream._storedError;
- }
- var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller);
- var maybeBackpressure = desiredSize <= 0;
- if (maybeBackpressure === true && transformStream._backpressure === false) {
- TransformStreamSetBackpressure(transformStream, true);
- }
- }
- function TransformStreamError(transformStream, e) {
- if (transformStream._errored === true) {
- throw new TypeError('TransformStream is already errored');
- }
- TransformStreamErrorInternal(transformStream, e);
- }
- function TransformStreamCloseReadableInternal(transformStream) {
- assert(transformStream._errored === false);
- assert(transformStream._readableClosed === false);
- try {
- ReadableStreamDefaultControllerClose(transformStream._readableController);
- } catch (e) {
- assert(false);
- }
- transformStream._readableClosed = true;
- }
- function TransformStreamErrorIfNeeded(transformStream, e) {
- if (transformStream._errored === false) {
- TransformStreamErrorInternal(transformStream, e);
- }
- }
- function TransformStreamErrorInternal(transformStream, e) {
- assert(transformStream._errored === false);
- transformStream._errored = true;
- transformStream._storedError = e;
- if (transformStream._writableDone === false) {
- WritableStreamDefaultControllerError(transformStream._writableController, e);
- }
- if (transformStream._readableClosed === false) {
- ReadableStreamDefaultControllerError(transformStream._readableController, e);
- }
- }
- function TransformStreamReadableReadyPromise(transformStream) {
- assert(transformStream._backpressureChangePromise !== undefined, '_backpressureChangePromise should have been initialized');
- if (transformStream._backpressure === false) {
- return Promise.resolve();
- }
- assert(transformStream._backpressure === true, '_backpressure should have been initialized');
- return transformStream._backpressureChangePromise;
- }
- function TransformStreamSetBackpressure(transformStream, backpressure) {
- assert(transformStream._backpressure !== backpressure, 'TransformStreamSetBackpressure() should be called only when backpressure is changed');
- if (transformStream._backpressureChangePromise !== undefined) {
- transformStream._backpressureChangePromise_resolve(backpressure);
- }
- transformStream._backpressureChangePromise = new Promise(function (resolve) {
- transformStream._backpressureChangePromise_resolve = resolve;
- });
- transformStream._backpressureChangePromise.then(function (resolution) {
- assert(resolution !== backpressure, '_backpressureChangePromise should be fulfilled only when backpressure is changed');
- });
- transformStream._backpressure = backpressure;
- }
- function TransformStreamDefaultTransform(chunk, transformStreamController) {
- var transformStream = transformStreamController._controlledTransformStream;
- TransformStreamEnqueueToReadable(transformStream, chunk);
- return Promise.resolve();
- }
- function TransformStreamTransform(transformStream, chunk) {
- assert(transformStream._errored === false);
- assert(transformStream._transforming === false);
- assert(transformStream._backpressure === false);
- transformStream._transforming = true;
- var transformer = transformStream._transformer;
- var controller = transformStream._transformStreamController;
- var transformPromise = PromiseInvokeOrPerformFallback(transformer, 'transform', [chunk, controller], TransformStreamDefaultTransform, [chunk, controller]);
- return transformPromise.then(function () {
- transformStream._transforming = false;
- return TransformStreamReadableReadyPromise(transformStream);
- }, function (e) {
- TransformStreamErrorIfNeeded(transformStream, e);
- return Promise.reject(e);
- });
- }
- function IsTransformStreamDefaultController(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_controlledTransformStream')) {
- return false;
- }
- return true;
- }
- function IsTransformStream(x) {
- if (!typeIsObject(x)) {
- return false;
- }
- if (!Object.prototype.hasOwnProperty.call(x, '_transformStreamController')) {
- return false;
- }
- return true;
- }
- var TransformStreamSink = function () {
- function TransformStreamSink(transformStream, startPromise) {
- _classCallCheck(this, TransformStreamSink);
- this._transformStream = transformStream;
- this._startPromise = startPromise;
- }
- _createClass(TransformStreamSink, [{
- key: 'start',
- value: function start(c) {
- var transformStream = this._transformStream;
- transformStream._writableController = c;
- return this._startPromise.then(function () {
- return TransformStreamReadableReadyPromise(transformStream);
- });
- }
- }, {
- key: 'write',
- value: function write(chunk) {
- var transformStream = this._transformStream;
- return TransformStreamTransform(transformStream, chunk);
- }
- }, {
- key: 'abort',
- value: function abort() {
- var transformStream = this._transformStream;
- transformStream._writableDone = true;
- TransformStreamErrorInternal(transformStream, new TypeError('Writable side aborted'));
- }
- }, {
- key: 'close',
- value: function close() {
- var transformStream = this._transformStream;
- assert(transformStream._transforming === false);
- transformStream._writableDone = true;
- var flushPromise = PromiseInvokeOrNoop(transformStream._transformer, 'flush', [transformStream._transformStreamController]);
- return flushPromise.then(function () {
- if (transformStream._errored === true) {
- return Promise.reject(transformStream._storedError);
- }
- if (transformStream._readableClosed === false) {
- TransformStreamCloseReadableInternal(transformStream);
- }
- return Promise.resolve();
- }).catch(function (r) {
- TransformStreamErrorIfNeeded(transformStream, r);
- return Promise.reject(transformStream._storedError);
- });
- }
- }]);
- return TransformStreamSink;
- }();
- var TransformStreamSource = function () {
- function TransformStreamSource(transformStream, startPromise) {
- _classCallCheck(this, TransformStreamSource);
- this._transformStream = transformStream;
- this._startPromise = startPromise;
- }
- _createClass(TransformStreamSource, [{
- key: 'start',
- value: function start(c) {
- var transformStream = this._transformStream;
- transformStream._readableController = c;
- return this._startPromise.then(function () {
- assert(transformStream._backpressureChangePromise !== undefined, '_backpressureChangePromise should have been initialized');
- if (transformStream._backpressure === true) {
- return Promise.resolve();
- }
- assert(transformStream._backpressure === false, '_backpressure should have been initialized');
- return transformStream._backpressureChangePromise;
- });
- }
- }, {
- key: 'pull',
- value: function pull() {
- var transformStream = this._transformStream;
- assert(transformStream._backpressure === true, 'pull() should be never called while _backpressure is false');
- assert(transformStream._backpressureChangePromise !== undefined, '_backpressureChangePromise should have been initialized');
- TransformStreamSetBackpressure(transformStream, false);
- return transformStream._backpressureChangePromise;
- }
- }, {
- key: 'cancel',
- value: function cancel() {
- var transformStream = this._transformStream;
- transformStream._readableClosed = true;
- TransformStreamErrorInternal(transformStream, new TypeError('Readable side canceled'));
- }
- }]);
- return TransformStreamSource;
- }();
- var TransformStreamDefaultController = function () {
- function TransformStreamDefaultController(transformStream) {
- _classCallCheck(this, TransformStreamDefaultController);
- if (IsTransformStream(transformStream) === false) {
- throw new TypeError('TransformStreamDefaultController can only be ' + 'constructed with a TransformStream instance');
- }
- if (transformStream._transformStreamController !== undefined) {
- throw new TypeError('TransformStreamDefaultController instances can ' + 'only be created by the TransformStream constructor');
- }
- this._controlledTransformStream = transformStream;
- }
- _createClass(TransformStreamDefaultController, [{
- key: 'enqueue',
- value: function enqueue(chunk) {
- if (IsTransformStreamDefaultController(this) === false) {
- throw defaultControllerBrandCheckException('enqueue');
- }
- TransformStreamEnqueueToReadable(this._controlledTransformStream, chunk);
- }
- }, {
- key: 'close',
- value: function close() {
- if (IsTransformStreamDefaultController(this) === false) {
- throw defaultControllerBrandCheckException('close');
- }
- TransformStreamCloseReadable(this._controlledTransformStream);
- }
- }, {
- key: 'error',
- value: function error(reason) {
- if (IsTransformStreamDefaultController(this) === false) {
- throw defaultControllerBrandCheckException('error');
- }
- TransformStreamError(this._controlledTransformStream, reason);
- }
- }, {
- key: 'desiredSize',
- get: function get() {
- if (IsTransformStreamDefaultController(this) === false) {
- throw defaultControllerBrandCheckException('desiredSize');
- }
- var transformStream = this._controlledTransformStream;
- var readableController = transformStream._readableController;
- return ReadableStreamDefaultControllerGetDesiredSize(readableController);
- }
- }]);
- return TransformStreamDefaultController;
- }();
- var TransformStream = function () {
- function TransformStream() {
- var transformer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- _classCallCheck(this, TransformStream);
- this._transformer = transformer;
- var readableStrategy = transformer.readableStrategy,
- writableStrategy = transformer.writableStrategy;
- this._transforming = false;
- this._errored = false;
- this._storedError = undefined;
- this._writableController = undefined;
- this._readableController = undefined;
- this._transformStreamController = undefined;
- this._writableDone = false;
- this._readableClosed = false;
- this._backpressure = undefined;
- this._backpressureChangePromise = undefined;
- this._backpressureChangePromise_resolve = undefined;
- this._transformStreamController = new TransformStreamDefaultController(this);
- var startPromise_resolve = void 0;
- var startPromise = new Promise(function (resolve) {
- startPromise_resolve = resolve;
- });
- var source = new TransformStreamSource(this, startPromise);
- this._readable = new ReadableStream(source, readableStrategy);
- var sink = new TransformStreamSink(this, startPromise);
- this._writable = new WritableStream(sink, writableStrategy);
- assert(this._writableController !== undefined);
- assert(this._readableController !== undefined);
- var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(this._readableController);
- TransformStreamSetBackpressure(this, desiredSize <= 0);
- var transformStream = this;
- var startResult = InvokeOrNoop(transformer, 'start', [transformStream._transformStreamController]);
- startPromise_resolve(startResult);
- startPromise.catch(function (e) {
- if (transformStream._errored === false) {
- transformStream._errored = true;
- transformStream._storedError = e;
- }
- });
- }
- _createClass(TransformStream, [{
- key: 'readable',
- get: function get() {
- if (IsTransformStream(this) === false) {
- throw streamBrandCheckException('readable');
- }
- return this._readable;
- }
- }, {
- key: 'writable',
- get: function get() {
- if (IsTransformStream(this) === false) {
- throw streamBrandCheckException('writable');
- }
- return this._writable;
- }
- }]);
- return TransformStream;
- }();
- module.exports = { TransformStream: TransformStream };
- function defaultControllerBrandCheckException(name) {
- return new TypeError('TransformStreamDefaultController.prototype.' + name + ' can only be used on a TransformStreamDefaultController');
- }
- function streamBrandCheckException(name) {
- return new TypeError('TransformStream.prototype.' + name + ' can only be used on a TransformStream');
- }
-}, function (module, exports, __w_pdfjs_require__) {
- module.exports = __w_pdfjs_require__(5);
-}]));
-
-/***/ }),
-/* 128 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-{
- var isURLSupported = false;
- try {
- if (typeof URL === 'function' && _typeof(URL.prototype) === 'object' && 'origin' in URL.prototype) {
- var u = new URL('b', 'http://a');
- u.pathname = 'c%20d';
- isURLSupported = u.href === 'http://a/c%20d';
- }
- } catch (ex) {}
- if (isURLSupported) {
- exports.URL = URL;
- } else {
- var PolyfillURL = __w_pdfjs_require__(129).URL;
- var OriginalURL = __w_pdfjs_require__(4).URL;
- if (OriginalURL) {
- PolyfillURL.createObjectURL = function (blob) {
- return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
- };
- PolyfillURL.revokeObjectURL = function (url) {
- OriginalURL.revokeObjectURL(url);
- };
- }
- exports.URL = PolyfillURL;
- }
-}
-
-/***/ }),
-/* 129 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-(function URLConstructorClosure() {
- 'use strict';
-
- var relative = Object.create(null);
- relative['ftp'] = 21;
- relative['file'] = 0;
- relative['gopher'] = 70;
- relative['http'] = 80;
- relative['https'] = 443;
- relative['ws'] = 80;
- relative['wss'] = 443;
- var relativePathDotMapping = Object.create(null);
- relativePathDotMapping['%2e'] = '.';
- relativePathDotMapping['.%2e'] = '..';
- relativePathDotMapping['%2e.'] = '..';
- relativePathDotMapping['%2e%2e'] = '..';
- function isRelativeScheme(scheme) {
- return relative[scheme] !== undefined;
- }
- function invalid() {
- clear.call(this);
- this._isInvalid = true;
- }
- function IDNAToASCII(h) {
- if (h === '') {
- invalid.call(this);
- }
- return h.toLowerCase();
- }
- function percentEscape(c) {
- var unicode = c.charCodeAt(0);
- if (unicode > 0x20 && unicode < 0x7F && [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) === -1) {
- return c;
- }
- return encodeURIComponent(c);
- }
- function percentEscapeQuery(c) {
- var unicode = c.charCodeAt(0);
- if (unicode > 0x20 && unicode < 0x7F && [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) === -1) {
- return c;
- }
- return encodeURIComponent(c);
- }
- var EOF,
- ALPHA = /[a-zA-Z]/,
- ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
- function parse(input, stateOverride, base) {
- function err(message) {
- errors.push(message);
- }
- var state = stateOverride || 'scheme start',
- cursor = 0,
- buffer = '',
- seenAt = false,
- seenBracket = false,
- errors = [];
- loop: while ((input[cursor - 1] !== EOF || cursor === 0) && !this._isInvalid) {
- var c = input[cursor];
- switch (state) {
- case 'scheme start':
- if (c && ALPHA.test(c)) {
- buffer += c.toLowerCase();
- state = 'scheme';
- } else if (!stateOverride) {
- buffer = '';
- state = 'no scheme';
- continue;
- } else {
- err('Invalid scheme.');
- break loop;
- }
- break;
- case 'scheme':
- if (c && ALPHANUMERIC.test(c)) {
- buffer += c.toLowerCase();
- } else if (c === ':') {
- this._scheme = buffer;
- buffer = '';
- if (stateOverride) {
- break loop;
- }
- if (isRelativeScheme(this._scheme)) {
- this._isRelative = true;
- }
- if (this._scheme === 'file') {
- state = 'relative';
- } else if (this._isRelative && base && base._scheme === this._scheme) {
- state = 'relative or authority';
- } else if (this._isRelative) {
- state = 'authority first slash';
- } else {
- state = 'scheme data';
- }
- } else if (!stateOverride) {
- buffer = '';
- cursor = 0;
- state = 'no scheme';
- continue;
- } else if (c === EOF) {
- break loop;
- } else {
- err('Code point not allowed in scheme: ' + c);
- break loop;
- }
- break;
- case 'scheme data':
- if (c === '?') {
- this._query = '?';
- state = 'query';
- } else if (c === '#') {
- this._fragment = '#';
- state = 'fragment';
- } else {
- if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') {
- this._schemeData += percentEscape(c);
- }
- }
- break;
- case 'no scheme':
- if (!base || !isRelativeScheme(base._scheme)) {
- err('Missing scheme.');
- invalid.call(this);
- } else {
- state = 'relative';
- continue;
- }
- break;
- case 'relative or authority':
- if (c === '/' && input[cursor + 1] === '/') {
- state = 'authority ignore slashes';
- } else {
- err('Expected /, got: ' + c);
- state = 'relative';
- continue;
- }
- break;
- case 'relative':
- this._isRelative = true;
- if (this._scheme !== 'file') {
- this._scheme = base._scheme;
- }
- if (c === EOF) {
- this._host = base._host;
- this._port = base._port;
- this._path = base._path.slice();
- this._query = base._query;
- this._username = base._username;
- this._password = base._password;
- break loop;
- } else if (c === '/' || c === '\\') {
- if (c === '\\') {
- err('\\ is an invalid code point.');
- }
- state = 'relative slash';
- } else if (c === '?') {
- this._host = base._host;
- this._port = base._port;
- this._path = base._path.slice();
- this._query = '?';
- this._username = base._username;
- this._password = base._password;
- state = 'query';
- } else if (c === '#') {
- this._host = base._host;
- this._port = base._port;
- this._path = base._path.slice();
- this._query = base._query;
- this._fragment = '#';
- this._username = base._username;
- this._password = base._password;
- state = 'fragment';
- } else {
- var nextC = input[cursor + 1];
- var nextNextC = input[cursor + 2];
- if (this._scheme !== 'file' || !ALPHA.test(c) || nextC !== ':' && nextC !== '|' || nextNextC !== EOF && nextNextC !== '/' && nextNextC !== '\\' && nextNextC !== '?' && nextNextC !== '#') {
- this._host = base._host;
- this._port = base._port;
- this._username = base._username;
- this._password = base._password;
- this._path = base._path.slice();
- this._path.pop();
- }
- state = 'relative path';
- continue;
- }
- break;
- case 'relative slash':
- if (c === '/' || c === '\\') {
- if (c === '\\') {
- err('\\ is an invalid code point.');
- }
- if (this._scheme === 'file') {
- state = 'file host';
- } else {
- state = 'authority ignore slashes';
- }
- } else {
- if (this._scheme !== 'file') {
- this._host = base._host;
- this._port = base._port;
- this._username = base._username;
- this._password = base._password;
- }
- state = 'relative path';
- continue;
- }
- break;
- case 'authority first slash':
- if (c === '/') {
- state = 'authority second slash';
- } else {
- err('Expected \'/\', got: ' + c);
- state = 'authority ignore slashes';
- continue;
- }
- break;
- case 'authority second slash':
- state = 'authority ignore slashes';
- if (c !== '/') {
- err('Expected \'/\', got: ' + c);
- continue;
- }
- break;
- case 'authority ignore slashes':
- if (c !== '/' && c !== '\\') {
- state = 'authority';
- continue;
- } else {
- err('Expected authority, got: ' + c);
- }
- break;
- case 'authority':
- if (c === '@') {
- if (seenAt) {
- err('@ already seen.');
- buffer += '%40';
- }
- seenAt = true;
- for (var i = 0; i < buffer.length; i++) {
- var cp = buffer[i];
- if (cp === '\t' || cp === '\n' || cp === '\r') {
- err('Invalid whitespace in authority.');
- continue;
- }
- if (cp === ':' && this._password === null) {
- this._password = '';
- continue;
- }
- var tempC = percentEscape(cp);
- if (this._password !== null) {
- this._password += tempC;
- } else {
- this._username += tempC;
- }
- }
- buffer = '';
- } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
- cursor -= buffer.length;
- buffer = '';
- state = 'host';
- continue;
- } else {
- buffer += c;
- }
- break;
- case 'file host':
- if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
- if (buffer.length === 2 && ALPHA.test(buffer[0]) && (buffer[1] === ':' || buffer[1] === '|')) {
- state = 'relative path';
- } else if (buffer.length === 0) {
- state = 'relative path start';
- } else {
- this._host = IDNAToASCII.call(this, buffer);
- buffer = '';
- state = 'relative path start';
- }
- continue;
- } else if (c === '\t' || c === '\n' || c === '\r') {
- err('Invalid whitespace in file host.');
- } else {
- buffer += c;
- }
- break;
- case 'host':
- case 'hostname':
- if (c === ':' && !seenBracket) {
- this._host = IDNAToASCII.call(this, buffer);
- buffer = '';
- state = 'port';
- if (stateOverride === 'hostname') {
- break loop;
- }
- } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
- this._host = IDNAToASCII.call(this, buffer);
- buffer = '';
- state = 'relative path start';
- if (stateOverride) {
- break loop;
- }
- continue;
- } else if (c !== '\t' && c !== '\n' && c !== '\r') {
- if (c === '[') {
- seenBracket = true;
- } else if (c === ']') {
- seenBracket = false;
- }
- buffer += c;
- } else {
- err('Invalid code point in host/hostname: ' + c);
- }
- break;
- case 'port':
- if (/[0-9]/.test(c)) {
- buffer += c;
- } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#' || stateOverride) {
- if (buffer !== '') {
- var temp = parseInt(buffer, 10);
- if (temp !== relative[this._scheme]) {
- this._port = temp + '';
- }
- buffer = '';
- }
- if (stateOverride) {
- break loop;
- }
- state = 'relative path start';
- continue;
- } else if (c === '\t' || c === '\n' || c === '\r') {
- err('Invalid code point in port: ' + c);
- } else {
- invalid.call(this);
- }
- break;
- case 'relative path start':
- if (c === '\\') {
- err('\'\\\' not allowed in path.');
- }
- state = 'relative path';
- if (c !== '/' && c !== '\\') {
- continue;
- }
- break;
- case 'relative path':
- if (c === EOF || c === '/' || c === '\\' || !stateOverride && (c === '?' || c === '#')) {
- if (c === '\\') {
- err('\\ not allowed in relative path.');
- }
- var tmp;
- if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
- buffer = tmp;
- }
- if (buffer === '..') {
- this._path.pop();
- if (c !== '/' && c !== '\\') {
- this._path.push('');
- }
- } else if (buffer === '.' && c !== '/' && c !== '\\') {
- this._path.push('');
- } else if (buffer !== '.') {
- if (this._scheme === 'file' && this._path.length === 0 && buffer.length === 2 && ALPHA.test(buffer[0]) && buffer[1] === '|') {
- buffer = buffer[0] + ':';
- }
- this._path.push(buffer);
- }
- buffer = '';
- if (c === '?') {
- this._query = '?';
- state = 'query';
- } else if (c === '#') {
- this._fragment = '#';
- state = 'fragment';
- }
- } else if (c !== '\t' && c !== '\n' && c !== '\r') {
- buffer += percentEscape(c);
- }
- break;
- case 'query':
- if (!stateOverride && c === '#') {
- this._fragment = '#';
- state = 'fragment';
- } else if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') {
- this._query += percentEscapeQuery(c);
- }
- break;
- case 'fragment':
- if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') {
- this._fragment += c;
- }
- break;
- }
- cursor++;
- }
- }
- function clear() {
- this._scheme = '';
- this._schemeData = '';
- this._username = '';
- this._password = null;
- this._host = '';
- this._port = '';
- this._path = [];
- this._query = '';
- this._fragment = '';
- this._isInvalid = false;
- this._isRelative = false;
- }
- function JURL(url, base) {
- if (base !== undefined && !(base instanceof JURL)) {
- base = new JURL(String(base));
- }
- this._url = url;
- clear.call(this);
- var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, '');
- parse.call(this, input, null, base);
- }
- JURL.prototype = {
- toString: function toString() {
- return this.href;
- },
-
- get href() {
- if (this._isInvalid) {
- return this._url;
- }
- var authority = '';
- if (this._username !== '' || this._password !== null) {
- authority = this._username + (this._password !== null ? ':' + this._password : '') + '@';
- }
- return this.protocol + (this._isRelative ? '//' + authority + this.host : '') + this.pathname + this._query + this._fragment;
- },
- set href(value) {
- clear.call(this);
- parse.call(this, value);
- },
- get protocol() {
- return this._scheme + ':';
- },
- set protocol(value) {
- if (this._isInvalid) {
- return;
- }
- parse.call(this, value + ':', 'scheme start');
- },
- get host() {
- return this._isInvalid ? '' : this._port ? this._host + ':' + this._port : this._host;
- },
- set host(value) {
- if (this._isInvalid || !this._isRelative) {
- return;
- }
- parse.call(this, value, 'host');
- },
- get hostname() {
- return this._host;
- },
- set hostname(value) {
- if (this._isInvalid || !this._isRelative) {
- return;
- }
- parse.call(this, value, 'hostname');
- },
- get port() {
- return this._port;
- },
- set port(value) {
- if (this._isInvalid || !this._isRelative) {
- return;
- }
- parse.call(this, value, 'port');
- },
- get pathname() {
- return this._isInvalid ? '' : this._isRelative ? '/' + this._path.join('/') : this._schemeData;
- },
- set pathname(value) {
- if (this._isInvalid || !this._isRelative) {
- return;
- }
- this._path = [];
- parse.call(this, value, 'relative path start');
- },
- get search() {
- return this._isInvalid || !this._query || this._query === '?' ? '' : this._query;
- },
- set search(value) {
- if (this._isInvalid || !this._isRelative) {
- return;
- }
- this._query = '?';
- if (value[0] === '?') {
- value = value.slice(1);
- }
- parse.call(this, value, 'query');
- },
- get hash() {
- return this._isInvalid || !this._fragment || this._fragment === '#' ? '' : this._fragment;
- },
- set hash(value) {
- if (this._isInvalid) {
- return;
- }
- this._fragment = '#';
- if (value[0] === '#') {
- value = value.slice(1);
- }
- parse.call(this, value, 'fragment');
- },
- get origin() {
- var host;
- if (this._isInvalid || !this._scheme) {
- return '';
- }
- switch (this._scheme) {
- case 'data':
- case 'file':
- case 'javascript':
- case 'mailto':
- return 'null';
- case 'blob':
- try {
- return new JURL(this._schemeData).origin || 'null';
- } catch (_) {}
- return 'null';
- }
- host = this.host;
- if (!host) {
- return '';
- }
- return this._scheme + '://' + host;
- }
- };
- exports.URL = JURL;
-})();
-
-/***/ }),
-/* 130 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.NetworkPdfManager = exports.LocalPdfManager = undefined;
-
-var _regenerator = __w_pdfjs_require__(131);
-
-var _regenerator2 = _interopRequireDefault(_regenerator);
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _util = __w_pdfjs_require__(2);
-
-var _chunked_stream = __w_pdfjs_require__(135);
-
-var _document = __w_pdfjs_require__(136);
-
-var _stream = __w_pdfjs_require__(140);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
-
-function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
-
-function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var BasePdfManager = function () {
- function BasePdfManager() {
- _classCallCheck(this, BasePdfManager);
-
- if (this.constructor === BasePdfManager) {
- (0, _util.unreachable)('Cannot initialize BasePdfManager.');
- }
- }
-
- _createClass(BasePdfManager, [{
- key: 'onLoadedStream',
- value: function onLoadedStream() {
- (0, _util.unreachable)('Abstract method `onLoadedStream` called');
- }
- }, {
- key: 'ensureDoc',
- value: function ensureDoc(prop, args) {
- return this.ensure(this.pdfDocument, prop, args);
- }
- }, {
- key: 'ensureXRef',
- value: function ensureXRef(prop, args) {
- return this.ensure(this.pdfDocument.xref, prop, args);
- }
- }, {
- key: 'ensureCatalog',
- value: function ensureCatalog(prop, args) {
- return this.ensure(this.pdfDocument.catalog, prop, args);
- }
- }, {
- key: 'getPage',
- value: function getPage(pageIndex) {
- return this.pdfDocument.getPage(pageIndex);
- }
- }, {
- key: 'cleanup',
- value: function cleanup() {
- return this.pdfDocument.cleanup();
- }
- }, {
- key: 'ensure',
- value: function () {
- var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee(obj, prop, args) {
- return _regenerator2.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- (0, _util.unreachable)('Abstract method `ensure` called');
-
- case 1:
- case 'end':
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
-
- function ensure(_x, _x2, _x3) {
- return _ref.apply(this, arguments);
- }
-
- return ensure;
- }()
- }, {
- key: 'requestRange',
- value: function requestRange(begin, end) {
- (0, _util.unreachable)('Abstract method `requestRange` called');
- }
- }, {
- key: 'requestLoadedStream',
- value: function requestLoadedStream() {
- (0, _util.unreachable)('Abstract method `requestLoadedStream` called');
- }
- }, {
- key: 'sendProgressiveData',
- value: function sendProgressiveData(chunk) {
- (0, _util.unreachable)('Abstract method `sendProgressiveData` called');
- }
- }, {
- key: 'updatePassword',
- value: function updatePassword(password) {
- this._password = password;
- }
- }, {
- key: 'terminate',
- value: function terminate() {
- (0, _util.unreachable)('Abstract method `terminate` called');
- }
- }, {
- key: 'docId',
- get: function get() {
- return this._docId;
- }
- }, {
- key: 'password',
- get: function get() {
- return this._password;
- }
- }, {
- key: 'docBaseUrl',
- get: function get() {
- var docBaseUrl = null;
- if (this._docBaseUrl) {
- var absoluteUrl = (0, _util.createValidAbsoluteUrl)(this._docBaseUrl);
- if (absoluteUrl) {
- docBaseUrl = absoluteUrl.href;
- } else {
- (0, _util.warn)('Invalid absolute docBaseUrl: "' + this._docBaseUrl + '".');
- }
- }
- return (0, _util.shadow)(this, 'docBaseUrl', docBaseUrl);
- }
- }]);
-
- return BasePdfManager;
-}();
-
-var LocalPdfManager = function (_BasePdfManager) {
- _inherits(LocalPdfManager, _BasePdfManager);
-
- function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) {
- _classCallCheck(this, LocalPdfManager);
-
- var _this = _possibleConstructorReturn(this, (LocalPdfManager.__proto__ || Object.getPrototypeOf(LocalPdfManager)).call(this));
-
- _this._docId = docId;
- _this._password = password;
- _this._docBaseUrl = docBaseUrl;
- _this.evaluatorOptions = evaluatorOptions;
- var stream = new _stream.Stream(data);
- _this.pdfDocument = new _document.PDFDocument(_this, stream);
- _this._loadedStreamPromise = Promise.resolve(stream);
- return _this;
- }
-
- _createClass(LocalPdfManager, [{
- key: 'ensure',
- value: function () {
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2(obj, prop, args) {
- var value;
- return _regenerator2.default.wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- value = obj[prop];
-
- if (!(typeof value === 'function')) {
- _context2.next = 3;
- break;
- }
-
- return _context2.abrupt('return', value.apply(obj, args));
-
- case 3:
- return _context2.abrupt('return', value);
-
- case 4:
- case 'end':
- return _context2.stop();
- }
- }
- }, _callee2, this);
- }));
-
- function ensure(_x4, _x5, _x6) {
- return _ref2.apply(this, arguments);
- }
-
- return ensure;
- }()
- }, {
- key: 'requestRange',
- value: function requestRange(begin, end) {
- return Promise.resolve();
- }
- }, {
- key: 'requestLoadedStream',
- value: function requestLoadedStream() {}
- }, {
- key: 'onLoadedStream',
- value: function onLoadedStream() {
- return this._loadedStreamPromise;
- }
- }, {
- key: 'terminate',
- value: function terminate() {}
- }]);
-
- return LocalPdfManager;
-}(BasePdfManager);
-
-var NetworkPdfManager = function (_BasePdfManager2) {
- _inherits(NetworkPdfManager, _BasePdfManager2);
-
- function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
- _classCallCheck(this, NetworkPdfManager);
-
- var _this2 = _possibleConstructorReturn(this, (NetworkPdfManager.__proto__ || Object.getPrototypeOf(NetworkPdfManager)).call(this));
-
- _this2._docId = docId;
- _this2._password = args.password;
- _this2._docBaseUrl = docBaseUrl;
- _this2.msgHandler = args.msgHandler;
- _this2.evaluatorOptions = evaluatorOptions;
- _this2.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
- msgHandler: args.msgHandler,
- url: args.url,
- length: args.length,
- disableAutoFetch: args.disableAutoFetch,
- rangeChunkSize: args.rangeChunkSize
- });
- _this2.pdfDocument = new _document.PDFDocument(_this2, _this2.streamManager.getStream());
- return _this2;
- }
-
- _createClass(NetworkPdfManager, [{
- key: 'ensure',
- value: function () {
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee3(obj, prop, args) {
- var value;
- return _regenerator2.default.wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- _context3.prev = 0;
- value = obj[prop];
-
- if (!(typeof value === 'function')) {
- _context3.next = 4;
- break;
- }
-
- return _context3.abrupt('return', value.apply(obj, args));
-
- case 4:
- return _context3.abrupt('return', value);
-
- case 7:
- _context3.prev = 7;
- _context3.t0 = _context3['catch'](0);
-
- if (_context3.t0 instanceof _util.MissingDataException) {
- _context3.next = 11;
- break;
- }
-
- throw _context3.t0;
-
- case 11:
- _context3.next = 13;
- return this.requestRange(_context3.t0.begin, _context3.t0.end);
-
- case 13:
- return _context3.abrupt('return', this.ensure(obj, prop, args));
-
- case 14:
- case 'end':
- return _context3.stop();
- }
- }
- }, _callee3, this, [[0, 7]]);
- }));
-
- function ensure(_x7, _x8, _x9) {
- return _ref3.apply(this, arguments);
- }
-
- return ensure;
- }()
- }, {
- key: 'requestRange',
- value: function requestRange(begin, end) {
- return this.streamManager.requestRange(begin, end);
- }
- }, {
- key: 'requestLoadedStream',
- value: function requestLoadedStream() {
- this.streamManager.requestAllChunks();
- }
- }, {
- key: 'sendProgressiveData',
- value: function sendProgressiveData(chunk) {
- this.streamManager.onReceiveData({ chunk: chunk });
- }
- }, {
- key: 'onLoadedStream',
- value: function onLoadedStream() {
- return this.streamManager.onLoadedStream();
- }
- }, {
- key: 'terminate',
- value: function terminate() {
- this.streamManager.abort();
- }
- }]);
-
- return NetworkPdfManager;
-}(BasePdfManager);
-
-exports.LocalPdfManager = LocalPdfManager;
-exports.NetworkPdfManager = NetworkPdfManager;
-
-/***/ }),
-/* 131 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = __w_pdfjs_require__(132);
-
-/***/ }),
-/* 132 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-var g = function () {
- return this;
-}() || 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__(133);
-if (hadRuntime) {
- g.regeneratorRuntime = oldRuntime;
-} else {
- try {
- delete g.regeneratorRuntime;
- } catch (e) {
- g.regeneratorRuntime = undefined;
- }
-}
-
-/***/ }),
-/* 133 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(module) {
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-!function (global) {
- "use strict";
-
- var Op = Object.prototype;
- var hasOwn = Op.hasOwnProperty;
- var undefined;
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
- 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;
- var generator = Object.create(protoGenerator.prototype);
- var context = new Context(tryLocsList || []);
- generator._invoke = makeInvokeMethod(innerFn, self, context);
- return generator;
- }
- runtime.wrap = wrap;
- function tryCatch(fn, obj, arg) {
- try {
- return {
- type: "normal",
- arg: fn.call(obj, arg)
- };
- } catch (err) {
- return {
- type: "throw",
- arg: err
- };
- }
- }
- var GenStateSuspendedStart = "suspendedStart";
- var GenStateSuspendedYield = "suspendedYield";
- var GenStateExecuting = "executing";
- var GenStateCompleted = "completed";
- var ContinueSentinel = {};
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
- var IteratorPrototype = {};
- IteratorPrototype[iteratorSymbol] = function () {
- return this;
- };
- var getProto = Object.getPrototypeOf;
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
- if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
- IteratorPrototype = NativeIteratorPrototype;
- }
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
- GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
- GeneratorFunctionPrototype.constructor = GeneratorFunction;
- GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction";
- function defineIteratorMethods(prototype) {
- ["next", "throw", "return"].forEach(function (method) {
- prototype[method] = function (arg) {
- return this._invoke(method, arg);
- };
- });
- }
- runtime.isGeneratorFunction = function (genFun) {
- var ctor = typeof genFun === "function" && genFun.constructor;
- return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
- };
- runtime.mark = function (genFun) {
- if (Object.setPrototypeOf) {
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
- } else {
- genFun.__proto__ = GeneratorFunctionPrototype;
- if (!(toStringTagSymbol in genFun)) {
- genFun[toStringTagSymbol] = "GeneratorFunction";
- }
- }
- genFun.prototype = Object.create(Gp);
- return genFun;
- };
- runtime.awrap = function (arg) {
- return { __await: arg };
- };
- function AsyncIterator(generator) {
- function invoke(method, arg, resolve, reject) {
- var record = tryCatch(generator[method], generator, arg);
- if (record.type === "throw") {
- reject(record.arg);
- } else {
- var result = record.arg;
- var value = result.value;
- if (value && (typeof value === "undefined" ? "undefined" : _typeof(value)) === "object" && hasOwn.call(value, "__await")) {
- return Promise.resolve(value.__await).then(function (value) {
- invoke("next", value, resolve, reject);
- }, function (err) {
- invoke("throw", err, resolve, reject);
- });
- }
- return Promise.resolve(value).then(function (unwrapped) {
- result.value = unwrapped;
- resolve(result);
- }, reject);
- }
- }
- var previousPromise;
- function enqueue(method, arg) {
- function callInvokeWithMethodAndArg() {
- return new Promise(function (resolve, reject) {
- invoke(method, arg, resolve, reject);
- });
- }
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
- }
- this._invoke = enqueue;
- }
- defineIteratorMethods(AsyncIterator.prototype);
- AsyncIterator.prototype[asyncIteratorSymbol] = function () {
- return this;
- };
- runtime.AsyncIterator = AsyncIterator;
- runtime.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 result.done ? result.value : iter.next();
- });
- };
- function makeInvokeMethod(innerFn, self, context) {
- var state = GenStateSuspendedStart;
- return function invoke(method, arg) {
- if (state === GenStateExecuting) {
- throw new Error("Generator is already running");
- }
- if (state === GenStateCompleted) {
- if (method === "throw") {
- throw arg;
- }
- return doneResult();
- }
- context.method = method;
- context.arg = arg;
- while (true) {
- var delegate = context.delegate;
- if (delegate) {
- var delegateResult = maybeInvokeDelegate(delegate, context);
- if (delegateResult) {
- if (delegateResult === ContinueSentinel) continue;
- return delegateResult;
- }
- }
- if (context.method === "next") {
- context.sent = context._sent = context.arg;
- } else if (context.method === "throw") {
- if (state === GenStateSuspendedStart) {
- state = GenStateCompleted;
- throw context.arg;
- }
- context.dispatchException(context.arg);
- } else if (context.method === "return") {
- context.abrupt("return", context.arg);
- }
- state = GenStateExecuting;
- var record = tryCatch(innerFn, self, context);
- if (record.type === "normal") {
- state = context.done ? GenStateCompleted : GenStateSuspendedYield;
- if (record.arg === ContinueSentinel) {
- continue;
- }
- return {
- value: record.arg,
- done: context.done
- };
- } else if (record.type === "throw") {
- state = GenStateCompleted;
- context.method = "throw";
- context.arg = record.arg;
- }
- }
- };
- }
- function maybeInvokeDelegate(delegate, context) {
- var method = delegate.iterator[context.method];
- if (method === undefined) {
- context.delegate = null;
- if (context.method === "throw") {
- if (delegate.iterator.return) {
- context.method = "return";
- context.arg = undefined;
- maybeInvokeDelegate(delegate, context);
- if (context.method === "throw") {
- return ContinueSentinel;
- }
- }
- context.method = "throw";
- context.arg = new TypeError("The iterator does not provide a 'throw' method");
- }
- return ContinueSentinel;
- }
- var record = tryCatch(method, delegate.iterator, context.arg);
- if (record.type === "throw") {
- context.method = "throw";
- context.arg = record.arg;
- context.delegate = null;
- return ContinueSentinel;
- }
- var info = record.arg;
- if (!info) {
- context.method = "throw";
- context.arg = new TypeError("iterator result is not an object");
- context.delegate = null;
- return ContinueSentinel;
- }
- if (info.done) {
- context[delegate.resultName] = info.value;
- context.next = delegate.nextLoc;
- if (context.method !== "return") {
- context.method = "next";
- context.arg = undefined;
- }
- } else {
- return info;
- }
- context.delegate = null;
- return ContinueSentinel;
- }
- defineIteratorMethods(Gp);
- Gp[toStringTagSymbol] = "Generator";
- Gp[iteratorSymbol] = function () {
- return this;
- };
- Gp.toString = function () {
- return "[object Generator]";
- };
- function pushTryEntry(locs) {
- var entry = { tryLoc: locs[0] };
- if (1 in locs) {
- entry.catchLoc = locs[1];
- }
- if (2 in locs) {
- entry.finallyLoc = locs[2];
- entry.afterLoc = locs[3];
- }
- this.tryEntries.push(entry);
- }
- function resetTryEntry(entry) {
- var record = entry.completion || {};
- record.type = "normal";
- delete record.arg;
- entry.completion = record;
- }
- function Context(tryLocsList) {
- this.tryEntries = [{ tryLoc: "root" }];
- tryLocsList.forEach(pushTryEntry, this);
- this.reset(true);
- }
- runtime.keys = function (object) {
- var keys = [];
- for (var key in object) {
- keys.push(key);
- }
- keys.reverse();
- return function next() {
- while (keys.length) {
- var key = keys.pop();
- if (key in object) {
- next.value = key;
- next.done = false;
- return next;
- }
- }
- next.done = true;
- return next;
- };
- };
- function values(iterable) {
- if (iterable) {
- var iteratorMethod = iterable[iteratorSymbol];
- if (iteratorMethod) {
- return iteratorMethod.call(iterable);
- }
- if (typeof iterable.next === "function") {
- return iterable;
- }
- if (!isNaN(iterable.length)) {
- var i = -1,
- next = function next() {
- while (++i < iterable.length) {
- if (hasOwn.call(iterable, i)) {
- next.value = iterable[i];
- next.done = false;
- return next;
- }
- }
- next.value = undefined;
- next.done = true;
- return next;
- };
- return next.next = next;
- }
- }
- return { next: doneResult };
- }
- runtime.values = values;
- function doneResult() {
- return {
- value: undefined,
- done: true
- };
- }
- Context.prototype = {
- constructor: Context,
- reset: function reset(skipTempReset) {
- this.prev = 0;
- this.next = 0;
- this.sent = this._sent = undefined;
- this.done = false;
- this.delegate = null;
- this.method = "next";
- this.arg = undefined;
- this.tryEntries.forEach(resetTryEntry);
- if (!skipTempReset) {
- for (var name in this) {
- if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
- this[name] = undefined;
- }
- }
- }
- },
- stop: function stop() {
- this.done = true;
- var rootEntry = this.tryEntries[0];
- var rootRecord = rootEntry.completion;
- if (rootRecord.type === "throw") {
- throw rootRecord.arg;
- }
- return this.rval;
- },
- dispatchException: function dispatchException(exception) {
- if (this.done) {
- throw exception;
- }
- var context = this;
- function handle(loc, caught) {
- record.type = "throw";
- record.arg = exception;
- context.next = loc;
- if (caught) {
- context.method = "next";
- context.arg = undefined;
- }
- return !!caught;
- }
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- var record = entry.completion;
- if (entry.tryLoc === "root") {
- return handle("end");
- }
- if (entry.tryLoc <= this.prev) {
- var hasCatch = hasOwn.call(entry, "catchLoc");
- var hasFinally = hasOwn.call(entry, "finallyLoc");
- if (hasCatch && hasFinally) {
- if (this.prev < entry.catchLoc) {
- return handle(entry.catchLoc, true);
- } else if (this.prev < entry.finallyLoc) {
- return handle(entry.finallyLoc);
- }
- } else if (hasCatch) {
- if (this.prev < entry.catchLoc) {
- return handle(entry.catchLoc, true);
- }
- } else if (hasFinally) {
- if (this.prev < entry.finallyLoc) {
- return handle(entry.finallyLoc);
- }
- } else {
- throw new Error("try statement without catch or finally");
- }
- }
- }
- },
- abrupt: function abrupt(type, arg) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
- var finallyEntry = entry;
- break;
- }
- }
- if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
- finallyEntry = null;
- }
- var record = finallyEntry ? finallyEntry.completion : {};
- record.type = type;
- record.arg = arg;
- if (finallyEntry) {
- this.method = "next";
- this.next = finallyEntry.finallyLoc;
- return ContinueSentinel;
- }
- return this.complete(record);
- },
- complete: function complete(record, afterLoc) {
- if (record.type === "throw") {
- throw record.arg;
- }
- if (record.type === "break" || record.type === "continue") {
- this.next = record.arg;
- } else if (record.type === "return") {
- this.rval = this.arg = record.arg;
- this.method = "return";
- this.next = "end";
- } else if (record.type === "normal" && afterLoc) {
- this.next = afterLoc;
- }
- return ContinueSentinel;
- },
- finish: function finish(finallyLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.finallyLoc === finallyLoc) {
- this.complete(entry.completion, entry.afterLoc);
- resetTryEntry(entry);
- return ContinueSentinel;
- }
- }
- },
- "catch": function _catch(tryLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc === tryLoc) {
- var record = entry.completion;
- if (record.type === "throw") {
- var thrown = record.arg;
- resetTryEntry(entry);
- }
- return thrown;
- }
- }
- throw new Error("illegal catch attempt");
- },
- delegateYield: function delegateYield(iterable, resultName, nextLoc) {
- this.delegate = {
- iterator: values(iterable),
- resultName: resultName,
- nextLoc: nextLoc
- };
- if (this.method === "next") {
- this.arg = undefined;
- }
- return ContinueSentinel;
- }
- };
-}(function () {
- return this;
-}() || Function("return this")());
-/* WEBPACK VAR INJECTION */}.call(this, __w_pdfjs_require__(134)(module)))
-
-/***/ }),
-/* 134 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-module.exports = function (module) {
- if (!module.webpackPolyfill) {
- module.deprecate = function () {};
- module.paths = [];
- if (!module.children) module.children = [];
- Object.defineProperty(module, "loaded", {
- enumerable: true,
- get: function get() {
- return module.l;
- }
- });
- Object.defineProperty(module, "id", {
- enumerable: true,
- get: function get() {
- return module.i;
- }
- });
- module.webpackPolyfill = 1;
- }
- return module;
-};
-
-/***/ }),
-/* 135 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.ChunkedStreamManager = exports.ChunkedStream = undefined;
-
-var _util = __w_pdfjs_require__(2);
-
-var ChunkedStream = function ChunkedStreamClosure() {
- function ChunkedStream(length, chunkSize, manager) {
- this.bytes = new Uint8Array(length);
- this.start = 0;
- this.pos = 0;
- this.end = length;
- this.chunkSize = chunkSize;
- this.loadedChunks = [];
- this.numChunksLoaded = 0;
- this.numChunks = Math.ceil(length / chunkSize);
- this.manager = manager;
- this.progressiveDataLength = 0;
- this.lastSuccessfulEnsureByteChunk = -1;
- }
- ChunkedStream.prototype = {
- getMissingChunks: function ChunkedStream_getMissingChunks() {
- var chunks = [];
- for (var chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
- if (!this.loadedChunks[chunk]) {
- chunks.push(chunk);
- }
- }
- return chunks;
- },
- getBaseStreams: function ChunkedStream_getBaseStreams() {
- return [this];
- },
- allChunksLoaded: function ChunkedStream_allChunksLoaded() {
- return this.numChunksLoaded === this.numChunks;
- },
- onReceiveData: function ChunkedStream_onReceiveData(begin, chunk) {
- var end = begin + chunk.byteLength;
- if (begin % this.chunkSize !== 0) {
- throw new Error('Bad begin offset: ' + begin);
- }
- var length = this.bytes.length;
- if (end % this.chunkSize !== 0 && end !== length) {
- throw new Error('Bad end offset: ' + end);
- }
- this.bytes.set(new Uint8Array(chunk), begin);
- var chunkSize = this.chunkSize;
- var beginChunk = Math.floor(begin / chunkSize);
- var endChunk = Math.floor((end - 1) / chunkSize) + 1;
- var curChunk;
- for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
- if (!this.loadedChunks[curChunk]) {
- this.loadedChunks[curChunk] = true;
- ++this.numChunksLoaded;
- }
- }
- },
- onReceiveProgressiveData: function ChunkedStream_onReceiveProgressiveData(data) {
- var position = this.progressiveDataLength;
- var beginChunk = Math.floor(position / this.chunkSize);
- this.bytes.set(new Uint8Array(data), position);
- position += data.byteLength;
- this.progressiveDataLength = position;
- var endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
- var curChunk;
- for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
- if (!this.loadedChunks[curChunk]) {
- this.loadedChunks[curChunk] = true;
- ++this.numChunksLoaded;
- }
- }
- },
- ensureByte: function ChunkedStream_ensureByte(pos) {
- var chunk = Math.floor(pos / this.chunkSize);
- if (chunk === this.lastSuccessfulEnsureByteChunk) {
- return;
- }
- if (!this.loadedChunks[chunk]) {
- throw new _util.MissingDataException(pos, pos + 1);
- }
- this.lastSuccessfulEnsureByteChunk = chunk;
- },
- ensureRange: function ChunkedStream_ensureRange(begin, end) {
- if (begin >= end) {
- return;
- }
- if (end <= this.progressiveDataLength) {
- return;
- }
- var chunkSize = this.chunkSize;
- var beginChunk = Math.floor(begin / chunkSize);
- var endChunk = Math.floor((end - 1) / chunkSize) + 1;
- for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
- if (!this.loadedChunks[chunk]) {
- throw new _util.MissingDataException(begin, end);
- }
- }
- },
- nextEmptyChunk: function ChunkedStream_nextEmptyChunk(beginChunk) {
- var chunk,
- numChunks = this.numChunks;
- for (var i = 0; i < numChunks; ++i) {
- chunk = (beginChunk + i) % numChunks;
- if (!this.loadedChunks[chunk]) {
- return chunk;
- }
- }
- return null;
- },
- hasChunk: function ChunkedStream_hasChunk(chunk) {
- return !!this.loadedChunks[chunk];
- },
- get length() {
- return this.end - this.start;
- },
- get isEmpty() {
- return this.length === 0;
- },
- getByte: function ChunkedStream_getByte() {
- var pos = this.pos;
- if (pos >= this.end) {
- return -1;
- }
- this.ensureByte(pos);
- return this.bytes[this.pos++];
- },
- getUint16: function ChunkedStream_getUint16() {
- var b0 = this.getByte();
- var b1 = this.getByte();
- if (b0 === -1 || b1 === -1) {
- return -1;
- }
- return (b0 << 8) + b1;
- },
- getInt32: function ChunkedStream_getInt32() {
- var b0 = this.getByte();
- var b1 = this.getByte();
- var b2 = this.getByte();
- var b3 = this.getByte();
- return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
- },
- getBytes: function getBytes(length) {
- var forceClamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
-
- var bytes = this.bytes;
- var pos = this.pos;
- var strEnd = this.end;
- if (!length) {
- this.ensureRange(pos, strEnd);
- var _subarray = bytes.subarray(pos, strEnd);
- return forceClamped ? new Uint8ClampedArray(_subarray) : _subarray;
- }
- var end = pos + length;
- if (end > strEnd) {
- end = strEnd;
- }
- this.ensureRange(pos, end);
- this.pos = end;
- var subarray = bytes.subarray(pos, end);
- return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
- },
-
- peekByte: function ChunkedStream_peekByte() {
- var peekedByte = this.getByte();
- this.pos--;
- return peekedByte;
- },
- peekBytes: function peekBytes(length) {
- var forceClamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
-
- var bytes = this.getBytes(length, forceClamped);
- this.pos -= bytes.length;
- return bytes;
- },
-
- getByteRange: function ChunkedStream_getBytes(begin, end) {
- this.ensureRange(begin, end);
- return this.bytes.subarray(begin, end);
- },
- skip: function ChunkedStream_skip(n) {
- if (!n) {
- n = 1;
- }
- this.pos += n;
- },
- reset: function ChunkedStream_reset() {
- this.pos = this.start;
- },
- moveStart: function ChunkedStream_moveStart() {
- this.start = this.pos;
- },
- makeSubStream: function ChunkedStream_makeSubStream(start, length, dict) {
- this.ensureRange(start, start + length);
- function ChunkedStreamSubstream() {}
- ChunkedStreamSubstream.prototype = Object.create(this);
- ChunkedStreamSubstream.prototype.getMissingChunks = function () {
- var chunkSize = this.chunkSize;
- var beginChunk = Math.floor(this.start / chunkSize);
- var endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
- var missingChunks = [];
- for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
- if (!this.loadedChunks[chunk]) {
- missingChunks.push(chunk);
- }
- }
- return missingChunks;
- };
- var subStream = new ChunkedStreamSubstream();
- subStream.pos = subStream.start = start;
- subStream.end = start + length || this.end;
- subStream.dict = dict;
- return subStream;
- }
- };
- return ChunkedStream;
-}();
-var ChunkedStreamManager = function ChunkedStreamManagerClosure() {
- function ChunkedStreamManager(pdfNetworkStream, args) {
- var chunkSize = args.rangeChunkSize;
- var length = args.length;
- this.stream = new ChunkedStream(length, chunkSize, this);
- this.length = length;
- this.chunkSize = chunkSize;
- this.pdfNetworkStream = pdfNetworkStream;
- this.url = args.url;
- this.disableAutoFetch = args.disableAutoFetch;
- this.msgHandler = args.msgHandler;
- this.currRequestId = 0;
- this.chunksNeededByRequest = Object.create(null);
- this.requestsByChunk = Object.create(null);
- this.promisesByRequest = Object.create(null);
- this.progressiveDataLength = 0;
- this.aborted = false;
- this._loadedStreamCapability = (0, _util.createPromiseCapability)();
- }
- ChunkedStreamManager.prototype = {
- onLoadedStream: function ChunkedStreamManager_getLoadedStream() {
- return this._loadedStreamCapability.promise;
- },
- sendRequest: function ChunkedStreamManager_sendRequest(begin, end) {
- var _this = this;
-
- var rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
- if (!rangeReader.isStreamingSupported) {
- rangeReader.onProgress = this.onProgress.bind(this);
- }
- var chunks = [],
- loaded = 0;
- var manager = this;
- var promise = new Promise(function (resolve, reject) {
- var readChunk = function readChunk(chunk) {
- try {
- if (!chunk.done) {
- var data = chunk.value;
- chunks.push(data);
- loaded += (0, _util.arrayByteLength)(data);
- if (rangeReader.isStreamingSupported) {
- manager.onProgress({ loaded: loaded });
- }
- rangeReader.read().then(readChunk, reject);
- return;
- }
- var chunkData = (0, _util.arraysToBytes)(chunks);
- chunks = null;
- resolve(chunkData);
- } catch (e) {
- reject(e);
- }
- };
- rangeReader.read().then(readChunk, reject);
- });
- promise.then(function (data) {
- if (_this.aborted) {
- return;
- }
- _this.onReceiveData({
- chunk: data,
- begin: begin
- });
- });
- },
- requestAllChunks: function ChunkedStreamManager_requestAllChunks() {
- var missingChunks = this.stream.getMissingChunks();
- this._requestChunks(missingChunks);
- return this._loadedStreamCapability.promise;
- },
- _requestChunks: function ChunkedStreamManager_requestChunks(chunks) {
- var requestId = this.currRequestId++;
- var i, ii;
- var chunksNeeded = Object.create(null);
- this.chunksNeededByRequest[requestId] = chunksNeeded;
- for (i = 0, ii = chunks.length; i < ii; i++) {
- if (!this.stream.hasChunk(chunks[i])) {
- chunksNeeded[chunks[i]] = true;
- }
- }
- if ((0, _util.isEmptyObj)(chunksNeeded)) {
- return Promise.resolve();
- }
- var capability = (0, _util.createPromiseCapability)();
- this.promisesByRequest[requestId] = capability;
- var chunksToRequest = [];
- for (var chunk in chunksNeeded) {
- chunk = chunk | 0;
- if (!(chunk in this.requestsByChunk)) {
- this.requestsByChunk[chunk] = [];
- chunksToRequest.push(chunk);
- }
- this.requestsByChunk[chunk].push(requestId);
- }
- if (!chunksToRequest.length) {
- return capability.promise;
- }
- var groupedChunksToRequest = this.groupChunks(chunksToRequest);
- for (i = 0; i < groupedChunksToRequest.length; ++i) {
- var groupedChunk = groupedChunksToRequest[i];
- var begin = groupedChunk.beginChunk * this.chunkSize;
- var end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
- this.sendRequest(begin, end);
- }
- return capability.promise;
- },
- getStream: function ChunkedStreamManager_getStream() {
- return this.stream;
- },
- requestRange: function ChunkedStreamManager_requestRange(begin, end) {
- end = Math.min(end, this.length);
- var beginChunk = this.getBeginChunk(begin);
- var endChunk = this.getEndChunk(end);
- var chunks = [];
- for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
- chunks.push(chunk);
- }
- return this._requestChunks(chunks);
- },
- requestRanges: function ChunkedStreamManager_requestRanges(ranges) {
- ranges = ranges || [];
- var chunksToRequest = [];
- for (var i = 0; i < ranges.length; i++) {
- var beginChunk = this.getBeginChunk(ranges[i].begin);
- var endChunk = this.getEndChunk(ranges[i].end);
- for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
- if (!chunksToRequest.includes(chunk)) {
- chunksToRequest.push(chunk);
- }
- }
- }
- chunksToRequest.sort(function (a, b) {
- return a - b;
- });
- return this._requestChunks(chunksToRequest);
- },
- groupChunks: function ChunkedStreamManager_groupChunks(chunks) {
- var groupedChunks = [];
- var beginChunk = -1;
- var prevChunk = -1;
- for (var i = 0; i < chunks.length; ++i) {
- var chunk = chunks[i];
- if (beginChunk < 0) {
- beginChunk = chunk;
- }
- if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
- groupedChunks.push({
- beginChunk: beginChunk,
- endChunk: prevChunk + 1
- });
- beginChunk = chunk;
- }
- if (i + 1 === chunks.length) {
- groupedChunks.push({
- beginChunk: beginChunk,
- endChunk: chunk + 1
- });
- }
- prevChunk = chunk;
- }
- return groupedChunks;
- },
- onProgress: function ChunkedStreamManager_onProgress(args) {
- var bytesLoaded = this.stream.numChunksLoaded * this.chunkSize + args.loaded;
- this.msgHandler.send('DocProgress', {
- loaded: bytesLoaded,
- total: this.length
- });
- },
- onReceiveData: function ChunkedStreamManager_onReceiveData(args) {
- var chunk = args.chunk;
- var isProgressive = args.begin === undefined;
- var begin = isProgressive ? this.progressiveDataLength : args.begin;
- var end = begin + chunk.byteLength;
- var beginChunk = Math.floor(begin / this.chunkSize);
- var endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
- if (isProgressive) {
- this.stream.onReceiveProgressiveData(chunk);
- this.progressiveDataLength = end;
- } else {
- this.stream.onReceiveData(begin, chunk);
- }
- if (this.stream.allChunksLoaded()) {
- this._loadedStreamCapability.resolve(this.stream);
- }
- var loadedRequests = [];
- var i, requestId;
- for (chunk = beginChunk; chunk < endChunk; ++chunk) {
- var requestIds = this.requestsByChunk[chunk] || [];
- delete this.requestsByChunk[chunk];
- for (i = 0; i < requestIds.length; ++i) {
- requestId = requestIds[i];
- var chunksNeeded = this.chunksNeededByRequest[requestId];
- if (chunk in chunksNeeded) {
- delete chunksNeeded[chunk];
- }
- if (!(0, _util.isEmptyObj)(chunksNeeded)) {
- continue;
- }
- loadedRequests.push(requestId);
- }
- }
- if (!this.disableAutoFetch && (0, _util.isEmptyObj)(this.requestsByChunk)) {
- var nextEmptyChunk;
- if (this.stream.numChunksLoaded === 1) {
- var lastChunk = this.stream.numChunks - 1;
- if (!this.stream.hasChunk(lastChunk)) {
- nextEmptyChunk = lastChunk;
- }
- } else {
- nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
- }
- if (Number.isInteger(nextEmptyChunk)) {
- this._requestChunks([nextEmptyChunk]);
- }
- }
- for (i = 0; i < loadedRequests.length; ++i) {
- requestId = loadedRequests[i];
- var capability = this.promisesByRequest[requestId];
- delete this.promisesByRequest[requestId];
- capability.resolve();
- }
- this.msgHandler.send('DocProgress', {
- loaded: this.stream.numChunksLoaded * this.chunkSize,
- total: this.length
- });
- },
- onError: function ChunkedStreamManager_onError(err) {
- this._loadedStreamCapability.reject(err);
- },
- getBeginChunk: function ChunkedStreamManager_getBeginChunk(begin) {
- var chunk = Math.floor(begin / this.chunkSize);
- return chunk;
- },
- getEndChunk: function ChunkedStreamManager_getEndChunk(end) {
- var chunk = Math.floor((end - 1) / this.chunkSize) + 1;
- return chunk;
- },
- abort: function ChunkedStreamManager_abort() {
- this.aborted = true;
- if (this.pdfNetworkStream) {
- this.pdfNetworkStream.cancelAllRequests('abort');
- }
- for (var requestId in this.promisesByRequest) {
- var capability = this.promisesByRequest[requestId];
- capability.reject(new Error('Request was aborted'));
- }
- }
- };
- return ChunkedStreamManager;
-}();
-exports.ChunkedStream = ChunkedStream;
-exports.ChunkedStreamManager = ChunkedStreamManager;
-
-/***/ }),
-/* 136 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.PDFDocument = exports.Page = undefined;
-
-var _slicedToArray = function () { function sliceIterator(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"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
-
-var _util = __w_pdfjs_require__(2);
-
-var _obj = __w_pdfjs_require__(137);
-
-var _primitives = __w_pdfjs_require__(138);
-
-var _stream = __w_pdfjs_require__(140);
-
-var _annotation = __w_pdfjs_require__(152);
-
-var _crypto = __w_pdfjs_require__(150);
-
-var _parser = __w_pdfjs_require__(139);
-
-var _operator_list = __w_pdfjs_require__(153);
-
-var _evaluator = __w_pdfjs_require__(154);
-
-var _function = __w_pdfjs_require__(168);
-
-var Page = function PageClosure() {
- var DEFAULT_USER_UNIT = 1.0;
- var LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
- function isAnnotationRenderable(annotation, intent) {
- return intent === 'display' && annotation.viewable || intent === 'print' && annotation.printable;
- }
- function Page(_ref) {
- var pdfManager = _ref.pdfManager,
- xref = _ref.xref,
- pageIndex = _ref.pageIndex,
- pageDict = _ref.pageDict,
- ref = _ref.ref,
- fontCache = _ref.fontCache,
- builtInCMapCache = _ref.builtInCMapCache,
- pdfFunctionFactory = _ref.pdfFunctionFactory;
-
- this.pdfManager = pdfManager;
- this.pageIndex = pageIndex;
- this.pageDict = pageDict;
- this.xref = xref;
- this.ref = ref;
- this.fontCache = fontCache;
- this.builtInCMapCache = builtInCMapCache;
- this.pdfFunctionFactory = pdfFunctionFactory;
- this.evaluatorOptions = pdfManager.evaluatorOptions;
- this.resourcesPromise = null;
- var uniquePrefix = 'p' + this.pageIndex + '_';
- var idCounters = { obj: 0 };
- this.idFactory = {
- createObjId: function createObjId() {
- return uniquePrefix + ++idCounters.obj;
- }
- };
- }
- Page.prototype = {
- _getInheritableProperty: function _getInheritableProperty(key) {
- var getArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
-
- var value = (0, _util.getInheritableProperty)({
- dict: this.pageDict,
- key: key,
- getArray: getArray,
- stopWhenFound: false
- });
- if (!Array.isArray(value)) {
- return value;
- }
- if (value.length === 1 || !(0, _primitives.isDict)(value[0])) {
- return value[0];
- }
- return _primitives.Dict.merge(this.xref, value);
- },
-
- get content() {
- return this.pageDict.get('Contents');
- },
- get resources() {
- return (0, _util.shadow)(this, 'resources', this._getInheritableProperty('Resources') || _primitives.Dict.empty);
- },
- get mediaBox() {
- var mediaBox = this._getInheritableProperty('MediaBox', true);
- if (!Array.isArray(mediaBox) || mediaBox.length !== 4) {
- return (0, _util.shadow)(this, 'mediaBox', LETTER_SIZE_MEDIABOX);
- }
- return (0, _util.shadow)(this, 'mediaBox', mediaBox);
- },
- get cropBox() {
- var cropBox = this._getInheritableProperty('CropBox', true);
- if (!Array.isArray(cropBox) || cropBox.length !== 4) {
- return (0, _util.shadow)(this, 'cropBox', this.mediaBox);
- }
- return (0, _util.shadow)(this, 'cropBox', cropBox);
- },
- get userUnit() {
- var obj = this.pageDict.get('UserUnit');
- if (!(0, _util.isNum)(obj) || obj <= 0) {
- obj = DEFAULT_USER_UNIT;
- }
- return (0, _util.shadow)(this, 'userUnit', obj);
- },
- get view() {
- var mediaBox = this.mediaBox,
- cropBox = this.cropBox;
- if (mediaBox === cropBox) {
- return (0, _util.shadow)(this, 'view', mediaBox);
- }
- var intersection = _util.Util.intersect(cropBox, mediaBox);
- return (0, _util.shadow)(this, 'view', intersection || mediaBox);
- },
- get rotate() {
- var rotate = this._getInheritableProperty('Rotate') || 0;
- if (rotate % 90 !== 0) {
- rotate = 0;
- } else if (rotate >= 360) {
- rotate = rotate % 360;
- } else if (rotate < 0) {
- rotate = (rotate % 360 + 360) % 360;
- }
- return (0, _util.shadow)(this, 'rotate', rotate);
- },
- getContentStream: function Page_getContentStream() {
- var content = this.content;
- var stream;
- if (Array.isArray(content)) {
- var xref = this.xref;
- var i,
- n = content.length;
- var streams = [];
- for (i = 0; i < n; ++i) {
- streams.push(xref.fetchIfRef(content[i]));
- }
- stream = new _stream.StreamsSequenceStream(streams);
- } else if ((0, _primitives.isStream)(content)) {
- stream = content;
- } else {
- stream = new _stream.NullStream();
- }
- return stream;
- },
- loadResources: function Page_loadResources(keys) {
- var _this = this;
-
- if (!this.resourcesPromise) {
- this.resourcesPromise = this.pdfManager.ensure(this, 'resources');
- }
- return this.resourcesPromise.then(function () {
- var objectLoader = new _obj.ObjectLoader(_this.resources, keys, _this.xref);
- return objectLoader.load();
- });
- },
- getOperatorList: function getOperatorList(_ref2) {
- var _this2 = this;
-
- var handler = _ref2.handler,
- task = _ref2.task,
- intent = _ref2.intent,
- renderInteractiveForms = _ref2.renderInteractiveForms;
-
- 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,
- idFactory: this.idFactory,
- fontCache: this.fontCache,
- builtInCMapCache: this.builtInCMapCache,
- options: this.evaluatorOptions,
- pdfFunctionFactory: this.pdfFunctionFactory
- });
- var dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
- var pageListPromise = dataPromises.then(function (_ref3) {
- var _ref4 = _slicedToArray(_ref3, 1),
- contentStream = _ref4[0];
-
- var opList = new _operator_list.OperatorList(intent, handler, _this2.pageIndex);
- handler.send('StartRenderPage', {
- transparency: partialEvaluator.hasBlendModes(_this2.resources),
- pageIndex: _this2.pageIndex,
- intent: intent
- });
- return partialEvaluator.getOperatorList({
- stream: contentStream,
- task: task,
- resources: _this2.resources,
- operatorList: opList
- }).then(function () {
- return opList;
- });
- });
- return Promise.all([pageListPromise, this._parsedAnnotations]).then(function (_ref5) {
- var _ref6 = _slicedToArray(_ref5, 2),
- pageOpList = _ref6[0],
- annotations = _ref6[1];
-
- if (annotations.length === 0) {
- pageOpList.flush(true);
- return pageOpList;
- }
- var i,
- ii,
- opListPromises = [];
- for (i = 0, ii = annotations.length; i < ii; i++) {
- if (isAnnotationRenderable(annotations[i], intent)) {
- opListPromises.push(annotations[i].getOperatorList(partialEvaluator, task, renderInteractiveForms));
- }
- }
- return Promise.all(opListPromises).then(function (opLists) {
- pageOpList.addOp(_util.OPS.beginAnnotations, []);
- for (i = 0, ii = opLists.length; i < ii; i++) {
- pageOpList.addOpList(opLists[i]);
- }
- pageOpList.addOp(_util.OPS.endAnnotations, []);
- pageOpList.flush(true);
- return pageOpList;
- });
- });
- },
- extractTextContent: function extractTextContent(_ref7) {
- var _this3 = this;
-
- var handler = _ref7.handler,
- task = _ref7.task,
- normalizeWhitespace = _ref7.normalizeWhitespace,
- sink = _ref7.sink,
- combineTextItems = _ref7.combineTextItems;
-
- var contentStreamPromise = this.pdfManager.ensure(this, 'getContentStream');
- var resourcesPromise = this.loadResources(['ExtGState', 'XObject', 'Font']);
- var dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
- return dataPromises.then(function (_ref8) {
- var _ref9 = _slicedToArray(_ref8, 1),
- contentStream = _ref9[0];
-
- var partialEvaluator = new _evaluator.PartialEvaluator({
- pdfManager: _this3.pdfManager,
- xref: _this3.xref,
- handler: handler,
- pageIndex: _this3.pageIndex,
- idFactory: _this3.idFactory,
- fontCache: _this3.fontCache,
- builtInCMapCache: _this3.builtInCMapCache,
- options: _this3.evaluatorOptions,
- pdfFunctionFactory: _this3.pdfFunctionFactory
- });
- return partialEvaluator.getTextContent({
- stream: contentStream,
- task: task,
- resources: _this3.resources,
- normalizeWhitespace: normalizeWhitespace,
- combineTextItems: combineTextItems,
- sink: sink
- });
- });
- },
- getAnnotationsData: function getAnnotationsData(intent) {
- return this._parsedAnnotations.then(function (annotations) {
- var annotationsData = [];
- for (var i = 0, ii = annotations.length; i < ii; i++) {
- if (!intent || isAnnotationRenderable(annotations[i], intent)) {
- annotationsData.push(annotations[i].data);
- }
- }
- return annotationsData;
- });
- },
-
- get annotations() {
- return (0, _util.shadow)(this, 'annotations', this._getInheritableProperty('Annots') || []);
- },
- get _parsedAnnotations() {
- var _this4 = this;
-
- var parsedAnnotations = this.pdfManager.ensure(this, 'annotations').then(function () {
- var annotationRefs = _this4.annotations;
- var annotationPromises = [];
- for (var i = 0, ii = annotationRefs.length; i < ii; i++) {
- annotationPromises.push(_annotation.AnnotationFactory.create(_this4.xref, annotationRefs[i], _this4.pdfManager, _this4.idFactory));
- }
- return Promise.all(annotationPromises).then(function (annotations) {
- return annotations.filter(function isDefined(annotation) {
- return !!annotation;
- });
- }, function (reason) {
- (0, _util.warn)('_parsedAnnotations: "' + reason + '".');
- return [];
- });
- });
- return (0, _util.shadow)(this, '_parsedAnnotations', parsedAnnotations);
- }
- };
- return Page;
-}();
-var PDFDocument = function PDFDocumentClosure() {
- 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 PDFDocument(pdfManager, arg) {
- var stream;
- if ((0, _primitives.isStream)(arg)) {
- stream = arg;
- } else if ((0, _util.isArrayBuffer)(arg)) {
- stream = new _stream.Stream(arg);
- } else {
- throw new Error('PDFDocument: Unknown argument type');
- }
- if (stream.length <= 0) {
- throw new Error('PDFDocument: stream must have data');
- }
- this.pdfManager = pdfManager;
- this.stream = stream;
- this.xref = new _obj.XRef(stream, pdfManager);
- var evaluatorOptions = pdfManager.evaluatorOptions;
- this.pdfFunctionFactory = new _function.PDFFunctionFactory({
- xref: this.xref,
- isEvalSupported: evaluatorOptions.isEvalSupported
- });
- this._pagePromises = [];
- }
- function find(stream, needle, limit, backwards) {
- var pos = stream.pos;
- var end = stream.end;
- var strBuf = [];
- if (pos + limit > end) {
- limit = end - pos;
- }
- for (var n = 0; n < limit; ++n) {
- strBuf.push(String.fromCharCode(stream.getByte()));
- }
- var str = strBuf.join('');
- stream.pos = pos;
- var index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle);
- if (index === -1) {
- return false;
- }
- stream.pos += index;
- return true;
- }
- var DocumentInfoValidators = {
- Title: _util.isString,
- Author: _util.isString,
- Subject: _util.isString,
- Keywords: _util.isString,
- Creator: _util.isString,
- Producer: _util.isString,
- CreationDate: _util.isString,
- ModDate: _util.isString,
- Trapped: _primitives.isName
- };
- PDFDocument.prototype = {
- parse: function PDFDocument_parse(recoveryMode) {
- this.setup(recoveryMode);
- var version = this.catalog.catDict.get('Version');
- if ((0, _primitives.isName)(version)) {
- this.pdfFormatVersion = version.name;
- }
- try {
- this.acroForm = this.catalog.catDict.get('AcroForm');
- if (this.acroForm) {
- this.xfa = this.acroForm.get('XFA');
- var fields = this.acroForm.get('Fields');
- if ((!fields || !Array.isArray(fields) || fields.length === 0) && !this.xfa) {
- this.acroForm = null;
- }
- }
- } catch (ex) {
- if (ex instanceof _util.MissingDataException) {
- throw ex;
- }
- (0, _util.info)('Something wrong with AcroForm entry');
- this.acroForm = null;
- }
- },
- get linearization() {
- var linearization = null;
- try {
- linearization = _parser.Linearization.create(this.stream);
- } catch (err) {
- if (err instanceof _util.MissingDataException) {
- throw err;
- }
- (0, _util.info)(err);
- }
- return (0, _util.shadow)(this, 'linearization', linearization);
- },
- get startXRef() {
- var stream = this.stream;
- var startXRef = 0;
- var linearization = this.linearization;
- if (linearization) {
- stream.reset();
- if (find(stream, 'endobj', 1024)) {
- startXRef = stream.pos + 6;
- }
- } else {
- var step = 1024;
- var found = false,
- pos = stream.end;
- while (!found && pos > 0) {
- pos -= step - 'startxref'.length;
- if (pos < 0) {
- pos = 0;
- }
- stream.pos = pos;
- found = find(stream, 'startxref', step, true);
- }
- if (found) {
- stream.skip(9);
- var ch;
- do {
- ch = stream.getByte();
- } while ((0, _util.isSpace)(ch));
- var str = '';
- while (ch >= 0x20 && ch <= 0x39) {
- str += String.fromCharCode(ch);
- ch = stream.getByte();
- }
- startXRef = parseInt(str, 10);
- if (isNaN(startXRef)) {
- startXRef = 0;
- }
- }
- }
- return (0, _util.shadow)(this, 'startXRef', startXRef);
- },
- checkHeader: function PDFDocument_checkHeader() {
- var stream = this.stream;
- stream.reset();
- if (find(stream, '%PDF-', 1024)) {
- stream.moveStart();
- var MAX_VERSION_LENGTH = 12;
- var version = '',
- ch;
- while ((ch = stream.getByte()) > 0x20) {
- if (version.length >= MAX_VERSION_LENGTH) {
- break;
- }
- version += String.fromCharCode(ch);
- }
- if (!this.pdfFormatVersion) {
- this.pdfFormatVersion = version.substring(5);
- }
- return;
- }
- },
- parseStartXRef: function PDFDocument_parseStartXRef() {
- var startXRef = this.startXRef;
- this.xref.setStartXRef(startXRef);
- },
- setup: function PDFDocument_setup(recoveryMode) {
- this.xref.parse(recoveryMode);
- this.catalog = new _obj.Catalog(this.pdfManager, this.xref);
- },
- get numPages() {
- var linearization = this.linearization;
- var num = linearization ? linearization.numPages : this.catalog.numPages;
- return (0, _util.shadow)(this, 'numPages', num);
- },
- get documentInfo() {
- var docInfo = {
- PDFFormatVersion: this.pdfFormatVersion,
- IsLinearized: !!this.linearization,
- IsAcroFormPresent: !!this.acroForm,
- IsXFAPresent: !!this.xfa
- };
- var infoDict = void 0;
- try {
- infoDict = this.xref.trailer.get('Info');
- } catch (err) {
- if (err instanceof _util.MissingDataException) {
- throw err;
- }
- (0, _util.info)('The document information dictionary is invalid.');
- }
- if ((0, _primitives.isDict)(infoDict)) {
- for (var key in DocumentInfoValidators) {
- if (infoDict.has(key)) {
- var value = infoDict.get(key);
- if (DocumentInfoValidators[key](value)) {
- docInfo[key] = typeof value !== 'string' ? value : (0, _util.stringToPDFString)(value);
- } else {
- (0, _util.info)('Bad value in document info for "' + key + '"');
- }
- }
- }
- }
- return (0, _util.shadow)(this, 'documentInfo', docInfo);
- },
- get fingerprint() {
- var xref = this.xref,
- hash,
- fileID = '';
- var idArray = xref.trailer.get('ID');
- if (Array.isArray(idArray) && idArray[0] && (0, _util.isString)(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
- hash = (0, _util.stringToBytes)(idArray[0]);
- } else {
- if (this.stream.ensureRange) {
- this.stream.ensureRange(0, Math.min(FINGERPRINT_FIRST_BYTES, this.stream.end));
- }
- hash = (0, _crypto.calculateMD5)(this.stream.bytes.subarray(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
- }
- for (var i = 0, n = hash.length; i < n; i++) {
- var hex = hash[i].toString(16);
- fileID += hex.length === 1 ? '0' + hex : hex;
- }
- return (0, _util.shadow)(this, 'fingerprint', fileID);
- },
- _getLinearizationPage: function _getLinearizationPage(pageIndex) {
- var catalog = this.catalog,
- linearization = this.linearization;
-
- (0, _util.assert)(linearization && linearization.pageFirst === pageIndex);
- var ref = new _primitives.Ref(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)) {
- catalog.pageKidsCountCache.put(ref, 1);
- }
- return [obj, ref];
- }
- throw new _util.FormatError('The Linearization dictionary doesn\'t point ' + 'to a valid Page dictionary.');
- }).catch(function (reason) {
- (0, _util.info)(reason);
- return catalog.getPageDict(pageIndex);
- });
- },
- getPage: function getPage(pageIndex) {
- var _this5 = this;
-
- if (this._pagePromises[pageIndex] !== undefined) {
- return this._pagePromises[pageIndex];
- }
- var catalog = this.catalog,
- linearization = this.linearization;
-
- var promise = linearization && linearization.pageFirst === pageIndex ? this._getLinearizationPage(pageIndex) : catalog.getPageDict(pageIndex);
- return this._pagePromises[pageIndex] = promise.then(function (_ref10) {
- var _ref11 = _slicedToArray(_ref10, 2),
- pageDict = _ref11[0],
- ref = _ref11[1];
-
- return new Page({
- pdfManager: _this5.pdfManager,
- xref: _this5.xref,
- pageIndex: pageIndex,
- pageDict: pageDict,
- ref: ref,
- fontCache: catalog.fontCache,
- builtInCMapCache: catalog.builtInCMapCache,
- pdfFunctionFactory: _this5.pdfFunctionFactory
- });
- });
- },
-
- cleanup: function PDFDocument_cleanup() {
- return this.catalog.cleanup();
- }
- };
- return PDFDocument;
-}();
-exports.Page = Page;
-exports.PDFDocument = PDFDocument;
-
-/***/ }),
-/* 137 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.FileSpec = exports.XRef = exports.ObjectLoader = exports.Catalog = undefined;
-
-var _regenerator = __w_pdfjs_require__(131);
-
-var _regenerator2 = _interopRequireDefault(_regenerator);
-
-var _slicedToArray = function () { function sliceIterator(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"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _util = __w_pdfjs_require__(2);
-
-var _primitives = __w_pdfjs_require__(138);
-
-var _parser = __w_pdfjs_require__(139);
-
-var _chunked_stream = __w_pdfjs_require__(135);
-
-var _crypto = __w_pdfjs_require__(150);
-
-var _colorspace = __w_pdfjs_require__(151);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
-
-function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
-
-function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-function fetchDestination(dest) {
- return (0, _primitives.isDict)(dest) ? dest.get('D') : dest;
-}
-
-var Catalog = function () {
- function Catalog(pdfManager, xref) {
- _classCallCheck(this, Catalog);
-
- this.pdfManager = pdfManager;
- this.xref = xref;
- this.catDict = xref.getCatalogObj();
- if (!(0, _primitives.isDict)(this.catDict)) {
- throw new _util.FormatError('Catalog object is not a dictionary.');
- }
- this.fontCache = new _primitives.RefSetCache();
- this.builtInCMapCache = new Map();
- this.pageKidsCountCache = new _primitives.RefSetCache();
- }
-
- _createClass(Catalog, [{
- key: '_readDocumentOutline',
- value: function _readDocumentOutline() {
- var obj = this.catDict.get('Outlines');
- if (!(0, _primitives.isDict)(obj)) {
- return null;
- }
- obj = obj.getRaw('First');
- if (!(0, _primitives.isRef)(obj)) {
- return null;
- }
- var root = { items: [] };
- var queue = [{
- obj: obj,
- parent: root
- }];
- var processed = new _primitives.RefSet();
- processed.put(obj);
- var xref = this.xref,
- blackColor = new Uint8ClampedArray(3);
- while (queue.length > 0) {
- var i = queue.shift();
- var outlineDict = xref.fetchIfRef(i.obj);
- if (outlineDict === null) {
- continue;
- }
- if (!outlineDict.has('Title')) {
- throw new _util.FormatError('Invalid outline item encountered.');
- }
- var data = {
- url: null,
- dest: null
- };
- Catalog.parseDestDictionary({
- destDict: outlineDict,
- resultObj: data,
- docBaseUrl: this.pdfManager.docBaseUrl
- });
- var title = outlineDict.get('Title');
- var flags = outlineDict.get('F') || 0;
- var color = outlineDict.getArray('C');
- var rgbColor = blackColor;
- if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
- rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
- }
- var outlineItem = {
- dest: data.dest,
- url: data.url,
- unsafeUrl: data.unsafeUrl,
- newWindow: data.newWindow,
- title: (0, _util.stringToPDFString)(title),
- color: rgbColor,
- count: outlineDict.get('Count'),
- bold: !!(flags & 2),
- italic: !!(flags & 1),
- items: []
- };
- i.parent.items.push(outlineItem);
- obj = outlineDict.getRaw('First');
- if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
- queue.push({
- obj: obj,
- parent: outlineItem
- });
- processed.put(obj);
- }
- obj = outlineDict.getRaw('Next');
- if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
- queue.push({
- obj: obj,
- parent: i.parent
- });
- processed.put(obj);
- }
- }
- return root.items.length > 0 ? root.items : null;
- }
- }, {
- key: '_readPermissions',
- value: function _readPermissions() {
- var encrypt = this.xref.trailer.get('Encrypt');
- if (!(0, _primitives.isDict)(encrypt)) {
- return null;
- }
- var flags = encrypt.get('P');
- if (!(0, _util.isNum)(flags)) {
- return null;
- }
- flags += Math.pow(2, 32);
- var permissions = [];
- for (var key in _util.PermissionFlag) {
- var value = _util.PermissionFlag[key];
- if (flags & value) {
- permissions.push(value);
- }
- }
- return permissions;
- }
- }, {
- key: 'getDestination',
- value: function getDestination(destinationId) {
- var obj = this._readDests();
- if (obj instanceof NameTree || obj instanceof _primitives.Dict) {
- return fetchDestination(obj.get(destinationId) || null);
- }
- return null;
- }
- }, {
- key: '_readDests',
- value: function _readDests() {
- var obj = this.catDict.get('Names');
- if (obj && obj.has('Dests')) {
- return new NameTree(obj.getRaw('Dests'), this.xref);
- } else if (this.catDict.has('Dests')) {
- return this.catDict.get('Dests');
- }
- }
- }, {
- key: '_readPageLabels',
- value: function _readPageLabels() {
- var obj = this.catDict.getRaw('PageLabels');
- if (!obj) {
- return null;
- }
- var pageLabels = new Array(this.numPages);
- var style = null,
- prefix = '';
- var numberTree = new NumberTree(obj, this.xref);
- var nums = numberTree.getAll();
- var currentLabel = '',
- currentIndex = 1;
- for (var i = 0, ii = this.numPages; i < ii; i++) {
- if (i in nums) {
- var labelDict = nums[i];
- if (!(0, _primitives.isDict)(labelDict)) {
- throw new _util.FormatError('PageLabel is not a dictionary.');
- }
- if (labelDict.has('Type') && !(0, _primitives.isName)(labelDict.get('Type'), 'PageLabel')) {
- throw new _util.FormatError('Invalid type in PageLabel dictionary.');
- }
- if (labelDict.has('S')) {
- var s = labelDict.get('S');
- if (!(0, _primitives.isName)(s)) {
- throw new _util.FormatError('Invalid style in PageLabel dictionary.');
- }
- style = s.name;
- } else {
- style = null;
- }
- if (labelDict.has('P')) {
- var p = labelDict.get('P');
- if (!(0, _util.isString)(p)) {
- throw new _util.FormatError('Invalid prefix in PageLabel dictionary.');
- }
- prefix = (0, _util.stringToPDFString)(p);
- } else {
- prefix = '';
- }
- if (labelDict.has('St')) {
- var st = labelDict.get('St');
- if (!(Number.isInteger(st) && st >= 1)) {
- throw new _util.FormatError('Invalid start in PageLabel dictionary.');
- }
- currentIndex = st;
- } else {
- currentIndex = 1;
- }
- }
- switch (style) {
- case 'D':
- currentLabel = currentIndex;
- break;
- case 'R':
- case 'r':
- currentLabel = (0, _util.toRomanNumerals)(currentIndex, style === 'r');
- break;
- case 'A':
- case 'a':
- var LIMIT = 26;
- var A_UPPER_CASE = 0x41,
- A_LOWER_CASE = 0x61;
- var baseCharCode = style === 'a' ? A_LOWER_CASE : A_UPPER_CASE;
- var letterIndex = currentIndex - 1;
- var character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
- var charBuf = [];
- for (var j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
- charBuf.push(character);
- }
- currentLabel = charBuf.join('');
- break;
- default:
- if (style) {
- throw new _util.FormatError('Invalid style "' + style + '" in PageLabel dictionary.');
- }
- currentLabel = '';
- }
- pageLabels[i] = prefix + currentLabel;
- currentIndex++;
- }
- return pageLabels;
- }
- }, {
- key: 'cleanup',
- value: function cleanup() {
- var _this = this;
-
- this.pageKidsCountCache.clear();
- var promises = [];
- this.fontCache.forEach(function (promise) {
- promises.push(promise);
- });
- return Promise.all(promises).then(function (translatedFonts) {
- for (var i = 0, ii = translatedFonts.length; i < ii; i++) {
- var font = translatedFonts[i].dict;
- delete font.translated;
- }
- _this.fontCache.clear();
- _this.builtInCMapCache.clear();
- });
- }
- }, {
- key: 'getPageDict',
- value: function getPageDict(pageIndex) {
- var capability = (0, _util.createPromiseCapability)();
- var nodesToVisit = [this.catDict.getRaw('Pages')];
- var xref = this.xref,
- pageKidsCountCache = this.pageKidsCountCache;
- var count = void 0,
- currentPageIndex = 0;
- function next() {
- var _loop = function _loop() {
- var currentNode = nodesToVisit.pop();
- if ((0, _primitives.isRef)(currentNode)) {
- count = pageKidsCountCache.get(currentNode);
- if (count > 0 && currentPageIndex + count < pageIndex) {
- currentPageIndex += count;
- return 'continue';
- }
- xref.fetchAsync(currentNode).then(function (obj) {
- if ((0, _primitives.isDict)(obj, 'Page') || (0, _primitives.isDict)(obj) && !obj.has('Kids')) {
- if (pageIndex === currentPageIndex) {
- if (currentNode && !pageKidsCountCache.has(currentNode)) {
- pageKidsCountCache.put(currentNode, 1);
- }
- capability.resolve([obj, currentNode]);
- } else {
- currentPageIndex++;
- next();
- }
- return;
- }
- nodesToVisit.push(obj);
- next();
- }, capability.reject);
- return {
- v: void 0
- };
- }
- if (!(0, _primitives.isDict)(currentNode)) {
- capability.reject(new _util.FormatError('Page dictionary kid reference points to wrong type of object.'));
- return {
- v: void 0
- };
- }
- count = currentNode.get('Count');
- if (Number.isInteger(count) && count >= 0) {
- var objId = currentNode.objId;
- if (objId && !pageKidsCountCache.has(objId)) {
- pageKidsCountCache.put(objId, count);
- }
- if (currentPageIndex + count <= pageIndex) {
- currentPageIndex += count;
- return 'continue';
- }
- }
- var kids = currentNode.get('Kids');
- if (!Array.isArray(kids)) {
- if ((0, _primitives.isName)(currentNode.get('Type'), 'Page') || !currentNode.has('Type') && currentNode.has('Contents')) {
- if (currentPageIndex === pageIndex) {
- capability.resolve([currentNode, null]);
- return {
- v: void 0
- };
- }
- currentPageIndex++;
- return 'continue';
- }
- capability.reject(new _util.FormatError('Page dictionary kids object is not an array.'));
- return {
- v: void 0
- };
- }
- for (var last = kids.length - 1; last >= 0; last--) {
- nodesToVisit.push(kids[last]);
- }
- };
-
- while (nodesToVisit.length) {
- var _ret = _loop();
-
- switch (_ret) {
- case 'continue':
- continue;
-
- default:
- if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
- }
- }
- capability.reject(new Error('Page index ' + pageIndex + ' not found.'));
- }
- next();
- return capability.promise;
- }
- }, {
- key: 'getPageIndex',
- value: function getPageIndex(pageRef) {
- var xref = this.xref;
- function pagesBeforeRef(kidRef) {
- var total = 0,
- parentRef = void 0;
- return xref.fetchAsync(kidRef).then(function (node) {
- if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, 'Page') && !((0, _primitives.isDict)(node) && !node.has('Type') && node.has('Contents'))) {
- throw new _util.FormatError('The reference does not point to a /Page dictionary.');
- }
- if (!node) {
- return null;
- }
- if (!(0, _primitives.isDict)(node)) {
- throw new _util.FormatError('Node must be a dictionary.');
- }
- parentRef = node.getRaw('Parent');
- return node.getAsync('Parent');
- }).then(function (parent) {
- if (!parent) {
- return null;
- }
- if (!(0, _primitives.isDict)(parent)) {
- throw new _util.FormatError('Parent must be a dictionary.');
- }
- return parent.getAsync('Kids');
- }).then(function (kids) {
- if (!kids) {
- return null;
- }
- var kidPromises = [];
- var found = false;
- for (var i = 0, ii = kids.length; i < ii; i++) {
- var kid = kids[i];
- if (!(0, _primitives.isRef)(kid)) {
- throw new _util.FormatError('Kid must be a reference.');
- }
- if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
- found = true;
- break;
- }
- kidPromises.push(xref.fetchAsync(kid).then(function (kid) {
- if (!(0, _primitives.isDict)(kid)) {
- throw new _util.FormatError('Kid node must be a dictionary.');
- }
- if (kid.has('Count')) {
- total += kid.get('Count');
- } else {
- total++;
- }
- }));
- }
- if (!found) {
- throw new _util.FormatError('Kid reference not found in parent\'s kids.');
- }
- return Promise.all(kidPromises).then(function () {
- return [total, parentRef];
- });
- });
- }
- var total = 0;
- function next(ref) {
- return pagesBeforeRef(ref).then(function (args) {
- if (!args) {
- return total;
- }
-
- var _args = _slicedToArray(args, 2),
- count = _args[0],
- parentRef = _args[1];
-
- total += count;
- return next(parentRef);
- });
- }
- return next(pageRef);
- }
- }, {
- key: 'metadata',
- get: function get() {
- var streamRef = this.catDict.getRaw('Metadata');
- if (!(0, _primitives.isRef)(streamRef)) {
- return (0, _util.shadow)(this, 'metadata', null);
- }
- var suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
- var stream = this.xref.fetch(streamRef, suppressEncryption);
- var metadata = void 0;
- if (stream && (0, _primitives.isDict)(stream.dict)) {
- var type = stream.dict.get('Type');
- var subtype = stream.dict.get('Subtype');
- if ((0, _primitives.isName)(type, 'Metadata') && (0, _primitives.isName)(subtype, 'XML')) {
- try {
- metadata = (0, _util.stringToUTF8String)((0, _util.bytesToString)(stream.getBytes()));
- } catch (e) {
- if (e instanceof _util.MissingDataException) {
- throw e;
- }
- (0, _util.info)('Skipping invalid metadata.');
- }
- }
- }
- return (0, _util.shadow)(this, 'metadata', metadata);
- }
- }, {
- key: 'toplevelPagesDict',
- get: function get() {
- var pagesObj = this.catDict.get('Pages');
- if (!(0, _primitives.isDict)(pagesObj)) {
- throw new _util.FormatError('Invalid top-level pages dictionary.');
- }
- return (0, _util.shadow)(this, 'toplevelPagesDict', pagesObj);
- }
- }, {
- key: 'documentOutline',
- get: function get() {
- var obj = null;
- try {
- obj = this._readDocumentOutline();
- } catch (ex) {
- if (ex instanceof _util.MissingDataException) {
- throw ex;
- }
- (0, _util.warn)('Unable to read document outline.');
- }
- return (0, _util.shadow)(this, 'documentOutline', obj);
- }
- }, {
- key: 'permissions',
- get: function get() {
- var permissions = null;
- try {
- permissions = this._readPermissions();
- } catch (ex) {
- if (ex instanceof _util.MissingDataException) {
- throw ex;
- }
- (0, _util.warn)('Unable to read permissions.');
- }
- return (0, _util.shadow)(this, 'permissions', permissions);
- }
- }, {
- key: 'numPages',
- get: function get() {
- var obj = this.toplevelPagesDict.get('Count');
- if (!Number.isInteger(obj)) {
- throw new _util.FormatError('Page count in top-level pages dictionary is not an integer.');
- }
- return (0, _util.shadow)(this, 'numPages', obj);
- }
- }, {
- key: 'destinations',
- get: function get() {
- var obj = this._readDests(),
- dests = Object.create(null);
- if (obj instanceof NameTree) {
- var names = obj.getAll();
- for (var name in names) {
- dests[name] = fetchDestination(names[name]);
- }
- } else if (obj instanceof _primitives.Dict) {
- obj.forEach(function (key, value) {
- if (value) {
- dests[key] = fetchDestination(value);
- }
- });
- }
- return (0, _util.shadow)(this, 'destinations', dests);
- }
- }, {
- key: 'pageLabels',
- get: function get() {
- var obj = null;
- try {
- obj = this._readPageLabels();
- } catch (ex) {
- if (ex instanceof _util.MissingDataException) {
- throw ex;
- }
- (0, _util.warn)('Unable to read page labels.');
- }
- return (0, _util.shadow)(this, 'pageLabels', obj);
- }
- }, {
- key: 'pageMode',
- get: function get() {
- var obj = this.catDict.get('PageMode');
- var pageMode = 'UseNone';
- if ((0, _primitives.isName)(obj)) {
- switch (obj.name) {
- case 'UseNone':
- case 'UseOutlines':
- case 'UseThumbs':
- case 'FullScreen':
- case 'UseOC':
- case 'UseAttachments':
- pageMode = obj.name;
- }
- }
- return (0, _util.shadow)(this, 'pageMode', pageMode);
- }
- }, {
- key: 'attachments',
- get: function get() {
- var obj = this.catDict.get('Names');
- var attachments = null;
- if (obj && obj.has('EmbeddedFiles')) {
- var nameTree = new NameTree(obj.getRaw('EmbeddedFiles'), this.xref);
- var names = nameTree.getAll();
- for (var name in names) {
- var fs = new FileSpec(names[name], this.xref);
- if (!attachments) {
- attachments = Object.create(null);
- }
- attachments[(0, _util.stringToPDFString)(name)] = fs.serializable;
- }
- }
- return (0, _util.shadow)(this, 'attachments', attachments);
- }
- }, {
- key: 'javaScript',
- get: function get() {
- var obj = this.catDict.get('Names');
- var javaScript = null;
- function appendIfJavaScriptDict(jsDict) {
- var type = jsDict.get('S');
- if (!(0, _primitives.isName)(type, 'JavaScript')) {
- return;
- }
- var js = jsDict.get('JS');
- if ((0, _primitives.isStream)(js)) {
- js = (0, _util.bytesToString)(js.getBytes());
- } else if (!(0, _util.isString)(js)) {
- return;
- }
- if (!javaScript) {
- javaScript = [];
- }
- javaScript.push((0, _util.stringToPDFString)(js));
- }
- if (obj && obj.has('JavaScript')) {
- var nameTree = new NameTree(obj.getRaw('JavaScript'), this.xref);
- var names = nameTree.getAll();
- for (var name in names) {
- var jsDict = names[name];
- if ((0, _primitives.isDict)(jsDict)) {
- appendIfJavaScriptDict(jsDict);
- }
- }
- }
- var openActionDict = this.catDict.get('OpenAction');
- if ((0, _primitives.isDict)(openActionDict, 'Action')) {
- var actionType = openActionDict.get('S');
- if ((0, _primitives.isName)(actionType, 'Named')) {
- var action = openActionDict.get('N');
- if ((0, _primitives.isName)(action, 'Print')) {
- if (!javaScript) {
- javaScript = [];
- }
- javaScript.push('print({});');
- }
- } else {
- appendIfJavaScriptDict(openActionDict);
- }
- }
- return (0, _util.shadow)(this, 'javaScript', javaScript);
- }
- }], [{
- key: 'parseDestDictionary',
- value: function parseDestDictionary(params) {
- function addDefaultProtocolToUrl(url) {
- if (url.indexOf('www.') === 0) {
- return 'http://' + url;
- }
- return url;
- }
- function tryConvertUrlEncoding(url) {
- try {
- return (0, _util.stringToUTF8String)(url);
- } catch (e) {
- return url;
- }
- }
- var destDict = params.destDict;
- if (!(0, _primitives.isDict)(destDict)) {
- (0, _util.warn)('parseDestDictionary: `destDict` must be a dictionary.');
- return;
- }
- var resultObj = params.resultObj;
- if ((typeof resultObj === 'undefined' ? 'undefined' : _typeof(resultObj)) !== 'object') {
- (0, _util.warn)('parseDestDictionary: `resultObj` must be an object.');
- return;
- }
- var docBaseUrl = params.docBaseUrl || null;
- var action = destDict.get('A'),
- url = void 0,
- dest = void 0;
- if (!(0, _primitives.isDict)(action) && destDict.has('Dest')) {
- action = destDict.get('Dest');
- }
- if ((0, _primitives.isDict)(action)) {
- var actionType = action.get('S');
- if (!(0, _primitives.isName)(actionType)) {
- (0, _util.warn)('parseDestDictionary: Invalid type in Action dictionary.');
- return;
- }
- var actionName = actionType.name;
- switch (actionName) {
- case 'URI':
- url = action.get('URI');
- if ((0, _primitives.isName)(url)) {
- url = '/' + url.name;
- } else if ((0, _util.isString)(url)) {
- url = addDefaultProtocolToUrl(url);
- }
- break;
- case 'GoTo':
- dest = action.get('D');
- break;
- case 'Launch':
- case 'GoToR':
- var urlDict = action.get('F');
- if ((0, _primitives.isDict)(urlDict)) {
- url = urlDict.get('F') || null;
- } else if ((0, _util.isString)(urlDict)) {
- url = urlDict;
- }
- var remoteDest = action.get('D');
- if (remoteDest) {
- if ((0, _primitives.isName)(remoteDest)) {
- remoteDest = remoteDest.name;
- }
- if ((0, _util.isString)(url)) {
- var baseUrl = url.split('#')[0];
- if ((0, _util.isString)(remoteDest)) {
- url = baseUrl + '#' + remoteDest;
- } else if (Array.isArray(remoteDest)) {
- url = baseUrl + '#' + JSON.stringify(remoteDest);
- }
- }
- }
- var newWindow = action.get('NewWindow');
- if ((0, _util.isBool)(newWindow)) {
- resultObj.newWindow = newWindow;
- }
- break;
- case 'Named':
- var namedAction = action.get('N');
- if ((0, _primitives.isName)(namedAction)) {
- resultObj.action = namedAction.name;
- }
- break;
- case 'JavaScript':
- var jsAction = action.get('JS');
- var js = void 0;
- if ((0, _primitives.isStream)(jsAction)) {
- js = (0, _util.bytesToString)(jsAction.getBytes());
- } else if ((0, _util.isString)(jsAction)) {
- js = jsAction;
- }
- if (js) {
- var URL_OPEN_METHODS = ['app.launchURL', 'window.open'];
- var regex = new RegExp('^\\s*(' + URL_OPEN_METHODS.join('|').split('.').join('\\.') + ')\\((?:\'|\")([^\'\"]*)(?:\'|\")(?:,\\s*(\\w+)\\)|\\))', 'i');
- var jsUrl = regex.exec((0, _util.stringToPDFString)(js));
- if (jsUrl && jsUrl[2]) {
- url = jsUrl[2];
- if (jsUrl[3] === 'true' && jsUrl[1] === 'app.launchURL') {
- resultObj.newWindow = true;
- }
- break;
- }
- }
- default:
- (0, _util.warn)('parseDestDictionary: unsupported action type "' + actionName + '".');
- break;
- }
- } else if (destDict.has('Dest')) {
- dest = destDict.get('Dest');
- }
- if ((0, _util.isString)(url)) {
- url = tryConvertUrlEncoding(url);
- var absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl);
- if (absoluteUrl) {
- resultObj.url = absoluteUrl.href;
- }
- resultObj.unsafeUrl = url;
- }
- if (dest) {
- if ((0, _primitives.isName)(dest)) {
- dest = dest.name;
- }
- if ((0, _util.isString)(dest) || Array.isArray(dest)) {
- resultObj.dest = dest;
- }
- }
- }
- }]);
-
- return Catalog;
-}();
-
-var XRef = function XRefClosure() {
- function XRef(stream, pdfManager) {
- this.stream = stream;
- this.pdfManager = pdfManager;
- this.entries = [];
- this.xrefstms = Object.create(null);
- this.cache = [];
- this.stats = {
- streamTypes: [],
- fontTypes: []
- };
- }
- XRef.prototype = {
- setStartXRef: function XRef_setStartXRef(startXRef) {
- this.startXRefQueue = [startXRef];
- },
- parse: function XRef_parse(recoveryMode) {
- var trailerDict;
- if (!recoveryMode) {
- trailerDict = this.readXRef();
- } else {
- (0, _util.warn)('Indexing all PDF objects');
- trailerDict = this.indexObjects();
- }
- trailerDict.assignXref(this);
- this.trailer = trailerDict;
- var encrypt = void 0;
- try {
- encrypt = trailerDict.get('Encrypt');
- } catch (ex) {
- if (ex instanceof _util.MissingDataException) {
- throw ex;
- }
- (0, _util.warn)('XRef.parse - Invalid "Encrypt" reference: "' + ex + '".');
- }
- if ((0, _primitives.isDict)(encrypt)) {
- var ids = trailerDict.get('ID');
- var fileId = ids && ids.length ? ids[0] : '';
- encrypt.suppressEncryption = true;
- this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
- }
- var root = void 0;
- try {
- root = trailerDict.get('Root');
- } catch (ex) {
- if (ex instanceof _util.MissingDataException) {
- throw ex;
- }
- (0, _util.warn)('XRef.parse - Invalid "Root" reference: "' + ex + '".');
- }
- if ((0, _primitives.isDict)(root) && root.has('Pages')) {
- this.root = root;
- } else {
- if (!recoveryMode) {
- throw new _util.XRefParseException();
- }
- throw new _util.FormatError('Invalid root reference');
- }
- },
- processXRefTable: function XRef_processXRefTable(parser) {
- if (!('tableState' in this)) {
- this.tableState = {
- entryNum: 0,
- streamPos: parser.lexer.stream.pos,
- parserBuf1: parser.buf1,
- parserBuf2: parser.buf2
- };
- }
- var obj = this.readXRefTable(parser);
- if (!(0, _primitives.isCmd)(obj, 'trailer')) {
- throw new _util.FormatError('Invalid XRef table: could not find trailer dictionary');
- }
- var dict = parser.getObj();
- if (!(0, _primitives.isDict)(dict) && dict.dict) {
- dict = dict.dict;
- }
- if (!(0, _primitives.isDict)(dict)) {
- throw new _util.FormatError('Invalid XRef table: could not parse trailer dictionary');
- }
- delete this.tableState;
- return dict;
- },
- readXRefTable: function XRef_readXRefTable(parser) {
- var stream = parser.lexer.stream;
- var tableState = this.tableState;
- stream.pos = tableState.streamPos;
- parser.buf1 = tableState.parserBuf1;
- parser.buf2 = tableState.parserBuf2;
- var obj;
- while (true) {
- if (!('firstEntryNum' in tableState) || !('entryCount' in tableState)) {
- if ((0, _primitives.isCmd)(obj = parser.getObj(), 'trailer')) {
- break;
- }
- tableState.firstEntryNum = obj;
- tableState.entryCount = parser.getObj();
- }
- var first = tableState.firstEntryNum;
- var count = tableState.entryCount;
- if (!Number.isInteger(first) || !Number.isInteger(count)) {
- throw new _util.FormatError('Invalid XRef table: wrong types in subsection header');
- }
- for (var i = tableState.entryNum; i < count; i++) {
- tableState.streamPos = stream.pos;
- tableState.entryNum = i;
- tableState.parserBuf1 = parser.buf1;
- tableState.parserBuf2 = parser.buf2;
- var entry = {};
- entry.offset = parser.getObj();
- 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 (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
- throw new _util.FormatError('Invalid entry in XRef subsection: ' + first + ', ' + count);
- }
- if (i === 0 && entry.free && first === 1) {
- first = 0;
- }
- if (!this.entries[i + first]) {
- this.entries[i + first] = entry;
- }
- }
- tableState.entryNum = 0;
- tableState.streamPos = stream.pos;
- tableState.parserBuf1 = parser.buf1;
- tableState.parserBuf2 = parser.buf2;
- delete tableState.firstEntryNum;
- delete tableState.entryCount;
- }
- if (this.entries[0] && !this.entries[0].free) {
- throw new _util.FormatError('Invalid XRef table: unexpected first object');
- }
- return obj;
- },
- processXRefStream: function XRef_processXRefStream(stream) {
- if (!('streamState' in this)) {
- var streamParameters = stream.dict;
- var byteWidths = streamParameters.get('W');
- var range = streamParameters.get('Index');
- if (!range) {
- range = [0, streamParameters.get('Size')];
- }
- this.streamState = {
- entryRanges: range,
- byteWidths: byteWidths,
- entryNum: 0,
- streamPos: stream.pos
- };
- }
- this.readXRefStream(stream);
- delete this.streamState;
- return stream.dict;
- },
- readXRefStream: function XRef_readXRefStream(stream) {
- var i, j;
- var streamState = this.streamState;
- stream.pos = streamState.streamPos;
- var byteWidths = streamState.byteWidths;
- var typeFieldWidth = byteWidths[0];
- var offsetFieldWidth = byteWidths[1];
- var generationFieldWidth = byteWidths[2];
- var entryRanges = streamState.entryRanges;
- while (entryRanges.length > 0) {
- var first = entryRanges[0];
- var n = entryRanges[1];
- if (!Number.isInteger(first) || !Number.isInteger(n)) {
- throw new _util.FormatError('Invalid XRef range fields: ' + first + ', ' + n);
- }
- if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
- throw new _util.FormatError('Invalid XRef entry fields length: ' + first + ', ' + n);
- }
- for (i = streamState.entryNum; i < n; ++i) {
- streamState.entryNum = i;
- streamState.streamPos = stream.pos;
- var type = 0,
- offset = 0,
- generation = 0;
- for (j = 0; j < typeFieldWidth; ++j) {
- type = type << 8 | stream.getByte();
- }
- if (typeFieldWidth === 0) {
- type = 1;
- }
- for (j = 0; j < offsetFieldWidth; ++j) {
- offset = offset << 8 | stream.getByte();
- }
- for (j = 0; j < generationFieldWidth; ++j) {
- generation = generation << 8 | stream.getByte();
- }
- var entry = {};
- entry.offset = offset;
- entry.gen = generation;
- switch (type) {
- case 0:
- entry.free = true;
- break;
- case 1:
- entry.uncompressed = true;
- break;
- case 2:
- break;
- default:
- throw new _util.FormatError('Invalid XRef entry type: ' + type);
- }
- if (!this.entries[first + i]) {
- this.entries[first + i] = entry;
- }
- }
- streamState.entryNum = 0;
- streamState.streamPos = stream.pos;
- entryRanges.splice(0, 2);
- }
- },
- indexObjects: function XRef_indexObjects() {
- var TAB = 0x9,
- LF = 0xA,
- CR = 0xD,
- SPACE = 0x20;
- var PERCENT = 0x25,
- LT = 0x3C;
- function readToken(data, offset) {
- var token = '',
- ch = data[offset];
- while (ch !== LF && ch !== CR && ch !== LT) {
- if (++offset >= data.length) {
- break;
- }
- token += String.fromCharCode(ch);
- ch = data[offset];
- }
- return token;
- }
- function skipUntil(data, offset, what) {
- var length = what.length,
- dataLength = data.length;
- var skipped = 0;
- while (offset < dataLength) {
- var i = 0;
- while (i < length && data[offset + i] === what[i]) {
- ++i;
- }
- if (i >= length) {
- break;
- }
- offset++;
- skipped++;
- }
- return skipped;
- }
- var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
- var endobjRegExp = /\bendobj[\b\s]$/;
- var nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s])$/;
- var CHECK_CONTENT_LENGTH = 25;
- var trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
- var startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
- var objBytes = new Uint8Array([111, 98, 106]);
- var xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
- this.entries.length = 0;
- var stream = this.stream;
- stream.pos = 0;
- var buffer = stream.getBytes();
- var position = stream.start,
- length = buffer.length;
- var trailers = [],
- xrefStms = [];
- while (position < length) {
- var ch = buffer[position];
- if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
- ++position;
- continue;
- }
- if (ch === PERCENT) {
- do {
- ++position;
- if (position >= length) {
- break;
- }
- ch = buffer[position];
- } while (ch !== LF && ch !== CR);
- continue;
- }
- var token = readToken(buffer, position);
- var m;
- if (token.indexOf('xref') === 0 && (token.length === 4 || /\s/.test(token[4]))) {
- position += skipUntil(buffer, position, trailerBytes);
- trailers.push(position);
- position += skipUntil(buffer, position, startxrefBytes);
- } else if (m = objRegExp.exec(token)) {
- if (typeof this.entries[m[1]] === 'undefined') {
- this.entries[m[1]] = {
- offset: position - stream.start,
- gen: m[2] | 0,
- uncompressed: true
- };
- }
- var contentLength = void 0,
- startPos = position + token.length;
- while (startPos < buffer.length) {
- var endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
- contentLength = endPos - position;
- var checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
- var tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
- if (endobjRegExp.test(tokenStr)) {
- break;
- } else {
- var objToken = nestedObjRegExp.exec(tokenStr);
- if (objToken && objToken[1]) {
- (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
- contentLength -= objToken[1].length;
- break;
- }
- }
- startPos = endPos;
- }
- var content = buffer.subarray(position, position + contentLength);
- var xrefTagOffset = skipUntil(content, 0, xrefBytes);
- if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
- xrefStms.push(position - stream.start);
- this.xrefstms[position - stream.start] = 1;
- }
- position += contentLength;
- } else if (token.indexOf('trailer') === 0 && (token.length === 7 || /\s/.test(token[7]))) {
- trailers.push(position);
- position += skipUntil(buffer, position, startxrefBytes);
- } else {
- position += token.length + 1;
- }
- }
- var i, ii;
- for (i = 0, ii = xrefStms.length; i < ii; ++i) {
- this.startXRefQueue.push(xrefStms[i]);
- this.readXRef(true);
- }
- var trailerDict = void 0;
- 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 obj = parser.getObj();
- if (!(0, _primitives.isCmd)(obj, 'trailer')) {
- continue;
- }
- var dict = parser.getObj();
- if (!(0, _primitives.isDict)(dict)) {
- continue;
- }
- var rootDict = void 0;
- try {
- rootDict = dict.get('Root');
- } catch (ex) {
- if (ex instanceof _util.MissingDataException) {
- throw ex;
- }
- continue;
- }
- if (!(0, _primitives.isDict)(rootDict) || !rootDict.has('Pages')) {
- continue;
- }
- if (dict.has('ID')) {
- return dict;
- }
- trailerDict = dict;
- }
- if (trailerDict) {
- return trailerDict;
- }
- throw new _util.InvalidPDFException('Invalid PDF structure');
- },
- readXRef: function XRef_readXRef(recoveryMode) {
- var stream = this.stream;
- var startXRefParsedCache = Object.create(null);
- try {
- while (this.startXRefQueue.length) {
- var startXRef = this.startXRefQueue[0];
- if (startXRefParsedCache[startXRef]) {
- (0, _util.warn)('readXRef - skipping XRef table since it was already parsed.');
- this.startXRefQueue.shift();
- continue;
- }
- startXRefParsedCache[startXRef] = true;
- stream.pos = startXRef + stream.start;
- var parser = new _parser.Parser(new _parser.Lexer(stream), true, this);
- var obj = parser.getObj();
- var dict;
- if ((0, _primitives.isCmd)(obj, 'xref')) {
- dict = this.processXRefTable(parser);
- if (!this.topDict) {
- this.topDict = dict;
- }
- obj = dict.get('XRefStm');
- if (Number.isInteger(obj)) {
- var pos = obj;
- if (!(pos in this.xrefstms)) {
- this.xrefstms[pos] = 1;
- this.startXRefQueue.push(pos);
- }
- }
- } else if (Number.isInteger(obj)) {
- if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), 'obj') || !(0, _primitives.isStream)(obj = parser.getObj())) {
- throw new _util.FormatError('Invalid XRef stream');
- }
- dict = this.processXRefStream(obj);
- if (!this.topDict) {
- this.topDict = dict;
- }
- if (!dict) {
- throw new _util.FormatError('Failed to read XRef stream');
- }
- } else {
- throw new _util.FormatError('Invalid XRef stream header');
- }
- obj = dict.get('Prev');
- if (Number.isInteger(obj)) {
- this.startXRefQueue.push(obj);
- } else if ((0, _primitives.isRef)(obj)) {
- this.startXRefQueue.push(obj.num);
- }
- this.startXRefQueue.shift();
- }
- return this.topDict;
- } catch (e) {
- if (e instanceof _util.MissingDataException) {
- throw e;
- }
- (0, _util.info)('(while reading XRef): ' + e);
- }
- if (recoveryMode) {
- return;
- }
- throw new _util.XRefParseException();
- },
- getEntry: function XRef_getEntry(i) {
- var xrefEntry = this.entries[i];
- if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
- return xrefEntry;
- }
- return null;
- },
- fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {
- if (!(0, _primitives.isRef)(obj)) {
- return obj;
- }
- return this.fetch(obj, suppressEncryption);
- },
- fetch: function XRef_fetch(ref, suppressEncryption) {
- if (!(0, _primitives.isRef)(ref)) {
- throw new Error('ref object is not a reference');
- }
- var num = ref.num;
- if (num in this.cache) {
- var cacheEntry = this.cache[num];
- if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
- cacheEntry.objId = ref.toString();
- }
- return cacheEntry;
- }
- var xrefEntry = this.getEntry(num);
- if (xrefEntry === null) {
- return this.cache[num] = null;
- }
- if (xrefEntry.uncompressed) {
- xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
- } else {
- xrefEntry = this.fetchCompressed(xrefEntry, suppressEncryption);
- }
- if ((0, _primitives.isDict)(xrefEntry)) {
- xrefEntry.objId = ref.toString();
- } else if ((0, _primitives.isStream)(xrefEntry)) {
- xrefEntry.dict.objId = ref.toString();
- }
- return xrefEntry;
- },
- fetchUncompressed: function XRef_fetchUncompressed(ref, xrefEntry, suppressEncryption) {
- var gen = ref.gen;
- var num = ref.num;
- if (xrefEntry.gen !== gen) {
- throw new _util.FormatError('inconsistent generation in XRef');
- }
- var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
- var parser = new _parser.Parser(new _parser.Lexer(stream), true, this);
- var obj1 = parser.getObj();
- var obj2 = parser.getObj();
- var obj3 = parser.getObj();
- if (!Number.isInteger(obj1)) {
- obj1 = parseInt(obj1, 10);
- }
- if (!Number.isInteger(obj2)) {
- obj2 = parseInt(obj2, 10);
- }
- if (obj1 !== num || obj2 !== gen || !(0, _primitives.isCmd)(obj3)) {
- throw new _util.FormatError('bad XRef entry');
- }
- if (obj3.cmd !== 'obj') {
- if (obj3.cmd.indexOf('obj') === 0) {
- num = parseInt(obj3.cmd.substring(3), 10);
- if (!Number.isNaN(num)) {
- return num;
- }
- }
- throw new _util.FormatError('bad XRef entry');
- }
- if (this.encrypt && !suppressEncryption) {
- xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
- } else {
- xrefEntry = parser.getObj();
- }
- if (!(0, _primitives.isStream)(xrefEntry)) {
- this.cache[num] = xrefEntry;
- }
- return xrefEntry;
- },
- fetchCompressed: function XRef_fetchCompressed(xrefEntry, suppressEncryption) {
- var tableOffset = xrefEntry.offset;
- var stream = this.fetch(new _primitives.Ref(tableOffset, 0));
- if (!(0, _primitives.isStream)(stream)) {
- throw new _util.FormatError('bad ObjStm stream');
- }
- var first = stream.dict.get('First');
- var n = stream.dict.get('N');
- if (!Number.isInteger(first) || !Number.isInteger(n)) {
- 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 i,
- entries = [],
- num,
- nums = [];
- for (i = 0; i < n; ++i) {
- num = parser.getObj();
- if (!Number.isInteger(num)) {
- throw new _util.FormatError('invalid object number in the ObjStm stream: ' + num);
- }
- nums.push(num);
- var offset = parser.getObj();
- if (!Number.isInteger(offset)) {
- throw new _util.FormatError('invalid object offset in the ObjStm stream: ' + offset);
- }
- }
- for (i = 0; i < n; ++i) {
- entries.push(parser.getObj());
- if ((0, _primitives.isCmd)(parser.buf1, 'endobj')) {
- parser.shift();
- }
- num = nums[i];
- var entry = this.entries[num];
- if (entry && entry.offset === tableOffset && entry.gen === i) {
- this.cache[num] = entries[i];
- }
- }
- xrefEntry = entries[xrefEntry.gen];
- if (xrefEntry === undefined) {
- throw new _util.FormatError('bad XRef entry for compressed object');
- }
- return xrefEntry;
- },
- fetchIfRefAsync: function () {
- var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee(obj, suppressEncryption) {
- return _regenerator2.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- if ((0, _primitives.isRef)(obj)) {
- _context.next = 2;
- break;
- }
-
- return _context.abrupt('return', obj);
-
- case 2:
- return _context.abrupt('return', this.fetchAsync(obj, suppressEncryption));
-
- case 3:
- case 'end':
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
-
- function fetchIfRefAsync(_x, _x2) {
- return _ref.apply(this, arguments);
- }
-
- return fetchIfRefAsync;
- }(),
- fetchAsync: function () {
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2(ref, suppressEncryption) {
- return _regenerator2.default.wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- _context2.prev = 0;
- return _context2.abrupt('return', this.fetch(ref, suppressEncryption));
-
- case 4:
- _context2.prev = 4;
- _context2.t0 = _context2['catch'](0);
-
- if (_context2.t0 instanceof _util.MissingDataException) {
- _context2.next = 8;
- break;
- }
-
- throw _context2.t0;
-
- case 8:
- _context2.next = 10;
- return this.pdfManager.requestRange(_context2.t0.begin, _context2.t0.end);
-
- case 10:
- return _context2.abrupt('return', this.fetchAsync(ref, suppressEncryption));
-
- case 11:
- case 'end':
- return _context2.stop();
- }
- }
- }, _callee2, this, [[0, 4]]);
- }));
-
- function fetchAsync(_x3, _x4) {
- return _ref2.apply(this, arguments);
- }
-
- return fetchAsync;
- }(),
-
- getCatalogObj: function XRef_getCatalogObj() {
- return this.root;
- }
- };
- return XRef;
-}();
-
-var NameOrNumberTree = function () {
- function NameOrNumberTree(root, xref, type) {
- _classCallCheck(this, NameOrNumberTree);
-
- if (this.constructor === NameOrNumberTree) {
- (0, _util.unreachable)('Cannot initialize NameOrNumberTree.');
- }
- this.root = root;
- this.xref = xref;
- this._type = type;
- }
-
- _createClass(NameOrNumberTree, [{
- key: 'getAll',
- value: function getAll() {
- var dict = Object.create(null);
- if (!this.root) {
- return dict;
- }
- var xref = this.xref;
- var processed = new _primitives.RefSet();
- processed.put(this.root);
- var queue = [this.root];
- while (queue.length > 0) {
- var obj = xref.fetchIfRef(queue.shift());
- if (!(0, _primitives.isDict)(obj)) {
- continue;
- }
- if (obj.has('Kids')) {
- var _kids = obj.get('Kids');
- for (var i = 0, ii = _kids.length; i < ii; i++) {
- var kid = _kids[i];
- if (processed.has(kid)) {
- throw new _util.FormatError('Duplicate entry in "' + this._type + '" tree.');
- }
- queue.push(kid);
- processed.put(kid);
- }
- continue;
- }
- var entries = obj.get(this._type);
- if (Array.isArray(entries)) {
- for (var _i2 = 0, _ii = entries.length; _i2 < _ii; _i2 += 2) {
- dict[xref.fetchIfRef(entries[_i2])] = xref.fetchIfRef(entries[_i2 + 1]);
- }
- }
- }
- return dict;
- }
- }, {
- key: 'get',
- value: function get(key) {
- if (!this.root) {
- return null;
- }
- var xref = this.xref;
- var kidsOrEntries = xref.fetchIfRef(this.root);
- var loopCount = 0;
- var MAX_LEVELS = 10;
- while (kidsOrEntries.has('Kids')) {
- if (++loopCount > MAX_LEVELS) {
- (0, _util.warn)('Search depth limit reached for "' + this._type + '" tree.');
- return null;
- }
- var _kids2 = kidsOrEntries.get('Kids');
- if (!Array.isArray(_kids2)) {
- return null;
- }
- var l = 0,
- r = _kids2.length - 1;
- while (l <= r) {
- var m = l + r >> 1;
- var kid = xref.fetchIfRef(_kids2[m]);
- var limits = kid.get('Limits');
- if (key < xref.fetchIfRef(limits[0])) {
- r = m - 1;
- } else if (key > xref.fetchIfRef(limits[1])) {
- l = m + 1;
- } else {
- kidsOrEntries = xref.fetchIfRef(_kids2[m]);
- break;
- }
- }
- if (l > r) {
- return null;
- }
- }
- var entries = kidsOrEntries.get(this._type);
- if (Array.isArray(entries)) {
- var _l = 0,
- _r = entries.length - 2;
- while (_l <= _r) {
- var _m = _l + _r & ~1;
- var currentKey = xref.fetchIfRef(entries[_m]);
- if (key < currentKey) {
- _r = _m - 2;
- } else if (key > currentKey) {
- _l = _m + 2;
- } else {
- return xref.fetchIfRef(entries[_m + 1]);
- }
- }
- }
- return null;
- }
- }]);
-
- return NameOrNumberTree;
-}();
-
-var NameTree = function (_NameOrNumberTree) {
- _inherits(NameTree, _NameOrNumberTree);
-
- function NameTree(root, xref) {
- _classCallCheck(this, NameTree);
-
- return _possibleConstructorReturn(this, (NameTree.__proto__ || Object.getPrototypeOf(NameTree)).call(this, root, xref, 'Names'));
- }
-
- return NameTree;
-}(NameOrNumberTree);
-
-var NumberTree = function (_NameOrNumberTree2) {
- _inherits(NumberTree, _NameOrNumberTree2);
-
- function NumberTree(root, xref) {
- _classCallCheck(this, NumberTree);
-
- return _possibleConstructorReturn(this, (NumberTree.__proto__ || Object.getPrototypeOf(NumberTree)).call(this, root, xref, 'Nums'));
- }
-
- return NumberTree;
-}(NameOrNumberTree);
-
-var FileSpec = function FileSpecClosure() {
- function FileSpec(root, xref) {
- if (!root || !(0, _primitives.isDict)(root)) {
- return;
- }
- this.xref = xref;
- this.root = root;
- if (root.has('FS')) {
- this.fs = root.get('FS');
- }
- this.description = root.has('Desc') ? (0, _util.stringToPDFString)(root.get('Desc')) : '';
- if (root.has('RF')) {
- (0, _util.warn)('Related file specifications are not supported');
- }
- this.contentAvailable = true;
- if (!root.has('EF')) {
- this.contentAvailable = false;
- (0, _util.warn)('Non-embedded file specifications are not supported');
- }
- }
- function pickPlatformItem(dict) {
- if (dict.has('UF')) {
- return dict.get('UF');
- } else if (dict.has('F')) {
- return dict.get('F');
- } else if (dict.has('Unix')) {
- return dict.get('Unix');
- } else if (dict.has('Mac')) {
- return dict.get('Mac');
- } else if (dict.has('DOS')) {
- return dict.get('DOS');
- }
- return null;
- }
- FileSpec.prototype = {
- get filename() {
- if (!this._filename && this.root) {
- var filename = pickPlatformItem(this.root) || 'unnamed';
- this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, '\\').replace(/\\\//g, '/').replace(/\\/g, '/');
- }
- return this._filename;
- },
- get content() {
- if (!this.contentAvailable) {
- return null;
- }
- if (!this.contentRef && this.root) {
- this.contentRef = pickPlatformItem(this.root.get('EF'));
- }
- var content = null;
- if (this.contentRef) {
- var xref = this.xref;
- var fileObj = xref.fetchIfRef(this.contentRef);
- if (fileObj && (0, _primitives.isStream)(fileObj)) {
- content = fileObj.getBytes();
- } else {
- (0, _util.warn)('Embedded file specification points to non-existing/invalid ' + 'content');
- }
- } else {
- (0, _util.warn)('Embedded file specification does not have a content');
- }
- return content;
- },
- get serializable() {
- return {
- filename: this.filename,
- content: this.content
- };
- }
- };
- return FileSpec;
-}();
-var ObjectLoader = function () {
- function mayHaveChildren(value) {
- return (0, _primitives.isRef)(value) || (0, _primitives.isDict)(value) || Array.isArray(value) || (0, _primitives.isStream)(value);
- }
- function addChildren(node, nodesToVisit) {
- if ((0, _primitives.isDict)(node) || (0, _primitives.isStream)(node)) {
- var dict = (0, _primitives.isDict)(node) ? node : node.dict;
- var dictKeys = dict.getKeys();
- for (var i = 0, ii = dictKeys.length; i < ii; i++) {
- var rawValue = dict.getRaw(dictKeys[i]);
- if (mayHaveChildren(rawValue)) {
- nodesToVisit.push(rawValue);
- }
- }
- } else if (Array.isArray(node)) {
- for (var _i3 = 0, _ii2 = node.length; _i3 < _ii2; _i3++) {
- var value = node[_i3];
- if (mayHaveChildren(value)) {
- nodesToVisit.push(value);
- }
- }
- }
- }
- function ObjectLoader(dict, keys, xref) {
- this.dict = dict;
- this.keys = keys;
- this.xref = xref;
- this.refSet = null;
- this.capability = null;
- }
- ObjectLoader.prototype = {
- load: function load() {
- this.capability = (0, _util.createPromiseCapability)();
- if (!(this.xref.stream instanceof _chunked_stream.ChunkedStream) || this.xref.stream.getMissingChunks().length === 0) {
- this.capability.resolve();
- return this.capability.promise;
- }
- var keys = this.keys,
- dict = this.dict;
-
- this.refSet = new _primitives.RefSet();
- var nodesToVisit = [];
- for (var i = 0, ii = keys.length; i < ii; i++) {
- var rawValue = dict.getRaw(keys[i]);
- if (rawValue !== undefined) {
- nodesToVisit.push(rawValue);
- }
- }
- this._walk(nodesToVisit);
- return this.capability.promise;
- },
- _walk: function _walk(nodesToVisit) {
- var _this4 = this;
-
- var nodesToRevisit = [];
- var pendingRequests = [];
- while (nodesToVisit.length) {
- var _currentNode = nodesToVisit.pop();
- if ((0, _primitives.isRef)(_currentNode)) {
- if (this.refSet.has(_currentNode)) {
- continue;
- }
- try {
- this.refSet.put(_currentNode);
- _currentNode = this.xref.fetch(_currentNode);
- } catch (ex) {
- if (!(ex instanceof _util.MissingDataException)) {
- throw ex;
- }
- nodesToRevisit.push(_currentNode);
- pendingRequests.push({
- begin: ex.begin,
- end: ex.end
- });
- }
- }
- if (_currentNode && _currentNode.getBaseStreams) {
- var baseStreams = _currentNode.getBaseStreams();
- var foundMissingData = false;
- for (var i = 0, ii = baseStreams.length; i < ii; i++) {
- var stream = baseStreams[i];
- if (stream.getMissingChunks && stream.getMissingChunks().length) {
- foundMissingData = true;
- pendingRequests.push({
- begin: stream.start,
- end: stream.end
- });
- }
- }
- if (foundMissingData) {
- nodesToRevisit.push(_currentNode);
- }
- }
- addChildren(_currentNode, nodesToVisit);
- }
- if (pendingRequests.length) {
- this.xref.stream.manager.requestRanges(pendingRequests).then(function () {
- for (var _i4 = 0, _ii3 = nodesToRevisit.length; _i4 < _ii3; _i4++) {
- var node = nodesToRevisit[_i4];
- if ((0, _primitives.isRef)(node)) {
- _this4.refSet.remove(node);
- }
- }
- _this4._walk(nodesToRevisit);
- }, this.capability.reject);
- return;
- }
- this.refSet = null;
- this.capability.resolve();
- }
- };
- return ObjectLoader;
-}();
-exports.Catalog = Catalog;
-exports.ObjectLoader = ObjectLoader;
-exports.XRef = XRef;
-exports.FileSpec = FileSpec;
-
-/***/ }),
-/* 138 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-var 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;
-}();
-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;
-}();
-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;
-}();
-var Ref = function RefClosure() {
- function Ref(num, gen) {
- this.num = num;
- this.gen = gen;
- }
- Ref.prototype = {
- toString: function Ref_toString() {
- var str = this.num + 'R';
- if (this.gen !== 0) {
- str += this.gen;
- }
- return str;
- }
- };
- return 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;
-}();
-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;
-}();
-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 === 'undefined' ? 'undefined' : _typeof(v)) === 'object' && v !== null && v.getBytes !== undefined;
-}
-exports.EOF = EOF;
-exports.Cmd = Cmd;
-exports.Dict = Dict;
-exports.Name = Name;
-exports.Ref = Ref;
-exports.RefSet = RefSet;
-exports.RefSetCache = RefSetCache;
-exports.isEOF = isEOF;
-exports.isCmd = isCmd;
-exports.isDict = isDict;
-exports.isName = isName;
-exports.isRef = isRef;
-exports.isRefsEqual = isRefsEqual;
-exports.isStream = isStream;
-
-/***/ }),
-/* 139 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.Parser = exports.Linearization = exports.Lexer = undefined;
-
-var _stream = __w_pdfjs_require__(140);
-
-var _util = __w_pdfjs_require__(2);
-
-var _primitives = __w_pdfjs_require__(138);
-
-var _ccitt_stream = __w_pdfjs_require__(141);
-
-var _jbig2_stream = __w_pdfjs_require__(143);
-
-var _jpeg_stream = __w_pdfjs_require__(146);
-
-var _jpx_stream = __w_pdfjs_require__(148);
-
-var MAX_LENGTH_TO_CACHE = 1000;
-var MAX_ADLER32_LENGTH = 5552;
-function computeAdler32(bytes) {
- var bytesLength = bytes.length;
- var a = 1,
- b = 0;
- for (var i = 0; i < bytesLength; ++i) {
- a += bytes[i] & 0xFF;
- b += a;
- }
- return b % 65521 << 16 | a % 65521;
-}
-var Parser = function ParserClosure() {
- function Parser(lexer, allowStreams, xref, recoveryMode) {
- this.lexer = lexer;
- this.allowStreams = allowStreams;
- this.xref = xref;
- this.recoveryMode = recoveryMode || false;
- this.imageCache = Object.create(null);
- this.refill();
- }
- Parser.prototype = {
- refill: function Parser_refill() {
- this.buf1 = this.lexer.getObj();
- this.buf2 = this.lexer.getObj();
- },
- shift: function Parser_shift() {
- if ((0, _primitives.isCmd)(this.buf2, 'ID')) {
- this.buf1 = this.buf2;
- this.buf2 = null;
- } else {
- this.buf1 = this.buf2;
- this.buf2 = this.lexer.getObj();
- }
- },
- tryShift: function Parser_tryShift() {
- try {
- this.shift();
- return true;
- } catch (e) {
- if (e instanceof _util.MissingDataException) {
- throw e;
- }
- return false;
- }
- },
- getObj: function Parser_getObj(cipherTransform) {
- var buf1 = this.buf1;
- this.shift();
- if (buf1 instanceof _primitives.Cmd) {
- switch (buf1.cmd) {
- case 'BI':
- return this.makeInlineImage(cipherTransform);
- case '[':
- var array = [];
- while (!(0, _primitives.isCmd)(this.buf1, ']') && !(0, _primitives.isEOF)(this.buf1)) {
- array.push(this.getObj(cipherTransform));
- }
- if ((0, _primitives.isEOF)(this.buf1)) {
- if (!this.recoveryMode) {
- throw new _util.FormatError('End of file inside array');
- }
- return array;
- }
- this.shift();
- return array;
- case '<<':
- var dict = new _primitives.Dict(this.xref);
- while (!(0, _primitives.isCmd)(this.buf1, '>>') && !(0, _primitives.isEOF)(this.buf1)) {
- if (!(0, _primitives.isName)(this.buf1)) {
- (0, _util.info)('Malformed dictionary: key must be a name object');
- this.shift();
- continue;
- }
- var key = this.buf1.name;
- this.shift();
- if ((0, _primitives.isEOF)(this.buf1)) {
- break;
- }
- dict.set(key, this.getObj(cipherTransform));
- }
- if ((0, _primitives.isEOF)(this.buf1)) {
- if (!this.recoveryMode) {
- throw new _util.FormatError('End of file inside dictionary');
- }
- return dict;
- }
- if ((0, _primitives.isCmd)(this.buf2, 'stream')) {
- return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
- }
- this.shift();
- return dict;
- default:
- return buf1;
- }
- }
- if (Number.isInteger(buf1)) {
- var num = buf1;
- if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, 'R')) {
- var ref = new _primitives.Ref(num, this.buf1);
- this.shift();
- this.shift();
- return ref;
- }
- return num;
- }
- if ((0, _util.isString)(buf1)) {
- var str = buf1;
- if (cipherTransform) {
- str = cipherTransform.decryptString(str);
- }
- return str;
- }
- return buf1;
- },
- findDefaultInlineStreamEnd: function findDefaultInlineStreamEnd(stream) {
- var E = 0x45,
- I = 0x49,
- SPACE = 0x20,
- LF = 0xA,
- CR = 0xD;
- var n = 10,
- NUL = 0x0;
- var startPos = stream.pos,
- state = 0,
- ch = void 0,
- maybeEIPos = void 0;
- while ((ch = stream.getByte()) !== -1) {
- if (state === 0) {
- state = ch === E ? 1 : 0;
- } else if (state === 1) {
- state = ch === I ? 2 : 0;
- } else {
- (0, _util.assert)(state === 2);
- if (ch === SPACE || ch === LF || ch === CR) {
- maybeEIPos = stream.pos;
- var followingBytes = stream.peekBytes(n);
- for (var i = 0, ii = followingBytes.length; i < ii; i++) {
- ch = followingBytes[i];
- if (ch === NUL && followingBytes[i + 1] !== NUL) {
- continue;
- }
- if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7F)) {
- state = 0;
- break;
- }
- }
- if (state === 2) {
- break;
- }
- } else {
- state = 0;
- }
- }
- }
- if (ch === -1) {
- (0, _util.warn)('findDefaultInlineStreamEnd: ' + 'Reached the end of the stream without finding a valid EI marker');
- if (maybeEIPos) {
- (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
- stream.skip(-(stream.pos - maybeEIPos));
- }
- }
- return stream.pos - 4 - startPos;
- },
-
- findDCTDecodeInlineStreamEnd: function Parser_findDCTDecodeInlineStreamEnd(stream) {
- var startPos = stream.pos,
- foundEOI = false,
- b,
- markerLength,
- length;
- while ((b = stream.getByte()) !== -1) {
- if (b !== 0xFF) {
- continue;
- }
- switch (stream.getByte()) {
- case 0x00:
- break;
- case 0xFF:
- stream.skip(-1);
- break;
- case 0xD9:
- foundEOI = true;
- break;
- case 0xC0:
- case 0xC1:
- case 0xC2:
- case 0xC3:
- case 0xC5:
- case 0xC6:
- case 0xC7:
- case 0xC9:
- case 0xCA:
- case 0xCB:
- case 0xCD:
- case 0xCE:
- case 0xCF:
- case 0xC4:
- case 0xCC:
- case 0xDA:
- case 0xDB:
- case 0xDC:
- case 0xDD:
- case 0xDE:
- case 0xDF:
- case 0xE0:
- case 0xE1:
- case 0xE2:
- case 0xE3:
- case 0xE4:
- case 0xE5:
- case 0xE6:
- case 0xE7:
- case 0xE8:
- case 0xE9:
- case 0xEA:
- case 0xEB:
- case 0xEC:
- case 0xED:
- case 0xEE:
- case 0xEF:
- case 0xFE:
- markerLength = stream.getUint16();
- if (markerLength > 2) {
- stream.skip(markerLength - 2);
- } else {
- stream.skip(-2);
- }
- break;
- }
- if (foundEOI) {
- break;
- }
- }
- length = stream.pos - startPos;
- if (b === -1) {
- (0, _util.warn)('Inline DCTDecode image stream: ' + 'EOI marker not found, searching for /EI/ instead.');
- stream.skip(-length);
- return this.findDefaultInlineStreamEnd(stream);
- }
- this.inlineStreamSkipEI(stream);
- return length;
- },
- findASCII85DecodeInlineStreamEnd: function Parser_findASCII85DecodeInlineStreamEnd(stream) {
- var TILDE = 0x7E,
- GT = 0x3E;
- var startPos = stream.pos,
- ch,
- length;
- while ((ch = stream.getByte()) !== -1) {
- if (ch === TILDE && stream.peekByte() === GT) {
- stream.skip();
- break;
- }
- }
- length = stream.pos - startPos;
- if (ch === -1) {
- (0, _util.warn)('Inline ASCII85Decode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
- stream.skip(-length);
- return this.findDefaultInlineStreamEnd(stream);
- }
- this.inlineStreamSkipEI(stream);
- return length;
- },
- findASCIIHexDecodeInlineStreamEnd: function Parser_findASCIIHexDecodeInlineStreamEnd(stream) {
- var GT = 0x3E;
- var startPos = stream.pos,
- ch,
- length;
- while ((ch = stream.getByte()) !== -1) {
- if (ch === GT) {
- break;
- }
- }
- length = stream.pos - startPos;
- if (ch === -1) {
- (0, _util.warn)('Inline ASCIIHexDecode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
- stream.skip(-length);
- return this.findDefaultInlineStreamEnd(stream);
- }
- this.inlineStreamSkipEI(stream);
- return length;
- },
- inlineStreamSkipEI: function Parser_inlineStreamSkipEI(stream) {
- var E = 0x45,
- I = 0x49;
- var state = 0,
- ch;
- while ((ch = stream.getByte()) !== -1) {
- if (state === 0) {
- state = ch === E ? 1 : 0;
- } else if (state === 1) {
- state = ch === I ? 2 : 0;
- } else if (state === 2) {
- break;
- }
- }
- },
- makeInlineImage: function Parser_makeInlineImage(cipherTransform) {
- var lexer = this.lexer;
- var stream = lexer.stream;
- var dict = new _primitives.Dict(this.xref),
- dictLength = void 0;
- while (!(0, _primitives.isCmd)(this.buf1, 'ID') && !(0, _primitives.isEOF)(this.buf1)) {
- if (!(0, _primitives.isName)(this.buf1)) {
- throw new _util.FormatError('Dictionary key must be a name object');
- }
- var key = this.buf1.name;
- this.shift();
- if ((0, _primitives.isEOF)(this.buf1)) {
- break;
- }
- dict.set(key, this.getObj(cipherTransform));
- }
- if (lexer.beginInlineImagePos !== -1) {
- dictLength = stream.pos - lexer.beginInlineImagePos;
- }
- var filter = dict.get('Filter', 'F'),
- filterName;
- if ((0, _primitives.isName)(filter)) {
- filterName = filter.name;
- } else if (Array.isArray(filter)) {
- var filterZero = this.xref.fetchIfRef(filter[0]);
- if ((0, _primitives.isName)(filterZero)) {
- filterName = filterZero.name;
- }
- }
- var startPos = stream.pos,
- length = void 0;
- if (filterName === 'DCTDecode' || filterName === 'DCT') {
- length = this.findDCTDecodeInlineStreamEnd(stream);
- } else if (filterName === 'ASCII85Decode' || filterName === 'A85') {
- length = this.findASCII85DecodeInlineStreamEnd(stream);
- } else if (filterName === 'ASCIIHexDecode' || filterName === 'AHx') {
- length = this.findASCIIHexDecodeInlineStreamEnd(stream);
- } else {
- length = this.findDefaultInlineStreamEnd(stream);
- }
- var imageStream = stream.makeSubStream(startPos, length, dict);
- var cacheKey = void 0;
- if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
- var imageBytes = imageStream.getBytes();
- imageStream.reset();
- var initialStreamPos = stream.pos;
- stream.pos = lexer.beginInlineImagePos;
- var dictBytes = stream.getBytes(dictLength);
- stream.pos = initialStreamPos;
- cacheKey = computeAdler32(imageBytes) + '_' + computeAdler32(dictBytes);
- var cacheEntry = this.imageCache[cacheKey];
- if (cacheEntry !== undefined) {
- this.buf2 = _primitives.Cmd.get('EI');
- this.shift();
- cacheEntry.reset();
- return cacheEntry;
- }
- }
- if (cipherTransform) {
- imageStream = cipherTransform.createStream(imageStream, length);
- }
- imageStream = this.filter(imageStream, dict, length);
- imageStream.dict = dict;
- if (cacheKey !== undefined) {
- imageStream.cacheKey = 'inline_' + length + '_' + cacheKey;
- this.imageCache[cacheKey] = imageStream;
- }
- this.buf2 = _primitives.Cmd.get('EI');
- this.shift();
- return imageStream;
- },
- _findStreamLength: function _findStreamLength(startPos, signature) {
- var stream = this.lexer.stream;
-
- stream.pos = startPos;
- var SCAN_BLOCK_LENGTH = 2048;
- var signatureLength = signature.length;
- while (stream.pos < stream.end) {
- var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
- var scanLength = scanBytes.length - signatureLength;
- if (scanLength <= 0) {
- break;
- }
- var pos = 0;
- while (pos < scanLength) {
- var j = 0;
- while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
- j++;
- }
- if (j >= signatureLength) {
- stream.pos += pos;
- return stream.pos - startPos;
- }
- pos++;
- }
- stream.pos += scanLength;
- }
- return -1;
- },
-
- makeStream: function Parser_makeStream(dict, cipherTransform) {
- var lexer = this.lexer;
- var stream = lexer.stream;
- lexer.skipToNextLine();
- var startPos = stream.pos - 1;
- var length = dict.get('Length');
- if (!Number.isInteger(length)) {
- (0, _util.info)('Bad ' + length + ' attribute in stream');
- length = 0;
- }
- stream.pos = startPos + length;
- lexer.nextChar();
- if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, 'endstream')) {
- this.shift();
- } else {
- var ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6E, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D]);
- var actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
- if (actualLength < 0) {
- var MAX_TRUNCATION = 1;
- for (var i = 1; i <= MAX_TRUNCATION; i++) {
- var end = ENDSTREAM_SIGNATURE.length - i;
- var TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
- var maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
- if (maybeLength >= 0) {
- var lastByte = stream.peekBytes(end + 1)[end];
- if (!(0, _util.isSpace)(lastByte)) {
- break;
- }
- (0, _util.info)('Found "' + (0, _util.bytesToString)(TRUNCATED_SIGNATURE) + '" when ' + 'searching for endstream command.');
- actualLength = maybeLength;
- break;
- }
- }
- if (actualLength < 0) {
- throw new _util.FormatError('Missing endstream command.');
- }
- }
- length = actualLength;
- lexer.nextChar();
- this.shift();
- this.shift();
- }
- this.shift();
- stream = stream.makeSubStream(startPos, length, dict);
- if (cipherTransform) {
- stream = cipherTransform.createStream(stream, length);
- }
- stream = this.filter(stream, dict, length);
- stream.dict = dict;
- return stream;
- },
- filter: function Parser_filter(stream, dict, length) {
- var filter = dict.get('Filter', 'F');
- var params = dict.get('DecodeParms', 'DP');
- if ((0, _primitives.isName)(filter)) {
- if (Array.isArray(params)) {
- (0, _util.warn)('/DecodeParms should not contain an Array, ' + 'when /Filter contains a Name.');
- }
- return this.makeFilter(stream, filter.name, length, params);
- }
- var maybeLength = length;
- if (Array.isArray(filter)) {
- var filterArray = filter;
- var paramsArray = params;
- for (var i = 0, ii = filterArray.length; i < ii; ++i) {
- filter = this.xref.fetchIfRef(filterArray[i]);
- if (!(0, _primitives.isName)(filter)) {
- throw new _util.FormatError('Bad filter name: ' + filter);
- }
- params = null;
- if (Array.isArray(paramsArray) && i in paramsArray) {
- params = this.xref.fetchIfRef(paramsArray[i]);
- }
- stream = this.makeFilter(stream, filter.name, maybeLength, params);
- maybeLength = null;
- }
- }
- return stream;
- },
- makeFilter: function Parser_makeFilter(stream, name, maybeLength, params) {
- if (maybeLength === 0) {
- (0, _util.warn)('Empty "' + name + '" stream.');
- return new _stream.NullStream();
- }
- try {
- var xrefStreamStats = this.xref.stats.streamTypes;
- if (name === 'FlateDecode' || name === 'Fl') {
- xrefStreamStats[_util.StreamType.FLATE] = true;
- if (params) {
- return new _stream.PredictorStream(new _stream.FlateStream(stream, maybeLength), maybeLength, params);
- }
- return new _stream.FlateStream(stream, maybeLength);
- }
- if (name === 'LZWDecode' || name === 'LZW') {
- xrefStreamStats[_util.StreamType.LZW] = true;
- var earlyChange = 1;
- if (params) {
- if (params.has('EarlyChange')) {
- earlyChange = params.get('EarlyChange');
- }
- return new _stream.PredictorStream(new _stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
- }
- return new _stream.LZWStream(stream, maybeLength, earlyChange);
- }
- if (name === 'DCTDecode' || name === 'DCT') {
- xrefStreamStats[_util.StreamType.DCT] = true;
- return new _jpeg_stream.JpegStream(stream, maybeLength, stream.dict, params);
- }
- if (name === 'JPXDecode' || name === 'JPX') {
- xrefStreamStats[_util.StreamType.JPX] = true;
- return new _jpx_stream.JpxStream(stream, maybeLength, stream.dict, params);
- }
- if (name === 'ASCII85Decode' || name === 'A85') {
- xrefStreamStats[_util.StreamType.A85] = true;
- return new _stream.Ascii85Stream(stream, maybeLength);
- }
- if (name === 'ASCIIHexDecode' || name === 'AHx') {
- xrefStreamStats[_util.StreamType.AHX] = true;
- return new _stream.AsciiHexStream(stream, maybeLength);
- }
- if (name === 'CCITTFaxDecode' || name === 'CCF') {
- xrefStreamStats[_util.StreamType.CCF] = true;
- return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
- }
- if (name === 'RunLengthDecode' || name === 'RL') {
- xrefStreamStats[_util.StreamType.RL] = true;
- return new _stream.RunLengthStream(stream, maybeLength);
- }
- if (name === 'JBIG2Decode') {
- xrefStreamStats[_util.StreamType.JBIG] = true;
- return new _jbig2_stream.Jbig2Stream(stream, maybeLength, stream.dict, params);
- }
- (0, _util.warn)('filter "' + name + '" not supported yet');
- return stream;
- } catch (ex) {
- if (ex instanceof _util.MissingDataException) {
- throw ex;
- }
- (0, _util.warn)('Invalid stream: \"' + ex + '\"');
- return new _stream.NullStream();
- }
- }
- };
- return Parser;
-}();
-var Lexer = function LexerClosure() {
- function Lexer(stream, knownCommands) {
- this.stream = stream;
- this.nextChar();
- this.strBuf = [];
- this.knownCommands = knownCommands;
- this.beginInlineImagePos = -1;
- }
- 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];
- function toHexDigit(ch) {
- if (ch >= 0x30 && ch <= 0x39) {
- return ch & 0x0F;
- }
- if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
- return (ch & 0x0F) + 9;
- }
- return -1;
- }
- Lexer.prototype = {
- nextChar: function Lexer_nextChar() {
- return this.currentChar = this.stream.getByte();
- },
- peekChar: function Lexer_peekChar() {
- return this.stream.peekByte();
- },
- getNumber: function Lexer_getNumber() {
- var ch = this.currentChar;
- var eNotation = false;
- var divideBy = 0;
- var sign = 0;
- if (ch === 0x2D) {
- sign = -1;
- ch = this.nextChar();
- if (ch === 0x2D) {
- ch = this.nextChar();
- }
- } else if (ch === 0x2B) {
- sign = 1;
- ch = this.nextChar();
- }
- if (ch === 0x0A || ch === 0x0D) {
- do {
- ch = this.nextChar();
- } while (ch === 0x0A || ch === 0x0D);
- }
- if (ch === 0x2E) {
- divideBy = 10;
- ch = this.nextChar();
- }
- if (ch < 0x30 || ch > 0x39) {
- if (divideBy === 10 && sign === 0 && ((0, _util.isSpace)(ch) || ch === -1)) {
- (0, _util.warn)('Lexer.getNumber - treating a single decimal point as zero.');
- return 0;
- }
- throw new _util.FormatError('Invalid number: ' + String.fromCharCode(ch) + ' (charCode ' + ch + ')');
- }
- sign = sign || 1;
- var baseValue = ch - 0x30;
- var powerValue = 0;
- var powerValueSign = 1;
- while ((ch = this.nextChar()) >= 0) {
- if (0x30 <= ch && ch <= 0x39) {
- var currentDigit = ch - 0x30;
- if (eNotation) {
- powerValue = powerValue * 10 + currentDigit;
- } else {
- if (divideBy !== 0) {
- divideBy *= 10;
- }
- baseValue = baseValue * 10 + currentDigit;
- }
- } else if (ch === 0x2E) {
- if (divideBy === 0) {
- divideBy = 1;
- } else {
- break;
- }
- } else if (ch === 0x2D) {
- (0, _util.warn)('Badly formatted number');
- } else if (ch === 0x45 || ch === 0x65) {
- ch = this.peekChar();
- if (ch === 0x2B || ch === 0x2D) {
- powerValueSign = ch === 0x2D ? -1 : 1;
- this.nextChar();
- } else if (ch < 0x30 || ch > 0x39) {
- break;
- }
- eNotation = true;
- } else {
- break;
- }
- }
- if (divideBy !== 0) {
- baseValue /= divideBy;
- }
- if (eNotation) {
- baseValue *= Math.pow(10, powerValueSign * powerValue);
- }
- return sign * baseValue;
- },
- getString: function Lexer_getString() {
- var numParen = 1;
- var done = false;
- var strBuf = this.strBuf;
- strBuf.length = 0;
- var ch = this.nextChar();
- while (true) {
- var charBuffered = false;
- switch (ch | 0) {
- case -1:
- (0, _util.warn)('Unterminated string');
- done = true;
- break;
- case 0x28:
- ++numParen;
- strBuf.push('(');
- break;
- case 0x29:
- if (--numParen === 0) {
- this.nextChar();
- done = true;
- } else {
- strBuf.push(')');
- }
- break;
- case 0x5C:
- ch = this.nextChar();
- switch (ch) {
- case -1:
- (0, _util.warn)('Unterminated string');
- done = true;
- break;
- case 0x6E:
- strBuf.push('\n');
- break;
- case 0x72:
- strBuf.push('\r');
- break;
- case 0x74:
- strBuf.push('\t');
- break;
- case 0x62:
- strBuf.push('\b');
- break;
- case 0x66:
- strBuf.push('\f');
- break;
- case 0x5C:
- case 0x28:
- case 0x29:
- strBuf.push(String.fromCharCode(ch));
- break;
- case 0x30:
- case 0x31:
- case 0x32:
- case 0x33:
- case 0x34:
- case 0x35:
- case 0x36:
- case 0x37:
- var x = ch & 0x0F;
- ch = this.nextChar();
- charBuffered = true;
- if (ch >= 0x30 && ch <= 0x37) {
- x = (x << 3) + (ch & 0x0F);
- ch = this.nextChar();
- if (ch >= 0x30 && ch <= 0x37) {
- charBuffered = false;
- x = (x << 3) + (ch & 0x0F);
- }
- }
- strBuf.push(String.fromCharCode(x));
- break;
- case 0x0D:
- if (this.peekChar() === 0x0A) {
- this.nextChar();
- }
- break;
- case 0x0A:
- break;
- default:
- strBuf.push(String.fromCharCode(ch));
- break;
- }
- break;
- default:
- strBuf.push(String.fromCharCode(ch));
- break;
- }
- if (done) {
- break;
- }
- if (!charBuffered) {
- ch = this.nextChar();
- }
- }
- return strBuf.join('');
- },
- getName: function Lexer_getName() {
- var ch, previousCh;
- var strBuf = this.strBuf;
- strBuf.length = 0;
- while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
- if (ch === 0x23) {
- ch = this.nextChar();
- if (specialChars[ch]) {
- (0, _util.warn)('Lexer_getName: ' + 'NUMBER SIGN (#) should be followed by a hexadecimal number.');
- strBuf.push('#');
- break;
- }
- var x = toHexDigit(ch);
- if (x !== -1) {
- previousCh = ch;
- ch = this.nextChar();
- var x2 = toHexDigit(ch);
- if (x2 === -1) {
- (0, _util.warn)('Lexer_getName: Illegal digit (' + String.fromCharCode(ch) + ') in hexadecimal number.');
- strBuf.push('#', String.fromCharCode(previousCh));
- if (specialChars[ch]) {
- break;
- }
- strBuf.push(String.fromCharCode(ch));
- continue;
- }
- strBuf.push(String.fromCharCode(x << 4 | x2));
- } else {
- strBuf.push('#', String.fromCharCode(ch));
- }
- } else {
- strBuf.push(String.fromCharCode(ch));
- }
- }
- if (strBuf.length > 127) {
- (0, _util.warn)('name token is longer than allowed by the spec: ' + strBuf.length);
- }
- return _primitives.Name.get(strBuf.join(''));
- },
- getHexString: function Lexer_getHexString() {
- var strBuf = this.strBuf;
- strBuf.length = 0;
- var ch = this.currentChar;
- var isFirstHex = true;
- var firstDigit;
- var secondDigit;
- while (true) {
- if (ch < 0) {
- (0, _util.warn)('Unterminated hex string');
- break;
- } else if (ch === 0x3E) {
- this.nextChar();
- break;
- } else if (specialChars[ch] === 1) {
- ch = this.nextChar();
- continue;
- } else {
- if (isFirstHex) {
- firstDigit = toHexDigit(ch);
- if (firstDigit === -1) {
- (0, _util.warn)('Ignoring invalid character "' + ch + '" in hex string');
- ch = this.nextChar();
- continue;
- }
- } else {
- secondDigit = toHexDigit(ch);
- if (secondDigit === -1) {
- (0, _util.warn)('Ignoring invalid character "' + ch + '" in hex string');
- ch = this.nextChar();
- continue;
- }
- strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
- }
- isFirstHex = !isFirstHex;
- ch = this.nextChar();
- }
- }
- return strBuf.join('');
- },
- getObj: function Lexer_getObj() {
- var comment = false;
- var ch = this.currentChar;
- while (true) {
- if (ch < 0) {
- return _primitives.EOF;
- }
- if (comment) {
- if (ch === 0x0A || ch === 0x0D) {
- comment = false;
- }
- } else if (ch === 0x25) {
- comment = true;
- } else if (specialChars[ch] !== 1) {
- break;
- }
- ch = this.nextChar();
- }
- switch (ch | 0) {
- case 0x30:
- case 0x31:
- case 0x32:
- case 0x33:
- case 0x34:
- case 0x35:
- case 0x36:
- case 0x37:
- case 0x38:
- case 0x39:
- case 0x2B:
- case 0x2D:
- case 0x2E:
- return this.getNumber();
- case 0x28:
- return this.getString();
- case 0x2F:
- return this.getName();
- case 0x5B:
- this.nextChar();
- return _primitives.Cmd.get('[');
- case 0x5D:
- this.nextChar();
- return _primitives.Cmd.get(']');
- case 0x3C:
- ch = this.nextChar();
- if (ch === 0x3C) {
- this.nextChar();
- return _primitives.Cmd.get('<<');
- }
- return this.getHexString();
- case 0x3E:
- ch = this.nextChar();
- if (ch === 0x3E) {
- this.nextChar();
- return _primitives.Cmd.get('>>');
- }
- return _primitives.Cmd.get('>');
- case 0x7B:
- this.nextChar();
- return _primitives.Cmd.get('{');
- case 0x7D:
- this.nextChar();
- return _primitives.Cmd.get('}');
- case 0x29:
- this.nextChar();
- throw new _util.FormatError('Illegal character: ' + ch);
- }
- var str = String.fromCharCode(ch);
- var knownCommands = this.knownCommands;
- var knownCommandFound = knownCommands && knownCommands[str] !== undefined;
- while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
- var possibleCommand = str + String.fromCharCode(ch);
- if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
- break;
- }
- if (str.length === 128) {
- throw new _util.FormatError('Command token too long: ' + str.length);
- }
- str = possibleCommand;
- knownCommandFound = knownCommands && knownCommands[str] !== undefined;
- }
- if (str === 'true') {
- return true;
- }
- if (str === 'false') {
- return false;
- }
- if (str === 'null') {
- return null;
- }
- if (str === 'BI') {
- this.beginInlineImagePos = this.stream.pos;
- }
- return _primitives.Cmd.get(str);
- },
- skipToNextLine: function Lexer_skipToNextLine() {
- var ch = this.currentChar;
- while (ch >= 0) {
- if (ch === 0x0D) {
- ch = this.nextChar();
- if (ch === 0x0A) {
- this.nextChar();
- }
- break;
- } else if (ch === 0x0A) {
- this.nextChar();
- break;
- }
- ch = this.nextChar();
- }
- }
- };
- return 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;
- }
- throw new Error('The "' + name + '" parameter in the linearization ' + 'dictionary is invalid.');
- }
- 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++) {
- if (!(Number.isInteger(item = hints[index]) && item > 0)) {
- throw new Error('Hint (' + index + ') in the linearization dictionary is invalid.');
- }
- }
- return hints;
- }
- throw new Error('Hint array in the linearization dictionary is invalid.');
- }
- 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('L')) !== stream.length) {
- throw new Error('The "L" parameter in the linearization dictionary ' + 'does not equal the stream length.');
- }
- 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.Lexer = Lexer;
-exports.Linearization = Linearization;
-exports.Parser = Parser;
-
-/***/ }),
-/* 140 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.LZWStream = exports.StringStream = exports.StreamsSequenceStream = exports.Stream = exports.RunLengthStream = exports.PredictorStream = exports.NullStream = exports.FlateStream = exports.DecodeStream = exports.DecryptStream = exports.AsciiHexStream = exports.Ascii85Stream = undefined;
-
-var _util = __w_pdfjs_require__(2);
-
-var _primitives = __w_pdfjs_require__(138);
-
-function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
-
-var Stream = function StreamClosure() {
- function Stream(arrayBuffer, start, length, dict) {
- this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
- this.start = start || 0;
- this.pos = this.start;
- this.end = start + length || this.bytes.length;
- this.dict = dict;
- }
- Stream.prototype = {
- get length() {
- return this.end - this.start;
- },
- get isEmpty() {
- return this.length === 0;
- },
- getByte: function Stream_getByte() {
- if (this.pos >= this.end) {
- return -1;
- }
- return this.bytes[this.pos++];
- },
- getUint16: function Stream_getUint16() {
- var b0 = this.getByte();
- var b1 = this.getByte();
- if (b0 === -1 || b1 === -1) {
- return -1;
- }
- return (b0 << 8) + b1;
- },
- getInt32: function Stream_getInt32() {
- var b0 = this.getByte();
- var b1 = this.getByte();
- var b2 = this.getByte();
- var b3 = this.getByte();
- return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
- },
- getBytes: function getBytes(length) {
- var forceClamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
-
- var bytes = this.bytes;
- var pos = this.pos;
- var strEnd = this.end;
- if (!length) {
- var _subarray = bytes.subarray(pos, strEnd);
- return forceClamped ? new Uint8ClampedArray(_subarray) : _subarray;
- }
- var end = pos + length;
- if (end > strEnd) {
- end = strEnd;
- }
- this.pos = end;
- var subarray = bytes.subarray(pos, end);
- return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
- },
-
- peekByte: function Stream_peekByte() {
- var peekedByte = this.getByte();
- this.pos--;
- return peekedByte;
- },
- peekBytes: function peekBytes(length) {
- var forceClamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
-
- var bytes = this.getBytes(length, forceClamped);
- this.pos -= bytes.length;
- return bytes;
- },
-
- skip: function Stream_skip(n) {
- if (!n) {
- n = 1;
- }
- this.pos += n;
- },
- reset: function Stream_reset() {
- this.pos = this.start;
- },
- moveStart: function Stream_moveStart() {
- this.start = this.pos;
- },
- makeSubStream: function Stream_makeSubStream(start, length, dict) {
- return new Stream(this.bytes.buffer, start, length, dict);
- }
- };
- return Stream;
-}();
-var StringStream = function StringStreamClosure() {
- function StringStream(str) {
- var bytes = (0, _util.stringToBytes)(str);
- Stream.call(this, bytes);
- }
- StringStream.prototype = Stream.prototype;
- return StringStream;
-}();
-var DecodeStream = function DecodeStreamClosure() {
- var emptyBuffer = new Uint8Array(0);
- function DecodeStream(maybeMinBufferLength) {
- this._rawMinBufferLength = maybeMinBufferLength || 0;
- this.pos = 0;
- this.bufferLength = 0;
- this.eof = false;
- this.buffer = emptyBuffer;
- this.minBufferLength = 512;
- if (maybeMinBufferLength) {
- while (this.minBufferLength < maybeMinBufferLength) {
- this.minBufferLength *= 2;
- }
- }
- }
- DecodeStream.prototype = {
- get isEmpty() {
- while (!this.eof && this.bufferLength === 0) {
- this.readBlock();
- }
- return this.bufferLength === 0;
- },
- ensureBuffer: function DecodeStream_ensureBuffer(requested) {
- var buffer = this.buffer;
- if (requested <= buffer.byteLength) {
- return buffer;
- }
- var size = this.minBufferLength;
- while (size < requested) {
- size *= 2;
- }
- var buffer2 = new Uint8Array(size);
- buffer2.set(buffer);
- return this.buffer = buffer2;
- },
- getByte: function DecodeStream_getByte() {
- var pos = this.pos;
- while (this.bufferLength <= pos) {
- if (this.eof) {
- return -1;
- }
- this.readBlock();
- }
- return this.buffer[this.pos++];
- },
- getUint16: function DecodeStream_getUint16() {
- var b0 = this.getByte();
- var b1 = this.getByte();
- if (b0 === -1 || b1 === -1) {
- return -1;
- }
- return (b0 << 8) + b1;
- },
- getInt32: function DecodeStream_getInt32() {
- var b0 = this.getByte();
- var b1 = this.getByte();
- var b2 = this.getByte();
- var b3 = this.getByte();
- return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
- },
- getBytes: function getBytes(length) {
- var forceClamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
-
- var end,
- pos = this.pos;
- if (length) {
- this.ensureBuffer(pos + length);
- end = pos + length;
- while (!this.eof && this.bufferLength < end) {
- this.readBlock();
- }
- var bufEnd = this.bufferLength;
- if (end > bufEnd) {
- end = bufEnd;
- }
- } else {
- while (!this.eof) {
- this.readBlock();
- }
- end = this.bufferLength;
- }
- this.pos = end;
- var subarray = this.buffer.subarray(pos, end);
- return forceClamped && !(subarray instanceof Uint8ClampedArray) ? new Uint8ClampedArray(subarray) : subarray;
- },
-
- peekByte: function DecodeStream_peekByte() {
- var peekedByte = this.getByte();
- this.pos--;
- return peekedByte;
- },
- peekBytes: function peekBytes(length) {
- var forceClamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
-
- var bytes = this.getBytes(length, forceClamped);
- this.pos -= bytes.length;
- return bytes;
- },
-
- makeSubStream: function DecodeStream_makeSubStream(start, length, dict) {
- var end = start + length;
- while (this.bufferLength <= end && !this.eof) {
- this.readBlock();
- }
- return new Stream(this.buffer, start, length, dict);
- },
- skip: function DecodeStream_skip(n) {
- if (!n) {
- n = 1;
- }
- this.pos += n;
- },
- reset: function DecodeStream_reset() {
- this.pos = 0;
- },
- getBaseStreams: function DecodeStream_getBaseStreams() {
- if (this.str && this.str.getBaseStreams) {
- return this.str.getBaseStreams();
- }
- return [];
- }
- };
- return DecodeStream;
-}();
-var StreamsSequenceStream = function StreamsSequenceStreamClosure() {
- function StreamsSequenceStream(streams) {
- this.streams = streams;
- var maybeLength = 0;
- for (var i = 0, ii = streams.length; i < ii; i++) {
- var stream = streams[i];
- if (stream instanceof DecodeStream) {
- maybeLength += stream._rawMinBufferLength;
- } else {
- maybeLength += stream.length;
- }
- }
- DecodeStream.call(this, maybeLength);
- }
- StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype);
- StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() {
- var streams = this.streams;
- if (streams.length === 0) {
- this.eof = true;
- return;
- }
- var stream = streams.shift();
- var chunk = stream.getBytes();
- var bufferLength = this.bufferLength;
- var newLength = bufferLength + chunk.length;
- var buffer = this.ensureBuffer(newLength);
- buffer.set(chunk, bufferLength);
- this.bufferLength = newLength;
- };
- StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() {
- var baseStreams = [];
- for (var i = 0, ii = this.streams.length; i < ii; i++) {
- var stream = this.streams[i];
- if (stream.getBaseStreams) {
- baseStreams.push.apply(baseStreams, _toConsumableArray(stream.getBaseStreams()));
- }
- }
- return baseStreams;
- };
- return StreamsSequenceStream;
-}();
-var FlateStream = function FlateStreamClosure() {
- var codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
- var lengthDecode = new Int32Array([0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a, 0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f, 0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073, 0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102]);
- var distDecode = new Int32Array([0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d, 0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1, 0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01, 0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001]);
- var fixedLitCodeTab = [new Int32Array([0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0, 0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0, 0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0, 0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8, 0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8, 0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8, 0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4, 0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4, 0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4, 0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc, 0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec, 0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc, 0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2, 0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2, 0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2, 0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca, 0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea, 0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da, 0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6, 0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6, 0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6, 0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce, 0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee, 0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de, 0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe, 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1, 0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1, 0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1, 0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9, 0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9, 0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9, 0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5, 0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5, 0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5, 0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd, 0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed, 0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd, 0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3, 0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3, 0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3, 0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb, 0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb, 0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db, 0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7, 0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7, 0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7, 0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b, 0x900f7, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf, 0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef, 0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df, 0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff]), 9];
- var fixedDistCodeTab = [new Int32Array([0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c, 0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000, 0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d, 0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000]), 5];
- function FlateStream(str, maybeLength) {
- this.str = str;
- this.dict = str.dict;
- var cmf = str.getByte();
- var flg = str.getByte();
- if (cmf === -1 || flg === -1) {
- throw new _util.FormatError('Invalid header in flate stream: ' + cmf + ', ' + flg);
- }
- if ((cmf & 0x0f) !== 0x08) {
- throw new _util.FormatError('Unknown compression method in flate stream: ' + cmf + ', ' + flg);
- }
- if (((cmf << 8) + flg) % 31 !== 0) {
- throw new _util.FormatError('Bad FCHECK in flate stream: ' + cmf + ', ' + flg);
- }
- if (flg & 0x20) {
- throw new _util.FormatError('FDICT bit set in flate stream: ' + cmf + ', ' + flg);
- }
- this.codeSize = 0;
- this.codeBuf = 0;
- DecodeStream.call(this, maybeLength);
- }
- FlateStream.prototype = Object.create(DecodeStream.prototype);
- FlateStream.prototype.getBits = function FlateStream_getBits(bits) {
- var str = this.str;
- var codeSize = this.codeSize;
- var codeBuf = this.codeBuf;
- var b;
- while (codeSize < bits) {
- if ((b = str.getByte()) === -1) {
- throw new _util.FormatError('Bad encoding in flate stream');
- }
- codeBuf |= b << codeSize;
- codeSize += 8;
- }
- b = codeBuf & (1 << bits) - 1;
- this.codeBuf = codeBuf >> bits;
- this.codeSize = codeSize -= bits;
- return b;
- };
- FlateStream.prototype.getCode = function FlateStream_getCode(table) {
- var str = this.str;
- var codes = table[0];
- var maxLen = table[1];
- var codeSize = this.codeSize;
- var codeBuf = this.codeBuf;
- var b;
- while (codeSize < maxLen) {
- if ((b = str.getByte()) === -1) {
- break;
- }
- codeBuf |= b << codeSize;
- codeSize += 8;
- }
- var code = codes[codeBuf & (1 << maxLen) - 1];
- var codeLen = code >> 16;
- var codeVal = code & 0xffff;
- if (codeLen < 1 || codeSize < codeLen) {
- throw new _util.FormatError('Bad encoding in flate stream');
- }
- this.codeBuf = codeBuf >> codeLen;
- this.codeSize = codeSize - codeLen;
- return codeVal;
- };
- FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) {
- var n = lengths.length;
- var maxLen = 0;
- var i;
- for (i = 0; i < n; ++i) {
- if (lengths[i] > maxLen) {
- maxLen = lengths[i];
- }
- }
- var size = 1 << maxLen;
- var codes = new Int32Array(size);
- for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
- for (var val = 0; val < n; ++val) {
- if (lengths[val] === len) {
- var code2 = 0;
- var t = code;
- for (i = 0; i < len; ++i) {
- code2 = code2 << 1 | t & 1;
- t >>= 1;
- }
- for (i = code2; i < size; i += skip) {
- codes[i] = len << 16 | val;
- }
- ++code;
- }
- }
- }
- return [codes, maxLen];
- };
- FlateStream.prototype.readBlock = function FlateStream_readBlock() {
- var buffer, len;
- var str = this.str;
- var hdr = this.getBits(3);
- if (hdr & 1) {
- this.eof = true;
- }
- hdr >>= 1;
- if (hdr === 0) {
- var b;
- if ((b = str.getByte()) === -1) {
- throw new _util.FormatError('Bad block header in flate stream');
- }
- var blockLen = b;
- if ((b = str.getByte()) === -1) {
- throw new _util.FormatError('Bad block header in flate stream');
- }
- blockLen |= b << 8;
- if ((b = str.getByte()) === -1) {
- throw new _util.FormatError('Bad block header in flate stream');
- }
- var check = b;
- if ((b = str.getByte()) === -1) {
- throw new _util.FormatError('Bad block header in flate stream');
- }
- check |= b << 8;
- if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
- throw new _util.FormatError('Bad uncompressed block length in flate stream');
- }
- this.codeBuf = 0;
- this.codeSize = 0;
- var bufferLength = this.bufferLength;
- buffer = this.ensureBuffer(bufferLength + blockLen);
- var end = bufferLength + blockLen;
- this.bufferLength = end;
- if (blockLen === 0) {
- if (str.peekByte() === -1) {
- this.eof = true;
- }
- } else {
- for (var n = bufferLength; n < end; ++n) {
- if ((b = str.getByte()) === -1) {
- this.eof = true;
- break;
- }
- buffer[n] = b;
- }
- }
- return;
- }
- var litCodeTable;
- var distCodeTable;
- if (hdr === 1) {
- litCodeTable = fixedLitCodeTab;
- distCodeTable = fixedDistCodeTab;
- } else if (hdr === 2) {
- var numLitCodes = this.getBits(5) + 257;
- var numDistCodes = this.getBits(5) + 1;
- var numCodeLenCodes = this.getBits(4) + 4;
- var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
- var i;
- for (i = 0; i < numCodeLenCodes; ++i) {
- codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
- }
- var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
- len = 0;
- i = 0;
- var codes = numLitCodes + numDistCodes;
- var codeLengths = new Uint8Array(codes);
- var bitsLength, bitsOffset, what;
- while (i < codes) {
- var code = this.getCode(codeLenCodeTab);
- if (code === 16) {
- bitsLength = 2;
- bitsOffset = 3;
- what = len;
- } else if (code === 17) {
- bitsLength = 3;
- bitsOffset = 3;
- what = len = 0;
- } else if (code === 18) {
- bitsLength = 7;
- bitsOffset = 11;
- what = len = 0;
- } else {
- codeLengths[i++] = len = code;
- continue;
- }
- var repeatLength = this.getBits(bitsLength) + bitsOffset;
- while (repeatLength-- > 0) {
- codeLengths[i++] = what;
- }
- }
- litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
- distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
- } else {
- throw new _util.FormatError('Unknown block type in flate stream');
- }
- buffer = this.buffer;
- var limit = buffer ? buffer.length : 0;
- var pos = this.bufferLength;
- while (true) {
- var code1 = this.getCode(litCodeTable);
- if (code1 < 256) {
- if (pos + 1 >= limit) {
- buffer = this.ensureBuffer(pos + 1);
- limit = buffer.length;
- }
- buffer[pos++] = code1;
- continue;
- }
- if (code1 === 256) {
- this.bufferLength = pos;
- return;
- }
- code1 -= 257;
- code1 = lengthDecode[code1];
- var code2 = code1 >> 16;
- if (code2 > 0) {
- code2 = this.getBits(code2);
- }
- len = (code1 & 0xffff) + code2;
- code1 = this.getCode(distCodeTable);
- code1 = distDecode[code1];
- code2 = code1 >> 16;
- if (code2 > 0) {
- code2 = this.getBits(code2);
- }
- var dist = (code1 & 0xffff) + code2;
- if (pos + len >= limit) {
- buffer = this.ensureBuffer(pos + len);
- limit = buffer.length;
- }
- for (var k = 0; k < len; ++k, ++pos) {
- buffer[pos] = buffer[pos - dist];
- }
- }
- };
- return FlateStream;
-}();
-var PredictorStream = function PredictorStreamClosure() {
- function PredictorStream(str, maybeLength, params) {
- if (!(0, _primitives.isDict)(params)) {
- return str;
- }
- var predictor = this.predictor = params.get('Predictor') || 1;
- if (predictor <= 1) {
- return str;
- }
- if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
- throw new _util.FormatError('Unsupported predictor: ' + predictor);
- }
- if (predictor === 2) {
- this.readBlock = this.readBlockTiff;
- } else {
- this.readBlock = this.readBlockPng;
- }
- this.str = str;
- this.dict = str.dict;
- var colors = this.colors = params.get('Colors') || 1;
- var bits = this.bits = params.get('BitsPerComponent') || 8;
- var columns = this.columns = params.get('Columns') || 1;
- this.pixBytes = colors * bits + 7 >> 3;
- this.rowBytes = columns * colors * bits + 7 >> 3;
- DecodeStream.call(this, maybeLength);
- return this;
- }
- PredictorStream.prototype = Object.create(DecodeStream.prototype);
- PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() {
- var rowBytes = this.rowBytes;
- var bufferLength = this.bufferLength;
- var buffer = this.ensureBuffer(bufferLength + rowBytes);
- var bits = this.bits;
- var colors = this.colors;
- var rawBytes = this.str.getBytes(rowBytes);
- this.eof = !rawBytes.length;
- if (this.eof) {
- return;
- }
- var inbuf = 0,
- outbuf = 0;
- var inbits = 0,
- outbits = 0;
- var pos = bufferLength;
- var i;
- if (bits === 1 && colors === 1) {
- for (i = 0; i < rowBytes; ++i) {
- var c = rawBytes[i] ^ inbuf;
- c ^= c >> 1;
- c ^= c >> 2;
- c ^= c >> 4;
- inbuf = (c & 1) << 7;
- buffer[pos++] = c;
- }
- } else if (bits === 8) {
- for (i = 0; i < colors; ++i) {
- buffer[pos++] = rawBytes[i];
- }
- for (; i < rowBytes; ++i) {
- buffer[pos] = buffer[pos - colors] + rawBytes[i];
- pos++;
- }
- } else if (bits === 16) {
- var bytesPerPixel = colors * 2;
- for (i = 0; i < bytesPerPixel; ++i) {
- buffer[pos++] = rawBytes[i];
- }
- for (; i < rowBytes; i += 2) {
- var sum = ((rawBytes[i] & 0xFF) << 8) + (rawBytes[i + 1] & 0xFF) + ((buffer[pos - bytesPerPixel] & 0xFF) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xFF);
- buffer[pos++] = sum >> 8 & 0xFF;
- buffer[pos++] = sum & 0xFF;
- }
- } else {
- var compArray = new Uint8Array(colors + 1);
- var bitMask = (1 << bits) - 1;
- var j = 0,
- k = bufferLength;
- var columns = this.columns;
- for (i = 0; i < columns; ++i) {
- for (var kk = 0; kk < colors; ++kk) {
- if (inbits < bits) {
- inbuf = inbuf << 8 | rawBytes[j++] & 0xFF;
- inbits += 8;
- }
- compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
- inbits -= bits;
- outbuf = outbuf << bits | compArray[kk];
- outbits += bits;
- if (outbits >= 8) {
- buffer[k++] = outbuf >> outbits - 8 & 0xFF;
- outbits -= 8;
- }
- }
- }
- if (outbits > 0) {
- buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
- }
- }
- this.bufferLength += rowBytes;
- };
- PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() {
- var rowBytes = this.rowBytes;
- var pixBytes = this.pixBytes;
- var predictor = this.str.getByte();
- var rawBytes = this.str.getBytes(rowBytes);
- this.eof = !rawBytes.length;
- if (this.eof) {
- return;
- }
- var bufferLength = this.bufferLength;
- var buffer = this.ensureBuffer(bufferLength + rowBytes);
- var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
- if (prevRow.length === 0) {
- prevRow = new Uint8Array(rowBytes);
- }
- var i,
- j = bufferLength,
- up,
- c;
- switch (predictor) {
- case 0:
- for (i = 0; i < rowBytes; ++i) {
- buffer[j++] = rawBytes[i];
- }
- break;
- case 1:
- for (i = 0; i < pixBytes; ++i) {
- buffer[j++] = rawBytes[i];
- }
- for (; i < rowBytes; ++i) {
- buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xFF;
- j++;
- }
- break;
- case 2:
- for (i = 0; i < rowBytes; ++i) {
- buffer[j++] = prevRow[i] + rawBytes[i] & 0xFF;
- }
- break;
- case 3:
- for (i = 0; i < pixBytes; ++i) {
- buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
- }
- for (; i < rowBytes; ++i) {
- buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xFF;
- j++;
- }
- break;
- case 4:
- for (i = 0; i < pixBytes; ++i) {
- up = prevRow[i];
- c = rawBytes[i];
- buffer[j++] = up + c;
- }
- for (; i < rowBytes; ++i) {
- up = prevRow[i];
- var upLeft = prevRow[i - pixBytes];
- var left = buffer[j - pixBytes];
- var p = left + up - upLeft;
- var pa = p - left;
- if (pa < 0) {
- pa = -pa;
- }
- var pb = p - up;
- if (pb < 0) {
- pb = -pb;
- }
- var pc = p - upLeft;
- if (pc < 0) {
- pc = -pc;
- }
- c = rawBytes[i];
- if (pa <= pb && pa <= pc) {
- buffer[j++] = left + c;
- } else if (pb <= pc) {
- buffer[j++] = up + c;
- } else {
- buffer[j++] = upLeft + c;
- }
- }
- break;
- default:
- throw new _util.FormatError('Unsupported predictor: ' + predictor);
- }
- this.bufferLength += rowBytes;
- };
- return PredictorStream;
-}();
-var DecryptStream = function DecryptStreamClosure() {
- function DecryptStream(str, maybeLength, decrypt) {
- this.str = str;
- this.dict = str.dict;
- this.decrypt = decrypt;
- this.nextChunk = null;
- this.initialized = false;
- DecodeStream.call(this, maybeLength);
- }
- var chunkSize = 512;
- DecryptStream.prototype = Object.create(DecodeStream.prototype);
- DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
- var chunk;
- if (this.initialized) {
- chunk = this.nextChunk;
- } else {
- chunk = this.str.getBytes(chunkSize);
- this.initialized = true;
- }
- if (!chunk || chunk.length === 0) {
- this.eof = true;
- return;
- }
- this.nextChunk = this.str.getBytes(chunkSize);
- var hasMoreData = this.nextChunk && this.nextChunk.length > 0;
- var decrypt = this.decrypt;
- chunk = decrypt(chunk, !hasMoreData);
- var bufferLength = this.bufferLength;
- var i,
- n = chunk.length;
- var buffer = this.ensureBuffer(bufferLength + n);
- for (i = 0; i < n; i++) {
- buffer[bufferLength++] = chunk[i];
- }
- this.bufferLength = bufferLength;
- };
- return DecryptStream;
-}();
-var Ascii85Stream = function Ascii85StreamClosure() {
- function Ascii85Stream(str, maybeLength) {
- this.str = str;
- this.dict = str.dict;
- this.input = new Uint8Array(5);
- if (maybeLength) {
- maybeLength = 0.8 * maybeLength;
- }
- DecodeStream.call(this, maybeLength);
- }
- Ascii85Stream.prototype = Object.create(DecodeStream.prototype);
- Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() {
- var TILDA_CHAR = 0x7E;
- var Z_LOWER_CHAR = 0x7A;
- var EOF = -1;
- var str = this.str;
- var c = str.getByte();
- while ((0, _util.isSpace)(c)) {
- c = str.getByte();
- }
- if (c === EOF || c === TILDA_CHAR) {
- this.eof = true;
- return;
- }
- var bufferLength = this.bufferLength,
- buffer;
- var i;
- if (c === Z_LOWER_CHAR) {
- buffer = this.ensureBuffer(bufferLength + 4);
- for (i = 0; i < 4; ++i) {
- buffer[bufferLength + i] = 0;
- }
- this.bufferLength += 4;
- } else {
- var input = this.input;
- input[0] = c;
- for (i = 1; i < 5; ++i) {
- c = str.getByte();
- while ((0, _util.isSpace)(c)) {
- c = str.getByte();
- }
- input[i] = c;
- if (c === EOF || c === TILDA_CHAR) {
- break;
- }
- }
- buffer = this.ensureBuffer(bufferLength + i - 1);
- this.bufferLength += i - 1;
- if (i < 5) {
- for (; i < 5; ++i) {
- input[i] = 0x21 + 84;
- }
- this.eof = true;
- }
- var t = 0;
- for (i = 0; i < 5; ++i) {
- t = t * 85 + (input[i] - 0x21);
- }
- for (i = 3; i >= 0; --i) {
- buffer[bufferLength + i] = t & 0xFF;
- t >>= 8;
- }
- }
- };
- return Ascii85Stream;
-}();
-var AsciiHexStream = function AsciiHexStreamClosure() {
- function AsciiHexStream(str, maybeLength) {
- this.str = str;
- this.dict = str.dict;
- this.firstDigit = -1;
- if (maybeLength) {
- maybeLength = 0.5 * maybeLength;
- }
- DecodeStream.call(this, maybeLength);
- }
- AsciiHexStream.prototype = Object.create(DecodeStream.prototype);
- AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() {
- var UPSTREAM_BLOCK_SIZE = 8000;
- var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
- if (!bytes.length) {
- this.eof = true;
- return;
- }
- var maxDecodeLength = bytes.length + 1 >> 1;
- var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
- var bufferLength = this.bufferLength;
- var firstDigit = this.firstDigit;
- for (var i = 0, ii = bytes.length; i < ii; i++) {
- var ch = bytes[i],
- digit;
- if (ch >= 0x30 && ch <= 0x39) {
- digit = ch & 0x0F;
- } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
- digit = (ch & 0x0F) + 9;
- } else if (ch === 0x3E) {
- this.eof = true;
- break;
- } else {
- continue;
- }
- if (firstDigit < 0) {
- firstDigit = digit;
- } else {
- buffer[bufferLength++] = firstDigit << 4 | digit;
- firstDigit = -1;
- }
- }
- if (firstDigit >= 0 && this.eof) {
- buffer[bufferLength++] = firstDigit << 4;
- firstDigit = -1;
- }
- this.firstDigit = firstDigit;
- this.bufferLength = bufferLength;
- };
- return AsciiHexStream;
-}();
-var RunLengthStream = function RunLengthStreamClosure() {
- function RunLengthStream(str, maybeLength) {
- this.str = str;
- this.dict = str.dict;
- DecodeStream.call(this, maybeLength);
- }
- RunLengthStream.prototype = Object.create(DecodeStream.prototype);
- RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() {
- var repeatHeader = this.str.getBytes(2);
- if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
- this.eof = true;
- return;
- }
- var buffer;
- var bufferLength = this.bufferLength;
- var n = repeatHeader[0];
- if (n < 128) {
- buffer = this.ensureBuffer(bufferLength + n + 1);
- buffer[bufferLength++] = repeatHeader[1];
- if (n > 0) {
- var source = this.str.getBytes(n);
- buffer.set(source, bufferLength);
- bufferLength += n;
- }
- } else {
- n = 257 - n;
- var b = repeatHeader[1];
- buffer = this.ensureBuffer(bufferLength + n + 1);
- for (var i = 0; i < n; i++) {
- buffer[bufferLength++] = b;
- }
- }
- this.bufferLength = bufferLength;
- };
- return RunLengthStream;
-}();
-var LZWStream = function LZWStreamClosure() {
- function LZWStream(str, maybeLength, earlyChange) {
- this.str = str;
- this.dict = str.dict;
- this.cachedData = 0;
- this.bitsCached = 0;
- var maxLzwDictionarySize = 4096;
- var lzwState = {
- earlyChange: earlyChange,
- codeLength: 9,
- nextCode: 258,
- dictionaryValues: new Uint8Array(maxLzwDictionarySize),
- dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
- dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
- currentSequence: new Uint8Array(maxLzwDictionarySize),
- currentSequenceLength: 0
- };
- for (var i = 0; i < 256; ++i) {
- lzwState.dictionaryValues[i] = i;
- lzwState.dictionaryLengths[i] = 1;
- }
- this.lzwState = lzwState;
- DecodeStream.call(this, maybeLength);
- }
- LZWStream.prototype = Object.create(DecodeStream.prototype);
- LZWStream.prototype.readBits = function LZWStream_readBits(n) {
- var bitsCached = this.bitsCached;
- var cachedData = this.cachedData;
- while (bitsCached < n) {
- var c = this.str.getByte();
- if (c === -1) {
- this.eof = true;
- return null;
- }
- cachedData = cachedData << 8 | c;
- bitsCached += 8;
- }
- this.bitsCached = bitsCached -= n;
- this.cachedData = cachedData;
- this.lastCode = null;
- return cachedData >>> bitsCached & (1 << n) - 1;
- };
- LZWStream.prototype.readBlock = function LZWStream_readBlock() {
- var blockSize = 512;
- var estimatedDecodedSize = blockSize * 2,
- decodedSizeDelta = blockSize;
- var i, j, q;
- var lzwState = this.lzwState;
- if (!lzwState) {
- return;
- }
- var earlyChange = lzwState.earlyChange;
- var nextCode = lzwState.nextCode;
- var dictionaryValues = lzwState.dictionaryValues;
- var dictionaryLengths = lzwState.dictionaryLengths;
- var dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
- var codeLength = lzwState.codeLength;
- var prevCode = lzwState.prevCode;
- var currentSequence = lzwState.currentSequence;
- var currentSequenceLength = lzwState.currentSequenceLength;
- var decodedLength = 0;
- var currentBufferLength = this.bufferLength;
- var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
- for (i = 0; i < blockSize; i++) {
- var code = this.readBits(codeLength);
- var hasPrev = currentSequenceLength > 0;
- if (code < 256) {
- currentSequence[0] = code;
- currentSequenceLength = 1;
- } else if (code >= 258) {
- if (code < nextCode) {
- currentSequenceLength = dictionaryLengths[code];
- for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
- currentSequence[j] = dictionaryValues[q];
- q = dictionaryPrevCodes[q];
- }
- } else {
- currentSequence[currentSequenceLength++] = currentSequence[0];
- }
- } else if (code === 256) {
- codeLength = 9;
- nextCode = 258;
- currentSequenceLength = 0;
- continue;
- } else {
- this.eof = true;
- delete this.lzwState;
- break;
- }
- if (hasPrev) {
- dictionaryPrevCodes[nextCode] = prevCode;
- dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
- dictionaryValues[nextCode] = currentSequence[0];
- nextCode++;
- codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
- }
- prevCode = code;
- decodedLength += currentSequenceLength;
- if (estimatedDecodedSize < decodedLength) {
- do {
- estimatedDecodedSize += decodedSizeDelta;
- } while (estimatedDecodedSize < decodedLength);
- buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
- }
- for (j = 0; j < currentSequenceLength; j++) {
- buffer[currentBufferLength++] = currentSequence[j];
- }
- }
- lzwState.nextCode = nextCode;
- lzwState.codeLength = codeLength;
- lzwState.prevCode = prevCode;
- lzwState.currentSequenceLength = currentSequenceLength;
- this.bufferLength = currentBufferLength;
- };
- return LZWStream;
-}();
-var NullStream = function NullStreamClosure() {
- function NullStream() {
- Stream.call(this, new Uint8Array(0));
- }
- NullStream.prototype = Stream.prototype;
- return NullStream;
-}();
-exports.Ascii85Stream = Ascii85Stream;
-exports.AsciiHexStream = AsciiHexStream;
-exports.DecryptStream = DecryptStream;
-exports.DecodeStream = DecodeStream;
-exports.FlateStream = FlateStream;
-exports.NullStream = NullStream;
-exports.PredictorStream = PredictorStream;
-exports.RunLengthStream = RunLengthStream;
-exports.Stream = Stream;
-exports.StreamsSequenceStream = StreamsSequenceStream;
-exports.StringStream = StringStream;
-exports.LZWStream = LZWStream;
-
-/***/ }),
-/* 141 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.CCITTFaxStream = undefined;
-
-var _primitives = __w_pdfjs_require__(138);
-
-var _ccitt = __w_pdfjs_require__(142);
-
-var _stream = __w_pdfjs_require__(140);
-
-var CCITTFaxStream = function CCITTFaxStreamClosure() {
- function CCITTFaxStream(str, maybeLength, params) {
- this.str = str;
- this.dict = str.dict;
- if (!(0, _primitives.isDict)(params)) {
- params = _primitives.Dict.empty;
- }
- var source = {
- next: function next() {
- return str.getByte();
- }
- };
- this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
- K: params.get('K'),
- EndOfLine: params.get('EndOfLine'),
- EncodedByteAlign: params.get('EncodedByteAlign'),
- Columns: params.get('Columns'),
- Rows: params.get('Rows'),
- EndOfBlock: params.get('EndOfBlock'),
- BlackIs1: params.get('BlackIs1')
- });
- _stream.DecodeStream.call(this, maybeLength);
- }
- CCITTFaxStream.prototype = Object.create(_stream.DecodeStream.prototype);
- CCITTFaxStream.prototype.readBlock = function () {
- while (!this.eof) {
- var c = this.ccittFaxDecoder.readNextChar();
- if (c === -1) {
- this.eof = true;
- return;
- }
- this.ensureBuffer(this.bufferLength + 1);
- this.buffer[this.bufferLength++] = c;
- }
- };
- return CCITTFaxStream;
-}();
-exports.CCITTFaxStream = CCITTFaxStream;
-
-/***/ }),
-/* 142 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.CCITTFaxDecoder = undefined;
-
-var _util = __w_pdfjs_require__(2);
-
-var CCITTFaxDecoder = function CCITTFaxDecoder() {
- var ccittEOL = -2;
- var ccittEOF = -1;
- var twoDimPass = 0;
- var twoDimHoriz = 1;
- var twoDimVert0 = 2;
- var twoDimVertR1 = 3;
- var twoDimVertL1 = 4;
- var twoDimVertR2 = 5;
- var twoDimVertL2 = 6;
- var twoDimVertR3 = 7;
- var twoDimVertL3 = 8;
- var twoDimTable = [[-1, -1], [-1, -1], [7, twoDimVertL3], [7, twoDimVertR3], [6, twoDimVertL2], [6, twoDimVertL2], [6, twoDimVertR2], [6, twoDimVertR2], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0]];
- var whiteTable1 = [[-1, -1], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [12, 1984], [12, 2048], [12, 2112], [12, 2176], [12, 2240], [12, 2304], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [12, 2368], [12, 2432], [12, 2496], [12, 2560]];
- var whiteTable2 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [8, 29], [8, 29], [8, 30], [8, 30], [8, 45], [8, 45], [8, 46], [8, 46], [7, 22], [7, 22], [7, 22], [7, 22], [7, 23], [7, 23], [7, 23], [7, 23], [8, 47], [8, 47], [8, 48], [8, 48], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [7, 20], [7, 20], [7, 20], [7, 20], [8, 33], [8, 33], [8, 34], [8, 34], [8, 35], [8, 35], [8, 36], [8, 36], [8, 37], [8, 37], [8, 38], [8, 38], [7, 19], [7, 19], [7, 19], [7, 19], [8, 31], [8, 31], [8, 32], [8, 32], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [8, 53], [8, 53], [8, 54], [8, 54], [7, 26], [7, 26], [7, 26], [7, 26], [8, 39], [8, 39], [8, 40], [8, 40], [8, 41], [8, 41], [8, 42], [8, 42], [8, 43], [8, 43], [8, 44], [8, 44], [7, 21], [7, 21], [7, 21], [7, 21], [7, 28], [7, 28], [7, 28], [7, 28], [8, 61], [8, 61], [8, 62], [8, 62], [8, 63], [8, 63], [8, 0], [8, 0], [8, 320], [8, 320], [8, 384], [8, 384], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [7, 27], [7, 27], [7, 27], [7, 27], [8, 59], [8, 59], [8, 60], [8, 60], [9, 1472], [9, 1536], [9, 1600], [9, 1728], [7, 18], [7, 18], [7, 18], [7, 18], [7, 24], [7, 24], [7, 24], [7, 24], [8, 49], [8, 49], [8, 50], [8, 50], [8, 51], [8, 51], [8, 52], [8, 52], [7, 25], [7, 25], [7, 25], [7, 25], [8, 55], [8, 55], [8, 56], [8, 56], [8, 57], [8, 57], [8, 58], [8, 58], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [8, 448], [8, 448], [8, 512], [8, 512], [9, 704], [9, 768], [8, 640], [8, 640], [8, 576], [8, 576], [9, 832], [9, 896], [9, 960], [9, 1024], [9, 1088], [9, 1152], [9, 1216], [9, 1280], [9, 1344], [9, 1408], [7, 256], [7, 256], [7, 256], [7, 256], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7]];
- var blackTable1 = [[-1, -1], [-1, -1], [12, ccittEOL], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [11, 1792], [11, 1792], [12, 1984], [12, 1984], [12, 2048], [12, 2048], [12, 2112], [12, 2112], [12, 2176], [12, 2176], [12, 2240], [12, 2240], [12, 2304], [12, 2304], [11, 1856], [11, 1856], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [11, 1920], [11, 1920], [12, 2368], [12, 2368], [12, 2432], [12, 2432], [12, 2496], [12, 2496], [12, 2560], [12, 2560], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [12, 52], [12, 52], [13, 640], [13, 704], [13, 768], [13, 832], [12, 55], [12, 55], [12, 56], [12, 56], [13, 1280], [13, 1344], [13, 1408], [13, 1472], [12, 59], [12, 59], [12, 60], [12, 60], [13, 1536], [13, 1600], [11, 24], [11, 24], [11, 24], [11, 24], [11, 25], [11, 25], [11, 25], [11, 25], [13, 1664], [13, 1728], [12, 320], [12, 320], [12, 384], [12, 384], [12, 448], [12, 448], [13, 512], [13, 576], [12, 53], [12, 53], [12, 54], [12, 54], [13, 896], [13, 960], [13, 1024], [13, 1088], [13, 1152], [13, 1216], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64]];
- var blackTable2 = [[8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [11, 23], [11, 23], [12, 50], [12, 51], [12, 44], [12, 45], [12, 46], [12, 47], [12, 57], [12, 58], [12, 61], [12, 256], [10, 16], [10, 16], [10, 16], [10, 16], [10, 17], [10, 17], [10, 17], [10, 17], [12, 48], [12, 49], [12, 62], [12, 63], [12, 30], [12, 31], [12, 32], [12, 33], [12, 40], [12, 41], [11, 22], [11, 22], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [12, 128], [12, 192], [12, 26], [12, 27], [12, 28], [12, 29], [11, 19], [11, 19], [11, 20], [11, 20], [12, 34], [12, 35], [12, 36], [12, 37], [12, 38], [12, 39], [11, 21], [11, 21], [12, 42], [12, 43], [10, 0], [10, 0], [10, 0], [10, 0], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12]];
- var blackTable3 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [6, 9], [6, 8], [5, 7], [5, 7], [4, 6], [4, 6], [4, 6], [4, 6], [4, 5], [4, 5], [4, 5], [4, 5], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]];
- function CCITTFaxDecoder(source) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
-
- if (!source || typeof source.next !== 'function') {
- throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
- }
- this.source = source;
- this.eof = false;
- this.encoding = options['K'] || 0;
- this.eoline = options['EndOfLine'] || false;
- this.byteAlign = options['EncodedByteAlign'] || false;
- this.columns = options['Columns'] || 1728;
- this.rows = options['Rows'] || 0;
- var eoblock = options['EndOfBlock'];
- if (eoblock === null || eoblock === undefined) {
- eoblock = true;
- }
- this.eoblock = eoblock;
- this.black = options['BlackIs1'] || false;
- this.codingLine = new Uint32Array(this.columns + 1);
- this.refLine = new Uint32Array(this.columns + 2);
- this.codingLine[0] = this.columns;
- this.codingPos = 0;
- this.row = 0;
- this.nextLine2D = this.encoding < 0;
- this.inputBits = 0;
- this.inputBuf = 0;
- this.outputBits = 0;
- this.rowsDone = false;
- var code1 = void 0;
- while ((code1 = this._lookBits(12)) === 0) {
- this._eatBits(1);
- }
- if (code1 === 1) {
- this._eatBits(12);
- }
- if (this.encoding > 0) {
- this.nextLine2D = !this._lookBits(1);
- this._eatBits(1);
- }
- }
- CCITTFaxDecoder.prototype = {
- readNextChar: function readNextChar() {
- if (this.eof) {
- return -1;
- }
- var refLine = this.refLine;
- var codingLine = this.codingLine;
- var columns = this.columns;
- var refPos = void 0,
- blackPixels = void 0,
- bits = void 0,
- i = void 0;
- if (this.outputBits === 0) {
- if (this.rowsDone) {
- this.eof = true;
- }
- if (this.eof) {
- return -1;
- }
- this.err = false;
- var code1 = void 0,
- code2 = void 0,
- code3 = void 0;
- if (this.nextLine2D) {
- for (i = 0; codingLine[i] < columns; ++i) {
- refLine[i] = codingLine[i];
- }
- refLine[i++] = columns;
- refLine[i] = columns;
- codingLine[0] = 0;
- this.codingPos = 0;
- refPos = 0;
- blackPixels = 0;
- while (codingLine[this.codingPos] < columns) {
- code1 = this._getTwoDimCode();
- switch (code1) {
- case twoDimPass:
- this._addPixels(refLine[refPos + 1], blackPixels);
- if (refLine[refPos + 1] < columns) {
- refPos += 2;
- }
- break;
- case twoDimHoriz:
- code1 = code2 = 0;
- if (blackPixels) {
- do {
- code1 += code3 = this._getBlackCode();
- } while (code3 >= 64);
- do {
- code2 += code3 = this._getWhiteCode();
- } while (code3 >= 64);
- } else {
- do {
- code1 += code3 = this._getWhiteCode();
- } while (code3 >= 64);
- do {
- code2 += code3 = this._getBlackCode();
- } while (code3 >= 64);
- }
- this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
- if (codingLine[this.codingPos] < columns) {
- this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
- }
- while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
- refPos += 2;
- }
- break;
- case twoDimVertR3:
- this._addPixels(refLine[refPos] + 3, blackPixels);
- blackPixels ^= 1;
- if (codingLine[this.codingPos] < columns) {
- ++refPos;
- while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
- refPos += 2;
- }
- }
- break;
- case twoDimVertR2:
- this._addPixels(refLine[refPos] + 2, blackPixels);
- blackPixels ^= 1;
- if (codingLine[this.codingPos] < columns) {
- ++refPos;
- while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
- refPos += 2;
- }
- }
- break;
- case twoDimVertR1:
- this._addPixels(refLine[refPos] + 1, blackPixels);
- blackPixels ^= 1;
- if (codingLine[this.codingPos] < columns) {
- ++refPos;
- while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
- refPos += 2;
- }
- }
- break;
- case twoDimVert0:
- this._addPixels(refLine[refPos], blackPixels);
- blackPixels ^= 1;
- if (codingLine[this.codingPos] < columns) {
- ++refPos;
- while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
- refPos += 2;
- }
- }
- break;
- case twoDimVertL3:
- this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
- blackPixels ^= 1;
- if (codingLine[this.codingPos] < columns) {
- if (refPos > 0) {
- --refPos;
- } else {
- ++refPos;
- }
- while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
- refPos += 2;
- }
- }
- break;
- case twoDimVertL2:
- this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
- blackPixels ^= 1;
- if (codingLine[this.codingPos] < columns) {
- if (refPos > 0) {
- --refPos;
- } else {
- ++refPos;
- }
- while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
- refPos += 2;
- }
- }
- break;
- case twoDimVertL1:
- this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
- blackPixels ^= 1;
- if (codingLine[this.codingPos] < columns) {
- if (refPos > 0) {
- --refPos;
- } else {
- ++refPos;
- }
- while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
- refPos += 2;
- }
- }
- break;
- case ccittEOF:
- this._addPixels(columns, 0);
- this.eof = true;
- break;
- default:
- (0, _util.info)('bad 2d code');
- this._addPixels(columns, 0);
- this.err = true;
- }
- }
- } else {
- codingLine[0] = 0;
- this.codingPos = 0;
- blackPixels = 0;
- while (codingLine[this.codingPos] < columns) {
- code1 = 0;
- if (blackPixels) {
- do {
- code1 += code3 = this._getBlackCode();
- } while (code3 >= 64);
- } else {
- do {
- code1 += code3 = this._getWhiteCode();
- } while (code3 >= 64);
- }
- this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
- blackPixels ^= 1;
- }
- }
- var gotEOL = false;
- if (this.byteAlign) {
- this.inputBits &= ~7;
- }
- if (!this.eoblock && this.row === this.rows - 1) {
- this.rowsDone = true;
- } else {
- code1 = this._lookBits(12);
- if (this.eoline) {
- while (code1 !== ccittEOF && code1 !== 1) {
- this._eatBits(1);
- code1 = this._lookBits(12);
- }
- } else {
- while (code1 === 0) {
- this._eatBits(1);
- code1 = this._lookBits(12);
- }
- }
- if (code1 === 1) {
- this._eatBits(12);
- gotEOL = true;
- } else if (code1 === ccittEOF) {
- this.eof = true;
- }
- }
- if (!this.eof && this.encoding > 0 && !this.rowsDone) {
- this.nextLine2D = !this._lookBits(1);
- this._eatBits(1);
- }
- if (this.eoblock && gotEOL && this.byteAlign) {
- code1 = this._lookBits(12);
- if (code1 === 1) {
- this._eatBits(12);
- if (this.encoding > 0) {
- this._lookBits(1);
- this._eatBits(1);
- }
- if (this.encoding >= 0) {
- for (i = 0; i < 4; ++i) {
- code1 = this._lookBits(12);
- if (code1 !== 1) {
- (0, _util.info)('bad rtc code: ' + code1);
- }
- this._eatBits(12);
- if (this.encoding > 0) {
- this._lookBits(1);
- this._eatBits(1);
- }
- }
- }
- this.eof = true;
- }
- } else if (this.err && this.eoline) {
- while (true) {
- code1 = this._lookBits(13);
- if (code1 === ccittEOF) {
- this.eof = true;
- return -1;
- }
- if (code1 >> 1 === 1) {
- break;
- }
- this._eatBits(1);
- }
- this._eatBits(12);
- if (this.encoding > 0) {
- this._eatBits(1);
- this.nextLine2D = !(code1 & 1);
- }
- }
- if (codingLine[0] > 0) {
- this.outputBits = codingLine[this.codingPos = 0];
- } else {
- this.outputBits = codingLine[this.codingPos = 1];
- }
- this.row++;
- }
- var c = void 0;
- if (this.outputBits >= 8) {
- c = this.codingPos & 1 ? 0 : 0xFF;
- this.outputBits -= 8;
- if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
- this.codingPos++;
- this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
- }
- } else {
- bits = 8;
- c = 0;
- do {
- if (this.outputBits > bits) {
- c <<= bits;
- if (!(this.codingPos & 1)) {
- c |= 0xFF >> 8 - bits;
- }
- this.outputBits -= bits;
- bits = 0;
- } else {
- c <<= this.outputBits;
- if (!(this.codingPos & 1)) {
- c |= 0xFF >> 8 - this.outputBits;
- }
- bits -= this.outputBits;
- this.outputBits = 0;
- if (codingLine[this.codingPos] < columns) {
- this.codingPos++;
- this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
- } else if (bits > 0) {
- c <<= bits;
- bits = 0;
- }
- }
- } while (bits);
- }
- if (this.black) {
- c ^= 0xFF;
- }
- return c;
- },
- _addPixels: function _addPixels(a1, blackPixels) {
- var codingLine = this.codingLine;
- var codingPos = this.codingPos;
- if (a1 > codingLine[codingPos]) {
- if (a1 > this.columns) {
- (0, _util.info)('row is wrong length');
- this.err = true;
- a1 = this.columns;
- }
- if (codingPos & 1 ^ blackPixels) {
- ++codingPos;
- }
- codingLine[codingPos] = a1;
- }
- this.codingPos = codingPos;
- },
- _addPixelsNeg: function _addPixelsNeg(a1, blackPixels) {
- var codingLine = this.codingLine;
- var codingPos = this.codingPos;
- if (a1 > codingLine[codingPos]) {
- if (a1 > this.columns) {
- (0, _util.info)('row is wrong length');
- this.err = true;
- a1 = this.columns;
- }
- if (codingPos & 1 ^ blackPixels) {
- ++codingPos;
- }
- codingLine[codingPos] = a1;
- } else if (a1 < codingLine[codingPos]) {
- if (a1 < 0) {
- (0, _util.info)('invalid code');
- this.err = true;
- a1 = 0;
- }
- while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
- --codingPos;
- }
- codingLine[codingPos] = a1;
- }
- this.codingPos = codingPos;
- },
- _findTableCode: function _findTableCode(start, end, table, limit) {
- var limitValue = limit || 0;
- for (var i = start; i <= end; ++i) {
- var code = this._lookBits(i);
- if (code === ccittEOF) {
- return [true, 1, false];
- }
- if (i < end) {
- code <<= end - i;
- }
- if (!limitValue || code >= limitValue) {
- var p = table[code - limitValue];
- if (p[0] === i) {
- this._eatBits(i);
- return [true, p[1], true];
- }
- }
- }
- return [false, 0, false];
- },
- _getTwoDimCode: function _getTwoDimCode() {
- var code = 0;
- var p = void 0;
- if (this.eoblock) {
- code = this._lookBits(7);
- p = twoDimTable[code];
- if (p && p[0] > 0) {
- this._eatBits(p[0]);
- return p[1];
- }
- } else {
- var result = this._findTableCode(1, 7, twoDimTable);
- if (result[0] && result[2]) {
- return result[1];
- }
- }
- (0, _util.info)('Bad two dim code');
- return ccittEOF;
- },
- _getWhiteCode: function _getWhiteCode() {
- var code = 0;
- var p = void 0;
- if (this.eoblock) {
- code = this._lookBits(12);
- if (code === ccittEOF) {
- return 1;
- }
- if (code >> 5 === 0) {
- p = whiteTable1[code];
- } else {
- p = whiteTable2[code >> 3];
- }
- if (p[0] > 0) {
- this._eatBits(p[0]);
- return p[1];
- }
- } else {
- var result = this._findTableCode(1, 9, whiteTable2);
- if (result[0]) {
- return result[1];
- }
- result = this._findTableCode(11, 12, whiteTable1);
- if (result[0]) {
- return result[1];
- }
- }
- (0, _util.info)('bad white code');
- this._eatBits(1);
- return 1;
- },
- _getBlackCode: function _getBlackCode() {
- var code = void 0,
- p = void 0;
- if (this.eoblock) {
- code = this._lookBits(13);
- if (code === ccittEOF) {
- return 1;
- }
- if (code >> 7 === 0) {
- p = blackTable1[code];
- } else if (code >> 9 === 0 && code >> 7 !== 0) {
- p = blackTable2[(code >> 1) - 64];
- } else {
- p = blackTable3[code >> 7];
- }
- if (p[0] > 0) {
- this._eatBits(p[0]);
- return p[1];
- }
- } else {
- var result = this._findTableCode(2, 6, blackTable3);
- if (result[0]) {
- return result[1];
- }
- result = this._findTableCode(7, 12, blackTable2, 64);
- if (result[0]) {
- return result[1];
- }
- result = this._findTableCode(10, 13, blackTable1);
- if (result[0]) {
- return result[1];
- }
- }
- (0, _util.info)('bad black code');
- this._eatBits(1);
- return 1;
- },
- _lookBits: function _lookBits(n) {
- var c = void 0;
- while (this.inputBits < n) {
- if ((c = this.source.next()) === -1) {
- if (this.inputBits === 0) {
- return ccittEOF;
- }
- return this.inputBuf << n - this.inputBits & 0xFFFF >> 16 - n;
- }
- this.inputBuf = this.inputBuf << 8 | c;
- this.inputBits += 8;
- }
- return this.inputBuf >> this.inputBits - n & 0xFFFF >> 16 - n;
- },
- _eatBits: function _eatBits(n) {
- if ((this.inputBits -= n) < 0) {
- this.inputBits = 0;
- }
- }
- };
- return CCITTFaxDecoder;
-}();
-exports.CCITTFaxDecoder = CCITTFaxDecoder;
-
-/***/ }),
-/* 143 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.Jbig2Stream = undefined;
-
-var _primitives = __w_pdfjs_require__(138);
-
-var _stream = __w_pdfjs_require__(140);
-
-var _jbig = __w_pdfjs_require__(144);
-
-var _util = __w_pdfjs_require__(2);
-
-var Jbig2Stream = function Jbig2StreamClosure() {
- function Jbig2Stream(stream, maybeLength, dict, params) {
- this.stream = stream;
- this.maybeLength = maybeLength;
- this.dict = dict;
- this.params = params;
- _stream.DecodeStream.call(this, maybeLength);
- }
- Jbig2Stream.prototype = Object.create(_stream.DecodeStream.prototype);
- Object.defineProperty(Jbig2Stream.prototype, 'bytes', {
- get: function get() {
- return (0, _util.shadow)(this, 'bytes', this.stream.getBytes(this.maybeLength));
- },
-
- configurable: true
- });
- Jbig2Stream.prototype.ensureBuffer = function (requested) {};
- Jbig2Stream.prototype.readBlock = function () {
- if (this.eof) {
- return;
- }
- var jbig2Image = new _jbig.Jbig2Image();
- var chunks = [];
- if ((0, _primitives.isDict)(this.params)) {
- var globalsStream = this.params.get('JBIG2Globals');
- if ((0, _primitives.isStream)(globalsStream)) {
- var globals = globalsStream.getBytes();
- chunks.push({
- data: globals,
- start: 0,
- end: globals.length
- });
- }
- }
- chunks.push({
- data: this.bytes,
- start: 0,
- end: this.bytes.length
- });
- var data = jbig2Image.parseChunks(chunks);
- var dataLength = data.length;
- for (var i = 0; i < dataLength; i++) {
- data[i] ^= 0xFF;
- }
- this.buffer = data;
- this.bufferLength = dataLength;
- this.eof = true;
- };
- return Jbig2Stream;
-}();
-exports.Jbig2Stream = Jbig2Stream;
-
-/***/ }),
-/* 144 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.Jbig2Image = undefined;
-
-var _util = __w_pdfjs_require__(2);
-
-var _arithmetic_decoder = __w_pdfjs_require__(145);
-
-var _ccitt = __w_pdfjs_require__(142);
-
-var Jbig2Error = function Jbig2ErrorClosure() {
- function Jbig2Error(msg) {
- this.message = 'JBIG2 error: ' + msg;
- }
- Jbig2Error.prototype = new Error();
- Jbig2Error.prototype.name = 'Jbig2Error';
- Jbig2Error.constructor = Jbig2Error;
- return Jbig2Error;
-}();
-var Jbig2Image = function Jbig2ImageClosure() {
- function ContextCache() {}
- ContextCache.prototype = {
- getContexts: function getContexts(id) {
- if (id in this) {
- return this[id];
- }
- return this[id] = new Int8Array(1 << 16);
- }
- };
- function DecodingContext(data, start, end) {
- this.data = data;
- this.start = start;
- this.end = end;
- }
- DecodingContext.prototype = {
- get decoder() {
- var decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
- return (0, _util.shadow)(this, 'decoder', decoder);
- },
- get contextCache() {
- var cache = new ContextCache();
- return (0, _util.shadow)(this, 'contextCache', cache);
- }
- };
- function decodeInteger(contextCache, procedure, decoder) {
- var contexts = contextCache.getContexts(procedure);
- var prev = 1;
- function readBits(length) {
- var v = 0;
- for (var i = 0; i < length; i++) {
- var bit = decoder.readBit(contexts, prev);
- prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
- v = v << 1 | bit;
- }
- return v >>> 0;
- }
- var sign = readBits(1);
- var value = readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(32) + 4436 : readBits(12) + 340 : readBits(8) + 84 : readBits(6) + 20 : readBits(4) + 4 : readBits(2);
- return sign === 0 ? value : value > 0 ? -value : null;
- }
- function decodeIAID(contextCache, decoder, codeLength) {
- var contexts = contextCache.getContexts('IAID');
- var prev = 1;
- for (var i = 0; i < codeLength; i++) {
- var bit = decoder.readBit(contexts, prev);
- prev = prev << 1 | bit;
- }
- if (codeLength < 31) {
- return prev & (1 << codeLength) - 1;
- }
- return prev & 0x7FFFFFFF;
- }
- var SegmentTypes = ['SymbolDictionary', null, null, null, 'IntermediateTextRegion', null, 'ImmediateTextRegion', 'ImmediateLosslessTextRegion', null, null, null, null, null, null, null, null, 'PatternDictionary', null, null, null, 'IntermediateHalftoneRegion', null, 'ImmediateHalftoneRegion', 'ImmediateLosslessHalftoneRegion', null, null, null, null, null, null, null, null, null, null, null, null, 'IntermediateGenericRegion', null, 'ImmediateGenericRegion', 'ImmediateLosslessGenericRegion', 'IntermediateGenericRefinementRegion', null, 'ImmediateGenericRefinementRegion', 'ImmediateLosslessGenericRefinementRegion', null, null, null, null, 'PageInformation', 'EndOfPage', 'EndOfStripe', 'EndOfFile', 'Profiles', 'Tables', null, null, null, null, null, null, null, null, 'Extension'];
- var CodingTemplates = [[{
- x: -1,
- y: -2
- }, {
- x: 0,
- y: -2
- }, {
- x: 1,
- y: -2
- }, {
- x: -2,
- y: -1
- }, {
- x: -1,
- y: -1
- }, {
- x: 0,
- y: -1
- }, {
- x: 1,
- y: -1
- }, {
- x: 2,
- y: -1
- }, {
- x: -4,
- y: 0
- }, {
- x: -3,
- y: 0
- }, {
- x: -2,
- y: 0
- }, {
- x: -1,
- y: 0
- }], [{
- x: -1,
- y: -2
- }, {
- x: 0,
- y: -2
- }, {
- x: 1,
- y: -2
- }, {
- x: 2,
- y: -2
- }, {
- x: -2,
- y: -1
- }, {
- x: -1,
- y: -1
- }, {
- x: 0,
- y: -1
- }, {
- x: 1,
- y: -1
- }, {
- x: 2,
- y: -1
- }, {
- x: -3,
- y: 0
- }, {
- x: -2,
- y: 0
- }, {
- x: -1,
- y: 0
- }], [{
- x: -1,
- y: -2
- }, {
- x: 0,
- y: -2
- }, {
- x: 1,
- y: -2
- }, {
- x: -2,
- y: -1
- }, {
- x: -1,
- y: -1
- }, {
- x: 0,
- y: -1
- }, {
- x: 1,
- y: -1
- }, {
- x: -2,
- y: 0
- }, {
- x: -1,
- y: 0
- }], [{
- x: -3,
- y: -1
- }, {
- x: -2,
- y: -1
- }, {
- x: -1,
- y: -1
- }, {
- x: 0,
- y: -1
- }, {
- x: 1,
- y: -1
- }, {
- x: -4,
- y: 0
- }, {
- x: -3,
- y: 0
- }, {
- x: -2,
- y: 0
- }, {
- x: -1,
- y: 0
- }]];
- var RefinementTemplates = [{
- coding: [{
- x: 0,
- y: -1
- }, {
- x: 1,
- y: -1
- }, {
- x: -1,
- y: 0
- }],
- reference: [{
- x: 0,
- y: -1
- }, {
- x: 1,
- y: -1
- }, {
- x: -1,
- y: 0
- }, {
- x: 0,
- y: 0
- }, {
- x: 1,
- y: 0
- }, {
- x: -1,
- y: 1
- }, {
- x: 0,
- y: 1
- }, {
- x: 1,
- y: 1
- }]
- }, {
- coding: [{
- x: -1,
- y: -1
- }, {
- x: 0,
- y: -1
- }, {
- x: 1,
- y: -1
- }, {
- x: -1,
- y: 0
- }],
- reference: [{
- x: 0,
- y: -1
- }, {
- x: -1,
- y: 0
- }, {
- x: 0,
- y: 0
- }, {
- x: 1,
- y: 0
- }, {
- x: 0,
- y: 1
- }, {
- x: 1,
- y: 1
- }]
- }];
- var ReusedContexts = [0x9B25, 0x0795, 0x00E5, 0x0195];
- var RefinementReusedContexts = [0x0020, 0x0008];
- function decodeBitmapTemplate0(width, height, decodingContext) {
- var decoder = decodingContext.decoder;
- var contexts = decodingContext.contextCache.getContexts('GB');
- var contextLabel,
- i,
- j,
- pixel,
- row,
- row1,
- row2,
- bitmap = [];
- var OLD_PIXEL_MASK = 0x7BF7;
- for (i = 0; i < height; i++) {
- row = bitmap[i] = new Uint8Array(width);
- row1 = i < 1 ? row : bitmap[i - 1];
- row2 = i < 2 ? row : bitmap[i - 2];
- contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
- for (j = 0; j < width; j++) {
- row[j] = pixel = decoder.readBit(contexts, contextLabel);
- contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
- }
- }
- return bitmap;
- }
- function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
- if (mmr) {
- var input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
- return decodeMMRBitmap(input, width, height, false);
- }
- if (templateIndex === 0 && !skip && !prediction && at.length === 4 && at[0].x === 3 && at[0].y === -1 && at[1].x === -3 && at[1].y === -1 && at[2].x === 2 && at[2].y === -2 && at[3].x === -2 && at[3].y === -2) {
- return decodeBitmapTemplate0(width, height, decodingContext);
- }
- var useskip = !!skip;
- var template = CodingTemplates[templateIndex].concat(at);
- template.sort(function (a, b) {
- return a.y - b.y || a.x - b.x;
- });
- var templateLength = template.length;
- var templateX = new Int8Array(templateLength);
- var templateY = new Int8Array(templateLength);
- var changingTemplateEntries = [];
- var reuseMask = 0,
- minX = 0,
- maxX = 0,
- minY = 0;
- var c, k;
- for (k = 0; k < templateLength; k++) {
- templateX[k] = template[k].x;
- templateY[k] = template[k].y;
- minX = Math.min(minX, template[k].x);
- maxX = Math.max(maxX, template[k].x);
- minY = Math.min(minY, template[k].y);
- if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
- reuseMask |= 1 << templateLength - 1 - k;
- } else {
- changingTemplateEntries.push(k);
- }
- }
- var changingEntriesLength = changingTemplateEntries.length;
- var changingTemplateX = new Int8Array(changingEntriesLength);
- var changingTemplateY = new Int8Array(changingEntriesLength);
- var changingTemplateBit = new Uint16Array(changingEntriesLength);
- for (c = 0; c < changingEntriesLength; c++) {
- k = changingTemplateEntries[c];
- changingTemplateX[c] = template[k].x;
- changingTemplateY[c] = template[k].y;
- changingTemplateBit[c] = 1 << templateLength - 1 - k;
- }
- var sbb_left = -minX;
- var sbb_top = -minY;
- var sbb_right = width - maxX;
- var pseudoPixelContext = ReusedContexts[templateIndex];
- var row = new Uint8Array(width);
- var bitmap = [];
- var decoder = decodingContext.decoder;
- var contexts = decodingContext.contextCache.getContexts('GB');
- var ltp = 0,
- j,
- i0,
- j0,
- contextLabel = 0,
- bit,
- shift;
- for (var i = 0; i < height; i++) {
- if (prediction) {
- var sltp = decoder.readBit(contexts, pseudoPixelContext);
- ltp ^= sltp;
- if (ltp) {
- bitmap.push(row);
- continue;
- }
- }
- row = new Uint8Array(row);
- bitmap.push(row);
- for (j = 0; j < width; j++) {
- if (useskip && skip[i][j]) {
- row[j] = 0;
- continue;
- }
- if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
- contextLabel = contextLabel << 1 & reuseMask;
- for (k = 0; k < changingEntriesLength; k++) {
- i0 = i + changingTemplateY[k];
- j0 = j + changingTemplateX[k];
- bit = bitmap[i0][j0];
- if (bit) {
- bit = changingTemplateBit[k];
- contextLabel |= bit;
- }
- }
- } else {
- contextLabel = 0;
- shift = templateLength - 1;
- for (k = 0; k < templateLength; k++, shift--) {
- j0 = j + templateX[k];
- if (j0 >= 0 && j0 < width) {
- i0 = i + templateY[k];
- if (i0 >= 0) {
- bit = bitmap[i0][j0];
- if (bit) {
- contextLabel |= bit << shift;
- }
- }
- }
- }
- }
- var pixel = decoder.readBit(contexts, contextLabel);
- row[j] = pixel;
- }
- }
- return bitmap;
- }
- function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
- var codingTemplate = RefinementTemplates[templateIndex].coding;
- if (templateIndex === 0) {
- codingTemplate = codingTemplate.concat([at[0]]);
- }
- var codingTemplateLength = codingTemplate.length;
- var codingTemplateX = new Int32Array(codingTemplateLength);
- var codingTemplateY = new Int32Array(codingTemplateLength);
- var k;
- for (k = 0; k < codingTemplateLength; k++) {
- codingTemplateX[k] = codingTemplate[k].x;
- codingTemplateY[k] = codingTemplate[k].y;
- }
- var referenceTemplate = RefinementTemplates[templateIndex].reference;
- if (templateIndex === 0) {
- referenceTemplate = referenceTemplate.concat([at[1]]);
- }
- var referenceTemplateLength = referenceTemplate.length;
- var referenceTemplateX = new Int32Array(referenceTemplateLength);
- var referenceTemplateY = new Int32Array(referenceTemplateLength);
- for (k = 0; k < referenceTemplateLength; k++) {
- referenceTemplateX[k] = referenceTemplate[k].x;
- referenceTemplateY[k] = referenceTemplate[k].y;
- }
- var referenceWidth = referenceBitmap[0].length;
- var referenceHeight = referenceBitmap.length;
- var pseudoPixelContext = RefinementReusedContexts[templateIndex];
- var bitmap = [];
- var decoder = decodingContext.decoder;
- var contexts = decodingContext.contextCache.getContexts('GR');
- var ltp = 0;
- for (var i = 0; i < height; i++) {
- if (prediction) {
- var sltp = decoder.readBit(contexts, pseudoPixelContext);
- ltp ^= sltp;
- if (ltp) {
- throw new Jbig2Error('prediction is not supported');
- }
- }
- var row = new Uint8Array(width);
- bitmap.push(row);
- for (var j = 0; j < width; j++) {
- var i0, j0;
- var contextLabel = 0;
- for (k = 0; k < codingTemplateLength; k++) {
- i0 = i + codingTemplateY[k];
- j0 = j + codingTemplateX[k];
- if (i0 < 0 || j0 < 0 || j0 >= width) {
- contextLabel <<= 1;
- } else {
- contextLabel = contextLabel << 1 | bitmap[i0][j0];
- }
- }
- for (k = 0; k < referenceTemplateLength; k++) {
- i0 = i + referenceTemplateY[k] - offsetY;
- j0 = j + referenceTemplateX[k] - offsetX;
- if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
- contextLabel <<= 1;
- } else {
- contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
- }
- }
- var pixel = decoder.readBit(contexts, contextLabel);
- row[j] = pixel;
- }
- }
- return bitmap;
- }
- function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
- if (huffman && refinement) {
- throw new Jbig2Error('symbol refinement with Huffman is not supported');
- }
- var newSymbols = [];
- var currentHeight = 0;
- var symbolCodeLength = (0, _util.log2)(symbols.length + numberOfNewSymbols);
- var decoder = decodingContext.decoder;
- var contextCache = decodingContext.contextCache;
- var tableB1 = void 0,
- symbolWidths = void 0;
- if (huffman) {
- tableB1 = getStandardTable(1);
- symbolWidths = [];
- symbolCodeLength = Math.max(symbolCodeLength, 1);
- }
- while (newSymbols.length < numberOfNewSymbols) {
- var deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, 'IADH', decoder);
- currentHeight += deltaHeight;
- var currentWidth = 0,
- totalWidth = 0;
- var firstSymbol = huffman ? symbolWidths.length : 0;
- while (true) {
- var deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, 'IADW', decoder);
- if (deltaWidth === null) {
- break;
- }
- currentWidth += deltaWidth;
- totalWidth += currentWidth;
- var bitmap;
- if (refinement) {
- var numberOfInstances = decodeInteger(contextCache, 'IAAI', decoder);
- if (numberOfInstances > 1) {
- bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
- } else {
- var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
- var rdx = decodeInteger(contextCache, 'IARDX', decoder);
- var rdy = decodeInteger(contextCache, 'IARDY', decoder);
- var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
- bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
- }
- newSymbols.push(bitmap);
- } else if (huffman) {
- symbolWidths.push(currentWidth);
- } else {
- bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
- newSymbols.push(bitmap);
- }
- }
- if (huffman && !refinement) {
- var bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
- huffmanInput.byteAlign();
- var collectiveBitmap = void 0;
- if (bitmapSize === 0) {
- collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
- } else {
- var originalEnd = huffmanInput.end;
- var bitmapEnd = huffmanInput.position + bitmapSize;
- huffmanInput.end = bitmapEnd;
- collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
- huffmanInput.end = originalEnd;
- huffmanInput.position = bitmapEnd;
- }
- var numberOfSymbolsDecoded = symbolWidths.length;
- if (firstSymbol === numberOfSymbolsDecoded - 1) {
- newSymbols.push(collectiveBitmap);
- } else {
- var _i = void 0,
- y = void 0,
- xMin = 0,
- xMax = void 0,
- bitmapWidth = void 0,
- symbolBitmap = void 0;
- for (_i = firstSymbol; _i < numberOfSymbolsDecoded; _i++) {
- bitmapWidth = symbolWidths[_i];
- xMax = xMin + bitmapWidth;
- symbolBitmap = [];
- for (y = 0; y < currentHeight; y++) {
- symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
- }
- newSymbols.push(symbolBitmap);
- xMin = xMax;
- }
- }
- }
- }
- var exportedSymbols = [];
- var flags = [],
- currentFlag = false;
- var totalSymbolsLength = symbols.length + numberOfNewSymbols;
- while (flags.length < totalSymbolsLength) {
- var runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, 'IAEX', decoder);
- while (runLength--) {
- flags.push(currentFlag);
- }
- currentFlag = !currentFlag;
- }
- for (var i = 0, ii = symbols.length; i < ii; i++) {
- if (flags[i]) {
- exportedSymbols.push(symbols[i]);
- }
- }
- for (var j = 0; j < numberOfNewSymbols; i++, j++) {
- if (flags[i]) {
- exportedSymbols.push(newSymbols[j]);
- }
- }
- return exportedSymbols;
- }
- function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
- if (huffman && refinement) {
- throw new Jbig2Error('refinement with Huffman is not supported');
- }
- var bitmap = [];
- var i, row;
- for (i = 0; i < height; i++) {
- row = new Uint8Array(width);
- if (defaultPixelValue) {
- for (var j = 0; j < width; j++) {
- row[j] = defaultPixelValue;
- }
- }
- bitmap.push(row);
- }
- var decoder = decodingContext.decoder;
- var contextCache = decodingContext.contextCache;
- var stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, 'IADT', decoder);
- var firstS = 0;
- i = 0;
- while (i < numberOfSymbolInstances) {
- var deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, 'IADT', decoder);
- stripT += deltaT;
- var deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, 'IAFS', decoder);
- firstS += deltaFirstS;
- var currentS = firstS;
- do {
- var currentT = 0;
- if (stripSize > 1) {
- currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, 'IAIT', decoder);
- }
- var t = stripSize * stripT + currentT;
- var symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
- var applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, 'IARI', decoder));
- var symbolBitmap = inputSymbols[symbolId];
- var symbolWidth = symbolBitmap[0].length;
- var symbolHeight = symbolBitmap.length;
- if (applyRefinement) {
- var rdw = decodeInteger(contextCache, 'IARDW', decoder);
- var rdh = decodeInteger(contextCache, 'IARDH', decoder);
- var rdx = decodeInteger(contextCache, 'IARDX', decoder);
- var rdy = decodeInteger(contextCache, 'IARDY', decoder);
- symbolWidth += rdw;
- symbolHeight += rdh;
- symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
- }
- var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
- var offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
- var s2, t2, symbolRow;
- if (transposed) {
- for (s2 = 0; s2 < symbolHeight; s2++) {
- row = bitmap[offsetS + s2];
- if (!row) {
- continue;
- }
- symbolRow = symbolBitmap[s2];
- var maxWidth = Math.min(width - offsetT, symbolWidth);
- switch (combinationOperator) {
- case 0:
- for (t2 = 0; t2 < maxWidth; t2++) {
- row[offsetT + t2] |= symbolRow[t2];
- }
- break;
- case 2:
- for (t2 = 0; t2 < maxWidth; t2++) {
- row[offsetT + t2] ^= symbolRow[t2];
- }
- break;
- default:
- throw new Jbig2Error('operator ' + combinationOperator + ' is not supported');
- }
- }
- currentS += symbolHeight - 1;
- } else {
- for (t2 = 0; t2 < symbolHeight; t2++) {
- row = bitmap[offsetT + t2];
- if (!row) {
- continue;
- }
- symbolRow = symbolBitmap[t2];
- switch (combinationOperator) {
- case 0:
- for (s2 = 0; s2 < symbolWidth; s2++) {
- row[offsetS + s2] |= symbolRow[s2];
- }
- break;
- case 2:
- for (s2 = 0; s2 < symbolWidth; s2++) {
- row[offsetS + s2] ^= symbolRow[s2];
- }
- break;
- default:
- throw new Jbig2Error('operator ' + combinationOperator + ' is not supported');
- }
- }
- currentS += symbolWidth - 1;
- }
- i++;
- var deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, 'IADS', decoder);
- if (deltaS === null) {
- break;
- }
- currentS += deltaS + dsOffset;
- } while (true);
- }
- return bitmap;
- }
- function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
- var at = [];
- if (!mmr) {
- at.push({
- x: -patternWidth,
- y: 0
- });
- if (template === 0) {
- at.push({
- x: -3,
- y: -1
- });
- at.push({
- x: 2,
- y: -2
- });
- at.push({
- x: -2,
- y: -2
- });
- }
- }
- var collectiveWidth = (maxPatternIndex + 1) * patternWidth;
- var collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
- var patterns = [],
- i = 0,
- patternBitmap = void 0,
- xMin = void 0,
- xMax = void 0,
- y = void 0;
- while (i <= maxPatternIndex) {
- patternBitmap = [];
- xMin = patternWidth * i;
- xMax = xMin + patternWidth;
- for (y = 0; y < patternHeight; y++) {
- patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
- }
- patterns.push(patternBitmap);
- i++;
- }
- return patterns;
- }
- function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
- var skip = null;
- if (enableSkip) {
- throw new Jbig2Error('skip is not supported');
- }
- if (combinationOperator !== 0) {
- throw new Jbig2Error('operator ' + combinationOperator + ' is not supported in halftone region');
- }
- var regionBitmap = [];
- var i = void 0,
- j = void 0,
- row = void 0;
- for (i = 0; i < regionHeight; i++) {
- row = new Uint8Array(regionWidth);
- if (defaultPixelValue) {
- for (j = 0; j < regionWidth; j++) {
- row[j] = defaultPixelValue;
- }
- }
- regionBitmap.push(row);
- }
- var numberOfPatterns = patterns.length;
- var pattern0 = patterns[0];
- var patternWidth = pattern0[0].length,
- patternHeight = pattern0.length;
- var bitsPerValue = (0, _util.log2)(numberOfPatterns);
- var at = [];
- if (!mmr) {
- at.push({
- x: template <= 1 ? 3 : 2,
- y: -1
- });
- if (template === 0) {
- at.push({
- x: -3,
- y: -1
- });
- at.push({
- x: 2,
- y: -2
- });
- at.push({
- x: -2,
- y: -2
- });
- }
- }
- var grayScaleBitPlanes = [],
- mmrInput = void 0,
- bitmap = void 0;
- if (mmr) {
- mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
- }
- for (i = bitsPerValue - 1; i >= 0; i--) {
- if (mmr) {
- bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
- } else {
- bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
- }
- grayScaleBitPlanes[i] = bitmap;
- }
- var mg = void 0,
- ng = void 0,
- bit = void 0,
- patternIndex = void 0,
- patternBitmap = void 0,
- x = void 0,
- y = void 0,
- patternRow = void 0,
- regionRow = void 0;
- for (mg = 0; mg < gridHeight; mg++) {
- for (ng = 0; ng < gridWidth; ng++) {
- bit = 0;
- patternIndex = 0;
- for (j = bitsPerValue - 1; j >= 0; j--) {
- bit = grayScaleBitPlanes[j][mg][ng] ^ bit;
- patternIndex |= bit << j;
- }
- patternBitmap = patterns[patternIndex];
- x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
- y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
- if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
- for (i = 0; i < patternHeight; i++) {
- regionRow = regionBitmap[y + i];
- patternRow = patternBitmap[i];
- for (j = 0; j < patternWidth; j++) {
- regionRow[x + j] |= patternRow[j];
- }
- }
- } else {
- var regionX = void 0,
- regionY = void 0;
- for (i = 0; i < patternHeight; i++) {
- regionY = y + i;
- if (regionY < 0 || regionY >= regionHeight) {
- continue;
- }
- regionRow = regionBitmap[regionY];
- patternRow = patternBitmap[i];
- for (j = 0; j < patternWidth; j++) {
- regionX = x + j;
- if (regionX >= 0 && regionX < regionWidth) {
- regionRow[regionX] |= patternRow[j];
- }
- }
- }
- }
- }
- }
- return regionBitmap;
- }
- function readSegmentHeader(data, start) {
- var segmentHeader = {};
- segmentHeader.number = (0, _util.readUint32)(data, start);
- var flags = data[start + 4];
- var segmentType = flags & 0x3F;
- if (!SegmentTypes[segmentType]) {
- throw new Jbig2Error('invalid segment type: ' + segmentType);
- }
- segmentHeader.type = segmentType;
- segmentHeader.typeName = SegmentTypes[segmentType];
- segmentHeader.deferredNonRetain = !!(flags & 0x80);
- var pageAssociationFieldSize = !!(flags & 0x40);
- var referredFlags = data[start + 5];
- var referredToCount = referredFlags >> 5 & 7;
- var retainBits = [referredFlags & 31];
- var position = start + 6;
- if (referredFlags === 7) {
- referredToCount = (0, _util.readUint32)(data, position - 1) & 0x1FFFFFFF;
- position += 3;
- var bytes = referredToCount + 7 >> 3;
- retainBits[0] = data[position++];
- while (--bytes > 0) {
- retainBits.push(data[position++]);
- }
- } else if (referredFlags === 5 || referredFlags === 6) {
- throw new Jbig2Error('invalid referred-to flags');
- }
- segmentHeader.retainBits = retainBits;
- var referredToSegmentNumberSize = segmentHeader.number <= 256 ? 1 : segmentHeader.number <= 65536 ? 2 : 4;
- var referredTo = [];
- var i, ii;
- for (i = 0; i < referredToCount; i++) {
- var number = referredToSegmentNumberSize === 1 ? data[position] : referredToSegmentNumberSize === 2 ? (0, _util.readUint16)(data, position) : (0, _util.readUint32)(data, position);
- referredTo.push(number);
- position += referredToSegmentNumberSize;
- }
- segmentHeader.referredTo = referredTo;
- if (!pageAssociationFieldSize) {
- segmentHeader.pageAssociation = data[position++];
- } else {
- segmentHeader.pageAssociation = (0, _util.readUint32)(data, position);
- position += 4;
- }
- segmentHeader.length = (0, _util.readUint32)(data, position);
- position += 4;
- if (segmentHeader.length === 0xFFFFFFFF) {
- if (segmentType === 38) {
- var genericRegionInfo = readRegionSegmentInformation(data, position);
- var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
- var genericRegionMmr = !!(genericRegionSegmentFlags & 1);
- var searchPatternLength = 6;
- var searchPattern = new Uint8Array(searchPatternLength);
- if (!genericRegionMmr) {
- searchPattern[0] = 0xFF;
- searchPattern[1] = 0xAC;
- }
- searchPattern[2] = genericRegionInfo.height >>> 24 & 0xFF;
- searchPattern[3] = genericRegionInfo.height >> 16 & 0xFF;
- searchPattern[4] = genericRegionInfo.height >> 8 & 0xFF;
- searchPattern[5] = genericRegionInfo.height & 0xFF;
- for (i = position, ii = data.length; i < ii; i++) {
- var j = 0;
- while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
- j++;
- }
- if (j === searchPatternLength) {
- segmentHeader.length = i + searchPatternLength;
- break;
- }
- }
- if (segmentHeader.length === 0xFFFFFFFF) {
- throw new Jbig2Error('segment end was not found');
- }
- } else {
- throw new Jbig2Error('invalid unknown segment length');
- }
- }
- segmentHeader.headerEnd = position;
- return segmentHeader;
- }
- function readSegments(header, data, start, end) {
- var segments = [];
- var position = start;
- while (position < end) {
- var segmentHeader = readSegmentHeader(data, position);
- position = segmentHeader.headerEnd;
- var segment = {
- header: segmentHeader,
- data: data
- };
- if (!header.randomAccess) {
- segment.start = position;
- position += segmentHeader.length;
- segment.end = position;
- }
- segments.push(segment);
- if (segmentHeader.type === 51) {
- break;
- }
- }
- if (header.randomAccess) {
- for (var i = 0, ii = segments.length; i < ii; i++) {
- segments[i].start = position;
- position += segments[i].header.length;
- segments[i].end = position;
- }
- }
- return segments;
- }
- function readRegionSegmentInformation(data, start) {
- return {
- width: (0, _util.readUint32)(data, start),
- height: (0, _util.readUint32)(data, start + 4),
- x: (0, _util.readUint32)(data, start + 8),
- y: (0, _util.readUint32)(data, start + 12),
- combinationOperator: data[start + 16] & 7
- };
- }
- var RegionSegmentInformationFieldLength = 17;
- function processSegment(segment, visitor) {
- var header = segment.header;
- var data = segment.data,
- position = segment.start,
- end = segment.end;
- var args, at, i, atLength;
- switch (header.type) {
- case 0:
- var dictionary = {};
- var dictionaryFlags = (0, _util.readUint16)(data, position);
- dictionary.huffman = !!(dictionaryFlags & 1);
- dictionary.refinement = !!(dictionaryFlags & 2);
- dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
- dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
- dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
- dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
- dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
- dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
- dictionary.template = dictionaryFlags >> 10 & 3;
- dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
- position += 2;
- if (!dictionary.huffman) {
- atLength = dictionary.template === 0 ? 4 : 1;
- at = [];
- for (i = 0; i < atLength; i++) {
- at.push({
- x: (0, _util.readInt8)(data, position),
- y: (0, _util.readInt8)(data, position + 1)
- });
- position += 2;
- }
- dictionary.at = at;
- }
- if (dictionary.refinement && !dictionary.refinementTemplate) {
- at = [];
- for (i = 0; i < 2; i++) {
- at.push({
- x: (0, _util.readInt8)(data, position),
- y: (0, _util.readInt8)(data, position + 1)
- });
- position += 2;
- }
- dictionary.refinementAt = at;
- }
- dictionary.numberOfExportedSymbols = (0, _util.readUint32)(data, position);
- position += 4;
- dictionary.numberOfNewSymbols = (0, _util.readUint32)(data, position);
- position += 4;
- args = [dictionary, header.number, header.referredTo, data, position, end];
- break;
- case 6:
- case 7:
- var textRegion = {};
- textRegion.info = readRegionSegmentInformation(data, position);
- position += RegionSegmentInformationFieldLength;
- var textRegionSegmentFlags = (0, _util.readUint16)(data, position);
- position += 2;
- textRegion.huffman = !!(textRegionSegmentFlags & 1);
- textRegion.refinement = !!(textRegionSegmentFlags & 2);
- textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
- textRegion.stripSize = 1 << textRegion.logStripSize;
- textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
- textRegion.transposed = !!(textRegionSegmentFlags & 64);
- textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
- textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
- textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
- textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
- if (textRegion.huffman) {
- var textRegionHuffmanFlags = (0, _util.readUint16)(data, position);
- position += 2;
- textRegion.huffmanFS = textRegionHuffmanFlags & 3;
- textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
- textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
- textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
- textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
- textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
- textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
- textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
- }
- if (textRegion.refinement && !textRegion.refinementTemplate) {
- at = [];
- for (i = 0; i < 2; i++) {
- at.push({
- x: (0, _util.readInt8)(data, position),
- y: (0, _util.readInt8)(data, position + 1)
- });
- position += 2;
- }
- textRegion.refinementAt = at;
- }
- textRegion.numberOfSymbolInstances = (0, _util.readUint32)(data, position);
- position += 4;
- args = [textRegion, header.referredTo, data, position, end];
- break;
- case 16:
- var patternDictionary = {};
- var patternDictionaryFlags = data[position++];
- patternDictionary.mmr = !!(patternDictionaryFlags & 1);
- patternDictionary.template = patternDictionaryFlags >> 1 & 3;
- patternDictionary.patternWidth = data[position++];
- patternDictionary.patternHeight = data[position++];
- patternDictionary.maxPatternIndex = (0, _util.readUint32)(data, position);
- position += 4;
- args = [patternDictionary, header.number, data, position, end];
- break;
- case 22:
- case 23:
- var halftoneRegion = {};
- halftoneRegion.info = readRegionSegmentInformation(data, position);
- position += RegionSegmentInformationFieldLength;
- var halftoneRegionFlags = data[position++];
- halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
- halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
- halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
- halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
- halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
- halftoneRegion.gridWidth = (0, _util.readUint32)(data, position);
- position += 4;
- halftoneRegion.gridHeight = (0, _util.readUint32)(data, position);
- position += 4;
- halftoneRegion.gridOffsetX = (0, _util.readUint32)(data, position) & 0xFFFFFFFF;
- position += 4;
- halftoneRegion.gridOffsetY = (0, _util.readUint32)(data, position) & 0xFFFFFFFF;
- position += 4;
- halftoneRegion.gridVectorX = (0, _util.readUint16)(data, position);
- position += 2;
- halftoneRegion.gridVectorY = (0, _util.readUint16)(data, position);
- position += 2;
- args = [halftoneRegion, header.referredTo, data, position, end];
- break;
- case 38:
- case 39:
- var genericRegion = {};
- genericRegion.info = readRegionSegmentInformation(data, position);
- position += RegionSegmentInformationFieldLength;
- var genericRegionSegmentFlags = data[position++];
- genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
- genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
- genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
- if (!genericRegion.mmr) {
- atLength = genericRegion.template === 0 ? 4 : 1;
- at = [];
- for (i = 0; i < atLength; i++) {
- at.push({
- x: (0, _util.readInt8)(data, position),
- y: (0, _util.readInt8)(data, position + 1)
- });
- position += 2;
- }
- genericRegion.at = at;
- }
- args = [genericRegion, data, position, end];
- break;
- case 48:
- var pageInfo = {
- width: (0, _util.readUint32)(data, position),
- height: (0, _util.readUint32)(data, position + 4),
- resolutionX: (0, _util.readUint32)(data, position + 8),
- resolutionY: (0, _util.readUint32)(data, position + 12)
- };
- if (pageInfo.height === 0xFFFFFFFF) {
- delete pageInfo.height;
- }
- var pageSegmentFlags = data[position + 16];
- (0, _util.readUint16)(data, position + 17);
- pageInfo.lossless = !!(pageSegmentFlags & 1);
- pageInfo.refinement = !!(pageSegmentFlags & 2);
- pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
- pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
- pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
- pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
- args = [pageInfo];
- break;
- case 49:
- break;
- case 50:
- break;
- case 51:
- break;
- case 53:
- args = [header.number, data, position, end];
- break;
- case 62:
- break;
- default:
- throw new Jbig2Error('segment type ' + header.typeName + '(' + header.type + ')' + ' is not implemented');
- }
- var callbackName = 'on' + header.typeName;
- if (callbackName in visitor) {
- visitor[callbackName].apply(visitor, args);
- }
- }
- function processSegments(segments, visitor) {
- for (var i = 0, ii = segments.length; i < ii; i++) {
- processSegment(segments[i], visitor);
- }
- }
- function parseJbig2Chunks(chunks) {
- var visitor = new SimpleSegmentVisitor();
- for (var i = 0, ii = chunks.length; i < ii; i++) {
- var chunk = chunks[i];
- var segments = readSegments({}, chunk.data, chunk.start, chunk.end);
- processSegments(segments, visitor);
- }
- return visitor.buffer;
- }
- function parseJbig2(data) {
- var position = 0,
- end = data.length;
- if (data[position] !== 0x97 || data[position + 1] !== 0x4A || data[position + 2] !== 0x42 || data[position + 3] !== 0x32 || data[position + 4] !== 0x0D || data[position + 5] !== 0x0A || data[position + 6] !== 0x1A || data[position + 7] !== 0x0A) {
- throw new Jbig2Error('parseJbig2 - invalid header.');
- }
- var header = Object.create(null);
- position += 8;
- var flags = data[position++];
- header.randomAccess = !(flags & 1);
- if (!(flags & 2)) {
- header.numberOfPages = (0, _util.readUint32)(data, position);
- position += 4;
- }
- var segments = readSegments(header, data, position, end);
- var visitor = new SimpleSegmentVisitor();
- processSegments(segments, visitor);
- var _visitor$currentPageI = visitor.currentPageInfo,
- width = _visitor$currentPageI.width,
- height = _visitor$currentPageI.height;
-
- var bitPacked = visitor.buffer;
- var imgData = new Uint8ClampedArray(width * height);
- var q = 0,
- k = 0;
- for (var i = 0; i < height; i++) {
- var mask = 0,
- buffer = void 0;
- for (var j = 0; j < width; j++) {
- if (!mask) {
- mask = 128;
- buffer = bitPacked[k++];
- }
- imgData[q++] = buffer & mask ? 0 : 255;
- mask >>= 1;
- }
- }
- return {
- imgData: imgData,
- width: width,
- height: height
- };
- }
- function SimpleSegmentVisitor() {}
- SimpleSegmentVisitor.prototype = {
- onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) {
- this.currentPageInfo = info;
- var rowSize = info.width + 7 >> 3;
- var buffer = new Uint8ClampedArray(rowSize * info.height);
- if (info.defaultPixelValue) {
- for (var i = 0, ii = buffer.length; i < ii; i++) {
- buffer[i] = 0xFF;
- }
- }
- this.buffer = buffer;
- },
- drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) {
- var pageInfo = this.currentPageInfo;
- var width = regionInfo.width,
- height = regionInfo.height;
- var rowSize = pageInfo.width + 7 >> 3;
- var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
- var buffer = this.buffer;
- var mask0 = 128 >> (regionInfo.x & 7);
- var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
- var i, j, mask, offset;
- switch (combinationOperator) {
- case 0:
- for (i = 0; i < height; i++) {
- mask = mask0;
- offset = offset0;
- for (j = 0; j < width; j++) {
- if (bitmap[i][j]) {
- buffer[offset] |= mask;
- }
- mask >>= 1;
- if (!mask) {
- mask = 128;
- offset++;
- }
- }
- offset0 += rowSize;
- }
- break;
- case 2:
- for (i = 0; i < height; i++) {
- mask = mask0;
- offset = offset0;
- for (j = 0; j < width; j++) {
- if (bitmap[i][j]) {
- buffer[offset] ^= mask;
- }
- mask >>= 1;
- if (!mask) {
- mask = 128;
- offset++;
- }
- }
- offset0 += rowSize;
- }
- break;
- default:
- throw new Jbig2Error('operator ' + combinationOperator + ' is not supported');
- }
- },
- onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {
- var regionInfo = region.info;
- var decodingContext = new DecodingContext(data, start, end);
- var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
- this.drawBitmap(regionInfo, bitmap);
- },
- onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() {
- this.onImmediateGenericRegion.apply(this, arguments);
- },
- onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
- var huffmanTables = void 0,
- huffmanInput = void 0;
- if (dictionary.huffman) {
- huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
- huffmanInput = new Reader(data, start, end);
- }
- var symbols = this.symbols;
- if (!symbols) {
- this.symbols = symbols = {};
- }
- var inputSymbols = [];
- for (var i = 0, ii = referredSegments.length; i < ii; i++) {
- var referredSymbols = symbols[referredSegments[i]];
- if (referredSymbols) {
- inputSymbols = inputSymbols.concat(referredSymbols);
- }
- }
- var decodingContext = new DecodingContext(data, start, end);
- symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
- },
- onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {
- var regionInfo = region.info;
- var huffmanTables = void 0,
- huffmanInput = void 0;
- var symbols = this.symbols;
- var inputSymbols = [];
- for (var i = 0, ii = referredSegments.length; i < ii; i++) {
- var referredSymbols = symbols[referredSegments[i]];
- if (referredSymbols) {
- inputSymbols = inputSymbols.concat(referredSymbols);
- }
- }
- var symbolCodeLength = (0, _util.log2)(inputSymbols.length);
- if (region.huffman) {
- huffmanInput = new Reader(data, start, end);
- huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
- }
- var decodingContext = new DecodingContext(data, start, end);
- var bitmap = decodeTextRegion(region.huffman, region.refinement, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.numberOfSymbolInstances, region.stripSize, inputSymbols, symbolCodeLength, region.transposed, region.dsOffset, region.referenceCorner, region.combinationOperator, huffmanTables, region.refinementTemplate, region.refinementAt, decodingContext, region.logStripSize, huffmanInput);
- this.drawBitmap(regionInfo, bitmap);
- },
- onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() {
- this.onImmediateTextRegion.apply(this, arguments);
- },
- onPatternDictionary: function onPatternDictionary(dictionary, currentSegment, data, start, end) {
- var patterns = this.patterns;
- if (!patterns) {
- this.patterns = patterns = {};
- }
- var decodingContext = new DecodingContext(data, start, end);
- patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
- },
- onImmediateHalftoneRegion: function onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
- var patterns = this.patterns[referredSegments[0]];
- var regionInfo = region.info;
- var decodingContext = new DecodingContext(data, start, end);
- var bitmap = decodeHalftoneRegion(region.mmr, patterns, region.template, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.enableSkip, region.combinationOperator, region.gridWidth, region.gridHeight, region.gridOffsetX, region.gridOffsetY, region.gridVectorX, region.gridVectorY, decodingContext);
- this.drawBitmap(regionInfo, bitmap);
- },
- onImmediateLosslessHalftoneRegion: function onImmediateLosslessHalftoneRegion() {
- this.onImmediateHalftoneRegion.apply(this, arguments);
- },
- onTables: function onTables(currentSegment, data, start, end) {
- var customTables = this.customTables;
- if (!customTables) {
- this.customTables = customTables = {};
- }
- customTables[currentSegment] = decodeTablesSegment(data, start, end);
- }
- };
- function HuffmanLine(lineData) {
- if (lineData.length === 2) {
- this.isOOB = true;
- this.rangeLow = 0;
- this.prefixLength = lineData[0];
- this.rangeLength = 0;
- this.prefixCode = lineData[1];
- this.isLowerRange = false;
- } else {
- this.isOOB = false;
- this.rangeLow = lineData[0];
- this.prefixLength = lineData[1];
- this.rangeLength = lineData[2];
- this.prefixCode = lineData[3];
- this.isLowerRange = lineData[4] === 'lower';
- }
- }
- function HuffmanTreeNode(line) {
- this.children = [];
- if (line) {
- this.isLeaf = true;
- this.rangeLength = line.rangeLength;
- this.rangeLow = line.rangeLow;
- this.isLowerRange = line.isLowerRange;
- this.isOOB = line.isOOB;
- } else {
- this.isLeaf = false;
- }
- }
- HuffmanTreeNode.prototype = {
- buildTree: function buildTree(line, shift) {
- var bit = line.prefixCode >> shift & 1;
- if (shift <= 0) {
- this.children[bit] = new HuffmanTreeNode(line);
- } else {
- var node = this.children[bit];
- if (!node) {
- this.children[bit] = node = new HuffmanTreeNode(null);
- }
- node.buildTree(line, shift - 1);
- }
- },
- decodeNode: function decodeNode(reader) {
- if (this.isLeaf) {
- if (this.isOOB) {
- return null;
- }
- var htOffset = reader.readBits(this.rangeLength);
- return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
- }
- var node = this.children[reader.readBit()];
- if (!node) {
- throw new Jbig2Error('invalid Huffman data');
- }
- return node.decodeNode(reader);
- }
- };
- function HuffmanTable(lines, prefixCodesDone) {
- if (!prefixCodesDone) {
- this.assignPrefixCodes(lines);
- }
- this.rootNode = new HuffmanTreeNode(null);
- var i = void 0,
- ii = lines.length,
- line = void 0;
- for (i = 0; i < ii; i++) {
- line = lines[i];
- if (line.prefixLength > 0) {
- this.rootNode.buildTree(line, line.prefixLength - 1);
- }
- }
- }
- HuffmanTable.prototype = {
- decode: function decode(reader) {
- return this.rootNode.decodeNode(reader);
- },
- assignPrefixCodes: function assignPrefixCodes(lines) {
- var linesLength = lines.length,
- prefixLengthMax = 0,
- i = void 0;
- for (i = 0; i < linesLength; i++) {
- prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
- }
- var histogram = new Uint32Array(prefixLengthMax + 1);
- for (i = 0; i < linesLength; i++) {
- histogram[lines[i].prefixLength]++;
- }
- var currentLength = 1,
- firstCode = 0,
- currentCode = void 0,
- currentTemp = void 0,
- line = void 0;
- histogram[0] = 0;
- while (currentLength <= prefixLengthMax) {
- firstCode = firstCode + histogram[currentLength - 1] << 1;
- currentCode = firstCode;
- currentTemp = 0;
- while (currentTemp < linesLength) {
- line = lines[currentTemp];
- if (line.prefixLength === currentLength) {
- line.prefixCode = currentCode;
- currentCode++;
- }
- currentTemp++;
- }
- currentLength++;
- }
- }
- };
- function decodeTablesSegment(data, start, end) {
- var flags = data[start];
- var lowestValue = (0, _util.readUint32)(data, start + 1) & 0xFFFFFFFF;
- var highestValue = (0, _util.readUint32)(data, start + 5) & 0xFFFFFFFF;
- var reader = new Reader(data, start + 9, end);
- var prefixSizeBits = (flags >> 1 & 7) + 1;
- var rangeSizeBits = (flags >> 4 & 7) + 1;
- var lines = [];
- var prefixLength = void 0,
- rangeLength = void 0,
- currentRangeLow = lowestValue;
- do {
- prefixLength = reader.readBits(prefixSizeBits);
- rangeLength = reader.readBits(rangeSizeBits);
- lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
- currentRangeLow += 1 << rangeLength;
- } while (currentRangeLow < highestValue);
- prefixLength = reader.readBits(prefixSizeBits);
- lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, 'lower']));
- prefixLength = reader.readBits(prefixSizeBits);
- lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
- if (flags & 1) {
- prefixLength = reader.readBits(prefixSizeBits);
- lines.push(new HuffmanLine([prefixLength, 0]));
- }
- return new HuffmanTable(lines, false);
- }
- var standardTablesCache = {};
- function getStandardTable(number) {
- var table = standardTablesCache[number];
- if (table) {
- return table;
- }
- var lines = void 0;
- switch (number) {
- case 1:
- lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
- break;
- case 2:
- lines = [[0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xE], [11, 5, 6, 0x1E], [75, 6, 32, 0x3E], [6, 0x3F]];
- break;
- case 3:
- lines = [[-256, 8, 8, 0xFE], [0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xE], [11, 5, 6, 0x1E], [-257, 8, 32, 0xFF, 'lower'], [75, 7, 32, 0x7E], [6, 0x3E]];
- break;
- case 4:
- lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xE], [12, 5, 6, 0x1E], [76, 5, 32, 0x1F]];
- break;
- case 5:
- lines = [[-255, 7, 8, 0x7E], [1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xE], [12, 5, 6, 0x1E], [-256, 7, 32, 0x7F, 'lower'], [76, 6, 32, 0x3E]];
- break;
- case 6:
- lines = [[-2048, 5, 10, 0x1C], [-1024, 4, 9, 0x8], [-512, 4, 8, 0x9], [-256, 4, 7, 0xA], [-128, 5, 6, 0x1D], [-64, 5, 5, 0x1E], [-32, 4, 5, 0xB], [0, 2, 7, 0x0], [128, 3, 7, 0x2], [256, 3, 8, 0x3], [512, 4, 9, 0xC], [1024, 4, 10, 0xD], [-2049, 6, 32, 0x3E, 'lower'], [2048, 6, 32, 0x3F]];
- break;
- case 7:
- lines = [[-1024, 4, 9, 0x8], [-512, 3, 8, 0x0], [-256, 4, 7, 0x9], [-128, 5, 6, 0x1A], [-64, 5, 5, 0x1B], [-32, 4, 5, 0xA], [0, 4, 5, 0xB], [32, 5, 5, 0x1C], [64, 5, 6, 0x1D], [128, 4, 7, 0xC], [256, 3, 8, 0x1], [512, 3, 9, 0x2], [1024, 3, 10, 0x3], [-1025, 5, 32, 0x1E, 'lower'], [2048, 5, 32, 0x1F]];
- break;
- case 8:
- lines = [[-15, 8, 3, 0xFC], [-7, 9, 1, 0x1FC], [-5, 8, 1, 0xFD], [-3, 9, 0, 0x1FD], [-2, 7, 0, 0x7C], [-1, 4, 0, 0xA], [0, 2, 1, 0x0], [2, 5, 0, 0x1A], [3, 6, 0, 0x3A], [4, 3, 4, 0x4], [20, 6, 1, 0x3B], [22, 4, 4, 0xB], [38, 4, 5, 0xC], [70, 5, 6, 0x1B], [134, 5, 7, 0x1C], [262, 6, 7, 0x3C], [390, 7, 8, 0x7D], [646, 6, 10, 0x3D], [-16, 9, 32, 0x1FE, 'lower'], [1670, 9, 32, 0x1FF], [2, 0x1]];
- break;
- case 9:
- lines = [[-31, 8, 4, 0xFC], [-15, 9, 2, 0x1FC], [-11, 8, 2, 0xFD], [-7, 9, 1, 0x1FD], [-5, 7, 1, 0x7C], [-3, 4, 1, 0xA], [-1, 3, 1, 0x2], [1, 3, 1, 0x3], [3, 5, 1, 0x1A], [5, 6, 1, 0x3A], [7, 3, 5, 0x4], [39, 6, 2, 0x3B], [43, 4, 5, 0xB], [75, 4, 6, 0xC], [139, 5, 7, 0x1B], [267, 5, 8, 0x1C], [523, 6, 8, 0x3C], [779, 7, 9, 0x7D], [1291, 6, 11, 0x3D], [-32, 9, 32, 0x1FE, 'lower'], [3339, 9, 32, 0x1FF], [2, 0x0]];
- break;
- case 10:
- lines = [[-21, 7, 4, 0x7A], [-5, 8, 0, 0xFC], [-4, 7, 0, 0x7B], [-3, 5, 0, 0x18], [-2, 2, 2, 0x0], [2, 5, 0, 0x19], [3, 6, 0, 0x36], [4, 7, 0, 0x7C], [5, 8, 0, 0xFD], [6, 2, 6, 0x1], [70, 5, 5, 0x1A], [102, 6, 5, 0x37], [134, 6, 6, 0x38], [198, 6, 7, 0x39], [326, 6, 8, 0x3A], [582, 6, 9, 0x3B], [1094, 6, 10, 0x3C], [2118, 7, 11, 0x7D], [-22, 8, 32, 0xFE, 'lower'], [4166, 8, 32, 0xFF], [2, 0x2]];
- break;
- case 11:
- lines = [[1, 1, 0, 0x0], [2, 2, 1, 0x2], [4, 4, 0, 0xC], [5, 4, 1, 0xD], [7, 5, 1, 0x1C], [9, 5, 2, 0x1D], [13, 6, 2, 0x3C], [17, 7, 2, 0x7A], [21, 7, 3, 0x7B], [29, 7, 4, 0x7C], [45, 7, 5, 0x7D], [77, 7, 6, 0x7E], [141, 7, 32, 0x7F]];
- break;
- case 12:
- lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 1, 0x6], [5, 5, 0, 0x1C], [6, 5, 1, 0x1D], [8, 6, 1, 0x3C], [10, 7, 0, 0x7A], [11, 7, 1, 0x7B], [13, 7, 2, 0x7C], [17, 7, 3, 0x7D], [25, 7, 4, 0x7E], [41, 8, 5, 0xFE], [73, 8, 32, 0xFF]];
- break;
- case 13:
- lines = [[1, 1, 0, 0x0], [2, 3, 0, 0x4], [3, 4, 0, 0xC], [4, 5, 0, 0x1C], [5, 4, 1, 0xD], [7, 3, 3, 0x5], [15, 6, 1, 0x3A], [17, 6, 2, 0x3B], [21, 6, 3, 0x3C], [29, 6, 4, 0x3D], [45, 6, 5, 0x3E], [77, 7, 6, 0x7E], [141, 7, 32, 0x7F]];
- break;
- case 14:
- lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
- break;
- case 15:
- lines = [[-24, 7, 4, 0x7C], [-8, 6, 2, 0x3C], [-4, 5, 1, 0x1C], [-2, 4, 0, 0xC], [-1, 3, 0, 0x4], [0, 1, 0, 0x0], [1, 3, 0, 0x5], [2, 4, 0, 0xD], [3, 5, 1, 0x1D], [5, 6, 2, 0x3D], [9, 7, 4, 0x7D], [-25, 7, 32, 0x7E, 'lower'], [25, 7, 32, 0x7F]];
- break;
- default:
- throw new Jbig2Error('standard table B.' + number + ' does not exist');
- }
- var length = lines.length,
- i = void 0;
- for (i = 0; i < length; i++) {
- lines[i] = new HuffmanLine(lines[i]);
- }
- table = new HuffmanTable(lines, true);
- standardTablesCache[number] = table;
- return table;
- }
- function Reader(data, start, end) {
- this.data = data;
- this.start = start;
- this.end = end;
- this.position = start;
- this.shift = -1;
- this.currentByte = 0;
- }
- Reader.prototype = {
- readBit: function readBit() {
- if (this.shift < 0) {
- if (this.position >= this.end) {
- throw new Jbig2Error('end of data while reading bit');
- }
- this.currentByte = this.data[this.position++];
- this.shift = 7;
- }
- var bit = this.currentByte >> this.shift & 1;
- this.shift--;
- return bit;
- },
- readBits: function readBits(numBits) {
- var result = 0,
- i = void 0;
- for (i = numBits - 1; i >= 0; i--) {
- result |= this.readBit() << i;
- }
- return result;
- },
- byteAlign: function byteAlign() {
- this.shift = -1;
- },
- next: function next() {
- if (this.position >= this.end) {
- return -1;
- }
- return this.data[this.position++];
- }
- };
- function getCustomHuffmanTable(index, referredTo, customTables) {
- var currentIndex = 0,
- i = void 0,
- ii = referredTo.length,
- table = void 0;
- for (i = 0; i < ii; i++) {
- table = customTables[referredTo[i]];
- if (table) {
- if (index === currentIndex) {
- return table;
- }
- currentIndex++;
- }
- }
- throw new Jbig2Error('can\'t find custom Huffman table');
- }
- function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
- var codes = [],
- i = void 0,
- codeLength = void 0;
- for (i = 0; i <= 34; i++) {
- codeLength = reader.readBits(4);
- codes.push(new HuffmanLine([i, codeLength, 0, 0]));
- }
- var runCodesTable = new HuffmanTable(codes, false);
- codes.length = 0;
- for (i = 0; i < numberOfSymbols;) {
- codeLength = runCodesTable.decode(reader);
- if (codeLength >= 32) {
- var repeatedLength = void 0,
- numberOfRepeats = void 0,
- j = void 0;
- switch (codeLength) {
- case 32:
- if (i === 0) {
- throw new Jbig2Error('no previous value in symbol ID table');
- }
- numberOfRepeats = reader.readBits(2) + 3;
- repeatedLength = codes[i - 1].prefixLength;
- break;
- case 33:
- numberOfRepeats = reader.readBits(3) + 3;
- repeatedLength = 0;
- break;
- case 34:
- numberOfRepeats = reader.readBits(7) + 11;
- repeatedLength = 0;
- break;
- default:
- throw new Jbig2Error('invalid code length in symbol ID table');
- }
- for (j = 0; j < numberOfRepeats; j++) {
- codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
- i++;
- }
- } else {
- codes.push(new HuffmanLine([i, codeLength, 0, 0]));
- i++;
- }
- }
- reader.byteAlign();
- var symbolIDTable = new HuffmanTable(codes, false);
- var customIndex = 0,
- tableFirstS = void 0,
- tableDeltaS = void 0,
- tableDeltaT = void 0;
- switch (textRegion.huffmanFS) {
- case 0:
- case 1:
- tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
- break;
- case 3:
- tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
- customIndex++;
- break;
- default:
- throw new Jbig2Error('invalid Huffman FS selector');
- }
- switch (textRegion.huffmanDS) {
- case 0:
- case 1:
- case 2:
- tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
- break;
- case 3:
- tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
- customIndex++;
- break;
- default:
- throw new Jbig2Error('invalid Huffman DS selector');
- }
- switch (textRegion.huffmanDT) {
- case 0:
- case 1:
- case 2:
- tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
- break;
- case 3:
- tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
- customIndex++;
- break;
- default:
- throw new Jbig2Error('invalid Huffman DT selector');
- }
- if (textRegion.refinement) {
- throw new Jbig2Error('refinement with Huffman is not supported');
- }
- return {
- symbolIDTable: symbolIDTable,
- tableFirstS: tableFirstS,
- tableDeltaS: tableDeltaS,
- tableDeltaT: tableDeltaT
- };
- }
- function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
- var customIndex = 0,
- tableDeltaHeight = void 0,
- tableDeltaWidth = void 0;
- switch (dictionary.huffmanDHSelector) {
- case 0:
- case 1:
- tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
- break;
- case 3:
- tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
- customIndex++;
- break;
- default:
- throw new Jbig2Error('invalid Huffman DH selector');
- }
- switch (dictionary.huffmanDWSelector) {
- case 0:
- case 1:
- tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
- break;
- case 3:
- tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
- customIndex++;
- break;
- default:
- throw new Jbig2Error('invalid Huffman DW selector');
- }
- var tableBitmapSize = void 0,
- tableAggregateInstances = void 0;
- if (dictionary.bitmapSizeSelector) {
- tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
- customIndex++;
- } else {
- tableBitmapSize = getStandardTable(1);
- }
- if (dictionary.aggregationInstancesSelector) {
- tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
- } else {
- tableAggregateInstances = getStandardTable(1);
- }
- return {
- tableDeltaHeight: tableDeltaHeight,
- tableDeltaWidth: tableDeltaWidth,
- tableBitmapSize: tableBitmapSize,
- tableAggregateInstances: tableAggregateInstances
- };
- }
- function readUncompressedBitmap(reader, width, height) {
- var bitmap = [],
- x = void 0,
- y = void 0,
- row = void 0;
- for (y = 0; y < height; y++) {
- row = new Uint8Array(width);
- bitmap.push(row);
- for (x = 0; x < width; x++) {
- row[x] = reader.readBit();
- }
- reader.byteAlign();
- }
- return bitmap;
- }
- function decodeMMRBitmap(input, width, height, endOfBlock) {
- var params = {
- K: -1,
- Columns: width,
- Rows: height,
- BlackIs1: true,
- EndOfBlock: endOfBlock
- };
- var decoder = new _ccitt.CCITTFaxDecoder(input, params);
- var bitmap = [],
- x = void 0,
- y = void 0,
- row = void 0,
- currentByte = void 0,
- shift = void 0,
- eof = false;
- for (y = 0; y < height; y++) {
- row = new Uint8Array(width);
- bitmap.push(row);
- shift = -1;
- for (x = 0; x < width; x++) {
- if (shift < 0) {
- currentByte = decoder.readNextChar();
- if (currentByte === -1) {
- currentByte = 0;
- eof = true;
- }
- shift = 7;
- }
- row[x] = currentByte >> shift & 1;
- shift--;
- }
- }
- if (endOfBlock && !eof) {
- var lookForEOFLimit = 5;
- for (var i = 0; i < lookForEOFLimit; i++) {
- if (decoder.readNextChar() === -1) {
- break;
- }
- }
- }
- return bitmap;
- }
- function Jbig2Image() {}
- Jbig2Image.prototype = {
- parseChunks: function parseChunks(chunks) {
- return parseJbig2Chunks(chunks);
- },
- parse: function parse(data) {
- var _parseJbig = parseJbig2(data),
- imgData = _parseJbig.imgData,
- width = _parseJbig.width,
- height = _parseJbig.height;
-
- this.width = width;
- this.height = height;
- return imgData;
- }
- };
- return Jbig2Image;
-}();
-exports.Jbig2Image = Jbig2Image;
-
-/***/ }),
-/* 145 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-var ArithmeticDecoder = function ArithmeticDecoderClosure() {
- var QeTable = [{
- qe: 0x5601,
- nmps: 1,
- nlps: 1,
- switchFlag: 1
- }, {
- qe: 0x3401,
- nmps: 2,
- nlps: 6,
- switchFlag: 0
- }, {
- qe: 0x1801,
- nmps: 3,
- nlps: 9,
- switchFlag: 0
- }, {
- qe: 0x0AC1,
- nmps: 4,
- nlps: 12,
- switchFlag: 0
- }, {
- qe: 0x0521,
- nmps: 5,
- nlps: 29,
- switchFlag: 0
- }, {
- qe: 0x0221,
- nmps: 38,
- nlps: 33,
- switchFlag: 0
- }, {
- qe: 0x5601,
- nmps: 7,
- nlps: 6,
- switchFlag: 1
- }, {
- qe: 0x5401,
- nmps: 8,
- nlps: 14,
- switchFlag: 0
- }, {
- qe: 0x4801,
- nmps: 9,
- nlps: 14,
- switchFlag: 0
- }, {
- qe: 0x3801,
- nmps: 10,
- nlps: 14,
- switchFlag: 0
- }, {
- qe: 0x3001,
- nmps: 11,
- nlps: 17,
- switchFlag: 0
- }, {
- qe: 0x2401,
- nmps: 12,
- nlps: 18,
- switchFlag: 0
- }, {
- qe: 0x1C01,
- nmps: 13,
- nlps: 20,
- switchFlag: 0
- }, {
- qe: 0x1601,
- nmps: 29,
- nlps: 21,
- switchFlag: 0
- }, {
- qe: 0x5601,
- nmps: 15,
- nlps: 14,
- switchFlag: 1
- }, {
- qe: 0x5401,
- nmps: 16,
- nlps: 14,
- switchFlag: 0
- }, {
- qe: 0x5101,
- nmps: 17,
- nlps: 15,
- switchFlag: 0
- }, {
- qe: 0x4801,
- nmps: 18,
- nlps: 16,
- switchFlag: 0
- }, {
- qe: 0x3801,
- nmps: 19,
- nlps: 17,
- switchFlag: 0
- }, {
- qe: 0x3401,
- nmps: 20,
- nlps: 18,
- switchFlag: 0
- }, {
- qe: 0x3001,
- nmps: 21,
- nlps: 19,
- switchFlag: 0
- }, {
- qe: 0x2801,
- nmps: 22,
- nlps: 19,
- switchFlag: 0
- }, {
- qe: 0x2401,
- nmps: 23,
- nlps: 20,
- switchFlag: 0
- }, {
- qe: 0x2201,
- nmps: 24,
- nlps: 21,
- switchFlag: 0
- }, {
- qe: 0x1C01,
- nmps: 25,
- nlps: 22,
- switchFlag: 0
- }, {
- qe: 0x1801,
- nmps: 26,
- nlps: 23,
- switchFlag: 0
- }, {
- qe: 0x1601,
- nmps: 27,
- nlps: 24,
- switchFlag: 0
- }, {
- qe: 0x1401,
- nmps: 28,
- nlps: 25,
- switchFlag: 0
- }, {
- qe: 0x1201,
- nmps: 29,
- nlps: 26,
- switchFlag: 0
- }, {
- qe: 0x1101,
- nmps: 30,
- nlps: 27,
- switchFlag: 0
- }, {
- qe: 0x0AC1,
- nmps: 31,
- nlps: 28,
- switchFlag: 0
- }, {
- qe: 0x09C1,
- nmps: 32,
- nlps: 29,
- switchFlag: 0
- }, {
- qe: 0x08A1,
- nmps: 33,
- nlps: 30,
- switchFlag: 0
- }, {
- qe: 0x0521,
- nmps: 34,
- nlps: 31,
- switchFlag: 0
- }, {
- qe: 0x0441,
- nmps: 35,
- nlps: 32,
- switchFlag: 0
- }, {
- qe: 0x02A1,
- nmps: 36,
- nlps: 33,
- switchFlag: 0
- }, {
- qe: 0x0221,
- nmps: 37,
- nlps: 34,
- switchFlag: 0
- }, {
- qe: 0x0141,
- nmps: 38,
- nlps: 35,
- switchFlag: 0
- }, {
- qe: 0x0111,
- nmps: 39,
- nlps: 36,
- switchFlag: 0
- }, {
- qe: 0x0085,
- nmps: 40,
- nlps: 37,
- switchFlag: 0
- }, {
- qe: 0x0049,
- nmps: 41,
- nlps: 38,
- switchFlag: 0
- }, {
- qe: 0x0025,
- nmps: 42,
- nlps: 39,
- switchFlag: 0
- }, {
- qe: 0x0015,
- nmps: 43,
- nlps: 40,
- switchFlag: 0
- }, {
- qe: 0x0009,
- nmps: 44,
- nlps: 41,
- switchFlag: 0
- }, {
- qe: 0x0005,
- nmps: 45,
- nlps: 42,
- switchFlag: 0
- }, {
- qe: 0x0001,
- nmps: 45,
- nlps: 43,
- switchFlag: 0
- }, {
- qe: 0x5601,
- nmps: 46,
- nlps: 46,
- switchFlag: 0
- }];
- function ArithmeticDecoder(data, start, end) {
- this.data = data;
- this.bp = start;
- this.dataEnd = end;
- this.chigh = data[start];
- this.clow = 0;
- this.byteIn();
- this.chigh = this.chigh << 7 & 0xFFFF | this.clow >> 9 & 0x7F;
- this.clow = this.clow << 7 & 0xFFFF;
- this.ct -= 7;
- this.a = 0x8000;
- }
- ArithmeticDecoder.prototype = {
- byteIn: function ArithmeticDecoder_byteIn() {
- var data = this.data;
- var bp = this.bp;
- if (data[bp] === 0xFF) {
- var b1 = data[bp + 1];
- if (b1 > 0x8F) {
- this.clow += 0xFF00;
- this.ct = 8;
- } else {
- bp++;
- this.clow += data[bp] << 9;
- this.ct = 7;
- this.bp = bp;
- }
- } else {
- bp++;
- this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xFF00;
- this.ct = 8;
- this.bp = bp;
- }
- if (this.clow > 0xFFFF) {
- this.chigh += this.clow >> 16;
- this.clow &= 0xFFFF;
- }
- },
- readBit: function ArithmeticDecoder_readBit(contexts, pos) {
- var cx_index = contexts[pos] >> 1,
- cx_mps = contexts[pos] & 1;
- var qeTableIcx = QeTable[cx_index];
- var qeIcx = qeTableIcx.qe;
- var d;
- var a = this.a - qeIcx;
- if (this.chigh < qeIcx) {
- if (a < qeIcx) {
- a = qeIcx;
- d = cx_mps;
- cx_index = qeTableIcx.nmps;
- } else {
- a = qeIcx;
- d = 1 ^ cx_mps;
- if (qeTableIcx.switchFlag === 1) {
- cx_mps = d;
- }
- cx_index = qeTableIcx.nlps;
- }
- } else {
- this.chigh -= qeIcx;
- if ((a & 0x8000) !== 0) {
- this.a = a;
- return cx_mps;
- }
- if (a < qeIcx) {
- d = 1 ^ cx_mps;
- if (qeTableIcx.switchFlag === 1) {
- cx_mps = d;
- }
- cx_index = qeTableIcx.nlps;
- } else {
- d = cx_mps;
- cx_index = qeTableIcx.nmps;
- }
- }
- do {
- if (this.ct === 0) {
- this.byteIn();
- }
- a <<= 1;
- this.chigh = this.chigh << 1 & 0xFFFF | this.clow >> 15 & 1;
- this.clow = this.clow << 1 & 0xFFFF;
- this.ct--;
- } while ((a & 0x8000) === 0);
- this.a = a;
- contexts[pos] = cx_index << 1 | cx_mps;
- return d;
- }
- };
- return ArithmeticDecoder;
-}();
-exports.ArithmeticDecoder = ArithmeticDecoder;
-
-/***/ }),
-/* 146 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.JpegStream = undefined;
-
-var _util = __w_pdfjs_require__(2);
-
-var _stream = __w_pdfjs_require__(140);
-
-var _primitives = __w_pdfjs_require__(138);
-
-var _jpg = __w_pdfjs_require__(147);
-
-var JpegStream = function JpegStreamClosure() {
- function JpegStream(stream, maybeLength, dict, params) {
- var ch = void 0;
- while ((ch = stream.getByte()) !== -1) {
- if (ch === 0xFF) {
- stream.skip(-1);
- break;
- }
- }
- this.stream = stream;
- this.maybeLength = maybeLength;
- this.dict = dict;
- this.params = params;
- _stream.DecodeStream.call(this, maybeLength);
- }
- JpegStream.prototype = Object.create(_stream.DecodeStream.prototype);
- Object.defineProperty(JpegStream.prototype, 'bytes', {
- get: function JpegStream_bytes() {
- return (0, _util.shadow)(this, 'bytes', this.stream.getBytes(this.maybeLength));
- },
- configurable: true
- });
- JpegStream.prototype.ensureBuffer = function (requested) {};
- JpegStream.prototype.readBlock = function () {
- if (this.eof) {
- return;
- }
- var jpegOptions = {
- decodeTransform: undefined,
- colorTransform: undefined
- };
- var decodeArr = this.dict.getArray('Decode', 'D');
- if (this.forceRGB && Array.isArray(decodeArr)) {
- var bitsPerComponent = this.dict.get('BitsPerComponent') || 8;
- var decodeArrLength = decodeArr.length;
- var transform = new Int32Array(decodeArrLength);
- var transformNeeded = false;
- var maxValue = (1 << bitsPerComponent) - 1;
- for (var i = 0; i < decodeArrLength; i += 2) {
- transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
- transform[i + 1] = decodeArr[i] * maxValue | 0;
- if (transform[i] !== 256 || transform[i + 1] !== 0) {
- transformNeeded = true;
- }
- }
- if (transformNeeded) {
- jpegOptions.decodeTransform = transform;
- }
- }
- if ((0, _primitives.isDict)(this.params)) {
- var colorTransform = this.params.get('ColorTransform');
- if (Number.isInteger(colorTransform)) {
- jpegOptions.colorTransform = colorTransform;
- }
- }
- var jpegImage = new _jpg.JpegImage(jpegOptions);
- jpegImage.parse(this.bytes);
- var data = jpegImage.getData({
- width: this.drawWidth,
- height: this.drawHeight,
- forceRGB: this.forceRGB,
- isSourcePDF: true
- });
- this.buffer = data;
- this.bufferLength = data.length;
- this.eof = true;
- };
- JpegStream.prototype.getIR = function () {
- var forceDataSchema = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
-
- return (0, _util.createObjectURL)(this.bytes, 'image/jpeg', forceDataSchema);
- };
- return JpegStream;
-}();
-exports.JpegStream = JpegStream;
-
-/***/ }),
-/* 147 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.JpegImage = undefined;
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-var _util = __w_pdfjs_require__(2);
-
-var JpegError = function JpegErrorClosure() {
- function JpegError(msg) {
- this.message = 'JPEG error: ' + msg;
- }
- JpegError.prototype = new Error();
- JpegError.prototype.name = 'JpegError';
- JpegError.constructor = JpegError;
- return JpegError;
-}();
-var DNLMarkerError = function DNLMarkerErrorClosure() {
- function DNLMarkerError(message, scanLines) {
- this.message = message;
- this.scanLines = scanLines;
- }
- DNLMarkerError.prototype = new Error();
- DNLMarkerError.prototype.name = 'DNLMarkerError';
- DNLMarkerError.constructor = DNLMarkerError;
- return DNLMarkerError;
-}();
-var EOIMarkerError = function EOIMarkerErrorClosure() {
- function EOIMarkerError(message) {
- this.message = message;
- }
- EOIMarkerError.prototype = new Error();
- EOIMarkerError.prototype.name = 'EOIMarkerError';
- EOIMarkerError.constructor = EOIMarkerError;
- return EOIMarkerError;
-}();
-var JpegImage = function JpegImageClosure() {
- var dctZigZag = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]);
- var dctCos1 = 4017;
- var dctSin1 = 799;
- var dctCos3 = 3406;
- var dctSin3 = 2276;
- var dctCos6 = 1567;
- var dctSin6 = 3784;
- var dctSqrt2 = 5793;
- var dctSqrt1d2 = 2896;
- function JpegImage() {
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- _ref$decodeTransform = _ref.decodeTransform,
- decodeTransform = _ref$decodeTransform === undefined ? null : _ref$decodeTransform,
- _ref$colorTransform = _ref.colorTransform,
- colorTransform = _ref$colorTransform === undefined ? -1 : _ref$colorTransform;
-
- this._decodeTransform = decodeTransform;
- this._colorTransform = colorTransform;
- }
- function buildHuffmanTable(codeLengths, values) {
- var k = 0,
- code = [],
- i,
- j,
- length = 16;
- while (length > 0 && !codeLengths[length - 1]) {
- length--;
- }
- code.push({
- children: [],
- index: 0
- });
- var p = code[0],
- q;
- for (i = 0; i < length; i++) {
- for (j = 0; j < codeLengths[i]; j++) {
- p = code.pop();
- p.children[p.index] = values[k];
- while (p.index > 0) {
- p = code.pop();
- }
- p.index++;
- code.push(p);
- while (code.length <= i) {
- code.push(q = {
- children: [],
- index: 0
- });
- p.children[p.index] = q.children;
- p = q;
- }
- k++;
- }
- if (i + 1 < length) {
- code.push(q = {
- children: [],
- index: 0
- });
- p.children[p.index] = q.children;
- p = q;
- }
- }
- return code[0].children;
- }
- function getBlockBufferOffset(component, row, col) {
- return 64 * ((component.blocksPerLine + 1) * row + col);
- }
- function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) {
- var parseDNLMarker = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
-
- var mcusPerLine = frame.mcusPerLine;
- var progressive = frame.progressive;
- var startOffset = offset,
- bitsData = 0,
- bitsCount = 0;
- function readBit() {
- if (bitsCount > 0) {
- bitsCount--;
- return bitsData >> bitsCount & 1;
- }
- bitsData = data[offset++];
- if (bitsData === 0xFF) {
- var nextByte = data[offset++];
- if (nextByte) {
- if (nextByte === 0xDC && parseDNLMarker) {
- offset += 2;
- var scanLines = data[offset++] << 8 | data[offset++];
- if (scanLines > 0 && scanLines !== frame.scanLines) {
- throw new DNLMarkerError('Found DNL marker (0xFFDC) while parsing scan data', scanLines);
- }
- } else if (nextByte === 0xD9) {
- throw new EOIMarkerError('Found EOI marker (0xFFD9) while parsing scan data');
- }
- throw new JpegError('unexpected marker ' + (bitsData << 8 | nextByte).toString(16));
- }
- }
- bitsCount = 7;
- return bitsData >>> 7;
- }
- function decodeHuffman(tree) {
- var node = tree;
- while (true) {
- node = node[readBit()];
- if (typeof node === 'number') {
- return node;
- }
- if ((typeof node === 'undefined' ? 'undefined' : _typeof(node)) !== 'object') {
- throw new JpegError('invalid huffman sequence');
- }
- }
- }
- function receive(length) {
- var n = 0;
- while (length > 0) {
- n = n << 1 | readBit();
- length--;
- }
- return n;
- }
- function receiveAndExtend(length) {
- if (length === 1) {
- return readBit() === 1 ? 1 : -1;
- }
- var n = receive(length);
- if (n >= 1 << length - 1) {
- return n;
- }
- return n + (-1 << length) + 1;
- }
- function decodeBaseline(component, offset) {
- var t = decodeHuffman(component.huffmanTableDC);
- var diff = t === 0 ? 0 : receiveAndExtend(t);
- component.blockData[offset] = component.pred += diff;
- var k = 1;
- while (k < 64) {
- var rs = decodeHuffman(component.huffmanTableAC);
- var s = rs & 15,
- r = rs >> 4;
- if (s === 0) {
- if (r < 15) {
- break;
- }
- k += 16;
- continue;
- }
- k += r;
- var z = dctZigZag[k];
- component.blockData[offset + z] = receiveAndExtend(s);
- k++;
- }
- }
- function decodeDCFirst(component, offset) {
- var t = decodeHuffman(component.huffmanTableDC);
- var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
- component.blockData[offset] = component.pred += diff;
- }
- function decodeDCSuccessive(component, offset) {
- component.blockData[offset] |= readBit() << successive;
- }
- var eobrun = 0;
- function decodeACFirst(component, offset) {
- if (eobrun > 0) {
- eobrun--;
- return;
- }
- var k = spectralStart,
- e = spectralEnd;
- while (k <= e) {
- var rs = decodeHuffman(component.huffmanTableAC);
- var s = rs & 15,
- r = rs >> 4;
- if (s === 0) {
- if (r < 15) {
- eobrun = receive(r) + (1 << r) - 1;
- break;
- }
- k += 16;
- continue;
- }
- k += r;
- var z = dctZigZag[k];
- component.blockData[offset + z] = receiveAndExtend(s) * (1 << successive);
- k++;
- }
- }
- var successiveACState = 0,
- successiveACNextValue;
- function decodeACSuccessive(component, offset) {
- var k = spectralStart;
- var e = spectralEnd;
- var r = 0;
- var s;
- var rs;
- while (k <= e) {
- var offsetZ = offset + dctZigZag[k];
- var sign = component.blockData[offsetZ] < 0 ? -1 : 1;
- switch (successiveACState) {
- case 0:
- rs = decodeHuffman(component.huffmanTableAC);
- s = rs & 15;
- r = rs >> 4;
- if (s === 0) {
- if (r < 15) {
- eobrun = receive(r) + (1 << r);
- successiveACState = 4;
- } else {
- r = 16;
- successiveACState = 1;
- }
- } else {
- if (s !== 1) {
- throw new JpegError('invalid ACn encoding');
- }
- successiveACNextValue = receiveAndExtend(s);
- successiveACState = r ? 2 : 3;
- }
- continue;
- case 1:
- case 2:
- if (component.blockData[offsetZ]) {
- component.blockData[offsetZ] += sign * (readBit() << successive);
- } else {
- r--;
- if (r === 0) {
- successiveACState = successiveACState === 2 ? 3 : 0;
- }
- }
- break;
- case 3:
- if (component.blockData[offsetZ]) {
- component.blockData[offsetZ] += sign * (readBit() << successive);
- } else {
- component.blockData[offsetZ] = successiveACNextValue << successive;
- successiveACState = 0;
- }
- break;
- case 4:
- if (component.blockData[offsetZ]) {
- component.blockData[offsetZ] += sign * (readBit() << successive);
- }
- break;
- }
- k++;
- }
- if (successiveACState === 4) {
- eobrun--;
- if (eobrun === 0) {
- successiveACState = 0;
- }
- }
- }
- function decodeMcu(component, decode, mcu, row, col) {
- var mcuRow = mcu / mcusPerLine | 0;
- var mcuCol = mcu % mcusPerLine;
- var blockRow = mcuRow * component.v + row;
- var blockCol = mcuCol * component.h + col;
- var offset = getBlockBufferOffset(component, blockRow, blockCol);
- decode(component, offset);
- }
- function decodeBlock(component, decode, mcu) {
- var blockRow = mcu / component.blocksPerLine | 0;
- var blockCol = mcu % component.blocksPerLine;
- var offset = getBlockBufferOffset(component, blockRow, blockCol);
- decode(component, offset);
- }
- var componentsLength = components.length;
- var component, i, j, k, n;
- var decodeFn;
- if (progressive) {
- if (spectralStart === 0) {
- decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
- } else {
- decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
- }
- } else {
- decodeFn = decodeBaseline;
- }
- var mcu = 0,
- fileMarker;
- var mcuExpected;
- if (componentsLength === 1) {
- mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
- } else {
- mcuExpected = mcusPerLine * frame.mcusPerColumn;
- }
- var h, v;
- while (mcu < mcuExpected) {
- var mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
- for (i = 0; i < componentsLength; i++) {
- components[i].pred = 0;
- }
- eobrun = 0;
- if (componentsLength === 1) {
- component = components[0];
- for (n = 0; n < mcuToRead; n++) {
- decodeBlock(component, decodeFn, mcu);
- mcu++;
- }
- } else {
- for (n = 0; n < mcuToRead; n++) {
- for (i = 0; i < componentsLength; i++) {
- component = components[i];
- h = component.h;
- v = component.v;
- for (j = 0; j < v; j++) {
- for (k = 0; k < h; k++) {
- decodeMcu(component, decodeFn, mcu, j, k);
- }
- }
- }
- mcu++;
- }
- }
- bitsCount = 0;
- fileMarker = findNextFileMarker(data, offset);
- if (fileMarker && fileMarker.invalid) {
- (0, _util.warn)('decodeScan - unexpected MCU data, current marker is: ' + fileMarker.invalid);
- offset = fileMarker.offset;
- }
- var marker = fileMarker && fileMarker.marker;
- if (!marker || marker <= 0xFF00) {
- throw new JpegError('marker was not found');
- }
- if (marker >= 0xFFD0 && marker <= 0xFFD7) {
- offset += 2;
- } else {
- break;
- }
- }
- fileMarker = findNextFileMarker(data, offset);
- if (fileMarker && fileMarker.invalid) {
- (0, _util.warn)('decodeScan - unexpected Scan data, current marker is: ' + fileMarker.invalid);
- offset = fileMarker.offset;
- }
- return offset - startOffset;
- }
- function quantizeAndInverse(component, blockBufferOffset, p) {
- var qt = component.quantizationTable,
- blockData = component.blockData;
- var v0, v1, v2, v3, v4, v5, v6, v7;
- var p0, p1, p2, p3, p4, p5, p6, p7;
- var t;
- if (!qt) {
- throw new JpegError('missing required Quantization Table.');
- }
- for (var row = 0; row < 64; row += 8) {
- p0 = blockData[blockBufferOffset + row];
- p1 = blockData[blockBufferOffset + row + 1];
- p2 = blockData[blockBufferOffset + row + 2];
- p3 = blockData[blockBufferOffset + row + 3];
- p4 = blockData[blockBufferOffset + row + 4];
- p5 = blockData[blockBufferOffset + row + 5];
- p6 = blockData[blockBufferOffset + row + 6];
- p7 = blockData[blockBufferOffset + row + 7];
- p0 *= qt[row];
- if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
- t = dctSqrt2 * p0 + 512 >> 10;
- p[row] = t;
- p[row + 1] = t;
- p[row + 2] = t;
- p[row + 3] = t;
- p[row + 4] = t;
- p[row + 5] = t;
- p[row + 6] = t;
- p[row + 7] = t;
- continue;
- }
- p1 *= qt[row + 1];
- p2 *= qt[row + 2];
- p3 *= qt[row + 3];
- p4 *= qt[row + 4];
- p5 *= qt[row + 5];
- p6 *= qt[row + 6];
- p7 *= qt[row + 7];
- v0 = dctSqrt2 * p0 + 128 >> 8;
- v1 = dctSqrt2 * p4 + 128 >> 8;
- v2 = p2;
- v3 = p6;
- v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
- v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
- v5 = p3 << 4;
- v6 = p5 << 4;
- v0 = v0 + v1 + 1 >> 1;
- v1 = v0 - v1;
- t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
- v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
- v3 = t;
- v4 = v4 + v6 + 1 >> 1;
- v6 = v4 - v6;
- v7 = v7 + v5 + 1 >> 1;
- v5 = v7 - v5;
- v0 = v0 + v3 + 1 >> 1;
- v3 = v0 - v3;
- v1 = v1 + v2 + 1 >> 1;
- v2 = v1 - v2;
- t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
- v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
- v7 = t;
- t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
- v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
- v6 = t;
- p[row] = v0 + v7;
- p[row + 7] = v0 - v7;
- p[row + 1] = v1 + v6;
- p[row + 6] = v1 - v6;
- p[row + 2] = v2 + v5;
- p[row + 5] = v2 - v5;
- p[row + 3] = v3 + v4;
- p[row + 4] = v3 - v4;
- }
- for (var col = 0; col < 8; ++col) {
- p0 = p[col];
- p1 = p[col + 8];
- p2 = p[col + 16];
- p3 = p[col + 24];
- p4 = p[col + 32];
- p5 = p[col + 40];
- p6 = p[col + 48];
- p7 = p[col + 56];
- if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
- t = dctSqrt2 * p0 + 8192 >> 14;
- t = t < -2040 ? 0 : t >= 2024 ? 255 : t + 2056 >> 4;
- blockData[blockBufferOffset + col] = t;
- blockData[blockBufferOffset + col + 8] = t;
- blockData[blockBufferOffset + col + 16] = t;
- blockData[blockBufferOffset + col + 24] = t;
- blockData[blockBufferOffset + col + 32] = t;
- blockData[blockBufferOffset + col + 40] = t;
- blockData[blockBufferOffset + col + 48] = t;
- blockData[blockBufferOffset + col + 56] = t;
- continue;
- }
- v0 = dctSqrt2 * p0 + 2048 >> 12;
- v1 = dctSqrt2 * p4 + 2048 >> 12;
- v2 = p2;
- v3 = p6;
- v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
- v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
- v5 = p3;
- v6 = p5;
- v0 = (v0 + v1 + 1 >> 1) + 4112;
- v1 = v0 - v1;
- t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
- v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
- v3 = t;
- v4 = v4 + v6 + 1 >> 1;
- v6 = v4 - v6;
- v7 = v7 + v5 + 1 >> 1;
- v5 = v7 - v5;
- v0 = v0 + v3 + 1 >> 1;
- v3 = v0 - v3;
- v1 = v1 + v2 + 1 >> 1;
- v2 = v1 - v2;
- t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
- v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
- v7 = t;
- t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
- v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
- v6 = t;
- p0 = v0 + v7;
- p7 = v0 - v7;
- p1 = v1 + v6;
- p6 = v1 - v6;
- p2 = v2 + v5;
- p5 = v2 - v5;
- p3 = v3 + v4;
- p4 = v3 - v4;
- p0 = p0 < 16 ? 0 : p0 >= 4080 ? 255 : p0 >> 4;
- p1 = p1 < 16 ? 0 : p1 >= 4080 ? 255 : p1 >> 4;
- p2 = p2 < 16 ? 0 : p2 >= 4080 ? 255 : p2 >> 4;
- p3 = p3 < 16 ? 0 : p3 >= 4080 ? 255 : p3 >> 4;
- p4 = p4 < 16 ? 0 : p4 >= 4080 ? 255 : p4 >> 4;
- p5 = p5 < 16 ? 0 : p5 >= 4080 ? 255 : p5 >> 4;
- p6 = p6 < 16 ? 0 : p6 >= 4080 ? 255 : p6 >> 4;
- p7 = p7 < 16 ? 0 : p7 >= 4080 ? 255 : p7 >> 4;
- blockData[blockBufferOffset + col] = p0;
- blockData[blockBufferOffset + col + 8] = p1;
- blockData[blockBufferOffset + col + 16] = p2;
- blockData[blockBufferOffset + col + 24] = p3;
- blockData[blockBufferOffset + col + 32] = p4;
- blockData[blockBufferOffset + col + 40] = p5;
- blockData[blockBufferOffset + col + 48] = p6;
- blockData[blockBufferOffset + col + 56] = p7;
- }
- }
- function buildComponentData(frame, component) {
- var blocksPerLine = component.blocksPerLine;
- var blocksPerColumn = component.blocksPerColumn;
- var computationBuffer = new Int16Array(64);
- for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
- for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {
- var offset = getBlockBufferOffset(component, blockRow, blockCol);
- quantizeAndInverse(component, offset, computationBuffer);
- }
- }
- return component.blockData;
- }
- function findNextFileMarker(data, currentPos) {
- var startPos = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : currentPos;
-
- function peekUint16(pos) {
- return data[pos] << 8 | data[pos + 1];
- }
- var maxPos = data.length - 1;
- var newPos = startPos < currentPos ? startPos : currentPos;
- if (currentPos >= maxPos) {
- return null;
- }
- var currentMarker = peekUint16(currentPos);
- if (currentMarker >= 0xFFC0 && currentMarker <= 0xFFFE) {
- return {
- invalid: null,
- marker: currentMarker,
- offset: currentPos
- };
- }
- var newMarker = peekUint16(newPos);
- while (!(newMarker >= 0xFFC0 && newMarker <= 0xFFFE)) {
- if (++newPos >= maxPos) {
- return null;
- }
- newMarker = peekUint16(newPos);
- }
- return {
- invalid: currentMarker.toString(16),
- marker: newMarker,
- offset: newPos
- };
- }
- JpegImage.prototype = {
- parse: function parse(data) {
- var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- _ref2$dnlScanLines = _ref2.dnlScanLines,
- dnlScanLines = _ref2$dnlScanLines === undefined ? null : _ref2$dnlScanLines;
-
- function readUint16() {
- var value = data[offset] << 8 | data[offset + 1];
- offset += 2;
- return value;
- }
- function readDataBlock() {
- var length = readUint16();
- var endOffset = offset + length - 2;
- var fileMarker = findNextFileMarker(data, endOffset, offset);
- if (fileMarker && fileMarker.invalid) {
- (0, _util.warn)('readDataBlock - incorrect length, current marker is: ' + fileMarker.invalid);
- endOffset = fileMarker.offset;
- }
- var array = data.subarray(offset, endOffset);
- offset += array.length;
- return array;
- }
- function prepareComponents(frame) {
- var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
- var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
- for (var i = 0; i < frame.components.length; i++) {
- component = frame.components[i];
- var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
- var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
- var blocksPerLineForMcu = mcusPerLine * component.h;
- var blocksPerColumnForMcu = mcusPerColumn * component.v;
- var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
- component.blockData = new Int16Array(blocksBufferSize);
- component.blocksPerLine = blocksPerLine;
- component.blocksPerColumn = blocksPerColumn;
- }
- frame.mcusPerLine = mcusPerLine;
- frame.mcusPerColumn = mcusPerColumn;
- }
- var offset = 0;
- var jfif = null;
- var adobe = null;
- var frame, resetInterval;
- var numSOSMarkers = 0;
- var quantizationTables = [];
- var huffmanTablesAC = [],
- huffmanTablesDC = [];
- var fileMarker = readUint16();
- if (fileMarker !== 0xFFD8) {
- throw new JpegError('SOI not found');
- }
- fileMarker = readUint16();
- markerLoop: while (fileMarker !== 0xFFD9) {
- var i, j, l;
- switch (fileMarker) {
- case 0xFFE0:
- case 0xFFE1:
- case 0xFFE2:
- case 0xFFE3:
- case 0xFFE4:
- case 0xFFE5:
- case 0xFFE6:
- case 0xFFE7:
- case 0xFFE8:
- case 0xFFE9:
- case 0xFFEA:
- case 0xFFEB:
- case 0xFFEC:
- case 0xFFED:
- case 0xFFEE:
- case 0xFFEF:
- case 0xFFFE:
- var appData = readDataBlock();
- if (fileMarker === 0xFFE0) {
- if (appData[0] === 0x4A && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
- jfif = {
- version: {
- major: appData[5],
- minor: appData[6]
- },
- densityUnits: appData[7],
- xDensity: appData[8] << 8 | appData[9],
- yDensity: appData[10] << 8 | appData[11],
- thumbWidth: appData[12],
- thumbHeight: appData[13],
- thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
- };
- }
- }
- if (fileMarker === 0xFFEE) {
- if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F && appData[3] === 0x62 && appData[4] === 0x65) {
- adobe = {
- version: appData[5] << 8 | appData[6],
- flags0: appData[7] << 8 | appData[8],
- flags1: appData[9] << 8 | appData[10],
- transformCode: appData[11]
- };
- }
- }
- break;
- case 0xFFDB:
- var quantizationTablesLength = readUint16();
- var quantizationTablesEnd = quantizationTablesLength + offset - 2;
- var z;
- while (offset < quantizationTablesEnd) {
- var quantizationTableSpec = data[offset++];
- var tableData = new Uint16Array(64);
- if (quantizationTableSpec >> 4 === 0) {
- for (j = 0; j < 64; j++) {
- z = dctZigZag[j];
- tableData[z] = data[offset++];
- }
- } else if (quantizationTableSpec >> 4 === 1) {
- for (j = 0; j < 64; j++) {
- z = dctZigZag[j];
- tableData[z] = readUint16();
- }
- } else {
- throw new JpegError('DQT - invalid table spec');
- }
- quantizationTables[quantizationTableSpec & 15] = tableData;
- }
- break;
- case 0xFFC0:
- case 0xFFC1:
- case 0xFFC2:
- if (frame) {
- throw new JpegError('Only single frame JPEGs supported');
- }
- readUint16();
- frame = {};
- frame.extended = fileMarker === 0xFFC1;
- frame.progressive = fileMarker === 0xFFC2;
- frame.precision = data[offset++];
- var sofScanLines = readUint16();
- frame.scanLines = dnlScanLines || sofScanLines;
- frame.samplesPerLine = readUint16();
- frame.components = [];
- frame.componentIds = {};
- var componentsCount = data[offset++],
- componentId;
- var maxH = 0,
- maxV = 0;
- for (i = 0; i < componentsCount; i++) {
- componentId = data[offset];
- var h = data[offset + 1] >> 4;
- var v = data[offset + 1] & 15;
- if (maxH < h) {
- maxH = h;
- }
- if (maxV < v) {
- maxV = v;
- }
- var qId = data[offset + 2];
- l = frame.components.push({
- h: h,
- v: v,
- quantizationId: qId,
- quantizationTable: null
- });
- frame.componentIds[componentId] = l - 1;
- offset += 3;
- }
- frame.maxH = maxH;
- frame.maxV = maxV;
- prepareComponents(frame);
- break;
- case 0xFFC4:
- var huffmanLength = readUint16();
- for (i = 2; i < huffmanLength;) {
- var huffmanTableSpec = data[offset++];
- var codeLengths = new Uint8Array(16);
- var codeLengthSum = 0;
- for (j = 0; j < 16; j++, offset++) {
- codeLengthSum += codeLengths[j] = data[offset];
- }
- var huffmanValues = new Uint8Array(codeLengthSum);
- for (j = 0; j < codeLengthSum; j++, offset++) {
- huffmanValues[j] = data[offset];
- }
- i += 17 + codeLengthSum;
- (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
- }
- break;
- case 0xFFDD:
- readUint16();
- resetInterval = readUint16();
- break;
- case 0xFFDA:
- var parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
- readUint16();
- var selectorsCount = data[offset++];
- var components = [],
- component;
- for (i = 0; i < selectorsCount; i++) {
- var componentIndex = frame.componentIds[data[offset++]];
- component = frame.components[componentIndex];
- var tableSpec = data[offset++];
- component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
- component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
- components.push(component);
- }
- var spectralStart = data[offset++];
- var spectralEnd = data[offset++];
- var successiveApproximation = data[offset++];
- try {
- var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
- offset += processed;
- } catch (ex) {
- if (ex instanceof DNLMarkerError) {
- (0, _util.warn)(ex.message + ' -- attempting to re-parse the JPEG image.');
- return this.parse(data, { dnlScanLines: ex.scanLines });
- } else if (ex instanceof EOIMarkerError) {
- (0, _util.warn)(ex.message + ' -- ignoring the rest of the image data.');
- break markerLoop;
- }
- throw ex;
- }
- break;
- case 0xFFDC:
- offset += 4;
- break;
- case 0xFFFF:
- if (data[offset] !== 0xFF) {
- offset--;
- }
- break;
- default:
- if (data[offset - 3] === 0xFF && data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) {
- offset -= 3;
- break;
- }
- var nextFileMarker = findNextFileMarker(data, offset - 2);
- if (nextFileMarker && nextFileMarker.invalid) {
- (0, _util.warn)('JpegImage.parse - unexpected data, current marker is: ' + nextFileMarker.invalid);
- offset = nextFileMarker.offset;
- break;
- }
- throw new JpegError('unknown marker ' + fileMarker.toString(16));
- }
- fileMarker = readUint16();
- }
- this.width = frame.samplesPerLine;
- this.height = frame.scanLines;
- this.jfif = jfif;
- this.adobe = adobe;
- this.components = [];
- for (i = 0; i < frame.components.length; i++) {
- component = frame.components[i];
- var quantizationTable = quantizationTables[component.quantizationId];
- if (quantizationTable) {
- component.quantizationTable = quantizationTable;
- }
- this.components.push({
- output: buildComponentData(frame, component),
- scaleX: component.h / frame.maxH,
- scaleY: component.v / frame.maxV,
- blocksPerLine: component.blocksPerLine,
- blocksPerColumn: component.blocksPerColumn
- });
- }
- this.numComponents = this.components.length;
- },
- _getLinearizedBlockData: function _getLinearizedBlockData(width, height) {
- var isSourcePDF = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
-
- var scaleX = this.width / width,
- scaleY = this.height / height;
- var component, componentScaleX, componentScaleY, blocksPerScanline;
- var x, y, i, j, k;
- var index;
- var offset = 0;
- var output;
- var numComponents = this.components.length;
- var dataLength = width * height * numComponents;
- var data = new Uint8ClampedArray(dataLength);
- var xScaleBlockOffset = new Uint32Array(width);
- var mask3LSB = 0xfffffff8;
- for (i = 0; i < numComponents; i++) {
- component = this.components[i];
- componentScaleX = component.scaleX * scaleX;
- componentScaleY = component.scaleY * scaleY;
- offset = i;
- output = component.output;
- blocksPerScanline = component.blocksPerLine + 1 << 3;
- for (x = 0; x < width; x++) {
- j = 0 | x * componentScaleX;
- xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
- }
- for (y = 0; y < height; y++) {
- j = 0 | y * componentScaleY;
- index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
- for (x = 0; x < width; x++) {
- data[offset] = output[index + xScaleBlockOffset[x]];
- offset += numComponents;
- }
- }
- }
- var transform = this._decodeTransform;
- if (!isSourcePDF && numComponents === 4 && !transform) {
- transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
- }
- if (transform) {
- for (i = 0; i < dataLength;) {
- for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
- data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
- }
- }
- }
- return data;
- },
-
- get _isColorConversionNeeded() {
- if (this.adobe) {
- return !!this.adobe.transformCode;
- }
- if (this.numComponents === 3) {
- if (this._colorTransform === 0) {
- return false;
- }
- return true;
- }
- if (this._colorTransform === 1) {
- return true;
- }
- return false;
- },
- _convertYccToRgb: function convertYccToRgb(data) {
- var Y, Cb, Cr;
- for (var i = 0, length = data.length; i < length; i += 3) {
- Y = data[i];
- Cb = data[i + 1];
- Cr = data[i + 2];
- data[i] = Y - 179.456 + 1.402 * Cr;
- data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
- data[i + 2] = Y - 226.816 + 1.772 * Cb;
- }
- return data;
- },
- _convertYcckToRgb: function convertYcckToRgb(data) {
- var Y, Cb, Cr, k;
- var offset = 0;
- for (var i = 0, length = data.length; i < length; i += 4) {
- Y = data[i];
- Cb = data[i + 1];
- Cr = data[i + 2];
- k = data[i + 3];
- data[offset++] = -122.67195406894 + Cb * (-6.60635669420364e-5 * Cb + 0.000437130475926232 * Cr - 5.4080610064599e-5 * Y + 0.00048449797120281 * k - 0.154362151871126) + Cr * (-0.000957964378445773 * Cr + 0.000817076911346625 * Y - 0.00477271405408747 * k + 1.53380253221734) + Y * (0.000961250184130688 * Y - 0.00266257332283933 * k + 0.48357088451265) + k * (-0.000336197177618394 * k + 0.484791561490776);
- data[offset++] = 107.268039397724 + Cb * (2.19927104525741e-5 * Cb - 0.000640992018297945 * Cr + 0.000659397001245577 * Y + 0.000426105652938837 * k - 0.176491792462875) + Cr * (-0.000778269941513683 * Cr + 0.00130872261408275 * Y + 0.000770482631801132 * k - 0.151051492775562) + Y * (0.00126935368114843 * Y - 0.00265090189010898 * k + 0.25802910206845) + k * (-0.000318913117588328 * k - 0.213742400323665);
- data[offset++] = -20.810012546947 + Cb * (-0.000570115196973677 * Cb - 2.63409051004589e-5 * Cr + 0.0020741088115012 * Y - 0.00288260236853442 * k + 0.814272968359295) + Cr * (-1.53496057440975e-5 * Cr - 0.000132689043961446 * Y + 0.000560833691242812 * k - 0.195152027534049) + Y * (0.00174418132927582 * Y - 0.00255243321439347 * k + 0.116935020465145) + k * (-0.000343531996510555 * k + 0.24165260232407);
- }
- return data.subarray(0, offset);
- },
- _convertYcckToCmyk: function convertYcckToCmyk(data) {
- var Y, Cb, Cr;
- for (var i = 0, length = data.length; i < length; i += 4) {
- Y = data[i];
- Cb = data[i + 1];
- Cr = data[i + 2];
- data[i] = 434.456 - Y - 1.402 * Cr;
- data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
- data[i + 2] = 481.816 - Y - 1.772 * Cb;
- }
- return data;
- },
- _convertCmykToRgb: function convertCmykToRgb(data) {
- var c, m, y, k;
- var offset = 0;
- var scale = 1 / 255;
- for (var i = 0, length = data.length; i < length; i += 4) {
- c = data[i] * scale;
- m = data[i + 1] * scale;
- y = data[i + 2] * scale;
- k = data[i + 3] * scale;
- data[offset++] = 255 + c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k - 285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y - 17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) - k * (21.86122147463605 * k + 189.48180835922747);
- data[offset++] = 255 + c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k - 79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) - k * (20.737325471181034 * k + 187.80453709719578);
- data[offset++] = 255 + c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k - 14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k - 193.58209356861505) - k * (22.33816807309886 * k + 180.12613974708367);
- }
- return data.subarray(0, offset);
- },
- getData: function getData(_ref3) {
- var width = _ref3.width,
- height = _ref3.height,
- _ref3$forceRGB = _ref3.forceRGB,
- forceRGB = _ref3$forceRGB === undefined ? false : _ref3$forceRGB,
- _ref3$isSourcePDF = _ref3.isSourcePDF,
- isSourcePDF = _ref3$isSourcePDF === undefined ? false : _ref3$isSourcePDF;
-
- if (this.numComponents > 4) {
- throw new JpegError('Unsupported color mode');
- }
- var data = this._getLinearizedBlockData(width, height, isSourcePDF);
- if (this.numComponents === 1 && forceRGB) {
- var dataLength = data.length;
- var rgbData = new Uint8ClampedArray(dataLength * 3);
- var offset = 0;
- for (var i = 0; i < dataLength; i++) {
- var grayColor = data[i];
- rgbData[offset++] = grayColor;
- rgbData[offset++] = grayColor;
- rgbData[offset++] = grayColor;
- }
- return rgbData;
- } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
- return this._convertYccToRgb(data);
- } else if (this.numComponents === 4) {
- if (this._isColorConversionNeeded) {
- if (forceRGB) {
- return this._convertYcckToRgb(data);
- }
- return this._convertYcckToCmyk(data);
- } else if (forceRGB) {
- return this._convertCmykToRgb(data);
- }
- }
- return data;
- }
- };
- return JpegImage;
-}();
-exports.JpegImage = JpegImage;
-
-/***/ }),
-/* 148 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.JpxStream = undefined;
-
-var _stream = __w_pdfjs_require__(140);
-
-var _jpx = __w_pdfjs_require__(149);
-
-var _util = __w_pdfjs_require__(2);
-
-var JpxStream = function JpxStreamClosure() {
- function JpxStream(stream, maybeLength, dict, params) {
- this.stream = stream;
- this.maybeLength = maybeLength;
- this.dict = dict;
- this.params = params;
- _stream.DecodeStream.call(this, maybeLength);
- }
- JpxStream.prototype = Object.create(_stream.DecodeStream.prototype);
- Object.defineProperty(JpxStream.prototype, 'bytes', {
- get: function JpxStream_bytes() {
- return (0, _util.shadow)(this, 'bytes', this.stream.getBytes(this.maybeLength));
- },
- configurable: true
- });
- JpxStream.prototype.ensureBuffer = function (requested) {};
- JpxStream.prototype.readBlock = function () {
- if (this.eof) {
- return;
- }
- var jpxImage = new _jpx.JpxImage();
- jpxImage.parse(this.bytes);
- var width = jpxImage.width;
- var height = jpxImage.height;
- var componentsCount = jpxImage.componentsCount;
- var tileCount = jpxImage.tiles.length;
- if (tileCount === 1) {
- this.buffer = jpxImage.tiles[0].items;
- } else {
- var data = new Uint8ClampedArray(width * height * componentsCount);
- for (var k = 0; k < tileCount; k++) {
- var tileComponents = jpxImage.tiles[k];
- var tileWidth = tileComponents.width;
- var tileHeight = tileComponents.height;
- var tileLeft = tileComponents.left;
- var tileTop = tileComponents.top;
- var src = tileComponents.items;
- var srcPosition = 0;
- var dataPosition = (width * tileTop + tileLeft) * componentsCount;
- var imgRowSize = width * componentsCount;
- var tileRowSize = tileWidth * componentsCount;
- for (var j = 0; j < tileHeight; j++) {
- var rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
- data.set(rowBytes, dataPosition);
- srcPosition += tileRowSize;
- dataPosition += imgRowSize;
- }
- }
- this.buffer = data;
- }
- this.bufferLength = this.buffer.length;
- this.eof = true;
- };
- return JpxStream;
-}();
-exports.JpxStream = JpxStream;
-
-/***/ }),
-/* 149 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.JpxImage = undefined;
-
-var _util = __w_pdfjs_require__(2);
-
-var _arithmetic_decoder = __w_pdfjs_require__(145);
-
-var JpxError = function JpxErrorClosure() {
- function JpxError(msg) {
- this.message = 'JPX error: ' + msg;
- }
- JpxError.prototype = new Error();
- JpxError.prototype.name = 'JpxError';
- JpxError.constructor = JpxError;
- return JpxError;
-}();
-var JpxImage = function JpxImageClosure() {
- var SubbandsGainLog2 = {
- 'LL': 0,
- 'LH': 1,
- 'HL': 1,
- 'HH': 2
- };
- function JpxImage() {
- this.failOnCorruptedImage = false;
- }
- JpxImage.prototype = {
- parse: function JpxImage_parse(data) {
- var head = (0, _util.readUint16)(data, 0);
- if (head === 0xFF4F) {
- this.parseCodestream(data, 0, data.length);
- return;
- }
- var position = 0,
- length = data.length;
- while (position < length) {
- var headerSize = 8;
- var lbox = (0, _util.readUint32)(data, position);
- var tbox = (0, _util.readUint32)(data, position + 4);
- position += headerSize;
- if (lbox === 1) {
- lbox = (0, _util.readUint32)(data, position) * 4294967296 + (0, _util.readUint32)(data, position + 4);
- position += 8;
- headerSize += 8;
- }
- if (lbox === 0) {
- lbox = length - position + headerSize;
- }
- if (lbox < headerSize) {
- throw new JpxError('Invalid box field size');
- }
- var dataLength = lbox - headerSize;
- var jumpDataLength = true;
- switch (tbox) {
- case 0x6A703268:
- jumpDataLength = false;
- break;
- case 0x636F6C72:
- var method = data[position];
- if (method === 1) {
- var colorspace = (0, _util.readUint32)(data, position + 3);
- switch (colorspace) {
- case 16:
- case 17:
- case 18:
- break;
- default:
- (0, _util.warn)('Unknown colorspace ' + colorspace);
- break;
- }
- } else if (method === 2) {
- (0, _util.info)('ICC profile not supported');
- }
- break;
- case 0x6A703263:
- this.parseCodestream(data, position, position + dataLength);
- break;
- case 0x6A502020:
- if ((0, _util.readUint32)(data, position) !== 0x0d0a870a) {
- (0, _util.warn)('Invalid JP2 signature');
- }
- break;
- case 0x6A501A1A:
- case 0x66747970:
- case 0x72726571:
- case 0x72657320:
- case 0x69686472:
- break;
- default:
- var headerType = String.fromCharCode(tbox >> 24 & 0xFF, tbox >> 16 & 0xFF, tbox >> 8 & 0xFF, tbox & 0xFF);
- (0, _util.warn)('Unsupported header type ' + tbox + ' (' + headerType + ')');
- break;
- }
- if (jumpDataLength) {
- position += dataLength;
- }
- }
- },
- parseImageProperties: function JpxImage_parseImageProperties(stream) {
- var newByte = stream.getByte();
- while (newByte >= 0) {
- var oldByte = newByte;
- newByte = stream.getByte();
- var code = oldByte << 8 | newByte;
- if (code === 0xFF51) {
- stream.skip(4);
- var Xsiz = stream.getInt32() >>> 0;
- var Ysiz = stream.getInt32() >>> 0;
- var XOsiz = stream.getInt32() >>> 0;
- var YOsiz = stream.getInt32() >>> 0;
- stream.skip(16);
- var Csiz = stream.getUint16();
- this.width = Xsiz - XOsiz;
- this.height = Ysiz - YOsiz;
- this.componentsCount = Csiz;
- this.bitsPerComponent = 8;
- return;
- }
- }
- throw new JpxError('No size marker found in JPX stream');
- },
- parseCodestream: function JpxImage_parseCodestream(data, start, end) {
- var context = {};
- var doNotRecover = false;
- try {
- var position = start;
- while (position + 1 < end) {
- var code = (0, _util.readUint16)(data, position);
- position += 2;
- var length = 0,
- j,
- sqcd,
- spqcds,
- spqcdSize,
- scalarExpounded,
- tile;
- switch (code) {
- case 0xFF4F:
- context.mainHeader = true;
- break;
- case 0xFFD9:
- break;
- case 0xFF51:
- length = (0, _util.readUint16)(data, position);
- var siz = {};
- siz.Xsiz = (0, _util.readUint32)(data, position + 4);
- siz.Ysiz = (0, _util.readUint32)(data, position + 8);
- siz.XOsiz = (0, _util.readUint32)(data, position + 12);
- siz.YOsiz = (0, _util.readUint32)(data, position + 16);
- siz.XTsiz = (0, _util.readUint32)(data, position + 20);
- siz.YTsiz = (0, _util.readUint32)(data, position + 24);
- siz.XTOsiz = (0, _util.readUint32)(data, position + 28);
- siz.YTOsiz = (0, _util.readUint32)(data, position + 32);
- var componentsCount = (0, _util.readUint16)(data, position + 36);
- siz.Csiz = componentsCount;
- var components = [];
- j = position + 38;
- for (var i = 0; i < componentsCount; i++) {
- var component = {
- precision: (data[j] & 0x7F) + 1,
- isSigned: !!(data[j] & 0x80),
- XRsiz: data[j + 1],
- YRsiz: data[j + 2]
- };
- j += 3;
- calculateComponentDimensions(component, siz);
- components.push(component);
- }
- context.SIZ = siz;
- context.components = components;
- calculateTileGrids(context, components);
- context.QCC = [];
- context.COC = [];
- break;
- case 0xFF5C:
- length = (0, _util.readUint16)(data, position);
- var qcd = {};
- j = position + 2;
- sqcd = data[j++];
- switch (sqcd & 0x1F) {
- case 0:
- spqcdSize = 8;
- scalarExpounded = true;
- break;
- case 1:
- spqcdSize = 16;
- scalarExpounded = false;
- break;
- case 2:
- spqcdSize = 16;
- scalarExpounded = true;
- break;
- default:
- throw new Error('Invalid SQcd value ' + sqcd);
- }
- qcd.noQuantization = spqcdSize === 8;
- qcd.scalarExpounded = scalarExpounded;
- qcd.guardBits = sqcd >> 5;
- spqcds = [];
- while (j < length + position) {
- var spqcd = {};
- if (spqcdSize === 8) {
- spqcd.epsilon = data[j++] >> 3;
- spqcd.mu = 0;
- } else {
- spqcd.epsilon = data[j] >> 3;
- spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
- j += 2;
- }
- spqcds.push(spqcd);
- }
- qcd.SPqcds = spqcds;
- if (context.mainHeader) {
- context.QCD = qcd;
- } else {
- context.currentTile.QCD = qcd;
- context.currentTile.QCC = [];
- }
- break;
- case 0xFF5D:
- length = (0, _util.readUint16)(data, position);
- var qcc = {};
- j = position + 2;
- var cqcc;
- if (context.SIZ.Csiz < 257) {
- cqcc = data[j++];
- } else {
- cqcc = (0, _util.readUint16)(data, j);
- j += 2;
- }
- sqcd = data[j++];
- switch (sqcd & 0x1F) {
- case 0:
- spqcdSize = 8;
- scalarExpounded = true;
- break;
- case 1:
- spqcdSize = 16;
- scalarExpounded = false;
- break;
- case 2:
- spqcdSize = 16;
- scalarExpounded = true;
- break;
- default:
- throw new Error('Invalid SQcd value ' + sqcd);
- }
- qcc.noQuantization = spqcdSize === 8;
- qcc.scalarExpounded = scalarExpounded;
- qcc.guardBits = sqcd >> 5;
- spqcds = [];
- while (j < length + position) {
- spqcd = {};
- if (spqcdSize === 8) {
- spqcd.epsilon = data[j++] >> 3;
- spqcd.mu = 0;
- } else {
- spqcd.epsilon = data[j] >> 3;
- spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
- j += 2;
- }
- spqcds.push(spqcd);
- }
- qcc.SPqcds = spqcds;
- if (context.mainHeader) {
- context.QCC[cqcc] = qcc;
- } else {
- context.currentTile.QCC[cqcc] = qcc;
- }
- break;
- case 0xFF52:
- length = (0, _util.readUint16)(data, position);
- var cod = {};
- j = position + 2;
- var scod = data[j++];
- cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
- cod.sopMarkerUsed = !!(scod & 2);
- cod.ephMarkerUsed = !!(scod & 4);
- cod.progressionOrder = data[j++];
- cod.layersCount = (0, _util.readUint16)(data, j);
- j += 2;
- cod.multipleComponentTransform = data[j++];
- cod.decompositionLevelsCount = data[j++];
- cod.xcb = (data[j++] & 0xF) + 2;
- cod.ycb = (data[j++] & 0xF) + 2;
- var blockStyle = data[j++];
- cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
- cod.resetContextProbabilities = !!(blockStyle & 2);
- cod.terminationOnEachCodingPass = !!(blockStyle & 4);
- cod.verticallyStripe = !!(blockStyle & 8);
- cod.predictableTermination = !!(blockStyle & 16);
- cod.segmentationSymbolUsed = !!(blockStyle & 32);
- cod.reversibleTransformation = data[j++];
- if (cod.entropyCoderWithCustomPrecincts) {
- var precinctsSizes = [];
- while (j < length + position) {
- var precinctsSize = data[j++];
- precinctsSizes.push({
- PPx: precinctsSize & 0xF,
- PPy: precinctsSize >> 4
- });
- }
- cod.precinctsSizes = precinctsSizes;
- }
- var unsupported = [];
- if (cod.selectiveArithmeticCodingBypass) {
- unsupported.push('selectiveArithmeticCodingBypass');
- }
- if (cod.resetContextProbabilities) {
- unsupported.push('resetContextProbabilities');
- }
- if (cod.terminationOnEachCodingPass) {
- unsupported.push('terminationOnEachCodingPass');
- }
- if (cod.verticallyStripe) {
- unsupported.push('verticallyStripe');
- }
- if (cod.predictableTermination) {
- unsupported.push('predictableTermination');
- }
- if (unsupported.length > 0) {
- doNotRecover = true;
- throw new Error('Unsupported COD options (' + unsupported.join(', ') + ')');
- }
- if (context.mainHeader) {
- context.COD = cod;
- } else {
- context.currentTile.COD = cod;
- context.currentTile.COC = [];
- }
- break;
- case 0xFF90:
- length = (0, _util.readUint16)(data, position);
- tile = {};
- tile.index = (0, _util.readUint16)(data, position + 2);
- tile.length = (0, _util.readUint32)(data, position + 4);
- tile.dataEnd = tile.length + position - 2;
- tile.partIndex = data[position + 8];
- tile.partsCount = data[position + 9];
- context.mainHeader = false;
- if (tile.partIndex === 0) {
- tile.COD = context.COD;
- tile.COC = context.COC.slice(0);
- tile.QCD = context.QCD;
- tile.QCC = context.QCC.slice(0);
- }
- context.currentTile = tile;
- break;
- case 0xFF93:
- tile = context.currentTile;
- if (tile.partIndex === 0) {
- initializeTile(context, tile.index);
- buildPackets(context);
- }
- length = tile.dataEnd - position;
- parseTilePackets(context, data, position, length);
- break;
- case 0xFF55:
- case 0xFF57:
- case 0xFF58:
- case 0xFF64:
- length = (0, _util.readUint16)(data, position);
- break;
- case 0xFF53:
- throw new Error('Codestream code 0xFF53 (COC) is ' + 'not implemented');
- default:
- throw new Error('Unknown codestream code: ' + code.toString(16));
- }
- position += length;
- }
- } catch (e) {
- if (doNotRecover || this.failOnCorruptedImage) {
- throw new JpxError(e.message);
- } else {
- (0, _util.warn)('JPX: Trying to recover from: ' + e.message);
- }
- }
- this.tiles = transformComponents(context);
- this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
- this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
- this.componentsCount = context.SIZ.Csiz;
- }
- };
- function calculateComponentDimensions(component, siz) {
- component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
- component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
- component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
- component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
- component.width = component.x1 - component.x0;
- component.height = component.y1 - component.y0;
- }
- function calculateTileGrids(context, components) {
- var siz = context.SIZ;
- var tile,
- tiles = [];
- var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
- var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
- for (var q = 0; q < numYtiles; q++) {
- for (var p = 0; p < numXtiles; p++) {
- tile = {};
- tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
- tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
- tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
- tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
- tile.width = tile.tx1 - tile.tx0;
- tile.height = tile.ty1 - tile.ty0;
- tile.components = [];
- tiles.push(tile);
- }
- }
- context.tiles = tiles;
- var componentsCount = siz.Csiz;
- for (var i = 0, ii = componentsCount; i < ii; i++) {
- var component = components[i];
- for (var j = 0, jj = tiles.length; j < jj; j++) {
- var tileComponent = {};
- tile = tiles[j];
- tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
- tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
- tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
- tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
- tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
- tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
- tile.components[i] = tileComponent;
- }
- }
- }
- function getBlocksDimensions(context, component, r) {
- var codOrCoc = component.codingStyleParameters;
- var result = {};
- if (!codOrCoc.entropyCoderWithCustomPrecincts) {
- result.PPx = 15;
- result.PPy = 15;
- } else {
- result.PPx = codOrCoc.precinctsSizes[r].PPx;
- result.PPy = codOrCoc.precinctsSizes[r].PPy;
- }
- result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
- result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
- return result;
- }
- function buildPrecincts(context, resolution, dimensions) {
- var precinctWidth = 1 << dimensions.PPx;
- var precinctHeight = 1 << dimensions.PPy;
- var isZeroRes = resolution.resLevel === 0;
- var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
- var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
- var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
- var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
- var numprecincts = numprecinctswide * numprecinctshigh;
- resolution.precinctParameters = {
- precinctWidth: precinctWidth,
- precinctHeight: precinctHeight,
- numprecinctswide: numprecinctswide,
- numprecinctshigh: numprecinctshigh,
- numprecincts: numprecincts,
- precinctWidthInSubband: precinctWidthInSubband,
- precinctHeightInSubband: precinctHeightInSubband
- };
- }
- function buildCodeblocks(context, subband, dimensions) {
- var xcb_ = dimensions.xcb_;
- var ycb_ = dimensions.ycb_;
- var codeblockWidth = 1 << xcb_;
- var codeblockHeight = 1 << ycb_;
- var cbx0 = subband.tbx0 >> xcb_;
- var cby0 = subband.tby0 >> ycb_;
- var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
- var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
- var precinctParameters = subband.resolution.precinctParameters;
- var codeblocks = [];
- var precincts = [];
- var i, j, codeblock, precinctNumber;
- for (j = cby0; j < cby1; j++) {
- for (i = cbx0; i < cbx1; i++) {
- codeblock = {
- cbx: i,
- cby: j,
- tbx0: codeblockWidth * i,
- tby0: codeblockHeight * j,
- tbx1: codeblockWidth * (i + 1),
- tby1: codeblockHeight * (j + 1)
- };
- codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
- codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
- codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
- codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
- var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
- var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
- precinctNumber = pi + pj * precinctParameters.numprecinctswide;
- codeblock.precinctNumber = precinctNumber;
- codeblock.subbandType = subband.type;
- codeblock.Lblock = 3;
- if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
- continue;
- }
- codeblocks.push(codeblock);
- var precinct = precincts[precinctNumber];
- if (precinct !== undefined) {
- if (i < precinct.cbxMin) {
- precinct.cbxMin = i;
- } else if (i > precinct.cbxMax) {
- precinct.cbxMax = i;
- }
- if (j < precinct.cbyMin) {
- precinct.cbxMin = j;
- } else if (j > precinct.cbyMax) {
- precinct.cbyMax = j;
- }
- } else {
- precincts[precinctNumber] = precinct = {
- cbxMin: i,
- cbyMin: j,
- cbxMax: i,
- cbyMax: j
- };
- }
- codeblock.precinct = precinct;
- }
- }
- subband.codeblockParameters = {
- codeblockWidth: xcb_,
- codeblockHeight: ycb_,
- numcodeblockwide: cbx1 - cbx0 + 1,
- numcodeblockhigh: cby1 - cby0 + 1
- };
- subband.codeblocks = codeblocks;
- subband.precincts = precincts;
- }
- function createPacket(resolution, precinctNumber, layerNumber) {
- var precinctCodeblocks = [];
- var subbands = resolution.subbands;
- for (var i = 0, ii = subbands.length; i < ii; i++) {
- var subband = subbands[i];
- var codeblocks = subband.codeblocks;
- for (var j = 0, jj = codeblocks.length; j < jj; j++) {
- var codeblock = codeblocks[j];
- if (codeblock.precinctNumber !== precinctNumber) {
- continue;
- }
- precinctCodeblocks.push(codeblock);
- }
- }
- return {
- layerNumber: layerNumber,
- codeblocks: precinctCodeblocks
- };
- }
- function LayerResolutionComponentPositionIterator(context) {
- var siz = context.SIZ;
- var tileIndex = context.currentTile.index;
- var tile = context.tiles[tileIndex];
- var layersCount = tile.codingStyleDefaultParameters.layersCount;
- var componentsCount = siz.Csiz;
- var maxDecompositionLevelsCount = 0;
- for (var q = 0; q < componentsCount; q++) {
- maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
- }
- var l = 0,
- r = 0,
- i = 0,
- k = 0;
- this.nextPacket = function JpxImage_nextPacket() {
- for (; l < layersCount; l++) {
- for (; r <= maxDecompositionLevelsCount; r++) {
- for (; i < componentsCount; i++) {
- var component = tile.components[i];
- if (r > component.codingStyleParameters.decompositionLevelsCount) {
- continue;
- }
- var resolution = component.resolutions[r];
- var numprecincts = resolution.precinctParameters.numprecincts;
- for (; k < numprecincts;) {
- var packet = createPacket(resolution, k, l);
- k++;
- return packet;
- }
- k = 0;
- }
- i = 0;
- }
- r = 0;
- }
- throw new JpxError('Out of packets');
- };
- }
- function ResolutionLayerComponentPositionIterator(context) {
- var siz = context.SIZ;
- var tileIndex = context.currentTile.index;
- var tile = context.tiles[tileIndex];
- var layersCount = tile.codingStyleDefaultParameters.layersCount;
- var componentsCount = siz.Csiz;
- var maxDecompositionLevelsCount = 0;
- for (var q = 0; q < componentsCount; q++) {
- maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
- }
- var r = 0,
- l = 0,
- i = 0,
- k = 0;
- this.nextPacket = function JpxImage_nextPacket() {
- for (; r <= maxDecompositionLevelsCount; r++) {
- for (; l < layersCount; l++) {
- for (; i < componentsCount; i++) {
- var component = tile.components[i];
- if (r > component.codingStyleParameters.decompositionLevelsCount) {
- continue;
- }
- var resolution = component.resolutions[r];
- var numprecincts = resolution.precinctParameters.numprecincts;
- for (; k < numprecincts;) {
- var packet = createPacket(resolution, k, l);
- k++;
- return packet;
- }
- k = 0;
- }
- i = 0;
- }
- l = 0;
- }
- throw new JpxError('Out of packets');
- };
- }
- function ResolutionPositionComponentLayerIterator(context) {
- var siz = context.SIZ;
- var tileIndex = context.currentTile.index;
- var tile = context.tiles[tileIndex];
- var layersCount = tile.codingStyleDefaultParameters.layersCount;
- var componentsCount = siz.Csiz;
- var l, r, c, p;
- var maxDecompositionLevelsCount = 0;
- for (c = 0; c < componentsCount; c++) {
- var component = tile.components[c];
- maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
- }
- var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
- for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
- var maxNumPrecincts = 0;
- for (c = 0; c < componentsCount; ++c) {
- var resolutions = tile.components[c].resolutions;
- if (r < resolutions.length) {
- maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
- }
- }
- maxNumPrecinctsInLevel[r] = maxNumPrecincts;
- }
- l = 0;
- r = 0;
- c = 0;
- p = 0;
- this.nextPacket = function JpxImage_nextPacket() {
- for (; r <= maxDecompositionLevelsCount; r++) {
- for (; p < maxNumPrecinctsInLevel[r]; p++) {
- for (; c < componentsCount; c++) {
- var component = tile.components[c];
- if (r > component.codingStyleParameters.decompositionLevelsCount) {
- continue;
- }
- var resolution = component.resolutions[r];
- var numprecincts = resolution.precinctParameters.numprecincts;
- if (p >= numprecincts) {
- continue;
- }
- for (; l < layersCount;) {
- var packet = createPacket(resolution, p, l);
- l++;
- return packet;
- }
- l = 0;
- }
- c = 0;
- }
- p = 0;
- }
- throw new JpxError('Out of packets');
- };
- }
- function PositionComponentResolutionLayerIterator(context) {
- var siz = context.SIZ;
- var tileIndex = context.currentTile.index;
- var tile = context.tiles[tileIndex];
- var layersCount = tile.codingStyleDefaultParameters.layersCount;
- var componentsCount = siz.Csiz;
- var precinctsSizes = getPrecinctSizesInImageScale(tile);
- var precinctsIterationSizes = precinctsSizes;
- var l = 0,
- r = 0,
- c = 0,
- px = 0,
- py = 0;
- this.nextPacket = function JpxImage_nextPacket() {
- for (; py < precinctsIterationSizes.maxNumHigh; py++) {
- for (; px < precinctsIterationSizes.maxNumWide; px++) {
- for (; c < componentsCount; c++) {
- var component = tile.components[c];
- var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
- for (; r <= decompositionLevelsCount; r++) {
- var resolution = component.resolutions[r];
- var sizeInImageScale = precinctsSizes.components[c].resolutions[r];
- var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
- if (k === null) {
- continue;
- }
- for (; l < layersCount;) {
- var packet = createPacket(resolution, k, l);
- l++;
- return packet;
- }
- l = 0;
- }
- r = 0;
- }
- c = 0;
- }
- px = 0;
- }
- throw new JpxError('Out of packets');
- };
- }
- function ComponentPositionResolutionLayerIterator(context) {
- var siz = context.SIZ;
- var tileIndex = context.currentTile.index;
- var tile = context.tiles[tileIndex];
- var layersCount = tile.codingStyleDefaultParameters.layersCount;
- var componentsCount = siz.Csiz;
- var precinctsSizes = getPrecinctSizesInImageScale(tile);
- var l = 0,
- r = 0,
- c = 0,
- px = 0,
- py = 0;
- this.nextPacket = function JpxImage_nextPacket() {
- for (; c < componentsCount; ++c) {
- var component = tile.components[c];
- var precinctsIterationSizes = precinctsSizes.components[c];
- var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
- for (; py < precinctsIterationSizes.maxNumHigh; py++) {
- for (; px < precinctsIterationSizes.maxNumWide; px++) {
- for (; r <= decompositionLevelsCount; r++) {
- var resolution = component.resolutions[r];
- var sizeInImageScale = precinctsIterationSizes.resolutions[r];
- var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
- if (k === null) {
- continue;
- }
- for (; l < layersCount;) {
- var packet = createPacket(resolution, k, l);
- l++;
- return packet;
- }
- l = 0;
- }
- r = 0;
- }
- px = 0;
- }
- py = 0;
- }
- throw new JpxError('Out of packets');
- };
- }
- function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
- var posX = pxIndex * precinctIterationSizes.minWidth;
- var posY = pyIndex * precinctIterationSizes.minHeight;
- if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
- return null;
- }
- var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
- return posX / sizeInImageScale.height + startPrecinctRowIndex;
- }
- function getPrecinctSizesInImageScale(tile) {
- var componentsCount = tile.components.length;
- var minWidth = Number.MAX_VALUE;
- var minHeight = Number.MAX_VALUE;
- var maxNumWide = 0;
- var maxNumHigh = 0;
- var sizePerComponent = new Array(componentsCount);
- for (var c = 0; c < componentsCount; c++) {
- var component = tile.components[c];
- var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
- var sizePerResolution = new Array(decompositionLevelsCount + 1);
- var minWidthCurrentComponent = Number.MAX_VALUE;
- var minHeightCurrentComponent = Number.MAX_VALUE;
- var maxNumWideCurrentComponent = 0;
- var maxNumHighCurrentComponent = 0;
- var scale = 1;
- for (var r = decompositionLevelsCount; r >= 0; --r) {
- var resolution = component.resolutions[r];
- var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
- var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
- minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
- minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
- maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
- maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
- sizePerResolution[r] = {
- width: widthCurrentResolution,
- height: heightCurrentResolution
- };
- scale <<= 1;
- }
- minWidth = Math.min(minWidth, minWidthCurrentComponent);
- minHeight = Math.min(minHeight, minHeightCurrentComponent);
- maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
- maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
- sizePerComponent[c] = {
- resolutions: sizePerResolution,
- minWidth: minWidthCurrentComponent,
- minHeight: minHeightCurrentComponent,
- maxNumWide: maxNumWideCurrentComponent,
- maxNumHigh: maxNumHighCurrentComponent
- };
- }
- return {
- components: sizePerComponent,
- minWidth: minWidth,
- minHeight: minHeight,
- maxNumWide: maxNumWide,
- maxNumHigh: maxNumHigh
- };
- }
- function buildPackets(context) {
- var siz = context.SIZ;
- var tileIndex = context.currentTile.index;
- var tile = context.tiles[tileIndex];
- var componentsCount = siz.Csiz;
- for (var c = 0; c < componentsCount; c++) {
- var component = tile.components[c];
- var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
- var resolutions = [];
- var subbands = [];
- for (var r = 0; r <= decompositionLevelsCount; r++) {
- var blocksDimensions = getBlocksDimensions(context, component, r);
- var resolution = {};
- var scale = 1 << decompositionLevelsCount - r;
- resolution.trx0 = Math.ceil(component.tcx0 / scale);
- resolution.try0 = Math.ceil(component.tcy0 / scale);
- resolution.trx1 = Math.ceil(component.tcx1 / scale);
- resolution.try1 = Math.ceil(component.tcy1 / scale);
- resolution.resLevel = r;
- buildPrecincts(context, resolution, blocksDimensions);
- resolutions.push(resolution);
- var subband;
- if (r === 0) {
- subband = {};
- subband.type = 'LL';
- subband.tbx0 = Math.ceil(component.tcx0 / scale);
- subband.tby0 = Math.ceil(component.tcy0 / scale);
- subband.tbx1 = Math.ceil(component.tcx1 / scale);
- subband.tby1 = Math.ceil(component.tcy1 / scale);
- subband.resolution = resolution;
- buildCodeblocks(context, subband, blocksDimensions);
- subbands.push(subband);
- resolution.subbands = [subband];
- } else {
- var bscale = 1 << decompositionLevelsCount - r + 1;
- var resolutionSubbands = [];
- subband = {};
- subband.type = 'HL';
- subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
- subband.tby0 = Math.ceil(component.tcy0 / bscale);
- subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
- subband.tby1 = Math.ceil(component.tcy1 / bscale);
- subband.resolution = resolution;
- buildCodeblocks(context, subband, blocksDimensions);
- subbands.push(subband);
- resolutionSubbands.push(subband);
- subband = {};
- subband.type = 'LH';
- subband.tbx0 = Math.ceil(component.tcx0 / bscale);
- subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
- subband.tbx1 = Math.ceil(component.tcx1 / bscale);
- subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
- subband.resolution = resolution;
- buildCodeblocks(context, subband, blocksDimensions);
- subbands.push(subband);
- resolutionSubbands.push(subband);
- subband = {};
- subband.type = 'HH';
- subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
- subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
- subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
- subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
- subband.resolution = resolution;
- buildCodeblocks(context, subband, blocksDimensions);
- subbands.push(subband);
- resolutionSubbands.push(subband);
- resolution.subbands = resolutionSubbands;
- }
- }
- component.resolutions = resolutions;
- component.subbands = subbands;
- }
- var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
- switch (progressionOrder) {
- case 0:
- tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
- break;
- case 1:
- tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
- break;
- case 2:
- tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
- break;
- case 3:
- tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
- break;
- case 4:
- tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
- break;
- default:
- throw new JpxError('Unsupported progression order ' + progressionOrder);
- }
- }
- function parseTilePackets(context, data, offset, dataLength) {
- var position = 0;
- var buffer,
- bufferSize = 0,
- skipNextBit = false;
- function readBits(count) {
- while (bufferSize < count) {
- var b = data[offset + position];
- position++;
- if (skipNextBit) {
- buffer = buffer << 7 | b;
- bufferSize += 7;
- skipNextBit = false;
- } else {
- buffer = buffer << 8 | b;
- bufferSize += 8;
- }
- if (b === 0xFF) {
- skipNextBit = true;
- }
- }
- bufferSize -= count;
- return buffer >>> bufferSize & (1 << count) - 1;
- }
- function skipMarkerIfEqual(value) {
- if (data[offset + position - 1] === 0xFF && data[offset + position] === value) {
- skipBytes(1);
- return true;
- } else if (data[offset + position] === 0xFF && data[offset + position + 1] === value) {
- skipBytes(2);
- return true;
- }
- return false;
- }
- function skipBytes(count) {
- position += count;
- }
- function alignToByte() {
- bufferSize = 0;
- if (skipNextBit) {
- position++;
- skipNextBit = false;
- }
- }
- function readCodingpasses() {
- if (readBits(1) === 0) {
- return 1;
- }
- if (readBits(1) === 0) {
- return 2;
- }
- var value = readBits(2);
- if (value < 3) {
- return value + 3;
- }
- value = readBits(5);
- if (value < 31) {
- return value + 6;
- }
- value = readBits(7);
- return value + 37;
- }
- var tileIndex = context.currentTile.index;
- var tile = context.tiles[tileIndex];
- var sopMarkerUsed = context.COD.sopMarkerUsed;
- var ephMarkerUsed = context.COD.ephMarkerUsed;
- var packetsIterator = tile.packetsIterator;
- while (position < dataLength) {
- alignToByte();
- if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
- skipBytes(4);
- }
- var packet = packetsIterator.nextPacket();
- if (!readBits(1)) {
- continue;
- }
- var layerNumber = packet.layerNumber;
- var queue = [],
- codeblock;
- for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) {
- codeblock = packet.codeblocks[i];
- var precinct = codeblock.precinct;
- var codeblockColumn = codeblock.cbx - precinct.cbxMin;
- var codeblockRow = codeblock.cby - precinct.cbyMin;
- var codeblockIncluded = false;
- var firstTimeInclusion = false;
- var valueReady;
- if (codeblock['included'] !== undefined) {
- codeblockIncluded = !!readBits(1);
- } else {
- precinct = codeblock.precinct;
- var inclusionTree, zeroBitPlanesTree;
- if (precinct['inclusionTree'] !== undefined) {
- inclusionTree = precinct.inclusionTree;
- } else {
- var width = precinct.cbxMax - precinct.cbxMin + 1;
- var height = precinct.cbyMax - precinct.cbyMin + 1;
- inclusionTree = new InclusionTree(width, height, layerNumber);
- zeroBitPlanesTree = new TagTree(width, height);
- precinct.inclusionTree = inclusionTree;
- precinct.zeroBitPlanesTree = zeroBitPlanesTree;
- }
- if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
- while (true) {
- if (readBits(1)) {
- valueReady = !inclusionTree.nextLevel();
- if (valueReady) {
- codeblock.included = true;
- codeblockIncluded = firstTimeInclusion = true;
- break;
- }
- } else {
- inclusionTree.incrementValue(layerNumber);
- break;
- }
- }
- }
- }
- if (!codeblockIncluded) {
- continue;
- }
- if (firstTimeInclusion) {
- zeroBitPlanesTree = precinct.zeroBitPlanesTree;
- zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
- while (true) {
- if (readBits(1)) {
- valueReady = !zeroBitPlanesTree.nextLevel();
- if (valueReady) {
- break;
- }
- } else {
- zeroBitPlanesTree.incrementValue();
- }
- }
- codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
- }
- var codingpasses = readCodingpasses();
- while (readBits(1)) {
- codeblock.Lblock++;
- }
- var codingpassesLog2 = (0, _util.log2)(codingpasses);
- var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
- var codedDataLength = readBits(bits);
- queue.push({
- codeblock: codeblock,
- codingpasses: codingpasses,
- dataLength: codedDataLength
- });
- }
- alignToByte();
- if (ephMarkerUsed) {
- skipMarkerIfEqual(0x92);
- }
- while (queue.length > 0) {
- var packetItem = queue.shift();
- codeblock = packetItem.codeblock;
- if (codeblock['data'] === undefined) {
- codeblock.data = [];
- }
- codeblock.data.push({
- data: data,
- start: offset + position,
- end: offset + position + packetItem.dataLength,
- codingpasses: packetItem.codingpasses
- });
- position += packetItem.dataLength;
- }
- }
- return position;
- }
- function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
- var x0 = subband.tbx0;
- var y0 = subband.tby0;
- var width = subband.tbx1 - subband.tbx0;
- var codeblocks = subband.codeblocks;
- var right = subband.type.charAt(0) === 'H' ? 1 : 0;
- var bottom = subband.type.charAt(1) === 'H' ? levelWidth : 0;
- for (var i = 0, ii = codeblocks.length; i < ii; ++i) {
- var codeblock = codeblocks[i];
- var blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
- var blockHeight = codeblock.tby1_ - codeblock.tby0_;
- if (blockWidth === 0 || blockHeight === 0) {
- continue;
- }
- if (codeblock['data'] === undefined) {
- continue;
- }
- var bitModel, currentCodingpassType;
- bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
- currentCodingpassType = 2;
- var data = codeblock.data,
- totalLength = 0,
- codingpasses = 0;
- var j, jj, dataItem;
- for (j = 0, jj = data.length; j < jj; j++) {
- dataItem = data[j];
- totalLength += dataItem.end - dataItem.start;
- codingpasses += dataItem.codingpasses;
- }
- var encodedData = new Uint8Array(totalLength);
- var position = 0;
- for (j = 0, jj = data.length; j < jj; j++) {
- dataItem = data[j];
- var chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
- encodedData.set(chunk, position);
- position += chunk.length;
- }
- var decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
- bitModel.setDecoder(decoder);
- for (j = 0; j < codingpasses; j++) {
- switch (currentCodingpassType) {
- case 0:
- bitModel.runSignificancePropagationPass();
- break;
- case 1:
- bitModel.runMagnitudeRefinementPass();
- break;
- case 2:
- bitModel.runCleanupPass();
- if (segmentationSymbolUsed) {
- bitModel.checkSegmentationSymbol();
- }
- break;
- }
- currentCodingpassType = (currentCodingpassType + 1) % 3;
- }
- var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
- var sign = bitModel.coefficentsSign;
- var magnitude = bitModel.coefficentsMagnitude;
- var bitsDecoded = bitModel.bitsDecoded;
- var magnitudeCorrection = reversible ? 0 : 0.5;
- var k, n, nb;
- position = 0;
- var interleave = subband.type !== 'LL';
- for (j = 0; j < blockHeight; j++) {
- var row = offset / width | 0;
- var levelOffset = 2 * row * (levelWidth - width) + right + bottom;
- for (k = 0; k < blockWidth; k++) {
- n = magnitude[position];
- if (n !== 0) {
- n = (n + magnitudeCorrection) * delta;
- if (sign[position] !== 0) {
- n = -n;
- }
- nb = bitsDecoded[position];
- var pos = interleave ? levelOffset + (offset << 1) : offset;
- if (reversible && nb >= mb) {
- coefficients[pos] = n;
- } else {
- coefficients[pos] = n * (1 << mb - nb);
- }
- }
- offset++;
- position++;
- }
- offset += width - blockWidth;
- }
- }
- }
- function transformTile(context, tile, c) {
- var component = tile.components[c];
- var codingStyleParameters = component.codingStyleParameters;
- var quantizationParameters = component.quantizationParameters;
- var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
- var spqcds = quantizationParameters.SPqcds;
- var scalarExpounded = quantizationParameters.scalarExpounded;
- var guardBits = quantizationParameters.guardBits;
- var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
- var precision = context.components[c].precision;
- var reversible = codingStyleParameters.reversibleTransformation;
- var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
- var subbandCoefficients = [];
- var b = 0;
- for (var i = 0; i <= decompositionLevelsCount; i++) {
- var resolution = component.resolutions[i];
- var width = resolution.trx1 - resolution.trx0;
- var height = resolution.try1 - resolution.try0;
- var coefficients = new Float32Array(width * height);
- for (var j = 0, jj = resolution.subbands.length; j < jj; j++) {
- var mu, epsilon;
- if (!scalarExpounded) {
- mu = spqcds[0].mu;
- epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
- } else {
- mu = spqcds[b].mu;
- epsilon = spqcds[b].epsilon;
- b++;
- }
- var subband = resolution.subbands[j];
- var gainLog2 = SubbandsGainLog2[subband.type];
- var delta = reversible ? 1 : Math.pow(2, precision + gainLog2 - epsilon) * (1 + mu / 2048);
- var mb = guardBits + epsilon - 1;
- copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
- }
- subbandCoefficients.push({
- width: width,
- height: height,
- items: coefficients
- });
- }
- var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
- return {
- left: component.tcx0,
- top: component.tcy0,
- width: result.width,
- height: result.height,
- items: result.items
- };
- }
- function transformComponents(context) {
- var siz = context.SIZ;
- var components = context.components;
- var componentsCount = siz.Csiz;
- var resultImages = [];
- for (var i = 0, ii = context.tiles.length; i < ii; i++) {
- var tile = context.tiles[i];
- var transformedTiles = [];
- var c;
- for (c = 0; c < componentsCount; c++) {
- transformedTiles[c] = transformTile(context, tile, c);
- }
- var tile0 = transformedTiles[0];
- var out = new Uint8ClampedArray(tile0.items.length * componentsCount);
- var result = {
- left: tile0.left,
- top: tile0.top,
- width: tile0.width,
- height: tile0.height,
- items: out
- };
- var shift, offset;
- var pos = 0,
- j,
- jj,
- y0,
- y1,
- y2;
- if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
- var fourComponents = componentsCount === 4;
- var y0items = transformedTiles[0].items;
- var y1items = transformedTiles[1].items;
- var y2items = transformedTiles[2].items;
- var y3items = fourComponents ? transformedTiles[3].items : null;
- shift = components[0].precision - 8;
- offset = (128 << shift) + 0.5;
- var component0 = tile.components[0];
- var alpha01 = componentsCount - 3;
- jj = y0items.length;
- if (!component0.codingStyleParameters.reversibleTransformation) {
- for (j = 0; j < jj; j++, pos += alpha01) {
- y0 = y0items[j] + offset;
- y1 = y1items[j];
- y2 = y2items[j];
- out[pos++] = y0 + 1.402 * y2 >> shift;
- out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
- out[pos++] = y0 + 1.772 * y1 >> shift;
- }
- } else {
- for (j = 0; j < jj; j++, pos += alpha01) {
- y0 = y0items[j] + offset;
- y1 = y1items[j];
- y2 = y2items[j];
- var g = y0 - (y2 + y1 >> 2);
- out[pos++] = g + y2 >> shift;
- out[pos++] = g >> shift;
- out[pos++] = g + y1 >> shift;
- }
- }
- if (fourComponents) {
- for (j = 0, pos = 3; j < jj; j++, pos += 4) {
- out[pos] = y3items[j] + offset >> shift;
- }
- }
- } else {
- for (c = 0; c < componentsCount; c++) {
- var items = transformedTiles[c].items;
- shift = components[c].precision - 8;
- offset = (128 << shift) + 0.5;
- for (pos = c, j = 0, jj = items.length; j < jj; j++) {
- out[pos] = items[j] + offset >> shift;
- pos += componentsCount;
- }
- }
- }
- resultImages.push(result);
- }
- return resultImages;
- }
- function initializeTile(context, tileIndex) {
- var siz = context.SIZ;
- var componentsCount = siz.Csiz;
- var tile = context.tiles[tileIndex];
- for (var c = 0; c < componentsCount; c++) {
- var component = tile.components[c];
- var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
- component.quantizationParameters = qcdOrQcc;
- var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
- component.codingStyleParameters = codOrCoc;
- }
- tile.codingStyleDefaultParameters = context.currentTile.COD;
- }
- var TagTree = function TagTreeClosure() {
- function TagTree(width, height) {
- var levelsLength = (0, _util.log2)(Math.max(width, height)) + 1;
- this.levels = [];
- for (var i = 0; i < levelsLength; i++) {
- var level = {
- width: width,
- height: height,
- items: []
- };
- this.levels.push(level);
- width = Math.ceil(width / 2);
- height = Math.ceil(height / 2);
- }
- }
- TagTree.prototype = {
- reset: function TagTree_reset(i, j) {
- var currentLevel = 0,
- value = 0,
- level;
- while (currentLevel < this.levels.length) {
- level = this.levels[currentLevel];
- var index = i + j * level.width;
- if (level.items[index] !== undefined) {
- value = level.items[index];
- break;
- }
- level.index = index;
- i >>= 1;
- j >>= 1;
- currentLevel++;
- }
- currentLevel--;
- level = this.levels[currentLevel];
- level.items[level.index] = value;
- this.currentLevel = currentLevel;
- delete this.value;
- },
- incrementValue: function TagTree_incrementValue() {
- var level = this.levels[this.currentLevel];
- level.items[level.index]++;
- },
- nextLevel: function TagTree_nextLevel() {
- var currentLevel = this.currentLevel;
- var level = this.levels[currentLevel];
- var value = level.items[level.index];
- currentLevel--;
- if (currentLevel < 0) {
- this.value = value;
- return false;
- }
- this.currentLevel = currentLevel;
- level = this.levels[currentLevel];
- level.items[level.index] = value;
- return true;
- }
- };
- return TagTree;
- }();
- var InclusionTree = function InclusionTreeClosure() {
- function InclusionTree(width, height, defaultValue) {
- var levelsLength = (0, _util.log2)(Math.max(width, height)) + 1;
- this.levels = [];
- for (var i = 0; i < levelsLength; i++) {
- var items = new Uint8Array(width * height);
- for (var j = 0, jj = items.length; j < jj; j++) {
- items[j] = defaultValue;
- }
- var level = {
- width: width,
- height: height,
- items: items
- };
- this.levels.push(level);
- width = Math.ceil(width / 2);
- height = Math.ceil(height / 2);
- }
- }
- InclusionTree.prototype = {
- reset: function InclusionTree_reset(i, j, stopValue) {
- var currentLevel = 0;
- while (currentLevel < this.levels.length) {
- var level = this.levels[currentLevel];
- var index = i + j * level.width;
- level.index = index;
- var value = level.items[index];
- if (value === 0xFF) {
- break;
- }
- if (value > stopValue) {
- this.currentLevel = currentLevel;
- this.propagateValues();
- return false;
- }
- i >>= 1;
- j >>= 1;
- currentLevel++;
- }
- this.currentLevel = currentLevel - 1;
- return true;
- },
- incrementValue: function InclusionTree_incrementValue(stopValue) {
- var level = this.levels[this.currentLevel];
- level.items[level.index] = stopValue + 1;
- this.propagateValues();
- },
- propagateValues: function InclusionTree_propagateValues() {
- var levelIndex = this.currentLevel;
- var level = this.levels[levelIndex];
- var currentValue = level.items[level.index];
- while (--levelIndex >= 0) {
- level = this.levels[levelIndex];
- level.items[level.index] = currentValue;
- }
- },
- nextLevel: function InclusionTree_nextLevel() {
- var currentLevel = this.currentLevel;
- var level = this.levels[currentLevel];
- var value = level.items[level.index];
- level.items[level.index] = 0xFF;
- currentLevel--;
- if (currentLevel < 0) {
- return false;
- }
- this.currentLevel = currentLevel;
- level = this.levels[currentLevel];
- level.items[level.index] = value;
- return true;
- }
- };
- return InclusionTree;
- }();
- var BitModel = function BitModelClosure() {
- var UNIFORM_CONTEXT = 17;
- var RUNLENGTH_CONTEXT = 18;
- var LLAndLHContextsLabel = new Uint8Array([0, 5, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 1, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8]);
- var HLContextLabel = new Uint8Array([0, 3, 4, 0, 5, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 1, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8]);
- var HHContextLabel = new Uint8Array([0, 1, 2, 0, 1, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 3, 4, 5, 0, 4, 5, 5, 0, 5, 5, 5, 0, 0, 0, 0, 0, 6, 7, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8]);
- function BitModel(width, height, subband, zeroBitPlanes, mb) {
- this.width = width;
- this.height = height;
- this.contextLabelTable = subband === 'HH' ? HHContextLabel : subband === 'HL' ? HLContextLabel : LLAndLHContextsLabel;
- var coefficientCount = width * height;
- this.neighborsSignificance = new Uint8Array(coefficientCount);
- this.coefficentsSign = new Uint8Array(coefficientCount);
- this.coefficentsMagnitude = mb > 14 ? new Uint32Array(coefficientCount) : mb > 6 ? new Uint16Array(coefficientCount) : new Uint8Array(coefficientCount);
- this.processingFlags = new Uint8Array(coefficientCount);
- var bitsDecoded = new Uint8Array(coefficientCount);
- if (zeroBitPlanes !== 0) {
- for (var i = 0; i < coefficientCount; i++) {
- bitsDecoded[i] = zeroBitPlanes;
- }
- }
- this.bitsDecoded = bitsDecoded;
- this.reset();
- }
- BitModel.prototype = {
- setDecoder: function BitModel_setDecoder(decoder) {
- this.decoder = decoder;
- },
- reset: function BitModel_reset() {
- this.contexts = new Int8Array(19);
- this.contexts[0] = 4 << 1 | 0;
- this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
- this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
- },
- setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) {
- var neighborsSignificance = this.neighborsSignificance;
- var width = this.width,
- height = this.height;
- var left = column > 0;
- var right = column + 1 < width;
- var i;
- if (row > 0) {
- i = index - width;
- if (left) {
- neighborsSignificance[i - 1] += 0x10;
- }
- if (right) {
- neighborsSignificance[i + 1] += 0x10;
- }
- neighborsSignificance[i] += 0x04;
- }
- if (row + 1 < height) {
- i = index + width;
- if (left) {
- neighborsSignificance[i - 1] += 0x10;
- }
- if (right) {
- neighborsSignificance[i + 1] += 0x10;
- }
- neighborsSignificance[i] += 0x04;
- }
- if (left) {
- neighborsSignificance[index - 1] += 0x01;
- }
- if (right) {
- neighborsSignificance[index + 1] += 0x01;
- }
- neighborsSignificance[index] |= 0x80;
- },
- runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() {
- var decoder = this.decoder;
- var width = this.width,
- height = this.height;
- var coefficentsMagnitude = this.coefficentsMagnitude;
- var coefficentsSign = this.coefficentsSign;
- var neighborsSignificance = this.neighborsSignificance;
- var processingFlags = this.processingFlags;
- var contexts = this.contexts;
- var labels = this.contextLabelTable;
- var bitsDecoded = this.bitsDecoded;
- var processedInverseMask = ~1;
- var processedMask = 1;
- var firstMagnitudeBitMask = 2;
- for (var i0 = 0; i0 < height; i0 += 4) {
- for (var j = 0; j < width; j++) {
- var index = i0 * width + j;
- for (var i1 = 0; i1 < 4; i1++, index += width) {
- var i = i0 + i1;
- if (i >= height) {
- break;
- }
- processingFlags[index] &= processedInverseMask;
- if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
- continue;
- }
- var contextLabel = labels[neighborsSignificance[index]];
- var decision = decoder.readBit(contexts, contextLabel);
- if (decision) {
- var sign = this.decodeSignBit(i, j, index);
- coefficentsSign[index] = sign;
- coefficentsMagnitude[index] = 1;
- this.setNeighborsSignificance(i, j, index);
- processingFlags[index] |= firstMagnitudeBitMask;
- }
- bitsDecoded[index]++;
- processingFlags[index] |= processedMask;
- }
- }
- }
- },
- decodeSignBit: function BitModel_decodeSignBit(row, column, index) {
- var width = this.width,
- height = this.height;
- var coefficentsMagnitude = this.coefficentsMagnitude;
- var coefficentsSign = this.coefficentsSign;
- var contribution, sign0, sign1, significance1;
- var contextLabel, decoded;
- significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
- if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
- sign1 = coefficentsSign[index + 1];
- if (significance1) {
- sign0 = coefficentsSign[index - 1];
- contribution = 1 - sign1 - sign0;
- } else {
- contribution = 1 - sign1 - sign1;
- }
- } else if (significance1) {
- sign0 = coefficentsSign[index - 1];
- contribution = 1 - sign0 - sign0;
- } else {
- contribution = 0;
- }
- var horizontalContribution = 3 * contribution;
- significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
- if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
- sign1 = coefficentsSign[index + width];
- if (significance1) {
- sign0 = coefficentsSign[index - width];
- contribution = 1 - sign1 - sign0 + horizontalContribution;
- } else {
- contribution = 1 - sign1 - sign1 + horizontalContribution;
- }
- } else if (significance1) {
- sign0 = coefficentsSign[index - width];
- contribution = 1 - sign0 - sign0 + horizontalContribution;
- } else {
- contribution = horizontalContribution;
- }
- if (contribution >= 0) {
- contextLabel = 9 + contribution;
- decoded = this.decoder.readBit(this.contexts, contextLabel);
- } else {
- contextLabel = 9 - contribution;
- decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
- }
- return decoded;
- },
- runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() {
- var decoder = this.decoder;
- var width = this.width,
- height = this.height;
- var coefficentsMagnitude = this.coefficentsMagnitude;
- var neighborsSignificance = this.neighborsSignificance;
- var contexts = this.contexts;
- var bitsDecoded = this.bitsDecoded;
- var processingFlags = this.processingFlags;
- var processedMask = 1;
- var firstMagnitudeBitMask = 2;
- var length = width * height;
- var width4 = width * 4;
- for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) {
- indexNext = Math.min(length, index0 + width4);
- for (var j = 0; j < width; j++) {
- for (var index = index0 + j; index < indexNext; index += width) {
- if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
- continue;
- }
- var contextLabel = 16;
- if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
- processingFlags[index] ^= firstMagnitudeBitMask;
- var significance = neighborsSignificance[index] & 127;
- contextLabel = significance === 0 ? 15 : 14;
- }
- var bit = decoder.readBit(contexts, contextLabel);
- coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
- bitsDecoded[index]++;
- processingFlags[index] |= processedMask;
- }
- }
- }
- },
- runCleanupPass: function BitModel_runCleanupPass() {
- var decoder = this.decoder;
- var width = this.width,
- height = this.height;
- var neighborsSignificance = this.neighborsSignificance;
- var coefficentsMagnitude = this.coefficentsMagnitude;
- var coefficentsSign = this.coefficentsSign;
- var contexts = this.contexts;
- var labels = this.contextLabelTable;
- var bitsDecoded = this.bitsDecoded;
- var processingFlags = this.processingFlags;
- var processedMask = 1;
- var firstMagnitudeBitMask = 2;
- var oneRowDown = width;
- var twoRowsDown = width * 2;
- var threeRowsDown = width * 3;
- var iNext;
- for (var i0 = 0; i0 < height; i0 = iNext) {
- iNext = Math.min(i0 + 4, height);
- var indexBase = i0 * width;
- var checkAllEmpty = i0 + 3 < height;
- for (var j = 0; j < width; j++) {
- var index0 = indexBase + j;
- var allEmpty = checkAllEmpty && processingFlags[index0] === 0 && processingFlags[index0 + oneRowDown] === 0 && processingFlags[index0 + twoRowsDown] === 0 && processingFlags[index0 + threeRowsDown] === 0 && neighborsSignificance[index0] === 0 && neighborsSignificance[index0 + oneRowDown] === 0 && neighborsSignificance[index0 + twoRowsDown] === 0 && neighborsSignificance[index0 + threeRowsDown] === 0;
- var i1 = 0,
- index = index0;
- var i = i0,
- sign;
- if (allEmpty) {
- var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
- if (!hasSignificantCoefficent) {
- bitsDecoded[index0]++;
- bitsDecoded[index0 + oneRowDown]++;
- bitsDecoded[index0 + twoRowsDown]++;
- bitsDecoded[index0 + threeRowsDown]++;
- continue;
- }
- i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
- if (i1 !== 0) {
- i = i0 + i1;
- index += i1 * width;
- }
- sign = this.decodeSignBit(i, j, index);
- coefficentsSign[index] = sign;
- coefficentsMagnitude[index] = 1;
- this.setNeighborsSignificance(i, j, index);
- processingFlags[index] |= firstMagnitudeBitMask;
- index = index0;
- for (var i2 = i0; i2 <= i; i2++, index += width) {
- bitsDecoded[index]++;
- }
- i1++;
- }
- for (i = i0 + i1; i < iNext; i++, index += width) {
- if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
- continue;
- }
- var contextLabel = labels[neighborsSignificance[index]];
- var decision = decoder.readBit(contexts, contextLabel);
- if (decision === 1) {
- sign = this.decodeSignBit(i, j, index);
- coefficentsSign[index] = sign;
- coefficentsMagnitude[index] = 1;
- this.setNeighborsSignificance(i, j, index);
- processingFlags[index] |= firstMagnitudeBitMask;
- }
- bitsDecoded[index]++;
- }
- }
- }
- },
- checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() {
- var decoder = this.decoder;
- var contexts = this.contexts;
- var symbol = decoder.readBit(contexts, UNIFORM_CONTEXT) << 3 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 2 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
- if (symbol !== 0xA) {
- throw new JpxError('Invalid segmentation symbol');
- }
- }
- };
- return BitModel;
- }();
- var Transform = function TransformClosure() {
- function Transform() {}
- Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) {
- var ll = subbands[0];
- for (var i = 1, ii = subbands.length; i < ii; i++) {
- ll = this.iterate(ll, subbands[i], u0, v0);
- }
- return ll;
- };
- Transform.prototype.extend = function extend(buffer, offset, size) {
- var i1 = offset - 1,
- j1 = offset + 1;
- var i2 = offset + size - 2,
- j2 = offset + size;
- buffer[i1--] = buffer[j1++];
- buffer[j2++] = buffer[i2--];
- buffer[i1--] = buffer[j1++];
- buffer[j2++] = buffer[i2--];
- buffer[i1--] = buffer[j1++];
- buffer[j2++] = buffer[i2--];
- buffer[i1] = buffer[j1];
- buffer[j2] = buffer[i2];
- };
- Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) {
- var llWidth = ll.width,
- llHeight = ll.height,
- llItems = ll.items;
- var width = hl_lh_hh.width;
- var height = hl_lh_hh.height;
- var items = hl_lh_hh.items;
- var i, j, k, l, u, v;
- for (k = 0, i = 0; i < llHeight; i++) {
- l = i * 2 * width;
- for (j = 0; j < llWidth; j++, k++, l += 2) {
- items[l] = llItems[k];
- }
- }
- llItems = ll.items = null;
- var bufferPadding = 4;
- var rowBuffer = new Float32Array(width + 2 * bufferPadding);
- if (width === 1) {
- if ((u0 & 1) !== 0) {
- for (v = 0, k = 0; v < height; v++, k += width) {
- items[k] *= 0.5;
- }
- }
- } else {
- for (v = 0, k = 0; v < height; v++, k += width) {
- rowBuffer.set(items.subarray(k, k + width), bufferPadding);
- this.extend(rowBuffer, bufferPadding, width);
- this.filter(rowBuffer, bufferPadding, width);
- items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
- }
- }
- var numBuffers = 16;
- var colBuffers = [];
- for (i = 0; i < numBuffers; i++) {
- colBuffers.push(new Float32Array(height + 2 * bufferPadding));
- }
- var b,
- currentBuffer = 0;
- ll = bufferPadding + height;
- if (height === 1) {
- if ((v0 & 1) !== 0) {
- for (u = 0; u < width; u++) {
- items[u] *= 0.5;
- }
- }
- } else {
- for (u = 0; u < width; u++) {
- if (currentBuffer === 0) {
- numBuffers = Math.min(width - u, numBuffers);
- for (k = u, l = bufferPadding; l < ll; k += width, l++) {
- for (b = 0; b < numBuffers; b++) {
- colBuffers[b][l] = items[k + b];
- }
- }
- currentBuffer = numBuffers;
- }
- currentBuffer--;
- var buffer = colBuffers[currentBuffer];
- this.extend(buffer, bufferPadding, height);
- this.filter(buffer, bufferPadding, height);
- if (currentBuffer === 0) {
- k = u - numBuffers + 1;
- for (l = bufferPadding; l < ll; k += width, l++) {
- for (b = 0; b < numBuffers; b++) {
- items[k + b] = colBuffers[b][l];
- }
- }
- }
- }
- }
- return {
- width: width,
- height: height,
- items: items
- };
- };
- return Transform;
- }();
- var IrreversibleTransform = function IrreversibleTransformClosure() {
- function IrreversibleTransform() {
- Transform.call(this);
- }
- IrreversibleTransform.prototype = Object.create(Transform.prototype);
- IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) {
- var len = length >> 1;
- offset = offset | 0;
- var j, n, current, next;
- var alpha = -1.586134342059924;
- var beta = -0.052980118572961;
- var gamma = 0.882911075530934;
- var delta = 0.443506852043971;
- var K = 1.230174104914001;
- var K_ = 1 / K;
- j = offset - 3;
- for (n = len + 4; n--; j += 2) {
- x[j] *= K_;
- }
- j = offset - 2;
- current = delta * x[j - 1];
- for (n = len + 3; n--; j += 2) {
- next = delta * x[j + 1];
- x[j] = K * x[j] - current - next;
- if (n--) {
- j += 2;
- current = delta * x[j + 1];
- x[j] = K * x[j] - current - next;
- } else {
- break;
- }
- }
- j = offset - 1;
- current = gamma * x[j - 1];
- for (n = len + 2; n--; j += 2) {
- next = gamma * x[j + 1];
- x[j] -= current + next;
- if (n--) {
- j += 2;
- current = gamma * x[j + 1];
- x[j] -= current + next;
- } else {
- break;
- }
- }
- j = offset;
- current = beta * x[j - 1];
- for (n = len + 1; n--; j += 2) {
- next = beta * x[j + 1];
- x[j] -= current + next;
- if (n--) {
- j += 2;
- current = beta * x[j + 1];
- x[j] -= current + next;
- } else {
- break;
- }
- }
- if (len !== 0) {
- j = offset + 1;
- current = alpha * x[j - 1];
- for (n = len; n--; j += 2) {
- next = alpha * x[j + 1];
- x[j] -= current + next;
- if (n--) {
- j += 2;
- current = alpha * x[j + 1];
- x[j] -= current + next;
- } else {
- break;
- }
- }
- }
- };
- return IrreversibleTransform;
- }();
- var ReversibleTransform = function ReversibleTransformClosure() {
- function ReversibleTransform() {
- Transform.call(this);
- }
- ReversibleTransform.prototype = Object.create(Transform.prototype);
- ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) {
- var len = length >> 1;
- offset = offset | 0;
- var j, n;
- for (j = offset, n = len + 1; n--; j += 2) {
- x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
- }
- for (j = offset + 1, n = len; n--; j += 2) {
- x[j] += x[j - 1] + x[j + 1] >> 1;
- }
- };
- return ReversibleTransform;
- }();
- return JpxImage;
-}();
-exports.JpxImage = JpxImage;
-
-/***/ }),
-/* 150 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.calculateSHA512 = exports.calculateSHA384 = exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = undefined;
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _util = __w_pdfjs_require__(2);
-
-var _primitives = __w_pdfjs_require__(138);
-
-var _stream = __w_pdfjs_require__(140);
-
-function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
-
-function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var ARCFourCipher = function ARCFourCipherClosure() {
- function ARCFourCipher(key) {
- this.a = 0;
- this.b = 0;
- var s = new Uint8Array(256);
- var i,
- j = 0,
- tmp,
- keyLength = key.length;
- for (i = 0; i < 256; ++i) {
- s[i] = i;
- }
- for (i = 0; i < 256; ++i) {
- tmp = s[i];
- j = j + tmp + key[i % keyLength] & 0xFF;
- s[i] = s[j];
- s[j] = tmp;
- }
- this.s = s;
- }
- ARCFourCipher.prototype = {
- encryptBlock: function ARCFourCipher_encryptBlock(data) {
- var i,
- n = data.length,
- tmp,
- tmp2;
- var a = this.a,
- b = this.b,
- s = this.s;
- var output = new Uint8Array(n);
- for (i = 0; i < n; ++i) {
- a = a + 1 & 0xFF;
- tmp = s[a];
- b = b + tmp & 0xFF;
- tmp2 = s[b];
- s[a] = tmp2;
- s[b] = tmp;
- output[i] = data[i] ^ s[tmp + tmp2 & 0xFF];
- }
- this.a = a;
- this.b = b;
- return output;
- }
- };
- ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock;
- return ARCFourCipher;
-}();
-var calculateMD5 = function calculateMD5Closure() {
- var r = new Uint8Array([7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]);
- var k = new Int32Array([-680876936, -389564586, 606105819, -1044525330, -176418897, 1200080426, -1473231341, -45705983, 1770035416, -1958414417, -42063, -1990404162, 1804603682, -40341101, -1502002290, 1236535329, -165796510, -1069501632, 643717713, -373897302, -701558691, 38016083, -660478335, -405537848, 568446438, -1019803690, -187363961, 1163531501, -1444681467, -51403784, 1735328473, -1926607734, -378558, -2022574463, 1839030562, -35309556, -1530992060, 1272893353, -155497632, -1094730640, 681279174, -358537222, -722521979, 76029189, -640364487, -421815835, 530742520, -995338651, -198630844, 1126891415, -1416354905, -57434055, 1700485571, -1894986606, -1051523, -2054922799, 1873313359, -30611744, -1560198380, 1309151649, -145523070, -1120210379, 718787259, -343485551]);
- function hash(data, offset, length) {
- var h0 = 1732584193,
- h1 = -271733879,
- h2 = -1732584194,
- h3 = 271733878;
- var paddedLength = length + 72 & ~63;
- var padded = new Uint8Array(paddedLength);
- var i, j, n;
- for (i = 0; i < length; ++i) {
- padded[i] = data[offset++];
- }
- padded[i++] = 0x80;
- n = paddedLength - 8;
- while (i < n) {
- padded[i++] = 0;
- }
- padded[i++] = length << 3 & 0xFF;
- padded[i++] = length >> 5 & 0xFF;
- padded[i++] = length >> 13 & 0xFF;
- padded[i++] = length >> 21 & 0xFF;
- padded[i++] = length >>> 29 & 0xFF;
- padded[i++] = 0;
- padded[i++] = 0;
- padded[i++] = 0;
- var w = new Int32Array(16);
- for (i = 0; i < paddedLength;) {
- for (j = 0; j < 16; ++j, i += 4) {
- w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
- }
- var a = h0,
- b = h1,
- c = h2,
- d = h3,
- f,
- g;
- for (j = 0; j < 64; ++j) {
- if (j < 16) {
- f = b & c | ~b & d;
- g = j;
- } else if (j < 32) {
- f = d & b | ~d & c;
- g = 5 * j + 1 & 15;
- } else if (j < 48) {
- f = b ^ c ^ d;
- g = 3 * j + 5 & 15;
- } else {
- f = c ^ (b | ~d);
- g = 7 * j & 15;
- }
- var tmp = d,
- rotateArg = a + f + k[j] + w[g] | 0,
- rotate = r[j];
- d = c;
- c = b;
- b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
- a = tmp;
- }
- h0 = h0 + a | 0;
- h1 = h1 + b | 0;
- h2 = h2 + c | 0;
- h3 = h3 + d | 0;
- }
- return new Uint8Array([h0 & 0xFF, h0 >> 8 & 0xFF, h0 >> 16 & 0xFF, h0 >>> 24 & 0xFF, h1 & 0xFF, h1 >> 8 & 0xFF, h1 >> 16 & 0xFF, h1 >>> 24 & 0xFF, h2 & 0xFF, h2 >> 8 & 0xFF, h2 >> 16 & 0xFF, h2 >>> 24 & 0xFF, h3 & 0xFF, h3 >> 8 & 0xFF, h3 >> 16 & 0xFF, h3 >>> 24 & 0xFF]);
- }
- return hash;
-}();
-var Word64 = function Word64Closure() {
- function Word64(highInteger, lowInteger) {
- this.high = highInteger | 0;
- this.low = lowInteger | 0;
- }
- Word64.prototype = {
- and: function Word64_and(word) {
- this.high &= word.high;
- this.low &= word.low;
- },
- xor: function Word64_xor(word) {
- this.high ^= word.high;
- this.low ^= word.low;
- },
- or: function Word64_or(word) {
- this.high |= word.high;
- this.low |= word.low;
- },
- shiftRight: function Word64_shiftRight(places) {
- if (places >= 32) {
- this.low = this.high >>> places - 32 | 0;
- this.high = 0;
- } else {
- this.low = this.low >>> places | this.high << 32 - places;
- this.high = this.high >>> places | 0;
- }
- },
- shiftLeft: function Word64_shiftLeft(places) {
- if (places >= 32) {
- this.high = this.low << places - 32;
- this.low = 0;
- } else {
- this.high = this.high << places | this.low >>> 32 - places;
- this.low = this.low << places;
- }
- },
- rotateRight: function Word64_rotateRight(places) {
- var low, high;
- if (places & 32) {
- high = this.low;
- low = this.high;
- } else {
- low = this.low;
- high = this.high;
- }
- places &= 31;
- this.low = low >>> places | high << 32 - places;
- this.high = high >>> places | low << 32 - places;
- },
- not: function Word64_not() {
- this.high = ~this.high;
- this.low = ~this.low;
- },
- add: function Word64_add(word) {
- var lowAdd = (this.low >>> 0) + (word.low >>> 0);
- var highAdd = (this.high >>> 0) + (word.high >>> 0);
- if (lowAdd > 0xFFFFFFFF) {
- highAdd += 1;
- }
- this.low = lowAdd | 0;
- this.high = highAdd | 0;
- },
- copyTo: function Word64_copyTo(bytes, offset) {
- bytes[offset] = this.high >>> 24 & 0xFF;
- bytes[offset + 1] = this.high >> 16 & 0xFF;
- bytes[offset + 2] = this.high >> 8 & 0xFF;
- bytes[offset + 3] = this.high & 0xFF;
- bytes[offset + 4] = this.low >>> 24 & 0xFF;
- bytes[offset + 5] = this.low >> 16 & 0xFF;
- bytes[offset + 6] = this.low >> 8 & 0xFF;
- bytes[offset + 7] = this.low & 0xFF;
- },
- assign: function Word64_assign(word) {
- this.high = word.high;
- this.low = word.low;
- }
- };
- return Word64;
-}();
-var calculateSHA256 = function calculateSHA256Closure() {
- function rotr(x, n) {
- return x >>> n | x << 32 - n;
- }
- function ch(x, y, z) {
- return x & y ^ ~x & z;
- }
- function maj(x, y, z) {
- return x & y ^ x & z ^ y & z;
- }
- function sigma(x) {
- return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
- }
- function sigmaPrime(x) {
- return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
- }
- function littleSigma(x) {
- return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
- }
- function littleSigmaPrime(x) {
- return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
- }
- var k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];
- function hash(data, offset, length) {
- var h0 = 0x6a09e667,
- h1 = 0xbb67ae85,
- h2 = 0x3c6ef372,
- h3 = 0xa54ff53a,
- h4 = 0x510e527f,
- h5 = 0x9b05688c,
- h6 = 0x1f83d9ab,
- h7 = 0x5be0cd19;
- var paddedLength = Math.ceil((length + 9) / 64) * 64;
- var padded = new Uint8Array(paddedLength);
- var i, j, n;
- for (i = 0; i < length; ++i) {
- padded[i] = data[offset++];
- }
- padded[i++] = 0x80;
- n = paddedLength - 8;
- while (i < n) {
- padded[i++] = 0;
- }
- padded[i++] = 0;
- padded[i++] = 0;
- padded[i++] = 0;
- padded[i++] = length >>> 29 & 0xFF;
- padded[i++] = length >> 21 & 0xFF;
- padded[i++] = length >> 13 & 0xFF;
- padded[i++] = length >> 5 & 0xFF;
- padded[i++] = length << 3 & 0xFF;
- var w = new Uint32Array(64);
- for (i = 0; i < paddedLength;) {
- for (j = 0; j < 16; ++j) {
- w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
- i += 4;
- }
- for (j = 16; j < 64; ++j) {
- w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
- }
- var a = h0,
- b = h1,
- c = h2,
- d = h3,
- e = h4,
- f = h5,
- g = h6,
- h = h7,
- t1,
- t2;
- for (j = 0; j < 64; ++j) {
- t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
- t2 = sigma(a) + maj(a, b, c);
- h = g;
- g = f;
- f = e;
- e = d + t1 | 0;
- d = c;
- c = b;
- b = a;
- a = t1 + t2 | 0;
- }
- h0 = h0 + a | 0;
- h1 = h1 + b | 0;
- h2 = h2 + c | 0;
- h3 = h3 + d | 0;
- h4 = h4 + e | 0;
- h5 = h5 + f | 0;
- h6 = h6 + g | 0;
- h7 = h7 + h | 0;
- }
- return new Uint8Array([h0 >> 24 & 0xFF, h0 >> 16 & 0xFF, h0 >> 8 & 0xFF, h0 & 0xFF, h1 >> 24 & 0xFF, h1 >> 16 & 0xFF, h1 >> 8 & 0xFF, h1 & 0xFF, h2 >> 24 & 0xFF, h2 >> 16 & 0xFF, h2 >> 8 & 0xFF, h2 & 0xFF, h3 >> 24 & 0xFF, h3 >> 16 & 0xFF, h3 >> 8 & 0xFF, h3 & 0xFF, h4 >> 24 & 0xFF, h4 >> 16 & 0xFF, h4 >> 8 & 0xFF, h4 & 0xFF, h5 >> 24 & 0xFF, h5 >> 16 & 0xFF, h5 >> 8 & 0xFF, h5 & 0xFF, h6 >> 24 & 0xFF, h6 >> 16 & 0xFF, h6 >> 8 & 0xFF, h6 & 0xFF, h7 >> 24 & 0xFF, h7 >> 16 & 0xFF, h7 >> 8 & 0xFF, h7 & 0xFF]);
- }
- return hash;
-}();
-var calculateSHA512 = function calculateSHA512Closure() {
- function ch(result, x, y, z, tmp) {
- result.assign(x);
- result.and(y);
- tmp.assign(x);
- tmp.not();
- tmp.and(z);
- result.xor(tmp);
- }
- function maj(result, x, y, z, tmp) {
- result.assign(x);
- result.and(y);
- tmp.assign(x);
- tmp.and(z);
- result.xor(tmp);
- tmp.assign(y);
- tmp.and(z);
- result.xor(tmp);
- }
- function sigma(result, x, tmp) {
- result.assign(x);
- result.rotateRight(28);
- tmp.assign(x);
- tmp.rotateRight(34);
- result.xor(tmp);
- tmp.assign(x);
- tmp.rotateRight(39);
- result.xor(tmp);
- }
- function sigmaPrime(result, x, tmp) {
- result.assign(x);
- result.rotateRight(14);
- tmp.assign(x);
- tmp.rotateRight(18);
- result.xor(tmp);
- tmp.assign(x);
- tmp.rotateRight(41);
- result.xor(tmp);
- }
- function littleSigma(result, x, tmp) {
- result.assign(x);
- result.rotateRight(1);
- tmp.assign(x);
- tmp.rotateRight(8);
- result.xor(tmp);
- tmp.assign(x);
- tmp.shiftRight(7);
- result.xor(tmp);
- }
- function littleSigmaPrime(result, x, tmp) {
- result.assign(x);
- result.rotateRight(19);
- tmp.assign(x);
- tmp.rotateRight(61);
- result.xor(tmp);
- tmp.assign(x);
- tmp.shiftRight(6);
- result.xor(tmp);
- }
- var k = [new Word64(0x428a2f98, 0xd728ae22), new Word64(0x71374491, 0x23ef65cd), new Word64(0xb5c0fbcf, 0xec4d3b2f), new Word64(0xe9b5dba5, 0x8189dbbc), new Word64(0x3956c25b, 0xf348b538), new Word64(0x59f111f1, 0xb605d019), new Word64(0x923f82a4, 0xaf194f9b), new Word64(0xab1c5ed5, 0xda6d8118), new Word64(0xd807aa98, 0xa3030242), new Word64(0x12835b01, 0x45706fbe), new Word64(0x243185be, 0x4ee4b28c), new Word64(0x550c7dc3, 0xd5ffb4e2), new Word64(0x72be5d74, 0xf27b896f), new Word64(0x80deb1fe, 0x3b1696b1), new Word64(0x9bdc06a7, 0x25c71235), new Word64(0xc19bf174, 0xcf692694), new Word64(0xe49b69c1, 0x9ef14ad2), new Word64(0xefbe4786, 0x384f25e3), new Word64(0x0fc19dc6, 0x8b8cd5b5), new Word64(0x240ca1cc, 0x77ac9c65), new Word64(0x2de92c6f, 0x592b0275), new Word64(0x4a7484aa, 0x6ea6e483), new Word64(0x5cb0a9dc, 0xbd41fbd4), new Word64(0x76f988da, 0x831153b5), new Word64(0x983e5152, 0xee66dfab), new Word64(0xa831c66d, 0x2db43210), new Word64(0xb00327c8, 0x98fb213f), new Word64(0xbf597fc7, 0xbeef0ee4), new Word64(0xc6e00bf3, 0x3da88fc2), new Word64(0xd5a79147, 0x930aa725), new Word64(0x06ca6351, 0xe003826f), new Word64(0x14292967, 0x0a0e6e70), new Word64(0x27b70a85, 0x46d22ffc), new Word64(0x2e1b2138, 0x5c26c926), new Word64(0x4d2c6dfc, 0x5ac42aed), new Word64(0x53380d13, 0x9d95b3df), new Word64(0x650a7354, 0x8baf63de), new Word64(0x766a0abb, 0x3c77b2a8), new Word64(0x81c2c92e, 0x47edaee6), new Word64(0x92722c85, 0x1482353b), new Word64(0xa2bfe8a1, 0x4cf10364), new Word64(0xa81a664b, 0xbc423001), new Word64(0xc24b8b70, 0xd0f89791), new Word64(0xc76c51a3, 0x0654be30), new Word64(0xd192e819, 0xd6ef5218), new Word64(0xd6990624, 0x5565a910), new Word64(0xf40e3585, 0x5771202a), new Word64(0x106aa070, 0x32bbd1b8), new Word64(0x19a4c116, 0xb8d2d0c8), new Word64(0x1e376c08, 0x5141ab53), new Word64(0x2748774c, 0xdf8eeb99), new Word64(0x34b0bcb5, 0xe19b48a8), new Word64(0x391c0cb3, 0xc5c95a63), new Word64(0x4ed8aa4a, 0xe3418acb), new Word64(0x5b9cca4f, 0x7763e373), new Word64(0x682e6ff3, 0xd6b2b8a3), new Word64(0x748f82ee, 0x5defb2fc), new Word64(0x78a5636f, 0x43172f60), new Word64(0x84c87814, 0xa1f0ab72), new Word64(0x8cc70208, 0x1a6439ec), new Word64(0x90befffa, 0x23631e28), new Word64(0xa4506ceb, 0xde82bde9), new Word64(0xbef9a3f7, 0xb2c67915), new Word64(0xc67178f2, 0xe372532b), new Word64(0xca273ece, 0xea26619c), new Word64(0xd186b8c7, 0x21c0c207), new Word64(0xeada7dd6, 0xcde0eb1e), new Word64(0xf57d4f7f, 0xee6ed178), new Word64(0x06f067aa, 0x72176fba), new Word64(0x0a637dc5, 0xa2c898a6), new Word64(0x113f9804, 0xbef90dae), new Word64(0x1b710b35, 0x131c471b), new Word64(0x28db77f5, 0x23047d84), new Word64(0x32caab7b, 0x40c72493), new Word64(0x3c9ebe0a, 0x15c9bebc), new Word64(0x431d67c4, 0x9c100d4c), new Word64(0x4cc5d4be, 0xcb3e42b6), new Word64(0x597f299c, 0xfc657e2a), new Word64(0x5fcb6fab, 0x3ad6faec), new Word64(0x6c44198c, 0x4a475817)];
- function hash(data, offset, length, mode384) {
- mode384 = !!mode384;
- var h0, h1, h2, h3, h4, h5, h6, h7;
- if (!mode384) {
- h0 = new Word64(0x6a09e667, 0xf3bcc908);
- h1 = new Word64(0xbb67ae85, 0x84caa73b);
- h2 = new Word64(0x3c6ef372, 0xfe94f82b);
- h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
- h4 = new Word64(0x510e527f, 0xade682d1);
- h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
- h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
- h7 = new Word64(0x5be0cd19, 0x137e2179);
- } else {
- h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
- h1 = new Word64(0x629a292a, 0x367cd507);
- h2 = new Word64(0x9159015a, 0x3070dd17);
- h3 = new Word64(0x152fecd8, 0xf70e5939);
- h4 = new Word64(0x67332667, 0xffc00b31);
- h5 = new Word64(0x8eb44a87, 0x68581511);
- h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
- h7 = new Word64(0x47b5481d, 0xbefa4fa4);
- }
- var paddedLength = Math.ceil((length + 17) / 128) * 128;
- var padded = new Uint8Array(paddedLength);
- var i, j, n;
- for (i = 0; i < length; ++i) {
- padded[i] = data[offset++];
- }
- padded[i++] = 0x80;
- n = paddedLength - 16;
- while (i < n) {
- padded[i++] = 0;
- }
- padded[i++] = 0;
- padded[i++] = 0;
- padded[i++] = 0;
- padded[i++] = 0;
- padded[i++] = 0;
- padded[i++] = 0;
- padded[i++] = 0;
- padded[i++] = 0;
- padded[i++] = 0;
- padded[i++] = 0;
- padded[i++] = 0;
- padded[i++] = length >>> 29 & 0xFF;
- padded[i++] = length >> 21 & 0xFF;
- padded[i++] = length >> 13 & 0xFF;
- padded[i++] = length >> 5 & 0xFF;
- padded[i++] = length << 3 & 0xFF;
- var w = new Array(80);
- for (i = 0; i < 80; i++) {
- w[i] = new Word64(0, 0);
- }
- var a = new Word64(0, 0),
- b = new Word64(0, 0),
- c = new Word64(0, 0);
- var d = new Word64(0, 0),
- e = new Word64(0, 0),
- f = new Word64(0, 0);
- var g = new Word64(0, 0),
- h = new Word64(0, 0);
- var t1 = new Word64(0, 0),
- t2 = new Word64(0, 0);
- var tmp1 = new Word64(0, 0),
- tmp2 = new Word64(0, 0),
- tmp3;
- for (i = 0; i < paddedLength;) {
- for (j = 0; j < 16; ++j) {
- w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
- w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
- i += 8;
- }
- for (j = 16; j < 80; ++j) {
- tmp3 = w[j];
- littleSigmaPrime(tmp3, w[j - 2], tmp2);
- tmp3.add(w[j - 7]);
- littleSigma(tmp1, w[j - 15], tmp2);
- tmp3.add(tmp1);
- tmp3.add(w[j - 16]);
- }
- a.assign(h0);
- b.assign(h1);
- c.assign(h2);
- d.assign(h3);
- e.assign(h4);
- f.assign(h5);
- g.assign(h6);
- h.assign(h7);
- for (j = 0; j < 80; ++j) {
- t1.assign(h);
- sigmaPrime(tmp1, e, tmp2);
- t1.add(tmp1);
- ch(tmp1, e, f, g, tmp2);
- t1.add(tmp1);
- t1.add(k[j]);
- t1.add(w[j]);
- sigma(t2, a, tmp2);
- maj(tmp1, a, b, c, tmp2);
- t2.add(tmp1);
- tmp3 = h;
- h = g;
- g = f;
- f = e;
- d.add(t1);
- e = d;
- d = c;
- c = b;
- b = a;
- tmp3.assign(t1);
- tmp3.add(t2);
- a = tmp3;
- }
- h0.add(a);
- h1.add(b);
- h2.add(c);
- h3.add(d);
- h4.add(e);
- h5.add(f);
- h6.add(g);
- h7.add(h);
- }
- var result;
- if (!mode384) {
- result = new Uint8Array(64);
- h0.copyTo(result, 0);
- h1.copyTo(result, 8);
- h2.copyTo(result, 16);
- h3.copyTo(result, 24);
- h4.copyTo(result, 32);
- h5.copyTo(result, 40);
- h6.copyTo(result, 48);
- h7.copyTo(result, 56);
- } else {
- result = new Uint8Array(48);
- h0.copyTo(result, 0);
- h1.copyTo(result, 8);
- h2.copyTo(result, 16);
- h3.copyTo(result, 24);
- h4.copyTo(result, 32);
- h5.copyTo(result, 40);
- }
- return result;
- }
- return hash;
-}();
-var calculateSHA384 = function calculateSHA384Closure() {
- function hash(data, offset, length) {
- return calculateSHA512(data, offset, length, true);
- }
- return hash;
-}();
-var NullCipher = function NullCipherClosure() {
- function NullCipher() {}
- NullCipher.prototype = {
- decryptBlock: function NullCipher_decryptBlock(data) {
- return data;
- }
- };
- return NullCipher;
-}();
-
-var AESBaseCipher = function () {
- function AESBaseCipher() {
- _classCallCheck(this, AESBaseCipher);
-
- if (this.constructor === AESBaseCipher) {
- (0, _util.unreachable)('Cannot initialize AESBaseCipher.');
- }
- this._s = new Uint8Array([0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16]);
- this._inv_s = new Uint8Array([0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]);
- this._mix = new Uint32Array([0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]);
- this._mixCol = new Uint8Array(256);
- for (var i = 0; i < 256; i++) {
- if (i < 128) {
- this._mixCol[i] = i << 1;
- } else {
- this._mixCol[i] = i << 1 ^ 0x1b;
- }
- }
- this.buffer = new Uint8Array(16);
- this.bufferPosition = 0;
- }
-
- _createClass(AESBaseCipher, [{
- key: '_expandKey',
- value: function _expandKey(cipherKey) {
- (0, _util.unreachable)('Cannot call `_expandKey` on the base class');
- }
- }, {
- key: '_decrypt',
- value: function _decrypt(input, key) {
- var t = void 0,
- u = void 0,
- v = void 0;
- var state = new Uint8Array(16);
- state.set(input);
- for (var j = 0, k = this._keySize; j < 16; ++j, ++k) {
- state[j] ^= key[k];
- }
- for (var i = this._cyclesOfRepetition - 1; i >= 1; --i) {
- t = state[13];
- state[13] = state[9];
- state[9] = state[5];
- state[5] = state[1];
- state[1] = t;
- t = state[14];
- u = state[10];
- state[14] = state[6];
- state[10] = state[2];
- state[6] = t;
- state[2] = u;
- t = state[15];
- u = state[11];
- v = state[7];
- state[15] = state[3];
- state[11] = t;
- state[7] = u;
- state[3] = v;
- for (var _j = 0; _j < 16; ++_j) {
- state[_j] = this._inv_s[state[_j]];
- }
- for (var _j2 = 0, _k = i * 16; _j2 < 16; ++_j2, ++_k) {
- state[_j2] ^= key[_k];
- }
- for (var _j3 = 0; _j3 < 16; _j3 += 4) {
- var s0 = this._mix[state[_j3]];
- var s1 = this._mix[state[_j3 + 1]];
- var s2 = this._mix[state[_j3 + 2]];
- var s3 = this._mix[state[_j3 + 3]];
- t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
- state[_j3] = t >>> 24 & 0xFF;
- state[_j3 + 1] = t >> 16 & 0xFF;
- state[_j3 + 2] = t >> 8 & 0xFF;
- state[_j3 + 3] = t & 0xFF;
- }
- }
- t = state[13];
- state[13] = state[9];
- state[9] = state[5];
- state[5] = state[1];
- state[1] = t;
- t = state[14];
- u = state[10];
- state[14] = state[6];
- state[10] = state[2];
- state[6] = t;
- state[2] = u;
- t = state[15];
- u = state[11];
- v = state[7];
- state[15] = state[3];
- state[11] = t;
- state[7] = u;
- state[3] = v;
- for (var _j4 = 0; _j4 < 16; ++_j4) {
- state[_j4] = this._inv_s[state[_j4]];
- state[_j4] ^= key[_j4];
- }
- return state;
- }
- }, {
- key: '_encrypt',
- value: function _encrypt(input, key) {
- var s = this._s;
- var t = void 0,
- u = void 0,
- v = void 0;
- var state = new Uint8Array(16);
- state.set(input);
- for (var j = 0; j < 16; ++j) {
- state[j] ^= key[j];
- }
- for (var i = 1; i < this._cyclesOfRepetition; i++) {
- for (var _j5 = 0; _j5 < 16; ++_j5) {
- state[_j5] = s[state[_j5]];
- }
- v = state[1];
- state[1] = state[5];
- state[5] = state[9];
- state[9] = state[13];
- state[13] = v;
- v = state[2];
- u = state[6];
- state[2] = state[10];
- state[6] = state[14];
- state[10] = v;
- state[14] = u;
- v = state[3];
- u = state[7];
- t = state[11];
- state[3] = state[15];
- state[7] = v;
- state[11] = u;
- state[15] = t;
- for (var _j6 = 0; _j6 < 16; _j6 += 4) {
- var s0 = state[_j6 + 0];
- var s1 = state[_j6 + 1];
- var s2 = state[_j6 + 2];
- var s3 = state[_j6 + 3];
- t = s0 ^ s1 ^ s2 ^ s3;
- state[_j6 + 0] ^= t ^ this._mixCol[s0 ^ s1];
- state[_j6 + 1] ^= t ^ this._mixCol[s1 ^ s2];
- state[_j6 + 2] ^= t ^ this._mixCol[s2 ^ s3];
- state[_j6 + 3] ^= t ^ this._mixCol[s3 ^ s0];
- }
- for (var _j7 = 0, k = i * 16; _j7 < 16; ++_j7, ++k) {
- state[_j7] ^= key[k];
- }
- }
- for (var _j8 = 0; _j8 < 16; ++_j8) {
- state[_j8] = s[state[_j8]];
- }
- v = state[1];
- state[1] = state[5];
- state[5] = state[9];
- state[9] = state[13];
- state[13] = v;
- v = state[2];
- u = state[6];
- state[2] = state[10];
- state[6] = state[14];
- state[10] = v;
- state[14] = u;
- v = state[3];
- u = state[7];
- t = state[11];
- state[3] = state[15];
- state[7] = v;
- state[11] = u;
- state[15] = t;
- for (var _j9 = 0, _k2 = this._keySize; _j9 < 16; ++_j9, ++_k2) {
- state[_j9] ^= key[_k2];
- }
- return state;
- }
- }, {
- key: '_decryptBlock2',
- value: function _decryptBlock2(data, finalize) {
- var sourceLength = data.length;
- var buffer = this.buffer,
- bufferLength = this.bufferPosition;
- var result = [],
- iv = this.iv;
- for (var i = 0; i < sourceLength; ++i) {
- buffer[bufferLength] = data[i];
- ++bufferLength;
- if (bufferLength < 16) {
- continue;
- }
- var plain = this._decrypt(buffer, this._key);
- for (var j = 0; j < 16; ++j) {
- plain[j] ^= iv[j];
- }
- iv = buffer;
- result.push(plain);
- buffer = new Uint8Array(16);
- bufferLength = 0;
- }
- this.buffer = buffer;
- this.bufferLength = bufferLength;
- this.iv = iv;
- if (result.length === 0) {
- return new Uint8Array(0);
- }
- var outputLength = 16 * result.length;
- if (finalize) {
- var lastBlock = result[result.length - 1];
- var psLen = lastBlock[15];
- if (psLen <= 16) {
- for (var _i = 15, ii = 16 - psLen; _i >= ii; --_i) {
- if (lastBlock[_i] !== psLen) {
- psLen = 0;
- break;
- }
- }
- outputLength -= psLen;
- result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
- }
- }
- var output = new Uint8Array(outputLength);
- for (var _i2 = 0, _j10 = 0, _ii = result.length; _i2 < _ii; ++_i2, _j10 += 16) {
- output.set(result[_i2], _j10);
- }
- return output;
- }
- }, {
- key: 'decryptBlock',
- value: function decryptBlock(data, finalize) {
- var iv = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
-
- var sourceLength = data.length;
- var buffer = this.buffer,
- bufferLength = this.bufferPosition;
- if (iv) {
- this.iv = iv;
- } else {
- for (var i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
- buffer[bufferLength] = data[i];
- }
- if (bufferLength < 16) {
- this.bufferLength = bufferLength;
- return new Uint8Array(0);
- }
- this.iv = buffer;
- data = data.subarray(16);
- }
- this.buffer = new Uint8Array(16);
- this.bufferLength = 0;
- this.decryptBlock = this._decryptBlock2;
- return this.decryptBlock(data, finalize);
- }
- }, {
- key: 'encrypt',
- value: function encrypt(data, iv) {
- var sourceLength = data.length;
- var buffer = this.buffer,
- bufferLength = this.bufferPosition;
- var result = [];
- if (!iv) {
- iv = new Uint8Array(16);
- }
- for (var i = 0; i < sourceLength; ++i) {
- buffer[bufferLength] = data[i];
- ++bufferLength;
- if (bufferLength < 16) {
- continue;
- }
- for (var j = 0; j < 16; ++j) {
- buffer[j] ^= iv[j];
- }
- var cipher = this._encrypt(buffer, this._key);
- iv = cipher;
- result.push(cipher);
- buffer = new Uint8Array(16);
- bufferLength = 0;
- }
- this.buffer = buffer;
- this.bufferLength = bufferLength;
- this.iv = iv;
- if (result.length === 0) {
- return new Uint8Array(0);
- }
- var outputLength = 16 * result.length;
- var output = new Uint8Array(outputLength);
- for (var _i3 = 0, _j11 = 0, ii = result.length; _i3 < ii; ++_i3, _j11 += 16) {
- output.set(result[_i3], _j11);
- }
- return output;
- }
- }]);
-
- return AESBaseCipher;
-}();
-
-var AES128Cipher = function (_AESBaseCipher) {
- _inherits(AES128Cipher, _AESBaseCipher);
-
- function AES128Cipher(key) {
- _classCallCheck(this, AES128Cipher);
-
- var _this = _possibleConstructorReturn(this, (AES128Cipher.__proto__ || Object.getPrototypeOf(AES128Cipher)).call(this));
-
- _this._cyclesOfRepetition = 10;
- _this._keySize = 160;
- _this._rcon = new Uint8Array([0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d]);
- _this._key = _this._expandKey(key);
- return _this;
- }
-
- _createClass(AES128Cipher, [{
- key: '_expandKey',
- value: function _expandKey(cipherKey) {
- var b = 176;
- var s = this._s;
- var rcon = this._rcon;
- var result = new Uint8Array(b);
- result.set(cipherKey);
- for (var j = 16, i = 1; j < b; ++i) {
- var t1 = result[j - 3];
- var t2 = result[j - 2];
- var t3 = result[j - 1];
- var t4 = result[j - 4];
- t1 = s[t1];
- t2 = s[t2];
- t3 = s[t3];
- t4 = s[t4];
- t1 = t1 ^ rcon[i];
- for (var n = 0; n < 4; ++n) {
- result[j] = t1 ^= result[j - 16];
- j++;
- result[j] = t2 ^= result[j - 16];
- j++;
- result[j] = t3 ^= result[j - 16];
- j++;
- result[j] = t4 ^= result[j - 16];
- j++;
- }
- }
- return result;
- }
- }]);
-
- return AES128Cipher;
-}(AESBaseCipher);
-
-var AES256Cipher = function (_AESBaseCipher2) {
- _inherits(AES256Cipher, _AESBaseCipher2);
-
- function AES256Cipher(key) {
- _classCallCheck(this, AES256Cipher);
-
- var _this2 = _possibleConstructorReturn(this, (AES256Cipher.__proto__ || Object.getPrototypeOf(AES256Cipher)).call(this));
-
- _this2._cyclesOfRepetition = 14;
- _this2._keySize = 224;
- _this2._key = _this2._expandKey(key);
- return _this2;
- }
-
- _createClass(AES256Cipher, [{
- key: '_expandKey',
- value: function _expandKey(cipherKey) {
- var b = 240;
- var s = this._s;
- var result = new Uint8Array(b);
- result.set(cipherKey);
- var r = 1;
- var t1 = void 0,
- t2 = void 0,
- t3 = void 0,
- t4 = void 0;
- for (var j = 32, i = 1; j < b; ++i) {
- if (j % 32 === 16) {
- t1 = s[t1];
- t2 = s[t2];
- t3 = s[t3];
- t4 = s[t4];
- } else if (j % 32 === 0) {
- t1 = result[j - 3];
- t2 = result[j - 2];
- t3 = result[j - 1];
- t4 = result[j - 4];
- t1 = s[t1];
- t2 = s[t2];
- t3 = s[t3];
- t4 = s[t4];
- t1 = t1 ^ r;
- if ((r <<= 1) >= 256) {
- r = (r ^ 0x1b) & 0xFF;
- }
- }
- for (var n = 0; n < 4; ++n) {
- result[j] = t1 ^= result[j - 32];
- j++;
- result[j] = t2 ^= result[j - 32];
- j++;
- result[j] = t3 ^= result[j - 32];
- j++;
- result[j] = t4 ^= result[j - 32];
- j++;
- }
- }
- return result;
- }
- }]);
-
- return AES256Cipher;
-}(AESBaseCipher);
-
-var PDF17 = function PDF17Closure() {
- function compareByteArrays(array1, array2) {
- if (array1.length !== array2.length) {
- return false;
- }
- for (var i = 0; i < array1.length; i++) {
- if (array1[i] !== array2[i]) {
- return false;
- }
- }
- return true;
- }
- function PDF17() {}
- PDF17.prototype = {
- checkOwnerPassword: function PDF17_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
- var hashData = new Uint8Array(password.length + 56);
- hashData.set(password, 0);
- hashData.set(ownerValidationSalt, password.length);
- hashData.set(userBytes, password.length + ownerValidationSalt.length);
- var result = calculateSHA256(hashData, 0, hashData.length);
- return compareByteArrays(result, ownerPassword);
- },
- checkUserPassword: function PDF17_checkUserPassword(password, userValidationSalt, userPassword) {
- var hashData = new Uint8Array(password.length + 8);
- hashData.set(password, 0);
- hashData.set(userValidationSalt, password.length);
- var result = calculateSHA256(hashData, 0, hashData.length);
- return compareByteArrays(result, userPassword);
- },
- getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
- var hashData = new Uint8Array(password.length + 56);
- hashData.set(password, 0);
- hashData.set(ownerKeySalt, password.length);
- hashData.set(userBytes, password.length + ownerKeySalt.length);
- var key = calculateSHA256(hashData, 0, hashData.length);
- var cipher = new AES256Cipher(key);
- return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
- },
- getUserKey: function PDF17_getUserKey(password, userKeySalt, userEncryption) {
- var hashData = new Uint8Array(password.length + 8);
- hashData.set(password, 0);
- hashData.set(userKeySalt, password.length);
- var key = calculateSHA256(hashData, 0, hashData.length);
- var cipher = new AES256Cipher(key);
- return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
- }
- };
- return PDF17;
-}();
-var PDF20 = function PDF20Closure() {
- function concatArrays(array1, array2) {
- var t = new Uint8Array(array1.length + array2.length);
- t.set(array1, 0);
- t.set(array2, array1.length);
- return t;
- }
- function calculatePDF20Hash(password, input, userBytes) {
- var k = calculateSHA256(input, 0, input.length).subarray(0, 32);
- var e = [0];
- var i = 0;
- while (i < 64 || e[e.length - 1] > i - 32) {
- var arrayLength = password.length + k.length + userBytes.length;
- var k1 = new Uint8Array(arrayLength * 64);
- var array = concatArrays(password, k);
- array = concatArrays(array, userBytes);
- for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) {
- k1.set(array, pos);
- }
- var cipher = new AES128Cipher(k.subarray(0, 16));
- e = cipher.encrypt(k1, k.subarray(16, 32));
- var remainder = 0;
- for (var z = 0; z < 16; z++) {
- remainder *= 256 % 3;
- remainder %= 3;
- remainder += (e[z] >>> 0) % 3;
- remainder %= 3;
- }
- if (remainder === 0) {
- k = calculateSHA256(e, 0, e.length);
- } else if (remainder === 1) {
- k = calculateSHA384(e, 0, e.length);
- } else if (remainder === 2) {
- k = calculateSHA512(e, 0, e.length);
- }
- i++;
- }
- return k.subarray(0, 32);
- }
- function PDF20() {}
- function compareByteArrays(array1, array2) {
- if (array1.length !== array2.length) {
- return false;
- }
- for (var i = 0; i < array1.length; i++) {
- if (array1[i] !== array2[i]) {
- return false;
- }
- }
- return true;
- }
- PDF20.prototype = {
- hash: function PDF20_hash(password, concatBytes, userBytes) {
- return calculatePDF20Hash(password, concatBytes, userBytes);
- },
- checkOwnerPassword: function PDF20_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
- var hashData = new Uint8Array(password.length + 56);
- hashData.set(password, 0);
- hashData.set(ownerValidationSalt, password.length);
- hashData.set(userBytes, password.length + ownerValidationSalt.length);
- var result = calculatePDF20Hash(password, hashData, userBytes);
- return compareByteArrays(result, ownerPassword);
- },
- checkUserPassword: function PDF20_checkUserPassword(password, userValidationSalt, userPassword) {
- var hashData = new Uint8Array(password.length + 8);
- hashData.set(password, 0);
- hashData.set(userValidationSalt, password.length);
- var result = calculatePDF20Hash(password, hashData, []);
- return compareByteArrays(result, userPassword);
- },
- getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
- var hashData = new Uint8Array(password.length + 56);
- hashData.set(password, 0);
- hashData.set(ownerKeySalt, password.length);
- hashData.set(userBytes, password.length + ownerKeySalt.length);
- var key = calculatePDF20Hash(password, hashData, userBytes);
- var cipher = new AES256Cipher(key);
- return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
- },
- getUserKey: function PDF20_getUserKey(password, userKeySalt, userEncryption) {
- var hashData = new Uint8Array(password.length + 8);
- hashData.set(password, 0);
- hashData.set(userKeySalt, password.length);
- var key = calculatePDF20Hash(password, hashData, []);
- var cipher = new AES256Cipher(key);
- return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
- }
- };
- return PDF20;
-}();
-var CipherTransform = function CipherTransformClosure() {
- function CipherTransform(stringCipherConstructor, streamCipherConstructor) {
- this.StringCipherConstructor = stringCipherConstructor;
- this.StreamCipherConstructor = streamCipherConstructor;
- }
- CipherTransform.prototype = {
- createStream: function CipherTransform_createStream(stream, length) {
- var cipher = new this.StreamCipherConstructor();
- return new _stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
- return cipher.decryptBlock(data, finalize);
- });
- },
- decryptString: function CipherTransform_decryptString(s) {
- var cipher = new this.StringCipherConstructor();
- var data = (0, _util.stringToBytes)(s);
- data = cipher.decryptBlock(data, true);
- return (0, _util.bytesToString)(data);
- }
- };
- return CipherTransform;
-}();
-var CipherTransformFactory = function CipherTransformFactoryClosure() {
- var defaultPasswordBytes = new Uint8Array([0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41, 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08, 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80, 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A]);
- function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
- if (password) {
- var passwordLength = Math.min(127, password.length);
- password = password.subarray(0, passwordLength);
- } else {
- password = [];
- }
- var pdfAlgorithm;
- if (revision === 6) {
- pdfAlgorithm = new PDF20();
- } else {
- pdfAlgorithm = new PDF17();
- }
- if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
- return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
- } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
- return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
- }
- return null;
- }
- function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
- var hashDataSize = 40 + ownerPassword.length + fileId.length;
- var hashData = new Uint8Array(hashDataSize),
- i = 0,
- j,
- n;
- if (password) {
- n = Math.min(32, password.length);
- for (; i < n; ++i) {
- hashData[i] = password[i];
- }
- }
- j = 0;
- while (i < 32) {
- hashData[i++] = defaultPasswordBytes[j++];
- }
- for (j = 0, n = ownerPassword.length; j < n; ++j) {
- hashData[i++] = ownerPassword[j];
- }
- hashData[i++] = flags & 0xFF;
- hashData[i++] = flags >> 8 & 0xFF;
- hashData[i++] = flags >> 16 & 0xFF;
- hashData[i++] = flags >>> 24 & 0xFF;
- for (j = 0, n = fileId.length; j < n; ++j) {
- hashData[i++] = fileId[j];
- }
- if (revision >= 4 && !encryptMetadata) {
- hashData[i++] = 0xFF;
- hashData[i++] = 0xFF;
- hashData[i++] = 0xFF;
- hashData[i++] = 0xFF;
- }
- var hash = calculateMD5(hashData, 0, i);
- var keyLengthInBytes = keyLength >> 3;
- if (revision >= 3) {
- for (j = 0; j < 50; ++j) {
- hash = calculateMD5(hash, 0, keyLengthInBytes);
- }
- }
- var encryptionKey = hash.subarray(0, keyLengthInBytes);
- var cipher, checkData;
- if (revision >= 3) {
- for (i = 0; i < 32; ++i) {
- hashData[i] = defaultPasswordBytes[i];
- }
- for (j = 0, n = fileId.length; j < n; ++j) {
- hashData[i++] = fileId[j];
- }
- cipher = new ARCFourCipher(encryptionKey);
- checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
- n = encryptionKey.length;
- var derivedKey = new Uint8Array(n),
- k;
- for (j = 1; j <= 19; ++j) {
- for (k = 0; k < n; ++k) {
- derivedKey[k] = encryptionKey[k] ^ j;
- }
- cipher = new ARCFourCipher(derivedKey);
- checkData = cipher.encryptBlock(checkData);
- }
- for (j = 0, n = checkData.length; j < n; ++j) {
- if (userPassword[j] !== checkData[j]) {
- return null;
- }
- }
- } else {
- cipher = new ARCFourCipher(encryptionKey);
- checkData = cipher.encryptBlock(defaultPasswordBytes);
- for (j = 0, n = checkData.length; j < n; ++j) {
- if (userPassword[j] !== checkData[j]) {
- return null;
- }
- }
- }
- return encryptionKey;
- }
- function decodeUserPassword(password, ownerPassword, revision, keyLength) {
- var hashData = new Uint8Array(32),
- i = 0,
- j,
- n;
- n = Math.min(32, password.length);
- for (; i < n; ++i) {
- hashData[i] = password[i];
- }
- j = 0;
- while (i < 32) {
- hashData[i++] = defaultPasswordBytes[j++];
- }
- var hash = calculateMD5(hashData, 0, i);
- var keyLengthInBytes = keyLength >> 3;
- if (revision >= 3) {
- for (j = 0; j < 50; ++j) {
- hash = calculateMD5(hash, 0, hash.length);
- }
- }
- var cipher, userPassword;
- if (revision >= 3) {
- userPassword = ownerPassword;
- var derivedKey = new Uint8Array(keyLengthInBytes),
- k;
- for (j = 19; j >= 0; j--) {
- for (k = 0; k < keyLengthInBytes; ++k) {
- derivedKey[k] = hash[k] ^ j;
- }
- cipher = new ARCFourCipher(derivedKey);
- userPassword = cipher.encryptBlock(userPassword);
- }
- } else {
- cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
- userPassword = cipher.encryptBlock(ownerPassword);
- }
- return userPassword;
- }
- var identityName = _primitives.Name.get('Identity');
- function CipherTransformFactory(dict, fileId, password) {
- var filter = dict.get('Filter');
- if (!(0, _primitives.isName)(filter, 'Standard')) {
- throw new _util.FormatError('unknown encryption method');
- }
- this.dict = dict;
- var algorithm = dict.get('V');
- if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
- throw new _util.FormatError('unsupported encryption algorithm');
- }
- this.algorithm = algorithm;
- var keyLength = dict.get('Length');
- if (!keyLength) {
- if (algorithm <= 3) {
- keyLength = 40;
- } else {
- var cfDict = dict.get('CF');
- var streamCryptoName = dict.get('StmF');
- if ((0, _primitives.isDict)(cfDict) && (0, _primitives.isName)(streamCryptoName)) {
- cfDict.suppressEncryption = true;
- var handlerDict = cfDict.get(streamCryptoName.name);
- keyLength = handlerDict && handlerDict.get('Length') || 128;
- if (keyLength < 40) {
- keyLength <<= 3;
- }
- }
- }
- }
- if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
- throw new _util.FormatError('invalid key length');
- }
- var ownerPassword = (0, _util.stringToBytes)(dict.get('O')).subarray(0, 32);
- var userPassword = (0, _util.stringToBytes)(dict.get('U')).subarray(0, 32);
- var flags = dict.get('P');
- var revision = dict.get('R');
- var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get('EncryptMetadata') !== false;
- this.encryptMetadata = encryptMetadata;
- var fileIdBytes = (0, _util.stringToBytes)(fileId);
- var passwordBytes;
- if (password) {
- if (revision === 6) {
- try {
- password = (0, _util.utf8StringToString)(password);
- } catch (ex) {
- (0, _util.warn)('CipherTransformFactory: ' + 'Unable to convert UTF8 encoded password.');
- }
- }
- passwordBytes = (0, _util.stringToBytes)(password);
- }
- var encryptionKey;
- if (algorithm !== 5) {
- encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
- } else {
- var ownerValidationSalt = (0, _util.stringToBytes)(dict.get('O')).subarray(32, 40);
- var ownerKeySalt = (0, _util.stringToBytes)(dict.get('O')).subarray(40, 48);
- var uBytes = (0, _util.stringToBytes)(dict.get('U')).subarray(0, 48);
- var userValidationSalt = (0, _util.stringToBytes)(dict.get('U')).subarray(32, 40);
- var userKeySalt = (0, _util.stringToBytes)(dict.get('U')).subarray(40, 48);
- var ownerEncryption = (0, _util.stringToBytes)(dict.get('OE'));
- var userEncryption = (0, _util.stringToBytes)(dict.get('UE'));
- var perms = (0, _util.stringToBytes)(dict.get('Perms'));
- encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
- }
- if (!encryptionKey && !password) {
- throw new _util.PasswordException('No password given', _util.PasswordResponses.NEED_PASSWORD);
- } else if (!encryptionKey && password) {
- var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
- encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
- }
- if (!encryptionKey) {
- throw new _util.PasswordException('Incorrect Password', _util.PasswordResponses.INCORRECT_PASSWORD);
- }
- this.encryptionKey = encryptionKey;
- if (algorithm >= 4) {
- var cf = dict.get('CF');
- if ((0, _primitives.isDict)(cf)) {
- cf.suppressEncryption = true;
- }
- this.cf = cf;
- this.stmf = dict.get('StmF') || identityName;
- this.strf = dict.get('StrF') || identityName;
- this.eff = dict.get('EFF') || this.stmf;
- }
- }
- function buildObjectKey(num, gen, encryptionKey, isAes) {
- var key = new Uint8Array(encryptionKey.length + 9),
- i,
- n;
- for (i = 0, n = encryptionKey.length; i < n; ++i) {
- key[i] = encryptionKey[i];
- }
- key[i++] = num & 0xFF;
- key[i++] = num >> 8 & 0xFF;
- key[i++] = num >> 16 & 0xFF;
- key[i++] = gen & 0xFF;
- key[i++] = gen >> 8 & 0xFF;
- if (isAes) {
- key[i++] = 0x73;
- key[i++] = 0x41;
- key[i++] = 0x6C;
- key[i++] = 0x54;
- }
- var hash = calculateMD5(key, 0, i);
- return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
- }
- function buildCipherConstructor(cf, name, num, gen, key) {
- if (!(0, _primitives.isName)(name)) {
- throw new _util.FormatError('Invalid crypt filter name.');
- }
- var cryptFilter = cf.get(name.name);
- var cfm;
- if (cryptFilter !== null && cryptFilter !== undefined) {
- cfm = cryptFilter.get('CFM');
- }
- if (!cfm || cfm.name === 'None') {
- return function cipherTransformFactoryBuildCipherConstructorNone() {
- return new NullCipher();
- };
- }
- if (cfm.name === 'V2') {
- return function cipherTransformFactoryBuildCipherConstructorV2() {
- return new ARCFourCipher(buildObjectKey(num, gen, key, false));
- };
- }
- if (cfm.name === 'AESV2') {
- return function cipherTransformFactoryBuildCipherConstructorAESV2() {
- return new AES128Cipher(buildObjectKey(num, gen, key, true));
- };
- }
- if (cfm.name === 'AESV3') {
- return function cipherTransformFactoryBuildCipherConstructorAESV3() {
- return new AES256Cipher(key);
- };
- }
- throw new _util.FormatError('Unknown crypto method');
- }
- CipherTransformFactory.prototype = {
- createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) {
- if (this.algorithm === 4 || this.algorithm === 5) {
- return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
- }
- var key = buildObjectKey(num, gen, this.encryptionKey, false);
- var cipherConstructor = function buildCipherCipherConstructor() {
- return new ARCFourCipher(key);
- };
- return new CipherTransform(cipherConstructor, cipherConstructor);
- }
- };
- return CipherTransformFactory;
-}();
-exports.AES128Cipher = AES128Cipher;
-exports.AES256Cipher = AES256Cipher;
-exports.ARCFourCipher = ARCFourCipher;
-exports.CipherTransformFactory = CipherTransformFactory;
-exports.PDF17 = PDF17;
-exports.PDF20 = PDF20;
-exports.calculateMD5 = calculateMD5;
-exports.calculateSHA256 = calculateSHA256;
-exports.calculateSHA384 = calculateSHA384;
-exports.calculateSHA512 = calculateSHA512;
-
-/***/ }),
-/* 151 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.ColorSpace = undefined;
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _util = __w_pdfjs_require__(2);
-
-var _primitives = __w_pdfjs_require__(138);
-
-function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
-
-function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
- var COMPONENTS = 3;
- alpha01 = alpha01 !== 1 ? 0 : alpha01;
- var xRatio = w1 / w2;
- var yRatio = h1 / h2;
- var newIndex = 0,
- oldIndex = void 0;
- var xScaled = new Uint16Array(w2);
- var w1Scanline = w1 * COMPONENTS;
- for (var i = 0; i < w2; i++) {
- xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
- }
- for (var _i = 0; _i < h2; _i++) {
- var py = Math.floor(_i * yRatio) * w1Scanline;
- for (var j = 0; j < w2; j++) {
- oldIndex = py + xScaled[j];
- dest[newIndex++] = src[oldIndex++];
- dest[newIndex++] = src[oldIndex++];
- dest[newIndex++] = src[oldIndex++];
- newIndex += alpha01;
- }
- }
-}
-
-var ColorSpace = function () {
- function ColorSpace(name, numComps) {
- _classCallCheck(this, ColorSpace);
-
- if (this.constructor === ColorSpace) {
- (0, _util.unreachable)('Cannot initialize ColorSpace.');
- }
- this.name = name;
- this.numComps = numComps;
- }
-
- _createClass(ColorSpace, [{
- key: 'getRgb',
- value: function getRgb(src, srcOffset) {
- var rgb = new Uint8ClampedArray(3);
- this.getRgbItem(src, srcOffset, rgb, 0);
- return rgb;
- }
- }, {
- key: 'getRgbItem',
- value: function getRgbItem(src, srcOffset, dest, destOffset) {
- (0, _util.unreachable)('Should not call ColorSpace.getRgbItem');
- }
- }, {
- key: 'getRgbBuffer',
- value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
- (0, _util.unreachable)('Should not call ColorSpace.getRgbBuffer');
- }
- }, {
- key: 'getOutputLength',
- value: function getOutputLength(inputLength, alpha01) {
- (0, _util.unreachable)('Should not call ColorSpace.getOutputLength');
- }
- }, {
- key: 'isPassthrough',
- value: function isPassthrough(bits) {
- return false;
- }
- }, {
- key: 'fillRgb',
- value: function fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
- var count = originalWidth * originalHeight;
- var rgbBuf = null;
- var numComponentColors = 1 << bpc;
- var needsResizing = originalHeight !== height || originalWidth !== width;
- if (this.isPassthrough(bpc)) {
- rgbBuf = comps;
- } else if (this.numComps === 1 && count > numComponentColors && this.name !== 'DeviceGray' && this.name !== 'DeviceRGB') {
- var allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
- for (var i = 0; i < numComponentColors; i++) {
- allColors[i] = i;
- }
- var colorMap = new Uint8ClampedArray(numComponentColors * 3);
- this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
- if (!needsResizing) {
- var destPos = 0;
- for (var _i2 = 0; _i2 < count; ++_i2) {
- var key = comps[_i2] * 3;
- dest[destPos++] = colorMap[key];
- dest[destPos++] = colorMap[key + 1];
- dest[destPos++] = colorMap[key + 2];
- destPos += alpha01;
- }
- } else {
- rgbBuf = new Uint8Array(count * 3);
- var rgbPos = 0;
- for (var _i3 = 0; _i3 < count; ++_i3) {
- var _key = comps[_i3] * 3;
- rgbBuf[rgbPos++] = colorMap[_key];
- rgbBuf[rgbPos++] = colorMap[_key + 1];
- rgbBuf[rgbPos++] = colorMap[_key + 2];
- }
- }
- } else {
- if (!needsResizing) {
- this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
- } else {
- rgbBuf = new Uint8ClampedArray(count * 3);
- this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
- }
- }
- if (rgbBuf) {
- if (needsResizing) {
- resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
- } else {
- var _destPos = 0,
- _rgbPos = 0;
- for (var _i4 = 0, ii = width * actualHeight; _i4 < ii; _i4++) {
- dest[_destPos++] = rgbBuf[_rgbPos++];
- dest[_destPos++] = rgbBuf[_rgbPos++];
- dest[_destPos++] = rgbBuf[_rgbPos++];
- _destPos += alpha01;
- }
- }
- }
- }
- }, {
- key: 'usesZeroToOneRange',
- get: function get() {
- return (0, _util.shadow)(this, 'usesZeroToOneRange', true);
- }
- }], [{
- key: 'parse',
- value: function parse(cs, xref, res, pdfFunctionFactory) {
- var IR = this.parseToIR(cs, xref, res, pdfFunctionFactory);
- return this.fromIR(IR);
- }
- }, {
- key: 'fromIR',
- value: function fromIR(IR) {
- var name = Array.isArray(IR) ? IR[0] : IR;
- var whitePoint = void 0,
- blackPoint = void 0,
- gamma = void 0;
- switch (name) {
- case 'DeviceGrayCS':
- return this.singletons.gray;
- case 'DeviceRgbCS':
- return this.singletons.rgb;
- case 'DeviceCmykCS':
- return this.singletons.cmyk;
- case 'CalGrayCS':
- whitePoint = IR[1];
- blackPoint = IR[2];
- gamma = IR[3];
- return new CalGrayCS(whitePoint, blackPoint, gamma);
- case 'CalRGBCS':
- whitePoint = IR[1];
- blackPoint = IR[2];
- gamma = IR[3];
- var matrix = IR[4];
- return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
- case 'PatternCS':
- var basePatternCS = IR[1];
- if (basePatternCS) {
- basePatternCS = this.fromIR(basePatternCS);
- }
- return new PatternCS(basePatternCS);
- case 'IndexedCS':
- var baseIndexedCS = IR[1];
- var hiVal = IR[2];
- var lookup = IR[3];
- return new IndexedCS(this.fromIR(baseIndexedCS), hiVal, lookup);
- case 'AlternateCS':
- var numComps = IR[1];
- var alt = IR[2];
- var tintFn = IR[3];
- return new AlternateCS(numComps, this.fromIR(alt), tintFn);
- case 'LabCS':
- whitePoint = IR[1];
- blackPoint = IR[2];
- var range = IR[3];
- return new LabCS(whitePoint, blackPoint, range);
- default:
- throw new _util.FormatError('Unknown colorspace name: ' + name);
- }
- }
- }, {
- key: 'parseToIR',
- value: function parseToIR(cs, xref) {
- var res = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
- var pdfFunctionFactory = arguments[3];
-
- cs = xref.fetchIfRef(cs);
- if ((0, _primitives.isName)(cs)) {
- switch (cs.name) {
- case 'DeviceGray':
- case 'G':
- return 'DeviceGrayCS';
- case 'DeviceRGB':
- case 'RGB':
- return 'DeviceRgbCS';
- case 'DeviceCMYK':
- case 'CMYK':
- return 'DeviceCmykCS';
- case 'Pattern':
- return ['PatternCS', null];
- default:
- if ((0, _primitives.isDict)(res)) {
- var colorSpaces = res.get('ColorSpace');
- if ((0, _primitives.isDict)(colorSpaces)) {
- var resCS = colorSpaces.get(cs.name);
- if (resCS) {
- if ((0, _primitives.isName)(resCS)) {
- return this.parseToIR(resCS, xref, res, pdfFunctionFactory);
- }
- cs = resCS;
- break;
- }
- }
- }
- throw new _util.FormatError('unrecognized colorspace ' + cs.name);
- }
- }
- if (Array.isArray(cs)) {
- var mode = xref.fetchIfRef(cs[0]).name;
- var numComps = void 0,
- params = void 0,
- alt = void 0,
- whitePoint = void 0,
- blackPoint = void 0,
- gamma = void 0;
- switch (mode) {
- case 'DeviceGray':
- case 'G':
- return 'DeviceGrayCS';
- case 'DeviceRGB':
- case 'RGB':
- return 'DeviceRgbCS';
- case 'DeviceCMYK':
- case 'CMYK':
- return 'DeviceCmykCS';
- case 'CalGray':
- params = xref.fetchIfRef(cs[1]);
- whitePoint = params.getArray('WhitePoint');
- blackPoint = params.getArray('BlackPoint');
- gamma = params.get('Gamma');
- return ['CalGrayCS', whitePoint, blackPoint, gamma];
- case 'CalRGB':
- params = xref.fetchIfRef(cs[1]);
- whitePoint = params.getArray('WhitePoint');
- blackPoint = params.getArray('BlackPoint');
- gamma = params.getArray('Gamma');
- var matrix = params.getArray('Matrix');
- return ['CalRGBCS', whitePoint, blackPoint, gamma, matrix];
- case 'ICCBased':
- var stream = xref.fetchIfRef(cs[1]);
- var dict = stream.dict;
- numComps = dict.get('N');
- alt = dict.get('Alternate');
- if (alt) {
- var altIR = this.parseToIR(alt, xref, res, pdfFunctionFactory);
- var altCS = this.fromIR(altIR, pdfFunctionFactory);
- if (altCS.numComps === numComps) {
- return altIR;
- }
- (0, _util.warn)('ICCBased color space: Ignoring incorrect /Alternate entry.');
- }
- if (numComps === 1) {
- return 'DeviceGrayCS';
- } else if (numComps === 3) {
- return 'DeviceRgbCS';
- } else if (numComps === 4) {
- return 'DeviceCmykCS';
- }
- break;
- case 'Pattern':
- var basePatternCS = cs[1] || null;
- if (basePatternCS) {
- basePatternCS = this.parseToIR(basePatternCS, xref, res, pdfFunctionFactory);
- }
- return ['PatternCS', basePatternCS];
- case 'Indexed':
- case 'I':
- var baseIndexedCS = this.parseToIR(cs[1], xref, res, pdfFunctionFactory);
- var hiVal = xref.fetchIfRef(cs[2]) + 1;
- var lookup = xref.fetchIfRef(cs[3]);
- if ((0, _primitives.isStream)(lookup)) {
- lookup = lookup.getBytes();
- }
- return ['IndexedCS', baseIndexedCS, hiVal, lookup];
- case 'Separation':
- case 'DeviceN':
- var name = xref.fetchIfRef(cs[1]);
- numComps = Array.isArray(name) ? name.length : 1;
- alt = this.parseToIR(cs[2], xref, res, pdfFunctionFactory);
- var tintFn = pdfFunctionFactory.create(xref.fetchIfRef(cs[3]));
- return ['AlternateCS', numComps, alt, tintFn];
- case 'Lab':
- params = xref.fetchIfRef(cs[1]);
- whitePoint = params.getArray('WhitePoint');
- blackPoint = params.getArray('BlackPoint');
- var range = params.getArray('Range');
- return ['LabCS', whitePoint, blackPoint, range];
- default:
- throw new _util.FormatError('unimplemented color space object "' + mode + '"');
- }
- }
- throw new _util.FormatError('unrecognized color space object: "' + cs + '"');
- }
- }, {
- key: 'isDefaultDecode',
- value: function isDefaultDecode(decode, n) {
- if (!Array.isArray(decode)) {
- return true;
- }
- if (n * 2 !== decode.length) {
- (0, _util.warn)('The decode map is not the correct length');
- return true;
- }
- for (var i = 0, ii = decode.length; i < ii; i += 2) {
- if (decode[i] !== 0 || decode[i + 1] !== 1) {
- return false;
- }
- }
- return true;
- }
- }, {
- key: 'singletons',
- get: function get() {
- return (0, _util.shadow)(this, 'singletons', {
- get gray() {
- return (0, _util.shadow)(this, 'gray', new DeviceGrayCS());
- },
- get rgb() {
- return (0, _util.shadow)(this, 'rgb', new DeviceRgbCS());
- },
- get cmyk() {
- return (0, _util.shadow)(this, 'cmyk', new DeviceCmykCS());
- }
- });
- }
- }]);
-
- return ColorSpace;
-}();
-
-var AlternateCS = function (_ColorSpace) {
- _inherits(AlternateCS, _ColorSpace);
-
- function AlternateCS(numComps, base, tintFn) {
- _classCallCheck(this, AlternateCS);
-
- var _this = _possibleConstructorReturn(this, (AlternateCS.__proto__ || Object.getPrototypeOf(AlternateCS)).call(this, 'Alternate', numComps));
-
- _this.base = base;
- _this.tintFn = tintFn;
- _this.tmpBuf = new Float32Array(base.numComps);
- return _this;
- }
-
- _createClass(AlternateCS, [{
- key: 'getRgbItem',
- value: function getRgbItem(src, srcOffset, dest, destOffset) {
- var tmpBuf = this.tmpBuf;
- this.tintFn(src, srcOffset, tmpBuf, 0);
- this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
- }
- }, {
- key: 'getRgbBuffer',
- value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
- var tintFn = this.tintFn;
- var base = this.base;
- var scale = 1 / ((1 << bits) - 1);
- var baseNumComps = base.numComps;
- var usesZeroToOneRange = base.usesZeroToOneRange;
- var isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
- var pos = isPassthrough ? destOffset : 0;
- var baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
- var numComps = this.numComps;
- var scaled = new Float32Array(numComps);
- var tinted = new Float32Array(baseNumComps);
- var i = void 0,
- j = void 0;
- for (i = 0; i < count; i++) {
- for (j = 0; j < numComps; j++) {
- scaled[j] = src[srcOffset++] * scale;
- }
- tintFn(scaled, 0, tinted, 0);
- if (usesZeroToOneRange) {
- for (j = 0; j < baseNumComps; j++) {
- baseBuf[pos++] = tinted[j] * 255;
- }
- } else {
- base.getRgbItem(tinted, 0, baseBuf, pos);
- pos += baseNumComps;
- }
- }
- if (!isPassthrough) {
- base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
- }
- }
- }, {
- key: 'getOutputLength',
- value: function getOutputLength(inputLength, alpha01) {
- return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
- }
- }, {
- key: 'isDefaultDecode',
- value: function isDefaultDecode(decodeMap) {
- return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
- }
- }]);
-
- return AlternateCS;
-}(ColorSpace);
-
-var PatternCS = function (_ColorSpace2) {
- _inherits(PatternCS, _ColorSpace2);
-
- function PatternCS(baseCS) {
- _classCallCheck(this, PatternCS);
-
- var _this2 = _possibleConstructorReturn(this, (PatternCS.__proto__ || Object.getPrototypeOf(PatternCS)).call(this, 'Pattern', null));
-
- _this2.base = baseCS;
- return _this2;
- }
-
- return PatternCS;
-}(ColorSpace);
-
-var IndexedCS = function (_ColorSpace3) {
- _inherits(IndexedCS, _ColorSpace3);
-
- function IndexedCS(base, highVal, lookup) {
- _classCallCheck(this, IndexedCS);
-
- var _this3 = _possibleConstructorReturn(this, (IndexedCS.__proto__ || Object.getPrototypeOf(IndexedCS)).call(this, 'Indexed', 1));
-
- _this3.base = base;
- _this3.highVal = highVal;
- var baseNumComps = base.numComps;
- var length = baseNumComps * highVal;
- if ((0, _primitives.isStream)(lookup)) {
- _this3.lookup = new Uint8Array(length);
- var bytes = lookup.getBytes(length);
- _this3.lookup.set(bytes);
- } else if ((0, _util.isString)(lookup)) {
- _this3.lookup = new Uint8Array(length);
- for (var i = 0; i < length; ++i) {
- _this3.lookup[i] = lookup.charCodeAt(i);
- }
- } else if (lookup instanceof Uint8Array) {
- _this3.lookup = lookup;
- } else {
- throw new _util.FormatError('Unrecognized lookup table: ' + lookup);
- }
- return _this3;
- }
-
- _createClass(IndexedCS, [{
- key: 'getRgbItem',
- value: function getRgbItem(src, srcOffset, dest, destOffset) {
- var numComps = this.base.numComps;
- var start = src[srcOffset] * numComps;
- this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
- }
- }, {
- key: 'getRgbBuffer',
- value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
- var base = this.base;
- var numComps = base.numComps;
- var outputDelta = base.getOutputLength(numComps, alpha01);
- var lookup = this.lookup;
- for (var i = 0; i < count; ++i) {
- var lookupPos = src[srcOffset++] * numComps;
- base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
- destOffset += outputDelta;
- }
- }
- }, {
- key: 'getOutputLength',
- value: function getOutputLength(inputLength, alpha01) {
- return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
- }
- }, {
- key: 'isDefaultDecode',
- value: function isDefaultDecode(decodeMap) {
- return true;
- }
- }]);
-
- return IndexedCS;
-}(ColorSpace);
-
-var DeviceGrayCS = function (_ColorSpace4) {
- _inherits(DeviceGrayCS, _ColorSpace4);
-
- function DeviceGrayCS() {
- _classCallCheck(this, DeviceGrayCS);
-
- return _possibleConstructorReturn(this, (DeviceGrayCS.__proto__ || Object.getPrototypeOf(DeviceGrayCS)).call(this, 'DeviceGray', 1));
- }
-
- _createClass(DeviceGrayCS, [{
- key: 'getRgbItem',
- value: function getRgbItem(src, srcOffset, dest, destOffset) {
- var c = src[srcOffset] * 255;
- dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
- }
- }, {
- key: 'getRgbBuffer',
- value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
- var scale = 255 / ((1 << bits) - 1);
- var j = srcOffset,
- q = destOffset;
- for (var i = 0; i < count; ++i) {
- var c = scale * src[j++];
- dest[q++] = c;
- dest[q++] = c;
- dest[q++] = c;
- q += alpha01;
- }
- }
- }, {
- key: 'getOutputLength',
- value: function getOutputLength(inputLength, alpha01) {
- return inputLength * (3 + alpha01);
- }
- }, {
- key: 'isDefaultDecode',
- value: function isDefaultDecode(decodeMap) {
- return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
- }
- }]);
-
- return DeviceGrayCS;
-}(ColorSpace);
-
-var DeviceRgbCS = function (_ColorSpace5) {
- _inherits(DeviceRgbCS, _ColorSpace5);
-
- function DeviceRgbCS() {
- _classCallCheck(this, DeviceRgbCS);
-
- return _possibleConstructorReturn(this, (DeviceRgbCS.__proto__ || Object.getPrototypeOf(DeviceRgbCS)).call(this, 'DeviceRGB', 3));
- }
-
- _createClass(DeviceRgbCS, [{
- key: 'getRgbItem',
- value: function getRgbItem(src, srcOffset, dest, destOffset) {
- dest[destOffset] = src[srcOffset] * 255;
- dest[destOffset + 1] = src[srcOffset + 1] * 255;
- dest[destOffset + 2] = src[srcOffset + 2] * 255;
- }
- }, {
- key: 'getRgbBuffer',
- value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
- if (bits === 8 && alpha01 === 0) {
- dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
- return;
- }
- var scale = 255 / ((1 << bits) - 1);
- var j = srcOffset,
- q = destOffset;
- for (var i = 0; i < count; ++i) {
- dest[q++] = scale * src[j++];
- dest[q++] = scale * src[j++];
- dest[q++] = scale * src[j++];
- q += alpha01;
- }
- }
- }, {
- key: 'getOutputLength',
- value: function getOutputLength(inputLength, alpha01) {
- return inputLength * (3 + alpha01) / 3 | 0;
- }
- }, {
- key: 'isPassthrough',
- value: function isPassthrough(bits) {
- return bits === 8;
- }
- }, {
- key: 'isDefaultDecode',
- value: function isDefaultDecode(decodeMap) {
- return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
- }
- }]);
-
- return DeviceRgbCS;
-}(ColorSpace);
-
-var DeviceCmykCS = function DeviceCmykCSClosure() {
- function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
- var c = src[srcOffset] * srcScale;
- var m = src[srcOffset + 1] * srcScale;
- var y = src[srcOffset + 2] * srcScale;
- var k = src[srcOffset + 3] * srcScale;
- dest[destOffset] = 255 + c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k + -285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y + -17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) + k * (-21.86122147463605 * k - 189.48180835922747);
- dest[destOffset + 1] = 255 + c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k + -79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) + k * (-20.737325471181034 * k - 187.80453709719578);
- dest[destOffset + 2] = 255 + c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k + -14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k + -193.58209356861505) + k * (-22.33816807309886 * k - 180.12613974708367);
- }
-
- var DeviceCmykCS = function (_ColorSpace6) {
- _inherits(DeviceCmykCS, _ColorSpace6);
-
- function DeviceCmykCS() {
- _classCallCheck(this, DeviceCmykCS);
-
- return _possibleConstructorReturn(this, (DeviceCmykCS.__proto__ || Object.getPrototypeOf(DeviceCmykCS)).call(this, 'DeviceCMYK', 4));
- }
-
- _createClass(DeviceCmykCS, [{
- key: 'getRgbItem',
- value: function getRgbItem(src, srcOffset, dest, destOffset) {
- convertToRgb(src, srcOffset, 1, dest, destOffset);
- }
- }, {
- key: 'getRgbBuffer',
- value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
- var scale = 1 / ((1 << bits) - 1);
- for (var i = 0; i < count; i++) {
- convertToRgb(src, srcOffset, scale, dest, destOffset);
- srcOffset += 4;
- destOffset += 3 + alpha01;
- }
- }
- }, {
- key: 'getOutputLength',
- value: function getOutputLength(inputLength, alpha01) {
- return inputLength / 4 * (3 + alpha01) | 0;
- }
- }, {
- key: 'isDefaultDecode',
- value: function isDefaultDecode(decodeMap) {
- return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
- }
- }]);
-
- return DeviceCmykCS;
- }(ColorSpace);
-
- return DeviceCmykCS;
-}();
-var CalGrayCS = function CalGrayCSClosure() {
- function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
- var A = src[srcOffset] * scale;
- var AG = Math.pow(A, cs.G);
- var L = cs.YW * AG;
- var val = Math.max(295.8 * Math.pow(L, 0.333333333333333333) - 40.8, 0);
- dest[destOffset] = val;
- dest[destOffset + 1] = val;
- dest[destOffset + 2] = val;
- }
-
- var CalGrayCS = function (_ColorSpace7) {
- _inherits(CalGrayCS, _ColorSpace7);
-
- function CalGrayCS(whitePoint, blackPoint, gamma) {
- _classCallCheck(this, CalGrayCS);
-
- var _this7 = _possibleConstructorReturn(this, (CalGrayCS.__proto__ || Object.getPrototypeOf(CalGrayCS)).call(this, 'CalGray', 1));
-
- if (!whitePoint) {
- throw new _util.FormatError('WhitePoint missing - required for color space CalGray');
- }
- blackPoint = blackPoint || [0, 0, 0];
- gamma = gamma || 1;
- _this7.XW = whitePoint[0];
- _this7.YW = whitePoint[1];
- _this7.ZW = whitePoint[2];
- _this7.XB = blackPoint[0];
- _this7.YB = blackPoint[1];
- _this7.ZB = blackPoint[2];
- _this7.G = gamma;
- if (_this7.XW < 0 || _this7.ZW < 0 || _this7.YW !== 1) {
- throw new _util.FormatError('Invalid WhitePoint components for ' + _this7.name + ', no fallback available');
- }
- if (_this7.XB < 0 || _this7.YB < 0 || _this7.ZB < 0) {
- (0, _util.info)('Invalid BlackPoint for ' + _this7.name + ', falling back to default.');
- _this7.XB = _this7.YB = _this7.ZB = 0;
- }
- if (_this7.XB !== 0 || _this7.YB !== 0 || _this7.ZB !== 0) {
- (0, _util.warn)(_this7.name + ', BlackPoint: XB: ' + _this7.XB + ', YB: ' + _this7.YB + ', ' + ('ZB: ' + _this7.ZB + ', only default values are supported.'));
- }
- if (_this7.G < 1) {
- (0, _util.info)('Invalid Gamma: ' + _this7.G + ' for ' + _this7.name + ', ' + 'falling back to default.');
- _this7.G = 1;
- }
- return _this7;
- }
-
- _createClass(CalGrayCS, [{
- key: 'getRgbItem',
- value: function getRgbItem(src, srcOffset, dest, destOffset) {
- convertToRgb(this, src, srcOffset, dest, destOffset, 1);
- }
- }, {
- key: 'getRgbBuffer',
- value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
- var scale = 1 / ((1 << bits) - 1);
- for (var i = 0; i < count; ++i) {
- convertToRgb(this, src, srcOffset, dest, destOffset, scale);
- srcOffset += 1;
- destOffset += 3 + alpha01;
- }
- }
- }, {
- key: 'getOutputLength',
- value: function getOutputLength(inputLength, alpha01) {
- return inputLength * (3 + alpha01);
- }
- }, {
- key: 'isDefaultDecode',
- value: function isDefaultDecode(decodeMap) {
- return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
- }
- }]);
-
- return CalGrayCS;
- }(ColorSpace);
-
- return CalGrayCS;
-}();
-var CalRGBCS = function CalRGBCSClosure() {
- var BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
- var BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]);
- var SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([3.2404542, -1.5371385, -0.4985314, -0.9692660, 1.8760108, 0.0415560, 0.0556434, -0.2040259, 1.0572252]);
- var FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
- var tempNormalizeMatrix = new Float32Array(3);
- var tempConvertMatrix1 = new Float32Array(3);
- var tempConvertMatrix2 = new Float32Array(3);
- var DECODE_L_CONSTANT = Math.pow((8 + 16) / 116, 3) / 8.0;
- function matrixProduct(a, b, result) {
- result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
- result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
- result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
- }
- function convertToFlat(sourceWhitePoint, LMS, result) {
- result[0] = LMS[0] * 1 / sourceWhitePoint[0];
- result[1] = LMS[1] * 1 / sourceWhitePoint[1];
- result[2] = LMS[2] * 1 / sourceWhitePoint[2];
- }
- function convertToD65(sourceWhitePoint, LMS, result) {
- var D65X = 0.95047;
- var D65Y = 1;
- var D65Z = 1.08883;
- result[0] = LMS[0] * D65X / sourceWhitePoint[0];
- result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
- result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
- }
- function sRGBTransferFunction(color) {
- if (color <= 0.0031308) {
- return adjustToRange(0, 1, 12.92 * color);
- }
- return adjustToRange(0, 1, (1 + 0.055) * Math.pow(color, 1 / 2.4) - 0.055);
- }
- function adjustToRange(min, max, value) {
- return Math.max(min, Math.min(max, value));
- }
- function decodeL(L) {
- if (L < 0) {
- return -decodeL(-L);
- }
- if (L > 8.0) {
- return Math.pow((L + 16) / 116, 3);
- }
- return L * DECODE_L_CONSTANT;
- }
- function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
- if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
- result[0] = XYZ_Flat[0];
- result[1] = XYZ_Flat[1];
- result[2] = XYZ_Flat[2];
- return;
- }
- var zeroDecodeL = decodeL(0);
- var X_DST = zeroDecodeL;
- var X_SRC = decodeL(sourceBlackPoint[0]);
- var Y_DST = zeroDecodeL;
- var Y_SRC = decodeL(sourceBlackPoint[1]);
- var Z_DST = zeroDecodeL;
- var Z_SRC = decodeL(sourceBlackPoint[2]);
- var X_Scale = (1 - X_DST) / (1 - X_SRC);
- var X_Offset = 1 - X_Scale;
- var Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
- var Y_Offset = 1 - Y_Scale;
- var Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
- var Z_Offset = 1 - Z_Scale;
- result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
- result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
- result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
- }
- function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
- if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
- result[0] = XYZ_In[0];
- result[1] = XYZ_In[1];
- result[2] = XYZ_In[2];
- return;
- }
- var LMS = result;
- matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
- var LMS_Flat = tempNormalizeMatrix;
- convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
- matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
- }
- function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
- var LMS = result;
- matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
- var LMS_D65 = tempNormalizeMatrix;
- convertToD65(sourceWhitePoint, LMS, LMS_D65);
- matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
- }
- function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
- var A = adjustToRange(0, 1, src[srcOffset] * scale);
- var B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
- var C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
- var AGR = Math.pow(A, cs.GR);
- var BGG = Math.pow(B, cs.GG);
- var CGB = Math.pow(C, cs.GB);
- var X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
- var Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
- var Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
- var XYZ = tempConvertMatrix1;
- XYZ[0] = X;
- XYZ[1] = Y;
- XYZ[2] = Z;
- var XYZ_Flat = tempConvertMatrix2;
- normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
- var XYZ_Black = tempConvertMatrix1;
- compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
- var XYZ_D65 = tempConvertMatrix2;
- normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
- var SRGB = tempConvertMatrix1;
- matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
- dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
- dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
- dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
- }
-
- var CalRGBCS = function (_ColorSpace8) {
- _inherits(CalRGBCS, _ColorSpace8);
-
- function CalRGBCS(whitePoint, blackPoint, gamma, matrix) {
- _classCallCheck(this, CalRGBCS);
-
- var _this8 = _possibleConstructorReturn(this, (CalRGBCS.__proto__ || Object.getPrototypeOf(CalRGBCS)).call(this, 'CalRGB', 3));
-
- if (!whitePoint) {
- throw new _util.FormatError('WhitePoint missing - required for color space CalRGB');
- }
- blackPoint = blackPoint || new Float32Array(3);
- gamma = gamma || new Float32Array([1, 1, 1]);
- matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
- var XW = whitePoint[0];
- var YW = whitePoint[1];
- var ZW = whitePoint[2];
- _this8.whitePoint = whitePoint;
- var XB = blackPoint[0];
- var YB = blackPoint[1];
- var ZB = blackPoint[2];
- _this8.blackPoint = blackPoint;
- _this8.GR = gamma[0];
- _this8.GG = gamma[1];
- _this8.GB = gamma[2];
- _this8.MXA = matrix[0];
- _this8.MYA = matrix[1];
- _this8.MZA = matrix[2];
- _this8.MXB = matrix[3];
- _this8.MYB = matrix[4];
- _this8.MZB = matrix[5];
- _this8.MXC = matrix[6];
- _this8.MYC = matrix[7];
- _this8.MZC = matrix[8];
- if (XW < 0 || ZW < 0 || YW !== 1) {
- throw new _util.FormatError('Invalid WhitePoint components for ' + _this8.name + ', no fallback available');
- }
- if (XB < 0 || YB < 0 || ZB < 0) {
- (0, _util.info)('Invalid BlackPoint for ' + _this8.name + ' [' + XB + ', ' + YB + ', ' + ZB + '], ' + 'falling back to default.');
- _this8.blackPoint = new Float32Array(3);
- }
- if (_this8.GR < 0 || _this8.GG < 0 || _this8.GB < 0) {
- (0, _util.info)('Invalid Gamma [' + _this8.GR + ', ' + _this8.GG + ', ' + _this8.GB + '] for ' + (_this8.name + ', falling back to default.'));
- _this8.GR = _this8.GG = _this8.GB = 1;
- }
- return _this8;
- }
-
- _createClass(CalRGBCS, [{
- key: 'getRgbItem',
- value: function getRgbItem(src, srcOffset, dest, destOffset) {
- convertToRgb(this, src, srcOffset, dest, destOffset, 1);
- }
- }, {
- key: 'getRgbBuffer',
- value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
- var scale = 1 / ((1 << bits) - 1);
- for (var i = 0; i < count; ++i) {
- convertToRgb(this, src, srcOffset, dest, destOffset, scale);
- srcOffset += 3;
- destOffset += 3 + alpha01;
- }
- }
- }, {
- key: 'getOutputLength',
- value: function getOutputLength(inputLength, alpha01) {
- return inputLength * (3 + alpha01) / 3 | 0;
- }
- }, {
- key: 'isDefaultDecode',
- value: function isDefaultDecode(decodeMap) {
- return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
- }
- }]);
-
- return CalRGBCS;
- }(ColorSpace);
-
- return CalRGBCS;
-}();
-var LabCS = function LabCSClosure() {
- function fn_g(x) {
- var result = void 0;
- if (x >= 6 / 29) {
- result = x * x * x;
- } else {
- result = 108 / 841 * (x - 4 / 29);
- }
- return result;
- }
- function decode(value, high1, low2, high2) {
- return low2 + value * (high2 - low2) / high1;
- }
- function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
- var Ls = src[srcOffset];
- var as = src[srcOffset + 1];
- var bs = src[srcOffset + 2];
- if (maxVal !== false) {
- Ls = decode(Ls, maxVal, 0, 100);
- as = decode(as, maxVal, cs.amin, cs.amax);
- bs = decode(bs, maxVal, cs.bmin, cs.bmax);
- }
- as = as > cs.amax ? cs.amax : as < cs.amin ? cs.amin : as;
- bs = bs > cs.bmax ? cs.bmax : bs < cs.bmin ? cs.bmin : bs;
- var M = (Ls + 16) / 116;
- var L = M + as / 500;
- var N = M - bs / 200;
- var X = cs.XW * fn_g(L);
- var Y = cs.YW * fn_g(M);
- var Z = cs.ZW * fn_g(N);
- var r = void 0,
- g = void 0,
- b = void 0;
- if (cs.ZW < 1) {
- r = X * 3.1339 + Y * -1.6170 + Z * -0.4906;
- g = X * -0.9785 + Y * 1.9160 + Z * 0.0333;
- b = X * 0.0720 + Y * -0.2290 + Z * 1.4057;
- } else {
- r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
- g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
- b = X * 0.0557 + Y * -0.2040 + Z * 1.0570;
- }
- dest[destOffset] = Math.sqrt(r) * 255;
- dest[destOffset + 1] = Math.sqrt(g) * 255;
- dest[destOffset + 2] = Math.sqrt(b) * 255;
- }
-
- var LabCS = function (_ColorSpace9) {
- _inherits(LabCS, _ColorSpace9);
-
- function LabCS(whitePoint, blackPoint, range) {
- _classCallCheck(this, LabCS);
-
- var _this9 = _possibleConstructorReturn(this, (LabCS.__proto__ || Object.getPrototypeOf(LabCS)).call(this, 'Lab', 3));
-
- if (!whitePoint) {
- throw new _util.FormatError('WhitePoint missing - required for color space Lab');
- }
- blackPoint = blackPoint || [0, 0, 0];
- range = range || [-100, 100, -100, 100];
- _this9.XW = whitePoint[0];
- _this9.YW = whitePoint[1];
- _this9.ZW = whitePoint[2];
- _this9.amin = range[0];
- _this9.amax = range[1];
- _this9.bmin = range[2];
- _this9.bmax = range[3];
- _this9.XB = blackPoint[0];
- _this9.YB = blackPoint[1];
- _this9.ZB = blackPoint[2];
- if (_this9.XW < 0 || _this9.ZW < 0 || _this9.YW !== 1) {
- throw new _util.FormatError('Invalid WhitePoint components, no fallback available');
- }
- if (_this9.XB < 0 || _this9.YB < 0 || _this9.ZB < 0) {
- (0, _util.info)('Invalid BlackPoint, falling back to default');
- _this9.XB = _this9.YB = _this9.ZB = 0;
- }
- if (_this9.amin > _this9.amax || _this9.bmin > _this9.bmax) {
- (0, _util.info)('Invalid Range, falling back to defaults');
- _this9.amin = -100;
- _this9.amax = 100;
- _this9.bmin = -100;
- _this9.bmax = 100;
- }
- return _this9;
- }
-
- _createClass(LabCS, [{
- key: 'getRgbItem',
- value: function getRgbItem(src, srcOffset, dest, destOffset) {
- convertToRgb(this, src, srcOffset, false, dest, destOffset);
- }
- }, {
- key: 'getRgbBuffer',
- value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
- var maxVal = (1 << bits) - 1;
- for (var i = 0; i < count; i++) {
- convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
- srcOffset += 3;
- destOffset += 3 + alpha01;
- }
- }
- }, {
- key: 'getOutputLength',
- value: function getOutputLength(inputLength, alpha01) {
- return inputLength * (3 + alpha01) / 3 | 0;
- }
- }, {
- key: 'isDefaultDecode',
- value: function isDefaultDecode(decodeMap) {
- return true;
- }
- }, {
- key: 'usesZeroToOneRange',
- get: function get() {
- return (0, _util.shadow)(this, 'usesZeroToOneRange', false);
- }
- }]);
-
- return LabCS;
- }(ColorSpace);
-
- return LabCS;
-}();
-exports.ColorSpace = ColorSpace;
-
-/***/ }),
-/* 152 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = undefined;
-
-var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _util = __w_pdfjs_require__(2);
-
-var _obj = __w_pdfjs_require__(137);
-
-var _primitives = __w_pdfjs_require__(138);
-
-var _colorspace = __w_pdfjs_require__(151);
-
-var _operator_list = __w_pdfjs_require__(153);
-
-var _stream = __w_pdfjs_require__(140);
-
-function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
-
-function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var AnnotationFactory = function () {
- function AnnotationFactory() {
- _classCallCheck(this, AnnotationFactory);
- }
-
- _createClass(AnnotationFactory, null, [{
- key: 'create',
- value: function create(xref, ref, pdfManager, idFactory) {
- return pdfManager.ensure(this, '_create', [xref, ref, pdfManager, idFactory]);
- }
- }, {
- key: '_create',
- value: function _create(xref, ref, pdfManager, idFactory) {
- var dict = xref.fetchIfRef(ref);
- if (!(0, _primitives.isDict)(dict)) {
- return;
- }
- var id = (0, _primitives.isRef)(ref) ? ref.toString() : 'annot_' + 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
- };
- switch (subtype) {
- case 'Link':
- return new LinkAnnotation(parameters);
- case 'Text':
- return new TextAnnotation(parameters);
- case 'Widget':
- var fieldType = (0, _util.getInheritableProperty)({
- dict: dict,
- key: 'FT'
- });
- fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
- switch (fieldType) {
- case 'Tx':
- return new TextWidgetAnnotation(parameters);
- case 'Btn':
- return new ButtonWidgetAnnotation(parameters);
- case 'Ch':
- return new ChoiceWidgetAnnotation(parameters);
- }
- (0, _util.warn)('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.');
- return new WidgetAnnotation(parameters);
- case 'Popup':
- return new PopupAnnotation(parameters);
- case 'Line':
- return new LineAnnotation(parameters);
- case 'Square':
- return new SquareAnnotation(parameters);
- case 'Circle':
- return new CircleAnnotation(parameters);
- case 'PolyLine':
- return new PolylineAnnotation(parameters);
- case 'Polygon':
- return new PolygonAnnotation(parameters);
- case 'Ink':
- return new InkAnnotation(parameters);
- case 'Highlight':
- return new HighlightAnnotation(parameters);
- case 'Underline':
- return new UnderlineAnnotation(parameters);
- case 'Squiggly':
- return new SquigglyAnnotation(parameters);
- case 'StrikeOut':
- return new StrikeOutAnnotation(parameters);
- case 'Stamp':
- return new StampAnnotation(parameters);
- case 'FileAttachment':
- return new FileAttachmentAnnotation(parameters);
- default:
- if (!subtype) {
- (0, _util.warn)('Annotation is missing the required /Subtype.');
- } else {
- (0, _util.warn)('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation.');
- }
- return new Annotation(parameters);
- }
- }
- }]);
-
- return AnnotationFactory;
-}();
-
-function getTransformMatrix(rect, bbox, matrix) {
- var bounds = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
- var minX = bounds[0];
- var minY = bounds[1];
- var maxX = bounds[2];
- var maxY = bounds[3];
- if (minX === maxX || minY === maxY) {
- return [1, 0, 0, 1, rect[0], rect[1]];
- }
- var xRatio = (rect[2] - rect[0]) / (maxX - minX);
- var yRatio = (rect[3] - rect[1]) / (maxY - minY);
- return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
-}
-
-var Annotation = function () {
- function Annotation(params) {
- _classCallCheck(this, Annotation);
-
- var dict = params.dict;
- this.setFlags(dict.get('F'));
- this.setRectangle(dict.getArray('Rect'));
- this.setColor(dict.getArray('C'));
- this.setBorderStyle(dict);
- this.setAppearance(dict);
- this.data = {
- annotationFlags: this.flags,
- borderStyle: this.borderStyle,
- color: this.color,
- hasAppearance: !!this.appearance,
- id: params.id,
- rect: this.rectangle,
- subtype: params.subtype
- };
- }
-
- _createClass(Annotation, [{
- key: '_hasFlag',
- value: function _hasFlag(flags, flag) {
- return !!(flags & flag);
- }
- }, {
- key: '_isViewable',
- value: function _isViewable(flags) {
- return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
- }
- }, {
- key: '_isPrintable',
- value: function _isPrintable(flags) {
- return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN);
- }
- }, {
- key: 'setFlags',
- value: function setFlags(flags) {
- this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
- }
- }, {
- key: 'hasFlag',
- value: function hasFlag(flag) {
- return this._hasFlag(this.flags, flag);
- }
- }, {
- key: 'setRectangle',
- value: function setRectangle(rectangle) {
- if (Array.isArray(rectangle) && rectangle.length === 4) {
- this.rectangle = _util.Util.normalizeRect(rectangle);
- } else {
- this.rectangle = [0, 0, 0, 0];
- }
- }
- }, {
- key: 'setColor',
- value: function setColor(color) {
- var rgbColor = new Uint8ClampedArray(3);
- if (!Array.isArray(color)) {
- this.color = rgbColor;
- return;
- }
- switch (color.length) {
- case 0:
- this.color = null;
- break;
- case 1:
- _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
- this.color = rgbColor;
- break;
- case 3:
- _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
- this.color = rgbColor;
- break;
- case 4:
- _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
- this.color = rgbColor;
- break;
- default:
- this.color = rgbColor;
- break;
- }
- }
- }, {
- key: 'setBorderStyle',
- value: function setBorderStyle(borderStyle) {
- this.borderStyle = new AnnotationBorderStyle();
- if (!(0, _primitives.isDict)(borderStyle)) {
- return;
- }
- if (borderStyle.has('BS')) {
- var dict = borderStyle.get('BS');
- var dictType = dict.get('Type');
- if (!dictType || (0, _primitives.isName)(dictType, 'Border')) {
- this.borderStyle.setWidth(dict.get('W'));
- this.borderStyle.setStyle(dict.get('S'));
- this.borderStyle.setDashArray(dict.getArray('D'));
- }
- } else if (borderStyle.has('Border')) {
- var array = borderStyle.getArray('Border');
- if (Array.isArray(array) && array.length >= 3) {
- this.borderStyle.setHorizontalCornerRadius(array[0]);
- this.borderStyle.setVerticalCornerRadius(array[1]);
- this.borderStyle.setWidth(array[2]);
- if (array.length === 4) {
- this.borderStyle.setDashArray(array[3]);
- }
- }
- } else {
- this.borderStyle.setWidth(0);
- }
- }
- }, {
- key: 'setAppearance',
- value: function setAppearance(dict) {
- this.appearance = null;
- var appearanceStates = dict.get('AP');
- if (!(0, _primitives.isDict)(appearanceStates)) {
- return;
- }
- var normalAppearanceState = appearanceStates.get('N');
- if ((0, _primitives.isStream)(normalAppearanceState)) {
- this.appearance = normalAppearanceState;
- return;
- }
- if (!(0, _primitives.isDict)(normalAppearanceState)) {
- return;
- }
- var as = dict.get('AS');
- if (!(0, _primitives.isName)(as) || !normalAppearanceState.has(as.name)) {
- return;
- }
- 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;
- }
- var objectLoader = new _obj.ObjectLoader(resources, keys, resources.xref);
- return objectLoader.load().then(function () {
- return resources;
- });
- });
- }
- }, {
- key: 'getOperatorList',
- value: function getOperatorList(evaluator, task, renderForms) {
- var _this = this;
-
- if (!this.appearance) {
- return Promise.resolve(new _operator_list.OperatorList());
- }
- var data = this.data;
- var appearanceDict = this.appearance.dict;
- var resourcesPromise = this.loadResources(['ExtGState', 'ColorSpace', 'Pattern', 'Shading', 'XObject', 'Font']);
- var bbox = appearanceDict.getArray('BBox') || [0, 0, 1, 1];
- var matrix = appearanceDict.getArray('Matrix') || [1, 0, 0, 1, 0, 0];
- var transform = getTransformMatrix(data.rect, bbox, matrix);
- return resourcesPromise.then(function (resources) {
- var opList = new _operator_list.OperatorList();
- opList.addOp(_util.OPS.beginAnnotation, [data.rect, transform, matrix]);
- return evaluator.getOperatorList({
- stream: _this.appearance,
- task: task,
- resources: resources,
- operatorList: opList
- }).then(function () {
- opList.addOp(_util.OPS.endAnnotation, []);
- _this.appearance.reset();
- return opList;
- });
- });
- }
- }, {
- key: 'viewable',
- get: function get() {
- if (this.flags === 0) {
- return true;
- }
- return this._isViewable(this.flags);
- }
- }, {
- key: 'printable',
- get: function get() {
- if (this.flags === 0) {
- return false;
- }
- return this._isPrintable(this.flags);
- }
- }]);
-
- return Annotation;
-}();
-
-var AnnotationBorderStyle = function () {
- function AnnotationBorderStyle() {
- _classCallCheck(this, AnnotationBorderStyle);
-
- this.width = 1;
- this.style = _util.AnnotationBorderStyleType.SOLID;
- this.dashArray = [3];
- this.horizontalCornerRadius = 0;
- this.verticalCornerRadius = 0;
- }
-
- _createClass(AnnotationBorderStyle, [{
- key: 'setWidth',
- value: function setWidth(width) {
- if (Number.isInteger(width)) {
- this.width = width;
- }
- }
- }, {
- key: 'setStyle',
- value: function setStyle(style) {
- if (!style) {
- return;
- }
- switch (style.name) {
- case 'S':
- this.style = _util.AnnotationBorderStyleType.SOLID;
- break;
- case 'D':
- this.style = _util.AnnotationBorderStyleType.DASHED;
- break;
- case 'B':
- this.style = _util.AnnotationBorderStyleType.BEVELED;
- break;
- case 'I':
- this.style = _util.AnnotationBorderStyleType.INSET;
- break;
- case 'U':
- this.style = _util.AnnotationBorderStyleType.UNDERLINE;
- break;
- default:
- break;
- }
- }
- }, {
- key: 'setDashArray',
- value: function setDashArray(dashArray) {
- if (Array.isArray(dashArray) && dashArray.length > 0) {
- var isValid = true;
- var allZeros = true;
- for (var i = 0, len = dashArray.length; i < len; i++) {
- var element = dashArray[i];
- var validNumber = +element >= 0;
- if (!validNumber) {
- isValid = false;
- break;
- } else if (element > 0) {
- allZeros = false;
- }
- }
- if (isValid && !allZeros) {
- this.dashArray = dashArray;
- } else {
- this.width = 0;
- }
- } else if (dashArray) {
- this.width = 0;
- }
- }
- }, {
- key: 'setHorizontalCornerRadius',
- value: function setHorizontalCornerRadius(radius) {
- if (Number.isInteger(radius)) {
- this.horizontalCornerRadius = radius;
- }
- }
- }, {
- key: 'setVerticalCornerRadius',
- value: function setVerticalCornerRadius(radius) {
- if (Number.isInteger(radius)) {
- this.verticalCornerRadius = radius;
- }
- }
- }]);
-
- return AnnotationBorderStyle;
-}();
-
-var WidgetAnnotation = function (_Annotation) {
- _inherits(WidgetAnnotation, _Annotation);
-
- function WidgetAnnotation(params) {
- _classCallCheck(this, WidgetAnnotation);
-
- var _this2 = _possibleConstructorReturn(this, (WidgetAnnotation.__proto__ || Object.getPrototypeOf(WidgetAnnotation)).call(this, params));
-
- var dict = params.dict;
- var data = _this2.data;
- data.annotationType = _util.AnnotationType.WIDGET;
- data.fieldName = _this2._constructFieldName(dict);
- data.fieldValue = (0, _util.getInheritableProperty)({
- dict: dict,
- key: 'V',
- getArray: true
- });
- data.alternativeText = (0, _util.stringToPDFString)(dict.get('TU') || '');
- data.defaultAppearance = (0, _util.getInheritableProperty)({
- dict: dict,
- key: 'DA'
- }) || '';
- var fieldType = (0, _util.getInheritableProperty)({
- dict: dict,
- key: 'FT'
- });
- data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
- _this2.fieldResources = (0, _util.getInheritableProperty)({
- dict: dict,
- key: 'DR'
- }) || _primitives.Dict.empty;
- data.fieldFlags = (0, _util.getInheritableProperty)({
- dict: dict,
- key: 'Ff'
- });
- if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
- data.fieldFlags = 0;
- }
- data.readOnly = _this2.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
- if (data.fieldType === 'Sig') {
- _this2.setFlags(_util.AnnotationFlag.HIDDEN);
- }
- return _this2;
- }
-
- _createClass(WidgetAnnotation, [{
- key: '_constructFieldName',
- value: function _constructFieldName(dict) {
- if (!dict.has('T') && !dict.has('Parent')) {
- (0, _util.warn)('Unknown field name, falling back to empty field name.');
- return '';
- }
- if (!dict.has('Parent')) {
- return (0, _util.stringToPDFString)(dict.get('T'));
- }
- var fieldName = [];
- if (dict.has('T')) {
- fieldName.unshift((0, _util.stringToPDFString)(dict.get('T')));
- }
- var loopDict = dict;
- while (loopDict.has('Parent')) {
- loopDict = loopDict.get('Parent');
- if (!(0, _primitives.isDict)(loopDict)) {
- break;
- }
- if (loopDict.has('T')) {
- fieldName.unshift((0, _util.stringToPDFString)(loopDict.get('T')));
- }
- }
- return fieldName.join('.');
- }
- }, {
- key: 'hasFieldFlag',
- value: function hasFieldFlag(flag) {
- return !!(this.data.fieldFlags & flag);
- }
- }, {
- key: 'getOperatorList',
- value: function getOperatorList(evaluator, task, renderForms) {
- if (renderForms) {
- return Promise.resolve(new _operator_list.OperatorList());
- }
- return _get(WidgetAnnotation.prototype.__proto__ || Object.getPrototypeOf(WidgetAnnotation.prototype), 'getOperatorList', this).call(this, evaluator, task, renderForms);
- }
- }]);
-
- return WidgetAnnotation;
-}(Annotation);
-
-var TextWidgetAnnotation = function (_WidgetAnnotation) {
- _inherits(TextWidgetAnnotation, _WidgetAnnotation);
-
- function TextWidgetAnnotation(params) {
- _classCallCheck(this, TextWidgetAnnotation);
-
- var _this3 = _possibleConstructorReturn(this, (TextWidgetAnnotation.__proto__ || Object.getPrototypeOf(TextWidgetAnnotation)).call(this, params));
-
- var dict = params.dict;
- _this3.data.fieldValue = (0, _util.stringToPDFString)(_this3.data.fieldValue || '');
- var alignment = (0, _util.getInheritableProperty)({
- dict: dict,
- key: 'Q'
- });
- if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
- alignment = null;
- }
- _this3.data.textAlignment = alignment;
- var maximumLength = (0, _util.getInheritableProperty)({
- dict: dict,
- key: 'MaxLen'
- });
- if (!Number.isInteger(maximumLength) || maximumLength < 0) {
- 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;
- }
-
- _createClass(TextWidgetAnnotation, [{
- key: 'getOperatorList',
- value: function getOperatorList(evaluator, task, renderForms) {
- if (renderForms || this.appearance) {
- return _get(TextWidgetAnnotation.prototype.__proto__ || Object.getPrototypeOf(TextWidgetAnnotation.prototype), 'getOperatorList', this).call(this, evaluator, task, renderForms);
- }
- var operatorList = new _operator_list.OperatorList();
- if (!this.data.defaultAppearance) {
- return Promise.resolve(operatorList);
- }
- var stream = new _stream.Stream((0, _util.stringToBytes)(this.data.defaultAppearance));
- return evaluator.getOperatorList({
- stream: stream,
- task: task,
- resources: this.fieldResources,
- operatorList: operatorList
- }).then(function () {
- return operatorList;
- });
- }
- }]);
-
- return TextWidgetAnnotation;
-}(WidgetAnnotation);
-
-var ButtonWidgetAnnotation = function (_WidgetAnnotation2) {
- _inherits(ButtonWidgetAnnotation, _WidgetAnnotation2);
-
- function ButtonWidgetAnnotation(params) {
- _classCallCheck(this, ButtonWidgetAnnotation);
-
- var _this4 = _possibleConstructorReturn(this, (ButtonWidgetAnnotation.__proto__ || Object.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);
- } else {
- (0, _util.warn)('Invalid field flags for button widget annotation');
- }
- return _this4;
- }
-
- _createClass(ButtonWidgetAnnotation, [{
- key: '_processCheckBox',
- value: function _processCheckBox(params) {
- if ((0, _primitives.isName)(this.data.fieldValue)) {
- this.data.fieldValue = this.data.fieldValue.name;
- }
- var customAppearance = params.dict.get('AP');
- if (!(0, _primitives.isDict)(customAppearance)) {
- return;
- }
- var exportValueOptionsDict = customAppearance.get('D');
- if (!(0, _primitives.isDict)(exportValueOptionsDict)) {
- return;
- }
- var exportValues = exportValueOptionsDict.getKeys();
- var hasCorrectOptionCount = exportValues.length === 2;
- if (!hasCorrectOptionCount) {
- return;
- }
- this.data.exportValue = exportValues[0] === 'Off' ? exportValues[1] : exportValues[0];
- }
- }, {
- key: '_processRadioButton',
- value: function _processRadioButton(params) {
- this.data.fieldValue = this.data.buttonValue = null;
- var fieldParent = params.dict.get('Parent');
- if ((0, _primitives.isDict)(fieldParent) && fieldParent.has('V')) {
- var fieldParentValue = fieldParent.get('V');
- if ((0, _primitives.isName)(fieldParentValue)) {
- this.data.fieldValue = fieldParentValue.name;
- }
- }
- var appearanceStates = params.dict.get('AP');
- if (!(0, _primitives.isDict)(appearanceStates)) {
- return;
- }
- var normalAppearanceState = appearanceStates.get('N');
- if (!(0, _primitives.isDict)(normalAppearanceState)) {
- return;
- }
- var keys = normalAppearanceState.getKeys();
- for (var i = 0, ii = keys.length; i < ii; i++) {
- if (keys[i] !== 'Off') {
- this.data.buttonValue = keys[i];
- break;
- }
- }
- }
- }, {
- key: '_processPushButton',
- value: function _processPushButton(params) {
- if (!params.dict.has('A')) {
- (0, _util.warn)('Push buttons without action dictionaries are not supported');
- return;
- }
- _obj.Catalog.parseDestDictionary({
- destDict: params.dict,
- resultObj: this.data,
- docBaseUrl: params.pdfManager.docBaseUrl
- });
- }
- }]);
-
- return ButtonWidgetAnnotation;
-}(WidgetAnnotation);
-
-var ChoiceWidgetAnnotation = function (_WidgetAnnotation3) {
- _inherits(ChoiceWidgetAnnotation, _WidgetAnnotation3);
-
- function ChoiceWidgetAnnotation(params) {
- _classCallCheck(this, ChoiceWidgetAnnotation);
-
- var _this5 = _possibleConstructorReturn(this, (ChoiceWidgetAnnotation.__proto__ || Object.getPrototypeOf(ChoiceWidgetAnnotation)).call(this, params));
-
- _this5.data.options = [];
- var options = (0, _util.getInheritableProperty)({
- dict: params.dict,
- key: 'Opt'
- });
- if (Array.isArray(options)) {
- var xref = params.xref;
- 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] = {
- 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];
- }
- _this5.data.combo = _this5.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
- _this5.data.multiSelect = _this5.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
- return _this5;
- }
-
- return ChoiceWidgetAnnotation;
-}(WidgetAnnotation);
-
-var TextAnnotation = function (_Annotation2) {
- _inherits(TextAnnotation, _Annotation2);
-
- function TextAnnotation(parameters) {
- _classCallCheck(this, TextAnnotation);
-
- var DEFAULT_ICON_SIZE = 22;
-
- var _this6 = _possibleConstructorReturn(this, (TextAnnotation.__proto__ || Object.getPrototypeOf(TextAnnotation)).call(this, parameters));
-
- _this6.data.annotationType = _util.AnnotationType.TEXT;
- if (_this6.data.hasAppearance) {
- _this6.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';
- }
- _this6._preparePopup(parameters.dict);
- return _this6;
- }
-
- return TextAnnotation;
-}(Annotation);
-
-var LinkAnnotation = function (_Annotation3) {
- _inherits(LinkAnnotation, _Annotation3);
-
- function LinkAnnotation(params) {
- _classCallCheck(this, LinkAnnotation);
-
- var _this7 = _possibleConstructorReturn(this, (LinkAnnotation.__proto__ || Object.getPrototypeOf(LinkAnnotation)).call(this, params));
-
- _this7.data.annotationType = _util.AnnotationType.LINK;
- _obj.Catalog.parseDestDictionary({
- destDict: params.dict,
- resultObj: _this7.data,
- docBaseUrl: params.pdfManager.docBaseUrl
- });
- return _this7;
- }
-
- return LinkAnnotation;
-}(Annotation);
-
-var PopupAnnotation = function (_Annotation4) {
- _inherits(PopupAnnotation, _Annotation4);
-
- function PopupAnnotation(parameters) {
- _classCallCheck(this, PopupAnnotation);
-
- var _this8 = _possibleConstructorReturn(this, (PopupAnnotation.__proto__ || Object.getPrototypeOf(PopupAnnotation)).call(this, parameters));
-
- _this8.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);
- }
- 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') || '');
- if (!parentItem.has('C')) {
- _this8.data.color = null;
- } else {
- _this8.setColor(parentItem.getArray('C'));
- _this8.data.color = _this8.color;
- }
- if (!_this8.viewable) {
- var parentFlags = parentItem.get('F');
- if (_this8._isViewable(parentFlags)) {
- _this8.setFlags(parentFlags);
- }
- }
- return _this8;
- }
-
- return PopupAnnotation;
-}(Annotation);
-
-var LineAnnotation = function (_Annotation5) {
- _inherits(LineAnnotation, _Annotation5);
-
- function LineAnnotation(parameters) {
- _classCallCheck(this, LineAnnotation);
-
- var _this9 = _possibleConstructorReturn(this, (LineAnnotation.__proto__ || Object.getPrototypeOf(LineAnnotation)).call(this, parameters));
-
- _this9.data.annotationType = _util.AnnotationType.LINE;
- var dict = parameters.dict;
- _this9.data.lineCoordinates = _util.Util.normalizeRect(dict.getArray('L'));
- _this9._preparePopup(dict);
- return _this9;
- }
-
- return LineAnnotation;
-}(Annotation);
-
-var SquareAnnotation = function (_Annotation6) {
- _inherits(SquareAnnotation, _Annotation6);
-
- function SquareAnnotation(parameters) {
- _classCallCheck(this, SquareAnnotation);
-
- var _this10 = _possibleConstructorReturn(this, (SquareAnnotation.__proto__ || Object.getPrototypeOf(SquareAnnotation)).call(this, parameters));
-
- _this10.data.annotationType = _util.AnnotationType.SQUARE;
- _this10._preparePopup(parameters.dict);
- return _this10;
- }
-
- return SquareAnnotation;
-}(Annotation);
-
-var CircleAnnotation = function (_Annotation7) {
- _inherits(CircleAnnotation, _Annotation7);
-
- function CircleAnnotation(parameters) {
- _classCallCheck(this, CircleAnnotation);
-
- var _this11 = _possibleConstructorReturn(this, (CircleAnnotation.__proto__ || Object.getPrototypeOf(CircleAnnotation)).call(this, parameters));
-
- _this11.data.annotationType = _util.AnnotationType.CIRCLE;
- _this11._preparePopup(parameters.dict);
- return _this11;
- }
-
- return CircleAnnotation;
-}(Annotation);
-
-var PolylineAnnotation = function (_Annotation8) {
- _inherits(PolylineAnnotation, _Annotation8);
-
- function PolylineAnnotation(parameters) {
- _classCallCheck(this, PolylineAnnotation);
-
- var _this12 = _possibleConstructorReturn(this, (PolylineAnnotation.__proto__ || Object.getPrototypeOf(PolylineAnnotation)).call(this, parameters));
-
- _this12.data.annotationType = _util.AnnotationType.POLYLINE;
- var dict = parameters.dict;
- var rawVertices = dict.getArray('Vertices');
- _this12.data.vertices = [];
- for (var i = 0, ii = rawVertices.length; i < ii; i += 2) {
- _this12.data.vertices.push({
- x: rawVertices[i],
- y: rawVertices[i + 1]
- });
- }
- _this12._preparePopup(dict);
- return _this12;
- }
-
- return PolylineAnnotation;
-}(Annotation);
-
-var PolygonAnnotation = function (_PolylineAnnotation) {
- _inherits(PolygonAnnotation, _PolylineAnnotation);
-
- function PolygonAnnotation(parameters) {
- _classCallCheck(this, PolygonAnnotation);
-
- var _this13 = _possibleConstructorReturn(this, (PolygonAnnotation.__proto__ || Object.getPrototypeOf(PolygonAnnotation)).call(this, parameters));
-
- _this13.data.annotationType = _util.AnnotationType.POLYGON;
- return _this13;
- }
-
- return PolygonAnnotation;
-}(PolylineAnnotation);
-
-var InkAnnotation = function (_Annotation9) {
- _inherits(InkAnnotation, _Annotation9);
-
- function InkAnnotation(parameters) {
- _classCallCheck(this, InkAnnotation);
-
- var _this14 = _possibleConstructorReturn(this, (InkAnnotation.__proto__ || Object.getPrototypeOf(InkAnnotation)).call(this, parameters));
-
- _this14.data.annotationType = _util.AnnotationType.INK;
- var dict = parameters.dict;
- var xref = parameters.xref;
- var originalInkLists = dict.getArray('InkList');
- _this14.data.inkLists = [];
- for (var i = 0, ii = originalInkLists.length; i < ii; ++i) {
- _this14.data.inkLists.push([]);
- for (var j = 0, jj = originalInkLists[i].length; j < jj; j += 2) {
- _this14.data.inkLists[i].push({
- x: xref.fetchIfRef(originalInkLists[i][j]),
- y: xref.fetchIfRef(originalInkLists[i][j + 1])
- });
- }
- }
- _this14._preparePopup(dict);
- return _this14;
- }
-
- return InkAnnotation;
-}(Annotation);
-
-var HighlightAnnotation = function (_Annotation10) {
- _inherits(HighlightAnnotation, _Annotation10);
-
- function HighlightAnnotation(parameters) {
- _classCallCheck(this, HighlightAnnotation);
-
- var _this15 = _possibleConstructorReturn(this, (HighlightAnnotation.__proto__ || Object.getPrototypeOf(HighlightAnnotation)).call(this, parameters));
-
- _this15.data.annotationType = _util.AnnotationType.HIGHLIGHT;
- _this15._preparePopup(parameters.dict);
- return _this15;
- }
-
- return HighlightAnnotation;
-}(Annotation);
-
-var UnderlineAnnotation = function (_Annotation11) {
- _inherits(UnderlineAnnotation, _Annotation11);
-
- function UnderlineAnnotation(parameters) {
- _classCallCheck(this, UnderlineAnnotation);
-
- var _this16 = _possibleConstructorReturn(this, (UnderlineAnnotation.__proto__ || Object.getPrototypeOf(UnderlineAnnotation)).call(this, parameters));
-
- _this16.data.annotationType = _util.AnnotationType.UNDERLINE;
- _this16._preparePopup(parameters.dict);
- return _this16;
- }
-
- return UnderlineAnnotation;
-}(Annotation);
-
-var SquigglyAnnotation = function (_Annotation12) {
- _inherits(SquigglyAnnotation, _Annotation12);
-
- function SquigglyAnnotation(parameters) {
- _classCallCheck(this, SquigglyAnnotation);
-
- var _this17 = _possibleConstructorReturn(this, (SquigglyAnnotation.__proto__ || Object.getPrototypeOf(SquigglyAnnotation)).call(this, parameters));
-
- _this17.data.annotationType = _util.AnnotationType.SQUIGGLY;
- _this17._preparePopup(parameters.dict);
- return _this17;
- }
-
- return SquigglyAnnotation;
-}(Annotation);
-
-var StrikeOutAnnotation = function (_Annotation13) {
- _inherits(StrikeOutAnnotation, _Annotation13);
-
- function StrikeOutAnnotation(parameters) {
- _classCallCheck(this, StrikeOutAnnotation);
-
- var _this18 = _possibleConstructorReturn(this, (StrikeOutAnnotation.__proto__ || Object.getPrototypeOf(StrikeOutAnnotation)).call(this, parameters));
-
- _this18.data.annotationType = _util.AnnotationType.STRIKEOUT;
- _this18._preparePopup(parameters.dict);
- return _this18;
- }
-
- return StrikeOutAnnotation;
-}(Annotation);
-
-var StampAnnotation = function (_Annotation14) {
- _inherits(StampAnnotation, _Annotation14);
-
- function StampAnnotation(parameters) {
- _classCallCheck(this, StampAnnotation);
-
- var _this19 = _possibleConstructorReturn(this, (StampAnnotation.__proto__ || Object.getPrototypeOf(StampAnnotation)).call(this, parameters));
-
- _this19.data.annotationType = _util.AnnotationType.STAMP;
- _this19._preparePopup(parameters.dict);
- return _this19;
- }
-
- return StampAnnotation;
-}(Annotation);
-
-var FileAttachmentAnnotation = function (_Annotation15) {
- _inherits(FileAttachmentAnnotation, _Annotation15);
-
- function FileAttachmentAnnotation(parameters) {
- _classCallCheck(this, FileAttachmentAnnotation);
-
- var _this20 = _possibleConstructorReturn(this, (FileAttachmentAnnotation.__proto__ || Object.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;
- }
-
- return FileAttachmentAnnotation;
-}(Annotation);
-
-exports.Annotation = Annotation;
-exports.AnnotationBorderStyle = AnnotationBorderStyle;
-exports.AnnotationFactory = AnnotationFactory;
-
-/***/ }),
-/* 153 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.OperatorList = undefined;
-
-var _util = __w_pdfjs_require__(2);
-
-var QueueOptimizer = function QueueOptimizerClosure() {
- function addState(parentState, pattern, checkFn, iterateFn, processFn) {
- var state = parentState;
- for (var i = 0, ii = pattern.length - 1; i < ii; i++) {
- var item = pattern[i];
- state = state[item] || (state[item] = []);
- }
- state[pattern[pattern.length - 1]] = {
- checkFn: checkFn,
- iterateFn: iterateFn,
- processFn: processFn
- };
- }
- function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
- var iFirstPIMXO = iFirstSave + 2;
- for (var i = 0; i < count; i++) {
- var arg = argsArray[iFirstPIMXO + 4 * i];
- var imageMask = arg.length === 1 && arg[0];
- if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
- fnArray[iFirstPIMXO + 4 * i] = _util.OPS.paintSolidColorImageMask;
- continue;
- }
- break;
- }
- return count - i;
- }
- var InitialState = [];
- addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
- var fnArray = context.fnArray;
- var iFirstSave = context.iCurr - 3;
- var pos = (i - iFirstSave) % 4;
- switch (pos) {
- case 0:
- return fnArray[i] === _util.OPS.save;
- case 1:
- return fnArray[i] === _util.OPS.transform;
- case 2:
- return fnArray[i] === _util.OPS.paintInlineImageXObject;
- case 3:
- return fnArray[i] === _util.OPS.restore;
- }
- }, function foundInlineImageGroup(context, i) {
- var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
- var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
- var MAX_WIDTH = 1000;
- var IMAGE_PADDING = 1;
- var fnArray = context.fnArray,
- argsArray = context.argsArray;
- var curr = context.iCurr;
- var iFirstSave = curr - 3;
- var iFirstTransform = curr - 2;
- var iFirstPIIXO = curr - 1;
- var count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
- if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
- return i - (i - iFirstSave) % 4;
- }
- var maxX = 0;
- var map = [],
- maxLineHeight = 0;
- var currentX = IMAGE_PADDING,
- currentY = IMAGE_PADDING;
- var q;
- for (q = 0; q < count; q++) {
- var transform = argsArray[iFirstTransform + (q << 2)];
- var img = argsArray[iFirstPIIXO + (q << 2)][0];
- if (currentX + img.width > MAX_WIDTH) {
- maxX = Math.max(maxX, currentX);
- currentY += maxLineHeight + 2 * IMAGE_PADDING;
- currentX = 0;
- maxLineHeight = 0;
- }
- map.push({
- transform: transform,
- x: currentX,
- y: currentY,
- w: img.width,
- h: img.height
- });
- currentX += img.width + 2 * IMAGE_PADDING;
- maxLineHeight = Math.max(maxLineHeight, img.height);
- }
- var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
- var imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
- var imgData = new Uint8ClampedArray(imgWidth * imgHeight * 4);
- var imgRowSize = imgWidth << 2;
- for (q = 0; q < count; q++) {
- var data = argsArray[iFirstPIIXO + (q << 2)][0].data;
- var rowSize = map[q].w << 2;
- var dataOffset = 0;
- var offset = map[q].x + map[q].y * imgWidth << 2;
- imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
- for (var k = 0, kk = map[q].h; k < kk; k++) {
- imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
- dataOffset += rowSize;
- offset += imgRowSize;
- }
- imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
- while (offset >= 0) {
- data[offset - 4] = data[offset];
- data[offset - 3] = data[offset + 1];
- data[offset - 2] = data[offset + 2];
- data[offset - 1] = data[offset + 3];
- data[offset + rowSize] = data[offset + rowSize - 4];
- data[offset + rowSize + 1] = data[offset + rowSize - 3];
- data[offset + rowSize + 2] = data[offset + rowSize - 2];
- data[offset + rowSize + 3] = data[offset + rowSize - 1];
- offset -= imgRowSize;
- }
- }
- fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
- argsArray.splice(iFirstSave, count * 4, [{
- width: imgWidth,
- height: imgHeight,
- kind: _util.ImageKind.RGBA_32BPP,
- data: imgData
- }, map]);
- return iFirstSave + 1;
- });
- addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
- var fnArray = context.fnArray;
- var iFirstSave = context.iCurr - 3;
- var pos = (i - iFirstSave) % 4;
- switch (pos) {
- case 0:
- return fnArray[i] === _util.OPS.save;
- case 1:
- return fnArray[i] === _util.OPS.transform;
- case 2:
- return fnArray[i] === _util.OPS.paintImageMaskXObject;
- case 3:
- return fnArray[i] === _util.OPS.restore;
- }
- }, function foundImageMaskGroup(context, i) {
- var MIN_IMAGES_IN_MASKS_BLOCK = 10;
- var MAX_IMAGES_IN_MASKS_BLOCK = 100;
- var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
- var fnArray = context.fnArray,
- argsArray = context.argsArray;
- var curr = context.iCurr;
- var iFirstSave = curr - 3;
- var iFirstTransform = curr - 2;
- var iFirstPIMXO = curr - 1;
- var count = Math.floor((i - iFirstSave) / 4);
- count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
- if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
- return i - (i - iFirstSave) % 4;
- }
- var q;
- var isSameImage = false;
- var iTransform, transformArgs;
- var firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
- if (argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0) {
- isSameImage = true;
- var firstTransformArg0 = argsArray[iFirstTransform][0];
- var firstTransformArg3 = argsArray[iFirstTransform][3];
- iTransform = iFirstTransform + 4;
- var iPIMXO = iFirstPIMXO + 4;
- for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
- transformArgs = argsArray[iTransform];
- if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== 0 || transformArgs[2] !== 0 || transformArgs[3] !== firstTransformArg3) {
- if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
- isSameImage = false;
- } else {
- count = q;
- }
- break;
- }
- }
- }
- if (isSameImage) {
- count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
- var positions = new Float32Array(count * 2);
- iTransform = iFirstTransform;
- for (q = 0; q < count; q++, iTransform += 4) {
- transformArgs = argsArray[iTransform];
- positions[q << 1] = transformArgs[4];
- positions[(q << 1) + 1] = transformArgs[5];
- }
- fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
- argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg3, positions]);
- } else {
- count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
- var images = [];
- for (q = 0; q < count; q++) {
- transformArgs = argsArray[iFirstTransform + (q << 2)];
- var maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
- images.push({
- data: maskParams.data,
- width: maskParams.width,
- height: maskParams.height,
- transform: transformArgs
- });
- }
- fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
- argsArray.splice(iFirstSave, count * 4, [images]);
- }
- return iFirstSave + 1;
- });
- addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
- var argsArray = context.argsArray;
- var iFirstTransform = context.iCurr - 2;
- return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
- }, function (context, i) {
- var fnArray = context.fnArray,
- argsArray = context.argsArray;
- var iFirstSave = context.iCurr - 3;
- var pos = (i - iFirstSave) % 4;
- switch (pos) {
- case 0:
- return fnArray[i] === _util.OPS.save;
- case 1:
- if (fnArray[i] !== _util.OPS.transform) {
- return false;
- }
- var iFirstTransform = context.iCurr - 2;
- var firstTransformArg0 = argsArray[iFirstTransform][0];
- var firstTransformArg3 = argsArray[iFirstTransform][3];
- if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
- return false;
- }
- return true;
- case 2:
- if (fnArray[i] !== _util.OPS.paintImageXObject) {
- return false;
- }
- var iFirstPIXO = context.iCurr - 1;
- var firstPIXOArg0 = argsArray[iFirstPIXO][0];
- if (argsArray[i][0] !== firstPIXOArg0) {
- return false;
- }
- return true;
- case 3:
- return fnArray[i] === _util.OPS.restore;
- }
- }, function (context, i) {
- var MIN_IMAGES_IN_BLOCK = 3;
- var MAX_IMAGES_IN_BLOCK = 1000;
- var fnArray = context.fnArray,
- argsArray = context.argsArray;
- var curr = context.iCurr;
- var iFirstSave = curr - 3;
- var iFirstTransform = curr - 2;
- var iFirstPIXO = curr - 1;
- var firstPIXOArg0 = argsArray[iFirstPIXO][0];
- var firstTransformArg0 = argsArray[iFirstTransform][0];
- var firstTransformArg3 = argsArray[iFirstTransform][3];
- var count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
- if (count < MIN_IMAGES_IN_BLOCK) {
- return i - (i - iFirstSave) % 4;
- }
- var positions = new Float32Array(count * 2);
- var iTransform = iFirstTransform;
- for (var q = 0; q < count; q++, iTransform += 4) {
- var transformArgs = argsArray[iTransform];
- positions[q << 1] = transformArgs[4];
- positions[(q << 1) + 1] = transformArgs[5];
- }
- var args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
- fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
- 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) {
- var fnArray = context.fnArray,
- argsArray = context.argsArray;
- var iFirstSave = context.iCurr - 4;
- var pos = (i - iFirstSave) % 5;
- switch (pos) {
- case 0:
- return fnArray[i] === _util.OPS.beginText;
- case 1:
- return fnArray[i] === _util.OPS.setFont;
- case 2:
- return fnArray[i] === _util.OPS.setTextMatrix;
- case 3:
- if (fnArray[i] !== _util.OPS.showText) {
- return false;
- }
- var iFirstSetFont = context.iCurr - 3;
- var firstSetFontArg0 = argsArray[iFirstSetFont][0];
- var firstSetFontArg1 = argsArray[iFirstSetFont][1];
- if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
- return false;
- }
- return true;
- case 4:
- return fnArray[i] === _util.OPS.endText;
- }
- }, function (context, i) {
- var MIN_CHARS_IN_BLOCK = 3;
- var MAX_CHARS_IN_BLOCK = 1000;
- var fnArray = context.fnArray,
- argsArray = context.argsArray;
- var curr = context.iCurr;
- var iFirstBeginText = curr - 4;
- var iFirstSetFont = curr - 3;
- var iFirstSetTextMatrix = curr - 2;
- var iFirstShowText = curr - 1;
- var iFirstEndText = curr;
- var firstSetFontArg0 = argsArray[iFirstSetFont][0];
- var firstSetFontArg1 = argsArray[iFirstSetFont][1];
- var count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
- if (count < MIN_CHARS_IN_BLOCK) {
- return i - (i - iFirstBeginText) % 5;
- }
- var iFirst = iFirstBeginText;
- if (iFirstBeginText >= 4 && fnArray[iFirstBeginText - 4] === fnArray[iFirstSetFont] && fnArray[iFirstBeginText - 3] === fnArray[iFirstSetTextMatrix] && fnArray[iFirstBeginText - 2] === fnArray[iFirstShowText] && fnArray[iFirstBeginText - 1] === fnArray[iFirstEndText] && argsArray[iFirstBeginText - 4][0] === firstSetFontArg0 && argsArray[iFirstBeginText - 4][1] === firstSetFontArg1) {
- count++;
- iFirst -= 5;
- }
- var iEndText = iFirst + 4;
- for (var q = 1; q < count; q++) {
- fnArray.splice(iEndText, 3);
- argsArray.splice(iEndText, 3);
- iEndText += 2;
- }
- return iEndText + 1;
- });
- function QueueOptimizer(queue) {
- this.queue = queue;
- this.state = null;
- this.context = {
- iCurr: 0,
- fnArray: queue.fnArray,
- argsArray: queue.argsArray
- };
- this.match = null;
- this.lastProcessed = 0;
- }
- QueueOptimizer.prototype = {
- _optimize: function _optimize() {
- var fnArray = this.queue.fnArray;
- var i = this.lastProcessed,
- ii = fnArray.length;
- var state = this.state;
- var match = this.match;
- if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
- this.lastProcessed = ii;
- return;
- }
- var context = this.context;
- while (i < ii) {
- if (match) {
- var iterate = (0, match.iterateFn)(context, i);
- if (iterate) {
- i++;
- continue;
- }
- i = (0, match.processFn)(context, i + 1);
- ii = fnArray.length;
- match = null;
- state = null;
- if (i >= ii) {
- break;
- }
- }
- state = (state || InitialState)[fnArray[i]];
- if (!state || Array.isArray(state)) {
- i++;
- continue;
- }
- context.iCurr = i;
- i++;
- if (state.checkFn && !(0, state.checkFn)(context)) {
- state = null;
- continue;
- }
- match = state;
- state = null;
- }
- this.state = state;
- this.match = match;
- this.lastProcessed = i;
- },
- push: function push(fn, args) {
- this.queue.fnArray.push(fn);
- this.queue.argsArray.push(args);
- this._optimize();
- },
- flush: function flush() {
- while (this.match) {
- var length = this.queue.fnArray.length;
- this.lastProcessed = (0, this.match.processFn)(this.context, length);
- this.match = null;
- this.state = null;
- this._optimize();
- }
- },
- reset: function reset() {
- this.state = null;
- this.match = null;
- this.lastProcessed = 0;
- }
- };
- return QueueOptimizer;
-}();
-var NullOptimizer = function NullOptimizerClosure() {
- function NullOptimizer(queue) {
- this.queue = queue;
- }
- NullOptimizer.prototype = {
- push: function push(fn, args) {
- this.queue.fnArray.push(fn);
- this.queue.argsArray.push(args);
- },
- flush: function flush() {}
- };
- return NullOptimizer;
-}();
-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') {
- this.optimizer = new QueueOptimizer(this);
- } else {
- this.optimizer = new NullOptimizer(this);
- }
- this.dependencies = Object.create(null);
- this._totalLength = 0;
- this.pageIndex = pageIndex;
- this.intent = intent;
- this.weight = 0;
- }
- OperatorList.prototype = {
- get length() {
- return this.argsArray.length;
- },
- get totalLength() {
- return this._totalLength + this.length;
- },
- addOp: function addOp(fn, args) {
- this.optimizer.push(fn, args);
- this.weight++;
- if (this.messageHandler) {
- if (this.weight >= CHUNK_SIZE) {
- this.flush();
- } else if (this.weight >= CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
- this.flush();
- }
- }
- },
- addDependency: function addDependency(dependency) {
- if (dependency in this.dependencies) {
- return;
- }
- this.dependencies[dependency] = true;
- this.addOp(_util.OPS.dependency, [dependency]);
- },
- addDependencies: function addDependencies(dependencies) {
- for (var key in dependencies) {
- this.addDependency(key);
- }
- },
- addOpList: function addOpList(opList) {
- Object.assign(this.dependencies, opList.dependencies);
- for (var i = 0, ii = opList.length; i < ii; i++) {
- this.addOp(opList.fnArray[i], opList.argsArray[i]);
- }
- },
- getIR: function getIR() {
- return {
- fnArray: this.fnArray,
- argsArray: this.argsArray,
- length: this.length
- };
- },
- flush: function flush(lastChunk) {
- this.optimizer.flush();
- var transfers = getTransfers(this);
- var length = this.length;
- this._totalLength += length;
- this.messageHandler.send('RenderPageChunk', {
- operatorList: {
- fnArray: this.fnArray,
- argsArray: this.argsArray,
- lastChunk: lastChunk,
- length: length
- },
- pageIndex: this.pageIndex,
- intent: this.intent
- }, transfers);
- this.dependencies = Object.create(null);
- this.fnArray.length = 0;
- this.argsArray.length = 0;
- this.weight = 0;
- this.optimizer.reset();
- }
- };
- return OperatorList;
-}();
-exports.OperatorList = OperatorList;
-
-/***/ }),
-/* 154 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.PartialEvaluator = undefined;
-
-var _regenerator = __w_pdfjs_require__(131);
-
-var _regenerator2 = _interopRequireDefault(_regenerator);
-
-var _util = __w_pdfjs_require__(2);
-
-var _cmap = __w_pdfjs_require__(155);
-
-var _stream = __w_pdfjs_require__(140);
-
-var _primitives = __w_pdfjs_require__(138);
-
-var _fonts = __w_pdfjs_require__(156);
-
-var _encodings = __w_pdfjs_require__(159);
-
-var _unicode = __w_pdfjs_require__(162);
-
-var _standard_fonts = __w_pdfjs_require__(161);
-
-var _pattern = __w_pdfjs_require__(165);
-
-var _parser = __w_pdfjs_require__(139);
-
-var _bidi = __w_pdfjs_require__(166);
-
-var _colorspace = __w_pdfjs_require__(151);
-
-var _glyphlist = __w_pdfjs_require__(160);
-
-var _metrics = __w_pdfjs_require__(167);
-
-var _function = __w_pdfjs_require__(168);
-
-var _jpeg_stream = __w_pdfjs_require__(146);
-
-var _murmurhash = __w_pdfjs_require__(170);
-
-var _operator_list = __w_pdfjs_require__(153);
-
-var _image = __w_pdfjs_require__(171);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
-
-var PartialEvaluator = function PartialEvaluatorClosure() {
- var DefaultPartialEvaluatorOptions = {
- forceDataSchema: false,
- maxImageSize: -1,
- disableFontFace: false,
- nativeImageDecoderSupport: _util.NativeImageDecoding.DECODE,
- ignoreErrors: false,
- isEvalSupported: true
- };
- function NativeImageDecoder(_ref) {
- var xref = _ref.xref,
- resources = _ref.resources,
- handler = _ref.handler,
- _ref$forceDataSchema = _ref.forceDataSchema,
- forceDataSchema = _ref$forceDataSchema === undefined ? false : _ref$forceDataSchema,
- 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);
- return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
- };
- 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 === undefined ? null : _ref3$options,
- pdfFunctionFactory = _ref3.pdfFunctionFactory;
-
- this.pdfManager = pdfManager;
- this.xref = xref;
- this.handler = handler;
- this.pageIndex = pageIndex;
- this.idFactory = idFactory;
- this.fontCache = fontCache;
- this.builtInCMapCache = builtInCMapCache;
- this.options = options || DefaultPartialEvaluatorOptions;
- this.pdfFunctionFactory = pdfFunctionFactory;
- this.fetchBuiltInCMap = function () {
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee(name) {
- var data;
- return _regenerator2.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- if (!_this.builtInCMapCache.has(name)) {
- _context.next = 2;
- break;
- }
-
- return _context.abrupt('return', _this.builtInCMapCache.get(name));
-
- case 2:
- _context.next = 4;
- return _this.handler.sendWithPromise('FetchBuiltInCMap', { name: name });
-
- case 4:
- data = _context.sent;
-
- if (data.compressionType !== _util.CMapCompressionType.NONE) {
- _this.builtInCMapCache.set(name, data);
- }
- return _context.abrupt('return', data);
-
- case 7:
- case 'end':
- return _context.stop();
- }
- }
- }, _callee, _this);
- }));
-
- return function (_x) {
- return _ref4.apply(this, arguments);
- };
- }();
- }
- var TIME_SLOT_DURATION_MS = 20;
- var CHECK_TIME_EVERY = 100;
- function TimeSlotManager() {
- this.reset();
- }
- TimeSlotManager.prototype = {
- check: function TimeSlotManager_check() {
- if (++this.checked < CHECK_TIME_EVERY) {
- return false;
- }
- this.checked = 0;
- return this.endTime <= Date.now();
- },
- reset: function TimeSlotManager_reset() {
- this.endTime = Date.now() + TIME_SLOT_DURATION_MS;
- this.checked = 0;
- }
- };
- function normalizeBlendMode(value) {
- if (!(0, _primitives.isName)(value)) {
- return 'source-over';
- }
- switch (value.name) {
- case 'Normal':
- case 'Compatible':
- return 'source-over';
- case 'Multiply':
- return 'multiply';
- case 'Screen':
- return 'screen';
- case 'Overlay':
- return 'overlay';
- case 'Darken':
- return 'darken';
- case 'Lighten':
- return 'lighten';
- case 'ColorDodge':
- return 'color-dodge';
- case 'ColorBurn':
- return 'color-burn';
- case 'HardLight':
- return 'hard-light';
- case 'SoftLight':
- return 'soft-light';
- case 'Difference':
- return 'difference';
- case 'Exclusion':
- return 'exclusion';
- case 'Hue':
- return 'hue';
- case 'Saturation':
- return 'saturation';
- case 'Color':
- return 'color';
- case 'Luminosity':
- return 'luminosity';
- }
- (0, _util.warn)('Unsupported blend mode: ' + value.name);
- return 'source-over';
- }
- var deferred = Promise.resolve();
- var TILING_PATTERN = 1,
- SHADING_PATTERN = 2;
- PartialEvaluator.prototype = {
- clone: function clone() {
- var newOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DefaultPartialEvaluatorOptions;
-
- var newEvaluator = Object.create(this);
- newEvaluator.options = newOptions;
- return newEvaluator;
- },
-
- hasBlendModes: function PartialEvaluator_hasBlendModes(resources) {
- if (!(0, _primitives.isDict)(resources)) {
- return false;
- }
- var processed = Object.create(null);
- if (resources.objId) {
- processed[resources.objId] = true;
- }
- var nodes = [resources],
- xref = this.xref;
- while (nodes.length) {
- var key, i, ii;
- var node = nodes.shift();
- var graphicStates = node.get('ExtGState');
- if ((0, _primitives.isDict)(graphicStates)) {
- var graphicStatesKeys = graphicStates.getKeys();
- for (i = 0, ii = graphicStatesKeys.length; i < ii; i++) {
- key = graphicStatesKeys[i];
- var graphicState = graphicStates.get(key);
- var bm = graphicState.get('BM');
- if ((0, _primitives.isName)(bm) && bm.name !== 'Normal') {
- return true;
- }
- }
- }
- var xObjects = node.get('XObject');
- if (!(0, _primitives.isDict)(xObjects)) {
- continue;
- }
- var xObjectsKeys = xObjects.getKeys();
- for (i = 0, ii = xObjectsKeys.length; i < ii; i++) {
- key = xObjectsKeys[i];
- var xObject = xObjects.getRaw(key);
- if ((0, _primitives.isRef)(xObject)) {
- if (processed[xObject.toString()]) {
- continue;
- }
- xObject = xref.fetch(xObject);
- }
- if (!(0, _primitives.isStream)(xObject)) {
- continue;
- }
- if (xObject.dict.objId) {
- if (processed[xObject.dict.objId]) {
- continue;
- }
- processed[xObject.dict.objId] = true;
- }
- var xResources = xObject.dict.get('Resources');
- if ((0, _primitives.isDict)(xResources) && (!xResources.objId || !processed[xResources.objId])) {
- nodes.push(xResources);
- if (xResources.objId) {
- processed[xResources.objId] = true;
- }
- }
- }
- }
- return false;
- },
- buildFormXObject: function PartialEvaluator_buildFormXObject(resources, xobj, smask, operatorList, task, initialState) {
- var dict = xobj.dict;
- var matrix = dict.getArray('Matrix');
- var bbox = dict.getArray('BBox');
- var group = dict.get('Group');
- if (group) {
- var groupOptions = {
- matrix: matrix,
- bbox: bbox,
- smask: smask,
- isolated: false,
- knockout: false
- };
- var groupSubtype = group.get('S');
- var colorSpace = null;
- if ((0, _primitives.isName)(groupSubtype, 'Transparency')) {
- groupOptions.isolated = group.get('I') || false;
- groupOptions.knockout = group.get('K') || false;
- if (group.has('CS')) {
- colorSpace = _colorspace.ColorSpace.parse(group.get('CS'), this.xref, resources, this.pdfFunctionFactory);
- }
- }
- if (smask && smask.backdrop) {
- colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
- smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
- }
- operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
- }
- operatorList.addOp(_util.OPS.paintFormXObjectBegin, [matrix, bbox]);
- return this.getOperatorList({
- stream: xobj,
- task: task,
- resources: dict.get('Resources') || resources,
- operatorList: operatorList,
- initialState: initialState
- }).then(function () {
- operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
- if (group) {
- operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
- }
- });
- },
- buildPaintImageXObject: function buildPaintImageXObject(_ref5) {
- var _this2 = this;
-
- var resources = _ref5.resources,
- image = _ref5.image,
- _ref5$isInline = _ref5.isInline,
- isInline = _ref5$isInline === undefined ? false : _ref5$isInline,
- operatorList = _ref5.operatorList,
- cacheKey = _ref5.cacheKey,
- imageCache = _ref5.imageCache,
- _ref5$forceDisableNat = _ref5.forceDisableNativeImageDecoder,
- forceDisableNativeImageDecoder = _ref5$forceDisableNat === undefined ? false : _ref5$forceDisableNat;
-
- var dict = image.dict;
- var w = dict.get('Width', 'W');
- var h = dict.get('Height', 'H');
- if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) {
- (0, _util.warn)('Image dimensions are missing, or not numbers.');
- return Promise.resolve();
- }
- var maxImageSize = this.options.maxImageSize;
- if (maxImageSize !== -1 && w * h > maxImageSize) {
- (0, _util.warn)('Image exceeded maximum allowed size and was removed.');
- return Promise.resolve();
- }
- var imageMask = dict.get('ImageMask', 'IM') || false;
- var imgData, args;
- 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
- };
- }
- return Promise.resolve();
- }
- var softMask = dict.get('SMask', 'SM') || false;
- var mask = dict.get('Mask') || false;
- var SMALL_IMAGE_DIMENSIONS = 200;
- 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();
- }
- var nativeImageDecoderSupport = forceDisableNativeImageDecoder ? _util.NativeImageDecoding.NONE : this.options.nativeImageDecoderSupport;
- var objId = 'img_' + this.idFactory.createObjId();
- 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);
- 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
- });
- });
- }
- var nativeImageDecoder = null;
- 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
- });
- }
- operatorList.addDependency(objId);
- args = [objId, w, h];
- _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);
- _this2.handler.send('obj', [objId, _this2.pageIndex, 'Image', imgData], [imgData.data.buffer]);
- }).catch(function (reason) {
- (0, _util.warn)('Unable to decode image: ' + reason);
- _this2.handler.send('obj', [objId, _this2.pageIndex, 'Image', null]);
- });
- operatorList.addOp(_util.OPS.paintImageXObject, args);
- if (cacheKey) {
- imageCache[cacheKey] = {
- fn: _util.OPS.paintImageXObject,
- args: args
- };
- }
- return Promise.resolve();
- },
-
- handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) {
- var smaskContent = smask.get('G');
- var smaskOptions = {
- subtype: smask.get('S').name,
- backdrop: smask.get('BC')
- };
- var transferObj = smask.get('TR');
- if ((0, _function.isPDFFunction)(transferObj)) {
- var transferFn = this.pdfFunctionFactory.create(transferObj);
- var transferMap = new Uint8Array(256);
- var tmp = new Float32Array(1);
- for (var i = 0; i < 256; i++) {
- tmp[0] = i / 255;
- transferFn(tmp, 0, tmp, 0);
- transferMap[i] = tmp[0] * 255 | 0;
- }
- smaskOptions.transferMap = transferMap;
- }
- return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone());
- },
- handleTilingType: function handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) {
- var _this3 = this;
-
- var tilingOpList = new _operator_list.OperatorList();
- var resourcesArray = [patternDict.get('Resources'), resources];
- var patternResources = _primitives.Dict.merge(this.xref, resourcesArray);
- return this.getOperatorList({
- stream: pattern,
- task: task,
- resources: patternResources,
- operatorList: tilingOpList
- }).then(function () {
- return (0, _pattern.getTilingPatternIR)({
- fnArray: tilingOpList.fnArray,
- argsArray: tilingOpList.argsArray
- }, patternDict, args);
- }).then(function (tilingPatternIR) {
- operatorList.addDependencies(tilingOpList.dependencies);
- operatorList.addOp(fn, tilingPatternIR);
- }, function (reason) {
- if (_this3.options.ignoreErrors) {
- _this3.handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.unknown });
- (0, _util.warn)('handleTilingType - ignoring pattern: "' + reason + '".');
- return;
- }
- throw reason;
- });
- },
-
- handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
- var _this4 = this;
-
- var fontName;
- if (fontArgs) {
- fontArgs = fontArgs.slice();
- fontName = fontArgs[0].name;
- }
- return this.loadFont(fontName, fontRef, resources).then(function (translated) {
- if (!translated.font.isType3Font) {
- return translated;
- }
- return translated.loadType3Data(_this4, resources, operatorList, task).then(function () {
- return translated;
- }).catch(function (reason) {
- _this4.handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.font });
- return new TranslatedFont('g_font_error', new _fonts.ErrorFont('Type3 font load error: ' + reason), translated.font);
- });
- }).then(function (translated) {
- state.font = translated.font;
- translated.send(_this4.handler);
- return translated.loadedName;
- });
- },
- handleText: function PartialEvaluator_handleText(chars, state) {
- var _this5 = this;
-
- var font = state.font;
- var glyphs = font.charsToGlyphs(chars);
- var isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
- if (font.data && (isAddToPathSet || this.options.disableFontFace || state.fillColorSpace.name === 'Pattern')) {
- var buildPath = function buildPath(fontChar) {
- if (!font.renderer.hasBuiltPath(fontChar)) {
- var path = font.renderer.getPathJs(fontChar);
- _this5.handler.send('commonobj', [font.loadedName + '_path_' + fontChar, 'FontPath', path]);
- }
- };
- for (var i = 0, ii = glyphs.length; i < ii; i++) {
- var glyph = glyphs[i];
- buildPath(glyph.fontChar);
- var accent = glyph.accent;
- if (accent && accent.fontChar) {
- buildPath(accent.fontChar);
- }
- }
- }
- return glyphs;
- },
- setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, stateManager) {
- var _this6 = this;
-
- var gStateObj = [];
- var gStateKeys = gState.getKeys();
- var promise = Promise.resolve();
-
- var _loop = function _loop() {
- var key = gStateKeys[i];
- var value = gState.get(key);
- switch (key) {
- case 'Type':
- break;
- case 'LW':
- case 'LC':
- case 'LJ':
- case 'ML':
- case 'D':
- case 'RI':
- case 'FL':
- case 'CA':
- case 'ca':
- gStateObj.push([key, value]);
- break;
- case 'Font':
- promise = promise.then(function () {
- return _this6.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
- operatorList.addDependency(loadedName);
- gStateObj.push([key, [loadedName, value[1]]]);
- });
- });
- break;
- case 'BM':
- gStateObj.push([key, normalizeBlendMode(value)]);
- break;
- case 'SMask':
- if ((0, _primitives.isName)(value, 'None')) {
- gStateObj.push([key, false]);
- break;
- }
- if ((0, _primitives.isDict)(value)) {
- promise = promise.then(function () {
- return _this6.handleSMask(value, resources, operatorList, task, stateManager);
- });
- gStateObj.push([key, true]);
- } else {
- (0, _util.warn)('Unsupported SMask type');
- }
- break;
- case 'OP':
- case 'op':
- case 'OPM':
- case 'BG':
- case 'BG2':
- case 'UCR':
- case 'UCR2':
- case 'TR':
- case 'TR2':
- case 'HT':
- case 'SM':
- case 'SA':
- case 'AIS':
- case 'TK':
- (0, _util.info)('graphic state operator ' + key);
- break;
- default:
- (0, _util.info)('Unknown graphic state operator ' + key);
- break;
- }
- };
-
- for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
- _loop();
- }
- return promise.then(function () {
- if (gStateObj.length > 0) {
- operatorList.addOp(_util.OPS.setGState, [gStateObj]);
- }
- });
- },
- loadFont: function PartialEvaluator_loadFont(fontName, font, resources) {
- var _this7 = this;
-
- function errorFont() {
- return Promise.resolve(new TranslatedFont('g_font_error', new _fonts.ErrorFont('Font ' + fontName + ' is not available'), font));
- }
- var fontRef,
- xref = this.xref;
- if (font) {
- if (!(0, _primitives.isRef)(font)) {
- throw new Error('The "font" object should be a reference.');
- }
- fontRef = font;
- } else {
- var fontRes = resources.get('Font');
- if (fontRes) {
- fontRef = fontRes.getRaw(fontName);
- } else {
- (0, _util.warn)('fontRes not available');
- return errorFont();
- }
- }
- if (!fontRef) {
- (0, _util.warn)('fontRef not available');
- return errorFont();
- }
- if (this.fontCache.has(fontRef)) {
- return this.fontCache.get(fontRef);
- }
- font = xref.fetchIfRef(fontRef);
- if (!(0, _primitives.isDict)(font)) {
- return errorFont();
- }
- if (font.translated) {
- return font.translated;
- }
- var fontCapability = (0, _util.createPromiseCapability)();
- var preEvaluatedFont = this.preEvaluateFont(font);
- var descriptor = preEvaluatedFont.descriptor;
- var fontRefIsRef = (0, _primitives.isRef)(fontRef),
- fontID;
- if (fontRefIsRef) {
- fontID = fontRef.toString();
- }
- if ((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;
- if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
- this.fontCache.putAlias(fontRef, aliasFontRef);
- return this.fontCache.get(fontRef);
- }
- } else {
- fontAliases[hash] = { fontID: _fonts.Font.getFontID() };
- }
- if (fontRefIsRef) {
- fontAliases[hash].aliasRef = fontRef;
- }
- fontID = fontAliases[hash].fontID;
- }
- if (fontRefIsRef) {
- this.fontCache.put(fontRef, fontCapability.promise);
- } else {
- if (!fontID) {
- fontID = this.idFactory.createObjId();
- }
- this.fontCache.put('id_' + fontID, fontCapability.promise);
- }
- (0, _util.assert)(fontID, 'The "fontID" must be defined.');
- font.loadedName = 'g_' + this.pdfManager.docId + '_f' + fontID;
- font.translated = fontCapability.promise;
- var translatedPromise;
- try {
- translatedPromise = this.translateFont(preEvaluatedFont);
- } catch (e) {
- translatedPromise = Promise.reject(e);
- }
- translatedPromise.then(function (translatedFont) {
- if (translatedFont.fontType !== undefined) {
- var xrefFontStats = xref.stats.fontTypes;
- xrefFontStats[translatedFont.fontType] = true;
- }
- fontCapability.resolve(new TranslatedFont(font.loadedName, translatedFont, font));
- }).catch(function (reason) {
- _this7.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);
- var xrefFontStats = xref.stats.fontTypes;
- xrefFontStats[fontType] = true;
- } catch (ex) {}
- fontCapability.resolve(new TranslatedFont(font.loadedName, new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason), font));
- });
- return fontCapability.promise;
- },
- buildPath: function PartialEvaluator_buildPath(operatorList, fn, args) {
- var lastIndex = operatorList.length - 1;
- if (!args) {
- args = [];
- }
- if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
- operatorList.addOp(_util.OPS.constructPath, [[fn], args]);
- } 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;
- 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 (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();
- }
- return Promise.reject(new Error('Unknown PatternType: ' + typeNum));
- }
- operatorList.addOp(fn, args);
- return Promise.resolve();
- },
- getOperatorList: function getOperatorList(_ref6) {
- var _this8 = this;
-
- var stream = _ref6.stream,
- task = _ref6.task,
- resources = _ref6.resources,
- operatorList = _ref6.operatorList,
- _ref6$initialState = _ref6.initialState,
- initialState = _ref6$initialState === undefined ? null : _ref6$initialState;
-
- resources = resources || _primitives.Dict.empty;
- initialState = initialState || new EvalState();
- if (!operatorList) {
- throw new Error('getOperatorList: missing "operatorList" parameter');
- }
- var self = this;
- var xref = this.xref;
- var imageCache = Object.create(null);
- var xobjs = resources.get('XObject') || _primitives.Dict.empty;
- var patterns = resources.get('Pattern') || _primitives.Dict.empty;
- var stateManager = new StateManager(initialState);
- var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
- var timeSlotManager = new TimeSlotManager();
- function closePendingRestoreOPS(argument) {
- for (var i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
- operatorList.addOp(_util.OPS.restore, []);
- }
- }
- return new Promise(function promiseBody(resolve, reject) {
- var next = function next(promise) {
- promise.then(function () {
- try {
- promiseBody(resolve, reject);
- } catch (ex) {
- reject(ex);
- }
- }, reject);
- };
- task.ensureNotTerminated();
- timeSlotManager.reset();
- var stop,
- operation = {},
- i,
- ii,
- cs;
- while (!(stop = timeSlotManager.check())) {
- operation.args = null;
- if (!preprocessor.read(operation)) {
- break;
- }
- var args = operation.args;
- var fn = operation.fn;
- switch (fn | 0) {
- case _util.OPS.paintXObject:
- var name = args[0].name;
- if (name && imageCache[name] !== undefined) {
- operatorList.addOp(imageCache[name].fn, imageCache[name].args);
- args = null;
- continue;
- }
- next(new Promise(function (resolveXObject, rejectXObject) {
- if (!name) {
- throw new _util.FormatError('XObject must be referred to by name.');
- }
- var xobj = xobjs.get(name);
- if (!xobj) {
- operatorList.addOp(fn, args);
- resolveXObject();
- return;
- }
- if (!(0, _primitives.isStream)(xobj)) {
- throw new _util.FormatError('XObject should be a stream');
- }
- var type = xobj.dict.get('Subtype');
- if (!(0, _primitives.isName)(type)) {
- throw new _util.FormatError('XObject should have a Name subtype');
- }
- if (type.name === 'Form') {
- stateManager.save();
- self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
- stateManager.restore();
- resolveXObject();
- }, rejectXObject);
- return;
- } else if (type.name === 'Image') {
- self.buildPaintImageXObject({
- resources: resources,
- image: xobj,
- operatorList: operatorList,
- cacheKey: name,
- imageCache: imageCache
- }).then(resolveXObject, rejectXObject);
- return;
- } else if (type.name === 'PS') {
- (0, _util.info)('Ignored XObject subtype PS');
- } else {
- throw new _util.FormatError('Unhandled XObject subtype ' + type.name);
- }
- resolveXObject();
- }).catch(function (reason) {
- if (self.options.ignoreErrors) {
- self.handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.unknown });
- (0, _util.warn)('getOperatorList - ignoring XObject: "' + reason + '".');
- return;
- }
- throw reason;
- }));
- return;
- case _util.OPS.setFont:
- var fontSize = args[1];
- next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) {
- operatorList.addDependency(loadedName);
- operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
- }));
- return;
- case _util.OPS.endInlineImage:
- var cacheKey = args[0].cacheKey;
- if (cacheKey) {
- var cacheEntry = imageCache[cacheKey];
- if (cacheEntry !== undefined) {
- operatorList.addOp(cacheEntry.fn, cacheEntry.args);
- args = null;
- continue;
- }
- }
- next(self.buildPaintImageXObject({
- resources: resources,
- image: args[0],
- isInline: true,
- operatorList: operatorList,
- cacheKey: cacheKey,
- imageCache: imageCache
- }));
- return;
- case _util.OPS.showText:
- args[0] = self.handleText(args[0], stateManager.state);
- break;
- case _util.OPS.showSpacedText:
- var arr = args[0];
- var combinedGlyphs = [];
- var arrLength = arr.length;
- var state = stateManager.state;
- for (i = 0; i < arrLength; ++i) {
- var arrItem = arr[i];
- if ((0, _util.isString)(arrItem)) {
- Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
- } else if ((0, _util.isNum)(arrItem)) {
- combinedGlyphs.push(arrItem);
- }
- }
- args[0] = combinedGlyphs;
- fn = _util.OPS.showText;
- break;
- case _util.OPS.nextLineShowText:
- operatorList.addOp(_util.OPS.nextLine);
- args[0] = self.handleText(args[0], stateManager.state);
- fn = _util.OPS.showText;
- break;
- case _util.OPS.nextLineSetSpacingShowText:
- operatorList.addOp(_util.OPS.nextLine);
- operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
- operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
- args[0] = self.handleText(args[0], stateManager.state);
- fn = _util.OPS.showText;
- break;
- case _util.OPS.setTextRenderingMode:
- stateManager.state.textRenderingMode = args[0];
- break;
- case _util.OPS.setFillColorSpace:
- stateManager.state.fillColorSpace = _colorspace.ColorSpace.parse(args[0], xref, resources, self.pdfFunctionFactory);
- continue;
- case _util.OPS.setStrokeColorSpace:
- stateManager.state.strokeColorSpace = _colorspace.ColorSpace.parse(args[0], xref, resources, self.pdfFunctionFactory);
- continue;
- case _util.OPS.setFillColor:
- cs = stateManager.state.fillColorSpace;
- args = cs.getRgb(args, 0);
- fn = _util.OPS.setFillRGBColor;
- break;
- case _util.OPS.setStrokeColor:
- cs = stateManager.state.strokeColorSpace;
- args = cs.getRgb(args, 0);
- fn = _util.OPS.setStrokeRGBColor;
- break;
- case _util.OPS.setFillGray:
- stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
- args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
- fn = _util.OPS.setFillRGBColor;
- break;
- case _util.OPS.setStrokeGray:
- stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
- args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
- fn = _util.OPS.setStrokeRGBColor;
- break;
- case _util.OPS.setFillCMYKColor:
- stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
- args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
- fn = _util.OPS.setFillRGBColor;
- break;
- case _util.OPS.setStrokeCMYKColor:
- stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
- args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
- fn = _util.OPS.setStrokeRGBColor;
- break;
- case _util.OPS.setFillRGBColor:
- stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
- args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
- break;
- case _util.OPS.setStrokeRGBColor:
- stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
- args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
- break;
- case _util.OPS.setFillColorN:
- cs = stateManager.state.fillColorSpace;
- if (cs.name === 'Pattern') {
- next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task));
- return;
- }
- args = cs.getRgb(args, 0);
- fn = _util.OPS.setFillRGBColor;
- break;
- case _util.OPS.setStrokeColorN:
- cs = stateManager.state.strokeColorSpace;
- if (cs.name === 'Pattern') {
- next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task));
- return;
- }
- args = cs.getRgb(args, 0);
- fn = _util.OPS.setStrokeRGBColor;
- break;
- case _util.OPS.shadingFill:
- var shadingRes = resources.get('Shading');
- if (!shadingRes) {
- throw new _util.FormatError('No shading resource found');
- }
- var shading = shadingRes.get(args[0].name);
- if (!shading) {
- throw new _util.FormatError('No shading object found');
- }
- var shadingFill = _pattern.Pattern.parseShading(shading, null, xref, resources, self.handler, self.pdfFunctionFactory);
- var patternIR = shadingFill.getIR();
- args = [patternIR];
- fn = _util.OPS.shadingFill;
- break;
- case _util.OPS.setGState:
- var dictName = args[0];
- var extGState = resources.get('ExtGState');
- if (!(0, _primitives.isDict)(extGState) || !extGState.has(dictName.name)) {
- break;
- }
- var gState = extGState.get(dictName.name);
- next(self.setGState(resources, gState, operatorList, task, stateManager));
- return;
- case _util.OPS.moveTo:
- case _util.OPS.lineTo:
- case _util.OPS.curveTo:
- 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);
- continue;
- case _util.OPS.markPoint:
- case _util.OPS.markPointProps:
- case _util.OPS.beginMarkedContent:
- case _util.OPS.beginMarkedContentProps:
- case _util.OPS.endMarkedContent:
- case _util.OPS.beginCompat:
- case _util.OPS.endCompat:
- continue;
- default:
- if (args !== null) {
- for (i = 0, ii = args.length; i < ii; i++) {
- if (args[i] instanceof _primitives.Dict) {
- break;
- }
- }
- if (i < ii) {
- (0, _util.warn)('getOperatorList - ignoring operator: ' + fn);
- continue;
- }
- }
- }
- operatorList.addOp(fn, args);
- }
- if (stop) {
- next(deferred);
- return;
- }
- closePendingRestoreOPS();
- resolve();
- }).catch(function (reason) {
- if (_this8.options.ignoreErrors) {
- _this8.handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.unknown });
- (0, _util.warn)('getOperatorList - ignoring errors during "' + task.name + '" ' + ('task: "' + reason + '".'));
- closePendingRestoreOPS();
- return;
- }
- throw reason;
- });
- },
- getTextContent: function getTextContent(_ref7) {
- var _this9 = this;
-
- var stream = _ref7.stream,
- task = _ref7.task,
- resources = _ref7.resources,
- _ref7$stateManager = _ref7.stateManager,
- stateManager = _ref7$stateManager === undefined ? null : _ref7$stateManager,
- _ref7$normalizeWhites = _ref7.normalizeWhitespace,
- normalizeWhitespace = _ref7$normalizeWhites === undefined ? false : _ref7$normalizeWhites,
- _ref7$combineTextItem = _ref7.combineTextItems,
- combineTextItems = _ref7$combineTextItem === undefined ? false : _ref7$combineTextItem,
- sink = _ref7.sink,
- _ref7$seenStyles = _ref7.seenStyles,
- seenStyles = _ref7$seenStyles === undefined ? Object.create(null) : _ref7$seenStyles;
-
- resources = resources || _primitives.Dict.empty;
- stateManager = stateManager || new StateManager(new TextState());
- var WhitespaceRegexp = /\s/g;
- var textContent = {
- items: [],
- styles: Object.create(null)
- };
- var textContentItem = {
- initialized: false,
- str: [],
- width: 0,
- height: 0,
- vertical: false,
- lastAdvanceWidth: 0,
- lastAdvanceHeight: 0,
- textAdvanceScale: 0,
- spaceWidth: 0,
- fakeSpaceMin: Infinity,
- fakeMultiSpaceMin: Infinity,
- fakeMultiSpaceMax: -0,
- textRunBreakAllowed: false,
- transform: null,
- fontName: null
- };
- var SPACE_FACTOR = 0.3;
- var MULTI_SPACE_FACTOR = 1.5;
- var MULTI_SPACE_FACTOR_MAX = 4;
- var self = this;
- var xref = this.xref;
- var xobjs = null;
- var skipEmptyXObjs = Object.create(null);
- var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
- var textState;
- function ensureTextContentItem() {
- if (textContentItem.initialized) {
- return textContentItem;
- }
- var font = textState.font;
- if (!(font.loadedName in seenStyles)) {
- seenStyles[font.loadedName] = true;
- textContent.styles[font.loadedName] = {
- fontFamily: font.fallbackName,
- ascent: font.ascent,
- descent: font.descent,
- vertical: font.vertical
- };
- }
- 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) {
- var glyphHeight = font.bbox[3] - font.bbox[1];
- if (glyphHeight > 0) {
- glyphHeight = glyphHeight * textState.fontMatrix[3];
- tsm[3] *= glyphHeight;
- }
- }
- var trm = _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
- textContentItem.transform = trm;
- if (!font.vertical) {
- textContentItem.width = 0;
- textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]);
- textContentItem.vertical = false;
- } else {
- textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]);
- textContentItem.height = 0;
- textContentItem.vertical = true;
- }
- var a = textState.textLineMatrix[0];
- var b = textState.textLineMatrix[1];
- var scaleLineX = Math.sqrt(a * a + b * b);
- a = textState.ctm[0];
- b = textState.ctm[1];
- var scaleCtmX = Math.sqrt(a * a + b * b);
- textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
- textContentItem.lastAdvanceWidth = 0;
- textContentItem.lastAdvanceHeight = 0;
- var spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
- if (spaceWidth) {
- textContentItem.spaceWidth = spaceWidth;
- textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR;
- textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR;
- textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX;
- textContentItem.textRunBreakAllowed = !font.isMonospace;
- } else {
- textContentItem.spaceWidth = 0;
- textContentItem.fakeSpaceMin = Infinity;
- textContentItem.fakeMultiSpaceMin = Infinity;
- textContentItem.fakeMultiSpaceMax = 0;
- textContentItem.textRunBreakAllowed = false;
- }
- textContentItem.initialized = true;
- return textContentItem;
- }
- function replaceWhitespace(str) {
- var i = 0,
- ii = str.length,
- code;
- while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7F) {
- i++;
- }
- return i < ii ? str.replace(WhitespaceRegexp, ' ') : str;
- }
- function runBidiTransform(textChunk) {
- var str = textChunk.str.join('');
- var bidiResult = (0, _bidi.bidi)(str, -1, textChunk.vertical);
- return {
- str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str,
- dir: bidiResult.dir,
- width: textChunk.width,
- height: textChunk.height,
- transform: textChunk.transform,
- fontName: textChunk.fontName
- };
- }
- function handleSetFont(fontName, fontRef) {
- return self.loadFont(fontName, fontRef, resources).then(function (translated) {
- textState.font = translated.font;
- textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
- });
- }
- function buildTextContentItem(chars) {
- var font = textState.font;
- var textChunk = ensureTextContentItem();
- var width = 0;
- var height = 0;
- var glyphs = font.charsToGlyphs(chars);
- for (var i = 0; i < glyphs.length; i++) {
- var glyph = glyphs[i];
- var glyphWidth = null;
- if (font.vertical && glyph.vmetric) {
- glyphWidth = glyph.vmetric[0];
- } else {
- glyphWidth = glyph.width;
- }
- var glyphUnicode = glyph.unicode;
- var NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
- if (NormalizedUnicodes[glyphUnicode] !== undefined) {
- glyphUnicode = NormalizedUnicodes[glyphUnicode];
- }
- glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
- var charSpacing = textState.charSpacing;
- if (glyph.isSpace) {
- var wordSpacing = textState.wordSpacing;
- charSpacing += wordSpacing;
- if (wordSpacing > 0) {
- addFakeSpaces(wordSpacing, textChunk.str);
- }
- }
- var tx = 0;
- var ty = 0;
- if (!font.vertical) {
- var w0 = glyphWidth * textState.fontMatrix[0];
- tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale;
- width += tx;
- } else {
- var w1 = glyphWidth * textState.fontMatrix[0];
- ty = w1 * textState.fontSize + charSpacing;
- height += ty;
- }
- textState.translateTextMatrix(tx, ty);
- textChunk.str.push(glyphUnicode);
- }
- if (!font.vertical) {
- textChunk.lastAdvanceWidth = width;
- textChunk.width += width;
- } else {
- textChunk.lastAdvanceHeight = height;
- textChunk.height += Math.abs(height);
- }
- return textChunk;
- }
- function addFakeSpaces(width, strBuf) {
- if (width < textContentItem.fakeSpaceMin) {
- return;
- }
- if (width < textContentItem.fakeMultiSpaceMin) {
- strBuf.push(' ');
- return;
- }
- var fakeSpaces = Math.round(width / textContentItem.spaceWidth);
- while (fakeSpaces-- > 0) {
- strBuf.push(' ');
- }
- }
- function flushTextContentItem() {
- if (!textContentItem.initialized) {
- return;
- }
- textContentItem.width *= textContentItem.textAdvanceScale;
- textContentItem.height *= textContentItem.textAdvanceScale;
- textContent.items.push(runBidiTransform(textContentItem));
- textContentItem.initialized = false;
- textContentItem.str.length = 0;
- }
- function enqueueChunk() {
- var length = textContent.items.length;
- if (length > 0) {
- sink.enqueue(textContent, length);
- textContent.items = [];
- textContent.styles = Object.create(null);
- }
- }
- var timeSlotManager = new TimeSlotManager();
- return new Promise(function promiseBody(resolve, reject) {
- var next = function next(promise) {
- enqueueChunk();
- Promise.all([promise, sink.ready]).then(function () {
- try {
- promiseBody(resolve, reject);
- } catch (ex) {
- reject(ex);
- }
- }, reject);
- };
- task.ensureNotTerminated();
- timeSlotManager.reset();
- var stop,
- operation = {},
- args = [];
- while (!(stop = timeSlotManager.check())) {
- args.length = 0;
- operation.args = args;
- if (!preprocessor.read(operation)) {
- break;
- }
- textState = stateManager.state;
- var fn = operation.fn;
- args = operation.args;
- var advance, diff;
- switch (fn | 0) {
- case _util.OPS.setFont:
- var fontNameArg = args[0].name,
- fontSizeArg = args[1];
- if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
- break;
- }
- flushTextContentItem();
- textState.fontName = fontNameArg;
- textState.fontSize = fontSizeArg;
- next(handleSetFont(fontNameArg, null));
- return;
- case _util.OPS.setTextRise:
- flushTextContentItem();
- textState.textRise = args[0];
- break;
- case _util.OPS.setHScale:
- flushTextContentItem();
- textState.textHScale = args[0] / 100;
- break;
- case _util.OPS.setLeading:
- flushTextContentItem();
- textState.leading = args[0];
- break;
- case _util.OPS.moveText:
- var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
- advance = args[0] - args[1];
- if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
- textState.translateTextLineMatrix(args[0], args[1]);
- textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
- textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
- diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
- addFakeSpaces(diff, textContentItem.str);
- break;
- }
- flushTextContentItem();
- textState.translateTextLineMatrix(args[0], args[1]);
- textState.textMatrix = textState.textLineMatrix.slice();
- break;
- case _util.OPS.setLeadingMoveText:
- flushTextContentItem();
- textState.leading = -args[1];
- textState.translateTextLineMatrix(args[0], args[1]);
- textState.textMatrix = textState.textLineMatrix.slice();
- break;
- case _util.OPS.nextLine:
- flushTextContentItem();
- textState.carriageReturn();
- break;
- case _util.OPS.setTextMatrix:
- advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
- if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
- textState.translateTextLineMatrix(advance.width, advance.height);
- textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
- textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
- diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
- addFakeSpaces(diff, textContentItem.str);
- break;
- }
- flushTextContentItem();
- textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
- textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
- break;
- case _util.OPS.setCharSpacing:
- textState.charSpacing = args[0];
- break;
- case _util.OPS.setWordSpacing:
- textState.wordSpacing = args[0];
- break;
- case _util.OPS.beginText:
- flushTextContentItem();
- textState.textMatrix = _util.IDENTITY_MATRIX.slice();
- textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
- break;
- case _util.OPS.showSpacedText:
- var items = args[0];
- var offset;
- for (var j = 0, jj = items.length; j < jj; j++) {
- if (typeof items[j] === 'string') {
- buildTextContentItem(items[j]);
- } else if ((0, _util.isNum)(items[j])) {
- ensureTextContentItem();
- advance = items[j] * textState.fontSize / 1000;
- var breakTextRun = false;
- if (textState.font.vertical) {
- offset = advance;
- textState.translateTextMatrix(0, offset);
- breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
- if (!breakTextRun) {
- textContentItem.height += offset;
- }
- } else {
- advance = -advance;
- offset = advance * textState.textHScale;
- textState.translateTextMatrix(offset, 0);
- breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
- if (!breakTextRun) {
- textContentItem.width += offset;
- }
- }
- if (breakTextRun) {
- flushTextContentItem();
- } else if (advance > 0) {
- addFakeSpaces(advance, textContentItem.str);
- }
- }
- }
- break;
- case _util.OPS.showText:
- buildTextContentItem(args[0]);
- break;
- case _util.OPS.nextLineShowText:
- flushTextContentItem();
- textState.carriageReturn();
- buildTextContentItem(args[0]);
- break;
- case _util.OPS.nextLineSetSpacingShowText:
- flushTextContentItem();
- textState.wordSpacing = args[0];
- textState.charSpacing = args[1];
- textState.carriageReturn();
- buildTextContentItem(args[2]);
- break;
- case _util.OPS.paintXObject:
- flushTextContentItem();
- if (!xobjs) {
- xobjs = resources.get('XObject') || _primitives.Dict.empty;
- }
- var name = args[0].name;
- if (name && skipEmptyXObjs[name] !== undefined) {
- break;
- }
- next(new Promise(function (resolveXObject, rejectXObject) {
- if (!name) {
- throw new _util.FormatError('XObject must be referred to by name.');
- }
- var xobj = xobjs.get(name);
- if (!xobj) {
- resolveXObject();
- return;
- }
- if (!(0, _primitives.isStream)(xobj)) {
- throw new _util.FormatError('XObject should be a stream');
- }
- var type = xobj.dict.get('Subtype');
- if (!(0, _primitives.isName)(type)) {
- throw new _util.FormatError('XObject should have a Name subtype');
- }
- if (type.name !== 'Form') {
- skipEmptyXObjs[name] = true;
- resolveXObject();
- return;
- }
- var currentState = stateManager.state.clone();
- var xObjStateManager = new StateManager(currentState);
- var matrix = xobj.dict.getArray('Matrix');
- if (Array.isArray(matrix) && matrix.length === 6) {
- xObjStateManager.transform(matrix);
- }
- enqueueChunk();
- var sinkWrapper = {
- enqueueInvoked: false,
- enqueue: function enqueue(chunk, size) {
- this.enqueueInvoked = true;
- sink.enqueue(chunk, size);
- },
-
- get desiredSize() {
- return sink.desiredSize;
- },
- get ready() {
- return sink.ready;
- }
- };
- self.getTextContent({
- stream: xobj,
- task: task,
- resources: xobj.dict.get('Resources') || resources,
- stateManager: xObjStateManager,
- normalizeWhitespace: normalizeWhitespace,
- combineTextItems: combineTextItems,
- sink: sinkWrapper,
- seenStyles: seenStyles
- }).then(function () {
- if (!sinkWrapper.enqueueInvoked) {
- skipEmptyXObjs[name] = true;
- }
- resolveXObject();
- }, rejectXObject);
- }).catch(function (reason) {
- if (reason instanceof _util.AbortException) {
- return;
- }
- if (self.options.ignoreErrors) {
- (0, _util.warn)('getTextContent - ignoring XObject: "' + reason + '".');
- return;
- }
- throw reason;
- }));
- return;
- case _util.OPS.setGState:
- flushTextContentItem();
- var dictName = args[0];
- var extGState = resources.get('ExtGState');
- if (!(0, _primitives.isDict)(extGState) || !(0, _primitives.isName)(dictName)) {
- break;
- }
- var gState = extGState.get(dictName.name);
- if (!(0, _primitives.isDict)(gState)) {
- break;
- }
- var gStateFont = gState.get('Font');
- if (gStateFont) {
- textState.fontName = null;
- textState.fontSize = gStateFont[1];
- next(handleSetFont(null, gStateFont[0]));
- return;
- }
- break;
- }
- if (textContent.items.length >= sink.desiredSize) {
- stop = true;
- break;
- }
- }
- if (stop) {
- next(deferred);
- return;
- }
- flushTextContentItem();
- enqueueChunk();
- resolve();
- }).catch(function (reason) {
- if (reason instanceof _util.AbortException) {
- return;
- }
- if (_this9.options.ignoreErrors) {
- (0, _util.warn)('getTextContent - ignoring errors during "' + task.name + '" ' + ('task: "' + reason + '".'));
- flushTextContentItem();
- enqueueChunk();
- return;
- }
- throw reason;
- });
- },
-
- extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, properties) {
- var _this10 = this;
-
- var xref = this.xref;
- var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
- var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined);
- if (properties.composite) {
- var cidSystemInfo = dict.get('CIDSystemInfo');
- if ((0, _primitives.isDict)(cidSystemInfo)) {
- properties.cidSystemInfo = {
- registry: (0, _util.stringToPDFString)(cidSystemInfo.get('Registry')),
- ordering: (0, _util.stringToPDFString)(cidSystemInfo.get('Ordering')),
- supplement: cidSystemInfo.get('Supplement')
- };
- }
- var cidToGidMap = dict.get('CIDToGIDMap');
- if ((0, _primitives.isStream)(cidToGidMap)) {
- properties.cidToGidMap = this.readCidToGidMap(cidToGidMap);
- }
- }
- var differences = [];
- var baseEncodingName = null;
- var encoding;
- if (dict.has('Encoding')) {
- encoding = dict.get('Encoding');
- if ((0, _primitives.isDict)(encoding)) {
- baseEncodingName = encoding.get('BaseEncoding');
- baseEncodingName = (0, _primitives.isName)(baseEncodingName) ? baseEncodingName.name : null;
- if (encoding.has('Differences')) {
- var diffEncoding = encoding.get('Differences');
- var index = 0;
- for (var j = 0, jj = diffEncoding.length; j < jj; j++) {
- var data = xref.fetchIfRef(diffEncoding[j]);
- if ((0, _util.isNum)(data)) {
- index = data;
- } else if ((0, _primitives.isName)(data)) {
- differences[index++] = data.name;
- } else {
- throw new _util.FormatError('Invalid entry in \'Differences\' array: ' + data);
- }
- }
- }
- } else if ((0, _primitives.isName)(encoding)) {
- baseEncodingName = encoding.name;
- } else {
- throw new _util.FormatError('Encoding is not a Name nor a Dict');
- }
- if (baseEncodingName !== 'MacRomanEncoding' && baseEncodingName !== 'MacExpertEncoding' && baseEncodingName !== 'WinAnsiEncoding') {
- baseEncodingName = null;
- }
- }
- if (baseEncodingName) {
- properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName).slice();
- } else {
- var isSymbolicFont = !!(properties.flags & _fonts.FontFlags.Symbolic);
- var isNonsymbolicFont = !!(properties.flags & _fonts.FontFlags.Nonsymbolic);
- encoding = _encodings.StandardEncoding;
- if (properties.type === 'TrueType' && !isNonsymbolicFont) {
- encoding = _encodings.WinAnsiEncoding;
- }
- if (isSymbolicFont) {
- encoding = _encodings.MacRomanEncoding;
- if (!properties.file) {
- if (/Symbol/i.test(properties.name)) {
- encoding = _encodings.SymbolSetEncoding;
- } else if (/Dingbats/i.test(properties.name)) {
- encoding = _encodings.ZapfDingbatsEncoding;
- }
- }
- }
- properties.defaultEncoding = encoding;
- }
- properties.differences = differences;
- properties.baseEncodingName = baseEncodingName;
- properties.hasEncoding = !!baseEncodingName || differences.length > 0;
- properties.dict = dict;
- return toUnicodePromise.then(function (toUnicode) {
- properties.toUnicode = toUnicode;
- return _this10.buildToUnicode(properties);
- }).then(function (toUnicode) {
- properties.toUnicode = toUnicode;
- return properties;
- });
- },
- _buildSimpleFontToUnicode: function _buildSimpleFontToUnicode(properties) {
- (0, _util.assert)(!properties.composite, 'Must be a simple font.');
- var toUnicode = [],
- charcode = void 0,
- glyphName = void 0;
- var encoding = properties.defaultEncoding.slice();
- var baseEncodingName = properties.baseEncodingName;
- var differences = properties.differences;
- for (charcode in differences) {
- glyphName = differences[charcode];
- if (glyphName === '.notdef') {
- continue;
- }
- encoding[charcode] = glyphName;
- }
- var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
- for (charcode in encoding) {
- glyphName = encoding[charcode];
- if (glyphName === '') {
- continue;
- } else if (glyphsUnicodeMap[glyphName] === undefined) {
- var code = 0;
- switch (glyphName[0]) {
- case 'G':
- if (glyphName.length === 3) {
- code = parseInt(glyphName.substring(1), 16);
- }
- break;
- case 'g':
- if (glyphName.length === 5) {
- code = parseInt(glyphName.substring(1), 16);
- }
- break;
- case 'C':
- case 'c':
- if (glyphName.length >= 3) {
- code = +glyphName.substring(1);
- }
- break;
- default:
- var unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
- if (unicode !== -1) {
- code = unicode;
- }
- }
- if (code) {
- if (baseEncodingName && code === +charcode) {
- var baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
- if (baseEncoding && (glyphName = baseEncoding[charcode])) {
- toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
- continue;
- }
- }
- toUnicode[charcode] = String.fromCharCode(code);
- }
- continue;
- }
- toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
- }
- return new _fonts.ToUnicodeMap(toUnicode);
- },
- buildToUnicode: function buildToUnicode(properties) {
- properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
- if (properties.hasIncludedToUnicodeMap) {
- if (!properties.composite && properties.hasEncoding) {
- properties.fallbackToUnicode = this._buildSimpleFontToUnicode(properties);
- }
- return Promise.resolve(properties.toUnicode);
- }
- if (!properties.composite) {
- return Promise.resolve(this._buildSimpleFontToUnicode(properties));
- }
- if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof _cmap.IdentityCMap) || properties.cidSystemInfo.registry === 'Adobe' && (properties.cidSystemInfo.ordering === 'GB1' || properties.cidSystemInfo.ordering === 'CNS1' || properties.cidSystemInfo.ordering === 'Japan1' || properties.cidSystemInfo.ordering === 'Korea1'))) {
- var registry = properties.cidSystemInfo.registry;
- var ordering = properties.cidSystemInfo.ordering;
- var ucs2CMapName = _primitives.Name.get(registry + '-' + ordering + '-UCS2');
- return _cmap.CMapFactory.create({
- encoding: ucs2CMapName,
- fetchBuiltInCMap: this.fetchBuiltInCMap,
- useCMap: null
- }).then(function (ucs2CMap) {
- var cMap = properties.cMap;
- var toUnicode = [];
- cMap.forEach(function (charcode, cid) {
- if (cid > 0xffff) {
- throw new _util.FormatError('Max size of CID is 65,535');
- }
- var ucs2 = ucs2CMap.lookup(cid);
- if (ucs2) {
- toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
- }
- });
- return new _fonts.ToUnicodeMap(toUnicode);
- });
- }
- return Promise.resolve(new _fonts.IdentityToUnicodeMap(properties.firstChar, properties.lastChar));
- },
-
- readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
- var cmapObj = toUnicode;
- if ((0, _primitives.isName)(cmapObj)) {
- return _cmap.CMapFactory.create({
- encoding: cmapObj,
- fetchBuiltInCMap: this.fetchBuiltInCMap,
- useCMap: null
- }).then(function (cmap) {
- if (cmap instanceof _cmap.IdentityCMap) {
- return new _fonts.IdentityToUnicodeMap(0, 0xFFFF);
- }
- return new _fonts.ToUnicodeMap(cmap.getMap());
- });
- } else if ((0, _primitives.isStream)(cmapObj)) {
- return _cmap.CMapFactory.create({
- encoding: cmapObj,
- fetchBuiltInCMap: this.fetchBuiltInCMap,
- useCMap: null
- }).then(function (cmap) {
- if (cmap instanceof _cmap.IdentityCMap) {
- return new _fonts.IdentityToUnicodeMap(0, 0xFFFF);
- }
- var map = new Array(cmap.length);
- cmap.forEach(function (charCode, token) {
- var str = [];
- for (var k = 0; k < token.length; k += 2) {
- var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
- if ((w1 & 0xF800) !== 0xD800) {
- str.push(w1);
- continue;
- }
- k += 2;
- var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
- str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
- }
- map[charCode] = String.fromCharCode.apply(String, str);
- });
- return new _fonts.ToUnicodeMap(map);
- });
- }
- return Promise.resolve(null);
- },
- readCidToGidMap: function PartialEvaluator_readCidToGidMap(cidToGidStream) {
- var glyphsData = cidToGidStream.getBytes();
- var result = [];
- for (var j = 0, jj = glyphsData.length; j < jj; j++) {
- var glyphID = glyphsData[j++] << 8 | glyphsData[j];
- if (glyphID === 0) {
- continue;
- }
- var code = j >> 1;
- result[code] = glyphID;
- }
- return result;
- },
- extractWidths: function PartialEvaluator_extractWidths(dict, descriptor, properties) {
- var xref = this.xref;
- var glyphsWidths = [];
- var defaultWidth = 0;
- var glyphsVMetrics = [];
- var defaultVMetrics;
- var i, ii, j, jj, start, code, widths;
- if (properties.composite) {
- defaultWidth = dict.has('DW') ? dict.get('DW') : 1000;
- widths = dict.get('W');
- if (widths) {
- for (i = 0, ii = widths.length; i < ii; i++) {
- start = xref.fetchIfRef(widths[i++]);
- code = xref.fetchIfRef(widths[i]);
- if (Array.isArray(code)) {
- for (j = 0, jj = code.length; j < jj; j++) {
- glyphsWidths[start++] = xref.fetchIfRef(code[j]);
- }
- } else {
- var width = xref.fetchIfRef(widths[++i]);
- for (j = start; j <= code; j++) {
- glyphsWidths[j] = width;
- }
- }
- }
- }
- if (properties.vertical) {
- var vmetrics = dict.getArray('DW2') || [880, -1000];
- defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
- vmetrics = dict.get('W2');
- if (vmetrics) {
- for (i = 0, ii = vmetrics.length; i < ii; i++) {
- start = xref.fetchIfRef(vmetrics[i++]);
- code = xref.fetchIfRef(vmetrics[i]);
- if (Array.isArray(code)) {
- for (j = 0, jj = code.length; j < jj; j++) {
- glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
- }
- } else {
- var vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
- for (j = start; j <= code; j++) {
- glyphsVMetrics[j] = vmetric;
- }
- }
- }
- }
- }
- } else {
- var firstChar = properties.firstChar;
- widths = dict.get('Widths');
- if (widths) {
- j = firstChar;
- for (i = 0, ii = widths.length; i < ii; i++) {
- glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
- }
- defaultWidth = parseFloat(descriptor.get('MissingWidth')) || 0;
- } else {
- var baseFontName = dict.get('BaseFont');
- if ((0, _primitives.isName)(baseFontName)) {
- var metrics = this.getBaseFontMetrics(baseFontName.name);
- glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
- defaultWidth = metrics.defaultWidth;
- }
- }
- }
- var isMonospace = true;
- var firstWidth = defaultWidth;
- for (var glyph in glyphsWidths) {
- var glyphWidth = glyphsWidths[glyph];
- if (!glyphWidth) {
- continue;
- }
- if (!firstWidth) {
- firstWidth = glyphWidth;
- continue;
- }
- if (firstWidth !== glyphWidth) {
- isMonospace = false;
- break;
- }
- }
- if (isMonospace) {
- properties.flags |= _fonts.FontFlags.FixedPitch;
- }
- properties.defaultWidth = defaultWidth;
- properties.widths = glyphsWidths;
- properties.defaultVMetrics = defaultVMetrics;
- properties.vmetrics = glyphsVMetrics;
- },
- isSerifFont: function PartialEvaluator_isSerifFont(baseFontName) {
- var fontNameWoStyle = baseFontName.split('-')[0];
- return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1;
- },
- getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) {
- var defaultWidth = 0;
- var widths = [];
- var monospace = false;
- var stdFontMap = (0, _standard_fonts.getStdFontMap)();
- var lookupName = stdFontMap[name] || name;
- var Metrics = (0, _metrics.getMetrics)();
- if (!(lookupName in Metrics)) {
- if (this.isSerifFont(name)) {
- lookupName = 'Times-Roman';
- } else {
- lookupName = 'Helvetica';
- }
- }
- var glyphWidths = Metrics[lookupName];
- if ((0, _util.isNum)(glyphWidths)) {
- defaultWidth = glyphWidths;
- monospace = true;
- } else {
- widths = glyphWidths();
- }
- return {
- defaultWidth: defaultWidth,
- monospace: monospace,
- widths: widths
- };
- },
- buildCharCodeToWidth: function PartialEvaluator_bulildCharCodeToWidth(widthsByGlyphName, properties) {
- var widths = Object.create(null);
- var differences = properties.differences;
- var encoding = properties.defaultEncoding;
- for (var charCode = 0; charCode < 256; charCode++) {
- if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
- widths[charCode] = widthsByGlyphName[differences[charCode]];
- continue;
- }
- if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
- widths[charCode] = widthsByGlyphName[encoding[charCode]];
- continue;
- }
- }
- return widths;
- },
- preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict) {
- var baseDict = dict;
- var type = dict.get('Subtype');
- if (!(0, _primitives.isName)(type)) {
- throw new _util.FormatError('invalid font Subtype');
- }
- var composite = false;
- var uint8array;
- if (type.name === 'Type0') {
- var df = dict.get('DescendantFonts');
- if (!df) {
- throw new _util.FormatError('Descendant fonts are not specified');
- }
- dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
- type = dict.get('Subtype');
- if (!(0, _primitives.isName)(type)) {
- throw new _util.FormatError('invalid font Subtype');
- }
- composite = true;
- }
- var descriptor = dict.get('FontDescriptor');
- if (descriptor) {
- var hash = new _murmurhash.MurmurHash3_64();
- var encoding = baseDict.getRaw('Encoding');
- if ((0, _primitives.isName)(encoding)) {
- hash.update(encoding.name);
- } else if ((0, _primitives.isRef)(encoding)) {
- hash.update(encoding.toString());
- } else if ((0, _primitives.isDict)(encoding)) {
- var keys = encoding.getKeys();
- for (var i = 0, ii = keys.length; i < ii; i++) {
- var entry = encoding.getRaw(keys[i]);
- if ((0, _primitives.isName)(entry)) {
- hash.update(entry.name);
- } else if ((0, _primitives.isRef)(entry)) {
- hash.update(entry.toString());
- } else if (Array.isArray(entry)) {
- var diffLength = entry.length,
- diffBuf = new Array(diffLength);
- for (var j = 0; j < diffLength; j++) {
- var diffEntry = entry[j];
- if ((0, _primitives.isName)(diffEntry)) {
- diffBuf[j] = diffEntry.name;
- } else if ((0, _util.isNum)(diffEntry) || (0, _primitives.isRef)(diffEntry)) {
- diffBuf[j] = diffEntry.toString();
- }
- }
- hash.update(diffBuf.join());
- }
- }
- }
- var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
- if ((0, _primitives.isStream)(toUnicode)) {
- var stream = toUnicode.str || toUnicode;
- uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
- hash.update(uint8array);
- } else if ((0, _primitives.isName)(toUnicode)) {
- hash.update(toUnicode.name);
- }
- var widths = dict.get('Widths') || baseDict.get('Widths');
- if (widths) {
- uint8array = new Uint8Array(new Uint32Array(widths).buffer);
- hash.update(uint8array);
- }
- }
- return {
- descriptor: descriptor,
- dict: dict,
- baseDict: baseDict,
- composite: composite,
- type: type.name,
- hash: hash ? hash.hexdigest() : ''
- };
- },
- translateFont: function PartialEvaluator_translateFont(preEvaluatedFont) {
- var _this11 = this;
-
- var baseDict = preEvaluatedFont.baseDict;
- var dict = preEvaluatedFont.dict;
- var composite = preEvaluatedFont.composite;
- var descriptor = preEvaluatedFont.descriptor;
- var type = preEvaluatedFont.type;
- var maxCharIndex = composite ? 0xFFFF : 0xFF;
- var properties;
- if (!descriptor) {
- if (type === 'Type3') {
- descriptor = new _primitives.Dict(null);
- descriptor.set('FontName', _primitives.Name.get(type));
- descriptor.set('FontBBox', dict.getArray('FontBBox'));
- } else {
- var baseFontName = dict.get('BaseFont');
- if (!(0, _primitives.isName)(baseFontName)) {
- throw new _util.FormatError('Base font is not specified');
- }
- baseFontName = baseFontName.name.replace(/[,_]/g, '-');
- var metrics = this.getBaseFontMetrics(baseFontName);
- var fontNameWoStyle = baseFontName.split('-')[0];
- var flags = (this.isSerifFont(fontNameWoStyle) ? _fonts.FontFlags.Serif : 0) | (metrics.monospace ? _fonts.FontFlags.FixedPitch : 0) | ((0, _standard_fonts.getSymbolsFonts)()[fontNameWoStyle] ? _fonts.FontFlags.Symbolic : _fonts.FontFlags.Nonsymbolic);
- properties = {
- type: type,
- name: baseFontName,
- widths: metrics.widths,
- defaultWidth: metrics.defaultWidth,
- flags: flags,
- firstChar: 0,
- lastChar: maxCharIndex
- };
- return this.extractDataStructures(dict, dict, properties).then(function (properties) {
- properties.widths = _this11.buildCharCodeToWidth(metrics.widths, properties);
- return new _fonts.Font(baseFontName, null, properties);
- });
- }
- }
- var firstChar = dict.get('FirstChar') || 0;
- var lastChar = dict.get('LastChar') || maxCharIndex;
- var fontName = descriptor.get('FontName');
- var baseFont = dict.get('BaseFont');
- if ((0, _util.isString)(fontName)) {
- fontName = _primitives.Name.get(fontName);
- }
- if ((0, _util.isString)(baseFont)) {
- baseFont = _primitives.Name.get(baseFont);
- }
- if (type !== 'Type3') {
- var fontNameStr = fontName && fontName.name;
- var baseFontStr = baseFont && baseFont.name;
- if (fontNameStr !== baseFontStr) {
- (0, _util.info)('The FontDescriptor\'s FontName is "' + fontNameStr + '" but should be the same as the Font\'s BaseFont "' + baseFontStr + '"');
- if (fontNameStr && baseFontStr && baseFontStr.indexOf(fontNameStr) === 0) {
- fontName = baseFont;
- }
- }
- }
- fontName = fontName || baseFont;
- if (!(0, _primitives.isName)(fontName)) {
- throw new _util.FormatError('invalid font name');
- }
- var fontFile = descriptor.get('FontFile', 'FontFile2', 'FontFile3');
- if (fontFile) {
- if (fontFile.dict) {
- var subtype = fontFile.dict.get('Subtype');
- if (subtype) {
- subtype = subtype.name;
- }
- var length1 = fontFile.dict.get('Length1');
- var length2 = fontFile.dict.get('Length2');
- var length3 = fontFile.dict.get('Length3');
- }
- }
- properties = {
- type: type,
- name: fontName.name,
- subtype: subtype,
- file: fontFile,
- length1: length1,
- length2: length2,
- length3: length3,
- loadedName: baseDict.loadedName,
- composite: composite,
- wideChars: composite,
- fixedPitch: false,
- fontMatrix: dict.getArray('FontMatrix') || _util.FONT_IDENTITY_MATRIX,
- firstChar: firstChar || 0,
- lastChar: lastChar || maxCharIndex,
- bbox: descriptor.getArray('FontBBox'),
- ascent: descriptor.get('Ascent'),
- descent: descriptor.get('Descent'),
- xHeight: descriptor.get('XHeight'),
- capHeight: descriptor.get('CapHeight'),
- flags: descriptor.get('Flags'),
- italicAngle: descriptor.get('ItalicAngle'),
- isType3Font: false
- };
- var cMapPromise;
- if (composite) {
- var cidEncoding = baseDict.get('Encoding');
- if ((0, _primitives.isName)(cidEncoding)) {
- properties.cidEncoding = cidEncoding.name;
- }
- cMapPromise = _cmap.CMapFactory.create({
- encoding: cidEncoding,
- fetchBuiltInCMap: this.fetchBuiltInCMap,
- useCMap: null
- }).then(function (cMap) {
- properties.cMap = cMap;
- properties.vertical = properties.cMap.vertical;
- });
- } else {
- cMapPromise = Promise.resolve(undefined);
- }
- return cMapPromise.then(function () {
- return _this11.extractDataStructures(dict, baseDict, properties);
- }).then(function (properties) {
- _this11.extractWidths(dict, descriptor, properties);
- if (type === 'Type3') {
- properties.isType3Font = true;
- }
- return new _fonts.Font(fontName.name, fontFile, properties);
- });
- }
- };
- return PartialEvaluator;
-}();
-var TranslatedFont = function TranslatedFontClosure() {
- function TranslatedFont(loadedName, font, dict) {
- this.loadedName = loadedName;
- this.font = font;
- this.dict = dict;
- this.type3Loaded = null;
- this.sent = false;
- }
- TranslatedFont.prototype = {
- send: function send(handler) {
- if (this.sent) {
- return;
- }
- var fontData = this.font.exportData();
- handler.send('commonobj', [this.loadedName, 'Font', fontData]);
- this.sent = true;
- },
- loadType3Data: function loadType3Data(evaluator, resources, parentOperatorList, task) {
- if (!this.font.isType3Font) {
- throw new Error('Must be a Type3 font.');
- }
- if (this.type3Loaded) {
- return this.type3Loaded;
- }
- var type3Options = Object.create(evaluator.options);
- type3Options.ignoreErrors = false;
- var type3Evaluator = evaluator.clone(type3Options);
- var translatedFont = this.font;
- var loadCharProcsPromise = Promise.resolve();
- var charProcs = this.dict.get('CharProcs');
- var fontResources = this.dict.get('Resources') || resources;
- var charProcKeys = charProcs.getKeys();
- var charProcOperatorList = Object.create(null);
-
- var _loop2 = function _loop2() {
- var key = charProcKeys[i];
- loadCharProcsPromise = loadCharProcsPromise.then(function () {
- var glyphStream = charProcs.get(key);
- var operatorList = new _operator_list.OperatorList();
- return type3Evaluator.getOperatorList({
- stream: glyphStream,
- task: task,
- resources: fontResources,
- operatorList: operatorList
- }).then(function () {
- charProcOperatorList[key] = operatorList.getIR();
- parentOperatorList.addDependencies(operatorList.dependencies);
- }).catch(function (reason) {
- (0, _util.warn)('Type3 font resource "' + key + '" is not available.');
- var operatorList = new _operator_list.OperatorList();
- charProcOperatorList[key] = operatorList.getIR();
- });
- });
- };
-
- for (var i = 0, n = charProcKeys.length; i < n; ++i) {
- _loop2();
- }
- this.type3Loaded = loadCharProcsPromise.then(function () {
- translatedFont.charProcOperatorList = charProcOperatorList;
- });
- return this.type3Loaded;
- }
- };
- return TranslatedFont;
-}();
-var StateManager = function StateManagerClosure() {
- function StateManager(initialState) {
- this.state = initialState;
- this.stateStack = [];
- }
- StateManager.prototype = {
- save: function save() {
- var old = this.state;
- this.stateStack.push(this.state);
- this.state = old.clone();
- },
- restore: function restore() {
- var prev = this.stateStack.pop();
- if (prev) {
- this.state = prev;
- }
- },
- transform: function transform(args) {
- this.state.ctm = _util.Util.transform(this.state.ctm, args);
- }
- };
- return StateManager;
-}();
-var TextState = function TextStateClosure() {
- function TextState() {
- this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
- this.fontName = null;
- this.fontSize = 0;
- this.font = null;
- this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
- this.textMatrix = _util.IDENTITY_MATRIX.slice();
- this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
- this.charSpacing = 0;
- this.wordSpacing = 0;
- this.leading = 0;
- this.textHScale = 1;
- this.textRise = 0;
- }
- TextState.prototype = {
- setTextMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
- var m = this.textMatrix;
- m[0] = a;
- m[1] = b;
- m[2] = c;
- m[3] = d;
- m[4] = e;
- m[5] = f;
- },
- setTextLineMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
- var m = this.textLineMatrix;
- m[0] = a;
- m[1] = b;
- m[2] = c;
- m[3] = d;
- m[4] = e;
- m[5] = f;
- },
- translateTextMatrix: function TextState_translateTextMatrix(x, y) {
- var m = this.textMatrix;
- m[4] = m[0] * x + m[2] * y + m[4];
- m[5] = m[1] * x + m[3] * y + m[5];
- },
- translateTextLineMatrix: function TextState_translateTextMatrix(x, y) {
- var m = this.textLineMatrix;
- m[4] = m[0] * x + m[2] * y + m[4];
- m[5] = m[1] * x + m[3] * y + m[5];
- },
- calcTextLineMatrixAdvance: function TextState_calcTextLineMatrixAdvance(a, b, c, d, e, f) {
- var font = this.font;
- if (!font) {
- return null;
- }
- var m = this.textLineMatrix;
- if (!(a === m[0] && b === m[1] && c === m[2] && d === m[3])) {
- return null;
- }
- var txDiff = e - m[4],
- tyDiff = f - m[5];
- if (font.vertical && txDiff !== 0 || !font.vertical && tyDiff !== 0) {
- return null;
- }
- var tx,
- ty,
- denominator = a * d - b * c;
- if (font.vertical) {
- tx = -tyDiff * c / denominator;
- ty = tyDiff * a / denominator;
- } else {
- tx = txDiff * d / denominator;
- ty = -txDiff * b / denominator;
- }
- return {
- width: tx,
- height: ty,
- value: font.vertical ? ty : tx
- };
- },
- calcRenderMatrix: function TextState_calcRendeMatrix(ctm) {
- var tsm = [this.fontSize * this.textHScale, 0, 0, this.fontSize, 0, this.textRise];
- return _util.Util.transform(ctm, _util.Util.transform(this.textMatrix, tsm));
- },
- carriageReturn: function TextState_carriageReturn() {
- this.translateTextLineMatrix(0, -this.leading);
- this.textMatrix = this.textLineMatrix.slice();
- },
- clone: function TextState_clone() {
- var clone = Object.create(this);
- clone.textMatrix = this.textMatrix.slice();
- clone.textLineMatrix = this.textLineMatrix.slice();
- clone.fontMatrix = this.fontMatrix.slice();
- return clone;
- }
- };
- return TextState;
-}();
-var EvalState = function EvalStateClosure() {
- function EvalState() {
- this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
- this.font = null;
- this.textRenderingMode = _util.TextRenderingMode.FILL;
- this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
- this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
- }
- EvalState.prototype = {
- clone: function CanvasExtraState_clone() {
- return Object.create(this);
- }
- };
- return EvalState;
-}();
-var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
- var getOPMap = (0, _util.getLookupTableFactory)(function (t) {
- t['w'] = {
- id: _util.OPS.setLineWidth,
- numArgs: 1,
- variableArgs: false
- };
- t['J'] = {
- id: _util.OPS.setLineCap,
- numArgs: 1,
- variableArgs: false
- };
- t['j'] = {
- id: _util.OPS.setLineJoin,
- numArgs: 1,
- variableArgs: false
- };
- t['M'] = {
- id: _util.OPS.setMiterLimit,
- numArgs: 1,
- variableArgs: false
- };
- t['d'] = {
- id: _util.OPS.setDash,
- numArgs: 2,
- variableArgs: false
- };
- t['ri'] = {
- id: _util.OPS.setRenderingIntent,
- numArgs: 1,
- variableArgs: false
- };
- t['i'] = {
- id: _util.OPS.setFlatness,
- numArgs: 1,
- variableArgs: false
- };
- t['gs'] = {
- id: _util.OPS.setGState,
- numArgs: 1,
- variableArgs: false
- };
- t['q'] = {
- id: _util.OPS.save,
- numArgs: 0,
- variableArgs: false
- };
- t['Q'] = {
- id: _util.OPS.restore,
- numArgs: 0,
- variableArgs: false
- };
- t['cm'] = {
- id: _util.OPS.transform,
- numArgs: 6,
- variableArgs: false
- };
- t['m'] = {
- id: _util.OPS.moveTo,
- numArgs: 2,
- variableArgs: false
- };
- t['l'] = {
- id: _util.OPS.lineTo,
- numArgs: 2,
- variableArgs: false
- };
- t['c'] = {
- id: _util.OPS.curveTo,
- numArgs: 6,
- variableArgs: false
- };
- t['v'] = {
- id: _util.OPS.curveTo2,
- numArgs: 4,
- variableArgs: false
- };
- t['y'] = {
- id: _util.OPS.curveTo3,
- numArgs: 4,
- variableArgs: false
- };
- t['h'] = {
- id: _util.OPS.closePath,
- numArgs: 0,
- variableArgs: false
- };
- t['re'] = {
- id: _util.OPS.rectangle,
- numArgs: 4,
- variableArgs: false
- };
- t['S'] = {
- id: _util.OPS.stroke,
- numArgs: 0,
- variableArgs: false
- };
- t['s'] = {
- id: _util.OPS.closeStroke,
- numArgs: 0,
- variableArgs: false
- };
- t['f'] = {
- id: _util.OPS.fill,
- numArgs: 0,
- variableArgs: false
- };
- t['F'] = {
- id: _util.OPS.fill,
- numArgs: 0,
- variableArgs: false
- };
- t['f*'] = {
- id: _util.OPS.eoFill,
- numArgs: 0,
- variableArgs: false
- };
- t['B'] = {
- id: _util.OPS.fillStroke,
- numArgs: 0,
- variableArgs: false
- };
- t['B*'] = {
- id: _util.OPS.eoFillStroke,
- numArgs: 0,
- variableArgs: false
- };
- t['b'] = {
- id: _util.OPS.closeFillStroke,
- numArgs: 0,
- variableArgs: false
- };
- t['b*'] = {
- id: _util.OPS.closeEOFillStroke,
- numArgs: 0,
- variableArgs: false
- };
- t['n'] = {
- id: _util.OPS.endPath,
- numArgs: 0,
- variableArgs: false
- };
- t['W'] = {
- id: _util.OPS.clip,
- numArgs: 0,
- variableArgs: false
- };
- t['W*'] = {
- id: _util.OPS.eoClip,
- numArgs: 0,
- variableArgs: false
- };
- t['BT'] = {
- id: _util.OPS.beginText,
- numArgs: 0,
- variableArgs: false
- };
- t['ET'] = {
- id: _util.OPS.endText,
- numArgs: 0,
- variableArgs: false
- };
- t['Tc'] = {
- id: _util.OPS.setCharSpacing,
- numArgs: 1,
- variableArgs: false
- };
- t['Tw'] = {
- id: _util.OPS.setWordSpacing,
- numArgs: 1,
- variableArgs: false
- };
- t['Tz'] = {
- id: _util.OPS.setHScale,
- numArgs: 1,
- variableArgs: false
- };
- t['TL'] = {
- id: _util.OPS.setLeading,
- numArgs: 1,
- variableArgs: false
- };
- t['Tf'] = {
- id: _util.OPS.setFont,
- numArgs: 2,
- variableArgs: false
- };
- t['Tr'] = {
- id: _util.OPS.setTextRenderingMode,
- numArgs: 1,
- variableArgs: false
- };
- t['Ts'] = {
- id: _util.OPS.setTextRise,
- numArgs: 1,
- variableArgs: false
- };
- t['Td'] = {
- id: _util.OPS.moveText,
- numArgs: 2,
- variableArgs: false
- };
- t['TD'] = {
- id: _util.OPS.setLeadingMoveText,
- numArgs: 2,
- variableArgs: false
- };
- t['Tm'] = {
- id: _util.OPS.setTextMatrix,
- numArgs: 6,
- variableArgs: false
- };
- t['T*'] = {
- id: _util.OPS.nextLine,
- numArgs: 0,
- variableArgs: false
- };
- t['Tj'] = {
- id: _util.OPS.showText,
- numArgs: 1,
- variableArgs: false
- };
- t['TJ'] = {
- id: _util.OPS.showSpacedText,
- numArgs: 1,
- variableArgs: false
- };
- t['\''] = {
- id: _util.OPS.nextLineShowText,
- numArgs: 1,
- variableArgs: false
- };
- t['"'] = {
- id: _util.OPS.nextLineSetSpacingShowText,
- numArgs: 3,
- variableArgs: false
- };
- t['d0'] = {
- id: _util.OPS.setCharWidth,
- numArgs: 2,
- variableArgs: false
- };
- t['d1'] = {
- id: _util.OPS.setCharWidthAndBounds,
- numArgs: 6,
- variableArgs: false
- };
- t['CS'] = {
- id: _util.OPS.setStrokeColorSpace,
- numArgs: 1,
- variableArgs: false
- };
- t['cs'] = {
- id: _util.OPS.setFillColorSpace,
- numArgs: 1,
- variableArgs: false
- };
- t['SC'] = {
- id: _util.OPS.setStrokeColor,
- numArgs: 4,
- variableArgs: true
- };
- t['SCN'] = {
- id: _util.OPS.setStrokeColorN,
- numArgs: 33,
- variableArgs: true
- };
- t['sc'] = {
- id: _util.OPS.setFillColor,
- numArgs: 4,
- variableArgs: true
- };
- t['scn'] = {
- id: _util.OPS.setFillColorN,
- numArgs: 33,
- variableArgs: true
- };
- t['G'] = {
- id: _util.OPS.setStrokeGray,
- numArgs: 1,
- variableArgs: false
- };
- t['g'] = {
- id: _util.OPS.setFillGray,
- numArgs: 1,
- variableArgs: false
- };
- t['RG'] = {
- id: _util.OPS.setStrokeRGBColor,
- numArgs: 3,
- variableArgs: false
- };
- t['rg'] = {
- id: _util.OPS.setFillRGBColor,
- numArgs: 3,
- variableArgs: false
- };
- t['K'] = {
- id: _util.OPS.setStrokeCMYKColor,
- numArgs: 4,
- variableArgs: false
- };
- t['k'] = {
- id: _util.OPS.setFillCMYKColor,
- numArgs: 4,
- variableArgs: false
- };
- t['sh'] = {
- id: _util.OPS.shadingFill,
- numArgs: 1,
- variableArgs: false
- };
- t['BI'] = {
- id: _util.OPS.beginInlineImage,
- numArgs: 0,
- variableArgs: false
- };
- t['ID'] = {
- id: _util.OPS.beginImageData,
- numArgs: 0,
- variableArgs: false
- };
- t['EI'] = {
- id: _util.OPS.endInlineImage,
- numArgs: 1,
- variableArgs: false
- };
- t['Do'] = {
- id: _util.OPS.paintXObject,
- numArgs: 1,
- variableArgs: false
- };
- t['MP'] = {
- id: _util.OPS.markPoint,
- numArgs: 1,
- variableArgs: false
- };
- t['DP'] = {
- id: _util.OPS.markPointProps,
- numArgs: 2,
- variableArgs: false
- };
- t['BMC'] = {
- id: _util.OPS.beginMarkedContent,
- numArgs: 1,
- variableArgs: false
- };
- t['BDC'] = {
- id: _util.OPS.beginMarkedContentProps,
- numArgs: 2,
- variableArgs: false
- };
- t['EMC'] = {
- id: _util.OPS.endMarkedContent,
- numArgs: 0,
- variableArgs: false
- };
- t['BX'] = {
- id: _util.OPS.beginCompat,
- numArgs: 0,
- variableArgs: false
- };
- t['EX'] = {
- id: _util.OPS.endCompat,
- numArgs: 0,
- variableArgs: false
- };
- t['BM'] = null;
- t['BD'] = null;
- t['true'] = null;
- t['fa'] = null;
- t['fal'] = null;
- t['fals'] = null;
- t['false'] = null;
- t['nu'] = null;
- t['nul'] = null;
- t['null'] = null;
- });
- var MAX_INVALID_PATH_OPS = 20;
- function EvaluatorPreprocessor(stream, xref, stateManager) {
- this.opMap = getOPMap();
- this.parser = new _parser.Parser(new _parser.Lexer(stream, this.opMap), false, xref);
- this.stateManager = stateManager;
- this.nonProcessedArgs = [];
- this._numInvalidPathOPS = 0;
- }
- EvaluatorPreprocessor.prototype = {
- get savedStatesDepth() {
- return this.stateManager.stateStack.length;
- },
- read: function EvaluatorPreprocessor_read(operation) {
- var args = operation.args;
- while (true) {
- var obj = this.parser.getObj();
- if ((0, _primitives.isCmd)(obj)) {
- var cmd = obj.cmd;
- var opSpec = this.opMap[cmd];
- if (!opSpec) {
- (0, _util.warn)('Unknown command "' + cmd + '".');
- continue;
- }
- var fn = opSpec.id;
- var numArgs = opSpec.numArgs;
- var argsLength = args !== null ? args.length : 0;
- if (!opSpec.variableArgs) {
- if (argsLength !== numArgs) {
- var nonProcessedArgs = this.nonProcessedArgs;
- while (argsLength > numArgs) {
- nonProcessedArgs.push(args.shift());
- argsLength--;
- }
- while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
- if (args === null) {
- args = [];
- }
- args.unshift(nonProcessedArgs.pop());
- argsLength++;
- }
- }
- if (argsLength < numArgs) {
- var partialMsg = 'command ' + cmd + ': expected ' + numArgs + ' args, ' + ('but received ' + argsLength + ' args.');
- if (fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath && ++this._numInvalidPathOPS > MAX_INVALID_PATH_OPS) {
- throw new _util.FormatError('Invalid ' + partialMsg);
- }
- (0, _util.warn)('Skipping ' + partialMsg);
- if (args !== null) {
- args.length = 0;
- }
- continue;
- }
- } else if (argsLength > numArgs) {
- (0, _util.info)('Command ' + cmd + ': expected [0, ' + numArgs + '] args, ' + ('but received ' + argsLength + ' args.'));
- }
- this.preprocessCommand(fn, args);
- operation.fn = fn;
- operation.args = args;
- return true;
- }
- if ((0, _primitives.isEOF)(obj)) {
- return false;
- }
- if (obj !== null) {
- if (args === null) {
- args = [];
- }
- args.push(obj);
- if (args.length > 33) {
- throw new _util.FormatError('Too many arguments');
- }
- }
- }
- },
- preprocessCommand: function EvaluatorPreprocessor_preprocessCommand(fn, args) {
- switch (fn | 0) {
- case _util.OPS.save:
- this.stateManager.save();
- break;
- case _util.OPS.restore:
- this.stateManager.restore();
- break;
- case _util.OPS.transform:
- this.stateManager.transform(args);
- break;
- }
- }
- };
- return EvaluatorPreprocessor;
-}();
-exports.PartialEvaluator = PartialEvaluator;
-
-/***/ }),
-/* 155 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.CMapFactory = exports.IdentityCMap = exports.CMap = undefined;
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _util = __w_pdfjs_require__(2);
-
-var _primitives = __w_pdfjs_require__(138);
-
-var _parser = __w_pdfjs_require__(139);
-
-var _stream = __w_pdfjs_require__(140);
-
-function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
-
-function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var BUILT_IN_CMAPS = ['Adobe-GB1-UCS2', 'Adobe-CNS1-UCS2', 'Adobe-Japan1-UCS2', 'Adobe-Korea1-UCS2', '78-EUC-H', '78-EUC-V', '78-H', '78-RKSJ-H', '78-RKSJ-V', '78-V', '78ms-RKSJ-H', '78ms-RKSJ-V', '83pv-RKSJ-H', '90ms-RKSJ-H', '90ms-RKSJ-V', '90msp-RKSJ-H', '90msp-RKSJ-V', '90pv-RKSJ-H', '90pv-RKSJ-V', 'Add-H', 'Add-RKSJ-H', 'Add-RKSJ-V', 'Add-V', 'Adobe-CNS1-0', 'Adobe-CNS1-1', 'Adobe-CNS1-2', 'Adobe-CNS1-3', 'Adobe-CNS1-4', 'Adobe-CNS1-5', 'Adobe-CNS1-6', 'Adobe-GB1-0', 'Adobe-GB1-1', 'Adobe-GB1-2', 'Adobe-GB1-3', 'Adobe-GB1-4', 'Adobe-GB1-5', 'Adobe-Japan1-0', 'Adobe-Japan1-1', 'Adobe-Japan1-2', 'Adobe-Japan1-3', 'Adobe-Japan1-4', 'Adobe-Japan1-5', 'Adobe-Japan1-6', 'Adobe-Korea1-0', 'Adobe-Korea1-1', 'Adobe-Korea1-2', 'B5-H', 'B5-V', 'B5pc-H', 'B5pc-V', 'CNS-EUC-H', 'CNS-EUC-V', 'CNS1-H', 'CNS1-V', 'CNS2-H', 'CNS2-V', 'ETHK-B5-H', 'ETHK-B5-V', 'ETen-B5-H', 'ETen-B5-V', 'ETenms-B5-H', 'ETenms-B5-V', 'EUC-H', 'EUC-V', 'Ext-H', 'Ext-RKSJ-H', 'Ext-RKSJ-V', 'Ext-V', 'GB-EUC-H', 'GB-EUC-V', 'GB-H', 'GB-V', 'GBK-EUC-H', 'GBK-EUC-V', 'GBK2K-H', 'GBK2K-V', 'GBKp-EUC-H', 'GBKp-EUC-V', 'GBT-EUC-H', 'GBT-EUC-V', 'GBT-H', 'GBT-V', 'GBTpc-EUC-H', 'GBTpc-EUC-V', 'GBpc-EUC-H', 'GBpc-EUC-V', 'H', 'HKdla-B5-H', 'HKdla-B5-V', 'HKdlb-B5-H', 'HKdlb-B5-V', 'HKgccs-B5-H', 'HKgccs-B5-V', 'HKm314-B5-H', 'HKm314-B5-V', 'HKm471-B5-H', 'HKm471-B5-V', 'HKscs-B5-H', 'HKscs-B5-V', 'Hankaku', 'Hiragana', 'KSC-EUC-H', 'KSC-EUC-V', 'KSC-H', 'KSC-Johab-H', 'KSC-Johab-V', 'KSC-V', 'KSCms-UHC-H', 'KSCms-UHC-HW-H', 'KSCms-UHC-HW-V', 'KSCms-UHC-V', 'KSCpc-EUC-H', 'KSCpc-EUC-V', 'Katakana', 'NWP-H', 'NWP-V', 'RKSJ-H', 'RKSJ-V', 'Roman', 'UniCNS-UCS2-H', 'UniCNS-UCS2-V', 'UniCNS-UTF16-H', 'UniCNS-UTF16-V', 'UniCNS-UTF32-H', 'UniCNS-UTF32-V', 'UniCNS-UTF8-H', 'UniCNS-UTF8-V', 'UniGB-UCS2-H', 'UniGB-UCS2-V', 'UniGB-UTF16-H', 'UniGB-UTF16-V', 'UniGB-UTF32-H', 'UniGB-UTF32-V', 'UniGB-UTF8-H', 'UniGB-UTF8-V', 'UniJIS-UCS2-H', 'UniJIS-UCS2-HW-H', 'UniJIS-UCS2-HW-V', 'UniJIS-UCS2-V', 'UniJIS-UTF16-H', 'UniJIS-UTF16-V', 'UniJIS-UTF32-H', 'UniJIS-UTF32-V', 'UniJIS-UTF8-H', 'UniJIS-UTF8-V', 'UniJIS2004-UTF16-H', 'UniJIS2004-UTF16-V', 'UniJIS2004-UTF32-H', 'UniJIS2004-UTF32-V', 'UniJIS2004-UTF8-H', 'UniJIS2004-UTF8-V', 'UniJISPro-UCS2-HW-V', 'UniJISPro-UCS2-V', 'UniJISPro-UTF8-V', 'UniJISX0213-UTF32-H', 'UniJISX0213-UTF32-V', 'UniJISX02132004-UTF32-H', 'UniJISX02132004-UTF32-V', 'UniKS-UCS2-H', 'UniKS-UCS2-V', 'UniKS-UTF16-H', 'UniKS-UTF16-V', 'UniKS-UTF32-H', 'UniKS-UTF32-V', 'UniKS-UTF8-H', 'UniKS-UTF8-V', 'V', 'WP-Symbol'];
-
-var CMap = function () {
- function CMap() {
- var builtInCMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
-
- _classCallCheck(this, CMap);
-
- this.codespaceRanges = [[], [], [], []];
- this.numCodespaceRanges = 0;
- this._map = [];
- this.name = '';
- this.vertical = false;
- this.useCMap = null;
- this.builtInCMap = builtInCMap;
- }
-
- _createClass(CMap, [{
- key: 'addCodespaceRange',
- value: function addCodespaceRange(n, low, high) {
- this.codespaceRanges[n - 1].push(low, high);
- this.numCodespaceRanges++;
- }
- }, {
- key: 'mapCidRange',
- value: function mapCidRange(low, high, dstLow) {
- while (low <= high) {
- this._map[low++] = dstLow++;
- }
- }
- }, {
- key: 'mapBfRange',
- value: function mapBfRange(low, high, dstLow) {
- var lastByte = dstLow.length - 1;
- while (low <= high) {
- this._map[low++] = dstLow;
- dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
- }
- }
- }, {
- key: 'mapBfRangeToArray',
- value: function mapBfRangeToArray(low, high, array) {
- var i = 0,
- ii = array.length;
- while (low <= high && i < ii) {
- this._map[low] = array[i++];
- ++low;
- }
- }
- }, {
- key: 'mapOne',
- value: function mapOne(src, dst) {
- this._map[src] = dst;
- }
- }, {
- key: 'lookup',
- value: function lookup(code) {
- return this._map[code];
- }
- }, {
- key: 'contains',
- value: function contains(code) {
- return this._map[code] !== undefined;
- }
- }, {
- key: 'forEach',
- value: function forEach(callback) {
- var map = this._map;
- var length = map.length;
- if (length <= 0x10000) {
- for (var i = 0; i < length; i++) {
- if (map[i] !== undefined) {
- callback(i, map[i]);
- }
- }
- } else {
- for (var _i in map) {
- callback(_i, map[_i]);
- }
- }
- }
- }, {
- key: 'charCodeOf',
- value: function charCodeOf(value) {
- var map = this._map;
- if (map.length <= 0x10000) {
- return map.indexOf(value);
- }
- for (var charCode in map) {
- if (map[charCode] === value) {
- return charCode | 0;
- }
- }
- return -1;
- }
- }, {
- key: 'getMap',
- value: function getMap() {
- return this._map;
- }
- }, {
- key: 'readCharCode',
- value: function readCharCode(str, offset, out) {
- var c = 0;
- var codespaceRanges = this.codespaceRanges;
- for (var n = 0, nn = codespaceRanges.length; n < nn; n++) {
- c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
- var codespaceRange = codespaceRanges[n];
- for (var k = 0, kk = codespaceRange.length; k < kk;) {
- var low = codespaceRange[k++];
- var high = codespaceRange[k++];
- if (c >= low && c <= high) {
- out.charcode = c;
- out.length = n + 1;
- return;
- }
- }
- }
- out.charcode = 0;
- out.length = 1;
- }
- }, {
- key: 'length',
- get: function get() {
- return this._map.length;
- }
- }, {
- key: 'isIdentityCMap',
- get: function get() {
- if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) {
- return false;
- }
- if (this._map.length !== 0x10000) {
- return false;
- }
- for (var i = 0; i < 0x10000; i++) {
- if (this._map[i] !== i) {
- return false;
- }
- }
- return true;
- }
- }]);
-
- return CMap;
-}();
-
-var IdentityCMap = function (_CMap) {
- _inherits(IdentityCMap, _CMap);
-
- function IdentityCMap(vertical, n) {
- _classCallCheck(this, IdentityCMap);
-
- var _this = _possibleConstructorReturn(this, (IdentityCMap.__proto__ || Object.getPrototypeOf(IdentityCMap)).call(this));
-
- _this.vertical = vertical;
- _this.addCodespaceRange(n, 0, 0xffff);
- return _this;
- }
-
- _createClass(IdentityCMap, [{
- key: 'mapCidRange',
- value: function mapCidRange(low, high, dstLow) {
- (0, _util.unreachable)('should not call mapCidRange');
- }
- }, {
- key: 'mapBfRange',
- value: function mapBfRange(low, high, dstLow) {
- (0, _util.unreachable)('should not call mapBfRange');
- }
- }, {
- key: 'mapBfRangeToArray',
- value: function mapBfRangeToArray(low, high, array) {
- (0, _util.unreachable)('should not call mapBfRangeToArray');
- }
- }, {
- key: 'mapOne',
- value: function mapOne(src, dst) {
- (0, _util.unreachable)('should not call mapCidOne');
- }
- }, {
- key: 'lookup',
- value: function lookup(code) {
- return Number.isInteger(code) && code <= 0xffff ? code : undefined;
- }
- }, {
- key: 'contains',
- value: function contains(code) {
- return Number.isInteger(code) && code <= 0xffff;
- }
- }, {
- key: 'forEach',
- value: function forEach(callback) {
- for (var i = 0; i <= 0xffff; i++) {
- callback(i, i);
- }
- }
- }, {
- key: 'charCodeOf',
- value: function charCodeOf(value) {
- return Number.isInteger(value) && value <= 0xffff ? value : -1;
- }
- }, {
- key: 'getMap',
- value: function getMap() {
- var map = new Array(0x10000);
- for (var i = 0; i <= 0xffff; i++) {
- map[i] = i;
- }
- return map;
- }
- }, {
- key: 'length',
- get: function get() {
- return 0x10000;
- }
- }, {
- key: 'isIdentityCMap',
- get: function get() {
- (0, _util.unreachable)('should not access .isIdentityCMap');
- }
- }]);
-
- return IdentityCMap;
-}(CMap);
-
-var BinaryCMapReader = function BinaryCMapReaderClosure() {
- function hexToInt(a, size) {
- var n = 0;
- for (var i = 0; i <= size; i++) {
- n = n << 8 | a[i];
- }
- return n >>> 0;
- }
- function hexToStr(a, size) {
- if (size === 1) {
- return String.fromCharCode(a[0], a[1]);
- }
- if (size === 3) {
- return String.fromCharCode(a[0], a[1], a[2], a[3]);
- }
- return String.fromCharCode.apply(null, a.subarray(0, size + 1));
- }
- function addHex(a, b, size) {
- var c = 0;
- for (var i = size; i >= 0; i--) {
- c += a[i] + b[i];
- a[i] = c & 255;
- c >>= 8;
- }
- }
- function incHex(a, size) {
- var c = 1;
- for (var i = size; i >= 0 && c > 0; i--) {
- c += a[i];
- a[i] = c & 255;
- c >>= 8;
- }
- }
- var MAX_NUM_SIZE = 16;
- var MAX_ENCODED_NUM_SIZE = 19;
- function BinaryCMapStream(data) {
- this.buffer = data;
- this.pos = 0;
- this.end = data.length;
- this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
- }
- BinaryCMapStream.prototype = {
- readByte: function readByte() {
- if (this.pos >= this.end) {
- return -1;
- }
- return this.buffer[this.pos++];
- },
- readNumber: function readNumber() {
- var n = 0;
- var last;
- do {
- var b = this.readByte();
- if (b < 0) {
- throw new _util.FormatError('unexpected EOF in bcmap');
- }
- last = !(b & 0x80);
- n = n << 7 | b & 0x7F;
- } while (!last);
- return n;
- },
- readSigned: function readSigned() {
- var n = this.readNumber();
- return n & 1 ? ~(n >>> 1) : n >>> 1;
- },
- readHex: function readHex(num, size) {
- num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
- this.pos += size + 1;
- },
- readHexNumber: function readHexNumber(num, size) {
- var last;
- var stack = this.tmpBuf,
- sp = 0;
- do {
- var b = this.readByte();
- if (b < 0) {
- throw new _util.FormatError('unexpected EOF in bcmap');
- }
- last = !(b & 0x80);
- stack[sp++] = b & 0x7F;
- } while (!last);
- var i = size,
- buffer = 0,
- bufferSize = 0;
- while (i >= 0) {
- while (bufferSize < 8 && stack.length > 0) {
- buffer = stack[--sp] << bufferSize | buffer;
- bufferSize += 7;
- }
- num[i] = buffer & 255;
- i--;
- buffer >>= 8;
- bufferSize -= 8;
- }
- },
- readHexSigned: function readHexSigned(num, size) {
- this.readHexNumber(num, size);
- var sign = num[size] & 1 ? 255 : 0;
- var c = 0;
- for (var i = 0; i <= size; i++) {
- c = (c & 1) << 8 | num[i];
- num[i] = c >> 1 ^ sign;
- }
- },
- readString: function readString() {
- var len = this.readNumber();
- var s = '';
- for (var i = 0; i < len; i++) {
- s += String.fromCharCode(this.readNumber());
- }
- return s;
- }
- };
- function processBinaryCMap(data, cMap, extend) {
- return new Promise(function (resolve, reject) {
- var stream = new BinaryCMapStream(data);
- var header = stream.readByte();
- cMap.vertical = !!(header & 1);
- 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 charCode = new Uint8Array(MAX_NUM_SIZE);
- var tmp = new Uint8Array(MAX_NUM_SIZE);
- var code;
- var b;
- while ((b = stream.readByte()) >= 0) {
- var type = b >> 5;
- if (type === 7) {
- switch (b & 0x1F) {
- case 0:
- stream.readString();
- break;
- case 1:
- useCMap = stream.readString();
- break;
- }
- continue;
- }
- var sequence = !!(b & 0x10);
- var dataSize = b & 15;
- if (dataSize + 1 > MAX_NUM_SIZE) {
- throw new Error('processBinaryCMap: Invalid dataSize.');
- }
- var ucs2DataSize = 1;
- var subitemsCount = stream.readNumber();
- var i;
- switch (type) {
- case 0:
- stream.readHex(start, dataSize);
- stream.readHexNumber(end, dataSize);
- addHex(end, start, dataSize);
- cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
- for (i = 1; i < subitemsCount; i++) {
- incHex(end, dataSize);
- stream.readHexNumber(start, dataSize);
- addHex(start, end, dataSize);
- stream.readHexNumber(end, dataSize);
- addHex(end, start, dataSize);
- cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
- }
- break;
- case 1:
- stream.readHex(start, dataSize);
- stream.readHexNumber(end, dataSize);
- addHex(end, start, dataSize);
- stream.readNumber();
- for (i = 1; i < subitemsCount; i++) {
- incHex(end, dataSize);
- stream.readHexNumber(start, dataSize);
- addHex(start, end, dataSize);
- stream.readHexNumber(end, dataSize);
- addHex(end, start, dataSize);
- stream.readNumber();
- }
- break;
- case 2:
- stream.readHex(char, dataSize);
- code = stream.readNumber();
- cMap.mapOne(hexToInt(char, dataSize), code);
- for (i = 1; i < subitemsCount; i++) {
- incHex(char, dataSize);
- if (!sequence) {
- stream.readHexNumber(tmp, dataSize);
- addHex(char, tmp, dataSize);
- }
- code = stream.readSigned() + (code + 1);
- cMap.mapOne(hexToInt(char, dataSize), code);
- }
- break;
- case 3:
- stream.readHex(start, dataSize);
- stream.readHexNumber(end, dataSize);
- addHex(end, start, dataSize);
- code = stream.readNumber();
- cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
- for (i = 1; i < subitemsCount; i++) {
- incHex(end, dataSize);
- if (!sequence) {
- stream.readHexNumber(start, dataSize);
- addHex(start, end, dataSize);
- } else {
- start.set(end);
- }
- stream.readHexNumber(end, dataSize);
- addHex(end, start, dataSize);
- code = stream.readNumber();
- cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
- }
- break;
- case 4:
- stream.readHex(char, ucs2DataSize);
- stream.readHex(charCode, dataSize);
- cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
- for (i = 1; i < subitemsCount; i++) {
- incHex(char, ucs2DataSize);
- if (!sequence) {
- stream.readHexNumber(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));
- }
- break;
- case 5:
- stream.readHex(start, ucs2DataSize);
- stream.readHexNumber(end, ucs2DataSize);
- addHex(end, start, ucs2DataSize);
- stream.readHex(charCode, dataSize);
- cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
- for (i = 1; i < subitemsCount; i++) {
- incHex(end, ucs2DataSize);
- if (!sequence) {
- stream.readHexNumber(start, ucs2DataSize);
- addHex(start, end, ucs2DataSize);
- } else {
- start.set(end);
- }
- stream.readHexNumber(end, ucs2DataSize);
- addHex(end, start, ucs2DataSize);
- stream.readHex(charCode, dataSize);
- cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
- }
- break;
- default:
- reject(new Error('processBinaryCMap: Unknown type: ' + type));
- return;
- }
- }
- if (useCMap) {
- resolve(extend(useCMap));
- return;
- }
- resolve(cMap);
- });
- }
- function BinaryCMapReader() {}
- BinaryCMapReader.prototype = { process: processBinaryCMap };
- return BinaryCMapReader;
-}();
-var CMapFactory = function CMapFactoryClosure() {
- function strToInt(str) {
- var a = 0;
- for (var i = 0; i < str.length; i++) {
- a = a << 8 | str.charCodeAt(i);
- }
- return a >>> 0;
- }
- function expectString(obj) {
- if (!(0, _util.isString)(obj)) {
- throw new _util.FormatError('Malformed CMap: expected string.');
- }
- }
- function expectInt(obj) {
- if (!Number.isInteger(obj)) {
- throw new _util.FormatError('Malformed CMap: expected int.');
- }
- }
- function parseBfChar(cMap, lexer) {
- while (true) {
- var obj = lexer.getObj();
- if ((0, _primitives.isEOF)(obj)) {
- break;
- }
- if ((0, _primitives.isCmd)(obj, 'endbfchar')) {
- return;
- }
- expectString(obj);
- var src = strToInt(obj);
- obj = lexer.getObj();
- expectString(obj);
- var dst = obj;
- cMap.mapOne(src, dst);
- }
- }
- function parseBfRange(cMap, lexer) {
- while (true) {
- var obj = lexer.getObj();
- if ((0, _primitives.isEOF)(obj)) {
- break;
- }
- if ((0, _primitives.isCmd)(obj, 'endbfrange')) {
- return;
- }
- expectString(obj);
- var low = strToInt(obj);
- obj = lexer.getObj();
- expectString(obj);
- var high = strToInt(obj);
- obj = lexer.getObj();
- if (Number.isInteger(obj) || (0, _util.isString)(obj)) {
- var dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
- cMap.mapBfRange(low, high, dstLow);
- } else if ((0, _primitives.isCmd)(obj, '[')) {
- obj = lexer.getObj();
- var array = [];
- while (!(0, _primitives.isCmd)(obj, ']') && !(0, _primitives.isEOF)(obj)) {
- array.push(obj);
- obj = lexer.getObj();
- }
- cMap.mapBfRangeToArray(low, high, array);
- } else {
- break;
- }
- }
- throw new _util.FormatError('Invalid bf range.');
- }
- function parseCidChar(cMap, lexer) {
- while (true) {
- var obj = lexer.getObj();
- if ((0, _primitives.isEOF)(obj)) {
- break;
- }
- if ((0, _primitives.isCmd)(obj, 'endcidchar')) {
- return;
- }
- expectString(obj);
- var src = strToInt(obj);
- obj = lexer.getObj();
- expectInt(obj);
- var dst = obj;
- cMap.mapOne(src, dst);
- }
- }
- function parseCidRange(cMap, lexer) {
- while (true) {
- var obj = lexer.getObj();
- if ((0, _primitives.isEOF)(obj)) {
- break;
- }
- if ((0, _primitives.isCmd)(obj, 'endcidrange')) {
- return;
- }
- expectString(obj);
- var low = strToInt(obj);
- obj = lexer.getObj();
- expectString(obj);
- var high = strToInt(obj);
- obj = lexer.getObj();
- expectInt(obj);
- var dstLow = obj;
- cMap.mapCidRange(low, high, dstLow);
- }
- }
- function parseCodespaceRange(cMap, lexer) {
- while (true) {
- var obj = lexer.getObj();
- if ((0, _primitives.isEOF)(obj)) {
- break;
- }
- if ((0, _primitives.isCmd)(obj, 'endcodespacerange')) {
- return;
- }
- if (!(0, _util.isString)(obj)) {
- break;
- }
- var low = strToInt(obj);
- obj = lexer.getObj();
- if (!(0, _util.isString)(obj)) {
- break;
- }
- var high = strToInt(obj);
- cMap.addCodespaceRange(obj.length, low, high);
- }
- throw new _util.FormatError('Invalid codespace range.');
- }
- function parseWMode(cMap, lexer) {
- var obj = lexer.getObj();
- if (Number.isInteger(obj)) {
- cMap.vertical = !!obj;
- }
- }
- function parseCMapName(cMap, lexer) {
- var obj = lexer.getObj();
- if ((0, _primitives.isName)(obj) && (0, _util.isString)(obj.name)) {
- cMap.name = obj.name;
- }
- }
- function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
- var previous;
- var embeddedUseCMap;
- objLoop: while (true) {
- try {
- var obj = lexer.getObj();
- if ((0, _primitives.isEOF)(obj)) {
- break;
- } else if ((0, _primitives.isName)(obj)) {
- if (obj.name === 'WMode') {
- parseWMode(cMap, lexer);
- } else if (obj.name === 'CMapName') {
- parseCMapName(cMap, lexer);
- }
- previous = obj;
- } else if ((0, _primitives.isCmd)(obj)) {
- switch (obj.cmd) {
- case 'endcmap':
- break objLoop;
- case 'usecmap':
- if ((0, _primitives.isName)(previous)) {
- embeddedUseCMap = previous.name;
- }
- break;
- case 'begincodespacerange':
- parseCodespaceRange(cMap, lexer);
- break;
- case 'beginbfchar':
- parseBfChar(cMap, lexer);
- break;
- case 'begincidchar':
- parseCidChar(cMap, lexer);
- break;
- case 'beginbfrange':
- parseBfRange(cMap, lexer);
- break;
- case 'begincidrange':
- parseCidRange(cMap, lexer);
- break;
- }
- }
- } catch (ex) {
- if (ex instanceof _util.MissingDataException) {
- throw ex;
- }
- (0, _util.warn)('Invalid cMap data: ' + ex);
- continue;
- }
- }
- if (!useCMap && embeddedUseCMap) {
- useCMap = embeddedUseCMap;
- }
- if (useCMap) {
- return extendCMap(cMap, fetchBuiltInCMap, useCMap);
- }
- return Promise.resolve(cMap);
- }
- function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
- return createBuiltInCMap(useCMap, fetchBuiltInCMap).then(function (newCMap) {
- cMap.useCMap = newCMap;
- if (cMap.numCodespaceRanges === 0) {
- var useCodespaceRanges = cMap.useCMap.codespaceRanges;
- for (var i = 0; i < useCodespaceRanges.length; i++) {
- cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
- }
- cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
- }
- cMap.useCMap.forEach(function (key, value) {
- if (!cMap.contains(key)) {
- cMap.mapOne(key, cMap.useCMap.lookup(key));
- }
- });
- return cMap;
- });
- }
- function createBuiltInCMap(name, fetchBuiltInCMap) {
- if (name === 'Identity-H') {
- return Promise.resolve(new IdentityCMap(false, 2));
- } else if (name === 'Identity-V') {
- return Promise.resolve(new IdentityCMap(true, 2));
- }
- if (!BUILT_IN_CMAPS.includes(name)) {
- return Promise.reject(new Error('Unknown CMap name: ' + name));
- }
- if (!fetchBuiltInCMap) {
- return Promise.reject(new Error('Built-in CMap parameters are not provided.'));
- }
- return fetchBuiltInCMap(name).then(function (data) {
- var cMapData = data.cMapData,
- compressionType = data.compressionType;
- var cMap = new CMap(true);
- if (compressionType === _util.CMapCompressionType.BINARY) {
- return new BinaryCMapReader().process(cMapData, cMap, function (useCMap) {
- return extendCMap(cMap, fetchBuiltInCMap, useCMap);
- });
- }
- if (compressionType === _util.CMapCompressionType.NONE) {
- var lexer = new _parser.Lexer(new _stream.Stream(cMapData));
- return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
- }
- return Promise.reject(new Error('TODO: Only BINARY/NONE CMap compression is currently supported.'));
- });
- }
- return {
- create: function create(params) {
- var encoding = params.encoding;
- var fetchBuiltInCMap = params.fetchBuiltInCMap;
- var useCMap = params.useCMap;
- if ((0, _primitives.isName)(encoding)) {
- return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
- } else if ((0, _primitives.isStream)(encoding)) {
- var cMap = new CMap();
- var lexer = new _parser.Lexer(encoding);
- return parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap).then(function (parsedCMap) {
- if (parsedCMap.isIdentityCMap) {
- return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
- }
- return parsedCMap;
- });
- }
- return Promise.reject(new Error('Encoding required.'));
- }
- };
-}();
-exports.CMap = CMap;
-exports.IdentityCMap = IdentityCMap;
-exports.CMapFactory = CMapFactory;
-
-/***/ }),
-/* 156 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.getFontType = exports.IdentityToUnicodeMap = exports.ToUnicodeMap = exports.FontFlags = exports.Font = exports.ErrorFont = exports.SEAC_ANALYSIS_ENABLED = undefined;
-
-var _slicedToArray = function () { function sliceIterator(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"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
-
-var _util = __w_pdfjs_require__(2);
-
-var _cff_parser = __w_pdfjs_require__(157);
-
-var _glyphlist = __w_pdfjs_require__(160);
-
-var _encodings = __w_pdfjs_require__(159);
-
-var _standard_fonts = __w_pdfjs_require__(161);
-
-var _unicode = __w_pdfjs_require__(162);
-
-var _font_renderer = __w_pdfjs_require__(163);
-
-var _cmap = __w_pdfjs_require__(155);
-
-var _stream = __w_pdfjs_require__(140);
-
-var _type1_parser = __w_pdfjs_require__(164);
-
-var PRIVATE_USE_AREAS = [[0xE000, 0xF8FF], [0x100000, 0x10FFFD]];
-var PDF_GLYPH_SPACE_UNITS = 1000;
-var SEAC_ANALYSIS_ENABLED = true;
-var FontFlags = {
- FixedPitch: 1,
- Serif: 2,
- Symbolic: 4,
- Script: 8,
- Nonsymbolic: 32,
- Italic: 64,
- AllCap: 65536,
- SmallCap: 131072,
- ForceBold: 262144
-};
-var MacStandardGlyphOrdering = ['.notdef', '.null', 'nonmarkingreturn', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quotesingle', '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', 'grave', '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', 'Adieresis', 'Aring', 'Ccedilla', 'Eacute', 'Ntilde', 'Odieresis', 'Udieresis', 'aacute', 'agrave', 'acircumflex', 'adieresis', 'atilde', 'aring', 'ccedilla', 'eacute', 'egrave', 'ecircumflex', 'edieresis', 'iacute', 'igrave', 'icircumflex', 'idieresis', 'ntilde', 'oacute', 'ograve', 'ocircumflex', 'odieresis', 'otilde', 'uacute', 'ugrave', 'ucircumflex', 'udieresis', 'dagger', 'degree', 'cent', 'sterling', 'section', 'bullet', 'paragraph', 'germandbls', 'registered', 'copyright', 'trademark', 'acute', 'dieresis', 'notequal', 'AE', 'Oslash', 'infinity', 'plusminus', 'lessequal', 'greaterequal', 'yen', 'mu', 'partialdiff', 'summation', 'product', 'pi', 'integral', 'ordfeminine', 'ordmasculine', 'Omega', 'ae', 'oslash', 'questiondown', 'exclamdown', 'logicalnot', 'radical', 'florin', 'approxequal', 'Delta', 'guillemotleft', 'guillemotright', 'ellipsis', 'nonbreakingspace', 'Agrave', 'Atilde', 'Otilde', 'OE', 'oe', 'endash', 'emdash', 'quotedblleft', 'quotedblright', 'quoteleft', 'quoteright', 'divide', 'lozenge', 'ydieresis', 'Ydieresis', 'fraction', 'currency', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', 'daggerdbl', 'periodcentered', 'quotesinglbase', 'quotedblbase', 'perthousand', 'Acircumflex', 'Ecircumflex', 'Aacute', 'Edieresis', 'Egrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Igrave', 'Oacute', 'Ocircumflex', 'apple', 'Ograve', 'Uacute', 'Ucircumflex', 'Ugrave', 'dotlessi', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'ring', 'cedilla', 'hungarumlaut', 'ogonek', 'caron', 'Lslash', 'lslash', 'Scaron', 'scaron', 'Zcaron', 'zcaron', 'brokenbar', 'Eth', 'eth', 'Yacute', 'yacute', 'Thorn', 'thorn', 'minus', 'multiply', 'onesuperior', 'twosuperior', 'threesuperior', 'onehalf', 'onequarter', 'threequarters', 'franc', 'Gbreve', 'gbreve', 'Idotaccent', 'Scedilla', 'scedilla', 'Cacute', 'cacute', 'Ccaron', 'ccaron', 'dcroat'];
-function adjustWidths(properties) {
- if (!properties.fontMatrix) {
- return;
- }
- if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
- return;
- }
- var scale = 0.001 / properties.fontMatrix[0];
- var glyphsWidths = properties.widths;
- for (var glyph in glyphsWidths) {
- glyphsWidths[glyph] *= scale;
- }
- properties.defaultWidth *= scale;
-}
-function adjustToUnicode(properties, builtInEncoding) {
- if (properties.hasIncludedToUnicodeMap) {
- return;
- }
- if (properties.hasEncoding) {
- return;
- }
- if (builtInEncoding === properties.defaultEncoding) {
- return;
- }
- if (properties.toUnicode instanceof IdentityToUnicodeMap) {
- return;
- }
- var toUnicode = [],
- glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
- for (var charCode in builtInEncoding) {
- var glyphName = builtInEncoding[charCode];
- var unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
- if (unicode !== -1) {
- toUnicode[charCode] = String.fromCharCode(unicode);
- }
- }
- properties.toUnicode.amend(toUnicode);
-}
-function getFontType(type, subtype) {
- switch (type) {
- case 'Type1':
- return subtype === 'Type1C' ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
- case 'CIDFontType0':
- return subtype === 'CIDFontType0C' ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
- case 'OpenType':
- return _util.FontType.OPENTYPE;
- case 'TrueType':
- return _util.FontType.TRUETYPE;
- case 'CIDFontType2':
- return _util.FontType.CIDFONTTYPE2;
- case 'MMType1':
- return _util.FontType.MMTYPE1;
- case 'Type0':
- return _util.FontType.TYPE0;
- default:
- return _util.FontType.UNKNOWN;
- }
-}
-function recoverGlyphName(name, glyphsUnicodeMap) {
- if (glyphsUnicodeMap[name] !== undefined) {
- return name;
- }
- var unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
- if (unicode !== -1) {
- for (var key in glyphsUnicodeMap) {
- if (glyphsUnicodeMap[key] === unicode) {
- return key;
- }
- }
- }
- (0, _util.info)('Unable to recover a standard glyph name for: ' + name);
- return name;
-}
-var Glyph = function GlyphClosure() {
- function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
- this.fontChar = fontChar;
- this.unicode = unicode;
- this.accent = accent;
- this.width = width;
- this.vmetric = vmetric;
- this.operatorListId = operatorListId;
- this.isSpace = isSpace;
- this.isInFont = isInFont;
- }
- Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
- return this.fontChar === fontChar && this.unicode === unicode && this.accent === accent && this.width === width && this.vmetric === vmetric && this.operatorListId === operatorListId && this.isSpace === isSpace && this.isInFont === isInFont;
- };
- return Glyph;
-}();
-var ToUnicodeMap = function ToUnicodeMapClosure() {
- function ToUnicodeMap() {
- var cmap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
-
- this._map = cmap;
- }
- ToUnicodeMap.prototype = {
- get length() {
- return this._map.length;
- },
- forEach: function forEach(callback) {
- for (var charCode in this._map) {
- callback(charCode, this._map[charCode].charCodeAt(0));
- }
- },
- has: function has(i) {
- return this._map[i] !== undefined;
- },
- get: function get(i) {
- return this._map[i];
- },
- charCodeOf: function charCodeOf(value) {
- var map = this._map;
- if (map.length <= 0x10000) {
- return map.indexOf(value);
- }
- for (var charCode in map) {
- if (map[charCode] === value) {
- return charCode | 0;
- }
- }
- return -1;
- },
- amend: function amend(map) {
- for (var charCode in map) {
- this._map[charCode] = map[charCode];
- }
- }
- };
- return ToUnicodeMap;
-}();
-var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() {
- function IdentityToUnicodeMap(firstChar, lastChar) {
- this.firstChar = firstChar;
- this.lastChar = lastChar;
- }
- IdentityToUnicodeMap.prototype = {
- get length() {
- return this.lastChar + 1 - this.firstChar;
- },
- forEach: function forEach(callback) {
- for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
- callback(i, i);
- }
- },
- has: function has(i) {
- return this.firstChar <= i && i <= this.lastChar;
- },
- get: function get(i) {
- if (this.firstChar <= i && i <= this.lastChar) {
- return String.fromCharCode(i);
- }
- return undefined;
- },
- charCodeOf: function charCodeOf(v) {
- return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
- },
- amend: function amend(map) {
- (0, _util.unreachable)('Should not call amend()');
- }
- };
- return IdentityToUnicodeMap;
-}();
-var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
- function writeInt16(dest, offset, num) {
- dest[offset] = num >> 8 & 0xFF;
- dest[offset + 1] = num & 0xFF;
- }
- function writeInt32(dest, offset, num) {
- dest[offset] = num >> 24 & 0xFF;
- dest[offset + 1] = num >> 16 & 0xFF;
- dest[offset + 2] = num >> 8 & 0xFF;
- dest[offset + 3] = num & 0xFF;
- }
- function writeData(dest, offset, data) {
- var i, ii;
- if (data instanceof Uint8Array) {
- dest.set(data, offset);
- } else if (typeof data === 'string') {
- for (i = 0, ii = data.length; i < ii; i++) {
- dest[offset++] = data.charCodeAt(i) & 0xFF;
- }
- } else {
- for (i = 0, ii = data.length; i < ii; i++) {
- dest[offset++] = data[i] & 0xFF;
- }
- }
- }
- function OpenTypeFileBuilder(sfnt) {
- this.sfnt = sfnt;
- this.tables = Object.create(null);
- }
- OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) {
- var maxPower2 = 1,
- log2 = 0;
- while ((maxPower2 ^ entriesCount) > maxPower2) {
- maxPower2 <<= 1;
- log2++;
- }
- var searchRange = maxPower2 * entrySize;
- return {
- range: searchRange,
- entry: log2,
- rangeShift: entrySize * entriesCount - searchRange
- };
- };
- var OTF_HEADER_SIZE = 12;
- var OTF_TABLE_ENTRY_SIZE = 16;
- OpenTypeFileBuilder.prototype = {
- toArray: function OpenTypeFileBuilder_toArray() {
- var sfnt = this.sfnt;
- var tables = this.tables;
- var tablesNames = Object.keys(tables);
- tablesNames.sort();
- var numTables = tablesNames.length;
- var i, j, jj, table, tableName;
- var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
- var tableOffsets = [offset];
- for (i = 0; i < numTables; i++) {
- table = tables[tablesNames[i]];
- var paddedLength = (table.length + 3 & ~3) >>> 0;
- offset += paddedLength;
- tableOffsets.push(offset);
- }
- var file = new Uint8Array(offset);
- for (i = 0; i < numTables; i++) {
- table = tables[tablesNames[i]];
- writeData(file, tableOffsets[i], table);
- }
- if (sfnt === 'true') {
- sfnt = (0, _util.string32)(0x00010000);
- }
- file[0] = sfnt.charCodeAt(0) & 0xFF;
- file[1] = sfnt.charCodeAt(1) & 0xFF;
- file[2] = sfnt.charCodeAt(2) & 0xFF;
- file[3] = sfnt.charCodeAt(3) & 0xFF;
- writeInt16(file, 4, numTables);
- var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
- writeInt16(file, 6, searchParams.range);
- writeInt16(file, 8, searchParams.entry);
- writeInt16(file, 10, searchParams.rangeShift);
- offset = OTF_HEADER_SIZE;
- for (i = 0; i < numTables; i++) {
- tableName = tablesNames[i];
- file[offset] = tableName.charCodeAt(0) & 0xFF;
- file[offset + 1] = tableName.charCodeAt(1) & 0xFF;
- file[offset + 2] = tableName.charCodeAt(2) & 0xFF;
- file[offset + 3] = tableName.charCodeAt(3) & 0xFF;
- var checksum = 0;
- for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
- var quad = (0, _util.readUint32)(file, j);
- checksum = checksum + quad >>> 0;
- }
- writeInt32(file, offset + 4, checksum);
- writeInt32(file, offset + 8, tableOffsets[i]);
- writeInt32(file, offset + 12, tables[tableName].length);
- offset += OTF_TABLE_ENTRY_SIZE;
- }
- return file;
- },
- addTable: function OpenTypeFileBuilder_addTable(tag, data) {
- if (tag in this.tables) {
- throw new Error('Table ' + tag + ' already exists');
- }
- this.tables[tag] = data;
- }
- };
- return OpenTypeFileBuilder;
-}();
-var Font = function FontClosure() {
- function Font(name, file, properties) {
- var charCode;
- this.name = name;
- this.loadedName = properties.loadedName;
- this.isType3Font = properties.isType3Font;
- this.sizes = [];
- this.missingFile = false;
- this.glyphCache = Object.create(null);
- this.isSerifFont = !!(properties.flags & FontFlags.Serif);
- this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
- this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
- var type = properties.type;
- var subtype = properties.subtype;
- this.type = type;
- this.subtype = subtype;
- this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif';
- this.differences = properties.differences;
- this.widths = properties.widths;
- this.defaultWidth = properties.defaultWidth;
- this.composite = properties.composite;
- this.wideChars = properties.wideChars;
- this.cMap = properties.cMap;
- this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
- this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
- this.fontMatrix = properties.fontMatrix;
- this.bbox = properties.bbox;
- this.defaultEncoding = properties.defaultEncoding;
- this.toUnicode = properties.toUnicode;
- this.fallbackToUnicode = properties.fallbackToUnicode || new ToUnicodeMap();
- this.toFontChar = [];
- if (properties.type === 'Type3') {
- for (charCode = 0; charCode < 256; charCode++) {
- this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
- }
- this.fontType = _util.FontType.TYPE3;
- return;
- }
- this.cidEncoding = properties.cidEncoding;
- this.vertical = properties.vertical;
- if (this.vertical) {
- this.vmetrics = properties.vmetrics;
- this.defaultVMetrics = properties.defaultVMetrics;
- }
- if (!file || file.isEmpty) {
- if (file) {
- (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ')');
- }
- this.fallbackToSystemFont();
- return;
- }
-
- var _getFontFileType = getFontFileType(file, properties);
-
- var _getFontFileType2 = _slicedToArray(_getFontFileType, 2);
-
- type = _getFontFileType2[0];
- subtype = _getFontFileType2[1];
-
- if (type !== this.type || subtype !== this.subtype) {
- (0, _util.info)('Inconsistent font file Type/SubType, expected: ' + (this.type + '/' + this.subtype + ' but found: ' + type + '/' + subtype + '.'));
- }
- try {
- var data;
- switch (type) {
- case 'MMType1':
- (0, _util.info)('MMType1 font (' + name + '), falling back to Type1.');
- case 'Type1':
- case 'CIDFontType0':
- this.mimetype = 'font/opentype';
- var cff = subtype === 'Type1C' || subtype === 'CIDFontType0C' ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
- adjustWidths(properties);
- data = this.convert(name, cff, properties);
- break;
- case 'OpenType':
- case 'TrueType':
- case 'CIDFontType2':
- this.mimetype = 'font/opentype';
- data = this.checkAndRepair(name, file, properties);
- if (this.isOpenType) {
- adjustWidths(properties);
- type = 'OpenType';
- }
- break;
- default:
- throw new _util.FormatError('Font ' + type + ' is not supported');
- }
- } catch (e) {
- (0, _util.warn)(e);
- this.fallbackToSystemFont();
- return;
- }
- this.data = data;
- this.fontType = getFontType(type, subtype);
- this.fontMatrix = properties.fontMatrix;
- this.widths = properties.widths;
- this.defaultWidth = properties.defaultWidth;
- this.toUnicode = properties.toUnicode;
- this.encoding = properties.baseEncoding;
- this.seacMap = properties.seacMap;
- }
- Font.getFontID = function () {
- var ID = 1;
- return function Font_getFontID() {
- return String(ID++);
- };
- }();
- function int16(b0, b1) {
- return (b0 << 8) + b1;
- }
- function writeSignedInt16(bytes, index, value) {
- bytes[index + 1] = value;
- bytes[index] = value >>> 8;
- }
- function signedInt16(b0, b1) {
- var value = (b0 << 8) + b1;
- return value & 1 << 15 ? value - 0x10000 : value;
- }
- function int32(b0, b1, b2, b3) {
- return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
- }
- function string16(value) {
- return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
- }
- function safeString16(value) {
- value = value > 0x7FFF ? 0x7FFF : value < -0x8000 ? -0x8000 : value;
- return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
- }
- function isTrueTypeFile(file) {
- var header = file.peekBytes(4);
- return (0, _util.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === 'true';
- }
- function isTrueTypeCollectionFile(file) {
- var header = file.peekBytes(4);
- return (0, _util.bytesToString)(header) === 'ttcf';
- }
- function isOpenTypeFile(file) {
- var header = file.peekBytes(4);
- return (0, _util.bytesToString)(header) === 'OTTO';
- }
- function isType1File(file) {
- var header = file.peekBytes(2);
- if (header[0] === 0x25 && header[1] === 0x21) {
- return true;
- }
- if (header[0] === 0x80 && header[1] === 0x01) {
- return true;
- }
- return false;
- }
- function isCFFFile(file) {
- var header = file.peekBytes(4);
- if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
- return true;
- }
- return false;
- }
- function getFontFileType(file, _ref) {
- var type = _ref.type,
- subtype = _ref.subtype,
- composite = _ref.composite;
-
- var fileType = void 0,
- fileSubtype = void 0;
- if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
- if (composite) {
- fileType = 'CIDFontType2';
- } else {
- fileType = 'TrueType';
- }
- } else if (isOpenTypeFile(file)) {
- if (composite) {
- fileType = 'CIDFontType2';
- } else {
- fileType = 'OpenType';
- }
- } else if (isType1File(file)) {
- if (composite) {
- fileType = 'CIDFontType0';
- } else {
- fileType = type === 'MMType1' ? 'MMType1' : 'Type1';
- }
- } else if (isCFFFile(file)) {
- if (composite) {
- fileType = 'CIDFontType0';
- fileSubtype = 'CIDFontType0C';
- } else {
- fileType = type === 'MMType1' ? 'MMType1' : 'Type1';
- fileSubtype = 'Type1C';
- }
- } else {
- (0, _util.warn)('getFontFileType: Unable to detect correct font file Type/Subtype.');
- fileType = type;
- fileSubtype = subtype;
- }
- return [fileType, fileSubtype];
- }
- function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
- var toFontChar = [],
- unicode;
- for (var i = 0, ii = encoding.length; i < ii; i++) {
- unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
- if (unicode !== -1) {
- toFontChar[i] = unicode;
- }
- }
- for (var charCode in differences) {
- unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
- if (unicode !== -1) {
- toFontChar[+charCode] = unicode;
- }
- }
- return toFontChar;
- }
- function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId) {
- var newMap = Object.create(null);
- var toFontChar = [];
- var privateUseAreaIndex = 0;
- var nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
- var privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
- for (var originalCharCode in charCodeToGlyphId) {
- originalCharCode |= 0;
- var glyphId = charCodeToGlyphId[originalCharCode];
- if (!hasGlyph(glyphId)) {
- continue;
- }
- if (nextAvailableFontCharCode > privateUseOffetEnd) {
- privateUseAreaIndex++;
- if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
- (0, _util.warn)('Ran out of space in font private use area.');
- break;
- }
- nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
- privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
- }
- var fontCharCode = nextAvailableFontCharCode++;
- if (glyphId === 0) {
- glyphId = newGlyphZeroId;
- }
- newMap[fontCharCode] = glyphId;
- toFontChar[originalCharCode] = fontCharCode;
- }
- return {
- toFontChar: toFontChar,
- charCodeToGlyphId: newMap,
- nextAvailableFontCharCode: nextAvailableFontCharCode
- };
- }
- function getRanges(glyphs, numGlyphs) {
- var codes = [];
- for (var charCode in glyphs) {
- if (glyphs[charCode] >= numGlyphs) {
- continue;
- }
- codes.push({
- fontCharCode: charCode | 0,
- glyphId: glyphs[charCode]
- });
- }
- if (codes.length === 0) {
- codes.push({
- fontCharCode: 0,
- glyphId: 0
- });
- }
- codes.sort(function fontGetRangesSort(a, b) {
- return a.fontCharCode - b.fontCharCode;
- });
- var ranges = [];
- var length = codes.length;
- for (var n = 0; n < length;) {
- var start = codes[n].fontCharCode;
- var codeIndices = [codes[n].glyphId];
- ++n;
- var end = start;
- while (n < length && end + 1 === codes[n].fontCharCode) {
- codeIndices.push(codes[n].glyphId);
- ++end;
- ++n;
- if (end === 0xFFFF) {
- break;
- }
- }
- ranges.push([start, end, codeIndices]);
- }
- return ranges;
- }
- function createCmapTable(glyphs, numGlyphs) {
- var ranges = getRanges(glyphs, numGlyphs);
- var numTables = ranges[ranges.length - 1][1] > 0xFFFF ? 2 : 1;
- var cmap = '\x00\x00' + string16(numTables) + '\x00\x03' + '\x00\x01' + (0, _util.string32)(4 + numTables * 8);
- var i, ii, j, jj;
- for (i = ranges.length - 1; i >= 0; --i) {
- if (ranges[i][0] <= 0xFFFF) {
- break;
- }
- }
- var bmpLength = i + 1;
- if (ranges[i][0] < 0xFFFF && ranges[i][1] === 0xFFFF) {
- ranges[i][1] = 0xFFFE;
- }
- var trailingRangesCount = ranges[i][1] < 0xFFFF ? 1 : 0;
- var segCount = bmpLength + trailingRangesCount;
- var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
- var startCount = '';
- var endCount = '';
- var idDeltas = '';
- var idRangeOffsets = '';
- var glyphsIds = '';
- var bias = 0;
- var range, start, end, codes;
- for (i = 0, ii = bmpLength; i < ii; i++) {
- range = ranges[i];
- start = range[0];
- end = range[1];
- startCount += string16(start);
- endCount += string16(end);
- codes = range[2];
- var contiguous = true;
- for (j = 1, jj = codes.length; j < jj; ++j) {
- if (codes[j] !== codes[j - 1] + 1) {
- contiguous = false;
- break;
- }
- }
- if (!contiguous) {
- var offset = (segCount - i) * 2 + bias * 2;
- bias += end - start + 1;
- idDeltas += string16(0);
- idRangeOffsets += string16(offset);
- for (j = 0, jj = codes.length; j < jj; ++j) {
- glyphsIds += string16(codes[j]);
- }
- } else {
- var startCode = codes[0];
- idDeltas += string16(startCode - start & 0xFFFF);
- idRangeOffsets += string16(0);
- }
- }
- if (trailingRangesCount > 0) {
- endCount += '\xFF\xFF';
- startCount += '\xFF\xFF';
- idDeltas += '\x00\x01';
- idRangeOffsets += '\x00\x00';
- }
- var format314 = '\x00\x00' + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + '\x00\x00' + startCount + idDeltas + idRangeOffsets + glyphsIds;
- var format31012 = '';
- var header31012 = '';
- if (numTables > 1) {
- cmap += '\x00\x03' + '\x00\x0A' + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
- format31012 = '';
- for (i = 0, ii = ranges.length; i < ii; i++) {
- range = ranges[i];
- start = range[0];
- codes = range[2];
- var code = codes[0];
- for (j = 1, jj = codes.length; j < jj; ++j) {
- if (codes[j] !== codes[j - 1] + 1) {
- end = range[0] + j - 1;
- format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
- start = end + 1;
- code = codes[j];
- }
- }
- format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
- }
- header31012 = '\x00\x0C' + '\x00\x00' + (0, _util.string32)(format31012.length + 16) + '\x00\x00\x00\x00' + (0, _util.string32)(format31012.length / 12);
- }
- return cmap + '\x00\x04' + string16(format314.length + 4) + format314 + header31012 + format31012;
- }
- function validateOS2Table(os2) {
- var stream = new _stream.Stream(os2.data);
- var version = stream.getUint16();
- stream.getBytes(60);
- var selection = stream.getUint16();
- if (version < 4 && selection & 0x0300) {
- return false;
- }
- var firstChar = stream.getUint16();
- var lastChar = stream.getUint16();
- if (firstChar > lastChar) {
- return false;
- }
- stream.getBytes(6);
- var usWinAscent = stream.getUint16();
- if (usWinAscent === 0) {
- return false;
- }
- os2.data[8] = os2.data[9] = 0;
- return true;
- }
- function createOS2Table(properties, charstrings, override) {
- override = override || {
- unitsPerEm: 0,
- yMax: 0,
- yMin: 0,
- ascent: 0,
- descent: 0
- };
- var ulUnicodeRange1 = 0;
- var ulUnicodeRange2 = 0;
- var ulUnicodeRange3 = 0;
- var ulUnicodeRange4 = 0;
- var firstCharIndex = null;
- var lastCharIndex = 0;
- if (charstrings) {
- for (var code in charstrings) {
- code |= 0;
- if (firstCharIndex > code || !firstCharIndex) {
- firstCharIndex = code;
- }
- if (lastCharIndex < code) {
- lastCharIndex = code;
- }
- var position = (0, _unicode.getUnicodeRangeFor)(code);
- if (position < 32) {
- ulUnicodeRange1 |= 1 << position;
- } else if (position < 64) {
- ulUnicodeRange2 |= 1 << position - 32;
- } else if (position < 96) {
- ulUnicodeRange3 |= 1 << position - 64;
- } else if (position < 123) {
- ulUnicodeRange4 |= 1 << position - 96;
- } else {
- throw new _util.FormatError('Unicode ranges Bits > 123 are reserved for internal usage');
- }
- }
- if (lastCharIndex > 0xFFFF) {
- lastCharIndex = 0xFFFF;
- }
- } else {
- firstCharIndex = 0;
- lastCharIndex = 255;
- }
- var bbox = properties.bbox || [0, 0, 0, 0];
- var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
- var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
- var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
- var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
- if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
- typoDescent = -typoDescent;
- }
- var winAscent = override.yMax || typoAscent;
- var winDescent = -override.yMin || -typoDescent;
- return '\x00\x03' + '\x02\x24' + '\x01\xF4' + '\x00\x05' + '\x00\x00' + '\x02\x8A' + '\x02\xBB' + '\x00\x00' + '\x00\x8C' + '\x02\x8A' + '\x02\xBB' + '\x00\x00' + '\x01\xDF' + '\x00\x31' + '\x01\x02' + '\x00\x00' + '\x00\x00\x06' + String.fromCharCode(properties.fixedPitch ? 0x09 : 0x00) + '\x00\x00\x00\x00\x00\x00' + (0, _util.string32)(ulUnicodeRange1) + (0, _util.string32)(ulUnicodeRange2) + (0, _util.string32)(ulUnicodeRange3) + (0, _util.string32)(ulUnicodeRange4) + '\x2A\x32\x31\x2A' + string16(properties.italicAngle ? 1 : 0) + string16(firstCharIndex || properties.firstChar) + string16(lastCharIndex || properties.lastChar) + string16(typoAscent) + string16(typoDescent) + '\x00\x64' + string16(winAscent) + string16(winDescent) + '\x00\x00\x00\x00' + '\x00\x00\x00\x00' + string16(properties.xHeight) + string16(properties.capHeight) + string16(0) + string16(firstCharIndex || properties.firstChar) + '\x00\x03';
- }
- function createPostTable(properties) {
- var angle = Math.floor(properties.italicAngle * Math.pow(2, 16));
- return '\x00\x03\x00\x00' + (0, _util.string32)(angle) + '\x00\x00' + '\x00\x00' + (0, _util.string32)(properties.fixedPitch) + '\x00\x00\x00\x00' + '\x00\x00\x00\x00' + '\x00\x00\x00\x00' + '\x00\x00\x00\x00';
- }
- function createNameTable(name, proto) {
- if (!proto) {
- proto = [[], []];
- }
- var strings = [proto[0][0] || 'Original licence', proto[0][1] || name, proto[0][2] || 'Unknown', proto[0][3] || 'uniqueID', proto[0][4] || name, proto[0][5] || 'Version 0.11', proto[0][6] || '', proto[0][7] || 'Unknown', proto[0][8] || 'Unknown', proto[0][9] || 'Unknown'];
- var stringsUnicode = [];
- var i, ii, j, jj, str;
- for (i = 0, ii = strings.length; i < ii; i++) {
- str = proto[1][i] || strings[i];
- var strBufUnicode = [];
- for (j = 0, jj = str.length; j < jj; j++) {
- strBufUnicode.push(string16(str.charCodeAt(j)));
- }
- stringsUnicode.push(strBufUnicode.join(''));
- }
- var names = [strings, stringsUnicode];
- var platforms = ['\x00\x01', '\x00\x03'];
- var encodings = ['\x00\x00', '\x00\x01'];
- var languages = ['\x00\x00', '\x04\x09'];
- var namesRecordCount = strings.length * platforms.length;
- var nameTable = '\x00\x00' + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
- var strOffset = 0;
- for (i = 0, ii = platforms.length; i < ii; i++) {
- var strs = names[i];
- for (j = 0, jj = strs.length; j < jj; j++) {
- str = strs[j];
- var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
- nameTable += nameRecord;
- strOffset += str.length;
- }
- }
- nameTable += strings.join('') + stringsUnicode.join('');
- return nameTable;
- }
- Font.prototype = {
- name: null,
- font: null,
- mimetype: null,
- encoding: null,
- get renderer() {
- var renderer = _font_renderer.FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
- return (0, _util.shadow)(this, 'renderer', renderer);
- },
- exportData: function Font_exportData() {
- var data = {};
- for (var i in this) {
- if (this.hasOwnProperty(i)) {
- data[i] = this[i];
- }
- }
- return data;
- },
- fallbackToSystemFont: function Font_fallbackToSystemFont() {
- var _this = this;
-
- this.missingFile = true;
- var charCode, unicode;
- var name = this.name;
- var type = this.type;
- var subtype = this.subtype;
- var fontName = name.replace(/[,_]/g, '-');
- var stdFontMap = (0, _standard_fonts.getStdFontMap)(),
- nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
- var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
- fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
- this.bold = fontName.search(/bold/gi) !== -1;
- this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
- this.black = name.search(/Black/g) !== -1;
- this.remeasure = Object.keys(this.widths).length > 0;
- if (isStandardFont && type === 'CIDFontType2' && this.cidEncoding.indexOf('Identity-') === 0) {
- var GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
- var map = [];
- for (charCode in GlyphMapForStandardFonts) {
- map[+charCode] = GlyphMapForStandardFonts[charCode];
- }
- if (/Arial-?Black/i.test(name)) {
- var SupplementalGlyphMapForArialBlack = (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)();
- for (charCode in SupplementalGlyphMapForArialBlack) {
- map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
- }
- } else if (/Calibri/i.test(name)) {
- var SupplementalGlyphMapForCalibri = (0, _standard_fonts.getSupplementalGlyphMapForCalibri)();
- for (charCode in SupplementalGlyphMapForCalibri) {
- map[+charCode] = SupplementalGlyphMapForCalibri[charCode];
- }
- }
- var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
- if (!isIdentityUnicode) {
- this.toUnicode.forEach(function (charCode, unicodeCharCode) {
- map[+charCode] = unicodeCharCode;
- });
- }
- this.toFontChar = map;
- this.toUnicode = new ToUnicodeMap(map);
- } else if (/Symbol/i.test(fontName)) {
- this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
- } else if (/Dingbats/i.test(fontName)) {
- if (/Wingdings/i.test(name)) {
- (0, _util.warn)('Non-embedded Wingdings font, falling back to ZapfDingbats.');
- }
- this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
- } else if (isStandardFont) {
- this.toFontChar = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
- } else {
- var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
- this.toUnicode.forEach(function (charCode, unicodeCharCode) {
- if (!_this.composite) {
- var glyphName = _this.differences[charCode] || _this.defaultEncoding[charCode];
- unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
- if (unicode !== -1) {
- unicodeCharCode = unicode;
- }
- }
- _this.toFontChar[charCode] = unicodeCharCode;
- });
- }
- this.loadedName = fontName.split('-')[0];
- this.fontType = getFontType(type, subtype);
- },
- checkAndRepair: function Font_checkAndRepair(name, font, properties) {
- var VALID_TABLES = ['OS/2', 'cmap', 'head', 'hhea', 'hmtx', 'maxp', 'name', 'post', 'loca', 'glyf', 'fpgm', 'prep', 'cvt ', 'CFF '];
- function readTables(file, numTables) {
- var tables = Object.create(null);
- tables['OS/2'] = null;
- tables['cmap'] = null;
- tables['head'] = null;
- tables['hhea'] = null;
- tables['hmtx'] = null;
- tables['maxp'] = null;
- tables['name'] = null;
- tables['post'] = null;
- for (var i = 0; i < numTables; i++) {
- var table = readTableEntry(font);
- if (!VALID_TABLES.includes(table.tag)) {
- continue;
- }
- if (table.length === 0) {
- continue;
- }
- tables[table.tag] = table;
- }
- return tables;
- }
- function readTableEntry(file) {
- var tag = (0, _util.bytesToString)(file.getBytes(4));
- var checksum = file.getInt32() >>> 0;
- var offset = file.getInt32() >>> 0;
- var length = file.getInt32() >>> 0;
- var previousPosition = file.pos;
- file.pos = file.start ? file.start : 0;
- file.skip(offset);
- var data = file.getBytes(length);
- file.pos = previousPosition;
- if (tag === 'head') {
- data[8] = data[9] = data[10] = data[11] = 0;
- data[17] |= 0x20;
- }
- return {
- tag: tag,
- checksum: checksum,
- length: length,
- offset: offset,
- data: data
- };
- }
- function readOpenTypeHeader(ttf) {
- return {
- version: (0, _util.bytesToString)(ttf.getBytes(4)),
- numTables: ttf.getUint16(),
- searchRange: ttf.getUint16(),
- entrySelector: ttf.getUint16(),
- rangeShift: ttf.getUint16()
- };
- }
- function readTrueTypeCollectionHeader(ttc) {
- var ttcTag = (0, _util.bytesToString)(ttc.getBytes(4));
- (0, _util.assert)(ttcTag === 'ttcf', 'Must be a TrueType Collection font.');
- var majorVersion = ttc.getUint16();
- var minorVersion = ttc.getUint16();
- var numFonts = ttc.getInt32() >>> 0;
- var offsetTable = [];
- for (var i = 0; i < numFonts; i++) {
- offsetTable.push(ttc.getInt32() >>> 0);
- }
- var header = {
- ttcTag: ttcTag,
- majorVersion: majorVersion,
- minorVersion: minorVersion,
- numFonts: numFonts,
- offsetTable: offsetTable
- };
- switch (majorVersion) {
- case 1:
- return header;
- case 2:
- header.dsigTag = ttc.getInt32() >>> 0;
- header.dsigLength = ttc.getInt32() >>> 0;
- header.dsigOffset = ttc.getInt32() >>> 0;
- return header;
- }
- throw new _util.FormatError('Invalid TrueType Collection majorVersion: ' + majorVersion + '.');
- }
- function readTrueTypeCollectionData(ttc, fontName) {
- var _readTrueTypeCollecti = readTrueTypeCollectionHeader(ttc),
- numFonts = _readTrueTypeCollecti.numFonts,
- offsetTable = _readTrueTypeCollecti.offsetTable;
-
- for (var i = 0; i < numFonts; i++) {
- ttc.pos = (ttc.start || 0) + offsetTable[i];
- var potentialHeader = readOpenTypeHeader(ttc);
- var potentialTables = readTables(ttc, potentialHeader.numTables);
- if (!potentialTables['name']) {
- throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
- }
- var nameTable = readNameTable(potentialTables['name']);
- for (var j = 0, jj = nameTable.length; j < jj; j++) {
- for (var k = 0, kk = nameTable[j].length; k < kk; k++) {
- var nameEntry = nameTable[j][k];
- if (nameEntry && nameEntry.replace(/\s/g, '') === fontName) {
- return {
- header: potentialHeader,
- tables: potentialTables
- };
- }
- }
- }
- }
- throw new _util.FormatError('TrueType Collection does not contain "' + fontName + '" font.');
- }
- function readCmapTable(cmap, font, isSymbolicFont, hasEncoding) {
- if (!cmap) {
- (0, _util.warn)('No cmap table available.');
- return {
- platformId: -1,
- encodingId: -1,
- mappings: [],
- hasShortCmap: false
- };
- }
- var segment;
- var start = (font.start ? font.start : 0) + cmap.offset;
- font.pos = start;
- font.getUint16();
- var numTables = font.getUint16();
- var potentialTable;
- var canBreak = false;
- for (var i = 0; i < numTables; i++) {
- var platformId = font.getUint16();
- var encodingId = font.getUint16();
- var offset = font.getInt32() >>> 0;
- var useTable = false;
- if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
- continue;
- }
- if (platformId === 0 && encodingId === 0) {
- useTable = true;
- } else if (platformId === 1 && encodingId === 0) {
- useTable = true;
- } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
- useTable = true;
- if (!isSymbolicFont) {
- canBreak = true;
- }
- } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
- useTable = true;
- canBreak = true;
- }
- if (useTable) {
- potentialTable = {
- platformId: platformId,
- encodingId: encodingId,
- offset: offset
- };
- }
- if (canBreak) {
- break;
- }
- }
- if (potentialTable) {
- font.pos = start + potentialTable.offset;
- }
- if (!potentialTable || font.peekByte() === -1) {
- (0, _util.warn)('Could not find a preferred cmap table.');
- return {
- platformId: -1,
- encodingId: -1,
- mappings: [],
- hasShortCmap: false
- };
- }
- var format = font.getUint16();
- font.getUint16();
- font.getUint16();
- var hasShortCmap = false;
- var mappings = [];
- var j, glyphId;
- if (format === 0) {
- for (j = 0; j < 256; j++) {
- var index = font.getByte();
- if (!index) {
- continue;
- }
- mappings.push({
- charCode: j,
- glyphId: index
- });
- }
- hasShortCmap = true;
- } else if (format === 4) {
- var segCount = font.getUint16() >> 1;
- font.getBytes(6);
- var segIndex,
- segments = [];
- for (segIndex = 0; segIndex < segCount; segIndex++) {
- segments.push({ end: font.getUint16() });
- }
- font.getUint16();
- for (segIndex = 0; segIndex < segCount; segIndex++) {
- segments[segIndex].start = font.getUint16();
- }
- for (segIndex = 0; segIndex < segCount; segIndex++) {
- segments[segIndex].delta = font.getUint16();
- }
- var offsetsCount = 0;
- for (segIndex = 0; segIndex < segCount; segIndex++) {
- segment = segments[segIndex];
- var rangeOffset = font.getUint16();
- if (!rangeOffset) {
- segment.offsetIndex = -1;
- continue;
- }
- var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
- segment.offsetIndex = offsetIndex;
- offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
- }
- var offsets = [];
- for (j = 0; j < offsetsCount; j++) {
- offsets.push(font.getUint16());
- }
- for (segIndex = 0; segIndex < segCount; segIndex++) {
- segment = segments[segIndex];
- start = segment.start;
- var end = segment.end;
- var delta = segment.delta;
- offsetIndex = segment.offsetIndex;
- for (j = start; j <= end; j++) {
- if (j === 0xFFFF) {
- continue;
- }
- glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
- glyphId = glyphId + delta & 0xFFFF;
- mappings.push({
- charCode: j,
- glyphId: glyphId
- });
- }
- }
- } else if (format === 6) {
- var firstCode = font.getUint16();
- var entryCount = font.getUint16();
- for (j = 0; j < entryCount; j++) {
- glyphId = font.getUint16();
- var charCode = firstCode + j;
- mappings.push({
- charCode: charCode,
- glyphId: glyphId
- });
- }
- } else {
- (0, _util.warn)('cmap table has unsupported format: ' + format);
- return {
- platformId: -1,
- encodingId: -1,
- mappings: [],
- hasShortCmap: false
- };
- }
- mappings.sort(function (a, b) {
- return a.charCode - b.charCode;
- });
- for (i = 1; i < mappings.length; i++) {
- if (mappings[i - 1].charCode === mappings[i].charCode) {
- mappings.splice(i, 1);
- i--;
- }
- }
- return {
- platformId: potentialTable.platformId,
- encodingId: potentialTable.encodingId,
- mappings: mappings,
- hasShortCmap: hasShortCmap
- };
- }
- function sanitizeMetrics(font, header, metrics, numGlyphs) {
- if (!header) {
- if (metrics) {
- metrics.data = null;
- }
- return;
- }
- font.pos = (font.start ? font.start : 0) + header.offset;
- font.pos += header.length - 2;
- var numOfMetrics = font.getUint16();
- if (numOfMetrics > numGlyphs) {
- (0, _util.info)('The numOfMetrics (' + numOfMetrics + ') should not be ' + 'greater than the numGlyphs (' + numGlyphs + ')');
- numOfMetrics = numGlyphs;
- header.data[34] = (numOfMetrics & 0xff00) >> 8;
- header.data[35] = numOfMetrics & 0x00ff;
- }
- var numOfSidebearings = numGlyphs - numOfMetrics;
- var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
- if (numMissing > 0) {
- var entries = new Uint8Array(metrics.length + numMissing * 2);
- entries.set(metrics.data);
- metrics.data = entries;
- }
- }
- function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
- var glyphProfile = {
- length: 0,
- sizeOfInstructions: 0
- };
- if (sourceEnd - sourceStart <= 12) {
- return glyphProfile;
- }
- var glyf = source.subarray(sourceStart, sourceEnd);
- var contoursCount = signedInt16(glyf[0], glyf[1]);
- if (contoursCount < 0) {
- contoursCount = -1;
- writeSignedInt16(glyf, 0, contoursCount);
- dest.set(glyf, destStart);
- glyphProfile.length = glyf.length;
- return glyphProfile;
- }
- var i,
- j = 10,
- flagsCount = 0;
- for (i = 0; i < contoursCount; i++) {
- var endPoint = glyf[j] << 8 | glyf[j + 1];
- flagsCount = endPoint + 1;
- j += 2;
- }
- var instructionsStart = j;
- var instructionsLength = glyf[j] << 8 | glyf[j + 1];
- glyphProfile.sizeOfInstructions = instructionsLength;
- j += 2 + instructionsLength;
- var instructionsEnd = j;
- var coordinatesLength = 0;
- for (i = 0; i < flagsCount; i++) {
- var flag = glyf[j++];
- if (flag & 0xC0) {
- glyf[j - 1] = flag & 0x3F;
- }
- var xyLength = (flag & 2 ? 1 : flag & 16 ? 0 : 2) + (flag & 4 ? 1 : flag & 32 ? 0 : 2);
- coordinatesLength += xyLength;
- if (flag & 8) {
- var repeat = glyf[j++];
- i += repeat;
- coordinatesLength += repeat * xyLength;
- }
- }
- if (coordinatesLength === 0) {
- return glyphProfile;
- }
- var glyphDataLength = j + coordinatesLength;
- if (glyphDataLength > glyf.length) {
- return glyphProfile;
- }
- if (!hintsValid && instructionsLength > 0) {
- dest.set(glyf.subarray(0, instructionsStart), destStart);
- dest.set([0, 0], destStart + instructionsStart);
- dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
- glyphDataLength -= instructionsLength;
- if (glyf.length - glyphDataLength > 3) {
- glyphDataLength = glyphDataLength + 3 & ~3;
- }
- glyphProfile.length = glyphDataLength;
- return glyphProfile;
- }
- if (glyf.length - glyphDataLength > 3) {
- glyphDataLength = glyphDataLength + 3 & ~3;
- dest.set(glyf.subarray(0, glyphDataLength), destStart);
- glyphProfile.length = glyphDataLength;
- return glyphProfile;
- }
- dest.set(glyf, destStart);
- glyphProfile.length = glyf.length;
- return glyphProfile;
- }
- function sanitizeHead(head, numGlyphs, locaLength) {
- var data = head.data;
- var version = int32(data[0], data[1], data[2], data[3]);
- if (version >> 16 !== 1) {
- (0, _util.info)('Attempting to fix invalid version in head table: ' + version);
- data[0] = 0;
- data[1] = 1;
- data[2] = 0;
- data[3] = 0;
- }
- var indexToLocFormat = int16(data[50], data[51]);
- if (indexToLocFormat < 0 || indexToLocFormat > 1) {
- (0, _util.info)('Attempting to fix invalid indexToLocFormat in head table: ' + indexToLocFormat);
- var numGlyphsPlusOne = numGlyphs + 1;
- if (locaLength === numGlyphsPlusOne << 1) {
- data[50] = 0;
- data[51] = 0;
- } else if (locaLength === numGlyphsPlusOne << 2) {
- data[50] = 0;
- data[51] = 1;
- } else {
- throw new _util.FormatError('Could not fix indexToLocFormat: ' + indexToLocFormat);
- }
- }
- }
- function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
- var itemSize, itemDecode, itemEncode;
- if (isGlyphLocationsLong) {
- itemSize = 4;
- itemDecode = function fontItemDecodeLong(data, offset) {
- return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
- };
- itemEncode = function fontItemEncodeLong(data, offset, value) {
- data[offset] = value >>> 24 & 0xFF;
- data[offset + 1] = value >> 16 & 0xFF;
- data[offset + 2] = value >> 8 & 0xFF;
- data[offset + 3] = value & 0xFF;
- };
- } else {
- itemSize = 2;
- itemDecode = function fontItemDecode(data, offset) {
- return data[offset] << 9 | data[offset + 1] << 1;
- };
- itemEncode = function fontItemEncode(data, offset, value) {
- data[offset] = value >> 9 & 0xFF;
- data[offset + 1] = value >> 1 & 0xFF;
- };
- }
- var numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
- var locaData = loca.data;
- var locaDataSize = itemSize * (1 + numGlyphsOut);
- locaData = new Uint8Array(locaDataSize);
- locaData.set(loca.data.subarray(0, locaDataSize));
- loca.data = locaData;
- var oldGlyfData = glyf.data;
- var oldGlyfDataLength = oldGlyfData.length;
- var newGlyfData = new Uint8Array(oldGlyfDataLength);
- var startOffset = itemDecode(locaData, 0);
- var writeOffset = 0;
- var missingGlyphs = Object.create(null);
- itemEncode(locaData, 0, writeOffset);
- var i, j;
- for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
- var endOffset = itemDecode(locaData, j);
- if (endOffset === 0) {
- endOffset = startOffset;
- }
- if (endOffset > oldGlyfDataLength && (oldGlyfDataLength + 3 & ~3) === endOffset) {
- endOffset = oldGlyfDataLength;
- }
- if (endOffset > oldGlyfDataLength) {
- startOffset = endOffset;
- }
- var glyphProfile = sanitizeGlyph(oldGlyfData, startOffset, endOffset, newGlyfData, writeOffset, hintsValid);
- var newLength = glyphProfile.length;
- if (newLength === 0) {
- missingGlyphs[i] = true;
- }
- if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
- maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
- }
- writeOffset += newLength;
- itemEncode(locaData, j, writeOffset);
- startOffset = endOffset;
- }
- if (writeOffset === 0) {
- var simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
- for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
- itemEncode(locaData, j, simpleGlyph.length);
- }
- glyf.data = simpleGlyph;
- } else if (dupFirstEntry) {
- var firstEntryLength = itemDecode(locaData, itemSize);
- if (newGlyfData.length > firstEntryLength + writeOffset) {
- glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
- } else {
- glyf.data = new Uint8Array(firstEntryLength + writeOffset);
- glyf.data.set(newGlyfData.subarray(0, writeOffset));
- }
- glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
- itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
- } else {
- glyf.data = newGlyfData.subarray(0, writeOffset);
- }
- return {
- missingGlyphs: missingGlyphs,
- maxSizeOfInstructions: maxSizeOfInstructions
- };
- }
- function readPostScriptTable(post, properties, maxpNumGlyphs) {
- var start = (font.start ? font.start : 0) + post.offset;
- font.pos = start;
- var length = post.length,
- end = start + length;
- var version = font.getInt32();
- font.getBytes(28);
- var glyphNames;
- var valid = true;
- var i;
- switch (version) {
- case 0x00010000:
- glyphNames = MacStandardGlyphOrdering;
- break;
- case 0x00020000:
- var numGlyphs = font.getUint16();
- if (numGlyphs !== maxpNumGlyphs) {
- valid = false;
- break;
- }
- var glyphNameIndexes = [];
- for (i = 0; i < numGlyphs; ++i) {
- var index = font.getUint16();
- if (index >= 32768) {
- valid = false;
- break;
- }
- glyphNameIndexes.push(index);
- }
- if (!valid) {
- break;
- }
- var customNames = [];
- var strBuf = [];
- while (font.pos < end) {
- var stringLength = font.getByte();
- strBuf.length = stringLength;
- for (i = 0; i < stringLength; ++i) {
- strBuf[i] = String.fromCharCode(font.getByte());
- }
- customNames.push(strBuf.join(''));
- }
- glyphNames = [];
- for (i = 0; i < numGlyphs; ++i) {
- var j = glyphNameIndexes[i];
- if (j < 258) {
- glyphNames.push(MacStandardGlyphOrdering[j]);
- continue;
- }
- glyphNames.push(customNames[j - 258]);
- }
- break;
- case 0x00030000:
- break;
- default:
- (0, _util.warn)('Unknown/unsupported post table version ' + version);
- valid = false;
- if (properties.defaultEncoding) {
- glyphNames = properties.defaultEncoding;
- }
- break;
- }
- properties.glyphNames = glyphNames;
- return valid;
- }
- function readNameTable(nameTable) {
- var start = (font.start ? font.start : 0) + nameTable.offset;
- font.pos = start;
- var names = [[], []];
- var length = nameTable.length,
- end = start + length;
- var format = font.getUint16();
- var FORMAT_0_HEADER_LENGTH = 6;
- if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
- return names;
- }
- var numRecords = font.getUint16();
- var stringsStart = font.getUint16();
- var records = [];
- var NAME_RECORD_LENGTH = 12;
- var i, ii;
- for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
- var r = {
- platform: font.getUint16(),
- encoding: font.getUint16(),
- language: font.getUint16(),
- name: font.getUint16(),
- length: font.getUint16(),
- offset: font.getUint16()
- };
- if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
- records.push(r);
- }
- }
- for (i = 0, ii = records.length; i < ii; i++) {
- var record = records[i];
- if (record.length <= 0) {
- continue;
- }
- var pos = start + stringsStart + record.offset;
- if (pos + record.length > end) {
- continue;
- }
- font.pos = pos;
- var nameIndex = record.name;
- if (record.encoding) {
- var str = '';
- for (var j = 0, jj = record.length; j < jj; j += 2) {
- str += String.fromCharCode(font.getUint16());
- }
- names[1][nameIndex] = str;
- } else {
- names[0][nameIndex] = (0, _util.bytesToString)(font.getBytes(record.length));
- }
- }
- return names;
- }
- var TTOpsStackDeltas = [0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, 1, -1, -999, 0, 1, 0, -1, -2, 0, -1, -2, -1, -1, 0, -1, -1, 0, 0, -999, -999, -1, -1, -1, -1, -2, -999, -2, -2, -999, 0, -2, -2, 0, 0, -2, 0, -2, 0, 0, 0, -2, -1, -1, 1, 1, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, 0, -999, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -999, -999, -999, -999, -999, -1, -1, -2, -2, 0, 0, 0, 0, -1, -1, -999, -2, -2, 0, 0, -1, -2, -2, 0, 0, 0, -1, -1, -1, -2];
- function sanitizeTTProgram(table, ttContext) {
- var data = table.data;
- var i = 0,
- j,
- n,
- b,
- funcId,
- pc,
- lastEndf = 0,
- lastDeff = 0;
- var stack = [];
- var callstack = [];
- var functionsCalled = [];
- var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
- var inFDEF = false,
- ifLevel = 0,
- inELSE = 0;
- for (var ii = data.length; i < ii;) {
- var op = data[i++];
- if (op === 0x40) {
- n = data[i++];
- if (inFDEF || inELSE) {
- i += n;
- } else {
- for (j = 0; j < n; j++) {
- stack.push(data[i++]);
- }
- }
- } else if (op === 0x41) {
- n = data[i++];
- if (inFDEF || inELSE) {
- i += n * 2;
- } else {
- for (j = 0; j < n; j++) {
- b = data[i++];
- stack.push(b << 8 | data[i++]);
- }
- }
- } else if ((op & 0xF8) === 0xB0) {
- n = op - 0xB0 + 1;
- if (inFDEF || inELSE) {
- i += n;
- } else {
- for (j = 0; j < n; j++) {
- stack.push(data[i++]);
- }
- }
- } else if ((op & 0xF8) === 0xB8) {
- n = op - 0xB8 + 1;
- if (inFDEF || inELSE) {
- i += n * 2;
- } else {
- for (j = 0; j < n; j++) {
- b = data[i++];
- stack.push(b << 8 | data[i++]);
- }
- }
- } else if (op === 0x2B && !tooComplexToFollowFunctions) {
- if (!inFDEF && !inELSE) {
- funcId = stack[stack.length - 1];
- if (isNaN(funcId)) {
- (0, _util.info)('TT: CALL empty stack (or invalid entry).');
- } else {
- ttContext.functionsUsed[funcId] = true;
- if (funcId in ttContext.functionsStackDeltas) {
- var newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
- if (newStackLength < 0) {
- (0, _util.warn)('TT: CALL invalid functions stack delta.');
- ttContext.hintsValid = false;
- return;
- }
- stack.length = newStackLength;
- } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
- callstack.push({
- data: data,
- i: i,
- stackTop: stack.length - 1
- });
- functionsCalled.push(funcId);
- pc = ttContext.functionsDefined[funcId];
- if (!pc) {
- (0, _util.warn)('TT: CALL non-existent function');
- ttContext.hintsValid = false;
- return;
- }
- data = pc.data;
- i = pc.i;
- }
- }
- }
- } else if (op === 0x2C && !tooComplexToFollowFunctions) {
- if (inFDEF || inELSE) {
- (0, _util.warn)('TT: nested FDEFs not allowed');
- tooComplexToFollowFunctions = true;
- }
- inFDEF = true;
- lastDeff = i;
- funcId = stack.pop();
- ttContext.functionsDefined[funcId] = {
- data: data,
- i: i
- };
- } else if (op === 0x2D) {
- if (inFDEF) {
- inFDEF = false;
- lastEndf = i;
- } else {
- pc = callstack.pop();
- if (!pc) {
- (0, _util.warn)('TT: ENDF bad stack');
- ttContext.hintsValid = false;
- return;
- }
- funcId = functionsCalled.pop();
- data = pc.data;
- i = pc.i;
- ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
- }
- } else if (op === 0x89) {
- if (inFDEF || inELSE) {
- (0, _util.warn)('TT: nested IDEFs not allowed');
- tooComplexToFollowFunctions = true;
- }
- inFDEF = true;
- lastDeff = i;
- } else if (op === 0x58) {
- ++ifLevel;
- } else if (op === 0x1B) {
- inELSE = ifLevel;
- } else if (op === 0x59) {
- if (inELSE === ifLevel) {
- inELSE = 0;
- }
- --ifLevel;
- } else if (op === 0x1C) {
- if (!inFDEF && !inELSE) {
- var offset = stack[stack.length - 1];
- if (offset > 0) {
- i += offset - 1;
- }
- }
- }
- if (!inFDEF && !inELSE) {
- var stackDelta = op <= 0x8E ? TTOpsStackDeltas[op] : op >= 0xC0 && op <= 0xDF ? -1 : op >= 0xE0 ? -2 : 0;
- if (op >= 0x71 && op <= 0x75) {
- n = stack.pop();
- if (!isNaN(n)) {
- stackDelta = -n * 2;
- }
- }
- while (stackDelta < 0 && stack.length > 0) {
- stack.pop();
- stackDelta++;
- }
- while (stackDelta > 0) {
- stack.push(NaN);
- stackDelta--;
- }
- }
- }
- ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
- var content = [data];
- if (i > data.length) {
- content.push(new Uint8Array(i - data.length));
- }
- if (lastDeff > lastEndf) {
- (0, _util.warn)('TT: complementing a missing function tail');
- content.push(new Uint8Array([0x22, 0x2D]));
- }
- foldTTTable(table, content);
- }
- function checkInvalidFunctions(ttContext, maxFunctionDefs) {
- if (ttContext.tooComplexToFollowFunctions) {
- return;
- }
- if (ttContext.functionsDefined.length > maxFunctionDefs) {
- (0, _util.warn)('TT: more functions defined than expected');
- ttContext.hintsValid = false;
- return;
- }
- for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
- if (j > maxFunctionDefs) {
- (0, _util.warn)('TT: invalid function id: ' + j);
- ttContext.hintsValid = false;
- return;
- }
- if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
- (0, _util.warn)('TT: undefined function: ' + j);
- ttContext.hintsValid = false;
- return;
- }
- }
- }
- function foldTTTable(table, content) {
- if (content.length > 1) {
- var newLength = 0;
- var j, jj;
- for (j = 0, jj = content.length; j < jj; j++) {
- newLength += content[j].length;
- }
- newLength = newLength + 3 & ~3;
- var result = new Uint8Array(newLength);
- var pos = 0;
- for (j = 0, jj = content.length; j < jj; j++) {
- result.set(content[j], pos);
- pos += content[j].length;
- }
- table.data = result;
- table.length = newLength;
- }
- }
- function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
- var ttContext = {
- functionsDefined: [],
- functionsUsed: [],
- functionsStackDeltas: [],
- tooComplexToFollowFunctions: false,
- hintsValid: true
- };
- if (fpgm) {
- sanitizeTTProgram(fpgm, ttContext);
- }
- if (prep) {
- sanitizeTTProgram(prep, ttContext);
- }
- if (fpgm) {
- checkInvalidFunctions(ttContext, maxFunctionDefs);
- }
- if (cvt && cvt.length & 1) {
- var cvtData = new Uint8Array(cvt.length + 1);
- cvtData.set(cvt.data);
- cvt.data = cvtData;
- }
- return ttContext.hintsValid;
- }
- font = new _stream.Stream(new Uint8Array(font.getBytes()));
- var header = void 0,
- tables = void 0;
- if (isTrueTypeCollectionFile(font)) {
- var ttcData = readTrueTypeCollectionData(font, this.name);
- header = ttcData.header;
- tables = ttcData.tables;
- } else {
- header = readOpenTypeHeader(font);
- tables = readTables(font, header.numTables);
- }
- var cff = void 0,
- cffFile = void 0;
- var isTrueType = !tables['CFF '];
- if (!isTrueType) {
- var isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
- if (header.version === 'OTTO' && !isComposite || !tables['head'] || !tables['hhea'] || !tables['maxp'] || !tables['post']) {
- cffFile = new _stream.Stream(tables['CFF '].data);
- cff = new CFFFont(cffFile, properties);
- adjustWidths(properties);
- return this.convert(name, cff, properties);
- }
- delete tables['glyf'];
- delete tables['loca'];
- delete tables['fpgm'];
- delete tables['prep'];
- delete tables['cvt '];
- this.isOpenType = true;
- } else {
- if (!tables['loca']) {
- throw new _util.FormatError('Required "loca" table is not found');
- }
- if (!tables['glyf']) {
- (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
- tables['glyf'] = {
- tag: 'glyf',
- data: new Uint8Array(0)
- };
- }
- this.isOpenType = false;
- }
- if (!tables['maxp']) {
- throw new _util.FormatError('Required "maxp" table is not found');
- }
- font.pos = (font.start || 0) + tables['maxp'].offset;
- var version = font.getInt32();
- var numGlyphs = font.getUint16();
- var numGlyphsOut = numGlyphs + 1;
- var dupFirstEntry = true;
- if (numGlyphsOut > 0xFFFF) {
- dupFirstEntry = false;
- numGlyphsOut = numGlyphs;
- (0, _util.warn)('Not enough space in glyfs to duplicate first glyph.');
- }
- var maxFunctionDefs = 0;
- var maxSizeOfInstructions = 0;
- if (version >= 0x00010000 && tables['maxp'].length >= 22) {
- font.pos += 8;
- var maxZones = font.getUint16();
- if (maxZones > 2) {
- tables['maxp'].data[14] = 0;
- tables['maxp'].data[15] = 2;
- }
- font.pos += 4;
- maxFunctionDefs = font.getUint16();
- font.pos += 4;
- maxSizeOfInstructions = font.getUint16();
- }
- tables['maxp'].data[4] = numGlyphsOut >> 8;
- tables['maxp'].data[5] = numGlyphsOut & 255;
- var hintsValid = sanitizeTTPrograms(tables['fpgm'], tables['prep'], tables['cvt '], maxFunctionDefs);
- if (!hintsValid) {
- delete tables['fpgm'];
- delete tables['prep'];
- delete tables['cvt '];
- }
- sanitizeMetrics(font, tables['hhea'], tables['hmtx'], numGlyphsOut);
- if (!tables['head']) {
- throw new _util.FormatError('Required "head" table is not found');
- }
- sanitizeHead(tables['head'], numGlyphs, isTrueType ? tables['loca'].length : 0);
- var missingGlyphs = Object.create(null);
- if (isTrueType) {
- var isGlyphLocationsLong = int16(tables['head'].data[50], tables['head'].data[51]);
- var glyphsInfo = sanitizeGlyphLocations(tables['loca'], tables['glyf'], numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
- missingGlyphs = glyphsInfo.missingGlyphs;
- if (version >= 0x00010000 && tables['maxp'].length >= 22) {
- tables['maxp'].data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
- tables['maxp'].data[27] = glyphsInfo.maxSizeOfInstructions & 255;
- }
- }
- if (!tables['hhea']) {
- throw new _util.FormatError('Required "hhea" table is not found');
- }
- if (tables['hhea'].data[10] === 0 && tables['hhea'].data[11] === 0) {
- tables['hhea'].data[10] = 0xFF;
- tables['hhea'].data[11] = 0xFF;
- }
- var metricsOverride = {
- unitsPerEm: int16(tables['head'].data[18], tables['head'].data[19]),
- yMax: int16(tables['head'].data[42], tables['head'].data[43]),
- yMin: signedInt16(tables['head'].data[38], tables['head'].data[39]),
- ascent: int16(tables['hhea'].data[4], tables['hhea'].data[5]),
- descent: signedInt16(tables['hhea'].data[6], tables['hhea'].data[7])
- };
- this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
- this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
- if (tables['post']) {
- readPostScriptTable(tables['post'], properties, numGlyphs);
- }
- tables['post'] = {
- tag: 'post',
- data: createPostTable(properties)
- };
- var charCodeToGlyphId = [],
- charCode;
- function hasGlyph(glyphId) {
- return !missingGlyphs[glyphId];
- }
- if (properties.composite) {
- var cidToGidMap = properties.cidToGidMap || [];
- var isCidToGidMapEmpty = cidToGidMap.length === 0;
- properties.cMap.forEach(function (charCode, cid) {
- if (cid > 0xffff) {
- throw new _util.FormatError('Max size of CID is 65,535');
- }
- var glyphId = -1;
- if (isCidToGidMapEmpty) {
- glyphId = cid;
- } else if (cidToGidMap[cid] !== undefined) {
- glyphId = cidToGidMap[cid];
- }
- if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
- charCodeToGlyphId[charCode] = glyphId;
- }
- });
- } else {
- var cmapTable = readCmapTable(tables['cmap'], font, this.isSymbolicFont, properties.hasEncoding);
- var cmapPlatformId = cmapTable.platformId;
- var cmapEncodingId = cmapTable.encodingId;
- var cmapMappings = cmapTable.mappings;
- var cmapMappingsLength = cmapMappings.length;
- if (properties.hasEncoding && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0) || cmapPlatformId === -1 && cmapEncodingId === -1 && !!(0, _encodings.getEncoding)(properties.baseEncodingName)) {
- var baseEncoding = [];
- if (properties.baseEncodingName === 'MacRomanEncoding' || properties.baseEncodingName === 'WinAnsiEncoding') {
- baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
- }
- var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
- for (charCode = 0; charCode < 256; charCode++) {
- var glyphName, standardGlyphName;
- if (this.differences && charCode in this.differences) {
- glyphName = this.differences[charCode];
- } else if (charCode in baseEncoding && baseEncoding[charCode] !== '') {
- glyphName = baseEncoding[charCode];
- } else {
- glyphName = _encodings.StandardEncoding[charCode];
- }
- if (!glyphName) {
- continue;
- }
- standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
- var unicodeOrCharCode;
- if (cmapPlatformId === 3 && cmapEncodingId === 1) {
- unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
- } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
- unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
- }
- var found = false;
- for (var i = 0; i < cmapMappingsLength; ++i) {
- if (cmapMappings[i].charCode !== unicodeOrCharCode) {
- continue;
- }
- charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
- found = true;
- break;
- }
- if (!found && properties.glyphNames) {
- var glyphId = properties.glyphNames.indexOf(glyphName);
- if (glyphId === -1 && standardGlyphName !== glyphName) {
- glyphId = properties.glyphNames.indexOf(standardGlyphName);
- }
- if (glyphId > 0 && hasGlyph(glyphId)) {
- charCodeToGlyphId[charCode] = glyphId;
- }
- }
- }
- } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
- for (var _i = 0; _i < cmapMappingsLength; ++_i) {
- charCodeToGlyphId[cmapMappings[_i].charCode] = cmapMappings[_i].glyphId;
- }
- } else {
- for (var _i2 = 0; _i2 < cmapMappingsLength; ++_i2) {
- charCode = cmapMappings[_i2].charCode;
- if (cmapPlatformId === 3 && charCode >= 0xF000 && charCode <= 0xF0FF) {
- charCode &= 0xFF;
- }
- charCodeToGlyphId[charCode] = cmapMappings[_i2].glyphId;
- }
- }
- }
- if (charCodeToGlyphId.length === 0) {
- charCodeToGlyphId[0] = 0;
- }
- var glyphZeroId = numGlyphsOut - 1;
- if (!dupFirstEntry) {
- glyphZeroId = 0;
- }
- var newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId);
- this.toFontChar = newMapping.toFontChar;
- tables['cmap'] = {
- tag: 'cmap',
- data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphsOut)
- };
- if (!tables['OS/2'] || !validateOS2Table(tables['OS/2'])) {
- tables['OS/2'] = {
- tag: 'OS/2',
- data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
- };
- }
- if (!isTrueType) {
- try {
- cffFile = new _stream.Stream(tables['CFF '].data);
- var parser = new _cff_parser.CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED);
- cff = parser.parse();
- cff.duplicateFirstGlyph();
- var compiler = new _cff_parser.CFFCompiler(cff);
- tables['CFF '].data = compiler.compile();
- } catch (e) {
- (0, _util.warn)('Failed to compile font ' + properties.loadedName);
- }
- }
- if (!tables['name']) {
- tables['name'] = {
- tag: 'name',
- data: createNameTable(this.name)
- };
- } else {
- var namePrototype = readNameTable(tables['name']);
- tables['name'].data = createNameTable(name, namePrototype);
- }
- var builder = new OpenTypeFileBuilder(header.version);
- for (var tableTag in tables) {
- builder.addTable(tableTag, tables[tableTag].data);
- }
- return builder.toArray();
- },
- convert: function Font_convert(fontName, font, properties) {
- properties.fixedPitch = false;
- if (properties.builtInEncoding) {
- adjustToUnicode(properties, properties.builtInEncoding);
- }
- var glyphZeroId = 1;
- if (font instanceof CFFFont) {
- glyphZeroId = font.numGlyphs - 1;
- }
- var mapping = font.getGlyphMapping(properties);
- var newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId);
- this.toFontChar = newMapping.toFontChar;
- var numGlyphs = font.numGlyphs;
- function getCharCodes(charCodeToGlyphId, glyphId) {
- var charCodes = null;
- for (var charCode in charCodeToGlyphId) {
- if (glyphId === charCodeToGlyphId[charCode]) {
- if (!charCodes) {
- charCodes = [];
- }
- charCodes.push(charCode | 0);
- }
- }
- return charCodes;
- }
- function createCharCode(charCodeToGlyphId, glyphId) {
- for (var charCode in charCodeToGlyphId) {
- if (glyphId === charCodeToGlyphId[charCode]) {
- return charCode | 0;
- }
- }
- newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
- return newMapping.nextAvailableFontCharCode++;
- }
- var seacs = font.seacs;
- if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
- var matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
- var charset = font.getCharset();
- var seacMap = Object.create(null);
- for (var glyphId in seacs) {
- glyphId |= 0;
- var seac = seacs[glyphId];
- var baseGlyphName = _encodings.StandardEncoding[seac[2]];
- var accentGlyphName = _encodings.StandardEncoding[seac[3]];
- var baseGlyphId = charset.indexOf(baseGlyphName);
- var accentGlyphId = charset.indexOf(accentGlyphName);
- if (baseGlyphId < 0 || accentGlyphId < 0) {
- continue;
- }
- var accentOffset = {
- x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
- y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
- };
- var charCodes = getCharCodes(mapping, glyphId);
- if (!charCodes) {
- continue;
- }
- for (var i = 0, ii = charCodes.length; i < ii; i++) {
- var charCode = charCodes[i];
- var charCodeToGlyphId = newMapping.charCodeToGlyphId;
- var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
- var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
- seacMap[charCode] = {
- baseFontCharCode: baseFontCharCode,
- accentFontCharCode: accentFontCharCode,
- accentOffset: accentOffset
- };
- }
- }
- properties.seacMap = seacMap;
- }
- var unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
- var builder = new OpenTypeFileBuilder('\x4F\x54\x54\x4F');
- builder.addTable('CFF ', font.data);
- builder.addTable('OS/2', createOS2Table(properties, newMapping.charCodeToGlyphId));
- builder.addTable('cmap', createCmapTable(newMapping.charCodeToGlyphId, numGlyphs));
- builder.addTable('head', '\x00\x01\x00\x00' + '\x00\x00\x10\x00' + '\x00\x00\x00\x00' + '\x5F\x0F\x3C\xF5' + '\x00\x00' + safeString16(unitsPerEm) + '\x00\x00\x00\x00\x9e\x0b\x7e\x27' + '\x00\x00\x00\x00\x9e\x0b\x7e\x27' + '\x00\x00' + safeString16(properties.descent) + '\x0F\xFF' + safeString16(properties.ascent) + string16(properties.italicAngle ? 2 : 0) + '\x00\x11' + '\x00\x00' + '\x00\x00' + '\x00\x00');
- builder.addTable('hhea', '\x00\x01\x00\x00' + safeString16(properties.ascent) + safeString16(properties.descent) + '\x00\x00' + '\xFF\xFF' + '\x00\x00' + '\x00\x00' + '\x00\x00' + safeString16(properties.capHeight) + safeString16(Math.tan(properties.italicAngle) * properties.xHeight) + '\x00\x00' + '\x00\x00' + '\x00\x00' + '\x00\x00' + '\x00\x00' + '\x00\x00' + string16(numGlyphs));
- builder.addTable('hmtx', function fontFieldsHmtx() {
- var charstrings = font.charstrings;
- var cffWidths = font.cff ? font.cff.widths : null;
- var hmtx = '\x00\x00\x00\x00';
- for (var i = 1, ii = numGlyphs; i < ii; i++) {
- var width = 0;
- if (charstrings) {
- var charstring = charstrings[i - 1];
- width = 'width' in charstring ? charstring.width : 0;
- } else if (cffWidths) {
- width = Math.ceil(cffWidths[i] || 0);
- }
- hmtx += string16(width) + string16(0);
- }
- return hmtx;
- }());
- builder.addTable('maxp', '\x00\x00\x50\x00' + string16(numGlyphs));
- builder.addTable('name', createNameTable(fontName));
- builder.addTable('post', createPostTable(properties));
- return builder.toArray();
- },
- get spaceWidth() {
- if ('_shadowWidth' in this) {
- return this._shadowWidth;
- }
- var possibleSpaceReplacements = ['space', 'minus', 'one', 'i', 'I'];
- var width;
- for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
- var glyphName = possibleSpaceReplacements[i];
- if (glyphName in this.widths) {
- width = this.widths[glyphName];
- break;
- }
- var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
- var glyphUnicode = glyphsUnicodeMap[glyphName];
- var charcode = 0;
- if (this.composite) {
- if (this.cMap.contains(glyphUnicode)) {
- charcode = this.cMap.lookup(glyphUnicode);
- }
- }
- if (!charcode && this.toUnicode) {
- charcode = this.toUnicode.charCodeOf(glyphUnicode);
- }
- if (charcode <= 0) {
- charcode = glyphUnicode;
- }
- width = this.widths[charcode];
- if (width) {
- break;
- }
- }
- width = width || this.defaultWidth;
- this._shadowWidth = width;
- return width;
- },
- charToGlyph: function Font_charToGlyph(charcode, isSpace) {
- var fontCharCode, width, operatorListId;
- var widthCode = charcode;
- if (this.cMap && this.cMap.contains(charcode)) {
- widthCode = this.cMap.lookup(charcode);
- }
- width = this.widths[widthCode];
- width = (0, _util.isNum)(width) ? width : this.defaultWidth;
- var vmetric = this.vmetrics && this.vmetrics[widthCode];
- var unicode = this.toUnicode.get(charcode) || this.fallbackToUnicode.get(charcode) || charcode;
- if (typeof unicode === 'number') {
- unicode = String.fromCharCode(unicode);
- }
- var isInFont = charcode in this.toFontChar;
- fontCharCode = this.toFontChar[charcode] || charcode;
- if (this.missingFile) {
- fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
- }
- if (this.isType3Font) {
- operatorListId = fontCharCode;
- }
- var accent = null;
- if (this.seacMap && this.seacMap[charcode]) {
- isInFont = true;
- var seac = this.seacMap[charcode];
- fontCharCode = seac.baseFontCharCode;
- accent = {
- fontChar: String.fromCodePoint(seac.accentFontCharCode),
- offset: seac.accentOffset
- };
- }
- var fontChar = typeof fontCharCode === 'number' ? String.fromCodePoint(fontCharCode) : '';
- var glyph = this.glyphCache[charcode];
- if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
- glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
- this.glyphCache[charcode] = glyph;
- }
- return glyph;
- },
- charsToGlyphs: function Font_charsToGlyphs(chars) {
- var charsCache = this.charsCache;
- var glyphs, glyph, charcode;
- if (charsCache) {
- glyphs = charsCache[chars];
- if (glyphs) {
- return glyphs;
- }
- }
- if (!charsCache) {
- charsCache = this.charsCache = Object.create(null);
- }
- glyphs = [];
- var charsCacheKey = chars;
- var i = 0,
- ii;
- if (this.cMap) {
- var c = Object.create(null);
- while (i < chars.length) {
- this.cMap.readCharCode(chars, i, c);
- charcode = c.charcode;
- var length = c.length;
- i += length;
- var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20;
- glyph = this.charToGlyph(charcode, isSpace);
- glyphs.push(glyph);
- }
- } else {
- for (i = 0, ii = chars.length; i < ii; ++i) {
- charcode = chars.charCodeAt(i);
- glyph = this.charToGlyph(charcode, charcode === 0x20);
- glyphs.push(glyph);
- }
- }
- return charsCache[charsCacheKey] = glyphs;
- }
- };
- return Font;
-}();
-var ErrorFont = function ErrorFontClosure() {
- function ErrorFont(error) {
- this.error = error;
- this.loadedName = 'g_font_error';
- this.missingFile = true;
- }
- ErrorFont.prototype = {
- charsToGlyphs: function ErrorFont_charsToGlyphs() {
- return [];
- },
- exportData: function ErrorFont_exportData() {
- return { error: this.error };
- }
- };
- return ErrorFont;
-}();
-function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
- var charCodeToGlyphId = Object.create(null);
- var glyphId, charCode, baseEncoding;
- var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
- if (properties.baseEncodingName) {
- baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
- for (charCode = 0; charCode < baseEncoding.length; charCode++) {
- glyphId = glyphNames.indexOf(baseEncoding[charCode]);
- if (glyphId >= 0) {
- charCodeToGlyphId[charCode] = glyphId;
- } else {
- charCodeToGlyphId[charCode] = 0;
- }
- }
- } else if (isSymbolicFont) {
- for (charCode in builtInEncoding) {
- charCodeToGlyphId[charCode] = builtInEncoding[charCode];
- }
- } else {
- baseEncoding = _encodings.StandardEncoding;
- for (charCode = 0; charCode < baseEncoding.length; charCode++) {
- glyphId = glyphNames.indexOf(baseEncoding[charCode]);
- if (glyphId >= 0) {
- charCodeToGlyphId[charCode] = glyphId;
- } else {
- charCodeToGlyphId[charCode] = 0;
- }
- }
- }
- var differences = properties.differences,
- glyphsUnicodeMap;
- if (differences) {
- for (charCode in differences) {
- var glyphName = differences[charCode];
- glyphId = glyphNames.indexOf(glyphName);
- if (glyphId === -1) {
- if (!glyphsUnicodeMap) {
- glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
- }
- var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
- if (standardGlyphName !== glyphName) {
- glyphId = glyphNames.indexOf(standardGlyphName);
- }
- }
- if (glyphId >= 0) {
- charCodeToGlyphId[charCode] = glyphId;
- } else {
- charCodeToGlyphId[charCode] = 0;
- }
- }
- }
- return charCodeToGlyphId;
-}
-var Type1Font = function Type1FontClosure() {
- function findBlock(streamBytes, signature, startIndex) {
- var streamBytesLength = streamBytes.length;
- var signatureLength = signature.length;
- var scanLength = streamBytesLength - signatureLength;
- var i = startIndex,
- j,
- found = false;
- while (i < scanLength) {
- j = 0;
- while (j < signatureLength && streamBytes[i + j] === signature[j]) {
- j++;
- }
- if (j >= signatureLength) {
- i += j;
- while (i < streamBytesLength && (0, _util.isSpace)(streamBytes[i])) {
- i++;
- }
- found = true;
- break;
- }
- i++;
- }
- return {
- found: found,
- length: i
- };
- }
- function getHeaderBlock(stream, suggestedLength) {
- var EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
- var streamStartPos = stream.pos;
- var headerBytes, headerBytesLength, block;
- try {
- headerBytes = stream.getBytes(suggestedLength);
- headerBytesLength = headerBytes.length;
- } catch (ex) {
- if (ex instanceof _util.MissingDataException) {
- throw ex;
- }
- }
- if (headerBytesLength === suggestedLength) {
- block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
- if (block.found && block.length === suggestedLength) {
- return {
- stream: new _stream.Stream(headerBytes),
- length: suggestedLength
- };
- }
- }
- (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
- stream.pos = streamStartPos;
- var SCAN_BLOCK_LENGTH = 2048;
- var actualLength;
- while (true) {
- var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
- block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
- if (block.length === 0) {
- break;
- }
- stream.pos += block.length;
- if (block.found) {
- actualLength = stream.pos - streamStartPos;
- break;
- }
- }
- stream.pos = streamStartPos;
- if (actualLength) {
- return {
- stream: new _stream.Stream(stream.getBytes(actualLength)),
- length: actualLength
- };
- }
- (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
- return {
- stream: new _stream.Stream(stream.getBytes(suggestedLength)),
- length: suggestedLength
- };
- }
- function getEexecBlock(stream, suggestedLength) {
- var eexecBytes = stream.getBytes();
- return {
- stream: new _stream.Stream(eexecBytes),
- length: eexecBytes.length
- };
- }
- function Type1Font(name, file, properties) {
- var PFB_HEADER_SIZE = 6;
- var headerBlockLength = properties.length1;
- var eexecBlockLength = properties.length2;
- var pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
- var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
- if (pfbHeaderPresent) {
- file.skip(PFB_HEADER_SIZE);
- headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
- }
- var headerBlock = getHeaderBlock(file, headerBlockLength);
- var headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
- headerBlockParser.extractFontHeader(properties);
- if (pfbHeaderPresent) {
- pfbHeader = file.getBytes(PFB_HEADER_SIZE);
- eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
- }
- var eexecBlock = getEexecBlock(file, eexecBlockLength);
- var eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
- var data = eexecBlockParser.extractFontProgram();
- for (var info in data.properties) {
- properties[info] = data.properties[info];
- }
- var charstrings = data.charstrings;
- var type2Charstrings = this.getType2Charstrings(charstrings);
- var subrs = this.getType2Subrs(data.subrs);
- this.charstrings = charstrings;
- this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
- this.seacs = this.getSeacs(data.charstrings);
- }
- Type1Font.prototype = {
- get numGlyphs() {
- return this.charstrings.length + 1;
- },
- getCharset: function Type1Font_getCharset() {
- var charset = ['.notdef'];
- var charstrings = this.charstrings;
- for (var glyphId = 0; glyphId < charstrings.length; glyphId++) {
- charset.push(charstrings[glyphId].glyphName);
- }
- return charset;
- },
- getGlyphMapping: function Type1Font_getGlyphMapping(properties) {
- var charstrings = this.charstrings;
- var glyphNames = ['.notdef'],
- glyphId;
- for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
- glyphNames.push(charstrings[glyphId].glyphName);
- }
- var encoding = properties.builtInEncoding;
- if (encoding) {
- var builtInEncoding = Object.create(null);
- for (var charCode in encoding) {
- glyphId = glyphNames.indexOf(encoding[charCode]);
- if (glyphId >= 0) {
- builtInEncoding[charCode] = glyphId;
- }
- }
- }
- return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
- },
- hasGlyphId: function Type1Font_hasGlyphID(id) {
- if (id < 0 || id >= this.numGlyphs) {
- return false;
- }
- if (id === 0) {
- return true;
- }
- var glyph = this.charstrings[id - 1];
- return glyph.charstring.length > 0;
- },
- getSeacs: function Type1Font_getSeacs(charstrings) {
- var i, ii;
- var seacMap = [];
- for (i = 0, ii = charstrings.length; i < ii; i++) {
- var charstring = charstrings[i];
- if (charstring.seac) {
- seacMap[i + 1] = charstring.seac;
- }
- }
- return seacMap;
- },
- getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) {
- var type2Charstrings = [];
- for (var i = 0, ii = type1Charstrings.length; i < ii; i++) {
- type2Charstrings.push(type1Charstrings[i].charstring);
- }
- return type2Charstrings;
- },
- getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) {
- var bias = 0;
- var count = type1Subrs.length;
- if (count < 1133) {
- bias = 107;
- } else if (count < 33769) {
- bias = 1131;
- } else {
- bias = 32768;
- }
- var type2Subrs = [];
- var i;
- for (i = 0; i < bias; i++) {
- type2Subrs.push([0x0B]);
- }
- for (i = 0; i < count; i++) {
- type2Subrs.push(type1Subrs[i]);
- }
- return type2Subrs;
- },
- wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
- var cff = new _cff_parser.CFF();
- cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
- cff.names = [name];
- var topDict = new _cff_parser.CFFTopDict();
- topDict.setByName('version', 391);
- topDict.setByName('Notice', 392);
- topDict.setByName('FullName', 393);
- topDict.setByName('FamilyName', 394);
- topDict.setByName('Weight', 395);
- topDict.setByName('Encoding', null);
- topDict.setByName('FontMatrix', properties.fontMatrix);
- topDict.setByName('FontBBox', properties.bbox);
- topDict.setByName('charset', null);
- topDict.setByName('CharStrings', null);
- topDict.setByName('Private', null);
- cff.topDict = topDict;
- var strings = new _cff_parser.CFFStrings();
- strings.add('Version 0.11');
- strings.add('See original notice');
- strings.add(name);
- strings.add(name);
- strings.add('Medium');
- cff.strings = strings;
- cff.globalSubrIndex = new _cff_parser.CFFIndex();
- var count = glyphs.length;
- var charsetArray = [0];
- var i, ii;
- for (i = 0; i < count; i++) {
- var index = _cff_parser.CFFStandardStrings.indexOf(charstrings[i].glyphName);
- if (index === -1) {
- index = 0;
- }
- charsetArray.push(index >> 8 & 0xff, index & 0xff);
- }
- cff.charset = new _cff_parser.CFFCharset(false, 0, [], charsetArray);
- var charStringsIndex = new _cff_parser.CFFIndex();
- charStringsIndex.add([0x8B, 0x0E]);
- for (i = 0; i < count; i++) {
- charStringsIndex.add(glyphs[i]);
- }
- cff.charStrings = charStringsIndex;
- var privateDict = new _cff_parser.CFFPrivateDict();
- privateDict.setByName('Subrs', null);
- var fields = ['BlueValues', 'OtherBlues', 'FamilyBlues', 'FamilyOtherBlues', 'StemSnapH', 'StemSnapV', 'BlueShift', 'BlueFuzz', 'BlueScale', 'LanguageGroup', 'ExpansionFactor', 'ForceBold', 'StdHW', 'StdVW'];
- for (i = 0, ii = fields.length; i < ii; i++) {
- var field = fields[i];
- if (!(field in properties.privateData)) {
- continue;
- }
- var value = properties.privateData[field];
- if (Array.isArray(value)) {
- for (var j = value.length - 1; j > 0; j--) {
- value[j] -= value[j - 1];
- }
- }
- privateDict.setByName(field, value);
- }
- cff.topDict.privateDict = privateDict;
- var subrIndex = new _cff_parser.CFFIndex();
- for (i = 0, ii = subrs.length; i < ii; i++) {
- subrIndex.add(subrs[i]);
- }
- privateDict.subrsIndex = subrIndex;
- var compiler = new _cff_parser.CFFCompiler(cff);
- return compiler.compile();
- }
- };
- return Type1Font;
-}();
-var CFFFont = function CFFFontClosure() {
- function CFFFont(file, properties) {
- this.properties = properties;
- var parser = new _cff_parser.CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
- this.cff = parser.parse();
- this.cff.duplicateFirstGlyph();
- var compiler = new _cff_parser.CFFCompiler(this.cff);
- this.seacs = this.cff.seacs;
- try {
- this.data = compiler.compile();
- } catch (e) {
- (0, _util.warn)('Failed to compile font ' + properties.loadedName);
- this.data = file;
- }
- }
- CFFFont.prototype = {
- get numGlyphs() {
- return this.cff.charStrings.count;
- },
- getCharset: function CFFFont_getCharset() {
- return this.cff.charset.charset;
- },
- getGlyphMapping: function CFFFont_getGlyphMapping() {
- var cff = this.cff;
- var properties = this.properties;
- var charsets = cff.charset.charset;
- var charCodeToGlyphId;
- var glyphId;
- if (properties.composite) {
- charCodeToGlyphId = Object.create(null);
- if (cff.isCIDFont) {
- for (glyphId = 0; glyphId < charsets.length; glyphId++) {
- var cid = charsets[glyphId];
- var charCode = properties.cMap.charCodeOf(cid);
- charCodeToGlyphId[charCode] = glyphId;
- }
- } else {
- for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
- charCodeToGlyphId[glyphId] = glyphId;
- }
- }
- return charCodeToGlyphId;
- }
- var encoding = cff.encoding ? cff.encoding.encoding : null;
- charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
- return charCodeToGlyphId;
- },
- hasGlyphId: function CFFFont_hasGlyphID(id) {
- return this.cff.hasGlyphId(id);
- }
- };
- return CFFFont;
-}();
-exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
-exports.ErrorFont = ErrorFont;
-exports.Font = Font;
-exports.FontFlags = FontFlags;
-exports.ToUnicodeMap = ToUnicodeMap;
-exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
-exports.getFontType = getFontType;
-
-/***/ }),
-/* 157 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.CFFFDSelect = exports.CFFCompiler = exports.CFFPrivateDict = exports.CFFTopDict = exports.CFFCharset = exports.CFFIndex = exports.CFFStrings = exports.CFFHeader = exports.CFF = exports.CFFParser = exports.CFFStandardStrings = undefined;
-
-var _util = __w_pdfjs_require__(2);
-
-var _charsets = __w_pdfjs_require__(158);
-
-var _encodings = __w_pdfjs_require__(159);
-
-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'];
-var CFFParser = function CFFParserClosure() {
- var CharstringValidationData = [null, {
- id: 'hstem',
- min: 2,
- stackClearing: true,
- stem: true
- }, null, {
- id: 'vstem',
- min: 2,
- stackClearing: true,
- stem: true
- }, {
- id: 'vmoveto',
- min: 1,
- stackClearing: true
- }, {
- id: 'rlineto',
- min: 2,
- resetStack: true
- }, {
- id: 'hlineto',
- min: 1,
- resetStack: true
- }, {
- id: 'vlineto',
- min: 1,
- resetStack: true
- }, {
- id: 'rrcurveto',
- min: 6,
- resetStack: true
- }, null, {
- id: 'callsubr',
- min: 1,
- undefStack: true
- }, {
- id: 'return',
- min: 0,
- undefStack: true
- }, null, null, {
- id: 'endchar',
- min: 0,
- stackClearing: true
- }, null, null, null, {
- id: 'hstemhm',
- min: 2,
- stackClearing: true,
- stem: true
- }, {
- id: 'hintmask',
- min: 0,
- stackClearing: true
- }, {
- id: 'cntrmask',
- min: 0,
- stackClearing: true
- }, {
- id: 'rmoveto',
- min: 2,
- stackClearing: true
- }, {
- id: 'hmoveto',
- min: 1,
- stackClearing: true
- }, {
- id: 'vstemhm',
- min: 2,
- stackClearing: true,
- stem: true
- }, {
- id: 'rcurveline',
- min: 8,
- resetStack: true
- }, {
- id: 'rlinecurve',
- min: 8,
- resetStack: true
- }, {
- id: 'vvcurveto',
- min: 4,
- resetStack: true
- }, {
- id: 'hhcurveto',
- min: 4,
- resetStack: true
- }, null, {
- id: 'callgsubr',
- min: 1,
- undefStack: true
- }, {
- id: 'vhcurveto',
- min: 4,
- resetStack: true
- }, {
- id: 'hvcurveto',
- min: 4,
- resetStack: true
- }];
- var CharstringValidationData12 = [null, null, null, {
- id: 'and',
- min: 2,
- stackDelta: -1
- }, {
- id: 'or',
- min: 2,
- stackDelta: -1
- }, {
- id: 'not',
- min: 1,
- stackDelta: 0
- }, null, null, null, {
- id: 'abs',
- min: 1,
- stackDelta: 0
- }, {
- id: 'add',
- min: 2,
- stackDelta: -1,
- stackFn: function stack_div(stack, index) {
- stack[index - 2] = stack[index - 2] + stack[index - 1];
- }
- }, {
- id: 'sub',
- min: 2,
- stackDelta: -1,
- stackFn: function stack_div(stack, index) {
- stack[index - 2] = stack[index - 2] - stack[index - 1];
- }
- }, {
- id: 'div',
- min: 2,
- stackDelta: -1,
- stackFn: function stack_div(stack, index) {
- stack[index - 2] = stack[index - 2] / stack[index - 1];
- }
- }, null, {
- id: 'neg',
- min: 1,
- stackDelta: 0,
- stackFn: function stack_div(stack, index) {
- stack[index - 1] = -stack[index - 1];
- }
- }, {
- id: 'eq',
- min: 2,
- stackDelta: -1
- }, null, null, {
- id: 'drop',
- min: 1,
- stackDelta: -1
- }, null, {
- id: 'put',
- min: 2,
- stackDelta: -2
- }, {
- id: 'get',
- min: 1,
- stackDelta: 0
- }, {
- id: 'ifelse',
- min: 4,
- stackDelta: -3
- }, {
- id: 'random',
- min: 0,
- stackDelta: 1
- }, {
- id: 'mul',
- min: 2,
- stackDelta: -1,
- stackFn: function stack_div(stack, index) {
- stack[index - 2] = stack[index - 2] * stack[index - 1];
- }
- }, null, {
- id: 'sqrt',
- min: 1,
- stackDelta: 0
- }, {
- id: 'dup',
- min: 1,
- stackDelta: 1
- }, {
- id: 'exch',
- min: 2,
- stackDelta: 0
- }, {
- id: 'index',
- min: 2,
- stackDelta: 0
- }, {
- id: 'roll',
- min: 3,
- stackDelta: -2
- }, null, null, null, {
- id: 'hflex',
- min: 7,
- resetStack: true
- }, {
- id: 'flex',
- min: 13,
- resetStack: true
- }, {
- id: 'hflex1',
- min: 9,
- resetStack: true
- }, {
- id: 'flex1',
- min: 11,
- resetStack: true
- }];
- function CFFParser(file, properties, seacAnalysisEnabled) {
- this.bytes = file.getBytes();
- this.properties = properties;
- this.seacAnalysisEnabled = !!seacAnalysisEnabled;
- }
- CFFParser.prototype = {
- parse: function CFFParser_parse() {
- var properties = this.properties;
- var cff = new CFF();
- this.cff = cff;
- var header = this.parseHeader();
- var nameIndex = this.parseIndex(header.endPos);
- var topDictIndex = this.parseIndex(nameIndex.endPos);
- var stringIndex = this.parseIndex(topDictIndex.endPos);
- var globalSubrIndex = this.parseIndex(stringIndex.endPos);
- var topDictParsed = this.parseDict(topDictIndex.obj.get(0));
- var topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
- cff.header = header.obj;
- cff.names = this.parseNameIndex(nameIndex.obj);
- cff.strings = this.parseStringIndex(stringIndex.obj);
- cff.topDict = topDict;
- cff.globalSubrIndex = globalSubrIndex.obj;
- this.parsePrivateDict(cff.topDict);
- cff.isCIDFont = topDict.hasName('ROS');
- var charStringOffset = topDict.getByName('CharStrings');
- var charStringIndex = this.parseIndex(charStringOffset).obj;
- var fontMatrix = topDict.getByName('FontMatrix');
- if (fontMatrix) {
- properties.fontMatrix = fontMatrix;
- }
- var fontBBox = topDict.getByName('FontBBox');
- if (fontBBox) {
- properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
- properties.descent = Math.min(fontBBox[1], fontBBox[3]);
- properties.ascentScaled = true;
- }
- var charset, encoding;
- if (cff.isCIDFont) {
- var fdArrayIndex = this.parseIndex(topDict.getByName('FDArray')).obj;
- for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
- var dictRaw = fdArrayIndex.get(i);
- var fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
- this.parsePrivateDict(fontDict);
- cff.fdArray.push(fontDict);
- }
- encoding = null;
- charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, true);
- cff.fdSelect = this.parseFDSelect(topDict.getByName('FDSelect'), charStringIndex.count);
- } else {
- charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, false);
- encoding = this.parseEncoding(topDict.getByName('Encoding'), properties, cff.strings, charset.charset);
- }
- cff.charset = charset;
- cff.encoding = encoding;
- var charStringsAndSeacs = this.parseCharStrings({
- charStrings: charStringIndex,
- localSubrIndex: topDict.privateDict.subrsIndex,
- globalSubrIndex: globalSubrIndex.obj,
- fdSelect: cff.fdSelect,
- fdArray: cff.fdArray,
- privateDict: topDict.privateDict
- });
- cff.charStrings = charStringsAndSeacs.charStrings;
- cff.seacs = charStringsAndSeacs.seacs;
- cff.widths = charStringsAndSeacs.widths;
- return cff;
- },
- parseHeader: function CFFParser_parseHeader() {
- var bytes = this.bytes;
- var bytesLength = bytes.length;
- var offset = 0;
- while (offset < bytesLength && bytes[offset] !== 1) {
- ++offset;
- }
- if (offset >= bytesLength) {
- throw new _util.FormatError('Invalid CFF header');
- }
- if (offset !== 0) {
- (0, _util.info)('cff data is shifted');
- bytes = bytes.subarray(offset);
- this.bytes = bytes;
- }
- var major = bytes[0];
- var minor = bytes[1];
- var hdrSize = bytes[2];
- var offSize = bytes[3];
- var header = new CFFHeader(major, minor, hdrSize, offSize);
- return {
- obj: header,
- endPos: hdrSize
- };
- },
- parseDict: function CFFParser_parseDict(dict) {
- var pos = 0;
- function parseOperand() {
- var value = dict[pos++];
- if (value === 30) {
- return parseFloatOperand();
- } else if (value === 28) {
- value = dict[pos++];
- value = (value << 24 | dict[pos++] << 16) >> 16;
- return value;
- } else if (value === 29) {
- value = dict[pos++];
- value = value << 8 | dict[pos++];
- value = value << 8 | dict[pos++];
- value = value << 8 | dict[pos++];
- return value;
- } else if (value >= 32 && value <= 246) {
- return value - 139;
- } else if (value >= 247 && value <= 250) {
- return (value - 247) * 256 + dict[pos++] + 108;
- } else if (value >= 251 && value <= 254) {
- return -((value - 251) * 256) - dict[pos++] - 108;
- }
- (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
- return NaN;
- }
- function parseFloatOperand() {
- var str = '';
- var eof = 15;
- var lookup = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', 'E', 'E-', null, '-'];
- var length = dict.length;
- while (pos < length) {
- var b = dict[pos++];
- var b1 = b >> 4;
- var b2 = b & 15;
- if (b1 === eof) {
- break;
- }
- str += lookup[b1];
- if (b2 === eof) {
- break;
- }
- str += lookup[b2];
- }
- return parseFloat(str);
- }
- var operands = [];
- var entries = [];
- pos = 0;
- var end = dict.length;
- while (pos < end) {
- var b = dict[pos];
- if (b <= 21) {
- if (b === 12) {
- b = b << 8 | dict[++pos];
- }
- entries.push([b, operands]);
- operands = [];
- ++pos;
- } else {
- operands.push(parseOperand());
- }
- }
- return entries;
- },
- parseIndex: function CFFParser_parseIndex(pos) {
- var cffIndex = new CFFIndex();
- var bytes = this.bytes;
- var count = bytes[pos++] << 8 | bytes[pos++];
- var offsets = [];
- var end = pos;
- var i, ii;
- if (count !== 0) {
- var offsetSize = bytes[pos++];
- var startPos = pos + (count + 1) * offsetSize - 1;
- for (i = 0, ii = count + 1; i < ii; ++i) {
- var offset = 0;
- for (var j = 0; j < offsetSize; ++j) {
- offset <<= 8;
- offset += bytes[pos++];
- }
- offsets.push(startPos + offset);
- }
- end = offsets[count];
- }
- for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
- var offsetStart = offsets[i];
- var offsetEnd = offsets[i + 1];
- cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
- }
- return {
- obj: cffIndex,
- endPos: end
- };
- },
- parseNameIndex: function CFFParser_parseNameIndex(index) {
- var names = [];
- for (var i = 0, ii = index.count; i < ii; ++i) {
- var name = index.get(i);
- names.push((0, _util.bytesToString)(name));
- }
- return names;
- },
- parseStringIndex: function CFFParser_parseStringIndex(index) {
- var strings = new CFFStrings();
- for (var i = 0, ii = index.count; i < ii; ++i) {
- var data = index.get(i);
- strings.add((0, _util.bytesToString)(data));
- }
- return strings;
- },
- createDict: function CFFParser_createDict(Type, dict, strings) {
- var cffDict = new Type(strings);
- for (var i = 0, ii = dict.length; i < ii; ++i) {
- var pair = dict[i];
- var key = pair[0];
- var value = pair[1];
- cffDict.setByKey(key, value);
- }
- return cffDict;
- },
- parseCharString: function CFFParser_parseCharString(state, data, localSubrIndex, globalSubrIndex) {
- if (!data || state.callDepth > MAX_SUBR_NESTING) {
- return false;
- }
- var stackSize = state.stackSize;
- var stack = state.stack;
- var length = data.length;
- for (var j = 0; j < length;) {
- var value = data[j++];
- var validationCommand = null;
- if (value === 12) {
- var q = data[j++];
- if (q === 0) {
- data[j - 2] = 139;
- data[j - 1] = 22;
- stackSize = 0;
- } else {
- validationCommand = CharstringValidationData12[q];
- }
- } else if (value === 28) {
- stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
- j += 2;
- stackSize++;
- } else if (value === 14) {
- if (stackSize >= 4) {
- stackSize -= 4;
- if (this.seacAnalysisEnabled) {
- state.seac = stack.slice(stackSize, stackSize + 4);
- return false;
- }
- }
- validationCommand = CharstringValidationData[value];
- } else if (value >= 32 && value <= 246) {
- stack[stackSize] = value - 139;
- stackSize++;
- } else if (value >= 247 && value <= 254) {
- stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
- j++;
- stackSize++;
- } else if (value === 255) {
- stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
- j += 4;
- stackSize++;
- } else if (value === 19 || value === 20) {
- state.hints += stackSize >> 1;
- j += state.hints + 7 >> 3;
- stackSize %= 2;
- validationCommand = CharstringValidationData[value];
- } else if (value === 10 || value === 29) {
- var subrsIndex;
- if (value === 10) {
- subrsIndex = localSubrIndex;
- } else {
- subrsIndex = globalSubrIndex;
- }
- if (!subrsIndex) {
- validationCommand = CharstringValidationData[value];
- (0, _util.warn)('Missing subrsIndex for ' + validationCommand.id);
- return false;
- }
- var bias = 32768;
- if (subrsIndex.count < 1240) {
- bias = 107;
- } else if (subrsIndex.count < 33900) {
- bias = 1131;
- }
- var subrNumber = stack[--stackSize] + bias;
- if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
- validationCommand = CharstringValidationData[value];
- (0, _util.warn)('Out of bounds subrIndex for ' + validationCommand.id);
- return false;
- }
- state.stackSize = stackSize;
- state.callDepth++;
- var valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
- if (!valid) {
- return false;
- }
- state.callDepth--;
- stackSize = state.stackSize;
- continue;
- } else if (value === 11) {
- state.stackSize = stackSize;
- return true;
- } else {
- validationCommand = CharstringValidationData[value];
- }
- if (validationCommand) {
- if (validationCommand.stem) {
- state.hints += stackSize >> 1;
- }
- if ('min' in validationCommand) {
- if (!state.undefStack && stackSize < validationCommand.min) {
- (0, _util.warn)('Not enough parameters for ' + validationCommand.id + '; actual: ' + stackSize + ', expected: ' + validationCommand.min);
- return false;
- }
- }
- if (state.firstStackClearing && validationCommand.stackClearing) {
- state.firstStackClearing = false;
- stackSize -= validationCommand.min;
- if (stackSize >= 2 && validationCommand.stem) {
- stackSize %= 2;
- } else if (stackSize > 1) {
- (0, _util.warn)('Found too many parameters for stack-clearing command');
- }
- if (stackSize > 0 && stack[stackSize - 1] >= 0) {
- state.width = stack[stackSize - 1];
- }
- }
- if ('stackDelta' in validationCommand) {
- if ('stackFn' in validationCommand) {
- validationCommand.stackFn(stack, stackSize);
- }
- stackSize += validationCommand.stackDelta;
- } else if (validationCommand.stackClearing) {
- stackSize = 0;
- } else if (validationCommand.resetStack) {
- stackSize = 0;
- state.undefStack = false;
- } else if (validationCommand.undefStack) {
- stackSize = 0;
- state.undefStack = true;
- state.firstStackClearing = false;
- }
- }
- }
- state.stackSize = stackSize;
- return true;
- },
- parseCharStrings: function parseCharStrings(_ref) {
- var charStrings = _ref.charStrings,
- localSubrIndex = _ref.localSubrIndex,
- globalSubrIndex = _ref.globalSubrIndex,
- fdSelect = _ref.fdSelect,
- fdArray = _ref.fdArray,
- privateDict = _ref.privateDict;
-
- var seacs = [];
- var widths = [];
- var count = charStrings.count;
- for (var i = 0; i < count; i++) {
- var charstring = charStrings.get(i);
- var state = {
- callDepth: 0,
- stackSize: 0,
- stack: [],
- undefStack: true,
- hints: 0,
- firstStackClearing: true,
- seac: null,
- width: null
- };
- var valid = true;
- var localSubrToUse = null;
- var privateDictToUse = privateDict;
- if (fdSelect && fdArray.length) {
- var fdIndex = fdSelect.getFDIndex(i);
- if (fdIndex === -1) {
- (0, _util.warn)('Glyph index is not in fd select.');
- valid = false;
- }
- if (fdIndex >= fdArray.length) {
- (0, _util.warn)('Invalid fd index for glyph index.');
- valid = false;
- }
- if (valid) {
- privateDictToUse = fdArray[fdIndex].privateDict;
- localSubrToUse = privateDictToUse.subrsIndex;
- }
- } else if (localSubrIndex) {
- localSubrToUse = localSubrIndex;
- }
- if (valid) {
- valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
- }
- if (state.width !== null) {
- var nominalWidth = privateDictToUse.getByName('nominalWidthX');
- widths[i] = nominalWidth + state.width;
- } else {
- var defaultWidth = privateDictToUse.getByName('defaultWidthX');
- widths[i] = defaultWidth;
- }
- if (state.seac !== null) {
- seacs[i] = state.seac;
- }
- if (!valid) {
- charStrings.set(i, new Uint8Array([14]));
- }
- }
- return {
- charStrings: charStrings,
- seacs: seacs,
- widths: widths
- };
- },
-
- emptyPrivateDictionary: function CFFParser_emptyPrivateDictionary(parentDict) {
- var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
- parentDict.setByKey(18, [0, 0]);
- parentDict.privateDict = privateDict;
- },
- parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) {
- if (!parentDict.hasName('Private')) {
- this.emptyPrivateDictionary(parentDict);
- return;
- }
- var privateOffset = parentDict.getByName('Private');
- if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
- parentDict.removeByName('Private');
- return;
- }
- var size = privateOffset[0];
- var offset = privateOffset[1];
- if (size === 0 || offset >= this.bytes.length) {
- this.emptyPrivateDictionary(parentDict);
- return;
- }
- var privateDictEnd = offset + size;
- var dictData = this.bytes.subarray(offset, privateDictEnd);
- var dict = this.parseDict(dictData);
- var privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
- parentDict.privateDict = privateDict;
- if (!privateDict.getByName('Subrs')) {
- return;
- }
- var subrsOffset = privateDict.getByName('Subrs');
- var relativeOffset = offset + subrsOffset;
- if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
- this.emptyPrivateDictionary(parentDict);
- return;
- }
- var subrsIndex = this.parseIndex(relativeOffset);
- privateDict.subrsIndex = subrsIndex.obj;
- },
- parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) {
- if (pos === 0) {
- return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
- } else if (pos === 1) {
- return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
- } else if (pos === 2) {
- return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
- }
- var bytes = this.bytes;
- var start = pos;
- var format = bytes[pos++];
- var charset = ['.notdef'];
- var id, count, i;
- length -= 1;
- switch (format) {
- case 0:
- for (i = 0; i < length; i++) {
- id = bytes[pos++] << 8 | bytes[pos++];
- charset.push(cid ? id : strings.get(id));
- }
- break;
- case 1:
- while (charset.length <= length) {
- id = bytes[pos++] << 8 | bytes[pos++];
- count = bytes[pos++];
- for (i = 0; i <= count; i++) {
- charset.push(cid ? id++ : strings.get(id++));
- }
- }
- break;
- case 2:
- while (charset.length <= length) {
- id = bytes[pos++] << 8 | bytes[pos++];
- count = bytes[pos++] << 8 | bytes[pos++];
- for (i = 0; i <= count; i++) {
- charset.push(cid ? id++ : strings.get(id++));
- }
- }
- break;
- default:
- throw new _util.FormatError('Unknown charset format');
- }
- var end = pos;
- var raw = bytes.subarray(start, end);
- return new CFFCharset(false, format, charset, raw);
- },
- parseEncoding: function CFFParser_parseEncoding(pos, properties, strings, charset) {
- var encoding = Object.create(null);
- var bytes = this.bytes;
- var predefined = false;
- var format, i, ii;
- var raw = null;
- function readSupplement() {
- var supplementsCount = bytes[pos++];
- for (i = 0; i < supplementsCount; i++) {
- var code = bytes[pos++];
- var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
- encoding[code] = charset.indexOf(strings.get(sid));
- }
- }
- if (pos === 0 || pos === 1) {
- predefined = true;
- format = pos;
- var baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
- for (i = 0, ii = charset.length; i < ii; i++) {
- var index = baseEncoding.indexOf(charset[i]);
- if (index !== -1) {
- encoding[index] = i;
- }
- }
- } else {
- var dataStart = pos;
- format = bytes[pos++];
- switch (format & 0x7f) {
- case 0:
- var glyphsCount = bytes[pos++];
- for (i = 1; i <= glyphsCount; i++) {
- encoding[bytes[pos++]] = i;
- }
- break;
- case 1:
- var rangesCount = bytes[pos++];
- var gid = 1;
- for (i = 0; i < rangesCount; i++) {
- var start = bytes[pos++];
- var left = bytes[pos++];
- for (var j = start; j <= start + left; j++) {
- encoding[j] = gid++;
- }
- }
- break;
- default:
- throw new _util.FormatError('Unknown encoding format: ' + format + ' in CFF');
- }
- var dataEnd = pos;
- if (format & 0x80) {
- bytes[dataStart] &= 0x7f;
- readSupplement();
- }
- raw = bytes.subarray(dataStart, dataEnd);
- }
- format = format & 0x7f;
- return new CFFEncoding(predefined, format, encoding, raw);
- },
- parseFDSelect: function CFFParser_parseFDSelect(pos, length) {
- var bytes = this.bytes;
- var format = bytes[pos++];
- var fdSelect = [];
- var i;
- switch (format) {
- case 0:
- for (i = 0; i < length; ++i) {
- var id = bytes[pos++];
- fdSelect.push(id);
- }
- break;
- case 3:
- var rangesCount = bytes[pos++] << 8 | bytes[pos++];
- for (i = 0; i < rangesCount; ++i) {
- var first = bytes[pos++] << 8 | bytes[pos++];
- if (i === 0 && first !== 0) {
- (0, _util.warn)('parseFDSelect: The first range must have a first GID of 0' + ' -- trying to recover.');
- first = 0;
- }
- var fdIndex = bytes[pos++];
- var next = bytes[pos] << 8 | bytes[pos + 1];
- for (var j = first; j < next; ++j) {
- fdSelect.push(fdIndex);
- }
- }
- pos += 2;
- break;
- default:
- throw new _util.FormatError('parseFDSelect: Unknown format "' + format + '".');
- }
- if (fdSelect.length !== length) {
- throw new _util.FormatError('parseFDSelect: Invalid font data.');
- }
- return new CFFFDSelect(format, fdSelect);
- }
- };
- return CFFParser;
-}();
-var CFF = function CFFClosure() {
- function CFF() {
- this.header = null;
- this.names = [];
- this.topDict = null;
- this.strings = new CFFStrings();
- this.globalSubrIndex = null;
- this.encoding = null;
- this.charset = null;
- this.charStrings = null;
- this.fdArray = [];
- this.fdSelect = null;
- this.isCIDFont = false;
- }
- CFF.prototype = {
- duplicateFirstGlyph: function CFF_duplicateFirstGlyph() {
- if (this.charStrings.count >= 65535) {
- (0, _util.warn)('Not enough space in charstrings to duplicate first glyph.');
- return;
- }
- var glyphZero = this.charStrings.get(0);
- this.charStrings.add(glyphZero);
- if (this.isCIDFont) {
- this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
- }
- },
- hasGlyphId: function CFF_hasGlyphID(id) {
- if (id < 0 || id >= this.charStrings.count) {
- return false;
- }
- var glyph = this.charStrings.get(id);
- return glyph.length > 0;
- }
- };
- return CFF;
-}();
-var CFFHeader = function CFFHeaderClosure() {
- function CFFHeader(major, minor, hdrSize, offSize) {
- this.major = major;
- this.minor = minor;
- this.hdrSize = hdrSize;
- this.offSize = offSize;
- }
- return CFFHeader;
-}();
-var CFFStrings = function CFFStringsClosure() {
- function CFFStrings() {
- this.strings = [];
- }
- CFFStrings.prototype = {
- get: function CFFStrings_get(index) {
- if (index >= 0 && index <= 390) {
- return CFFStandardStrings[index];
- }
- if (index - 391 <= this.strings.length) {
- return this.strings[index - 391];
- }
- return CFFStandardStrings[0];
- },
- add: function CFFStrings_add(value) {
- this.strings.push(value);
- },
- get count() {
- return this.strings.length;
- }
- };
- return CFFStrings;
-}();
-var CFFIndex = function CFFIndexClosure() {
- function CFFIndex() {
- this.objects = [];
- this.length = 0;
- }
- CFFIndex.prototype = {
- add: function CFFIndex_add(data) {
- this.length += data.length;
- this.objects.push(data);
- },
- set: function CFFIndex_set(index, data) {
- this.length += data.length - this.objects[index].length;
- this.objects[index] = data;
- },
- get: function CFFIndex_get(index) {
- return this.objects[index];
- },
- get count() {
- return this.objects.length;
- }
- };
- return CFFIndex;
-}();
-var CFFDict = function CFFDictClosure() {
- function CFFDict(tables, strings) {
- this.keyToNameMap = tables.keyToNameMap;
- this.nameToKeyMap = tables.nameToKeyMap;
- this.defaults = tables.defaults;
- this.types = tables.types;
- this.opcodes = tables.opcodes;
- this.order = tables.order;
- this.strings = strings;
- this.values = Object.create(null);
- }
- CFFDict.prototype = {
- setByKey: function CFFDict_setByKey(key, value) {
- if (!(key in this.keyToNameMap)) {
- return false;
- }
- var valueLength = value.length;
- if (valueLength === 0) {
- return true;
- }
- for (var i = 0; i < valueLength; i++) {
- if (isNaN(value[i])) {
- (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
- return true;
- }
- }
- var type = this.types[key];
- if (type === 'num' || type === 'sid' || type === 'offset') {
- value = value[0];
- }
- this.values[key] = value;
- return true;
- },
- setByName: function CFFDict_setByName(name, value) {
- if (!(name in this.nameToKeyMap)) {
- throw new _util.FormatError('Invalid dictionary name "' + name + '"');
- }
- this.values[this.nameToKeyMap[name]] = value;
- },
- hasName: function CFFDict_hasName(name) {
- return this.nameToKeyMap[name] in this.values;
- },
- getByName: function CFFDict_getByName(name) {
- if (!(name in this.nameToKeyMap)) {
- throw new _util.FormatError('Invalid dictionary name ' + name + '"');
- }
- var key = this.nameToKeyMap[name];
- if (!(key in this.values)) {
- return this.defaults[key];
- }
- return this.values[key];
- },
- removeByName: function CFFDict_removeByName(name) {
- delete this.values[this.nameToKeyMap[name]];
- }
- };
- CFFDict.createTables = function CFFDict_createTables(layout) {
- var tables = {
- keyToNameMap: {},
- nameToKeyMap: {},
- defaults: {},
- types: {},
- opcodes: {},
- order: []
- };
- for (var i = 0, ii = layout.length; i < ii; ++i) {
- var entry = layout[i];
- var key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
- tables.keyToNameMap[key] = entry[1];
- tables.nameToKeyMap[entry[1]] = key;
- tables.types[key] = entry[2];
- tables.defaults[key] = entry[3];
- tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
- tables.order.push(key);
- }
- return tables;
- };
- return CFFDict;
-}();
-var CFFTopDict = function CFFTopDictClosure() {
- var layout = [[[12, 30], 'ROS', ['sid', 'sid', 'num'], null], [[12, 20], 'SyntheticBase', 'num', null], [0, 'version', 'sid', null], [1, 'Notice', 'sid', null], [[12, 0], 'Copyright', 'sid', null], [2, 'FullName', 'sid', null], [3, 'FamilyName', 'sid', null], [4, 'Weight', 'sid', null], [[12, 1], 'isFixedPitch', 'num', 0], [[12, 2], 'ItalicAngle', 'num', 0], [[12, 3], 'UnderlinePosition', 'num', -100], [[12, 4], 'UnderlineThickness', 'num', 50], [[12, 5], 'PaintType', 'num', 0], [[12, 6], 'CharstringType', 'num', 2], [[12, 7], 'FontMatrix', ['num', 'num', 'num', 'num', 'num', 'num'], [0.001, 0, 0, 0.001, 0, 0]], [13, 'UniqueID', 'num', null], [5, 'FontBBox', ['num', 'num', 'num', 'num'], [0, 0, 0, 0]], [[12, 8], 'StrokeWidth', 'num', 0], [14, 'XUID', 'array', null], [15, 'charset', 'offset', 0], [16, 'Encoding', 'offset', 0], [17, 'CharStrings', 'offset', 0], [18, 'Private', ['offset', 'offset'], null], [[12, 21], 'PostScript', 'sid', null], [[12, 22], 'BaseFontName', 'sid', null], [[12, 23], 'BaseFontBlend', 'delta', null], [[12, 31], 'CIDFontVersion', 'num', 0], [[12, 32], 'CIDFontRevision', 'num', 0], [[12, 33], 'CIDFontType', 'num', 0], [[12, 34], 'CIDCount', 'num', 8720], [[12, 35], 'UIDBase', 'num', null], [[12, 37], 'FDSelect', 'offset', null], [[12, 36], 'FDArray', 'offset', null], [[12, 38], 'FontName', 'sid', null]];
- var tables = null;
- function CFFTopDict(strings) {
- if (tables === null) {
- tables = CFFDict.createTables(layout);
- }
- CFFDict.call(this, tables, strings);
- this.privateDict = null;
- }
- CFFTopDict.prototype = Object.create(CFFDict.prototype);
- return CFFTopDict;
-}();
-var CFFPrivateDict = function CFFPrivateDictClosure() {
- var layout = [[6, 'BlueValues', 'delta', null], [7, 'OtherBlues', 'delta', null], [8, 'FamilyBlues', 'delta', null], [9, 'FamilyOtherBlues', 'delta', null], [[12, 9], 'BlueScale', 'num', 0.039625], [[12, 10], 'BlueShift', 'num', 7], [[12, 11], 'BlueFuzz', 'num', 1], [10, 'StdHW', 'num', null], [11, 'StdVW', 'num', null], [[12, 12], 'StemSnapH', 'delta', null], [[12, 13], 'StemSnapV', 'delta', null], [[12, 14], 'ForceBold', 'num', 0], [[12, 17], 'LanguageGroup', 'num', 0], [[12, 18], 'ExpansionFactor', 'num', 0.06], [[12, 19], 'initialRandomSeed', 'num', 0], [20, 'defaultWidthX', 'num', 0], [21, 'nominalWidthX', 'num', 0], [19, 'Subrs', 'offset', null]];
- var tables = null;
- function CFFPrivateDict(strings) {
- if (tables === null) {
- tables = CFFDict.createTables(layout);
- }
- CFFDict.call(this, tables, strings);
- this.subrsIndex = null;
- }
- CFFPrivateDict.prototype = Object.create(CFFDict.prototype);
- return CFFPrivateDict;
-}();
-var CFFCharsetPredefinedTypes = {
- ISO_ADOBE: 0,
- EXPERT: 1,
- EXPERT_SUBSET: 2
-};
-var CFFCharset = function CFFCharsetClosure() {
- function CFFCharset(predefined, format, charset, raw) {
- this.predefined = predefined;
- this.format = format;
- this.charset = charset;
- this.raw = raw;
- }
- return CFFCharset;
-}();
-var CFFEncoding = function CFFEncodingClosure() {
- function CFFEncoding(predefined, format, encoding, raw) {
- this.predefined = predefined;
- this.format = format;
- this.encoding = encoding;
- this.raw = raw;
- }
- return CFFEncoding;
-}();
-var CFFFDSelect = function CFFFDSelectClosure() {
- function CFFFDSelect(format, fdSelect) {
- this.format = format;
- this.fdSelect = fdSelect;
- }
- CFFFDSelect.prototype = {
- getFDIndex: function CFFFDSelect_get(glyphIndex) {
- if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
- return -1;
- }
- return this.fdSelect[glyphIndex];
- }
- };
- return CFFFDSelect;
-}();
-var CFFOffsetTracker = function CFFOffsetTrackerClosure() {
- function CFFOffsetTracker() {
- this.offsets = Object.create(null);
- }
- CFFOffsetTracker.prototype = {
- isTracking: function CFFOffsetTracker_isTracking(key) {
- return key in this.offsets;
- },
- track: function CFFOffsetTracker_track(key, location) {
- if (key in this.offsets) {
- throw new _util.FormatError('Already tracking location of ' + key);
- }
- this.offsets[key] = location;
- },
- offset: function CFFOffsetTracker_offset(value) {
- for (var key in this.offsets) {
- this.offsets[key] += value;
- }
- },
- setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) {
- if (!(key in this.offsets)) {
- throw new _util.FormatError('Not tracking location of ' + key);
- }
- var data = output.data;
- var dataOffset = this.offsets[key];
- var size = 5;
- for (var i = 0, ii = values.length; i < ii; ++i) {
- var offset0 = i * size + dataOffset;
- var offset1 = offset0 + 1;
- var offset2 = offset0 + 2;
- var offset3 = offset0 + 3;
- var offset4 = offset0 + 4;
- if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
- throw new _util.FormatError('writing to an offset that is not empty');
- }
- var value = values[i];
- data[offset0] = 0x1d;
- data[offset1] = value >> 24 & 0xFF;
- data[offset2] = value >> 16 & 0xFF;
- data[offset3] = value >> 8 & 0xFF;
- data[offset4] = value & 0xFF;
- }
- }
- };
- return CFFOffsetTracker;
-}();
-var CFFCompiler = function CFFCompilerClosure() {
- function CFFCompiler(cff) {
- this.cff = cff;
- }
- CFFCompiler.prototype = {
- compile: function CFFCompiler_compile() {
- var cff = this.cff;
- var output = {
- data: [],
- length: 0,
- add: function CFFCompiler_add(data) {
- this.data = this.data.concat(data);
- this.length = this.data.length;
- }
- };
- var header = this.compileHeader(cff.header);
- output.add(header);
- var nameIndex = this.compileNameIndex(cff.names);
- output.add(nameIndex);
- if (cff.isCIDFont) {
- if (cff.topDict.hasName('FontMatrix')) {
- var base = cff.topDict.getByName('FontMatrix');
- cff.topDict.removeByName('FontMatrix');
- for (var i = 0, ii = cff.fdArray.length; i < ii; i++) {
- var subDict = cff.fdArray[i];
- var matrix = base.slice(0);
- if (subDict.hasName('FontMatrix')) {
- matrix = _util.Util.transform(matrix, subDict.getByName('FontMatrix'));
- }
- subDict.setByName('FontMatrix', matrix);
- }
- }
- }
- cff.topDict.setByName('charset', 0);
- var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
- output.add(compiled.output);
- var topDictTracker = compiled.trackers[0];
- var stringIndex = this.compileStringIndex(cff.strings.strings);
- output.add(stringIndex);
- var globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
- output.add(globalSubrIndex);
- if (cff.encoding && cff.topDict.hasName('Encoding')) {
- if (cff.encoding.predefined) {
- topDictTracker.setEntryLocation('Encoding', [cff.encoding.format], output);
- } else {
- var encoding = this.compileEncoding(cff.encoding);
- topDictTracker.setEntryLocation('Encoding', [output.length], output);
- output.add(encoding);
- }
- }
- var charset = this.compileCharset(cff.charset);
- topDictTracker.setEntryLocation('charset', [output.length], output);
- output.add(charset);
- var charStrings = this.compileCharStrings(cff.charStrings);
- topDictTracker.setEntryLocation('CharStrings', [output.length], output);
- output.add(charStrings);
- if (cff.isCIDFont) {
- topDictTracker.setEntryLocation('FDSelect', [output.length], output);
- var fdSelect = this.compileFDSelect(cff.fdSelect);
- output.add(fdSelect);
- compiled = this.compileTopDicts(cff.fdArray, output.length, true);
- topDictTracker.setEntryLocation('FDArray', [output.length], output);
- output.add(compiled.output);
- var fontDictTrackers = compiled.trackers;
- this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
- }
- this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
- output.add([0]);
- return output.data;
- },
- encodeNumber: function CFFCompiler_encodeNumber(value) {
- if (parseFloat(value) === parseInt(value, 10) && !isNaN(value)) {
- return this.encodeInteger(value);
- }
- return this.encodeFloat(value);
- },
- encodeFloat: function CFFCompiler_encodeFloat(num) {
- var value = num.toString();
- var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
- if (m) {
- var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length));
- value = (Math.round(num * epsilon) / epsilon).toString();
- }
- var nibbles = '';
- var i, ii;
- for (i = 0, ii = value.length; i < ii; ++i) {
- var a = value[i];
- if (a === 'e') {
- nibbles += value[++i] === '-' ? 'c' : 'b';
- } else if (a === '.') {
- nibbles += 'a';
- } else if (a === '-') {
- nibbles += 'e';
- } else {
- nibbles += a;
- }
- }
- nibbles += nibbles.length & 1 ? 'f' : 'ff';
- var out = [30];
- for (i = 0, ii = nibbles.length; i < ii; i += 2) {
- out.push(parseInt(nibbles.substring(i, i + 2), 16));
- }
- return out;
- },
- encodeInteger: function CFFCompiler_encodeInteger(value) {
- var code;
- if (value >= -107 && value <= 107) {
- code = [value + 139];
- } else if (value >= 108 && value <= 1131) {
- value = value - 108;
- code = [(value >> 8) + 247, value & 0xFF];
- } else if (value >= -1131 && value <= -108) {
- value = -value - 108;
- code = [(value >> 8) + 251, value & 0xFF];
- } else if (value >= -32768 && value <= 32767) {
- code = [0x1c, value >> 8 & 0xFF, value & 0xFF];
- } else {
- code = [0x1d, value >> 24 & 0xFF, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF];
- }
- return code;
- },
- compileHeader: function CFFCompiler_compileHeader(header) {
- return [header.major, header.minor, header.hdrSize, header.offSize];
- },
- compileNameIndex: function CFFCompiler_compileNameIndex(names) {
- var nameIndex = new CFFIndex();
- for (var i = 0, ii = names.length; i < ii; ++i) {
- var name = names[i];
- var length = Math.min(name.length, 127);
- var sanitizedName = new Array(length);
- for (var j = 0; j < length; j++) {
- var char = name[j];
- if (char < '!' || char > '~' || char === '[' || char === ']' || char === '(' || char === ')' || char === '{' || char === '}' || char === '<' || char === '>' || char === '/' || char === '%') {
- char = '_';
- }
- sanitizedName[j] = char;
- }
- sanitizedName = sanitizedName.join('');
- if (sanitizedName === '') {
- sanitizedName = 'Bad_Font_Name';
- }
- nameIndex.add((0, _util.stringToBytes)(sanitizedName));
- }
- return this.compileIndex(nameIndex);
- },
- compileTopDicts: function CFFCompiler_compileTopDicts(dicts, length, removeCidKeys) {
- var fontDictTrackers = [];
- var fdArrayIndex = new CFFIndex();
- for (var i = 0, ii = dicts.length; i < ii; ++i) {
- var fontDict = dicts[i];
- if (removeCidKeys) {
- fontDict.removeByName('CIDFontVersion');
- fontDict.removeByName('CIDFontRevision');
- fontDict.removeByName('CIDFontType');
- fontDict.removeByName('CIDCount');
- fontDict.removeByName('UIDBase');
- }
- var fontDictTracker = new CFFOffsetTracker();
- var fontDictData = this.compileDict(fontDict, fontDictTracker);
- fontDictTrackers.push(fontDictTracker);
- fdArrayIndex.add(fontDictData);
- fontDictTracker.offset(length);
- }
- fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
- return {
- trackers: fontDictTrackers,
- output: fdArrayIndex
- };
- },
- compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, trackers, output) {
- for (var i = 0, ii = dicts.length; i < ii; ++i) {
- var fontDict = dicts[i];
- var privateDict = fontDict.privateDict;
- if (!privateDict || !fontDict.hasName('Private')) {
- throw new _util.FormatError('There must be a private dictionary.');
- }
- var privateDictTracker = new CFFOffsetTracker();
- var privateDictData = this.compileDict(privateDict, privateDictTracker);
- var outputLength = output.length;
- privateDictTracker.offset(outputLength);
- if (!privateDictData.length) {
- outputLength = 0;
- }
- trackers[i].setEntryLocation('Private', [privateDictData.length, outputLength], output);
- output.add(privateDictData);
- if (privateDict.subrsIndex && privateDict.hasName('Subrs')) {
- var subrs = this.compileIndex(privateDict.subrsIndex);
- privateDictTracker.setEntryLocation('Subrs', [privateDictData.length], output);
- output.add(subrs);
- }
- }
- },
- compileDict: function CFFCompiler_compileDict(dict, offsetTracker) {
- var out = [];
- var order = dict.order;
- for (var i = 0; i < order.length; ++i) {
- var key = order[i];
- if (!(key in dict.values)) {
- continue;
- }
- var values = dict.values[key];
- var types = dict.types[key];
- if (!Array.isArray(types)) {
- types = [types];
- }
- if (!Array.isArray(values)) {
- values = [values];
- }
- if (values.length === 0) {
- continue;
- }
- for (var j = 0, jj = types.length; j < jj; ++j) {
- var type = types[j];
- var value = values[j];
- switch (type) {
- case 'num':
- case 'sid':
- out = out.concat(this.encodeNumber(value));
- break;
- case 'offset':
- var name = dict.keyToNameMap[key];
- if (!offsetTracker.isTracking(name)) {
- offsetTracker.track(name, out.length);
- }
- out = out.concat([0x1d, 0, 0, 0, 0]);
- break;
- case 'array':
- case 'delta':
- out = out.concat(this.encodeNumber(value));
- for (var k = 1, kk = values.length; k < kk; ++k) {
- out = out.concat(this.encodeNumber(values[k]));
- }
- break;
- default:
- throw new _util.FormatError('Unknown data type of ' + type);
- }
- }
- out = out.concat(dict.opcodes[key]);
- }
- return out;
- },
- compileStringIndex: function CFFCompiler_compileStringIndex(strings) {
- var stringIndex = new CFFIndex();
- for (var i = 0, ii = strings.length; i < ii; ++i) {
- stringIndex.add((0, _util.stringToBytes)(strings[i]));
- }
- return this.compileIndex(stringIndex);
- },
- compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() {
- var globalSubrIndex = this.cff.globalSubrIndex;
- this.out.writeByteArray(this.compileIndex(globalSubrIndex));
- },
- compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) {
- var charStringsIndex = new CFFIndex();
- for (var i = 0; i < charStrings.count; i++) {
- var glyph = charStrings.get(i);
- if (glyph.length === 0) {
- charStringsIndex.add(new Uint8Array([0x8B, 0x0E]));
- continue;
- }
- charStringsIndex.add(glyph);
- }
- return this.compileIndex(charStringsIndex);
- },
- compileCharset: function CFFCompiler_compileCharset(charset) {
- var length = 1 + (this.cff.charStrings.count - 1) * 2;
- var out = new Uint8Array(length);
- return this.compileTypedArray(out);
- },
- compileEncoding: function CFFCompiler_compileEncoding(encoding) {
- return this.compileTypedArray(encoding.raw);
- },
- compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) {
- var format = fdSelect.format;
- var out = void 0,
- i = void 0;
- switch (format) {
- case 0:
- out = new Uint8Array(1 + fdSelect.fdSelect.length);
- out[0] = format;
- for (i = 0; i < fdSelect.fdSelect.length; i++) {
- out[i + 1] = fdSelect.fdSelect[i];
- }
- break;
- case 3:
- var start = 0;
- var lastFD = fdSelect.fdSelect[0];
- var ranges = [format, 0, 0, start >> 8 & 0xFF, start & 0xFF, lastFD];
- for (i = 1; i < fdSelect.fdSelect.length; i++) {
- var currentFD = fdSelect.fdSelect[i];
- if (currentFD !== lastFD) {
- ranges.push(i >> 8 & 0xFF, i & 0xFF, currentFD);
- lastFD = currentFD;
- }
- }
- var numRanges = (ranges.length - 3) / 3;
- ranges[1] = numRanges >> 8 & 0xFF;
- ranges[2] = numRanges & 0xFF;
- ranges.push(i >> 8 & 0xFF, i & 0xFF);
- out = new Uint8Array(ranges);
- break;
- }
- return this.compileTypedArray(out);
- },
- compileTypedArray: function CFFCompiler_compileTypedArray(data) {
- var out = [];
- for (var i = 0, ii = data.length; i < ii; ++i) {
- out[i] = data[i];
- }
- return out;
- },
- compileIndex: function CFFCompiler_compileIndex(index, trackers) {
- trackers = trackers || [];
- var objects = index.objects;
- var count = objects.length;
- if (count === 0) {
- return [0, 0, 0];
- }
- var data = [count >> 8 & 0xFF, count & 0xff];
- var lastOffset = 1,
- i;
- for (i = 0; i < count; ++i) {
- lastOffset += objects[i].length;
- }
- var offsetSize;
- if (lastOffset < 0x100) {
- offsetSize = 1;
- } else if (lastOffset < 0x10000) {
- offsetSize = 2;
- } else if (lastOffset < 0x1000000) {
- offsetSize = 3;
- } else {
- offsetSize = 4;
- }
- data.push(offsetSize);
- var relativeOffset = 1;
- for (i = 0; i < count + 1; i++) {
- if (offsetSize === 1) {
- data.push(relativeOffset & 0xFF);
- } else if (offsetSize === 2) {
- data.push(relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
- } else if (offsetSize === 3) {
- data.push(relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
- } else {
- data.push(relativeOffset >>> 24 & 0xFF, relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
- }
- if (objects[i]) {
- relativeOffset += objects[i].length;
- }
- }
- for (i = 0; i < count; i++) {
- if (trackers[i]) {
- trackers[i].offset(data.length);
- }
- for (var j = 0, jj = objects[i].length; j < jj; j++) {
- data.push(objects[i][j]);
- }
- }
- return data;
- }
- };
- return CFFCompiler;
-}();
-exports.CFFStandardStrings = CFFStandardStrings;
-exports.CFFParser = CFFParser;
-exports.CFF = CFF;
-exports.CFFHeader = CFFHeader;
-exports.CFFStrings = CFFStrings;
-exports.CFFIndex = CFFIndex;
-exports.CFFCharset = CFFCharset;
-exports.CFFTopDict = CFFTopDict;
-exports.CFFPrivateDict = CFFPrivateDict;
-exports.CFFCompiler = CFFCompiler;
-exports.CFFFDSelect = CFFFDSelect;
-
-/***/ }),
-/* 158 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-var ISOAdobeCharset = ['.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'];
-var ExpertCharset = ['.notdef', 'space', 'exclamsmall', 'Hungarumlautsmall', 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma', 'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'colon', 'semicolon', 'commasuperior', 'threequartersemdash', 'periodsuperior', 'questionsmall', 'asuperior', 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', 'isuperior', 'lsuperior', 'msuperior', 'nsuperior', 'osuperior', 'rsuperior', 'ssuperior', 'tsuperior', 'ff', 'fi', 'fl', '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', 'onequarter', 'onehalf', 'threequarters', 'questiondownsmall', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', 'zerosuperior', 'onesuperior', 'twosuperior', 'threesuperior', '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'];
-var ExpertSubsetCharset = ['.notdef', 'space', 'dollaroldstyle', 'dollarsuperior', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma', 'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'colon', 'semicolon', 'commasuperior', 'threequartersemdash', 'periodsuperior', 'asuperior', 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', 'isuperior', 'lsuperior', 'msuperior', 'nsuperior', 'osuperior', 'rsuperior', 'ssuperior', 'tsuperior', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior', 'parenrightinferior', 'hyphensuperior', 'colonmonetary', 'onefitted', 'rupiah', 'centoldstyle', 'figuredash', 'hypheninferior', 'onequarter', 'onehalf', 'threequarters', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', 'zerosuperior', 'onesuperior', 'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior', 'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior', 'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior', 'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior', 'periodinferior', 'commainferior'];
-exports.ISOAdobeCharset = ISOAdobeCharset;
-exports.ExpertCharset = ExpertCharset;
-exports.ExpertSubsetCharset = ExpertSubsetCharset;
-
-/***/ }),
-/* 159 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-var ExpertEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclamsmall', 'Hungarumlautsmall', '', 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma', 'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'colon', 'semicolon', 'commasuperior', 'threequartersemdash', 'periodsuperior', 'questionsmall', '', 'asuperior', 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', '', '', '', 'isuperior', '', '', 'lsuperior', 'msuperior', 'nsuperior', 'osuperior', '', '', 'rsuperior', 'ssuperior', 'tsuperior', '', 'ff', 'fi', 'fl', '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', '', '', '', 'onequarter', 'onehalf', 'threequarters', 'questiondownsmall', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', '', '', 'zerosuperior', 'onesuperior', 'twosuperior', 'threesuperior', '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'];
-var MacExpertEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclamsmall', 'Hungarumlautsmall', 'centoldstyle', 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma', 'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'colon', 'semicolon', '', 'threequartersemdash', '', 'questionsmall', '', '', '', '', 'Ethsmall', '', '', 'onequarter', 'onehalf', 'threequarters', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', '', '', '', '', '', '', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior', '', 'parenrightinferior', 'Circumflexsmall', 'hypheninferior', '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', '', '', 'asuperior', 'centsuperior', '', '', '', '', 'Aacutesmall', 'Agravesmall', 'Acircumflexsmall', 'Adieresissmall', 'Atildesmall', 'Aringsmall', 'Ccedillasmall', 'Eacutesmall', 'Egravesmall', 'Ecircumflexsmall', 'Edieresissmall', 'Iacutesmall', 'Igravesmall', 'Icircumflexsmall', 'Idieresissmall', 'Ntildesmall', 'Oacutesmall', 'Ogravesmall', 'Ocircumflexsmall', 'Odieresissmall', 'Otildesmall', 'Uacutesmall', 'Ugravesmall', 'Ucircumflexsmall', 'Udieresissmall', '', 'eightsuperior', 'fourinferior', 'threeinferior', 'sixinferior', 'eightinferior', 'seveninferior', 'Scaronsmall', '', 'centinferior', 'twoinferior', '', 'Dieresissmall', '', 'Caronsmall', 'osuperior', 'fiveinferior', '', 'commainferior', 'periodinferior', 'Yacutesmall', '', 'dollarinferior', '', '', 'Thornsmall', '', 'nineinferior', 'zeroinferior', 'Zcaronsmall', 'AEsmall', 'Oslashsmall', 'questiondownsmall', 'oneinferior', 'Lslashsmall', '', '', '', '', '', '', 'Cedillasmall', '', '', '', '', '', 'OEsmall', 'figuredash', 'hyphensuperior', '', '', '', '', 'exclamdownsmall', '', 'Ydieresissmall', '', 'onesuperior', 'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'ninesuperior', 'zerosuperior', '', 'esuperior', 'rsuperior', 'tsuperior', '', '', 'isuperior', 'ssuperior', 'dsuperior', '', '', '', '', '', 'lsuperior', 'Ogoneksmall', 'Brevesmall', 'Macronsmall', 'bsuperior', 'nsuperior', 'msuperior', 'commasuperior', 'periodsuperior', 'Dotaccentsmall', 'Ringsmall', '', '', '', ''];
-var MacRomanEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quotesingle', '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', 'grave', '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', '', 'Adieresis', 'Aring', 'Ccedilla', 'Eacute', 'Ntilde', 'Odieresis', 'Udieresis', 'aacute', 'agrave', 'acircumflex', 'adieresis', 'atilde', 'aring', 'ccedilla', 'eacute', 'egrave', 'ecircumflex', 'edieresis', 'iacute', 'igrave', 'icircumflex', 'idieresis', 'ntilde', 'oacute', 'ograve', 'ocircumflex', 'odieresis', 'otilde', 'uacute', 'ugrave', 'ucircumflex', 'udieresis', 'dagger', 'degree', 'cent', 'sterling', 'section', 'bullet', 'paragraph', 'germandbls', 'registered', 'copyright', 'trademark', 'acute', 'dieresis', 'notequal', 'AE', 'Oslash', 'infinity', 'plusminus', 'lessequal', 'greaterequal', 'yen', 'mu', 'partialdiff', 'summation', 'product', 'pi', 'integral', 'ordfeminine', 'ordmasculine', 'Omega', 'ae', 'oslash', 'questiondown', 'exclamdown', 'logicalnot', 'radical', 'florin', 'approxequal', 'Delta', 'guillemotleft', 'guillemotright', 'ellipsis', 'space', 'Agrave', 'Atilde', 'Otilde', 'OE', 'oe', 'endash', 'emdash', 'quotedblleft', 'quotedblright', 'quoteleft', 'quoteright', 'divide', 'lozenge', 'ydieresis', 'Ydieresis', 'fraction', 'currency', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', 'daggerdbl', 'periodcentered', 'quotesinglbase', 'quotedblbase', 'perthousand', 'Acircumflex', 'Ecircumflex', 'Aacute', 'Edieresis', 'Egrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Igrave', 'Oacute', 'Ocircumflex', 'apple', 'Ograve', 'Uacute', 'Ucircumflex', 'Ugrave', 'dotlessi', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'ring', 'cedilla', 'hungarumlaut', 'ogonek', 'caron'];
-var StandardEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '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', '', '', '', ''];
-var WinAnsiEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quotesingle', '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', 'grave', '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', 'bullet', 'Euro', 'bullet', 'quotesinglbase', 'florin', 'quotedblbase', 'ellipsis', 'dagger', 'daggerdbl', 'circumflex', 'perthousand', 'Scaron', 'guilsinglleft', 'OE', 'bullet', 'Zcaron', 'bullet', 'bullet', 'quoteleft', 'quoteright', 'quotedblleft', 'quotedblright', 'bullet', 'endash', 'emdash', 'tilde', 'trademark', 'scaron', 'guilsinglright', 'oe', 'bullet', 'zcaron', 'Ydieresis', 'space', 'exclamdown', 'cent', 'sterling', 'currency', 'yen', 'brokenbar', 'section', 'dieresis', 'copyright', 'ordfeminine', 'guillemotleft', 'logicalnot', 'hyphen', 'registered', 'macron', 'degree', 'plusminus', 'twosuperior', 'threesuperior', 'acute', 'mu', 'paragraph', 'periodcentered', 'cedilla', 'onesuperior', 'ordmasculine', 'guillemotright', 'onequarter', 'onehalf', 'threequarters', 'questiondown', 'Agrave', 'Aacute', 'Acircumflex', 'Atilde', 'Adieresis', 'Aring', 'AE', 'Ccedilla', 'Egrave', 'Eacute', 'Ecircumflex', 'Edieresis', 'Igrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Eth', 'Ntilde', 'Ograve', 'Oacute', 'Ocircumflex', 'Otilde', 'Odieresis', 'multiply', 'Oslash', 'Ugrave', 'Uacute', 'Ucircumflex', 'Udieresis', 'Yacute', 'Thorn', 'germandbls', 'agrave', 'aacute', 'acircumflex', 'atilde', 'adieresis', 'aring', 'ae', 'ccedilla', 'egrave', 'eacute', 'ecircumflex', 'edieresis', 'igrave', 'iacute', 'icircumflex', 'idieresis', 'eth', 'ntilde', 'ograve', 'oacute', 'ocircumflex', 'otilde', 'odieresis', 'divide', 'oslash', 'ugrave', 'uacute', 'ucircumflex', 'udieresis', 'yacute', 'thorn', 'ydieresis'];
-var SymbolSetEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclam', 'universal', 'numbersign', 'existential', 'percent', 'ampersand', 'suchthat', 'parenleft', 'parenright', 'asteriskmath', 'plus', 'comma', 'minus', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'congruent', 'Alpha', 'Beta', 'Chi', 'Delta', 'Epsilon', 'Phi', 'Gamma', 'Eta', 'Iota', 'theta1', 'Kappa', 'Lambda', 'Mu', 'Nu', 'Omicron', 'Pi', 'Theta', 'Rho', 'Sigma', 'Tau', 'Upsilon', 'sigma1', 'Omega', 'Xi', 'Psi', 'Zeta', 'bracketleft', 'therefore', 'bracketright', 'perpendicular', 'underscore', 'radicalex', 'alpha', 'beta', 'chi', 'delta', 'epsilon', 'phi', 'gamma', 'eta', 'iota', 'phi1', 'kappa', 'lambda', 'mu', 'nu', 'omicron', 'pi', 'theta', 'rho', 'sigma', 'tau', 'upsilon', 'omega1', 'omega', 'xi', 'psi', 'zeta', 'braceleft', 'bar', 'braceright', 'similar', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'Euro', 'Upsilon1', 'minute', 'lessequal', 'fraction', 'infinity', 'florin', 'club', 'diamond', 'heart', 'spade', 'arrowboth', 'arrowleft', 'arrowup', 'arrowright', 'arrowdown', 'degree', 'plusminus', 'second', 'greaterequal', 'multiply', 'proportional', 'partialdiff', 'bullet', 'divide', 'notequal', 'equivalence', 'approxequal', 'ellipsis', 'arrowvertex', 'arrowhorizex', 'carriagereturn', 'aleph', 'Ifraktur', 'Rfraktur', 'weierstrass', 'circlemultiply', 'circleplus', 'emptyset', 'intersection', 'union', 'propersuperset', 'reflexsuperset', 'notsubset', 'propersubset', 'reflexsubset', 'element', 'notelement', 'angle', 'gradient', 'registerserif', 'copyrightserif', 'trademarkserif', 'product', 'radical', 'dotmath', 'logicalnot', 'logicaland', 'logicalor', 'arrowdblboth', 'arrowdblleft', 'arrowdblup', 'arrowdblright', 'arrowdbldown', 'lozenge', 'angleleft', 'registersans', 'copyrightsans', 'trademarksans', 'summation', 'parenlefttp', 'parenleftex', 'parenleftbt', 'bracketlefttp', 'bracketleftex', 'bracketleftbt', 'bracelefttp', 'braceleftmid', 'braceleftbt', 'braceex', '', 'angleright', 'integral', 'integraltp', 'integralex', 'integralbt', 'parenrighttp', 'parenrightex', 'parenrightbt', 'bracketrighttp', 'bracketrightex', 'bracketrightbt', 'bracerighttp', 'bracerightmid', 'bracerightbt', ''];
-var ZapfDingbatsEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'a1', 'a2', 'a202', 'a3', 'a4', 'a5', 'a119', 'a118', 'a117', 'a11', 'a12', 'a13', 'a14', 'a15', 'a16', 'a105', 'a17', 'a18', 'a19', 'a20', 'a21', 'a22', 'a23', 'a24', 'a25', 'a26', 'a27', 'a28', 'a6', 'a7', 'a8', 'a9', 'a10', 'a29', 'a30', 'a31', 'a32', 'a33', 'a34', 'a35', 'a36', 'a37', 'a38', 'a39', 'a40', 'a41', 'a42', 'a43', 'a44', 'a45', 'a46', 'a47', 'a48', 'a49', 'a50', 'a51', 'a52', 'a53', 'a54', 'a55', 'a56', 'a57', 'a58', 'a59', 'a60', 'a61', 'a62', 'a63', 'a64', 'a65', 'a66', 'a67', 'a68', 'a69', 'a70', 'a71', 'a72', 'a73', 'a74', 'a203', 'a75', 'a204', 'a76', 'a77', 'a78', 'a79', 'a81', 'a82', 'a83', 'a84', 'a97', 'a98', 'a99', 'a100', '', 'a89', 'a90', 'a93', 'a94', 'a91', 'a92', 'a205', 'a85', 'a206', 'a86', 'a87', 'a88', 'a95', 'a96', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'a101', 'a102', 'a103', 'a104', 'a106', 'a107', 'a108', 'a112', 'a111', 'a110', 'a109', 'a120', 'a121', 'a122', 'a123', 'a124', 'a125', 'a126', 'a127', 'a128', 'a129', 'a130', 'a131', 'a132', 'a133', 'a134', 'a135', 'a136', 'a137', 'a138', 'a139', 'a140', 'a141', 'a142', 'a143', 'a144', 'a145', 'a146', 'a147', 'a148', 'a149', 'a150', 'a151', 'a152', 'a153', 'a154', 'a155', 'a156', 'a157', 'a158', 'a159', 'a160', 'a161', 'a163', 'a164', 'a196', 'a165', 'a192', 'a166', 'a167', 'a168', 'a169', 'a170', 'a171', 'a172', 'a173', 'a162', 'a174', 'a175', 'a176', 'a177', 'a178', 'a179', 'a193', 'a180', 'a199', 'a181', 'a200', 'a182', '', 'a201', 'a183', 'a184', 'a197', 'a185', 'a194', 'a198', 'a186', 'a195', 'a187', 'a188', 'a189', 'a190', 'a191', ''];
-function getEncoding(encodingName) {
- switch (encodingName) {
- case 'WinAnsiEncoding':
- return WinAnsiEncoding;
- case 'StandardEncoding':
- return StandardEncoding;
- case 'MacRomanEncoding':
- return MacRomanEncoding;
- case 'SymbolSetEncoding':
- return SymbolSetEncoding;
- case 'ZapfDingbatsEncoding':
- return ZapfDingbatsEncoding;
- case 'ExpertEncoding':
- return ExpertEncoding;
- case 'MacExpertEncoding':
- return MacExpertEncoding;
- default:
- return null;
- }
-}
-exports.WinAnsiEncoding = WinAnsiEncoding;
-exports.StandardEncoding = StandardEncoding;
-exports.MacRomanEncoding = MacRomanEncoding;
-exports.SymbolSetEncoding = SymbolSetEncoding;
-exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
-exports.ExpertEncoding = ExpertEncoding;
-exports.getEncoding = getEncoding;
-
-/***/ }),
-/* 160 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-var getLookupTableFactory = __w_pdfjs_require__(2).getLookupTableFactory;
-var getGlyphsUnicode = getLookupTableFactory(function (t) {
- t['A'] = 0x0041;
- t['AE'] = 0x00C6;
- t['AEacute'] = 0x01FC;
- t['AEmacron'] = 0x01E2;
- t['AEsmall'] = 0xF7E6;
- t['Aacute'] = 0x00C1;
- t['Aacutesmall'] = 0xF7E1;
- t['Abreve'] = 0x0102;
- t['Abreveacute'] = 0x1EAE;
- t['Abrevecyrillic'] = 0x04D0;
- t['Abrevedotbelow'] = 0x1EB6;
- t['Abrevegrave'] = 0x1EB0;
- t['Abrevehookabove'] = 0x1EB2;
- t['Abrevetilde'] = 0x1EB4;
- t['Acaron'] = 0x01CD;
- t['Acircle'] = 0x24B6;
- t['Acircumflex'] = 0x00C2;
- t['Acircumflexacute'] = 0x1EA4;
- t['Acircumflexdotbelow'] = 0x1EAC;
- t['Acircumflexgrave'] = 0x1EA6;
- t['Acircumflexhookabove'] = 0x1EA8;
- t['Acircumflexsmall'] = 0xF7E2;
- t['Acircumflextilde'] = 0x1EAA;
- t['Acute'] = 0xF6C9;
- t['Acutesmall'] = 0xF7B4;
- t['Acyrillic'] = 0x0410;
- t['Adblgrave'] = 0x0200;
- t['Adieresis'] = 0x00C4;
- t['Adieresiscyrillic'] = 0x04D2;
- t['Adieresismacron'] = 0x01DE;
- t['Adieresissmall'] = 0xF7E4;
- t['Adotbelow'] = 0x1EA0;
- t['Adotmacron'] = 0x01E0;
- t['Agrave'] = 0x00C0;
- t['Agravesmall'] = 0xF7E0;
- t['Ahookabove'] = 0x1EA2;
- t['Aiecyrillic'] = 0x04D4;
- t['Ainvertedbreve'] = 0x0202;
- t['Alpha'] = 0x0391;
- t['Alphatonos'] = 0x0386;
- t['Amacron'] = 0x0100;
- t['Amonospace'] = 0xFF21;
- t['Aogonek'] = 0x0104;
- t['Aring'] = 0x00C5;
- t['Aringacute'] = 0x01FA;
- t['Aringbelow'] = 0x1E00;
- t['Aringsmall'] = 0xF7E5;
- t['Asmall'] = 0xF761;
- t['Atilde'] = 0x00C3;
- t['Atildesmall'] = 0xF7E3;
- t['Aybarmenian'] = 0x0531;
- t['B'] = 0x0042;
- t['Bcircle'] = 0x24B7;
- t['Bdotaccent'] = 0x1E02;
- t['Bdotbelow'] = 0x1E04;
- t['Becyrillic'] = 0x0411;
- t['Benarmenian'] = 0x0532;
- t['Beta'] = 0x0392;
- t['Bhook'] = 0x0181;
- t['Blinebelow'] = 0x1E06;
- t['Bmonospace'] = 0xFF22;
- t['Brevesmall'] = 0xF6F4;
- t['Bsmall'] = 0xF762;
- t['Btopbar'] = 0x0182;
- t['C'] = 0x0043;
- t['Caarmenian'] = 0x053E;
- t['Cacute'] = 0x0106;
- t['Caron'] = 0xF6CA;
- t['Caronsmall'] = 0xF6F5;
- t['Ccaron'] = 0x010C;
- t['Ccedilla'] = 0x00C7;
- t['Ccedillaacute'] = 0x1E08;
- t['Ccedillasmall'] = 0xF7E7;
- t['Ccircle'] = 0x24B8;
- t['Ccircumflex'] = 0x0108;
- t['Cdot'] = 0x010A;
- t['Cdotaccent'] = 0x010A;
- t['Cedillasmall'] = 0xF7B8;
- t['Chaarmenian'] = 0x0549;
- t['Cheabkhasiancyrillic'] = 0x04BC;
- t['Checyrillic'] = 0x0427;
- t['Chedescenderabkhasiancyrillic'] = 0x04BE;
- t['Chedescendercyrillic'] = 0x04B6;
- t['Chedieresiscyrillic'] = 0x04F4;
- t['Cheharmenian'] = 0x0543;
- t['Chekhakassiancyrillic'] = 0x04CB;
- t['Cheverticalstrokecyrillic'] = 0x04B8;
- t['Chi'] = 0x03A7;
- t['Chook'] = 0x0187;
- t['Circumflexsmall'] = 0xF6F6;
- t['Cmonospace'] = 0xFF23;
- t['Coarmenian'] = 0x0551;
- t['Csmall'] = 0xF763;
- t['D'] = 0x0044;
- t['DZ'] = 0x01F1;
- t['DZcaron'] = 0x01C4;
- t['Daarmenian'] = 0x0534;
- t['Dafrican'] = 0x0189;
- t['Dcaron'] = 0x010E;
- t['Dcedilla'] = 0x1E10;
- t['Dcircle'] = 0x24B9;
- t['Dcircumflexbelow'] = 0x1E12;
- t['Dcroat'] = 0x0110;
- t['Ddotaccent'] = 0x1E0A;
- t['Ddotbelow'] = 0x1E0C;
- t['Decyrillic'] = 0x0414;
- t['Deicoptic'] = 0x03EE;
- t['Delta'] = 0x2206;
- t['Deltagreek'] = 0x0394;
- t['Dhook'] = 0x018A;
- t['Dieresis'] = 0xF6CB;
- t['DieresisAcute'] = 0xF6CC;
- t['DieresisGrave'] = 0xF6CD;
- t['Dieresissmall'] = 0xF7A8;
- t['Digammagreek'] = 0x03DC;
- t['Djecyrillic'] = 0x0402;
- t['Dlinebelow'] = 0x1E0E;
- t['Dmonospace'] = 0xFF24;
- t['Dotaccentsmall'] = 0xF6F7;
- t['Dslash'] = 0x0110;
- t['Dsmall'] = 0xF764;
- t['Dtopbar'] = 0x018B;
- t['Dz'] = 0x01F2;
- t['Dzcaron'] = 0x01C5;
- t['Dzeabkhasiancyrillic'] = 0x04E0;
- t['Dzecyrillic'] = 0x0405;
- t['Dzhecyrillic'] = 0x040F;
- t['E'] = 0x0045;
- t['Eacute'] = 0x00C9;
- t['Eacutesmall'] = 0xF7E9;
- t['Ebreve'] = 0x0114;
- t['Ecaron'] = 0x011A;
- t['Ecedillabreve'] = 0x1E1C;
- t['Echarmenian'] = 0x0535;
- t['Ecircle'] = 0x24BA;
- t['Ecircumflex'] = 0x00CA;
- t['Ecircumflexacute'] = 0x1EBE;
- t['Ecircumflexbelow'] = 0x1E18;
- t['Ecircumflexdotbelow'] = 0x1EC6;
- t['Ecircumflexgrave'] = 0x1EC0;
- t['Ecircumflexhookabove'] = 0x1EC2;
- t['Ecircumflexsmall'] = 0xF7EA;
- t['Ecircumflextilde'] = 0x1EC4;
- t['Ecyrillic'] = 0x0404;
- t['Edblgrave'] = 0x0204;
- t['Edieresis'] = 0x00CB;
- t['Edieresissmall'] = 0xF7EB;
- t['Edot'] = 0x0116;
- t['Edotaccent'] = 0x0116;
- t['Edotbelow'] = 0x1EB8;
- t['Efcyrillic'] = 0x0424;
- t['Egrave'] = 0x00C8;
- t['Egravesmall'] = 0xF7E8;
- t['Eharmenian'] = 0x0537;
- t['Ehookabove'] = 0x1EBA;
- t['Eightroman'] = 0x2167;
- t['Einvertedbreve'] = 0x0206;
- t['Eiotifiedcyrillic'] = 0x0464;
- t['Elcyrillic'] = 0x041B;
- t['Elevenroman'] = 0x216A;
- t['Emacron'] = 0x0112;
- t['Emacronacute'] = 0x1E16;
- t['Emacrongrave'] = 0x1E14;
- t['Emcyrillic'] = 0x041C;
- t['Emonospace'] = 0xFF25;
- t['Encyrillic'] = 0x041D;
- t['Endescendercyrillic'] = 0x04A2;
- t['Eng'] = 0x014A;
- t['Enghecyrillic'] = 0x04A4;
- t['Enhookcyrillic'] = 0x04C7;
- t['Eogonek'] = 0x0118;
- t['Eopen'] = 0x0190;
- t['Epsilon'] = 0x0395;
- t['Epsilontonos'] = 0x0388;
- t['Ercyrillic'] = 0x0420;
- t['Ereversed'] = 0x018E;
- t['Ereversedcyrillic'] = 0x042D;
- t['Escyrillic'] = 0x0421;
- t['Esdescendercyrillic'] = 0x04AA;
- t['Esh'] = 0x01A9;
- t['Esmall'] = 0xF765;
- t['Eta'] = 0x0397;
- t['Etarmenian'] = 0x0538;
- t['Etatonos'] = 0x0389;
- t['Eth'] = 0x00D0;
- t['Ethsmall'] = 0xF7F0;
- t['Etilde'] = 0x1EBC;
- t['Etildebelow'] = 0x1E1A;
- t['Euro'] = 0x20AC;
- t['Ezh'] = 0x01B7;
- t['Ezhcaron'] = 0x01EE;
- t['Ezhreversed'] = 0x01B8;
- t['F'] = 0x0046;
- t['Fcircle'] = 0x24BB;
- t['Fdotaccent'] = 0x1E1E;
- t['Feharmenian'] = 0x0556;
- t['Feicoptic'] = 0x03E4;
- t['Fhook'] = 0x0191;
- t['Fitacyrillic'] = 0x0472;
- t['Fiveroman'] = 0x2164;
- t['Fmonospace'] = 0xFF26;
- t['Fourroman'] = 0x2163;
- t['Fsmall'] = 0xF766;
- t['G'] = 0x0047;
- t['GBsquare'] = 0x3387;
- t['Gacute'] = 0x01F4;
- t['Gamma'] = 0x0393;
- t['Gammaafrican'] = 0x0194;
- t['Gangiacoptic'] = 0x03EA;
- t['Gbreve'] = 0x011E;
- t['Gcaron'] = 0x01E6;
- t['Gcedilla'] = 0x0122;
- t['Gcircle'] = 0x24BC;
- t['Gcircumflex'] = 0x011C;
- t['Gcommaaccent'] = 0x0122;
- t['Gdot'] = 0x0120;
- t['Gdotaccent'] = 0x0120;
- t['Gecyrillic'] = 0x0413;
- t['Ghadarmenian'] = 0x0542;
- t['Ghemiddlehookcyrillic'] = 0x0494;
- t['Ghestrokecyrillic'] = 0x0492;
- t['Gheupturncyrillic'] = 0x0490;
- t['Ghook'] = 0x0193;
- t['Gimarmenian'] = 0x0533;
- t['Gjecyrillic'] = 0x0403;
- t['Gmacron'] = 0x1E20;
- t['Gmonospace'] = 0xFF27;
- t['Grave'] = 0xF6CE;
- t['Gravesmall'] = 0xF760;
- t['Gsmall'] = 0xF767;
- t['Gsmallhook'] = 0x029B;
- t['Gstroke'] = 0x01E4;
- t['H'] = 0x0048;
- t['H18533'] = 0x25CF;
- t['H18543'] = 0x25AA;
- t['H18551'] = 0x25AB;
- t['H22073'] = 0x25A1;
- t['HPsquare'] = 0x33CB;
- t['Haabkhasiancyrillic'] = 0x04A8;
- t['Hadescendercyrillic'] = 0x04B2;
- t['Hardsigncyrillic'] = 0x042A;
- t['Hbar'] = 0x0126;
- t['Hbrevebelow'] = 0x1E2A;
- t['Hcedilla'] = 0x1E28;
- t['Hcircle'] = 0x24BD;
- t['Hcircumflex'] = 0x0124;
- t['Hdieresis'] = 0x1E26;
- t['Hdotaccent'] = 0x1E22;
- t['Hdotbelow'] = 0x1E24;
- t['Hmonospace'] = 0xFF28;
- t['Hoarmenian'] = 0x0540;
- t['Horicoptic'] = 0x03E8;
- t['Hsmall'] = 0xF768;
- t['Hungarumlaut'] = 0xF6CF;
- t['Hungarumlautsmall'] = 0xF6F8;
- t['Hzsquare'] = 0x3390;
- t['I'] = 0x0049;
- t['IAcyrillic'] = 0x042F;
- t['IJ'] = 0x0132;
- t['IUcyrillic'] = 0x042E;
- t['Iacute'] = 0x00CD;
- t['Iacutesmall'] = 0xF7ED;
- t['Ibreve'] = 0x012C;
- t['Icaron'] = 0x01CF;
- t['Icircle'] = 0x24BE;
- t['Icircumflex'] = 0x00CE;
- t['Icircumflexsmall'] = 0xF7EE;
- t['Icyrillic'] = 0x0406;
- t['Idblgrave'] = 0x0208;
- t['Idieresis'] = 0x00CF;
- t['Idieresisacute'] = 0x1E2E;
- t['Idieresiscyrillic'] = 0x04E4;
- t['Idieresissmall'] = 0xF7EF;
- t['Idot'] = 0x0130;
- t['Idotaccent'] = 0x0130;
- t['Idotbelow'] = 0x1ECA;
- t['Iebrevecyrillic'] = 0x04D6;
- t['Iecyrillic'] = 0x0415;
- t['Ifraktur'] = 0x2111;
- t['Igrave'] = 0x00CC;
- t['Igravesmall'] = 0xF7EC;
- t['Ihookabove'] = 0x1EC8;
- t['Iicyrillic'] = 0x0418;
- t['Iinvertedbreve'] = 0x020A;
- t['Iishortcyrillic'] = 0x0419;
- t['Imacron'] = 0x012A;
- t['Imacroncyrillic'] = 0x04E2;
- t['Imonospace'] = 0xFF29;
- t['Iniarmenian'] = 0x053B;
- t['Iocyrillic'] = 0x0401;
- t['Iogonek'] = 0x012E;
- t['Iota'] = 0x0399;
- t['Iotaafrican'] = 0x0196;
- t['Iotadieresis'] = 0x03AA;
- t['Iotatonos'] = 0x038A;
- t['Ismall'] = 0xF769;
- t['Istroke'] = 0x0197;
- t['Itilde'] = 0x0128;
- t['Itildebelow'] = 0x1E2C;
- t['Izhitsacyrillic'] = 0x0474;
- t['Izhitsadblgravecyrillic'] = 0x0476;
- t['J'] = 0x004A;
- t['Jaarmenian'] = 0x0541;
- t['Jcircle'] = 0x24BF;
- t['Jcircumflex'] = 0x0134;
- t['Jecyrillic'] = 0x0408;
- t['Jheharmenian'] = 0x054B;
- t['Jmonospace'] = 0xFF2A;
- t['Jsmall'] = 0xF76A;
- t['K'] = 0x004B;
- t['KBsquare'] = 0x3385;
- t['KKsquare'] = 0x33CD;
- t['Kabashkircyrillic'] = 0x04A0;
- t['Kacute'] = 0x1E30;
- t['Kacyrillic'] = 0x041A;
- t['Kadescendercyrillic'] = 0x049A;
- t['Kahookcyrillic'] = 0x04C3;
- t['Kappa'] = 0x039A;
- t['Kastrokecyrillic'] = 0x049E;
- t['Kaverticalstrokecyrillic'] = 0x049C;
- t['Kcaron'] = 0x01E8;
- t['Kcedilla'] = 0x0136;
- t['Kcircle'] = 0x24C0;
- t['Kcommaaccent'] = 0x0136;
- t['Kdotbelow'] = 0x1E32;
- t['Keharmenian'] = 0x0554;
- t['Kenarmenian'] = 0x053F;
- t['Khacyrillic'] = 0x0425;
- t['Kheicoptic'] = 0x03E6;
- t['Khook'] = 0x0198;
- t['Kjecyrillic'] = 0x040C;
- t['Klinebelow'] = 0x1E34;
- t['Kmonospace'] = 0xFF2B;
- t['Koppacyrillic'] = 0x0480;
- t['Koppagreek'] = 0x03DE;
- t['Ksicyrillic'] = 0x046E;
- t['Ksmall'] = 0xF76B;
- t['L'] = 0x004C;
- t['LJ'] = 0x01C7;
- t['LL'] = 0xF6BF;
- t['Lacute'] = 0x0139;
- t['Lambda'] = 0x039B;
- t['Lcaron'] = 0x013D;
- t['Lcedilla'] = 0x013B;
- t['Lcircle'] = 0x24C1;
- t['Lcircumflexbelow'] = 0x1E3C;
- t['Lcommaaccent'] = 0x013B;
- t['Ldot'] = 0x013F;
- t['Ldotaccent'] = 0x013F;
- t['Ldotbelow'] = 0x1E36;
- t['Ldotbelowmacron'] = 0x1E38;
- t['Liwnarmenian'] = 0x053C;
- t['Lj'] = 0x01C8;
- t['Ljecyrillic'] = 0x0409;
- t['Llinebelow'] = 0x1E3A;
- t['Lmonospace'] = 0xFF2C;
- t['Lslash'] = 0x0141;
- t['Lslashsmall'] = 0xF6F9;
- t['Lsmall'] = 0xF76C;
- t['M'] = 0x004D;
- t['MBsquare'] = 0x3386;
- t['Macron'] = 0xF6D0;
- t['Macronsmall'] = 0xF7AF;
- t['Macute'] = 0x1E3E;
- t['Mcircle'] = 0x24C2;
- t['Mdotaccent'] = 0x1E40;
- t['Mdotbelow'] = 0x1E42;
- t['Menarmenian'] = 0x0544;
- t['Mmonospace'] = 0xFF2D;
- t['Msmall'] = 0xF76D;
- t['Mturned'] = 0x019C;
- t['Mu'] = 0x039C;
- t['N'] = 0x004E;
- t['NJ'] = 0x01CA;
- t['Nacute'] = 0x0143;
- t['Ncaron'] = 0x0147;
- t['Ncedilla'] = 0x0145;
- t['Ncircle'] = 0x24C3;
- t['Ncircumflexbelow'] = 0x1E4A;
- t['Ncommaaccent'] = 0x0145;
- t['Ndotaccent'] = 0x1E44;
- t['Ndotbelow'] = 0x1E46;
- t['Nhookleft'] = 0x019D;
- t['Nineroman'] = 0x2168;
- t['Nj'] = 0x01CB;
- t['Njecyrillic'] = 0x040A;
- t['Nlinebelow'] = 0x1E48;
- t['Nmonospace'] = 0xFF2E;
- t['Nowarmenian'] = 0x0546;
- t['Nsmall'] = 0xF76E;
- t['Ntilde'] = 0x00D1;
- t['Ntildesmall'] = 0xF7F1;
- t['Nu'] = 0x039D;
- t['O'] = 0x004F;
- t['OE'] = 0x0152;
- t['OEsmall'] = 0xF6FA;
- t['Oacute'] = 0x00D3;
- t['Oacutesmall'] = 0xF7F3;
- t['Obarredcyrillic'] = 0x04E8;
- t['Obarreddieresiscyrillic'] = 0x04EA;
- t['Obreve'] = 0x014E;
- t['Ocaron'] = 0x01D1;
- t['Ocenteredtilde'] = 0x019F;
- t['Ocircle'] = 0x24C4;
- t['Ocircumflex'] = 0x00D4;
- t['Ocircumflexacute'] = 0x1ED0;
- t['Ocircumflexdotbelow'] = 0x1ED8;
- t['Ocircumflexgrave'] = 0x1ED2;
- t['Ocircumflexhookabove'] = 0x1ED4;
- t['Ocircumflexsmall'] = 0xF7F4;
- t['Ocircumflextilde'] = 0x1ED6;
- t['Ocyrillic'] = 0x041E;
- t['Odblacute'] = 0x0150;
- t['Odblgrave'] = 0x020C;
- t['Odieresis'] = 0x00D6;
- t['Odieresiscyrillic'] = 0x04E6;
- t['Odieresissmall'] = 0xF7F6;
- t['Odotbelow'] = 0x1ECC;
- t['Ogoneksmall'] = 0xF6FB;
- t['Ograve'] = 0x00D2;
- t['Ogravesmall'] = 0xF7F2;
- t['Oharmenian'] = 0x0555;
- t['Ohm'] = 0x2126;
- t['Ohookabove'] = 0x1ECE;
- t['Ohorn'] = 0x01A0;
- t['Ohornacute'] = 0x1EDA;
- t['Ohorndotbelow'] = 0x1EE2;
- t['Ohorngrave'] = 0x1EDC;
- t['Ohornhookabove'] = 0x1EDE;
- t['Ohorntilde'] = 0x1EE0;
- t['Ohungarumlaut'] = 0x0150;
- t['Oi'] = 0x01A2;
- t['Oinvertedbreve'] = 0x020E;
- t['Omacron'] = 0x014C;
- t['Omacronacute'] = 0x1E52;
- t['Omacrongrave'] = 0x1E50;
- t['Omega'] = 0x2126;
- t['Omegacyrillic'] = 0x0460;
- t['Omegagreek'] = 0x03A9;
- t['Omegaroundcyrillic'] = 0x047A;
- t['Omegatitlocyrillic'] = 0x047C;
- t['Omegatonos'] = 0x038F;
- t['Omicron'] = 0x039F;
- t['Omicrontonos'] = 0x038C;
- t['Omonospace'] = 0xFF2F;
- t['Oneroman'] = 0x2160;
- t['Oogonek'] = 0x01EA;
- t['Oogonekmacron'] = 0x01EC;
- t['Oopen'] = 0x0186;
- t['Oslash'] = 0x00D8;
- t['Oslashacute'] = 0x01FE;
- t['Oslashsmall'] = 0xF7F8;
- t['Osmall'] = 0xF76F;
- t['Ostrokeacute'] = 0x01FE;
- t['Otcyrillic'] = 0x047E;
- t['Otilde'] = 0x00D5;
- t['Otildeacute'] = 0x1E4C;
- t['Otildedieresis'] = 0x1E4E;
- t['Otildesmall'] = 0xF7F5;
- t['P'] = 0x0050;
- t['Pacute'] = 0x1E54;
- t['Pcircle'] = 0x24C5;
- t['Pdotaccent'] = 0x1E56;
- t['Pecyrillic'] = 0x041F;
- t['Peharmenian'] = 0x054A;
- t['Pemiddlehookcyrillic'] = 0x04A6;
- t['Phi'] = 0x03A6;
- t['Phook'] = 0x01A4;
- t['Pi'] = 0x03A0;
- t['Piwrarmenian'] = 0x0553;
- t['Pmonospace'] = 0xFF30;
- t['Psi'] = 0x03A8;
- t['Psicyrillic'] = 0x0470;
- t['Psmall'] = 0xF770;
- t['Q'] = 0x0051;
- t['Qcircle'] = 0x24C6;
- t['Qmonospace'] = 0xFF31;
- t['Qsmall'] = 0xF771;
- t['R'] = 0x0052;
- t['Raarmenian'] = 0x054C;
- t['Racute'] = 0x0154;
- t['Rcaron'] = 0x0158;
- t['Rcedilla'] = 0x0156;
- t['Rcircle'] = 0x24C7;
- t['Rcommaaccent'] = 0x0156;
- t['Rdblgrave'] = 0x0210;
- t['Rdotaccent'] = 0x1E58;
- t['Rdotbelow'] = 0x1E5A;
- t['Rdotbelowmacron'] = 0x1E5C;
- t['Reharmenian'] = 0x0550;
- t['Rfraktur'] = 0x211C;
- t['Rho'] = 0x03A1;
- t['Ringsmall'] = 0xF6FC;
- t['Rinvertedbreve'] = 0x0212;
- t['Rlinebelow'] = 0x1E5E;
- t['Rmonospace'] = 0xFF32;
- t['Rsmall'] = 0xF772;
- t['Rsmallinverted'] = 0x0281;
- t['Rsmallinvertedsuperior'] = 0x02B6;
- t['S'] = 0x0053;
- t['SF010000'] = 0x250C;
- t['SF020000'] = 0x2514;
- t['SF030000'] = 0x2510;
- t['SF040000'] = 0x2518;
- t['SF050000'] = 0x253C;
- t['SF060000'] = 0x252C;
- t['SF070000'] = 0x2534;
- t['SF080000'] = 0x251C;
- t['SF090000'] = 0x2524;
- t['SF100000'] = 0x2500;
- t['SF110000'] = 0x2502;
- t['SF190000'] = 0x2561;
- t['SF200000'] = 0x2562;
- t['SF210000'] = 0x2556;
- t['SF220000'] = 0x2555;
- t['SF230000'] = 0x2563;
- t['SF240000'] = 0x2551;
- t['SF250000'] = 0x2557;
- t['SF260000'] = 0x255D;
- t['SF270000'] = 0x255C;
- t['SF280000'] = 0x255B;
- t['SF360000'] = 0x255E;
- t['SF370000'] = 0x255F;
- t['SF380000'] = 0x255A;
- t['SF390000'] = 0x2554;
- t['SF400000'] = 0x2569;
- t['SF410000'] = 0x2566;
- t['SF420000'] = 0x2560;
- t['SF430000'] = 0x2550;
- t['SF440000'] = 0x256C;
- t['SF450000'] = 0x2567;
- t['SF460000'] = 0x2568;
- t['SF470000'] = 0x2564;
- t['SF480000'] = 0x2565;
- t['SF490000'] = 0x2559;
- t['SF500000'] = 0x2558;
- t['SF510000'] = 0x2552;
- t['SF520000'] = 0x2553;
- t['SF530000'] = 0x256B;
- t['SF540000'] = 0x256A;
- t['Sacute'] = 0x015A;
- t['Sacutedotaccent'] = 0x1E64;
- t['Sampigreek'] = 0x03E0;
- t['Scaron'] = 0x0160;
- t['Scarondotaccent'] = 0x1E66;
- t['Scaronsmall'] = 0xF6FD;
- t['Scedilla'] = 0x015E;
- t['Schwa'] = 0x018F;
- t['Schwacyrillic'] = 0x04D8;
- t['Schwadieresiscyrillic'] = 0x04DA;
- t['Scircle'] = 0x24C8;
- t['Scircumflex'] = 0x015C;
- t['Scommaaccent'] = 0x0218;
- t['Sdotaccent'] = 0x1E60;
- t['Sdotbelow'] = 0x1E62;
- t['Sdotbelowdotaccent'] = 0x1E68;
- t['Seharmenian'] = 0x054D;
- t['Sevenroman'] = 0x2166;
- t['Shaarmenian'] = 0x0547;
- t['Shacyrillic'] = 0x0428;
- t['Shchacyrillic'] = 0x0429;
- t['Sheicoptic'] = 0x03E2;
- t['Shhacyrillic'] = 0x04BA;
- t['Shimacoptic'] = 0x03EC;
- t['Sigma'] = 0x03A3;
- t['Sixroman'] = 0x2165;
- t['Smonospace'] = 0xFF33;
- t['Softsigncyrillic'] = 0x042C;
- t['Ssmall'] = 0xF773;
- t['Stigmagreek'] = 0x03DA;
- t['T'] = 0x0054;
- t['Tau'] = 0x03A4;
- t['Tbar'] = 0x0166;
- t['Tcaron'] = 0x0164;
- t['Tcedilla'] = 0x0162;
- t['Tcircle'] = 0x24C9;
- t['Tcircumflexbelow'] = 0x1E70;
- t['Tcommaaccent'] = 0x0162;
- t['Tdotaccent'] = 0x1E6A;
- t['Tdotbelow'] = 0x1E6C;
- t['Tecyrillic'] = 0x0422;
- t['Tedescendercyrillic'] = 0x04AC;
- t['Tenroman'] = 0x2169;
- t['Tetsecyrillic'] = 0x04B4;
- t['Theta'] = 0x0398;
- t['Thook'] = 0x01AC;
- t['Thorn'] = 0x00DE;
- t['Thornsmall'] = 0xF7FE;
- t['Threeroman'] = 0x2162;
- t['Tildesmall'] = 0xF6FE;
- t['Tiwnarmenian'] = 0x054F;
- t['Tlinebelow'] = 0x1E6E;
- t['Tmonospace'] = 0xFF34;
- t['Toarmenian'] = 0x0539;
- t['Tonefive'] = 0x01BC;
- t['Tonesix'] = 0x0184;
- t['Tonetwo'] = 0x01A7;
- t['Tretroflexhook'] = 0x01AE;
- t['Tsecyrillic'] = 0x0426;
- t['Tshecyrillic'] = 0x040B;
- t['Tsmall'] = 0xF774;
- t['Twelveroman'] = 0x216B;
- t['Tworoman'] = 0x2161;
- t['U'] = 0x0055;
- t['Uacute'] = 0x00DA;
- t['Uacutesmall'] = 0xF7FA;
- t['Ubreve'] = 0x016C;
- t['Ucaron'] = 0x01D3;
- t['Ucircle'] = 0x24CA;
- t['Ucircumflex'] = 0x00DB;
- t['Ucircumflexbelow'] = 0x1E76;
- t['Ucircumflexsmall'] = 0xF7FB;
- t['Ucyrillic'] = 0x0423;
- t['Udblacute'] = 0x0170;
- t['Udblgrave'] = 0x0214;
- t['Udieresis'] = 0x00DC;
- t['Udieresisacute'] = 0x01D7;
- t['Udieresisbelow'] = 0x1E72;
- t['Udieresiscaron'] = 0x01D9;
- t['Udieresiscyrillic'] = 0x04F0;
- t['Udieresisgrave'] = 0x01DB;
- t['Udieresismacron'] = 0x01D5;
- t['Udieresissmall'] = 0xF7FC;
- t['Udotbelow'] = 0x1EE4;
- t['Ugrave'] = 0x00D9;
- t['Ugravesmall'] = 0xF7F9;
- t['Uhookabove'] = 0x1EE6;
- t['Uhorn'] = 0x01AF;
- t['Uhornacute'] = 0x1EE8;
- t['Uhorndotbelow'] = 0x1EF0;
- t['Uhorngrave'] = 0x1EEA;
- t['Uhornhookabove'] = 0x1EEC;
- t['Uhorntilde'] = 0x1EEE;
- t['Uhungarumlaut'] = 0x0170;
- t['Uhungarumlautcyrillic'] = 0x04F2;
- t['Uinvertedbreve'] = 0x0216;
- t['Ukcyrillic'] = 0x0478;
- t['Umacron'] = 0x016A;
- t['Umacroncyrillic'] = 0x04EE;
- t['Umacrondieresis'] = 0x1E7A;
- t['Umonospace'] = 0xFF35;
- t['Uogonek'] = 0x0172;
- t['Upsilon'] = 0x03A5;
- t['Upsilon1'] = 0x03D2;
- t['Upsilonacutehooksymbolgreek'] = 0x03D3;
- t['Upsilonafrican'] = 0x01B1;
- t['Upsilondieresis'] = 0x03AB;
- t['Upsilondieresishooksymbolgreek'] = 0x03D4;
- t['Upsilonhooksymbol'] = 0x03D2;
- t['Upsilontonos'] = 0x038E;
- t['Uring'] = 0x016E;
- t['Ushortcyrillic'] = 0x040E;
- t['Usmall'] = 0xF775;
- t['Ustraightcyrillic'] = 0x04AE;
- t['Ustraightstrokecyrillic'] = 0x04B0;
- t['Utilde'] = 0x0168;
- t['Utildeacute'] = 0x1E78;
- t['Utildebelow'] = 0x1E74;
- t['V'] = 0x0056;
- t['Vcircle'] = 0x24CB;
- t['Vdotbelow'] = 0x1E7E;
- t['Vecyrillic'] = 0x0412;
- t['Vewarmenian'] = 0x054E;
- t['Vhook'] = 0x01B2;
- t['Vmonospace'] = 0xFF36;
- t['Voarmenian'] = 0x0548;
- t['Vsmall'] = 0xF776;
- t['Vtilde'] = 0x1E7C;
- t['W'] = 0x0057;
- t['Wacute'] = 0x1E82;
- t['Wcircle'] = 0x24CC;
- t['Wcircumflex'] = 0x0174;
- t['Wdieresis'] = 0x1E84;
- t['Wdotaccent'] = 0x1E86;
- t['Wdotbelow'] = 0x1E88;
- t['Wgrave'] = 0x1E80;
- t['Wmonospace'] = 0xFF37;
- t['Wsmall'] = 0xF777;
- t['X'] = 0x0058;
- t['Xcircle'] = 0x24CD;
- t['Xdieresis'] = 0x1E8C;
- t['Xdotaccent'] = 0x1E8A;
- t['Xeharmenian'] = 0x053D;
- t['Xi'] = 0x039E;
- t['Xmonospace'] = 0xFF38;
- t['Xsmall'] = 0xF778;
- t['Y'] = 0x0059;
- t['Yacute'] = 0x00DD;
- t['Yacutesmall'] = 0xF7FD;
- t['Yatcyrillic'] = 0x0462;
- t['Ycircle'] = 0x24CE;
- t['Ycircumflex'] = 0x0176;
- t['Ydieresis'] = 0x0178;
- t['Ydieresissmall'] = 0xF7FF;
- t['Ydotaccent'] = 0x1E8E;
- t['Ydotbelow'] = 0x1EF4;
- t['Yericyrillic'] = 0x042B;
- t['Yerudieresiscyrillic'] = 0x04F8;
- t['Ygrave'] = 0x1EF2;
- t['Yhook'] = 0x01B3;
- t['Yhookabove'] = 0x1EF6;
- t['Yiarmenian'] = 0x0545;
- t['Yicyrillic'] = 0x0407;
- t['Yiwnarmenian'] = 0x0552;
- t['Ymonospace'] = 0xFF39;
- t['Ysmall'] = 0xF779;
- t['Ytilde'] = 0x1EF8;
- t['Yusbigcyrillic'] = 0x046A;
- t['Yusbigiotifiedcyrillic'] = 0x046C;
- t['Yuslittlecyrillic'] = 0x0466;
- t['Yuslittleiotifiedcyrillic'] = 0x0468;
- t['Z'] = 0x005A;
- t['Zaarmenian'] = 0x0536;
- t['Zacute'] = 0x0179;
- t['Zcaron'] = 0x017D;
- t['Zcaronsmall'] = 0xF6FF;
- t['Zcircle'] = 0x24CF;
- t['Zcircumflex'] = 0x1E90;
- t['Zdot'] = 0x017B;
- t['Zdotaccent'] = 0x017B;
- t['Zdotbelow'] = 0x1E92;
- t['Zecyrillic'] = 0x0417;
- t['Zedescendercyrillic'] = 0x0498;
- t['Zedieresiscyrillic'] = 0x04DE;
- t['Zeta'] = 0x0396;
- t['Zhearmenian'] = 0x053A;
- t['Zhebrevecyrillic'] = 0x04C1;
- t['Zhecyrillic'] = 0x0416;
- t['Zhedescendercyrillic'] = 0x0496;
- t['Zhedieresiscyrillic'] = 0x04DC;
- t['Zlinebelow'] = 0x1E94;
- t['Zmonospace'] = 0xFF3A;
- t['Zsmall'] = 0xF77A;
- t['Zstroke'] = 0x01B5;
- t['a'] = 0x0061;
- t['aabengali'] = 0x0986;
- t['aacute'] = 0x00E1;
- t['aadeva'] = 0x0906;
- t['aagujarati'] = 0x0A86;
- t['aagurmukhi'] = 0x0A06;
- t['aamatragurmukhi'] = 0x0A3E;
- t['aarusquare'] = 0x3303;
- t['aavowelsignbengali'] = 0x09BE;
- t['aavowelsigndeva'] = 0x093E;
- t['aavowelsigngujarati'] = 0x0ABE;
- t['abbreviationmarkarmenian'] = 0x055F;
- t['abbreviationsigndeva'] = 0x0970;
- t['abengali'] = 0x0985;
- t['abopomofo'] = 0x311A;
- t['abreve'] = 0x0103;
- t['abreveacute'] = 0x1EAF;
- t['abrevecyrillic'] = 0x04D1;
- t['abrevedotbelow'] = 0x1EB7;
- t['abrevegrave'] = 0x1EB1;
- t['abrevehookabove'] = 0x1EB3;
- t['abrevetilde'] = 0x1EB5;
- t['acaron'] = 0x01CE;
- t['acircle'] = 0x24D0;
- t['acircumflex'] = 0x00E2;
- t['acircumflexacute'] = 0x1EA5;
- t['acircumflexdotbelow'] = 0x1EAD;
- t['acircumflexgrave'] = 0x1EA7;
- t['acircumflexhookabove'] = 0x1EA9;
- t['acircumflextilde'] = 0x1EAB;
- t['acute'] = 0x00B4;
- t['acutebelowcmb'] = 0x0317;
- t['acutecmb'] = 0x0301;
- t['acutecomb'] = 0x0301;
- t['acutedeva'] = 0x0954;
- t['acutelowmod'] = 0x02CF;
- t['acutetonecmb'] = 0x0341;
- t['acyrillic'] = 0x0430;
- t['adblgrave'] = 0x0201;
- t['addakgurmukhi'] = 0x0A71;
- t['adeva'] = 0x0905;
- t['adieresis'] = 0x00E4;
- t['adieresiscyrillic'] = 0x04D3;
- t['adieresismacron'] = 0x01DF;
- t['adotbelow'] = 0x1EA1;
- t['adotmacron'] = 0x01E1;
- t['ae'] = 0x00E6;
- t['aeacute'] = 0x01FD;
- t['aekorean'] = 0x3150;
- t['aemacron'] = 0x01E3;
- t['afii00208'] = 0x2015;
- t['afii08941'] = 0x20A4;
- t['afii10017'] = 0x0410;
- t['afii10018'] = 0x0411;
- t['afii10019'] = 0x0412;
- t['afii10020'] = 0x0413;
- t['afii10021'] = 0x0414;
- t['afii10022'] = 0x0415;
- t['afii10023'] = 0x0401;
- t['afii10024'] = 0x0416;
- t['afii10025'] = 0x0417;
- t['afii10026'] = 0x0418;
- t['afii10027'] = 0x0419;
- t['afii10028'] = 0x041A;
- t['afii10029'] = 0x041B;
- t['afii10030'] = 0x041C;
- t['afii10031'] = 0x041D;
- t['afii10032'] = 0x041E;
- t['afii10033'] = 0x041F;
- t['afii10034'] = 0x0420;
- t['afii10035'] = 0x0421;
- t['afii10036'] = 0x0422;
- t['afii10037'] = 0x0423;
- t['afii10038'] = 0x0424;
- t['afii10039'] = 0x0425;
- t['afii10040'] = 0x0426;
- t['afii10041'] = 0x0427;
- t['afii10042'] = 0x0428;
- t['afii10043'] = 0x0429;
- t['afii10044'] = 0x042A;
- t['afii10045'] = 0x042B;
- t['afii10046'] = 0x042C;
- t['afii10047'] = 0x042D;
- t['afii10048'] = 0x042E;
- t['afii10049'] = 0x042F;
- t['afii10050'] = 0x0490;
- t['afii10051'] = 0x0402;
- t['afii10052'] = 0x0403;
- t['afii10053'] = 0x0404;
- t['afii10054'] = 0x0405;
- t['afii10055'] = 0x0406;
- t['afii10056'] = 0x0407;
- t['afii10057'] = 0x0408;
- t['afii10058'] = 0x0409;
- t['afii10059'] = 0x040A;
- t['afii10060'] = 0x040B;
- t['afii10061'] = 0x040C;
- t['afii10062'] = 0x040E;
- t['afii10063'] = 0xF6C4;
- t['afii10064'] = 0xF6C5;
- t['afii10065'] = 0x0430;
- t['afii10066'] = 0x0431;
- t['afii10067'] = 0x0432;
- t['afii10068'] = 0x0433;
- t['afii10069'] = 0x0434;
- t['afii10070'] = 0x0435;
- t['afii10071'] = 0x0451;
- t['afii10072'] = 0x0436;
- t['afii10073'] = 0x0437;
- t['afii10074'] = 0x0438;
- t['afii10075'] = 0x0439;
- t['afii10076'] = 0x043A;
- t['afii10077'] = 0x043B;
- t['afii10078'] = 0x043C;
- t['afii10079'] = 0x043D;
- t['afii10080'] = 0x043E;
- t['afii10081'] = 0x043F;
- t['afii10082'] = 0x0440;
- t['afii10083'] = 0x0441;
- t['afii10084'] = 0x0442;
- t['afii10085'] = 0x0443;
- t['afii10086'] = 0x0444;
- t['afii10087'] = 0x0445;
- t['afii10088'] = 0x0446;
- t['afii10089'] = 0x0447;
- t['afii10090'] = 0x0448;
- t['afii10091'] = 0x0449;
- t['afii10092'] = 0x044A;
- t['afii10093'] = 0x044B;
- t['afii10094'] = 0x044C;
- t['afii10095'] = 0x044D;
- t['afii10096'] = 0x044E;
- t['afii10097'] = 0x044F;
- t['afii10098'] = 0x0491;
- t['afii10099'] = 0x0452;
- t['afii10100'] = 0x0453;
- t['afii10101'] = 0x0454;
- t['afii10102'] = 0x0455;
- t['afii10103'] = 0x0456;
- t['afii10104'] = 0x0457;
- t['afii10105'] = 0x0458;
- t['afii10106'] = 0x0459;
- t['afii10107'] = 0x045A;
- t['afii10108'] = 0x045B;
- t['afii10109'] = 0x045C;
- t['afii10110'] = 0x045E;
- t['afii10145'] = 0x040F;
- t['afii10146'] = 0x0462;
- t['afii10147'] = 0x0472;
- t['afii10148'] = 0x0474;
- t['afii10192'] = 0xF6C6;
- t['afii10193'] = 0x045F;
- t['afii10194'] = 0x0463;
- t['afii10195'] = 0x0473;
- t['afii10196'] = 0x0475;
- t['afii10831'] = 0xF6C7;
- t['afii10832'] = 0xF6C8;
- t['afii10846'] = 0x04D9;
- t['afii299'] = 0x200E;
- t['afii300'] = 0x200F;
- t['afii301'] = 0x200D;
- t['afii57381'] = 0x066A;
- t['afii57388'] = 0x060C;
- t['afii57392'] = 0x0660;
- t['afii57393'] = 0x0661;
- t['afii57394'] = 0x0662;
- t['afii57395'] = 0x0663;
- t['afii57396'] = 0x0664;
- t['afii57397'] = 0x0665;
- t['afii57398'] = 0x0666;
- t['afii57399'] = 0x0667;
- t['afii57400'] = 0x0668;
- t['afii57401'] = 0x0669;
- t['afii57403'] = 0x061B;
- t['afii57407'] = 0x061F;
- t['afii57409'] = 0x0621;
- t['afii57410'] = 0x0622;
- t['afii57411'] = 0x0623;
- t['afii57412'] = 0x0624;
- t['afii57413'] = 0x0625;
- t['afii57414'] = 0x0626;
- t['afii57415'] = 0x0627;
- t['afii57416'] = 0x0628;
- t['afii57417'] = 0x0629;
- t['afii57418'] = 0x062A;
- t['afii57419'] = 0x062B;
- t['afii57420'] = 0x062C;
- t['afii57421'] = 0x062D;
- t['afii57422'] = 0x062E;
- t['afii57423'] = 0x062F;
- t['afii57424'] = 0x0630;
- t['afii57425'] = 0x0631;
- t['afii57426'] = 0x0632;
- t['afii57427'] = 0x0633;
- t['afii57428'] = 0x0634;
- t['afii57429'] = 0x0635;
- t['afii57430'] = 0x0636;
- t['afii57431'] = 0x0637;
- t['afii57432'] = 0x0638;
- t['afii57433'] = 0x0639;
- t['afii57434'] = 0x063A;
- t['afii57440'] = 0x0640;
- t['afii57441'] = 0x0641;
- t['afii57442'] = 0x0642;
- t['afii57443'] = 0x0643;
- t['afii57444'] = 0x0644;
- t['afii57445'] = 0x0645;
- t['afii57446'] = 0x0646;
- t['afii57448'] = 0x0648;
- t['afii57449'] = 0x0649;
- t['afii57450'] = 0x064A;
- t['afii57451'] = 0x064B;
- t['afii57452'] = 0x064C;
- t['afii57453'] = 0x064D;
- t['afii57454'] = 0x064E;
- t['afii57455'] = 0x064F;
- t['afii57456'] = 0x0650;
- t['afii57457'] = 0x0651;
- t['afii57458'] = 0x0652;
- t['afii57470'] = 0x0647;
- t['afii57505'] = 0x06A4;
- t['afii57506'] = 0x067E;
- t['afii57507'] = 0x0686;
- t['afii57508'] = 0x0698;
- t['afii57509'] = 0x06AF;
- t['afii57511'] = 0x0679;
- t['afii57512'] = 0x0688;
- t['afii57513'] = 0x0691;
- t['afii57514'] = 0x06BA;
- t['afii57519'] = 0x06D2;
- t['afii57534'] = 0x06D5;
- t['afii57636'] = 0x20AA;
- t['afii57645'] = 0x05BE;
- t['afii57658'] = 0x05C3;
- t['afii57664'] = 0x05D0;
- t['afii57665'] = 0x05D1;
- t['afii57666'] = 0x05D2;
- t['afii57667'] = 0x05D3;
- t['afii57668'] = 0x05D4;
- t['afii57669'] = 0x05D5;
- t['afii57670'] = 0x05D6;
- t['afii57671'] = 0x05D7;
- t['afii57672'] = 0x05D8;
- t['afii57673'] = 0x05D9;
- t['afii57674'] = 0x05DA;
- t['afii57675'] = 0x05DB;
- t['afii57676'] = 0x05DC;
- t['afii57677'] = 0x05DD;
- t['afii57678'] = 0x05DE;
- t['afii57679'] = 0x05DF;
- t['afii57680'] = 0x05E0;
- t['afii57681'] = 0x05E1;
- t['afii57682'] = 0x05E2;
- t['afii57683'] = 0x05E3;
- t['afii57684'] = 0x05E4;
- t['afii57685'] = 0x05E5;
- t['afii57686'] = 0x05E6;
- t['afii57687'] = 0x05E7;
- t['afii57688'] = 0x05E8;
- t['afii57689'] = 0x05E9;
- t['afii57690'] = 0x05EA;
- t['afii57694'] = 0xFB2A;
- t['afii57695'] = 0xFB2B;
- t['afii57700'] = 0xFB4B;
- t['afii57705'] = 0xFB1F;
- t['afii57716'] = 0x05F0;
- t['afii57717'] = 0x05F1;
- t['afii57718'] = 0x05F2;
- t['afii57723'] = 0xFB35;
- t['afii57793'] = 0x05B4;
- t['afii57794'] = 0x05B5;
- t['afii57795'] = 0x05B6;
- t['afii57796'] = 0x05BB;
- t['afii57797'] = 0x05B8;
- t['afii57798'] = 0x05B7;
- t['afii57799'] = 0x05B0;
- t['afii57800'] = 0x05B2;
- t['afii57801'] = 0x05B1;
- t['afii57802'] = 0x05B3;
- t['afii57803'] = 0x05C2;
- t['afii57804'] = 0x05C1;
- t['afii57806'] = 0x05B9;
- t['afii57807'] = 0x05BC;
- t['afii57839'] = 0x05BD;
- t['afii57841'] = 0x05BF;
- t['afii57842'] = 0x05C0;
- t['afii57929'] = 0x02BC;
- t['afii61248'] = 0x2105;
- t['afii61289'] = 0x2113;
- t['afii61352'] = 0x2116;
- t['afii61573'] = 0x202C;
- t['afii61574'] = 0x202D;
- t['afii61575'] = 0x202E;
- t['afii61664'] = 0x200C;
- t['afii63167'] = 0x066D;
- t['afii64937'] = 0x02BD;
- t['agrave'] = 0x00E0;
- t['agujarati'] = 0x0A85;
- t['agurmukhi'] = 0x0A05;
- t['ahiragana'] = 0x3042;
- t['ahookabove'] = 0x1EA3;
- t['aibengali'] = 0x0990;
- t['aibopomofo'] = 0x311E;
- t['aideva'] = 0x0910;
- t['aiecyrillic'] = 0x04D5;
- t['aigujarati'] = 0x0A90;
- t['aigurmukhi'] = 0x0A10;
- t['aimatragurmukhi'] = 0x0A48;
- t['ainarabic'] = 0x0639;
- t['ainfinalarabic'] = 0xFECA;
- t['aininitialarabic'] = 0xFECB;
- t['ainmedialarabic'] = 0xFECC;
- t['ainvertedbreve'] = 0x0203;
- t['aivowelsignbengali'] = 0x09C8;
- t['aivowelsigndeva'] = 0x0948;
- t['aivowelsigngujarati'] = 0x0AC8;
- t['akatakana'] = 0x30A2;
- t['akatakanahalfwidth'] = 0xFF71;
- t['akorean'] = 0x314F;
- t['alef'] = 0x05D0;
- t['alefarabic'] = 0x0627;
- t['alefdageshhebrew'] = 0xFB30;
- t['aleffinalarabic'] = 0xFE8E;
- t['alefhamzaabovearabic'] = 0x0623;
- t['alefhamzaabovefinalarabic'] = 0xFE84;
- t['alefhamzabelowarabic'] = 0x0625;
- t['alefhamzabelowfinalarabic'] = 0xFE88;
- t['alefhebrew'] = 0x05D0;
- t['aleflamedhebrew'] = 0xFB4F;
- t['alefmaddaabovearabic'] = 0x0622;
- t['alefmaddaabovefinalarabic'] = 0xFE82;
- t['alefmaksuraarabic'] = 0x0649;
- t['alefmaksurafinalarabic'] = 0xFEF0;
- t['alefmaksurainitialarabic'] = 0xFEF3;
- t['alefmaksuramedialarabic'] = 0xFEF4;
- t['alefpatahhebrew'] = 0xFB2E;
- t['alefqamatshebrew'] = 0xFB2F;
- t['aleph'] = 0x2135;
- t['allequal'] = 0x224C;
- t['alpha'] = 0x03B1;
- t['alphatonos'] = 0x03AC;
- t['amacron'] = 0x0101;
- t['amonospace'] = 0xFF41;
- t['ampersand'] = 0x0026;
- t['ampersandmonospace'] = 0xFF06;
- t['ampersandsmall'] = 0xF726;
- t['amsquare'] = 0x33C2;
- t['anbopomofo'] = 0x3122;
- t['angbopomofo'] = 0x3124;
- t['angbracketleft'] = 0x3008;
- t['angbracketright'] = 0x3009;
- t['angkhankhuthai'] = 0x0E5A;
- t['angle'] = 0x2220;
- t['anglebracketleft'] = 0x3008;
- t['anglebracketleftvertical'] = 0xFE3F;
- t['anglebracketright'] = 0x3009;
- t['anglebracketrightvertical'] = 0xFE40;
- t['angleleft'] = 0x2329;
- t['angleright'] = 0x232A;
- t['angstrom'] = 0x212B;
- t['anoteleia'] = 0x0387;
- t['anudattadeva'] = 0x0952;
- t['anusvarabengali'] = 0x0982;
- t['anusvaradeva'] = 0x0902;
- t['anusvaragujarati'] = 0x0A82;
- t['aogonek'] = 0x0105;
- t['apaatosquare'] = 0x3300;
- t['aparen'] = 0x249C;
- t['apostrophearmenian'] = 0x055A;
- t['apostrophemod'] = 0x02BC;
- t['apple'] = 0xF8FF;
- t['approaches'] = 0x2250;
- t['approxequal'] = 0x2248;
- t['approxequalorimage'] = 0x2252;
- t['approximatelyequal'] = 0x2245;
- t['araeaekorean'] = 0x318E;
- t['araeakorean'] = 0x318D;
- t['arc'] = 0x2312;
- t['arighthalfring'] = 0x1E9A;
- t['aring'] = 0x00E5;
- t['aringacute'] = 0x01FB;
- t['aringbelow'] = 0x1E01;
- t['arrowboth'] = 0x2194;
- t['arrowdashdown'] = 0x21E3;
- t['arrowdashleft'] = 0x21E0;
- t['arrowdashright'] = 0x21E2;
- t['arrowdashup'] = 0x21E1;
- t['arrowdblboth'] = 0x21D4;
- t['arrowdbldown'] = 0x21D3;
- t['arrowdblleft'] = 0x21D0;
- t['arrowdblright'] = 0x21D2;
- t['arrowdblup'] = 0x21D1;
- t['arrowdown'] = 0x2193;
- t['arrowdownleft'] = 0x2199;
- t['arrowdownright'] = 0x2198;
- t['arrowdownwhite'] = 0x21E9;
- t['arrowheaddownmod'] = 0x02C5;
- t['arrowheadleftmod'] = 0x02C2;
- t['arrowheadrightmod'] = 0x02C3;
- t['arrowheadupmod'] = 0x02C4;
- t['arrowhorizex'] = 0xF8E7;
- t['arrowleft'] = 0x2190;
- t['arrowleftdbl'] = 0x21D0;
- t['arrowleftdblstroke'] = 0x21CD;
- t['arrowleftoverright'] = 0x21C6;
- t['arrowleftwhite'] = 0x21E6;
- t['arrowright'] = 0x2192;
- t['arrowrightdblstroke'] = 0x21CF;
- t['arrowrightheavy'] = 0x279E;
- t['arrowrightoverleft'] = 0x21C4;
- t['arrowrightwhite'] = 0x21E8;
- t['arrowtableft'] = 0x21E4;
- t['arrowtabright'] = 0x21E5;
- t['arrowup'] = 0x2191;
- t['arrowupdn'] = 0x2195;
- t['arrowupdnbse'] = 0x21A8;
- t['arrowupdownbase'] = 0x21A8;
- t['arrowupleft'] = 0x2196;
- t['arrowupleftofdown'] = 0x21C5;
- t['arrowupright'] = 0x2197;
- t['arrowupwhite'] = 0x21E7;
- t['arrowvertex'] = 0xF8E6;
- t['asciicircum'] = 0x005E;
- t['asciicircummonospace'] = 0xFF3E;
- t['asciitilde'] = 0x007E;
- t['asciitildemonospace'] = 0xFF5E;
- t['ascript'] = 0x0251;
- t['ascriptturned'] = 0x0252;
- t['asmallhiragana'] = 0x3041;
- t['asmallkatakana'] = 0x30A1;
- t['asmallkatakanahalfwidth'] = 0xFF67;
- t['asterisk'] = 0x002A;
- t['asteriskaltonearabic'] = 0x066D;
- t['asteriskarabic'] = 0x066D;
- t['asteriskmath'] = 0x2217;
- t['asteriskmonospace'] = 0xFF0A;
- t['asterisksmall'] = 0xFE61;
- t['asterism'] = 0x2042;
- t['asuperior'] = 0xF6E9;
- t['asymptoticallyequal'] = 0x2243;
- t['at'] = 0x0040;
- t['atilde'] = 0x00E3;
- t['atmonospace'] = 0xFF20;
- t['atsmall'] = 0xFE6B;
- t['aturned'] = 0x0250;
- t['aubengali'] = 0x0994;
- t['aubopomofo'] = 0x3120;
- t['audeva'] = 0x0914;
- t['augujarati'] = 0x0A94;
- t['augurmukhi'] = 0x0A14;
- t['aulengthmarkbengali'] = 0x09D7;
- t['aumatragurmukhi'] = 0x0A4C;
- t['auvowelsignbengali'] = 0x09CC;
- t['auvowelsigndeva'] = 0x094C;
- t['auvowelsigngujarati'] = 0x0ACC;
- t['avagrahadeva'] = 0x093D;
- t['aybarmenian'] = 0x0561;
- t['ayin'] = 0x05E2;
- t['ayinaltonehebrew'] = 0xFB20;
- t['ayinhebrew'] = 0x05E2;
- t['b'] = 0x0062;
- t['babengali'] = 0x09AC;
- t['backslash'] = 0x005C;
- t['backslashmonospace'] = 0xFF3C;
- t['badeva'] = 0x092C;
- t['bagujarati'] = 0x0AAC;
- t['bagurmukhi'] = 0x0A2C;
- t['bahiragana'] = 0x3070;
- t['bahtthai'] = 0x0E3F;
- t['bakatakana'] = 0x30D0;
- t['bar'] = 0x007C;
- t['barmonospace'] = 0xFF5C;
- t['bbopomofo'] = 0x3105;
- t['bcircle'] = 0x24D1;
- t['bdotaccent'] = 0x1E03;
- t['bdotbelow'] = 0x1E05;
- t['beamedsixteenthnotes'] = 0x266C;
- t['because'] = 0x2235;
- t['becyrillic'] = 0x0431;
- t['beharabic'] = 0x0628;
- t['behfinalarabic'] = 0xFE90;
- t['behinitialarabic'] = 0xFE91;
- t['behiragana'] = 0x3079;
- t['behmedialarabic'] = 0xFE92;
- t['behmeeminitialarabic'] = 0xFC9F;
- t['behmeemisolatedarabic'] = 0xFC08;
- t['behnoonfinalarabic'] = 0xFC6D;
- t['bekatakana'] = 0x30D9;
- t['benarmenian'] = 0x0562;
- t['bet'] = 0x05D1;
- t['beta'] = 0x03B2;
- t['betasymbolgreek'] = 0x03D0;
- t['betdagesh'] = 0xFB31;
- t['betdageshhebrew'] = 0xFB31;
- t['bethebrew'] = 0x05D1;
- t['betrafehebrew'] = 0xFB4C;
- t['bhabengali'] = 0x09AD;
- t['bhadeva'] = 0x092D;
- t['bhagujarati'] = 0x0AAD;
- t['bhagurmukhi'] = 0x0A2D;
- t['bhook'] = 0x0253;
- t['bihiragana'] = 0x3073;
- t['bikatakana'] = 0x30D3;
- t['bilabialclick'] = 0x0298;
- t['bindigurmukhi'] = 0x0A02;
- t['birusquare'] = 0x3331;
- t['blackcircle'] = 0x25CF;
- t['blackdiamond'] = 0x25C6;
- t['blackdownpointingtriangle'] = 0x25BC;
- t['blackleftpointingpointer'] = 0x25C4;
- t['blackleftpointingtriangle'] = 0x25C0;
- t['blacklenticularbracketleft'] = 0x3010;
- t['blacklenticularbracketleftvertical'] = 0xFE3B;
- t['blacklenticularbracketright'] = 0x3011;
- t['blacklenticularbracketrightvertical'] = 0xFE3C;
- t['blacklowerlefttriangle'] = 0x25E3;
- t['blacklowerrighttriangle'] = 0x25E2;
- t['blackrectangle'] = 0x25AC;
- t['blackrightpointingpointer'] = 0x25BA;
- t['blackrightpointingtriangle'] = 0x25B6;
- t['blacksmallsquare'] = 0x25AA;
- t['blacksmilingface'] = 0x263B;
- t['blacksquare'] = 0x25A0;
- t['blackstar'] = 0x2605;
- t['blackupperlefttriangle'] = 0x25E4;
- t['blackupperrighttriangle'] = 0x25E5;
- t['blackuppointingsmalltriangle'] = 0x25B4;
- t['blackuppointingtriangle'] = 0x25B2;
- t['blank'] = 0x2423;
- t['blinebelow'] = 0x1E07;
- t['block'] = 0x2588;
- t['bmonospace'] = 0xFF42;
- t['bobaimaithai'] = 0x0E1A;
- t['bohiragana'] = 0x307C;
- t['bokatakana'] = 0x30DC;
- t['bparen'] = 0x249D;
- t['bqsquare'] = 0x33C3;
- t['braceex'] = 0xF8F4;
- t['braceleft'] = 0x007B;
- t['braceleftbt'] = 0xF8F3;
- t['braceleftmid'] = 0xF8F2;
- t['braceleftmonospace'] = 0xFF5B;
- t['braceleftsmall'] = 0xFE5B;
- t['bracelefttp'] = 0xF8F1;
- t['braceleftvertical'] = 0xFE37;
- t['braceright'] = 0x007D;
- t['bracerightbt'] = 0xF8FE;
- t['bracerightmid'] = 0xF8FD;
- t['bracerightmonospace'] = 0xFF5D;
- t['bracerightsmall'] = 0xFE5C;
- t['bracerighttp'] = 0xF8FC;
- t['bracerightvertical'] = 0xFE38;
- t['bracketleft'] = 0x005B;
- t['bracketleftbt'] = 0xF8F0;
- t['bracketleftex'] = 0xF8EF;
- t['bracketleftmonospace'] = 0xFF3B;
- t['bracketlefttp'] = 0xF8EE;
- t['bracketright'] = 0x005D;
- t['bracketrightbt'] = 0xF8FB;
- t['bracketrightex'] = 0xF8FA;
- t['bracketrightmonospace'] = 0xFF3D;
- t['bracketrighttp'] = 0xF8F9;
- t['breve'] = 0x02D8;
- t['brevebelowcmb'] = 0x032E;
- t['brevecmb'] = 0x0306;
- t['breveinvertedbelowcmb'] = 0x032F;
- t['breveinvertedcmb'] = 0x0311;
- t['breveinverteddoublecmb'] = 0x0361;
- t['bridgebelowcmb'] = 0x032A;
- t['bridgeinvertedbelowcmb'] = 0x033A;
- t['brokenbar'] = 0x00A6;
- t['bstroke'] = 0x0180;
- t['bsuperior'] = 0xF6EA;
- t['btopbar'] = 0x0183;
- t['buhiragana'] = 0x3076;
- t['bukatakana'] = 0x30D6;
- t['bullet'] = 0x2022;
- t['bulletinverse'] = 0x25D8;
- t['bulletoperator'] = 0x2219;
- t['bullseye'] = 0x25CE;
- t['c'] = 0x0063;
- t['caarmenian'] = 0x056E;
- t['cabengali'] = 0x099A;
- t['cacute'] = 0x0107;
- t['cadeva'] = 0x091A;
- t['cagujarati'] = 0x0A9A;
- t['cagurmukhi'] = 0x0A1A;
- t['calsquare'] = 0x3388;
- t['candrabindubengali'] = 0x0981;
- t['candrabinducmb'] = 0x0310;
- t['candrabindudeva'] = 0x0901;
- t['candrabindugujarati'] = 0x0A81;
- t['capslock'] = 0x21EA;
- t['careof'] = 0x2105;
- t['caron'] = 0x02C7;
- t['caronbelowcmb'] = 0x032C;
- t['caroncmb'] = 0x030C;
- t['carriagereturn'] = 0x21B5;
- t['cbopomofo'] = 0x3118;
- t['ccaron'] = 0x010D;
- t['ccedilla'] = 0x00E7;
- t['ccedillaacute'] = 0x1E09;
- t['ccircle'] = 0x24D2;
- t['ccircumflex'] = 0x0109;
- t['ccurl'] = 0x0255;
- t['cdot'] = 0x010B;
- t['cdotaccent'] = 0x010B;
- t['cdsquare'] = 0x33C5;
- t['cedilla'] = 0x00B8;
- t['cedillacmb'] = 0x0327;
- t['cent'] = 0x00A2;
- t['centigrade'] = 0x2103;
- t['centinferior'] = 0xF6DF;
- t['centmonospace'] = 0xFFE0;
- t['centoldstyle'] = 0xF7A2;
- t['centsuperior'] = 0xF6E0;
- t['chaarmenian'] = 0x0579;
- t['chabengali'] = 0x099B;
- t['chadeva'] = 0x091B;
- t['chagujarati'] = 0x0A9B;
- t['chagurmukhi'] = 0x0A1B;
- t['chbopomofo'] = 0x3114;
- t['cheabkhasiancyrillic'] = 0x04BD;
- t['checkmark'] = 0x2713;
- t['checyrillic'] = 0x0447;
- t['chedescenderabkhasiancyrillic'] = 0x04BF;
- t['chedescendercyrillic'] = 0x04B7;
- t['chedieresiscyrillic'] = 0x04F5;
- t['cheharmenian'] = 0x0573;
- t['chekhakassiancyrillic'] = 0x04CC;
- t['cheverticalstrokecyrillic'] = 0x04B9;
- t['chi'] = 0x03C7;
- t['chieuchacirclekorean'] = 0x3277;
- t['chieuchaparenkorean'] = 0x3217;
- t['chieuchcirclekorean'] = 0x3269;
- t['chieuchkorean'] = 0x314A;
- t['chieuchparenkorean'] = 0x3209;
- t['chochangthai'] = 0x0E0A;
- t['chochanthai'] = 0x0E08;
- t['chochingthai'] = 0x0E09;
- t['chochoethai'] = 0x0E0C;
- t['chook'] = 0x0188;
- t['cieucacirclekorean'] = 0x3276;
- t['cieucaparenkorean'] = 0x3216;
- t['cieuccirclekorean'] = 0x3268;
- t['cieuckorean'] = 0x3148;
- t['cieucparenkorean'] = 0x3208;
- t['cieucuparenkorean'] = 0x321C;
- t['circle'] = 0x25CB;
- t['circlecopyrt'] = 0x00A9;
- t['circlemultiply'] = 0x2297;
- t['circleot'] = 0x2299;
- t['circleplus'] = 0x2295;
- t['circlepostalmark'] = 0x3036;
- t['circlewithlefthalfblack'] = 0x25D0;
- t['circlewithrighthalfblack'] = 0x25D1;
- t['circumflex'] = 0x02C6;
- t['circumflexbelowcmb'] = 0x032D;
- t['circumflexcmb'] = 0x0302;
- t['clear'] = 0x2327;
- t['clickalveolar'] = 0x01C2;
- t['clickdental'] = 0x01C0;
- t['clicklateral'] = 0x01C1;
- t['clickretroflex'] = 0x01C3;
- t['club'] = 0x2663;
- t['clubsuitblack'] = 0x2663;
- t['clubsuitwhite'] = 0x2667;
- t['cmcubedsquare'] = 0x33A4;
- t['cmonospace'] = 0xFF43;
- t['cmsquaredsquare'] = 0x33A0;
- t['coarmenian'] = 0x0581;
- t['colon'] = 0x003A;
- t['colonmonetary'] = 0x20A1;
- t['colonmonospace'] = 0xFF1A;
- t['colonsign'] = 0x20A1;
- t['colonsmall'] = 0xFE55;
- t['colontriangularhalfmod'] = 0x02D1;
- t['colontriangularmod'] = 0x02D0;
- t['comma'] = 0x002C;
- t['commaabovecmb'] = 0x0313;
- t['commaaboverightcmb'] = 0x0315;
- t['commaaccent'] = 0xF6C3;
- t['commaarabic'] = 0x060C;
- t['commaarmenian'] = 0x055D;
- t['commainferior'] = 0xF6E1;
- t['commamonospace'] = 0xFF0C;
- t['commareversedabovecmb'] = 0x0314;
- t['commareversedmod'] = 0x02BD;
- t['commasmall'] = 0xFE50;
- t['commasuperior'] = 0xF6E2;
- t['commaturnedabovecmb'] = 0x0312;
- t['commaturnedmod'] = 0x02BB;
- t['compass'] = 0x263C;
- t['congruent'] = 0x2245;
- t['contourintegral'] = 0x222E;
- t['control'] = 0x2303;
- t['controlACK'] = 0x0006;
- t['controlBEL'] = 0x0007;
- t['controlBS'] = 0x0008;
- t['controlCAN'] = 0x0018;
- t['controlCR'] = 0x000D;
- t['controlDC1'] = 0x0011;
- t['controlDC2'] = 0x0012;
- t['controlDC3'] = 0x0013;
- t['controlDC4'] = 0x0014;
- t['controlDEL'] = 0x007F;
- t['controlDLE'] = 0x0010;
- t['controlEM'] = 0x0019;
- t['controlENQ'] = 0x0005;
- t['controlEOT'] = 0x0004;
- t['controlESC'] = 0x001B;
- t['controlETB'] = 0x0017;
- t['controlETX'] = 0x0003;
- t['controlFF'] = 0x000C;
- t['controlFS'] = 0x001C;
- t['controlGS'] = 0x001D;
- t['controlHT'] = 0x0009;
- t['controlLF'] = 0x000A;
- t['controlNAK'] = 0x0015;
- t['controlNULL'] = 0x0000;
- t['controlRS'] = 0x001E;
- t['controlSI'] = 0x000F;
- t['controlSO'] = 0x000E;
- t['controlSOT'] = 0x0002;
- t['controlSTX'] = 0x0001;
- t['controlSUB'] = 0x001A;
- t['controlSYN'] = 0x0016;
- t['controlUS'] = 0x001F;
- t['controlVT'] = 0x000B;
- t['copyright'] = 0x00A9;
- t['copyrightsans'] = 0xF8E9;
- t['copyrightserif'] = 0xF6D9;
- t['cornerbracketleft'] = 0x300C;
- t['cornerbracketlefthalfwidth'] = 0xFF62;
- t['cornerbracketleftvertical'] = 0xFE41;
- t['cornerbracketright'] = 0x300D;
- t['cornerbracketrighthalfwidth'] = 0xFF63;
- t['cornerbracketrightvertical'] = 0xFE42;
- t['corporationsquare'] = 0x337F;
- t['cosquare'] = 0x33C7;
- t['coverkgsquare'] = 0x33C6;
- t['cparen'] = 0x249E;
- t['cruzeiro'] = 0x20A2;
- t['cstretched'] = 0x0297;
- t['curlyand'] = 0x22CF;
- t['curlyor'] = 0x22CE;
- t['currency'] = 0x00A4;
- t['cyrBreve'] = 0xF6D1;
- t['cyrFlex'] = 0xF6D2;
- t['cyrbreve'] = 0xF6D4;
- t['cyrflex'] = 0xF6D5;
- t['d'] = 0x0064;
- t['daarmenian'] = 0x0564;
- t['dabengali'] = 0x09A6;
- t['dadarabic'] = 0x0636;
- t['dadeva'] = 0x0926;
- t['dadfinalarabic'] = 0xFEBE;
- t['dadinitialarabic'] = 0xFEBF;
- t['dadmedialarabic'] = 0xFEC0;
- t['dagesh'] = 0x05BC;
- t['dageshhebrew'] = 0x05BC;
- t['dagger'] = 0x2020;
- t['daggerdbl'] = 0x2021;
- t['dagujarati'] = 0x0AA6;
- t['dagurmukhi'] = 0x0A26;
- t['dahiragana'] = 0x3060;
- t['dakatakana'] = 0x30C0;
- t['dalarabic'] = 0x062F;
- t['dalet'] = 0x05D3;
- t['daletdagesh'] = 0xFB33;
- t['daletdageshhebrew'] = 0xFB33;
- t['dalethebrew'] = 0x05D3;
- t['dalfinalarabic'] = 0xFEAA;
- t['dammaarabic'] = 0x064F;
- t['dammalowarabic'] = 0x064F;
- t['dammatanaltonearabic'] = 0x064C;
- t['dammatanarabic'] = 0x064C;
- t['danda'] = 0x0964;
- t['dargahebrew'] = 0x05A7;
- t['dargalefthebrew'] = 0x05A7;
- t['dasiapneumatacyrilliccmb'] = 0x0485;
- t['dblGrave'] = 0xF6D3;
- t['dblanglebracketleft'] = 0x300A;
- t['dblanglebracketleftvertical'] = 0xFE3D;
- t['dblanglebracketright'] = 0x300B;
- t['dblanglebracketrightvertical'] = 0xFE3E;
- t['dblarchinvertedbelowcmb'] = 0x032B;
- t['dblarrowleft'] = 0x21D4;
- t['dblarrowright'] = 0x21D2;
- t['dbldanda'] = 0x0965;
- t['dblgrave'] = 0xF6D6;
- t['dblgravecmb'] = 0x030F;
- t['dblintegral'] = 0x222C;
- t['dbllowline'] = 0x2017;
- t['dbllowlinecmb'] = 0x0333;
- t['dbloverlinecmb'] = 0x033F;
- t['dblprimemod'] = 0x02BA;
- t['dblverticalbar'] = 0x2016;
- t['dblverticallineabovecmb'] = 0x030E;
- t['dbopomofo'] = 0x3109;
- t['dbsquare'] = 0x33C8;
- t['dcaron'] = 0x010F;
- t['dcedilla'] = 0x1E11;
- t['dcircle'] = 0x24D3;
- t['dcircumflexbelow'] = 0x1E13;
- t['dcroat'] = 0x0111;
- t['ddabengali'] = 0x09A1;
- t['ddadeva'] = 0x0921;
- t['ddagujarati'] = 0x0AA1;
- t['ddagurmukhi'] = 0x0A21;
- t['ddalarabic'] = 0x0688;
- t['ddalfinalarabic'] = 0xFB89;
- t['dddhadeva'] = 0x095C;
- t['ddhabengali'] = 0x09A2;
- t['ddhadeva'] = 0x0922;
- t['ddhagujarati'] = 0x0AA2;
- t['ddhagurmukhi'] = 0x0A22;
- t['ddotaccent'] = 0x1E0B;
- t['ddotbelow'] = 0x1E0D;
- t['decimalseparatorarabic'] = 0x066B;
- t['decimalseparatorpersian'] = 0x066B;
- t['decyrillic'] = 0x0434;
- t['degree'] = 0x00B0;
- t['dehihebrew'] = 0x05AD;
- t['dehiragana'] = 0x3067;
- t['deicoptic'] = 0x03EF;
- t['dekatakana'] = 0x30C7;
- t['deleteleft'] = 0x232B;
- t['deleteright'] = 0x2326;
- t['delta'] = 0x03B4;
- t['deltaturned'] = 0x018D;
- t['denominatorminusonenumeratorbengali'] = 0x09F8;
- t['dezh'] = 0x02A4;
- t['dhabengali'] = 0x09A7;
- t['dhadeva'] = 0x0927;
- t['dhagujarati'] = 0x0AA7;
- t['dhagurmukhi'] = 0x0A27;
- t['dhook'] = 0x0257;
- t['dialytikatonos'] = 0x0385;
- t['dialytikatonoscmb'] = 0x0344;
- t['diamond'] = 0x2666;
- t['diamondsuitwhite'] = 0x2662;
- t['dieresis'] = 0x00A8;
- t['dieresisacute'] = 0xF6D7;
- t['dieresisbelowcmb'] = 0x0324;
- t['dieresiscmb'] = 0x0308;
- t['dieresisgrave'] = 0xF6D8;
- t['dieresistonos'] = 0x0385;
- t['dihiragana'] = 0x3062;
- t['dikatakana'] = 0x30C2;
- t['dittomark'] = 0x3003;
- t['divide'] = 0x00F7;
- t['divides'] = 0x2223;
- t['divisionslash'] = 0x2215;
- t['djecyrillic'] = 0x0452;
- t['dkshade'] = 0x2593;
- t['dlinebelow'] = 0x1E0F;
- t['dlsquare'] = 0x3397;
- t['dmacron'] = 0x0111;
- t['dmonospace'] = 0xFF44;
- t['dnblock'] = 0x2584;
- t['dochadathai'] = 0x0E0E;
- t['dodekthai'] = 0x0E14;
- t['dohiragana'] = 0x3069;
- t['dokatakana'] = 0x30C9;
- t['dollar'] = 0x0024;
- t['dollarinferior'] = 0xF6E3;
- t['dollarmonospace'] = 0xFF04;
- t['dollaroldstyle'] = 0xF724;
- t['dollarsmall'] = 0xFE69;
- t['dollarsuperior'] = 0xF6E4;
- t['dong'] = 0x20AB;
- t['dorusquare'] = 0x3326;
- t['dotaccent'] = 0x02D9;
- t['dotaccentcmb'] = 0x0307;
- t['dotbelowcmb'] = 0x0323;
- t['dotbelowcomb'] = 0x0323;
- t['dotkatakana'] = 0x30FB;
- t['dotlessi'] = 0x0131;
- t['dotlessj'] = 0xF6BE;
- t['dotlessjstrokehook'] = 0x0284;
- t['dotmath'] = 0x22C5;
- t['dottedcircle'] = 0x25CC;
- t['doubleyodpatah'] = 0xFB1F;
- t['doubleyodpatahhebrew'] = 0xFB1F;
- t['downtackbelowcmb'] = 0x031E;
- t['downtackmod'] = 0x02D5;
- t['dparen'] = 0x249F;
- t['dsuperior'] = 0xF6EB;
- t['dtail'] = 0x0256;
- t['dtopbar'] = 0x018C;
- t['duhiragana'] = 0x3065;
- t['dukatakana'] = 0x30C5;
- t['dz'] = 0x01F3;
- t['dzaltone'] = 0x02A3;
- t['dzcaron'] = 0x01C6;
- t['dzcurl'] = 0x02A5;
- t['dzeabkhasiancyrillic'] = 0x04E1;
- t['dzecyrillic'] = 0x0455;
- t['dzhecyrillic'] = 0x045F;
- t['e'] = 0x0065;
- t['eacute'] = 0x00E9;
- t['earth'] = 0x2641;
- t['ebengali'] = 0x098F;
- t['ebopomofo'] = 0x311C;
- t['ebreve'] = 0x0115;
- t['ecandradeva'] = 0x090D;
- t['ecandragujarati'] = 0x0A8D;
- t['ecandravowelsigndeva'] = 0x0945;
- t['ecandravowelsigngujarati'] = 0x0AC5;
- t['ecaron'] = 0x011B;
- t['ecedillabreve'] = 0x1E1D;
- t['echarmenian'] = 0x0565;
- t['echyiwnarmenian'] = 0x0587;
- t['ecircle'] = 0x24D4;
- t['ecircumflex'] = 0x00EA;
- t['ecircumflexacute'] = 0x1EBF;
- t['ecircumflexbelow'] = 0x1E19;
- t['ecircumflexdotbelow'] = 0x1EC7;
- t['ecircumflexgrave'] = 0x1EC1;
- t['ecircumflexhookabove'] = 0x1EC3;
- t['ecircumflextilde'] = 0x1EC5;
- t['ecyrillic'] = 0x0454;
- t['edblgrave'] = 0x0205;
- t['edeva'] = 0x090F;
- t['edieresis'] = 0x00EB;
- t['edot'] = 0x0117;
- t['edotaccent'] = 0x0117;
- t['edotbelow'] = 0x1EB9;
- t['eegurmukhi'] = 0x0A0F;
- t['eematragurmukhi'] = 0x0A47;
- t['efcyrillic'] = 0x0444;
- t['egrave'] = 0x00E8;
- t['egujarati'] = 0x0A8F;
- t['eharmenian'] = 0x0567;
- t['ehbopomofo'] = 0x311D;
- t['ehiragana'] = 0x3048;
- t['ehookabove'] = 0x1EBB;
- t['eibopomofo'] = 0x311F;
- t['eight'] = 0x0038;
- t['eightarabic'] = 0x0668;
- t['eightbengali'] = 0x09EE;
- t['eightcircle'] = 0x2467;
- t['eightcircleinversesansserif'] = 0x2791;
- t['eightdeva'] = 0x096E;
- t['eighteencircle'] = 0x2471;
- t['eighteenparen'] = 0x2485;
- t['eighteenperiod'] = 0x2499;
- t['eightgujarati'] = 0x0AEE;
- t['eightgurmukhi'] = 0x0A6E;
- t['eighthackarabic'] = 0x0668;
- t['eighthangzhou'] = 0x3028;
- t['eighthnotebeamed'] = 0x266B;
- t['eightideographicparen'] = 0x3227;
- t['eightinferior'] = 0x2088;
- t['eightmonospace'] = 0xFF18;
- t['eightoldstyle'] = 0xF738;
- t['eightparen'] = 0x247B;
- t['eightperiod'] = 0x248F;
- t['eightpersian'] = 0x06F8;
- t['eightroman'] = 0x2177;
- t['eightsuperior'] = 0x2078;
- t['eightthai'] = 0x0E58;
- t['einvertedbreve'] = 0x0207;
- t['eiotifiedcyrillic'] = 0x0465;
- t['ekatakana'] = 0x30A8;
- t['ekatakanahalfwidth'] = 0xFF74;
- t['ekonkargurmukhi'] = 0x0A74;
- t['ekorean'] = 0x3154;
- t['elcyrillic'] = 0x043B;
- t['element'] = 0x2208;
- t['elevencircle'] = 0x246A;
- t['elevenparen'] = 0x247E;
- t['elevenperiod'] = 0x2492;
- t['elevenroman'] = 0x217A;
- t['ellipsis'] = 0x2026;
- t['ellipsisvertical'] = 0x22EE;
- t['emacron'] = 0x0113;
- t['emacronacute'] = 0x1E17;
- t['emacrongrave'] = 0x1E15;
- t['emcyrillic'] = 0x043C;
- t['emdash'] = 0x2014;
- t['emdashvertical'] = 0xFE31;
- t['emonospace'] = 0xFF45;
- t['emphasismarkarmenian'] = 0x055B;
- t['emptyset'] = 0x2205;
- t['enbopomofo'] = 0x3123;
- t['encyrillic'] = 0x043D;
- t['endash'] = 0x2013;
- t['endashvertical'] = 0xFE32;
- t['endescendercyrillic'] = 0x04A3;
- t['eng'] = 0x014B;
- t['engbopomofo'] = 0x3125;
- t['enghecyrillic'] = 0x04A5;
- t['enhookcyrillic'] = 0x04C8;
- t['enspace'] = 0x2002;
- t['eogonek'] = 0x0119;
- t['eokorean'] = 0x3153;
- t['eopen'] = 0x025B;
- t['eopenclosed'] = 0x029A;
- t['eopenreversed'] = 0x025C;
- t['eopenreversedclosed'] = 0x025E;
- t['eopenreversedhook'] = 0x025D;
- t['eparen'] = 0x24A0;
- t['epsilon'] = 0x03B5;
- t['epsilontonos'] = 0x03AD;
- t['equal'] = 0x003D;
- t['equalmonospace'] = 0xFF1D;
- t['equalsmall'] = 0xFE66;
- t['equalsuperior'] = 0x207C;
- t['equivalence'] = 0x2261;
- t['erbopomofo'] = 0x3126;
- t['ercyrillic'] = 0x0440;
- t['ereversed'] = 0x0258;
- t['ereversedcyrillic'] = 0x044D;
- t['escyrillic'] = 0x0441;
- t['esdescendercyrillic'] = 0x04AB;
- t['esh'] = 0x0283;
- t['eshcurl'] = 0x0286;
- t['eshortdeva'] = 0x090E;
- t['eshortvowelsigndeva'] = 0x0946;
- t['eshreversedloop'] = 0x01AA;
- t['eshsquatreversed'] = 0x0285;
- t['esmallhiragana'] = 0x3047;
- t['esmallkatakana'] = 0x30A7;
- t['esmallkatakanahalfwidth'] = 0xFF6A;
- t['estimated'] = 0x212E;
- t['esuperior'] = 0xF6EC;
- t['eta'] = 0x03B7;
- t['etarmenian'] = 0x0568;
- t['etatonos'] = 0x03AE;
- t['eth'] = 0x00F0;
- t['etilde'] = 0x1EBD;
- t['etildebelow'] = 0x1E1B;
- t['etnahtafoukhhebrew'] = 0x0591;
- t['etnahtafoukhlefthebrew'] = 0x0591;
- t['etnahtahebrew'] = 0x0591;
- t['etnahtalefthebrew'] = 0x0591;
- t['eturned'] = 0x01DD;
- t['eukorean'] = 0x3161;
- t['euro'] = 0x20AC;
- t['evowelsignbengali'] = 0x09C7;
- t['evowelsigndeva'] = 0x0947;
- t['evowelsigngujarati'] = 0x0AC7;
- t['exclam'] = 0x0021;
- t['exclamarmenian'] = 0x055C;
- t['exclamdbl'] = 0x203C;
- t['exclamdown'] = 0x00A1;
- t['exclamdownsmall'] = 0xF7A1;
- t['exclammonospace'] = 0xFF01;
- t['exclamsmall'] = 0xF721;
- t['existential'] = 0x2203;
- t['ezh'] = 0x0292;
- t['ezhcaron'] = 0x01EF;
- t['ezhcurl'] = 0x0293;
- t['ezhreversed'] = 0x01B9;
- t['ezhtail'] = 0x01BA;
- t['f'] = 0x0066;
- t['fadeva'] = 0x095E;
- t['fagurmukhi'] = 0x0A5E;
- t['fahrenheit'] = 0x2109;
- t['fathaarabic'] = 0x064E;
- t['fathalowarabic'] = 0x064E;
- t['fathatanarabic'] = 0x064B;
- t['fbopomofo'] = 0x3108;
- t['fcircle'] = 0x24D5;
- t['fdotaccent'] = 0x1E1F;
- t['feharabic'] = 0x0641;
- t['feharmenian'] = 0x0586;
- t['fehfinalarabic'] = 0xFED2;
- t['fehinitialarabic'] = 0xFED3;
- t['fehmedialarabic'] = 0xFED4;
- t['feicoptic'] = 0x03E5;
- t['female'] = 0x2640;
- t['ff'] = 0xFB00;
- t['ffi'] = 0xFB03;
- t['ffl'] = 0xFB04;
- t['fi'] = 0xFB01;
- t['fifteencircle'] = 0x246E;
- t['fifteenparen'] = 0x2482;
- t['fifteenperiod'] = 0x2496;
- t['figuredash'] = 0x2012;
- t['filledbox'] = 0x25A0;
- t['filledrect'] = 0x25AC;
- t['finalkaf'] = 0x05DA;
- t['finalkafdagesh'] = 0xFB3A;
- t['finalkafdageshhebrew'] = 0xFB3A;
- t['finalkafhebrew'] = 0x05DA;
- t['finalmem'] = 0x05DD;
- t['finalmemhebrew'] = 0x05DD;
- t['finalnun'] = 0x05DF;
- t['finalnunhebrew'] = 0x05DF;
- t['finalpe'] = 0x05E3;
- t['finalpehebrew'] = 0x05E3;
- t['finaltsadi'] = 0x05E5;
- t['finaltsadihebrew'] = 0x05E5;
- t['firsttonechinese'] = 0x02C9;
- t['fisheye'] = 0x25C9;
- t['fitacyrillic'] = 0x0473;
- t['five'] = 0x0035;
- t['fivearabic'] = 0x0665;
- t['fivebengali'] = 0x09EB;
- t['fivecircle'] = 0x2464;
- t['fivecircleinversesansserif'] = 0x278E;
- t['fivedeva'] = 0x096B;
- t['fiveeighths'] = 0x215D;
- t['fivegujarati'] = 0x0AEB;
- t['fivegurmukhi'] = 0x0A6B;
- t['fivehackarabic'] = 0x0665;
- t['fivehangzhou'] = 0x3025;
- t['fiveideographicparen'] = 0x3224;
- t['fiveinferior'] = 0x2085;
- t['fivemonospace'] = 0xFF15;
- t['fiveoldstyle'] = 0xF735;
- t['fiveparen'] = 0x2478;
- t['fiveperiod'] = 0x248C;
- t['fivepersian'] = 0x06F5;
- t['fiveroman'] = 0x2174;
- t['fivesuperior'] = 0x2075;
- t['fivethai'] = 0x0E55;
- t['fl'] = 0xFB02;
- t['florin'] = 0x0192;
- t['fmonospace'] = 0xFF46;
- t['fmsquare'] = 0x3399;
- t['fofanthai'] = 0x0E1F;
- t['fofathai'] = 0x0E1D;
- t['fongmanthai'] = 0x0E4F;
- t['forall'] = 0x2200;
- t['four'] = 0x0034;
- t['fourarabic'] = 0x0664;
- t['fourbengali'] = 0x09EA;
- t['fourcircle'] = 0x2463;
- t['fourcircleinversesansserif'] = 0x278D;
- t['fourdeva'] = 0x096A;
- t['fourgujarati'] = 0x0AEA;
- t['fourgurmukhi'] = 0x0A6A;
- t['fourhackarabic'] = 0x0664;
- t['fourhangzhou'] = 0x3024;
- t['fourideographicparen'] = 0x3223;
- t['fourinferior'] = 0x2084;
- t['fourmonospace'] = 0xFF14;
- t['fournumeratorbengali'] = 0x09F7;
- t['fouroldstyle'] = 0xF734;
- t['fourparen'] = 0x2477;
- t['fourperiod'] = 0x248B;
- t['fourpersian'] = 0x06F4;
- t['fourroman'] = 0x2173;
- t['foursuperior'] = 0x2074;
- t['fourteencircle'] = 0x246D;
- t['fourteenparen'] = 0x2481;
- t['fourteenperiod'] = 0x2495;
- t['fourthai'] = 0x0E54;
- t['fourthtonechinese'] = 0x02CB;
- t['fparen'] = 0x24A1;
- t['fraction'] = 0x2044;
- t['franc'] = 0x20A3;
- t['g'] = 0x0067;
- t['gabengali'] = 0x0997;
- t['gacute'] = 0x01F5;
- t['gadeva'] = 0x0917;
- t['gafarabic'] = 0x06AF;
- t['gaffinalarabic'] = 0xFB93;
- t['gafinitialarabic'] = 0xFB94;
- t['gafmedialarabic'] = 0xFB95;
- t['gagujarati'] = 0x0A97;
- t['gagurmukhi'] = 0x0A17;
- t['gahiragana'] = 0x304C;
- t['gakatakana'] = 0x30AC;
- t['gamma'] = 0x03B3;
- t['gammalatinsmall'] = 0x0263;
- t['gammasuperior'] = 0x02E0;
- t['gangiacoptic'] = 0x03EB;
- t['gbopomofo'] = 0x310D;
- t['gbreve'] = 0x011F;
- t['gcaron'] = 0x01E7;
- t['gcedilla'] = 0x0123;
- t['gcircle'] = 0x24D6;
- t['gcircumflex'] = 0x011D;
- t['gcommaaccent'] = 0x0123;
- t['gdot'] = 0x0121;
- t['gdotaccent'] = 0x0121;
- t['gecyrillic'] = 0x0433;
- t['gehiragana'] = 0x3052;
- t['gekatakana'] = 0x30B2;
- t['geometricallyequal'] = 0x2251;
- t['gereshaccenthebrew'] = 0x059C;
- t['gereshhebrew'] = 0x05F3;
- t['gereshmuqdamhebrew'] = 0x059D;
- t['germandbls'] = 0x00DF;
- t['gershayimaccenthebrew'] = 0x059E;
- t['gershayimhebrew'] = 0x05F4;
- t['getamark'] = 0x3013;
- t['ghabengali'] = 0x0998;
- t['ghadarmenian'] = 0x0572;
- t['ghadeva'] = 0x0918;
- t['ghagujarati'] = 0x0A98;
- t['ghagurmukhi'] = 0x0A18;
- t['ghainarabic'] = 0x063A;
- t['ghainfinalarabic'] = 0xFECE;
- t['ghaininitialarabic'] = 0xFECF;
- t['ghainmedialarabic'] = 0xFED0;
- t['ghemiddlehookcyrillic'] = 0x0495;
- t['ghestrokecyrillic'] = 0x0493;
- t['gheupturncyrillic'] = 0x0491;
- t['ghhadeva'] = 0x095A;
- t['ghhagurmukhi'] = 0x0A5A;
- t['ghook'] = 0x0260;
- t['ghzsquare'] = 0x3393;
- t['gihiragana'] = 0x304E;
- t['gikatakana'] = 0x30AE;
- t['gimarmenian'] = 0x0563;
- t['gimel'] = 0x05D2;
- t['gimeldagesh'] = 0xFB32;
- t['gimeldageshhebrew'] = 0xFB32;
- t['gimelhebrew'] = 0x05D2;
- t['gjecyrillic'] = 0x0453;
- t['glottalinvertedstroke'] = 0x01BE;
- t['glottalstop'] = 0x0294;
- t['glottalstopinverted'] = 0x0296;
- t['glottalstopmod'] = 0x02C0;
- t['glottalstopreversed'] = 0x0295;
- t['glottalstopreversedmod'] = 0x02C1;
- t['glottalstopreversedsuperior'] = 0x02E4;
- t['glottalstopstroke'] = 0x02A1;
- t['glottalstopstrokereversed'] = 0x02A2;
- t['gmacron'] = 0x1E21;
- t['gmonospace'] = 0xFF47;
- t['gohiragana'] = 0x3054;
- t['gokatakana'] = 0x30B4;
- t['gparen'] = 0x24A2;
- t['gpasquare'] = 0x33AC;
- t['gradient'] = 0x2207;
- t['grave'] = 0x0060;
- t['gravebelowcmb'] = 0x0316;
- t['gravecmb'] = 0x0300;
- t['gravecomb'] = 0x0300;
- t['gravedeva'] = 0x0953;
- t['gravelowmod'] = 0x02CE;
- t['gravemonospace'] = 0xFF40;
- t['gravetonecmb'] = 0x0340;
- t['greater'] = 0x003E;
- t['greaterequal'] = 0x2265;
- t['greaterequalorless'] = 0x22DB;
- t['greatermonospace'] = 0xFF1E;
- t['greaterorequivalent'] = 0x2273;
- t['greaterorless'] = 0x2277;
- t['greateroverequal'] = 0x2267;
- t['greatersmall'] = 0xFE65;
- t['gscript'] = 0x0261;
- t['gstroke'] = 0x01E5;
- t['guhiragana'] = 0x3050;
- t['guillemotleft'] = 0x00AB;
- t['guillemotright'] = 0x00BB;
- t['guilsinglleft'] = 0x2039;
- t['guilsinglright'] = 0x203A;
- t['gukatakana'] = 0x30B0;
- t['guramusquare'] = 0x3318;
- t['gysquare'] = 0x33C9;
- t['h'] = 0x0068;
- t['haabkhasiancyrillic'] = 0x04A9;
- t['haaltonearabic'] = 0x06C1;
- t['habengali'] = 0x09B9;
- t['hadescendercyrillic'] = 0x04B3;
- t['hadeva'] = 0x0939;
- t['hagujarati'] = 0x0AB9;
- t['hagurmukhi'] = 0x0A39;
- t['haharabic'] = 0x062D;
- t['hahfinalarabic'] = 0xFEA2;
- t['hahinitialarabic'] = 0xFEA3;
- t['hahiragana'] = 0x306F;
- t['hahmedialarabic'] = 0xFEA4;
- t['haitusquare'] = 0x332A;
- t['hakatakana'] = 0x30CF;
- t['hakatakanahalfwidth'] = 0xFF8A;
- t['halantgurmukhi'] = 0x0A4D;
- t['hamzaarabic'] = 0x0621;
- t['hamzalowarabic'] = 0x0621;
- t['hangulfiller'] = 0x3164;
- t['hardsigncyrillic'] = 0x044A;
- t['harpoonleftbarbup'] = 0x21BC;
- t['harpoonrightbarbup'] = 0x21C0;
- t['hasquare'] = 0x33CA;
- t['hatafpatah'] = 0x05B2;
- t['hatafpatah16'] = 0x05B2;
- t['hatafpatah23'] = 0x05B2;
- t['hatafpatah2f'] = 0x05B2;
- t['hatafpatahhebrew'] = 0x05B2;
- t['hatafpatahnarrowhebrew'] = 0x05B2;
- t['hatafpatahquarterhebrew'] = 0x05B2;
- t['hatafpatahwidehebrew'] = 0x05B2;
- t['hatafqamats'] = 0x05B3;
- t['hatafqamats1b'] = 0x05B3;
- t['hatafqamats28'] = 0x05B3;
- t['hatafqamats34'] = 0x05B3;
- t['hatafqamatshebrew'] = 0x05B3;
- t['hatafqamatsnarrowhebrew'] = 0x05B3;
- t['hatafqamatsquarterhebrew'] = 0x05B3;
- t['hatafqamatswidehebrew'] = 0x05B3;
- t['hatafsegol'] = 0x05B1;
- t['hatafsegol17'] = 0x05B1;
- t['hatafsegol24'] = 0x05B1;
- t['hatafsegol30'] = 0x05B1;
- t['hatafsegolhebrew'] = 0x05B1;
- t['hatafsegolnarrowhebrew'] = 0x05B1;
- t['hatafsegolquarterhebrew'] = 0x05B1;
- t['hatafsegolwidehebrew'] = 0x05B1;
- t['hbar'] = 0x0127;
- t['hbopomofo'] = 0x310F;
- t['hbrevebelow'] = 0x1E2B;
- t['hcedilla'] = 0x1E29;
- t['hcircle'] = 0x24D7;
- t['hcircumflex'] = 0x0125;
- t['hdieresis'] = 0x1E27;
- t['hdotaccent'] = 0x1E23;
- t['hdotbelow'] = 0x1E25;
- t['he'] = 0x05D4;
- t['heart'] = 0x2665;
- t['heartsuitblack'] = 0x2665;
- t['heartsuitwhite'] = 0x2661;
- t['hedagesh'] = 0xFB34;
- t['hedageshhebrew'] = 0xFB34;
- t['hehaltonearabic'] = 0x06C1;
- t['heharabic'] = 0x0647;
- t['hehebrew'] = 0x05D4;
- t['hehfinalaltonearabic'] = 0xFBA7;
- t['hehfinalalttwoarabic'] = 0xFEEA;
- t['hehfinalarabic'] = 0xFEEA;
- t['hehhamzaabovefinalarabic'] = 0xFBA5;
- t['hehhamzaaboveisolatedarabic'] = 0xFBA4;
- t['hehinitialaltonearabic'] = 0xFBA8;
- t['hehinitialarabic'] = 0xFEEB;
- t['hehiragana'] = 0x3078;
- t['hehmedialaltonearabic'] = 0xFBA9;
- t['hehmedialarabic'] = 0xFEEC;
- t['heiseierasquare'] = 0x337B;
- t['hekatakana'] = 0x30D8;
- t['hekatakanahalfwidth'] = 0xFF8D;
- t['hekutaarusquare'] = 0x3336;
- t['henghook'] = 0x0267;
- t['herutusquare'] = 0x3339;
- t['het'] = 0x05D7;
- t['hethebrew'] = 0x05D7;
- t['hhook'] = 0x0266;
- t['hhooksuperior'] = 0x02B1;
- t['hieuhacirclekorean'] = 0x327B;
- t['hieuhaparenkorean'] = 0x321B;
- t['hieuhcirclekorean'] = 0x326D;
- t['hieuhkorean'] = 0x314E;
- t['hieuhparenkorean'] = 0x320D;
- t['hihiragana'] = 0x3072;
- t['hikatakana'] = 0x30D2;
- t['hikatakanahalfwidth'] = 0xFF8B;
- t['hiriq'] = 0x05B4;
- t['hiriq14'] = 0x05B4;
- t['hiriq21'] = 0x05B4;
- t['hiriq2d'] = 0x05B4;
- t['hiriqhebrew'] = 0x05B4;
- t['hiriqnarrowhebrew'] = 0x05B4;
- t['hiriqquarterhebrew'] = 0x05B4;
- t['hiriqwidehebrew'] = 0x05B4;
- t['hlinebelow'] = 0x1E96;
- t['hmonospace'] = 0xFF48;
- t['hoarmenian'] = 0x0570;
- t['hohipthai'] = 0x0E2B;
- t['hohiragana'] = 0x307B;
- t['hokatakana'] = 0x30DB;
- t['hokatakanahalfwidth'] = 0xFF8E;
- t['holam'] = 0x05B9;
- t['holam19'] = 0x05B9;
- t['holam26'] = 0x05B9;
- t['holam32'] = 0x05B9;
- t['holamhebrew'] = 0x05B9;
- t['holamnarrowhebrew'] = 0x05B9;
- t['holamquarterhebrew'] = 0x05B9;
- t['holamwidehebrew'] = 0x05B9;
- t['honokhukthai'] = 0x0E2E;
- t['hookabovecomb'] = 0x0309;
- t['hookcmb'] = 0x0309;
- t['hookpalatalizedbelowcmb'] = 0x0321;
- t['hookretroflexbelowcmb'] = 0x0322;
- t['hoonsquare'] = 0x3342;
- t['horicoptic'] = 0x03E9;
- t['horizontalbar'] = 0x2015;
- t['horncmb'] = 0x031B;
- t['hotsprings'] = 0x2668;
- t['house'] = 0x2302;
- t['hparen'] = 0x24A3;
- t['hsuperior'] = 0x02B0;
- t['hturned'] = 0x0265;
- t['huhiragana'] = 0x3075;
- t['huiitosquare'] = 0x3333;
- t['hukatakana'] = 0x30D5;
- t['hukatakanahalfwidth'] = 0xFF8C;
- t['hungarumlaut'] = 0x02DD;
- t['hungarumlautcmb'] = 0x030B;
- t['hv'] = 0x0195;
- t['hyphen'] = 0x002D;
- t['hypheninferior'] = 0xF6E5;
- t['hyphenmonospace'] = 0xFF0D;
- t['hyphensmall'] = 0xFE63;
- t['hyphensuperior'] = 0xF6E6;
- t['hyphentwo'] = 0x2010;
- t['i'] = 0x0069;
- t['iacute'] = 0x00ED;
- t['iacyrillic'] = 0x044F;
- t['ibengali'] = 0x0987;
- t['ibopomofo'] = 0x3127;
- t['ibreve'] = 0x012D;
- t['icaron'] = 0x01D0;
- t['icircle'] = 0x24D8;
- t['icircumflex'] = 0x00EE;
- t['icyrillic'] = 0x0456;
- t['idblgrave'] = 0x0209;
- t['ideographearthcircle'] = 0x328F;
- t['ideographfirecircle'] = 0x328B;
- t['ideographicallianceparen'] = 0x323F;
- t['ideographiccallparen'] = 0x323A;
- t['ideographiccentrecircle'] = 0x32A5;
- t['ideographicclose'] = 0x3006;
- t['ideographiccomma'] = 0x3001;
- t['ideographiccommaleft'] = 0xFF64;
- t['ideographiccongratulationparen'] = 0x3237;
- t['ideographiccorrectcircle'] = 0x32A3;
- t['ideographicearthparen'] = 0x322F;
- t['ideographicenterpriseparen'] = 0x323D;
- t['ideographicexcellentcircle'] = 0x329D;
- t['ideographicfestivalparen'] = 0x3240;
- t['ideographicfinancialcircle'] = 0x3296;
- t['ideographicfinancialparen'] = 0x3236;
- t['ideographicfireparen'] = 0x322B;
- t['ideographichaveparen'] = 0x3232;
- t['ideographichighcircle'] = 0x32A4;
- t['ideographiciterationmark'] = 0x3005;
- t['ideographiclaborcircle'] = 0x3298;
- t['ideographiclaborparen'] = 0x3238;
- t['ideographicleftcircle'] = 0x32A7;
- t['ideographiclowcircle'] = 0x32A6;
- t['ideographicmedicinecircle'] = 0x32A9;
- t['ideographicmetalparen'] = 0x322E;
- t['ideographicmoonparen'] = 0x322A;
- t['ideographicnameparen'] = 0x3234;
- t['ideographicperiod'] = 0x3002;
- t['ideographicprintcircle'] = 0x329E;
- t['ideographicreachparen'] = 0x3243;
- t['ideographicrepresentparen'] = 0x3239;
- t['ideographicresourceparen'] = 0x323E;
- t['ideographicrightcircle'] = 0x32A8;
- t['ideographicsecretcircle'] = 0x3299;
- t['ideographicselfparen'] = 0x3242;
- t['ideographicsocietyparen'] = 0x3233;
- t['ideographicspace'] = 0x3000;
- t['ideographicspecialparen'] = 0x3235;
- t['ideographicstockparen'] = 0x3231;
- t['ideographicstudyparen'] = 0x323B;
- t['ideographicsunparen'] = 0x3230;
- t['ideographicsuperviseparen'] = 0x323C;
- t['ideographicwaterparen'] = 0x322C;
- t['ideographicwoodparen'] = 0x322D;
- t['ideographiczero'] = 0x3007;
- t['ideographmetalcircle'] = 0x328E;
- t['ideographmooncircle'] = 0x328A;
- t['ideographnamecircle'] = 0x3294;
- t['ideographsuncircle'] = 0x3290;
- t['ideographwatercircle'] = 0x328C;
- t['ideographwoodcircle'] = 0x328D;
- t['ideva'] = 0x0907;
- t['idieresis'] = 0x00EF;
- t['idieresisacute'] = 0x1E2F;
- t['idieresiscyrillic'] = 0x04E5;
- t['idotbelow'] = 0x1ECB;
- t['iebrevecyrillic'] = 0x04D7;
- t['iecyrillic'] = 0x0435;
- t['ieungacirclekorean'] = 0x3275;
- t['ieungaparenkorean'] = 0x3215;
- t['ieungcirclekorean'] = 0x3267;
- t['ieungkorean'] = 0x3147;
- t['ieungparenkorean'] = 0x3207;
- t['igrave'] = 0x00EC;
- t['igujarati'] = 0x0A87;
- t['igurmukhi'] = 0x0A07;
- t['ihiragana'] = 0x3044;
- t['ihookabove'] = 0x1EC9;
- t['iibengali'] = 0x0988;
- t['iicyrillic'] = 0x0438;
- t['iideva'] = 0x0908;
- t['iigujarati'] = 0x0A88;
- t['iigurmukhi'] = 0x0A08;
- t['iimatragurmukhi'] = 0x0A40;
- t['iinvertedbreve'] = 0x020B;
- t['iishortcyrillic'] = 0x0439;
- t['iivowelsignbengali'] = 0x09C0;
- t['iivowelsigndeva'] = 0x0940;
- t['iivowelsigngujarati'] = 0x0AC0;
- t['ij'] = 0x0133;
- t['ikatakana'] = 0x30A4;
- t['ikatakanahalfwidth'] = 0xFF72;
- t['ikorean'] = 0x3163;
- t['ilde'] = 0x02DC;
- t['iluyhebrew'] = 0x05AC;
- t['imacron'] = 0x012B;
- t['imacroncyrillic'] = 0x04E3;
- t['imageorapproximatelyequal'] = 0x2253;
- t['imatragurmukhi'] = 0x0A3F;
- t['imonospace'] = 0xFF49;
- t['increment'] = 0x2206;
- t['infinity'] = 0x221E;
- t['iniarmenian'] = 0x056B;
- t['integral'] = 0x222B;
- t['integralbottom'] = 0x2321;
- t['integralbt'] = 0x2321;
- t['integralex'] = 0xF8F5;
- t['integraltop'] = 0x2320;
- t['integraltp'] = 0x2320;
- t['intersection'] = 0x2229;
- t['intisquare'] = 0x3305;
- t['invbullet'] = 0x25D8;
- t['invcircle'] = 0x25D9;
- t['invsmileface'] = 0x263B;
- t['iocyrillic'] = 0x0451;
- t['iogonek'] = 0x012F;
- t['iota'] = 0x03B9;
- t['iotadieresis'] = 0x03CA;
- t['iotadieresistonos'] = 0x0390;
- t['iotalatin'] = 0x0269;
- t['iotatonos'] = 0x03AF;
- t['iparen'] = 0x24A4;
- t['irigurmukhi'] = 0x0A72;
- t['ismallhiragana'] = 0x3043;
- t['ismallkatakana'] = 0x30A3;
- t['ismallkatakanahalfwidth'] = 0xFF68;
- t['issharbengali'] = 0x09FA;
- t['istroke'] = 0x0268;
- t['isuperior'] = 0xF6ED;
- t['iterationhiragana'] = 0x309D;
- t['iterationkatakana'] = 0x30FD;
- t['itilde'] = 0x0129;
- t['itildebelow'] = 0x1E2D;
- t['iubopomofo'] = 0x3129;
- t['iucyrillic'] = 0x044E;
- t['ivowelsignbengali'] = 0x09BF;
- t['ivowelsigndeva'] = 0x093F;
- t['ivowelsigngujarati'] = 0x0ABF;
- t['izhitsacyrillic'] = 0x0475;
- t['izhitsadblgravecyrillic'] = 0x0477;
- t['j'] = 0x006A;
- t['jaarmenian'] = 0x0571;
- t['jabengali'] = 0x099C;
- t['jadeva'] = 0x091C;
- t['jagujarati'] = 0x0A9C;
- t['jagurmukhi'] = 0x0A1C;
- t['jbopomofo'] = 0x3110;
- t['jcaron'] = 0x01F0;
- t['jcircle'] = 0x24D9;
- t['jcircumflex'] = 0x0135;
- t['jcrossedtail'] = 0x029D;
- t['jdotlessstroke'] = 0x025F;
- t['jecyrillic'] = 0x0458;
- t['jeemarabic'] = 0x062C;
- t['jeemfinalarabic'] = 0xFE9E;
- t['jeeminitialarabic'] = 0xFE9F;
- t['jeemmedialarabic'] = 0xFEA0;
- t['jeharabic'] = 0x0698;
- t['jehfinalarabic'] = 0xFB8B;
- t['jhabengali'] = 0x099D;
- t['jhadeva'] = 0x091D;
- t['jhagujarati'] = 0x0A9D;
- t['jhagurmukhi'] = 0x0A1D;
- t['jheharmenian'] = 0x057B;
- t['jis'] = 0x3004;
- t['jmonospace'] = 0xFF4A;
- t['jparen'] = 0x24A5;
- t['jsuperior'] = 0x02B2;
- t['k'] = 0x006B;
- t['kabashkircyrillic'] = 0x04A1;
- t['kabengali'] = 0x0995;
- t['kacute'] = 0x1E31;
- t['kacyrillic'] = 0x043A;
- t['kadescendercyrillic'] = 0x049B;
- t['kadeva'] = 0x0915;
- t['kaf'] = 0x05DB;
- t['kafarabic'] = 0x0643;
- t['kafdagesh'] = 0xFB3B;
- t['kafdageshhebrew'] = 0xFB3B;
- t['kaffinalarabic'] = 0xFEDA;
- t['kafhebrew'] = 0x05DB;
- t['kafinitialarabic'] = 0xFEDB;
- t['kafmedialarabic'] = 0xFEDC;
- t['kafrafehebrew'] = 0xFB4D;
- t['kagujarati'] = 0x0A95;
- t['kagurmukhi'] = 0x0A15;
- t['kahiragana'] = 0x304B;
- t['kahookcyrillic'] = 0x04C4;
- t['kakatakana'] = 0x30AB;
- t['kakatakanahalfwidth'] = 0xFF76;
- t['kappa'] = 0x03BA;
- t['kappasymbolgreek'] = 0x03F0;
- t['kapyeounmieumkorean'] = 0x3171;
- t['kapyeounphieuphkorean'] = 0x3184;
- t['kapyeounpieupkorean'] = 0x3178;
- t['kapyeounssangpieupkorean'] = 0x3179;
- t['karoriisquare'] = 0x330D;
- t['kashidaautoarabic'] = 0x0640;
- t['kashidaautonosidebearingarabic'] = 0x0640;
- t['kasmallkatakana'] = 0x30F5;
- t['kasquare'] = 0x3384;
- t['kasraarabic'] = 0x0650;
- t['kasratanarabic'] = 0x064D;
- t['kastrokecyrillic'] = 0x049F;
- t['katahiraprolongmarkhalfwidth'] = 0xFF70;
- t['kaverticalstrokecyrillic'] = 0x049D;
- t['kbopomofo'] = 0x310E;
- t['kcalsquare'] = 0x3389;
- t['kcaron'] = 0x01E9;
- t['kcedilla'] = 0x0137;
- t['kcircle'] = 0x24DA;
- t['kcommaaccent'] = 0x0137;
- t['kdotbelow'] = 0x1E33;
- t['keharmenian'] = 0x0584;
- t['kehiragana'] = 0x3051;
- t['kekatakana'] = 0x30B1;
- t['kekatakanahalfwidth'] = 0xFF79;
- t['kenarmenian'] = 0x056F;
- t['kesmallkatakana'] = 0x30F6;
- t['kgreenlandic'] = 0x0138;
- t['khabengali'] = 0x0996;
- t['khacyrillic'] = 0x0445;
- t['khadeva'] = 0x0916;
- t['khagujarati'] = 0x0A96;
- t['khagurmukhi'] = 0x0A16;
- t['khaharabic'] = 0x062E;
- t['khahfinalarabic'] = 0xFEA6;
- t['khahinitialarabic'] = 0xFEA7;
- t['khahmedialarabic'] = 0xFEA8;
- t['kheicoptic'] = 0x03E7;
- t['khhadeva'] = 0x0959;
- t['khhagurmukhi'] = 0x0A59;
- t['khieukhacirclekorean'] = 0x3278;
- t['khieukhaparenkorean'] = 0x3218;
- t['khieukhcirclekorean'] = 0x326A;
- t['khieukhkorean'] = 0x314B;
- t['khieukhparenkorean'] = 0x320A;
- t['khokhaithai'] = 0x0E02;
- t['khokhonthai'] = 0x0E05;
- t['khokhuatthai'] = 0x0E03;
- t['khokhwaithai'] = 0x0E04;
- t['khomutthai'] = 0x0E5B;
- t['khook'] = 0x0199;
- t['khorakhangthai'] = 0x0E06;
- t['khzsquare'] = 0x3391;
- t['kihiragana'] = 0x304D;
- t['kikatakana'] = 0x30AD;
- t['kikatakanahalfwidth'] = 0xFF77;
- t['kiroguramusquare'] = 0x3315;
- t['kiromeetorusquare'] = 0x3316;
- t['kirosquare'] = 0x3314;
- t['kiyeokacirclekorean'] = 0x326E;
- t['kiyeokaparenkorean'] = 0x320E;
- t['kiyeokcirclekorean'] = 0x3260;
- t['kiyeokkorean'] = 0x3131;
- t['kiyeokparenkorean'] = 0x3200;
- t['kiyeoksioskorean'] = 0x3133;
- t['kjecyrillic'] = 0x045C;
- t['klinebelow'] = 0x1E35;
- t['klsquare'] = 0x3398;
- t['kmcubedsquare'] = 0x33A6;
- t['kmonospace'] = 0xFF4B;
- t['kmsquaredsquare'] = 0x33A2;
- t['kohiragana'] = 0x3053;
- t['kohmsquare'] = 0x33C0;
- t['kokaithai'] = 0x0E01;
- t['kokatakana'] = 0x30B3;
- t['kokatakanahalfwidth'] = 0xFF7A;
- t['kooposquare'] = 0x331E;
- t['koppacyrillic'] = 0x0481;
- t['koreanstandardsymbol'] = 0x327F;
- t['koroniscmb'] = 0x0343;
- t['kparen'] = 0x24A6;
- t['kpasquare'] = 0x33AA;
- t['ksicyrillic'] = 0x046F;
- t['ktsquare'] = 0x33CF;
- t['kturned'] = 0x029E;
- t['kuhiragana'] = 0x304F;
- t['kukatakana'] = 0x30AF;
- t['kukatakanahalfwidth'] = 0xFF78;
- t['kvsquare'] = 0x33B8;
- t['kwsquare'] = 0x33BE;
- t['l'] = 0x006C;
- t['labengali'] = 0x09B2;
- t['lacute'] = 0x013A;
- t['ladeva'] = 0x0932;
- t['lagujarati'] = 0x0AB2;
- t['lagurmukhi'] = 0x0A32;
- t['lakkhangyaothai'] = 0x0E45;
- t['lamaleffinalarabic'] = 0xFEFC;
- t['lamalefhamzaabovefinalarabic'] = 0xFEF8;
- t['lamalefhamzaaboveisolatedarabic'] = 0xFEF7;
- t['lamalefhamzabelowfinalarabic'] = 0xFEFA;
- t['lamalefhamzabelowisolatedarabic'] = 0xFEF9;
- t['lamalefisolatedarabic'] = 0xFEFB;
- t['lamalefmaddaabovefinalarabic'] = 0xFEF6;
- t['lamalefmaddaaboveisolatedarabic'] = 0xFEF5;
- t['lamarabic'] = 0x0644;
- t['lambda'] = 0x03BB;
- t['lambdastroke'] = 0x019B;
- t['lamed'] = 0x05DC;
- t['lameddagesh'] = 0xFB3C;
- t['lameddageshhebrew'] = 0xFB3C;
- t['lamedhebrew'] = 0x05DC;
- t['lamfinalarabic'] = 0xFEDE;
- t['lamhahinitialarabic'] = 0xFCCA;
- t['laminitialarabic'] = 0xFEDF;
- t['lamjeeminitialarabic'] = 0xFCC9;
- t['lamkhahinitialarabic'] = 0xFCCB;
- t['lamlamhehisolatedarabic'] = 0xFDF2;
- t['lammedialarabic'] = 0xFEE0;
- t['lammeemhahinitialarabic'] = 0xFD88;
- t['lammeeminitialarabic'] = 0xFCCC;
- t['largecircle'] = 0x25EF;
- t['lbar'] = 0x019A;
- t['lbelt'] = 0x026C;
- t['lbopomofo'] = 0x310C;
- t['lcaron'] = 0x013E;
- t['lcedilla'] = 0x013C;
- t['lcircle'] = 0x24DB;
- t['lcircumflexbelow'] = 0x1E3D;
- t['lcommaaccent'] = 0x013C;
- t['ldot'] = 0x0140;
- t['ldotaccent'] = 0x0140;
- t['ldotbelow'] = 0x1E37;
- t['ldotbelowmacron'] = 0x1E39;
- t['leftangleabovecmb'] = 0x031A;
- t['lefttackbelowcmb'] = 0x0318;
- t['less'] = 0x003C;
- t['lessequal'] = 0x2264;
- t['lessequalorgreater'] = 0x22DA;
- t['lessmonospace'] = 0xFF1C;
- t['lessorequivalent'] = 0x2272;
- t['lessorgreater'] = 0x2276;
- t['lessoverequal'] = 0x2266;
- t['lesssmall'] = 0xFE64;
- t['lezh'] = 0x026E;
- t['lfblock'] = 0x258C;
- t['lhookretroflex'] = 0x026D;
- t['lira'] = 0x20A4;
- t['liwnarmenian'] = 0x056C;
- t['lj'] = 0x01C9;
- t['ljecyrillic'] = 0x0459;
- t['ll'] = 0xF6C0;
- t['lladeva'] = 0x0933;
- t['llagujarati'] = 0x0AB3;
- t['llinebelow'] = 0x1E3B;
- t['llladeva'] = 0x0934;
- t['llvocalicbengali'] = 0x09E1;
- t['llvocalicdeva'] = 0x0961;
- t['llvocalicvowelsignbengali'] = 0x09E3;
- t['llvocalicvowelsigndeva'] = 0x0963;
- t['lmiddletilde'] = 0x026B;
- t['lmonospace'] = 0xFF4C;
- t['lmsquare'] = 0x33D0;
- t['lochulathai'] = 0x0E2C;
- t['logicaland'] = 0x2227;
- t['logicalnot'] = 0x00AC;
- t['logicalnotreversed'] = 0x2310;
- t['logicalor'] = 0x2228;
- t['lolingthai'] = 0x0E25;
- t['longs'] = 0x017F;
- t['lowlinecenterline'] = 0xFE4E;
- t['lowlinecmb'] = 0x0332;
- t['lowlinedashed'] = 0xFE4D;
- t['lozenge'] = 0x25CA;
- t['lparen'] = 0x24A7;
- t['lslash'] = 0x0142;
- t['lsquare'] = 0x2113;
- t['lsuperior'] = 0xF6EE;
- t['ltshade'] = 0x2591;
- t['luthai'] = 0x0E26;
- t['lvocalicbengali'] = 0x098C;
- t['lvocalicdeva'] = 0x090C;
- t['lvocalicvowelsignbengali'] = 0x09E2;
- t['lvocalicvowelsigndeva'] = 0x0962;
- t['lxsquare'] = 0x33D3;
- t['m'] = 0x006D;
- t['mabengali'] = 0x09AE;
- t['macron'] = 0x00AF;
- t['macronbelowcmb'] = 0x0331;
- t['macroncmb'] = 0x0304;
- t['macronlowmod'] = 0x02CD;
- t['macronmonospace'] = 0xFFE3;
- t['macute'] = 0x1E3F;
- t['madeva'] = 0x092E;
- t['magujarati'] = 0x0AAE;
- t['magurmukhi'] = 0x0A2E;
- t['mahapakhhebrew'] = 0x05A4;
- t['mahapakhlefthebrew'] = 0x05A4;
- t['mahiragana'] = 0x307E;
- t['maichattawalowleftthai'] = 0xF895;
- t['maichattawalowrightthai'] = 0xF894;
- t['maichattawathai'] = 0x0E4B;
- t['maichattawaupperleftthai'] = 0xF893;
- t['maieklowleftthai'] = 0xF88C;
- t['maieklowrightthai'] = 0xF88B;
- t['maiekthai'] = 0x0E48;
- t['maiekupperleftthai'] = 0xF88A;
- t['maihanakatleftthai'] = 0xF884;
- t['maihanakatthai'] = 0x0E31;
- t['maitaikhuleftthai'] = 0xF889;
- t['maitaikhuthai'] = 0x0E47;
- t['maitholowleftthai'] = 0xF88F;
- t['maitholowrightthai'] = 0xF88E;
- t['maithothai'] = 0x0E49;
- t['maithoupperleftthai'] = 0xF88D;
- t['maitrilowleftthai'] = 0xF892;
- t['maitrilowrightthai'] = 0xF891;
- t['maitrithai'] = 0x0E4A;
- t['maitriupperleftthai'] = 0xF890;
- t['maiyamokthai'] = 0x0E46;
- t['makatakana'] = 0x30DE;
- t['makatakanahalfwidth'] = 0xFF8F;
- t['male'] = 0x2642;
- t['mansyonsquare'] = 0x3347;
- t['maqafhebrew'] = 0x05BE;
- t['mars'] = 0x2642;
- t['masoracirclehebrew'] = 0x05AF;
- t['masquare'] = 0x3383;
- t['mbopomofo'] = 0x3107;
- t['mbsquare'] = 0x33D4;
- t['mcircle'] = 0x24DC;
- t['mcubedsquare'] = 0x33A5;
- t['mdotaccent'] = 0x1E41;
- t['mdotbelow'] = 0x1E43;
- t['meemarabic'] = 0x0645;
- t['meemfinalarabic'] = 0xFEE2;
- t['meeminitialarabic'] = 0xFEE3;
- t['meemmedialarabic'] = 0xFEE4;
- t['meemmeeminitialarabic'] = 0xFCD1;
- t['meemmeemisolatedarabic'] = 0xFC48;
- t['meetorusquare'] = 0x334D;
- t['mehiragana'] = 0x3081;
- t['meizierasquare'] = 0x337E;
- t['mekatakana'] = 0x30E1;
- t['mekatakanahalfwidth'] = 0xFF92;
- t['mem'] = 0x05DE;
- t['memdagesh'] = 0xFB3E;
- t['memdageshhebrew'] = 0xFB3E;
- t['memhebrew'] = 0x05DE;
- t['menarmenian'] = 0x0574;
- t['merkhahebrew'] = 0x05A5;
- t['merkhakefulahebrew'] = 0x05A6;
- t['merkhakefulalefthebrew'] = 0x05A6;
- t['merkhalefthebrew'] = 0x05A5;
- t['mhook'] = 0x0271;
- t['mhzsquare'] = 0x3392;
- t['middledotkatakanahalfwidth'] = 0xFF65;
- t['middot'] = 0x00B7;
- t['mieumacirclekorean'] = 0x3272;
- t['mieumaparenkorean'] = 0x3212;
- t['mieumcirclekorean'] = 0x3264;
- t['mieumkorean'] = 0x3141;
- t['mieumpansioskorean'] = 0x3170;
- t['mieumparenkorean'] = 0x3204;
- t['mieumpieupkorean'] = 0x316E;
- t['mieumsioskorean'] = 0x316F;
- t['mihiragana'] = 0x307F;
- t['mikatakana'] = 0x30DF;
- t['mikatakanahalfwidth'] = 0xFF90;
- t['minus'] = 0x2212;
- t['minusbelowcmb'] = 0x0320;
- t['minuscircle'] = 0x2296;
- t['minusmod'] = 0x02D7;
- t['minusplus'] = 0x2213;
- t['minute'] = 0x2032;
- t['miribaarusquare'] = 0x334A;
- t['mirisquare'] = 0x3349;
- t['mlonglegturned'] = 0x0270;
- t['mlsquare'] = 0x3396;
- t['mmcubedsquare'] = 0x33A3;
- t['mmonospace'] = 0xFF4D;
- t['mmsquaredsquare'] = 0x339F;
- t['mohiragana'] = 0x3082;
- t['mohmsquare'] = 0x33C1;
- t['mokatakana'] = 0x30E2;
- t['mokatakanahalfwidth'] = 0xFF93;
- t['molsquare'] = 0x33D6;
- t['momathai'] = 0x0E21;
- t['moverssquare'] = 0x33A7;
- t['moverssquaredsquare'] = 0x33A8;
- t['mparen'] = 0x24A8;
- t['mpasquare'] = 0x33AB;
- t['mssquare'] = 0x33B3;
- t['msuperior'] = 0xF6EF;
- t['mturned'] = 0x026F;
- t['mu'] = 0x00B5;
- t['mu1'] = 0x00B5;
- t['muasquare'] = 0x3382;
- t['muchgreater'] = 0x226B;
- t['muchless'] = 0x226A;
- t['mufsquare'] = 0x338C;
- t['mugreek'] = 0x03BC;
- t['mugsquare'] = 0x338D;
- t['muhiragana'] = 0x3080;
- t['mukatakana'] = 0x30E0;
- t['mukatakanahalfwidth'] = 0xFF91;
- t['mulsquare'] = 0x3395;
- t['multiply'] = 0x00D7;
- t['mumsquare'] = 0x339B;
- t['munahhebrew'] = 0x05A3;
- t['munahlefthebrew'] = 0x05A3;
- t['musicalnote'] = 0x266A;
- t['musicalnotedbl'] = 0x266B;
- t['musicflatsign'] = 0x266D;
- t['musicsharpsign'] = 0x266F;
- t['mussquare'] = 0x33B2;
- t['muvsquare'] = 0x33B6;
- t['muwsquare'] = 0x33BC;
- t['mvmegasquare'] = 0x33B9;
- t['mvsquare'] = 0x33B7;
- t['mwmegasquare'] = 0x33BF;
- t['mwsquare'] = 0x33BD;
- t['n'] = 0x006E;
- t['nabengali'] = 0x09A8;
- t['nabla'] = 0x2207;
- t['nacute'] = 0x0144;
- t['nadeva'] = 0x0928;
- t['nagujarati'] = 0x0AA8;
- t['nagurmukhi'] = 0x0A28;
- t['nahiragana'] = 0x306A;
- t['nakatakana'] = 0x30CA;
- t['nakatakanahalfwidth'] = 0xFF85;
- t['napostrophe'] = 0x0149;
- t['nasquare'] = 0x3381;
- t['nbopomofo'] = 0x310B;
- t['nbspace'] = 0x00A0;
- t['ncaron'] = 0x0148;
- t['ncedilla'] = 0x0146;
- t['ncircle'] = 0x24DD;
- t['ncircumflexbelow'] = 0x1E4B;
- t['ncommaaccent'] = 0x0146;
- t['ndotaccent'] = 0x1E45;
- t['ndotbelow'] = 0x1E47;
- t['nehiragana'] = 0x306D;
- t['nekatakana'] = 0x30CD;
- t['nekatakanahalfwidth'] = 0xFF88;
- t['newsheqelsign'] = 0x20AA;
- t['nfsquare'] = 0x338B;
- t['ngabengali'] = 0x0999;
- t['ngadeva'] = 0x0919;
- t['ngagujarati'] = 0x0A99;
- t['ngagurmukhi'] = 0x0A19;
- t['ngonguthai'] = 0x0E07;
- t['nhiragana'] = 0x3093;
- t['nhookleft'] = 0x0272;
- t['nhookretroflex'] = 0x0273;
- t['nieunacirclekorean'] = 0x326F;
- t['nieunaparenkorean'] = 0x320F;
- t['nieuncieuckorean'] = 0x3135;
- t['nieuncirclekorean'] = 0x3261;
- t['nieunhieuhkorean'] = 0x3136;
- t['nieunkorean'] = 0x3134;
- t['nieunpansioskorean'] = 0x3168;
- t['nieunparenkorean'] = 0x3201;
- t['nieunsioskorean'] = 0x3167;
- t['nieuntikeutkorean'] = 0x3166;
- t['nihiragana'] = 0x306B;
- t['nikatakana'] = 0x30CB;
- t['nikatakanahalfwidth'] = 0xFF86;
- t['nikhahitleftthai'] = 0xF899;
- t['nikhahitthai'] = 0x0E4D;
- t['nine'] = 0x0039;
- t['ninearabic'] = 0x0669;
- t['ninebengali'] = 0x09EF;
- t['ninecircle'] = 0x2468;
- t['ninecircleinversesansserif'] = 0x2792;
- t['ninedeva'] = 0x096F;
- t['ninegujarati'] = 0x0AEF;
- t['ninegurmukhi'] = 0x0A6F;
- t['ninehackarabic'] = 0x0669;
- t['ninehangzhou'] = 0x3029;
- t['nineideographicparen'] = 0x3228;
- t['nineinferior'] = 0x2089;
- t['ninemonospace'] = 0xFF19;
- t['nineoldstyle'] = 0xF739;
- t['nineparen'] = 0x247C;
- t['nineperiod'] = 0x2490;
- t['ninepersian'] = 0x06F9;
- t['nineroman'] = 0x2178;
- t['ninesuperior'] = 0x2079;
- t['nineteencircle'] = 0x2472;
- t['nineteenparen'] = 0x2486;
- t['nineteenperiod'] = 0x249A;
- t['ninethai'] = 0x0E59;
- t['nj'] = 0x01CC;
- t['njecyrillic'] = 0x045A;
- t['nkatakana'] = 0x30F3;
- t['nkatakanahalfwidth'] = 0xFF9D;
- t['nlegrightlong'] = 0x019E;
- t['nlinebelow'] = 0x1E49;
- t['nmonospace'] = 0xFF4E;
- t['nmsquare'] = 0x339A;
- t['nnabengali'] = 0x09A3;
- t['nnadeva'] = 0x0923;
- t['nnagujarati'] = 0x0AA3;
- t['nnagurmukhi'] = 0x0A23;
- t['nnnadeva'] = 0x0929;
- t['nohiragana'] = 0x306E;
- t['nokatakana'] = 0x30CE;
- t['nokatakanahalfwidth'] = 0xFF89;
- t['nonbreakingspace'] = 0x00A0;
- t['nonenthai'] = 0x0E13;
- t['nonuthai'] = 0x0E19;
- t['noonarabic'] = 0x0646;
- t['noonfinalarabic'] = 0xFEE6;
- t['noonghunnaarabic'] = 0x06BA;
- t['noonghunnafinalarabic'] = 0xFB9F;
- t['nooninitialarabic'] = 0xFEE7;
- t['noonjeeminitialarabic'] = 0xFCD2;
- t['noonjeemisolatedarabic'] = 0xFC4B;
- t['noonmedialarabic'] = 0xFEE8;
- t['noonmeeminitialarabic'] = 0xFCD5;
- t['noonmeemisolatedarabic'] = 0xFC4E;
- t['noonnoonfinalarabic'] = 0xFC8D;
- t['notcontains'] = 0x220C;
- t['notelement'] = 0x2209;
- t['notelementof'] = 0x2209;
- t['notequal'] = 0x2260;
- t['notgreater'] = 0x226F;
- t['notgreaternorequal'] = 0x2271;
- t['notgreaternorless'] = 0x2279;
- t['notidentical'] = 0x2262;
- t['notless'] = 0x226E;
- t['notlessnorequal'] = 0x2270;
- t['notparallel'] = 0x2226;
- t['notprecedes'] = 0x2280;
- t['notsubset'] = 0x2284;
- t['notsucceeds'] = 0x2281;
- t['notsuperset'] = 0x2285;
- t['nowarmenian'] = 0x0576;
- t['nparen'] = 0x24A9;
- t['nssquare'] = 0x33B1;
- t['nsuperior'] = 0x207F;
- t['ntilde'] = 0x00F1;
- t['nu'] = 0x03BD;
- t['nuhiragana'] = 0x306C;
- t['nukatakana'] = 0x30CC;
- t['nukatakanahalfwidth'] = 0xFF87;
- t['nuktabengali'] = 0x09BC;
- t['nuktadeva'] = 0x093C;
- t['nuktagujarati'] = 0x0ABC;
- t['nuktagurmukhi'] = 0x0A3C;
- t['numbersign'] = 0x0023;
- t['numbersignmonospace'] = 0xFF03;
- t['numbersignsmall'] = 0xFE5F;
- t['numeralsigngreek'] = 0x0374;
- t['numeralsignlowergreek'] = 0x0375;
- t['numero'] = 0x2116;
- t['nun'] = 0x05E0;
- t['nundagesh'] = 0xFB40;
- t['nundageshhebrew'] = 0xFB40;
- t['nunhebrew'] = 0x05E0;
- t['nvsquare'] = 0x33B5;
- t['nwsquare'] = 0x33BB;
- t['nyabengali'] = 0x099E;
- t['nyadeva'] = 0x091E;
- t['nyagujarati'] = 0x0A9E;
- t['nyagurmukhi'] = 0x0A1E;
- t['o'] = 0x006F;
- t['oacute'] = 0x00F3;
- t['oangthai'] = 0x0E2D;
- t['obarred'] = 0x0275;
- t['obarredcyrillic'] = 0x04E9;
- t['obarreddieresiscyrillic'] = 0x04EB;
- t['obengali'] = 0x0993;
- t['obopomofo'] = 0x311B;
- t['obreve'] = 0x014F;
- t['ocandradeva'] = 0x0911;
- t['ocandragujarati'] = 0x0A91;
- t['ocandravowelsigndeva'] = 0x0949;
- t['ocandravowelsigngujarati'] = 0x0AC9;
- t['ocaron'] = 0x01D2;
- t['ocircle'] = 0x24DE;
- t['ocircumflex'] = 0x00F4;
- t['ocircumflexacute'] = 0x1ED1;
- t['ocircumflexdotbelow'] = 0x1ED9;
- t['ocircumflexgrave'] = 0x1ED3;
- t['ocircumflexhookabove'] = 0x1ED5;
- t['ocircumflextilde'] = 0x1ED7;
- t['ocyrillic'] = 0x043E;
- t['odblacute'] = 0x0151;
- t['odblgrave'] = 0x020D;
- t['odeva'] = 0x0913;
- t['odieresis'] = 0x00F6;
- t['odieresiscyrillic'] = 0x04E7;
- t['odotbelow'] = 0x1ECD;
- t['oe'] = 0x0153;
- t['oekorean'] = 0x315A;
- t['ogonek'] = 0x02DB;
- t['ogonekcmb'] = 0x0328;
- t['ograve'] = 0x00F2;
- t['ogujarati'] = 0x0A93;
- t['oharmenian'] = 0x0585;
- t['ohiragana'] = 0x304A;
- t['ohookabove'] = 0x1ECF;
- t['ohorn'] = 0x01A1;
- t['ohornacute'] = 0x1EDB;
- t['ohorndotbelow'] = 0x1EE3;
- t['ohorngrave'] = 0x1EDD;
- t['ohornhookabove'] = 0x1EDF;
- t['ohorntilde'] = 0x1EE1;
- t['ohungarumlaut'] = 0x0151;
- t['oi'] = 0x01A3;
- t['oinvertedbreve'] = 0x020F;
- t['okatakana'] = 0x30AA;
- t['okatakanahalfwidth'] = 0xFF75;
- t['okorean'] = 0x3157;
- t['olehebrew'] = 0x05AB;
- t['omacron'] = 0x014D;
- t['omacronacute'] = 0x1E53;
- t['omacrongrave'] = 0x1E51;
- t['omdeva'] = 0x0950;
- t['omega'] = 0x03C9;
- t['omega1'] = 0x03D6;
- t['omegacyrillic'] = 0x0461;
- t['omegalatinclosed'] = 0x0277;
- t['omegaroundcyrillic'] = 0x047B;
- t['omegatitlocyrillic'] = 0x047D;
- t['omegatonos'] = 0x03CE;
- t['omgujarati'] = 0x0AD0;
- t['omicron'] = 0x03BF;
- t['omicrontonos'] = 0x03CC;
- t['omonospace'] = 0xFF4F;
- t['one'] = 0x0031;
- t['onearabic'] = 0x0661;
- t['onebengali'] = 0x09E7;
- t['onecircle'] = 0x2460;
- t['onecircleinversesansserif'] = 0x278A;
- t['onedeva'] = 0x0967;
- t['onedotenleader'] = 0x2024;
- t['oneeighth'] = 0x215B;
- t['onefitted'] = 0xF6DC;
- t['onegujarati'] = 0x0AE7;
- t['onegurmukhi'] = 0x0A67;
- t['onehackarabic'] = 0x0661;
- t['onehalf'] = 0x00BD;
- t['onehangzhou'] = 0x3021;
- t['oneideographicparen'] = 0x3220;
- t['oneinferior'] = 0x2081;
- t['onemonospace'] = 0xFF11;
- t['onenumeratorbengali'] = 0x09F4;
- t['oneoldstyle'] = 0xF731;
- t['oneparen'] = 0x2474;
- t['oneperiod'] = 0x2488;
- t['onepersian'] = 0x06F1;
- t['onequarter'] = 0x00BC;
- t['oneroman'] = 0x2170;
- t['onesuperior'] = 0x00B9;
- t['onethai'] = 0x0E51;
- t['onethird'] = 0x2153;
- t['oogonek'] = 0x01EB;
- t['oogonekmacron'] = 0x01ED;
- t['oogurmukhi'] = 0x0A13;
- t['oomatragurmukhi'] = 0x0A4B;
- t['oopen'] = 0x0254;
- t['oparen'] = 0x24AA;
- t['openbullet'] = 0x25E6;
- t['option'] = 0x2325;
- t['ordfeminine'] = 0x00AA;
- t['ordmasculine'] = 0x00BA;
- t['orthogonal'] = 0x221F;
- t['oshortdeva'] = 0x0912;
- t['oshortvowelsigndeva'] = 0x094A;
- t['oslash'] = 0x00F8;
- t['oslashacute'] = 0x01FF;
- t['osmallhiragana'] = 0x3049;
- t['osmallkatakana'] = 0x30A9;
- t['osmallkatakanahalfwidth'] = 0xFF6B;
- t['ostrokeacute'] = 0x01FF;
- t['osuperior'] = 0xF6F0;
- t['otcyrillic'] = 0x047F;
- t['otilde'] = 0x00F5;
- t['otildeacute'] = 0x1E4D;
- t['otildedieresis'] = 0x1E4F;
- t['oubopomofo'] = 0x3121;
- t['overline'] = 0x203E;
- t['overlinecenterline'] = 0xFE4A;
- t['overlinecmb'] = 0x0305;
- t['overlinedashed'] = 0xFE49;
- t['overlinedblwavy'] = 0xFE4C;
- t['overlinewavy'] = 0xFE4B;
- t['overscore'] = 0x00AF;
- t['ovowelsignbengali'] = 0x09CB;
- t['ovowelsigndeva'] = 0x094B;
- t['ovowelsigngujarati'] = 0x0ACB;
- t['p'] = 0x0070;
- t['paampssquare'] = 0x3380;
- t['paasentosquare'] = 0x332B;
- t['pabengali'] = 0x09AA;
- t['pacute'] = 0x1E55;
- t['padeva'] = 0x092A;
- t['pagedown'] = 0x21DF;
- t['pageup'] = 0x21DE;
- t['pagujarati'] = 0x0AAA;
- t['pagurmukhi'] = 0x0A2A;
- t['pahiragana'] = 0x3071;
- t['paiyannoithai'] = 0x0E2F;
- t['pakatakana'] = 0x30D1;
- t['palatalizationcyrilliccmb'] = 0x0484;
- t['palochkacyrillic'] = 0x04C0;
- t['pansioskorean'] = 0x317F;
- t['paragraph'] = 0x00B6;
- t['parallel'] = 0x2225;
- t['parenleft'] = 0x0028;
- t['parenleftaltonearabic'] = 0xFD3E;
- t['parenleftbt'] = 0xF8ED;
- t['parenleftex'] = 0xF8EC;
- t['parenleftinferior'] = 0x208D;
- t['parenleftmonospace'] = 0xFF08;
- t['parenleftsmall'] = 0xFE59;
- t['parenleftsuperior'] = 0x207D;
- t['parenlefttp'] = 0xF8EB;
- t['parenleftvertical'] = 0xFE35;
- t['parenright'] = 0x0029;
- t['parenrightaltonearabic'] = 0xFD3F;
- t['parenrightbt'] = 0xF8F8;
- t['parenrightex'] = 0xF8F7;
- t['parenrightinferior'] = 0x208E;
- t['parenrightmonospace'] = 0xFF09;
- t['parenrightsmall'] = 0xFE5A;
- t['parenrightsuperior'] = 0x207E;
- t['parenrighttp'] = 0xF8F6;
- t['parenrightvertical'] = 0xFE36;
- t['partialdiff'] = 0x2202;
- t['paseqhebrew'] = 0x05C0;
- t['pashtahebrew'] = 0x0599;
- t['pasquare'] = 0x33A9;
- t['patah'] = 0x05B7;
- t['patah11'] = 0x05B7;
- t['patah1d'] = 0x05B7;
- t['patah2a'] = 0x05B7;
- t['patahhebrew'] = 0x05B7;
- t['patahnarrowhebrew'] = 0x05B7;
- t['patahquarterhebrew'] = 0x05B7;
- t['patahwidehebrew'] = 0x05B7;
- t['pazerhebrew'] = 0x05A1;
- t['pbopomofo'] = 0x3106;
- t['pcircle'] = 0x24DF;
- t['pdotaccent'] = 0x1E57;
- t['pe'] = 0x05E4;
- t['pecyrillic'] = 0x043F;
- t['pedagesh'] = 0xFB44;
- t['pedageshhebrew'] = 0xFB44;
- t['peezisquare'] = 0x333B;
- t['pefinaldageshhebrew'] = 0xFB43;
- t['peharabic'] = 0x067E;
- t['peharmenian'] = 0x057A;
- t['pehebrew'] = 0x05E4;
- t['pehfinalarabic'] = 0xFB57;
- t['pehinitialarabic'] = 0xFB58;
- t['pehiragana'] = 0x307A;
- t['pehmedialarabic'] = 0xFB59;
- t['pekatakana'] = 0x30DA;
- t['pemiddlehookcyrillic'] = 0x04A7;
- t['perafehebrew'] = 0xFB4E;
- t['percent'] = 0x0025;
- t['percentarabic'] = 0x066A;
- t['percentmonospace'] = 0xFF05;
- t['percentsmall'] = 0xFE6A;
- t['period'] = 0x002E;
- t['periodarmenian'] = 0x0589;
- t['periodcentered'] = 0x00B7;
- t['periodhalfwidth'] = 0xFF61;
- t['periodinferior'] = 0xF6E7;
- t['periodmonospace'] = 0xFF0E;
- t['periodsmall'] = 0xFE52;
- t['periodsuperior'] = 0xF6E8;
- t['perispomenigreekcmb'] = 0x0342;
- t['perpendicular'] = 0x22A5;
- t['perthousand'] = 0x2030;
- t['peseta'] = 0x20A7;
- t['pfsquare'] = 0x338A;
- t['phabengali'] = 0x09AB;
- t['phadeva'] = 0x092B;
- t['phagujarati'] = 0x0AAB;
- t['phagurmukhi'] = 0x0A2B;
- t['phi'] = 0x03C6;
- t['phi1'] = 0x03D5;
- t['phieuphacirclekorean'] = 0x327A;
- t['phieuphaparenkorean'] = 0x321A;
- t['phieuphcirclekorean'] = 0x326C;
- t['phieuphkorean'] = 0x314D;
- t['phieuphparenkorean'] = 0x320C;
- t['philatin'] = 0x0278;
- t['phinthuthai'] = 0x0E3A;
- t['phisymbolgreek'] = 0x03D5;
- t['phook'] = 0x01A5;
- t['phophanthai'] = 0x0E1E;
- t['phophungthai'] = 0x0E1C;
- t['phosamphaothai'] = 0x0E20;
- t['pi'] = 0x03C0;
- t['pieupacirclekorean'] = 0x3273;
- t['pieupaparenkorean'] = 0x3213;
- t['pieupcieuckorean'] = 0x3176;
- t['pieupcirclekorean'] = 0x3265;
- t['pieupkiyeokkorean'] = 0x3172;
- t['pieupkorean'] = 0x3142;
- t['pieupparenkorean'] = 0x3205;
- t['pieupsioskiyeokkorean'] = 0x3174;
- t['pieupsioskorean'] = 0x3144;
- t['pieupsiostikeutkorean'] = 0x3175;
- t['pieupthieuthkorean'] = 0x3177;
- t['pieuptikeutkorean'] = 0x3173;
- t['pihiragana'] = 0x3074;
- t['pikatakana'] = 0x30D4;
- t['pisymbolgreek'] = 0x03D6;
- t['piwrarmenian'] = 0x0583;
- t['plus'] = 0x002B;
- t['plusbelowcmb'] = 0x031F;
- t['pluscircle'] = 0x2295;
- t['plusminus'] = 0x00B1;
- t['plusmod'] = 0x02D6;
- t['plusmonospace'] = 0xFF0B;
- t['plussmall'] = 0xFE62;
- t['plussuperior'] = 0x207A;
- t['pmonospace'] = 0xFF50;
- t['pmsquare'] = 0x33D8;
- t['pohiragana'] = 0x307D;
- t['pointingindexdownwhite'] = 0x261F;
- t['pointingindexleftwhite'] = 0x261C;
- t['pointingindexrightwhite'] = 0x261E;
- t['pointingindexupwhite'] = 0x261D;
- t['pokatakana'] = 0x30DD;
- t['poplathai'] = 0x0E1B;
- t['postalmark'] = 0x3012;
- t['postalmarkface'] = 0x3020;
- t['pparen'] = 0x24AB;
- t['precedes'] = 0x227A;
- t['prescription'] = 0x211E;
- t['primemod'] = 0x02B9;
- t['primereversed'] = 0x2035;
- t['product'] = 0x220F;
- t['projective'] = 0x2305;
- t['prolongedkana'] = 0x30FC;
- t['propellor'] = 0x2318;
- t['propersubset'] = 0x2282;
- t['propersuperset'] = 0x2283;
- t['proportion'] = 0x2237;
- t['proportional'] = 0x221D;
- t['psi'] = 0x03C8;
- t['psicyrillic'] = 0x0471;
- t['psilipneumatacyrilliccmb'] = 0x0486;
- t['pssquare'] = 0x33B0;
- t['puhiragana'] = 0x3077;
- t['pukatakana'] = 0x30D7;
- t['pvsquare'] = 0x33B4;
- t['pwsquare'] = 0x33BA;
- t['q'] = 0x0071;
- t['qadeva'] = 0x0958;
- t['qadmahebrew'] = 0x05A8;
- t['qafarabic'] = 0x0642;
- t['qaffinalarabic'] = 0xFED6;
- t['qafinitialarabic'] = 0xFED7;
- t['qafmedialarabic'] = 0xFED8;
- t['qamats'] = 0x05B8;
- t['qamats10'] = 0x05B8;
- t['qamats1a'] = 0x05B8;
- t['qamats1c'] = 0x05B8;
- t['qamats27'] = 0x05B8;
- t['qamats29'] = 0x05B8;
- t['qamats33'] = 0x05B8;
- t['qamatsde'] = 0x05B8;
- t['qamatshebrew'] = 0x05B8;
- t['qamatsnarrowhebrew'] = 0x05B8;
- t['qamatsqatanhebrew'] = 0x05B8;
- t['qamatsqatannarrowhebrew'] = 0x05B8;
- t['qamatsqatanquarterhebrew'] = 0x05B8;
- t['qamatsqatanwidehebrew'] = 0x05B8;
- t['qamatsquarterhebrew'] = 0x05B8;
- t['qamatswidehebrew'] = 0x05B8;
- t['qarneyparahebrew'] = 0x059F;
- t['qbopomofo'] = 0x3111;
- t['qcircle'] = 0x24E0;
- t['qhook'] = 0x02A0;
- t['qmonospace'] = 0xFF51;
- t['qof'] = 0x05E7;
- t['qofdagesh'] = 0xFB47;
- t['qofdageshhebrew'] = 0xFB47;
- t['qofhebrew'] = 0x05E7;
- t['qparen'] = 0x24AC;
- t['quarternote'] = 0x2669;
- t['qubuts'] = 0x05BB;
- t['qubuts18'] = 0x05BB;
- t['qubuts25'] = 0x05BB;
- t['qubuts31'] = 0x05BB;
- t['qubutshebrew'] = 0x05BB;
- t['qubutsnarrowhebrew'] = 0x05BB;
- t['qubutsquarterhebrew'] = 0x05BB;
- t['qubutswidehebrew'] = 0x05BB;
- t['question'] = 0x003F;
- t['questionarabic'] = 0x061F;
- t['questionarmenian'] = 0x055E;
- t['questiondown'] = 0x00BF;
- t['questiondownsmall'] = 0xF7BF;
- t['questiongreek'] = 0x037E;
- t['questionmonospace'] = 0xFF1F;
- t['questionsmall'] = 0xF73F;
- t['quotedbl'] = 0x0022;
- t['quotedblbase'] = 0x201E;
- t['quotedblleft'] = 0x201C;
- t['quotedblmonospace'] = 0xFF02;
- t['quotedblprime'] = 0x301E;
- t['quotedblprimereversed'] = 0x301D;
- t['quotedblright'] = 0x201D;
- t['quoteleft'] = 0x2018;
- t['quoteleftreversed'] = 0x201B;
- t['quotereversed'] = 0x201B;
- t['quoteright'] = 0x2019;
- t['quoterightn'] = 0x0149;
- t['quotesinglbase'] = 0x201A;
- t['quotesingle'] = 0x0027;
- t['quotesinglemonospace'] = 0xFF07;
- t['r'] = 0x0072;
- t['raarmenian'] = 0x057C;
- t['rabengali'] = 0x09B0;
- t['racute'] = 0x0155;
- t['radeva'] = 0x0930;
- t['radical'] = 0x221A;
- t['radicalex'] = 0xF8E5;
- t['radoverssquare'] = 0x33AE;
- t['radoverssquaredsquare'] = 0x33AF;
- t['radsquare'] = 0x33AD;
- t['rafe'] = 0x05BF;
- t['rafehebrew'] = 0x05BF;
- t['ragujarati'] = 0x0AB0;
- t['ragurmukhi'] = 0x0A30;
- t['rahiragana'] = 0x3089;
- t['rakatakana'] = 0x30E9;
- t['rakatakanahalfwidth'] = 0xFF97;
- t['ralowerdiagonalbengali'] = 0x09F1;
- t['ramiddlediagonalbengali'] = 0x09F0;
- t['ramshorn'] = 0x0264;
- t['ratio'] = 0x2236;
- t['rbopomofo'] = 0x3116;
- t['rcaron'] = 0x0159;
- t['rcedilla'] = 0x0157;
- t['rcircle'] = 0x24E1;
- t['rcommaaccent'] = 0x0157;
- t['rdblgrave'] = 0x0211;
- t['rdotaccent'] = 0x1E59;
- t['rdotbelow'] = 0x1E5B;
- t['rdotbelowmacron'] = 0x1E5D;
- t['referencemark'] = 0x203B;
- t['reflexsubset'] = 0x2286;
- t['reflexsuperset'] = 0x2287;
- t['registered'] = 0x00AE;
- t['registersans'] = 0xF8E8;
- t['registerserif'] = 0xF6DA;
- t['reharabic'] = 0x0631;
- t['reharmenian'] = 0x0580;
- t['rehfinalarabic'] = 0xFEAE;
- t['rehiragana'] = 0x308C;
- t['rekatakana'] = 0x30EC;
- t['rekatakanahalfwidth'] = 0xFF9A;
- t['resh'] = 0x05E8;
- t['reshdageshhebrew'] = 0xFB48;
- t['reshhebrew'] = 0x05E8;
- t['reversedtilde'] = 0x223D;
- t['reviahebrew'] = 0x0597;
- t['reviamugrashhebrew'] = 0x0597;
- t['revlogicalnot'] = 0x2310;
- t['rfishhook'] = 0x027E;
- t['rfishhookreversed'] = 0x027F;
- t['rhabengali'] = 0x09DD;
- t['rhadeva'] = 0x095D;
- t['rho'] = 0x03C1;
- t['rhook'] = 0x027D;
- t['rhookturned'] = 0x027B;
- t['rhookturnedsuperior'] = 0x02B5;
- t['rhosymbolgreek'] = 0x03F1;
- t['rhotichookmod'] = 0x02DE;
- t['rieulacirclekorean'] = 0x3271;
- t['rieulaparenkorean'] = 0x3211;
- t['rieulcirclekorean'] = 0x3263;
- t['rieulhieuhkorean'] = 0x3140;
- t['rieulkiyeokkorean'] = 0x313A;
- t['rieulkiyeoksioskorean'] = 0x3169;
- t['rieulkorean'] = 0x3139;
- t['rieulmieumkorean'] = 0x313B;
- t['rieulpansioskorean'] = 0x316C;
- t['rieulparenkorean'] = 0x3203;
- t['rieulphieuphkorean'] = 0x313F;
- t['rieulpieupkorean'] = 0x313C;
- t['rieulpieupsioskorean'] = 0x316B;
- t['rieulsioskorean'] = 0x313D;
- t['rieulthieuthkorean'] = 0x313E;
- t['rieultikeutkorean'] = 0x316A;
- t['rieulyeorinhieuhkorean'] = 0x316D;
- t['rightangle'] = 0x221F;
- t['righttackbelowcmb'] = 0x0319;
- t['righttriangle'] = 0x22BF;
- t['rihiragana'] = 0x308A;
- t['rikatakana'] = 0x30EA;
- t['rikatakanahalfwidth'] = 0xFF98;
- t['ring'] = 0x02DA;
- t['ringbelowcmb'] = 0x0325;
- t['ringcmb'] = 0x030A;
- t['ringhalfleft'] = 0x02BF;
- t['ringhalfleftarmenian'] = 0x0559;
- t['ringhalfleftbelowcmb'] = 0x031C;
- t['ringhalfleftcentered'] = 0x02D3;
- t['ringhalfright'] = 0x02BE;
- t['ringhalfrightbelowcmb'] = 0x0339;
- t['ringhalfrightcentered'] = 0x02D2;
- t['rinvertedbreve'] = 0x0213;
- t['rittorusquare'] = 0x3351;
- t['rlinebelow'] = 0x1E5F;
- t['rlongleg'] = 0x027C;
- t['rlonglegturned'] = 0x027A;
- t['rmonospace'] = 0xFF52;
- t['rohiragana'] = 0x308D;
- t['rokatakana'] = 0x30ED;
- t['rokatakanahalfwidth'] = 0xFF9B;
- t['roruathai'] = 0x0E23;
- t['rparen'] = 0x24AD;
- t['rrabengali'] = 0x09DC;
- t['rradeva'] = 0x0931;
- t['rragurmukhi'] = 0x0A5C;
- t['rreharabic'] = 0x0691;
- t['rrehfinalarabic'] = 0xFB8D;
- t['rrvocalicbengali'] = 0x09E0;
- t['rrvocalicdeva'] = 0x0960;
- t['rrvocalicgujarati'] = 0x0AE0;
- t['rrvocalicvowelsignbengali'] = 0x09C4;
- t['rrvocalicvowelsigndeva'] = 0x0944;
- t['rrvocalicvowelsigngujarati'] = 0x0AC4;
- t['rsuperior'] = 0xF6F1;
- t['rtblock'] = 0x2590;
- t['rturned'] = 0x0279;
- t['rturnedsuperior'] = 0x02B4;
- t['ruhiragana'] = 0x308B;
- t['rukatakana'] = 0x30EB;
- t['rukatakanahalfwidth'] = 0xFF99;
- t['rupeemarkbengali'] = 0x09F2;
- t['rupeesignbengali'] = 0x09F3;
- t['rupiah'] = 0xF6DD;
- t['ruthai'] = 0x0E24;
- t['rvocalicbengali'] = 0x098B;
- t['rvocalicdeva'] = 0x090B;
- t['rvocalicgujarati'] = 0x0A8B;
- t['rvocalicvowelsignbengali'] = 0x09C3;
- t['rvocalicvowelsigndeva'] = 0x0943;
- t['rvocalicvowelsigngujarati'] = 0x0AC3;
- t['s'] = 0x0073;
- t['sabengali'] = 0x09B8;
- t['sacute'] = 0x015B;
- t['sacutedotaccent'] = 0x1E65;
- t['sadarabic'] = 0x0635;
- t['sadeva'] = 0x0938;
- t['sadfinalarabic'] = 0xFEBA;
- t['sadinitialarabic'] = 0xFEBB;
- t['sadmedialarabic'] = 0xFEBC;
- t['sagujarati'] = 0x0AB8;
- t['sagurmukhi'] = 0x0A38;
- t['sahiragana'] = 0x3055;
- t['sakatakana'] = 0x30B5;
- t['sakatakanahalfwidth'] = 0xFF7B;
- t['sallallahoualayhewasallamarabic'] = 0xFDFA;
- t['samekh'] = 0x05E1;
- t['samekhdagesh'] = 0xFB41;
- t['samekhdageshhebrew'] = 0xFB41;
- t['samekhhebrew'] = 0x05E1;
- t['saraaathai'] = 0x0E32;
- t['saraaethai'] = 0x0E41;
- t['saraaimaimalaithai'] = 0x0E44;
- t['saraaimaimuanthai'] = 0x0E43;
- t['saraamthai'] = 0x0E33;
- t['saraathai'] = 0x0E30;
- t['saraethai'] = 0x0E40;
- t['saraiileftthai'] = 0xF886;
- t['saraiithai'] = 0x0E35;
- t['saraileftthai'] = 0xF885;
- t['saraithai'] = 0x0E34;
- t['saraothai'] = 0x0E42;
- t['saraueeleftthai'] = 0xF888;
- t['saraueethai'] = 0x0E37;
- t['saraueleftthai'] = 0xF887;
- t['sarauethai'] = 0x0E36;
- t['sarauthai'] = 0x0E38;
- t['sarauuthai'] = 0x0E39;
- t['sbopomofo'] = 0x3119;
- t['scaron'] = 0x0161;
- t['scarondotaccent'] = 0x1E67;
- t['scedilla'] = 0x015F;
- t['schwa'] = 0x0259;
- t['schwacyrillic'] = 0x04D9;
- t['schwadieresiscyrillic'] = 0x04DB;
- t['schwahook'] = 0x025A;
- t['scircle'] = 0x24E2;
- t['scircumflex'] = 0x015D;
- t['scommaaccent'] = 0x0219;
- t['sdotaccent'] = 0x1E61;
- t['sdotbelow'] = 0x1E63;
- t['sdotbelowdotaccent'] = 0x1E69;
- t['seagullbelowcmb'] = 0x033C;
- t['second'] = 0x2033;
- t['secondtonechinese'] = 0x02CA;
- t['section'] = 0x00A7;
- t['seenarabic'] = 0x0633;
- t['seenfinalarabic'] = 0xFEB2;
- t['seeninitialarabic'] = 0xFEB3;
- t['seenmedialarabic'] = 0xFEB4;
- t['segol'] = 0x05B6;
- t['segol13'] = 0x05B6;
- t['segol1f'] = 0x05B6;
- t['segol2c'] = 0x05B6;
- t['segolhebrew'] = 0x05B6;
- t['segolnarrowhebrew'] = 0x05B6;
- t['segolquarterhebrew'] = 0x05B6;
- t['segoltahebrew'] = 0x0592;
- t['segolwidehebrew'] = 0x05B6;
- t['seharmenian'] = 0x057D;
- t['sehiragana'] = 0x305B;
- t['sekatakana'] = 0x30BB;
- t['sekatakanahalfwidth'] = 0xFF7E;
- t['semicolon'] = 0x003B;
- t['semicolonarabic'] = 0x061B;
- t['semicolonmonospace'] = 0xFF1B;
- t['semicolonsmall'] = 0xFE54;
- t['semivoicedmarkkana'] = 0x309C;
- t['semivoicedmarkkanahalfwidth'] = 0xFF9F;
- t['sentisquare'] = 0x3322;
- t['sentosquare'] = 0x3323;
- t['seven'] = 0x0037;
- t['sevenarabic'] = 0x0667;
- t['sevenbengali'] = 0x09ED;
- t['sevencircle'] = 0x2466;
- t['sevencircleinversesansserif'] = 0x2790;
- t['sevendeva'] = 0x096D;
- t['seveneighths'] = 0x215E;
- t['sevengujarati'] = 0x0AED;
- t['sevengurmukhi'] = 0x0A6D;
- t['sevenhackarabic'] = 0x0667;
- t['sevenhangzhou'] = 0x3027;
- t['sevenideographicparen'] = 0x3226;
- t['seveninferior'] = 0x2087;
- t['sevenmonospace'] = 0xFF17;
- t['sevenoldstyle'] = 0xF737;
- t['sevenparen'] = 0x247A;
- t['sevenperiod'] = 0x248E;
- t['sevenpersian'] = 0x06F7;
- t['sevenroman'] = 0x2176;
- t['sevensuperior'] = 0x2077;
- t['seventeencircle'] = 0x2470;
- t['seventeenparen'] = 0x2484;
- t['seventeenperiod'] = 0x2498;
- t['seventhai'] = 0x0E57;
- t['sfthyphen'] = 0x00AD;
- t['shaarmenian'] = 0x0577;
- t['shabengali'] = 0x09B6;
- t['shacyrillic'] = 0x0448;
- t['shaddaarabic'] = 0x0651;
- t['shaddadammaarabic'] = 0xFC61;
- t['shaddadammatanarabic'] = 0xFC5E;
- t['shaddafathaarabic'] = 0xFC60;
- t['shaddakasraarabic'] = 0xFC62;
- t['shaddakasratanarabic'] = 0xFC5F;
- t['shade'] = 0x2592;
- t['shadedark'] = 0x2593;
- t['shadelight'] = 0x2591;
- t['shademedium'] = 0x2592;
- t['shadeva'] = 0x0936;
- t['shagujarati'] = 0x0AB6;
- t['shagurmukhi'] = 0x0A36;
- t['shalshelethebrew'] = 0x0593;
- t['shbopomofo'] = 0x3115;
- t['shchacyrillic'] = 0x0449;
- t['sheenarabic'] = 0x0634;
- t['sheenfinalarabic'] = 0xFEB6;
- t['sheeninitialarabic'] = 0xFEB7;
- t['sheenmedialarabic'] = 0xFEB8;
- t['sheicoptic'] = 0x03E3;
- t['sheqel'] = 0x20AA;
- t['sheqelhebrew'] = 0x20AA;
- t['sheva'] = 0x05B0;
- t['sheva115'] = 0x05B0;
- t['sheva15'] = 0x05B0;
- t['sheva22'] = 0x05B0;
- t['sheva2e'] = 0x05B0;
- t['shevahebrew'] = 0x05B0;
- t['shevanarrowhebrew'] = 0x05B0;
- t['shevaquarterhebrew'] = 0x05B0;
- t['shevawidehebrew'] = 0x05B0;
- t['shhacyrillic'] = 0x04BB;
- t['shimacoptic'] = 0x03ED;
- t['shin'] = 0x05E9;
- t['shindagesh'] = 0xFB49;
- t['shindageshhebrew'] = 0xFB49;
- t['shindageshshindot'] = 0xFB2C;
- t['shindageshshindothebrew'] = 0xFB2C;
- t['shindageshsindot'] = 0xFB2D;
- t['shindageshsindothebrew'] = 0xFB2D;
- t['shindothebrew'] = 0x05C1;
- t['shinhebrew'] = 0x05E9;
- t['shinshindot'] = 0xFB2A;
- t['shinshindothebrew'] = 0xFB2A;
- t['shinsindot'] = 0xFB2B;
- t['shinsindothebrew'] = 0xFB2B;
- t['shook'] = 0x0282;
- t['sigma'] = 0x03C3;
- t['sigma1'] = 0x03C2;
- t['sigmafinal'] = 0x03C2;
- t['sigmalunatesymbolgreek'] = 0x03F2;
- t['sihiragana'] = 0x3057;
- t['sikatakana'] = 0x30B7;
- t['sikatakanahalfwidth'] = 0xFF7C;
- t['siluqhebrew'] = 0x05BD;
- t['siluqlefthebrew'] = 0x05BD;
- t['similar'] = 0x223C;
- t['sindothebrew'] = 0x05C2;
- t['siosacirclekorean'] = 0x3274;
- t['siosaparenkorean'] = 0x3214;
- t['sioscieuckorean'] = 0x317E;
- t['sioscirclekorean'] = 0x3266;
- t['sioskiyeokkorean'] = 0x317A;
- t['sioskorean'] = 0x3145;
- t['siosnieunkorean'] = 0x317B;
- t['siosparenkorean'] = 0x3206;
- t['siospieupkorean'] = 0x317D;
- t['siostikeutkorean'] = 0x317C;
- t['six'] = 0x0036;
- t['sixarabic'] = 0x0666;
- t['sixbengali'] = 0x09EC;
- t['sixcircle'] = 0x2465;
- t['sixcircleinversesansserif'] = 0x278F;
- t['sixdeva'] = 0x096C;
- t['sixgujarati'] = 0x0AEC;
- t['sixgurmukhi'] = 0x0A6C;
- t['sixhackarabic'] = 0x0666;
- t['sixhangzhou'] = 0x3026;
- t['sixideographicparen'] = 0x3225;
- t['sixinferior'] = 0x2086;
- t['sixmonospace'] = 0xFF16;
- t['sixoldstyle'] = 0xF736;
- t['sixparen'] = 0x2479;
- t['sixperiod'] = 0x248D;
- t['sixpersian'] = 0x06F6;
- t['sixroman'] = 0x2175;
- t['sixsuperior'] = 0x2076;
- t['sixteencircle'] = 0x246F;
- t['sixteencurrencydenominatorbengali'] = 0x09F9;
- t['sixteenparen'] = 0x2483;
- t['sixteenperiod'] = 0x2497;
- t['sixthai'] = 0x0E56;
- t['slash'] = 0x002F;
- t['slashmonospace'] = 0xFF0F;
- t['slong'] = 0x017F;
- t['slongdotaccent'] = 0x1E9B;
- t['smileface'] = 0x263A;
- t['smonospace'] = 0xFF53;
- t['sofpasuqhebrew'] = 0x05C3;
- t['softhyphen'] = 0x00AD;
- t['softsigncyrillic'] = 0x044C;
- t['sohiragana'] = 0x305D;
- t['sokatakana'] = 0x30BD;
- t['sokatakanahalfwidth'] = 0xFF7F;
- t['soliduslongoverlaycmb'] = 0x0338;
- t['solidusshortoverlaycmb'] = 0x0337;
- t['sorusithai'] = 0x0E29;
- t['sosalathai'] = 0x0E28;
- t['sosothai'] = 0x0E0B;
- t['sosuathai'] = 0x0E2A;
- t['space'] = 0x0020;
- t['spacehackarabic'] = 0x0020;
- t['spade'] = 0x2660;
- t['spadesuitblack'] = 0x2660;
- t['spadesuitwhite'] = 0x2664;
- t['sparen'] = 0x24AE;
- t['squarebelowcmb'] = 0x033B;
- t['squarecc'] = 0x33C4;
- t['squarecm'] = 0x339D;
- t['squarediagonalcrosshatchfill'] = 0x25A9;
- t['squarehorizontalfill'] = 0x25A4;
- t['squarekg'] = 0x338F;
- t['squarekm'] = 0x339E;
- t['squarekmcapital'] = 0x33CE;
- t['squareln'] = 0x33D1;
- t['squarelog'] = 0x33D2;
- t['squaremg'] = 0x338E;
- t['squaremil'] = 0x33D5;
- t['squaremm'] = 0x339C;
- t['squaremsquared'] = 0x33A1;
- t['squareorthogonalcrosshatchfill'] = 0x25A6;
- t['squareupperlefttolowerrightfill'] = 0x25A7;
- t['squareupperrighttolowerleftfill'] = 0x25A8;
- t['squareverticalfill'] = 0x25A5;
- t['squarewhitewithsmallblack'] = 0x25A3;
- t['srsquare'] = 0x33DB;
- t['ssabengali'] = 0x09B7;
- t['ssadeva'] = 0x0937;
- t['ssagujarati'] = 0x0AB7;
- t['ssangcieuckorean'] = 0x3149;
- t['ssanghieuhkorean'] = 0x3185;
- t['ssangieungkorean'] = 0x3180;
- t['ssangkiyeokkorean'] = 0x3132;
- t['ssangnieunkorean'] = 0x3165;
- t['ssangpieupkorean'] = 0x3143;
- t['ssangsioskorean'] = 0x3146;
- t['ssangtikeutkorean'] = 0x3138;
- t['ssuperior'] = 0xF6F2;
- t['sterling'] = 0x00A3;
- t['sterlingmonospace'] = 0xFFE1;
- t['strokelongoverlaycmb'] = 0x0336;
- t['strokeshortoverlaycmb'] = 0x0335;
- t['subset'] = 0x2282;
- t['subsetnotequal'] = 0x228A;
- t['subsetorequal'] = 0x2286;
- t['succeeds'] = 0x227B;
- t['suchthat'] = 0x220B;
- t['suhiragana'] = 0x3059;
- t['sukatakana'] = 0x30B9;
- t['sukatakanahalfwidth'] = 0xFF7D;
- t['sukunarabic'] = 0x0652;
- t['summation'] = 0x2211;
- t['sun'] = 0x263C;
- t['superset'] = 0x2283;
- t['supersetnotequal'] = 0x228B;
- t['supersetorequal'] = 0x2287;
- t['svsquare'] = 0x33DC;
- t['syouwaerasquare'] = 0x337C;
- t['t'] = 0x0074;
- t['tabengali'] = 0x09A4;
- t['tackdown'] = 0x22A4;
- t['tackleft'] = 0x22A3;
- t['tadeva'] = 0x0924;
- t['tagujarati'] = 0x0AA4;
- t['tagurmukhi'] = 0x0A24;
- t['taharabic'] = 0x0637;
- t['tahfinalarabic'] = 0xFEC2;
- t['tahinitialarabic'] = 0xFEC3;
- t['tahiragana'] = 0x305F;
- t['tahmedialarabic'] = 0xFEC4;
- t['taisyouerasquare'] = 0x337D;
- t['takatakana'] = 0x30BF;
- t['takatakanahalfwidth'] = 0xFF80;
- t['tatweelarabic'] = 0x0640;
- t['tau'] = 0x03C4;
- t['tav'] = 0x05EA;
- t['tavdages'] = 0xFB4A;
- t['tavdagesh'] = 0xFB4A;
- t['tavdageshhebrew'] = 0xFB4A;
- t['tavhebrew'] = 0x05EA;
- t['tbar'] = 0x0167;
- t['tbopomofo'] = 0x310A;
- t['tcaron'] = 0x0165;
- t['tccurl'] = 0x02A8;
- t['tcedilla'] = 0x0163;
- t['tcheharabic'] = 0x0686;
- t['tchehfinalarabic'] = 0xFB7B;
- t['tchehinitialarabic'] = 0xFB7C;
- t['tchehmedialarabic'] = 0xFB7D;
- t['tcircle'] = 0x24E3;
- t['tcircumflexbelow'] = 0x1E71;
- t['tcommaaccent'] = 0x0163;
- t['tdieresis'] = 0x1E97;
- t['tdotaccent'] = 0x1E6B;
- t['tdotbelow'] = 0x1E6D;
- t['tecyrillic'] = 0x0442;
- t['tedescendercyrillic'] = 0x04AD;
- t['teharabic'] = 0x062A;
- t['tehfinalarabic'] = 0xFE96;
- t['tehhahinitialarabic'] = 0xFCA2;
- t['tehhahisolatedarabic'] = 0xFC0C;
- t['tehinitialarabic'] = 0xFE97;
- t['tehiragana'] = 0x3066;
- t['tehjeeminitialarabic'] = 0xFCA1;
- t['tehjeemisolatedarabic'] = 0xFC0B;
- t['tehmarbutaarabic'] = 0x0629;
- t['tehmarbutafinalarabic'] = 0xFE94;
- t['tehmedialarabic'] = 0xFE98;
- t['tehmeeminitialarabic'] = 0xFCA4;
- t['tehmeemisolatedarabic'] = 0xFC0E;
- t['tehnoonfinalarabic'] = 0xFC73;
- t['tekatakana'] = 0x30C6;
- t['tekatakanahalfwidth'] = 0xFF83;
- t['telephone'] = 0x2121;
- t['telephoneblack'] = 0x260E;
- t['telishagedolahebrew'] = 0x05A0;
- t['telishaqetanahebrew'] = 0x05A9;
- t['tencircle'] = 0x2469;
- t['tenideographicparen'] = 0x3229;
- t['tenparen'] = 0x247D;
- t['tenperiod'] = 0x2491;
- t['tenroman'] = 0x2179;
- t['tesh'] = 0x02A7;
- t['tet'] = 0x05D8;
- t['tetdagesh'] = 0xFB38;
- t['tetdageshhebrew'] = 0xFB38;
- t['tethebrew'] = 0x05D8;
- t['tetsecyrillic'] = 0x04B5;
- t['tevirhebrew'] = 0x059B;
- t['tevirlefthebrew'] = 0x059B;
- t['thabengali'] = 0x09A5;
- t['thadeva'] = 0x0925;
- t['thagujarati'] = 0x0AA5;
- t['thagurmukhi'] = 0x0A25;
- t['thalarabic'] = 0x0630;
- t['thalfinalarabic'] = 0xFEAC;
- t['thanthakhatlowleftthai'] = 0xF898;
- t['thanthakhatlowrightthai'] = 0xF897;
- t['thanthakhatthai'] = 0x0E4C;
- t['thanthakhatupperleftthai'] = 0xF896;
- t['theharabic'] = 0x062B;
- t['thehfinalarabic'] = 0xFE9A;
- t['thehinitialarabic'] = 0xFE9B;
- t['thehmedialarabic'] = 0xFE9C;
- t['thereexists'] = 0x2203;
- t['therefore'] = 0x2234;
- t['theta'] = 0x03B8;
- t['theta1'] = 0x03D1;
- t['thetasymbolgreek'] = 0x03D1;
- t['thieuthacirclekorean'] = 0x3279;
- t['thieuthaparenkorean'] = 0x3219;
- t['thieuthcirclekorean'] = 0x326B;
- t['thieuthkorean'] = 0x314C;
- t['thieuthparenkorean'] = 0x320B;
- t['thirteencircle'] = 0x246C;
- t['thirteenparen'] = 0x2480;
- t['thirteenperiod'] = 0x2494;
- t['thonangmonthothai'] = 0x0E11;
- t['thook'] = 0x01AD;
- t['thophuthaothai'] = 0x0E12;
- t['thorn'] = 0x00FE;
- t['thothahanthai'] = 0x0E17;
- t['thothanthai'] = 0x0E10;
- t['thothongthai'] = 0x0E18;
- t['thothungthai'] = 0x0E16;
- t['thousandcyrillic'] = 0x0482;
- t['thousandsseparatorarabic'] = 0x066C;
- t['thousandsseparatorpersian'] = 0x066C;
- t['three'] = 0x0033;
- t['threearabic'] = 0x0663;
- t['threebengali'] = 0x09E9;
- t['threecircle'] = 0x2462;
- t['threecircleinversesansserif'] = 0x278C;
- t['threedeva'] = 0x0969;
- t['threeeighths'] = 0x215C;
- t['threegujarati'] = 0x0AE9;
- t['threegurmukhi'] = 0x0A69;
- t['threehackarabic'] = 0x0663;
- t['threehangzhou'] = 0x3023;
- t['threeideographicparen'] = 0x3222;
- t['threeinferior'] = 0x2083;
- t['threemonospace'] = 0xFF13;
- t['threenumeratorbengali'] = 0x09F6;
- t['threeoldstyle'] = 0xF733;
- t['threeparen'] = 0x2476;
- t['threeperiod'] = 0x248A;
- t['threepersian'] = 0x06F3;
- t['threequarters'] = 0x00BE;
- t['threequartersemdash'] = 0xF6DE;
- t['threeroman'] = 0x2172;
- t['threesuperior'] = 0x00B3;
- t['threethai'] = 0x0E53;
- t['thzsquare'] = 0x3394;
- t['tihiragana'] = 0x3061;
- t['tikatakana'] = 0x30C1;
- t['tikatakanahalfwidth'] = 0xFF81;
- t['tikeutacirclekorean'] = 0x3270;
- t['tikeutaparenkorean'] = 0x3210;
- t['tikeutcirclekorean'] = 0x3262;
- t['tikeutkorean'] = 0x3137;
- t['tikeutparenkorean'] = 0x3202;
- t['tilde'] = 0x02DC;
- t['tildebelowcmb'] = 0x0330;
- t['tildecmb'] = 0x0303;
- t['tildecomb'] = 0x0303;
- t['tildedoublecmb'] = 0x0360;
- t['tildeoperator'] = 0x223C;
- t['tildeoverlaycmb'] = 0x0334;
- t['tildeverticalcmb'] = 0x033E;
- t['timescircle'] = 0x2297;
- t['tipehahebrew'] = 0x0596;
- t['tipehalefthebrew'] = 0x0596;
- t['tippigurmukhi'] = 0x0A70;
- t['titlocyrilliccmb'] = 0x0483;
- t['tiwnarmenian'] = 0x057F;
- t['tlinebelow'] = 0x1E6F;
- t['tmonospace'] = 0xFF54;
- t['toarmenian'] = 0x0569;
- t['tohiragana'] = 0x3068;
- t['tokatakana'] = 0x30C8;
- t['tokatakanahalfwidth'] = 0xFF84;
- t['tonebarextrahighmod'] = 0x02E5;
- t['tonebarextralowmod'] = 0x02E9;
- t['tonebarhighmod'] = 0x02E6;
- t['tonebarlowmod'] = 0x02E8;
- t['tonebarmidmod'] = 0x02E7;
- t['tonefive'] = 0x01BD;
- t['tonesix'] = 0x0185;
- t['tonetwo'] = 0x01A8;
- t['tonos'] = 0x0384;
- t['tonsquare'] = 0x3327;
- t['topatakthai'] = 0x0E0F;
- t['tortoiseshellbracketleft'] = 0x3014;
- t['tortoiseshellbracketleftsmall'] = 0xFE5D;
- t['tortoiseshellbracketleftvertical'] = 0xFE39;
- t['tortoiseshellbracketright'] = 0x3015;
- t['tortoiseshellbracketrightsmall'] = 0xFE5E;
- t['tortoiseshellbracketrightvertical'] = 0xFE3A;
- t['totaothai'] = 0x0E15;
- t['tpalatalhook'] = 0x01AB;
- t['tparen'] = 0x24AF;
- t['trademark'] = 0x2122;
- t['trademarksans'] = 0xF8EA;
- t['trademarkserif'] = 0xF6DB;
- t['tretroflexhook'] = 0x0288;
- t['triagdn'] = 0x25BC;
- t['triaglf'] = 0x25C4;
- t['triagrt'] = 0x25BA;
- t['triagup'] = 0x25B2;
- t['ts'] = 0x02A6;
- t['tsadi'] = 0x05E6;
- t['tsadidagesh'] = 0xFB46;
- t['tsadidageshhebrew'] = 0xFB46;
- t['tsadihebrew'] = 0x05E6;
- t['tsecyrillic'] = 0x0446;
- t['tsere'] = 0x05B5;
- t['tsere12'] = 0x05B5;
- t['tsere1e'] = 0x05B5;
- t['tsere2b'] = 0x05B5;
- t['tserehebrew'] = 0x05B5;
- t['tserenarrowhebrew'] = 0x05B5;
- t['tserequarterhebrew'] = 0x05B5;
- t['tserewidehebrew'] = 0x05B5;
- t['tshecyrillic'] = 0x045B;
- t['tsuperior'] = 0xF6F3;
- t['ttabengali'] = 0x099F;
- t['ttadeva'] = 0x091F;
- t['ttagujarati'] = 0x0A9F;
- t['ttagurmukhi'] = 0x0A1F;
- t['tteharabic'] = 0x0679;
- t['ttehfinalarabic'] = 0xFB67;
- t['ttehinitialarabic'] = 0xFB68;
- t['ttehmedialarabic'] = 0xFB69;
- t['tthabengali'] = 0x09A0;
- t['tthadeva'] = 0x0920;
- t['tthagujarati'] = 0x0AA0;
- t['tthagurmukhi'] = 0x0A20;
- t['tturned'] = 0x0287;
- t['tuhiragana'] = 0x3064;
- t['tukatakana'] = 0x30C4;
- t['tukatakanahalfwidth'] = 0xFF82;
- t['tusmallhiragana'] = 0x3063;
- t['tusmallkatakana'] = 0x30C3;
- t['tusmallkatakanahalfwidth'] = 0xFF6F;
- t['twelvecircle'] = 0x246B;
- t['twelveparen'] = 0x247F;
- t['twelveperiod'] = 0x2493;
- t['twelveroman'] = 0x217B;
- t['twentycircle'] = 0x2473;
- t['twentyhangzhou'] = 0x5344;
- t['twentyparen'] = 0x2487;
- t['twentyperiod'] = 0x249B;
- t['two'] = 0x0032;
- t['twoarabic'] = 0x0662;
- t['twobengali'] = 0x09E8;
- t['twocircle'] = 0x2461;
- t['twocircleinversesansserif'] = 0x278B;
- t['twodeva'] = 0x0968;
- t['twodotenleader'] = 0x2025;
- t['twodotleader'] = 0x2025;
- t['twodotleadervertical'] = 0xFE30;
- t['twogujarati'] = 0x0AE8;
- t['twogurmukhi'] = 0x0A68;
- t['twohackarabic'] = 0x0662;
- t['twohangzhou'] = 0x3022;
- t['twoideographicparen'] = 0x3221;
- t['twoinferior'] = 0x2082;
- t['twomonospace'] = 0xFF12;
- t['twonumeratorbengali'] = 0x09F5;
- t['twooldstyle'] = 0xF732;
- t['twoparen'] = 0x2475;
- t['twoperiod'] = 0x2489;
- t['twopersian'] = 0x06F2;
- t['tworoman'] = 0x2171;
- t['twostroke'] = 0x01BB;
- t['twosuperior'] = 0x00B2;
- t['twothai'] = 0x0E52;
- t['twothirds'] = 0x2154;
- t['u'] = 0x0075;
- t['uacute'] = 0x00FA;
- t['ubar'] = 0x0289;
- t['ubengali'] = 0x0989;
- t['ubopomofo'] = 0x3128;
- t['ubreve'] = 0x016D;
- t['ucaron'] = 0x01D4;
- t['ucircle'] = 0x24E4;
- t['ucircumflex'] = 0x00FB;
- t['ucircumflexbelow'] = 0x1E77;
- t['ucyrillic'] = 0x0443;
- t['udattadeva'] = 0x0951;
- t['udblacute'] = 0x0171;
- t['udblgrave'] = 0x0215;
- t['udeva'] = 0x0909;
- t['udieresis'] = 0x00FC;
- t['udieresisacute'] = 0x01D8;
- t['udieresisbelow'] = 0x1E73;
- t['udieresiscaron'] = 0x01DA;
- t['udieresiscyrillic'] = 0x04F1;
- t['udieresisgrave'] = 0x01DC;
- t['udieresismacron'] = 0x01D6;
- t['udotbelow'] = 0x1EE5;
- t['ugrave'] = 0x00F9;
- t['ugujarati'] = 0x0A89;
- t['ugurmukhi'] = 0x0A09;
- t['uhiragana'] = 0x3046;
- t['uhookabove'] = 0x1EE7;
- t['uhorn'] = 0x01B0;
- t['uhornacute'] = 0x1EE9;
- t['uhorndotbelow'] = 0x1EF1;
- t['uhorngrave'] = 0x1EEB;
- t['uhornhookabove'] = 0x1EED;
- t['uhorntilde'] = 0x1EEF;
- t['uhungarumlaut'] = 0x0171;
- t['uhungarumlautcyrillic'] = 0x04F3;
- t['uinvertedbreve'] = 0x0217;
- t['ukatakana'] = 0x30A6;
- t['ukatakanahalfwidth'] = 0xFF73;
- t['ukcyrillic'] = 0x0479;
- t['ukorean'] = 0x315C;
- t['umacron'] = 0x016B;
- t['umacroncyrillic'] = 0x04EF;
- t['umacrondieresis'] = 0x1E7B;
- t['umatragurmukhi'] = 0x0A41;
- t['umonospace'] = 0xFF55;
- t['underscore'] = 0x005F;
- t['underscoredbl'] = 0x2017;
- t['underscoremonospace'] = 0xFF3F;
- t['underscorevertical'] = 0xFE33;
- t['underscorewavy'] = 0xFE4F;
- t['union'] = 0x222A;
- t['universal'] = 0x2200;
- t['uogonek'] = 0x0173;
- t['uparen'] = 0x24B0;
- t['upblock'] = 0x2580;
- t['upperdothebrew'] = 0x05C4;
- t['upsilon'] = 0x03C5;
- t['upsilondieresis'] = 0x03CB;
- t['upsilondieresistonos'] = 0x03B0;
- t['upsilonlatin'] = 0x028A;
- t['upsilontonos'] = 0x03CD;
- t['uptackbelowcmb'] = 0x031D;
- t['uptackmod'] = 0x02D4;
- t['uragurmukhi'] = 0x0A73;
- t['uring'] = 0x016F;
- t['ushortcyrillic'] = 0x045E;
- t['usmallhiragana'] = 0x3045;
- t['usmallkatakana'] = 0x30A5;
- t['usmallkatakanahalfwidth'] = 0xFF69;
- t['ustraightcyrillic'] = 0x04AF;
- t['ustraightstrokecyrillic'] = 0x04B1;
- t['utilde'] = 0x0169;
- t['utildeacute'] = 0x1E79;
- t['utildebelow'] = 0x1E75;
- t['uubengali'] = 0x098A;
- t['uudeva'] = 0x090A;
- t['uugujarati'] = 0x0A8A;
- t['uugurmukhi'] = 0x0A0A;
- t['uumatragurmukhi'] = 0x0A42;
- t['uuvowelsignbengali'] = 0x09C2;
- t['uuvowelsigndeva'] = 0x0942;
- t['uuvowelsigngujarati'] = 0x0AC2;
- t['uvowelsignbengali'] = 0x09C1;
- t['uvowelsigndeva'] = 0x0941;
- t['uvowelsigngujarati'] = 0x0AC1;
- t['v'] = 0x0076;
- t['vadeva'] = 0x0935;
- t['vagujarati'] = 0x0AB5;
- t['vagurmukhi'] = 0x0A35;
- t['vakatakana'] = 0x30F7;
- t['vav'] = 0x05D5;
- t['vavdagesh'] = 0xFB35;
- t['vavdagesh65'] = 0xFB35;
- t['vavdageshhebrew'] = 0xFB35;
- t['vavhebrew'] = 0x05D5;
- t['vavholam'] = 0xFB4B;
- t['vavholamhebrew'] = 0xFB4B;
- t['vavvavhebrew'] = 0x05F0;
- t['vavyodhebrew'] = 0x05F1;
- t['vcircle'] = 0x24E5;
- t['vdotbelow'] = 0x1E7F;
- t['vecyrillic'] = 0x0432;
- t['veharabic'] = 0x06A4;
- t['vehfinalarabic'] = 0xFB6B;
- t['vehinitialarabic'] = 0xFB6C;
- t['vehmedialarabic'] = 0xFB6D;
- t['vekatakana'] = 0x30F9;
- t['venus'] = 0x2640;
- t['verticalbar'] = 0x007C;
- t['verticallineabovecmb'] = 0x030D;
- t['verticallinebelowcmb'] = 0x0329;
- t['verticallinelowmod'] = 0x02CC;
- t['verticallinemod'] = 0x02C8;
- t['vewarmenian'] = 0x057E;
- t['vhook'] = 0x028B;
- t['vikatakana'] = 0x30F8;
- t['viramabengali'] = 0x09CD;
- t['viramadeva'] = 0x094D;
- t['viramagujarati'] = 0x0ACD;
- t['visargabengali'] = 0x0983;
- t['visargadeva'] = 0x0903;
- t['visargagujarati'] = 0x0A83;
- t['vmonospace'] = 0xFF56;
- t['voarmenian'] = 0x0578;
- t['voicediterationhiragana'] = 0x309E;
- t['voicediterationkatakana'] = 0x30FE;
- t['voicedmarkkana'] = 0x309B;
- t['voicedmarkkanahalfwidth'] = 0xFF9E;
- t['vokatakana'] = 0x30FA;
- t['vparen'] = 0x24B1;
- t['vtilde'] = 0x1E7D;
- t['vturned'] = 0x028C;
- t['vuhiragana'] = 0x3094;
- t['vukatakana'] = 0x30F4;
- t['w'] = 0x0077;
- t['wacute'] = 0x1E83;
- t['waekorean'] = 0x3159;
- t['wahiragana'] = 0x308F;
- t['wakatakana'] = 0x30EF;
- t['wakatakanahalfwidth'] = 0xFF9C;
- t['wakorean'] = 0x3158;
- t['wasmallhiragana'] = 0x308E;
- t['wasmallkatakana'] = 0x30EE;
- t['wattosquare'] = 0x3357;
- t['wavedash'] = 0x301C;
- t['wavyunderscorevertical'] = 0xFE34;
- t['wawarabic'] = 0x0648;
- t['wawfinalarabic'] = 0xFEEE;
- t['wawhamzaabovearabic'] = 0x0624;
- t['wawhamzaabovefinalarabic'] = 0xFE86;
- t['wbsquare'] = 0x33DD;
- t['wcircle'] = 0x24E6;
- t['wcircumflex'] = 0x0175;
- t['wdieresis'] = 0x1E85;
- t['wdotaccent'] = 0x1E87;
- t['wdotbelow'] = 0x1E89;
- t['wehiragana'] = 0x3091;
- t['weierstrass'] = 0x2118;
- t['wekatakana'] = 0x30F1;
- t['wekorean'] = 0x315E;
- t['weokorean'] = 0x315D;
- t['wgrave'] = 0x1E81;
- t['whitebullet'] = 0x25E6;
- t['whitecircle'] = 0x25CB;
- t['whitecircleinverse'] = 0x25D9;
- t['whitecornerbracketleft'] = 0x300E;
- t['whitecornerbracketleftvertical'] = 0xFE43;
- t['whitecornerbracketright'] = 0x300F;
- t['whitecornerbracketrightvertical'] = 0xFE44;
- t['whitediamond'] = 0x25C7;
- t['whitediamondcontainingblacksmalldiamond'] = 0x25C8;
- t['whitedownpointingsmalltriangle'] = 0x25BF;
- t['whitedownpointingtriangle'] = 0x25BD;
- t['whiteleftpointingsmalltriangle'] = 0x25C3;
- t['whiteleftpointingtriangle'] = 0x25C1;
- t['whitelenticularbracketleft'] = 0x3016;
- t['whitelenticularbracketright'] = 0x3017;
- t['whiterightpointingsmalltriangle'] = 0x25B9;
- t['whiterightpointingtriangle'] = 0x25B7;
- t['whitesmallsquare'] = 0x25AB;
- t['whitesmilingface'] = 0x263A;
- t['whitesquare'] = 0x25A1;
- t['whitestar'] = 0x2606;
- t['whitetelephone'] = 0x260F;
- t['whitetortoiseshellbracketleft'] = 0x3018;
- t['whitetortoiseshellbracketright'] = 0x3019;
- t['whiteuppointingsmalltriangle'] = 0x25B5;
- t['whiteuppointingtriangle'] = 0x25B3;
- t['wihiragana'] = 0x3090;
- t['wikatakana'] = 0x30F0;
- t['wikorean'] = 0x315F;
- t['wmonospace'] = 0xFF57;
- t['wohiragana'] = 0x3092;
- t['wokatakana'] = 0x30F2;
- t['wokatakanahalfwidth'] = 0xFF66;
- t['won'] = 0x20A9;
- t['wonmonospace'] = 0xFFE6;
- t['wowaenthai'] = 0x0E27;
- t['wparen'] = 0x24B2;
- t['wring'] = 0x1E98;
- t['wsuperior'] = 0x02B7;
- t['wturned'] = 0x028D;
- t['wynn'] = 0x01BF;
- t['x'] = 0x0078;
- t['xabovecmb'] = 0x033D;
- t['xbopomofo'] = 0x3112;
- t['xcircle'] = 0x24E7;
- t['xdieresis'] = 0x1E8D;
- t['xdotaccent'] = 0x1E8B;
- t['xeharmenian'] = 0x056D;
- t['xi'] = 0x03BE;
- t['xmonospace'] = 0xFF58;
- t['xparen'] = 0x24B3;
- t['xsuperior'] = 0x02E3;
- t['y'] = 0x0079;
- t['yaadosquare'] = 0x334E;
- t['yabengali'] = 0x09AF;
- t['yacute'] = 0x00FD;
- t['yadeva'] = 0x092F;
- t['yaekorean'] = 0x3152;
- t['yagujarati'] = 0x0AAF;
- t['yagurmukhi'] = 0x0A2F;
- t['yahiragana'] = 0x3084;
- t['yakatakana'] = 0x30E4;
- t['yakatakanahalfwidth'] = 0xFF94;
- t['yakorean'] = 0x3151;
- t['yamakkanthai'] = 0x0E4E;
- t['yasmallhiragana'] = 0x3083;
- t['yasmallkatakana'] = 0x30E3;
- t['yasmallkatakanahalfwidth'] = 0xFF6C;
- t['yatcyrillic'] = 0x0463;
- t['ycircle'] = 0x24E8;
- t['ycircumflex'] = 0x0177;
- t['ydieresis'] = 0x00FF;
- t['ydotaccent'] = 0x1E8F;
- t['ydotbelow'] = 0x1EF5;
- t['yeharabic'] = 0x064A;
- t['yehbarreearabic'] = 0x06D2;
- t['yehbarreefinalarabic'] = 0xFBAF;
- t['yehfinalarabic'] = 0xFEF2;
- t['yehhamzaabovearabic'] = 0x0626;
- t['yehhamzaabovefinalarabic'] = 0xFE8A;
- t['yehhamzaaboveinitialarabic'] = 0xFE8B;
- t['yehhamzaabovemedialarabic'] = 0xFE8C;
- t['yehinitialarabic'] = 0xFEF3;
- t['yehmedialarabic'] = 0xFEF4;
- t['yehmeeminitialarabic'] = 0xFCDD;
- t['yehmeemisolatedarabic'] = 0xFC58;
- t['yehnoonfinalarabic'] = 0xFC94;
- t['yehthreedotsbelowarabic'] = 0x06D1;
- t['yekorean'] = 0x3156;
- t['yen'] = 0x00A5;
- t['yenmonospace'] = 0xFFE5;
- t['yeokorean'] = 0x3155;
- t['yeorinhieuhkorean'] = 0x3186;
- t['yerahbenyomohebrew'] = 0x05AA;
- t['yerahbenyomolefthebrew'] = 0x05AA;
- t['yericyrillic'] = 0x044B;
- t['yerudieresiscyrillic'] = 0x04F9;
- t['yesieungkorean'] = 0x3181;
- t['yesieungpansioskorean'] = 0x3183;
- t['yesieungsioskorean'] = 0x3182;
- t['yetivhebrew'] = 0x059A;
- t['ygrave'] = 0x1EF3;
- t['yhook'] = 0x01B4;
- t['yhookabove'] = 0x1EF7;
- t['yiarmenian'] = 0x0575;
- t['yicyrillic'] = 0x0457;
- t['yikorean'] = 0x3162;
- t['yinyang'] = 0x262F;
- t['yiwnarmenian'] = 0x0582;
- t['ymonospace'] = 0xFF59;
- t['yod'] = 0x05D9;
- t['yoddagesh'] = 0xFB39;
- t['yoddageshhebrew'] = 0xFB39;
- t['yodhebrew'] = 0x05D9;
- t['yodyodhebrew'] = 0x05F2;
- t['yodyodpatahhebrew'] = 0xFB1F;
- t['yohiragana'] = 0x3088;
- t['yoikorean'] = 0x3189;
- t['yokatakana'] = 0x30E8;
- t['yokatakanahalfwidth'] = 0xFF96;
- t['yokorean'] = 0x315B;
- t['yosmallhiragana'] = 0x3087;
- t['yosmallkatakana'] = 0x30E7;
- t['yosmallkatakanahalfwidth'] = 0xFF6E;
- t['yotgreek'] = 0x03F3;
- t['yoyaekorean'] = 0x3188;
- t['yoyakorean'] = 0x3187;
- t['yoyakthai'] = 0x0E22;
- t['yoyingthai'] = 0x0E0D;
- t['yparen'] = 0x24B4;
- t['ypogegrammeni'] = 0x037A;
- t['ypogegrammenigreekcmb'] = 0x0345;
- t['yr'] = 0x01A6;
- t['yring'] = 0x1E99;
- t['ysuperior'] = 0x02B8;
- t['ytilde'] = 0x1EF9;
- t['yturned'] = 0x028E;
- t['yuhiragana'] = 0x3086;
- t['yuikorean'] = 0x318C;
- t['yukatakana'] = 0x30E6;
- t['yukatakanahalfwidth'] = 0xFF95;
- t['yukorean'] = 0x3160;
- t['yusbigcyrillic'] = 0x046B;
- t['yusbigiotifiedcyrillic'] = 0x046D;
- t['yuslittlecyrillic'] = 0x0467;
- t['yuslittleiotifiedcyrillic'] = 0x0469;
- t['yusmallhiragana'] = 0x3085;
- t['yusmallkatakana'] = 0x30E5;
- t['yusmallkatakanahalfwidth'] = 0xFF6D;
- t['yuyekorean'] = 0x318B;
- t['yuyeokorean'] = 0x318A;
- t['yyabengali'] = 0x09DF;
- t['yyadeva'] = 0x095F;
- t['z'] = 0x007A;
- t['zaarmenian'] = 0x0566;
- t['zacute'] = 0x017A;
- t['zadeva'] = 0x095B;
- t['zagurmukhi'] = 0x0A5B;
- t['zaharabic'] = 0x0638;
- t['zahfinalarabic'] = 0xFEC6;
- t['zahinitialarabic'] = 0xFEC7;
- t['zahiragana'] = 0x3056;
- t['zahmedialarabic'] = 0xFEC8;
- t['zainarabic'] = 0x0632;
- t['zainfinalarabic'] = 0xFEB0;
- t['zakatakana'] = 0x30B6;
- t['zaqefgadolhebrew'] = 0x0595;
- t['zaqefqatanhebrew'] = 0x0594;
- t['zarqahebrew'] = 0x0598;
- t['zayin'] = 0x05D6;
- t['zayindagesh'] = 0xFB36;
- t['zayindageshhebrew'] = 0xFB36;
- t['zayinhebrew'] = 0x05D6;
- t['zbopomofo'] = 0x3117;
- t['zcaron'] = 0x017E;
- t['zcircle'] = 0x24E9;
- t['zcircumflex'] = 0x1E91;
- t['zcurl'] = 0x0291;
- t['zdot'] = 0x017C;
- t['zdotaccent'] = 0x017C;
- t['zdotbelow'] = 0x1E93;
- t['zecyrillic'] = 0x0437;
- t['zedescendercyrillic'] = 0x0499;
- t['zedieresiscyrillic'] = 0x04DF;
- t['zehiragana'] = 0x305C;
- t['zekatakana'] = 0x30BC;
- t['zero'] = 0x0030;
- t['zeroarabic'] = 0x0660;
- t['zerobengali'] = 0x09E6;
- t['zerodeva'] = 0x0966;
- t['zerogujarati'] = 0x0AE6;
- t['zerogurmukhi'] = 0x0A66;
- t['zerohackarabic'] = 0x0660;
- t['zeroinferior'] = 0x2080;
- t['zeromonospace'] = 0xFF10;
- t['zerooldstyle'] = 0xF730;
- t['zeropersian'] = 0x06F0;
- t['zerosuperior'] = 0x2070;
- t['zerothai'] = 0x0E50;
- t['zerowidthjoiner'] = 0xFEFF;
- t['zerowidthnonjoiner'] = 0x200C;
- t['zerowidthspace'] = 0x200B;
- t['zeta'] = 0x03B6;
- t['zhbopomofo'] = 0x3113;
- t['zhearmenian'] = 0x056A;
- t['zhebrevecyrillic'] = 0x04C2;
- t['zhecyrillic'] = 0x0436;
- t['zhedescendercyrillic'] = 0x0497;
- t['zhedieresiscyrillic'] = 0x04DD;
- t['zihiragana'] = 0x3058;
- t['zikatakana'] = 0x30B8;
- t['zinorhebrew'] = 0x05AE;
- t['zlinebelow'] = 0x1E95;
- t['zmonospace'] = 0xFF5A;
- t['zohiragana'] = 0x305E;
- t['zokatakana'] = 0x30BE;
- t['zparen'] = 0x24B5;
- t['zretroflexhook'] = 0x0290;
- t['zstroke'] = 0x01B6;
- t['zuhiragana'] = 0x305A;
- t['zukatakana'] = 0x30BA;
- t['.notdef'] = 0x0000;
- t['angbracketleftbig'] = 0x2329;
- t['angbracketleftBig'] = 0x2329;
- t['angbracketleftbigg'] = 0x2329;
- t['angbracketleftBigg'] = 0x2329;
- t['angbracketrightBig'] = 0x232A;
- t['angbracketrightbig'] = 0x232A;
- t['angbracketrightBigg'] = 0x232A;
- t['angbracketrightbigg'] = 0x232A;
- t['arrowhookleft'] = 0x21AA;
- t['arrowhookright'] = 0x21A9;
- t['arrowlefttophalf'] = 0x21BC;
- t['arrowleftbothalf'] = 0x21BD;
- t['arrownortheast'] = 0x2197;
- t['arrownorthwest'] = 0x2196;
- t['arrowrighttophalf'] = 0x21C0;
- t['arrowrightbothalf'] = 0x21C1;
- t['arrowsoutheast'] = 0x2198;
- t['arrowsouthwest'] = 0x2199;
- t['backslashbig'] = 0x2216;
- t['backslashBig'] = 0x2216;
- t['backslashBigg'] = 0x2216;
- t['backslashbigg'] = 0x2216;
- t['bardbl'] = 0x2016;
- t['bracehtipdownleft'] = 0xFE37;
- t['bracehtipdownright'] = 0xFE37;
- t['bracehtipupleft'] = 0xFE38;
- t['bracehtipupright'] = 0xFE38;
- t['braceleftBig'] = 0x007B;
- t['braceleftbig'] = 0x007B;
- t['braceleftbigg'] = 0x007B;
- t['braceleftBigg'] = 0x007B;
- t['bracerightBig'] = 0x007D;
- t['bracerightbig'] = 0x007D;
- t['bracerightbigg'] = 0x007D;
- t['bracerightBigg'] = 0x007D;
- t['bracketleftbig'] = 0x005B;
- t['bracketleftBig'] = 0x005B;
- t['bracketleftbigg'] = 0x005B;
- t['bracketleftBigg'] = 0x005B;
- t['bracketrightBig'] = 0x005D;
- t['bracketrightbig'] = 0x005D;
- t['bracketrightbigg'] = 0x005D;
- t['bracketrightBigg'] = 0x005D;
- t['ceilingleftbig'] = 0x2308;
- t['ceilingleftBig'] = 0x2308;
- t['ceilingleftBigg'] = 0x2308;
- t['ceilingleftbigg'] = 0x2308;
- t['ceilingrightbig'] = 0x2309;
- t['ceilingrightBig'] = 0x2309;
- t['ceilingrightbigg'] = 0x2309;
- t['ceilingrightBigg'] = 0x2309;
- t['circledotdisplay'] = 0x2299;
- t['circledottext'] = 0x2299;
- t['circlemultiplydisplay'] = 0x2297;
- t['circlemultiplytext'] = 0x2297;
- t['circleplusdisplay'] = 0x2295;
- t['circleplustext'] = 0x2295;
- t['contintegraldisplay'] = 0x222E;
- t['contintegraltext'] = 0x222E;
- t['coproductdisplay'] = 0x2210;
- t['coproducttext'] = 0x2210;
- t['floorleftBig'] = 0x230A;
- t['floorleftbig'] = 0x230A;
- t['floorleftbigg'] = 0x230A;
- t['floorleftBigg'] = 0x230A;
- t['floorrightbig'] = 0x230B;
- t['floorrightBig'] = 0x230B;
- t['floorrightBigg'] = 0x230B;
- t['floorrightbigg'] = 0x230B;
- t['hatwide'] = 0x0302;
- t['hatwider'] = 0x0302;
- t['hatwidest'] = 0x0302;
- t['intercal'] = 0x1D40;
- t['integraldisplay'] = 0x222B;
- t['integraltext'] = 0x222B;
- t['intersectiondisplay'] = 0x22C2;
- t['intersectiontext'] = 0x22C2;
- t['logicalanddisplay'] = 0x2227;
- t['logicalandtext'] = 0x2227;
- t['logicalordisplay'] = 0x2228;
- t['logicalortext'] = 0x2228;
- t['parenleftBig'] = 0x0028;
- t['parenleftbig'] = 0x0028;
- t['parenleftBigg'] = 0x0028;
- t['parenleftbigg'] = 0x0028;
- t['parenrightBig'] = 0x0029;
- t['parenrightbig'] = 0x0029;
- t['parenrightBigg'] = 0x0029;
- t['parenrightbigg'] = 0x0029;
- t['prime'] = 0x2032;
- t['productdisplay'] = 0x220F;
- t['producttext'] = 0x220F;
- t['radicalbig'] = 0x221A;
- t['radicalBig'] = 0x221A;
- t['radicalBigg'] = 0x221A;
- t['radicalbigg'] = 0x221A;
- t['radicalbt'] = 0x221A;
- t['radicaltp'] = 0x221A;
- t['radicalvertex'] = 0x221A;
- t['slashbig'] = 0x002F;
- t['slashBig'] = 0x002F;
- t['slashBigg'] = 0x002F;
- t['slashbigg'] = 0x002F;
- t['summationdisplay'] = 0x2211;
- t['summationtext'] = 0x2211;
- t['tildewide'] = 0x02DC;
- t['tildewider'] = 0x02DC;
- t['tildewidest'] = 0x02DC;
- t['uniondisplay'] = 0x22C3;
- t['unionmultidisplay'] = 0x228E;
- t['unionmultitext'] = 0x228E;
- t['unionsqdisplay'] = 0x2294;
- t['unionsqtext'] = 0x2294;
- t['uniontext'] = 0x22C3;
- t['vextenddouble'] = 0x2225;
- t['vextendsingle'] = 0x2223;
-});
-var getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) {
- t['space'] = 0x0020;
- t['a1'] = 0x2701;
- t['a2'] = 0x2702;
- t['a202'] = 0x2703;
- t['a3'] = 0x2704;
- t['a4'] = 0x260E;
- t['a5'] = 0x2706;
- t['a119'] = 0x2707;
- t['a118'] = 0x2708;
- t['a117'] = 0x2709;
- t['a11'] = 0x261B;
- t['a12'] = 0x261E;
- t['a13'] = 0x270C;
- t['a14'] = 0x270D;
- t['a15'] = 0x270E;
- t['a16'] = 0x270F;
- t['a105'] = 0x2710;
- t['a17'] = 0x2711;
- t['a18'] = 0x2712;
- t['a19'] = 0x2713;
- t['a20'] = 0x2714;
- t['a21'] = 0x2715;
- t['a22'] = 0x2716;
- t['a23'] = 0x2717;
- t['a24'] = 0x2718;
- t['a25'] = 0x2719;
- t['a26'] = 0x271A;
- t['a27'] = 0x271B;
- t['a28'] = 0x271C;
- t['a6'] = 0x271D;
- t['a7'] = 0x271E;
- t['a8'] = 0x271F;
- t['a9'] = 0x2720;
- t['a10'] = 0x2721;
- t['a29'] = 0x2722;
- t['a30'] = 0x2723;
- t['a31'] = 0x2724;
- t['a32'] = 0x2725;
- t['a33'] = 0x2726;
- t['a34'] = 0x2727;
- t['a35'] = 0x2605;
- t['a36'] = 0x2729;
- t['a37'] = 0x272A;
- t['a38'] = 0x272B;
- t['a39'] = 0x272C;
- t['a40'] = 0x272D;
- t['a41'] = 0x272E;
- t['a42'] = 0x272F;
- t['a43'] = 0x2730;
- t['a44'] = 0x2731;
- t['a45'] = 0x2732;
- t['a46'] = 0x2733;
- t['a47'] = 0x2734;
- t['a48'] = 0x2735;
- t['a49'] = 0x2736;
- t['a50'] = 0x2737;
- t['a51'] = 0x2738;
- t['a52'] = 0x2739;
- t['a53'] = 0x273A;
- t['a54'] = 0x273B;
- t['a55'] = 0x273C;
- t['a56'] = 0x273D;
- t['a57'] = 0x273E;
- t['a58'] = 0x273F;
- t['a59'] = 0x2740;
- t['a60'] = 0x2741;
- t['a61'] = 0x2742;
- t['a62'] = 0x2743;
- t['a63'] = 0x2744;
- t['a64'] = 0x2745;
- t['a65'] = 0x2746;
- t['a66'] = 0x2747;
- t['a67'] = 0x2748;
- t['a68'] = 0x2749;
- t['a69'] = 0x274A;
- t['a70'] = 0x274B;
- t['a71'] = 0x25CF;
- t['a72'] = 0x274D;
- t['a73'] = 0x25A0;
- t['a74'] = 0x274F;
- t['a203'] = 0x2750;
- t['a75'] = 0x2751;
- t['a204'] = 0x2752;
- t['a76'] = 0x25B2;
- t['a77'] = 0x25BC;
- t['a78'] = 0x25C6;
- t['a79'] = 0x2756;
- t['a81'] = 0x25D7;
- t['a82'] = 0x2758;
- t['a83'] = 0x2759;
- t['a84'] = 0x275A;
- t['a97'] = 0x275B;
- t['a98'] = 0x275C;
- t['a99'] = 0x275D;
- t['a100'] = 0x275E;
- t['a101'] = 0x2761;
- t['a102'] = 0x2762;
- t['a103'] = 0x2763;
- t['a104'] = 0x2764;
- t['a106'] = 0x2765;
- t['a107'] = 0x2766;
- t['a108'] = 0x2767;
- t['a112'] = 0x2663;
- t['a111'] = 0x2666;
- t['a110'] = 0x2665;
- t['a109'] = 0x2660;
- t['a120'] = 0x2460;
- t['a121'] = 0x2461;
- t['a122'] = 0x2462;
- t['a123'] = 0x2463;
- t['a124'] = 0x2464;
- t['a125'] = 0x2465;
- t['a126'] = 0x2466;
- t['a127'] = 0x2467;
- t['a128'] = 0x2468;
- t['a129'] = 0x2469;
- t['a130'] = 0x2776;
- t['a131'] = 0x2777;
- t['a132'] = 0x2778;
- t['a133'] = 0x2779;
- t['a134'] = 0x277A;
- t['a135'] = 0x277B;
- t['a136'] = 0x277C;
- t['a137'] = 0x277D;
- t['a138'] = 0x277E;
- t['a139'] = 0x277F;
- t['a140'] = 0x2780;
- t['a141'] = 0x2781;
- t['a142'] = 0x2782;
- t['a143'] = 0x2783;
- t['a144'] = 0x2784;
- t['a145'] = 0x2785;
- t['a146'] = 0x2786;
- t['a147'] = 0x2787;
- t['a148'] = 0x2788;
- t['a149'] = 0x2789;
- t['a150'] = 0x278A;
- t['a151'] = 0x278B;
- t['a152'] = 0x278C;
- t['a153'] = 0x278D;
- t['a154'] = 0x278E;
- t['a155'] = 0x278F;
- t['a156'] = 0x2790;
- t['a157'] = 0x2791;
- t['a158'] = 0x2792;
- t['a159'] = 0x2793;
- t['a160'] = 0x2794;
- t['a161'] = 0x2192;
- t['a163'] = 0x2194;
- t['a164'] = 0x2195;
- t['a196'] = 0x2798;
- t['a165'] = 0x2799;
- t['a192'] = 0x279A;
- t['a166'] = 0x279B;
- t['a167'] = 0x279C;
- t['a168'] = 0x279D;
- t['a169'] = 0x279E;
- t['a170'] = 0x279F;
- t['a171'] = 0x27A0;
- t['a172'] = 0x27A1;
- t['a173'] = 0x27A2;
- t['a162'] = 0x27A3;
- t['a174'] = 0x27A4;
- t['a175'] = 0x27A5;
- t['a176'] = 0x27A6;
- t['a177'] = 0x27A7;
- t['a178'] = 0x27A8;
- t['a179'] = 0x27A9;
- t['a193'] = 0x27AA;
- t['a180'] = 0x27AB;
- t['a199'] = 0x27AC;
- t['a181'] = 0x27AD;
- t['a200'] = 0x27AE;
- t['a182'] = 0x27AF;
- t['a201'] = 0x27B1;
- t['a183'] = 0x27B2;
- t['a184'] = 0x27B3;
- t['a197'] = 0x27B4;
- t['a185'] = 0x27B5;
- t['a194'] = 0x27B6;
- t['a198'] = 0x27B7;
- t['a186'] = 0x27B8;
- t['a195'] = 0x27B9;
- t['a187'] = 0x27BA;
- t['a188'] = 0x27BB;
- t['a189'] = 0x27BC;
- t['a190'] = 0x27BD;
- t['a191'] = 0x27BE;
- t['a89'] = 0x2768;
- t['a90'] = 0x2769;
- t['a93'] = 0x276A;
- t['a94'] = 0x276B;
- t['a91'] = 0x276C;
- t['a92'] = 0x276D;
- t['a205'] = 0x276E;
- t['a85'] = 0x276F;
- t['a206'] = 0x2770;
- t['a86'] = 0x2771;
- t['a87'] = 0x2772;
- t['a88'] = 0x2773;
- t['a95'] = 0x2774;
- t['a96'] = 0x2775;
- t['.notdef'] = 0x0000;
-});
-exports.getGlyphsUnicode = getGlyphsUnicode;
-exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode;
-
-/***/ }),
-/* 161 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getGlyphMapForStandardFonts = exports.getSymbolsFonts = exports.getSerifFonts = exports.getNonStdFontMap = exports.getStdFontMap = undefined;
-
-var _util = __w_pdfjs_require__(2);
-
-var getStdFontMap = (0, _util.getLookupTableFactory)(function (t) {
- t['ArialNarrow'] = 'Helvetica';
- t['ArialNarrow-Bold'] = 'Helvetica-Bold';
- t['ArialNarrow-BoldItalic'] = 'Helvetica-BoldOblique';
- t['ArialNarrow-Italic'] = 'Helvetica-Oblique';
- t['ArialBlack'] = 'Helvetica';
- t['ArialBlack-Bold'] = 'Helvetica-Bold';
- t['ArialBlack-BoldItalic'] = 'Helvetica-BoldOblique';
- t['ArialBlack-Italic'] = 'Helvetica-Oblique';
- t['Arial-Black'] = 'Helvetica';
- t['Arial-Black-Bold'] = 'Helvetica-Bold';
- t['Arial-Black-BoldItalic'] = 'Helvetica-BoldOblique';
- t['Arial-Black-Italic'] = 'Helvetica-Oblique';
- t['Arial'] = 'Helvetica';
- t['Arial-Bold'] = 'Helvetica-Bold';
- t['Arial-BoldItalic'] = 'Helvetica-BoldOblique';
- t['Arial-Italic'] = 'Helvetica-Oblique';
- t['Arial-BoldItalicMT'] = 'Helvetica-BoldOblique';
- t['Arial-BoldMT'] = 'Helvetica-Bold';
- t['Arial-ItalicMT'] = 'Helvetica-Oblique';
- t['ArialMT'] = 'Helvetica';
- t['Courier-Bold'] = 'Courier-Bold';
- t['Courier-BoldItalic'] = 'Courier-BoldOblique';
- t['Courier-Italic'] = 'Courier-Oblique';
- t['CourierNew'] = 'Courier';
- t['CourierNew-Bold'] = 'Courier-Bold';
- t['CourierNew-BoldItalic'] = 'Courier-BoldOblique';
- t['CourierNew-Italic'] = 'Courier-Oblique';
- t['CourierNewPS-BoldItalicMT'] = 'Courier-BoldOblique';
- t['CourierNewPS-BoldMT'] = 'Courier-Bold';
- t['CourierNewPS-ItalicMT'] = 'Courier-Oblique';
- t['CourierNewPSMT'] = 'Courier';
- t['Helvetica'] = 'Helvetica';
- t['Helvetica-Bold'] = 'Helvetica-Bold';
- t['Helvetica-BoldItalic'] = 'Helvetica-BoldOblique';
- t['Helvetica-BoldOblique'] = 'Helvetica-BoldOblique';
- t['Helvetica-Italic'] = 'Helvetica-Oblique';
- t['Helvetica-Oblique'] = 'Helvetica-Oblique';
- t['SegoeUISymbol'] = 'Helvetica';
- t['Symbol-Bold'] = 'Symbol';
- t['Symbol-BoldItalic'] = 'Symbol';
- t['Symbol-Italic'] = 'Symbol';
- t['TimesNewRoman'] = 'Times-Roman';
- t['TimesNewRoman-Bold'] = 'Times-Bold';
- t['TimesNewRoman-BoldItalic'] = 'Times-BoldItalic';
- t['TimesNewRoman-Italic'] = 'Times-Italic';
- t['TimesNewRomanPS'] = 'Times-Roman';
- t['TimesNewRomanPS-Bold'] = 'Times-Bold';
- t['TimesNewRomanPS-BoldItalic'] = 'Times-BoldItalic';
- t['TimesNewRomanPS-BoldItalicMT'] = 'Times-BoldItalic';
- t['TimesNewRomanPS-BoldMT'] = 'Times-Bold';
- t['TimesNewRomanPS-Italic'] = 'Times-Italic';
- t['TimesNewRomanPS-ItalicMT'] = 'Times-Italic';
- t['TimesNewRomanPSMT'] = 'Times-Roman';
- t['TimesNewRomanPSMT-Bold'] = 'Times-Bold';
- t['TimesNewRomanPSMT-BoldItalic'] = 'Times-BoldItalic';
- t['TimesNewRomanPSMT-Italic'] = 'Times-Italic';
-});
-var getNonStdFontMap = (0, _util.getLookupTableFactory)(function (t) {
- t['Calibri'] = 'Helvetica';
- t['Calibri-Bold'] = 'Helvetica-Bold';
- t['Calibri-BoldItalic'] = 'Helvetica-BoldOblique';
- t['Calibri-Italic'] = 'Helvetica-Oblique';
- t['CenturyGothic'] = 'Helvetica';
- t['CenturyGothic-Bold'] = 'Helvetica-Bold';
- t['CenturyGothic-BoldItalic'] = 'Helvetica-BoldOblique';
- t['CenturyGothic-Italic'] = 'Helvetica-Oblique';
- t['ComicSansMS'] = 'Comic Sans MS';
- t['ComicSansMS-Bold'] = 'Comic Sans MS-Bold';
- t['ComicSansMS-BoldItalic'] = 'Comic Sans MS-BoldItalic';
- t['ComicSansMS-Italic'] = 'Comic Sans MS-Italic';
- t['LucidaConsole'] = 'Courier';
- t['LucidaConsole-Bold'] = 'Courier-Bold';
- t['LucidaConsole-BoldItalic'] = 'Courier-BoldOblique';
- t['LucidaConsole-Italic'] = 'Courier-Oblique';
- t['LucidaSans-Demi'] = 'Helvetica-Bold';
- t['MS-Gothic'] = 'MS Gothic';
- t['MS-Gothic-Bold'] = 'MS Gothic-Bold';
- t['MS-Gothic-BoldItalic'] = 'MS Gothic-BoldItalic';
- t['MS-Gothic-Italic'] = 'MS Gothic-Italic';
- t['MS-Mincho'] = 'MS Mincho';
- t['MS-Mincho-Bold'] = 'MS Mincho-Bold';
- t['MS-Mincho-BoldItalic'] = 'MS Mincho-BoldItalic';
- t['MS-Mincho-Italic'] = 'MS Mincho-Italic';
- t['MS-PGothic'] = 'MS PGothic';
- t['MS-PGothic-Bold'] = 'MS PGothic-Bold';
- t['MS-PGothic-BoldItalic'] = 'MS PGothic-BoldItalic';
- t['MS-PGothic-Italic'] = 'MS PGothic-Italic';
- t['MS-PMincho'] = 'MS PMincho';
- t['MS-PMincho-Bold'] = 'MS PMincho-Bold';
- t['MS-PMincho-BoldItalic'] = 'MS PMincho-BoldItalic';
- t['MS-PMincho-Italic'] = 'MS PMincho-Italic';
- t['NuptialScript'] = 'Times-Italic';
- t['Wingdings'] = 'ZapfDingbats';
-});
-var getSerifFonts = (0, _util.getLookupTableFactory)(function (t) {
- t['Adobe Jenson'] = true;
- t['Adobe Text'] = true;
- t['Albertus'] = true;
- t['Aldus'] = true;
- t['Alexandria'] = true;
- t['Algerian'] = true;
- t['American Typewriter'] = true;
- t['Antiqua'] = true;
- t['Apex'] = true;
- t['Arno'] = true;
- t['Aster'] = true;
- t['Aurora'] = true;
- t['Baskerville'] = true;
- t['Bell'] = true;
- t['Bembo'] = true;
- t['Bembo Schoolbook'] = true;
- t['Benguiat'] = true;
- t['Berkeley Old Style'] = true;
- t['Bernhard Modern'] = true;
- t['Berthold City'] = true;
- t['Bodoni'] = true;
- t['Bauer Bodoni'] = true;
- t['Book Antiqua'] = true;
- t['Bookman'] = true;
- t['Bordeaux Roman'] = true;
- t['Californian FB'] = true;
- t['Calisto'] = true;
- t['Calvert'] = true;
- t['Capitals'] = true;
- t['Cambria'] = true;
- t['Cartier'] = true;
- t['Caslon'] = true;
- t['Catull'] = true;
- t['Centaur'] = true;
- t['Century Old Style'] = true;
- t['Century Schoolbook'] = true;
- t['Chaparral'] = true;
- t['Charis SIL'] = true;
- t['Cheltenham'] = true;
- t['Cholla Slab'] = true;
- t['Clarendon'] = true;
- t['Clearface'] = true;
- t['Cochin'] = true;
- t['Colonna'] = true;
- t['Computer Modern'] = true;
- t['Concrete Roman'] = true;
- t['Constantia'] = true;
- t['Cooper Black'] = true;
- t['Corona'] = true;
- t['Ecotype'] = true;
- t['Egyptienne'] = true;
- t['Elephant'] = true;
- t['Excelsior'] = true;
- t['Fairfield'] = true;
- t['FF Scala'] = true;
- t['Folkard'] = true;
- t['Footlight'] = true;
- t['FreeSerif'] = true;
- t['Friz Quadrata'] = true;
- t['Garamond'] = true;
- t['Gentium'] = true;
- t['Georgia'] = true;
- t['Gloucester'] = true;
- t['Goudy Old Style'] = true;
- t['Goudy Schoolbook'] = true;
- t['Goudy Pro Font'] = true;
- t['Granjon'] = true;
- t['Guardian Egyptian'] = true;
- t['Heather'] = true;
- t['Hercules'] = true;
- t['High Tower Text'] = true;
- t['Hiroshige'] = true;
- t['Hoefler Text'] = true;
- t['Humana Serif'] = true;
- t['Imprint'] = true;
- t['Ionic No. 5'] = true;
- t['Janson'] = true;
- t['Joanna'] = true;
- t['Korinna'] = true;
- t['Lexicon'] = true;
- t['Liberation Serif'] = true;
- t['Linux Libertine'] = true;
- t['Literaturnaya'] = true;
- t['Lucida'] = true;
- t['Lucida Bright'] = true;
- t['Melior'] = true;
- t['Memphis'] = true;
- t['Miller'] = true;
- t['Minion'] = true;
- t['Modern'] = true;
- t['Mona Lisa'] = true;
- t['Mrs Eaves'] = true;
- t['MS Serif'] = true;
- t['Museo Slab'] = true;
- t['New York'] = true;
- t['Nimbus Roman'] = true;
- t['NPS Rawlinson Roadway'] = true;
- t['NuptialScript'] = true;
- t['Palatino'] = true;
- t['Perpetua'] = true;
- t['Plantin'] = true;
- t['Plantin Schoolbook'] = true;
- t['Playbill'] = true;
- t['Poor Richard'] = true;
- t['Rawlinson Roadway'] = true;
- t['Renault'] = true;
- t['Requiem'] = true;
- t['Rockwell'] = true;
- t['Roman'] = true;
- t['Rotis Serif'] = true;
- t['Sabon'] = true;
- t['Scala'] = true;
- t['Seagull'] = true;
- t['Sistina'] = true;
- t['Souvenir'] = true;
- t['STIX'] = true;
- t['Stone Informal'] = true;
- t['Stone Serif'] = true;
- t['Sylfaen'] = true;
- t['Times'] = true;
- t['Trajan'] = true;
- t['Trinité'] = true;
- t['Trump Mediaeval'] = true;
- t['Utopia'] = true;
- t['Vale Type'] = true;
- t['Bitstream Vera'] = true;
- t['Vera Serif'] = true;
- t['Versailles'] = true;
- t['Wanted'] = true;
- t['Weiss'] = true;
- t['Wide Latin'] = true;
- t['Windsor'] = true;
- t['XITS'] = true;
-});
-var getSymbolsFonts = (0, _util.getLookupTableFactory)(function (t) {
- t['Dingbats'] = true;
- t['Symbol'] = true;
- t['ZapfDingbats'] = true;
-});
-var getGlyphMapForStandardFonts = (0, _util.getLookupTableFactory)(function (t) {
- t[2] = 10;
- t[3] = 32;
- t[4] = 33;
- t[5] = 34;
- t[6] = 35;
- t[7] = 36;
- t[8] = 37;
- t[9] = 38;
- t[10] = 39;
- t[11] = 40;
- t[12] = 41;
- t[13] = 42;
- t[14] = 43;
- t[15] = 44;
- t[16] = 45;
- t[17] = 46;
- t[18] = 47;
- t[19] = 48;
- t[20] = 49;
- t[21] = 50;
- t[22] = 51;
- t[23] = 52;
- t[24] = 53;
- t[25] = 54;
- t[26] = 55;
- t[27] = 56;
- t[28] = 57;
- t[29] = 58;
- t[30] = 894;
- t[31] = 60;
- t[32] = 61;
- t[33] = 62;
- t[34] = 63;
- t[35] = 64;
- t[36] = 65;
- t[37] = 66;
- t[38] = 67;
- t[39] = 68;
- t[40] = 69;
- t[41] = 70;
- t[42] = 71;
- t[43] = 72;
- t[44] = 73;
- t[45] = 74;
- t[46] = 75;
- t[47] = 76;
- t[48] = 77;
- t[49] = 78;
- t[50] = 79;
- t[51] = 80;
- t[52] = 81;
- t[53] = 82;
- t[54] = 83;
- t[55] = 84;
- t[56] = 85;
- t[57] = 86;
- t[58] = 87;
- t[59] = 88;
- t[60] = 89;
- t[61] = 90;
- t[62] = 91;
- t[63] = 92;
- t[64] = 93;
- t[65] = 94;
- t[66] = 95;
- t[67] = 96;
- t[68] = 97;
- t[69] = 98;
- t[70] = 99;
- t[71] = 100;
- t[72] = 101;
- t[73] = 102;
- t[74] = 103;
- t[75] = 104;
- t[76] = 105;
- t[77] = 106;
- t[78] = 107;
- t[79] = 108;
- t[80] = 109;
- t[81] = 110;
- t[82] = 111;
- t[83] = 112;
- t[84] = 113;
- t[85] = 114;
- t[86] = 115;
- t[87] = 116;
- t[88] = 117;
- t[89] = 118;
- t[90] = 119;
- t[91] = 120;
- t[92] = 121;
- t[93] = 122;
- t[94] = 123;
- t[95] = 124;
- t[96] = 125;
- t[97] = 126;
- t[98] = 196;
- t[99] = 197;
- t[100] = 199;
- t[101] = 201;
- t[102] = 209;
- t[103] = 214;
- t[104] = 220;
- t[105] = 225;
- t[106] = 224;
- t[107] = 226;
- t[108] = 228;
- t[109] = 227;
- t[110] = 229;
- t[111] = 231;
- t[112] = 233;
- t[113] = 232;
- t[114] = 234;
- t[115] = 235;
- t[116] = 237;
- t[117] = 236;
- t[118] = 238;
- t[119] = 239;
- t[120] = 241;
- t[121] = 243;
- t[122] = 242;
- t[123] = 244;
- t[124] = 246;
- t[125] = 245;
- t[126] = 250;
- t[127] = 249;
- t[128] = 251;
- t[129] = 252;
- t[130] = 8224;
- t[131] = 176;
- t[132] = 162;
- t[133] = 163;
- t[134] = 167;
- t[135] = 8226;
- t[136] = 182;
- t[137] = 223;
- t[138] = 174;
- t[139] = 169;
- t[140] = 8482;
- t[141] = 180;
- t[142] = 168;
- t[143] = 8800;
- t[144] = 198;
- t[145] = 216;
- t[146] = 8734;
- t[147] = 177;
- t[148] = 8804;
- t[149] = 8805;
- t[150] = 165;
- t[151] = 181;
- t[152] = 8706;
- t[153] = 8721;
- t[154] = 8719;
- t[156] = 8747;
- t[157] = 170;
- t[158] = 186;
- t[159] = 8486;
- t[160] = 230;
- t[161] = 248;
- t[162] = 191;
- t[163] = 161;
- t[164] = 172;
- t[165] = 8730;
- t[166] = 402;
- t[167] = 8776;
- t[168] = 8710;
- t[169] = 171;
- t[170] = 187;
- t[171] = 8230;
- t[210] = 218;
- t[223] = 711;
- t[224] = 321;
- t[225] = 322;
- t[227] = 353;
- t[229] = 382;
- t[234] = 253;
- t[252] = 263;
- t[253] = 268;
- t[254] = 269;
- t[258] = 258;
- t[260] = 260;
- t[261] = 261;
- t[265] = 280;
- t[266] = 281;
- t[268] = 283;
- t[269] = 313;
- t[275] = 323;
- t[276] = 324;
- t[278] = 328;
- t[284] = 345;
- t[285] = 346;
- t[286] = 347;
- t[292] = 367;
- t[295] = 377;
- t[296] = 378;
- t[298] = 380;
- t[305] = 963;
- t[306] = 964;
- t[307] = 966;
- t[308] = 8215;
- t[309] = 8252;
- t[310] = 8319;
- t[311] = 8359;
- t[312] = 8592;
- t[313] = 8593;
- t[337] = 9552;
- t[493] = 1039;
- t[494] = 1040;
- t[705] = 1524;
- t[706] = 8362;
- t[710] = 64288;
- t[711] = 64298;
- t[759] = 1617;
- t[761] = 1776;
- t[763] = 1778;
- t[775] = 1652;
- t[777] = 1764;
- t[778] = 1780;
- t[779] = 1781;
- t[780] = 1782;
- t[782] = 771;
- t[783] = 64726;
- t[786] = 8363;
- t[788] = 8532;
- t[790] = 768;
- t[791] = 769;
- t[792] = 768;
- t[795] = 803;
- t[797] = 64336;
- t[798] = 64337;
- t[799] = 64342;
- t[800] = 64343;
- t[801] = 64344;
- t[802] = 64345;
- t[803] = 64362;
- t[804] = 64363;
- t[805] = 64364;
- t[2424] = 7821;
- t[2425] = 7822;
- t[2426] = 7823;
- t[2427] = 7824;
- t[2428] = 7825;
- t[2429] = 7826;
- t[2430] = 7827;
- t[2433] = 7682;
- t[2678] = 8045;
- t[2679] = 8046;
- t[2830] = 1552;
- t[2838] = 686;
- t[2840] = 751;
- t[2842] = 753;
- t[2843] = 754;
- t[2844] = 755;
- t[2846] = 757;
- t[2856] = 767;
- t[2857] = 848;
- t[2858] = 849;
- t[2862] = 853;
- t[2863] = 854;
- t[2864] = 855;
- t[2865] = 861;
- t[2866] = 862;
- t[2906] = 7460;
- t[2908] = 7462;
- t[2909] = 7463;
- t[2910] = 7464;
- t[2912] = 7466;
- t[2913] = 7467;
- t[2914] = 7468;
- t[2916] = 7470;
- t[2917] = 7471;
- t[2918] = 7472;
- t[2920] = 7474;
- t[2921] = 7475;
- t[2922] = 7476;
- t[2924] = 7478;
- t[2925] = 7479;
- t[2926] = 7480;
- t[2928] = 7482;
- t[2929] = 7483;
- t[2930] = 7484;
- t[2932] = 7486;
- t[2933] = 7487;
- t[2934] = 7488;
- t[2936] = 7490;
- t[2937] = 7491;
- t[2938] = 7492;
- t[2940] = 7494;
- t[2941] = 7495;
- t[2942] = 7496;
- t[2944] = 7498;
- t[2946] = 7500;
- t[2948] = 7502;
- t[2950] = 7504;
- t[2951] = 7505;
- t[2952] = 7506;
- t[2954] = 7508;
- t[2955] = 7509;
- t[2956] = 7510;
- t[2958] = 7512;
- t[2959] = 7513;
- t[2960] = 7514;
- t[2962] = 7516;
- t[2963] = 7517;
- t[2964] = 7518;
- t[2966] = 7520;
- t[2967] = 7521;
- t[2968] = 7522;
- t[2970] = 7524;
- t[2971] = 7525;
- t[2972] = 7526;
- t[2974] = 7528;
- t[2975] = 7529;
- t[2976] = 7530;
- t[2978] = 1537;
- t[2979] = 1538;
- t[2980] = 1539;
- t[2982] = 1549;
- t[2983] = 1551;
- t[2984] = 1552;
- t[2986] = 1554;
- t[2987] = 1555;
- t[2988] = 1556;
- t[2990] = 1623;
- t[2991] = 1624;
- t[2995] = 1775;
- t[2999] = 1791;
- t[3002] = 64290;
- t[3003] = 64291;
- t[3004] = 64292;
- t[3006] = 64294;
- t[3007] = 64295;
- t[3008] = 64296;
- t[3011] = 1900;
- t[3014] = 8223;
- t[3015] = 8244;
- t[3017] = 7532;
- t[3018] = 7533;
- t[3019] = 7534;
- t[3075] = 7590;
- t[3076] = 7591;
- t[3079] = 7594;
- t[3080] = 7595;
- t[3083] = 7598;
- t[3084] = 7599;
- t[3087] = 7602;
- t[3088] = 7603;
- t[3091] = 7606;
- t[3092] = 7607;
- t[3095] = 7610;
- t[3096] = 7611;
- t[3099] = 7614;
- t[3100] = 7615;
- t[3103] = 7618;
- t[3104] = 7619;
- t[3107] = 8337;
- t[3108] = 8338;
- t[3116] = 1884;
- t[3119] = 1885;
- t[3120] = 1885;
- t[3123] = 1886;
- t[3124] = 1886;
- t[3127] = 1887;
- t[3128] = 1887;
- t[3131] = 1888;
- t[3132] = 1888;
- t[3135] = 1889;
- t[3136] = 1889;
- t[3139] = 1890;
- t[3140] = 1890;
- t[3143] = 1891;
- t[3144] = 1891;
- t[3147] = 1892;
- t[3148] = 1892;
- t[3153] = 580;
- t[3154] = 581;
- t[3157] = 584;
- t[3158] = 585;
- t[3161] = 588;
- t[3162] = 589;
- t[3165] = 891;
- t[3166] = 892;
- t[3169] = 1274;
- t[3170] = 1275;
- t[3173] = 1278;
- t[3174] = 1279;
- t[3181] = 7622;
- t[3182] = 7623;
- t[3282] = 11799;
- t[3316] = 578;
- t[3379] = 42785;
- t[3393] = 1159;
- t[3416] = 8377;
-});
-var getSupplementalGlyphMapForArialBlack = (0, _util.getLookupTableFactory)(function (t) {
- t[227] = 322;
- t[264] = 261;
- t[291] = 346;
-});
-var getSupplementalGlyphMapForCalibri = (0, _util.getLookupTableFactory)(function (t) {
- t[1] = 32;
- t[4] = 65;
- t[17] = 66;
- t[18] = 67;
- t[24] = 68;
- t[28] = 69;
- t[38] = 70;
- t[39] = 71;
- t[44] = 72;
- t[47] = 73;
- t[58] = 74;
- t[60] = 75;
- t[62] = 76;
- t[68] = 77;
- t[69] = 78;
- t[75] = 79;
- t[87] = 80;
- t[89] = 81;
- t[90] = 82;
- t[94] = 83;
- t[100] = 84;
- t[104] = 85;
- t[115] = 86;
- t[116] = 87;
- t[121] = 88;
- t[122] = 89;
- t[127] = 90;
- t[258] = 97;
- t[268] = 261;
- t[271] = 98;
- t[272] = 99;
- t[273] = 263;
- t[282] = 100;
- t[286] = 101;
- t[295] = 281;
- t[296] = 102;
- t[336] = 103;
- t[346] = 104;
- t[349] = 105;
- t[361] = 106;
- t[364] = 107;
- t[367] = 108;
- t[371] = 322;
- t[373] = 109;
- t[374] = 110;
- t[381] = 111;
- t[383] = 243;
- t[393] = 112;
- t[395] = 113;
- t[396] = 114;
- t[400] = 115;
- t[401] = 347;
- t[410] = 116;
- t[437] = 117;
- t[448] = 118;
- t[449] = 119;
- t[454] = 120;
- t[455] = 121;
- t[460] = 122;
- t[463] = 380;
- t[853] = 44;
- t[855] = 58;
- t[856] = 46;
- t[876] = 47;
- t[878] = 45;
- t[882] = 45;
- t[894] = 40;
- t[895] = 41;
- t[896] = 91;
- t[897] = 93;
- t[923] = 64;
- t[1004] = 48;
- t[1005] = 49;
- t[1006] = 50;
- t[1007] = 51;
- t[1008] = 52;
- t[1009] = 53;
- t[1010] = 54;
- t[1011] = 55;
- t[1012] = 56;
- t[1013] = 57;
- t[1081] = 37;
- t[1085] = 43;
- t[1086] = 45;
-});
-exports.getStdFontMap = getStdFontMap;
-exports.getNonStdFontMap = getNonStdFontMap;
-exports.getSerifFonts = getSerifFonts;
-exports.getSymbolsFonts = getSymbolsFonts;
-exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
-exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
-exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
-
-/***/ }),
-/* 162 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-var getLookupTableFactory = __w_pdfjs_require__(2).getLookupTableFactory;
-var getSpecialPUASymbols = getLookupTableFactory(function (t) {
- t[63721] = 0x00A9;
- t[63193] = 0x00A9;
- t[63720] = 0x00AE;
- t[63194] = 0x00AE;
- t[63722] = 0x2122;
- t[63195] = 0x2122;
- t[63729] = 0x23A7;
- t[63730] = 0x23A8;
- t[63731] = 0x23A9;
- t[63740] = 0x23AB;
- t[63741] = 0x23AC;
- t[63742] = 0x23AD;
- t[63726] = 0x23A1;
- t[63727] = 0x23A2;
- t[63728] = 0x23A3;
- t[63737] = 0x23A4;
- t[63738] = 0x23A5;
- t[63739] = 0x23A6;
- t[63723] = 0x239B;
- t[63724] = 0x239C;
- t[63725] = 0x239D;
- t[63734] = 0x239E;
- t[63735] = 0x239F;
- t[63736] = 0x23A0;
-});
-function mapSpecialUnicodeValues(code) {
- if (code >= 0xFFF0 && code <= 0xFFFF) {
- return 0;
- } else if (code >= 0xF600 && code <= 0xF8FF) {
- return getSpecialPUASymbols()[code] || code;
- } else if (code === 0x00AD) {
- return 0x002D;
- }
- return code;
-}
-function getUnicodeForGlyph(name, glyphsUnicodeMap) {
- var unicode = glyphsUnicodeMap[name];
- if (unicode !== undefined) {
- return unicode;
- }
- if (!name) {
- return -1;
- }
- if (name[0] === 'u') {
- var nameLen = name.length, hexStr;
- if (nameLen === 7 && name[1] === 'n' && name[2] === 'i') {
- hexStr = name.substring(3);
- } else if (nameLen >= 5 && nameLen <= 7) {
- hexStr = name.substring(1);
- } else {
- return -1;
- }
- if (hexStr === hexStr.toUpperCase()) {
- unicode = parseInt(hexStr, 16);
- if (unicode >= 0) {
- return unicode;
- }
- }
- }
- return -1;
-}
-var UnicodeRanges = [
- {
- 'begin': 0x0000,
- 'end': 0x007F
- },
- {
- 'begin': 0x0080,
- 'end': 0x00FF
- },
- {
- 'begin': 0x0100,
- 'end': 0x017F
- },
- {
- 'begin': 0x0180,
- 'end': 0x024F
- },
- {
- 'begin': 0x0250,
- 'end': 0x02AF
- },
- {
- 'begin': 0x02B0,
- 'end': 0x02FF
- },
- {
- 'begin': 0x0300,
- 'end': 0x036F
- },
- {
- 'begin': 0x0370,
- 'end': 0x03FF
- },
- {
- 'begin': 0x2C80,
- 'end': 0x2CFF
- },
- {
- 'begin': 0x0400,
- 'end': 0x04FF
- },
- {
- 'begin': 0x0530,
- 'end': 0x058F
- },
- {
- 'begin': 0x0590,
- 'end': 0x05FF
- },
- {
- 'begin': 0xA500,
- 'end': 0xA63F
- },
- {
- 'begin': 0x0600,
- 'end': 0x06FF
- },
- {
- 'begin': 0x07C0,
- 'end': 0x07FF
- },
- {
- 'begin': 0x0900,
- 'end': 0x097F
- },
- {
- 'begin': 0x0980,
- 'end': 0x09FF
- },
- {
- 'begin': 0x0A00,
- 'end': 0x0A7F
- },
- {
- 'begin': 0x0A80,
- 'end': 0x0AFF
- },
- {
- 'begin': 0x0B00,
- 'end': 0x0B7F
- },
- {
- 'begin': 0x0B80,
- 'end': 0x0BFF
- },
- {
- 'begin': 0x0C00,
- 'end': 0x0C7F
- },
- {
- 'begin': 0x0C80,
- 'end': 0x0CFF
- },
- {
- 'begin': 0x0D00,
- 'end': 0x0D7F
- },
- {
- 'begin': 0x0E00,
- 'end': 0x0E7F
- },
- {
- 'begin': 0x0E80,
- 'end': 0x0EFF
- },
- {
- 'begin': 0x10A0,
- 'end': 0x10FF
- },
- {
- 'begin': 0x1B00,
- 'end': 0x1B7F
- },
- {
- 'begin': 0x1100,
- 'end': 0x11FF
- },
- {
- 'begin': 0x1E00,
- 'end': 0x1EFF
- },
- {
- 'begin': 0x1F00,
- 'end': 0x1FFF
- },
- {
- 'begin': 0x2000,
- 'end': 0x206F
- },
- {
- 'begin': 0x2070,
- 'end': 0x209F
- },
- {
- 'begin': 0x20A0,
- 'end': 0x20CF
- },
- {
- 'begin': 0x20D0,
- 'end': 0x20FF
- },
- {
- 'begin': 0x2100,
- 'end': 0x214F
- },
- {
- 'begin': 0x2150,
- 'end': 0x218F
- },
- {
- 'begin': 0x2190,
- 'end': 0x21FF
- },
- {
- 'begin': 0x2200,
- 'end': 0x22FF
- },
- {
- 'begin': 0x2300,
- 'end': 0x23FF
- },
- {
- 'begin': 0x2400,
- 'end': 0x243F
- },
- {
- 'begin': 0x2440,
- 'end': 0x245F
- },
- {
- 'begin': 0x2460,
- 'end': 0x24FF
- },
- {
- 'begin': 0x2500,
- 'end': 0x257F
- },
- {
- 'begin': 0x2580,
- 'end': 0x259F
- },
- {
- 'begin': 0x25A0,
- 'end': 0x25FF
- },
- {
- 'begin': 0x2600,
- 'end': 0x26FF
- },
- {
- 'begin': 0x2700,
- 'end': 0x27BF
- },
- {
- 'begin': 0x3000,
- 'end': 0x303F
- },
- {
- 'begin': 0x3040,
- 'end': 0x309F
- },
- {
- 'begin': 0x30A0,
- 'end': 0x30FF
- },
- {
- 'begin': 0x3100,
- 'end': 0x312F
- },
- {
- 'begin': 0x3130,
- 'end': 0x318F
- },
- {
- 'begin': 0xA840,
- 'end': 0xA87F
- },
- {
- 'begin': 0x3200,
- 'end': 0x32FF
- },
- {
- 'begin': 0x3300,
- 'end': 0x33FF
- },
- {
- 'begin': 0xAC00,
- 'end': 0xD7AF
- },
- {
- 'begin': 0xD800,
- 'end': 0xDFFF
- },
- {
- 'begin': 0x10900,
- 'end': 0x1091F
- },
- {
- 'begin': 0x4E00,
- 'end': 0x9FFF
- },
- {
- 'begin': 0xE000,
- 'end': 0xF8FF
- },
- {
- 'begin': 0x31C0,
- 'end': 0x31EF
- },
- {
- 'begin': 0xFB00,
- 'end': 0xFB4F
- },
- {
- 'begin': 0xFB50,
- 'end': 0xFDFF
- },
- {
- 'begin': 0xFE20,
- 'end': 0xFE2F
- },
- {
- 'begin': 0xFE10,
- 'end': 0xFE1F
- },
- {
- 'begin': 0xFE50,
- 'end': 0xFE6F
- },
- {
- 'begin': 0xFE70,
- 'end': 0xFEFF
- },
- {
- 'begin': 0xFF00,
- 'end': 0xFFEF
- },
- {
- 'begin': 0xFFF0,
- 'end': 0xFFFF
- },
- {
- 'begin': 0x0F00,
- 'end': 0x0FFF
- },
- {
- 'begin': 0x0700,
- 'end': 0x074F
- },
- {
- 'begin': 0x0780,
- 'end': 0x07BF
- },
- {
- 'begin': 0x0D80,
- 'end': 0x0DFF
- },
- {
- 'begin': 0x1000,
- 'end': 0x109F
- },
- {
- 'begin': 0x1200,
- 'end': 0x137F
- },
- {
- 'begin': 0x13A0,
- 'end': 0x13FF
- },
- {
- 'begin': 0x1400,
- 'end': 0x167F
- },
- {
- 'begin': 0x1680,
- 'end': 0x169F
- },
- {
- 'begin': 0x16A0,
- 'end': 0x16FF
- },
- {
- 'begin': 0x1780,
- 'end': 0x17FF
- },
- {
- 'begin': 0x1800,
- 'end': 0x18AF
- },
- {
- 'begin': 0x2800,
- 'end': 0x28FF
- },
- {
- 'begin': 0xA000,
- 'end': 0xA48F
- },
- {
- 'begin': 0x1700,
- 'end': 0x171F
- },
- {
- 'begin': 0x10300,
- 'end': 0x1032F
- },
- {
- 'begin': 0x10330,
- 'end': 0x1034F
- },
- {
- 'begin': 0x10400,
- 'end': 0x1044F
- },
- {
- 'begin': 0x1D000,
- 'end': 0x1D0FF
- },
- {
- 'begin': 0x1D400,
- 'end': 0x1D7FF
- },
- {
- 'begin': 0xFF000,
- 'end': 0xFFFFD
- },
- {
- 'begin': 0xFE00,
- 'end': 0xFE0F
- },
- {
- 'begin': 0xE0000,
- 'end': 0xE007F
- },
- {
- 'begin': 0x1900,
- 'end': 0x194F
- },
- {
- 'begin': 0x1950,
- 'end': 0x197F
- },
- {
- 'begin': 0x1980,
- 'end': 0x19DF
- },
- {
- 'begin': 0x1A00,
- 'end': 0x1A1F
- },
- {
- 'begin': 0x2C00,
- 'end': 0x2C5F
- },
- {
- 'begin': 0x2D30,
- 'end': 0x2D7F
- },
- {
- 'begin': 0x4DC0,
- 'end': 0x4DFF
- },
- {
- 'begin': 0xA800,
- 'end': 0xA82F
- },
- {
- 'begin': 0x10000,
- 'end': 0x1007F
- },
- {
- 'begin': 0x10140,
- 'end': 0x1018F
- },
- {
- 'begin': 0x10380,
- 'end': 0x1039F
- },
- {
- 'begin': 0x103A0,
- 'end': 0x103DF
- },
- {
- 'begin': 0x10450,
- 'end': 0x1047F
- },
- {
- 'begin': 0x10480,
- 'end': 0x104AF
- },
- {
- 'begin': 0x10800,
- 'end': 0x1083F
- },
- {
- 'begin': 0x10A00,
- 'end': 0x10A5F
- },
- {
- 'begin': 0x1D300,
- 'end': 0x1D35F
- },
- {
- 'begin': 0x12000,
- 'end': 0x123FF
- },
- {
- 'begin': 0x1D360,
- 'end': 0x1D37F
- },
- {
- 'begin': 0x1B80,
- 'end': 0x1BBF
- },
- {
- 'begin': 0x1C00,
- 'end': 0x1C4F
- },
- {
- 'begin': 0x1C50,
- 'end': 0x1C7F
- },
- {
- 'begin': 0xA880,
- 'end': 0xA8DF
- },
- {
- 'begin': 0xA900,
- 'end': 0xA92F
- },
- {
- 'begin': 0xA930,
- 'end': 0xA95F
- },
- {
- 'begin': 0xAA00,
- 'end': 0xAA5F
- },
- {
- 'begin': 0x10190,
- 'end': 0x101CF
- },
- {
- 'begin': 0x101D0,
- 'end': 0x101FF
- },
- {
- 'begin': 0x102A0,
- 'end': 0x102DF
- },
- {
- 'begin': 0x1F030,
- 'end': 0x1F09F
- }
-];
-function getUnicodeRangeFor(value) {
- for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) {
- var range = UnicodeRanges[i];
- if (value >= range.begin && value < range.end) {
- return i;
- }
- }
- return -1;
-}
-function isRTLRangeFor(value) {
- var range = UnicodeRanges[13];
- if (value >= range.begin && value < range.end) {
- return true;
- }
- range = UnicodeRanges[11];
- if (value >= range.begin && value < range.end) {
- return true;
- }
- return false;
-}
-var getNormalizedUnicodes = getLookupTableFactory(function (t) {
- t['\u00A8'] = '\u0020\u0308';
- t['\u00AF'] = '\u0020\u0304';
- t['\u00B4'] = '\u0020\u0301';
- t['\u00B5'] = '\u03BC';
- t['\u00B8'] = '\u0020\u0327';
- t['\u0132'] = '\u0049\u004A';
- t['\u0133'] = '\u0069\u006A';
- t['\u013F'] = '\u004C\u00B7';
- t['\u0140'] = '\u006C\u00B7';
- t['\u0149'] = '\u02BC\u006E';
- t['\u017F'] = '\u0073';
- t['\u01C4'] = '\u0044\u017D';
- t['\u01C5'] = '\u0044\u017E';
- t['\u01C6'] = '\u0064\u017E';
- t['\u01C7'] = '\u004C\u004A';
- t['\u01C8'] = '\u004C\u006A';
- t['\u01C9'] = '\u006C\u006A';
- t['\u01CA'] = '\u004E\u004A';
- t['\u01CB'] = '\u004E\u006A';
- t['\u01CC'] = '\u006E\u006A';
- t['\u01F1'] = '\u0044\u005A';
- t['\u01F2'] = '\u0044\u007A';
- t['\u01F3'] = '\u0064\u007A';
- t['\u02D8'] = '\u0020\u0306';
- t['\u02D9'] = '\u0020\u0307';
- t['\u02DA'] = '\u0020\u030A';
- t['\u02DB'] = '\u0020\u0328';
- t['\u02DC'] = '\u0020\u0303';
- t['\u02DD'] = '\u0020\u030B';
- t['\u037A'] = '\u0020\u0345';
- t['\u0384'] = '\u0020\u0301';
- t['\u03D0'] = '\u03B2';
- t['\u03D1'] = '\u03B8';
- t['\u03D2'] = '\u03A5';
- t['\u03D5'] = '\u03C6';
- t['\u03D6'] = '\u03C0';
- t['\u03F0'] = '\u03BA';
- t['\u03F1'] = '\u03C1';
- t['\u03F2'] = '\u03C2';
- t['\u03F4'] = '\u0398';
- t['\u03F5'] = '\u03B5';
- t['\u03F9'] = '\u03A3';
- t['\u0587'] = '\u0565\u0582';
- t['\u0675'] = '\u0627\u0674';
- t['\u0676'] = '\u0648\u0674';
- t['\u0677'] = '\u06C7\u0674';
- t['\u0678'] = '\u064A\u0674';
- t['\u0E33'] = '\u0E4D\u0E32';
- t['\u0EB3'] = '\u0ECD\u0EB2';
- t['\u0EDC'] = '\u0EAB\u0E99';
- t['\u0EDD'] = '\u0EAB\u0EA1';
- t['\u0F77'] = '\u0FB2\u0F81';
- t['\u0F79'] = '\u0FB3\u0F81';
- t['\u1E9A'] = '\u0061\u02BE';
- t['\u1FBD'] = '\u0020\u0313';
- t['\u1FBF'] = '\u0020\u0313';
- t['\u1FC0'] = '\u0020\u0342';
- t['\u1FFE'] = '\u0020\u0314';
- t['\u2002'] = '\u0020';
- t['\u2003'] = '\u0020';
- t['\u2004'] = '\u0020';
- t['\u2005'] = '\u0020';
- t['\u2006'] = '\u0020';
- t['\u2008'] = '\u0020';
- t['\u2009'] = '\u0020';
- t['\u200A'] = '\u0020';
- t['\u2017'] = '\u0020\u0333';
- t['\u2024'] = '\u002E';
- t['\u2025'] = '\u002E\u002E';
- t['\u2026'] = '\u002E\u002E\u002E';
- t['\u2033'] = '\u2032\u2032';
- t['\u2034'] = '\u2032\u2032\u2032';
- t['\u2036'] = '\u2035\u2035';
- t['\u2037'] = '\u2035\u2035\u2035';
- t['\u203C'] = '\u0021\u0021';
- t['\u203E'] = '\u0020\u0305';
- t['\u2047'] = '\u003F\u003F';
- t['\u2048'] = '\u003F\u0021';
- t['\u2049'] = '\u0021\u003F';
- t['\u2057'] = '\u2032\u2032\u2032\u2032';
- t['\u205F'] = '\u0020';
- t['\u20A8'] = '\u0052\u0073';
- t['\u2100'] = '\u0061\u002F\u0063';
- t['\u2101'] = '\u0061\u002F\u0073';
- t['\u2103'] = '\u00B0\u0043';
- t['\u2105'] = '\u0063\u002F\u006F';
- t['\u2106'] = '\u0063\u002F\u0075';
- t['\u2107'] = '\u0190';
- t['\u2109'] = '\u00B0\u0046';
- t['\u2116'] = '\u004E\u006F';
- t['\u2121'] = '\u0054\u0045\u004C';
- t['\u2135'] = '\u05D0';
- t['\u2136'] = '\u05D1';
- t['\u2137'] = '\u05D2';
- t['\u2138'] = '\u05D3';
- t['\u213B'] = '\u0046\u0041\u0058';
- t['\u2160'] = '\u0049';
- t['\u2161'] = '\u0049\u0049';
- t['\u2162'] = '\u0049\u0049\u0049';
- t['\u2163'] = '\u0049\u0056';
- t['\u2164'] = '\u0056';
- t['\u2165'] = '\u0056\u0049';
- t['\u2166'] = '\u0056\u0049\u0049';
- t['\u2167'] = '\u0056\u0049\u0049\u0049';
- t['\u2168'] = '\u0049\u0058';
- t['\u2169'] = '\u0058';
- t['\u216A'] = '\u0058\u0049';
- t['\u216B'] = '\u0058\u0049\u0049';
- t['\u216C'] = '\u004C';
- t['\u216D'] = '\u0043';
- t['\u216E'] = '\u0044';
- t['\u216F'] = '\u004D';
- t['\u2170'] = '\u0069';
- t['\u2171'] = '\u0069\u0069';
- t['\u2172'] = '\u0069\u0069\u0069';
- t['\u2173'] = '\u0069\u0076';
- t['\u2174'] = '\u0076';
- t['\u2175'] = '\u0076\u0069';
- t['\u2176'] = '\u0076\u0069\u0069';
- t['\u2177'] = '\u0076\u0069\u0069\u0069';
- t['\u2178'] = '\u0069\u0078';
- t['\u2179'] = '\u0078';
- t['\u217A'] = '\u0078\u0069';
- t['\u217B'] = '\u0078\u0069\u0069';
- t['\u217C'] = '\u006C';
- t['\u217D'] = '\u0063';
- t['\u217E'] = '\u0064';
- t['\u217F'] = '\u006D';
- t['\u222C'] = '\u222B\u222B';
- t['\u222D'] = '\u222B\u222B\u222B';
- t['\u222F'] = '\u222E\u222E';
- t['\u2230'] = '\u222E\u222E\u222E';
- t['\u2474'] = '\u0028\u0031\u0029';
- t['\u2475'] = '\u0028\u0032\u0029';
- t['\u2476'] = '\u0028\u0033\u0029';
- t['\u2477'] = '\u0028\u0034\u0029';
- t['\u2478'] = '\u0028\u0035\u0029';
- t['\u2479'] = '\u0028\u0036\u0029';
- t['\u247A'] = '\u0028\u0037\u0029';
- t['\u247B'] = '\u0028\u0038\u0029';
- t['\u247C'] = '\u0028\u0039\u0029';
- t['\u247D'] = '\u0028\u0031\u0030\u0029';
- t['\u247E'] = '\u0028\u0031\u0031\u0029';
- t['\u247F'] = '\u0028\u0031\u0032\u0029';
- t['\u2480'] = '\u0028\u0031\u0033\u0029';
- t['\u2481'] = '\u0028\u0031\u0034\u0029';
- t['\u2482'] = '\u0028\u0031\u0035\u0029';
- t['\u2483'] = '\u0028\u0031\u0036\u0029';
- t['\u2484'] = '\u0028\u0031\u0037\u0029';
- t['\u2485'] = '\u0028\u0031\u0038\u0029';
- t['\u2486'] = '\u0028\u0031\u0039\u0029';
- t['\u2487'] = '\u0028\u0032\u0030\u0029';
- t['\u2488'] = '\u0031\u002E';
- t['\u2489'] = '\u0032\u002E';
- t['\u248A'] = '\u0033\u002E';
- t['\u248B'] = '\u0034\u002E';
- t['\u248C'] = '\u0035\u002E';
- t['\u248D'] = '\u0036\u002E';
- t['\u248E'] = '\u0037\u002E';
- t['\u248F'] = '\u0038\u002E';
- t['\u2490'] = '\u0039\u002E';
- t['\u2491'] = '\u0031\u0030\u002E';
- t['\u2492'] = '\u0031\u0031\u002E';
- t['\u2493'] = '\u0031\u0032\u002E';
- t['\u2494'] = '\u0031\u0033\u002E';
- t['\u2495'] = '\u0031\u0034\u002E';
- t['\u2496'] = '\u0031\u0035\u002E';
- t['\u2497'] = '\u0031\u0036\u002E';
- t['\u2498'] = '\u0031\u0037\u002E';
- t['\u2499'] = '\u0031\u0038\u002E';
- t['\u249A'] = '\u0031\u0039\u002E';
- t['\u249B'] = '\u0032\u0030\u002E';
- t['\u249C'] = '\u0028\u0061\u0029';
- t['\u249D'] = '\u0028\u0062\u0029';
- t['\u249E'] = '\u0028\u0063\u0029';
- t['\u249F'] = '\u0028\u0064\u0029';
- t['\u24A0'] = '\u0028\u0065\u0029';
- t['\u24A1'] = '\u0028\u0066\u0029';
- t['\u24A2'] = '\u0028\u0067\u0029';
- t['\u24A3'] = '\u0028\u0068\u0029';
- t['\u24A4'] = '\u0028\u0069\u0029';
- t['\u24A5'] = '\u0028\u006A\u0029';
- t['\u24A6'] = '\u0028\u006B\u0029';
- t['\u24A7'] = '\u0028\u006C\u0029';
- t['\u24A8'] = '\u0028\u006D\u0029';
- t['\u24A9'] = '\u0028\u006E\u0029';
- t['\u24AA'] = '\u0028\u006F\u0029';
- t['\u24AB'] = '\u0028\u0070\u0029';
- t['\u24AC'] = '\u0028\u0071\u0029';
- t['\u24AD'] = '\u0028\u0072\u0029';
- t['\u24AE'] = '\u0028\u0073\u0029';
- t['\u24AF'] = '\u0028\u0074\u0029';
- t['\u24B0'] = '\u0028\u0075\u0029';
- t['\u24B1'] = '\u0028\u0076\u0029';
- t['\u24B2'] = '\u0028\u0077\u0029';
- t['\u24B3'] = '\u0028\u0078\u0029';
- t['\u24B4'] = '\u0028\u0079\u0029';
- t['\u24B5'] = '\u0028\u007A\u0029';
- t['\u2A0C'] = '\u222B\u222B\u222B\u222B';
- t['\u2A74'] = '\u003A\u003A\u003D';
- t['\u2A75'] = '\u003D\u003D';
- t['\u2A76'] = '\u003D\u003D\u003D';
- t['\u2E9F'] = '\u6BCD';
- t['\u2EF3'] = '\u9F9F';
- t['\u2F00'] = '\u4E00';
- t['\u2F01'] = '\u4E28';
- t['\u2F02'] = '\u4E36';
- t['\u2F03'] = '\u4E3F';
- t['\u2F04'] = '\u4E59';
- t['\u2F05'] = '\u4E85';
- t['\u2F06'] = '\u4E8C';
- t['\u2F07'] = '\u4EA0';
- t['\u2F08'] = '\u4EBA';
- t['\u2F09'] = '\u513F';
- t['\u2F0A'] = '\u5165';
- t['\u2F0B'] = '\u516B';
- t['\u2F0C'] = '\u5182';
- t['\u2F0D'] = '\u5196';
- t['\u2F0E'] = '\u51AB';
- t['\u2F0F'] = '\u51E0';
- t['\u2F10'] = '\u51F5';
- t['\u2F11'] = '\u5200';
- t['\u2F12'] = '\u529B';
- t['\u2F13'] = '\u52F9';
- t['\u2F14'] = '\u5315';
- t['\u2F15'] = '\u531A';
- t['\u2F16'] = '\u5338';
- t['\u2F17'] = '\u5341';
- t['\u2F18'] = '\u535C';
- t['\u2F19'] = '\u5369';
- t['\u2F1A'] = '\u5382';
- t['\u2F1B'] = '\u53B6';
- t['\u2F1C'] = '\u53C8';
- t['\u2F1D'] = '\u53E3';
- t['\u2F1E'] = '\u56D7';
- t['\u2F1F'] = '\u571F';
- t['\u2F20'] = '\u58EB';
- t['\u2F21'] = '\u5902';
- t['\u2F22'] = '\u590A';
- t['\u2F23'] = '\u5915';
- t['\u2F24'] = '\u5927';
- t['\u2F25'] = '\u5973';
- t['\u2F26'] = '\u5B50';
- t['\u2F27'] = '\u5B80';
- t['\u2F28'] = '\u5BF8';
- t['\u2F29'] = '\u5C0F';
- t['\u2F2A'] = '\u5C22';
- t['\u2F2B'] = '\u5C38';
- t['\u2F2C'] = '\u5C6E';
- t['\u2F2D'] = '\u5C71';
- t['\u2F2E'] = '\u5DDB';
- t['\u2F2F'] = '\u5DE5';
- t['\u2F30'] = '\u5DF1';
- t['\u2F31'] = '\u5DFE';
- t['\u2F32'] = '\u5E72';
- t['\u2F33'] = '\u5E7A';
- t['\u2F34'] = '\u5E7F';
- t['\u2F35'] = '\u5EF4';
- t['\u2F36'] = '\u5EFE';
- t['\u2F37'] = '\u5F0B';
- t['\u2F38'] = '\u5F13';
- t['\u2F39'] = '\u5F50';
- t['\u2F3A'] = '\u5F61';
- t['\u2F3B'] = '\u5F73';
- t['\u2F3C'] = '\u5FC3';
- t['\u2F3D'] = '\u6208';
- t['\u2F3E'] = '\u6236';
- t['\u2F3F'] = '\u624B';
- t['\u2F40'] = '\u652F';
- t['\u2F41'] = '\u6534';
- t['\u2F42'] = '\u6587';
- t['\u2F43'] = '\u6597';
- t['\u2F44'] = '\u65A4';
- t['\u2F45'] = '\u65B9';
- t['\u2F46'] = '\u65E0';
- t['\u2F47'] = '\u65E5';
- t['\u2F48'] = '\u66F0';
- t['\u2F49'] = '\u6708';
- t['\u2F4A'] = '\u6728';
- t['\u2F4B'] = '\u6B20';
- t['\u2F4C'] = '\u6B62';
- t['\u2F4D'] = '\u6B79';
- t['\u2F4E'] = '\u6BB3';
- t['\u2F4F'] = '\u6BCB';
- t['\u2F50'] = '\u6BD4';
- t['\u2F51'] = '\u6BDB';
- t['\u2F52'] = '\u6C0F';
- t['\u2F53'] = '\u6C14';
- t['\u2F54'] = '\u6C34';
- t['\u2F55'] = '\u706B';
- t['\u2F56'] = '\u722A';
- t['\u2F57'] = '\u7236';
- t['\u2F58'] = '\u723B';
- t['\u2F59'] = '\u723F';
- t['\u2F5A'] = '\u7247';
- t['\u2F5B'] = '\u7259';
- t['\u2F5C'] = '\u725B';
- t['\u2F5D'] = '\u72AC';
- t['\u2F5E'] = '\u7384';
- t['\u2F5F'] = '\u7389';
- t['\u2F60'] = '\u74DC';
- t['\u2F61'] = '\u74E6';
- t['\u2F62'] = '\u7518';
- t['\u2F63'] = '\u751F';
- t['\u2F64'] = '\u7528';
- t['\u2F65'] = '\u7530';
- t['\u2F66'] = '\u758B';
- t['\u2F67'] = '\u7592';
- t['\u2F68'] = '\u7676';
- t['\u2F69'] = '\u767D';
- t['\u2F6A'] = '\u76AE';
- t['\u2F6B'] = '\u76BF';
- t['\u2F6C'] = '\u76EE';
- t['\u2F6D'] = '\u77DB';
- t['\u2F6E'] = '\u77E2';
- t['\u2F6F'] = '\u77F3';
- t['\u2F70'] = '\u793A';
- t['\u2F71'] = '\u79B8';
- t['\u2F72'] = '\u79BE';
- t['\u2F73'] = '\u7A74';
- t['\u2F74'] = '\u7ACB';
- t['\u2F75'] = '\u7AF9';
- t['\u2F76'] = '\u7C73';
- t['\u2F77'] = '\u7CF8';
- t['\u2F78'] = '\u7F36';
- t['\u2F79'] = '\u7F51';
- t['\u2F7A'] = '\u7F8A';
- t['\u2F7B'] = '\u7FBD';
- t['\u2F7C'] = '\u8001';
- t['\u2F7D'] = '\u800C';
- t['\u2F7E'] = '\u8012';
- t['\u2F7F'] = '\u8033';
- t['\u2F80'] = '\u807F';
- t['\u2F81'] = '\u8089';
- t['\u2F82'] = '\u81E3';
- t['\u2F83'] = '\u81EA';
- t['\u2F84'] = '\u81F3';
- t['\u2F85'] = '\u81FC';
- t['\u2F86'] = '\u820C';
- t['\u2F87'] = '\u821B';
- t['\u2F88'] = '\u821F';
- t['\u2F89'] = '\u826E';
- t['\u2F8A'] = '\u8272';
- t['\u2F8B'] = '\u8278';
- t['\u2F8C'] = '\u864D';
- t['\u2F8D'] = '\u866B';
- t['\u2F8E'] = '\u8840';
- t['\u2F8F'] = '\u884C';
- t['\u2F90'] = '\u8863';
- t['\u2F91'] = '\u897E';
- t['\u2F92'] = '\u898B';
- t['\u2F93'] = '\u89D2';
- t['\u2F94'] = '\u8A00';
- t['\u2F95'] = '\u8C37';
- t['\u2F96'] = '\u8C46';
- t['\u2F97'] = '\u8C55';
- t['\u2F98'] = '\u8C78';
- t['\u2F99'] = '\u8C9D';
- t['\u2F9A'] = '\u8D64';
- t['\u2F9B'] = '\u8D70';
- t['\u2F9C'] = '\u8DB3';
- t['\u2F9D'] = '\u8EAB';
- t['\u2F9E'] = '\u8ECA';
- t['\u2F9F'] = '\u8F9B';
- t['\u2FA0'] = '\u8FB0';
- t['\u2FA1'] = '\u8FB5';
- t['\u2FA2'] = '\u9091';
- t['\u2FA3'] = '\u9149';
- t['\u2FA4'] = '\u91C6';
- t['\u2FA5'] = '\u91CC';
- t['\u2FA6'] = '\u91D1';
- t['\u2FA7'] = '\u9577';
- t['\u2FA8'] = '\u9580';
- t['\u2FA9'] = '\u961C';
- t['\u2FAA'] = '\u96B6';
- t['\u2FAB'] = '\u96B9';
- t['\u2FAC'] = '\u96E8';
- t['\u2FAD'] = '\u9751';
- t['\u2FAE'] = '\u975E';
- t['\u2FAF'] = '\u9762';
- t['\u2FB0'] = '\u9769';
- t['\u2FB1'] = '\u97CB';
- t['\u2FB2'] = '\u97ED';
- t['\u2FB3'] = '\u97F3';
- t['\u2FB4'] = '\u9801';
- t['\u2FB5'] = '\u98A8';
- t['\u2FB6'] = '\u98DB';
- t['\u2FB7'] = '\u98DF';
- t['\u2FB8'] = '\u9996';
- t['\u2FB9'] = '\u9999';
- t['\u2FBA'] = '\u99AC';
- t['\u2FBB'] = '\u9AA8';
- t['\u2FBC'] = '\u9AD8';
- t['\u2FBD'] = '\u9ADF';
- t['\u2FBE'] = '\u9B25';
- t['\u2FBF'] = '\u9B2F';
- t['\u2FC0'] = '\u9B32';
- t['\u2FC1'] = '\u9B3C';
- t['\u2FC2'] = '\u9B5A';
- t['\u2FC3'] = '\u9CE5';
- t['\u2FC4'] = '\u9E75';
- t['\u2FC5'] = '\u9E7F';
- t['\u2FC6'] = '\u9EA5';
- t['\u2FC7'] = '\u9EBB';
- t['\u2FC8'] = '\u9EC3';
- t['\u2FC9'] = '\u9ECD';
- t['\u2FCA'] = '\u9ED1';
- t['\u2FCB'] = '\u9EF9';
- t['\u2FCC'] = '\u9EFD';
- t['\u2FCD'] = '\u9F0E';
- t['\u2FCE'] = '\u9F13';
- t['\u2FCF'] = '\u9F20';
- t['\u2FD0'] = '\u9F3B';
- t['\u2FD1'] = '\u9F4A';
- t['\u2FD2'] = '\u9F52';
- t['\u2FD3'] = '\u9F8D';
- t['\u2FD4'] = '\u9F9C';
- t['\u2FD5'] = '\u9FA0';
- t['\u3036'] = '\u3012';
- t['\u3038'] = '\u5341';
- t['\u3039'] = '\u5344';
- t['\u303A'] = '\u5345';
- t['\u309B'] = '\u0020\u3099';
- t['\u309C'] = '\u0020\u309A';
- t['\u3131'] = '\u1100';
- t['\u3132'] = '\u1101';
- t['\u3133'] = '\u11AA';
- t['\u3134'] = '\u1102';
- t['\u3135'] = '\u11AC';
- t['\u3136'] = '\u11AD';
- t['\u3137'] = '\u1103';
- t['\u3138'] = '\u1104';
- t['\u3139'] = '\u1105';
- t['\u313A'] = '\u11B0';
- t['\u313B'] = '\u11B1';
- t['\u313C'] = '\u11B2';
- t['\u313D'] = '\u11B3';
- t['\u313E'] = '\u11B4';
- t['\u313F'] = '\u11B5';
- t['\u3140'] = '\u111A';
- t['\u3141'] = '\u1106';
- t['\u3142'] = '\u1107';
- t['\u3143'] = '\u1108';
- t['\u3144'] = '\u1121';
- t['\u3145'] = '\u1109';
- t['\u3146'] = '\u110A';
- t['\u3147'] = '\u110B';
- t['\u3148'] = '\u110C';
- t['\u3149'] = '\u110D';
- t['\u314A'] = '\u110E';
- t['\u314B'] = '\u110F';
- t['\u314C'] = '\u1110';
- t['\u314D'] = '\u1111';
- t['\u314E'] = '\u1112';
- t['\u314F'] = '\u1161';
- t['\u3150'] = '\u1162';
- t['\u3151'] = '\u1163';
- t['\u3152'] = '\u1164';
- t['\u3153'] = '\u1165';
- t['\u3154'] = '\u1166';
- t['\u3155'] = '\u1167';
- t['\u3156'] = '\u1168';
- t['\u3157'] = '\u1169';
- t['\u3158'] = '\u116A';
- t['\u3159'] = '\u116B';
- t['\u315A'] = '\u116C';
- t['\u315B'] = '\u116D';
- t['\u315C'] = '\u116E';
- t['\u315D'] = '\u116F';
- t['\u315E'] = '\u1170';
- t['\u315F'] = '\u1171';
- t['\u3160'] = '\u1172';
- t['\u3161'] = '\u1173';
- t['\u3162'] = '\u1174';
- t['\u3163'] = '\u1175';
- t['\u3164'] = '\u1160';
- t['\u3165'] = '\u1114';
- t['\u3166'] = '\u1115';
- t['\u3167'] = '\u11C7';
- t['\u3168'] = '\u11C8';
- t['\u3169'] = '\u11CC';
- t['\u316A'] = '\u11CE';
- t['\u316B'] = '\u11D3';
- t['\u316C'] = '\u11D7';
- t['\u316D'] = '\u11D9';
- t['\u316E'] = '\u111C';
- t['\u316F'] = '\u11DD';
- t['\u3170'] = '\u11DF';
- t['\u3171'] = '\u111D';
- t['\u3172'] = '\u111E';
- t['\u3173'] = '\u1120';
- t['\u3174'] = '\u1122';
- t['\u3175'] = '\u1123';
- t['\u3176'] = '\u1127';
- t['\u3177'] = '\u1129';
- t['\u3178'] = '\u112B';
- t['\u3179'] = '\u112C';
- t['\u317A'] = '\u112D';
- t['\u317B'] = '\u112E';
- t['\u317C'] = '\u112F';
- t['\u317D'] = '\u1132';
- t['\u317E'] = '\u1136';
- t['\u317F'] = '\u1140';
- t['\u3180'] = '\u1147';
- t['\u3181'] = '\u114C';
- t['\u3182'] = '\u11F1';
- t['\u3183'] = '\u11F2';
- t['\u3184'] = '\u1157';
- t['\u3185'] = '\u1158';
- t['\u3186'] = '\u1159';
- t['\u3187'] = '\u1184';
- t['\u3188'] = '\u1185';
- t['\u3189'] = '\u1188';
- t['\u318A'] = '\u1191';
- t['\u318B'] = '\u1192';
- t['\u318C'] = '\u1194';
- t['\u318D'] = '\u119E';
- t['\u318E'] = '\u11A1';
- t['\u3200'] = '\u0028\u1100\u0029';
- t['\u3201'] = '\u0028\u1102\u0029';
- t['\u3202'] = '\u0028\u1103\u0029';
- t['\u3203'] = '\u0028\u1105\u0029';
- t['\u3204'] = '\u0028\u1106\u0029';
- t['\u3205'] = '\u0028\u1107\u0029';
- t['\u3206'] = '\u0028\u1109\u0029';
- t['\u3207'] = '\u0028\u110B\u0029';
- t['\u3208'] = '\u0028\u110C\u0029';
- t['\u3209'] = '\u0028\u110E\u0029';
- t['\u320A'] = '\u0028\u110F\u0029';
- t['\u320B'] = '\u0028\u1110\u0029';
- t['\u320C'] = '\u0028\u1111\u0029';
- t['\u320D'] = '\u0028\u1112\u0029';
- t['\u320E'] = '\u0028\u1100\u1161\u0029';
- t['\u320F'] = '\u0028\u1102\u1161\u0029';
- t['\u3210'] = '\u0028\u1103\u1161\u0029';
- t['\u3211'] = '\u0028\u1105\u1161\u0029';
- t['\u3212'] = '\u0028\u1106\u1161\u0029';
- t['\u3213'] = '\u0028\u1107\u1161\u0029';
- t['\u3214'] = '\u0028\u1109\u1161\u0029';
- t['\u3215'] = '\u0028\u110B\u1161\u0029';
- t['\u3216'] = '\u0028\u110C\u1161\u0029';
- t['\u3217'] = '\u0028\u110E\u1161\u0029';
- t['\u3218'] = '\u0028\u110F\u1161\u0029';
- t['\u3219'] = '\u0028\u1110\u1161\u0029';
- t['\u321A'] = '\u0028\u1111\u1161\u0029';
- t['\u321B'] = '\u0028\u1112\u1161\u0029';
- t['\u321C'] = '\u0028\u110C\u116E\u0029';
- t['\u321D'] = '\u0028\u110B\u1169\u110C\u1165\u11AB\u0029';
- t['\u321E'] = '\u0028\u110B\u1169\u1112\u116E\u0029';
- t['\u3220'] = '\u0028\u4E00\u0029';
- t['\u3221'] = '\u0028\u4E8C\u0029';
- t['\u3222'] = '\u0028\u4E09\u0029';
- t['\u3223'] = '\u0028\u56DB\u0029';
- t['\u3224'] = '\u0028\u4E94\u0029';
- t['\u3225'] = '\u0028\u516D\u0029';
- t['\u3226'] = '\u0028\u4E03\u0029';
- t['\u3227'] = '\u0028\u516B\u0029';
- t['\u3228'] = '\u0028\u4E5D\u0029';
- t['\u3229'] = '\u0028\u5341\u0029';
- t['\u322A'] = '\u0028\u6708\u0029';
- t['\u322B'] = '\u0028\u706B\u0029';
- t['\u322C'] = '\u0028\u6C34\u0029';
- t['\u322D'] = '\u0028\u6728\u0029';
- t['\u322E'] = '\u0028\u91D1\u0029';
- t['\u322F'] = '\u0028\u571F\u0029';
- t['\u3230'] = '\u0028\u65E5\u0029';
- t['\u3231'] = '\u0028\u682A\u0029';
- t['\u3232'] = '\u0028\u6709\u0029';
- t['\u3233'] = '\u0028\u793E\u0029';
- t['\u3234'] = '\u0028\u540D\u0029';
- t['\u3235'] = '\u0028\u7279\u0029';
- t['\u3236'] = '\u0028\u8CA1\u0029';
- t['\u3237'] = '\u0028\u795D\u0029';
- t['\u3238'] = '\u0028\u52B4\u0029';
- t['\u3239'] = '\u0028\u4EE3\u0029';
- t['\u323A'] = '\u0028\u547C\u0029';
- t['\u323B'] = '\u0028\u5B66\u0029';
- t['\u323C'] = '\u0028\u76E3\u0029';
- t['\u323D'] = '\u0028\u4F01\u0029';
- t['\u323E'] = '\u0028\u8CC7\u0029';
- t['\u323F'] = '\u0028\u5354\u0029';
- t['\u3240'] = '\u0028\u796D\u0029';
- t['\u3241'] = '\u0028\u4F11\u0029';
- t['\u3242'] = '\u0028\u81EA\u0029';
- t['\u3243'] = '\u0028\u81F3\u0029';
- t['\u32C0'] = '\u0031\u6708';
- t['\u32C1'] = '\u0032\u6708';
- t['\u32C2'] = '\u0033\u6708';
- t['\u32C3'] = '\u0034\u6708';
- t['\u32C4'] = '\u0035\u6708';
- t['\u32C5'] = '\u0036\u6708';
- t['\u32C6'] = '\u0037\u6708';
- t['\u32C7'] = '\u0038\u6708';
- t['\u32C8'] = '\u0039\u6708';
- t['\u32C9'] = '\u0031\u0030\u6708';
- t['\u32CA'] = '\u0031\u0031\u6708';
- t['\u32CB'] = '\u0031\u0032\u6708';
- t['\u3358'] = '\u0030\u70B9';
- t['\u3359'] = '\u0031\u70B9';
- t['\u335A'] = '\u0032\u70B9';
- t['\u335B'] = '\u0033\u70B9';
- t['\u335C'] = '\u0034\u70B9';
- t['\u335D'] = '\u0035\u70B9';
- t['\u335E'] = '\u0036\u70B9';
- t['\u335F'] = '\u0037\u70B9';
- t['\u3360'] = '\u0038\u70B9';
- t['\u3361'] = '\u0039\u70B9';
- t['\u3362'] = '\u0031\u0030\u70B9';
- t['\u3363'] = '\u0031\u0031\u70B9';
- t['\u3364'] = '\u0031\u0032\u70B9';
- t['\u3365'] = '\u0031\u0033\u70B9';
- t['\u3366'] = '\u0031\u0034\u70B9';
- t['\u3367'] = '\u0031\u0035\u70B9';
- t['\u3368'] = '\u0031\u0036\u70B9';
- t['\u3369'] = '\u0031\u0037\u70B9';
- t['\u336A'] = '\u0031\u0038\u70B9';
- t['\u336B'] = '\u0031\u0039\u70B9';
- t['\u336C'] = '\u0032\u0030\u70B9';
- t['\u336D'] = '\u0032\u0031\u70B9';
- t['\u336E'] = '\u0032\u0032\u70B9';
- t['\u336F'] = '\u0032\u0033\u70B9';
- t['\u3370'] = '\u0032\u0034\u70B9';
- t['\u33E0'] = '\u0031\u65E5';
- t['\u33E1'] = '\u0032\u65E5';
- t['\u33E2'] = '\u0033\u65E5';
- t['\u33E3'] = '\u0034\u65E5';
- t['\u33E4'] = '\u0035\u65E5';
- t['\u33E5'] = '\u0036\u65E5';
- t['\u33E6'] = '\u0037\u65E5';
- t['\u33E7'] = '\u0038\u65E5';
- t['\u33E8'] = '\u0039\u65E5';
- t['\u33E9'] = '\u0031\u0030\u65E5';
- t['\u33EA'] = '\u0031\u0031\u65E5';
- t['\u33EB'] = '\u0031\u0032\u65E5';
- t['\u33EC'] = '\u0031\u0033\u65E5';
- t['\u33ED'] = '\u0031\u0034\u65E5';
- t['\u33EE'] = '\u0031\u0035\u65E5';
- t['\u33EF'] = '\u0031\u0036\u65E5';
- t['\u33F0'] = '\u0031\u0037\u65E5';
- t['\u33F1'] = '\u0031\u0038\u65E5';
- t['\u33F2'] = '\u0031\u0039\u65E5';
- t['\u33F3'] = '\u0032\u0030\u65E5';
- t['\u33F4'] = '\u0032\u0031\u65E5';
- t['\u33F5'] = '\u0032\u0032\u65E5';
- t['\u33F6'] = '\u0032\u0033\u65E5';
- t['\u33F7'] = '\u0032\u0034\u65E5';
- t['\u33F8'] = '\u0032\u0035\u65E5';
- t['\u33F9'] = '\u0032\u0036\u65E5';
- t['\u33FA'] = '\u0032\u0037\u65E5';
- t['\u33FB'] = '\u0032\u0038\u65E5';
- t['\u33FC'] = '\u0032\u0039\u65E5';
- t['\u33FD'] = '\u0033\u0030\u65E5';
- t['\u33FE'] = '\u0033\u0031\u65E5';
- t['\uFB00'] = '\u0066\u0066';
- t['\uFB01'] = '\u0066\u0069';
- t['\uFB02'] = '\u0066\u006C';
- t['\uFB03'] = '\u0066\u0066\u0069';
- t['\uFB04'] = '\u0066\u0066\u006C';
- t['\uFB05'] = '\u017F\u0074';
- t['\uFB06'] = '\u0073\u0074';
- t['\uFB13'] = '\u0574\u0576';
- t['\uFB14'] = '\u0574\u0565';
- t['\uFB15'] = '\u0574\u056B';
- t['\uFB16'] = '\u057E\u0576';
- t['\uFB17'] = '\u0574\u056D';
- t['\uFB4F'] = '\u05D0\u05DC';
- t['\uFB50'] = '\u0671';
- t['\uFB51'] = '\u0671';
- t['\uFB52'] = '\u067B';
- t['\uFB53'] = '\u067B';
- t['\uFB54'] = '\u067B';
- t['\uFB55'] = '\u067B';
- t['\uFB56'] = '\u067E';
- t['\uFB57'] = '\u067E';
- t['\uFB58'] = '\u067E';
- t['\uFB59'] = '\u067E';
- t['\uFB5A'] = '\u0680';
- t['\uFB5B'] = '\u0680';
- t['\uFB5C'] = '\u0680';
- t['\uFB5D'] = '\u0680';
- t['\uFB5E'] = '\u067A';
- t['\uFB5F'] = '\u067A';
- t['\uFB60'] = '\u067A';
- t['\uFB61'] = '\u067A';
- t['\uFB62'] = '\u067F';
- t['\uFB63'] = '\u067F';
- t['\uFB64'] = '\u067F';
- t['\uFB65'] = '\u067F';
- t['\uFB66'] = '\u0679';
- t['\uFB67'] = '\u0679';
- t['\uFB68'] = '\u0679';
- t['\uFB69'] = '\u0679';
- t['\uFB6A'] = '\u06A4';
- t['\uFB6B'] = '\u06A4';
- t['\uFB6C'] = '\u06A4';
- t['\uFB6D'] = '\u06A4';
- t['\uFB6E'] = '\u06A6';
- t['\uFB6F'] = '\u06A6';
- t['\uFB70'] = '\u06A6';
- t['\uFB71'] = '\u06A6';
- t['\uFB72'] = '\u0684';
- t['\uFB73'] = '\u0684';
- t['\uFB74'] = '\u0684';
- t['\uFB75'] = '\u0684';
- t['\uFB76'] = '\u0683';
- t['\uFB77'] = '\u0683';
- t['\uFB78'] = '\u0683';
- t['\uFB79'] = '\u0683';
- t['\uFB7A'] = '\u0686';
- t['\uFB7B'] = '\u0686';
- t['\uFB7C'] = '\u0686';
- t['\uFB7D'] = '\u0686';
- t['\uFB7E'] = '\u0687';
- t['\uFB7F'] = '\u0687';
- t['\uFB80'] = '\u0687';
- t['\uFB81'] = '\u0687';
- t['\uFB82'] = '\u068D';
- t['\uFB83'] = '\u068D';
- t['\uFB84'] = '\u068C';
- t['\uFB85'] = '\u068C';
- t['\uFB86'] = '\u068E';
- t['\uFB87'] = '\u068E';
- t['\uFB88'] = '\u0688';
- t['\uFB89'] = '\u0688';
- t['\uFB8A'] = '\u0698';
- t['\uFB8B'] = '\u0698';
- t['\uFB8C'] = '\u0691';
- t['\uFB8D'] = '\u0691';
- t['\uFB8E'] = '\u06A9';
- t['\uFB8F'] = '\u06A9';
- t['\uFB90'] = '\u06A9';
- t['\uFB91'] = '\u06A9';
- t['\uFB92'] = '\u06AF';
- t['\uFB93'] = '\u06AF';
- t['\uFB94'] = '\u06AF';
- t['\uFB95'] = '\u06AF';
- t['\uFB96'] = '\u06B3';
- t['\uFB97'] = '\u06B3';
- t['\uFB98'] = '\u06B3';
- t['\uFB99'] = '\u06B3';
- t['\uFB9A'] = '\u06B1';
- t['\uFB9B'] = '\u06B1';
- t['\uFB9C'] = '\u06B1';
- t['\uFB9D'] = '\u06B1';
- t['\uFB9E'] = '\u06BA';
- t['\uFB9F'] = '\u06BA';
- t['\uFBA0'] = '\u06BB';
- t['\uFBA1'] = '\u06BB';
- t['\uFBA2'] = '\u06BB';
- t['\uFBA3'] = '\u06BB';
- t['\uFBA4'] = '\u06C0';
- t['\uFBA5'] = '\u06C0';
- t['\uFBA6'] = '\u06C1';
- t['\uFBA7'] = '\u06C1';
- t['\uFBA8'] = '\u06C1';
- t['\uFBA9'] = '\u06C1';
- t['\uFBAA'] = '\u06BE';
- t['\uFBAB'] = '\u06BE';
- t['\uFBAC'] = '\u06BE';
- t['\uFBAD'] = '\u06BE';
- t['\uFBAE'] = '\u06D2';
- t['\uFBAF'] = '\u06D2';
- t['\uFBB0'] = '\u06D3';
- t['\uFBB1'] = '\u06D3';
- t['\uFBD3'] = '\u06AD';
- t['\uFBD4'] = '\u06AD';
- t['\uFBD5'] = '\u06AD';
- t['\uFBD6'] = '\u06AD';
- t['\uFBD7'] = '\u06C7';
- t['\uFBD8'] = '\u06C7';
- t['\uFBD9'] = '\u06C6';
- t['\uFBDA'] = '\u06C6';
- t['\uFBDB'] = '\u06C8';
- t['\uFBDC'] = '\u06C8';
- t['\uFBDD'] = '\u0677';
- t['\uFBDE'] = '\u06CB';
- t['\uFBDF'] = '\u06CB';
- t['\uFBE0'] = '\u06C5';
- t['\uFBE1'] = '\u06C5';
- t['\uFBE2'] = '\u06C9';
- t['\uFBE3'] = '\u06C9';
- t['\uFBE4'] = '\u06D0';
- t['\uFBE5'] = '\u06D0';
- t['\uFBE6'] = '\u06D0';
- t['\uFBE7'] = '\u06D0';
- t['\uFBE8'] = '\u0649';
- t['\uFBE9'] = '\u0649';
- t['\uFBEA'] = '\u0626\u0627';
- t['\uFBEB'] = '\u0626\u0627';
- t['\uFBEC'] = '\u0626\u06D5';
- t['\uFBED'] = '\u0626\u06D5';
- t['\uFBEE'] = '\u0626\u0648';
- t['\uFBEF'] = '\u0626\u0648';
- t['\uFBF0'] = '\u0626\u06C7';
- t['\uFBF1'] = '\u0626\u06C7';
- t['\uFBF2'] = '\u0626\u06C6';
- t['\uFBF3'] = '\u0626\u06C6';
- t['\uFBF4'] = '\u0626\u06C8';
- t['\uFBF5'] = '\u0626\u06C8';
- t['\uFBF6'] = '\u0626\u06D0';
- t['\uFBF7'] = '\u0626\u06D0';
- t['\uFBF8'] = '\u0626\u06D0';
- t['\uFBF9'] = '\u0626\u0649';
- t['\uFBFA'] = '\u0626\u0649';
- t['\uFBFB'] = '\u0626\u0649';
- t['\uFBFC'] = '\u06CC';
- t['\uFBFD'] = '\u06CC';
- t['\uFBFE'] = '\u06CC';
- t['\uFBFF'] = '\u06CC';
- t['\uFC00'] = '\u0626\u062C';
- t['\uFC01'] = '\u0626\u062D';
- t['\uFC02'] = '\u0626\u0645';
- t['\uFC03'] = '\u0626\u0649';
- t['\uFC04'] = '\u0626\u064A';
- t['\uFC05'] = '\u0628\u062C';
- t['\uFC06'] = '\u0628\u062D';
- t['\uFC07'] = '\u0628\u062E';
- t['\uFC08'] = '\u0628\u0645';
- t['\uFC09'] = '\u0628\u0649';
- t['\uFC0A'] = '\u0628\u064A';
- t['\uFC0B'] = '\u062A\u062C';
- t['\uFC0C'] = '\u062A\u062D';
- t['\uFC0D'] = '\u062A\u062E';
- t['\uFC0E'] = '\u062A\u0645';
- t['\uFC0F'] = '\u062A\u0649';
- t['\uFC10'] = '\u062A\u064A';
- t['\uFC11'] = '\u062B\u062C';
- t['\uFC12'] = '\u062B\u0645';
- t['\uFC13'] = '\u062B\u0649';
- t['\uFC14'] = '\u062B\u064A';
- t['\uFC15'] = '\u062C\u062D';
- t['\uFC16'] = '\u062C\u0645';
- t['\uFC17'] = '\u062D\u062C';
- t['\uFC18'] = '\u062D\u0645';
- t['\uFC19'] = '\u062E\u062C';
- t['\uFC1A'] = '\u062E\u062D';
- t['\uFC1B'] = '\u062E\u0645';
- t['\uFC1C'] = '\u0633\u062C';
- t['\uFC1D'] = '\u0633\u062D';
- t['\uFC1E'] = '\u0633\u062E';
- t['\uFC1F'] = '\u0633\u0645';
- t['\uFC20'] = '\u0635\u062D';
- t['\uFC21'] = '\u0635\u0645';
- t['\uFC22'] = '\u0636\u062C';
- t['\uFC23'] = '\u0636\u062D';
- t['\uFC24'] = '\u0636\u062E';
- t['\uFC25'] = '\u0636\u0645';
- t['\uFC26'] = '\u0637\u062D';
- t['\uFC27'] = '\u0637\u0645';
- t['\uFC28'] = '\u0638\u0645';
- t['\uFC29'] = '\u0639\u062C';
- t['\uFC2A'] = '\u0639\u0645';
- t['\uFC2B'] = '\u063A\u062C';
- t['\uFC2C'] = '\u063A\u0645';
- t['\uFC2D'] = '\u0641\u062C';
- t['\uFC2E'] = '\u0641\u062D';
- t['\uFC2F'] = '\u0641\u062E';
- t['\uFC30'] = '\u0641\u0645';
- t['\uFC31'] = '\u0641\u0649';
- t['\uFC32'] = '\u0641\u064A';
- t['\uFC33'] = '\u0642\u062D';
- t['\uFC34'] = '\u0642\u0645';
- t['\uFC35'] = '\u0642\u0649';
- t['\uFC36'] = '\u0642\u064A';
- t['\uFC37'] = '\u0643\u0627';
- t['\uFC38'] = '\u0643\u062C';
- t['\uFC39'] = '\u0643\u062D';
- t['\uFC3A'] = '\u0643\u062E';
- t['\uFC3B'] = '\u0643\u0644';
- t['\uFC3C'] = '\u0643\u0645';
- t['\uFC3D'] = '\u0643\u0649';
- t['\uFC3E'] = '\u0643\u064A';
- t['\uFC3F'] = '\u0644\u062C';
- t['\uFC40'] = '\u0644\u062D';
- t['\uFC41'] = '\u0644\u062E';
- t['\uFC42'] = '\u0644\u0645';
- t['\uFC43'] = '\u0644\u0649';
- t['\uFC44'] = '\u0644\u064A';
- t['\uFC45'] = '\u0645\u062C';
- t['\uFC46'] = '\u0645\u062D';
- t['\uFC47'] = '\u0645\u062E';
- t['\uFC48'] = '\u0645\u0645';
- t['\uFC49'] = '\u0645\u0649';
- t['\uFC4A'] = '\u0645\u064A';
- t['\uFC4B'] = '\u0646\u062C';
- t['\uFC4C'] = '\u0646\u062D';
- t['\uFC4D'] = '\u0646\u062E';
- t['\uFC4E'] = '\u0646\u0645';
- t['\uFC4F'] = '\u0646\u0649';
- t['\uFC50'] = '\u0646\u064A';
- t['\uFC51'] = '\u0647\u062C';
- t['\uFC52'] = '\u0647\u0645';
- t['\uFC53'] = '\u0647\u0649';
- t['\uFC54'] = '\u0647\u064A';
- t['\uFC55'] = '\u064A\u062C';
- t['\uFC56'] = '\u064A\u062D';
- t['\uFC57'] = '\u064A\u062E';
- t['\uFC58'] = '\u064A\u0645';
- t['\uFC59'] = '\u064A\u0649';
- t['\uFC5A'] = '\u064A\u064A';
- t['\uFC5B'] = '\u0630\u0670';
- t['\uFC5C'] = '\u0631\u0670';
- t['\uFC5D'] = '\u0649\u0670';
- t['\uFC5E'] = '\u0020\u064C\u0651';
- t['\uFC5F'] = '\u0020\u064D\u0651';
- t['\uFC60'] = '\u0020\u064E\u0651';
- t['\uFC61'] = '\u0020\u064F\u0651';
- t['\uFC62'] = '\u0020\u0650\u0651';
- t['\uFC63'] = '\u0020\u0651\u0670';
- t['\uFC64'] = '\u0626\u0631';
- t['\uFC65'] = '\u0626\u0632';
- t['\uFC66'] = '\u0626\u0645';
- t['\uFC67'] = '\u0626\u0646';
- t['\uFC68'] = '\u0626\u0649';
- t['\uFC69'] = '\u0626\u064A';
- t['\uFC6A'] = '\u0628\u0631';
- t['\uFC6B'] = '\u0628\u0632';
- t['\uFC6C'] = '\u0628\u0645';
- t['\uFC6D'] = '\u0628\u0646';
- t['\uFC6E'] = '\u0628\u0649';
- t['\uFC6F'] = '\u0628\u064A';
- t['\uFC70'] = '\u062A\u0631';
- t['\uFC71'] = '\u062A\u0632';
- t['\uFC72'] = '\u062A\u0645';
- t['\uFC73'] = '\u062A\u0646';
- t['\uFC74'] = '\u062A\u0649';
- t['\uFC75'] = '\u062A\u064A';
- t['\uFC76'] = '\u062B\u0631';
- t['\uFC77'] = '\u062B\u0632';
- t['\uFC78'] = '\u062B\u0645';
- t['\uFC79'] = '\u062B\u0646';
- t['\uFC7A'] = '\u062B\u0649';
- t['\uFC7B'] = '\u062B\u064A';
- t['\uFC7C'] = '\u0641\u0649';
- t['\uFC7D'] = '\u0641\u064A';
- t['\uFC7E'] = '\u0642\u0649';
- t['\uFC7F'] = '\u0642\u064A';
- t['\uFC80'] = '\u0643\u0627';
- t['\uFC81'] = '\u0643\u0644';
- t['\uFC82'] = '\u0643\u0645';
- t['\uFC83'] = '\u0643\u0649';
- t['\uFC84'] = '\u0643\u064A';
- t['\uFC85'] = '\u0644\u0645';
- t['\uFC86'] = '\u0644\u0649';
- t['\uFC87'] = '\u0644\u064A';
- t['\uFC88'] = '\u0645\u0627';
- t['\uFC89'] = '\u0645\u0645';
- t['\uFC8A'] = '\u0646\u0631';
- t['\uFC8B'] = '\u0646\u0632';
- t['\uFC8C'] = '\u0646\u0645';
- t['\uFC8D'] = '\u0646\u0646';
- t['\uFC8E'] = '\u0646\u0649';
- t['\uFC8F'] = '\u0646\u064A';
- t['\uFC90'] = '\u0649\u0670';
- t['\uFC91'] = '\u064A\u0631';
- t['\uFC92'] = '\u064A\u0632';
- t['\uFC93'] = '\u064A\u0645';
- t['\uFC94'] = '\u064A\u0646';
- t['\uFC95'] = '\u064A\u0649';
- t['\uFC96'] = '\u064A\u064A';
- t['\uFC97'] = '\u0626\u062C';
- t['\uFC98'] = '\u0626\u062D';
- t['\uFC99'] = '\u0626\u062E';
- t['\uFC9A'] = '\u0626\u0645';
- t['\uFC9B'] = '\u0626\u0647';
- t['\uFC9C'] = '\u0628\u062C';
- t['\uFC9D'] = '\u0628\u062D';
- t['\uFC9E'] = '\u0628\u062E';
- t['\uFC9F'] = '\u0628\u0645';
- t['\uFCA0'] = '\u0628\u0647';
- t['\uFCA1'] = '\u062A\u062C';
- t['\uFCA2'] = '\u062A\u062D';
- t['\uFCA3'] = '\u062A\u062E';
- t['\uFCA4'] = '\u062A\u0645';
- t['\uFCA5'] = '\u062A\u0647';
- t['\uFCA6'] = '\u062B\u0645';
- t['\uFCA7'] = '\u062C\u062D';
- t['\uFCA8'] = '\u062C\u0645';
- t['\uFCA9'] = '\u062D\u062C';
- t['\uFCAA'] = '\u062D\u0645';
- t['\uFCAB'] = '\u062E\u062C';
- t['\uFCAC'] = '\u062E\u0645';
- t['\uFCAD'] = '\u0633\u062C';
- t['\uFCAE'] = '\u0633\u062D';
- t['\uFCAF'] = '\u0633\u062E';
- t['\uFCB0'] = '\u0633\u0645';
- t['\uFCB1'] = '\u0635\u062D';
- t['\uFCB2'] = '\u0635\u062E';
- t['\uFCB3'] = '\u0635\u0645';
- t['\uFCB4'] = '\u0636\u062C';
- t['\uFCB5'] = '\u0636\u062D';
- t['\uFCB6'] = '\u0636\u062E';
- t['\uFCB7'] = '\u0636\u0645';
- t['\uFCB8'] = '\u0637\u062D';
- t['\uFCB9'] = '\u0638\u0645';
- t['\uFCBA'] = '\u0639\u062C';
- t['\uFCBB'] = '\u0639\u0645';
- t['\uFCBC'] = '\u063A\u062C';
- t['\uFCBD'] = '\u063A\u0645';
- t['\uFCBE'] = '\u0641\u062C';
- t['\uFCBF'] = '\u0641\u062D';
- t['\uFCC0'] = '\u0641\u062E';
- t['\uFCC1'] = '\u0641\u0645';
- t['\uFCC2'] = '\u0642\u062D';
- t['\uFCC3'] = '\u0642\u0645';
- t['\uFCC4'] = '\u0643\u062C';
- t['\uFCC5'] = '\u0643\u062D';
- t['\uFCC6'] = '\u0643\u062E';
- t['\uFCC7'] = '\u0643\u0644';
- t['\uFCC8'] = '\u0643\u0645';
- t['\uFCC9'] = '\u0644\u062C';
- t['\uFCCA'] = '\u0644\u062D';
- t['\uFCCB'] = '\u0644\u062E';
- t['\uFCCC'] = '\u0644\u0645';
- t['\uFCCD'] = '\u0644\u0647';
- t['\uFCCE'] = '\u0645\u062C';
- t['\uFCCF'] = '\u0645\u062D';
- t['\uFCD0'] = '\u0645\u062E';
- t['\uFCD1'] = '\u0645\u0645';
- t['\uFCD2'] = '\u0646\u062C';
- t['\uFCD3'] = '\u0646\u062D';
- t['\uFCD4'] = '\u0646\u062E';
- t['\uFCD5'] = '\u0646\u0645';
- t['\uFCD6'] = '\u0646\u0647';
- t['\uFCD7'] = '\u0647\u062C';
- t['\uFCD8'] = '\u0647\u0645';
- t['\uFCD9'] = '\u0647\u0670';
- t['\uFCDA'] = '\u064A\u062C';
- t['\uFCDB'] = '\u064A\u062D';
- t['\uFCDC'] = '\u064A\u062E';
- t['\uFCDD'] = '\u064A\u0645';
- t['\uFCDE'] = '\u064A\u0647';
- t['\uFCDF'] = '\u0626\u0645';
- t['\uFCE0'] = '\u0626\u0647';
- t['\uFCE1'] = '\u0628\u0645';
- t['\uFCE2'] = '\u0628\u0647';
- t['\uFCE3'] = '\u062A\u0645';
- t['\uFCE4'] = '\u062A\u0647';
- t['\uFCE5'] = '\u062B\u0645';
- t['\uFCE6'] = '\u062B\u0647';
- t['\uFCE7'] = '\u0633\u0645';
- t['\uFCE8'] = '\u0633\u0647';
- t['\uFCE9'] = '\u0634\u0645';
- t['\uFCEA'] = '\u0634\u0647';
- t['\uFCEB'] = '\u0643\u0644';
- t['\uFCEC'] = '\u0643\u0645';
- t['\uFCED'] = '\u0644\u0645';
- t['\uFCEE'] = '\u0646\u0645';
- t['\uFCEF'] = '\u0646\u0647';
- t['\uFCF0'] = '\u064A\u0645';
- t['\uFCF1'] = '\u064A\u0647';
- t['\uFCF2'] = '\u0640\u064E\u0651';
- t['\uFCF3'] = '\u0640\u064F\u0651';
- t['\uFCF4'] = '\u0640\u0650\u0651';
- t['\uFCF5'] = '\u0637\u0649';
- t['\uFCF6'] = '\u0637\u064A';
- t['\uFCF7'] = '\u0639\u0649';
- t['\uFCF8'] = '\u0639\u064A';
- t['\uFCF9'] = '\u063A\u0649';
- t['\uFCFA'] = '\u063A\u064A';
- t['\uFCFB'] = '\u0633\u0649';
- t['\uFCFC'] = '\u0633\u064A';
- t['\uFCFD'] = '\u0634\u0649';
- t['\uFCFE'] = '\u0634\u064A';
- t['\uFCFF'] = '\u062D\u0649';
- t['\uFD00'] = '\u062D\u064A';
- t['\uFD01'] = '\u062C\u0649';
- t['\uFD02'] = '\u062C\u064A';
- t['\uFD03'] = '\u062E\u0649';
- t['\uFD04'] = '\u062E\u064A';
- t['\uFD05'] = '\u0635\u0649';
- t['\uFD06'] = '\u0635\u064A';
- t['\uFD07'] = '\u0636\u0649';
- t['\uFD08'] = '\u0636\u064A';
- t['\uFD09'] = '\u0634\u062C';
- t['\uFD0A'] = '\u0634\u062D';
- t['\uFD0B'] = '\u0634\u062E';
- t['\uFD0C'] = '\u0634\u0645';
- t['\uFD0D'] = '\u0634\u0631';
- t['\uFD0E'] = '\u0633\u0631';
- t['\uFD0F'] = '\u0635\u0631';
- t['\uFD10'] = '\u0636\u0631';
- t['\uFD11'] = '\u0637\u0649';
- t['\uFD12'] = '\u0637\u064A';
- t['\uFD13'] = '\u0639\u0649';
- t['\uFD14'] = '\u0639\u064A';
- t['\uFD15'] = '\u063A\u0649';
- t['\uFD16'] = '\u063A\u064A';
- t['\uFD17'] = '\u0633\u0649';
- t['\uFD18'] = '\u0633\u064A';
- t['\uFD19'] = '\u0634\u0649';
- t['\uFD1A'] = '\u0634\u064A';
- t['\uFD1B'] = '\u062D\u0649';
- t['\uFD1C'] = '\u062D\u064A';
- t['\uFD1D'] = '\u062C\u0649';
- t['\uFD1E'] = '\u062C\u064A';
- t['\uFD1F'] = '\u062E\u0649';
- t['\uFD20'] = '\u062E\u064A';
- t['\uFD21'] = '\u0635\u0649';
- t['\uFD22'] = '\u0635\u064A';
- t['\uFD23'] = '\u0636\u0649';
- t['\uFD24'] = '\u0636\u064A';
- t['\uFD25'] = '\u0634\u062C';
- t['\uFD26'] = '\u0634\u062D';
- t['\uFD27'] = '\u0634\u062E';
- t['\uFD28'] = '\u0634\u0645';
- t['\uFD29'] = '\u0634\u0631';
- t['\uFD2A'] = '\u0633\u0631';
- t['\uFD2B'] = '\u0635\u0631';
- t['\uFD2C'] = '\u0636\u0631';
- t['\uFD2D'] = '\u0634\u062C';
- t['\uFD2E'] = '\u0634\u062D';
- t['\uFD2F'] = '\u0634\u062E';
- t['\uFD30'] = '\u0634\u0645';
- t['\uFD31'] = '\u0633\u0647';
- t['\uFD32'] = '\u0634\u0647';
- t['\uFD33'] = '\u0637\u0645';
- t['\uFD34'] = '\u0633\u062C';
- t['\uFD35'] = '\u0633\u062D';
- t['\uFD36'] = '\u0633\u062E';
- t['\uFD37'] = '\u0634\u062C';
- t['\uFD38'] = '\u0634\u062D';
- t['\uFD39'] = '\u0634\u062E';
- t['\uFD3A'] = '\u0637\u0645';
- t['\uFD3B'] = '\u0638\u0645';
- t['\uFD3C'] = '\u0627\u064B';
- t['\uFD3D'] = '\u0627\u064B';
- t['\uFD50'] = '\u062A\u062C\u0645';
- t['\uFD51'] = '\u062A\u062D\u062C';
- t['\uFD52'] = '\u062A\u062D\u062C';
- t['\uFD53'] = '\u062A\u062D\u0645';
- t['\uFD54'] = '\u062A\u062E\u0645';
- t['\uFD55'] = '\u062A\u0645\u062C';
- t['\uFD56'] = '\u062A\u0645\u062D';
- t['\uFD57'] = '\u062A\u0645\u062E';
- t['\uFD58'] = '\u062C\u0645\u062D';
- t['\uFD59'] = '\u062C\u0645\u062D';
- t['\uFD5A'] = '\u062D\u0645\u064A';
- t['\uFD5B'] = '\u062D\u0645\u0649';
- t['\uFD5C'] = '\u0633\u062D\u062C';
- t['\uFD5D'] = '\u0633\u062C\u062D';
- t['\uFD5E'] = '\u0633\u062C\u0649';
- t['\uFD5F'] = '\u0633\u0645\u062D';
- t['\uFD60'] = '\u0633\u0645\u062D';
- t['\uFD61'] = '\u0633\u0645\u062C';
- t['\uFD62'] = '\u0633\u0645\u0645';
- t['\uFD63'] = '\u0633\u0645\u0645';
- t['\uFD64'] = '\u0635\u062D\u062D';
- t['\uFD65'] = '\u0635\u062D\u062D';
- t['\uFD66'] = '\u0635\u0645\u0645';
- t['\uFD67'] = '\u0634\u062D\u0645';
- t['\uFD68'] = '\u0634\u062D\u0645';
- t['\uFD69'] = '\u0634\u062C\u064A';
- t['\uFD6A'] = '\u0634\u0645\u062E';
- t['\uFD6B'] = '\u0634\u0645\u062E';
- t['\uFD6C'] = '\u0634\u0645\u0645';
- t['\uFD6D'] = '\u0634\u0645\u0645';
- t['\uFD6E'] = '\u0636\u062D\u0649';
- t['\uFD6F'] = '\u0636\u062E\u0645';
- t['\uFD70'] = '\u0636\u062E\u0645';
- t['\uFD71'] = '\u0637\u0645\u062D';
- t['\uFD72'] = '\u0637\u0645\u062D';
- t['\uFD73'] = '\u0637\u0645\u0645';
- t['\uFD74'] = '\u0637\u0645\u064A';
- t['\uFD75'] = '\u0639\u062C\u0645';
- t['\uFD76'] = '\u0639\u0645\u0645';
- t['\uFD77'] = '\u0639\u0645\u0645';
- t['\uFD78'] = '\u0639\u0645\u0649';
- t['\uFD79'] = '\u063A\u0645\u0645';
- t['\uFD7A'] = '\u063A\u0645\u064A';
- t['\uFD7B'] = '\u063A\u0645\u0649';
- t['\uFD7C'] = '\u0641\u062E\u0645';
- t['\uFD7D'] = '\u0641\u062E\u0645';
- t['\uFD7E'] = '\u0642\u0645\u062D';
- t['\uFD7F'] = '\u0642\u0645\u0645';
- t['\uFD80'] = '\u0644\u062D\u0645';
- t['\uFD81'] = '\u0644\u062D\u064A';
- t['\uFD82'] = '\u0644\u062D\u0649';
- t['\uFD83'] = '\u0644\u062C\u062C';
- t['\uFD84'] = '\u0644\u062C\u062C';
- t['\uFD85'] = '\u0644\u062E\u0645';
- t['\uFD86'] = '\u0644\u062E\u0645';
- t['\uFD87'] = '\u0644\u0645\u062D';
- t['\uFD88'] = '\u0644\u0645\u062D';
- t['\uFD89'] = '\u0645\u062D\u062C';
- t['\uFD8A'] = '\u0645\u062D\u0645';
- t['\uFD8B'] = '\u0645\u062D\u064A';
- t['\uFD8C'] = '\u0645\u062C\u062D';
- t['\uFD8D'] = '\u0645\u062C\u0645';
- t['\uFD8E'] = '\u0645\u062E\u062C';
- t['\uFD8F'] = '\u0645\u062E\u0645';
- t['\uFD92'] = '\u0645\u062C\u062E';
- t['\uFD93'] = '\u0647\u0645\u062C';
- t['\uFD94'] = '\u0647\u0645\u0645';
- t['\uFD95'] = '\u0646\u062D\u0645';
- t['\uFD96'] = '\u0646\u062D\u0649';
- t['\uFD97'] = '\u0646\u062C\u0645';
- t['\uFD98'] = '\u0646\u062C\u0645';
- t['\uFD99'] = '\u0646\u062C\u0649';
- t['\uFD9A'] = '\u0646\u0645\u064A';
- t['\uFD9B'] = '\u0646\u0645\u0649';
- t['\uFD9C'] = '\u064A\u0645\u0645';
- t['\uFD9D'] = '\u064A\u0645\u0645';
- t['\uFD9E'] = '\u0628\u062E\u064A';
- t['\uFD9F'] = '\u062A\u062C\u064A';
- t['\uFDA0'] = '\u062A\u062C\u0649';
- t['\uFDA1'] = '\u062A\u062E\u064A';
- t['\uFDA2'] = '\u062A\u062E\u0649';
- t['\uFDA3'] = '\u062A\u0645\u064A';
- t['\uFDA4'] = '\u062A\u0645\u0649';
- t['\uFDA5'] = '\u062C\u0645\u064A';
- t['\uFDA6'] = '\u062C\u062D\u0649';
- t['\uFDA7'] = '\u062C\u0645\u0649';
- t['\uFDA8'] = '\u0633\u062E\u0649';
- t['\uFDA9'] = '\u0635\u062D\u064A';
- t['\uFDAA'] = '\u0634\u062D\u064A';
- t['\uFDAB'] = '\u0636\u062D\u064A';
- t['\uFDAC'] = '\u0644\u062C\u064A';
- t['\uFDAD'] = '\u0644\u0645\u064A';
- t['\uFDAE'] = '\u064A\u062D\u064A';
- t['\uFDAF'] = '\u064A\u062C\u064A';
- t['\uFDB0'] = '\u064A\u0645\u064A';
- t['\uFDB1'] = '\u0645\u0645\u064A';
- t['\uFDB2'] = '\u0642\u0645\u064A';
- t['\uFDB3'] = '\u0646\u062D\u064A';
- t['\uFDB4'] = '\u0642\u0645\u062D';
- t['\uFDB5'] = '\u0644\u062D\u0645';
- t['\uFDB6'] = '\u0639\u0645\u064A';
- t['\uFDB7'] = '\u0643\u0645\u064A';
- t['\uFDB8'] = '\u0646\u062C\u062D';
- t['\uFDB9'] = '\u0645\u062E\u064A';
- t['\uFDBA'] = '\u0644\u062C\u0645';
- t['\uFDBB'] = '\u0643\u0645\u0645';
- t['\uFDBC'] = '\u0644\u062C\u0645';
- t['\uFDBD'] = '\u0646\u062C\u062D';
- t['\uFDBE'] = '\u062C\u062D\u064A';
- t['\uFDBF'] = '\u062D\u062C\u064A';
- t['\uFDC0'] = '\u0645\u062C\u064A';
- t['\uFDC1'] = '\u0641\u0645\u064A';
- t['\uFDC2'] = '\u0628\u062D\u064A';
- t['\uFDC3'] = '\u0643\u0645\u0645';
- t['\uFDC4'] = '\u0639\u062C\u0645';
- t['\uFDC5'] = '\u0635\u0645\u0645';
- t['\uFDC6'] = '\u0633\u062E\u064A';
- t['\uFDC7'] = '\u0646\u062C\u064A';
- t['\uFE49'] = '\u203E';
- t['\uFE4A'] = '\u203E';
- t['\uFE4B'] = '\u203E';
- t['\uFE4C'] = '\u203E';
- t['\uFE4D'] = '\u005F';
- t['\uFE4E'] = '\u005F';
- t['\uFE4F'] = '\u005F';
- t['\uFE80'] = '\u0621';
- t['\uFE81'] = '\u0622';
- t['\uFE82'] = '\u0622';
- t['\uFE83'] = '\u0623';
- t['\uFE84'] = '\u0623';
- t['\uFE85'] = '\u0624';
- t['\uFE86'] = '\u0624';
- t['\uFE87'] = '\u0625';
- t['\uFE88'] = '\u0625';
- t['\uFE89'] = '\u0626';
- t['\uFE8A'] = '\u0626';
- t['\uFE8B'] = '\u0626';
- t['\uFE8C'] = '\u0626';
- t['\uFE8D'] = '\u0627';
- t['\uFE8E'] = '\u0627';
- t['\uFE8F'] = '\u0628';
- t['\uFE90'] = '\u0628';
- t['\uFE91'] = '\u0628';
- t['\uFE92'] = '\u0628';
- t['\uFE93'] = '\u0629';
- t['\uFE94'] = '\u0629';
- t['\uFE95'] = '\u062A';
- t['\uFE96'] = '\u062A';
- t['\uFE97'] = '\u062A';
- t['\uFE98'] = '\u062A';
- t['\uFE99'] = '\u062B';
- t['\uFE9A'] = '\u062B';
- t['\uFE9B'] = '\u062B';
- t['\uFE9C'] = '\u062B';
- t['\uFE9D'] = '\u062C';
- t['\uFE9E'] = '\u062C';
- t['\uFE9F'] = '\u062C';
- t['\uFEA0'] = '\u062C';
- t['\uFEA1'] = '\u062D';
- t['\uFEA2'] = '\u062D';
- t['\uFEA3'] = '\u062D';
- t['\uFEA4'] = '\u062D';
- t['\uFEA5'] = '\u062E';
- t['\uFEA6'] = '\u062E';
- t['\uFEA7'] = '\u062E';
- t['\uFEA8'] = '\u062E';
- t['\uFEA9'] = '\u062F';
- t['\uFEAA'] = '\u062F';
- t['\uFEAB'] = '\u0630';
- t['\uFEAC'] = '\u0630';
- t['\uFEAD'] = '\u0631';
- t['\uFEAE'] = '\u0631';
- t['\uFEAF'] = '\u0632';
- t['\uFEB0'] = '\u0632';
- t['\uFEB1'] = '\u0633';
- t['\uFEB2'] = '\u0633';
- t['\uFEB3'] = '\u0633';
- t['\uFEB4'] = '\u0633';
- t['\uFEB5'] = '\u0634';
- t['\uFEB6'] = '\u0634';
- t['\uFEB7'] = '\u0634';
- t['\uFEB8'] = '\u0634';
- t['\uFEB9'] = '\u0635';
- t['\uFEBA'] = '\u0635';
- t['\uFEBB'] = '\u0635';
- t['\uFEBC'] = '\u0635';
- t['\uFEBD'] = '\u0636';
- t['\uFEBE'] = '\u0636';
- t['\uFEBF'] = '\u0636';
- t['\uFEC0'] = '\u0636';
- t['\uFEC1'] = '\u0637';
- t['\uFEC2'] = '\u0637';
- t['\uFEC3'] = '\u0637';
- t['\uFEC4'] = '\u0637';
- t['\uFEC5'] = '\u0638';
- t['\uFEC6'] = '\u0638';
- t['\uFEC7'] = '\u0638';
- t['\uFEC8'] = '\u0638';
- t['\uFEC9'] = '\u0639';
- t['\uFECA'] = '\u0639';
- t['\uFECB'] = '\u0639';
- t['\uFECC'] = '\u0639';
- t['\uFECD'] = '\u063A';
- t['\uFECE'] = '\u063A';
- t['\uFECF'] = '\u063A';
- t['\uFED0'] = '\u063A';
- t['\uFED1'] = '\u0641';
- t['\uFED2'] = '\u0641';
- t['\uFED3'] = '\u0641';
- t['\uFED4'] = '\u0641';
- t['\uFED5'] = '\u0642';
- t['\uFED6'] = '\u0642';
- t['\uFED7'] = '\u0642';
- t['\uFED8'] = '\u0642';
- t['\uFED9'] = '\u0643';
- t['\uFEDA'] = '\u0643';
- t['\uFEDB'] = '\u0643';
- t['\uFEDC'] = '\u0643';
- t['\uFEDD'] = '\u0644';
- t['\uFEDE'] = '\u0644';
- t['\uFEDF'] = '\u0644';
- t['\uFEE0'] = '\u0644';
- t['\uFEE1'] = '\u0645';
- t['\uFEE2'] = '\u0645';
- t['\uFEE3'] = '\u0645';
- t['\uFEE4'] = '\u0645';
- t['\uFEE5'] = '\u0646';
- t['\uFEE6'] = '\u0646';
- t['\uFEE7'] = '\u0646';
- t['\uFEE8'] = '\u0646';
- t['\uFEE9'] = '\u0647';
- t['\uFEEA'] = '\u0647';
- t['\uFEEB'] = '\u0647';
- t['\uFEEC'] = '\u0647';
- t['\uFEED'] = '\u0648';
- t['\uFEEE'] = '\u0648';
- t['\uFEEF'] = '\u0649';
- t['\uFEF0'] = '\u0649';
- t['\uFEF1'] = '\u064A';
- t['\uFEF2'] = '\u064A';
- t['\uFEF3'] = '\u064A';
- t['\uFEF4'] = '\u064A';
- t['\uFEF5'] = '\u0644\u0622';
- t['\uFEF6'] = '\u0644\u0622';
- t['\uFEF7'] = '\u0644\u0623';
- t['\uFEF8'] = '\u0644\u0623';
- t['\uFEF9'] = '\u0644\u0625';
- t['\uFEFA'] = '\u0644\u0625';
- t['\uFEFB'] = '\u0644\u0627';
- t['\uFEFC'] = '\u0644\u0627';
-});
-function reverseIfRtl(chars) {
- var charsLength = chars.length;
- if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
- return chars;
- }
- var s = '';
- for (var ii = charsLength - 1; ii >= 0; ii--) {
- s += chars[ii];
- }
- return s;
-}
-exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues;
-exports.reverseIfRtl = reverseIfRtl;
-exports.getUnicodeRangeFor = getUnicodeRangeFor;
-exports.getNormalizedUnicodes = getNormalizedUnicodes;
-exports.getUnicodeForGlyph = getUnicodeForGlyph;
-
-/***/ }),
-/* 163 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.FontRendererFactory = undefined;
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _util = __w_pdfjs_require__(2);
-
-var _cff_parser = __w_pdfjs_require__(157);
-
-var _glyphlist = __w_pdfjs_require__(160);
-
-var _encodings = __w_pdfjs_require__(159);
-
-var _stream = __w_pdfjs_require__(140);
-
-function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
-
-function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var FontRendererFactory = function FontRendererFactoryClosure() {
- function getLong(data, offset) {
- return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
- }
- function getUshort(data, offset) {
- return data[offset] << 8 | data[offset + 1];
- }
- function parseCmap(data, start, end) {
- var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
- var format = getUshort(data, start + offset);
- var ranges, p, i;
- if (format === 4) {
- getUshort(data, start + offset + 2);
- var segCount = getUshort(data, start + offset + 6) >> 1;
- p = start + offset + 14;
- ranges = [];
- for (i = 0; i < segCount; i++, p += 2) {
- ranges[i] = { end: getUshort(data, p) };
- }
- p += 2;
- for (i = 0; i < segCount; i++, p += 2) {
- ranges[i].start = getUshort(data, p);
- }
- for (i = 0; i < segCount; i++, p += 2) {
- ranges[i].idDelta = getUshort(data, p);
- }
- for (i = 0; i < segCount; i++, p += 2) {
- var idOffset = getUshort(data, p);
- if (idOffset === 0) {
- continue;
- }
- ranges[i].ids = [];
- for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
- ranges[i].ids[j] = getUshort(data, p + idOffset);
- idOffset += 2;
- }
- }
- return ranges;
- } else if (format === 12) {
- getLong(data, start + offset + 4);
- var groups = getLong(data, start + offset + 12);
- p = start + offset + 16;
- ranges = [];
- for (i = 0; i < groups; i++) {
- ranges.push({
- start: getLong(data, p),
- end: getLong(data, p + 4),
- idDelta: getLong(data, p + 8) - getLong(data, p)
- });
- p += 12;
- }
- return ranges;
- }
- throw new _util.FormatError('unsupported cmap: ' + format);
- }
- function parseCff(data, start, end, seacAnalysisEnabled) {
- var properties = {};
- var parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
- var cff = parser.parse();
- return {
- glyphs: cff.charStrings.objects,
- subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
- gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
- isCFFCIDFont: cff.isCIDFont,
- fdSelect: cff.fdSelect,
- fdArray: cff.fdArray
- };
- }
- function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
- var itemSize, itemDecode;
- if (isGlyphLocationsLong) {
- itemSize = 4;
- itemDecode = function fontItemDecodeLong(data, offset) {
- return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
- };
- } else {
- itemSize = 2;
- itemDecode = function fontItemDecode(data, offset) {
- return data[offset] << 9 | data[offset + 1] << 1;
- };
- }
- var glyphs = [];
- var startOffset = itemDecode(loca, 0);
- for (var j = itemSize; j < loca.length; j += itemSize) {
- var endOffset = itemDecode(loca, j);
- glyphs.push(glyf.subarray(startOffset, endOffset));
- startOffset = endOffset;
- }
- return glyphs;
- }
- function lookupCmap(ranges, unicode) {
- var code = unicode.codePointAt(0),
- gid = 0;
- var l = 0,
- r = ranges.length - 1;
- while (l < r) {
- var c = l + r + 1 >> 1;
- if (code < ranges[c].start) {
- r = c - 1;
- } else {
- l = c;
- }
- }
- if (ranges[l].start <= code && code <= ranges[l].end) {
- gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xFFFF;
- }
- return {
- charCode: code,
- glyphId: gid
- };
- }
- function compileGlyf(code, cmds, font) {
- function moveTo(x, y) {
- cmds.push({
- cmd: 'moveTo',
- args: [x, y]
- });
- }
- function lineTo(x, y) {
- cmds.push({
- cmd: 'lineTo',
- args: [x, y]
- });
- }
- function quadraticCurveTo(xa, ya, x, y) {
- cmds.push({
- cmd: 'quadraticCurveTo',
- args: [xa, ya, x, y]
- });
- }
- var i = 0;
- var numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
- var flags;
- var x = 0,
- y = 0;
- i += 10;
- if (numberOfContours < 0) {
- do {
- flags = code[i] << 8 | code[i + 1];
- var glyphIndex = code[i + 2] << 8 | code[i + 3];
- i += 4;
- var arg1, arg2;
- if (flags & 0x01) {
- arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
- arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
- i += 4;
- } else {
- arg1 = code[i++];
- arg2 = code[i++];
- }
- if (flags & 0x02) {
- x = arg1;
- y = arg2;
- } else {
- x = 0;
- y = 0;
- }
- var scaleX = 1,
- scaleY = 1,
- scale01 = 0,
- scale10 = 0;
- if (flags & 0x08) {
- scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
- i += 2;
- } else if (flags & 0x40) {
- scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
- scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
- i += 4;
- } else if (flags & 0x80) {
- scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
- scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
- scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
- scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
- i += 8;
- }
- var subglyph = font.glyphs[glyphIndex];
- if (subglyph) {
- cmds.push({ cmd: 'save' });
- cmds.push({
- cmd: 'transform',
- args: [scaleX, scale01, scale10, scaleY, x, y]
- });
- compileGlyf(subglyph, cmds, font);
- cmds.push({ cmd: 'restore' });
- }
- } while (flags & 0x20);
- } else {
- var endPtsOfContours = [];
- var j, jj;
- for (j = 0; j < numberOfContours; j++) {
- endPtsOfContours.push(code[i] << 8 | code[i + 1]);
- i += 2;
- }
- var instructionLength = code[i] << 8 | code[i + 1];
- i += 2 + instructionLength;
- var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
- var points = [];
- while (points.length < numberOfPoints) {
- flags = code[i++];
- var repeat = 1;
- if (flags & 0x08) {
- repeat += code[i++];
- }
- while (repeat-- > 0) {
- points.push({ flags: flags });
- }
- }
- for (j = 0; j < numberOfPoints; j++) {
- switch (points[j].flags & 0x12) {
- case 0x00:
- x += (code[i] << 24 | code[i + 1] << 16) >> 16;
- i += 2;
- break;
- case 0x02:
- x -= code[i++];
- break;
- case 0x12:
- x += code[i++];
- break;
- }
- points[j].x = x;
- }
- for (j = 0; j < numberOfPoints; j++) {
- switch (points[j].flags & 0x24) {
- case 0x00:
- y += (code[i] << 24 | code[i + 1] << 16) >> 16;
- i += 2;
- break;
- case 0x04:
- y -= code[i++];
- break;
- case 0x24:
- y += code[i++];
- break;
- }
- points[j].y = y;
- }
- var startPoint = 0;
- for (i = 0; i < numberOfContours; i++) {
- var endPoint = endPtsOfContours[i];
- var contour = points.slice(startPoint, endPoint + 1);
- if (contour[0].flags & 1) {
- contour.push(contour[0]);
- } else if (contour[contour.length - 1].flags & 1) {
- contour.unshift(contour[contour.length - 1]);
- } else {
- var p = {
- flags: 1,
- x: (contour[0].x + contour[contour.length - 1].x) / 2,
- y: (contour[0].y + contour[contour.length - 1].y) / 2
- };
- contour.unshift(p);
- contour.push(p);
- }
- moveTo(contour[0].x, contour[0].y);
- for (j = 1, jj = contour.length; j < jj; j++) {
- if (contour[j].flags & 1) {
- lineTo(contour[j].x, contour[j].y);
- } else if (contour[j + 1].flags & 1) {
- quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
- j++;
- } else {
- quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
- }
- }
- startPoint = endPoint + 1;
- }
- }
- }
- function compileCharString(code, cmds, font, glyphId) {
- var stack = [];
- var x = 0,
- y = 0;
- var stems = 0;
- function moveTo(x, y) {
- cmds.push({
- cmd: 'moveTo',
- args: [x, y]
- });
- }
- function lineTo(x, y) {
- cmds.push({
- cmd: 'lineTo',
- args: [x, y]
- });
- }
- function bezierCurveTo(x1, y1, x2, y2, x, y) {
- cmds.push({
- cmd: 'bezierCurveTo',
- args: [x1, y1, x2, y2, x, y]
- });
- }
- function parse(code) {
- var i = 0;
- while (i < code.length) {
- var stackClean = false;
- var v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
- switch (v) {
- case 1:
- stems += stack.length >> 1;
- stackClean = true;
- break;
- case 3:
- stems += stack.length >> 1;
- stackClean = true;
- break;
- case 4:
- y += stack.pop();
- moveTo(x, y);
- stackClean = true;
- break;
- case 5:
- while (stack.length > 0) {
- x += stack.shift();
- y += stack.shift();
- lineTo(x, y);
- }
- break;
- case 6:
- while (stack.length > 0) {
- x += stack.shift();
- lineTo(x, y);
- if (stack.length === 0) {
- break;
- }
- y += stack.shift();
- lineTo(x, y);
- }
- break;
- case 7:
- while (stack.length > 0) {
- y += stack.shift();
- lineTo(x, y);
- if (stack.length === 0) {
- break;
- }
- x += stack.shift();
- lineTo(x, y);
- }
- break;
- case 8:
- while (stack.length > 0) {
- xa = x + stack.shift();
- ya = y + stack.shift();
- xb = xa + stack.shift();
- yb = ya + stack.shift();
- x = xb + stack.shift();
- y = yb + stack.shift();
- bezierCurveTo(xa, ya, xb, yb, x, y);
- }
- break;
- case 10:
- n = stack.pop();
- subrCode = null;
- if (font.isCFFCIDFont) {
- var fdIndex = font.fdSelect.getFDIndex(glyphId);
- if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
- var fontDict = font.fdArray[fdIndex],
- subrs = void 0;
- if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
- subrs = fontDict.privateDict.subrsIndex.objects;
- }
- if (subrs) {
- var numSubrs = subrs.length;
- n += numSubrs < 1240 ? 107 : numSubrs < 33900 ? 1131 : 32768;
- subrCode = subrs[n];
- }
- } else {
- (0, _util.warn)('Invalid fd index for glyph index.');
- }
- } else {
- subrCode = font.subrs[n + font.subrsBias];
- }
- if (subrCode) {
- parse(subrCode);
- }
- break;
- case 11:
- return;
- case 12:
- v = code[i++];
- switch (v) {
- case 34:
- xa = x + stack.shift();
- xb = xa + stack.shift();
- y1 = y + stack.shift();
- x = xb + stack.shift();
- bezierCurveTo(xa, y, xb, y1, x, y1);
- xa = x + stack.shift();
- xb = xa + stack.shift();
- x = xb + stack.shift();
- bezierCurveTo(xa, y1, xb, y, x, y);
- break;
- case 35:
- xa = x + stack.shift();
- ya = y + stack.shift();
- xb = xa + stack.shift();
- yb = ya + stack.shift();
- x = xb + stack.shift();
- y = yb + stack.shift();
- bezierCurveTo(xa, ya, xb, yb, x, y);
- xa = x + stack.shift();
- ya = y + stack.shift();
- xb = xa + stack.shift();
- yb = ya + stack.shift();
- x = xb + stack.shift();
- y = yb + stack.shift();
- bezierCurveTo(xa, ya, xb, yb, x, y);
- stack.pop();
- break;
- case 36:
- xa = x + stack.shift();
- y1 = y + stack.shift();
- xb = xa + stack.shift();
- y2 = y1 + stack.shift();
- x = xb + stack.shift();
- bezierCurveTo(xa, y1, xb, y2, x, y2);
- xa = x + stack.shift();
- xb = xa + stack.shift();
- y3 = y2 + stack.shift();
- x = xb + stack.shift();
- bezierCurveTo(xa, y2, xb, y3, x, y);
- break;
- case 37:
- var x0 = x,
- y0 = y;
- xa = x + stack.shift();
- ya = y + stack.shift();
- xb = xa + stack.shift();
- yb = ya + stack.shift();
- x = xb + stack.shift();
- y = yb + stack.shift();
- bezierCurveTo(xa, ya, xb, yb, x, y);
- xa = x + stack.shift();
- ya = y + stack.shift();
- xb = xa + stack.shift();
- yb = ya + stack.shift();
- x = xb;
- y = yb;
- if (Math.abs(x - x0) > Math.abs(y - y0)) {
- x += stack.shift();
- } else {
- y += stack.shift();
- }
- bezierCurveTo(xa, ya, xb, yb, x, y);
- break;
- default:
- throw new _util.FormatError('unknown operator: 12 ' + v);
- }
- break;
- case 14:
- if (stack.length >= 4) {
- var achar = stack.pop();
- var bchar = stack.pop();
- y = stack.pop();
- x = stack.pop();
- cmds.push({ cmd: 'save' });
- cmds.push({
- cmd: 'translate',
- args: [x, y]
- });
- var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
- compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
- cmds.push({ cmd: 'restore' });
- cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
- compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
- }
- return;
- case 18:
- stems += stack.length >> 1;
- stackClean = true;
- break;
- case 19:
- stems += stack.length >> 1;
- i += stems + 7 >> 3;
- stackClean = true;
- break;
- case 20:
- stems += stack.length >> 1;
- i += stems + 7 >> 3;
- stackClean = true;
- break;
- case 21:
- y += stack.pop();
- x += stack.pop();
- moveTo(x, y);
- stackClean = true;
- break;
- case 22:
- x += stack.pop();
- moveTo(x, y);
- stackClean = true;
- break;
- case 23:
- stems += stack.length >> 1;
- stackClean = true;
- break;
- case 24:
- while (stack.length > 2) {
- xa = x + stack.shift();
- ya = y + stack.shift();
- xb = xa + stack.shift();
- yb = ya + stack.shift();
- x = xb + stack.shift();
- y = yb + stack.shift();
- bezierCurveTo(xa, ya, xb, yb, x, y);
- }
- x += stack.shift();
- y += stack.shift();
- lineTo(x, y);
- break;
- case 25:
- while (stack.length > 6) {
- x += stack.shift();
- y += stack.shift();
- lineTo(x, y);
- }
- xa = x + stack.shift();
- ya = y + stack.shift();
- xb = xa + stack.shift();
- yb = ya + stack.shift();
- x = xb + stack.shift();
- y = yb + stack.shift();
- bezierCurveTo(xa, ya, xb, yb, x, y);
- break;
- case 26:
- if (stack.length % 2) {
- x += stack.shift();
- }
- while (stack.length > 0) {
- xa = x;
- ya = y + stack.shift();
- xb = xa + stack.shift();
- yb = ya + stack.shift();
- x = xb;
- y = yb + stack.shift();
- bezierCurveTo(xa, ya, xb, yb, x, y);
- }
- break;
- case 27:
- if (stack.length % 2) {
- y += stack.shift();
- }
- while (stack.length > 0) {
- xa = x + stack.shift();
- ya = y;
- xb = xa + stack.shift();
- yb = ya + stack.shift();
- x = xb + stack.shift();
- y = yb;
- bezierCurveTo(xa, ya, xb, yb, x, y);
- }
- break;
- case 28:
- stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
- i += 2;
- break;
- case 29:
- n = stack.pop() + font.gsubrsBias;
- subrCode = font.gsubrs[n];
- if (subrCode) {
- parse(subrCode);
- }
- break;
- case 30:
- while (stack.length > 0) {
- xa = x;
- ya = y + stack.shift();
- xb = xa + stack.shift();
- yb = ya + stack.shift();
- x = xb + stack.shift();
- y = yb + (stack.length === 1 ? stack.shift() : 0);
- bezierCurveTo(xa, ya, xb, yb, x, y);
- if (stack.length === 0) {
- break;
- }
- xa = x + stack.shift();
- ya = y;
- xb = xa + stack.shift();
- yb = ya + stack.shift();
- y = yb + stack.shift();
- x = xb + (stack.length === 1 ? stack.shift() : 0);
- bezierCurveTo(xa, ya, xb, yb, x, y);
- }
- break;
- case 31:
- while (stack.length > 0) {
- xa = x + stack.shift();
- ya = y;
- xb = xa + stack.shift();
- yb = ya + stack.shift();
- y = yb + stack.shift();
- x = xb + (stack.length === 1 ? stack.shift() : 0);
- bezierCurveTo(xa, ya, xb, yb, x, y);
- if (stack.length === 0) {
- break;
- }
- xa = x;
- ya = y + stack.shift();
- xb = xa + stack.shift();
- yb = ya + stack.shift();
- x = xb + stack.shift();
- y = yb + (stack.length === 1 ? stack.shift() : 0);
- bezierCurveTo(xa, ya, xb, yb, x, y);
- }
- break;
- default:
- if (v < 32) {
- throw new _util.FormatError('unknown operator: ' + v);
- }
- if (v < 247) {
- stack.push(v - 139);
- } else if (v < 251) {
- stack.push((v - 247) * 256 + code[i++] + 108);
- } else if (v < 255) {
- stack.push(-(v - 251) * 256 - code[i++] - 108);
- } else {
- stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
- i += 4;
- }
- break;
- }
- if (stackClean) {
- stack.length = 0;
- }
- }
- }
- parse(code);
- }
- var NOOP = [];
-
- var CompiledFont = function () {
- function CompiledFont(fontMatrix) {
- _classCallCheck(this, CompiledFont);
-
- if (this.constructor === CompiledFont) {
- (0, _util.unreachable)('Cannot initialize CompiledFont.');
- }
- this.fontMatrix = fontMatrix;
- this.compiledGlyphs = Object.create(null);
- this.compiledCharCodeToGlyphId = Object.create(null);
- }
-
- _createClass(CompiledFont, [{
- key: 'getPathJs',
- value: function getPathJs(unicode) {
- var cmap = lookupCmap(this.cmap, unicode);
- var fn = this.compiledGlyphs[cmap.glyphId];
- if (!fn) {
- fn = this.compileGlyph(this.glyphs[cmap.glyphId], cmap.glyphId);
- this.compiledGlyphs[cmap.glyphId] = fn;
- }
- if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
- this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
- }
- return fn;
- }
- }, {
- key: 'compileGlyph',
- value: function compileGlyph(code, glyphId) {
- if (!code || code.length === 0 || code[0] === 14) {
- return NOOP;
- }
- var fontMatrix = this.fontMatrix;
- if (this.isCFFCIDFont) {
- var fdIndex = this.fdSelect.getFDIndex(glyphId);
- if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
- var fontDict = this.fdArray[fdIndex];
- fontMatrix = fontDict.getByName('FontMatrix') || _util.FONT_IDENTITY_MATRIX;
- } else {
- (0, _util.warn)('Invalid fd index for glyph index.');
- }
- }
- var cmds = [];
- cmds.push({ cmd: 'save' });
- cmds.push({
- cmd: 'transform',
- args: fontMatrix.slice()
- });
- cmds.push({
- cmd: 'scale',
- args: ['size', '-size']
- });
- this.compileGlyphImpl(code, cmds, glyphId);
- cmds.push({ cmd: 'restore' });
- return cmds;
- }
- }, {
- key: 'compileGlyphImpl',
- value: function compileGlyphImpl() {
- (0, _util.unreachable)('Children classes should implement this.');
- }
- }, {
- key: 'hasBuiltPath',
- value: function hasBuiltPath(unicode) {
- var cmap = lookupCmap(this.cmap, unicode);
- return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
- }
- }]);
-
- return CompiledFont;
- }();
-
- var TrueTypeCompiled = function (_CompiledFont) {
- _inherits(TrueTypeCompiled, _CompiledFont);
-
- function TrueTypeCompiled(glyphs, cmap, fontMatrix) {
- _classCallCheck(this, TrueTypeCompiled);
-
- var _this = _possibleConstructorReturn(this, (TrueTypeCompiled.__proto__ || Object.getPrototypeOf(TrueTypeCompiled)).call(this, fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]));
-
- _this.glyphs = glyphs;
- _this.cmap = cmap;
- return _this;
- }
-
- _createClass(TrueTypeCompiled, [{
- key: 'compileGlyphImpl',
- value: function compileGlyphImpl(code, cmds) {
- compileGlyf(code, cmds, this);
- }
- }]);
-
- return TrueTypeCompiled;
- }(CompiledFont);
-
- var Type2Compiled = function (_CompiledFont2) {
- _inherits(Type2Compiled, _CompiledFont2);
-
- function Type2Compiled(cffInfo, cmap, fontMatrix, glyphNameMap) {
- _classCallCheck(this, Type2Compiled);
-
- var _this2 = _possibleConstructorReturn(this, (Type2Compiled.__proto__ || Object.getPrototypeOf(Type2Compiled)).call(this, fontMatrix || [0.001, 0, 0, 0.001, 0, 0]));
-
- _this2.glyphs = cffInfo.glyphs;
- _this2.gsubrs = cffInfo.gsubrs || [];
- _this2.subrs = cffInfo.subrs || [];
- _this2.cmap = cmap;
- _this2.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
- _this2.gsubrsBias = _this2.gsubrs.length < 1240 ? 107 : _this2.gsubrs.length < 33900 ? 1131 : 32768;
- _this2.subrsBias = _this2.subrs.length < 1240 ? 107 : _this2.subrs.length < 33900 ? 1131 : 32768;
- _this2.isCFFCIDFont = cffInfo.isCFFCIDFont;
- _this2.fdSelect = cffInfo.fdSelect;
- _this2.fdArray = cffInfo.fdArray;
- return _this2;
- }
-
- _createClass(Type2Compiled, [{
- key: 'compileGlyphImpl',
- value: function compileGlyphImpl(code, cmds, glyphId) {
- compileCharString(code, cmds, this, glyphId);
- }
- }]);
-
- return Type2Compiled;
- }(CompiledFont);
-
- return {
- create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
- var data = new Uint8Array(font.data);
- var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
- var numTables = getUshort(data, 4);
- for (var i = 0, p = 12; i < numTables; i++, p += 16) {
- var tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
- var offset = getLong(data, p + 8);
- var length = getLong(data, p + 12);
- switch (tag) {
- case 'cmap':
- cmap = parseCmap(data, offset, offset + length);
- break;
- case 'glyf':
- glyf = data.subarray(offset, offset + length);
- break;
- case 'loca':
- loca = data.subarray(offset, offset + length);
- break;
- case 'head':
- unitsPerEm = getUshort(data, offset + 18);
- indexToLocFormat = getUshort(data, offset + 50);
- break;
- case 'CFF ':
- cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
- break;
- }
- }
- if (glyf) {
- var fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
- return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
- }
- return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
- }
- };
-}();
-exports.FontRendererFactory = FontRendererFactory;
-
-/***/ }),
-/* 164 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.Type1Parser = undefined;
-
-var _util = __w_pdfjs_require__(2);
-
-var _encodings = __w_pdfjs_require__(159);
-
-var _stream = __w_pdfjs_require__(140);
-
-var HINTING_ENABLED = false;
-var Type1CharString = function Type1CharStringClosure() {
- var COMMAND_MAP = {
- 'hstem': [1],
- 'vstem': [3],
- 'vmoveto': [4],
- 'rlineto': [5],
- 'hlineto': [6],
- 'vlineto': [7],
- 'rrcurveto': [8],
- 'callsubr': [10],
- 'flex': [12, 35],
- 'drop': [12, 18],
- 'endchar': [14],
- 'rmoveto': [21],
- 'hmoveto': [22],
- 'vhcurveto': [30],
- 'hvcurveto': [31]
- };
- function Type1CharString() {
- this.width = 0;
- this.lsb = 0;
- this.flexing = false;
- this.output = [];
- this.stack = [];
- }
- Type1CharString.prototype = {
- convert: function Type1CharString_convert(encoded, subrs, seacAnalysisEnabled) {
- var count = encoded.length;
- var error = false;
- var wx, sbx, subrNumber;
- for (var i = 0; i < count; i++) {
- var value = encoded[i];
- if (value < 32) {
- if (value === 12) {
- value = (value << 8) + encoded[++i];
- }
- switch (value) {
- case 1:
- if (!HINTING_ENABLED) {
- this.stack = [];
- break;
- }
- error = this.executeCommand(2, COMMAND_MAP.hstem);
- break;
- case 3:
- if (!HINTING_ENABLED) {
- this.stack = [];
- break;
- }
- error = this.executeCommand(2, COMMAND_MAP.vstem);
- break;
- case 4:
- if (this.flexing) {
- if (this.stack.length < 1) {
- error = true;
- break;
- }
- var dy = this.stack.pop();
- this.stack.push(0, dy);
- break;
- }
- error = this.executeCommand(1, COMMAND_MAP.vmoveto);
- break;
- case 5:
- error = this.executeCommand(2, COMMAND_MAP.rlineto);
- break;
- case 6:
- error = this.executeCommand(1, COMMAND_MAP.hlineto);
- break;
- case 7:
- error = this.executeCommand(1, COMMAND_MAP.vlineto);
- break;
- case 8:
- error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
- break;
- case 9:
- this.stack = [];
- break;
- case 10:
- if (this.stack.length < 1) {
- error = true;
- break;
- }
- subrNumber = this.stack.pop();
- if (!subrs[subrNumber]) {
- error = true;
- break;
- }
- error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
- break;
- case 11:
- return error;
- case 13:
- if (this.stack.length < 2) {
- error = true;
- break;
- }
- wx = this.stack.pop();
- sbx = this.stack.pop();
- this.lsb = sbx;
- this.width = wx;
- this.stack.push(wx, sbx);
- error = this.executeCommand(2, COMMAND_MAP.hmoveto);
- break;
- case 14:
- this.output.push(COMMAND_MAP.endchar[0]);
- break;
- case 21:
- if (this.flexing) {
- break;
- }
- error = this.executeCommand(2, COMMAND_MAP.rmoveto);
- break;
- case 22:
- if (this.flexing) {
- this.stack.push(0);
- break;
- }
- error = this.executeCommand(1, COMMAND_MAP.hmoveto);
- break;
- case 30:
- error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
- break;
- case 31:
- error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
- break;
- case (12 << 8) + 0:
- this.stack = [];
- break;
- case (12 << 8) + 1:
- if (!HINTING_ENABLED) {
- this.stack = [];
- break;
- }
- error = this.executeCommand(2, COMMAND_MAP.vstem);
- break;
- case (12 << 8) + 2:
- if (!HINTING_ENABLED) {
- this.stack = [];
- break;
- }
- error = this.executeCommand(2, COMMAND_MAP.hstem);
- break;
- case (12 << 8) + 6:
- if (seacAnalysisEnabled) {
- this.seac = this.stack.splice(-4, 4);
- error = this.executeCommand(0, COMMAND_MAP.endchar);
- } else {
- error = this.executeCommand(4, COMMAND_MAP.endchar);
- }
- break;
- case (12 << 8) + 7:
- if (this.stack.length < 4) {
- error = true;
- break;
- }
- this.stack.pop();
- wx = this.stack.pop();
- var sby = this.stack.pop();
- sbx = this.stack.pop();
- this.lsb = sbx;
- this.width = wx;
- this.stack.push(wx, sbx, sby);
- error = this.executeCommand(3, COMMAND_MAP.rmoveto);
- break;
- case (12 << 8) + 12:
- if (this.stack.length < 2) {
- error = true;
- break;
- }
- var num2 = this.stack.pop();
- var num1 = this.stack.pop();
- this.stack.push(num1 / num2);
- break;
- case (12 << 8) + 16:
- if (this.stack.length < 2) {
- error = true;
- break;
- }
- subrNumber = this.stack.pop();
- var numArgs = this.stack.pop();
- if (subrNumber === 0 && numArgs === 3) {
- var flexArgs = this.stack.splice(this.stack.length - 17, 17);
- this.stack.push(flexArgs[2] + flexArgs[0], flexArgs[3] + flexArgs[1], flexArgs[4], flexArgs[5], flexArgs[6], flexArgs[7], flexArgs[8], flexArgs[9], flexArgs[10], flexArgs[11], flexArgs[12], flexArgs[13], flexArgs[14]);
- error = this.executeCommand(13, COMMAND_MAP.flex, true);
- this.flexing = false;
- this.stack.push(flexArgs[15], flexArgs[16]);
- } else if (subrNumber === 1 && numArgs === 0) {
- this.flexing = true;
- }
- break;
- case (12 << 8) + 17:
- break;
- case (12 << 8) + 33:
- this.stack = [];
- break;
- default:
- (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
- break;
- }
- if (error) {
- break;
- }
- continue;
- } else if (value <= 246) {
- value = value - 139;
- } else if (value <= 250) {
- value = (value - 247) * 256 + encoded[++i] + 108;
- } else if (value <= 254) {
- value = -((value - 251) * 256) - encoded[++i] - 108;
- } else {
- value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
- }
- this.stack.push(value);
- }
- return error;
- },
- executeCommand: function executeCommand(howManyArgs, command, keepStack) {
- var stackLength = this.stack.length;
- if (howManyArgs > stackLength) {
- return true;
- }
- var start = stackLength - howManyArgs;
- for (var i = start; i < stackLength; i++) {
- var value = this.stack[i];
- if (Number.isInteger(value)) {
- this.output.push(28, value >> 8 & 0xff, value & 0xff);
- } else {
- value = 65536 * value | 0;
- this.output.push(255, value >> 24 & 0xFF, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF);
- }
- }
- this.output.push.apply(this.output, command);
- if (keepStack) {
- this.stack.splice(start, howManyArgs);
- } else {
- this.stack.length = 0;
- }
- return false;
- }
- };
- return Type1CharString;
-}();
-var Type1Parser = function Type1ParserClosure() {
- var EEXEC_ENCRYPT_KEY = 55665;
- var CHAR_STRS_ENCRYPT_KEY = 4330;
- function isHexDigit(code) {
- return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
- }
- function decrypt(data, key, discardNumber) {
- if (discardNumber >= data.length) {
- return new Uint8Array(0);
- }
- var r = key | 0,
- c1 = 52845,
- c2 = 22719,
- i,
- j;
- for (i = 0; i < discardNumber; i++) {
- r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
- }
- var count = data.length - discardNumber;
- var decrypted = new Uint8Array(count);
- for (i = discardNumber, j = 0; j < count; i++, j++) {
- var value = data[i];
- decrypted[j] = value ^ r >> 8;
- r = (value + r) * c1 + c2 & (1 << 16) - 1;
- }
- return decrypted;
- }
- function decryptAscii(data, key, discardNumber) {
- var r = key | 0,
- c1 = 52845,
- c2 = 22719;
- var count = data.length,
- maybeLength = count >>> 1;
- var decrypted = new Uint8Array(maybeLength);
- var i, j;
- for (i = 0, j = 0; i < count; i++) {
- var digit1 = data[i];
- if (!isHexDigit(digit1)) {
- continue;
- }
- i++;
- var digit2;
- while (i < count && !isHexDigit(digit2 = data[i])) {
- i++;
- }
- if (i < count) {
- var value = parseInt(String.fromCharCode(digit1, digit2), 16);
- decrypted[j++] = value ^ r >> 8;
- r = (value + r) * c1 + c2 & (1 << 16) - 1;
- }
- }
- return Array.prototype.slice.call(decrypted, discardNumber, j);
- }
- function isSpecial(c) {
- return c === 0x2F || c === 0x5B || c === 0x5D || c === 0x7B || c === 0x7D || c === 0x28 || c === 0x29;
- }
- function Type1Parser(stream, encrypted, seacAnalysisEnabled) {
- if (encrypted) {
- var data = stream.getBytes();
- var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]));
- stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
- }
- this.seacAnalysisEnabled = !!seacAnalysisEnabled;
- this.stream = stream;
- this.nextChar();
- }
- Type1Parser.prototype = {
- readNumberArray: function Type1Parser_readNumberArray() {
- this.getToken();
- var array = [];
- while (true) {
- var token = this.getToken();
- if (token === null || token === ']' || token === '}') {
- break;
- }
- array.push(parseFloat(token || 0));
- }
- return array;
- },
- readNumber: function Type1Parser_readNumber() {
- var token = this.getToken();
- return parseFloat(token || 0);
- },
- readInt: function Type1Parser_readInt() {
- var token = this.getToken();
- return parseInt(token || 0, 10) | 0;
- },
- readBoolean: function Type1Parser_readBoolean() {
- var token = this.getToken();
- return token === 'true' ? 1 : 0;
- },
- nextChar: function Type1_nextChar() {
- return this.currentChar = this.stream.getByte();
- },
- getToken: function Type1Parser_getToken() {
- var comment = false;
- var ch = this.currentChar;
- while (true) {
- if (ch === -1) {
- return null;
- }
- if (comment) {
- if (ch === 0x0A || ch === 0x0D) {
- comment = false;
- }
- } else if (ch === 0x25) {
- comment = true;
- } else if (!(0, _util.isSpace)(ch)) {
- break;
- }
- ch = this.nextChar();
- }
- if (isSpecial(ch)) {
- this.nextChar();
- return String.fromCharCode(ch);
- }
- var token = '';
- do {
- token += String.fromCharCode(ch);
- ch = this.nextChar();
- } while (ch >= 0 && !(0, _util.isSpace)(ch) && !isSpecial(ch));
- return token;
- },
- readCharStrings: function Type1Parser_readCharStrings(bytes, lenIV) {
- if (lenIV === -1) {
- return bytes;
- }
- return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
- },
- extractFontProgram: function Type1Parser_extractFontProgram() {
- var stream = this.stream;
- var subrs = [],
- charstrings = [];
- var privateData = Object.create(null);
- privateData['lenIV'] = 4;
- var program = {
- subrs: [],
- charstrings: [],
- properties: { 'privateData': privateData }
- };
- var token, length, data, lenIV, encoded;
- while ((token = this.getToken()) !== null) {
- if (token !== '/') {
- continue;
- }
- token = this.getToken();
- switch (token) {
- case 'CharStrings':
- this.getToken();
- this.getToken();
- this.getToken();
- this.getToken();
- while (true) {
- token = this.getToken();
- if (token === null || token === 'end') {
- break;
- }
- if (token !== '/') {
- continue;
- }
- var glyph = this.getToken();
- length = this.readInt();
- this.getToken();
- data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
- lenIV = program.properties.privateData['lenIV'];
- encoded = this.readCharStrings(data, lenIV);
- this.nextChar();
- token = this.getToken();
- if (token === 'noaccess') {
- this.getToken();
- }
- charstrings.push({
- glyph: glyph,
- encoded: encoded
- });
- }
- break;
- case 'Subrs':
- this.readInt();
- this.getToken();
- while (this.getToken() === 'dup') {
- var index = this.readInt();
- length = this.readInt();
- this.getToken();
- data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
- lenIV = program.properties.privateData['lenIV'];
- encoded = this.readCharStrings(data, lenIV);
- this.nextChar();
- token = this.getToken();
- if (token === 'noaccess') {
- this.getToken();
- }
- subrs[index] = encoded;
- }
- break;
- case 'BlueValues':
- case 'OtherBlues':
- case 'FamilyBlues':
- case 'FamilyOtherBlues':
- var blueArray = this.readNumberArray();
- if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
- program.properties.privateData[token] = blueArray;
- }
- break;
- case 'StemSnapH':
- case 'StemSnapV':
- program.properties.privateData[token] = this.readNumberArray();
- break;
- case 'StdHW':
- case 'StdVW':
- program.properties.privateData[token] = this.readNumberArray()[0];
- break;
- case 'BlueShift':
- case 'lenIV':
- case 'BlueFuzz':
- case 'BlueScale':
- case 'LanguageGroup':
- case 'ExpansionFactor':
- program.properties.privateData[token] = this.readNumber();
- break;
- case 'ForceBold':
- program.properties.privateData[token] = this.readBoolean();
- break;
- }
- }
- for (var i = 0; i < charstrings.length; i++) {
- glyph = charstrings[i].glyph;
- encoded = charstrings[i].encoded;
- var charString = new Type1CharString();
- var error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
- var output = charString.output;
- if (error) {
- output = [14];
- }
- program.charstrings.push({
- glyphName: glyph,
- charstring: output,
- width: charString.width,
- lsb: charString.lsb,
- seac: charString.seac
- });
- }
- return program;
- },
- extractFontHeader: function Type1Parser_extractFontHeader(properties) {
- var token;
- while ((token = this.getToken()) !== null) {
- if (token !== '/') {
- continue;
- }
- token = this.getToken();
- switch (token) {
- case 'FontMatrix':
- var matrix = this.readNumberArray();
- properties.fontMatrix = matrix;
- break;
- case 'Encoding':
- var encodingArg = this.getToken();
- var encoding;
- if (!/^\d+$/.test(encodingArg)) {
- encoding = (0, _encodings.getEncoding)(encodingArg);
- } else {
- encoding = [];
- var size = parseInt(encodingArg, 10) | 0;
- this.getToken();
- for (var j = 0; j < size; j++) {
- token = this.getToken();
- while (token !== 'dup' && token !== 'def') {
- token = this.getToken();
- if (token === null) {
- return;
- }
- }
- if (token === 'def') {
- break;
- }
- var index = this.readInt();
- this.getToken();
- var glyph = this.getToken();
- encoding[index] = glyph;
- this.getToken();
- }
- }
- properties.builtInEncoding = encoding;
- break;
- case 'FontBBox':
- var fontBBox = this.readNumberArray();
- properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
- properties.descent = Math.min(fontBBox[1], fontBBox[3]);
- properties.ascentScaled = true;
- break;
- }
- }
- }
- };
- return Type1Parser;
-}();
-exports.Type1Parser = Type1Parser;
-
-/***/ }),
-/* 165 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.getTilingPatternIR = exports.Pattern = undefined;
-
-var _util = __w_pdfjs_require__(2);
-
-var _colorspace = __w_pdfjs_require__(151);
-
-var _primitives = __w_pdfjs_require__(138);
-
-var ShadingType = {
- FUNCTION_BASED: 1,
- AXIAL: 2,
- RADIAL: 3,
- FREE_FORM_MESH: 4,
- LATTICE_FORM_MESH: 5,
- COONS_PATCH_MESH: 6,
- TENSOR_PATCH_MESH: 7
-};
-var Pattern = function PatternClosure() {
- function Pattern() {
- (0, _util.unreachable)('should not call Pattern constructor');
- }
- Pattern.prototype = {
- getPattern: function Pattern_getPattern(ctx) {
- (0, _util.unreachable)('Should not call Pattern.getStyle: ' + ctx);
- }
- };
- Pattern.parseShading = function (shading, matrix, xref, res, handler, pdfFunctionFactory) {
- var dict = (0, _primitives.isStream)(shading) ? shading.dict : shading;
- var type = dict.get('ShadingType');
- try {
- switch (type) {
- case ShadingType.AXIAL:
- case ShadingType.RADIAL:
- return new Shadings.RadialAxial(dict, matrix, xref, res, pdfFunctionFactory);
- case ShadingType.FREE_FORM_MESH:
- case ShadingType.LATTICE_FORM_MESH:
- case ShadingType.COONS_PATCH_MESH:
- case ShadingType.TENSOR_PATCH_MESH:
- return new Shadings.Mesh(shading, matrix, xref, res, pdfFunctionFactory);
- default:
- throw new _util.FormatError('Unsupported ShadingType: ' + type);
- }
- } catch (ex) {
- if (ex instanceof _util.MissingDataException) {
- throw ex;
- }
- handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.shadingPattern });
- (0, _util.warn)(ex);
- return new Shadings.Dummy();
- }
- };
- return Pattern;
-}();
-var Shadings = {};
-Shadings.SMALL_NUMBER = 1e-6;
-Shadings.RadialAxial = function RadialAxialClosure() {
- function RadialAxial(dict, matrix, xref, res, pdfFunctionFactory) {
- this.matrix = matrix;
- this.coordsArr = dict.getArray('Coords');
- this.shadingType = dict.get('ShadingType');
- this.type = 'Pattern';
- var cs = dict.get('ColorSpace', 'CS');
- cs = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
- this.cs = cs;
- var t0 = 0.0,
- t1 = 1.0;
- if (dict.has('Domain')) {
- var domainArr = dict.getArray('Domain');
- t0 = domainArr[0];
- t1 = domainArr[1];
- }
- var extendStart = false,
- extendEnd = false;
- if (dict.has('Extend')) {
- var extendArr = dict.getArray('Extend');
- extendStart = extendArr[0];
- extendEnd = extendArr[1];
- }
- if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
- var x1 = this.coordsArr[0];
- var y1 = this.coordsArr[1];
- var r1 = this.coordsArr[2];
- var x2 = this.coordsArr[3];
- var y2 = this.coordsArr[4];
- var r2 = this.coordsArr[5];
- var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
- if (r1 <= r2 + distance && r2 <= r1 + distance) {
- (0, _util.warn)('Unsupported radial gradient.');
- }
- }
- this.extendStart = extendStart;
- this.extendEnd = extendEnd;
- var fnObj = dict.get('Function');
- var fn = pdfFunctionFactory.createFromArray(fnObj);
- var diff = t1 - t0;
- var step = diff / 10;
- var colorStops = this.colorStops = [];
- if (t0 >= t1 || step <= 0) {
- (0, _util.info)('Bad shading domain.');
- return;
- }
- var color = new Float32Array(cs.numComps),
- ratio = new Float32Array(1);
- var rgbColor;
- for (var i = t0; i <= t1; i += step) {
- ratio[0] = i;
- fn(ratio, 0, color, 0);
- rgbColor = cs.getRgb(color, 0);
- var cssColor = _util.Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
- colorStops.push([(i - t0) / diff, cssColor]);
- }
- var background = 'transparent';
- if (dict.has('Background')) {
- rgbColor = cs.getRgb(dict.get('Background'), 0);
- background = _util.Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
- }
- if (!extendStart) {
- colorStops.unshift([0, background]);
- colorStops[1][0] += Shadings.SMALL_NUMBER;
- }
- if (!extendEnd) {
- colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER;
- colorStops.push([1, background]);
- }
- this.colorStops = colorStops;
- }
- RadialAxial.prototype = {
- getIR: function RadialAxial_getIR() {
- var coordsArr = this.coordsArr;
- var shadingType = this.shadingType;
- var type, p0, p1, r0, r1;
- if (shadingType === ShadingType.AXIAL) {
- p0 = [coordsArr[0], coordsArr[1]];
- p1 = [coordsArr[2], coordsArr[3]];
- r0 = null;
- r1 = null;
- type = 'axial';
- } else if (shadingType === ShadingType.RADIAL) {
- p0 = [coordsArr[0], coordsArr[1]];
- p1 = [coordsArr[3], coordsArr[4]];
- r0 = coordsArr[2];
- r1 = coordsArr[5];
- type = 'radial';
- } else {
- (0, _util.unreachable)('getPattern type unknown: ' + shadingType);
- }
- var matrix = this.matrix;
- if (matrix) {
- p0 = _util.Util.applyTransform(p0, matrix);
- p1 = _util.Util.applyTransform(p1, matrix);
- if (shadingType === ShadingType.RADIAL) {
- var scale = _util.Util.singularValueDecompose2dScale(matrix);
- r0 *= scale[0];
- r1 *= scale[1];
- }
- }
- return ['RadialAxial', type, this.colorStops, p0, p1, r0, r1];
- }
- };
- return RadialAxial;
-}();
-Shadings.Mesh = function MeshClosure() {
- function MeshStreamReader(stream, context) {
- this.stream = stream;
- this.context = context;
- this.buffer = 0;
- this.bufferLength = 0;
- var numComps = context.numComps;
- this.tmpCompsBuf = new Float32Array(numComps);
- var csNumComps = context.colorSpace.numComps;
- this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
- }
- MeshStreamReader.prototype = {
- get hasData() {
- if (this.stream.end) {
- return this.stream.pos < this.stream.end;
- }
- if (this.bufferLength > 0) {
- return true;
- }
- var nextByte = this.stream.getByte();
- if (nextByte < 0) {
- return false;
- }
- this.buffer = nextByte;
- this.bufferLength = 8;
- return true;
- },
- readBits: function MeshStreamReader_readBits(n) {
- var buffer = this.buffer;
- var bufferLength = this.bufferLength;
- if (n === 32) {
- if (bufferLength === 0) {
- return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
- }
- buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
- var nextByte = this.stream.getByte();
- this.buffer = nextByte & (1 << bufferLength) - 1;
- return (buffer << 8 - bufferLength | (nextByte & 0xFF) >> bufferLength) >>> 0;
- }
- if (n === 8 && bufferLength === 0) {
- return this.stream.getByte();
- }
- while (bufferLength < n) {
- buffer = buffer << 8 | this.stream.getByte();
- bufferLength += 8;
- }
- bufferLength -= n;
- this.bufferLength = bufferLength;
- this.buffer = buffer & (1 << bufferLength) - 1;
- return buffer >> bufferLength;
- },
- align: function MeshStreamReader_align() {
- this.buffer = 0;
- this.bufferLength = 0;
- },
- readFlag: function MeshStreamReader_readFlag() {
- return this.readBits(this.context.bitsPerFlag);
- },
- readCoordinate: function MeshStreamReader_readCoordinate() {
- var bitsPerCoordinate = this.context.bitsPerCoordinate;
- var xi = this.readBits(bitsPerCoordinate);
- var yi = this.readBits(bitsPerCoordinate);
- var decode = this.context.decode;
- var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
- return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
- },
- readComponents: function MeshStreamReader_readComponents() {
- var numComps = this.context.numComps;
- var bitsPerComponent = this.context.bitsPerComponent;
- var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
- var decode = this.context.decode;
- var components = this.tmpCompsBuf;
- for (var i = 0, j = 4; i < numComps; i++, j += 2) {
- var ci = this.readBits(bitsPerComponent);
- components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
- }
- var color = this.tmpCsCompsBuf;
- if (this.context.colorFn) {
- this.context.colorFn(components, 0, color, 0);
- }
- return this.context.colorSpace.getRgb(color, 0);
- }
- };
- function decodeType4Shading(mesh, reader) {
- var coords = mesh.coords;
- var colors = mesh.colors;
- var operators = [];
- var ps = [];
- var verticesLeft = 0;
- while (reader.hasData) {
- var f = reader.readFlag();
- var coord = reader.readCoordinate();
- var color = reader.readComponents();
- if (verticesLeft === 0) {
- if (!(0 <= f && f <= 2)) {
- throw new _util.FormatError('Unknown type4 flag');
- }
- switch (f) {
- case 0:
- verticesLeft = 3;
- break;
- case 1:
- ps.push(ps[ps.length - 2], ps[ps.length - 1]);
- verticesLeft = 1;
- break;
- case 2:
- ps.push(ps[ps.length - 3], ps[ps.length - 1]);
- verticesLeft = 1;
- break;
- }
- operators.push(f);
- }
- ps.push(coords.length);
- coords.push(coord);
- colors.push(color);
- verticesLeft--;
- reader.align();
- }
- mesh.figures.push({
- type: 'triangles',
- coords: new Int32Array(ps),
- colors: new Int32Array(ps)
- });
- }
- function decodeType5Shading(mesh, reader, verticesPerRow) {
- var coords = mesh.coords;
- var colors = mesh.colors;
- var ps = [];
- while (reader.hasData) {
- var coord = reader.readCoordinate();
- var color = reader.readComponents();
- ps.push(coords.length);
- coords.push(coord);
- colors.push(color);
- }
- mesh.figures.push({
- type: 'lattice',
- coords: new Int32Array(ps),
- colors: new Int32Array(ps),
- verticesPerRow: verticesPerRow
- });
- }
- var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
- var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
- var TRIANGLE_DENSITY = 20;
- var getB = function getBClosure() {
- function buildB(count) {
- var lut = [];
- for (var i = 0; i <= count; i++) {
- var t = i / count,
- t_ = 1 - t;
- lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
- }
- return lut;
- }
- var cache = [];
- return function getB(count) {
- if (!cache[count]) {
- cache[count] = buildB(count);
- }
- return cache[count];
- };
- }();
- function buildFigureFromPatch(mesh, index) {
- var figure = mesh.figures[index];
- (0, _util.assert)(figure.type === 'patch', 'Unexpected patch mesh figure');
- var coords = mesh.coords,
- colors = mesh.colors;
- var pi = figure.coords;
- var ci = figure.colors;
- var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
- var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
- var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
- var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
- var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0]));
- splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
- var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1]));
- splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
- var verticesPerRow = splitXBy + 1;
- var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
- var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
- var k = 0;
- var cl = new Uint8Array(3),
- cr = new Uint8Array(3);
- var c0 = colors[ci[0]],
- c1 = colors[ci[1]],
- c2 = colors[ci[2]],
- c3 = colors[ci[3]];
- var bRow = getB(splitYBy),
- bCol = getB(splitXBy);
- for (var row = 0; row <= splitYBy; row++) {
- cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
- cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
- cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
- cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
- cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
- cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
- for (var col = 0; col <= splitXBy; col++, k++) {
- if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
- continue;
- }
- var x = 0,
- y = 0;
- var q = 0;
- for (var i = 0; i <= 3; i++) {
- for (var j = 0; j <= 3; j++, q++) {
- var m = bRow[row][i] * bCol[col][j];
- x += coords[pi[q]][0] * m;
- y += coords[pi[q]][1] * m;
- }
- }
- figureCoords[k] = coords.length;
- coords.push([x, y]);
- figureColors[k] = colors.length;
- var newColor = new Uint8Array(3);
- newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
- newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
- newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
- colors.push(newColor);
- }
- }
- figureCoords[0] = pi[0];
- figureColors[0] = ci[0];
- figureCoords[splitXBy] = pi[3];
- figureColors[splitXBy] = ci[1];
- figureCoords[verticesPerRow * splitYBy] = pi[12];
- figureColors[verticesPerRow * splitYBy] = ci[2];
- figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
- figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
- mesh.figures[index] = {
- type: 'lattice',
- coords: figureCoords,
- colors: figureColors,
- verticesPerRow: verticesPerRow
- };
- }
- function decodeType6Shading(mesh, reader) {
- var coords = mesh.coords;
- var colors = mesh.colors;
- var ps = new Int32Array(16);
- var cs = new Int32Array(4);
- while (reader.hasData) {
- var f = reader.readFlag();
- if (!(0 <= f && f <= 3)) {
- throw new _util.FormatError('Unknown type6 flag');
- }
- var i, ii;
- var pi = coords.length;
- for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
- coords.push(reader.readCoordinate());
- }
- var ci = colors.length;
- for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
- colors.push(reader.readComponents());
- }
- var tmp1, tmp2, tmp3, tmp4;
- switch (f) {
- case 0:
- ps[12] = pi + 3;
- ps[13] = pi + 4;
- ps[14] = pi + 5;
- ps[15] = pi + 6;
- ps[8] = pi + 2;
- ps[11] = pi + 7;
- ps[4] = pi + 1;
- ps[7] = pi + 8;
- ps[0] = pi;
- ps[1] = pi + 11;
- ps[2] = pi + 10;
- ps[3] = pi + 9;
- cs[2] = ci + 1;
- cs[3] = ci + 2;
- cs[0] = ci;
- cs[1] = ci + 3;
- break;
- case 1:
- tmp1 = ps[12];
- tmp2 = ps[13];
- tmp3 = ps[14];
- tmp4 = ps[15];
- ps[12] = tmp4;
- ps[13] = pi + 0;
- ps[14] = pi + 1;
- ps[15] = pi + 2;
- ps[8] = tmp3;
- ps[11] = pi + 3;
- ps[4] = tmp2;
- ps[7] = pi + 4;
- ps[0] = tmp1;
- ps[1] = pi + 7;
- ps[2] = pi + 6;
- ps[3] = pi + 5;
- tmp1 = cs[2];
- tmp2 = cs[3];
- cs[2] = tmp2;
- cs[3] = ci;
- cs[0] = tmp1;
- cs[1] = ci + 1;
- break;
- case 2:
- tmp1 = ps[15];
- tmp2 = ps[11];
- ps[12] = ps[3];
- ps[13] = pi + 0;
- ps[14] = pi + 1;
- ps[15] = pi + 2;
- ps[8] = ps[7];
- ps[11] = pi + 3;
- ps[4] = tmp2;
- ps[7] = pi + 4;
- ps[0] = tmp1;
- ps[1] = pi + 7;
- ps[2] = pi + 6;
- ps[3] = pi + 5;
- tmp1 = cs[3];
- cs[2] = cs[1];
- cs[3] = ci;
- cs[0] = tmp1;
- cs[1] = ci + 1;
- break;
- case 3:
- ps[12] = ps[0];
- ps[13] = pi + 0;
- ps[14] = pi + 1;
- ps[15] = pi + 2;
- ps[8] = ps[1];
- ps[11] = pi + 3;
- ps[4] = ps[2];
- ps[7] = pi + 4;
- ps[0] = ps[3];
- ps[1] = pi + 7;
- ps[2] = pi + 6;
- ps[3] = pi + 5;
- cs[2] = cs[0];
- cs[3] = ci;
- cs[0] = cs[1];
- cs[1] = ci + 1;
- break;
- }
- ps[5] = coords.length;
- coords.push([(-4 * coords[ps[0]][0] - coords[ps[15]][0] + 6 * (coords[ps[4]][0] + coords[ps[1]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[13]][0] + coords[ps[7]][0])) / 9, (-4 * coords[ps[0]][1] - coords[ps[15]][1] + 6 * (coords[ps[4]][1] + coords[ps[1]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[13]][1] + coords[ps[7]][1])) / 9]);
- ps[6] = coords.length;
- coords.push([(-4 * coords[ps[3]][0] - coords[ps[12]][0] + 6 * (coords[ps[2]][0] + coords[ps[7]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[4]][0] + coords[ps[14]][0])) / 9, (-4 * coords[ps[3]][1] - coords[ps[12]][1] + 6 * (coords[ps[2]][1] + coords[ps[7]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[4]][1] + coords[ps[14]][1])) / 9]);
- ps[9] = coords.length;
- coords.push([(-4 * coords[ps[12]][0] - coords[ps[3]][0] + 6 * (coords[ps[8]][0] + coords[ps[13]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[11]][0] + coords[ps[1]][0])) / 9, (-4 * coords[ps[12]][1] - coords[ps[3]][1] + 6 * (coords[ps[8]][1] + coords[ps[13]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[11]][1] + coords[ps[1]][1])) / 9]);
- ps[10] = coords.length;
- coords.push([(-4 * coords[ps[15]][0] - coords[ps[0]][0] + 6 * (coords[ps[11]][0] + coords[ps[14]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[2]][0] + coords[ps[8]][0])) / 9, (-4 * coords[ps[15]][1] - coords[ps[0]][1] + 6 * (coords[ps[11]][1] + coords[ps[14]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[2]][1] + coords[ps[8]][1])) / 9]);
- mesh.figures.push({
- type: 'patch',
- coords: new Int32Array(ps),
- colors: new Int32Array(cs)
- });
- }
- }
- function decodeType7Shading(mesh, reader) {
- var coords = mesh.coords;
- var colors = mesh.colors;
- var ps = new Int32Array(16);
- var cs = new Int32Array(4);
- while (reader.hasData) {
- var f = reader.readFlag();
- if (!(0 <= f && f <= 3)) {
- throw new _util.FormatError('Unknown type7 flag');
- }
- var i, ii;
- var pi = coords.length;
- for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
- coords.push(reader.readCoordinate());
- }
- var ci = colors.length;
- for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
- colors.push(reader.readComponents());
- }
- var tmp1, tmp2, tmp3, tmp4;
- switch (f) {
- case 0:
- ps[12] = pi + 3;
- ps[13] = pi + 4;
- ps[14] = pi + 5;
- ps[15] = pi + 6;
- ps[8] = pi + 2;
- ps[9] = pi + 13;
- ps[10] = pi + 14;
- ps[11] = pi + 7;
- ps[4] = pi + 1;
- ps[5] = pi + 12;
- ps[6] = pi + 15;
- ps[7] = pi + 8;
- ps[0] = pi;
- ps[1] = pi + 11;
- ps[2] = pi + 10;
- ps[3] = pi + 9;
- cs[2] = ci + 1;
- cs[3] = ci + 2;
- cs[0] = ci;
- cs[1] = ci + 3;
- break;
- case 1:
- tmp1 = ps[12];
- tmp2 = ps[13];
- tmp3 = ps[14];
- tmp4 = ps[15];
- ps[12] = tmp4;
- ps[13] = pi + 0;
- ps[14] = pi + 1;
- ps[15] = pi + 2;
- ps[8] = tmp3;
- ps[9] = pi + 9;
- ps[10] = pi + 10;
- ps[11] = pi + 3;
- ps[4] = tmp2;
- ps[5] = pi + 8;
- ps[6] = pi + 11;
- ps[7] = pi + 4;
- ps[0] = tmp1;
- ps[1] = pi + 7;
- ps[2] = pi + 6;
- ps[3] = pi + 5;
- tmp1 = cs[2];
- tmp2 = cs[3];
- cs[2] = tmp2;
- cs[3] = ci;
- cs[0] = tmp1;
- cs[1] = ci + 1;
- break;
- case 2:
- tmp1 = ps[15];
- tmp2 = ps[11];
- ps[12] = ps[3];
- ps[13] = pi + 0;
- ps[14] = pi + 1;
- ps[15] = pi + 2;
- ps[8] = ps[7];
- ps[9] = pi + 9;
- ps[10] = pi + 10;
- ps[11] = pi + 3;
- ps[4] = tmp2;
- ps[5] = pi + 8;
- ps[6] = pi + 11;
- ps[7] = pi + 4;
- ps[0] = tmp1;
- ps[1] = pi + 7;
- ps[2] = pi + 6;
- ps[3] = pi + 5;
- tmp1 = cs[3];
- cs[2] = cs[1];
- cs[3] = ci;
- cs[0] = tmp1;
- cs[1] = ci + 1;
- break;
- case 3:
- ps[12] = ps[0];
- ps[13] = pi + 0;
- ps[14] = pi + 1;
- ps[15] = pi + 2;
- ps[8] = ps[1];
- ps[9] = pi + 9;
- ps[10] = pi + 10;
- ps[11] = pi + 3;
- ps[4] = ps[2];
- ps[5] = pi + 8;
- ps[6] = pi + 11;
- ps[7] = pi + 4;
- ps[0] = ps[3];
- ps[1] = pi + 7;
- ps[2] = pi + 6;
- ps[3] = pi + 5;
- cs[2] = cs[0];
- cs[3] = ci;
- cs[0] = cs[1];
- cs[1] = ci + 1;
- break;
- }
- mesh.figures.push({
- type: 'patch',
- coords: new Int32Array(ps),
- colors: new Int32Array(cs)
- });
- }
- }
- function updateBounds(mesh) {
- var minX = mesh.coords[0][0],
- minY = mesh.coords[0][1],
- maxX = minX,
- maxY = minY;
- for (var i = 1, ii = mesh.coords.length; i < ii; i++) {
- var x = mesh.coords[i][0],
- y = mesh.coords[i][1];
- minX = minX > x ? x : minX;
- minY = minY > y ? y : minY;
- maxX = maxX < x ? x : maxX;
- maxY = maxY < y ? y : maxY;
- }
- mesh.bounds = [minX, minY, maxX, maxY];
- }
- function packData(mesh) {
- var i, ii, j, jj;
- var coords = mesh.coords;
- var coordsPacked = new Float32Array(coords.length * 2);
- for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
- var xy = coords[i];
- coordsPacked[j++] = xy[0];
- coordsPacked[j++] = xy[1];
- }
- mesh.coords = coordsPacked;
- var colors = mesh.colors;
- var colorsPacked = new Uint8Array(colors.length * 3);
- for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
- var c = colors[i];
- colorsPacked[j++] = c[0];
- colorsPacked[j++] = c[1];
- colorsPacked[j++] = c[2];
- }
- mesh.colors = colorsPacked;
- var figures = mesh.figures;
- for (i = 0, ii = figures.length; i < ii; i++) {
- var figure = figures[i],
- ps = figure.coords,
- cs = figure.colors;
- for (j = 0, jj = ps.length; j < jj; j++) {
- ps[j] *= 2;
- cs[j] *= 3;
- }
- }
- }
- function Mesh(stream, matrix, xref, res, pdfFunctionFactory) {
- if (!(0, _primitives.isStream)(stream)) {
- throw new _util.FormatError('Mesh data is not a stream');
- }
- var dict = stream.dict;
- this.matrix = matrix;
- this.shadingType = dict.get('ShadingType');
- this.type = 'Pattern';
- this.bbox = dict.getArray('BBox');
- var cs = dict.get('ColorSpace', 'CS');
- cs = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
- this.cs = cs;
- this.background = dict.has('Background') ? cs.getRgb(dict.get('Background'), 0) : null;
- var fnObj = dict.get('Function');
- var fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
- this.coords = [];
- this.colors = [];
- this.figures = [];
- var decodeContext = {
- bitsPerCoordinate: dict.get('BitsPerCoordinate'),
- bitsPerComponent: dict.get('BitsPerComponent'),
- bitsPerFlag: dict.get('BitsPerFlag'),
- decode: dict.getArray('Decode'),
- colorFn: fn,
- colorSpace: cs,
- numComps: fn ? 1 : cs.numComps
- };
- var reader = new MeshStreamReader(stream, decodeContext);
- var patchMesh = false;
- switch (this.shadingType) {
- case ShadingType.FREE_FORM_MESH:
- decodeType4Shading(this, reader);
- break;
- case ShadingType.LATTICE_FORM_MESH:
- var verticesPerRow = dict.get('VerticesPerRow') | 0;
- if (verticesPerRow < 2) {
- throw new _util.FormatError('Invalid VerticesPerRow');
- }
- decodeType5Shading(this, reader, verticesPerRow);
- break;
- case ShadingType.COONS_PATCH_MESH:
- decodeType6Shading(this, reader);
- patchMesh = true;
- break;
- case ShadingType.TENSOR_PATCH_MESH:
- decodeType7Shading(this, reader);
- patchMesh = true;
- break;
- default:
- (0, _util.unreachable)('Unsupported mesh type.');
- break;
- }
- if (patchMesh) {
- updateBounds(this);
- for (var i = 0, ii = this.figures.length; i < ii; i++) {
- buildFigureFromPatch(this, i);
- }
- }
- updateBounds(this);
- packData(this);
- }
- Mesh.prototype = {
- getIR: function Mesh_getIR() {
- return ['Mesh', this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.matrix, this.bbox, this.background];
- }
- };
- return Mesh;
-}();
-Shadings.Dummy = function DummyClosure() {
- function Dummy() {
- this.type = 'Pattern';
- }
- Dummy.prototype = {
- getIR: function Dummy_getIR() {
- return ['Dummy'];
- }
- };
- return Dummy;
-}();
-function getTilingPatternIR(operatorList, dict, args) {
- var matrix = dict.getArray('Matrix');
- var bbox = _util.Util.normalizeRect(dict.getArray('BBox'));
- var xstep = dict.get('XStep');
- var ystep = dict.get('YStep');
- var paintType = dict.get('PaintType');
- var tilingType = dict.get('TilingType');
- if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
- throw new _util.FormatError('Invalid getTilingPatternIR /BBox array: [' + bbox + '].');
- }
- return ['TilingPattern', args, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
-}
-exports.Pattern = Pattern;
-exports.getTilingPatternIR = getTilingPatternIR;
-
-/***/ }),
-/* 166 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.bidi = undefined;
-
-var _util = __w_pdfjs_require__(2);
-
-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'];
-function isOdd(i) {
- return (i & 1) !== 0;
-}
-function isEven(i) {
- return (i & 1) === 0;
-}
-function findUnequal(arr, start, value) {
- for (var j = start, jj = arr.length; j < jj; ++j) {
- if (arr[j] !== value) {
- return j;
- }
- }
- return j;
-}
-function setValues(arr, start, end, value) {
- for (var j = start; j < end; ++j) {
- arr[j] = value;
- }
-}
-function reverseValues(arr, start, end) {
- for (var i = start, j = end - 1; i < j; ++i, --j) {
- var temp = arr[i];
- arr[i] = arr[j];
- arr[j] = temp;
- }
-}
-function createBidiText(str, isLTR, vertical) {
- return {
- str: str,
- dir: vertical ? 'ttb' : isLTR ? 'ltr' : 'rtl'
- };
-}
-var chars = [];
-var types = [];
-function bidi(str, startLevel, vertical) {
- var isLTR = true;
- var strLength = str.length;
- if (strLength === 0 || vertical) {
- return createBidiText(str, isLTR, vertical);
- }
- chars.length = strLength;
- types.length = strLength;
- var numBidi = 0;
- var i, ii;
- for (i = 0; i < strLength; ++i) {
- chars[i] = str.charAt(i);
- var charCode = str.charCodeAt(i);
- var charType = 'L';
- if (charCode <= 0x00ff) {
- charType = baseTypes[charCode];
- } else if (0x0590 <= charCode && charCode <= 0x05f4) {
- charType = 'R';
- } else if (0x0600 <= charCode && charCode <= 0x06ff) {
- charType = arabicTypes[charCode & 0xff];
- if (!charType) {
- (0, _util.warn)('Bidi: invalid Unicode character ' + charCode.toString(16));
- }
- } else if (0x0700 <= charCode && charCode <= 0x08AC) {
- charType = 'AL';
- }
- if (charType === 'R' || charType === 'AL' || charType === 'AN') {
- numBidi++;
- }
- types[i] = charType;
- }
- if (numBidi === 0) {
- isLTR = true;
- return createBidiText(str, isLTR);
- }
- if (startLevel === -1) {
- if (numBidi / strLength < 0.3) {
- isLTR = true;
- startLevel = 0;
- } else {
- isLTR = false;
- startLevel = 1;
- }
- }
- var levels = [];
- for (i = 0; i < strLength; ++i) {
- levels[i] = startLevel;
- }
- var e = isOdd(startLevel) ? 'R' : 'L';
- var sor = e;
- var eor = sor;
- var lastType = sor;
- for (i = 0; i < strLength; ++i) {
- if (types[i] === 'NSM') {
- types[i] = lastType;
- } else {
- lastType = types[i];
- }
- }
- lastType = sor;
- var t;
- for (i = 0; i < strLength; ++i) {
- t = types[i];
- if (t === 'EN') {
- types[i] = lastType === 'AL' ? 'AN' : 'EN';
- } else if (t === 'R' || t === 'L' || t === 'AL') {
- lastType = t;
- }
- }
- for (i = 0; i < strLength; ++i) {
- t = types[i];
- if (t === 'AL') {
- types[i] = 'R';
- }
- }
- for (i = 1; i < strLength - 1; ++i) {
- if (types[i] === 'ES' && types[i - 1] === 'EN' && types[i + 1] === 'EN') {
- types[i] = 'EN';
- }
- if (types[i] === 'CS' && (types[i - 1] === 'EN' || types[i - 1] === 'AN') && types[i + 1] === types[i - 1]) {
- types[i] = types[i - 1];
- }
- }
- for (i = 0; i < strLength; ++i) {
- if (types[i] === 'EN') {
- var j;
- for (j = i - 1; j >= 0; --j) {
- if (types[j] !== 'ET') {
- break;
- }
- types[j] = 'EN';
- }
- for (j = i + 1; j < strLength; ++j) {
- if (types[j] !== 'ET') {
- break;
- }
- types[j] = 'EN';
- }
- }
- }
- for (i = 0; i < strLength; ++i) {
- t = types[i];
- if (t === 'WS' || t === 'ES' || t === 'ET' || t === 'CS') {
- types[i] = 'ON';
- }
- }
- lastType = sor;
- for (i = 0; i < strLength; ++i) {
- t = types[i];
- if (t === 'EN') {
- types[i] = lastType === 'L' ? 'L' : 'EN';
- } else if (t === 'R' || t === 'L') {
- lastType = t;
- }
- }
- for (i = 0; i < strLength; ++i) {
- if (types[i] === 'ON') {
- var end = findUnequal(types, i + 1, 'ON');
- var before = sor;
- if (i > 0) {
- before = types[i - 1];
- }
- var after = eor;
- if (end + 1 < strLength) {
- after = types[end + 1];
- }
- if (before !== 'L') {
- before = 'R';
- }
- if (after !== 'L') {
- after = 'R';
- }
- if (before === after) {
- setValues(types, i, end, before);
- }
- i = end - 1;
- }
- }
- for (i = 0; i < strLength; ++i) {
- if (types[i] === 'ON') {
- types[i] = e;
- }
- }
- for (i = 0; i < strLength; ++i) {
- t = types[i];
- if (isEven(levels[i])) {
- if (t === 'R') {
- levels[i] += 1;
- } else if (t === 'AN' || t === 'EN') {
- levels[i] += 2;
- }
- } else {
- if (t === 'L' || t === 'AN' || t === 'EN') {
- levels[i] += 1;
- }
- }
- }
- var highestLevel = -1;
- var lowestOddLevel = 99;
- var level;
- for (i = 0, ii = levels.length; i < ii; ++i) {
- level = levels[i];
- if (highestLevel < level) {
- highestLevel = level;
- }
- if (lowestOddLevel > level && isOdd(level)) {
- lowestOddLevel = level;
- }
- }
- for (level = highestLevel; level >= lowestOddLevel; --level) {
- var start = -1;
- for (i = 0, ii = levels.length; i < ii; ++i) {
- if (levels[i] < level) {
- if (start >= 0) {
- reverseValues(chars, start, i);
- start = -1;
- }
- } else if (start < 0) {
- start = i;
- }
- }
- if (start >= 0) {
- reverseValues(chars, start, levels.length);
- }
- }
- for (i = 0, ii = chars.length; i < ii; ++i) {
- var ch = chars[i];
- if (ch === '<' || ch === '>') {
- chars[i] = '';
- }
- }
- return createBidiText(chars.join(''), isLTR);
-}
-exports.bidi = bidi;
-
-/***/ }),
-/* 167 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.getMetrics = undefined;
-
-var _util = __w_pdfjs_require__(2);
-
-var getMetrics = (0, _util.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['space'] = 278;
- t['exclam'] = 278;
- t['quotedbl'] = 355;
- t['numbersign'] = 556;
- t['dollar'] = 556;
- t['percent'] = 889;
- t['ampersand'] = 667;
- t['quoteright'] = 222;
- t['parenleft'] = 333;
- t['parenright'] = 333;
- t['asterisk'] = 389;
- t['plus'] = 584;
- t['comma'] = 278;
- t['hyphen'] = 333;
- t['period'] = 278;
- t['slash'] = 278;
- t['zero'] = 556;
- t['one'] = 556;
- t['two'] = 556;
- t['three'] = 556;
- t['four'] = 556;
- t['five'] = 556;
- t['six'] = 556;
- t['seven'] = 556;
- t['eight'] = 556;
- t['nine'] = 556;
- t['colon'] = 278;
- t['semicolon'] = 278;
- t['less'] = 584;
- t['equal'] = 584;
- t['greater'] = 584;
- t['question'] = 556;
- t['at'] = 1015;
- t['A'] = 667;
- t['B'] = 667;
- t['C'] = 722;
- t['D'] = 722;
- t['E'] = 667;
- t['F'] = 611;
- t['G'] = 778;
- t['H'] = 722;
- t['I'] = 278;
- t['J'] = 500;
- t['K'] = 667;
- t['L'] = 556;
- t['M'] = 833;
- t['N'] = 722;
- t['O'] = 778;
- t['P'] = 667;
- t['Q'] = 778;
- t['R'] = 722;
- t['S'] = 667;
- t['T'] = 611;
- t['U'] = 722;
- t['V'] = 667;
- t['W'] = 944;
- t['X'] = 667;
- t['Y'] = 667;
- t['Z'] = 611;
- t['bracketleft'] = 278;
- t['backslash'] = 278;
- t['bracketright'] = 278;
- t['asciicircum'] = 469;
- t['underscore'] = 556;
- t['quoteleft'] = 222;
- t['a'] = 556;
- t['b'] = 556;
- t['c'] = 500;
- t['d'] = 556;
- t['e'] = 556;
- t['f'] = 278;
- t['g'] = 556;
- t['h'] = 556;
- t['i'] = 222;
- t['j'] = 222;
- t['k'] = 500;
- t['l'] = 222;
- t['m'] = 833;
- t['n'] = 556;
- t['o'] = 556;
- t['p'] = 556;
- t['q'] = 556;
- t['r'] = 333;
- t['s'] = 500;
- t['t'] = 278;
- t['u'] = 556;
- t['v'] = 500;
- t['w'] = 722;
- t['x'] = 500;
- t['y'] = 500;
- t['z'] = 500;
- t['braceleft'] = 334;
- t['bar'] = 260;
- t['braceright'] = 334;
- t['asciitilde'] = 584;
- t['exclamdown'] = 333;
- t['cent'] = 556;
- t['sterling'] = 556;
- t['fraction'] = 167;
- t['yen'] = 556;
- t['florin'] = 556;
- t['section'] = 556;
- t['currency'] = 556;
- t['quotesingle'] = 191;
- t['quotedblleft'] = 333;
- t['guillemotleft'] = 556;
- t['guilsinglleft'] = 333;
- t['guilsinglright'] = 333;
- t['fi'] = 500;
- t['fl'] = 500;
- t['endash'] = 556;
- t['dagger'] = 556;
- t['daggerdbl'] = 556;
- t['periodcentered'] = 278;
- t['paragraph'] = 537;
- t['bullet'] = 350;
- t['quotesinglbase'] = 222;
- t['quotedblbase'] = 333;
- t['quotedblright'] = 333;
- t['guillemotright'] = 556;
- t['ellipsis'] = 1000;
- t['perthousand'] = 1000;
- t['questiondown'] = 611;
- t['grave'] = 333;
- t['acute'] = 333;
- t['circumflex'] = 333;
- t['tilde'] = 333;
- t['macron'] = 333;
- t['breve'] = 333;
- t['dotaccent'] = 333;
- t['dieresis'] = 333;
- t['ring'] = 333;
- t['cedilla'] = 333;
- t['hungarumlaut'] = 333;
- t['ogonek'] = 333;
- t['caron'] = 333;
- t['emdash'] = 1000;
- t['AE'] = 1000;
- t['ordfeminine'] = 370;
- t['Lslash'] = 556;
- t['Oslash'] = 778;
- t['OE'] = 1000;
- t['ordmasculine'] = 365;
- t['ae'] = 889;
- t['dotlessi'] = 278;
- t['lslash'] = 222;
- t['oslash'] = 611;
- t['oe'] = 944;
- t['germandbls'] = 611;
- t['Idieresis'] = 278;
- t['eacute'] = 556;
- t['abreve'] = 556;
- t['uhungarumlaut'] = 556;
- t['ecaron'] = 556;
- t['Ydieresis'] = 667;
- t['divide'] = 584;
- t['Yacute'] = 667;
- t['Acircumflex'] = 667;
- t['aacute'] = 556;
- t['Ucircumflex'] = 722;
- t['yacute'] = 500;
- t['scommaaccent'] = 500;
- t['ecircumflex'] = 556;
- t['Uring'] = 722;
- t['Udieresis'] = 722;
- t['aogonek'] = 556;
- t['Uacute'] = 722;
- t['uogonek'] = 556;
- t['Edieresis'] = 667;
- t['Dcroat'] = 722;
- t['commaaccent'] = 250;
- t['copyright'] = 737;
- t['Emacron'] = 667;
- t['ccaron'] = 500;
- t['aring'] = 556;
- t['Ncommaaccent'] = 722;
- t['lacute'] = 222;
- t['agrave'] = 556;
- t['Tcommaaccent'] = 611;
- t['Cacute'] = 722;
- t['atilde'] = 556;
- t['Edotaccent'] = 667;
- t['scaron'] = 500;
- t['scedilla'] = 500;
- t['iacute'] = 278;
- t['lozenge'] = 471;
- t['Rcaron'] = 722;
- t['Gcommaaccent'] = 778;
- t['ucircumflex'] = 556;
- t['acircumflex'] = 556;
- t['Amacron'] = 667;
- t['rcaron'] = 333;
- t['ccedilla'] = 500;
- t['Zdotaccent'] = 611;
- t['Thorn'] = 667;
- t['Omacron'] = 778;
- t['Racute'] = 722;
- t['Sacute'] = 667;
- t['dcaron'] = 643;
- t['Umacron'] = 722;
- t['uring'] = 556;
- t['threesuperior'] = 333;
- t['Ograve'] = 778;
- t['Agrave'] = 667;
- t['Abreve'] = 667;
- t['multiply'] = 584;
- t['uacute'] = 556;
- t['Tcaron'] = 611;
- t['partialdiff'] = 476;
- t['ydieresis'] = 500;
- t['Nacute'] = 722;
- t['icircumflex'] = 278;
- t['Ecircumflex'] = 667;
- t['adieresis'] = 556;
- t['edieresis'] = 556;
- t['cacute'] = 500;
- t['nacute'] = 556;
- t['umacron'] = 556;
- t['Ncaron'] = 722;
- t['Iacute'] = 278;
- t['plusminus'] = 584;
- t['brokenbar'] = 260;
- t['registered'] = 737;
- t['Gbreve'] = 778;
- t['Idotaccent'] = 278;
- t['summation'] = 600;
- t['Egrave'] = 667;
- t['racute'] = 333;
- t['omacron'] = 556;
- t['Zacute'] = 611;
- t['Zcaron'] = 611;
- t['greaterequal'] = 549;
- t['Eth'] = 722;
- t['Ccedilla'] = 722;
- t['lcommaaccent'] = 222;
- t['tcaron'] = 317;
- t['eogonek'] = 556;
- t['Uogonek'] = 722;
- t['Aacute'] = 667;
- t['Adieresis'] = 667;
- t['egrave'] = 556;
- t['zacute'] = 500;
- t['iogonek'] = 222;
- t['Oacute'] = 778;
- t['oacute'] = 556;
- t['amacron'] = 556;
- t['sacute'] = 500;
- t['idieresis'] = 278;
- t['Ocircumflex'] = 778;
- t['Ugrave'] = 722;
- t['Delta'] = 612;
- t['thorn'] = 556;
- t['twosuperior'] = 333;
- t['Odieresis'] = 778;
- t['mu'] = 556;
- t['igrave'] = 278;
- t['ohungarumlaut'] = 556;
- t['Eogonek'] = 667;
- t['dcroat'] = 556;
- t['threequarters'] = 834;
- t['Scedilla'] = 667;
- t['lcaron'] = 299;
- t['Kcommaaccent'] = 667;
- t['Lacute'] = 556;
- t['trademark'] = 1000;
- t['edotaccent'] = 556;
- t['Igrave'] = 278;
- t['Imacron'] = 278;
- t['Lcaron'] = 556;
- t['onehalf'] = 834;
- t['lessequal'] = 549;
- t['ocircumflex'] = 556;
- t['ntilde'] = 556;
- t['Uhungarumlaut'] = 722;
- t['Eacute'] = 667;
- t['emacron'] = 556;
- t['gbreve'] = 556;
- t['onequarter'] = 834;
- t['Scaron'] = 667;
- t['Scommaaccent'] = 667;
- t['Ohungarumlaut'] = 778;
- t['degree'] = 400;
- t['ograve'] = 556;
- t['Ccaron'] = 722;
- t['ugrave'] = 556;
- t['radical'] = 453;
- t['Dcaron'] = 722;
- t['rcommaaccent'] = 333;
- t['Ntilde'] = 722;
- t['otilde'] = 556;
- t['Rcommaaccent'] = 722;
- t['Lcommaaccent'] = 556;
- t['Atilde'] = 667;
- t['Aogonek'] = 667;
- t['Aring'] = 667;
- t['Otilde'] = 778;
- t['zdotaccent'] = 500;
- t['Ecaron'] = 667;
- t['Iogonek'] = 278;
- t['kcommaaccent'] = 500;
- t['minus'] = 584;
- t['Icircumflex'] = 278;
- t['ncaron'] = 556;
- t['tcommaaccent'] = 278;
- t['logicalnot'] = 584;
- t['odieresis'] = 556;
- t['udieresis'] = 556;
- t['notequal'] = 549;
- t['gcommaaccent'] = 556;
- t['eth'] = 556;
- t['zcaron'] = 500;
- t['ncommaaccent'] = 556;
- t['onesuperior'] = 333;
- t['imacron'] = 278;
- t['Euro'] = 556;
- });
- t['Helvetica-Bold'] = (0, _util.getLookupTableFactory)(function (t) {
- t['space'] = 278;
- t['exclam'] = 333;
- t['quotedbl'] = 474;
- t['numbersign'] = 556;
- t['dollar'] = 556;
- t['percent'] = 889;
- t['ampersand'] = 722;
- t['quoteright'] = 278;
- t['parenleft'] = 333;
- t['parenright'] = 333;
- t['asterisk'] = 389;
- t['plus'] = 584;
- t['comma'] = 278;
- t['hyphen'] = 333;
- t['period'] = 278;
- t['slash'] = 278;
- t['zero'] = 556;
- t['one'] = 556;
- t['two'] = 556;
- t['three'] = 556;
- t['four'] = 556;
- t['five'] = 556;
- t['six'] = 556;
- t['seven'] = 556;
- t['eight'] = 556;
- t['nine'] = 556;
- t['colon'] = 333;
- t['semicolon'] = 333;
- t['less'] = 584;
- t['equal'] = 584;
- t['greater'] = 584;
- t['question'] = 611;
- t['at'] = 975;
- t['A'] = 722;
- t['B'] = 722;
- t['C'] = 722;
- t['D'] = 722;
- t['E'] = 667;
- t['F'] = 611;
- t['G'] = 778;
- t['H'] = 722;
- t['I'] = 278;
- t['J'] = 556;
- t['K'] = 722;
- t['L'] = 611;
- t['M'] = 833;
- t['N'] = 722;
- t['O'] = 778;
- t['P'] = 667;
- t['Q'] = 778;
- t['R'] = 722;
- t['S'] = 667;
- t['T'] = 611;
- t['U'] = 722;
- t['V'] = 667;
- t['W'] = 944;
- t['X'] = 667;
- t['Y'] = 667;
- t['Z'] = 611;
- t['bracketleft'] = 333;
- t['backslash'] = 278;
- t['bracketright'] = 333;
- t['asciicircum'] = 584;
- t['underscore'] = 556;
- t['quoteleft'] = 278;
- t['a'] = 556;
- t['b'] = 611;
- t['c'] = 556;
- t['d'] = 611;
- t['e'] = 556;
- t['f'] = 333;
- t['g'] = 611;
- t['h'] = 611;
- t['i'] = 278;
- t['j'] = 278;
- t['k'] = 556;
- t['l'] = 278;
- t['m'] = 889;
- t['n'] = 611;
- t['o'] = 611;
- t['p'] = 611;
- t['q'] = 611;
- t['r'] = 389;
- t['s'] = 556;
- t['t'] = 333;
- t['u'] = 611;
- t['v'] = 556;
- t['w'] = 778;
- t['x'] = 556;
- t['y'] = 556;
- t['z'] = 500;
- t['braceleft'] = 389;
- t['bar'] = 280;
- t['braceright'] = 389;
- t['asciitilde'] = 584;
- t['exclamdown'] = 333;
- t['cent'] = 556;
- t['sterling'] = 556;
- t['fraction'] = 167;
- t['yen'] = 556;
- t['florin'] = 556;
- t['section'] = 556;
- t['currency'] = 556;
- t['quotesingle'] = 238;
- t['quotedblleft'] = 500;
- t['guillemotleft'] = 556;
- t['guilsinglleft'] = 333;
- t['guilsinglright'] = 333;
- t['fi'] = 611;
- t['fl'] = 611;
- t['endash'] = 556;
- t['dagger'] = 556;
- t['daggerdbl'] = 556;
- t['periodcentered'] = 278;
- t['paragraph'] = 556;
- t['bullet'] = 350;
- t['quotesinglbase'] = 278;
- t['quotedblbase'] = 500;
- t['quotedblright'] = 500;
- t['guillemotright'] = 556;
- t['ellipsis'] = 1000;
- t['perthousand'] = 1000;
- t['questiondown'] = 611;
- t['grave'] = 333;
- t['acute'] = 333;
- t['circumflex'] = 333;
- t['tilde'] = 333;
- t['macron'] = 333;
- t['breve'] = 333;
- t['dotaccent'] = 333;
- t['dieresis'] = 333;
- t['ring'] = 333;
- t['cedilla'] = 333;
- t['hungarumlaut'] = 333;
- t['ogonek'] = 333;
- t['caron'] = 333;
- t['emdash'] = 1000;
- t['AE'] = 1000;
- t['ordfeminine'] = 370;
- t['Lslash'] = 611;
- t['Oslash'] = 778;
- t['OE'] = 1000;
- t['ordmasculine'] = 365;
- t['ae'] = 889;
- t['dotlessi'] = 278;
- t['lslash'] = 278;
- t['oslash'] = 611;
- t['oe'] = 944;
- t['germandbls'] = 611;
- t['Idieresis'] = 278;
- t['eacute'] = 556;
- t['abreve'] = 556;
- t['uhungarumlaut'] = 611;
- t['ecaron'] = 556;
- t['Ydieresis'] = 667;
- t['divide'] = 584;
- t['Yacute'] = 667;
- t['Acircumflex'] = 722;
- t['aacute'] = 556;
- t['Ucircumflex'] = 722;
- t['yacute'] = 556;
- t['scommaaccent'] = 556;
- t['ecircumflex'] = 556;
- t['Uring'] = 722;
- t['Udieresis'] = 722;
- t['aogonek'] = 556;
- t['Uacute'] = 722;
- t['uogonek'] = 611;
- t['Edieresis'] = 667;
- t['Dcroat'] = 722;
- t['commaaccent'] = 250;
- t['copyright'] = 737;
- t['Emacron'] = 667;
- t['ccaron'] = 556;
- t['aring'] = 556;
- t['Ncommaaccent'] = 722;
- t['lacute'] = 278;
- t['agrave'] = 556;
- t['Tcommaaccent'] = 611;
- t['Cacute'] = 722;
- t['atilde'] = 556;
- t['Edotaccent'] = 667;
- t['scaron'] = 556;
- t['scedilla'] = 556;
- t['iacute'] = 278;
- t['lozenge'] = 494;
- t['Rcaron'] = 722;
- t['Gcommaaccent'] = 778;
- t['ucircumflex'] = 611;
- t['acircumflex'] = 556;
- t['Amacron'] = 722;
- t['rcaron'] = 389;
- t['ccedilla'] = 556;
- t['Zdotaccent'] = 611;
- t['Thorn'] = 667;
- t['Omacron'] = 778;
- t['Racute'] = 722;
- t['Sacute'] = 667;
- t['dcaron'] = 743;
- t['Umacron'] = 722;
- t['uring'] = 611;
- t['threesuperior'] = 333;
- t['Ograve'] = 778;
- t['Agrave'] = 722;
- t['Abreve'] = 722;
- t['multiply'] = 584;
- t['uacute'] = 611;
- t['Tcaron'] = 611;
- t['partialdiff'] = 494;
- t['ydieresis'] = 556;
- t['Nacute'] = 722;
- t['icircumflex'] = 278;
- t['Ecircumflex'] = 667;
- t['adieresis'] = 556;
- t['edieresis'] = 556;
- t['cacute'] = 556;
- t['nacute'] = 611;
- t['umacron'] = 611;
- t['Ncaron'] = 722;
- t['Iacute'] = 278;
- t['plusminus'] = 584;
- t['brokenbar'] = 280;
- t['registered'] = 737;
- t['Gbreve'] = 778;
- t['Idotaccent'] = 278;
- t['summation'] = 600;
- t['Egrave'] = 667;
- t['racute'] = 389;
- t['omacron'] = 611;
- t['Zacute'] = 611;
- t['Zcaron'] = 611;
- t['greaterequal'] = 549;
- t['Eth'] = 722;
- t['Ccedilla'] = 722;
- t['lcommaaccent'] = 278;
- t['tcaron'] = 389;
- t['eogonek'] = 556;
- t['Uogonek'] = 722;
- t['Aacute'] = 722;
- t['Adieresis'] = 722;
- t['egrave'] = 556;
- t['zacute'] = 500;
- t['iogonek'] = 278;
- t['Oacute'] = 778;
- t['oacute'] = 611;
- t['amacron'] = 556;
- t['sacute'] = 556;
- t['idieresis'] = 278;
- t['Ocircumflex'] = 778;
- t['Ugrave'] = 722;
- t['Delta'] = 612;
- t['thorn'] = 611;
- t['twosuperior'] = 333;
- t['Odieresis'] = 778;
- t['mu'] = 611;
- t['igrave'] = 278;
- t['ohungarumlaut'] = 611;
- t['Eogonek'] = 667;
- t['dcroat'] = 611;
- t['threequarters'] = 834;
- t['Scedilla'] = 667;
- t['lcaron'] = 400;
- t['Kcommaaccent'] = 722;
- t['Lacute'] = 611;
- t['trademark'] = 1000;
- t['edotaccent'] = 556;
- t['Igrave'] = 278;
- t['Imacron'] = 278;
- t['Lcaron'] = 611;
- t['onehalf'] = 834;
- t['lessequal'] = 549;
- t['ocircumflex'] = 611;
- t['ntilde'] = 611;
- t['Uhungarumlaut'] = 722;
- t['Eacute'] = 667;
- t['emacron'] = 556;
- t['gbreve'] = 611;
- t['onequarter'] = 834;
- t['Scaron'] = 667;
- t['Scommaaccent'] = 667;
- t['Ohungarumlaut'] = 778;
- t['degree'] = 400;
- t['ograve'] = 611;
- t['Ccaron'] = 722;
- t['ugrave'] = 611;
- t['radical'] = 549;
- t['Dcaron'] = 722;
- t['rcommaaccent'] = 389;
- t['Ntilde'] = 722;
- t['otilde'] = 611;
- t['Rcommaaccent'] = 722;
- t['Lcommaaccent'] = 611;
- t['Atilde'] = 722;
- t['Aogonek'] = 722;
- t['Aring'] = 722;
- t['Otilde'] = 778;
- t['zdotaccent'] = 500;
- t['Ecaron'] = 667;
- t['Iogonek'] = 278;
- t['kcommaaccent'] = 556;
- t['minus'] = 584;
- t['Icircumflex'] = 278;
- t['ncaron'] = 611;
- t['tcommaaccent'] = 333;
- t['logicalnot'] = 584;
- t['odieresis'] = 611;
- t['udieresis'] = 611;
- t['notequal'] = 549;
- t['gcommaaccent'] = 611;
- t['eth'] = 611;
- t['zcaron'] = 500;
- t['ncommaaccent'] = 611;
- t['onesuperior'] = 333;
- t['imacron'] = 278;
- t['Euro'] = 556;
- });
- t['Helvetica-BoldOblique'] = (0, _util.getLookupTableFactory)(function (t) {
- t['space'] = 278;
- t['exclam'] = 333;
- t['quotedbl'] = 474;
- t['numbersign'] = 556;
- t['dollar'] = 556;
- t['percent'] = 889;
- t['ampersand'] = 722;
- t['quoteright'] = 278;
- t['parenleft'] = 333;
- t['parenright'] = 333;
- t['asterisk'] = 389;
- t['plus'] = 584;
- t['comma'] = 278;
- t['hyphen'] = 333;
- t['period'] = 278;
- t['slash'] = 278;
- t['zero'] = 556;
- t['one'] = 556;
- t['two'] = 556;
- t['three'] = 556;
- t['four'] = 556;
- t['five'] = 556;
- t['six'] = 556;
- t['seven'] = 556;
- t['eight'] = 556;
- t['nine'] = 556;
- t['colon'] = 333;
- t['semicolon'] = 333;
- t['less'] = 584;
- t['equal'] = 584;
- t['greater'] = 584;
- t['question'] = 611;
- t['at'] = 975;
- t['A'] = 722;
- t['B'] = 722;
- t['C'] = 722;
- t['D'] = 722;
- t['E'] = 667;
- t['F'] = 611;
- t['G'] = 778;
- t['H'] = 722;
- t['I'] = 278;
- t['J'] = 556;
- t['K'] = 722;
- t['L'] = 611;
- t['M'] = 833;
- t['N'] = 722;
- t['O'] = 778;
- t['P'] = 667;
- t['Q'] = 778;
- t['R'] = 722;
- t['S'] = 667;
- t['T'] = 611;
- t['U'] = 722;
- t['V'] = 667;
- t['W'] = 944;
- t['X'] = 667;
- t['Y'] = 667;
- t['Z'] = 611;
- t['bracketleft'] = 333;
- t['backslash'] = 278;
- t['bracketright'] = 333;
- t['asciicircum'] = 584;
- t['underscore'] = 556;
- t['quoteleft'] = 278;
- t['a'] = 556;
- t['b'] = 611;
- t['c'] = 556;
- t['d'] = 611;
- t['e'] = 556;
- t['f'] = 333;
- t['g'] = 611;
- t['h'] = 611;
- t['i'] = 278;
- t['j'] = 278;
- t['k'] = 556;
- t['l'] = 278;
- t['m'] = 889;
- t['n'] = 611;
- t['o'] = 611;
- t['p'] = 611;
- t['q'] = 611;
- t['r'] = 389;
- t['s'] = 556;
- t['t'] = 333;
- t['u'] = 611;
- t['v'] = 556;
- t['w'] = 778;
- t['x'] = 556;
- t['y'] = 556;
- t['z'] = 500;
- t['braceleft'] = 389;
- t['bar'] = 280;
- t['braceright'] = 389;
- t['asciitilde'] = 584;
- t['exclamdown'] = 333;
- t['cent'] = 556;
- t['sterling'] = 556;
- t['fraction'] = 167;
- t['yen'] = 556;
- t['florin'] = 556;
- t['section'] = 556;
- t['currency'] = 556;
- t['quotesingle'] = 238;
- t['quotedblleft'] = 500;
- t['guillemotleft'] = 556;
- t['guilsinglleft'] = 333;
- t['guilsinglright'] = 333;
- t['fi'] = 611;
- t['fl'] = 611;
- t['endash'] = 556;
- t['dagger'] = 556;
- t['daggerdbl'] = 556;
- t['periodcentered'] = 278;
- t['paragraph'] = 556;
- t['bullet'] = 350;
- t['quotesinglbase'] = 278;
- t['quotedblbase'] = 500;
- t['quotedblright'] = 500;
- t['guillemotright'] = 556;
- t['ellipsis'] = 1000;
- t['perthousand'] = 1000;
- t['questiondown'] = 611;
- t['grave'] = 333;
- t['acute'] = 333;
- t['circumflex'] = 333;
- t['tilde'] = 333;
- t['macron'] = 333;
- t['breve'] = 333;
- t['dotaccent'] = 333;
- t['dieresis'] = 333;
- t['ring'] = 333;
- t['cedilla'] = 333;
- t['hungarumlaut'] = 333;
- t['ogonek'] = 333;
- t['caron'] = 333;
- t['emdash'] = 1000;
- t['AE'] = 1000;
- t['ordfeminine'] = 370;
- t['Lslash'] = 611;
- t['Oslash'] = 778;
- t['OE'] = 1000;
- t['ordmasculine'] = 365;
- t['ae'] = 889;
- t['dotlessi'] = 278;
- t['lslash'] = 278;
- t['oslash'] = 611;
- t['oe'] = 944;
- t['germandbls'] = 611;
- t['Idieresis'] = 278;
- t['eacute'] = 556;
- t['abreve'] = 556;
- t['uhungarumlaut'] = 611;
- t['ecaron'] = 556;
- t['Ydieresis'] = 667;
- t['divide'] = 584;
- t['Yacute'] = 667;
- t['Acircumflex'] = 722;
- t['aacute'] = 556;
- t['Ucircumflex'] = 722;
- t['yacute'] = 556;
- t['scommaaccent'] = 556;
- t['ecircumflex'] = 556;
- t['Uring'] = 722;
- t['Udieresis'] = 722;
- t['aogonek'] = 556;
- t['Uacute'] = 722;
- t['uogonek'] = 611;
- t['Edieresis'] = 667;
- t['Dcroat'] = 722;
- t['commaaccent'] = 250;
- t['copyright'] = 737;
- t['Emacron'] = 667;
- t['ccaron'] = 556;
- t['aring'] = 556;
- t['Ncommaaccent'] = 722;
- t['lacute'] = 278;
- t['agrave'] = 556;
- t['Tcommaaccent'] = 611;
- t['Cacute'] = 722;
- t['atilde'] = 556;
- t['Edotaccent'] = 667;
- t['scaron'] = 556;
- t['scedilla'] = 556;
- t['iacute'] = 278;
- t['lozenge'] = 494;
- t['Rcaron'] = 722;
- t['Gcommaaccent'] = 778;
- t['ucircumflex'] = 611;
- t['acircumflex'] = 556;
- t['Amacron'] = 722;
- t['rcaron'] = 389;
- t['ccedilla'] = 556;
- t['Zdotaccent'] = 611;
- t['Thorn'] = 667;
- t['Omacron'] = 778;
- t['Racute'] = 722;
- t['Sacute'] = 667;
- t['dcaron'] = 743;
- t['Umacron'] = 722;
- t['uring'] = 611;
- t['threesuperior'] = 333;
- t['Ograve'] = 778;
- t['Agrave'] = 722;
- t['Abreve'] = 722;
- t['multiply'] = 584;
- t['uacute'] = 611;
- t['Tcaron'] = 611;
- t['partialdiff'] = 494;
- t['ydieresis'] = 556;
- t['Nacute'] = 722;
- t['icircumflex'] = 278;
- t['Ecircumflex'] = 667;
- t['adieresis'] = 556;
- t['edieresis'] = 556;
- t['cacute'] = 556;
- t['nacute'] = 611;
- t['umacron'] = 611;
- t['Ncaron'] = 722;
- t['Iacute'] = 278;
- t['plusminus'] = 584;
- t['brokenbar'] = 280;
- t['registered'] = 737;
- t['Gbreve'] = 778;
- t['Idotaccent'] = 278;
- t['summation'] = 600;
- t['Egrave'] = 667;
- t['racute'] = 389;
- t['omacron'] = 611;
- t['Zacute'] = 611;
- t['Zcaron'] = 611;
- t['greaterequal'] = 549;
- t['Eth'] = 722;
- t['Ccedilla'] = 722;
- t['lcommaaccent'] = 278;
- t['tcaron'] = 389;
- t['eogonek'] = 556;
- t['Uogonek'] = 722;
- t['Aacute'] = 722;
- t['Adieresis'] = 722;
- t['egrave'] = 556;
- t['zacute'] = 500;
- t['iogonek'] = 278;
- t['Oacute'] = 778;
- t['oacute'] = 611;
- t['amacron'] = 556;
- t['sacute'] = 556;
- t['idieresis'] = 278;
- t['Ocircumflex'] = 778;
- t['Ugrave'] = 722;
- t['Delta'] = 612;
- t['thorn'] = 611;
- t['twosuperior'] = 333;
- t['Odieresis'] = 778;
- t['mu'] = 611;
- t['igrave'] = 278;
- t['ohungarumlaut'] = 611;
- t['Eogonek'] = 667;
- t['dcroat'] = 611;
- t['threequarters'] = 834;
- t['Scedilla'] = 667;
- t['lcaron'] = 400;
- t['Kcommaaccent'] = 722;
- t['Lacute'] = 611;
- t['trademark'] = 1000;
- t['edotaccent'] = 556;
- t['Igrave'] = 278;
- t['Imacron'] = 278;
- t['Lcaron'] = 611;
- t['onehalf'] = 834;
- t['lessequal'] = 549;
- t['ocircumflex'] = 611;
- t['ntilde'] = 611;
- t['Uhungarumlaut'] = 722;
- t['Eacute'] = 667;
- t['emacron'] = 556;
- t['gbreve'] = 611;
- t['onequarter'] = 834;
- t['Scaron'] = 667;
- t['Scommaaccent'] = 667;
- t['Ohungarumlaut'] = 778;
- t['degree'] = 400;
- t['ograve'] = 611;
- t['Ccaron'] = 722;
- t['ugrave'] = 611;
- t['radical'] = 549;
- t['Dcaron'] = 722;
- t['rcommaaccent'] = 389;
- t['Ntilde'] = 722;
- t['otilde'] = 611;
- t['Rcommaaccent'] = 722;
- t['Lcommaaccent'] = 611;
- t['Atilde'] = 722;
- t['Aogonek'] = 722;
- t['Aring'] = 722;
- t['Otilde'] = 778;
- t['zdotaccent'] = 500;
- t['Ecaron'] = 667;
- t['Iogonek'] = 278;
- t['kcommaaccent'] = 556;
- t['minus'] = 584;
- t['Icircumflex'] = 278;
- t['ncaron'] = 611;
- t['tcommaaccent'] = 333;
- t['logicalnot'] = 584;
- t['odieresis'] = 611;
- t['udieresis'] = 611;
- t['notequal'] = 549;
- t['gcommaaccent'] = 611;
- t['eth'] = 611;
- t['zcaron'] = 500;
- t['ncommaaccent'] = 611;
- t['onesuperior'] = 333;
- t['imacron'] = 278;
- t['Euro'] = 556;
- });
- t['Helvetica-Oblique'] = (0, _util.getLookupTableFactory)(function (t) {
- t['space'] = 278;
- t['exclam'] = 278;
- t['quotedbl'] = 355;
- t['numbersign'] = 556;
- t['dollar'] = 556;
- t['percent'] = 889;
- t['ampersand'] = 667;
- t['quoteright'] = 222;
- t['parenleft'] = 333;
- t['parenright'] = 333;
- t['asterisk'] = 389;
- t['plus'] = 584;
- t['comma'] = 278;
- t['hyphen'] = 333;
- t['period'] = 278;
- t['slash'] = 278;
- t['zero'] = 556;
- t['one'] = 556;
- t['two'] = 556;
- t['three'] = 556;
- t['four'] = 556;
- t['five'] = 556;
- t['six'] = 556;
- t['seven'] = 556;
- t['eight'] = 556;
- t['nine'] = 556;
- t['colon'] = 278;
- t['semicolon'] = 278;
- t['less'] = 584;
- t['equal'] = 584;
- t['greater'] = 584;
- t['question'] = 556;
- t['at'] = 1015;
- t['A'] = 667;
- t['B'] = 667;
- t['C'] = 722;
- t['D'] = 722;
- t['E'] = 667;
- t['F'] = 611;
- t['G'] = 778;
- t['H'] = 722;
- t['I'] = 278;
- t['J'] = 500;
- t['K'] = 667;
- t['L'] = 556;
- t['M'] = 833;
- t['N'] = 722;
- t['O'] = 778;
- t['P'] = 667;
- t['Q'] = 778;
- t['R'] = 722;
- t['S'] = 667;
- t['T'] = 611;
- t['U'] = 722;
- t['V'] = 667;
- t['W'] = 944;
- t['X'] = 667;
- t['Y'] = 667;
- t['Z'] = 611;
- t['bracketleft'] = 278;
- t['backslash'] = 278;
- t['bracketright'] = 278;
- t['asciicircum'] = 469;
- t['underscore'] = 556;
- t['quoteleft'] = 222;
- t['a'] = 556;
- t['b'] = 556;
- t['c'] = 500;
- t['d'] = 556;
- t['e'] = 556;
- t['f'] = 278;
- t['g'] = 556;
- t['h'] = 556;
- t['i'] = 222;
- t['j'] = 222;
- t['k'] = 500;
- t['l'] = 222;
- t['m'] = 833;
- t['n'] = 556;
- t['o'] = 556;
- t['p'] = 556;
- t['q'] = 556;
- t['r'] = 333;
- t['s'] = 500;
- t['t'] = 278;
- t['u'] = 556;
- t['v'] = 500;
- t['w'] = 722;
- t['x'] = 500;
- t['y'] = 500;
- t['z'] = 500;
- t['braceleft'] = 334;
- t['bar'] = 260;
- t['braceright'] = 334;
- t['asciitilde'] = 584;
- t['exclamdown'] = 333;
- t['cent'] = 556;
- t['sterling'] = 556;
- t['fraction'] = 167;
- t['yen'] = 556;
- t['florin'] = 556;
- t['section'] = 556;
- t['currency'] = 556;
- t['quotesingle'] = 191;
- t['quotedblleft'] = 333;
- t['guillemotleft'] = 556;
- t['guilsinglleft'] = 333;
- t['guilsinglright'] = 333;
- t['fi'] = 500;
- t['fl'] = 500;
- t['endash'] = 556;
- t['dagger'] = 556;
- t['daggerdbl'] = 556;
- t['periodcentered'] = 278;
- t['paragraph'] = 537;
- t['bullet'] = 350;
- t['quotesinglbase'] = 222;
- t['quotedblbase'] = 333;
- t['quotedblright'] = 333;
- t['guillemotright'] = 556;
- t['ellipsis'] = 1000;
- t['perthousand'] = 1000;
- t['questiondown'] = 611;
- t['grave'] = 333;
- t['acute'] = 333;
- t['circumflex'] = 333;
- t['tilde'] = 333;
- t['macron'] = 333;
- t['breve'] = 333;
- t['dotaccent'] = 333;
- t['dieresis'] = 333;
- t['ring'] = 333;
- t['cedilla'] = 333;
- t['hungarumlaut'] = 333;
- t['ogonek'] = 333;
- t['caron'] = 333;
- t['emdash'] = 1000;
- t['AE'] = 1000;
- t['ordfeminine'] = 370;
- t['Lslash'] = 556;
- t['Oslash'] = 778;
- t['OE'] = 1000;
- t['ordmasculine'] = 365;
- t['ae'] = 889;
- t['dotlessi'] = 278;
- t['lslash'] = 222;
- t['oslash'] = 611;
- t['oe'] = 944;
- t['germandbls'] = 611;
- t['Idieresis'] = 278;
- t['eacute'] = 556;
- t['abreve'] = 556;
- t['uhungarumlaut'] = 556;
- t['ecaron'] = 556;
- t['Ydieresis'] = 667;
- t['divide'] = 584;
- t['Yacute'] = 667;
- t['Acircumflex'] = 667;
- t['aacute'] = 556;
- t['Ucircumflex'] = 722;
- t['yacute'] = 500;
- t['scommaaccent'] = 500;
- t['ecircumflex'] = 556;
- t['Uring'] = 722;
- t['Udieresis'] = 722;
- t['aogonek'] = 556;
- t['Uacute'] = 722;
- t['uogonek'] = 556;
- t['Edieresis'] = 667;
- t['Dcroat'] = 722;
- t['commaaccent'] = 250;
- t['copyright'] = 737;
- t['Emacron'] = 667;
- t['ccaron'] = 500;
- t['aring'] = 556;
- t['Ncommaaccent'] = 722;
- t['lacute'] = 222;
- t['agrave'] = 556;
- t['Tcommaaccent'] = 611;
- t['Cacute'] = 722;
- t['atilde'] = 556;
- t['Edotaccent'] = 667;
- t['scaron'] = 500;
- t['scedilla'] = 500;
- t['iacute'] = 278;
- t['lozenge'] = 471;
- t['Rcaron'] = 722;
- t['Gcommaaccent'] = 778;
- t['ucircumflex'] = 556;
- t['acircumflex'] = 556;
- t['Amacron'] = 667;
- t['rcaron'] = 333;
- t['ccedilla'] = 500;
- t['Zdotaccent'] = 611;
- t['Thorn'] = 667;
- t['Omacron'] = 778;
- t['Racute'] = 722;
- t['Sacute'] = 667;
- t['dcaron'] = 643;
- t['Umacron'] = 722;
- t['uring'] = 556;
- t['threesuperior'] = 333;
- t['Ograve'] = 778;
- t['Agrave'] = 667;
- t['Abreve'] = 667;
- t['multiply'] = 584;
- t['uacute'] = 556;
- t['Tcaron'] = 611;
- t['partialdiff'] = 476;
- t['ydieresis'] = 500;
- t['Nacute'] = 722;
- t['icircumflex'] = 278;
- t['Ecircumflex'] = 667;
- t['adieresis'] = 556;
- t['edieresis'] = 556;
- t['cacute'] = 500;
- t['nacute'] = 556;
- t['umacron'] = 556;
- t['Ncaron'] = 722;
- t['Iacute'] = 278;
- t['plusminus'] = 584;
- t['brokenbar'] = 260;
- t['registered'] = 737;
- t['Gbreve'] = 778;
- t['Idotaccent'] = 278;
- t['summation'] = 600;
- t['Egrave'] = 667;
- t['racute'] = 333;
- t['omacron'] = 556;
- t['Zacute'] = 611;
- t['Zcaron'] = 611;
- t['greaterequal'] = 549;
- t['Eth'] = 722;
- t['Ccedilla'] = 722;
- t['lcommaaccent'] = 222;
- t['tcaron'] = 317;
- t['eogonek'] = 556;
- t['Uogonek'] = 722;
- t['Aacute'] = 667;
- t['Adieresis'] = 667;
- t['egrave'] = 556;
- t['zacute'] = 500;
- t['iogonek'] = 222;
- t['Oacute'] = 778;
- t['oacute'] = 556;
- t['amacron'] = 556;
- t['sacute'] = 500;
- t['idieresis'] = 278;
- t['Ocircumflex'] = 778;
- t['Ugrave'] = 722;
- t['Delta'] = 612;
- t['thorn'] = 556;
- t['twosuperior'] = 333;
- t['Odieresis'] = 778;
- t['mu'] = 556;
- t['igrave'] = 278;
- t['ohungarumlaut'] = 556;
- t['Eogonek'] = 667;
- t['dcroat'] = 556;
- t['threequarters'] = 834;
- t['Scedilla'] = 667;
- t['lcaron'] = 299;
- t['Kcommaaccent'] = 667;
- t['Lacute'] = 556;
- t['trademark'] = 1000;
- t['edotaccent'] = 556;
- t['Igrave'] = 278;
- t['Imacron'] = 278;
- t['Lcaron'] = 556;
- t['onehalf'] = 834;
- t['lessequal'] = 549;
- t['ocircumflex'] = 556;
- t['ntilde'] = 556;
- t['Uhungarumlaut'] = 722;
- t['Eacute'] = 667;
- t['emacron'] = 556;
- t['gbreve'] = 556;
- t['onequarter'] = 834;
- t['Scaron'] = 667;
- t['Scommaaccent'] = 667;
- t['Ohungarumlaut'] = 778;
- t['degree'] = 400;
- t['ograve'] = 556;
- t['Ccaron'] = 722;
- t['ugrave'] = 556;
- t['radical'] = 453;
- t['Dcaron'] = 722;
- t['rcommaaccent'] = 333;
- t['Ntilde'] = 722;
- t['otilde'] = 556;
- t['Rcommaaccent'] = 722;
- t['Lcommaaccent'] = 556;
- t['Atilde'] = 667;
- t['Aogonek'] = 667;
- t['Aring'] = 667;
- t['Otilde'] = 778;
- t['zdotaccent'] = 500;
- t['Ecaron'] = 667;
- t['Iogonek'] = 278;
- t['kcommaaccent'] = 500;
- t['minus'] = 584;
- t['Icircumflex'] = 278;
- t['ncaron'] = 556;
- t['tcommaaccent'] = 278;
- t['logicalnot'] = 584;
- t['odieresis'] = 556;
- t['udieresis'] = 556;
- t['notequal'] = 549;
- t['gcommaaccent'] = 556;
- t['eth'] = 556;
- t['zcaron'] = 500;
- t['ncommaaccent'] = 556;
- t['onesuperior'] = 333;
- t['imacron'] = 278;
- t['Euro'] = 556;
- });
- t['Symbol'] = (0, _util.getLookupTableFactory)(function (t) {
- t['space'] = 250;
- t['exclam'] = 333;
- t['universal'] = 713;
- t['numbersign'] = 500;
- t['existential'] = 549;
- t['percent'] = 833;
- t['ampersand'] = 778;
- t['suchthat'] = 439;
- t['parenleft'] = 333;
- t['parenright'] = 333;
- t['asteriskmath'] = 500;
- t['plus'] = 549;
- t['comma'] = 250;
- t['minus'] = 549;
- t['period'] = 250;
- t['slash'] = 278;
- t['zero'] = 500;
- t['one'] = 500;
- t['two'] = 500;
- t['three'] = 500;
- t['four'] = 500;
- t['five'] = 500;
- t['six'] = 500;
- t['seven'] = 500;
- t['eight'] = 500;
- t['nine'] = 500;
- t['colon'] = 278;
- t['semicolon'] = 278;
- t['less'] = 549;
- t['equal'] = 549;
- t['greater'] = 549;
- t['question'] = 444;
- t['congruent'] = 549;
- t['Alpha'] = 722;
- t['Beta'] = 667;
- t['Chi'] = 722;
- t['Delta'] = 612;
- t['Epsilon'] = 611;
- t['Phi'] = 763;
- t['Gamma'] = 603;
- t['Eta'] = 722;
- t['Iota'] = 333;
- t['theta1'] = 631;
- t['Kappa'] = 722;
- t['Lambda'] = 686;
- t['Mu'] = 889;
- t['Nu'] = 722;
- t['Omicron'] = 722;
- t['Pi'] = 768;
- t['Theta'] = 741;
- t['Rho'] = 556;
- t['Sigma'] = 592;
- t['Tau'] = 611;
- t['Upsilon'] = 690;
- t['sigma1'] = 439;
- t['Omega'] = 768;
- t['Xi'] = 645;
- t['Psi'] = 795;
- t['Zeta'] = 611;
- t['bracketleft'] = 333;
- t['therefore'] = 863;
- t['bracketright'] = 333;
- t['perpendicular'] = 658;
- t['underscore'] = 500;
- t['radicalex'] = 500;
- t['alpha'] = 631;
- t['beta'] = 549;
- t['chi'] = 549;
- t['delta'] = 494;
- t['epsilon'] = 439;
- t['phi'] = 521;
- t['gamma'] = 411;
- t['eta'] = 603;
- t['iota'] = 329;
- t['phi1'] = 603;
- t['kappa'] = 549;
- t['lambda'] = 549;
- t['mu'] = 576;
- t['nu'] = 521;
- t['omicron'] = 549;
- t['pi'] = 549;
- t['theta'] = 521;
- t['rho'] = 549;
- t['sigma'] = 603;
- t['tau'] = 439;
- t['upsilon'] = 576;
- t['omega1'] = 713;
- t['omega'] = 686;
- t['xi'] = 493;
- t['psi'] = 686;
- t['zeta'] = 494;
- t['braceleft'] = 480;
- t['bar'] = 200;
- t['braceright'] = 480;
- t['similar'] = 549;
- t['Euro'] = 750;
- t['Upsilon1'] = 620;
- t['minute'] = 247;
- t['lessequal'] = 549;
- t['fraction'] = 167;
- t['infinity'] = 713;
- t['florin'] = 500;
- t['club'] = 753;
- t['diamond'] = 753;
- t['heart'] = 753;
- t['spade'] = 753;
- t['arrowboth'] = 1042;
- t['arrowleft'] = 987;
- t['arrowup'] = 603;
- t['arrowright'] = 987;
- t['arrowdown'] = 603;
- t['degree'] = 400;
- t['plusminus'] = 549;
- t['second'] = 411;
- t['greaterequal'] = 549;
- t['multiply'] = 549;
- t['proportional'] = 713;
- t['partialdiff'] = 494;
- t['bullet'] = 460;
- t['divide'] = 549;
- t['notequal'] = 549;
- t['equivalence'] = 549;
- t['approxequal'] = 549;
- t['ellipsis'] = 1000;
- t['arrowvertex'] = 603;
- t['arrowhorizex'] = 1000;
- t['carriagereturn'] = 658;
- t['aleph'] = 823;
- t['Ifraktur'] = 686;
- t['Rfraktur'] = 795;
- t['weierstrass'] = 987;
- t['circlemultiply'] = 768;
- t['circleplus'] = 768;
- t['emptyset'] = 823;
- t['intersection'] = 768;
- t['union'] = 768;
- t['propersuperset'] = 713;
- t['reflexsuperset'] = 713;
- t['notsubset'] = 713;
- t['propersubset'] = 713;
- t['reflexsubset'] = 713;
- t['element'] = 713;
- t['notelement'] = 713;
- t['angle'] = 768;
- t['gradient'] = 713;
- t['registerserif'] = 790;
- t['copyrightserif'] = 790;
- t['trademarkserif'] = 890;
- t['product'] = 823;
- t['radical'] = 549;
- t['dotmath'] = 250;
- t['logicalnot'] = 713;
- t['logicaland'] = 603;
- t['logicalor'] = 603;
- t['arrowdblboth'] = 1042;
- t['arrowdblleft'] = 987;
- t['arrowdblup'] = 603;
- t['arrowdblright'] = 987;
- t['arrowdbldown'] = 603;
- t['lozenge'] = 494;
- t['angleleft'] = 329;
- t['registersans'] = 790;
- t['copyrightsans'] = 790;
- t['trademarksans'] = 786;
- t['summation'] = 713;
- t['parenlefttp'] = 384;
- t['parenleftex'] = 384;
- t['parenleftbt'] = 384;
- t['bracketlefttp'] = 384;
- t['bracketleftex'] = 384;
- t['bracketleftbt'] = 384;
- t['bracelefttp'] = 494;
- t['braceleftmid'] = 494;
- t['braceleftbt'] = 494;
- t['braceex'] = 494;
- t['angleright'] = 329;
- t['integral'] = 274;
- t['integraltp'] = 686;
- t['integralex'] = 686;
- t['integralbt'] = 686;
- t['parenrighttp'] = 384;
- t['parenrightex'] = 384;
- t['parenrightbt'] = 384;
- t['bracketrighttp'] = 384;
- t['bracketrightex'] = 384;
- t['bracketrightbt'] = 384;
- t['bracerighttp'] = 494;
- t['bracerightmid'] = 494;
- t['bracerightbt'] = 494;
- t['apple'] = 790;
- });
- t['Times-Roman'] = (0, _util.getLookupTableFactory)(function (t) {
- t['space'] = 250;
- t['exclam'] = 333;
- t['quotedbl'] = 408;
- t['numbersign'] = 500;
- t['dollar'] = 500;
- t['percent'] = 833;
- t['ampersand'] = 778;
- t['quoteright'] = 333;
- t['parenleft'] = 333;
- t['parenright'] = 333;
- t['asterisk'] = 500;
- t['plus'] = 564;
- t['comma'] = 250;
- t['hyphen'] = 333;
- t['period'] = 250;
- t['slash'] = 278;
- t['zero'] = 500;
- t['one'] = 500;
- t['two'] = 500;
- t['three'] = 500;
- t['four'] = 500;
- t['five'] = 500;
- t['six'] = 500;
- t['seven'] = 500;
- t['eight'] = 500;
- t['nine'] = 500;
- t['colon'] = 278;
- t['semicolon'] = 278;
- t['less'] = 564;
- t['equal'] = 564;
- t['greater'] = 564;
- t['question'] = 444;
- t['at'] = 921;
- t['A'] = 722;
- t['B'] = 667;
- t['C'] = 667;
- t['D'] = 722;
- t['E'] = 611;
- t['F'] = 556;
- t['G'] = 722;
- t['H'] = 722;
- t['I'] = 333;
- t['J'] = 389;
- t['K'] = 722;
- t['L'] = 611;
- t['M'] = 889;
- t['N'] = 722;
- t['O'] = 722;
- t['P'] = 556;
- t['Q'] = 722;
- t['R'] = 667;
- t['S'] = 556;
- t['T'] = 611;
- t['U'] = 722;
- t['V'] = 722;
- t['W'] = 944;
- t['X'] = 722;
- t['Y'] = 722;
- t['Z'] = 611;
- t['bracketleft'] = 333;
- t['backslash'] = 278;
- t['bracketright'] = 333;
- t['asciicircum'] = 469;
- t['underscore'] = 500;
- t['quoteleft'] = 333;
- t['a'] = 444;
- t['b'] = 500;
- t['c'] = 444;
- t['d'] = 500;
- t['e'] = 444;
- t['f'] = 333;
- t['g'] = 500;
- t['h'] = 500;
- t['i'] = 278;
- t['j'] = 278;
- t['k'] = 500;
- t['l'] = 278;
- t['m'] = 778;
- t['n'] = 500;
- t['o'] = 500;
- t['p'] = 500;
- t['q'] = 500;
- t['r'] = 333;
- t['s'] = 389;
- t['t'] = 278;
- t['u'] = 500;
- t['v'] = 500;
- t['w'] = 722;
- t['x'] = 500;
- t['y'] = 500;
- t['z'] = 444;
- t['braceleft'] = 480;
- t['bar'] = 200;
- t['braceright'] = 480;
- t['asciitilde'] = 541;
- t['exclamdown'] = 333;
- t['cent'] = 500;
- t['sterling'] = 500;
- t['fraction'] = 167;
- t['yen'] = 500;
- t['florin'] = 500;
- t['section'] = 500;
- t['currency'] = 500;
- t['quotesingle'] = 180;
- t['quotedblleft'] = 444;
- t['guillemotleft'] = 500;
- t['guilsinglleft'] = 333;
- t['guilsinglright'] = 333;
- t['fi'] = 556;
- t['fl'] = 556;
- t['endash'] = 500;
- t['dagger'] = 500;
- t['daggerdbl'] = 500;
- t['periodcentered'] = 250;
- t['paragraph'] = 453;
- t['bullet'] = 350;
- t['quotesinglbase'] = 333;
- t['quotedblbase'] = 444;
- t['quotedblright'] = 444;
- t['guillemotright'] = 500;
- t['ellipsis'] = 1000;
- t['perthousand'] = 1000;
- t['questiondown'] = 444;
- t['grave'] = 333;
- t['acute'] = 333;
- t['circumflex'] = 333;
- t['tilde'] = 333;
- t['macron'] = 333;
- t['breve'] = 333;
- t['dotaccent'] = 333;
- t['dieresis'] = 333;
- t['ring'] = 333;
- t['cedilla'] = 333;
- t['hungarumlaut'] = 333;
- t['ogonek'] = 333;
- t['caron'] = 333;
- t['emdash'] = 1000;
- t['AE'] = 889;
- t['ordfeminine'] = 276;
- t['Lslash'] = 611;
- t['Oslash'] = 722;
- t['OE'] = 889;
- t['ordmasculine'] = 310;
- t['ae'] = 667;
- t['dotlessi'] = 278;
- t['lslash'] = 278;
- t['oslash'] = 500;
- t['oe'] = 722;
- t['germandbls'] = 500;
- t['Idieresis'] = 333;
- t['eacute'] = 444;
- t['abreve'] = 444;
- t['uhungarumlaut'] = 500;
- t['ecaron'] = 444;
- t['Ydieresis'] = 722;
- t['divide'] = 564;
- t['Yacute'] = 722;
- t['Acircumflex'] = 722;
- t['aacute'] = 444;
- t['Ucircumflex'] = 722;
- t['yacute'] = 500;
- t['scommaaccent'] = 389;
- t['ecircumflex'] = 444;
- t['Uring'] = 722;
- t['Udieresis'] = 722;
- t['aogonek'] = 444;
- t['Uacute'] = 722;
- t['uogonek'] = 500;
- t['Edieresis'] = 611;
- t['Dcroat'] = 722;
- t['commaaccent'] = 250;
- t['copyright'] = 760;
- t['Emacron'] = 611;
- t['ccaron'] = 444;
- t['aring'] = 444;
- t['Ncommaaccent'] = 722;
- t['lacute'] = 278;
- t['agrave'] = 444;
- t['Tcommaaccent'] = 611;
- t['Cacute'] = 667;
- t['atilde'] = 444;
- t['Edotaccent'] = 611;
- t['scaron'] = 389;
- t['scedilla'] = 389;
- t['iacute'] = 278;
- t['lozenge'] = 471;
- t['Rcaron'] = 667;
- t['Gcommaaccent'] = 722;
- t['ucircumflex'] = 500;
- t['acircumflex'] = 444;
- t['Amacron'] = 722;
- t['rcaron'] = 333;
- t['ccedilla'] = 444;
- t['Zdotaccent'] = 611;
- t['Thorn'] = 556;
- t['Omacron'] = 722;
- t['Racute'] = 667;
- t['Sacute'] = 556;
- t['dcaron'] = 588;
- t['Umacron'] = 722;
- t['uring'] = 500;
- t['threesuperior'] = 300;
- t['Ograve'] = 722;
- t['Agrave'] = 722;
- t['Abreve'] = 722;
- t['multiply'] = 564;
- t['uacute'] = 500;
- t['Tcaron'] = 611;
- t['partialdiff'] = 476;
- t['ydieresis'] = 500;
- t['Nacute'] = 722;
- t['icircumflex'] = 278;
- t['Ecircumflex'] = 611;
- t['adieresis'] = 444;
- t['edieresis'] = 444;
- t['cacute'] = 444;
- t['nacute'] = 500;
- t['umacron'] = 500;
- t['Ncaron'] = 722;
- t['Iacute'] = 333;
- t['plusminus'] = 564;
- t['brokenbar'] = 200;
- t['registered'] = 760;
- t['Gbreve'] = 722;
- t['Idotaccent'] = 333;
- t['summation'] = 600;
- t['Egrave'] = 611;
- t['racute'] = 333;
- t['omacron'] = 500;
- t['Zacute'] = 611;
- t['Zcaron'] = 611;
- t['greaterequal'] = 549;
- t['Eth'] = 722;
- t['Ccedilla'] = 667;
- t['lcommaaccent'] = 278;
- t['tcaron'] = 326;
- t['eogonek'] = 444;
- t['Uogonek'] = 722;
- t['Aacute'] = 722;
- t['Adieresis'] = 722;
- t['egrave'] = 444;
- t['zacute'] = 444;
- t['iogonek'] = 278;
- t['Oacute'] = 722;
- t['oacute'] = 500;
- t['amacron'] = 444;
- t['sacute'] = 389;
- t['idieresis'] = 278;
- t['Ocircumflex'] = 722;
- t['Ugrave'] = 722;
- t['Delta'] = 612;
- t['thorn'] = 500;
- t['twosuperior'] = 300;
- t['Odieresis'] = 722;
- t['mu'] = 500;
- t['igrave'] = 278;
- t['ohungarumlaut'] = 500;
- t['Eogonek'] = 611;
- t['dcroat'] = 500;
- t['threequarters'] = 750;
- t['Scedilla'] = 556;
- t['lcaron'] = 344;
- t['Kcommaaccent'] = 722;
- t['Lacute'] = 611;
- t['trademark'] = 980;
- t['edotaccent'] = 444;
- t['Igrave'] = 333;
- t['Imacron'] = 333;
- t['Lcaron'] = 611;
- t['onehalf'] = 750;
- t['lessequal'] = 549;
- t['ocircumflex'] = 500;
- t['ntilde'] = 500;
- t['Uhungarumlaut'] = 722;
- t['Eacute'] = 611;
- t['emacron'] = 444;
- t['gbreve'] = 500;
- t['onequarter'] = 750;
- t['Scaron'] = 556;
- t['Scommaaccent'] = 556;
- t['Ohungarumlaut'] = 722;
- t['degree'] = 400;
- t['ograve'] = 500;
- t['Ccaron'] = 667;
- t['ugrave'] = 500;
- t['radical'] = 453;
- t['Dcaron'] = 722;
- t['rcommaaccent'] = 333;
- t['Ntilde'] = 722;
- t['otilde'] = 500;
- t['Rcommaaccent'] = 667;
- t['Lcommaaccent'] = 611;
- t['Atilde'] = 722;
- t['Aogonek'] = 722;
- t['Aring'] = 722;
- t['Otilde'] = 722;
- t['zdotaccent'] = 444;
- t['Ecaron'] = 611;
- t['Iogonek'] = 333;
- t['kcommaaccent'] = 500;
- t['minus'] = 564;
- t['Icircumflex'] = 333;
- t['ncaron'] = 500;
- t['tcommaaccent'] = 278;
- t['logicalnot'] = 564;
- t['odieresis'] = 500;
- t['udieresis'] = 500;
- t['notequal'] = 549;
- t['gcommaaccent'] = 500;
- t['eth'] = 500;
- t['zcaron'] = 444;
- t['ncommaaccent'] = 500;
- t['onesuperior'] = 300;
- t['imacron'] = 278;
- t['Euro'] = 500;
- });
- t['Times-Bold'] = (0, _util.getLookupTableFactory)(function (t) {
- t['space'] = 250;
- t['exclam'] = 333;
- t['quotedbl'] = 555;
- t['numbersign'] = 500;
- t['dollar'] = 500;
- t['percent'] = 1000;
- t['ampersand'] = 833;
- t['quoteright'] = 333;
- t['parenleft'] = 333;
- t['parenright'] = 333;
- t['asterisk'] = 500;
- t['plus'] = 570;
- t['comma'] = 250;
- t['hyphen'] = 333;
- t['period'] = 250;
- t['slash'] = 278;
- t['zero'] = 500;
- t['one'] = 500;
- t['two'] = 500;
- t['three'] = 500;
- t['four'] = 500;
- t['five'] = 500;
- t['six'] = 500;
- t['seven'] = 500;
- t['eight'] = 500;
- t['nine'] = 500;
- t['colon'] = 333;
- t['semicolon'] = 333;
- t['less'] = 570;
- t['equal'] = 570;
- t['greater'] = 570;
- t['question'] = 500;
- t['at'] = 930;
- t['A'] = 722;
- t['B'] = 667;
- t['C'] = 722;
- t['D'] = 722;
- t['E'] = 667;
- t['F'] = 611;
- t['G'] = 778;
- t['H'] = 778;
- t['I'] = 389;
- t['J'] = 500;
- t['K'] = 778;
- t['L'] = 667;
- t['M'] = 944;
- t['N'] = 722;
- t['O'] = 778;
- t['P'] = 611;
- t['Q'] = 778;
- t['R'] = 722;
- t['S'] = 556;
- t['T'] = 667;
- t['U'] = 722;
- t['V'] = 722;
- t['W'] = 1000;
- t['X'] = 722;
- t['Y'] = 722;
- t['Z'] = 667;
- t['bracketleft'] = 333;
- t['backslash'] = 278;
- t['bracketright'] = 333;
- t['asciicircum'] = 581;
- t['underscore'] = 500;
- t['quoteleft'] = 333;
- t['a'] = 500;
- t['b'] = 556;
- t['c'] = 444;
- t['d'] = 556;
- t['e'] = 444;
- t['f'] = 333;
- t['g'] = 500;
- t['h'] = 556;
- t['i'] = 278;
- t['j'] = 333;
- t['k'] = 556;
- t['l'] = 278;
- t['m'] = 833;
- t['n'] = 556;
- t['o'] = 500;
- t['p'] = 556;
- t['q'] = 556;
- t['r'] = 444;
- t['s'] = 389;
- t['t'] = 333;
- t['u'] = 556;
- t['v'] = 500;
- t['w'] = 722;
- t['x'] = 500;
- t['y'] = 500;
- t['z'] = 444;
- t['braceleft'] = 394;
- t['bar'] = 220;
- t['braceright'] = 394;
- t['asciitilde'] = 520;
- t['exclamdown'] = 333;
- t['cent'] = 500;
- t['sterling'] = 500;
- t['fraction'] = 167;
- t['yen'] = 500;
- t['florin'] = 500;
- t['section'] = 500;
- t['currency'] = 500;
- t['quotesingle'] = 278;
- t['quotedblleft'] = 500;
- t['guillemotleft'] = 500;
- t['guilsinglleft'] = 333;
- t['guilsinglright'] = 333;
- t['fi'] = 556;
- t['fl'] = 556;
- t['endash'] = 500;
- t['dagger'] = 500;
- t['daggerdbl'] = 500;
- t['periodcentered'] = 250;
- t['paragraph'] = 540;
- t['bullet'] = 350;
- t['quotesinglbase'] = 333;
- t['quotedblbase'] = 500;
- t['quotedblright'] = 500;
- t['guillemotright'] = 500;
- t['ellipsis'] = 1000;
- t['perthousand'] = 1000;
- t['questiondown'] = 500;
- t['grave'] = 333;
- t['acute'] = 333;
- t['circumflex'] = 333;
- t['tilde'] = 333;
- t['macron'] = 333;
- t['breve'] = 333;
- t['dotaccent'] = 333;
- t['dieresis'] = 333;
- t['ring'] = 333;
- t['cedilla'] = 333;
- t['hungarumlaut'] = 333;
- t['ogonek'] = 333;
- t['caron'] = 333;
- t['emdash'] = 1000;
- t['AE'] = 1000;
- t['ordfeminine'] = 300;
- t['Lslash'] = 667;
- t['Oslash'] = 778;
- t['OE'] = 1000;
- t['ordmasculine'] = 330;
- t['ae'] = 722;
- t['dotlessi'] = 278;
- t['lslash'] = 278;
- t['oslash'] = 500;
- t['oe'] = 722;
- t['germandbls'] = 556;
- t['Idieresis'] = 389;
- t['eacute'] = 444;
- t['abreve'] = 500;
- t['uhungarumlaut'] = 556;
- t['ecaron'] = 444;
- t['Ydieresis'] = 722;
- t['divide'] = 570;
- t['Yacute'] = 722;
- t['Acircumflex'] = 722;
- t['aacute'] = 500;
- t['Ucircumflex'] = 722;
- t['yacute'] = 500;
- t['scommaaccent'] = 389;
- t['ecircumflex'] = 444;
- t['Uring'] = 722;
- t['Udieresis'] = 722;
- t['aogonek'] = 500;
- t['Uacute'] = 722;
- t['uogonek'] = 556;
- t['Edieresis'] = 667;
- t['Dcroat'] = 722;
- t['commaaccent'] = 250;
- t['copyright'] = 747;
- t['Emacron'] = 667;
- t['ccaron'] = 444;
- t['aring'] = 500;
- t['Ncommaaccent'] = 722;
- t['lacute'] = 278;
- t['agrave'] = 500;
- t['Tcommaaccent'] = 667;
- t['Cacute'] = 722;
- t['atilde'] = 500;
- t['Edotaccent'] = 667;
- t['scaron'] = 389;
- t['scedilla'] = 389;
- t['iacute'] = 278;
- t['lozenge'] = 494;
- t['Rcaron'] = 722;
- t['Gcommaaccent'] = 778;
- t['ucircumflex'] = 556;
- t['acircumflex'] = 500;
- t['Amacron'] = 722;
- t['rcaron'] = 444;
- t['ccedilla'] = 444;
- t['Zdotaccent'] = 667;
- t['Thorn'] = 611;
- t['Omacron'] = 778;
- t['Racute'] = 722;
- t['Sacute'] = 556;
- t['dcaron'] = 672;
- t['Umacron'] = 722;
- t['uring'] = 556;
- t['threesuperior'] = 300;
- t['Ograve'] = 778;
- t['Agrave'] = 722;
- t['Abreve'] = 722;
- t['multiply'] = 570;
- t['uacute'] = 556;
- t['Tcaron'] = 667;
- t['partialdiff'] = 494;
- t['ydieresis'] = 500;
- t['Nacute'] = 722;
- t['icircumflex'] = 278;
- t['Ecircumflex'] = 667;
- t['adieresis'] = 500;
- t['edieresis'] = 444;
- t['cacute'] = 444;
- t['nacute'] = 556;
- t['umacron'] = 556;
- t['Ncaron'] = 722;
- t['Iacute'] = 389;
- t['plusminus'] = 570;
- t['brokenbar'] = 220;
- t['registered'] = 747;
- t['Gbreve'] = 778;
- t['Idotaccent'] = 389;
- t['summation'] = 600;
- t['Egrave'] = 667;
- t['racute'] = 444;
- t['omacron'] = 500;
- t['Zacute'] = 667;
- t['Zcaron'] = 667;
- t['greaterequal'] = 549;
- t['Eth'] = 722;
- t['Ccedilla'] = 722;
- t['lcommaaccent'] = 278;
- t['tcaron'] = 416;
- t['eogonek'] = 444;
- t['Uogonek'] = 722;
- t['Aacute'] = 722;
- t['Adieresis'] = 722;
- t['egrave'] = 444;
- t['zacute'] = 444;
- t['iogonek'] = 278;
- t['Oacute'] = 778;
- t['oacute'] = 500;
- t['amacron'] = 500;
- t['sacute'] = 389;
- t['idieresis'] = 278;
- t['Ocircumflex'] = 778;
- t['Ugrave'] = 722;
- t['Delta'] = 612;
- t['thorn'] = 556;
- t['twosuperior'] = 300;
- t['Odieresis'] = 778;
- t['mu'] = 556;
- t['igrave'] = 278;
- t['ohungarumlaut'] = 500;
- t['Eogonek'] = 667;
- t['dcroat'] = 556;
- t['threequarters'] = 750;
- t['Scedilla'] = 556;
- t['lcaron'] = 394;
- t['Kcommaaccent'] = 778;
- t['Lacute'] = 667;
- t['trademark'] = 1000;
- t['edotaccent'] = 444;
- t['Igrave'] = 389;
- t['Imacron'] = 389;
- t['Lcaron'] = 667;
- t['onehalf'] = 750;
- t['lessequal'] = 549;
- t['ocircumflex'] = 500;
- t['ntilde'] = 556;
- t['Uhungarumlaut'] = 722;
- t['Eacute'] = 667;
- t['emacron'] = 444;
- t['gbreve'] = 500;
- t['onequarter'] = 750;
- t['Scaron'] = 556;
- t['Scommaaccent'] = 556;
- t['Ohungarumlaut'] = 778;
- t['degree'] = 400;
- t['ograve'] = 500;
- t['Ccaron'] = 722;
- t['ugrave'] = 556;
- t['radical'] = 549;
- t['Dcaron'] = 722;
- t['rcommaaccent'] = 444;
- t['Ntilde'] = 722;
- t['otilde'] = 500;
- t['Rcommaaccent'] = 722;
- t['Lcommaaccent'] = 667;
- t['Atilde'] = 722;
- t['Aogonek'] = 722;
- t['Aring'] = 722;
- t['Otilde'] = 778;
- t['zdotaccent'] = 444;
- t['Ecaron'] = 667;
- t['Iogonek'] = 389;
- t['kcommaaccent'] = 556;
- t['minus'] = 570;
- t['Icircumflex'] = 389;
- t['ncaron'] = 556;
- t['tcommaaccent'] = 333;
- t['logicalnot'] = 570;
- t['odieresis'] = 500;
- t['udieresis'] = 556;
- t['notequal'] = 549;
- t['gcommaaccent'] = 500;
- t['eth'] = 500;
- t['zcaron'] = 444;
- t['ncommaaccent'] = 556;
- t['onesuperior'] = 300;
- t['imacron'] = 278;
- t['Euro'] = 500;
- });
- t['Times-BoldItalic'] = (0, _util.getLookupTableFactory)(function (t) {
- t['space'] = 250;
- t['exclam'] = 389;
- t['quotedbl'] = 555;
- t['numbersign'] = 500;
- t['dollar'] = 500;
- t['percent'] = 833;
- t['ampersand'] = 778;
- t['quoteright'] = 333;
- t['parenleft'] = 333;
- t['parenright'] = 333;
- t['asterisk'] = 500;
- t['plus'] = 570;
- t['comma'] = 250;
- t['hyphen'] = 333;
- t['period'] = 250;
- t['slash'] = 278;
- t['zero'] = 500;
- t['one'] = 500;
- t['two'] = 500;
- t['three'] = 500;
- t['four'] = 500;
- t['five'] = 500;
- t['six'] = 500;
- t['seven'] = 500;
- t['eight'] = 500;
- t['nine'] = 500;
- t['colon'] = 333;
- t['semicolon'] = 333;
- t['less'] = 570;
- t['equal'] = 570;
- t['greater'] = 570;
- t['question'] = 500;
- t['at'] = 832;
- t['A'] = 667;
- t['B'] = 667;
- t['C'] = 667;
- t['D'] = 722;
- t['E'] = 667;
- t['F'] = 667;
- t['G'] = 722;
- t['H'] = 778;
- t['I'] = 389;
- t['J'] = 500;
- t['K'] = 667;
- t['L'] = 611;
- t['M'] = 889;
- t['N'] = 722;
- t['O'] = 722;
- t['P'] = 611;
- t['Q'] = 722;
- t['R'] = 667;
- t['S'] = 556;
- t['T'] = 611;
- t['U'] = 722;
- t['V'] = 667;
- t['W'] = 889;
- t['X'] = 667;
- t['Y'] = 611;
- t['Z'] = 611;
- t['bracketleft'] = 333;
- t['backslash'] = 278;
- t['bracketright'] = 333;
- t['asciicircum'] = 570;
- t['underscore'] = 500;
- t['quoteleft'] = 333;
- t['a'] = 500;
- t['b'] = 500;
- t['c'] = 444;
- t['d'] = 500;
- t['e'] = 444;
- t['f'] = 333;
- t['g'] = 500;
- t['h'] = 556;
- t['i'] = 278;
- t['j'] = 278;
- t['k'] = 500;
- t['l'] = 278;
- t['m'] = 778;
- t['n'] = 556;
- t['o'] = 500;
- t['p'] = 500;
- t['q'] = 500;
- t['r'] = 389;
- t['s'] = 389;
- t['t'] = 278;
- t['u'] = 556;
- t['v'] = 444;
- t['w'] = 667;
- t['x'] = 500;
- t['y'] = 444;
- t['z'] = 389;
- t['braceleft'] = 348;
- t['bar'] = 220;
- t['braceright'] = 348;
- t['asciitilde'] = 570;
- t['exclamdown'] = 389;
- t['cent'] = 500;
- t['sterling'] = 500;
- t['fraction'] = 167;
- t['yen'] = 500;
- t['florin'] = 500;
- t['section'] = 500;
- t['currency'] = 500;
- t['quotesingle'] = 278;
- t['quotedblleft'] = 500;
- t['guillemotleft'] = 500;
- t['guilsinglleft'] = 333;
- t['guilsinglright'] = 333;
- t['fi'] = 556;
- t['fl'] = 556;
- t['endash'] = 500;
- t['dagger'] = 500;
- t['daggerdbl'] = 500;
- t['periodcentered'] = 250;
- t['paragraph'] = 500;
- t['bullet'] = 350;
- t['quotesinglbase'] = 333;
- t['quotedblbase'] = 500;
- t['quotedblright'] = 500;
- t['guillemotright'] = 500;
- t['ellipsis'] = 1000;
- t['perthousand'] = 1000;
- t['questiondown'] = 500;
- t['grave'] = 333;
- t['acute'] = 333;
- t['circumflex'] = 333;
- t['tilde'] = 333;
- t['macron'] = 333;
- t['breve'] = 333;
- t['dotaccent'] = 333;
- t['dieresis'] = 333;
- t['ring'] = 333;
- t['cedilla'] = 333;
- t['hungarumlaut'] = 333;
- t['ogonek'] = 333;
- t['caron'] = 333;
- t['emdash'] = 1000;
- t['AE'] = 944;
- t['ordfeminine'] = 266;
- t['Lslash'] = 611;
- t['Oslash'] = 722;
- t['OE'] = 944;
- t['ordmasculine'] = 300;
- t['ae'] = 722;
- t['dotlessi'] = 278;
- t['lslash'] = 278;
- t['oslash'] = 500;
- t['oe'] = 722;
- t['germandbls'] = 500;
- t['Idieresis'] = 389;
- t['eacute'] = 444;
- t['abreve'] = 500;
- t['uhungarumlaut'] = 556;
- t['ecaron'] = 444;
- t['Ydieresis'] = 611;
- t['divide'] = 570;
- t['Yacute'] = 611;
- t['Acircumflex'] = 667;
- t['aacute'] = 500;
- t['Ucircumflex'] = 722;
- t['yacute'] = 444;
- t['scommaaccent'] = 389;
- t['ecircumflex'] = 444;
- t['Uring'] = 722;
- t['Udieresis'] = 722;
- t['aogonek'] = 500;
- t['Uacute'] = 722;
- t['uogonek'] = 556;
- t['Edieresis'] = 667;
- t['Dcroat'] = 722;
- t['commaaccent'] = 250;
- t['copyright'] = 747;
- t['Emacron'] = 667;
- t['ccaron'] = 444;
- t['aring'] = 500;
- t['Ncommaaccent'] = 722;
- t['lacute'] = 278;
- t['agrave'] = 500;
- t['Tcommaaccent'] = 611;
- t['Cacute'] = 667;
- t['atilde'] = 500;
- t['Edotaccent'] = 667;
- t['scaron'] = 389;
- t['scedilla'] = 389;
- t['iacute'] = 278;
- t['lozenge'] = 494;
- t['Rcaron'] = 667;
- t['Gcommaaccent'] = 722;
- t['ucircumflex'] = 556;
- t['acircumflex'] = 500;
- t['Amacron'] = 667;
- t['rcaron'] = 389;
- t['ccedilla'] = 444;
- t['Zdotaccent'] = 611;
- t['Thorn'] = 611;
- t['Omacron'] = 722;
- t['Racute'] = 667;
- t['Sacute'] = 556;
- t['dcaron'] = 608;
- t['Umacron'] = 722;
- t['uring'] = 556;
- t['threesuperior'] = 300;
- t['Ograve'] = 722;
- t['Agrave'] = 667;
- t['Abreve'] = 667;
- t['multiply'] = 570;
- t['uacute'] = 556;
- t['Tcaron'] = 611;
- t['partialdiff'] = 494;
- t['ydieresis'] = 444;
- t['Nacute'] = 722;
- t['icircumflex'] = 278;
- t['Ecircumflex'] = 667;
- t['adieresis'] = 500;
- t['edieresis'] = 444;
- t['cacute'] = 444;
- t['nacute'] = 556;
- t['umacron'] = 556;
- t['Ncaron'] = 722;
- t['Iacute'] = 389;
- t['plusminus'] = 570;
- t['brokenbar'] = 220;
- t['registered'] = 747;
- t['Gbreve'] = 722;
- t['Idotaccent'] = 389;
- t['summation'] = 600;
- t['Egrave'] = 667;
- t['racute'] = 389;
- t['omacron'] = 500;
- t['Zacute'] = 611;
- t['Zcaron'] = 611;
- t['greaterequal'] = 549;
- t['Eth'] = 722;
- t['Ccedilla'] = 667;
- t['lcommaaccent'] = 278;
- t['tcaron'] = 366;
- t['eogonek'] = 444;
- t['Uogonek'] = 722;
- t['Aacute'] = 667;
- t['Adieresis'] = 667;
- t['egrave'] = 444;
- t['zacute'] = 389;
- t['iogonek'] = 278;
- t['Oacute'] = 722;
- t['oacute'] = 500;
- t['amacron'] = 500;
- t['sacute'] = 389;
- t['idieresis'] = 278;
- t['Ocircumflex'] = 722;
- t['Ugrave'] = 722;
- t['Delta'] = 612;
- t['thorn'] = 500;
- t['twosuperior'] = 300;
- t['Odieresis'] = 722;
- t['mu'] = 576;
- t['igrave'] = 278;
- t['ohungarumlaut'] = 500;
- t['Eogonek'] = 667;
- t['dcroat'] = 500;
- t['threequarters'] = 750;
- t['Scedilla'] = 556;
- t['lcaron'] = 382;
- t['Kcommaaccent'] = 667;
- t['Lacute'] = 611;
- t['trademark'] = 1000;
- t['edotaccent'] = 444;
- t['Igrave'] = 389;
- t['Imacron'] = 389;
- t['Lcaron'] = 611;
- t['onehalf'] = 750;
- t['lessequal'] = 549;
- t['ocircumflex'] = 500;
- t['ntilde'] = 556;
- t['Uhungarumlaut'] = 722;
- t['Eacute'] = 667;
- t['emacron'] = 444;
- t['gbreve'] = 500;
- t['onequarter'] = 750;
- t['Scaron'] = 556;
- t['Scommaaccent'] = 556;
- t['Ohungarumlaut'] = 722;
- t['degree'] = 400;
- t['ograve'] = 500;
- t['Ccaron'] = 667;
- t['ugrave'] = 556;
- t['radical'] = 549;
- t['Dcaron'] = 722;
- t['rcommaaccent'] = 389;
- t['Ntilde'] = 722;
- t['otilde'] = 500;
- t['Rcommaaccent'] = 667;
- t['Lcommaaccent'] = 611;
- t['Atilde'] = 667;
- t['Aogonek'] = 667;
- t['Aring'] = 667;
- t['Otilde'] = 722;
- t['zdotaccent'] = 389;
- t['Ecaron'] = 667;
- t['Iogonek'] = 389;
- t['kcommaaccent'] = 500;
- t['minus'] = 606;
- t['Icircumflex'] = 389;
- t['ncaron'] = 556;
- t['tcommaaccent'] = 278;
- t['logicalnot'] = 606;
- t['odieresis'] = 500;
- t['udieresis'] = 556;
- t['notequal'] = 549;
- t['gcommaaccent'] = 500;
- t['eth'] = 500;
- t['zcaron'] = 389;
- t['ncommaaccent'] = 556;
- t['onesuperior'] = 300;
- t['imacron'] = 278;
- t['Euro'] = 500;
- });
- t['Times-Italic'] = (0, _util.getLookupTableFactory)(function (t) {
- t['space'] = 250;
- t['exclam'] = 333;
- t['quotedbl'] = 420;
- t['numbersign'] = 500;
- t['dollar'] = 500;
- t['percent'] = 833;
- t['ampersand'] = 778;
- t['quoteright'] = 333;
- t['parenleft'] = 333;
- t['parenright'] = 333;
- t['asterisk'] = 500;
- t['plus'] = 675;
- t['comma'] = 250;
- t['hyphen'] = 333;
- t['period'] = 250;
- t['slash'] = 278;
- t['zero'] = 500;
- t['one'] = 500;
- t['two'] = 500;
- t['three'] = 500;
- t['four'] = 500;
- t['five'] = 500;
- t['six'] = 500;
- t['seven'] = 500;
- t['eight'] = 500;
- t['nine'] = 500;
- t['colon'] = 333;
- t['semicolon'] = 333;
- t['less'] = 675;
- t['equal'] = 675;
- t['greater'] = 675;
- t['question'] = 500;
- t['at'] = 920;
- t['A'] = 611;
- t['B'] = 611;
- t['C'] = 667;
- t['D'] = 722;
- t['E'] = 611;
- t['F'] = 611;
- t['G'] = 722;
- t['H'] = 722;
- t['I'] = 333;
- t['J'] = 444;
- t['K'] = 667;
- t['L'] = 556;
- t['M'] = 833;
- t['N'] = 667;
- t['O'] = 722;
- t['P'] = 611;
- t['Q'] = 722;
- t['R'] = 611;
- t['S'] = 500;
- t['T'] = 556;
- t['U'] = 722;
- t['V'] = 611;
- t['W'] = 833;
- t['X'] = 611;
- t['Y'] = 556;
- t['Z'] = 556;
- t['bracketleft'] = 389;
- t['backslash'] = 278;
- t['bracketright'] = 389;
- t['asciicircum'] = 422;
- t['underscore'] = 500;
- t['quoteleft'] = 333;
- t['a'] = 500;
- t['b'] = 500;
- t['c'] = 444;
- t['d'] = 500;
- t['e'] = 444;
- t['f'] = 278;
- t['g'] = 500;
- t['h'] = 500;
- t['i'] = 278;
- t['j'] = 278;
- t['k'] = 444;
- t['l'] = 278;
- t['m'] = 722;
- t['n'] = 500;
- t['o'] = 500;
- t['p'] = 500;
- t['q'] = 500;
- t['r'] = 389;
- t['s'] = 389;
- t['t'] = 278;
- t['u'] = 500;
- t['v'] = 444;
- t['w'] = 667;
- t['x'] = 444;
- t['y'] = 444;
- t['z'] = 389;
- t['braceleft'] = 400;
- t['bar'] = 275;
- t['braceright'] = 400;
- t['asciitilde'] = 541;
- t['exclamdown'] = 389;
- t['cent'] = 500;
- t['sterling'] = 500;
- t['fraction'] = 167;
- t['yen'] = 500;
- t['florin'] = 500;
- t['section'] = 500;
- t['currency'] = 500;
- t['quotesingle'] = 214;
- t['quotedblleft'] = 556;
- t['guillemotleft'] = 500;
- t['guilsinglleft'] = 333;
- t['guilsinglright'] = 333;
- t['fi'] = 500;
- t['fl'] = 500;
- t['endash'] = 500;
- t['dagger'] = 500;
- t['daggerdbl'] = 500;
- t['periodcentered'] = 250;
- t['paragraph'] = 523;
- t['bullet'] = 350;
- t['quotesinglbase'] = 333;
- t['quotedblbase'] = 556;
- t['quotedblright'] = 556;
- t['guillemotright'] = 500;
- t['ellipsis'] = 889;
- t['perthousand'] = 1000;
- t['questiondown'] = 500;
- t['grave'] = 333;
- t['acute'] = 333;
- t['circumflex'] = 333;
- t['tilde'] = 333;
- t['macron'] = 333;
- t['breve'] = 333;
- t['dotaccent'] = 333;
- t['dieresis'] = 333;
- t['ring'] = 333;
- t['cedilla'] = 333;
- t['hungarumlaut'] = 333;
- t['ogonek'] = 333;
- t['caron'] = 333;
- t['emdash'] = 889;
- t['AE'] = 889;
- t['ordfeminine'] = 276;
- t['Lslash'] = 556;
- t['Oslash'] = 722;
- t['OE'] = 944;
- t['ordmasculine'] = 310;
- t['ae'] = 667;
- t['dotlessi'] = 278;
- t['lslash'] = 278;
- t['oslash'] = 500;
- t['oe'] = 667;
- t['germandbls'] = 500;
- t['Idieresis'] = 333;
- t['eacute'] = 444;
- t['abreve'] = 500;
- t['uhungarumlaut'] = 500;
- t['ecaron'] = 444;
- t['Ydieresis'] = 556;
- t['divide'] = 675;
- t['Yacute'] = 556;
- t['Acircumflex'] = 611;
- t['aacute'] = 500;
- t['Ucircumflex'] = 722;
- t['yacute'] = 444;
- t['scommaaccent'] = 389;
- t['ecircumflex'] = 444;
- t['Uring'] = 722;
- t['Udieresis'] = 722;
- t['aogonek'] = 500;
- t['Uacute'] = 722;
- t['uogonek'] = 500;
- t['Edieresis'] = 611;
- t['Dcroat'] = 722;
- t['commaaccent'] = 250;
- t['copyright'] = 760;
- t['Emacron'] = 611;
- t['ccaron'] = 444;
- t['aring'] = 500;
- t['Ncommaaccent'] = 667;
- t['lacute'] = 278;
- t['agrave'] = 500;
- t['Tcommaaccent'] = 556;
- t['Cacute'] = 667;
- t['atilde'] = 500;
- t['Edotaccent'] = 611;
- t['scaron'] = 389;
- t['scedilla'] = 389;
- t['iacute'] = 278;
- t['lozenge'] = 471;
- t['Rcaron'] = 611;
- t['Gcommaaccent'] = 722;
- t['ucircumflex'] = 500;
- t['acircumflex'] = 500;
- t['Amacron'] = 611;
- t['rcaron'] = 389;
- t['ccedilla'] = 444;
- t['Zdotaccent'] = 556;
- t['Thorn'] = 611;
- t['Omacron'] = 722;
- t['Racute'] = 611;
- t['Sacute'] = 500;
- t['dcaron'] = 544;
- t['Umacron'] = 722;
- t['uring'] = 500;
- t['threesuperior'] = 300;
- t['Ograve'] = 722;
- t['Agrave'] = 611;
- t['Abreve'] = 611;
- t['multiply'] = 675;
- t['uacute'] = 500;
- t['Tcaron'] = 556;
- t['partialdiff'] = 476;
- t['ydieresis'] = 444;
- t['Nacute'] = 667;
- t['icircumflex'] = 278;
- t['Ecircumflex'] = 611;
- t['adieresis'] = 500;
- t['edieresis'] = 444;
- t['cacute'] = 444;
- t['nacute'] = 500;
- t['umacron'] = 500;
- t['Ncaron'] = 667;
- t['Iacute'] = 333;
- t['plusminus'] = 675;
- t['brokenbar'] = 275;
- t['registered'] = 760;
- t['Gbreve'] = 722;
- t['Idotaccent'] = 333;
- t['summation'] = 600;
- t['Egrave'] = 611;
- t['racute'] = 389;
- t['omacron'] = 500;
- t['Zacute'] = 556;
- t['Zcaron'] = 556;
- t['greaterequal'] = 549;
- t['Eth'] = 722;
- t['Ccedilla'] = 667;
- t['lcommaaccent'] = 278;
- t['tcaron'] = 300;
- t['eogonek'] = 444;
- t['Uogonek'] = 722;
- t['Aacute'] = 611;
- t['Adieresis'] = 611;
- t['egrave'] = 444;
- t['zacute'] = 389;
- t['iogonek'] = 278;
- t['Oacute'] = 722;
- t['oacute'] = 500;
- t['amacron'] = 500;
- t['sacute'] = 389;
- t['idieresis'] = 278;
- t['Ocircumflex'] = 722;
- t['Ugrave'] = 722;
- t['Delta'] = 612;
- t['thorn'] = 500;
- t['twosuperior'] = 300;
- t['Odieresis'] = 722;
- t['mu'] = 500;
- t['igrave'] = 278;
- t['ohungarumlaut'] = 500;
- t['Eogonek'] = 611;
- t['dcroat'] = 500;
- t['threequarters'] = 750;
- t['Scedilla'] = 500;
- t['lcaron'] = 300;
- t['Kcommaaccent'] = 667;
- t['Lacute'] = 556;
- t['trademark'] = 980;
- t['edotaccent'] = 444;
- t['Igrave'] = 333;
- t['Imacron'] = 333;
- t['Lcaron'] = 611;
- t['onehalf'] = 750;
- t['lessequal'] = 549;
- t['ocircumflex'] = 500;
- t['ntilde'] = 500;
- t['Uhungarumlaut'] = 722;
- t['Eacute'] = 611;
- t['emacron'] = 444;
- t['gbreve'] = 500;
- t['onequarter'] = 750;
- t['Scaron'] = 500;
- t['Scommaaccent'] = 500;
- t['Ohungarumlaut'] = 722;
- t['degree'] = 400;
- t['ograve'] = 500;
- t['Ccaron'] = 667;
- t['ugrave'] = 500;
- t['radical'] = 453;
- t['Dcaron'] = 722;
- t['rcommaaccent'] = 389;
- t['Ntilde'] = 667;
- t['otilde'] = 500;
- t['Rcommaaccent'] = 611;
- t['Lcommaaccent'] = 556;
- t['Atilde'] = 611;
- t['Aogonek'] = 611;
- t['Aring'] = 611;
- t['Otilde'] = 722;
- t['zdotaccent'] = 389;
- t['Ecaron'] = 611;
- t['Iogonek'] = 333;
- t['kcommaaccent'] = 444;
- t['minus'] = 675;
- t['Icircumflex'] = 333;
- t['ncaron'] = 500;
- t['tcommaaccent'] = 278;
- t['logicalnot'] = 675;
- t['odieresis'] = 500;
- t['udieresis'] = 500;
- t['notequal'] = 549;
- t['gcommaaccent'] = 500;
- t['eth'] = 500;
- t['zcaron'] = 389;
- t['ncommaaccent'] = 500;
- t['onesuperior'] = 300;
- t['imacron'] = 278;
- t['Euro'] = 500;
- });
- t['ZapfDingbats'] = (0, _util.getLookupTableFactory)(function (t) {
- t['space'] = 278;
- t['a1'] = 974;
- t['a2'] = 961;
- t['a202'] = 974;
- t['a3'] = 980;
- t['a4'] = 719;
- t['a5'] = 789;
- t['a119'] = 790;
- t['a118'] = 791;
- t['a117'] = 690;
- t['a11'] = 960;
- t['a12'] = 939;
- t['a13'] = 549;
- t['a14'] = 855;
- t['a15'] = 911;
- t['a16'] = 933;
- t['a105'] = 911;
- t['a17'] = 945;
- t['a18'] = 974;
- t['a19'] = 755;
- t['a20'] = 846;
- t['a21'] = 762;
- t['a22'] = 761;
- t['a23'] = 571;
- t['a24'] = 677;
- t['a25'] = 763;
- t['a26'] = 760;
- t['a27'] = 759;
- t['a28'] = 754;
- t['a6'] = 494;
- t['a7'] = 552;
- t['a8'] = 537;
- t['a9'] = 577;
- t['a10'] = 692;
- t['a29'] = 786;
- t['a30'] = 788;
- t['a31'] = 788;
- t['a32'] = 790;
- t['a33'] = 793;
- t['a34'] = 794;
- t['a35'] = 816;
- t['a36'] = 823;
- t['a37'] = 789;
- t['a38'] = 841;
- t['a39'] = 823;
- t['a40'] = 833;
- t['a41'] = 816;
- t['a42'] = 831;
- t['a43'] = 923;
- t['a44'] = 744;
- t['a45'] = 723;
- t['a46'] = 749;
- t['a47'] = 790;
- t['a48'] = 792;
- t['a49'] = 695;
- t['a50'] = 776;
- t['a51'] = 768;
- t['a52'] = 792;
- t['a53'] = 759;
- t['a54'] = 707;
- t['a55'] = 708;
- t['a56'] = 682;
- t['a57'] = 701;
- t['a58'] = 826;
- t['a59'] = 815;
- t['a60'] = 789;
- t['a61'] = 789;
- t['a62'] = 707;
- t['a63'] = 687;
- t['a64'] = 696;
- t['a65'] = 689;
- t['a66'] = 786;
- t['a67'] = 787;
- t['a68'] = 713;
- t['a69'] = 791;
- t['a70'] = 785;
- t['a71'] = 791;
- t['a72'] = 873;
- t['a73'] = 761;
- t['a74'] = 762;
- t['a203'] = 762;
- t['a75'] = 759;
- t['a204'] = 759;
- t['a76'] = 892;
- t['a77'] = 892;
- t['a78'] = 788;
- t['a79'] = 784;
- t['a81'] = 438;
- t['a82'] = 138;
- t['a83'] = 277;
- t['a84'] = 415;
- t['a97'] = 392;
- t['a98'] = 392;
- t['a99'] = 668;
- t['a100'] = 668;
- t['a89'] = 390;
- t['a90'] = 390;
- t['a93'] = 317;
- t['a94'] = 317;
- t['a91'] = 276;
- t['a92'] = 276;
- t['a205'] = 509;
- t['a85'] = 509;
- t['a206'] = 410;
- t['a86'] = 410;
- t['a87'] = 234;
- t['a88'] = 234;
- t['a95'] = 334;
- t['a96'] = 334;
- t['a101'] = 732;
- t['a102'] = 544;
- t['a103'] = 544;
- t['a104'] = 910;
- t['a106'] = 667;
- t['a107'] = 760;
- t['a108'] = 760;
- t['a112'] = 776;
- t['a111'] = 595;
- t['a110'] = 694;
- t['a109'] = 626;
- t['a120'] = 788;
- t['a121'] = 788;
- t['a122'] = 788;
- t['a123'] = 788;
- t['a124'] = 788;
- t['a125'] = 788;
- t['a126'] = 788;
- t['a127'] = 788;
- t['a128'] = 788;
- t['a129'] = 788;
- t['a130'] = 788;
- t['a131'] = 788;
- t['a132'] = 788;
- t['a133'] = 788;
- t['a134'] = 788;
- t['a135'] = 788;
- t['a136'] = 788;
- t['a137'] = 788;
- t['a138'] = 788;
- t['a139'] = 788;
- t['a140'] = 788;
- t['a141'] = 788;
- t['a142'] = 788;
- t['a143'] = 788;
- t['a144'] = 788;
- t['a145'] = 788;
- t['a146'] = 788;
- t['a147'] = 788;
- t['a148'] = 788;
- t['a149'] = 788;
- t['a150'] = 788;
- t['a151'] = 788;
- t['a152'] = 788;
- t['a153'] = 788;
- t['a154'] = 788;
- t['a155'] = 788;
- t['a156'] = 788;
- t['a157'] = 788;
- t['a158'] = 788;
- t['a159'] = 788;
- t['a160'] = 894;
- t['a161'] = 838;
- t['a163'] = 1016;
- t['a164'] = 458;
- t['a196'] = 748;
- t['a165'] = 924;
- t['a192'] = 748;
- t['a166'] = 918;
- t['a167'] = 927;
- t['a168'] = 928;
- t['a169'] = 928;
- t['a170'] = 834;
- t['a171'] = 873;
- t['a172'] = 828;
- t['a173'] = 924;
- t['a162'] = 924;
- t['a174'] = 917;
- t['a175'] = 930;
- t['a176'] = 931;
- t['a177'] = 463;
- t['a178'] = 883;
- t['a179'] = 836;
- t['a193'] = 836;
- t['a180'] = 867;
- t['a199'] = 867;
- t['a181'] = 696;
- t['a200'] = 696;
- t['a182'] = 874;
- t['a201'] = 874;
- t['a183'] = 760;
- t['a184'] = 946;
- t['a197'] = 771;
- t['a185'] = 865;
- t['a194'] = 771;
- t['a198'] = 888;
- t['a186'] = 967;
- t['a195'] = 888;
- t['a187'] = 831;
- t['a188'] = 873;
- t['a189'] = 927;
- t['a190'] = 970;
- t['a191'] = 918;
- });
-});
-exports.getMetrics = getMetrics;
-
-/***/ }),
-/* 168 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.PostScriptCompiler = exports.PostScriptEvaluator = exports.PDFFunctionFactory = exports.isPDFFunction = undefined;
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _util = __w_pdfjs_require__(2);
-
-var _primitives = __w_pdfjs_require__(138);
-
-var _ps_parser = __w_pdfjs_require__(169);
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var IsEvalSupportedCached = {
- get value() {
- return (0, _util.shadow)(this, 'value', (0, _util.isEvalSupported)());
- }
-};
-
-var PDFFunctionFactory = function () {
- function PDFFunctionFactory(_ref) {
- var xref = _ref.xref,
- _ref$isEvalSupported = _ref.isEvalSupported,
- isEvalSupported = _ref$isEvalSupported === undefined ? true : _ref$isEvalSupported;
-
- _classCallCheck(this, PDFFunctionFactory);
-
- this.xref = xref;
- this.isEvalSupported = isEvalSupported !== false;
- }
-
- _createClass(PDFFunctionFactory, [{
- key: 'create',
- value: function create(fn) {
- return PDFFunction.parse({
- xref: this.xref,
- isEvalSupported: this.isEvalSupported,
- fn: fn
- });
- }
- }, {
- key: 'createFromArray',
- value: function createFromArray(fnObj) {
- return PDFFunction.parseArray({
- xref: this.xref,
- isEvalSupported: this.isEvalSupported,
- fnObj: fnObj
- });
- }
- }]);
-
- return PDFFunctionFactory;
-}();
-
-function toNumberArray(arr) {
- if (!Array.isArray(arr)) {
- return null;
- }
- var length = arr.length;
- for (var i = 0; i < length; i++) {
- if (typeof arr[i] !== 'number') {
- var result = new Array(length);
- for (var _i = 0; _i < length; _i++) {
- result[_i] = +arr[_i];
- }
- return result;
- }
- }
- return arr;
-}
-var PDFFunction = function PDFFunctionClosure() {
- var CONSTRUCT_SAMPLED = 0;
- var CONSTRUCT_INTERPOLATED = 2;
- var CONSTRUCT_STICHED = 3;
- var CONSTRUCT_POSTSCRIPT = 4;
- return {
- getSampleArray: function getSampleArray(size, outputSize, bps, stream) {
- var i, ii;
- var length = 1;
- for (i = 0, ii = size.length; i < ii; i++) {
- length *= size[i];
- }
- length *= outputSize;
- var array = new Array(length);
- var codeSize = 0;
- var codeBuf = 0;
- var sampleMul = 1.0 / (Math.pow(2.0, bps) - 1);
- var strBytes = stream.getBytes((length * bps + 7) / 8);
- var strIdx = 0;
- for (i = 0; i < length; i++) {
- while (codeSize < bps) {
- codeBuf <<= 8;
- codeBuf |= strBytes[strIdx++];
- codeSize += 8;
- }
- codeSize -= bps;
- array[i] = (codeBuf >> codeSize) * sampleMul;
- codeBuf &= (1 << codeSize) - 1;
- }
- return array;
- },
- getIR: function getIR(_ref2) {
- var xref = _ref2.xref,
- isEvalSupported = _ref2.isEvalSupported,
- fn = _ref2.fn;
-
- var dict = fn.dict;
- if (!dict) {
- dict = fn;
- }
- var types = [this.constructSampled, null, this.constructInterpolated, this.constructStiched, this.constructPostScript];
- var typeNum = dict.get('FunctionType');
- var typeFn = types[typeNum];
- if (!typeFn) {
- throw new _util.FormatError('Unknown type of function');
- }
- return typeFn.call(this, {
- xref: xref,
- isEvalSupported: isEvalSupported,
- fn: fn,
- dict: dict
- });
- },
- fromIR: function fromIR(_ref3) {
- var xref = _ref3.xref,
- isEvalSupported = _ref3.isEvalSupported,
- IR = _ref3.IR;
-
- var type = IR[0];
- switch (type) {
- case CONSTRUCT_SAMPLED:
- return this.constructSampledFromIR({
- xref: xref,
- isEvalSupported: isEvalSupported,
- IR: IR
- });
- case CONSTRUCT_INTERPOLATED:
- return this.constructInterpolatedFromIR({
- xref: xref,
- isEvalSupported: isEvalSupported,
- IR: IR
- });
- case CONSTRUCT_STICHED:
- return this.constructStichedFromIR({
- xref: xref,
- isEvalSupported: isEvalSupported,
- IR: IR
- });
- default:
- return this.constructPostScriptFromIR({
- xref: xref,
- isEvalSupported: isEvalSupported,
- IR: IR
- });
- }
- },
- parse: function parse(_ref4) {
- var xref = _ref4.xref,
- isEvalSupported = _ref4.isEvalSupported,
- fn = _ref4.fn;
-
- var IR = this.getIR({
- xref: xref,
- isEvalSupported: isEvalSupported,
- fn: fn
- });
- return this.fromIR({
- xref: xref,
- isEvalSupported: isEvalSupported,
- IR: IR
- });
- },
- parseArray: function parseArray(_ref5) {
- var xref = _ref5.xref,
- isEvalSupported = _ref5.isEvalSupported,
- fnObj = _ref5.fnObj;
-
- if (!Array.isArray(fnObj)) {
- return this.parse({
- xref: xref,
- isEvalSupported: isEvalSupported,
- fn: fnObj
- });
- }
- var fnArray = [];
- for (var j = 0, jj = fnObj.length; j < jj; j++) {
- fnArray.push(this.parse({
- xref: xref,
- isEvalSupported: isEvalSupported,
- fn: xref.fetchIfRef(fnObj[j])
- }));
- }
- return function (src, srcOffset, dest, destOffset) {
- for (var i = 0, ii = fnArray.length; i < ii; i++) {
- fnArray[i](src, srcOffset, dest, destOffset + i);
- }
- };
- },
- constructSampled: function constructSampled(_ref6) {
- var xref = _ref6.xref,
- isEvalSupported = _ref6.isEvalSupported,
- fn = _ref6.fn,
- dict = _ref6.dict;
-
- function toMultiArray(arr) {
- var inputLength = arr.length;
- var out = [];
- var index = 0;
- for (var i = 0; i < inputLength; i += 2) {
- out[index] = [arr[i], arr[i + 1]];
- ++index;
- }
- return out;
- }
- var domain = toNumberArray(dict.getArray('Domain'));
- var range = toNumberArray(dict.getArray('Range'));
- if (!domain || !range) {
- throw new _util.FormatError('No domain or range');
- }
- var inputSize = domain.length / 2;
- var outputSize = range.length / 2;
- domain = toMultiArray(domain);
- range = toMultiArray(range);
- var size = toNumberArray(dict.getArray('Size'));
- var bps = dict.get('BitsPerSample');
- var order = dict.get('Order') || 1;
- if (order !== 1) {
- (0, _util.info)('No support for cubic spline interpolation: ' + order);
- }
- var encode = toNumberArray(dict.getArray('Encode'));
- if (!encode) {
- encode = [];
- for (var i = 0; i < inputSize; ++i) {
- encode.push([0, size[i] - 1]);
- }
- } else {
- encode = toMultiArray(encode);
- }
- var decode = toNumberArray(dict.getArray('Decode'));
- if (!decode) {
- decode = range;
- } else {
- decode = toMultiArray(decode);
- }
- var samples = this.getSampleArray(size, outputSize, bps, fn);
- return [CONSTRUCT_SAMPLED, inputSize, domain, encode, decode, samples, size, outputSize, Math.pow(2, bps) - 1, range];
- },
- constructSampledFromIR: function constructSampledFromIR(_ref7) {
- var xref = _ref7.xref,
- isEvalSupported = _ref7.isEvalSupported,
- IR = _ref7.IR;
-
- function interpolate(x, xmin, xmax, ymin, ymax) {
- return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
- }
- return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) {
- var m = IR[1];
- var domain = IR[2];
- var encode = IR[3];
- var decode = IR[4];
- var samples = IR[5];
- var size = IR[6];
- var n = IR[7];
- var range = IR[9];
- var cubeVertices = 1 << m;
- var cubeN = new Float64Array(cubeVertices);
- var cubeVertex = new Uint32Array(cubeVertices);
- var i, j;
- for (j = 0; j < cubeVertices; j++) {
- cubeN[j] = 1;
- }
- var k = n,
- pos = 1;
- for (i = 0; i < m; ++i) {
- var domain_2i = domain[i][0];
- var domain_2i_1 = domain[i][1];
- var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
- var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
- var size_i = size[i];
- e = Math.min(Math.max(e, 0), size_i - 1);
- var e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
- var n0 = e0 + 1 - e;
- var n1 = e - e0;
- var offset0 = e0 * k;
- var offset1 = offset0 + k;
- for (j = 0; j < cubeVertices; j++) {
- if (j & pos) {
- cubeN[j] *= n1;
- cubeVertex[j] += offset1;
- } else {
- cubeN[j] *= n0;
- cubeVertex[j] += offset0;
- }
- }
- k *= size_i;
- pos <<= 1;
- }
- for (j = 0; j < n; ++j) {
- var rj = 0;
- for (i = 0; i < cubeVertices; i++) {
- rj += samples[cubeVertex[i] + j] * cubeN[i];
- }
- rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
- dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
- }
- };
- },
- constructInterpolated: function constructInterpolated(_ref8) {
- var xref = _ref8.xref,
- isEvalSupported = _ref8.isEvalSupported,
- fn = _ref8.fn,
- dict = _ref8.dict;
-
- var c0 = toNumberArray(dict.getArray('C0')) || [0];
- var c1 = toNumberArray(dict.getArray('C1')) || [1];
- var n = dict.get('N');
- var length = c0.length;
- var diff = [];
- for (var i = 0; i < length; ++i) {
- diff.push(c1[i] - c0[i]);
- }
- return [CONSTRUCT_INTERPOLATED, c0, diff, n];
- },
- constructInterpolatedFromIR: function constructInterpolatedFromIR(_ref9) {
- var xref = _ref9.xref,
- isEvalSupported = _ref9.isEvalSupported,
- IR = _ref9.IR;
-
- var c0 = IR[1];
- var diff = IR[2];
- var n = IR[3];
- var length = diff.length;
- return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
- var x = n === 1 ? src[srcOffset] : Math.pow(src[srcOffset], n);
- for (var j = 0; j < length; ++j) {
- dest[destOffset + j] = c0[j] + x * diff[j];
- }
- };
- },
- constructStiched: function constructStiched(_ref10) {
- var xref = _ref10.xref,
- isEvalSupported = _ref10.isEvalSupported,
- fn = _ref10.fn,
- dict = _ref10.dict;
-
- var domain = toNumberArray(dict.getArray('Domain'));
- if (!domain) {
- throw new _util.FormatError('No domain');
- }
- var inputSize = domain.length / 2;
- if (inputSize !== 1) {
- throw new _util.FormatError('Bad domain for stiched function');
- }
- var fnRefs = dict.get('Functions');
- var fns = [];
- for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
- fns.push(this.parse({
- xref: xref,
- isEvalSupported: isEvalSupported,
- fn: xref.fetchIfRef(fnRefs[i])
- }));
- }
- var bounds = toNumberArray(dict.getArray('Bounds'));
- var encode = toNumberArray(dict.getArray('Encode'));
- return [CONSTRUCT_STICHED, domain, bounds, encode, fns];
- },
- constructStichedFromIR: function constructStichedFromIR(_ref11) {
- var xref = _ref11.xref,
- isEvalSupported = _ref11.isEvalSupported,
- IR = _ref11.IR;
-
- var domain = IR[1];
- var bounds = IR[2];
- var encode = IR[3];
- var fns = IR[4];
- var tmpBuf = new Float32Array(1);
- return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
- var clip = function constructStichedFromIRClip(v, min, max) {
- if (v > max) {
- v = max;
- } else if (v < min) {
- v = min;
- }
- return v;
- };
- var v = clip(src[srcOffset], domain[0], domain[1]);
- for (var i = 0, ii = bounds.length; i < ii; ++i) {
- if (v < bounds[i]) {
- break;
- }
- }
- var dmin = domain[0];
- if (i > 0) {
- dmin = bounds[i - 1];
- }
- var dmax = domain[1];
- if (i < bounds.length) {
- dmax = bounds[i];
- }
- var rmin = encode[2 * i];
- var rmax = encode[2 * i + 1];
- tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
- fns[i](tmpBuf, 0, dest, destOffset);
- };
- },
- constructPostScript: function constructPostScript(_ref12) {
- var xref = _ref12.xref,
- isEvalSupported = _ref12.isEvalSupported,
- fn = _ref12.fn,
- dict = _ref12.dict;
-
- var domain = toNumberArray(dict.getArray('Domain'));
- var range = toNumberArray(dict.getArray('Range'));
- if (!domain) {
- throw new _util.FormatError('No domain.');
- }
- if (!range) {
- throw new _util.FormatError('No range.');
- }
- var lexer = new _ps_parser.PostScriptLexer(fn);
- var parser = new _ps_parser.PostScriptParser(lexer);
- var code = parser.parse();
- return [CONSTRUCT_POSTSCRIPT, domain, range, code];
- },
- constructPostScriptFromIR: function constructPostScriptFromIR(_ref13) {
- var xref = _ref13.xref,
- isEvalSupported = _ref13.isEvalSupported,
- IR = _ref13.IR;
-
- var domain = IR[1];
- var range = IR[2];
- var code = IR[3];
- if (isEvalSupported && IsEvalSupportedCached.value) {
- var compiled = new PostScriptCompiler().compile(code, domain, range);
- if (compiled) {
- return new Function('src', 'srcOffset', 'dest', 'destOffset', compiled);
- }
- }
- (0, _util.info)('Unable to compile PS function');
- var numOutputs = range.length >> 1;
- var numInputs = domain.length >> 1;
- var evaluator = new PostScriptEvaluator(code);
- var cache = Object.create(null);
- var MAX_CACHE_SIZE = 2048 * 4;
- var cache_available = MAX_CACHE_SIZE;
- var tmpBuf = new Float32Array(numInputs);
- return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) {
- var i, value;
- var key = '';
- var input = tmpBuf;
- for (i = 0; i < numInputs; i++) {
- value = src[srcOffset + i];
- input[i] = value;
- key += value + '_';
- }
- var cachedValue = cache[key];
- if (cachedValue !== undefined) {
- dest.set(cachedValue, destOffset);
- return;
- }
- var output = new Float32Array(numOutputs);
- var stack = evaluator.execute(input);
- var stackIndex = stack.length - numOutputs;
- for (i = 0; i < numOutputs; i++) {
- value = stack[stackIndex + i];
- var bound = range[i * 2];
- if (value < bound) {
- value = bound;
- } else {
- bound = range[i * 2 + 1];
- if (value > bound) {
- value = bound;
- }
- }
- output[i] = value;
- }
- if (cache_available > 0) {
- cache_available--;
- cache[key] = output;
- }
- dest.set(output, destOffset);
- };
- }
- };
-}();
-function isPDFFunction(v) {
- var fnDict;
- if ((typeof v === 'undefined' ? 'undefined' : _typeof(v)) !== 'object') {
- return false;
- } else if ((0, _primitives.isDict)(v)) {
- fnDict = v;
- } else if ((0, _primitives.isStream)(v)) {
- fnDict = v.dict;
- } else {
- return false;
- }
- return fnDict.has('FunctionType');
-}
-var PostScriptStack = function PostScriptStackClosure() {
- var MAX_STACK_SIZE = 100;
- function PostScriptStack(initialStack) {
- this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
- }
- PostScriptStack.prototype = {
- push: function PostScriptStack_push(value) {
- if (this.stack.length >= MAX_STACK_SIZE) {
- throw new Error('PostScript function stack overflow.');
- }
- this.stack.push(value);
- },
- pop: function PostScriptStack_pop() {
- if (this.stack.length <= 0) {
- throw new Error('PostScript function stack underflow.');
- }
- return this.stack.pop();
- },
- copy: function PostScriptStack_copy(n) {
- if (this.stack.length + n >= MAX_STACK_SIZE) {
- throw new Error('PostScript function stack overflow.');
- }
- var stack = this.stack;
- for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
- stack.push(stack[i]);
- }
- },
- index: function PostScriptStack_index(n) {
- this.push(this.stack[this.stack.length - n - 1]);
- },
- roll: function PostScriptStack_roll(n, p) {
- var stack = this.stack;
- var l = stack.length - n;
- var r = stack.length - 1,
- c = l + (p - Math.floor(p / n) * n),
- i,
- j,
- t;
- for (i = l, j = r; i < j; i++, j--) {
- t = stack[i];
- stack[i] = stack[j];
- stack[j] = t;
- }
- for (i = l, j = c - 1; i < j; i++, j--) {
- t = stack[i];
- stack[i] = stack[j];
- stack[j] = t;
- }
- for (i = c, j = r; i < j; i++, j--) {
- t = stack[i];
- stack[i] = stack[j];
- stack[j] = t;
- }
- }
- };
- return PostScriptStack;
-}();
-var PostScriptEvaluator = function PostScriptEvaluatorClosure() {
- function PostScriptEvaluator(operators) {
- this.operators = operators;
- }
- PostScriptEvaluator.prototype = {
- execute: function PostScriptEvaluator_execute(initialStack) {
- var stack = new PostScriptStack(initialStack);
- var counter = 0;
- var operators = this.operators;
- var length = operators.length;
- var operator, a, b;
- while (counter < length) {
- operator = operators[counter++];
- if (typeof operator === 'number') {
- stack.push(operator);
- continue;
- }
- switch (operator) {
- case 'jz':
- b = stack.pop();
- a = stack.pop();
- if (!a) {
- counter = b;
- }
- break;
- case 'j':
- a = stack.pop();
- counter = a;
- break;
- case 'abs':
- a = stack.pop();
- stack.push(Math.abs(a));
- break;
- case 'add':
- b = stack.pop();
- a = stack.pop();
- stack.push(a + b);
- break;
- case 'and':
- b = stack.pop();
- a = stack.pop();
- if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
- stack.push(a && b);
- } else {
- stack.push(a & b);
- }
- break;
- case 'atan':
- a = stack.pop();
- stack.push(Math.atan(a));
- break;
- case 'bitshift':
- b = stack.pop();
- a = stack.pop();
- if (a > 0) {
- stack.push(a << b);
- } else {
- stack.push(a >> b);
- }
- break;
- case 'ceiling':
- a = stack.pop();
- stack.push(Math.ceil(a));
- break;
- case 'copy':
- a = stack.pop();
- stack.copy(a);
- break;
- case 'cos':
- a = stack.pop();
- stack.push(Math.cos(a));
- break;
- case 'cvi':
- a = stack.pop() | 0;
- stack.push(a);
- break;
- case 'cvr':
- break;
- case 'div':
- b = stack.pop();
- a = stack.pop();
- stack.push(a / b);
- break;
- case 'dup':
- stack.copy(1);
- break;
- case 'eq':
- b = stack.pop();
- a = stack.pop();
- stack.push(a === b);
- break;
- case 'exch':
- stack.roll(2, 1);
- break;
- case 'exp':
- b = stack.pop();
- a = stack.pop();
- stack.push(Math.pow(a, b));
- break;
- case 'false':
- stack.push(false);
- break;
- case 'floor':
- a = stack.pop();
- stack.push(Math.floor(a));
- break;
- case 'ge':
- b = stack.pop();
- a = stack.pop();
- stack.push(a >= b);
- break;
- case 'gt':
- b = stack.pop();
- a = stack.pop();
- stack.push(a > b);
- break;
- case 'idiv':
- b = stack.pop();
- a = stack.pop();
- stack.push(a / b | 0);
- break;
- case 'index':
- a = stack.pop();
- stack.index(a);
- break;
- case 'le':
- b = stack.pop();
- a = stack.pop();
- stack.push(a <= b);
- break;
- case 'ln':
- a = stack.pop();
- stack.push(Math.log(a));
- break;
- case 'log':
- a = stack.pop();
- stack.push(Math.log(a) / Math.LN10);
- break;
- case 'lt':
- b = stack.pop();
- a = stack.pop();
- stack.push(a < b);
- break;
- case 'mod':
- b = stack.pop();
- a = stack.pop();
- stack.push(a % b);
- break;
- case 'mul':
- b = stack.pop();
- a = stack.pop();
- stack.push(a * b);
- break;
- case 'ne':
- b = stack.pop();
- a = stack.pop();
- stack.push(a !== b);
- break;
- case 'neg':
- a = stack.pop();
- stack.push(-a);
- break;
- case 'not':
- a = stack.pop();
- if ((0, _util.isBool)(a)) {
- stack.push(!a);
- } else {
- stack.push(~a);
- }
- break;
- case 'or':
- b = stack.pop();
- a = stack.pop();
- if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
- stack.push(a || b);
- } else {
- stack.push(a | b);
- }
- break;
- case 'pop':
- stack.pop();
- break;
- case 'roll':
- b = stack.pop();
- a = stack.pop();
- stack.roll(a, b);
- break;
- case 'round':
- a = stack.pop();
- stack.push(Math.round(a));
- break;
- case 'sin':
- a = stack.pop();
- stack.push(Math.sin(a));
- break;
- case 'sqrt':
- a = stack.pop();
- stack.push(Math.sqrt(a));
- break;
- case 'sub':
- b = stack.pop();
- a = stack.pop();
- stack.push(a - b);
- break;
- case 'true':
- stack.push(true);
- break;
- case 'truncate':
- a = stack.pop();
- a = a < 0 ? Math.ceil(a) : Math.floor(a);
- stack.push(a);
- break;
- case 'xor':
- b = stack.pop();
- a = stack.pop();
- if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
- stack.push(a !== b);
- } else {
- stack.push(a ^ b);
- }
- break;
- default:
- throw new _util.FormatError('Unknown operator ' + operator);
- }
- }
- return stack.stack;
- }
- };
- return PostScriptEvaluator;
-}();
-var PostScriptCompiler = function PostScriptCompilerClosure() {
- function AstNode(type) {
- this.type = type;
- }
- AstNode.prototype.visit = function (visitor) {
- (0, _util.unreachable)('abstract method');
- };
- function AstArgument(index, min, max) {
- AstNode.call(this, 'args');
- this.index = index;
- this.min = min;
- this.max = max;
- }
- AstArgument.prototype = Object.create(AstNode.prototype);
- AstArgument.prototype.visit = function (visitor) {
- visitor.visitArgument(this);
- };
- function AstLiteral(number) {
- AstNode.call(this, 'literal');
- this.number = number;
- this.min = number;
- this.max = number;
- }
- AstLiteral.prototype = Object.create(AstNode.prototype);
- AstLiteral.prototype.visit = function (visitor) {
- visitor.visitLiteral(this);
- };
- function AstBinaryOperation(op, arg1, arg2, min, max) {
- AstNode.call(this, 'binary');
- this.op = op;
- this.arg1 = arg1;
- this.arg2 = arg2;
- this.min = min;
- this.max = max;
- }
- AstBinaryOperation.prototype = Object.create(AstNode.prototype);
- AstBinaryOperation.prototype.visit = function (visitor) {
- visitor.visitBinaryOperation(this);
- };
- function AstMin(arg, max) {
- AstNode.call(this, 'max');
- this.arg = arg;
- this.min = arg.min;
- this.max = max;
- }
- AstMin.prototype = Object.create(AstNode.prototype);
- AstMin.prototype.visit = function (visitor) {
- visitor.visitMin(this);
- };
- function AstVariable(index, min, max) {
- AstNode.call(this, 'var');
- this.index = index;
- this.min = min;
- this.max = max;
- }
- AstVariable.prototype = Object.create(AstNode.prototype);
- AstVariable.prototype.visit = function (visitor) {
- visitor.visitVariable(this);
- };
- function AstVariableDefinition(variable, arg) {
- AstNode.call(this, 'definition');
- this.variable = variable;
- this.arg = arg;
- }
- AstVariableDefinition.prototype = Object.create(AstNode.prototype);
- AstVariableDefinition.prototype.visit = function (visitor) {
- visitor.visitVariableDefinition(this);
- };
- function ExpressionBuilderVisitor() {
- this.parts = [];
- }
- ExpressionBuilderVisitor.prototype = {
- visitArgument: function visitArgument(arg) {
- this.parts.push('Math.max(', arg.min, ', Math.min(', arg.max, ', src[srcOffset + ', arg.index, ']))');
- },
- visitVariable: function visitVariable(variable) {
- this.parts.push('v', variable.index);
- },
- visitLiteral: function visitLiteral(literal) {
- this.parts.push(literal.number);
- },
- visitBinaryOperation: function visitBinaryOperation(operation) {
- this.parts.push('(');
- operation.arg1.visit(this);
- this.parts.push(' ', operation.op, ' ');
- operation.arg2.visit(this);
- this.parts.push(')');
- },
- visitVariableDefinition: function visitVariableDefinition(definition) {
- this.parts.push('var ');
- definition.variable.visit(this);
- this.parts.push(' = ');
- definition.arg.visit(this);
- this.parts.push(';');
- },
- visitMin: function visitMin(max) {
- this.parts.push('Math.min(');
- max.arg.visit(this);
- this.parts.push(', ', max.max, ')');
- },
- toString: function toString() {
- return this.parts.join('');
- }
- };
- function buildAddOperation(num1, num2) {
- if (num2.type === 'literal' && num2.number === 0) {
- return num1;
- }
- if (num1.type === 'literal' && num1.number === 0) {
- return num2;
- }
- if (num2.type === 'literal' && num1.type === 'literal') {
- return new AstLiteral(num1.number + num2.number);
- }
- return new AstBinaryOperation('+', num1, num2, num1.min + num2.min, num1.max + num2.max);
- }
- function buildMulOperation(num1, num2) {
- if (num2.type === 'literal') {
- if (num2.number === 0) {
- return new AstLiteral(0);
- } else if (num2.number === 1) {
- return num1;
- } else if (num1.type === 'literal') {
- return new AstLiteral(num1.number * num2.number);
- }
- }
- if (num1.type === 'literal') {
- if (num1.number === 0) {
- return new AstLiteral(0);
- } else if (num1.number === 1) {
- return num2;
- }
- }
- var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
- var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
- return new AstBinaryOperation('*', num1, num2, min, max);
- }
- function buildSubOperation(num1, num2) {
- if (num2.type === 'literal') {
- if (num2.number === 0) {
- return num1;
- } else if (num1.type === 'literal') {
- return new AstLiteral(num1.number - num2.number);
- }
- }
- if (num2.type === 'binary' && num2.op === '-' && num1.type === 'literal' && num1.number === 1 && num2.arg1.type === 'literal' && num2.arg1.number === 1) {
- return num2.arg2;
- }
- return new AstBinaryOperation('-', num1, num2, num1.min - num2.max, num1.max - num2.min);
- }
- function buildMinOperation(num1, max) {
- if (num1.min >= max) {
- return new AstLiteral(max);
- } else if (num1.max <= max) {
- return num1;
- }
- return new AstMin(num1, max);
- }
- function PostScriptCompiler() {}
- PostScriptCompiler.prototype = {
- compile: function PostScriptCompiler_compile(code, domain, range) {
- var stack = [];
- var i, ii;
- var instructions = [];
- var inputSize = domain.length >> 1,
- outputSize = range.length >> 1;
- var lastRegister = 0;
- var n, j;
- var num1, num2, ast1, ast2, tmpVar, item;
- for (i = 0; i < inputSize; i++) {
- stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
- }
- for (i = 0, ii = code.length; i < ii; i++) {
- item = code[i];
- if (typeof item === 'number') {
- stack.push(new AstLiteral(item));
- continue;
- }
- switch (item) {
- case 'add':
- if (stack.length < 2) {
- return null;
- }
- num2 = stack.pop();
- num1 = stack.pop();
- stack.push(buildAddOperation(num1, num2));
- break;
- case 'cvr':
- if (stack.length < 1) {
- return null;
- }
- break;
- case 'mul':
- if (stack.length < 2) {
- return null;
- }
- num2 = stack.pop();
- num1 = stack.pop();
- stack.push(buildMulOperation(num1, num2));
- break;
- case 'sub':
- if (stack.length < 2) {
- return null;
- }
- num2 = stack.pop();
- num1 = stack.pop();
- stack.push(buildSubOperation(num1, num2));
- break;
- case 'exch':
- if (stack.length < 2) {
- return null;
- }
- ast1 = stack.pop();
- ast2 = stack.pop();
- stack.push(ast1, ast2);
- break;
- case 'pop':
- if (stack.length < 1) {
- return null;
- }
- stack.pop();
- break;
- case 'index':
- if (stack.length < 1) {
- return null;
- }
- num1 = stack.pop();
- if (num1.type !== 'literal') {
- return null;
- }
- n = num1.number;
- if (n < 0 || !Number.isInteger(n) || stack.length < n) {
- return null;
- }
- ast1 = stack[stack.length - n - 1];
- if (ast1.type === 'literal' || ast1.type === 'var') {
- stack.push(ast1);
- break;
- }
- tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
- stack[stack.length - n - 1] = tmpVar;
- stack.push(tmpVar);
- instructions.push(new AstVariableDefinition(tmpVar, ast1));
- break;
- case 'dup':
- if (stack.length < 1) {
- return null;
- }
- if (typeof code[i + 1] === 'number' && code[i + 2] === 'gt' && code[i + 3] === i + 7 && code[i + 4] === 'jz' && code[i + 5] === 'pop' && code[i + 6] === code[i + 1]) {
- num1 = stack.pop();
- stack.push(buildMinOperation(num1, code[i + 1]));
- i += 6;
- break;
- }
- ast1 = stack[stack.length - 1];
- if (ast1.type === 'literal' || ast1.type === 'var') {
- stack.push(ast1);
- break;
- }
- tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
- stack[stack.length - 1] = tmpVar;
- stack.push(tmpVar);
- instructions.push(new AstVariableDefinition(tmpVar, ast1));
- break;
- case 'roll':
- if (stack.length < 2) {
- return null;
- }
- num2 = stack.pop();
- num1 = stack.pop();
- if (num2.type !== 'literal' || num1.type !== 'literal') {
- return null;
- }
- j = num2.number;
- n = num1.number;
- if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
- return null;
- }
- j = (j % n + n) % n;
- if (j === 0) {
- break;
- }
- Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
- break;
- default:
- return null;
- }
- }
- if (stack.length !== outputSize) {
- return null;
- }
- var result = [];
- instructions.forEach(function (instruction) {
- var statementBuilder = new ExpressionBuilderVisitor();
- instruction.visit(statementBuilder);
- result.push(statementBuilder.toString());
- });
- stack.forEach(function (expr, i) {
- var statementBuilder = new ExpressionBuilderVisitor();
- expr.visit(statementBuilder);
- var min = range[i * 2],
- max = range[i * 2 + 1];
- var out = [statementBuilder.toString()];
- if (min > expr.min) {
- out.unshift('Math.max(', min, ', ');
- out.push(')');
- }
- if (max < expr.max) {
- out.unshift('Math.min(', max, ', ');
- out.push(')');
- }
- out.unshift('dest[destOffset + ', i, '] = ');
- out.push(';');
- result.push(out.join(''));
- });
- return result.join('\n');
- }
- };
- return PostScriptCompiler;
-}();
-exports.isPDFFunction = isPDFFunction;
-exports.PDFFunctionFactory = PDFFunctionFactory;
-exports.PostScriptEvaluator = PostScriptEvaluator;
-exports.PostScriptCompiler = PostScriptCompiler;
-
-/***/ }),
-/* 169 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.PostScriptParser = exports.PostScriptLexer = undefined;
-
-var _util = __w_pdfjs_require__(2);
-
-var _primitives = __w_pdfjs_require__(138);
-
-var PostScriptParser = function PostScriptParserClosure() {
- function PostScriptParser(lexer) {
- this.lexer = lexer;
- this.operators = [];
- this.token = null;
- this.prev = null;
- }
- PostScriptParser.prototype = {
- nextToken: function PostScriptParser_nextToken() {
- this.prev = this.token;
- this.token = this.lexer.getToken();
- },
- accept: function PostScriptParser_accept(type) {
- if (this.token.type === type) {
- this.nextToken();
- return true;
- }
- return false;
- },
- expect: function PostScriptParser_expect(type) {
- if (this.accept(type)) {
- return true;
- }
- throw new _util.FormatError('Unexpected symbol: found ' + this.token.type + ' expected ' + type + '.');
- },
- parse: function PostScriptParser_parse() {
- this.nextToken();
- this.expect(PostScriptTokenTypes.LBRACE);
- this.parseBlock();
- this.expect(PostScriptTokenTypes.RBRACE);
- return this.operators;
- },
- parseBlock: function PostScriptParser_parseBlock() {
- while (true) {
- if (this.accept(PostScriptTokenTypes.NUMBER)) {
- this.operators.push(this.prev.value);
- } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
- this.operators.push(this.prev.value);
- } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
- this.parseCondition();
- } else {
- return;
- }
- }
- },
- parseCondition: function PostScriptParser_parseCondition() {
- var conditionLocation = this.operators.length;
- this.operators.push(null, null);
- this.parseBlock();
- this.expect(PostScriptTokenTypes.RBRACE);
- if (this.accept(PostScriptTokenTypes.IF)) {
- this.operators[conditionLocation] = this.operators.length;
- this.operators[conditionLocation + 1] = 'jz';
- } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
- var jumpLocation = this.operators.length;
- this.operators.push(null, null);
- var endOfTrue = this.operators.length;
- this.parseBlock();
- this.expect(PostScriptTokenTypes.RBRACE);
- this.expect(PostScriptTokenTypes.IFELSE);
- this.operators[jumpLocation] = this.operators.length;
- this.operators[jumpLocation + 1] = 'j';
- this.operators[conditionLocation] = endOfTrue;
- this.operators[conditionLocation + 1] = 'jz';
- } else {
- throw new _util.FormatError('PS Function: error parsing conditional.');
- }
- }
- };
- return PostScriptParser;
-}();
-var PostScriptTokenTypes = {
- LBRACE: 0,
- RBRACE: 1,
- NUMBER: 2,
- OPERATOR: 3,
- IF: 4,
- IFELSE: 5
-};
-var PostScriptToken = function PostScriptTokenClosure() {
- function PostScriptToken(type, value) {
- this.type = type;
- this.value = value;
- }
- var opCache = Object.create(null);
- PostScriptToken.getOperator = function PostScriptToken_getOperator(op) {
- var opValue = opCache[op];
- if (opValue) {
- return opValue;
- }
- return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
- };
- PostScriptToken.LBRACE = new PostScriptToken(PostScriptTokenTypes.LBRACE, '{');
- PostScriptToken.RBRACE = new PostScriptToken(PostScriptTokenTypes.RBRACE, '}');
- PostScriptToken.IF = new PostScriptToken(PostScriptTokenTypes.IF, 'IF');
- PostScriptToken.IFELSE = new PostScriptToken(PostScriptTokenTypes.IFELSE, 'IFELSE');
- return PostScriptToken;
-}();
-var PostScriptLexer = function PostScriptLexerClosure() {
- function PostScriptLexer(stream) {
- this.stream = stream;
- this.nextChar();
- this.strBuf = [];
- }
- PostScriptLexer.prototype = {
- nextChar: function PostScriptLexer_nextChar() {
- return this.currentChar = this.stream.getByte();
- },
- getToken: function PostScriptLexer_getToken() {
- var comment = false;
- var ch = this.currentChar;
- while (true) {
- if (ch < 0) {
- return _primitives.EOF;
- }
- if (comment) {
- if (ch === 0x0A || ch === 0x0D) {
- comment = false;
- }
- } else if (ch === 0x25) {
- comment = true;
- } else if (!(0, _util.isSpace)(ch)) {
- break;
- }
- ch = this.nextChar();
- }
- switch (ch | 0) {
- case 0x30:
- case 0x31:
- case 0x32:
- case 0x33:
- case 0x34:
- case 0x35:
- case 0x36:
- case 0x37:
- case 0x38:
- case 0x39:
- case 0x2B:
- case 0x2D:
- case 0x2E:
- return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
- case 0x7B:
- this.nextChar();
- return PostScriptToken.LBRACE;
- case 0x7D:
- this.nextChar();
- return PostScriptToken.RBRACE;
- }
- var strBuf = this.strBuf;
- strBuf.length = 0;
- strBuf[0] = String.fromCharCode(ch);
- while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A)) {
- strBuf.push(String.fromCharCode(ch));
- }
- var str = strBuf.join('');
- switch (str.toLowerCase()) {
- case 'if':
- return PostScriptToken.IF;
- case 'ifelse':
- return PostScriptToken.IFELSE;
- default:
- return PostScriptToken.getOperator(str);
- }
- },
- getNumber: function PostScriptLexer_getNumber() {
- var ch = this.currentChar;
- var strBuf = this.strBuf;
- strBuf.length = 0;
- strBuf[0] = String.fromCharCode(ch);
- while ((ch = this.nextChar()) >= 0) {
- if (ch >= 0x30 && ch <= 0x39 || ch === 0x2D || ch === 0x2E) {
- strBuf.push(String.fromCharCode(ch));
- } else {
- break;
- }
- }
- var value = parseFloat(strBuf.join(''));
- if (isNaN(value)) {
- throw new _util.FormatError('Invalid floating point number: ' + value);
- }
- return value;
- }
- };
- return PostScriptLexer;
-}();
-exports.PostScriptLexer = PostScriptLexer;
-exports.PostScriptParser = PostScriptParser;
-
-/***/ }),
-/* 170 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.MurmurHash3_64 = undefined;
-
-var _util = __w_pdfjs_require__(2);
-
-var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
- var MASK_HIGH = 0xffff0000;
- var MASK_LOW = 0xffff;
- function MurmurHash3_64(seed) {
- var SEED = 0xc3d2e1f0;
- this.h1 = seed ? seed & 0xffffffff : SEED;
- this.h2 = seed ? seed & 0xffffffff : SEED;
- }
- MurmurHash3_64.prototype = {
- update: function MurmurHash3_64_update(input) {
- var data = void 0,
- length = void 0;
- if ((0, _util.isString)(input)) {
- data = new Uint8Array(input.length * 2);
- length = 0;
- for (var i = 0, ii = input.length; i < ii; i++) {
- var code = input.charCodeAt(i);
- if (code <= 0xff) {
- data[length++] = code;
- } else {
- data[length++] = code >>> 8;
- data[length++] = code & 0xff;
- }
- }
- } else if ((0, _util.isArrayBuffer)(input)) {
- data = input;
- length = data.byteLength;
- } else {
- throw new Error('Wrong data format in MurmurHash3_64_update. ' + 'Input must be a string or array.');
- }
- 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;
- for (var _i = 0; _i < blockCounts; _i++) {
- if (_i & 1) {
- k1 = dataUint32[_i];
- k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
- k1 = k1 << 15 | k1 >>> 17;
- k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
- h1 ^= k1;
- h1 = h1 << 13 | h1 >>> 19;
- h1 = h1 * 5 + 0xe6546b64;
- } else {
- k2 = dataUint32[_i];
- k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
- k2 = k2 << 15 | k2 >>> 17;
- k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
- h2 ^= k2;
- h2 = h2 << 13 | h2 >>> 19;
- h2 = h2 * 5 + 0xe6546b64;
- }
- }
- k1 = 0;
- switch (tailLength) {
- case 3:
- k1 ^= data[blockCounts * 4 + 2] << 16;
- case 2:
- k1 ^= data[blockCounts * 4 + 1] << 8;
- case 1:
- k1 ^= data[blockCounts * 4];
- k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
- k1 = k1 << 15 | k1 >>> 17;
- k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
- if (blockCounts & 1) {
- h1 ^= k1;
- } else {
- h2 ^= k1;
- }
- }
- this.h1 = h1;
- this.h2 = h2;
- return this;
- },
- hexdigest: function MurmurHash3_64_hexdigest() {
- var h1 = this.h1;
- var 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;
- h1 ^= h2 >>> 1;
- 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;
- for (var i = 0, arr = [h1, h2], str = ''; i < arr.length; i++) {
- var hex = (arr[i] >>> 0).toString(16);
- while (hex.length < 8) {
- hex = '0' + hex;
- }
- str += hex;
- }
- return str;
- }
- };
- return MurmurHash3_64;
-}();
-exports.MurmurHash3_64 = MurmurHash3_64;
-
-/***/ }),
-/* 171 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.PDFImage = undefined;
-
-var _slicedToArray = function () { function sliceIterator(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"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
-
-var _util = __w_pdfjs_require__(2);
-
-var _primitives = __w_pdfjs_require__(138);
-
-var _colorspace = __w_pdfjs_require__(151);
-
-var _stream = __w_pdfjs_require__(140);
-
-var _jpeg_stream = __w_pdfjs_require__(146);
-
-var _jpx = __w_pdfjs_require__(149);
-
-var PDFImage = function PDFImageClosure() {
- function handleImageData(image, nativeDecoder) {
- if (nativeDecoder && nativeDecoder.canDecode(image)) {
- return nativeDecoder.decode(image).catch(function (reason) {
- (0, _util.warn)('Native image decoding failed -- trying to recover: ' + (reason && reason.message));
- return image;
- });
- }
- return Promise.resolve(image);
- }
- function decodeAndClamp(value, addend, coefficient, max) {
- value = addend + value * coefficient;
- return value < 0 ? 0 : value > max ? max : value;
- }
- function resizeImageMask(src, bpc, w1, h1, w2, h2) {
- var length = w2 * h2;
- var dest = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
- var xRatio = w1 / w2;
- var yRatio = h1 / h2;
- var i,
- j,
- py,
- newIndex = 0,
- oldIndex;
- var xScaled = new Uint16Array(w2);
- var w1Scanline = w1;
- for (i = 0; i < w2; i++) {
- xScaled[i] = Math.floor(i * xRatio);
- }
- for (i = 0; i < h2; i++) {
- py = Math.floor(i * yRatio) * w1Scanline;
- for (j = 0; j < w2; j++) {
- oldIndex = py + xScaled[j];
- dest[newIndex++] = src[oldIndex];
- }
- }
- return dest;
- }
- function PDFImage(_ref) {
- var xref = _ref.xref,
- res = _ref.res,
- image = _ref.image,
- _ref$isInline = _ref.isInline,
- isInline = _ref$isInline === undefined ? false : _ref$isInline,
- _ref$smask = _ref.smask,
- smask = _ref$smask === undefined ? null : _ref$smask,
- _ref$mask = _ref.mask,
- mask = _ref$mask === undefined ? null : _ref$mask,
- _ref$isMask = _ref.isMask,
- isMask = _ref$isMask === undefined ? false : _ref$isMask,
- pdfFunctionFactory = _ref.pdfFunctionFactory;
-
- this.image = image;
- var dict = image.dict;
- var filter = dict.get('Filter');
- if ((0, _primitives.isName)(filter)) {
- switch (filter.name) {
- case 'JPXDecode':
- var jpxImage = new _jpx.JpxImage();
- jpxImage.parseImageProperties(image.stream);
- image.stream.reset();
- image.width = jpxImage.width;
- image.height = jpxImage.height;
- image.bitsPerComponent = jpxImage.bitsPerComponent;
- image.numComps = jpxImage.componentsCount;
- break;
- case 'JBIG2Decode':
- image.bitsPerComponent = 1;
- image.numComps = 1;
- break;
- }
- }
- var width = dict.get('Width', 'W');
- var height = dict.get('Height', 'H');
- if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
- (0, _util.warn)('PDFImage - using the Width/Height of the image data, ' + 'rather than the image dictionary.');
- width = image.width;
- height = image.height;
- }
- if (width < 1 || height < 1) {
- throw new _util.FormatError('Invalid image width: ' + width + ' or ' + ('height: ' + height));
- }
- this.width = width;
- this.height = height;
- this.interpolate = dict.get('Interpolate', 'I') || false;
- this.imageMask = dict.get('ImageMask', 'IM') || false;
- this.matte = dict.get('Matte') || false;
- var bitsPerComponent = image.bitsPerComponent;
- if (!bitsPerComponent) {
- bitsPerComponent = dict.get('BitsPerComponent', 'BPC');
- if (!bitsPerComponent) {
- if (this.imageMask) {
- bitsPerComponent = 1;
- } else {
- throw new _util.FormatError('Bits per component missing in image: ' + this.imageMask);
- }
- }
- }
- this.bpc = bitsPerComponent;
- if (!this.imageMask) {
- var colorSpace = dict.get('ColorSpace', 'CS');
- if (!colorSpace) {
- (0, _util.info)('JPX images (which do not require color spaces)');
- switch (image.numComps) {
- case 1:
- colorSpace = _primitives.Name.get('DeviceGray');
- break;
- case 3:
- colorSpace = _primitives.Name.get('DeviceRGB');
- break;
- case 4:
- colorSpace = _primitives.Name.get('DeviceCMYK');
- break;
- default:
- throw new Error('JPX images with ' + image.numComps + ' ' + 'color components not supported.');
- }
- }
- var resources = isInline ? res : null;
- this.colorSpace = _colorspace.ColorSpace.parse(colorSpace, xref, resources, pdfFunctionFactory);
- this.numComps = this.colorSpace.numComps;
- }
- this.decode = dict.getArray('Decode', 'D');
- this.needsDecode = false;
- if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
- this.needsDecode = true;
- var max = (1 << bitsPerComponent) - 1;
- this.decodeCoefficients = [];
- this.decodeAddends = [];
- for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
- var dmin = this.decode[i];
- var dmax = this.decode[i + 1];
- this.decodeCoefficients[j] = dmax - dmin;
- this.decodeAddends[j] = max * dmin;
- }
- }
- if (smask) {
- this.smask = new PDFImage({
- xref: xref,
- res: res,
- image: smask,
- isInline: isInline,
- pdfFunctionFactory: pdfFunctionFactory
- });
- } else if (mask) {
- if ((0, _primitives.isStream)(mask)) {
- var maskDict = mask.dict,
- imageMask = maskDict.get('ImageMask', 'IM');
- if (!imageMask) {
- (0, _util.warn)('Ignoring /Mask in image without /ImageMask.');
- } else {
- this.mask = new PDFImage({
- xref: xref,
- res: res,
- image: mask,
- isInline: isInline,
- isMask: true,
- pdfFunctionFactory: pdfFunctionFactory
- });
- }
- } else {
- this.mask = mask;
- }
- }
- }
- PDFImage.buildImage = function (_ref2) {
- var handler = _ref2.handler,
- xref = _ref2.xref,
- res = _ref2.res,
- image = _ref2.image,
- _ref2$isInline = _ref2.isInline,
- isInline = _ref2$isInline === undefined ? false : _ref2$isInline,
- _ref2$nativeDecoder = _ref2.nativeDecoder,
- nativeDecoder = _ref2$nativeDecoder === undefined ? null : _ref2$nativeDecoder,
- pdfFunctionFactory = _ref2.pdfFunctionFactory;
-
- var imagePromise = handleImageData(image, nativeDecoder);
- var smaskPromise;
- var maskPromise;
- var smask = image.dict.get('SMask');
- var mask = image.dict.get('Mask');
- if (smask) {
- smaskPromise = handleImageData(smask, nativeDecoder);
- maskPromise = Promise.resolve(null);
- } else {
- smaskPromise = Promise.resolve(null);
- if (mask) {
- if ((0, _primitives.isStream)(mask)) {
- maskPromise = handleImageData(mask, nativeDecoder);
- } else if (Array.isArray(mask)) {
- maskPromise = Promise.resolve(mask);
- } else {
- (0, _util.warn)('Unsupported mask format.');
- maskPromise = Promise.resolve(null);
- }
- } else {
- maskPromise = Promise.resolve(null);
- }
- }
- return Promise.all([imagePromise, smaskPromise, maskPromise]).then(function (_ref3) {
- var _ref4 = _slicedToArray(_ref3, 3),
- imageData = _ref4[0],
- smaskData = _ref4[1],
- maskData = _ref4[2];
-
- return new PDFImage({
- xref: xref,
- res: res,
- image: imageData,
- isInline: isInline,
- smask: smaskData,
- mask: maskData,
- pdfFunctionFactory: pdfFunctionFactory
- });
- });
- };
- PDFImage.createMask = function (_ref5) {
- var imgArray = _ref5.imgArray,
- width = _ref5.width,
- height = _ref5.height,
- imageIsFromDecodeStream = _ref5.imageIsFromDecodeStream,
- inverseDecode = _ref5.inverseDecode;
-
- var computedLength = (width + 7 >> 3) * height;
- var actualLength = imgArray.byteLength;
- var haveFullData = computedLength === actualLength;
- var data, i;
- if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
- data = imgArray;
- } else if (!inverseDecode) {
- data = new Uint8ClampedArray(actualLength);
- data.set(imgArray);
- } else {
- data = new Uint8ClampedArray(computedLength);
- data.set(imgArray);
- for (i = actualLength; i < computedLength; i++) {
- data[i] = 0xff;
- }
- }
- if (inverseDecode) {
- for (i = 0; i < actualLength; i++) {
- data[i] ^= 0xFF;
- }
- }
- return {
- data: data,
- width: width,
- height: height
- };
- };
- PDFImage.prototype = {
- get drawWidth() {
- return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
- },
- get drawHeight() {
- return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
- },
- decodeBuffer: function decodeBuffer(buffer) {
- var bpc = this.bpc;
- var numComps = this.numComps;
- var decodeAddends = this.decodeAddends;
- var decodeCoefficients = this.decodeCoefficients;
- var max = (1 << bpc) - 1;
- var i, ii;
- if (bpc === 1) {
- for (i = 0, ii = buffer.length; i < ii; i++) {
- buffer[i] = +!buffer[i];
- }
- return;
- }
- var index = 0;
- for (i = 0, ii = this.width * this.height; i < ii; i++) {
- for (var j = 0; j < numComps; j++) {
- buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
- index++;
- }
- }
- },
- getComponents: function getComponents(buffer) {
- var bpc = this.bpc;
- if (bpc === 8) {
- return buffer;
- }
- var width = this.width;
- var height = this.height;
- var numComps = this.numComps;
- var length = width * height * numComps;
- var bufferPos = 0;
- var output = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
- var rowComps = width * numComps;
- var max = (1 << bpc) - 1;
- var i = 0,
- ii,
- buf;
- if (bpc === 1) {
- var mask, loop1End, loop2End;
- for (var j = 0; j < height; j++) {
- loop1End = i + (rowComps & ~7);
- loop2End = i + rowComps;
- while (i < loop1End) {
- buf = buffer[bufferPos++];
- output[i] = buf >> 7 & 1;
- output[i + 1] = buf >> 6 & 1;
- output[i + 2] = buf >> 5 & 1;
- output[i + 3] = buf >> 4 & 1;
- output[i + 4] = buf >> 3 & 1;
- output[i + 5] = buf >> 2 & 1;
- output[i + 6] = buf >> 1 & 1;
- output[i + 7] = buf & 1;
- i += 8;
- }
- if (i < loop2End) {
- buf = buffer[bufferPos++];
- mask = 128;
- while (i < loop2End) {
- output[i++] = +!!(buf & mask);
- mask >>= 1;
- }
- }
- }
- } else {
- var bits = 0;
- buf = 0;
- for (i = 0, ii = length; i < ii; ++i) {
- if (i % rowComps === 0) {
- buf = 0;
- bits = 0;
- }
- while (bits < bpc) {
- buf = buf << 8 | buffer[bufferPos++];
- bits += 8;
- }
- var remainingBits = bits - bpc;
- var value = buf >> remainingBits;
- output[i] = value < 0 ? 0 : value > max ? max : value;
- buf = buf & (1 << remainingBits) - 1;
- bits = remainingBits;
- }
- }
- return output;
- },
- fillOpacity: function fillOpacity(rgbaBuf, width, height, actualHeight, image) {
- var smask = this.smask;
- var mask = this.mask;
- var alphaBuf, sw, sh, i, ii, j;
- if (smask) {
- sw = smask.width;
- sh = smask.height;
- alphaBuf = new Uint8ClampedArray(sw * sh);
- smask.fillGrayBuffer(alphaBuf);
- if (sw !== width || sh !== height) {
- alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
- }
- } else if (mask) {
- if (mask instanceof PDFImage) {
- sw = mask.width;
- sh = mask.height;
- alphaBuf = new Uint8ClampedArray(sw * sh);
- mask.numComps = 1;
- mask.fillGrayBuffer(alphaBuf);
- for (i = 0, ii = sw * sh; i < ii; ++i) {
- alphaBuf[i] = 255 - alphaBuf[i];
- }
- if (sw !== width || sh !== height) {
- alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
- }
- } else if (Array.isArray(mask)) {
- alphaBuf = new Uint8ClampedArray(width * height);
- var numComps = this.numComps;
- for (i = 0, ii = width * height; i < ii; ++i) {
- var opacity = 0;
- var imageOffset = i * numComps;
- for (j = 0; j < numComps; ++j) {
- var color = image[imageOffset + j];
- var maskOffset = j * 2;
- if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
- opacity = 255;
- break;
- }
- }
- alphaBuf[i] = opacity;
- }
- } else {
- throw new _util.FormatError('Unknown mask format.');
- }
- }
- if (alphaBuf) {
- for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
- rgbaBuf[j] = alphaBuf[i];
- }
- } else {
- for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
- rgbaBuf[j] = 255;
- }
- }
- },
- undoPreblend: function undoPreblend(buffer, width, height) {
- var matte = this.smask && this.smask.matte;
- if (!matte) {
- return;
- }
- var matteRgb = this.colorSpace.getRgb(matte, 0);
- var matteR = matteRgb[0];
- var matteG = matteRgb[1];
- var matteB = matteRgb[2];
- var length = width * height * 4;
- for (var i = 0; i < length; i += 4) {
- var alpha = buffer[i + 3];
- if (alpha === 0) {
- buffer[i] = 255;
- buffer[i + 1] = 255;
- buffer[i + 2] = 255;
- continue;
- }
- var k = 255 / alpha;
- buffer[i] = (buffer[i] - matteR) * k + matteR;
- buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
- buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
- }
- },
- createImageData: function createImageData() {
- var forceRGBA = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
-
- var drawWidth = this.drawWidth;
- var drawHeight = this.drawHeight;
- var imgData = {
- width: drawWidth,
- height: drawHeight,
- kind: 0,
- data: null
- };
- var numComps = this.numComps;
- var originalWidth = this.width;
- var originalHeight = this.height;
- var bpc = this.bpc;
- var rowBytes = originalWidth * numComps * bpc + 7 >> 3;
- var imgArray;
- if (!forceRGBA) {
- var kind;
- if (this.colorSpace.name === 'DeviceGray' && bpc === 1) {
- kind = _util.ImageKind.GRAYSCALE_1BPP;
- } else if (this.colorSpace.name === 'DeviceRGB' && bpc === 8 && !this.needsDecode) {
- kind = _util.ImageKind.RGB_24BPP;
- }
- if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
- imgData.kind = kind;
- imgArray = this.getImageBytes(originalHeight * rowBytes);
- if (this.image instanceof _stream.DecodeStream) {
- imgData.data = imgArray;
- } else {
- var newArray = new Uint8ClampedArray(imgArray.length);
- newArray.set(imgArray);
- imgData.data = newArray;
- }
- if (this.needsDecode) {
- (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, 'PDFImage.createImageData: The image must be grayscale.');
- var buffer = imgData.data;
- for (var i = 0, ii = buffer.length; i < ii; i++) {
- buffer[i] ^= 0xff;
- }
- }
- return imgData;
- }
- if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
- var imageLength = originalHeight * rowBytes;
- switch (this.colorSpace.name) {
- case 'DeviceGray':
- imageLength *= 3;
- case 'DeviceRGB':
- case 'DeviceCMYK':
- imgData.kind = _util.ImageKind.RGB_24BPP;
- imgData.data = this.getImageBytes(imageLength, drawWidth, drawHeight, true);
- return imgData;
- }
- }
- }
- imgArray = this.getImageBytes(originalHeight * rowBytes);
- var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
- var comps = this.getComponents(imgArray);
- var alpha01, maybeUndoPreblend;
- if (!forceRGBA && !this.smask && !this.mask) {
- imgData.kind = _util.ImageKind.RGB_24BPP;
- imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
- alpha01 = 0;
- maybeUndoPreblend = false;
- } else {
- imgData.kind = _util.ImageKind.RGBA_32BPP;
- imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
- alpha01 = 1;
- maybeUndoPreblend = true;
- this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
- }
- if (this.needsDecode) {
- this.decodeBuffer(comps);
- }
- this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
- if (maybeUndoPreblend) {
- this.undoPreblend(imgData.data, drawWidth, actualHeight);
- }
- return imgData;
- },
- fillGrayBuffer: function fillGrayBuffer(buffer) {
- var numComps = this.numComps;
- if (numComps !== 1) {
- throw new _util.FormatError('Reading gray scale from a color image: ' + numComps);
- }
- var width = this.width;
- var height = this.height;
- var bpc = this.bpc;
- var rowBytes = width * numComps * bpc + 7 >> 3;
- var imgArray = this.getImageBytes(height * rowBytes);
- var comps = this.getComponents(imgArray);
- var i, length;
- if (bpc === 1) {
- length = width * height;
- if (this.needsDecode) {
- for (i = 0; i < length; ++i) {
- buffer[i] = comps[i] - 1 & 255;
- }
- } else {
- for (i = 0; i < length; ++i) {
- buffer[i] = -comps[i] & 255;
- }
- }
- return;
- }
- if (this.needsDecode) {
- this.decodeBuffer(comps);
- }
- length = width * height;
- var scale = 255 / ((1 << bpc) - 1);
- for (i = 0; i < length; ++i) {
- buffer[i] = scale * comps[i];
- }
- },
- getImageBytes: function getImageBytes(length, drawWidth, drawHeight) {
- var forceRGB = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
-
- this.image.reset();
- this.image.drawWidth = drawWidth || this.width;
- this.image.drawHeight = drawHeight || this.height;
- this.image.forceRGB = !!forceRGB;
- return this.image.getBytes(length, true);
- }
- };
- return PDFImage;
-}();
-exports.PDFImage = PDFImage;
-
-/***/ }),
-/* 172 */
-/***/ (function(module, exports, __w_pdfjs_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.MessageHandler = undefined;
-
-var _regenerator = __w_pdfjs_require__(131);
-
-var _regenerator2 = _interopRequireDefault(_regenerator);
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-var resolveCall = function () {
- var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee(fn, args) {
- var thisArg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
- return _regenerator2.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- if (fn) {
- _context.next = 2;
- break;
- }
-
- return _context.abrupt('return');
-
- case 2:
- return _context.abrupt('return', fn.apply(thisArg, args));
-
- case 3:
- case 'end':
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
-
- return function resolveCall(_x2, _x3) {
- return _ref.apply(this, arguments);
- };
-}();
-
-var _util = __w_pdfjs_require__(2);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
-
-function wrapReason(reason) {
- if ((typeof reason === 'undefined' ? 'undefined' : _typeof(reason)) !== 'object') {
- return reason;
- }
- switch (reason.name) {
- case 'AbortException':
- return new _util.AbortException(reason.message);
- case 'MissingPDFException':
- return new _util.MissingPDFException(reason.message);
- case 'UnexpectedResponseException':
- return new _util.UnexpectedResponseException(reason.message, reason.status);
- default:
- return new _util.UnknownErrorException(reason.message, reason.details);
- }
-}
-function makeReasonSerializable(reason) {
- if (!(reason instanceof Error) || reason instanceof _util.AbortException || reason instanceof _util.MissingPDFException || reason instanceof _util.UnexpectedResponseException || reason instanceof _util.UnknownErrorException) {
- return reason;
- }
- return new _util.UnknownErrorException(reason.message, reason.toString());
-}
-function resolveOrReject(capability, success, reason) {
- if (success) {
- capability.resolve();
- } else {
- capability.reject(reason);
- }
-}
-function finalize(promise) {
- return Promise.resolve(promise).catch(function () {});
-}
-function MessageHandler(sourceName, targetName, comObj) {
- var _this = this;
-
- this.sourceName = sourceName;
- this.targetName = targetName;
- this.comObj = comObj;
- this.callbackId = 1;
- this.streamId = 1;
- this.postMessageTransfers = true;
- this.streamSinks = Object.create(null);
- this.streamControllers = Object.create(null);
- var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
- var ah = this.actionHandler = Object.create(null);
- this._onComObjOnMessage = function (event) {
- var data = event.data;
- if (data.targetName !== _this.sourceName) {
- return;
- }
- if (data.stream) {
- _this._processStreamMessage(data);
- } else if (data.isReply) {
- var callbackId = data.callbackId;
- if (data.callbackId in callbacksCapabilities) {
- var callback = callbacksCapabilities[callbackId];
- delete callbacksCapabilities[callbackId];
- if ('error' in data) {
- callback.reject(wrapReason(data.error));
- } else {
- callback.resolve(data.data);
- }
- } else {
- throw new Error('Cannot resolve callback ' + callbackId);
- }
- } else if (data.action in ah) {
- var action = ah[data.action];
- if (data.callbackId) {
- var _sourceName = _this.sourceName;
- var _targetName = data.sourceName;
- Promise.resolve().then(function () {
- return action[0].call(action[1], data.data);
- }).then(function (result) {
- comObj.postMessage({
- sourceName: _sourceName,
- targetName: _targetName,
- isReply: true,
- callbackId: data.callbackId,
- data: result
- });
- }, function (reason) {
- comObj.postMessage({
- sourceName: _sourceName,
- targetName: _targetName,
- isReply: true,
- callbackId: data.callbackId,
- error: makeReasonSerializable(reason)
- });
- });
- } else if (data.streamId) {
- _this._createStreamSink(data);
- } else {
- action[0].call(action[1], data.data);
- }
- } else {
- throw new Error('Unknown action from worker: ' + data.action);
- }
- };
- comObj.addEventListener('message', this._onComObjOnMessage);
-}
-MessageHandler.prototype = {
- on: function on(actionName, handler, scope) {
- var ah = this.actionHandler;
- if (ah[actionName]) {
- throw new Error('There is already an actionName called "' + actionName + '"');
- }
- ah[actionName] = [handler, scope];
- },
- send: function send(actionName, data, transfers) {
- var message = {
- sourceName: this.sourceName,
- targetName: this.targetName,
- action: actionName,
- data: data
- };
- this.postMessage(message, transfers);
- },
- sendWithPromise: function sendWithPromise(actionName, data, transfers) {
- var callbackId = this.callbackId++;
- var message = {
- sourceName: this.sourceName,
- targetName: this.targetName,
- action: actionName,
- data: data,
- callbackId: callbackId
- };
- var capability = (0, _util.createPromiseCapability)();
- this.callbacksCapabilities[callbackId] = capability;
- try {
- this.postMessage(message, transfers);
- } catch (e) {
- capability.reject(e);
- }
- return capability.promise;
- },
- sendWithStream: function sendWithStream(actionName, data, queueingStrategy, transfers) {
- var _this2 = this;
-
- var streamId = this.streamId++;
- var sourceName = this.sourceName;
- var targetName = this.targetName;
- return new _util.ReadableStream({
- start: function start(controller) {
- var startCapability = (0, _util.createPromiseCapability)();
- _this2.streamControllers[streamId] = {
- controller: controller,
- startCall: startCapability,
- isClosed: false
- };
- _this2.postMessage({
- sourceName: sourceName,
- targetName: targetName,
- action: actionName,
- streamId: streamId,
- data: data,
- desiredSize: controller.desiredSize
- });
- return startCapability.promise;
- },
- pull: function pull(controller) {
- var pullCapability = (0, _util.createPromiseCapability)();
- _this2.streamControllers[streamId].pullCall = pullCapability;
- _this2.postMessage({
- sourceName: sourceName,
- targetName: targetName,
- stream: 'pull',
- streamId: streamId,
- desiredSize: controller.desiredSize
- });
- return pullCapability.promise;
- },
- cancel: function cancel(reason) {
- var cancelCapability = (0, _util.createPromiseCapability)();
- _this2.streamControllers[streamId].cancelCall = cancelCapability;
- _this2.streamControllers[streamId].isClosed = true;
- _this2.postMessage({
- sourceName: sourceName,
- targetName: targetName,
- stream: 'cancel',
- reason: reason,
- streamId: streamId
- });
- return cancelCapability.promise;
- }
- }, queueingStrategy);
- },
- _createStreamSink: function _createStreamSink(data) {
- var _this3 = this;
-
- var self = this;
- var action = this.actionHandler[data.action];
- var streamId = data.streamId;
- var desiredSize = data.desiredSize;
- var sourceName = this.sourceName;
- var targetName = data.sourceName;
- var capability = (0, _util.createPromiseCapability)();
- var sendStreamRequest = function sendStreamRequest(_ref2) {
- var stream = _ref2.stream,
- chunk = _ref2.chunk,
- transfers = _ref2.transfers,
- success = _ref2.success,
- reason = _ref2.reason;
-
- _this3.postMessage({
- sourceName: sourceName,
- targetName: targetName,
- stream: stream,
- streamId: streamId,
- chunk: chunk,
- success: success,
- reason: reason
- }, transfers);
- };
- var streamSink = {
- enqueue: function enqueue(chunk) {
- var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
- var transfers = arguments[2];
-
- if (this.isCancelled) {
- return;
- }
- var lastDesiredSize = this.desiredSize;
- this.desiredSize -= size;
- if (lastDesiredSize > 0 && this.desiredSize <= 0) {
- this.sinkCapability = (0, _util.createPromiseCapability)();
- this.ready = this.sinkCapability.promise;
- }
- sendStreamRequest({
- stream: 'enqueue',
- chunk: chunk,
- transfers: transfers
- });
- },
- close: function close() {
- if (this.isCancelled) {
- return;
- }
- this.isCancelled = true;
- sendStreamRequest({ stream: 'close' });
- delete self.streamSinks[streamId];
- },
- error: function error(reason) {
- if (this.isCancelled) {
- return;
- }
- this.isCancelled = true;
- sendStreamRequest({
- stream: 'error',
- reason: reason
- });
- },
-
- sinkCapability: capability,
- onPull: null,
- onCancel: null,
- isCancelled: false,
- desiredSize: desiredSize,
- ready: null
- };
- streamSink.sinkCapability.resolve();
- streamSink.ready = streamSink.sinkCapability.promise;
- this.streamSinks[streamId] = streamSink;
- resolveCall(action[0], [data.data, streamSink], action[1]).then(function () {
- sendStreamRequest({
- stream: 'start_complete',
- success: true
- });
- }, function (reason) {
- sendStreamRequest({
- stream: 'start_complete',
- success: false,
- reason: reason
- });
- });
- },
- _processStreamMessage: function _processStreamMessage(data) {
- var _this4 = this;
-
- var sourceName = this.sourceName;
- var targetName = data.sourceName;
- var streamId = data.streamId;
- var sendStreamResponse = function sendStreamResponse(_ref3) {
- var stream = _ref3.stream,
- success = _ref3.success,
- reason = _ref3.reason;
-
- _this4.comObj.postMessage({
- sourceName: sourceName,
- targetName: targetName,
- stream: stream,
- success: success,
- streamId: streamId,
- reason: reason
- });
- };
- var deleteStreamController = function deleteStreamController() {
- Promise.all([_this4.streamControllers[data.streamId].startCall, _this4.streamControllers[data.streamId].pullCall, _this4.streamControllers[data.streamId].cancelCall].map(function (capability) {
- return capability && finalize(capability.promise);
- })).then(function () {
- delete _this4.streamControllers[data.streamId];
- });
- };
- switch (data.stream) {
- case 'start_complete':
- resolveOrReject(this.streamControllers[data.streamId].startCall, data.success, wrapReason(data.reason));
- break;
- case 'pull_complete':
- resolveOrReject(this.streamControllers[data.streamId].pullCall, data.success, wrapReason(data.reason));
- break;
- case 'pull':
- if (!this.streamSinks[data.streamId]) {
- sendStreamResponse({
- stream: 'pull_complete',
- success: true
- });
- break;
- }
- if (this.streamSinks[data.streamId].desiredSize <= 0 && data.desiredSize > 0) {
- this.streamSinks[data.streamId].sinkCapability.resolve();
- }
- this.streamSinks[data.streamId].desiredSize = data.desiredSize;
- resolveCall(this.streamSinks[data.streamId].onPull).then(function () {
- sendStreamResponse({
- stream: 'pull_complete',
- success: true
- });
- }, function (reason) {
- sendStreamResponse({
- stream: 'pull_complete',
- success: false,
- reason: reason
- });
- });
- break;
- case 'enqueue':
- (0, _util.assert)(this.streamControllers[data.streamId], 'enqueue should have stream controller');
- if (!this.streamControllers[data.streamId].isClosed) {
- this.streamControllers[data.streamId].controller.enqueue(data.chunk);
- }
- break;
- case 'close':
- (0, _util.assert)(this.streamControllers[data.streamId], 'close should have stream controller');
- if (this.streamControllers[data.streamId].isClosed) {
- break;
- }
- this.streamControllers[data.streamId].isClosed = true;
- this.streamControllers[data.streamId].controller.close();
- deleteStreamController();
- break;
- case 'error':
- (0, _util.assert)(this.streamControllers[data.streamId], 'error should have stream controller');
- this.streamControllers[data.streamId].controller.error(wrapReason(data.reason));
- deleteStreamController();
- break;
- case 'cancel_complete':
- resolveOrReject(this.streamControllers[data.streamId].cancelCall, data.success, wrapReason(data.reason));
- deleteStreamController();
- break;
- case 'cancel':
- if (!this.streamSinks[data.streamId]) {
- break;
- }
- resolveCall(this.streamSinks[data.streamId].onCancel, [wrapReason(data.reason)]).then(function () {
- sendStreamResponse({
- stream: 'cancel_complete',
- success: true
- });
- }, function (reason) {
- sendStreamResponse({
- stream: 'cancel_complete',
- success: false,
- reason: reason
- });
- });
- this.streamSinks[data.streamId].sinkCapability.reject(wrapReason(data.reason));
- this.streamSinks[data.streamId].isCancelled = true;
- delete this.streamSinks[data.streamId];
- break;
- default:
- throw new Error('Unexpected stream case');
- }
- },
- postMessage: function postMessage(message, transfers) {
- if (transfers && this.postMessageTransfers) {
- this.comObj.postMessage(message, transfers);
- } else {
- this.comObj.postMessage(message);
- }
- },
- destroy: function destroy() {
- this.comObj.removeEventListener('message', this._onComObjOnMessage);
- }
-};
-exports.MessageHandler = MessageHandler;
-
-/***/ })
-/******/ ]);
-});
-//# sourceMappingURL=pdf.worker.js.map \ No newline at end of file
diff --git a/vendor/assets/javascripts/pdf.worker.min.js b/vendor/assets/javascripts/pdf.worker.min.js
deleted file mode 100644
index 31516d160ab..00000000000
--- a/vendor/assets/javascripts/pdf.worker.min.js
+++ /dev/null
@@ -1 +0,0 @@
-!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("pdfjs-dist/build/pdf.worker",[],t):"object"==typeof exports?exports["pdfjs-dist/build/pdf.worker"]=t():e["pdfjs-dist/build/pdf.worker"]=e.pdfjsWorker=t()}(this,function(){return function(e){var t={};function r(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};e[a].call(i.exports,i,i.exports,r);i.l=!0;return i.exports}r.m=e;r.c=t;r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})};r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});Object.defineProperty(e,"__esModule",{value:!0})};r.t=function(e,t){1&t&&(e=r(e));if(8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);r.r(a);Object.defineProperty(a,"default",{enumerable:!0,value:e});if(2&t&&"string"!=typeof e)for(var i in e)r.d(a,i,function(t){return e[t]}.bind(null,i));return a};r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};r.d(t,"a",t);return t};r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};r.p="";return r(r.s=0)}([function(e,t,r){"use strict";var a=r(1);t.WorkerMessageHandler=a.WorkerMessageHandler},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.WorkerMessageHandler=t.WorkerTask=void 0;var a,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],a=!0,i=!1,n=void 0;try{for(var o,s=e[Symbol.iterator]();!(a=(o=s.next()).done);a=!0){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=!0;n=e}finally{try{!a&&s.return&&s.return()}finally{if(i)throw n}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=r(2),s=r(130),c=r(5),l=(a=c)&&a.__esModule?a:{default:a},u=r(172),h=r(138);var f,d=function(){function e(e){this.name=e;this.terminated=!1;this._capability=(0,o.createPromiseCapability)()}e.prototype={get finished(){return this._capability.promise},finish:function(){this._capability.resolve()},terminate:function(){this.terminated=!0},ensureNotTerminated:function(){if(this.terminated)throw new Error("Worker task was terminated")}};return e}(),g=function(){function e(e){this._msgHandler=e;this._contentLength=null;this._fullRequestReader=null;this._rangeRequestReaders=[]}e.prototype={getFullReader:function(){(0,o.assert)(!this._fullRequestReader);this._fullRequestReader=new t(this._msgHandler);return this._fullRequestReader},getRangeReader:function(e,t){var a=new r(e,t,this._msgHandler);this._rangeRequestReaders.push(a);return a},cancelAllRequests:function(e){this._fullRequestReader&&this._fullRequestReader.cancel(e);this._rangeRequestReaders.slice(0).forEach(function(t){t.cancel(e)})}};function t(e){var t=this;this._msgHandler=e;this._contentLength=null;this._isRangeSupported=!1;this._isStreamingSupported=!1;var r=this._msgHandler.sendWithStream("GetReader");this._reader=r.getReader();this._headersReady=this._msgHandler.sendWithPromise("ReaderHeadersReady").then(function(e){t._isStreamingSupported=e.isStreamingSupported;t._isRangeSupported=e.isRangeSupported;t._contentLength=e.contentLength})}t.prototype={get headersReady(){return this._headersReady},get contentLength(){return this._contentLength},get isStreamingSupported(){return this._isStreamingSupported},get isRangeSupported(){return this._isRangeSupported},read:function(){return this._reader.read().then(function(e){var t=e.value;return e.done?{value:void 0,done:!0}:{value:t.buffer,done:!1}})},cancel:function(e){this._reader.cancel(e)}};function r(e,t,r){this._msgHandler=r;this.onProgress=null;var a=this._msgHandler.sendWithStream("GetRangeReader",{begin:e,end:t});this._reader=a.getReader()}r.prototype={get isStreamingSupported(){return!1},read:function(){return this._reader.read().then(function(e){var t=e.value;return e.done?{value:void 0,done:!0}:{value:t.buffer,done:!1}})},cancel:function(e){this._reader.cancel(e)}};return e}(),m={setup:function(e,t){var r=!1;e.on("test",function(t){if(!r){r=!0;if(t instanceof Uint8Array){var a=255===t[0];e.postMessageTransfers=a;var i=new XMLHttpRequest,n="response"in i;try{i.responseType}catch(e){n=!1}n?e.send("test",{supportTypedArray:!0,supportTransfers:a}):e.send("test",!1)}else e.send("test",!1)}});e.on("configure",function(e){(0,o.setVerbosityLevel)(e.verbosity)});e.on("GetDocRequest",function(e){return m.createDocumentHandler(e,t)})},createDocumentHandler:function(e,t){var r,a=!1,c=null,l=[],f=e.apiVersion;if("2.0.943"!==f)throw new Error('The API version "'+f+'" does not match the Worker version "2.0.943".');var m=e.docId,p=e.docBaseUrl,v=e.docId+"_worker",b=new u.MessageHandler(v,m,t);b.postMessageTransfers=e.postMessageTransfers;function y(){if(a)throw new Error("Worker was terminated")}function w(e){l.push(e)}function k(e){e.finish();var t=l.indexOf(e);l.splice(t,1)}function S(e){var t=(0,o.createPromiseCapability)(),a=function(){Promise.all([r.ensureDoc("numPages"),r.ensureDoc("fingerprint")]).then(function(e){var r=n(e,2),a=r[0],i=r[1];t.resolve({numPages:a,fingerprint:i})},i)},i=function(e){t.reject(e)};r.ensureDoc("checkHeader",[]).then(function(){r.ensureDoc("parseStartXRef",[]).then(function(){r.ensureDoc("parse",[e]).then(a,i)},i)},i);return t.promise}function C(e,t){var r,a=(0,o.createPromiseCapability)(),i=e.source;if(i.data){try{r=new s.LocalPdfManager(m,i.data,i.password,t,p);a.resolve(r)}catch(e){a.reject(e)}return a.promise}var n,l=[];try{n=new g(b)}catch(e){a.reject(e);return a.promise}var u=n.getFullReader();u.headersReady.then(function(){if(u.isRangeSupported){var e=i.disableAutoFetch||u.isStreamingSupported;r=new s.NetworkPdfManager(m,n,{msgHandler:b,url:i.url,password:i.password,length:u.contentLength,disableAutoFetch:e,rangeChunkSize:i.rangeChunkSize},t,p);for(var o=0;o<l.length;o++)r.sendProgressiveData(l[o]);l=[];a.resolve(r);c=null}}).catch(function(e){a.reject(e);c=null});var h=0;new Promise(function(e,n){u.read().then(function e(f){try{y();if(f.done){r||function(){var e=(0,o.arraysToBytes)(l);i.length&&e.length!==i.length&&(0,o.warn)("reported HTTP length is different from actual");try{r=new s.LocalPdfManager(m,e,i.password,t,p);a.resolve(r)}catch(e){a.reject(e)}l=[]}();c=null;return}var d=f.value;h+=(0,o.arrayByteLength)(d);u.isStreamingSupported||b.send("DocProgress",{loaded:h,total:Math.max(h,u.contentLength||0)});r?r.sendProgressiveData(d):l.push(d);u.read().then(e,n)}catch(e){n(e)}},n)}).catch(function(e){a.reject(e);c=null});c=function(){n.cancelAllRequests("abort")};return a.promise}b.on("GetPage",function(e){return r.getPage(e.pageIndex).then(function(e){return Promise.all([r.ensure(e,"rotate"),r.ensure(e,"ref"),r.ensure(e,"userUnit"),r.ensure(e,"view")]).then(function(e){var t=n(e,4);return{rotate:t[0],ref:t[1],userUnit:t[2],view:t[3]}})})});b.on("GetPageIndex",function(e){var t=new h.Ref(e.ref.num,e.ref.gen);return r.pdfDocument.catalog.getPageIndex(t)});b.on("GetDestinations",function(e){return r.ensureCatalog("destinations")});b.on("GetDestination",function(e){return r.ensureCatalog("getDestination",[e.id])});b.on("GetPageLabels",function(e){return r.ensureCatalog("pageLabels")});b.on("GetPageMode",function(e){return r.ensureCatalog("pageMode")});b.on("GetAttachments",function(e){return r.ensureCatalog("attachments")});b.on("GetJavaScript",function(e){return r.ensureCatalog("javaScript")});b.on("GetOutline",function(e){return r.ensureCatalog("documentOutline")});b.on("GetPermissions",function(e){return r.ensureCatalog("permissions")});b.on("GetMetadata",function(e){return Promise.all([r.ensureDoc("documentInfo"),r.ensureCatalog("metadata")])});b.on("GetData",function(e){r.requestLoadedStream();return r.onLoadedStream().then(function(e){return e.bytes})});b.on("GetStats",function(e){return r.pdfDocument.xref.stats});b.on("GetAnnotations",function(e){var t=e.pageIndex,a=e.intent;return r.getPage(t).then(function(e){return e.getAnnotationsData(a)})});b.on("RenderPageRequest",function(e){var t=e.pageIndex;r.getPage(t).then(function(r){var a=new d("RenderPageRequest: page "+t);w(a);var n=t+1,s=Date.now();r.getOperatorList({handler:b,task:a,intent:e.intent,renderInteractiveForms:e.renderInteractiveForms}).then(function(e){k(a);(0,o.info)("page="+n+" - getOperatorList: time="+(Date.now()-s)+"ms, len="+e.totalLength)},function(t){k(a);if(!a.terminated){b.send("UnsupportedFeature",{featureId:o.UNSUPPORTED_FEATURES.unknown});var r,s="worker.js: while trying to getPage() and getOperatorList()";r="string"==typeof t?{message:t,stack:s}:"object"===(void 0===t?"undefined":i(t))?{message:t.message||t.toString(),stack:t.stack||s}:{message:"Unknown exception type: "+(void 0===t?"undefined":i(t)),stack:s};b.send("PageError",{pageNum:n,error:r,intent:e.intent})}})})},this);b.on("GetTextContent",function(e,t){var a=e.pageIndex;t.onPull=function(e){};t.onCancel=function(e){};r.getPage(a).then(function(r){var i=new d("GetTextContent: page "+a);w(i);var n=a+1,s=Date.now();r.extractTextContent({handler:b,task:i,sink:t,normalizeWhitespace:e.normalizeWhitespace,combineTextItems:e.combineTextItems}).then(function(){k(i);(0,o.info)("text indexing: page="+n+" - time="+(Date.now()-s)+"ms");t.close()},function(e){k(i);if(!i.terminated){t.error(e);throw e}})})});b.on("Cleanup",function(e){return r.cleanup()});b.on("Terminate",function(e){a=!0;if(r){r.terminate();r=null}c&&c();var t=[];l.forEach(function(e){t.push(e.finished);e.terminate()});return Promise.all(t).then(function(){b.destroy();b=null})});b.on("Ready",function(t){!function(e){function t(e){y();b.send("GetDoc",{pdfInfo:e})}function i(e){y();if(e instanceof o.PasswordException){var t=new d("PasswordException: response "+e.code);w(t);b.sendWithPromise("PasswordRequest",e).then(function(e){k(t);r.updatePassword(e.password);n()}).catch(function(e){k(t);b.send("PasswordException",e)}.bind(null,e))}else e instanceof o.InvalidPDFException?b.send("InvalidPDF",e):e instanceof o.MissingPDFException?b.send("MissingPDF",e):e instanceof o.UnexpectedResponseException?b.send("UnexpectedResponse",e):b.send("UnknownError",new o.UnknownErrorException(e.message,e.toString()))}function n(){y();S(!1).then(t,function(e){y();if(e instanceof o.XRefParseException){r.requestLoadedStream();r.onLoadedStream().then(function(){y();S(!0).then(t,i)})}else i(e)},i)}y();C(e,{forceDataSchema:e.disableCreateObjectURL,maxImageSize:e.maxImageSize,disableFontFace:e.disableFontFace,nativeImageDecoderSupport:e.nativeImageDecoderSupport,ignoreErrors:e.ignoreErrors,isEvalSupported:e.isEvalSupported}).then(function(e){if(a){e.terminate();throw new Error("Worker was terminated")}(r=e).onLoadedStream().then(function(e){b.send("DataLoaded",{length:e.bytes.byteLength})})}).then(n,i)}(e);e=null});return v},initializeFromPort:function(e){var t=new u.MessageHandler("worker","main",e);m.setup(t,e);t.send("ready",null)}};"undefined"==typeof window&&!(0,l.default)()&&"undefined"!=typeof self&&("function"==typeof(f=self).postMessage&&"onmessage"in f)&&m.initializeFromPort(self);t.WorkerTask=d;t.WorkerMessageHandler=m},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.unreachable=t.warn=t.utf8StringToString=t.stringToUTF8String=t.stringToPDFString=t.stringToBytes=t.string32=t.shadow=t.setVerbosityLevel=t.URL=t.ReadableStream=t.removeNullCharacters=t.readUint32=t.readUint16=t.readInt8=t.log2=t.isEvalSupported=t.isLittleEndian=t.createValidAbsoluteUrl=t.isSameOrigin=t.isSpace=t.isString=t.isNum=t.isEmptyObj=t.isBool=t.isArrayBuffer=t.info=t.getVerbosityLevel=t.getLookupTableFactory=t.getInheritableProperty=t.deprecated=t.createObjectURL=t.createPromiseCapability=t.bytesToString=t.assert=t.arraysToBytes=t.arrayByteLength=t.FormatError=t.XRefParseException=t.toRomanNumerals=t.Util=t.UnknownErrorException=t.UnexpectedResponseException=t.TextRenderingMode=t.StreamType=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.NativeImageDecoding=t.MissingPDFException=t.MissingDataException=t.InvalidPDFException=t.AbortException=t.CMapCompressionType=t.ImageKind=t.FontType=t.AnnotationType=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationBorderStyleType=t.UNSUPPORTED_FEATURES=t.VerbosityLevel=t.OPS=t.IDENTITY_MATRIX=t.FONT_IDENTITY_MATRIX=void 0;var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r(3);var i=r(126),n=r(128),o={ERRORS:0,WARNINGS:1,INFOS:5},s=o.WARNINGS;function c(e){s>=o.WARNINGS&&console.log("Warning: "+e)}function l(e){throw new Error(e)}function u(e,t){e||l(t)}var h=function(){function e(e,t){this.name="PasswordException";this.message=e;this.code=t}e.prototype=new Error;e.constructor=e;return e}(),f=function(){function e(e,t){this.name="UnknownErrorException";this.message=e;this.details=t}e.prototype=new Error;e.constructor=e;return e}(),d=function(){function e(e){this.name="InvalidPDFException";this.message=e}e.prototype=new Error;e.constructor=e;return e}(),g=function(){function e(e){this.name="MissingPDFException";this.message=e}e.prototype=new Error;e.constructor=e;return e}(),m=function(){function e(e,t){this.name="UnexpectedResponseException";this.message=e;this.status=t}e.prototype=new Error;e.constructor=e;return e}(),p=function(){function e(e,t){this.begin=e;this.end=t;this.message="Missing data ["+e+", "+t+")"}e.prototype=new Error;e.prototype.name="MissingDataException";e.constructor=e;return e}(),v=function(){function e(e){this.message=e}e.prototype=new Error;e.prototype.name="XRefParseException";e.constructor=e;return e}(),b=function(){function e(e){this.message=e}e.prototype=new Error;e.prototype.name="FormatError";e.constructor=e;return e}(),y=function(){function e(e){this.name="AbortException";this.message=e}e.prototype=new Error;e.constructor=e;return e}(),w=/\x00/g;function k(e){u("string"==typeof e,"Invalid argument for stringToBytes");for(var t=e.length,r=new Uint8Array(t),a=0;a<t;++a)r[a]=255&e.charCodeAt(a);return r}function S(e){if(void 0!==e.length)return e.length;u(void 0!==e.byteLength);return e.byteLength}var C=function(){function e(){}var t=["rgb(",0,",",0,",",0,")"];e.makeCssRgb=function(e,r,a){t[1]=e;t[3]=r;t[5]=a;return t.join("")};e.transform=function(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]};e.applyTransform=function(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]};e.applyInverseTransform=function(e,t){var r=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/r,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/r]};e.getAxialAlignedBoundingBox=function(t,r){var a=e.applyTransform(t,r),i=e.applyTransform(t.slice(2,4),r),n=e.applyTransform([t[0],t[3]],r),o=e.applyTransform([t[2],t[1]],r);return[Math.min(a[0],i[0],n[0],o[0]),Math.min(a[1],i[1],n[1],o[1]),Math.max(a[0],i[0],n[0],o[0]),Math.max(a[1],i[1],n[1],o[1])]};e.inverseTransform=function(e){var t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]};e.apply3dTransform=function(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2],e[3]*t[0]+e[4]*t[1]+e[5]*t[2],e[6]*t[0]+e[7]*t[1]+e[8]*t[2]]};e.singularValueDecompose2dScale=function(e){var t=[e[0],e[2],e[1],e[3]],r=e[0]*t[0]+e[1]*t[2],a=e[0]*t[1]+e[1]*t[3],i=e[2]*t[0]+e[3]*t[2],n=e[2]*t[1]+e[3]*t[3],o=(r+n)/2,s=Math.sqrt((r+n)*(r+n)-4*(r*n-i*a))/2,c=o+s||1,l=o-s||1;return[Math.sqrt(c),Math.sqrt(l)]};e.normalizeRect=function(e){var t=e.slice(0);if(e[0]>e[2]){t[0]=e[2];t[2]=e[0]}if(e[1]>e[3]){t[1]=e[3];t[3]=e[1]}return t};e.intersect=function(t,r){function a(e,t){return e-t}var i=[t[0],t[2],r[0],r[2]].sort(a),n=[t[1],t[3],r[1],r[3]].sort(a),o=[];t=e.normalizeRect(t);r=e.normalizeRect(r);if(!(i[0]===t[0]&&i[1]===r[0]||i[0]===r[0]&&i[1]===t[0]))return!1;o[0]=i[1];o[2]=i[2];if(!(n[0]===t[1]&&n[1]===r[1]||n[0]===r[1]&&n[1]===t[1]))return!1;o[1]=n[1];o[3]=n[2];return o};return e}(),x=["","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"];var _=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];var A,P=(A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",function(e,t){if(!(arguments.length>2&&void 0!==arguments[2]&&arguments[2])&&n.URL.createObjectURL){var r=new Blob([e],{type:t});return n.URL.createObjectURL(r)}for(var a="data:"+t+";base64,",i=0,o=e.length;i<o;i+=3){var s=255&e[i],c=255&e[i+1],l=255&e[i+2];a+=A[s>>2]+A[(3&s)<<4|c>>4]+A[i+1<o?(15&c)<<2|l>>6:64]+A[i+2<o?63&l:64]}return a});t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0];t.IDENTITY_MATRIX=[1,0,0,1,0,0];t.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91};t.VerbosityLevel=o;t.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",smask:"smask",shadingPattern:"shadingPattern",font:"font"};t.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};t.AnnotationFieldFlag={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864};t.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};t.AnnotationType={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26};t.FontType={UNKNOWN:0,TYPE1:1,TYPE1C:2,CIDFONTTYPE0:3,CIDFONTTYPE0C:4,TRUETYPE:5,CIDFONTTYPE2:6,TYPE3:7,OPENTYPE:8,TYPE0:9,MMTYPE1:10};t.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};t.CMapCompressionType={NONE:0,BINARY:1,STREAM:2};t.AbortException=y;t.InvalidPDFException=d;t.MissingDataException=p;t.MissingPDFException=g;t.NativeImageDecoding={NONE:"none",DECODE:"decode",DISPLAY:"display"};t.PasswordException=h;t.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};t.PermissionFlag={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};t.StreamType={UNKNOWN:0,FLATE:1,LZW:2,DCT:3,JPX:4,JBIG:5,A85:6,AHX:7,CCF:8,RL:9};t.TextRenderingMode={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4};t.UnexpectedResponseException=m;t.UnknownErrorException=f;t.Util=C;t.toRomanNumerals=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];u(Number.isInteger(e)&&e>0,"The number should be a positive integer.");for(var r=void 0,a=[];e>=1e3;){e-=1e3;a.push("M")}r=e/100|0;e%=100;a.push(x[r]);r=e/10|0;e%=10;a.push(x[10+r]);a.push(x[20+e]);var i=a.join("");return t?i.toLowerCase():i};t.XRefParseException=v;t.FormatError=b;t.arrayByteLength=S;t.arraysToBytes=function(e){if(1===e.length&&e[0]instanceof Uint8Array)return e[0];var t,r,a,i=0,n=e.length;for(t=0;t<n;t++)i+=a=S(r=e[t]);var o=0,s=new Uint8Array(i);for(t=0;t<n;t++){(r=e[t])instanceof Uint8Array||(r="string"==typeof r?k(r):new Uint8Array(r));a=r.byteLength;s.set(r,o);o+=a}return s};t.assert=u;t.bytesToString=function(e){u(null!==e&&"object"===(void 0===e?"undefined":a(e))&&void 0!==e.length,"Invalid argument for bytesToString");var t=e.length;if(t<8192)return String.fromCharCode.apply(null,e);for(var r=[],i=0;i<t;i+=8192){var n=Math.min(i+8192,t),o=e.subarray(i,n);r.push(String.fromCharCode.apply(null,o))}return r.join("")};t.createPromiseCapability=function(){var e={};e.promise=new Promise(function(t,r){e.resolve=t;e.reject=r});return e};t.createObjectURL=P;t.deprecated=function(e){console.log("Deprecated API usage: "+e)};t.getInheritableProperty=function(e){for(var t=e.dict,r=e.key,a=e.getArray,i=void 0!==a&&a,n=e.stopWhenFound,o=void 0===n||n,s=0,l=void 0;t;){var u=i?t.getArray(r):t.get(r);if(void 0!==u){if(o)return u;l||(l=[]);l.push(u)}if(++s>100){c('getInheritableProperty: maximum loop count exceeded for "'+r+'"');break}t=t.get("Parent")}return l};t.getLookupTableFactory=function(e){var t;return function(){if(e){t=Object.create(null);e(t);e=null}return t}};t.getVerbosityLevel=function(){return s};t.info=function(e){s>=o.INFOS&&console.log("Info: "+e)};t.isArrayBuffer=function(e){return"object"===(void 0===e?"undefined":a(e))&&null!==e&&void 0!==e.byteLength};t.isBool=function(e){return"boolean"==typeof e};t.isEmptyObj=function(e){for(var t in e)return!1;return!0};t.isNum=function(e){return"number"==typeof e};t.isString=function(e){return"string"==typeof e};t.isSpace=function(e){return 32===e||9===e||13===e||10===e};t.isSameOrigin=function(e,t){try{var r=new n.URL(e);if(!r.origin||"null"===r.origin)return!1}catch(e){return!1}var a=new n.URL(t,r);return r.origin===a.origin};t.createValidAbsoluteUrl=function(e,t){if(!e)return null;try{var r=t?new n.URL(e,t):new n.URL(e);if(function(e){if(!e)return!1;switch(e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(r))return r}catch(e){}return null};t.isLittleEndian=function(){var e=new Uint8Array(4);e[0]=1;return 1===new Uint32Array(e.buffer,0,1)[0]};t.isEvalSupported=function(){try{new Function("");return!0}catch(e){return!1}};t.log2=function(e){return e<=0?0:Math.ceil(Math.log2(e))};t.readInt8=function(e,t){return e[t]<<24>>24};t.readUint16=function(e,t){return e[t]<<8|e[t+1]};t.readUint32=function(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0};t.removeNullCharacters=function(e){if("string"!=typeof e){c("The argument for removeNullCharacters must be a string.");return e}return e.replace(w,"")};t.ReadableStream=i.ReadableStream;t.URL=n.URL;t.setVerbosityLevel=function(e){Number.isInteger(e)&&(s=e)};t.shadow=function(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!1});return r};t.string32=function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)};t.stringToBytes=k;t.stringToPDFString=function(e){var t,r=e.length,a=[];if("þ"===e[0]&&"ÿ"===e[1])for(t=2;t<r;t+=2)a.push(String.fromCharCode(e.charCodeAt(t)<<8|e.charCodeAt(t+1)));else for(t=0;t<r;++t){var i=_[e.charCodeAt(t)];a.push(i?String.fromCharCode(i):e.charAt(t))}return a.join("")};t.stringToUTF8String=function(e){return decodeURIComponent(escape(e))};t.utf8StringToString=function(e){return unescape(encodeURIComponent(e))};t.warn=c;t.unreachable=l},function(e,t,r){"use strict";var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(4);if(!i._pdfjsCompatibilityChecked){i._pdfjsCompatibilityChecked=!0;var n=r(5),o="object"===("undefined"==typeof window?"undefined":a(window))&&"object"===("undefined"==typeof document?"undefined":a(document));!i.btoa&&n()&&(i.btoa=function(e){return Buffer.from(e,"binary").toString("base64")});!i.atob&&n()&&(i.atob=function(e){return Buffer.from(e,"base64").toString("binary")});o&&("currentScript"in document||Object.defineProperty(document,"currentScript",{get:function(){var e=document.getElementsByTagName("script");return e[e.length-1]},enumerable:!0,configurable:!0}));o&&void 0===Element.prototype.remove&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)});!function(){if(o&&!n()){if(!1!==document.createElement("div").classList.toggle("test",0)){var e=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(t){if(arguments.length>1){var r=!!arguments[1];return this[r?"add":"remove"](t),r}return e(t)}}}}();String.prototype.includes||r(6);Array.prototype.includes||r(34);Object.assign||r(43);Math.log2||(Math.log2=r(53));Number.isNaN||(Number.isNaN=r(55));Number.isInteger||(Number.isInteger=r(57));i.Promise||(i.Promise=r(60));i.WeakMap||(i.WeakMap=r(95));String.codePointAt||(String.codePointAt=r(112));String.fromCodePoint||(String.fromCodePoint=r(114));i.Symbol||r(116);Object.values||(Object.values=r(123))}},function(e,t,r){"use strict";e.exports="undefined"!=typeof window&&window.Math===Math?window:"undefined"!=typeof global&&global.Math===Math?global:"undefined"!=typeof self&&self.Math===Math?self:{}},function(e,t,r){"use strict";var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};e.exports=function(){return"object"===("undefined"==typeof process?"undefined":a(process))&&process+""=="[object process]"}},function(e,t,r){"use strict";r(7);e.exports=r(10).String.includes},function(e,t,r){"use strict";var a=r(8),i=r(26);a(a.P+a.F*r(33)("includes"),"String",{includes:function(e){return!!~i(this,e,"includes").indexOf(e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,r){"use strict";var a=r(9),i=r(10),n=r(11),o=r(21),s=r(24),c=function e(t,r,c){var l,u,h,f,d=t&e.F,g=t&e.G,m=t&e.P,p=t&e.B,v=g?a:t&e.S?a[r]||(a[r]={}):(a[r]||{}).prototype,b=g?i:i[r]||(i[r]={}),y=b.prototype||(b.prototype={});g&&(c=r);for(l in c){h=((u=!d&&v&&void 0!==v[l])?v:c)[l];f=p&&u?s(h,a):m&&"function"==typeof h?s(Function.call,h):h;v&&o(v,l,h,t&e.U);b[l]!=h&&n(b,l,f);m&&y[l]!=h&&(y[l]=h)}};a.core=i;c.F=1;c.G=2;c.S=4;c.P=8;c.B=16;c.W=32;c.U=64;c.R=128;e.exports=c},function(e,t,r){"use strict";var a=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=a)},function(e,t,r){"use strict";var a=e.exports={version:"2.5.7"};"number"==typeof __e&&(__e=a)},function(e,t,r){"use strict";var a=r(12),i=r(20);e.exports=r(16)?function(e,t,r){return a.f(e,t,i(1,r))}:function(e,t,r){e[t]=r;return e}},function(e,t,r){"use strict";var a=r(13),i=r(15),n=r(19),o=Object.defineProperty;t.f=r(16)?Object.defineProperty:function(e,t,r){a(e);t=n(t,!0);a(r);if(i)try{return o(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");"value"in r&&(e[t]=r.value);return e}},function(e,t,r){"use strict";var a=r(14);e.exports=function(e){if(!a(e))throw TypeError(e+" is not an object!");return e}},function(e,t,r){"use strict";var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};e.exports=function(e){return"object"===(void 0===e?"undefined":a(e))?null!==e:"function"==typeof e}},function(e,t,r){"use strict";e.exports=!r(16)&&!r(17)(function(){return 7!=Object.defineProperty(r(18)("div"),"a",{get:function(){return 7}}).a})},function(e,t,r){"use strict";e.exports=!r(17)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,r){"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,r){"use strict";var a=r(14),i=r(9).document,n=a(i)&&a(i.createElement);e.exports=function(e){return n?i.createElement(e):{}}},function(e,t,r){"use strict";var a=r(14);e.exports=function(e,t){if(!a(e))return e;var r,i;if(t&&"function"==typeof(r=e.toString)&&!a(i=r.call(e)))return i;if("function"==typeof(r=e.valueOf)&&!a(i=r.call(e)))return i;if(!t&&"function"==typeof(r=e.toString)&&!a(i=r.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t,r){"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,r){"use strict";var a=r(9),i=r(11),n=r(22),o=r(23)("src"),s=Function.toString,c=(""+s).split("toString");r(10).inspectSource=function(e){return s.call(e)};(e.exports=function(e,t,r,s){var l="function"==typeof r;l&&(n(r,"name")||i(r,"name",t));if(e[t]!==r){l&&(n(r,o)||i(r,o,e[t]?""+e[t]:c.join(String(t))));if(e===a)e[t]=r;else if(s)e[t]?e[t]=r:i(e,t,r);else{delete e[t];i(e,t,r)}}})(Function.prototype,"toString",function(){return"function"==typeof this&&this[o]||s.call(this)})},function(e,t,r){"use strict";var a={}.hasOwnProperty;e.exports=function(e,t){return a.call(e,t)}},function(e,t,r){"use strict";var a=0,i=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++a+i).toString(36))}},function(e,t,r){"use strict";var a=r(25);e.exports=function(e,t,r){a(e);if(void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,a){return e.call(t,r,a)};case 3:return function(r,a,i){return e.call(t,r,a,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,r){"use strict";e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,r){"use strict";var a=r(27),i=r(32);e.exports=function(e,t,r){if(a(t))throw TypeError("String#"+r+" doesn't accept regex!");return String(i(e))}},function(e,t,r){"use strict";var a=r(14),i=r(28),n=r(29)("match");e.exports=function(e){var t;return a(e)&&(void 0!==(t=e[n])?!!t:"RegExp"==i(e))}},function(e,t,r){"use strict";var a={}.toString;e.exports=function(e){return a.call(e).slice(8,-1)}},function(e,t,r){"use strict";var a=r(30)("wks"),i=r(23),n=r(9).Symbol,o="function"==typeof n;(e.exports=function(e){return a[e]||(a[e]=o&&n[e]||(o?n:i)("Symbol."+e))}).store=a},function(e,t,r){"use strict";var a=r(10),i=r(9),n=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(e.exports=function(e,t){return n[e]||(n[e]=void 0!==t?t:{})})("versions",[]).push({version:a.version,mode:r(31)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(e,t,r){"use strict";e.exports=!1},function(e,t,r){"use strict";e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,r){"use strict";var a=r(29)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{t[a]=!1;return!"/./"[e](t)}catch(e){}}return!0}},function(e,t,r){"use strict";r(35);e.exports=r(10).Array.includes},function(e,t,r){"use strict";var a=r(8),i=r(36)(!0);a(a.P,"Array",{includes:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}});r(42)("includes")},function(e,t,r){"use strict";var a=r(37),i=r(39),n=r(41);e.exports=function(e){return function(t,r,o){var s,c=a(t),l=i(c.length),u=n(o,l);if(e&&r!=r){for(;l>u;)if((s=c[u++])!=s)return!0}else for(;l>u;u++)if((e||u in c)&&c[u]===r)return e||u||0;return!e&&-1}}},function(e,t,r){"use strict";var a=r(38),i=r(32);e.exports=function(e){return a(i(e))}},function(e,t,r){"use strict";var a=r(28);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==a(e)?e.split(""):Object(e)}},function(e,t,r){"use strict";var a=r(40),i=Math.min;e.exports=function(e){return e>0?i(a(e),9007199254740991):0}},function(e,t,r){"use strict";var a=Math.ceil,i=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?i:a)(e)}},function(e,t,r){"use strict";var a=r(40),i=Math.max,n=Math.min;e.exports=function(e,t){return(e=a(e))<0?i(e+t,0):n(e,t)}},function(e,t,r){"use strict";var a=r(29)("unscopables"),i=Array.prototype;void 0==i[a]&&r(11)(i,a,{});e.exports=function(e){i[a][e]=!0}},function(e,t,r){"use strict";r(44);e.exports=r(10).Object.assign},function(e,t,r){"use strict";var a=r(8);a(a.S+a.F,"Object",{assign:r(45)})},function(e,t,r){"use strict";var a=r(46),i=r(50),n=r(51),o=r(52),s=r(38),c=Object.assign;e.exports=!c||r(17)(function(){var e={},t={},r=Symbol(),a="abcdefghijklmnopqrst";e[r]=7;a.split("").forEach(function(e){t[e]=e});return 7!=c({},e)[r]||Object.keys(c({},t)).join("")!=a})?function(e,t){for(var r=o(e),c=arguments.length,l=1,u=i.f,h=n.f;c>l;)for(var f,d=s(arguments[l++]),g=u?a(d).concat(u(d)):a(d),m=g.length,p=0;m>p;)h.call(d,f=g[p++])&&(r[f]=d[f]);return r}:c},function(e,t,r){"use strict";var a=r(47),i=r(49);e.exports=Object.keys||function(e){return a(e,i)}},function(e,t,r){"use strict";var a=r(22),i=r(37),n=r(36)(!1),o=r(48)("IE_PROTO");e.exports=function(e,t){var r,s=i(e),c=0,l=[];for(r in s)r!=o&&a(s,r)&&l.push(r);for(;t.length>c;)a(s,r=t[c++])&&(~n(l,r)||l.push(r));return l}},function(e,t,r){"use strict";var a=r(30)("keys"),i=r(23);e.exports=function(e){return a[e]||(a[e]=i(e))}},function(e,t,r){"use strict";e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,r){"use strict";t.f=Object.getOwnPropertySymbols},function(e,t,r){"use strict";t.f={}.propertyIsEnumerable},function(e,t,r){"use strict";var a=r(32);e.exports=function(e){return Object(a(e))}},function(e,t,r){"use strict";r(54);e.exports=r(10).Math.log2},function(e,t,r){"use strict";var a=r(8);a(a.S,"Math",{log2:function(e){return Math.log(e)/Math.LN2}})},function(e,t,r){"use strict";r(56);e.exports=r(10).Number.isNaN},function(e,t,r){"use strict";var a=r(8);a(a.S,"Number",{isNaN:function(e){return e!=e}})},function(e,t,r){"use strict";r(58);e.exports=r(10).Number.isInteger},function(e,t,r){"use strict";var a=r(8);a(a.S,"Number",{isInteger:r(59)})},function(e,t,r){"use strict";var a=r(14),i=Math.floor;e.exports=function(e){return!a(e)&&isFinite(e)&&i(e)===e}},function(e,t,r){"use strict";r(61);r(63);r(73);r(76);r(93);r(94);e.exports=r(10).Promise},function(e,t,r){"use strict";var a=r(62),i={};i[r(29)("toStringTag")]="z";i+""!="[object z]"&&r(21)(Object.prototype,"toString",function(){return"[object "+a(this)+"]"},!0)},function(e,t,r){"use strict";var a=r(28),i=r(29)("toStringTag"),n="Arguments"==a(function(){return arguments}());e.exports=function(e){var t,r,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?r:n?a(t):"Object"==(o=a(t))&&"function"==typeof t.callee?"Arguments":o}},function(e,t,r){"use strict";var a=r(64)(!0);r(65)(String,"String",function(e){this._t=String(e);this._i=0},function(){var e,t=this._t,r=this._i;if(r>=t.length)return{value:void 0,done:!0};e=a(t,r);this._i+=e.length;return{value:e,done:!1}})},function(e,t,r){"use strict";var a=r(40),i=r(32);e.exports=function(e){return function(t,r){var n,o,s=String(i(t)),c=a(r),l=s.length;return c<0||c>=l?e?"":void 0:(n=s.charCodeAt(c))<55296||n>56319||c+1===l||(o=s.charCodeAt(c+1))<56320||o>57343?e?s.charAt(c):n:e?s.slice(c,c+2):o-56320+(n-55296<<10)+65536}}},function(e,t,r){"use strict";var a=r(31),i=r(8),n=r(21),o=r(11),s=r(66),c=r(67),l=r(71),u=r(72),h=r(29)("iterator"),f=!([].keys&&"next"in[].keys()),d=function(){return this};e.exports=function(e,t,r,g,m,p,v){c(r,t,g);var b,y,w,k=function(e){if(!f&&e in _)return _[e];switch(e){case"keys":case"values":return function(){return new r(this,e)}}return function(){return new r(this,e)}},S=t+" Iterator",C="values"==m,x=!1,_=e.prototype,A=_[h]||_["@@iterator"]||m&&_[m],P=A||k(m),I=m?C?k("entries"):P:void 0,O="Array"==t&&_.entries||A;if(O&&(w=u(O.call(new e)))!==Object.prototype&&w.next){l(w,S,!0);a||"function"==typeof w[h]||o(w,h,d)}if(C&&A&&"values"!==A.name){x=!0;P=function(){return A.call(this)}}a&&!v||!f&&!x&&_[h]||o(_,h,P);s[t]=P;s[S]=d;if(m){b={values:C?P:k("values"),keys:p?P:k("keys"),entries:I};if(v)for(y in b)y in _||n(_,y,b[y]);else i(i.P+i.F*(f||x),t,b)}return b}},function(e,t,r){"use strict";e.exports={}},function(e,t,r){"use strict";var a=r(68),i=r(20),n=r(71),o={};r(11)(o,r(29)("iterator"),function(){return this});e.exports=function(e,t,r){e.prototype=a(o,{next:i(1,r)});n(e,t+" Iterator")}},function(e,t,r){"use strict";var a=r(13),i=r(69),n=r(49),o=r(48)("IE_PROTO"),s=function(){},c=function(){var e,t=r(18)("iframe"),a=n.length;t.style.display="none";r(70).appendChild(t);t.src="javascript:";(e=t.contentWindow.document).open();e.write("<script>document.F=Object<\/script>");e.close();c=e.F;for(;a--;)delete c.prototype[n[a]];return c()};e.exports=Object.create||function(e,t){var r;if(null!==e){s.prototype=a(e);r=new s;s.prototype=null;r[o]=e}else r=c();return void 0===t?r:i(r,t)}},function(e,t,r){"use strict";var a=r(12),i=r(13),n=r(46);e.exports=r(16)?Object.defineProperties:function(e,t){i(e);for(var r,o=n(t),s=o.length,c=0;s>c;)a.f(e,r=o[c++],t[r]);return e}},function(e,t,r){"use strict";var a=r(9).document;e.exports=a&&a.documentElement},function(e,t,r){"use strict";var a=r(12).f,i=r(22),n=r(29)("toStringTag");e.exports=function(e,t,r){e&&!i(e=r?e:e.prototype,n)&&a(e,n,{configurable:!0,value:t})}},function(e,t,r){"use strict";var a=r(22),i=r(52),n=r(48)("IE_PROTO"),o=Object.prototype;e.exports=Object.getPrototypeOf||function(e){e=i(e);return a(e,n)?e[n]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?o:null}},function(e,t,r){"use strict";for(var a=r(74),i=r(46),n=r(21),o=r(9),s=r(11),c=r(66),l=r(29),u=l("iterator"),h=l("toStringTag"),f=c.Array,d={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},g=i(d),m=0;m<g.length;m++){var p,v=g[m],b=d[v],y=o[v],w=y&&y.prototype;if(w){w[u]||s(w,u,f);w[h]||s(w,h,v);c[v]=f;if(b)for(p in a)w[p]||n(w,p,a[p],!0)}}},function(e,t,r){"use strict";var a=r(42),i=r(75),n=r(66),o=r(37);e.exports=r(65)(Array,"Array",function(e,t){this._t=o(e);this._i=0;this._k=t},function(){var e=this._t,t=this._k,r=this._i++;if(!e||r>=e.length){this._t=void 0;return i(1)}return i(0,"keys"==t?r:"values"==t?e[r]:[r,e[r]])},"values");n.Arguments=n.Array;a("keys");a("values");a("entries")},function(e,t,r){"use strict";e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,r){"use strict";var a,i,n,o,s=r(31),c=r(9),l=r(24),u=r(62),h=r(8),f=r(14),d=r(25),g=r(77),m=r(78),p=r(82),v=r(83).set,b=r(85)(),y=r(86),w=r(87),k=r(88),S=r(89),C=c.TypeError,x=c.process,_=x&&x.versions,A=_&&_.v8||"",P=c.Promise,I="process"==u(x),O=function(){},T=i=y.f,E=!!function(){try{var e=P.resolve(1),t=(e.constructor={})[r(29)("species")]=function(e){e(O,O)};return(I||"function"==typeof PromiseRejectionEvent)&&e.then(O)instanceof t&&0!==A.indexOf("6.6")&&-1===k.indexOf("Chrome/66")}catch(e){}}(),F=function(e){var t;return!(!f(e)||"function"!=typeof(t=e.then))&&t},R=function(e,t){if(!e._n){e._n=!0;var r=e._c;b(function(){for(var a=e._v,i=1==e._s,n=0,o=function(t){var r,n,o,s=i?t.ok:t.fail,c=t.resolve,l=t.reject,u=t.domain;try{if(s){if(!i){2==e._h&&M(e);e._h=1}if(!0===s)r=a;else{u&&u.enter();r=s(a);if(u){u.exit();o=!0}}r===t.promise?l(C("Promise-chain cycle")):(n=F(r))?n.call(r,c,l):c(r)}else l(a)}catch(e){u&&!o&&u.exit();l(e)}};r.length>n;)o(r[n++]);e._c=[];e._n=!1;t&&!e._h&&B(e)})}},B=function(e){v.call(c,function(){var t,r,a,i=e._v,n=D(e);if(n){t=w(function(){I?x.emit("unhandledRejection",i,e):(r=c.onunhandledrejection)?r({promise:e,reason:i}):(a=c.console)&&a.error&&a.error("Unhandled promise rejection",i)});e._h=I||D(e)?2:1}e._a=void 0;if(n&&t.e)throw t.v})},D=function(e){return 1!==e._h&&0===(e._a||e._c).length},M=function(e){v.call(c,function(){var t;I?x.emit("rejectionHandled",e):(t=c.onrejectionhandled)&&t({promise:e,reason:e._v})})},L=function(e){var t=this;if(!t._d){t._d=!0;(t=t._w||t)._v=e;t._s=2;t._a||(t._a=t._c.slice());R(t,!0)}},N=function e(t){var r,a=this;if(!a._d){a._d=!0;a=a._w||a;try{if(a===t)throw C("Promise can't be resolved itself");if(r=F(t))b(function(){var i={_w:a,_d:!1};try{r.call(t,l(e,i,1),l(L,i,1))}catch(e){L.call(i,e)}});else{a._v=t;a._s=1;R(a,!1)}}catch(e){L.call({_w:a,_d:!1},e)}}};if(!E){P=function(e){g(this,P,"Promise","_h");d(e);a.call(this);try{e(l(N,this,1),l(L,this,1))}catch(e){L.call(this,e)}};(a=function(e){this._c=[];this._a=void 0;this._s=0;this._d=!1;this._v=void 0;this._h=0;this._n=!1}).prototype=r(90)(P.prototype,{then:function(e,t){var r=T(p(this,P));r.ok="function"!=typeof e||e;r.fail="function"==typeof t&&t;r.domain=I?x.domain:void 0;this._c.push(r);this._a&&this._a.push(r);this._s&&R(this,!1);return r.promise},catch:function(e){return this.then(void 0,e)}});n=function(){var e=new a;this.promise=e;this.resolve=l(N,e,1);this.reject=l(L,e,1)};y.f=T=function(e){return e===P||e===o?new n(e):i(e)}}h(h.G+h.W+h.F*!E,{Promise:P});r(71)(P,"Promise");r(91)("Promise");o=r(10).Promise;h(h.S+h.F*!E,"Promise",{reject:function(e){var t=T(this);(0,t.reject)(e);return t.promise}});h(h.S+h.F*(s||!E),"Promise",{resolve:function(e){return S(s&&this===o?P:this,e)}});h(h.S+h.F*!(E&&r(92)(function(e){P.all(e).catch(O)})),"Promise",{all:function(e){var t=this,r=T(t),a=r.resolve,i=r.reject,n=w(function(){var r=[],n=0,o=1;m(e,!1,function(e){var s=n++,c=!1;r.push(void 0);o++;t.resolve(e).then(function(e){if(!c){c=!0;r[s]=e;--o||a(r)}},i)});--o||a(r)});n.e&&i(n.v);return r.promise},race:function(e){var t=this,r=T(t),a=r.reject,i=w(function(){m(e,!1,function(e){t.resolve(e).then(r.resolve,a)})});i.e&&a(i.v);return r.promise}})},function(e,t,r){"use strict";e.exports=function(e,t,r,a){if(!(e instanceof t)||void 0!==a&&a in e)throw TypeError(r+": incorrect invocation!");return e}},function(e,t,r){"use strict";var a=r(24),i=r(79),n=r(80),o=r(13),s=r(39),c=r(81),l={},u={},h=e.exports=function(e,t,r,h,f){var d,g,m,p,v=f?function(){return e}:c(e),b=a(r,h,t?2:1),y=0;if("function"!=typeof v)throw TypeError(e+" is not iterable!");if(n(v)){for(d=s(e.length);d>y;y++)if((p=t?b(o(g=e[y])[0],g[1]):b(e[y]))===l||p===u)return p}else for(m=v.call(e);!(g=m.next()).done;)if((p=i(m,b,g.value,t))===l||p===u)return p};h.BREAK=l;h.RETURN=u},function(e,t,r){"use strict";var a=r(13);e.exports=function(e,t,r,i){try{return i?t(a(r)[0],r[1]):t(r)}catch(t){var n=e.return;void 0!==n&&a(n.call(e));throw t}}},function(e,t,r){"use strict";var a=r(66),i=r(29)("iterator"),n=Array.prototype;e.exports=function(e){return void 0!==e&&(a.Array===e||n[i]===e)}},function(e,t,r){"use strict";var a=r(62),i=r(29)("iterator"),n=r(66);e.exports=r(10).getIteratorMethod=function(e){if(void 0!=e)return e[i]||e["@@iterator"]||n[a(e)]}},function(e,t,r){"use strict";var a=r(13),i=r(25),n=r(29)("species");e.exports=function(e,t){var r,o=a(e).constructor;return void 0===o||void 0==(r=a(o)[n])?t:i(r)}},function(e,t,r){"use strict";var a,i,n,o=r(24),s=r(84),c=r(70),l=r(18),u=r(9),h=u.process,f=u.setImmediate,d=u.clearImmediate,g=u.MessageChannel,m=u.Dispatch,p=0,v={},b=function(){var e=+this;if(v.hasOwnProperty(e)){var t=v[e];delete v[e];t()}},y=function(e){b.call(e.data)};if(!f||!d){f=function(e){for(var t=[],r=1;arguments.length>r;)t.push(arguments[r++]);v[++p]=function(){s("function"==typeof e?e:Function(e),t)};a(p);return p};d=function(e){delete v[e]};if("process"==r(28)(h))a=function(e){h.nextTick(o(b,e,1))};else if(m&&m.now)a=function(e){m.now(o(b,e,1))};else if(g){n=(i=new g).port2;i.port1.onmessage=y;a=o(n.postMessage,n,1)}else if(u.addEventListener&&"function"==typeof postMessage&&!u.importScripts){a=function(e){u.postMessage(e+"","*")};u.addEventListener("message",y,!1)}else a="onreadystatechange"in l("script")?function(e){c.appendChild(l("script")).onreadystatechange=function(){c.removeChild(this);b.call(e)}}:function(e){setTimeout(o(b,e,1),0)}}e.exports={set:f,clear:d}},function(e,t,r){"use strict";e.exports=function(e,t,r){var a=void 0===r;switch(t.length){case 0:return a?e():e.call(r);case 1:return a?e(t[0]):e.call(r,t[0]);case 2:return a?e(t[0],t[1]):e.call(r,t[0],t[1]);case 3:return a?e(t[0],t[1],t[2]):e.call(r,t[0],t[1],t[2]);case 4:return a?e(t[0],t[1],t[2],t[3]):e.call(r,t[0],t[1],t[2],t[3])}return e.apply(r,t)}},function(e,t,r){"use strict";var a=r(9),i=r(83).set,n=a.MutationObserver||a.WebKitMutationObserver,o=a.process,s=a.Promise,c="process"==r(28)(o);e.exports=function(){var e,t,r,l=function(){var a,i;c&&(a=o.domain)&&a.exit();for(;e;){i=e.fn;e=e.next;try{i()}catch(a){e?r():t=void 0;throw a}}t=void 0;a&&a.enter()};if(c)r=function(){o.nextTick(l)};else if(!n||a.navigator&&a.navigator.standalone)if(s&&s.resolve){var u=s.resolve(void 0);r=function(){u.then(l)}}else r=function(){i.call(a,l)};else{var h=!0,f=document.createTextNode("");new n(l).observe(f,{characterData:!0});r=function(){f.data=h=!h}}return function(a){var i={fn:a,next:void 0};t&&(t.next=i);if(!e){e=i;r()}t=i}}},function(e,t,r){"use strict";var a=r(25);e.exports.f=function(e){return new function(e){var t,r;this.promise=new e(function(e,a){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e;r=a});this.resolve=a(t);this.reject=a(r)}(e)}},function(e,t,r){"use strict";e.exports=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}}},function(e,t,r){"use strict";var a=r(9).navigator;e.exports=a&&a.userAgent||""},function(e,t,r){"use strict";var a=r(13),i=r(14),n=r(86);e.exports=function(e,t){a(e);if(i(t)&&t.constructor===e)return t;var r=n.f(e);(0,r.resolve)(t);return r.promise}},function(e,t,r){"use strict";var a=r(21);e.exports=function(e,t,r){for(var i in t)a(e,i,t[i],r);return e}},function(e,t,r){"use strict";var a=r(9),i=r(12),n=r(16),o=r(29)("species");e.exports=function(e){var t=a[e];n&&t&&!t[o]&&i.f(t,o,{configurable:!0,get:function(){return this}})}},function(e,t,r){"use strict";var a=r(29)("iterator"),i=!1;try{var n=[7][a]();n.return=function(){i=!0};Array.from(n,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!i)return!1;var r=!1;try{var n=[7],o=n[a]();o.next=function(){return{done:r=!0}};n[a]=function(){return o};e(n)}catch(e){}return r}},function(e,t,r){"use strict";var a=r(8),i=r(10),n=r(9),o=r(82),s=r(89);a(a.P+a.R,"Promise",{finally:function(e){var t=o(this,i.Promise||n.Promise),r="function"==typeof e;return this.then(r?function(r){return s(t,e()).then(function(){return r})}:e,r?function(r){return s(t,e()).then(function(){throw r})}:e)}})},function(e,t,r){"use strict";var a=r(8),i=r(86),n=r(87);a(a.S,"Promise",{try:function(e){var t=i.f(this),r=n(e);(r.e?t.reject:t.resolve)(r.v);return t.promise}})},function(e,t,r){"use strict";r(61);r(73);r(96);r(108);r(110);e.exports=r(10).WeakMap},function(e,t,r){"use strict";var a,i=r(97)(0),n=r(21),o=r(101),s=r(45),c=r(102),l=r(14),u=r(17),h=r(103),f=o.getWeak,d=Object.isExtensible,g=c.ufstore,m={},p=function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},v={get:function(e){if(l(e)){var t=f(e);return!0===t?g(h(this,"WeakMap")).get(e):t?t[this._i]:void 0}},set:function(e,t){return c.def(h(this,"WeakMap"),e,t)}},b=e.exports=r(104)("WeakMap",p,v,c,!0,!0);if(u(function(){return 7!=(new b).set((Object.freeze||Object)(m),7).get(m)})){s((a=c.getConstructor(p,"WeakMap")).prototype,v);o.NEED=!0;i(["delete","has","get","set"],function(e){var t=b.prototype,r=t[e];n(t,e,function(t,i){if(l(t)&&!d(t)){this._f||(this._f=new a);var n=this._f[e](t,i);return"set"==e?this:n}return r.call(this,t,i)})})}},function(e,t,r){"use strict";var a=r(24),i=r(38),n=r(52),o=r(39),s=r(98);e.exports=function(e,t){var r=1==e,c=2==e,l=3==e,u=4==e,h=6==e,f=5==e||h,d=t||s;return function(t,s,g){for(var m,p,v=n(t),b=i(v),y=a(s,g,3),w=o(b.length),k=0,S=r?d(t,w):c?d(t,0):void 0;w>k;k++)if(f||k in b){p=y(m=b[k],k,v);if(e)if(r)S[k]=p;else if(p)switch(e){case 3:return!0;case 5:return m;case 6:return k;case 2:S.push(m)}else if(u)return!1}return h?-1:l||u?u:S}}},function(e,t,r){"use strict";var a=r(99);e.exports=function(e,t){return new(a(e))(t)}},function(e,t,r){"use strict";var a=r(14),i=r(100),n=r(29)("species");e.exports=function(e){var t;if(i(e)){"function"!=typeof(t=e.constructor)||t!==Array&&!i(t.prototype)||(t=void 0);a(t)&&null===(t=t[n])&&(t=void 0)}return void 0===t?Array:t}},function(e,t,r){"use strict";var a=r(28);e.exports=Array.isArray||function(e){return"Array"==a(e)}},function(e,t,r){"use strict";var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(23)("meta"),n=r(14),o=r(22),s=r(12).f,c=0,l=Object.isExtensible||function(){return!0},u=!r(17)(function(){return l(Object.preventExtensions({}))}),h=function(e){s(e,i,{value:{i:"O"+ ++c,w:{}}})},f=e.exports={KEY:i,NEED:!1,fastKey:function(e,t){if(!n(e))return"symbol"==(void 0===e?"undefined":a(e))?e:("string"==typeof e?"S":"P")+e;if(!o(e,i)){if(!l(e))return"F";if(!t)return"E";h(e)}return e[i].i},getWeak:function(e,t){if(!o(e,i)){if(!l(e))return!0;if(!t)return!1;h(e)}return e[i].w},onFreeze:function(e){u&&f.NEED&&l(e)&&!o(e,i)&&h(e);return e}}},function(e,t,r){"use strict";var a=r(90),i=r(101).getWeak,n=r(13),o=r(14),s=r(77),c=r(78),l=r(97),u=r(22),h=r(103),f=l(5),d=l(6),g=0,m=function(e){return e._l||(e._l=new p)},p=function(){this.a=[]},v=function(e,t){return f(e.a,function(e){return e[0]===t})};p.prototype={get:function(e){var t=v(this,e);if(t)return t[1]},has:function(e){return!!v(this,e)},set:function(e,t){var r=v(this,e);r?r[1]=t:this.a.push([e,t])},delete:function(e){var t=d(this.a,function(t){return t[0]===e});~t&&this.a.splice(t,1);return!!~t}};e.exports={getConstructor:function(e,t,r,n){var l=e(function(e,a){s(e,l,t,"_i");e._t=t;e._i=g++;e._l=void 0;void 0!=a&&c(a,r,e[n],e)});a(l.prototype,{delete:function(e){if(!o(e))return!1;var r=i(e);return!0===r?m(h(this,t)).delete(e):r&&u(r,this._i)&&delete r[this._i]},has:function(e){if(!o(e))return!1;var r=i(e);return!0===r?m(h(this,t)).has(e):r&&u(r,this._i)}});return l},def:function(e,t,r){var a=i(n(t),!0);!0===a?m(e).set(t,r):a[e._i]=r;return e},ufstore:m}},function(e,t,r){"use strict";var a=r(14);e.exports=function(e,t){if(!a(e)||e._t!==t)throw TypeError("Incompatible receiver, "+t+" required!");return e}},function(e,t,r){"use strict";var a=r(9),i=r(8),n=r(21),o=r(90),s=r(101),c=r(78),l=r(77),u=r(14),h=r(17),f=r(92),d=r(71),g=r(105);e.exports=function(e,t,r,m,p,v){var b=a[e],y=b,w=p?"set":"add",k=y&&y.prototype,S={},C=function(e){var t=k[e];n(k,e,"delete"==e?function(e){return!(v&&!u(e))&&t.call(this,0===e?0:e)}:"has"==e?function(e){return!(v&&!u(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return v&&!u(e)?void 0:t.call(this,0===e?0:e)}:"add"==e?function(e){t.call(this,0===e?0:e);return this}:function(e,r){t.call(this,0===e?0:e,r);return this})};if("function"==typeof y&&(v||k.forEach&&!h(function(){(new y).entries().next()}))){var x=new y,_=x[w](v?{}:-0,1)!=x,A=h(function(){x.has(1)}),P=f(function(e){new y(e)}),I=!v&&h(function(){for(var e=new y,t=5;t--;)e[w](t,t);return!e.has(-0)});if(!P){(y=t(function(t,r){l(t,y,e);var a=g(new b,t,y);void 0!=r&&c(r,p,a[w],a);return a})).prototype=k;k.constructor=y}if(A||I){C("delete");C("has");p&&C("get")}(I||_)&&C(w);v&&k.clear&&delete k.clear}else{y=m.getConstructor(t,e,p,w);o(y.prototype,r);s.NEED=!0}d(y,e);S[e]=y;i(i.G+i.W+i.F*(y!=b),S);v||m.setStrong(y,e,p);return y}},function(e,t,r){"use strict";var a=r(14),i=r(106).set;e.exports=function(e,t,r){var n,o=t.constructor;o!==r&&"function"==typeof o&&(n=o.prototype)!==r.prototype&&a(n)&&i&&i(e,n);return e}},function(e,t,r){"use strict";var a=r(14),i=r(13),n=function(e,t){i(e);if(!a(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,a){try{(a=r(24)(Function.call,r(107).f(Object.prototype,"__proto__").set,2))(e,[]);t=!(e instanceof Array)}catch(e){t=!0}return function(e,r){n(e,r);t?e.__proto__=r:a(e,r);return e}}({},!1):void 0),check:n}},function(e,t,r){"use strict";var a=r(51),i=r(20),n=r(37),o=r(19),s=r(22),c=r(15),l=Object.getOwnPropertyDescriptor;t.f=r(16)?l:function(e,t){e=n(e);t=o(t,!0);if(c)try{return l(e,t)}catch(e){}if(s(e,t))return i(!a.f.call(e,t),e[t])}},function(e,t,r){"use strict";r(109)("WeakMap")},function(e,t,r){"use strict";var a=r(8);e.exports=function(e){a(a.S,e,{of:function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];return new this(t)}})}},function(e,t,r){"use strict";r(111)("WeakMap")},function(e,t,r){"use strict";var a=r(8),i=r(25),n=r(24),o=r(78);e.exports=function(e){a(a.S,e,{from:function(e){var t,r,a,s,c=arguments[1];i(this);(t=void 0!==c)&&i(c);if(void 0==e)return new this;r=[];if(t){a=0;s=n(c,arguments[2],2);o(e,!1,function(e){r.push(s(e,a++))})}else o(e,!1,r.push,r);return new this(r)}})}},function(e,t,r){"use strict";r(113);e.exports=r(10).String.codePointAt},function(e,t,r){"use strict";var a=r(8),i=r(64)(!1);a(a.P,"String",{codePointAt:function(e){return i(this,e)}})},function(e,t,r){"use strict";r(115);e.exports=r(10).String.fromCodePoint},function(e,t,r){"use strict";var a=r(8),i=r(41),n=String.fromCharCode,o=String.fromCodePoint;a(a.S+a.F*(!!o&&1!=o.length),"String",{fromCodePoint:function(e){for(var t,r=[],a=arguments.length,o=0;a>o;){t=+arguments[o++];if(i(t,1114111)!==t)throw RangeError(t+" is not a valid code point");r.push(t<65536?n(t):n(55296+((t-=65536)>>10),t%1024+56320))}return r.join("")}})},function(e,t,r){"use strict";r(117);r(61);e.exports=r(10).Symbol},function(e,t,r){"use strict";var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(9),n=r(22),o=r(16),s=r(8),c=r(21),l=r(101).KEY,u=r(17),h=r(30),f=r(71),d=r(23),g=r(29),m=r(118),p=r(119),v=r(120),b=r(100),y=r(13),w=r(14),k=r(37),S=r(19),C=r(20),x=r(68),_=r(121),A=r(107),P=r(12),I=r(46),O=A.f,T=P.f,E=_.f,F=i.Symbol,R=i.JSON,B=R&&R.stringify,D=g("_hidden"),M=g("toPrimitive"),L={}.propertyIsEnumerable,N=h("symbol-registry"),U=h("symbols"),q=h("op-symbols"),j=Object.prototype,z="function"==typeof F,H=i.QObject,G=!H||!H.prototype||!H.prototype.findChild,W=o&&u(function(){return 7!=x(T({},"a",{get:function(){return T(this,"a",{value:7}).a}})).a})?function(e,t,r){var a=O(j,t);a&&delete j[t];T(e,t,r);a&&e!==j&&T(j,t,a)}:T,X=function(e){var t=U[e]=x(F.prototype);t._k=e;return t},V=z&&"symbol"==a(F.iterator)?function(e){return"symbol"==(void 0===e?"undefined":a(e))}:function(e){return e instanceof F},K=function(e,t,r){e===j&&K(q,t,r);y(e);t=S(t,!0);y(r);if(n(U,t)){if(r.enumerable){n(e,D)&&e[D][t]&&(e[D][t]=!1);r=x(r,{enumerable:C(0,!1)})}else{n(e,D)||T(e,D,C(1,{}));e[D][t]=!0}return W(e,t,r)}return T(e,t,r)},Y=function(e,t){y(e);for(var r,a=v(t=k(t)),i=0,n=a.length;n>i;)K(e,r=a[i++],t[r]);return e},J=function(e){var t=L.call(this,e=S(e,!0));return!(this===j&&n(U,e)&&!n(q,e))&&(!(t||!n(this,e)||!n(U,e)||n(this,D)&&this[D][e])||t)},Z=function(e,t){e=k(e);t=S(t,!0);if(e!==j||!n(U,t)||n(q,t)){var r=O(e,t);!r||!n(U,t)||n(e,D)&&e[D][t]||(r.enumerable=!0);return r}},Q=function(e){for(var t,r=E(k(e)),a=[],i=0;r.length>i;)n(U,t=r[i++])||t==D||t==l||a.push(t);return a},$=function(e){for(var t,r=e===j,a=E(r?q:k(e)),i=[],o=0;a.length>o;)!n(U,t=a[o++])||r&&!n(j,t)||i.push(U[t]);return i};if(!z){c((F=function(){if(this instanceof F)throw TypeError("Symbol is not a constructor!");var e=d(arguments.length>0?arguments[0]:void 0);o&&G&&W(j,e,{configurable:!0,set:function t(r){this===j&&t.call(q,r);n(this,D)&&n(this[D],e)&&(this[D][e]=!1);W(this,e,C(1,r))}});return X(e)}).prototype,"toString",function(){return this._k});A.f=Z;P.f=K;r(122).f=_.f=Q;r(51).f=J;r(50).f=$;o&&!r(31)&&c(j,"propertyIsEnumerable",J,!0);m.f=function(e){return X(g(e))}}s(s.G+s.W+s.F*!z,{Symbol:F});for(var ee="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),te=0;ee.length>te;)g(ee[te++]);for(var re=I(g.store),ae=0;re.length>ae;)p(re[ae++]);s(s.S+s.F*!z,"Symbol",{for:function(e){return n(N,e+="")?N[e]:N[e]=F(e)},keyFor:function(e){if(!V(e))throw TypeError(e+" is not a symbol!");for(var t in N)if(N[t]===e)return t},useSetter:function(){G=!0},useSimple:function(){G=!1}});s(s.S+s.F*!z,"Object",{create:function(e,t){return void 0===t?x(e):Y(x(e),t)},defineProperty:K,defineProperties:Y,getOwnPropertyDescriptor:Z,getOwnPropertyNames:Q,getOwnPropertySymbols:$});R&&s(s.S+s.F*(!z||u(function(){var e=F();return"[null]"!=B([e])||"{}"!=B({a:e})||"{}"!=B(Object(e))})),"JSON",{stringify:function(e){for(var t,r,a=[e],i=1;arguments.length>i;)a.push(arguments[i++]);r=t=a[1];if((w(t)||void 0!==e)&&!V(e)){b(t)||(t=function(e,t){"function"==typeof r&&(t=r.call(this,e,t));if(!V(t))return t});a[1]=t;return B.apply(R,a)}}});F.prototype[M]||r(11)(F.prototype,M,F.prototype.valueOf);f(F,"Symbol");f(Math,"Math",!0);f(i.JSON,"JSON",!0)},function(e,t,r){"use strict";t.f=r(29)},function(e,t,r){"use strict";var a=r(9),i=r(10),n=r(31),o=r(118),s=r(12).f;e.exports=function(e){var t=i.Symbol||(i.Symbol=n?{}:a.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:o.f(e)})}},function(e,t,r){"use strict";var a=r(46),i=r(50),n=r(51);e.exports=function(e){var t=a(e),r=i.f;if(r)for(var o,s=r(e),c=n.f,l=0;s.length>l;)c.call(e,o=s[l++])&&t.push(o);return t}},function(e,t,r){"use strict";var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(37),n=r(122).f,o={}.toString,s="object"==("undefined"==typeof window?"undefined":a(window))&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return s&&"[object Window]"==o.call(e)?function(e){try{return n(e)}catch(e){return s.slice()}}(e):n(i(e))}},function(e,t,r){"use strict";var a=r(47),i=r(49).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return a(e,i)}},function(e,t,r){"use strict";r(124);e.exports=r(10).Object.values},function(e,t,r){"use strict";var a=r(8),i=r(125)(!1);a(a.S,"Object",{values:function(e){return i(e)}})},function(e,t,r){"use strict";var a=r(46),i=r(37),n=r(51).f;e.exports=function(e){return function(t){for(var r,o=i(t),s=a(o),c=s.length,l=0,u=[];c>l;)n.call(o,r=s[l++])&&u.push(e?[r,o[r]]:o[r]);return u}}},function(e,t,r){"use strict";var a=!1;if("undefined"!=typeof ReadableStream)try{new ReadableStream({start:function(e){e.close()}});a=!0}catch(e){}t.ReadableStream=a?ReadableStream:r(127).ReadableStream},function(e,t,r){"use strict";var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t){for(var r in t)e[r]=t[r]}(t,function(e){var t={};function r(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};e[a].call(i.exports,i,i.exports,r);i.l=!0;return i.exports}r.m=e;r.c=t;r.i=function(e){return e};r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:a})};r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};r.d(t,"a",t);return t};r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};r.p="";return r(r.s=7)}([function(e,t,r){var i="function"==typeof Symbol&&"symbol"===a(Symbol.iterator)?function(e){return void 0===e?"undefined":a(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":a(e)},n=r(1).assert;function o(e){return"string"==typeof e||"symbol"===(void 0===e?"undefined":i(e))}t.typeIsObject=function(e){return"object"===(void 0===e?"undefined":i(e))&&null!==e||"function"==typeof e};t.createDataProperty=function(e,r,a){n(t.typeIsObject(e));Object.defineProperty(e,r,{value:a,writable:!0,enumerable:!0,configurable:!0})};t.createArrayFromList=function(e){return e.slice()};t.ArrayBufferCopy=function(e,t,r,a,i){new Uint8Array(e).set(new Uint8Array(r,a,i),t)};t.CreateIterResultObject=function(e,t){n("boolean"==typeof t);var r={};Object.defineProperty(r,"value",{value:e,enumerable:!0,writable:!0,configurable:!0});Object.defineProperty(r,"done",{value:t,enumerable:!0,writable:!0,configurable:!0});return r};t.IsFiniteNonNegativeNumber=function(e){return!Number.isNaN(e)&&(e!==1/0&&!(e<0))};function s(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}t.InvokeOrNoop=function(e,t,r){n(void 0!==e);n(o(t));n(Array.isArray(r));var a=e[t];if(void 0!==a)return s(a,e,r)};t.PromiseInvokeOrNoop=function(e,r,a){n(void 0!==e);n(o(r));n(Array.isArray(a));try{return Promise.resolve(t.InvokeOrNoop(e,r,a))}catch(e){return Promise.reject(e)}};t.PromiseInvokeOrPerformFallback=function(e,t,r,a,i){n(void 0!==e);n(o(t));n(Array.isArray(r));n(Array.isArray(i));var c=void 0;try{c=e[t]}catch(e){return Promise.reject(e)}if(void 0===c)return a.apply(null,i);try{return Promise.resolve(s(c,e,r))}catch(e){return Promise.reject(e)}};t.TransferArrayBuffer=function(e){return e.slice()};t.ValidateAndNormalizeHighWaterMark=function(e){e=Number(e);if(Number.isNaN(e)||e<0)throw new RangeError("highWaterMark property of a queuing strategy must be non-negative and non-NaN");return e};t.ValidateAndNormalizeQueuingStrategy=function(e,r){if(void 0!==e&&"function"!=typeof e)throw new TypeError("size property of a queuing strategy must be a function");return{size:e,highWaterMark:r=t.ValidateAndNormalizeHighWaterMark(r)}}},function(e,t,r){function a(e){this.name="AssertionError";this.message=e||"";this.stack=(new Error).stack}a.prototype=Object.create(Error.prototype);a.prototype.constructor=a;e.exports={rethrowAssertionErrorRejection:function(e){e&&e.constructor===a&&setTimeout(function(){throw e},0)},AssertionError:a,assert:function(e,t){if(!e)throw new a(t)}}},function(e,t,r){var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1;a.configurable=!0;"value"in a&&(a.writable=!0);Object.defineProperty(e,a.key,a)}}return function(t,r,a){r&&e(t.prototype,r);a&&e(t,a);return t}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var n=r(0),o=n.InvokeOrNoop,s=n.PromiseInvokeOrNoop,c=n.ValidateAndNormalizeQueuingStrategy,l=n.typeIsObject,u=r(1),h=u.assert,f=u.rethrowAssertionErrorRejection,d=r(3),g=d.DequeueValue,m=d.EnqueueValueWithSize,p=d.PeekQueueValue,v=d.ResetQueue,b=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.size,n=r.highWaterMark,o=void 0===n?1:n;i(this,e);this._state="writable";this._storedError=void 0;this._writer=void 0;this._writableStreamController=void 0;this._writeRequests=[];this._inFlightWriteRequest=void 0;this._closeRequest=void 0;this._inFlightCloseRequest=void 0;this._pendingAbortRequest=void 0;this._backpressure=!1;if(void 0!==t.type)throw new RangeError("Invalid type is specified");this._writableStreamController=new N(this,t,a,o);this._writableStreamController.__startSteps()}a(e,[{key:"abort",value:function(e){return!1===w(this)?Promise.reject(G("abort")):!0===k(this)?Promise.reject(new TypeError("Cannot abort a stream that already has a writer")):S(this,e)}},{key:"getWriter",value:function(){if(!1===w(this))throw G("getWriter");return y(this)}},{key:"locked",get:function(){if(!1===w(this))throw G("locked");return k(this)}}]);return e}();e.exports={AcquireWritableStreamDefaultWriter:y,IsWritableStream:w,IsWritableStreamLocked:k,WritableStream:b,WritableStreamAbort:S,WritableStreamDefaultControllerError:H,WritableStreamDefaultWriterCloseWithErrorPropagation:function(e){var t=e._ownerWritableStream;h(void 0!==t);var r=t._state;if(!0===P(t)||"closed"===r)return Promise.resolve();if("errored"===r)return Promise.reject(t._storedError);h("writable"===r||"erroring"===r);return R(e)},WritableStreamDefaultWriterRelease:M,WritableStreamDefaultWriterWrite:L,WritableStreamCloseQueuedOrInFlight:P};function y(e){return new E(e)}function w(e){return!!l(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")}function k(e){h(!0===w(e),"IsWritableStreamLocked should only be used on known writable streams");return void 0!==e._writer}function S(e,t){var r=e._state;if("closed"===r)return Promise.resolve(void 0);if("errored"===r)return Promise.reject(e._storedError);var a=new TypeError("Requested to abort");if(void 0!==e._pendingAbortRequest)return Promise.reject(a);h("writable"===r||"erroring"===r,"state must be writable or erroring");var i=!1;if("erroring"===r){i=!0;t=void 0}var n=new Promise(function(r,a){e._pendingAbortRequest={_resolve:r,_reject:a,_reason:t,_wasAlreadyErroring:i}});!1===i&&x(e,a);return n}function C(e,t){var r=e._state;if("writable"!==r){h("erroring"===r);_(e)}else x(e,t)}function x(e,t){h(void 0===e._storedError,"stream._storedError === undefined");h("writable"===e._state,"state must be writable");var r=e._writableStreamController;h(void 0!==r,"controller must not be undefined");e._state="erroring";e._storedError=t;var a=e._writer;void 0!==a&&D(a,t);!1===I(e)&&!0===r._started&&_(e)}function _(e){h("erroring"===e._state,"stream._state === erroring");h(!1===I(e),"WritableStreamHasOperationMarkedInFlight(stream) === false");e._state="errored";e._writableStreamController.__errorSteps();for(var t=e._storedError,r=0;r<e._writeRequests.length;r++){e._writeRequests[r]._reject(t)}e._writeRequests=[];if(void 0!==e._pendingAbortRequest){var a=e._pendingAbortRequest;e._pendingAbortRequest=void 0;if(!0!==a._wasAlreadyErroring){e._writableStreamController.__abortSteps(a._reason).then(function(){a._resolve();O(e)},function(t){a._reject(t);O(e)})}else{a._reject(t);O(e)}}else O(e)}function A(e){h(void 0!==e._inFlightCloseRequest);e._inFlightCloseRequest._resolve(void 0);e._inFlightCloseRequest=void 0;var t=e._state;h("writable"===t||"erroring"===t);if("erroring"===t){e._storedError=void 0;if(void 0!==e._pendingAbortRequest){e._pendingAbortRequest._resolve();e._pendingAbortRequest=void 0}}e._state="closed";var r=e._writer;void 0!==r&&function(e){h(void 0!==e._closedPromise_resolve,"writer._closedPromise_resolve !== undefined");h(void 0!==e._closedPromise_reject,"writer._closedPromise_reject !== undefined");h("pending"===e._closedPromiseState,"writer._closedPromiseState is pending");e._closedPromise_resolve(void 0);e._closedPromise_resolve=void 0;e._closedPromise_reject=void 0;e._closedPromiseState="resolved"}(r);h(void 0===e._pendingAbortRequest,"stream._pendingAbortRequest === undefined");h(void 0===e._storedError,"stream._storedError === undefined")}function P(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function I(e){return void 0!==e._inFlightWriteRequest||void 0!==e._inFlightCloseRequest}function O(e){h("errored"===e._state,'_stream_.[[state]] is `"errored"`');if(void 0!==e._closeRequest){h(void 0===e._inFlightCloseRequest);e._closeRequest._reject(e._storedError);e._closeRequest=void 0}var t=e._writer;if(void 0!==t){K(t,e._storedError);t._closedPromise.catch(function(){})}}function T(e,t){h("writable"===e._state);h(!1===P(e));var r=e._writer;if(void 0!==r&&t!==e._backpressure)if(!0===t)!function(e){h(void 0===e._readyPromise_resolve,"writer._readyPromise_resolve === undefined");h(void 0===e._readyPromise_reject,"writer._readyPromise_reject === undefined");e._readyPromise=new Promise(function(t,r){e._readyPromise_resolve=t;e._readyPromise_reject=r});e._readyPromiseState="pending"}(r);else{h(!1===t);Z(r)}e._backpressure=t}var E=function(){function e(t){i(this,e);if(!1===w(t))throw new TypeError("WritableStreamDefaultWriter can only be constructed with a WritableStream instance");if(!0===k(t))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=t;t._writer=this;var r=t._state;if("writable"===r){!1===P(t)&&!0===t._backpressure?function(e){e._readyPromise=new Promise(function(t,r){e._readyPromise_resolve=t;e._readyPromise_reject=r});e._readyPromiseState="pending"}(this):J(this);V(this)}else if("erroring"===r){Y(this,t._storedError);this._readyPromise.catch(function(){});V(this)}else if("closed"===r){J(this);!function(e){e._closedPromise=Promise.resolve(void 0);e._closedPromise_resolve=void 0;e._closedPromise_reject=void 0;e._closedPromiseState="resolved"}(this)}else{h("errored"===r,"state must be errored");var a=t._storedError;Y(this,a);this._readyPromise.catch(function(){});!function(e,t){e._closedPromise=Promise.reject(t);e._closedPromise_resolve=void 0;e._closedPromise_reject=void 0;e._closedPromiseState="rejected"}(this,a);this._closedPromise.catch(function(){})}}a(e,[{key:"abort",value:function(e){return!1===F(this)?Promise.reject(W("abort")):void 0===this._ownerWritableStream?Promise.reject(X("abort")):function(e,t){var r=e._ownerWritableStream;h(void 0!==r);return S(r,t)}(this,e)}},{key:"close",value:function(){if(!1===F(this))return Promise.reject(W("close"));var e=this._ownerWritableStream;return void 0===e?Promise.reject(X("close")):!0===P(e)?Promise.reject(new TypeError("cannot close an already-closing stream")):R(this)}},{key:"releaseLock",value:function(){if(!1===F(this))throw W("releaseLock");var e=this._ownerWritableStream;if(void 0!==e){h(void 0!==e._writer);M(this)}}},{key:"write",value:function(e){return!1===F(this)?Promise.reject(W("write")):void 0===this._ownerWritableStream?Promise.reject(X("write to")):L(this,e)}},{key:"closed",get:function(){return!1===F(this)?Promise.reject(W("closed")):this._closedPromise}},{key:"desiredSize",get:function(){if(!1===F(this))throw W("desiredSize");if(void 0===this._ownerWritableStream)throw X("desiredSize");return function(e){var t=e._ownerWritableStream,r=t._state;if("errored"===r||"erroring"===r)return null;if("closed"===r)return 0;return U(t._writableStreamController)}(this)}},{key:"ready",get:function(){return!1===F(this)?Promise.reject(W("ready")):this._readyPromise}}]);return e}();function F(e){return!!l(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")}function R(e){var t=e._ownerWritableStream;h(void 0!==t);var r=t._state;if("closed"===r||"errored"===r)return Promise.reject(new TypeError("The stream (in "+r+" state) is not in the writable state and cannot be closed"));h("writable"===r||"erroring"===r);h(!1===P(t));var a=new Promise(function(e,r){var a={_resolve:e,_reject:r};t._closeRequest=a});!0===t._backpressure&&"writable"===r&&Z(e);!function(e){m(e,"close",0);q(e)}(t._writableStreamController);return a}function B(e,t){"pending"===e._closedPromiseState?K(e,t):function(e,t){h(void 0===e._closedPromise_resolve,"writer._closedPromise_resolve === undefined");h(void 0===e._closedPromise_reject,"writer._closedPromise_reject === undefined");h("pending"!==e._closedPromiseState,"writer._closedPromiseState is not pending");e._closedPromise=Promise.reject(t);e._closedPromiseState="rejected"}(e,t);e._closedPromise.catch(function(){})}function D(e,t){"pending"===e._readyPromiseState?function(e,t){h(void 0!==e._readyPromise_resolve,"writer._readyPromise_resolve !== undefined");h(void 0!==e._readyPromise_reject,"writer._readyPromise_reject !== undefined");e._readyPromise_reject(t);e._readyPromise_resolve=void 0;e._readyPromise_reject=void 0;e._readyPromiseState="rejected"}(e,t):function(e,t){h(void 0===e._readyPromise_resolve,"writer._readyPromise_resolve === undefined");h(void 0===e._readyPromise_reject,"writer._readyPromise_reject === undefined");e._readyPromise=Promise.reject(t);e._readyPromiseState="rejected"}(e,t);e._readyPromise.catch(function(){})}function M(e){var t=e._ownerWritableStream;h(void 0!==t);h(t._writer===e);var r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");D(e,r);B(e,r);t._writer=void 0;e._ownerWritableStream=void 0}function L(e,t){var r=e._ownerWritableStream;h(void 0!==r);var a=r._writableStreamController,i=function(e,t){var r=e._strategySize;if(void 0===r)return 1;try{return r(t)}catch(t){j(e,t);return 1}}(a,t);if(r!==e._ownerWritableStream)return Promise.reject(X("write to"));var n=r._state;if("errored"===n)return Promise.reject(r._storedError);if(!0===P(r)||"closed"===n)return Promise.reject(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===n)return Promise.reject(r._storedError);h("writable"===n);var o=function(e){h(!0===k(e));h("writable"===e._state);return new Promise(function(t,r){var a={_resolve:t,_reject:r};e._writeRequests.push(a)})}(r);!function(e,t,r){var a={chunk:t};try{m(e,a,r)}catch(t){j(e,t);return}var i=e._controlledWritableStream;if(!1===P(i)&&"writable"===i._state){var n=z(e);T(i,n)}q(e)}(a,t,i);return o}var N=function(){function e(t,r,a,n){i(this,e);if(!1===w(t))throw new TypeError("WritableStreamDefaultController can only be constructed with a WritableStream instance");if(void 0!==t._writableStreamController)throw new TypeError("WritableStreamDefaultController instances can only be created by the WritableStream constructor");this._controlledWritableStream=t;this._underlyingSink=r;this._queue=void 0;this._queueTotalSize=void 0;v(this);this._started=!1;var o=c(a,n);this._strategySize=o.size;this._strategyHWM=o.highWaterMark;T(t,z(this))}a(e,[{key:"error",value:function(e){if(!1===function(e){if(!l(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_underlyingSink"))return!1;return!0}(this))throw new TypeError("WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController");"writable"===this._controlledWritableStream._state&&H(this,e)}},{key:"__abortSteps",value:function(e){return s(this._underlyingSink,"abort",[e])}},{key:"__errorSteps",value:function(){v(this)}},{key:"__startSteps",value:function(){var e=this,t=o(this._underlyingSink,"start",[this]),r=this._controlledWritableStream;Promise.resolve(t).then(function(){h("writable"===r._state||"erroring"===r._state);e._started=!0;q(e)},function(t){h("writable"===r._state||"erroring"===r._state);e._started=!0;C(r,t)}).catch(f)}}]);return e}();function U(e){return e._strategyHWM-e._queueTotalSize}function q(e){var t=e._controlledWritableStream;if(!1!==e._started&&void 0===t._inFlightWriteRequest){var r=t._state;if("closed"!==r&&"errored"!==r)if("erroring"!==r){if(0!==e._queue.length){var a=p(e);"close"===a?function(e){var t=e._controlledWritableStream;!function(e){h(void 0===e._inFlightCloseRequest);h(void 0!==e._closeRequest);e._inFlightCloseRequest=e._closeRequest;e._closeRequest=void 0}(t);g(e);h(0===e._queue.length,"queue must be empty once the final write record is dequeued");s(e._underlyingSink,"close",[]).then(function(){A(t)},function(e){!function(e,t){h(void 0!==e._inFlightCloseRequest);e._inFlightCloseRequest._reject(t);e._inFlightCloseRequest=void 0;h("writable"===e._state||"erroring"===e._state);if(void 0!==e._pendingAbortRequest){e._pendingAbortRequest._reject(t);e._pendingAbortRequest=void 0}C(e,t)}(t,e)}).catch(f)}(e):function(e,t){var r=e._controlledWritableStream;!function(e){h(void 0===e._inFlightWriteRequest,"there must be no pending write request");h(0!==e._writeRequests.length,"writeRequests must not be empty");e._inFlightWriteRequest=e._writeRequests.shift()}(r);s(e._underlyingSink,"write",[t,e]).then(function(){!function(e){h(void 0!==e._inFlightWriteRequest);e._inFlightWriteRequest._resolve(void 0);e._inFlightWriteRequest=void 0}(r);var t=r._state;h("writable"===t||"erroring"===t);g(e);if(!1===P(r)&&"writable"===t){var a=z(e);T(r,a)}q(e)},function(e){!function(e,t){h(void 0!==e._inFlightWriteRequest);e._inFlightWriteRequest._reject(t);e._inFlightWriteRequest=void 0;h("writable"===e._state||"erroring"===e._state);C(e,t)}(r,e)}).catch(f)}(e,a.chunk)}}else _(t)}}function j(e,t){"writable"===e._controlledWritableStream._state&&H(e,t)}function z(e){return U(e)<=0}function H(e,t){var r=e._controlledWritableStream;h("writable"===r._state);x(r,t)}function G(e){return new TypeError("WritableStream.prototype."+e+" can only be used on a WritableStream")}function W(e){return new TypeError("WritableStreamDefaultWriter.prototype."+e+" can only be used on a WritableStreamDefaultWriter")}function X(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function V(e){e._closedPromise=new Promise(function(t,r){e._closedPromise_resolve=t;e._closedPromise_reject=r;e._closedPromiseState="pending"})}function K(e,t){h(void 0!==e._closedPromise_resolve,"writer._closedPromise_resolve !== undefined");h(void 0!==e._closedPromise_reject,"writer._closedPromise_reject !== undefined");h("pending"===e._closedPromiseState,"writer._closedPromiseState is pending");e._closedPromise_reject(t);e._closedPromise_resolve=void 0;e._closedPromise_reject=void 0;e._closedPromiseState="rejected"}function Y(e,t){e._readyPromise=Promise.reject(t);e._readyPromise_resolve=void 0;e._readyPromise_reject=void 0;e._readyPromiseState="rejected"}function J(e){e._readyPromise=Promise.resolve(void 0);e._readyPromise_resolve=void 0;e._readyPromise_reject=void 0;e._readyPromiseState="fulfilled"}function Z(e){h(void 0!==e._readyPromise_resolve,"writer._readyPromise_resolve !== undefined");h(void 0!==e._readyPromise_reject,"writer._readyPromise_reject !== undefined");e._readyPromise_resolve(void 0);e._readyPromise_resolve=void 0;e._readyPromise_reject=void 0;e._readyPromiseState="fulfilled"}},function(e,t,r){var a=r(0).IsFiniteNonNegativeNumber,i=r(1).assert;t.DequeueValue=function(e){i("_queue"in e&&"_queueTotalSize"in e,"Spec-level failure: DequeueValue should only be used on containers with [[queue]] and [[queueTotalSize]].");i(e._queue.length>0,"Spec-level failure: should never dequeue from an empty queue.");var t=e._queue.shift();e._queueTotalSize-=t.size;e._queueTotalSize<0&&(e._queueTotalSize=0);return t.value};t.EnqueueValueWithSize=function(e,t,r){i("_queue"in e&&"_queueTotalSize"in e,"Spec-level failure: EnqueueValueWithSize should only be used on containers with [[queue]] and [[queueTotalSize]].");r=Number(r);if(!a(r))throw new RangeError("Size must be a finite, non-NaN, non-negative number.");e._queue.push({value:t,size:r});e._queueTotalSize+=r};t.PeekQueueValue=function(e){i("_queue"in e&&"_queueTotalSize"in e,"Spec-level failure: PeekQueueValue should only be used on containers with [[queue]] and [[queueTotalSize]].");i(e._queue.length>0,"Spec-level failure: should never peek at an empty queue.");return e._queue[0].value};t.ResetQueue=function(e){i("_queue"in e&&"_queueTotalSize"in e,"Spec-level failure: ResetQueue should only be used on containers with [[queue]] and [[queueTotalSize]].");e._queue=[];e._queueTotalSize=0}},function(e,t,r){var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1;a.configurable=!0;"value"in a&&(a.writable=!0);Object.defineProperty(e,a.key,a)}}return function(t,r,a){r&&e(t.prototype,r);a&&e(t,a);return t}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var n=r(0),o=n.ArrayBufferCopy,s=n.CreateIterResultObject,c=n.IsFiniteNonNegativeNumber,l=n.InvokeOrNoop,u=n.PromiseInvokeOrNoop,h=n.TransferArrayBuffer,f=n.ValidateAndNormalizeQueuingStrategy,d=n.ValidateAndNormalizeHighWaterMark,g=r(0),m=g.createArrayFromList,p=g.createDataProperty,v=g.typeIsObject,b=r(1),y=b.assert,w=b.rethrowAssertionErrorRejection,k=r(3),S=k.DequeueValue,C=k.EnqueueValueWithSize,x=k.ResetQueue,_=r(2),A=_.AcquireWritableStreamDefaultWriter,P=_.IsWritableStream,I=_.IsWritableStreamLocked,O=_.WritableStreamAbort,T=_.WritableStreamDefaultWriterCloseWithErrorPropagation,E=_.WritableStreamDefaultWriterRelease,F=_.WritableStreamDefaultWriterWrite,R=_.WritableStreamCloseQueuedOrInFlight,B=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.size,n=r.highWaterMark;i(this,e);this._state="readable";this._reader=void 0;this._storedError=void 0;this._disturbed=!1;this._readableStreamController=void 0;var o=t.type;if("bytes"===String(o)){void 0===n&&(n=0);this._readableStreamController=new fe(this,t,n)}else{if(void 0!==o)throw new RangeError("Invalid type is specified");void 0===n&&(n=1);this._readableStreamController=new ae(this,t,a,n)}}a(e,[{key:"cancel",value:function(e){return!1===M(this)?Promise.reject(Oe("cancel")):!0===L(this)?Promise.reject(new TypeError("Cannot cancel a stream that already has a reader")):j(this,e)}},{key:"getReader",value:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).mode;if(!1===M(this))throw Oe("getReader");if(void 0===e)return D(this);if("byob"===(e=String(e)))return new J(this);throw new RangeError("Invalid mode is specified")}},{key:"pipeThrough",value:function(e,t){var r=e.writable,a=e.readable;!function(e){try{Promise.prototype.then.call(e,void 0,function(){})}catch(e){}}(this.pipeTo(r,t));return a}},{key:"pipeTo",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.preventClose,i=r.preventAbort,n=r.preventCancel;if(!1===M(this))return Promise.reject(Oe("pipeTo"));if(!1===P(e))return Promise.reject(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));a=Boolean(a);i=Boolean(i);n=Boolean(n);if(!0===L(this))return Promise.reject(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream"));if(!0===I(e))return Promise.reject(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream"));var o=D(this),s=A(e),c=!1,l=Promise.resolve();return new Promise(function(r,u){p(t,o._closedPromise,function(t){!1===i?v(function(){return O(e,t)},!0,t):b(!0,t)});p(e,s._closedPromise,function(e){!1===n?v(function(){return j(t,e)},!0,e):b(!0,e)});h=t,f=o._closedPromise,d=function(){!1===a?v(function(){return T(s)}):b()},"closed"===h._state?d():f.then(d).catch(w);var h,f,d;if(!0===R(e)||"closed"===e._state){var g=new TypeError("the destination writable stream closed before all data could be piped to it");!1===n?v(function(){return j(t,g)},!0,g):b(!0,g)}(function e(){l=Promise.resolve();return!0===c?Promise.resolve():s._readyPromise.then(function(){return re(o).then(function(e){var t=e.value;!0!==e.done&&(l=F(s,t).catch(function(){}))})}).then(e)})().catch(function(e){l=Promise.resolve();w(e)});function m(){var e=l;return l.then(function(){return e!==l?m():void 0})}function p(e,t,r){"errored"===e._state?r(e._storedError):t.catch(r).catch(w)}function v(t,r,a){if(!0!==c){c=!0;"writable"===e._state&&!1===R(e)?m().then(i):i()}function i(){t().then(function(){return y(r,a)},function(e){return y(!0,e)}).catch(w)}}function b(t,r){if(!0!==c){c=!0;"writable"===e._state&&!1===R(e)?m().then(function(){return y(t,r)}).catch(w):y(t,r)}}function y(e,t){E(s);te(o);e?u(t):r(void 0)}})}},{key:"tee",value:function(){if(!1===M(this))throw Oe("tee");var e=N(this,!1);return m(e)}},{key:"locked",get:function(){if(!1===M(this))throw Oe("locked");return L(this)}}]);return e}();e.exports={ReadableStream:B,IsReadableStreamDisturbed:function(e){y(!0===M(e),"IsReadableStreamDisturbed should only be used on known readable streams");return e._disturbed},ReadableStreamDefaultControllerClose:oe,ReadableStreamDefaultControllerEnqueue:se,ReadableStreamDefaultControllerError:ce,ReadableStreamDefaultControllerGetDesiredSize:ue};function D(e){return new Y(e)}function M(e){return!!v(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")}function L(e){y(!0===M(e),"IsReadableStreamLocked should only be used on known readable streams");return void 0!==e._reader}function N(e,t){y(!0===M(e));y("boolean"==typeof t);var r=D(e),a={closedOrErrored:!1,canceled1:!1,canceled2:!1,reason1:void 0,reason2:void 0};a.promise=new Promise(function(e){a._resolve=e});var i=function(){return function e(){var t=e._reader,r=e._branch1,a=e._branch2,i=e._teeState;return re(t).then(function(e){y(v(e));var t=e.value,n=e.done;y("boolean"==typeof n);if(!0===n&&!1===i.closedOrErrored){!1===i.canceled1&&oe(r);!1===i.canceled2&&oe(a);i.closedOrErrored=!0}if(!0!==i.closedOrErrored){var o=t,s=t;!1===i.canceled1&&se(r,o);!1===i.canceled2&&se(a,s)}})}}();i._reader=r;i._teeState=a;i._cloneForBranch2=t;var n=function(){return function e(t){var r=e._stream,a=e._teeState;a.canceled1=!0;a.reason1=t;if(!0===a.canceled2){var i=m([a.reason1,a.reason2]),n=j(r,i);a._resolve(n)}return a.promise}}();n._stream=e;n._teeState=a;var o=function(){return function e(t){var r=e._stream,a=e._teeState;a.canceled2=!0;a.reason2=t;if(!0===a.canceled1){var i=m([a.reason1,a.reason2]),n=j(r,i);a._resolve(n)}return a.promise}}();o._stream=e;o._teeState=a;var s=Object.create(Object.prototype);p(s,"pull",i);p(s,"cancel",n);var c=new B(s),l=Object.create(Object.prototype);p(l,"pull",i);p(l,"cancel",o);var u=new B(l);i._branch1=c._readableStreamController;i._branch2=u._readableStreamController;r._closedPromise.catch(function(e){if(!0!==a.closedOrErrored){ce(i._branch1,e);ce(i._branch2,e);a.closedOrErrored=!0}});return[c,u]}function U(e){y(!0===Z(e._reader));y("readable"===e._state||"closed"===e._state);return new Promise(function(t,r){var a={_resolve:t,_reject:r};e._reader._readIntoRequests.push(a)})}function q(e){y(!0===Q(e._reader));y("readable"===e._state);return new Promise(function(t,r){var a={_resolve:t,_reject:r};e._reader._readRequests.push(a)})}function j(e,t){e._disturbed=!0;if("closed"===e._state)return Promise.resolve(void 0);if("errored"===e._state)return Promise.reject(e._storedError);z(e);return e._readableStreamController.__cancelSteps(t).then(function(){})}function z(e){y("readable"===e._state);e._state="closed";var t=e._reader;if(void 0!==t){if(!0===Q(t)){for(var r=0;r<t._readRequests.length;r++){(0,t._readRequests[r]._resolve)(s(void 0,!0))}t._readRequests=[]}!function(e){y(void 0!==e._closedPromise_resolve);y(void 0!==e._closedPromise_reject);e._closedPromise_resolve(void 0);e._closedPromise_resolve=void 0;e._closedPromise_reject=void 0}(t)}}function H(e,t){y(!0===M(e),"stream must be ReadableStream");y("readable"===e._state,"state must be readable");e._state="errored";e._storedError=t;var r=e._reader;if(void 0!==r){if(!0===Q(r)){for(var a=0;a<r._readRequests.length;a++){r._readRequests[a]._reject(t)}r._readRequests=[]}else{y(Z(r),"reader must be ReadableStreamBYOBReader");for(var i=0;i<r._readIntoRequests.length;i++){r._readIntoRequests[i]._reject(t)}r._readIntoRequests=[]}Fe(r,t);r._closedPromise.catch(function(){})}}function G(e,t,r){var a=e._reader;y(a._readRequests.length>0);a._readRequests.shift()._resolve(s(t,r))}function W(e){return e._reader._readIntoRequests.length}function X(e){return e._reader._readRequests.length}function V(e){var t=e._reader;return void 0!==t&&!1!==Z(t)}function K(e){var t=e._reader;return void 0!==t&&!1!==Q(t)}var Y=function(){function e(t){i(this,e);if(!1===M(t))throw new TypeError("ReadableStreamDefaultReader can only be constructed with a ReadableStream instance");if(!0===L(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");$(this,t);this._readRequests=[]}a(e,[{key:"cancel",value:function(e){return!1===Q(this)?Promise.reject(Ee("cancel")):void 0===this._ownerReadableStream?Promise.reject(Te("cancel")):ee(this,e)}},{key:"read",value:function(){return!1===Q(this)?Promise.reject(Ee("read")):void 0===this._ownerReadableStream?Promise.reject(Te("read from")):re(this)}},{key:"releaseLock",value:function(){if(!1===Q(this))throw Ee("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");te(this)}}},{key:"closed",get:function(){return!1===Q(this)?Promise.reject(Ee("closed")):this._closedPromise}}]);return e}(),J=function(){function e(t){i(this,e);if(!M(t))throw new TypeError("ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a byte source");if(!1===de(t._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");if(L(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");$(this,t);this._readIntoRequests=[]}a(e,[{key:"cancel",value:function(e){return Z(this)?void 0===this._ownerReadableStream?Promise.reject(Te("cancel")):ee(this,e):Promise.reject(Re("cancel"))}},{key:"read",value:function(e){return Z(this)?void 0===this._ownerReadableStream?Promise.reject(Te("read from")):ArrayBuffer.isView(e)?0===e.byteLength?Promise.reject(new TypeError("view must have non-zero byteLength")):function(e,t){var r=e._ownerReadableStream;y(void 0!==r);r._disturbed=!0;if("errored"===r._state)return Promise.reject(r._storedError);return function(e,t){var r=e._controlledReadableStream,a=1;t.constructor!==DataView&&(a=t.constructor.BYTES_PER_ELEMENT);var i=t.constructor,n={buffer:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength,bytesFilled:0,elementSize:a,ctor:i,readerType:"byob"};if(e._pendingPullIntos.length>0){n.buffer=h(n.buffer);e._pendingPullIntos.push(n);return U(r)}if("closed"===r._state){var o=new t.constructor(n.buffer,n.byteOffset,0);return Promise.resolve(s(o,!0))}if(e._queueTotalSize>0){if(!0===we(e,n)){var c=be(n);Se(e);return Promise.resolve(s(c,!1))}if(!0===e._closeRequested){var l=new TypeError("Insufficient bytes to fill elements in the given buffer");Pe(e,l);return Promise.reject(l)}}n.buffer=h(n.buffer);e._pendingPullIntos.push(n);var u=U(r);me(e);return u}(r._readableStreamController,t)}(this,e):Promise.reject(new TypeError("view must be an array buffer view")):Promise.reject(Re("read"))}},{key:"releaseLock",value:function(){if(!Z(this))throw Re("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");te(this)}}},{key:"closed",get:function(){return Z(this)?this._closedPromise:Promise.reject(Re("closed"))}}]);return e}();function Z(e){return!!v(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")}function Q(e){return!!v(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")}function $(e,t){e._ownerReadableStream=t;t._reader=e;if("readable"===t._state)!function(e){e._closedPromise=new Promise(function(t,r){e._closedPromise_resolve=t;e._closedPromise_reject=r})}(e);else if("closed"===t._state)!function(e){e._closedPromise=Promise.resolve(void 0);e._closedPromise_resolve=void 0;e._closedPromise_reject=void 0}(e);else{y("errored"===t._state,"state must be errored");!function(e,t){e._closedPromise=Promise.reject(t);e._closedPromise_resolve=void 0;e._closedPromise_reject=void 0}(e,t._storedError);e._closedPromise.catch(function(){})}}function ee(e,t){var r=e._ownerReadableStream;y(void 0!==r);return j(r,t)}function te(e){y(void 0!==e._ownerReadableStream);y(e._ownerReadableStream._reader===e);"readable"===e._ownerReadableStream._state?Fe(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e,t){y(void 0===e._closedPromise_resolve);y(void 0===e._closedPromise_reject);e._closedPromise=Promise.reject(t)}(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"));e._closedPromise.catch(function(){});e._ownerReadableStream._reader=void 0;e._ownerReadableStream=void 0}function re(e){var t=e._ownerReadableStream;y(void 0!==t);t._disturbed=!0;if("closed"===t._state)return Promise.resolve(s(void 0,!0));if("errored"===t._state)return Promise.reject(t._storedError);y("readable"===t._state);return t._readableStreamController.__pullSteps()}var ae=function(){function e(t,r,a,n){i(this,e);if(!1===M(t))throw new TypeError("ReadableStreamDefaultController can only be constructed with a ReadableStream instance");if(void 0!==t._readableStreamController)throw new TypeError("ReadableStreamDefaultController instances can only be created by the ReadableStream constructor");this._controlledReadableStream=t;this._underlyingSource=r;this._queue=void 0;this._queueTotalSize=void 0;x(this);this._started=!1;this._closeRequested=!1;this._pullAgain=!1;this._pulling=!1;var o=f(a,n);this._strategySize=o.size;this._strategyHWM=o.highWaterMark;var s=this,c=l(r,"start",[this]);Promise.resolve(c).then(function(){s._started=!0;y(!1===s._pulling);y(!1===s._pullAgain);ne(s)},function(e){le(s,e)}).catch(w)}a(e,[{key:"close",value:function(){if(!1===ie(this))throw Be("close");if(!0===this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");var e=this._controlledReadableStream._state;if("readable"!==e)throw new TypeError("The stream (in "+e+" state) is not in the readable state and cannot be closed");oe(this)}},{key:"enqueue",value:function(e){if(!1===ie(this))throw Be("enqueue");if(!0===this._closeRequested)throw new TypeError("stream is closed or draining");var t=this._controlledReadableStream._state;if("readable"!==t)throw new TypeError("The stream (in "+t+" state) is not in the readable state and cannot be enqueued to");return se(this,e)}},{key:"error",value:function(e){if(!1===ie(this))throw Be("error");var t=this._controlledReadableStream;if("readable"!==t._state)throw new TypeError("The stream is "+t._state+" and so cannot be errored");ce(this,e)}},{key:"__cancelSteps",value:function(e){x(this);return u(this._underlyingSource,"cancel",[e])}},{key:"__pullSteps",value:function(){var e=this._controlledReadableStream;if(this._queue.length>0){var t=S(this);!0===this._closeRequested&&0===this._queue.length?z(e):ne(this);return Promise.resolve(s(t,!1))}var r=q(e);ne(this);return r}},{key:"desiredSize",get:function(){if(!1===ie(this))throw Be("desiredSize");return ue(this)}}]);return e}();function ie(e){return!!v(e)&&!!Object.prototype.hasOwnProperty.call(e,"_underlyingSource")}function ne(e){if(!1!==function(e){var t=e._controlledReadableStream;if("closed"===t._state||"errored"===t._state)return!1;if(!0===e._closeRequested)return!1;if(!1===e._started)return!1;if(!0===L(t)&&X(t)>0)return!0;if(ue(e)>0)return!0;return!1}(e))if(!0!==e._pulling){y(!1===e._pullAgain);e._pulling=!0;u(e._underlyingSource,"pull",[e]).then(function(){e._pulling=!1;if(!0===e._pullAgain){e._pullAgain=!1;return ne(e)}},function(t){le(e,t)}).catch(w)}else e._pullAgain=!0}function oe(e){var t=e._controlledReadableStream;y(!1===e._closeRequested);y("readable"===t._state);e._closeRequested=!0;0===e._queue.length&&z(t)}function se(e,t){var r=e._controlledReadableStream;y(!1===e._closeRequested);y("readable"===r._state);if(!0===L(r)&&X(r)>0)G(r,t,!1);else{var a=1;if(void 0!==e._strategySize){var i=e._strategySize;try{a=i(t)}catch(t){le(e,t);throw t}}try{C(e,t,a)}catch(t){le(e,t);throw t}}ne(e)}function ce(e,t){var r=e._controlledReadableStream;y("readable"===r._state);x(e);H(r,t)}function le(e,t){"readable"===e._controlledReadableStream._state&&ce(e,t)}function ue(e){var t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}var he=function(){function e(t,r){i(this,e);this._associatedReadableByteStreamController=t;this._view=r}a(e,[{key:"respond",value:function(e){if(!1===ge(this))throw De("respond");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");!function(e,t){t=Number(t);if(!1===c(t))throw new RangeError("bytesWritten must be a finite");y(e._pendingPullIntos.length>0);_e(e,t)}(this._associatedReadableByteStreamController,e)}},{key:"respondWithNewView",value:function(e){if(!1===ge(this))throw De("respond");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");!function(e,t){y(e._pendingPullIntos.length>0);var r=e._pendingPullIntos[0];if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.byteLength!==t.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");r.buffer=t.buffer;_e(e,t.byteLength)}(this._associatedReadableByteStreamController,e)}},{key:"view",get:function(){return this._view}}]);return e}(),fe=function(){function e(t,r,a){i(this,e);if(!1===M(t))throw new TypeError("ReadableByteStreamController can only be constructed with a ReadableStream instance given a byte source");if(void 0!==t._readableStreamController)throw new TypeError("ReadableByteStreamController instances can only be created by the ReadableStream constructor given a byte source");this._controlledReadableStream=t;this._underlyingByteSource=r;this._pullAgain=!1;this._pulling=!1;pe(this);this._queue=this._queueTotalSize=void 0;x(this);this._closeRequested=!1;this._started=!1;this._strategyHWM=d(a);var n=r.autoAllocateChunkSize;if(void 0!==n&&(!1===Number.isInteger(n)||n<=0))throw new RangeError("autoAllocateChunkSize must be a positive integer");this._autoAllocateChunkSize=n;this._pendingPullIntos=[];var o=this,s=l(r,"start",[this]);Promise.resolve(s).then(function(){o._started=!0;y(!1===o._pulling);y(!1===o._pullAgain);me(o)},function(e){"readable"===t._state&&Pe(o,e)}).catch(w)}a(e,[{key:"close",value:function(){if(!1===de(this))throw Me("close");if(!0===this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");var e=this._controlledReadableStream._state;if("readable"!==e)throw new TypeError("The stream (in "+e+" state) is not in the readable state and cannot be closed");!function(e){var t=e._controlledReadableStream;y(!1===e._closeRequested);y("readable"===t._state);if(e._queueTotalSize>0){e._closeRequested=!0;return}if(e._pendingPullIntos.length>0){var r=e._pendingPullIntos[0];if(r.bytesFilled>0){var a=new TypeError("Insufficient bytes to fill elements in the given buffer");Pe(e,a);throw a}}z(t)}(this)}},{key:"enqueue",value:function(e){if(!1===de(this))throw Me("enqueue");if(!0===this._closeRequested)throw new TypeError("stream is closed or draining");var t=this._controlledReadableStream._state;if("readable"!==t)throw new TypeError("The stream (in "+t+" state) is not in the readable state and cannot be enqueued to");if(!ArrayBuffer.isView(e))throw new TypeError("You can only enqueue array buffer views when using a ReadableByteStreamController");!function(e,t){var r=e._controlledReadableStream;y(!1===e._closeRequested);y("readable"===r._state);var a=t.buffer,i=t.byteOffset,n=t.byteLength,o=h(a);if(!0===K(r))if(0===X(r))ye(e,o,i,n);else{y(0===e._queue.length);var s=new Uint8Array(o,i,n);G(r,s,!1)}else if(!0===V(r)){ye(e,o,i,n);xe(e)}else{y(!1===L(r),"stream must not be locked");ye(e,o,i,n)}}(this,e)}},{key:"error",value:function(e){if(!1===de(this))throw Me("error");var t=this._controlledReadableStream;if("readable"!==t._state)throw new TypeError("The stream is "+t._state+" and so cannot be errored");Pe(this,e)}},{key:"__cancelSteps",value:function(e){if(this._pendingPullIntos.length>0){this._pendingPullIntos[0].bytesFilled=0}x(this);return u(this._underlyingByteSource,"cancel",[e])}},{key:"__pullSteps",value:function(){var e=this._controlledReadableStream;y(!0===K(e));if(this._queueTotalSize>0){y(0===X(e));var t=this._queue.shift();this._queueTotalSize-=t.byteLength;Se(this);var r=void 0;try{r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}catch(e){return Promise.reject(e)}return Promise.resolve(s(r,!1))}var a=this._autoAllocateChunkSize;if(void 0!==a){var i=void 0;try{i=new ArrayBuffer(a)}catch(e){return Promise.reject(e)}var n={buffer:i,byteOffset:0,byteLength:a,bytesFilled:0,elementSize:1,ctor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(n)}var o=q(e);me(this);return o}},{key:"byobRequest",get:function(){if(!1===de(this))throw Me("byobRequest");if(void 0===this._byobRequest&&this._pendingPullIntos.length>0){var e=this._pendingPullIntos[0],t=new Uint8Array(e.buffer,e.byteOffset+e.bytesFilled,e.byteLength-e.bytesFilled);this._byobRequest=new he(this,t)}return this._byobRequest}},{key:"desiredSize",get:function(){if(!1===de(this))throw Me("desiredSize");return Ie(this)}}]);return e}();function de(e){return!!v(e)&&!!Object.prototype.hasOwnProperty.call(e,"_underlyingByteSource")}function ge(e){return!!v(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")}function me(e){if(!1!==function(e){var t=e._controlledReadableStream;if("readable"!==t._state)return!1;if(!0===e._closeRequested)return!1;if(!1===e._started)return!1;if(!0===K(t)&&X(t)>0)return!0;if(!0===V(t)&&W(t)>0)return!0;if(Ie(e)>0)return!0;return!1}(e))if(!0!==e._pulling){y(!1===e._pullAgain);e._pulling=!0;u(e._underlyingByteSource,"pull",[e]).then(function(){e._pulling=!1;if(!0===e._pullAgain){e._pullAgain=!1;me(e)}},function(t){"readable"===e._controlledReadableStream._state&&Pe(e,t)}).catch(w)}else e._pullAgain=!0}function pe(e){Ce(e);e._pendingPullIntos=[]}function ve(e,t){y("errored"!==e._state,"state must not be errored");var r=!1;if("closed"===e._state){y(0===t.bytesFilled);r=!0}var a=be(t);if("default"===t.readerType)G(e,a,r);else{y("byob"===t.readerType);!function(e,t,r){var a=e._reader;y(a._readIntoRequests.length>0);a._readIntoRequests.shift()._resolve(s(t,r))}(e,a,r)}}function be(e){var t=e.bytesFilled,r=e.elementSize;y(t<=e.byteLength);y(t%r==0);return new e.ctor(e.buffer,e.byteOffset,t/r)}function ye(e,t,r,a){e._queue.push({buffer:t,byteOffset:r,byteLength:a});e._queueTotalSize+=a}function we(e,t){var r=t.elementSize,a=t.bytesFilled-t.bytesFilled%r,i=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),n=t.bytesFilled+i,s=n-n%r,c=i,l=!1;if(s>a){c=s-t.bytesFilled;l=!0}for(var u=e._queue;c>0;){var h=u[0],f=Math.min(c,h.byteLength),d=t.byteOffset+t.bytesFilled;o(t.buffer,d,h.buffer,h.byteOffset,f);if(h.byteLength===f)u.shift();else{h.byteOffset+=f;h.byteLength-=f}e._queueTotalSize-=f;ke(e,f,t);c-=f}if(!1===l){y(0===e._queueTotalSize,"queue must be empty");y(t.bytesFilled>0);y(t.bytesFilled<t.elementSize)}return l}function ke(e,t,r){y(0===e._pendingPullIntos.length||e._pendingPullIntos[0]===r);Ce(e);r.bytesFilled+=t}function Se(e){y("readable"===e._controlledReadableStream._state);0===e._queueTotalSize&&!0===e._closeRequested?z(e._controlledReadableStream):me(e)}function Ce(e){if(void 0!==e._byobRequest){e._byobRequest._associatedReadableByteStreamController=void 0;e._byobRequest._view=void 0;e._byobRequest=void 0}}function xe(e){y(!1===e._closeRequested);for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;var t=e._pendingPullIntos[0];if(!0===we(e,t)){Ae(e);ve(e._controlledReadableStream,t)}}}function _e(e,t){var r=e._pendingPullIntos[0],a=e._controlledReadableStream;if("closed"===a._state){if(0!==t)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream");!function(e,t){t.buffer=h(t.buffer);y(0===t.bytesFilled,"bytesFilled must be 0");var r=e._controlledReadableStream;if(!0===V(r))for(;W(r)>0;)ve(r,Ae(e))}(e,r)}else{y("readable"===a._state);!function(e,t,r){if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range");ke(e,t,r);if(!(r.bytesFilled<r.elementSize)){Ae(e);var a=r.bytesFilled%r.elementSize;if(a>0){var i=r.byteOffset+r.bytesFilled,n=r.buffer.slice(i-a,i);ye(e,n,0,n.byteLength)}r.buffer=h(r.buffer);r.bytesFilled-=a;ve(e._controlledReadableStream,r);xe(e)}}(e,t,r)}}function Ae(e){var t=e._pendingPullIntos.shift();Ce(e);return t}function Pe(e,t){var r=e._controlledReadableStream;y("readable"===r._state);pe(e);x(e);H(r,t)}function Ie(e){var t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Oe(e){return new TypeError("ReadableStream.prototype."+e+" can only be used on a ReadableStream")}function Te(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function Ee(e){return new TypeError("ReadableStreamDefaultReader.prototype."+e+" can only be used on a ReadableStreamDefaultReader")}function Fe(e,t){y(void 0!==e._closedPromise_resolve);y(void 0!==e._closedPromise_reject);e._closedPromise_reject(t);e._closedPromise_resolve=void 0;e._closedPromise_reject=void 0}function Re(e){return new TypeError("ReadableStreamBYOBReader.prototype."+e+" can only be used on a ReadableStreamBYOBReader")}function Be(e){return new TypeError("ReadableStreamDefaultController.prototype."+e+" can only be used on a ReadableStreamDefaultController")}function De(e){return new TypeError("ReadableStreamBYOBRequest.prototype."+e+" can only be used on a ReadableStreamBYOBRequest")}function Me(e){return new TypeError("ReadableByteStreamController.prototype."+e+" can only be used on a ReadableByteStreamController")}},function(e,t,r){var a=r(6),i=r(4),n=r(2);t.TransformStream=a.TransformStream;t.ReadableStream=i.ReadableStream;t.IsReadableStreamDisturbed=i.IsReadableStreamDisturbed;t.ReadableStreamDefaultControllerClose=i.ReadableStreamDefaultControllerClose;t.ReadableStreamDefaultControllerEnqueue=i.ReadableStreamDefaultControllerEnqueue;t.ReadableStreamDefaultControllerError=i.ReadableStreamDefaultControllerError;t.ReadableStreamDefaultControllerGetDesiredSize=i.ReadableStreamDefaultControllerGetDesiredSize;t.AcquireWritableStreamDefaultWriter=n.AcquireWritableStreamDefaultWriter;t.IsWritableStream=n.IsWritableStream;t.IsWritableStreamLocked=n.IsWritableStreamLocked;t.WritableStream=n.WritableStream;t.WritableStreamAbort=n.WritableStreamAbort;t.WritableStreamDefaultControllerError=n.WritableStreamDefaultControllerError;t.WritableStreamDefaultWriterCloseWithErrorPropagation=n.WritableStreamDefaultWriterCloseWithErrorPropagation;t.WritableStreamDefaultWriterRelease=n.WritableStreamDefaultWriterRelease;t.WritableStreamDefaultWriterWrite=n.WritableStreamDefaultWriterWrite},function(e,t,r){var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1;a.configurable=!0;"value"in a&&(a.writable=!0);Object.defineProperty(e,a.key,a)}}return function(t,r,a){r&&e(t.prototype,r);a&&e(t,a);return t}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var n=r(1).assert,o=r(0),s=o.InvokeOrNoop,c=o.PromiseInvokeOrPerformFallback,l=o.PromiseInvokeOrNoop,u=o.typeIsObject,h=r(4),f=h.ReadableStream,d=h.ReadableStreamDefaultControllerClose,g=h.ReadableStreamDefaultControllerEnqueue,m=h.ReadableStreamDefaultControllerError,p=h.ReadableStreamDefaultControllerGetDesiredSize,v=r(2),b=v.WritableStream,y=v.WritableStreamDefaultControllerError;function w(e,t){if(!0===e._errored)throw new TypeError("TransformStream is already errored");if(!0===e._readableClosed)throw new TypeError("Readable side is already closed");var r=e._readableController;try{g(r,t)}catch(t){e._readableClosed=!0;S(e,t);throw e._storedError}!0===p(r)<=0&&!1===e._backpressure&&_(e,!0)}function k(e){n(!1===e._errored);n(!1===e._readableClosed);try{d(e._readableController)}catch(e){n(!1)}e._readableClosed=!0}function S(e,t){!1===e._errored&&C(e,t)}function C(e,t){n(!1===e._errored);e._errored=!0;e._storedError=t;!1===e._writableDone&&y(e._writableController,t);!1===e._readableClosed&&m(e._readableController,t)}function x(e){n(void 0!==e._backpressureChangePromise,"_backpressureChangePromise should have been initialized");if(!1===e._backpressure)return Promise.resolve();n(!0===e._backpressure,"_backpressure should have been initialized");return e._backpressureChangePromise}function _(e,t){n(e._backpressure!==t,"TransformStreamSetBackpressure() should be called only when backpressure is changed");void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(t);e._backpressureChangePromise=new Promise(function(t){e._backpressureChangePromise_resolve=t});e._backpressureChangePromise.then(function(e){n(e!==t,"_backpressureChangePromise should be fulfilled only when backpressure is changed")});e._backpressure=t}function A(e,t){w(t._controlledTransformStream,e);return Promise.resolve()}function P(e){return!!u(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")}function I(e){return!!u(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")}var O=function(){function e(t,r){i(this,e);this._transformStream=t;this._startPromise=r}a(e,[{key:"start",value:function(e){var t=this._transformStream;t._writableController=e;return this._startPromise.then(function(){return x(t)})}},{key:"write",value:function(e){return function(e,t){n(!1===e._errored);n(!1===e._transforming);n(!1===e._backpressure);e._transforming=!0;var r=e._transformer,a=e._transformStreamController;return c(r,"transform",[t,a],A,[t,a]).then(function(){e._transforming=!1;return x(e)},function(t){S(e,t);return Promise.reject(t)})}(this._transformStream,e)}},{key:"abort",value:function(){var e=this._transformStream;e._writableDone=!0;C(e,new TypeError("Writable side aborted"))}},{key:"close",value:function(){var e=this._transformStream;n(!1===e._transforming);e._writableDone=!0;return l(e._transformer,"flush",[e._transformStreamController]).then(function(){if(!0===e._errored)return Promise.reject(e._storedError);!1===e._readableClosed&&k(e);return Promise.resolve()}).catch(function(t){S(e,t);return Promise.reject(e._storedError)})}}]);return e}(),T=function(){function e(t,r){i(this,e);this._transformStream=t;this._startPromise=r}a(e,[{key:"start",value:function(e){var t=this._transformStream;t._readableController=e;return this._startPromise.then(function(){n(void 0!==t._backpressureChangePromise,"_backpressureChangePromise should have been initialized");if(!0===t._backpressure)return Promise.resolve();n(!1===t._backpressure,"_backpressure should have been initialized");return t._backpressureChangePromise})}},{key:"pull",value:function(){var e=this._transformStream;n(!0===e._backpressure,"pull() should be never called while _backpressure is false");n(void 0!==e._backpressureChangePromise,"_backpressureChangePromise should have been initialized");_(e,!1);return e._backpressureChangePromise}},{key:"cancel",value:function(){var e=this._transformStream;e._readableClosed=!0;C(e,new TypeError("Readable side canceled"))}}]);return e}(),E=function(){function e(t){i(this,e);if(!1===I(t))throw new TypeError("TransformStreamDefaultController can only be constructed with a TransformStream instance");if(void 0!==t._transformStreamController)throw new TypeError("TransformStreamDefaultController instances can only be created by the TransformStream constructor");this._controlledTransformStream=t}a(e,[{key:"enqueue",value:function(e){if(!1===P(this))throw R("enqueue");w(this._controlledTransformStream,e)}},{key:"close",value:function(){if(!1===P(this))throw R("close");!function(e){if(!0===e._errored)throw new TypeError("TransformStream is already errored");if(!0===e._readableClosed)throw new TypeError("Readable side is already closed");k(e)}(this._controlledTransformStream)}},{key:"error",value:function(e){if(!1===P(this))throw R("error");!function(e,t){if(!0===e._errored)throw new TypeError("TransformStream is already errored");C(e,t)}(this._controlledTransformStream,e)}},{key:"desiredSize",get:function(){if(!1===P(this))throw R("desiredSize");var e=this._controlledTransformStream._readableController;return p(e)}}]);return e}(),F=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);this._transformer=t;var r=t.readableStrategy,a=t.writableStrategy;this._transforming=!1;this._errored=!1;this._storedError=void 0;this._writableController=void 0;this._readableController=void 0;this._transformStreamController=void 0;this._writableDone=!1;this._readableClosed=!1;this._backpressure=void 0;this._backpressureChangePromise=void 0;this._backpressureChangePromise_resolve=void 0;this._transformStreamController=new E(this);var o=void 0,c=new Promise(function(e){o=e}),l=new T(this,c);this._readable=new f(l,r);var u=new O(this,c);this._writable=new b(u,a);n(void 0!==this._writableController);n(void 0!==this._readableController);_(this,p(this._readableController)<=0);var h=this,d=s(t,"start",[h._transformStreamController]);o(d);c.catch(function(e){if(!1===h._errored){h._errored=!0;h._storedError=e}})}a(e,[{key:"readable",get:function(){if(!1===I(this))throw B("readable");return this._readable}},{key:"writable",get:function(){if(!1===I(this))throw B("writable");return this._writable}}]);return e}();e.exports={TransformStream:F};function R(e){return new TypeError("TransformStreamDefaultController.prototype."+e+" can only be used on a TransformStreamDefaultController")}function B(e){return new TypeError("TransformStream.prototype."+e+" can only be used on a TransformStream")}},function(e,t,r){e.exports=r(5)}]))},function(e,t,r){"use strict";var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=!1;try{if("function"==typeof URL&&"object"===a(URL.prototype)&&"origin"in URL.prototype){var n=new URL("b","http://a");n.pathname="c%20d";i="http://a/c%20d"===n.href}}catch(e){}if(i)t.URL=URL;else{var o=r(129).URL,s=r(4).URL;if(s){o.createObjectURL=function(e){return s.createObjectURL.apply(s,arguments)};o.revokeObjectURL=function(e){s.revokeObjectURL(e)}}t.URL=o}},function(e,t,r){"use strict";!function(){var e=Object.create(null);e.ftp=21;e.file=0;e.gopher=70;e.http=80;e.https=443;e.ws=80;e.wss=443;var r=Object.create(null);r["%2e"]=".";r[".%2e"]="..";r["%2e."]="..";r["%2e%2e"]="..";function a(t){return void 0!==e[t]}function i(){f.call(this);this._isInvalid=!0}function n(e){""===e&&i.call(this);return e.toLowerCase()}function o(e){var t=e.charCodeAt(0);return t>32&&t<127&&-1===[34,35,60,62,63,96].indexOf(t)?e:encodeURIComponent(e)}function s(e){var t=e.charCodeAt(0);return t>32&&t<127&&-1===[34,35,60,62,96].indexOf(t)?e:encodeURIComponent(e)}var c,l=/[a-zA-Z]/,u=/[a-zA-Z0-9\+\-\.]/;function h(t,h,f){function d(e){y.push(e)}var g=h||"scheme start",m=0,p="",v=!1,b=!1,y=[];e:for(;(t[m-1]!==c||0===m)&&!this._isInvalid;){var w=t[m];switch(g){case"scheme start":if(!w||!l.test(w)){if(h){d("Invalid scheme.");break e}p="";g="no scheme";continue}p+=w.toLowerCase();g="scheme";break;case"scheme":if(w&&u.test(w))p+=w.toLowerCase();else{if(":"!==w){if(h){if(w===c)break e;d("Code point not allowed in scheme: "+w);break e}p="";m=0;g="no scheme";continue}this._scheme=p;p="";if(h)break e;a(this._scheme)&&(this._isRelative=!0);g="file"===this._scheme?"relative":this._isRelative&&f&&f._scheme===this._scheme?"relative or authority":this._isRelative?"authority first slash":"scheme data"}break;case"scheme data":if("?"===w){this._query="?";g="query"}else if("#"===w){this._fragment="#";g="fragment"}else w!==c&&"\t"!==w&&"\n"!==w&&"\r"!==w&&(this._schemeData+=o(w));break;case"no scheme":if(f&&a(f._scheme)){g="relative";continue}d("Missing scheme.");i.call(this);break;case"relative or authority":if("/"!==w||"/"!==t[m+1]){d("Expected /, got: "+w);g="relative";continue}g="authority ignore slashes";break;case"relative":this._isRelative=!0;"file"!==this._scheme&&(this._scheme=f._scheme);if(w===c){this._host=f._host;this._port=f._port;this._path=f._path.slice();this._query=f._query;this._username=f._username;this._password=f._password;break e}if("/"===w||"\\"===w){"\\"===w&&d("\\ is an invalid code point.");g="relative slash"}else if("?"===w){this._host=f._host;this._port=f._port;this._path=f._path.slice();this._query="?";this._username=f._username;this._password=f._password;g="query"}else{if("#"!==w){var k=t[m+1],S=t[m+2];if("file"!==this._scheme||!l.test(w)||":"!==k&&"|"!==k||S!==c&&"/"!==S&&"\\"!==S&&"?"!==S&&"#"!==S){this._host=f._host;this._port=f._port;this._username=f._username;this._password=f._password;this._path=f._path.slice();this._path.pop()}g="relative path";continue}this._host=f._host;this._port=f._port;this._path=f._path.slice();this._query=f._query;this._fragment="#";this._username=f._username;this._password=f._password;g="fragment"}break;case"relative slash":if("/"!==w&&"\\"!==w){if("file"!==this._scheme){this._host=f._host;this._port=f._port;this._username=f._username;this._password=f._password}g="relative path";continue}"\\"===w&&d("\\ is an invalid code point.");g="file"===this._scheme?"file host":"authority ignore slashes";break;case"authority first slash":if("/"!==w){d("Expected '/', got: "+w);g="authority ignore slashes";continue}g="authority second slash";break;case"authority second slash":g="authority ignore slashes";if("/"!==w){d("Expected '/', got: "+w);continue}break;case"authority ignore slashes":if("/"!==w&&"\\"!==w){g="authority";continue}d("Expected authority, got: "+w);break;case"authority":if("@"===w){if(v){d("@ already seen.");p+="%40"}v=!0;for(var C=0;C<p.length;C++){var x=p[C];if("\t"!==x&&"\n"!==x&&"\r"!==x)if(":"!==x||null!==this._password){var _=o(x);null!==this._password?this._password+=_:this._username+=_}else this._password="";else d("Invalid whitespace in authority.")}p=""}else{if(w===c||"/"===w||"\\"===w||"?"===w||"#"===w){m-=p.length;p="";g="host";continue}p+=w}break;case"file host":if(w===c||"/"===w||"\\"===w||"?"===w||"#"===w){if(2!==p.length||!l.test(p[0])||":"!==p[1]&&"|"!==p[1])if(0===p.length)g="relative path start";else{this._host=n.call(this,p);p="";g="relative path start"}else g="relative path";continue}"\t"===w||"\n"===w||"\r"===w?d("Invalid whitespace in file host."):p+=w;break;case"host":case"hostname":if(":"!==w||b){if(w===c||"/"===w||"\\"===w||"?"===w||"#"===w){this._host=n.call(this,p);p="";g="relative path start";if(h)break e;continue}if("\t"!==w&&"\n"!==w&&"\r"!==w){"["===w?b=!0:"]"===w&&(b=!1);p+=w}else d("Invalid code point in host/hostname: "+w)}else{this._host=n.call(this,p);p="";g="port";if("hostname"===h)break e}break;case"port":if(/[0-9]/.test(w))p+=w;else{if(w===c||"/"===w||"\\"===w||"?"===w||"#"===w||h){if(""!==p){var A=parseInt(p,10);A!==e[this._scheme]&&(this._port=A+"");p=""}if(h)break e;g="relative path start";continue}"\t"===w||"\n"===w||"\r"===w?d("Invalid code point in port: "+w):i.call(this)}break;case"relative path start":"\\"===w&&d("'\\' not allowed in path.");g="relative path";if("/"!==w&&"\\"!==w)continue;break;case"relative path":if(w!==c&&"/"!==w&&"\\"!==w&&(h||"?"!==w&&"#"!==w))"\t"!==w&&"\n"!==w&&"\r"!==w&&(p+=o(w));else{"\\"===w&&d("\\ not allowed in relative path.");var P;(P=r[p.toLowerCase()])&&(p=P);if(".."===p){this._path.pop();"/"!==w&&"\\"!==w&&this._path.push("")}else if("."===p&&"/"!==w&&"\\"!==w)this._path.push("");else if("."!==p){"file"===this._scheme&&0===this._path.length&&2===p.length&&l.test(p[0])&&"|"===p[1]&&(p=p[0]+":");this._path.push(p)}p="";if("?"===w){this._query="?";g="query"}else if("#"===w){this._fragment="#";g="fragment"}}break;case"query":if(h||"#"!==w)w!==c&&"\t"!==w&&"\n"!==w&&"\r"!==w&&(this._query+=s(w));else{this._fragment="#";g="fragment"}break;case"fragment":w!==c&&"\t"!==w&&"\n"!==w&&"\r"!==w&&(this._fragment+=w)}m++}}function f(){this._scheme="";this._schemeData="";this._username="";this._password=null;this._host="";this._port="";this._path=[];this._query="";this._fragment="";this._isInvalid=!1;this._isRelative=!1}function d(e,t){void 0===t||t instanceof d||(t=new d(String(t)));this._url=e;f.call(this);var r=e.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g,"");h.call(this,r,null,t)}d.prototype={toString:function(){return this.href},get href(){if(this._isInvalid)return this._url;var e="";""===this._username&&null===this._password||(e=this._username+(null!==this._password?":"+this._password:"")+"@");return this.protocol+(this._isRelative?"//"+e+this.host:"")+this.pathname+this._query+this._fragment},set href(e){f.call(this);h.call(this,e)},get protocol(){return this._scheme+":"},set protocol(e){this._isInvalid||h.call(this,e+":","scheme start")},get host(){return this._isInvalid?"":this._port?this._host+":"+this._port:this._host},set host(e){!this._isInvalid&&this._isRelative&&h.call(this,e,"host")},get hostname(){return this._host},set hostname(e){!this._isInvalid&&this._isRelative&&h.call(this,e,"hostname")},get port(){return this._port},set port(e){!this._isInvalid&&this._isRelative&&h.call(this,e,"port")},get pathname(){return this._isInvalid?"":this._isRelative?"/"+this._path.join("/"):this._schemeData},set pathname(e){if(!this._isInvalid&&this._isRelative){this._path=[];h.call(this,e,"relative path start")}},get search(){return this._isInvalid||!this._query||"?"===this._query?"":this._query},set search(e){if(!this._isInvalid&&this._isRelative){this._query="?";"?"===e[0]&&(e=e.slice(1));h.call(this,e,"query")}},get hash(){return this._isInvalid||!this._fragment||"#"===this._fragment?"":this._fragment},set hash(e){if(!this._isInvalid){this._fragment="#";"#"===e[0]&&(e=e.slice(1));h.call(this,e,"fragment")}},get origin(){var e;if(this._isInvalid||!this._scheme)return"";switch(this._scheme){case"data":case"file":case"javascript":case"mailto":return"null";case"blob":try{return new d(this._schemeData).origin||"null"}catch(e){}return"null"}return(e=this.host)?this._scheme+"://"+e:""}};t.URL=d}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.NetworkPdfManager=t.LocalPdfManager=void 0;var a,i=r(131),n=(a=i)&&a.__esModule?a:{default:a},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1;a.configurable=!0;"value"in a&&(a.writable=!0);Object.defineProperty(e,a.key,a)}}return function(t,r,a){r&&e(t.prototype,r);a&&e(t,a);return t}}(),s=r(2),c=r(135),l=r(136),u=r(140);function h(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function d(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function a(i,n){try{var o=t[i](n),s=o.value}catch(e){r(e);return}if(!o.done)return Promise.resolve(s).then(function(e){a("next",e)},function(e){a("throw",e)});e(s)}("next")})}}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var m=function(){function e(){g(this,e);this.constructor===e&&(0,s.unreachable)("Cannot initialize BasePdfManager.")}o(e,[{key:"onLoadedStream",value:function(){(0,s.unreachable)("Abstract method `onLoadedStream` called")}},{key:"ensureDoc",value:function(e,t){return this.ensure(this.pdfDocument,e,t)}},{key:"ensureXRef",value:function(e,t){return this.ensure(this.pdfDocument.xref,e,t)}},{key:"ensureCatalog",value:function(e,t){return this.ensure(this.pdfDocument.catalog,e,t)}},{key:"getPage",value:function(e){return this.pdfDocument.getPage(e)}},{key:"cleanup",value:function(){return this.pdfDocument.cleanup()}},{key:"ensure",value:function(){var e=d(n.default.mark(function e(t,r,a){return n.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:(0,s.unreachable)("Abstract method `ensure` called");case 1:case"end":return e.stop()}},e,this)}));return function(t,r,a){return e.apply(this,arguments)}}()},{key:"requestRange",value:function(e,t){(0,s.unreachable)("Abstract method `requestRange` called")}},{key:"requestLoadedStream",value:function(){(0,s.unreachable)("Abstract method `requestLoadedStream` called")}},{key:"sendProgressiveData",value:function(e){(0,s.unreachable)("Abstract method `sendProgressiveData` called")}},{key:"updatePassword",value:function(e){this._password=e}},{key:"terminate",value:function(){(0,s.unreachable)("Abstract method `terminate` called")}},{key:"docId",get:function(){return this._docId}},{key:"password",get:function(){return this._password}},{key:"docBaseUrl",get:function(){var e=null;if(this._docBaseUrl){var t=(0,s.createValidAbsoluteUrl)(this._docBaseUrl);t?e=t.href:(0,s.warn)('Invalid absolute docBaseUrl: "'+this._docBaseUrl+'".')}return(0,s.shadow)(this,"docBaseUrl",e)}}]);return e}(),p=function(e){f(t,m);function t(e,r,a,i,n){g(this,t);var o=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));o._docId=e;o._password=a;o._docBaseUrl=n;o.evaluatorOptions=i;var s=new u.Stream(r);o.pdfDocument=new l.PDFDocument(o,s);o._loadedStreamPromise=Promise.resolve(s);return o}o(t,[{key:"ensure",value:function(){var e=d(n.default.mark(function e(t,r,a){var i;return n.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof(i=t[r])){e.next=3;break}return e.abrupt("return",i.apply(t,a));case 3:return e.abrupt("return",i);case 4:case"end":return e.stop()}},e,this)}));return function(t,r,a){return e.apply(this,arguments)}}()},{key:"requestRange",value:function(e,t){return Promise.resolve()}},{key:"requestLoadedStream",value:function(){}},{key:"onLoadedStream",value:function(){return this._loadedStreamPromise}},{key:"terminate",value:function(){}}]);return t}(),v=function(e){f(t,m);function t(e,r,a,i,n){g(this,t);var o=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));o._docId=e;o._password=a.password;o._docBaseUrl=n;o.msgHandler=a.msgHandler;o.evaluatorOptions=i;o.streamManager=new c.ChunkedStreamManager(r,{msgHandler:a.msgHandler,url:a.url,length:a.length,disableAutoFetch:a.disableAutoFetch,rangeChunkSize:a.rangeChunkSize});o.pdfDocument=new l.PDFDocument(o,o.streamManager.getStream());return o}o(t,[{key:"ensure",value:function(){var e=d(n.default.mark(function e(t,r,a){var i;return n.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0;if("function"!=typeof(i=t[r])){e.next=4;break}return e.abrupt("return",i.apply(t,a));case 4:return e.abrupt("return",i);case 7:e.prev=7;e.t0=e.catch(0);if(e.t0 instanceof s.MissingDataException){e.next=11;break}throw e.t0;case 11:e.next=13;return this.requestRange(e.t0.begin,e.t0.end);case 13:return e.abrupt("return",this.ensure(t,r,a));case 14:case"end":return e.stop()}},e,this,[[0,7]])}));return function(t,r,a){return e.apply(this,arguments)}}()},{key:"requestRange",value:function(e,t){return this.streamManager.requestRange(e,t)}},{key:"requestLoadedStream",value:function(){this.streamManager.requestAllChunks()}},{key:"sendProgressiveData",value:function(e){this.streamManager.onReceiveData({chunk:e})}},{key:"onLoadedStream",value:function(){return this.streamManager.onLoadedStream()}},{key:"terminate",value:function(){this.streamManager.abort()}}]);return t}();t.LocalPdfManager=p;t.NetworkPdfManager=v},function(e,t,r){"use strict";e.exports=r(132)},function(e,t,r){"use strict";var a=function(){return this}()||Function("return this")(),i=a.regeneratorRuntime&&Object.getOwnPropertyNames(a).indexOf("regeneratorRuntime")>=0,n=i&&a.regeneratorRuntime;a.regeneratorRuntime=void 0;e.exports=r(133);if(i)a.regeneratorRuntime=n;else try{delete a.regeneratorRuntime}catch(e){a.regeneratorRuntime=void 0}},function(e,t,r){"use strict";(function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(r){var a,i=Object.prototype,n=i.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag",u="object"===t(e),h=r.regeneratorRuntime;if(h)u&&(e.exports=h);else{(h=r.regeneratorRuntime=u?e.exports:{}).wrap=k;var f="suspendedStart",d="suspendedYield",g="executing",m="completed",p={},v={};v[s]=function(){return this};var b=Object.getPrototypeOf,y=b&&b(b(F([])));y&&y!==i&&n.call(y,s)&&(v=y);var w=_.prototype=C.prototype=Object.create(v);x.prototype=w.constructor=_;_.constructor=x;_[l]=x.displayName="GeneratorFunction";h.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))};h.mark=function(e){if(Object.setPrototypeOf)Object.setPrototypeOf(e,_);else{e.__proto__=_;l in e||(e[l]="GeneratorFunction")}e.prototype=Object.create(w);return e};h.awrap=function(e){return{__await:e}};A(P.prototype);P.prototype[c]=function(){return this};h.AsyncIterator=P;h.async=function(e,t,r,a){var i=new P(k(e,t,r,a));return h.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})};A(w);w[l]="Generator";w[s]=function(){return this};w.toString=function(){return"[object Generator]"};h.keys=function(e){var t=[];for(var r in e)t.push(r);t.reverse();return function r(){for(;t.length;){var a=t.pop();if(a in e){r.value=a;r.done=!1;return r}}r.done=!0;return r}};h.values=F;E.prototype={constructor:E,reset:function(e){this.prev=0;this.next=0;this.sent=this._sent=a;this.done=!1;this.delegate=null;this.method="next";this.arg=a;this.tryEntries.forEach(T);if(!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=a)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,i){s.type="throw";s.arg=e;t.next=r;if(i){t.method="next";t.arg=a}return!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};o.type=e;o.arg=t;if(i){this.method="next";this.next=i.finallyLoc;return p}return this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;if("break"===e.type||"continue"===e.type)this.next=e.arg;else if("return"===e.type){this.rval=this.arg=e.arg;this.method="return";this.next="end"}else"normal"===e.type&&t&&(this.next=t);return p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e){this.complete(r.completion,r.afterLoc);T(r);return p}}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var a=r.completion;if("throw"===a.type){var i=a.arg;T(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){this.delegate={iterator:F(e),resultName:t,nextLoc:r};"next"===this.method&&(this.arg=a);return p}}}function k(e,t,r,a){var i=t&&t.prototype instanceof C?t:C,n=Object.create(i.prototype),o=new E(a||[]);n._invoke=function(e,t,r){var a=f;return function(i,n){if(a===g)throw new Error("Generator is already running");if(a===m){if("throw"===i)throw n;return R()}r.method=i;r.arg=n;for(;;){var o=r.delegate;if(o){var s=I(o,r);if(s){if(s===p)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===f){a=m;throw r.arg}r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=g;var c=S(e,t,r);if("normal"===c.type){a=r.done?m:d;if(c.arg===p)continue;return{value:c.arg,done:r.done}}if("throw"===c.type){a=m;r.method="throw";r.arg=c.arg}}}}(e,r,o);return n}function S(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function C(){}function x(){}function _(){}function A(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function P(e){var r;this._invoke=function(a,i){function o(){return new Promise(function(r,o){!function r(a,i,o,s){var c=S(e[a],e,i);if("throw"!==c.type){var l=c.arg,u=l.value;return u&&"object"===(void 0===u?"undefined":t(u))&&n.call(u,"__await")?Promise.resolve(u.__await).then(function(e){r("next",e,o,s)},function(e){r("throw",e,o,s)}):Promise.resolve(u).then(function(e){l.value=e;o(l)},s)}s(c.arg)}(a,i,r,o)})}return r=r?r.then(o,o):o()}}function I(e,t){var r=e.iterator[t.method];if(r===a){t.delegate=null;if("throw"===t.method){if(e.iterator.return){t.method="return";t.arg=a;I(e,t);if("throw"===t.method)return p}t.method="throw";t.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var i=S(r,e.iterator,t.arg);if("throw"===i.type){t.method="throw";t.arg=i.arg;t.delegate=null;return p}var n=i.arg;if(!n){t.method="throw";t.arg=new TypeError("iterator result is not an object");t.delegate=null;return p}if(!n.done)return n;t[e.resultName]=n.value;t.next=e.nextLoc;if("return"!==t.method){t.method="next";t.arg=a}t.delegate=null;return p}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]);if(2 in e){t.finallyLoc=e[2];t.afterLoc=e[3]}this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal";delete t.arg;e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}];e.forEach(O,this);this.reset(!0)}function F(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r)){t.value=e[r];t.done=!1;return t}t.value=a;t.done=!0;return t};return i.next=i}}return{next:R}}function R(){return{value:a,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(134)(e))},function(e,t,r){"use strict";e.exports=function(e){if(!e.webpackPolyfill){e.deprecate=function(){};e.paths=[];e.children||(e.children=[]);Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}});Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}});e.webpackPolyfill=1}return e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.ChunkedStreamManager=t.ChunkedStream=void 0;var a=r(2),i=function(){function e(e,t,r){this.bytes=new Uint8Array(e);this.start=0;this.pos=0;this.end=e;this.chunkSize=t;this.loadedChunks=[];this.numChunksLoaded=0;this.numChunks=Math.ceil(e/t);this.manager=r;this.progressiveDataLength=0;this.lastSuccessfulEnsureByteChunk=-1}e.prototype={getMissingChunks:function(){for(var e=[],t=0,r=this.numChunks;t<r;++t)this.loadedChunks[t]||e.push(t);return e},getBaseStreams:function(){return[this]},allChunksLoaded:function(){return this.numChunksLoaded===this.numChunks},onReceiveData:function(e,t){var r=e+t.byteLength;if(e%this.chunkSize!=0)throw new Error("Bad begin offset: "+e);var a=this.bytes.length;if(r%this.chunkSize!=0&&r!==a)throw new Error("Bad end offset: "+r);this.bytes.set(new Uint8Array(t),e);var i,n=this.chunkSize,o=Math.floor(e/n),s=Math.floor((r-1)/n)+1;for(i=o;i<s;++i)if(!this.loadedChunks[i]){this.loadedChunks[i]=!0;++this.numChunksLoaded}},onReceiveProgressiveData:function(e){var t=this.progressiveDataLength,r=Math.floor(t/this.chunkSize);this.bytes.set(new Uint8Array(e),t);t+=e.byteLength;this.progressiveDataLength=t;var a,i=t>=this.end?this.numChunks:Math.floor(t/this.chunkSize);for(a=r;a<i;++a)if(!this.loadedChunks[a]){this.loadedChunks[a]=!0;++this.numChunksLoaded}},ensureByte:function(e){var t=Math.floor(e/this.chunkSize);if(t!==this.lastSuccessfulEnsureByteChunk){if(!this.loadedChunks[t])throw new a.MissingDataException(e,e+1);this.lastSuccessfulEnsureByteChunk=t}},ensureRange:function(e,t){if(!(e>=t||t<=this.progressiveDataLength))for(var r=this.chunkSize,i=Math.floor(e/r),n=Math.floor((t-1)/r)+1,o=i;o<n;++o)if(!this.loadedChunks[o])throw new a.MissingDataException(e,t)},nextEmptyChunk:function(e){for(var t,r=this.numChunks,a=0;a<r;++a){t=(e+a)%r;if(!this.loadedChunks[t])return t}return null},hasChunk:function(e){return!!this.loadedChunks[e]},get length(){return this.end-this.start},get isEmpty(){return 0===this.length},getByte:function(){var e=this.pos;if(e>=this.end)return-1;this.ensureByte(e);return this.bytes[this.pos++]},getUint16:function(){var e=this.getByte(),t=this.getByte();return-1===e||-1===t?-1:(e<<8)+t},getInt32:function(){return(this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()},getBytes:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.bytes,a=this.pos,i=this.end;if(!e){this.ensureRange(a,i);var n=r.subarray(a,i);return t?new Uint8ClampedArray(n):n}var o=a+e;o>i&&(o=i);this.ensureRange(a,o);this.pos=o;var s=r.subarray(a,o);return t?new Uint8ClampedArray(s):s},peekByte:function(){var e=this.getByte();this.pos--;return e},peekBytes:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.getBytes(e,t);this.pos-=r.length;return r},getByteRange:function(e,t){this.ensureRange(e,t);return this.bytes.subarray(e,t)},skip:function(e){e||(e=1);this.pos+=e},reset:function(){this.pos=this.start},moveStart:function(){this.start=this.pos},makeSubStream:function(e,t,r){this.ensureRange(e,e+t);function a(){}a.prototype=Object.create(this);a.prototype.getMissingChunks=function(){for(var e=this.chunkSize,t=Math.floor(this.start/e),r=Math.floor((this.end-1)/e)+1,a=[],i=t;i<r;++i)this.loadedChunks[i]||a.push(i);return a};var i=new a;i.pos=i.start=e;i.end=e+t||this.end;i.dict=r;return i}};return e}(),n=function(){function e(e,t){var r=t.rangeChunkSize,n=t.length;this.stream=new i(n,r,this);this.length=n;this.chunkSize=r;this.pdfNetworkStream=e;this.url=t.url;this.disableAutoFetch=t.disableAutoFetch;this.msgHandler=t.msgHandler;this.currRequestId=0;this.chunksNeededByRequest=Object.create(null);this.requestsByChunk=Object.create(null);this.promisesByRequest=Object.create(null);this.progressiveDataLength=0;this.aborted=!1;this._loadedStreamCapability=(0,a.createPromiseCapability)()}e.prototype={onLoadedStream:function(){return this._loadedStreamCapability.promise},sendRequest:function(e,t){var r=this,i=this.pdfNetworkStream.getRangeReader(e,t);i.isStreamingSupported||(i.onProgress=this.onProgress.bind(this));var n=[],o=0,s=this;new Promise(function(e,t){i.read().then(function r(c){try{if(!c.done){var l=c.value;n.push(l);o+=(0,a.arrayByteLength)(l);i.isStreamingSupported&&s.onProgress({loaded:o});i.read().then(r,t);return}var u=(0,a.arraysToBytes)(n);n=null;e(u)}catch(e){t(e)}},t)}).then(function(t){r.aborted||r.onReceiveData({chunk:t,begin:e})})},requestAllChunks:function(){var e=this.stream.getMissingChunks();this._requestChunks(e);return this._loadedStreamCapability.promise},_requestChunks:function(e){var t,r,i=this.currRequestId++,n=Object.create(null);this.chunksNeededByRequest[i]=n;for(t=0,r=e.length;t<r;t++)this.stream.hasChunk(e[t])||(n[e[t]]=!0);if((0,a.isEmptyObj)(n))return Promise.resolve();var o=(0,a.createPromiseCapability)();this.promisesByRequest[i]=o;var s=[];for(var c in n){if(!((c|=0)in this.requestsByChunk)){this.requestsByChunk[c]=[];s.push(c)}this.requestsByChunk[c].push(i)}if(!s.length)return o.promise;var l=this.groupChunks(s);for(t=0;t<l.length;++t){var u=l[t],h=u.beginChunk*this.chunkSize,f=Math.min(u.endChunk*this.chunkSize,this.length);this.sendRequest(h,f)}return o.promise},getStream:function(){return this.stream},requestRange:function(e,t){t=Math.min(t,this.length);for(var r=this.getBeginChunk(e),a=this.getEndChunk(t),i=[],n=r;n<a;++n)i.push(n);return this._requestChunks(i)},requestRanges:function(e){e=e||[];for(var t=[],r=0;r<e.length;r++)for(var a=this.getBeginChunk(e[r].begin),i=this.getEndChunk(e[r].end),n=a;n<i;++n)t.includes(n)||t.push(n);t.sort(function(e,t){return e-t});return this._requestChunks(t)},groupChunks:function(e){for(var t=[],r=-1,a=-1,i=0;i<e.length;++i){var n=e[i];r<0&&(r=n);if(a>=0&&a+1!==n){t.push({beginChunk:r,endChunk:a+1});r=n}i+1===e.length&&t.push({beginChunk:r,endChunk:n+1});a=n}return t},onProgress:function(e){var t=this.stream.numChunksLoaded*this.chunkSize+e.loaded;this.msgHandler.send("DocProgress",{loaded:t,total:this.length})},onReceiveData:function(e){var t=e.chunk,r=void 0===e.begin,i=r?this.progressiveDataLength:e.begin,n=i+t.byteLength,o=Math.floor(i/this.chunkSize),s=n<this.length?Math.floor(n/this.chunkSize):Math.ceil(n/this.chunkSize);if(r){this.stream.onReceiveProgressiveData(t);this.progressiveDataLength=n}else this.stream.onReceiveData(i,t);this.stream.allChunksLoaded()&&this._loadedStreamCapability.resolve(this.stream);var c,l,u=[];for(t=o;t<s;++t){var h=this.requestsByChunk[t]||[];delete this.requestsByChunk[t];for(c=0;c<h.length;++c){l=h[c];var f=this.chunksNeededByRequest[l];t in f&&delete f[t];(0,a.isEmptyObj)(f)&&u.push(l)}}if(!this.disableAutoFetch&&(0,a.isEmptyObj)(this.requestsByChunk)){var d;if(1===this.stream.numChunksLoaded){var g=this.stream.numChunks-1;this.stream.hasChunk(g)||(d=g)}else d=this.stream.nextEmptyChunk(s);Number.isInteger(d)&&this._requestChunks([d])}for(c=0;c<u.length;++c){l=u[c];var m=this.promisesByRequest[l];delete this.promisesByRequest[l];m.resolve()}this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize,total:this.length})},onError:function(e){this._loadedStreamCapability.reject(e)},getBeginChunk:function(e){return Math.floor(e/this.chunkSize)},getEndChunk:function(e){return Math.floor((e-1)/this.chunkSize)+1},abort:function(){this.aborted=!0;this.pdfNetworkStream&&this.pdfNetworkStream.cancelAllRequests("abort");for(var e in this.promisesByRequest){this.promisesByRequest[e].reject(new Error("Request was aborted"))}}};return e}();t.ChunkedStream=i;t.ChunkedStreamManager=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFDocument=t.Page=void 0;var a=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],a=!0,i=!1,n=void 0;try{for(var o,s=e[Symbol.iterator]();!(a=(o=s.next()).done);a=!0){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=!0;n=e}finally{try{!a&&s.return&&s.return()}finally{if(i)throw n}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=r(2),n=r(137),o=r(138),s=r(140),c=r(152),l=r(150),u=r(139),h=r(153),f=r(154),d=r(168),g=function(){var e=[0,0,612,792];function t(e,t){return"display"===t&&e.viewable||"print"===t&&e.printable}function r(e){var t=e.pdfManager,r=e.xref,a=e.pageIndex,i=e.pageDict,n=e.ref,o=e.fontCache,s=e.builtInCMapCache,c=e.pdfFunctionFactory;this.pdfManager=t;this.pageIndex=a;this.pageDict=i;this.xref=r;this.ref=n;this.fontCache=o;this.builtInCMapCache=s;this.pdfFunctionFactory=c;this.evaluatorOptions=t.evaluatorOptions;this.resourcesPromise=null;var l="p"+this.pageIndex+"_",u={obj:0};this.idFactory={createObjId:function(){return l+ ++u.obj}}}r.prototype={_getInheritableProperty:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=(0,i.getInheritableProperty)({dict:this.pageDict,key:e,getArray:t,stopWhenFound:!1});return Array.isArray(r)?1!==r.length&&(0,o.isDict)(r[0])?o.Dict.merge(this.xref,r):r[0]:r},get content(){return this.pageDict.get("Contents")},get resources(){return(0,i.shadow)(this,"resources",this._getInheritableProperty("Resources")||o.Dict.empty)},get mediaBox(){var t=this._getInheritableProperty("MediaBox",!0);return Array.isArray(t)&&4===t.length?(0,i.shadow)(this,"mediaBox",t):(0,i.shadow)(this,"mediaBox",e)},get cropBox(){var e=this._getInheritableProperty("CropBox",!0);return Array.isArray(e)&&4===e.length?(0,i.shadow)(this,"cropBox",e):(0,i.shadow)(this,"cropBox",this.mediaBox)},get userUnit(){var e=this.pageDict.get("UserUnit");(!(0,i.isNum)(e)||e<=0)&&(e=1);return(0,i.shadow)(this,"userUnit",e)},get view(){var e=this.mediaBox,t=this.cropBox;if(e===t)return(0,i.shadow)(this,"view",e);var r=i.Util.intersect(t,e);return(0,i.shadow)(this,"view",r||e)},get rotate(){var e=this._getInheritableProperty("Rotate")||0;e%90!=0?e=0:e>=360?e%=360:e<0&&(e=(e%360+360)%360);return(0,i.shadow)(this,"rotate",e)},getContentStream:function(){var e,t=this.content;if(Array.isArray(t)){var r,a=this.xref,i=t.length,n=[];for(r=0;r<i;++r)n.push(a.fetchIfRef(t[r]));e=new s.StreamsSequenceStream(n)}else e=(0,o.isStream)(t)?t:new s.NullStream;return e},loadResources:function(e){var t=this;this.resourcesPromise||(this.resourcesPromise=this.pdfManager.ensure(this,"resources"));return this.resourcesPromise.then(function(){return new n.ObjectLoader(t.resources,e,t.xref).load()})},getOperatorList:function(e){var r=this,n=e.handler,o=e.task,s=e.intent,c=e.renderInteractiveForms,l=this.pdfManager.ensure(this,"getContentStream"),u=this.loadResources(["ExtGState","ColorSpace","Pattern","Shading","XObject","Font"]),d=new f.PartialEvaluator({pdfManager:this.pdfManager,xref:this.xref,handler:n,pageIndex:this.pageIndex,idFactory:this.idFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,options:this.evaluatorOptions,pdfFunctionFactory:this.pdfFunctionFactory}),g=Promise.all([l,u]).then(function(e){var t=a(e,1)[0],i=new h.OperatorList(s,n,r.pageIndex);n.send("StartRenderPage",{transparency:d.hasBlendModes(r.resources),pageIndex:r.pageIndex,intent:s});return d.getOperatorList({stream:t,task:o,resources:r.resources,operatorList:i}).then(function(){return i})});return Promise.all([g,this._parsedAnnotations]).then(function(e){var r=a(e,2),n=r[0],l=r[1];if(0===l.length){n.flush(!0);return n}var u,h,f=[];for(u=0,h=l.length;u<h;u++)t(l[u],s)&&f.push(l[u].getOperatorList(d,o,c));return Promise.all(f).then(function(e){n.addOp(i.OPS.beginAnnotations,[]);for(u=0,h=e.length;u<h;u++)n.addOpList(e[u]);n.addOp(i.OPS.endAnnotations,[]);n.flush(!0);return n})})},extractTextContent:function(e){var t=this,r=e.handler,i=e.task,n=e.normalizeWhitespace,o=e.sink,s=e.combineTextItems,c=this.pdfManager.ensure(this,"getContentStream"),l=this.loadResources(["ExtGState","XObject","Font"]);return Promise.all([c,l]).then(function(e){var c=a(e,1)[0];return new f.PartialEvaluator({pdfManager:t.pdfManager,xref:t.xref,handler:r,pageIndex:t.pageIndex,idFactory:t.idFactory,fontCache:t.fontCache,builtInCMapCache:t.builtInCMapCache,options:t.evaluatorOptions,pdfFunctionFactory:t.pdfFunctionFactory}).getTextContent({stream:c,task:i,resources:t.resources,normalizeWhitespace:n,combineTextItems:s,sink:o})})},getAnnotationsData:function(e){return this._parsedAnnotations.then(function(r){for(var a=[],i=0,n=r.length;i<n;i++)e&&!t(r[i],e)||a.push(r[i].data);return a})},get annotations(){return(0,i.shadow)(this,"annotations",this._getInheritableProperty("Annots")||[])},get _parsedAnnotations(){var e=this,t=this.pdfManager.ensure(this,"annotations").then(function(){for(var t=e.annotations,r=[],a=0,n=t.length;a<n;a++)r.push(c.AnnotationFactory.create(e.xref,t[a],e.pdfManager,e.idFactory));return Promise.all(r).then(function(e){return e.filter(function(e){return!!e})},function(e){(0,i.warn)('_parsedAnnotations: "'+e+'".');return[]})});return(0,i.shadow)(this,"_parsedAnnotations",t)}};return r}(),m=function(){function e(e,t){var r;if((0,o.isStream)(t))r=t;else{if(!(0,i.isArrayBuffer)(t))throw new Error("PDFDocument: Unknown argument type");r=new s.Stream(t)}if(r.length<=0)throw new Error("PDFDocument: stream must have data");this.pdfManager=e;this.stream=r;this.xref=new n.XRef(r,e);var a=e.evaluatorOptions;this.pdfFunctionFactory=new d.PDFFunctionFactory({xref:this.xref,isEvalSupported:a.isEvalSupported});this._pagePromises=[]}function t(e,t,r,a){var i=e.pos,n=e.end,o=[];i+r>n&&(r=n-i);for(var s=0;s<r;++s)o.push(String.fromCharCode(e.getByte()));var c=o.join("");e.pos=i;var l=a?c.lastIndexOf(t):c.indexOf(t);if(-1===l)return!1;e.pos+=l;return!0}var r={Title:i.isString,Author:i.isString,Subject:i.isString,Keywords:i.isString,Creator:i.isString,Producer:i.isString,CreationDate:i.isString,ModDate:i.isString,Trapped:o.isName};e.prototype={parse:function(e){this.setup(e);var t=this.catalog.catDict.get("Version");(0,o.isName)(t)&&(this.pdfFormatVersion=t.name);try{this.acroForm=this.catalog.catDict.get("AcroForm");if(this.acroForm){this.xfa=this.acroForm.get("XFA");var r=this.acroForm.get("Fields");r&&Array.isArray(r)&&0!==r.length||this.xfa||(this.acroForm=null)}}catch(e){if(e instanceof i.MissingDataException)throw e;(0,i.info)("Something wrong with AcroForm entry");this.acroForm=null}},get linearization(){var e=null;try{e=u.Linearization.create(this.stream)}catch(e){if(e instanceof i.MissingDataException)throw e;(0,i.info)(e)}return(0,i.shadow)(this,"linearization",e)},get startXRef(){var e=this.stream,r=0;if(this.linearization){e.reset();t(e,"endobj",1024)&&(r=e.pos+6)}else{for(var a=!1,n=e.end;!a&&n>0;){(n-=1024-"startxref".length)<0&&(n=0);e.pos=n;a=t(e,"startxref",1024,!0)}if(a){e.skip(9);var o;do{o=e.getByte()}while((0,i.isSpace)(o));for(var s="";o>=32&&o<=57;){s+=String.fromCharCode(o);o=e.getByte()}r=parseInt(s,10);isNaN(r)&&(r=0)}}return(0,i.shadow)(this,"startXRef",r)},checkHeader:function(){var e=this.stream;e.reset();if(t(e,"%PDF-",1024)){e.moveStart();for(var r,a="";(r=e.getByte())>32&&!(a.length>=12);)a+=String.fromCharCode(r);this.pdfFormatVersion||(this.pdfFormatVersion=a.substring(5))}else;},parseStartXRef:function(){var e=this.startXRef;this.xref.setStartXRef(e)},setup:function(e){this.xref.parse(e);this.catalog=new n.Catalog(this.pdfManager,this.xref)},get numPages(){var e=this.linearization,t=e?e.numPages:this.catalog.numPages;return(0,i.shadow)(this,"numPages",t)},get documentInfo(){var e={PDFFormatVersion:this.pdfFormatVersion,IsLinearized:!!this.linearization,IsAcroFormPresent:!!this.acroForm,IsXFAPresent:!!this.xfa},t=void 0;try{t=this.xref.trailer.get("Info")}catch(e){if(e instanceof i.MissingDataException)throw e;(0,i.info)("The document information dictionary is invalid.")}if((0,o.isDict)(t))for(var a in r)if(t.has(a)){var n=t.get(a);r[a](n)?e[a]="string"!=typeof n?n:(0,i.stringToPDFString)(n):(0,i.info)('Bad value in document info for "'+a+'"')}return(0,i.shadow)(this,"documentInfo",e)},get fingerprint(){var e,t="",r=this.xref.trailer.get("ID");if(Array.isArray(r)&&r[0]&&(0,i.isString)(r[0])&&"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"!==r[0])e=(0,i.stringToBytes)(r[0]);else{this.stream.ensureRange&&this.stream.ensureRange(0,Math.min(1024,this.stream.end));e=(0,l.calculateMD5)(this.stream.bytes.subarray(0,1024),0,1024)}for(var a=0,n=e.length;a<n;a++){var o=e[a].toString(16);t+=1===o.length?"0"+o:o}return(0,i.shadow)(this,"fingerprint",t)},_getLinearizationPage:function(e){var t=this.catalog,r=this.linearization;(0,i.assert)(r&&r.pageFirst===e);var a=new o.Ref(r.objectNumberFirst,0);return this.xref.fetchAsync(a).then(function(e){if((0,o.isDict)(e,"Page")||(0,o.isDict)(e)&&!e.has("Type")&&e.has("Contents")){a&&!t.pageKidsCountCache.has(a)&&t.pageKidsCountCache.put(a,1);return[e,a]}throw new i.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.")}).catch(function(r){(0,i.info)(r);return t.getPageDict(e)})},getPage:function(e){var t=this;if(void 0!==this._pagePromises[e])return this._pagePromises[e];var r=this.catalog,i=this.linearization,n=i&&i.pageFirst===e?this._getLinearizationPage(e):r.getPageDict(e);return this._pagePromises[e]=n.then(function(i){var n=a(i,2),o=n[0],s=n[1];return new g({pdfManager:t.pdfManager,xref:t.xref,pageIndex:e,pageDict:o,ref:s,fontCache:r.fontCache,builtInCMapCache:r.builtInCMapCache,pdfFunctionFactory:t.pdfFunctionFactory})})},cleanup:function(){return this.catalog.cleanup()}};return e}();t.Page=g;t.PDFDocument=m},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.FileSpec=t.XRef=t.ObjectLoader=t.Catalog=void 0;var a,i=r(131),n=(a=i)&&a.__esModule?a:{default:a},o=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],a=!0,i=!1,n=void 0;try{for(var o,s=e[Symbol.iterator]();!(a=(o=s.next()).done);a=!0){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=!0;n=e}finally{try{!a&&s.return&&s.return()}finally{if(i)throw n}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1;a.configurable=!0;"value"in a&&(a.writable=!0);Object.defineProperty(e,a.key,a)}}return function(t,r,a){r&&e(t.prototype,r);a&&e(t,a);return t}}(),l=r(2),u=r(138),h=r(139),f=r(135),d=r(150),g=r(151);function m(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function v(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function a(i,n){try{var o=t[i](n),s=o.value}catch(e){r(e);return}if(!o.done)return Promise.resolve(s).then(function(e){a("next",e)},function(e){a("throw",e)});e(s)}("next")})}}function b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(e){return(0,u.isDict)(e)?e.get("D"):e}var w=function(){function e(t,r){b(this,e);this.pdfManager=t;this.xref=r;this.catDict=r.getCatalogObj();if(!(0,u.isDict)(this.catDict))throw new l.FormatError("Catalog object is not a dictionary.");this.fontCache=new u.RefSetCache;this.builtInCMapCache=new Map;this.pageKidsCountCache=new u.RefSetCache}c(e,[{key:"_readDocumentOutline",value:function(){var t=this.catDict.get("Outlines");if(!(0,u.isDict)(t))return null;t=t.getRaw("First");if(!(0,u.isRef)(t))return null;var r={items:[]},a=[{obj:t,parent:r}],i=new u.RefSet;i.put(t);for(var n=this.xref,o=new Uint8ClampedArray(3);a.length>0;){var s=a.shift(),c=n.fetchIfRef(s.obj);if(null!==c){if(!c.has("Title"))throw new l.FormatError("Invalid outline item encountered.");var h={url:null,dest:null};e.parseDestDictionary({destDict:c,resultObj:h,docBaseUrl:this.pdfManager.docBaseUrl});var f=c.get("Title"),d=c.get("F")||0,m=c.getArray("C"),p=o;!Array.isArray(m)||3!==m.length||0===m[0]&&0===m[1]&&0===m[2]||(p=g.ColorSpace.singletons.rgb.getRgb(m,0));var v={dest:h.dest,url:h.url,unsafeUrl:h.unsafeUrl,newWindow:h.newWindow,title:(0,l.stringToPDFString)(f),color:p,count:c.get("Count"),bold:!!(2&d),italic:!!(1&d),items:[]};s.parent.items.push(v);t=c.getRaw("First");if((0,u.isRef)(t)&&!i.has(t)){a.push({obj:t,parent:v});i.put(t)}t=c.getRaw("Next");if((0,u.isRef)(t)&&!i.has(t)){a.push({obj:t,parent:s.parent});i.put(t)}}}return r.items.length>0?r.items:null}},{key:"_readPermissions",value:function(){var e=this.xref.trailer.get("Encrypt");if(!(0,u.isDict)(e))return null;var t=e.get("P");if(!(0,l.isNum)(t))return null;t+=Math.pow(2,32);var r=[];for(var a in l.PermissionFlag){var i=l.PermissionFlag[a];t&i&&r.push(i)}return r}},{key:"getDestination",value:function(e){var t=this._readDests();return t instanceof C||t instanceof u.Dict?y(t.get(e)||null):null}},{key:"_readDests",value:function(){var e=this.catDict.get("Names");return e&&e.has("Dests")?new C(e.getRaw("Dests"),this.xref):this.catDict.has("Dests")?this.catDict.get("Dests"):void 0}},{key:"_readPageLabels",value:function(){var e=this.catDict.getRaw("PageLabels");if(!e)return null;for(var t=new Array(this.numPages),r=null,a="",i=new x(e,this.xref).getAll(),n="",o=1,s=0,c=this.numPages;s<c;s++){if(s in i){var h=i[s];if(!(0,u.isDict)(h))throw new l.FormatError("PageLabel is not a dictionary.");if(h.has("Type")&&!(0,u.isName)(h.get("Type"),"PageLabel"))throw new l.FormatError("Invalid type in PageLabel dictionary.");if(h.has("S")){var f=h.get("S");if(!(0,u.isName)(f))throw new l.FormatError("Invalid style in PageLabel dictionary.");r=f.name}else r=null;if(h.has("P")){var d=h.get("P");if(!(0,l.isString)(d))throw new l.FormatError("Invalid prefix in PageLabel dictionary.");a=(0,l.stringToPDFString)(d)}else a="";if(h.has("St")){var g=h.get("St");if(!(Number.isInteger(g)&&g>=1))throw new l.FormatError("Invalid start in PageLabel dictionary.");o=g}else o=1}switch(r){case"D":n=o;break;case"R":case"r":n=(0,l.toRomanNumerals)(o,"r"===r);break;case"A":case"a":for(var m="a"===r?97:65,p=o-1,v=String.fromCharCode(m+p%26),b=[],y=0,w=p/26|0;y<=w;y++)b.push(v);n=b.join("");break;default:if(r)throw new l.FormatError('Invalid style "'+r+'" in PageLabel dictionary.');n=""}t[s]=a+n;o++}return t}},{key:"cleanup",value:function(){var e=this;this.pageKidsCountCache.clear();var t=[];this.fontCache.forEach(function(e){t.push(e)});return Promise.all(t).then(function(t){for(var r=0,a=t.length;r<a;r++){delete t[r].dict.translated}e.fontCache.clear();e.builtInCMapCache.clear()})}},{key:"getPageDict",value:function(e){var t=(0,l.createPromiseCapability)(),r=[this.catDict.getRaw("Pages")],a=this.xref,i=this.pageKidsCountCache,n=void 0,o=0;!function c(){for(var h=function(){var s=r.pop();if((0,u.isRef)(s)){if((n=i.get(s))>0&&o+n<e){o+=n;return"continue"}a.fetchAsync(s).then(function(a){if((0,u.isDict)(a,"Page")||(0,u.isDict)(a)&&!a.has("Kids"))if(e===o){s&&!i.has(s)&&i.put(s,1);t.resolve([a,s])}else{o++;c()}else{r.push(a);c()}},t.reject);return{v:void 0}}if(!(0,u.isDict)(s)){t.reject(new l.FormatError("Page dictionary kid reference points to wrong type of object."));return{v:void 0}}n=s.get("Count");if(Number.isInteger(n)&&n>=0){var h=s.objId;h&&!i.has(h)&&i.put(h,n);if(o+n<=e){o+=n;return"continue"}}var f=s.get("Kids");if(!Array.isArray(f)){if((0,u.isName)(s.get("Type"),"Page")||!s.has("Type")&&s.has("Contents")){if(o===e){t.resolve([s,null]);return{v:void 0}}o++;return"continue"}t.reject(new l.FormatError("Page dictionary kids object is not an array."));return{v:void 0}}for(var d=f.length-1;d>=0;d--)r.push(f[d])};r.length;){var f=h();switch(f){case"continue":continue;default:if("object"===(void 0===f?"undefined":s(f)))return f.v}}t.reject(new Error("Page index "+e+" not found."))}();return t.promise}},{key:"getPageIndex",value:function(e){var t=this.xref;var r=0;return function a(i){return function(r){var a=0,i=void 0;return t.fetchAsync(r).then(function(t){if((0,u.isRefsEqual)(r,e)&&!(0,u.isDict)(t,"Page")&&(!(0,u.isDict)(t)||t.has("Type")||!t.has("Contents")))throw new l.FormatError("The reference does not point to a /Page dictionary.");if(!t)return null;if(!(0,u.isDict)(t))throw new l.FormatError("Node must be a dictionary.");i=t.getRaw("Parent");return t.getAsync("Parent")}).then(function(e){if(!e)return null;if(!(0,u.isDict)(e))throw new l.FormatError("Parent must be a dictionary.");return e.getAsync("Kids")}).then(function(e){if(!e)return null;for(var n=[],o=!1,s=0,c=e.length;s<c;s++){var h=e[s];if(!(0,u.isRef)(h))throw new l.FormatError("Kid must be a reference.");if((0,u.isRefsEqual)(h,r)){o=!0;break}n.push(t.fetchAsync(h).then(function(e){if(!(0,u.isDict)(e))throw new l.FormatError("Kid node must be a dictionary.");e.has("Count")?a+=e.get("Count"):a++}))}if(!o)throw new l.FormatError("Kid reference not found in parent's kids.");return Promise.all(n).then(function(){return[a,i]})})}(i).then(function(e){if(!e)return r;var t=o(e,2),i=t[0],n=t[1];r+=i;return a(n)})}(e)}},{key:"metadata",get:function(){var e=this.catDict.getRaw("Metadata");if(!(0,u.isRef)(e))return(0,l.shadow)(this,"metadata",null);var t=!(this.xref.encrypt&&this.xref.encrypt.encryptMetadata),r=this.xref.fetch(e,t),a=void 0;if(r&&(0,u.isDict)(r.dict)){var i=r.dict.get("Type"),n=r.dict.get("Subtype");if((0,u.isName)(i,"Metadata")&&(0,u.isName)(n,"XML"))try{a=(0,l.stringToUTF8String)((0,l.bytesToString)(r.getBytes()))}catch(e){if(e instanceof l.MissingDataException)throw e;(0,l.info)("Skipping invalid metadata.")}}return(0,l.shadow)(this,"metadata",a)}},{key:"toplevelPagesDict",get:function(){var e=this.catDict.get("Pages");if(!(0,u.isDict)(e))throw new l.FormatError("Invalid top-level pages dictionary.");return(0,l.shadow)(this,"toplevelPagesDict",e)}},{key:"documentOutline",get:function(){var e=null;try{e=this._readDocumentOutline()}catch(e){if(e instanceof l.MissingDataException)throw e;(0,l.warn)("Unable to read document outline.")}return(0,l.shadow)(this,"documentOutline",e)}},{key:"permissions",get:function(){var e=null;try{e=this._readPermissions()}catch(e){if(e instanceof l.MissingDataException)throw e;(0,l.warn)("Unable to read permissions.")}return(0,l.shadow)(this,"permissions",e)}},{key:"numPages",get:function(){var e=this.toplevelPagesDict.get("Count");if(!Number.isInteger(e))throw new l.FormatError("Page count in top-level pages dictionary is not an integer.");return(0,l.shadow)(this,"numPages",e)}},{key:"destinations",get:function(){var e=this._readDests(),t=Object.create(null);if(e instanceof C){var r=e.getAll();for(var a in r)t[a]=y(r[a])}else e instanceof u.Dict&&e.forEach(function(e,r){r&&(t[e]=y(r))});return(0,l.shadow)(this,"destinations",t)}},{key:"pageLabels",get:function(){var e=null;try{e=this._readPageLabels()}catch(e){if(e instanceof l.MissingDataException)throw e;(0,l.warn)("Unable to read page labels.")}return(0,l.shadow)(this,"pageLabels",e)}},{key:"pageMode",get:function(){var e=this.catDict.get("PageMode"),t="UseNone";if((0,u.isName)(e))switch(e.name){case"UseNone":case"UseOutlines":case"UseThumbs":case"FullScreen":case"UseOC":case"UseAttachments":t=e.name}return(0,l.shadow)(this,"pageMode",t)}},{key:"attachments",get:function(){var e=this.catDict.get("Names"),t=null;if(e&&e.has("EmbeddedFiles")){var r=new C(e.getRaw("EmbeddedFiles"),this.xref).getAll();for(var a in r){var i=new _(r[a],this.xref);t||(t=Object.create(null));t[(0,l.stringToPDFString)(a)]=i.serializable}}return(0,l.shadow)(this,"attachments",t)}},{key:"javaScript",get:function(){var e=this.catDict.get("Names"),t=null;function r(e){var r=e.get("S");if((0,u.isName)(r,"JavaScript")){var a=e.get("JS");if((0,u.isStream)(a))a=(0,l.bytesToString)(a.getBytes());else if(!(0,l.isString)(a))return;t||(t=[]);t.push((0,l.stringToPDFString)(a))}}if(e&&e.has("JavaScript")){var a=new C(e.getRaw("JavaScript"),this.xref).getAll();for(var i in a){var n=a[i];(0,u.isDict)(n)&&r(n)}}var o=this.catDict.get("OpenAction");if((0,u.isDict)(o,"Action")){var s=o.get("S");if((0,u.isName)(s,"Named")){var c=o.get("N");if((0,u.isName)(c,"Print")){t||(t=[]);t.push("print({});")}}else r(o)}return(0,l.shadow)(this,"javaScript",t)}}],[{key:"parseDestDictionary",value:function(e){var t=e.destDict;if((0,u.isDict)(t)){var r=e.resultObj;if("object"===(void 0===r?"undefined":s(r))){var a=e.docBaseUrl||null,i=t.get("A"),n=void 0,o=void 0;!(0,u.isDict)(i)&&t.has("Dest")&&(i=t.get("Dest"));if((0,u.isDict)(i)){var c=i.get("S");if(!(0,u.isName)(c)){(0,l.warn)("parseDestDictionary: Invalid type in Action dictionary.");return}var h=c.name;switch(h){case"URI":n=i.get("URI");(0,u.isName)(n)?n="/"+n.name:(0,l.isString)(n)&&(n=function(e){return 0===e.indexOf("www.")?"http://"+e:e}(n));break;case"GoTo":o=i.get("D");break;case"Launch":case"GoToR":var f=i.get("F");(0,u.isDict)(f)?n=f.get("F")||null:(0,l.isString)(f)&&(n=f);var d=i.get("D");if(d){(0,u.isName)(d)&&(d=d.name);if((0,l.isString)(n)){var g=n.split("#")[0];(0,l.isString)(d)?n=g+"#"+d:Array.isArray(d)&&(n=g+"#"+JSON.stringify(d))}}var m=i.get("NewWindow");(0,l.isBool)(m)&&(r.newWindow=m);break;case"Named":var p=i.get("N");(0,u.isName)(p)&&(r.action=p.name);break;case"JavaScript":var v=i.get("JS"),b=void 0;(0,u.isStream)(v)?b=(0,l.bytesToString)(v.getBytes()):(0,l.isString)(v)&&(b=v);if(b){var y=new RegExp("^\\s*("+["app.launchURL","window.open"].join("|").split(".").join("\\.")+")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))","i").exec((0,l.stringToPDFString)(b));if(y&&y[2]){n=y[2];"true"===y[3]&&"app.launchURL"===y[1]&&(r.newWindow=!0);break}}default:(0,l.warn)('parseDestDictionary: unsupported action type "'+h+'".')}}else t.has("Dest")&&(o=t.get("Dest"));if((0,l.isString)(n)){n=function(e){try{return(0,l.stringToUTF8String)(e)}catch(t){return e}}(n);var w=(0,l.createValidAbsoluteUrl)(n,a);w&&(r.url=w.href);r.unsafeUrl=n}if(o){(0,u.isName)(o)&&(o=o.name);((0,l.isString)(o)||Array.isArray(o))&&(r.dest=o)}}else(0,l.warn)("parseDestDictionary: `resultObj` must be an object.")}else(0,l.warn)("parseDestDictionary: `destDict` must be a dictionary.")}}]);return e}(),k=function(){function e(e,t){this.stream=e;this.pdfManager=t;this.entries=[];this.xrefstms=Object.create(null);this.cache=[];this.stats={streamTypes:[],fontTypes:[]}}e.prototype={setStartXRef:function(e){this.startXRefQueue=[e]},parse:function(e){var t;if(e){(0,l.warn)("Indexing all PDF objects");t=this.indexObjects()}else t=this.readXRef();t.assignXref(this);this.trailer=t;var r=void 0;try{r=t.get("Encrypt")}catch(e){if(e instanceof l.MissingDataException)throw e;(0,l.warn)('XRef.parse - Invalid "Encrypt" reference: "'+e+'".')}if((0,u.isDict)(r)){var a=t.get("ID"),i=a&&a.length?a[0]:"";r.suppressEncryption=!0;this.encrypt=new d.CipherTransformFactory(r,i,this.pdfManager.password)}var n=void 0;try{n=t.get("Root")}catch(e){if(e instanceof l.MissingDataException)throw e;(0,l.warn)('XRef.parse - Invalid "Root" reference: "'+e+'".')}if(!(0,u.isDict)(n)||!n.has("Pages")){if(!e)throw new l.XRefParseException;throw new l.FormatError("Invalid root reference")}this.root=n},processXRefTable:function(e){"tableState"in this||(this.tableState={entryNum:0,streamPos:e.lexer.stream.pos,parserBuf1:e.buf1,parserBuf2:e.buf2});var t=this.readXRefTable(e);if(!(0,u.isCmd)(t,"trailer"))throw new l.FormatError("Invalid XRef table: could not find trailer dictionary");var r=e.getObj();!(0,u.isDict)(r)&&r.dict&&(r=r.dict);if(!(0,u.isDict)(r))throw new l.FormatError("Invalid XRef table: could not parse trailer dictionary");delete this.tableState;return r},readXRefTable:function(e){var t,r=e.lexer.stream,a=this.tableState;r.pos=a.streamPos;e.buf1=a.parserBuf1;e.buf2=a.parserBuf2;for(;;){if(!("firstEntryNum"in a&&"entryCount"in a)){if((0,u.isCmd)(t=e.getObj(),"trailer"))break;a.firstEntryNum=t;a.entryCount=e.getObj()}var i=a.firstEntryNum,n=a.entryCount;if(!Number.isInteger(i)||!Number.isInteger(n))throw new l.FormatError("Invalid XRef table: wrong types in subsection header");for(var o=a.entryNum;o<n;o++){a.streamPos=r.pos;a.entryNum=o;a.parserBuf1=e.buf1;a.parserBuf2=e.buf2;var s={};s.offset=e.getObj();s.gen=e.getObj();var c=e.getObj();(0,u.isCmd)(c,"f")?s.free=!0:(0,u.isCmd)(c,"n")&&(s.uncompressed=!0);if(!Number.isInteger(s.offset)||!Number.isInteger(s.gen)||!s.free&&!s.uncompressed)throw new l.FormatError("Invalid entry in XRef subsection: "+i+", "+n);0===o&&s.free&&1===i&&(i=0);this.entries[o+i]||(this.entries[o+i]=s)}a.entryNum=0;a.streamPos=r.pos;a.parserBuf1=e.buf1;a.parserBuf2=e.buf2;delete a.firstEntryNum;delete a.entryCount}if(this.entries[0]&&!this.entries[0].free)throw new l.FormatError("Invalid XRef table: unexpected first object");return t},processXRefStream:function(e){if(!("streamState"in this)){var t=e.dict,r=t.get("W"),a=t.get("Index");a||(a=[0,t.get("Size")]);this.streamState={entryRanges:a,byteWidths:r,entryNum:0,streamPos:e.pos}}this.readXRefStream(e);delete this.streamState;return e.dict},readXRefStream:function(e){var t,r,a=this.streamState;e.pos=a.streamPos;for(var i=a.byteWidths,n=i[0],o=i[1],s=i[2],c=a.entryRanges;c.length>0;){var u=c[0],h=c[1];if(!Number.isInteger(u)||!Number.isInteger(h))throw new l.FormatError("Invalid XRef range fields: "+u+", "+h);if(!Number.isInteger(n)||!Number.isInteger(o)||!Number.isInteger(s))throw new l.FormatError("Invalid XRef entry fields length: "+u+", "+h);for(t=a.entryNum;t<h;++t){a.entryNum=t;a.streamPos=e.pos;var f=0,d=0,g=0;for(r=0;r<n;++r)f=f<<8|e.getByte();0===n&&(f=1);for(r=0;r<o;++r)d=d<<8|e.getByte();for(r=0;r<s;++r)g=g<<8|e.getByte();var m={};m.offset=d;m.gen=g;switch(f){case 0:m.free=!0;break;case 1:m.uncompressed=!0;break;case 2:break;default:throw new l.FormatError("Invalid XRef entry type: "+f)}this.entries[u+t]||(this.entries[u+t]=m)}a.entryNum=0;a.streamPos=e.pos;c.splice(0,2)}},indexObjects:function(){var e=10,t=13,r=60;function a(a,i){for(var n="",o=a[i];o!==e&&o!==t&&o!==r&&!(++i>=a.length);){n+=String.fromCharCode(o);o=a[i]}return n}function i(e,t,r){for(var a=r.length,i=e.length,n=0;t<i;){for(var o=0;o<a&&e[t+o]===r[o];)++o;if(o>=a)break;t++;n++}return n}var n=/^(\d+)\s+(\d+)\s+obj\b/,o=/\bendobj[\b\s]$/,s=/\s+(\d+\s+\d+\s+obj[\b\s])$/,c=new Uint8Array([116,114,97,105,108,101,114]),f=new Uint8Array([115,116,97,114,116,120,114,101,102]),d=new Uint8Array([111,98,106]),g=new Uint8Array([47,88,82,101,102]);this.entries.length=0;var m=this.stream;m.pos=0;for(var p,v,b=m.getBytes(),y=m.start,w=b.length,k=[],S=[];y<w;){var C=b[y];if(9!==C&&C!==e&&C!==t&&32!==C)if(37!==C){var x,_=a(b,y);if(0!==_.indexOf("xref")||4!==_.length&&!/\s/.test(_[4]))if(x=n.exec(_)){void 0===this.entries[x[1]]&&(this.entries[x[1]]={offset:y-m.start,gen:0|x[2],uncompressed:!0});for(var A=void 0,P=y+_.length;P<b.length;){var I=P+i(b,P,d)+4;A=I-y;var O=Math.max(I-25,P),T=(0,l.bytesToString)(b.subarray(O,I));if(o.test(T))break;var E=s.exec(T);if(E&&E[1]){(0,l.warn)('indexObjects: Found new "obj" inside of another "obj", caused by missing "endobj" -- trying to recover.');A-=E[1].length;break}P=I}var F=b.subarray(y,y+A),R=i(F,0,g);if(R<A&&F[R+5]<64){S.push(y-m.start);this.xrefstms[y-m.start]=1}y+=A}else if(0!==_.indexOf("trailer")||7!==_.length&&!/\s/.test(_[7]))y+=_.length+1;else{k.push(y);y+=i(b,y,f)}else{y+=i(b,y,c);k.push(y);y+=i(b,y,f)}}else do{if(++y>=w)break;C=b[y]}while(C!==e&&C!==t);else++y}for(p=0,v=S.length;p<v;++p){this.startXRefQueue.push(S[p]);this.readXRef(!0)}var B=void 0;for(p=0,v=k.length;p<v;++p){m.pos=k[p];var D=new h.Parser(new h.Lexer(m),!0,this,!0),M=D.getObj();if((0,u.isCmd)(M,"trailer")){var L=D.getObj();if((0,u.isDict)(L)){var N=void 0;try{N=L.get("Root")}catch(e){if(e instanceof l.MissingDataException)throw e;continue}if((0,u.isDict)(N)&&N.has("Pages")){if(L.has("ID"))return L;B=L}}}}if(B)return B;throw new l.InvalidPDFException("Invalid PDF structure")},readXRef:function(e){var t=this.stream,r=Object.create(null);try{for(;this.startXRefQueue.length;){var a=this.startXRefQueue[0];if(r[a]){(0,l.warn)("readXRef - skipping XRef table since it was already parsed.");this.startXRefQueue.shift()}else{r[a]=!0;t.pos=a+t.start;var i,n=new h.Parser(new h.Lexer(t),!0,this),o=n.getObj();if((0,u.isCmd)(o,"xref")){i=this.processXRefTable(n);this.topDict||(this.topDict=i);o=i.get("XRefStm");if(Number.isInteger(o)){var s=o;if(!(s in this.xrefstms)){this.xrefstms[s]=1;this.startXRefQueue.push(s)}}}else{if(!Number.isInteger(o))throw new l.FormatError("Invalid XRef stream header");if(!Number.isInteger(n.getObj())||!(0,u.isCmd)(n.getObj(),"obj")||!(0,u.isStream)(o=n.getObj()))throw new l.FormatError("Invalid XRef stream");i=this.processXRefStream(o);this.topDict||(this.topDict=i);if(!i)throw new l.FormatError("Failed to read XRef stream")}o=i.get("Prev");Number.isInteger(o)?this.startXRefQueue.push(o):(0,u.isRef)(o)&&this.startXRefQueue.push(o.num);this.startXRefQueue.shift()}}return this.topDict}catch(e){if(e instanceof l.MissingDataException)throw e;(0,l.info)("(while reading XRef): "+e)}if(!e)throw new l.XRefParseException},getEntry:function(e){var t=this.entries[e];return t&&!t.free&&t.offset?t:null},fetchIfRef:function(e,t){return(0,u.isRef)(e)?this.fetch(e,t):e},fetch:function(e,t){if(!(0,u.isRef)(e))throw new Error("ref object is not a reference");var r=e.num;if(r in this.cache){var a=this.cache[r];a instanceof u.Dict&&!a.objId&&(a.objId=e.toString());return a}var i=this.getEntry(r);if(null===i)return this.cache[r]=null;i=i.uncompressed?this.fetchUncompressed(e,i,t):this.fetchCompressed(i,t);(0,u.isDict)(i)?i.objId=e.toString():(0,u.isStream)(i)&&(i.dict.objId=e.toString());return i},fetchUncompressed:function(e,t,r){var a=e.gen,i=e.num;if(t.gen!==a)throw new l.FormatError("inconsistent generation in XRef");var n=this.stream.makeSubStream(t.offset+this.stream.start),o=new h.Parser(new h.Lexer(n),!0,this),s=o.getObj(),c=o.getObj(),f=o.getObj();Number.isInteger(s)||(s=parseInt(s,10));Number.isInteger(c)||(c=parseInt(c,10));if(s!==i||c!==a||!(0,u.isCmd)(f))throw new l.FormatError("bad XRef entry");if("obj"!==f.cmd){if(0===f.cmd.indexOf("obj")){i=parseInt(f.cmd.substring(3),10);if(!Number.isNaN(i))return i}throw new l.FormatError("bad XRef entry")}t=this.encrypt&&!r?o.getObj(this.encrypt.createCipherTransform(i,a)):o.getObj();(0,u.isStream)(t)||(this.cache[i]=t);return t},fetchCompressed:function(e,t){var r=e.offset,a=this.fetch(new u.Ref(r,0));if(!(0,u.isStream)(a))throw new l.FormatError("bad ObjStm stream");var i=a.dict.get("First"),n=a.dict.get("N");if(!Number.isInteger(i)||!Number.isInteger(n))throw new l.FormatError("invalid first and n parameters for ObjStm stream");var o=new h.Parser(new h.Lexer(a),!1,this);o.allowStreams=!0;var s,c,f=[],d=[];for(s=0;s<n;++s){c=o.getObj();if(!Number.isInteger(c))throw new l.FormatError("invalid object number in the ObjStm stream: "+c);d.push(c);var g=o.getObj();if(!Number.isInteger(g))throw new l.FormatError("invalid object offset in the ObjStm stream: "+g)}for(s=0;s<n;++s){f.push(o.getObj());(0,u.isCmd)(o.buf1,"endobj")&&o.shift();c=d[s];var m=this.entries[c];m&&m.offset===r&&m.gen===s&&(this.cache[c]=f[s])}if(void 0===(e=f[e.gen]))throw new l.FormatError("bad XRef entry for compressed object");return e},fetchIfRefAsync:function(){var e=v(n.default.mark(function e(t,r){return n.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if((0,u.isRef)(t)){e.next=2;break}return e.abrupt("return",t);case 2:return e.abrupt("return",this.fetchAsync(t,r));case 3:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}(),fetchAsync:function(){var e=v(n.default.mark(function e(t,r){return n.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0;return e.abrupt("return",this.fetch(t,r));case 4:e.prev=4;e.t0=e.catch(0);if(e.t0 instanceof l.MissingDataException){e.next=8;break}throw e.t0;case 8:e.next=10;return this.pdfManager.requestRange(e.t0.begin,e.t0.end);case 10:return e.abrupt("return",this.fetchAsync(t,r));case 11:case"end":return e.stop()}},e,this,[[0,4]])}));return function(t,r){return e.apply(this,arguments)}}(),getCatalogObj:function(){return this.root}};return e}(),S=function(){function e(t,r,a){b(this,e);this.constructor===e&&(0,l.unreachable)("Cannot initialize NameOrNumberTree.");this.root=t;this.xref=r;this._type=a}c(e,[{key:"getAll",value:function(){var e=Object.create(null);if(!this.root)return e;var t=this.xref,r=new u.RefSet;r.put(this.root);for(var a=[this.root];a.length>0;){var i=t.fetchIfRef(a.shift());if((0,u.isDict)(i))if(i.has("Kids"))for(var n=i.get("Kids"),o=0,s=n.length;o<s;o++){var c=n[o];if(r.has(c))throw new l.FormatError('Duplicate entry in "'+this._type+'" tree.');a.push(c);r.put(c)}else{var h=i.get(this._type);if(Array.isArray(h))for(var f=0,d=h.length;f<d;f+=2)e[t.fetchIfRef(h[f])]=t.fetchIfRef(h[f+1])}}return e}},{key:"get",value:function(e){if(!this.root)return null;for(var t=this.xref,r=t.fetchIfRef(this.root),a=0;r.has("Kids");){if(++a>10){(0,l.warn)('Search depth limit reached for "'+this._type+'" tree.');return null}var i=r.get("Kids");if(!Array.isArray(i))return null;for(var n=0,o=i.length-1;n<=o;){var s=n+o>>1,c=t.fetchIfRef(i[s]).get("Limits");if(e<t.fetchIfRef(c[0]))o=s-1;else{if(!(e>t.fetchIfRef(c[1]))){r=t.fetchIfRef(i[s]);break}n=s+1}}if(n>o)return null}var u=r.get(this._type);if(Array.isArray(u))for(var h=0,f=u.length-2;h<=f;){var d=h+f&-2,g=t.fetchIfRef(u[d]);if(e<g)f=d-2;else{if(!(e>g))return t.fetchIfRef(u[d+1]);h=d+2}}return null}}]);return e}(),C=function(e){p(t,S);function t(e,r){b(this,t);return m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r,"Names"))}return t}(),x=function(e){p(t,S);function t(e,r){b(this,t);return m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r,"Nums"))}return t}(),_=function(){function e(e,t){if(e&&(0,u.isDict)(e)){this.xref=t;this.root=e;e.has("FS")&&(this.fs=e.get("FS"));this.description=e.has("Desc")?(0,l.stringToPDFString)(e.get("Desc")):"";e.has("RF")&&(0,l.warn)("Related file specifications are not supported");this.contentAvailable=!0;if(!e.has("EF")){this.contentAvailable=!1;(0,l.warn)("Non-embedded file specifications are not supported")}}}function t(e){return e.has("UF")?e.get("UF"):e.has("F")?e.get("F"):e.has("Unix")?e.get("Unix"):e.has("Mac")?e.get("Mac"):e.has("DOS")?e.get("DOS"):null}e.prototype={get filename(){if(!this._filename&&this.root){var e=t(this.root)||"unnamed";this._filename=(0,l.stringToPDFString)(e).replace(/\\\\/g,"\\").replace(/\\\//g,"/").replace(/\\/g,"/")}return this._filename},get content(){if(!this.contentAvailable)return null;!this.contentRef&&this.root&&(this.contentRef=t(this.root.get("EF")));var e=null;if(this.contentRef){var r=this.xref.fetchIfRef(this.contentRef);r&&(0,u.isStream)(r)?e=r.getBytes():(0,l.warn)("Embedded file specification points to non-existing/invalid content")}else(0,l.warn)("Embedded file specification does not have a content");return e},get serializable(){return{filename:this.filename,content:this.content}}};return e}(),A=function(){function e(e){return(0,u.isRef)(e)||(0,u.isDict)(e)||Array.isArray(e)||(0,u.isStream)(e)}function t(t,r){if((0,u.isDict)(t)||(0,u.isStream)(t))for(var a=(0,u.isDict)(t)?t:t.dict,i=a.getKeys(),n=0,o=i.length;n<o;n++){var s=a.getRaw(i[n]);e(s)&&r.push(s)}else if(Array.isArray(t))for(var c=0,l=t.length;c<l;c++){var h=t[c];e(h)&&r.push(h)}}function r(e,t,r){this.dict=e;this.keys=t;this.xref=r;this.refSet=null;this.capability=null}r.prototype={load:function(){this.capability=(0,l.createPromiseCapability)();if(!(this.xref.stream instanceof f.ChunkedStream)||0===this.xref.stream.getMissingChunks().length){this.capability.resolve();return this.capability.promise}var e=this.keys,t=this.dict;this.refSet=new u.RefSet;for(var r=[],a=0,i=e.length;a<i;a++){var n=t.getRaw(e[a]);void 0!==n&&r.push(n)}this._walk(r);return this.capability.promise},_walk:function(e){for(var r=this,a=[],i=[];e.length;){var n=e.pop();if((0,u.isRef)(n)){if(this.refSet.has(n))continue;try{this.refSet.put(n);n=this.xref.fetch(n)}catch(e){if(!(e instanceof l.MissingDataException))throw e;a.push(n);i.push({begin:e.begin,end:e.end})}}if(n&&n.getBaseStreams){for(var o=n.getBaseStreams(),s=!1,c=0,h=o.length;c<h;c++){var f=o[c];if(f.getMissingChunks&&f.getMissingChunks().length){s=!0;i.push({begin:f.start,end:f.end})}}s&&a.push(n)}t(n,e)}if(i.length)this.xref.stream.manager.requestRanges(i).then(function(){for(var e=0,t=a.length;e<t;e++){var i=a[e];(0,u.isRef)(i)&&r.refSet.remove(i)}r._walk(a)},this.capability.reject);else{this.refSet=null;this.capability.resolve()}}};return r}();t.Catalog=w;t.ObjectLoader=A;t.XRef=k;t.FileSpec=_},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i={},n=function(){function e(e){this.name=e}e.prototype={};var t=Object.create(null);e.get=function(r){var a=t[r];return a||(t[r]=new e(r))};return e}(),o=function(){function e(e){this.cmd=e}e.prototype={};var t=Object.create(null);e.get=function(r){var a=t[r];return a||(t[r]=new e(r))};return e}(),s=function(){var e=function(){return e};function t(t){this._map=Object.create(null);this.xref=t;this.objId=null;this.suppressEncryption=!1;this.__nonSerializable__=e}t.prototype={assignXref:function(e){this.xref=e},get:function(e,t,r){var a,i=this.xref,n=this.suppressEncryption;if(void 0!==(a=this._map[e])||e in this._map||void 0===t)return i?i.fetchIfRef(a,n):a;if(void 0!==(a=this._map[t])||t in this._map||void 0===r)return i?i.fetchIfRef(a,n):a;a=this._map[r]||null;return i?i.fetchIfRef(a,n):a},getAsync:function(e,t,r){var a,i=this.xref,n=this.suppressEncryption;if(void 0!==(a=this._map[e])||e in this._map||void 0===t)return i?i.fetchIfRefAsync(a,n):Promise.resolve(a);if(void 0!==(a=this._map[t])||t in this._map||void 0===r)return i?i.fetchIfRefAsync(a,n):Promise.resolve(a);a=this._map[r]||null;return i?i.fetchIfRefAsync(a,n):Promise.resolve(a)},getArray:function(e,t,r){var a=this.get(e,t,r),i=this.xref,n=this.suppressEncryption;if(!Array.isArray(a)||!i)return a;for(var o=0,s=(a=a.slice()).length;o<s;o++)d(a[o])&&(a[o]=i.fetch(a[o],n));return a},getRaw:function(e){return this._map[e]},getKeys:function(){return Object.keys(this._map)},set:function(e,t){this._map[e]=t},has:function(e){return e in this._map},forEach:function(e){for(var t in this._map)e(t,this.get(t))}};t.empty=new t(null);t.merge=function(e,r){for(var a=new t(e),i=0,n=r.length;i<n;i++){var o=r[i];if(f(o))for(var s in o._map)void 0===a._map[s]&&(a._map[s]=o._map[s])}return a};return t}(),c=function(){function e(e,t){this.num=e;this.gen=t}e.prototype={toString:function(){var e=this.num+"R";0!==this.gen&&(e+=this.gen);return e}};return e}(),l=function(){function e(){this.dict=Object.create(null)}e.prototype={has:function(e){return e.toString()in this.dict},put:function(e){this.dict[e.toString()]=!0},remove:function(e){delete this.dict[e.toString()]}};return e}(),u=function(){function e(){this.dict=Object.create(null)}e.prototype={get:function(e){return this.dict[e.toString()]},has:function(e){return e.toString()in this.dict},put:function(e,t){this.dict[e.toString()]=t},putAlias:function(e,t){this.dict[e.toString()]=this.get(t)},forEach:function(e,t){for(var r in this.dict)e.call(t,this.dict[r])},clear:function(){this.dict=Object.create(null)}};return e}();function h(e,t){return e instanceof n&&(void 0===t||e.name===t)}function f(e,t){return e instanceof s&&(void 0===t||h(e.get("Type"),t))}function d(e){return e instanceof c}t.EOF=i;t.Cmd=o;t.Dict=s;t.Name=n;t.Ref=c;t.RefSet=l;t.RefSetCache=u;t.isEOF=function(e){return e===i};t.isCmd=function(e,t){return e instanceof o&&(void 0===t||e.cmd===t)};t.isDict=f;t.isName=h;t.isRef=d;t.isRefsEqual=function(e,t){return e.num===t.num&&e.gen===t.gen};t.isStream=function(e){return"object"===(void 0===e?"undefined":a(e))&&null!==e&&void 0!==e.getBytes}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.Parser=t.Linearization=t.Lexer=void 0;var a=r(140),i=r(2),n=r(138),o=r(141),s=r(143),c=r(146),l=r(148);function u(e){for(var t=e.length,r=1,a=0,i=0;i<t;++i)a+=r+=255&e[i];return a%65521<<16|r%65521}var h=function(){function e(e,t,r,a){this.lexer=e;this.allowStreams=t;this.xref=r;this.recoveryMode=a||!1;this.imageCache=Object.create(null);this.refill()}e.prototype={refill:function(){this.buf1=this.lexer.getObj();this.buf2=this.lexer.getObj()},shift:function(){if((0,n.isCmd)(this.buf2,"ID")){this.buf1=this.buf2;this.buf2=null}else{this.buf1=this.buf2;this.buf2=this.lexer.getObj()}},tryShift:function(){try{this.shift();return!0}catch(e){if(e instanceof i.MissingDataException)throw e;return!1}},getObj:function(e){var t=this.buf1;this.shift();if(t instanceof n.Cmd)switch(t.cmd){case"BI":return this.makeInlineImage(e);case"[":for(var r=[];!(0,n.isCmd)(this.buf1,"]")&&!(0,n.isEOF)(this.buf1);)r.push(this.getObj(e));if((0,n.isEOF)(this.buf1)){if(!this.recoveryMode)throw new i.FormatError("End of file inside array");return r}this.shift();return r;case"<<":for(var a=new n.Dict(this.xref);!(0,n.isCmd)(this.buf1,">>")&&!(0,n.isEOF)(this.buf1);)if((0,n.isName)(this.buf1)){var o=this.buf1.name;this.shift();if((0,n.isEOF)(this.buf1))break;a.set(o,this.getObj(e))}else{(0,i.info)("Malformed dictionary: key must be a name object");this.shift()}if((0,n.isEOF)(this.buf1)){if(!this.recoveryMode)throw new i.FormatError("End of file inside dictionary");return a}if((0,n.isCmd)(this.buf2,"stream"))return this.allowStreams?this.makeStream(a,e):a;this.shift();return a;default:return t}if(Number.isInteger(t)){var s=t;if(Number.isInteger(this.buf1)&&(0,n.isCmd)(this.buf2,"R")){var c=new n.Ref(s,this.buf1);this.shift();this.shift();return c}return s}if((0,i.isString)(t)){var l=t;e&&(l=e.decryptString(l));return l}return t},findDefaultInlineStreamEnd:function(e){for(var t=e.pos,r=0,a=void 0,n=void 0;-1!==(a=e.getByte());)if(0===r)r=69===a?1:0;else if(1===r)r=73===a?2:0;else{(0,i.assert)(2===r);if(32===a||10===a||13===a){n=e.pos;for(var o=e.peekBytes(10),s=0,c=o.length;s<c;s++)if((0!==(a=o[s])||0===o[s+1])&&10!==a&&13!==a&&(a<32||a>127)){r=0;break}if(2===r)break}else r=0}if(-1===a){(0,i.warn)("findDefaultInlineStreamEnd: Reached the end of the stream without finding a valid EI marker");if(n){(0,i.warn)('... trying to recover by using the last "EI" occurrence.');e.skip(-(e.pos-n))}}return e.pos-4-t},findDCTDecodeInlineStreamEnd:function(e){for(var t,r,a,n=e.pos,o=!1;-1!==(t=e.getByte());)if(255===t){switch(e.getByte()){case 0:break;case 255:e.skip(-1);break;case 217:o=!0;break;case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:case 196:case 204:case 218:case 219:case 220:case 221:case 222:case 223:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:(r=e.getUint16())>2?e.skip(r-2):e.skip(-2)}if(o)break}a=e.pos-n;if(-1===t){(0,i.warn)("Inline DCTDecode image stream: EOI marker not found, searching for /EI/ instead.");e.skip(-a);return this.findDefaultInlineStreamEnd(e)}this.inlineStreamSkipEI(e);return a},findASCII85DecodeInlineStreamEnd:function(e){for(var t,r,a=e.pos;-1!==(t=e.getByte());)if(126===t&&62===e.peekByte()){e.skip();break}r=e.pos-a;if(-1===t){(0,i.warn)("Inline ASCII85Decode image stream: EOD marker not found, searching for /EI/ instead.");e.skip(-r);return this.findDefaultInlineStreamEnd(e)}this.inlineStreamSkipEI(e);return r},findASCIIHexDecodeInlineStreamEnd:function(e){for(var t,r,a=e.pos;-1!==(t=e.getByte())&&62!==t;);r=e.pos-a;if(-1===t){(0,i.warn)("Inline ASCIIHexDecode image stream: EOD marker not found, searching for /EI/ instead.");e.skip(-r);return this.findDefaultInlineStreamEnd(e)}this.inlineStreamSkipEI(e);return r},inlineStreamSkipEI:function(e){for(var t,r=0;-1!==(t=e.getByte());)if(0===r)r=69===t?1:0;else if(1===r)r=73===t?2:0;else if(2===r)break},makeInlineImage:function(e){for(var t=this.lexer,r=t.stream,a=new n.Dict(this.xref),o=void 0;!(0,n.isCmd)(this.buf1,"ID")&&!(0,n.isEOF)(this.buf1);){if(!(0,n.isName)(this.buf1))throw new i.FormatError("Dictionary key must be a name object");var s=this.buf1.name;this.shift();if((0,n.isEOF)(this.buf1))break;a.set(s,this.getObj(e))}-1!==t.beginInlineImagePos&&(o=r.pos-t.beginInlineImagePos);var c,l=a.get("Filter","F");if((0,n.isName)(l))c=l.name;else if(Array.isArray(l)){var h=this.xref.fetchIfRef(l[0]);(0,n.isName)(h)&&(c=h.name)}var f=r.pos,d=void 0;d="DCTDecode"===c||"DCT"===c?this.findDCTDecodeInlineStreamEnd(r):"ASCII85Decode"===c||"A85"===c?this.findASCII85DecodeInlineStreamEnd(r):"ASCIIHexDecode"===c||"AHx"===c?this.findASCIIHexDecodeInlineStreamEnd(r):this.findDefaultInlineStreamEnd(r);var g=r.makeSubStream(f,d,a),m=void 0;if(d<1e3&&o<5552){var p=g.getBytes();g.reset();var v=r.pos;r.pos=t.beginInlineImagePos;var b=r.getBytes(o);r.pos=v;m=u(p)+"_"+u(b);var y=this.imageCache[m];if(void 0!==y){this.buf2=n.Cmd.get("EI");this.shift();y.reset();return y}}e&&(g=e.createStream(g,d));(g=this.filter(g,a,d)).dict=a;if(void 0!==m){g.cacheKey="inline_"+d+"_"+m;this.imageCache[m]=g}this.buf2=n.Cmd.get("EI");this.shift();return g},_findStreamLength:function(e,t){var r=this.lexer.stream;r.pos=e;for(var a=t.length;r.pos<r.end;){var i=r.peekBytes(2048),n=i.length-a;if(n<=0)break;for(var o=0;o<n;){for(var s=0;s<a&&i[o+s]===t[s];)s++;if(s>=a){r.pos+=o;return r.pos-e}o++}r.pos+=n}return-1},makeStream:function(e,t){var r=this.lexer,a=r.stream;r.skipToNextLine();var o=a.pos-1,s=e.get("Length");if(!Number.isInteger(s)){(0,i.info)("Bad "+s+" attribute in stream");s=0}a.pos=o+s;r.nextChar();if(this.tryShift()&&(0,n.isCmd)(this.buf2,"endstream"))this.shift();else{var c=new Uint8Array([101,110,100,115,116,114,101,97,109]),l=this._findStreamLength(o,c);if(l<0){for(var u=1;u<=1;u++){var h=c.length-u,f=c.slice(0,h),d=this._findStreamLength(o,f);if(d>=0){var g=a.peekBytes(h+1)[h];if(!(0,i.isSpace)(g))break;(0,i.info)('Found "'+(0,i.bytesToString)(f)+'" when searching for endstream command.');l=d;break}}if(l<0)throw new i.FormatError("Missing endstream command.")}s=l;r.nextChar();this.shift();this.shift()}this.shift();a=a.makeSubStream(o,s,e);t&&(a=t.createStream(a,s));(a=this.filter(a,e,s)).dict=e;return a},filter:function(e,t,r){var a=t.get("Filter","F"),o=t.get("DecodeParms","DP");if((0,n.isName)(a)){Array.isArray(o)&&(0,i.warn)("/DecodeParms should not contain an Array, when /Filter contains a Name.");return this.makeFilter(e,a.name,r,o)}var s=r;if(Array.isArray(a))for(var c=a,l=o,u=0,h=c.length;u<h;++u){a=this.xref.fetchIfRef(c[u]);if(!(0,n.isName)(a))throw new i.FormatError("Bad filter name: "+a);o=null;Array.isArray(l)&&u in l&&(o=this.xref.fetchIfRef(l[u]));e=this.makeFilter(e,a.name,s,o);s=null}return e},makeFilter:function(e,t,r,n){if(0===r){(0,i.warn)('Empty "'+t+'" stream.');return new a.NullStream}try{var u=this.xref.stats.streamTypes;if("FlateDecode"===t||"Fl"===t){u[i.StreamType.FLATE]=!0;return n?new a.PredictorStream(new a.FlateStream(e,r),r,n):new a.FlateStream(e,r)}if("LZWDecode"===t||"LZW"===t){u[i.StreamType.LZW]=!0;var h=1;if(n){n.has("EarlyChange")&&(h=n.get("EarlyChange"));return new a.PredictorStream(new a.LZWStream(e,r,h),r,n)}return new a.LZWStream(e,r,h)}if("DCTDecode"===t||"DCT"===t){u[i.StreamType.DCT]=!0;return new c.JpegStream(e,r,e.dict,n)}if("JPXDecode"===t||"JPX"===t){u[i.StreamType.JPX]=!0;return new l.JpxStream(e,r,e.dict,n)}if("ASCII85Decode"===t||"A85"===t){u[i.StreamType.A85]=!0;return new a.Ascii85Stream(e,r)}if("ASCIIHexDecode"===t||"AHx"===t){u[i.StreamType.AHX]=!0;return new a.AsciiHexStream(e,r)}if("CCITTFaxDecode"===t||"CCF"===t){u[i.StreamType.CCF]=!0;return new o.CCITTFaxStream(e,r,n)}if("RunLengthDecode"===t||"RL"===t){u[i.StreamType.RL]=!0;return new a.RunLengthStream(e,r)}if("JBIG2Decode"===t){u[i.StreamType.JBIG]=!0;return new s.Jbig2Stream(e,r,e.dict,n)}(0,i.warn)('filter "'+t+'" not supported yet');return e}catch(e){if(e instanceof i.MissingDataException)throw e;(0,i.warn)('Invalid stream: "'+e+'"');return new a.NullStream}}};return e}(),f=function(){function e(e,t){this.stream=e;this.nextChar();this.strBuf=[];this.knownCommands=t;this.beginInlineImagePos=-1}var t=[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];function r(e){return e>=48&&e<=57?15&e:e>=65&&e<=70||e>=97&&e<=102?9+(15&e):-1}e.prototype={nextChar:function(){return this.currentChar=this.stream.getByte()},peekChar:function(){return this.stream.peekByte()},getNumber:function(){var e=this.currentChar,t=!1,r=0,a=0;if(45===e){a=-1;45===(e=this.nextChar())&&(e=this.nextChar())}else if(43===e){a=1;e=this.nextChar()}if(10===e||13===e)do{e=this.nextChar()}while(10===e||13===e);if(46===e){r=10;e=this.nextChar()}if(e<48||e>57){if(10===r&&0===a&&((0,i.isSpace)(e)||-1===e)){(0,i.warn)("Lexer.getNumber - treating a single decimal point as zero.");return 0}throw new i.FormatError("Invalid number: "+String.fromCharCode(e)+" (charCode "+e+")")}a=a||1;for(var n=e-48,o=0,s=1;(e=this.nextChar())>=0;)if(48<=e&&e<=57){var c=e-48;if(t)o=10*o+c;else{0!==r&&(r*=10);n=10*n+c}}else if(46===e){if(0!==r)break;r=1}else if(45===e)(0,i.warn)("Badly formatted number");else{if(69!==e&&101!==e)break;if(43===(e=this.peekChar())||45===e){s=45===e?-1:1;this.nextChar()}else if(e<48||e>57)break;t=!0}0!==r&&(n/=r);t&&(n*=Math.pow(10,s*o));return a*n},getString:function(){var e=1,t=!1,r=this.strBuf;r.length=0;for(var a=this.nextChar();;){var n=!1;switch(0|a){case-1:(0,i.warn)("Unterminated string");t=!0;break;case 40:++e;r.push("(");break;case 41:if(0==--e){this.nextChar();t=!0}else r.push(")");break;case 92:switch(a=this.nextChar()){case-1:(0,i.warn)("Unterminated string");t=!0;break;case 110:r.push("\n");break;case 114:r.push("\r");break;case 116:r.push("\t");break;case 98:r.push("\b");break;case 102:r.push("\f");break;case 92:case 40:case 41:r.push(String.fromCharCode(a));break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:var o=15&a;a=this.nextChar();n=!0;if(a>=48&&a<=55){o=(o<<3)+(15&a);if((a=this.nextChar())>=48&&a<=55){n=!1;o=(o<<3)+(15&a)}}r.push(String.fromCharCode(o));break;case 13:10===this.peekChar()&&this.nextChar();break;case 10:break;default:r.push(String.fromCharCode(a))}break;default:r.push(String.fromCharCode(a))}if(t)break;n||(a=this.nextChar())}return r.join("")},getName:function(){var e,a,o=this.strBuf;o.length=0;for(;(e=this.nextChar())>=0&&!t[e];)if(35===e){e=this.nextChar();if(t[e]){(0,i.warn)("Lexer_getName: NUMBER SIGN (#) should be followed by a hexadecimal number.");o.push("#");break}var s=r(e);if(-1!==s){a=e;var c=r(e=this.nextChar());if(-1===c){(0,i.warn)("Lexer_getName: Illegal digit ("+String.fromCharCode(e)+") in hexadecimal number.");o.push("#",String.fromCharCode(a));if(t[e])break;o.push(String.fromCharCode(e));continue}o.push(String.fromCharCode(s<<4|c))}else o.push("#",String.fromCharCode(e))}else o.push(String.fromCharCode(e));o.length>127&&(0,i.warn)("name token is longer than allowed by the spec: "+o.length);return n.Name.get(o.join(""))},getHexString:function(){var e=this.strBuf;e.length=0;for(var a,n,o=this.currentChar,s=!0;;){if(o<0){(0,i.warn)("Unterminated hex string");break}if(62===o){this.nextChar();break}if(1!==t[o]){if(s){if(-1===(a=r(o))){(0,i.warn)('Ignoring invalid character "'+o+'" in hex string');o=this.nextChar();continue}}else{if(-1===(n=r(o))){(0,i.warn)('Ignoring invalid character "'+o+'" in hex string');o=this.nextChar();continue}e.push(String.fromCharCode(a<<4|n))}s=!s;o=this.nextChar()}else o=this.nextChar()}return e.join("")},getObj:function(){for(var e=!1,r=this.currentChar;;){if(r<0)return n.EOF;if(e)10!==r&&13!==r||(e=!1);else if(37===r)e=!0;else if(1!==t[r])break;r=this.nextChar()}switch(0|r){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return this.getNumber();case 40:return this.getString();case 47:return this.getName();case 91:this.nextChar();return n.Cmd.get("[");case 93:this.nextChar();return n.Cmd.get("]");case 60:if(60===(r=this.nextChar())){this.nextChar();return n.Cmd.get("<<")}return this.getHexString();case 62:if(62===(r=this.nextChar())){this.nextChar();return n.Cmd.get(">>")}return n.Cmd.get(">");case 123:this.nextChar();return n.Cmd.get("{");case 125:this.nextChar();return n.Cmd.get("}");case 41:this.nextChar();throw new i.FormatError("Illegal character: "+r)}for(var a=String.fromCharCode(r),o=this.knownCommands,s=o&&void 0!==o[a];(r=this.nextChar())>=0&&!t[r];){var c=a+String.fromCharCode(r);if(s&&void 0===o[c])break;if(128===a.length)throw new i.FormatError("Command token too long: "+a.length);a=c;s=o&&void 0!==o[a]}if("true"===a)return!0;if("false"===a)return!1;if("null"===a)return null;"BI"===a&&(this.beginInlineImagePos=this.stream.pos);return n.Cmd.get(a)},skipToNextLine:function(){for(var e=this.currentChar;e>=0;){if(13===e){10===(e=this.nextChar())&&this.nextChar();break}if(10===e){this.nextChar();break}e=this.nextChar()}}};return e}(),d={create:function(e){function t(e,t){var r=u.get(e);if(Number.isInteger(r)&&(t?r>=0:r>0))return r;throw new Error('The "'+e+'" parameter in the linearization dictionary is invalid.')}var r,a,o=new h(new f(e),!1,null),s=o.getObj(),c=o.getObj(),l=o.getObj(),u=o.getObj();if(!(Number.isInteger(s)&&Number.isInteger(c)&&(0,n.isCmd)(l,"obj")&&(0,n.isDict)(u)&&(0,i.isNum)(r=u.get("Linearized"))&&r>0))return null;if((a=t("L"))!==e.length)throw new Error('The "L" parameter in the linearization dictionary does not equal the stream length.');return{length:a,hints:function(){var e,t,r=u.get("H");if(Array.isArray(r)&&(2===(e=r.length)||4===e)){for(var a=0;a<e;a++)if(!(Number.isInteger(t=r[a])&&t>0))throw new Error("Hint ("+a+") in the linearization dictionary is invalid.");return r}throw new Error("Hint array in the linearization dictionary is invalid.")}(),objectNumberFirst:t("O"),endFirst:t("E"),numPages:t("N"),mainXRefEntriesOffset:t("T"),pageFirst:u.has("P")?t("P",!0):0}}};t.Lexer=f;t.Linearization=d;t.Parser=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.LZWStream=t.StringStream=t.StreamsSequenceStream=t.Stream=t.RunLengthStream=t.PredictorStream=t.NullStream=t.FlateStream=t.DecodeStream=t.DecryptStream=t.AsciiHexStream=t.Ascii85Stream=void 0;var a=r(2),i=r(138);function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}var o=function(){function e(e,t,r,a){this.bytes=e instanceof Uint8Array?e:new Uint8Array(e);this.start=t||0;this.pos=this.start;this.end=t+r||this.bytes.length;this.dict=a}e.prototype={get length(){return this.end-this.start},get isEmpty(){return 0===this.length},getByte:function(){return this.pos>=this.end?-1:this.bytes[this.pos++]},getUint16:function(){var e=this.getByte(),t=this.getByte();return-1===e||-1===t?-1:(e<<8)+t},getInt32:function(){return(this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()},getBytes:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.bytes,a=this.pos,i=this.end;if(!e){var n=r.subarray(a,i);return t?new Uint8ClampedArray(n):n}var o=a+e;o>i&&(o=i);this.pos=o;var s=r.subarray(a,o);return t?new Uint8ClampedArray(s):s},peekByte:function(){var e=this.getByte();this.pos--;return e},peekBytes:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.getBytes(e,t);this.pos-=r.length;return r},skip:function(e){e||(e=1);this.pos+=e},reset:function(){this.pos=this.start},moveStart:function(){this.start=this.pos},makeSubStream:function(t,r,a){return new e(this.bytes.buffer,t,r,a)}};return e}(),s=function(){function e(e){var t=(0,a.stringToBytes)(e);o.call(this,t)}e.prototype=o.prototype;return e}(),c=function(){var e=new Uint8Array(0);function t(t){this._rawMinBufferLength=t||0;this.pos=0;this.bufferLength=0;this.eof=!1;this.buffer=e;this.minBufferLength=512;if(t)for(;this.minBufferLength<t;)this.minBufferLength*=2}t.prototype={get isEmpty(){for(;!this.eof&&0===this.bufferLength;)this.readBlock();return 0===this.bufferLength},ensureBuffer:function(e){var t=this.buffer;if(e<=t.byteLength)return t;for(var r=this.minBufferLength;r<e;)r*=2;var a=new Uint8Array(r);a.set(t);return this.buffer=a},getByte:function(){for(var e=this.pos;this.bufferLength<=e;){if(this.eof)return-1;this.readBlock()}return this.buffer[this.pos++]},getUint16:function(){var e=this.getByte(),t=this.getByte();return-1===e||-1===t?-1:(e<<8)+t},getInt32:function(){return(this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()},getBytes:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=this.pos;if(e){this.ensureBuffer(a+e);t=a+e;for(;!this.eof&&this.bufferLength<t;)this.readBlock();var i=this.bufferLength;t>i&&(t=i)}else{for(;!this.eof;)this.readBlock();t=this.bufferLength}this.pos=t;var n=this.buffer.subarray(a,t);return!r||n instanceof Uint8ClampedArray?n:new Uint8ClampedArray(n)},peekByte:function(){var e=this.getByte();this.pos--;return e},peekBytes:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.getBytes(e,t);this.pos-=r.length;return r},makeSubStream:function(e,t,r){for(var a=e+t;this.bufferLength<=a&&!this.eof;)this.readBlock();return new o(this.buffer,e,t,r)},skip:function(e){e||(e=1);this.pos+=e},reset:function(){this.pos=0},getBaseStreams:function(){return this.str&&this.str.getBaseStreams?this.str.getBaseStreams():[]}};return t}(),l=function(){function e(e){this.streams=e;for(var t=0,r=0,a=e.length;r<a;r++){var i=e[r];t+=i instanceof c?i._rawMinBufferLength:i.length}c.call(this,t)}e.prototype=Object.create(c.prototype);e.prototype.readBlock=function(){var e=this.streams;if(0!==e.length){var t=e.shift().getBytes(),r=this.bufferLength,a=r+t.length;this.ensureBuffer(a).set(t,r);this.bufferLength=a}else this.eof=!0};e.prototype.getBaseStreams=function(){for(var e=[],t=0,r=this.streams.length;t<r;t++){var a=this.streams[t];a.getBaseStreams&&e.push.apply(e,n(a.getBaseStreams()))}return e};return e}(),u=function(){var e=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),t=new Int32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),r=new Int32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),i=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],n=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5];function o(e,t){this.str=e;this.dict=e.dict;var r=e.getByte(),i=e.getByte();if(-1===r||-1===i)throw new a.FormatError("Invalid header in flate stream: "+r+", "+i);if(8!=(15&r))throw new a.FormatError("Unknown compression method in flate stream: "+r+", "+i);if(((r<<8)+i)%31!=0)throw new a.FormatError("Bad FCHECK in flate stream: "+r+", "+i);if(32&i)throw new a.FormatError("FDICT bit set in flate stream: "+r+", "+i);this.codeSize=0;this.codeBuf=0;c.call(this,t)}o.prototype=Object.create(c.prototype);o.prototype.getBits=function(e){for(var t,r=this.str,i=this.codeSize,n=this.codeBuf;i<e;){if(-1===(t=r.getByte()))throw new a.FormatError("Bad encoding in flate stream");n|=t<<i;i+=8}t=n&(1<<e)-1;this.codeBuf=n>>e;this.codeSize=i-=e;return t};o.prototype.getCode=function(e){for(var t,r=this.str,i=e[0],n=e[1],o=this.codeSize,s=this.codeBuf;o<n&&-1!==(t=r.getByte());){s|=t<<o;o+=8}var c=i[s&(1<<n)-1],l=c>>16,u=65535&c;if(l<1||o<l)throw new a.FormatError("Bad encoding in flate stream");this.codeBuf=s>>l;this.codeSize=o-l;return u};o.prototype.generateHuffmanTable=function(e){var t,r=e.length,a=0;for(t=0;t<r;++t)e[t]>a&&(a=e[t]);for(var i=1<<a,n=new Int32Array(i),o=1,s=0,c=2;o<=a;++o,s<<=1,c<<=1)for(var l=0;l<r;++l)if(e[l]===o){var u=0,h=s;for(t=0;t<o;++t){u=u<<1|1&h;h>>=1}for(t=u;t<i;t+=c)n[t]=o<<16|l;++s}return[n,a]};o.prototype.readBlock=function(){var o,s,c=this.str,l=this.getBits(3);1&l&&(this.eof=!0);if(0!==(l>>=1)){var u,h;if(1===l){u=i;h=n}else{if(2!==l)throw new a.FormatError("Unknown block type in flate stream");var f,d=this.getBits(5)+257,g=this.getBits(5)+1,m=this.getBits(4)+4,p=new Uint8Array(e.length);for(f=0;f<m;++f)p[e[f]]=this.getBits(3);var v=this.generateHuffmanTable(p);s=0;f=0;for(var b,y,w,k=d+g,S=new Uint8Array(k);f<k;){var C=this.getCode(v);if(16===C){b=2;y=3;w=s}else if(17===C){b=3;y=3;w=s=0}else{if(18!==C){S[f++]=s=C;continue}b=7;y=11;w=s=0}for(var x=this.getBits(b)+y;x-- >0;)S[f++]=w}u=this.generateHuffmanTable(S.subarray(0,d));h=this.generateHuffmanTable(S.subarray(d,k))}for(var _=(o=this.buffer)?o.length:0,A=this.bufferLength;;){var P=this.getCode(u);if(P<256){A+1>=_&&(_=(o=this.ensureBuffer(A+1)).length);o[A++]=P}else{if(256===P){this.bufferLength=A;return}var I=(P=t[P-=257])>>16;I>0&&(I=this.getBits(I));s=(65535&P)+I;P=this.getCode(h);(I=(P=r[P])>>16)>0&&(I=this.getBits(I));var O=(65535&P)+I;A+s>=_&&(_=(o=this.ensureBuffer(A+s)).length);for(var T=0;T<s;++T,++A)o[A]=o[A-O]}}}else{var E;if(-1===(E=c.getByte()))throw new a.FormatError("Bad block header in flate stream");var F=E;if(-1===(E=c.getByte()))throw new a.FormatError("Bad block header in flate stream");F|=E<<8;if(-1===(E=c.getByte()))throw new a.FormatError("Bad block header in flate stream");var R=E;if(-1===(E=c.getByte()))throw new a.FormatError("Bad block header in flate stream");if((R|=E<<8)!==(65535&~F)&&(0!==F||0!==R))throw new a.FormatError("Bad uncompressed block length in flate stream");this.codeBuf=0;this.codeSize=0;var B=this.bufferLength;o=this.ensureBuffer(B+F);var D=B+F;this.bufferLength=D;if(0===F)-1===c.peekByte()&&(this.eof=!0);else for(var M=B;M<D;++M){if(-1===(E=c.getByte())){this.eof=!0;break}o[M]=E}}};return o}(),h=function(){function e(e,t,r){if(!(0,i.isDict)(r))return e;var n=this.predictor=r.get("Predictor")||1;if(n<=1)return e;if(2!==n&&(n<10||n>15))throw new a.FormatError("Unsupported predictor: "+n);this.readBlock=2===n?this.readBlockTiff:this.readBlockPng;this.str=e;this.dict=e.dict;var o=this.colors=r.get("Colors")||1,s=this.bits=r.get("BitsPerComponent")||8,l=this.columns=r.get("Columns")||1;this.pixBytes=o*s+7>>3;this.rowBytes=l*o*s+7>>3;c.call(this,t);return this}e.prototype=Object.create(c.prototype);e.prototype.readBlockTiff=function(){var e=this.rowBytes,t=this.bufferLength,r=this.ensureBuffer(t+e),a=this.bits,i=this.colors,n=this.str.getBytes(e);this.eof=!n.length;if(!this.eof){var o,s=0,c=0,l=0,u=0,h=t;if(1===a&&1===i)for(o=0;o<e;++o){var f=n[o]^s;f^=f>>1;f^=f>>2;s=(1&(f^=f>>4))<<7;r[h++]=f}else if(8===a){for(o=0;o<i;++o)r[h++]=n[o];for(;o<e;++o){r[h]=r[h-i]+n[o];h++}}else if(16===a){var d=2*i;for(o=0;o<d;++o)r[h++]=n[o];for(;o<e;o+=2){var g=((255&n[o])<<8)+(255&n[o+1])+((255&r[h-d])<<8)+(255&r[h-d+1]);r[h++]=g>>8&255;r[h++]=255&g}}else{var m=new Uint8Array(i+1),p=(1<<a)-1,v=0,b=t,y=this.columns;for(o=0;o<y;++o)for(var w=0;w<i;++w){if(l<a){s=s<<8|255&n[v++];l+=8}m[w]=m[w]+(s>>l-a)&p;l-=a;c=c<<a|m[w];if((u+=a)>=8){r[b++]=c>>u-8&255;u-=8}}u>0&&(r[b++]=(c<<8-u)+(s&(1<<8-u)-1))}this.bufferLength+=e}};e.prototype.readBlockPng=function(){var e=this.rowBytes,t=this.pixBytes,r=this.str.getByte(),i=this.str.getBytes(e);this.eof=!i.length;if(!this.eof){var n=this.bufferLength,o=this.ensureBuffer(n+e),s=o.subarray(n-e,n);0===s.length&&(s=new Uint8Array(e));var c,l,u,h=n;switch(r){case 0:for(c=0;c<e;++c)o[h++]=i[c];break;case 1:for(c=0;c<t;++c)o[h++]=i[c];for(;c<e;++c){o[h]=o[h-t]+i[c]&255;h++}break;case 2:for(c=0;c<e;++c)o[h++]=s[c]+i[c]&255;break;case 3:for(c=0;c<t;++c)o[h++]=(s[c]>>1)+i[c];for(;c<e;++c){o[h]=(s[c]+o[h-t]>>1)+i[c]&255;h++}break;case 4:for(c=0;c<t;++c){l=s[c];u=i[c];o[h++]=l+u}for(;c<e;++c){l=s[c];var f=s[c-t],d=o[h-t],g=d+l-f,m=g-d;m<0&&(m=-m);var p=g-l;p<0&&(p=-p);var v=g-f;v<0&&(v=-v);u=i[c];o[h++]=m<=p&&m<=v?d+u:p<=v?l+u:f+u}break;default:throw new a.FormatError("Unsupported predictor: "+r)}this.bufferLength+=e}};return e}(),f=function(){function e(e,t,r){this.str=e;this.dict=e.dict;this.decrypt=r;this.nextChunk=null;this.initialized=!1;c.call(this,t)}e.prototype=Object.create(c.prototype);e.prototype.readBlock=function(){var e;if(this.initialized)e=this.nextChunk;else{e=this.str.getBytes(512);this.initialized=!0}if(e&&0!==e.length){this.nextChunk=this.str.getBytes(512);var t=this.nextChunk&&this.nextChunk.length>0;e=(0,this.decrypt)(e,!t);var r,a=this.bufferLength,i=e.length,n=this.ensureBuffer(a+i);for(r=0;r<i;r++)n[a++]=e[r];this.bufferLength=a}else this.eof=!0};return e}(),d=function(){function e(e,t){this.str=e;this.dict=e.dict;this.input=new Uint8Array(5);t&&(t*=.8);c.call(this,t)}e.prototype=Object.create(c.prototype);e.prototype.readBlock=function(){for(var e=this.str,t=e.getByte();(0,a.isSpace)(t);)t=e.getByte();if(-1!==t&&126!==t){var r,i,n=this.bufferLength;if(122===t){r=this.ensureBuffer(n+4);for(i=0;i<4;++i)r[n+i]=0;this.bufferLength+=4}else{var o=this.input;o[0]=t;for(i=1;i<5;++i){t=e.getByte();for(;(0,a.isSpace)(t);)t=e.getByte();o[i]=t;if(-1===t||126===t)break}r=this.ensureBuffer(n+i-1);this.bufferLength+=i-1;if(i<5){for(;i<5;++i)o[i]=117;this.eof=!0}var s=0;for(i=0;i<5;++i)s=85*s+(o[i]-33);for(i=3;i>=0;--i){r[n+i]=255&s;s>>=8}}}else this.eof=!0};return e}(),g=function(){function e(e,t){this.str=e;this.dict=e.dict;this.firstDigit=-1;t&&(t*=.5);c.call(this,t)}e.prototype=Object.create(c.prototype);e.prototype.readBlock=function(){var e=this.str.getBytes(8e3);if(e.length){for(var t=e.length+1>>1,r=this.ensureBuffer(this.bufferLength+t),a=this.bufferLength,i=this.firstDigit,n=0,o=e.length;n<o;n++){var s,c=e[n];if(c>=48&&c<=57)s=15&c;else{if(!(c>=65&&c<=70||c>=97&&c<=102)){if(62===c){this.eof=!0;break}continue}s=9+(15&c)}if(i<0)i=s;else{r[a++]=i<<4|s;i=-1}}if(i>=0&&this.eof){r[a++]=i<<4;i=-1}this.firstDigit=i;this.bufferLength=a}else this.eof=!0};return e}(),m=function(){function e(e,t){this.str=e;this.dict=e.dict;c.call(this,t)}e.prototype=Object.create(c.prototype);e.prototype.readBlock=function(){var e=this.str.getBytes(2);if(!e||e.length<2||128===e[0])this.eof=!0;else{var t,r=this.bufferLength,a=e[0];if(a<128){(t=this.ensureBuffer(r+a+1))[r++]=e[1];if(a>0){var i=this.str.getBytes(a);t.set(i,r);r+=a}}else{a=257-a;var n=e[1];t=this.ensureBuffer(r+a+1);for(var o=0;o<a;o++)t[r++]=n}this.bufferLength=r}};return e}(),p=function(){function e(e,t,r){this.str=e;this.dict=e.dict;this.cachedData=0;this.bitsCached=0;for(var a={earlyChange:r,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(4096),dictionaryLengths:new Uint16Array(4096),dictionaryPrevCodes:new Uint16Array(4096),currentSequence:new Uint8Array(4096),currentSequenceLength:0},i=0;i<256;++i){a.dictionaryValues[i]=i;a.dictionaryLengths[i]=1}this.lzwState=a;c.call(this,t)}e.prototype=Object.create(c.prototype);e.prototype.readBits=function(e){for(var t=this.bitsCached,r=this.cachedData;t<e;){var a=this.str.getByte();if(-1===a){this.eof=!0;return null}r=r<<8|a;t+=8}this.bitsCached=t-=e;this.cachedData=r;this.lastCode=null;return r>>>t&(1<<e)-1};e.prototype.readBlock=function(){var e,t,r,a=1024,i=this.lzwState;if(i){var n=i.earlyChange,o=i.nextCode,s=i.dictionaryValues,c=i.dictionaryLengths,l=i.dictionaryPrevCodes,u=i.codeLength,h=i.prevCode,f=i.currentSequence,d=i.currentSequenceLength,g=0,m=this.bufferLength,p=this.ensureBuffer(this.bufferLength+a);for(e=0;e<512;e++){var v=this.readBits(u),b=d>0;if(v<256){f[0]=v;d=1}else{if(!(v>=258)){if(256===v){u=9;o=258;d=0;continue}this.eof=!0;delete this.lzwState;break}if(v<o)for(t=(d=c[v])-1,r=v;t>=0;t--){f[t]=s[r];r=l[r]}else f[d++]=f[0]}if(b){l[o]=h;c[o]=c[h]+1;s[o]=f[0];u=++o+n&o+n-1?u:0|Math.min(Math.log(o+n)/.6931471805599453+1,12)}h=v;if(a<(g+=d)){do{a+=512}while(a<g);p=this.ensureBuffer(this.bufferLength+a)}for(t=0;t<d;t++)p[m++]=f[t]}i.nextCode=o;i.codeLength=u;i.prevCode=h;i.currentSequenceLength=d;this.bufferLength=m}};return e}(),v=function(){function e(){o.call(this,new Uint8Array(0))}e.prototype=o.prototype;return e}();t.Ascii85Stream=d;t.AsciiHexStream=g;t.DecryptStream=f;t.DecodeStream=c;t.FlateStream=u;t.NullStream=v;t.PredictorStream=h;t.RunLengthStream=m;t.Stream=o;t.StreamsSequenceStream=l;t.StringStream=s;t.LZWStream=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.CCITTFaxStream=void 0;var a=r(138),i=r(142),n=r(140),o=function(){function e(e,t,r){this.str=e;this.dict=e.dict;(0,a.isDict)(r)||(r=a.Dict.empty);var o={next:function(){return e.getByte()}};this.ccittFaxDecoder=new i.CCITTFaxDecoder(o,{K:r.get("K"),EndOfLine:r.get("EndOfLine"),EncodedByteAlign:r.get("EncodedByteAlign"),Columns:r.get("Columns"),Rows:r.get("Rows"),EndOfBlock:r.get("EndOfBlock"),BlackIs1:r.get("BlackIs1")});n.DecodeStream.call(this,t)}e.prototype=Object.create(n.DecodeStream.prototype);e.prototype.readBlock=function(){for(;!this.eof;){var e=this.ccittFaxDecoder.readNextChar();if(-1===e){this.eof=!0;return}this.ensureBuffer(this.bufferLength+1);this.buffer[this.bufferLength++]=e}};return e}();t.CCITTFaxStream=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.CCITTFaxDecoder=void 0;var a=r(2),i=function(){var e=[[-1,-1],[-1,-1],[7,8],[7,7],[6,6],[6,6],[6,5],[6,5],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2]],t=[[-1,-1],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[12,1984],[12,2048],[12,2112],[12,2176],[12,2240],[12,2304],[11,1856],[11,1856],[11,1920],[11,1920],[12,2368],[12,2432],[12,2496],[12,2560]],r=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[8,29],[8,29],[8,30],[8,30],[8,45],[8,45],[8,46],[8,46],[7,22],[7,22],[7,22],[7,22],[7,23],[7,23],[7,23],[7,23],[8,47],[8,47],[8,48],[8,48],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[7,20],[7,20],[7,20],[7,20],[8,33],[8,33],[8,34],[8,34],[8,35],[8,35],[8,36],[8,36],[8,37],[8,37],[8,38],[8,38],[7,19],[7,19],[7,19],[7,19],[8,31],[8,31],[8,32],[8,32],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[8,53],[8,53],[8,54],[8,54],[7,26],[7,26],[7,26],[7,26],[8,39],[8,39],[8,40],[8,40],[8,41],[8,41],[8,42],[8,42],[8,43],[8,43],[8,44],[8,44],[7,21],[7,21],[7,21],[7,21],[7,28],[7,28],[7,28],[7,28],[8,61],[8,61],[8,62],[8,62],[8,63],[8,63],[8,0],[8,0],[8,320],[8,320],[8,384],[8,384],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[7,27],[7,27],[7,27],[7,27],[8,59],[8,59],[8,60],[8,60],[9,1472],[9,1536],[9,1600],[9,1728],[7,18],[7,18],[7,18],[7,18],[7,24],[7,24],[7,24],[7,24],[8,49],[8,49],[8,50],[8,50],[8,51],[8,51],[8,52],[8,52],[7,25],[7,25],[7,25],[7,25],[8,55],[8,55],[8,56],[8,56],[8,57],[8,57],[8,58],[8,58],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[8,448],[8,448],[8,512],[8,512],[9,704],[9,768],[8,640],[8,640],[8,576],[8,576],[9,832],[9,896],[9,960],[9,1024],[9,1088],[9,1152],[9,1216],[9,1280],[9,1344],[9,1408],[7,256],[7,256],[7,256],[7,256],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7]],i=[[-1,-1],[-1,-1],[12,-2],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[11,1792],[11,1792],[12,1984],[12,1984],[12,2048],[12,2048],[12,2112],[12,2112],[12,2176],[12,2176],[12,2240],[12,2240],[12,2304],[12,2304],[11,1856],[11,1856],[11,1856],[11,1856],[11,1920],[11,1920],[11,1920],[11,1920],[12,2368],[12,2368],[12,2432],[12,2432],[12,2496],[12,2496],[12,2560],[12,2560],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[12,52],[12,52],[13,640],[13,704],[13,768],[13,832],[12,55],[12,55],[12,56],[12,56],[13,1280],[13,1344],[13,1408],[13,1472],[12,59],[12,59],[12,60],[12,60],[13,1536],[13,1600],[11,24],[11,24],[11,24],[11,24],[11,25],[11,25],[11,25],[11,25],[13,1664],[13,1728],[12,320],[12,320],[12,384],[12,384],[12,448],[12,448],[13,512],[13,576],[12,53],[12,53],[12,54],[12,54],[13,896],[13,960],[13,1024],[13,1088],[13,1152],[13,1216],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64]],n=[[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[11,23],[11,23],[12,50],[12,51],[12,44],[12,45],[12,46],[12,47],[12,57],[12,58],[12,61],[12,256],[10,16],[10,16],[10,16],[10,16],[10,17],[10,17],[10,17],[10,17],[12,48],[12,49],[12,62],[12,63],[12,30],[12,31],[12,32],[12,33],[12,40],[12,41],[11,22],[11,22],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[12,128],[12,192],[12,26],[12,27],[12,28],[12,29],[11,19],[11,19],[11,20],[11,20],[12,34],[12,35],[12,36],[12,37],[12,38],[12,39],[11,21],[11,21],[12,42],[12,43],[10,0],[10,0],[10,0],[10,0],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12]],o=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[6,9],[6,8],[5,7],[5,7],[4,6],[4,6],[4,6],[4,6],[4,5],[4,5],[4,5],[4,5],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2]];function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||"function"!=typeof e.next)throw new Error('CCITTFaxDecoder - invalid "source" parameter.');this.source=e;this.eof=!1;this.encoding=t.K||0;this.eoline=t.EndOfLine||!1;this.byteAlign=t.EncodedByteAlign||!1;this.columns=t.Columns||1728;this.rows=t.Rows||0;var r=t.EndOfBlock;null!==r&&void 0!==r||(r=!0);this.eoblock=r;this.black=t.BlackIs1||!1;this.codingLine=new Uint32Array(this.columns+1);this.refLine=new Uint32Array(this.columns+2);this.codingLine[0]=this.columns;this.codingPos=0;this.row=0;this.nextLine2D=this.encoding<0;this.inputBits=0;this.inputBuf=0;this.outputBits=0;this.rowsDone=!1;for(var a=void 0;0===(a=this._lookBits(12));)this._eatBits(1);1===a&&this._eatBits(12);if(this.encoding>0){this.nextLine2D=!this._lookBits(1);this._eatBits(1)}}s.prototype={readNextChar:function(){if(this.eof)return-1;var e=this.refLine,t=this.codingLine,r=this.columns,i=void 0,n=void 0,o=void 0,s=void 0;if(0===this.outputBits){this.rowsDone&&(this.eof=!0);if(this.eof)return-1;this.err=!1;var c=void 0,l=void 0,u=void 0;if(this.nextLine2D){for(s=0;t[s]<r;++s)e[s]=t[s];e[s++]=r;e[s]=r;t[0]=0;this.codingPos=0;i=0;n=0;for(;t[this.codingPos]<r;)switch(c=this._getTwoDimCode()){case 0:this._addPixels(e[i+1],n);e[i+1]<r&&(i+=2);break;case 1:c=l=0;if(n){do{c+=u=this._getBlackCode()}while(u>=64);do{l+=u=this._getWhiteCode()}while(u>=64)}else{do{c+=u=this._getWhiteCode()}while(u>=64);do{l+=u=this._getBlackCode()}while(u>=64)}this._addPixels(t[this.codingPos]+c,n);t[this.codingPos]<r&&this._addPixels(t[this.codingPos]+l,1^n);for(;e[i]<=t[this.codingPos]&&e[i]<r;)i+=2;break;case 7:this._addPixels(e[i]+3,n);n^=1;if(t[this.codingPos]<r){++i;for(;e[i]<=t[this.codingPos]&&e[i]<r;)i+=2}break;case 5:this._addPixels(e[i]+2,n);n^=1;if(t[this.codingPos]<r){++i;for(;e[i]<=t[this.codingPos]&&e[i]<r;)i+=2}break;case 3:this._addPixels(e[i]+1,n);n^=1;if(t[this.codingPos]<r){++i;for(;e[i]<=t[this.codingPos]&&e[i]<r;)i+=2}break;case 2:this._addPixels(e[i],n);n^=1;if(t[this.codingPos]<r){++i;for(;e[i]<=t[this.codingPos]&&e[i]<r;)i+=2}break;case 8:this._addPixelsNeg(e[i]-3,n);n^=1;if(t[this.codingPos]<r){i>0?--i:++i;for(;e[i]<=t[this.codingPos]&&e[i]<r;)i+=2}break;case 6:this._addPixelsNeg(e[i]-2,n);n^=1;if(t[this.codingPos]<r){i>0?--i:++i;for(;e[i]<=t[this.codingPos]&&e[i]<r;)i+=2}break;case 4:this._addPixelsNeg(e[i]-1,n);n^=1;if(t[this.codingPos]<r){i>0?--i:++i;for(;e[i]<=t[this.codingPos]&&e[i]<r;)i+=2}break;case-1:this._addPixels(r,0);this.eof=!0;break;default:(0,a.info)("bad 2d code");this._addPixels(r,0);this.err=!0}}else{t[0]=0;this.codingPos=0;n=0;for(;t[this.codingPos]<r;){c=0;if(n)do{c+=u=this._getBlackCode()}while(u>=64);else do{c+=u=this._getWhiteCode()}while(u>=64);this._addPixels(t[this.codingPos]+c,n);n^=1}}var h=!1;this.byteAlign&&(this.inputBits&=-8);if(this.eoblock||this.row!==this.rows-1){c=this._lookBits(12);if(this.eoline)for(;-1!==c&&1!==c;){this._eatBits(1);c=this._lookBits(12)}else for(;0===c;){this._eatBits(1);c=this._lookBits(12)}if(1===c){this._eatBits(12);h=!0}else-1===c&&(this.eof=!0)}else this.rowsDone=!0;if(!this.eof&&this.encoding>0&&!this.rowsDone){this.nextLine2D=!this._lookBits(1);this._eatBits(1)}if(this.eoblock&&h&&this.byteAlign){if(1===(c=this._lookBits(12))){this._eatBits(12);if(this.encoding>0){this._lookBits(1);this._eatBits(1)}if(this.encoding>=0)for(s=0;s<4;++s){1!==(c=this._lookBits(12))&&(0,a.info)("bad rtc code: "+c);this._eatBits(12);if(this.encoding>0){this._lookBits(1);this._eatBits(1)}}this.eof=!0}}else if(this.err&&this.eoline){for(;;){if(-1===(c=this._lookBits(13))){this.eof=!0;return-1}if(c>>1==1)break;this._eatBits(1)}this._eatBits(12);if(this.encoding>0){this._eatBits(1);this.nextLine2D=!(1&c)}}t[0]>0?this.outputBits=t[this.codingPos=0]:this.outputBits=t[this.codingPos=1];this.row++}var f=void 0;if(this.outputBits>=8){f=1&this.codingPos?0:255;this.outputBits-=8;if(0===this.outputBits&&t[this.codingPos]<r){this.codingPos++;this.outputBits=t[this.codingPos]-t[this.codingPos-1]}}else{o=8;f=0;do{if(this.outputBits>o){f<<=o;1&this.codingPos||(f|=255>>8-o);this.outputBits-=o;o=0}else{f<<=this.outputBits;1&this.codingPos||(f|=255>>8-this.outputBits);o-=this.outputBits;this.outputBits=0;if(t[this.codingPos]<r){this.codingPos++;this.outputBits=t[this.codingPos]-t[this.codingPos-1]}else if(o>0){f<<=o;o=0}}}while(o)}this.black&&(f^=255);return f},_addPixels:function(e,t){var r=this.codingLine,i=this.codingPos;if(e>r[i]){if(e>this.columns){(0,a.info)("row is wrong length");this.err=!0;e=this.columns}1&i^t&&++i;r[i]=e}this.codingPos=i},_addPixelsNeg:function(e,t){var r=this.codingLine,i=this.codingPos;if(e>r[i]){if(e>this.columns){(0,a.info)("row is wrong length");this.err=!0;e=this.columns}1&i^t&&++i;r[i]=e}else if(e<r[i]){if(e<0){(0,a.info)("invalid code");this.err=!0;e=0}for(;i>0&&e<r[i-1];)--i;r[i]=e}this.codingPos=i},_findTableCode:function(e,t,r,a){for(var i=a||0,n=e;n<=t;++n){var o=this._lookBits(n);if(-1===o)return[!0,1,!1];n<t&&(o<<=t-n);if(!i||o>=i){var s=r[o-i];if(s[0]===n){this._eatBits(n);return[!0,s[1],!0]}}}return[!1,0,!1]},_getTwoDimCode:function(){var t=0,r=void 0;if(this.eoblock){t=this._lookBits(7);if((r=e[t])&&r[0]>0){this._eatBits(r[0]);return r[1]}}else{var i=this._findTableCode(1,7,e);if(i[0]&&i[2])return i[1]}(0,a.info)("Bad two dim code");return-1},_getWhiteCode:function(){var e=0,i=void 0;if(this.eoblock){if(-1===(e=this._lookBits(12)))return 1;if((i=e>>5==0?t[e]:r[e>>3])[0]>0){this._eatBits(i[0]);return i[1]}}else{var n=this._findTableCode(1,9,r);if(n[0])return n[1];if((n=this._findTableCode(11,12,t))[0])return n[1]}(0,a.info)("bad white code");this._eatBits(1);return 1},_getBlackCode:function(){var e=void 0,t=void 0;if(this.eoblock){if(-1===(e=this._lookBits(13)))return 1;if((t=e>>7==0?i[e]:e>>9==0&&e>>7!=0?n[(e>>1)-64]:o[e>>7])[0]>0){this._eatBits(t[0]);return t[1]}}else{var r=this._findTableCode(2,6,o);if(r[0])return r[1];if((r=this._findTableCode(7,12,n,64))[0])return r[1];if((r=this._findTableCode(10,13,i))[0])return r[1]}(0,a.info)("bad black code");this._eatBits(1);return 1},_lookBits:function(e){for(var t=void 0;this.inputBits<e;){if(-1===(t=this.source.next()))return 0===this.inputBits?-1:this.inputBuf<<e-this.inputBits&65535>>16-e;this.inputBuf=this.inputBuf<<8|t;this.inputBits+=8}return this.inputBuf>>this.inputBits-e&65535>>16-e},_eatBits:function(e){(this.inputBits-=e)<0&&(this.inputBits=0)}};return s}();t.CCITTFaxDecoder=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.Jbig2Stream=void 0;var a=r(138),i=r(140),n=r(144),o=r(2),s=function(){function e(e,t,r,a){this.stream=e;this.maybeLength=t;this.dict=r;this.params=a;i.DecodeStream.call(this,t)}e.prototype=Object.create(i.DecodeStream.prototype);Object.defineProperty(e.prototype,"bytes",{get:function(){return(0,o.shadow)(this,"bytes",this.stream.getBytes(this.maybeLength))},configurable:!0});e.prototype.ensureBuffer=function(e){};e.prototype.readBlock=function(){if(!this.eof){var e=new n.Jbig2Image,t=[];if((0,a.isDict)(this.params)){var r=this.params.get("JBIG2Globals");if((0,a.isStream)(r)){var i=r.getBytes();t.push({data:i,start:0,end:i.length})}}t.push({data:this.bytes,start:0,end:this.bytes.length});for(var o=e.parseChunks(t),s=o.length,c=0;c<s;c++)o[c]^=255;this.buffer=o;this.bufferLength=s;this.eof=!0}};return e}();t.Jbig2Stream=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.Jbig2Image=void 0;var a=r(2),i=r(145),n=r(142),o=function(){function e(e){this.message="JBIG2 error: "+e}e.prototype=new Error;e.prototype.name="Jbig2Error";e.constructor=e;return e}(),s=function(){function e(){}e.prototype={getContexts:function(e){return e in this?this[e]:this[e]=new Int8Array(65536)}};function t(e,t,r){this.data=e;this.start=t;this.end=r}t.prototype={get decoder(){var e=new i.ArithmeticDecoder(this.data,this.start,this.end);return(0,a.shadow)(this,"decoder",e)},get contextCache(){var t=new e;return(0,a.shadow)(this,"contextCache",t)}};function r(e,t,r){var a=e.getContexts(t),i=1;function n(e){for(var t=0,n=0;n<e;n++){var o=r.readBit(a,i);i=i<256?i<<1|o:511&(i<<1|o)|256;t=t<<1|o}return t>>>0}var o=n(1),s=n(1)?n(1)?n(1)?n(1)?n(1)?n(32)+4436:n(12)+340:n(8)+84:n(6)+20:n(4)+4:n(2);return 0===o?s:s>0?-s:null}function s(e,t,r){for(var a=e.getContexts("IAID"),i=1,n=0;n<r;n++){i=i<<1|t.readBit(a,i)}return r<31?i&(1<<r)-1:2147483647&i}var c=["SymbolDictionary",null,null,null,"IntermediateTextRegion",null,"ImmediateTextRegion","ImmediateLosslessTextRegion",null,null,null,null,null,null,null,null,"PatternDictionary",null,null,null,"IntermediateHalftoneRegion",null,"ImmediateHalftoneRegion","ImmediateLosslessHalftoneRegion",null,null,null,null,null,null,null,null,null,null,null,null,"IntermediateGenericRegion",null,"ImmediateGenericRegion","ImmediateLosslessGenericRegion","IntermediateGenericRefinementRegion",null,"ImmediateGenericRefinementRegion","ImmediateLosslessGenericRefinementRegion",null,null,null,null,"PageInformation","EndOfPage","EndOfStripe","EndOfFile","Profiles","Tables",null,null,null,null,null,null,null,null,"Extension"],l=[[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:2,y:-1},{x:-4,y:0},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}],[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:2,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:2,y:-1},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}],[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-2,y:0},{x:-1,y:0}],[{x:-3,y:-1},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-4,y:0},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}]],u=[{coding:[{x:0,y:-1},{x:1,y:-1},{x:-1,y:0}],reference:[{x:0,y:-1},{x:1,y:-1},{x:-1,y:0},{x:0,y:0},{x:1,y:0},{x:-1,y:1},{x:0,y:1},{x:1,y:1}]},{coding:[{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-1,y:0}],reference:[{x:0,y:-1},{x:-1,y:0},{x:0,y:0},{x:1,y:0},{x:0,y:1},{x:1,y:1}]}],h=[39717,1941,229,405],f=[32,8];function d(e,t,r,a,i,n,o,s){if(e){return E(new I(s.data,s.start,s.end),t,r,!1)}if(0===a&&!n&&!i&&4===o.length&&3===o[0].x&&-1===o[0].y&&-3===o[1].x&&-1===o[1].y&&2===o[2].x&&-2===o[2].y&&-2===o[3].x&&-2===o[3].y)return function(e,t,r){var a,i,n,o,s,c,l,u=r.decoder,h=r.contextCache.getContexts("GB"),f=[];for(i=0;i<t;i++){s=f[i]=new Uint8Array(e);c=i<1?s:f[i-1];a=(l=i<2?s:f[i-2])[0]<<13|l[1]<<12|l[2]<<11|c[0]<<7|c[1]<<6|c[2]<<5|c[3]<<4;for(n=0;n<e;n++){s[n]=o=u.readBit(h,a);a=(31735&a)<<1|(n+3<e?l[n+3]<<11:0)|(n+4<e?c[n+4]<<4:0)|o}}return f}(t,r,s);var c=!!n,u=l[a].concat(o);u.sort(function(e,t){return e.y-t.y||e.x-t.x});var f,d,g=u.length,m=new Int8Array(g),p=new Int8Array(g),v=[],b=0,y=0,w=0,k=0;for(d=0;d<g;d++){m[d]=u[d].x;p[d]=u[d].y;y=Math.min(y,u[d].x);w=Math.max(w,u[d].x);k=Math.min(k,u[d].y);d<g-1&&u[d].y===u[d+1].y&&u[d].x===u[d+1].x-1?b|=1<<g-1-d:v.push(d)}var S=v.length,C=new Int8Array(S),x=new Int8Array(S),_=new Uint16Array(S);for(f=0;f<S;f++){d=v[f];C[f]=u[d].x;x[f]=u[d].y;_[f]=1<<g-1-d}for(var A,P,O,T,F,R=-y,B=-k,D=t-w,M=h[a],L=new Uint8Array(t),N=[],U=s.decoder,q=s.contextCache.getContexts("GB"),j=0,z=0,H=0;H<r;H++){if(i){if(j^=U.readBit(q,M)){N.push(L);continue}}L=new Uint8Array(L);N.push(L);for(A=0;A<t;A++)if(c&&n[H][A])L[A]=0;else{if(A>=R&&A<D&&H>=B){z=z<<1&b;for(d=0;d<S;d++){P=H+x[d];O=A+C[d];(T=N[P][O])&&(z|=T=_[d])}}else{z=0;F=g-1;for(d=0;d<g;d++,F--)(O=A+m[d])>=0&&O<t&&(P=H+p[d])>=0&&(T=N[P][O])&&(z|=T<<F)}var G=U.readBit(q,z);L[A]=G}}return N}function g(e,t,r,a,i,n,s,c,l){var h=u[r].coding;0===r&&(h=h.concat([c[0]]));var d,g=h.length,m=new Int32Array(g),p=new Int32Array(g);for(d=0;d<g;d++){m[d]=h[d].x;p[d]=h[d].y}var v=u[r].reference;0===r&&(v=v.concat([c[1]]));var b=v.length,y=new Int32Array(b),w=new Int32Array(b);for(d=0;d<b;d++){y[d]=v[d].x;w[d]=v[d].y}for(var k=a[0].length,S=a.length,C=f[r],x=[],_=l.decoder,A=l.contextCache.getContexts("GR"),P=0,I=0;I<t;I++){if(s){if(P^=_.readBit(A,C))throw new o("prediction is not supported")}var O=new Uint8Array(e);x.push(O);for(var T=0;T<e;T++){var E,F,R=0;for(d=0;d<g;d++){E=I+p[d];F=T+m[d];E<0||F<0||F>=e?R<<=1:R=R<<1|x[E][F]}for(d=0;d<b;d++){E=I+w[d]-n;F=T+y[d]-i;E<0||E>=S||F<0||F>=k?R<<=1:R=R<<1|a[E][F]}var B=_.readBit(A,R);O[T]=B}}return x}function m(e,t,a,i,n,c,l,u,h,f,d,m,p,v,b,y,w,k,S){if(e&&t)throw new o("refinement with Huffman is not supported");var C,x,_=[];for(C=0;C<i;C++){x=new Uint8Array(a);if(n)for(var A=0;A<a;A++)x[A]=n;_.push(x)}var P=w.decoder,I=w.contextCache,O=e?-v.tableDeltaT.decode(S):-r(I,"IADT",P),T=0;C=0;for(;C<c;){O+=e?v.tableDeltaT.decode(S):r(I,"IADT",P);for(var E=T+=e?v.tableFirstS.decode(S):r(I,"IAFS",P);;){var F=0;l>1&&(F=e?S.readBits(k):r(I,"IAIT",P));var R=l*O+F,B=e?v.symbolIDTable.decode(S):s(I,P,h),D=t&&(e?S.readBit():r(I,"IARI",P)),M=u[B],L=M[0].length,N=M.length;if(D){var U=r(I,"IARDW",P),q=r(I,"IARDH",P);M=g(L+=U,N+=q,b,M,(U>>1)+r(I,"IARDX",P),(q>>1)+r(I,"IARDY",P),!1,y,w)}var j,z,H,G=R-(1&m?0:N-1),W=E-(2&m?L-1:0);if(f){for(j=0;j<N;j++)if(x=_[W+j]){H=M[j];var X=Math.min(a-G,L);switch(p){case 0:for(z=0;z<X;z++)x[G+z]|=H[z];break;case 2:for(z=0;z<X;z++)x[G+z]^=H[z];break;default:throw new o("operator "+p+" is not supported")}}E+=N-1}else{for(z=0;z<N;z++)if(x=_[G+z]){H=M[z];switch(p){case 0:for(j=0;j<L;j++)x[W+j]|=H[j];break;case 2:for(j=0;j<L;j++)x[W+j]^=H[j];break;default:throw new o("operator "+p+" is not supported")}}E+=L-1}C++;var V=e?v.tableDeltaS.decode(S):r(I,"IADS",P);if(null===V)break;E+=V+d}}return _}function p(e,t){var r={};r.number=(0,a.readUint32)(e,t);var i=e[t+4],n=63&i;if(!c[n])throw new o("invalid segment type: "+n);r.type=n;r.typeName=c[n];r.deferredNonRetain=!!(128&i);var s=!!(64&i),l=e[t+5],u=l>>5&7,h=[31&l],f=t+6;if(7===l){u=536870911&(0,a.readUint32)(e,f-1);f+=3;var d=u+7>>3;h[0]=e[f++];for(;--d>0;)h.push(e[f++])}else if(5===l||6===l)throw new o("invalid referred-to flags");r.retainBits=h;var g,m,p=r.number<=256?1:r.number<=65536?2:4,v=[];for(g=0;g<u;g++){var w=1===p?e[f]:2===p?(0,a.readUint16)(e,f):(0,a.readUint32)(e,f);v.push(w);f+=p}r.referredTo=v;if(s){r.pageAssociation=(0,a.readUint32)(e,f);f+=4}else r.pageAssociation=e[f++];r.length=(0,a.readUint32)(e,f);f+=4;if(4294967295===r.length){if(38!==n)throw new o("invalid unknown segment length");var k=b(e,f),S=!!(1&e[f+y]),C=new Uint8Array(6);if(!S){C[0]=255;C[1]=172}C[2]=k.height>>>24&255;C[3]=k.height>>16&255;C[4]=k.height>>8&255;C[5]=255&k.height;for(g=f,m=e.length;g<m;g++){for(var x=0;x<6&&C[x]===e[g+x];)x++;if(6===x){r.length=g+6;break}}if(4294967295===r.length)throw new o("segment end was not found")}r.headerEnd=f;return r}function v(e,t,r,a){for(var i=[],n=r;n<a;){var o=p(t,n);n=o.headerEnd;var s={header:o,data:t};if(!e.randomAccess){s.start=n;n+=o.length;s.end=n}i.push(s);if(51===o.type)break}if(e.randomAccess)for(var c=0,l=i.length;c<l;c++){i[c].start=n;n+=i[c].header.length;i[c].end=n}return i}function b(e,t){return{width:(0,a.readUint32)(e,t),height:(0,a.readUint32)(e,t+4),x:(0,a.readUint32)(e,t+8),y:(0,a.readUint32)(e,t+12),combinationOperator:7&e[t+16]}}var y=17;function w(e,t){var r,i,n,s,c=e.header,l=e.data,u=e.start,h=e.end;switch(c.type){case 0:var f={},d=(0,a.readUint16)(l,u);f.huffman=!!(1&d);f.refinement=!!(2&d);f.huffmanDHSelector=d>>2&3;f.huffmanDWSelector=d>>4&3;f.bitmapSizeSelector=d>>6&1;f.aggregationInstancesSelector=d>>7&1;f.bitmapCodingContextUsed=!!(256&d);f.bitmapCodingContextRetained=!!(512&d);f.template=d>>10&3;f.refinementTemplate=d>>12&1;u+=2;if(!f.huffman){s=0===f.template?4:1;i=[];for(n=0;n<s;n++){i.push({x:(0,a.readInt8)(l,u),y:(0,a.readInt8)(l,u+1)});u+=2}f.at=i}if(f.refinement&&!f.refinementTemplate){i=[];for(n=0;n<2;n++){i.push({x:(0,a.readInt8)(l,u),y:(0,a.readInt8)(l,u+1)});u+=2}f.refinementAt=i}f.numberOfExportedSymbols=(0,a.readUint32)(l,u);u+=4;f.numberOfNewSymbols=(0,a.readUint32)(l,u);u+=4;r=[f,c.number,c.referredTo,l,u,h];break;case 6:case 7:var g={};g.info=b(l,u);u+=y;var m=(0,a.readUint16)(l,u);u+=2;g.huffman=!!(1&m);g.refinement=!!(2&m);g.logStripSize=m>>2&3;g.stripSize=1<<g.logStripSize;g.referenceCorner=m>>4&3;g.transposed=!!(64&m);g.combinationOperator=m>>7&3;g.defaultPixelValue=m>>9&1;g.dsOffset=m<<17>>27;g.refinementTemplate=m>>15&1;if(g.huffman){var p=(0,a.readUint16)(l,u);u+=2;g.huffmanFS=3&p;g.huffmanDS=p>>2&3;g.huffmanDT=p>>4&3;g.huffmanRefinementDW=p>>6&3;g.huffmanRefinementDH=p>>8&3;g.huffmanRefinementDX=p>>10&3;g.huffmanRefinementDY=p>>12&3;g.huffmanRefinementSizeSelector=!!(16384&p)}if(g.refinement&&!g.refinementTemplate){i=[];for(n=0;n<2;n++){i.push({x:(0,a.readInt8)(l,u),y:(0,a.readInt8)(l,u+1)});u+=2}g.refinementAt=i}g.numberOfSymbolInstances=(0,a.readUint32)(l,u);u+=4;r=[g,c.referredTo,l,u,h];break;case 16:var v={},w=l[u++];v.mmr=!!(1&w);v.template=w>>1&3;v.patternWidth=l[u++];v.patternHeight=l[u++];v.maxPatternIndex=(0,a.readUint32)(l,u);u+=4;r=[v,c.number,l,u,h];break;case 22:case 23:var k={};k.info=b(l,u);u+=y;var S=l[u++];k.mmr=!!(1&S);k.template=S>>1&3;k.enableSkip=!!(8&S);k.combinationOperator=S>>4&7;k.defaultPixelValue=S>>7&1;k.gridWidth=(0,a.readUint32)(l,u);u+=4;k.gridHeight=(0,a.readUint32)(l,u);u+=4;k.gridOffsetX=4294967295&(0,a.readUint32)(l,u);u+=4;k.gridOffsetY=4294967295&(0,a.readUint32)(l,u);u+=4;k.gridVectorX=(0,a.readUint16)(l,u);u+=2;k.gridVectorY=(0,a.readUint16)(l,u);u+=2;r=[k,c.referredTo,l,u,h];break;case 38:case 39:var C={};C.info=b(l,u);u+=y;var x=l[u++];C.mmr=!!(1&x);C.template=x>>1&3;C.prediction=!!(8&x);if(!C.mmr){s=0===C.template?4:1;i=[];for(n=0;n<s;n++){i.push({x:(0,a.readInt8)(l,u),y:(0,a.readInt8)(l,u+1)});u+=2}C.at=i}r=[C,l,u,h];break;case 48:var _={width:(0,a.readUint32)(l,u),height:(0,a.readUint32)(l,u+4),resolutionX:(0,a.readUint32)(l,u+8),resolutionY:(0,a.readUint32)(l,u+12)};4294967295===_.height&&delete _.height;var A=l[u+16];(0,a.readUint16)(l,u+17);_.lossless=!!(1&A);_.refinement=!!(2&A);_.defaultPixelValue=A>>2&1;_.combinationOperator=A>>3&3;_.requiresBuffer=!!(32&A);_.combinationOperatorOverride=!!(64&A);r=[_];break;case 49:case 50:case 51:break;case 53:r=[c.number,l,u,h];break;case 62:break;default:throw new o("segment type "+c.typeName+"("+c.type+") is not implemented")}var P="on"+c.typeName;P in t&&t[P].apply(t,r)}function k(e,t){for(var r=0,a=e.length;r<a;r++)w(e[r],t)}function S(){}S.prototype={onPageInformation:function(e){this.currentPageInfo=e;var t=e.width+7>>3,r=new Uint8ClampedArray(t*e.height);if(e.defaultPixelValue)for(var a=0,i=r.length;a<i;a++)r[a]=255;this.buffer=r},drawBitmap:function(e,t){var r,a,i,n,s=this.currentPageInfo,c=e.width,l=e.height,u=s.width+7>>3,h=s.combinationOperatorOverride?e.combinationOperator:s.combinationOperator,f=this.buffer,d=128>>(7&e.x),g=e.y*u+(e.x>>3);switch(h){case 0:for(r=0;r<l;r++){i=d;n=g;for(a=0;a<c;a++){t[r][a]&&(f[n]|=i);if(!(i>>=1)){i=128;n++}}g+=u}break;case 2:for(r=0;r<l;r++){i=d;n=g;for(a=0;a<c;a++){t[r][a]&&(f[n]^=i);if(!(i>>=1)){i=128;n++}}g+=u}break;default:throw new o("operator "+h+" is not supported")}},onImmediateGenericRegion:function(e,r,a,i){var n=e.info,o=new t(r,a,i),s=d(e.mmr,n.width,n.height,e.template,e.prediction,null,e.at,o);this.drawBitmap(n,s)},onImmediateLosslessGenericRegion:function(){this.onImmediateGenericRegion.apply(this,arguments)},onSymbolDictionary:function(e,i,n,c,l,u){var h=void 0,f=void 0;if(e.huffman){h=function(e,t,r){var a=0,i=void 0,n=void 0;switch(e.huffmanDHSelector){case 0:case 1:i=P(e.huffmanDHSelector+4);break;case 3:i=O(a,t,r);a++;break;default:throw new o("invalid Huffman DH selector")}switch(e.huffmanDWSelector){case 0:case 1:n=P(e.huffmanDWSelector+2);break;case 3:n=O(a,t,r);a++;break;default:throw new o("invalid Huffman DW selector")}var s=void 0,c=void 0;if(e.bitmapSizeSelector){s=O(a,t,r);a++}else s=P(1);c=e.aggregationInstancesSelector?O(a,t,r):P(1);return{tableDeltaHeight:i,tableDeltaWidth:n,tableBitmapSize:s,tableAggregateInstances:c}}(e,n,this.customTables);f=new I(c,l,u)}var p=this.symbols;p||(this.symbols=p={});for(var v=[],b=0,y=n.length;b<y;b++){var w=p[n[b]];w&&(v=v.concat(w))}var k=new t(c,l,u);p[i]=function(e,t,i,n,c,l,u,h,f,p,v,b){if(e&&t)throw new o("symbol refinement with Huffman is not supported");var y=[],w=0,k=(0,a.log2)(i.length+n),S=v.decoder,C=v.contextCache,x=void 0,_=void 0;if(e){x=P(1);_=[];k=Math.max(k,1)}for(;y.length<n;){w+=e?l.tableDeltaHeight.decode(b):r(C,"IADH",S);for(var A=0,I=0,O=e?_.length:0;;){var F,R=e?l.tableDeltaWidth.decode(b):r(C,"IADW",S);if(null===R)break;I+=A+=R;if(t){var B=r(C,"IAAI",S);if(B>1)F=m(e,t,A,w,0,B,1,i.concat(y),k,0,0,1,0,l,f,p,v,0,b);else{var D=s(C,S,k),M=r(C,"IARDX",S),L=r(C,"IARDY",S);F=g(A,w,f,D<i.length?i[D]:y[D-i.length],M,L,!1,p,v)}y.push(F)}else if(e)_.push(A);else{F=d(!1,A,w,u,!1,null,h,v);y.push(F)}}if(e&&!t){var N=l.tableBitmapSize.decode(b);b.byteAlign();var U=void 0;if(0===N)U=T(b,I,w);else{var q=b.end,j=b.position+N;b.end=j;U=E(b,I,w,!1);b.end=q;b.position=j}var z=_.length;if(O===z-1)y.push(U);else{var H=void 0,G=void 0,W=0,X=void 0,V=void 0;for(H=O;H<z;H++){X=W+_[H];V=[];for(G=0;G<w;G++)V.push(U[G].subarray(W,X));y.push(V);W=X}}}}for(var K=[],Y=[],J=!1,Z=i.length+n;Y.length<Z;){for(var Q=e?x.decode(b):r(C,"IAEX",S);Q--;)Y.push(J);J=!J}for(var $=0,ee=i.length;$<ee;$++)Y[$]&&K.push(i[$]);for(var te=0;te<n;$++,te++)Y[$]&&K.push(y[te]);return K}(e.huffman,e.refinement,v,e.numberOfNewSymbols,e.numberOfExportedSymbols,h,e.template,e.at,e.refinementTemplate,e.refinementAt,k,f)},onImmediateTextRegion:function(e,r,i,n,s){for(var c=e.info,l=void 0,u=void 0,h=this.symbols,f=[],d=0,g=r.length;d<g;d++){var p=h[r[d]];p&&(f=f.concat(p))}var v=(0,a.log2)(f.length);if(e.huffman){u=new I(i,n,s);l=function(e,t,r,a,i){var n=[],s=void 0,c=void 0;for(s=0;s<=34;s++){c=i.readBits(4);n.push(new C([s,c,0,0]))}var l=new _(n,!1);n.length=0;for(s=0;s<a;)if((c=l.decode(i))>=32){var u=void 0,h=void 0,f=void 0;switch(c){case 32:if(0===s)throw new o("no previous value in symbol ID table");h=i.readBits(2)+3;u=n[s-1].prefixLength;break;case 33:h=i.readBits(3)+3;u=0;break;case 34:h=i.readBits(7)+11;u=0;break;default:throw new o("invalid code length in symbol ID table")}for(f=0;f<h;f++){n.push(new C([s,u,0,0]));s++}}else{n.push(new C([s,c,0,0]));s++}i.byteAlign();var d=new _(n,!1),g=0,m=void 0,p=void 0,v=void 0;switch(e.huffmanFS){case 0:case 1:m=P(e.huffmanFS+6);break;case 3:m=O(g,t,r);g++;break;default:throw new o("invalid Huffman FS selector")}switch(e.huffmanDS){case 0:case 1:case 2:p=P(e.huffmanDS+8);break;case 3:p=O(g,t,r);g++;break;default:throw new o("invalid Huffman DS selector")}switch(e.huffmanDT){case 0:case 1:case 2:v=P(e.huffmanDT+11);break;case 3:v=O(g,t,r);g++;break;default:throw new o("invalid Huffman DT selector")}if(e.refinement)throw new o("refinement with Huffman is not supported");return{symbolIDTable:d,tableFirstS:m,tableDeltaS:p,tableDeltaT:v}}(e,r,this.customTables,f.length,u)}var b=new t(i,n,s),y=m(e.huffman,e.refinement,c.width,c.height,e.defaultPixelValue,e.numberOfSymbolInstances,e.stripSize,f,v,e.transposed,e.dsOffset,e.referenceCorner,e.combinationOperator,l,e.refinementTemplate,e.refinementAt,b,e.logStripSize,u);this.drawBitmap(c,y)},onImmediateLosslessTextRegion:function(){this.onImmediateTextRegion.apply(this,arguments)},onPatternDictionary:function(e,r,a,i,n){var o=this.patterns;o||(this.patterns=o={});var s=new t(a,i,n);o[r]=function(e,t,r,a,i,n){var o=[];if(!e){o.push({x:-t,y:0});if(0===i){o.push({x:-3,y:-1});o.push({x:2,y:-2});o.push({x:-2,y:-2})}}for(var s=d(e,(a+1)*t,r,i,!1,null,o,n),c=[],l=0,u=void 0,h=void 0,f=void 0,g=void 0;l<=a;){u=[];f=(h=t*l)+t;for(g=0;g<r;g++)u.push(s[g].subarray(h,f));c.push(u);l++}return c}(e.mmr,e.patternWidth,e.patternHeight,e.maxPatternIndex,e.template,s)},onImmediateHalftoneRegion:function(e,r,i,n,s){var c=this.patterns[r[0]],l=e.info,u=new t(i,n,s),h=function(e,t,r,i,n,s,c,l,u,h,f,g,m,p,v){if(c)throw new o("skip is not supported");if(0!==l)throw new o("operator "+l+" is not supported in halftone region");var b=[],y=void 0,w=void 0,k=void 0;for(y=0;y<n;y++){k=new Uint8Array(i);if(s)for(w=0;w<i;w++)k[w]=s;b.push(k)}var S=t.length,C=t[0],x=C[0].length,_=C.length,A=(0,a.log2)(S),P=[];if(!e){P.push({x:r<=1?3:2,y:-1});if(0===r){P.push({x:-3,y:-1});P.push({x:2,y:-2});P.push({x:-2,y:-2})}}var O=[],T=void 0,F=void 0;e&&(T=new I(v.data,v.start,v.end));for(y=A-1;y>=0;y--){F=e?E(T,u,h,!0):d(!1,u,h,r,!1,null,P,v);O[y]=F}var R=void 0,B=void 0,D=void 0,M=void 0,L=void 0,N=void 0,U=void 0,q=void 0,j=void 0;for(R=0;R<h;R++)for(B=0;B<u;B++){D=0;M=0;for(w=A-1;w>=0;w--)M|=(D=O[w][R][B]^D)<<w;L=t[M];U=g+R*m-B*p>>8;if((N=f+R*p+B*m>>8)>=0&&N+x<=i&&U>=0&&U+_<=n)for(y=0;y<_;y++){j=b[U+y];q=L[y];for(w=0;w<x;w++)j[N+w]|=q[w]}else{var z=void 0,H=void 0;for(y=0;y<_;y++)if(!((H=U+y)<0||H>=n)){j=b[H];q=L[y];for(w=0;w<x;w++)(z=N+w)>=0&&z<i&&(j[z]|=q[w])}}}return b}(e.mmr,c,e.template,l.width,l.height,e.defaultPixelValue,e.enableSkip,e.combinationOperator,e.gridWidth,e.gridHeight,e.gridOffsetX,e.gridOffsetY,e.gridVectorX,e.gridVectorY,u);this.drawBitmap(l,h)},onImmediateLosslessHalftoneRegion:function(){this.onImmediateHalftoneRegion.apply(this,arguments)},onTables:function(e,t,r,i){var n=this.customTables;n||(this.customTables=n={});n[e]=function(e,t,r){var i=e[t],n=4294967295&(0,a.readUint32)(e,t+1),o=4294967295&(0,a.readUint32)(e,t+5),s=new I(e,t+9,r),c=1+(i>>1&7),l=1+(i>>4&7),u=[],h=void 0,f=void 0,d=n;do{h=s.readBits(c);f=s.readBits(l);u.push(new C([d,h,f,0]));d+=1<<f}while(d<o);h=s.readBits(c);u.push(new C([n-1,h,32,0,"lower"]));h=s.readBits(c);u.push(new C([o,h,32,0]));if(1&i){h=s.readBits(c);u.push(new C([h,0]))}return new _(u,!1)}(t,r,i)}};function C(e){if(2===e.length){this.isOOB=!0;this.rangeLow=0;this.prefixLength=e[0];this.rangeLength=0;this.prefixCode=e[1];this.isLowerRange=!1}else{this.isOOB=!1;this.rangeLow=e[0];this.prefixLength=e[1];this.rangeLength=e[2];this.prefixCode=e[3];this.isLowerRange="lower"===e[4]}}function x(e){this.children=[];if(e){this.isLeaf=!0;this.rangeLength=e.rangeLength;this.rangeLow=e.rangeLow;this.isLowerRange=e.isLowerRange;this.isOOB=e.isOOB}else this.isLeaf=!1}x.prototype={buildTree:function(e,t){var r=e.prefixCode>>t&1;if(t<=0)this.children[r]=new x(e);else{var a=this.children[r];a||(this.children[r]=a=new x(null));a.buildTree(e,t-1)}},decodeNode:function(e){if(this.isLeaf){if(this.isOOB)return null;var t=e.readBits(this.rangeLength);return this.rangeLow+(this.isLowerRange?-t:t)}var r=this.children[e.readBit()];if(!r)throw new o("invalid Huffman data");return r.decodeNode(e)}};function _(e,t){t||this.assignPrefixCodes(e);this.rootNode=new x(null);var r=void 0,a=e.length,i=void 0;for(r=0;r<a;r++)(i=e[r]).prefixLength>0&&this.rootNode.buildTree(i,i.prefixLength-1)}_.prototype={decode:function(e){return this.rootNode.decodeNode(e)},assignPrefixCodes:function(e){var t=e.length,r=0,a=void 0;for(a=0;a<t;a++)r=Math.max(r,e[a].prefixLength);var i=new Uint32Array(r+1);for(a=0;a<t;a++)i[e[a].prefixLength]++;var n=1,o=0,s=void 0,c=void 0,l=void 0;i[0]=0;for(;n<=r;){s=o=o+i[n-1]<<1;c=0;for(;c<t;){if((l=e[c]).prefixLength===n){l.prefixCode=s;s++}c++}n++}}};var A={};function P(e){var t=A[e];if(t)return t;var r=void 0;switch(e){case 1:r=[[0,1,4,0],[16,2,8,2],[272,3,16,6],[65808,3,32,7]];break;case 2:r=[[0,1,0,0],[1,2,0,2],[2,3,0,6],[3,4,3,14],[11,5,6,30],[75,6,32,62],[6,63]];break;case 3:r=[[-256,8,8,254],[0,1,0,0],[1,2,0,2],[2,3,0,6],[3,4,3,14],[11,5,6,30],[-257,8,32,255,"lower"],[75,7,32,126],[6,62]];break;case 4:r=[[1,1,0,0],[2,2,0,2],[3,3,0,6],[4,4,3,14],[12,5,6,30],[76,5,32,31]];break;case 5:r=[[-255,7,8,126],[1,1,0,0],[2,2,0,2],[3,3,0,6],[4,4,3,14],[12,5,6,30],[-256,7,32,127,"lower"],[76,6,32,62]];break;case 6:r=[[-2048,5,10,28],[-1024,4,9,8],[-512,4,8,9],[-256,4,7,10],[-128,5,6,29],[-64,5,5,30],[-32,4,5,11],[0,2,7,0],[128,3,7,2],[256,3,8,3],[512,4,9,12],[1024,4,10,13],[-2049,6,32,62,"lower"],[2048,6,32,63]];break;case 7:r=[[-1024,4,9,8],[-512,3,8,0],[-256,4,7,9],[-128,5,6,26],[-64,5,5,27],[-32,4,5,10],[0,4,5,11],[32,5,5,28],[64,5,6,29],[128,4,7,12],[256,3,8,1],[512,3,9,2],[1024,3,10,3],[-1025,5,32,30,"lower"],[2048,5,32,31]];break;case 8:r=[[-15,8,3,252],[-7,9,1,508],[-5,8,1,253],[-3,9,0,509],[-2,7,0,124],[-1,4,0,10],[0,2,1,0],[2,5,0,26],[3,6,0,58],[4,3,4,4],[20,6,1,59],[22,4,4,11],[38,4,5,12],[70,5,6,27],[134,5,7,28],[262,6,7,60],[390,7,8,125],[646,6,10,61],[-16,9,32,510,"lower"],[1670,9,32,511],[2,1]];break;case 9:r=[[-31,8,4,252],[-15,9,2,508],[-11,8,2,253],[-7,9,1,509],[-5,7,1,124],[-3,4,1,10],[-1,3,1,2],[1,3,1,3],[3,5,1,26],[5,6,1,58],[7,3,5,4],[39,6,2,59],[43,4,5,11],[75,4,6,12],[139,5,7,27],[267,5,8,28],[523,6,8,60],[779,7,9,125],[1291,6,11,61],[-32,9,32,510,"lower"],[3339,9,32,511],[2,0]];break;case 10:r=[[-21,7,4,122],[-5,8,0,252],[-4,7,0,123],[-3,5,0,24],[-2,2,2,0],[2,5,0,25],[3,6,0,54],[4,7,0,124],[5,8,0,253],[6,2,6,1],[70,5,5,26],[102,6,5,55],[134,6,6,56],[198,6,7,57],[326,6,8,58],[582,6,9,59],[1094,6,10,60],[2118,7,11,125],[-22,8,32,254,"lower"],[4166,8,32,255],[2,2]];break;case 11:r=[[1,1,0,0],[2,2,1,2],[4,4,0,12],[5,4,1,13],[7,5,1,28],[9,5,2,29],[13,6,2,60],[17,7,2,122],[21,7,3,123],[29,7,4,124],[45,7,5,125],[77,7,6,126],[141,7,32,127]];break;case 12:r=[[1,1,0,0],[2,2,0,2],[3,3,1,6],[5,5,0,28],[6,5,1,29],[8,6,1,60],[10,7,0,122],[11,7,1,123],[13,7,2,124],[17,7,3,125],[25,7,4,126],[41,8,5,254],[73,8,32,255]];break;case 13:r=[[1,1,0,0],[2,3,0,4],[3,4,0,12],[4,5,0,28],[5,4,1,13],[7,3,3,5],[15,6,1,58],[17,6,2,59],[21,6,3,60],[29,6,4,61],[45,6,5,62],[77,7,6,126],[141,7,32,127]];break;case 14:r=[[-2,3,0,4],[-1,3,0,5],[0,1,0,0],[1,3,0,6],[2,3,0,7]];break;case 15:r=[[-24,7,4,124],[-8,6,2,60],[-4,5,1,28],[-2,4,0,12],[-1,3,0,4],[0,1,0,0],[1,3,0,5],[2,4,0,13],[3,5,1,29],[5,6,2,61],[9,7,4,125],[-25,7,32,126,"lower"],[25,7,32,127]];break;default:throw new o("standard table B."+e+" does not exist")}var a=r.length,i=void 0;for(i=0;i<a;i++)r[i]=new C(r[i]);t=new _(r,!0);A[e]=t;return t}function I(e,t,r){this.data=e;this.start=t;this.end=r;this.position=t;this.shift=-1;this.currentByte=0}I.prototype={readBit:function(){if(this.shift<0){if(this.position>=this.end)throw new o("end of data while reading bit");this.currentByte=this.data[this.position++];this.shift=7}var e=this.currentByte>>this.shift&1;this.shift--;return e},readBits:function(e){var t=0,r=void 0;for(r=e-1;r>=0;r--)t|=this.readBit()<<r;return t},byteAlign:function(){this.shift=-1},next:function(){return this.position>=this.end?-1:this.data[this.position++]}};function O(e,t,r){var a=0,i=void 0,n=t.length,s=void 0;for(i=0;i<n;i++)if(s=r[t[i]]){if(e===a)return s;a++}throw new o("can't find custom Huffman table")}function T(e,t,r){var a=[],i=void 0,n=void 0,o=void 0;for(n=0;n<r;n++){o=new Uint8Array(t);a.push(o);for(i=0;i<t;i++)o[i]=e.readBit();e.byteAlign()}return a}function E(e,t,r,a){var i={K:-1,Columns:t,Rows:r,BlackIs1:!0,EndOfBlock:a},o=new n.CCITTFaxDecoder(e,i),s=[],c=void 0,l=void 0,u=void 0,h=void 0,f=void 0,d=!1;for(l=0;l<r;l++){u=new Uint8Array(t);s.push(u);f=-1;for(c=0;c<t;c++){if(f<0){if(-1===(h=o.readNextChar())){h=0;d=!0}f=7}u[c]=h>>f&1;f--}}if(a&&!d)for(var g=0;g<5&&-1!==o.readNextChar();g++);return s}function F(){}F.prototype={parseChunks:function(e){return function(e){for(var t=new S,r=0,a=e.length;r<a;r++){var i=e[r];k(v({},i.data,i.start,i.end),t)}return t.buffer}(e)},parse:function(e){var t=function(e){var t=0,r=e.length;if(151!==e[t]||74!==e[t+1]||66!==e[t+2]||50!==e[t+3]||13!==e[t+4]||10!==e[t+5]||26!==e[t+6]||10!==e[t+7])throw new o("parseJbig2 - invalid header.");var i=Object.create(null);t+=8;var n=e[t++];i.randomAccess=!(1&n);if(!(2&n)){i.numberOfPages=(0,a.readUint32)(e,t);t+=4}var s=v(i,e,t,r),c=new S;k(s,c);for(var l=c.currentPageInfo,u=l.width,h=l.height,f=c.buffer,d=new Uint8ClampedArray(u*h),g=0,m=0,p=0;p<h;p++)for(var b=0,y=void 0,w=0;w<u;w++){if(!b){b=128;y=f[m++]}d[g++]=y&b?0:255;b>>=1}return{imgData:d,width:u,height:h}}(e),r=t.imgData,i=t.width,n=t.height;this.width=i;this.height=n;return r}};return F}();t.Jbig2Image=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){var e=[{qe:22017,nmps:1,nlps:1,switchFlag:1},{qe:13313,nmps:2,nlps:6,switchFlag:0},{qe:6145,nmps:3,nlps:9,switchFlag:0},{qe:2753,nmps:4,nlps:12,switchFlag:0},{qe:1313,nmps:5,nlps:29,switchFlag:0},{qe:545,nmps:38,nlps:33,switchFlag:0},{qe:22017,nmps:7,nlps:6,switchFlag:1},{qe:21505,nmps:8,nlps:14,switchFlag:0},{qe:18433,nmps:9,nlps:14,switchFlag:0},{qe:14337,nmps:10,nlps:14,switchFlag:0},{qe:12289,nmps:11,nlps:17,switchFlag:0},{qe:9217,nmps:12,nlps:18,switchFlag:0},{qe:7169,nmps:13,nlps:20,switchFlag:0},{qe:5633,nmps:29,nlps:21,switchFlag:0},{qe:22017,nmps:15,nlps:14,switchFlag:1},{qe:21505,nmps:16,nlps:14,switchFlag:0},{qe:20737,nmps:17,nlps:15,switchFlag:0},{qe:18433,nmps:18,nlps:16,switchFlag:0},{qe:14337,nmps:19,nlps:17,switchFlag:0},{qe:13313,nmps:20,nlps:18,switchFlag:0},{qe:12289,nmps:21,nlps:19,switchFlag:0},{qe:10241,nmps:22,nlps:19,switchFlag:0},{qe:9217,nmps:23,nlps:20,switchFlag:0},{qe:8705,nmps:24,nlps:21,switchFlag:0},{qe:7169,nmps:25,nlps:22,switchFlag:0},{qe:6145,nmps:26,nlps:23,switchFlag:0},{qe:5633,nmps:27,nlps:24,switchFlag:0},{qe:5121,nmps:28,nlps:25,switchFlag:0},{qe:4609,nmps:29,nlps:26,switchFlag:0},{qe:4353,nmps:30,nlps:27,switchFlag:0},{qe:2753,nmps:31,nlps:28,switchFlag:0},{qe:2497,nmps:32,nlps:29,switchFlag:0},{qe:2209,nmps:33,nlps:30,switchFlag:0},{qe:1313,nmps:34,nlps:31,switchFlag:0},{qe:1089,nmps:35,nlps:32,switchFlag:0},{qe:673,nmps:36,nlps:33,switchFlag:0},{qe:545,nmps:37,nlps:34,switchFlag:0},{qe:321,nmps:38,nlps:35,switchFlag:0},{qe:273,nmps:39,nlps:36,switchFlag:0},{qe:133,nmps:40,nlps:37,switchFlag:0},{qe:73,nmps:41,nlps:38,switchFlag:0},{qe:37,nmps:42,nlps:39,switchFlag:0},{qe:21,nmps:43,nlps:40,switchFlag:0},{qe:9,nmps:44,nlps:41,switchFlag:0},{qe:5,nmps:45,nlps:42,switchFlag:0},{qe:1,nmps:45,nlps:43,switchFlag:0},{qe:22017,nmps:46,nlps:46,switchFlag:0}];function t(e,t,r){this.data=e;this.bp=t;this.dataEnd=r;this.chigh=e[t];this.clow=0;this.byteIn();this.chigh=this.chigh<<7&65535|this.clow>>9&127;this.clow=this.clow<<7&65535;this.ct-=7;this.a=32768}t.prototype={byteIn:function(){var e=this.data,t=this.bp;if(255===e[t]){if(e[t+1]>143){this.clow+=65280;this.ct=8}else{t++;this.clow+=e[t]<<9;this.ct=7;this.bp=t}}else{t++;this.clow+=t<this.dataEnd?e[t]<<8:65280;this.ct=8;this.bp=t}if(this.clow>65535){this.chigh+=this.clow>>16;this.clow&=65535}},readBit:function(t,r){var a,i=t[r]>>1,n=1&t[r],o=e[i],s=o.qe,c=this.a-s;if(this.chigh<s)if(c<s){c=s;a=n;i=o.nmps}else{c=s;a=1^n;1===o.switchFlag&&(n=a);i=o.nlps}else{this.chigh-=s;if(0!=(32768&c)){this.a=c;return n}if(c<s){a=1^n;1===o.switchFlag&&(n=a);i=o.nlps}else{a=n;i=o.nmps}}do{0===this.ct&&this.byteIn();c<<=1;this.chigh=this.chigh<<1&65535|this.clow>>15&1;this.clow=this.clow<<1&65535;this.ct--}while(0==(32768&c));this.a=c;t[r]=i<<1|n;return a}};return t}();t.ArithmeticDecoder=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.JpegStream=void 0;var a=r(2),i=r(140),n=r(138),o=r(147),s=function(){function e(e,t,r,a){for(var n=void 0;-1!==(n=e.getByte());)if(255===n){e.skip(-1);break}this.stream=e;this.maybeLength=t;this.dict=r;this.params=a;i.DecodeStream.call(this,t)}e.prototype=Object.create(i.DecodeStream.prototype);Object.defineProperty(e.prototype,"bytes",{get:function(){return(0,a.shadow)(this,"bytes",this.stream.getBytes(this.maybeLength))},configurable:!0});e.prototype.ensureBuffer=function(e){};e.prototype.readBlock=function(){if(!this.eof){var e={decodeTransform:void 0,colorTransform:void 0},t=this.dict.getArray("Decode","D");if(this.forceRGB&&Array.isArray(t)){for(var r=this.dict.get("BitsPerComponent")||8,a=t.length,i=new Int32Array(a),s=!1,c=(1<<r)-1,l=0;l<a;l+=2){i[l]=256*(t[l+1]-t[l])|0;i[l+1]=t[l]*c|0;256===i[l]&&0===i[l+1]||(s=!0)}s&&(e.decodeTransform=i)}if((0,n.isDict)(this.params)){var u=this.params.get("ColorTransform");Number.isInteger(u)&&(e.colorTransform=u)}var h=new o.JpegImage(e);h.parse(this.bytes);var f=h.getData({width:this.drawWidth,height:this.drawHeight,forceRGB:this.forceRGB,isSourcePDF:!0});this.buffer=f;this.bufferLength=f.length;this.eof=!0}};e.prototype.getIR=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(0,a.createObjectURL)(this.bytes,"image/jpeg",e)};return e}();t.JpegStream=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.JpegImage=void 0;var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(2),n=function(){function e(e){this.message="JPEG error: "+e}e.prototype=new Error;e.prototype.name="JpegError";e.constructor=e;return e}(),o=function(){function e(e,t){this.message=e;this.scanLines=t}e.prototype=new Error;e.prototype.name="DNLMarkerError";e.constructor=e;return e}(),s=function(){function e(e){this.message=e}e.prototype=new Error;e.prototype.name="EOIMarkerError";e.constructor=e;return e}(),c=function(){var e=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),t=4017,r=799,c=3406,l=2276,u=1567,h=3784,f=5793,d=2896;function g(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.decodeTransform,r=void 0===t?null:t,a=e.colorTransform,i=void 0===a?-1:a;this._decodeTransform=r;this._colorTransform=i}function m(e,t){for(var r,a,i=0,n=[],o=16;o>0&&!e[o-1];)o--;n.push({children:[],index:0});var s,c=n[0];for(r=0;r<o;r++){for(a=0;a<e[r];a++){(c=n.pop()).children[c.index]=t[i];for(;c.index>0;)c=n.pop();c.index++;n.push(c);for(;n.length<=r;){n.push(s={children:[],index:0});c.children[c.index]=s.children;c=s}i++}if(r+1<o){n.push(s={children:[],index:0});c.children[c.index]=s.children;c=s}}return n[0].children}function p(e,t,r){return 64*((e.blocksPerLine+1)*t+r)}function v(t,r,c,l,u,h,f,d,g){var m=arguments.length>9&&void 0!==arguments[9]&&arguments[9],v=c.mcusPerLine,b=c.progressive,y=r,k=0,S=0;function C(){if(S>0)return k>>--S&1;if(255===(k=t[r++])){var e=t[r++];if(e){if(220===e&&m){r+=2;var a=t[r++]<<8|t[r++];if(a>0&&a!==c.scanLines)throw new o("Found DNL marker (0xFFDC) while parsing scan data",a)}else if(217===e)throw new s("Found EOI marker (0xFFD9) while parsing scan data");throw new n("unexpected marker "+(k<<8|e).toString(16))}}S=7;return k>>>7}function x(e){for(var t=e;;){if("number"==typeof(t=t[C()]))return t;if("object"!==(void 0===t?"undefined":a(t)))throw new n("invalid huffman sequence")}}function _(e){for(var t=0;e>0;){t=t<<1|C();e--}return t}function A(e){if(1===e)return 1===C()?1:-1;var t=_(e);return t>=1<<e-1?t:t+(-1<<e)+1}var P=0;var I,O=0;function T(e,t,r,a,i){var n=r%v;t(e,p(e,(r/v|0)*e.v+a,n*e.h+i))}function E(e,t,r){t(e,p(e,r/e.blocksPerLine|0,r%e.blocksPerLine))}var F,R,B,D,M,L,N=l.length;L=b?0===h?0===d?function(e,t){var r=x(e.huffmanTableDC),a=0===r?0:A(r)<<g;e.blockData[t]=e.pred+=a}:function(e,t){e.blockData[t]|=C()<<g}:0===d?function(t,r){if(P>0)P--;else for(var a=h,i=f;a<=i;){var n=x(t.huffmanTableAC),o=15&n,s=n>>4;if(0!==o){var c=e[a+=s];t.blockData[r+c]=A(o)*(1<<g);a++}else{if(s<15){P=_(s)+(1<<s)-1;break}a+=16}}}:function(t,r){for(var a,i,o=h,s=f,c=0;o<=s;){var l=r+e[o],u=t.blockData[l]<0?-1:1;switch(O){case 0:c=(i=x(t.huffmanTableAC))>>4;if(0==(a=15&i))if(c<15){P=_(c)+(1<<c);O=4}else{c=16;O=1}else{if(1!==a)throw new n("invalid ACn encoding");I=A(a);O=c?2:3}continue;case 1:case 2:t.blockData[l]?t.blockData[l]+=u*(C()<<g):0==--c&&(O=2===O?3:0);break;case 3:if(t.blockData[l])t.blockData[l]+=u*(C()<<g);else{t.blockData[l]=I<<g;O=0}break;case 4:t.blockData[l]&&(t.blockData[l]+=u*(C()<<g))}o++}4===O&&0==--P&&(O=0)}:function(t,r){var a=x(t.huffmanTableDC),i=0===a?0:A(a);t.blockData[r]=t.pred+=i;for(var n=1;n<64;){var o=x(t.huffmanTableAC),s=15&o,c=o>>4;if(0!==s){var l=e[n+=c];t.blockData[r+l]=A(s);n++}else{if(c<15)break;n+=16}}};var U,q,j,z,H=0;q=1===N?l[0].blocksPerLine*l[0].blocksPerColumn:v*c.mcusPerColumn;for(;H<q;){var G=u?Math.min(q-H,u):q;for(R=0;R<N;R++)l[R].pred=0;P=0;if(1===N){F=l[0];for(M=0;M<G;M++){E(F,L,H);H++}}else for(M=0;M<G;M++){for(R=0;R<N;R++){j=(F=l[R]).h;z=F.v;for(B=0;B<z;B++)for(D=0;D<j;D++)T(F,L,H,B,D)}H++}S=0;if((U=w(t,r))&&U.invalid){(0,i.warn)("decodeScan - unexpected MCU data, current marker is: "+U.invalid);r=U.offset}var W=U&&U.marker;if(!W||W<=65280)throw new n("marker was not found");if(!(W>=65488&&W<=65495))break;r+=2}if((U=w(t,r))&&U.invalid){(0,i.warn)("decodeScan - unexpected Scan data, current marker is: "+U.invalid);r=U.offset}return r-y}function b(e,a,i){var o,s,g,m,p,v,b,y,w,k,S,C,x,_,A,P,I,O=e.quantizationTable,T=e.blockData;if(!O)throw new n("missing required Quantization Table.");for(var E=0;E<64;E+=8){w=T[a+E];k=T[a+E+1];S=T[a+E+2];C=T[a+E+3];x=T[a+E+4];_=T[a+E+5];A=T[a+E+6];P=T[a+E+7];w*=O[E];if(0!=(k|S|C|x|_|A|P)){k*=O[E+1];S*=O[E+2];C*=O[E+3];x*=O[E+4];_*=O[E+5];A*=O[E+6];P*=O[E+7];s=(o=(o=f*w+128>>8)+(s=f*x+128>>8)+1>>1)-s;I=(g=S)*h+(m=A)*u+128>>8;g=g*u-m*h+128>>8;b=(p=(p=d*(k-P)+128>>8)+(b=_<<4)+1>>1)-b;v=(y=(y=d*(k+P)+128>>8)+(v=C<<4)+1>>1)-v;m=(o=o+(m=I)+1>>1)-m;g=(s=s+g+1>>1)-g;I=p*l+y*c+2048>>12;p=p*c-y*l+2048>>12;y=I;I=v*r+b*t+2048>>12;v=v*t-b*r+2048>>12;b=I;i[E]=o+y;i[E+7]=o-y;i[E+1]=s+b;i[E+6]=s-b;i[E+2]=g+v;i[E+5]=g-v;i[E+3]=m+p;i[E+4]=m-p}else{I=f*w+512>>10;i[E]=I;i[E+1]=I;i[E+2]=I;i[E+3]=I;i[E+4]=I;i[E+5]=I;i[E+6]=I;i[E+7]=I}}for(var F=0;F<8;++F){w=i[F];if(0!=((k=i[F+8])|(S=i[F+16])|(C=i[F+24])|(x=i[F+32])|(_=i[F+40])|(A=i[F+48])|(P=i[F+56]))){s=(o=4112+((o=f*w+2048>>12)+(s=f*x+2048>>12)+1>>1))-s;I=(g=S)*h+(m=A)*u+2048>>12;g=g*u-m*h+2048>>12;m=I;b=(p=(p=d*(k-P)+2048>>12)+(b=_)+1>>1)-b;v=(y=(y=d*(k+P)+2048>>12)+(v=C)+1>>1)-v;I=p*l+y*c+2048>>12;p=p*c-y*l+2048>>12;y=I;I=v*r+b*t+2048>>12;v=v*t-b*r+2048>>12;P=(o=o+m+1>>1)-y;k=(s=s+g+1>>1)+(b=I);A=s-b;S=(g=s-g)+v;_=g-v;C=(m=o-m)+p;x=m-p;w=(w=o+y)<16?0:w>=4080?255:w>>4;k=k<16?0:k>=4080?255:k>>4;S=S<16?0:S>=4080?255:S>>4;C=C<16?0:C>=4080?255:C>>4;x=x<16?0:x>=4080?255:x>>4;_=_<16?0:_>=4080?255:_>>4;A=A<16?0:A>=4080?255:A>>4;P=P<16?0:P>=4080?255:P>>4;T[a+F]=w;T[a+F+8]=k;T[a+F+16]=S;T[a+F+24]=C;T[a+F+32]=x;T[a+F+40]=_;T[a+F+48]=A;T[a+F+56]=P}else{I=(I=f*w+8192>>14)<-2040?0:I>=2024?255:I+2056>>4;T[a+F]=I;T[a+F+8]=I;T[a+F+16]=I;T[a+F+24]=I;T[a+F+32]=I;T[a+F+40]=I;T[a+F+48]=I;T[a+F+56]=I}}}function y(e,t){for(var r=t.blocksPerLine,a=t.blocksPerColumn,i=new Int16Array(64),n=0;n<a;n++)for(var o=0;o<r;o++){b(t,p(t,n,o),i)}return t.blockData}function w(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t;function a(t){return e[t]<<8|e[t+1]}var i=e.length-1,n=r<t?r:t;if(t>=i)return null;var o=a(t);if(o>=65472&&o<=65534)return{invalid:null,marker:o,offset:t};for(var s=a(n);!(s>=65472&&s<=65534);){if(++n>=i)return null;s=a(n)}return{invalid:o.toString(16),marker:s,offset:n}}g.prototype={parse:function(t){var r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).dnlScanLines,a=void 0===r?null:r;function c(){var e=t[d]<<8|t[d+1];d+=2;return e}function l(){var e=c(),r=d+e-2,a=w(t,r,d);if(a&&a.invalid){(0,i.warn)("readDataBlock - incorrect length, current marker is: "+a.invalid);r=a.offset}var n=t.subarray(d,r);d+=n.length;return n}function u(e){for(var t=Math.ceil(e.samplesPerLine/8/e.maxH),r=Math.ceil(e.scanLines/8/e.maxV),a=0;a<e.components.length;a++){X=e.components[a];var i=Math.ceil(Math.ceil(e.samplesPerLine/8)*X.h/e.maxH),n=Math.ceil(Math.ceil(e.scanLines/8)*X.v/e.maxV),o=t*X.h,s=64*(r*X.v)*(o+1);X.blockData=new Int16Array(s);X.blocksPerLine=i;X.blocksPerColumn=n}e.mcusPerLine=t;e.mcusPerColumn=r}var h,f,d=0,g=null,p=null,b=0,k=[],S=[],C=[],x=c();if(65496!==x)throw new n("SOI not found");x=c();e:for(;65497!==x;){var _,A,P;switch(x){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var I=l();65504===x&&74===I[0]&&70===I[1]&&73===I[2]&&70===I[3]&&0===I[4]&&(g={version:{major:I[5],minor:I[6]},densityUnits:I[7],xDensity:I[8]<<8|I[9],yDensity:I[10]<<8|I[11],thumbWidth:I[12],thumbHeight:I[13],thumbData:I.subarray(14,14+3*I[12]*I[13])});65518===x&&65===I[0]&&100===I[1]&&111===I[2]&&98===I[3]&&101===I[4]&&(p={version:I[5]<<8|I[6],flags0:I[7]<<8|I[8],flags1:I[9]<<8|I[10],transformCode:I[11]});break;case 65499:for(var O=c()+d-2;d<O;){var T=t[d++],E=new Uint16Array(64);if(T>>4==0)for(A=0;A<64;A++)E[e[A]]=t[d++];else{if(T>>4!=1)throw new n("DQT - invalid table spec");for(A=0;A<64;A++)E[e[A]]=c()}k[15&T]=E}break;case 65472:case 65473:case 65474:if(h)throw new n("Only single frame JPEGs supported");c();(h={}).extended=65473===x;h.progressive=65474===x;h.precision=t[d++];var F=c();h.scanLines=a||F;h.samplesPerLine=c();h.components=[];h.componentIds={};var R,B=t[d++],D=0,M=0;for(_=0;_<B;_++){R=t[d];var L=t[d+1]>>4,N=15&t[d+1];D<L&&(D=L);M<N&&(M=N);var U=t[d+2];P=h.components.push({h:L,v:N,quantizationId:U,quantizationTable:null});h.componentIds[R]=P-1;d+=3}h.maxH=D;h.maxV=M;u(h);break;case 65476:var q=c();for(_=2;_<q;){var j=t[d++],z=new Uint8Array(16),H=0;for(A=0;A<16;A++,d++)H+=z[A]=t[d];var G=new Uint8Array(H);for(A=0;A<H;A++,d++)G[A]=t[d];_+=17+H;(j>>4==0?C:S)[15&j]=m(z,G)}break;case 65501:c();f=c();break;case 65498:var W=1==++b&&!a;c();var X,V=t[d++],K=[];for(_=0;_<V;_++){var Y=h.componentIds[t[d++]];X=h.components[Y];var J=t[d++];X.huffmanTableDC=C[J>>4];X.huffmanTableAC=S[15&J];K.push(X)}var Z=t[d++],Q=t[d++],$=t[d++];try{var ee=v(t,d,h,K,f,Z,Q,$>>4,15&$,W);d+=ee}catch(e){if(e instanceof o){(0,i.warn)(e.message+" -- attempting to re-parse the JPEG image.");return this.parse(t,{dnlScanLines:e.scanLines})}if(e instanceof s){(0,i.warn)(e.message+" -- ignoring the rest of the image data.");break e}throw e}break;case 65500:d+=4;break;case 65535:255!==t[d]&&d--;break;default:if(255===t[d-3]&&t[d-2]>=192&&t[d-2]<=254){d-=3;break}var te=w(t,d-2);if(te&&te.invalid){(0,i.warn)("JpegImage.parse - unexpected data, current marker is: "+te.invalid);d=te.offset;break}throw new n("unknown marker "+x.toString(16))}x=c()}this.width=h.samplesPerLine;this.height=h.scanLines;this.jfif=g;this.adobe=p;this.components=[];for(_=0;_<h.components.length;_++){var re=k[(X=h.components[_]).quantizationId];re&&(X.quantizationTable=re);this.components.push({output:y(0,X),scaleX:X.h/h.maxH,scaleY:X.v/h.maxV,blocksPerLine:X.blocksPerLine,blocksPerColumn:X.blocksPerColumn})}this.numComponents=this.components.length},_getLinearizedBlockData:function(e,t){var r,a,i,n,o,s,c,l,u,h,f,d=arguments.length>2&&void 0!==arguments[2]&&arguments[2],g=this.width/e,m=this.height/t,p=0,v=this.components.length,b=e*t*v,y=new Uint8ClampedArray(b),w=new Uint32Array(e);for(c=0;c<v;c++){a=(r=this.components[c]).scaleX*g;i=r.scaleY*m;p=c;f=r.output;n=r.blocksPerLine+1<<3;for(o=0;o<e;o++){l=0|o*a;w[o]=(4294967288&l)<<3|7&l}for(s=0;s<t;s++){h=n*(4294967288&(l=0|s*i))|(7&l)<<3;for(o=0;o<e;o++){y[p]=f[h+w[o]];p+=v}}}var k=this._decodeTransform;d||4!==v||k||(k=new Int32Array([-256,255,-256,255,-256,255,-256,255]));if(k)for(c=0;c<b;)for(l=0,u=0;l<v;l++,c++,u+=2)y[c]=(y[c]*k[u]>>8)+k[u+1];return y},get _isColorConversionNeeded(){return this.adobe?!!this.adobe.transformCode:3===this.numComponents?0!==this._colorTransform:1===this._colorTransform},_convertYccToRgb:function(e){for(var t,r,a,i=0,n=e.length;i<n;i+=3){t=e[i];r=e[i+1];a=e[i+2];e[i]=t-179.456+1.402*a;e[i+1]=t+135.459-.344*r-.714*a;e[i+2]=t-226.816+1.772*r}return e},_convertYcckToRgb:function(e){for(var t,r,a,i,n=0,o=0,s=e.length;o<s;o+=4){t=e[o];r=e[o+1];a=e[o+2];i=e[o+3];e[n++]=r*(-660635669420364e-19*r+.000437130475926232*a-54080610064599e-18*t+.00048449797120281*i-.154362151871126)-122.67195406894+a*(-.000957964378445773*a+.000817076911346625*t-.00477271405408747*i+1.53380253221734)+t*(.000961250184130688*t-.00266257332283933*i+.48357088451265)+i*(-.000336197177618394*i+.484791561490776);e[n++]=107.268039397724+r*(219927104525741e-19*r-.000640992018297945*a+.000659397001245577*t+.000426105652938837*i-.176491792462875)+a*(-.000778269941513683*a+.00130872261408275*t+.000770482631801132*i-.151051492775562)+t*(.00126935368114843*t-.00265090189010898*i+.25802910206845)+i*(-.000318913117588328*i-.213742400323665);e[n++]=r*(-.000570115196973677*r-263409051004589e-19*a+.0020741088115012*t-.00288260236853442*i+.814272968359295)-20.810012546947+a*(-153496057440975e-19*a-.000132689043961446*t+.000560833691242812*i-.195152027534049)+t*(.00174418132927582*t-.00255243321439347*i+.116935020465145)+i*(-.000343531996510555*i+.24165260232407)}return e.subarray(0,n)},_convertYcckToCmyk:function(e){for(var t,r,a,i=0,n=e.length;i<n;i+=4){t=e[i];r=e[i+1];a=e[i+2];e[i]=434.456-t-1.402*a;e[i+1]=119.541-t+.344*r+.714*a;e[i+2]=481.816-t-1.772*r}return e},_convertCmykToRgb:function(e){for(var t,r,a,i,n=0,o=0,s=e.length;o<s;o+=4){t=e[o]*(1/255);r=e[o+1]*(1/255);a=e[o+2]*(1/255);i=e[o+3]*(1/255);e[n++]=255+t*(-4.387332384609988*t+54.48615194189176*r+18.82290502165302*a+212.25662451639585*i-285.2331026137004)+r*(1.7149763477362134*r-5.6096736904047315*a-17.873870861415444*i-5.497006427196366)+a*(-2.5217340131683033*a-21.248923337353073*i+17.5119270841813)-i*(21.86122147463605*i+189.48180835922747);e[n++]=255+t*(8.841041422036149*t+60.118027045597366*r+6.871425592049007*a+31.159100130055922*i-79.2970844816548)+r*(-15.310361306967817*r+17.575251261109482*a+131.35250912493976*i-190.9453302588951)+a*(4.444339102852739*a+9.8632861493405*i-24.86741582555878)-i*(20.737325471181034*i+187.80453709719578);e[n++]=255+t*(.8842522430003296*t+8.078677503112928*r+30.89978309703729*a-.23883238689178934*i-14.183576799673286)+r*(10.49593273432072*r+63.02378494754052*a+50.606957656360734*i-112.23884253719248)+a*(.03296041114873217*a+115.60384449646641*i-193.58209356861505)-i*(22.33816807309886*i+180.12613974708367)}return e.subarray(0,n)},getData:function(e){var t=e.width,r=e.height,a=e.forceRGB,i=void 0!==a&&a,o=e.isSourcePDF,s=void 0!==o&&o;if(this.numComponents>4)throw new n("Unsupported color mode");var c=this._getLinearizedBlockData(t,r,s);if(1===this.numComponents&&i){for(var l=c.length,u=new Uint8ClampedArray(3*l),h=0,f=0;f<l;f++){var d=c[f];u[h++]=d;u[h++]=d;u[h++]=d}return u}if(3===this.numComponents&&this._isColorConversionNeeded)return this._convertYccToRgb(c);if(4===this.numComponents){if(this._isColorConversionNeeded)return i?this._convertYcckToRgb(c):this._convertYcckToCmyk(c);if(i)return this._convertCmykToRgb(c)}return c}};return g}();t.JpegImage=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.JpxStream=void 0;var a=r(140),i=r(149),n=r(2),o=function(){function e(e,t,r,i){this.stream=e;this.maybeLength=t;this.dict=r;this.params=i;a.DecodeStream.call(this,t)}e.prototype=Object.create(a.DecodeStream.prototype);Object.defineProperty(e.prototype,"bytes",{get:function(){return(0,n.shadow)(this,"bytes",this.stream.getBytes(this.maybeLength))},configurable:!0});e.prototype.ensureBuffer=function(e){};e.prototype.readBlock=function(){if(!this.eof){var e=new i.JpxImage;e.parse(this.bytes);var t=e.width,r=e.height,a=e.componentsCount,n=e.tiles.length;if(1===n)this.buffer=e.tiles[0].items;else{for(var o=new Uint8ClampedArray(t*r*a),s=0;s<n;s++)for(var c=e.tiles[s],l=c.width,u=c.height,h=c.left,f=c.top,d=c.items,g=0,m=(t*f+h)*a,p=t*a,v=l*a,b=0;b<u;b++){var y=d.subarray(g,g+v);o.set(y,m);g+=v;m+=p}this.buffer=o}this.bufferLength=this.buffer.length;this.eof=!0}};return e}();t.JpxStream=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.JpxImage=void 0;var a=r(2),i=r(145),n=function(){function e(e){this.message="JPX error: "+e}e.prototype=new Error;e.prototype.name="JpxError";e.constructor=e;return e}(),o=function(){var e={LL:0,LH:1,HL:1,HH:2};function t(){this.failOnCorruptedImage=!1}t.prototype={parse:function(e){if(65359!==(0,a.readUint16)(e,0))for(var t=0,r=e.length;t<r;){var i=8,o=(0,a.readUint32)(e,t),s=(0,a.readUint32)(e,t+4);t+=i;if(1===o){o=4294967296*(0,a.readUint32)(e,t)+(0,a.readUint32)(e,t+4);t+=8;i+=8}0===o&&(o=r-t+i);if(o<i)throw new n("Invalid box field size");var c=o-i,l=!0;switch(s){case 1785737832:l=!1;break;case 1668246642:var u=e[t];if(1===u){var h=(0,a.readUint32)(e,t+3);switch(h){case 16:case 17:case 18:break;default:(0,a.warn)("Unknown colorspace "+h)}}else 2===u&&(0,a.info)("ICC profile not supported");break;case 1785737827:this.parseCodestream(e,t,t+c);break;case 1783636e3:218793738!==(0,a.readUint32)(e,t)&&(0,a.warn)("Invalid JP2 signature");break;case 1783634458:case 1718909296:case 1920099697:case 1919251232:case 1768449138:break;default:var f=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,255&s);(0,a.warn)("Unsupported header type "+s+" ("+f+")")}l&&(t+=c)}else this.parseCodestream(e,0,e.length)},parseImageProperties:function(e){for(var t=e.getByte();t>=0;){if(65361===(t<<8|(t=e.getByte()))){e.skip(4);var r=e.getInt32()>>>0,a=e.getInt32()>>>0,i=e.getInt32()>>>0,o=e.getInt32()>>>0;e.skip(16);var s=e.getUint16();this.width=r-i;this.height=a-o;this.componentsCount=s;this.bitsPerComponent=8;return}}throw new n("No size marker found in JPX stream")},parseCodestream:function(e,t,i){var s={},c=!1;try{for(var l=t;l+1<i;){var u=(0,a.readUint16)(e,l);l+=2;var h,f,m,b,y,w,k=0;switch(u){case 65359:s.mainHeader=!0;break;case 65497:break;case 65361:k=(0,a.readUint16)(e,l);var S={};S.Xsiz=(0,a.readUint32)(e,l+4);S.Ysiz=(0,a.readUint32)(e,l+8);S.XOsiz=(0,a.readUint32)(e,l+12);S.YOsiz=(0,a.readUint32)(e,l+16);S.XTsiz=(0,a.readUint32)(e,l+20);S.YTsiz=(0,a.readUint32)(e,l+24);S.XTOsiz=(0,a.readUint32)(e,l+28);S.YTOsiz=(0,a.readUint32)(e,l+32);var C=(0,a.readUint16)(e,l+36);S.Csiz=C;var x=[];h=l+38;for(var _=0;_<C;_++){var A={precision:1+(127&e[h]),isSigned:!!(128&e[h]),XRsiz:e[h+1],YRsiz:e[h+2]};h+=3;r(A,S);x.push(A)}s.SIZ=S;s.components=x;o(s,x);s.QCC=[];s.COC=[];break;case 65372:k=(0,a.readUint16)(e,l);var P={};h=l+2;switch(31&(f=e[h++])){case 0:b=8;y=!0;break;case 1:b=16;y=!1;break;case 2:b=16;y=!0;break;default:throw new Error("Invalid SQcd value "+f)}P.noQuantization=8===b;P.scalarExpounded=y;P.guardBits=f>>5;m=[];for(;h<k+l;){var I={};if(8===b){I.epsilon=e[h++]>>3;I.mu=0}else{I.epsilon=e[h]>>3;I.mu=(7&e[h])<<8|e[h+1];h+=2}m.push(I)}P.SPqcds=m;if(s.mainHeader)s.QCD=P;else{s.currentTile.QCD=P;s.currentTile.QCC=[]}break;case 65373:k=(0,a.readUint16)(e,l);var O,T={};h=l+2;if(s.SIZ.Csiz<257)O=e[h++];else{O=(0,a.readUint16)(e,h);h+=2}switch(31&(f=e[h++])){case 0:b=8;y=!0;break;case 1:b=16;y=!1;break;case 2:b=16;y=!0;break;default:throw new Error("Invalid SQcd value "+f)}T.noQuantization=8===b;T.scalarExpounded=y;T.guardBits=f>>5;m=[];for(;h<k+l;){I={};if(8===b){I.epsilon=e[h++]>>3;I.mu=0}else{I.epsilon=e[h]>>3;I.mu=(7&e[h])<<8|e[h+1];h+=2}m.push(I)}T.SPqcds=m;s.mainHeader?s.QCC[O]=T:s.currentTile.QCC[O]=T;break;case 65362:k=(0,a.readUint16)(e,l);var E={};h=l+2;var F=e[h++];E.entropyCoderWithCustomPrecincts=!!(1&F);E.sopMarkerUsed=!!(2&F);E.ephMarkerUsed=!!(4&F);E.progressionOrder=e[h++];E.layersCount=(0,a.readUint16)(e,h);h+=2;E.multipleComponentTransform=e[h++];E.decompositionLevelsCount=e[h++];E.xcb=2+(15&e[h++]);E.ycb=2+(15&e[h++]);var R=e[h++];E.selectiveArithmeticCodingBypass=!!(1&R);E.resetContextProbabilities=!!(2&R);E.terminationOnEachCodingPass=!!(4&R);E.verticallyStripe=!!(8&R);E.predictableTermination=!!(16&R);E.segmentationSymbolUsed=!!(32&R);E.reversibleTransformation=e[h++];if(E.entropyCoderWithCustomPrecincts){for(var B=[];h<k+l;){var D=e[h++];B.push({PPx:15&D,PPy:D>>4})}E.precinctsSizes=B}var M=[];E.selectiveArithmeticCodingBypass&&M.push("selectiveArithmeticCodingBypass");E.resetContextProbabilities&&M.push("resetContextProbabilities");E.terminationOnEachCodingPass&&M.push("terminationOnEachCodingPass");E.verticallyStripe&&M.push("verticallyStripe");E.predictableTermination&&M.push("predictableTermination");if(M.length>0){c=!0;throw new Error("Unsupported COD options ("+M.join(", ")+")")}if(s.mainHeader)s.COD=E;else{s.currentTile.COD=E;s.currentTile.COC=[]}break;case 65424:k=(0,a.readUint16)(e,l);(w={}).index=(0,a.readUint16)(e,l+2);w.length=(0,a.readUint32)(e,l+4);w.dataEnd=w.length+l-2;w.partIndex=e[l+8];w.partsCount=e[l+9];s.mainHeader=!1;if(0===w.partIndex){w.COD=s.COD;w.COC=s.COC.slice(0);w.QCD=s.QCD;w.QCC=s.QCC.slice(0)}s.currentTile=w;break;case 65427:if(0===(w=s.currentTile).partIndex){v(s,w.index);d(s)}g(s,e,l,k=w.dataEnd-l);break;case 65365:case 65367:case 65368:case 65380:k=(0,a.readUint16)(e,l);break;case 65363:throw new Error("Codestream code 0xFF53 (COC) is not implemented");default:throw new Error("Unknown codestream code: "+u.toString(16))}l+=k}}catch(e){if(c||this.failOnCorruptedImage)throw new n(e.message);(0,a.warn)("JPX: Trying to recover from: "+e.message)}this.tiles=function(e){for(var t=e.SIZ,r=e.components,a=t.Csiz,i=[],n=0,o=e.tiles.length;n<o;n++){var s,c=e.tiles[n],l=[];for(s=0;s<a;s++)l[s]=p(e,c,s);var u,h,f,d,g,m,v,b=l[0],y=new Uint8ClampedArray(b.items.length*a),w={left:b.left,top:b.top,width:b.width,height:b.height,items:y},k=0;if(c.codingStyleDefaultParameters.multipleComponentTransform){var S=4===a,C=l[0].items,x=l[1].items,_=l[2].items,A=S?l[3].items:null;u=r[0].precision-8;h=.5+(128<<u);var P=c.components[0],I=a-3;d=C.length;if(P.codingStyleParameters.reversibleTransformation)for(f=0;f<d;f++,k+=I){g=C[f]+h;m=x[f];v=_[f];var O=g-(v+m>>2);y[k++]=O+v>>u;y[k++]=O>>u;y[k++]=O+m>>u}else for(f=0;f<d;f++,k+=I){g=C[f]+h;m=x[f];v=_[f];y[k++]=g+1.402*v>>u;y[k++]=g-.34413*m-.71414*v>>u;y[k++]=g+1.772*m>>u}if(S)for(f=0,k=3;f<d;f++,k+=4)y[k]=A[f]+h>>u}else for(s=0;s<a;s++){var T=l[s].items;u=r[s].precision-8;h=.5+(128<<u);for(k=s,f=0,d=T.length;f<d;f++){y[k]=T[f]+h>>u;k+=a}}i.push(w)}return i}(s);this.width=s.SIZ.Xsiz-s.SIZ.XOsiz;this.height=s.SIZ.Ysiz-s.SIZ.YOsiz;this.componentsCount=s.SIZ.Csiz}};function r(e,t){e.x0=Math.ceil(t.XOsiz/e.XRsiz);e.x1=Math.ceil(t.Xsiz/e.XRsiz);e.y0=Math.ceil(t.YOsiz/e.YRsiz);e.y1=Math.ceil(t.Ysiz/e.YRsiz);e.width=e.x1-e.x0;e.height=e.y1-e.y0}function o(e,t){for(var r,a=e.SIZ,i=[],n=Math.ceil((a.Xsiz-a.XTOsiz)/a.XTsiz),o=Math.ceil((a.Ysiz-a.YTOsiz)/a.YTsiz),s=0;s<o;s++)for(var c=0;c<n;c++){(r={}).tx0=Math.max(a.XTOsiz+c*a.XTsiz,a.XOsiz);r.ty0=Math.max(a.YTOsiz+s*a.YTsiz,a.YOsiz);r.tx1=Math.min(a.XTOsiz+(c+1)*a.XTsiz,a.Xsiz);r.ty1=Math.min(a.YTOsiz+(s+1)*a.YTsiz,a.Ysiz);r.width=r.tx1-r.tx0;r.height=r.ty1-r.ty0;r.components=[];i.push(r)}e.tiles=i;for(var l=0,u=a.Csiz;l<u;l++)for(var h=t[l],f=0,d=i.length;f<d;f++){var g={};r=i[f];g.tcx0=Math.ceil(r.tx0/h.XRsiz);g.tcy0=Math.ceil(r.ty0/h.YRsiz);g.tcx1=Math.ceil(r.tx1/h.XRsiz);g.tcy1=Math.ceil(r.ty1/h.YRsiz);g.width=g.tcx1-g.tcx0;g.height=g.tcy1-g.tcy0;r.components[l]=g}}function s(e,t,r){var a=t.codingStyleParameters,i={};if(a.entropyCoderWithCustomPrecincts){i.PPx=a.precinctsSizes[r].PPx;i.PPy=a.precinctsSizes[r].PPy}else{i.PPx=15;i.PPy=15}i.xcb_=r>0?Math.min(a.xcb,i.PPx-1):Math.min(a.xcb,i.PPx);i.ycb_=r>0?Math.min(a.ycb,i.PPy-1):Math.min(a.ycb,i.PPy);return i}function c(e,t,r){var a=1<<r.PPx,i=1<<r.PPy,n=0===t.resLevel,o=1<<r.PPx+(n?0:-1),s=1<<r.PPy+(n?0:-1),c=t.trx1>t.trx0?Math.ceil(t.trx1/a)-Math.floor(t.trx0/a):0,l=t.try1>t.try0?Math.ceil(t.try1/i)-Math.floor(t.try0/i):0,u=c*l;t.precinctParameters={precinctWidth:a,precinctHeight:i,numprecinctswide:c,numprecinctshigh:l,numprecincts:u,precinctWidthInSubband:o,precinctHeightInSubband:s}}function l(e,t,r){var a,i,n,o,s=r.xcb_,c=r.ycb_,l=1<<s,u=1<<c,h=t.tbx0>>s,f=t.tby0>>c,d=t.tbx1+l-1>>s,g=t.tby1+u-1>>c,m=t.resolution.precinctParameters,p=[],v=[];for(i=f;i<g;i++)for(a=h;a<d;a++){(n={cbx:a,cby:i,tbx0:l*a,tby0:u*i,tbx1:l*(a+1),tby1:u*(i+1)}).tbx0_=Math.max(t.tbx0,n.tbx0);n.tby0_=Math.max(t.tby0,n.tby0);n.tbx1_=Math.min(t.tbx1,n.tbx1);n.tby1_=Math.min(t.tby1,n.tby1);o=Math.floor((n.tbx0_-t.tbx0)/m.precinctWidthInSubband)+Math.floor((n.tby0_-t.tby0)/m.precinctHeightInSubband)*m.numprecinctswide;n.precinctNumber=o;n.subbandType=t.type;n.Lblock=3;if(!(n.tbx1_<=n.tbx0_||n.tby1_<=n.tby0_)){p.push(n);var b=v[o];if(void 0!==b){a<b.cbxMin?b.cbxMin=a:a>b.cbxMax&&(b.cbxMax=a);i<b.cbyMin?b.cbxMin=i:i>b.cbyMax&&(b.cbyMax=i)}else v[o]=b={cbxMin:a,cbyMin:i,cbxMax:a,cbyMax:i};n.precinct=b}}t.codeblockParameters={codeblockWidth:s,codeblockHeight:c,numcodeblockwide:d-h+1,numcodeblockhigh:g-f+1};t.codeblocks=p;t.precincts=v}function u(e,t,r){for(var a=[],i=e.subbands,n=0,o=i.length;n<o;n++)for(var s=i[n].codeblocks,c=0,l=s.length;c<l;c++){var u=s[c];u.precinctNumber===t&&a.push(u)}return{layerNumber:r,codeblocks:a}}function h(e,t,r,a,i){var n=e*a.minWidth,o=t*a.minHeight;if(n%r.width!=0||o%r.height!=0)return null;var s=o/r.width*i.precinctParameters.numprecinctswide;return n/r.height+s}function f(e){for(var t=e.components.length,r=Number.MAX_VALUE,a=Number.MAX_VALUE,i=0,n=0,o=new Array(t),s=0;s<t;s++){for(var c=e.components[s],l=c.codingStyleParameters.decompositionLevelsCount,u=new Array(l+1),h=Number.MAX_VALUE,f=Number.MAX_VALUE,d=0,g=0,m=1,p=l;p>=0;--p){var v=c.resolutions[p],b=m*v.precinctParameters.precinctWidth,y=m*v.precinctParameters.precinctHeight;h=Math.min(h,b);f=Math.min(f,y);d=Math.max(d,v.precinctParameters.numprecinctswide);g=Math.max(g,v.precinctParameters.numprecinctshigh);u[p]={width:b,height:y};m<<=1}r=Math.min(r,h);a=Math.min(a,f);i=Math.max(i,d);n=Math.max(n,g);o[s]={resolutions:u,minWidth:h,minHeight:f,maxNumWide:d,maxNumHigh:g}}return{components:o,minWidth:r,minHeight:a,maxNumWide:i,maxNumHigh:n}}function d(e){for(var t=e.SIZ,r=e.currentTile.index,a=e.tiles[r],i=t.Csiz,o=0;o<i;o++){for(var d=a.components[o],g=d.codingStyleParameters.decompositionLevelsCount,m=[],p=[],v=0;v<=g;v++){var b,y=s(0,d,v),w={},k=1<<g-v;w.trx0=Math.ceil(d.tcx0/k);w.try0=Math.ceil(d.tcy0/k);w.trx1=Math.ceil(d.tcx1/k);w.try1=Math.ceil(d.tcy1/k);w.resLevel=v;c(0,w,y);m.push(w);if(0===v){(b={}).type="LL";b.tbx0=Math.ceil(d.tcx0/k);b.tby0=Math.ceil(d.tcy0/k);b.tbx1=Math.ceil(d.tcx1/k);b.tby1=Math.ceil(d.tcy1/k);b.resolution=w;l(0,b,y);p.push(b);w.subbands=[b]}else{var S=1<<g-v+1,C=[];(b={}).type="HL";b.tbx0=Math.ceil(d.tcx0/S-.5);b.tby0=Math.ceil(d.tcy0/S);b.tbx1=Math.ceil(d.tcx1/S-.5);b.tby1=Math.ceil(d.tcy1/S);b.resolution=w;l(0,b,y);p.push(b);C.push(b);(b={}).type="LH";b.tbx0=Math.ceil(d.tcx0/S);b.tby0=Math.ceil(d.tcy0/S-.5);b.tbx1=Math.ceil(d.tcx1/S);b.tby1=Math.ceil(d.tcy1/S-.5);b.resolution=w;l(0,b,y);p.push(b);C.push(b);(b={}).type="HH";b.tbx0=Math.ceil(d.tcx0/S-.5);b.tby0=Math.ceil(d.tcy0/S-.5);b.tbx1=Math.ceil(d.tcx1/S-.5);b.tby1=Math.ceil(d.tcy1/S-.5);b.resolution=w;l(0,b,y);p.push(b);C.push(b);w.subbands=C}}d.resolutions=m;d.subbands=p}var x=a.codingStyleDefaultParameters.progressionOrder;switch(x){case 0:a.packetsIterator=new function(e){for(var t=e.SIZ,r=e.currentTile.index,a=e.tiles[r],i=a.codingStyleDefaultParameters.layersCount,o=t.Csiz,s=0,c=0;c<o;c++)s=Math.max(s,a.components[c].codingStyleParameters.decompositionLevelsCount);var l=0,h=0,f=0,d=0;this.nextPacket=function(){for(;l<i;l++){for(;h<=s;h++){for(;f<o;f++){var e=a.components[f];if(!(h>e.codingStyleParameters.decompositionLevelsCount)){for(var t=e.resolutions[h],r=t.precinctParameters.numprecincts;d<r;){var c=u(t,d,l);d++;return c}d=0}}f=0}h=0}throw new n("Out of packets")}}(e);break;case 1:a.packetsIterator=new function(e){for(var t=e.SIZ,r=e.currentTile.index,a=e.tiles[r],i=a.codingStyleDefaultParameters.layersCount,o=t.Csiz,s=0,c=0;c<o;c++)s=Math.max(s,a.components[c].codingStyleParameters.decompositionLevelsCount);var l=0,h=0,f=0,d=0;this.nextPacket=function(){for(;l<=s;l++){for(;h<i;h++){for(;f<o;f++){var e=a.components[f];if(!(l>e.codingStyleParameters.decompositionLevelsCount)){for(var t=e.resolutions[l],r=t.precinctParameters.numprecincts;d<r;){var c=u(t,d,h);d++;return c}d=0}}f=0}h=0}throw new n("Out of packets")}}(e);break;case 2:a.packetsIterator=new function(e){var t,r,a,i,o=e.SIZ,s=e.currentTile.index,c=e.tiles[s],l=c.codingStyleDefaultParameters.layersCount,h=o.Csiz,f=0;for(a=0;a<h;a++){var d=c.components[a];f=Math.max(f,d.codingStyleParameters.decompositionLevelsCount)}var g=new Int32Array(f+1);for(r=0;r<=f;++r){var m=0;for(a=0;a<h;++a){var p=c.components[a].resolutions;r<p.length&&(m=Math.max(m,p[r].precinctParameters.numprecincts))}g[r]=m}t=0;r=0;a=0;i=0;this.nextPacket=function(){for(;r<=f;r++){for(;i<g[r];i++){for(;a<h;a++){var e=c.components[a];if(!(r>e.codingStyleParameters.decompositionLevelsCount)){var o=e.resolutions[r],s=o.precinctParameters.numprecincts;if(!(i>=s)){for(;t<l;){var d=u(o,i,t);t++;return d}t=0}}}a=0}i=0}throw new n("Out of packets")}}(e);break;case 3:a.packetsIterator=new function(e){var t=e.SIZ,r=e.currentTile.index,a=e.tiles[r],i=a.codingStyleDefaultParameters.layersCount,o=t.Csiz,s=f(a),c=s,l=0,d=0,g=0,m=0,p=0;this.nextPacket=function(){for(;p<c.maxNumHigh;p++){for(;m<c.maxNumWide;m++){for(;g<o;g++){for(var e=a.components[g],t=e.codingStyleParameters.decompositionLevelsCount;d<=t;d++){var r=e.resolutions[d],f=s.components[g].resolutions[d],v=h(m,p,f,c,r);if(null!==v){for(;l<i;){var b=u(r,v,l);l++;return b}l=0}}d=0}g=0}m=0}throw new n("Out of packets")}}(e);break;case 4:a.packetsIterator=new function(e){var t=e.SIZ,r=e.currentTile.index,a=e.tiles[r],i=a.codingStyleDefaultParameters.layersCount,o=t.Csiz,s=f(a),c=0,l=0,d=0,g=0,m=0;this.nextPacket=function(){for(;d<o;++d){for(var e=a.components[d],t=s.components[d],r=e.codingStyleParameters.decompositionLevelsCount;m<t.maxNumHigh;m++){for(;g<t.maxNumWide;g++){for(;l<=r;l++){var f=e.resolutions[l],p=t.resolutions[l],v=h(g,m,p,t,f);if(null!==v){for(;c<i;){var b=u(f,v,c);c++;return b}c=0}}l=0}g=0}m=0}throw new n("Out of packets")}}(e);break;default:throw new n("Unsupported progression order "+x)}}function g(e,t,r,i){var n,o=0,s=0,c=!1;function l(e){for(;s<e;){var a=t[r+o];o++;if(c){n=n<<7|a;s+=7;c=!1}else{n=n<<8|a;s+=8}255===a&&(c=!0)}return n>>>(s-=e)&(1<<e)-1}function u(e){if(255===t[r+o-1]&&t[r+o]===e){h(1);return!0}if(255===t[r+o]&&t[r+o+1]===e){h(2);return!0}return!1}function h(e){o+=e}function f(){s=0;if(c){o++;c=!1}}function d(){if(0===l(1))return 1;if(0===l(1))return 2;var e=l(2);return e<3?e+3:(e=l(5))<31?e+6:(e=l(7))+37}for(var g=e.currentTile.index,m=e.tiles[g],p=e.COD.sopMarkerUsed,v=e.COD.ephMarkerUsed,w=m.packetsIterator;o<i;){f();p&&u(145)&&h(4);var k=w.nextPacket();if(l(1)){for(var S,C=k.layerNumber,x=[],_=0,A=k.codeblocks.length;_<A;_++){var P=(S=k.codeblocks[_]).precinct,I=S.cbx-P.cbxMin,O=S.cby-P.cbyMin,T=!1,E=!1;if(void 0!==S.included)T=!!l(1);else{var F,R;if(void 0!==(P=S.precinct).inclusionTree)F=P.inclusionTree;else{var B=P.cbxMax-P.cbxMin+1,D=P.cbyMax-P.cbyMin+1;F=new y(B,D,C);R=new b(B,D);P.inclusionTree=F;P.zeroBitPlanesTree=R}if(F.reset(I,O,C))for(;;){if(!l(1)){F.incrementValue(C);break}if(!F.nextLevel()){S.included=!0;T=E=!0;break}}}if(T){if(E){(R=P.zeroBitPlanesTree).reset(I,O);for(;;)if(l(1)){if(!R.nextLevel())break}else R.incrementValue();S.zeroBitPlanes=R.value}for(var M=d();l(1);)S.Lblock++;var L=(0,a.log2)(M),N=l((M<1<<L?L-1:L)+S.Lblock);x.push({codeblock:S,codingpasses:M,dataLength:N})}}f();v&&u(146);for(;x.length>0;){var U=x.shift();void 0===(S=U.codeblock).data&&(S.data=[]);S.data.push({data:t,start:r+o,end:r+o+U.dataLength,codingpasses:U.codingpasses});o+=U.dataLength}}}return o}function m(e,t,r,a,n,o,s,c){for(var l=a.tbx0,u=a.tby0,h=a.tbx1-a.tbx0,f=a.codeblocks,d="H"===a.type.charAt(0)?1:0,g="H"===a.type.charAt(1)?t:0,m=0,p=f.length;m<p;++m){var v=f[m],b=v.tbx1_-v.tbx0_,y=v.tby1_-v.tby0_;if(0!==b&&0!==y&&void 0!==v.data){var k,S;k=new w(b,y,v.subbandType,v.zeroBitPlanes,o);S=2;var C,x,_,A=v.data,P=0,I=0;for(C=0,x=A.length;C<x;C++){P+=(_=A[C]).end-_.start;I+=_.codingpasses}var O=new Uint8Array(P),T=0;for(C=0,x=A.length;C<x;C++){var E=(_=A[C]).data.subarray(_.start,_.end);O.set(E,T);T+=E.length}var F=new i.ArithmeticDecoder(O,0,P);k.setDecoder(F);for(C=0;C<I;C++){switch(S){case 0:k.runSignificancePropagationPass();break;case 1:k.runMagnitudeRefinementPass();break;case 2:k.runCleanupPass();c&&k.checkSegmentationSymbol()}S=(S+1)%3}var R,B,D,M=v.tbx0_-l+(v.tby0_-u)*h,L=k.coefficentsSign,N=k.coefficentsMagnitude,U=k.bitsDecoded,q=s?0:.5;T=0;var j="LL"!==a.type;for(C=0;C<y;C++){var z=2*(M/h|0)*(t-h)+d+g;for(R=0;R<b;R++){if(0!==(B=N[T])){B=(B+q)*n;0!==L[T]&&(B=-B);D=U[T];var H=j?z+(M<<1):M;e[H]=s&&D>=o?B:B*(1<<o-D)}M++;T++}M+=h-b}}}}function p(t,r,a){for(var i=r.components[a],n=i.codingStyleParameters,o=i.quantizationParameters,s=n.decompositionLevelsCount,c=o.SPqcds,l=o.scalarExpounded,u=o.guardBits,h=n.segmentationSymbolUsed,f=t.components[a].precision,d=n.reversibleTransformation,g=d?new C:new S,p=[],v=0,b=0;b<=s;b++){for(var y=i.resolutions[b],w=y.trx1-y.trx0,k=y.try1-y.try0,x=new Float32Array(w*k),_=0,A=y.subbands.length;_<A;_++){var P,I;if(l){P=c[v].mu;I=c[v].epsilon;v++}else{P=c[0].mu;I=c[0].epsilon+(b>0?1-b:0)}var O=y.subbands[_],T=e[O.type];m(x,w,0,O,d?1:Math.pow(2,f+T-I)*(1+P/2048),u+I-1,d,h)}p.push({width:w,height:k,items:x})}var E=g.calculate(p,i.tcx0,i.tcy0);return{left:i.tcx0,top:i.tcy0,width:E.width,height:E.height,items:E.items}}function v(e,t){for(var r=e.SIZ.Csiz,a=e.tiles[t],i=0;i<r;i++){var n=a.components[i],o=void 0!==e.currentTile.QCC[i]?e.currentTile.QCC[i]:e.currentTile.QCD;n.quantizationParameters=o;var s=void 0!==e.currentTile.COC[i]?e.currentTile.COC[i]:e.currentTile.COD;n.codingStyleParameters=s}a.codingStyleDefaultParameters=e.currentTile.COD}var b=function(){function e(e,t){var r=(0,a.log2)(Math.max(e,t))+1;this.levels=[];for(var i=0;i<r;i++){var n={width:e,height:t,items:[]};this.levels.push(n);e=Math.ceil(e/2);t=Math.ceil(t/2)}}e.prototype={reset:function(e,t){for(var r,a=0,i=0;a<this.levels.length;){var n=e+t*(r=this.levels[a]).width;if(void 0!==r.items[n]){i=r.items[n];break}r.index=n;e>>=1;t>>=1;a++}a--;(r=this.levels[a]).items[r.index]=i;this.currentLevel=a;delete this.value},incrementValue:function(){var e=this.levels[this.currentLevel];e.items[e.index]++},nextLevel:function(){var e=this.currentLevel,t=this.levels[e],r=t.items[t.index];if(--e<0){this.value=r;return!1}this.currentLevel=e;(t=this.levels[e]).items[t.index]=r;return!0}};return e}(),y=function(){function e(e,t,r){var i=(0,a.log2)(Math.max(e,t))+1;this.levels=[];for(var n=0;n<i;n++){for(var o=new Uint8Array(e*t),s=0,c=o.length;s<c;s++)o[s]=r;var l={width:e,height:t,items:o};this.levels.push(l);e=Math.ceil(e/2);t=Math.ceil(t/2)}}e.prototype={reset:function(e,t,r){for(var a=0;a<this.levels.length;){var i=this.levels[a],n=e+t*i.width;i.index=n;var o=i.items[n];if(255===o)break;if(o>r){this.currentLevel=a;this.propagateValues();return!1}e>>=1;t>>=1;a++}this.currentLevel=a-1;return!0},incrementValue:function(e){var t=this.levels[this.currentLevel];t.items[t.index]=e+1;this.propagateValues()},propagateValues:function(){for(var e=this.currentLevel,t=this.levels[e],r=t.items[t.index];--e>=0;)(t=this.levels[e]).items[t.index]=r},nextLevel:function(){var e=this.currentLevel,t=this.levels[e],r=t.items[t.index];t.items[t.index]=255;if(--e<0)return!1;this.currentLevel=e;(t=this.levels[e]).items[t.index]=r;return!0}};return e}(),w=function(){var e=new Uint8Array([0,5,8,0,3,7,8,0,4,7,8,0,0,0,0,0,1,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8]),t=new Uint8Array([0,3,4,0,5,7,7,0,8,8,8,0,0,0,0,0,1,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8]),r=new Uint8Array([0,1,2,0,1,2,2,0,2,2,2,0,0,0,0,0,3,4,5,0,4,5,5,0,5,5,5,0,0,0,0,0,6,7,7,0,7,7,7,0,7,7,7,0,0,0,0,0,8,8,8,0,8,8,8,0,8,8,8,0,0,0,0,0,8,8,8,0,8,8,8,0,8,8,8]);function a(a,i,n,o,s){this.width=a;this.height=i;this.contextLabelTable="HH"===n?r:"HL"===n?t:e;var c=a*i;this.neighborsSignificance=new Uint8Array(c);this.coefficentsSign=new Uint8Array(c);this.coefficentsMagnitude=s>14?new Uint32Array(c):s>6?new Uint16Array(c):new Uint8Array(c);this.processingFlags=new Uint8Array(c);var l=new Uint8Array(c);if(0!==o)for(var u=0;u<c;u++)l[u]=o;this.bitsDecoded=l;this.reset()}a.prototype={setDecoder:function(e){this.decoder=e},reset:function(){this.contexts=new Int8Array(19);this.contexts[0]=8;this.contexts[17]=92;this.contexts[18]=6},setNeighborsSignificance:function(e,t,r){var a,i=this.neighborsSignificance,n=this.width,o=this.height,s=t>0,c=t+1<n;if(e>0){a=r-n;s&&(i[a-1]+=16);c&&(i[a+1]+=16);i[a]+=4}if(e+1<o){a=r+n;s&&(i[a-1]+=16);c&&(i[a+1]+=16);i[a]+=4}s&&(i[r-1]+=1);c&&(i[r+1]+=1);i[r]|=128},runSignificancePropagationPass:function(){for(var e=this.decoder,t=this.width,r=this.height,a=this.coefficentsMagnitude,i=this.coefficentsSign,n=this.neighborsSignificance,o=this.processingFlags,s=this.contexts,c=this.contextLabelTable,l=this.bitsDecoded,u=0;u<r;u+=4)for(var h=0;h<t;h++)for(var f=u*t+h,d=0;d<4;d++,f+=t){var g=u+d;if(g>=r)break;o[f]&=-2;if(!a[f]&&n[f]){var m=c[n[f]];if(e.readBit(s,m)){var p=this.decodeSignBit(g,h,f);i[f]=p;a[f]=1;this.setNeighborsSignificance(g,h,f);o[f]|=2}l[f]++;o[f]|=1}}},decodeSignBit:function(e,t,r){var a,i,n,o,s,c,l=this.width,u=this.height,h=this.coefficentsMagnitude,f=this.coefficentsSign;o=t>0&&0!==h[r-1];if(t+1<l&&0!==h[r+1]){n=f[r+1];a=o?1-n-(i=f[r-1]):1-n-n}else a=o?1-(i=f[r-1])-i:0;var d=3*a;o=e>0&&0!==h[r-l];if(e+1<u&&0!==h[r+l]){n=f[r+l];a=o?1-n-(i=f[r-l])+d:1-n-n+d}else a=o?1-(i=f[r-l])-i+d:d;if(a>=0){s=9+a;c=this.decoder.readBit(this.contexts,s)}else{s=9-a;c=1^this.decoder.readBit(this.contexts,s)}return c},runMagnitudeRefinementPass:function(){for(var e,t=this.decoder,r=this.width,a=this.height,i=this.coefficentsMagnitude,n=this.neighborsSignificance,o=this.contexts,s=this.bitsDecoded,c=this.processingFlags,l=r*a,u=4*r,h=0;h<l;h=e){e=Math.min(l,h+u);for(var f=0;f<r;f++)for(var d=h+f;d<e;d+=r)if(i[d]&&0==(1&c[d])){var g=16;if(0!=(2&c[d])){c[d]^=2;g=0===(127&n[d])?15:14}var m=t.readBit(o,g);i[d]=i[d]<<1|m;s[d]++;c[d]|=1}}},runCleanupPass:function(){for(var e,t=this.decoder,r=this.width,a=this.height,i=this.neighborsSignificance,n=this.coefficentsMagnitude,o=this.coefficentsSign,s=this.contexts,c=this.contextLabelTable,l=this.bitsDecoded,u=this.processingFlags,h=r,f=2*r,d=3*r,g=0;g<a;g=e){e=Math.min(g+4,a);for(var m=g*r,p=g+3<a,v=0;v<r;v++){var b,y=m+v,w=0,k=y,S=g;if(p&&0===u[y]&&0===u[y+h]&&0===u[y+f]&&0===u[y+d]&&0===i[y]&&0===i[y+h]&&0===i[y+f]&&0===i[y+d]){if(!t.readBit(s,18)){l[y]++;l[y+h]++;l[y+f]++;l[y+d]++;continue}if(0!==(w=t.readBit(s,17)<<1|t.readBit(s,17))){S=g+w;k+=w*r}b=this.decodeSignBit(S,v,k);o[k]=b;n[k]=1;this.setNeighborsSignificance(S,v,k);u[k]|=2;k=y;for(var C=g;C<=S;C++,k+=r)l[k]++;w++}for(S=g+w;S<e;S++,k+=r)if(!n[k]&&0==(1&u[k])){var x=c[i[k]];if(1===t.readBit(s,x)){b=this.decodeSignBit(S,v,k);o[k]=b;n[k]=1;this.setNeighborsSignificance(S,v,k);u[k]|=2}l[k]++}}}},checkSegmentationSymbol:function(){var e=this.decoder,t=this.contexts;if(10!==(e.readBit(t,17)<<3|e.readBit(t,17)<<2|e.readBit(t,17)<<1|e.readBit(t,17)))throw new n("Invalid segmentation symbol")}};return a}(),k=function(){function e(){}e.prototype.calculate=function(e,t,r){for(var a=e[0],i=1,n=e.length;i<n;i++)a=this.iterate(a,e[i],t,r);return a};e.prototype.extend=function(e,t,r){var a=t-1,i=t+1,n=t+r-2,o=t+r;e[a--]=e[i++];e[o++]=e[n--];e[a--]=e[i++];e[o++]=e[n--];e[a--]=e[i++];e[o++]=e[n--];e[a]=e[i];e[o]=e[n]};e.prototype.iterate=function(e,t,r,a){var i,n,o,s,c,l,u=e.width,h=e.height,f=e.items,d=t.width,g=t.height,m=t.items;for(o=0,i=0;i<h;i++){s=2*i*d;for(n=0;n<u;n++,o++,s+=2)m[s]=f[o]}f=e.items=null;var p=new Float32Array(d+8);if(1===d){if(0!=(1&r))for(l=0,o=0;l<g;l++,o+=d)m[o]*=.5}else for(l=0,o=0;l<g;l++,o+=d){p.set(m.subarray(o,o+d),4);this.extend(p,4,d);this.filter(p,4,d);m.set(p.subarray(4,4+d),o)}var v=16,b=[];for(i=0;i<v;i++)b.push(new Float32Array(g+8));var y,w=0;e=4+g;if(1===g){if(0!=(1&a))for(c=0;c<d;c++)m[c]*=.5}else for(c=0;c<d;c++){if(0===w){v=Math.min(d-c,v);for(o=c,s=4;s<e;o+=d,s++)for(y=0;y<v;y++)b[y][s]=m[o+y];w=v}var k=b[--w];this.extend(k,4,g);this.filter(k,4,g);if(0===w){o=c-v+1;for(s=4;s<e;o+=d,s++)for(y=0;y<v;y++)m[o+y]=b[y][s]}}return{width:d,height:g,items:m}};return e}(),S=function(){function e(){k.call(this)}e.prototype=Object.create(k.prototype);e.prototype.filter=function(e,t,r){var a,i,n,o,s=r>>1,c=-1.586134342059924,l=-.052980118572961,u=.882911075530934,h=.443506852043971,f=1.230174104914001;a=(t|=0)-3;for(i=s+4;i--;a+=2)e[a]*=.8128930661159609;n=h*e[(a=t-2)-1];for(i=s+3;i--;a+=2){o=h*e[a+1];e[a]=f*e[a]-n-o;if(!i--)break;n=h*e[(a+=2)+1];e[a]=f*e[a]-n-o}n=u*e[(a=t-1)-1];for(i=s+2;i--;a+=2){o=u*e[a+1];e[a]-=n+o;if(!i--)break;n=u*e[(a+=2)+1];e[a]-=n+o}n=l*e[(a=t)-1];for(i=s+1;i--;a+=2){o=l*e[a+1];e[a]-=n+o;if(!i--)break;n=l*e[(a+=2)+1];e[a]-=n+o}if(0!==s){n=c*e[(a=t+1)-1];for(i=s;i--;a+=2){o=c*e[a+1];e[a]-=n+o;if(!i--)break;n=c*e[(a+=2)+1];e[a]-=n+o}}};return e}(),C=function(){function e(){k.call(this)}e.prototype=Object.create(k.prototype);e.prototype.filter=function(e,t,r){var a,i,n=r>>1;for(a=t|=0,i=n+1;i--;a+=2)e[a]-=e[a-1]+e[a+1]+2>>2;for(a=t+1,i=n;i--;a+=2)e[a]+=e[a-1]+e[a+1]>>1};return e}();return t}();t.JpxImage=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.calculateSHA512=t.calculateSHA384=t.calculateSHA256=t.calculateMD5=t.PDF20=t.PDF17=t.CipherTransformFactory=t.ARCFourCipher=t.AES256Cipher=t.AES128Cipher=void 0;var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1;a.configurable=!0;"value"in a&&(a.writable=!0);Object.defineProperty(e,a.key,a)}}return function(t,r,a){r&&e(t.prototype,r);a&&e(t,a);return t}}(),i=r(2),n=r(138),o=r(140);function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var u=function(){function e(e){this.a=0;this.b=0;var t,r,a=new Uint8Array(256),i=0,n=e.length;for(t=0;t<256;++t)a[t]=t;for(t=0;t<256;++t){i=i+(r=a[t])+e[t%n]&255;a[t]=a[i];a[i]=r}this.s=a}e.prototype={encryptBlock:function(e){var t,r,a,i=e.length,n=this.a,o=this.b,s=this.s,c=new Uint8Array(i);for(t=0;t<i;++t){a=s[o=o+(r=s[n=n+1&255])&255];s[n]=a;s[o]=r;c[t]=e[t]^s[r+a&255]}this.a=n;this.b=o;return c}};e.prototype.decryptBlock=e.prototype.encryptBlock;return e}(),h=function(){var e=new Uint8Array([7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21]),t=new Int32Array([-680876936,-389564586,606105819,-1044525330,-176418897,1200080426,-1473231341,-45705983,1770035416,-1958414417,-42063,-1990404162,1804603682,-40341101,-1502002290,1236535329,-165796510,-1069501632,643717713,-373897302,-701558691,38016083,-660478335,-405537848,568446438,-1019803690,-187363961,1163531501,-1444681467,-51403784,1735328473,-1926607734,-378558,-2022574463,1839030562,-35309556,-1530992060,1272893353,-155497632,-1094730640,681279174,-358537222,-722521979,76029189,-640364487,-421815835,530742520,-995338651,-198630844,1126891415,-1416354905,-57434055,1700485571,-1894986606,-1051523,-2054922799,1873313359,-30611744,-1560198380,1309151649,-145523070,-1120210379,718787259,-343485551]);return function(r,a,i){var n,o,s,c=1732584193,l=-271733879,u=-1732584194,h=271733878,f=i+72&-64,d=new Uint8Array(f);for(n=0;n<i;++n)d[n]=r[a++];d[n++]=128;s=f-8;for(;n<s;)d[n++]=0;d[n++]=i<<3&255;d[n++]=i>>5&255;d[n++]=i>>13&255;d[n++]=i>>21&255;d[n++]=i>>>29&255;d[n++]=0;d[n++]=0;d[n++]=0;var g=new Int32Array(16);for(n=0;n<f;){for(o=0;o<16;++o,n+=4)g[o]=d[n]|d[n+1]<<8|d[n+2]<<16|d[n+3]<<24;var m,p,v=c,b=l,y=u,w=h;for(o=0;o<64;++o){if(o<16){m=b&y|~b&w;p=o}else if(o<32){m=w&b|~w&y;p=5*o+1&15}else if(o<48){m=b^y^w;p=3*o+5&15}else{m=y^(b|~w);p=7*o&15}var k=w,S=v+m+t[o]+g[p]|0,C=e[o];w=y;y=b;b=b+(S<<C|S>>>32-C)|0;v=k}c=c+v|0;l=l+b|0;u=u+y|0;h=h+w|0}return new Uint8Array([255&c,c>>8&255,c>>16&255,c>>>24&255,255&l,l>>8&255,l>>16&255,l>>>24&255,255&u,u>>8&255,u>>16&255,u>>>24&255,255&h,h>>8&255,h>>16&255,h>>>24&255])}}(),f=function(){function e(e,t){this.high=0|e;this.low=0|t}e.prototype={and:function(e){this.high&=e.high;this.low&=e.low},xor:function(e){this.high^=e.high;this.low^=e.low},or:function(e){this.high|=e.high;this.low|=e.low},shiftRight:function(e){if(e>=32){this.low=this.high>>>e-32|0;this.high=0}else{this.low=this.low>>>e|this.high<<32-e;this.high=this.high>>>e|0}},shiftLeft:function(e){if(e>=32){this.high=this.low<<e-32;this.low=0}else{this.high=this.high<<e|this.low>>>32-e;this.low=this.low<<e}},rotateRight:function(e){var t,r;if(32&e){r=this.low;t=this.high}else{t=this.low;r=this.high}e&=31;this.low=t>>>e|r<<32-e;this.high=r>>>e|t<<32-e},not:function(){this.high=~this.high;this.low=~this.low},add:function(e){var t=(this.low>>>0)+(e.low>>>0),r=(this.high>>>0)+(e.high>>>0);t>4294967295&&(r+=1);this.low=0|t;this.high=0|r},copyTo:function(e,t){e[t]=this.high>>>24&255;e[t+1]=this.high>>16&255;e[t+2]=this.high>>8&255;e[t+3]=255&this.high;e[t+4]=this.low>>>24&255;e[t+5]=this.low>>16&255;e[t+6]=this.low>>8&255;e[t+7]=255&this.low},assign:function(e){this.high=e.high;this.low=e.low}};return e}(),d=function(){function e(e,t){return e>>>t|e<<32-t}function t(e,t,r){return e&t^~e&r}function r(e,t,r){return e&t^e&r^t&r}function a(t){return e(t,2)^e(t,13)^e(t,22)}function i(t){return e(t,6)^e(t,11)^e(t,25)}function n(t){return e(t,7)^e(t,18)^t>>>3}var o=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];return function(s,c,l){var u,h,f,d=1779033703,g=3144134277,m=1013904242,p=2773480762,v=1359893119,b=2600822924,y=528734635,w=1541459225,k=64*Math.ceil((l+9)/64),S=new Uint8Array(k);for(u=0;u<l;++u)S[u]=s[c++];S[u++]=128;f=k-8;for(;u<f;)S[u++]=0;S[u++]=0;S[u++]=0;S[u++]=0;S[u++]=l>>>29&255;S[u++]=l>>21&255;S[u++]=l>>13&255;S[u++]=l>>5&255;S[u++]=l<<3&255;var C,x=new Uint32Array(64);for(u=0;u<k;){for(h=0;h<16;++h){x[h]=S[u]<<24|S[u+1]<<16|S[u+2]<<8|S[u+3];u+=4}for(h=16;h<64;++h)x[h]=(e(C=x[h-2],17)^e(C,19)^C>>>10)+x[h-7]+n(x[h-15])+x[h-16]|0;var _,A,P=d,I=g,O=m,T=p,E=v,F=b,R=y,B=w;for(h=0;h<64;++h){_=B+i(E)+t(E,F,R)+o[h]+x[h];A=a(P)+r(P,I,O);B=R;R=F;F=E;E=T+_|0;T=O;O=I;I=P;P=_+A|0}d=d+P|0;g=g+I|0;m=m+O|0;p=p+T|0;v=v+E|0;b=b+F|0;y=y+R|0;w=w+B|0}return new Uint8Array([d>>24&255,d>>16&255,d>>8&255,255&d,g>>24&255,g>>16&255,g>>8&255,255&g,m>>24&255,m>>16&255,m>>8&255,255&m,p>>24&255,p>>16&255,p>>8&255,255&p,v>>24&255,v>>16&255,v>>8&255,255&v,b>>24&255,b>>16&255,b>>8&255,255&b,y>>24&255,y>>16&255,y>>8&255,255&y,w>>24&255,w>>16&255,w>>8&255,255&w])}}(),g=function(){function e(e,t,r,a,i){e.assign(t);e.and(r);i.assign(t);i.not();i.and(a);e.xor(i)}function t(e,t,r,a,i){e.assign(t);e.and(r);i.assign(t);i.and(a);e.xor(i);i.assign(r);i.and(a);e.xor(i)}function r(e,t,r){e.assign(t);e.rotateRight(28);r.assign(t);r.rotateRight(34);e.xor(r);r.assign(t);r.rotateRight(39);e.xor(r)}function a(e,t,r){e.assign(t);e.rotateRight(14);r.assign(t);r.rotateRight(18);e.xor(r);r.assign(t);r.rotateRight(41);e.xor(r)}function i(e,t,r){e.assign(t);e.rotateRight(1);r.assign(t);r.rotateRight(8);e.xor(r);r.assign(t);r.shiftRight(7);e.xor(r)}function n(e,t,r){e.assign(t);e.rotateRight(19);r.assign(t);r.rotateRight(61);e.xor(r);r.assign(t);r.shiftRight(6);e.xor(r)}var o=[new f(1116352408,3609767458),new f(1899447441,602891725),new f(3049323471,3964484399),new f(3921009573,2173295548),new f(961987163,4081628472),new f(1508970993,3053834265),new f(2453635748,2937671579),new f(2870763221,3664609560),new f(3624381080,2734883394),new f(310598401,1164996542),new f(607225278,1323610764),new f(1426881987,3590304994),new f(1925078388,4068182383),new f(2162078206,991336113),new f(2614888103,633803317),new f(3248222580,3479774868),new f(3835390401,2666613458),new f(4022224774,944711139),new f(264347078,2341262773),new f(604807628,2007800933),new f(770255983,1495990901),new f(1249150122,1856431235),new f(1555081692,3175218132),new f(1996064986,2198950837),new f(2554220882,3999719339),new f(2821834349,766784016),new f(2952996808,2566594879),new f(3210313671,3203337956),new f(3336571891,1034457026),new f(3584528711,2466948901),new f(113926993,3758326383),new f(338241895,168717936),new f(666307205,1188179964),new f(773529912,1546045734),new f(1294757372,1522805485),new f(1396182291,2643833823),new f(1695183700,2343527390),new f(1986661051,1014477480),new f(2177026350,1206759142),new f(2456956037,344077627),new f(2730485921,1290863460),new f(2820302411,3158454273),new f(3259730800,3505952657),new f(3345764771,106217008),new f(3516065817,3606008344),new f(3600352804,1432725776),new f(4094571909,1467031594),new f(275423344,851169720),new f(430227734,3100823752),new f(506948616,1363258195),new f(659060556,3750685593),new f(883997877,3785050280),new f(958139571,3318307427),new f(1322822218,3812723403),new f(1537002063,2003034995),new f(1747873779,3602036899),new f(1955562222,1575990012),new f(2024104815,1125592928),new f(2227730452,2716904306),new f(2361852424,442776044),new f(2428436474,593698344),new f(2756734187,3733110249),new f(3204031479,2999351573),new f(3329325298,3815920427),new f(3391569614,3928383900),new f(3515267271,566280711),new f(3940187606,3454069534),new f(4118630271,4000239992),new f(116418474,1914138554),new f(174292421,2731055270),new f(289380356,3203993006),new f(460393269,320620315),new f(685471733,587496836),new f(852142971,1086792851),new f(1017036298,365543100),new f(1126000580,2618297676),new f(1288033470,3409855158),new f(1501505948,4234509866),new f(1607167915,987167468),new f(1816402316,1246189591)];return function(s,c,l,u){var h,d,g,m,p,v,b,y;if(u=!!u){h=new f(3418070365,3238371032);d=new f(1654270250,914150663);g=new f(2438529370,812702999);m=new f(355462360,4144912697);p=new f(1731405415,4290775857);v=new f(2394180231,1750603025);b=new f(3675008525,1694076839);y=new f(1203062813,3204075428)}else{h=new f(1779033703,4089235720);d=new f(3144134277,2227873595);g=new f(1013904242,4271175723);m=new f(2773480762,1595750129);p=new f(1359893119,2917565137);v=new f(2600822924,725511199);b=new f(528734635,4215389547);y=new f(1541459225,327033209)}var w,k,S,C=128*Math.ceil((l+17)/128),x=new Uint8Array(C);for(w=0;w<l;++w)x[w]=s[c++];x[w++]=128;S=C-16;for(;w<S;)x[w++]=0;x[w++]=0;x[w++]=0;x[w++]=0;x[w++]=0;x[w++]=0;x[w++]=0;x[w++]=0;x[w++]=0;x[w++]=0;x[w++]=0;x[w++]=0;x[w++]=l>>>29&255;x[w++]=l>>21&255;x[w++]=l>>13&255;x[w++]=l>>5&255;x[w++]=l<<3&255;var _=new Array(80);for(w=0;w<80;w++)_[w]=new f(0,0);var A,P,I=new f(0,0),O=new f(0,0),T=new f(0,0),E=new f(0,0),F=new f(0,0),R=new f(0,0),B=new f(0,0),D=new f(0,0),M=new f(0,0),L=new f(0,0),N=new f(0,0),U=new f(0,0);for(w=0;w<C;){for(k=0;k<16;++k){_[k].high=x[w]<<24|x[w+1]<<16|x[w+2]<<8|x[w+3];_[k].low=x[w+4]<<24|x[w+5]<<16|x[w+6]<<8|x[w+7];w+=8}for(k=16;k<80;++k){n(A=_[k],_[k-2],U);A.add(_[k-7]);i(N,_[k-15],U);A.add(N);A.add(_[k-16])}I.assign(h);O.assign(d);T.assign(g);E.assign(m);F.assign(p);R.assign(v);B.assign(b);D.assign(y);for(k=0;k<80;++k){M.assign(D);a(N,F,U);M.add(N);e(N,F,R,B,U);M.add(N);M.add(o[k]);M.add(_[k]);r(L,I,U);t(N,I,O,T,U);L.add(N);A=D;D=B;B=R;R=F;E.add(M);F=E;E=T;T=O;O=I;A.assign(M);A.add(L);I=A}h.add(I);d.add(O);g.add(T);m.add(E);p.add(F);v.add(R);b.add(B);y.add(D)}if(u){P=new Uint8Array(48);h.copyTo(P,0);d.copyTo(P,8);g.copyTo(P,16);m.copyTo(P,24);p.copyTo(P,32);v.copyTo(P,40)}else{P=new Uint8Array(64);h.copyTo(P,0);d.copyTo(P,8);g.copyTo(P,16);m.copyTo(P,24);p.copyTo(P,32);v.copyTo(P,40);b.copyTo(P,48);y.copyTo(P,56)}return P}}(),m=function(){return function(e,t,r){return g(e,t,r,!0)}}(),p=function(){function e(){}e.prototype={decryptBlock:function(e){return e}};return e}(),v=function(){function e(){l(this,e);this.constructor===e&&(0,i.unreachable)("Cannot initialize AESBaseCipher.");this._s=new Uint8Array([99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22]);this._inv_s=new Uint8Array([82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125]);this._mix=new Uint32Array([0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795]);this._mixCol=new Uint8Array(256);for(var t=0;t<256;t++)this._mixCol[t]=t<128?t<<1:t<<1^27;this.buffer=new Uint8Array(16);this.bufferPosition=0}a(e,[{key:"_expandKey",value:function(e){(0,i.unreachable)("Cannot call `_expandKey` on the base class")}},{key:"_decrypt",value:function(e,t){var r=void 0,a=void 0,i=void 0,n=new Uint8Array(16);n.set(e);for(var o=0,s=this._keySize;o<16;++o,++s)n[o]^=t[s];for(var c=this._cyclesOfRepetition-1;c>=1;--c){r=n[13];n[13]=n[9];n[9]=n[5];n[5]=n[1];n[1]=r;r=n[14];a=n[10];n[14]=n[6];n[10]=n[2];n[6]=r;n[2]=a;r=n[15];a=n[11];i=n[7];n[15]=n[3];n[11]=r;n[7]=a;n[3]=i;for(var l=0;l<16;++l)n[l]=this._inv_s[n[l]];for(var u=0,h=16*c;u<16;++u,++h)n[u]^=t[h];for(var f=0;f<16;f+=4){var d=this._mix[n[f]],g=this._mix[n[f+1]],m=this._mix[n[f+2]],p=this._mix[n[f+3]];r=d^g>>>8^g<<24^m>>>16^m<<16^p>>>24^p<<8;n[f]=r>>>24&255;n[f+1]=r>>16&255;n[f+2]=r>>8&255;n[f+3]=255&r}}r=n[13];n[13]=n[9];n[9]=n[5];n[5]=n[1];n[1]=r;r=n[14];a=n[10];n[14]=n[6];n[10]=n[2];n[6]=r;n[2]=a;r=n[15];a=n[11];i=n[7];n[15]=n[3];n[11]=r;n[7]=a;n[3]=i;for(var v=0;v<16;++v){n[v]=this._inv_s[n[v]];n[v]^=t[v]}return n}},{key:"_encrypt",value:function(e,t){var r=this._s,a=void 0,i=void 0,n=void 0,o=new Uint8Array(16);o.set(e);for(var s=0;s<16;++s)o[s]^=t[s];for(var c=1;c<this._cyclesOfRepetition;c++){for(var l=0;l<16;++l)o[l]=r[o[l]];n=o[1];o[1]=o[5];o[5]=o[9];o[9]=o[13];o[13]=n;n=o[2];i=o[6];o[2]=o[10];o[6]=o[14];o[10]=n;o[14]=i;n=o[3];i=o[7];a=o[11];o[3]=o[15];o[7]=n;o[11]=i;o[15]=a;for(var u=0;u<16;u+=4){var h=o[u+0],f=o[u+1],d=o[u+2],g=o[u+3];a=h^f^d^g;o[u+0]^=a^this._mixCol[h^f];o[u+1]^=a^this._mixCol[f^d];o[u+2]^=a^this._mixCol[d^g];o[u+3]^=a^this._mixCol[g^h]}for(var m=0,p=16*c;m<16;++m,++p)o[m]^=t[p]}for(var v=0;v<16;++v)o[v]=r[o[v]];n=o[1];o[1]=o[5];o[5]=o[9];o[9]=o[13];o[13]=n;n=o[2];i=o[6];o[2]=o[10];o[6]=o[14];o[10]=n;o[14]=i;n=o[3];i=o[7];a=o[11];o[3]=o[15];o[7]=n;o[11]=i;o[15]=a;for(var b=0,y=this._keySize;b<16;++b,++y)o[b]^=t[y];return o}},{key:"_decryptBlock2",value:function(e,t){for(var r=e.length,a=this.buffer,i=this.bufferPosition,n=[],o=this.iv,s=0;s<r;++s){a[i]=e[s];if(!(++i<16)){for(var c=this._decrypt(a,this._key),l=0;l<16;++l)c[l]^=o[l];o=a;n.push(c);a=new Uint8Array(16);i=0}}this.buffer=a;this.bufferLength=i;this.iv=o;if(0===n.length)return new Uint8Array(0);var u=16*n.length;if(t){var h=n[n.length-1],f=h[15];if(f<=16){for(var d=15,g=16-f;d>=g;--d)if(h[d]!==f){f=0;break}u-=f;n[n.length-1]=h.subarray(0,16-f)}}for(var m=new Uint8Array(u),p=0,v=0,b=n.length;p<b;++p,v+=16)m.set(n[p],v);return m}},{key:"decryptBlock",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=e.length,i=this.buffer,n=this.bufferPosition;if(r)this.iv=r;else{for(var o=0;n<16&&o<a;++o,++n)i[n]=e[o];if(n<16){this.bufferLength=n;return new Uint8Array(0)}this.iv=i;e=e.subarray(16)}this.buffer=new Uint8Array(16);this.bufferLength=0;this.decryptBlock=this._decryptBlock2;return this.decryptBlock(e,t)}},{key:"encrypt",value:function(e,t){var r=e.length,a=this.buffer,i=this.bufferPosition,n=[];t||(t=new Uint8Array(16));for(var o=0;o<r;++o){a[i]=e[o];if(!(++i<16)){for(var s=0;s<16;++s)a[s]^=t[s];var c=this._encrypt(a,this._key);t=c;n.push(c);a=new Uint8Array(16);i=0}}this.buffer=a;this.bufferLength=i;this.iv=t;if(0===n.length)return new Uint8Array(0);for(var l=16*n.length,u=new Uint8Array(l),h=0,f=0,d=n.length;h<d;++h,f+=16)u.set(n[h],f);return u}}]);return e}(),b=function(e){c(t,v);function t(e){l(this,t);var r=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));r._cyclesOfRepetition=10;r._keySize=160;r._rcon=new Uint8Array([141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141]);r._key=r._expandKey(e);return r}a(t,[{key:"_expandKey",value:function(e){var t=this._s,r=this._rcon,a=new Uint8Array(176);a.set(e);for(var i=16,n=1;i<176;++n){var o=a[i-3],s=a[i-2],c=a[i-1],l=a[i-4];o=t[o];s=t[s];c=t[c];l=t[l];o^=r[n];for(var u=0;u<4;++u){a[i]=o^=a[i-16];a[++i]=s^=a[i-16];a[++i]=c^=a[i-16];a[++i]=l^=a[i-16];i++}}return a}}]);return t}(),y=function(e){c(t,v);function t(e){l(this,t);var r=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));r._cyclesOfRepetition=14;r._keySize=224;r._key=r._expandKey(e);return r}a(t,[{key:"_expandKey",value:function(e){var t=this._s,r=new Uint8Array(240);r.set(e);for(var a=1,i=void 0,n=void 0,o=void 0,s=void 0,c=32,l=1;c<240;++l){if(c%32==16){i=t[i];n=t[n];o=t[o];s=t[s]}else if(c%32==0){i=r[c-3];n=r[c-2];o=r[c-1];s=r[c-4];i=t[i];n=t[n];o=t[o];s=t[s];i^=a;(a<<=1)>=256&&(a=255&(27^a))}for(var u=0;u<4;++u){r[c]=i^=r[c-32];r[++c]=n^=r[c-32];r[++c]=o^=r[c-32];r[++c]=s^=r[c-32];c++}}return r}}]);return t}(),w=function(){function e(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function t(){}t.prototype={checkOwnerPassword:function(t,r,a,i){var n=new Uint8Array(t.length+56);n.set(t,0);n.set(r,t.length);n.set(a,t.length+r.length);return e(d(n,0,n.length),i)},checkUserPassword:function(t,r,a){var i=new Uint8Array(t.length+8);i.set(t,0);i.set(r,t.length);return e(d(i,0,i.length),a)},getOwnerKey:function(e,t,r,a){var i=new Uint8Array(e.length+56);i.set(e,0);i.set(t,e.length);i.set(r,e.length+t.length);var n=d(i,0,i.length);return new y(n).decryptBlock(a,!1,new Uint8Array(16))},getUserKey:function(e,t,r){var a=new Uint8Array(e.length+8);a.set(e,0);a.set(t,e.length);var i=d(a,0,a.length);return new y(i).decryptBlock(r,!1,new Uint8Array(16))}};return t}(),k=function(){function e(e,t){var r=new Uint8Array(e.length+t.length);r.set(e,0);r.set(t,e.length);return r}function t(t,r,a){for(var i=d(r,0,r.length).subarray(0,32),n=[0],o=0;o<64||n[n.length-1]>o-32;){var s=t.length+i.length+a.length,c=new Uint8Array(64*s),l=e(t,i);l=e(l,a);for(var u=0,h=0;u<64;u++,h+=s)c.set(l,h);n=new b(i.subarray(0,16)).encrypt(c,i.subarray(16,32));for(var f=0,p=0;p<16;p++){f*=1;f%=3;f+=(n[p]>>>0)%3;f%=3}0===f?i=d(n,0,n.length):1===f?i=m(n,0,n.length):2===f&&(i=g(n,0,n.length));o++}return i.subarray(0,32)}function r(){}function a(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}r.prototype={hash:function(e,r,a){return t(e,r,a)},checkOwnerPassword:function(e,r,i,n){var o=new Uint8Array(e.length+56);o.set(e,0);o.set(r,e.length);o.set(i,e.length+r.length);return a(t(e,o,i),n)},checkUserPassword:function(e,r,i){var n=new Uint8Array(e.length+8);n.set(e,0);n.set(r,e.length);return a(t(e,n,[]),i)},getOwnerKey:function(e,r,a,i){var n=new Uint8Array(e.length+56);n.set(e,0);n.set(r,e.length);n.set(a,e.length+r.length);var o=t(e,n,a);return new y(o).decryptBlock(i,!1,new Uint8Array(16))},getUserKey:function(e,r,a){var i=new Uint8Array(e.length+8);i.set(e,0);i.set(r,e.length);var n=t(e,i,[]);return new y(n).decryptBlock(a,!1,new Uint8Array(16))}};return r}(),S=function(){function e(e,t){this.StringCipherConstructor=e;this.StreamCipherConstructor=t}e.prototype={createStream:function(e,t){var r=new this.StreamCipherConstructor;return new o.DecryptStream(e,t,function(e,t){return r.decryptBlock(e,t)})},decryptString:function(e){var t=new this.StringCipherConstructor,r=(0,i.stringToBytes)(e);r=t.decryptBlock(r,!0);return(0,i.bytesToString)(r)}};return e}(),C=function(){var e=new Uint8Array([40,191,78,94,78,117,138,65,100,0,78,86,255,250,1,8,46,46,0,182,208,104,62,128,47,12,169,254,100,83,105,122]);function t(t,r,a,i,n,o,s,c){var l,f,d=40+a.length+t.length,g=new Uint8Array(d),m=0;if(r){f=Math.min(32,r.length);for(;m<f;++m)g[m]=r[m]}l=0;for(;m<32;)g[m++]=e[l++];for(l=0,f=a.length;l<f;++l)g[m++]=a[l];g[m++]=255&n;g[m++]=n>>8&255;g[m++]=n>>16&255;g[m++]=n>>>24&255;for(l=0,f=t.length;l<f;++l)g[m++]=t[l];if(o>=4&&!c){g[m++]=255;g[m++]=255;g[m++]=255;g[m++]=255}var p=h(g,0,m),v=s>>3;if(o>=3)for(l=0;l<50;++l)p=h(p,0,v);var b,y=p.subarray(0,v);if(o>=3){for(m=0;m<32;++m)g[m]=e[m];for(l=0,f=t.length;l<f;++l)g[m++]=t[l];b=new u(y).encryptBlock(h(g,0,m));f=y.length;var w,k=new Uint8Array(f);for(l=1;l<=19;++l){for(w=0;w<f;++w)k[w]=y[w]^l;b=new u(k).encryptBlock(b)}for(l=0,f=b.length;l<f;++l)if(i[l]!==b[l])return null}else for(l=0,f=(b=new u(y).encryptBlock(e)).length;l<f;++l)if(i[l]!==b[l])return null;return y}var r=n.Name.get("Identity");function a(a,o,s){var c=a.get("Filter");if(!(0,n.isName)(c,"Standard"))throw new i.FormatError("unknown encryption method");this.dict=a;var l=a.get("V");if(!Number.isInteger(l)||1!==l&&2!==l&&4!==l&&5!==l)throw new i.FormatError("unsupported encryption algorithm");this.algorithm=l;var f=a.get("Length");if(!f)if(l<=3)f=40;else{var d=a.get("CF"),g=a.get("StmF");if((0,n.isDict)(d)&&(0,n.isName)(g)){d.suppressEncryption=!0;var m=d.get(g.name);(f=m&&m.get("Length")||128)<40&&(f<<=3)}}if(!Number.isInteger(f)||f<40||f%8!=0)throw new i.FormatError("invalid key length");var p=(0,i.stringToBytes)(a.get("O")).subarray(0,32),v=(0,i.stringToBytes)(a.get("U")).subarray(0,32),b=a.get("P"),y=a.get("R"),S=(4===l||5===l)&&!1!==a.get("EncryptMetadata");this.encryptMetadata=S;var C,x,_=(0,i.stringToBytes)(o);if(s){if(6===y)try{s=(0,i.utf8StringToString)(s)}catch(e){(0,i.warn)("CipherTransformFactory: Unable to convert UTF8 encoded password.")}C=(0,i.stringToBytes)(s)}if(5!==l)x=t(_,C,p,v,b,y,f,S);else{var A=(0,i.stringToBytes)(a.get("O")).subarray(32,40),P=(0,i.stringToBytes)(a.get("O")).subarray(40,48),I=(0,i.stringToBytes)(a.get("U")).subarray(0,48),O=(0,i.stringToBytes)(a.get("U")).subarray(32,40),T=(0,i.stringToBytes)(a.get("U")).subarray(40,48),E=(0,i.stringToBytes)(a.get("OE")),F=(0,i.stringToBytes)(a.get("UE"));(0,i.stringToBytes)(a.get("Perms"));x=function(e,t,r,a,i,n,o,s,c,l,u,h){if(t){var f=Math.min(127,t.length);t=t.subarray(0,f)}else t=[];var d;return(d=6===e?new k:new w).checkUserPassword(t,s,o)?d.getUserKey(t,c,u):t.length&&d.checkOwnerPassword(t,a,n,r)?d.getOwnerKey(t,i,n,l):null}(y,C,p,A,P,I,v,O,T,E,F)}if(!x&&!s)throw new i.PasswordException("No password given",i.PasswordResponses.NEED_PASSWORD);if(!x&&s){x=t(_,function(t,r,a,i){var n,o,s=new Uint8Array(32),c=0;o=Math.min(32,t.length);for(;c<o;++c)s[c]=t[c];n=0;for(;c<32;)s[c++]=e[n++];var l,f=h(s,0,c),d=i>>3;if(a>=3)for(n=0;n<50;++n)f=h(f,0,f.length);if(a>=3){l=r;var g,m=new Uint8Array(d);for(n=19;n>=0;n--){for(g=0;g<d;++g)m[g]=f[g]^n;l=new u(m).encryptBlock(l)}}else l=new u(f.subarray(0,d)).encryptBlock(r);return l}(C,p,y,f),p,v,b,y,f,S)}if(!x)throw new i.PasswordException("Incorrect Password",i.PasswordResponses.INCORRECT_PASSWORD);this.encryptionKey=x;if(l>=4){var R=a.get("CF");(0,n.isDict)(R)&&(R.suppressEncryption=!0);this.cf=R;this.stmf=a.get("StmF")||r;this.strf=a.get("StrF")||r;this.eff=a.get("EFF")||this.stmf}}function o(e,t,r,a){var i,n,o=new Uint8Array(r.length+9);for(i=0,n=r.length;i<n;++i)o[i]=r[i];o[i++]=255&e;o[i++]=e>>8&255;o[i++]=e>>16&255;o[i++]=255&t;o[i++]=t>>8&255;if(a){o[i++]=115;o[i++]=65;o[i++]=108;o[i++]=84}return h(o,0,i).subarray(0,Math.min(r.length+5,16))}function s(e,t,r,a,s){if(!(0,n.isName)(t))throw new i.FormatError("Invalid crypt filter name.");var c,l=e.get(t.name);null!==l&&void 0!==l&&(c=l.get("CFM"));if(!c||"None"===c.name)return function(){return new p};if("V2"===c.name)return function(){return new u(o(r,a,s,!1))};if("AESV2"===c.name)return function(){return new b(o(r,a,s,!0))};if("AESV3"===c.name)return function(){return new y(s)};throw new i.FormatError("Unknown crypto method")}a.prototype={createCipherTransform:function(e,t){if(4===this.algorithm||5===this.algorithm)return new S(s(this.cf,this.stmf,e,t,this.encryptionKey),s(this.cf,this.strf,e,t,this.encryptionKey));var r=o(e,t,this.encryptionKey,!1),a=function(){return new u(r)};return new S(a,a)}};return a}();t.AES128Cipher=b;t.AES256Cipher=y;t.ARCFourCipher=u;t.CipherTransformFactory=C;t.PDF17=w;t.PDF20=k;t.calculateMD5=h;t.calculateSHA256=d;t.calculateSHA384=m;t.calculateSHA512=g},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.ColorSpace=void 0;var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1;a.configurable=!0;"value"in a&&(a.writable=!0);Object.defineProperty(e,a.key,a)}}return function(t,r,a){r&&e(t.prototype,r);a&&e(t,a);return t}}(),i=r(2),n=r(138);function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var l=function(){function e(t,r){c(this,e);this.constructor===e&&(0,i.unreachable)("Cannot initialize ColorSpace.");this.name=t;this.numComps=r}a(e,[{key:"getRgb",value:function(e,t){var r=new Uint8ClampedArray(3);this.getRgbItem(e,t,r,0);return r}},{key:"getRgbItem",value:function(e,t,r,a){(0,i.unreachable)("Should not call ColorSpace.getRgbItem")}},{key:"getRgbBuffer",value:function(e,t,r,a,n,o,s){(0,i.unreachable)("Should not call ColorSpace.getRgbBuffer")}},{key:"getOutputLength",value:function(e,t){(0,i.unreachable)("Should not call ColorSpace.getOutputLength")}},{key:"isPassthrough",value:function(e){return!1}},{key:"fillRgb",value:function(e,t,r,a,i,n,o,s,c){var l=t*r,u=null,h=1<<o,f=r!==i||t!==a;if(this.isPassthrough(o))u=s;else if(1===this.numComps&&l>h&&"DeviceGray"!==this.name&&"DeviceRGB"!==this.name){for(var d=o<=8?new Uint8Array(h):new Uint16Array(h),g=0;g<h;g++)d[g]=g;var m=new Uint8ClampedArray(3*h);this.getRgbBuffer(d,0,h,m,0,o,0);if(f){u=new Uint8Array(3*l);for(var p=0,v=0;v<l;++v){var b=3*s[v];u[p++]=m[b];u[p++]=m[b+1];u[p++]=m[b+2]}}else for(var y=0,w=0;w<l;++w){var k=3*s[w];e[y++]=m[k];e[y++]=m[k+1];e[y++]=m[k+2];y+=c}}else if(f){u=new Uint8ClampedArray(3*l);this.getRgbBuffer(s,0,l,u,0,o,0)}else this.getRgbBuffer(s,0,a*n,e,0,o,c);if(u)if(f)!function(e,t,r,a,i,n,o){o=1!==o?0:o;for(var s=r/i,c=a/n,l=0,u=void 0,h=new Uint16Array(i),f=3*r,d=0;d<i;d++)h[d]=3*Math.floor(d*s);for(var g=0;g<n;g++)for(var m=Math.floor(g*c)*f,p=0;p<i;p++){u=m+h[p];t[l++]=e[u++];t[l++]=e[u++];t[l++]=e[u++];l+=o}}(u,e,t,r,a,i,c);else for(var S=0,C=0,x=0,_=a*n;x<_;x++){e[S++]=u[C++];e[S++]=u[C++];e[S++]=u[C++];S+=c}}},{key:"usesZeroToOneRange",get:function(){return(0,i.shadow)(this,"usesZeroToOneRange",!0)}}],[{key:"parse",value:function(e,t,r,a){var i=this.parseToIR(e,t,r,a);return this.fromIR(i)}},{key:"fromIR",value:function(e){var t=Array.isArray(e)?e[0]:e,r=void 0,a=void 0,n=void 0;switch(t){case"DeviceGrayCS":return this.singletons.gray;case"DeviceRgbCS":return this.singletons.rgb;case"DeviceCmykCS":return this.singletons.cmyk;case"CalGrayCS":r=e[1];a=e[2];n=e[3];return new p(r,a,n);case"CalRGBCS":r=e[1];a=e[2];n=e[3];var o=e[4];return new v(r,a,n,o);case"PatternCS":var s=e[1];s&&(s=this.fromIR(s));return new h(s);case"IndexedCS":var c=e[1],l=e[2],d=e[3];return new f(this.fromIR(c),l,d);case"AlternateCS":var g=e[1],m=e[2],y=e[3];return new u(g,this.fromIR(m),y);case"LabCS":r=e[1];a=e[2];var w=e[3];return new b(r,a,w);default:throw new i.FormatError("Unknown colorspace name: "+t)}}},{key:"parseToIR",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments[3];e=t.fetchIfRef(e);if((0,n.isName)(e))switch(e.name){case"DeviceGray":case"G":return"DeviceGrayCS";case"DeviceRGB":case"RGB":return"DeviceRgbCS";case"DeviceCMYK":case"CMYK":return"DeviceCmykCS";case"Pattern":return["PatternCS",null];default:if((0,n.isDict)(r)){var o=r.get("ColorSpace");if((0,n.isDict)(o)){var s=o.get(e.name);if(s){if((0,n.isName)(s))return this.parseToIR(s,t,r,a);e=s;break}}}throw new i.FormatError("unrecognized colorspace "+e.name)}if(Array.isArray(e)){var c=t.fetchIfRef(e[0]).name,l=void 0,u=void 0,h=void 0;switch(c){case"DeviceGray":case"G":return"DeviceGrayCS";case"DeviceRGB":case"RGB":return"DeviceRgbCS";case"DeviceCMYK":case"CMYK":return"DeviceCmykCS";case"CalGray":return["CalGrayCS",(u=t.fetchIfRef(e[1])).getArray("WhitePoint"),u.getArray("BlackPoint"),u.get("Gamma")];case"CalRGB":return["CalRGBCS",(u=t.fetchIfRef(e[1])).getArray("WhitePoint"),u.getArray("BlackPoint"),u.getArray("Gamma"),u.getArray("Matrix")];case"ICCBased":var f=t.fetchIfRef(e[1]).dict;l=f.get("N");if(h=f.get("Alternate")){var d=this.parseToIR(h,t,r,a);if(this.fromIR(d,a).numComps===l)return d;(0,i.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.")}if(1===l)return"DeviceGrayCS";if(3===l)return"DeviceRgbCS";if(4===l)return"DeviceCmykCS";break;case"Pattern":var g=e[1]||null;g&&(g=this.parseToIR(g,t,r,a));return["PatternCS",g];case"Indexed":case"I":var m=this.parseToIR(e[1],t,r,a),p=t.fetchIfRef(e[2])+1,v=t.fetchIfRef(e[3]);(0,n.isStream)(v)&&(v=v.getBytes());return["IndexedCS",m,p,v];case"Separation":case"DeviceN":var b=t.fetchIfRef(e[1]);return["AlternateCS",l=Array.isArray(b)?b.length:1,h=this.parseToIR(e[2],t,r,a),a.create(t.fetchIfRef(e[3]))];case"Lab":return["LabCS",(u=t.fetchIfRef(e[1])).getArray("WhitePoint"),u.getArray("BlackPoint"),u.getArray("Range")];default:throw new i.FormatError('unimplemented color space object "'+c+'"')}}throw new i.FormatError('unrecognized color space object: "'+e+'"')}},{key:"isDefaultDecode",value:function(e,t){if(!Array.isArray(e))return!0;if(2*t!==e.length){(0,i.warn)("The decode map is not the correct length");return!0}for(var r=0,a=e.length;r<a;r+=2)if(0!==e[r]||1!==e[r+1])return!1;return!0}},{key:"singletons",get:function(){return(0,i.shadow)(this,"singletons",{get gray(){return(0,i.shadow)(this,"gray",new d)},get rgb(){return(0,i.shadow)(this,"rgb",new g)},get cmyk(){return(0,i.shadow)(this,"cmyk",new m)}})}}]);return e}(),u=function(e){s(t,l);function t(e,r,a){c(this,t);var i=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Alternate",e));i.base=r;i.tintFn=a;i.tmpBuf=new Float32Array(r.numComps);return i}a(t,[{key:"getRgbItem",value:function(e,t,r,a){var i=this.tmpBuf;this.tintFn(e,t,i,0);this.base.getRgbItem(i,0,r,a)}},{key:"getRgbBuffer",value:function(e,t,r,a,i,n,o){var s=this.tintFn,c=this.base,l=1/((1<<n)-1),u=c.numComps,h=c.usesZeroToOneRange,f=(c.isPassthrough(8)||!h)&&0===o,d=f?i:0,g=f?a:new Uint8ClampedArray(u*r),m=this.numComps,p=new Float32Array(m),v=new Float32Array(u),b=void 0,y=void 0;for(b=0;b<r;b++){for(y=0;y<m;y++)p[y]=e[t++]*l;s(p,0,v,0);if(h)for(y=0;y<u;y++)g[d++]=255*v[y];else{c.getRgbItem(v,0,g,d);d+=u}}f||c.getRgbBuffer(g,0,r,a,i,8,o)}},{key:"getOutputLength",value:function(e,t){return this.base.getOutputLength(e*this.base.numComps/this.numComps,t)}},{key:"isDefaultDecode",value:function(e){return l.isDefaultDecode(e,this.numComps)}}]);return t}(),h=function(e){s(t,l);function t(e){c(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Pattern",null));r.base=e;return r}return t}(),f=function(e){s(t,l);function t(e,r,a){c(this,t);var s=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Indexed",1));s.base=e;s.highVal=r;var l=e.numComps*r;if((0,n.isStream)(a)){s.lookup=new Uint8Array(l);var u=a.getBytes(l);s.lookup.set(u)}else if((0,i.isString)(a)){s.lookup=new Uint8Array(l);for(var h=0;h<l;++h)s.lookup[h]=a.charCodeAt(h)}else{if(!(a instanceof Uint8Array))throw new i.FormatError("Unrecognized lookup table: "+a);s.lookup=a}return s}a(t,[{key:"getRgbItem",value:function(e,t,r,a){var i=this.base.numComps,n=e[t]*i;this.base.getRgbBuffer(this.lookup,n,1,r,a,8,0)}},{key:"getRgbBuffer",value:function(e,t,r,a,i,n,o){for(var s=this.base,c=s.numComps,l=s.getOutputLength(c,o),u=this.lookup,h=0;h<r;++h){var f=e[t++]*c;s.getRgbBuffer(u,f,1,a,i,8,o);i+=l}}},{key:"getOutputLength",value:function(e,t){return this.base.getOutputLength(e*this.base.numComps,t)}},{key:"isDefaultDecode",value:function(e){return!0}}]);return t}(),d=function(e){s(t,l);function t(){c(this,t);return o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"DeviceGray",1))}a(t,[{key:"getRgbItem",value:function(e,t,r,a){var i=255*e[t];r[a]=r[a+1]=r[a+2]=i}},{key:"getRgbBuffer",value:function(e,t,r,a,i,n,o){for(var s=255/((1<<n)-1),c=t,l=i,u=0;u<r;++u){var h=s*e[c++];a[l++]=h;a[l++]=h;a[l++]=h;l+=o}}},{key:"getOutputLength",value:function(e,t){return e*(3+t)}},{key:"isDefaultDecode",value:function(e){return l.isDefaultDecode(e,this.numComps)}}]);return t}(),g=function(e){s(t,l);function t(){c(this,t);return o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"DeviceRGB",3))}a(t,[{key:"getRgbItem",value:function(e,t,r,a){r[a]=255*e[t];r[a+1]=255*e[t+1];r[a+2]=255*e[t+2]}},{key:"getRgbBuffer",value:function(e,t,r,a,i,n,o){if(8!==n||0!==o)for(var s=255/((1<<n)-1),c=t,l=i,u=0;u<r;++u){a[l++]=s*e[c++];a[l++]=s*e[c++];a[l++]=s*e[c++];l+=o}else a.set(e.subarray(t,t+3*r),i)}},{key:"getOutputLength",value:function(e,t){return e*(3+t)/3|0}},{key:"isPassthrough",value:function(e){return 8===e}},{key:"isDefaultDecode",value:function(e){return l.isDefaultDecode(e,this.numComps)}}]);return t}(),m=function(){function e(e,t,r,a,i){var n=e[t]*r,o=e[t+1]*r,s=e[t+2]*r,c=e[t+3]*r;a[i]=255+n*(-4.387332384609988*n+54.48615194189176*o+18.82290502165302*s+212.25662451639585*c-285.2331026137004)+o*(1.7149763477362134*o-5.6096736904047315*s+-17.873870861415444*c-5.497006427196366)+s*(-2.5217340131683033*s-21.248923337353073*c+17.5119270841813)+c*(-21.86122147463605*c-189.48180835922747);a[i+1]=255+n*(8.841041422036149*n+60.118027045597366*o+6.871425592049007*s+31.159100130055922*c-79.2970844816548)+o*(-15.310361306967817*o+17.575251261109482*s+131.35250912493976*c-190.9453302588951)+s*(4.444339102852739*s+9.8632861493405*c-24.86741582555878)+c*(-20.737325471181034*c-187.80453709719578);a[i+2]=255+n*(.8842522430003296*n+8.078677503112928*o+30.89978309703729*s-.23883238689178934*c-14.183576799673286)+o*(10.49593273432072*o+63.02378494754052*s+50.606957656360734*c-112.23884253719248)+s*(.03296041114873217*s+115.60384449646641*c-193.58209356861505)+c*(-22.33816807309886*c-180.12613974708367)}return function(t){s(r,l);function r(){c(this,r);return o(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,"DeviceCMYK",4))}a(r,[{key:"getRgbItem",value:function(t,r,a,i){e(t,r,1,a,i)}},{key:"getRgbBuffer",value:function(t,r,a,i,n,o,s){for(var c=1/((1<<o)-1),l=0;l<a;l++){e(t,r,c,i,n);r+=4;n+=3+s}}},{key:"getOutputLength",value:function(e,t){return e/4*(3+t)|0}},{key:"isDefaultDecode",value:function(e){return l.isDefaultDecode(e,this.numComps)}}]);return r}()}(),p=function(){function e(e,t,r,a,i,n){var o=t[r]*n,s=Math.pow(o,e.G),c=e.YW*s,l=Math.max(295.8*Math.pow(c,.3333333333333333)-40.8,0);a[i]=l;a[i+1]=l;a[i+2]=l}return function(t){s(r,l);function r(e,t,a){c(this,r);var n=o(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,"CalGray",1));if(!e)throw new i.FormatError("WhitePoint missing - required for color space CalGray");t=t||[0,0,0];a=a||1;n.XW=e[0];n.YW=e[1];n.ZW=e[2];n.XB=t[0];n.YB=t[1];n.ZB=t[2];n.G=a;if(n.XW<0||n.ZW<0||1!==n.YW)throw new i.FormatError("Invalid WhitePoint components for "+n.name+", no fallback available");if(n.XB<0||n.YB<0||n.ZB<0){(0,i.info)("Invalid BlackPoint for "+n.name+", falling back to default.");n.XB=n.YB=n.ZB=0}0===n.XB&&0===n.YB&&0===n.ZB||(0,i.warn)(n.name+", BlackPoint: XB: "+n.XB+", YB: "+n.YB+", ZB: "+n.ZB+", only default values are supported.");if(n.G<1){(0,i.info)("Invalid Gamma: "+n.G+" for "+n.name+", falling back to default.");n.G=1}return n}a(r,[{key:"getRgbItem",value:function(t,r,a,i){e(this,t,r,a,i,1)}},{key:"getRgbBuffer",value:function(t,r,a,i,n,o,s){for(var c=1/((1<<o)-1),l=0;l<a;++l){e(this,t,r,i,n,c);r+=1;n+=3+s}}},{key:"getOutputLength",value:function(e,t){return e*(3+t)}},{key:"isDefaultDecode",value:function(e){return l.isDefaultDecode(e,this.numComps)}}]);return r}()}(),v=function(){var e=new Float32Array([.8951,.2664,-.1614,-.7502,1.7135,.0367,.0389,-.0685,1.0296]),t=new Float32Array([.9869929,-.1470543,.1599627,.4323053,.5183603,.0492912,-.0085287,.0400428,.9684867]),r=new Float32Array([3.2404542,-1.5371385,-.4985314,-.969266,1.8760108,.041556,.0556434,-.2040259,1.0572252]),n=new Float32Array([1,1,1]),u=new Float32Array(3),h=new Float32Array(3),f=new Float32Array(3),d=Math.pow(24/116,3)/8;function g(e,t,r){r[0]=e[0]*t[0]+e[1]*t[1]+e[2]*t[2];r[1]=e[3]*t[0]+e[4]*t[1]+e[5]*t[2];r[2]=e[6]*t[0]+e[7]*t[1]+e[8]*t[2]}function m(e){return p(0,1,e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function p(e,t,r){return Math.max(e,Math.min(t,r))}function v(e){return e<0?-v(-e):e>8?Math.pow((e+16)/116,3):e*d}function b(a,i,o,s,c,l){var d=p(0,1,i[o]*l),b=p(0,1,i[o+1]*l),y=p(0,1,i[o+2]*l),w=Math.pow(d,a.GR),k=Math.pow(b,a.GG),S=Math.pow(y,a.GB),C=a.MXA*w+a.MXB*k+a.MXC*S,x=a.MYA*w+a.MYB*k+a.MYC*S,_=a.MZA*w+a.MZB*k+a.MZC*S,A=h;A[0]=C;A[1]=x;A[2]=_;var P=f;!function(r,a,i){if(1!==r[0]||1!==r[2]){var n=i;g(e,a,n);var o=u;!function(e,t,r){r[0]=1*t[0]/e[0];r[1]=1*t[1]/e[1];r[2]=1*t[2]/e[2]}(r,n,o);g(t,o,i)}else{i[0]=a[0];i[1]=a[1];i[2]=a[2]}}(a.whitePoint,A,P);var I=h;!function(e,t,r){if(0!==e[0]||0!==e[1]||0!==e[2]){var a=v(0),i=(1-a)/(1-v(e[0])),n=1-i,o=(1-a)/(1-v(e[1])),s=1-o,c=(1-a)/(1-v(e[2])),l=1-c;r[0]=t[0]*i+n;r[1]=t[1]*o+s;r[2]=t[2]*c+l}else{r[0]=t[0];r[1]=t[1];r[2]=t[2]}}(a.blackPoint,P,I);var O=f;!function(r,a,i){var n=i;g(e,a,n);var o=u;!function(e,t,r){r[0]=.95047*t[0]/e[0];r[1]=1*t[1]/e[1];r[2]=1.08883*t[2]/e[2]}(r,n,o);g(t,o,i)}(n,I,O);var T=h;g(r,O,T);s[c]=255*m(T[0]);s[c+1]=255*m(T[1]);s[c+2]=255*m(T[2])}return function(e){s(t,l);function t(e,r,a,n){c(this,t);var s=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"CalRGB",3));if(!e)throw new i.FormatError("WhitePoint missing - required for color space CalRGB");r=r||new Float32Array(3);a=a||new Float32Array([1,1,1]);n=n||new Float32Array([1,0,0,0,1,0,0,0,1]);var l=e[0],u=e[1],h=e[2];s.whitePoint=e;var f=r[0],d=r[1],g=r[2];s.blackPoint=r;s.GR=a[0];s.GG=a[1];s.GB=a[2];s.MXA=n[0];s.MYA=n[1];s.MZA=n[2];s.MXB=n[3];s.MYB=n[4];s.MZB=n[5];s.MXC=n[6];s.MYC=n[7];s.MZC=n[8];if(l<0||h<0||1!==u)throw new i.FormatError("Invalid WhitePoint components for "+s.name+", no fallback available");if(f<0||d<0||g<0){(0,i.info)("Invalid BlackPoint for "+s.name+" ["+f+", "+d+", "+g+"], falling back to default.");s.blackPoint=new Float32Array(3)}if(s.GR<0||s.GG<0||s.GB<0){(0,i.info)("Invalid Gamma ["+s.GR+", "+s.GG+", "+s.GB+"] for "+s.name+", falling back to default.");s.GR=s.GG=s.GB=1}return s}a(t,[{key:"getRgbItem",value:function(e,t,r,a){b(this,e,t,r,a,1)}},{key:"getRgbBuffer",value:function(e,t,r,a,i,n,o){for(var s=1/((1<<n)-1),c=0;c<r;++c){b(this,e,t,a,i,s);t+=3;i+=3+o}}},{key:"getOutputLength",value:function(e,t){return e*(3+t)/3|0}},{key:"isDefaultDecode",value:function(e){return l.isDefaultDecode(e,this.numComps)}}]);return t}()}(),b=function(){function e(e){return e>=6/29?e*e*e:108/841*(e-4/29)}function t(e,t,r,a){return r+e*(a-r)/t}function r(r,a,i,n,o,s){var c=a[i],l=a[i+1],u=a[i+2];if(!1!==n){c=t(c,n,0,100);l=t(l,n,r.amin,r.amax);u=t(u,n,r.bmin,r.bmax)}var h=(c+16)/116,f=h+(l=l>r.amax?r.amax:l<r.amin?r.amin:l)/500,d=h-(u=u>r.bmax?r.bmax:u<r.bmin?r.bmin:u)/200,g=r.XW*e(f),m=r.YW*e(h),p=r.ZW*e(d),v=void 0,b=void 0,y=void 0;if(r.ZW<1){v=3.1339*g+-1.617*m+-.4906*p;b=-.9785*g+1.916*m+.0333*p;y=.072*g+-.229*m+1.4057*p}else{v=3.2406*g+-1.5372*m+-.4986*p;b=-.9689*g+1.8758*m+.0415*p;y=.0557*g+-.204*m+1.057*p}o[s]=255*Math.sqrt(v);o[s+1]=255*Math.sqrt(b);o[s+2]=255*Math.sqrt(y)}return function(e){s(t,l);function t(e,r,a){c(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Lab",3));if(!e)throw new i.FormatError("WhitePoint missing - required for color space Lab");r=r||[0,0,0];a=a||[-100,100,-100,100];n.XW=e[0];n.YW=e[1];n.ZW=e[2];n.amin=a[0];n.amax=a[1];n.bmin=a[2];n.bmax=a[3];n.XB=r[0];n.YB=r[1];n.ZB=r[2];if(n.XW<0||n.ZW<0||1!==n.YW)throw new i.FormatError("Invalid WhitePoint components, no fallback available");if(n.XB<0||n.YB<0||n.ZB<0){(0,i.info)("Invalid BlackPoint, falling back to default");n.XB=n.YB=n.ZB=0}if(n.amin>n.amax||n.bmin>n.bmax){(0,i.info)("Invalid Range, falling back to defaults");n.amin=-100;n.amax=100;n.bmin=-100;n.bmax=100}return n}a(t,[{key:"getRgbItem",value:function(e,t,a,i){r(this,e,t,!1,a,i)}},{key:"getRgbBuffer",value:function(e,t,a,i,n,o,s){for(var c=(1<<o)-1,l=0;l<a;l++){r(this,e,t,c,i,n);t+=3;n+=3+s}}},{key:"getOutputLength",value:function(e,t){return e*(3+t)/3|0}},{key:"isDefaultDecode",value:function(e){return!0}},{key:"usesZeroToOneRange",get:function(){return(0,i.shadow)(this,"usesZeroToOneRange",!1)}}]);return t}()}();t.ColorSpace=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.AnnotationFactory=t.AnnotationBorderStyle=t.Annotation=void 0;var a=function e(t,r,a){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var n=Object.getPrototypeOf(t);return null===n?void 0:e(n,r,a)}if("value"in i)return i.value;var o=i.get;return void 0!==o?o.call(a):void 0},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1;a.configurable=!0;"value"in a&&(a.writable=!0);Object.defineProperty(e,a.key,a)}}return function(t,r,a){r&&e(t.prototype,r);a&&e(t,a);return t}}(),n=r(2),o=r(137),s=r(138),c=r(151),l=r(153),u=r(140);function h(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var g=function(){function e(){d(this,e)}i(e,null,[{key:"create",value:function(e,t,r,a){return r.ensure(this,"_create",[e,t,r,a])}},{key:"_create",value:function(e,t,r,a){var i=e.fetchIfRef(t);if((0,s.isDict)(i)){var o=(0,s.isRef)(t)?t.toString():"annot_"+a.createObjId(),c=i.get("Subtype");c=(0,s.isName)(c)?c.name:null;var l={xref:e,dict:i,ref:(0,s.isRef)(t)?t:null,subtype:c,id:o,pdfManager:r};switch(c){case"Link":return new S(l);case"Text":return new k(l);case"Widget":var u=(0,n.getInheritableProperty)({dict:i,key:"FT"});switch(u=(0,s.isName)(u)?u.name:null){case"Tx":return new b(l);case"Btn":return new y(l);case"Ch":return new w(l)}(0,n.warn)('Unimplemented widget field type "'+u+'", falling back to base field type.');return new v(l);case"Popup":return new C(l);case"Line":return new x(l);case"Square":return new _(l);case"Circle":return new A(l);case"PolyLine":return new P(l);case"Polygon":return new I(l);case"Ink":return new O(l);case"Highlight":return new T(l);case"Underline":return new E(l);case"Squiggly":return new F(l);case"StrikeOut":return new R(l);case"Stamp":return new B(l);case"FileAttachment":return new D(l);default:c?(0,n.warn)('Unimplemented annotation type "'+c+'", falling back to base annotation.'):(0,n.warn)("Annotation is missing the required /Subtype.");return new m(l)}}}}]);return e}();var m=function(){function e(t){d(this,e);var r=t.dict;this.setFlags(r.get("F"));this.setRectangle(r.getArray("Rect"));this.setColor(r.getArray("C"));this.setBorderStyle(r);this.setAppearance(r);this.data={annotationFlags:this.flags,borderStyle:this.borderStyle,color:this.color,hasAppearance:!!this.appearance,id:t.id,rect:this.rectangle,subtype:t.subtype}}i(e,[{key:"_hasFlag",value:function(e,t){return!!(e&t)}},{key:"_isViewable",value:function(e){return!this._hasFlag(e,n.AnnotationFlag.INVISIBLE)&&!this._hasFlag(e,n.AnnotationFlag.HIDDEN)&&!this._hasFlag(e,n.AnnotationFlag.NOVIEW)}},{key:"_isPrintable",value:function(e){return this._hasFlag(e,n.AnnotationFlag.PRINT)&&!this._hasFlag(e,n.AnnotationFlag.INVISIBLE)&&!this._hasFlag(e,n.AnnotationFlag.HIDDEN)}},{key:"setFlags",value:function(e){this.flags=Number.isInteger(e)&&e>0?e:0}},{key:"hasFlag",value:function(e){return this._hasFlag(this.flags,e)}},{key:"setRectangle",value:function(e){Array.isArray(e)&&4===e.length?this.rectangle=n.Util.normalizeRect(e):this.rectangle=[0,0,0,0]}},{key:"setColor",value:function(e){var t=new Uint8ClampedArray(3);if(Array.isArray(e))switch(e.length){case 0:this.color=null;break;case 1:c.ColorSpace.singletons.gray.getRgbItem(e,0,t,0);this.color=t;break;case 3:c.ColorSpace.singletons.rgb.getRgbItem(e,0,t,0);this.color=t;break;case 4:c.ColorSpace.singletons.cmyk.getRgbItem(e,0,t,0);this.color=t;break;default:this.color=t}else this.color=t}},{key:"setBorderStyle",value:function(e){this.borderStyle=new p;if((0,s.isDict)(e))if(e.has("BS")){var t=e.get("BS"),r=t.get("Type");if(!r||(0,s.isName)(r,"Border")){this.borderStyle.setWidth(t.get("W"));this.borderStyle.setStyle(t.get("S"));this.borderStyle.setDashArray(t.getArray("D"))}}else if(e.has("Border")){var a=e.getArray("Border");if(Array.isArray(a)&&a.length>=3){this.borderStyle.setHorizontalCornerRadius(a[0]);this.borderStyle.setVerticalCornerRadius(a[1]);this.borderStyle.setWidth(a[2]);4===a.length&&this.borderStyle.setDashArray(a[3])}}else this.borderStyle.setWidth(0)}},{key:"setAppearance",value:function(e){this.appearance=null;var t=e.get("AP");if((0,s.isDict)(t)){var r=t.get("N");if((0,s.isStream)(r))this.appearance=r;else if((0,s.isDict)(r)){var a=e.get("AS");(0,s.isName)(a)&&r.has(a.name)&&(this.appearance=r.get(a.name))}}}},{key:"_preparePopup",value:function(e){e.has("C")||(this.data.color=null);this.data.hasPopup=e.has("Popup");this.data.title=(0,n.stringToPDFString)(e.get("T")||"");this.data.contents=(0,n.stringToPDFString)(e.get("Contents")||"")}},{key:"loadResources",value:function(e){return this.appearance.dict.getAsync("Resources").then(function(t){if(t){return new o.ObjectLoader(t,e,t.xref).load().then(function(){return t})}})}},{key:"getOperatorList",value:function(e,t,r){var a=this;if(!this.appearance)return Promise.resolve(new l.OperatorList);var i=this.data,o=this.appearance.dict,s=this.loadResources(["ExtGState","ColorSpace","Pattern","Shading","XObject","Font"]),c=o.getArray("BBox")||[0,0,1,1],u=o.getArray("Matrix")||[1,0,0,1,0,0],h=function(e,t,r){var a=n.Util.getAxialAlignedBoundingBox(t,r),i=a[0],o=a[1],s=a[2],c=a[3];if(i===s||o===c)return[1,0,0,1,e[0],e[1]];var l=(e[2]-e[0])/(s-i),u=(e[3]-e[1])/(c-o);return[l,0,0,u,e[0]-i*l,e[1]-o*u]}(i.rect,c,u);return s.then(function(r){var o=new l.OperatorList;o.addOp(n.OPS.beginAnnotation,[i.rect,h,u]);return e.getOperatorList({stream:a.appearance,task:t,resources:r,operatorList:o}).then(function(){o.addOp(n.OPS.endAnnotation,[]);a.appearance.reset();return o})})}},{key:"viewable",get:function(){return 0===this.flags||this._isViewable(this.flags)}},{key:"printable",get:function(){return 0!==this.flags&&this._isPrintable(this.flags)}}]);return e}(),p=function(){function e(){d(this,e);this.width=1;this.style=n.AnnotationBorderStyleType.SOLID;this.dashArray=[3];this.horizontalCornerRadius=0;this.verticalCornerRadius=0}i(e,[{key:"setWidth",value:function(e){Number.isInteger(e)&&(this.width=e)}},{key:"setStyle",value:function(e){if(e)switch(e.name){case"S":this.style=n.AnnotationBorderStyleType.SOLID;break;case"D":this.style=n.AnnotationBorderStyleType.DASHED;break;case"B":this.style=n.AnnotationBorderStyleType.BEVELED;break;case"I":this.style=n.AnnotationBorderStyleType.INSET;break;case"U":this.style=n.AnnotationBorderStyleType.UNDERLINE}}},{key:"setDashArray",value:function(e){if(Array.isArray(e)&&e.length>0){for(var t=!0,r=!0,a=0,i=e.length;a<i;a++){var n=e[a];if(!(+n>=0)){t=!1;break}n>0&&(r=!1)}t&&!r?this.dashArray=e:this.width=0}else e&&(this.width=0)}},{key:"setHorizontalCornerRadius",value:function(e){Number.isInteger(e)&&(this.horizontalCornerRadius=e)}},{key:"setVerticalCornerRadius",value:function(e){Number.isInteger(e)&&(this.verticalCornerRadius=e)}}]);return e}(),v=function(e){f(t,m);function t(e){d(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),a=e.dict,i=r.data;i.annotationType=n.AnnotationType.WIDGET;i.fieldName=r._constructFieldName(a);i.fieldValue=(0,n.getInheritableProperty)({dict:a,key:"V",getArray:!0});i.alternativeText=(0,n.stringToPDFString)(a.get("TU")||"");i.defaultAppearance=(0,n.getInheritableProperty)({dict:a,key:"DA"})||"";var o=(0,n.getInheritableProperty)({dict:a,key:"FT"});i.fieldType=(0,s.isName)(o)?o.name:null;r.fieldResources=(0,n.getInheritableProperty)({dict:a,key:"DR"})||s.Dict.empty;i.fieldFlags=(0,n.getInheritableProperty)({dict:a,key:"Ff"});(!Number.isInteger(i.fieldFlags)||i.fieldFlags<0)&&(i.fieldFlags=0);i.readOnly=r.hasFieldFlag(n.AnnotationFieldFlag.READONLY);"Sig"===i.fieldType&&r.setFlags(n.AnnotationFlag.HIDDEN);return r}i(t,[{key:"_constructFieldName",value:function(e){if(!e.has("T")&&!e.has("Parent")){(0,n.warn)("Unknown field name, falling back to empty field name.");return""}if(!e.has("Parent"))return(0,n.stringToPDFString)(e.get("T"));var t=[];e.has("T")&&t.unshift((0,n.stringToPDFString)(e.get("T")));for(var r=e;r.has("Parent");){r=r.get("Parent");if(!(0,s.isDict)(r))break;r.has("T")&&t.unshift((0,n.stringToPDFString)(r.get("T")))}return t.join(".")}},{key:"hasFieldFlag",value:function(e){return!!(this.data.fieldFlags&e)}},{key:"getOperatorList",value:function(e,r,i){return i?Promise.resolve(new l.OperatorList):a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"getOperatorList",this).call(this,e,r,i)}}]);return t}(),b=function(e){f(t,v);function t(e){d(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),a=e.dict;r.data.fieldValue=(0,n.stringToPDFString)(r.data.fieldValue||"");var i=(0,n.getInheritableProperty)({dict:a,key:"Q"});(!Number.isInteger(i)||i<0||i>2)&&(i=null);r.data.textAlignment=i;var o=(0,n.getInheritableProperty)({dict:a,key:"MaxLen"});(!Number.isInteger(o)||o<0)&&(o=null);r.data.maxLen=o;r.data.multiLine=r.hasFieldFlag(n.AnnotationFieldFlag.MULTILINE);r.data.comb=r.hasFieldFlag(n.AnnotationFieldFlag.COMB)&&!r.hasFieldFlag(n.AnnotationFieldFlag.MULTILINE)&&!r.hasFieldFlag(n.AnnotationFieldFlag.PASSWORD)&&!r.hasFieldFlag(n.AnnotationFieldFlag.FILESELECT)&&null!==r.data.maxLen;return r}i(t,[{key:"getOperatorList",value:function(e,r,i){if(i||this.appearance)return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"getOperatorList",this).call(this,e,r,i);var o=new l.OperatorList;if(!this.data.defaultAppearance)return Promise.resolve(o);var s=new u.Stream((0,n.stringToBytes)(this.data.defaultAppearance));return e.getOperatorList({stream:s,task:r,resources:this.fieldResources,operatorList:o}).then(function(){return o})}}]);return t}(),y=function(e){f(t,v);function t(e){d(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.data.checkBox=!r.hasFieldFlag(n.AnnotationFieldFlag.RADIO)&&!r.hasFieldFlag(n.AnnotationFieldFlag.PUSHBUTTON);r.data.radioButton=r.hasFieldFlag(n.AnnotationFieldFlag.RADIO)&&!r.hasFieldFlag(n.AnnotationFieldFlag.PUSHBUTTON);r.data.pushButton=r.hasFieldFlag(n.AnnotationFieldFlag.PUSHBUTTON);r.data.checkBox?r._processCheckBox(e):r.data.radioButton?r._processRadioButton(e):r.data.pushButton?r._processPushButton(e):(0,n.warn)("Invalid field flags for button widget annotation");return r}i(t,[{key:"_processCheckBox",value:function(e){(0,s.isName)(this.data.fieldValue)&&(this.data.fieldValue=this.data.fieldValue.name);var t=e.dict.get("AP");if((0,s.isDict)(t)){var r=t.get("D");if((0,s.isDict)(r)){var a=r.getKeys();2===a.length&&(this.data.exportValue="Off"===a[0]?a[1]:a[0])}}}},{key:"_processRadioButton",value:function(e){this.data.fieldValue=this.data.buttonValue=null;var t=e.dict.get("Parent");if((0,s.isDict)(t)&&t.has("V")){var r=t.get("V");(0,s.isName)(r)&&(this.data.fieldValue=r.name)}var a=e.dict.get("AP");if((0,s.isDict)(a)){var i=a.get("N");if((0,s.isDict)(i))for(var n=i.getKeys(),o=0,c=n.length;o<c;o++)if("Off"!==n[o]){this.data.buttonValue=n[o];break}}}},{key:"_processPushButton",value:function(e){e.dict.has("A")?o.Catalog.parseDestDictionary({destDict:e.dict,resultObj:this.data,docBaseUrl:e.pdfManager.docBaseUrl}):(0,n.warn)("Push buttons without action dictionaries are not supported")}}]);return t}(),w=function(e){f(t,v);function t(e){d(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.data.options=[];var a=(0,n.getInheritableProperty)({dict:e.dict,key:"Opt"});if(Array.isArray(a))for(var i=e.xref,o=0,s=a.length;o<s;o++){var c=i.fetchIfRef(a[o]),l=Array.isArray(c);r.data.options[o]={exportValue:l?i.fetchIfRef(c[0]):c,displayValue:(0,n.stringToPDFString)(l?i.fetchIfRef(c[1]):c)}}Array.isArray(r.data.fieldValue)||(r.data.fieldValue=[r.data.fieldValue]);r.data.combo=r.hasFieldFlag(n.AnnotationFieldFlag.COMBO);r.data.multiSelect=r.hasFieldFlag(n.AnnotationFieldFlag.MULTISELECT);return r}return t}(),k=function(e){f(t,m);function t(e){d(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.data.annotationType=n.AnnotationType.TEXT;if(r.data.hasAppearance)r.data.name="NoIcon";else{r.data.rect[1]=r.data.rect[3]-22;r.data.rect[2]=r.data.rect[0]+22;r.data.name=e.dict.has("Name")?e.dict.get("Name").name:"Note"}r._preparePopup(e.dict);return r}return t}(),S=function(e){f(t,m);function t(e){d(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.data.annotationType=n.AnnotationType.LINK;o.Catalog.parseDestDictionary({destDict:e.dict,resultObj:r.data,docBaseUrl:e.pdfManager.docBaseUrl});return r}return t}(),C=function(e){f(t,m);function t(e){d(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.data.annotationType=n.AnnotationType.POPUP;var a=e.dict,i=a.get("Parent");if(!i){(0,n.warn)("Popup annotation has a missing or invalid parent annotation.");return h(r)}var o=i.get("Subtype");r.data.parentType=(0,s.isName)(o)?o.name:null;r.data.parentId=a.getRaw("Parent").toString();r.data.title=(0,n.stringToPDFString)(i.get("T")||"");r.data.contents=(0,n.stringToPDFString)(i.get("Contents")||"");if(i.has("C")){r.setColor(i.getArray("C"));r.data.color=r.color}else r.data.color=null;if(!r.viewable){var c=i.get("F");r._isViewable(c)&&r.setFlags(c)}return r}return t}(),x=function(e){f(t,m);function t(e){d(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.data.annotationType=n.AnnotationType.LINE;var a=e.dict;r.data.lineCoordinates=n.Util.normalizeRect(a.getArray("L"));r._preparePopup(a);return r}return t}(),_=function(e){f(t,m);function t(e){d(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.data.annotationType=n.AnnotationType.SQUARE;r._preparePopup(e.dict);return r}return t}(),A=function(e){f(t,m);function t(e){d(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.data.annotationType=n.AnnotationType.CIRCLE;r._preparePopup(e.dict);return r}return t}(),P=function(e){f(t,m);function t(e){d(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.data.annotationType=n.AnnotationType.POLYLINE;var a=e.dict,i=a.getArray("Vertices");r.data.vertices=[];for(var o=0,s=i.length;o<s;o+=2)r.data.vertices.push({x:i[o],y:i[o+1]});r._preparePopup(a);return r}return t}(),I=function(e){f(t,P);function t(e){d(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.data.annotationType=n.AnnotationType.POLYGON;return r}return t}(),O=function(e){f(t,m);function t(e){d(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.data.annotationType=n.AnnotationType.INK;var a=e.dict,i=e.xref,o=a.getArray("InkList");r.data.inkLists=[];for(var s=0,c=o.length;s<c;++s){r.data.inkLists.push([]);for(var l=0,u=o[s].length;l<u;l+=2)r.data.inkLists[s].push({x:i.fetchIfRef(o[s][l]),y:i.fetchIfRef(o[s][l+1])})}r._preparePopup(a);return r}return t}(),T=function(e){f(t,m);function t(e){d(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.data.annotationType=n.AnnotationType.HIGHLIGHT;r._preparePopup(e.dict);return r}return t}(),E=function(e){f(t,m);function t(e){d(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.data.annotationType=n.AnnotationType.UNDERLINE;r._preparePopup(e.dict);return r}return t}(),F=function(e){f(t,m);function t(e){d(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.data.annotationType=n.AnnotationType.SQUIGGLY;r._preparePopup(e.dict);return r}return t}(),R=function(e){f(t,m);function t(e){d(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.data.annotationType=n.AnnotationType.STRIKEOUT;r._preparePopup(e.dict);return r}return t}(),B=function(e){f(t,m);function t(e){d(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.data.annotationType=n.AnnotationType.STAMP;r._preparePopup(e.dict);return r}return t}(),D=function(e){f(t,m);function t(e){d(this,t);var r=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),a=new o.FileSpec(e.dict.get("FS"),e.xref);r.data.annotationType=n.AnnotationType.FILEATTACHMENT;r.data.file=a.serializable;r._preparePopup(e.dict);return r}return t}();t.Annotation=m;t.AnnotationBorderStyle=p;t.AnnotationFactory=g},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.OperatorList=void 0;var a=r(2),i=function(){function e(e,t,r,a,i){for(var n=e,o=0,s=t.length-1;o<s;o++){var c=t[o];n=n[c]||(n[c]=[])}n[t[t.length-1]]={checkFn:r,iterateFn:a,processFn:i}}var t=[];e(t,[a.OPS.save,a.OPS.transform,a.OPS.paintInlineImageXObject,a.OPS.restore],null,function(e,t){var r=e.fnArray;switch((t-(e.iCurr-3))%4){case 0:return r[t]===a.OPS.save;case 1:return r[t]===a.OPS.transform;case 2:return r[t]===a.OPS.paintInlineImageXObject;case 3:return r[t]===a.OPS.restore}},function(e,t){var r=e.fnArray,i=e.argsArray,n=e.iCurr,o=n-3,s=n-2,c=n-1,l=Math.min(Math.floor((t-o)/4),200);if(l<10)return t-(t-o)%4;var u,h=0,f=[],d=0,g=1,m=1;for(u=0;u<l;u++){var p=i[s+(u<<2)],v=i[c+(u<<2)][0];if(g+v.width>1e3){h=Math.max(h,g);m+=d+2;g=0;d=0}f.push({transform:p,x:g,y:m,w:v.width,h:v.height});g+=v.width+2;d=Math.max(d,v.height)}var b=Math.max(h,g)+1,y=m+d+1,w=new Uint8ClampedArray(b*y*4),k=b<<2;for(u=0;u<l;u++){var S=i[c+(u<<2)][0].data,C=f[u].w<<2,x=0,_=f[u].x+f[u].y*b<<2;w.set(S.subarray(0,C),_-k);for(var A=0,P=f[u].h;A<P;A++){w.set(S.subarray(x,x+C),_);x+=C;_+=k}w.set(S.subarray(x-C,x),_);for(;_>=0;){S[_-4]=S[_];S[_-3]=S[_+1];S[_-2]=S[_+2];S[_-1]=S[_+3];S[_+C]=S[_+C-4];S[_+C+1]=S[_+C-3];S[_+C+2]=S[_+C-2];S[_+C+3]=S[_+C-1];_-=k}}r.splice(o,4*l,a.OPS.paintInlineImageXObjectGroup);i.splice(o,4*l,[{width:b,height:y,kind:a.ImageKind.RGBA_32BPP,data:w},f]);return o+1});e(t,[a.OPS.save,a.OPS.transform,a.OPS.paintImageMaskXObject,a.OPS.restore],null,function(e,t){var r=e.fnArray;switch((t-(e.iCurr-3))%4){case 0:return r[t]===a.OPS.save;case 1:return r[t]===a.OPS.transform;case 2:return r[t]===a.OPS.paintImageMaskXObject;case 3:return r[t]===a.OPS.restore}},function(e,t){var r,i=e.fnArray,n=e.argsArray,o=e.iCurr,s=o-3,c=o-2,l=o-1,u=Math.floor((t-s)/4);if((u=function(e,t,r,i){for(var n=e+2,o=0;o<t;o++){var s=i[n+4*o],c=1===s.length&&s[0];if(!c||1!==c.width||1!==c.height||c.data.length&&(1!==c.data.length||0!==c.data[0]))break;r[n+4*o]=a.OPS.paintSolidColorImageMask}return t-o}(s,u,i,n))<10)return t-(t-s)%4;var h,f,d=!1,g=n[l][0];if(0===n[c][1]&&0===n[c][2]){d=!0;var m=n[c][0],p=n[c][3];h=c+4;var v=l+4;for(r=1;r<u;r++,h+=4,v+=4){f=n[h];if(n[v][0]!==g||f[0]!==m||0!==f[1]||0!==f[2]||f[3]!==p){r<10?d=!1:u=r;break}}}if(d){u=Math.min(u,1e3);var b=new Float32Array(2*u);h=c;for(r=0;r<u;r++,h+=4){f=n[h];b[r<<1]=f[4];b[1+(r<<1)]=f[5]}i.splice(s,4*u,a.OPS.paintImageMaskXObjectRepeat);n.splice(s,4*u,[g,m,p,b])}else{u=Math.min(u,100);var y=[];for(r=0;r<u;r++){f=n[c+(r<<2)];var w=n[l+(r<<2)][0];y.push({data:w.data,width:w.width,height:w.height,transform:f})}i.splice(s,4*u,a.OPS.paintImageMaskXObjectGroup);n.splice(s,4*u,[y])}return s+1});e(t,[a.OPS.save,a.OPS.transform,a.OPS.paintImageXObject,a.OPS.restore],function(e){var t=e.argsArray,r=e.iCurr-2;return 0===t[r][1]&&0===t[r][2]},function(e,t){var r=e.fnArray,i=e.argsArray;switch((t-(e.iCurr-3))%4){case 0:return r[t]===a.OPS.save;case 1:if(r[t]!==a.OPS.transform)return!1;var n=e.iCurr-2,o=i[n][0],s=i[n][3];return i[t][0]===o&&0===i[t][1]&&0===i[t][2]&&i[t][3]===s;case 2:if(r[t]!==a.OPS.paintImageXObject)return!1;var c=i[e.iCurr-1][0];return i[t][0]===c;case 3:return r[t]===a.OPS.restore}},function(e,t){var r=e.fnArray,i=e.argsArray,n=e.iCurr,o=n-3,s=n-2,c=i[n-1][0],l=i[s][0],u=i[s][3],h=Math.min(Math.floor((t-o)/4),1e3);if(h<3)return t-(t-o)%4;for(var f=new Float32Array(2*h),d=s,g=0;g<h;g++,d+=4){var m=i[d];f[g<<1]=m[4];f[1+(g<<1)]=m[5]}var p=[c,l,u,f];r.splice(o,4*h,a.OPS.paintImageXObjectRepeat);i.splice(o,4*h,p);return o+1});e(t,[a.OPS.beginText,a.OPS.setFont,a.OPS.setTextMatrix,a.OPS.showText,a.OPS.endText],null,function(e,t){var r=e.fnArray,i=e.argsArray;switch((t-(e.iCurr-4))%5){case 0:return r[t]===a.OPS.beginText;case 1:return r[t]===a.OPS.setFont;case 2:return r[t]===a.OPS.setTextMatrix;case 3:if(r[t]!==a.OPS.showText)return!1;var n=e.iCurr-3,o=i[n][0],s=i[n][1];return i[t][0]===o&&i[t][1]===s;case 4:return r[t]===a.OPS.endText}},function(e,t){var r=e.fnArray,a=e.argsArray,i=e.iCurr,n=i-4,o=i-3,s=i-2,c=i-1,l=i,u=a[o][0],h=a[o][1],f=Math.min(Math.floor((t-n)/5),1e3);if(f<3)return t-(t-n)%5;var d=n;if(n>=4&&r[n-4]===r[o]&&r[n-3]===r[s]&&r[n-2]===r[c]&&r[n-1]===r[l]&&a[n-4][0]===u&&a[n-4][1]===h){f++;d-=5}for(var g=d+4,m=1;m<f;m++){r.splice(g,3);a.splice(g,3);g+=2}return g+1});function r(e){this.queue=e;this.state=null;this.context={iCurr:0,fnArray:e.fnArray,argsArray:e.argsArray};this.match=null;this.lastProcessed=0}r.prototype={_optimize:function(){var e=this.queue.fnArray,r=this.lastProcessed,a=e.length,i=this.state,n=this.match;if(i||n||r+1!==a||t[e[r]]){for(var o=this.context;r<a;){if(n){if((0,n.iterateFn)(o,r)){r++;continue}r=(0,n.processFn)(o,r+1);a=e.length;n=null;i=null;if(r>=a)break}if((i=(i||t)[e[r]])&&!Array.isArray(i)){o.iCurr=r;r++;if(!i.checkFn||(0,i.checkFn)(o)){n=i;i=null}else i=null}else r++}this.state=i;this.match=n;this.lastProcessed=r}else this.lastProcessed=a},push:function(e,t){this.queue.fnArray.push(e);this.queue.argsArray.push(t);this._optimize()},flush:function(){for(;this.match;){var e=this.queue.fnArray.length;this.lastProcessed=(0,this.match.processFn)(this.context,e);this.match=null;this.state=null;this._optimize()}},reset:function(){this.state=null;this.match=null;this.lastProcessed=0}};return r}(),n=function(){function e(e){this.queue=e}e.prototype={push:function(e,t){this.queue.fnArray.push(e);this.queue.argsArray.push(t)},flush:function(){}};return e}(),o=function(){function e(e,t,r){this.messageHandler=t;this.fnArray=[];this.argsArray=[];t&&"oplist"!==this.intent?this.optimizer=new i(this):this.optimizer=new n(this);this.dependencies=Object.create(null);this._totalLength=0;this.pageIndex=r;this.intent=e;this.weight=0}e.prototype={get length(){return this.argsArray.length},get totalLength(){return this._totalLength+this.length},addOp:function(e,t){this.optimizer.push(e,t);this.weight++;this.messageHandler&&(this.weight>=1e3?this.flush():this.weight>=995&&(e===a.OPS.restore||e===a.OPS.endText)&&this.flush())},addDependency:function(e){if(!(e in this.dependencies)){this.dependencies[e]=!0;this.addOp(a.OPS.dependency,[e])}},addDependencies:function(e){for(var t in e)this.addDependency(t)},addOpList:function(e){Object.assign(this.dependencies,e.dependencies);for(var t=0,r=e.length;t<r;t++)this.addOp(e.fnArray[t],e.argsArray[t])},getIR:function(){return{fnArray:this.fnArray,argsArray:this.argsArray,length:this.length}},flush:function(e){this.optimizer.flush();var t=function(e){for(var t=[],r=e.fnArray,i=e.argsArray,n=0,o=e.length;n<o;n++)switch(r[n]){case a.OPS.paintInlineImageXObject:case a.OPS.paintInlineImageXObjectGroup:case a.OPS.paintImageMaskXObject:var s=i[n][0];s.cached||t.push(s.data.buffer)}return t}(this),r=this.length;this._totalLength+=r;this.messageHandler.send("RenderPageChunk",{operatorList:{fnArray:this.fnArray,argsArray:this.argsArray,lastChunk:e,length:r},pageIndex:this.pageIndex,intent:this.intent},t);this.dependencies=Object.create(null);this.fnArray.length=0;this.argsArray.length=0;this.weight=0;this.optimizer.reset()}};return e}();t.OperatorList=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PartialEvaluator=void 0;var a,i=r(131),n=(a=i)&&a.__esModule?a:{default:a},o=r(2),s=r(155),c=r(140),l=r(138),u=r(156),h=r(159),f=r(162),d=r(161),g=r(165),m=r(139),p=r(166),v=r(151),b=r(160),y=r(167),w=r(168),k=r(146),S=r(170),C=r(153),x=r(171);var _=function(){var e={forceDataSchema:!1,maxImageSize:-1,disableFontFace:!1,nativeImageDecoderSupport:o.NativeImageDecoding.DECODE,ignoreErrors:!1,isEvalSupported:!0};function t(e){var t=e.xref,r=e.resources,a=e.handler,i=e.forceDataSchema,n=void 0!==i&&i,o=e.pdfFunctionFactory;this.xref=t;this.resources=r;this.handler=a;this.forceDataSchema=n;this.pdfFunctionFactory=o}t.prototype={canDecode:function(e){return e instanceof k.JpegStream&&t.isDecodable(e,this.xref,this.resources,this.pdfFunctionFactory)},decode:function(e){var t=e.dict.get("ColorSpace","CS");t=v.ColorSpace.parse(t,this.xref,this.resources,this.pdfFunctionFactory);return this.handler.sendWithPromise("JpegDecode",[e.getIR(this.forceDataSchema),t.numComps]).then(function(t){var r=t.data;t.width,t.height;return new c.Stream(r,0,r.length,e.dict)})}};t.isSupported=function(e,t,r,a){var i=e.dict;if(i.has("DecodeParms")||i.has("DP"))return!1;var n=v.ColorSpace.parse(i.get("ColorSpace","CS"),t,r,a);return("DeviceGray"===n.name||"DeviceRGB"===n.name)&&n.isDefaultDecode(i.getArray("Decode","D"))};t.isDecodable=function(e,t,r,a){var i=e.dict;if(i.has("DecodeParms")||i.has("DP"))return!1;var n=v.ColorSpace.parse(i.get("ColorSpace","CS"),t,r,a);return(1===n.numComps||3===n.numComps)&&n.isDefaultDecode(i.getArray("Decode","D"))};function r(t){var r,a,i=this,s=t.pdfManager,c=t.xref,l=t.handler,u=t.pageIndex,h=t.idFactory,f=t.fontCache,d=t.builtInCMapCache,g=t.options,m=void 0===g?null:g,p=t.pdfFunctionFactory;this.pdfManager=s;this.xref=c;this.handler=l;this.pageIndex=u;this.idFactory=h;this.fontCache=f;this.builtInCMapCache=d;this.options=m||e;this.pdfFunctionFactory=p;this.fetchBuiltInCMap=(a=(r=n.default.mark(function e(t){var r;return n.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.builtInCMapCache.has(t)){e.next=2;break}return e.abrupt("return",i.builtInCMapCache.get(t));case 2:e.next=4;return i.handler.sendWithPromise("FetchBuiltInCMap",{name:t});case 4:(r=e.sent).compressionType!==o.CMapCompressionType.NONE&&i.builtInCMapCache.set(t,r);return e.abrupt("return",r);case 7:case"end":return e.stop()}},e,i)}),function(){var e=r.apply(this,arguments);return new Promise(function(t,r){return function a(i,n){try{var o=e[i](n),s=o.value}catch(e){r(e);return}if(!o.done)return Promise.resolve(s).then(function(e){a("next",e)},function(e){a("throw",e)});t(s)}("next")})}),function(e){return a.apply(this,arguments)})}function a(){this.reset()}a.prototype={check:function(){if(++this.checked<100)return!1;this.checked=0;return this.endTime<=Date.now()},reset:function(){this.endTime=Date.now()+20;this.checked=0}};var i=Promise.resolve();r.prototype={clone:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e,r=Object.create(this);r.options=t;return r},hasBlendModes:function(e){if(!(0,l.isDict)(e))return!1;var t=Object.create(null);e.objId&&(t[e.objId]=!0);for(var r=[e],a=this.xref;r.length;){var i,n,o,s=r.shift(),c=s.get("ExtGState");if((0,l.isDict)(c)){var u=c.getKeys();for(n=0,o=u.length;n<o;n++){i=u[n];var h=c.get(i).get("BM");if((0,l.isName)(h)&&"Normal"!==h.name)return!0}}var f=s.get("XObject");if((0,l.isDict)(f)){var d=f.getKeys();for(n=0,o=d.length;n<o;n++){i=d[n];var g=f.getRaw(i);if((0,l.isRef)(g)){if(t[g.toString()])continue;g=a.fetch(g)}if((0,l.isStream)(g)){if(g.dict.objId){if(t[g.dict.objId])continue;t[g.dict.objId]=!0}var m=g.dict.get("Resources");if((0,l.isDict)(m)&&(!m.objId||!t[m.objId])){r.push(m);m.objId&&(t[m.objId]=!0)}}}}}return!1},buildFormXObject:function(e,t,r,a,i,n){var s=t.dict,c=s.getArray("Matrix"),u=s.getArray("BBox"),h=s.get("Group");if(h){var f={matrix:c,bbox:u,smask:r,isolated:!1,knockout:!1},d=h.get("S"),g=null;if((0,l.isName)(d,"Transparency")){f.isolated=h.get("I")||!1;f.knockout=h.get("K")||!1;h.has("CS")&&(g=v.ColorSpace.parse(h.get("CS"),this.xref,e,this.pdfFunctionFactory))}if(r&&r.backdrop){g=g||v.ColorSpace.singletons.rgb;r.backdrop=g.getRgb(r.backdrop,0)}a.addOp(o.OPS.beginGroup,[f])}a.addOp(o.OPS.paintFormXObjectBegin,[c,u]);return this.getOperatorList({stream:t,task:i,resources:s.get("Resources")||e,operatorList:a,initialState:n}).then(function(){a.addOp(o.OPS.paintFormXObjectEnd,[]);h&&a.addOp(o.OPS.endGroup,[f])})},buildPaintImageXObject:function(e){var r=this,a=e.resources,i=e.image,n=e.isInline,s=void 0!==n&&n,l=e.operatorList,u=e.cacheKey,h=e.imageCache,f=e.forceDisableNativeImageDecoder,d=void 0!==f&&f,g=i.dict,m=g.get("Width","W"),p=g.get("Height","H");if(!(m&&(0,o.isNum)(m)&&p&&(0,o.isNum)(p))){(0,o.warn)("Image dimensions are missing, or not numbers.");return Promise.resolve()}var v,b,y=this.options.maxImageSize;if(-1!==y&&m*p>y){(0,o.warn)("Image exceeded maximum allowed size and was removed.");return Promise.resolve()}if(g.get("ImageMask","IM")||!1){var w=g.get("Width","W"),S=g.get("Height","H"),C=w+7>>3,_=i.getBytes(C*S,!0),A=g.getArray("Decode","D");(v=x.PDFImage.createMask({imgArray:_,width:w,height:S,imageIsFromDecodeStream:i instanceof c.DecodeStream,inverseDecode:!!A&&A[0]>0})).cached=!0;b=[v];l.addOp(o.OPS.paintImageMaskXObject,b);u&&(h[u]={fn:o.OPS.paintImageMaskXObject,args:b});return Promise.resolve()}var P=g.get("SMask","SM")||!1,I=g.get("Mask")||!1;if(s&&!P&&!I&&!(i instanceof k.JpegStream)&&m+p<200){v=new x.PDFImage({xref:this.xref,res:a,image:i,isInline:s,pdfFunctionFactory:this.pdfFunctionFactory}).createImageData(!0);l.addOp(o.OPS.paintInlineImageXObject,[v]);return Promise.resolve()}var O=d?o.NativeImageDecoding.NONE:this.options.nativeImageDecoderSupport,T="img_"+this.idFactory.createObjId();if(O!==o.NativeImageDecoding.NONE&&!P&&!I&&i instanceof k.JpegStream&&t.isSupported(i,this.xref,a,this.pdfFunctionFactory))return this.handler.sendWithPromise("obj",[T,this.pageIndex,"JpegStream",i.getIR(this.options.forceDataSchema)]).then(function(){l.addDependency(T);b=[T,m,p];l.addOp(o.OPS.paintJpegXObject,b);u&&(h[u]={fn:o.OPS.paintJpegXObject,args:b})},function(e){(0,o.warn)("Native JPEG decoding failed -- trying to recover: "+(e&&e.message));return r.buildPaintImageXObject({resources:a,image:i,isInline:s,operatorList:l,cacheKey:u,imageCache:h,forceDisableNativeImageDecoder:!0})});var E=null;O===o.NativeImageDecoding.DECODE&&(i instanceof k.JpegStream||I instanceof k.JpegStream||P instanceof k.JpegStream)&&(E=new t({xref:this.xref,resources:a,handler:this.handler,forceDataSchema:this.options.forceDataSchema,pdfFunctionFactory:this.pdfFunctionFactory}));l.addDependency(T);b=[T,m,p];x.PDFImage.buildImage({handler:this.handler,xref:this.xref,res:a,image:i,isInline:s,nativeDecoder:E,pdfFunctionFactory:this.pdfFunctionFactory}).then(function(e){var t=e.createImageData(!1);r.handler.send("obj",[T,r.pageIndex,"Image",t],[t.data.buffer])}).catch(function(e){(0,o.warn)("Unable to decode image: "+e);r.handler.send("obj",[T,r.pageIndex,"Image",null])});l.addOp(o.OPS.paintImageXObject,b);u&&(h[u]={fn:o.OPS.paintImageXObject,args:b});return Promise.resolve()},handleSMask:function(e,t,r,a,i){var n=e.get("G"),o={subtype:e.get("S").name,backdrop:e.get("BC")},s=e.get("TR");if((0,w.isPDFFunction)(s)){for(var c=this.pdfFunctionFactory.create(s),l=new Uint8Array(256),u=new Float32Array(1),h=0;h<256;h++){u[0]=h/255;c(u,0,u,0);l[h]=255*u[0]|0}o.transferMap=l}return this.buildFormXObject(t,n,o,r,a,i.state.clone())},handleTilingType:function(e,t,r,a,i,n,s){var c=this,u=new C.OperatorList,h=[i.get("Resources"),r],f=l.Dict.merge(this.xref,h);return this.getOperatorList({stream:a,task:s,resources:f,operatorList:u}).then(function(){return(0,g.getTilingPatternIR)({fnArray:u.fnArray,argsArray:u.argsArray},i,t)}).then(function(t){n.addDependencies(u.dependencies);n.addOp(e,t)},function(e){if(!c.options.ignoreErrors)throw e;c.handler.send("UnsupportedFeature",{featureId:o.UNSUPPORTED_FEATURES.unknown});(0,o.warn)('handleTilingType - ignoring pattern: "'+e+'".')})},handleSetFont:function(e,t,r,a,i,n){var s,c=this;t&&(s=(t=t.slice())[0].name);return this.loadFont(s,r,e).then(function(t){return t.font.isType3Font?t.loadType3Data(c,e,a,i).then(function(){return t}).catch(function(e){c.handler.send("UnsupportedFeature",{featureId:o.UNSUPPORTED_FEATURES.font});return new A("g_font_error",new u.ErrorFont("Type3 font load error: "+e),t.font)}):t}).then(function(e){n.font=e.font;e.send(c.handler);return e.loadedName})},handleText:function(e,t){var r=this,a=t.font,i=a.charsToGlyphs(e),n=!!(t.textRenderingMode&o.TextRenderingMode.ADD_TO_PATH_FLAG);if(a.data&&(n||this.options.disableFontFace||"Pattern"===t.fillColorSpace.name))for(var s=function(e){if(!a.renderer.hasBuiltPath(e)){var t=a.renderer.getPathJs(e);r.handler.send("commonobj",[a.loadedName+"_path_"+e,"FontPath",t])}},c=0,l=i.length;c<l;c++){var u=i[c];s(u.fontChar);var h=u.accent;h&&h.fontChar&&s(h.fontChar)}return i},setGState:function(e,t,r,a,i){for(var n=this,s=[],c=t.getKeys(),u=Promise.resolve(),h=function(){var h=c[f],d=t.get(h);switch(h){case"Type":break;case"LW":case"LC":case"LJ":case"ML":case"D":case"RI":case"FL":case"CA":case"ca":s.push([h,d]);break;case"Font":u=u.then(function(){return n.handleSetFont(e,null,d[0],r,a,i.state).then(function(e){r.addDependency(e);s.push([h,[e,d[1]]])})});break;case"BM":s.push([h,function(e){if(!(0,l.isName)(e))return"source-over";switch(e.name){case"Normal":case"Compatible":return"source-over";case"Multiply":return"multiply";case"Screen":return"screen";case"Overlay":return"overlay";case"Darken":return"darken";case"Lighten":return"lighten";case"ColorDodge":return"color-dodge";case"ColorBurn":return"color-burn";case"HardLight":return"hard-light";case"SoftLight":return"soft-light";case"Difference":return"difference";case"Exclusion":return"exclusion";case"Hue":return"hue";case"Saturation":return"saturation";case"Color":return"color";case"Luminosity":return"luminosity"}(0,o.warn)("Unsupported blend mode: "+e.name);return"source-over"}(d)]);break;case"SMask":if((0,l.isName)(d,"None")){s.push([h,!1]);break}if((0,l.isDict)(d)){u=u.then(function(){return n.handleSMask(d,e,r,a,i)});s.push([h,!0])}else(0,o.warn)("Unsupported SMask type");break;case"OP":case"op":case"OPM":case"BG":case"BG2":case"UCR":case"UCR2":case"TR":case"TR2":case"HT":case"SM":case"SA":case"AIS":case"TK":(0,o.info)("graphic state operator "+h);break;default:(0,o.info)("Unknown graphic state operator "+h)}},f=0,d=c.length;f<d;f++)h();return u.then(function(){s.length>0&&r.addOp(o.OPS.setGState,[s])})},loadFont:function(e,t,r){var a=this;function i(){return Promise.resolve(new A("g_font_error",new u.ErrorFont("Font "+e+" is not available"),t))}var n,s=this.xref;if(t){if(!(0,l.isRef)(t))throw new Error('The "font" object should be a reference.');n=t}else{var c=r.get("Font");if(!c){(0,o.warn)("fontRes not available");return i()}n=c.getRaw(e)}if(!n){(0,o.warn)("fontRef not available");return i()}if(this.fontCache.has(n))return this.fontCache.get(n);t=s.fetchIfRef(n);if(!(0,l.isDict)(t))return i();if(t.translated)return t.translated;var h,f,d=(0,o.createPromiseCapability)(),g=this.preEvaluateFont(t),m=g.descriptor,p=(0,l.isRef)(n);p&&(h=n.toString());if((0,l.isDict)(m)){m.fontAliases||(m.fontAliases=Object.create(null));var v=m.fontAliases,b=g.hash;if(v[b]){var y=v[b].aliasRef;if(p&&y&&this.fontCache.has(y)){this.fontCache.putAlias(n,y);return this.fontCache.get(n)}}else v[b]={fontID:u.Font.getFontID()};p&&(v[b].aliasRef=n);h=v[b].fontID}if(p)this.fontCache.put(n,d.promise);else{h||(h=this.idFactory.createObjId());this.fontCache.put("id_"+h,d.promise)}(0,o.assert)(h,'The "fontID" must be defined.');t.loadedName="g_"+this.pdfManager.docId+"_f"+h;t.translated=d.promise;try{f=this.translateFont(g)}catch(e){f=Promise.reject(e)}f.then(function(e){if(void 0!==e.fontType){s.stats.fontTypes[e.fontType]=!0}d.resolve(new A(t.loadedName,e,t))}).catch(function(e){a.handler.send("UnsupportedFeature",{featureId:o.UNSUPPORTED_FEATURES.font});try{var r=g.descriptor,i=r&&r.get("FontFile3"),n=i&&i.get("Subtype"),c=(0,u.getFontType)(g.type,n&&n.name);s.stats.fontTypes[c]=!0}catch(e){}d.resolve(new A(t.loadedName,new u.ErrorFont(e instanceof Error?e.message:e),t))});return d.promise},buildPath:function(e,t,r){var a=e.length-1;r||(r=[]);if(a<0||e.fnArray[a]!==o.OPS.constructPath)e.addOp(o.OPS.constructPath,[[t],r]);else{var i=e.argsArray[a];i[0].push(t);Array.prototype.push.apply(i[1],r)}},handleColorN:function(e,t,r,a,i,n,o){var s,c=r[r.length-1];if((0,l.isName)(c)&&(s=i.get(c.name))){var u=(0,l.isStream)(s)?s.dict:s,h=u.get("PatternType");if(1===h){var f=a.base?a.base.getRgb(r,0):null;return this.handleTilingType(t,f,n,s,u,e,o)}if(2===h){var d=u.get("Shading"),m=u.getArray("Matrix");s=g.Pattern.parseShading(d,m,this.xref,n,this.handler,this.pdfFunctionFactory);e.addOp(t,s.getIR());return Promise.resolve()}return Promise.reject(new Error("Unknown PatternType: "+h))}e.addOp(t,r);return Promise.resolve()},getOperatorList:function(e){var t=this,r=e.stream,n=e.task,s=e.resources,c=e.operatorList,u=e.initialState,h=void 0===u?null:u;s=s||l.Dict.empty;h=h||new O;if(!c)throw new Error('getOperatorList: missing "operatorList" parameter');var f=this,d=this.xref,m=Object.create(null),p=s.get("XObject")||l.Dict.empty,b=s.get("Pattern")||l.Dict.empty,y=new P(h),w=new T(r,d,y),k=new a;function S(e){for(var t=0,r=w.savedStatesDepth;t<r;t++)c.addOp(o.OPS.restore,[])}return new Promise(function e(t,r){var a=function(a){a.then(function(){try{e(t,r)}catch(e){r(e)}},r)};n.ensureNotTerminated();k.reset();for(var u,h,C,x,_={};!(u=k.check());){_.args=null;if(!w.read(_))break;var A=_.args,P=_.fn;switch(0|P){case o.OPS.paintXObject:var I=A[0].name;if(I&&void 0!==m[I]){c.addOp(m[I].fn,m[I].args);A=null;continue}a(new Promise(function(e,t){if(!I)throw new o.FormatError("XObject must be referred to by name.");var r=p.get(I);if(r){if(!(0,l.isStream)(r))throw new o.FormatError("XObject should be a stream");var a=r.dict.get("Subtype");if(!(0,l.isName)(a))throw new o.FormatError("XObject should have a Name subtype");if("Form"!==a.name)if("Image"!==a.name){if("PS"!==a.name)throw new o.FormatError("Unhandled XObject subtype "+a.name);(0,o.info)("Ignored XObject subtype PS");e()}else f.buildPaintImageXObject({resources:s,image:r,operatorList:c,cacheKey:I,imageCache:m}).then(e,t);else{y.save();f.buildFormXObject(s,r,null,c,n,y.state.clone()).then(function(){y.restore();e()},t)}}else{c.addOp(P,A);e()}}).catch(function(e){if(!f.options.ignoreErrors)throw e;f.handler.send("UnsupportedFeature",{featureId:o.UNSUPPORTED_FEATURES.unknown});(0,o.warn)('getOperatorList - ignoring XObject: "'+e+'".')}));return;case o.OPS.setFont:var O=A[1];a(f.handleSetFont(s,A,null,c,n,y.state).then(function(e){c.addDependency(e);c.addOp(o.OPS.setFont,[e,O])}));return;case o.OPS.endInlineImage:var T=A[0].cacheKey;if(T){var E=m[T];if(void 0!==E){c.addOp(E.fn,E.args);A=null;continue}}a(f.buildPaintImageXObject({resources:s,image:A[0],isInline:!0,operatorList:c,cacheKey:T,imageCache:m}));return;case o.OPS.showText:A[0]=f.handleText(A[0],y.state);break;case o.OPS.showSpacedText:var F=A[0],R=[],B=F.length,D=y.state;for(h=0;h<B;++h){var M=F[h];(0,o.isString)(M)?Array.prototype.push.apply(R,f.handleText(M,D)):(0,o.isNum)(M)&&R.push(M)}A[0]=R;P=o.OPS.showText;break;case o.OPS.nextLineShowText:c.addOp(o.OPS.nextLine);A[0]=f.handleText(A[0],y.state);P=o.OPS.showText;break;case o.OPS.nextLineSetSpacingShowText:c.addOp(o.OPS.nextLine);c.addOp(o.OPS.setWordSpacing,[A.shift()]);c.addOp(o.OPS.setCharSpacing,[A.shift()]);A[0]=f.handleText(A[0],y.state);P=o.OPS.showText;break;case o.OPS.setTextRenderingMode:y.state.textRenderingMode=A[0];break;case o.OPS.setFillColorSpace:y.state.fillColorSpace=v.ColorSpace.parse(A[0],d,s,f.pdfFunctionFactory);continue;case o.OPS.setStrokeColorSpace:y.state.strokeColorSpace=v.ColorSpace.parse(A[0],d,s,f.pdfFunctionFactory);continue;case o.OPS.setFillColor:x=y.state.fillColorSpace;A=x.getRgb(A,0);P=o.OPS.setFillRGBColor;break;case o.OPS.setStrokeColor:x=y.state.strokeColorSpace;A=x.getRgb(A,0);P=o.OPS.setStrokeRGBColor;break;case o.OPS.setFillGray:y.state.fillColorSpace=v.ColorSpace.singletons.gray;A=v.ColorSpace.singletons.gray.getRgb(A,0);P=o.OPS.setFillRGBColor;break;case o.OPS.setStrokeGray:y.state.strokeColorSpace=v.ColorSpace.singletons.gray;A=v.ColorSpace.singletons.gray.getRgb(A,0);P=o.OPS.setStrokeRGBColor;break;case o.OPS.setFillCMYKColor:y.state.fillColorSpace=v.ColorSpace.singletons.cmyk;A=v.ColorSpace.singletons.cmyk.getRgb(A,0);P=o.OPS.setFillRGBColor;break;case o.OPS.setStrokeCMYKColor:y.state.strokeColorSpace=v.ColorSpace.singletons.cmyk;A=v.ColorSpace.singletons.cmyk.getRgb(A,0);P=o.OPS.setStrokeRGBColor;break;case o.OPS.setFillRGBColor:y.state.fillColorSpace=v.ColorSpace.singletons.rgb;A=v.ColorSpace.singletons.rgb.getRgb(A,0);break;case o.OPS.setStrokeRGBColor:y.state.strokeColorSpace=v.ColorSpace.singletons.rgb;A=v.ColorSpace.singletons.rgb.getRgb(A,0);break;case o.OPS.setFillColorN:if("Pattern"===(x=y.state.fillColorSpace).name){a(f.handleColorN(c,o.OPS.setFillColorN,A,x,b,s,n));return}A=x.getRgb(A,0);P=o.OPS.setFillRGBColor;break;case o.OPS.setStrokeColorN:if("Pattern"===(x=y.state.strokeColorSpace).name){a(f.handleColorN(c,o.OPS.setStrokeColorN,A,x,b,s,n));return}A=x.getRgb(A,0);P=o.OPS.setStrokeRGBColor;break;case o.OPS.shadingFill:var L=s.get("Shading");if(!L)throw new o.FormatError("No shading resource found");var N=L.get(A[0].name);if(!N)throw new o.FormatError("No shading object found");var U=g.Pattern.parseShading(N,null,d,s,f.handler,f.pdfFunctionFactory).getIR();A=[U];P=o.OPS.shadingFill;break;case o.OPS.setGState:var q=A[0],j=s.get("ExtGState");if(!(0,l.isDict)(j)||!j.has(q.name))break;var z=j.get(q.name);a(f.setGState(s,z,c,n,y));return;case o.OPS.moveTo:case o.OPS.lineTo:case o.OPS.curveTo:case o.OPS.curveTo2:case o.OPS.curveTo3:case o.OPS.closePath:case o.OPS.rectangle:f.buildPath(c,P,A);continue;case o.OPS.markPoint:case o.OPS.markPointProps:case o.OPS.beginMarkedContent:case o.OPS.beginMarkedContentProps:case o.OPS.endMarkedContent:case o.OPS.beginCompat:case o.OPS.endCompat:continue;default:if(null!==A){for(h=0,C=A.length;h<C&&!(A[h]instanceof l.Dict);h++);if(h<C){(0,o.warn)("getOperatorList - ignoring operator: "+P);continue}}}c.addOp(P,A)}if(u)a(i);else{S();t()}}).catch(function(e){if(!t.options.ignoreErrors)throw e;t.handler.send("UnsupportedFeature",{featureId:o.UNSUPPORTED_FEATURES.unknown});(0,o.warn)('getOperatorList - ignoring errors during "'+n.name+'" task: "'+e+'".');S()})},getTextContent:function(e){var t=this,r=e.stream,n=e.task,s=e.resources,c=e.stateManager,u=void 0===c?null:c,h=e.normalizeWhitespace,d=void 0!==h&&h,g=e.combineTextItems,m=void 0!==g&&g,v=e.sink,b=e.seenStyles,y=void 0===b?Object.create(null):b;s=s||l.Dict.empty;u=u||new P(new I);var w,k=/\s/g,S={items:[],styles:Object.create(null)},C={initialized:!1,str:[],width:0,height:0,vertical:!1,lastAdvanceWidth:0,lastAdvanceHeight:0,textAdvanceScale:0,spaceWidth:0,fakeSpaceMin:1/0,fakeMultiSpaceMin:1/0,fakeMultiSpaceMax:-0,textRunBreakAllowed:!1,transform:null,fontName:null},x=.3,_=1.5,A=4,O=this,E=this.xref,F=null,R=Object.create(null),B=new T(r,E,u);function D(){if(C.initialized)return C;var e=w.font;if(!(e.loadedName in y)){y[e.loadedName]=!0;S.styles[e.loadedName]={fontFamily:e.fallbackName,ascent:e.ascent,descent:e.descent,vertical:e.vertical}}C.fontName=e.loadedName;var t=[w.fontSize*w.textHScale,0,0,w.fontSize,0,w.textRise];if(e.isType3Font&&w.fontMatrix!==o.FONT_IDENTITY_MATRIX&&1===w.fontSize){var r=e.bbox[3]-e.bbox[1];if(r>0){r*=w.fontMatrix[3];t[3]*=r}}var a=o.Util.transform(w.ctm,o.Util.transform(w.textMatrix,t));C.transform=a;if(e.vertical){C.width=Math.sqrt(a[0]*a[0]+a[1]*a[1]);C.height=0;C.vertical=!0}else{C.width=0;C.height=Math.sqrt(a[2]*a[2]+a[3]*a[3]);C.vertical=!1}var i=w.textLineMatrix[0],n=w.textLineMatrix[1],s=Math.sqrt(i*i+n*n);i=w.ctm[0];n=w.ctm[1];var c=Math.sqrt(i*i+n*n);C.textAdvanceScale=c*s;C.lastAdvanceWidth=0;C.lastAdvanceHeight=0;var l=e.spaceWidth/1e3*w.fontSize;if(l){C.spaceWidth=l;C.fakeSpaceMin=l*x;C.fakeMultiSpaceMin=l*_;C.fakeMultiSpaceMax=l*A;C.textRunBreakAllowed=!e.isMonospace}else{C.spaceWidth=0;C.fakeSpaceMin=1/0;C.fakeMultiSpaceMin=1/0;C.fakeMultiSpaceMax=0;C.textRunBreakAllowed=!1}C.initialized=!0;return C}function M(e){var t=e.str.join(""),r=(0,p.bidi)(t,-1,e.vertical);return{str:d?function(e){for(var t,r=0,a=e.length;r<a&&(t=e.charCodeAt(r))>=32&&t<=127;)r++;return r<a?e.replace(k," "):e}(r.str):r.str,dir:r.dir,width:e.width,height:e.height,transform:e.transform,fontName:e.fontName}}function L(e,t){return O.loadFont(e,t,s).then(function(e){w.font=e.font;w.fontMatrix=e.font.fontMatrix||o.FONT_IDENTITY_MATRIX})}function N(e){for(var t=w.font,r=D(),a=0,i=0,n=t.charsToGlyphs(e),o=0;o<n.length;o++){var s=n[o],c=null;c=t.vertical&&s.vmetric?s.vmetric[0]:s.width;var l=s.unicode,u=(0,f.getNormalizedUnicodes)();void 0!==u[l]&&(l=u[l]);l=(0,f.reverseIfRtl)(l);var h=w.charSpacing;if(s.isSpace){var d=w.wordSpacing;h+=d;d>0&&U(d,r.str)}var g=0,m=0;if(t.vertical){i+=m=c*w.fontMatrix[0]*w.fontSize+h}else{a+=g=(c*w.fontMatrix[0]*w.fontSize+h)*w.textHScale}w.translateTextMatrix(g,m);r.str.push(l)}if(t.vertical){r.lastAdvanceHeight=i;r.height+=Math.abs(i)}else{r.lastAdvanceWidth=a;r.width+=a}return r}function U(e,t){if(!(e<C.fakeSpaceMin))if(e<C.fakeMultiSpaceMin)t.push(" ");else for(var r=Math.round(e/C.spaceWidth);r-- >0;)t.push(" ")}function q(){if(C.initialized){C.width*=C.textAdvanceScale;C.height*=C.textAdvanceScale;S.items.push(M(C));C.initialized=!1;C.str.length=0}}function j(){var e=S.items.length;if(e>0){v.enqueue(S,e);S.items=[];S.styles=Object.create(null)}}var z=new a;return new Promise(function e(t,r){var a=function(a){j();Promise.all([a,v.ready]).then(function(){try{e(t,r)}catch(e){r(e)}},r)};n.ensureNotTerminated();z.reset();for(var c,h={},f=[];!(c=z.check());){f.length=0;h.args=f;if(!B.read(h))break;w=u.state;var g,p=h.fn;f=h.args;switch(0|p){case o.OPS.setFont:var b=f[0].name,k=f[1];if(w.font&&b===w.fontName&&k===w.fontSize)break;q();w.fontName=b;w.fontSize=k;a(L(b,null));return;case o.OPS.setTextRise:q();w.textRise=f[0];break;case o.OPS.setHScale:q();w.textHScale=f[0]/100;break;case o.OPS.setLeading:q();w.leading=f[0];break;case o.OPS.moveText:var x=!!w.font&&0===(w.font.vertical?f[0]:f[1]);g=f[0]-f[1];if(m&&x&&C.initialized&&g>0&&g<=C.fakeMultiSpaceMax){w.translateTextLineMatrix(f[0],f[1]);C.width+=f[0]-C.lastAdvanceWidth;C.height+=f[1]-C.lastAdvanceHeight;U(f[0]-C.lastAdvanceWidth-(f[1]-C.lastAdvanceHeight),C.str);break}q();w.translateTextLineMatrix(f[0],f[1]);w.textMatrix=w.textLineMatrix.slice();break;case o.OPS.setLeadingMoveText:q();w.leading=-f[1];w.translateTextLineMatrix(f[0],f[1]);w.textMatrix=w.textLineMatrix.slice();break;case o.OPS.nextLine:q();w.carriageReturn();break;case o.OPS.setTextMatrix:g=w.calcTextLineMatrixAdvance(f[0],f[1],f[2],f[3],f[4],f[5]);if(m&&null!==g&&C.initialized&&g.value>0&&g.value<=C.fakeMultiSpaceMax){w.translateTextLineMatrix(g.width,g.height);C.width+=g.width-C.lastAdvanceWidth;C.height+=g.height-C.lastAdvanceHeight;U(g.width-C.lastAdvanceWidth-(g.height-C.lastAdvanceHeight),C.str);break}q();w.setTextMatrix(f[0],f[1],f[2],f[3],f[4],f[5]);w.setTextLineMatrix(f[0],f[1],f[2],f[3],f[4],f[5]);break;case o.OPS.setCharSpacing:w.charSpacing=f[0];break;case o.OPS.setWordSpacing:w.wordSpacing=f[0];break;case o.OPS.beginText:q();w.textMatrix=o.IDENTITY_MATRIX.slice();w.textLineMatrix=o.IDENTITY_MATRIX.slice();break;case o.OPS.showSpacedText:for(var _,A=f[0],I=0,T=A.length;I<T;I++)if("string"==typeof A[I])N(A[I]);else if((0,o.isNum)(A[I])){D();g=A[I]*w.fontSize/1e3;var E=!1;if(w.font.vertical){_=g;w.translateTextMatrix(0,_);(E=C.textRunBreakAllowed&&g>C.fakeMultiSpaceMax)||(C.height+=_)}else{_=(g=-g)*w.textHScale;w.translateTextMatrix(_,0);(E=C.textRunBreakAllowed&&g>C.fakeMultiSpaceMax)||(C.width+=_)}E?q():g>0&&U(g,C.str)}break;case o.OPS.showText:N(f[0]);break;case o.OPS.nextLineShowText:q();w.carriageReturn();N(f[0]);break;case o.OPS.nextLineSetSpacingShowText:q();w.wordSpacing=f[0];w.charSpacing=f[1];w.carriageReturn();N(f[2]);break;case o.OPS.paintXObject:q();F||(F=s.get("XObject")||l.Dict.empty);var M=f[0].name;if(M&&void 0!==R[M])break;a(new Promise(function(e,t){if(!M)throw new o.FormatError("XObject must be referred to by name.");var r=F.get(M);if(r){if(!(0,l.isStream)(r))throw new o.FormatError("XObject should be a stream");var a=r.dict.get("Subtype");if(!(0,l.isName)(a))throw new o.FormatError("XObject should have a Name subtype");if("Form"===a.name){var i=u.state.clone(),c=new P(i),h=r.dict.getArray("Matrix");Array.isArray(h)&&6===h.length&&c.transform(h);j();var f={enqueueInvoked:!1,enqueue:function(e,t){this.enqueueInvoked=!0;v.enqueue(e,t)},get desiredSize(){return v.desiredSize},get ready(){return v.ready}};O.getTextContent({stream:r,task:n,resources:r.dict.get("Resources")||s,stateManager:c,normalizeWhitespace:d,combineTextItems:m,sink:f,seenStyles:y}).then(function(){f.enqueueInvoked||(R[M]=!0);e()},t)}else{R[M]=!0;e()}}else e()}).catch(function(e){if(!(e instanceof o.AbortException)){if(!O.options.ignoreErrors)throw e;(0,o.warn)('getTextContent - ignoring XObject: "'+e+'".')}}));return;case o.OPS.setGState:q();var H=f[0],G=s.get("ExtGState");if(!(0,l.isDict)(G)||!(0,l.isName)(H))break;var W=G.get(H.name);if(!(0,l.isDict)(W))break;var X=W.get("Font");if(X){w.fontName=null;w.fontSize=X[1];a(L(null,X[0]));return}}if(S.items.length>=v.desiredSize){c=!0;break}}if(c)a(i);else{q();j();t()}}).catch(function(e){if(!(e instanceof o.AbortException)){if(!t.options.ignoreErrors)throw e;(0,o.warn)('getTextContent - ignoring errors during "'+n.name+'" task: "'+e+'".');q();j()}})},extractDataStructures:function(e,t,r){var a=this,i=this.xref,n=e.get("ToUnicode")||t.get("ToUnicode"),s=n?this.readToUnicode(n):Promise.resolve(void 0);if(r.composite){var c=e.get("CIDSystemInfo");(0,l.isDict)(c)&&(r.cidSystemInfo={registry:(0,o.stringToPDFString)(c.get("Registry")),ordering:(0,o.stringToPDFString)(c.get("Ordering")),supplement:c.get("Supplement")});var f=e.get("CIDToGIDMap");(0,l.isStream)(f)&&(r.cidToGidMap=this.readCidToGidMap(f))}var d,g=[],m=null;if(e.has("Encoding")){d=e.get("Encoding");if((0,l.isDict)(d)){m=d.get("BaseEncoding");m=(0,l.isName)(m)?m.name:null;if(d.has("Differences"))for(var p=d.get("Differences"),v=0,b=0,y=p.length;b<y;b++){var w=i.fetchIfRef(p[b]);if((0,o.isNum)(w))v=w;else{if(!(0,l.isName)(w))throw new o.FormatError("Invalid entry in 'Differences' array: "+w);g[v++]=w.name}}}else{if(!(0,l.isName)(d))throw new o.FormatError("Encoding is not a Name nor a Dict");m=d.name}"MacRomanEncoding"!==m&&"MacExpertEncoding"!==m&&"WinAnsiEncoding"!==m&&(m=null)}if(m)r.defaultEncoding=(0,h.getEncoding)(m).slice();else{var k=!!(r.flags&u.FontFlags.Symbolic),S=!!(r.flags&u.FontFlags.Nonsymbolic);d=h.StandardEncoding;"TrueType"!==r.type||S||(d=h.WinAnsiEncoding);if(k){d=h.MacRomanEncoding;r.file||(/Symbol/i.test(r.name)?d=h.SymbolSetEncoding:/Dingbats/i.test(r.name)&&(d=h.ZapfDingbatsEncoding))}r.defaultEncoding=d}r.differences=g;r.baseEncodingName=m;r.hasEncoding=!!m||g.length>0;r.dict=e;return s.then(function(e){r.toUnicode=e;return a.buildToUnicode(r)}).then(function(e){r.toUnicode=e;return r})},_buildSimpleFontToUnicode:function(e){(0,o.assert)(!e.composite,"Must be a simple font.");var t=[],r=void 0,a=void 0,i=e.defaultEncoding.slice(),n=e.baseEncodingName,s=e.differences;for(r in s)".notdef"!==(a=s[r])&&(i[r]=a);var c=(0,b.getGlyphsUnicode)();for(r in i)if(""!==(a=i[r]))if(void 0!==c[a])t[r]=String.fromCharCode(c[a]);else{var l=0;switch(a[0]){case"G":3===a.length&&(l=parseInt(a.substring(1),16));break;case"g":5===a.length&&(l=parseInt(a.substring(1),16));break;case"C":case"c":a.length>=3&&(l=+a.substring(1));break;default:var d=(0,f.getUnicodeForGlyph)(a,c);-1!==d&&(l=d)}if(l){if(n&&l===+r){var g=(0,h.getEncoding)(n);if(g&&(a=g[r])){t[r]=String.fromCharCode(c[a]);continue}}t[r]=String.fromCharCode(l)}}return new u.ToUnicodeMap(t)},buildToUnicode:function(e){e.hasIncludedToUnicodeMap=!!e.toUnicode&&e.toUnicode.length>0;if(e.hasIncludedToUnicodeMap){!e.composite&&e.hasEncoding&&(e.fallbackToUnicode=this._buildSimpleFontToUnicode(e));return Promise.resolve(e.toUnicode)}if(!e.composite)return Promise.resolve(this._buildSimpleFontToUnicode(e));if(e.composite&&(e.cMap.builtInCMap&&!(e.cMap instanceof s.IdentityCMap)||"Adobe"===e.cidSystemInfo.registry&&("GB1"===e.cidSystemInfo.ordering||"CNS1"===e.cidSystemInfo.ordering||"Japan1"===e.cidSystemInfo.ordering||"Korea1"===e.cidSystemInfo.ordering))){var t=e.cidSystemInfo.registry,r=e.cidSystemInfo.ordering,a=l.Name.get(t+"-"+r+"-UCS2");return s.CMapFactory.create({encoding:a,fetchBuiltInCMap:this.fetchBuiltInCMap,useCMap:null}).then(function(t){var r=[];e.cMap.forEach(function(e,a){if(a>65535)throw new o.FormatError("Max size of CID is 65,535");var i=t.lookup(a);i&&(r[e]=String.fromCharCode((i.charCodeAt(0)<<8)+i.charCodeAt(1)))});return new u.ToUnicodeMap(r)})}return Promise.resolve(new u.IdentityToUnicodeMap(e.firstChar,e.lastChar))},readToUnicode:function(e){var t=e;return(0,l.isName)(t)?s.CMapFactory.create({encoding:t,fetchBuiltInCMap:this.fetchBuiltInCMap,useCMap:null}).then(function(e){return e instanceof s.IdentityCMap?new u.IdentityToUnicodeMap(0,65535):new u.ToUnicodeMap(e.getMap())}):(0,l.isStream)(t)?s.CMapFactory.create({encoding:t,fetchBuiltInCMap:this.fetchBuiltInCMap,useCMap:null}).then(function(e){if(e instanceof s.IdentityCMap)return new u.IdentityToUnicodeMap(0,65535);var t=new Array(e.length);e.forEach(function(e,r){for(var a=[],i=0;i<r.length;i+=2){var n=r.charCodeAt(i)<<8|r.charCodeAt(i+1);if(55296==(63488&n)){i+=2;var o=r.charCodeAt(i)<<8|r.charCodeAt(i+1);a.push(((1023&n)<<10)+(1023&o)+65536)}else a.push(n)}t[e]=String.fromCharCode.apply(String,a)});return new u.ToUnicodeMap(t)}):Promise.resolve(null)},readCidToGidMap:function(e){for(var t=e.getBytes(),r=[],a=0,i=t.length;a<i;a++){var n=t[a++]<<8|t[a];if(0!==n){r[a>>1]=n}}return r},extractWidths:function(e,t,r){var a,i,n,o,s,c,h,f,d=this.xref,g=[],m=0,p=[];if(r.composite){m=e.has("DW")?e.get("DW"):1e3;if(f=e.get("W"))for(i=0,n=f.length;i<n;i++){c=d.fetchIfRef(f[i++]);h=d.fetchIfRef(f[i]);if(Array.isArray(h))for(o=0,s=h.length;o<s;o++)g[c++]=d.fetchIfRef(h[o]);else{var v=d.fetchIfRef(f[++i]);for(o=c;o<=h;o++)g[o]=v}}if(r.vertical){var b=e.getArray("DW2")||[880,-1e3];a=[b[1],.5*m,b[0]];if(b=e.get("W2"))for(i=0,n=b.length;i<n;i++){c=d.fetchIfRef(b[i++]);h=d.fetchIfRef(b[i]);if(Array.isArray(h))for(o=0,s=h.length;o<s;o++)p[c++]=[d.fetchIfRef(h[o++]),d.fetchIfRef(h[o++]),d.fetchIfRef(h[o])];else{var y=[d.fetchIfRef(b[++i]),d.fetchIfRef(b[++i]),d.fetchIfRef(b[++i])];for(o=c;o<=h;o++)p[o]=y}}}}else{var w=r.firstChar;if(f=e.get("Widths")){o=w;for(i=0,n=f.length;i<n;i++)g[o++]=d.fetchIfRef(f[i]);m=parseFloat(t.get("MissingWidth"))||0}else{var k=e.get("BaseFont");if((0,l.isName)(k)){var S=this.getBaseFontMetrics(k.name);g=this.buildCharCodeToWidth(S.widths,r);m=S.defaultWidth}}}var C=!0,x=m;for(var _ in g){var A=g[_];if(A)if(x){if(x!==A){C=!1;break}}else x=A}C&&(r.flags|=u.FontFlags.FixedPitch);r.defaultWidth=m;r.widths=g;r.defaultVMetrics=a;r.vmetrics=p},isSerifFont:function(e){var t=e.split("-")[0];return t in(0,d.getSerifFonts)()||-1!==t.search(/serif/gi)},getBaseFontMetrics:function(e){var t=0,r=[],a=!1,i=(0,d.getStdFontMap)()[e]||e,n=(0,y.getMetrics)();i in n||(i=this.isSerifFont(e)?"Times-Roman":"Helvetica");var s=n[i];if((0,o.isNum)(s)){t=s;a=!0}else r=s();return{defaultWidth:t,monospace:a,widths:r}},buildCharCodeToWidth:function(e,t){for(var r=Object.create(null),a=t.differences,i=t.defaultEncoding,n=0;n<256;n++)n in a&&e[a[n]]?r[n]=e[a[n]]:n in i&&e[i[n]]&&(r[n]=e[i[n]]);return r},preEvaluateFont:function(e){var t=e,r=e.get("Subtype");if(!(0,l.isName)(r))throw new o.FormatError("invalid font Subtype");var a,i=!1;if("Type0"===r.name){var n=e.get("DescendantFonts");if(!n)throw new o.FormatError("Descendant fonts are not specified");r=(e=Array.isArray(n)?this.xref.fetchIfRef(n[0]):n).get("Subtype");if(!(0,l.isName)(r))throw new o.FormatError("invalid font Subtype");i=!0}var s=e.get("FontDescriptor");if(s){var c=new S.MurmurHash3_64,u=t.getRaw("Encoding");if((0,l.isName)(u))c.update(u.name);else if((0,l.isRef)(u))c.update(u.toString());else if((0,l.isDict)(u))for(var h=u.getKeys(),f=0,d=h.length;f<d;f++){var g=u.getRaw(h[f]);if((0,l.isName)(g))c.update(g.name);else if((0,l.isRef)(g))c.update(g.toString());else if(Array.isArray(g)){for(var m=g.length,p=new Array(m),v=0;v<m;v++){var b=g[v];(0,l.isName)(b)?p[v]=b.name:((0,o.isNum)(b)||(0,l.isRef)(b))&&(p[v]=b.toString())}c.update(p.join())}}var y=e.get("ToUnicode")||t.get("ToUnicode");if((0,l.isStream)(y)){var w=y.str||y;a=w.buffer?new Uint8Array(w.buffer.buffer,0,w.bufferLength):new Uint8Array(w.bytes.buffer,w.start,w.end-w.start);c.update(a)}else(0,l.isName)(y)&&c.update(y.name);var k=e.get("Widths")||t.get("Widths");if(k){a=new Uint8Array(new Uint32Array(k).buffer);c.update(a)}}return{descriptor:s,dict:e,baseDict:t,composite:i,type:r.name,hash:c?c.hexdigest():""}},translateFont:function(e){var t,r=this,a=e.baseDict,i=e.dict,n=e.composite,c=e.descriptor,h=e.type,f=n?65535:255;if(!c){if("Type3"!==h){var g=i.get("BaseFont");if(!(0,l.isName)(g))throw new o.FormatError("Base font is not specified");g=g.name.replace(/[,_]/g,"-");var m=this.getBaseFontMetrics(g),p=g.split("-")[0],v=(this.isSerifFont(p)?u.FontFlags.Serif:0)|(m.monospace?u.FontFlags.FixedPitch:0)|((0,d.getSymbolsFonts)()[p]?u.FontFlags.Symbolic:u.FontFlags.Nonsymbolic);t={type:h,name:g,widths:m.widths,defaultWidth:m.defaultWidth,flags:v,firstChar:0,lastChar:f};return this.extractDataStructures(i,i,t).then(function(e){e.widths=r.buildCharCodeToWidth(m.widths,e);return new u.Font(g,null,e)})}(c=new l.Dict(null)).set("FontName",l.Name.get(h));c.set("FontBBox",i.getArray("FontBBox"))}var b=i.get("FirstChar")||0,y=i.get("LastChar")||f,w=c.get("FontName"),k=i.get("BaseFont");(0,o.isString)(w)&&(w=l.Name.get(w));(0,o.isString)(k)&&(k=l.Name.get(k));if("Type3"!==h){var S=w&&w.name,C=k&&k.name;if(S!==C){(0,o.info)("The FontDescriptor's FontName is \""+S+'" but should be the same as the Font\'s BaseFont "'+C+'"');S&&C&&0===C.indexOf(S)&&(w=k)}}w=w||k;if(!(0,l.isName)(w))throw new o.FormatError("invalid font name");var x,_=c.get("FontFile","FontFile2","FontFile3");if(_&&_.dict){var A=_.dict.get("Subtype");A&&(A=A.name);var P=_.dict.get("Length1"),I=_.dict.get("Length2"),O=_.dict.get("Length3")}t={type:h,name:w.name,subtype:A,file:_,length1:P,length2:I,length3:O,loadedName:a.loadedName,composite:n,wideChars:n,fixedPitch:!1,fontMatrix:i.getArray("FontMatrix")||o.FONT_IDENTITY_MATRIX,firstChar:b||0,lastChar:y||f,bbox:c.getArray("FontBBox"),ascent:c.get("Ascent"),descent:c.get("Descent"),xHeight:c.get("XHeight"),capHeight:c.get("CapHeight"),flags:c.get("Flags"),italicAngle:c.get("ItalicAngle"),isType3Font:!1};if(n){var T=a.get("Encoding");(0,l.isName)(T)&&(t.cidEncoding=T.name);x=s.CMapFactory.create({encoding:T,fetchBuiltInCMap:this.fetchBuiltInCMap,useCMap:null}).then(function(e){t.cMap=e;t.vertical=t.cMap.vertical})}else x=Promise.resolve(void 0);return x.then(function(){return r.extractDataStructures(i,a,t)}).then(function(e){r.extractWidths(i,c,e);"Type3"===h&&(e.isType3Font=!0);return new u.Font(w.name,_,e)})}};return r}(),A=function(){function e(e,t,r){this.loadedName=e;this.font=t;this.dict=r;this.type3Loaded=null;this.sent=!1}e.prototype={send:function(e){if(!this.sent){var t=this.font.exportData();e.send("commonobj",[this.loadedName,"Font",t]);this.sent=!0}},loadType3Data:function(e,t,r,a){if(!this.font.isType3Font)throw new Error("Must be a Type3 font.");if(this.type3Loaded)return this.type3Loaded;var i=Object.create(e.options);i.ignoreErrors=!1;for(var n=e.clone(i),s=this.font,c=Promise.resolve(),l=this.dict.get("CharProcs"),u=this.dict.get("Resources")||t,h=l.getKeys(),f=Object.create(null),d=function(){var e=h[g];c=c.then(function(){var t=l.get(e),i=new C.OperatorList;return n.getOperatorList({stream:t,task:a,resources:u,operatorList:i}).then(function(){f[e]=i.getIR();r.addDependencies(i.dependencies)}).catch(function(t){(0,o.warn)('Type3 font resource "'+e+'" is not available.');var r=new C.OperatorList;f[e]=r.getIR()})})},g=0,m=h.length;g<m;++g)d();this.type3Loaded=c.then(function(){s.charProcOperatorList=f});return this.type3Loaded}};return e}(),P=function(){function e(e){this.state=e;this.stateStack=[]}e.prototype={save:function(){var e=this.state;this.stateStack.push(this.state);this.state=e.clone()},restore:function(){var e=this.stateStack.pop();e&&(this.state=e)},transform:function(e){this.state.ctm=o.Util.transform(this.state.ctm,e)}};return e}(),I=function(){function e(){this.ctm=new Float32Array(o.IDENTITY_MATRIX);this.fontName=null;this.fontSize=0;this.font=null;this.fontMatrix=o.FONT_IDENTITY_MATRIX;this.textMatrix=o.IDENTITY_MATRIX.slice();this.textLineMatrix=o.IDENTITY_MATRIX.slice();this.charSpacing=0;this.wordSpacing=0;this.leading=0;this.textHScale=1;this.textRise=0}e.prototype={setTextMatrix:function(e,t,r,a,i,n){var o=this.textMatrix;o[0]=e;o[1]=t;o[2]=r;o[3]=a;o[4]=i;o[5]=n},setTextLineMatrix:function(e,t,r,a,i,n){var o=this.textLineMatrix;o[0]=e;o[1]=t;o[2]=r;o[3]=a;o[4]=i;o[5]=n},translateTextMatrix:function(e,t){var r=this.textMatrix;r[4]=r[0]*e+r[2]*t+r[4];r[5]=r[1]*e+r[3]*t+r[5]},translateTextLineMatrix:function(e,t){var r=this.textLineMatrix;r[4]=r[0]*e+r[2]*t+r[4];r[5]=r[1]*e+r[3]*t+r[5]},calcTextLineMatrixAdvance:function(e,t,r,a,i,n){var o=this.font;if(!o)return null;var s=this.textLineMatrix;if(e!==s[0]||t!==s[1]||r!==s[2]||a!==s[3])return null;var c=i-s[4],l=n-s[5];if(o.vertical&&0!==c||!o.vertical&&0!==l)return null;var u,h,f=e*a-t*r;if(o.vertical){u=-l*r/f;h=l*e/f}else{u=c*a/f;h=-c*t/f}return{width:u,height:h,value:o.vertical?h:u}},calcRenderMatrix:function(e){var t=[this.fontSize*this.textHScale,0,0,this.fontSize,0,this.textRise];return o.Util.transform(e,o.Util.transform(this.textMatrix,t))},carriageReturn:function(){this.translateTextLineMatrix(0,-this.leading);this.textMatrix=this.textLineMatrix.slice()},clone:function(){var e=Object.create(this);e.textMatrix=this.textMatrix.slice();e.textLineMatrix=this.textLineMatrix.slice();e.fontMatrix=this.fontMatrix.slice();return e}};return e}(),O=function(){function e(){this.ctm=new Float32Array(o.IDENTITY_MATRIX);this.font=null;this.textRenderingMode=o.TextRenderingMode.FILL;this.fillColorSpace=v.ColorSpace.singletons.gray;this.strokeColorSpace=v.ColorSpace.singletons.gray}e.prototype={clone:function(){return Object.create(this)}};return e}(),T=function(){var e=(0,o.getLookupTableFactory)(function(e){e.w={id:o.OPS.setLineWidth,numArgs:1,variableArgs:!1};e.J={id:o.OPS.setLineCap,numArgs:1,variableArgs:!1};e.j={id:o.OPS.setLineJoin,numArgs:1,variableArgs:!1};e.M={id:o.OPS.setMiterLimit,numArgs:1,variableArgs:!1};e.d={id:o.OPS.setDash,numArgs:2,variableArgs:!1};e.ri={id:o.OPS.setRenderingIntent,numArgs:1,variableArgs:!1};e.i={id:o.OPS.setFlatness,numArgs:1,variableArgs:!1};e.gs={id:o.OPS.setGState,numArgs:1,variableArgs:!1};e.q={id:o.OPS.save,numArgs:0,variableArgs:!1};e.Q={id:o.OPS.restore,numArgs:0,variableArgs:!1};e.cm={id:o.OPS.transform,numArgs:6,variableArgs:!1};e.m={id:o.OPS.moveTo,numArgs:2,variableArgs:!1};e.l={id:o.OPS.lineTo,numArgs:2,variableArgs:!1};e.c={id:o.OPS.curveTo,numArgs:6,variableArgs:!1};e.v={id:o.OPS.curveTo2,numArgs:4,variableArgs:!1};e.y={id:o.OPS.curveTo3,numArgs:4,variableArgs:!1};e.h={id:o.OPS.closePath,numArgs:0,variableArgs:!1};e.re={id:o.OPS.rectangle,numArgs:4,variableArgs:!1};e.S={id:o.OPS.stroke,numArgs:0,variableArgs:!1};e.s={id:o.OPS.closeStroke,numArgs:0,variableArgs:!1};e.f={id:o.OPS.fill,numArgs:0,variableArgs:!1};e.F={id:o.OPS.fill,numArgs:0,variableArgs:!1};e["f*"]={id:o.OPS.eoFill,numArgs:0,variableArgs:!1};e.B={id:o.OPS.fillStroke,numArgs:0,variableArgs:!1};e["B*"]={id:o.OPS.eoFillStroke,numArgs:0,variableArgs:!1};e.b={id:o.OPS.closeFillStroke,numArgs:0,variableArgs:!1};e["b*"]={id:o.OPS.closeEOFillStroke,numArgs:0,variableArgs:!1};e.n={id:o.OPS.endPath,numArgs:0,variableArgs:!1};e.W={id:o.OPS.clip,numArgs:0,variableArgs:!1};e["W*"]={id:o.OPS.eoClip,numArgs:0,variableArgs:!1};e.BT={id:o.OPS.beginText,numArgs:0,variableArgs:!1};e.ET={id:o.OPS.endText,numArgs:0,variableArgs:!1};e.Tc={id:o.OPS.setCharSpacing,numArgs:1,variableArgs:!1};e.Tw={id:o.OPS.setWordSpacing,numArgs:1,variableArgs:!1};e.Tz={id:o.OPS.setHScale,numArgs:1,variableArgs:!1};e.TL={id:o.OPS.setLeading,numArgs:1,variableArgs:!1};e.Tf={id:o.OPS.setFont,numArgs:2,variableArgs:!1};e.Tr={id:o.OPS.setTextRenderingMode,numArgs:1,variableArgs:!1};e.Ts={id:o.OPS.setTextRise,numArgs:1,variableArgs:!1};e.Td={id:o.OPS.moveText,numArgs:2,variableArgs:!1};e.TD={id:o.OPS.setLeadingMoveText,numArgs:2,variableArgs:!1};e.Tm={id:o.OPS.setTextMatrix,numArgs:6,variableArgs:!1};e["T*"]={id:o.OPS.nextLine,numArgs:0,variableArgs:!1};e.Tj={id:o.OPS.showText,numArgs:1,variableArgs:!1};e.TJ={id:o.OPS.showSpacedText,numArgs:1,variableArgs:!1};e["'"]={id:o.OPS.nextLineShowText,numArgs:1,variableArgs:!1};e['"']={id:o.OPS.nextLineSetSpacingShowText,numArgs:3,variableArgs:!1};e.d0={id:o.OPS.setCharWidth,numArgs:2,variableArgs:!1};e.d1={id:o.OPS.setCharWidthAndBounds,numArgs:6,variableArgs:!1};e.CS={id:o.OPS.setStrokeColorSpace,numArgs:1,variableArgs:!1};e.cs={id:o.OPS.setFillColorSpace,numArgs:1,variableArgs:!1};e.SC={id:o.OPS.setStrokeColor,numArgs:4,variableArgs:!0};e.SCN={id:o.OPS.setStrokeColorN,numArgs:33,variableArgs:!0};e.sc={id:o.OPS.setFillColor,numArgs:4,variableArgs:!0};e.scn={id:o.OPS.setFillColorN,numArgs:33,variableArgs:!0};e.G={id:o.OPS.setStrokeGray,numArgs:1,variableArgs:!1};e.g={id:o.OPS.setFillGray,numArgs:1,variableArgs:!1};e.RG={id:o.OPS.setStrokeRGBColor,numArgs:3,variableArgs:!1};e.rg={id:o.OPS.setFillRGBColor,numArgs:3,variableArgs:!1};e.K={id:o.OPS.setStrokeCMYKColor,numArgs:4,variableArgs:!1};e.k={id:o.OPS.setFillCMYKColor,numArgs:4,variableArgs:!1};e.sh={id:o.OPS.shadingFill,numArgs:1,variableArgs:!1};e.BI={id:o.OPS.beginInlineImage,numArgs:0,variableArgs:!1};e.ID={id:o.OPS.beginImageData,numArgs:0,variableArgs:!1};e.EI={id:o.OPS.endInlineImage,numArgs:1,variableArgs:!1};e.Do={id:o.OPS.paintXObject,numArgs:1,variableArgs:!1};e.MP={id:o.OPS.markPoint,numArgs:1,variableArgs:!1};e.DP={id:o.OPS.markPointProps,numArgs:2,variableArgs:!1};e.BMC={id:o.OPS.beginMarkedContent,numArgs:1,variableArgs:!1};e.BDC={id:o.OPS.beginMarkedContentProps,numArgs:2,variableArgs:!1};e.EMC={id:o.OPS.endMarkedContent,numArgs:0,variableArgs:!1};e.BX={id:o.OPS.beginCompat,numArgs:0,variableArgs:!1};e.EX={id:o.OPS.endCompat,numArgs:0,variableArgs:!1};e.BM=null;e.BD=null;e.true=null;e.fa=null;e.fal=null;e.fals=null;e.false=null;e.nu=null;e.nul=null;e.null=null});function t(t,r,a){this.opMap=e();this.parser=new m.Parser(new m.Lexer(t,this.opMap),!1,r);this.stateManager=a;this.nonProcessedArgs=[];this._numInvalidPathOPS=0}t.prototype={get savedStatesDepth(){return this.stateManager.stateStack.length},read:function(e){for(var t=e.args;;){var r=this.parser.getObj();if((0,l.isCmd)(r)){var a=r.cmd,i=this.opMap[a];if(!i){(0,o.warn)('Unknown command "'+a+'".');continue}var n=i.id,s=i.numArgs,c=null!==t?t.length:0;if(i.variableArgs)c>s&&(0,o.info)("Command "+a+": expected [0, "+s+"] args, but received "+c+" args.");else{if(c!==s){for(var u=this.nonProcessedArgs;c>s;){u.push(t.shift());c--}for(;c<s&&0!==u.length;){null===t&&(t=[]);t.unshift(u.pop());c++}}if(c<s){var h="command "+a+": expected "+s+" args, but received "+c+" args.";if(n>=o.OPS.moveTo&&n<=o.OPS.endPath&&++this._numInvalidPathOPS>20)throw new o.FormatError("Invalid "+h);(0,o.warn)("Skipping "+h);null!==t&&(t.length=0);continue}}this.preprocessCommand(n,t);e.fn=n;e.args=t;return!0}if((0,l.isEOF)(r))return!1;if(null!==r){null===t&&(t=[]);t.push(r);if(t.length>33)throw new o.FormatError("Too many arguments")}}},preprocessCommand:function(e,t){switch(0|e){case o.OPS.save:this.stateManager.save();break;case o.OPS.restore:this.stateManager.restore();break;case o.OPS.transform:this.stateManager.transform(t)}}};return t}();t.PartialEvaluator=_},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.CMapFactory=t.IdentityCMap=t.CMap=void 0;var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1;a.configurable=!0;"value"in a&&(a.writable=!0);Object.defineProperty(e,a.key,a)}}return function(t,r,a){r&&e(t.prototype,r);a&&e(t,a);return t}}(),i=r(2),n=r(138),o=r(139),s=r(140);function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var l=["Adobe-GB1-UCS2","Adobe-CNS1-UCS2","Adobe-Japan1-UCS2","Adobe-Korea1-UCS2","78-EUC-H","78-EUC-V","78-H","78-RKSJ-H","78-RKSJ-V","78-V","78ms-RKSJ-H","78ms-RKSJ-V","83pv-RKSJ-H","90ms-RKSJ-H","90ms-RKSJ-V","90msp-RKSJ-H","90msp-RKSJ-V","90pv-RKSJ-H","90pv-RKSJ-V","Add-H","Add-RKSJ-H","Add-RKSJ-V","Add-V","Adobe-CNS1-0","Adobe-CNS1-1","Adobe-CNS1-2","Adobe-CNS1-3","Adobe-CNS1-4","Adobe-CNS1-5","Adobe-CNS1-6","Adobe-GB1-0","Adobe-GB1-1","Adobe-GB1-2","Adobe-GB1-3","Adobe-GB1-4","Adobe-GB1-5","Adobe-Japan1-0","Adobe-Japan1-1","Adobe-Japan1-2","Adobe-Japan1-3","Adobe-Japan1-4","Adobe-Japan1-5","Adobe-Japan1-6","Adobe-Korea1-0","Adobe-Korea1-1","Adobe-Korea1-2","B5-H","B5-V","B5pc-H","B5pc-V","CNS-EUC-H","CNS-EUC-V","CNS1-H","CNS1-V","CNS2-H","CNS2-V","ETHK-B5-H","ETHK-B5-V","ETen-B5-H","ETen-B5-V","ETenms-B5-H","ETenms-B5-V","EUC-H","EUC-V","Ext-H","Ext-RKSJ-H","Ext-RKSJ-V","Ext-V","GB-EUC-H","GB-EUC-V","GB-H","GB-V","GBK-EUC-H","GBK-EUC-V","GBK2K-H","GBK2K-V","GBKp-EUC-H","GBKp-EUC-V","GBT-EUC-H","GBT-EUC-V","GBT-H","GBT-V","GBTpc-EUC-H","GBTpc-EUC-V","GBpc-EUC-H","GBpc-EUC-V","H","HKdla-B5-H","HKdla-B5-V","HKdlb-B5-H","HKdlb-B5-V","HKgccs-B5-H","HKgccs-B5-V","HKm314-B5-H","HKm314-B5-V","HKm471-B5-H","HKm471-B5-V","HKscs-B5-H","HKscs-B5-V","Hankaku","Hiragana","KSC-EUC-H","KSC-EUC-V","KSC-H","KSC-Johab-H","KSC-Johab-V","KSC-V","KSCms-UHC-H","KSCms-UHC-HW-H","KSCms-UHC-HW-V","KSCms-UHC-V","KSCpc-EUC-H","KSCpc-EUC-V","Katakana","NWP-H","NWP-V","RKSJ-H","RKSJ-V","Roman","UniCNS-UCS2-H","UniCNS-UCS2-V","UniCNS-UTF16-H","UniCNS-UTF16-V","UniCNS-UTF32-H","UniCNS-UTF32-V","UniCNS-UTF8-H","UniCNS-UTF8-V","UniGB-UCS2-H","UniGB-UCS2-V","UniGB-UTF16-H","UniGB-UTF16-V","UniGB-UTF32-H","UniGB-UTF32-V","UniGB-UTF8-H","UniGB-UTF8-V","UniJIS-UCS2-H","UniJIS-UCS2-HW-H","UniJIS-UCS2-HW-V","UniJIS-UCS2-V","UniJIS-UTF16-H","UniJIS-UTF16-V","UniJIS-UTF32-H","UniJIS-UTF32-V","UniJIS-UTF8-H","UniJIS-UTF8-V","UniJIS2004-UTF16-H","UniJIS2004-UTF16-V","UniJIS2004-UTF32-H","UniJIS2004-UTF32-V","UniJIS2004-UTF8-H","UniJIS2004-UTF8-V","UniJISPro-UCS2-HW-V","UniJISPro-UCS2-V","UniJISPro-UTF8-V","UniJISX0213-UTF32-H","UniJISX0213-UTF32-V","UniJISX02132004-UTF32-H","UniJISX02132004-UTF32-V","UniKS-UCS2-H","UniKS-UCS2-V","UniKS-UTF16-H","UniKS-UTF16-V","UniKS-UTF32-H","UniKS-UTF32-V","UniKS-UTF8-H","UniKS-UTF8-V","V","WP-Symbol"],u=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];c(this,e);this.codespaceRanges=[[],[],[],[]];this.numCodespaceRanges=0;this._map=[];this.name="";this.vertical=!1;this.useCMap=null;this.builtInCMap=t}a(e,[{key:"addCodespaceRange",value:function(e,t,r){this.codespaceRanges[e-1].push(t,r);this.numCodespaceRanges++}},{key:"mapCidRange",value:function(e,t,r){for(;e<=t;)this._map[e++]=r++}},{key:"mapBfRange",value:function(e,t,r){for(var a=r.length-1;e<=t;){this._map[e++]=r;r=r.substring(0,a)+String.fromCharCode(r.charCodeAt(a)+1)}}},{key:"mapBfRangeToArray",value:function(e,t,r){for(var a=0,i=r.length;e<=t&&a<i;){this._map[e]=r[a++];++e}}},{key:"mapOne",value:function(e,t){this._map[e]=t}},{key:"lookup",value:function(e){return this._map[e]}},{key:"contains",value:function(e){return void 0!==this._map[e]}},{key:"forEach",value:function(e){var t=this._map,r=t.length;if(r<=65536)for(var a=0;a<r;a++)void 0!==t[a]&&e(a,t[a]);else for(var i in t)e(i,t[i])}},{key:"charCodeOf",value:function(e){var t=this._map;if(t.length<=65536)return t.indexOf(e);for(var r in t)if(t[r]===e)return 0|r;return-1}},{key:"getMap",value:function(){return this._map}},{key:"readCharCode",value:function(e,t,r){for(var a=0,i=this.codespaceRanges,n=0,o=i.length;n<o;n++){a=(a<<8|e.charCodeAt(t+n))>>>0;for(var s=i[n],c=0,l=s.length;c<l;){var u=s[c++],h=s[c++];if(a>=u&&a<=h){r.charcode=a;r.length=n+1;return}}}r.charcode=0;r.length=1}},{key:"length",get:function(){return this._map.length}},{key:"isIdentityCMap",get:function(){if("Identity-H"!==this.name&&"Identity-V"!==this.name)return!1;if(65536!==this._map.length)return!1;for(var e=0;e<65536;e++)if(this._map[e]!==e)return!1;return!0}}]);return e}(),h=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,u);function t(e,r){c(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));a.vertical=e;a.addCodespaceRange(r,0,65535);return a}a(t,[{key:"mapCidRange",value:function(e,t,r){(0,i.unreachable)("should not call mapCidRange")}},{key:"mapBfRange",value:function(e,t,r){(0,i.unreachable)("should not call mapBfRange")}},{key:"mapBfRangeToArray",value:function(e,t,r){(0,i.unreachable)("should not call mapBfRangeToArray")}},{key:"mapOne",value:function(e,t){(0,i.unreachable)("should not call mapCidOne")}},{key:"lookup",value:function(e){return Number.isInteger(e)&&e<=65535?e:void 0}},{key:"contains",value:function(e){return Number.isInteger(e)&&e<=65535}},{key:"forEach",value:function(e){for(var t=0;t<=65535;t++)e(t,t)}},{key:"charCodeOf",value:function(e){return Number.isInteger(e)&&e<=65535?e:-1}},{key:"getMap",value:function(){for(var e=new Array(65536),t=0;t<=65535;t++)e[t]=t;return e}},{key:"length",get:function(){return 65536}},{key:"isIdentityCMap",get:function(){(0,i.unreachable)("should not access .isIdentityCMap")}}]);return t}(),f=function(){function e(e,t){for(var r=0,a=0;a<=t;a++)r=r<<8|e[a];return r>>>0}function t(e,t){return 1===t?String.fromCharCode(e[0],e[1]):3===t?String.fromCharCode(e[0],e[1],e[2],e[3]):String.fromCharCode.apply(null,e.subarray(0,t+1))}function r(e,t,r){for(var a=0,i=r;i>=0;i--){a+=e[i]+t[i];e[i]=255&a;a>>=8}}function a(e,t){for(var r=1,a=t;a>=0&&r>0;a--){r+=e[a];e[a]=255&r;r>>=8}}var n=16,o=19;function s(e){this.buffer=e;this.pos=0;this.end=e.length;this.tmpBuf=new Uint8Array(o)}s.prototype={readByte:function(){return this.pos>=this.end?-1:this.buffer[this.pos++]},readNumber:function(){var e,t=0;do{var r=this.readByte();if(r<0)throw new i.FormatError("unexpected EOF in bcmap");e=!(128&r);t=t<<7|127&r}while(!e);return t},readSigned:function(){var e=this.readNumber();return 1&e?~(e>>>1):e>>>1},readHex:function(e,t){e.set(this.buffer.subarray(this.pos,this.pos+t+1));this.pos+=t+1},readHexNumber:function(e,t){var r,a=this.tmpBuf,n=0;do{var o=this.readByte();if(o<0)throw new i.FormatError("unexpected EOF in bcmap");r=!(128&o);a[n++]=127&o}while(!r);for(var s=t,c=0,l=0;s>=0;){for(;l<8&&a.length>0;){c=a[--n]<<l|c;l+=7}e[s]=255&c;s--;c>>=8;l-=8}},readHexSigned:function(e,t){this.readHexNumber(e,t);for(var r=1&e[t]?255:0,a=0,i=0;i<=t;i++){a=(1&a)<<8|e[i];e[i]=a>>1^r}},readString:function(){for(var e=this.readNumber(),t="",r=0;r<e;r++)t+=String.fromCharCode(this.readNumber());return t}};function c(){}c.prototype={process:function(i,o,c){return new Promise(function(l,u){var h=new s(i),f=h.readByte();o.vertical=!!(1&f);for(var d,g,m=null,p=new Uint8Array(n),v=new Uint8Array(n),b=new Uint8Array(n),y=new Uint8Array(n),w=new Uint8Array(n);(g=h.readByte())>=0;){var k=g>>5;if(7!==k){var S=!!(16&g),C=15&g;if(C+1>n)throw new Error("processBinaryCMap: Invalid dataSize.");var x,_=h.readNumber();switch(k){case 0:h.readHex(p,C);h.readHexNumber(v,C);r(v,p,C);o.addCodespaceRange(C+1,e(p,C),e(v,C));for(x=1;x<_;x++){a(v,C);h.readHexNumber(p,C);r(p,v,C);h.readHexNumber(v,C);r(v,p,C);o.addCodespaceRange(C+1,e(p,C),e(v,C))}break;case 1:h.readHex(p,C);h.readHexNumber(v,C);r(v,p,C);h.readNumber();for(x=1;x<_;x++){a(v,C);h.readHexNumber(p,C);r(p,v,C);h.readHexNumber(v,C);r(v,p,C);h.readNumber()}break;case 2:h.readHex(b,C);d=h.readNumber();o.mapOne(e(b,C),d);for(x=1;x<_;x++){a(b,C);if(!S){h.readHexNumber(w,C);r(b,w,C)}d=h.readSigned()+(d+1);o.mapOne(e(b,C),d)}break;case 3:h.readHex(p,C);h.readHexNumber(v,C);r(v,p,C);d=h.readNumber();o.mapCidRange(e(p,C),e(v,C),d);for(x=1;x<_;x++){a(v,C);if(S)p.set(v);else{h.readHexNumber(p,C);r(p,v,C)}h.readHexNumber(v,C);r(v,p,C);d=h.readNumber();o.mapCidRange(e(p,C),e(v,C),d)}break;case 4:h.readHex(b,1);h.readHex(y,C);o.mapOne(e(b,1),t(y,C));for(x=1;x<_;x++){a(b,1);if(!S){h.readHexNumber(w,1);r(b,w,1)}a(y,C);h.readHexSigned(w,C);r(y,w,C);o.mapOne(e(b,1),t(y,C))}break;case 5:h.readHex(p,1);h.readHexNumber(v,1);r(v,p,1);h.readHex(y,C);o.mapBfRange(e(p,1),e(v,1),t(y,C));for(x=1;x<_;x++){a(v,1);if(S)p.set(v);else{h.readHexNumber(p,1);r(p,v,1)}h.readHexNumber(v,1);r(v,p,1);h.readHex(y,C);o.mapBfRange(e(p,1),e(v,1),t(y,C))}break;default:u(new Error("processBinaryCMap: Unknown type: "+k));return}}else switch(31&g){case 0:h.readString();break;case 1:m=h.readString()}}l(m?c(m):o)})}};return c}(),d=function(){function e(e){for(var t=0,r=0;r<e.length;r++)t=t<<8|e.charCodeAt(r);return t>>>0}function t(e){if(!(0,i.isString)(e))throw new i.FormatError("Malformed CMap: expected string.")}function r(e){if(!Number.isInteger(e))throw new i.FormatError("Malformed CMap: expected int.")}function a(r,a){for(;;){var i=a.getObj();if((0,n.isEOF)(i))break;if((0,n.isCmd)(i,"endbfchar"))return;t(i);var o=e(i);t(i=a.getObj());var s=i;r.mapOne(o,s)}}function c(r,a){for(;;){var o=a.getObj();if((0,n.isEOF)(o))break;if((0,n.isCmd)(o,"endbfrange"))return;t(o);var s=e(o);t(o=a.getObj());var c=e(o);o=a.getObj();if(Number.isInteger(o)||(0,i.isString)(o)){var l=Number.isInteger(o)?String.fromCharCode(o):o;r.mapBfRange(s,c,l)}else{if(!(0,n.isCmd)(o,"["))break;o=a.getObj();for(var u=[];!(0,n.isCmd)(o,"]")&&!(0,n.isEOF)(o);){u.push(o);o=a.getObj()}r.mapBfRangeToArray(s,c,u)}}throw new i.FormatError("Invalid bf range.")}function d(a,i){for(;;){var o=i.getObj();if((0,n.isEOF)(o))break;if((0,n.isCmd)(o,"endcidchar"))return;t(o);var s=e(o);r(o=i.getObj());var c=o;a.mapOne(s,c)}}function g(a,i){for(;;){var o=i.getObj();if((0,n.isEOF)(o))break;if((0,n.isCmd)(o,"endcidrange"))return;t(o);var s=e(o);t(o=i.getObj());var c=e(o);r(o=i.getObj());var l=o;a.mapCidRange(s,c,l)}}function m(t,r){for(;;){var a=r.getObj();if((0,n.isEOF)(a))break;if((0,n.isCmd)(a,"endcodespacerange"))return;if(!(0,i.isString)(a))break;var o=e(a);a=r.getObj();if(!(0,i.isString)(a))break;var s=e(a);t.addCodespaceRange(a.length,o,s)}throw new i.FormatError("Invalid codespace range.")}function p(e,t){var r=t.getObj();Number.isInteger(r)&&(e.vertical=!!r)}function v(e,t){var r=t.getObj();(0,n.isName)(r)&&(0,i.isString)(r.name)&&(e.name=r.name)}function b(e,t,r,o){var s,l;e:for(;;)try{var u=t.getObj();if((0,n.isEOF)(u))break;if((0,n.isName)(u)){"WMode"===u.name?p(e,t):"CMapName"===u.name&&v(e,t);s=u}else if((0,n.isCmd)(u))switch(u.cmd){case"endcmap":break e;case"usecmap":(0,n.isName)(s)&&(l=s.name);break;case"begincodespacerange":m(e,t);break;case"beginbfchar":a(e,t);break;case"begincidchar":d(e,t);break;case"beginbfrange":c(e,t);break;case"begincidrange":g(e,t)}}catch(e){if(e instanceof i.MissingDataException)throw e;(0,i.warn)("Invalid cMap data: "+e);continue}!o&&l&&(o=l);return o?y(e,r,o):Promise.resolve(e)}function y(e,t,r){return w(r,t).then(function(t){e.useCMap=t;if(0===e.numCodespaceRanges){for(var r=e.useCMap.codespaceRanges,a=0;a<r.length;a++)e.codespaceRanges[a]=r[a].slice();e.numCodespaceRanges=e.useCMap.numCodespaceRanges}e.useCMap.forEach(function(t,r){e.contains(t)||e.mapOne(t,e.useCMap.lookup(t))});return e})}function w(e,t){return"Identity-H"===e?Promise.resolve(new h(!1,2)):"Identity-V"===e?Promise.resolve(new h(!0,2)):l.includes(e)?t?t(e).then(function(e){var r=e.cMapData,a=e.compressionType,n=new u(!0);if(a===i.CMapCompressionType.BINARY)return(new f).process(r,n,function(e){return y(n,t,e)});if(a===i.CMapCompressionType.NONE){var c=new o.Lexer(new s.Stream(r));return b(n,c,t,null)}return Promise.reject(new Error("TODO: Only BINARY/NONE CMap compression is currently supported."))}):Promise.reject(new Error("Built-in CMap parameters are not provided.")):Promise.reject(new Error("Unknown CMap name: "+e))}return{create:function(e){var t=e.encoding,r=e.fetchBuiltInCMap,a=e.useCMap;if((0,n.isName)(t))return w(t.name,r);if((0,n.isStream)(t)){return b(new u,new o.Lexer(t),r,a).then(function(e){return e.isIdentityCMap?w(e.name,r):e})}return Promise.reject(new Error("Encoding required."))}}}();t.CMap=u;t.IdentityCMap=h;t.CMapFactory=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.getFontType=t.IdentityToUnicodeMap=t.ToUnicodeMap=t.FontFlags=t.Font=t.ErrorFont=t.SEAC_ANALYSIS_ENABLED=void 0;var a=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],a=!0,i=!1,n=void 0;try{for(var o,s=e[Symbol.iterator]();!(a=(o=s.next()).done);a=!0){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=!0;n=e}finally{try{!a&&s.return&&s.return()}finally{if(i)throw n}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=r(2),n=r(157),o=r(160),s=r(159),c=r(161),l=r(162),u=r(163),h=r(155),f=r(140),d=r(164),g=[[57344,63743],[1048576,1114109]],m=1e3,p=!0,v={FixedPitch:1,Serif:2,Symbolic:4,Script:8,Nonsymbolic:32,Italic:64,AllCap:65536,SmallCap:131072,ForceBold:262144},b=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","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","grave","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","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function y(e){if(e.fontMatrix&&e.fontMatrix[0]!==i.FONT_IDENTITY_MATRIX[0]){var t=.001/e.fontMatrix[0],r=e.widths;for(var a in r)r[a]*=t;e.defaultWidth*=t}}function w(e,t){switch(e){case"Type1":return"Type1C"===t?i.FontType.TYPE1C:i.FontType.TYPE1;case"CIDFontType0":return"CIDFontType0C"===t?i.FontType.CIDFONTTYPE0C:i.FontType.CIDFONTTYPE0;case"OpenType":return i.FontType.OPENTYPE;case"TrueType":return i.FontType.TRUETYPE;case"CIDFontType2":return i.FontType.CIDFONTTYPE2;case"MMType1":return i.FontType.MMTYPE1;case"Type0":return i.FontType.TYPE0;default:return i.FontType.UNKNOWN}}function k(e,t){if(void 0!==t[e])return e;var r=(0,l.getUnicodeForGlyph)(e,t);if(-1!==r)for(var a in t)if(t[a]===r)return a;(0,i.info)("Unable to recover a standard glyph name for: "+e);return e}var S=function(){function e(e,t,r,a,i,n,o,s){this.fontChar=e;this.unicode=t;this.accent=r;this.width=a;this.vmetric=i;this.operatorListId=n;this.isSpace=o;this.isInFont=s}e.prototype.matchesForCache=function(e,t,r,a,i,n,o,s){return this.fontChar===e&&this.unicode===t&&this.accent===r&&this.width===a&&this.vmetric===i&&this.operatorListId===n&&this.isSpace===o&&this.isInFont===s};return e}(),C=function(){function e(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this._map=e}e.prototype={get length(){return this._map.length},forEach:function(e){for(var t in this._map)e(t,this._map[t].charCodeAt(0))},has:function(e){return void 0!==this._map[e]},get:function(e){return this._map[e]},charCodeOf:function(e){var t=this._map;if(t.length<=65536)return t.indexOf(e);for(var r in t)if(t[r]===e)return 0|r;return-1},amend:function(e){for(var t in e)this._map[t]=e[t]}};return e}(),x=function(){function e(e,t){this.firstChar=e;this.lastChar=t}e.prototype={get length(){return this.lastChar+1-this.firstChar},forEach:function(e){for(var t=this.firstChar,r=this.lastChar;t<=r;t++)e(t,t)},has:function(e){return this.firstChar<=e&&e<=this.lastChar},get:function(e){if(this.firstChar<=e&&e<=this.lastChar)return String.fromCharCode(e)},charCodeOf:function(e){return Number.isInteger(e)&&e>=this.firstChar&&e<=this.lastChar?e:-1},amend:function(e){(0,i.unreachable)("Should not call amend()")}};return e}(),_=function(){function e(e,t,r){e[t]=r>>8&255;e[t+1]=255&r}function t(e,t,r){e[t]=r>>24&255;e[t+1]=r>>16&255;e[t+2]=r>>8&255;e[t+3]=255&r}function r(e,t,r){var a,i;if(r instanceof Uint8Array)e.set(r,t);else if("string"==typeof r)for(a=0,i=r.length;a<i;a++)e[t++]=255&r.charCodeAt(a);else for(a=0,i=r.length;a<i;a++)e[t++]=255&r[a]}function a(e){this.sfnt=e;this.tables=Object.create(null)}a.getSearchParams=function(e,t){for(var r=1,a=0;(r^e)>r;){r<<=1;a++}var i=r*t;return{range:i,entry:a,rangeShift:t*e-i}};a.prototype={toArray:function(){var n=this.sfnt,o=this.tables,s=Object.keys(o);s.sort();var c,l,u,h,f,d=s.length,g=12+16*d,m=[g];for(c=0;c<d;c++){g+=((h=o[s[c]]).length+3&-4)>>>0;m.push(g)}var p=new Uint8Array(g);for(c=0;c<d;c++){h=o[s[c]];r(p,m[c],h)}"true"===n&&(n=(0,i.string32)(65536));p[0]=255&n.charCodeAt(0);p[1]=255&n.charCodeAt(1);p[2]=255&n.charCodeAt(2);p[3]=255&n.charCodeAt(3);e(p,4,d);var v=a.getSearchParams(d,16);e(p,6,v.range);e(p,8,v.entry);e(p,10,v.rangeShift);g=12;for(c=0;c<d;c++){f=s[c];p[g]=255&f.charCodeAt(0);p[g+1]=255&f.charCodeAt(1);p[g+2]=255&f.charCodeAt(2);p[g+3]=255&f.charCodeAt(3);var b=0;for(l=m[c],u=m[c+1];l<u;l+=4){b=b+(0,i.readUint32)(p,l)>>>0}t(p,g+4,b);t(p,g+8,m[c]);t(p,g+12,o[f].length);g+=16}return p},addTable:function(e,t){if(e in this.tables)throw new Error("Table "+e+" already exists");this.tables[e]=t}};return a}(),A=function(){function e(e,t,r){var n;this.name=e;this.loadedName=r.loadedName;this.isType3Font=r.isType3Font;this.sizes=[];this.missingFile=!1;this.glyphCache=Object.create(null);this.isSerifFont=!!(r.flags&v.Serif);this.isSymbolicFont=!!(r.flags&v.Symbolic);this.isMonospace=!!(r.flags&v.FixedPitch);var o=r.type,s=r.subtype;this.type=o;this.subtype=s;this.fallbackName=this.isMonospace?"monospace":this.isSerifFont?"serif":"sans-serif";this.differences=r.differences;this.widths=r.widths;this.defaultWidth=r.defaultWidth;this.composite=r.composite;this.wideChars=r.wideChars;this.cMap=r.cMap;this.ascent=r.ascent/m;this.descent=r.descent/m;this.fontMatrix=r.fontMatrix;this.bbox=r.bbox;this.defaultEncoding=r.defaultEncoding;this.toUnicode=r.toUnicode;this.fallbackToUnicode=r.fallbackToUnicode||new C;this.toFontChar=[];if("Type3"!==r.type){this.cidEncoding=r.cidEncoding;this.vertical=r.vertical;if(this.vertical){this.vmetrics=r.vmetrics;this.defaultVMetrics=r.defaultVMetrics}if(t&&!t.isEmpty){var c=function(e,t){var r=t.type,a=t.subtype,n=t.composite,o=void 0,s=void 0;if(function(e){var t=e.peekBytes(4);return 65536===(0,i.readUint32)(t,0)||"true"===(0,i.bytesToString)(t)}(e)||I(e))o=n?"CIDFontType2":"TrueType";else if(function(e){var t=e.peekBytes(4);return"OTTO"===(0,i.bytesToString)(t)}(e))o=n?"CIDFontType2":"OpenType";else if(function(e){var t=e.peekBytes(2);if(37===t[0]&&33===t[1])return!0;if(128===t[0]&&1===t[1])return!0;return!1}(e))o=n?"CIDFontType0":"MMType1"===r?"MMType1":"Type1";else if(function(e){var t=e.peekBytes(4);if(t[0]>=1&&t[3]>=1&&t[3]<=4)return!0;return!1}(e))if(n){o="CIDFontType0";s="CIDFontType0C"}else{o="MMType1"===r?"MMType1":"Type1";s="Type1C"}else{(0,i.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");o=r;s=a}return[o,s]}(t,r),l=a(c,2);o=l[0];s=l[1];o===this.type&&s===this.subtype||(0,i.info)("Inconsistent font file Type/SubType, expected: "+this.type+"/"+this.subtype+" but found: "+o+"/"+s+".");try{var u;switch(o){case"MMType1":(0,i.info)("MMType1 font ("+e+"), falling back to Type1.");case"Type1":case"CIDFontType0":this.mimetype="font/opentype";var h="Type1C"===s||"CIDFontType0C"===s?new T(t,r):new O(e,t,r);y(r);u=this.convert(e,h,r);break;case"OpenType":case"TrueType":case"CIDFontType2":this.mimetype="font/opentype";u=this.checkAndRepair(e,t,r);if(this.isOpenType){y(r);o="OpenType"}break;default:throw new i.FormatError("Font "+o+" is not supported")}}catch(e){(0,i.warn)(e);this.fallbackToSystemFont();return}this.data=u;this.fontType=w(o,s);this.fontMatrix=r.fontMatrix;this.widths=r.widths;this.defaultWidth=r.defaultWidth;this.toUnicode=r.toUnicode;this.encoding=r.baseEncoding;this.seacMap=r.seacMap}else{t&&(0,i.warn)('Font file is empty in "'+e+'" ('+this.loadedName+")");this.fallbackToSystemFont()}}else{for(n=0;n<256;n++)this.toFontChar[n]=this.differences[n]||r.defaultEncoding[n];this.fontType=i.FontType.TYPE3}}e.getFontID=(t=1,function(){return String(t++)});var t;function r(e,t){return(e<<8)+t}function d(e,t){var r=(e<<8)+t;return 32768&r?r-65536:r}function A(e){return String.fromCharCode(e>>8&255,255&e)}function P(e){e=e>32767?32767:e<-32768?-32768:e;return String.fromCharCode(e>>8&255,255&e)}function I(e){var t=e.peekBytes(4);return"ttcf"===(0,i.bytesToString)(t)}function E(e,t,r){for(var a,i=[],n=0,o=e.length;n<o;n++)-1!==(a=(0,l.getUnicodeForGlyph)(e[n],t))&&(i[n]=a);for(var s in r)-1!==(a=(0,l.getUnicodeForGlyph)(r[s],t))&&(i[+s]=a);return i}function F(e,t,r){var a=Object.create(null),n=[],o=0,s=g[o][0],c=g[o][1];for(var l in e){var u=e[l|=0];if(t(u)){if(s>c){if(++o>=g.length){(0,i.warn)("Ran out of space in font private use area.");break}s=g[o][0];c=g[o][1]}var h=s++;0===u&&(u=r);a[h]=u;n[l]=h}}return{toFontChar:n,charCodeToGlyphId:a,nextAvailableFontCharCode:s}}function R(e,t){var r,a,n,o,s=function(e,t){var r=[];for(var a in e)e[a]>=t||r.push({fontCharCode:0|a,glyphId:e[a]});0===r.length&&r.push({fontCharCode:0,glyphId:0});r.sort(function(e,t){return e.fontCharCode-t.fontCharCode});for(var i=[],n=r.length,o=0;o<n;){var s=r[o].fontCharCode,c=[r[o].glyphId];++o;for(var l=s;o<n&&l+1===r[o].fontCharCode;){c.push(r[o].glyphId);++o;if(65535==++l)break}i.push([s,l,c])}return i}(e,t),c=s[s.length-1][1]>65535?2:1,l="\0\0"+A(c)+"\0\0"+(0,i.string32)(4+8*c);for(r=s.length-1;r>=0&&!(s[r][0]<=65535);--r);var u=r+1;s[r][0]<65535&&65535===s[r][1]&&(s[r][1]=65534);var h,f,d,g,m=s[r][1]<65535?1:0,p=u+m,v=_.getSearchParams(p,2),b="",y="",w="",k="",S="",C=0;for(r=0,a=u;r<a;r++){f=(h=s[r])[0];d=h[1];b+=A(f);y+=A(d);var x=!0;for(n=1,o=(g=h[2]).length;n<o;++n)if(g[n]!==g[n-1]+1){x=!1;break}if(x){w+=A(g[0]-f&65535);k+=A(0)}else{var P=2*(p-r)+2*C;C+=d-f+1;w+=A(0);k+=A(P);for(n=0,o=g.length;n<o;++n)S+=A(g[n])}}if(m>0){y+="ÿÿ";b+="ÿÿ";w+="\0";k+="\0\0"}var I="\0\0"+A(2*p)+A(v.range)+A(v.entry)+A(v.rangeShift)+y+"\0\0"+b+w+k+S,O="",T="";if(c>1){l+="\0\0\n"+(0,i.string32)(4+8*c+4+I.length);O="";for(r=0,a=s.length;r<a;r++){f=(h=s[r])[0];var E=(g=h[2])[0];for(n=1,o=g.length;n<o;++n)if(g[n]!==g[n-1]+1){d=h[0]+n-1;O+=(0,i.string32)(f)+(0,i.string32)(d)+(0,i.string32)(E);f=d+1;E=g[n]}O+=(0,i.string32)(f)+(0,i.string32)(h[1])+(0,i.string32)(E)}T="\0\f\0\0"+(0,i.string32)(O.length+16)+"\0\0\0\0"+(0,i.string32)(O.length/12)}return l+"\0"+A(I.length+4)+I+T+O}function B(e,t,r){r=r||{unitsPerEm:0,yMax:0,yMin:0,ascent:0,descent:0};var a=0,n=0,o=0,s=0,c=null,u=0;if(t){for(var h in t){(c>(h|=0)||!c)&&(c=h);u<h&&(u=h);var f=(0,l.getUnicodeRangeFor)(h);if(f<32)a|=1<<f;else if(f<64)n|=1<<f-32;else if(f<96)o|=1<<f-64;else{if(!(f<123))throw new i.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");s|=1<<f-96}}u>65535&&(u=65535)}else{c=0;u=255}var d=e.bbox||[0,0,0,0],g=r.unitsPerEm||1/(e.fontMatrix||i.FONT_IDENTITY_MATRIX)[0],p=e.ascentScaled?1:g/m,v=r.ascent||Math.round(p*(e.ascent||d[3])),b=r.descent||Math.round(p*(e.descent||d[1]));b>0&&e.descent>0&&d[1]<0&&(b=-b);var y=r.yMax||v,w=-r.yMin||-b;return"\0$ô\0\0\0Š»\0\0\0ŒŠ»\0\0ß\x001\0\0\0\0"+String.fromCharCode(e.fixedPitch?9:0)+"\0\0\0\0\0\0"+(0,i.string32)(a)+(0,i.string32)(n)+(0,i.string32)(o)+(0,i.string32)(s)+"*21*"+A(e.italicAngle?1:0)+A(c||e.firstChar)+A(u||e.lastChar)+A(v)+A(b)+"\0d"+A(y)+A(w)+"\0\0\0\0\0\0\0\0"+A(e.xHeight)+A(e.capHeight)+A(0)+A(c||e.firstChar)+"\0"}function D(e){var t=Math.floor(e.italicAngle*Math.pow(2,16));return"\0\0\0"+(0,i.string32)(t)+"\0\0\0\0"+(0,i.string32)(e.fixedPitch)+"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}function M(e,t){t||(t=[[],[]]);var r,a,i,n,o,s=[t[0][0]||"Original licence",t[0][1]||e,t[0][2]||"Unknown",t[0][3]||"uniqueID",t[0][4]||e,t[0][5]||"Version 0.11",t[0][6]||"",t[0][7]||"Unknown",t[0][8]||"Unknown",t[0][9]||"Unknown"],c=[];for(r=0,a=s.length;r<a;r++){var l=[];for(i=0,n=(o=t[1][r]||s[r]).length;i<n;i++)l.push(A(o.charCodeAt(i)));c.push(l.join(""))}var u=[s,c],h=["\0","\0"],f=["\0\0","\0"],d=["\0\0","\t"],g=s.length*h.length,m="\0\0"+A(g)+A(12*g+6),p=0;for(r=0,a=h.length;r<a;r++){var v=u[r];for(i=0,n=v.length;i<n;i++){o=v[i];m+=h[r]+f[r]+d[r]+A(i)+A(o.length)+A(p);p+=o.length}}return m+=s.join("")+c.join("")}e.prototype={name:null,font:null,mimetype:null,encoding:null,get renderer(){var e=u.FontRendererFactory.create(this,p);return(0,i.shadow)(this,"renderer",e)},exportData:function(){var e={};for(var t in this)this.hasOwnProperty(t)&&(e[t]=this[t]);return e},fallbackToSystemFont:function(){var e,t,r=this;this.missingFile=!0;var a=this.name,n=this.type,u=this.subtype,h=a.replace(/[,_]/g,"-"),f=(0,c.getStdFontMap)(),d=(0,c.getNonStdFontMap)(),g=!!f[h]||!(!d[h]||!f[d[h]]);h=f[h]||d[h]||h;this.bold=-1!==h.search(/bold/gi);this.italic=-1!==h.search(/oblique/gi)||-1!==h.search(/italic/gi);this.black=-1!==a.search(/Black/g);this.remeasure=Object.keys(this.widths).length>0;if(g&&"CIDFontType2"===n&&0===this.cidEncoding.indexOf("Identity-")){var m=(0,c.getGlyphMapForStandardFonts)(),p=[];for(e in m)p[+e]=m[e];if(/Arial-?Black/i.test(a)){var v=(0,c.getSupplementalGlyphMapForArialBlack)();for(e in v)p[+e]=v[e]}else if(/Calibri/i.test(a)){var b=(0,c.getSupplementalGlyphMapForCalibri)();for(e in b)p[+e]=b[e]}this.toUnicode instanceof x||this.toUnicode.forEach(function(e,t){p[+e]=t});this.toFontChar=p;this.toUnicode=new C(p)}else if(/Symbol/i.test(h))this.toFontChar=E(s.SymbolSetEncoding,(0,o.getGlyphsUnicode)(),this.differences);else if(/Dingbats/i.test(h)){/Wingdings/i.test(a)&&(0,i.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");this.toFontChar=E(s.ZapfDingbatsEncoding,(0,o.getDingbatsGlyphsUnicode)(),this.differences)}else if(g)this.toFontChar=E(this.defaultEncoding,(0,o.getGlyphsUnicode)(),this.differences);else{var y=(0,o.getGlyphsUnicode)();this.toUnicode.forEach(function(e,a){if(!r.composite){var i=r.differences[e]||r.defaultEncoding[e];-1!==(t=(0,l.getUnicodeForGlyph)(i,y))&&(a=t)}r.toFontChar[e]=a})}this.loadedName=h.split("-")[0];this.fontType=w(n,u)},checkAndRepair:function(e,t,a){var c=["OS/2","cmap","head","hhea","hmtx","maxp","name","post","loca","glyf","fpgm","prep","cvt ","CFF "];function l(e,r){var a=Object.create(null);a["OS/2"]=null;a.cmap=null;a.head=null;a.hhea=null;a.hmtx=null;a.maxp=null;a.name=null;a.post=null;for(var i=0;i<r;i++){var n=u(t);c.includes(n.tag)&&(0!==n.length&&(a[n.tag]=n))}return a}function u(e){var t=(0,i.bytesToString)(e.getBytes(4)),r=e.getInt32()>>>0,a=e.getInt32()>>>0,n=e.getInt32()>>>0,o=e.pos;e.pos=e.start?e.start:0;e.skip(a);var s=e.getBytes(n);e.pos=o;if("head"===t){s[8]=s[9]=s[10]=s[11]=0;s[17]|=32}return{tag:t,checksum:r,length:n,offset:a,data:s}}function g(e){return{version:(0,i.bytesToString)(e.getBytes(4)),numTables:e.getUint16(),searchRange:e.getUint16(),entrySelector:e.getUint16(),rangeShift:e.getUint16()}}function m(e,t,r,a,i,n){var o={length:0,sizeOfInstructions:0};if(r-t<=12)return o;var s=e.subarray(t,r),c=d(s[0],s[1]);if(c<0){!function(e,t,r){e[t+1]=r;e[t]=r>>>8}(s,0,c=-1);a.set(s,i);o.length=s.length;return o}var l,u=10,h=0;for(l=0;l<c;l++){h=(s[u]<<8|s[u+1])+1;u+=2}var f=u,g=s[u]<<8|s[u+1];o.sizeOfInstructions=g;var m=u+=2+g,p=0;for(l=0;l<h;l++){var v=s[u++];192&v&&(s[u-1]=63&v);var b=(2&v?1:16&v?0:2)+(4&v?1:32&v?0:2);p+=b;if(8&v){var y=s[u++];l+=y;p+=y*b}}if(0===p)return o;var w=u+p;if(w>s.length)return o;if(!n&&g>0){a.set(s.subarray(0,f),i);a.set([0,0],i+f);a.set(s.subarray(m,w),i+f+2);w-=g;s.length-w>3&&(w=w+3&-4);o.length=w;return o}if(s.length-w>3){w=w+3&-4;a.set(s.subarray(0,w),i);o.length=w;return o}a.set(s,i);o.length=s.length;return o}function v(e){var r=(t.start?t.start:0)+e.offset;t.pos=r;var a=[[],[]],n=e.length,o=r+n;if(0!==t.getUint16()||n<6)return a;var s,c,l=t.getUint16(),u=t.getUint16(),h=[];for(s=0;s<l&&t.pos+12<=o;s++){var f={platform:t.getUint16(),encoding:t.getUint16(),language:t.getUint16(),name:t.getUint16(),length:t.getUint16(),offset:t.getUint16()};(1===f.platform&&0===f.encoding&&0===f.language||3===f.platform&&1===f.encoding&&1033===f.language)&&h.push(f)}for(s=0,c=h.length;s<c;s++){var d=h[s];if(!(d.length<=0)){var g=r+u+d.offset;if(!(g+d.length>o)){t.pos=g;var m=d.name;if(d.encoding){for(var p="",v=0,b=d.length;v<b;v+=2)p+=String.fromCharCode(t.getUint16());a[1][m]=p}else a[0][m]=(0,i.bytesToString)(t.getBytes(d.length))}}}return a}var w=[0,0,0,0,0,0,0,0,-2,-2,-2,-2,0,0,-2,-5,-1,-1,-1,-1,-1,-1,-1,-1,0,0,-1,0,-1,-1,-1,-1,1,-1,-999,0,1,0,-1,-2,0,-1,-2,-1,-1,0,-1,-1,0,0,-999,-999,-1,-1,-1,-1,-2,-999,-2,-2,-999,0,-2,-2,0,0,-2,0,-2,0,0,0,-2,-1,-1,1,1,0,0,-1,-1,-1,-1,-1,-1,-1,0,0,-1,0,-1,-1,0,-999,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,-2,-999,-999,-999,-999,-999,-1,-1,-2,-2,0,0,0,0,-1,-1,-999,-2,-2,0,0,-1,-2,-2,0,0,0,-1,-1,-1,-2];function S(e,t){for(var r,a,n,o,s,c=e.data,l=0,u=0,h=0,f=[],d=[],g=[],m=t.tooComplexToFollowFunctions,p=!1,v=0,b=0,y=c.length;l<y;){var k=c[l++];if(64===k){a=c[l++];if(p||b)l+=a;else for(r=0;r<a;r++)f.push(c[l++])}else if(65===k){a=c[l++];if(p||b)l+=2*a;else for(r=0;r<a;r++){n=c[l++];f.push(n<<8|c[l++])}}else if(176==(248&k)){a=k-176+1;if(p||b)l+=a;else for(r=0;r<a;r++)f.push(c[l++])}else if(184==(248&k)){a=k-184+1;if(p||b)l+=2*a;else for(r=0;r<a;r++){n=c[l++];f.push(n<<8|c[l++])}}else if(43!==k||m)if(44!==k||m){if(45===k)if(p){p=!1;u=l}else{if(!(s=d.pop())){(0,i.warn)("TT: ENDF bad stack");t.hintsValid=!1;return}o=g.pop();c=s.data;l=s.i;t.functionsStackDeltas[o]=f.length-s.stackTop}else if(137===k){if(p||b){(0,i.warn)("TT: nested IDEFs not allowed");m=!0}p=!0;h=l}else if(88===k)++v;else if(27===k)b=v;else if(89===k){b===v&&(b=0);--v}else if(28===k&&!p&&!b){var S=f[f.length-1];S>0&&(l+=S-1)}}else{if(p||b){(0,i.warn)("TT: nested FDEFs not allowed");m=!0}p=!0;h=l;o=f.pop();t.functionsDefined[o]={data:c,i:l}}else if(!p&&!b){o=f[f.length-1];if(isNaN(o))(0,i.info)("TT: CALL empty stack (or invalid entry).");else{t.functionsUsed[o]=!0;if(o in t.functionsStackDeltas){var C=f.length+t.functionsStackDeltas[o];if(C<0){(0,i.warn)("TT: CALL invalid functions stack delta.");t.hintsValid=!1;return}f.length=C}else if(o in t.functionsDefined&&!g.includes(o)){d.push({data:c,i:l,stackTop:f.length-1});g.push(o);if(!(s=t.functionsDefined[o])){(0,i.warn)("TT: CALL non-existent function");t.hintsValid=!1;return}c=s.data;l=s.i}}}if(!p&&!b){var x=k<=142?w[k]:k>=192&&k<=223?-1:k>=224?-2:0;if(k>=113&&k<=117){a=f.pop();isNaN(a)||(x=2*-a)}for(;x<0&&f.length>0;){f.pop();x++}for(;x>0;){f.push(NaN);x--}}}t.tooComplexToFollowFunctions=m;var _=[c];l>c.length&&_.push(new Uint8Array(l-c.length));if(h>u){(0,i.warn)("TT: complementing a missing function tail");_.push(new Uint8Array([34,45]))}!function(e,t){if(t.length>1){var r,a,i=0;for(r=0,a=t.length;r<a;r++)i+=t[r].length;i=i+3&-4;var n=new Uint8Array(i),o=0;for(r=0,a=t.length;r<a;r++){n.set(t[r],o);o+=t[r].length}e.data=n;e.length=i}}(e,_)}var C=void 0,x=void 0;if(I(t=new f.Stream(new Uint8Array(t.getBytes())))){var A=function(e,t){for(var r=function(e){var t=(0,i.bytesToString)(e.getBytes(4));(0,i.assert)("ttcf"===t,"Must be a TrueType Collection font.");for(var r=e.getUint16(),a=e.getUint16(),n=e.getInt32()>>>0,o=[],s=0;s<n;s++)o.push(e.getInt32()>>>0);var c={ttcTag:t,majorVersion:r,minorVersion:a,numFonts:n,offsetTable:o};switch(r){case 1:return c;case 2:c.dsigTag=e.getInt32()>>>0;c.dsigLength=e.getInt32()>>>0;c.dsigOffset=e.getInt32()>>>0;return c}throw new i.FormatError("Invalid TrueType Collection majorVersion: "+r+".")}(e),a=r.numFonts,n=r.offsetTable,o=0;o<a;o++){e.pos=(e.start||0)+n[o];var s=g(e),c=l(0,s.numTables);if(!c.name)throw new i.FormatError('TrueType Collection font must contain a "name" table.');for(var u=v(c.name),h=0,f=u.length;h<f;h++)for(var d=0,m=u[h].length;d<m;d++){var p=u[h][d];if(p&&p.replace(/\s/g,"")===t)return{header:s,tables:c}}}throw new i.FormatError('TrueType Collection does not contain "'+t+'" font.')}(t,this.name);C=A.header;x=A.tables}else x=l(0,(C=g(t)).numTables);var P=void 0,O=void 0,E=!x["CFF "];if(E){if(!x.loca)throw new i.FormatError('Required "loca" table is not found');if(!x.glyf){(0,i.warn)('Required "glyf" table is not found -- trying to recover.');x.glyf={tag:"glyf",data:new Uint8Array(0)}}this.isOpenType=!1}else{var L=a.composite&&((a.cidToGidMap||[]).length>0||!(a.cMap instanceof h.IdentityCMap));if("OTTO"===C.version&&!L||!x.head||!x.hhea||!x.maxp||!x.post){O=new f.Stream(x["CFF "].data);P=new T(O,a);y(a);return this.convert(e,P,a)}delete x.glyf;delete x.loca;delete x.fpgm;delete x.prep;delete x["cvt "];this.isOpenType=!0}if(!x.maxp)throw new i.FormatError('Required "maxp" table is not found');t.pos=(t.start||0)+x.maxp.offset;var N=t.getInt32(),U=t.getUint16(),q=U+1,j=!0;if(q>65535){j=!1;q=U;(0,i.warn)("Not enough space in glyfs to duplicate first glyph.")}var z=0,H=0;if(N>=65536&&x.maxp.length>=22){t.pos+=8;if(t.getUint16()>2){x.maxp.data[14]=0;x.maxp.data[15]=2}t.pos+=4;z=t.getUint16();t.pos+=4;H=t.getUint16()}x.maxp.data[4]=q>>8;x.maxp.data[5]=255&q;var G=function(e,t,r,a){var n={functionsDefined:[],functionsUsed:[],functionsStackDeltas:[],tooComplexToFollowFunctions:!1,hintsValid:!0};e&&S(e,n);t&&S(t,n);e&&function(e,t){if(!e.tooComplexToFollowFunctions)if(e.functionsDefined.length>t){(0,i.warn)("TT: more functions defined than expected");e.hintsValid=!1}else for(var r=0,a=e.functionsUsed.length;r<a;r++){if(r>t){(0,i.warn)("TT: invalid function id: "+r);e.hintsValid=!1;return}if(e.functionsUsed[r]&&!e.functionsDefined[r]){(0,i.warn)("TT: undefined function: "+r);e.hintsValid=!1;return}}}(n,a);if(r&&1&r.length){var o=new Uint8Array(r.length+1);o.set(r.data);r.data=o}return n.hintsValid}(x.fpgm,x.prep,x["cvt "],z);if(!G){delete x.fpgm;delete x.prep;delete x["cvt "]}!function(e,t,r,a){if(t){e.pos=(e.start?e.start:0)+t.offset;e.pos+=t.length-2;var n=e.getUint16();if(n>a){(0,i.info)("The numOfMetrics ("+n+") should not be greater than the numGlyphs ("+a+")");n=a;t.data[34]=(65280&n)>>8;t.data[35]=255&n}var o=a-n-(r.length-4*n>>1);if(o>0){var s=new Uint8Array(r.length+2*o);s.set(r.data);r.data=s}}else r&&(r.data=null)}(t,x.hhea,x.hmtx,q);if(!x.head)throw new i.FormatError('Required "head" table is not found');!function(e,t,a){var n,o,s,c,l=e.data,u=(n=l[0],o=l[1],s=l[2],c=l[3],(n<<24)+(o<<16)+(s<<8)+c);if(u>>16!=1){(0,i.info)("Attempting to fix invalid version in head table: "+u);l[0]=0;l[1]=1;l[2]=0;l[3]=0}var h=r(l[50],l[51]);if(h<0||h>1){(0,i.info)("Attempting to fix invalid indexToLocFormat in head table: "+h);var f=t+1;if(a===f<<1){l[50]=0;l[51]=0}else{if(a!==f<<2)throw new i.FormatError("Could not fix indexToLocFormat: "+h);l[50]=0;l[51]=1}}}(x.head,U,E?x.loca.length:0);var W=Object.create(null);if(E){var X=r(x.head.data[50],x.head.data[51]),V=function(e,t,r,a,i,n,o){var s,c,l;if(a){s=4;c=function(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]};l=function(e,t,r){e[t]=r>>>24&255;e[t+1]=r>>16&255;e[t+2]=r>>8&255;e[t+3]=255&r}}else{s=2;c=function(e,t){return e[t]<<9|e[t+1]<<1};l=function(e,t,r){e[t]=r>>9&255;e[t+1]=r>>1&255}}var u=n?r+1:r,h=e.data,f=s*(1+u);(h=new Uint8Array(f)).set(e.data.subarray(0,f));e.data=h;var d,g,p=t.data,v=p.length,b=new Uint8Array(v),y=c(h,0),w=0,k=Object.create(null);l(h,0,w);for(d=0,g=s;d<r;d++,g+=s){var S=c(h,g);0===S&&(S=y);S>v&&(v+3&-4)===S&&(S=v);S>v&&(y=S);var C=m(p,y,S,b,w,i),x=C.length;0===x&&(k[d]=!0);C.sizeOfInstructions>o&&(o=C.sizeOfInstructions);l(h,g,w+=x);y=S}if(0===w){var _=new Uint8Array([0,1,0,0,0,0,0,0,0,0,0,0,0,0,49,0]);for(d=0,g=s;d<u;d++,g+=s)l(h,g,_.length);t.data=_}else if(n){var A=c(h,s);if(b.length>A+w)t.data=b.subarray(0,A+w);else{t.data=new Uint8Array(A+w);t.data.set(b.subarray(0,w))}t.data.set(b.subarray(0,A),w);l(e.data,h.length-s,w+A)}else t.data=b.subarray(0,w);return{missingGlyphs:k,maxSizeOfInstructions:o}}(x.loca,x.glyf,U,X,G,j,H);W=V.missingGlyphs;if(N>=65536&&x.maxp.length>=22){x.maxp.data[26]=V.maxSizeOfInstructions>>8;x.maxp.data[27]=255&V.maxSizeOfInstructions}}if(!x.hhea)throw new i.FormatError('Required "hhea" table is not found');if(0===x.hhea.data[10]&&0===x.hhea.data[11]){x.hhea.data[10]=255;x.hhea.data[11]=255}var K={unitsPerEm:r(x.head.data[18],x.head.data[19]),yMax:r(x.head.data[42],x.head.data[43]),yMin:d(x.head.data[38],x.head.data[39]),ascent:r(x.hhea.data[4],x.hhea.data[5]),descent:d(x.hhea.data[6],x.hhea.data[7])};this.ascent=K.ascent/K.unitsPerEm;this.descent=K.descent/K.unitsPerEm;x.post&&function(e,r,a){var n=(t.start?t.start:0)+e.offset;t.pos=n;var o,s=n+e.length,c=t.getInt32();t.getBytes(28);var l,u=!0;switch(c){case 65536:o=b;break;case 131072:var h=t.getUint16();if(h!==a){u=!1;break}var f=[];for(l=0;l<h;++l){var d=t.getUint16();if(d>=32768){u=!1;break}f.push(d)}if(!u)break;for(var g=[],m=[];t.pos<s;){var p=t.getByte();m.length=p;for(l=0;l<p;++l)m[l]=String.fromCharCode(t.getByte());g.push(m.join(""))}o=[];for(l=0;l<h;++l){var v=f[l];v<258?o.push(b[v]):o.push(g[v-258])}break;case 196608:break;default:(0,i.warn)("Unknown/unsupported post table version "+c);u=!1;r.defaultEncoding&&(o=r.defaultEncoding)}r.glyphNames=o}(x.post,a,U);x.post={tag:"post",data:D(a)};var Y,J=[];function Z(e){return!W[e]}if(a.composite){var Q=a.cidToGidMap||[],$=0===Q.length;a.cMap.forEach(function(e,t){if(t>65535)throw new i.FormatError("Max size of CID is 65,535");var r=-1;$?r=t:void 0!==Q[t]&&(r=Q[t]);r>=0&&r<U&&Z(r)&&(J[e]=r)})}else{var ee=function(e,t,r,a){if(!e){(0,i.warn)("No cmap table available.");return{platformId:-1,encodingId:-1,mappings:[],hasShortCmap:!1}}var n,o=(t.start?t.start:0)+e.offset;t.pos=o;t.getUint16();for(var s,c=t.getUint16(),l=!1,u=0;u<c;u++){var h=t.getUint16(),f=t.getUint16(),d=t.getInt32()>>>0,g=!1;if(!s||s.platformId!==h||s.encodingId!==f){if(0===h&&0===f)g=!0;else if(1===h&&0===f)g=!0;else if(3!==h||1!==f||!a&&s){if(r&&3===h&&0===f){g=!0;l=!0}}else{g=!0;r||(l=!0)}g&&(s={platformId:h,encodingId:f,offset:d});if(l)break}}s&&(t.pos=o+s.offset);if(!s||-1===t.peekByte()){(0,i.warn)("Could not find a preferred cmap table.");return{platformId:-1,encodingId:-1,mappings:[],hasShortCmap:!1}}var m=t.getUint16();t.getUint16();t.getUint16();var p,v,b=!1,y=[];if(0===m){for(p=0;p<256;p++){var w=t.getByte();w&&y.push({charCode:p,glyphId:w})}b=!0}else if(4===m){var k=t.getUint16()>>1;t.getBytes(6);var S,C=[];for(S=0;S<k;S++)C.push({end:t.getUint16()});t.getUint16();for(S=0;S<k;S++)C[S].start=t.getUint16();for(S=0;S<k;S++)C[S].delta=t.getUint16();var x=0;for(S=0;S<k;S++){n=C[S];var _=t.getUint16();if(_){var A=(_>>1)-(k-S);n.offsetIndex=A;x=Math.max(x,A+n.end-n.start+1)}else n.offsetIndex=-1}var P=[];for(p=0;p<x;p++)P.push(t.getUint16());for(S=0;S<k;S++){o=(n=C[S]).start;var I=n.end,O=n.delta;A=n.offsetIndex;for(p=o;p<=I;p++)if(65535!==p){v=(v=A<0?p:P[A+p-o])+O&65535;y.push({charCode:p,glyphId:v})}}}else{if(6!==m){(0,i.warn)("cmap table has unsupported format: "+m);return{platformId:-1,encodingId:-1,mappings:[],hasShortCmap:!1}}var T=t.getUint16(),E=t.getUint16();for(p=0;p<E;p++){v=t.getUint16();var F=T+p;y.push({charCode:F,glyphId:v})}}y.sort(function(e,t){return e.charCode-t.charCode});for(u=1;u<y.length;u++)if(y[u-1].charCode===y[u].charCode){y.splice(u,1);u--}return{platformId:s.platformId,encodingId:s.encodingId,mappings:y,hasShortCmap:b}}(x.cmap,t,this.isSymbolicFont,a.hasEncoding),te=ee.platformId,re=ee.encodingId,ae=ee.mappings,ie=ae.length;if(a.hasEncoding&&(3===te&&1===re||1===te&&0===re)||-1===te&&-1===re&&(0,s.getEncoding)(a.baseEncodingName)){var ne=[];"MacRomanEncoding"!==a.baseEncodingName&&"WinAnsiEncoding"!==a.baseEncodingName||(ne=(0,s.getEncoding)(a.baseEncodingName));var oe=(0,o.getGlyphsUnicode)();for(Y=0;Y<256;Y++){var se,ce;if(se=this.differences&&Y in this.differences?this.differences[Y]:Y in ne&&""!==ne[Y]?ne[Y]:s.StandardEncoding[Y]){ce=k(se,oe);var le;3===te&&1===re?le=oe[ce]:1===te&&0===re&&(le=s.MacRomanEncoding.indexOf(ce));for(var ue=!1,he=0;he<ie;++he)if(ae[he].charCode===le){J[Y]=ae[he].glyphId;ue=!0;break}if(!ue&&a.glyphNames){var fe=a.glyphNames.indexOf(se);-1===fe&&ce!==se&&(fe=a.glyphNames.indexOf(ce));fe>0&&Z(fe)&&(J[Y]=fe)}}}}else if(0===te&&0===re)for(var de=0;de<ie;++de)J[ae[de].charCode]=ae[de].glyphId;else for(var ge=0;ge<ie;++ge){Y=ae[ge].charCode;3===te&&Y>=61440&&Y<=61695&&(Y&=255);J[Y]=ae[ge].glyphId}}0===J.length&&(J[0]=0);var me=q-1;j||(me=0);var pe=F(J,Z,me);this.toFontChar=pe.toFontChar;x.cmap={tag:"cmap",data:R(pe.charCodeToGlyphId,q)};x["OS/2"]&&function(e){var t=new f.Stream(e.data),r=t.getUint16();t.getBytes(60);var a=t.getUint16();if(r<4&&768&a)return!1;if(t.getUint16()>t.getUint16())return!1;t.getBytes(6);if(0===t.getUint16())return!1;e.data[8]=e.data[9]=0;return!0}(x["OS/2"])||(x["OS/2"]={tag:"OS/2",data:B(a,pe.charCodeToGlyphId,K)});if(!E)try{O=new f.Stream(x["CFF "].data);(P=new n.CFFParser(O,a,p).parse()).duplicateFirstGlyph();var ve=new n.CFFCompiler(P);x["CFF "].data=ve.compile()}catch(e){(0,i.warn)("Failed to compile font "+a.loadedName)}if(x.name){var be=v(x.name);x.name.data=M(e,be)}else x.name={tag:"name",data:M(this.name)};var ye=new _(C.version);for(var we in x)ye.addTable(we,x[we].data);return ye.toArray()},convert:function(e,t,r){r.fixedPitch=!1;r.builtInEncoding&&function(e,t){if(!e.hasIncludedToUnicodeMap&&!(e.hasEncoding||t===e.defaultEncoding||e.toUnicode instanceof x)){var r=[],a=(0,o.getGlyphsUnicode)();for(var i in t){var n=t[i],s=(0,l.getUnicodeForGlyph)(n,a);-1!==s&&(r[i]=String.fromCharCode(s))}e.toUnicode.amend(r)}}(r,r.builtInEncoding);var a=1;t instanceof T&&(a=t.numGlyphs-1);var n=t.getGlyphMapping(r),c=F(n,t.hasGlyphId.bind(t),a);this.toFontChar=c.toFontChar;var u=t.numGlyphs;function h(e,t){var r=null;for(var a in e)if(t===e[a]){r||(r=[]);r.push(0|a)}return r}function f(e,t){for(var r in e)if(t===e[r])return 0|r;c.charCodeToGlyphId[c.nextAvailableFontCharCode]=t;return c.nextAvailableFontCharCode++}var d=t.seacs;if(p&&d&&d.length){var g=r.fontMatrix||i.FONT_IDENTITY_MATRIX,m=t.getCharset(),v=Object.create(null);for(var b in d){var y=d[b|=0],w=s.StandardEncoding[y[2]],k=s.StandardEncoding[y[3]],S=m.indexOf(w),C=m.indexOf(k);if(!(S<0||C<0)){var I={x:y[0]*g[0]+y[1]*g[2]+g[4],y:y[0]*g[1]+y[1]*g[3]+g[5]},O=h(n,b);if(O)for(var E=0,L=O.length;E<L;E++){var N=O[E],U=c.charCodeToGlyphId,q=f(U,S),j=f(U,C);v[N]={baseFontCharCode:q,accentFontCharCode:j,accentOffset:I}}}}r.seacMap=v}var z=1/(r.fontMatrix||i.FONT_IDENTITY_MATRIX)[0],H=new _("OTTO");H.addTable("CFF ",t.data);H.addTable("OS/2",B(r,c.charCodeToGlyphId));H.addTable("cmap",R(c.charCodeToGlyphId,u));H.addTable("head","\0\0\0\0\0\0\0\0\0\0_<õ\0\0"+P(z)+"\0\0\0\0ž\v~'\0\0\0\0ž\v~'\0\0"+P(r.descent)+"ÿ"+P(r.ascent)+A(r.italicAngle?2:0)+"\0\0\0\0\0\0\0");H.addTable("hhea","\0\0\0"+P(r.ascent)+P(r.descent)+"\0\0ÿÿ\0\0\0\0\0\0"+P(r.capHeight)+P(Math.tan(r.italicAngle)*r.xHeight)+"\0\0\0\0\0\0\0\0\0\0\0\0"+A(u));H.addTable("hmtx",function(){for(var e=t.charstrings,r=t.cff?t.cff.widths:null,a="\0\0\0\0",i=1,n=u;i<n;i++){var o=0;if(e){var s=e[i-1];o="width"in s?s.width:0}else r&&(o=Math.ceil(r[i]||0));a+=A(o)+A(0)}return a}());H.addTable("maxp","\0\0P\0"+A(u));H.addTable("name",M(e));H.addTable("post",D(r));return H.toArray()},get spaceWidth(){if("_shadowWidth"in this)return this._shadowWidth;for(var e,t=["space","minus","one","i","I"],r=0,a=t.length;r<a;r++){var i=t[r];if(i in this.widths){e=this.widths[i];break}var n=(0,o.getGlyphsUnicode)()[i],s=0;this.composite&&this.cMap.contains(n)&&(s=this.cMap.lookup(n));!s&&this.toUnicode&&(s=this.toUnicode.charCodeOf(n));s<=0&&(s=n);if(e=this.widths[s])break}e=e||this.defaultWidth;this._shadowWidth=e;return e},charToGlyph:function(e,t){var r,a,n,o=e;this.cMap&&this.cMap.contains(e)&&(o=this.cMap.lookup(e));a=this.widths[o];a=(0,i.isNum)(a)?a:this.defaultWidth;var s=this.vmetrics&&this.vmetrics[o],c=this.toUnicode.get(e)||this.fallbackToUnicode.get(e)||e;"number"==typeof c&&(c=String.fromCharCode(c));var u=e in this.toFontChar;r=this.toFontChar[e]||e;this.missingFile&&(r=(0,l.mapSpecialUnicodeValues)(r));this.isType3Font&&(n=r);var h=null;if(this.seacMap&&this.seacMap[e]){u=!0;var f=this.seacMap[e];r=f.baseFontCharCode;h={fontChar:String.fromCodePoint(f.accentFontCharCode),offset:f.accentOffset}}var d="number"==typeof r?String.fromCodePoint(r):"",g=this.glyphCache[e];if(!g||!g.matchesForCache(d,c,h,a,s,n,t,u)){g=new S(d,c,h,a,s,n,t,u);this.glyphCache[e]=g}return g},charsToGlyphs:function(e){var t,r,a,i=this.charsCache;if(i&&(t=i[e]))return t;i||(i=this.charsCache=Object.create(null));t=[];var n,o=e,s=0;if(this.cMap)for(var c=Object.create(null);s<e.length;){this.cMap.readCharCode(e,s,c);a=c.charcode;var l=c.length;s+=l;var u=1===l&&32===e.charCodeAt(s-1);r=this.charToGlyph(a,u);t.push(r)}else for(s=0,n=e.length;s<n;++s){a=e.charCodeAt(s);r=this.charToGlyph(a,32===a);t.push(r)}return i[o]=t}};return e}(),P=function(){function e(e){this.error=e;this.loadedName="g_font_error";this.missingFile=!0}e.prototype={charsToGlyphs:function(){return[]},exportData:function(){return{error:this.error}}};return e}();function I(e,t,r){var a,i,n,c=Object.create(null),l=!!(e.flags&v.Symbolic);if(e.baseEncodingName){n=(0,s.getEncoding)(e.baseEncodingName);for(i=0;i<n.length;i++){a=r.indexOf(n[i]);c[i]=a>=0?a:0}}else if(l)for(i in t)c[i]=t[i];else{n=s.StandardEncoding;for(i=0;i<n.length;i++){a=r.indexOf(n[i]);c[i]=a>=0?a:0}}var u,h=e.differences;if(h)for(i in h){var f=h[i];if(-1===(a=r.indexOf(f))){u||(u=(0,o.getGlyphsUnicode)());var d=k(f,u);d!==f&&(a=r.indexOf(d))}c[i]=a>=0?a:0}return c}var O=function(){function e(e,t,r){for(var a,n=e.length,o=t.length,s=n-o,c=r,l=!1;c<s;){a=0;for(;a<o&&e[c+a]===t[a];)a++;if(a>=o){c+=a;for(;c<n&&(0,i.isSpace)(e[c]);)c++;l=!0;break}c++}return{found:l,length:c}}function t(t,r,a){var n=a.length1,o=(a.length2,r.peekBytes(6)),s=128===o[0]&&1===o[1];if(s){r.skip(6);n=o[5]<<24|o[4]<<16|o[3]<<8|o[2]}var c=function(t,r){var a,n,o,s,c=[101,101,120,101,99],l=t.pos;try{n=(a=t.getBytes(r)).length}catch(e){if(e instanceof i.MissingDataException)throw e}if(n===r&&(o=e(a,c,r-2*c.length)).found&&o.length===r)return{stream:new f.Stream(a),length:r};(0,i.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');t.pos=l;for(;0!==(o=e(t.peekBytes(2048),c,0)).length;){t.pos+=o.length;if(o.found){s=t.pos-l;break}}t.pos=l;if(s)return{stream:new f.Stream(t.getBytes(s)),length:s};(0,i.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');return{stream:new f.Stream(t.getBytes(r)),length:r}}(r,n);new d.Type1Parser(c.stream,!1,p).extractFontHeader(a);s&&(o=r.getBytes(6))[5]<<24|o[4]<<16|o[3]<<8|o[2];var l,u=(l=r.getBytes(),{stream:new f.Stream(l),length:l.length}),h=new d.Type1Parser(u.stream,!0,p).extractFontProgram();for(var g in h.properties)a[g]=h.properties[g];var m=h.charstrings,v=this.getType2Charstrings(m),b=this.getType2Subrs(h.subrs);this.charstrings=m;this.data=this.wrap(t,v,this.charstrings,b,a);this.seacs=this.getSeacs(h.charstrings)}t.prototype={get numGlyphs(){return this.charstrings.length+1},getCharset:function(){for(var e=[".notdef"],t=this.charstrings,r=0;r<t.length;r++)e.push(t[r].glyphName);return e},getGlyphMapping:function(e){var t,r=this.charstrings,a=[".notdef"];for(t=0;t<r.length;t++)a.push(r[t].glyphName);var i=e.builtInEncoding;if(i){var n=Object.create(null);for(var o in i)(t=a.indexOf(i[o]))>=0&&(n[o]=t)}return I(e,n,a)},hasGlyphId:function(e){return!(e<0||e>=this.numGlyphs)&&(0===e||this.charstrings[e-1].charstring.length>0)},getSeacs:function(e){var t,r,a=[];for(t=0,r=e.length;t<r;t++){var i=e[t];i.seac&&(a[t+1]=i.seac)}return a},getType2Charstrings:function(e){for(var t=[],r=0,a=e.length;r<a;r++)t.push(e[r].charstring);return t},getType2Subrs:function(e){var t=0,r=e.length;t=r<1133?107:r<33769?1131:32768;var a,i=[];for(a=0;a<t;a++)i.push([11]);for(a=0;a<r;a++)i.push(e[a]);return i},wrap:function(e,t,r,a,i){var o=new n.CFF;o.header=new n.CFFHeader(1,0,4,4);o.names=[e];var s=new n.CFFTopDict;s.setByName("version",391);s.setByName("Notice",392);s.setByName("FullName",393);s.setByName("FamilyName",394);s.setByName("Weight",395);s.setByName("Encoding",null);s.setByName("FontMatrix",i.fontMatrix);s.setByName("FontBBox",i.bbox);s.setByName("charset",null);s.setByName("CharStrings",null);s.setByName("Private",null);o.topDict=s;var c=new n.CFFStrings;c.add("Version 0.11");c.add("See original notice");c.add(e);c.add(e);c.add("Medium");o.strings=c;o.globalSubrIndex=new n.CFFIndex;var l,u,h=t.length,f=[0];for(l=0;l<h;l++){var d=n.CFFStandardStrings.indexOf(r[l].glyphName);-1===d&&(d=0);f.push(d>>8&255,255&d)}o.charset=new n.CFFCharset(!1,0,[],f);var g=new n.CFFIndex;g.add([139,14]);for(l=0;l<h;l++)g.add(t[l]);o.charStrings=g;var m=new n.CFFPrivateDict;m.setByName("Subrs",null);var p=["BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StemSnapH","StemSnapV","BlueShift","BlueFuzz","BlueScale","LanguageGroup","ExpansionFactor","ForceBold","StdHW","StdVW"];for(l=0,u=p.length;l<u;l++){var v=p[l];if(v in i.privateData){var b=i.privateData[v];if(Array.isArray(b))for(var y=b.length-1;y>0;y--)b[y]-=b[y-1];m.setByName(v,b)}}o.topDict.privateDict=m;var w=new n.CFFIndex;for(l=0,u=a.length;l<u;l++)w.add(a[l]);m.subrsIndex=w;return new n.CFFCompiler(o).compile()}};return t}(),T=function(){function e(e,t){this.properties=t;var r=new n.CFFParser(e,t,p);this.cff=r.parse();this.cff.duplicateFirstGlyph();var a=new n.CFFCompiler(this.cff);this.seacs=this.cff.seacs;try{this.data=a.compile()}catch(r){(0,i.warn)("Failed to compile font "+t.loadedName);this.data=e}}e.prototype={get numGlyphs(){return this.cff.charStrings.count},getCharset:function(){return this.cff.charset.charset},getGlyphMapping:function(){var e,t,r=this.cff,a=this.properties,i=r.charset.charset;if(a.composite){e=Object.create(null);if(r.isCIDFont)for(t=0;t<i.length;t++){var n=i[t];e[a.cMap.charCodeOf(n)]=t}else for(t=0;t<r.charStrings.count;t++)e[t]=t;return e}return e=I(a,r.encoding?r.encoding.encoding:null,i)},hasGlyphId:function(e){return this.cff.hasGlyphId(e)}};return e}();t.SEAC_ANALYSIS_ENABLED=p;t.ErrorFont=P;t.Font=A;t.FontFlags=v;t.ToUnicodeMap=C;t.IdentityToUnicodeMap=x;t.getFontType=w},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.CFFFDSelect=t.CFFCompiler=t.CFFPrivateDict=t.CFFTopDict=t.CFFCharset=t.CFFIndex=t.CFFStrings=t.CFFHeader=t.CFF=t.CFFParser=t.CFFStandardStrings=void 0;var a=r(2),i=r(158),n=r(159),o=[".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"],s=function(){var e=[null,{id:"hstem",min:2,stackClearing:!0,stem:!0},null,{id:"vstem",min:2,stackClearing:!0,stem:!0},{id:"vmoveto",min:1,stackClearing:!0},{id:"rlineto",min:2,resetStack:!0},{id:"hlineto",min:1,resetStack:!0},{id:"vlineto",min:1,resetStack:!0},{id:"rrcurveto",min:6,resetStack:!0},null,{id:"callsubr",min:1,undefStack:!0},{id:"return",min:0,undefStack:!0},null,null,{id:"endchar",min:0,stackClearing:!0},null,null,null,{id:"hstemhm",min:2,stackClearing:!0,stem:!0},{id:"hintmask",min:0,stackClearing:!0},{id:"cntrmask",min:0,stackClearing:!0},{id:"rmoveto",min:2,stackClearing:!0},{id:"hmoveto",min:1,stackClearing:!0},{id:"vstemhm",min:2,stackClearing:!0,stem:!0},{id:"rcurveline",min:8,resetStack:!0},{id:"rlinecurve",min:8,resetStack:!0},{id:"vvcurveto",min:4,resetStack:!0},{id:"hhcurveto",min:4,resetStack:!0},null,{id:"callgsubr",min:1,undefStack:!0},{id:"vhcurveto",min:4,resetStack:!0},{id:"hvcurveto",min:4,resetStack:!0}],t=[null,null,null,{id:"and",min:2,stackDelta:-1},{id:"or",min:2,stackDelta:-1},{id:"not",min:1,stackDelta:0},null,null,null,{id:"abs",min:1,stackDelta:0},{id:"add",min:2,stackDelta:-1,stackFn:function(e,t){e[t-2]=e[t-2]+e[t-1]}},{id:"sub",min:2,stackDelta:-1,stackFn:function(e,t){e[t-2]=e[t-2]-e[t-1]}},{id:"div",min:2,stackDelta:-1,stackFn:function(e,t){e[t-2]=e[t-2]/e[t-1]}},null,{id:"neg",min:1,stackDelta:0,stackFn:function(e,t){e[t-1]=-e[t-1]}},{id:"eq",min:2,stackDelta:-1},null,null,{id:"drop",min:1,stackDelta:-1},null,{id:"put",min:2,stackDelta:-2},{id:"get",min:1,stackDelta:0},{id:"ifelse",min:4,stackDelta:-3},{id:"random",min:0,stackDelta:1},{id:"mul",min:2,stackDelta:-1,stackFn:function(e,t){e[t-2]=e[t-2]*e[t-1]}},null,{id:"sqrt",min:1,stackDelta:0},{id:"dup",min:1,stackDelta:1},{id:"exch",min:2,stackDelta:0},{id:"index",min:2,stackDelta:0},{id:"roll",min:3,stackDelta:-2},null,null,null,{id:"hflex",min:7,resetStack:!0},{id:"flex",min:13,resetStack:!0},{id:"hflex1",min:9,resetStack:!0},{id:"flex1",min:11,resetStack:!0}];function r(e,t,r){this.bytes=e.getBytes();this.properties=t;this.seacAnalysisEnabled=!!r}r.prototype={parse:function(){var e=this.properties,t=new c;this.cff=t;var r=this.parseHeader(),a=this.parseIndex(r.endPos),i=this.parseIndex(a.endPos),n=this.parseIndex(i.endPos),o=this.parseIndex(n.endPos),s=this.parseDict(i.obj.get(0)),l=this.createDict(d,s,t.strings);t.header=r.obj;t.names=this.parseNameIndex(a.obj);t.strings=this.parseStringIndex(n.obj);t.topDict=l;t.globalSubrIndex=o.obj;this.parsePrivateDict(t.topDict);t.isCIDFont=l.hasName("ROS");var u=l.getByName("CharStrings"),h=this.parseIndex(u).obj,f=l.getByName("FontMatrix");f&&(e.fontMatrix=f);var g,m,p=l.getByName("FontBBox");if(p){e.ascent=Math.max(p[3],p[1]);e.descent=Math.min(p[1],p[3]);e.ascentScaled=!0}if(t.isCIDFont){for(var v=this.parseIndex(l.getByName("FDArray")).obj,b=0,y=v.count;b<y;++b){var w=v.get(b),k=this.createDict(d,this.parseDict(w),t.strings);this.parsePrivateDict(k);t.fdArray.push(k)}m=null;g=this.parseCharsets(l.getByName("charset"),h.count,t.strings,!0);t.fdSelect=this.parseFDSelect(l.getByName("FDSelect"),h.count)}else{g=this.parseCharsets(l.getByName("charset"),h.count,t.strings,!1);m=this.parseEncoding(l.getByName("Encoding"),e,t.strings,g.charset)}t.charset=g;t.encoding=m;var S=this.parseCharStrings({charStrings:h,localSubrIndex:l.privateDict.subrsIndex,globalSubrIndex:o.obj,fdSelect:t.fdSelect,fdArray:t.fdArray,privateDict:l.privateDict});t.charStrings=S.charStrings;t.seacs=S.seacs;t.widths=S.widths;return t},parseHeader:function(){for(var e=this.bytes,t=e.length,r=0;r<t&&1!==e[r];)++r;if(r>=t)throw new a.FormatError("Invalid CFF header");if(0!==r){(0,a.info)("cff data is shifted");e=e.subarray(r);this.bytes=e}var i=e[0],n=e[1],o=e[2],s=e[3];return{obj:new l(i,n,o,s),endPos:o}},parseDict:function(e){var t=0;function r(){var r=e[t++];if(30===r)return function(){var r="",a=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"],i=e.length;for(;t<i;){var n=e[t++],o=n>>4,s=15&n;if(15===o)break;r+=a[o];if(15===s)break;r+=a[s]}return parseFloat(r)}();if(28===r)return r=((r=e[t++])<<24|e[t++]<<16)>>16;if(29===r)return r=(r=(r=(r=e[t++])<<8|e[t++])<<8|e[t++])<<8|e[t++];if(r>=32&&r<=246)return r-139;if(r>=247&&r<=250)return 256*(r-247)+e[t++]+108;if(r>=251&&r<=254)return-256*(r-251)-e[t++]-108;(0,a.warn)('CFFParser_parseDict: "'+r+'" is a reserved command.');return NaN}var i=[],n=[];t=0;for(var o=e.length;t<o;){var s=e[t];if(s<=21){12===s&&(s=s<<8|e[++t]);n.push([s,i]);i=[];++t}else i.push(r())}return n},parseIndex:function(e){var t,r,a=new h,i=this.bytes,n=i[e++]<<8|i[e++],o=[],s=e;if(0!==n){var c=i[e++],l=e+(n+1)*c-1;for(t=0,r=n+1;t<r;++t){for(var u=0,f=0;f<c;++f){u<<=8;u+=i[e++]}o.push(l+u)}s=o[n]}for(t=0,r=o.length-1;t<r;++t){var d=o[t],g=o[t+1];a.add(i.subarray(d,g))}return{obj:a,endPos:s}},parseNameIndex:function(e){for(var t=[],r=0,i=e.count;r<i;++r){var n=e.get(r);t.push((0,a.bytesToString)(n))}return t},parseStringIndex:function(e){for(var t=new u,r=0,i=e.count;r<i;++r){var n=e.get(r);t.add((0,a.bytesToString)(n))}return t},createDict:function(e,t,r){for(var a=new e(r),i=0,n=t.length;i<n;++i){var o=t[i],s=o[0],c=o[1];a.setByKey(s,c)}return a},parseCharString:function(r,i,n,o){if(!i||r.callDepth>10)return!1;for(var s=r.stackSize,c=r.stack,l=i.length,u=0;u<l;){var h=i[u++],f=null;if(12===h){var d=i[u++];if(0===d){i[u-2]=139;i[u-1]=22;s=0}else f=t[d]}else if(28===h){c[s]=(i[u]<<24|i[u+1]<<16)>>16;u+=2;s++}else if(14===h){if(s>=4){s-=4;if(this.seacAnalysisEnabled){r.seac=c.slice(s,s+4);return!1}}f=e[h]}else if(h>=32&&h<=246){c[s]=h-139;s++}else if(h>=247&&h<=254){c[s]=h<251?(h-247<<8)+i[u]+108:-(h-251<<8)-i[u]-108;u++;s++}else if(255===h){c[s]=(i[u]<<24|i[u+1]<<16|i[u+2]<<8|i[u+3])/65536;u+=4;s++}else if(19===h||20===h){r.hints+=s>>1;u+=r.hints+7>>3;s%=2;f=e[h]}else{if(10===h||29===h){var g;if(!(g=10===h?n:o)){f=e[h];(0,a.warn)("Missing subrsIndex for "+f.id);return!1}var m=32768;g.count<1240?m=107:g.count<33900&&(m=1131);var p=c[--s]+m;if(p<0||p>=g.count||isNaN(p)){f=e[h];(0,a.warn)("Out of bounds subrIndex for "+f.id);return!1}r.stackSize=s;r.callDepth++;if(!this.parseCharString(r,g.get(p),n,o))return!1;r.callDepth--;s=r.stackSize;continue}if(11===h){r.stackSize=s;return!0}f=e[h]}if(f){f.stem&&(r.hints+=s>>1);if("min"in f&&!r.undefStack&&s<f.min){(0,a.warn)("Not enough parameters for "+f.id+"; actual: "+s+", expected: "+f.min);return!1}if(r.firstStackClearing&&f.stackClearing){r.firstStackClearing=!1;(s-=f.min)>=2&&f.stem?s%=2:s>1&&(0,a.warn)("Found too many parameters for stack-clearing command");s>0&&c[s-1]>=0&&(r.width=c[s-1])}if("stackDelta"in f){"stackFn"in f&&f.stackFn(c,s);s+=f.stackDelta}else if(f.stackClearing)s=0;else if(f.resetStack){s=0;r.undefStack=!1}else if(f.undefStack){s=0;r.undefStack=!0;r.firstStackClearing=!1}}}r.stackSize=s;return!0},parseCharStrings:function(e){for(var t=e.charStrings,r=e.localSubrIndex,i=e.globalSubrIndex,n=e.fdSelect,o=e.fdArray,s=e.privateDict,c=[],l=[],u=t.count,h=0;h<u;h++){var f=t.get(h),d={callDepth:0,stackSize:0,stack:[],undefStack:!0,hints:0,firstStackClearing:!0,seac:null,width:null},g=!0,m=null,p=s;if(n&&o.length){var v=n.getFDIndex(h);if(-1===v){(0,a.warn)("Glyph index is not in fd select.");g=!1}if(v>=o.length){(0,a.warn)("Invalid fd index for glyph index.");g=!1}g&&(m=(p=o[v].privateDict).subrsIndex)}else r&&(m=r);g&&(g=this.parseCharString(d,f,m,i));if(null!==d.width){var b=p.getByName("nominalWidthX");l[h]=b+d.width}else{var y=p.getByName("defaultWidthX");l[h]=y}null!==d.seac&&(c[h]=d.seac);g||t.set(h,new Uint8Array([14]))}return{charStrings:t,seacs:c,widths:l}},emptyPrivateDictionary:function(e){var t=this.createDict(g,[],e.strings);e.setByKey(18,[0,0]);e.privateDict=t},parsePrivateDict:function(e){if(e.hasName("Private")){var t=e.getByName("Private");if(Array.isArray(t)&&2===t.length){var r=t[0],a=t[1];if(0===r||a>=this.bytes.length)this.emptyPrivateDictionary(e);else{var i=a+r,n=this.bytes.subarray(a,i),o=this.parseDict(n),s=this.createDict(g,o,e.strings);e.privateDict=s;if(s.getByName("Subrs")){var c=s.getByName("Subrs"),l=a+c;if(0===c||l>=this.bytes.length)this.emptyPrivateDictionary(e);else{var u=this.parseIndex(l);s.subrsIndex=u.obj}}}}else e.removeByName("Private")}else this.emptyPrivateDictionary(e)},parseCharsets:function(e,t,r,n){if(0===e)return new p(!0,m.ISO_ADOBE,i.ISOAdobeCharset);if(1===e)return new p(!0,m.EXPERT,i.ExpertCharset);if(2===e)return new p(!0,m.EXPERT_SUBSET,i.ExpertSubsetCharset);var o,s,c,l=this.bytes,u=e,h=l[e++],f=[".notdef"];t-=1;switch(h){case 0:for(c=0;c<t;c++){o=l[e++]<<8|l[e++];f.push(n?o:r.get(o))}break;case 1:for(;f.length<=t;){o=l[e++]<<8|l[e++];s=l[e++];for(c=0;c<=s;c++)f.push(n?o++:r.get(o++))}break;case 2:for(;f.length<=t;){o=l[e++]<<8|l[e++];s=l[e++]<<8|l[e++];for(c=0;c<=s;c++)f.push(n?o++:r.get(o++))}break;default:throw new a.FormatError("Unknown charset format")}var d=e,g=l.subarray(u,d);return new p(!1,h,f,g)},parseEncoding:function(e,t,r,i){var o,s,c,l=Object.create(null),u=this.bytes,h=!1,f=null;if(0===e||1===e){h=!0;o=e;var d=e?n.ExpertEncoding:n.StandardEncoding;for(s=0,c=i.length;s<c;s++){var g=d.indexOf(i[s]);-1!==g&&(l[g]=s)}}else{var m=e;switch(127&(o=u[e++])){case 0:var p=u[e++];for(s=1;s<=p;s++)l[u[e++]]=s;break;case 1:var b=u[e++],y=1;for(s=0;s<b;s++)for(var w=u[e++],k=u[e++],S=w;S<=w+k;S++)l[S]=y++;break;default:throw new a.FormatError("Unknown encoding format: "+o+" in CFF")}var C=e;if(128&o){u[m]&=127;!function(){var t=u[e++];for(s=0;s<t;s++){var a=u[e++],n=(u[e++]<<8)+(255&u[e++]);l[a]=i.indexOf(r.get(n))}}()}f=u.subarray(m,C)}return new v(h,o&=127,l,f)},parseFDSelect:function(e,t){var r,i=this.bytes,n=i[e++],o=[];switch(n){case 0:for(r=0;r<t;++r){var s=i[e++];o.push(s)}break;case 3:var c=i[e++]<<8|i[e++];for(r=0;r<c;++r){var l=i[e++]<<8|i[e++];if(0===r&&0!==l){(0,a.warn)("parseFDSelect: The first range must have a first GID of 0 -- trying to recover.");l=0}for(var u=i[e++],h=i[e]<<8|i[e+1],f=l;f<h;++f)o.push(u)}e+=2;break;default:throw new a.FormatError('parseFDSelect: Unknown format "'+n+'".')}if(o.length!==t)throw new a.FormatError("parseFDSelect: Invalid font data.");return new b(n,o)}};return r}(),c=function(){function e(){this.header=null;this.names=[];this.topDict=null;this.strings=new u;this.globalSubrIndex=null;this.encoding=null;this.charset=null;this.charStrings=null;this.fdArray=[];this.fdSelect=null;this.isCIDFont=!1}e.prototype={duplicateFirstGlyph:function(){if(this.charStrings.count>=65535)(0,a.warn)("Not enough space in charstrings to duplicate first glyph.");else{var e=this.charStrings.get(0);this.charStrings.add(e);this.isCIDFont&&this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0])}},hasGlyphId:function(e){return!(e<0||e>=this.charStrings.count)&&this.charStrings.get(e).length>0}};return e}(),l=function(){return function(e,t,r,a){this.major=e;this.minor=t;this.hdrSize=r;this.offSize=a}}(),u=function(){function e(){this.strings=[]}e.prototype={get:function(e){return e>=0&&e<=390?o[e]:e-391<=this.strings.length?this.strings[e-391]:o[0]},add:function(e){this.strings.push(e)},get count(){return this.strings.length}};return e}(),h=function(){function e(){this.objects=[];this.length=0}e.prototype={add:function(e){this.length+=e.length;this.objects.push(e)},set:function(e,t){this.length+=t.length-this.objects[e].length;this.objects[e]=t},get:function(e){return this.objects[e]},get count(){return this.objects.length}};return e}(),f=function(){function e(e,t){this.keyToNameMap=e.keyToNameMap;this.nameToKeyMap=e.nameToKeyMap;this.defaults=e.defaults;this.types=e.types;this.opcodes=e.opcodes;this.order=e.order;this.strings=t;this.values=Object.create(null)}e.prototype={setByKey:function(e,t){if(!(e in this.keyToNameMap))return!1;var r=t.length;if(0===r)return!0;for(var i=0;i<r;i++)if(isNaN(t[i])){(0,a.warn)('Invalid CFFDict value: "'+t+'" for key "'+e+'".');return!0}var n=this.types[e];"num"!==n&&"sid"!==n&&"offset"!==n||(t=t[0]);this.values[e]=t;return!0},setByName:function(e,t){if(!(e in this.nameToKeyMap))throw new a.FormatError('Invalid dictionary name "'+e+'"');this.values[this.nameToKeyMap[e]]=t},hasName:function(e){return this.nameToKeyMap[e]in this.values},getByName:function(e){if(!(e in this.nameToKeyMap))throw new a.FormatError("Invalid dictionary name "+e+'"');var t=this.nameToKeyMap[e];return t in this.values?this.values[t]:this.defaults[t]},removeByName:function(e){delete this.values[this.nameToKeyMap[e]]}};e.createTables=function(e){for(var t={keyToNameMap:{},nameToKeyMap:{},defaults:{},types:{},opcodes:{},order:[]},r=0,a=e.length;r<a;++r){var i=e[r],n=Array.isArray(i[0])?(i[0][0]<<8)+i[0][1]:i[0];t.keyToNameMap[n]=i[1];t.nameToKeyMap[i[1]]=n;t.types[n]=i[2];t.defaults[n]=i[3];t.opcodes[n]=Array.isArray(i[0])?i[0]:[i[0]];t.order.push(n)}return t};return e}(),d=function(){var e=[[[12,30],"ROS",["sid","sid","num"],null],[[12,20],"SyntheticBase","num",null],[0,"version","sid",null],[1,"Notice","sid",null],[[12,0],"Copyright","sid",null],[2,"FullName","sid",null],[3,"FamilyName","sid",null],[4,"Weight","sid",null],[[12,1],"isFixedPitch","num",0],[[12,2],"ItalicAngle","num",0],[[12,3],"UnderlinePosition","num",-100],[[12,4],"UnderlineThickness","num",50],[[12,5],"PaintType","num",0],[[12,6],"CharstringType","num",2],[[12,7],"FontMatrix",["num","num","num","num","num","num"],[.001,0,0,.001,0,0]],[13,"UniqueID","num",null],[5,"FontBBox",["num","num","num","num"],[0,0,0,0]],[[12,8],"StrokeWidth","num",0],[14,"XUID","array",null],[15,"charset","offset",0],[16,"Encoding","offset",0],[17,"CharStrings","offset",0],[18,"Private",["offset","offset"],null],[[12,21],"PostScript","sid",null],[[12,22],"BaseFontName","sid",null],[[12,23],"BaseFontBlend","delta",null],[[12,31],"CIDFontVersion","num",0],[[12,32],"CIDFontRevision","num",0],[[12,33],"CIDFontType","num",0],[[12,34],"CIDCount","num",8720],[[12,35],"UIDBase","num",null],[[12,37],"FDSelect","offset",null],[[12,36],"FDArray","offset",null],[[12,38],"FontName","sid",null]],t=null;function r(r){null===t&&(t=f.createTables(e));f.call(this,t,r);this.privateDict=null}r.prototype=Object.create(f.prototype);return r}(),g=function(){var e=[[6,"BlueValues","delta",null],[7,"OtherBlues","delta",null],[8,"FamilyBlues","delta",null],[9,"FamilyOtherBlues","delta",null],[[12,9],"BlueScale","num",.039625],[[12,10],"BlueShift","num",7],[[12,11],"BlueFuzz","num",1],[10,"StdHW","num",null],[11,"StdVW","num",null],[[12,12],"StemSnapH","delta",null],[[12,13],"StemSnapV","delta",null],[[12,14],"ForceBold","num",0],[[12,17],"LanguageGroup","num",0],[[12,18],"ExpansionFactor","num",.06],[[12,19],"initialRandomSeed","num",0],[20,"defaultWidthX","num",0],[21,"nominalWidthX","num",0],[19,"Subrs","offset",null]],t=null;function r(r){null===t&&(t=f.createTables(e));f.call(this,t,r);this.subrsIndex=null}r.prototype=Object.create(f.prototype);return r}(),m={ISO_ADOBE:0,EXPERT:1,EXPERT_SUBSET:2},p=function(){return function(e,t,r,a){this.predefined=e;this.format=t;this.charset=r;this.raw=a}}(),v=function(){return function(e,t,r,a){this.predefined=e;this.format=t;this.encoding=r;this.raw=a}}(),b=function(){function e(e,t){this.format=e;this.fdSelect=t}e.prototype={getFDIndex:function(e){return e<0||e>=this.fdSelect.length?-1:this.fdSelect[e]}};return e}(),y=function(){function e(){this.offsets=Object.create(null)}e.prototype={isTracking:function(e){return e in this.offsets},track:function(e,t){if(e in this.offsets)throw new a.FormatError("Already tracking location of "+e);this.offsets[e]=t},offset:function(e){for(var t in this.offsets)this.offsets[t]+=e},setEntryLocation:function(e,t,r){if(!(e in this.offsets))throw new a.FormatError("Not tracking location of "+e);for(var i=r.data,n=this.offsets[e],o=0,s=t.length;o<s;++o){var c=5*o+n,l=c+1,u=c+2,h=c+3,f=c+4;if(29!==i[c]||0!==i[l]||0!==i[u]||0!==i[h]||0!==i[f])throw new a.FormatError("writing to an offset that is not empty");var d=t[o];i[c]=29;i[l]=d>>24&255;i[u]=d>>16&255;i[h]=d>>8&255;i[f]=255&d}}};return e}(),w=function(){function e(e){this.cff=e}e.prototype={compile:function(){var e=this.cff,t={data:[],length:0,add:function(e){this.data=this.data.concat(e);this.length=this.data.length}},r=this.compileHeader(e.header);t.add(r);var i=this.compileNameIndex(e.names);t.add(i);if(e.isCIDFont&&e.topDict.hasName("FontMatrix")){var n=e.topDict.getByName("FontMatrix");e.topDict.removeByName("FontMatrix");for(var o=0,s=e.fdArray.length;o<s;o++){var c=e.fdArray[o],l=n.slice(0);c.hasName("FontMatrix")&&(l=a.Util.transform(l,c.getByName("FontMatrix")));c.setByName("FontMatrix",l)}}e.topDict.setByName("charset",0);var u=this.compileTopDicts([e.topDict],t.length,e.isCIDFont);t.add(u.output);var h=u.trackers[0],f=this.compileStringIndex(e.strings.strings);t.add(f);var d=this.compileIndex(e.globalSubrIndex);t.add(d);if(e.encoding&&e.topDict.hasName("Encoding"))if(e.encoding.predefined)h.setEntryLocation("Encoding",[e.encoding.format],t);else{var g=this.compileEncoding(e.encoding);h.setEntryLocation("Encoding",[t.length],t);t.add(g)}var m=this.compileCharset(e.charset);h.setEntryLocation("charset",[t.length],t);t.add(m);var p=this.compileCharStrings(e.charStrings);h.setEntryLocation("CharStrings",[t.length],t);t.add(p);if(e.isCIDFont){h.setEntryLocation("FDSelect",[t.length],t);var v=this.compileFDSelect(e.fdSelect);t.add(v);u=this.compileTopDicts(e.fdArray,t.length,!0);h.setEntryLocation("FDArray",[t.length],t);t.add(u.output);var b=u.trackers;this.compilePrivateDicts(e.fdArray,b,t)}this.compilePrivateDicts([e.topDict],[h],t);t.add([0]);return t.data},encodeNumber:function(e){return parseFloat(e)!==parseInt(e,10)||isNaN(e)?this.encodeFloat(e):this.encodeInteger(e)},encodeFloat:function(e){var t=e.toString(),r=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(t);if(r){var a=parseFloat("1e"+((r[2]?+r[2]:0)+r[1].length));t=(Math.round(e*a)/a).toString()}var i,n,o="";for(i=0,n=t.length;i<n;++i){var s=t[i];o+="e"===s?"-"===t[++i]?"c":"b":"."===s?"a":"-"===s?"e":s}var c=[30];for(i=0,n=(o+=1&o.length?"f":"ff").length;i<n;i+=2)c.push(parseInt(o.substring(i,i+2),16));return c},encodeInteger:function(e){return e>=-107&&e<=107?[e+139]:e>=108&&e<=1131?[247+((e-=108)>>8),255&e]:e>=-1131&&e<=-108?[251+((e=-e-108)>>8),255&e]:e>=-32768&&e<=32767?[28,e>>8&255,255&e]:[29,e>>24&255,e>>16&255,e>>8&255,255&e]},compileHeader:function(e){return[e.major,e.minor,e.hdrSize,e.offSize]},compileNameIndex:function(e){for(var t=new h,r=0,i=e.length;r<i;++r){for(var n=e[r],o=Math.min(n.length,127),s=new Array(o),c=0;c<o;c++){var l=n[c];(l<"!"||l>"~"||"["===l||"]"===l||"("===l||")"===l||"{"===l||"}"===l||"<"===l||">"===l||"/"===l||"%"===l)&&(l="_");s[c]=l}""===(s=s.join(""))&&(s="Bad_Font_Name");t.add((0,a.stringToBytes)(s))}return this.compileIndex(t)},compileTopDicts:function(e,t,r){for(var a=[],i=new h,n=0,o=e.length;n<o;++n){var s=e[n];if(r){s.removeByName("CIDFontVersion");s.removeByName("CIDFontRevision");s.removeByName("CIDFontType");s.removeByName("CIDCount");s.removeByName("UIDBase")}var c=new y,l=this.compileDict(s,c);a.push(c);i.add(l);c.offset(t)}return{trackers:a,output:i=this.compileIndex(i,a)}},compilePrivateDicts:function(e,t,r){for(var i=0,n=e.length;i<n;++i){var o=e[i],s=o.privateDict;if(!s||!o.hasName("Private"))throw new a.FormatError("There must be a private dictionary.");var c=new y,l=this.compileDict(s,c),u=r.length;c.offset(u);l.length||(u=0);t[i].setEntryLocation("Private",[l.length,u],r);r.add(l);if(s.subrsIndex&&s.hasName("Subrs")){var h=this.compileIndex(s.subrsIndex);c.setEntryLocation("Subrs",[l.length],r);r.add(h)}}},compileDict:function(e,t){for(var r=[],i=e.order,n=0;n<i.length;++n){var o=i[n];if(o in e.values){var s=e.values[o],c=e.types[o];Array.isArray(c)||(c=[c]);Array.isArray(s)||(s=[s]);if(0!==s.length){for(var l=0,u=c.length;l<u;++l){var h=c[l],f=s[l];switch(h){case"num":case"sid":r=r.concat(this.encodeNumber(f));break;case"offset":var d=e.keyToNameMap[o];t.isTracking(d)||t.track(d,r.length);r=r.concat([29,0,0,0,0]);break;case"array":case"delta":r=r.concat(this.encodeNumber(f));for(var g=1,m=s.length;g<m;++g)r=r.concat(this.encodeNumber(s[g]));break;default:throw new a.FormatError("Unknown data type of "+h)}}r=r.concat(e.opcodes[o])}}}return r},compileStringIndex:function(e){for(var t=new h,r=0,i=e.length;r<i;++r)t.add((0,a.stringToBytes)(e[r]));return this.compileIndex(t)},compileGlobalSubrIndex:function(){var e=this.cff.globalSubrIndex;this.out.writeByteArray(this.compileIndex(e))},compileCharStrings:function(e){for(var t=new h,r=0;r<e.count;r++){var a=e.get(r);0!==a.length?t.add(a):t.add(new Uint8Array([139,14]))}return this.compileIndex(t)},compileCharset:function(e){var t=1+2*(this.cff.charStrings.count-1),r=new Uint8Array(t);return this.compileTypedArray(r)},compileEncoding:function(e){return this.compileTypedArray(e.raw)},compileFDSelect:function(e){var t=e.format,r=void 0,a=void 0;switch(t){case 0:(r=new Uint8Array(1+e.fdSelect.length))[0]=t;for(a=0;a<e.fdSelect.length;a++)r[a+1]=e.fdSelect[a];break;case 3:var i=e.fdSelect[0],n=[t,0,0,0,0,i];for(a=1;a<e.fdSelect.length;a++){var o=e.fdSelect[a];if(o!==i){n.push(a>>8&255,255&a,o);i=o}}var s=(n.length-3)/3;n[1]=s>>8&255;n[2]=255&s;n.push(a>>8&255,255&a);r=new Uint8Array(n)}return this.compileTypedArray(r)},compileTypedArray:function(e){for(var t=[],r=0,a=e.length;r<a;++r)t[r]=e[r];return t},compileIndex:function(e,t){t=t||[];var r=e.objects,a=r.length;if(0===a)return[0,0,0];var i,n,o=[a>>8&255,255&a],s=1;for(i=0;i<a;++i)s+=r[i].length;n=s<256?1:s<65536?2:s<16777216?3:4;o.push(n);var c=1;for(i=0;i<a+1;i++){1===n?o.push(255&c):2===n?o.push(c>>8&255,255&c):3===n?o.push(c>>16&255,c>>8&255,255&c):o.push(c>>>24&255,c>>16&255,c>>8&255,255&c);r[i]&&(c+=r[i].length)}for(i=0;i<a;i++){t[i]&&t[i].offset(o.length);for(var l=0,u=r[i].length;l<u;l++)o.push(r[i][l])}return o}};return e}();t.CFFStandardStrings=o;t.CFFParser=s;t.CFF=c;t.CFFHeader=l;t.CFFStrings=u;t.CFFIndex=h;t.CFFCharset=p;t.CFFTopDict=d;t.CFFPrivateDict=g;t.CFFCompiler=w;t.CFFFDSelect=b},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.ISOAdobeCharset=[".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"];t.ExpertCharset=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","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","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","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"];t.ExpertSubsetCharset=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"]},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","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","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","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"],i=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","centoldstyle","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","","threequartersemdash","","questionsmall","","","","","Ethsmall","","","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","","","","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hypheninferior","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","","","asuperior","centsuperior","","","","","Aacutesmall","Agravesmall","Acircumflexsmall","Adieresissmall","Atildesmall","Aringsmall","Ccedillasmall","Eacutesmall","Egravesmall","Ecircumflexsmall","Edieresissmall","Iacutesmall","Igravesmall","Icircumflexsmall","Idieresissmall","Ntildesmall","Oacutesmall","Ogravesmall","Ocircumflexsmall","Odieresissmall","Otildesmall","Uacutesmall","Ugravesmall","Ucircumflexsmall","Udieresissmall","","eightsuperior","fourinferior","threeinferior","sixinferior","eightinferior","seveninferior","Scaronsmall","","centinferior","twoinferior","","Dieresissmall","","Caronsmall","osuperior","fiveinferior","","commainferior","periodinferior","Yacutesmall","","dollarinferior","","","Thornsmall","","nineinferior","zeroinferior","Zcaronsmall","AEsmall","Oslashsmall","questiondownsmall","oneinferior","Lslashsmall","","","","","","","Cedillasmall","","","","","","OEsmall","figuredash","hyphensuperior","","","","","exclamdownsmall","","Ydieresissmall","","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","ninesuperior","zerosuperior","","esuperior","rsuperior","tsuperior","","","isuperior","ssuperior","dsuperior","","","","","","lsuperior","Ogoneksmall","Brevesmall","Macronsmall","bsuperior","nsuperior","msuperior","commasuperior","periodsuperior","Dotaccentsmall","Ringsmall","","","",""],n=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","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","grave","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","","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","space","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron"],o=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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","","","",""],s=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","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","grave","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","bullet","Euro","bullet","quotesinglbase","florin","quotedblbase","ellipsis","dagger","daggerdbl","circumflex","perthousand","Scaron","guilsinglleft","OE","bullet","Zcaron","bullet","bullet","quoteleft","quoteright","quotedblleft","quotedblright","bullet","endash","emdash","tilde","trademark","scaron","guilsinglright","oe","bullet","zcaron","Ydieresis","space","exclamdown","cent","sterling","currency","yen","brokenbar","section","dieresis","copyright","ordfeminine","guillemotleft","logicalnot","hyphen","registered","macron","degree","plusminus","twosuperior","threesuperior","acute","mu","paragraph","periodcentered","cedilla","onesuperior","ordmasculine","guillemotright","onequarter","onehalf","threequarters","questiondown","Agrave","Aacute","Acircumflex","Atilde","Adieresis","Aring","AE","Ccedilla","Egrave","Eacute","Ecircumflex","Edieresis","Igrave","Iacute","Icircumflex","Idieresis","Eth","Ntilde","Ograve","Oacute","Ocircumflex","Otilde","Odieresis","multiply","Oslash","Ugrave","Uacute","Ucircumflex","Udieresis","Yacute","Thorn","germandbls","agrave","aacute","acircumflex","atilde","adieresis","aring","ae","ccedilla","egrave","eacute","ecircumflex","edieresis","igrave","iacute","icircumflex","idieresis","eth","ntilde","ograve","oacute","ocircumflex","otilde","odieresis","divide","oslash","ugrave","uacute","ucircumflex","udieresis","yacute","thorn","ydieresis"],c=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","universal","numbersign","existential","percent","ampersand","suchthat","parenleft","parenright","asteriskmath","plus","comma","minus","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","congruent","Alpha","Beta","Chi","Delta","Epsilon","Phi","Gamma","Eta","Iota","theta1","Kappa","Lambda","Mu","Nu","Omicron","Pi","Theta","Rho","Sigma","Tau","Upsilon","sigma1","Omega","Xi","Psi","Zeta","bracketleft","therefore","bracketright","perpendicular","underscore","radicalex","alpha","beta","chi","delta","epsilon","phi","gamma","eta","iota","phi1","kappa","lambda","mu","nu","omicron","pi","theta","rho","sigma","tau","upsilon","omega1","omega","xi","psi","zeta","braceleft","bar","braceright","similar","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Euro","Upsilon1","minute","lessequal","fraction","infinity","florin","club","diamond","heart","spade","arrowboth","arrowleft","arrowup","arrowright","arrowdown","degree","plusminus","second","greaterequal","multiply","proportional","partialdiff","bullet","divide","notequal","equivalence","approxequal","ellipsis","arrowvertex","arrowhorizex","carriagereturn","aleph","Ifraktur","Rfraktur","weierstrass","circlemultiply","circleplus","emptyset","intersection","union","propersuperset","reflexsuperset","notsubset","propersubset","reflexsubset","element","notelement","angle","gradient","registerserif","copyrightserif","trademarkserif","product","radical","dotmath","logicalnot","logicaland","logicalor","arrowdblboth","arrowdblleft","arrowdblup","arrowdblright","arrowdbldown","lozenge","angleleft","registersans","copyrightsans","trademarksans","summation","parenlefttp","parenleftex","parenleftbt","bracketlefttp","bracketleftex","bracketleftbt","bracelefttp","braceleftmid","braceleftbt","braceex","","angleright","integral","integraltp","integralex","integralbt","parenrighttp","parenrightex","parenrightbt","bracketrighttp","bracketrightex","bracketrightbt","bracerighttp","bracerightmid","bracerightbt",""],l=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","a1","a2","a202","a3","a4","a5","a119","a118","a117","a11","a12","a13","a14","a15","a16","a105","a17","a18","a19","a20","a21","a22","a23","a24","a25","a26","a27","a28","a6","a7","a8","a9","a10","a29","a30","a31","a32","a33","a34","a35","a36","a37","a38","a39","a40","a41","a42","a43","a44","a45","a46","a47","a48","a49","a50","a51","a52","a53","a54","a55","a56","a57","a58","a59","a60","a61","a62","a63","a64","a65","a66","a67","a68","a69","a70","a71","a72","a73","a74","a203","a75","a204","a76","a77","a78","a79","a81","a82","a83","a84","a97","a98","a99","a100","","a89","a90","a93","a94","a91","a92","a205","a85","a206","a86","a87","a88","a95","a96","","","","","","","","","","","","","","","","","","","","a101","a102","a103","a104","a106","a107","a108","a112","a111","a110","a109","a120","a121","a122","a123","a124","a125","a126","a127","a128","a129","a130","a131","a132","a133","a134","a135","a136","a137","a138","a139","a140","a141","a142","a143","a144","a145","a146","a147","a148","a149","a150","a151","a152","a153","a154","a155","a156","a157","a158","a159","a160","a161","a163","a164","a196","a165","a192","a166","a167","a168","a169","a170","a171","a172","a173","a162","a174","a175","a176","a177","a178","a179","a193","a180","a199","a181","a200","a182","","a201","a183","a184","a197","a185","a194","a198","a186","a195","a187","a188","a189","a190","a191",""];t.WinAnsiEncoding=s;t.StandardEncoding=o;t.MacRomanEncoding=n;t.SymbolSetEncoding=c;t.ZapfDingbatsEncoding=l;t.ExpertEncoding=a;t.getEncoding=function(e){switch(e){case"WinAnsiEncoding":return s;case"StandardEncoding":return o;case"MacRomanEncoding":return n;case"SymbolSetEncoding":return c;case"ZapfDingbatsEncoding":return l;case"ExpertEncoding":return a;case"MacExpertEncoding":return i;default:return null}}},function(e,t,r){var a=r(2).getLookupTableFactory,i=a(function(e){e.A=65;e.AE=198;e.AEacute=508;e.AEmacron=482;e.AEsmall=63462;e.Aacute=193;e.Aacutesmall=63457;e.Abreve=258;e.Abreveacute=7854;e.Abrevecyrillic=1232;e.Abrevedotbelow=7862;e.Abrevegrave=7856;e.Abrevehookabove=7858;e.Abrevetilde=7860;e.Acaron=461;e.Acircle=9398;e.Acircumflex=194;e.Acircumflexacute=7844;e.Acircumflexdotbelow=7852;e.Acircumflexgrave=7846;e.Acircumflexhookabove=7848;e.Acircumflexsmall=63458;e.Acircumflextilde=7850;e.Acute=63177;e.Acutesmall=63412;e.Acyrillic=1040;e.Adblgrave=512;e.Adieresis=196;e.Adieresiscyrillic=1234;e.Adieresismacron=478;e.Adieresissmall=63460;e.Adotbelow=7840;e.Adotmacron=480;e.Agrave=192;e.Agravesmall=63456;e.Ahookabove=7842;e.Aiecyrillic=1236;e.Ainvertedbreve=514;e.Alpha=913;e.Alphatonos=902;e.Amacron=256;e.Amonospace=65313;e.Aogonek=260;e.Aring=197;e.Aringacute=506;e.Aringbelow=7680;e.Aringsmall=63461;e.Asmall=63329;e.Atilde=195;e.Atildesmall=63459;e.Aybarmenian=1329;e.B=66;e.Bcircle=9399;e.Bdotaccent=7682;e.Bdotbelow=7684;e.Becyrillic=1041;e.Benarmenian=1330;e.Beta=914;e.Bhook=385;e.Blinebelow=7686;e.Bmonospace=65314;e.Brevesmall=63220;e.Bsmall=63330;e.Btopbar=386;e.C=67;e.Caarmenian=1342;e.Cacute=262;e.Caron=63178;e.Caronsmall=63221;e.Ccaron=268;e.Ccedilla=199;e.Ccedillaacute=7688;e.Ccedillasmall=63463;e.Ccircle=9400;e.Ccircumflex=264;e.Cdot=266;e.Cdotaccent=266;e.Cedillasmall=63416;e.Chaarmenian=1353;e.Cheabkhasiancyrillic=1212;e.Checyrillic=1063;e.Chedescenderabkhasiancyrillic=1214;e.Chedescendercyrillic=1206;e.Chedieresiscyrillic=1268;e.Cheharmenian=1347;e.Chekhakassiancyrillic=1227;e.Cheverticalstrokecyrillic=1208;e.Chi=935;e.Chook=391;e.Circumflexsmall=63222;e.Cmonospace=65315;e.Coarmenian=1361;e.Csmall=63331;e.D=68;e.DZ=497;e.DZcaron=452;e.Daarmenian=1332;e.Dafrican=393;e.Dcaron=270;e.Dcedilla=7696;e.Dcircle=9401;e.Dcircumflexbelow=7698;e.Dcroat=272;e.Ddotaccent=7690;e.Ddotbelow=7692;e.Decyrillic=1044;e.Deicoptic=1006;e.Delta=8710;e.Deltagreek=916;e.Dhook=394;e.Dieresis=63179;e.DieresisAcute=63180;e.DieresisGrave=63181;e.Dieresissmall=63400;e.Digammagreek=988;e.Djecyrillic=1026;e.Dlinebelow=7694;e.Dmonospace=65316;e.Dotaccentsmall=63223;e.Dslash=272;e.Dsmall=63332;e.Dtopbar=395;e.Dz=498;e.Dzcaron=453;e.Dzeabkhasiancyrillic=1248;e.Dzecyrillic=1029;e.Dzhecyrillic=1039;e.E=69;e.Eacute=201;e.Eacutesmall=63465;e.Ebreve=276;e.Ecaron=282;e.Ecedillabreve=7708;e.Echarmenian=1333;e.Ecircle=9402;e.Ecircumflex=202;e.Ecircumflexacute=7870;e.Ecircumflexbelow=7704;e.Ecircumflexdotbelow=7878;e.Ecircumflexgrave=7872;e.Ecircumflexhookabove=7874;e.Ecircumflexsmall=63466;e.Ecircumflextilde=7876;e.Ecyrillic=1028;e.Edblgrave=516;e.Edieresis=203;e.Edieresissmall=63467;e.Edot=278;e.Edotaccent=278;e.Edotbelow=7864;e.Efcyrillic=1060;e.Egrave=200;e.Egravesmall=63464;e.Eharmenian=1335;e.Ehookabove=7866;e.Eightroman=8551;e.Einvertedbreve=518;e.Eiotifiedcyrillic=1124;e.Elcyrillic=1051;e.Elevenroman=8554;e.Emacron=274;e.Emacronacute=7702;e.Emacrongrave=7700;e.Emcyrillic=1052;e.Emonospace=65317;e.Encyrillic=1053;e.Endescendercyrillic=1186;e.Eng=330;e.Enghecyrillic=1188;e.Enhookcyrillic=1223;e.Eogonek=280;e.Eopen=400;e.Epsilon=917;e.Epsilontonos=904;e.Ercyrillic=1056;e.Ereversed=398;e.Ereversedcyrillic=1069;e.Escyrillic=1057;e.Esdescendercyrillic=1194;e.Esh=425;e.Esmall=63333;e.Eta=919;e.Etarmenian=1336;e.Etatonos=905;e.Eth=208;e.Ethsmall=63472;e.Etilde=7868;e.Etildebelow=7706;e.Euro=8364;e.Ezh=439;e.Ezhcaron=494;e.Ezhreversed=440;e.F=70;e.Fcircle=9403;e.Fdotaccent=7710;e.Feharmenian=1366;e.Feicoptic=996;e.Fhook=401;e.Fitacyrillic=1138;e.Fiveroman=8548;e.Fmonospace=65318;e.Fourroman=8547;e.Fsmall=63334;e.G=71;e.GBsquare=13191;e.Gacute=500;e.Gamma=915;e.Gammaafrican=404;e.Gangiacoptic=1002;e.Gbreve=286;e.Gcaron=486;e.Gcedilla=290;e.Gcircle=9404;e.Gcircumflex=284;e.Gcommaaccent=290;e.Gdot=288;e.Gdotaccent=288;e.Gecyrillic=1043;e.Ghadarmenian=1346;e.Ghemiddlehookcyrillic=1172;e.Ghestrokecyrillic=1170;e.Gheupturncyrillic=1168;e.Ghook=403;e.Gimarmenian=1331;e.Gjecyrillic=1027;e.Gmacron=7712;e.Gmonospace=65319;e.Grave=63182;e.Gravesmall=63328;e.Gsmall=63335;e.Gsmallhook=667;e.Gstroke=484;e.H=72;e.H18533=9679;e.H18543=9642;e.H18551=9643;e.H22073=9633;e.HPsquare=13259;e.Haabkhasiancyrillic=1192;e.Hadescendercyrillic=1202;e.Hardsigncyrillic=1066;e.Hbar=294;e.Hbrevebelow=7722;e.Hcedilla=7720;e.Hcircle=9405;e.Hcircumflex=292;e.Hdieresis=7718;e.Hdotaccent=7714;e.Hdotbelow=7716;e.Hmonospace=65320;e.Hoarmenian=1344;e.Horicoptic=1e3;e.Hsmall=63336;e.Hungarumlaut=63183;e.Hungarumlautsmall=63224;e.Hzsquare=13200;e.I=73;e.IAcyrillic=1071;e.IJ=306;e.IUcyrillic=1070;e.Iacute=205;e.Iacutesmall=63469;e.Ibreve=300;e.Icaron=463;e.Icircle=9406;e.Icircumflex=206;e.Icircumflexsmall=63470;e.Icyrillic=1030;e.Idblgrave=520;e.Idieresis=207;e.Idieresisacute=7726;e.Idieresiscyrillic=1252;e.Idieresissmall=63471;e.Idot=304;e.Idotaccent=304;e.Idotbelow=7882;e.Iebrevecyrillic=1238;e.Iecyrillic=1045;e.Ifraktur=8465;e.Igrave=204;e.Igravesmall=63468;e.Ihookabove=7880;e.Iicyrillic=1048;e.Iinvertedbreve=522;e.Iishortcyrillic=1049;e.Imacron=298;e.Imacroncyrillic=1250;e.Imonospace=65321;e.Iniarmenian=1339;e.Iocyrillic=1025;e.Iogonek=302;e.Iota=921;e.Iotaafrican=406;e.Iotadieresis=938;e.Iotatonos=906;e.Ismall=63337;e.Istroke=407;e.Itilde=296;e.Itildebelow=7724;e.Izhitsacyrillic=1140;e.Izhitsadblgravecyrillic=1142;e.J=74;e.Jaarmenian=1345;e.Jcircle=9407;e.Jcircumflex=308;e.Jecyrillic=1032;e.Jheharmenian=1355;e.Jmonospace=65322;e.Jsmall=63338;e.K=75;e.KBsquare=13189;e.KKsquare=13261;e.Kabashkircyrillic=1184;e.Kacute=7728;e.Kacyrillic=1050;e.Kadescendercyrillic=1178;e.Kahookcyrillic=1219;e.Kappa=922;e.Kastrokecyrillic=1182;e.Kaverticalstrokecyrillic=1180;e.Kcaron=488;e.Kcedilla=310;e.Kcircle=9408;e.Kcommaaccent=310;e.Kdotbelow=7730;e.Keharmenian=1364;e.Kenarmenian=1343;e.Khacyrillic=1061;e.Kheicoptic=998;e.Khook=408;e.Kjecyrillic=1036;e.Klinebelow=7732;e.Kmonospace=65323;e.Koppacyrillic=1152;e.Koppagreek=990;e.Ksicyrillic=1134;e.Ksmall=63339;e.L=76;e.LJ=455;e.LL=63167;e.Lacute=313;e.Lambda=923;e.Lcaron=317;e.Lcedilla=315;e.Lcircle=9409;e.Lcircumflexbelow=7740;e.Lcommaaccent=315;e.Ldot=319;e.Ldotaccent=319;e.Ldotbelow=7734;e.Ldotbelowmacron=7736;e.Liwnarmenian=1340;e.Lj=456;e.Ljecyrillic=1033;e.Llinebelow=7738;e.Lmonospace=65324;e.Lslash=321;e.Lslashsmall=63225;e.Lsmall=63340;e.M=77;e.MBsquare=13190;e.Macron=63184;e.Macronsmall=63407;e.Macute=7742;e.Mcircle=9410;e.Mdotaccent=7744;e.Mdotbelow=7746;e.Menarmenian=1348;e.Mmonospace=65325;e.Msmall=63341;e.Mturned=412;e.Mu=924;e.N=78;e.NJ=458;e.Nacute=323;e.Ncaron=327;e.Ncedilla=325;e.Ncircle=9411;e.Ncircumflexbelow=7754;e.Ncommaaccent=325;e.Ndotaccent=7748;e.Ndotbelow=7750;e.Nhookleft=413;e.Nineroman=8552;e.Nj=459;e.Njecyrillic=1034;e.Nlinebelow=7752;e.Nmonospace=65326;e.Nowarmenian=1350;e.Nsmall=63342;e.Ntilde=209;e.Ntildesmall=63473;e.Nu=925;e.O=79;e.OE=338;e.OEsmall=63226;e.Oacute=211;e.Oacutesmall=63475;e.Obarredcyrillic=1256;e.Obarreddieresiscyrillic=1258;e.Obreve=334;e.Ocaron=465;e.Ocenteredtilde=415;e.Ocircle=9412;e.Ocircumflex=212;e.Ocircumflexacute=7888;e.Ocircumflexdotbelow=7896;e.Ocircumflexgrave=7890;e.Ocircumflexhookabove=7892;e.Ocircumflexsmall=63476;e.Ocircumflextilde=7894;e.Ocyrillic=1054;e.Odblacute=336;e.Odblgrave=524;e.Odieresis=214;e.Odieresiscyrillic=1254;e.Odieresissmall=63478;e.Odotbelow=7884;e.Ogoneksmall=63227;e.Ograve=210;e.Ogravesmall=63474;e.Oharmenian=1365;e.Ohm=8486;e.Ohookabove=7886;e.Ohorn=416;e.Ohornacute=7898;e.Ohorndotbelow=7906;e.Ohorngrave=7900;e.Ohornhookabove=7902;e.Ohorntilde=7904;e.Ohungarumlaut=336;e.Oi=418;e.Oinvertedbreve=526;e.Omacron=332;e.Omacronacute=7762;e.Omacrongrave=7760;e.Omega=8486;e.Omegacyrillic=1120;e.Omegagreek=937;e.Omegaroundcyrillic=1146;e.Omegatitlocyrillic=1148;e.Omegatonos=911;e.Omicron=927;e.Omicrontonos=908;e.Omonospace=65327;e.Oneroman=8544;e.Oogonek=490;e.Oogonekmacron=492;e.Oopen=390;e.Oslash=216;e.Oslashacute=510;e.Oslashsmall=63480;e.Osmall=63343;e.Ostrokeacute=510;e.Otcyrillic=1150;e.Otilde=213;e.Otildeacute=7756;e.Otildedieresis=7758;e.Otildesmall=63477;e.P=80;e.Pacute=7764;e.Pcircle=9413;e.Pdotaccent=7766;e.Pecyrillic=1055;e.Peharmenian=1354;e.Pemiddlehookcyrillic=1190;e.Phi=934;e.Phook=420;e.Pi=928;e.Piwrarmenian=1363;e.Pmonospace=65328;e.Psi=936;e.Psicyrillic=1136;e.Psmall=63344;e.Q=81;e.Qcircle=9414;e.Qmonospace=65329;e.Qsmall=63345;e.R=82;e.Raarmenian=1356;e.Racute=340;e.Rcaron=344;e.Rcedilla=342;e.Rcircle=9415;e.Rcommaaccent=342;e.Rdblgrave=528;e.Rdotaccent=7768;e.Rdotbelow=7770;e.Rdotbelowmacron=7772;e.Reharmenian=1360;e.Rfraktur=8476;e.Rho=929;e.Ringsmall=63228;e.Rinvertedbreve=530;e.Rlinebelow=7774;e.Rmonospace=65330;e.Rsmall=63346;e.Rsmallinverted=641;e.Rsmallinvertedsuperior=694;e.S=83;e.SF010000=9484;e.SF020000=9492;e.SF030000=9488;e.SF040000=9496;e.SF050000=9532;e.SF060000=9516;e.SF070000=9524;e.SF080000=9500;e.SF090000=9508;e.SF100000=9472;e.SF110000=9474;e.SF190000=9569;e.SF200000=9570;e.SF210000=9558;e.SF220000=9557;e.SF230000=9571;e.SF240000=9553;e.SF250000=9559;e.SF260000=9565;e.SF270000=9564;e.SF280000=9563;e.SF360000=9566;e.SF370000=9567;e.SF380000=9562;e.SF390000=9556;e.SF400000=9577;e.SF410000=9574;e.SF420000=9568;e.SF430000=9552;e.SF440000=9580;e.SF450000=9575;e.SF460000=9576;e.SF470000=9572;e.SF480000=9573;e.SF490000=9561;e.SF500000=9560;e.SF510000=9554;e.SF520000=9555;e.SF530000=9579;e.SF540000=9578;e.Sacute=346;e.Sacutedotaccent=7780;e.Sampigreek=992;e.Scaron=352;e.Scarondotaccent=7782;e.Scaronsmall=63229;e.Scedilla=350;e.Schwa=399;e.Schwacyrillic=1240;e.Schwadieresiscyrillic=1242;e.Scircle=9416;e.Scircumflex=348;e.Scommaaccent=536;e.Sdotaccent=7776;e.Sdotbelow=7778;e.Sdotbelowdotaccent=7784;e.Seharmenian=1357;e.Sevenroman=8550;e.Shaarmenian=1351;e.Shacyrillic=1064;e.Shchacyrillic=1065;e.Sheicoptic=994;e.Shhacyrillic=1210;e.Shimacoptic=1004;e.Sigma=931;e.Sixroman=8549;e.Smonospace=65331;e.Softsigncyrillic=1068;e.Ssmall=63347;e.Stigmagreek=986;e.T=84;e.Tau=932;e.Tbar=358;e.Tcaron=356;e.Tcedilla=354;e.Tcircle=9417;e.Tcircumflexbelow=7792;e.Tcommaaccent=354;e.Tdotaccent=7786;e.Tdotbelow=7788;e.Tecyrillic=1058;e.Tedescendercyrillic=1196;e.Tenroman=8553;e.Tetsecyrillic=1204;e.Theta=920;e.Thook=428;e.Thorn=222;e.Thornsmall=63486;e.Threeroman=8546;e.Tildesmall=63230;e.Tiwnarmenian=1359;e.Tlinebelow=7790;e.Tmonospace=65332;e.Toarmenian=1337;e.Tonefive=444;e.Tonesix=388;e.Tonetwo=423;e.Tretroflexhook=430;e.Tsecyrillic=1062;e.Tshecyrillic=1035;e.Tsmall=63348;e.Twelveroman=8555;e.Tworoman=8545;e.U=85;e.Uacute=218;e.Uacutesmall=63482;e.Ubreve=364;e.Ucaron=467;e.Ucircle=9418;e.Ucircumflex=219;e.Ucircumflexbelow=7798;e.Ucircumflexsmall=63483;e.Ucyrillic=1059;e.Udblacute=368;e.Udblgrave=532;e.Udieresis=220;e.Udieresisacute=471;e.Udieresisbelow=7794;e.Udieresiscaron=473;e.Udieresiscyrillic=1264;e.Udieresisgrave=475;e.Udieresismacron=469;e.Udieresissmall=63484;e.Udotbelow=7908;e.Ugrave=217;e.Ugravesmall=63481;e.Uhookabove=7910;e.Uhorn=431;e.Uhornacute=7912;e.Uhorndotbelow=7920;e.Uhorngrave=7914;e.Uhornhookabove=7916;e.Uhorntilde=7918;e.Uhungarumlaut=368;e.Uhungarumlautcyrillic=1266;e.Uinvertedbreve=534;e.Ukcyrillic=1144;e.Umacron=362;e.Umacroncyrillic=1262;e.Umacrondieresis=7802;e.Umonospace=65333;e.Uogonek=370;e.Upsilon=933;e.Upsilon1=978;e.Upsilonacutehooksymbolgreek=979;e.Upsilonafrican=433;e.Upsilondieresis=939;e.Upsilondieresishooksymbolgreek=980;e.Upsilonhooksymbol=978;e.Upsilontonos=910;e.Uring=366;e.Ushortcyrillic=1038;e.Usmall=63349;e.Ustraightcyrillic=1198;e.Ustraightstrokecyrillic=1200;e.Utilde=360;e.Utildeacute=7800;e.Utildebelow=7796;e.V=86;e.Vcircle=9419;e.Vdotbelow=7806;e.Vecyrillic=1042;e.Vewarmenian=1358;e.Vhook=434;e.Vmonospace=65334;e.Voarmenian=1352;e.Vsmall=63350;e.Vtilde=7804;e.W=87;e.Wacute=7810;e.Wcircle=9420;e.Wcircumflex=372;e.Wdieresis=7812;e.Wdotaccent=7814;e.Wdotbelow=7816;e.Wgrave=7808;e.Wmonospace=65335;e.Wsmall=63351;e.X=88;e.Xcircle=9421;e.Xdieresis=7820;e.Xdotaccent=7818;e.Xeharmenian=1341;e.Xi=926;e.Xmonospace=65336;e.Xsmall=63352;e.Y=89;e.Yacute=221;e.Yacutesmall=63485;e.Yatcyrillic=1122;e.Ycircle=9422;e.Ycircumflex=374;e.Ydieresis=376;e.Ydieresissmall=63487;e.Ydotaccent=7822;e.Ydotbelow=7924;e.Yericyrillic=1067;e.Yerudieresiscyrillic=1272;e.Ygrave=7922;e.Yhook=435;e.Yhookabove=7926;e.Yiarmenian=1349;e.Yicyrillic=1031;e.Yiwnarmenian=1362;e.Ymonospace=65337;e.Ysmall=63353;e.Ytilde=7928;e.Yusbigcyrillic=1130;e.Yusbigiotifiedcyrillic=1132;e.Yuslittlecyrillic=1126;e.Yuslittleiotifiedcyrillic=1128;e.Z=90;e.Zaarmenian=1334;e.Zacute=377;e.Zcaron=381;e.Zcaronsmall=63231;e.Zcircle=9423;e.Zcircumflex=7824;e.Zdot=379;e.Zdotaccent=379;e.Zdotbelow=7826;e.Zecyrillic=1047;e.Zedescendercyrillic=1176;e.Zedieresiscyrillic=1246;e.Zeta=918;e.Zhearmenian=1338;e.Zhebrevecyrillic=1217;e.Zhecyrillic=1046;e.Zhedescendercyrillic=1174;e.Zhedieresiscyrillic=1244;e.Zlinebelow=7828;e.Zmonospace=65338;e.Zsmall=63354;e.Zstroke=437;e.a=97;e.aabengali=2438;e.aacute=225;e.aadeva=2310;e.aagujarati=2694;e.aagurmukhi=2566;e.aamatragurmukhi=2622;e.aarusquare=13059;e.aavowelsignbengali=2494;e.aavowelsigndeva=2366;e.aavowelsigngujarati=2750;e.abbreviationmarkarmenian=1375;e.abbreviationsigndeva=2416;e.abengali=2437;e.abopomofo=12570;e.abreve=259;e.abreveacute=7855;e.abrevecyrillic=1233;e.abrevedotbelow=7863;e.abrevegrave=7857;e.abrevehookabove=7859;e.abrevetilde=7861;e.acaron=462;e.acircle=9424;e.acircumflex=226;e.acircumflexacute=7845;e.acircumflexdotbelow=7853;e.acircumflexgrave=7847;e.acircumflexhookabove=7849;e.acircumflextilde=7851;e.acute=180;e.acutebelowcmb=791;e.acutecmb=769;e.acutecomb=769;e.acutedeva=2388;e.acutelowmod=719;e.acutetonecmb=833;e.acyrillic=1072;e.adblgrave=513;e.addakgurmukhi=2673;e.adeva=2309;e.adieresis=228;e.adieresiscyrillic=1235;e.adieresismacron=479;e.adotbelow=7841;e.adotmacron=481;e.ae=230;e.aeacute=509;e.aekorean=12624;e.aemacron=483;e.afii00208=8213;e.afii08941=8356;e.afii10017=1040;e.afii10018=1041;e.afii10019=1042;e.afii10020=1043;e.afii10021=1044;e.afii10022=1045;e.afii10023=1025;e.afii10024=1046;e.afii10025=1047;e.afii10026=1048;e.afii10027=1049;e.afii10028=1050;e.afii10029=1051;e.afii10030=1052;e.afii10031=1053;e.afii10032=1054;e.afii10033=1055;e.afii10034=1056;e.afii10035=1057;e.afii10036=1058;e.afii10037=1059;e.afii10038=1060;e.afii10039=1061;e.afii10040=1062;e.afii10041=1063;e.afii10042=1064;e.afii10043=1065;e.afii10044=1066;e.afii10045=1067;e.afii10046=1068;e.afii10047=1069;e.afii10048=1070;e.afii10049=1071;e.afii10050=1168;e.afii10051=1026;e.afii10052=1027;e.afii10053=1028;e.afii10054=1029;e.afii10055=1030;e.afii10056=1031;e.afii10057=1032;e.afii10058=1033;e.afii10059=1034;e.afii10060=1035;e.afii10061=1036;e.afii10062=1038;e.afii10063=63172;e.afii10064=63173;e.afii10065=1072;e.afii10066=1073;e.afii10067=1074;e.afii10068=1075;e.afii10069=1076;e.afii10070=1077;e.afii10071=1105;e.afii10072=1078;e.afii10073=1079;e.afii10074=1080;e.afii10075=1081;e.afii10076=1082;e.afii10077=1083;e.afii10078=1084;e.afii10079=1085;e.afii10080=1086;e.afii10081=1087;e.afii10082=1088;e.afii10083=1089;e.afii10084=1090;e.afii10085=1091;e.afii10086=1092;e.afii10087=1093;e.afii10088=1094;e.afii10089=1095;e.afii10090=1096;e.afii10091=1097;e.afii10092=1098;e.afii10093=1099;e.afii10094=1100;e.afii10095=1101;e.afii10096=1102;e.afii10097=1103;e.afii10098=1169;e.afii10099=1106;e.afii10100=1107;e.afii10101=1108;e.afii10102=1109;e.afii10103=1110;e.afii10104=1111;e.afii10105=1112;e.afii10106=1113;e.afii10107=1114;e.afii10108=1115;e.afii10109=1116;e.afii10110=1118;e.afii10145=1039;e.afii10146=1122;e.afii10147=1138;e.afii10148=1140;e.afii10192=63174;e.afii10193=1119;e.afii10194=1123;e.afii10195=1139;e.afii10196=1141;e.afii10831=63175;e.afii10832=63176;e.afii10846=1241;e.afii299=8206;e.afii300=8207;e.afii301=8205;e.afii57381=1642;e.afii57388=1548;e.afii57392=1632;e.afii57393=1633;e.afii57394=1634;e.afii57395=1635;e.afii57396=1636;e.afii57397=1637;e.afii57398=1638;e.afii57399=1639;e.afii57400=1640;e.afii57401=1641;e.afii57403=1563;e.afii57407=1567;e.afii57409=1569;e.afii57410=1570;e.afii57411=1571;e.afii57412=1572;e.afii57413=1573;e.afii57414=1574;e.afii57415=1575;e.afii57416=1576;e.afii57417=1577;e.afii57418=1578;e.afii57419=1579;e.afii57420=1580;e.afii57421=1581;e.afii57422=1582;e.afii57423=1583;e.afii57424=1584;e.afii57425=1585;e.afii57426=1586;e.afii57427=1587;e.afii57428=1588;e.afii57429=1589;e.afii57430=1590;e.afii57431=1591;e.afii57432=1592;e.afii57433=1593;e.afii57434=1594;e.afii57440=1600;e.afii57441=1601;e.afii57442=1602;e.afii57443=1603;e.afii57444=1604;e.afii57445=1605;e.afii57446=1606;e.afii57448=1608;e.afii57449=1609;e.afii57450=1610;e.afii57451=1611;e.afii57452=1612;e.afii57453=1613;e.afii57454=1614;e.afii57455=1615;e.afii57456=1616;e.afii57457=1617;e.afii57458=1618;e.afii57470=1607;e.afii57505=1700;e.afii57506=1662;e.afii57507=1670;e.afii57508=1688;e.afii57509=1711;e.afii57511=1657;e.afii57512=1672;e.afii57513=1681;e.afii57514=1722;e.afii57519=1746;e.afii57534=1749;e.afii57636=8362;e.afii57645=1470;e.afii57658=1475;e.afii57664=1488;e.afii57665=1489;e.afii57666=1490;e.afii57667=1491;e.afii57668=1492;e.afii57669=1493;e.afii57670=1494;e.afii57671=1495;e.afii57672=1496;e.afii57673=1497;e.afii57674=1498;e.afii57675=1499;e.afii57676=1500;e.afii57677=1501;e.afii57678=1502;e.afii57679=1503;e.afii57680=1504;e.afii57681=1505;e.afii57682=1506;e.afii57683=1507;e.afii57684=1508;e.afii57685=1509;e.afii57686=1510;e.afii57687=1511;e.afii57688=1512;e.afii57689=1513;e.afii57690=1514;e.afii57694=64298;e.afii57695=64299;e.afii57700=64331;e.afii57705=64287;e.afii57716=1520;e.afii57717=1521;e.afii57718=1522;e.afii57723=64309;e.afii57793=1460;e.afii57794=1461;e.afii57795=1462;e.afii57796=1467;e.afii57797=1464;e.afii57798=1463;e.afii57799=1456;e.afii57800=1458;e.afii57801=1457;e.afii57802=1459;e.afii57803=1474;e.afii57804=1473;e.afii57806=1465;e.afii57807=1468;e.afii57839=1469;e.afii57841=1471;e.afii57842=1472;e.afii57929=700;e.afii61248=8453;e.afii61289=8467;e.afii61352=8470;e.afii61573=8236;e.afii61574=8237;e.afii61575=8238;e.afii61664=8204;e.afii63167=1645;e.afii64937=701;e.agrave=224;e.agujarati=2693;e.agurmukhi=2565;e.ahiragana=12354;e.ahookabove=7843;e.aibengali=2448;e.aibopomofo=12574;e.aideva=2320;e.aiecyrillic=1237;e.aigujarati=2704;e.aigurmukhi=2576;e.aimatragurmukhi=2632;e.ainarabic=1593;e.ainfinalarabic=65226;e.aininitialarabic=65227;e.ainmedialarabic=65228;e.ainvertedbreve=515;e.aivowelsignbengali=2504;e.aivowelsigndeva=2376;e.aivowelsigngujarati=2760;e.akatakana=12450;e.akatakanahalfwidth=65393;e.akorean=12623;e.alef=1488;e.alefarabic=1575;e.alefdageshhebrew=64304;e.aleffinalarabic=65166;e.alefhamzaabovearabic=1571;e.alefhamzaabovefinalarabic=65156;e.alefhamzabelowarabic=1573;e.alefhamzabelowfinalarabic=65160;e.alefhebrew=1488;e.aleflamedhebrew=64335;e.alefmaddaabovearabic=1570;e.alefmaddaabovefinalarabic=65154;e.alefmaksuraarabic=1609;e.alefmaksurafinalarabic=65264;e.alefmaksurainitialarabic=65267;e.alefmaksuramedialarabic=65268;e.alefpatahhebrew=64302;e.alefqamatshebrew=64303;e.aleph=8501;e.allequal=8780;e.alpha=945;e.alphatonos=940;e.amacron=257;e.amonospace=65345;e.ampersand=38;e.ampersandmonospace=65286;e.ampersandsmall=63270;e.amsquare=13250;e.anbopomofo=12578;e.angbopomofo=12580;e.angbracketleft=12296;e.angbracketright=12297;e.angkhankhuthai=3674;e.angle=8736;e.anglebracketleft=12296;e.anglebracketleftvertical=65087;e.anglebracketright=12297;e.anglebracketrightvertical=65088;e.angleleft=9001;e.angleright=9002;e.angstrom=8491;e.anoteleia=903;e.anudattadeva=2386;e.anusvarabengali=2434;e.anusvaradeva=2306;e.anusvaragujarati=2690;e.aogonek=261;e.apaatosquare=13056;e.aparen=9372;e.apostrophearmenian=1370;e.apostrophemod=700;e.apple=63743;e.approaches=8784;e.approxequal=8776;e.approxequalorimage=8786;e.approximatelyequal=8773;e.araeaekorean=12686;e.araeakorean=12685;e.arc=8978;e.arighthalfring=7834;e.aring=229;e.aringacute=507;e.aringbelow=7681;e.arrowboth=8596;e.arrowdashdown=8675;e.arrowdashleft=8672;e.arrowdashright=8674;e.arrowdashup=8673;e.arrowdblboth=8660;e.arrowdbldown=8659;e.arrowdblleft=8656;e.arrowdblright=8658;e.arrowdblup=8657;e.arrowdown=8595;e.arrowdownleft=8601;e.arrowdownright=8600;e.arrowdownwhite=8681;e.arrowheaddownmod=709;e.arrowheadleftmod=706;e.arrowheadrightmod=707;e.arrowheadupmod=708;e.arrowhorizex=63719;e.arrowleft=8592;e.arrowleftdbl=8656;e.arrowleftdblstroke=8653;e.arrowleftoverright=8646;e.arrowleftwhite=8678;e.arrowright=8594;e.arrowrightdblstroke=8655;e.arrowrightheavy=10142;e.arrowrightoverleft=8644;e.arrowrightwhite=8680;e.arrowtableft=8676;e.arrowtabright=8677;e.arrowup=8593;e.arrowupdn=8597;e.arrowupdnbse=8616;e.arrowupdownbase=8616;e.arrowupleft=8598;e.arrowupleftofdown=8645;e.arrowupright=8599;e.arrowupwhite=8679;e.arrowvertex=63718;e.asciicircum=94;e.asciicircummonospace=65342;e.asciitilde=126;e.asciitildemonospace=65374;e.ascript=593;e.ascriptturned=594;e.asmallhiragana=12353;e.asmallkatakana=12449;e.asmallkatakanahalfwidth=65383;e.asterisk=42;e.asteriskaltonearabic=1645;e.asteriskarabic=1645;e.asteriskmath=8727;e.asteriskmonospace=65290;e.asterisksmall=65121;e.asterism=8258;e.asuperior=63209;e.asymptoticallyequal=8771;e.at=64;e.atilde=227;e.atmonospace=65312;e.atsmall=65131;e.aturned=592;e.aubengali=2452;e.aubopomofo=12576;e.audeva=2324;e.augujarati=2708;e.augurmukhi=2580;e.aulengthmarkbengali=2519;e.aumatragurmukhi=2636;e.auvowelsignbengali=2508;e.auvowelsigndeva=2380;e.auvowelsigngujarati=2764;e.avagrahadeva=2365;e.aybarmenian=1377;e.ayin=1506;e.ayinaltonehebrew=64288;e.ayinhebrew=1506;e.b=98;e.babengali=2476;e.backslash=92;e.backslashmonospace=65340;e.badeva=2348;e.bagujarati=2732;e.bagurmukhi=2604;e.bahiragana=12400;e.bahtthai=3647;e.bakatakana=12496;e.bar=124;e.barmonospace=65372;e.bbopomofo=12549;e.bcircle=9425;e.bdotaccent=7683;e.bdotbelow=7685;e.beamedsixteenthnotes=9836;e.because=8757;e.becyrillic=1073;e.beharabic=1576;e.behfinalarabic=65168;e.behinitialarabic=65169;e.behiragana=12409;e.behmedialarabic=65170;e.behmeeminitialarabic=64671;e.behmeemisolatedarabic=64520;e.behnoonfinalarabic=64621;e.bekatakana=12505;e.benarmenian=1378;e.bet=1489;e.beta=946;e.betasymbolgreek=976;e.betdagesh=64305;e.betdageshhebrew=64305;e.bethebrew=1489;e.betrafehebrew=64332;e.bhabengali=2477;e.bhadeva=2349;e.bhagujarati=2733;e.bhagurmukhi=2605;e.bhook=595;e.bihiragana=12403;e.bikatakana=12499;e.bilabialclick=664;e.bindigurmukhi=2562;e.birusquare=13105;e.blackcircle=9679;e.blackdiamond=9670;e.blackdownpointingtriangle=9660;e.blackleftpointingpointer=9668;e.blackleftpointingtriangle=9664;e.blacklenticularbracketleft=12304;e.blacklenticularbracketleftvertical=65083;e.blacklenticularbracketright=12305;e.blacklenticularbracketrightvertical=65084;e.blacklowerlefttriangle=9699;e.blacklowerrighttriangle=9698;e.blackrectangle=9644;e.blackrightpointingpointer=9658;e.blackrightpointingtriangle=9654;e.blacksmallsquare=9642;e.blacksmilingface=9787;e.blacksquare=9632;e.blackstar=9733;e.blackupperlefttriangle=9700;e.blackupperrighttriangle=9701;e.blackuppointingsmalltriangle=9652;e.blackuppointingtriangle=9650;e.blank=9251;e.blinebelow=7687;e.block=9608;e.bmonospace=65346;e.bobaimaithai=3610;e.bohiragana=12412;e.bokatakana=12508;e.bparen=9373;e.bqsquare=13251;e.braceex=63732;e.braceleft=123;e.braceleftbt=63731;e.braceleftmid=63730;e.braceleftmonospace=65371;e.braceleftsmall=65115;e.bracelefttp=63729;e.braceleftvertical=65079;e.braceright=125;e.bracerightbt=63742;e.bracerightmid=63741;e.bracerightmonospace=65373;e.bracerightsmall=65116;e.bracerighttp=63740;e.bracerightvertical=65080;e.bracketleft=91;e.bracketleftbt=63728;e.bracketleftex=63727;e.bracketleftmonospace=65339;e.bracketlefttp=63726;e.bracketright=93;e.bracketrightbt=63739;e.bracketrightex=63738;e.bracketrightmonospace=65341;e.bracketrighttp=63737;e.breve=728;e.brevebelowcmb=814;e.brevecmb=774;e.breveinvertedbelowcmb=815;e.breveinvertedcmb=785;e.breveinverteddoublecmb=865;e.bridgebelowcmb=810;e.bridgeinvertedbelowcmb=826;e.brokenbar=166;e.bstroke=384;e.bsuperior=63210;e.btopbar=387;e.buhiragana=12406;e.bukatakana=12502;e.bullet=8226;e.bulletinverse=9688;e.bulletoperator=8729;e.bullseye=9678;e.c=99;e.caarmenian=1390;e.cabengali=2458;e.cacute=263;e.cadeva=2330;e.cagujarati=2714;e.cagurmukhi=2586;e.calsquare=13192;e.candrabindubengali=2433;e.candrabinducmb=784;e.candrabindudeva=2305;e.candrabindugujarati=2689;e.capslock=8682;e.careof=8453;e.caron=711;e.caronbelowcmb=812;e.caroncmb=780;e.carriagereturn=8629;e.cbopomofo=12568;e.ccaron=269;e.ccedilla=231;e.ccedillaacute=7689;e.ccircle=9426;e.ccircumflex=265;e.ccurl=597;e.cdot=267;e.cdotaccent=267;e.cdsquare=13253;e.cedilla=184;e.cedillacmb=807;e.cent=162;e.centigrade=8451;e.centinferior=63199;e.centmonospace=65504;e.centoldstyle=63394;e.centsuperior=63200;e.chaarmenian=1401;e.chabengali=2459;e.chadeva=2331;e.chagujarati=2715;e.chagurmukhi=2587;e.chbopomofo=12564;e.cheabkhasiancyrillic=1213;e.checkmark=10003;e.checyrillic=1095;e.chedescenderabkhasiancyrillic=1215;e.chedescendercyrillic=1207;e.chedieresiscyrillic=1269;e.cheharmenian=1395;e.chekhakassiancyrillic=1228;e.cheverticalstrokecyrillic=1209;e.chi=967;e.chieuchacirclekorean=12919;e.chieuchaparenkorean=12823;e.chieuchcirclekorean=12905;e.chieuchkorean=12618;e.chieuchparenkorean=12809;e.chochangthai=3594;e.chochanthai=3592;e.chochingthai=3593;e.chochoethai=3596;e.chook=392;e.cieucacirclekorean=12918;e.cieucaparenkorean=12822;e.cieuccirclekorean=12904;e.cieuckorean=12616;e.cieucparenkorean=12808;e.cieucuparenkorean=12828;e.circle=9675;e.circlecopyrt=169;e.circlemultiply=8855;e.circleot=8857;e.circleplus=8853;e.circlepostalmark=12342;e.circlewithlefthalfblack=9680;e.circlewithrighthalfblack=9681;e.circumflex=710;e.circumflexbelowcmb=813;e.circumflexcmb=770;e.clear=8999;e.clickalveolar=450;e.clickdental=448;e.clicklateral=449;e.clickretroflex=451;e.club=9827;e.clubsuitblack=9827;e.clubsuitwhite=9831;e.cmcubedsquare=13220;e.cmonospace=65347;e.cmsquaredsquare=13216;e.coarmenian=1409;e.colon=58;e.colonmonetary=8353;e.colonmonospace=65306;e.colonsign=8353;e.colonsmall=65109;e.colontriangularhalfmod=721;e.colontriangularmod=720;e.comma=44;e.commaabovecmb=787;e.commaaboverightcmb=789;e.commaaccent=63171;e.commaarabic=1548;e.commaarmenian=1373;e.commainferior=63201;e.commamonospace=65292;e.commareversedabovecmb=788;e.commareversedmod=701;e.commasmall=65104;e.commasuperior=63202;e.commaturnedabovecmb=786;e.commaturnedmod=699;e.compass=9788;e.congruent=8773;e.contourintegral=8750;e.control=8963;e.controlACK=6;e.controlBEL=7;e.controlBS=8;e.controlCAN=24;e.controlCR=13;e.controlDC1=17;e.controlDC2=18;e.controlDC3=19;e.controlDC4=20;e.controlDEL=127;e.controlDLE=16;e.controlEM=25;e.controlENQ=5;e.controlEOT=4;e.controlESC=27;e.controlETB=23;e.controlETX=3;e.controlFF=12;e.controlFS=28;e.controlGS=29;e.controlHT=9;e.controlLF=10;e.controlNAK=21;e.controlNULL=0;e.controlRS=30;e.controlSI=15;e.controlSO=14;e.controlSOT=2;e.controlSTX=1;e.controlSUB=26;e.controlSYN=22;e.controlUS=31;e.controlVT=11;e.copyright=169;e.copyrightsans=63721;e.copyrightserif=63193;e.cornerbracketleft=12300;e.cornerbracketlefthalfwidth=65378;e.cornerbracketleftvertical=65089;e.cornerbracketright=12301;e.cornerbracketrighthalfwidth=65379;e.cornerbracketrightvertical=65090;e.corporationsquare=13183;e.cosquare=13255;e.coverkgsquare=13254;e.cparen=9374;e.cruzeiro=8354;e.cstretched=663;e.curlyand=8911;e.curlyor=8910;e.currency=164;e.cyrBreve=63185;e.cyrFlex=63186;e.cyrbreve=63188;e.cyrflex=63189;e.d=100;e.daarmenian=1380;e.dabengali=2470;e.dadarabic=1590;e.dadeva=2342;e.dadfinalarabic=65214;e.dadinitialarabic=65215;e.dadmedialarabic=65216;e.dagesh=1468;e.dageshhebrew=1468;e.dagger=8224;e.daggerdbl=8225;e.dagujarati=2726;e.dagurmukhi=2598;e.dahiragana=12384;e.dakatakana=12480;e.dalarabic=1583;e.dalet=1491;e.daletdagesh=64307;e.daletdageshhebrew=64307;e.dalethebrew=1491;e.dalfinalarabic=65194;e.dammaarabic=1615;e.dammalowarabic=1615;e.dammatanaltonearabic=1612;e.dammatanarabic=1612;e.danda=2404;e.dargahebrew=1447;e.dargalefthebrew=1447;e.dasiapneumatacyrilliccmb=1157;e.dblGrave=63187;e.dblanglebracketleft=12298;e.dblanglebracketleftvertical=65085;e.dblanglebracketright=12299;e.dblanglebracketrightvertical=65086;e.dblarchinvertedbelowcmb=811;e.dblarrowleft=8660;e.dblarrowright=8658;e.dbldanda=2405;e.dblgrave=63190;e.dblgravecmb=783;e.dblintegral=8748;e.dbllowline=8215;e.dbllowlinecmb=819;e.dbloverlinecmb=831;e.dblprimemod=698;e.dblverticalbar=8214;e.dblverticallineabovecmb=782;e.dbopomofo=12553;e.dbsquare=13256;e.dcaron=271;e.dcedilla=7697;e.dcircle=9427;e.dcircumflexbelow=7699;e.dcroat=273;e.ddabengali=2465;e.ddadeva=2337;e.ddagujarati=2721;e.ddagurmukhi=2593;e.ddalarabic=1672;e.ddalfinalarabic=64393;e.dddhadeva=2396;e.ddhabengali=2466;e.ddhadeva=2338;e.ddhagujarati=2722;e.ddhagurmukhi=2594;e.ddotaccent=7691;e.ddotbelow=7693;e.decimalseparatorarabic=1643;e.decimalseparatorpersian=1643;e.decyrillic=1076;e.degree=176;e.dehihebrew=1453;e.dehiragana=12391;e.deicoptic=1007;e.dekatakana=12487;e.deleteleft=9003;e.deleteright=8998;e.delta=948;e.deltaturned=397;e.denominatorminusonenumeratorbengali=2552;e.dezh=676;e.dhabengali=2471;e.dhadeva=2343;e.dhagujarati=2727;e.dhagurmukhi=2599;e.dhook=599;e.dialytikatonos=901;e.dialytikatonoscmb=836;e.diamond=9830;e.diamondsuitwhite=9826;e.dieresis=168;e.dieresisacute=63191;e.dieresisbelowcmb=804;e.dieresiscmb=776;e.dieresisgrave=63192;e.dieresistonos=901;e.dihiragana=12386;e.dikatakana=12482;e.dittomark=12291;e.divide=247;e.divides=8739;e.divisionslash=8725;e.djecyrillic=1106;e.dkshade=9619;e.dlinebelow=7695;e.dlsquare=13207;e.dmacron=273;e.dmonospace=65348;e.dnblock=9604;e.dochadathai=3598;e.dodekthai=3604;e.dohiragana=12393;e.dokatakana=12489;e.dollar=36;e.dollarinferior=63203;e.dollarmonospace=65284;e.dollaroldstyle=63268;e.dollarsmall=65129;e.dollarsuperior=63204;e.dong=8363;e.dorusquare=13094;e.dotaccent=729;e.dotaccentcmb=775;e.dotbelowcmb=803;e.dotbelowcomb=803;e.dotkatakana=12539;e.dotlessi=305;e.dotlessj=63166;e.dotlessjstrokehook=644;e.dotmath=8901;e.dottedcircle=9676;e.doubleyodpatah=64287;e.doubleyodpatahhebrew=64287;e.downtackbelowcmb=798;e.downtackmod=725;e.dparen=9375;e.dsuperior=63211;e.dtail=598;e.dtopbar=396;e.duhiragana=12389;e.dukatakana=12485;e.dz=499;e.dzaltone=675;e.dzcaron=454;e.dzcurl=677;e.dzeabkhasiancyrillic=1249;e.dzecyrillic=1109;e.dzhecyrillic=1119;e.e=101;e.eacute=233;e.earth=9793;e.ebengali=2447;e.ebopomofo=12572;e.ebreve=277;e.ecandradeva=2317;e.ecandragujarati=2701;e.ecandravowelsigndeva=2373;e.ecandravowelsigngujarati=2757;e.ecaron=283;e.ecedillabreve=7709;e.echarmenian=1381;e.echyiwnarmenian=1415;e.ecircle=9428;e.ecircumflex=234;e.ecircumflexacute=7871;e.ecircumflexbelow=7705;e.ecircumflexdotbelow=7879;e.ecircumflexgrave=7873;e.ecircumflexhookabove=7875;e.ecircumflextilde=7877;e.ecyrillic=1108;e.edblgrave=517;e.edeva=2319;e.edieresis=235;e.edot=279;e.edotaccent=279;e.edotbelow=7865;e.eegurmukhi=2575;e.eematragurmukhi=2631;e.efcyrillic=1092;e.egrave=232;e.egujarati=2703;e.eharmenian=1383;e.ehbopomofo=12573;e.ehiragana=12360;e.ehookabove=7867;e.eibopomofo=12575;e.eight=56;e.eightarabic=1640;e.eightbengali=2542;e.eightcircle=9319;e.eightcircleinversesansserif=10129;e.eightdeva=2414;e.eighteencircle=9329;e.eighteenparen=9349;e.eighteenperiod=9369;e.eightgujarati=2798;e.eightgurmukhi=2670;e.eighthackarabic=1640;e.eighthangzhou=12328;e.eighthnotebeamed=9835;e.eightideographicparen=12839;e.eightinferior=8328;e.eightmonospace=65304;e.eightoldstyle=63288;e.eightparen=9339;e.eightperiod=9359;e.eightpersian=1784;e.eightroman=8567;e.eightsuperior=8312;e.eightthai=3672;e.einvertedbreve=519;e.eiotifiedcyrillic=1125;e.ekatakana=12456;e.ekatakanahalfwidth=65396;e.ekonkargurmukhi=2676;e.ekorean=12628;e.elcyrillic=1083;e.element=8712;e.elevencircle=9322;e.elevenparen=9342;e.elevenperiod=9362;e.elevenroman=8570;e.ellipsis=8230;e.ellipsisvertical=8942;e.emacron=275;e.emacronacute=7703;e.emacrongrave=7701;e.emcyrillic=1084;e.emdash=8212;e.emdashvertical=65073;e.emonospace=65349;e.emphasismarkarmenian=1371;e.emptyset=8709;e.enbopomofo=12579;e.encyrillic=1085;e.endash=8211;e.endashvertical=65074;e.endescendercyrillic=1187;e.eng=331;e.engbopomofo=12581;e.enghecyrillic=1189;e.enhookcyrillic=1224;e.enspace=8194;e.eogonek=281;e.eokorean=12627;e.eopen=603;e.eopenclosed=666;e.eopenreversed=604;e.eopenreversedclosed=606;e.eopenreversedhook=605;e.eparen=9376;e.epsilon=949;e.epsilontonos=941;e.equal=61;e.equalmonospace=65309;e.equalsmall=65126;e.equalsuperior=8316;e.equivalence=8801;e.erbopomofo=12582;e.ercyrillic=1088;e.ereversed=600;e.ereversedcyrillic=1101;e.escyrillic=1089;e.esdescendercyrillic=1195;e.esh=643;e.eshcurl=646;e.eshortdeva=2318;e.eshortvowelsigndeva=2374;e.eshreversedloop=426;e.eshsquatreversed=645;e.esmallhiragana=12359;e.esmallkatakana=12455;e.esmallkatakanahalfwidth=65386;e.estimated=8494;e.esuperior=63212;e.eta=951;e.etarmenian=1384;e.etatonos=942;e.eth=240;e.etilde=7869;e.etildebelow=7707;e.etnahtafoukhhebrew=1425;e.etnahtafoukhlefthebrew=1425;e.etnahtahebrew=1425;e.etnahtalefthebrew=1425;e.eturned=477;e.eukorean=12641;e.euro=8364;e.evowelsignbengali=2503;e.evowelsigndeva=2375;e.evowelsigngujarati=2759;e.exclam=33;e.exclamarmenian=1372;e.exclamdbl=8252;e.exclamdown=161;e.exclamdownsmall=63393;e.exclammonospace=65281;e.exclamsmall=63265;e.existential=8707;e.ezh=658;e.ezhcaron=495;e.ezhcurl=659;e.ezhreversed=441;e.ezhtail=442;e.f=102;e.fadeva=2398;e.fagurmukhi=2654;e.fahrenheit=8457;e.fathaarabic=1614;e.fathalowarabic=1614;e.fathatanarabic=1611;e.fbopomofo=12552;e.fcircle=9429;e.fdotaccent=7711;e.feharabic=1601;e.feharmenian=1414;e.fehfinalarabic=65234;e.fehinitialarabic=65235;e.fehmedialarabic=65236;e.feicoptic=997;e.female=9792;e.ff=64256;e.ffi=64259;e.ffl=64260;e.fi=64257;e.fifteencircle=9326;e.fifteenparen=9346;e.fifteenperiod=9366;e.figuredash=8210;e.filledbox=9632;e.filledrect=9644;e.finalkaf=1498;e.finalkafdagesh=64314;e.finalkafdageshhebrew=64314;e.finalkafhebrew=1498;e.finalmem=1501;e.finalmemhebrew=1501;e.finalnun=1503;e.finalnunhebrew=1503;e.finalpe=1507;e.finalpehebrew=1507;e.finaltsadi=1509;e.finaltsadihebrew=1509;e.firsttonechinese=713;e.fisheye=9673;e.fitacyrillic=1139;e.five=53;e.fivearabic=1637;e.fivebengali=2539;e.fivecircle=9316;e.fivecircleinversesansserif=10126;e.fivedeva=2411;e.fiveeighths=8541;e.fivegujarati=2795;e.fivegurmukhi=2667;e.fivehackarabic=1637;e.fivehangzhou=12325;e.fiveideographicparen=12836;e.fiveinferior=8325;e.fivemonospace=65301;e.fiveoldstyle=63285;e.fiveparen=9336;e.fiveperiod=9356;e.fivepersian=1781;e.fiveroman=8564;e.fivesuperior=8309;e.fivethai=3669;e.fl=64258;e.florin=402;e.fmonospace=65350;e.fmsquare=13209;e.fofanthai=3615;e.fofathai=3613;e.fongmanthai=3663;e.forall=8704;e.four=52;e.fourarabic=1636;e.fourbengali=2538;e.fourcircle=9315;e.fourcircleinversesansserif=10125;e.fourdeva=2410;e.fourgujarati=2794;e.fourgurmukhi=2666;e.fourhackarabic=1636;e.fourhangzhou=12324;e.fourideographicparen=12835;e.fourinferior=8324;e.fourmonospace=65300;e.fournumeratorbengali=2551;e.fouroldstyle=63284;e.fourparen=9335;e.fourperiod=9355;e.fourpersian=1780;e.fourroman=8563;e.foursuperior=8308;e.fourteencircle=9325;e.fourteenparen=9345;e.fourteenperiod=9365;e.fourthai=3668;e.fourthtonechinese=715;e.fparen=9377;e.fraction=8260;e.franc=8355;e.g=103;e.gabengali=2455;e.gacute=501;e.gadeva=2327;e.gafarabic=1711;e.gaffinalarabic=64403;e.gafinitialarabic=64404;e.gafmedialarabic=64405;e.gagujarati=2711;e.gagurmukhi=2583;e.gahiragana=12364;e.gakatakana=12460;e.gamma=947;e.gammalatinsmall=611;e.gammasuperior=736;e.gangiacoptic=1003;e.gbopomofo=12557;e.gbreve=287;e.gcaron=487;e.gcedilla=291;e.gcircle=9430;e.gcircumflex=285;e.gcommaaccent=291;e.gdot=289;e.gdotaccent=289;e.gecyrillic=1075;e.gehiragana=12370;e.gekatakana=12466;e.geometricallyequal=8785;e.gereshaccenthebrew=1436;e.gereshhebrew=1523;e.gereshmuqdamhebrew=1437;e.germandbls=223;e.gershayimaccenthebrew=1438;e.gershayimhebrew=1524;e.getamark=12307;e.ghabengali=2456;e.ghadarmenian=1394;e.ghadeva=2328;e.ghagujarati=2712;e.ghagurmukhi=2584;e.ghainarabic=1594;e.ghainfinalarabic=65230;e.ghaininitialarabic=65231;e.ghainmedialarabic=65232;e.ghemiddlehookcyrillic=1173;e.ghestrokecyrillic=1171;e.gheupturncyrillic=1169;e.ghhadeva=2394;e.ghhagurmukhi=2650;e.ghook=608;e.ghzsquare=13203;e.gihiragana=12366;e.gikatakana=12462;e.gimarmenian=1379;e.gimel=1490;e.gimeldagesh=64306;e.gimeldageshhebrew=64306;e.gimelhebrew=1490;e.gjecyrillic=1107;e.glottalinvertedstroke=446;e.glottalstop=660;e.glottalstopinverted=662;e.glottalstopmod=704;e.glottalstopreversed=661;e.glottalstopreversedmod=705;e.glottalstopreversedsuperior=740;e.glottalstopstroke=673;e.glottalstopstrokereversed=674;e.gmacron=7713;e.gmonospace=65351;e.gohiragana=12372;e.gokatakana=12468;e.gparen=9378;e.gpasquare=13228;e.gradient=8711;e.grave=96;e.gravebelowcmb=790;e.gravecmb=768;e.gravecomb=768;e.gravedeva=2387;e.gravelowmod=718;e.gravemonospace=65344;e.gravetonecmb=832;e.greater=62;e.greaterequal=8805;e.greaterequalorless=8923;e.greatermonospace=65310;e.greaterorequivalent=8819;e.greaterorless=8823;e.greateroverequal=8807;e.greatersmall=65125;e.gscript=609;e.gstroke=485;e.guhiragana=12368;e.guillemotleft=171;e.guillemotright=187;e.guilsinglleft=8249;e.guilsinglright=8250;e.gukatakana=12464;e.guramusquare=13080;e.gysquare=13257;e.h=104;e.haabkhasiancyrillic=1193;e.haaltonearabic=1729;e.habengali=2489;e.hadescendercyrillic=1203;e.hadeva=2361;e.hagujarati=2745;e.hagurmukhi=2617;e.haharabic=1581;e.hahfinalarabic=65186;e.hahinitialarabic=65187;e.hahiragana=12399;e.hahmedialarabic=65188;e.haitusquare=13098;e.hakatakana=12495;e.hakatakanahalfwidth=65418;e.halantgurmukhi=2637;e.hamzaarabic=1569;e.hamzalowarabic=1569;e.hangulfiller=12644;e.hardsigncyrillic=1098;e.harpoonleftbarbup=8636;e.harpoonrightbarbup=8640;e.hasquare=13258;e.hatafpatah=1458;e.hatafpatah16=1458;e.hatafpatah23=1458;e.hatafpatah2f=1458;e.hatafpatahhebrew=1458;e.hatafpatahnarrowhebrew=1458;e.hatafpatahquarterhebrew=1458;e.hatafpatahwidehebrew=1458;e.hatafqamats=1459;e.hatafqamats1b=1459;e.hatafqamats28=1459;e.hatafqamats34=1459;e.hatafqamatshebrew=1459;e.hatafqamatsnarrowhebrew=1459;e.hatafqamatsquarterhebrew=1459;e.hatafqamatswidehebrew=1459;e.hatafsegol=1457;e.hatafsegol17=1457;e.hatafsegol24=1457;e.hatafsegol30=1457;e.hatafsegolhebrew=1457;e.hatafsegolnarrowhebrew=1457;e.hatafsegolquarterhebrew=1457;e.hatafsegolwidehebrew=1457;e.hbar=295;e.hbopomofo=12559;e.hbrevebelow=7723;e.hcedilla=7721;e.hcircle=9431;e.hcircumflex=293;e.hdieresis=7719;e.hdotaccent=7715;e.hdotbelow=7717;e.he=1492;e.heart=9829;e.heartsuitblack=9829;e.heartsuitwhite=9825;e.hedagesh=64308;e.hedageshhebrew=64308;e.hehaltonearabic=1729;e.heharabic=1607;e.hehebrew=1492;e.hehfinalaltonearabic=64423;e.hehfinalalttwoarabic=65258;e.hehfinalarabic=65258;e.hehhamzaabovefinalarabic=64421;e.hehhamzaaboveisolatedarabic=64420;e.hehinitialaltonearabic=64424;e.hehinitialarabic=65259;e.hehiragana=12408;e.hehmedialaltonearabic=64425;e.hehmedialarabic=65260;e.heiseierasquare=13179;e.hekatakana=12504;e.hekatakanahalfwidth=65421;e.hekutaarusquare=13110;e.henghook=615;e.herutusquare=13113;e.het=1495;e.hethebrew=1495;e.hhook=614;e.hhooksuperior=689;e.hieuhacirclekorean=12923;e.hieuhaparenkorean=12827;e.hieuhcirclekorean=12909;e.hieuhkorean=12622;e.hieuhparenkorean=12813;e.hihiragana=12402;e.hikatakana=12498;e.hikatakanahalfwidth=65419;e.hiriq=1460;e.hiriq14=1460;e.hiriq21=1460;e.hiriq2d=1460;e.hiriqhebrew=1460;e.hiriqnarrowhebrew=1460;e.hiriqquarterhebrew=1460;e.hiriqwidehebrew=1460;e.hlinebelow=7830;e.hmonospace=65352;e.hoarmenian=1392;e.hohipthai=3627;e.hohiragana=12411;e.hokatakana=12507;e.hokatakanahalfwidth=65422;e.holam=1465;e.holam19=1465;e.holam26=1465;e.holam32=1465;e.holamhebrew=1465;e.holamnarrowhebrew=1465;e.holamquarterhebrew=1465;e.holamwidehebrew=1465;e.honokhukthai=3630;e.hookabovecomb=777;e.hookcmb=777;e.hookpalatalizedbelowcmb=801;e.hookretroflexbelowcmb=802;e.hoonsquare=13122;e.horicoptic=1001;e.horizontalbar=8213;e.horncmb=795;e.hotsprings=9832;e.house=8962;e.hparen=9379;e.hsuperior=688;e.hturned=613;e.huhiragana=12405;e.huiitosquare=13107;e.hukatakana=12501;e.hukatakanahalfwidth=65420;e.hungarumlaut=733;e.hungarumlautcmb=779;e.hv=405;e.hyphen=45;e.hypheninferior=63205;e.hyphenmonospace=65293;e.hyphensmall=65123;e.hyphensuperior=63206;e.hyphentwo=8208;e.i=105;e.iacute=237;e.iacyrillic=1103;e.ibengali=2439;e.ibopomofo=12583;e.ibreve=301;e.icaron=464;e.icircle=9432;e.icircumflex=238;e.icyrillic=1110;e.idblgrave=521;e.ideographearthcircle=12943;e.ideographfirecircle=12939;e.ideographicallianceparen=12863;e.ideographiccallparen=12858;e.ideographiccentrecircle=12965;e.ideographicclose=12294;e.ideographiccomma=12289;e.ideographiccommaleft=65380;e.ideographiccongratulationparen=12855;e.ideographiccorrectcircle=12963;e.ideographicearthparen=12847;e.ideographicenterpriseparen=12861;e.ideographicexcellentcircle=12957;e.ideographicfestivalparen=12864;e.ideographicfinancialcircle=12950;e.ideographicfinancialparen=12854;e.ideographicfireparen=12843;e.ideographichaveparen=12850;e.ideographichighcircle=12964;e.ideographiciterationmark=12293;e.ideographiclaborcircle=12952;e.ideographiclaborparen=12856;e.ideographicleftcircle=12967;e.ideographiclowcircle=12966;e.ideographicmedicinecircle=12969;e.ideographicmetalparen=12846;e.ideographicmoonparen=12842;e.ideographicnameparen=12852;e.ideographicperiod=12290;e.ideographicprintcircle=12958;e.ideographicreachparen=12867;e.ideographicrepresentparen=12857;e.ideographicresourceparen=12862;e.ideographicrightcircle=12968;e.ideographicsecretcircle=12953;e.ideographicselfparen=12866;e.ideographicsocietyparen=12851;e.ideographicspace=12288;e.ideographicspecialparen=12853;e.ideographicstockparen=12849;e.ideographicstudyparen=12859;e.ideographicsunparen=12848;e.ideographicsuperviseparen=12860;e.ideographicwaterparen=12844;e.ideographicwoodparen=12845;e.ideographiczero=12295;e.ideographmetalcircle=12942;e.ideographmooncircle=12938;e.ideographnamecircle=12948;e.ideographsuncircle=12944;e.ideographwatercircle=12940;e.ideographwoodcircle=12941;e.ideva=2311;e.idieresis=239;e.idieresisacute=7727;e.idieresiscyrillic=1253;e.idotbelow=7883;e.iebrevecyrillic=1239;e.iecyrillic=1077;e.ieungacirclekorean=12917;e.ieungaparenkorean=12821;e.ieungcirclekorean=12903;e.ieungkorean=12615;e.ieungparenkorean=12807;e.igrave=236;e.igujarati=2695;e.igurmukhi=2567;e.ihiragana=12356;e.ihookabove=7881;e.iibengali=2440;e.iicyrillic=1080;e.iideva=2312;e.iigujarati=2696;e.iigurmukhi=2568;e.iimatragurmukhi=2624;e.iinvertedbreve=523;e.iishortcyrillic=1081;e.iivowelsignbengali=2496;e.iivowelsigndeva=2368;e.iivowelsigngujarati=2752;e.ij=307;e.ikatakana=12452;e.ikatakanahalfwidth=65394;e.ikorean=12643;e.ilde=732;e.iluyhebrew=1452;e.imacron=299;e.imacroncyrillic=1251;e.imageorapproximatelyequal=8787;e.imatragurmukhi=2623;e.imonospace=65353;e.increment=8710;e.infinity=8734;e.iniarmenian=1387;e.integral=8747;e.integralbottom=8993;e.integralbt=8993;e.integralex=63733;e.integraltop=8992;e.integraltp=8992;e.intersection=8745;e.intisquare=13061;e.invbullet=9688;e.invcircle=9689;e.invsmileface=9787;e.iocyrillic=1105;e.iogonek=303;e.iota=953;e.iotadieresis=970;e.iotadieresistonos=912;e.iotalatin=617;e.iotatonos=943;e.iparen=9380;e.irigurmukhi=2674;e.ismallhiragana=12355;e.ismallkatakana=12451;e.ismallkatakanahalfwidth=65384;e.issharbengali=2554;e.istroke=616;e.isuperior=63213;e.iterationhiragana=12445;e.iterationkatakana=12541;e.itilde=297;e.itildebelow=7725;e.iubopomofo=12585;e.iucyrillic=1102;e.ivowelsignbengali=2495;e.ivowelsigndeva=2367;e.ivowelsigngujarati=2751;e.izhitsacyrillic=1141;e.izhitsadblgravecyrillic=1143;e.j=106;e.jaarmenian=1393;e.jabengali=2460;e.jadeva=2332;e.jagujarati=2716;e.jagurmukhi=2588;e.jbopomofo=12560;e.jcaron=496;e.jcircle=9433;e.jcircumflex=309;e.jcrossedtail=669;e.jdotlessstroke=607;e.jecyrillic=1112;e.jeemarabic=1580;e.jeemfinalarabic=65182;e.jeeminitialarabic=65183;e.jeemmedialarabic=65184;e.jeharabic=1688;e.jehfinalarabic=64395;e.jhabengali=2461;e.jhadeva=2333;e.jhagujarati=2717;e.jhagurmukhi=2589;e.jheharmenian=1403;e.jis=12292;e.jmonospace=65354;e.jparen=9381;e.jsuperior=690;e.k=107;e.kabashkircyrillic=1185;e.kabengali=2453;e.kacute=7729;e.kacyrillic=1082;e.kadescendercyrillic=1179;e.kadeva=2325;e.kaf=1499;e.kafarabic=1603;e.kafdagesh=64315;e.kafdageshhebrew=64315;e.kaffinalarabic=65242;e.kafhebrew=1499;e.kafinitialarabic=65243;e.kafmedialarabic=65244;e.kafrafehebrew=64333;e.kagujarati=2709;e.kagurmukhi=2581;e.kahiragana=12363;e.kahookcyrillic=1220;e.kakatakana=12459;e.kakatakanahalfwidth=65398;e.kappa=954;e.kappasymbolgreek=1008;e.kapyeounmieumkorean=12657;e.kapyeounphieuphkorean=12676;e.kapyeounpieupkorean=12664;e.kapyeounssangpieupkorean=12665;e.karoriisquare=13069;e.kashidaautoarabic=1600;e.kashidaautonosidebearingarabic=1600;e.kasmallkatakana=12533;e.kasquare=13188;e.kasraarabic=1616;e.kasratanarabic=1613;e.kastrokecyrillic=1183;e.katahiraprolongmarkhalfwidth=65392;e.kaverticalstrokecyrillic=1181;e.kbopomofo=12558;e.kcalsquare=13193;e.kcaron=489;e.kcedilla=311;e.kcircle=9434;e.kcommaaccent=311;e.kdotbelow=7731;e.keharmenian=1412;e.kehiragana=12369;e.kekatakana=12465;e.kekatakanahalfwidth=65401;e.kenarmenian=1391;e.kesmallkatakana=12534;e.kgreenlandic=312;e.khabengali=2454;e.khacyrillic=1093;e.khadeva=2326;e.khagujarati=2710;e.khagurmukhi=2582;e.khaharabic=1582;e.khahfinalarabic=65190;e.khahinitialarabic=65191;e.khahmedialarabic=65192;e.kheicoptic=999;e.khhadeva=2393;e.khhagurmukhi=2649;e.khieukhacirclekorean=12920;e.khieukhaparenkorean=12824;e.khieukhcirclekorean=12906;e.khieukhkorean=12619;e.khieukhparenkorean=12810;e.khokhaithai=3586;e.khokhonthai=3589;e.khokhuatthai=3587;e.khokhwaithai=3588;e.khomutthai=3675;e.khook=409;e.khorakhangthai=3590;e.khzsquare=13201;e.kihiragana=12365;e.kikatakana=12461;e.kikatakanahalfwidth=65399;e.kiroguramusquare=13077;e.kiromeetorusquare=13078;e.kirosquare=13076;e.kiyeokacirclekorean=12910;e.kiyeokaparenkorean=12814;e.kiyeokcirclekorean=12896;e.kiyeokkorean=12593;e.kiyeokparenkorean=12800;e.kiyeoksioskorean=12595;e.kjecyrillic=1116;e.klinebelow=7733;e.klsquare=13208;e.kmcubedsquare=13222;e.kmonospace=65355;e.kmsquaredsquare=13218;e.kohiragana=12371;e.kohmsquare=13248;e.kokaithai=3585;e.kokatakana=12467;e.kokatakanahalfwidth=65402;e.kooposquare=13086;e.koppacyrillic=1153;e.koreanstandardsymbol=12927;e.koroniscmb=835;e.kparen=9382;e.kpasquare=13226;e.ksicyrillic=1135;e.ktsquare=13263;e.kturned=670;e.kuhiragana=12367;e.kukatakana=12463;e.kukatakanahalfwidth=65400;e.kvsquare=13240;e.kwsquare=13246;e.l=108;e.labengali=2482;e.lacute=314;e.ladeva=2354;e.lagujarati=2738;e.lagurmukhi=2610;e.lakkhangyaothai=3653;e.lamaleffinalarabic=65276;e.lamalefhamzaabovefinalarabic=65272;e.lamalefhamzaaboveisolatedarabic=65271;e.lamalefhamzabelowfinalarabic=65274;e.lamalefhamzabelowisolatedarabic=65273;e.lamalefisolatedarabic=65275;e.lamalefmaddaabovefinalarabic=65270;e.lamalefmaddaaboveisolatedarabic=65269;e.lamarabic=1604;e.lambda=955;e.lambdastroke=411;e.lamed=1500;e.lameddagesh=64316;e.lameddageshhebrew=64316;e.lamedhebrew=1500;e.lamfinalarabic=65246;e.lamhahinitialarabic=64714;e.laminitialarabic=65247;e.lamjeeminitialarabic=64713;e.lamkhahinitialarabic=64715;e.lamlamhehisolatedarabic=65010;e.lammedialarabic=65248;e.lammeemhahinitialarabic=64904;e.lammeeminitialarabic=64716;e.largecircle=9711;e.lbar=410;e.lbelt=620;e.lbopomofo=12556;e.lcaron=318;e.lcedilla=316;e.lcircle=9435;e.lcircumflexbelow=7741;e.lcommaaccent=316;e.ldot=320;e.ldotaccent=320;e.ldotbelow=7735;e.ldotbelowmacron=7737;e.leftangleabovecmb=794;e.lefttackbelowcmb=792;e.less=60;e.lessequal=8804;e.lessequalorgreater=8922;e.lessmonospace=65308;e.lessorequivalent=8818;e.lessorgreater=8822;e.lessoverequal=8806;e.lesssmall=65124;e.lezh=622;e.lfblock=9612;e.lhookretroflex=621;e.lira=8356;e.liwnarmenian=1388;e.lj=457;e.ljecyrillic=1113;e.ll=63168;e.lladeva=2355;e.llagujarati=2739;e.llinebelow=7739;e.llladeva=2356;e.llvocalicbengali=2529;e.llvocalicdeva=2401;e.llvocalicvowelsignbengali=2531;e.llvocalicvowelsigndeva=2403;e.lmiddletilde=619;e.lmonospace=65356;e.lmsquare=13264;e.lochulathai=3628;e.logicaland=8743;e.logicalnot=172;e.logicalnotreversed=8976;e.logicalor=8744;e.lolingthai=3621;e.longs=383;e.lowlinecenterline=65102;e.lowlinecmb=818;e.lowlinedashed=65101;e.lozenge=9674;e.lparen=9383;e.lslash=322;e.lsquare=8467;e.lsuperior=63214;e.ltshade=9617;e.luthai=3622;e.lvocalicbengali=2444;e.lvocalicdeva=2316;e.lvocalicvowelsignbengali=2530;e.lvocalicvowelsigndeva=2402;e.lxsquare=13267;e.m=109;e.mabengali=2478;e.macron=175;e.macronbelowcmb=817;e.macroncmb=772;e.macronlowmod=717;e.macronmonospace=65507;e.macute=7743;e.madeva=2350;e.magujarati=2734;e.magurmukhi=2606;e.mahapakhhebrew=1444;e.mahapakhlefthebrew=1444;e.mahiragana=12414;e.maichattawalowleftthai=63637;e.maichattawalowrightthai=63636;e.maichattawathai=3659;e.maichattawaupperleftthai=63635;e.maieklowleftthai=63628;e.maieklowrightthai=63627;e.maiekthai=3656;e.maiekupperleftthai=63626;e.maihanakatleftthai=63620;e.maihanakatthai=3633;e.maitaikhuleftthai=63625;e.maitaikhuthai=3655;e.maitholowleftthai=63631;e.maitholowrightthai=63630;e.maithothai=3657;e.maithoupperleftthai=63629;e.maitrilowleftthai=63634;e.maitrilowrightthai=63633;e.maitrithai=3658;e.maitriupperleftthai=63632;e.maiyamokthai=3654;e.makatakana=12510;e.makatakanahalfwidth=65423;e.male=9794;e.mansyonsquare=13127;e.maqafhebrew=1470;e.mars=9794;e.masoracirclehebrew=1455;e.masquare=13187;e.mbopomofo=12551;e.mbsquare=13268;e.mcircle=9436;e.mcubedsquare=13221;e.mdotaccent=7745;e.mdotbelow=7747;e.meemarabic=1605;e.meemfinalarabic=65250;e.meeminitialarabic=65251;e.meemmedialarabic=65252;e.meemmeeminitialarabic=64721;e.meemmeemisolatedarabic=64584;e.meetorusquare=13133;e.mehiragana=12417;e.meizierasquare=13182;e.mekatakana=12513;e.mekatakanahalfwidth=65426;e.mem=1502;e.memdagesh=64318;e.memdageshhebrew=64318;e.memhebrew=1502;e.menarmenian=1396;e.merkhahebrew=1445;e.merkhakefulahebrew=1446;e.merkhakefulalefthebrew=1446;e.merkhalefthebrew=1445;e.mhook=625;e.mhzsquare=13202;e.middledotkatakanahalfwidth=65381;e.middot=183;e.mieumacirclekorean=12914;e.mieumaparenkorean=12818;e.mieumcirclekorean=12900;e.mieumkorean=12609;e.mieumpansioskorean=12656;e.mieumparenkorean=12804;e.mieumpieupkorean=12654;e.mieumsioskorean=12655;e.mihiragana=12415;e.mikatakana=12511;e.mikatakanahalfwidth=65424;e.minus=8722;e.minusbelowcmb=800;e.minuscircle=8854;e.minusmod=727;e.minusplus=8723;e.minute=8242;e.miribaarusquare=13130;e.mirisquare=13129;e.mlonglegturned=624;e.mlsquare=13206;e.mmcubedsquare=13219;e.mmonospace=65357;e.mmsquaredsquare=13215;e.mohiragana=12418;e.mohmsquare=13249;e.mokatakana=12514;e.mokatakanahalfwidth=65427;e.molsquare=13270;e.momathai=3617;e.moverssquare=13223;e.moverssquaredsquare=13224;e.mparen=9384;e.mpasquare=13227;e.mssquare=13235;e.msuperior=63215;e.mturned=623;e.mu=181;e.mu1=181;e.muasquare=13186;e.muchgreater=8811;e.muchless=8810;e.mufsquare=13196;e.mugreek=956;e.mugsquare=13197;e.muhiragana=12416;e.mukatakana=12512;e.mukatakanahalfwidth=65425;e.mulsquare=13205;e.multiply=215;e.mumsquare=13211;e.munahhebrew=1443;e.munahlefthebrew=1443;e.musicalnote=9834;e.musicalnotedbl=9835;e.musicflatsign=9837;e.musicsharpsign=9839;e.mussquare=13234;e.muvsquare=13238;e.muwsquare=13244;e.mvmegasquare=13241;e.mvsquare=13239;e.mwmegasquare=13247;e.mwsquare=13245;e.n=110;e.nabengali=2472;e.nabla=8711;e.nacute=324;e.nadeva=2344;e.nagujarati=2728;e.nagurmukhi=2600;e.nahiragana=12394;e.nakatakana=12490;e.nakatakanahalfwidth=65413;e.napostrophe=329;e.nasquare=13185;e.nbopomofo=12555;e.nbspace=160;e.ncaron=328;e.ncedilla=326;e.ncircle=9437;e.ncircumflexbelow=7755;e.ncommaaccent=326;e.ndotaccent=7749;e.ndotbelow=7751;e.nehiragana=12397;e.nekatakana=12493;e.nekatakanahalfwidth=65416;e.newsheqelsign=8362;e.nfsquare=13195;e.ngabengali=2457;e.ngadeva=2329;e.ngagujarati=2713;e.ngagurmukhi=2585;e.ngonguthai=3591;e.nhiragana=12435;e.nhookleft=626;e.nhookretroflex=627;e.nieunacirclekorean=12911;e.nieunaparenkorean=12815;e.nieuncieuckorean=12597;e.nieuncirclekorean=12897;e.nieunhieuhkorean=12598;e.nieunkorean=12596;e.nieunpansioskorean=12648;e.nieunparenkorean=12801;e.nieunsioskorean=12647;e.nieuntikeutkorean=12646;e.nihiragana=12395;e.nikatakana=12491;e.nikatakanahalfwidth=65414;e.nikhahitleftthai=63641;e.nikhahitthai=3661;e.nine=57;e.ninearabic=1641;e.ninebengali=2543;e.ninecircle=9320;e.ninecircleinversesansserif=10130;e.ninedeva=2415;e.ninegujarati=2799;e.ninegurmukhi=2671;e.ninehackarabic=1641;e.ninehangzhou=12329;e.nineideographicparen=12840;e.nineinferior=8329;e.ninemonospace=65305;e.nineoldstyle=63289;e.nineparen=9340;e.nineperiod=9360;e.ninepersian=1785;e.nineroman=8568;e.ninesuperior=8313;e.nineteencircle=9330;e.nineteenparen=9350;e.nineteenperiod=9370;e.ninethai=3673;e.nj=460;e.njecyrillic=1114;e.nkatakana=12531;e.nkatakanahalfwidth=65437;e.nlegrightlong=414;e.nlinebelow=7753;e.nmonospace=65358;e.nmsquare=13210;e.nnabengali=2467;e.nnadeva=2339;e.nnagujarati=2723;e.nnagurmukhi=2595;e.nnnadeva=2345;e.nohiragana=12398;e.nokatakana=12494;e.nokatakanahalfwidth=65417;e.nonbreakingspace=160;e.nonenthai=3603;e.nonuthai=3609;e.noonarabic=1606;e.noonfinalarabic=65254;e.noonghunnaarabic=1722;e.noonghunnafinalarabic=64415;e.nooninitialarabic=65255;e.noonjeeminitialarabic=64722;e.noonjeemisolatedarabic=64587;e.noonmedialarabic=65256;e.noonmeeminitialarabic=64725;e.noonmeemisolatedarabic=64590;e.noonnoonfinalarabic=64653;e.notcontains=8716;e.notelement=8713;e.notelementof=8713;e.notequal=8800;e.notgreater=8815;e.notgreaternorequal=8817;e.notgreaternorless=8825;e.notidentical=8802;e.notless=8814;e.notlessnorequal=8816;e.notparallel=8742;e.notprecedes=8832;e.notsubset=8836;e.notsucceeds=8833;e.notsuperset=8837;e.nowarmenian=1398;e.nparen=9385;e.nssquare=13233;e.nsuperior=8319;e.ntilde=241;e.nu=957;e.nuhiragana=12396;e.nukatakana=12492;e.nukatakanahalfwidth=65415;e.nuktabengali=2492;e.nuktadeva=2364;e.nuktagujarati=2748;e.nuktagurmukhi=2620;e.numbersign=35;e.numbersignmonospace=65283;e.numbersignsmall=65119;e.numeralsigngreek=884;e.numeralsignlowergreek=885;e.numero=8470;e.nun=1504;e.nundagesh=64320;e.nundageshhebrew=64320;e.nunhebrew=1504;e.nvsquare=13237;e.nwsquare=13243;e.nyabengali=2462;e.nyadeva=2334;e.nyagujarati=2718;e.nyagurmukhi=2590;e.o=111;e.oacute=243;e.oangthai=3629;e.obarred=629;e.obarredcyrillic=1257;e.obarreddieresiscyrillic=1259;e.obengali=2451;e.obopomofo=12571;e.obreve=335;e.ocandradeva=2321;e.ocandragujarati=2705;e.ocandravowelsigndeva=2377;e.ocandravowelsigngujarati=2761;e.ocaron=466;e.ocircle=9438;e.ocircumflex=244;e.ocircumflexacute=7889;e.ocircumflexdotbelow=7897;e.ocircumflexgrave=7891;e.ocircumflexhookabove=7893;e.ocircumflextilde=7895;e.ocyrillic=1086;e.odblacute=337;e.odblgrave=525;e.odeva=2323;e.odieresis=246;e.odieresiscyrillic=1255;e.odotbelow=7885;e.oe=339;e.oekorean=12634;e.ogonek=731;e.ogonekcmb=808;e.ograve=242;e.ogujarati=2707;e.oharmenian=1413;e.ohiragana=12362;e.ohookabove=7887;e.ohorn=417;e.ohornacute=7899;e.ohorndotbelow=7907;e.ohorngrave=7901;e.ohornhookabove=7903;e.ohorntilde=7905;e.ohungarumlaut=337;e.oi=419;e.oinvertedbreve=527;e.okatakana=12458;e.okatakanahalfwidth=65397;e.okorean=12631;e.olehebrew=1451;e.omacron=333;e.omacronacute=7763;e.omacrongrave=7761;e.omdeva=2384;e.omega=969;e.omega1=982;e.omegacyrillic=1121;e.omegalatinclosed=631;e.omegaroundcyrillic=1147;e.omegatitlocyrillic=1149;e.omegatonos=974;e.omgujarati=2768;e.omicron=959;e.omicrontonos=972;e.omonospace=65359;e.one=49;e.onearabic=1633;e.onebengali=2535;e.onecircle=9312;e.onecircleinversesansserif=10122;e.onedeva=2407;e.onedotenleader=8228;e.oneeighth=8539;e.onefitted=63196;e.onegujarati=2791;e.onegurmukhi=2663;e.onehackarabic=1633;e.onehalf=189;e.onehangzhou=12321;e.oneideographicparen=12832;e.oneinferior=8321;e.onemonospace=65297;e.onenumeratorbengali=2548;e.oneoldstyle=63281;e.oneparen=9332;e.oneperiod=9352;e.onepersian=1777;e.onequarter=188;e.oneroman=8560;e.onesuperior=185;e.onethai=3665;e.onethird=8531;e.oogonek=491;e.oogonekmacron=493;e.oogurmukhi=2579;e.oomatragurmukhi=2635;e.oopen=596;e.oparen=9386;e.openbullet=9702;e.option=8997;e.ordfeminine=170;e.ordmasculine=186;e.orthogonal=8735;e.oshortdeva=2322;e.oshortvowelsigndeva=2378;e.oslash=248;e.oslashacute=511;e.osmallhiragana=12361;e.osmallkatakana=12457;e.osmallkatakanahalfwidth=65387;e.ostrokeacute=511;e.osuperior=63216;e.otcyrillic=1151;e.otilde=245;e.otildeacute=7757;e.otildedieresis=7759;e.oubopomofo=12577;e.overline=8254;e.overlinecenterline=65098;e.overlinecmb=773;e.overlinedashed=65097;e.overlinedblwavy=65100;e.overlinewavy=65099;e.overscore=175;e.ovowelsignbengali=2507;e.ovowelsigndeva=2379;e.ovowelsigngujarati=2763;e.p=112;e.paampssquare=13184;e.paasentosquare=13099;e.pabengali=2474;e.pacute=7765;e.padeva=2346;e.pagedown=8671;e.pageup=8670;e.pagujarati=2730;e.pagurmukhi=2602;e.pahiragana=12401;e.paiyannoithai=3631;e.pakatakana=12497;e.palatalizationcyrilliccmb=1156;e.palochkacyrillic=1216;e.pansioskorean=12671;e.paragraph=182;e.parallel=8741;e.parenleft=40;e.parenleftaltonearabic=64830;e.parenleftbt=63725;e.parenleftex=63724;e.parenleftinferior=8333;e.parenleftmonospace=65288;e.parenleftsmall=65113;e.parenleftsuperior=8317;e.parenlefttp=63723;e.parenleftvertical=65077;e.parenright=41;e.parenrightaltonearabic=64831;e.parenrightbt=63736;e.parenrightex=63735;e.parenrightinferior=8334;e.parenrightmonospace=65289;e.parenrightsmall=65114;e.parenrightsuperior=8318;e.parenrighttp=63734;e.parenrightvertical=65078;e.partialdiff=8706;e.paseqhebrew=1472;e.pashtahebrew=1433;e.pasquare=13225;e.patah=1463;e.patah11=1463;e.patah1d=1463;e.patah2a=1463;e.patahhebrew=1463;e.patahnarrowhebrew=1463;e.patahquarterhebrew=1463;e.patahwidehebrew=1463;e.pazerhebrew=1441;e.pbopomofo=12550;e.pcircle=9439;e.pdotaccent=7767;e.pe=1508;e.pecyrillic=1087;e.pedagesh=64324;e.pedageshhebrew=64324;e.peezisquare=13115;e.pefinaldageshhebrew=64323;e.peharabic=1662;e.peharmenian=1402;e.pehebrew=1508;e.pehfinalarabic=64343;e.pehinitialarabic=64344;e.pehiragana=12410;e.pehmedialarabic=64345;e.pekatakana=12506;e.pemiddlehookcyrillic=1191;e.perafehebrew=64334;e.percent=37;e.percentarabic=1642;e.percentmonospace=65285;e.percentsmall=65130;e.period=46;e.periodarmenian=1417;e.periodcentered=183;e.periodhalfwidth=65377;e.periodinferior=63207;e.periodmonospace=65294;e.periodsmall=65106;e.periodsuperior=63208;e.perispomenigreekcmb=834;e.perpendicular=8869;e.perthousand=8240;e.peseta=8359;e.pfsquare=13194;e.phabengali=2475;e.phadeva=2347;e.phagujarati=2731;e.phagurmukhi=2603;e.phi=966;e.phi1=981;e.phieuphacirclekorean=12922;e.phieuphaparenkorean=12826;e.phieuphcirclekorean=12908;e.phieuphkorean=12621;e.phieuphparenkorean=12812;e.philatin=632;e.phinthuthai=3642;e.phisymbolgreek=981;e.phook=421;e.phophanthai=3614;e.phophungthai=3612;e.phosamphaothai=3616;e.pi=960;e.pieupacirclekorean=12915;e.pieupaparenkorean=12819;e.pieupcieuckorean=12662;e.pieupcirclekorean=12901;e.pieupkiyeokkorean=12658;e.pieupkorean=12610;e.pieupparenkorean=12805;e.pieupsioskiyeokkorean=12660;e.pieupsioskorean=12612;e.pieupsiostikeutkorean=12661;e.pieupthieuthkorean=12663;e.pieuptikeutkorean=12659;e.pihiragana=12404;e.pikatakana=12500;e.pisymbolgreek=982;e.piwrarmenian=1411;e.plus=43;e.plusbelowcmb=799;e.pluscircle=8853;e.plusminus=177;e.plusmod=726;e.plusmonospace=65291;e.plussmall=65122;e.plussuperior=8314;e.pmonospace=65360;e.pmsquare=13272;e.pohiragana=12413;e.pointingindexdownwhite=9759;e.pointingindexleftwhite=9756;e.pointingindexrightwhite=9758;e.pointingindexupwhite=9757;e.pokatakana=12509;e.poplathai=3611;e.postalmark=12306;e.postalmarkface=12320;e.pparen=9387;e.precedes=8826;e.prescription=8478;e.primemod=697;e.primereversed=8245;e.product=8719;e.projective=8965;e.prolongedkana=12540;e.propellor=8984;e.propersubset=8834;e.propersuperset=8835;e.proportion=8759;e.proportional=8733;e.psi=968;e.psicyrillic=1137;e.psilipneumatacyrilliccmb=1158;e.pssquare=13232;e.puhiragana=12407;e.pukatakana=12503;e.pvsquare=13236;e.pwsquare=13242;e.q=113;e.qadeva=2392;e.qadmahebrew=1448;e.qafarabic=1602;e.qaffinalarabic=65238;e.qafinitialarabic=65239;e.qafmedialarabic=65240;e.qamats=1464;e.qamats10=1464;e.qamats1a=1464;e.qamats1c=1464;e.qamats27=1464;e.qamats29=1464;e.qamats33=1464;e.qamatsde=1464;e.qamatshebrew=1464;e.qamatsnarrowhebrew=1464;e.qamatsqatanhebrew=1464;e.qamatsqatannarrowhebrew=1464;e.qamatsqatanquarterhebrew=1464;e.qamatsqatanwidehebrew=1464;e.qamatsquarterhebrew=1464;e.qamatswidehebrew=1464;e.qarneyparahebrew=1439;e.qbopomofo=12561;e.qcircle=9440;e.qhook=672;e.qmonospace=65361;e.qof=1511;e.qofdagesh=64327;e.qofdageshhebrew=64327;e.qofhebrew=1511;e.qparen=9388;e.quarternote=9833;e.qubuts=1467;e.qubuts18=1467;e.qubuts25=1467;e.qubuts31=1467;e.qubutshebrew=1467;e.qubutsnarrowhebrew=1467;e.qubutsquarterhebrew=1467;e.qubutswidehebrew=1467;e.question=63;e.questionarabic=1567;e.questionarmenian=1374;e.questiondown=191;e.questiondownsmall=63423;e.questiongreek=894;e.questionmonospace=65311;e.questionsmall=63295;e.quotedbl=34;e.quotedblbase=8222;e.quotedblleft=8220;e.quotedblmonospace=65282;e.quotedblprime=12318;e.quotedblprimereversed=12317;e.quotedblright=8221;e.quoteleft=8216;e.quoteleftreversed=8219;e.quotereversed=8219;e.quoteright=8217;e.quoterightn=329;e.quotesinglbase=8218;e.quotesingle=39;e.quotesinglemonospace=65287;e.r=114;e.raarmenian=1404;e.rabengali=2480;e.racute=341;e.radeva=2352;e.radical=8730;e.radicalex=63717;e.radoverssquare=13230;e.radoverssquaredsquare=13231;e.radsquare=13229;e.rafe=1471;e.rafehebrew=1471;e.ragujarati=2736;e.ragurmukhi=2608;e.rahiragana=12425;e.rakatakana=12521;e.rakatakanahalfwidth=65431;e.ralowerdiagonalbengali=2545;e.ramiddlediagonalbengali=2544;e.ramshorn=612;e.ratio=8758;e.rbopomofo=12566;e.rcaron=345;e.rcedilla=343;e.rcircle=9441;e.rcommaaccent=343;e.rdblgrave=529;e.rdotaccent=7769;e.rdotbelow=7771;e.rdotbelowmacron=7773;e.referencemark=8251;e.reflexsubset=8838;e.reflexsuperset=8839;e.registered=174;e.registersans=63720;e.registerserif=63194;e.reharabic=1585;e.reharmenian=1408;e.rehfinalarabic=65198;e.rehiragana=12428;e.rekatakana=12524;e.rekatakanahalfwidth=65434;e.resh=1512;e.reshdageshhebrew=64328;e.reshhebrew=1512;e.reversedtilde=8765;e.reviahebrew=1431;e.reviamugrashhebrew=1431;e.revlogicalnot=8976;e.rfishhook=638;e.rfishhookreversed=639;e.rhabengali=2525;e.rhadeva=2397;e.rho=961;e.rhook=637;e.rhookturned=635;e.rhookturnedsuperior=693;e.rhosymbolgreek=1009;e.rhotichookmod=734;e.rieulacirclekorean=12913;e.rieulaparenkorean=12817;e.rieulcirclekorean=12899;e.rieulhieuhkorean=12608;e.rieulkiyeokkorean=12602;e.rieulkiyeoksioskorean=12649;e.rieulkorean=12601;e.rieulmieumkorean=12603;e.rieulpansioskorean=12652;e.rieulparenkorean=12803;e.rieulphieuphkorean=12607;e.rieulpieupkorean=12604;e.rieulpieupsioskorean=12651;e.rieulsioskorean=12605;e.rieulthieuthkorean=12606;e.rieultikeutkorean=12650;e.rieulyeorinhieuhkorean=12653;e.rightangle=8735;e.righttackbelowcmb=793;e.righttriangle=8895;e.rihiragana=12426;e.rikatakana=12522;e.rikatakanahalfwidth=65432;e.ring=730;e.ringbelowcmb=805;e.ringcmb=778;e.ringhalfleft=703;e.ringhalfleftarmenian=1369;e.ringhalfleftbelowcmb=796;e.ringhalfleftcentered=723;e.ringhalfright=702;e.ringhalfrightbelowcmb=825;e.ringhalfrightcentered=722;e.rinvertedbreve=531;e.rittorusquare=13137;e.rlinebelow=7775;e.rlongleg=636;e.rlonglegturned=634;e.rmonospace=65362;e.rohiragana=12429;e.rokatakana=12525;e.rokatakanahalfwidth=65435;e.roruathai=3619;e.rparen=9389;e.rrabengali=2524;e.rradeva=2353;e.rragurmukhi=2652;e.rreharabic=1681;e.rrehfinalarabic=64397;e.rrvocalicbengali=2528;e.rrvocalicdeva=2400;e.rrvocalicgujarati=2784;e.rrvocalicvowelsignbengali=2500;e.rrvocalicvowelsigndeva=2372;e.rrvocalicvowelsigngujarati=2756;e.rsuperior=63217;e.rtblock=9616;e.rturned=633;e.rturnedsuperior=692;e.ruhiragana=12427;e.rukatakana=12523;e.rukatakanahalfwidth=65433;e.rupeemarkbengali=2546;e.rupeesignbengali=2547;e.rupiah=63197;e.ruthai=3620;e.rvocalicbengali=2443;e.rvocalicdeva=2315;e.rvocalicgujarati=2699;e.rvocalicvowelsignbengali=2499;e.rvocalicvowelsigndeva=2371;e.rvocalicvowelsigngujarati=2755;e.s=115;e.sabengali=2488;e.sacute=347;e.sacutedotaccent=7781;e.sadarabic=1589;e.sadeva=2360;e.sadfinalarabic=65210;e.sadinitialarabic=65211;e.sadmedialarabic=65212;e.sagujarati=2744;e.sagurmukhi=2616;e.sahiragana=12373;e.sakatakana=12469;e.sakatakanahalfwidth=65403;e.sallallahoualayhewasallamarabic=65018;e.samekh=1505;e.samekhdagesh=64321;e.samekhdageshhebrew=64321;e.samekhhebrew=1505;e.saraaathai=3634;e.saraaethai=3649;e.saraaimaimalaithai=3652;e.saraaimaimuanthai=3651;e.saraamthai=3635;e.saraathai=3632;e.saraethai=3648;e.saraiileftthai=63622;e.saraiithai=3637;e.saraileftthai=63621;e.saraithai=3636;e.saraothai=3650;e.saraueeleftthai=63624;e.saraueethai=3639;e.saraueleftthai=63623;e.sarauethai=3638;e.sarauthai=3640;e.sarauuthai=3641;e.sbopomofo=12569;e.scaron=353;e.scarondotaccent=7783;e.scedilla=351;e.schwa=601;e.schwacyrillic=1241;e.schwadieresiscyrillic=1243;e.schwahook=602;e.scircle=9442;e.scircumflex=349;e.scommaaccent=537;e.sdotaccent=7777;e.sdotbelow=7779;e.sdotbelowdotaccent=7785;e.seagullbelowcmb=828;e.second=8243;e.secondtonechinese=714;e.section=167;e.seenarabic=1587;e.seenfinalarabic=65202;e.seeninitialarabic=65203;e.seenmedialarabic=65204;e.segol=1462;e.segol13=1462;e.segol1f=1462;e.segol2c=1462;e.segolhebrew=1462;e.segolnarrowhebrew=1462;e.segolquarterhebrew=1462;e.segoltahebrew=1426;e.segolwidehebrew=1462;e.seharmenian=1405;e.sehiragana=12379;e.sekatakana=12475;e.sekatakanahalfwidth=65406;e.semicolon=59;e.semicolonarabic=1563;e.semicolonmonospace=65307;e.semicolonsmall=65108;e.semivoicedmarkkana=12444;e.semivoicedmarkkanahalfwidth=65439;e.sentisquare=13090;e.sentosquare=13091;e.seven=55;e.sevenarabic=1639;e.sevenbengali=2541;e.sevencircle=9318;e.sevencircleinversesansserif=10128;e.sevendeva=2413;e.seveneighths=8542;e.sevengujarati=2797;e.sevengurmukhi=2669;e.sevenhackarabic=1639;e.sevenhangzhou=12327;e.sevenideographicparen=12838;e.seveninferior=8327;e.sevenmonospace=65303;e.sevenoldstyle=63287;e.sevenparen=9338;e.sevenperiod=9358;e.sevenpersian=1783;e.sevenroman=8566;e.sevensuperior=8311;e.seventeencircle=9328;e.seventeenparen=9348;e.seventeenperiod=9368;e.seventhai=3671;e.sfthyphen=173;e.shaarmenian=1399;e.shabengali=2486;e.shacyrillic=1096;e.shaddaarabic=1617;e.shaddadammaarabic=64609;e.shaddadammatanarabic=64606;e.shaddafathaarabic=64608;e.shaddakasraarabic=64610;e.shaddakasratanarabic=64607;e.shade=9618;e.shadedark=9619;e.shadelight=9617;e.shademedium=9618;e.shadeva=2358;e.shagujarati=2742;e.shagurmukhi=2614;e.shalshelethebrew=1427;e.shbopomofo=12565;e.shchacyrillic=1097;e.sheenarabic=1588;e.sheenfinalarabic=65206;e.sheeninitialarabic=65207;e.sheenmedialarabic=65208;e.sheicoptic=995;e.sheqel=8362;e.sheqelhebrew=8362;e.sheva=1456;e.sheva115=1456;e.sheva15=1456;e.sheva22=1456;e.sheva2e=1456;e.shevahebrew=1456;e.shevanarrowhebrew=1456;e.shevaquarterhebrew=1456;e.shevawidehebrew=1456;e.shhacyrillic=1211;e.shimacoptic=1005;e.shin=1513;e.shindagesh=64329;e.shindageshhebrew=64329;e.shindageshshindot=64300;e.shindageshshindothebrew=64300;e.shindageshsindot=64301;e.shindageshsindothebrew=64301;e.shindothebrew=1473;e.shinhebrew=1513;e.shinshindot=64298;e.shinshindothebrew=64298;e.shinsindot=64299;e.shinsindothebrew=64299;e.shook=642;e.sigma=963;e.sigma1=962;e.sigmafinal=962;e.sigmalunatesymbolgreek=1010;e.sihiragana=12375;e.sikatakana=12471;e.sikatakanahalfwidth=65404;e.siluqhebrew=1469;e.siluqlefthebrew=1469;e.similar=8764;e.sindothebrew=1474;e.siosacirclekorean=12916;e.siosaparenkorean=12820;e.sioscieuckorean=12670;e.sioscirclekorean=12902;e.sioskiyeokkorean=12666;e.sioskorean=12613;e.siosnieunkorean=12667;e.siosparenkorean=12806;e.siospieupkorean=12669;e.siostikeutkorean=12668;e.six=54;e.sixarabic=1638;e.sixbengali=2540;e.sixcircle=9317;e.sixcircleinversesansserif=10127;e.sixdeva=2412;e.sixgujarati=2796;e.sixgurmukhi=2668;e.sixhackarabic=1638;e.sixhangzhou=12326;e.sixideographicparen=12837;e.sixinferior=8326;e.sixmonospace=65302;e.sixoldstyle=63286;e.sixparen=9337;e.sixperiod=9357;e.sixpersian=1782;e.sixroman=8565;e.sixsuperior=8310;e.sixteencircle=9327;e.sixteencurrencydenominatorbengali=2553;e.sixteenparen=9347;e.sixteenperiod=9367;e.sixthai=3670;e.slash=47;e.slashmonospace=65295;e.slong=383;e.slongdotaccent=7835;e.smileface=9786;e.smonospace=65363;e.sofpasuqhebrew=1475;e.softhyphen=173;e.softsigncyrillic=1100;e.sohiragana=12381;e.sokatakana=12477;e.sokatakanahalfwidth=65407;e.soliduslongoverlaycmb=824;e.solidusshortoverlaycmb=823;e.sorusithai=3625;e.sosalathai=3624;e.sosothai=3595;e.sosuathai=3626;e.space=32;e.spacehackarabic=32;e.spade=9824;e.spadesuitblack=9824;e.spadesuitwhite=9828;e.sparen=9390;e.squarebelowcmb=827;e.squarecc=13252;e.squarecm=13213;e.squarediagonalcrosshatchfill=9641;e.squarehorizontalfill=9636;e.squarekg=13199;e.squarekm=13214;e.squarekmcapital=13262;e.squareln=13265;e.squarelog=13266;e.squaremg=13198;e.squaremil=13269;e.squaremm=13212;e.squaremsquared=13217;e.squareorthogonalcrosshatchfill=9638;e.squareupperlefttolowerrightfill=9639;e.squareupperrighttolowerleftfill=9640;e.squareverticalfill=9637;e.squarewhitewithsmallblack=9635;e.srsquare=13275;e.ssabengali=2487;e.ssadeva=2359;e.ssagujarati=2743;e.ssangcieuckorean=12617;e.ssanghieuhkorean=12677;e.ssangieungkorean=12672;e.ssangkiyeokkorean=12594;e.ssangnieunkorean=12645;e.ssangpieupkorean=12611;e.ssangsioskorean=12614;e.ssangtikeutkorean=12600;e.ssuperior=63218;e.sterling=163;e.sterlingmonospace=65505;e.strokelongoverlaycmb=822;e.strokeshortoverlaycmb=821;e.subset=8834;e.subsetnotequal=8842;e.subsetorequal=8838;e.succeeds=8827;e.suchthat=8715;e.suhiragana=12377;e.sukatakana=12473;e.sukatakanahalfwidth=65405;e.sukunarabic=1618;e.summation=8721;e.sun=9788;e.superset=8835;e.supersetnotequal=8843;e.supersetorequal=8839;e.svsquare=13276;e.syouwaerasquare=13180;e.t=116;e.tabengali=2468;e.tackdown=8868;e.tackleft=8867;e.tadeva=2340;e.tagujarati=2724;e.tagurmukhi=2596;e.taharabic=1591;e.tahfinalarabic=65218;e.tahinitialarabic=65219;e.tahiragana=12383;e.tahmedialarabic=65220;e.taisyouerasquare=13181;e.takatakana=12479;e.takatakanahalfwidth=65408;e.tatweelarabic=1600;e.tau=964;e.tav=1514;e.tavdages=64330;e.tavdagesh=64330;e.tavdageshhebrew=64330;e.tavhebrew=1514;e.tbar=359;e.tbopomofo=12554;e.tcaron=357;e.tccurl=680;e.tcedilla=355;e.tcheharabic=1670;e.tchehfinalarabic=64379;e.tchehinitialarabic=64380;e.tchehmedialarabic=64381;e.tcircle=9443;e.tcircumflexbelow=7793;e.tcommaaccent=355;e.tdieresis=7831;e.tdotaccent=7787;e.tdotbelow=7789;e.tecyrillic=1090;e.tedescendercyrillic=1197;e.teharabic=1578;e.tehfinalarabic=65174;e.tehhahinitialarabic=64674;e.tehhahisolatedarabic=64524;e.tehinitialarabic=65175;e.tehiragana=12390;e.tehjeeminitialarabic=64673;e.tehjeemisolatedarabic=64523;e.tehmarbutaarabic=1577;e.tehmarbutafinalarabic=65172;e.tehmedialarabic=65176;e.tehmeeminitialarabic=64676;e.tehmeemisolatedarabic=64526;e.tehnoonfinalarabic=64627;e.tekatakana=12486;e.tekatakanahalfwidth=65411;e.telephone=8481;e.telephoneblack=9742;e.telishagedolahebrew=1440;e.telishaqetanahebrew=1449;e.tencircle=9321;e.tenideographicparen=12841;e.tenparen=9341;e.tenperiod=9361;e.tenroman=8569;e.tesh=679;e.tet=1496;e.tetdagesh=64312;e.tetdageshhebrew=64312;e.tethebrew=1496;e.tetsecyrillic=1205;e.tevirhebrew=1435;e.tevirlefthebrew=1435;e.thabengali=2469;e.thadeva=2341;e.thagujarati=2725;e.thagurmukhi=2597;e.thalarabic=1584;e.thalfinalarabic=65196;e.thanthakhatlowleftthai=63640;e.thanthakhatlowrightthai=63639;e.thanthakhatthai=3660;e.thanthakhatupperleftthai=63638;e.theharabic=1579;e.thehfinalarabic=65178;e.thehinitialarabic=65179;e.thehmedialarabic=65180;e.thereexists=8707;e.therefore=8756;e.theta=952;e.theta1=977;e.thetasymbolgreek=977;e.thieuthacirclekorean=12921;e.thieuthaparenkorean=12825;e.thieuthcirclekorean=12907;e.thieuthkorean=12620;e.thieuthparenkorean=12811;e.thirteencircle=9324;e.thirteenparen=9344;e.thirteenperiod=9364;e.thonangmonthothai=3601;e.thook=429;e.thophuthaothai=3602;e.thorn=254;e.thothahanthai=3607;e.thothanthai=3600;e.thothongthai=3608;e.thothungthai=3606;e.thousandcyrillic=1154;e.thousandsseparatorarabic=1644;e.thousandsseparatorpersian=1644;e.three=51;e.threearabic=1635;e.threebengali=2537;e.threecircle=9314;e.threecircleinversesansserif=10124;e.threedeva=2409;e.threeeighths=8540;e.threegujarati=2793;e.threegurmukhi=2665;e.threehackarabic=1635;e.threehangzhou=12323;e.threeideographicparen=12834;e.threeinferior=8323;e.threemonospace=65299;e.threenumeratorbengali=2550;e.threeoldstyle=63283;e.threeparen=9334;e.threeperiod=9354;e.threepersian=1779;e.threequarters=190;e.threequartersemdash=63198;e.threeroman=8562;e.threesuperior=179;e.threethai=3667;e.thzsquare=13204;e.tihiragana=12385;e.tikatakana=12481;e.tikatakanahalfwidth=65409;e.tikeutacirclekorean=12912;e.tikeutaparenkorean=12816;e.tikeutcirclekorean=12898;e.tikeutkorean=12599;e.tikeutparenkorean=12802;e.tilde=732;e.tildebelowcmb=816;e.tildecmb=771;e.tildecomb=771;e.tildedoublecmb=864;e.tildeoperator=8764;e.tildeoverlaycmb=820;e.tildeverticalcmb=830;e.timescircle=8855;e.tipehahebrew=1430;e.tipehalefthebrew=1430;e.tippigurmukhi=2672;e.titlocyrilliccmb=1155;e.tiwnarmenian=1407;e.tlinebelow=7791;e.tmonospace=65364;e.toarmenian=1385;e.tohiragana=12392;e.tokatakana=12488;e.tokatakanahalfwidth=65412;e.tonebarextrahighmod=741;e.tonebarextralowmod=745;e.tonebarhighmod=742;e.tonebarlowmod=744;e.tonebarmidmod=743;e.tonefive=445;e.tonesix=389;e.tonetwo=424;e.tonos=900;e.tonsquare=13095;e.topatakthai=3599;e.tortoiseshellbracketleft=12308;e.tortoiseshellbracketleftsmall=65117;e.tortoiseshellbracketleftvertical=65081;e.tortoiseshellbracketright=12309;e.tortoiseshellbracketrightsmall=65118;e.tortoiseshellbracketrightvertical=65082;e.totaothai=3605;e.tpalatalhook=427;e.tparen=9391;e.trademark=8482;e.trademarksans=63722;e.trademarkserif=63195;e.tretroflexhook=648;e.triagdn=9660;e.triaglf=9668;e.triagrt=9658;e.triagup=9650;e.ts=678;e.tsadi=1510;e.tsadidagesh=64326;e.tsadidageshhebrew=64326;e.tsadihebrew=1510;e.tsecyrillic=1094;e.tsere=1461;e.tsere12=1461;e.tsere1e=1461;e.tsere2b=1461;e.tserehebrew=1461;e.tserenarrowhebrew=1461;e.tserequarterhebrew=1461;e.tserewidehebrew=1461;e.tshecyrillic=1115;e.tsuperior=63219;e.ttabengali=2463;e.ttadeva=2335;e.ttagujarati=2719;e.ttagurmukhi=2591;e.tteharabic=1657;e.ttehfinalarabic=64359;e.ttehinitialarabic=64360;e.ttehmedialarabic=64361;e.tthabengali=2464;e.tthadeva=2336;e.tthagujarati=2720;e.tthagurmukhi=2592;e.tturned=647;e.tuhiragana=12388;e.tukatakana=12484;e.tukatakanahalfwidth=65410;e.tusmallhiragana=12387;e.tusmallkatakana=12483;e.tusmallkatakanahalfwidth=65391;e.twelvecircle=9323;e.twelveparen=9343;e.twelveperiod=9363;e.twelveroman=8571;e.twentycircle=9331;e.twentyhangzhou=21316;e.twentyparen=9351;e.twentyperiod=9371;e.two=50;e.twoarabic=1634;e.twobengali=2536;e.twocircle=9313;e.twocircleinversesansserif=10123;e.twodeva=2408;e.twodotenleader=8229;e.twodotleader=8229;e.twodotleadervertical=65072;e.twogujarati=2792;e.twogurmukhi=2664;e.twohackarabic=1634;e.twohangzhou=12322;e.twoideographicparen=12833;e.twoinferior=8322;e.twomonospace=65298;e.twonumeratorbengali=2549;e.twooldstyle=63282;e.twoparen=9333;e.twoperiod=9353;e.twopersian=1778;e.tworoman=8561;e.twostroke=443;e.twosuperior=178;e.twothai=3666;e.twothirds=8532;e.u=117;e.uacute=250;e.ubar=649;e.ubengali=2441;e.ubopomofo=12584;e.ubreve=365;e.ucaron=468;e.ucircle=9444;e.ucircumflex=251;e.ucircumflexbelow=7799;e.ucyrillic=1091;e.udattadeva=2385;e.udblacute=369;e.udblgrave=533;e.udeva=2313;e.udieresis=252;e.udieresisacute=472;e.udieresisbelow=7795;e.udieresiscaron=474;e.udieresiscyrillic=1265;e.udieresisgrave=476;e.udieresismacron=470;e.udotbelow=7909;e.ugrave=249;e.ugujarati=2697;e.ugurmukhi=2569;e.uhiragana=12358;e.uhookabove=7911;e.uhorn=432;e.uhornacute=7913;e.uhorndotbelow=7921;e.uhorngrave=7915;e.uhornhookabove=7917;e.uhorntilde=7919;e.uhungarumlaut=369;e.uhungarumlautcyrillic=1267;e.uinvertedbreve=535;e.ukatakana=12454;e.ukatakanahalfwidth=65395;e.ukcyrillic=1145;e.ukorean=12636;e.umacron=363;e.umacroncyrillic=1263;e.umacrondieresis=7803;e.umatragurmukhi=2625;e.umonospace=65365;e.underscore=95;e.underscoredbl=8215;e.underscoremonospace=65343;e.underscorevertical=65075;e.underscorewavy=65103;e.union=8746;e.universal=8704;e.uogonek=371;e.uparen=9392;e.upblock=9600;e.upperdothebrew=1476;e.upsilon=965;e.upsilondieresis=971;e.upsilondieresistonos=944;e.upsilonlatin=650;e.upsilontonos=973;e.uptackbelowcmb=797;e.uptackmod=724;e.uragurmukhi=2675;e.uring=367;e.ushortcyrillic=1118;e.usmallhiragana=12357;e.usmallkatakana=12453;e.usmallkatakanahalfwidth=65385;e.ustraightcyrillic=1199;e.ustraightstrokecyrillic=1201;e.utilde=361;e.utildeacute=7801;e.utildebelow=7797;e.uubengali=2442;e.uudeva=2314;e.uugujarati=2698;e.uugurmukhi=2570;e.uumatragurmukhi=2626;e.uuvowelsignbengali=2498;e.uuvowelsigndeva=2370;e.uuvowelsigngujarati=2754;e.uvowelsignbengali=2497;e.uvowelsigndeva=2369;e.uvowelsigngujarati=2753;e.v=118;e.vadeva=2357;e.vagujarati=2741;e.vagurmukhi=2613;e.vakatakana=12535;e.vav=1493;e.vavdagesh=64309;e.vavdagesh65=64309;e.vavdageshhebrew=64309;e.vavhebrew=1493;e.vavholam=64331;e.vavholamhebrew=64331;e.vavvavhebrew=1520;e.vavyodhebrew=1521;e.vcircle=9445;e.vdotbelow=7807;e.vecyrillic=1074;e.veharabic=1700;e.vehfinalarabic=64363;e.vehinitialarabic=64364;e.vehmedialarabic=64365;e.vekatakana=12537;e.venus=9792;e.verticalbar=124;e.verticallineabovecmb=781;e.verticallinebelowcmb=809;e.verticallinelowmod=716;e.verticallinemod=712;e.vewarmenian=1406;e.vhook=651;e.vikatakana=12536;e.viramabengali=2509;e.viramadeva=2381;e.viramagujarati=2765;e.visargabengali=2435;e.visargadeva=2307;e.visargagujarati=2691;e.vmonospace=65366;e.voarmenian=1400;e.voicediterationhiragana=12446;e.voicediterationkatakana=12542;e.voicedmarkkana=12443;e.voicedmarkkanahalfwidth=65438;e.vokatakana=12538;e.vparen=9393;e.vtilde=7805;e.vturned=652;e.vuhiragana=12436;e.vukatakana=12532;e.w=119;e.wacute=7811;e.waekorean=12633;e.wahiragana=12431;e.wakatakana=12527;e.wakatakanahalfwidth=65436;e.wakorean=12632;e.wasmallhiragana=12430;e.wasmallkatakana=12526;e.wattosquare=13143;e.wavedash=12316;e.wavyunderscorevertical=65076;e.wawarabic=1608;e.wawfinalarabic=65262;e.wawhamzaabovearabic=1572;e.wawhamzaabovefinalarabic=65158;e.wbsquare=13277;e.wcircle=9446;e.wcircumflex=373;e.wdieresis=7813;e.wdotaccent=7815;e.wdotbelow=7817;e.wehiragana=12433;e.weierstrass=8472;e.wekatakana=12529;e.wekorean=12638;e.weokorean=12637;e.wgrave=7809;e.whitebullet=9702;e.whitecircle=9675;e.whitecircleinverse=9689;e.whitecornerbracketleft=12302;e.whitecornerbracketleftvertical=65091;e.whitecornerbracketright=12303;e.whitecornerbracketrightvertical=65092;e.whitediamond=9671;e.whitediamondcontainingblacksmalldiamond=9672;e.whitedownpointingsmalltriangle=9663;e.whitedownpointingtriangle=9661;e.whiteleftpointingsmalltriangle=9667;e.whiteleftpointingtriangle=9665;e.whitelenticularbracketleft=12310;e.whitelenticularbracketright=12311;e.whiterightpointingsmalltriangle=9657;e.whiterightpointingtriangle=9655;e.whitesmallsquare=9643;e.whitesmilingface=9786;e.whitesquare=9633;e.whitestar=9734;e.whitetelephone=9743;e.whitetortoiseshellbracketleft=12312;e.whitetortoiseshellbracketright=12313;e.whiteuppointingsmalltriangle=9653;e.whiteuppointingtriangle=9651;e.wihiragana=12432;e.wikatakana=12528;e.wikorean=12639;e.wmonospace=65367;e.wohiragana=12434;e.wokatakana=12530;e.wokatakanahalfwidth=65382;e.won=8361;e.wonmonospace=65510;e.wowaenthai=3623;e.wparen=9394;e.wring=7832;e.wsuperior=695;e.wturned=653;e.wynn=447;e.x=120;e.xabovecmb=829;e.xbopomofo=12562;e.xcircle=9447;e.xdieresis=7821;e.xdotaccent=7819;e.xeharmenian=1389;e.xi=958;e.xmonospace=65368;e.xparen=9395;e.xsuperior=739;e.y=121;e.yaadosquare=13134;e.yabengali=2479;e.yacute=253;e.yadeva=2351;e.yaekorean=12626;e.yagujarati=2735;e.yagurmukhi=2607;e.yahiragana=12420;e.yakatakana=12516;e.yakatakanahalfwidth=65428;e.yakorean=12625;e.yamakkanthai=3662;e.yasmallhiragana=12419;e.yasmallkatakana=12515;e.yasmallkatakanahalfwidth=65388;e.yatcyrillic=1123;e.ycircle=9448;e.ycircumflex=375;e.ydieresis=255;e.ydotaccent=7823;e.ydotbelow=7925;e.yeharabic=1610;e.yehbarreearabic=1746;e.yehbarreefinalarabic=64431;e.yehfinalarabic=65266;e.yehhamzaabovearabic=1574;e.yehhamzaabovefinalarabic=65162;e.yehhamzaaboveinitialarabic=65163;e.yehhamzaabovemedialarabic=65164;e.yehinitialarabic=65267;e.yehmedialarabic=65268;e.yehmeeminitialarabic=64733;e.yehmeemisolatedarabic=64600;e.yehnoonfinalarabic=64660;e.yehthreedotsbelowarabic=1745;e.yekorean=12630;e.yen=165;e.yenmonospace=65509;e.yeokorean=12629;e.yeorinhieuhkorean=12678;e.yerahbenyomohebrew=1450;e.yerahbenyomolefthebrew=1450;e.yericyrillic=1099;e.yerudieresiscyrillic=1273;e.yesieungkorean=12673;e.yesieungpansioskorean=12675;e.yesieungsioskorean=12674;e.yetivhebrew=1434;e.ygrave=7923;e.yhook=436;e.yhookabove=7927;e.yiarmenian=1397;e.yicyrillic=1111;e.yikorean=12642;e.yinyang=9775;e.yiwnarmenian=1410;e.ymonospace=65369;e.yod=1497;e.yoddagesh=64313;e.yoddageshhebrew=64313;e.yodhebrew=1497;e.yodyodhebrew=1522;e.yodyodpatahhebrew=64287;e.yohiragana=12424;e.yoikorean=12681;e.yokatakana=12520;e.yokatakanahalfwidth=65430;e.yokorean=12635;e.yosmallhiragana=12423;e.yosmallkatakana=12519;e.yosmallkatakanahalfwidth=65390;e.yotgreek=1011;e.yoyaekorean=12680;e.yoyakorean=12679;e.yoyakthai=3618;e.yoyingthai=3597;e.yparen=9396;e.ypogegrammeni=890;e.ypogegrammenigreekcmb=837;e.yr=422;e.yring=7833;e.ysuperior=696;e.ytilde=7929;e.yturned=654;e.yuhiragana=12422;e.yuikorean=12684;e.yukatakana=12518;e.yukatakanahalfwidth=65429;e.yukorean=12640;e.yusbigcyrillic=1131;e.yusbigiotifiedcyrillic=1133;e.yuslittlecyrillic=1127;e.yuslittleiotifiedcyrillic=1129;e.yusmallhiragana=12421;e.yusmallkatakana=12517;e.yusmallkatakanahalfwidth=65389;e.yuyekorean=12683;e.yuyeokorean=12682;e.yyabengali=2527;e.yyadeva=2399;e.z=122;e.zaarmenian=1382;e.zacute=378;e.zadeva=2395;e.zagurmukhi=2651;e.zaharabic=1592;e.zahfinalarabic=65222;e.zahinitialarabic=65223;e.zahiragana=12374;e.zahmedialarabic=65224;e.zainarabic=1586;e.zainfinalarabic=65200;e.zakatakana=12470;e.zaqefgadolhebrew=1429;e.zaqefqatanhebrew=1428;e.zarqahebrew=1432;e.zayin=1494;e.zayindagesh=64310;e.zayindageshhebrew=64310;e.zayinhebrew=1494;e.zbopomofo=12567;e.zcaron=382;e.zcircle=9449;e.zcircumflex=7825;e.zcurl=657;e.zdot=380;e.zdotaccent=380;e.zdotbelow=7827;e.zecyrillic=1079;e.zedescendercyrillic=1177;e.zedieresiscyrillic=1247;e.zehiragana=12380;e.zekatakana=12476;e.zero=48;e.zeroarabic=1632;e.zerobengali=2534;e.zerodeva=2406;e.zerogujarati=2790;e.zerogurmukhi=2662;e.zerohackarabic=1632;e.zeroinferior=8320;e.zeromonospace=65296;e.zerooldstyle=63280;e.zeropersian=1776;e.zerosuperior=8304;e.zerothai=3664;e.zerowidthjoiner=65279;e.zerowidthnonjoiner=8204;e.zerowidthspace=8203;e.zeta=950;e.zhbopomofo=12563;e.zhearmenian=1386;e.zhebrevecyrillic=1218;e.zhecyrillic=1078;e.zhedescendercyrillic=1175;e.zhedieresiscyrillic=1245;e.zihiragana=12376;e.zikatakana=12472;e.zinorhebrew=1454;e.zlinebelow=7829;e.zmonospace=65370;e.zohiragana=12382;e.zokatakana=12478;e.zparen=9397;e.zretroflexhook=656;e.zstroke=438;e.zuhiragana=12378;e.zukatakana=12474;e[".notdef"]=0;e.angbracketleftbig=9001;e.angbracketleftBig=9001;e.angbracketleftbigg=9001;e.angbracketleftBigg=9001;e.angbracketrightBig=9002;e.angbracketrightbig=9002;e.angbracketrightBigg=9002;e.angbracketrightbigg=9002;e.arrowhookleft=8618;e.arrowhookright=8617;e.arrowlefttophalf=8636;e.arrowleftbothalf=8637;e.arrownortheast=8599;e.arrownorthwest=8598;e.arrowrighttophalf=8640;e.arrowrightbothalf=8641;e.arrowsoutheast=8600;e.arrowsouthwest=8601;e.backslashbig=8726;e.backslashBig=8726;e.backslashBigg=8726;e.backslashbigg=8726;e.bardbl=8214;e.bracehtipdownleft=65079;e.bracehtipdownright=65079;e.bracehtipupleft=65080;e.bracehtipupright=65080;e.braceleftBig=123;e.braceleftbig=123;e.braceleftbigg=123;e.braceleftBigg=123;e.bracerightBig=125;e.bracerightbig=125;e.bracerightbigg=125;e.bracerightBigg=125;e.bracketleftbig=91;e.bracketleftBig=91;e.bracketleftbigg=91;e.bracketleftBigg=91;e.bracketrightBig=93;e.bracketrightbig=93;e.bracketrightbigg=93;e.bracketrightBigg=93;e.ceilingleftbig=8968;e.ceilingleftBig=8968;e.ceilingleftBigg=8968;e.ceilingleftbigg=8968;e.ceilingrightbig=8969;e.ceilingrightBig=8969;e.ceilingrightbigg=8969;e.ceilingrightBigg=8969;e.circledotdisplay=8857;e.circledottext=8857;e.circlemultiplydisplay=8855;e.circlemultiplytext=8855;e.circleplusdisplay=8853;e.circleplustext=8853;e.contintegraldisplay=8750;e.contintegraltext=8750;e.coproductdisplay=8720;e.coproducttext=8720;e.floorleftBig=8970;e.floorleftbig=8970;e.floorleftbigg=8970;e.floorleftBigg=8970;e.floorrightbig=8971;e.floorrightBig=8971;e.floorrightBigg=8971;e.floorrightbigg=8971;e.hatwide=770;e.hatwider=770;e.hatwidest=770;e.intercal=7488;e.integraldisplay=8747;e.integraltext=8747;e.intersectiondisplay=8898;e.intersectiontext=8898;e.logicalanddisplay=8743;e.logicalandtext=8743;e.logicalordisplay=8744;e.logicalortext=8744;e.parenleftBig=40;e.parenleftbig=40;e.parenleftBigg=40;e.parenleftbigg=40;e.parenrightBig=41;e.parenrightbig=41;e.parenrightBigg=41;e.parenrightbigg=41;e.prime=8242;e.productdisplay=8719;e.producttext=8719;e.radicalbig=8730;e.radicalBig=8730;e.radicalBigg=8730;e.radicalbigg=8730;e.radicalbt=8730;e.radicaltp=8730;e.radicalvertex=8730;e.slashbig=47;e.slashBig=47;e.slashBigg=47;e.slashbigg=47;e.summationdisplay=8721;e.summationtext=8721;e.tildewide=732;e.tildewider=732;e.tildewidest=732;e.uniondisplay=8899;e.unionmultidisplay=8846;e.unionmultitext=8846;e.unionsqdisplay=8852;e.unionsqtext=8852;e.uniontext=8899;e.vextenddouble=8741;e.vextendsingle=8739}),n=a(function(e){e.space=32;e.a1=9985;e.a2=9986;e.a202=9987;e.a3=9988;e.a4=9742;e.a5=9990;e.a119=9991;e.a118=9992;e.a117=9993;e.a11=9755;e.a12=9758;e.a13=9996;e.a14=9997;e.a15=9998;e.a16=9999;e.a105=1e4;e.a17=10001;e.a18=10002;e.a19=10003;e.a20=10004;e.a21=10005;e.a22=10006;e.a23=10007;e.a24=10008;e.a25=10009;e.a26=10010;e.a27=10011;e.a28=10012;e.a6=10013;e.a7=10014;e.a8=10015;e.a9=10016;e.a10=10017;e.a29=10018;e.a30=10019;e.a31=10020;e.a32=10021;e.a33=10022;e.a34=10023;e.a35=9733;e.a36=10025;e.a37=10026;e.a38=10027;e.a39=10028;e.a40=10029;e.a41=10030;e.a42=10031;e.a43=10032;e.a44=10033;e.a45=10034;e.a46=10035;e.a47=10036;e.a48=10037;e.a49=10038;e.a50=10039;e.a51=10040;e.a52=10041;e.a53=10042;e.a54=10043;e.a55=10044;e.a56=10045;e.a57=10046;e.a58=10047;e.a59=10048;e.a60=10049;e.a61=10050;e.a62=10051;e.a63=10052;e.a64=10053;e.a65=10054;e.a66=10055;e.a67=10056;e.a68=10057;e.a69=10058;e.a70=10059;e.a71=9679;e.a72=10061;e.a73=9632;e.a74=10063;e.a203=10064;e.a75=10065;e.a204=10066;e.a76=9650;e.a77=9660;e.a78=9670;e.a79=10070;e.a81=9687;e.a82=10072;e.a83=10073;e.a84=10074;e.a97=10075;e.a98=10076;e.a99=10077;e.a100=10078;e.a101=10081;e.a102=10082;e.a103=10083;e.a104=10084;e.a106=10085;e.a107=10086;e.a108=10087;e.a112=9827;e.a111=9830;e.a110=9829;e.a109=9824;e.a120=9312;e.a121=9313;e.a122=9314;e.a123=9315;e.a124=9316;e.a125=9317;e.a126=9318;e.a127=9319;e.a128=9320;e.a129=9321;e.a130=10102;e.a131=10103;e.a132=10104;e.a133=10105;e.a134=10106;e.a135=10107;e.a136=10108;e.a137=10109;e.a138=10110;e.a139=10111;e.a140=10112;e.a141=10113;e.a142=10114;e.a143=10115;e.a144=10116;e.a145=10117;e.a146=10118;e.a147=10119;e.a148=10120;e.a149=10121;e.a150=10122;e.a151=10123;e.a152=10124;e.a153=10125;e.a154=10126;e.a155=10127;e.a156=10128;e.a157=10129;e.a158=10130;e.a159=10131;e.a160=10132;e.a161=8594;e.a163=8596;e.a164=8597;e.a196=10136;e.a165=10137;e.a192=10138;e.a166=10139;e.a167=10140;e.a168=10141;e.a169=10142;e.a170=10143;e.a171=10144;e.a172=10145;e.a173=10146;e.a162=10147;e.a174=10148;e.a175=10149;e.a176=10150;e.a177=10151;e.a178=10152;e.a179=10153;e.a193=10154;e.a180=10155;e.a199=10156;e.a181=10157;e.a200=10158;e.a182=10159;e.a201=10161;e.a183=10162;e.a184=10163;e.a197=10164;e.a185=10165;e.a194=10166;e.a198=10167;e.a186=10168;e.a195=10169;e.a187=10170;e.a188=10171;e.a189=10172;e.a190=10173;e.a191=10174;e.a89=10088;e.a90=10089;e.a93=10090;e.a94=10091;e.a91=10092;e.a92=10093;e.a205=10094;e.a85=10095;e.a206=10096;e.a86=10097;e.a87=10098;e.a88=10099;e.a95=10100;e.a96=10101;e[".notdef"]=0});t.getGlyphsUnicode=i;t.getDingbatsGlyphsUnicode=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.getSupplementalGlyphMapForCalibri=t.getSupplementalGlyphMapForArialBlack=t.getGlyphMapForStandardFonts=t.getSymbolsFonts=t.getSerifFonts=t.getNonStdFontMap=t.getStdFontMap=void 0;var a=r(2),i=(0,a.getLookupTableFactory)(function(e){e.ArialNarrow="Helvetica";e["ArialNarrow-Bold"]="Helvetica-Bold";e["ArialNarrow-BoldItalic"]="Helvetica-BoldOblique";e["ArialNarrow-Italic"]="Helvetica-Oblique";e.ArialBlack="Helvetica";e["ArialBlack-Bold"]="Helvetica-Bold";e["ArialBlack-BoldItalic"]="Helvetica-BoldOblique";e["ArialBlack-Italic"]="Helvetica-Oblique";e["Arial-Black"]="Helvetica";e["Arial-Black-Bold"]="Helvetica-Bold";e["Arial-Black-BoldItalic"]="Helvetica-BoldOblique";e["Arial-Black-Italic"]="Helvetica-Oblique";e.Arial="Helvetica";e["Arial-Bold"]="Helvetica-Bold";e["Arial-BoldItalic"]="Helvetica-BoldOblique";e["Arial-Italic"]="Helvetica-Oblique";e["Arial-BoldItalicMT"]="Helvetica-BoldOblique";e["Arial-BoldMT"]="Helvetica-Bold";e["Arial-ItalicMT"]="Helvetica-Oblique";e.ArialMT="Helvetica";e["Courier-Bold"]="Courier-Bold";e["Courier-BoldItalic"]="Courier-BoldOblique";e["Courier-Italic"]="Courier-Oblique";e.CourierNew="Courier";e["CourierNew-Bold"]="Courier-Bold";e["CourierNew-BoldItalic"]="Courier-BoldOblique";e["CourierNew-Italic"]="Courier-Oblique";e["CourierNewPS-BoldItalicMT"]="Courier-BoldOblique";e["CourierNewPS-BoldMT"]="Courier-Bold";e["CourierNewPS-ItalicMT"]="Courier-Oblique";e.CourierNewPSMT="Courier";e.Helvetica="Helvetica";e["Helvetica-Bold"]="Helvetica-Bold";e["Helvetica-BoldItalic"]="Helvetica-BoldOblique";e["Helvetica-BoldOblique"]="Helvetica-BoldOblique";e["Helvetica-Italic"]="Helvetica-Oblique";e["Helvetica-Oblique"]="Helvetica-Oblique";e.SegoeUISymbol="Helvetica";e["Symbol-Bold"]="Symbol";e["Symbol-BoldItalic"]="Symbol";e["Symbol-Italic"]="Symbol";e.TimesNewRoman="Times-Roman";e["TimesNewRoman-Bold"]="Times-Bold";e["TimesNewRoman-BoldItalic"]="Times-BoldItalic";e["TimesNewRoman-Italic"]="Times-Italic";e.TimesNewRomanPS="Times-Roman";e["TimesNewRomanPS-Bold"]="Times-Bold";e["TimesNewRomanPS-BoldItalic"]="Times-BoldItalic";e["TimesNewRomanPS-BoldItalicMT"]="Times-BoldItalic";e["TimesNewRomanPS-BoldMT"]="Times-Bold";e["TimesNewRomanPS-Italic"]="Times-Italic";e["TimesNewRomanPS-ItalicMT"]="Times-Italic";e.TimesNewRomanPSMT="Times-Roman";e["TimesNewRomanPSMT-Bold"]="Times-Bold";e["TimesNewRomanPSMT-BoldItalic"]="Times-BoldItalic";e["TimesNewRomanPSMT-Italic"]="Times-Italic"}),n=(0,a.getLookupTableFactory)(function(e){e.Calibri="Helvetica";e["Calibri-Bold"]="Helvetica-Bold";e["Calibri-BoldItalic"]="Helvetica-BoldOblique";e["Calibri-Italic"]="Helvetica-Oblique";e.CenturyGothic="Helvetica";e["CenturyGothic-Bold"]="Helvetica-Bold";e["CenturyGothic-BoldItalic"]="Helvetica-BoldOblique";e["CenturyGothic-Italic"]="Helvetica-Oblique";e.ComicSansMS="Comic Sans MS";e["ComicSansMS-Bold"]="Comic Sans MS-Bold";e["ComicSansMS-BoldItalic"]="Comic Sans MS-BoldItalic";e["ComicSansMS-Italic"]="Comic Sans MS-Italic";e.LucidaConsole="Courier";e["LucidaConsole-Bold"]="Courier-Bold";e["LucidaConsole-BoldItalic"]="Courier-BoldOblique";e["LucidaConsole-Italic"]="Courier-Oblique";e["LucidaSans-Demi"]="Helvetica-Bold";e["MS-Gothic"]="MS Gothic";e["MS-Gothic-Bold"]="MS Gothic-Bold";e["MS-Gothic-BoldItalic"]="MS Gothic-BoldItalic";e["MS-Gothic-Italic"]="MS Gothic-Italic";e["MS-Mincho"]="MS Mincho";e["MS-Mincho-Bold"]="MS Mincho-Bold";e["MS-Mincho-BoldItalic"]="MS Mincho-BoldItalic";e["MS-Mincho-Italic"]="MS Mincho-Italic";e["MS-PGothic"]="MS PGothic";e["MS-PGothic-Bold"]="MS PGothic-Bold";e["MS-PGothic-BoldItalic"]="MS PGothic-BoldItalic";e["MS-PGothic-Italic"]="MS PGothic-Italic";e["MS-PMincho"]="MS PMincho";e["MS-PMincho-Bold"]="MS PMincho-Bold";e["MS-PMincho-BoldItalic"]="MS PMincho-BoldItalic";e["MS-PMincho-Italic"]="MS PMincho-Italic";e.NuptialScript="Times-Italic";e.Wingdings="ZapfDingbats"}),o=(0,a.getLookupTableFactory)(function(e){e["Adobe Jenson"]=!0;e["Adobe Text"]=!0;e.Albertus=!0;e.Aldus=!0;e.Alexandria=!0;e.Algerian=!0;e["American Typewriter"]=!0;e.Antiqua=!0;e.Apex=!0;e.Arno=!0;e.Aster=!0;e.Aurora=!0;e.Baskerville=!0;e.Bell=!0;e.Bembo=!0;e["Bembo Schoolbook"]=!0;e.Benguiat=!0;e["Berkeley Old Style"]=!0;e["Bernhard Modern"]=!0;e["Berthold City"]=!0;e.Bodoni=!0;e["Bauer Bodoni"]=!0;e["Book Antiqua"]=!0;e.Bookman=!0;e["Bordeaux Roman"]=!0;e["Californian FB"]=!0;e.Calisto=!0;e.Calvert=!0;e.Capitals=!0;e.Cambria=!0;e.Cartier=!0;e.Caslon=!0;e.Catull=!0;e.Centaur=!0;e["Century Old Style"]=!0;e["Century Schoolbook"]=!0;e.Chaparral=!0;e["Charis SIL"]=!0;e.Cheltenham=!0;e["Cholla Slab"]=!0;e.Clarendon=!0;e.Clearface=!0;e.Cochin=!0;e.Colonna=!0;e["Computer Modern"]=!0;e["Concrete Roman"]=!0;e.Constantia=!0;e["Cooper Black"]=!0;e.Corona=!0;e.Ecotype=!0;e.Egyptienne=!0;e.Elephant=!0;e.Excelsior=!0;e.Fairfield=!0;e["FF Scala"]=!0;e.Folkard=!0;e.Footlight=!0;e.FreeSerif=!0;e["Friz Quadrata"]=!0;e.Garamond=!0;e.Gentium=!0;e.Georgia=!0;e.Gloucester=!0;e["Goudy Old Style"]=!0;e["Goudy Schoolbook"]=!0;e["Goudy Pro Font"]=!0;e.Granjon=!0;e["Guardian Egyptian"]=!0;e.Heather=!0;e.Hercules=!0;e["High Tower Text"]=!0;e.Hiroshige=!0;e["Hoefler Text"]=!0;e["Humana Serif"]=!0;e.Imprint=!0;e["Ionic No. 5"]=!0;e.Janson=!0;e.Joanna=!0;e.Korinna=!0;e.Lexicon=!0;e["Liberation Serif"]=!0;e["Linux Libertine"]=!0;e.Literaturnaya=!0;e.Lucida=!0;e["Lucida Bright"]=!0;e.Melior=!0;e.Memphis=!0;e.Miller=!0;e.Minion=!0;e.Modern=!0;e["Mona Lisa"]=!0;e["Mrs Eaves"]=!0;e["MS Serif"]=!0;e["Museo Slab"]=!0;e["New York"]=!0;e["Nimbus Roman"]=!0;e["NPS Rawlinson Roadway"]=!0;e.NuptialScript=!0;e.Palatino=!0;e.Perpetua=!0;e.Plantin=!0;e["Plantin Schoolbook"]=!0;e.Playbill=!0;e["Poor Richard"]=!0;e["Rawlinson Roadway"]=!0;e.Renault=!0;e.Requiem=!0;e.Rockwell=!0;e.Roman=!0;e["Rotis Serif"]=!0;e.Sabon=!0;e.Scala=!0;e.Seagull=!0;e.Sistina=!0;e.Souvenir=!0;e.STIX=!0;e["Stone Informal"]=!0;e["Stone Serif"]=!0;e.Sylfaen=!0;e.Times=!0;e.Trajan=!0;e["Trinité"]=!0;e["Trump Mediaeval"]=!0;e.Utopia=!0;e["Vale Type"]=!0;e["Bitstream Vera"]=!0;e["Vera Serif"]=!0;e.Versailles=!0;e.Wanted=!0;e.Weiss=!0;e["Wide Latin"]=!0;e.Windsor=!0;e.XITS=!0}),s=(0,a.getLookupTableFactory)(function(e){e.Dingbats=!0;e.Symbol=!0;e.ZapfDingbats=!0}),c=(0,a.getLookupTableFactory)(function(e){e[2]=10;e[3]=32;e[4]=33;e[5]=34;e[6]=35;e[7]=36;e[8]=37;e[9]=38;e[10]=39;e[11]=40;e[12]=41;e[13]=42;e[14]=43;e[15]=44;e[16]=45;e[17]=46;e[18]=47;e[19]=48;e[20]=49;e[21]=50;e[22]=51;e[23]=52;e[24]=53;e[25]=54;e[26]=55;e[27]=56;e[28]=57;e[29]=58;e[30]=894;e[31]=60;e[32]=61;e[33]=62;e[34]=63;e[35]=64;e[36]=65;e[37]=66;e[38]=67;e[39]=68;e[40]=69;e[41]=70;e[42]=71;e[43]=72;e[44]=73;e[45]=74;e[46]=75;e[47]=76;e[48]=77;e[49]=78;e[50]=79;e[51]=80;e[52]=81;e[53]=82;e[54]=83;e[55]=84;e[56]=85;e[57]=86;e[58]=87;e[59]=88;e[60]=89;e[61]=90;e[62]=91;e[63]=92;e[64]=93;e[65]=94;e[66]=95;e[67]=96;e[68]=97;e[69]=98;e[70]=99;e[71]=100;e[72]=101;e[73]=102;e[74]=103;e[75]=104;e[76]=105;e[77]=106;e[78]=107;e[79]=108;e[80]=109;e[81]=110;e[82]=111;e[83]=112;e[84]=113;e[85]=114;e[86]=115;e[87]=116;e[88]=117;e[89]=118;e[90]=119;e[91]=120;e[92]=121;e[93]=122;e[94]=123;e[95]=124;e[96]=125;e[97]=126;e[98]=196;e[99]=197;e[100]=199;e[101]=201;e[102]=209;e[103]=214;e[104]=220;e[105]=225;e[106]=224;e[107]=226;e[108]=228;e[109]=227;e[110]=229;e[111]=231;e[112]=233;e[113]=232;e[114]=234;e[115]=235;e[116]=237;e[117]=236;e[118]=238;e[119]=239;e[120]=241;e[121]=243;e[122]=242;e[123]=244;e[124]=246;e[125]=245;e[126]=250;e[127]=249;e[128]=251;e[129]=252;e[130]=8224;e[131]=176;e[132]=162;e[133]=163;e[134]=167;e[135]=8226;e[136]=182;e[137]=223;e[138]=174;e[139]=169;e[140]=8482;e[141]=180;e[142]=168;e[143]=8800;e[144]=198;e[145]=216;e[146]=8734;e[147]=177;e[148]=8804;e[149]=8805;e[150]=165;e[151]=181;e[152]=8706;e[153]=8721;e[154]=8719;e[156]=8747;e[157]=170;e[158]=186;e[159]=8486;e[160]=230;e[161]=248;e[162]=191;e[163]=161;e[164]=172;e[165]=8730;e[166]=402;e[167]=8776;e[168]=8710;e[169]=171;e[170]=187;e[171]=8230;e[210]=218;e[223]=711;e[224]=321;e[225]=322;e[227]=353;e[229]=382;e[234]=253;e[252]=263;e[253]=268;e[254]=269;e[258]=258;e[260]=260;e[261]=261;e[265]=280;e[266]=281;e[268]=283;e[269]=313;e[275]=323;e[276]=324;e[278]=328;e[284]=345;e[285]=346;e[286]=347;e[292]=367;e[295]=377;e[296]=378;e[298]=380;e[305]=963;e[306]=964;e[307]=966;e[308]=8215;e[309]=8252;e[310]=8319;e[311]=8359;e[312]=8592;e[313]=8593;e[337]=9552;e[493]=1039;e[494]=1040;e[705]=1524;e[706]=8362;e[710]=64288;e[711]=64298;e[759]=1617;e[761]=1776;e[763]=1778;e[775]=1652;e[777]=1764;e[778]=1780;e[779]=1781;e[780]=1782;e[782]=771;e[783]=64726;e[786]=8363;e[788]=8532;e[790]=768;e[791]=769;e[792]=768;e[795]=803;e[797]=64336;e[798]=64337;e[799]=64342;e[800]=64343;e[801]=64344;e[802]=64345;e[803]=64362;e[804]=64363;e[805]=64364;e[2424]=7821;e[2425]=7822;e[2426]=7823;e[2427]=7824;e[2428]=7825;e[2429]=7826;e[2430]=7827;e[2433]=7682;e[2678]=8045;e[2679]=8046;e[2830]=1552;e[2838]=686;e[2840]=751;e[2842]=753;e[2843]=754;e[2844]=755;e[2846]=757;e[2856]=767;e[2857]=848;e[2858]=849;e[2862]=853;e[2863]=854;e[2864]=855;e[2865]=861;e[2866]=862;e[2906]=7460;e[2908]=7462;e[2909]=7463;e[2910]=7464;e[2912]=7466;e[2913]=7467;e[2914]=7468;e[2916]=7470;e[2917]=7471;e[2918]=7472;e[2920]=7474;e[2921]=7475;e[2922]=7476;e[2924]=7478;e[2925]=7479;e[2926]=7480;e[2928]=7482;e[2929]=7483;e[2930]=7484;e[2932]=7486;e[2933]=7487;e[2934]=7488;e[2936]=7490;e[2937]=7491;e[2938]=7492;e[2940]=7494;e[2941]=7495;e[2942]=7496;e[2944]=7498;e[2946]=7500;e[2948]=7502;e[2950]=7504;e[2951]=7505;e[2952]=7506;e[2954]=7508;e[2955]=7509;e[2956]=7510;e[2958]=7512;e[2959]=7513;e[2960]=7514;e[2962]=7516;e[2963]=7517;e[2964]=7518;e[2966]=7520;e[2967]=7521;e[2968]=7522;e[2970]=7524;e[2971]=7525;e[2972]=7526;e[2974]=7528;e[2975]=7529;e[2976]=7530;e[2978]=1537;e[2979]=1538;e[2980]=1539;e[2982]=1549;e[2983]=1551;e[2984]=1552;e[2986]=1554;e[2987]=1555;e[2988]=1556;e[2990]=1623;e[2991]=1624;e[2995]=1775;e[2999]=1791;e[3002]=64290;e[3003]=64291;e[3004]=64292;e[3006]=64294;e[3007]=64295;e[3008]=64296;e[3011]=1900;e[3014]=8223;e[3015]=8244;e[3017]=7532;e[3018]=7533;e[3019]=7534;e[3075]=7590;e[3076]=7591;e[3079]=7594;e[3080]=7595;e[3083]=7598;e[3084]=7599;e[3087]=7602;e[3088]=7603;e[3091]=7606;e[3092]=7607;e[3095]=7610;e[3096]=7611;e[3099]=7614;e[3100]=7615;e[3103]=7618;e[3104]=7619;e[3107]=8337;e[3108]=8338;e[3116]=1884;e[3119]=1885;e[3120]=1885;e[3123]=1886;e[3124]=1886;e[3127]=1887;e[3128]=1887;e[3131]=1888;e[3132]=1888;e[3135]=1889;e[3136]=1889;e[3139]=1890;e[3140]=1890;e[3143]=1891;e[3144]=1891;e[3147]=1892;e[3148]=1892;e[3153]=580;e[3154]=581;e[3157]=584;e[3158]=585;e[3161]=588;e[3162]=589;e[3165]=891;e[3166]=892;e[3169]=1274;e[3170]=1275;e[3173]=1278;e[3174]=1279;e[3181]=7622;e[3182]=7623;e[3282]=11799;e[3316]=578;e[3379]=42785;e[3393]=1159;e[3416]=8377}),l=(0,a.getLookupTableFactory)(function(e){e[227]=322;e[264]=261;e[291]=346}),u=(0,a.getLookupTableFactory)(function(e){e[1]=32;e[4]=65;e[17]=66;e[18]=67;e[24]=68;e[28]=69;e[38]=70;e[39]=71;e[44]=72;e[47]=73;e[58]=74;e[60]=75;e[62]=76;e[68]=77;e[69]=78;e[75]=79;e[87]=80;e[89]=81;e[90]=82;e[94]=83;e[100]=84;e[104]=85;e[115]=86;e[116]=87;e[121]=88;e[122]=89;e[127]=90;e[258]=97;e[268]=261;e[271]=98;e[272]=99;e[273]=263;e[282]=100;e[286]=101;e[295]=281;e[296]=102;e[336]=103;e[346]=104;e[349]=105;e[361]=106;e[364]=107;e[367]=108;e[371]=322;e[373]=109;e[374]=110;e[381]=111;e[383]=243;e[393]=112;e[395]=113;e[396]=114;e[400]=115;e[401]=347;e[410]=116;e[437]=117;e[448]=118;e[449]=119;e[454]=120;e[455]=121;e[460]=122;e[463]=380;e[853]=44;e[855]=58;e[856]=46;e[876]=47;e[878]=45;e[882]=45;e[894]=40;e[895]=41;e[896]=91;e[897]=93;e[923]=64;e[1004]=48;e[1005]=49;e[1006]=50;e[1007]=51;e[1008]=52;e[1009]=53;e[1010]=54;e[1011]=55;e[1012]=56;e[1013]=57;e[1081]=37;e[1085]=43;e[1086]=45});t.getStdFontMap=i;t.getNonStdFontMap=n;t.getSerifFonts=o;t.getSymbolsFonts=s;t.getGlyphMapForStandardFonts=c;t.getSupplementalGlyphMapForArialBlack=l;t.getSupplementalGlyphMapForCalibri=u},function(e,t,r){var a=r(2).getLookupTableFactory,i=a(function(e){e[63721]=169;e[63193]=169;e[63720]=174;e[63194]=174;e[63722]=8482;e[63195]=8482;e[63729]=9127;e[63730]=9128;e[63731]=9129;e[63740]=9131;e[63741]=9132;e[63742]=9133;e[63726]=9121;e[63727]=9122;e[63728]=9123;e[63737]=9124;e[63738]=9125;e[63739]=9126;e[63723]=9115;e[63724]=9116;e[63725]=9117;e[63734]=9118;e[63735]=9119;e[63736]=9120});var n=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];var o=a(function(e){e["¨"]=" ̈";e["¯"]=" ̄";e["´"]=" ́";e["µ"]="μ";e["¸"]=" ̧";e["IJ"]="IJ";e["ij"]="ij";e["Ŀ"]="L·";e["ŀ"]="l·";e["ʼn"]="ʼn";e["ſ"]="s";e["DŽ"]="DŽ";e["Dž"]="Dž";e["dž"]="dž";e["LJ"]="LJ";e["Lj"]="Lj";e["lj"]="lj";e["NJ"]="NJ";e["Nj"]="Nj";e["nj"]="nj";e["DZ"]="DZ";e["Dz"]="Dz";e["dz"]="dz";e["˘"]=" ̆";e["˙"]=" ̇";e["˚"]=" ̊";e["˛"]=" ̨";e["˜"]=" ̃";e["˝"]=" ̋";e["ͺ"]=" ͅ";e["΄"]=" ́";e["ϐ"]="β";e["ϑ"]="θ";e["ϒ"]="Υ";e["ϕ"]="φ";e["ϖ"]="π";e["ϰ"]="κ";e["ϱ"]="ρ";e["ϲ"]="ς";e["ϴ"]="Θ";e["ϵ"]="ε";e["Ϲ"]="Σ";e["և"]="եւ";e["ٵ"]="اٴ";e["ٶ"]="وٴ";e["ٷ"]="ۇٴ";e["ٸ"]="يٴ";e["ำ"]="ํา";e["ຳ"]="ໍາ";e["ໜ"]="ຫນ";e["ໝ"]="ຫມ";e["ཷ"]="ྲཱྀ";e["ཹ"]="ླཱྀ";e["ẚ"]="aʾ";e["᾽"]=" ̓";e["᾿"]=" ̓";e["῀"]=" ͂";e["῾"]=" ̔";e[" "]=" ";e[" "]=" ";e[" "]=" ";e[" "]=" ";e[" "]=" ";e[" "]=" ";e[" "]=" ";e[" "]=" ";e["‗"]=" ̳";e["․"]=".";e["‥"]="..";e["…"]="...";e["″"]="′′";e["‴"]="′′′";e["‶"]="‵‵";e["‷"]="‵‵‵";e["‼"]="!!";e["‾"]=" ̅";e["⁇"]="??";e["⁈"]="?!";e["⁉"]="!?";e["⁗"]="′′′′";e[" "]=" ";e["₨"]="Rs";e["℀"]="a/c";e["℁"]="a/s";e["℃"]="°C";e["℅"]="c/o";e["℆"]="c/u";e["ℇ"]="Ɛ";e["℉"]="°F";e["№"]="No";e["℡"]="TEL";e["ℵ"]="א";e["ℶ"]="ב";e["ℷ"]="ג";e["ℸ"]="ד";e["℻"]="FAX";e["Ⅰ"]="I";e["Ⅱ"]="II";e["Ⅲ"]="III";e["Ⅳ"]="IV";e["Ⅴ"]="V";e["Ⅵ"]="VI";e["Ⅶ"]="VII";e["Ⅷ"]="VIII";e["Ⅸ"]="IX";e["Ⅹ"]="X";e["Ⅺ"]="XI";e["Ⅻ"]="XII";e["Ⅼ"]="L";e["Ⅽ"]="C";e["Ⅾ"]="D";e["Ⅿ"]="M";e["ⅰ"]="i";e["ⅱ"]="ii";e["ⅲ"]="iii";e["ⅳ"]="iv";e["ⅴ"]="v";e["ⅵ"]="vi";e["ⅶ"]="vii";e["ⅷ"]="viii";e["ⅸ"]="ix";e["ⅹ"]="x";e["ⅺ"]="xi";e["ⅻ"]="xii";e["ⅼ"]="l";e["ⅽ"]="c";e["ⅾ"]="d";e["ⅿ"]="m";e["∬"]="∫∫";e["∭"]="∫∫∫";e["∯"]="∮∮";e["∰"]="∮∮∮";e["⑴"]="(1)";e["⑵"]="(2)";e["⑶"]="(3)";e["⑷"]="(4)";e["⑸"]="(5)";e["⑹"]="(6)";e["⑺"]="(7)";e["⑻"]="(8)";e["⑼"]="(9)";e["⑽"]="(10)";e["⑾"]="(11)";e["⑿"]="(12)";e["⒀"]="(13)";e["⒁"]="(14)";e["⒂"]="(15)";e["⒃"]="(16)";e["⒄"]="(17)";e["⒅"]="(18)";e["⒆"]="(19)";e["⒇"]="(20)";e["⒈"]="1.";e["⒉"]="2.";e["⒊"]="3.";e["⒋"]="4.";e["⒌"]="5.";e["⒍"]="6.";e["⒎"]="7.";e["⒏"]="8.";e["⒐"]="9.";e["⒑"]="10.";e["⒒"]="11.";e["⒓"]="12.";e["⒔"]="13.";e["⒕"]="14.";e["⒖"]="15.";e["⒗"]="16.";e["⒘"]="17.";e["⒙"]="18.";e["⒚"]="19.";e["⒛"]="20.";e["⒜"]="(a)";e["⒝"]="(b)";e["⒞"]="(c)";e["⒟"]="(d)";e["⒠"]="(e)";e["⒡"]="(f)";e["⒢"]="(g)";e["⒣"]="(h)";e["⒤"]="(i)";e["⒥"]="(j)";e["⒦"]="(k)";e["⒧"]="(l)";e["⒨"]="(m)";e["⒩"]="(n)";e["⒪"]="(o)";e["⒫"]="(p)";e["⒬"]="(q)";e["⒭"]="(r)";e["⒮"]="(s)";e["⒯"]="(t)";e["⒰"]="(u)";e["⒱"]="(v)";e["⒲"]="(w)";e["⒳"]="(x)";e["⒴"]="(y)";e["⒵"]="(z)";e["⨌"]="∫∫∫∫";e["⩴"]="::=";e["⩵"]="==";e["⩶"]="===";e["⺟"]="母";e["⻳"]="龟";e["⼀"]="一";e["⼁"]="丨";e["⼂"]="丶";e["⼃"]="丿";e["⼄"]="乙";e["⼅"]="亅";e["⼆"]="二";e["⼇"]="亠";e["⼈"]="人";e["⼉"]="儿";e["⼊"]="入";e["⼋"]="八";e["⼌"]="冂";e["⼍"]="冖";e["⼎"]="冫";e["⼏"]="几";e["⼐"]="凵";e["⼑"]="刀";e["⼒"]="力";e["⼓"]="勹";e["⼔"]="匕";e["⼕"]="匚";e["⼖"]="匸";e["⼗"]="十";e["⼘"]="卜";e["⼙"]="卩";e["⼚"]="厂";e["⼛"]="厶";e["⼜"]="又";e["⼝"]="口";e["⼞"]="囗";e["⼟"]="土";e["⼠"]="士";e["⼡"]="夂";e["⼢"]="夊";e["⼣"]="夕";e["⼤"]="大";e["⼥"]="女";e["⼦"]="子";e["⼧"]="宀";e["⼨"]="寸";e["⼩"]="小";e["⼪"]="尢";e["⼫"]="尸";e["⼬"]="屮";e["⼭"]="山";e["⼮"]="巛";e["⼯"]="工";e["⼰"]="己";e["⼱"]="巾";e["⼲"]="干";e["⼳"]="幺";e["⼴"]="广";e["⼵"]="廴";e["⼶"]="廾";e["⼷"]="弋";e["⼸"]="弓";e["⼹"]="彐";e["⼺"]="彡";e["⼻"]="彳";e["⼼"]="心";e["⼽"]="戈";e["⼾"]="戶";e["⼿"]="手";e["⽀"]="支";e["⽁"]="攴";e["⽂"]="文";e["⽃"]="斗";e["⽄"]="斤";e["⽅"]="方";e["⽆"]="无";e["⽇"]="日";e["⽈"]="曰";e["⽉"]="月";e["⽊"]="木";e["⽋"]="欠";e["⽌"]="止";e["⽍"]="歹";e["⽎"]="殳";e["⽏"]="毋";e["⽐"]="比";e["⽑"]="毛";e["⽒"]="氏";e["⽓"]="气";e["⽔"]="水";e["⽕"]="火";e["⽖"]="爪";e["⽗"]="父";e["⽘"]="爻";e["⽙"]="爿";e["⽚"]="片";e["⽛"]="牙";e["⽜"]="牛";e["⽝"]="犬";e["⽞"]="玄";e["⽟"]="玉";e["⽠"]="瓜";e["⽡"]="瓦";e["⽢"]="甘";e["⽣"]="生";e["⽤"]="用";e["⽥"]="田";e["⽦"]="疋";e["⽧"]="疒";e["⽨"]="癶";e["⽩"]="白";e["⽪"]="皮";e["⽫"]="皿";e["⽬"]="目";e["⽭"]="矛";e["⽮"]="矢";e["⽯"]="石";e["⽰"]="示";e["⽱"]="禸";e["⽲"]="禾";e["⽳"]="穴";e["⽴"]="立";e["⽵"]="竹";e["⽶"]="米";e["⽷"]="糸";e["⽸"]="缶";e["⽹"]="网";e["⽺"]="羊";e["⽻"]="羽";e["⽼"]="老";e["⽽"]="而";e["⽾"]="耒";e["⽿"]="耳";e["⾀"]="聿";e["⾁"]="肉";e["⾂"]="臣";e["⾃"]="自";e["⾄"]="至";e["⾅"]="臼";e["⾆"]="舌";e["⾇"]="舛";e["⾈"]="舟";e["⾉"]="艮";e["⾊"]="色";e["⾋"]="艸";e["⾌"]="虍";e["⾍"]="虫";e["⾎"]="血";e["⾏"]="行";e["⾐"]="衣";e["⾑"]="襾";e["⾒"]="見";e["⾓"]="角";e["⾔"]="言";e["⾕"]="谷";e["⾖"]="豆";e["⾗"]="豕";e["⾘"]="豸";e["⾙"]="貝";e["⾚"]="赤";e["⾛"]="走";e["⾜"]="足";e["⾝"]="身";e["⾞"]="車";e["⾟"]="辛";e["⾠"]="辰";e["⾡"]="辵";e["⾢"]="邑";e["⾣"]="酉";e["⾤"]="釆";e["⾥"]="里";e["⾦"]="金";e["⾧"]="長";e["⾨"]="門";e["⾩"]="阜";e["⾪"]="隶";e["⾫"]="隹";e["⾬"]="雨";e["⾭"]="靑";e["⾮"]="非";e["⾯"]="面";e["⾰"]="革";e["⾱"]="韋";e["⾲"]="韭";e["⾳"]="音";e["⾴"]="頁";e["⾵"]="風";e["⾶"]="飛";e["⾷"]="食";e["⾸"]="首";e["⾹"]="香";e["⾺"]="馬";e["⾻"]="骨";e["⾼"]="高";e["⾽"]="髟";e["⾾"]="鬥";e["⾿"]="鬯";e["⿀"]="鬲";e["⿁"]="鬼";e["⿂"]="魚";e["⿃"]="鳥";e["⿄"]="鹵";e["⿅"]="鹿";e["⿆"]="麥";e["⿇"]="麻";e["⿈"]="黃";e["⿉"]="黍";e["⿊"]="黑";e["⿋"]="黹";e["⿌"]="黽";e["⿍"]="鼎";e["⿎"]="鼓";e["⿏"]="鼠";e["⿐"]="鼻";e["⿑"]="齊";e["⿒"]="齒";e["⿓"]="龍";e["⿔"]="龜";e["⿕"]="龠";e["〶"]="〒";e["〸"]="十";e["〹"]="卄";e["〺"]="卅";e["゛"]=" ゙";e["゜"]=" ゚";e["ㄱ"]="ᄀ";e["ㄲ"]="ᄁ";e["ㄳ"]="ᆪ";e["ㄴ"]="ᄂ";e["ㄵ"]="ᆬ";e["ㄶ"]="ᆭ";e["ㄷ"]="ᄃ";e["ㄸ"]="ᄄ";e["ㄹ"]="ᄅ";e["ㄺ"]="ᆰ";e["ㄻ"]="ᆱ";e["ㄼ"]="ᆲ";e["ㄽ"]="ᆳ";e["ㄾ"]="ᆴ";e["ㄿ"]="ᆵ";e["ㅀ"]="ᄚ";e["ㅁ"]="ᄆ";e["ㅂ"]="ᄇ";e["ㅃ"]="ᄈ";e["ㅄ"]="ᄡ";e["ㅅ"]="ᄉ";e["ㅆ"]="ᄊ";e["ㅇ"]="ᄋ";e["ㅈ"]="ᄌ";e["ㅉ"]="ᄍ";e["ㅊ"]="ᄎ";e["ㅋ"]="ᄏ";e["ㅌ"]="ᄐ";e["ㅍ"]="ᄑ";e["ㅎ"]="ᄒ";e["ㅏ"]="ᅡ";e["ㅐ"]="ᅢ";e["ㅑ"]="ᅣ";e["ㅒ"]="ᅤ";e["ㅓ"]="ᅥ";e["ㅔ"]="ᅦ";e["ㅕ"]="ᅧ";e["ㅖ"]="ᅨ";e["ㅗ"]="ᅩ";e["ㅘ"]="ᅪ";e["ㅙ"]="ᅫ";e["ㅚ"]="ᅬ";e["ㅛ"]="ᅭ";e["ㅜ"]="ᅮ";e["ㅝ"]="ᅯ";e["ㅞ"]="ᅰ";e["ㅟ"]="ᅱ";e["ㅠ"]="ᅲ";e["ㅡ"]="ᅳ";e["ㅢ"]="ᅴ";e["ㅣ"]="ᅵ";e["ㅤ"]="ᅠ";e["ㅥ"]="ᄔ";e["ㅦ"]="ᄕ";e["ㅧ"]="ᇇ";e["ㅨ"]="ᇈ";e["ㅩ"]="ᇌ";e["ㅪ"]="ᇎ";e["ㅫ"]="ᇓ";e["ㅬ"]="ᇗ";e["ㅭ"]="ᇙ";e["ㅮ"]="ᄜ";e["ㅯ"]="ᇝ";e["ㅰ"]="ᇟ";e["ㅱ"]="ᄝ";e["ㅲ"]="ᄞ";e["ㅳ"]="ᄠ";e["ㅴ"]="ᄢ";e["ㅵ"]="ᄣ";e["ㅶ"]="ᄧ";e["ㅷ"]="ᄩ";e["ㅸ"]="ᄫ";e["ㅹ"]="ᄬ";e["ㅺ"]="ᄭ";e["ㅻ"]="ᄮ";e["ㅼ"]="ᄯ";e["ㅽ"]="ᄲ";e["ㅾ"]="ᄶ";e["ㅿ"]="ᅀ";e["ㆀ"]="ᅇ";e["ㆁ"]="ᅌ";e["ㆂ"]="ᇱ";e["ㆃ"]="ᇲ";e["ㆄ"]="ᅗ";e["ㆅ"]="ᅘ";e["ㆆ"]="ᅙ";e["ㆇ"]="ᆄ";e["ㆈ"]="ᆅ";e["ㆉ"]="ᆈ";e["ㆊ"]="ᆑ";e["ㆋ"]="ᆒ";e["ㆌ"]="ᆔ";e["ㆍ"]="ᆞ";e["ㆎ"]="ᆡ";e["㈀"]="(ᄀ)";e["㈁"]="(ᄂ)";e["㈂"]="(ᄃ)";e["㈃"]="(ᄅ)";e["㈄"]="(ᄆ)";e["㈅"]="(ᄇ)";e["㈆"]="(ᄉ)";e["㈇"]="(ᄋ)";e["㈈"]="(ᄌ)";e["㈉"]="(ᄎ)";e["㈊"]="(ᄏ)";e["㈋"]="(ᄐ)";e["㈌"]="(ᄑ)";e["㈍"]="(ᄒ)";e["㈎"]="(가)";e["㈏"]="(나)";e["㈐"]="(다)";e["㈑"]="(라)";e["㈒"]="(마)";e["㈓"]="(바)";e["㈔"]="(사)";e["㈕"]="(아)";e["㈖"]="(자)";e["㈗"]="(차)";e["㈘"]="(카)";e["㈙"]="(타)";e["㈚"]="(파)";e["㈛"]="(하)";e["㈜"]="(주)";e["㈝"]="(오전)";e["㈞"]="(오후)";e["㈠"]="(一)";e["㈡"]="(二)";e["㈢"]="(三)";e["㈣"]="(四)";e["㈤"]="(五)";e["㈥"]="(六)";e["㈦"]="(七)";e["㈧"]="(八)";e["㈨"]="(九)";e["㈩"]="(十)";e["㈪"]="(月)";e["㈫"]="(火)";e["㈬"]="(水)";e["㈭"]="(木)";e["㈮"]="(金)";e["㈯"]="(土)";e["㈰"]="(日)";e["㈱"]="(株)";e["㈲"]="(有)";e["㈳"]="(社)";e["㈴"]="(名)";e["㈵"]="(特)";e["㈶"]="(財)";e["㈷"]="(祝)";e["㈸"]="(労)";e["㈹"]="(代)";e["㈺"]="(呼)";e["㈻"]="(学)";e["㈼"]="(監)";e["㈽"]="(企)";e["㈾"]="(資)";e["㈿"]="(協)";e["㉀"]="(祭)";e["㉁"]="(休)";e["㉂"]="(自)";e["㉃"]="(至)";e["㋀"]="1月";e["㋁"]="2月";e["㋂"]="3月";e["㋃"]="4月";e["㋄"]="5月";e["㋅"]="6月";e["㋆"]="7月";e["㋇"]="8月";e["㋈"]="9月";e["㋉"]="10月";e["㋊"]="11月";e["㋋"]="12月";e["㍘"]="0点";e["㍙"]="1点";e["㍚"]="2点";e["㍛"]="3点";e["㍜"]="4点";e["㍝"]="5点";e["㍞"]="6点";e["㍟"]="7点";e["㍠"]="8点";e["㍡"]="9点";e["㍢"]="10点";e["㍣"]="11点";e["㍤"]="12点";e["㍥"]="13点";e["㍦"]="14点";e["㍧"]="15点";e["㍨"]="16点";e["㍩"]="17点";e["㍪"]="18点";e["㍫"]="19点";e["㍬"]="20点";e["㍭"]="21点";e["㍮"]="22点";e["㍯"]="23点";e["㍰"]="24点";e["㏠"]="1日";e["㏡"]="2日";e["㏢"]="3日";e["㏣"]="4日";e["㏤"]="5日";e["㏥"]="6日";e["㏦"]="7日";e["㏧"]="8日";e["㏨"]="9日";e["㏩"]="10日";e["㏪"]="11日";e["㏫"]="12日";e["㏬"]="13日";e["㏭"]="14日";e["㏮"]="15日";e["㏯"]="16日";e["㏰"]="17日";e["㏱"]="18日";e["㏲"]="19日";e["㏳"]="20日";e["㏴"]="21日";e["㏵"]="22日";e["㏶"]="23日";e["㏷"]="24日";e["㏸"]="25日";e["㏹"]="26日";e["㏺"]="27日";e["㏻"]="28日";e["㏼"]="29日";e["㏽"]="30日";e["㏾"]="31日";e["ff"]="ff";e["fi"]="fi";e["fl"]="fl";e["ffi"]="ffi";e["ffl"]="ffl";e["ſt"]="ſt";e["st"]="st";e["ﬓ"]="մն";e["ﬔ"]="մե";e["ﬕ"]="մի";e["ﬖ"]="վն";e["ﬗ"]="մխ";e["ﭏ"]="אל";e["ﭐ"]="ٱ";e["ﭑ"]="ٱ";e["ﭒ"]="ٻ";e["ﭓ"]="ٻ";e["ﭔ"]="ٻ";e["ﭕ"]="ٻ";e["ﭖ"]="پ";e["ﭗ"]="پ";e["ﭘ"]="پ";e["ﭙ"]="پ";e["ﭚ"]="ڀ";e["ﭛ"]="ڀ";e["ﭜ"]="ڀ";e["ﭝ"]="ڀ";e["ﭞ"]="ٺ";e["ﭟ"]="ٺ";e["ﭠ"]="ٺ";e["ﭡ"]="ٺ";e["ﭢ"]="ٿ";e["ﭣ"]="ٿ";e["ﭤ"]="ٿ";e["ﭥ"]="ٿ";e["ﭦ"]="ٹ";e["ﭧ"]="ٹ";e["ﭨ"]="ٹ";e["ﭩ"]="ٹ";e["ﭪ"]="ڤ";e["ﭫ"]="ڤ";e["ﭬ"]="ڤ";e["ﭭ"]="ڤ";e["ﭮ"]="ڦ";e["ﭯ"]="ڦ";e["ﭰ"]="ڦ";e["ﭱ"]="ڦ";e["ﭲ"]="ڄ";e["ﭳ"]="ڄ";e["ﭴ"]="ڄ";e["ﭵ"]="ڄ";e["ﭶ"]="ڃ";e["ﭷ"]="ڃ";e["ﭸ"]="ڃ";e["ﭹ"]="ڃ";e["ﭺ"]="چ";e["ﭻ"]="چ";e["ﭼ"]="چ";e["ﭽ"]="چ";e["ﭾ"]="ڇ";e["ﭿ"]="ڇ";e["ﮀ"]="ڇ";e["ﮁ"]="ڇ";e["ﮂ"]="ڍ";e["ﮃ"]="ڍ";e["ﮄ"]="ڌ";e["ﮅ"]="ڌ";e["ﮆ"]="ڎ";e["ﮇ"]="ڎ";e["ﮈ"]="ڈ";e["ﮉ"]="ڈ";e["ﮊ"]="ژ";e["ﮋ"]="ژ";e["ﮌ"]="ڑ";e["ﮍ"]="ڑ";e["ﮎ"]="ک";e["ﮏ"]="ک";e["ﮐ"]="ک";e["ﮑ"]="ک";e["ﮒ"]="گ";e["ﮓ"]="گ";e["ﮔ"]="گ";e["ﮕ"]="گ";e["ﮖ"]="ڳ";e["ﮗ"]="ڳ";e["ﮘ"]="ڳ";e["ﮙ"]="ڳ";e["ﮚ"]="ڱ";e["ﮛ"]="ڱ";e["ﮜ"]="ڱ";e["ﮝ"]="ڱ";e["ﮞ"]="ں";e["ﮟ"]="ں";e["ﮠ"]="ڻ";e["ﮡ"]="ڻ";e["ﮢ"]="ڻ";e["ﮣ"]="ڻ";e["ﮤ"]="ۀ";e["ﮥ"]="ۀ";e["ﮦ"]="ہ";e["ﮧ"]="ہ";e["ﮨ"]="ہ";e["ﮩ"]="ہ";e["ﮪ"]="ھ";e["ﮫ"]="ھ";e["ﮬ"]="ھ";e["ﮭ"]="ھ";e["ﮮ"]="ے";e["ﮯ"]="ے";e["ﮰ"]="ۓ";e["ﮱ"]="ۓ";e["ﯓ"]="ڭ";e["ﯔ"]="ڭ";e["ﯕ"]="ڭ";e["ﯖ"]="ڭ";e["ﯗ"]="ۇ";e["ﯘ"]="ۇ";e["ﯙ"]="ۆ";e["ﯚ"]="ۆ";e["ﯛ"]="ۈ";e["ﯜ"]="ۈ";e["ﯝ"]="ٷ";e["ﯞ"]="ۋ";e["ﯟ"]="ۋ";e["ﯠ"]="ۅ";e["ﯡ"]="ۅ";e["ﯢ"]="ۉ";e["ﯣ"]="ۉ";e["ﯤ"]="ې";e["ﯥ"]="ې";e["ﯦ"]="ې";e["ﯧ"]="ې";e["ﯨ"]="ى";e["ﯩ"]="ى";e["ﯪ"]="ئا";e["ﯫ"]="ئا";e["ﯬ"]="ئە";e["ﯭ"]="ئە";e["ﯮ"]="ئو";e["ﯯ"]="ئو";e["ﯰ"]="ئۇ";e["ﯱ"]="ئۇ";e["ﯲ"]="ئۆ";e["ﯳ"]="ئۆ";e["ﯴ"]="ئۈ";e["ﯵ"]="ئۈ";e["ﯶ"]="ئې";e["ﯷ"]="ئې";e["ﯸ"]="ئې";e["ﯹ"]="ئى";e["ﯺ"]="ئى";e["ﯻ"]="ئى";e["ﯼ"]="ی";e["ﯽ"]="ی";e["ﯾ"]="ی";e["ﯿ"]="ی";e["ﰀ"]="ئج";e["ﰁ"]="ئح";e["ﰂ"]="ئم";e["ﰃ"]="ئى";e["ﰄ"]="ئي";e["ﰅ"]="بج";e["ﰆ"]="بح";e["ﰇ"]="بخ";e["ﰈ"]="بم";e["ﰉ"]="بى";e["ﰊ"]="بي";e["ﰋ"]="تج";e["ﰌ"]="تح";e["ﰍ"]="تخ";e["ﰎ"]="تم";e["ﰏ"]="تى";e["ﰐ"]="تي";e["ﰑ"]="ثج";e["ﰒ"]="ثم";e["ﰓ"]="ثى";e["ﰔ"]="ثي";e["ﰕ"]="جح";e["ﰖ"]="جم";e["ﰗ"]="حج";e["ﰘ"]="حم";e["ﰙ"]="خج";e["ﰚ"]="خح";e["ﰛ"]="خم";e["ﰜ"]="سج";e["ﰝ"]="سح";e["ﰞ"]="سخ";e["ﰟ"]="سم";e["ﰠ"]="صح";e["ﰡ"]="صم";e["ﰢ"]="ضج";e["ﰣ"]="ضح";e["ﰤ"]="ضخ";e["ﰥ"]="ضم";e["ﰦ"]="طح";e["ﰧ"]="طم";e["ﰨ"]="ظم";e["ﰩ"]="عج";e["ﰪ"]="عم";e["ﰫ"]="غج";e["ﰬ"]="غم";e["ﰭ"]="فج";e["ﰮ"]="فح";e["ﰯ"]="فخ";e["ﰰ"]="فم";e["ﰱ"]="فى";e["ﰲ"]="في";e["ﰳ"]="قح";e["ﰴ"]="قم";e["ﰵ"]="قى";e["ﰶ"]="قي";e["ﰷ"]="كا";e["ﰸ"]="كج";e["ﰹ"]="كح";e["ﰺ"]="كخ";e["ﰻ"]="كل";e["ﰼ"]="كم";e["ﰽ"]="كى";e["ﰾ"]="كي";e["ﰿ"]="لج";e["ﱀ"]="لح";e["ﱁ"]="لخ";e["ﱂ"]="لم";e["ﱃ"]="لى";e["ﱄ"]="لي";e["ﱅ"]="مج";e["ﱆ"]="مح";e["ﱇ"]="مخ";e["ﱈ"]="مم";e["ﱉ"]="مى";e["ﱊ"]="مي";e["ﱋ"]="نج";e["ﱌ"]="نح";e["ﱍ"]="نخ";e["ﱎ"]="نم";e["ﱏ"]="نى";e["ﱐ"]="ني";e["ﱑ"]="هج";e["ﱒ"]="هم";e["ﱓ"]="هى";e["ﱔ"]="هي";e["ﱕ"]="يج";e["ﱖ"]="يح";e["ﱗ"]="يخ";e["ﱘ"]="يم";e["ﱙ"]="يى";e["ﱚ"]="يي";e["ﱛ"]="ذٰ";e["ﱜ"]="رٰ";e["ﱝ"]="ىٰ";e["ﱞ"]=" ٌّ";e["ﱟ"]=" ٍّ";e["ﱠ"]=" َّ";e["ﱡ"]=" ُّ";e["ﱢ"]=" ِّ";e["ﱣ"]=" ّٰ";e["ﱤ"]="ئر";e["ﱥ"]="ئز";e["ﱦ"]="ئم";e["ﱧ"]="ئن";e["ﱨ"]="ئى";e["ﱩ"]="ئي";e["ﱪ"]="بر";e["ﱫ"]="بز";e["ﱬ"]="بم";e["ﱭ"]="بن";e["ﱮ"]="بى";e["ﱯ"]="بي";e["ﱰ"]="تر";e["ﱱ"]="تز";e["ﱲ"]="تم";e["ﱳ"]="تن";e["ﱴ"]="تى";e["ﱵ"]="تي";e["ﱶ"]="ثر";e["ﱷ"]="ثز";e["ﱸ"]="ثم";e["ﱹ"]="ثن";e["ﱺ"]="ثى";e["ﱻ"]="ثي";e["ﱼ"]="فى";e["ﱽ"]="في";e["ﱾ"]="قى";e["ﱿ"]="قي";e["ﲀ"]="كا";e["ﲁ"]="كل";e["ﲂ"]="كم";e["ﲃ"]="كى";e["ﲄ"]="كي";e["ﲅ"]="لم";e["ﲆ"]="لى";e["ﲇ"]="لي";e["ﲈ"]="ما";e["ﲉ"]="مم";e["ﲊ"]="نر";e["ﲋ"]="نز";e["ﲌ"]="نم";e["ﲍ"]="نن";e["ﲎ"]="نى";e["ﲏ"]="ني";e["ﲐ"]="ىٰ";e["ﲑ"]="ير";e["ﲒ"]="يز";e["ﲓ"]="يم";e["ﲔ"]="ين";e["ﲕ"]="يى";e["ﲖ"]="يي";e["ﲗ"]="ئج";e["ﲘ"]="ئح";e["ﲙ"]="ئخ";e["ﲚ"]="ئم";e["ﲛ"]="ئه";e["ﲜ"]="بج";e["ﲝ"]="بح";e["ﲞ"]="بخ";e["ﲟ"]="بم";e["ﲠ"]="به";e["ﲡ"]="تج";e["ﲢ"]="تح";e["ﲣ"]="تخ";e["ﲤ"]="تم";e["ﲥ"]="ته";e["ﲦ"]="ثم";e["ﲧ"]="جح";e["ﲨ"]="جم";e["ﲩ"]="حج";e["ﲪ"]="حم";e["ﲫ"]="خج";e["ﲬ"]="خم";e["ﲭ"]="سج";e["ﲮ"]="سح";e["ﲯ"]="سخ";e["ﲰ"]="سم";e["ﲱ"]="صح";e["ﲲ"]="صخ";e["ﲳ"]="صم";e["ﲴ"]="ضج";e["ﲵ"]="ضح";e["ﲶ"]="ضخ";e["ﲷ"]="ضم";e["ﲸ"]="طح";e["ﲹ"]="ظم";e["ﲺ"]="عج";e["ﲻ"]="عم";e["ﲼ"]="غج";e["ﲽ"]="غم";e["ﲾ"]="فج";e["ﲿ"]="فح";e["ﳀ"]="فخ";e["ﳁ"]="فم";e["ﳂ"]="قح";e["ﳃ"]="قم";e["ﳄ"]="كج";e["ﳅ"]="كح";e["ﳆ"]="كخ";e["ﳇ"]="كل";e["ﳈ"]="كم";e["ﳉ"]="لج";e["ﳊ"]="لح";e["ﳋ"]="لخ";e["ﳌ"]="لم";e["ﳍ"]="له";e["ﳎ"]="مج";e["ﳏ"]="مح";e["ﳐ"]="مخ";e["ﳑ"]="مم";e["ﳒ"]="نج";e["ﳓ"]="نح";e["ﳔ"]="نخ";e["ﳕ"]="نم";e["ﳖ"]="نه";e["ﳗ"]="هج";e["ﳘ"]="هم";e["ﳙ"]="هٰ";e["ﳚ"]="يج";e["ﳛ"]="يح";e["ﳜ"]="يخ";e["ﳝ"]="يم";e["ﳞ"]="يه";e["ﳟ"]="ئم";e["ﳠ"]="ئه";e["ﳡ"]="بم";e["ﳢ"]="به";e["ﳣ"]="تم";e["ﳤ"]="ته";e["ﳥ"]="ثم";e["ﳦ"]="ثه";e["ﳧ"]="سم";e["ﳨ"]="سه";e["ﳩ"]="شم";e["ﳪ"]="شه";e["ﳫ"]="كل";e["ﳬ"]="كم";e["ﳭ"]="لم";e["ﳮ"]="نم";e["ﳯ"]="نه";e["ﳰ"]="يم";e["ﳱ"]="يه";e["ﳲ"]="ـَّ";e["ﳳ"]="ـُّ";e["ﳴ"]="ـِّ";e["ﳵ"]="طى";e["ﳶ"]="طي";e["ﳷ"]="عى";e["ﳸ"]="عي";e["ﳹ"]="غى";e["ﳺ"]="غي";e["ﳻ"]="سى";e["ﳼ"]="سي";e["ﳽ"]="شى";e["ﳾ"]="شي";e["ﳿ"]="حى";e["ﴀ"]="حي";e["ﴁ"]="جى";e["ﴂ"]="جي";e["ﴃ"]="خى";e["ﴄ"]="خي";e["ﴅ"]="صى";e["ﴆ"]="صي";e["ﴇ"]="ضى";e["ﴈ"]="ضي";e["ﴉ"]="شج";e["ﴊ"]="شح";e["ﴋ"]="شخ";e["ﴌ"]="شم";e["ﴍ"]="شر";e["ﴎ"]="سر";e["ﴏ"]="صر";e["ﴐ"]="ضر";e["ﴑ"]="طى";e["ﴒ"]="طي";e["ﴓ"]="عى";e["ﴔ"]="عي";e["ﴕ"]="غى";e["ﴖ"]="غي";e["ﴗ"]="سى";e["ﴘ"]="سي";e["ﴙ"]="شى";e["ﴚ"]="شي";e["ﴛ"]="حى";e["ﴜ"]="حي";e["ﴝ"]="جى";e["ﴞ"]="جي";e["ﴟ"]="خى";e["ﴠ"]="خي";e["ﴡ"]="صى";e["ﴢ"]="صي";e["ﴣ"]="ضى";e["ﴤ"]="ضي";e["ﴥ"]="شج";e["ﴦ"]="شح";e["ﴧ"]="شخ";e["ﴨ"]="شم";e["ﴩ"]="شر";e["ﴪ"]="سر";e["ﴫ"]="صر";e["ﴬ"]="ضر";e["ﴭ"]="شج";e["ﴮ"]="شح";e["ﴯ"]="شخ";e["ﴰ"]="شم";e["ﴱ"]="سه";e["ﴲ"]="شه";e["ﴳ"]="طم";e["ﴴ"]="سج";e["ﴵ"]="سح";e["ﴶ"]="سخ";e["ﴷ"]="شج";e["ﴸ"]="شح";e["ﴹ"]="شخ";e["ﴺ"]="طم";e["ﴻ"]="ظم";e["ﴼ"]="اً";e["ﴽ"]="اً";e["ﵐ"]="تجم";e["ﵑ"]="تحج";e["ﵒ"]="تحج";e["ﵓ"]="تحم";e["ﵔ"]="تخم";e["ﵕ"]="تمج";e["ﵖ"]="تمح";e["ﵗ"]="تمخ";e["ﵘ"]="جمح";e["ﵙ"]="جمح";e["ﵚ"]="حمي";e["ﵛ"]="حمى";e["ﵜ"]="سحج";e["ﵝ"]="سجح";e["ﵞ"]="سجى";e["ﵟ"]="سمح";e["ﵠ"]="سمح";e["ﵡ"]="سمج";e["ﵢ"]="سمم";e["ﵣ"]="سمم";e["ﵤ"]="صحح";e["ﵥ"]="صحح";e["ﵦ"]="صمم";e["ﵧ"]="شحم";e["ﵨ"]="شحم";e["ﵩ"]="شجي";e["ﵪ"]="شمخ";e["ﵫ"]="شمخ";e["ﵬ"]="شمم";e["ﵭ"]="شمم";e["ﵮ"]="ضحى";e["ﵯ"]="ضخم";e["ﵰ"]="ضخم";e["ﵱ"]="طمح";e["ﵲ"]="طمح";e["ﵳ"]="طمم";e["ﵴ"]="طمي";e["ﵵ"]="عجم";e["ﵶ"]="عمم";e["ﵷ"]="عمم";e["ﵸ"]="عمى";e["ﵹ"]="غمم";e["ﵺ"]="غمي";e["ﵻ"]="غمى";e["ﵼ"]="فخم";e["ﵽ"]="فخم";e["ﵾ"]="قمح";e["ﵿ"]="قمم";e["ﶀ"]="لحم";e["ﶁ"]="لحي";e["ﶂ"]="لحى";e["ﶃ"]="لجج";e["ﶄ"]="لجج";e["ﶅ"]="لخم";e["ﶆ"]="لخم";e["ﶇ"]="لمح";e["ﶈ"]="لمح";e["ﶉ"]="محج";e["ﶊ"]="محم";e["ﶋ"]="محي";e["ﶌ"]="مجح";e["ﶍ"]="مجم";e["ﶎ"]="مخج";e["ﶏ"]="مخم";e["ﶒ"]="مجخ";e["ﶓ"]="همج";e["ﶔ"]="همم";e["ﶕ"]="نحم";e["ﶖ"]="نحى";e["ﶗ"]="نجم";e["ﶘ"]="نجم";e["ﶙ"]="نجى";e["ﶚ"]="نمي";e["ﶛ"]="نمى";e["ﶜ"]="يمم";e["ﶝ"]="يمم";e["ﶞ"]="بخي";e["ﶟ"]="تجي";e["ﶠ"]="تجى";e["ﶡ"]="تخي";e["ﶢ"]="تخى";e["ﶣ"]="تمي";e["ﶤ"]="تمى";e["ﶥ"]="جمي";e["ﶦ"]="جحى";e["ﶧ"]="جمى";e["ﶨ"]="سخى";e["ﶩ"]="صحي";e["ﶪ"]="شحي";e["ﶫ"]="ضحي";e["ﶬ"]="لجي";e["ﶭ"]="لمي";e["ﶮ"]="يحي";e["ﶯ"]="يجي";e["ﶰ"]="يمي";e["ﶱ"]="ممي";e["ﶲ"]="قمي";e["ﶳ"]="نحي";e["ﶴ"]="قمح";e["ﶵ"]="لحم";e["ﶶ"]="عمي";e["ﶷ"]="كمي";e["ﶸ"]="نجح";e["ﶹ"]="مخي";e["ﶺ"]="لجم";e["ﶻ"]="كمم";e["ﶼ"]="لجم";e["ﶽ"]="نجح";e["ﶾ"]="جحي";e["ﶿ"]="حجي";e["ﷀ"]="مجي";e["ﷁ"]="فمي";e["ﷂ"]="بحي";e["ﷃ"]="كمم";e["ﷄ"]="عجم";e["ﷅ"]="صمم";e["ﷆ"]="سخي";e["ﷇ"]="نجي";e["﹉"]="‾";e["﹊"]="‾";e["﹋"]="‾";e["﹌"]="‾";e["﹍"]="_";e["﹎"]="_";e["﹏"]="_";e["ﺀ"]="ء";e["ﺁ"]="آ";e["ﺂ"]="آ";e["ﺃ"]="أ";e["ﺄ"]="أ";e["ﺅ"]="ؤ";e["ﺆ"]="ؤ";e["ﺇ"]="إ";e["ﺈ"]="إ";e["ﺉ"]="ئ";e["ﺊ"]="ئ";e["ﺋ"]="ئ";e["ﺌ"]="ئ";e["ﺍ"]="ا";e["ﺎ"]="ا";e["ﺏ"]="ب";e["ﺐ"]="ب";e["ﺑ"]="ب";e["ﺒ"]="ب";e["ﺓ"]="ة";e["ﺔ"]="ة";e["ﺕ"]="ت";e["ﺖ"]="ت";e["ﺗ"]="ت";e["ﺘ"]="ت";e["ﺙ"]="ث";e["ﺚ"]="ث";e["ﺛ"]="ث";e["ﺜ"]="ث";e["ﺝ"]="ج";e["ﺞ"]="ج";e["ﺟ"]="ج";e["ﺠ"]="ج";e["ﺡ"]="ح";e["ﺢ"]="ح";e["ﺣ"]="ح";e["ﺤ"]="ح";e["ﺥ"]="خ";e["ﺦ"]="خ";e["ﺧ"]="خ";e["ﺨ"]="خ";e["ﺩ"]="د";e["ﺪ"]="د";e["ﺫ"]="ذ";e["ﺬ"]="ذ";e["ﺭ"]="ر";e["ﺮ"]="ر";e["ﺯ"]="ز";e["ﺰ"]="ز";e["ﺱ"]="س";e["ﺲ"]="س";e["ﺳ"]="س";e["ﺴ"]="س";e["ﺵ"]="ش";e["ﺶ"]="ش";e["ﺷ"]="ش";e["ﺸ"]="ش";e["ﺹ"]="ص";e["ﺺ"]="ص";e["ﺻ"]="ص";e["ﺼ"]="ص";e["ﺽ"]="ض";e["ﺾ"]="ض";e["ﺿ"]="ض";e["ﻀ"]="ض";e["ﻁ"]="ط";e["ﻂ"]="ط";e["ﻃ"]="ط";e["ﻄ"]="ط";e["ﻅ"]="ظ";e["ﻆ"]="ظ";e["ﻇ"]="ظ";e["ﻈ"]="ظ";e["ﻉ"]="ع";e["ﻊ"]="ع";e["ﻋ"]="ع";e["ﻌ"]="ع";e["ﻍ"]="غ";e["ﻎ"]="غ";e["ﻏ"]="غ";e["ﻐ"]="غ";e["ﻑ"]="ف";e["ﻒ"]="ف";e["ﻓ"]="ف";e["ﻔ"]="ف";e["ﻕ"]="ق";e["ﻖ"]="ق";e["ﻗ"]="ق";e["ﻘ"]="ق";e["ﻙ"]="ك";e["ﻚ"]="ك";e["ﻛ"]="ك";e["ﻜ"]="ك";e["ﻝ"]="ل";e["ﻞ"]="ل";e["ﻟ"]="ل";e["ﻠ"]="ل";e["ﻡ"]="م";e["ﻢ"]="م";e["ﻣ"]="م";e["ﻤ"]="م";e["ﻥ"]="ن";e["ﻦ"]="ن";e["ﻧ"]="ن";e["ﻨ"]="ن";e["ﻩ"]="ه";e["ﻪ"]="ه";e["ﻫ"]="ه";e["ﻬ"]="ه";e["ﻭ"]="و";e["ﻮ"]="و";e["ﻯ"]="ى";e["ﻰ"]="ى";e["ﻱ"]="ي";e["ﻲ"]="ي";e["ﻳ"]="ي";e["ﻴ"]="ي";e["ﻵ"]="لآ";e["ﻶ"]="لآ";e["ﻷ"]="لأ";e["ﻸ"]="لأ";e["ﻹ"]="لإ";e["ﻺ"]="لإ";e["ﻻ"]="لا";e["ﻼ"]="لا"});t.mapSpecialUnicodeValues=function(e){return e>=65520&&e<=65535?0:e>=62976&&e<=63743?i()[e]||e:173===e?45:e};t.reverseIfRtl=function(e){var t,r,a=e.length;if(a<=1||!(t=e.charCodeAt(0),r=n[13],t>=r.begin&&t<r.end||t>=(r=n[11]).begin&&t<r.end))return e;for(var i="",o=a-1;o>=0;o--)i+=e[o];return i};t.getUnicodeRangeFor=function(e){for(var t=0,r=n.length;t<r;t++){var a=n[t];if(e>=a.begin&&e<a.end)return t}return-1};t.getNormalizedUnicodes=o;t.getUnicodeForGlyph=function(e,t){var r=t[e];if(void 0!==r)return r;if(!e)return-1;if("u"===e[0]){var a,i=e.length;if(7===i&&"n"===e[1]&&"i"===e[2])a=e.substring(3);else{if(!(i>=5&&i<=7))return-1;a=e.substring(1)}if(a===a.toUpperCase()&&(r=parseInt(a,16))>=0)return r}return-1}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.FontRendererFactory=void 0;var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1;a.configurable=!0;"value"in a&&(a.writable=!0);Object.defineProperty(e,a.key,a)}}return function(t,r,a){r&&e(t.prototype,r);a&&e(t,a);return t}}(),i=r(2),n=r(157),o=r(160),s=r(159),c=r(140);function l(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var f=function(){function e(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function t(e,t){return e[t]<<8|e[t+1]}function r(r,a,n){var o,s,c,l=1===t(r,a+2)?e(r,a+8):e(r,a+16),u=t(r,a+l);if(4===u){t(r,a+l+2);var h=t(r,a+l+6)>>1;s=a+l+14;o=[];for(c=0;c<h;c++,s+=2)o[c]={end:t(r,s)};s+=2;for(c=0;c<h;c++,s+=2)o[c].start=t(r,s);for(c=0;c<h;c++,s+=2)o[c].idDelta=t(r,s);for(c=0;c<h;c++,s+=2){var f=t(r,s);if(0!==f){o[c].ids=[];for(var d=0,g=o[c].end-o[c].start+1;d<g;d++){o[c].ids[d]=t(r,s+f);f+=2}}}return o}if(12===u){e(r,a+l+4);var m=e(r,a+l+12);s=a+l+16;o=[];for(c=0;c<m;c++){o.push({start:e(r,s),end:e(r,s+4),idDelta:e(r,s+8)-e(r,s)});s+=12}return o}throw new i.FormatError("unsupported cmap: "+u)}function f(e,t,r,a){var i=new n.CFFParser(new c.Stream(e,t,r-t),{},a).parse();return{glyphs:i.charStrings.objects,subrs:i.topDict.privateDict&&i.topDict.privateDict.subrsIndex&&i.topDict.privateDict.subrsIndex.objects,gsubrs:i.globalSubrIndex&&i.globalSubrIndex.objects,isCFFCIDFont:i.isCIDFont,fdSelect:i.fdSelect,fdArray:i.fdArray}}function d(e,t){for(var r=t.codePointAt(0),a=0,i=0,n=e.length-1;i<n;){var o=i+n+1>>1;r<e[o].start?n=o-1:i=o}e[i].start<=r&&r<=e[i].end&&(a=e[i].idDelta+(e[i].ids?e[i].ids[r-e[i].start]:r)&65535);return{charCode:r,glyphId:a}}var g=[],m=function(){function e(t){h(this,e);this.constructor===e&&(0,i.unreachable)("Cannot initialize CompiledFont.");this.fontMatrix=t;this.compiledGlyphs=Object.create(null);this.compiledCharCodeToGlyphId=Object.create(null)}a(e,[{key:"getPathJs",value:function(e){var t=d(this.cmap,e),r=this.compiledGlyphs[t.glyphId];if(!r){r=this.compileGlyph(this.glyphs[t.glyphId],t.glyphId);this.compiledGlyphs[t.glyphId]=r}void 0===this.compiledCharCodeToGlyphId[t.charCode]&&(this.compiledCharCodeToGlyphId[t.charCode]=t.glyphId);return r}},{key:"compileGlyph",value:function(e,t){if(!e||0===e.length||14===e[0])return g;var r=this.fontMatrix;if(this.isCFFCIDFont){var a=this.fdSelect.getFDIndex(t);if(a>=0&&a<this.fdArray.length){r=this.fdArray[a].getByName("FontMatrix")||i.FONT_IDENTITY_MATRIX}else(0,i.warn)("Invalid fd index for glyph index.")}var n=[];n.push({cmd:"save"});n.push({cmd:"transform",args:r.slice()});n.push({cmd:"scale",args:["size","-size"]});this.compileGlyphImpl(e,n,t);n.push({cmd:"restore"});return n}},{key:"compileGlyphImpl",value:function(){(0,i.unreachable)("Children classes should implement this.")}},{key:"hasBuiltPath",value:function(e){var t=d(this.cmap,e);return void 0!==this.compiledGlyphs[t.glyphId]&&void 0!==this.compiledCharCodeToGlyphId[t.charCode]}}]);return e}(),p=function(e){u(t,m);function t(e,r,a){h(this,t);var i=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a||[488e-6,0,0,488e-6,0,0]));i.glyphs=e;i.cmap=r;return i}a(t,[{key:"compileGlyphImpl",value:function(e,t){!function e(t,r,a){function i(e,t){r.push({cmd:"moveTo",args:[e,t]})}function n(e,t){r.push({cmd:"lineTo",args:[e,t]})}function o(e,t,a,i){r.push({cmd:"quadraticCurveTo",args:[e,t,a,i]})}var s,c=0,l=(t[c]<<24|t[c+1]<<16)>>16,u=0,h=0;c+=10;if(l<0)do{s=t[c]<<8|t[c+1];var f,d,g=t[c+2]<<8|t[c+3];c+=4;if(1&s){f=(t[c]<<24|t[c+1]<<16)>>16;d=(t[c+2]<<24|t[c+3]<<16)>>16;c+=4}else{f=t[c++];d=t[c++]}if(2&s){u=f;h=d}else{u=0;h=0}var m=1,p=1,v=0,b=0;if(8&s){m=p=(t[c]<<24|t[c+1]<<16)/1073741824;c+=2}else if(64&s){m=(t[c]<<24|t[c+1]<<16)/1073741824;p=(t[c+2]<<24|t[c+3]<<16)/1073741824;c+=4}else if(128&s){m=(t[c]<<24|t[c+1]<<16)/1073741824;v=(t[c+2]<<24|t[c+3]<<16)/1073741824;b=(t[c+4]<<24|t[c+5]<<16)/1073741824;p=(t[c+6]<<24|t[c+7]<<16)/1073741824;c+=8}var y=a.glyphs[g];if(y){r.push({cmd:"save"});r.push({cmd:"transform",args:[m,v,b,p,u,h]});e(y,r,a);r.push({cmd:"restore"})}}while(32&s);else{var w,k,S=[];for(w=0;w<l;w++){S.push(t[c]<<8|t[c+1]);c+=2}c+=2+(t[c]<<8|t[c+1]);for(var C=S[S.length-1]+1,x=[];x.length<C;){var _=1;8&(s=t[c++])&&(_+=t[c++]);for(;_-- >0;)x.push({flags:s})}for(w=0;w<C;w++){switch(18&x[w].flags){case 0:u+=(t[c]<<24|t[c+1]<<16)>>16;c+=2;break;case 2:u-=t[c++];break;case 18:u+=t[c++]}x[w].x=u}for(w=0;w<C;w++){switch(36&x[w].flags){case 0:h+=(t[c]<<24|t[c+1]<<16)>>16;c+=2;break;case 4:h-=t[c++];break;case 36:h+=t[c++]}x[w].y=h}var A=0;for(c=0;c<l;c++){var P=S[c],I=x.slice(A,P+1);if(1&I[0].flags)I.push(I[0]);else if(1&I[I.length-1].flags)I.unshift(I[I.length-1]);else{var O={flags:1,x:(I[0].x+I[I.length-1].x)/2,y:(I[0].y+I[I.length-1].y)/2};I.unshift(O);I.push(O)}i(I[0].x,I[0].y);for(w=1,k=I.length;w<k;w++)if(1&I[w].flags)n(I[w].x,I[w].y);else if(1&I[w+1].flags){o(I[w].x,I[w].y,I[w+1].x,I[w+1].y);w++}else o(I[w].x,I[w].y,(I[w].x+I[w+1].x)/2,(I[w].y+I[w+1].y)/2);A=P+1}}}(e,t,this)}}]);return t}(),v=function(e){u(t,m);function t(e,r,a,i){h(this,t);var n=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a||[.001,0,0,.001,0,0]));n.glyphs=e.glyphs;n.gsubrs=e.gsubrs||[];n.subrs=e.subrs||[];n.cmap=r;n.glyphNameMap=i||(0,o.getGlyphsUnicode)();n.gsubrsBias=n.gsubrs.length<1240?107:n.gsubrs.length<33900?1131:32768;n.subrsBias=n.subrs.length<1240?107:n.subrs.length<33900?1131:32768;n.isCFFCIDFont=e.isCFFCIDFont;n.fdSelect=e.fdSelect;n.fdArray=e.fdArray;return n}a(t,[{key:"compileGlyphImpl",value:function(e,t,r){!function e(t,r,a,n){var o=[],c=0,l=0,u=0;function h(e,t){r.push({cmd:"moveTo",args:[e,t]})}function f(e,t){r.push({cmd:"lineTo",args:[e,t]})}function g(e,t,a,i,n,o){r.push({cmd:"bezierCurveTo",args:[e,t,a,i,n,o]})}!function t(m){for(var p=0;p<m.length;){var v,b,y,w,k,S,C,x,_=!1,A=m[p++];switch(A){case 1:case 3:u+=o.length>>1;_=!0;break;case 4:l+=o.pop();h(c,l);_=!0;break;case 5:for(;o.length>0;){c+=o.shift();l+=o.shift();f(c,l)}break;case 6:for(;o.length>0;){f(c+=o.shift(),l);if(0===o.length)break;l+=o.shift();f(c,l)}break;case 7:for(;o.length>0;){l+=o.shift();f(c,l);if(0===o.length)break;f(c+=o.shift(),l)}break;case 8:for(;o.length>0;){v=c+o.shift();y=l+o.shift();b=v+o.shift();w=y+o.shift();c=b+o.shift();l=w+o.shift();g(v,y,b,w,c,l)}break;case 10:C=o.pop();x=null;if(a.isCFFCIDFont){var P=a.fdSelect.getFDIndex(n);if(P>=0&&P<a.fdArray.length){var I=a.fdArray[P],O=void 0;I.privateDict&&I.privateDict.subrsIndex&&(O=I.privateDict.subrsIndex.objects);if(O){var T=O.length;x=O[C+=T<1240?107:T<33900?1131:32768]}}else(0,i.warn)("Invalid fd index for glyph index.")}else x=a.subrs[C+a.subrsBias];x&&t(x);break;case 11:return;case 12:switch(A=m[p++]){case 34:b=(v=c+o.shift())+o.shift();k=l+o.shift();c=b+o.shift();g(v,l,b,k,c,k);b=(v=c+o.shift())+o.shift();c=b+o.shift();g(v,k,b,l,c,l);break;case 35:v=c+o.shift();y=l+o.shift();b=v+o.shift();w=y+o.shift();c=b+o.shift();l=w+o.shift();g(v,y,b,w,c,l);v=c+o.shift();y=l+o.shift();b=v+o.shift();w=y+o.shift();c=b+o.shift();l=w+o.shift();g(v,y,b,w,c,l);o.pop();break;case 36:g(v=c+o.shift(),k=l+o.shift(),b=v+o.shift(),S=k+o.shift(),c=b+o.shift(),S);g(v=c+o.shift(),S,b=v+o.shift(),S+o.shift(),c=b+o.shift(),l);break;case 37:var E=c,F=l;v=c+o.shift();y=l+o.shift();b=v+o.shift();w=y+o.shift();c=b+o.shift();l=w+o.shift();g(v,y,b,w,c,l);v=c+o.shift();y=l+o.shift();b=v+o.shift();w=y+o.shift();c=b;l=w;Math.abs(c-E)>Math.abs(l-F)?c+=o.shift():l+=o.shift();g(v,y,b,w,c,l);break;default:throw new i.FormatError("unknown operator: 12 "+A)}break;case 14:if(o.length>=4){var R=o.pop(),B=o.pop();l=o.pop();c=o.pop();r.push({cmd:"save"});r.push({cmd:"translate",args:[c,l]});var D=d(a.cmap,String.fromCharCode(a.glyphNameMap[s.StandardEncoding[R]]));e(a.glyphs[D.glyphId],r,a,D.glyphId);r.push({cmd:"restore"});D=d(a.cmap,String.fromCharCode(a.glyphNameMap[s.StandardEncoding[B]]));e(a.glyphs[D.glyphId],r,a,D.glyphId)}return;case 18:u+=o.length>>1;_=!0;break;case 19:case 20:p+=(u+=o.length>>1)+7>>3;_=!0;break;case 21:l+=o.pop();h(c+=o.pop(),l);_=!0;break;case 22:h(c+=o.pop(),l);_=!0;break;case 23:u+=o.length>>1;_=!0;break;case 24:for(;o.length>2;){v=c+o.shift();y=l+o.shift();b=v+o.shift();w=y+o.shift();c=b+o.shift();l=w+o.shift();g(v,y,b,w,c,l)}c+=o.shift();l+=o.shift();f(c,l);break;case 25:for(;o.length>6;){c+=o.shift();l+=o.shift();f(c,l)}v=c+o.shift();y=l+o.shift();b=v+o.shift();w=y+o.shift();c=b+o.shift();l=w+o.shift();g(v,y,b,w,c,l);break;case 26:o.length%2&&(c+=o.shift());for(;o.length>0;){v=c;y=l+o.shift();b=v+o.shift();w=y+o.shift();c=b;l=w+o.shift();g(v,y,b,w,c,l)}break;case 27:o.length%2&&(l+=o.shift());for(;o.length>0;)g(v=c+o.shift(),y=l,b=v+o.shift(),w=y+o.shift(),c=b+o.shift(),l=w);break;case 28:o.push((m[p]<<24|m[p+1]<<16)>>16);p+=2;break;case 29:C=o.pop()+a.gsubrsBias;(x=a.gsubrs[C])&&t(x);break;case 30:for(;o.length>0;){v=c;y=l+o.shift();b=v+o.shift();w=y+o.shift();c=b+o.shift();l=w+(1===o.length?o.shift():0);g(v,y,b,w,c,l);if(0===o.length)break;v=c+o.shift();y=l;b=v+o.shift();w=y+o.shift();l=w+o.shift();g(v,y,b,w,c=b+(1===o.length?o.shift():0),l)}break;case 31:for(;o.length>0;){v=c+o.shift();y=l;b=v+o.shift();w=y+o.shift();l=w+o.shift();g(v,y,b,w,c=b+(1===o.length?o.shift():0),l);if(0===o.length)break;v=c;y=l+o.shift();b=v+o.shift();w=y+o.shift();c=b+o.shift();l=w+(1===o.length?o.shift():0);g(v,y,b,w,c,l)}break;default:if(A<32)throw new i.FormatError("unknown operator: "+A);if(A<247)o.push(A-139);else if(A<251)o.push(256*(A-247)+m[p++]+108);else if(A<255)o.push(256*-(A-251)-m[p++]-108);else{o.push((m[p]<<24|m[p+1]<<16|m[p+2]<<8|m[p+3])/65536);p+=4}}_&&(o.length=0)}}(t)}(e,t,this,r)}}]);return t}();return{create:function(a,n){for(var o,s,c,l,u,h,d=new Uint8Array(a.data),g=t(d,4),m=0,b=12;m<g;m++,b+=16){var y=(0,i.bytesToString)(d.subarray(b,b+4)),w=e(d,b+8),k=e(d,b+12);switch(y){case"cmap":o=r(d,w);break;case"glyf":s=d.subarray(w,w+k);break;case"loca":c=d.subarray(w,w+k);break;case"head":h=t(d,w+18);u=t(d,w+50);break;case"CFF ":l=f(d,w,w+k,n)}}if(s){var S=h?[1/h,0,0,1/h,0,0]:a.fontMatrix;return new p(function(e,t,r){var a,i;if(r){a=4;i=function(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}}else{a=2;i=function(e,t){return e[t]<<9|e[t+1]<<1}}for(var n=[],o=i(t,0),s=a;s<t.length;s+=a){var c=i(t,s);n.push(e.subarray(o,c));o=c}return n}(s,c,u),o,S)}return new v(l,o,a.fontMatrix,a.glyphNameMap)}}}();t.FontRendererFactory=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.Type1Parser=void 0;var a=r(2),i=r(159),n=r(140),o=function(){var e=[4],t=[5],r=[6],i=[7],n=[8],o=[12,35],s=[14],c=[21],l=[22],u=[30],h=[31];function f(){this.width=0;this.lsb=0;this.flexing=!1;this.output=[];this.stack=[]}f.prototype={convert:function(f,d,g){for(var m,p,v,b=f.length,y=!1,w=0;w<b;w++){var k=f[w];if(k<32){12===k&&(k=(k<<8)+f[++w]);switch(k){case 1:case 3:this.stack=[];break;case 4:if(this.flexing){if(this.stack.length<1){y=!0;break}var S=this.stack.pop();this.stack.push(0,S);break}y=this.executeCommand(1,e);break;case 5:y=this.executeCommand(2,t);break;case 6:y=this.executeCommand(1,r);break;case 7:y=this.executeCommand(1,i);break;case 8:y=this.executeCommand(6,n);break;case 9:this.stack=[];break;case 10:if(this.stack.length<1){y=!0;break}if(!d[v=this.stack.pop()]){y=!0;break}y=this.convert(d[v],d,g);break;case 11:return y;case 13:if(this.stack.length<2){y=!0;break}m=this.stack.pop();p=this.stack.pop();this.lsb=p;this.width=m;this.stack.push(m,p);y=this.executeCommand(2,l);break;case 14:this.output.push(s[0]);break;case 21:if(this.flexing)break;y=this.executeCommand(2,c);break;case 22:if(this.flexing){this.stack.push(0);break}y=this.executeCommand(1,l);break;case 30:y=this.executeCommand(4,u);break;case 31:y=this.executeCommand(4,h);break;case 3072:case 3073:case 3074:this.stack=[];break;case 3078:if(g){this.seac=this.stack.splice(-4,4);y=this.executeCommand(0,s)}else y=this.executeCommand(4,s);break;case 3079:if(this.stack.length<4){y=!0;break}this.stack.pop();m=this.stack.pop();var C=this.stack.pop();p=this.stack.pop();this.lsb=p;this.width=m;this.stack.push(m,p,C);y=this.executeCommand(3,c);break;case 3084:if(this.stack.length<2){y=!0;break}var x=this.stack.pop(),_=this.stack.pop();this.stack.push(_/x);break;case 3088:if(this.stack.length<2){y=!0;break}v=this.stack.pop();var A=this.stack.pop();if(0===v&&3===A){var P=this.stack.splice(this.stack.length-17,17);this.stack.push(P[2]+P[0],P[3]+P[1],P[4],P[5],P[6],P[7],P[8],P[9],P[10],P[11],P[12],P[13],P[14]);y=this.executeCommand(13,o,!0);this.flexing=!1;this.stack.push(P[15],P[16])}else 1===v&&0===A&&(this.flexing=!0);break;case 3089:break;case 3105:this.stack=[];break;default:(0,a.warn)('Unknown type 1 charstring command of "'+k+'"')}if(y)break}else{k<=246?k-=139:k=k<=250?256*(k-247)+f[++w]+108:k<=254?-256*(k-251)-f[++w]-108:(255&f[++w])<<24|(255&f[++w])<<16|(255&f[++w])<<8|(255&f[++w])<<0;this.stack.push(k)}}return y},executeCommand:function(e,t,r){var a=this.stack.length;if(e>a)return!0;for(var i=a-e,n=i;n<a;n++){var o=this.stack[n];if(Number.isInteger(o))this.output.push(28,o>>8&255,255&o);else{o=65536*o|0;this.output.push(255,o>>24&255,o>>16&255,o>>8&255,255&o)}}this.output.push.apply(this.output,t);r?this.stack.splice(i,e):this.stack.length=0;return!1}};return f}(),s=function(){var e=55665;function t(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function r(e,t,r){if(r>=e.length)return new Uint8Array(0);var a,i,n=0|t;for(a=0;a<r;a++)n=52845*(e[a]+n)+22719&65535;var o=e.length-r,s=new Uint8Array(o);for(a=r,i=0;i<o;a++,i++){var c=e[a];s[i]=c^n>>8;n=52845*(c+n)+22719&65535}return s}function s(e){return 47===e||91===e||93===e||123===e||125===e||40===e||41===e}function c(a,i,o){if(i){var s=a.getBytes(),c=!(t(s[0])&&t(s[1])&&t(s[2])&&t(s[3]));a=new n.Stream(c?r(s,e,4):function(e,r,a){var i,n,o=0|r,s=e.length,c=new Uint8Array(s>>>1);for(i=0,n=0;i<s;i++){var l=e[i];if(t(l)){i++;for(var u;i<s&&!t(u=e[i]);)i++;if(i<s){var h=parseInt(String.fromCharCode(l,u),16);c[n++]=h^o>>8;o=52845*(h+o)+22719&65535}}}return Array.prototype.slice.call(c,a,n)}(s,e,4))}this.seacAnalysisEnabled=!!o;this.stream=a;this.nextChar()}c.prototype={readNumberArray:function(){this.getToken();for(var e=[];;){var t=this.getToken();if(null===t||"]"===t||"}"===t)break;e.push(parseFloat(t||0))}return e},readNumber:function(){var e=this.getToken();return parseFloat(e||0)},readInt:function(){var e=this.getToken();return 0|parseInt(e||0,10)},readBoolean:function(){return"true"===this.getToken()?1:0},nextChar:function(){return this.currentChar=this.stream.getByte()},getToken:function(){for(var e=!1,t=this.currentChar;;){if(-1===t)return null;if(e)10!==t&&13!==t||(e=!1);else if(37===t)e=!0;else if(!(0,a.isSpace)(t))break;t=this.nextChar()}if(s(t)){this.nextChar();return String.fromCharCode(t)}var r="";do{r+=String.fromCharCode(t);t=this.nextChar()}while(t>=0&&!(0,a.isSpace)(t)&&!s(t));return r},readCharStrings:function(e,t){return-1===t?e:r(e,4330,t)},extractFontProgram:function(){var e=this.stream,t=[],r=[],a=Object.create(null);a.lenIV=4;for(var i,n,s,c,l,u={subrs:[],charstrings:[],properties:{privateData:a}};null!==(i=this.getToken());)if("/"===i)switch(i=this.getToken()){case"CharStrings":this.getToken();this.getToken();this.getToken();this.getToken();for(;null!==(i=this.getToken())&&"end"!==i;)if("/"===i){var h=this.getToken();n=this.readInt();this.getToken();s=n>0?e.getBytes(n):new Uint8Array(0);c=u.properties.privateData.lenIV;l=this.readCharStrings(s,c);this.nextChar();"noaccess"===(i=this.getToken())&&this.getToken();r.push({glyph:h,encoded:l})}break;case"Subrs":this.readInt();this.getToken();for(;"dup"===this.getToken();){var f=this.readInt();n=this.readInt();this.getToken();s=n>0?e.getBytes(n):new Uint8Array(0);c=u.properties.privateData.lenIV;l=this.readCharStrings(s,c);this.nextChar();"noaccess"===(i=this.getToken())&&this.getToken();t[f]=l}break;case"BlueValues":case"OtherBlues":case"FamilyBlues":case"FamilyOtherBlues":var d=this.readNumberArray();d.length>0&&d.length,0;break;case"StemSnapH":case"StemSnapV":u.properties.privateData[i]=this.readNumberArray();break;case"StdHW":case"StdVW":u.properties.privateData[i]=this.readNumberArray()[0];break;case"BlueShift":case"lenIV":case"BlueFuzz":case"BlueScale":case"LanguageGroup":case"ExpansionFactor":u.properties.privateData[i]=this.readNumber();break;case"ForceBold":u.properties.privateData[i]=this.readBoolean()}for(var g=0;g<r.length;g++){h=r[g].glyph;l=r[g].encoded;var m=new o,p=m.convert(l,t,this.seacAnalysisEnabled),v=m.output;p&&(v=[14]);u.charstrings.push({glyphName:h,charstring:v,width:m.width,lsb:m.lsb,seac:m.seac})}return u},extractFontHeader:function(e){for(var t;null!==(t=this.getToken());)if("/"===t)switch(t=this.getToken()){case"FontMatrix":var r=this.readNumberArray();e.fontMatrix=r;break;case"Encoding":var a,n=this.getToken();if(/^\d+$/.test(n)){a=[];var o=0|parseInt(n,10);this.getToken();for(var s=0;s<o;s++){t=this.getToken();for(;"dup"!==t&&"def"!==t;)if(null===(t=this.getToken()))return;if("def"===t)break;var c=this.readInt();this.getToken();var l=this.getToken();a[c]=l;this.getToken()}}else a=(0,i.getEncoding)(n);e.builtInEncoding=a;break;case"FontBBox":var u=this.readNumberArray();e.ascent=Math.max(u[3],u[1]);e.descent=Math.min(u[1],u[3]);e.ascentScaled=!0}}};return c}();t.Type1Parser=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.getTilingPatternIR=t.Pattern=void 0;var a=r(2),i=r(151),n=r(138),o={FUNCTION_BASED:1,AXIAL:2,RADIAL:3,FREE_FORM_MESH:4,LATTICE_FORM_MESH:5,COONS_PATCH_MESH:6,TENSOR_PATCH_MESH:7},s=function(){function e(){(0,a.unreachable)("should not call Pattern constructor")}e.prototype={getPattern:function(e){(0,a.unreachable)("Should not call Pattern.getStyle: "+e)}};e.parseShading=function(e,t,r,i,s,l){var u=(0,n.isStream)(e)?e.dict:e,h=u.get("ShadingType");try{switch(h){case o.AXIAL:case o.RADIAL:return new c.RadialAxial(u,t,r,i,l);case o.FREE_FORM_MESH:case o.LATTICE_FORM_MESH:case o.COONS_PATCH_MESH:case o.TENSOR_PATCH_MESH:return new c.Mesh(e,t,r,i,l);default:throw new a.FormatError("Unsupported ShadingType: "+h)}}catch(e){if(e instanceof a.MissingDataException)throw e;s.send("UnsupportedFeature",{featureId:a.UNSUPPORTED_FEATURES.shadingPattern});(0,a.warn)(e);return new c.Dummy}};return e}(),c={SMALL_NUMBER:1e-6};c.RadialAxial=function(){function e(e,t,r,n,s){this.matrix=t;this.coordsArr=e.getArray("Coords");this.shadingType=e.get("ShadingType");this.type="Pattern";var l=e.get("ColorSpace","CS");l=i.ColorSpace.parse(l,r,n,s);this.cs=l;var u=0,h=1;if(e.has("Domain")){var f=e.getArray("Domain");u=f[0];h=f[1]}var d=!1,g=!1;if(e.has("Extend")){var m=e.getArray("Extend");d=m[0];g=m[1]}if(!(this.shadingType!==o.RADIAL||d&&g)){var p=this.coordsArr[0],v=this.coordsArr[1],b=this.coordsArr[2],y=this.coordsArr[3],w=this.coordsArr[4],k=this.coordsArr[5],S=Math.sqrt((p-y)*(p-y)+(v-w)*(v-w));b<=k+S&&k<=b+S&&(0,a.warn)("Unsupported radial gradient.")}this.extendStart=d;this.extendEnd=g;var C=e.get("Function"),x=s.createFromArray(C),_=h-u,A=_/10,P=this.colorStops=[];if(u>=h||A<=0)(0,a.info)("Bad shading domain.");else{for(var I,O=new Float32Array(l.numComps),T=new Float32Array(1),E=u;E<=h;E+=A){T[0]=E;x(T,0,O,0);I=l.getRgb(O,0);var F=a.Util.makeCssRgb(I[0],I[1],I[2]);P.push([(E-u)/_,F])}var R="transparent";if(e.has("Background")){I=l.getRgb(e.get("Background"),0);R=a.Util.makeCssRgb(I[0],I[1],I[2])}if(!d){P.unshift([0,R]);P[1][0]+=c.SMALL_NUMBER}if(!g){P[P.length-1][0]-=c.SMALL_NUMBER;P.push([1,R])}this.colorStops=P}}e.prototype={getIR:function(){var e,t,r,i,n,s=this.coordsArr,c=this.shadingType;if(c===o.AXIAL){t=[s[0],s[1]];r=[s[2],s[3]];i=null;n=null;e="axial"}else if(c===o.RADIAL){t=[s[0],s[1]];r=[s[3],s[4]];i=s[2];n=s[5];e="radial"}else(0,a.unreachable)("getPattern type unknown: "+c);var l=this.matrix;if(l){t=a.Util.applyTransform(t,l);r=a.Util.applyTransform(r,l);if(c===o.RADIAL){var u=a.Util.singularValueDecompose2dScale(l);i*=u[0];n*=u[1]}}return["RadialAxial",e,this.colorStops,t,r,i,n]}};return e}();c.Mesh=function(){function e(e,t){this.stream=e;this.context=t;this.buffer=0;this.bufferLength=0;var r=t.numComps;this.tmpCompsBuf=new Float32Array(r);var a=t.colorSpace.numComps;this.tmpCsCompsBuf=t.colorFn?new Float32Array(a):this.tmpCompsBuf}e.prototype={get hasData(){if(this.stream.end)return this.stream.pos<this.stream.end;if(this.bufferLength>0)return!0;var e=this.stream.getByte();if(e<0)return!1;this.buffer=e;this.bufferLength=8;return!0},readBits:function(e){var t=this.buffer,r=this.bufferLength;if(32===e){if(0===r)return(this.stream.getByte()<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte())>>>0;t=t<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte();var a=this.stream.getByte();this.buffer=a&(1<<r)-1;return(t<<8-r|(255&a)>>r)>>>0}if(8===e&&0===r)return this.stream.getByte();for(;r<e;){t=t<<8|this.stream.getByte();r+=8}r-=e;this.bufferLength=r;this.buffer=t&(1<<r)-1;return t>>r},align:function(){this.buffer=0;this.bufferLength=0},readFlag:function(){return this.readBits(this.context.bitsPerFlag)},readCoordinate:function(){var e=this.context.bitsPerCoordinate,t=this.readBits(e),r=this.readBits(e),a=this.context.decode,i=e<32?1/((1<<e)-1):2.3283064365386963e-10;return[t*i*(a[1]-a[0])+a[0],r*i*(a[3]-a[2])+a[2]]},readComponents:function(){for(var e=this.context.numComps,t=this.context.bitsPerComponent,r=t<32?1/((1<<t)-1):2.3283064365386963e-10,a=this.context.decode,i=this.tmpCompsBuf,n=0,o=4;n<e;n++,o+=2){var s=this.readBits(t);i[n]=s*r*(a[o+1]-a[o])+a[o]}var c=this.tmpCsCompsBuf;this.context.colorFn&&this.context.colorFn(i,0,c,0);return this.context.colorSpace.getRgb(c,0)}};var t=3,r=20,s=20,c=function(){var e=[];return function(t){e[t]||(e[t]=function(e){for(var t=[],r=0;r<=e;r++){var a=r/e,i=1-a;t.push(new Float32Array([i*i*i,3*a*i*i,3*a*a*i,a*a*a]))}return t}(t));return e[t]}}();function l(e,i){var n=e.figures[i];(0,a.assert)("patch"===n.type,"Unexpected patch mesh figure");var o=e.coords,l=e.colors,u=n.coords,h=n.colors,f=Math.min(o[u[0]][0],o[u[3]][0],o[u[12]][0],o[u[15]][0]),d=Math.min(o[u[0]][1],o[u[3]][1],o[u[12]][1],o[u[15]][1]),g=Math.max(o[u[0]][0],o[u[3]][0],o[u[12]][0],o[u[15]][0]),m=Math.max(o[u[0]][1],o[u[3]][1],o[u[12]][1],o[u[15]][1]),p=Math.ceil((g-f)*s/(e.bounds[2]-e.bounds[0]));p=Math.max(t,Math.min(r,p));var v=Math.ceil((m-d)*s/(e.bounds[3]-e.bounds[1]));v=Math.max(t,Math.min(r,v));for(var b=p+1,y=new Int32Array((v+1)*b),w=new Int32Array((v+1)*b),k=0,S=new Uint8Array(3),C=new Uint8Array(3),x=l[h[0]],_=l[h[1]],A=l[h[2]],P=l[h[3]],I=c(v),O=c(p),T=0;T<=v;T++){S[0]=(x[0]*(v-T)+A[0]*T)/v|0;S[1]=(x[1]*(v-T)+A[1]*T)/v|0;S[2]=(x[2]*(v-T)+A[2]*T)/v|0;C[0]=(_[0]*(v-T)+P[0]*T)/v|0;C[1]=(_[1]*(v-T)+P[1]*T)/v|0;C[2]=(_[2]*(v-T)+P[2]*T)/v|0;for(var E=0;E<=p;E++,k++)if(0!==T&&T!==v||0!==E&&E!==p){for(var F=0,R=0,B=0,D=0;D<=3;D++)for(var M=0;M<=3;M++,B++){var L=I[T][D]*O[E][M];F+=o[u[B]][0]*L;R+=o[u[B]][1]*L}y[k]=o.length;o.push([F,R]);w[k]=l.length;var N=new Uint8Array(3);N[0]=(S[0]*(p-E)+C[0]*E)/p|0;N[1]=(S[1]*(p-E)+C[1]*E)/p|0;N[2]=(S[2]*(p-E)+C[2]*E)/p|0;l.push(N)}}y[0]=u[0];w[0]=h[0];y[p]=u[3];w[p]=h[1];y[b*v]=u[12];w[b*v]=h[2];y[b*v+p]=u[15];w[b*v+p]=h[3];e.figures[i]={type:"lattice",coords:y,colors:w,verticesPerRow:b}}function u(e){for(var t=e.coords[0][0],r=e.coords[0][1],a=t,i=r,n=1,o=e.coords.length;n<o;n++){var s=e.coords[n][0],c=e.coords[n][1];t=t>s?s:t;r=r>c?c:r;a=a<s?s:a;i=i<c?c:i}e.bounds=[t,r,a,i]}function h(t,r,s,c,h){if(!(0,n.isStream)(t))throw new a.FormatError("Mesh data is not a stream");var f=t.dict;this.matrix=r;this.shadingType=f.get("ShadingType");this.type="Pattern";this.bbox=f.getArray("BBox");var d=f.get("ColorSpace","CS");d=i.ColorSpace.parse(d,s,c,h);this.cs=d;this.background=f.has("Background")?d.getRgb(f.get("Background"),0):null;var g=f.get("Function"),m=g?h.createFromArray(g):null;this.coords=[];this.colors=[];this.figures=[];var p=new e(t,{bitsPerCoordinate:f.get("BitsPerCoordinate"),bitsPerComponent:f.get("BitsPerComponent"),bitsPerFlag:f.get("BitsPerFlag"),decode:f.getArray("Decode"),colorFn:m,colorSpace:d,numComps:m?1:d.numComps}),v=!1;switch(this.shadingType){case o.FREE_FORM_MESH:!function(e,t){for(var r=e.coords,i=e.colors,n=[],o=[],s=0;t.hasData;){var c=t.readFlag(),l=t.readCoordinate(),u=t.readComponents();if(0===s){if(!(0<=c&&c<=2))throw new a.FormatError("Unknown type4 flag");switch(c){case 0:s=3;break;case 1:o.push(o[o.length-2],o[o.length-1]);s=1;break;case 2:o.push(o[o.length-3],o[o.length-1]);s=1}n.push(c)}o.push(r.length);r.push(l);i.push(u);s--;t.align()}e.figures.push({type:"triangles",coords:new Int32Array(o),colors:new Int32Array(o)})}(this,p);break;case o.LATTICE_FORM_MESH:var b=0|f.get("VerticesPerRow");if(b<2)throw new a.FormatError("Invalid VerticesPerRow");!function(e,t,r){for(var a=e.coords,i=e.colors,n=[];t.hasData;){var o=t.readCoordinate(),s=t.readComponents();n.push(a.length);a.push(o);i.push(s)}e.figures.push({type:"lattice",coords:new Int32Array(n),colors:new Int32Array(n),verticesPerRow:r})}(this,p,b);break;case o.COONS_PATCH_MESH:!function(e,t){for(var r=e.coords,i=e.colors,n=new Int32Array(16),o=new Int32Array(4);t.hasData;){var s,c,l=t.readFlag();if(!(0<=l&&l<=3))throw new a.FormatError("Unknown type6 flag");var u=r.length;for(s=0,c=0!==l?8:12;s<c;s++)r.push(t.readCoordinate());var h,f,d,g,m=i.length;for(s=0,c=0!==l?2:4;s<c;s++)i.push(t.readComponents());switch(l){case 0:n[12]=u+3;n[13]=u+4;n[14]=u+5;n[15]=u+6;n[8]=u+2;n[11]=u+7;n[4]=u+1;n[7]=u+8;n[0]=u;n[1]=u+11;n[2]=u+10;n[3]=u+9;o[2]=m+1;o[3]=m+2;o[0]=m;o[1]=m+3;break;case 1:h=n[12];f=n[13];d=n[14];g=n[15];n[12]=g;n[13]=u+0;n[14]=u+1;n[15]=u+2;n[8]=d;n[11]=u+3;n[4]=f;n[7]=u+4;n[0]=h;n[1]=u+7;n[2]=u+6;n[3]=u+5;h=o[2];f=o[3];o[2]=f;o[3]=m;o[0]=h;o[1]=m+1;break;case 2:h=n[15];f=n[11];n[12]=n[3];n[13]=u+0;n[14]=u+1;n[15]=u+2;n[8]=n[7];n[11]=u+3;n[4]=f;n[7]=u+4;n[0]=h;n[1]=u+7;n[2]=u+6;n[3]=u+5;h=o[3];o[2]=o[1];o[3]=m;o[0]=h;o[1]=m+1;break;case 3:n[12]=n[0];n[13]=u+0;n[14]=u+1;n[15]=u+2;n[8]=n[1];n[11]=u+3;n[4]=n[2];n[7]=u+4;n[0]=n[3];n[1]=u+7;n[2]=u+6;n[3]=u+5;o[2]=o[0];o[3]=m;o[0]=o[1];o[1]=m+1}n[5]=r.length;r.push([(-4*r[n[0]][0]-r[n[15]][0]+6*(r[n[4]][0]+r[n[1]][0])-2*(r[n[12]][0]+r[n[3]][0])+3*(r[n[13]][0]+r[n[7]][0]))/9,(-4*r[n[0]][1]-r[n[15]][1]+6*(r[n[4]][1]+r[n[1]][1])-2*(r[n[12]][1]+r[n[3]][1])+3*(r[n[13]][1]+r[n[7]][1]))/9]);n[6]=r.length;r.push([(-4*r[n[3]][0]-r[n[12]][0]+6*(r[n[2]][0]+r[n[7]][0])-2*(r[n[0]][0]+r[n[15]][0])+3*(r[n[4]][0]+r[n[14]][0]))/9,(-4*r[n[3]][1]-r[n[12]][1]+6*(r[n[2]][1]+r[n[7]][1])-2*(r[n[0]][1]+r[n[15]][1])+3*(r[n[4]][1]+r[n[14]][1]))/9]);n[9]=r.length;r.push([(-4*r[n[12]][0]-r[n[3]][0]+6*(r[n[8]][0]+r[n[13]][0])-2*(r[n[0]][0]+r[n[15]][0])+3*(r[n[11]][0]+r[n[1]][0]))/9,(-4*r[n[12]][1]-r[n[3]][1]+6*(r[n[8]][1]+r[n[13]][1])-2*(r[n[0]][1]+r[n[15]][1])+3*(r[n[11]][1]+r[n[1]][1]))/9]);n[10]=r.length;r.push([(-4*r[n[15]][0]-r[n[0]][0]+6*(r[n[11]][0]+r[n[14]][0])-2*(r[n[12]][0]+r[n[3]][0])+3*(r[n[2]][0]+r[n[8]][0]))/9,(-4*r[n[15]][1]-r[n[0]][1]+6*(r[n[11]][1]+r[n[14]][1])-2*(r[n[12]][1]+r[n[3]][1])+3*(r[n[2]][1]+r[n[8]][1]))/9]);e.figures.push({type:"patch",coords:new Int32Array(n),colors:new Int32Array(o)})}}(this,p);v=!0;break;case o.TENSOR_PATCH_MESH:!function(e,t){for(var r=e.coords,i=e.colors,n=new Int32Array(16),o=new Int32Array(4);t.hasData;){var s,c,l=t.readFlag();if(!(0<=l&&l<=3))throw new a.FormatError("Unknown type7 flag");var u=r.length;for(s=0,c=0!==l?12:16;s<c;s++)r.push(t.readCoordinate());var h,f,d,g,m=i.length;for(s=0,c=0!==l?2:4;s<c;s++)i.push(t.readComponents());switch(l){case 0:n[12]=u+3;n[13]=u+4;n[14]=u+5;n[15]=u+6;n[8]=u+2;n[9]=u+13;n[10]=u+14;n[11]=u+7;n[4]=u+1;n[5]=u+12;n[6]=u+15;n[7]=u+8;n[0]=u;n[1]=u+11;n[2]=u+10;n[3]=u+9;o[2]=m+1;o[3]=m+2;o[0]=m;o[1]=m+3;break;case 1:h=n[12];f=n[13];d=n[14];g=n[15];n[12]=g;n[13]=u+0;n[14]=u+1;n[15]=u+2;n[8]=d;n[9]=u+9;n[10]=u+10;n[11]=u+3;n[4]=f;n[5]=u+8;n[6]=u+11;n[7]=u+4;n[0]=h;n[1]=u+7;n[2]=u+6;n[3]=u+5;h=o[2];f=o[3];o[2]=f;o[3]=m;o[0]=h;o[1]=m+1;break;case 2:h=n[15];f=n[11];n[12]=n[3];n[13]=u+0;n[14]=u+1;n[15]=u+2;n[8]=n[7];n[9]=u+9;n[10]=u+10;n[11]=u+3;n[4]=f;n[5]=u+8;n[6]=u+11;n[7]=u+4;n[0]=h;n[1]=u+7;n[2]=u+6;n[3]=u+5;h=o[3];o[2]=o[1];o[3]=m;o[0]=h;o[1]=m+1;break;case 3:n[12]=n[0];n[13]=u+0;n[14]=u+1;n[15]=u+2;n[8]=n[1];n[9]=u+9;n[10]=u+10;n[11]=u+3;n[4]=n[2];n[5]=u+8;n[6]=u+11;n[7]=u+4;n[0]=n[3];n[1]=u+7;n[2]=u+6;n[3]=u+5;o[2]=o[0];o[3]=m;o[0]=o[1];o[1]=m+1}e.figures.push({type:"patch",coords:new Int32Array(n),colors:new Int32Array(o)})}}(this,p);v=!0;break;default:(0,a.unreachable)("Unsupported mesh type.")}if(v){u(this);for(var y=0,w=this.figures.length;y<w;y++)l(this,y)}u(this);!function(e){var t,r,a,i,n=e.coords,o=new Float32Array(2*n.length);for(t=0,a=0,r=n.length;t<r;t++){var s=n[t];o[a++]=s[0];o[a++]=s[1]}e.coords=o;var c=e.colors,l=new Uint8Array(3*c.length);for(t=0,a=0,r=c.length;t<r;t++){var u=c[t];l[a++]=u[0];l[a++]=u[1];l[a++]=u[2]}e.colors=l;var h=e.figures;for(t=0,r=h.length;t<r;t++){var f=h[t],d=f.coords,g=f.colors;for(a=0,i=d.length;a<i;a++){d[a]*=2;g[a]*=3}}}(this)}h.prototype={getIR:function(){return["Mesh",this.shadingType,this.coords,this.colors,this.figures,this.bounds,this.matrix,this.bbox,this.background]}};return h}();c.Dummy=function(){function e(){this.type="Pattern"}e.prototype={getIR:function(){return["Dummy"]}};return e}();t.Pattern=s;t.getTilingPatternIR=function(e,t,r){var i=t.getArray("Matrix"),n=a.Util.normalizeRect(t.getArray("BBox")),o=t.get("XStep"),s=t.get("YStep"),c=t.get("PaintType"),l=t.get("TilingType");if(n[2]-n[0]==0||n[3]-n[1]==0)throw new a.FormatError("Invalid getTilingPatternIR /BBox array: ["+n+"].");return["TilingPattern",r,e,i,n,o,s,c,l]}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.bidi=void 0;var a=r(2),i=["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"],n=["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"];function o(e){return 0!=(1&e)}function s(e){return 0==(1&e)}function c(e,t,r){for(var a=t,i=e.length;a<i;++a)if(e[a]!==r)return a;return a}function l(e,t,r,a){for(var i=t;i<r;++i)e[i]=a}function u(e,t,r){for(var a=t,i=r-1;a<i;++a,--i){var n=e[a];e[a]=e[i];e[i]=n}}function h(e,t,r){return{str:e,dir:r?"ttb":t?"ltr":"rtl"}}var f=[],d=[];t.bidi=function(e,t,r){var g=!0,m=e.length;if(0===m||r)return h(e,g,r);f.length=m;d.length=m;var p,v,b=0;for(p=0;p<m;++p){f[p]=e.charAt(p);var y=e.charCodeAt(p),w="L";y<=255?w=i[y]:1424<=y&&y<=1524?w="R":1536<=y&&y<=1791?(w=n[255&y])||(0,a.warn)("Bidi: invalid Unicode character "+y.toString(16)):1792<=y&&y<=2220&&(w="AL");"R"!==w&&"AL"!==w&&"AN"!==w||b++;d[p]=w}if(0===b)return h(e,g=!0);if(-1===t)if(b/m<.3){g=!0;t=0}else{g=!1;t=1}var k=[];for(p=0;p<m;++p)k[p]=t;var S,C=o(t)?"R":"L",x=C,_=x,A=x;for(p=0;p<m;++p)"NSM"===d[p]?d[p]=A:A=d[p];A=x;for(p=0;p<m;++p)"EN"===(S=d[p])?d[p]="AL"===A?"AN":"EN":"R"!==S&&"L"!==S&&"AL"!==S||(A=S);for(p=0;p<m;++p)"AL"===(S=d[p])&&(d[p]="R");for(p=1;p<m-1;++p){"ES"===d[p]&&"EN"===d[p-1]&&"EN"===d[p+1]&&(d[p]="EN");"CS"!==d[p]||"EN"!==d[p-1]&&"AN"!==d[p-1]||d[p+1]!==d[p-1]||(d[p]=d[p-1])}for(p=0;p<m;++p)if("EN"===d[p]){var P;for(P=p-1;P>=0&&"ET"===d[P];--P)d[P]="EN";for(P=p+1;P<m&&"ET"===d[P];++P)d[P]="EN"}for(p=0;p<m;++p)"WS"!==(S=d[p])&&"ES"!==S&&"ET"!==S&&"CS"!==S||(d[p]="ON");A=x;for(p=0;p<m;++p)"EN"===(S=d[p])?d[p]="L"===A?"L":"EN":"R"!==S&&"L"!==S||(A=S);for(p=0;p<m;++p)if("ON"===d[p]){var I=c(d,p+1,"ON"),O=x;p>0&&(O=d[p-1]);var T=_;I+1<m&&(T=d[I+1]);"L"!==O&&(O="R");"L"!==T&&(T="R");O===T&&l(d,p,I,O);p=I-1}for(p=0;p<m;++p)"ON"===d[p]&&(d[p]=C);for(p=0;p<m;++p){S=d[p];s(k[p])?"R"===S?k[p]+=1:"AN"!==S&&"EN"!==S||(k[p]+=2):"L"!==S&&"AN"!==S&&"EN"!==S||(k[p]+=1)}var E,F=-1,R=99;for(p=0,v=k.length;p<v;++p){F<(E=k[p])&&(F=E);R>E&&o(E)&&(R=E)}for(E=F;E>=R;--E){var B=-1;for(p=0,v=k.length;p<v;++p)if(k[p]<E){if(B>=0){u(f,B,p);B=-1}}else B<0&&(B=p);B>=0&&u(f,B,k.length)}for(p=0,v=f.length;p<v;++p){var D=f[p];"<"!==D&&">"!==D||(f[p]="")}return h(f.join(""),g)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.getMetrics=void 0;var a=r(2),i=(0,a.getLookupTableFactory)(function(e){e.Courier=600;e["Courier-Bold"]=600;e["Courier-BoldOblique"]=600;e["Courier-Oblique"]=600;e.Helvetica=(0,a.getLookupTableFactory)(function(e){e.space=278;e.exclam=278;e.quotedbl=355;e.numbersign=556;e.dollar=556;e.percent=889;e.ampersand=667;e.quoteright=222;e.parenleft=333;e.parenright=333;e.asterisk=389;e.plus=584;e.comma=278;e.hyphen=333;e.period=278;e.slash=278;e.zero=556;e.one=556;e.two=556;e.three=556;e.four=556;e.five=556;e.six=556;e.seven=556;e.eight=556;e.nine=556;e.colon=278;e.semicolon=278;e.less=584;e.equal=584;e.greater=584;e.question=556;e.at=1015;e.A=667;e.B=667;e.C=722;e.D=722;e.E=667;e.F=611;e.G=778;e.H=722;e.I=278;e.J=500;e.K=667;e.L=556;e.M=833;e.N=722;e.O=778;e.P=667;e.Q=778;e.R=722;e.S=667;e.T=611;e.U=722;e.V=667;e.W=944;e.X=667;e.Y=667;e.Z=611;e.bracketleft=278;e.backslash=278;e.bracketright=278;e.asciicircum=469;e.underscore=556;e.quoteleft=222;e.a=556;e.b=556;e.c=500;e.d=556;e.e=556;e.f=278;e.g=556;e.h=556;e.i=222;e.j=222;e.k=500;e.l=222;e.m=833;e.n=556;e.o=556;e.p=556;e.q=556;e.r=333;e.s=500;e.t=278;e.u=556;e.v=500;e.w=722;e.x=500;e.y=500;e.z=500;e.braceleft=334;e.bar=260;e.braceright=334;e.asciitilde=584;e.exclamdown=333;e.cent=556;e.sterling=556;e.fraction=167;e.yen=556;e.florin=556;e.section=556;e.currency=556;e.quotesingle=191;e.quotedblleft=333;e.guillemotleft=556;e.guilsinglleft=333;e.guilsinglright=333;e.fi=500;e.fl=500;e.endash=556;e.dagger=556;e.daggerdbl=556;e.periodcentered=278;e.paragraph=537;e.bullet=350;e.quotesinglbase=222;e.quotedblbase=333;e.quotedblright=333;e.guillemotright=556;e.ellipsis=1e3;e.perthousand=1e3;e.questiondown=611;e.grave=333;e.acute=333;e.circumflex=333;e.tilde=333;e.macron=333;e.breve=333;e.dotaccent=333;e.dieresis=333;e.ring=333;e.cedilla=333;e.hungarumlaut=333;e.ogonek=333;e.caron=333;e.emdash=1e3;e.AE=1e3;e.ordfeminine=370;e.Lslash=556;e.Oslash=778;e.OE=1e3;e.ordmasculine=365;e.ae=889;e.dotlessi=278;e.lslash=222;e.oslash=611;e.oe=944;e.germandbls=611;e.Idieresis=278;e.eacute=556;e.abreve=556;e.uhungarumlaut=556;e.ecaron=556;e.Ydieresis=667;e.divide=584;e.Yacute=667;e.Acircumflex=667;e.aacute=556;e.Ucircumflex=722;e.yacute=500;e.scommaaccent=500;e.ecircumflex=556;e.Uring=722;e.Udieresis=722;e.aogonek=556;e.Uacute=722;e.uogonek=556;e.Edieresis=667;e.Dcroat=722;e.commaaccent=250;e.copyright=737;e.Emacron=667;e.ccaron=500;e.aring=556;e.Ncommaaccent=722;e.lacute=222;e.agrave=556;e.Tcommaaccent=611;e.Cacute=722;e.atilde=556;e.Edotaccent=667;e.scaron=500;e.scedilla=500;e.iacute=278;e.lozenge=471;e.Rcaron=722;e.Gcommaaccent=778;e.ucircumflex=556;e.acircumflex=556;e.Amacron=667;e.rcaron=333;e.ccedilla=500;e.Zdotaccent=611;e.Thorn=667;e.Omacron=778;e.Racute=722;e.Sacute=667;e.dcaron=643;e.Umacron=722;e.uring=556;e.threesuperior=333;e.Ograve=778;e.Agrave=667;e.Abreve=667;e.multiply=584;e.uacute=556;e.Tcaron=611;e.partialdiff=476;e.ydieresis=500;e.Nacute=722;e.icircumflex=278;e.Ecircumflex=667;e.adieresis=556;e.edieresis=556;e.cacute=500;e.nacute=556;e.umacron=556;e.Ncaron=722;e.Iacute=278;e.plusminus=584;e.brokenbar=260;e.registered=737;e.Gbreve=778;e.Idotaccent=278;e.summation=600;e.Egrave=667;e.racute=333;e.omacron=556;e.Zacute=611;e.Zcaron=611;e.greaterequal=549;e.Eth=722;e.Ccedilla=722;e.lcommaaccent=222;e.tcaron=317;e.eogonek=556;e.Uogonek=722;e.Aacute=667;e.Adieresis=667;e.egrave=556;e.zacute=500;e.iogonek=222;e.Oacute=778;e.oacute=556;e.amacron=556;e.sacute=500;e.idieresis=278;e.Ocircumflex=778;e.Ugrave=722;e.Delta=612;e.thorn=556;e.twosuperior=333;e.Odieresis=778;e.mu=556;e.igrave=278;e.ohungarumlaut=556;e.Eogonek=667;e.dcroat=556;e.threequarters=834;e.Scedilla=667;e.lcaron=299;e.Kcommaaccent=667;e.Lacute=556;e.trademark=1e3;e.edotaccent=556;e.Igrave=278;e.Imacron=278;e.Lcaron=556;e.onehalf=834;e.lessequal=549;e.ocircumflex=556;e.ntilde=556;e.Uhungarumlaut=722;e.Eacute=667;e.emacron=556;e.gbreve=556;e.onequarter=834;e.Scaron=667;e.Scommaaccent=667;e.Ohungarumlaut=778;e.degree=400;e.ograve=556;e.Ccaron=722;e.ugrave=556;e.radical=453;e.Dcaron=722;e.rcommaaccent=333;e.Ntilde=722;e.otilde=556;e.Rcommaaccent=722;e.Lcommaaccent=556;e.Atilde=667;e.Aogonek=667;e.Aring=667;e.Otilde=778;e.zdotaccent=500;e.Ecaron=667;e.Iogonek=278;e.kcommaaccent=500;e.minus=584;e.Icircumflex=278;e.ncaron=556;e.tcommaaccent=278;e.logicalnot=584;e.odieresis=556;e.udieresis=556;e.notequal=549;e.gcommaaccent=556;e.eth=556;e.zcaron=500;e.ncommaaccent=556;e.onesuperior=333;e.imacron=278;e.Euro=556});e["Helvetica-Bold"]=(0,a.getLookupTableFactory)(function(e){e.space=278;e.exclam=333;e.quotedbl=474;e.numbersign=556;e.dollar=556;e.percent=889;e.ampersand=722;e.quoteright=278;e.parenleft=333;e.parenright=333;e.asterisk=389;e.plus=584;e.comma=278;e.hyphen=333;e.period=278;e.slash=278;e.zero=556;e.one=556;e.two=556;e.three=556;e.four=556;e.five=556;e.six=556;e.seven=556;e.eight=556;e.nine=556;e.colon=333;e.semicolon=333;e.less=584;e.equal=584;e.greater=584;e.question=611;e.at=975;e.A=722;e.B=722;e.C=722;e.D=722;e.E=667;e.F=611;e.G=778;e.H=722;e.I=278;e.J=556;e.K=722;e.L=611;e.M=833;e.N=722;e.O=778;e.P=667;e.Q=778;e.R=722;e.S=667;e.T=611;e.U=722;e.V=667;e.W=944;e.X=667;e.Y=667;e.Z=611;e.bracketleft=333;e.backslash=278;e.bracketright=333;e.asciicircum=584;e.underscore=556;e.quoteleft=278;e.a=556;e.b=611;e.c=556;e.d=611;e.e=556;e.f=333;e.g=611;e.h=611;e.i=278;e.j=278;e.k=556;e.l=278;e.m=889;e.n=611;e.o=611;e.p=611;e.q=611;e.r=389;e.s=556;e.t=333;e.u=611;e.v=556;e.w=778;e.x=556;e.y=556;e.z=500;e.braceleft=389;e.bar=280;e.braceright=389;e.asciitilde=584;e.exclamdown=333;e.cent=556;e.sterling=556;e.fraction=167;e.yen=556;e.florin=556;e.section=556;e.currency=556;e.quotesingle=238;e.quotedblleft=500;e.guillemotleft=556;e.guilsinglleft=333;e.guilsinglright=333;e.fi=611;e.fl=611;e.endash=556;e.dagger=556;e.daggerdbl=556;e.periodcentered=278;e.paragraph=556;e.bullet=350;e.quotesinglbase=278;e.quotedblbase=500;e.quotedblright=500;e.guillemotright=556;e.ellipsis=1e3;e.perthousand=1e3;e.questiondown=611;e.grave=333;e.acute=333;e.circumflex=333;e.tilde=333;e.macron=333;e.breve=333;e.dotaccent=333;e.dieresis=333;e.ring=333;e.cedilla=333;e.hungarumlaut=333;e.ogonek=333;e.caron=333;e.emdash=1e3;e.AE=1e3;e.ordfeminine=370;e.Lslash=611;e.Oslash=778;e.OE=1e3;e.ordmasculine=365;e.ae=889;e.dotlessi=278;e.lslash=278;e.oslash=611;e.oe=944;e.germandbls=611;e.Idieresis=278;e.eacute=556;e.abreve=556;e.uhungarumlaut=611;e.ecaron=556;e.Ydieresis=667;e.divide=584;e.Yacute=667;e.Acircumflex=722;e.aacute=556;e.Ucircumflex=722;e.yacute=556;e.scommaaccent=556;e.ecircumflex=556;e.Uring=722;e.Udieresis=722;e.aogonek=556;e.Uacute=722;e.uogonek=611;e.Edieresis=667;e.Dcroat=722;e.commaaccent=250;e.copyright=737;e.Emacron=667;e.ccaron=556;e.aring=556;e.Ncommaaccent=722;e.lacute=278;e.agrave=556;e.Tcommaaccent=611;e.Cacute=722;e.atilde=556;e.Edotaccent=667;e.scaron=556;e.scedilla=556;e.iacute=278;e.lozenge=494;e.Rcaron=722;e.Gcommaaccent=778;e.ucircumflex=611;e.acircumflex=556;e.Amacron=722;e.rcaron=389;e.ccedilla=556;e.Zdotaccent=611;e.Thorn=667;e.Omacron=778;e.Racute=722;e.Sacute=667;e.dcaron=743;e.Umacron=722;e.uring=611;e.threesuperior=333;e.Ograve=778;e.Agrave=722;e.Abreve=722;e.multiply=584;e.uacute=611;e.Tcaron=611;e.partialdiff=494;e.ydieresis=556;e.Nacute=722;e.icircumflex=278;e.Ecircumflex=667;e.adieresis=556;e.edieresis=556;e.cacute=556;e.nacute=611;e.umacron=611;e.Ncaron=722;e.Iacute=278;e.plusminus=584;e.brokenbar=280;e.registered=737;e.Gbreve=778;e.Idotaccent=278;e.summation=600;e.Egrave=667;e.racute=389;e.omacron=611;e.Zacute=611;e.Zcaron=611;e.greaterequal=549;e.Eth=722;e.Ccedilla=722;e.lcommaaccent=278;e.tcaron=389;e.eogonek=556;e.Uogonek=722;e.Aacute=722;e.Adieresis=722;e.egrave=556;e.zacute=500;e.iogonek=278;e.Oacute=778;e.oacute=611;e.amacron=556;e.sacute=556;e.idieresis=278;e.Ocircumflex=778;e.Ugrave=722;e.Delta=612;e.thorn=611;e.twosuperior=333;e.Odieresis=778;e.mu=611;e.igrave=278;e.ohungarumlaut=611;e.Eogonek=667;e.dcroat=611;e.threequarters=834;e.Scedilla=667;e.lcaron=400;e.Kcommaaccent=722;e.Lacute=611;e.trademark=1e3;e.edotaccent=556;e.Igrave=278;e.Imacron=278;e.Lcaron=611;e.onehalf=834;e.lessequal=549;e.ocircumflex=611;e.ntilde=611;e.Uhungarumlaut=722;e.Eacute=667;e.emacron=556;e.gbreve=611;e.onequarter=834;e.Scaron=667;e.Scommaaccent=667;e.Ohungarumlaut=778;e.degree=400;e.ograve=611;e.Ccaron=722;e.ugrave=611;e.radical=549;e.Dcaron=722;e.rcommaaccent=389;e.Ntilde=722;e.otilde=611;e.Rcommaaccent=722;e.Lcommaaccent=611;e.Atilde=722;e.Aogonek=722;e.Aring=722;e.Otilde=778;e.zdotaccent=500;e.Ecaron=667;e.Iogonek=278;e.kcommaaccent=556;e.minus=584;e.Icircumflex=278;e.ncaron=611;e.tcommaaccent=333;e.logicalnot=584;e.odieresis=611;e.udieresis=611;e.notequal=549;e.gcommaaccent=611;e.eth=611;e.zcaron=500;e.ncommaaccent=611;e.onesuperior=333;e.imacron=278;e.Euro=556});e["Helvetica-BoldOblique"]=(0,a.getLookupTableFactory)(function(e){e.space=278;e.exclam=333;e.quotedbl=474;e.numbersign=556;e.dollar=556;e.percent=889;e.ampersand=722;e.quoteright=278;e.parenleft=333;e.parenright=333;e.asterisk=389;e.plus=584;e.comma=278;e.hyphen=333;e.period=278;e.slash=278;e.zero=556;e.one=556;e.two=556;e.three=556;e.four=556;e.five=556;e.six=556;e.seven=556;e.eight=556;e.nine=556;e.colon=333;e.semicolon=333;e.less=584;e.equal=584;e.greater=584;e.question=611;e.at=975;e.A=722;e.B=722;e.C=722;e.D=722;e.E=667;e.F=611;e.G=778;e.H=722;e.I=278;e.J=556;e.K=722;e.L=611;e.M=833;e.N=722;e.O=778;e.P=667;e.Q=778;e.R=722;e.S=667;e.T=611;e.U=722;e.V=667;e.W=944;e.X=667;e.Y=667;e.Z=611;e.bracketleft=333;e.backslash=278;e.bracketright=333;e.asciicircum=584;e.underscore=556;e.quoteleft=278;e.a=556;e.b=611;e.c=556;e.d=611;e.e=556;e.f=333;e.g=611;e.h=611;e.i=278;e.j=278;e.k=556;e.l=278;e.m=889;e.n=611;e.o=611;e.p=611;e.q=611;e.r=389;e.s=556;e.t=333;e.u=611;e.v=556;e.w=778;e.x=556;e.y=556;e.z=500;e.braceleft=389;e.bar=280;e.braceright=389;e.asciitilde=584;e.exclamdown=333;e.cent=556;e.sterling=556;e.fraction=167;e.yen=556;e.florin=556;e.section=556;e.currency=556;e.quotesingle=238;e.quotedblleft=500;e.guillemotleft=556;e.guilsinglleft=333;e.guilsinglright=333;e.fi=611;e.fl=611;e.endash=556;e.dagger=556;e.daggerdbl=556;e.periodcentered=278;e.paragraph=556;e.bullet=350;e.quotesinglbase=278;e.quotedblbase=500;e.quotedblright=500;e.guillemotright=556;e.ellipsis=1e3;e.perthousand=1e3;e.questiondown=611;e.grave=333;e.acute=333;e.circumflex=333;e.tilde=333;e.macron=333;e.breve=333;e.dotaccent=333;e.dieresis=333;e.ring=333;e.cedilla=333;e.hungarumlaut=333;e.ogonek=333;e.caron=333;e.emdash=1e3;e.AE=1e3;e.ordfeminine=370;e.Lslash=611;e.Oslash=778;e.OE=1e3;e.ordmasculine=365;e.ae=889;e.dotlessi=278;e.lslash=278;e.oslash=611;e.oe=944;e.germandbls=611;e.Idieresis=278;e.eacute=556;e.abreve=556;e.uhungarumlaut=611;e.ecaron=556;e.Ydieresis=667;e.divide=584;e.Yacute=667;e.Acircumflex=722;e.aacute=556;e.Ucircumflex=722;e.yacute=556;e.scommaaccent=556;e.ecircumflex=556;e.Uring=722;e.Udieresis=722;e.aogonek=556;e.Uacute=722;e.uogonek=611;e.Edieresis=667;e.Dcroat=722;e.commaaccent=250;e.copyright=737;e.Emacron=667;e.ccaron=556;e.aring=556;e.Ncommaaccent=722;e.lacute=278;e.agrave=556;e.Tcommaaccent=611;e.Cacute=722;e.atilde=556;e.Edotaccent=667;e.scaron=556;e.scedilla=556;e.iacute=278;e.lozenge=494;e.Rcaron=722;e.Gcommaaccent=778;e.ucircumflex=611;e.acircumflex=556;e.Amacron=722;e.rcaron=389;e.ccedilla=556;e.Zdotaccent=611;e.Thorn=667;e.Omacron=778;e.Racute=722;e.Sacute=667;e.dcaron=743;e.Umacron=722;e.uring=611;e.threesuperior=333;e.Ograve=778;e.Agrave=722;e.Abreve=722;e.multiply=584;e.uacute=611;e.Tcaron=611;e.partialdiff=494;e.ydieresis=556;e.Nacute=722;e.icircumflex=278;e.Ecircumflex=667;e.adieresis=556;e.edieresis=556;e.cacute=556;e.nacute=611;e.umacron=611;e.Ncaron=722;e.Iacute=278;e.plusminus=584;e.brokenbar=280;e.registered=737;e.Gbreve=778;e.Idotaccent=278;e.summation=600;e.Egrave=667;e.racute=389;e.omacron=611;e.Zacute=611;e.Zcaron=611;e.greaterequal=549;e.Eth=722;e.Ccedilla=722;e.lcommaaccent=278;e.tcaron=389;e.eogonek=556;e.Uogonek=722;e.Aacute=722;e.Adieresis=722;e.egrave=556;e.zacute=500;e.iogonek=278;e.Oacute=778;e.oacute=611;e.amacron=556;e.sacute=556;e.idieresis=278;e.Ocircumflex=778;e.Ugrave=722;e.Delta=612;e.thorn=611;e.twosuperior=333;e.Odieresis=778;e.mu=611;e.igrave=278;e.ohungarumlaut=611;e.Eogonek=667;e.dcroat=611;e.threequarters=834;e.Scedilla=667;e.lcaron=400;e.Kcommaaccent=722;e.Lacute=611;e.trademark=1e3;e.edotaccent=556;e.Igrave=278;e.Imacron=278;e.Lcaron=611;e.onehalf=834;e.lessequal=549;e.ocircumflex=611;e.ntilde=611;e.Uhungarumlaut=722;e.Eacute=667;e.emacron=556;e.gbreve=611;e.onequarter=834;e.Scaron=667;e.Scommaaccent=667;e.Ohungarumlaut=778;e.degree=400;e.ograve=611;e.Ccaron=722;e.ugrave=611;e.radical=549;e.Dcaron=722;e.rcommaaccent=389;e.Ntilde=722;e.otilde=611;e.Rcommaaccent=722;e.Lcommaaccent=611;e.Atilde=722;e.Aogonek=722;e.Aring=722;e.Otilde=778;e.zdotaccent=500;e.Ecaron=667;e.Iogonek=278;e.kcommaaccent=556;e.minus=584;e.Icircumflex=278;e.ncaron=611;e.tcommaaccent=333;e.logicalnot=584;e.odieresis=611;e.udieresis=611;e.notequal=549;e.gcommaaccent=611;e.eth=611;e.zcaron=500;e.ncommaaccent=611;e.onesuperior=333;e.imacron=278;e.Euro=556});e["Helvetica-Oblique"]=(0,a.getLookupTableFactory)(function(e){e.space=278;e.exclam=278;e.quotedbl=355;e.numbersign=556;e.dollar=556;e.percent=889;e.ampersand=667;e.quoteright=222;e.parenleft=333;e.parenright=333;e.asterisk=389;e.plus=584;e.comma=278;e.hyphen=333;e.period=278;e.slash=278;e.zero=556;e.one=556;e.two=556;e.three=556;e.four=556;e.five=556;e.six=556;e.seven=556;e.eight=556;e.nine=556;e.colon=278;e.semicolon=278;e.less=584;e.equal=584;e.greater=584;e.question=556;e.at=1015;e.A=667;e.B=667;e.C=722;e.D=722;e.E=667;e.F=611;e.G=778;e.H=722;e.I=278;e.J=500;e.K=667;e.L=556;e.M=833;e.N=722;e.O=778;e.P=667;e.Q=778;e.R=722;e.S=667;e.T=611;e.U=722;e.V=667;e.W=944;e.X=667;e.Y=667;e.Z=611;e.bracketleft=278;e.backslash=278;e.bracketright=278;e.asciicircum=469;e.underscore=556;e.quoteleft=222;e.a=556;e.b=556;e.c=500;e.d=556;e.e=556;e.f=278;e.g=556;e.h=556;e.i=222;e.j=222;e.k=500;e.l=222;e.m=833;e.n=556;e.o=556;e.p=556;e.q=556;e.r=333;e.s=500;e.t=278;e.u=556;e.v=500;e.w=722;e.x=500;e.y=500;e.z=500;e.braceleft=334;e.bar=260;e.braceright=334;e.asciitilde=584;e.exclamdown=333;e.cent=556;e.sterling=556;e.fraction=167;e.yen=556;e.florin=556;e.section=556;e.currency=556;e.quotesingle=191;e.quotedblleft=333;e.guillemotleft=556;e.guilsinglleft=333;e.guilsinglright=333;e.fi=500;e.fl=500;e.endash=556;e.dagger=556;e.daggerdbl=556;e.periodcentered=278;e.paragraph=537;e.bullet=350;e.quotesinglbase=222;e.quotedblbase=333;e.quotedblright=333;e.guillemotright=556;e.ellipsis=1e3;e.perthousand=1e3;e.questiondown=611;e.grave=333;e.acute=333;e.circumflex=333;e.tilde=333;e.macron=333;e.breve=333;e.dotaccent=333;e.dieresis=333;e.ring=333;e.cedilla=333;e.hungarumlaut=333;e.ogonek=333;e.caron=333;e.emdash=1e3;e.AE=1e3;e.ordfeminine=370;e.Lslash=556;e.Oslash=778;e.OE=1e3;e.ordmasculine=365;e.ae=889;e.dotlessi=278;e.lslash=222;e.oslash=611;e.oe=944;e.germandbls=611;e.Idieresis=278;e.eacute=556;e.abreve=556;e.uhungarumlaut=556;e.ecaron=556;e.Ydieresis=667;e.divide=584;e.Yacute=667;e.Acircumflex=667;e.aacute=556;e.Ucircumflex=722;e.yacute=500;e.scommaaccent=500;e.ecircumflex=556;e.Uring=722;e.Udieresis=722;e.aogonek=556;e.Uacute=722;e.uogonek=556;e.Edieresis=667;e.Dcroat=722;e.commaaccent=250;e.copyright=737;e.Emacron=667;e.ccaron=500;e.aring=556;e.Ncommaaccent=722;e.lacute=222;e.agrave=556;e.Tcommaaccent=611;e.Cacute=722;e.atilde=556;e.Edotaccent=667;e.scaron=500;e.scedilla=500;e.iacute=278;e.lozenge=471;e.Rcaron=722;e.Gcommaaccent=778;e.ucircumflex=556;e.acircumflex=556;e.Amacron=667;e.rcaron=333;e.ccedilla=500;e.Zdotaccent=611;e.Thorn=667;e.Omacron=778;e.Racute=722;e.Sacute=667;e.dcaron=643;e.Umacron=722;e.uring=556;e.threesuperior=333;e.Ograve=778;e.Agrave=667;e.Abreve=667;e.multiply=584;e.uacute=556;e.Tcaron=611;e.partialdiff=476;e.ydieresis=500;e.Nacute=722;e.icircumflex=278;e.Ecircumflex=667;e.adieresis=556;e.edieresis=556;e.cacute=500;e.nacute=556;e.umacron=556;e.Ncaron=722;e.Iacute=278;e.plusminus=584;e.brokenbar=260;e.registered=737;e.Gbreve=778;e.Idotaccent=278;e.summation=600;e.Egrave=667;e.racute=333;e.omacron=556;e.Zacute=611;e.Zcaron=611;e.greaterequal=549;e.Eth=722;e.Ccedilla=722;e.lcommaaccent=222;e.tcaron=317;e.eogonek=556;e.Uogonek=722;e.Aacute=667;e.Adieresis=667;e.egrave=556;e.zacute=500;e.iogonek=222;e.Oacute=778;e.oacute=556;e.amacron=556;e.sacute=500;e.idieresis=278;e.Ocircumflex=778;e.Ugrave=722;e.Delta=612;e.thorn=556;e.twosuperior=333;e.Odieresis=778;e.mu=556;e.igrave=278;e.ohungarumlaut=556;e.Eogonek=667;e.dcroat=556;e.threequarters=834;e.Scedilla=667;e.lcaron=299;e.Kcommaaccent=667;e.Lacute=556;e.trademark=1e3;e.edotaccent=556;e.Igrave=278;e.Imacron=278;e.Lcaron=556;e.onehalf=834;e.lessequal=549;e.ocircumflex=556;e.ntilde=556;e.Uhungarumlaut=722;e.Eacute=667;e.emacron=556;e.gbreve=556;e.onequarter=834;e.Scaron=667;e.Scommaaccent=667;e.Ohungarumlaut=778;e.degree=400;e.ograve=556;e.Ccaron=722;e.ugrave=556;e.radical=453;e.Dcaron=722;e.rcommaaccent=333;e.Ntilde=722;e.otilde=556;e.Rcommaaccent=722;e.Lcommaaccent=556;e.Atilde=667;e.Aogonek=667;e.Aring=667;e.Otilde=778;e.zdotaccent=500;e.Ecaron=667;e.Iogonek=278;e.kcommaaccent=500;e.minus=584;e.Icircumflex=278;e.ncaron=556;e.tcommaaccent=278;e.logicalnot=584;e.odieresis=556;e.udieresis=556;e.notequal=549;e.gcommaaccent=556;e.eth=556;e.zcaron=500;e.ncommaaccent=556;e.onesuperior=333;e.imacron=278;e.Euro=556});e.Symbol=(0,a.getLookupTableFactory)(function(e){e.space=250;e.exclam=333;e.universal=713;e.numbersign=500;e.existential=549;e.percent=833;e.ampersand=778;e.suchthat=439;e.parenleft=333;e.parenright=333;e.asteriskmath=500;e.plus=549;e.comma=250;e.minus=549;e.period=250;e.slash=278;e.zero=500;e.one=500;e.two=500;e.three=500;e.four=500;e.five=500;e.six=500;e.seven=500;e.eight=500;e.nine=500;e.colon=278;e.semicolon=278;e.less=549;e.equal=549;e.greater=549;e.question=444;e.congruent=549;e.Alpha=722;e.Beta=667;e.Chi=722;e.Delta=612;e.Epsilon=611;e.Phi=763;e.Gamma=603;e.Eta=722;e.Iota=333;e.theta1=631;e.Kappa=722;e.Lambda=686;e.Mu=889;e.Nu=722;e.Omicron=722;e.Pi=768;e.Theta=741;e.Rho=556;e.Sigma=592;e.Tau=611;e.Upsilon=690;e.sigma1=439;e.Omega=768;e.Xi=645;e.Psi=795;e.Zeta=611;e.bracketleft=333;e.therefore=863;e.bracketright=333;e.perpendicular=658;e.underscore=500;e.radicalex=500;e.alpha=631;e.beta=549;e.chi=549;e.delta=494;e.epsilon=439;e.phi=521;e.gamma=411;e.eta=603;e.iota=329;e.phi1=603;e.kappa=549;e.lambda=549;e.mu=576;e.nu=521;e.omicron=549;e.pi=549;e.theta=521;e.rho=549;e.sigma=603;e.tau=439;e.upsilon=576;e.omega1=713;e.omega=686;e.xi=493;e.psi=686;e.zeta=494;e.braceleft=480;e.bar=200;e.braceright=480;e.similar=549;e.Euro=750;e.Upsilon1=620;e.minute=247;e.lessequal=549;e.fraction=167;e.infinity=713;e.florin=500;e.club=753;e.diamond=753;e.heart=753;e.spade=753;e.arrowboth=1042;e.arrowleft=987;e.arrowup=603;e.arrowright=987;e.arrowdown=603;e.degree=400;e.plusminus=549;e.second=411;e.greaterequal=549;e.multiply=549;e.proportional=713;e.partialdiff=494;e.bullet=460;e.divide=549;e.notequal=549;e.equivalence=549;e.approxequal=549;e.ellipsis=1e3;e.arrowvertex=603;e.arrowhorizex=1e3;e.carriagereturn=658;e.aleph=823;e.Ifraktur=686;e.Rfraktur=795;e.weierstrass=987;e.circlemultiply=768;e.circleplus=768;e.emptyset=823;e.intersection=768;e.union=768;e.propersuperset=713;e.reflexsuperset=713;e.notsubset=713;e.propersubset=713;e.reflexsubset=713;e.element=713;e.notelement=713;e.angle=768;e.gradient=713;e.registerserif=790;e.copyrightserif=790;e.trademarkserif=890;e.product=823;e.radical=549;e.dotmath=250;e.logicalnot=713;e.logicaland=603;e.logicalor=603;e.arrowdblboth=1042;e.arrowdblleft=987;e.arrowdblup=603;e.arrowdblright=987;e.arrowdbldown=603;e.lozenge=494;e.angleleft=329;e.registersans=790;e.copyrightsans=790;e.trademarksans=786;e.summation=713;e.parenlefttp=384;e.parenleftex=384;e.parenleftbt=384;e.bracketlefttp=384;e.bracketleftex=384;e.bracketleftbt=384;e.bracelefttp=494;e.braceleftmid=494;e.braceleftbt=494;e.braceex=494;e.angleright=329;e.integral=274;e.integraltp=686;e.integralex=686;e.integralbt=686;e.parenrighttp=384;e.parenrightex=384;e.parenrightbt=384;e.bracketrighttp=384;e.bracketrightex=384;e.bracketrightbt=384;e.bracerighttp=494;e.bracerightmid=494;e.bracerightbt=494;e.apple=790});e["Times-Roman"]=(0,a.getLookupTableFactory)(function(e){e.space=250;e.exclam=333;e.quotedbl=408;e.numbersign=500;e.dollar=500;e.percent=833;e.ampersand=778;e.quoteright=333;e.parenleft=333;e.parenright=333;e.asterisk=500;e.plus=564;e.comma=250;e.hyphen=333;e.period=250;e.slash=278;e.zero=500;e.one=500;e.two=500;e.three=500;e.four=500;e.five=500;e.six=500;e.seven=500;e.eight=500;e.nine=500;e.colon=278;e.semicolon=278;e.less=564;e.equal=564;e.greater=564;e.question=444;e.at=921;e.A=722;e.B=667;e.C=667;e.D=722;e.E=611;e.F=556;e.G=722;e.H=722;e.I=333;e.J=389;e.K=722;e.L=611;e.M=889;e.N=722;e.O=722;e.P=556;e.Q=722;e.R=667;e.S=556;e.T=611;e.U=722;e.V=722;e.W=944;e.X=722;e.Y=722;e.Z=611;e.bracketleft=333;e.backslash=278;e.bracketright=333;e.asciicircum=469;e.underscore=500;e.quoteleft=333;e.a=444;e.b=500;e.c=444;e.d=500;e.e=444;e.f=333;e.g=500;e.h=500;e.i=278;e.j=278;e.k=500;e.l=278;e.m=778;e.n=500;e.o=500;e.p=500;e.q=500;e.r=333;e.s=389;e.t=278;e.u=500;e.v=500;e.w=722;e.x=500;e.y=500;e.z=444;e.braceleft=480;e.bar=200;e.braceright=480;e.asciitilde=541;e.exclamdown=333;e.cent=500;e.sterling=500;e.fraction=167;e.yen=500;e.florin=500;e.section=500;e.currency=500;e.quotesingle=180;e.quotedblleft=444;e.guillemotleft=500;e.guilsinglleft=333;e.guilsinglright=333;e.fi=556;e.fl=556;e.endash=500;e.dagger=500;e.daggerdbl=500;e.periodcentered=250;e.paragraph=453;e.bullet=350;e.quotesinglbase=333;e.quotedblbase=444;e.quotedblright=444;e.guillemotright=500;e.ellipsis=1e3;e.perthousand=1e3;e.questiondown=444;e.grave=333;e.acute=333;e.circumflex=333;e.tilde=333;e.macron=333;e.breve=333;e.dotaccent=333;e.dieresis=333;e.ring=333;e.cedilla=333;e.hungarumlaut=333;e.ogonek=333;e.caron=333;e.emdash=1e3;e.AE=889;e.ordfeminine=276;e.Lslash=611;e.Oslash=722;e.OE=889;e.ordmasculine=310;e.ae=667;e.dotlessi=278;e.lslash=278;e.oslash=500;e.oe=722;e.germandbls=500;e.Idieresis=333;e.eacute=444;e.abreve=444;e.uhungarumlaut=500;e.ecaron=444;e.Ydieresis=722;e.divide=564;e.Yacute=722;e.Acircumflex=722;e.aacute=444;e.Ucircumflex=722;e.yacute=500;e.scommaaccent=389;e.ecircumflex=444;e.Uring=722;e.Udieresis=722;e.aogonek=444;e.Uacute=722;e.uogonek=500;e.Edieresis=611;e.Dcroat=722;e.commaaccent=250;e.copyright=760;e.Emacron=611;e.ccaron=444;e.aring=444;e.Ncommaaccent=722;e.lacute=278;e.agrave=444;e.Tcommaaccent=611;e.Cacute=667;e.atilde=444;e.Edotaccent=611;e.scaron=389;e.scedilla=389;e.iacute=278;e.lozenge=471;e.Rcaron=667;e.Gcommaaccent=722;e.ucircumflex=500;e.acircumflex=444;e.Amacron=722;e.rcaron=333;e.ccedilla=444;e.Zdotaccent=611;e.Thorn=556;e.Omacron=722;e.Racute=667;e.Sacute=556;e.dcaron=588;e.Umacron=722;e.uring=500;e.threesuperior=300;e.Ograve=722;e.Agrave=722;e.Abreve=722;e.multiply=564;e.uacute=500;e.Tcaron=611;e.partialdiff=476;e.ydieresis=500;e.Nacute=722;e.icircumflex=278;e.Ecircumflex=611;e.adieresis=444;e.edieresis=444;e.cacute=444;e.nacute=500;e.umacron=500;e.Ncaron=722;e.Iacute=333;e.plusminus=564;e.brokenbar=200;e.registered=760;e.Gbreve=722;e.Idotaccent=333;e.summation=600;e.Egrave=611;e.racute=333;e.omacron=500;e.Zacute=611;e.Zcaron=611;e.greaterequal=549;e.Eth=722;e.Ccedilla=667;e.lcommaaccent=278;e.tcaron=326;e.eogonek=444;e.Uogonek=722;e.Aacute=722;e.Adieresis=722;e.egrave=444;e.zacute=444;e.iogonek=278;e.Oacute=722;e.oacute=500;e.amacron=444;e.sacute=389;e.idieresis=278;e.Ocircumflex=722;e.Ugrave=722;e.Delta=612;e.thorn=500;e.twosuperior=300;e.Odieresis=722;e.mu=500;e.igrave=278;e.ohungarumlaut=500;e.Eogonek=611;e.dcroat=500;e.threequarters=750;e.Scedilla=556;e.lcaron=344;e.Kcommaaccent=722;e.Lacute=611;e.trademark=980;e.edotaccent=444;e.Igrave=333;e.Imacron=333;e.Lcaron=611;e.onehalf=750;e.lessequal=549;e.ocircumflex=500;e.ntilde=500;e.Uhungarumlaut=722;e.Eacute=611;e.emacron=444;e.gbreve=500;e.onequarter=750;e.Scaron=556;e.Scommaaccent=556;e.Ohungarumlaut=722;e.degree=400;e.ograve=500;e.Ccaron=667;e.ugrave=500;e.radical=453;e.Dcaron=722;e.rcommaaccent=333;e.Ntilde=722;e.otilde=500;e.Rcommaaccent=667;e.Lcommaaccent=611;e.Atilde=722;e.Aogonek=722;e.Aring=722;e.Otilde=722;e.zdotaccent=444;e.Ecaron=611;e.Iogonek=333;e.kcommaaccent=500;e.minus=564;e.Icircumflex=333;e.ncaron=500;e.tcommaaccent=278;e.logicalnot=564;e.odieresis=500;e.udieresis=500;e.notequal=549;e.gcommaaccent=500;e.eth=500;e.zcaron=444;e.ncommaaccent=500;e.onesuperior=300;e.imacron=278;e.Euro=500});e["Times-Bold"]=(0,a.getLookupTableFactory)(function(e){e.space=250;e.exclam=333;e.quotedbl=555;e.numbersign=500;e.dollar=500;e.percent=1e3;e.ampersand=833;e.quoteright=333;e.parenleft=333;e.parenright=333;e.asterisk=500;e.plus=570;e.comma=250;e.hyphen=333;e.period=250;e.slash=278;e.zero=500;e.one=500;e.two=500;e.three=500;e.four=500;e.five=500;e.six=500;e.seven=500;e.eight=500;e.nine=500;e.colon=333;e.semicolon=333;e.less=570;e.equal=570;e.greater=570;e.question=500;e.at=930;e.A=722;e.B=667;e.C=722;e.D=722;e.E=667;e.F=611;e.G=778;e.H=778;e.I=389;e.J=500;e.K=778;e.L=667;e.M=944;e.N=722;e.O=778;e.P=611;e.Q=778;e.R=722;e.S=556;e.T=667;e.U=722;e.V=722;e.W=1e3;e.X=722;e.Y=722;e.Z=667;e.bracketleft=333;e.backslash=278;e.bracketright=333;e.asciicircum=581;e.underscore=500;e.quoteleft=333;e.a=500;e.b=556;e.c=444;e.d=556;e.e=444;e.f=333;e.g=500;e.h=556;e.i=278;e.j=333;e.k=556;e.l=278;e.m=833;e.n=556;e.o=500;e.p=556;e.q=556;e.r=444;e.s=389;e.t=333;e.u=556;e.v=500;e.w=722;e.x=500;e.y=500;e.z=444;e.braceleft=394;e.bar=220;e.braceright=394;e.asciitilde=520;e.exclamdown=333;e.cent=500;e.sterling=500;e.fraction=167;e.yen=500;e.florin=500;e.section=500;e.currency=500;e.quotesingle=278;e.quotedblleft=500;e.guillemotleft=500;e.guilsinglleft=333;e.guilsinglright=333;e.fi=556;e.fl=556;e.endash=500;e.dagger=500;e.daggerdbl=500;e.periodcentered=250;e.paragraph=540;e.bullet=350;e.quotesinglbase=333;e.quotedblbase=500;e.quotedblright=500;e.guillemotright=500;e.ellipsis=1e3;e.perthousand=1e3;e.questiondown=500;e.grave=333;e.acute=333;e.circumflex=333;e.tilde=333;e.macron=333;e.breve=333;e.dotaccent=333;e.dieresis=333;e.ring=333;e.cedilla=333;e.hungarumlaut=333;e.ogonek=333;e.caron=333;e.emdash=1e3;e.AE=1e3;e.ordfeminine=300;e.Lslash=667;e.Oslash=778;e.OE=1e3;e.ordmasculine=330;e.ae=722;e.dotlessi=278;e.lslash=278;e.oslash=500;e.oe=722;e.germandbls=556;e.Idieresis=389;e.eacute=444;e.abreve=500;e.uhungarumlaut=556;e.ecaron=444;e.Ydieresis=722;e.divide=570;e.Yacute=722;e.Acircumflex=722;e.aacute=500;e.Ucircumflex=722;e.yacute=500;e.scommaaccent=389;e.ecircumflex=444;e.Uring=722;e.Udieresis=722;e.aogonek=500;e.Uacute=722;e.uogonek=556;e.Edieresis=667;e.Dcroat=722;e.commaaccent=250;e.copyright=747;e.Emacron=667;e.ccaron=444;e.aring=500;e.Ncommaaccent=722;e.lacute=278;e.agrave=500;e.Tcommaaccent=667;e.Cacute=722;e.atilde=500;e.Edotaccent=667;e.scaron=389;e.scedilla=389;e.iacute=278;e.lozenge=494;e.Rcaron=722;e.Gcommaaccent=778;e.ucircumflex=556;e.acircumflex=500;e.Amacron=722;e.rcaron=444;e.ccedilla=444;e.Zdotaccent=667;e.Thorn=611;e.Omacron=778;e.Racute=722;e.Sacute=556;e.dcaron=672;e.Umacron=722;e.uring=556;e.threesuperior=300;e.Ograve=778;e.Agrave=722;e.Abreve=722;e.multiply=570;e.uacute=556;e.Tcaron=667;e.partialdiff=494;e.ydieresis=500;e.Nacute=722;e.icircumflex=278;e.Ecircumflex=667;e.adieresis=500;e.edieresis=444;e.cacute=444;e.nacute=556;e.umacron=556;e.Ncaron=722;e.Iacute=389;e.plusminus=570;e.brokenbar=220;e.registered=747;e.Gbreve=778;e.Idotaccent=389;e.summation=600;e.Egrave=667;e.racute=444;e.omacron=500;e.Zacute=667;e.Zcaron=667;e.greaterequal=549;e.Eth=722;e.Ccedilla=722;e.lcommaaccent=278;e.tcaron=416;e.eogonek=444;e.Uogonek=722;e.Aacute=722;e.Adieresis=722;e.egrave=444;e.zacute=444;e.iogonek=278;e.Oacute=778;e.oacute=500;e.amacron=500;e.sacute=389;e.idieresis=278;e.Ocircumflex=778;e.Ugrave=722;e.Delta=612;e.thorn=556;e.twosuperior=300;e.Odieresis=778;e.mu=556;e.igrave=278;e.ohungarumlaut=500;e.Eogonek=667;e.dcroat=556;e.threequarters=750;e.Scedilla=556;e.lcaron=394;e.Kcommaaccent=778;e.Lacute=667;e.trademark=1e3;e.edotaccent=444;e.Igrave=389;e.Imacron=389;e.Lcaron=667;e.onehalf=750;e.lessequal=549;e.ocircumflex=500;e.ntilde=556;e.Uhungarumlaut=722;e.Eacute=667;e.emacron=444;e.gbreve=500;e.onequarter=750;e.Scaron=556;e.Scommaaccent=556;e.Ohungarumlaut=778;e.degree=400;e.ograve=500;e.Ccaron=722;e.ugrave=556;e.radical=549;e.Dcaron=722;e.rcommaaccent=444;e.Ntilde=722;e.otilde=500;e.Rcommaaccent=722;e.Lcommaaccent=667;e.Atilde=722;e.Aogonek=722;e.Aring=722;e.Otilde=778;e.zdotaccent=444;e.Ecaron=667;e.Iogonek=389;e.kcommaaccent=556;e.minus=570;e.Icircumflex=389;e.ncaron=556;e.tcommaaccent=333;e.logicalnot=570;e.odieresis=500;e.udieresis=556;e.notequal=549;e.gcommaaccent=500;e.eth=500;e.zcaron=444;e.ncommaaccent=556;e.onesuperior=300;e.imacron=278;e.Euro=500});e["Times-BoldItalic"]=(0,a.getLookupTableFactory)(function(e){e.space=250;e.exclam=389;e.quotedbl=555;e.numbersign=500;e.dollar=500;e.percent=833;e.ampersand=778;e.quoteright=333;e.parenleft=333;e.parenright=333;e.asterisk=500;e.plus=570;e.comma=250;e.hyphen=333;e.period=250;e.slash=278;e.zero=500;e.one=500;e.two=500;e.three=500;e.four=500;e.five=500;e.six=500;e.seven=500;e.eight=500;e.nine=500;e.colon=333;e.semicolon=333;e.less=570;e.equal=570;e.greater=570;e.question=500;e.at=832;e.A=667;e.B=667;e.C=667;e.D=722;e.E=667;e.F=667;e.G=722;e.H=778;e.I=389;e.J=500;e.K=667;e.L=611;e.M=889;e.N=722;e.O=722;e.P=611;e.Q=722;e.R=667;e.S=556;e.T=611;e.U=722;e.V=667;e.W=889;e.X=667;e.Y=611;e.Z=611;e.bracketleft=333;e.backslash=278;e.bracketright=333;e.asciicircum=570;e.underscore=500;e.quoteleft=333;e.a=500;e.b=500;e.c=444;e.d=500;e.e=444;e.f=333;e.g=500;e.h=556;e.i=278;e.j=278;e.k=500;e.l=278;e.m=778;e.n=556;e.o=500;e.p=500;e.q=500;e.r=389;e.s=389;e.t=278;e.u=556;e.v=444;e.w=667;e.x=500;e.y=444;e.z=389;e.braceleft=348;e.bar=220;e.braceright=348;e.asciitilde=570;e.exclamdown=389;e.cent=500;e.sterling=500;e.fraction=167;e.yen=500;e.florin=500;e.section=500;e.currency=500;e.quotesingle=278;e.quotedblleft=500;e.guillemotleft=500;e.guilsinglleft=333;e.guilsinglright=333;e.fi=556;e.fl=556;e.endash=500;e.dagger=500;e.daggerdbl=500;e.periodcentered=250;e.paragraph=500;e.bullet=350;e.quotesinglbase=333;e.quotedblbase=500;e.quotedblright=500;e.guillemotright=500;e.ellipsis=1e3;e.perthousand=1e3;e.questiondown=500;e.grave=333;e.acute=333;e.circumflex=333;e.tilde=333;e.macron=333;e.breve=333;e.dotaccent=333;e.dieresis=333;e.ring=333;e.cedilla=333;e.hungarumlaut=333;e.ogonek=333;e.caron=333;e.emdash=1e3;e.AE=944;e.ordfeminine=266;e.Lslash=611;e.Oslash=722;e.OE=944;e.ordmasculine=300;e.ae=722;e.dotlessi=278;e.lslash=278;e.oslash=500;e.oe=722;e.germandbls=500;e.Idieresis=389;e.eacute=444;e.abreve=500;e.uhungarumlaut=556;e.ecaron=444;e.Ydieresis=611;e.divide=570;e.Yacute=611;e.Acircumflex=667;e.aacute=500;e.Ucircumflex=722;e.yacute=444;e.scommaaccent=389;e.ecircumflex=444;e.Uring=722;e.Udieresis=722;e.aogonek=500;e.Uacute=722;e.uogonek=556;e.Edieresis=667;e.Dcroat=722;e.commaaccent=250;e.copyright=747;e.Emacron=667;e.ccaron=444;e.aring=500;e.Ncommaaccent=722;e.lacute=278;e.agrave=500;e.Tcommaaccent=611;e.Cacute=667;e.atilde=500;e.Edotaccent=667;e.scaron=389;e.scedilla=389;e.iacute=278;e.lozenge=494;e.Rcaron=667;e.Gcommaaccent=722;e.ucircumflex=556;e.acircumflex=500;e.Amacron=667;e.rcaron=389;e.ccedilla=444;e.Zdotaccent=611;e.Thorn=611;e.Omacron=722;e.Racute=667;e.Sacute=556;e.dcaron=608;e.Umacron=722;e.uring=556;e.threesuperior=300;e.Ograve=722;e.Agrave=667;e.Abreve=667;e.multiply=570;e.uacute=556;e.Tcaron=611;e.partialdiff=494;e.ydieresis=444;e.Nacute=722;e.icircumflex=278;e.Ecircumflex=667;e.adieresis=500;e.edieresis=444;e.cacute=444;e.nacute=556;e.umacron=556;e.Ncaron=722;e.Iacute=389;e.plusminus=570;e.brokenbar=220;e.registered=747;e.Gbreve=722;e.Idotaccent=389;e.summation=600;e.Egrave=667;e.racute=389;e.omacron=500;e.Zacute=611;e.Zcaron=611;e.greaterequal=549;e.Eth=722;e.Ccedilla=667;e.lcommaaccent=278;e.tcaron=366;e.eogonek=444;e.Uogonek=722;e.Aacute=667;e.Adieresis=667;e.egrave=444;e.zacute=389;e.iogonek=278;e.Oacute=722;e.oacute=500;e.amacron=500;e.sacute=389;e.idieresis=278;e.Ocircumflex=722;e.Ugrave=722;e.Delta=612;e.thorn=500;e.twosuperior=300;e.Odieresis=722;e.mu=576;e.igrave=278;e.ohungarumlaut=500;e.Eogonek=667;e.dcroat=500;e.threequarters=750;e.Scedilla=556;e.lcaron=382;e.Kcommaaccent=667;e.Lacute=611;e.trademark=1e3;e.edotaccent=444;e.Igrave=389;e.Imacron=389;e.Lcaron=611;e.onehalf=750;e.lessequal=549;e.ocircumflex=500;e.ntilde=556;e.Uhungarumlaut=722;e.Eacute=667;e.emacron=444;e.gbreve=500;e.onequarter=750;e.Scaron=556;e.Scommaaccent=556;e.Ohungarumlaut=722;e.degree=400;e.ograve=500;e.Ccaron=667;e.ugrave=556;e.radical=549;e.Dcaron=722;e.rcommaaccent=389;e.Ntilde=722;e.otilde=500;e.Rcommaaccent=667;e.Lcommaaccent=611;e.Atilde=667;e.Aogonek=667;e.Aring=667;e.Otilde=722;e.zdotaccent=389;e.Ecaron=667;e.Iogonek=389;e.kcommaaccent=500;e.minus=606;e.Icircumflex=389;e.ncaron=556;e.tcommaaccent=278;e.logicalnot=606;e.odieresis=500;e.udieresis=556;e.notequal=549;e.gcommaaccent=500;e.eth=500;e.zcaron=389;e.ncommaaccent=556;e.onesuperior=300;e.imacron=278;e.Euro=500});e["Times-Italic"]=(0,a.getLookupTableFactory)(function(e){e.space=250;e.exclam=333;e.quotedbl=420;e.numbersign=500;e.dollar=500;e.percent=833;e.ampersand=778;e.quoteright=333;e.parenleft=333;e.parenright=333;e.asterisk=500;e.plus=675;e.comma=250;e.hyphen=333;e.period=250;e.slash=278;e.zero=500;e.one=500;e.two=500;e.three=500;e.four=500;e.five=500;e.six=500;e.seven=500;e.eight=500;e.nine=500;e.colon=333;e.semicolon=333;e.less=675;e.equal=675;e.greater=675;e.question=500;e.at=920;e.A=611;e.B=611;e.C=667;e.D=722;e.E=611;e.F=611;e.G=722;e.H=722;e.I=333;e.J=444;e.K=667;e.L=556;e.M=833;e.N=667;e.O=722;e.P=611;e.Q=722;e.R=611;e.S=500;e.T=556;e.U=722;e.V=611;e.W=833;e.X=611;e.Y=556;e.Z=556;e.bracketleft=389;e.backslash=278;e.bracketright=389;e.asciicircum=422;e.underscore=500;e.quoteleft=333;e.a=500;e.b=500;e.c=444;e.d=500;e.e=444;e.f=278;e.g=500;e.h=500;e.i=278;e.j=278;e.k=444;e.l=278;e.m=722;e.n=500;e.o=500;e.p=500;e.q=500;e.r=389;e.s=389;e.t=278;e.u=500;e.v=444;e.w=667;e.x=444;e.y=444;e.z=389;e.braceleft=400;e.bar=275;e.braceright=400;e.asciitilde=541;e.exclamdown=389;e.cent=500;e.sterling=500;e.fraction=167;e.yen=500;e.florin=500;e.section=500;e.currency=500;e.quotesingle=214;e.quotedblleft=556;e.guillemotleft=500;e.guilsinglleft=333;e.guilsinglright=333;e.fi=500;e.fl=500;e.endash=500;e.dagger=500;e.daggerdbl=500;e.periodcentered=250;e.paragraph=523;e.bullet=350;e.quotesinglbase=333;e.quotedblbase=556;e.quotedblright=556;e.guillemotright=500;e.ellipsis=889;e.perthousand=1e3;e.questiondown=500;e.grave=333;e.acute=333;e.circumflex=333;e.tilde=333;e.macron=333;e.breve=333;e.dotaccent=333;e.dieresis=333;e.ring=333;e.cedilla=333;e.hungarumlaut=333;e.ogonek=333;e.caron=333;e.emdash=889;e.AE=889;e.ordfeminine=276;e.Lslash=556;e.Oslash=722;e.OE=944;e.ordmasculine=310;e.ae=667;e.dotlessi=278;e.lslash=278;e.oslash=500;e.oe=667;e.germandbls=500;e.Idieresis=333;e.eacute=444;e.abreve=500;e.uhungarumlaut=500;e.ecaron=444;e.Ydieresis=556;e.divide=675;e.Yacute=556;e.Acircumflex=611;e.aacute=500;e.Ucircumflex=722;e.yacute=444;e.scommaaccent=389;e.ecircumflex=444;e.Uring=722;e.Udieresis=722;e.aogonek=500;e.Uacute=722;e.uogonek=500;e.Edieresis=611;e.Dcroat=722;e.commaaccent=250;e.copyright=760;e.Emacron=611;e.ccaron=444;e.aring=500;e.Ncommaaccent=667;e.lacute=278;e.agrave=500;e.Tcommaaccent=556;e.Cacute=667;e.atilde=500;e.Edotaccent=611;e.scaron=389;e.scedilla=389;e.iacute=278;e.lozenge=471;e.Rcaron=611;e.Gcommaaccent=722;e.ucircumflex=500;e.acircumflex=500;e.Amacron=611;e.rcaron=389;e.ccedilla=444;e.Zdotaccent=556;e.Thorn=611;e.Omacron=722;e.Racute=611;e.Sacute=500;e.dcaron=544;e.Umacron=722;e.uring=500;e.threesuperior=300;e.Ograve=722;e.Agrave=611;e.Abreve=611;e.multiply=675;e.uacute=500;e.Tcaron=556;e.partialdiff=476;e.ydieresis=444;e.Nacute=667;e.icircumflex=278;e.Ecircumflex=611;e.adieresis=500;e.edieresis=444;e.cacute=444;e.nacute=500;e.umacron=500;e.Ncaron=667;e.Iacute=333;e.plusminus=675;e.brokenbar=275;e.registered=760;e.Gbreve=722;e.Idotaccent=333;e.summation=600;e.Egrave=611;e.racute=389;e.omacron=500;e.Zacute=556;e.Zcaron=556;e.greaterequal=549;e.Eth=722;e.Ccedilla=667;e.lcommaaccent=278;e.tcaron=300;e.eogonek=444;e.Uogonek=722;e.Aacute=611;e.Adieresis=611;e.egrave=444;e.zacute=389;e.iogonek=278;e.Oacute=722;e.oacute=500;e.amacron=500;e.sacute=389;e.idieresis=278;e.Ocircumflex=722;e.Ugrave=722;e.Delta=612;e.thorn=500;e.twosuperior=300;e.Odieresis=722;e.mu=500;e.igrave=278;e.ohungarumlaut=500;e.Eogonek=611;e.dcroat=500;e.threequarters=750;e.Scedilla=500;e.lcaron=300;e.Kcommaaccent=667;e.Lacute=556;e.trademark=980;e.edotaccent=444;e.Igrave=333;e.Imacron=333;e.Lcaron=611;e.onehalf=750;e.lessequal=549;e.ocircumflex=500;e.ntilde=500;e.Uhungarumlaut=722;e.Eacute=611;e.emacron=444;e.gbreve=500;e.onequarter=750;e.Scaron=500;e.Scommaaccent=500;e.Ohungarumlaut=722;e.degree=400;e.ograve=500;e.Ccaron=667;e.ugrave=500;e.radical=453;e.Dcaron=722;e.rcommaaccent=389;e.Ntilde=667;e.otilde=500;e.Rcommaaccent=611;e.Lcommaaccent=556;e.Atilde=611;e.Aogonek=611;e.Aring=611;e.Otilde=722;e.zdotaccent=389;e.Ecaron=611;e.Iogonek=333;e.kcommaaccent=444;e.minus=675;e.Icircumflex=333;e.ncaron=500;e.tcommaaccent=278;e.logicalnot=675;e.odieresis=500;e.udieresis=500;e.notequal=549;e.gcommaaccent=500;e.eth=500;e.zcaron=389;e.ncommaaccent=500;e.onesuperior=300;e.imacron=278;e.Euro=500});e.ZapfDingbats=(0,a.getLookupTableFactory)(function(e){e.space=278;e.a1=974;e.a2=961;e.a202=974;e.a3=980;e.a4=719;e.a5=789;e.a119=790;e.a118=791;e.a117=690;e.a11=960;e.a12=939;e.a13=549;e.a14=855;e.a15=911;e.a16=933;e.a105=911;e.a17=945;e.a18=974;e.a19=755;e.a20=846;e.a21=762;e.a22=761;e.a23=571;e.a24=677;e.a25=763;e.a26=760;e.a27=759;e.a28=754;e.a6=494;e.a7=552;e.a8=537;e.a9=577;e.a10=692;e.a29=786;e.a30=788;e.a31=788;e.a32=790;e.a33=793;e.a34=794;e.a35=816;e.a36=823;e.a37=789;e.a38=841;e.a39=823;e.a40=833;e.a41=816;e.a42=831;e.a43=923;e.a44=744;e.a45=723;e.a46=749;e.a47=790;e.a48=792;e.a49=695;e.a50=776;e.a51=768;e.a52=792;e.a53=759;e.a54=707;e.a55=708;e.a56=682;e.a57=701;e.a58=826;e.a59=815;e.a60=789;e.a61=789;e.a62=707;e.a63=687;e.a64=696;e.a65=689;e.a66=786;e.a67=787;e.a68=713;e.a69=791;e.a70=785;e.a71=791;e.a72=873;e.a73=761;e.a74=762;e.a203=762;e.a75=759;e.a204=759;e.a76=892;e.a77=892;e.a78=788;e.a79=784;e.a81=438;e.a82=138;e.a83=277;e.a84=415;e.a97=392;e.a98=392;e.a99=668;e.a100=668;e.a89=390;e.a90=390;e.a93=317;e.a94=317;e.a91=276;e.a92=276;e.a205=509;e.a85=509;e.a206=410;e.a86=410;e.a87=234;e.a88=234;e.a95=334;e.a96=334;e.a101=732;e.a102=544;e.a103=544;e.a104=910;e.a106=667;e.a107=760;e.a108=760;e.a112=776;e.a111=595;e.a110=694;e.a109=626;e.a120=788;e.a121=788;e.a122=788;e.a123=788;e.a124=788;e.a125=788;e.a126=788;e.a127=788;e.a128=788;e.a129=788;e.a130=788;e.a131=788;e.a132=788;e.a133=788;e.a134=788;e.a135=788;e.a136=788;e.a137=788;e.a138=788;e.a139=788;e.a140=788;e.a141=788;e.a142=788;e.a143=788;e.a144=788;e.a145=788;e.a146=788;e.a147=788;e.a148=788;e.a149=788;e.a150=788;e.a151=788;e.a152=788;e.a153=788;e.a154=788;e.a155=788;e.a156=788;e.a157=788;e.a158=788;e.a159=788;e.a160=894;e.a161=838;e.a163=1016;e.a164=458;e.a196=748;e.a165=924;e.a192=748;e.a166=918;e.a167=927;e.a168=928;e.a169=928;e.a170=834;e.a171=873;e.a172=828;e.a173=924;e.a162=924;e.a174=917;e.a175=930;e.a176=931;e.a177=463;e.a178=883;e.a179=836;e.a193=836;e.a180=867;e.a199=867;e.a181=696;e.a200=696;e.a182=874;e.a201=874;e.a183=760;e.a184=946;e.a197=771;e.a185=865;e.a194=771;e.a198=888;e.a186=967;e.a195=888;e.a187=831;e.a188=873;e.a189=927;e.a190=970;e.a191=918})});t.getMetrics=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PostScriptCompiler=t.PostScriptEvaluator=t.PDFFunctionFactory=t.isPDFFunction=void 0;var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1;a.configurable=!0;"value"in a&&(a.writable=!0);Object.defineProperty(e,a.key,a)}}return function(t,r,a){r&&e(t.prototype,r);a&&e(t,a);return t}}(),n=r(2),o=r(138),s=r(169);var c={get value(){return(0,n.shadow)(this,"value",(0,n.isEvalSupported)())}},l=function(){function e(t){var r=t.xref,a=t.isEvalSupported,i=void 0===a||a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);this.xref=r;this.isEvalSupported=!1!==i}i(e,[{key:"create",value:function(e){return h.parse({xref:this.xref,isEvalSupported:this.isEvalSupported,fn:e})}},{key:"createFromArray",value:function(e){return h.parseArray({xref:this.xref,isEvalSupported:this.isEvalSupported,fnObj:e})}}]);return e}();function u(e){if(!Array.isArray(e))return null;for(var t=e.length,r=0;r<t;r++)if("number"!=typeof e[r]){for(var a=new Array(t),i=0;i<t;i++)a[i]=+e[i];return a}return e}var h={getSampleArray:function(e,t,r,a){var i,n,o=1;for(i=0,n=e.length;i<n;i++)o*=e[i];o*=t;var s=new Array(o),c=0,l=0,u=1/(Math.pow(2,r)-1),h=a.getBytes((o*r+7)/8),f=0;for(i=0;i<o;i++){for(;c<r;){l<<=8;l|=h[f++];c+=8}c-=r;s[i]=(l>>c)*u;l&=(1<<c)-1}return s},getIR:function(e){var t=e.xref,r=e.isEvalSupported,a=e.fn,i=a.dict;i||(i=a);var o=[this.constructSampled,null,this.constructInterpolated,this.constructStiched,this.constructPostScript][i.get("FunctionType")];if(!o)throw new n.FormatError("Unknown type of function");return o.call(this,{xref:t,isEvalSupported:r,fn:a,dict:i})},fromIR:function(e){var t=e.xref,r=e.isEvalSupported,a=e.IR;switch(a[0]){case 0:return this.constructSampledFromIR({xref:t,isEvalSupported:r,IR:a});case 2:return this.constructInterpolatedFromIR({xref:t,isEvalSupported:r,IR:a});case 3:return this.constructStichedFromIR({xref:t,isEvalSupported:r,IR:a});default:return this.constructPostScriptFromIR({xref:t,isEvalSupported:r,IR:a})}},parse:function(e){var t=e.xref,r=e.isEvalSupported,a=e.fn,i=this.getIR({xref:t,isEvalSupported:r,fn:a});return this.fromIR({xref:t,isEvalSupported:r,IR:i})},parseArray:function(e){var t=e.xref,r=e.isEvalSupported,a=e.fnObj;if(!Array.isArray(a))return this.parse({xref:t,isEvalSupported:r,fn:a});for(var i=[],n=0,o=a.length;n<o;n++)i.push(this.parse({xref:t,isEvalSupported:r,fn:t.fetchIfRef(a[n])}));return function(e,t,r,a){for(var n=0,o=i.length;n<o;n++)i[n](e,t,r,a+n)}},constructSampled:function(e){e.xref,e.isEvalSupported;var t=e.fn,r=e.dict;function a(e){for(var t=e.length,r=[],a=0,i=0;i<t;i+=2){r[a]=[e[i],e[i+1]];++a}return r}var i=u(r.getArray("Domain")),o=u(r.getArray("Range"));if(!i||!o)throw new n.FormatError("No domain or range");var s=i.length/2,c=o.length/2;i=a(i);o=a(o);var l=u(r.getArray("Size")),h=r.get("BitsPerSample"),f=r.get("Order")||1;1!==f&&(0,n.info)("No support for cubic spline interpolation: "+f);var d=u(r.getArray("Encode"));if(d)d=a(d);else{d=[];for(var g=0;g<s;++g)d.push([0,l[g]-1])}var m=u(r.getArray("Decode"));return[0,s,i,d,m=m?a(m):o,this.getSampleArray(l,c,h,t),l,c,Math.pow(2,h)-1,o]},constructSampledFromIR:function(e){e.xref,e.isEvalSupported;var t=e.IR;function r(e,t,r,a,i){return a+(i-a)/(r-t)*(e-t)}return function(e,a,i,n){var o,s,c=t[1],l=t[2],u=t[3],h=t[4],f=t[5],d=t[6],g=t[7],m=t[9],p=1<<c,v=new Float64Array(p),b=new Uint32Array(p);for(s=0;s<p;s++)v[s]=1;var y=g,w=1;for(o=0;o<c;++o){var k=l[o][0],S=l[o][1],C=r(Math.min(Math.max(e[a+o],k),S),k,S,u[o][0],u[o][1]),x=d[o],_=(C=Math.min(Math.max(C,0),x-1))<x-1?Math.floor(C):C-1,A=_+1-C,P=C-_,I=_*y,O=I+y;for(s=0;s<p;s++)if(s&w){v[s]*=P;b[s]+=O}else{v[s]*=A;b[s]+=I}y*=x;w<<=1}for(s=0;s<g;++s){var T=0;for(o=0;o<p;o++)T+=f[b[o]+s]*v[o];T=r(T,0,1,h[s][0],h[s][1]);i[n+s]=Math.min(Math.max(T,m[s][0]),m[s][1])}}},constructInterpolated:function(e){e.xref,e.isEvalSupported,e.fn;for(var t=e.dict,r=u(t.getArray("C0"))||[0],a=u(t.getArray("C1"))||[1],i=t.get("N"),n=r.length,o=[],s=0;s<n;++s)o.push(a[s]-r[s]);return[2,r,o,i]},constructInterpolatedFromIR:function(e){e.xref,e.isEvalSupported;var t=e.IR,r=t[1],a=t[2],i=t[3],n=a.length;return function(e,t,o,s){for(var c=1===i?e[t]:Math.pow(e[t],i),l=0;l<n;++l)o[s+l]=r[l]+c*a[l]}},constructStiched:function(e){var t=e.xref,r=e.isEvalSupported,a=(e.fn,e.dict),i=u(a.getArray("Domain"));if(!i)throw new n.FormatError("No domain");if(1!=i.length/2)throw new n.FormatError("Bad domain for stiched function");for(var o=a.get("Functions"),s=[],c=0,l=o.length;c<l;++c)s.push(this.parse({xref:t,isEvalSupported:r,fn:t.fetchIfRef(o[c])}));return[3,i,u(a.getArray("Bounds")),u(a.getArray("Encode")),s]},constructStichedFromIR:function(e){e.xref,e.isEvalSupported;var t=e.IR,r=t[1],a=t[2],i=t[3],n=t[4],o=new Float32Array(1);return function(e,t,s,c){for(var l=function(e,t,r){e>r?e=r:e<t&&(e=t);return e}(e[t],r[0],r[1]),u=0,h=a.length;u<h&&!(l<a[u]);++u);var f=r[0];u>0&&(f=a[u-1]);var d=r[1];u<a.length&&(d=a[u]);var g=i[2*u],m=i[2*u+1];o[0]=f===d?g:g+(l-f)*(m-g)/(d-f);n[u](o,0,s,c)}},constructPostScript:function(e){e.xref,e.isEvalSupported;var t=e.fn,r=e.dict,a=u(r.getArray("Domain")),i=u(r.getArray("Range"));if(!a)throw new n.FormatError("No domain.");if(!i)throw new n.FormatError("No range.");var o=new s.PostScriptLexer(t);return[4,a,i,new s.PostScriptParser(o).parse()]},constructPostScriptFromIR:function(e){e.xref;var t=e.isEvalSupported,r=e.IR,a=r[1],i=r[2],o=r[3];if(t&&c.value){var s=(new g).compile(o,a,i);if(s)return new Function("src","srcOffset","dest","destOffset",s)}(0,n.info)("Unable to compile PS function");var l=i.length>>1,u=a.length>>1,h=new d(o),f=Object.create(null),m=8192,p=new Float32Array(u);return function(e,t,r,a){var n,o,s="",c=p;for(n=0;n<u;n++){o=e[t+n];c[n]=o;s+=o+"_"}var d=f[s];if(void 0===d){var g=new Float32Array(l),v=h.execute(c),b=v.length-l;for(n=0;n<l;n++){o=v[b+n];var y=i[2*n];o<y?o=y:o>(y=i[2*n+1])&&(o=y);g[n]=o}if(m>0){m--;f[s]=g}r.set(g,a)}else r.set(d,a)}}};var f=function(){function e(e){this.stack=e?Array.prototype.slice.call(e,0):[]}e.prototype={push:function(e){if(this.stack.length>=100)throw new Error("PostScript function stack overflow.");this.stack.push(e)},pop:function(){if(this.stack.length<=0)throw new Error("PostScript function stack underflow.");return this.stack.pop()},copy:function(e){if(this.stack.length+e>=100)throw new Error("PostScript function stack overflow.");for(var t=this.stack,r=t.length-e,a=e-1;a>=0;a--,r++)t.push(t[r])},index:function(e){this.push(this.stack[this.stack.length-e-1])},roll:function(e,t){var r,a,i,n=this.stack,o=n.length-e,s=n.length-1,c=o+(t-Math.floor(t/e)*e);for(r=o,a=s;r<a;r++,a--){i=n[r];n[r]=n[a];n[a]=i}for(r=o,a=c-1;r<a;r++,a--){i=n[r];n[r]=n[a];n[a]=i}for(r=c,a=s;r<a;r++,a--){i=n[r];n[r]=n[a];n[a]=i}}};return e}(),d=function(){function e(e){this.operators=e}e.prototype={execute:function(e){for(var t,r,a,i=new f(e),o=0,s=this.operators,c=s.length;o<c;)if("number"!=typeof(t=s[o++]))switch(t){case"jz":a=i.pop();(r=i.pop())||(o=a);break;case"j":o=r=i.pop();break;case"abs":r=i.pop();i.push(Math.abs(r));break;case"add":a=i.pop();r=i.pop();i.push(r+a);break;case"and":a=i.pop();r=i.pop();(0,n.isBool)(r)&&(0,n.isBool)(a)?i.push(r&&a):i.push(r&a);break;case"atan":r=i.pop();i.push(Math.atan(r));break;case"bitshift":a=i.pop();(r=i.pop())>0?i.push(r<<a):i.push(r>>a);break;case"ceiling":r=i.pop();i.push(Math.ceil(r));break;case"copy":r=i.pop();i.copy(r);break;case"cos":r=i.pop();i.push(Math.cos(r));break;case"cvi":r=0|i.pop();i.push(r);break;case"cvr":break;case"div":a=i.pop();r=i.pop();i.push(r/a);break;case"dup":i.copy(1);break;case"eq":a=i.pop();r=i.pop();i.push(r===a);break;case"exch":i.roll(2,1);break;case"exp":a=i.pop();r=i.pop();i.push(Math.pow(r,a));break;case"false":i.push(!1);break;case"floor":r=i.pop();i.push(Math.floor(r));break;case"ge":a=i.pop();r=i.pop();i.push(r>=a);break;case"gt":a=i.pop();r=i.pop();i.push(r>a);break;case"idiv":a=i.pop();r=i.pop();i.push(r/a|0);break;case"index":r=i.pop();i.index(r);break;case"le":a=i.pop();r=i.pop();i.push(r<=a);break;case"ln":r=i.pop();i.push(Math.log(r));break;case"log":r=i.pop();i.push(Math.log(r)/Math.LN10);break;case"lt":a=i.pop();r=i.pop();i.push(r<a);break;case"mod":a=i.pop();r=i.pop();i.push(r%a);break;case"mul":a=i.pop();r=i.pop();i.push(r*a);break;case"ne":a=i.pop();r=i.pop();i.push(r!==a);break;case"neg":r=i.pop();i.push(-r);break;case"not":r=i.pop();(0,n.isBool)(r)?i.push(!r):i.push(~r);break;case"or":a=i.pop();r=i.pop();(0,n.isBool)(r)&&(0,n.isBool)(a)?i.push(r||a):i.push(r|a);break;case"pop":i.pop();break;case"roll":a=i.pop();r=i.pop();i.roll(r,a);break;case"round":r=i.pop();i.push(Math.round(r));break;case"sin":r=i.pop();i.push(Math.sin(r));break;case"sqrt":r=i.pop();i.push(Math.sqrt(r));break;case"sub":a=i.pop();r=i.pop();i.push(r-a);break;case"true":i.push(!0);break;case"truncate":r=(r=i.pop())<0?Math.ceil(r):Math.floor(r);i.push(r);break;case"xor":a=i.pop();r=i.pop();(0,n.isBool)(r)&&(0,n.isBool)(a)?i.push(r!==a):i.push(r^a);break;default:throw new n.FormatError("Unknown operator "+t)}else i.push(t);return i.stack}};return e}(),g=function(){function e(e){this.type=e}e.prototype.visit=function(e){(0,n.unreachable)("abstract method")};function t(t,r,a){e.call(this,"args");this.index=t;this.min=r;this.max=a}t.prototype=Object.create(e.prototype);t.prototype.visit=function(e){e.visitArgument(this)};function r(t){e.call(this,"literal");this.number=t;this.min=t;this.max=t}r.prototype=Object.create(e.prototype);r.prototype.visit=function(e){e.visitLiteral(this)};function a(t,r,a,i,n){e.call(this,"binary");this.op=t;this.arg1=r;this.arg2=a;this.min=i;this.max=n}a.prototype=Object.create(e.prototype);a.prototype.visit=function(e){e.visitBinaryOperation(this)};function i(t,r){e.call(this,"max");this.arg=t;this.min=t.min;this.max=r}i.prototype=Object.create(e.prototype);i.prototype.visit=function(e){e.visitMin(this)};function o(t,r,a){e.call(this,"var");this.index=t;this.min=r;this.max=a}o.prototype=Object.create(e.prototype);o.prototype.visit=function(e){e.visitVariable(this)};function s(t,r){e.call(this,"definition");this.variable=t;this.arg=r}s.prototype=Object.create(e.prototype);s.prototype.visit=function(e){e.visitVariableDefinition(this)};function c(){this.parts=[]}c.prototype={visitArgument:function(e){this.parts.push("Math.max(",e.min,", Math.min(",e.max,", src[srcOffset + ",e.index,"]))")},visitVariable:function(e){this.parts.push("v",e.index)},visitLiteral:function(e){this.parts.push(e.number)},visitBinaryOperation:function(e){this.parts.push("(");e.arg1.visit(this);this.parts.push(" ",e.op," ");e.arg2.visit(this);this.parts.push(")")},visitVariableDefinition:function(e){this.parts.push("var ");e.variable.visit(this);this.parts.push(" = ");e.arg.visit(this);this.parts.push(";")},visitMin:function(e){this.parts.push("Math.min(");e.arg.visit(this);this.parts.push(", ",e.max,")")},toString:function(){return this.parts.join("")}};function l(e,t){return"literal"===t.type&&0===t.number?e:"literal"===e.type&&0===e.number?t:"literal"===t.type&&"literal"===e.type?new r(e.number+t.number):new a("+",e,t,e.min+t.min,e.max+t.max)}function u(e,t){if("literal"===t.type){if(0===t.number)return new r(0);if(1===t.number)return e;if("literal"===e.type)return new r(e.number*t.number)}if("literal"===e.type){if(0===e.number)return new r(0);if(1===e.number)return t}return new a("*",e,t,Math.min(e.min*t.min,e.min*t.max,e.max*t.min,e.max*t.max),Math.max(e.min*t.min,e.min*t.max,e.max*t.min,e.max*t.max))}function h(e,t){if("literal"===t.type){if(0===t.number)return e;if("literal"===e.type)return new r(e.number-t.number)}return"binary"===t.type&&"-"===t.op&&"literal"===e.type&&1===e.number&&"literal"===t.arg1.type&&1===t.arg1.number?t.arg2:new a("-",e,t,e.min-t.max,e.max-t.min)}function f(e,t){return e.min>=t?new r(t):e.max<=t?e:new i(e,t)}function d(){}d.prototype={compile:function(e,a,i){var n,d,g,m,p,v,b,y,w,k,S=[],C=[],x=a.length>>1,_=i.length>>1,A=0;for(n=0;n<x;n++)S.push(new t(n,a[2*n],a[2*n+1]));for(n=0,d=e.length;n<d;n++)if("number"!=typeof(k=e[n]))switch(k){case"add":if(S.length<2)return null;v=S.pop();p=S.pop();S.push(l(p,v));break;case"cvr":if(S.length<1)return null;break;case"mul":if(S.length<2)return null;v=S.pop();p=S.pop();S.push(u(p,v));break;case"sub":if(S.length<2)return null;v=S.pop();p=S.pop();S.push(h(p,v));break;case"exch":if(S.length<2)return null;b=S.pop();y=S.pop();S.push(b,y);break;case"pop":if(S.length<1)return null;S.pop();break;case"index":if(S.length<1)return null;if("literal"!==(p=S.pop()).type)return null;if((g=p.number)<0||!Number.isInteger(g)||S.length<g)return null;if("literal"===(b=S[S.length-g-1]).type||"var"===b.type){S.push(b);break}w=new o(A++,b.min,b.max);S[S.length-g-1]=w;S.push(w);C.push(new s(w,b));break;case"dup":if(S.length<1)return null;if("number"==typeof e[n+1]&&"gt"===e[n+2]&&e[n+3]===n+7&&"jz"===e[n+4]&&"pop"===e[n+5]&&e[n+6]===e[n+1]){p=S.pop();S.push(f(p,e[n+1]));n+=6;break}if("literal"===(b=S[S.length-1]).type||"var"===b.type){S.push(b);break}w=new o(A++,b.min,b.max);S[S.length-1]=w;S.push(w);C.push(new s(w,b));break;case"roll":if(S.length<2)return null;v=S.pop();p=S.pop();if("literal"!==v.type||"literal"!==p.type)return null;m=v.number;if((g=p.number)<=0||!Number.isInteger(g)||!Number.isInteger(m)||S.length<g)return null;if(0===(m=(m%g+g)%g))break;Array.prototype.push.apply(S,S.splice(S.length-g,g-m));break;default:return null}else S.push(new r(k));if(S.length!==_)return null;var P=[];C.forEach(function(e){var t=new c;e.visit(t);P.push(t.toString())});S.forEach(function(e,t){var r=new c;e.visit(r);var a=i[2*t],n=i[2*t+1],o=[r.toString()];if(a>e.min){o.unshift("Math.max(",a,", ");o.push(")")}if(n<e.max){o.unshift("Math.min(",n,", ");o.push(")")}o.unshift("dest[destOffset + ",t,"] = ");o.push(";");P.push(o.join(""))});return P.join("\n")}};return d}();t.isPDFFunction=function(e){var t;if("object"!==(void 0===e?"undefined":a(e)))return!1;if((0,o.isDict)(e))t=e;else{if(!(0,o.isStream)(e))return!1;t=e.dict}return t.has("FunctionType")};t.PDFFunctionFactory=l;t.PostScriptEvaluator=d;t.PostScriptCompiler=g},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PostScriptParser=t.PostScriptLexer=void 0;var a=r(2),i=r(138),n=function(){function e(e){this.lexer=e;this.operators=[];this.token=null;this.prev=null}e.prototype={nextToken:function(){this.prev=this.token;this.token=this.lexer.getToken()},accept:function(e){if(this.token.type===e){this.nextToken();return!0}return!1},expect:function(e){if(this.accept(e))return!0;throw new a.FormatError("Unexpected symbol: found "+this.token.type+" expected "+e+".")},parse:function(){this.nextToken();this.expect(o.LBRACE);this.parseBlock();this.expect(o.RBRACE);return this.operators},parseBlock:function(){for(;;)if(this.accept(o.NUMBER))this.operators.push(this.prev.value);else if(this.accept(o.OPERATOR))this.operators.push(this.prev.value);else{if(!this.accept(o.LBRACE))return;this.parseCondition()}},parseCondition:function(){var e=this.operators.length;this.operators.push(null,null);this.parseBlock();this.expect(o.RBRACE);if(this.accept(o.IF)){this.operators[e]=this.operators.length;this.operators[e+1]="jz"}else{if(!this.accept(o.LBRACE))throw new a.FormatError("PS Function: error parsing conditional.");var t=this.operators.length;this.operators.push(null,null);var r=this.operators.length;this.parseBlock();this.expect(o.RBRACE);this.expect(o.IFELSE);this.operators[t]=this.operators.length;this.operators[t+1]="j";this.operators[e]=r;this.operators[e+1]="jz"}}};return e}(),o={LBRACE:0,RBRACE:1,NUMBER:2,OPERATOR:3,IF:4,IFELSE:5},s=function(){function e(e,t){this.type=e;this.value=t}var t=Object.create(null);e.getOperator=function(r){var a=t[r];return a||(t[r]=new e(o.OPERATOR,r))};e.LBRACE=new e(o.LBRACE,"{");e.RBRACE=new e(o.RBRACE,"}");e.IF=new e(o.IF,"IF");e.IFELSE=new e(o.IFELSE,"IFELSE");return e}(),c=function(){function e(e){this.stream=e;this.nextChar();this.strBuf=[]}e.prototype={nextChar:function(){return this.currentChar=this.stream.getByte()},getToken:function(){for(var e=!1,t=this.currentChar;;){if(t<0)return i.EOF;if(e)10!==t&&13!==t||(e=!1);else if(37===t)e=!0;else if(!(0,a.isSpace)(t))break;t=this.nextChar()}switch(0|t){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return new s(o.NUMBER,this.getNumber());case 123:this.nextChar();return s.LBRACE;case 125:this.nextChar();return s.RBRACE}var r=this.strBuf;r.length=0;r[0]=String.fromCharCode(t);for(;(t=this.nextChar())>=0&&(t>=65&&t<=90||t>=97&&t<=122);)r.push(String.fromCharCode(t));var n=r.join("");switch(n.toLowerCase()){case"if":return s.IF;case"ifelse":return s.IFELSE;default:return s.getOperator(n)}},getNumber:function(){var e=this.currentChar,t=this.strBuf;t.length=0;t[0]=String.fromCharCode(e);for(;(e=this.nextChar())>=0&&(e>=48&&e<=57||45===e||46===e);)t.push(String.fromCharCode(e));var r=parseFloat(t.join(""));if(isNaN(r))throw new a.FormatError("Invalid floating point number: "+r);return r}};return e}();t.PostScriptLexer=c;t.PostScriptParser=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.MurmurHash3_64=void 0;var a=r(2),i=function(e){function t(e){this.h1=e?4294967295&e:3285377520;this.h2=e?4294967295&e:3285377520}t.prototype={update:function(e){var t=void 0,r=void 0;if((0,a.isString)(e)){t=new Uint8Array(2*e.length);r=0;for(var i=0,n=e.length;i<n;i++){var o=e.charCodeAt(i);if(o<=255)t[r++]=o;else{t[r++]=o>>>8;t[r++]=255&o}}}else{if(!(0,a.isArrayBuffer)(e))throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");r=(t=e).byteLength}for(var s=r>>2,c=r-4*s,l=new Uint32Array(t.buffer,0,s),u=0,h=0,f=this.h1,d=this.h2,g=3432918353,m=461845907,p=0;p<s;p++)1&p?f=5*(f=(f^=u=(u=(u=(u=l[p])*g&4294901760|11601*u&65535)<<15|u>>>17)*m&4294901760|13715*u&65535)<<13|f>>>19)+3864292196:d=5*(d=(d^=h=(h=(h=(h=l[p])*g&4294901760|11601*h&65535)<<15|h>>>17)*m&4294901760|13715*h&65535)<<13|d>>>19)+3864292196;u=0;switch(c){case 3:u^=t[4*s+2]<<16;case 2:u^=t[4*s+1]<<8;case 1:u=(u=(u=(u^=t[4*s])*g&4294901760|11601*u&65535)<<15|u>>>17)*m&4294901760|13715*u&65535;1&s?f^=u:d^=u}this.h1=f;this.h2=d;return this},hexdigest:function(){var e=this.h1,t=this.h2;e=3981806797*(e^=t>>>1)&4294901760|36045*e&65535;e=444984403*(e^=(t=4283543511*t&4294901760|(2950163797*(t<<16|e>>>16)&4294901760)>>>16)>>>1)&4294901760|60499*e&65535;for(var r=0,a=[e^=(t=3301882366*t&4294901760|(3120437893*(t<<16|e>>>16)&4294901760)>>>16)>>>1,t],i="";r<a.length;r++){for(var n=(a[r]>>>0).toString(16);n.length<8;)n="0"+n;i+=n}return i}};return t}();t.MurmurHash3_64=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFImage=void 0;var a=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],a=!0,i=!1,n=void 0;try{for(var o,s=e[Symbol.iterator]();!(a=(o=s.next()).done);a=!0){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=!0;n=e}finally{try{!a&&s.return&&s.return()}finally{if(i)throw n}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=r(2),n=r(138),o=r(151),s=r(140),c=r(146),l=r(149),u=function(){function e(e,t){return t&&t.canDecode(e)?t.decode(e).catch(function(t){(0,i.warn)("Native image decoding failed -- trying to recover: "+(t&&t.message));return e}):Promise.resolve(e)}function t(e,t,r,a){return(e=t+e*r)<0?0:e>a?a:e}function r(e,t,r,a,i,n){var o,s,c,l,u=i*n,h=t<=8?new Uint8Array(u):t<=16?new Uint16Array(u):new Uint32Array(u),f=r/i,d=a/n,g=0,m=new Uint16Array(i),p=r;for(o=0;o<i;o++)m[o]=Math.floor(o*f);for(o=0;o<n;o++){c=Math.floor(o*d)*p;for(s=0;s<i;s++){l=c+m[s];h[g++]=e[l]}}return h}function u(e){var t=e.xref,r=e.res,a=e.image,s=e.isInline,c=void 0!==s&&s,h=e.smask,f=void 0===h?null:h,d=e.mask,g=void 0===d?null:d,m=e.isMask,p=void 0!==m&&m,v=e.pdfFunctionFactory;this.image=a;var b=a.dict,y=b.get("Filter");if((0,n.isName)(y))switch(y.name){case"JPXDecode":var w=new l.JpxImage;w.parseImageProperties(a.stream);a.stream.reset();a.width=w.width;a.height=w.height;a.bitsPerComponent=w.bitsPerComponent;a.numComps=w.componentsCount;break;case"JBIG2Decode":a.bitsPerComponent=1;a.numComps=1}var k=b.get("Width","W"),S=b.get("Height","H");if(Number.isInteger(a.width)&&a.width>0&&Number.isInteger(a.height)&&a.height>0&&(a.width!==k||a.height!==S)){(0,i.warn)("PDFImage - using the Width/Height of the image data, rather than the image dictionary.");k=a.width;S=a.height}if(k<1||S<1)throw new i.FormatError("Invalid image width: "+k+" or height: "+S);this.width=k;this.height=S;this.interpolate=b.get("Interpolate","I")||!1;this.imageMask=b.get("ImageMask","IM")||!1;this.matte=b.get("Matte")||!1;var C=a.bitsPerComponent;if(!C&&!(C=b.get("BitsPerComponent","BPC"))){if(!this.imageMask)throw new i.FormatError("Bits per component missing in image: "+this.imageMask);C=1}this.bpc=C;if(!this.imageMask){var x=b.get("ColorSpace","CS");if(!x){(0,i.info)("JPX images (which do not require color spaces)");switch(a.numComps){case 1:x=n.Name.get("DeviceGray");break;case 3:x=n.Name.get("DeviceRGB");break;case 4:x=n.Name.get("DeviceCMYK");break;default:throw new Error("JPX images with "+a.numComps+" color components not supported.")}}var _=c?r:null;this.colorSpace=o.ColorSpace.parse(x,t,_,v);this.numComps=this.colorSpace.numComps}this.decode=b.getArray("Decode","D");this.needsDecode=!1;if(this.decode&&(this.colorSpace&&!this.colorSpace.isDefaultDecode(this.decode)||p&&!o.ColorSpace.isDefaultDecode(this.decode,1))){this.needsDecode=!0;var A=(1<<C)-1;this.decodeCoefficients=[];this.decodeAddends=[];for(var P=0,I=0;P<this.decode.length;P+=2,++I){var O=this.decode[P],T=this.decode[P+1];this.decodeCoefficients[I]=T-O;this.decodeAddends[I]=A*O}}if(f)this.smask=new u({xref:t,res:r,image:f,isInline:c,pdfFunctionFactory:v});else if(g)if((0,n.isStream)(g)){g.dict.get("ImageMask","IM")?this.mask=new u({xref:t,res:r,image:g,isInline:c,isMask:!0,pdfFunctionFactory:v}):(0,i.warn)("Ignoring /Mask in image without /ImageMask.")}else this.mask=g}u.buildImage=function(t){t.handler;var r,o,s=t.xref,c=t.res,l=t.image,h=t.isInline,f=void 0!==h&&h,d=t.nativeDecoder,g=void 0===d?null:d,m=t.pdfFunctionFactory,p=e(l,g),v=l.dict.get("SMask"),b=l.dict.get("Mask");if(v){r=e(v,g);o=Promise.resolve(null)}else{r=Promise.resolve(null);if(b)if((0,n.isStream)(b))o=e(b,g);else if(Array.isArray(b))o=Promise.resolve(b);else{(0,i.warn)("Unsupported mask format.");o=Promise.resolve(null)}else o=Promise.resolve(null)}return Promise.all([p,r,o]).then(function(e){var t=a(e,3),r=t[0],i=t[1],n=t[2];return new u({xref:s,res:c,image:r,isInline:f,smask:i,mask:n,pdfFunctionFactory:m})})};u.createMask=function(e){var t,r,a=e.imgArray,i=e.width,n=e.height,o=e.imageIsFromDecodeStream,s=e.inverseDecode,c=(i+7>>3)*n,l=a.byteLength;if(!o||s&&!(c===l))if(s){(t=new Uint8ClampedArray(c)).set(a);for(r=l;r<c;r++)t[r]=255}else(t=new Uint8ClampedArray(l)).set(a);else t=a;if(s)for(r=0;r<l;r++)t[r]^=255;return{data:t,width:i,height:n}};u.prototype={get drawWidth(){return Math.max(this.width,this.smask&&this.smask.width||0,this.mask&&this.mask.width||0)},get drawHeight(){return Math.max(this.height,this.smask&&this.smask.height||0,this.mask&&this.mask.height||0)},decodeBuffer:function(e){var r,a,i=this.bpc,n=this.numComps,o=this.decodeAddends,s=this.decodeCoefficients,c=(1<<i)-1;if(1!==i){var l=0;for(r=0,a=this.width*this.height;r<a;r++)for(var u=0;u<n;u++){e[l]=t(e[l],o[u],s[u],c);l++}}else for(r=0,a=e.length;r<a;r++)e[r]=+!e[r]},getComponents:function(e){var t=this.bpc;if(8===t)return e;var r,a,i=this.width,n=this.height,o=this.numComps,s=i*n*o,c=0,l=t<=8?new Uint8Array(s):t<=16?new Uint16Array(s):new Uint32Array(s),u=i*o,h=(1<<t)-1,f=0;if(1===t)for(var d,g,m,p=0;p<n;p++){g=f+(-8&u);m=f+u;for(;f<g;){a=e[c++];l[f]=a>>7&1;l[f+1]=a>>6&1;l[f+2]=a>>5&1;l[f+3]=a>>4&1;l[f+4]=a>>3&1;l[f+5]=a>>2&1;l[f+6]=a>>1&1;l[f+7]=1&a;f+=8}if(f<m){a=e[c++];d=128;for(;f<m;){l[f++]=+!!(a&d);d>>=1}}}else{var v=0;a=0;for(f=0,r=s;f<r;++f){if(f%u==0){a=0;v=0}for(;v<t;){a=a<<8|e[c++];v+=8}var b=v-t,y=a>>b;l[f]=y<0?0:y>h?h:y;a&=(1<<b)-1;v=b}}return l},fillOpacity:function(e,t,a,n,o){var s,c,l,h,f,d,g=this.smask,m=this.mask;if(g){c=g.width;l=g.height;s=new Uint8ClampedArray(c*l);g.fillGrayBuffer(s);c===t&&l===a||(s=r(s,g.bpc,c,l,t,a))}else if(m)if(m instanceof u){c=m.width;l=m.height;s=new Uint8ClampedArray(c*l);m.numComps=1;m.fillGrayBuffer(s);for(h=0,f=c*l;h<f;++h)s[h]=255-s[h];c===t&&l===a||(s=r(s,m.bpc,c,l,t,a))}else{if(!Array.isArray(m))throw new i.FormatError("Unknown mask format.");s=new Uint8ClampedArray(t*a);var p=this.numComps;for(h=0,f=t*a;h<f;++h){var v=0,b=h*p;for(d=0;d<p;++d){var y=o[b+d],w=2*d;if(y<m[w]||y>m[w+1]){v=255;break}}s[h]=v}}if(s)for(h=0,d=3,f=t*n;h<f;++h,d+=4)e[d]=s[h];else for(h=0,d=3,f=t*n;h<f;++h,d+=4)e[d]=255},undoPreblend:function(e,t,r){var a=this.smask&&this.smask.matte;if(a)for(var i=this.colorSpace.getRgb(a,0),n=i[0],o=i[1],s=i[2],c=t*r*4,l=0;l<c;l+=4){var u=e[l+3];if(0!==u){var h=255/u;e[l]=(e[l]-n)*h+n;e[l+1]=(e[l+1]-o)*h+o;e[l+2]=(e[l+2]-s)*h+s}else{e[l]=255;e[l+1]=255;e[l+2]=255}}},createImageData:function(){var e,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=this.drawWidth,a=this.drawHeight,n={width:r,height:a,kind:0,data:null},o=this.numComps,l=this.width,u=this.height,h=this.bpc,f=l*o*h+7>>3;if(!t){var d;"DeviceGray"===this.colorSpace.name&&1===h?d=i.ImageKind.GRAYSCALE_1BPP:"DeviceRGB"!==this.colorSpace.name||8!==h||this.needsDecode||(d=i.ImageKind.RGB_24BPP);if(d&&!this.smask&&!this.mask&&r===l&&a===u){n.kind=d;e=this.getImageBytes(u*f);if(this.image instanceof s.DecodeStream)n.data=e;else{var g=new Uint8ClampedArray(e.length);g.set(e);n.data=g}if(this.needsDecode){(0,i.assert)(d===i.ImageKind.GRAYSCALE_1BPP,"PDFImage.createImageData: The image must be grayscale.");for(var m=n.data,p=0,v=m.length;p<v;p++)m[p]^=255}return n}if(this.image instanceof c.JpegStream&&!this.smask&&!this.mask){var b=u*f;switch(this.colorSpace.name){case"DeviceGray":b*=3;case"DeviceRGB":case"DeviceCMYK":n.kind=i.ImageKind.RGB_24BPP;n.data=this.getImageBytes(b,r,a,!0);return n}}}var y,w,k=0|(e=this.getImageBytes(u*f)).length/f*a/u,S=this.getComponents(e);if(t||this.smask||this.mask){n.kind=i.ImageKind.RGBA_32BPP;n.data=new Uint8ClampedArray(r*a*4);y=1;w=!0;this.fillOpacity(n.data,r,a,k,S)}else{n.kind=i.ImageKind.RGB_24BPP;n.data=new Uint8ClampedArray(r*a*3);y=0;w=!1}this.needsDecode&&this.decodeBuffer(S);this.colorSpace.fillRgb(n.data,l,u,r,a,k,h,S,y);w&&this.undoPreblend(n.data,r,k);return n},fillGrayBuffer:function(e){var t=this.numComps;if(1!==t)throw new i.FormatError("Reading gray scale from a color image: "+t);var r,a,n=this.width,o=this.height,s=this.bpc,c=n*t*s+7>>3,l=this.getImageBytes(o*c),u=this.getComponents(l);if(1!==s){this.needsDecode&&this.decodeBuffer(u);a=n*o;var h=255/((1<<s)-1);for(r=0;r<a;++r)e[r]=h*u[r]}else{a=n*o;if(this.needsDecode)for(r=0;r<a;++r)e[r]=u[r]-1&255;else for(r=0;r<a;++r)e[r]=255&-u[r]}},getImageBytes:function(e,t,r){var a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.image.reset();this.image.drawWidth=t||this.width;this.image.drawHeight=r||this.height;this.image.forceRGB=!!a;return this.image.getBytes(e,!0)}};return u}();t.PDFImage=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.MessageHandler=void 0;var a,i,n,o=r(131),s=(a=o)&&a.__esModule?a:{default:a},c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l=(n=(i=s.default.mark(function e(t,r){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return");case 2:return e.abrupt("return",t.apply(a,r));case 3:case"end":return e.stop()}},e,this)}),function(){var e=i.apply(this,arguments);return new Promise(function(t,r){return function a(i,n){try{var o=e[i](n),s=o.value}catch(e){r(e);return}if(!o.done)return Promise.resolve(s).then(function(e){a("next",e)},function(e){a("throw",e)});t(s)}("next")})}),function(e,t){return n.apply(this,arguments)}),u=r(2);function h(e){if("object"!==(void 0===e?"undefined":c(e)))return e;switch(e.name){case"AbortException":return new u.AbortException(e.message);case"MissingPDFException":return new u.MissingPDFException(e.message);case"UnexpectedResponseException":return new u.UnexpectedResponseException(e.message,e.status);default:return new u.UnknownErrorException(e.message,e.details)}}function f(e,t,r){t?e.resolve():e.reject(r)}function d(e,t,r){var a=this;this.sourceName=e;this.targetName=t;this.comObj=r;this.callbackId=1;this.streamId=1;this.postMessageTransfers=!0;this.streamSinks=Object.create(null);this.streamControllers=Object.create(null);var i=this.callbacksCapabilities=Object.create(null),n=this.actionHandler=Object.create(null);this._onComObjOnMessage=function(e){var t=e.data;if(t.targetName===a.sourceName)if(t.stream)a._processStreamMessage(t);else if(t.isReply){var o=t.callbackId;if(!(t.callbackId in i))throw new Error("Cannot resolve callback "+o);var s=i[o];delete i[o];"error"in t?s.reject(h(t.error)):s.resolve(t.data)}else{if(!(t.action in n))throw new Error("Unknown action from worker: "+t.action);var c=n[t.action];if(t.callbackId){var l=a.sourceName,f=t.sourceName;Promise.resolve().then(function(){return c[0].call(c[1],t.data)}).then(function(e){r.postMessage({sourceName:l,targetName:f,isReply:!0,callbackId:t.callbackId,data:e})},function(e){r.postMessage({sourceName:l,targetName:f,isReply:!0,callbackId:t.callbackId,error:function(e){return!(e instanceof Error)||e instanceof u.AbortException||e instanceof u.MissingPDFException||e instanceof u.UnexpectedResponseException||e instanceof u.UnknownErrorException?e:new u.UnknownErrorException(e.message,e.toString())}(e)})})}else t.streamId?a._createStreamSink(t):c[0].call(c[1],t.data)}};r.addEventListener("message",this._onComObjOnMessage)}d.prototype={on:function(e,t,r){var a=this.actionHandler;if(a[e])throw new Error('There is already an actionName called "'+e+'"');a[e]=[t,r]},send:function(e,t,r){var a={sourceName:this.sourceName,targetName:this.targetName,action:e,data:t};this.postMessage(a,r)},sendWithPromise:function(e,t,r){var a=this.callbackId++,i={sourceName:this.sourceName,targetName:this.targetName,action:e,data:t,callbackId:a},n=(0,u.createPromiseCapability)();this.callbacksCapabilities[a]=n;try{this.postMessage(i,r)}catch(e){n.reject(e)}return n.promise},sendWithStream:function(e,t,r,a){var i=this,n=this.streamId++,o=this.sourceName,s=this.targetName;return new u.ReadableStream({start:function(r){var a=(0,u.createPromiseCapability)();i.streamControllers[n]={controller:r,startCall:a,isClosed:!1};i.postMessage({sourceName:o,targetName:s,action:e,streamId:n,data:t,desiredSize:r.desiredSize});return a.promise},pull:function(e){var t=(0,u.createPromiseCapability)();i.streamControllers[n].pullCall=t;i.postMessage({sourceName:o,targetName:s,stream:"pull",streamId:n,desiredSize:e.desiredSize});return t.promise},cancel:function(e){var t=(0,u.createPromiseCapability)();i.streamControllers[n].cancelCall=t;i.streamControllers[n].isClosed=!0;i.postMessage({sourceName:o,targetName:s,stream:"cancel",reason:e,streamId:n});return t.promise}},r)},_createStreamSink:function(e){var t=this,r=this,a=this.actionHandler[e.action],i=e.streamId,n=e.desiredSize,o=this.sourceName,s=e.sourceName,c=function(e){var r=e.stream,a=e.chunk,n=e.transfers,c=e.success,l=e.reason;t.postMessage({sourceName:o,targetName:s,stream:r,streamId:i,chunk:a,success:c,reason:l},n)},h={enqueue:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments[2];if(!this.isCancelled){var a=this.desiredSize;this.desiredSize-=t;if(a>0&&this.desiredSize<=0){this.sinkCapability=(0,u.createPromiseCapability)();this.ready=this.sinkCapability.promise}c({stream:"enqueue",chunk:e,transfers:r})}},close:function(){if(!this.isCancelled){this.isCancelled=!0;c({stream:"close"});delete r.streamSinks[i]}},error:function(e){if(!this.isCancelled){this.isCancelled=!0;c({stream:"error",reason:e})}},sinkCapability:(0,u.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:n,ready:null};h.sinkCapability.resolve();h.ready=h.sinkCapability.promise;this.streamSinks[i]=h;l(a[0],[e.data,h],a[1]).then(function(){c({stream:"start_complete",success:!0})},function(e){c({stream:"start_complete",success:!1,reason:e})})},_processStreamMessage:function(e){var t=this,r=this.sourceName,a=e.sourceName,i=e.streamId,n=function(e){var n=e.stream,o=e.success,s=e.reason;t.comObj.postMessage({sourceName:r,targetName:a,stream:n,success:o,streamId:i,reason:s})},o=function(){Promise.all([t.streamControllers[e.streamId].startCall,t.streamControllers[e.streamId].pullCall,t.streamControllers[e.streamId].cancelCall].map(function(e){return e&&(t=e.promise,Promise.resolve(t).catch(function(){}));var t})).then(function(){delete t.streamControllers[e.streamId]})};switch(e.stream){case"start_complete":f(this.streamControllers[e.streamId].startCall,e.success,h(e.reason));break;case"pull_complete":f(this.streamControllers[e.streamId].pullCall,e.success,h(e.reason));break;case"pull":if(!this.streamSinks[e.streamId]){n({stream:"pull_complete",success:!0});break}this.streamSinks[e.streamId].desiredSize<=0&&e.desiredSize>0&&this.streamSinks[e.streamId].sinkCapability.resolve();this.streamSinks[e.streamId].desiredSize=e.desiredSize;l(this.streamSinks[e.streamId].onPull).then(function(){n({stream:"pull_complete",success:!0})},function(e){n({stream:"pull_complete",success:!1,reason:e})});break;case"enqueue":(0,u.assert)(this.streamControllers[e.streamId],"enqueue should have stream controller");this.streamControllers[e.streamId].isClosed||this.streamControllers[e.streamId].controller.enqueue(e.chunk);break;case"close":(0,u.assert)(this.streamControllers[e.streamId],"close should have stream controller");if(this.streamControllers[e.streamId].isClosed)break;this.streamControllers[e.streamId].isClosed=!0;this.streamControllers[e.streamId].controller.close();o();break;case"error":(0,u.assert)(this.streamControllers[e.streamId],"error should have stream controller");this.streamControllers[e.streamId].controller.error(h(e.reason));o();break;case"cancel_complete":f(this.streamControllers[e.streamId].cancelCall,e.success,h(e.reason));o();break;case"cancel":if(!this.streamSinks[e.streamId])break;l(this.streamSinks[e.streamId].onCancel,[h(e.reason)]).then(function(){n({stream:"cancel_complete",success:!0})},function(e){n({stream:"cancel_complete",success:!1,reason:e})});this.streamSinks[e.streamId].sinkCapability.reject(h(e.reason));this.streamSinks[e.streamId].isCancelled=!0;delete this.streamSinks[e.streamId];break;default:throw new Error("Unexpected stream case")}},postMessage:function(e,t){t&&this.postMessageTransfers?this.comObj.postMessage(e,t):this.comObj.postMessage(e)},destroy:function(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}};t.MessageHandler=d}])}); \ No newline at end of file
diff --git a/vendor/jupyter/values.yaml b/vendor/jupyter/values.yaml
index 781d6e3042f..a5e13fdc104 100644
--- a/vendor/jupyter/values.yaml
+++ b/vendor/jupyter/values.yaml
@@ -8,8 +8,28 @@ hub:
extraConfig: |
c.KubeSpawner.cmd = ['jupyter-labhub']
+ async def add_auth_env(spawner):
+ '''
+ We set user's id, login and access token on single user image to
+ enable repository integration for JupyterHub.
+ See: https://gitlab.com/gitlab-org/gitlab-ce/issues/47138#note_154294790
+ '''
+ auth_state = await spawner.user.get_auth_state()
+
+ if not auth_state:
+ spawner.log.warning("No auth state for %s", spawner.user)
+ return
+
+ spawner.environment['GITLAB_ACCESS_TOKEN'] = auth_state['access_token']
+ spawner.environment['GITLAB_USER_LOGIN'] = auth_state['gitlab_user']['username']
+ spawner.environment['GITLAB_USER_ID'] = str(auth_state['gitlab_user']['id'])
+
+ c.KubeSpawner.pre_spawn_hook = add_auth_env
+
auth:
type: gitlab
+ state:
+ enabled: true
singleuser:
defaultUrl: "/lab"
diff --git a/yarn.lock b/yarn.lock
index 42b6fc642c4..80178b04ba8 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -9,18 +9,18 @@
dependencies:
"@babel/highlight" "^7.0.0"
-"@babel/core@>=7.1.0", "@babel/core@^7.1.0", "@babel/core@^7.2.2":
- version "7.3.4"
- resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.3.4.tgz#921a5a13746c21e32445bf0798680e9d11a6530b"
- integrity sha512-jRsuseXBo9pN197KnDwhhaaBzyZr2oIcLHHTt2oDdQrej5Qp57dCCJafWx5ivU8/alEYDpssYqv1MUqcxwQlrA==
+"@babel/core@>=7.1.0", "@babel/core@^7.1.0", "@babel/core@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.4.4.tgz#84055750b05fcd50f9915a826b44fa347a825250"
+ integrity sha512-lQgGX3FPRgbz2SKmhMtYgJvVzGZrmjaF4apZ2bLwofAKiSjxU0drPh4S/VasyYXwaTs+A1gvQ45BN8SQJzHsQQ==
dependencies:
"@babel/code-frame" "^7.0.0"
- "@babel/generator" "^7.3.4"
- "@babel/helpers" "^7.2.0"
- "@babel/parser" "^7.3.4"
- "@babel/template" "^7.2.2"
- "@babel/traverse" "^7.3.4"
- "@babel/types" "^7.3.4"
+ "@babel/generator" "^7.4.4"
+ "@babel/helpers" "^7.4.4"
+ "@babel/parser" "^7.4.4"
+ "@babel/template" "^7.4.4"
+ "@babel/traverse" "^7.4.4"
+ "@babel/types" "^7.4.4"
convert-source-map "^1.1.0"
debug "^4.1.0"
json5 "^2.1.0"
@@ -29,12 +29,12 @@
semver "^5.4.1"
source-map "^0.5.0"
-"@babel/generator@^7.0.0", "@babel/generator@^7.3.4":
- version "7.3.4"
- resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.3.4.tgz#9aa48c1989257877a9d971296e5b73bfe72e446e"
- integrity sha512-8EXhHRFqlVVWXPezBW5keTiQi/rJMQTg/Y9uVCEZ0CAF3PKtCCaVRnp64Ii1ujhkoDhhF1fVsImoN4yJ2uz4Wg==
+"@babel/generator@^7.0.0", "@babel/generator@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.4.4.tgz#174a215eb843fc392c7edcaabeaa873de6e8f041"
+ integrity sha512-53UOLK6TVNqKxf7RUh8NE851EHRxOOeVXKbK2bivdb+iziMyk03Sr4eaE9OELCbyZAAafAKPDwF2TPUES5QbxQ==
dependencies:
- "@babel/types" "^7.3.4"
+ "@babel/types" "^7.4.4"
jsesc "^2.5.1"
lodash "^4.17.11"
source-map "^0.5.0"
@@ -55,34 +55,35 @@
"@babel/helper-explode-assignable-expression" "^7.1.0"
"@babel/types" "^7.0.0"
-"@babel/helper-call-delegate@^7.1.0":
- version "7.1.0"
- resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.1.0.tgz#6a957f105f37755e8645343d3038a22e1449cc4a"
- integrity sha512-YEtYZrw3GUK6emQHKthltKNZwszBcHK58Ygcis+gVUrF4/FmTVr5CCqQNSfmvg2y+YDEANyYoaLz/SHsnusCwQ==
+"@babel/helper-call-delegate@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.4.4.tgz#87c1f8ca19ad552a736a7a27b1c1fcf8b1ff1f43"
+ integrity sha512-l79boDFJ8S1c5hvQvG+rc+wHw6IuH7YldmRKsYtpbawsxURu/paVy57FZMomGK22/JckepaikOkY0MoAmdyOlQ==
dependencies:
- "@babel/helper-hoist-variables" "^7.0.0"
- "@babel/traverse" "^7.1.0"
- "@babel/types" "^7.0.0"
+ "@babel/helper-hoist-variables" "^7.4.4"
+ "@babel/traverse" "^7.4.4"
+ "@babel/types" "^7.4.4"
-"@babel/helper-create-class-features-plugin@^7.3.0":
- version "7.3.0"
- resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.3.0.tgz#2b01a81b3adc2b1287f9ee193688ef8dc71e718f"
- integrity sha512-DUsQNS2CGLZZ7I3W3fvh0YpPDd6BuWJlDl+qmZZpABZHza2ErE3LxtEzLJFHFC1ZwtlAXvHhbFYbtM5o5B0WBw==
+"@babel/helper-create-class-features-plugin@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.4.4.tgz#fc3d690af6554cc9efc607364a82d48f58736dba"
+ integrity sha512-UbBHIa2qeAGgyiNR9RszVF7bUHEdgS4JAUNT8SiqrAN6YJVxlOxeLr5pBzb5kan302dejJ9nla4RyKcR1XT6XA==
dependencies:
"@babel/helper-function-name" "^7.1.0"
"@babel/helper-member-expression-to-functions" "^7.0.0"
"@babel/helper-optimise-call-expression" "^7.0.0"
"@babel/helper-plugin-utils" "^7.0.0"
- "@babel/helper-replace-supers" "^7.2.3"
+ "@babel/helper-replace-supers" "^7.4.4"
+ "@babel/helper-split-export-declaration" "^7.4.4"
-"@babel/helper-define-map@^7.1.0":
- version "7.1.0"
- resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.1.0.tgz#3b74caec329b3c80c116290887c0dd9ae468c20c"
- integrity sha512-yPPcW8dc3gZLN+U1mhYV91QU3n5uTbx7DUdf8NnPbjS0RMwBuHi9Xt2MUgppmNz7CJxTBWsGczTiEp1CSOTPRg==
+"@babel/helper-define-map@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.4.4.tgz#6969d1f570b46bdc900d1eba8e5d59c48ba2c12a"
+ integrity sha512-IX3Ln8gLhZpSuqHJSnTNBWGDE9kdkTEWl21A/K7PQ00tseBwbqCHTvNLHSBd9M0R5rER4h5Rsvj9vw0R5SieBg==
dependencies:
"@babel/helper-function-name" "^7.1.0"
- "@babel/types" "^7.0.0"
- lodash "^4.17.10"
+ "@babel/types" "^7.4.4"
+ lodash "^4.17.11"
"@babel/helper-explode-assignable-expression@^7.1.0":
version "7.1.0"
@@ -108,12 +109,12 @@
dependencies:
"@babel/types" "^7.0.0"
-"@babel/helper-hoist-variables@^7.0.0":
- version "7.0.0"
- resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.0.0.tgz#46adc4c5e758645ae7a45deb92bab0918c23bb88"
- integrity sha512-Ggv5sldXUeSKsuzLkddtyhyHe2YantsxWKNi7A+7LeD12ExRDWTRk29JCXpaHPAbMaIPZSil7n+lq78WY2VY7w==
+"@babel/helper-hoist-variables@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.4.4.tgz#0298b5f25c8c09c53102d52ac4a98f773eb2850a"
+ integrity sha512-VYk2/H/BnYbZDDg39hr3t2kKyifAm1W6zHRfhx8jGjIHpQEBv9dry7oQ2f3+J703TLu69nYdxsovl0XYfcnK4w==
dependencies:
- "@babel/types" "^7.0.0"
+ "@babel/types" "^7.4.4"
"@babel/helper-member-expression-to-functions@^7.0.0":
version "7.0.0"
@@ -129,17 +130,17 @@
dependencies:
"@babel/types" "^7.0.0"
-"@babel/helper-module-transforms@^7.1.0":
- version "7.1.0"
- resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.1.0.tgz#470d4f9676d9fad50b324cdcce5fbabbc3da5787"
- integrity sha512-0JZRd2yhawo79Rcm4w0LwSMILFmFXjugG3yqf+P/UsKsRS1mJCmMwwlHDlMg7Avr9LrvSpp4ZSULO9r8jpCzcw==
+"@babel/helper-module-transforms@^7.1.0", "@babel/helper-module-transforms@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.4.4.tgz#96115ea42a2f139e619e98ed46df6019b94414b8"
+ integrity sha512-3Z1yp8TVQf+B4ynN7WoHPKS8EkdTbgAEy0nU0rs/1Kw4pDgmvYH3rz3aI11KgxKCba2cn7N+tqzV1mY2HMN96w==
dependencies:
"@babel/helper-module-imports" "^7.0.0"
"@babel/helper-simple-access" "^7.1.0"
- "@babel/helper-split-export-declaration" "^7.0.0"
- "@babel/template" "^7.1.0"
- "@babel/types" "^7.0.0"
- lodash "^4.17.10"
+ "@babel/helper-split-export-declaration" "^7.4.4"
+ "@babel/template" "^7.4.4"
+ "@babel/types" "^7.4.4"
+ lodash "^4.17.11"
"@babel/helper-optimise-call-expression@^7.0.0":
version "7.0.0"
@@ -153,12 +154,12 @@
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz#bbb3fbee98661c569034237cc03967ba99b4f250"
integrity sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA==
-"@babel/helper-regex@^7.0.0":
- version "7.0.0"
- resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.0.0.tgz#2c1718923b57f9bbe64705ffe5640ac64d9bdb27"
- integrity sha512-TR0/N0NDCcUIUEbqV6dCO+LptmmSQFQ7q70lfcEB4URsjD0E1HzicrwUH+ap6BAQ2jhCX9Q4UqZy4wilujWlkg==
+"@babel/helper-regex@^7.0.0", "@babel/helper-regex@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.4.4.tgz#a47e02bc91fb259d2e6727c2a30013e3ac13c4a2"
+ integrity sha512-Y5nuB/kESmR3tKjU8Nkn1wMGEx1tjJX076HBMeL3XLQCu6vA/YRzuTW0bbb+qRnXvQGn+d6Rx953yffl8vEy7Q==
dependencies:
- lodash "^4.17.10"
+ lodash "^4.17.11"
"@babel/helper-remap-async-to-generator@^7.1.0":
version "7.1.0"
@@ -171,15 +172,15 @@
"@babel/traverse" "^7.1.0"
"@babel/types" "^7.0.0"
-"@babel/helper-replace-supers@^7.1.0", "@babel/helper-replace-supers@^7.2.3":
- version "7.2.3"
- resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.2.3.tgz#19970020cf22677d62b3a689561dbd9644d8c5e5"
- integrity sha512-GyieIznGUfPXPWu0yLS6U55Mz67AZD9cUk0BfirOWlPrXlBcan9Gz+vHGz+cPfuoweZSnPzPIm67VtQM0OWZbA==
+"@babel/helper-replace-supers@^7.1.0", "@babel/helper-replace-supers@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.4.4.tgz#aee41783ebe4f2d3ab3ae775e1cc6f1a90cefa27"
+ integrity sha512-04xGEnd+s01nY1l15EuMS1rfKktNF+1CkKmHoErDppjAAZL+IUBZpzT748x262HF7fibaQPhbvWUl5HeSt1EXg==
dependencies:
"@babel/helper-member-expression-to-functions" "^7.0.0"
"@babel/helper-optimise-call-expression" "^7.0.0"
- "@babel/traverse" "^7.2.3"
- "@babel/types" "^7.0.0"
+ "@babel/traverse" "^7.4.4"
+ "@babel/types" "^7.4.4"
"@babel/helper-simple-access@^7.1.0":
version "7.1.0"
@@ -189,12 +190,12 @@
"@babel/template" "^7.1.0"
"@babel/types" "^7.0.0"
-"@babel/helper-split-export-declaration@^7.0.0":
- version "7.0.0"
- resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0.tgz#3aae285c0311c2ab095d997b8c9a94cad547d813"
- integrity sha512-MXkOJqva62dfC0w85mEf/LucPPS/1+04nmmRMPEBUB++hiiThQ2zPtX/mEWQ3mtzCEjIJvPY8nuwxXtQeQwUag==
+"@babel/helper-split-export-declaration@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz#ff94894a340be78f53f06af038b205c49d993677"
+ integrity sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q==
dependencies:
- "@babel/types" "^7.0.0"
+ "@babel/types" "^7.4.4"
"@babel/helper-wrap-function@^7.1.0":
version "7.1.0"
@@ -206,14 +207,14 @@
"@babel/traverse" "^7.1.0"
"@babel/types" "^7.0.0"
-"@babel/helpers@^7.2.0":
- version "7.2.0"
- resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.2.0.tgz#8335f3140f3144270dc63c4732a4f8b0a50b7a21"
- integrity sha512-Fr07N+ea0dMcMN8nFpuK6dUIT7/ivt9yKQdEEnjVS83tG2pHwPi03gYmk/tyuwONnZ+sY+GFFPlWGgCtW1hF9A==
+"@babel/helpers@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.4.4.tgz#868b0ef59c1dd4e78744562d5ce1b59c89f2f2a5"
+ integrity sha512-igczbR/0SeuPR8RFfC7tGrbdTbFL3QTvH6D+Z6zNxnTe//GyqmtHmDkzrqDmyZ3eSwPqB/LhyKoU5DXsp+Vp2A==
dependencies:
- "@babel/template" "^7.1.2"
- "@babel/traverse" "^7.1.5"
- "@babel/types" "^7.2.0"
+ "@babel/template" "^7.4.4"
+ "@babel/traverse" "^7.4.4"
+ "@babel/types" "^7.4.4"
"@babel/highlight@^7.0.0":
version "7.0.0"
@@ -224,10 +225,10 @@
esutils "^2.0.2"
js-tokens "^4.0.0"
-"@babel/parser@^7.0.0", "@babel/parser@^7.2.2", "@babel/parser@^7.3.4":
- version "7.3.4"
- resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.3.4.tgz#a43357e4bbf4b92a437fb9e465c192848287f27c"
- integrity sha512-tXZCqWtlOOP4wgCp6RjRvLmfuhnqTLy9VHwRochJBCP2nDm27JnnuFEnXFASVyQNHk36jD1tAammsCEEqgscIQ==
+"@babel/parser@^7.0.0", "@babel/parser@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.4.4.tgz#5977129431b8fe33471730d255ce8654ae1250b6"
+ integrity sha512-5pCS4mOsL+ANsFZGdvNLybx4wtqAZJ0MJjMHxvzI3bvIsz6sQvzW8XX92EYIkiPtIvcfG3Aj+Ir5VNyjnZhP7w==
"@babel/plugin-proposal-async-generator-functions@^7.2.0":
version "7.2.0"
@@ -238,12 +239,12 @@
"@babel/helper-remap-async-to-generator" "^7.1.0"
"@babel/plugin-syntax-async-generators" "^7.2.0"
-"@babel/plugin-proposal-class-properties@^7.3.0":
- version "7.3.0"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.3.0.tgz#272636bc0fa19a0bc46e601ec78136a173ea36cd"
- integrity sha512-wNHxLkEKTQ2ay0tnsam2z7fGZUi+05ziDJflEt3AZTP3oXLKHJp9HqhfroB/vdMvt3sda9fAbq7FsG8QPDrZBg==
+"@babel/plugin-proposal-class-properties@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.4.4.tgz#93a6486eed86d53452ab9bab35e368e9461198ce"
+ integrity sha512-WjKTI8g8d5w1Bc9zgwSz2nfrsNQsXcCf9J9cdCvrJV6RF56yztwm4TmJC0MgJ9tvwO9gUA/mcYe89bLdGfiXFg==
dependencies:
- "@babel/helper-create-class-features-plugin" "^7.3.0"
+ "@babel/helper-create-class-features-plugin" "^7.4.4"
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-proposal-json-strings@^7.2.0":
@@ -254,10 +255,10 @@
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-syntax-json-strings" "^7.2.0"
-"@babel/plugin-proposal-object-rest-spread@^7.3.1":
- version "7.3.1"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.3.1.tgz#f69fb6a1ea6a4e1c503994a91d9cf76f3c4b36e8"
- integrity sha512-Nmmv1+3LqxJu/V5jU9vJmxR/KIRWFk2qLHmbB56yRRRFhlaSuOVXscX3gUmhaKgUhzA3otOHVubbIEVYsZ0eZg==
+"@babel/plugin-proposal-object-rest-spread@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.4.4.tgz#1ef173fcf24b3e2df92a678f027673b55e7e3005"
+ integrity sha512-dMBG6cSPBbHeEBdFXeQ2QLc5gUpg4Vkaz8octD4aoW/ISO+jBOcsuxYL7bsb5WSu8RLP6boxrBIALEHgoHtO9g==
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-syntax-object-rest-spread" "^7.2.0"
@@ -270,22 +271,22 @@
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-syntax-optional-catch-binding" "^7.2.0"
-"@babel/plugin-proposal-private-methods@^7.3.0":
- version "7.3.0"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.3.0.tgz#da373257a66525cb76544c37ab2ce4c611568841"
- integrity sha512-j6luy/F0MX6kd71e9hz97my2tBXTa+czAz+sscJVCRmjB9e9g2D4JN+tyfcwMCXUM2afj/tYCjzNaxwWJ4SdYg==
+"@babel/plugin-proposal-private-methods@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.4.4.tgz#307b7db29d8ae2d259e7c0e6e665b1922d7ac856"
+ integrity sha512-EIV4fDVP3XwdizJ/H6308Km+d8xdLAUCAvsY8mjxhat9I3vNgssGhZuhgn/jw7IK5/91sN8PHtVGxMjeTSrSng==
dependencies:
- "@babel/helper-create-class-features-plugin" "^7.3.0"
+ "@babel/helper-create-class-features-plugin" "^7.4.4"
"@babel/helper-plugin-utils" "^7.0.0"
-"@babel/plugin-proposal-unicode-property-regex@^7.2.0":
- version "7.2.0"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.2.0.tgz#abe7281fe46c95ddc143a65e5358647792039520"
- integrity sha512-LvRVYb7kikuOtIoUeWTkOxQEV1kYvL5B6U3iWEGCzPNRus1MzJweFqORTj+0jkxozkTSYNJozPOddxmqdqsRpw==
+"@babel/plugin-proposal-unicode-property-regex@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.4.4.tgz#501ffd9826c0b91da22690720722ac7cb1ca9c78"
+ integrity sha512-j1NwnOqMG9mFUOH58JTFsA/+ZYzQLUZ/drqWUqxCYLGeu2JFZL8YrNC9hBxKmWtAuOCHPcRpgv7fhap09Fb4kA==
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
- "@babel/helper-regex" "^7.0.0"
- regexpu-core "^4.2.0"
+ "@babel/helper-regex" "^7.4.4"
+ regexpu-core "^4.5.4"
"@babel/plugin-syntax-async-generators@^7.2.0":
version "7.2.0"
@@ -336,10 +337,10 @@
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
-"@babel/plugin-transform-async-to-generator@^7.2.0":
- version "7.2.0"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.2.0.tgz#68b8a438663e88519e65b776f8938f3445b1a2ff"
- integrity sha512-CEHzg4g5UraReozI9D4fblBYABs7IM6UerAVG7EJVrTLC5keh00aEuLUT+O40+mJCEzaXkYfTCUKIyeDfMOFFQ==
+"@babel/plugin-transform-async-to-generator@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.4.4.tgz#a3f1d01f2f21cadab20b33a82133116f14fb5894"
+ integrity sha512-YiqW2Li8TXmzgbXw+STsSqPBPFnGviiaSp6CYOq55X8GQ2SGVLrXB6pNid8HkqkZAzOH6knbai3snhP7v0fNwA==
dependencies:
"@babel/helper-module-imports" "^7.0.0"
"@babel/helper-plugin-utils" "^7.0.0"
@@ -352,26 +353,26 @@
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
-"@babel/plugin-transform-block-scoping@^7.2.0":
- version "7.2.0"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.2.0.tgz#f17c49d91eedbcdf5dd50597d16f5f2f770132d4"
- integrity sha512-vDTgf19ZEV6mx35yiPJe4fS02mPQUUcBNwWQSZFXSzTSbsJFQvHt7DqyS3LK8oOWALFOsJ+8bbqBgkirZteD5Q==
+"@babel/plugin-transform-block-scoping@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.4.4.tgz#c13279fabf6b916661531841a23c4b7dae29646d"
+ integrity sha512-jkTUyWZcTrwxu5DD4rWz6rDB5Cjdmgz6z7M7RLXOJyCUkFBawssDGcGh8M/0FTSB87avyJI1HsTwUXp9nKA1PA==
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
- lodash "^4.17.10"
+ lodash "^4.17.11"
-"@babel/plugin-transform-classes@^7.2.0":
- version "7.2.2"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.2.2.tgz#6c90542f210ee975aa2aa8c8b5af7fa73a126953"
- integrity sha512-gEZvgTy1VtcDOaQty1l10T3jQmJKlNVxLDCs+3rCVPr6nMkODLELxViq5X9l+rfxbie3XrfrMCYYY6eX3aOcOQ==
+"@babel/plugin-transform-classes@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.4.4.tgz#0ce4094cdafd709721076d3b9c38ad31ca715eb6"
+ integrity sha512-/e44eFLImEGIpL9qPxSRat13I5QNRgBLu2hOQJCF7VLy/otSM/sypV1+XaIw5+502RX/+6YaSAPmldk+nhHDPw==
dependencies:
"@babel/helper-annotate-as-pure" "^7.0.0"
- "@babel/helper-define-map" "^7.1.0"
+ "@babel/helper-define-map" "^7.4.4"
"@babel/helper-function-name" "^7.1.0"
"@babel/helper-optimise-call-expression" "^7.0.0"
"@babel/helper-plugin-utils" "^7.0.0"
- "@babel/helper-replace-supers" "^7.1.0"
- "@babel/helper-split-export-declaration" "^7.0.0"
+ "@babel/helper-replace-supers" "^7.4.4"
+ "@babel/helper-split-export-declaration" "^7.4.4"
globals "^11.1.0"
"@babel/plugin-transform-computed-properties@^7.2.0":
@@ -381,21 +382,21 @@
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
-"@babel/plugin-transform-destructuring@^7.2.0":
- version "7.2.0"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.2.0.tgz#e75269b4b7889ec3a332cd0d0c8cff8fed0dc6f3"
- integrity sha512-coVO2Ayv7g0qdDbrNiadE4bU7lvCd9H539m2gMknyVjjMdwF/iCOM7R+E8PkntoqLkltO0rk+3axhpp/0v68VQ==
+"@babel/plugin-transform-destructuring@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.4.4.tgz#9d964717829cc9e4b601fc82a26a71a4d8faf20f"
+ integrity sha512-/aOx+nW0w8eHiEHm+BTERB2oJn5D127iye/SUQl7NjHy0lf+j7h4MKMMSOwdazGq9OxgiNADncE+SRJkCxjZpQ==
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
-"@babel/plugin-transform-dotall-regex@^7.2.0":
- version "7.2.0"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.2.0.tgz#f0aabb93d120a8ac61e925ea0ba440812dbe0e49"
- integrity sha512-sKxnyHfizweTgKZf7XsXu/CNupKhzijptfTM+bozonIuyVrLWVUvYjE2bhuSBML8VQeMxq4Mm63Q9qvcvUcciQ==
+"@babel/plugin-transform-dotall-regex@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.4.4.tgz#361a148bc951444312c69446d76ed1ea8e4450c3"
+ integrity sha512-P05YEhRc2h53lZDjRPk/OektxCVevFzZs2Gfjd545Wde3k+yFDbXORgl2e0xpbq8mLcKJ7Idss4fAg0zORN/zg==
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
- "@babel/helper-regex" "^7.0.0"
- regexpu-core "^4.1.3"
+ "@babel/helper-regex" "^7.4.4"
+ regexpu-core "^4.5.4"
"@babel/plugin-transform-duplicate-keys@^7.2.0":
version "7.2.0"
@@ -412,17 +413,17 @@
"@babel/helper-builder-binary-assignment-operator-visitor" "^7.1.0"
"@babel/helper-plugin-utils" "^7.0.0"
-"@babel/plugin-transform-for-of@^7.2.0":
- version "7.2.0"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.2.0.tgz#ab7468befa80f764bb03d3cb5eef8cc998e1cad9"
- integrity sha512-Kz7Mt0SsV2tQk6jG5bBv5phVbkd0gd27SgYD4hH1aLMJRchM0dzHaXvrWhVZ+WxAlDoAKZ7Uy3jVTW2mKXQ1WQ==
+"@babel/plugin-transform-for-of@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.4.4.tgz#0267fc735e24c808ba173866c6c4d1440fc3c556"
+ integrity sha512-9T/5Dlr14Z9TIEXLXkt8T1DU7F24cbhwhMNUziN3hB1AXoZcdzPcTiKGRn/6iOymDqtTKWnr/BtRKN9JwbKtdQ==
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
-"@babel/plugin-transform-function-name@^7.2.0":
- version "7.2.0"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.2.0.tgz#f7930362829ff99a3174c39f0afcc024ef59731a"
- integrity sha512-kWgksow9lHdvBC2Z4mxTsvc7YdY7w/V6B2vy9cTIPtLEE9NhwoWivaxdNM/S37elu5bqlLP/qOY906LukO9lkQ==
+"@babel/plugin-transform-function-name@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.4.4.tgz#e1436116abb0610c2259094848754ac5230922ad"
+ integrity sha512-iU9pv7U+2jC9ANQkKeNF6DrPy4GBa4NWQtl6dHB4Pb3izX2JOEvDTFarlNsBj/63ZEzNNIAMs3Qw4fNCcSOXJA==
dependencies:
"@babel/helper-function-name" "^7.1.0"
"@babel/helper-plugin-utils" "^7.0.0"
@@ -434,6 +435,13 @@
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
+"@babel/plugin-transform-member-expression-literals@^7.2.0":
+ version "7.2.0"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.2.0.tgz#fa10aa5c58a2cb6afcf2c9ffa8cb4d8b3d489a2d"
+ integrity sha512-HiU3zKkSU6scTidmnFJ0bMX8hz5ixC93b4MHMiYebmk2lUVNGOboPsqQvx5LzooihijUoLR/v7Nc1rbBtnc7FA==
+ dependencies:
+ "@babel/helper-plugin-utils" "^7.0.0"
+
"@babel/plugin-transform-modules-amd@^7.2.0":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.2.0.tgz#82a9bce45b95441f617a24011dc89d12da7f4ee6"
@@ -442,21 +450,21 @@
"@babel/helper-module-transforms" "^7.1.0"
"@babel/helper-plugin-utils" "^7.0.0"
-"@babel/plugin-transform-modules-commonjs@^7.2.0":
- version "7.2.0"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.2.0.tgz#c4f1933f5991d5145e9cfad1dfd848ea1727f404"
- integrity sha512-V6y0uaUQrQPXUrmj+hgnks8va2L0zcZymeU7TtWEgdRLNkceafKXEduv7QzgQAE4lT+suwooG9dC7LFhdRAbVQ==
+"@babel/plugin-transform-modules-commonjs@^7.2.0", "@babel/plugin-transform-modules-commonjs@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.4.4.tgz#0bef4713d30f1d78c2e59b3d6db40e60192cac1e"
+ integrity sha512-4sfBOJt58sEo9a2BQXnZq+Q3ZTSAUXyK3E30o36BOGnJ+tvJ6YSxF0PG6kERvbeISgProodWuI9UVG3/FMY6iw==
dependencies:
- "@babel/helper-module-transforms" "^7.1.0"
+ "@babel/helper-module-transforms" "^7.4.4"
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/helper-simple-access" "^7.1.0"
-"@babel/plugin-transform-modules-systemjs@^7.2.0":
- version "7.2.0"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.2.0.tgz#912bfe9e5ff982924c81d0937c92d24994bb9068"
- integrity sha512-aYJwpAhoK9a+1+O625WIjvMY11wkB/ok0WClVwmeo3mCjcNRjt+/8gHWrB5i+00mUju0gWsBkQnPpdvQ7PImmQ==
+"@babel/plugin-transform-modules-systemjs@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.4.4.tgz#dc83c5665b07d6c2a7b224c00ac63659ea36a405"
+ integrity sha512-MSiModfILQc3/oqnG7NrP1jHaSPryO6tA2kOMmAQApz5dayPxWiHqmq4sWH2xF5LcQK56LlbKByCd8Aah/OIkQ==
dependencies:
- "@babel/helper-hoist-variables" "^7.0.0"
+ "@babel/helper-hoist-variables" "^7.4.4"
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-transform-modules-umd@^7.2.0":
@@ -467,17 +475,17 @@
"@babel/helper-module-transforms" "^7.1.0"
"@babel/helper-plugin-utils" "^7.0.0"
-"@babel/plugin-transform-named-capturing-groups-regex@^7.3.0":
- version "7.3.0"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.3.0.tgz#140b52985b2d6ef0cb092ef3b29502b990f9cd50"
- integrity sha512-NxIoNVhk9ZxS+9lSoAQ/LM0V2UEvARLttEHUrRDGKFaAxOYQcrkN/nLRE+BbbicCAvZPl7wMP0X60HsHE5DtQw==
+"@babel/plugin-transform-named-capturing-groups-regex@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.4.4.tgz#5611d96d987dfc4a3a81c4383bb173361037d68d"
+ integrity sha512-Ki+Y9nXBlKfhD+LXaRS7v95TtTGYRAf9Y1rTDiE75zf8YQz4GDaWRXosMfJBXxnk88mGFjWdCRIeqDbon7spYA==
dependencies:
regexp-tree "^0.1.0"
-"@babel/plugin-transform-new-target@^7.0.0":
- version "7.0.0"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.0.0.tgz#ae8fbd89517fa7892d20e6564e641e8770c3aa4a"
- integrity sha512-yin069FYjah+LbqfGeTfzIBODex/e++Yfa0rH0fpfam9uTbuEeEOx5GLGr210ggOV77mVRNoeqSYqeuaqSzVSw==
+"@babel/plugin-transform-new-target@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.4.4.tgz#18d120438b0cc9ee95a47f2c72bc9768fbed60a5"
+ integrity sha512-r1z3T2DNGQwwe2vPGZMBNjioT2scgWzK9BCnDEh+46z8EEwXBq24uRzd65I7pjtugzPSj921aM15RpESgzsSuA==
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
@@ -489,21 +497,35 @@
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/helper-replace-supers" "^7.1.0"
-"@babel/plugin-transform-parameters@^7.2.0":
- version "7.2.0"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.2.0.tgz#0d5ad15dc805e2ea866df4dd6682bfe76d1408c2"
- integrity sha512-kB9+hhUidIgUoBQ0MsxMewhzr8i60nMa2KgeJKQWYrqQpqcBYtnpR+JgkadZVZoaEZ/eKu9mclFaVwhRpLNSzA==
+"@babel/plugin-transform-parameters@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.4.4.tgz#7556cf03f318bd2719fe4c922d2d808be5571e16"
+ integrity sha512-oMh5DUO1V63nZcu/ZVLQFqiihBGo4OpxJxR1otF50GMeCLiRx5nUdtokd+u9SuVJrvvuIh9OosRFPP4pIPnwmw==
dependencies:
- "@babel/helper-call-delegate" "^7.1.0"
+ "@babel/helper-call-delegate" "^7.4.4"
"@babel/helper-get-function-arity" "^7.0.0"
"@babel/helper-plugin-utils" "^7.0.0"
-"@babel/plugin-transform-regenerator@^7.0.0":
- version "7.0.0"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.0.0.tgz#5b41686b4ed40bef874d7ed6a84bdd849c13e0c1"
- integrity sha512-sj2qzsEx8KDVv1QuJc/dEfilkg3RRPvPYx/VnKLtItVQRWt1Wqf5eVCOLZm29CiGFfYYsA3VPjfizTCV0S0Dlw==
+"@babel/plugin-transform-property-literals@^7.2.0":
+ version "7.2.0"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.2.0.tgz#03e33f653f5b25c4eb572c98b9485055b389e905"
+ integrity sha512-9q7Dbk4RhgcLp8ebduOpCbtjh7C0itoLYHXd9ueASKAG/is5PQtMR5VJGka9NKqGhYEGn5ITahd4h9QeBMylWQ==
dependencies:
- regenerator-transform "^0.13.3"
+ "@babel/helper-plugin-utils" "^7.0.0"
+
+"@babel/plugin-transform-regenerator@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.4.4.tgz#5b4da4df79391895fca9e28f99e87e22cfc02072"
+ integrity sha512-Zz3w+pX1SI0KMIiqshFZkwnVGUhDZzpX2vtPzfJBKQQq8WsP/Xy9DNdELWivxcKOCX/Pywge4SiEaPaLtoDT4g==
+ dependencies:
+ regenerator-transform "^0.13.4"
+
+"@babel/plugin-transform-reserved-words@^7.2.0":
+ version "7.2.0"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.2.0.tgz#4792af87c998a49367597d07fedf02636d2e1634"
+ integrity sha512-fz43fqW8E1tAB3DKF19/vxbpib1fuyCwSPE418ge5ZxILnBhWyhtPgz8eh1RCGGJlwvksHkyxMxh0eenFi+kFw==
+ dependencies:
+ "@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-transform-shorthand-properties@^7.2.0":
version "7.2.0"
@@ -527,10 +549,10 @@
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/helper-regex" "^7.0.0"
-"@babel/plugin-transform-template-literals@^7.2.0":
- version "7.2.0"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.2.0.tgz#d87ed01b8eaac7a92473f608c97c089de2ba1e5b"
- integrity sha512-FkPix00J9A/XWXv4VoKJBMeSkyY9x/TqIh76wzcdfl57RJJcf8CehQ08uwfhCDNtRQYtHQKBTwKZDEyjE13Lwg==
+"@babel/plugin-transform-template-literals@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.4.4.tgz#9d28fea7bbce637fb7612a0750989d8321d4bcb0"
+ integrity sha512-mQrEC4TWkhLN0z8ygIvEL9ZEToPhG5K7KDW3pzGqOfIGZ28Jb0POUkeWcoz8HnHvhFy6dwAT1j8OzqN8s804+g==
dependencies:
"@babel/helper-annotate-as-pure" "^7.0.0"
"@babel/helper-plugin-utils" "^7.0.0"
@@ -542,97 +564,102 @@
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
-"@babel/plugin-transform-unicode-regex@^7.2.0":
- version "7.2.0"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.2.0.tgz#4eb8db16f972f8abb5062c161b8b115546ade08b"
- integrity sha512-m48Y0lMhrbXEJnVUaYly29jRXbQ3ksxPrS1Tg8t+MHqzXhtBYAvI51euOBaoAlZLPHsieY9XPVMf80a5x0cPcA==
+"@babel/plugin-transform-unicode-regex@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.4.4.tgz#ab4634bb4f14d36728bf5978322b35587787970f"
+ integrity sha512-il+/XdNw01i93+M9J9u4T7/e/Ue/vWfNZE4IRUQjplu2Mqb/AFTDimkw2tdEdSH50wuQXZAbXSql0UphQke+vA==
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
- "@babel/helper-regex" "^7.0.0"
- regexpu-core "^4.1.3"
+ "@babel/helper-regex" "^7.4.4"
+ regexpu-core "^4.5.4"
-"@babel/preset-env@^7.3.1":
- version "7.3.1"
- resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.3.1.tgz#389e8ca6b17ae67aaf9a2111665030be923515db"
- integrity sha512-FHKrD6Dxf30e8xgHQO0zJZpUPfVZg+Xwgz5/RdSWCbza9QLNk4Qbp40ctRoqDxml3O8RMzB1DU55SXeDG6PqHQ==
+"@babel/preset-env@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.4.4.tgz#b6f6825bfb27b3e1394ca3de4f926482722c1d6f"
+ integrity sha512-FU1H+ACWqZZqfw1x2G1tgtSSYSfxJLkpaUQL37CenULFARDo+h4xJoVHzRoHbK+85ViLciuI7ME4WTIhFRBBlw==
dependencies:
"@babel/helper-module-imports" "^7.0.0"
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-proposal-async-generator-functions" "^7.2.0"
"@babel/plugin-proposal-json-strings" "^7.2.0"
- "@babel/plugin-proposal-object-rest-spread" "^7.3.1"
+ "@babel/plugin-proposal-object-rest-spread" "^7.4.4"
"@babel/plugin-proposal-optional-catch-binding" "^7.2.0"
- "@babel/plugin-proposal-unicode-property-regex" "^7.2.0"
+ "@babel/plugin-proposal-unicode-property-regex" "^7.4.4"
"@babel/plugin-syntax-async-generators" "^7.2.0"
"@babel/plugin-syntax-json-strings" "^7.2.0"
"@babel/plugin-syntax-object-rest-spread" "^7.2.0"
"@babel/plugin-syntax-optional-catch-binding" "^7.2.0"
"@babel/plugin-transform-arrow-functions" "^7.2.0"
- "@babel/plugin-transform-async-to-generator" "^7.2.0"
+ "@babel/plugin-transform-async-to-generator" "^7.4.4"
"@babel/plugin-transform-block-scoped-functions" "^7.2.0"
- "@babel/plugin-transform-block-scoping" "^7.2.0"
- "@babel/plugin-transform-classes" "^7.2.0"
+ "@babel/plugin-transform-block-scoping" "^7.4.4"
+ "@babel/plugin-transform-classes" "^7.4.4"
"@babel/plugin-transform-computed-properties" "^7.2.0"
- "@babel/plugin-transform-destructuring" "^7.2.0"
- "@babel/plugin-transform-dotall-regex" "^7.2.0"
+ "@babel/plugin-transform-destructuring" "^7.4.4"
+ "@babel/plugin-transform-dotall-regex" "^7.4.4"
"@babel/plugin-transform-duplicate-keys" "^7.2.0"
"@babel/plugin-transform-exponentiation-operator" "^7.2.0"
- "@babel/plugin-transform-for-of" "^7.2.0"
- "@babel/plugin-transform-function-name" "^7.2.0"
+ "@babel/plugin-transform-for-of" "^7.4.4"
+ "@babel/plugin-transform-function-name" "^7.4.4"
"@babel/plugin-transform-literals" "^7.2.0"
+ "@babel/plugin-transform-member-expression-literals" "^7.2.0"
"@babel/plugin-transform-modules-amd" "^7.2.0"
- "@babel/plugin-transform-modules-commonjs" "^7.2.0"
- "@babel/plugin-transform-modules-systemjs" "^7.2.0"
+ "@babel/plugin-transform-modules-commonjs" "^7.4.4"
+ "@babel/plugin-transform-modules-systemjs" "^7.4.4"
"@babel/plugin-transform-modules-umd" "^7.2.0"
- "@babel/plugin-transform-named-capturing-groups-regex" "^7.3.0"
- "@babel/plugin-transform-new-target" "^7.0.0"
+ "@babel/plugin-transform-named-capturing-groups-regex" "^7.4.4"
+ "@babel/plugin-transform-new-target" "^7.4.4"
"@babel/plugin-transform-object-super" "^7.2.0"
- "@babel/plugin-transform-parameters" "^7.2.0"
- "@babel/plugin-transform-regenerator" "^7.0.0"
+ "@babel/plugin-transform-parameters" "^7.4.4"
+ "@babel/plugin-transform-property-literals" "^7.2.0"
+ "@babel/plugin-transform-regenerator" "^7.4.4"
+ "@babel/plugin-transform-reserved-words" "^7.2.0"
"@babel/plugin-transform-shorthand-properties" "^7.2.0"
"@babel/plugin-transform-spread" "^7.2.0"
"@babel/plugin-transform-sticky-regex" "^7.2.0"
- "@babel/plugin-transform-template-literals" "^7.2.0"
+ "@babel/plugin-transform-template-literals" "^7.4.4"
"@babel/plugin-transform-typeof-symbol" "^7.2.0"
- "@babel/plugin-transform-unicode-regex" "^7.2.0"
- browserslist "^4.3.4"
+ "@babel/plugin-transform-unicode-regex" "^7.4.4"
+ "@babel/types" "^7.4.4"
+ browserslist "^4.5.2"
+ core-js-compat "^3.0.0"
invariant "^2.2.2"
js-levenshtein "^1.1.3"
- semver "^5.3.0"
+ semver "^5.5.0"
"@babel/standalone@^7.0.0":
version "7.3.4"
resolved "https://registry.yarnpkg.com/@babel/standalone/-/standalone-7.3.4.tgz#b622c1e522acef91b2a14f22bdcdd4f935a1a474"
integrity sha512-4L9c5i4WlGqbrjOVX0Yp8TIR5cEiw1/tPYYZENW/iuO2uI6viY38U7zALidzNfGdZIwNc+A/AWqMEWKeScWkBg==
-"@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.1.2", "@babel/template@^7.2.2":
- version "7.2.2"
- resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.2.2.tgz#005b3fdf0ed96e88041330379e0da9a708eb2907"
- integrity sha512-zRL0IMM02AUDwghf5LMSSDEz7sBCO2YnNmpg3uWTZj/v1rcG2BmQUvaGU8GhU8BvfMh1k2KIAYZ7Ji9KXPUg7g==
+"@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.4.4.tgz#f4b88d1225689a08f5bc3a17483545be9e4ed237"
+ integrity sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw==
dependencies:
"@babel/code-frame" "^7.0.0"
- "@babel/parser" "^7.2.2"
- "@babel/types" "^7.2.2"
+ "@babel/parser" "^7.4.4"
+ "@babel/types" "^7.4.4"
-"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.1.5", "@babel/traverse@^7.2.3", "@babel/traverse@^7.3.4":
- version "7.3.4"
- resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.3.4.tgz#1330aab72234f8dea091b08c4f8b9d05c7119e06"
- integrity sha512-TvTHKp6471OYEcE/91uWmhR6PrrYywQntCHSaZ8CM8Vmp+pjAusal4nGB2WCCQd0rvI7nOMKn9GnbcvTUz3/ZQ==
+"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.4.4.tgz#0776f038f6d78361860b6823887d4f3937133fe8"
+ integrity sha512-Gw6qqkw/e6AGzlyj9KnkabJX7VcubqPtkUQVAwkc0wUMldr3A/hezNB3Rc5eIvId95iSGkGIOe5hh1kMKf951A==
dependencies:
"@babel/code-frame" "^7.0.0"
- "@babel/generator" "^7.3.4"
+ "@babel/generator" "^7.4.4"
"@babel/helper-function-name" "^7.1.0"
- "@babel/helper-split-export-declaration" "^7.0.0"
- "@babel/parser" "^7.3.4"
- "@babel/types" "^7.3.4"
+ "@babel/helper-split-export-declaration" "^7.4.4"
+ "@babel/parser" "^7.4.4"
+ "@babel/types" "^7.4.4"
debug "^4.1.0"
globals "^11.1.0"
lodash "^4.17.11"
-"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.2.2", "@babel/types@^7.3.4":
- version "7.3.4"
- resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.3.4.tgz#bf482eaeaffb367a28abbf9357a94963235d90ed"
- integrity sha512-WEkp8MsLftM7O/ty580wAmZzN1nDmCACc5+jFzUt+GUFNNIi3LdRlueYz0YIlmJhlZx1QYDMZL5vdWCL0fNjFQ==
+"@babel/types@^7.0.0", "@babel/types@^7.4.4":
+ version "7.4.4"
+ resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.4.4.tgz#8db9e9a629bb7c29370009b4b779ed93fe57d5f0"
+ integrity sha512-dOllgYdnEFOebhkKCjzSVFqw/PmmB8pH6RGOWkY4GsboQNd47b1fBThBSwlHAq9alF9vc1M3+6oqR47R50L0tQ==
dependencies:
esutils "^2.0.2"
lodash "^4.17.11"
@@ -658,10 +685,10 @@
eslint-plugin-promise "^4.1.1"
eslint-plugin-vue "^5.0.0"
-"@gitlab/svgs@^1.60.0":
- version "1.60.0"
- resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.60.0.tgz#c24fe0d40193f4b722e858c2f766b1c80f961cb7"
- integrity sha512-Io13vB7LMmPHwUXOoHI+dBYRKDoL0E1dw0b+kJOjesFo+uogaggXJJ4WNEGbWTueYyLckv1YhePACG2xgoLWow==
+"@gitlab/svgs@^1.62.0":
+ version "1.62.0"
+ resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.62.0.tgz#7072220b7c3aeb31d49b770888ff923b31e44e39"
+ integrity sha512-xBmIidLfJZ3N9OJTsrtphsCbmenGm25AJe6s9Hsm9ikuSJ9FLBbwDJBORw95CSmajB0GdgbkPoTOWbIh1V9KgA==
"@gitlab/ui@^3.10.0":
version "3.10.0"
@@ -1796,14 +1823,14 @@ browserify-zlib@^0.2.0:
dependencies:
pako "~1.0.5"
-browserslist@^4.3.4, browserslist@^4.4.1:
- version "4.4.1"
- resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.4.1.tgz#42e828954b6b29a7a53e352277be429478a69062"
- integrity sha512-pEBxEXg7JwaakBXjATYw/D1YZh4QUSCX/Mnd/wnqSRPPSi1U39iDhDoKGoBUcraKdxDlrYqJxSI5nNvD+dWP2A==
+browserslist@^4.4.1, browserslist@^4.5.2, browserslist@^4.5.4:
+ version "4.6.0"
+ resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.6.0.tgz#5274028c26f4d933d5b1323307c1d1da5084c9ff"
+ integrity sha512-Jk0YFwXBuMOOol8n6FhgkDzn3mY9PYLYGk29zybF05SbRTsMgPqmTNeQQhOghCxq5oFqAXE3u4sYddr4C0uRhg==
dependencies:
- caniuse-lite "^1.0.30000929"
- electron-to-chromium "^1.3.103"
- node-releases "^1.1.3"
+ caniuse-lite "^1.0.30000967"
+ electron-to-chromium "^1.3.133"
+ node-releases "^1.1.19"
bs-logger@0.x:
version "0.2.6"
@@ -1995,10 +2022,10 @@ camelcase@^5.0.0:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.0.0.tgz#03295527d58bd3cd4aa75363f35b2e8d97be2f42"
integrity sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==
-caniuse-lite@^1.0.30000929, caniuse-lite@^1.0.30000932:
- version "1.0.30000936"
- resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000936.tgz#5d33b118763988bf721b9b8ad436d0400e4a116b"
- integrity sha512-orX4IdpbFhdNO7bTBhSbahp1EBpqzBc+qrvTRVUFfZgA4zta7TdM6PN5ZxkEUgDnz36m+PfWGcdX7AVfFWItJw==
+caniuse-lite@^1.0.30000932, caniuse-lite@^1.0.30000967:
+ version "1.0.30000969"
+ resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000969.tgz#7664f571f2072657bde70b00a1fc1ba41f1942a9"
+ integrity sha512-Kus0yxkoAJgVc0bax7S4gLSlFifCa7MnSZL9p9VuS/HIKEL4seaqh28KIQAAO50cD/rJ5CiJkJFapkdDAlhFxQ==
capture-exit@^1.2.0:
version "1.2.0"
@@ -2531,6 +2558,26 @@ copy-to-clipboard@^3.0.8:
dependencies:
toggle-selection "^1.0.3"
+core-js-compat@^3.0.0:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.0.1.tgz#bff73ba31ca8687431b9c88f78d3362646fb76f0"
+ integrity sha512-2pC3e+Ht/1/gD7Sim/sqzvRplMiRnFQVlPpDVaHtY9l7zZP7knamr3VRD6NyGfHd84MrDC0tAM9ulNxYMW0T3g==
+ dependencies:
+ browserslist "^4.5.4"
+ core-js "3.0.1"
+ core-js-pure "3.0.1"
+ semver "^6.0.0"
+
+core-js-pure@3.0.1:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.0.1.tgz#37358fb0d024e6b86d443d794f4e37e949098cbe"
+ integrity sha512-mSxeQ6IghKW3MoyF4cz19GJ1cMm7761ON+WObSyLfTu/Jn3x7w4NwNFnrZxgl4MTSvYYepVLNuRtlB4loMwJ5g==
+
+core-js@3.0.1:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.0.1.tgz#1343182634298f7f38622f95e73f54e48ddf4738"
+ integrity sha512-sco40rF+2KlE0ROMvydjkrVMMG1vYilP2ALoRXcYR4obqbYIuV3Bg+51GEDW+HF8n7NRA+iaA4qD0nD9lo9mew==
+
core-js@^2.2.0, core-js@^2.4.0, core-js@^2.4.1:
version "2.5.7"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e"
@@ -3519,10 +3566,10 @@ ejs@^2.6.1:
resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.6.1.tgz#498ec0d495655abc6f23cd61868d926464071aa0"
integrity sha512-0xy4A/twfrRCnkhfk8ErDi5DqdAsAqeGxht4xkCUrsvhhbQNs7E+4jV0CN7+NKIY0aHE72+XvqtBIXzD31ZbXQ==
-electron-to-chromium@^1.3.103:
- version "1.3.113"
- resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.113.tgz#b1ccf619df7295aea17bc6951dc689632629e4a9"
- integrity sha512-De+lPAxEcpxvqPTyZAXELNpRZXABRxf+uL/rSykstQhzj/B0l1150G/ExIIxKc16lI89Hgz81J0BHAcbTqK49g==
+electron-to-chromium@^1.3.133:
+ version "1.3.135"
+ resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.135.tgz#f5799b95f2bcd8de17cde47d63392d83a4477041"
+ integrity sha512-xXLNstRdVsisPF3pL3H9TVZo2XkMILfqtD6RiWIUmDK2sFX1Bjwqmd8LBp0Kuo2FgKO63JXPoEVGm8WyYdwP0Q==
elliptic@^6.0.0:
version "6.4.0"
@@ -4524,12 +4571,12 @@ fs.realpath@^1.0.0:
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
fsevents@^1.2.2, fsevents@^1.2.3:
- version "1.2.4"
- resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.4.tgz#f41dcb1af2582af3692da36fc55cbd8e1041c426"
- integrity sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==
+ version "1.2.9"
+ resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.9.tgz#3f5ed66583ccd6f400b5a00db6f7e861363e388f"
+ integrity sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw==
dependencies:
- nan "^2.9.2"
- node-pre-gyp "^0.10.0"
+ nan "^2.12.1"
+ node-pre-gyp "^0.12.0"
fstream@^1.0.0, fstream@^1.0.2:
version "1.0.11"
@@ -4723,9 +4770,9 @@ global-prefix@^3.0.0:
which "^1.3.1"
globals@^11.1.0, globals@^11.7.0:
- version "11.7.0"
- resolved "https://registry.yarnpkg.com/globals/-/globals-11.7.0.tgz#a583faa43055b1aca771914bf68258e2fc125673"
- integrity sha512-K8BNSPySfeShBQXsahYB/AbbWruVOTyVpgoIDnl8odPpeSfP2J5QO2oLFFdl2j7GfDCtZj2bMKar2T49itTPCg==
+ version "11.12.0"
+ resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e"
+ integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==
globby@^5.0.0:
version "5.0.0"
@@ -6374,9 +6421,9 @@ jsdom@^11.5.1:
xml-name-validator "^3.0.0"
jsesc@^2.5.1:
- version "2.5.1"
- resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.1.tgz#e421a2a8e20d6b0819df28908f782526b96dd1fe"
- integrity sha1-5CGiqOINawgZ3yiQj3glJrlt0f4=
+ version "2.5.2"
+ resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4"
+ integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==
jsesc@~0.5.0:
version "0.5.0"
@@ -6731,17 +6778,12 @@ locate-path@^3.0.0:
p-locate "^3.0.0"
path-exists "^3.0.0"
-lodash.assign@^4.2.0:
- version "4.2.0"
- resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7"
- integrity sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=
-
lodash.camelcase@4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6"
integrity sha1-soqmKIorn8ZRA1x3EfZathkDMaY=
-lodash.clonedeep@^4.3.2, lodash.clonedeep@^4.5.0:
+lodash.clonedeep@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=
@@ -7310,10 +7352,10 @@ mute-stream@0.0.7:
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=
-nan@^2.10.0, nan@^2.9.2:
- version "2.13.1"
- resolved "https://registry.yarnpkg.com/nan/-/nan-2.13.1.tgz#a15bee3790bde247e8f38f1d446edcdaeb05f2dd"
- integrity sha512-I6YB/YEuDeUZMmhscXKxGgZlFnhsn5y0hgOZBadkzfTRrZBtJDZeg6eQf7PYMIEclwmorTKK8GztsyOUSVBREA==
+nan@^2.12.1, nan@^2.13.2:
+ version "2.14.0"
+ resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c"
+ integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==
nanomatch@^1.2.9:
version "1.2.9"
@@ -7362,6 +7404,11 @@ nice-try@^1.0.4:
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4"
integrity sha512-2NpiFHqC87y/zFke0fC0spBXL3bBsoh/p5H1EFhshxjCR5+0g2d6BiXbUFz9v1sAcxsk2htp2eQnNIci2dIYcA==
+node-ensure@^0.0.0:
+ version "0.0.0"
+ resolved "https://registry.yarnpkg.com/node-ensure/-/node-ensure-0.0.0.tgz#ecae764150de99861ec5c810fd5d096b183932a7"
+ integrity sha1-7K52QVDemYYexcgQ/V0Jaxg5Mqc=
+
node-fetch@1.6.3:
version "1.6.3"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.6.3.tgz#dc234edd6489982d58e8f0db4f695029abcd8c04"
@@ -7442,10 +7489,10 @@ node-notifier@^5.2.1:
shellwords "^0.1.1"
which "^1.3.0"
-node-pre-gyp@^0.10.0:
- version "0.10.3"
- resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.10.3.tgz#3070040716afdc778747b61b6887bf78880b80fc"
- integrity sha512-d1xFs+C/IPS8Id0qPTZ4bUT8wWryfR/OzzAFxweG+uLN85oPzyo2Iw6bVlLQ/JOdgNonXLCoRyqDzDWq4iw72A==
+node-pre-gyp@^0.12.0:
+ version "0.12.0"
+ resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.12.0.tgz#39ba4bb1439da030295f899e3b520b7785766149"
+ integrity sha512-4KghwV8vH5k+g2ylT+sLTjy5wmUOb9vPhnM8NHvRf9dHmnW/CndrFXy2aRPaPST6dugXSdHXfeaHQm77PIz/1A==
dependencies:
detect-libc "^1.0.2"
mkdirp "^0.5.1"
@@ -7458,17 +7505,17 @@ node-pre-gyp@^0.10.0:
semver "^5.3.0"
tar "^4"
-node-releases@^1.1.3:
- version "1.1.3"
- resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.3.tgz#aad9ce0dcb98129c753f772c0aa01360fb90fbd2"
- integrity sha512-6VrvH7z6jqqNFY200kdB6HdzkgM96Oaj9v3dqGfgp6mF+cHmU4wyQKZ2/WPDRVoR0Jz9KqbamaBN0ZhdUaysUQ==
+node-releases@^1.1.19:
+ version "1.1.19"
+ resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.19.tgz#c492d1e381fea0350b338b646c27867e88e91b3d"
+ integrity sha512-SH/B4WwovHbulIALsQllAVwqZZD1kPmKCqrhGfR29dXjLAVZMHvBjD3S6nL9D/J9QkmZ1R92/0wCMDKXUUvyyA==
dependencies:
semver "^5.3.0"
-node-sass@^4.11.0:
- version "4.11.0"
- resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.11.0.tgz#183faec398e9cbe93ba43362e2768ca988a6369a"
- integrity sha512-bHUdHTphgQJZaF1LASx0kAviPH7sGlcyNhWade4eVIpFp6tsn7SV8xNMTbsQFpEV9VXpnwTTnNYlfsZXgGgmkA==
+node-sass@^4.12.0:
+ version "4.12.0"
+ resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.12.0.tgz#0914f531932380114a30cc5fa4fa63233a25f017"
+ integrity sha512-A1Iv4oN+Iel6EPv77/HddXErL2a+gZ4uBeZUy+a8O35CFYTXhgA8MgLCWBtwpGZdCvTvQ9d+bQxX/QC36GDPpQ==
dependencies:
async-foreach "^0.1.3"
chalk "^1.1.1"
@@ -7477,12 +7524,10 @@ node-sass@^4.11.0:
get-stdin "^4.0.1"
glob "^7.0.3"
in-publish "^2.0.0"
- lodash.assign "^4.2.0"
- lodash.clonedeep "^4.3.2"
- lodash.mergewith "^4.6.0"
+ lodash "^4.17.11"
meow "^3.7.0"
mkdirp "^0.5.1"
- nan "^2.10.0"
+ nan "^2.13.2"
node-gyp "^3.8.0"
npmlog "^4.0.0"
request "^2.88.0"
@@ -8104,6 +8149,14 @@ pbkdf2@^3.0.3:
safe-buffer "^5.0.1"
sha.js "^2.4.8"
+pdfjs-dist@^2.0.943:
+ version "2.0.943"
+ resolved "https://registry.yarnpkg.com/pdfjs-dist/-/pdfjs-dist-2.0.943.tgz#32fb9a2d863df5a1d89521a0b3cd900c16e7edde"
+ integrity sha512-iLhNcm4XceTHRaSU5o22ZGCm4YpuW5+rf4+BJFH/feBhMQLbCGBry+Jet8Q419QDI4qgARaIQzXuiNrsNWS8Yw==
+ dependencies:
+ node-ensure "^0.0.0"
+ worker-loader "^2.0.0"
+
performance-now@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
@@ -8866,10 +8919,10 @@ redent@^2.0.0:
indent-string "^3.0.0"
strip-indent "^2.0.0"
-regenerate-unicode-properties@^7.0.0:
- version "7.0.0"
- resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-7.0.0.tgz#107405afcc4a190ec5ed450ecaa00ed0cafa7a4c"
- integrity sha512-s5NGghCE4itSlUS+0WUj88G6cfMVMmH8boTPNvABf8od+2dhT9WDlWu8n01raQAJZMOK8Ch6jSexaRO7swd6aw==
+regenerate-unicode-properties@^8.0.2:
+ version "8.1.0"
+ resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz#ef51e0f0ea4ad424b77bf7cb41f3e015c70a3f0e"
+ integrity sha512-LGZzkgtLY79GeXLm8Dp0BVLdQlWICzBnJz/ipWUgo59qBaZ+BHtq51P2q1uVZlppMuUAT37SDk39qUbjTWB7bA==
dependencies:
regenerate "^1.4.0"
@@ -8888,10 +8941,10 @@ regenerator-runtime@^0.11.0:
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==
-regenerator-transform@^0.13.3:
- version "0.13.3"
- resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.13.3.tgz#264bd9ff38a8ce24b06e0636496b2c856b57bcbb"
- integrity sha512-5ipTrZFSq5vU2YoGoww4uaRVAK4wyYC4TSICibbfEPOruUu8FFP7ErV0BjmbIOEpn3O/k9na9UEdYR/3m7N6uA==
+regenerator-transform@^0.13.4:
+ version "0.13.4"
+ resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.13.4.tgz#18f6763cf1382c69c36df76c6ce122cc694284fb"
+ integrity sha512-T0QMBjK3J0MtxjPmdIMXm72Wvj2Abb0Bd4HADdfijwMdoIsyQZ6fWC7kDFhk2YinBBEMZDL7Y7wh0J1sGx3S4A==
dependencies:
private "^0.1.6"
@@ -8926,17 +8979,17 @@ regexpu-core@^1.0.0:
regjsgen "^0.2.0"
regjsparser "^0.1.4"
-regexpu-core@^4.1.3, regexpu-core@^4.2.0:
- version "4.2.0"
- resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.2.0.tgz#a3744fa03806cffe146dea4421a3e73bdcc47b1d"
- integrity sha512-Z835VSnJJ46CNBttalHD/dB+Sj2ezmY6Xp38npwU87peK6mqOzOpV8eYktdkLTEkzzD+JsTcxd84ozd8I14+rw==
+regexpu-core@^4.5.4:
+ version "4.5.4"
+ resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.5.4.tgz#080d9d02289aa87fe1667a4f5136bc98a6aebaae"
+ integrity sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ==
dependencies:
regenerate "^1.4.0"
- regenerate-unicode-properties "^7.0.0"
- regjsgen "^0.4.0"
- regjsparser "^0.3.0"
+ regenerate-unicode-properties "^8.0.2"
+ regjsgen "^0.5.0"
+ regjsparser "^0.6.0"
unicode-match-property-ecmascript "^1.0.4"
- unicode-match-property-value-ecmascript "^1.0.2"
+ unicode-match-property-value-ecmascript "^1.1.0"
registry-auth-token@^3.0.1:
version "3.3.2"
@@ -8958,10 +9011,10 @@ regjsgen@^0.2.0:
resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.2.0.tgz#6c016adeac554f75823fe37ac05b92d5a4edb1f7"
integrity sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=
-regjsgen@^0.4.0:
- version "0.4.0"
- resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.4.0.tgz#c1eb4c89a209263f8717c782591523913ede2561"
- integrity sha512-X51Lte1gCYUdlwhF28+2YMO0U6WeN0GLpgpA7LK7mbdDnkQYiwvEpmpe0F/cv5L14EbxgrdayAG3JETBv0dbXA==
+regjsgen@^0.5.0:
+ version "0.5.0"
+ resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.5.0.tgz#a7634dc08f89209c2049adda3525711fb97265dd"
+ integrity sha512-RnIrLhrXCX5ow/E5/Mh2O4e/oa1/jW0eaBKTSy3LaCj+M3Bqvm97GWDp2yUtzIs4LEn65zR2yiYGFqb2ApnzDA==
regjsparser@^0.1.4:
version "0.1.5"
@@ -8970,10 +9023,10 @@ regjsparser@^0.1.4:
dependencies:
jsesc "~0.5.0"
-regjsparser@^0.3.0:
- version "0.3.0"
- resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.3.0.tgz#3c326da7fcfd69fa0d332575a41c8c0cdf588c96"
- integrity sha512-zza72oZBBHzt64G7DxdqrOo/30bhHkwMUoT0WqfGu98XLd7N+1tsy5MJ96Bk4MD0y74n629RhmrGW6XlnLLwCA==
+regjsparser@^0.6.0:
+ version "0.6.0"
+ resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.6.0.tgz#f1e6ae8b7da2bae96c99399b868cd6c933a2ba9c"
+ integrity sha512-RQ7YyokLiQBomUJuUG8iGVvkgOLxwyZM8k6d3q5SAXpg4r5TZJZigKFvC6PpD+qQ98bCDC5YelPeA3EucDoNeQ==
dependencies:
jsesc "~0.5.0"
@@ -9172,9 +9225,9 @@ resolve@1.1.7, resolve@1.1.x:
integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=
resolve@1.x, resolve@^1.10.0, resolve@^1.3.2, resolve@^1.4.0, resolve@^1.5.0, resolve@^1.9.0:
- version "1.10.0"
- resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.0.tgz#3bdaaeaf45cc07f375656dfd2e54ed0810b101ba"
- integrity sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==
+ version "1.11.0"
+ resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.0.tgz#4014870ba296176b86343d50b60f3b50609ce232"
+ integrity sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==
dependencies:
path-parse "^1.0.6"
@@ -9390,9 +9443,14 @@ semver-diff@^2.0.0:
semver "^5.0.3"
"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0:
- version "5.6.0"
- resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004"
- integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==
+ version "5.7.0"
+ resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b"
+ integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==
+
+semver@^6.0.0:
+ version "6.0.0"
+ resolved "https://registry.yarnpkg.com/semver/-/semver-6.0.0.tgz#05e359ee571e5ad7ed641a6eec1e547ba52dea65"
+ integrity sha512-0UewU+9rFapKFnlbirLi3byoOuhrSsli/z/ihNnvM24vgF+8sNBiI1LZPBSH9wJKUwaUbw+s3hToDLCXkrghrQ==
semver@~5.3.0:
version "5.3.0"
@@ -10662,10 +10720,10 @@ unicode-match-property-ecmascript@^1.0.4:
unicode-canonical-property-names-ecmascript "^1.0.4"
unicode-property-aliases-ecmascript "^1.0.4"
-unicode-match-property-value-ecmascript@^1.0.2:
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.0.2.tgz#9f1dc76926d6ccf452310564fd834ace059663d4"
- integrity sha512-Rx7yODZC1L/T8XKo/2kNzVAQaRE88AaMvI1EF/Xnj3GW2wzN6fop9DDWuFAKUVFH7vozkz26DzP0qyWLKLIVPQ==
+unicode-match-property-value-ecmascript@^1.1.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.1.0.tgz#5b4b426e08d13a80365e0d657ac7a6c1ec46a277"
+ integrity sha512-hDTHvaBk3RmFzvSl0UVrUmC3PuW9wKVnpoUDYH0JDkSIovzw+J5viQmeYHxVSBptubnr7PbH2e0fnpDRQnQl5g==
unicode-property-aliases-ecmascript@^1.0.4:
version "1.0.4"