From d491fa776fd14395a3546bd3d71d3de94cb78fdd Mon Sep 17 00:00:00 2001 From: Laud Bruce Tagoe Date: Fri, 17 Nov 2023 08:45:13 +0000 Subject: [PATCH] Remove build directory. --- packages/embed/build/authentication.html | 47 - packages/embed/build/basic-kyc.html | 499 -- packages/embed/build/basic_kyc.html | 56 - .../build/basic_kyc_pre_select_country.html | 57 - .../build/basic_kyc_pre_select_id_type.html | 57 - .../build/basic_kyc_preview_bvn_mfa.html | 55 - packages/embed/build/biometric-kyc.html | 646 -- packages/embed/build/biometric_kyc.html | 44 - .../biometric_kyc_pre_select_country.html | 47 - .../biometric_kyc_pre_select_id_type.html | 47 - .../build/biometric_kyc_preview_bvn_mfa.html | 45 - .../embed/build/consent-not-required.html | 44 - packages/embed/build/consent-required.html | 47 - packages/embed/build/css/styles.css | 560 -- packages/embed/build/demo.html | 45 - packages/embed/build/doc-verification.html | 417 - ...document-verification-legacy-id_types.html | 49 - ...ument-verification-pre-select-country.html | 47 - ...ument-verification-pre-select-id-type.html | 47 - .../embed/build/document-verification.html | 44 - .../embed/build/ekyc-consent-required.html | 47 - packages/embed/build/ekyc.html | 500 -- .../build/enhanced-document-verification.html | 417 - .../build/enhanced_document_verification.html | 44 - packages/embed/build/enhanced_kyc.html | 44 - .../enhanced_kyc_pre_select_country.html | 47 - .../enhanced_kyc_pre_select_id_type.html | 47 - .../build/enhanced_kyc_preview_bvn_mfa.html | 45 - packages/embed/build/id-selection.html | 47 - .../embed/build/identity-verification.html | 47 - .../embed/build/img/icons/chevron-down.svg | 11 - packages/embed/build/img/icons/chevron-up.svg | 4 - packages/embed/build/index.html | 47 - packages/embed/build/js/basic-kyc.min.js | 3751 -------- packages/embed/build/js/biometric-kyc.min.js | 7765 ----------------- .../embed/build/js/components/.eslintrc.cjs | 5 - .../build/js/demo-ekyc-smartselfie.min.js | 41 - .../embed/build/js/doc-verification.min.js | 5423 ------------ packages/embed/build/js/ekyc.min.js | 3758 -------- .../js/enhanced-document-verification.min.js | 4838 ---------- .../embed/build/js/product-selection.min.js | 281 - packages/embed/build/js/script.min.js | 162 - .../embed/build/js/smartselfie-auth.min.js | 4693 ---------- .../build/kra-verification-basic-kyc.html | 47 - .../embed/build/kra-verification-ekyc.html | 47 - packages/embed/build/product-selection.html | 226 - packages/embed/build/smartselfie-auth.html | 296 - packages/embed/build/smartselfie.html | 47 - ...tion-single-country-multiple-id-types.html | 60 - ...lection-single-country-single-id-type.html | 50 - .../build/verification-method-selection.html | 70 - 51 files changed, 35807 deletions(-) delete mode 100644 packages/embed/build/authentication.html delete mode 100644 packages/embed/build/basic-kyc.html delete mode 100644 packages/embed/build/basic_kyc.html delete mode 100644 packages/embed/build/basic_kyc_pre_select_country.html delete mode 100644 packages/embed/build/basic_kyc_pre_select_id_type.html delete mode 100644 packages/embed/build/basic_kyc_preview_bvn_mfa.html delete mode 100644 packages/embed/build/biometric-kyc.html delete mode 100644 packages/embed/build/biometric_kyc.html delete mode 100644 packages/embed/build/biometric_kyc_pre_select_country.html delete mode 100644 packages/embed/build/biometric_kyc_pre_select_id_type.html delete mode 100644 packages/embed/build/biometric_kyc_preview_bvn_mfa.html delete mode 100644 packages/embed/build/consent-not-required.html delete mode 100644 packages/embed/build/consent-required.html delete mode 100644 packages/embed/build/css/styles.css delete mode 100644 packages/embed/build/demo.html delete mode 100644 packages/embed/build/doc-verification.html delete mode 100644 packages/embed/build/document-verification-legacy-id_types.html delete mode 100644 packages/embed/build/document-verification-pre-select-country.html delete mode 100644 packages/embed/build/document-verification-pre-select-id-type.html delete mode 100644 packages/embed/build/document-verification.html delete mode 100644 packages/embed/build/ekyc-consent-required.html delete mode 100644 packages/embed/build/ekyc.html delete mode 100644 packages/embed/build/enhanced-document-verification.html delete mode 100644 packages/embed/build/enhanced_document_verification.html delete mode 100644 packages/embed/build/enhanced_kyc.html delete mode 100644 packages/embed/build/enhanced_kyc_pre_select_country.html delete mode 100644 packages/embed/build/enhanced_kyc_pre_select_id_type.html delete mode 100644 packages/embed/build/enhanced_kyc_preview_bvn_mfa.html delete mode 100644 packages/embed/build/id-selection.html delete mode 100644 packages/embed/build/identity-verification.html delete mode 100644 packages/embed/build/img/icons/chevron-down.svg delete mode 100644 packages/embed/build/img/icons/chevron-up.svg delete mode 100644 packages/embed/build/index.html delete mode 100644 packages/embed/build/js/basic-kyc.min.js delete mode 100644 packages/embed/build/js/biometric-kyc.min.js delete mode 100644 packages/embed/build/js/components/.eslintrc.cjs delete mode 100644 packages/embed/build/js/demo-ekyc-smartselfie.min.js delete mode 100644 packages/embed/build/js/doc-verification.min.js delete mode 100644 packages/embed/build/js/ekyc.min.js delete mode 100644 packages/embed/build/js/enhanced-document-verification.min.js delete mode 100644 packages/embed/build/js/product-selection.min.js delete mode 100644 packages/embed/build/js/script.min.js delete mode 100644 packages/embed/build/js/smartselfie-auth.min.js delete mode 100644 packages/embed/build/kra-verification-basic-kyc.html delete mode 100644 packages/embed/build/kra-verification-ekyc.html delete mode 100644 packages/embed/build/product-selection.html delete mode 100644 packages/embed/build/smartselfie-auth.html delete mode 100644 packages/embed/build/smartselfie.html delete mode 100644 packages/embed/build/verification-method-selection-single-country-multiple-id-types.html delete mode 100644 packages/embed/build/verification-method-selection-single-country-single-id-type.html delete mode 100644 packages/embed/build/verification-method-selection.html diff --git a/packages/embed/build/authentication.html b/packages/embed/build/authentication.html deleted file mode 100644 index eacaee86..00000000 --- a/packages/embed/build/authentication.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/basic-kyc.html b/packages/embed/build/basic-kyc.html deleted file mode 100644 index 58dcb3e5..00000000 --- a/packages/embed/build/basic-kyc.html +++ /dev/null @@ -1,499 +0,0 @@ - - - - - - SmileIdentity - Basic KYC - - - - - - - - - - - - - - -
-
- -
-

- -

Setting up

- -

- Just a few more seconds -
- We are setting up your verification flow -

- -

- Powered by SmileID - -

-
- - - - - - -
- - - - diff --git a/packages/embed/build/basic_kyc.html b/packages/embed/build/basic_kyc.html deleted file mode 100644 index 4deba76b..00000000 --- a/packages/embed/build/basic_kyc.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/basic_kyc_pre_select_country.html b/packages/embed/build/basic_kyc_pre_select_country.html deleted file mode 100644 index 0a7f2230..00000000 --- a/packages/embed/build/basic_kyc_pre_select_country.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/basic_kyc_pre_select_id_type.html b/packages/embed/build/basic_kyc_pre_select_id_type.html deleted file mode 100644 index 4678e57c..00000000 --- a/packages/embed/build/basic_kyc_pre_select_id_type.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/basic_kyc_preview_bvn_mfa.html b/packages/embed/build/basic_kyc_preview_bvn_mfa.html deleted file mode 100644 index 295c8346..00000000 --- a/packages/embed/build/basic_kyc_preview_bvn_mfa.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/biometric-kyc.html b/packages/embed/build/biometric-kyc.html deleted file mode 100644 index 51eba6f3..00000000 --- a/packages/embed/build/biometric-kyc.html +++ /dev/null @@ -1,646 +0,0 @@ - - - - - - SmileIdentity - Biometric KYC - - - - - - - - - - - - - - -
-
- -
-

- -

Setting up

- -

- Just a few more seconds -
- We are setting up your verification flow -

- -

- Powered by SmileID - -

-
- - - -
- -
- - - - - - - - -
- - - - diff --git a/packages/embed/build/biometric_kyc.html b/packages/embed/build/biometric_kyc.html deleted file mode 100644 index fda22ee7..00000000 --- a/packages/embed/build/biometric_kyc.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/biometric_kyc_pre_select_country.html b/packages/embed/build/biometric_kyc_pre_select_country.html deleted file mode 100644 index 95e54d9b..00000000 --- a/packages/embed/build/biometric_kyc_pre_select_country.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/biometric_kyc_pre_select_id_type.html b/packages/embed/build/biometric_kyc_pre_select_id_type.html deleted file mode 100644 index c0e65417..00000000 --- a/packages/embed/build/biometric_kyc_pre_select_id_type.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/biometric_kyc_preview_bvn_mfa.html b/packages/embed/build/biometric_kyc_preview_bvn_mfa.html deleted file mode 100644 index 3526259a..00000000 --- a/packages/embed/build/biometric_kyc_preview_bvn_mfa.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/consent-not-required.html b/packages/embed/build/consent-not-required.html deleted file mode 100644 index 28a8173b..00000000 --- a/packages/embed/build/consent-not-required.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/consent-required.html b/packages/embed/build/consent-required.html deleted file mode 100644 index 29277c9a..00000000 --- a/packages/embed/build/consent-required.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/css/styles.css b/packages/embed/build/css/styles.css deleted file mode 100644 index 0d8371a1..00000000 --- a/packages/embed/build/css/styles.css +++ /dev/null @@ -1,560 +0,0 @@ -:root { - --flow-space: 1rem; - --color-active: #001096; - --color-default: #2d2b2a; - --color-disabled: #848282; -} - -*, -::after, -::before { - box-sizing: border-box; -} - -blockquote, -body, -dd, -dl, -figure, -h1, -h2, -h3, -h4, -p { - margin: 0; -} - -ol[role="list"], -ul[role="list"] { - list-style: none; -} - -html:focus-within { - scroll-behavior: smooth; -} - -a:not([class]) { - text-decoration-skip-ink: auto; -} - -img, -picture { - max-width: 100%; - display: block; -} - -button, -input, -select, -textarea { - font: inherit; -} - -@media (prefers-reduced-motion: reduce) { - html:focus-within { - scroll-behavior: auto; - } - - *, - ::after, - ::before { - animation-duration: 0s !important; - animation-iteration-count: 1 !important; - transition-duration: 0s !important; - scroll-behavior: auto !important; - } -} - -[hidden] { - display: none !important; -} - -html { - font-family: "DM Sans", sans-serif; -} - -body { - min-height: 100vh; - text-rendering: optimizeSpeed; - color: #1c2334; - line-height: 1.5; - display: flex; - flex-direction: column; - position: relative; -} - -main { - width: 100%; - max-width: 40rem; - background: #ffffff; - border-radius: 2rem; - padding: 2rem; - overflow-y: scroll; - position: absolute; - max-height: 100vh; -} - -@media screen and (min-width: 40rem) { - main { - padding: 2rem 5rem; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - } -} - -@media screen and (min-width: 80rem) { - main { - max-height: 80%; - } -} - -h1 { - font-size: 2.25rem; - font-weight: 600; -} - -section { - position: relative; -} - -form { - --flow-space: 4rem; -} - -form > * { - --flow-space: 1.5rem; -} - -fieldset { - border: none; - margin-left: 0; - margin-right: 0; - padding: 0; -} - -label, -input, -select, -textarea { - --flow-space: 0.5rem; - display: block; - width: 100%; -} - -label, -legend { - color: black; - font-weight: 500; - padding: 0; -} - -input, -select, -textarea { - border: 1px solid #d1d8d6; - border-radius: 0.5rem; - padding: 0.75rem 1rem; -} - -input, -select { - height: 3rem; -} - -textarea { - min-height: 10rem; -} - -select { - -webkit-appearance: none; - appearance: none; - background-image: url(../img/icons/chevron-down.svg); - background-repeat: no-repeat, repeat; - background-position: - right 10px top 50%, - 0 0; - background-size: - 24px auto, - 100%; -} - -button { - --button-color: var(--color-default); - --flow-space: 3rem; - -webkit-appearance: none; - -moz-appearance: none; - align-items: center; - appearance: none; - background-color: transparent; - border-radius: 2.5rem; - border: none; - color: #ffffff; - cursor: pointer; - display: inline-flex; - font-size: 20px; - font-weight: 500; - inline-size: 100%; - justify-content: center; - letter-spacing: 0.05ch; - line-height: 1; - padding: 1rem 2.5rem; - text-align: center; - text-decoration: none; -} - -button[data-variant="solid"] { - background-color: var(--button-color); - border: 2px solid var(--button-color); -} - -button[data-variant="outline"] { - color: var(--button-color); - border: 2px solid var(--button-color); -} - -button[data-variant="ghost"] { - color: var(--button-color); - padding: 0px; -} - -button:hover, -button:focus, -button:active { - --button-color: var(--color-active); -} - -button:disabled { - --button-color: var(--color-disabled); -} - -button[data-type="icon"] { - align-items: center; - background-color: transparent; - border: 0; - cursor: pointer; - display: flex; - padding: 0; - width: auto; -} - -[disabled] { - cursor: not-allowed; - filter: opacity(0.7); -} - -.visually-hidden { - border: 0; - clip: rect(1px 1px 1px 1px); - clip: rect(1px, 1px, 1px, 1px); - height: auto; - margin: 0; - overflow: hidden; - padding: 0; - position: absolute; - white-space: nowrap; - width: 1px; -} - -.flow { -} - -.flow > * + * { - margin-top: var(--flow-space); -} - -.center { - text-align: center; -} - -.split-pair > * + * { - margin-top: var(--flow-space); -} - -@media screen and (min-width: 45em) { - .split-pair { - display: flex; - align-items: center; - gap: 2rem; - } - - .split-pair[data-variant="start"] { - align-items: start; - } - - .split-pair > * { - flex-grow: 1; - flex-basis: 50%; - } - - .split-pair > * + * { - margin-top: 0; - } -} - -.input-group { - --flow-space: 1.5rem; -} - -.input-group > * { - --flow-space: 1.5rem; -} - -.justify-right { - justify-content: end !important; -} - -.nav { - display: flex; - justify-content: space-between; -} - -.back-wrapper { - display: flex; - align-items: center; -} - -.back-button { - display: block !important; -} - -.back-button-text { - font-size: 11px; - line-height: 11px; - color: rgb(21, 31, 114); -} - -.user-details { - padding: 2rem 5rem; -} - -.demo-tip { - align-items: center; - background-color: #f5fcff; - border-radius: 0.75rem; - border: 1px solid #a9d1e8; - color: inherit; - display: flex; - font-size: 0.875rem; - max-width: 36rem; - padding: 1rem; - text-align: left; - text-decoration: none; -} - -.demo-tip[data-variant="yellow"] { - background-color: #fff8ee; - border: #fff8ee; -} - -.demo-tip > * + * { - margin-left: 0.5rem; -} - -#error, -.validation-message { - color: red; - text-transform: capitalize; -} - -.dob { - --flow-space: 1rem; - display: flex; - gap: 1rem; -} - -@media screen and (min-width: 40rem) { - .dob { - gap: 2rem; - } -} - -.credits { - --flow-space: 2rem; - margin-inline: auto; - max-inline-size: 10rem; -} - -.company-name { - text-transform: uppercase; - letter-spacing: 0.1rem; - border-left: 1px solid #cecece; - margin-left: 0.75rem; - padding-left: 0.75rem; - display: inline-flex; - align-items: center; -} - -.company-name svg { - margin-right: 0.5rem; -} - -@keyframes spin { - 0% { - transform: translate3d(-50%, -50%, 0) rotate(0deg); - } - 100% { - transform: translate3d(-50%, -50%, 0) rotate(360deg); - } -} - -.spinner { - animation: 1.5s linear infinite spin; - animation-play-state: inherit; - border: solid 1rem #cfd0d1; - border-bottom-color: var(--color-active); - border-radius: 50%; - content: ""; - display: block; - height: 10rem; - width: 10rem; - will-change: transform; - position: relative; - top: 5rem; - left: 50%; -} - -@keyframes rotate { - 100% { - transform: rotate(360deg); - } -} - -@keyframes dash { - 0% { - stroke-dasharray: 1, 150; - stroke-dashoffset: 0; - } - 50% { - stroke-dasharray: 90, 150; - stroke-dashoffset: -35; - } - 100% { - stroke-dasharray: 90, 150; - stroke-dashoffset: -124; - } -} - -/** - * Combobox Styles - */ -smileid-combobox { - display: block; - position: relative; - inline-size: 100%; -} - -smileid-combobox-trigger { - border: 1px solid #d1d8d6; - border-radius: 0.5rem; - display: block; - inline-size: 100%; -} - -smileid-combobox-trigger > * { - inline-size: 100%; - block-size: 3rem; - display: inline-flex; - align-items: center; - padding: 0.75rem 1rem; -} - -smileid-combobox-trigger svg { - margin-inline-end: 0.5rem; - flex-shrink: 0; -} - -smileid-combobox-trigger input { - appearance: none; - border: none; - background-color: transparent; - padding: 0; -} - -smileid-combobox-trigger button { - color: initial; - display: initial; - font-size: initial; - font-weight: initial; - text-align: initial; - background-repeat: no-repeat, repeat; - background-position: - right 1rem top 50%, - 0 0; - background-size: - 24px auto, - 100%; -} - -smileid-combobox-trigger input ~ button { - display: block; - padding: 0px; - flex-shrink: 0; - background-position: right 0px; - inline-size: 24px; - block-size: 24px; -} - -smileid-combobox-trigger[expanded="true"] button { - background-image: url(../img/icons/chevron-up.svg); -} - -smileid-combobox-trigger[expanded="false"] button { - background-image: url(../img/icons/chevron-down.svg); -} - -smileid-combobox-trigger:focus-within { - outline: 5px auto Highlight; - outline: 5px auto -webkit-focus-ring-color; -} - -smileid-combobox-trigger button:focus, -smileid-combobox-trigger input:focus { - outline: none; -} - -smileid-combobox-listbox { - background-color: white; - - inline-size: 100%; - max-block-size: 10rem; - - margin-block-start: 0.5rem; - flex-direction: column; - overflow-y: scroll; - border: 1px solid black; - border-radius: 0.25rem; - - position: absolute; - top: 3rem; - z-index: 1; -} - -smileid-combobox-trigger[expanded="false"] ~ smileid-combobox-listbox { - display: none; -} - -smileid-combobox-trigger[expanded="true"] ~ smileid-combobox-listbox { - display: flex; -} - -smileid-combobox-option { - box-sizing: border-box; - inline-size: 100%; - display: block; - padding: 0.75rem 1rem; -} - -smileid-combobox-option:hover, -smileid-combobox-option[tabindex="0"] { - background-color: #f9f0e7; -} - -smileid-combobox-option[aria-selected] { - background-color: #151f72; - color: #fff; -} - -smileid-combobox-option[hidden] { - display: none; -} diff --git a/packages/embed/build/demo.html b/packages/embed/build/demo.html deleted file mode 100644 index f0af257b..00000000 --- a/packages/embed/build/demo.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/doc-verification.html b/packages/embed/build/doc-verification.html deleted file mode 100644 index 3e5f72b6..00000000 --- a/packages/embed/build/doc-verification.html +++ /dev/null @@ -1,417 +0,0 @@ - - - - - - Document Verification — Smile Identity - - - - - - - - - - - - - - -
-
- -
-

- -

Setting up

- -

- Just a few more seconds -
- We are setting up your verification flow -

- -

- Powered by SmileID - -

-
- - - - - - - - - - -
- - - - diff --git a/packages/embed/build/document-verification-legacy-id_types.html b/packages/embed/build/document-verification-legacy-id_types.html deleted file mode 100644 index 640bc0f3..00000000 --- a/packages/embed/build/document-verification-legacy-id_types.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/document-verification-pre-select-country.html b/packages/embed/build/document-verification-pre-select-country.html deleted file mode 100644 index 1889e2cf..00000000 --- a/packages/embed/build/document-verification-pre-select-country.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/document-verification-pre-select-id-type.html b/packages/embed/build/document-verification-pre-select-id-type.html deleted file mode 100644 index 7d74eca3..00000000 --- a/packages/embed/build/document-verification-pre-select-id-type.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/document-verification.html b/packages/embed/build/document-verification.html deleted file mode 100644 index a25b01fe..00000000 --- a/packages/embed/build/document-verification.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/ekyc-consent-required.html b/packages/embed/build/ekyc-consent-required.html deleted file mode 100644 index 6d61cb48..00000000 --- a/packages/embed/build/ekyc-consent-required.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/ekyc.html b/packages/embed/build/ekyc.html deleted file mode 100644 index a9180286..00000000 --- a/packages/embed/build/ekyc.html +++ /dev/null @@ -1,500 +0,0 @@ - - - - - - SmileIdentity - Enhanced KYC - - - - - - - - - - - - - - -
-
- -
-

- -

Setting up

- -

- Just a few more seconds -
- We are setting up your verification flow -

- -

- Powered by SmileID - -

-
- - - - - - -
- - - - diff --git a/packages/embed/build/enhanced-document-verification.html b/packages/embed/build/enhanced-document-verification.html deleted file mode 100644 index ff492f9e..00000000 --- a/packages/embed/build/enhanced-document-verification.html +++ /dev/null @@ -1,417 +0,0 @@ - - - - - - Document Verification — Smile Identity - - - - - - - - - - - - - - -
-
- -
-

- -

Setting up

- -

- Just a few more seconds -
- We are setting up your verification flow -

- -

- Powered by SmileID - -

-
- - - - - - - - - - -
- - - - diff --git a/packages/embed/build/enhanced_document_verification.html b/packages/embed/build/enhanced_document_verification.html deleted file mode 100644 index 1f8e6549..00000000 --- a/packages/embed/build/enhanced_document_verification.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/enhanced_kyc.html b/packages/embed/build/enhanced_kyc.html deleted file mode 100644 index 69b62ecd..00000000 --- a/packages/embed/build/enhanced_kyc.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/enhanced_kyc_pre_select_country.html b/packages/embed/build/enhanced_kyc_pre_select_country.html deleted file mode 100644 index 25f7577b..00000000 --- a/packages/embed/build/enhanced_kyc_pre_select_country.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/enhanced_kyc_pre_select_id_type.html b/packages/embed/build/enhanced_kyc_pre_select_id_type.html deleted file mode 100644 index d984ee52..00000000 --- a/packages/embed/build/enhanced_kyc_pre_select_id_type.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/enhanced_kyc_preview_bvn_mfa.html b/packages/embed/build/enhanced_kyc_preview_bvn_mfa.html deleted file mode 100644 index 9465a038..00000000 --- a/packages/embed/build/enhanced_kyc_preview_bvn_mfa.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/id-selection.html b/packages/embed/build/id-selection.html deleted file mode 100644 index 06380f49..00000000 --- a/packages/embed/build/id-selection.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/identity-verification.html b/packages/embed/build/identity-verification.html deleted file mode 100644 index f7b3c326..00000000 --- a/packages/embed/build/identity-verification.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/img/icons/chevron-down.svg b/packages/embed/build/img/icons/chevron-down.svg deleted file mode 100644 index 01d7949f..00000000 --- a/packages/embed/build/img/icons/chevron-down.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/packages/embed/build/img/icons/chevron-up.svg b/packages/embed/build/img/icons/chevron-up.svg deleted file mode 100644 index be91aef3..00000000 --- a/packages/embed/build/img/icons/chevron-up.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/embed/build/index.html b/packages/embed/build/index.html deleted file mode 100644 index 6708f78f..00000000 --- a/packages/embed/build/index.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/js/basic-kyc.min.js b/packages/embed/build/js/basic-kyc.min.js deleted file mode 100644 index cc7ca198..00000000 --- a/packages/embed/build/js/basic-kyc.min.js +++ /dev/null @@ -1,3751 +0,0 @@ -(() => { - var __create = Object.create; - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __getProtoOf = Object.getPrototypeOf; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __commonJS = (cb, mod) => function __require() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod - )); - - // ../../node_modules/validate.js/validate.js - var require_validate = __commonJS({ - "../../node_modules/validate.js/validate.js"(exports, module) { - (function(exports2, module2, define2) { - "use strict"; - var validate3 = function(attributes, constraints, options) { - options = v.extend({}, v.options, options); - var results = v.runValidations(attributes, constraints, options), attr, validator; - if (results.some(function(r) { - return v.isPromise(r.error); - })) { - throw new Error("Use validate.async if you want support for promises"); - } - return validate3.processValidationResults(results, options); - }; - var v = validate3; - v.extend = function(obj) { - [].slice.call(arguments, 1).forEach(function(source) { - for (var attr in source) { - obj[attr] = source[attr]; - } - }); - return obj; - }; - v.extend(validate3, { - // This is the version of the library as a semver. - // The toString function will allow it to be coerced into a string - version: { - major: 0, - minor: 13, - patch: 1, - metadata: null, - toString: function() { - var version2 = v.format("%{major}.%{minor}.%{patch}", v.version); - if (!v.isEmpty(v.version.metadata)) { - version2 += "+" + v.version.metadata; - } - return version2; - } - }, - // Below is the dependencies that are used in validate.js - // The constructor of the Promise implementation. - // If you are using Q.js, RSVP or any other A+ compatible implementation - // override this attribute to be the constructor of that promise. - // Since jQuery promises aren't A+ compatible they won't work. - Promise: typeof Promise !== "undefined" ? Promise : ( - /* istanbul ignore next */ - null - ), - EMPTY_STRING_REGEXP: /^\s*$/, - // Runs the validators specified by the constraints object. - // Will return an array of the format: - // [{attribute: "", error: ""}, ...] - runValidations: function(attributes, constraints, options) { - var results = [], attr, validatorName, value, validators, validator, validatorOptions, error; - if (v.isDomElement(attributes) || v.isJqueryElement(attributes)) { - attributes = v.collectFormValues(attributes); - } - for (attr in constraints) { - value = v.getDeepObjectValue(attributes, attr); - validators = v.result(constraints[attr], value, attributes, attr, options, constraints); - for (validatorName in validators) { - validator = v.validators[validatorName]; - if (!validator) { - error = v.format("Unknown validator %{name}", { name: validatorName }); - throw new Error(error); - } - validatorOptions = validators[validatorName]; - validatorOptions = v.result(validatorOptions, value, attributes, attr, options, constraints); - if (!validatorOptions) { - continue; - } - results.push({ - attribute: attr, - value, - validator: validatorName, - globalOptions: options, - attributes, - options: validatorOptions, - error: validator.call( - validator, - value, - validatorOptions, - attr, - attributes, - options - ) - }); - } - } - return results; - }, - // Takes the output from runValidations and converts it to the correct - // output format. - processValidationResults: function(errors, options) { - errors = v.pruneEmptyErrors(errors, options); - errors = v.expandMultipleErrors(errors, options); - errors = v.convertErrorMessages(errors, options); - var format = options.format || "grouped"; - if (typeof v.formatters[format] === "function") { - errors = v.formatters[format](errors); - } else { - throw new Error(v.format("Unknown format %{format}", options)); - } - return v.isEmpty(errors) ? void 0 : errors; - }, - // Runs the validations with support for promises. - // This function will return a promise that is settled when all the - // validation promises have been completed. - // It can be called even if no validations returned a promise. - async: function(attributes, constraints, options) { - options = v.extend({}, v.async.options, options); - var WrapErrors = options.wrapErrors || function(errors) { - return errors; - }; - if (options.cleanAttributes !== false) { - attributes = v.cleanAttributes(attributes, constraints); - } - var results = v.runValidations(attributes, constraints, options); - return new v.Promise(function(resolve, reject) { - v.waitForResults(results).then(function() { - var errors = v.processValidationResults(results, options); - if (errors) { - reject(new WrapErrors(errors, options, attributes, constraints)); - } else { - resolve(attributes); - } - }, function(err) { - reject(err); - }); - }); - }, - single: function(value, constraints, options) { - options = v.extend({}, v.single.options, options, { - format: "flat", - fullMessages: false - }); - return v({ single: value }, { single: constraints }, options); - }, - // Returns a promise that is resolved when all promises in the results array - // are settled. The promise returned from this function is always resolved, - // never rejected. - // This function modifies the input argument, it replaces the promises - // with the value returned from the promise. - waitForResults: function(results) { - return results.reduce(function(memo, result) { - if (!v.isPromise(result.error)) { - return memo; - } - return memo.then(function() { - return result.error.then(function(error) { - result.error = error || null; - }); - }); - }, new v.Promise(function(r) { - r(); - })); - }, - // If the given argument is a call: function the and: function return the value - // otherwise just return the value. Additional arguments will be passed as - // arguments to the function. - // Example: - // ``` - // result('foo') // 'foo' - // result(Math.max, 1, 2) // 2 - // ``` - result: function(value) { - var args = [].slice.call(arguments, 1); - if (typeof value === "function") { - value = value.apply(null, args); - } - return value; - }, - // Checks if the value is a number. This function does not consider NaN a - // number like many other `isNumber` functions do. - isNumber: function(value) { - return typeof value === "number" && !isNaN(value); - }, - // Returns false if the object is not a function - isFunction: function(value) { - return typeof value === "function"; - }, - // A simple check to verify that the value is an integer. Uses `isNumber` - // and a simple modulo check. - isInteger: function(value) { - return v.isNumber(value) && value % 1 === 0; - }, - // Checks if the value is a boolean - isBoolean: function(value) { - return typeof value === "boolean"; - }, - // Uses the `Object` function to check if the given argument is an object. - isObject: function(obj) { - return obj === Object(obj); - }, - // Simply checks if the object is an instance of a date - isDate: function(obj) { - return obj instanceof Date; - }, - // Returns false if the object is `null` of `undefined` - isDefined: function(obj) { - return obj !== null && obj !== void 0; - }, - // Checks if the given argument is a promise. Anything with a `then` - // function is considered a promise. - isPromise: function(p) { - return !!p && v.isFunction(p.then); - }, - isJqueryElement: function(o) { - return o && v.isString(o.jquery); - }, - isDomElement: function(o) { - if (!o) { - return false; - } - if (!o.querySelectorAll || !o.querySelector) { - return false; - } - if (v.isObject(document) && o === document) { - return true; - } - if (typeof HTMLElement === "object") { - return o instanceof HTMLElement; - } else { - return o && typeof o === "object" && o !== null && o.nodeType === 1 && typeof o.nodeName === "string"; - } - }, - isEmpty: function(value) { - var attr; - if (!v.isDefined(value)) { - return true; - } - if (v.isFunction(value)) { - return false; - } - if (v.isString(value)) { - return v.EMPTY_STRING_REGEXP.test(value); - } - if (v.isArray(value)) { - return value.length === 0; - } - if (v.isDate(value)) { - return false; - } - if (v.isObject(value)) { - for (attr in value) { - return false; - } - return true; - } - return false; - }, - // Formats the specified strings with the given values like so: - // ``` - // format("Foo: %{foo}", {foo: "bar"}) // "Foo bar" - // ``` - // If you want to write %{...} without having it replaced simply - // prefix it with % like this `Foo: %%{foo}` and it will be returned - // as `"Foo: %{foo}"` - format: v.extend(function(str, vals) { - if (!v.isString(str)) { - return str; - } - return str.replace(v.format.FORMAT_REGEXP, function(m0, m1, m2) { - if (m1 === "%") { - return "%{" + m2 + "}"; - } else { - return String(vals[m2]); - } - }); - }, { - // Finds %{key} style patterns in the given string - FORMAT_REGEXP: /(%?)%\{([^\}]+)\}/g - }), - // "Prettifies" the given string. - // Prettifying means replacing [.\_-] with spaces as well as splitting - // camel case words. - prettify: function(str) { - if (v.isNumber(str)) { - if (str * 100 % 1 === 0) { - return "" + str; - } else { - return parseFloat(Math.round(str * 100) / 100).toFixed(2); - } - } - if (v.isArray(str)) { - return str.map(function(s) { - return v.prettify(s); - }).join(", "); - } - if (v.isObject(str)) { - if (!v.isDefined(str.toString)) { - return JSON.stringify(str); - } - return str.toString(); - } - str = "" + str; - return str.replace(/([^\s])\.([^\s])/g, "$1 $2").replace(/\\+/g, "").replace(/[_-]/g, " ").replace(/([a-z])([A-Z])/g, function(m0, m1, m2) { - return "" + m1 + " " + m2.toLowerCase(); - }).toLowerCase(); - }, - stringifyValue: function(value, options) { - var prettify = options && options.prettify || v.prettify; - return prettify(value); - }, - isString: function(value) { - return typeof value === "string"; - }, - isArray: function(value) { - return {}.toString.call(value) === "[object Array]"; - }, - // Checks if the object is a hash, which is equivalent to an object that - // is neither an array nor a function. - isHash: function(value) { - return v.isObject(value) && !v.isArray(value) && !v.isFunction(value); - }, - contains: function(obj, value) { - if (!v.isDefined(obj)) { - return false; - } - if (v.isArray(obj)) { - return obj.indexOf(value) !== -1; - } - return value in obj; - }, - unique: function(array) { - if (!v.isArray(array)) { - return array; - } - return array.filter(function(el, index, array2) { - return array2.indexOf(el) == index; - }); - }, - forEachKeyInKeypath: function(object, keypath, callback) { - if (!v.isString(keypath)) { - return void 0; - } - var key = "", i, escape = false; - for (i = 0; i < keypath.length; ++i) { - switch (keypath[i]) { - case ".": - if (escape) { - escape = false; - key += "."; - } else { - object = callback(object, key, false); - key = ""; - } - break; - case "\\": - if (escape) { - escape = false; - key += "\\"; - } else { - escape = true; - } - break; - default: - escape = false; - key += keypath[i]; - break; - } - } - return callback(object, key, true); - }, - getDeepObjectValue: function(obj, keypath) { - if (!v.isObject(obj)) { - return void 0; - } - return v.forEachKeyInKeypath(obj, keypath, function(obj2, key) { - if (v.isObject(obj2)) { - return obj2[key]; - } - }); - }, - // This returns an object with all the values of the form. - // It uses the input name as key and the value as value - // So for example this: - // - // would return: - // {email: "foo@bar.com"} - collectFormValues: function(form, options) { - var values = {}, i, j, input, inputs, option, value; - if (v.isJqueryElement(form)) { - form = form[0]; - } - if (!form) { - return values; - } - options = options || {}; - inputs = form.querySelectorAll("input[name], textarea[name]"); - for (i = 0; i < inputs.length; ++i) { - input = inputs.item(i); - if (v.isDefined(input.getAttribute("data-ignored"))) { - continue; - } - var name = input.name.replace(/\./g, "\\\\."); - value = v.sanitizeFormValue(input.value, options); - if (input.type === "number") { - value = value ? +value : null; - } else if (input.type === "checkbox") { - if (input.attributes.value) { - if (!input.checked) { - value = values[name] || null; - } - } else { - value = input.checked; - } - } else if (input.type === "radio") { - if (!input.checked) { - value = values[name] || null; - } - } - values[name] = value; - } - inputs = form.querySelectorAll("select[name]"); - for (i = 0; i < inputs.length; ++i) { - input = inputs.item(i); - if (v.isDefined(input.getAttribute("data-ignored"))) { - continue; - } - if (input.multiple) { - value = []; - for (j in input.options) { - option = input.options[j]; - if (option && option.selected) { - value.push(v.sanitizeFormValue(option.value, options)); - } - } - } else { - var _val = typeof input.options[input.selectedIndex] !== "undefined" ? input.options[input.selectedIndex].value : ( - /* istanbul ignore next */ - "" - ); - value = v.sanitizeFormValue(_val, options); - } - values[input.name] = value; - } - return values; - }, - sanitizeFormValue: function(value, options) { - if (options.trim && v.isString(value)) { - value = value.trim(); - } - if (options.nullify !== false && value === "") { - return null; - } - return value; - }, - capitalize: function(str) { - if (!v.isString(str)) { - return str; - } - return str[0].toUpperCase() + str.slice(1); - }, - // Remove all errors who's error attribute is empty (null or undefined) - pruneEmptyErrors: function(errors) { - return errors.filter(function(error) { - return !v.isEmpty(error.error); - }); - }, - // In - // [{error: ["err1", "err2"], ...}] - // Out - // [{error: "err1", ...}, {error: "err2", ...}] - // - // All attributes in an error with multiple messages are duplicated - // when expanding the errors. - expandMultipleErrors: function(errors) { - var ret = []; - errors.forEach(function(error) { - if (v.isArray(error.error)) { - error.error.forEach(function(msg) { - ret.push(v.extend({}, error, { error: msg })); - }); - } else { - ret.push(error); - } - }); - return ret; - }, - // Converts the error mesages by prepending the attribute name unless the - // message is prefixed by ^ - convertErrorMessages: function(errors, options) { - options = options || {}; - var ret = [], prettify = options.prettify || v.prettify; - errors.forEach(function(errorInfo) { - var error = v.result( - errorInfo.error, - errorInfo.value, - errorInfo.attribute, - errorInfo.options, - errorInfo.attributes, - errorInfo.globalOptions - ); - if (!v.isString(error)) { - ret.push(errorInfo); - return; - } - if (error[0] === "^") { - error = error.slice(1); - } else if (options.fullMessages !== false) { - error = v.capitalize(prettify(errorInfo.attribute)) + " " + error; - } - error = error.replace(/\\\^/g, "^"); - error = v.format(error, { - value: v.stringifyValue(errorInfo.value, options) - }); - ret.push(v.extend({}, errorInfo, { error })); - }); - return ret; - }, - // In: - // [{attribute: "", ...}] - // Out: - // {"": [{attribute: "", ...}]} - groupErrorsByAttribute: function(errors) { - var ret = {}; - errors.forEach(function(error) { - var list = ret[error.attribute]; - if (list) { - list.push(error); - } else { - ret[error.attribute] = [error]; - } - }); - return ret; - }, - // In: - // [{error: "", ...}, {error: "", ...}] - // Out: - // ["", ""] - flattenErrorsToArray: function(errors) { - return errors.map(function(error) { - return error.error; - }).filter(function(value, index, self) { - return self.indexOf(value) === index; - }); - }, - cleanAttributes: function(attributes, whitelist) { - function whitelistCreator(obj, key, last) { - if (v.isObject(obj[key])) { - return obj[key]; - } - return obj[key] = last ? true : {}; - } - function buildObjectWhitelist(whitelist2) { - var ow = {}, lastObject, attr; - for (attr in whitelist2) { - if (!whitelist2[attr]) { - continue; - } - v.forEachKeyInKeypath(ow, attr, whitelistCreator); - } - return ow; - } - function cleanRecursive(attributes2, whitelist2) { - if (!v.isObject(attributes2)) { - return attributes2; - } - var ret = v.extend({}, attributes2), w, attribute; - for (attribute in attributes2) { - w = whitelist2[attribute]; - if (v.isObject(w)) { - ret[attribute] = cleanRecursive(ret[attribute], w); - } else if (!w) { - delete ret[attribute]; - } - } - return ret; - } - if (!v.isObject(whitelist) || !v.isObject(attributes)) { - return {}; - } - whitelist = buildObjectWhitelist(whitelist); - return cleanRecursive(attributes, whitelist); - }, - exposeModule: function(validate4, root, exports3, module3, define3) { - if (exports3) { - if (module3 && module3.exports) { - exports3 = module3.exports = validate4; - } - exports3.validate = validate4; - } else { - root.validate = validate4; - if (validate4.isFunction(define3) && define3.amd) { - define3([], function() { - return validate4; - }); - } - } - }, - warn: function(msg) { - if (typeof console !== "undefined" && console.warn) { - console.warn("[validate.js] " + msg); - } - }, - error: function(msg) { - if (typeof console !== "undefined" && console.error) { - console.error("[validate.js] " + msg); - } - } - }); - validate3.validators = { - // Presence validates that the value isn't empty - presence: function(value, options) { - options = v.extend({}, this.options, options); - if (options.allowEmpty !== false ? !v.isDefined(value) : v.isEmpty(value)) { - return options.message || this.message || "can't be blank"; - } - }, - length: function(value, options, attribute) { - if (!v.isDefined(value)) { - return; - } - options = v.extend({}, this.options, options); - var is = options.is, maximum = options.maximum, minimum = options.minimum, tokenizer = options.tokenizer || function(val) { - return val; - }, err, errors = []; - value = tokenizer(value); - var length = value.length; - if (!v.isNumber(length)) { - return options.message || this.notValid || "has an incorrect length"; - } - if (v.isNumber(is) && length !== is) { - err = options.wrongLength || this.wrongLength || "is the wrong length (should be %{count} characters)"; - errors.push(v.format(err, { count: is })); - } - if (v.isNumber(minimum) && length < minimum) { - err = options.tooShort || this.tooShort || "is too short (minimum is %{count} characters)"; - errors.push(v.format(err, { count: minimum })); - } - if (v.isNumber(maximum) && length > maximum) { - err = options.tooLong || this.tooLong || "is too long (maximum is %{count} characters)"; - errors.push(v.format(err, { count: maximum })); - } - if (errors.length > 0) { - return options.message || errors; - } - }, - numericality: function(value, options, attribute, attributes, globalOptions) { - if (!v.isDefined(value)) { - return; - } - options = v.extend({}, this.options, options); - var errors = [], name, count, checks = { - greaterThan: function(v2, c) { - return v2 > c; - }, - greaterThanOrEqualTo: function(v2, c) { - return v2 >= c; - }, - equalTo: function(v2, c) { - return v2 === c; - }, - lessThan: function(v2, c) { - return v2 < c; - }, - lessThanOrEqualTo: function(v2, c) { - return v2 <= c; - }, - divisibleBy: function(v2, c) { - return v2 % c === 0; - } - }, prettify = options.prettify || globalOptions && globalOptions.prettify || v.prettify; - if (v.isString(value) && options.strict) { - var pattern = "^-?(0|[1-9]\\d*)"; - if (!options.onlyInteger) { - pattern += "(\\.\\d+)?"; - } - pattern += "$"; - if (!new RegExp(pattern).test(value)) { - return options.message || options.notValid || this.notValid || this.message || "must be a valid number"; - } - } - if (options.noStrings !== true && v.isString(value) && !v.isEmpty(value)) { - value = +value; - } - if (!v.isNumber(value)) { - return options.message || options.notValid || this.notValid || this.message || "is not a number"; - } - if (options.onlyInteger && !v.isInteger(value)) { - return options.message || options.notInteger || this.notInteger || this.message || "must be an integer"; - } - for (name in checks) { - count = options[name]; - if (v.isNumber(count) && !checks[name](value, count)) { - var key = "not" + v.capitalize(name); - var msg = options[key] || this[key] || this.message || "must be %{type} %{count}"; - errors.push(v.format(msg, { - count, - type: prettify(name) - })); - } - } - if (options.odd && value % 2 !== 1) { - errors.push(options.notOdd || this.notOdd || this.message || "must be odd"); - } - if (options.even && value % 2 !== 0) { - errors.push(options.notEven || this.notEven || this.message || "must be even"); - } - if (errors.length) { - return options.message || errors; - } - }, - datetime: v.extend(function(value, options) { - if (!v.isFunction(this.parse) || !v.isFunction(this.format)) { - throw new Error("Both the parse and format functions needs to be set to use the datetime/date validator"); - } - if (!v.isDefined(value)) { - return; - } - options = v.extend({}, this.options, options); - var err, errors = [], earliest = options.earliest ? this.parse(options.earliest, options) : NaN, latest = options.latest ? this.parse(options.latest, options) : NaN; - value = this.parse(value, options); - if (isNaN(value) || options.dateOnly && value % 864e5 !== 0) { - err = options.notValid || options.message || this.notValid || "must be a valid date"; - return v.format(err, { value: arguments[0] }); - } - if (!isNaN(earliest) && value < earliest) { - err = options.tooEarly || options.message || this.tooEarly || "must be no earlier than %{date}"; - err = v.format(err, { - value: this.format(value, options), - date: this.format(earliest, options) - }); - errors.push(err); - } - if (!isNaN(latest) && value > latest) { - err = options.tooLate || options.message || this.tooLate || "must be no later than %{date}"; - err = v.format(err, { - date: this.format(latest, options), - value: this.format(value, options) - }); - errors.push(err); - } - if (errors.length) { - return v.unique(errors); - } - }, { - parse: null, - format: null - }), - date: function(value, options) { - options = v.extend({}, options, { dateOnly: true }); - return v.validators.datetime.call(v.validators.datetime, value, options); - }, - format: function(value, options) { - if (v.isString(options) || options instanceof RegExp) { - options = { pattern: options }; - } - options = v.extend({}, this.options, options); - var message = options.message || this.message || "is invalid", pattern = options.pattern, match; - if (!v.isDefined(value)) { - return; - } - if (!v.isString(value)) { - return message; - } - if (v.isString(pattern)) { - pattern = new RegExp(options.pattern, options.flags); - } - match = pattern.exec(value); - if (!match || match[0].length != value.length) { - return message; - } - }, - inclusion: function(value, options) { - if (!v.isDefined(value)) { - return; - } - if (v.isArray(options)) { - options = { within: options }; - } - options = v.extend({}, this.options, options); - if (v.contains(options.within, value)) { - return; - } - var message = options.message || this.message || "^%{value} is not included in the list"; - return v.format(message, { value }); - }, - exclusion: function(value, options) { - if (!v.isDefined(value)) { - return; - } - if (v.isArray(options)) { - options = { within: options }; - } - options = v.extend({}, this.options, options); - if (!v.contains(options.within, value)) { - return; - } - var message = options.message || this.message || "^%{value} is restricted"; - if (v.isString(options.within[value])) { - value = options.within[value]; - } - return v.format(message, { value }); - }, - email: v.extend(function(value, options) { - options = v.extend({}, this.options, options); - var message = options.message || this.message || "is not a valid email"; - if (!v.isDefined(value)) { - return; - } - if (!v.isString(value)) { - return message; - } - if (!this.PATTERN.exec(value)) { - return message; - } - }, { - PATTERN: /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i - }), - equality: function(value, options, attribute, attributes, globalOptions) { - if (!v.isDefined(value)) { - return; - } - if (v.isString(options)) { - options = { attribute: options }; - } - options = v.extend({}, this.options, options); - var message = options.message || this.message || "is not equal to %{attribute}"; - if (v.isEmpty(options.attribute) || !v.isString(options.attribute)) { - throw new Error("The attribute must be a non empty string"); - } - var otherValue = v.getDeepObjectValue(attributes, options.attribute), comparator = options.comparator || function(v1, v2) { - return v1 === v2; - }, prettify = options.prettify || globalOptions && globalOptions.prettify || v.prettify; - if (!comparator(value, otherValue, options, attribute, attributes)) { - return v.format(message, { attribute: prettify(options.attribute) }); - } - }, - // A URL validator that is used to validate URLs with the ability to - // restrict schemes and some domains. - url: function(value, options) { - if (!v.isDefined(value)) { - return; - } - options = v.extend({}, this.options, options); - var message = options.message || this.message || "is not a valid url", schemes = options.schemes || this.schemes || ["http", "https"], allowLocal = options.allowLocal || this.allowLocal || false, allowDataUrl = options.allowDataUrl || this.allowDataUrl || false; - if (!v.isString(value)) { - return message; - } - var regex = "^(?:(?:" + schemes.join("|") + ")://)(?:\\S+(?::\\S*)?@)?(?:"; - var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))"; - if (allowLocal) { - tld += "?"; - } else { - regex += // IP address exclusion - // private & local networks - "(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})"; - } - regex += // IP address dotted notation octets - // excludes loopback network 0.0.0.0 - // excludes reserved space >= 224.0.0.0 - // excludes network & broacast addresses - // (first & last IP address of each class) - "(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*" + tld + ")(?::\\d{2,5})?(?:[/?#]\\S*)?$"; - if (allowDataUrl) { - var mediaType = "\\w+\\/[-+.\\w]+(?:;[\\w=]+)*"; - var urlchar = "[A-Za-z0-9-_.!~\\*'();\\/?:@&=+$,%]*"; - var dataurl = "data:(?:" + mediaType + ")?(?:;base64)?," + urlchar; - regex = "(?:" + regex + ")|(?:^" + dataurl + "$)"; - } - var PATTERN = new RegExp(regex, "i"); - if (!PATTERN.exec(value)) { - return message; - } - }, - type: v.extend(function(value, originalOptions, attribute, attributes, globalOptions) { - if (v.isString(originalOptions)) { - originalOptions = { type: originalOptions }; - } - if (!v.isDefined(value)) { - return; - } - var options = v.extend({}, this.options, originalOptions); - var type = options.type; - if (!v.isDefined(type)) { - throw new Error("No type was specified"); - } - var check; - if (v.isFunction(type)) { - check = type; - } else { - check = this.types[type]; - } - if (!v.isFunction(check)) { - throw new Error("validate.validators.type.types." + type + " must be a function."); - } - if (!check(value, options, attribute, attributes, globalOptions)) { - var message = originalOptions.message || this.messages[type] || this.message || options.message || (v.isFunction(type) ? "must be of the correct type" : "must be of type %{type}"); - if (v.isFunction(message)) { - message = message(value, originalOptions, attribute, attributes, globalOptions); - } - return v.format(message, { attribute: v.prettify(attribute), type }); - } - }, { - types: { - object: function(value) { - return v.isObject(value) && !v.isArray(value); - }, - array: v.isArray, - integer: v.isInteger, - number: v.isNumber, - string: v.isString, - date: v.isDate, - boolean: v.isBoolean - }, - messages: {} - }) - }; - validate3.formatters = { - detailed: function(errors) { - return errors; - }, - flat: v.flattenErrorsToArray, - grouped: function(errors) { - var attr; - errors = v.groupErrorsByAttribute(errors); - for (attr in errors) { - errors[attr] = v.flattenErrorsToArray(errors[attr]); - } - return errors; - }, - constraint: function(errors) { - var attr; - errors = v.groupErrorsByAttribute(errors); - for (attr in errors) { - errors[attr] = errors[attr].map(function(result) { - return result.validator; - }).sort(); - } - return errors; - } - }; - validate3.exposeModule(validate3, this, exports2, module2, define2); - }).call( - exports, - typeof exports !== "undefined" ? ( - /* istanbul ignore next */ - exports - ) : null, - typeof module !== "undefined" ? ( - /* istanbul ignore next */ - module - ) : null, - typeof define !== "undefined" ? ( - /* istanbul ignore next */ - define - ) : null - ); - } - }); - - // src/js/basic-kyc.js - var import_validate2 = __toESM(require_validate(), 1); - - // src/js/components/ConsentScreen.js - function templateString() { - return ` - - - - - - - - `; - } - var EndUserConsent = class extends HTMLElement { - constructor() { - super(); - this.idRequiresTotpConsent = ["BVN_MFA"]; - this.templateString = templateString.bind(this); - this.render = () => { - return this.templateString(); - }; - this.attachShadow({ mode: "open" }); - } - connectedCallback() { - this.pages = []; - const template = document.createElement("template"); - template.innerHTML = this.render(); - this.shadowRoot.appendChild(template.content.cloneNode(true)); - this.consentScreen = this.shadowRoot.querySelector("#consent-screen"); - this.totpConsentApp = this.shadowRoot.querySelector("totp-consent-app"); - this.consentRejectedScreen = this.shadowRoot.querySelector( - "#consent-rejected-screen" - ); - this.allowButton = this.shadowRoot.querySelector("#allow"); - this.rejectButton = this.shadowRoot.querySelector("#cancel"); - this.backToConsentButton = this.shadowRoot.querySelector("#back-to-consent"); - this.confirmConsentRejectionButton = this.shadowRoot.querySelector( - "#confirm-consent-rejection" - ); - this.backButton = this.shadowRoot.querySelector("#back-button"); - const CloseIframeButtons = this.shadowRoot.querySelectorAll(".close-iframe"); - this.allowButton.addEventListener( - "click", - (e) => this.handleConsentGrant(e) - ); - this.rejectButton.addEventListener( - "click", - (e) => this.handleConsentGrant(e) - ); - this.backToConsentButton.addEventListener( - "click", - () => this.setActiveScreen(this.consentScreen) - ); - this.confirmConsentRejectionButton.addEventListener( - "click", - (e) => this.handleConsentRejection(e) - ); - this.totpConsentApp.addEventListener( - "SmileIdentity::ConsentDenied::TOTP::ContactMethodsOutdated", - (e) => this.handleTotpConsentEvents(e) - ); - this.totpConsentApp.addEventListener( - "SmileIdentity::ConsentGranted::TOTP", - (e) => this.handleTotpConsentEvents(e) - ); - this.totpConsentApp.addEventListener( - "SmileIdentity::ConsentDenied::Back", - (e) => this.handleBackEvents(e) - ); - this.backButton.addEventListener("click", (e) => { - this.handleBackEvents(e); - }); - CloseIframeButtons.forEach((button) => { - button.addEventListener( - "click", - () => { - this.closeWindow(); - }, - false - ); - }); - this.activeScreen = this.consentScreen; - } - setActiveScreen(screen) { - this.activeScreen.hidden = true; - screen.hidden = false; - this.activeScreen = screen; - } - get baseUrl() { - return this.getAttribute("base-url"); - } - get country() { - return this.getAttribute("country"); - } - get demoMode() { - return !!this.hasAttribute("demo-mode"); - } - get hideBack() { - return this.hasAttribute("hide-back-to-host"); - } - get idHint() { - return this.getAttribute("id-hint") || "Your BVN should be 11 digits long"; - } - get idRegex() { - return this.getAttribute("id-regex"); - } - get idType() { - return this.getAttribute("id-type"); - } - get idTypeLabel() { - return this.getAttribute("id-type-label"); - } - get partnerId() { - return this.getAttribute("partner-id"); - } - get partnerName() { - return this.getAttribute("partner-name"); - } - get partnerLogoURL() { - return this.getAttribute("partner-logo"); - } - get partnerPolicyURL() { - return this.getAttribute("policy-url"); - } - get themeColor() { - return this.getAttribute("theme-color") || "#043C93"; - } - get token() { - return this.getAttribute("token"); - } - handleConsentGrant(e) { - const granted = e.target === this.allowButton; - if (granted) { - if (this.idRequiresTotpConsent.includes(this.idType)) { - this.setActiveScreen(this.totpConsentApp); - this.pages.push(this.consentScreen); - } else { - this.dispatchEvent( - new CustomEvent("SmileIdentity::ConsentGranted", { - detail: { - consented: { - personal_details: granted, - contact_information: granted, - document_information: granted - } - } - }) - ); - } - } else { - this.setActiveScreen(this.consentRejectedScreen); - } - } - handleConsentRejection() { - this.dispatchEvent(new CustomEvent("SmileIdentity::ConsentDenied")); - } - handleTotpConsentEvents(e) { - const customEvent = new CustomEvent(e.type, { - detail: { - ...e.detail - } - }); - this.dispatchEvent(customEvent); - } - handleBackEvents() { - const page = this.pages.pop(); - if (page) { - this.setActiveScreen(page); - } else { - this.dispatchEvent(new CustomEvent("SmileIdentity::Exit")); - } - } - closeWindow() { - const referenceWindow = window.parent; - referenceWindow.postMessage("SmileIdentity::Close", "*"); - } - }; - var ConsentScreen_default = EndUserConsent; - - // src/js/components/TotpConsentApp.js - var import_validate = __toESM(require_validate(), 1); - function postData(url, data) { - return fetch(url, { - method: "POST", - mode: "cors", - cache: "no-cache", - headers: { - Accept: "application/json", - "Content-Type": "application/json" - }, - body: JSON.stringify(data) - }); - } - function markup() { - return ` - - -
- -

- Enter your ${this.idTypeLabel} -

- -
-
- - - - -

- ${this.idHint} -

-
- - -
-
- - - - - `; - } - var TotpBasedConsent = class extends HTMLElement { - constructor() { - super(); - this.templateString = markup.bind(this); - this.render = () => { - return this.templateString(); - }; - this.attachShadow({ mode: "open" }); - this.modes = []; - this["otp-delivery-mode"] = ""; - this.queryOtpModes = this.queryOtpModes.bind(this); - this.selectOtpMode = this.selectOtpMode.bind(this); - this.submitOtp = this.submitOtp.bind(this); - this.switchContactMethod = this.switchContactMethod.bind(this); - this.handleTotpConsentGrant = this.handleTotpConsentGrant.bind(this); - this.handleTotpConsentContactMethodsOutdated = this.handleTotpConsentContactMethodsOutdated.bind(this); - this.pages = []; - } - static get observedAttributes() { - return ["modes", "otp-delivery-mode"]; - } - attributeChangedCallback(name) { - switch (name) { - case "modes": - case "otp-delivery-mode": { - const updatedTemplate = document.createElement("template"); - updatedTemplate.innerHTML = this.render(); - const updatedNode = updatedTemplate.content.cloneNode(true).querySelector(`#${this.activeScreen.id}`); - updatedNode.hidden = false; - this.shadowRoot.replaceChild(updatedNode, this.activeScreen); - this.setUpEventListeners(); - this.setActiveScreen(updatedNode); - break; - } - default: - break; - } - } - setUpEventListeners() { - this.idEntryScreen = this.shadowRoot.querySelector("#id-entry"); - this.selectModeScreen = this.shadowRoot.querySelector("#select-mode"); - this.otpVerificationScreen = this.shadowRoot.querySelector("#otp-verification"); - if (!this.activeScreen) { - this.activeScreen = this.idEntryScreen; - } - this.queryOtpModesButton = this.idEntryScreen.querySelector("#query-otp-modes"); - this.backButton = this.idEntryScreen.querySelector("#back-button"); - this.selectOtpModeButton = this.selectModeScreen.querySelector("#select-otp-mode"); - this.entryBackbutton = this.selectModeScreen.querySelector( - "#back-to-entry-button" - ); - this.contactMethodsOutdatedButton = this.selectModeScreen.querySelector( - "#contact-methods-outdated" - ); - this.submitOtpButton = this.otpVerificationScreen.querySelector("#submit-otp"); - this.switchContactMethodButton = this.otpVerificationScreen.querySelector( - ".try-another-method" - ); - const CloseIframeButtons = this.shadowRoot.querySelectorAll(".close-iframe"); - this.idNumberInput = this.idEntryScreen.querySelector("#id_number"); - this.modeInputs = this.selectModeScreen.querySelectorAll('[name="mode"]'); - this.otpInput = this.otpVerificationScreen.querySelector("#totp-token"); - this.queryOtpModesButton.addEventListener( - "click", - (e) => this.queryOtpModes(e) - ); - this.selectOtpModeButton.addEventListener( - "click", - (e) => this.selectOtpMode(e) - ); - this.submitOtpButton.addEventListener("click", (e) => this.submitOtp(e)); - this.switchContactMethodButton.addEventListener( - "click", - (e) => this.switchContactMethod(e) - ); - this.contactMethodsOutdatedButton.addEventListener( - "click", - (e) => this.handleTotpConsentContactMethodsOutdated(e) - ); - this.entryBackbutton.addEventListener("click", () => { - this.handleBackClick(); - }); - this.backButton.addEventListener("click", () => { - this.handleBackClick(); - }); - CloseIframeButtons.forEach((button) => { - button.addEventListener( - "click", - () => { - this.closeWindow(); - }, - false - ); - }); - } - closeWindow() { - const referenceWindow = window.parent; - referenceWindow.postMessage("SmileIdentity::Close", "*"); - } - handleBackClick() { - const page = this.pages.pop(); - if (page) { - this.setActiveScreen(page); - } else { - this.dispatchEvent( - new CustomEvent("SmileIdentity::ConsentDenied::Back", {}) - ); - } - } - connectedCallback() { - const template = document.createElement("template"); - template.innerHTML = this.render(); - this.shadowRoot.appendChild(template.content.cloneNode(true)); - this.setUpEventListeners(); - } - switchContactMethod() { - this.queryOtpModes(); - } - resetForm() { - const invalidElements = this.activeScreen.querySelectorAll("[aria-invalid]"); - invalidElements.forEach((el) => el.removeAttribute("aria-invalid")); - const validationMessages = this.activeScreen.querySelectorAll( - ".validation-message" - ); - validationMessages.forEach((el) => el.remove()); - } - handleIdNumberValidationErrors(errors) { - const fields = Object.keys(errors); - fields.forEach((field) => { - const input = this.activeScreen.querySelector(`#${field}`); - input.setAttribute("aria-invalid", "true"); - input.setAttribute("aria-describedby", `${field}-hint`); - const errorDiv = document.createElement("div"); - errorDiv.setAttribute("id", `${field}-hint`); - errorDiv.setAttribute("class", "validation-message"); - errorDiv.textContent = errors[field][0]; - input.insertAdjacentElement("afterend", errorDiv); - }); - } - handleActiveScreenErrors(error) { - const submitButton = this.activeScreen.querySelector('[type="submit"]'); - const errorDiv = document.createElement("div"); - errorDiv.setAttribute("class", "validation-message"); - errorDiv.textContent = error; - submitButton.insertAdjacentElement("beforebegin", errorDiv); - } - validateIdNumber(idNumber) { - const validationConstraints = { - id_number: { - presence: { - allowEmpty: false, - message: "is required" - }, - format: new RegExp(this.idRegex) - } - }; - const errors = (0, import_validate.default)({ id_number: idNumber }, validationConstraints); - if (errors) { - this.handleIdNumberValidationErrors(errors); - } - return errors; - } - async queryOtpModes(event) { - if (event) { - event.preventDefault(); - this.resetForm(); - } - const validationErrors = this.validateIdNumber(this.idNumberInput.value); - localStorage.setItem("idNumber", this.idNumberInput.value || this.idNumber); - if (!validationErrors) { - const data = { - country: this.country, - id_number: this.idNumber, - id_type: this.idType, - partner_id: this.partnerId, - token: this.token - }; - const url = `${this.baseUrl}/totp_consent`; - try { - this.toggleLoading(); - const response = await postData(url, data); - const json = await response.json(); - this.toggleLoading(); - if (!response.ok) { - this.handleActiveScreenErrors(json.error); - } else { - this.sessionId = json.session_id; - this.modes = json.modes; - this.setActiveScreen(this.selectModeScreen); - this.setAttribute("modes", json.modes); - } - } catch (error) { - this.toggleLoading(); - this.handleActiveScreenErrors(error.message); - } - } - } - async selectOtpMode(event) { - event.preventDefault(); - this.resetForm(); - this.mode = Array.prototype.find.call( - this.modeInputs, - (node) => node.checked - ).value; - const data = { - country: this.country, - id_number: this.idNumber, - id_type: this.idType, - mode: this.mode, - partner_id: this.partnerId, - session_id: this.sessionId, - token: this.token - }; - const url = `${this.baseUrl}/totp_consent/mode`; - try { - this.toggleLoading(); - const response = await postData(url, data); - const json = await response.json(); - this.toggleLoading(); - if (!response.ok) { - this.handleActiveScreenErrors(json.error); - } else { - this.selectedOtpDeliveryMode = this.modes.filter( - (mode) => mode[this.mode] - )[0][this.mode]; - this.setActiveScreen(this.otpVerificationScreen); - this.setAttribute("otp-delivery-mode", this.selectedOtpDeliveryMode); - } - } catch (error) { - this.toggleLoading(); - this.handleActiveScreenErrors(error.message); - } - } - async submitOtp(event) { - event.preventDefault(); - this.resetForm(); - this.otp = this.otpInput.value; - const data = { - country: this.country, - id_number: this.idNumber, - id_type: this.idType, - otp: this.otp, - partner_id: this.partnerId, - session_id: this.sessionId, - token: this.token - }; - const url = `${this.baseUrl}/totp_consent/otp`; - try { - this.toggleLoading(); - const response = await postData(url, data); - const json = await response.json(); - this.toggleLoading(); - if (!response.ok) { - this.handleActiveScreenErrors(json.error); - } else { - this.handleTotpConsentGrant(event); - } - } catch (error) { - this.toggleLoading(); - this.handleActiveScreenErrors(error.message); - } - } - toggleLoading() { - const button = this.activeScreen.querySelector('button[type="submit"]'); - const text = button.querySelector(".text"); - const arrow = button.querySelector("svg"); - const spinner = button.querySelector(".spinner"); - button.toggleAttribute("disabled"); - text.toggleAttribute("hidden"); - arrow.toggleAttribute("hidden"); - spinner.toggleAttribute("hidden"); - } - setActiveScreen(screen) { - this.activeScreen.hidden = true; - screen.hidden = false; - this.activeScreen = screen; - } - get baseUrl() { - return this.getAttribute("base-url"); - } - get country() { - return this.getAttribute("country"); - } - get idHint() { - return this.getAttribute("id-hint") || "Your BVN should be 11 digits long"; - } - get idNumber() { - return localStorage.getItem("idNumber"); - } - get idRegex() { - return this.getAttribute("id-regex"); - } - get idType() { - return this.getAttribute("id-type"); - } - get idTypeLabel() { - return this.getAttribute("id-type-label"); - } - get partnerId() { - return this.getAttribute("partner-id"); - } - get partnerName() { - return this.getAttribute("partner-name"); - } - get token() { - return this.getAttribute("token"); - } - handleTotpConsentGrant() { - const customEvent = new CustomEvent("SmileIdentity::ConsentGranted::TOTP", { - detail: { - id_number: this.idNumber, - session_id: this.sessionId, - consented: { - personal_details: true, - contact_information: true, - document_information: true - } - } - }); - this.dispatchEvent(customEvent); - } - handleTotpConsentContactMethodsOutdated() { - const tag = "SmileIdentity::ConsentDenied::TOTP::ContactMethodsOutdated"; - const customEvent = new CustomEvent(tag, { - detail: { - message: tag, - data: { - id_number: this.idNumber, - session_id: this.sessionId - } - } - }); - this.dispatchEvent(customEvent); - } - }; - var TotpConsentApp_default = TotpBasedConsent; - - // src/js/components/Combobox.js - function generateId(prefix) { - const id = [...Array(30)].map(() => Math.random().toString(36)[3]).join(""); - return `${prefix}-${id}`; - } - function isElementInView(element) { - const bounding = element.getBoundingClientRect(); - return bounding.top >= 0 && bounding.left >= 0 && bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) && bounding.right <= (window.innerWidth || document.documentElement.clientWidth); - } - function isScrollable(element) { - return element && element.clientHeight < element.scrollHeight; - } - function maintainScrollVisibility(activeElement, scrollParent) { - const { offsetHeight, offsetTop } = activeElement; - const { offsetHeight: parentOffsetHeight, scrollTop } = scrollParent; - const isAbove = offsetTop < scrollTop; - const isBelow = offsetTop + offsetHeight > scrollTop + parentOffsetHeight; - if (isAbove) { - scrollParent.scrollTo(0, offsetTop); - } else if (isBelow) { - scrollParent.scrollTo(0, offsetTop - parentOffsetHeight + offsetHeight); - } - } - var ComboboxRoot = class extends HTMLElement { - constructor() { - super(); - this.handleRoaming = this.handleRoaming.bind(this); - } - connectedCallback() { - this.trigger = this.querySelector("smileid-combobox-trigger"); - document.addEventListener("click", this.handleRoaming); - this.addEventListener("focusout", this.handleRoaming); - this.addEventListener("blur", this.handleRoaming); - } - disconnectedCallback() { - document.removeEventListener("click", this.handleRoaming); - this.removeEventListener("focusout", this.handleRoaming); - this.removeEventListener("blur", this.handleRoaming); - } - handleRoaming(event) { - const target = event.relatedTarget || event.target; - if (this.contains(target)) { - return; - } - if (this.trigger.getAttribute("expanded") === "true") { - this.trigger.setAttribute("expanded", "false"); - } - } - }; - var ComboboxTrigger = class extends HTMLElement { - constructor() { - super(); - this.handleKeyUp = this.handleKeyUp.bind(this); - this.handleKeyDown = this.handleKeyDown.bind(this); - this.handleSelection = this.handleSelection.bind(this); - this.toggleExpansionState = this.toggleExpansionState.bind(this); - } - get type() { - return this.getAttribute("type") || "text"; - } - get label() { - return this.getAttribute("label") || ""; - } - get value() { - return this.getAttribute("value") || ""; - } - get disabled() { - return this.hasAttribute("disabled"); - } - connectedCallback() { - if (!this.label) { - throw new Error(": a label attribute is required"); - } - this.innerHTML = `${this.type === "text" ? ` -
- - -
- ` : ``}`; - this.setAttribute("expanded", false); - this.inputTrigger = this.querySelector("input"); - this.buttonTrigger = this.querySelector("button"); - this.buttonTrigger.setAttribute("aria-expanded", false); - this.buttonTrigger.setAttribute("role", "combobox"); - this.buttonTrigger.addEventListener("keydown", this.handleKeyDown); - this.buttonTrigger.addEventListener("click", this.toggleExpansionState); - if (this.inputTrigger) { - this.inputTrigger.setAttribute("aria-expanded", false); - this.inputTrigger.setAttribute("role", "combobox"); - this.inputTrigger.addEventListener("keydown", this.handleKeyDown); - this.inputTrigger.addEventListener("keyup", this.handleKeyUp); - this.inputTrigger.addEventListener("change", (e) => e.stopPropagation()); - } - this.listbox = this.parentElement.querySelector("smileid-combobox-listbox"); - this.options = Array.from( - this.parentElement.querySelectorAll("smileid-combobox-option") - ); - this.options.forEach((node) => { - node.addEventListener("Combobox::Option::Select", this.handleSelection); - }); - } - disconnectedCallback() { - this.buttonTrigger.removeEventListener("keydown", this.handleKeyDown); - this.buttonTrigger.removeEventListener("click", this.toggleExpansionState); - if (this.inputTrigger) { - this.inputTrigger.removeEventListener("keydown", this.handleKeyDown); - this.inputTrigger.removeEventListener("keyup", this.handleKeyUp); - this.inputTrigger.removeEventListener( - "change", - (e) => e.stopPropagation() - ); - } - if (this.options) { - this.options.forEach((node) => { - node.removeEventListener( - "Combobox::Option::Select", - this.handleSelection - ); - }); - } - } - handleKeyDown(event) { - if (event.ctrlKey || event.shiftKey) { - return; - } - const key = event.key; - switch (key) { - case "Enter": - case "Space": - case " ": - if (this.getAttribute("expanded") === "true") { - if (this.inputTrigger && (key === "Space" || key === " ")) { - this.resetListbox(); - } else { - event.preventDefault(); - const selectedOption = this.buttonTrigger.getAttribute( - "aria-activedescendant" - ); - if (selectedOption) { - document.getElementById(selectedOption).click(); - } - } - } else { - event.preventDefault(); - this.toggleExpansionState(); - } - break; - case "Esc": - case "Escape": - event.preventDefault(); - if (this.getAttribute("expanded") === "true") { - this.toggleExpansionState(); - } - break; - case "Down": - case "ArrowDown": - event.preventDefault(); - if (this.getAttribute("expanded") !== "true") { - this.toggleExpansionState(); - this.focusListbox("First"); - } else { - this.focusListbox("Down"); - } - break; - case "Up": - case "ArrowUp": - event.preventDefault(); - if (this.getAttribute("expanded") !== "true") { - this.toggleExpansionState(); - this.focusListbox("Last"); - } else { - this.focusListbox("Up"); - } - break; - case "Left": - case "ArrowLeft": - case "Right": - case "ArrowRight": - case "Home": - case "End": - this.resetListbox(); - break; - case "Tab": - break; - default: - break; - } - } - handleKeyUp(event) { - const key = event.key; - const isPrintableCharacter = (str) => str.length === 1 && str.match(/\S| /); - if (event.key === "Escape" || event.key === "Esc") { - event.preventDefault(); - if (this.getAttribute("expanded") === "true") { - this.toggleExpansionState(); - } else if (this.inputTrigger) { - this.inputTrigger.value = ""; - this.listbox.dispatchEvent( - new CustomEvent("Combobox::Listbox::Filter", { detail: "" }) - ); - } - } - if (isPrintableCharacter(key) || key === "Backspace") { - this.resetListbox(); - this.filterListbox(event.target.value); - } - } - toggleExpansionState() { - const listboxIsExpanded = this.getAttribute("expanded") === "true"; - this.setAttribute("expanded", !listboxIsExpanded); - this.buttonTrigger.setAttribute("aria-expanded", !listboxIsExpanded); - if (this.inputTrigger) { - this.inputTrigger.setAttribute("aria-expanded", !listboxIsExpanded); - } - } - handleSelection(event) { - if (this.inputTrigger) { - this.inputTrigger.value = event.detail.label; - } else { - this.buttonTrigger.textContent = event.detail.label; - } - this.toggleExpansionState(); - this.parentElement.dispatchEvent( - new CustomEvent("change", { - detail: { - value: event.detail.value - } - }) - ); - } - filterListbox(value) { - if (this.getAttribute("expanded") !== "true") { - this.toggleExpansionState(); - } - this.listbox.dispatchEvent( - new CustomEvent("Combobox::Listbox::Filter", { detail: value }) - ); - } - focusListbox(direction) { - this.resetListbox(); - this.listbox.dispatchEvent( - new CustomEvent("Combobox::Listbox::Focus", { - detail: { - direction - } - }) - ); - } - resetListbox() { - this.listbox.dispatchEvent(new CustomEvent("Combobox::Listbox::Reset")); - } - }; - var ComboboxListbox = class extends HTMLElement { - constructor() { - super(); - this.handleFilter = this.handleFilter.bind(this); - this.handleFocus = this.handleFocus.bind(this); - this.handleReset = this.handleReset.bind(this); - this.handleOptionSelection = this.handleOptionSelection.bind(this); - } - get emptyLabel() { - return this.getAttribute("empty-label"); - } - get emptyState() { - return ` -

- ${this.emptyLabel || "No items"} -

- `; - } - connectedCallback() { - this.setAttribute("role", "listbox"); - this.setAttribute("id", generateId("listbox")); - this.addEventListener("Combobox::Listbox::Filter", this.handleFilter); - this.addEventListener("Combobox::Listbox::Focus", this.handleFocus); - this.addEventListener("Combobox::Listbox::Reset", this.handleReset); - this.triggers = Array.from( - this.parentElement.querySelectorAll( - "smileid-combobox-trigger input, smileid-combobox-trigger button" - ) - ); - this.triggers.forEach( - (node) => node.setAttribute("aria-controls", this.getAttribute("id")) - ); - this.optionNodes = Array.from( - this.querySelectorAll("smileid-combobox-option") - ); - this.selectedNode = this.optionNodes.find( - (node) => !node.hasAttribute("hidden") && node.hasAttribute("aria-selected") - ) || this.optionNodes.filter((node) => !node.hasAttribute("hidden"))[0]; - this.selectedNode.setAttribute("tabindex", "0"); - this.optionNodes.forEach((node) => { - node.addEventListener( - "Combobox::Option::Select", - this.handleOptionSelection - ); - }); - if (this.optionNodes.length === 0) { - this.innerHTML = this.emptyState; - } - } - disconnectedCallback() { - this.removeEventListener("Combobox::Listbox::Filter", this.handleFilter); - this.removeEventListener("Combobox::Listbox::Focus", this.handleFocus); - this.removeEventListener("Combobox::Listbox::Reset", this.handleReset); - this.optionNodes.forEach((node) => { - node.removeEventListener( - "Combobox::Option::Select", - this.handleOptionSelection - ); - }); - } - static get observedAttributes() { - return ["search-term"]; - } - attributeChangedCallback(name, oldValue, newValue) { - switch (name) { - case "search-term": - if (oldValue && !newValue) { - this.optionNodes.forEach((node) => { - node.removeAttribute("hidden"); - }); - } else if (newValue) { - this.filterNodes(newValue); - } - break; - default: - break; - } - } - filterNodes(searchTerm) { - this.optionNodes.forEach((node) => { - const value = node.getAttribute("value").toLowerCase(); - const label = node.getAttribute("label").toLowerCase(); - const containsSearchTerm = value.includes(searchTerm.toLowerCase()) || label.includes(searchTerm.toLowerCase()); - if (containsSearchTerm) { - node.removeAttribute("hidden"); - } else { - node.setAttribute("hidden", true); - } - }); - const optionsVisible = this.optionNodes.find( - (node) => !node.hasAttribute("hidden") - ); - const emptyState = this.querySelector("#empty-state"); - if (!optionsVisible && !emptyState) { - this.insertAdjacentHTML("afterbegin", this.emptyState); - } else if (optionsVisible && emptyState) { - this.removeChild(emptyState); - } - } - handleFilter(event) { - const searchTerm = event.detail; - this.setAttribute("search-term", searchTerm); - } - handleFocus(event) { - this.setSelected(event.detail.direction); - } - handleReset() { - this.optionNodes.forEach((node) => node.setAttribute("tabindex", "-1")); - } - handleOptionSelection(event) { - const inputTrigger = this.triggers.filter( - (node) => node.tagName === "INPUT" - )[0]; - if (inputTrigger) { - this.setAttribute("search-term", event.detail.label); - } - } - setSelected(direction) { - const visibleOptions = this.optionNodes.filter( - (node) => !node.hasAttribute("hidden") - ); - this.selectedNode.setAttribute("tabindex", "0"); - const currentIndex = visibleOptions.findIndex( - (node) => node === this.selectedNode - ); - const lastIndex = visibleOptions.length - 1; - let nextIndex; - switch (direction) { - case "First": - nextIndex = 0; - break; - case "Last": - nextIndex = lastIndex; - break; - case "Up": - if (currentIndex === 0) { - nextIndex = lastIndex; - } else { - nextIndex = currentIndex - 1; - } - break; - default: - if (currentIndex === lastIndex) { - nextIndex = 0; - } else { - nextIndex = currentIndex + 1; - } - break; - } - if (currentIndex !== nextIndex) { - this.swapSelected(this.selectedNode, visibleOptions[nextIndex]); - } - } - swapSelected(currentNode, newNode) { - currentNode.setAttribute("tabindex", "-1"); - newNode.setAttribute("tabindex", "0"); - this.selectedNode = newNode; - if (isScrollable(this)) { - maintainScrollVisibility(this.selectedNode, this); - } - if (!isElementInView(newNode)) { - newNode.scrollIntoView({ behavior: "smooth", block: "nearest" }); - } - this.triggers.forEach( - (node) => node.setAttribute("aria-activedescendant", newNode.id) - ); - } - }; - var ComboboxOption = class extends HTMLElement { - connectedCallback() { - this.setAttribute("role", "option"); - this.setAttribute("tabindex", "-1"); - this.setAttribute("id", generateId("option")); - this.options = Array.from( - this.parentElement.querySelectorAll("smileid-combobox-option") - ); - this.addEventListener("click", this.select); - } - disconnectedCallback() { - this.removeEventListener("click", this.select); - } - get value() { - return this.getAttribute("value"); - } - get label() { - return this.getAttribute("label"); - } - select() { - const selectedOption = this.options.find( - (node) => node.getAttribute("aria-selected") - ); - if (selectedOption) { - selectedOption.removeAttribute("aria-selected"); - } - this.setAttribute("aria-selected", true); - this.dispatchEvent( - new CustomEvent("Combobox::Option::Select", { - detail: { - label: this.label, - value: this.value, - id: this.getAttribute("id") - } - }) - ); - } - }; - var Combobox_default = { - Root: ComboboxRoot, - Trigger: ComboboxTrigger, - List: ComboboxListbox, - Option: ComboboxOption - }; - - // package.json - var version = "v1.2.3"; - - // src/js/basic-kyc.js - (function basicKyc() { - "use strict"; - const endpoints = { - development: "https://devapi.smileidentity.com", - sandbox: "https://testapi.smileidentity.com", - live: "https://api.smileidentity.com", - production: "https://api.smileidentity.com" - }; - const referenceWindow = window.parent; - referenceWindow.postMessage("SmileIdentity::ChildPageReady", "*"); - window.customElements.define("end-user-consent", ConsentScreen_default); - window.customElements.define("totp-consent-app", TotpConsentApp_default); - window.customElements.define("smileid-combobox", Combobox_default.Root); - window.customElements.define("smileid-combobox-trigger", Combobox_default.Trigger); - window.customElements.define("smileid-combobox-listbox", Combobox_default.List); - window.customElements.define("smileid-combobox-option", Combobox_default.Option); - const pages = []; - let activeScreen; - let config; - let consent_information; - let id_info; - let partner_params; - let ngBankCodes; - let productConstraints; - let EndUserConsent2; - const LoadingScreen = document.querySelector("#loading-screen"); - const SelectIDType = document.querySelector("#select-id-type"); - const IDInfoForm = document.querySelector("#id-info"); - const CompleteScreen = document.querySelector("#complete-screen"); - let disableBackOnFirstScreen = false; - const CloseIframeButtons = document.querySelectorAll(".close-iframe"); - function postData2(url = "", data = {}) { - return fetch(url, { - method: "POST", - mode: "cors", - cache: "no-cache", - headers: { - Accept: "application/json", - "Content-Type": "application/json" - }, - body: JSON.stringify(data) - }); - } - async function getProductConstraints() { - try { - const productsConfigPayload = { - partner_id: config.partner_details.partner_id, - token: config.token, - partner_params - }; - const productsConfigUrl = `${endpoints[config.environment]}/v1/products_config`; - const productsConfigPromise = postData2( - productsConfigUrl, - productsConfigPayload - ); - const servicesPromise = fetch( - `${endpoints[config.environment]}/v1/services` - ); - const [productsConfigResponse, servicesResponse] = await Promise.all([ - productsConfigPromise, - servicesPromise - ]); - if (productsConfigResponse.ok && servicesResponse.ok) { - const partnerConstraints = await productsConfigResponse.json(); - const generalConstraints = await servicesResponse.json(); - ngBankCodes = generalConstraints.bank_codes; - const previewBvnMfa = config.previewBVNMFA; - if (previewBvnMfa) { - generalConstraints.hosted_web.basic_kyc.NG.id_types.BVN_MFA = { - id_number_regex: "^[0-9]{11}$", - label: "Bank Verification Number (with OTP)", - required_fields: [ - "country", - "id_type", - "session_id", - "user_id", - "job_id", - "first_name", - "last_name" - ], - test_data: "00000000000" - }; - } - return { - partnerConstraints, - generalConstraints: generalConstraints.hosted_web.basic_kyc - }; - } - throw new Error("Failed to get supported ID types"); - } catch (e) { - throw new Error("Failed to get supported ID types", { cause: e }); - } - } - window.addEventListener( - "message", - async (event) => { - if (event.data && event.data.includes("SmileIdentity::Configuration")) { - config = JSON.parse(event.data); - activeScreen = LoadingScreen; - getPartnerParams(); - const { partnerConstraints, generalConstraints } = await getProductConstraints(); - productConstraints = generalConstraints; - initializeSession(generalConstraints, partnerConstraints); - } - }, - false - ); - function setInitialScreen(partnerConstraints) { - const { country: selectedCountry, id_type: selectedIDType } = id_info; - const selectedIdRequiresConsent = partnerConstraints.consentRequired[selectedCountry] ? partnerConstraints.consentRequired[selectedCountry].includes( - selectedIDType - ) : false; - if (selectedIdRequiresConsent || config.consent_required || config.demo_mode) { - const IDRequiresConsent = selectedIdRequiresConsent || config.consent_required && config.consent_required[selectedCountry] && config.consent_required[selectedCountry].includes(selectedIDType); - if (IDRequiresConsent || config.demo_mode) { - customizeConsentScreen(); - setActiveScreen(EndUserConsent2); - } else { - setActiveScreen(IDInfoForm); - } - } else { - hideIdFromBackExit(); - setActiveScreen(IDInfoForm); - } - customizeForm(); - } - function hideIdFromBackExit() { - if (!disableBackOnFirstScreen) - return; - IDInfoForm.querySelector(".nav").classList.add("justify-right"); - IDInfoForm.querySelector(".back-wrapper").style.display = "none"; - } - function initializeSession(generalConstraints, partnerConstraints) { - const supportedCountries = Object.keys(generalConstraints).map((countryCode) => ({ - code: countryCode, - name: generalConstraints[countryCode].name - })).sort((a, b) => { - if (a.name < b.name) { - return -1; - } - if (a.name > b.name) { - return 1; - } - return 0; - }).map((item) => item.code); - let validCountries = []; - if (config.id_selection) { - const selectedCountryList = Object.keys(config.id_selection); - validCountries = supportedCountries.filter( - (value) => selectedCountryList.includes(value) - ); - if (validCountries.length === 1) { - const selectedCountry = validCountries[0]; - id_info = { - country: validCountries[0] - }; - const idTypes = config.id_selection[selectedCountry]; - if (idTypes.length === 1 || typeof idTypes === "string") { - id_info.id_type = Array.isArray(idTypes) ? idTypes[0] : idTypes; - disableBackOnFirstScreen = true; - setInitialScreen(partnerConstraints); - } - } - } else { - validCountries = Object.keys(partnerConstraints.idSelection.basic_kyc); - } - if (!id_info || !id_info.id_type) { - const selectCountry = SelectIDType.querySelector("#country"); - const selectIDType = SelectIDType.querySelector("#id_type"); - const hostedWebConfigForm = document.querySelector( - 'form[name="hosted-web-config"]' - ); - selectCountry.disabled = false; - setActiveScreen(SelectIDType); - const loadIdTypes = (countryCode) => { - if (countryCode) { - const validIDTypes = config.id_selection ? config.id_selection : partnerConstraints.idSelection.basic_kyc; - const constrainedIDTypes = Object.keys( - generalConstraints[countryCode].id_types - ); - const selectedIDTypes = validIDTypes[countryCode].filter( - (value) => constrainedIDTypes.includes(value) - ); - selectIDType.innerHTML = ""; - const initialOption = document.createElement("option"); - initialOption.setAttribute("value", ""); - initialOption.textContent = "--Please Select--"; - selectIDType.appendChild(initialOption); - selectedIDTypes.forEach((IDType) => { - const option = document.createElement("option"); - option.setAttribute("value", IDType); - option.textContent = generalConstraints[countryCode].id_types[IDType].label; - selectIDType.appendChild(option); - }); - selectIDType.disabled = false; - } else { - selectIDType.innerHTML = ""; - const option = document.createElement("option"); - option.disabled = true; - option.setAttribute("value", ""); - option.textContent = "--Select Country First--"; - selectIDType.appendChild(option); - } - }; - selectCountry.addEventListener("change", (e) => { - loadIdTypes(e.target.value); - }); - validCountries.forEach((country) => { - const countryObject = generalConstraints[country]; - if (countryObject) { - const option = document.createElement("option"); - option.setAttribute("value", country); - option.textContent = countryObject.name; - if (id_info && id_info.country && country === id_info.country) { - option.setAttribute("selected", true); - selectCountry.value = country; - selectCountry.disabled = true; - loadIdTypes(country); - } - selectCountry.appendChild(option); - } - }); - hostedWebConfigForm.addEventListener("submit", (e) => { - e.preventDefault(); - const selectedCountry = selectCountry.value; - const selectedIDType = selectIDType.value; - id_info = { - country: selectedCountry, - id_type: selectedIDType - }; - setInitialScreen(partnerConstraints); - }); - } - } - function initiateDemoMode() { - const demoTips = document.querySelectorAll(".demo-tip"); - Array.prototype.forEach.call(demoTips, (tip) => { - tip.hidden = false; - }); - const script = document.createElement("script"); - script.type = "text/javascript"; - script.src = "js/demo-ekyc.min.js"; - document.body.appendChild(script); - } - IDInfoForm.querySelector("#submitForm").addEventListener( - "click", - (event) => { - handleFormSubmit(event); - }, - false - ); - IDInfoForm.querySelector("#back-button").addEventListener( - "click", - (event) => { - event.preventDefault(); - const page = pages.pop(); - setActiveScreen(page); - }, - false - ); - CloseIframeButtons.forEach((button) => { - button.addEventListener( - "click", - () => { - closeWindow(true); - }, - false - ); - }); - function customizeConsentScreen() { - const partnerDetails = config.partner_details; - const main = document.querySelector("main"); - EndUserConsent2 = document.querySelector("end-user-consent"); - if (EndUserConsent2) { - main.removeChild(EndUserConsent2); - } - EndUserConsent2 = document.createElement("end-user-consent"); - EndUserConsent2.setAttribute( - "base-url", - `${endpoints[config.environment] || config.environment}/v1` - ); - EndUserConsent2.setAttribute("country", id_info.country); - EndUserConsent2.setAttribute( - "id-regex", - productConstraints[id_info.country].id_types[id_info.id_type].id_number_regex - ); - EndUserConsent2.setAttribute("id-type", id_info.id_type); - EndUserConsent2.setAttribute( - "id-type-label", - productConstraints[id_info.country].id_types[id_info.id_type].label - ); - EndUserConsent2.setAttribute("partner-id", partnerDetails.partner_id); - EndUserConsent2.setAttribute("partner-name", partnerDetails.name); - EndUserConsent2.setAttribute("partner-logo", partnerDetails.logo_url); - EndUserConsent2.setAttribute("policy-url", partnerDetails.policy_url); - EndUserConsent2.setAttribute("theme-color", partnerDetails.theme_color); - EndUserConsent2.setAttribute("token", config.token); - if (disableBackOnFirstScreen) { - EndUserConsent2.setAttribute("hide-back-to-host", true); - } - if (config.demo_mode) { - EndUserConsent2.setAttribute("demo-mode", config.demo_mode); - localStorage.setItem( - "SmileIdentityConstraints", - JSON.stringify(productConstraints, null, 2) - ); - initiateDemoMode(); - } - EndUserConsent2.addEventListener( - "SmileIdentity::Exit", - () => { - setActiveScreen(SelectIDType); - }, - false - ); - EndUserConsent2.addEventListener( - "SmileIdentity::ConsentGranted", - (event) => { - consent_information = event.detail; - if (consent_information.consented.personal_details) { - setActiveScreen(IDInfoForm); - } - }, - false - ); - EndUserConsent2.addEventListener( - "SmileIdentity::ConsentGranted::TOTP", - (event) => { - consent_information = event.detail; - if (consent_information.consented.personal_details) { - id_info.id_number = consent_information.id_number; - id_info.session_id = consent_information.session_id; - id_info.consent_information = consent_information; - setActiveScreen(IDInfoForm); - } - }, - false - ); - EndUserConsent2.addEventListener( - "SmileIdentity::ConsentDenied", - () => { - referenceWindow.postMessage("SmileIdentity::ConsentDenied", "*"); - closeWindow(); - }, - false - ); - EndUserConsent2.addEventListener( - "SmileIdentity::ConsentDenied::TOTP::ContactMethodsOutdated", - (event) => { - referenceWindow.postMessage(event.detail, "*"); - closeWindow(); - }, - false - ); - main.appendChild(EndUserConsent2); - } - function customizeForm() { - setGuideTextForIDType(); - setFormInputs(); - } - function setGuideTextForIDType() { - const label = document.querySelector('[for="id_number"]'); - const input = document.querySelector("#id_number"); - label.innerHTML = productConstraints[id_info.country].id_types[id_info.id_type].label; - input.setAttribute( - "placeholder", - productConstraints[id_info.country].id_types[id_info.id_type].test_data - ); - input.setAttribute( - "pattern", - productConstraints[id_info.country].id_types[id_info.id_type].id_number_regex - ); - } - function loadBankCodes(bankCodes, placeholderElement) { - const autocomplete = document.createElement("smileid-combobox"); - autocomplete.setAttribute("id", "bank_code"); - autocomplete.innerHTML = ` - - - - - ${bankCodes.map( - (bank) => ` - - ${bank.name} - - ` - ).join("\n")} - - `; - placeholderElement.replaceWith(autocomplete); - autocomplete.addEventListener("change", (e) => { - id_info.bank_code = e.detail ? e.detail.value : ""; - }); - return autocomplete; - } - function setFormInputs() { - const requiredFields = productConstraints[id_info.country].id_types[id_info.id_type].required_fields; - const showIdNumber = requiredFields.some( - (fieldName) => fieldName.includes("id_number") - ); - if (showIdNumber) { - const IdNumber = IDInfoForm.querySelector("div#id-number"); - IdNumber.hidden = false; - } - const showNames = requiredFields.some( - (fieldName) => fieldName.includes("name") - ); - if (showNames) { - const Names = IDInfoForm.querySelector("fieldset#names"); - Names.hidden = false; - } - const showDOB = requiredFields.some( - (fieldName) => fieldName.includes("dob") - ); - if (showDOB) { - const DOB = IDInfoForm.querySelector("fieldset#dob"); - DOB.hidden = false; - } - const showCitizenship = requiredFields.some( - (fieldName) => fieldName.includes("citizenship") - ); - if (showCitizenship) { - const Citizenship = IDInfoForm.querySelector("fieldset#citizenships"); - Citizenship.hidden = false; - } - const showBankCode = requiredFields.some( - (fieldName) => fieldName.includes("bank_code") - ); - if (showBankCode) { - const BankCode = IDInfoForm.querySelector("fieldset#bank-code"); - loadBankCodes(ngBankCodes, BankCode.querySelector("#bank_code")); - BankCode.hidden = false; - } - } - function getPartnerParams() { - function parseJWT(token) { - const base64Url = token.split(".")[1]; - const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/"); - const jsonPayload = decodeURIComponent( - atob(base64).split("").map(function(c) { - return `%${c.charCodeAt(0).toString(16)}`; - }).join("") - ); - return JSON.parse(jsonPayload); - } - const { partner_params: partnerParams } = parseJWT(config.token); - partner_params = { ...partnerParams, ...config.partner_params || {} }; - } - function setActiveScreen(node) { - activeScreen.hidden = true; - pages.push(activeScreen); - node.hidden = false; - activeScreen = node; - } - function resetForm() { - const invalidElements = IDInfoForm.querySelectorAll("[aria-invalid]"); - invalidElements.forEach((el) => el.removeAttribute("aria-invalid")); - const validationMessages = document.querySelectorAll(".validation-message"); - validationMessages.forEach((el) => el.remove()); - } - function validateInputs(payload) { - const validationConstraints = {}; - const requiredFields = productConstraints[id_info.country].id_types[id_info.id_type].required_fields; - const showIdNumber = requiredFields.some( - (fieldName) => fieldName.includes("id_number") - ); - if (showIdNumber) { - validationConstraints.id_number = { - presence: { - allowEmpty: false, - message: "is required" - }, - format: new RegExp( - productConstraints[id_info.country].id_types[id_info.id_type].id_number_regex - ) - }; - } - const showNames = requiredFields.some( - (fieldName) => fieldName.includes("name") - ); - if (showNames) { - validationConstraints.first_name = { - presence: { - allowEmpty: false, - message: "is required" - } - }; - validationConstraints.last_name = { - presence: { - allowEmpty: false, - message: "is required" - } - }; - } - const showDOB = requiredFields.some( - (fieldName) => fieldName.includes("dob") - ); - if (showDOB) { - validationConstraints.day = { - presence: { - allowEmpty: false, - message: "is required" - } - }; - validationConstraints.month = { - presence: { - allowEmpty: false, - message: "is required" - } - }; - validationConstraints.year = { - presence: { - allowEmpty: false, - message: "is required" - } - }; - } - const showCitizenship = requiredFields.some( - (fieldName) => fieldName.includes("citizenship") - ); - if (showCitizenship) { - validationConstraints.citizenship = { - presence: { - allowEmpty: false, - message: "is required" - } - }; - } - const showBankCode = requiredFields.some( - (fieldName) => fieldName.includes("bank_code") - ); - if (showBankCode) { - validationConstraints.bank_code = { - presence: { - allowEmpty: false, - message: "is required" - } - }; - } - const validation = (0, import_validate2.default)(payload, validationConstraints); - if (validation) { - handleValidationErrors(validation); - const submitButton = IDInfoForm.querySelector('[type="button"]'); - submitButton.removeAttribute("disabled"); - } - return validation; - } - function handleValidationErrors(errors) { - const fields = Object.keys(errors); - fields.forEach((field) => { - const input = IDInfoForm.querySelector(`#${field}`); - input.setAttribute("aria-invalid", "true"); - input.setAttribute("aria-describedby", `${field}-hint`); - const errorDiv = document.createElement("div"); - errorDiv.setAttribute("id", `${field}-hint`); - errorDiv.setAttribute("class", "validation-message"); - errorDiv.textContent = errors[field][0]; - input.insertAdjacentElement("afterend", errorDiv); - }); - } - async function handleFormSubmit(event) { - event.preventDefault(); - resetForm(); - const form = IDInfoForm.querySelector("form"); - const formData = new FormData(form); - const payload = { ...id_info, ...Object.fromEntries(formData.entries()) }; - const isInvalid = validateInputs(payload); - if (isInvalid) { - return; - } - id_info = { - dob: `${payload.year}-${payload.month}-${payload.day}`, - entered: true, - ...payload, - ...id_info - }; - try { - event.target.disabled = true; - await submitIdInfoForm(); - complete(); - event.target.disabled = false; - } catch (error) { - event.target.disabled = false; - displayErrorMessage("Something went wrong"); - console.error( - `SmileIdentity - ${error.name || error.message}: ${error.cause}` - ); - } - } - function displayErrorMessage(message) { - const p = document.createElement("p"); - p.textContent = message; - p.classList.add("validation-message"); - p.style.fontSize = "1.5rem"; - p.style.textAlign = "center"; - const main = document.querySelector("main"); - main.prepend(p); - } - async function submitIdInfoForm() { - const { year, month, day, ...data } = id_info; - const dob = year && month && day ? `${year}-${month}-${day}` : void 0; - const { - callback_url, - token, - partner_details: { partner_id } - } = config; - const payload = { - ...data, - dob, - partner_id, - partner_params, - callback_url, - token, - source_sdk: config.sdk || "hosted_web", - source_sdk_version: config.sdk_version || version - }; - const URL = `${endpoints[config.environment]}/v2/verify_async`; - const response = await postData2(URL, payload); - const json = await response.json(); - if (json.error) - throw new Error(json.error); - } - function complete() { - const countryName = productConstraints[id_info.country].name; - const idTypeName = productConstraints[id_info.country].id_types[id_info.id_type].label; - const thankYouMessage = CompleteScreen.querySelector("#thank-you-message"); - thankYouMessage.textContent = `We will process your ${countryName} - ${idTypeName} information to verify your identity`; - setActiveScreen(CompleteScreen); - handleSuccess(); - window.setTimeout(closeWindow, 2e3); - } - function closeWindow(userTriggered) { - const message = userTriggered ? "SmileIdentity::Close" : "SmileIdentity::Close::System"; - referenceWindow.postMessage(message, "*"); - } - function handleSuccess() { - referenceWindow.postMessage("SmileIdentity::Success", "*"); - } - })(); -})(); -/*! Bundled license information: - -validate.js/validate.js: - (*! - * validate.js 0.13.1 - * - * (c) 2013-2019 Nicklas Ansman, 2013 Wrapp - * Validate.js may be freely distributed under the MIT license. - * For all details and documentation: - * http://validatejs.org/ - *) -*/ diff --git a/packages/embed/build/js/biometric-kyc.min.js b/packages/embed/build/js/biometric-kyc.min.js deleted file mode 100644 index 90a96008..00000000 --- a/packages/embed/build/js/biometric-kyc.min.js +++ /dev/null @@ -1,7765 +0,0 @@ -(() => { - var __create = Object.create; - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __getProtoOf = Object.getPrototypeOf; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { - get: (a, b) => (typeof require !== "undefined" ? require : a)[b] - }) : x)(function(x) { - if (typeof require !== "undefined") - return require.apply(this, arguments); - throw Error('Dynamic require of "' + x + '" is not supported'); - }); - var __commonJS = (cb, mod) => function __require2() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod - )); - - // ../../node_modules/jszip/dist/jszip.min.js - var require_jszip_min = __commonJS({ - "../../node_modules/jszip/dist/jszip.min.js"(exports, module) { - !function(e) { - if ("object" == typeof exports && "undefined" != typeof module) - module.exports = e(); - else if ("function" == typeof define && define.amd) - define([], e); - else { - ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).JSZip = e(); - } - }(function() { - return function s(a, o, h) { - function u(r, e2) { - if (!o[r]) { - if (!a[r]) { - var t = "function" == typeof __require && __require; - if (!e2 && t) - return t(r, true); - if (l) - return l(r, true); - var n = new Error("Cannot find module '" + r + "'"); - throw n.code = "MODULE_NOT_FOUND", n; - } - var i = o[r] = { exports: {} }; - a[r][0].call(i.exports, function(e3) { - var t2 = a[r][1][e3]; - return u(t2 || e3); - }, i, i.exports, s, a, o, h); - } - return o[r].exports; - } - for (var l = "function" == typeof __require && __require, e = 0; e < h.length; e++) - u(h[e]); - return u; - }({ 1: [function(e, t, r) { - "use strict"; - var d = e("./utils"), c = e("./support"), p = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - r.encode = function(e2) { - for (var t2, r2, n, i, s, a, o, h = [], u = 0, l = e2.length, f = l, c2 = "string" !== d.getTypeOf(e2); u < e2.length; ) - f = l - u, n = c2 ? (t2 = e2[u++], r2 = u < l ? e2[u++] : 0, u < l ? e2[u++] : 0) : (t2 = e2.charCodeAt(u++), r2 = u < l ? e2.charCodeAt(u++) : 0, u < l ? e2.charCodeAt(u++) : 0), i = t2 >> 2, s = (3 & t2) << 4 | r2 >> 4, a = 1 < f ? (15 & r2) << 2 | n >> 6 : 64, o = 2 < f ? 63 & n : 64, h.push(p.charAt(i) + p.charAt(s) + p.charAt(a) + p.charAt(o)); - return h.join(""); - }, r.decode = function(e2) { - var t2, r2, n, i, s, a, o = 0, h = 0, u = "data:"; - if (e2.substr(0, u.length) === u) - throw new Error("Invalid base64 input, it looks like a data url."); - var l, f = 3 * (e2 = e2.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4; - if (e2.charAt(e2.length - 1) === p.charAt(64) && f--, e2.charAt(e2.length - 2) === p.charAt(64) && f--, f % 1 != 0) - throw new Error("Invalid base64 input, bad content length."); - for (l = c.uint8array ? new Uint8Array(0 | f) : new Array(0 | f); o < e2.length; ) - t2 = p.indexOf(e2.charAt(o++)) << 2 | (i = p.indexOf(e2.charAt(o++))) >> 4, r2 = (15 & i) << 4 | (s = p.indexOf(e2.charAt(o++))) >> 2, n = (3 & s) << 6 | (a = p.indexOf(e2.charAt(o++))), l[h++] = t2, 64 !== s && (l[h++] = r2), 64 !== a && (l[h++] = n); - return l; - }; - }, { "./support": 30, "./utils": 32 }], 2: [function(e, t, r) { - "use strict"; - var n = e("./external"), i = e("./stream/DataWorker"), s = e("./stream/Crc32Probe"), a = e("./stream/DataLengthProbe"); - function o(e2, t2, r2, n2, i2) { - this.compressedSize = e2, this.uncompressedSize = t2, this.crc32 = r2, this.compression = n2, this.compressedContent = i2; - } - o.prototype = { getContentWorker: function() { - var e2 = new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")), t2 = this; - return e2.on("end", function() { - if (this.streamInfo.data_length !== t2.uncompressedSize) - throw new Error("Bug : uncompressed data size mismatch"); - }), e2; - }, getCompressedWorker: function() { - return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression); - } }, o.createWorkerFrom = function(e2, t2, r2) { - return e2.pipe(new s()).pipe(new a("uncompressedSize")).pipe(t2.compressWorker(r2)).pipe(new a("compressedSize")).withStreamInfo("compression", t2); - }, t.exports = o; - }, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function(e, t, r) { - "use strict"; - var n = e("./stream/GenericWorker"); - r.STORE = { magic: "\0\0", compressWorker: function() { - return new n("STORE compression"); - }, uncompressWorker: function() { - return new n("STORE decompression"); - } }, r.DEFLATE = e("./flate"); - }, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function(e, t, r) { - "use strict"; - var n = e("./utils"); - var o = function() { - for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) { - e2 = r2; - for (var n2 = 0; n2 < 8; n2++) - e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1; - t2[r2] = e2; - } - return t2; - }(); - t.exports = function(e2, t2) { - return void 0 !== e2 && e2.length ? "string" !== n.getTypeOf(e2) ? function(e3, t3, r2, n2) { - var i = o, s = n2 + r2; - e3 ^= -1; - for (var a = n2; a < s; a++) - e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3[a])]; - return -1 ^ e3; - }(0 | t2, e2, e2.length, 0) : function(e3, t3, r2, n2) { - var i = o, s = n2 + r2; - e3 ^= -1; - for (var a = n2; a < s; a++) - e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3.charCodeAt(a))]; - return -1 ^ e3; - }(0 | t2, e2, e2.length, 0) : 0; - }; - }, { "./utils": 32 }], 5: [function(e, t, r) { - "use strict"; - r.base64 = false, r.binary = false, r.dir = false, r.createFolders = true, r.date = null, r.compression = null, r.compressionOptions = null, r.comment = null, r.unixPermissions = null, r.dosPermissions = null; - }, {}], 6: [function(e, t, r) { - "use strict"; - var n = null; - n = "undefined" != typeof Promise ? Promise : e("lie"), t.exports = { Promise: n }; - }, { lie: 37 }], 7: [function(e, t, r) { - "use strict"; - var n = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array, i = e("pako"), s = e("./utils"), a = e("./stream/GenericWorker"), o = n ? "uint8array" : "array"; - function h(e2, t2) { - a.call(this, "FlateWorker/" + e2), this._pako = null, this._pakoAction = e2, this._pakoOptions = t2, this.meta = {}; - } - r.magic = "\b\0", s.inherits(h, a), h.prototype.processChunk = function(e2) { - this.meta = e2.meta, null === this._pako && this._createPako(), this._pako.push(s.transformTo(o, e2.data), false); - }, h.prototype.flush = function() { - a.prototype.flush.call(this), null === this._pako && this._createPako(), this._pako.push([], true); - }, h.prototype.cleanUp = function() { - a.prototype.cleanUp.call(this), this._pako = null; - }, h.prototype._createPako = function() { - this._pako = new i[this._pakoAction]({ raw: true, level: this._pakoOptions.level || -1 }); - var t2 = this; - this._pako.onData = function(e2) { - t2.push({ data: e2, meta: t2.meta }); - }; - }, r.compressWorker = function(e2) { - return new h("Deflate", e2); - }, r.uncompressWorker = function() { - return new h("Inflate", {}); - }; - }, { "./stream/GenericWorker": 28, "./utils": 32, pako: 38 }], 8: [function(e, t, r) { - "use strict"; - function A(e2, t2) { - var r2, n2 = ""; - for (r2 = 0; r2 < t2; r2++) - n2 += String.fromCharCode(255 & e2), e2 >>>= 8; - return n2; - } - function n(e2, t2, r2, n2, i2, s2) { - var a, o, h = e2.file, u = e2.compression, l = s2 !== O.utf8encode, f = I.transformTo("string", s2(h.name)), c = I.transformTo("string", O.utf8encode(h.name)), d = h.comment, p = I.transformTo("string", s2(d)), m = I.transformTo("string", O.utf8encode(d)), _ = c.length !== h.name.length, g = m.length !== d.length, b = "", v = "", y = "", w = h.dir, k = h.date, x = { crc32: 0, compressedSize: 0, uncompressedSize: 0 }; - t2 && !r2 || (x.crc32 = e2.crc32, x.compressedSize = e2.compressedSize, x.uncompressedSize = e2.uncompressedSize); - var S = 0; - t2 && (S |= 8), l || !_ && !g || (S |= 2048); - var z = 0, C = 0; - w && (z |= 16), "UNIX" === i2 ? (C = 798, z |= function(e3, t3) { - var r3 = e3; - return e3 || (r3 = t3 ? 16893 : 33204), (65535 & r3) << 16; - }(h.unixPermissions, w)) : (C = 20, z |= function(e3) { - return 63 & (e3 || 0); - }(h.dosPermissions)), a = k.getUTCHours(), a <<= 6, a |= k.getUTCMinutes(), a <<= 5, a |= k.getUTCSeconds() / 2, o = k.getUTCFullYear() - 1980, o <<= 4, o |= k.getUTCMonth() + 1, o <<= 5, o |= k.getUTCDate(), _ && (v = A(1, 1) + A(B(f), 4) + c, b += "up" + A(v.length, 2) + v), g && (y = A(1, 1) + A(B(p), 4) + m, b += "uc" + A(y.length, 2) + y); - var E = ""; - return E += "\n\0", E += A(S, 2), E += u.magic, E += A(a, 2), E += A(o, 2), E += A(x.crc32, 4), E += A(x.compressedSize, 4), E += A(x.uncompressedSize, 4), E += A(f.length, 2), E += A(b.length, 2), { fileRecord: R.LOCAL_FILE_HEADER + E + f + b, dirRecord: R.CENTRAL_FILE_HEADER + A(C, 2) + E + A(p.length, 2) + "\0\0\0\0" + A(z, 4) + A(n2, 4) + f + b + p }; - } - var I = e("../utils"), i = e("../stream/GenericWorker"), O = e("../utf8"), B = e("../crc32"), R = e("../signature"); - function s(e2, t2, r2, n2) { - i.call(this, "ZipFileWorker"), this.bytesWritten = 0, this.zipComment = t2, this.zipPlatform = r2, this.encodeFileName = n2, this.streamFiles = e2, this.accumulate = false, this.contentBuffer = [], this.dirRecords = [], this.currentSourceOffset = 0, this.entriesCount = 0, this.currentFile = null, this._sources = []; - } - I.inherits(s, i), s.prototype.push = function(e2) { - var t2 = e2.meta.percent || 0, r2 = this.entriesCount, n2 = this._sources.length; - this.accumulate ? this.contentBuffer.push(e2) : (this.bytesWritten += e2.data.length, i.prototype.push.call(this, { data: e2.data, meta: { currentFile: this.currentFile, percent: r2 ? (t2 + 100 * (r2 - n2 - 1)) / r2 : 100 } })); - }, s.prototype.openedSource = function(e2) { - this.currentSourceOffset = this.bytesWritten, this.currentFile = e2.file.name; - var t2 = this.streamFiles && !e2.file.dir; - if (t2) { - var r2 = n(e2, t2, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); - this.push({ data: r2.fileRecord, meta: { percent: 0 } }); - } else - this.accumulate = true; - }, s.prototype.closedSource = function(e2) { - this.accumulate = false; - var t2 = this.streamFiles && !e2.file.dir, r2 = n(e2, t2, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); - if (this.dirRecords.push(r2.dirRecord), t2) - this.push({ data: function(e3) { - return R.DATA_DESCRIPTOR + A(e3.crc32, 4) + A(e3.compressedSize, 4) + A(e3.uncompressedSize, 4); - }(e2), meta: { percent: 100 } }); - else - for (this.push({ data: r2.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length; ) - this.push(this.contentBuffer.shift()); - this.currentFile = null; - }, s.prototype.flush = function() { - for (var e2 = this.bytesWritten, t2 = 0; t2 < this.dirRecords.length; t2++) - this.push({ data: this.dirRecords[t2], meta: { percent: 100 } }); - var r2 = this.bytesWritten - e2, n2 = function(e3, t3, r3, n3, i2) { - var s2 = I.transformTo("string", i2(n3)); - return R.CENTRAL_DIRECTORY_END + "\0\0\0\0" + A(e3, 2) + A(e3, 2) + A(t3, 4) + A(r3, 4) + A(s2.length, 2) + s2; - }(this.dirRecords.length, r2, e2, this.zipComment, this.encodeFileName); - this.push({ data: n2, meta: { percent: 100 } }); - }, s.prototype.prepareNextSource = function() { - this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume(); - }, s.prototype.registerPrevious = function(e2) { - this._sources.push(e2); - var t2 = this; - return e2.on("data", function(e3) { - t2.processChunk(e3); - }), e2.on("end", function() { - t2.closedSource(t2.previous.streamInfo), t2._sources.length ? t2.prepareNextSource() : t2.end(); - }), e2.on("error", function(e3) { - t2.error(e3); - }), this; - }, s.prototype.resume = function() { - return !!i.prototype.resume.call(this) && (!this.previous && this._sources.length ? (this.prepareNextSource(), true) : this.previous || this._sources.length || this.generatedError ? void 0 : (this.end(), true)); - }, s.prototype.error = function(e2) { - var t2 = this._sources; - if (!i.prototype.error.call(this, e2)) - return false; - for (var r2 = 0; r2 < t2.length; r2++) - try { - t2[r2].error(e2); - } catch (e3) { - } - return true; - }, s.prototype.lock = function() { - i.prototype.lock.call(this); - for (var e2 = this._sources, t2 = 0; t2 < e2.length; t2++) - e2[t2].lock(); - }, t.exports = s; - }, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function(e, t, r) { - "use strict"; - var u = e("../compressions"), n = e("./ZipFileWorker"); - r.generateWorker = function(e2, a, t2) { - var o = new n(a.streamFiles, t2, a.platform, a.encodeFileName), h = 0; - try { - e2.forEach(function(e3, t3) { - h++; - var r2 = function(e4, t4) { - var r3 = e4 || t4, n3 = u[r3]; - if (!n3) - throw new Error(r3 + " is not a valid compression method !"); - return n3; - }(t3.options.compression, a.compression), n2 = t3.options.compressionOptions || a.compressionOptions || {}, i = t3.dir, s = t3.date; - t3._compressWorker(r2, n2).withStreamInfo("file", { name: e3, dir: i, date: s, comment: t3.comment || "", unixPermissions: t3.unixPermissions, dosPermissions: t3.dosPermissions }).pipe(o); - }), o.entriesCount = h; - } catch (e3) { - o.error(e3); - } - return o; - }; - }, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function(e, t, r) { - "use strict"; - function n() { - if (!(this instanceof n)) - return new n(); - if (arguments.length) - throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide."); - this.files = /* @__PURE__ */ Object.create(null), this.comment = null, this.root = "", this.clone = function() { - var e2 = new n(); - for (var t2 in this) - "function" != typeof this[t2] && (e2[t2] = this[t2]); - return e2; - }; - } - (n.prototype = e("./object")).loadAsync = e("./load"), n.support = e("./support"), n.defaults = e("./defaults"), n.version = "3.10.1", n.loadAsync = function(e2, t2) { - return new n().loadAsync(e2, t2); - }, n.external = e("./external"), t.exports = n; - }, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function(e, t, r) { - "use strict"; - var u = e("./utils"), i = e("./external"), n = e("./utf8"), s = e("./zipEntries"), a = e("./stream/Crc32Probe"), l = e("./nodejsUtils"); - function f(n2) { - return new i.Promise(function(e2, t2) { - var r2 = n2.decompressed.getContentWorker().pipe(new a()); - r2.on("error", function(e3) { - t2(e3); - }).on("end", function() { - r2.streamInfo.crc32 !== n2.decompressed.crc32 ? t2(new Error("Corrupted zip : CRC32 mismatch")) : e2(); - }).resume(); - }); - } - t.exports = function(e2, o) { - var h = this; - return o = u.extend(o || {}, { base64: false, checkCRC32: false, optimizedBinaryString: false, createFolders: false, decodeFileName: n.utf8decode }), l.isNode && l.isStream(e2) ? i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")) : u.prepareContent("the loaded zip file", e2, true, o.optimizedBinaryString, o.base64).then(function(e3) { - var t2 = new s(o); - return t2.load(e3), t2; - }).then(function(e3) { - var t2 = [i.Promise.resolve(e3)], r2 = e3.files; - if (o.checkCRC32) - for (var n2 = 0; n2 < r2.length; n2++) - t2.push(f(r2[n2])); - return i.Promise.all(t2); - }).then(function(e3) { - for (var t2 = e3.shift(), r2 = t2.files, n2 = 0; n2 < r2.length; n2++) { - var i2 = r2[n2], s2 = i2.fileNameStr, a2 = u.resolve(i2.fileNameStr); - h.file(a2, i2.decompressed, { binary: true, optimizedBinaryString: true, date: i2.date, dir: i2.dir, comment: i2.fileCommentStr.length ? i2.fileCommentStr : null, unixPermissions: i2.unixPermissions, dosPermissions: i2.dosPermissions, createFolders: o.createFolders }), i2.dir || (h.file(a2).unsafeOriginalName = s2); - } - return t2.zipComment.length && (h.comment = t2.zipComment), h; - }); - }; - }, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function(e, t, r) { - "use strict"; - var n = e("../utils"), i = e("../stream/GenericWorker"); - function s(e2, t2) { - i.call(this, "Nodejs stream input adapter for " + e2), this._upstreamEnded = false, this._bindStream(t2); - } - n.inherits(s, i), s.prototype._bindStream = function(e2) { - var t2 = this; - (this._stream = e2).pause(), e2.on("data", function(e3) { - t2.push({ data: e3, meta: { percent: 0 } }); - }).on("error", function(e3) { - t2.isPaused ? this.generatedError = e3 : t2.error(e3); - }).on("end", function() { - t2.isPaused ? t2._upstreamEnded = true : t2.end(); - }); - }, s.prototype.pause = function() { - return !!i.prototype.pause.call(this) && (this._stream.pause(), true); - }, s.prototype.resume = function() { - return !!i.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), true); - }, t.exports = s; - }, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function(e, t, r) { - "use strict"; - var i = e("readable-stream").Readable; - function n(e2, t2, r2) { - i.call(this, t2), this._helper = e2; - var n2 = this; - e2.on("data", function(e3, t3) { - n2.push(e3) || n2._helper.pause(), r2 && r2(t3); - }).on("error", function(e3) { - n2.emit("error", e3); - }).on("end", function() { - n2.push(null); - }); - } - e("../utils").inherits(n, i), n.prototype._read = function() { - this._helper.resume(); - }, t.exports = n; - }, { "../utils": 32, "readable-stream": 16 }], 14: [function(e, t, r) { - "use strict"; - t.exports = { isNode: "undefined" != typeof Buffer, newBufferFrom: function(e2, t2) { - if (Buffer.from && Buffer.from !== Uint8Array.from) - return Buffer.from(e2, t2); - if ("number" == typeof e2) - throw new Error('The "data" argument must not be a number'); - return new Buffer(e2, t2); - }, allocBuffer: function(e2) { - if (Buffer.alloc) - return Buffer.alloc(e2); - var t2 = new Buffer(e2); - return t2.fill(0), t2; - }, isBuffer: function(e2) { - return Buffer.isBuffer(e2); - }, isStream: function(e2) { - return e2 && "function" == typeof e2.on && "function" == typeof e2.pause && "function" == typeof e2.resume; - } }; - }, {}], 15: [function(e, t, r) { - "use strict"; - function s(e2, t2, r2) { - var n2, i2 = u.getTypeOf(t2), s2 = u.extend(r2 || {}, f); - s2.date = s2.date || /* @__PURE__ */ new Date(), null !== s2.compression && (s2.compression = s2.compression.toUpperCase()), "string" == typeof s2.unixPermissions && (s2.unixPermissions = parseInt(s2.unixPermissions, 8)), s2.unixPermissions && 16384 & s2.unixPermissions && (s2.dir = true), s2.dosPermissions && 16 & s2.dosPermissions && (s2.dir = true), s2.dir && (e2 = g(e2)), s2.createFolders && (n2 = _(e2)) && b.call(this, n2, true); - var a2 = "string" === i2 && false === s2.binary && false === s2.base64; - r2 && void 0 !== r2.binary || (s2.binary = !a2), (t2 instanceof c && 0 === t2.uncompressedSize || s2.dir || !t2 || 0 === t2.length) && (s2.base64 = false, s2.binary = true, t2 = "", s2.compression = "STORE", i2 = "string"); - var o2 = null; - o2 = t2 instanceof c || t2 instanceof l ? t2 : p.isNode && p.isStream(t2) ? new m(e2, t2) : u.prepareContent(e2, t2, s2.binary, s2.optimizedBinaryString, s2.base64); - var h2 = new d(e2, o2, s2); - this.files[e2] = h2; - } - var i = e("./utf8"), u = e("./utils"), l = e("./stream/GenericWorker"), a = e("./stream/StreamHelper"), f = e("./defaults"), c = e("./compressedObject"), d = e("./zipObject"), o = e("./generate"), p = e("./nodejsUtils"), m = e("./nodejs/NodejsStreamInputAdapter"), _ = function(e2) { - "/" === e2.slice(-1) && (e2 = e2.substring(0, e2.length - 1)); - var t2 = e2.lastIndexOf("/"); - return 0 < t2 ? e2.substring(0, t2) : ""; - }, g = function(e2) { - return "/" !== e2.slice(-1) && (e2 += "/"), e2; - }, b = function(e2, t2) { - return t2 = void 0 !== t2 ? t2 : f.createFolders, e2 = g(e2), this.files[e2] || s.call(this, e2, null, { dir: true, createFolders: t2 }), this.files[e2]; - }; - function h(e2) { - return "[object RegExp]" === Object.prototype.toString.call(e2); - } - var n = { load: function() { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); - }, forEach: function(e2) { - var t2, r2, n2; - for (t2 in this.files) - n2 = this.files[t2], (r2 = t2.slice(this.root.length, t2.length)) && t2.slice(0, this.root.length) === this.root && e2(r2, n2); - }, filter: function(r2) { - var n2 = []; - return this.forEach(function(e2, t2) { - r2(e2, t2) && n2.push(t2); - }), n2; - }, file: function(e2, t2, r2) { - if (1 !== arguments.length) - return e2 = this.root + e2, s.call(this, e2, t2, r2), this; - if (h(e2)) { - var n2 = e2; - return this.filter(function(e3, t3) { - return !t3.dir && n2.test(e3); - }); - } - var i2 = this.files[this.root + e2]; - return i2 && !i2.dir ? i2 : null; - }, folder: function(r2) { - if (!r2) - return this; - if (h(r2)) - return this.filter(function(e3, t3) { - return t3.dir && r2.test(e3); - }); - var e2 = this.root + r2, t2 = b.call(this, e2), n2 = this.clone(); - return n2.root = t2.name, n2; - }, remove: function(r2) { - r2 = this.root + r2; - var e2 = this.files[r2]; - if (e2 || ("/" !== r2.slice(-1) && (r2 += "/"), e2 = this.files[r2]), e2 && !e2.dir) - delete this.files[r2]; - else - for (var t2 = this.filter(function(e3, t3) { - return t3.name.slice(0, r2.length) === r2; - }), n2 = 0; n2 < t2.length; n2++) - delete this.files[t2[n2].name]; - return this; - }, generate: function() { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); - }, generateInternalStream: function(e2) { - var t2, r2 = {}; - try { - if ((r2 = u.extend(e2 || {}, { streamFiles: false, compression: "STORE", compressionOptions: null, type: "", platform: "DOS", comment: null, mimeType: "application/zip", encodeFileName: i.utf8encode })).type = r2.type.toLowerCase(), r2.compression = r2.compression.toUpperCase(), "binarystring" === r2.type && (r2.type = "string"), !r2.type) - throw new Error("No output type specified."); - u.checkSupport(r2.type), "darwin" !== r2.platform && "freebsd" !== r2.platform && "linux" !== r2.platform && "sunos" !== r2.platform || (r2.platform = "UNIX"), "win32" === r2.platform && (r2.platform = "DOS"); - var n2 = r2.comment || this.comment || ""; - t2 = o.generateWorker(this, r2, n2); - } catch (e3) { - (t2 = new l("error")).error(e3); - } - return new a(t2, r2.type || "string", r2.mimeType); - }, generateAsync: function(e2, t2) { - return this.generateInternalStream(e2).accumulate(t2); - }, generateNodeStream: function(e2, t2) { - return (e2 = e2 || {}).type || (e2.type = "nodebuffer"), this.generateInternalStream(e2).toNodejsStream(t2); - } }; - t.exports = n; - }, { "./compressedObject": 2, "./defaults": 5, "./generate": 9, "./nodejs/NodejsStreamInputAdapter": 12, "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31, "./utils": 32, "./zipObject": 35 }], 16: [function(e, t, r) { - "use strict"; - t.exports = e("stream"); - }, { stream: void 0 }], 17: [function(e, t, r) { - "use strict"; - var n = e("./DataReader"); - function i(e2) { - n.call(this, e2); - for (var t2 = 0; t2 < this.data.length; t2++) - e2[t2] = 255 & e2[t2]; - } - e("../utils").inherits(i, n), i.prototype.byteAt = function(e2) { - return this.data[this.zero + e2]; - }, i.prototype.lastIndexOfSignature = function(e2) { - for (var t2 = e2.charCodeAt(0), r2 = e2.charCodeAt(1), n2 = e2.charCodeAt(2), i2 = e2.charCodeAt(3), s = this.length - 4; 0 <= s; --s) - if (this.data[s] === t2 && this.data[s + 1] === r2 && this.data[s + 2] === n2 && this.data[s + 3] === i2) - return s - this.zero; - return -1; - }, i.prototype.readAndCheckSignature = function(e2) { - var t2 = e2.charCodeAt(0), r2 = e2.charCodeAt(1), n2 = e2.charCodeAt(2), i2 = e2.charCodeAt(3), s = this.readData(4); - return t2 === s[0] && r2 === s[1] && n2 === s[2] && i2 === s[3]; - }, i.prototype.readData = function(e2) { - if (this.checkOffset(e2), 0 === e2) - return []; - var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2); - return this.index += e2, t2; - }, t.exports = i; - }, { "../utils": 32, "./DataReader": 18 }], 18: [function(e, t, r) { - "use strict"; - var n = e("../utils"); - function i(e2) { - this.data = e2, this.length = e2.length, this.index = 0, this.zero = 0; - } - i.prototype = { checkOffset: function(e2) { - this.checkIndex(this.index + e2); - }, checkIndex: function(e2) { - if (this.length < this.zero + e2 || e2 < 0) - throw new Error("End of data reached (data length = " + this.length + ", asked index = " + e2 + "). Corrupted zip ?"); - }, setIndex: function(e2) { - this.checkIndex(e2), this.index = e2; - }, skip: function(e2) { - this.setIndex(this.index + e2); - }, byteAt: function() { - }, readInt: function(e2) { - var t2, r2 = 0; - for (this.checkOffset(e2), t2 = this.index + e2 - 1; t2 >= this.index; t2--) - r2 = (r2 << 8) + this.byteAt(t2); - return this.index += e2, r2; - }, readString: function(e2) { - return n.transformTo("string", this.readData(e2)); - }, readData: function() { - }, lastIndexOfSignature: function() { - }, readAndCheckSignature: function() { - }, readDate: function() { - var e2 = this.readInt(4); - return new Date(Date.UTC(1980 + (e2 >> 25 & 127), (e2 >> 21 & 15) - 1, e2 >> 16 & 31, e2 >> 11 & 31, e2 >> 5 & 63, (31 & e2) << 1)); - } }, t.exports = i; - }, { "../utils": 32 }], 19: [function(e, t, r) { - "use strict"; - var n = e("./Uint8ArrayReader"); - function i(e2) { - n.call(this, e2); - } - e("../utils").inherits(i, n), i.prototype.readData = function(e2) { - this.checkOffset(e2); - var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2); - return this.index += e2, t2; - }, t.exports = i; - }, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function(e, t, r) { - "use strict"; - var n = e("./DataReader"); - function i(e2) { - n.call(this, e2); - } - e("../utils").inherits(i, n), i.prototype.byteAt = function(e2) { - return this.data.charCodeAt(this.zero + e2); - }, i.prototype.lastIndexOfSignature = function(e2) { - return this.data.lastIndexOf(e2) - this.zero; - }, i.prototype.readAndCheckSignature = function(e2) { - return e2 === this.readData(4); - }, i.prototype.readData = function(e2) { - this.checkOffset(e2); - var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2); - return this.index += e2, t2; - }, t.exports = i; - }, { "../utils": 32, "./DataReader": 18 }], 21: [function(e, t, r) { - "use strict"; - var n = e("./ArrayReader"); - function i(e2) { - n.call(this, e2); - } - e("../utils").inherits(i, n), i.prototype.readData = function(e2) { - if (this.checkOffset(e2), 0 === e2) - return new Uint8Array(0); - var t2 = this.data.subarray(this.zero + this.index, this.zero + this.index + e2); - return this.index += e2, t2; - }, t.exports = i; - }, { "../utils": 32, "./ArrayReader": 17 }], 22: [function(e, t, r) { - "use strict"; - var n = e("../utils"), i = e("../support"), s = e("./ArrayReader"), a = e("./StringReader"), o = e("./NodeBufferReader"), h = e("./Uint8ArrayReader"); - t.exports = function(e2) { - var t2 = n.getTypeOf(e2); - return n.checkSupport(t2), "string" !== t2 || i.uint8array ? "nodebuffer" === t2 ? new o(e2) : i.uint8array ? new h(n.transformTo("uint8array", e2)) : new s(n.transformTo("array", e2)) : new a(e2); - }; - }, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function(e, t, r) { - "use strict"; - r.LOCAL_FILE_HEADER = "PK", r.CENTRAL_FILE_HEADER = "PK", r.CENTRAL_DIRECTORY_END = "PK", r.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x07", r.ZIP64_CENTRAL_DIRECTORY_END = "PK", r.DATA_DESCRIPTOR = "PK\x07\b"; - }, {}], 24: [function(e, t, r) { - "use strict"; - var n = e("./GenericWorker"), i = e("../utils"); - function s(e2) { - n.call(this, "ConvertWorker to " + e2), this.destType = e2; - } - i.inherits(s, n), s.prototype.processChunk = function(e2) { - this.push({ data: i.transformTo(this.destType, e2.data), meta: e2.meta }); - }, t.exports = s; - }, { "../utils": 32, "./GenericWorker": 28 }], 25: [function(e, t, r) { - "use strict"; - var n = e("./GenericWorker"), i = e("../crc32"); - function s() { - n.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0); - } - e("../utils").inherits(s, n), s.prototype.processChunk = function(e2) { - this.streamInfo.crc32 = i(e2.data, this.streamInfo.crc32 || 0), this.push(e2); - }, t.exports = s; - }, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function(e, t, r) { - "use strict"; - var n = e("../utils"), i = e("./GenericWorker"); - function s(e2) { - i.call(this, "DataLengthProbe for " + e2), this.propName = e2, this.withStreamInfo(e2, 0); - } - n.inherits(s, i), s.prototype.processChunk = function(e2) { - if (e2) { - var t2 = this.streamInfo[this.propName] || 0; - this.streamInfo[this.propName] = t2 + e2.data.length; - } - i.prototype.processChunk.call(this, e2); - }, t.exports = s; - }, { "../utils": 32, "./GenericWorker": 28 }], 27: [function(e, t, r) { - "use strict"; - var n = e("../utils"), i = e("./GenericWorker"); - function s(e2) { - i.call(this, "DataWorker"); - var t2 = this; - this.dataIsReady = false, this.index = 0, this.max = 0, this.data = null, this.type = "", this._tickScheduled = false, e2.then(function(e3) { - t2.dataIsReady = true, t2.data = e3, t2.max = e3 && e3.length || 0, t2.type = n.getTypeOf(e3), t2.isPaused || t2._tickAndRepeat(); - }, function(e3) { - t2.error(e3); - }); - } - n.inherits(s, i), s.prototype.cleanUp = function() { - i.prototype.cleanUp.call(this), this.data = null; - }, s.prototype.resume = function() { - return !!i.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = true, n.delay(this._tickAndRepeat, [], this)), true); - }, s.prototype._tickAndRepeat = function() { - this._tickScheduled = false, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (n.delay(this._tickAndRepeat, [], this), this._tickScheduled = true)); - }, s.prototype._tick = function() { - if (this.isPaused || this.isFinished) - return false; - var e2 = null, t2 = Math.min(this.max, this.index + 16384); - if (this.index >= this.max) - return this.end(); - switch (this.type) { - case "string": - e2 = this.data.substring(this.index, t2); - break; - case "uint8array": - e2 = this.data.subarray(this.index, t2); - break; - case "array": - case "nodebuffer": - e2 = this.data.slice(this.index, t2); - } - return this.index = t2, this.push({ data: e2, meta: { percent: this.max ? this.index / this.max * 100 : 0 } }); - }, t.exports = s; - }, { "../utils": 32, "./GenericWorker": 28 }], 28: [function(e, t, r) { - "use strict"; - function n(e2) { - this.name = e2 || "default", this.streamInfo = {}, this.generatedError = null, this.extraStreamInfo = {}, this.isPaused = true, this.isFinished = false, this.isLocked = false, this._listeners = { data: [], end: [], error: [] }, this.previous = null; - } - n.prototype = { push: function(e2) { - this.emit("data", e2); - }, end: function() { - if (this.isFinished) - return false; - this.flush(); - try { - this.emit("end"), this.cleanUp(), this.isFinished = true; - } catch (e2) { - this.emit("error", e2); - } - return true; - }, error: function(e2) { - return !this.isFinished && (this.isPaused ? this.generatedError = e2 : (this.isFinished = true, this.emit("error", e2), this.previous && this.previous.error(e2), this.cleanUp()), true); - }, on: function(e2, t2) { - return this._listeners[e2].push(t2), this; - }, cleanUp: function() { - this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = []; - }, emit: function(e2, t2) { - if (this._listeners[e2]) - for (var r2 = 0; r2 < this._listeners[e2].length; r2++) - this._listeners[e2][r2].call(this, t2); - }, pipe: function(e2) { - return e2.registerPrevious(this); - }, registerPrevious: function(e2) { - if (this.isLocked) - throw new Error("The stream '" + this + "' has already been used."); - this.streamInfo = e2.streamInfo, this.mergeStreamInfo(), this.previous = e2; - var t2 = this; - return e2.on("data", function(e3) { - t2.processChunk(e3); - }), e2.on("end", function() { - t2.end(); - }), e2.on("error", function(e3) { - t2.error(e3); - }), this; - }, pause: function() { - return !this.isPaused && !this.isFinished && (this.isPaused = true, this.previous && this.previous.pause(), true); - }, resume: function() { - if (!this.isPaused || this.isFinished) - return false; - var e2 = this.isPaused = false; - return this.generatedError && (this.error(this.generatedError), e2 = true), this.previous && this.previous.resume(), !e2; - }, flush: function() { - }, processChunk: function(e2) { - this.push(e2); - }, withStreamInfo: function(e2, t2) { - return this.extraStreamInfo[e2] = t2, this.mergeStreamInfo(), this; - }, mergeStreamInfo: function() { - for (var e2 in this.extraStreamInfo) - Object.prototype.hasOwnProperty.call(this.extraStreamInfo, e2) && (this.streamInfo[e2] = this.extraStreamInfo[e2]); - }, lock: function() { - if (this.isLocked) - throw new Error("The stream '" + this + "' has already been used."); - this.isLocked = true, this.previous && this.previous.lock(); - }, toString: function() { - var e2 = "Worker " + this.name; - return this.previous ? this.previous + " -> " + e2 : e2; - } }, t.exports = n; - }, {}], 29: [function(e, t, r) { - "use strict"; - var h = e("../utils"), i = e("./ConvertWorker"), s = e("./GenericWorker"), u = e("../base64"), n = e("../support"), a = e("../external"), o = null; - if (n.nodestream) - try { - o = e("../nodejs/NodejsStreamOutputAdapter"); - } catch (e2) { - } - function l(e2, o2) { - return new a.Promise(function(t2, r2) { - var n2 = [], i2 = e2._internalType, s2 = e2._outputType, a2 = e2._mimeType; - e2.on("data", function(e3, t3) { - n2.push(e3), o2 && o2(t3); - }).on("error", function(e3) { - n2 = [], r2(e3); - }).on("end", function() { - try { - var e3 = function(e4, t3, r3) { - switch (e4) { - case "blob": - return h.newBlob(h.transformTo("arraybuffer", t3), r3); - case "base64": - return u.encode(t3); - default: - return h.transformTo(e4, t3); - } - }(s2, function(e4, t3) { - var r3, n3 = 0, i3 = null, s3 = 0; - for (r3 = 0; r3 < t3.length; r3++) - s3 += t3[r3].length; - switch (e4) { - case "string": - return t3.join(""); - case "array": - return Array.prototype.concat.apply([], t3); - case "uint8array": - for (i3 = new Uint8Array(s3), r3 = 0; r3 < t3.length; r3++) - i3.set(t3[r3], n3), n3 += t3[r3].length; - return i3; - case "nodebuffer": - return Buffer.concat(t3); - default: - throw new Error("concat : unsupported type '" + e4 + "'"); - } - }(i2, n2), a2); - t2(e3); - } catch (e4) { - r2(e4); - } - n2 = []; - }).resume(); - }); - } - function f(e2, t2, r2) { - var n2 = t2; - switch (t2) { - case "blob": - case "arraybuffer": - n2 = "uint8array"; - break; - case "base64": - n2 = "string"; - } - try { - this._internalType = n2, this._outputType = t2, this._mimeType = r2, h.checkSupport(n2), this._worker = e2.pipe(new i(n2)), e2.lock(); - } catch (e3) { - this._worker = new s("error"), this._worker.error(e3); - } - } - f.prototype = { accumulate: function(e2) { - return l(this, e2); - }, on: function(e2, t2) { - var r2 = this; - return "data" === e2 ? this._worker.on(e2, function(e3) { - t2.call(r2, e3.data, e3.meta); - }) : this._worker.on(e2, function() { - h.delay(t2, arguments, r2); - }), this; - }, resume: function() { - return h.delay(this._worker.resume, [], this._worker), this; - }, pause: function() { - return this._worker.pause(), this; - }, toNodejsStream: function(e2) { - if (h.checkSupport("nodestream"), "nodebuffer" !== this._outputType) - throw new Error(this._outputType + " is not supported by this method"); - return new o(this, { objectMode: "nodebuffer" !== this._outputType }, e2); - } }, t.exports = f; - }, { "../base64": 1, "../external": 6, "../nodejs/NodejsStreamOutputAdapter": 13, "../support": 30, "../utils": 32, "./ConvertWorker": 24, "./GenericWorker": 28 }], 30: [function(e, t, r) { - "use strict"; - if (r.base64 = true, r.array = true, r.string = true, r.arraybuffer = "undefined" != typeof ArrayBuffer && "undefined" != typeof Uint8Array, r.nodebuffer = "undefined" != typeof Buffer, r.uint8array = "undefined" != typeof Uint8Array, "undefined" == typeof ArrayBuffer) - r.blob = false; - else { - var n = new ArrayBuffer(0); - try { - r.blob = 0 === new Blob([n], { type: "application/zip" }).size; - } catch (e2) { - try { - var i = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)(); - i.append(n), r.blob = 0 === i.getBlob("application/zip").size; - } catch (e3) { - r.blob = false; - } - } - } - try { - r.nodestream = !!e("readable-stream").Readable; - } catch (e2) { - r.nodestream = false; - } - }, { "readable-stream": 16 }], 31: [function(e, t, s) { - "use strict"; - for (var o = e("./utils"), h = e("./support"), r = e("./nodejsUtils"), n = e("./stream/GenericWorker"), u = new Array(256), i = 0; i < 256; i++) - u[i] = 252 <= i ? 6 : 248 <= i ? 5 : 240 <= i ? 4 : 224 <= i ? 3 : 192 <= i ? 2 : 1; - u[254] = u[254] = 1; - function a() { - n.call(this, "utf-8 decode"), this.leftOver = null; - } - function l() { - n.call(this, "utf-8 encode"); - } - s.utf8encode = function(e2) { - return h.nodebuffer ? r.newBufferFrom(e2, "utf-8") : function(e3) { - var t2, r2, n2, i2, s2, a2 = e3.length, o2 = 0; - for (i2 = 0; i2 < a2; i2++) - 55296 == (64512 & (r2 = e3.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n2 = e3.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), o2 += r2 < 128 ? 1 : r2 < 2048 ? 2 : r2 < 65536 ? 3 : 4; - for (t2 = h.uint8array ? new Uint8Array(o2) : new Array(o2), i2 = s2 = 0; s2 < o2; i2++) - 55296 == (64512 & (r2 = e3.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n2 = e3.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), r2 < 128 ? t2[s2++] = r2 : (r2 < 2048 ? t2[s2++] = 192 | r2 >>> 6 : (r2 < 65536 ? t2[s2++] = 224 | r2 >>> 12 : (t2[s2++] = 240 | r2 >>> 18, t2[s2++] = 128 | r2 >>> 12 & 63), t2[s2++] = 128 | r2 >>> 6 & 63), t2[s2++] = 128 | 63 & r2); - return t2; - }(e2); - }, s.utf8decode = function(e2) { - return h.nodebuffer ? o.transformTo("nodebuffer", e2).toString("utf-8") : function(e3) { - var t2, r2, n2, i2, s2 = e3.length, a2 = new Array(2 * s2); - for (t2 = r2 = 0; t2 < s2; ) - if ((n2 = e3[t2++]) < 128) - a2[r2++] = n2; - else if (4 < (i2 = u[n2])) - a2[r2++] = 65533, t2 += i2 - 1; - else { - for (n2 &= 2 === i2 ? 31 : 3 === i2 ? 15 : 7; 1 < i2 && t2 < s2; ) - n2 = n2 << 6 | 63 & e3[t2++], i2--; - 1 < i2 ? a2[r2++] = 65533 : n2 < 65536 ? a2[r2++] = n2 : (n2 -= 65536, a2[r2++] = 55296 | n2 >> 10 & 1023, a2[r2++] = 56320 | 1023 & n2); - } - return a2.length !== r2 && (a2.subarray ? a2 = a2.subarray(0, r2) : a2.length = r2), o.applyFromCharCode(a2); - }(e2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2)); - }, o.inherits(a, n), a.prototype.processChunk = function(e2) { - var t2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2.data); - if (this.leftOver && this.leftOver.length) { - if (h.uint8array) { - var r2 = t2; - (t2 = new Uint8Array(r2.length + this.leftOver.length)).set(this.leftOver, 0), t2.set(r2, this.leftOver.length); - } else - t2 = this.leftOver.concat(t2); - this.leftOver = null; - } - var n2 = function(e3, t3) { - var r3; - for ((t3 = t3 || e3.length) > e3.length && (t3 = e3.length), r3 = t3 - 1; 0 <= r3 && 128 == (192 & e3[r3]); ) - r3--; - return r3 < 0 ? t3 : 0 === r3 ? t3 : r3 + u[e3[r3]] > t3 ? r3 : t3; - }(t2), i2 = t2; - n2 !== t2.length && (h.uint8array ? (i2 = t2.subarray(0, n2), this.leftOver = t2.subarray(n2, t2.length)) : (i2 = t2.slice(0, n2), this.leftOver = t2.slice(n2, t2.length))), this.push({ data: s.utf8decode(i2), meta: e2.meta }); - }, a.prototype.flush = function() { - this.leftOver && this.leftOver.length && (this.push({ data: s.utf8decode(this.leftOver), meta: {} }), this.leftOver = null); - }, s.Utf8DecodeWorker = a, o.inherits(l, n), l.prototype.processChunk = function(e2) { - this.push({ data: s.utf8encode(e2.data), meta: e2.meta }); - }, s.Utf8EncodeWorker = l; - }, { "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./support": 30, "./utils": 32 }], 32: [function(e, t, a) { - "use strict"; - var o = e("./support"), h = e("./base64"), r = e("./nodejsUtils"), u = e("./external"); - function n(e2) { - return e2; - } - function l(e2, t2) { - for (var r2 = 0; r2 < e2.length; ++r2) - t2[r2] = 255 & e2.charCodeAt(r2); - return t2; - } - e("setimmediate"), a.newBlob = function(t2, r2) { - a.checkSupport("blob"); - try { - return new Blob([t2], { type: r2 }); - } catch (e2) { - try { - var n2 = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)(); - return n2.append(t2), n2.getBlob(r2); - } catch (e3) { - throw new Error("Bug : can't construct the Blob."); - } - } - }; - var i = { stringifyByChunk: function(e2, t2, r2) { - var n2 = [], i2 = 0, s2 = e2.length; - if (s2 <= r2) - return String.fromCharCode.apply(null, e2); - for (; i2 < s2; ) - "array" === t2 || "nodebuffer" === t2 ? n2.push(String.fromCharCode.apply(null, e2.slice(i2, Math.min(i2 + r2, s2)))) : n2.push(String.fromCharCode.apply(null, e2.subarray(i2, Math.min(i2 + r2, s2)))), i2 += r2; - return n2.join(""); - }, stringifyByChar: function(e2) { - for (var t2 = "", r2 = 0; r2 < e2.length; r2++) - t2 += String.fromCharCode(e2[r2]); - return t2; - }, applyCanBeUsed: { uint8array: function() { - try { - return o.uint8array && 1 === String.fromCharCode.apply(null, new Uint8Array(1)).length; - } catch (e2) { - return false; - } - }(), nodebuffer: function() { - try { - return o.nodebuffer && 1 === String.fromCharCode.apply(null, r.allocBuffer(1)).length; - } catch (e2) { - return false; - } - }() } }; - function s(e2) { - var t2 = 65536, r2 = a.getTypeOf(e2), n2 = true; - if ("uint8array" === r2 ? n2 = i.applyCanBeUsed.uint8array : "nodebuffer" === r2 && (n2 = i.applyCanBeUsed.nodebuffer), n2) - for (; 1 < t2; ) - try { - return i.stringifyByChunk(e2, r2, t2); - } catch (e3) { - t2 = Math.floor(t2 / 2); - } - return i.stringifyByChar(e2); - } - function f(e2, t2) { - for (var r2 = 0; r2 < e2.length; r2++) - t2[r2] = e2[r2]; - return t2; - } - a.applyFromCharCode = s; - var c = {}; - c.string = { string: n, array: function(e2) { - return l(e2, new Array(e2.length)); - }, arraybuffer: function(e2) { - return c.string.uint8array(e2).buffer; - }, uint8array: function(e2) { - return l(e2, new Uint8Array(e2.length)); - }, nodebuffer: function(e2) { - return l(e2, r.allocBuffer(e2.length)); - } }, c.array = { string: s, array: n, arraybuffer: function(e2) { - return new Uint8Array(e2).buffer; - }, uint8array: function(e2) { - return new Uint8Array(e2); - }, nodebuffer: function(e2) { - return r.newBufferFrom(e2); - } }, c.arraybuffer = { string: function(e2) { - return s(new Uint8Array(e2)); - }, array: function(e2) { - return f(new Uint8Array(e2), new Array(e2.byteLength)); - }, arraybuffer: n, uint8array: function(e2) { - return new Uint8Array(e2); - }, nodebuffer: function(e2) { - return r.newBufferFrom(new Uint8Array(e2)); - } }, c.uint8array = { string: s, array: function(e2) { - return f(e2, new Array(e2.length)); - }, arraybuffer: function(e2) { - return e2.buffer; - }, uint8array: n, nodebuffer: function(e2) { - return r.newBufferFrom(e2); - } }, c.nodebuffer = { string: s, array: function(e2) { - return f(e2, new Array(e2.length)); - }, arraybuffer: function(e2) { - return c.nodebuffer.uint8array(e2).buffer; - }, uint8array: function(e2) { - return f(e2, new Uint8Array(e2.length)); - }, nodebuffer: n }, a.transformTo = function(e2, t2) { - if (t2 = t2 || "", !e2) - return t2; - a.checkSupport(e2); - var r2 = a.getTypeOf(t2); - return c[r2][e2](t2); - }, a.resolve = function(e2) { - for (var t2 = e2.split("/"), r2 = [], n2 = 0; n2 < t2.length; n2++) { - var i2 = t2[n2]; - "." === i2 || "" === i2 && 0 !== n2 && n2 !== t2.length - 1 || (".." === i2 ? r2.pop() : r2.push(i2)); - } - return r2.join("/"); - }, a.getTypeOf = function(e2) { - return "string" == typeof e2 ? "string" : "[object Array]" === Object.prototype.toString.call(e2) ? "array" : o.nodebuffer && r.isBuffer(e2) ? "nodebuffer" : o.uint8array && e2 instanceof Uint8Array ? "uint8array" : o.arraybuffer && e2 instanceof ArrayBuffer ? "arraybuffer" : void 0; - }, a.checkSupport = function(e2) { - if (!o[e2.toLowerCase()]) - throw new Error(e2 + " is not supported by this platform"); - }, a.MAX_VALUE_16BITS = 65535, a.MAX_VALUE_32BITS = -1, a.pretty = function(e2) { - var t2, r2, n2 = ""; - for (r2 = 0; r2 < (e2 || "").length; r2++) - n2 += "\\x" + ((t2 = e2.charCodeAt(r2)) < 16 ? "0" : "") + t2.toString(16).toUpperCase(); - return n2; - }, a.delay = function(e2, t2, r2) { - setImmediate(function() { - e2.apply(r2 || null, t2 || []); - }); - }, a.inherits = function(e2, t2) { - function r2() { - } - r2.prototype = t2.prototype, e2.prototype = new r2(); - }, a.extend = function() { - var e2, t2, r2 = {}; - for (e2 = 0; e2 < arguments.length; e2++) - for (t2 in arguments[e2]) - Object.prototype.hasOwnProperty.call(arguments[e2], t2) && void 0 === r2[t2] && (r2[t2] = arguments[e2][t2]); - return r2; - }, a.prepareContent = function(r2, e2, n2, i2, s2) { - return u.Promise.resolve(e2).then(function(n3) { - return o.blob && (n3 instanceof Blob || -1 !== ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(n3))) && "undefined" != typeof FileReader ? new u.Promise(function(t2, r3) { - var e3 = new FileReader(); - e3.onload = function(e4) { - t2(e4.target.result); - }, e3.onerror = function(e4) { - r3(e4.target.error); - }, e3.readAsArrayBuffer(n3); - }) : n3; - }).then(function(e3) { - var t2 = a.getTypeOf(e3); - return t2 ? ("arraybuffer" === t2 ? e3 = a.transformTo("uint8array", e3) : "string" === t2 && (s2 ? e3 = h.decode(e3) : n2 && true !== i2 && (e3 = function(e4) { - return l(e4, o.uint8array ? new Uint8Array(e4.length) : new Array(e4.length)); - }(e3))), e3) : u.Promise.reject(new Error("Can't read the data of '" + r2 + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?")); - }); - }; - }, { "./base64": 1, "./external": 6, "./nodejsUtils": 14, "./support": 30, setimmediate: 54 }], 33: [function(e, t, r) { - "use strict"; - var n = e("./reader/readerFor"), i = e("./utils"), s = e("./signature"), a = e("./zipEntry"), o = e("./support"); - function h(e2) { - this.files = [], this.loadOptions = e2; - } - h.prototype = { checkSignature: function(e2) { - if (!this.reader.readAndCheckSignature(e2)) { - this.reader.index -= 4; - var t2 = this.reader.readString(4); - throw new Error("Corrupted zip or bug: unexpected signature (" + i.pretty(t2) + ", expected " + i.pretty(e2) + ")"); - } - }, isSignature: function(e2, t2) { - var r2 = this.reader.index; - this.reader.setIndex(e2); - var n2 = this.reader.readString(4) === t2; - return this.reader.setIndex(r2), n2; - }, readBlockEndOfCentral: function() { - this.diskNumber = this.reader.readInt(2), this.diskWithCentralDirStart = this.reader.readInt(2), this.centralDirRecordsOnThisDisk = this.reader.readInt(2), this.centralDirRecords = this.reader.readInt(2), this.centralDirSize = this.reader.readInt(4), this.centralDirOffset = this.reader.readInt(4), this.zipCommentLength = this.reader.readInt(2); - var e2 = this.reader.readData(this.zipCommentLength), t2 = o.uint8array ? "uint8array" : "array", r2 = i.transformTo(t2, e2); - this.zipComment = this.loadOptions.decodeFileName(r2); - }, readBlockZip64EndOfCentral: function() { - this.zip64EndOfCentralSize = this.reader.readInt(8), this.reader.skip(4), this.diskNumber = this.reader.readInt(4), this.diskWithCentralDirStart = this.reader.readInt(4), this.centralDirRecordsOnThisDisk = this.reader.readInt(8), this.centralDirRecords = this.reader.readInt(8), this.centralDirSize = this.reader.readInt(8), this.centralDirOffset = this.reader.readInt(8), this.zip64ExtensibleData = {}; - for (var e2, t2, r2, n2 = this.zip64EndOfCentralSize - 44; 0 < n2; ) - e2 = this.reader.readInt(2), t2 = this.reader.readInt(4), r2 = this.reader.readData(t2), this.zip64ExtensibleData[e2] = { id: e2, length: t2, value: r2 }; - }, readBlockZip64EndOfCentralLocator: function() { - if (this.diskWithZip64CentralDirStart = this.reader.readInt(4), this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8), this.disksCount = this.reader.readInt(4), 1 < this.disksCount) - throw new Error("Multi-volumes zip are not supported"); - }, readLocalFiles: function() { - var e2, t2; - for (e2 = 0; e2 < this.files.length; e2++) - t2 = this.files[e2], this.reader.setIndex(t2.localHeaderOffset), this.checkSignature(s.LOCAL_FILE_HEADER), t2.readLocalPart(this.reader), t2.handleUTF8(), t2.processAttributes(); - }, readCentralDir: function() { - var e2; - for (this.reader.setIndex(this.centralDirOffset); this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER); ) - (e2 = new a({ zip64: this.zip64 }, this.loadOptions)).readCentralPart(this.reader), this.files.push(e2); - if (this.centralDirRecords !== this.files.length && 0 !== this.centralDirRecords && 0 === this.files.length) - throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length); - }, readEndOfCentral: function() { - var e2 = this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END); - if (e2 < 0) - throw !this.isSignature(0, s.LOCAL_FILE_HEADER) ? new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html") : new Error("Corrupted zip: can't find end of central directory"); - this.reader.setIndex(e2); - var t2 = e2; - if (this.checkSignature(s.CENTRAL_DIRECTORY_END), this.readBlockEndOfCentral(), this.diskNumber === i.MAX_VALUE_16BITS || this.diskWithCentralDirStart === i.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === i.MAX_VALUE_16BITS || this.centralDirRecords === i.MAX_VALUE_16BITS || this.centralDirSize === i.MAX_VALUE_32BITS || this.centralDirOffset === i.MAX_VALUE_32BITS) { - if (this.zip64 = true, (e2 = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR)) < 0) - throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator"); - if (this.reader.setIndex(e2), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR), this.readBlockZip64EndOfCentralLocator(), !this.isSignature(this.relativeOffsetEndOfZip64CentralDir, s.ZIP64_CENTRAL_DIRECTORY_END) && (this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.relativeOffsetEndOfZip64CentralDir < 0)) - throw new Error("Corrupted zip: can't find the ZIP64 end of central directory"); - this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.readBlockZip64EndOfCentral(); - } - var r2 = this.centralDirOffset + this.centralDirSize; - this.zip64 && (r2 += 20, r2 += 12 + this.zip64EndOfCentralSize); - var n2 = t2 - r2; - if (0 < n2) - this.isSignature(t2, s.CENTRAL_FILE_HEADER) || (this.reader.zero = n2); - else if (n2 < 0) - throw new Error("Corrupted zip: missing " + Math.abs(n2) + " bytes."); - }, prepareReader: function(e2) { - this.reader = n(e2); - }, load: function(e2) { - this.prepareReader(e2), this.readEndOfCentral(), this.readCentralDir(), this.readLocalFiles(); - } }, t.exports = h; - }, { "./reader/readerFor": 22, "./signature": 23, "./support": 30, "./utils": 32, "./zipEntry": 34 }], 34: [function(e, t, r) { - "use strict"; - var n = e("./reader/readerFor"), s = e("./utils"), i = e("./compressedObject"), a = e("./crc32"), o = e("./utf8"), h = e("./compressions"), u = e("./support"); - function l(e2, t2) { - this.options = e2, this.loadOptions = t2; - } - l.prototype = { isEncrypted: function() { - return 1 == (1 & this.bitFlag); - }, useUTF8: function() { - return 2048 == (2048 & this.bitFlag); - }, readLocalPart: function(e2) { - var t2, r2; - if (e2.skip(22), this.fileNameLength = e2.readInt(2), r2 = e2.readInt(2), this.fileName = e2.readData(this.fileNameLength), e2.skip(r2), -1 === this.compressedSize || -1 === this.uncompressedSize) - throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)"); - if (null === (t2 = function(e3) { - for (var t3 in h) - if (Object.prototype.hasOwnProperty.call(h, t3) && h[t3].magic === e3) - return h[t3]; - return null; - }(this.compressionMethod))) - throw new Error("Corrupted zip : compression " + s.pretty(this.compressionMethod) + " unknown (inner file : " + s.transformTo("string", this.fileName) + ")"); - this.decompressed = new i(this.compressedSize, this.uncompressedSize, this.crc32, t2, e2.readData(this.compressedSize)); - }, readCentralPart: function(e2) { - this.versionMadeBy = e2.readInt(2), e2.skip(2), this.bitFlag = e2.readInt(2), this.compressionMethod = e2.readString(2), this.date = e2.readDate(), this.crc32 = e2.readInt(4), this.compressedSize = e2.readInt(4), this.uncompressedSize = e2.readInt(4); - var t2 = e2.readInt(2); - if (this.extraFieldsLength = e2.readInt(2), this.fileCommentLength = e2.readInt(2), this.diskNumberStart = e2.readInt(2), this.internalFileAttributes = e2.readInt(2), this.externalFileAttributes = e2.readInt(4), this.localHeaderOffset = e2.readInt(4), this.isEncrypted()) - throw new Error("Encrypted zip are not supported"); - e2.skip(t2), this.readExtraFields(e2), this.parseZIP64ExtraField(e2), this.fileComment = e2.readData(this.fileCommentLength); - }, processAttributes: function() { - this.unixPermissions = null, this.dosPermissions = null; - var e2 = this.versionMadeBy >> 8; - this.dir = !!(16 & this.externalFileAttributes), 0 == e2 && (this.dosPermissions = 63 & this.externalFileAttributes), 3 == e2 && (this.unixPermissions = this.externalFileAttributes >> 16 & 65535), this.dir || "/" !== this.fileNameStr.slice(-1) || (this.dir = true); - }, parseZIP64ExtraField: function() { - if (this.extraFields[1]) { - var e2 = n(this.extraFields[1].value); - this.uncompressedSize === s.MAX_VALUE_32BITS && (this.uncompressedSize = e2.readInt(8)), this.compressedSize === s.MAX_VALUE_32BITS && (this.compressedSize = e2.readInt(8)), this.localHeaderOffset === s.MAX_VALUE_32BITS && (this.localHeaderOffset = e2.readInt(8)), this.diskNumberStart === s.MAX_VALUE_32BITS && (this.diskNumberStart = e2.readInt(4)); - } - }, readExtraFields: function(e2) { - var t2, r2, n2, i2 = e2.index + this.extraFieldsLength; - for (this.extraFields || (this.extraFields = {}); e2.index + 4 < i2; ) - t2 = e2.readInt(2), r2 = e2.readInt(2), n2 = e2.readData(r2), this.extraFields[t2] = { id: t2, length: r2, value: n2 }; - e2.setIndex(i2); - }, handleUTF8: function() { - var e2 = u.uint8array ? "uint8array" : "array"; - if (this.useUTF8()) - this.fileNameStr = o.utf8decode(this.fileName), this.fileCommentStr = o.utf8decode(this.fileComment); - else { - var t2 = this.findExtraFieldUnicodePath(); - if (null !== t2) - this.fileNameStr = t2; - else { - var r2 = s.transformTo(e2, this.fileName); - this.fileNameStr = this.loadOptions.decodeFileName(r2); - } - var n2 = this.findExtraFieldUnicodeComment(); - if (null !== n2) - this.fileCommentStr = n2; - else { - var i2 = s.transformTo(e2, this.fileComment); - this.fileCommentStr = this.loadOptions.decodeFileName(i2); - } - } - }, findExtraFieldUnicodePath: function() { - var e2 = this.extraFields[28789]; - if (e2) { - var t2 = n(e2.value); - return 1 !== t2.readInt(1) ? null : a(this.fileName) !== t2.readInt(4) ? null : o.utf8decode(t2.readData(e2.length - 5)); - } - return null; - }, findExtraFieldUnicodeComment: function() { - var e2 = this.extraFields[25461]; - if (e2) { - var t2 = n(e2.value); - return 1 !== t2.readInt(1) ? null : a(this.fileComment) !== t2.readInt(4) ? null : o.utf8decode(t2.readData(e2.length - 5)); - } - return null; - } }, t.exports = l; - }, { "./compressedObject": 2, "./compressions": 3, "./crc32": 4, "./reader/readerFor": 22, "./support": 30, "./utf8": 31, "./utils": 32 }], 35: [function(e, t, r) { - "use strict"; - function n(e2, t2, r2) { - this.name = e2, this.dir = r2.dir, this.date = r2.date, this.comment = r2.comment, this.unixPermissions = r2.unixPermissions, this.dosPermissions = r2.dosPermissions, this._data = t2, this._dataBinary = r2.binary, this.options = { compression: r2.compression, compressionOptions: r2.compressionOptions }; - } - var s = e("./stream/StreamHelper"), i = e("./stream/DataWorker"), a = e("./utf8"), o = e("./compressedObject"), h = e("./stream/GenericWorker"); - n.prototype = { internalStream: function(e2) { - var t2 = null, r2 = "string"; - try { - if (!e2) - throw new Error("No output type specified."); - var n2 = "string" === (r2 = e2.toLowerCase()) || "text" === r2; - "binarystring" !== r2 && "text" !== r2 || (r2 = "string"), t2 = this._decompressWorker(); - var i2 = !this._dataBinary; - i2 && !n2 && (t2 = t2.pipe(new a.Utf8EncodeWorker())), !i2 && n2 && (t2 = t2.pipe(new a.Utf8DecodeWorker())); - } catch (e3) { - (t2 = new h("error")).error(e3); - } - return new s(t2, r2, ""); - }, async: function(e2, t2) { - return this.internalStream(e2).accumulate(t2); - }, nodeStream: function(e2, t2) { - return this.internalStream(e2 || "nodebuffer").toNodejsStream(t2); - }, _compressWorker: function(e2, t2) { - if (this._data instanceof o && this._data.compression.magic === e2.magic) - return this._data.getCompressedWorker(); - var r2 = this._decompressWorker(); - return this._dataBinary || (r2 = r2.pipe(new a.Utf8EncodeWorker())), o.createWorkerFrom(r2, e2, t2); - }, _decompressWorker: function() { - return this._data instanceof o ? this._data.getContentWorker() : this._data instanceof h ? this._data : new i(this._data); - } }; - for (var u = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"], l = function() { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); - }, f = 0; f < u.length; f++) - n.prototype[u[f]] = l; - t.exports = n; - }, { "./compressedObject": 2, "./stream/DataWorker": 27, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31 }], 36: [function(e, l, t) { - (function(t2) { - "use strict"; - var r, n, e2 = t2.MutationObserver || t2.WebKitMutationObserver; - if (e2) { - var i = 0, s = new e2(u), a = t2.document.createTextNode(""); - s.observe(a, { characterData: true }), r = function() { - a.data = i = ++i % 2; - }; - } else if (t2.setImmediate || void 0 === t2.MessageChannel) - r = "document" in t2 && "onreadystatechange" in t2.document.createElement("script") ? function() { - var e3 = t2.document.createElement("script"); - e3.onreadystatechange = function() { - u(), e3.onreadystatechange = null, e3.parentNode.removeChild(e3), e3 = null; - }, t2.document.documentElement.appendChild(e3); - } : function() { - setTimeout(u, 0); - }; - else { - var o = new t2.MessageChannel(); - o.port1.onmessage = u, r = function() { - o.port2.postMessage(0); - }; - } - var h = []; - function u() { - var e3, t3; - n = true; - for (var r2 = h.length; r2; ) { - for (t3 = h, h = [], e3 = -1; ++e3 < r2; ) - t3[e3](); - r2 = h.length; - } - n = false; - } - l.exports = function(e3) { - 1 !== h.push(e3) || n || r(); - }; - }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}); - }, {}], 37: [function(e, t, r) { - "use strict"; - var i = e("immediate"); - function u() { - } - var l = {}, s = ["REJECTED"], a = ["FULFILLED"], n = ["PENDING"]; - function o(e2) { - if ("function" != typeof e2) - throw new TypeError("resolver must be a function"); - this.state = n, this.queue = [], this.outcome = void 0, e2 !== u && d(this, e2); - } - function h(e2, t2, r2) { - this.promise = e2, "function" == typeof t2 && (this.onFulfilled = t2, this.callFulfilled = this.otherCallFulfilled), "function" == typeof r2 && (this.onRejected = r2, this.callRejected = this.otherCallRejected); - } - function f(t2, r2, n2) { - i(function() { - var e2; - try { - e2 = r2(n2); - } catch (e3) { - return l.reject(t2, e3); - } - e2 === t2 ? l.reject(t2, new TypeError("Cannot resolve promise with itself")) : l.resolve(t2, e2); - }); - } - function c(e2) { - var t2 = e2 && e2.then; - if (e2 && ("object" == typeof e2 || "function" == typeof e2) && "function" == typeof t2) - return function() { - t2.apply(e2, arguments); - }; - } - function d(t2, e2) { - var r2 = false; - function n2(e3) { - r2 || (r2 = true, l.reject(t2, e3)); - } - function i2(e3) { - r2 || (r2 = true, l.resolve(t2, e3)); - } - var s2 = p(function() { - e2(i2, n2); - }); - "error" === s2.status && n2(s2.value); - } - function p(e2, t2) { - var r2 = {}; - try { - r2.value = e2(t2), r2.status = "success"; - } catch (e3) { - r2.status = "error", r2.value = e3; - } - return r2; - } - (t.exports = o).prototype.finally = function(t2) { - if ("function" != typeof t2) - return this; - var r2 = this.constructor; - return this.then(function(e2) { - return r2.resolve(t2()).then(function() { - return e2; - }); - }, function(e2) { - return r2.resolve(t2()).then(function() { - throw e2; - }); - }); - }, o.prototype.catch = function(e2) { - return this.then(null, e2); - }, o.prototype.then = function(e2, t2) { - if ("function" != typeof e2 && this.state === a || "function" != typeof t2 && this.state === s) - return this; - var r2 = new this.constructor(u); - this.state !== n ? f(r2, this.state === a ? e2 : t2, this.outcome) : this.queue.push(new h(r2, e2, t2)); - return r2; - }, h.prototype.callFulfilled = function(e2) { - l.resolve(this.promise, e2); - }, h.prototype.otherCallFulfilled = function(e2) { - f(this.promise, this.onFulfilled, e2); - }, h.prototype.callRejected = function(e2) { - l.reject(this.promise, e2); - }, h.prototype.otherCallRejected = function(e2) { - f(this.promise, this.onRejected, e2); - }, l.resolve = function(e2, t2) { - var r2 = p(c, t2); - if ("error" === r2.status) - return l.reject(e2, r2.value); - var n2 = r2.value; - if (n2) - d(e2, n2); - else { - e2.state = a, e2.outcome = t2; - for (var i2 = -1, s2 = e2.queue.length; ++i2 < s2; ) - e2.queue[i2].callFulfilled(t2); - } - return e2; - }, l.reject = function(e2, t2) { - e2.state = s, e2.outcome = t2; - for (var r2 = -1, n2 = e2.queue.length; ++r2 < n2; ) - e2.queue[r2].callRejected(t2); - return e2; - }, o.resolve = function(e2) { - if (e2 instanceof this) - return e2; - return l.resolve(new this(u), e2); - }, o.reject = function(e2) { - var t2 = new this(u); - return l.reject(t2, e2); - }, o.all = function(e2) { - var r2 = this; - if ("[object Array]" !== Object.prototype.toString.call(e2)) - return this.reject(new TypeError("must be an array")); - var n2 = e2.length, i2 = false; - if (!n2) - return this.resolve([]); - var s2 = new Array(n2), a2 = 0, t2 = -1, o2 = new this(u); - for (; ++t2 < n2; ) - h2(e2[t2], t2); - return o2; - function h2(e3, t3) { - r2.resolve(e3).then(function(e4) { - s2[t3] = e4, ++a2 !== n2 || i2 || (i2 = true, l.resolve(o2, s2)); - }, function(e4) { - i2 || (i2 = true, l.reject(o2, e4)); - }); - } - }, o.race = function(e2) { - var t2 = this; - if ("[object Array]" !== Object.prototype.toString.call(e2)) - return this.reject(new TypeError("must be an array")); - var r2 = e2.length, n2 = false; - if (!r2) - return this.resolve([]); - var i2 = -1, s2 = new this(u); - for (; ++i2 < r2; ) - a2 = e2[i2], t2.resolve(a2).then(function(e3) { - n2 || (n2 = true, l.resolve(s2, e3)); - }, function(e3) { - n2 || (n2 = true, l.reject(s2, e3)); - }); - var a2; - return s2; - }; - }, { immediate: 36 }], 38: [function(e, t, r) { - "use strict"; - var n = {}; - (0, e("./lib/utils/common").assign)(n, e("./lib/deflate"), e("./lib/inflate"), e("./lib/zlib/constants")), t.exports = n; - }, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function(e, t, r) { - "use strict"; - var a = e("./zlib/deflate"), o = e("./utils/common"), h = e("./utils/strings"), i = e("./zlib/messages"), s = e("./zlib/zstream"), u = Object.prototype.toString, l = 0, f = -1, c = 0, d = 8; - function p(e2) { - if (!(this instanceof p)) - return new p(e2); - this.options = o.assign({ level: f, method: d, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: c, to: "" }, e2 || {}); - var t2 = this.options; - t2.raw && 0 < t2.windowBits ? t2.windowBits = -t2.windowBits : t2.gzip && 0 < t2.windowBits && t2.windowBits < 16 && (t2.windowBits += 16), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new s(), this.strm.avail_out = 0; - var r2 = a.deflateInit2(this.strm, t2.level, t2.method, t2.windowBits, t2.memLevel, t2.strategy); - if (r2 !== l) - throw new Error(i[r2]); - if (t2.header && a.deflateSetHeader(this.strm, t2.header), t2.dictionary) { - var n2; - if (n2 = "string" == typeof t2.dictionary ? h.string2buf(t2.dictionary) : "[object ArrayBuffer]" === u.call(t2.dictionary) ? new Uint8Array(t2.dictionary) : t2.dictionary, (r2 = a.deflateSetDictionary(this.strm, n2)) !== l) - throw new Error(i[r2]); - this._dict_set = true; - } - } - function n(e2, t2) { - var r2 = new p(t2); - if (r2.push(e2, true), r2.err) - throw r2.msg || i[r2.err]; - return r2.result; - } - p.prototype.push = function(e2, t2) { - var r2, n2, i2 = this.strm, s2 = this.options.chunkSize; - if (this.ended) - return false; - n2 = t2 === ~~t2 ? t2 : true === t2 ? 4 : 0, "string" == typeof e2 ? i2.input = h.string2buf(e2) : "[object ArrayBuffer]" === u.call(e2) ? i2.input = new Uint8Array(e2) : i2.input = e2, i2.next_in = 0, i2.avail_in = i2.input.length; - do { - if (0 === i2.avail_out && (i2.output = new o.Buf8(s2), i2.next_out = 0, i2.avail_out = s2), 1 !== (r2 = a.deflate(i2, n2)) && r2 !== l) - return this.onEnd(r2), !(this.ended = true); - 0 !== i2.avail_out && (0 !== i2.avail_in || 4 !== n2 && 2 !== n2) || ("string" === this.options.to ? this.onData(h.buf2binstring(o.shrinkBuf(i2.output, i2.next_out))) : this.onData(o.shrinkBuf(i2.output, i2.next_out))); - } while ((0 < i2.avail_in || 0 === i2.avail_out) && 1 !== r2); - return 4 === n2 ? (r2 = a.deflateEnd(this.strm), this.onEnd(r2), this.ended = true, r2 === l) : 2 !== n2 || (this.onEnd(l), !(i2.avail_out = 0)); - }, p.prototype.onData = function(e2) { - this.chunks.push(e2); - }, p.prototype.onEnd = function(e2) { - e2 === l && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = o.flattenChunks(this.chunks)), this.chunks = [], this.err = e2, this.msg = this.strm.msg; - }, r.Deflate = p, r.deflate = n, r.deflateRaw = function(e2, t2) { - return (t2 = t2 || {}).raw = true, n(e2, t2); - }, r.gzip = function(e2, t2) { - return (t2 = t2 || {}).gzip = true, n(e2, t2); - }; - }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(e, t, r) { - "use strict"; - var c = e("./zlib/inflate"), d = e("./utils/common"), p = e("./utils/strings"), m = e("./zlib/constants"), n = e("./zlib/messages"), i = e("./zlib/zstream"), s = e("./zlib/gzheader"), _ = Object.prototype.toString; - function a(e2) { - if (!(this instanceof a)) - return new a(e2); - this.options = d.assign({ chunkSize: 16384, windowBits: 0, to: "" }, e2 || {}); - var t2 = this.options; - t2.raw && 0 <= t2.windowBits && t2.windowBits < 16 && (t2.windowBits = -t2.windowBits, 0 === t2.windowBits && (t2.windowBits = -15)), !(0 <= t2.windowBits && t2.windowBits < 16) || e2 && e2.windowBits || (t2.windowBits += 32), 15 < t2.windowBits && t2.windowBits < 48 && 0 == (15 & t2.windowBits) && (t2.windowBits |= 15), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new i(), this.strm.avail_out = 0; - var r2 = c.inflateInit2(this.strm, t2.windowBits); - if (r2 !== m.Z_OK) - throw new Error(n[r2]); - this.header = new s(), c.inflateGetHeader(this.strm, this.header); - } - function o(e2, t2) { - var r2 = new a(t2); - if (r2.push(e2, true), r2.err) - throw r2.msg || n[r2.err]; - return r2.result; - } - a.prototype.push = function(e2, t2) { - var r2, n2, i2, s2, a2, o2, h = this.strm, u = this.options.chunkSize, l = this.options.dictionary, f = false; - if (this.ended) - return false; - n2 = t2 === ~~t2 ? t2 : true === t2 ? m.Z_FINISH : m.Z_NO_FLUSH, "string" == typeof e2 ? h.input = p.binstring2buf(e2) : "[object ArrayBuffer]" === _.call(e2) ? h.input = new Uint8Array(e2) : h.input = e2, h.next_in = 0, h.avail_in = h.input.length; - do { - if (0 === h.avail_out && (h.output = new d.Buf8(u), h.next_out = 0, h.avail_out = u), (r2 = c.inflate(h, m.Z_NO_FLUSH)) === m.Z_NEED_DICT && l && (o2 = "string" == typeof l ? p.string2buf(l) : "[object ArrayBuffer]" === _.call(l) ? new Uint8Array(l) : l, r2 = c.inflateSetDictionary(this.strm, o2)), r2 === m.Z_BUF_ERROR && true === f && (r2 = m.Z_OK, f = false), r2 !== m.Z_STREAM_END && r2 !== m.Z_OK) - return this.onEnd(r2), !(this.ended = true); - h.next_out && (0 !== h.avail_out && r2 !== m.Z_STREAM_END && (0 !== h.avail_in || n2 !== m.Z_FINISH && n2 !== m.Z_SYNC_FLUSH) || ("string" === this.options.to ? (i2 = p.utf8border(h.output, h.next_out), s2 = h.next_out - i2, a2 = p.buf2string(h.output, i2), h.next_out = s2, h.avail_out = u - s2, s2 && d.arraySet(h.output, h.output, i2, s2, 0), this.onData(a2)) : this.onData(d.shrinkBuf(h.output, h.next_out)))), 0 === h.avail_in && 0 === h.avail_out && (f = true); - } while ((0 < h.avail_in || 0 === h.avail_out) && r2 !== m.Z_STREAM_END); - return r2 === m.Z_STREAM_END && (n2 = m.Z_FINISH), n2 === m.Z_FINISH ? (r2 = c.inflateEnd(this.strm), this.onEnd(r2), this.ended = true, r2 === m.Z_OK) : n2 !== m.Z_SYNC_FLUSH || (this.onEnd(m.Z_OK), !(h.avail_out = 0)); - }, a.prototype.onData = function(e2) { - this.chunks.push(e2); - }, a.prototype.onEnd = function(e2) { - e2 === m.Z_OK && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = d.flattenChunks(this.chunks)), this.chunks = [], this.err = e2, this.msg = this.strm.msg; - }, r.Inflate = a, r.inflate = o, r.inflateRaw = function(e2, t2) { - return (t2 = t2 || {}).raw = true, o(e2, t2); - }, r.ungzip = o; - }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/constants": 44, "./zlib/gzheader": 47, "./zlib/inflate": 49, "./zlib/messages": 51, "./zlib/zstream": 53 }], 41: [function(e, t, r) { - "use strict"; - var n = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Int32Array; - r.assign = function(e2) { - for (var t2 = Array.prototype.slice.call(arguments, 1); t2.length; ) { - var r2 = t2.shift(); - if (r2) { - if ("object" != typeof r2) - throw new TypeError(r2 + "must be non-object"); - for (var n2 in r2) - r2.hasOwnProperty(n2) && (e2[n2] = r2[n2]); - } - } - return e2; - }, r.shrinkBuf = function(e2, t2) { - return e2.length === t2 ? e2 : e2.subarray ? e2.subarray(0, t2) : (e2.length = t2, e2); - }; - var i = { arraySet: function(e2, t2, r2, n2, i2) { - if (t2.subarray && e2.subarray) - e2.set(t2.subarray(r2, r2 + n2), i2); - else - for (var s2 = 0; s2 < n2; s2++) - e2[i2 + s2] = t2[r2 + s2]; - }, flattenChunks: function(e2) { - var t2, r2, n2, i2, s2, a; - for (t2 = n2 = 0, r2 = e2.length; t2 < r2; t2++) - n2 += e2[t2].length; - for (a = new Uint8Array(n2), t2 = i2 = 0, r2 = e2.length; t2 < r2; t2++) - s2 = e2[t2], a.set(s2, i2), i2 += s2.length; - return a; - } }, s = { arraySet: function(e2, t2, r2, n2, i2) { - for (var s2 = 0; s2 < n2; s2++) - e2[i2 + s2] = t2[r2 + s2]; - }, flattenChunks: function(e2) { - return [].concat.apply([], e2); - } }; - r.setTyped = function(e2) { - e2 ? (r.Buf8 = Uint8Array, r.Buf16 = Uint16Array, r.Buf32 = Int32Array, r.assign(r, i)) : (r.Buf8 = Array, r.Buf16 = Array, r.Buf32 = Array, r.assign(r, s)); - }, r.setTyped(n); - }, {}], 42: [function(e, t, r) { - "use strict"; - var h = e("./common"), i = true, s = true; - try { - String.fromCharCode.apply(null, [0]); - } catch (e2) { - i = false; - } - try { - String.fromCharCode.apply(null, new Uint8Array(1)); - } catch (e2) { - s = false; - } - for (var u = new h.Buf8(256), n = 0; n < 256; n++) - u[n] = 252 <= n ? 6 : 248 <= n ? 5 : 240 <= n ? 4 : 224 <= n ? 3 : 192 <= n ? 2 : 1; - function l(e2, t2) { - if (t2 < 65537 && (e2.subarray && s || !e2.subarray && i)) - return String.fromCharCode.apply(null, h.shrinkBuf(e2, t2)); - for (var r2 = "", n2 = 0; n2 < t2; n2++) - r2 += String.fromCharCode(e2[n2]); - return r2; - } - u[254] = u[254] = 1, r.string2buf = function(e2) { - var t2, r2, n2, i2, s2, a = e2.length, o = 0; - for (i2 = 0; i2 < a; i2++) - 55296 == (64512 & (r2 = e2.charCodeAt(i2))) && i2 + 1 < a && 56320 == (64512 & (n2 = e2.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), o += r2 < 128 ? 1 : r2 < 2048 ? 2 : r2 < 65536 ? 3 : 4; - for (t2 = new h.Buf8(o), i2 = s2 = 0; s2 < o; i2++) - 55296 == (64512 & (r2 = e2.charCodeAt(i2))) && i2 + 1 < a && 56320 == (64512 & (n2 = e2.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), r2 < 128 ? t2[s2++] = r2 : (r2 < 2048 ? t2[s2++] = 192 | r2 >>> 6 : (r2 < 65536 ? t2[s2++] = 224 | r2 >>> 12 : (t2[s2++] = 240 | r2 >>> 18, t2[s2++] = 128 | r2 >>> 12 & 63), t2[s2++] = 128 | r2 >>> 6 & 63), t2[s2++] = 128 | 63 & r2); - return t2; - }, r.buf2binstring = function(e2) { - return l(e2, e2.length); - }, r.binstring2buf = function(e2) { - for (var t2 = new h.Buf8(e2.length), r2 = 0, n2 = t2.length; r2 < n2; r2++) - t2[r2] = e2.charCodeAt(r2); - return t2; - }, r.buf2string = function(e2, t2) { - var r2, n2, i2, s2, a = t2 || e2.length, o = new Array(2 * a); - for (r2 = n2 = 0; r2 < a; ) - if ((i2 = e2[r2++]) < 128) - o[n2++] = i2; - else if (4 < (s2 = u[i2])) - o[n2++] = 65533, r2 += s2 - 1; - else { - for (i2 &= 2 === s2 ? 31 : 3 === s2 ? 15 : 7; 1 < s2 && r2 < a; ) - i2 = i2 << 6 | 63 & e2[r2++], s2--; - 1 < s2 ? o[n2++] = 65533 : i2 < 65536 ? o[n2++] = i2 : (i2 -= 65536, o[n2++] = 55296 | i2 >> 10 & 1023, o[n2++] = 56320 | 1023 & i2); - } - return l(o, n2); - }, r.utf8border = function(e2, t2) { - var r2; - for ((t2 = t2 || e2.length) > e2.length && (t2 = e2.length), r2 = t2 - 1; 0 <= r2 && 128 == (192 & e2[r2]); ) - r2--; - return r2 < 0 ? t2 : 0 === r2 ? t2 : r2 + u[e2[r2]] > t2 ? r2 : t2; - }; - }, { "./common": 41 }], 43: [function(e, t, r) { - "use strict"; - t.exports = function(e2, t2, r2, n) { - for (var i = 65535 & e2 | 0, s = e2 >>> 16 & 65535 | 0, a = 0; 0 !== r2; ) { - for (r2 -= a = 2e3 < r2 ? 2e3 : r2; s = s + (i = i + t2[n++] | 0) | 0, --a; ) - ; - i %= 65521, s %= 65521; - } - return i | s << 16 | 0; - }; - }, {}], 44: [function(e, t, r) { - "use strict"; - t.exports = { Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, Z_BUF_ERROR: -5, Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, Z_BINARY: 0, Z_TEXT: 1, Z_UNKNOWN: 2, Z_DEFLATED: 8 }; - }, {}], 45: [function(e, t, r) { - "use strict"; - var o = function() { - for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) { - e2 = r2; - for (var n = 0; n < 8; n++) - e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1; - t2[r2] = e2; - } - return t2; - }(); - t.exports = function(e2, t2, r2, n) { - var i = o, s = n + r2; - e2 ^= -1; - for (var a = n; a < s; a++) - e2 = e2 >>> 8 ^ i[255 & (e2 ^ t2[a])]; - return -1 ^ e2; - }; - }, {}], 46: [function(e, t, r) { - "use strict"; - var h, c = e("../utils/common"), u = e("./trees"), d = e("./adler32"), p = e("./crc32"), n = e("./messages"), l = 0, f = 4, m = 0, _ = -2, g = -1, b = 4, i = 2, v = 8, y = 9, s = 286, a = 30, o = 19, w = 2 * s + 1, k = 15, x = 3, S = 258, z = S + x + 1, C = 42, E = 113, A = 1, I = 2, O = 3, B = 4; - function R(e2, t2) { - return e2.msg = n[t2], t2; - } - function T(e2) { - return (e2 << 1) - (4 < e2 ? 9 : 0); - } - function D(e2) { - for (var t2 = e2.length; 0 <= --t2; ) - e2[t2] = 0; - } - function F(e2) { - var t2 = e2.state, r2 = t2.pending; - r2 > e2.avail_out && (r2 = e2.avail_out), 0 !== r2 && (c.arraySet(e2.output, t2.pending_buf, t2.pending_out, r2, e2.next_out), e2.next_out += r2, t2.pending_out += r2, e2.total_out += r2, e2.avail_out -= r2, t2.pending -= r2, 0 === t2.pending && (t2.pending_out = 0)); - } - function N(e2, t2) { - u._tr_flush_block(e2, 0 <= e2.block_start ? e2.block_start : -1, e2.strstart - e2.block_start, t2), e2.block_start = e2.strstart, F(e2.strm); - } - function U(e2, t2) { - e2.pending_buf[e2.pending++] = t2; - } - function P(e2, t2) { - e2.pending_buf[e2.pending++] = t2 >>> 8 & 255, e2.pending_buf[e2.pending++] = 255 & t2; - } - function L(e2, t2) { - var r2, n2, i2 = e2.max_chain_length, s2 = e2.strstart, a2 = e2.prev_length, o2 = e2.nice_match, h2 = e2.strstart > e2.w_size - z ? e2.strstart - (e2.w_size - z) : 0, u2 = e2.window, l2 = e2.w_mask, f2 = e2.prev, c2 = e2.strstart + S, d2 = u2[s2 + a2 - 1], p2 = u2[s2 + a2]; - e2.prev_length >= e2.good_match && (i2 >>= 2), o2 > e2.lookahead && (o2 = e2.lookahead); - do { - if (u2[(r2 = t2) + a2] === p2 && u2[r2 + a2 - 1] === d2 && u2[r2] === u2[s2] && u2[++r2] === u2[s2 + 1]) { - s2 += 2, r2++; - do { - } while (u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && s2 < c2); - if (n2 = S - (c2 - s2), s2 = c2 - S, a2 < n2) { - if (e2.match_start = t2, o2 <= (a2 = n2)) - break; - d2 = u2[s2 + a2 - 1], p2 = u2[s2 + a2]; - } - } - } while ((t2 = f2[t2 & l2]) > h2 && 0 != --i2); - return a2 <= e2.lookahead ? a2 : e2.lookahead; - } - function j(e2) { - var t2, r2, n2, i2, s2, a2, o2, h2, u2, l2, f2 = e2.w_size; - do { - if (i2 = e2.window_size - e2.lookahead - e2.strstart, e2.strstart >= f2 + (f2 - z)) { - for (c.arraySet(e2.window, e2.window, f2, f2, 0), e2.match_start -= f2, e2.strstart -= f2, e2.block_start -= f2, t2 = r2 = e2.hash_size; n2 = e2.head[--t2], e2.head[t2] = f2 <= n2 ? n2 - f2 : 0, --r2; ) - ; - for (t2 = r2 = f2; n2 = e2.prev[--t2], e2.prev[t2] = f2 <= n2 ? n2 - f2 : 0, --r2; ) - ; - i2 += f2; - } - if (0 === e2.strm.avail_in) - break; - if (a2 = e2.strm, o2 = e2.window, h2 = e2.strstart + e2.lookahead, u2 = i2, l2 = void 0, l2 = a2.avail_in, u2 < l2 && (l2 = u2), r2 = 0 === l2 ? 0 : (a2.avail_in -= l2, c.arraySet(o2, a2.input, a2.next_in, l2, h2), 1 === a2.state.wrap ? a2.adler = d(a2.adler, o2, l2, h2) : 2 === a2.state.wrap && (a2.adler = p(a2.adler, o2, l2, h2)), a2.next_in += l2, a2.total_in += l2, l2), e2.lookahead += r2, e2.lookahead + e2.insert >= x) - for (s2 = e2.strstart - e2.insert, e2.ins_h = e2.window[s2], e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[s2 + 1]) & e2.hash_mask; e2.insert && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[s2 + x - 1]) & e2.hash_mask, e2.prev[s2 & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = s2, s2++, e2.insert--, !(e2.lookahead + e2.insert < x)); ) - ; - } while (e2.lookahead < z && 0 !== e2.strm.avail_in); - } - function Z(e2, t2) { - for (var r2, n2; ; ) { - if (e2.lookahead < z) { - if (j(e2), e2.lookahead < z && t2 === l) - return A; - if (0 === e2.lookahead) - break; - } - if (r2 = 0, e2.lookahead >= x && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), 0 !== r2 && e2.strstart - r2 <= e2.w_size - z && (e2.match_length = L(e2, r2)), e2.match_length >= x) - if (n2 = u._tr_tally(e2, e2.strstart - e2.match_start, e2.match_length - x), e2.lookahead -= e2.match_length, e2.match_length <= e2.max_lazy_match && e2.lookahead >= x) { - for (e2.match_length--; e2.strstart++, e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart, 0 != --e2.match_length; ) - ; - e2.strstart++; - } else - e2.strstart += e2.match_length, e2.match_length = 0, e2.ins_h = e2.window[e2.strstart], e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + 1]) & e2.hash_mask; - else - n2 = u._tr_tally(e2, 0, e2.window[e2.strstart]), e2.lookahead--, e2.strstart++; - if (n2 && (N(e2, false), 0 === e2.strm.avail_out)) - return A; - } - return e2.insert = e2.strstart < x - 1 ? e2.strstart : x - 1, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : e2.last_lit && (N(e2, false), 0 === e2.strm.avail_out) ? A : I; - } - function W(e2, t2) { - for (var r2, n2, i2; ; ) { - if (e2.lookahead < z) { - if (j(e2), e2.lookahead < z && t2 === l) - return A; - if (0 === e2.lookahead) - break; - } - if (r2 = 0, e2.lookahead >= x && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), e2.prev_length = e2.match_length, e2.prev_match = e2.match_start, e2.match_length = x - 1, 0 !== r2 && e2.prev_length < e2.max_lazy_match && e2.strstart - r2 <= e2.w_size - z && (e2.match_length = L(e2, r2), e2.match_length <= 5 && (1 === e2.strategy || e2.match_length === x && 4096 < e2.strstart - e2.match_start) && (e2.match_length = x - 1)), e2.prev_length >= x && e2.match_length <= e2.prev_length) { - for (i2 = e2.strstart + e2.lookahead - x, n2 = u._tr_tally(e2, e2.strstart - 1 - e2.prev_match, e2.prev_length - x), e2.lookahead -= e2.prev_length - 1, e2.prev_length -= 2; ++e2.strstart <= i2 && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), 0 != --e2.prev_length; ) - ; - if (e2.match_available = 0, e2.match_length = x - 1, e2.strstart++, n2 && (N(e2, false), 0 === e2.strm.avail_out)) - return A; - } else if (e2.match_available) { - if ((n2 = u._tr_tally(e2, 0, e2.window[e2.strstart - 1])) && N(e2, false), e2.strstart++, e2.lookahead--, 0 === e2.strm.avail_out) - return A; - } else - e2.match_available = 1, e2.strstart++, e2.lookahead--; - } - return e2.match_available && (n2 = u._tr_tally(e2, 0, e2.window[e2.strstart - 1]), e2.match_available = 0), e2.insert = e2.strstart < x - 1 ? e2.strstart : x - 1, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : e2.last_lit && (N(e2, false), 0 === e2.strm.avail_out) ? A : I; - } - function M(e2, t2, r2, n2, i2) { - this.good_length = e2, this.max_lazy = t2, this.nice_length = r2, this.max_chain = n2, this.func = i2; - } - function H() { - this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = v, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new c.Buf16(2 * w), this.dyn_dtree = new c.Buf16(2 * (2 * a + 1)), this.bl_tree = new c.Buf16(2 * (2 * o + 1)), D(this.dyn_ltree), D(this.dyn_dtree), D(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new c.Buf16(k + 1), this.heap = new c.Buf16(2 * s + 1), D(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new c.Buf16(2 * s + 1), D(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0; - } - function G(e2) { - var t2; - return e2 && e2.state ? (e2.total_in = e2.total_out = 0, e2.data_type = i, (t2 = e2.state).pending = 0, t2.pending_out = 0, t2.wrap < 0 && (t2.wrap = -t2.wrap), t2.status = t2.wrap ? C : E, e2.adler = 2 === t2.wrap ? 0 : 1, t2.last_flush = l, u._tr_init(t2), m) : R(e2, _); - } - function K(e2) { - var t2 = G(e2); - return t2 === m && function(e3) { - e3.window_size = 2 * e3.w_size, D(e3.head), e3.max_lazy_match = h[e3.level].max_lazy, e3.good_match = h[e3.level].good_length, e3.nice_match = h[e3.level].nice_length, e3.max_chain_length = h[e3.level].max_chain, e3.strstart = 0, e3.block_start = 0, e3.lookahead = 0, e3.insert = 0, e3.match_length = e3.prev_length = x - 1, e3.match_available = 0, e3.ins_h = 0; - }(e2.state), t2; - } - function Y(e2, t2, r2, n2, i2, s2) { - if (!e2) - return _; - var a2 = 1; - if (t2 === g && (t2 = 6), n2 < 0 ? (a2 = 0, n2 = -n2) : 15 < n2 && (a2 = 2, n2 -= 16), i2 < 1 || y < i2 || r2 !== v || n2 < 8 || 15 < n2 || t2 < 0 || 9 < t2 || s2 < 0 || b < s2) - return R(e2, _); - 8 === n2 && (n2 = 9); - var o2 = new H(); - return (e2.state = o2).strm = e2, o2.wrap = a2, o2.gzhead = null, o2.w_bits = n2, o2.w_size = 1 << o2.w_bits, o2.w_mask = o2.w_size - 1, o2.hash_bits = i2 + 7, o2.hash_size = 1 << o2.hash_bits, o2.hash_mask = o2.hash_size - 1, o2.hash_shift = ~~((o2.hash_bits + x - 1) / x), o2.window = new c.Buf8(2 * o2.w_size), o2.head = new c.Buf16(o2.hash_size), o2.prev = new c.Buf16(o2.w_size), o2.lit_bufsize = 1 << i2 + 6, o2.pending_buf_size = 4 * o2.lit_bufsize, o2.pending_buf = new c.Buf8(o2.pending_buf_size), o2.d_buf = 1 * o2.lit_bufsize, o2.l_buf = 3 * o2.lit_bufsize, o2.level = t2, o2.strategy = s2, o2.method = r2, K(e2); - } - h = [new M(0, 0, 0, 0, function(e2, t2) { - var r2 = 65535; - for (r2 > e2.pending_buf_size - 5 && (r2 = e2.pending_buf_size - 5); ; ) { - if (e2.lookahead <= 1) { - if (j(e2), 0 === e2.lookahead && t2 === l) - return A; - if (0 === e2.lookahead) - break; - } - e2.strstart += e2.lookahead, e2.lookahead = 0; - var n2 = e2.block_start + r2; - if ((0 === e2.strstart || e2.strstart >= n2) && (e2.lookahead = e2.strstart - n2, e2.strstart = n2, N(e2, false), 0 === e2.strm.avail_out)) - return A; - if (e2.strstart - e2.block_start >= e2.w_size - z && (N(e2, false), 0 === e2.strm.avail_out)) - return A; - } - return e2.insert = 0, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : (e2.strstart > e2.block_start && (N(e2, false), e2.strm.avail_out), A); - }), new M(4, 4, 8, 4, Z), new M(4, 5, 16, 8, Z), new M(4, 6, 32, 32, Z), new M(4, 4, 16, 16, W), new M(8, 16, 32, 32, W), new M(8, 16, 128, 128, W), new M(8, 32, 128, 256, W), new M(32, 128, 258, 1024, W), new M(32, 258, 258, 4096, W)], r.deflateInit = function(e2, t2) { - return Y(e2, t2, v, 15, 8, 0); - }, r.deflateInit2 = Y, r.deflateReset = K, r.deflateResetKeep = G, r.deflateSetHeader = function(e2, t2) { - return e2 && e2.state ? 2 !== e2.state.wrap ? _ : (e2.state.gzhead = t2, m) : _; - }, r.deflate = function(e2, t2) { - var r2, n2, i2, s2; - if (!e2 || !e2.state || 5 < t2 || t2 < 0) - return e2 ? R(e2, _) : _; - if (n2 = e2.state, !e2.output || !e2.input && 0 !== e2.avail_in || 666 === n2.status && t2 !== f) - return R(e2, 0 === e2.avail_out ? -5 : _); - if (n2.strm = e2, r2 = n2.last_flush, n2.last_flush = t2, n2.status === C) - if (2 === n2.wrap) - e2.adler = 0, U(n2, 31), U(n2, 139), U(n2, 8), n2.gzhead ? (U(n2, (n2.gzhead.text ? 1 : 0) + (n2.gzhead.hcrc ? 2 : 0) + (n2.gzhead.extra ? 4 : 0) + (n2.gzhead.name ? 8 : 0) + (n2.gzhead.comment ? 16 : 0)), U(n2, 255 & n2.gzhead.time), U(n2, n2.gzhead.time >> 8 & 255), U(n2, n2.gzhead.time >> 16 & 255), U(n2, n2.gzhead.time >> 24 & 255), U(n2, 9 === n2.level ? 2 : 2 <= n2.strategy || n2.level < 2 ? 4 : 0), U(n2, 255 & n2.gzhead.os), n2.gzhead.extra && n2.gzhead.extra.length && (U(n2, 255 & n2.gzhead.extra.length), U(n2, n2.gzhead.extra.length >> 8 & 255)), n2.gzhead.hcrc && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending, 0)), n2.gzindex = 0, n2.status = 69) : (U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 9 === n2.level ? 2 : 2 <= n2.strategy || n2.level < 2 ? 4 : 0), U(n2, 3), n2.status = E); - else { - var a2 = v + (n2.w_bits - 8 << 4) << 8; - a2 |= (2 <= n2.strategy || n2.level < 2 ? 0 : n2.level < 6 ? 1 : 6 === n2.level ? 2 : 3) << 6, 0 !== n2.strstart && (a2 |= 32), a2 += 31 - a2 % 31, n2.status = E, P(n2, a2), 0 !== n2.strstart && (P(n2, e2.adler >>> 16), P(n2, 65535 & e2.adler)), e2.adler = 1; - } - if (69 === n2.status) - if (n2.gzhead.extra) { - for (i2 = n2.pending; n2.gzindex < (65535 & n2.gzhead.extra.length) && (n2.pending !== n2.pending_buf_size || (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending !== n2.pending_buf_size)); ) - U(n2, 255 & n2.gzhead.extra[n2.gzindex]), n2.gzindex++; - n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), n2.gzindex === n2.gzhead.extra.length && (n2.gzindex = 0, n2.status = 73); - } else - n2.status = 73; - if (73 === n2.status) - if (n2.gzhead.name) { - i2 = n2.pending; - do { - if (n2.pending === n2.pending_buf_size && (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending === n2.pending_buf_size)) { - s2 = 1; - break; - } - s2 = n2.gzindex < n2.gzhead.name.length ? 255 & n2.gzhead.name.charCodeAt(n2.gzindex++) : 0, U(n2, s2); - } while (0 !== s2); - n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), 0 === s2 && (n2.gzindex = 0, n2.status = 91); - } else - n2.status = 91; - if (91 === n2.status) - if (n2.gzhead.comment) { - i2 = n2.pending; - do { - if (n2.pending === n2.pending_buf_size && (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending === n2.pending_buf_size)) { - s2 = 1; - break; - } - s2 = n2.gzindex < n2.gzhead.comment.length ? 255 & n2.gzhead.comment.charCodeAt(n2.gzindex++) : 0, U(n2, s2); - } while (0 !== s2); - n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), 0 === s2 && (n2.status = 103); - } else - n2.status = 103; - if (103 === n2.status && (n2.gzhead.hcrc ? (n2.pending + 2 > n2.pending_buf_size && F(e2), n2.pending + 2 <= n2.pending_buf_size && (U(n2, 255 & e2.adler), U(n2, e2.adler >> 8 & 255), e2.adler = 0, n2.status = E)) : n2.status = E), 0 !== n2.pending) { - if (F(e2), 0 === e2.avail_out) - return n2.last_flush = -1, m; - } else if (0 === e2.avail_in && T(t2) <= T(r2) && t2 !== f) - return R(e2, -5); - if (666 === n2.status && 0 !== e2.avail_in) - return R(e2, -5); - if (0 !== e2.avail_in || 0 !== n2.lookahead || t2 !== l && 666 !== n2.status) { - var o2 = 2 === n2.strategy ? function(e3, t3) { - for (var r3; ; ) { - if (0 === e3.lookahead && (j(e3), 0 === e3.lookahead)) { - if (t3 === l) - return A; - break; - } - if (e3.match_length = 0, r3 = u._tr_tally(e3, 0, e3.window[e3.strstart]), e3.lookahead--, e3.strstart++, r3 && (N(e3, false), 0 === e3.strm.avail_out)) - return A; - } - return e3.insert = 0, t3 === f ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I; - }(n2, t2) : 3 === n2.strategy ? function(e3, t3) { - for (var r3, n3, i3, s3, a3 = e3.window; ; ) { - if (e3.lookahead <= S) { - if (j(e3), e3.lookahead <= S && t3 === l) - return A; - if (0 === e3.lookahead) - break; - } - if (e3.match_length = 0, e3.lookahead >= x && 0 < e3.strstart && (n3 = a3[i3 = e3.strstart - 1]) === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]) { - s3 = e3.strstart + S; - do { - } while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && i3 < s3); - e3.match_length = S - (s3 - i3), e3.match_length > e3.lookahead && (e3.match_length = e3.lookahead); - } - if (e3.match_length >= x ? (r3 = u._tr_tally(e3, 1, e3.match_length - x), e3.lookahead -= e3.match_length, e3.strstart += e3.match_length, e3.match_length = 0) : (r3 = u._tr_tally(e3, 0, e3.window[e3.strstart]), e3.lookahead--, e3.strstart++), r3 && (N(e3, false), 0 === e3.strm.avail_out)) - return A; - } - return e3.insert = 0, t3 === f ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I; - }(n2, t2) : h[n2.level].func(n2, t2); - if (o2 !== O && o2 !== B || (n2.status = 666), o2 === A || o2 === O) - return 0 === e2.avail_out && (n2.last_flush = -1), m; - if (o2 === I && (1 === t2 ? u._tr_align(n2) : 5 !== t2 && (u._tr_stored_block(n2, 0, 0, false), 3 === t2 && (D(n2.head), 0 === n2.lookahead && (n2.strstart = 0, n2.block_start = 0, n2.insert = 0))), F(e2), 0 === e2.avail_out)) - return n2.last_flush = -1, m; - } - return t2 !== f ? m : n2.wrap <= 0 ? 1 : (2 === n2.wrap ? (U(n2, 255 & e2.adler), U(n2, e2.adler >> 8 & 255), U(n2, e2.adler >> 16 & 255), U(n2, e2.adler >> 24 & 255), U(n2, 255 & e2.total_in), U(n2, e2.total_in >> 8 & 255), U(n2, e2.total_in >> 16 & 255), U(n2, e2.total_in >> 24 & 255)) : (P(n2, e2.adler >>> 16), P(n2, 65535 & e2.adler)), F(e2), 0 < n2.wrap && (n2.wrap = -n2.wrap), 0 !== n2.pending ? m : 1); - }, r.deflateEnd = function(e2) { - var t2; - return e2 && e2.state ? (t2 = e2.state.status) !== C && 69 !== t2 && 73 !== t2 && 91 !== t2 && 103 !== t2 && t2 !== E && 666 !== t2 ? R(e2, _) : (e2.state = null, t2 === E ? R(e2, -3) : m) : _; - }, r.deflateSetDictionary = function(e2, t2) { - var r2, n2, i2, s2, a2, o2, h2, u2, l2 = t2.length; - if (!e2 || !e2.state) - return _; - if (2 === (s2 = (r2 = e2.state).wrap) || 1 === s2 && r2.status !== C || r2.lookahead) - return _; - for (1 === s2 && (e2.adler = d(e2.adler, t2, l2, 0)), r2.wrap = 0, l2 >= r2.w_size && (0 === s2 && (D(r2.head), r2.strstart = 0, r2.block_start = 0, r2.insert = 0), u2 = new c.Buf8(r2.w_size), c.arraySet(u2, t2, l2 - r2.w_size, r2.w_size, 0), t2 = u2, l2 = r2.w_size), a2 = e2.avail_in, o2 = e2.next_in, h2 = e2.input, e2.avail_in = l2, e2.next_in = 0, e2.input = t2, j(r2); r2.lookahead >= x; ) { - for (n2 = r2.strstart, i2 = r2.lookahead - (x - 1); r2.ins_h = (r2.ins_h << r2.hash_shift ^ r2.window[n2 + x - 1]) & r2.hash_mask, r2.prev[n2 & r2.w_mask] = r2.head[r2.ins_h], r2.head[r2.ins_h] = n2, n2++, --i2; ) - ; - r2.strstart = n2, r2.lookahead = x - 1, j(r2); - } - return r2.strstart += r2.lookahead, r2.block_start = r2.strstart, r2.insert = r2.lookahead, r2.lookahead = 0, r2.match_length = r2.prev_length = x - 1, r2.match_available = 0, e2.next_in = o2, e2.input = h2, e2.avail_in = a2, r2.wrap = s2, m; - }, r.deflateInfo = "pako deflate (from Nodeca project)"; - }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./messages": 51, "./trees": 52 }], 47: [function(e, t, r) { - "use strict"; - t.exports = function() { - this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = false; - }; - }, {}], 48: [function(e, t, r) { - "use strict"; - t.exports = function(e2, t2) { - var r2, n, i, s, a, o, h, u, l, f, c, d, p, m, _, g, b, v, y, w, k, x, S, z, C; - r2 = e2.state, n = e2.next_in, z = e2.input, i = n + (e2.avail_in - 5), s = e2.next_out, C = e2.output, a = s - (t2 - e2.avail_out), o = s + (e2.avail_out - 257), h = r2.dmax, u = r2.wsize, l = r2.whave, f = r2.wnext, c = r2.window, d = r2.hold, p = r2.bits, m = r2.lencode, _ = r2.distcode, g = (1 << r2.lenbits) - 1, b = (1 << r2.distbits) - 1; - e: - do { - p < 15 && (d += z[n++] << p, p += 8, d += z[n++] << p, p += 8), v = m[d & g]; - t: - for (; ; ) { - if (d >>>= y = v >>> 24, p -= y, 0 === (y = v >>> 16 & 255)) - C[s++] = 65535 & v; - else { - if (!(16 & y)) { - if (0 == (64 & y)) { - v = m[(65535 & v) + (d & (1 << y) - 1)]; - continue t; - } - if (32 & y) { - r2.mode = 12; - break e; - } - e2.msg = "invalid literal/length code", r2.mode = 30; - break e; - } - w = 65535 & v, (y &= 15) && (p < y && (d += z[n++] << p, p += 8), w += d & (1 << y) - 1, d >>>= y, p -= y), p < 15 && (d += z[n++] << p, p += 8, d += z[n++] << p, p += 8), v = _[d & b]; - r: - for (; ; ) { - if (d >>>= y = v >>> 24, p -= y, !(16 & (y = v >>> 16 & 255))) { - if (0 == (64 & y)) { - v = _[(65535 & v) + (d & (1 << y) - 1)]; - continue r; - } - e2.msg = "invalid distance code", r2.mode = 30; - break e; - } - if (k = 65535 & v, p < (y &= 15) && (d += z[n++] << p, (p += 8) < y && (d += z[n++] << p, p += 8)), h < (k += d & (1 << y) - 1)) { - e2.msg = "invalid distance too far back", r2.mode = 30; - break e; - } - if (d >>>= y, p -= y, (y = s - a) < k) { - if (l < (y = k - y) && r2.sane) { - e2.msg = "invalid distance too far back", r2.mode = 30; - break e; - } - if (S = c, (x = 0) === f) { - if (x += u - y, y < w) { - for (w -= y; C[s++] = c[x++], --y; ) - ; - x = s - k, S = C; - } - } else if (f < y) { - if (x += u + f - y, (y -= f) < w) { - for (w -= y; C[s++] = c[x++], --y; ) - ; - if (x = 0, f < w) { - for (w -= y = f; C[s++] = c[x++], --y; ) - ; - x = s - k, S = C; - } - } - } else if (x += f - y, y < w) { - for (w -= y; C[s++] = c[x++], --y; ) - ; - x = s - k, S = C; - } - for (; 2 < w; ) - C[s++] = S[x++], C[s++] = S[x++], C[s++] = S[x++], w -= 3; - w && (C[s++] = S[x++], 1 < w && (C[s++] = S[x++])); - } else { - for (x = s - k; C[s++] = C[x++], C[s++] = C[x++], C[s++] = C[x++], 2 < (w -= 3); ) - ; - w && (C[s++] = C[x++], 1 < w && (C[s++] = C[x++])); - } - break; - } - } - break; - } - } while (n < i && s < o); - n -= w = p >> 3, d &= (1 << (p -= w << 3)) - 1, e2.next_in = n, e2.next_out = s, e2.avail_in = n < i ? i - n + 5 : 5 - (n - i), e2.avail_out = s < o ? o - s + 257 : 257 - (s - o), r2.hold = d, r2.bits = p; - }; - }, {}], 49: [function(e, t, r) { - "use strict"; - var I = e("../utils/common"), O = e("./adler32"), B = e("./crc32"), R = e("./inffast"), T = e("./inftrees"), D = 1, F = 2, N = 0, U = -2, P = 1, n = 852, i = 592; - function L(e2) { - return (e2 >>> 24 & 255) + (e2 >>> 8 & 65280) + ((65280 & e2) << 8) + ((255 & e2) << 24); - } - function s() { - this.mode = 0, this.last = false, this.wrap = 0, this.havedict = false, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new I.Buf16(320), this.work = new I.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0; - } - function a(e2) { - var t2; - return e2 && e2.state ? (t2 = e2.state, e2.total_in = e2.total_out = t2.total = 0, e2.msg = "", t2.wrap && (e2.adler = 1 & t2.wrap), t2.mode = P, t2.last = 0, t2.havedict = 0, t2.dmax = 32768, t2.head = null, t2.hold = 0, t2.bits = 0, t2.lencode = t2.lendyn = new I.Buf32(n), t2.distcode = t2.distdyn = new I.Buf32(i), t2.sane = 1, t2.back = -1, N) : U; - } - function o(e2) { - var t2; - return e2 && e2.state ? ((t2 = e2.state).wsize = 0, t2.whave = 0, t2.wnext = 0, a(e2)) : U; - } - function h(e2, t2) { - var r2, n2; - return e2 && e2.state ? (n2 = e2.state, t2 < 0 ? (r2 = 0, t2 = -t2) : (r2 = 1 + (t2 >> 4), t2 < 48 && (t2 &= 15)), t2 && (t2 < 8 || 15 < t2) ? U : (null !== n2.window && n2.wbits !== t2 && (n2.window = null), n2.wrap = r2, n2.wbits = t2, o(e2))) : U; - } - function u(e2, t2) { - var r2, n2; - return e2 ? (n2 = new s(), (e2.state = n2).window = null, (r2 = h(e2, t2)) !== N && (e2.state = null), r2) : U; - } - var l, f, c = true; - function j(e2) { - if (c) { - var t2; - for (l = new I.Buf32(512), f = new I.Buf32(32), t2 = 0; t2 < 144; ) - e2.lens[t2++] = 8; - for (; t2 < 256; ) - e2.lens[t2++] = 9; - for (; t2 < 280; ) - e2.lens[t2++] = 7; - for (; t2 < 288; ) - e2.lens[t2++] = 8; - for (T(D, e2.lens, 0, 288, l, 0, e2.work, { bits: 9 }), t2 = 0; t2 < 32; ) - e2.lens[t2++] = 5; - T(F, e2.lens, 0, 32, f, 0, e2.work, { bits: 5 }), c = false; - } - e2.lencode = l, e2.lenbits = 9, e2.distcode = f, e2.distbits = 5; - } - function Z(e2, t2, r2, n2) { - var i2, s2 = e2.state; - return null === s2.window && (s2.wsize = 1 << s2.wbits, s2.wnext = 0, s2.whave = 0, s2.window = new I.Buf8(s2.wsize)), n2 >= s2.wsize ? (I.arraySet(s2.window, t2, r2 - s2.wsize, s2.wsize, 0), s2.wnext = 0, s2.whave = s2.wsize) : (n2 < (i2 = s2.wsize - s2.wnext) && (i2 = n2), I.arraySet(s2.window, t2, r2 - n2, i2, s2.wnext), (n2 -= i2) ? (I.arraySet(s2.window, t2, r2 - n2, n2, 0), s2.wnext = n2, s2.whave = s2.wsize) : (s2.wnext += i2, s2.wnext === s2.wsize && (s2.wnext = 0), s2.whave < s2.wsize && (s2.whave += i2))), 0; - } - r.inflateReset = o, r.inflateReset2 = h, r.inflateResetKeep = a, r.inflateInit = function(e2) { - return u(e2, 15); - }, r.inflateInit2 = u, r.inflate = function(e2, t2) { - var r2, n2, i2, s2, a2, o2, h2, u2, l2, f2, c2, d, p, m, _, g, b, v, y, w, k, x, S, z, C = 0, E = new I.Buf8(4), A = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; - if (!e2 || !e2.state || !e2.output || !e2.input && 0 !== e2.avail_in) - return U; - 12 === (r2 = e2.state).mode && (r2.mode = 13), a2 = e2.next_out, i2 = e2.output, h2 = e2.avail_out, s2 = e2.next_in, n2 = e2.input, o2 = e2.avail_in, u2 = r2.hold, l2 = r2.bits, f2 = o2, c2 = h2, x = N; - e: - for (; ; ) - switch (r2.mode) { - case P: - if (0 === r2.wrap) { - r2.mode = 13; - break; - } - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (2 & r2.wrap && 35615 === u2) { - E[r2.check = 0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0), l2 = u2 = 0, r2.mode = 2; - break; - } - if (r2.flags = 0, r2.head && (r2.head.done = false), !(1 & r2.wrap) || (((255 & u2) << 8) + (u2 >> 8)) % 31) { - e2.msg = "incorrect header check", r2.mode = 30; - break; - } - if (8 != (15 & u2)) { - e2.msg = "unknown compression method", r2.mode = 30; - break; - } - if (l2 -= 4, k = 8 + (15 & (u2 >>>= 4)), 0 === r2.wbits) - r2.wbits = k; - else if (k > r2.wbits) { - e2.msg = "invalid window size", r2.mode = 30; - break; - } - r2.dmax = 1 << k, e2.adler = r2.check = 1, r2.mode = 512 & u2 ? 10 : 12, l2 = u2 = 0; - break; - case 2: - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (r2.flags = u2, 8 != (255 & r2.flags)) { - e2.msg = "unknown compression method", r2.mode = 30; - break; - } - if (57344 & r2.flags) { - e2.msg = "unknown header flags set", r2.mode = 30; - break; - } - r2.head && (r2.head.text = u2 >> 8 & 1), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0, r2.mode = 3; - case 3: - for (; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.head && (r2.head.time = u2), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, E[2] = u2 >>> 16 & 255, E[3] = u2 >>> 24 & 255, r2.check = B(r2.check, E, 4, 0)), l2 = u2 = 0, r2.mode = 4; - case 4: - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.head && (r2.head.xflags = 255 & u2, r2.head.os = u2 >> 8), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0, r2.mode = 5; - case 5: - if (1024 & r2.flags) { - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.length = u2, r2.head && (r2.head.extra_len = u2), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0; - } else - r2.head && (r2.head.extra = null); - r2.mode = 6; - case 6: - if (1024 & r2.flags && (o2 < (d = r2.length) && (d = o2), d && (r2.head && (k = r2.head.extra_len - r2.length, r2.head.extra || (r2.head.extra = new Array(r2.head.extra_len)), I.arraySet(r2.head.extra, n2, s2, d, k)), 512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, r2.length -= d), r2.length)) - break e; - r2.length = 0, r2.mode = 7; - case 7: - if (2048 & r2.flags) { - if (0 === o2) - break e; - for (d = 0; k = n2[s2 + d++], r2.head && k && r2.length < 65536 && (r2.head.name += String.fromCharCode(k)), k && d < o2; ) - ; - if (512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, k) - break e; - } else - r2.head && (r2.head.name = null); - r2.length = 0, r2.mode = 8; - case 8: - if (4096 & r2.flags) { - if (0 === o2) - break e; - for (d = 0; k = n2[s2 + d++], r2.head && k && r2.length < 65536 && (r2.head.comment += String.fromCharCode(k)), k && d < o2; ) - ; - if (512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, k) - break e; - } else - r2.head && (r2.head.comment = null); - r2.mode = 9; - case 9: - if (512 & r2.flags) { - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (u2 !== (65535 & r2.check)) { - e2.msg = "header crc mismatch", r2.mode = 30; - break; - } - l2 = u2 = 0; - } - r2.head && (r2.head.hcrc = r2.flags >> 9 & 1, r2.head.done = true), e2.adler = r2.check = 0, r2.mode = 12; - break; - case 10: - for (; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - e2.adler = r2.check = L(u2), l2 = u2 = 0, r2.mode = 11; - case 11: - if (0 === r2.havedict) - return e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, 2; - e2.adler = r2.check = 1, r2.mode = 12; - case 12: - if (5 === t2 || 6 === t2) - break e; - case 13: - if (r2.last) { - u2 >>>= 7 & l2, l2 -= 7 & l2, r2.mode = 27; - break; - } - for (; l2 < 3; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - switch (r2.last = 1 & u2, l2 -= 1, 3 & (u2 >>>= 1)) { - case 0: - r2.mode = 14; - break; - case 1: - if (j(r2), r2.mode = 20, 6 !== t2) - break; - u2 >>>= 2, l2 -= 2; - break e; - case 2: - r2.mode = 17; - break; - case 3: - e2.msg = "invalid block type", r2.mode = 30; - } - u2 >>>= 2, l2 -= 2; - break; - case 14: - for (u2 >>>= 7 & l2, l2 -= 7 & l2; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if ((65535 & u2) != (u2 >>> 16 ^ 65535)) { - e2.msg = "invalid stored block lengths", r2.mode = 30; - break; - } - if (r2.length = 65535 & u2, l2 = u2 = 0, r2.mode = 15, 6 === t2) - break e; - case 15: - r2.mode = 16; - case 16: - if (d = r2.length) { - if (o2 < d && (d = o2), h2 < d && (d = h2), 0 === d) - break e; - I.arraySet(i2, n2, s2, d, a2), o2 -= d, s2 += d, h2 -= d, a2 += d, r2.length -= d; - break; - } - r2.mode = 12; - break; - case 17: - for (; l2 < 14; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (r2.nlen = 257 + (31 & u2), u2 >>>= 5, l2 -= 5, r2.ndist = 1 + (31 & u2), u2 >>>= 5, l2 -= 5, r2.ncode = 4 + (15 & u2), u2 >>>= 4, l2 -= 4, 286 < r2.nlen || 30 < r2.ndist) { - e2.msg = "too many length or distance symbols", r2.mode = 30; - break; - } - r2.have = 0, r2.mode = 18; - case 18: - for (; r2.have < r2.ncode; ) { - for (; l2 < 3; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.lens[A[r2.have++]] = 7 & u2, u2 >>>= 3, l2 -= 3; - } - for (; r2.have < 19; ) - r2.lens[A[r2.have++]] = 0; - if (r2.lencode = r2.lendyn, r2.lenbits = 7, S = { bits: r2.lenbits }, x = T(0, r2.lens, 0, 19, r2.lencode, 0, r2.work, S), r2.lenbits = S.bits, x) { - e2.msg = "invalid code lengths set", r2.mode = 30; - break; - } - r2.have = 0, r2.mode = 19; - case 19: - for (; r2.have < r2.nlen + r2.ndist; ) { - for (; g = (C = r2.lencode[u2 & (1 << r2.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (b < 16) - u2 >>>= _, l2 -= _, r2.lens[r2.have++] = b; - else { - if (16 === b) { - for (z = _ + 2; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (u2 >>>= _, l2 -= _, 0 === r2.have) { - e2.msg = "invalid bit length repeat", r2.mode = 30; - break; - } - k = r2.lens[r2.have - 1], d = 3 + (3 & u2), u2 >>>= 2, l2 -= 2; - } else if (17 === b) { - for (z = _ + 3; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - l2 -= _, k = 0, d = 3 + (7 & (u2 >>>= _)), u2 >>>= 3, l2 -= 3; - } else { - for (z = _ + 7; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - l2 -= _, k = 0, d = 11 + (127 & (u2 >>>= _)), u2 >>>= 7, l2 -= 7; - } - if (r2.have + d > r2.nlen + r2.ndist) { - e2.msg = "invalid bit length repeat", r2.mode = 30; - break; - } - for (; d--; ) - r2.lens[r2.have++] = k; - } - } - if (30 === r2.mode) - break; - if (0 === r2.lens[256]) { - e2.msg = "invalid code -- missing end-of-block", r2.mode = 30; - break; - } - if (r2.lenbits = 9, S = { bits: r2.lenbits }, x = T(D, r2.lens, 0, r2.nlen, r2.lencode, 0, r2.work, S), r2.lenbits = S.bits, x) { - e2.msg = "invalid literal/lengths set", r2.mode = 30; - break; - } - if (r2.distbits = 6, r2.distcode = r2.distdyn, S = { bits: r2.distbits }, x = T(F, r2.lens, r2.nlen, r2.ndist, r2.distcode, 0, r2.work, S), r2.distbits = S.bits, x) { - e2.msg = "invalid distances set", r2.mode = 30; - break; - } - if (r2.mode = 20, 6 === t2) - break e; - case 20: - r2.mode = 21; - case 21: - if (6 <= o2 && 258 <= h2) { - e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, R(e2, c2), a2 = e2.next_out, i2 = e2.output, h2 = e2.avail_out, s2 = e2.next_in, n2 = e2.input, o2 = e2.avail_in, u2 = r2.hold, l2 = r2.bits, 12 === r2.mode && (r2.back = -1); - break; - } - for (r2.back = 0; g = (C = r2.lencode[u2 & (1 << r2.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (g && 0 == (240 & g)) { - for (v = _, y = g, w = b; g = (C = r2.lencode[w + ((u2 & (1 << v + y) - 1) >> v)]) >>> 16 & 255, b = 65535 & C, !(v + (_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - u2 >>>= v, l2 -= v, r2.back += v; - } - if (u2 >>>= _, l2 -= _, r2.back += _, r2.length = b, 0 === g) { - r2.mode = 26; - break; - } - if (32 & g) { - r2.back = -1, r2.mode = 12; - break; - } - if (64 & g) { - e2.msg = "invalid literal/length code", r2.mode = 30; - break; - } - r2.extra = 15 & g, r2.mode = 22; - case 22: - if (r2.extra) { - for (z = r2.extra; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.length += u2 & (1 << r2.extra) - 1, u2 >>>= r2.extra, l2 -= r2.extra, r2.back += r2.extra; - } - r2.was = r2.length, r2.mode = 23; - case 23: - for (; g = (C = r2.distcode[u2 & (1 << r2.distbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (0 == (240 & g)) { - for (v = _, y = g, w = b; g = (C = r2.distcode[w + ((u2 & (1 << v + y) - 1) >> v)]) >>> 16 & 255, b = 65535 & C, !(v + (_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - u2 >>>= v, l2 -= v, r2.back += v; - } - if (u2 >>>= _, l2 -= _, r2.back += _, 64 & g) { - e2.msg = "invalid distance code", r2.mode = 30; - break; - } - r2.offset = b, r2.extra = 15 & g, r2.mode = 24; - case 24: - if (r2.extra) { - for (z = r2.extra; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.offset += u2 & (1 << r2.extra) - 1, u2 >>>= r2.extra, l2 -= r2.extra, r2.back += r2.extra; - } - if (r2.offset > r2.dmax) { - e2.msg = "invalid distance too far back", r2.mode = 30; - break; - } - r2.mode = 25; - case 25: - if (0 === h2) - break e; - if (d = c2 - h2, r2.offset > d) { - if ((d = r2.offset - d) > r2.whave && r2.sane) { - e2.msg = "invalid distance too far back", r2.mode = 30; - break; - } - p = d > r2.wnext ? (d -= r2.wnext, r2.wsize - d) : r2.wnext - d, d > r2.length && (d = r2.length), m = r2.window; - } else - m = i2, p = a2 - r2.offset, d = r2.length; - for (h2 < d && (d = h2), h2 -= d, r2.length -= d; i2[a2++] = m[p++], --d; ) - ; - 0 === r2.length && (r2.mode = 21); - break; - case 26: - if (0 === h2) - break e; - i2[a2++] = r2.length, h2--, r2.mode = 21; - break; - case 27: - if (r2.wrap) { - for (; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 |= n2[s2++] << l2, l2 += 8; - } - if (c2 -= h2, e2.total_out += c2, r2.total += c2, c2 && (e2.adler = r2.check = r2.flags ? B(r2.check, i2, c2, a2 - c2) : O(r2.check, i2, c2, a2 - c2)), c2 = h2, (r2.flags ? u2 : L(u2)) !== r2.check) { - e2.msg = "incorrect data check", r2.mode = 30; - break; - } - l2 = u2 = 0; - } - r2.mode = 28; - case 28: - if (r2.wrap && r2.flags) { - for (; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (u2 !== (4294967295 & r2.total)) { - e2.msg = "incorrect length check", r2.mode = 30; - break; - } - l2 = u2 = 0; - } - r2.mode = 29; - case 29: - x = 1; - break e; - case 30: - x = -3; - break e; - case 31: - return -4; - case 32: - default: - return U; - } - return e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, (r2.wsize || c2 !== e2.avail_out && r2.mode < 30 && (r2.mode < 27 || 4 !== t2)) && Z(e2, e2.output, e2.next_out, c2 - e2.avail_out) ? (r2.mode = 31, -4) : (f2 -= e2.avail_in, c2 -= e2.avail_out, e2.total_in += f2, e2.total_out += c2, r2.total += c2, r2.wrap && c2 && (e2.adler = r2.check = r2.flags ? B(r2.check, i2, c2, e2.next_out - c2) : O(r2.check, i2, c2, e2.next_out - c2)), e2.data_type = r2.bits + (r2.last ? 64 : 0) + (12 === r2.mode ? 128 : 0) + (20 === r2.mode || 15 === r2.mode ? 256 : 0), (0 == f2 && 0 === c2 || 4 === t2) && x === N && (x = -5), x); - }, r.inflateEnd = function(e2) { - if (!e2 || !e2.state) - return U; - var t2 = e2.state; - return t2.window && (t2.window = null), e2.state = null, N; - }, r.inflateGetHeader = function(e2, t2) { - var r2; - return e2 && e2.state ? 0 == (2 & (r2 = e2.state).wrap) ? U : ((r2.head = t2).done = false, N) : U; - }, r.inflateSetDictionary = function(e2, t2) { - var r2, n2 = t2.length; - return e2 && e2.state ? 0 !== (r2 = e2.state).wrap && 11 !== r2.mode ? U : 11 === r2.mode && O(1, t2, n2, 0) !== r2.check ? -3 : Z(e2, t2, n2, n2) ? (r2.mode = 31, -4) : (r2.havedict = 1, N) : U; - }, r.inflateInfo = "pako inflate (from Nodeca project)"; - }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(e, t, r) { - "use strict"; - var D = e("../utils/common"), F = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], N = [16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78], U = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0], P = [16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64]; - t.exports = function(e2, t2, r2, n, i, s, a, o) { - var h, u, l, f, c, d, p, m, _, g = o.bits, b = 0, v = 0, y = 0, w = 0, k = 0, x = 0, S = 0, z = 0, C = 0, E = 0, A = null, I = 0, O = new D.Buf16(16), B = new D.Buf16(16), R = null, T = 0; - for (b = 0; b <= 15; b++) - O[b] = 0; - for (v = 0; v < n; v++) - O[t2[r2 + v]]++; - for (k = g, w = 15; 1 <= w && 0 === O[w]; w--) - ; - if (w < k && (k = w), 0 === w) - return i[s++] = 20971520, i[s++] = 20971520, o.bits = 1, 0; - for (y = 1; y < w && 0 === O[y]; y++) - ; - for (k < y && (k = y), b = z = 1; b <= 15; b++) - if (z <<= 1, (z -= O[b]) < 0) - return -1; - if (0 < z && (0 === e2 || 1 !== w)) - return -1; - for (B[1] = 0, b = 1; b < 15; b++) - B[b + 1] = B[b] + O[b]; - for (v = 0; v < n; v++) - 0 !== t2[r2 + v] && (a[B[t2[r2 + v]]++] = v); - if (d = 0 === e2 ? (A = R = a, 19) : 1 === e2 ? (A = F, I -= 257, R = N, T -= 257, 256) : (A = U, R = P, -1), b = y, c = s, S = v = E = 0, l = -1, f = (C = 1 << (x = k)) - 1, 1 === e2 && 852 < C || 2 === e2 && 592 < C) - return 1; - for (; ; ) { - for (p = b - S, _ = a[v] < d ? (m = 0, a[v]) : a[v] > d ? (m = R[T + a[v]], A[I + a[v]]) : (m = 96, 0), h = 1 << b - S, y = u = 1 << x; i[c + (E >> S) + (u -= h)] = p << 24 | m << 16 | _ | 0, 0 !== u; ) - ; - for (h = 1 << b - 1; E & h; ) - h >>= 1; - if (0 !== h ? (E &= h - 1, E += h) : E = 0, v++, 0 == --O[b]) { - if (b === w) - break; - b = t2[r2 + a[v]]; - } - if (k < b && (E & f) !== l) { - for (0 === S && (S = k), c += y, z = 1 << (x = b - S); x + S < w && !((z -= O[x + S]) <= 0); ) - x++, z <<= 1; - if (C += 1 << x, 1 === e2 && 852 < C || 2 === e2 && 592 < C) - return 1; - i[l = E & f] = k << 24 | x << 16 | c - s | 0; - } - } - return 0 !== E && (i[c + E] = b - S << 24 | 64 << 16 | 0), o.bits = k, 0; - }; - }, { "../utils/common": 41 }], 51: [function(e, t, r) { - "use strict"; - t.exports = { 2: "need dictionary", 1: "stream end", 0: "", "-1": "file error", "-2": "stream error", "-3": "data error", "-4": "insufficient memory", "-5": "buffer error", "-6": "incompatible version" }; - }, {}], 52: [function(e, t, r) { - "use strict"; - var i = e("../utils/common"), o = 0, h = 1; - function n(e2) { - for (var t2 = e2.length; 0 <= --t2; ) - e2[t2] = 0; - } - var s = 0, a = 29, u = 256, l = u + 1 + a, f = 30, c = 19, _ = 2 * l + 1, g = 15, d = 16, p = 7, m = 256, b = 16, v = 17, y = 18, w = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], k = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], x = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], S = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], z = new Array(2 * (l + 2)); - n(z); - var C = new Array(2 * f); - n(C); - var E = new Array(512); - n(E); - var A = new Array(256); - n(A); - var I = new Array(a); - n(I); - var O, B, R, T = new Array(f); - function D(e2, t2, r2, n2, i2) { - this.static_tree = e2, this.extra_bits = t2, this.extra_base = r2, this.elems = n2, this.max_length = i2, this.has_stree = e2 && e2.length; - } - function F(e2, t2) { - this.dyn_tree = e2, this.max_code = 0, this.stat_desc = t2; - } - function N(e2) { - return e2 < 256 ? E[e2] : E[256 + (e2 >>> 7)]; - } - function U(e2, t2) { - e2.pending_buf[e2.pending++] = 255 & t2, e2.pending_buf[e2.pending++] = t2 >>> 8 & 255; - } - function P(e2, t2, r2) { - e2.bi_valid > d - r2 ? (e2.bi_buf |= t2 << e2.bi_valid & 65535, U(e2, e2.bi_buf), e2.bi_buf = t2 >> d - e2.bi_valid, e2.bi_valid += r2 - d) : (e2.bi_buf |= t2 << e2.bi_valid & 65535, e2.bi_valid += r2); - } - function L(e2, t2, r2) { - P(e2, r2[2 * t2], r2[2 * t2 + 1]); - } - function j(e2, t2) { - for (var r2 = 0; r2 |= 1 & e2, e2 >>>= 1, r2 <<= 1, 0 < --t2; ) - ; - return r2 >>> 1; - } - function Z(e2, t2, r2) { - var n2, i2, s2 = new Array(g + 1), a2 = 0; - for (n2 = 1; n2 <= g; n2++) - s2[n2] = a2 = a2 + r2[n2 - 1] << 1; - for (i2 = 0; i2 <= t2; i2++) { - var o2 = e2[2 * i2 + 1]; - 0 !== o2 && (e2[2 * i2] = j(s2[o2]++, o2)); - } - } - function W(e2) { - var t2; - for (t2 = 0; t2 < l; t2++) - e2.dyn_ltree[2 * t2] = 0; - for (t2 = 0; t2 < f; t2++) - e2.dyn_dtree[2 * t2] = 0; - for (t2 = 0; t2 < c; t2++) - e2.bl_tree[2 * t2] = 0; - e2.dyn_ltree[2 * m] = 1, e2.opt_len = e2.static_len = 0, e2.last_lit = e2.matches = 0; - } - function M(e2) { - 8 < e2.bi_valid ? U(e2, e2.bi_buf) : 0 < e2.bi_valid && (e2.pending_buf[e2.pending++] = e2.bi_buf), e2.bi_buf = 0, e2.bi_valid = 0; - } - function H(e2, t2, r2, n2) { - var i2 = 2 * t2, s2 = 2 * r2; - return e2[i2] < e2[s2] || e2[i2] === e2[s2] && n2[t2] <= n2[r2]; - } - function G(e2, t2, r2) { - for (var n2 = e2.heap[r2], i2 = r2 << 1; i2 <= e2.heap_len && (i2 < e2.heap_len && H(t2, e2.heap[i2 + 1], e2.heap[i2], e2.depth) && i2++, !H(t2, n2, e2.heap[i2], e2.depth)); ) - e2.heap[r2] = e2.heap[i2], r2 = i2, i2 <<= 1; - e2.heap[r2] = n2; - } - function K(e2, t2, r2) { - var n2, i2, s2, a2, o2 = 0; - if (0 !== e2.last_lit) - for (; n2 = e2.pending_buf[e2.d_buf + 2 * o2] << 8 | e2.pending_buf[e2.d_buf + 2 * o2 + 1], i2 = e2.pending_buf[e2.l_buf + o2], o2++, 0 === n2 ? L(e2, i2, t2) : (L(e2, (s2 = A[i2]) + u + 1, t2), 0 !== (a2 = w[s2]) && P(e2, i2 -= I[s2], a2), L(e2, s2 = N(--n2), r2), 0 !== (a2 = k[s2]) && P(e2, n2 -= T[s2], a2)), o2 < e2.last_lit; ) - ; - L(e2, m, t2); - } - function Y(e2, t2) { - var r2, n2, i2, s2 = t2.dyn_tree, a2 = t2.stat_desc.static_tree, o2 = t2.stat_desc.has_stree, h2 = t2.stat_desc.elems, u2 = -1; - for (e2.heap_len = 0, e2.heap_max = _, r2 = 0; r2 < h2; r2++) - 0 !== s2[2 * r2] ? (e2.heap[++e2.heap_len] = u2 = r2, e2.depth[r2] = 0) : s2[2 * r2 + 1] = 0; - for (; e2.heap_len < 2; ) - s2[2 * (i2 = e2.heap[++e2.heap_len] = u2 < 2 ? ++u2 : 0)] = 1, e2.depth[i2] = 0, e2.opt_len--, o2 && (e2.static_len -= a2[2 * i2 + 1]); - for (t2.max_code = u2, r2 = e2.heap_len >> 1; 1 <= r2; r2--) - G(e2, s2, r2); - for (i2 = h2; r2 = e2.heap[1], e2.heap[1] = e2.heap[e2.heap_len--], G(e2, s2, 1), n2 = e2.heap[1], e2.heap[--e2.heap_max] = r2, e2.heap[--e2.heap_max] = n2, s2[2 * i2] = s2[2 * r2] + s2[2 * n2], e2.depth[i2] = (e2.depth[r2] >= e2.depth[n2] ? e2.depth[r2] : e2.depth[n2]) + 1, s2[2 * r2 + 1] = s2[2 * n2 + 1] = i2, e2.heap[1] = i2++, G(e2, s2, 1), 2 <= e2.heap_len; ) - ; - e2.heap[--e2.heap_max] = e2.heap[1], function(e3, t3) { - var r3, n3, i3, s3, a3, o3, h3 = t3.dyn_tree, u3 = t3.max_code, l2 = t3.stat_desc.static_tree, f2 = t3.stat_desc.has_stree, c2 = t3.stat_desc.extra_bits, d2 = t3.stat_desc.extra_base, p2 = t3.stat_desc.max_length, m2 = 0; - for (s3 = 0; s3 <= g; s3++) - e3.bl_count[s3] = 0; - for (h3[2 * e3.heap[e3.heap_max] + 1] = 0, r3 = e3.heap_max + 1; r3 < _; r3++) - p2 < (s3 = h3[2 * h3[2 * (n3 = e3.heap[r3]) + 1] + 1] + 1) && (s3 = p2, m2++), h3[2 * n3 + 1] = s3, u3 < n3 || (e3.bl_count[s3]++, a3 = 0, d2 <= n3 && (a3 = c2[n3 - d2]), o3 = h3[2 * n3], e3.opt_len += o3 * (s3 + a3), f2 && (e3.static_len += o3 * (l2[2 * n3 + 1] + a3))); - if (0 !== m2) { - do { - for (s3 = p2 - 1; 0 === e3.bl_count[s3]; ) - s3--; - e3.bl_count[s3]--, e3.bl_count[s3 + 1] += 2, e3.bl_count[p2]--, m2 -= 2; - } while (0 < m2); - for (s3 = p2; 0 !== s3; s3--) - for (n3 = e3.bl_count[s3]; 0 !== n3; ) - u3 < (i3 = e3.heap[--r3]) || (h3[2 * i3 + 1] !== s3 && (e3.opt_len += (s3 - h3[2 * i3 + 1]) * h3[2 * i3], h3[2 * i3 + 1] = s3), n3--); - } - }(e2, t2), Z(s2, u2, e2.bl_count); - } - function X(e2, t2, r2) { - var n2, i2, s2 = -1, a2 = t2[1], o2 = 0, h2 = 7, u2 = 4; - for (0 === a2 && (h2 = 138, u2 = 3), t2[2 * (r2 + 1) + 1] = 65535, n2 = 0; n2 <= r2; n2++) - i2 = a2, a2 = t2[2 * (n2 + 1) + 1], ++o2 < h2 && i2 === a2 || (o2 < u2 ? e2.bl_tree[2 * i2] += o2 : 0 !== i2 ? (i2 !== s2 && e2.bl_tree[2 * i2]++, e2.bl_tree[2 * b]++) : o2 <= 10 ? e2.bl_tree[2 * v]++ : e2.bl_tree[2 * y]++, s2 = i2, u2 = (o2 = 0) === a2 ? (h2 = 138, 3) : i2 === a2 ? (h2 = 6, 3) : (h2 = 7, 4)); - } - function V(e2, t2, r2) { - var n2, i2, s2 = -1, a2 = t2[1], o2 = 0, h2 = 7, u2 = 4; - for (0 === a2 && (h2 = 138, u2 = 3), n2 = 0; n2 <= r2; n2++) - if (i2 = a2, a2 = t2[2 * (n2 + 1) + 1], !(++o2 < h2 && i2 === a2)) { - if (o2 < u2) - for (; L(e2, i2, e2.bl_tree), 0 != --o2; ) - ; - else - 0 !== i2 ? (i2 !== s2 && (L(e2, i2, e2.bl_tree), o2--), L(e2, b, e2.bl_tree), P(e2, o2 - 3, 2)) : o2 <= 10 ? (L(e2, v, e2.bl_tree), P(e2, o2 - 3, 3)) : (L(e2, y, e2.bl_tree), P(e2, o2 - 11, 7)); - s2 = i2, u2 = (o2 = 0) === a2 ? (h2 = 138, 3) : i2 === a2 ? (h2 = 6, 3) : (h2 = 7, 4); - } - } - n(T); - var q = false; - function J(e2, t2, r2, n2) { - P(e2, (s << 1) + (n2 ? 1 : 0), 3), function(e3, t3, r3, n3) { - M(e3), n3 && (U(e3, r3), U(e3, ~r3)), i.arraySet(e3.pending_buf, e3.window, t3, r3, e3.pending), e3.pending += r3; - }(e2, t2, r2, true); - } - r._tr_init = function(e2) { - q || (function() { - var e3, t2, r2, n2, i2, s2 = new Array(g + 1); - for (n2 = r2 = 0; n2 < a - 1; n2++) - for (I[n2] = r2, e3 = 0; e3 < 1 << w[n2]; e3++) - A[r2++] = n2; - for (A[r2 - 1] = n2, n2 = i2 = 0; n2 < 16; n2++) - for (T[n2] = i2, e3 = 0; e3 < 1 << k[n2]; e3++) - E[i2++] = n2; - for (i2 >>= 7; n2 < f; n2++) - for (T[n2] = i2 << 7, e3 = 0; e3 < 1 << k[n2] - 7; e3++) - E[256 + i2++] = n2; - for (t2 = 0; t2 <= g; t2++) - s2[t2] = 0; - for (e3 = 0; e3 <= 143; ) - z[2 * e3 + 1] = 8, e3++, s2[8]++; - for (; e3 <= 255; ) - z[2 * e3 + 1] = 9, e3++, s2[9]++; - for (; e3 <= 279; ) - z[2 * e3 + 1] = 7, e3++, s2[7]++; - for (; e3 <= 287; ) - z[2 * e3 + 1] = 8, e3++, s2[8]++; - for (Z(z, l + 1, s2), e3 = 0; e3 < f; e3++) - C[2 * e3 + 1] = 5, C[2 * e3] = j(e3, 5); - O = new D(z, w, u + 1, l, g), B = new D(C, k, 0, f, g), R = new D(new Array(0), x, 0, c, p); - }(), q = true), e2.l_desc = new F(e2.dyn_ltree, O), e2.d_desc = new F(e2.dyn_dtree, B), e2.bl_desc = new F(e2.bl_tree, R), e2.bi_buf = 0, e2.bi_valid = 0, W(e2); - }, r._tr_stored_block = J, r._tr_flush_block = function(e2, t2, r2, n2) { - var i2, s2, a2 = 0; - 0 < e2.level ? (2 === e2.strm.data_type && (e2.strm.data_type = function(e3) { - var t3, r3 = 4093624447; - for (t3 = 0; t3 <= 31; t3++, r3 >>>= 1) - if (1 & r3 && 0 !== e3.dyn_ltree[2 * t3]) - return o; - if (0 !== e3.dyn_ltree[18] || 0 !== e3.dyn_ltree[20] || 0 !== e3.dyn_ltree[26]) - return h; - for (t3 = 32; t3 < u; t3++) - if (0 !== e3.dyn_ltree[2 * t3]) - return h; - return o; - }(e2)), Y(e2, e2.l_desc), Y(e2, e2.d_desc), a2 = function(e3) { - var t3; - for (X(e3, e3.dyn_ltree, e3.l_desc.max_code), X(e3, e3.dyn_dtree, e3.d_desc.max_code), Y(e3, e3.bl_desc), t3 = c - 1; 3 <= t3 && 0 === e3.bl_tree[2 * S[t3] + 1]; t3--) - ; - return e3.opt_len += 3 * (t3 + 1) + 5 + 5 + 4, t3; - }(e2), i2 = e2.opt_len + 3 + 7 >>> 3, (s2 = e2.static_len + 3 + 7 >>> 3) <= i2 && (i2 = s2)) : i2 = s2 = r2 + 5, r2 + 4 <= i2 && -1 !== t2 ? J(e2, t2, r2, n2) : 4 === e2.strategy || s2 === i2 ? (P(e2, 2 + (n2 ? 1 : 0), 3), K(e2, z, C)) : (P(e2, 4 + (n2 ? 1 : 0), 3), function(e3, t3, r3, n3) { - var i3; - for (P(e3, t3 - 257, 5), P(e3, r3 - 1, 5), P(e3, n3 - 4, 4), i3 = 0; i3 < n3; i3++) - P(e3, e3.bl_tree[2 * S[i3] + 1], 3); - V(e3, e3.dyn_ltree, t3 - 1), V(e3, e3.dyn_dtree, r3 - 1); - }(e2, e2.l_desc.max_code + 1, e2.d_desc.max_code + 1, a2 + 1), K(e2, e2.dyn_ltree, e2.dyn_dtree)), W(e2), n2 && M(e2); - }, r._tr_tally = function(e2, t2, r2) { - return e2.pending_buf[e2.d_buf + 2 * e2.last_lit] = t2 >>> 8 & 255, e2.pending_buf[e2.d_buf + 2 * e2.last_lit + 1] = 255 & t2, e2.pending_buf[e2.l_buf + e2.last_lit] = 255 & r2, e2.last_lit++, 0 === t2 ? e2.dyn_ltree[2 * r2]++ : (e2.matches++, t2--, e2.dyn_ltree[2 * (A[r2] + u + 1)]++, e2.dyn_dtree[2 * N(t2)]++), e2.last_lit === e2.lit_bufsize - 1; - }, r._tr_align = function(e2) { - P(e2, 2, 3), L(e2, m, z), function(e3) { - 16 === e3.bi_valid ? (U(e3, e3.bi_buf), e3.bi_buf = 0, e3.bi_valid = 0) : 8 <= e3.bi_valid && (e3.pending_buf[e3.pending++] = 255 & e3.bi_buf, e3.bi_buf >>= 8, e3.bi_valid -= 8); - }(e2); - }; - }, { "../utils/common": 41 }], 53: [function(e, t, r) { - "use strict"; - t.exports = function() { - this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0; - }; - }, {}], 54: [function(e, t, r) { - (function(e2) { - !function(r2, n) { - "use strict"; - if (!r2.setImmediate) { - var i, s, t2, a, o = 1, h = {}, u = false, l = r2.document, e3 = Object.getPrototypeOf && Object.getPrototypeOf(r2); - e3 = e3 && e3.setTimeout ? e3 : r2, i = "[object process]" === {}.toString.call(r2.process) ? function(e4) { - process.nextTick(function() { - c(e4); - }); - } : function() { - if (r2.postMessage && !r2.importScripts) { - var e4 = true, t3 = r2.onmessage; - return r2.onmessage = function() { - e4 = false; - }, r2.postMessage("", "*"), r2.onmessage = t3, e4; - } - }() ? (a = "setImmediate$" + Math.random() + "$", r2.addEventListener ? r2.addEventListener("message", d, false) : r2.attachEvent("onmessage", d), function(e4) { - r2.postMessage(a + e4, "*"); - }) : r2.MessageChannel ? ((t2 = new MessageChannel()).port1.onmessage = function(e4) { - c(e4.data); - }, function(e4) { - t2.port2.postMessage(e4); - }) : l && "onreadystatechange" in l.createElement("script") ? (s = l.documentElement, function(e4) { - var t3 = l.createElement("script"); - t3.onreadystatechange = function() { - c(e4), t3.onreadystatechange = null, s.removeChild(t3), t3 = null; - }, s.appendChild(t3); - }) : function(e4) { - setTimeout(c, 0, e4); - }, e3.setImmediate = function(e4) { - "function" != typeof e4 && (e4 = new Function("" + e4)); - for (var t3 = new Array(arguments.length - 1), r3 = 0; r3 < t3.length; r3++) - t3[r3] = arguments[r3 + 1]; - var n2 = { callback: e4, args: t3 }; - return h[o] = n2, i(o), o++; - }, e3.clearImmediate = f; - } - function f(e4) { - delete h[e4]; - } - function c(e4) { - if (u) - setTimeout(c, 0, e4); - else { - var t3 = h[e4]; - if (t3) { - u = true; - try { - !function(e5) { - var t4 = e5.callback, r3 = e5.args; - switch (r3.length) { - case 0: - t4(); - break; - case 1: - t4(r3[0]); - break; - case 2: - t4(r3[0], r3[1]); - break; - case 3: - t4(r3[0], r3[1], r3[2]); - break; - default: - t4.apply(n, r3); - } - }(t3); - } finally { - f(e4), u = false; - } - } - } - } - function d(e4) { - e4.source === r2 && "string" == typeof e4.data && 0 === e4.data.indexOf(a) && c(+e4.data.slice(a.length)); - } - }("undefined" == typeof self ? void 0 === e2 ? this : e2 : self); - }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}); - }, {}] }, {}, [10])(10); - }); - } - }); - - // ../../node_modules/validate.js/validate.js - var require_validate = __commonJS({ - "../../node_modules/validate.js/validate.js"(exports, module) { - (function(exports2, module2, define2) { - "use strict"; - var validate3 = function(attributes, constraints, options) { - options = v.extend({}, v.options, options); - var results = v.runValidations(attributes, constraints, options), attr, validator; - if (results.some(function(r) { - return v.isPromise(r.error); - })) { - throw new Error("Use validate.async if you want support for promises"); - } - return validate3.processValidationResults(results, options); - }; - var v = validate3; - v.extend = function(obj) { - [].slice.call(arguments, 1).forEach(function(source) { - for (var attr in source) { - obj[attr] = source[attr]; - } - }); - return obj; - }; - v.extend(validate3, { - // This is the version of the library as a semver. - // The toString function will allow it to be coerced into a string - version: { - major: 0, - minor: 13, - patch: 1, - metadata: null, - toString: function() { - var version2 = v.format("%{major}.%{minor}.%{patch}", v.version); - if (!v.isEmpty(v.version.metadata)) { - version2 += "+" + v.version.metadata; - } - return version2; - } - }, - // Below is the dependencies that are used in validate.js - // The constructor of the Promise implementation. - // If you are using Q.js, RSVP or any other A+ compatible implementation - // override this attribute to be the constructor of that promise. - // Since jQuery promises aren't A+ compatible they won't work. - Promise: typeof Promise !== "undefined" ? Promise : ( - /* istanbul ignore next */ - null - ), - EMPTY_STRING_REGEXP: /^\s*$/, - // Runs the validators specified by the constraints object. - // Will return an array of the format: - // [{attribute: "", error: ""}, ...] - runValidations: function(attributes, constraints, options) { - var results = [], attr, validatorName, value, validators, validator, validatorOptions, error; - if (v.isDomElement(attributes) || v.isJqueryElement(attributes)) { - attributes = v.collectFormValues(attributes); - } - for (attr in constraints) { - value = v.getDeepObjectValue(attributes, attr); - validators = v.result(constraints[attr], value, attributes, attr, options, constraints); - for (validatorName in validators) { - validator = v.validators[validatorName]; - if (!validator) { - error = v.format("Unknown validator %{name}", { name: validatorName }); - throw new Error(error); - } - validatorOptions = validators[validatorName]; - validatorOptions = v.result(validatorOptions, value, attributes, attr, options, constraints); - if (!validatorOptions) { - continue; - } - results.push({ - attribute: attr, - value, - validator: validatorName, - globalOptions: options, - attributes, - options: validatorOptions, - error: validator.call( - validator, - value, - validatorOptions, - attr, - attributes, - options - ) - }); - } - } - return results; - }, - // Takes the output from runValidations and converts it to the correct - // output format. - processValidationResults: function(errors, options) { - errors = v.pruneEmptyErrors(errors, options); - errors = v.expandMultipleErrors(errors, options); - errors = v.convertErrorMessages(errors, options); - var format = options.format || "grouped"; - if (typeof v.formatters[format] === "function") { - errors = v.formatters[format](errors); - } else { - throw new Error(v.format("Unknown format %{format}", options)); - } - return v.isEmpty(errors) ? void 0 : errors; - }, - // Runs the validations with support for promises. - // This function will return a promise that is settled when all the - // validation promises have been completed. - // It can be called even if no validations returned a promise. - async: function(attributes, constraints, options) { - options = v.extend({}, v.async.options, options); - var WrapErrors = options.wrapErrors || function(errors) { - return errors; - }; - if (options.cleanAttributes !== false) { - attributes = v.cleanAttributes(attributes, constraints); - } - var results = v.runValidations(attributes, constraints, options); - return new v.Promise(function(resolve, reject) { - v.waitForResults(results).then(function() { - var errors = v.processValidationResults(results, options); - if (errors) { - reject(new WrapErrors(errors, options, attributes, constraints)); - } else { - resolve(attributes); - } - }, function(err) { - reject(err); - }); - }); - }, - single: function(value, constraints, options) { - options = v.extend({}, v.single.options, options, { - format: "flat", - fullMessages: false - }); - return v({ single: value }, { single: constraints }, options); - }, - // Returns a promise that is resolved when all promises in the results array - // are settled. The promise returned from this function is always resolved, - // never rejected. - // This function modifies the input argument, it replaces the promises - // with the value returned from the promise. - waitForResults: function(results) { - return results.reduce(function(memo, result) { - if (!v.isPromise(result.error)) { - return memo; - } - return memo.then(function() { - return result.error.then(function(error) { - result.error = error || null; - }); - }); - }, new v.Promise(function(r) { - r(); - })); - }, - // If the given argument is a call: function the and: function return the value - // otherwise just return the value. Additional arguments will be passed as - // arguments to the function. - // Example: - // ``` - // result('foo') // 'foo' - // result(Math.max, 1, 2) // 2 - // ``` - result: function(value) { - var args = [].slice.call(arguments, 1); - if (typeof value === "function") { - value = value.apply(null, args); - } - return value; - }, - // Checks if the value is a number. This function does not consider NaN a - // number like many other `isNumber` functions do. - isNumber: function(value) { - return typeof value === "number" && !isNaN(value); - }, - // Returns false if the object is not a function - isFunction: function(value) { - return typeof value === "function"; - }, - // A simple check to verify that the value is an integer. Uses `isNumber` - // and a simple modulo check. - isInteger: function(value) { - return v.isNumber(value) && value % 1 === 0; - }, - // Checks if the value is a boolean - isBoolean: function(value) { - return typeof value === "boolean"; - }, - // Uses the `Object` function to check if the given argument is an object. - isObject: function(obj) { - return obj === Object(obj); - }, - // Simply checks if the object is an instance of a date - isDate: function(obj) { - return obj instanceof Date; - }, - // Returns false if the object is `null` of `undefined` - isDefined: function(obj) { - return obj !== null && obj !== void 0; - }, - // Checks if the given argument is a promise. Anything with a `then` - // function is considered a promise. - isPromise: function(p) { - return !!p && v.isFunction(p.then); - }, - isJqueryElement: function(o) { - return o && v.isString(o.jquery); - }, - isDomElement: function(o) { - if (!o) { - return false; - } - if (!o.querySelectorAll || !o.querySelector) { - return false; - } - if (v.isObject(document) && o === document) { - return true; - } - if (typeof HTMLElement === "object") { - return o instanceof HTMLElement; - } else { - return o && typeof o === "object" && o !== null && o.nodeType === 1 && typeof o.nodeName === "string"; - } - }, - isEmpty: function(value) { - var attr; - if (!v.isDefined(value)) { - return true; - } - if (v.isFunction(value)) { - return false; - } - if (v.isString(value)) { - return v.EMPTY_STRING_REGEXP.test(value); - } - if (v.isArray(value)) { - return value.length === 0; - } - if (v.isDate(value)) { - return false; - } - if (v.isObject(value)) { - for (attr in value) { - return false; - } - return true; - } - return false; - }, - // Formats the specified strings with the given values like so: - // ``` - // format("Foo: %{foo}", {foo: "bar"}) // "Foo bar" - // ``` - // If you want to write %{...} without having it replaced simply - // prefix it with % like this `Foo: %%{foo}` and it will be returned - // as `"Foo: %{foo}"` - format: v.extend(function(str, vals) { - if (!v.isString(str)) { - return str; - } - return str.replace(v.format.FORMAT_REGEXP, function(m0, m1, m2) { - if (m1 === "%") { - return "%{" + m2 + "}"; - } else { - return String(vals[m2]); - } - }); - }, { - // Finds %{key} style patterns in the given string - FORMAT_REGEXP: /(%?)%\{([^\}]+)\}/g - }), - // "Prettifies" the given string. - // Prettifying means replacing [.\_-] with spaces as well as splitting - // camel case words. - prettify: function(str) { - if (v.isNumber(str)) { - if (str * 100 % 1 === 0) { - return "" + str; - } else { - return parseFloat(Math.round(str * 100) / 100).toFixed(2); - } - } - if (v.isArray(str)) { - return str.map(function(s) { - return v.prettify(s); - }).join(", "); - } - if (v.isObject(str)) { - if (!v.isDefined(str.toString)) { - return JSON.stringify(str); - } - return str.toString(); - } - str = "" + str; - return str.replace(/([^\s])\.([^\s])/g, "$1 $2").replace(/\\+/g, "").replace(/[_-]/g, " ").replace(/([a-z])([A-Z])/g, function(m0, m1, m2) { - return "" + m1 + " " + m2.toLowerCase(); - }).toLowerCase(); - }, - stringifyValue: function(value, options) { - var prettify = options && options.prettify || v.prettify; - return prettify(value); - }, - isString: function(value) { - return typeof value === "string"; - }, - isArray: function(value) { - return {}.toString.call(value) === "[object Array]"; - }, - // Checks if the object is a hash, which is equivalent to an object that - // is neither an array nor a function. - isHash: function(value) { - return v.isObject(value) && !v.isArray(value) && !v.isFunction(value); - }, - contains: function(obj, value) { - if (!v.isDefined(obj)) { - return false; - } - if (v.isArray(obj)) { - return obj.indexOf(value) !== -1; - } - return value in obj; - }, - unique: function(array) { - if (!v.isArray(array)) { - return array; - } - return array.filter(function(el, index, array2) { - return array2.indexOf(el) == index; - }); - }, - forEachKeyInKeypath: function(object, keypath, callback) { - if (!v.isString(keypath)) { - return void 0; - } - var key = "", i, escape = false; - for (i = 0; i < keypath.length; ++i) { - switch (keypath[i]) { - case ".": - if (escape) { - escape = false; - key += "."; - } else { - object = callback(object, key, false); - key = ""; - } - break; - case "\\": - if (escape) { - escape = false; - key += "\\"; - } else { - escape = true; - } - break; - default: - escape = false; - key += keypath[i]; - break; - } - } - return callback(object, key, true); - }, - getDeepObjectValue: function(obj, keypath) { - if (!v.isObject(obj)) { - return void 0; - } - return v.forEachKeyInKeypath(obj, keypath, function(obj2, key) { - if (v.isObject(obj2)) { - return obj2[key]; - } - }); - }, - // This returns an object with all the values of the form. - // It uses the input name as key and the value as value - // So for example this: - // - // would return: - // {email: "foo@bar.com"} - collectFormValues: function(form, options) { - var values = {}, i, j, input, inputs, option, value; - if (v.isJqueryElement(form)) { - form = form[0]; - } - if (!form) { - return values; - } - options = options || {}; - inputs = form.querySelectorAll("input[name], textarea[name]"); - for (i = 0; i < inputs.length; ++i) { - input = inputs.item(i); - if (v.isDefined(input.getAttribute("data-ignored"))) { - continue; - } - var name = input.name.replace(/\./g, "\\\\."); - value = v.sanitizeFormValue(input.value, options); - if (input.type === "number") { - value = value ? +value : null; - } else if (input.type === "checkbox") { - if (input.attributes.value) { - if (!input.checked) { - value = values[name] || null; - } - } else { - value = input.checked; - } - } else if (input.type === "radio") { - if (!input.checked) { - value = values[name] || null; - } - } - values[name] = value; - } - inputs = form.querySelectorAll("select[name]"); - for (i = 0; i < inputs.length; ++i) { - input = inputs.item(i); - if (v.isDefined(input.getAttribute("data-ignored"))) { - continue; - } - if (input.multiple) { - value = []; - for (j in input.options) { - option = input.options[j]; - if (option && option.selected) { - value.push(v.sanitizeFormValue(option.value, options)); - } - } - } else { - var _val = typeof input.options[input.selectedIndex] !== "undefined" ? input.options[input.selectedIndex].value : ( - /* istanbul ignore next */ - "" - ); - value = v.sanitizeFormValue(_val, options); - } - values[input.name] = value; - } - return values; - }, - sanitizeFormValue: function(value, options) { - if (options.trim && v.isString(value)) { - value = value.trim(); - } - if (options.nullify !== false && value === "") { - return null; - } - return value; - }, - capitalize: function(str) { - if (!v.isString(str)) { - return str; - } - return str[0].toUpperCase() + str.slice(1); - }, - // Remove all errors who's error attribute is empty (null or undefined) - pruneEmptyErrors: function(errors) { - return errors.filter(function(error) { - return !v.isEmpty(error.error); - }); - }, - // In - // [{error: ["err1", "err2"], ...}] - // Out - // [{error: "err1", ...}, {error: "err2", ...}] - // - // All attributes in an error with multiple messages are duplicated - // when expanding the errors. - expandMultipleErrors: function(errors) { - var ret = []; - errors.forEach(function(error) { - if (v.isArray(error.error)) { - error.error.forEach(function(msg) { - ret.push(v.extend({}, error, { error: msg })); - }); - } else { - ret.push(error); - } - }); - return ret; - }, - // Converts the error mesages by prepending the attribute name unless the - // message is prefixed by ^ - convertErrorMessages: function(errors, options) { - options = options || {}; - var ret = [], prettify = options.prettify || v.prettify; - errors.forEach(function(errorInfo) { - var error = v.result( - errorInfo.error, - errorInfo.value, - errorInfo.attribute, - errorInfo.options, - errorInfo.attributes, - errorInfo.globalOptions - ); - if (!v.isString(error)) { - ret.push(errorInfo); - return; - } - if (error[0] === "^") { - error = error.slice(1); - } else if (options.fullMessages !== false) { - error = v.capitalize(prettify(errorInfo.attribute)) + " " + error; - } - error = error.replace(/\\\^/g, "^"); - error = v.format(error, { - value: v.stringifyValue(errorInfo.value, options) - }); - ret.push(v.extend({}, errorInfo, { error })); - }); - return ret; - }, - // In: - // [{attribute: "", ...}] - // Out: - // {"": [{attribute: "", ...}]} - groupErrorsByAttribute: function(errors) { - var ret = {}; - errors.forEach(function(error) { - var list = ret[error.attribute]; - if (list) { - list.push(error); - } else { - ret[error.attribute] = [error]; - } - }); - return ret; - }, - // In: - // [{error: "", ...}, {error: "", ...}] - // Out: - // ["", ""] - flattenErrorsToArray: function(errors) { - return errors.map(function(error) { - return error.error; - }).filter(function(value, index, self2) { - return self2.indexOf(value) === index; - }); - }, - cleanAttributes: function(attributes, whitelist) { - function whitelistCreator(obj, key, last) { - if (v.isObject(obj[key])) { - return obj[key]; - } - return obj[key] = last ? true : {}; - } - function buildObjectWhitelist(whitelist2) { - var ow = {}, lastObject, attr; - for (attr in whitelist2) { - if (!whitelist2[attr]) { - continue; - } - v.forEachKeyInKeypath(ow, attr, whitelistCreator); - } - return ow; - } - function cleanRecursive(attributes2, whitelist2) { - if (!v.isObject(attributes2)) { - return attributes2; - } - var ret = v.extend({}, attributes2), w, attribute; - for (attribute in attributes2) { - w = whitelist2[attribute]; - if (v.isObject(w)) { - ret[attribute] = cleanRecursive(ret[attribute], w); - } else if (!w) { - delete ret[attribute]; - } - } - return ret; - } - if (!v.isObject(whitelist) || !v.isObject(attributes)) { - return {}; - } - whitelist = buildObjectWhitelist(whitelist); - return cleanRecursive(attributes, whitelist); - }, - exposeModule: function(validate4, root, exports3, module3, define3) { - if (exports3) { - if (module3 && module3.exports) { - exports3 = module3.exports = validate4; - } - exports3.validate = validate4; - } else { - root.validate = validate4; - if (validate4.isFunction(define3) && define3.amd) { - define3([], function() { - return validate4; - }); - } - } - }, - warn: function(msg) { - if (typeof console !== "undefined" && console.warn) { - console.warn("[validate.js] " + msg); - } - }, - error: function(msg) { - if (typeof console !== "undefined" && console.error) { - console.error("[validate.js] " + msg); - } - } - }); - validate3.validators = { - // Presence validates that the value isn't empty - presence: function(value, options) { - options = v.extend({}, this.options, options); - if (options.allowEmpty !== false ? !v.isDefined(value) : v.isEmpty(value)) { - return options.message || this.message || "can't be blank"; - } - }, - length: function(value, options, attribute) { - if (!v.isDefined(value)) { - return; - } - options = v.extend({}, this.options, options); - var is = options.is, maximum = options.maximum, minimum = options.minimum, tokenizer = options.tokenizer || function(val) { - return val; - }, err, errors = []; - value = tokenizer(value); - var length = value.length; - if (!v.isNumber(length)) { - return options.message || this.notValid || "has an incorrect length"; - } - if (v.isNumber(is) && length !== is) { - err = options.wrongLength || this.wrongLength || "is the wrong length (should be %{count} characters)"; - errors.push(v.format(err, { count: is })); - } - if (v.isNumber(minimum) && length < minimum) { - err = options.tooShort || this.tooShort || "is too short (minimum is %{count} characters)"; - errors.push(v.format(err, { count: minimum })); - } - if (v.isNumber(maximum) && length > maximum) { - err = options.tooLong || this.tooLong || "is too long (maximum is %{count} characters)"; - errors.push(v.format(err, { count: maximum })); - } - if (errors.length > 0) { - return options.message || errors; - } - }, - numericality: function(value, options, attribute, attributes, globalOptions) { - if (!v.isDefined(value)) { - return; - } - options = v.extend({}, this.options, options); - var errors = [], name, count, checks = { - greaterThan: function(v2, c) { - return v2 > c; - }, - greaterThanOrEqualTo: function(v2, c) { - return v2 >= c; - }, - equalTo: function(v2, c) { - return v2 === c; - }, - lessThan: function(v2, c) { - return v2 < c; - }, - lessThanOrEqualTo: function(v2, c) { - return v2 <= c; - }, - divisibleBy: function(v2, c) { - return v2 % c === 0; - } - }, prettify = options.prettify || globalOptions && globalOptions.prettify || v.prettify; - if (v.isString(value) && options.strict) { - var pattern = "^-?(0|[1-9]\\d*)"; - if (!options.onlyInteger) { - pattern += "(\\.\\d+)?"; - } - pattern += "$"; - if (!new RegExp(pattern).test(value)) { - return options.message || options.notValid || this.notValid || this.message || "must be a valid number"; - } - } - if (options.noStrings !== true && v.isString(value) && !v.isEmpty(value)) { - value = +value; - } - if (!v.isNumber(value)) { - return options.message || options.notValid || this.notValid || this.message || "is not a number"; - } - if (options.onlyInteger && !v.isInteger(value)) { - return options.message || options.notInteger || this.notInteger || this.message || "must be an integer"; - } - for (name in checks) { - count = options[name]; - if (v.isNumber(count) && !checks[name](value, count)) { - var key = "not" + v.capitalize(name); - var msg = options[key] || this[key] || this.message || "must be %{type} %{count}"; - errors.push(v.format(msg, { - count, - type: prettify(name) - })); - } - } - if (options.odd && value % 2 !== 1) { - errors.push(options.notOdd || this.notOdd || this.message || "must be odd"); - } - if (options.even && value % 2 !== 0) { - errors.push(options.notEven || this.notEven || this.message || "must be even"); - } - if (errors.length) { - return options.message || errors; - } - }, - datetime: v.extend(function(value, options) { - if (!v.isFunction(this.parse) || !v.isFunction(this.format)) { - throw new Error("Both the parse and format functions needs to be set to use the datetime/date validator"); - } - if (!v.isDefined(value)) { - return; - } - options = v.extend({}, this.options, options); - var err, errors = [], earliest = options.earliest ? this.parse(options.earliest, options) : NaN, latest = options.latest ? this.parse(options.latest, options) : NaN; - value = this.parse(value, options); - if (isNaN(value) || options.dateOnly && value % 864e5 !== 0) { - err = options.notValid || options.message || this.notValid || "must be a valid date"; - return v.format(err, { value: arguments[0] }); - } - if (!isNaN(earliest) && value < earliest) { - err = options.tooEarly || options.message || this.tooEarly || "must be no earlier than %{date}"; - err = v.format(err, { - value: this.format(value, options), - date: this.format(earliest, options) - }); - errors.push(err); - } - if (!isNaN(latest) && value > latest) { - err = options.tooLate || options.message || this.tooLate || "must be no later than %{date}"; - err = v.format(err, { - date: this.format(latest, options), - value: this.format(value, options) - }); - errors.push(err); - } - if (errors.length) { - return v.unique(errors); - } - }, { - parse: null, - format: null - }), - date: function(value, options) { - options = v.extend({}, options, { dateOnly: true }); - return v.validators.datetime.call(v.validators.datetime, value, options); - }, - format: function(value, options) { - if (v.isString(options) || options instanceof RegExp) { - options = { pattern: options }; - } - options = v.extend({}, this.options, options); - var message = options.message || this.message || "is invalid", pattern = options.pattern, match; - if (!v.isDefined(value)) { - return; - } - if (!v.isString(value)) { - return message; - } - if (v.isString(pattern)) { - pattern = new RegExp(options.pattern, options.flags); - } - match = pattern.exec(value); - if (!match || match[0].length != value.length) { - return message; - } - }, - inclusion: function(value, options) { - if (!v.isDefined(value)) { - return; - } - if (v.isArray(options)) { - options = { within: options }; - } - options = v.extend({}, this.options, options); - if (v.contains(options.within, value)) { - return; - } - var message = options.message || this.message || "^%{value} is not included in the list"; - return v.format(message, { value }); - }, - exclusion: function(value, options) { - if (!v.isDefined(value)) { - return; - } - if (v.isArray(options)) { - options = { within: options }; - } - options = v.extend({}, this.options, options); - if (!v.contains(options.within, value)) { - return; - } - var message = options.message || this.message || "^%{value} is restricted"; - if (v.isString(options.within[value])) { - value = options.within[value]; - } - return v.format(message, { value }); - }, - email: v.extend(function(value, options) { - options = v.extend({}, this.options, options); - var message = options.message || this.message || "is not a valid email"; - if (!v.isDefined(value)) { - return; - } - if (!v.isString(value)) { - return message; - } - if (!this.PATTERN.exec(value)) { - return message; - } - }, { - PATTERN: /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i - }), - equality: function(value, options, attribute, attributes, globalOptions) { - if (!v.isDefined(value)) { - return; - } - if (v.isString(options)) { - options = { attribute: options }; - } - options = v.extend({}, this.options, options); - var message = options.message || this.message || "is not equal to %{attribute}"; - if (v.isEmpty(options.attribute) || !v.isString(options.attribute)) { - throw new Error("The attribute must be a non empty string"); - } - var otherValue = v.getDeepObjectValue(attributes, options.attribute), comparator = options.comparator || function(v1, v2) { - return v1 === v2; - }, prettify = options.prettify || globalOptions && globalOptions.prettify || v.prettify; - if (!comparator(value, otherValue, options, attribute, attributes)) { - return v.format(message, { attribute: prettify(options.attribute) }); - } - }, - // A URL validator that is used to validate URLs with the ability to - // restrict schemes and some domains. - url: function(value, options) { - if (!v.isDefined(value)) { - return; - } - options = v.extend({}, this.options, options); - var message = options.message || this.message || "is not a valid url", schemes = options.schemes || this.schemes || ["http", "https"], allowLocal = options.allowLocal || this.allowLocal || false, allowDataUrl = options.allowDataUrl || this.allowDataUrl || false; - if (!v.isString(value)) { - return message; - } - var regex = "^(?:(?:" + schemes.join("|") + ")://)(?:\\S+(?::\\S*)?@)?(?:"; - var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))"; - if (allowLocal) { - tld += "?"; - } else { - regex += // IP address exclusion - // private & local networks - "(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})"; - } - regex += // IP address dotted notation octets - // excludes loopback network 0.0.0.0 - // excludes reserved space >= 224.0.0.0 - // excludes network & broacast addresses - // (first & last IP address of each class) - "(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*" + tld + ")(?::\\d{2,5})?(?:[/?#]\\S*)?$"; - if (allowDataUrl) { - var mediaType = "\\w+\\/[-+.\\w]+(?:;[\\w=]+)*"; - var urlchar = "[A-Za-z0-9-_.!~\\*'();\\/?:@&=+$,%]*"; - var dataurl = "data:(?:" + mediaType + ")?(?:;base64)?," + urlchar; - regex = "(?:" + regex + ")|(?:^" + dataurl + "$)"; - } - var PATTERN = new RegExp(regex, "i"); - if (!PATTERN.exec(value)) { - return message; - } - }, - type: v.extend(function(value, originalOptions, attribute, attributes, globalOptions) { - if (v.isString(originalOptions)) { - originalOptions = { type: originalOptions }; - } - if (!v.isDefined(value)) { - return; - } - var options = v.extend({}, this.options, originalOptions); - var type = options.type; - if (!v.isDefined(type)) { - throw new Error("No type was specified"); - } - var check; - if (v.isFunction(type)) { - check = type; - } else { - check = this.types[type]; - } - if (!v.isFunction(check)) { - throw new Error("validate.validators.type.types." + type + " must be a function."); - } - if (!check(value, options, attribute, attributes, globalOptions)) { - var message = originalOptions.message || this.messages[type] || this.message || options.message || (v.isFunction(type) ? "must be of the correct type" : "must be of type %{type}"); - if (v.isFunction(message)) { - message = message(value, originalOptions, attribute, attributes, globalOptions); - } - return v.format(message, { attribute: v.prettify(attribute), type }); - } - }, { - types: { - object: function(value) { - return v.isObject(value) && !v.isArray(value); - }, - array: v.isArray, - integer: v.isInteger, - number: v.isNumber, - string: v.isString, - date: v.isDate, - boolean: v.isBoolean - }, - messages: {} - }) - }; - validate3.formatters = { - detailed: function(errors) { - return errors; - }, - flat: v.flattenErrorsToArray, - grouped: function(errors) { - var attr; - errors = v.groupErrorsByAttribute(errors); - for (attr in errors) { - errors[attr] = v.flattenErrorsToArray(errors[attr]); - } - return errors; - }, - constraint: function(errors) { - var attr; - errors = v.groupErrorsByAttribute(errors); - for (attr in errors) { - errors[attr] = errors[attr].map(function(result) { - return result.validator; - }).sort(); - } - return errors; - } - }; - validate3.exposeModule(validate3, this, exports2, module2, define2); - }).call( - exports, - typeof exports !== "undefined" ? ( - /* istanbul ignore next */ - exports - ) : null, - typeof module !== "undefined" ? ( - /* istanbul ignore next */ - module - ) : null, - typeof define !== "undefined" ? ( - /* istanbul ignore next */ - define - ) : null - ); - } - }); - - // src/js/biometric-kyc.js - var import_jszip = __toESM(require_jszip_min(), 1); - var import_validate2 = __toESM(require_validate(), 1); - - // ../components/smart-camera-web.js - var VERSION = "1.0.2"; - var DEFAULT_NO_OF_LIVENESS_FRAMES = 8; - var PORTRAIT_ID_PREVIEW_WIDTH = 396; - var PORTRAIT_ID_PREVIEW_HEIGHT = 527; - function isSamsungMultiCameraDevice() { - const matchedModelNumber = navigator.userAgent.match(/SM-[N|G]\d{3}/); - if (!matchedModelNumber) { - return false; - } - const modelNumber = parseInt(matchedModelNumber[0].match(/\d{3}/)[0], 10); - const smallerModelNumber = 970; - return !Number.isNaN(modelNumber) && modelNumber >= smallerModelNumber; - } - function getLivenessFramesIndices(totalNoOfFrames, numberOfFramesRequired = DEFAULT_NO_OF_LIVENESS_FRAMES) { - const selectedFrames = []; - if (totalNoOfFrames < numberOfFramesRequired) { - throw new Error("SmartCameraWeb: Minimum required no of frames is ", numberOfFramesRequired); - } - const frameDivisor = numberOfFramesRequired - 1; - const frameInterval = Math.floor(totalNoOfFrames / frameDivisor); - let replacementFrameIndex = 1; - for (let i = 0; i < totalNoOfFrames; i += frameInterval) { - if (selectedFrames.length < 8) { - selectedFrames.push(i); - } else { - selectedFrames[replacementFrameIndex] = i; - selectedFrames.sort((a, b) => a - b); - replacementFrameIndex += 1; - } - } - const lastFrameIndex = totalNoOfFrames - 1; - if (selectedFrames.length < 8 && !selectedFrames.includes(lastFrameIndex)) { - selectedFrames.push(lastFrameIndex); - } - return selectedFrames; - } - var SmartFileUpload = class _SmartFileUpload { - static memoryLimit = 1024e4; - static supportedTypes = ["image/jpeg", "image/png"]; - static getHumanSize(numberOfBytes) { - const units = [ - "B", - "kB", - "MB", - "GB", - "TB", - "PB", - "EB", - "ZB", - "YB" - ]; - const exponent = Math.min( - Math.floor(Math.log(numberOfBytes) / Math.log(1024)), - units.length - 1 - ); - const approx = numberOfBytes / 1024 ** exponent; - const output = exponent === 0 ? `${numberOfBytes} bytes` : `${approx.toFixed(0)} ${units[exponent]}`; - return output; - } - static getData(file) { - return new Promise((resolve, reject) => { - const reader = new FileReader(); - reader.onload = (e) => { - resolve(e.target.result); - }; - reader.onerror = () => { - reject(new Error("An error occurred reading the file. Please check the file, and try again")); - }; - reader.readAsDataURL(file); - }); - } - static async retrieve(files) { - if (files.length > 1) { - throw new Error("Only one file upload is permitted at a time"); - } - const file = files[0]; - if (!_SmartFileUpload.supportedTypes.includes(file.type)) { - throw new Error("Unsupported file format. Please ensure that you are providing a JPG or PNG image"); - } - if (file.size > _SmartFileUpload.memoryLimit) { - throw new Error(`${file.name} is too large. Please ensure that the file is less than ${_SmartFileUpload.getHumanSize(_SmartFileUpload.memoryLimit)}.`); - } - const imageAsDataUrl = await _SmartFileUpload.getData(file); - return imageAsDataUrl; - } - }; - function scwTemplateString() { - return ` - - - - - - - - - - - - - - - -
-

-

-
- -
- ${this.showNavigation ? ` - - ` : ""} -
-

- We need access to your camera so that we can take selfie and proof-of-life images. -

- - - - ${this.hideAttribution ? "" : ` - - `} -
-
- - - - - - - - - - - - - - - - - - - - - - `; - } - var PoweredBySmileId = class extends HTMLElement { - constructor() { - super(); - const template = document.createElement("template"); - template.innerHTML = ` -

- - - - - - - - - - - - - - - - - - - -

- `; - this.attachShadow({ mode: "open" }).appendChild(template.content.cloneNode(true)); - } - }; - function hasMoreThanNColors(data, n = 16) { - const colors = /* @__PURE__ */ new Set(); - for (let i = 0; i < Math.min(data.length, 1e4); i += 4) { - colors.add(data[i] << 16 | data[i + 1] << 8 | data[i + 2]); - if (colors.size > n) { - return true; - } - } - return false; - } - window.customElements.define("powered-by-smile-id", PoweredBySmileId); - var SmartCameraWeb = class extends HTMLElement { - constructor() { - super(); - this.scwTemplateString = scwTemplateString.bind(this); - this.render = () => this.scwTemplateString(); - this.attachShadow({ mode: "open" }); - this.activeScreen = null; - } - setActiveScreen(element) { - this.activeScreen.hidden = true; - element.hidden = false; - this.activeScreen = element; - } - connectedCallback() { - this.shadowRoot.innerHTML = this.render(); - if ("mediaDevices" in navigator && "getUserMedia" in navigator.mediaDevices) { - this.setUpEventListeners(); - } else { - const heading = document.createElement("h1"); - heading.classList.add("error-message"); - heading.textContent = "Your browser does not support this integration"; - this.shadowRoot.innerHTML = heading; - } - } - disconnectedCallback() { - if (this.activeScreen) { - this.activeScreen.hidden = true; - } - this.activeScreen = null; - this.shadowRoot.innerHTML = ""; - } - static get observedAttributes() { - return ["document-capture-modes", "document-type", "hide-back-to-host", "show-navigation"]; - } - attributeChangedCallback(name) { - switch (name) { - case "document-capture-modes": - case "document-type": - case "hide-back-to-host": - case "show-navigation": - this.shadowRoot.innerHTML = this.render(); - this.setUpEventListeners(); - break; - default: - break; - } - } - setUpEventListeners() { - this.errorMessage = this.shadowRoot.querySelector("#error"); - this.requestScreen = this.shadowRoot.querySelector("#request-screen"); - this.activeScreen = this.requestScreen; - this.cameraScreen = this.shadowRoot.querySelector("#camera-screen"); - this.failedImageTestScreen = this.shadowRoot.querySelector("#failed-image-test-screen"); - this.reviewScreen = this.shadowRoot.querySelector("#review-screen"); - this.idEntryScreen = this.shadowRoot.querySelector("#id-entry-screen"); - this.IDCameraScreen = this.shadowRoot.querySelector("#id-camera-screen"); - this.IDReviewScreen = this.shadowRoot.querySelector("#id-review-screen"); - this.backOfIdEntryScreen = this.shadowRoot.querySelector("#back-of-id-entry-screen"); - this.backOfIDCameraScreen = this.shadowRoot.querySelector("#back-of-id-camera-screen"); - this.backOfIDReviewScreen = this.shadowRoot.querySelector("#back-of-id-review-screen"); - this.thanksScreen = this.shadowRoot.querySelector("#thanks-screen"); - this.videoContainer = this.shadowRoot.querySelector(".video-container > .video"); - this.smileCTA = this.shadowRoot.querySelector("#smile-cta"); - this.imageOutline = this.shadowRoot.querySelector("#image-outline path"); - this.startImageCapture = this.shadowRoot.querySelector("#start-image-capture"); - this.captureIDImage = this.shadowRoot.querySelector("#capture-id-image"); - this.captureBackOfIDImage = this.shadowRoot.querySelector("#capture-back-of-id-image"); - this.reviewImage = this.shadowRoot.querySelector("#review-image"); - this.IDReviewImage = this.shadowRoot.querySelector("#id-review-image"); - this.backOfIDReviewImage = this.shadowRoot.querySelector("#back-of-id-review-image"); - this.reStartImageCapture = this.shadowRoot.querySelector("#restart-image-capture"); - this.reCaptureIDImage = this.shadowRoot.querySelector("#re-capture-id-image"); - this.reCaptureBackOfIDImage = this.shadowRoot.querySelector("#re-capture-back-of-id-image"); - this.selectSelfie = this.shadowRoot.querySelector("#select-selfie"); - this.selectIDImage = this.shadowRoot.querySelector("#select-id-image"); - this.selectBackOfIDImage = this.shadowRoot.querySelector("#select-back-of-id-image"); - this.takeDocumentPhotoButton = this.idEntryScreen.querySelector("#take-photo"); - this.uploadDocumentPhotoButton = this.idEntryScreen.querySelector("#upload-photo"); - this.skipBackOfDocumentPhotoButton = this.backOfIdEntryScreen.querySelector("#skip-this-step"); - this.takeBackOfDocumentPhotoButton = this.backOfIdEntryScreen.querySelector("#take-photo"); - this.uploadBackOfDocumentPhotoButton = this.backOfIdEntryScreen.querySelector("#upload-photo"); - this.shadowRoot.querySelector("#request-camera-access").addEventListener("click", () => this.init()); - if (this.showNavigation) { - const backButtons = this.shadowRoot.querySelectorAll(".back-button-exit"); - backButtons.forEach((button) => { - button.addEventListener("click", () => { - this._backAndExit(); - }); - }); - const closeButtons = this.shadowRoot.querySelectorAll(".close-iframe"); - closeButtons.forEach((button) => { - button.addEventListener("click", () => { - this._exitSmartCamera(); - }); - }); - } - if (this.takeDocumentPhotoButton) - this.takeDocumentPhotoButton.addEventListener("click", () => this._startIDCamera()); - if (this.skipBackOfDocumentPhotoButton) - this.skipBackOfDocumentPhotoButton.addEventListener("click", () => this._skipBackDocument()); - if (this.takeBackOfDocumentPhotoButton) - this.takeBackOfDocumentPhotoButton.addEventListener("click", () => this._startIDCamera()); - if (this.uploadDocumentPhotoButton) - this.uploadDocumentPhotoButton.addEventListener("change", (e) => this._uploadDocument(e)); - if (this.uploadBackOfDocumentPhotoButton) - this.uploadBackOfDocumentPhotoButton.addEventListener("change", (e) => this._uploadDocument(e)); - this.backToSelfie = this.shadowRoot.querySelector("#back-button-selfie"); - this.backToIdEntryButton = this.shadowRoot.querySelector("#back-button-id-entry"); - this.backToBackIdEntryButton = this.shadowRoot.querySelector("#back-button-back-id-entry"); - this.backToIdImageButton = this.shadowRoot.querySelector("#back-button-id-image"); - if (this.backToSelfie) { - this.backToSelfie.addEventListener("click", () => { - this._reStartImageCapture(); - }); - } - if (this.backToIdEntryButton) { - this.backToIdEntryButton.addEventListener("click", () => { - this.setActiveScreen(this.idEntryScreen); - }); - } - if (this.backToBackIdEntryButton) { - this.backToBackIdEntryButton.addEventListener("click", () => { - this.setActiveScreen(this.backOfIdEntryScreen); - }); - } - if (this.backToIdImageButton) { - this.backToIdImageButton.addEventListener("click", () => { - this.setActiveScreen(this.IDReviewScreen); - }); - } - this.startImageCapture.addEventListener("click", () => { - this._startImageCapture(); - }); - this.selectSelfie.addEventListener("click", () => { - this._selectSelfie(); - }); - this.selectIDImage.addEventListener("click", () => { - this._selectIDImage(); - }); - this.selectBackOfIDImage.addEventListener("click", () => { - this._selectIDImage(true); - }); - this.captureIDImage.addEventListener("click", () => { - this._captureIDImage(); - }); - this.captureBackOfIDImage.addEventListener("click", () => { - this._captureIDImage(); - }); - this.reStartImageCapture.addEventListener("click", () => { - this._reStartImageCapture(); - }); - this.reCaptureIDImage.addEventListener("click", () => { - this._reCaptureIDImage(); - }); - this.reCaptureBackOfIDImage.addEventListener("click", () => { - this._reCaptureIDImage(); - }); - } - init() { - this._videoStreamDurationInMS = 7800; - this._imageCaptureIntervalInMS = 200; - this._data = { - images: [], - partner_params: { - libraryVersion: VERSION, - permissionGranted: false - } - }; - this._rawImages = []; - navigator.mediaDevices.getUserMedia({ audio: false, video: true }).then((stream) => { - this.handleSuccess(stream); - }).catch((e) => { - this.handleError(e); - }); - } - reset() { - this.disconnectedCallback(); - this.connectedCallback(); - } - resetErrorMessage() { - this.errorMessage.textContent = ""; - } - handleSuccess(stream) { - const videoExists = !!this.videoContainer.querySelector("video"); - const video = videoExists ? this.videoContainer.querySelector("video") : document.createElement("video"); - video.autoplay = true; - video.playsInline = true; - video.muted = true; - if ("srcObject" in video) { - video.srcObject = stream; - } else { - video.src = window.URL.createObjectURL(stream); - } - video.play(); - if (!videoExists) - this.videoContainer.prepend(video); - this._data.partner_params.permissionGranted = true; - this.setActiveScreen(this.cameraScreen); - this._stream = stream; - this._video = video; - } - handleIDStream(stream) { - const videoExists = this.activeScreen === this.IDCameraScreen ? !!this.IDCameraScreen.querySelector("video") : !!this.backOfIDCameraScreen.querySelector("video"); - let video = null; - if (videoExists) { - if (this.activeScreen === this.IDCameraScreen) { - video = this.IDCameraScreen.querySelector("video"); - } else { - video = this.backOfIDCameraScreen.querySelector("video"); - } - } else { - video = document.createElement("video"); - } - video.autoplay = true; - video.playsInline = true; - video.muted = true; - if ("srcObject" in video) { - video.srcObject = stream; - } else { - video.src = window.URL.createObjectURL(stream); - } - video.play(); - const videoContainer = this.activeScreen === this.IDCameraScreen ? this.IDCameraScreen.querySelector(".id-video-container") : this.backOfIDCameraScreen.querySelector(".id-video-container"); - video.onloadedmetadata = () => { - videoContainer.querySelector(".actions").hidden = false; - }; - if (!videoExists) { - videoContainer.prepend(video); - } - this._IDStream = stream; - this._IDVideo = video; - } - handleError(e) { - switch (e.name) { - case "NotAllowedError": - case "SecurityError": - this.errorMessage.textContent = ` - Looks like camera access was not granted, or was blocked by a browser - level setting / extension. Please follow the prompt from the URL bar, - or extensions, and enable access. - You may need to refresh to start all over again - `; - break; - case "AbortError": - this.errorMessage.textContent = ` - Oops! Something happened, and we lost access to your stream. - Please refresh to start all over again - `; - break; - case "NotReadableError": - this.errorMessage.textContent = ` - There seems to be a problem with your device's camera, or its connection. - Please check this, and when resolved, try again. Or try another device. - `; - break; - case "NotFoundError": - this.errorMessage.textContent = ` - We are unable to find a video stream. - You may need to refresh to start all over again - `; - break; - case "TypeError": - this.errorMessage.textContent = ` - This site is insecure, and as such cannot have access to your camera. - Try to navigate to a secure version of this page, or contact the owner. - `; - break; - default: - this.errorMessage.textContent = e.message; - } - } - _startImageCapture() { - this.startImageCapture.disabled = true; - const imageOutlineLength = this.imageOutline.getTotalLength(); - this.imageOutline.style.transition = "none"; - this.imageOutline.style.strokeDasharray = `${imageOutlineLength} ${imageOutlineLength}`; - this.imageOutline.style.strokeDashoffset = imageOutlineLength; - this.imageOutline.getBoundingClientRect(); - this.imageOutline.style.transition = `stroke-dashoffset ${this._videoStreamDurationInMS / 1e3}s ease-in-out`; - this.imageOutline.style.strokeDashoffset = "0"; - this.smileCTA.style.animation = `fadeInOut ease ${this._videoStreamDurationInMS / 1e3}s`; - this._imageCaptureInterval = setInterval(() => { - this._capturePOLPhoto(); - }, this._imageCaptureIntervalInMS); - this._videoStreamTimeout = setTimeout(() => { - this._stopVideoStream(this._stream); - }, this._videoStreamDurationInMS); - } - _captureIDImage() { - const image = this._drawIDImage(); - if (this.activeScreen === this.IDCameraScreen) { - this.IDReviewImage.src = image; - } else { - this.backOfIDReviewImage.src = image; - } - this._data.images.push({ - image: image.split(",")[1], - image_type_id: this.activeScreen === this.IDCameraScreen ? 3 : 7 - }); - this._stopIDVideoStream(); - if (this.activeScreen === this.IDCameraScreen) { - this.setActiveScreen(this.IDReviewScreen); - } else { - this.setActiveScreen(this.backOfIDReviewScreen); - } - } - _drawImage(canvas, enableImageTests = true, video = this._video) { - this.resetErrorMessage(); - const context = canvas.getContext("2d"); - context.drawImage( - video, - 0, - 0, - video.videoWidth, - video.videoHeight, - 0, - 0, - canvas.width, - canvas.height - ); - if (enableImageTests) { - const imageData = context.getImageData(0, 0, canvas.width, canvas.height); - const hasEnoughColors = hasMoreThanNColors(imageData.data); - if (hasEnoughColors) { - return context; - } - throw new Error("Unable to capture webcam images - Please try another device"); - } else { - return context; - } - } - _capturePOLPhoto() { - const canvas = document.createElement("canvas"); - canvas.width = 240; - canvas.height = canvas.width * this._video.videoHeight / this._video.videoWidth; - this._drawImage(canvas, false); - this._rawImages.push(canvas.toDataURL("image/jpeg")); - } - _captureReferencePhoto() { - const canvas = document.createElement("canvas"); - canvas.width = 480; - canvas.height = canvas.width * this._video.videoHeight / this._video.videoWidth; - this._drawImage(canvas, !this.disableImageTests); - const image = canvas.toDataURL("image/jpeg"); - this._referenceImage = image; - this._data.images.push({ - image: image.split(",")[1], - image_type_id: 2 - }); - } - _skipBackDocument() { - this._publishSelectedImages(); - } - async _uploadDocument(event) { - this.resetErrorMessage(); - try { - const { files } = event.target; - const fileData = await SmartFileUpload.retrieve(files); - this._data.images.push({ - // NOTE: data URLs start with a file type before the base64 data, - // separated by a comma. - // - // we are only interested in the base64 segment, so we extract it - image: fileData.split(",")[1], - image_type_id: this.activeScreen === this.idEntryScreen ? 3 : 7 - }); - const nextScreen = this.activeScreen === this.idEntryScreen ? this.IDReviewScreen : this.backOfIDReviewScreen; - const previewImage = nextScreen.querySelector("img"); - previewImage.src = fileData; - this.setActiveScreen(nextScreen); - } catch (error) { - this.handleError(error); - } - } - _drawIDImage(video = this._IDVideo) { - const canvas = document.createElement("canvas"); - if (this.isPortraitCaptureView) { - canvas.width = video.videoWidth; - canvas.height = video.videoHeight; - const ctx = canvas.getContext("2d"); - ctx.drawImage(video, 0, 0, canvas.width, canvas.height); - const previewWidth = PORTRAIT_ID_PREVIEW_WIDTH; - const previewHeight = PORTRAIT_ID_PREVIEW_HEIGHT; - const paddingPercent = 0.5; - const paddedWidth = previewWidth * (1 + paddingPercent); - const paddedHeight = previewHeight * (1 + paddingPercent); - const cropWidth = paddedWidth; - const cropHeight = paddedHeight; - const cropLeft = (canvas.width - cropWidth) / 2; - const cropTop = (canvas.height - cropHeight) / 2; - const croppedCanvas = document.createElement("canvas"); - croppedCanvas.width = cropWidth; - croppedCanvas.height = cropHeight; - const croppedCtx = croppedCanvas.getContext("2d"); - croppedCtx.drawImage(canvas, cropLeft, cropTop, cropWidth, cropHeight, 0, 0, cropWidth, cropHeight); - return croppedCanvas.toDataURL("image/jpeg"); - } - canvas.width = 2240; - canvas.height = 1260; - const context = canvas.getContext("2d"); - const aspectRatio = video.videoWidth / video.videoHeight; - if (aspectRatio < 1) { - const imageFrame = this.activeScreen.querySelector('[class*="image-frame"]:not([hidden]) [href*="image-frame"]'); - const videoBox = video.getBoundingClientRect(); - const frameBox = imageFrame.getBoundingClientRect(); - const sourceXOffset = (frameBox.left - videoBox.left) / videoBox.width * video.videoWidth; - const sourceYOffset = (frameBox.top - videoBox.top) / videoBox.height * video.videoHeight; - const sourceWidth = frameBox.width * (video.videoWidth / videoBox.width); - const sourceHeight = frameBox.height * (video.videoHeight / videoBox.height); - canvas.height = canvas.width * frameBox.height / frameBox.width; - context.drawImage(video, sourceXOffset, sourceYOffset, sourceWidth, sourceHeight, 0, 0, canvas.width, canvas.height); - return canvas.toDataURL("image/jpeg"); - } - context.drawImage(video, 0, 0, canvas.width, canvas.height); - return canvas.toDataURL("image/jpeg"); - } - _stopVideoStream(stream) { - try { - clearTimeout(this._videoStreamTimeout); - clearInterval(this._imageCaptureInterval); - clearInterval(this._drawingInterval); - this.smileCTA.style.animation = "none"; - this._capturePOLPhoto(); - this._captureReferencePhoto(); - stream.getTracks().forEach((track) => track.stop()); - this.reviewImage.src = this._referenceImage; - const totalNoOfFrames = this._rawImages.length; - const livenessFramesIndices = getLivenessFramesIndices(totalNoOfFrames); - this._data.images = this._data.images.concat(livenessFramesIndices.map((imageIndex) => ({ - image: this._rawImages[imageIndex].split(",")[1], - image_type_id: 6 - }))); - this.setActiveScreen(this.reviewScreen); - } catch (error) { - this.setActiveScreen(this.failedImageTestScreen); - } - } - _stopIDVideoStream(stream = this._IDStream) { - stream.getTracks().forEach((track) => track.stop()); - } - async _startIDCamera() { - try { - const stream = await navigator.mediaDevices.getUserMedia({ - audio: false, - video: { - facingMode: "environment", - width: { min: 1280 }, - // NOTE: Special case for multi-camera Samsung devices (learnt from Acuant) - // "We found out that some triple camera Samsung devices (S10, S20, Note 20, etc) capture images blurry at edges. - // Zooming to 2X, matching the telephoto lens, doesn't solve it completely but mitigates it." - zoom: isSamsungMultiCameraDevice() ? 2 : 1 - } - }); - if (this.activeScreen === this.idEntryScreen) { - this.setActiveScreen(this.IDCameraScreen); - } else if (this.activeScreen === this.backOfIdEntryScreen) { - this.setActiveScreen(this.backOfIDCameraScreen); - } - this.handleIDStream(stream); - } catch (e) { - this.handleError(e); - } - } - _selectSelfie() { - if (!this.captureID) { - this._publishSelectedImages(); - } else { - this.setActiveScreen(this.idEntryScreen); - } - } - _selectIDImage(backOfIDCaptured = false) { - if (!this.captureBackOfID || backOfIDCaptured) { - this._publishSelectedImages(); - } else { - this.setActiveScreen(this.backOfIdEntryScreen); - } - } - _publishSelectedImages() { - this.dispatchEvent( - new CustomEvent("imagesComputed", { detail: this._data }) - ); - this.setActiveScreen(this.thanksScreen); - } - _exitSmartCamera() { - this.dispatchEvent( - new CustomEvent("close", { detail: {} }) - ); - } - _backAndExit() { - this.dispatchEvent( - new CustomEvent("backExit", { detail: {} }) - ); - } - async _reStartImageCapture() { - this.startImageCapture.disabled = false; - this._rawImages = []; - this._data.images = []; - try { - const stream = await navigator.mediaDevices.getUserMedia({ - audio: false, - video: true - }); - this.handleSuccess(stream); - } catch (e) { - this.handleError(e); - } - } - async _reCaptureIDImage() { - const previousScreen = this.activeScreen === this.IDReviewScreen ? this.idEntryScreen : this.backOfIdEntryScreen; - this.setActiveScreen(previousScreen); - this._data.images.pop(); - } - get captureID() { - return this.hasAttribute("capture-id"); - } - get captureBackOfID() { - return this.getAttribute("capture-id") === "back" || false; - } - get hideAttribution() { - return this.hasAttribute("hide-attribution"); - } - get showNavigation() { - return this.hasAttribute("show-navigation"); - } - get hideBackToHost() { - return this.hasAttribute("hide-back-to-host"); - } - get documentType() { - return this.getAttribute("document-type"); - } - get isPortraitCaptureView() { - return this.getAttribute("document-type") === "GREEN_BOOK"; - } - get documentCaptureModes() { - return this.getAttribute("document-capture-modes") || "camera"; - } - get supportBothCaptureModes() { - const value = this.documentCaptureModes; - return value.includes("camera") && value.includes("upload"); - } - get disableImageTests() { - return this.hasAttribute("disable-image-tests"); - } - get doNotUpload() { - return this.getAttribute("document-capture-modes") === "camera"; - } - }; - window.customElements.define("smart-camera-web", SmartCameraWeb); - - // src/js/components/ConsentScreen.js - function templateString() { - return ` - - - - - - - - `; - } - var EndUserConsent = class extends HTMLElement { - constructor() { - super(); - this.idRequiresTotpConsent = ["BVN_MFA"]; - this.templateString = templateString.bind(this); - this.render = () => { - return this.templateString(); - }; - this.attachShadow({ mode: "open" }); - } - connectedCallback() { - this.pages = []; - const template = document.createElement("template"); - template.innerHTML = this.render(); - this.shadowRoot.appendChild(template.content.cloneNode(true)); - this.consentScreen = this.shadowRoot.querySelector("#consent-screen"); - this.totpConsentApp = this.shadowRoot.querySelector("totp-consent-app"); - this.consentRejectedScreen = this.shadowRoot.querySelector( - "#consent-rejected-screen" - ); - this.allowButton = this.shadowRoot.querySelector("#allow"); - this.rejectButton = this.shadowRoot.querySelector("#cancel"); - this.backToConsentButton = this.shadowRoot.querySelector("#back-to-consent"); - this.confirmConsentRejectionButton = this.shadowRoot.querySelector( - "#confirm-consent-rejection" - ); - this.backButton = this.shadowRoot.querySelector("#back-button"); - const CloseIframeButtons = this.shadowRoot.querySelectorAll(".close-iframe"); - this.allowButton.addEventListener( - "click", - (e) => this.handleConsentGrant(e) - ); - this.rejectButton.addEventListener( - "click", - (e) => this.handleConsentGrant(e) - ); - this.backToConsentButton.addEventListener( - "click", - () => this.setActiveScreen(this.consentScreen) - ); - this.confirmConsentRejectionButton.addEventListener( - "click", - (e) => this.handleConsentRejection(e) - ); - this.totpConsentApp.addEventListener( - "SmileIdentity::ConsentDenied::TOTP::ContactMethodsOutdated", - (e) => this.handleTotpConsentEvents(e) - ); - this.totpConsentApp.addEventListener( - "SmileIdentity::ConsentGranted::TOTP", - (e) => this.handleTotpConsentEvents(e) - ); - this.totpConsentApp.addEventListener( - "SmileIdentity::ConsentDenied::Back", - (e) => this.handleBackEvents(e) - ); - this.backButton.addEventListener("click", (e) => { - this.handleBackEvents(e); - }); - CloseIframeButtons.forEach((button) => { - button.addEventListener( - "click", - () => { - this.closeWindow(); - }, - false - ); - }); - this.activeScreen = this.consentScreen; - } - setActiveScreen(screen) { - this.activeScreen.hidden = true; - screen.hidden = false; - this.activeScreen = screen; - } - get baseUrl() { - return this.getAttribute("base-url"); - } - get country() { - return this.getAttribute("country"); - } - get demoMode() { - return !!this.hasAttribute("demo-mode"); - } - get hideBack() { - return this.hasAttribute("hide-back-to-host"); - } - get idHint() { - return this.getAttribute("id-hint") || "Your BVN should be 11 digits long"; - } - get idRegex() { - return this.getAttribute("id-regex"); - } - get idType() { - return this.getAttribute("id-type"); - } - get idTypeLabel() { - return this.getAttribute("id-type-label"); - } - get partnerId() { - return this.getAttribute("partner-id"); - } - get partnerName() { - return this.getAttribute("partner-name"); - } - get partnerLogoURL() { - return this.getAttribute("partner-logo"); - } - get partnerPolicyURL() { - return this.getAttribute("policy-url"); - } - get themeColor() { - return this.getAttribute("theme-color") || "#043C93"; - } - get token() { - return this.getAttribute("token"); - } - handleConsentGrant(e) { - const granted = e.target === this.allowButton; - if (granted) { - if (this.idRequiresTotpConsent.includes(this.idType)) { - this.setActiveScreen(this.totpConsentApp); - this.pages.push(this.consentScreen); - } else { - this.dispatchEvent( - new CustomEvent("SmileIdentity::ConsentGranted", { - detail: { - consented: { - personal_details: granted, - contact_information: granted, - document_information: granted - } - } - }) - ); - } - } else { - this.setActiveScreen(this.consentRejectedScreen); - } - } - handleConsentRejection() { - this.dispatchEvent(new CustomEvent("SmileIdentity::ConsentDenied")); - } - handleTotpConsentEvents(e) { - const customEvent = new CustomEvent(e.type, { - detail: { - ...e.detail - } - }); - this.dispatchEvent(customEvent); - } - handleBackEvents() { - const page = this.pages.pop(); - if (page) { - this.setActiveScreen(page); - } else { - this.dispatchEvent(new CustomEvent("SmileIdentity::Exit")); - } - } - closeWindow() { - const referenceWindow = window.parent; - referenceWindow.postMessage("SmileIdentity::Close", "*"); - } - }; - var ConsentScreen_default = EndUserConsent; - - // src/js/components/TotpConsentApp.js - var import_validate = __toESM(require_validate(), 1); - function postData(url, data) { - return fetch(url, { - method: "POST", - mode: "cors", - cache: "no-cache", - headers: { - Accept: "application/json", - "Content-Type": "application/json" - }, - body: JSON.stringify(data) - }); - } - function markup() { - return ` - - -
- -

- Enter your ${this.idTypeLabel} -

- -
-
- - - - -

- ${this.idHint} -

-
- - -
-
- - - - - `; - } - var TotpBasedConsent = class extends HTMLElement { - constructor() { - super(); - this.templateString = markup.bind(this); - this.render = () => { - return this.templateString(); - }; - this.attachShadow({ mode: "open" }); - this.modes = []; - this["otp-delivery-mode"] = ""; - this.queryOtpModes = this.queryOtpModes.bind(this); - this.selectOtpMode = this.selectOtpMode.bind(this); - this.submitOtp = this.submitOtp.bind(this); - this.switchContactMethod = this.switchContactMethod.bind(this); - this.handleTotpConsentGrant = this.handleTotpConsentGrant.bind(this); - this.handleTotpConsentContactMethodsOutdated = this.handleTotpConsentContactMethodsOutdated.bind(this); - this.pages = []; - } - static get observedAttributes() { - return ["modes", "otp-delivery-mode"]; - } - attributeChangedCallback(name) { - switch (name) { - case "modes": - case "otp-delivery-mode": { - const updatedTemplate = document.createElement("template"); - updatedTemplate.innerHTML = this.render(); - const updatedNode = updatedTemplate.content.cloneNode(true).querySelector(`#${this.activeScreen.id}`); - updatedNode.hidden = false; - this.shadowRoot.replaceChild(updatedNode, this.activeScreen); - this.setUpEventListeners(); - this.setActiveScreen(updatedNode); - break; - } - default: - break; - } - } - setUpEventListeners() { - this.idEntryScreen = this.shadowRoot.querySelector("#id-entry"); - this.selectModeScreen = this.shadowRoot.querySelector("#select-mode"); - this.otpVerificationScreen = this.shadowRoot.querySelector("#otp-verification"); - if (!this.activeScreen) { - this.activeScreen = this.idEntryScreen; - } - this.queryOtpModesButton = this.idEntryScreen.querySelector("#query-otp-modes"); - this.backButton = this.idEntryScreen.querySelector("#back-button"); - this.selectOtpModeButton = this.selectModeScreen.querySelector("#select-otp-mode"); - this.entryBackbutton = this.selectModeScreen.querySelector( - "#back-to-entry-button" - ); - this.contactMethodsOutdatedButton = this.selectModeScreen.querySelector( - "#contact-methods-outdated" - ); - this.submitOtpButton = this.otpVerificationScreen.querySelector("#submit-otp"); - this.switchContactMethodButton = this.otpVerificationScreen.querySelector( - ".try-another-method" - ); - const CloseIframeButtons = this.shadowRoot.querySelectorAll(".close-iframe"); - this.idNumberInput = this.idEntryScreen.querySelector("#id_number"); - this.modeInputs = this.selectModeScreen.querySelectorAll('[name="mode"]'); - this.otpInput = this.otpVerificationScreen.querySelector("#totp-token"); - this.queryOtpModesButton.addEventListener( - "click", - (e) => this.queryOtpModes(e) - ); - this.selectOtpModeButton.addEventListener( - "click", - (e) => this.selectOtpMode(e) - ); - this.submitOtpButton.addEventListener("click", (e) => this.submitOtp(e)); - this.switchContactMethodButton.addEventListener( - "click", - (e) => this.switchContactMethod(e) - ); - this.contactMethodsOutdatedButton.addEventListener( - "click", - (e) => this.handleTotpConsentContactMethodsOutdated(e) - ); - this.entryBackbutton.addEventListener("click", () => { - this.handleBackClick(); - }); - this.backButton.addEventListener("click", () => { - this.handleBackClick(); - }); - CloseIframeButtons.forEach((button) => { - button.addEventListener( - "click", - () => { - this.closeWindow(); - }, - false - ); - }); - } - closeWindow() { - const referenceWindow = window.parent; - referenceWindow.postMessage("SmileIdentity::Close", "*"); - } - handleBackClick() { - const page = this.pages.pop(); - if (page) { - this.setActiveScreen(page); - } else { - this.dispatchEvent( - new CustomEvent("SmileIdentity::ConsentDenied::Back", {}) - ); - } - } - connectedCallback() { - const template = document.createElement("template"); - template.innerHTML = this.render(); - this.shadowRoot.appendChild(template.content.cloneNode(true)); - this.setUpEventListeners(); - } - switchContactMethod() { - this.queryOtpModes(); - } - resetForm() { - const invalidElements = this.activeScreen.querySelectorAll("[aria-invalid]"); - invalidElements.forEach((el) => el.removeAttribute("aria-invalid")); - const validationMessages = this.activeScreen.querySelectorAll( - ".validation-message" - ); - validationMessages.forEach((el) => el.remove()); - } - handleIdNumberValidationErrors(errors) { - const fields = Object.keys(errors); - fields.forEach((field) => { - const input = this.activeScreen.querySelector(`#${field}`); - input.setAttribute("aria-invalid", "true"); - input.setAttribute("aria-describedby", `${field}-hint`); - const errorDiv = document.createElement("div"); - errorDiv.setAttribute("id", `${field}-hint`); - errorDiv.setAttribute("class", "validation-message"); - errorDiv.textContent = errors[field][0]; - input.insertAdjacentElement("afterend", errorDiv); - }); - } - handleActiveScreenErrors(error) { - const submitButton = this.activeScreen.querySelector('[type="submit"]'); - const errorDiv = document.createElement("div"); - errorDiv.setAttribute("class", "validation-message"); - errorDiv.textContent = error; - submitButton.insertAdjacentElement("beforebegin", errorDiv); - } - validateIdNumber(idNumber) { - const validationConstraints = { - id_number: { - presence: { - allowEmpty: false, - message: "is required" - }, - format: new RegExp(this.idRegex) - } - }; - const errors = (0, import_validate.default)({ id_number: idNumber }, validationConstraints); - if (errors) { - this.handleIdNumberValidationErrors(errors); - } - return errors; - } - async queryOtpModes(event) { - if (event) { - event.preventDefault(); - this.resetForm(); - } - const validationErrors = this.validateIdNumber(this.idNumberInput.value); - localStorage.setItem("idNumber", this.idNumberInput.value || this.idNumber); - if (!validationErrors) { - const data = { - country: this.country, - id_number: this.idNumber, - id_type: this.idType, - partner_id: this.partnerId, - token: this.token - }; - const url = `${this.baseUrl}/totp_consent`; - try { - this.toggleLoading(); - const response = await postData(url, data); - const json = await response.json(); - this.toggleLoading(); - if (!response.ok) { - this.handleActiveScreenErrors(json.error); - } else { - this.sessionId = json.session_id; - this.modes = json.modes; - this.setActiveScreen(this.selectModeScreen); - this.setAttribute("modes", json.modes); - } - } catch (error) { - this.toggleLoading(); - this.handleActiveScreenErrors(error.message); - } - } - } - async selectOtpMode(event) { - event.preventDefault(); - this.resetForm(); - this.mode = Array.prototype.find.call( - this.modeInputs, - (node) => node.checked - ).value; - const data = { - country: this.country, - id_number: this.idNumber, - id_type: this.idType, - mode: this.mode, - partner_id: this.partnerId, - session_id: this.sessionId, - token: this.token - }; - const url = `${this.baseUrl}/totp_consent/mode`; - try { - this.toggleLoading(); - const response = await postData(url, data); - const json = await response.json(); - this.toggleLoading(); - if (!response.ok) { - this.handleActiveScreenErrors(json.error); - } else { - this.selectedOtpDeliveryMode = this.modes.filter( - (mode) => mode[this.mode] - )[0][this.mode]; - this.setActiveScreen(this.otpVerificationScreen); - this.setAttribute("otp-delivery-mode", this.selectedOtpDeliveryMode); - } - } catch (error) { - this.toggleLoading(); - this.handleActiveScreenErrors(error.message); - } - } - async submitOtp(event) { - event.preventDefault(); - this.resetForm(); - this.otp = this.otpInput.value; - const data = { - country: this.country, - id_number: this.idNumber, - id_type: this.idType, - otp: this.otp, - partner_id: this.partnerId, - session_id: this.sessionId, - token: this.token - }; - const url = `${this.baseUrl}/totp_consent/otp`; - try { - this.toggleLoading(); - const response = await postData(url, data); - const json = await response.json(); - this.toggleLoading(); - if (!response.ok) { - this.handleActiveScreenErrors(json.error); - } else { - this.handleTotpConsentGrant(event); - } - } catch (error) { - this.toggleLoading(); - this.handleActiveScreenErrors(error.message); - } - } - toggleLoading() { - const button = this.activeScreen.querySelector('button[type="submit"]'); - const text = button.querySelector(".text"); - const arrow = button.querySelector("svg"); - const spinner = button.querySelector(".spinner"); - button.toggleAttribute("disabled"); - text.toggleAttribute("hidden"); - arrow.toggleAttribute("hidden"); - spinner.toggleAttribute("hidden"); - } - setActiveScreen(screen) { - this.activeScreen.hidden = true; - screen.hidden = false; - this.activeScreen = screen; - } - get baseUrl() { - return this.getAttribute("base-url"); - } - get country() { - return this.getAttribute("country"); - } - get idHint() { - return this.getAttribute("id-hint") || "Your BVN should be 11 digits long"; - } - get idNumber() { - return localStorage.getItem("idNumber"); - } - get idRegex() { - return this.getAttribute("id-regex"); - } - get idType() { - return this.getAttribute("id-type"); - } - get idTypeLabel() { - return this.getAttribute("id-type-label"); - } - get partnerId() { - return this.getAttribute("partner-id"); - } - get partnerName() { - return this.getAttribute("partner-name"); - } - get token() { - return this.getAttribute("token"); - } - handleTotpConsentGrant() { - const customEvent = new CustomEvent("SmileIdentity::ConsentGranted::TOTP", { - detail: { - id_number: this.idNumber, - session_id: this.sessionId, - consented: { - personal_details: true, - contact_information: true, - document_information: true - } - } - }); - this.dispatchEvent(customEvent); - } - handleTotpConsentContactMethodsOutdated() { - const tag = "SmileIdentity::ConsentDenied::TOTP::ContactMethodsOutdated"; - const customEvent = new CustomEvent(tag, { - detail: { - message: tag, - data: { - id_number: this.idNumber, - session_id: this.sessionId - } - } - }); - this.dispatchEvent(customEvent); - } - }; - var TotpConsentApp_default = TotpBasedConsent; - - // package.json - var version = "v1.2.3"; - - // src/js/biometric-kyc.js - (function biometricKyc() { - "use strict"; - const endpoints = { - development: "https://devapi.smileidentity.com/v1", - sandbox: "https://testapi.smileidentity.com/v1", - live: "https://api.smileidentity.com/v1", - production: "https://api.smileidentity.com/v1" - }; - const referenceWindow = window.parent; - referenceWindow.postMessage("SmileIdentity::ChildPageReady", "*"); - window.customElements.define("end-user-consent", ConsentScreen_default); - window.customElements.define("totp-consent-app", TotpConsentApp_default); - const pages = []; - let activeScreen; - let config; - let consent_information; - let EndUserConsent2; - let id_info; - let images; - let partner_params; - let productConstraints; - const LoadingScreen = document.querySelector("#loading-screen"); - const SelectIDType = document.querySelector("#select-id-type"); - const SmartCameraWeb2 = document.querySelector("smart-camera-web"); - const IDInfoForm = document.querySelector("#id-info"); - const UploadProgressScreen = document.querySelector( - "#upload-progress-screen" - ); - const UploadFailureScreen = document.querySelector("#upload-failure-screen"); - const CompleteScreen = document.querySelector("#complete-screen"); - const CloseIframeButtons = document.querySelectorAll(".close-iframe"); - const RetryUploadButton = document.querySelector("#retry-upload"); - let disableBackOnFirstScreen = false; - let fileToUpload; - let uploadURL; - function postData2(url = "", data = {}) { - return fetch(url, { - method: "POST", - mode: "cors", - cache: "no-cache", - headers: { - Accept: "application/json", - "Content-Type": "application/json" - }, - body: JSON.stringify(data) - }); - } - async function getProductConstraints() { - try { - const productsConfigPayload = { - partner_id: config.partner_details.partner_id, - token: config.token, - partner_params - }; - const productsConfigUrl = `${endpoints[config.environment]}/products_config`; - const productsConfigPromise = postData2( - productsConfigUrl, - productsConfigPayload - ); - const servicesPromise = fetch( - `${endpoints[config.environment]}/services` - ); - const [productsConfigResponse, servicesResponse] = await Promise.all([ - productsConfigPromise, - servicesPromise - ]); - if (productsConfigResponse.ok && servicesResponse.ok) { - const partnerConstraints = await productsConfigResponse.json(); - const generalConstraints = await servicesResponse.json(); - const previewBvnMfa = config.previewBVNMFA; - if (previewBvnMfa) { - generalConstraints.hosted_web.biometric_kyc.NG.id_types.BVN_MFA = { - id_number_regex: "^[0-9]{11}$", - label: "Bank Verification Number (with OTP)", - required_fields: [ - "country", - "id_type", - "session_id", - "user_id", - "job_id" - ], - test_data: "00000000000" - }; - } - return { - partnerConstraints, - generalConstraints: generalConstraints.hosted_web.biometric_kyc - }; - } - throw new Error("Failed to get supported ID types"); - } catch (e) { - throw new Error("Failed to get supported ID types", { cause: e }); - } - } - window.addEventListener( - "message", - async (event) => { - if (event.data && event.data.includes("SmileIdentity::Configuration")) { - config = JSON.parse(event.data); - activeScreen = LoadingScreen; - getPartnerParams(); - const { partnerConstraints, generalConstraints } = await getProductConstraints(); - productConstraints = generalConstraints; - initializeSession(generalConstraints, partnerConstraints); - } - }, - false - ); - function setInitialScreen(partnerConstraints) { - const { country: selectedCountry, id_type: selectedIDType } = id_info; - const selectedIdRequiresConsent = partnerConstraints.consentRequired[selectedCountry] ? partnerConstraints.consentRequired[selectedCountry].includes( - selectedIDType - ) : false; - if (selectedIdRequiresConsent || config.consent_required || config.demo_mode) { - const IDRequiresConsent = selectedIdRequiresConsent || config.consent_required && config.consent_required[selectedCountry] && config.consent_required[selectedCountry].includes(selectedIDType); - if (IDRequiresConsent || config.demo_mode) { - customizeConsentScreen(); - setActiveScreen(EndUserConsent2); - } else { - SmartCameraWeb2.setAttribute("hide-back-to-host", true); - setActiveScreen(SmartCameraWeb2); - } - } else { - SmartCameraWeb2.setAttribute("hide-back-to-host", true); - setActiveScreen(SmartCameraWeb2); - } - customizeForm(); - } - function initializeSession(generalConstraints, partnerConstraints) { - const supportedCountries = Object.keys(generalConstraints).map((countryCode) => ({ - code: countryCode, - name: generalConstraints[countryCode].name - })).sort((a, b) => { - if (a.name < b.name) { - return -1; - } - if (a.name > b.name) { - return 1; - } - return 0; - }).map((item) => item.code); - let validCountries = []; - if (config.id_selection) { - validCountries = supportedCountries.filter( - (value) => Object.keys(config.id_selection).includes(value) - ); - if (validCountries.length === 1) { - const selectedCountry = validCountries[0]; - id_info = { - country: validCountries[0] - }; - const idTypes = config.id_selection[selectedCountry]; - if (idTypes.length === 1 || typeof idTypes === "string") { - id_info.id_type = Array.isArray(idTypes) ? idTypes[0] : idTypes; - disableBackOnFirstScreen = true; - setInitialScreen(partnerConstraints); - } - } - } else { - validCountries = Object.keys( - partnerConstraints.idSelection.biometric_kyc - ); - } - if (!id_info || !id_info.id_type) { - const selectCountry = SelectIDType.querySelector("#country"); - const selectIDType = SelectIDType.querySelector("#id_type"); - const hostedWebConfigForm = document.querySelector( - 'form[name="hosted-web-config"]' - ); - selectCountry.disabled = false; - setActiveScreen(SelectIDType); - const loadIdTypes = (countryCode) => { - if (countryCode) { - const validIDTypes = config.id_selection ? config.id_selection : partnerConstraints.idSelection.biometric_kyc; - const constrainedIDTypes = Object.keys( - generalConstraints[countryCode].id_types - ); - const selectedIDTypes = validIDTypes[countryCode].filter( - (value) => constrainedIDTypes.includes(value) - ); - selectIDType.innerHTML = ""; - const initialOption = document.createElement("option"); - initialOption.setAttribute("value", ""); - initialOption.textContent = "--Please Select--"; - selectIDType.appendChild(initialOption); - selectedIDTypes.forEach((IDType) => { - const option = document.createElement("option"); - option.setAttribute("value", IDType); - option.textContent = generalConstraints[countryCode].id_types[IDType].label; - selectIDType.appendChild(option); - }); - selectIDType.disabled = false; - } else { - selectIDType.innerHTML = ""; - const option = document.createElement("option"); - option.disabled = true; - option.setAttribute("value", ""); - option.textContent = "--Select Country First--"; - selectIDType.appendChild(option); - } - }; - selectCountry.addEventListener("change", (e) => { - loadIdTypes(e.target.value); - }); - validCountries.forEach((country) => { - const countryObject = generalConstraints[country]; - if (countryObject) { - const option = document.createElement("option"); - option.setAttribute("value", country); - option.textContent = countryObject.name; - if (id_info && id_info.country && country === id_info.country) { - option.setAttribute("selected", true); - selectCountry.value = country; - selectCountry.disabled = true; - loadIdTypes(country); - } - selectCountry.appendChild(option); - } - }); - hostedWebConfigForm.addEventListener("submit", (e) => { - e.preventDefault(); - const selectedCountry = selectCountry.value; - const selectedIDType = selectIDType.value; - id_info = { - country: selectedCountry, - id_type: selectedIDType - }; - setInitialScreen(partnerConstraints); - }); - } - } - function initiateDemoMode() { - const demoTips = document.querySelectorAll(".demo-tip"); - Array.prototype.forEach.call(demoTips, (tip) => { - tip.hidden = false; - }); - const script = document.createElement("script"); - script.type = "text/javascript"; - script.src = "js/demo-ekyc-smartselfie.min.js"; - document.body.appendChild(script); - } - SmartCameraWeb2.addEventListener( - "imagesComputed", - (event) => { - images = event.detail.images; - const idRequiresTOTPConsent = ["BVN_MFA"].includes(id_info.id_type); - if (idRequiresTOTPConsent) { - handleFormSubmit(); - } else { - setActiveScreen(IDInfoForm); - } - }, - false - ); - SmartCameraWeb2.addEventListener( - "backExit", - () => { - SmartCameraWeb2.reset(); - const page = pages.pop(); - setActiveScreen(page); - }, - false - ); - SmartCameraWeb2.addEventListener( - "close", - () => { - closeWindow(true); - }, - false - ); - IDInfoForm.querySelector("#submitForm").addEventListener( - "click", - (event) => { - handleFormSubmit(event); - }, - false - ); - IDInfoForm.querySelector("#back-button").addEventListener( - "click", - (event) => { - event.preventDefault(); - const page = pages.pop(); - if (page === SmartCameraWeb2) { - page.reset(); - } - setActiveScreen(page); - }, - false - ); - RetryUploadButton.addEventListener( - "click", - () => { - retryUpload(); - }, - false - ); - CloseIframeButtons.forEach((button) => { - button.addEventListener( - "click", - () => { - closeWindow(true); - }, - false - ); - }); - function customizeConsentScreen() { - const partnerDetails = config.partner_details; - const main = document.querySelector("main"); - EndUserConsent2 = document.querySelector("end-user-consent"); - if (EndUserConsent2) { - main.removeChild(EndUserConsent2); - } - EndUserConsent2 = document.createElement("end-user-consent"); - EndUserConsent2.setAttribute( - "base-url", - endpoints[config.environment] || config.environment - ); - EndUserConsent2.setAttribute("country", id_info.country); - EndUserConsent2.setAttribute( - "id-regex", - productConstraints[id_info.country].id_types[id_info.id_type].id_number_regex - ); - EndUserConsent2.setAttribute("id-type", id_info.id_type); - EndUserConsent2.setAttribute( - "id-type-label", - productConstraints[id_info.country].id_types[id_info.id_type].label - ); - EndUserConsent2.setAttribute("partner-id", partnerDetails.partner_id); - EndUserConsent2.setAttribute("partner-name", partnerDetails.name); - EndUserConsent2.setAttribute("partner-logo", partnerDetails.logo_url); - EndUserConsent2.setAttribute("policy-url", partnerDetails.policy_url); - EndUserConsent2.setAttribute("theme-color", partnerDetails.theme_color); - EndUserConsent2.setAttribute("token", config.token); - if (disableBackOnFirstScreen) { - EndUserConsent2.setAttribute("hide-back-to-host", true); - } - if (config.demo_mode) { - EndUserConsent2.setAttribute("demo-mode", config.demo_mode); - localStorage.setItem( - "SmileIdentityConstraints", - JSON.stringify(productConstraints, null, 2) - ); - initiateDemoMode(); - } - EndUserConsent2.addEventListener( - "SmileIdentity::Exit", - () => { - setActiveScreen(SelectIDType); - }, - false - ); - EndUserConsent2.addEventListener( - "SmileIdentity::ConsentGranted", - (event) => { - consent_information = event.detail; - if (consent_information.consented.personal_details) { - id_info.consent_information = consent_information; - setActiveScreen(SmartCameraWeb2); - } - }, - false - ); - EndUserConsent2.addEventListener( - "SmileIdentity::ConsentGranted::TOTP", - (event) => { - consent_information = event.detail; - if (consent_information.consented.personal_details) { - id_info.id_number = consent_information.id_number; - id_info.session_id = consent_information.session_id; - id_info.consent_information = consent_information; - setActiveScreen(SmartCameraWeb2); - } - }, - false - ); - EndUserConsent2.addEventListener( - "SmileIdentity::ConsentDenied", - () => { - referenceWindow.postMessage("SmileIdentity::ConsentDenied", "*"); - closeWindow(); - }, - false - ); - EndUserConsent2.addEventListener( - "SmileIdentity::ConsentDenied::TOTP::ContactMethodsOutdated", - (event) => { - referenceWindow.postMessage(event.detail, "*"); - closeWindow(); - }, - false - ); - main.appendChild(EndUserConsent2); - } - function customizeForm() { - setGuideTextForIDType(); - setFormInputs(); - } - function setGuideTextForIDType() { - const label = document.querySelector('[for="id_number"]'); - const input = document.querySelector("#id_number"); - label.innerHTML = productConstraints[id_info.country].id_types[id_info.id_type].label; - input.setAttribute( - "placeholder", - productConstraints[id_info.country].id_types[id_info.id_type].test_data - ); - input.setAttribute( - "pattern", - productConstraints[id_info.country].id_types[id_info.id_type].id_number_regex - ); - } - function setFormInputs() { - const requiredFields = productConstraints[id_info.country].id_types[id_info.id_type].required_fields; - const showIdNumber = requiredFields.some( - (fieldName) => fieldName.includes("id_number") - ); - if (showIdNumber) { - const IdNumber = IDInfoForm.querySelector("div#id-number"); - IdNumber.hidden = false; - } - const showNames = requiredFields.some( - (fieldName) => fieldName.includes("name") - ); - if (showNames) { - const Names = IDInfoForm.querySelector("fieldset#names"); - Names.hidden = false; - } - const showDOB = requiredFields.some( - (fieldName) => fieldName.includes("dob") - ); - if (showDOB) { - const DOB = IDInfoForm.querySelector("fieldset#dob"); - DOB.hidden = false; - } - } - function getPartnerParams() { - function parseJWT(token) { - const base64Url = token.split(".")[1]; - const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/"); - const jsonPayload = decodeURIComponent( - atob(base64).split("").map(function(c) { - return `%${c.charCodeAt(0).toString(16)}`; - }).join("") - ); - return JSON.parse(jsonPayload); - } - const { partner_params: partnerParams } = parseJWT(config.token); - partner_params = { ...partnerParams, ...config.partner_params || {} }; - } - function setActiveScreen(node) { - activeScreen.hidden = true; - pages.push(activeScreen); - node.hidden = false; - activeScreen = node; - } - function resetForm() { - const invalidElements = IDInfoForm.querySelectorAll("[aria-invalid]"); - invalidElements.forEach((el) => el.removeAttribute("aria-invalid")); - const validationMessages = document.querySelectorAll(".validation-message"); - validationMessages.forEach((el) => el.remove()); - } - function validateInputs(payload) { - const validationConstraints = {}; - const requiredFields = productConstraints[id_info.country].id_types[id_info.id_type].required_fields; - const showIdNumber = requiredFields.some( - (fieldName) => fieldName.includes("id_number") - ); - if (showIdNumber) { - validationConstraints.id_number = { - presence: { - allowEmpty: false, - message: "is required" - }, - format: new RegExp( - productConstraints[id_info.country].id_types[id_info.id_type].id_number_regex - ) - }; - } - const showNames = requiredFields.some( - (fieldName) => fieldName.includes("name") - ); - if (showNames) { - validationConstraints.first_name = { - presence: { - allowEmpty: false, - message: "is required" - } - }; - validationConstraints.last_name = { - presence: { - allowEmpty: false, - message: "is required" - } - }; - } - const showDOB = requiredFields.some( - (fieldName) => fieldName.includes("dob") - ); - if (showDOB) { - validationConstraints.day = { - presence: { - allowEmpty: false, - message: "is required" - } - }; - validationConstraints.month = { - presence: { - allowEmpty: false, - message: "is required" - } - }; - validationConstraints.year = { - presence: { - allowEmpty: false, - message: "is required" - } - }; - } - const validation = (0, import_validate2.default)(payload, validationConstraints); - if (validation) { - handleValidationErrors(validation); - const submitButton = IDInfoForm.querySelector('[type="button"]'); - submitButton.removeAttribute("disabled"); - } - return validation; - } - function handleValidationErrors(errors) { - const fields = Object.keys(errors); - fields.forEach((field) => { - const input = IDInfoForm.querySelector(`#${field}`); - input.setAttribute("aria-invalid", "true"); - input.setAttribute("aria-describedby", `${field}-hint`); - const errorDiv = document.createElement("div"); - errorDiv.setAttribute("id", `${field}-hint`); - errorDiv.setAttribute("class", "validation-message"); - errorDiv.textContent = errors[field][0]; - input.insertAdjacentElement("afterend", errorDiv); - }); - } - async function handleFormSubmit(event) { - if (event) { - event.preventDefault(); - resetForm(); - } - const form = IDInfoForm.querySelector("form"); - const formData = new FormData(form); - const payload = Object.fromEntries(formData.entries()); - const isInvalid = validateInputs(payload); - if (isInvalid) { - return; - } - id_info = { - dob: `${payload.year}-${payload.month}-${payload.day}`, - entered: true, - ...payload, - ...id_info - }; - try { - if (event && event.target) - event.target.disabled = true; - [uploadURL, fileToUpload] = await Promise.all([ - getUploadURL(), - createZip() - ]); - uploadZip(fileToUpload, uploadURL); - if (event && event.target) - event.target.disabled = false; - } catch (error) { - if (event && event.target) - event.target.disabled = false; - displayErrorMessage("Something went wrong"); - console.error( - `SmileIdentity - ${error.name || error.message}: ${error.cause}` - ); - } - } - function displayErrorMessage(message) { - const p = document.createElement("p"); - p.textContent = message; - p.classList.add("validation-message"); - p.style.fontSize = "1.5rem"; - p.style.textAlign = "center"; - const main = document.querySelector("main"); - main.prepend(p); - } - async function createZip() { - const zip = new import_jszip.default(); - zip.file( - "info.json", - JSON.stringify({ - package_information: { - language: "Hosted Web Integration", - apiVersion: { - buildNumber: 0, - majorVersion: 2, - minorVersion: 0 - } - }, - id_info, - images - }) - ); - try { - const zipFile = await zip.generateAsync({ type: "blob" }); - return zipFile; - } catch (error) { - throw new Error("createZip failed", { cause: error }); - } - } - async function getUploadURL() { - const payload = { - source_sdk: config.sdk || "hosted_web", - source_sdk_version: config.sdk_version || version, - file_name: `${config.product}.zip`, - smile_client_id: config.partner_details.partner_id, - callback_url: config.callback_url, - token: config.token, - partner_params: { - ...partner_params, - job_type: 1 - } - }; - const URL = `${endpoints[config.environment] || config.environment}/upload`; - try { - const response = await postData2(URL, payload); - const json = await response.json(); - if (json.error) - throw new Error(json.error); - return json.upload_url; - } catch (error) { - throw new Error("getUploadURL failed", { cause: error }); - } - } - function uploadZip(file, destination) { - setActiveScreen(UploadProgressScreen); - const request = new XMLHttpRequest(); - request.open("PUT", destination); - request.upload.addEventListener("load", function() { - return request.response; - }); - request.upload.addEventListener("error", function(e) { - setActiveScreen(UploadFailureScreen); - throw new Error("uploadZip failed", { cause: e }); - }); - request.onreadystatechange = function() { - if (request.readyState === XMLHttpRequest.DONE && request.status === 200) { - const countryName = productConstraints[id_info.country].name; - const idTypeName = productConstraints[id_info.country].id_types[id_info.id_type].label; - const thankYouMessage = CompleteScreen.querySelector("#thank-you-message"); - thankYouMessage.textContent = `We will process your ${countryName} - ${idTypeName} information to verify your identity`; - setActiveScreen(CompleteScreen); - handleSuccess(); - window.setTimeout(closeWindow, 2e3); - } - if (request.readyState === XMLHttpRequest.DONE && request.status !== 200) { - setActiveScreen(UploadFailureScreen); - throw new Error("uploadZip failed", { cause: request }); - } - }; - request.setRequestHeader("Content-type", "application/zip"); - request.send(file); - } - function retryUpload() { - const fileUploaded = uploadZip(fileToUpload, uploadURL); - return fileUploaded; - } - function closeWindow(userTriggered) { - const message = userTriggered ? "SmileIdentity::Close" : "SmileIdentity::Close::System"; - referenceWindow.postMessage(message, "*"); - } - function handleSuccess() { - referenceWindow.postMessage("SmileIdentity::Success", "*"); - } - })(); -})(); -/*! Bundled license information: - -jszip/dist/jszip.min.js: - (*! - - JSZip v3.10.1 - A JavaScript class for generating and reading zip files - - - (c) 2009-2016 Stuart Knightley - Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. - - JSZip uses the library pako released under the MIT license : - https://github.com/nodeca/pako/blob/main/LICENSE - *) - -validate.js/validate.js: - (*! - * validate.js 0.13.1 - * - * (c) 2013-2019 Nicklas Ansman, 2013 Wrapp - * Validate.js may be freely distributed under the MIT license. - * For all details and documentation: - * http://validatejs.org/ - *) -*/ diff --git a/packages/embed/build/js/components/.eslintrc.cjs b/packages/embed/build/js/components/.eslintrc.cjs deleted file mode 100644 index cea670a5..00000000 --- a/packages/embed/build/js/components/.eslintrc.cjs +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - rules: { - "max-classes-per-file": 0, - }, -}; diff --git a/packages/embed/build/js/demo-ekyc-smartselfie.min.js b/packages/embed/build/js/demo-ekyc-smartselfie.min.js deleted file mode 100644 index 7ffcd1c5..00000000 --- a/packages/embed/build/js/demo-ekyc-smartselfie.min.js +++ /dev/null @@ -1,41 +0,0 @@ -(() => { - // src/js/demo-ekyc-smartselfie.js - (function eKYCSmartSelfieSandbox() { - "use strict"; - const constraints = JSON.parse( - localStorage.getItem("SmileIdentityConstraints") - ); - const country = document.querySelector("#country").value; - const IDType = document.querySelector("#id_type").value; - const sandboxPII = { - first_name: "Ciroma", - last_name: "Adekunle", - day: "01", - month: "01", - year: "1970" - }; - const { required_fields: requiredFields, test_data: testData } = constraints[country].id_types[IDType]; - requiredFields.forEach((field) => { - if (field === "country" || field === "id_type" || field === "user_id" || field === "job_id") - return; - const element = document.querySelector(`#${field}`); - if (field === "id_number") { - element.setAttribute("value", testData); - element.setAttribute("readonly", true); - } else if (field === "dob") { - const day = element.querySelector("#day"); - const month = element.querySelector("#month"); - const year = element.querySelector("#year"); - day.setAttribute("readonly", true); - day.setAttribute("value", sandboxPII.day); - month.setAttribute("readonly", true); - month.setAttribute("value", sandboxPII.month); - year.setAttribute("readonly", true); - year.setAttribute("value", sandboxPII.year); - } else { - element.setAttribute("value", sandboxPII[field]); - element.setAttribute("readonly", true); - } - }); - })(); -})(); diff --git a/packages/embed/build/js/doc-verification.min.js b/packages/embed/build/js/doc-verification.min.js deleted file mode 100644 index bc241cc1..00000000 --- a/packages/embed/build/js/doc-verification.min.js +++ /dev/null @@ -1,5423 +0,0 @@ -(() => { - var __create = Object.create; - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __getProtoOf = Object.getPrototypeOf; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { - get: (a, b) => (typeof require !== "undefined" ? require : a)[b] - }) : x)(function(x) { - if (typeof require !== "undefined") - return require.apply(this, arguments); - throw Error('Dynamic require of "' + x + '" is not supported'); - }); - var __commonJS = (cb, mod) => function __require2() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod - )); - - // ../../node_modules/jszip/dist/jszip.min.js - var require_jszip_min = __commonJS({ - "../../node_modules/jszip/dist/jszip.min.js"(exports, module) { - !function(e) { - if ("object" == typeof exports && "undefined" != typeof module) - module.exports = e(); - else if ("function" == typeof define && define.amd) - define([], e); - else { - ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).JSZip = e(); - } - }(function() { - return function s(a, o, h) { - function u(r, e2) { - if (!o[r]) { - if (!a[r]) { - var t = "function" == typeof __require && __require; - if (!e2 && t) - return t(r, true); - if (l) - return l(r, true); - var n = new Error("Cannot find module '" + r + "'"); - throw n.code = "MODULE_NOT_FOUND", n; - } - var i = o[r] = { exports: {} }; - a[r][0].call(i.exports, function(e3) { - var t2 = a[r][1][e3]; - return u(t2 || e3); - }, i, i.exports, s, a, o, h); - } - return o[r].exports; - } - for (var l = "function" == typeof __require && __require, e = 0; e < h.length; e++) - u(h[e]); - return u; - }({ 1: [function(e, t, r) { - "use strict"; - var d = e("./utils"), c = e("./support"), p = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - r.encode = function(e2) { - for (var t2, r2, n, i, s, a, o, h = [], u = 0, l = e2.length, f = l, c2 = "string" !== d.getTypeOf(e2); u < e2.length; ) - f = l - u, n = c2 ? (t2 = e2[u++], r2 = u < l ? e2[u++] : 0, u < l ? e2[u++] : 0) : (t2 = e2.charCodeAt(u++), r2 = u < l ? e2.charCodeAt(u++) : 0, u < l ? e2.charCodeAt(u++) : 0), i = t2 >> 2, s = (3 & t2) << 4 | r2 >> 4, a = 1 < f ? (15 & r2) << 2 | n >> 6 : 64, o = 2 < f ? 63 & n : 64, h.push(p.charAt(i) + p.charAt(s) + p.charAt(a) + p.charAt(o)); - return h.join(""); - }, r.decode = function(e2) { - var t2, r2, n, i, s, a, o = 0, h = 0, u = "data:"; - if (e2.substr(0, u.length) === u) - throw new Error("Invalid base64 input, it looks like a data url."); - var l, f = 3 * (e2 = e2.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4; - if (e2.charAt(e2.length - 1) === p.charAt(64) && f--, e2.charAt(e2.length - 2) === p.charAt(64) && f--, f % 1 != 0) - throw new Error("Invalid base64 input, bad content length."); - for (l = c.uint8array ? new Uint8Array(0 | f) : new Array(0 | f); o < e2.length; ) - t2 = p.indexOf(e2.charAt(o++)) << 2 | (i = p.indexOf(e2.charAt(o++))) >> 4, r2 = (15 & i) << 4 | (s = p.indexOf(e2.charAt(o++))) >> 2, n = (3 & s) << 6 | (a = p.indexOf(e2.charAt(o++))), l[h++] = t2, 64 !== s && (l[h++] = r2), 64 !== a && (l[h++] = n); - return l; - }; - }, { "./support": 30, "./utils": 32 }], 2: [function(e, t, r) { - "use strict"; - var n = e("./external"), i = e("./stream/DataWorker"), s = e("./stream/Crc32Probe"), a = e("./stream/DataLengthProbe"); - function o(e2, t2, r2, n2, i2) { - this.compressedSize = e2, this.uncompressedSize = t2, this.crc32 = r2, this.compression = n2, this.compressedContent = i2; - } - o.prototype = { getContentWorker: function() { - var e2 = new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")), t2 = this; - return e2.on("end", function() { - if (this.streamInfo.data_length !== t2.uncompressedSize) - throw new Error("Bug : uncompressed data size mismatch"); - }), e2; - }, getCompressedWorker: function() { - return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression); - } }, o.createWorkerFrom = function(e2, t2, r2) { - return e2.pipe(new s()).pipe(new a("uncompressedSize")).pipe(t2.compressWorker(r2)).pipe(new a("compressedSize")).withStreamInfo("compression", t2); - }, t.exports = o; - }, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function(e, t, r) { - "use strict"; - var n = e("./stream/GenericWorker"); - r.STORE = { magic: "\0\0", compressWorker: function() { - return new n("STORE compression"); - }, uncompressWorker: function() { - return new n("STORE decompression"); - } }, r.DEFLATE = e("./flate"); - }, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function(e, t, r) { - "use strict"; - var n = e("./utils"); - var o = function() { - for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) { - e2 = r2; - for (var n2 = 0; n2 < 8; n2++) - e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1; - t2[r2] = e2; - } - return t2; - }(); - t.exports = function(e2, t2) { - return void 0 !== e2 && e2.length ? "string" !== n.getTypeOf(e2) ? function(e3, t3, r2, n2) { - var i = o, s = n2 + r2; - e3 ^= -1; - for (var a = n2; a < s; a++) - e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3[a])]; - return -1 ^ e3; - }(0 | t2, e2, e2.length, 0) : function(e3, t3, r2, n2) { - var i = o, s = n2 + r2; - e3 ^= -1; - for (var a = n2; a < s; a++) - e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3.charCodeAt(a))]; - return -1 ^ e3; - }(0 | t2, e2, e2.length, 0) : 0; - }; - }, { "./utils": 32 }], 5: [function(e, t, r) { - "use strict"; - r.base64 = false, r.binary = false, r.dir = false, r.createFolders = true, r.date = null, r.compression = null, r.compressionOptions = null, r.comment = null, r.unixPermissions = null, r.dosPermissions = null; - }, {}], 6: [function(e, t, r) { - "use strict"; - var n = null; - n = "undefined" != typeof Promise ? Promise : e("lie"), t.exports = { Promise: n }; - }, { lie: 37 }], 7: [function(e, t, r) { - "use strict"; - var n = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array, i = e("pako"), s = e("./utils"), a = e("./stream/GenericWorker"), o = n ? "uint8array" : "array"; - function h(e2, t2) { - a.call(this, "FlateWorker/" + e2), this._pako = null, this._pakoAction = e2, this._pakoOptions = t2, this.meta = {}; - } - r.magic = "\b\0", s.inherits(h, a), h.prototype.processChunk = function(e2) { - this.meta = e2.meta, null === this._pako && this._createPako(), this._pako.push(s.transformTo(o, e2.data), false); - }, h.prototype.flush = function() { - a.prototype.flush.call(this), null === this._pako && this._createPako(), this._pako.push([], true); - }, h.prototype.cleanUp = function() { - a.prototype.cleanUp.call(this), this._pako = null; - }, h.prototype._createPako = function() { - this._pako = new i[this._pakoAction]({ raw: true, level: this._pakoOptions.level || -1 }); - var t2 = this; - this._pako.onData = function(e2) { - t2.push({ data: e2, meta: t2.meta }); - }; - }, r.compressWorker = function(e2) { - return new h("Deflate", e2); - }, r.uncompressWorker = function() { - return new h("Inflate", {}); - }; - }, { "./stream/GenericWorker": 28, "./utils": 32, pako: 38 }], 8: [function(e, t, r) { - "use strict"; - function A(e2, t2) { - var r2, n2 = ""; - for (r2 = 0; r2 < t2; r2++) - n2 += String.fromCharCode(255 & e2), e2 >>>= 8; - return n2; - } - function n(e2, t2, r2, n2, i2, s2) { - var a, o, h = e2.file, u = e2.compression, l = s2 !== O.utf8encode, f = I.transformTo("string", s2(h.name)), c = I.transformTo("string", O.utf8encode(h.name)), d = h.comment, p = I.transformTo("string", s2(d)), m = I.transformTo("string", O.utf8encode(d)), _ = c.length !== h.name.length, g = m.length !== d.length, b = "", v = "", y = "", w = h.dir, k = h.date, x = { crc32: 0, compressedSize: 0, uncompressedSize: 0 }; - t2 && !r2 || (x.crc32 = e2.crc32, x.compressedSize = e2.compressedSize, x.uncompressedSize = e2.uncompressedSize); - var S = 0; - t2 && (S |= 8), l || !_ && !g || (S |= 2048); - var z = 0, C = 0; - w && (z |= 16), "UNIX" === i2 ? (C = 798, z |= function(e3, t3) { - var r3 = e3; - return e3 || (r3 = t3 ? 16893 : 33204), (65535 & r3) << 16; - }(h.unixPermissions, w)) : (C = 20, z |= function(e3) { - return 63 & (e3 || 0); - }(h.dosPermissions)), a = k.getUTCHours(), a <<= 6, a |= k.getUTCMinutes(), a <<= 5, a |= k.getUTCSeconds() / 2, o = k.getUTCFullYear() - 1980, o <<= 4, o |= k.getUTCMonth() + 1, o <<= 5, o |= k.getUTCDate(), _ && (v = A(1, 1) + A(B(f), 4) + c, b += "up" + A(v.length, 2) + v), g && (y = A(1, 1) + A(B(p), 4) + m, b += "uc" + A(y.length, 2) + y); - var E = ""; - return E += "\n\0", E += A(S, 2), E += u.magic, E += A(a, 2), E += A(o, 2), E += A(x.crc32, 4), E += A(x.compressedSize, 4), E += A(x.uncompressedSize, 4), E += A(f.length, 2), E += A(b.length, 2), { fileRecord: R.LOCAL_FILE_HEADER + E + f + b, dirRecord: R.CENTRAL_FILE_HEADER + A(C, 2) + E + A(p.length, 2) + "\0\0\0\0" + A(z, 4) + A(n2, 4) + f + b + p }; - } - var I = e("../utils"), i = e("../stream/GenericWorker"), O = e("../utf8"), B = e("../crc32"), R = e("../signature"); - function s(e2, t2, r2, n2) { - i.call(this, "ZipFileWorker"), this.bytesWritten = 0, this.zipComment = t2, this.zipPlatform = r2, this.encodeFileName = n2, this.streamFiles = e2, this.accumulate = false, this.contentBuffer = [], this.dirRecords = [], this.currentSourceOffset = 0, this.entriesCount = 0, this.currentFile = null, this._sources = []; - } - I.inherits(s, i), s.prototype.push = function(e2) { - var t2 = e2.meta.percent || 0, r2 = this.entriesCount, n2 = this._sources.length; - this.accumulate ? this.contentBuffer.push(e2) : (this.bytesWritten += e2.data.length, i.prototype.push.call(this, { data: e2.data, meta: { currentFile: this.currentFile, percent: r2 ? (t2 + 100 * (r2 - n2 - 1)) / r2 : 100 } })); - }, s.prototype.openedSource = function(e2) { - this.currentSourceOffset = this.bytesWritten, this.currentFile = e2.file.name; - var t2 = this.streamFiles && !e2.file.dir; - if (t2) { - var r2 = n(e2, t2, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); - this.push({ data: r2.fileRecord, meta: { percent: 0 } }); - } else - this.accumulate = true; - }, s.prototype.closedSource = function(e2) { - this.accumulate = false; - var t2 = this.streamFiles && !e2.file.dir, r2 = n(e2, t2, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); - if (this.dirRecords.push(r2.dirRecord), t2) - this.push({ data: function(e3) { - return R.DATA_DESCRIPTOR + A(e3.crc32, 4) + A(e3.compressedSize, 4) + A(e3.uncompressedSize, 4); - }(e2), meta: { percent: 100 } }); - else - for (this.push({ data: r2.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length; ) - this.push(this.contentBuffer.shift()); - this.currentFile = null; - }, s.prototype.flush = function() { - for (var e2 = this.bytesWritten, t2 = 0; t2 < this.dirRecords.length; t2++) - this.push({ data: this.dirRecords[t2], meta: { percent: 100 } }); - var r2 = this.bytesWritten - e2, n2 = function(e3, t3, r3, n3, i2) { - var s2 = I.transformTo("string", i2(n3)); - return R.CENTRAL_DIRECTORY_END + "\0\0\0\0" + A(e3, 2) + A(e3, 2) + A(t3, 4) + A(r3, 4) + A(s2.length, 2) + s2; - }(this.dirRecords.length, r2, e2, this.zipComment, this.encodeFileName); - this.push({ data: n2, meta: { percent: 100 } }); - }, s.prototype.prepareNextSource = function() { - this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume(); - }, s.prototype.registerPrevious = function(e2) { - this._sources.push(e2); - var t2 = this; - return e2.on("data", function(e3) { - t2.processChunk(e3); - }), e2.on("end", function() { - t2.closedSource(t2.previous.streamInfo), t2._sources.length ? t2.prepareNextSource() : t2.end(); - }), e2.on("error", function(e3) { - t2.error(e3); - }), this; - }, s.prototype.resume = function() { - return !!i.prototype.resume.call(this) && (!this.previous && this._sources.length ? (this.prepareNextSource(), true) : this.previous || this._sources.length || this.generatedError ? void 0 : (this.end(), true)); - }, s.prototype.error = function(e2) { - var t2 = this._sources; - if (!i.prototype.error.call(this, e2)) - return false; - for (var r2 = 0; r2 < t2.length; r2++) - try { - t2[r2].error(e2); - } catch (e3) { - } - return true; - }, s.prototype.lock = function() { - i.prototype.lock.call(this); - for (var e2 = this._sources, t2 = 0; t2 < e2.length; t2++) - e2[t2].lock(); - }, t.exports = s; - }, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function(e, t, r) { - "use strict"; - var u = e("../compressions"), n = e("./ZipFileWorker"); - r.generateWorker = function(e2, a, t2) { - var o = new n(a.streamFiles, t2, a.platform, a.encodeFileName), h = 0; - try { - e2.forEach(function(e3, t3) { - h++; - var r2 = function(e4, t4) { - var r3 = e4 || t4, n3 = u[r3]; - if (!n3) - throw new Error(r3 + " is not a valid compression method !"); - return n3; - }(t3.options.compression, a.compression), n2 = t3.options.compressionOptions || a.compressionOptions || {}, i = t3.dir, s = t3.date; - t3._compressWorker(r2, n2).withStreamInfo("file", { name: e3, dir: i, date: s, comment: t3.comment || "", unixPermissions: t3.unixPermissions, dosPermissions: t3.dosPermissions }).pipe(o); - }), o.entriesCount = h; - } catch (e3) { - o.error(e3); - } - return o; - }; - }, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function(e, t, r) { - "use strict"; - function n() { - if (!(this instanceof n)) - return new n(); - if (arguments.length) - throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide."); - this.files = /* @__PURE__ */ Object.create(null), this.comment = null, this.root = "", this.clone = function() { - var e2 = new n(); - for (var t2 in this) - "function" != typeof this[t2] && (e2[t2] = this[t2]); - return e2; - }; - } - (n.prototype = e("./object")).loadAsync = e("./load"), n.support = e("./support"), n.defaults = e("./defaults"), n.version = "3.10.1", n.loadAsync = function(e2, t2) { - return new n().loadAsync(e2, t2); - }, n.external = e("./external"), t.exports = n; - }, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function(e, t, r) { - "use strict"; - var u = e("./utils"), i = e("./external"), n = e("./utf8"), s = e("./zipEntries"), a = e("./stream/Crc32Probe"), l = e("./nodejsUtils"); - function f(n2) { - return new i.Promise(function(e2, t2) { - var r2 = n2.decompressed.getContentWorker().pipe(new a()); - r2.on("error", function(e3) { - t2(e3); - }).on("end", function() { - r2.streamInfo.crc32 !== n2.decompressed.crc32 ? t2(new Error("Corrupted zip : CRC32 mismatch")) : e2(); - }).resume(); - }); - } - t.exports = function(e2, o) { - var h = this; - return o = u.extend(o || {}, { base64: false, checkCRC32: false, optimizedBinaryString: false, createFolders: false, decodeFileName: n.utf8decode }), l.isNode && l.isStream(e2) ? i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")) : u.prepareContent("the loaded zip file", e2, true, o.optimizedBinaryString, o.base64).then(function(e3) { - var t2 = new s(o); - return t2.load(e3), t2; - }).then(function(e3) { - var t2 = [i.Promise.resolve(e3)], r2 = e3.files; - if (o.checkCRC32) - for (var n2 = 0; n2 < r2.length; n2++) - t2.push(f(r2[n2])); - return i.Promise.all(t2); - }).then(function(e3) { - for (var t2 = e3.shift(), r2 = t2.files, n2 = 0; n2 < r2.length; n2++) { - var i2 = r2[n2], s2 = i2.fileNameStr, a2 = u.resolve(i2.fileNameStr); - h.file(a2, i2.decompressed, { binary: true, optimizedBinaryString: true, date: i2.date, dir: i2.dir, comment: i2.fileCommentStr.length ? i2.fileCommentStr : null, unixPermissions: i2.unixPermissions, dosPermissions: i2.dosPermissions, createFolders: o.createFolders }), i2.dir || (h.file(a2).unsafeOriginalName = s2); - } - return t2.zipComment.length && (h.comment = t2.zipComment), h; - }); - }; - }, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function(e, t, r) { - "use strict"; - var n = e("../utils"), i = e("../stream/GenericWorker"); - function s(e2, t2) { - i.call(this, "Nodejs stream input adapter for " + e2), this._upstreamEnded = false, this._bindStream(t2); - } - n.inherits(s, i), s.prototype._bindStream = function(e2) { - var t2 = this; - (this._stream = e2).pause(), e2.on("data", function(e3) { - t2.push({ data: e3, meta: { percent: 0 } }); - }).on("error", function(e3) { - t2.isPaused ? this.generatedError = e3 : t2.error(e3); - }).on("end", function() { - t2.isPaused ? t2._upstreamEnded = true : t2.end(); - }); - }, s.prototype.pause = function() { - return !!i.prototype.pause.call(this) && (this._stream.pause(), true); - }, s.prototype.resume = function() { - return !!i.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), true); - }, t.exports = s; - }, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function(e, t, r) { - "use strict"; - var i = e("readable-stream").Readable; - function n(e2, t2, r2) { - i.call(this, t2), this._helper = e2; - var n2 = this; - e2.on("data", function(e3, t3) { - n2.push(e3) || n2._helper.pause(), r2 && r2(t3); - }).on("error", function(e3) { - n2.emit("error", e3); - }).on("end", function() { - n2.push(null); - }); - } - e("../utils").inherits(n, i), n.prototype._read = function() { - this._helper.resume(); - }, t.exports = n; - }, { "../utils": 32, "readable-stream": 16 }], 14: [function(e, t, r) { - "use strict"; - t.exports = { isNode: "undefined" != typeof Buffer, newBufferFrom: function(e2, t2) { - if (Buffer.from && Buffer.from !== Uint8Array.from) - return Buffer.from(e2, t2); - if ("number" == typeof e2) - throw new Error('The "data" argument must not be a number'); - return new Buffer(e2, t2); - }, allocBuffer: function(e2) { - if (Buffer.alloc) - return Buffer.alloc(e2); - var t2 = new Buffer(e2); - return t2.fill(0), t2; - }, isBuffer: function(e2) { - return Buffer.isBuffer(e2); - }, isStream: function(e2) { - return e2 && "function" == typeof e2.on && "function" == typeof e2.pause && "function" == typeof e2.resume; - } }; - }, {}], 15: [function(e, t, r) { - "use strict"; - function s(e2, t2, r2) { - var n2, i2 = u.getTypeOf(t2), s2 = u.extend(r2 || {}, f); - s2.date = s2.date || /* @__PURE__ */ new Date(), null !== s2.compression && (s2.compression = s2.compression.toUpperCase()), "string" == typeof s2.unixPermissions && (s2.unixPermissions = parseInt(s2.unixPermissions, 8)), s2.unixPermissions && 16384 & s2.unixPermissions && (s2.dir = true), s2.dosPermissions && 16 & s2.dosPermissions && (s2.dir = true), s2.dir && (e2 = g(e2)), s2.createFolders && (n2 = _(e2)) && b.call(this, n2, true); - var a2 = "string" === i2 && false === s2.binary && false === s2.base64; - r2 && void 0 !== r2.binary || (s2.binary = !a2), (t2 instanceof c && 0 === t2.uncompressedSize || s2.dir || !t2 || 0 === t2.length) && (s2.base64 = false, s2.binary = true, t2 = "", s2.compression = "STORE", i2 = "string"); - var o2 = null; - o2 = t2 instanceof c || t2 instanceof l ? t2 : p.isNode && p.isStream(t2) ? new m(e2, t2) : u.prepareContent(e2, t2, s2.binary, s2.optimizedBinaryString, s2.base64); - var h2 = new d(e2, o2, s2); - this.files[e2] = h2; - } - var i = e("./utf8"), u = e("./utils"), l = e("./stream/GenericWorker"), a = e("./stream/StreamHelper"), f = e("./defaults"), c = e("./compressedObject"), d = e("./zipObject"), o = e("./generate"), p = e("./nodejsUtils"), m = e("./nodejs/NodejsStreamInputAdapter"), _ = function(e2) { - "/" === e2.slice(-1) && (e2 = e2.substring(0, e2.length - 1)); - var t2 = e2.lastIndexOf("/"); - return 0 < t2 ? e2.substring(0, t2) : ""; - }, g = function(e2) { - return "/" !== e2.slice(-1) && (e2 += "/"), e2; - }, b = function(e2, t2) { - return t2 = void 0 !== t2 ? t2 : f.createFolders, e2 = g(e2), this.files[e2] || s.call(this, e2, null, { dir: true, createFolders: t2 }), this.files[e2]; - }; - function h(e2) { - return "[object RegExp]" === Object.prototype.toString.call(e2); - } - var n = { load: function() { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); - }, forEach: function(e2) { - var t2, r2, n2; - for (t2 in this.files) - n2 = this.files[t2], (r2 = t2.slice(this.root.length, t2.length)) && t2.slice(0, this.root.length) === this.root && e2(r2, n2); - }, filter: function(r2) { - var n2 = []; - return this.forEach(function(e2, t2) { - r2(e2, t2) && n2.push(t2); - }), n2; - }, file: function(e2, t2, r2) { - if (1 !== arguments.length) - return e2 = this.root + e2, s.call(this, e2, t2, r2), this; - if (h(e2)) { - var n2 = e2; - return this.filter(function(e3, t3) { - return !t3.dir && n2.test(e3); - }); - } - var i2 = this.files[this.root + e2]; - return i2 && !i2.dir ? i2 : null; - }, folder: function(r2) { - if (!r2) - return this; - if (h(r2)) - return this.filter(function(e3, t3) { - return t3.dir && r2.test(e3); - }); - var e2 = this.root + r2, t2 = b.call(this, e2), n2 = this.clone(); - return n2.root = t2.name, n2; - }, remove: function(r2) { - r2 = this.root + r2; - var e2 = this.files[r2]; - if (e2 || ("/" !== r2.slice(-1) && (r2 += "/"), e2 = this.files[r2]), e2 && !e2.dir) - delete this.files[r2]; - else - for (var t2 = this.filter(function(e3, t3) { - return t3.name.slice(0, r2.length) === r2; - }), n2 = 0; n2 < t2.length; n2++) - delete this.files[t2[n2].name]; - return this; - }, generate: function() { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); - }, generateInternalStream: function(e2) { - var t2, r2 = {}; - try { - if ((r2 = u.extend(e2 || {}, { streamFiles: false, compression: "STORE", compressionOptions: null, type: "", platform: "DOS", comment: null, mimeType: "application/zip", encodeFileName: i.utf8encode })).type = r2.type.toLowerCase(), r2.compression = r2.compression.toUpperCase(), "binarystring" === r2.type && (r2.type = "string"), !r2.type) - throw new Error("No output type specified."); - u.checkSupport(r2.type), "darwin" !== r2.platform && "freebsd" !== r2.platform && "linux" !== r2.platform && "sunos" !== r2.platform || (r2.platform = "UNIX"), "win32" === r2.platform && (r2.platform = "DOS"); - var n2 = r2.comment || this.comment || ""; - t2 = o.generateWorker(this, r2, n2); - } catch (e3) { - (t2 = new l("error")).error(e3); - } - return new a(t2, r2.type || "string", r2.mimeType); - }, generateAsync: function(e2, t2) { - return this.generateInternalStream(e2).accumulate(t2); - }, generateNodeStream: function(e2, t2) { - return (e2 = e2 || {}).type || (e2.type = "nodebuffer"), this.generateInternalStream(e2).toNodejsStream(t2); - } }; - t.exports = n; - }, { "./compressedObject": 2, "./defaults": 5, "./generate": 9, "./nodejs/NodejsStreamInputAdapter": 12, "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31, "./utils": 32, "./zipObject": 35 }], 16: [function(e, t, r) { - "use strict"; - t.exports = e("stream"); - }, { stream: void 0 }], 17: [function(e, t, r) { - "use strict"; - var n = e("./DataReader"); - function i(e2) { - n.call(this, e2); - for (var t2 = 0; t2 < this.data.length; t2++) - e2[t2] = 255 & e2[t2]; - } - e("../utils").inherits(i, n), i.prototype.byteAt = function(e2) { - return this.data[this.zero + e2]; - }, i.prototype.lastIndexOfSignature = function(e2) { - for (var t2 = e2.charCodeAt(0), r2 = e2.charCodeAt(1), n2 = e2.charCodeAt(2), i2 = e2.charCodeAt(3), s = this.length - 4; 0 <= s; --s) - if (this.data[s] === t2 && this.data[s + 1] === r2 && this.data[s + 2] === n2 && this.data[s + 3] === i2) - return s - this.zero; - return -1; - }, i.prototype.readAndCheckSignature = function(e2) { - var t2 = e2.charCodeAt(0), r2 = e2.charCodeAt(1), n2 = e2.charCodeAt(2), i2 = e2.charCodeAt(3), s = this.readData(4); - return t2 === s[0] && r2 === s[1] && n2 === s[2] && i2 === s[3]; - }, i.prototype.readData = function(e2) { - if (this.checkOffset(e2), 0 === e2) - return []; - var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2); - return this.index += e2, t2; - }, t.exports = i; - }, { "../utils": 32, "./DataReader": 18 }], 18: [function(e, t, r) { - "use strict"; - var n = e("../utils"); - function i(e2) { - this.data = e2, this.length = e2.length, this.index = 0, this.zero = 0; - } - i.prototype = { checkOffset: function(e2) { - this.checkIndex(this.index + e2); - }, checkIndex: function(e2) { - if (this.length < this.zero + e2 || e2 < 0) - throw new Error("End of data reached (data length = " + this.length + ", asked index = " + e2 + "). Corrupted zip ?"); - }, setIndex: function(e2) { - this.checkIndex(e2), this.index = e2; - }, skip: function(e2) { - this.setIndex(this.index + e2); - }, byteAt: function() { - }, readInt: function(e2) { - var t2, r2 = 0; - for (this.checkOffset(e2), t2 = this.index + e2 - 1; t2 >= this.index; t2--) - r2 = (r2 << 8) + this.byteAt(t2); - return this.index += e2, r2; - }, readString: function(e2) { - return n.transformTo("string", this.readData(e2)); - }, readData: function() { - }, lastIndexOfSignature: function() { - }, readAndCheckSignature: function() { - }, readDate: function() { - var e2 = this.readInt(4); - return new Date(Date.UTC(1980 + (e2 >> 25 & 127), (e2 >> 21 & 15) - 1, e2 >> 16 & 31, e2 >> 11 & 31, e2 >> 5 & 63, (31 & e2) << 1)); - } }, t.exports = i; - }, { "../utils": 32 }], 19: [function(e, t, r) { - "use strict"; - var n = e("./Uint8ArrayReader"); - function i(e2) { - n.call(this, e2); - } - e("../utils").inherits(i, n), i.prototype.readData = function(e2) { - this.checkOffset(e2); - var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2); - return this.index += e2, t2; - }, t.exports = i; - }, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function(e, t, r) { - "use strict"; - var n = e("./DataReader"); - function i(e2) { - n.call(this, e2); - } - e("../utils").inherits(i, n), i.prototype.byteAt = function(e2) { - return this.data.charCodeAt(this.zero + e2); - }, i.prototype.lastIndexOfSignature = function(e2) { - return this.data.lastIndexOf(e2) - this.zero; - }, i.prototype.readAndCheckSignature = function(e2) { - return e2 === this.readData(4); - }, i.prototype.readData = function(e2) { - this.checkOffset(e2); - var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2); - return this.index += e2, t2; - }, t.exports = i; - }, { "../utils": 32, "./DataReader": 18 }], 21: [function(e, t, r) { - "use strict"; - var n = e("./ArrayReader"); - function i(e2) { - n.call(this, e2); - } - e("../utils").inherits(i, n), i.prototype.readData = function(e2) { - if (this.checkOffset(e2), 0 === e2) - return new Uint8Array(0); - var t2 = this.data.subarray(this.zero + this.index, this.zero + this.index + e2); - return this.index += e2, t2; - }, t.exports = i; - }, { "../utils": 32, "./ArrayReader": 17 }], 22: [function(e, t, r) { - "use strict"; - var n = e("../utils"), i = e("../support"), s = e("./ArrayReader"), a = e("./StringReader"), o = e("./NodeBufferReader"), h = e("./Uint8ArrayReader"); - t.exports = function(e2) { - var t2 = n.getTypeOf(e2); - return n.checkSupport(t2), "string" !== t2 || i.uint8array ? "nodebuffer" === t2 ? new o(e2) : i.uint8array ? new h(n.transformTo("uint8array", e2)) : new s(n.transformTo("array", e2)) : new a(e2); - }; - }, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function(e, t, r) { - "use strict"; - r.LOCAL_FILE_HEADER = "PK", r.CENTRAL_FILE_HEADER = "PK", r.CENTRAL_DIRECTORY_END = "PK", r.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x07", r.ZIP64_CENTRAL_DIRECTORY_END = "PK", r.DATA_DESCRIPTOR = "PK\x07\b"; - }, {}], 24: [function(e, t, r) { - "use strict"; - var n = e("./GenericWorker"), i = e("../utils"); - function s(e2) { - n.call(this, "ConvertWorker to " + e2), this.destType = e2; - } - i.inherits(s, n), s.prototype.processChunk = function(e2) { - this.push({ data: i.transformTo(this.destType, e2.data), meta: e2.meta }); - }, t.exports = s; - }, { "../utils": 32, "./GenericWorker": 28 }], 25: [function(e, t, r) { - "use strict"; - var n = e("./GenericWorker"), i = e("../crc32"); - function s() { - n.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0); - } - e("../utils").inherits(s, n), s.prototype.processChunk = function(e2) { - this.streamInfo.crc32 = i(e2.data, this.streamInfo.crc32 || 0), this.push(e2); - }, t.exports = s; - }, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function(e, t, r) { - "use strict"; - var n = e("../utils"), i = e("./GenericWorker"); - function s(e2) { - i.call(this, "DataLengthProbe for " + e2), this.propName = e2, this.withStreamInfo(e2, 0); - } - n.inherits(s, i), s.prototype.processChunk = function(e2) { - if (e2) { - var t2 = this.streamInfo[this.propName] || 0; - this.streamInfo[this.propName] = t2 + e2.data.length; - } - i.prototype.processChunk.call(this, e2); - }, t.exports = s; - }, { "../utils": 32, "./GenericWorker": 28 }], 27: [function(e, t, r) { - "use strict"; - var n = e("../utils"), i = e("./GenericWorker"); - function s(e2) { - i.call(this, "DataWorker"); - var t2 = this; - this.dataIsReady = false, this.index = 0, this.max = 0, this.data = null, this.type = "", this._tickScheduled = false, e2.then(function(e3) { - t2.dataIsReady = true, t2.data = e3, t2.max = e3 && e3.length || 0, t2.type = n.getTypeOf(e3), t2.isPaused || t2._tickAndRepeat(); - }, function(e3) { - t2.error(e3); - }); - } - n.inherits(s, i), s.prototype.cleanUp = function() { - i.prototype.cleanUp.call(this), this.data = null; - }, s.prototype.resume = function() { - return !!i.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = true, n.delay(this._tickAndRepeat, [], this)), true); - }, s.prototype._tickAndRepeat = function() { - this._tickScheduled = false, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (n.delay(this._tickAndRepeat, [], this), this._tickScheduled = true)); - }, s.prototype._tick = function() { - if (this.isPaused || this.isFinished) - return false; - var e2 = null, t2 = Math.min(this.max, this.index + 16384); - if (this.index >= this.max) - return this.end(); - switch (this.type) { - case "string": - e2 = this.data.substring(this.index, t2); - break; - case "uint8array": - e2 = this.data.subarray(this.index, t2); - break; - case "array": - case "nodebuffer": - e2 = this.data.slice(this.index, t2); - } - return this.index = t2, this.push({ data: e2, meta: { percent: this.max ? this.index / this.max * 100 : 0 } }); - }, t.exports = s; - }, { "../utils": 32, "./GenericWorker": 28 }], 28: [function(e, t, r) { - "use strict"; - function n(e2) { - this.name = e2 || "default", this.streamInfo = {}, this.generatedError = null, this.extraStreamInfo = {}, this.isPaused = true, this.isFinished = false, this.isLocked = false, this._listeners = { data: [], end: [], error: [] }, this.previous = null; - } - n.prototype = { push: function(e2) { - this.emit("data", e2); - }, end: function() { - if (this.isFinished) - return false; - this.flush(); - try { - this.emit("end"), this.cleanUp(), this.isFinished = true; - } catch (e2) { - this.emit("error", e2); - } - return true; - }, error: function(e2) { - return !this.isFinished && (this.isPaused ? this.generatedError = e2 : (this.isFinished = true, this.emit("error", e2), this.previous && this.previous.error(e2), this.cleanUp()), true); - }, on: function(e2, t2) { - return this._listeners[e2].push(t2), this; - }, cleanUp: function() { - this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = []; - }, emit: function(e2, t2) { - if (this._listeners[e2]) - for (var r2 = 0; r2 < this._listeners[e2].length; r2++) - this._listeners[e2][r2].call(this, t2); - }, pipe: function(e2) { - return e2.registerPrevious(this); - }, registerPrevious: function(e2) { - if (this.isLocked) - throw new Error("The stream '" + this + "' has already been used."); - this.streamInfo = e2.streamInfo, this.mergeStreamInfo(), this.previous = e2; - var t2 = this; - return e2.on("data", function(e3) { - t2.processChunk(e3); - }), e2.on("end", function() { - t2.end(); - }), e2.on("error", function(e3) { - t2.error(e3); - }), this; - }, pause: function() { - return !this.isPaused && !this.isFinished && (this.isPaused = true, this.previous && this.previous.pause(), true); - }, resume: function() { - if (!this.isPaused || this.isFinished) - return false; - var e2 = this.isPaused = false; - return this.generatedError && (this.error(this.generatedError), e2 = true), this.previous && this.previous.resume(), !e2; - }, flush: function() { - }, processChunk: function(e2) { - this.push(e2); - }, withStreamInfo: function(e2, t2) { - return this.extraStreamInfo[e2] = t2, this.mergeStreamInfo(), this; - }, mergeStreamInfo: function() { - for (var e2 in this.extraStreamInfo) - Object.prototype.hasOwnProperty.call(this.extraStreamInfo, e2) && (this.streamInfo[e2] = this.extraStreamInfo[e2]); - }, lock: function() { - if (this.isLocked) - throw new Error("The stream '" + this + "' has already been used."); - this.isLocked = true, this.previous && this.previous.lock(); - }, toString: function() { - var e2 = "Worker " + this.name; - return this.previous ? this.previous + " -> " + e2 : e2; - } }, t.exports = n; - }, {}], 29: [function(e, t, r) { - "use strict"; - var h = e("../utils"), i = e("./ConvertWorker"), s = e("./GenericWorker"), u = e("../base64"), n = e("../support"), a = e("../external"), o = null; - if (n.nodestream) - try { - o = e("../nodejs/NodejsStreamOutputAdapter"); - } catch (e2) { - } - function l(e2, o2) { - return new a.Promise(function(t2, r2) { - var n2 = [], i2 = e2._internalType, s2 = e2._outputType, a2 = e2._mimeType; - e2.on("data", function(e3, t3) { - n2.push(e3), o2 && o2(t3); - }).on("error", function(e3) { - n2 = [], r2(e3); - }).on("end", function() { - try { - var e3 = function(e4, t3, r3) { - switch (e4) { - case "blob": - return h.newBlob(h.transformTo("arraybuffer", t3), r3); - case "base64": - return u.encode(t3); - default: - return h.transformTo(e4, t3); - } - }(s2, function(e4, t3) { - var r3, n3 = 0, i3 = null, s3 = 0; - for (r3 = 0; r3 < t3.length; r3++) - s3 += t3[r3].length; - switch (e4) { - case "string": - return t3.join(""); - case "array": - return Array.prototype.concat.apply([], t3); - case "uint8array": - for (i3 = new Uint8Array(s3), r3 = 0; r3 < t3.length; r3++) - i3.set(t3[r3], n3), n3 += t3[r3].length; - return i3; - case "nodebuffer": - return Buffer.concat(t3); - default: - throw new Error("concat : unsupported type '" + e4 + "'"); - } - }(i2, n2), a2); - t2(e3); - } catch (e4) { - r2(e4); - } - n2 = []; - }).resume(); - }); - } - function f(e2, t2, r2) { - var n2 = t2; - switch (t2) { - case "blob": - case "arraybuffer": - n2 = "uint8array"; - break; - case "base64": - n2 = "string"; - } - try { - this._internalType = n2, this._outputType = t2, this._mimeType = r2, h.checkSupport(n2), this._worker = e2.pipe(new i(n2)), e2.lock(); - } catch (e3) { - this._worker = new s("error"), this._worker.error(e3); - } - } - f.prototype = { accumulate: function(e2) { - return l(this, e2); - }, on: function(e2, t2) { - var r2 = this; - return "data" === e2 ? this._worker.on(e2, function(e3) { - t2.call(r2, e3.data, e3.meta); - }) : this._worker.on(e2, function() { - h.delay(t2, arguments, r2); - }), this; - }, resume: function() { - return h.delay(this._worker.resume, [], this._worker), this; - }, pause: function() { - return this._worker.pause(), this; - }, toNodejsStream: function(e2) { - if (h.checkSupport("nodestream"), "nodebuffer" !== this._outputType) - throw new Error(this._outputType + " is not supported by this method"); - return new o(this, { objectMode: "nodebuffer" !== this._outputType }, e2); - } }, t.exports = f; - }, { "../base64": 1, "../external": 6, "../nodejs/NodejsStreamOutputAdapter": 13, "../support": 30, "../utils": 32, "./ConvertWorker": 24, "./GenericWorker": 28 }], 30: [function(e, t, r) { - "use strict"; - if (r.base64 = true, r.array = true, r.string = true, r.arraybuffer = "undefined" != typeof ArrayBuffer && "undefined" != typeof Uint8Array, r.nodebuffer = "undefined" != typeof Buffer, r.uint8array = "undefined" != typeof Uint8Array, "undefined" == typeof ArrayBuffer) - r.blob = false; - else { - var n = new ArrayBuffer(0); - try { - r.blob = 0 === new Blob([n], { type: "application/zip" }).size; - } catch (e2) { - try { - var i = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)(); - i.append(n), r.blob = 0 === i.getBlob("application/zip").size; - } catch (e3) { - r.blob = false; - } - } - } - try { - r.nodestream = !!e("readable-stream").Readable; - } catch (e2) { - r.nodestream = false; - } - }, { "readable-stream": 16 }], 31: [function(e, t, s) { - "use strict"; - for (var o = e("./utils"), h = e("./support"), r = e("./nodejsUtils"), n = e("./stream/GenericWorker"), u = new Array(256), i = 0; i < 256; i++) - u[i] = 252 <= i ? 6 : 248 <= i ? 5 : 240 <= i ? 4 : 224 <= i ? 3 : 192 <= i ? 2 : 1; - u[254] = u[254] = 1; - function a() { - n.call(this, "utf-8 decode"), this.leftOver = null; - } - function l() { - n.call(this, "utf-8 encode"); - } - s.utf8encode = function(e2) { - return h.nodebuffer ? r.newBufferFrom(e2, "utf-8") : function(e3) { - var t2, r2, n2, i2, s2, a2 = e3.length, o2 = 0; - for (i2 = 0; i2 < a2; i2++) - 55296 == (64512 & (r2 = e3.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n2 = e3.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), o2 += r2 < 128 ? 1 : r2 < 2048 ? 2 : r2 < 65536 ? 3 : 4; - for (t2 = h.uint8array ? new Uint8Array(o2) : new Array(o2), i2 = s2 = 0; s2 < o2; i2++) - 55296 == (64512 & (r2 = e3.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n2 = e3.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), r2 < 128 ? t2[s2++] = r2 : (r2 < 2048 ? t2[s2++] = 192 | r2 >>> 6 : (r2 < 65536 ? t2[s2++] = 224 | r2 >>> 12 : (t2[s2++] = 240 | r2 >>> 18, t2[s2++] = 128 | r2 >>> 12 & 63), t2[s2++] = 128 | r2 >>> 6 & 63), t2[s2++] = 128 | 63 & r2); - return t2; - }(e2); - }, s.utf8decode = function(e2) { - return h.nodebuffer ? o.transformTo("nodebuffer", e2).toString("utf-8") : function(e3) { - var t2, r2, n2, i2, s2 = e3.length, a2 = new Array(2 * s2); - for (t2 = r2 = 0; t2 < s2; ) - if ((n2 = e3[t2++]) < 128) - a2[r2++] = n2; - else if (4 < (i2 = u[n2])) - a2[r2++] = 65533, t2 += i2 - 1; - else { - for (n2 &= 2 === i2 ? 31 : 3 === i2 ? 15 : 7; 1 < i2 && t2 < s2; ) - n2 = n2 << 6 | 63 & e3[t2++], i2--; - 1 < i2 ? a2[r2++] = 65533 : n2 < 65536 ? a2[r2++] = n2 : (n2 -= 65536, a2[r2++] = 55296 | n2 >> 10 & 1023, a2[r2++] = 56320 | 1023 & n2); - } - return a2.length !== r2 && (a2.subarray ? a2 = a2.subarray(0, r2) : a2.length = r2), o.applyFromCharCode(a2); - }(e2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2)); - }, o.inherits(a, n), a.prototype.processChunk = function(e2) { - var t2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2.data); - if (this.leftOver && this.leftOver.length) { - if (h.uint8array) { - var r2 = t2; - (t2 = new Uint8Array(r2.length + this.leftOver.length)).set(this.leftOver, 0), t2.set(r2, this.leftOver.length); - } else - t2 = this.leftOver.concat(t2); - this.leftOver = null; - } - var n2 = function(e3, t3) { - var r3; - for ((t3 = t3 || e3.length) > e3.length && (t3 = e3.length), r3 = t3 - 1; 0 <= r3 && 128 == (192 & e3[r3]); ) - r3--; - return r3 < 0 ? t3 : 0 === r3 ? t3 : r3 + u[e3[r3]] > t3 ? r3 : t3; - }(t2), i2 = t2; - n2 !== t2.length && (h.uint8array ? (i2 = t2.subarray(0, n2), this.leftOver = t2.subarray(n2, t2.length)) : (i2 = t2.slice(0, n2), this.leftOver = t2.slice(n2, t2.length))), this.push({ data: s.utf8decode(i2), meta: e2.meta }); - }, a.prototype.flush = function() { - this.leftOver && this.leftOver.length && (this.push({ data: s.utf8decode(this.leftOver), meta: {} }), this.leftOver = null); - }, s.Utf8DecodeWorker = a, o.inherits(l, n), l.prototype.processChunk = function(e2) { - this.push({ data: s.utf8encode(e2.data), meta: e2.meta }); - }, s.Utf8EncodeWorker = l; - }, { "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./support": 30, "./utils": 32 }], 32: [function(e, t, a) { - "use strict"; - var o = e("./support"), h = e("./base64"), r = e("./nodejsUtils"), u = e("./external"); - function n(e2) { - return e2; - } - function l(e2, t2) { - for (var r2 = 0; r2 < e2.length; ++r2) - t2[r2] = 255 & e2.charCodeAt(r2); - return t2; - } - e("setimmediate"), a.newBlob = function(t2, r2) { - a.checkSupport("blob"); - try { - return new Blob([t2], { type: r2 }); - } catch (e2) { - try { - var n2 = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)(); - return n2.append(t2), n2.getBlob(r2); - } catch (e3) { - throw new Error("Bug : can't construct the Blob."); - } - } - }; - var i = { stringifyByChunk: function(e2, t2, r2) { - var n2 = [], i2 = 0, s2 = e2.length; - if (s2 <= r2) - return String.fromCharCode.apply(null, e2); - for (; i2 < s2; ) - "array" === t2 || "nodebuffer" === t2 ? n2.push(String.fromCharCode.apply(null, e2.slice(i2, Math.min(i2 + r2, s2)))) : n2.push(String.fromCharCode.apply(null, e2.subarray(i2, Math.min(i2 + r2, s2)))), i2 += r2; - return n2.join(""); - }, stringifyByChar: function(e2) { - for (var t2 = "", r2 = 0; r2 < e2.length; r2++) - t2 += String.fromCharCode(e2[r2]); - return t2; - }, applyCanBeUsed: { uint8array: function() { - try { - return o.uint8array && 1 === String.fromCharCode.apply(null, new Uint8Array(1)).length; - } catch (e2) { - return false; - } - }(), nodebuffer: function() { - try { - return o.nodebuffer && 1 === String.fromCharCode.apply(null, r.allocBuffer(1)).length; - } catch (e2) { - return false; - } - }() } }; - function s(e2) { - var t2 = 65536, r2 = a.getTypeOf(e2), n2 = true; - if ("uint8array" === r2 ? n2 = i.applyCanBeUsed.uint8array : "nodebuffer" === r2 && (n2 = i.applyCanBeUsed.nodebuffer), n2) - for (; 1 < t2; ) - try { - return i.stringifyByChunk(e2, r2, t2); - } catch (e3) { - t2 = Math.floor(t2 / 2); - } - return i.stringifyByChar(e2); - } - function f(e2, t2) { - for (var r2 = 0; r2 < e2.length; r2++) - t2[r2] = e2[r2]; - return t2; - } - a.applyFromCharCode = s; - var c = {}; - c.string = { string: n, array: function(e2) { - return l(e2, new Array(e2.length)); - }, arraybuffer: function(e2) { - return c.string.uint8array(e2).buffer; - }, uint8array: function(e2) { - return l(e2, new Uint8Array(e2.length)); - }, nodebuffer: function(e2) { - return l(e2, r.allocBuffer(e2.length)); - } }, c.array = { string: s, array: n, arraybuffer: function(e2) { - return new Uint8Array(e2).buffer; - }, uint8array: function(e2) { - return new Uint8Array(e2); - }, nodebuffer: function(e2) { - return r.newBufferFrom(e2); - } }, c.arraybuffer = { string: function(e2) { - return s(new Uint8Array(e2)); - }, array: function(e2) { - return f(new Uint8Array(e2), new Array(e2.byteLength)); - }, arraybuffer: n, uint8array: function(e2) { - return new Uint8Array(e2); - }, nodebuffer: function(e2) { - return r.newBufferFrom(new Uint8Array(e2)); - } }, c.uint8array = { string: s, array: function(e2) { - return f(e2, new Array(e2.length)); - }, arraybuffer: function(e2) { - return e2.buffer; - }, uint8array: n, nodebuffer: function(e2) { - return r.newBufferFrom(e2); - } }, c.nodebuffer = { string: s, array: function(e2) { - return f(e2, new Array(e2.length)); - }, arraybuffer: function(e2) { - return c.nodebuffer.uint8array(e2).buffer; - }, uint8array: function(e2) { - return f(e2, new Uint8Array(e2.length)); - }, nodebuffer: n }, a.transformTo = function(e2, t2) { - if (t2 = t2 || "", !e2) - return t2; - a.checkSupport(e2); - var r2 = a.getTypeOf(t2); - return c[r2][e2](t2); - }, a.resolve = function(e2) { - for (var t2 = e2.split("/"), r2 = [], n2 = 0; n2 < t2.length; n2++) { - var i2 = t2[n2]; - "." === i2 || "" === i2 && 0 !== n2 && n2 !== t2.length - 1 || (".." === i2 ? r2.pop() : r2.push(i2)); - } - return r2.join("/"); - }, a.getTypeOf = function(e2) { - return "string" == typeof e2 ? "string" : "[object Array]" === Object.prototype.toString.call(e2) ? "array" : o.nodebuffer && r.isBuffer(e2) ? "nodebuffer" : o.uint8array && e2 instanceof Uint8Array ? "uint8array" : o.arraybuffer && e2 instanceof ArrayBuffer ? "arraybuffer" : void 0; - }, a.checkSupport = function(e2) { - if (!o[e2.toLowerCase()]) - throw new Error(e2 + " is not supported by this platform"); - }, a.MAX_VALUE_16BITS = 65535, a.MAX_VALUE_32BITS = -1, a.pretty = function(e2) { - var t2, r2, n2 = ""; - for (r2 = 0; r2 < (e2 || "").length; r2++) - n2 += "\\x" + ((t2 = e2.charCodeAt(r2)) < 16 ? "0" : "") + t2.toString(16).toUpperCase(); - return n2; - }, a.delay = function(e2, t2, r2) { - setImmediate(function() { - e2.apply(r2 || null, t2 || []); - }); - }, a.inherits = function(e2, t2) { - function r2() { - } - r2.prototype = t2.prototype, e2.prototype = new r2(); - }, a.extend = function() { - var e2, t2, r2 = {}; - for (e2 = 0; e2 < arguments.length; e2++) - for (t2 in arguments[e2]) - Object.prototype.hasOwnProperty.call(arguments[e2], t2) && void 0 === r2[t2] && (r2[t2] = arguments[e2][t2]); - return r2; - }, a.prepareContent = function(r2, e2, n2, i2, s2) { - return u.Promise.resolve(e2).then(function(n3) { - return o.blob && (n3 instanceof Blob || -1 !== ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(n3))) && "undefined" != typeof FileReader ? new u.Promise(function(t2, r3) { - var e3 = new FileReader(); - e3.onload = function(e4) { - t2(e4.target.result); - }, e3.onerror = function(e4) { - r3(e4.target.error); - }, e3.readAsArrayBuffer(n3); - }) : n3; - }).then(function(e3) { - var t2 = a.getTypeOf(e3); - return t2 ? ("arraybuffer" === t2 ? e3 = a.transformTo("uint8array", e3) : "string" === t2 && (s2 ? e3 = h.decode(e3) : n2 && true !== i2 && (e3 = function(e4) { - return l(e4, o.uint8array ? new Uint8Array(e4.length) : new Array(e4.length)); - }(e3))), e3) : u.Promise.reject(new Error("Can't read the data of '" + r2 + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?")); - }); - }; - }, { "./base64": 1, "./external": 6, "./nodejsUtils": 14, "./support": 30, setimmediate: 54 }], 33: [function(e, t, r) { - "use strict"; - var n = e("./reader/readerFor"), i = e("./utils"), s = e("./signature"), a = e("./zipEntry"), o = e("./support"); - function h(e2) { - this.files = [], this.loadOptions = e2; - } - h.prototype = { checkSignature: function(e2) { - if (!this.reader.readAndCheckSignature(e2)) { - this.reader.index -= 4; - var t2 = this.reader.readString(4); - throw new Error("Corrupted zip or bug: unexpected signature (" + i.pretty(t2) + ", expected " + i.pretty(e2) + ")"); - } - }, isSignature: function(e2, t2) { - var r2 = this.reader.index; - this.reader.setIndex(e2); - var n2 = this.reader.readString(4) === t2; - return this.reader.setIndex(r2), n2; - }, readBlockEndOfCentral: function() { - this.diskNumber = this.reader.readInt(2), this.diskWithCentralDirStart = this.reader.readInt(2), this.centralDirRecordsOnThisDisk = this.reader.readInt(2), this.centralDirRecords = this.reader.readInt(2), this.centralDirSize = this.reader.readInt(4), this.centralDirOffset = this.reader.readInt(4), this.zipCommentLength = this.reader.readInt(2); - var e2 = this.reader.readData(this.zipCommentLength), t2 = o.uint8array ? "uint8array" : "array", r2 = i.transformTo(t2, e2); - this.zipComment = this.loadOptions.decodeFileName(r2); - }, readBlockZip64EndOfCentral: function() { - this.zip64EndOfCentralSize = this.reader.readInt(8), this.reader.skip(4), this.diskNumber = this.reader.readInt(4), this.diskWithCentralDirStart = this.reader.readInt(4), this.centralDirRecordsOnThisDisk = this.reader.readInt(8), this.centralDirRecords = this.reader.readInt(8), this.centralDirSize = this.reader.readInt(8), this.centralDirOffset = this.reader.readInt(8), this.zip64ExtensibleData = {}; - for (var e2, t2, r2, n2 = this.zip64EndOfCentralSize - 44; 0 < n2; ) - e2 = this.reader.readInt(2), t2 = this.reader.readInt(4), r2 = this.reader.readData(t2), this.zip64ExtensibleData[e2] = { id: e2, length: t2, value: r2 }; - }, readBlockZip64EndOfCentralLocator: function() { - if (this.diskWithZip64CentralDirStart = this.reader.readInt(4), this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8), this.disksCount = this.reader.readInt(4), 1 < this.disksCount) - throw new Error("Multi-volumes zip are not supported"); - }, readLocalFiles: function() { - var e2, t2; - for (e2 = 0; e2 < this.files.length; e2++) - t2 = this.files[e2], this.reader.setIndex(t2.localHeaderOffset), this.checkSignature(s.LOCAL_FILE_HEADER), t2.readLocalPart(this.reader), t2.handleUTF8(), t2.processAttributes(); - }, readCentralDir: function() { - var e2; - for (this.reader.setIndex(this.centralDirOffset); this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER); ) - (e2 = new a({ zip64: this.zip64 }, this.loadOptions)).readCentralPart(this.reader), this.files.push(e2); - if (this.centralDirRecords !== this.files.length && 0 !== this.centralDirRecords && 0 === this.files.length) - throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length); - }, readEndOfCentral: function() { - var e2 = this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END); - if (e2 < 0) - throw !this.isSignature(0, s.LOCAL_FILE_HEADER) ? new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html") : new Error("Corrupted zip: can't find end of central directory"); - this.reader.setIndex(e2); - var t2 = e2; - if (this.checkSignature(s.CENTRAL_DIRECTORY_END), this.readBlockEndOfCentral(), this.diskNumber === i.MAX_VALUE_16BITS || this.diskWithCentralDirStart === i.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === i.MAX_VALUE_16BITS || this.centralDirRecords === i.MAX_VALUE_16BITS || this.centralDirSize === i.MAX_VALUE_32BITS || this.centralDirOffset === i.MAX_VALUE_32BITS) { - if (this.zip64 = true, (e2 = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR)) < 0) - throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator"); - if (this.reader.setIndex(e2), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR), this.readBlockZip64EndOfCentralLocator(), !this.isSignature(this.relativeOffsetEndOfZip64CentralDir, s.ZIP64_CENTRAL_DIRECTORY_END) && (this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.relativeOffsetEndOfZip64CentralDir < 0)) - throw new Error("Corrupted zip: can't find the ZIP64 end of central directory"); - this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.readBlockZip64EndOfCentral(); - } - var r2 = this.centralDirOffset + this.centralDirSize; - this.zip64 && (r2 += 20, r2 += 12 + this.zip64EndOfCentralSize); - var n2 = t2 - r2; - if (0 < n2) - this.isSignature(t2, s.CENTRAL_FILE_HEADER) || (this.reader.zero = n2); - else if (n2 < 0) - throw new Error("Corrupted zip: missing " + Math.abs(n2) + " bytes."); - }, prepareReader: function(e2) { - this.reader = n(e2); - }, load: function(e2) { - this.prepareReader(e2), this.readEndOfCentral(), this.readCentralDir(), this.readLocalFiles(); - } }, t.exports = h; - }, { "./reader/readerFor": 22, "./signature": 23, "./support": 30, "./utils": 32, "./zipEntry": 34 }], 34: [function(e, t, r) { - "use strict"; - var n = e("./reader/readerFor"), s = e("./utils"), i = e("./compressedObject"), a = e("./crc32"), o = e("./utf8"), h = e("./compressions"), u = e("./support"); - function l(e2, t2) { - this.options = e2, this.loadOptions = t2; - } - l.prototype = { isEncrypted: function() { - return 1 == (1 & this.bitFlag); - }, useUTF8: function() { - return 2048 == (2048 & this.bitFlag); - }, readLocalPart: function(e2) { - var t2, r2; - if (e2.skip(22), this.fileNameLength = e2.readInt(2), r2 = e2.readInt(2), this.fileName = e2.readData(this.fileNameLength), e2.skip(r2), -1 === this.compressedSize || -1 === this.uncompressedSize) - throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)"); - if (null === (t2 = function(e3) { - for (var t3 in h) - if (Object.prototype.hasOwnProperty.call(h, t3) && h[t3].magic === e3) - return h[t3]; - return null; - }(this.compressionMethod))) - throw new Error("Corrupted zip : compression " + s.pretty(this.compressionMethod) + " unknown (inner file : " + s.transformTo("string", this.fileName) + ")"); - this.decompressed = new i(this.compressedSize, this.uncompressedSize, this.crc32, t2, e2.readData(this.compressedSize)); - }, readCentralPart: function(e2) { - this.versionMadeBy = e2.readInt(2), e2.skip(2), this.bitFlag = e2.readInt(2), this.compressionMethod = e2.readString(2), this.date = e2.readDate(), this.crc32 = e2.readInt(4), this.compressedSize = e2.readInt(4), this.uncompressedSize = e2.readInt(4); - var t2 = e2.readInt(2); - if (this.extraFieldsLength = e2.readInt(2), this.fileCommentLength = e2.readInt(2), this.diskNumberStart = e2.readInt(2), this.internalFileAttributes = e2.readInt(2), this.externalFileAttributes = e2.readInt(4), this.localHeaderOffset = e2.readInt(4), this.isEncrypted()) - throw new Error("Encrypted zip are not supported"); - e2.skip(t2), this.readExtraFields(e2), this.parseZIP64ExtraField(e2), this.fileComment = e2.readData(this.fileCommentLength); - }, processAttributes: function() { - this.unixPermissions = null, this.dosPermissions = null; - var e2 = this.versionMadeBy >> 8; - this.dir = !!(16 & this.externalFileAttributes), 0 == e2 && (this.dosPermissions = 63 & this.externalFileAttributes), 3 == e2 && (this.unixPermissions = this.externalFileAttributes >> 16 & 65535), this.dir || "/" !== this.fileNameStr.slice(-1) || (this.dir = true); - }, parseZIP64ExtraField: function() { - if (this.extraFields[1]) { - var e2 = n(this.extraFields[1].value); - this.uncompressedSize === s.MAX_VALUE_32BITS && (this.uncompressedSize = e2.readInt(8)), this.compressedSize === s.MAX_VALUE_32BITS && (this.compressedSize = e2.readInt(8)), this.localHeaderOffset === s.MAX_VALUE_32BITS && (this.localHeaderOffset = e2.readInt(8)), this.diskNumberStart === s.MAX_VALUE_32BITS && (this.diskNumberStart = e2.readInt(4)); - } - }, readExtraFields: function(e2) { - var t2, r2, n2, i2 = e2.index + this.extraFieldsLength; - for (this.extraFields || (this.extraFields = {}); e2.index + 4 < i2; ) - t2 = e2.readInt(2), r2 = e2.readInt(2), n2 = e2.readData(r2), this.extraFields[t2] = { id: t2, length: r2, value: n2 }; - e2.setIndex(i2); - }, handleUTF8: function() { - var e2 = u.uint8array ? "uint8array" : "array"; - if (this.useUTF8()) - this.fileNameStr = o.utf8decode(this.fileName), this.fileCommentStr = o.utf8decode(this.fileComment); - else { - var t2 = this.findExtraFieldUnicodePath(); - if (null !== t2) - this.fileNameStr = t2; - else { - var r2 = s.transformTo(e2, this.fileName); - this.fileNameStr = this.loadOptions.decodeFileName(r2); - } - var n2 = this.findExtraFieldUnicodeComment(); - if (null !== n2) - this.fileCommentStr = n2; - else { - var i2 = s.transformTo(e2, this.fileComment); - this.fileCommentStr = this.loadOptions.decodeFileName(i2); - } - } - }, findExtraFieldUnicodePath: function() { - var e2 = this.extraFields[28789]; - if (e2) { - var t2 = n(e2.value); - return 1 !== t2.readInt(1) ? null : a(this.fileName) !== t2.readInt(4) ? null : o.utf8decode(t2.readData(e2.length - 5)); - } - return null; - }, findExtraFieldUnicodeComment: function() { - var e2 = this.extraFields[25461]; - if (e2) { - var t2 = n(e2.value); - return 1 !== t2.readInt(1) ? null : a(this.fileComment) !== t2.readInt(4) ? null : o.utf8decode(t2.readData(e2.length - 5)); - } - return null; - } }, t.exports = l; - }, { "./compressedObject": 2, "./compressions": 3, "./crc32": 4, "./reader/readerFor": 22, "./support": 30, "./utf8": 31, "./utils": 32 }], 35: [function(e, t, r) { - "use strict"; - function n(e2, t2, r2) { - this.name = e2, this.dir = r2.dir, this.date = r2.date, this.comment = r2.comment, this.unixPermissions = r2.unixPermissions, this.dosPermissions = r2.dosPermissions, this._data = t2, this._dataBinary = r2.binary, this.options = { compression: r2.compression, compressionOptions: r2.compressionOptions }; - } - var s = e("./stream/StreamHelper"), i = e("./stream/DataWorker"), a = e("./utf8"), o = e("./compressedObject"), h = e("./stream/GenericWorker"); - n.prototype = { internalStream: function(e2) { - var t2 = null, r2 = "string"; - try { - if (!e2) - throw new Error("No output type specified."); - var n2 = "string" === (r2 = e2.toLowerCase()) || "text" === r2; - "binarystring" !== r2 && "text" !== r2 || (r2 = "string"), t2 = this._decompressWorker(); - var i2 = !this._dataBinary; - i2 && !n2 && (t2 = t2.pipe(new a.Utf8EncodeWorker())), !i2 && n2 && (t2 = t2.pipe(new a.Utf8DecodeWorker())); - } catch (e3) { - (t2 = new h("error")).error(e3); - } - return new s(t2, r2, ""); - }, async: function(e2, t2) { - return this.internalStream(e2).accumulate(t2); - }, nodeStream: function(e2, t2) { - return this.internalStream(e2 || "nodebuffer").toNodejsStream(t2); - }, _compressWorker: function(e2, t2) { - if (this._data instanceof o && this._data.compression.magic === e2.magic) - return this._data.getCompressedWorker(); - var r2 = this._decompressWorker(); - return this._dataBinary || (r2 = r2.pipe(new a.Utf8EncodeWorker())), o.createWorkerFrom(r2, e2, t2); - }, _decompressWorker: function() { - return this._data instanceof o ? this._data.getContentWorker() : this._data instanceof h ? this._data : new i(this._data); - } }; - for (var u = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"], l = function() { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); - }, f = 0; f < u.length; f++) - n.prototype[u[f]] = l; - t.exports = n; - }, { "./compressedObject": 2, "./stream/DataWorker": 27, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31 }], 36: [function(e, l, t) { - (function(t2) { - "use strict"; - var r, n, e2 = t2.MutationObserver || t2.WebKitMutationObserver; - if (e2) { - var i = 0, s = new e2(u), a = t2.document.createTextNode(""); - s.observe(a, { characterData: true }), r = function() { - a.data = i = ++i % 2; - }; - } else if (t2.setImmediate || void 0 === t2.MessageChannel) - r = "document" in t2 && "onreadystatechange" in t2.document.createElement("script") ? function() { - var e3 = t2.document.createElement("script"); - e3.onreadystatechange = function() { - u(), e3.onreadystatechange = null, e3.parentNode.removeChild(e3), e3 = null; - }, t2.document.documentElement.appendChild(e3); - } : function() { - setTimeout(u, 0); - }; - else { - var o = new t2.MessageChannel(); - o.port1.onmessage = u, r = function() { - o.port2.postMessage(0); - }; - } - var h = []; - function u() { - var e3, t3; - n = true; - for (var r2 = h.length; r2; ) { - for (t3 = h, h = [], e3 = -1; ++e3 < r2; ) - t3[e3](); - r2 = h.length; - } - n = false; - } - l.exports = function(e3) { - 1 !== h.push(e3) || n || r(); - }; - }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}); - }, {}], 37: [function(e, t, r) { - "use strict"; - var i = e("immediate"); - function u() { - } - var l = {}, s = ["REJECTED"], a = ["FULFILLED"], n = ["PENDING"]; - function o(e2) { - if ("function" != typeof e2) - throw new TypeError("resolver must be a function"); - this.state = n, this.queue = [], this.outcome = void 0, e2 !== u && d(this, e2); - } - function h(e2, t2, r2) { - this.promise = e2, "function" == typeof t2 && (this.onFulfilled = t2, this.callFulfilled = this.otherCallFulfilled), "function" == typeof r2 && (this.onRejected = r2, this.callRejected = this.otherCallRejected); - } - function f(t2, r2, n2) { - i(function() { - var e2; - try { - e2 = r2(n2); - } catch (e3) { - return l.reject(t2, e3); - } - e2 === t2 ? l.reject(t2, new TypeError("Cannot resolve promise with itself")) : l.resolve(t2, e2); - }); - } - function c(e2) { - var t2 = e2 && e2.then; - if (e2 && ("object" == typeof e2 || "function" == typeof e2) && "function" == typeof t2) - return function() { - t2.apply(e2, arguments); - }; - } - function d(t2, e2) { - var r2 = false; - function n2(e3) { - r2 || (r2 = true, l.reject(t2, e3)); - } - function i2(e3) { - r2 || (r2 = true, l.resolve(t2, e3)); - } - var s2 = p(function() { - e2(i2, n2); - }); - "error" === s2.status && n2(s2.value); - } - function p(e2, t2) { - var r2 = {}; - try { - r2.value = e2(t2), r2.status = "success"; - } catch (e3) { - r2.status = "error", r2.value = e3; - } - return r2; - } - (t.exports = o).prototype.finally = function(t2) { - if ("function" != typeof t2) - return this; - var r2 = this.constructor; - return this.then(function(e2) { - return r2.resolve(t2()).then(function() { - return e2; - }); - }, function(e2) { - return r2.resolve(t2()).then(function() { - throw e2; - }); - }); - }, o.prototype.catch = function(e2) { - return this.then(null, e2); - }, o.prototype.then = function(e2, t2) { - if ("function" != typeof e2 && this.state === a || "function" != typeof t2 && this.state === s) - return this; - var r2 = new this.constructor(u); - this.state !== n ? f(r2, this.state === a ? e2 : t2, this.outcome) : this.queue.push(new h(r2, e2, t2)); - return r2; - }, h.prototype.callFulfilled = function(e2) { - l.resolve(this.promise, e2); - }, h.prototype.otherCallFulfilled = function(e2) { - f(this.promise, this.onFulfilled, e2); - }, h.prototype.callRejected = function(e2) { - l.reject(this.promise, e2); - }, h.prototype.otherCallRejected = function(e2) { - f(this.promise, this.onRejected, e2); - }, l.resolve = function(e2, t2) { - var r2 = p(c, t2); - if ("error" === r2.status) - return l.reject(e2, r2.value); - var n2 = r2.value; - if (n2) - d(e2, n2); - else { - e2.state = a, e2.outcome = t2; - for (var i2 = -1, s2 = e2.queue.length; ++i2 < s2; ) - e2.queue[i2].callFulfilled(t2); - } - return e2; - }, l.reject = function(e2, t2) { - e2.state = s, e2.outcome = t2; - for (var r2 = -1, n2 = e2.queue.length; ++r2 < n2; ) - e2.queue[r2].callRejected(t2); - return e2; - }, o.resolve = function(e2) { - if (e2 instanceof this) - return e2; - return l.resolve(new this(u), e2); - }, o.reject = function(e2) { - var t2 = new this(u); - return l.reject(t2, e2); - }, o.all = function(e2) { - var r2 = this; - if ("[object Array]" !== Object.prototype.toString.call(e2)) - return this.reject(new TypeError("must be an array")); - var n2 = e2.length, i2 = false; - if (!n2) - return this.resolve([]); - var s2 = new Array(n2), a2 = 0, t2 = -1, o2 = new this(u); - for (; ++t2 < n2; ) - h2(e2[t2], t2); - return o2; - function h2(e3, t3) { - r2.resolve(e3).then(function(e4) { - s2[t3] = e4, ++a2 !== n2 || i2 || (i2 = true, l.resolve(o2, s2)); - }, function(e4) { - i2 || (i2 = true, l.reject(o2, e4)); - }); - } - }, o.race = function(e2) { - var t2 = this; - if ("[object Array]" !== Object.prototype.toString.call(e2)) - return this.reject(new TypeError("must be an array")); - var r2 = e2.length, n2 = false; - if (!r2) - return this.resolve([]); - var i2 = -1, s2 = new this(u); - for (; ++i2 < r2; ) - a2 = e2[i2], t2.resolve(a2).then(function(e3) { - n2 || (n2 = true, l.resolve(s2, e3)); - }, function(e3) { - n2 || (n2 = true, l.reject(s2, e3)); - }); - var a2; - return s2; - }; - }, { immediate: 36 }], 38: [function(e, t, r) { - "use strict"; - var n = {}; - (0, e("./lib/utils/common").assign)(n, e("./lib/deflate"), e("./lib/inflate"), e("./lib/zlib/constants")), t.exports = n; - }, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function(e, t, r) { - "use strict"; - var a = e("./zlib/deflate"), o = e("./utils/common"), h = e("./utils/strings"), i = e("./zlib/messages"), s = e("./zlib/zstream"), u = Object.prototype.toString, l = 0, f = -1, c = 0, d = 8; - function p(e2) { - if (!(this instanceof p)) - return new p(e2); - this.options = o.assign({ level: f, method: d, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: c, to: "" }, e2 || {}); - var t2 = this.options; - t2.raw && 0 < t2.windowBits ? t2.windowBits = -t2.windowBits : t2.gzip && 0 < t2.windowBits && t2.windowBits < 16 && (t2.windowBits += 16), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new s(), this.strm.avail_out = 0; - var r2 = a.deflateInit2(this.strm, t2.level, t2.method, t2.windowBits, t2.memLevel, t2.strategy); - if (r2 !== l) - throw new Error(i[r2]); - if (t2.header && a.deflateSetHeader(this.strm, t2.header), t2.dictionary) { - var n2; - if (n2 = "string" == typeof t2.dictionary ? h.string2buf(t2.dictionary) : "[object ArrayBuffer]" === u.call(t2.dictionary) ? new Uint8Array(t2.dictionary) : t2.dictionary, (r2 = a.deflateSetDictionary(this.strm, n2)) !== l) - throw new Error(i[r2]); - this._dict_set = true; - } - } - function n(e2, t2) { - var r2 = new p(t2); - if (r2.push(e2, true), r2.err) - throw r2.msg || i[r2.err]; - return r2.result; - } - p.prototype.push = function(e2, t2) { - var r2, n2, i2 = this.strm, s2 = this.options.chunkSize; - if (this.ended) - return false; - n2 = t2 === ~~t2 ? t2 : true === t2 ? 4 : 0, "string" == typeof e2 ? i2.input = h.string2buf(e2) : "[object ArrayBuffer]" === u.call(e2) ? i2.input = new Uint8Array(e2) : i2.input = e2, i2.next_in = 0, i2.avail_in = i2.input.length; - do { - if (0 === i2.avail_out && (i2.output = new o.Buf8(s2), i2.next_out = 0, i2.avail_out = s2), 1 !== (r2 = a.deflate(i2, n2)) && r2 !== l) - return this.onEnd(r2), !(this.ended = true); - 0 !== i2.avail_out && (0 !== i2.avail_in || 4 !== n2 && 2 !== n2) || ("string" === this.options.to ? this.onData(h.buf2binstring(o.shrinkBuf(i2.output, i2.next_out))) : this.onData(o.shrinkBuf(i2.output, i2.next_out))); - } while ((0 < i2.avail_in || 0 === i2.avail_out) && 1 !== r2); - return 4 === n2 ? (r2 = a.deflateEnd(this.strm), this.onEnd(r2), this.ended = true, r2 === l) : 2 !== n2 || (this.onEnd(l), !(i2.avail_out = 0)); - }, p.prototype.onData = function(e2) { - this.chunks.push(e2); - }, p.prototype.onEnd = function(e2) { - e2 === l && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = o.flattenChunks(this.chunks)), this.chunks = [], this.err = e2, this.msg = this.strm.msg; - }, r.Deflate = p, r.deflate = n, r.deflateRaw = function(e2, t2) { - return (t2 = t2 || {}).raw = true, n(e2, t2); - }, r.gzip = function(e2, t2) { - return (t2 = t2 || {}).gzip = true, n(e2, t2); - }; - }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(e, t, r) { - "use strict"; - var c = e("./zlib/inflate"), d = e("./utils/common"), p = e("./utils/strings"), m = e("./zlib/constants"), n = e("./zlib/messages"), i = e("./zlib/zstream"), s = e("./zlib/gzheader"), _ = Object.prototype.toString; - function a(e2) { - if (!(this instanceof a)) - return new a(e2); - this.options = d.assign({ chunkSize: 16384, windowBits: 0, to: "" }, e2 || {}); - var t2 = this.options; - t2.raw && 0 <= t2.windowBits && t2.windowBits < 16 && (t2.windowBits = -t2.windowBits, 0 === t2.windowBits && (t2.windowBits = -15)), !(0 <= t2.windowBits && t2.windowBits < 16) || e2 && e2.windowBits || (t2.windowBits += 32), 15 < t2.windowBits && t2.windowBits < 48 && 0 == (15 & t2.windowBits) && (t2.windowBits |= 15), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new i(), this.strm.avail_out = 0; - var r2 = c.inflateInit2(this.strm, t2.windowBits); - if (r2 !== m.Z_OK) - throw new Error(n[r2]); - this.header = new s(), c.inflateGetHeader(this.strm, this.header); - } - function o(e2, t2) { - var r2 = new a(t2); - if (r2.push(e2, true), r2.err) - throw r2.msg || n[r2.err]; - return r2.result; - } - a.prototype.push = function(e2, t2) { - var r2, n2, i2, s2, a2, o2, h = this.strm, u = this.options.chunkSize, l = this.options.dictionary, f = false; - if (this.ended) - return false; - n2 = t2 === ~~t2 ? t2 : true === t2 ? m.Z_FINISH : m.Z_NO_FLUSH, "string" == typeof e2 ? h.input = p.binstring2buf(e2) : "[object ArrayBuffer]" === _.call(e2) ? h.input = new Uint8Array(e2) : h.input = e2, h.next_in = 0, h.avail_in = h.input.length; - do { - if (0 === h.avail_out && (h.output = new d.Buf8(u), h.next_out = 0, h.avail_out = u), (r2 = c.inflate(h, m.Z_NO_FLUSH)) === m.Z_NEED_DICT && l && (o2 = "string" == typeof l ? p.string2buf(l) : "[object ArrayBuffer]" === _.call(l) ? new Uint8Array(l) : l, r2 = c.inflateSetDictionary(this.strm, o2)), r2 === m.Z_BUF_ERROR && true === f && (r2 = m.Z_OK, f = false), r2 !== m.Z_STREAM_END && r2 !== m.Z_OK) - return this.onEnd(r2), !(this.ended = true); - h.next_out && (0 !== h.avail_out && r2 !== m.Z_STREAM_END && (0 !== h.avail_in || n2 !== m.Z_FINISH && n2 !== m.Z_SYNC_FLUSH) || ("string" === this.options.to ? (i2 = p.utf8border(h.output, h.next_out), s2 = h.next_out - i2, a2 = p.buf2string(h.output, i2), h.next_out = s2, h.avail_out = u - s2, s2 && d.arraySet(h.output, h.output, i2, s2, 0), this.onData(a2)) : this.onData(d.shrinkBuf(h.output, h.next_out)))), 0 === h.avail_in && 0 === h.avail_out && (f = true); - } while ((0 < h.avail_in || 0 === h.avail_out) && r2 !== m.Z_STREAM_END); - return r2 === m.Z_STREAM_END && (n2 = m.Z_FINISH), n2 === m.Z_FINISH ? (r2 = c.inflateEnd(this.strm), this.onEnd(r2), this.ended = true, r2 === m.Z_OK) : n2 !== m.Z_SYNC_FLUSH || (this.onEnd(m.Z_OK), !(h.avail_out = 0)); - }, a.prototype.onData = function(e2) { - this.chunks.push(e2); - }, a.prototype.onEnd = function(e2) { - e2 === m.Z_OK && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = d.flattenChunks(this.chunks)), this.chunks = [], this.err = e2, this.msg = this.strm.msg; - }, r.Inflate = a, r.inflate = o, r.inflateRaw = function(e2, t2) { - return (t2 = t2 || {}).raw = true, o(e2, t2); - }, r.ungzip = o; - }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/constants": 44, "./zlib/gzheader": 47, "./zlib/inflate": 49, "./zlib/messages": 51, "./zlib/zstream": 53 }], 41: [function(e, t, r) { - "use strict"; - var n = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Int32Array; - r.assign = function(e2) { - for (var t2 = Array.prototype.slice.call(arguments, 1); t2.length; ) { - var r2 = t2.shift(); - if (r2) { - if ("object" != typeof r2) - throw new TypeError(r2 + "must be non-object"); - for (var n2 in r2) - r2.hasOwnProperty(n2) && (e2[n2] = r2[n2]); - } - } - return e2; - }, r.shrinkBuf = function(e2, t2) { - return e2.length === t2 ? e2 : e2.subarray ? e2.subarray(0, t2) : (e2.length = t2, e2); - }; - var i = { arraySet: function(e2, t2, r2, n2, i2) { - if (t2.subarray && e2.subarray) - e2.set(t2.subarray(r2, r2 + n2), i2); - else - for (var s2 = 0; s2 < n2; s2++) - e2[i2 + s2] = t2[r2 + s2]; - }, flattenChunks: function(e2) { - var t2, r2, n2, i2, s2, a; - for (t2 = n2 = 0, r2 = e2.length; t2 < r2; t2++) - n2 += e2[t2].length; - for (a = new Uint8Array(n2), t2 = i2 = 0, r2 = e2.length; t2 < r2; t2++) - s2 = e2[t2], a.set(s2, i2), i2 += s2.length; - return a; - } }, s = { arraySet: function(e2, t2, r2, n2, i2) { - for (var s2 = 0; s2 < n2; s2++) - e2[i2 + s2] = t2[r2 + s2]; - }, flattenChunks: function(e2) { - return [].concat.apply([], e2); - } }; - r.setTyped = function(e2) { - e2 ? (r.Buf8 = Uint8Array, r.Buf16 = Uint16Array, r.Buf32 = Int32Array, r.assign(r, i)) : (r.Buf8 = Array, r.Buf16 = Array, r.Buf32 = Array, r.assign(r, s)); - }, r.setTyped(n); - }, {}], 42: [function(e, t, r) { - "use strict"; - var h = e("./common"), i = true, s = true; - try { - String.fromCharCode.apply(null, [0]); - } catch (e2) { - i = false; - } - try { - String.fromCharCode.apply(null, new Uint8Array(1)); - } catch (e2) { - s = false; - } - for (var u = new h.Buf8(256), n = 0; n < 256; n++) - u[n] = 252 <= n ? 6 : 248 <= n ? 5 : 240 <= n ? 4 : 224 <= n ? 3 : 192 <= n ? 2 : 1; - function l(e2, t2) { - if (t2 < 65537 && (e2.subarray && s || !e2.subarray && i)) - return String.fromCharCode.apply(null, h.shrinkBuf(e2, t2)); - for (var r2 = "", n2 = 0; n2 < t2; n2++) - r2 += String.fromCharCode(e2[n2]); - return r2; - } - u[254] = u[254] = 1, r.string2buf = function(e2) { - var t2, r2, n2, i2, s2, a = e2.length, o = 0; - for (i2 = 0; i2 < a; i2++) - 55296 == (64512 & (r2 = e2.charCodeAt(i2))) && i2 + 1 < a && 56320 == (64512 & (n2 = e2.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), o += r2 < 128 ? 1 : r2 < 2048 ? 2 : r2 < 65536 ? 3 : 4; - for (t2 = new h.Buf8(o), i2 = s2 = 0; s2 < o; i2++) - 55296 == (64512 & (r2 = e2.charCodeAt(i2))) && i2 + 1 < a && 56320 == (64512 & (n2 = e2.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), r2 < 128 ? t2[s2++] = r2 : (r2 < 2048 ? t2[s2++] = 192 | r2 >>> 6 : (r2 < 65536 ? t2[s2++] = 224 | r2 >>> 12 : (t2[s2++] = 240 | r2 >>> 18, t2[s2++] = 128 | r2 >>> 12 & 63), t2[s2++] = 128 | r2 >>> 6 & 63), t2[s2++] = 128 | 63 & r2); - return t2; - }, r.buf2binstring = function(e2) { - return l(e2, e2.length); - }, r.binstring2buf = function(e2) { - for (var t2 = new h.Buf8(e2.length), r2 = 0, n2 = t2.length; r2 < n2; r2++) - t2[r2] = e2.charCodeAt(r2); - return t2; - }, r.buf2string = function(e2, t2) { - var r2, n2, i2, s2, a = t2 || e2.length, o = new Array(2 * a); - for (r2 = n2 = 0; r2 < a; ) - if ((i2 = e2[r2++]) < 128) - o[n2++] = i2; - else if (4 < (s2 = u[i2])) - o[n2++] = 65533, r2 += s2 - 1; - else { - for (i2 &= 2 === s2 ? 31 : 3 === s2 ? 15 : 7; 1 < s2 && r2 < a; ) - i2 = i2 << 6 | 63 & e2[r2++], s2--; - 1 < s2 ? o[n2++] = 65533 : i2 < 65536 ? o[n2++] = i2 : (i2 -= 65536, o[n2++] = 55296 | i2 >> 10 & 1023, o[n2++] = 56320 | 1023 & i2); - } - return l(o, n2); - }, r.utf8border = function(e2, t2) { - var r2; - for ((t2 = t2 || e2.length) > e2.length && (t2 = e2.length), r2 = t2 - 1; 0 <= r2 && 128 == (192 & e2[r2]); ) - r2--; - return r2 < 0 ? t2 : 0 === r2 ? t2 : r2 + u[e2[r2]] > t2 ? r2 : t2; - }; - }, { "./common": 41 }], 43: [function(e, t, r) { - "use strict"; - t.exports = function(e2, t2, r2, n) { - for (var i = 65535 & e2 | 0, s = e2 >>> 16 & 65535 | 0, a = 0; 0 !== r2; ) { - for (r2 -= a = 2e3 < r2 ? 2e3 : r2; s = s + (i = i + t2[n++] | 0) | 0, --a; ) - ; - i %= 65521, s %= 65521; - } - return i | s << 16 | 0; - }; - }, {}], 44: [function(e, t, r) { - "use strict"; - t.exports = { Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, Z_BUF_ERROR: -5, Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, Z_BINARY: 0, Z_TEXT: 1, Z_UNKNOWN: 2, Z_DEFLATED: 8 }; - }, {}], 45: [function(e, t, r) { - "use strict"; - var o = function() { - for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) { - e2 = r2; - for (var n = 0; n < 8; n++) - e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1; - t2[r2] = e2; - } - return t2; - }(); - t.exports = function(e2, t2, r2, n) { - var i = o, s = n + r2; - e2 ^= -1; - for (var a = n; a < s; a++) - e2 = e2 >>> 8 ^ i[255 & (e2 ^ t2[a])]; - return -1 ^ e2; - }; - }, {}], 46: [function(e, t, r) { - "use strict"; - var h, c = e("../utils/common"), u = e("./trees"), d = e("./adler32"), p = e("./crc32"), n = e("./messages"), l = 0, f = 4, m = 0, _ = -2, g = -1, b = 4, i = 2, v = 8, y = 9, s = 286, a = 30, o = 19, w = 2 * s + 1, k = 15, x = 3, S = 258, z = S + x + 1, C = 42, E = 113, A = 1, I = 2, O = 3, B = 4; - function R(e2, t2) { - return e2.msg = n[t2], t2; - } - function T(e2) { - return (e2 << 1) - (4 < e2 ? 9 : 0); - } - function D(e2) { - for (var t2 = e2.length; 0 <= --t2; ) - e2[t2] = 0; - } - function F(e2) { - var t2 = e2.state, r2 = t2.pending; - r2 > e2.avail_out && (r2 = e2.avail_out), 0 !== r2 && (c.arraySet(e2.output, t2.pending_buf, t2.pending_out, r2, e2.next_out), e2.next_out += r2, t2.pending_out += r2, e2.total_out += r2, e2.avail_out -= r2, t2.pending -= r2, 0 === t2.pending && (t2.pending_out = 0)); - } - function N(e2, t2) { - u._tr_flush_block(e2, 0 <= e2.block_start ? e2.block_start : -1, e2.strstart - e2.block_start, t2), e2.block_start = e2.strstart, F(e2.strm); - } - function U(e2, t2) { - e2.pending_buf[e2.pending++] = t2; - } - function P(e2, t2) { - e2.pending_buf[e2.pending++] = t2 >>> 8 & 255, e2.pending_buf[e2.pending++] = 255 & t2; - } - function L(e2, t2) { - var r2, n2, i2 = e2.max_chain_length, s2 = e2.strstart, a2 = e2.prev_length, o2 = e2.nice_match, h2 = e2.strstart > e2.w_size - z ? e2.strstart - (e2.w_size - z) : 0, u2 = e2.window, l2 = e2.w_mask, f2 = e2.prev, c2 = e2.strstart + S, d2 = u2[s2 + a2 - 1], p2 = u2[s2 + a2]; - e2.prev_length >= e2.good_match && (i2 >>= 2), o2 > e2.lookahead && (o2 = e2.lookahead); - do { - if (u2[(r2 = t2) + a2] === p2 && u2[r2 + a2 - 1] === d2 && u2[r2] === u2[s2] && u2[++r2] === u2[s2 + 1]) { - s2 += 2, r2++; - do { - } while (u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && s2 < c2); - if (n2 = S - (c2 - s2), s2 = c2 - S, a2 < n2) { - if (e2.match_start = t2, o2 <= (a2 = n2)) - break; - d2 = u2[s2 + a2 - 1], p2 = u2[s2 + a2]; - } - } - } while ((t2 = f2[t2 & l2]) > h2 && 0 != --i2); - return a2 <= e2.lookahead ? a2 : e2.lookahead; - } - function j(e2) { - var t2, r2, n2, i2, s2, a2, o2, h2, u2, l2, f2 = e2.w_size; - do { - if (i2 = e2.window_size - e2.lookahead - e2.strstart, e2.strstart >= f2 + (f2 - z)) { - for (c.arraySet(e2.window, e2.window, f2, f2, 0), e2.match_start -= f2, e2.strstart -= f2, e2.block_start -= f2, t2 = r2 = e2.hash_size; n2 = e2.head[--t2], e2.head[t2] = f2 <= n2 ? n2 - f2 : 0, --r2; ) - ; - for (t2 = r2 = f2; n2 = e2.prev[--t2], e2.prev[t2] = f2 <= n2 ? n2 - f2 : 0, --r2; ) - ; - i2 += f2; - } - if (0 === e2.strm.avail_in) - break; - if (a2 = e2.strm, o2 = e2.window, h2 = e2.strstart + e2.lookahead, u2 = i2, l2 = void 0, l2 = a2.avail_in, u2 < l2 && (l2 = u2), r2 = 0 === l2 ? 0 : (a2.avail_in -= l2, c.arraySet(o2, a2.input, a2.next_in, l2, h2), 1 === a2.state.wrap ? a2.adler = d(a2.adler, o2, l2, h2) : 2 === a2.state.wrap && (a2.adler = p(a2.adler, o2, l2, h2)), a2.next_in += l2, a2.total_in += l2, l2), e2.lookahead += r2, e2.lookahead + e2.insert >= x) - for (s2 = e2.strstart - e2.insert, e2.ins_h = e2.window[s2], e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[s2 + 1]) & e2.hash_mask; e2.insert && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[s2 + x - 1]) & e2.hash_mask, e2.prev[s2 & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = s2, s2++, e2.insert--, !(e2.lookahead + e2.insert < x)); ) - ; - } while (e2.lookahead < z && 0 !== e2.strm.avail_in); - } - function Z(e2, t2) { - for (var r2, n2; ; ) { - if (e2.lookahead < z) { - if (j(e2), e2.lookahead < z && t2 === l) - return A; - if (0 === e2.lookahead) - break; - } - if (r2 = 0, e2.lookahead >= x && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), 0 !== r2 && e2.strstart - r2 <= e2.w_size - z && (e2.match_length = L(e2, r2)), e2.match_length >= x) - if (n2 = u._tr_tally(e2, e2.strstart - e2.match_start, e2.match_length - x), e2.lookahead -= e2.match_length, e2.match_length <= e2.max_lazy_match && e2.lookahead >= x) { - for (e2.match_length--; e2.strstart++, e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart, 0 != --e2.match_length; ) - ; - e2.strstart++; - } else - e2.strstart += e2.match_length, e2.match_length = 0, e2.ins_h = e2.window[e2.strstart], e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + 1]) & e2.hash_mask; - else - n2 = u._tr_tally(e2, 0, e2.window[e2.strstart]), e2.lookahead--, e2.strstart++; - if (n2 && (N(e2, false), 0 === e2.strm.avail_out)) - return A; - } - return e2.insert = e2.strstart < x - 1 ? e2.strstart : x - 1, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : e2.last_lit && (N(e2, false), 0 === e2.strm.avail_out) ? A : I; - } - function W(e2, t2) { - for (var r2, n2, i2; ; ) { - if (e2.lookahead < z) { - if (j(e2), e2.lookahead < z && t2 === l) - return A; - if (0 === e2.lookahead) - break; - } - if (r2 = 0, e2.lookahead >= x && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), e2.prev_length = e2.match_length, e2.prev_match = e2.match_start, e2.match_length = x - 1, 0 !== r2 && e2.prev_length < e2.max_lazy_match && e2.strstart - r2 <= e2.w_size - z && (e2.match_length = L(e2, r2), e2.match_length <= 5 && (1 === e2.strategy || e2.match_length === x && 4096 < e2.strstart - e2.match_start) && (e2.match_length = x - 1)), e2.prev_length >= x && e2.match_length <= e2.prev_length) { - for (i2 = e2.strstart + e2.lookahead - x, n2 = u._tr_tally(e2, e2.strstart - 1 - e2.prev_match, e2.prev_length - x), e2.lookahead -= e2.prev_length - 1, e2.prev_length -= 2; ++e2.strstart <= i2 && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), 0 != --e2.prev_length; ) - ; - if (e2.match_available = 0, e2.match_length = x - 1, e2.strstart++, n2 && (N(e2, false), 0 === e2.strm.avail_out)) - return A; - } else if (e2.match_available) { - if ((n2 = u._tr_tally(e2, 0, e2.window[e2.strstart - 1])) && N(e2, false), e2.strstart++, e2.lookahead--, 0 === e2.strm.avail_out) - return A; - } else - e2.match_available = 1, e2.strstart++, e2.lookahead--; - } - return e2.match_available && (n2 = u._tr_tally(e2, 0, e2.window[e2.strstart - 1]), e2.match_available = 0), e2.insert = e2.strstart < x - 1 ? e2.strstart : x - 1, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : e2.last_lit && (N(e2, false), 0 === e2.strm.avail_out) ? A : I; - } - function M(e2, t2, r2, n2, i2) { - this.good_length = e2, this.max_lazy = t2, this.nice_length = r2, this.max_chain = n2, this.func = i2; - } - function H() { - this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = v, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new c.Buf16(2 * w), this.dyn_dtree = new c.Buf16(2 * (2 * a + 1)), this.bl_tree = new c.Buf16(2 * (2 * o + 1)), D(this.dyn_ltree), D(this.dyn_dtree), D(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new c.Buf16(k + 1), this.heap = new c.Buf16(2 * s + 1), D(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new c.Buf16(2 * s + 1), D(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0; - } - function G(e2) { - var t2; - return e2 && e2.state ? (e2.total_in = e2.total_out = 0, e2.data_type = i, (t2 = e2.state).pending = 0, t2.pending_out = 0, t2.wrap < 0 && (t2.wrap = -t2.wrap), t2.status = t2.wrap ? C : E, e2.adler = 2 === t2.wrap ? 0 : 1, t2.last_flush = l, u._tr_init(t2), m) : R(e2, _); - } - function K(e2) { - var t2 = G(e2); - return t2 === m && function(e3) { - e3.window_size = 2 * e3.w_size, D(e3.head), e3.max_lazy_match = h[e3.level].max_lazy, e3.good_match = h[e3.level].good_length, e3.nice_match = h[e3.level].nice_length, e3.max_chain_length = h[e3.level].max_chain, e3.strstart = 0, e3.block_start = 0, e3.lookahead = 0, e3.insert = 0, e3.match_length = e3.prev_length = x - 1, e3.match_available = 0, e3.ins_h = 0; - }(e2.state), t2; - } - function Y(e2, t2, r2, n2, i2, s2) { - if (!e2) - return _; - var a2 = 1; - if (t2 === g && (t2 = 6), n2 < 0 ? (a2 = 0, n2 = -n2) : 15 < n2 && (a2 = 2, n2 -= 16), i2 < 1 || y < i2 || r2 !== v || n2 < 8 || 15 < n2 || t2 < 0 || 9 < t2 || s2 < 0 || b < s2) - return R(e2, _); - 8 === n2 && (n2 = 9); - var o2 = new H(); - return (e2.state = o2).strm = e2, o2.wrap = a2, o2.gzhead = null, o2.w_bits = n2, o2.w_size = 1 << o2.w_bits, o2.w_mask = o2.w_size - 1, o2.hash_bits = i2 + 7, o2.hash_size = 1 << o2.hash_bits, o2.hash_mask = o2.hash_size - 1, o2.hash_shift = ~~((o2.hash_bits + x - 1) / x), o2.window = new c.Buf8(2 * o2.w_size), o2.head = new c.Buf16(o2.hash_size), o2.prev = new c.Buf16(o2.w_size), o2.lit_bufsize = 1 << i2 + 6, o2.pending_buf_size = 4 * o2.lit_bufsize, o2.pending_buf = new c.Buf8(o2.pending_buf_size), o2.d_buf = 1 * o2.lit_bufsize, o2.l_buf = 3 * o2.lit_bufsize, o2.level = t2, o2.strategy = s2, o2.method = r2, K(e2); - } - h = [new M(0, 0, 0, 0, function(e2, t2) { - var r2 = 65535; - for (r2 > e2.pending_buf_size - 5 && (r2 = e2.pending_buf_size - 5); ; ) { - if (e2.lookahead <= 1) { - if (j(e2), 0 === e2.lookahead && t2 === l) - return A; - if (0 === e2.lookahead) - break; - } - e2.strstart += e2.lookahead, e2.lookahead = 0; - var n2 = e2.block_start + r2; - if ((0 === e2.strstart || e2.strstart >= n2) && (e2.lookahead = e2.strstart - n2, e2.strstart = n2, N(e2, false), 0 === e2.strm.avail_out)) - return A; - if (e2.strstart - e2.block_start >= e2.w_size - z && (N(e2, false), 0 === e2.strm.avail_out)) - return A; - } - return e2.insert = 0, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : (e2.strstart > e2.block_start && (N(e2, false), e2.strm.avail_out), A); - }), new M(4, 4, 8, 4, Z), new M(4, 5, 16, 8, Z), new M(4, 6, 32, 32, Z), new M(4, 4, 16, 16, W), new M(8, 16, 32, 32, W), new M(8, 16, 128, 128, W), new M(8, 32, 128, 256, W), new M(32, 128, 258, 1024, W), new M(32, 258, 258, 4096, W)], r.deflateInit = function(e2, t2) { - return Y(e2, t2, v, 15, 8, 0); - }, r.deflateInit2 = Y, r.deflateReset = K, r.deflateResetKeep = G, r.deflateSetHeader = function(e2, t2) { - return e2 && e2.state ? 2 !== e2.state.wrap ? _ : (e2.state.gzhead = t2, m) : _; - }, r.deflate = function(e2, t2) { - var r2, n2, i2, s2; - if (!e2 || !e2.state || 5 < t2 || t2 < 0) - return e2 ? R(e2, _) : _; - if (n2 = e2.state, !e2.output || !e2.input && 0 !== e2.avail_in || 666 === n2.status && t2 !== f) - return R(e2, 0 === e2.avail_out ? -5 : _); - if (n2.strm = e2, r2 = n2.last_flush, n2.last_flush = t2, n2.status === C) - if (2 === n2.wrap) - e2.adler = 0, U(n2, 31), U(n2, 139), U(n2, 8), n2.gzhead ? (U(n2, (n2.gzhead.text ? 1 : 0) + (n2.gzhead.hcrc ? 2 : 0) + (n2.gzhead.extra ? 4 : 0) + (n2.gzhead.name ? 8 : 0) + (n2.gzhead.comment ? 16 : 0)), U(n2, 255 & n2.gzhead.time), U(n2, n2.gzhead.time >> 8 & 255), U(n2, n2.gzhead.time >> 16 & 255), U(n2, n2.gzhead.time >> 24 & 255), U(n2, 9 === n2.level ? 2 : 2 <= n2.strategy || n2.level < 2 ? 4 : 0), U(n2, 255 & n2.gzhead.os), n2.gzhead.extra && n2.gzhead.extra.length && (U(n2, 255 & n2.gzhead.extra.length), U(n2, n2.gzhead.extra.length >> 8 & 255)), n2.gzhead.hcrc && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending, 0)), n2.gzindex = 0, n2.status = 69) : (U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 9 === n2.level ? 2 : 2 <= n2.strategy || n2.level < 2 ? 4 : 0), U(n2, 3), n2.status = E); - else { - var a2 = v + (n2.w_bits - 8 << 4) << 8; - a2 |= (2 <= n2.strategy || n2.level < 2 ? 0 : n2.level < 6 ? 1 : 6 === n2.level ? 2 : 3) << 6, 0 !== n2.strstart && (a2 |= 32), a2 += 31 - a2 % 31, n2.status = E, P(n2, a2), 0 !== n2.strstart && (P(n2, e2.adler >>> 16), P(n2, 65535 & e2.adler)), e2.adler = 1; - } - if (69 === n2.status) - if (n2.gzhead.extra) { - for (i2 = n2.pending; n2.gzindex < (65535 & n2.gzhead.extra.length) && (n2.pending !== n2.pending_buf_size || (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending !== n2.pending_buf_size)); ) - U(n2, 255 & n2.gzhead.extra[n2.gzindex]), n2.gzindex++; - n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), n2.gzindex === n2.gzhead.extra.length && (n2.gzindex = 0, n2.status = 73); - } else - n2.status = 73; - if (73 === n2.status) - if (n2.gzhead.name) { - i2 = n2.pending; - do { - if (n2.pending === n2.pending_buf_size && (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending === n2.pending_buf_size)) { - s2 = 1; - break; - } - s2 = n2.gzindex < n2.gzhead.name.length ? 255 & n2.gzhead.name.charCodeAt(n2.gzindex++) : 0, U(n2, s2); - } while (0 !== s2); - n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), 0 === s2 && (n2.gzindex = 0, n2.status = 91); - } else - n2.status = 91; - if (91 === n2.status) - if (n2.gzhead.comment) { - i2 = n2.pending; - do { - if (n2.pending === n2.pending_buf_size && (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending === n2.pending_buf_size)) { - s2 = 1; - break; - } - s2 = n2.gzindex < n2.gzhead.comment.length ? 255 & n2.gzhead.comment.charCodeAt(n2.gzindex++) : 0, U(n2, s2); - } while (0 !== s2); - n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), 0 === s2 && (n2.status = 103); - } else - n2.status = 103; - if (103 === n2.status && (n2.gzhead.hcrc ? (n2.pending + 2 > n2.pending_buf_size && F(e2), n2.pending + 2 <= n2.pending_buf_size && (U(n2, 255 & e2.adler), U(n2, e2.adler >> 8 & 255), e2.adler = 0, n2.status = E)) : n2.status = E), 0 !== n2.pending) { - if (F(e2), 0 === e2.avail_out) - return n2.last_flush = -1, m; - } else if (0 === e2.avail_in && T(t2) <= T(r2) && t2 !== f) - return R(e2, -5); - if (666 === n2.status && 0 !== e2.avail_in) - return R(e2, -5); - if (0 !== e2.avail_in || 0 !== n2.lookahead || t2 !== l && 666 !== n2.status) { - var o2 = 2 === n2.strategy ? function(e3, t3) { - for (var r3; ; ) { - if (0 === e3.lookahead && (j(e3), 0 === e3.lookahead)) { - if (t3 === l) - return A; - break; - } - if (e3.match_length = 0, r3 = u._tr_tally(e3, 0, e3.window[e3.strstart]), e3.lookahead--, e3.strstart++, r3 && (N(e3, false), 0 === e3.strm.avail_out)) - return A; - } - return e3.insert = 0, t3 === f ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I; - }(n2, t2) : 3 === n2.strategy ? function(e3, t3) { - for (var r3, n3, i3, s3, a3 = e3.window; ; ) { - if (e3.lookahead <= S) { - if (j(e3), e3.lookahead <= S && t3 === l) - return A; - if (0 === e3.lookahead) - break; - } - if (e3.match_length = 0, e3.lookahead >= x && 0 < e3.strstart && (n3 = a3[i3 = e3.strstart - 1]) === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]) { - s3 = e3.strstart + S; - do { - } while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && i3 < s3); - e3.match_length = S - (s3 - i3), e3.match_length > e3.lookahead && (e3.match_length = e3.lookahead); - } - if (e3.match_length >= x ? (r3 = u._tr_tally(e3, 1, e3.match_length - x), e3.lookahead -= e3.match_length, e3.strstart += e3.match_length, e3.match_length = 0) : (r3 = u._tr_tally(e3, 0, e3.window[e3.strstart]), e3.lookahead--, e3.strstart++), r3 && (N(e3, false), 0 === e3.strm.avail_out)) - return A; - } - return e3.insert = 0, t3 === f ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I; - }(n2, t2) : h[n2.level].func(n2, t2); - if (o2 !== O && o2 !== B || (n2.status = 666), o2 === A || o2 === O) - return 0 === e2.avail_out && (n2.last_flush = -1), m; - if (o2 === I && (1 === t2 ? u._tr_align(n2) : 5 !== t2 && (u._tr_stored_block(n2, 0, 0, false), 3 === t2 && (D(n2.head), 0 === n2.lookahead && (n2.strstart = 0, n2.block_start = 0, n2.insert = 0))), F(e2), 0 === e2.avail_out)) - return n2.last_flush = -1, m; - } - return t2 !== f ? m : n2.wrap <= 0 ? 1 : (2 === n2.wrap ? (U(n2, 255 & e2.adler), U(n2, e2.adler >> 8 & 255), U(n2, e2.adler >> 16 & 255), U(n2, e2.adler >> 24 & 255), U(n2, 255 & e2.total_in), U(n2, e2.total_in >> 8 & 255), U(n2, e2.total_in >> 16 & 255), U(n2, e2.total_in >> 24 & 255)) : (P(n2, e2.adler >>> 16), P(n2, 65535 & e2.adler)), F(e2), 0 < n2.wrap && (n2.wrap = -n2.wrap), 0 !== n2.pending ? m : 1); - }, r.deflateEnd = function(e2) { - var t2; - return e2 && e2.state ? (t2 = e2.state.status) !== C && 69 !== t2 && 73 !== t2 && 91 !== t2 && 103 !== t2 && t2 !== E && 666 !== t2 ? R(e2, _) : (e2.state = null, t2 === E ? R(e2, -3) : m) : _; - }, r.deflateSetDictionary = function(e2, t2) { - var r2, n2, i2, s2, a2, o2, h2, u2, l2 = t2.length; - if (!e2 || !e2.state) - return _; - if (2 === (s2 = (r2 = e2.state).wrap) || 1 === s2 && r2.status !== C || r2.lookahead) - return _; - for (1 === s2 && (e2.adler = d(e2.adler, t2, l2, 0)), r2.wrap = 0, l2 >= r2.w_size && (0 === s2 && (D(r2.head), r2.strstart = 0, r2.block_start = 0, r2.insert = 0), u2 = new c.Buf8(r2.w_size), c.arraySet(u2, t2, l2 - r2.w_size, r2.w_size, 0), t2 = u2, l2 = r2.w_size), a2 = e2.avail_in, o2 = e2.next_in, h2 = e2.input, e2.avail_in = l2, e2.next_in = 0, e2.input = t2, j(r2); r2.lookahead >= x; ) { - for (n2 = r2.strstart, i2 = r2.lookahead - (x - 1); r2.ins_h = (r2.ins_h << r2.hash_shift ^ r2.window[n2 + x - 1]) & r2.hash_mask, r2.prev[n2 & r2.w_mask] = r2.head[r2.ins_h], r2.head[r2.ins_h] = n2, n2++, --i2; ) - ; - r2.strstart = n2, r2.lookahead = x - 1, j(r2); - } - return r2.strstart += r2.lookahead, r2.block_start = r2.strstart, r2.insert = r2.lookahead, r2.lookahead = 0, r2.match_length = r2.prev_length = x - 1, r2.match_available = 0, e2.next_in = o2, e2.input = h2, e2.avail_in = a2, r2.wrap = s2, m; - }, r.deflateInfo = "pako deflate (from Nodeca project)"; - }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./messages": 51, "./trees": 52 }], 47: [function(e, t, r) { - "use strict"; - t.exports = function() { - this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = false; - }; - }, {}], 48: [function(e, t, r) { - "use strict"; - t.exports = function(e2, t2) { - var r2, n, i, s, a, o, h, u, l, f, c, d, p, m, _, g, b, v, y, w, k, x, S, z, C; - r2 = e2.state, n = e2.next_in, z = e2.input, i = n + (e2.avail_in - 5), s = e2.next_out, C = e2.output, a = s - (t2 - e2.avail_out), o = s + (e2.avail_out - 257), h = r2.dmax, u = r2.wsize, l = r2.whave, f = r2.wnext, c = r2.window, d = r2.hold, p = r2.bits, m = r2.lencode, _ = r2.distcode, g = (1 << r2.lenbits) - 1, b = (1 << r2.distbits) - 1; - e: - do { - p < 15 && (d += z[n++] << p, p += 8, d += z[n++] << p, p += 8), v = m[d & g]; - t: - for (; ; ) { - if (d >>>= y = v >>> 24, p -= y, 0 === (y = v >>> 16 & 255)) - C[s++] = 65535 & v; - else { - if (!(16 & y)) { - if (0 == (64 & y)) { - v = m[(65535 & v) + (d & (1 << y) - 1)]; - continue t; - } - if (32 & y) { - r2.mode = 12; - break e; - } - e2.msg = "invalid literal/length code", r2.mode = 30; - break e; - } - w = 65535 & v, (y &= 15) && (p < y && (d += z[n++] << p, p += 8), w += d & (1 << y) - 1, d >>>= y, p -= y), p < 15 && (d += z[n++] << p, p += 8, d += z[n++] << p, p += 8), v = _[d & b]; - r: - for (; ; ) { - if (d >>>= y = v >>> 24, p -= y, !(16 & (y = v >>> 16 & 255))) { - if (0 == (64 & y)) { - v = _[(65535 & v) + (d & (1 << y) - 1)]; - continue r; - } - e2.msg = "invalid distance code", r2.mode = 30; - break e; - } - if (k = 65535 & v, p < (y &= 15) && (d += z[n++] << p, (p += 8) < y && (d += z[n++] << p, p += 8)), h < (k += d & (1 << y) - 1)) { - e2.msg = "invalid distance too far back", r2.mode = 30; - break e; - } - if (d >>>= y, p -= y, (y = s - a) < k) { - if (l < (y = k - y) && r2.sane) { - e2.msg = "invalid distance too far back", r2.mode = 30; - break e; - } - if (S = c, (x = 0) === f) { - if (x += u - y, y < w) { - for (w -= y; C[s++] = c[x++], --y; ) - ; - x = s - k, S = C; - } - } else if (f < y) { - if (x += u + f - y, (y -= f) < w) { - for (w -= y; C[s++] = c[x++], --y; ) - ; - if (x = 0, f < w) { - for (w -= y = f; C[s++] = c[x++], --y; ) - ; - x = s - k, S = C; - } - } - } else if (x += f - y, y < w) { - for (w -= y; C[s++] = c[x++], --y; ) - ; - x = s - k, S = C; - } - for (; 2 < w; ) - C[s++] = S[x++], C[s++] = S[x++], C[s++] = S[x++], w -= 3; - w && (C[s++] = S[x++], 1 < w && (C[s++] = S[x++])); - } else { - for (x = s - k; C[s++] = C[x++], C[s++] = C[x++], C[s++] = C[x++], 2 < (w -= 3); ) - ; - w && (C[s++] = C[x++], 1 < w && (C[s++] = C[x++])); - } - break; - } - } - break; - } - } while (n < i && s < o); - n -= w = p >> 3, d &= (1 << (p -= w << 3)) - 1, e2.next_in = n, e2.next_out = s, e2.avail_in = n < i ? i - n + 5 : 5 - (n - i), e2.avail_out = s < o ? o - s + 257 : 257 - (s - o), r2.hold = d, r2.bits = p; - }; - }, {}], 49: [function(e, t, r) { - "use strict"; - var I = e("../utils/common"), O = e("./adler32"), B = e("./crc32"), R = e("./inffast"), T = e("./inftrees"), D = 1, F = 2, N = 0, U = -2, P = 1, n = 852, i = 592; - function L(e2) { - return (e2 >>> 24 & 255) + (e2 >>> 8 & 65280) + ((65280 & e2) << 8) + ((255 & e2) << 24); - } - function s() { - this.mode = 0, this.last = false, this.wrap = 0, this.havedict = false, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new I.Buf16(320), this.work = new I.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0; - } - function a(e2) { - var t2; - return e2 && e2.state ? (t2 = e2.state, e2.total_in = e2.total_out = t2.total = 0, e2.msg = "", t2.wrap && (e2.adler = 1 & t2.wrap), t2.mode = P, t2.last = 0, t2.havedict = 0, t2.dmax = 32768, t2.head = null, t2.hold = 0, t2.bits = 0, t2.lencode = t2.lendyn = new I.Buf32(n), t2.distcode = t2.distdyn = new I.Buf32(i), t2.sane = 1, t2.back = -1, N) : U; - } - function o(e2) { - var t2; - return e2 && e2.state ? ((t2 = e2.state).wsize = 0, t2.whave = 0, t2.wnext = 0, a(e2)) : U; - } - function h(e2, t2) { - var r2, n2; - return e2 && e2.state ? (n2 = e2.state, t2 < 0 ? (r2 = 0, t2 = -t2) : (r2 = 1 + (t2 >> 4), t2 < 48 && (t2 &= 15)), t2 && (t2 < 8 || 15 < t2) ? U : (null !== n2.window && n2.wbits !== t2 && (n2.window = null), n2.wrap = r2, n2.wbits = t2, o(e2))) : U; - } - function u(e2, t2) { - var r2, n2; - return e2 ? (n2 = new s(), (e2.state = n2).window = null, (r2 = h(e2, t2)) !== N && (e2.state = null), r2) : U; - } - var l, f, c = true; - function j(e2) { - if (c) { - var t2; - for (l = new I.Buf32(512), f = new I.Buf32(32), t2 = 0; t2 < 144; ) - e2.lens[t2++] = 8; - for (; t2 < 256; ) - e2.lens[t2++] = 9; - for (; t2 < 280; ) - e2.lens[t2++] = 7; - for (; t2 < 288; ) - e2.lens[t2++] = 8; - for (T(D, e2.lens, 0, 288, l, 0, e2.work, { bits: 9 }), t2 = 0; t2 < 32; ) - e2.lens[t2++] = 5; - T(F, e2.lens, 0, 32, f, 0, e2.work, { bits: 5 }), c = false; - } - e2.lencode = l, e2.lenbits = 9, e2.distcode = f, e2.distbits = 5; - } - function Z(e2, t2, r2, n2) { - var i2, s2 = e2.state; - return null === s2.window && (s2.wsize = 1 << s2.wbits, s2.wnext = 0, s2.whave = 0, s2.window = new I.Buf8(s2.wsize)), n2 >= s2.wsize ? (I.arraySet(s2.window, t2, r2 - s2.wsize, s2.wsize, 0), s2.wnext = 0, s2.whave = s2.wsize) : (n2 < (i2 = s2.wsize - s2.wnext) && (i2 = n2), I.arraySet(s2.window, t2, r2 - n2, i2, s2.wnext), (n2 -= i2) ? (I.arraySet(s2.window, t2, r2 - n2, n2, 0), s2.wnext = n2, s2.whave = s2.wsize) : (s2.wnext += i2, s2.wnext === s2.wsize && (s2.wnext = 0), s2.whave < s2.wsize && (s2.whave += i2))), 0; - } - r.inflateReset = o, r.inflateReset2 = h, r.inflateResetKeep = a, r.inflateInit = function(e2) { - return u(e2, 15); - }, r.inflateInit2 = u, r.inflate = function(e2, t2) { - var r2, n2, i2, s2, a2, o2, h2, u2, l2, f2, c2, d, p, m, _, g, b, v, y, w, k, x, S, z, C = 0, E = new I.Buf8(4), A = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; - if (!e2 || !e2.state || !e2.output || !e2.input && 0 !== e2.avail_in) - return U; - 12 === (r2 = e2.state).mode && (r2.mode = 13), a2 = e2.next_out, i2 = e2.output, h2 = e2.avail_out, s2 = e2.next_in, n2 = e2.input, o2 = e2.avail_in, u2 = r2.hold, l2 = r2.bits, f2 = o2, c2 = h2, x = N; - e: - for (; ; ) - switch (r2.mode) { - case P: - if (0 === r2.wrap) { - r2.mode = 13; - break; - } - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (2 & r2.wrap && 35615 === u2) { - E[r2.check = 0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0), l2 = u2 = 0, r2.mode = 2; - break; - } - if (r2.flags = 0, r2.head && (r2.head.done = false), !(1 & r2.wrap) || (((255 & u2) << 8) + (u2 >> 8)) % 31) { - e2.msg = "incorrect header check", r2.mode = 30; - break; - } - if (8 != (15 & u2)) { - e2.msg = "unknown compression method", r2.mode = 30; - break; - } - if (l2 -= 4, k = 8 + (15 & (u2 >>>= 4)), 0 === r2.wbits) - r2.wbits = k; - else if (k > r2.wbits) { - e2.msg = "invalid window size", r2.mode = 30; - break; - } - r2.dmax = 1 << k, e2.adler = r2.check = 1, r2.mode = 512 & u2 ? 10 : 12, l2 = u2 = 0; - break; - case 2: - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (r2.flags = u2, 8 != (255 & r2.flags)) { - e2.msg = "unknown compression method", r2.mode = 30; - break; - } - if (57344 & r2.flags) { - e2.msg = "unknown header flags set", r2.mode = 30; - break; - } - r2.head && (r2.head.text = u2 >> 8 & 1), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0, r2.mode = 3; - case 3: - for (; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.head && (r2.head.time = u2), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, E[2] = u2 >>> 16 & 255, E[3] = u2 >>> 24 & 255, r2.check = B(r2.check, E, 4, 0)), l2 = u2 = 0, r2.mode = 4; - case 4: - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.head && (r2.head.xflags = 255 & u2, r2.head.os = u2 >> 8), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0, r2.mode = 5; - case 5: - if (1024 & r2.flags) { - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.length = u2, r2.head && (r2.head.extra_len = u2), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0; - } else - r2.head && (r2.head.extra = null); - r2.mode = 6; - case 6: - if (1024 & r2.flags && (o2 < (d = r2.length) && (d = o2), d && (r2.head && (k = r2.head.extra_len - r2.length, r2.head.extra || (r2.head.extra = new Array(r2.head.extra_len)), I.arraySet(r2.head.extra, n2, s2, d, k)), 512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, r2.length -= d), r2.length)) - break e; - r2.length = 0, r2.mode = 7; - case 7: - if (2048 & r2.flags) { - if (0 === o2) - break e; - for (d = 0; k = n2[s2 + d++], r2.head && k && r2.length < 65536 && (r2.head.name += String.fromCharCode(k)), k && d < o2; ) - ; - if (512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, k) - break e; - } else - r2.head && (r2.head.name = null); - r2.length = 0, r2.mode = 8; - case 8: - if (4096 & r2.flags) { - if (0 === o2) - break e; - for (d = 0; k = n2[s2 + d++], r2.head && k && r2.length < 65536 && (r2.head.comment += String.fromCharCode(k)), k && d < o2; ) - ; - if (512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, k) - break e; - } else - r2.head && (r2.head.comment = null); - r2.mode = 9; - case 9: - if (512 & r2.flags) { - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (u2 !== (65535 & r2.check)) { - e2.msg = "header crc mismatch", r2.mode = 30; - break; - } - l2 = u2 = 0; - } - r2.head && (r2.head.hcrc = r2.flags >> 9 & 1, r2.head.done = true), e2.adler = r2.check = 0, r2.mode = 12; - break; - case 10: - for (; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - e2.adler = r2.check = L(u2), l2 = u2 = 0, r2.mode = 11; - case 11: - if (0 === r2.havedict) - return e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, 2; - e2.adler = r2.check = 1, r2.mode = 12; - case 12: - if (5 === t2 || 6 === t2) - break e; - case 13: - if (r2.last) { - u2 >>>= 7 & l2, l2 -= 7 & l2, r2.mode = 27; - break; - } - for (; l2 < 3; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - switch (r2.last = 1 & u2, l2 -= 1, 3 & (u2 >>>= 1)) { - case 0: - r2.mode = 14; - break; - case 1: - if (j(r2), r2.mode = 20, 6 !== t2) - break; - u2 >>>= 2, l2 -= 2; - break e; - case 2: - r2.mode = 17; - break; - case 3: - e2.msg = "invalid block type", r2.mode = 30; - } - u2 >>>= 2, l2 -= 2; - break; - case 14: - for (u2 >>>= 7 & l2, l2 -= 7 & l2; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if ((65535 & u2) != (u2 >>> 16 ^ 65535)) { - e2.msg = "invalid stored block lengths", r2.mode = 30; - break; - } - if (r2.length = 65535 & u2, l2 = u2 = 0, r2.mode = 15, 6 === t2) - break e; - case 15: - r2.mode = 16; - case 16: - if (d = r2.length) { - if (o2 < d && (d = o2), h2 < d && (d = h2), 0 === d) - break e; - I.arraySet(i2, n2, s2, d, a2), o2 -= d, s2 += d, h2 -= d, a2 += d, r2.length -= d; - break; - } - r2.mode = 12; - break; - case 17: - for (; l2 < 14; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (r2.nlen = 257 + (31 & u2), u2 >>>= 5, l2 -= 5, r2.ndist = 1 + (31 & u2), u2 >>>= 5, l2 -= 5, r2.ncode = 4 + (15 & u2), u2 >>>= 4, l2 -= 4, 286 < r2.nlen || 30 < r2.ndist) { - e2.msg = "too many length or distance symbols", r2.mode = 30; - break; - } - r2.have = 0, r2.mode = 18; - case 18: - for (; r2.have < r2.ncode; ) { - for (; l2 < 3; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.lens[A[r2.have++]] = 7 & u2, u2 >>>= 3, l2 -= 3; - } - for (; r2.have < 19; ) - r2.lens[A[r2.have++]] = 0; - if (r2.lencode = r2.lendyn, r2.lenbits = 7, S = { bits: r2.lenbits }, x = T(0, r2.lens, 0, 19, r2.lencode, 0, r2.work, S), r2.lenbits = S.bits, x) { - e2.msg = "invalid code lengths set", r2.mode = 30; - break; - } - r2.have = 0, r2.mode = 19; - case 19: - for (; r2.have < r2.nlen + r2.ndist; ) { - for (; g = (C = r2.lencode[u2 & (1 << r2.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (b < 16) - u2 >>>= _, l2 -= _, r2.lens[r2.have++] = b; - else { - if (16 === b) { - for (z = _ + 2; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (u2 >>>= _, l2 -= _, 0 === r2.have) { - e2.msg = "invalid bit length repeat", r2.mode = 30; - break; - } - k = r2.lens[r2.have - 1], d = 3 + (3 & u2), u2 >>>= 2, l2 -= 2; - } else if (17 === b) { - for (z = _ + 3; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - l2 -= _, k = 0, d = 3 + (7 & (u2 >>>= _)), u2 >>>= 3, l2 -= 3; - } else { - for (z = _ + 7; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - l2 -= _, k = 0, d = 11 + (127 & (u2 >>>= _)), u2 >>>= 7, l2 -= 7; - } - if (r2.have + d > r2.nlen + r2.ndist) { - e2.msg = "invalid bit length repeat", r2.mode = 30; - break; - } - for (; d--; ) - r2.lens[r2.have++] = k; - } - } - if (30 === r2.mode) - break; - if (0 === r2.lens[256]) { - e2.msg = "invalid code -- missing end-of-block", r2.mode = 30; - break; - } - if (r2.lenbits = 9, S = { bits: r2.lenbits }, x = T(D, r2.lens, 0, r2.nlen, r2.lencode, 0, r2.work, S), r2.lenbits = S.bits, x) { - e2.msg = "invalid literal/lengths set", r2.mode = 30; - break; - } - if (r2.distbits = 6, r2.distcode = r2.distdyn, S = { bits: r2.distbits }, x = T(F, r2.lens, r2.nlen, r2.ndist, r2.distcode, 0, r2.work, S), r2.distbits = S.bits, x) { - e2.msg = "invalid distances set", r2.mode = 30; - break; - } - if (r2.mode = 20, 6 === t2) - break e; - case 20: - r2.mode = 21; - case 21: - if (6 <= o2 && 258 <= h2) { - e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, R(e2, c2), a2 = e2.next_out, i2 = e2.output, h2 = e2.avail_out, s2 = e2.next_in, n2 = e2.input, o2 = e2.avail_in, u2 = r2.hold, l2 = r2.bits, 12 === r2.mode && (r2.back = -1); - break; - } - for (r2.back = 0; g = (C = r2.lencode[u2 & (1 << r2.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (g && 0 == (240 & g)) { - for (v = _, y = g, w = b; g = (C = r2.lencode[w + ((u2 & (1 << v + y) - 1) >> v)]) >>> 16 & 255, b = 65535 & C, !(v + (_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - u2 >>>= v, l2 -= v, r2.back += v; - } - if (u2 >>>= _, l2 -= _, r2.back += _, r2.length = b, 0 === g) { - r2.mode = 26; - break; - } - if (32 & g) { - r2.back = -1, r2.mode = 12; - break; - } - if (64 & g) { - e2.msg = "invalid literal/length code", r2.mode = 30; - break; - } - r2.extra = 15 & g, r2.mode = 22; - case 22: - if (r2.extra) { - for (z = r2.extra; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.length += u2 & (1 << r2.extra) - 1, u2 >>>= r2.extra, l2 -= r2.extra, r2.back += r2.extra; - } - r2.was = r2.length, r2.mode = 23; - case 23: - for (; g = (C = r2.distcode[u2 & (1 << r2.distbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (0 == (240 & g)) { - for (v = _, y = g, w = b; g = (C = r2.distcode[w + ((u2 & (1 << v + y) - 1) >> v)]) >>> 16 & 255, b = 65535 & C, !(v + (_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - u2 >>>= v, l2 -= v, r2.back += v; - } - if (u2 >>>= _, l2 -= _, r2.back += _, 64 & g) { - e2.msg = "invalid distance code", r2.mode = 30; - break; - } - r2.offset = b, r2.extra = 15 & g, r2.mode = 24; - case 24: - if (r2.extra) { - for (z = r2.extra; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.offset += u2 & (1 << r2.extra) - 1, u2 >>>= r2.extra, l2 -= r2.extra, r2.back += r2.extra; - } - if (r2.offset > r2.dmax) { - e2.msg = "invalid distance too far back", r2.mode = 30; - break; - } - r2.mode = 25; - case 25: - if (0 === h2) - break e; - if (d = c2 - h2, r2.offset > d) { - if ((d = r2.offset - d) > r2.whave && r2.sane) { - e2.msg = "invalid distance too far back", r2.mode = 30; - break; - } - p = d > r2.wnext ? (d -= r2.wnext, r2.wsize - d) : r2.wnext - d, d > r2.length && (d = r2.length), m = r2.window; - } else - m = i2, p = a2 - r2.offset, d = r2.length; - for (h2 < d && (d = h2), h2 -= d, r2.length -= d; i2[a2++] = m[p++], --d; ) - ; - 0 === r2.length && (r2.mode = 21); - break; - case 26: - if (0 === h2) - break e; - i2[a2++] = r2.length, h2--, r2.mode = 21; - break; - case 27: - if (r2.wrap) { - for (; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 |= n2[s2++] << l2, l2 += 8; - } - if (c2 -= h2, e2.total_out += c2, r2.total += c2, c2 && (e2.adler = r2.check = r2.flags ? B(r2.check, i2, c2, a2 - c2) : O(r2.check, i2, c2, a2 - c2)), c2 = h2, (r2.flags ? u2 : L(u2)) !== r2.check) { - e2.msg = "incorrect data check", r2.mode = 30; - break; - } - l2 = u2 = 0; - } - r2.mode = 28; - case 28: - if (r2.wrap && r2.flags) { - for (; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (u2 !== (4294967295 & r2.total)) { - e2.msg = "incorrect length check", r2.mode = 30; - break; - } - l2 = u2 = 0; - } - r2.mode = 29; - case 29: - x = 1; - break e; - case 30: - x = -3; - break e; - case 31: - return -4; - case 32: - default: - return U; - } - return e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, (r2.wsize || c2 !== e2.avail_out && r2.mode < 30 && (r2.mode < 27 || 4 !== t2)) && Z(e2, e2.output, e2.next_out, c2 - e2.avail_out) ? (r2.mode = 31, -4) : (f2 -= e2.avail_in, c2 -= e2.avail_out, e2.total_in += f2, e2.total_out += c2, r2.total += c2, r2.wrap && c2 && (e2.adler = r2.check = r2.flags ? B(r2.check, i2, c2, e2.next_out - c2) : O(r2.check, i2, c2, e2.next_out - c2)), e2.data_type = r2.bits + (r2.last ? 64 : 0) + (12 === r2.mode ? 128 : 0) + (20 === r2.mode || 15 === r2.mode ? 256 : 0), (0 == f2 && 0 === c2 || 4 === t2) && x === N && (x = -5), x); - }, r.inflateEnd = function(e2) { - if (!e2 || !e2.state) - return U; - var t2 = e2.state; - return t2.window && (t2.window = null), e2.state = null, N; - }, r.inflateGetHeader = function(e2, t2) { - var r2; - return e2 && e2.state ? 0 == (2 & (r2 = e2.state).wrap) ? U : ((r2.head = t2).done = false, N) : U; - }, r.inflateSetDictionary = function(e2, t2) { - var r2, n2 = t2.length; - return e2 && e2.state ? 0 !== (r2 = e2.state).wrap && 11 !== r2.mode ? U : 11 === r2.mode && O(1, t2, n2, 0) !== r2.check ? -3 : Z(e2, t2, n2, n2) ? (r2.mode = 31, -4) : (r2.havedict = 1, N) : U; - }, r.inflateInfo = "pako inflate (from Nodeca project)"; - }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(e, t, r) { - "use strict"; - var D = e("../utils/common"), F = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], N = [16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78], U = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0], P = [16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64]; - t.exports = function(e2, t2, r2, n, i, s, a, o) { - var h, u, l, f, c, d, p, m, _, g = o.bits, b = 0, v = 0, y = 0, w = 0, k = 0, x = 0, S = 0, z = 0, C = 0, E = 0, A = null, I = 0, O = new D.Buf16(16), B = new D.Buf16(16), R = null, T = 0; - for (b = 0; b <= 15; b++) - O[b] = 0; - for (v = 0; v < n; v++) - O[t2[r2 + v]]++; - for (k = g, w = 15; 1 <= w && 0 === O[w]; w--) - ; - if (w < k && (k = w), 0 === w) - return i[s++] = 20971520, i[s++] = 20971520, o.bits = 1, 0; - for (y = 1; y < w && 0 === O[y]; y++) - ; - for (k < y && (k = y), b = z = 1; b <= 15; b++) - if (z <<= 1, (z -= O[b]) < 0) - return -1; - if (0 < z && (0 === e2 || 1 !== w)) - return -1; - for (B[1] = 0, b = 1; b < 15; b++) - B[b + 1] = B[b] + O[b]; - for (v = 0; v < n; v++) - 0 !== t2[r2 + v] && (a[B[t2[r2 + v]]++] = v); - if (d = 0 === e2 ? (A = R = a, 19) : 1 === e2 ? (A = F, I -= 257, R = N, T -= 257, 256) : (A = U, R = P, -1), b = y, c = s, S = v = E = 0, l = -1, f = (C = 1 << (x = k)) - 1, 1 === e2 && 852 < C || 2 === e2 && 592 < C) - return 1; - for (; ; ) { - for (p = b - S, _ = a[v] < d ? (m = 0, a[v]) : a[v] > d ? (m = R[T + a[v]], A[I + a[v]]) : (m = 96, 0), h = 1 << b - S, y = u = 1 << x; i[c + (E >> S) + (u -= h)] = p << 24 | m << 16 | _ | 0, 0 !== u; ) - ; - for (h = 1 << b - 1; E & h; ) - h >>= 1; - if (0 !== h ? (E &= h - 1, E += h) : E = 0, v++, 0 == --O[b]) { - if (b === w) - break; - b = t2[r2 + a[v]]; - } - if (k < b && (E & f) !== l) { - for (0 === S && (S = k), c += y, z = 1 << (x = b - S); x + S < w && !((z -= O[x + S]) <= 0); ) - x++, z <<= 1; - if (C += 1 << x, 1 === e2 && 852 < C || 2 === e2 && 592 < C) - return 1; - i[l = E & f] = k << 24 | x << 16 | c - s | 0; - } - } - return 0 !== E && (i[c + E] = b - S << 24 | 64 << 16 | 0), o.bits = k, 0; - }; - }, { "../utils/common": 41 }], 51: [function(e, t, r) { - "use strict"; - t.exports = { 2: "need dictionary", 1: "stream end", 0: "", "-1": "file error", "-2": "stream error", "-3": "data error", "-4": "insufficient memory", "-5": "buffer error", "-6": "incompatible version" }; - }, {}], 52: [function(e, t, r) { - "use strict"; - var i = e("../utils/common"), o = 0, h = 1; - function n(e2) { - for (var t2 = e2.length; 0 <= --t2; ) - e2[t2] = 0; - } - var s = 0, a = 29, u = 256, l = u + 1 + a, f = 30, c = 19, _ = 2 * l + 1, g = 15, d = 16, p = 7, m = 256, b = 16, v = 17, y = 18, w = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], k = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], x = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], S = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], z = new Array(2 * (l + 2)); - n(z); - var C = new Array(2 * f); - n(C); - var E = new Array(512); - n(E); - var A = new Array(256); - n(A); - var I = new Array(a); - n(I); - var O, B, R, T = new Array(f); - function D(e2, t2, r2, n2, i2) { - this.static_tree = e2, this.extra_bits = t2, this.extra_base = r2, this.elems = n2, this.max_length = i2, this.has_stree = e2 && e2.length; - } - function F(e2, t2) { - this.dyn_tree = e2, this.max_code = 0, this.stat_desc = t2; - } - function N(e2) { - return e2 < 256 ? E[e2] : E[256 + (e2 >>> 7)]; - } - function U(e2, t2) { - e2.pending_buf[e2.pending++] = 255 & t2, e2.pending_buf[e2.pending++] = t2 >>> 8 & 255; - } - function P(e2, t2, r2) { - e2.bi_valid > d - r2 ? (e2.bi_buf |= t2 << e2.bi_valid & 65535, U(e2, e2.bi_buf), e2.bi_buf = t2 >> d - e2.bi_valid, e2.bi_valid += r2 - d) : (e2.bi_buf |= t2 << e2.bi_valid & 65535, e2.bi_valid += r2); - } - function L(e2, t2, r2) { - P(e2, r2[2 * t2], r2[2 * t2 + 1]); - } - function j(e2, t2) { - for (var r2 = 0; r2 |= 1 & e2, e2 >>>= 1, r2 <<= 1, 0 < --t2; ) - ; - return r2 >>> 1; - } - function Z(e2, t2, r2) { - var n2, i2, s2 = new Array(g + 1), a2 = 0; - for (n2 = 1; n2 <= g; n2++) - s2[n2] = a2 = a2 + r2[n2 - 1] << 1; - for (i2 = 0; i2 <= t2; i2++) { - var o2 = e2[2 * i2 + 1]; - 0 !== o2 && (e2[2 * i2] = j(s2[o2]++, o2)); - } - } - function W(e2) { - var t2; - for (t2 = 0; t2 < l; t2++) - e2.dyn_ltree[2 * t2] = 0; - for (t2 = 0; t2 < f; t2++) - e2.dyn_dtree[2 * t2] = 0; - for (t2 = 0; t2 < c; t2++) - e2.bl_tree[2 * t2] = 0; - e2.dyn_ltree[2 * m] = 1, e2.opt_len = e2.static_len = 0, e2.last_lit = e2.matches = 0; - } - function M(e2) { - 8 < e2.bi_valid ? U(e2, e2.bi_buf) : 0 < e2.bi_valid && (e2.pending_buf[e2.pending++] = e2.bi_buf), e2.bi_buf = 0, e2.bi_valid = 0; - } - function H(e2, t2, r2, n2) { - var i2 = 2 * t2, s2 = 2 * r2; - return e2[i2] < e2[s2] || e2[i2] === e2[s2] && n2[t2] <= n2[r2]; - } - function G(e2, t2, r2) { - for (var n2 = e2.heap[r2], i2 = r2 << 1; i2 <= e2.heap_len && (i2 < e2.heap_len && H(t2, e2.heap[i2 + 1], e2.heap[i2], e2.depth) && i2++, !H(t2, n2, e2.heap[i2], e2.depth)); ) - e2.heap[r2] = e2.heap[i2], r2 = i2, i2 <<= 1; - e2.heap[r2] = n2; - } - function K(e2, t2, r2) { - var n2, i2, s2, a2, o2 = 0; - if (0 !== e2.last_lit) - for (; n2 = e2.pending_buf[e2.d_buf + 2 * o2] << 8 | e2.pending_buf[e2.d_buf + 2 * o2 + 1], i2 = e2.pending_buf[e2.l_buf + o2], o2++, 0 === n2 ? L(e2, i2, t2) : (L(e2, (s2 = A[i2]) + u + 1, t2), 0 !== (a2 = w[s2]) && P(e2, i2 -= I[s2], a2), L(e2, s2 = N(--n2), r2), 0 !== (a2 = k[s2]) && P(e2, n2 -= T[s2], a2)), o2 < e2.last_lit; ) - ; - L(e2, m, t2); - } - function Y(e2, t2) { - var r2, n2, i2, s2 = t2.dyn_tree, a2 = t2.stat_desc.static_tree, o2 = t2.stat_desc.has_stree, h2 = t2.stat_desc.elems, u2 = -1; - for (e2.heap_len = 0, e2.heap_max = _, r2 = 0; r2 < h2; r2++) - 0 !== s2[2 * r2] ? (e2.heap[++e2.heap_len] = u2 = r2, e2.depth[r2] = 0) : s2[2 * r2 + 1] = 0; - for (; e2.heap_len < 2; ) - s2[2 * (i2 = e2.heap[++e2.heap_len] = u2 < 2 ? ++u2 : 0)] = 1, e2.depth[i2] = 0, e2.opt_len--, o2 && (e2.static_len -= a2[2 * i2 + 1]); - for (t2.max_code = u2, r2 = e2.heap_len >> 1; 1 <= r2; r2--) - G(e2, s2, r2); - for (i2 = h2; r2 = e2.heap[1], e2.heap[1] = e2.heap[e2.heap_len--], G(e2, s2, 1), n2 = e2.heap[1], e2.heap[--e2.heap_max] = r2, e2.heap[--e2.heap_max] = n2, s2[2 * i2] = s2[2 * r2] + s2[2 * n2], e2.depth[i2] = (e2.depth[r2] >= e2.depth[n2] ? e2.depth[r2] : e2.depth[n2]) + 1, s2[2 * r2 + 1] = s2[2 * n2 + 1] = i2, e2.heap[1] = i2++, G(e2, s2, 1), 2 <= e2.heap_len; ) - ; - e2.heap[--e2.heap_max] = e2.heap[1], function(e3, t3) { - var r3, n3, i3, s3, a3, o3, h3 = t3.dyn_tree, u3 = t3.max_code, l2 = t3.stat_desc.static_tree, f2 = t3.stat_desc.has_stree, c2 = t3.stat_desc.extra_bits, d2 = t3.stat_desc.extra_base, p2 = t3.stat_desc.max_length, m2 = 0; - for (s3 = 0; s3 <= g; s3++) - e3.bl_count[s3] = 0; - for (h3[2 * e3.heap[e3.heap_max] + 1] = 0, r3 = e3.heap_max + 1; r3 < _; r3++) - p2 < (s3 = h3[2 * h3[2 * (n3 = e3.heap[r3]) + 1] + 1] + 1) && (s3 = p2, m2++), h3[2 * n3 + 1] = s3, u3 < n3 || (e3.bl_count[s3]++, a3 = 0, d2 <= n3 && (a3 = c2[n3 - d2]), o3 = h3[2 * n3], e3.opt_len += o3 * (s3 + a3), f2 && (e3.static_len += o3 * (l2[2 * n3 + 1] + a3))); - if (0 !== m2) { - do { - for (s3 = p2 - 1; 0 === e3.bl_count[s3]; ) - s3--; - e3.bl_count[s3]--, e3.bl_count[s3 + 1] += 2, e3.bl_count[p2]--, m2 -= 2; - } while (0 < m2); - for (s3 = p2; 0 !== s3; s3--) - for (n3 = e3.bl_count[s3]; 0 !== n3; ) - u3 < (i3 = e3.heap[--r3]) || (h3[2 * i3 + 1] !== s3 && (e3.opt_len += (s3 - h3[2 * i3 + 1]) * h3[2 * i3], h3[2 * i3 + 1] = s3), n3--); - } - }(e2, t2), Z(s2, u2, e2.bl_count); - } - function X(e2, t2, r2) { - var n2, i2, s2 = -1, a2 = t2[1], o2 = 0, h2 = 7, u2 = 4; - for (0 === a2 && (h2 = 138, u2 = 3), t2[2 * (r2 + 1) + 1] = 65535, n2 = 0; n2 <= r2; n2++) - i2 = a2, a2 = t2[2 * (n2 + 1) + 1], ++o2 < h2 && i2 === a2 || (o2 < u2 ? e2.bl_tree[2 * i2] += o2 : 0 !== i2 ? (i2 !== s2 && e2.bl_tree[2 * i2]++, e2.bl_tree[2 * b]++) : o2 <= 10 ? e2.bl_tree[2 * v]++ : e2.bl_tree[2 * y]++, s2 = i2, u2 = (o2 = 0) === a2 ? (h2 = 138, 3) : i2 === a2 ? (h2 = 6, 3) : (h2 = 7, 4)); - } - function V(e2, t2, r2) { - var n2, i2, s2 = -1, a2 = t2[1], o2 = 0, h2 = 7, u2 = 4; - for (0 === a2 && (h2 = 138, u2 = 3), n2 = 0; n2 <= r2; n2++) - if (i2 = a2, a2 = t2[2 * (n2 + 1) + 1], !(++o2 < h2 && i2 === a2)) { - if (o2 < u2) - for (; L(e2, i2, e2.bl_tree), 0 != --o2; ) - ; - else - 0 !== i2 ? (i2 !== s2 && (L(e2, i2, e2.bl_tree), o2--), L(e2, b, e2.bl_tree), P(e2, o2 - 3, 2)) : o2 <= 10 ? (L(e2, v, e2.bl_tree), P(e2, o2 - 3, 3)) : (L(e2, y, e2.bl_tree), P(e2, o2 - 11, 7)); - s2 = i2, u2 = (o2 = 0) === a2 ? (h2 = 138, 3) : i2 === a2 ? (h2 = 6, 3) : (h2 = 7, 4); - } - } - n(T); - var q = false; - function J(e2, t2, r2, n2) { - P(e2, (s << 1) + (n2 ? 1 : 0), 3), function(e3, t3, r3, n3) { - M(e3), n3 && (U(e3, r3), U(e3, ~r3)), i.arraySet(e3.pending_buf, e3.window, t3, r3, e3.pending), e3.pending += r3; - }(e2, t2, r2, true); - } - r._tr_init = function(e2) { - q || (function() { - var e3, t2, r2, n2, i2, s2 = new Array(g + 1); - for (n2 = r2 = 0; n2 < a - 1; n2++) - for (I[n2] = r2, e3 = 0; e3 < 1 << w[n2]; e3++) - A[r2++] = n2; - for (A[r2 - 1] = n2, n2 = i2 = 0; n2 < 16; n2++) - for (T[n2] = i2, e3 = 0; e3 < 1 << k[n2]; e3++) - E[i2++] = n2; - for (i2 >>= 7; n2 < f; n2++) - for (T[n2] = i2 << 7, e3 = 0; e3 < 1 << k[n2] - 7; e3++) - E[256 + i2++] = n2; - for (t2 = 0; t2 <= g; t2++) - s2[t2] = 0; - for (e3 = 0; e3 <= 143; ) - z[2 * e3 + 1] = 8, e3++, s2[8]++; - for (; e3 <= 255; ) - z[2 * e3 + 1] = 9, e3++, s2[9]++; - for (; e3 <= 279; ) - z[2 * e3 + 1] = 7, e3++, s2[7]++; - for (; e3 <= 287; ) - z[2 * e3 + 1] = 8, e3++, s2[8]++; - for (Z(z, l + 1, s2), e3 = 0; e3 < f; e3++) - C[2 * e3 + 1] = 5, C[2 * e3] = j(e3, 5); - O = new D(z, w, u + 1, l, g), B = new D(C, k, 0, f, g), R = new D(new Array(0), x, 0, c, p); - }(), q = true), e2.l_desc = new F(e2.dyn_ltree, O), e2.d_desc = new F(e2.dyn_dtree, B), e2.bl_desc = new F(e2.bl_tree, R), e2.bi_buf = 0, e2.bi_valid = 0, W(e2); - }, r._tr_stored_block = J, r._tr_flush_block = function(e2, t2, r2, n2) { - var i2, s2, a2 = 0; - 0 < e2.level ? (2 === e2.strm.data_type && (e2.strm.data_type = function(e3) { - var t3, r3 = 4093624447; - for (t3 = 0; t3 <= 31; t3++, r3 >>>= 1) - if (1 & r3 && 0 !== e3.dyn_ltree[2 * t3]) - return o; - if (0 !== e3.dyn_ltree[18] || 0 !== e3.dyn_ltree[20] || 0 !== e3.dyn_ltree[26]) - return h; - for (t3 = 32; t3 < u; t3++) - if (0 !== e3.dyn_ltree[2 * t3]) - return h; - return o; - }(e2)), Y(e2, e2.l_desc), Y(e2, e2.d_desc), a2 = function(e3) { - var t3; - for (X(e3, e3.dyn_ltree, e3.l_desc.max_code), X(e3, e3.dyn_dtree, e3.d_desc.max_code), Y(e3, e3.bl_desc), t3 = c - 1; 3 <= t3 && 0 === e3.bl_tree[2 * S[t3] + 1]; t3--) - ; - return e3.opt_len += 3 * (t3 + 1) + 5 + 5 + 4, t3; - }(e2), i2 = e2.opt_len + 3 + 7 >>> 3, (s2 = e2.static_len + 3 + 7 >>> 3) <= i2 && (i2 = s2)) : i2 = s2 = r2 + 5, r2 + 4 <= i2 && -1 !== t2 ? J(e2, t2, r2, n2) : 4 === e2.strategy || s2 === i2 ? (P(e2, 2 + (n2 ? 1 : 0), 3), K(e2, z, C)) : (P(e2, 4 + (n2 ? 1 : 0), 3), function(e3, t3, r3, n3) { - var i3; - for (P(e3, t3 - 257, 5), P(e3, r3 - 1, 5), P(e3, n3 - 4, 4), i3 = 0; i3 < n3; i3++) - P(e3, e3.bl_tree[2 * S[i3] + 1], 3); - V(e3, e3.dyn_ltree, t3 - 1), V(e3, e3.dyn_dtree, r3 - 1); - }(e2, e2.l_desc.max_code + 1, e2.d_desc.max_code + 1, a2 + 1), K(e2, e2.dyn_ltree, e2.dyn_dtree)), W(e2), n2 && M(e2); - }, r._tr_tally = function(e2, t2, r2) { - return e2.pending_buf[e2.d_buf + 2 * e2.last_lit] = t2 >>> 8 & 255, e2.pending_buf[e2.d_buf + 2 * e2.last_lit + 1] = 255 & t2, e2.pending_buf[e2.l_buf + e2.last_lit] = 255 & r2, e2.last_lit++, 0 === t2 ? e2.dyn_ltree[2 * r2]++ : (e2.matches++, t2--, e2.dyn_ltree[2 * (A[r2] + u + 1)]++, e2.dyn_dtree[2 * N(t2)]++), e2.last_lit === e2.lit_bufsize - 1; - }, r._tr_align = function(e2) { - P(e2, 2, 3), L(e2, m, z), function(e3) { - 16 === e3.bi_valid ? (U(e3, e3.bi_buf), e3.bi_buf = 0, e3.bi_valid = 0) : 8 <= e3.bi_valid && (e3.pending_buf[e3.pending++] = 255 & e3.bi_buf, e3.bi_buf >>= 8, e3.bi_valid -= 8); - }(e2); - }; - }, { "../utils/common": 41 }], 53: [function(e, t, r) { - "use strict"; - t.exports = function() { - this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0; - }; - }, {}], 54: [function(e, t, r) { - (function(e2) { - !function(r2, n) { - "use strict"; - if (!r2.setImmediate) { - var i, s, t2, a, o = 1, h = {}, u = false, l = r2.document, e3 = Object.getPrototypeOf && Object.getPrototypeOf(r2); - e3 = e3 && e3.setTimeout ? e3 : r2, i = "[object process]" === {}.toString.call(r2.process) ? function(e4) { - process.nextTick(function() { - c(e4); - }); - } : function() { - if (r2.postMessage && !r2.importScripts) { - var e4 = true, t3 = r2.onmessage; - return r2.onmessage = function() { - e4 = false; - }, r2.postMessage("", "*"), r2.onmessage = t3, e4; - } - }() ? (a = "setImmediate$" + Math.random() + "$", r2.addEventListener ? r2.addEventListener("message", d, false) : r2.attachEvent("onmessage", d), function(e4) { - r2.postMessage(a + e4, "*"); - }) : r2.MessageChannel ? ((t2 = new MessageChannel()).port1.onmessage = function(e4) { - c(e4.data); - }, function(e4) { - t2.port2.postMessage(e4); - }) : l && "onreadystatechange" in l.createElement("script") ? (s = l.documentElement, function(e4) { - var t3 = l.createElement("script"); - t3.onreadystatechange = function() { - c(e4), t3.onreadystatechange = null, s.removeChild(t3), t3 = null; - }, s.appendChild(t3); - }) : function(e4) { - setTimeout(c, 0, e4); - }, e3.setImmediate = function(e4) { - "function" != typeof e4 && (e4 = new Function("" + e4)); - for (var t3 = new Array(arguments.length - 1), r3 = 0; r3 < t3.length; r3++) - t3[r3] = arguments[r3 + 1]; - var n2 = { callback: e4, args: t3 }; - return h[o] = n2, i(o), o++; - }, e3.clearImmediate = f; - } - function f(e4) { - delete h[e4]; - } - function c(e4) { - if (u) - setTimeout(c, 0, e4); - else { - var t3 = h[e4]; - if (t3) { - u = true; - try { - !function(e5) { - var t4 = e5.callback, r3 = e5.args; - switch (r3.length) { - case 0: - t4(); - break; - case 1: - t4(r3[0]); - break; - case 2: - t4(r3[0], r3[1]); - break; - case 3: - t4(r3[0], r3[1], r3[2]); - break; - default: - t4.apply(n, r3); - } - }(t3); - } finally { - f(e4), u = false; - } - } - } - } - function d(e4) { - e4.source === r2 && "string" == typeof e4.data && 0 === e4.data.indexOf(a) && c(+e4.data.slice(a.length)); - } - }("undefined" == typeof self ? void 0 === e2 ? this : e2 : self); - }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}); - }, {}] }, {}, [10])(10); - }); - } - }); - - // ../components/smart-camera-web.js - var VERSION = "1.0.2"; - var DEFAULT_NO_OF_LIVENESS_FRAMES = 8; - var PORTRAIT_ID_PREVIEW_WIDTH = 396; - var PORTRAIT_ID_PREVIEW_HEIGHT = 527; - function isSamsungMultiCameraDevice() { - const matchedModelNumber = navigator.userAgent.match(/SM-[N|G]\d{3}/); - if (!matchedModelNumber) { - return false; - } - const modelNumber = parseInt(matchedModelNumber[0].match(/\d{3}/)[0], 10); - const smallerModelNumber = 970; - return !Number.isNaN(modelNumber) && modelNumber >= smallerModelNumber; - } - function getLivenessFramesIndices(totalNoOfFrames, numberOfFramesRequired = DEFAULT_NO_OF_LIVENESS_FRAMES) { - const selectedFrames = []; - if (totalNoOfFrames < numberOfFramesRequired) { - throw new Error("SmartCameraWeb: Minimum required no of frames is ", numberOfFramesRequired); - } - const frameDivisor = numberOfFramesRequired - 1; - const frameInterval = Math.floor(totalNoOfFrames / frameDivisor); - let replacementFrameIndex = 1; - for (let i = 0; i < totalNoOfFrames; i += frameInterval) { - if (selectedFrames.length < 8) { - selectedFrames.push(i); - } else { - selectedFrames[replacementFrameIndex] = i; - selectedFrames.sort((a, b) => a - b); - replacementFrameIndex += 1; - } - } - const lastFrameIndex = totalNoOfFrames - 1; - if (selectedFrames.length < 8 && !selectedFrames.includes(lastFrameIndex)) { - selectedFrames.push(lastFrameIndex); - } - return selectedFrames; - } - var SmartFileUpload = class _SmartFileUpload { - static memoryLimit = 1024e4; - static supportedTypes = ["image/jpeg", "image/png"]; - static getHumanSize(numberOfBytes) { - const units = [ - "B", - "kB", - "MB", - "GB", - "TB", - "PB", - "EB", - "ZB", - "YB" - ]; - const exponent = Math.min( - Math.floor(Math.log(numberOfBytes) / Math.log(1024)), - units.length - 1 - ); - const approx = numberOfBytes / 1024 ** exponent; - const output = exponent === 0 ? `${numberOfBytes} bytes` : `${approx.toFixed(0)} ${units[exponent]}`; - return output; - } - static getData(file) { - return new Promise((resolve, reject) => { - const reader = new FileReader(); - reader.onload = (e) => { - resolve(e.target.result); - }; - reader.onerror = () => { - reject(new Error("An error occurred reading the file. Please check the file, and try again")); - }; - reader.readAsDataURL(file); - }); - } - static async retrieve(files) { - if (files.length > 1) { - throw new Error("Only one file upload is permitted at a time"); - } - const file = files[0]; - if (!_SmartFileUpload.supportedTypes.includes(file.type)) { - throw new Error("Unsupported file format. Please ensure that you are providing a JPG or PNG image"); - } - if (file.size > _SmartFileUpload.memoryLimit) { - throw new Error(`${file.name} is too large. Please ensure that the file is less than ${_SmartFileUpload.getHumanSize(_SmartFileUpload.memoryLimit)}.`); - } - const imageAsDataUrl = await _SmartFileUpload.getData(file); - return imageAsDataUrl; - } - }; - function scwTemplateString() { - return ` - - - - - - - - - - - - - - - -
-

-

-
- -
- ${this.showNavigation ? ` - - ` : ""} -
-

- We need access to your camera so that we can take selfie and proof-of-life images. -

- - - - ${this.hideAttribution ? "" : ` - - `} -
-
- - - - - - - - - - - - - - - - - - - - - - `; - } - var PoweredBySmileId = class extends HTMLElement { - constructor() { - super(); - const template = document.createElement("template"); - template.innerHTML = ` -

- - - - - - - - - - - - - - - - - - - -

- `; - this.attachShadow({ mode: "open" }).appendChild(template.content.cloneNode(true)); - } - }; - function hasMoreThanNColors(data, n = 16) { - const colors = /* @__PURE__ */ new Set(); - for (let i = 0; i < Math.min(data.length, 1e4); i += 4) { - colors.add(data[i] << 16 | data[i + 1] << 8 | data[i + 2]); - if (colors.size > n) { - return true; - } - } - return false; - } - window.customElements.define("powered-by-smile-id", PoweredBySmileId); - var SmartCameraWeb = class extends HTMLElement { - constructor() { - super(); - this.scwTemplateString = scwTemplateString.bind(this); - this.render = () => this.scwTemplateString(); - this.attachShadow({ mode: "open" }); - this.activeScreen = null; - } - setActiveScreen(element) { - this.activeScreen.hidden = true; - element.hidden = false; - this.activeScreen = element; - } - connectedCallback() { - this.shadowRoot.innerHTML = this.render(); - if ("mediaDevices" in navigator && "getUserMedia" in navigator.mediaDevices) { - this.setUpEventListeners(); - } else { - const heading = document.createElement("h1"); - heading.classList.add("error-message"); - heading.textContent = "Your browser does not support this integration"; - this.shadowRoot.innerHTML = heading; - } - } - disconnectedCallback() { - if (this.activeScreen) { - this.activeScreen.hidden = true; - } - this.activeScreen = null; - this.shadowRoot.innerHTML = ""; - } - static get observedAttributes() { - return ["document-capture-modes", "document-type", "hide-back-to-host", "show-navigation"]; - } - attributeChangedCallback(name) { - switch (name) { - case "document-capture-modes": - case "document-type": - case "hide-back-to-host": - case "show-navigation": - this.shadowRoot.innerHTML = this.render(); - this.setUpEventListeners(); - break; - default: - break; - } - } - setUpEventListeners() { - this.errorMessage = this.shadowRoot.querySelector("#error"); - this.requestScreen = this.shadowRoot.querySelector("#request-screen"); - this.activeScreen = this.requestScreen; - this.cameraScreen = this.shadowRoot.querySelector("#camera-screen"); - this.failedImageTestScreen = this.shadowRoot.querySelector("#failed-image-test-screen"); - this.reviewScreen = this.shadowRoot.querySelector("#review-screen"); - this.idEntryScreen = this.shadowRoot.querySelector("#id-entry-screen"); - this.IDCameraScreen = this.shadowRoot.querySelector("#id-camera-screen"); - this.IDReviewScreen = this.shadowRoot.querySelector("#id-review-screen"); - this.backOfIdEntryScreen = this.shadowRoot.querySelector("#back-of-id-entry-screen"); - this.backOfIDCameraScreen = this.shadowRoot.querySelector("#back-of-id-camera-screen"); - this.backOfIDReviewScreen = this.shadowRoot.querySelector("#back-of-id-review-screen"); - this.thanksScreen = this.shadowRoot.querySelector("#thanks-screen"); - this.videoContainer = this.shadowRoot.querySelector(".video-container > .video"); - this.smileCTA = this.shadowRoot.querySelector("#smile-cta"); - this.imageOutline = this.shadowRoot.querySelector("#image-outline path"); - this.startImageCapture = this.shadowRoot.querySelector("#start-image-capture"); - this.captureIDImage = this.shadowRoot.querySelector("#capture-id-image"); - this.captureBackOfIDImage = this.shadowRoot.querySelector("#capture-back-of-id-image"); - this.reviewImage = this.shadowRoot.querySelector("#review-image"); - this.IDReviewImage = this.shadowRoot.querySelector("#id-review-image"); - this.backOfIDReviewImage = this.shadowRoot.querySelector("#back-of-id-review-image"); - this.reStartImageCapture = this.shadowRoot.querySelector("#restart-image-capture"); - this.reCaptureIDImage = this.shadowRoot.querySelector("#re-capture-id-image"); - this.reCaptureBackOfIDImage = this.shadowRoot.querySelector("#re-capture-back-of-id-image"); - this.selectSelfie = this.shadowRoot.querySelector("#select-selfie"); - this.selectIDImage = this.shadowRoot.querySelector("#select-id-image"); - this.selectBackOfIDImage = this.shadowRoot.querySelector("#select-back-of-id-image"); - this.takeDocumentPhotoButton = this.idEntryScreen.querySelector("#take-photo"); - this.uploadDocumentPhotoButton = this.idEntryScreen.querySelector("#upload-photo"); - this.skipBackOfDocumentPhotoButton = this.backOfIdEntryScreen.querySelector("#skip-this-step"); - this.takeBackOfDocumentPhotoButton = this.backOfIdEntryScreen.querySelector("#take-photo"); - this.uploadBackOfDocumentPhotoButton = this.backOfIdEntryScreen.querySelector("#upload-photo"); - this.shadowRoot.querySelector("#request-camera-access").addEventListener("click", () => this.init()); - if (this.showNavigation) { - const backButtons = this.shadowRoot.querySelectorAll(".back-button-exit"); - backButtons.forEach((button) => { - button.addEventListener("click", () => { - this._backAndExit(); - }); - }); - const closeButtons = this.shadowRoot.querySelectorAll(".close-iframe"); - closeButtons.forEach((button) => { - button.addEventListener("click", () => { - this._exitSmartCamera(); - }); - }); - } - if (this.takeDocumentPhotoButton) - this.takeDocumentPhotoButton.addEventListener("click", () => this._startIDCamera()); - if (this.skipBackOfDocumentPhotoButton) - this.skipBackOfDocumentPhotoButton.addEventListener("click", () => this._skipBackDocument()); - if (this.takeBackOfDocumentPhotoButton) - this.takeBackOfDocumentPhotoButton.addEventListener("click", () => this._startIDCamera()); - if (this.uploadDocumentPhotoButton) - this.uploadDocumentPhotoButton.addEventListener("change", (e) => this._uploadDocument(e)); - if (this.uploadBackOfDocumentPhotoButton) - this.uploadBackOfDocumentPhotoButton.addEventListener("change", (e) => this._uploadDocument(e)); - this.backToSelfie = this.shadowRoot.querySelector("#back-button-selfie"); - this.backToIdEntryButton = this.shadowRoot.querySelector("#back-button-id-entry"); - this.backToBackIdEntryButton = this.shadowRoot.querySelector("#back-button-back-id-entry"); - this.backToIdImageButton = this.shadowRoot.querySelector("#back-button-id-image"); - if (this.backToSelfie) { - this.backToSelfie.addEventListener("click", () => { - this._reStartImageCapture(); - }); - } - if (this.backToIdEntryButton) { - this.backToIdEntryButton.addEventListener("click", () => { - this.setActiveScreen(this.idEntryScreen); - }); - } - if (this.backToBackIdEntryButton) { - this.backToBackIdEntryButton.addEventListener("click", () => { - this.setActiveScreen(this.backOfIdEntryScreen); - }); - } - if (this.backToIdImageButton) { - this.backToIdImageButton.addEventListener("click", () => { - this.setActiveScreen(this.IDReviewScreen); - }); - } - this.startImageCapture.addEventListener("click", () => { - this._startImageCapture(); - }); - this.selectSelfie.addEventListener("click", () => { - this._selectSelfie(); - }); - this.selectIDImage.addEventListener("click", () => { - this._selectIDImage(); - }); - this.selectBackOfIDImage.addEventListener("click", () => { - this._selectIDImage(true); - }); - this.captureIDImage.addEventListener("click", () => { - this._captureIDImage(); - }); - this.captureBackOfIDImage.addEventListener("click", () => { - this._captureIDImage(); - }); - this.reStartImageCapture.addEventListener("click", () => { - this._reStartImageCapture(); - }); - this.reCaptureIDImage.addEventListener("click", () => { - this._reCaptureIDImage(); - }); - this.reCaptureBackOfIDImage.addEventListener("click", () => { - this._reCaptureIDImage(); - }); - } - init() { - this._videoStreamDurationInMS = 7800; - this._imageCaptureIntervalInMS = 200; - this._data = { - images: [], - partner_params: { - libraryVersion: VERSION, - permissionGranted: false - } - }; - this._rawImages = []; - navigator.mediaDevices.getUserMedia({ audio: false, video: true }).then((stream) => { - this.handleSuccess(stream); - }).catch((e) => { - this.handleError(e); - }); - } - reset() { - this.disconnectedCallback(); - this.connectedCallback(); - } - resetErrorMessage() { - this.errorMessage.textContent = ""; - } - handleSuccess(stream) { - const videoExists = !!this.videoContainer.querySelector("video"); - const video = videoExists ? this.videoContainer.querySelector("video") : document.createElement("video"); - video.autoplay = true; - video.playsInline = true; - video.muted = true; - if ("srcObject" in video) { - video.srcObject = stream; - } else { - video.src = window.URL.createObjectURL(stream); - } - video.play(); - if (!videoExists) - this.videoContainer.prepend(video); - this._data.partner_params.permissionGranted = true; - this.setActiveScreen(this.cameraScreen); - this._stream = stream; - this._video = video; - } - handleIDStream(stream) { - const videoExists = this.activeScreen === this.IDCameraScreen ? !!this.IDCameraScreen.querySelector("video") : !!this.backOfIDCameraScreen.querySelector("video"); - let video = null; - if (videoExists) { - if (this.activeScreen === this.IDCameraScreen) { - video = this.IDCameraScreen.querySelector("video"); - } else { - video = this.backOfIDCameraScreen.querySelector("video"); - } - } else { - video = document.createElement("video"); - } - video.autoplay = true; - video.playsInline = true; - video.muted = true; - if ("srcObject" in video) { - video.srcObject = stream; - } else { - video.src = window.URL.createObjectURL(stream); - } - video.play(); - const videoContainer = this.activeScreen === this.IDCameraScreen ? this.IDCameraScreen.querySelector(".id-video-container") : this.backOfIDCameraScreen.querySelector(".id-video-container"); - video.onloadedmetadata = () => { - videoContainer.querySelector(".actions").hidden = false; - }; - if (!videoExists) { - videoContainer.prepend(video); - } - this._IDStream = stream; - this._IDVideo = video; - } - handleError(e) { - switch (e.name) { - case "NotAllowedError": - case "SecurityError": - this.errorMessage.textContent = ` - Looks like camera access was not granted, or was blocked by a browser - level setting / extension. Please follow the prompt from the URL bar, - or extensions, and enable access. - You may need to refresh to start all over again - `; - break; - case "AbortError": - this.errorMessage.textContent = ` - Oops! Something happened, and we lost access to your stream. - Please refresh to start all over again - `; - break; - case "NotReadableError": - this.errorMessage.textContent = ` - There seems to be a problem with your device's camera, or its connection. - Please check this, and when resolved, try again. Or try another device. - `; - break; - case "NotFoundError": - this.errorMessage.textContent = ` - We are unable to find a video stream. - You may need to refresh to start all over again - `; - break; - case "TypeError": - this.errorMessage.textContent = ` - This site is insecure, and as such cannot have access to your camera. - Try to navigate to a secure version of this page, or contact the owner. - `; - break; - default: - this.errorMessage.textContent = e.message; - } - } - _startImageCapture() { - this.startImageCapture.disabled = true; - const imageOutlineLength = this.imageOutline.getTotalLength(); - this.imageOutline.style.transition = "none"; - this.imageOutline.style.strokeDasharray = `${imageOutlineLength} ${imageOutlineLength}`; - this.imageOutline.style.strokeDashoffset = imageOutlineLength; - this.imageOutline.getBoundingClientRect(); - this.imageOutline.style.transition = `stroke-dashoffset ${this._videoStreamDurationInMS / 1e3}s ease-in-out`; - this.imageOutline.style.strokeDashoffset = "0"; - this.smileCTA.style.animation = `fadeInOut ease ${this._videoStreamDurationInMS / 1e3}s`; - this._imageCaptureInterval = setInterval(() => { - this._capturePOLPhoto(); - }, this._imageCaptureIntervalInMS); - this._videoStreamTimeout = setTimeout(() => { - this._stopVideoStream(this._stream); - }, this._videoStreamDurationInMS); - } - _captureIDImage() { - const image = this._drawIDImage(); - if (this.activeScreen === this.IDCameraScreen) { - this.IDReviewImage.src = image; - } else { - this.backOfIDReviewImage.src = image; - } - this._data.images.push({ - image: image.split(",")[1], - image_type_id: this.activeScreen === this.IDCameraScreen ? 3 : 7 - }); - this._stopIDVideoStream(); - if (this.activeScreen === this.IDCameraScreen) { - this.setActiveScreen(this.IDReviewScreen); - } else { - this.setActiveScreen(this.backOfIDReviewScreen); - } - } - _drawImage(canvas, enableImageTests = true, video = this._video) { - this.resetErrorMessage(); - const context = canvas.getContext("2d"); - context.drawImage( - video, - 0, - 0, - video.videoWidth, - video.videoHeight, - 0, - 0, - canvas.width, - canvas.height - ); - if (enableImageTests) { - const imageData = context.getImageData(0, 0, canvas.width, canvas.height); - const hasEnoughColors = hasMoreThanNColors(imageData.data); - if (hasEnoughColors) { - return context; - } - throw new Error("Unable to capture webcam images - Please try another device"); - } else { - return context; - } - } - _capturePOLPhoto() { - const canvas = document.createElement("canvas"); - canvas.width = 240; - canvas.height = canvas.width * this._video.videoHeight / this._video.videoWidth; - this._drawImage(canvas, false); - this._rawImages.push(canvas.toDataURL("image/jpeg")); - } - _captureReferencePhoto() { - const canvas = document.createElement("canvas"); - canvas.width = 480; - canvas.height = canvas.width * this._video.videoHeight / this._video.videoWidth; - this._drawImage(canvas, !this.disableImageTests); - const image = canvas.toDataURL("image/jpeg"); - this._referenceImage = image; - this._data.images.push({ - image: image.split(",")[1], - image_type_id: 2 - }); - } - _skipBackDocument() { - this._publishSelectedImages(); - } - async _uploadDocument(event) { - this.resetErrorMessage(); - try { - const { files } = event.target; - const fileData = await SmartFileUpload.retrieve(files); - this._data.images.push({ - // NOTE: data URLs start with a file type before the base64 data, - // separated by a comma. - // - // we are only interested in the base64 segment, so we extract it - image: fileData.split(",")[1], - image_type_id: this.activeScreen === this.idEntryScreen ? 3 : 7 - }); - const nextScreen = this.activeScreen === this.idEntryScreen ? this.IDReviewScreen : this.backOfIDReviewScreen; - const previewImage = nextScreen.querySelector("img"); - previewImage.src = fileData; - this.setActiveScreen(nextScreen); - } catch (error) { - this.handleError(error); - } - } - _drawIDImage(video = this._IDVideo) { - const canvas = document.createElement("canvas"); - if (this.isPortraitCaptureView) { - canvas.width = video.videoWidth; - canvas.height = video.videoHeight; - const ctx = canvas.getContext("2d"); - ctx.drawImage(video, 0, 0, canvas.width, canvas.height); - const previewWidth = PORTRAIT_ID_PREVIEW_WIDTH; - const previewHeight = PORTRAIT_ID_PREVIEW_HEIGHT; - const paddingPercent = 0.5; - const paddedWidth = previewWidth * (1 + paddingPercent); - const paddedHeight = previewHeight * (1 + paddingPercent); - const cropWidth = paddedWidth; - const cropHeight = paddedHeight; - const cropLeft = (canvas.width - cropWidth) / 2; - const cropTop = (canvas.height - cropHeight) / 2; - const croppedCanvas = document.createElement("canvas"); - croppedCanvas.width = cropWidth; - croppedCanvas.height = cropHeight; - const croppedCtx = croppedCanvas.getContext("2d"); - croppedCtx.drawImage(canvas, cropLeft, cropTop, cropWidth, cropHeight, 0, 0, cropWidth, cropHeight); - return croppedCanvas.toDataURL("image/jpeg"); - } - canvas.width = 2240; - canvas.height = 1260; - const context = canvas.getContext("2d"); - const aspectRatio = video.videoWidth / video.videoHeight; - if (aspectRatio < 1) { - const imageFrame = this.activeScreen.querySelector('[class*="image-frame"]:not([hidden]) [href*="image-frame"]'); - const videoBox = video.getBoundingClientRect(); - const frameBox = imageFrame.getBoundingClientRect(); - const sourceXOffset = (frameBox.left - videoBox.left) / videoBox.width * video.videoWidth; - const sourceYOffset = (frameBox.top - videoBox.top) / videoBox.height * video.videoHeight; - const sourceWidth = frameBox.width * (video.videoWidth / videoBox.width); - const sourceHeight = frameBox.height * (video.videoHeight / videoBox.height); - canvas.height = canvas.width * frameBox.height / frameBox.width; - context.drawImage(video, sourceXOffset, sourceYOffset, sourceWidth, sourceHeight, 0, 0, canvas.width, canvas.height); - return canvas.toDataURL("image/jpeg"); - } - context.drawImage(video, 0, 0, canvas.width, canvas.height); - return canvas.toDataURL("image/jpeg"); - } - _stopVideoStream(stream) { - try { - clearTimeout(this._videoStreamTimeout); - clearInterval(this._imageCaptureInterval); - clearInterval(this._drawingInterval); - this.smileCTA.style.animation = "none"; - this._capturePOLPhoto(); - this._captureReferencePhoto(); - stream.getTracks().forEach((track) => track.stop()); - this.reviewImage.src = this._referenceImage; - const totalNoOfFrames = this._rawImages.length; - const livenessFramesIndices = getLivenessFramesIndices(totalNoOfFrames); - this._data.images = this._data.images.concat(livenessFramesIndices.map((imageIndex) => ({ - image: this._rawImages[imageIndex].split(",")[1], - image_type_id: 6 - }))); - this.setActiveScreen(this.reviewScreen); - } catch (error) { - this.setActiveScreen(this.failedImageTestScreen); - } - } - _stopIDVideoStream(stream = this._IDStream) { - stream.getTracks().forEach((track) => track.stop()); - } - async _startIDCamera() { - try { - const stream = await navigator.mediaDevices.getUserMedia({ - audio: false, - video: { - facingMode: "environment", - width: { min: 1280 }, - // NOTE: Special case for multi-camera Samsung devices (learnt from Acuant) - // "We found out that some triple camera Samsung devices (S10, S20, Note 20, etc) capture images blurry at edges. - // Zooming to 2X, matching the telephoto lens, doesn't solve it completely but mitigates it." - zoom: isSamsungMultiCameraDevice() ? 2 : 1 - } - }); - if (this.activeScreen === this.idEntryScreen) { - this.setActiveScreen(this.IDCameraScreen); - } else if (this.activeScreen === this.backOfIdEntryScreen) { - this.setActiveScreen(this.backOfIDCameraScreen); - } - this.handleIDStream(stream); - } catch (e) { - this.handleError(e); - } - } - _selectSelfie() { - if (!this.captureID) { - this._publishSelectedImages(); - } else { - this.setActiveScreen(this.idEntryScreen); - } - } - _selectIDImage(backOfIDCaptured = false) { - if (!this.captureBackOfID || backOfIDCaptured) { - this._publishSelectedImages(); - } else { - this.setActiveScreen(this.backOfIdEntryScreen); - } - } - _publishSelectedImages() { - this.dispatchEvent( - new CustomEvent("imagesComputed", { detail: this._data }) - ); - this.setActiveScreen(this.thanksScreen); - } - _exitSmartCamera() { - this.dispatchEvent( - new CustomEvent("close", { detail: {} }) - ); - } - _backAndExit() { - this.dispatchEvent( - new CustomEvent("backExit", { detail: {} }) - ); - } - async _reStartImageCapture() { - this.startImageCapture.disabled = false; - this._rawImages = []; - this._data.images = []; - try { - const stream = await navigator.mediaDevices.getUserMedia({ - audio: false, - video: true - }); - this.handleSuccess(stream); - } catch (e) { - this.handleError(e); - } - } - async _reCaptureIDImage() { - const previousScreen = this.activeScreen === this.IDReviewScreen ? this.idEntryScreen : this.backOfIdEntryScreen; - this.setActiveScreen(previousScreen); - this._data.images.pop(); - } - get captureID() { - return this.hasAttribute("capture-id"); - } - get captureBackOfID() { - return this.getAttribute("capture-id") === "back" || false; - } - get hideAttribution() { - return this.hasAttribute("hide-attribution"); - } - get showNavigation() { - return this.hasAttribute("show-navigation"); - } - get hideBackToHost() { - return this.hasAttribute("hide-back-to-host"); - } - get documentType() { - return this.getAttribute("document-type"); - } - get isPortraitCaptureView() { - return this.getAttribute("document-type") === "GREEN_BOOK"; - } - get documentCaptureModes() { - return this.getAttribute("document-capture-modes") || "camera"; - } - get supportBothCaptureModes() { - const value = this.documentCaptureModes; - return value.includes("camera") && value.includes("upload"); - } - get disableImageTests() { - return this.hasAttribute("disable-image-tests"); - } - get doNotUpload() { - return this.getAttribute("document-capture-modes") === "camera"; - } - }; - window.customElements.define("smart-camera-web", SmartCameraWeb); - - // src/js/doc-verification.js - var import_jszip = __toESM(require_jszip_min(), 1); - - // package.json - var version = "v1.2.3"; - - // src/js/components/Combobox.js - function generateId(prefix) { - const id = [...Array(30)].map(() => Math.random().toString(36)[3]).join(""); - return `${prefix}-${id}`; - } - function isElementInView(element) { - const bounding = element.getBoundingClientRect(); - return bounding.top >= 0 && bounding.left >= 0 && bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) && bounding.right <= (window.innerWidth || document.documentElement.clientWidth); - } - function isScrollable(element) { - return element && element.clientHeight < element.scrollHeight; - } - function maintainScrollVisibility(activeElement, scrollParent) { - const { offsetHeight, offsetTop } = activeElement; - const { offsetHeight: parentOffsetHeight, scrollTop } = scrollParent; - const isAbove = offsetTop < scrollTop; - const isBelow = offsetTop + offsetHeight > scrollTop + parentOffsetHeight; - if (isAbove) { - scrollParent.scrollTo(0, offsetTop); - } else if (isBelow) { - scrollParent.scrollTo(0, offsetTop - parentOffsetHeight + offsetHeight); - } - } - var ComboboxRoot = class extends HTMLElement { - constructor() { - super(); - this.handleRoaming = this.handleRoaming.bind(this); - } - connectedCallback() { - this.trigger = this.querySelector("smileid-combobox-trigger"); - document.addEventListener("click", this.handleRoaming); - this.addEventListener("focusout", this.handleRoaming); - this.addEventListener("blur", this.handleRoaming); - } - disconnectedCallback() { - document.removeEventListener("click", this.handleRoaming); - this.removeEventListener("focusout", this.handleRoaming); - this.removeEventListener("blur", this.handleRoaming); - } - handleRoaming(event) { - const target = event.relatedTarget || event.target; - if (this.contains(target)) { - return; - } - if (this.trigger.getAttribute("expanded") === "true") { - this.trigger.setAttribute("expanded", "false"); - } - } - }; - var ComboboxTrigger = class extends HTMLElement { - constructor() { - super(); - this.handleKeyUp = this.handleKeyUp.bind(this); - this.handleKeyDown = this.handleKeyDown.bind(this); - this.handleSelection = this.handleSelection.bind(this); - this.toggleExpansionState = this.toggleExpansionState.bind(this); - } - get type() { - return this.getAttribute("type") || "text"; - } - get label() { - return this.getAttribute("label") || ""; - } - get value() { - return this.getAttribute("value") || ""; - } - get disabled() { - return this.hasAttribute("disabled"); - } - connectedCallback() { - if (!this.label) { - throw new Error(": a label attribute is required"); - } - this.innerHTML = `${this.type === "text" ? ` -
- - -
- ` : ``}`; - this.setAttribute("expanded", false); - this.inputTrigger = this.querySelector("input"); - this.buttonTrigger = this.querySelector("button"); - this.buttonTrigger.setAttribute("aria-expanded", false); - this.buttonTrigger.setAttribute("role", "combobox"); - this.buttonTrigger.addEventListener("keydown", this.handleKeyDown); - this.buttonTrigger.addEventListener("click", this.toggleExpansionState); - if (this.inputTrigger) { - this.inputTrigger.setAttribute("aria-expanded", false); - this.inputTrigger.setAttribute("role", "combobox"); - this.inputTrigger.addEventListener("keydown", this.handleKeyDown); - this.inputTrigger.addEventListener("keyup", this.handleKeyUp); - this.inputTrigger.addEventListener("change", (e) => e.stopPropagation()); - } - this.listbox = this.parentElement.querySelector("smileid-combobox-listbox"); - this.options = Array.from( - this.parentElement.querySelectorAll("smileid-combobox-option") - ); - this.options.forEach((node) => { - node.addEventListener("Combobox::Option::Select", this.handleSelection); - }); - } - disconnectedCallback() { - this.buttonTrigger.removeEventListener("keydown", this.handleKeyDown); - this.buttonTrigger.removeEventListener("click", this.toggleExpansionState); - if (this.inputTrigger) { - this.inputTrigger.removeEventListener("keydown", this.handleKeyDown); - this.inputTrigger.removeEventListener("keyup", this.handleKeyUp); - this.inputTrigger.removeEventListener( - "change", - (e) => e.stopPropagation() - ); - } - if (this.options) { - this.options.forEach((node) => { - node.removeEventListener( - "Combobox::Option::Select", - this.handleSelection - ); - }); - } - } - handleKeyDown(event) { - if (event.ctrlKey || event.shiftKey) { - return; - } - const key = event.key; - switch (key) { - case "Enter": - case "Space": - case " ": - if (this.getAttribute("expanded") === "true") { - if (this.inputTrigger && (key === "Space" || key === " ")) { - this.resetListbox(); - } else { - event.preventDefault(); - const selectedOption = this.buttonTrigger.getAttribute( - "aria-activedescendant" - ); - if (selectedOption) { - document.getElementById(selectedOption).click(); - } - } - } else { - event.preventDefault(); - this.toggleExpansionState(); - } - break; - case "Esc": - case "Escape": - event.preventDefault(); - if (this.getAttribute("expanded") === "true") { - this.toggleExpansionState(); - } - break; - case "Down": - case "ArrowDown": - event.preventDefault(); - if (this.getAttribute("expanded") !== "true") { - this.toggleExpansionState(); - this.focusListbox("First"); - } else { - this.focusListbox("Down"); - } - break; - case "Up": - case "ArrowUp": - event.preventDefault(); - if (this.getAttribute("expanded") !== "true") { - this.toggleExpansionState(); - this.focusListbox("Last"); - } else { - this.focusListbox("Up"); - } - break; - case "Left": - case "ArrowLeft": - case "Right": - case "ArrowRight": - case "Home": - case "End": - this.resetListbox(); - break; - case "Tab": - break; - default: - break; - } - } - handleKeyUp(event) { - const key = event.key; - const isPrintableCharacter = (str) => str.length === 1 && str.match(/\S| /); - if (event.key === "Escape" || event.key === "Esc") { - event.preventDefault(); - if (this.getAttribute("expanded") === "true") { - this.toggleExpansionState(); - } else if (this.inputTrigger) { - this.inputTrigger.value = ""; - this.listbox.dispatchEvent( - new CustomEvent("Combobox::Listbox::Filter", { detail: "" }) - ); - } - } - if (isPrintableCharacter(key) || key === "Backspace") { - this.resetListbox(); - this.filterListbox(event.target.value); - } - } - toggleExpansionState() { - const listboxIsExpanded = this.getAttribute("expanded") === "true"; - this.setAttribute("expanded", !listboxIsExpanded); - this.buttonTrigger.setAttribute("aria-expanded", !listboxIsExpanded); - if (this.inputTrigger) { - this.inputTrigger.setAttribute("aria-expanded", !listboxIsExpanded); - } - } - handleSelection(event) { - if (this.inputTrigger) { - this.inputTrigger.value = event.detail.label; - } else { - this.buttonTrigger.textContent = event.detail.label; - } - this.toggleExpansionState(); - this.parentElement.dispatchEvent( - new CustomEvent("change", { - detail: { - value: event.detail.value - } - }) - ); - } - filterListbox(value) { - if (this.getAttribute("expanded") !== "true") { - this.toggleExpansionState(); - } - this.listbox.dispatchEvent( - new CustomEvent("Combobox::Listbox::Filter", { detail: value }) - ); - } - focusListbox(direction) { - this.resetListbox(); - this.listbox.dispatchEvent( - new CustomEvent("Combobox::Listbox::Focus", { - detail: { - direction - } - }) - ); - } - resetListbox() { - this.listbox.dispatchEvent(new CustomEvent("Combobox::Listbox::Reset")); - } - }; - var ComboboxListbox = class extends HTMLElement { - constructor() { - super(); - this.handleFilter = this.handleFilter.bind(this); - this.handleFocus = this.handleFocus.bind(this); - this.handleReset = this.handleReset.bind(this); - this.handleOptionSelection = this.handleOptionSelection.bind(this); - } - get emptyLabel() { - return this.getAttribute("empty-label"); - } - get emptyState() { - return ` -

- ${this.emptyLabel || "No items"} -

- `; - } - connectedCallback() { - this.setAttribute("role", "listbox"); - this.setAttribute("id", generateId("listbox")); - this.addEventListener("Combobox::Listbox::Filter", this.handleFilter); - this.addEventListener("Combobox::Listbox::Focus", this.handleFocus); - this.addEventListener("Combobox::Listbox::Reset", this.handleReset); - this.triggers = Array.from( - this.parentElement.querySelectorAll( - "smileid-combobox-trigger input, smileid-combobox-trigger button" - ) - ); - this.triggers.forEach( - (node) => node.setAttribute("aria-controls", this.getAttribute("id")) - ); - this.optionNodes = Array.from( - this.querySelectorAll("smileid-combobox-option") - ); - this.selectedNode = this.optionNodes.find( - (node) => !node.hasAttribute("hidden") && node.hasAttribute("aria-selected") - ) || this.optionNodes.filter((node) => !node.hasAttribute("hidden"))[0]; - this.selectedNode.setAttribute("tabindex", "0"); - this.optionNodes.forEach((node) => { - node.addEventListener( - "Combobox::Option::Select", - this.handleOptionSelection - ); - }); - if (this.optionNodes.length === 0) { - this.innerHTML = this.emptyState; - } - } - disconnectedCallback() { - this.removeEventListener("Combobox::Listbox::Filter", this.handleFilter); - this.removeEventListener("Combobox::Listbox::Focus", this.handleFocus); - this.removeEventListener("Combobox::Listbox::Reset", this.handleReset); - this.optionNodes.forEach((node) => { - node.removeEventListener( - "Combobox::Option::Select", - this.handleOptionSelection - ); - }); - } - static get observedAttributes() { - return ["search-term"]; - } - attributeChangedCallback(name, oldValue, newValue) { - switch (name) { - case "search-term": - if (oldValue && !newValue) { - this.optionNodes.forEach((node) => { - node.removeAttribute("hidden"); - }); - } else if (newValue) { - this.filterNodes(newValue); - } - break; - default: - break; - } - } - filterNodes(searchTerm) { - this.optionNodes.forEach((node) => { - const value = node.getAttribute("value").toLowerCase(); - const label = node.getAttribute("label").toLowerCase(); - const containsSearchTerm = value.includes(searchTerm.toLowerCase()) || label.includes(searchTerm.toLowerCase()); - if (containsSearchTerm) { - node.removeAttribute("hidden"); - } else { - node.setAttribute("hidden", true); - } - }); - const optionsVisible = this.optionNodes.find( - (node) => !node.hasAttribute("hidden") - ); - const emptyState = this.querySelector("#empty-state"); - if (!optionsVisible && !emptyState) { - this.insertAdjacentHTML("afterbegin", this.emptyState); - } else if (optionsVisible && emptyState) { - this.removeChild(emptyState); - } - } - handleFilter(event) { - const searchTerm = event.detail; - this.setAttribute("search-term", searchTerm); - } - handleFocus(event) { - this.setSelected(event.detail.direction); - } - handleReset() { - this.optionNodes.forEach((node) => node.setAttribute("tabindex", "-1")); - } - handleOptionSelection(event) { - const inputTrigger = this.triggers.filter( - (node) => node.tagName === "INPUT" - )[0]; - if (inputTrigger) { - this.setAttribute("search-term", event.detail.label); - } - } - setSelected(direction) { - const visibleOptions = this.optionNodes.filter( - (node) => !node.hasAttribute("hidden") - ); - this.selectedNode.setAttribute("tabindex", "0"); - const currentIndex = visibleOptions.findIndex( - (node) => node === this.selectedNode - ); - const lastIndex = visibleOptions.length - 1; - let nextIndex; - switch (direction) { - case "First": - nextIndex = 0; - break; - case "Last": - nextIndex = lastIndex; - break; - case "Up": - if (currentIndex === 0) { - nextIndex = lastIndex; - } else { - nextIndex = currentIndex - 1; - } - break; - default: - if (currentIndex === lastIndex) { - nextIndex = 0; - } else { - nextIndex = currentIndex + 1; - } - break; - } - if (currentIndex !== nextIndex) { - this.swapSelected(this.selectedNode, visibleOptions[nextIndex]); - } - } - swapSelected(currentNode, newNode) { - currentNode.setAttribute("tabindex", "-1"); - newNode.setAttribute("tabindex", "0"); - this.selectedNode = newNode; - if (isScrollable(this)) { - maintainScrollVisibility(this.selectedNode, this); - } - if (!isElementInView(newNode)) { - newNode.scrollIntoView({ behavior: "smooth", block: "nearest" }); - } - this.triggers.forEach( - (node) => node.setAttribute("aria-activedescendant", newNode.id) - ); - } - }; - var ComboboxOption = class extends HTMLElement { - connectedCallback() { - this.setAttribute("role", "option"); - this.setAttribute("tabindex", "-1"); - this.setAttribute("id", generateId("option")); - this.options = Array.from( - this.parentElement.querySelectorAll("smileid-combobox-option") - ); - this.addEventListener("click", this.select); - } - disconnectedCallback() { - this.removeEventListener("click", this.select); - } - get value() { - return this.getAttribute("value"); - } - get label() { - return this.getAttribute("label"); - } - select() { - const selectedOption = this.options.find( - (node) => node.getAttribute("aria-selected") - ); - if (selectedOption) { - selectedOption.removeAttribute("aria-selected"); - } - this.setAttribute("aria-selected", true); - this.dispatchEvent( - new CustomEvent("Combobox::Option::Select", { - detail: { - label: this.label, - value: this.value, - id: this.getAttribute("id") - } - }) - ); - } - }; - var Combobox_default = { - Root: ComboboxRoot, - Trigger: ComboboxTrigger, - List: ComboboxListbox, - Option: ComboboxOption - }; - - // src/js/doc-verification.js - (function documentVerification() { - "use strict"; - const endpoints = { - sandbox: "https://testapi.smileidentity.com/v1", - live: "https://api.smileidentity.com/v1", - production: "https://api.smileidentity.com/v1" - }; - const referenceWindow = window.parent; - referenceWindow.postMessage("SmileIdentity::ChildPageReady", "*"); - window.customElements.define("smileid-combobox", Combobox_default.Root); - window.customElements.define("smileid-combobox-trigger", Combobox_default.Trigger); - window.customElements.define("smileid-combobox-listbox", Combobox_default.List); - window.customElements.define("smileid-combobox-option", Combobox_default.Option); - let config; - let activeScreen; - let id_info; - let images; - let partner_params; - const LoadingScreen = document.querySelector("#loading-screen"); - const SelectIDType = document.querySelector("#select-id-type"); - const SmartCameraWeb2 = document.querySelector("smart-camera-web"); - const UploadProgressScreen = document.querySelector( - "#upload-progress-screen" - ); - const UploadFailureScreen = document.querySelector("#upload-failure-screen"); - const CompleteScreen = document.querySelector("#complete-screen"); - const CloseIframeButtons = document.querySelectorAll(".close-iframe"); - const RetryUploadButton = document.querySelector("#retry-upload"); - let fileToUpload; - let uploadURL; - async function getProductConstraints() { - const payload = { - token: config.token, - partner_id: config.partner_details.partner_id - }; - const fetchConfig = { - cache: "no-cache", - mode: "cors", - headers: { - Accept: "application/json", - "Content-Type": "application/json" - }, - method: "POST", - body: JSON.stringify(payload) - }; - try { - const response = await fetch( - `${endpoints[config.environment]}/valid_documents`, - fetchConfig - ); - const json = await response.json(); - return json.valid_documents; - } catch (e) { - throw new Error("Failed to get supported ID types", { cause: e }); - } - } - async function getLegacyProductConstraints() { - const fetchConfig = { - cache: "no-cache", - mode: "cors", - headers: { - Accept: "application/json", - "Content-Type": "application/json" - }, - method: "GET" - }; - try { - const response = await fetch( - `${endpoints[config.environment]}/services`, - fetchConfig - ); - const json = await response.json(); - return json.hosted_web.doc_verification; - } catch (e) { - throw new Error("Failed to get supported ID types", { cause: e }); - } - } - window.addEventListener( - "message", - async (event) => { - if (event.data && event.data.includes("SmileIdentity::Configuration")) { - config = JSON.parse(event.data); - activeScreen = LoadingScreen; - const productConstraints = await getProductConstraints(); - initializeSession(productConstraints); - getPartnerParams(); - } - }, - false - ); - function loadCountrySelector(countries, placeholderElement) { - const isSingleCountry = countries.length === 1; - const autocomplete = document.createElement("smileid-combobox"); - autocomplete.setAttribute("id", "country"); - autocomplete.innerHTML = ` - - - - - ${countries.map( - (country) => ` - - ${country.name} - - ` - ).join("\n")} - - `; - placeholderElement.replaceWith(autocomplete); - return autocomplete; - } - function loadIdTypeSelector(idTypes) { - const idTypeSelector = document.querySelector("#id-type-selector"); - let combobox = document.querySelector('smileid-combobox[id="id_type"]'); - if (!combobox) { - combobox = document.createElement("smileid-combobox"); - combobox.setAttribute("id", "id_type"); - } - combobox.innerHTML = ` - - - - - ${idTypes.map( - (idType) => ` - -
-

${idType.name}

- ${idType.name === "Others" || idType.example && idType.example.length > 1 ? `${idType.example.length > 1 ? "e.g. " : ""}${idType.example.join(", ")}` : ""} -
-
- ` - ).join("\n")} -
- `; - if (idTypeSelector.hidden) { - idTypeSelector.appendChild(combobox); - idTypeSelector.removeAttribute("hidden"); - } - return combobox; - } - async function initializeSession(constraints) { - let selectedCountry; - let selectedIdType; - function loadIdTypes(countryCode) { - const countryIdTypes = constraints.find( - (item) => item.country.code === countryCode - ).id_types; - if (config.id_selection) { - return countryIdTypes.filter((idType) => { - return config.id_selection[countryCode].find((validIdType) => { - if (validIdType.toLowerCase() === "others") { - return !idType.code; - } - return validIdType === idType.code; - }); - }); - } - return countryIdTypes; - } - function initialiseIdTypeSelector(country, selectIdType) { - const idTypes = loadIdTypes(country); - const idTypeSelector = loadIdTypeSelector(idTypes, selectIdType); - idTypeSelector.addEventListener("change", (e) => { - selectedIdType = e.detail.value; - }); - } - const supportedCountries = constraints.map(({ country: { name, code } }) => ({ - code, - name - })).sort((a, b) => { - if (a.name < b.name) { - return -1; - } - if (a.name > b.name) { - return 1; - } - return 0; - }).map((item) => item.code); - let validCountries = []; - if (config.id_selection) { - const legacyConstraints = await getLegacyProductConstraints(); - Object.keys(config.id_selection).forEach((countryCode) => { - const isCountrySupported = supportedCountries.includes(countryCode); - if (!isCountrySupported) { - throw new Error(`SmileIdentity - ${countryCode} is not supported`); - } - const countryIndex = constraints.findIndex( - (entry) => entry.country.code === countryCode - ); - config.id_selection[countryCode].forEach((idSelectionIdType) => { - const isIdTypeSupported = constraints[countryIndex].id_types.find( - (constrainedIdType) => idSelectionIdType === constrainedIdType.code - ); - if (isIdTypeSupported) - return; - console.error( - `SmileIdentity - ${countryCode}-${idSelectionIdType} has been deprecated` - ); - if (idSelectionIdType.toLowerCase() !== "others") { - constraints[countryIndex].id_types.push({ - code: idSelectionIdType, - has_back: false, - name: legacyConstraints[countryCode].id_types[idSelectionIdType].label - }); - } - }); - }); - const selectedCountryList = Object.keys(config.id_selection); - validCountries = supportedCountries.filter( - (value) => selectedCountryList.includes(value) - ); - if (validCountries.length === 1) { - selectedCountry = validCountries[0]; - id_info = { - country: validCountries[0] - }; - const idTypes = config.id_selection[selectedCountry]; - if (idTypes.length === 1 || typeof idTypes === "string") { - id_info.id_type = Array.isArray(idTypes) ? idTypes[0] : idTypes; - const documentCaptureConfig = constraints.find((entry) => entry.country.code === selectedCountry).id_types.find((entry) => entry.code === id_info.id_type); - SmartCameraWeb2.setAttribute("document-type", id_info.id_type); - if (documentCaptureConfig.has_back) { - SmartCameraWeb2.setAttribute("capture-id", "back"); - } - if (config.document_capture_modes) { - SmartCameraWeb2.setAttribute( - "document-capture-modes", - config.document_capture_modes.join(",") - ); - } - SmartCameraWeb2.setAttribute("hide-back-to-host", true); - setActiveScreen(SmartCameraWeb2); - } - } - } else { - validCountries = supportedCountries; - } - const countries = validCountries.map((countryCode) => { - const countryObject = constraints.find( - (entry) => entry.country.code === countryCode - ).country; - return { - code: countryCode, - name: countryObject.name - }; - }); - if (!id_info || !id_info.id_type) { - const selectCountry = SelectIDType.querySelector("#country"); - const hostedWebConfigForm = document.querySelector( - 'form[name="hosted-web-config"]' - ); - selectCountry.disabled = false; - setActiveScreen(SelectIDType); - const countrySelector = loadCountrySelector(countries, selectCountry); - countrySelector.addEventListener("change", (e) => { - selectedCountry = e.detail ? e.detail.value : ""; - initialiseIdTypeSelector(selectedCountry); - }); - if (id_info && id_info.country) { - selectedCountry = id_info.country; - initialiseIdTypeSelector(selectedCountry); - } - hostedWebConfigForm.addEventListener("submit", (e) => { - e.preventDefault(); - id_info = { - country: selectedCountry, - id_type: selectedIdType - }; - SmartCameraWeb2.setAttribute("document-type", selectedIdType); - const documentCaptureConfig = constraints.find((entry) => entry.country.code === selectedCountry).id_types.find((entry) => entry.code === selectedIdType); - if (documentCaptureConfig.has_back) { - SmartCameraWeb2.setAttribute("capture-id", "back"); - } - if (config.document_capture_modes) { - SmartCameraWeb2.setAttribute( - "document-capture-modes", - config.document_capture_modes.join(",") - ); - } - setActiveScreen(SmartCameraWeb2); - }); - } - } - SmartCameraWeb2.addEventListener( - "imagesComputed", - (event) => { - images = event.detail.images; - setActiveScreen(UploadProgressScreen); - handleFormSubmit(event); - }, - false - ); - SmartCameraWeb2.addEventListener( - "backExit", - () => { - setActiveScreen(SelectIDType); - }, - false - ); - SmartCameraWeb2.addEventListener( - "close", - () => { - closeWindow(); - }, - false - ); - RetryUploadButton.addEventListener( - "click", - () => { - retryUpload(); - }, - false - ); - CloseIframeButtons.forEach((button) => { - button.addEventListener( - "click", - () => { - closeWindow(); - }, - false - ); - }); - function getPartnerParams() { - function parseJWT(token) { - const base64Url = token.split(".")[1]; - const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/"); - const jsonPayload = decodeURIComponent( - atob(base64).split("").map(function(c) { - return `%${c.charCodeAt(0).toString(16)}`; - }).join("") - ); - return JSON.parse(jsonPayload); - } - const { partner_params: partnerParams } = parseJWT(config.token); - partner_params = { ...partnerParams, ...config.partner_params || {} }; - } - function setActiveScreen(node) { - activeScreen.hidden = true; - node.hidden = false; - activeScreen = node; - } - async function handleFormSubmit(event) { - event.preventDefault(); - const errorMessage = document.querySelector(".validation-message"); - if (errorMessage) - errorMessage.remove(); - try { - event.target.disabled = true; - [uploadURL, fileToUpload] = await Promise.all([ - getUploadURL(), - createZip() - ]); - uploadZip(fileToUpload, uploadURL); - event.target.disabled = false; - } catch (error) { - event.target.disabled = false; - displayErrorMessage("Something went wrong"); - console.error( - `SmileIdentity - ${error.name || error.message}: ${error.cause}` - ); - } - } - function displayErrorMessage(message) { - const p = document.createElement("p"); - p.textContent = message; - p.classList.add("validation-message"); - p.style.fontSize = "1.5rem"; - p.style.textAlign = "center"; - const main = document.querySelector("main"); - main.prepend(p); - } - async function createZip() { - const zip = new import_jszip.default(); - zip.file( - "info.json", - JSON.stringify({ - package_information: { - language: "Hosted Web Integration", - apiVersion: { - buildNumber: 0, - majorVersion: 2, - minorVersion: 0 - } - }, - id_info, - images - }) - ); - try { - const zipFile = await zip.generateAsync({ type: "blob" }); - return zipFile; - } catch (error) { - throw new Error("createZip failed", { cause: error }); - } - } - async function getUploadURL() { - const payload = { - source_sdk: config.sdk || "hosted_web", - source_sdk_version: config.sdk_version || version, - file_name: `${config.product}.zip`, - smile_client_id: config.partner_details.partner_id, - callback_url: config.callback_url, - token: config.token, - partner_params: { - ...partner_params, - job_type: 6 - } - }; - const fetchConfig = { - cache: "no-cache", - mode: "cors", - headers: { - Accept: "application/json", - "Content-Type": "application/json" - }, - method: "POST", - body: JSON.stringify(payload) - }; - const URL = `${endpoints[config.environment] || config.environment}/upload`; - try { - const response = await fetch(URL, fetchConfig); - const json = await response.json(); - if (json.error) - throw new Error(json.error); - return json.upload_url; - } catch (error) { - throw new Error("getUploadURL failed", { cause: error }); - } - } - function uploadZip(file, destination) { - const request = new XMLHttpRequest(); - request.open("PUT", destination); - request.upload.addEventListener("load", function() { - return request.response; - }); - request.upload.addEventListener("error", function(e) { - setActiveScreen(UploadFailureScreen); - throw new Error("uploadZip failed", { cause: e }); - }); - request.onreadystatechange = function() { - if (request.readyState === XMLHttpRequest.DONE && request.status === 200) { - setActiveScreen(CompleteScreen); - handleSuccess(); - window.setTimeout(closeWindow, 2e3); - } - if (request.readyState === XMLHttpRequest.DONE && request.status !== 200) { - setActiveScreen(UploadFailureScreen); - throw new Error("uploadZip failed", { cause: request }); - } - }; - request.setRequestHeader("Content-type", "application/zip"); - request.send(file); - } - function retryUpload() { - const fileUploaded = uploadZip(fileToUpload, uploadURL); - return fileUploaded; - } - function closeWindow() { - referenceWindow.postMessage("SmileIdentity::Close", "*"); - } - function handleSuccess() { - referenceWindow.postMessage("SmileIdentity::Success", "*"); - } - })(); -})(); -/*! Bundled license information: - -jszip/dist/jszip.min.js: - (*! - - JSZip v3.10.1 - A JavaScript class for generating and reading zip files - - - (c) 2009-2016 Stuart Knightley - Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. - - JSZip uses the library pako released under the MIT license : - https://github.com/nodeca/pako/blob/main/LICENSE - *) -*/ diff --git a/packages/embed/build/js/ekyc.min.js b/packages/embed/build/js/ekyc.min.js deleted file mode 100644 index 54508350..00000000 --- a/packages/embed/build/js/ekyc.min.js +++ /dev/null @@ -1,3758 +0,0 @@ -(() => { - var __create = Object.create; - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __getProtoOf = Object.getPrototypeOf; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __commonJS = (cb, mod) => function __require() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod - )); - - // ../../node_modules/validate.js/validate.js - var require_validate = __commonJS({ - "../../node_modules/validate.js/validate.js"(exports, module) { - (function(exports2, module2, define2) { - "use strict"; - var validate3 = function(attributes, constraints, options) { - options = v.extend({}, v.options, options); - var results = v.runValidations(attributes, constraints, options), attr, validator; - if (results.some(function(r) { - return v.isPromise(r.error); - })) { - throw new Error("Use validate.async if you want support for promises"); - } - return validate3.processValidationResults(results, options); - }; - var v = validate3; - v.extend = function(obj) { - [].slice.call(arguments, 1).forEach(function(source) { - for (var attr in source) { - obj[attr] = source[attr]; - } - }); - return obj; - }; - v.extend(validate3, { - // This is the version of the library as a semver. - // The toString function will allow it to be coerced into a string - version: { - major: 0, - minor: 13, - patch: 1, - metadata: null, - toString: function() { - var version2 = v.format("%{major}.%{minor}.%{patch}", v.version); - if (!v.isEmpty(v.version.metadata)) { - version2 += "+" + v.version.metadata; - } - return version2; - } - }, - // Below is the dependencies that are used in validate.js - // The constructor of the Promise implementation. - // If you are using Q.js, RSVP or any other A+ compatible implementation - // override this attribute to be the constructor of that promise. - // Since jQuery promises aren't A+ compatible they won't work. - Promise: typeof Promise !== "undefined" ? Promise : ( - /* istanbul ignore next */ - null - ), - EMPTY_STRING_REGEXP: /^\s*$/, - // Runs the validators specified by the constraints object. - // Will return an array of the format: - // [{attribute: "", error: ""}, ...] - runValidations: function(attributes, constraints, options) { - var results = [], attr, validatorName, value, validators, validator, validatorOptions, error; - if (v.isDomElement(attributes) || v.isJqueryElement(attributes)) { - attributes = v.collectFormValues(attributes); - } - for (attr in constraints) { - value = v.getDeepObjectValue(attributes, attr); - validators = v.result(constraints[attr], value, attributes, attr, options, constraints); - for (validatorName in validators) { - validator = v.validators[validatorName]; - if (!validator) { - error = v.format("Unknown validator %{name}", { name: validatorName }); - throw new Error(error); - } - validatorOptions = validators[validatorName]; - validatorOptions = v.result(validatorOptions, value, attributes, attr, options, constraints); - if (!validatorOptions) { - continue; - } - results.push({ - attribute: attr, - value, - validator: validatorName, - globalOptions: options, - attributes, - options: validatorOptions, - error: validator.call( - validator, - value, - validatorOptions, - attr, - attributes, - options - ) - }); - } - } - return results; - }, - // Takes the output from runValidations and converts it to the correct - // output format. - processValidationResults: function(errors, options) { - errors = v.pruneEmptyErrors(errors, options); - errors = v.expandMultipleErrors(errors, options); - errors = v.convertErrorMessages(errors, options); - var format = options.format || "grouped"; - if (typeof v.formatters[format] === "function") { - errors = v.formatters[format](errors); - } else { - throw new Error(v.format("Unknown format %{format}", options)); - } - return v.isEmpty(errors) ? void 0 : errors; - }, - // Runs the validations with support for promises. - // This function will return a promise that is settled when all the - // validation promises have been completed. - // It can be called even if no validations returned a promise. - async: function(attributes, constraints, options) { - options = v.extend({}, v.async.options, options); - var WrapErrors = options.wrapErrors || function(errors) { - return errors; - }; - if (options.cleanAttributes !== false) { - attributes = v.cleanAttributes(attributes, constraints); - } - var results = v.runValidations(attributes, constraints, options); - return new v.Promise(function(resolve, reject) { - v.waitForResults(results).then(function() { - var errors = v.processValidationResults(results, options); - if (errors) { - reject(new WrapErrors(errors, options, attributes, constraints)); - } else { - resolve(attributes); - } - }, function(err) { - reject(err); - }); - }); - }, - single: function(value, constraints, options) { - options = v.extend({}, v.single.options, options, { - format: "flat", - fullMessages: false - }); - return v({ single: value }, { single: constraints }, options); - }, - // Returns a promise that is resolved when all promises in the results array - // are settled. The promise returned from this function is always resolved, - // never rejected. - // This function modifies the input argument, it replaces the promises - // with the value returned from the promise. - waitForResults: function(results) { - return results.reduce(function(memo, result) { - if (!v.isPromise(result.error)) { - return memo; - } - return memo.then(function() { - return result.error.then(function(error) { - result.error = error || null; - }); - }); - }, new v.Promise(function(r) { - r(); - })); - }, - // If the given argument is a call: function the and: function return the value - // otherwise just return the value. Additional arguments will be passed as - // arguments to the function. - // Example: - // ``` - // result('foo') // 'foo' - // result(Math.max, 1, 2) // 2 - // ``` - result: function(value) { - var args = [].slice.call(arguments, 1); - if (typeof value === "function") { - value = value.apply(null, args); - } - return value; - }, - // Checks if the value is a number. This function does not consider NaN a - // number like many other `isNumber` functions do. - isNumber: function(value) { - return typeof value === "number" && !isNaN(value); - }, - // Returns false if the object is not a function - isFunction: function(value) { - return typeof value === "function"; - }, - // A simple check to verify that the value is an integer. Uses `isNumber` - // and a simple modulo check. - isInteger: function(value) { - return v.isNumber(value) && value % 1 === 0; - }, - // Checks if the value is a boolean - isBoolean: function(value) { - return typeof value === "boolean"; - }, - // Uses the `Object` function to check if the given argument is an object. - isObject: function(obj) { - return obj === Object(obj); - }, - // Simply checks if the object is an instance of a date - isDate: function(obj) { - return obj instanceof Date; - }, - // Returns false if the object is `null` of `undefined` - isDefined: function(obj) { - return obj !== null && obj !== void 0; - }, - // Checks if the given argument is a promise. Anything with a `then` - // function is considered a promise. - isPromise: function(p) { - return !!p && v.isFunction(p.then); - }, - isJqueryElement: function(o) { - return o && v.isString(o.jquery); - }, - isDomElement: function(o) { - if (!o) { - return false; - } - if (!o.querySelectorAll || !o.querySelector) { - return false; - } - if (v.isObject(document) && o === document) { - return true; - } - if (typeof HTMLElement === "object") { - return o instanceof HTMLElement; - } else { - return o && typeof o === "object" && o !== null && o.nodeType === 1 && typeof o.nodeName === "string"; - } - }, - isEmpty: function(value) { - var attr; - if (!v.isDefined(value)) { - return true; - } - if (v.isFunction(value)) { - return false; - } - if (v.isString(value)) { - return v.EMPTY_STRING_REGEXP.test(value); - } - if (v.isArray(value)) { - return value.length === 0; - } - if (v.isDate(value)) { - return false; - } - if (v.isObject(value)) { - for (attr in value) { - return false; - } - return true; - } - return false; - }, - // Formats the specified strings with the given values like so: - // ``` - // format("Foo: %{foo}", {foo: "bar"}) // "Foo bar" - // ``` - // If you want to write %{...} without having it replaced simply - // prefix it with % like this `Foo: %%{foo}` and it will be returned - // as `"Foo: %{foo}"` - format: v.extend(function(str, vals) { - if (!v.isString(str)) { - return str; - } - return str.replace(v.format.FORMAT_REGEXP, function(m0, m1, m2) { - if (m1 === "%") { - return "%{" + m2 + "}"; - } else { - return String(vals[m2]); - } - }); - }, { - // Finds %{key} style patterns in the given string - FORMAT_REGEXP: /(%?)%\{([^\}]+)\}/g - }), - // "Prettifies" the given string. - // Prettifying means replacing [.\_-] with spaces as well as splitting - // camel case words. - prettify: function(str) { - if (v.isNumber(str)) { - if (str * 100 % 1 === 0) { - return "" + str; - } else { - return parseFloat(Math.round(str * 100) / 100).toFixed(2); - } - } - if (v.isArray(str)) { - return str.map(function(s) { - return v.prettify(s); - }).join(", "); - } - if (v.isObject(str)) { - if (!v.isDefined(str.toString)) { - return JSON.stringify(str); - } - return str.toString(); - } - str = "" + str; - return str.replace(/([^\s])\.([^\s])/g, "$1 $2").replace(/\\+/g, "").replace(/[_-]/g, " ").replace(/([a-z])([A-Z])/g, function(m0, m1, m2) { - return "" + m1 + " " + m2.toLowerCase(); - }).toLowerCase(); - }, - stringifyValue: function(value, options) { - var prettify = options && options.prettify || v.prettify; - return prettify(value); - }, - isString: function(value) { - return typeof value === "string"; - }, - isArray: function(value) { - return {}.toString.call(value) === "[object Array]"; - }, - // Checks if the object is a hash, which is equivalent to an object that - // is neither an array nor a function. - isHash: function(value) { - return v.isObject(value) && !v.isArray(value) && !v.isFunction(value); - }, - contains: function(obj, value) { - if (!v.isDefined(obj)) { - return false; - } - if (v.isArray(obj)) { - return obj.indexOf(value) !== -1; - } - return value in obj; - }, - unique: function(array) { - if (!v.isArray(array)) { - return array; - } - return array.filter(function(el, index, array2) { - return array2.indexOf(el) == index; - }); - }, - forEachKeyInKeypath: function(object, keypath, callback) { - if (!v.isString(keypath)) { - return void 0; - } - var key = "", i, escape = false; - for (i = 0; i < keypath.length; ++i) { - switch (keypath[i]) { - case ".": - if (escape) { - escape = false; - key += "."; - } else { - object = callback(object, key, false); - key = ""; - } - break; - case "\\": - if (escape) { - escape = false; - key += "\\"; - } else { - escape = true; - } - break; - default: - escape = false; - key += keypath[i]; - break; - } - } - return callback(object, key, true); - }, - getDeepObjectValue: function(obj, keypath) { - if (!v.isObject(obj)) { - return void 0; - } - return v.forEachKeyInKeypath(obj, keypath, function(obj2, key) { - if (v.isObject(obj2)) { - return obj2[key]; - } - }); - }, - // This returns an object with all the values of the form. - // It uses the input name as key and the value as value - // So for example this: - // - // would return: - // {email: "foo@bar.com"} - collectFormValues: function(form, options) { - var values = {}, i, j, input, inputs, option, value; - if (v.isJqueryElement(form)) { - form = form[0]; - } - if (!form) { - return values; - } - options = options || {}; - inputs = form.querySelectorAll("input[name], textarea[name]"); - for (i = 0; i < inputs.length; ++i) { - input = inputs.item(i); - if (v.isDefined(input.getAttribute("data-ignored"))) { - continue; - } - var name = input.name.replace(/\./g, "\\\\."); - value = v.sanitizeFormValue(input.value, options); - if (input.type === "number") { - value = value ? +value : null; - } else if (input.type === "checkbox") { - if (input.attributes.value) { - if (!input.checked) { - value = values[name] || null; - } - } else { - value = input.checked; - } - } else if (input.type === "radio") { - if (!input.checked) { - value = values[name] || null; - } - } - values[name] = value; - } - inputs = form.querySelectorAll("select[name]"); - for (i = 0; i < inputs.length; ++i) { - input = inputs.item(i); - if (v.isDefined(input.getAttribute("data-ignored"))) { - continue; - } - if (input.multiple) { - value = []; - for (j in input.options) { - option = input.options[j]; - if (option && option.selected) { - value.push(v.sanitizeFormValue(option.value, options)); - } - } - } else { - var _val = typeof input.options[input.selectedIndex] !== "undefined" ? input.options[input.selectedIndex].value : ( - /* istanbul ignore next */ - "" - ); - value = v.sanitizeFormValue(_val, options); - } - values[input.name] = value; - } - return values; - }, - sanitizeFormValue: function(value, options) { - if (options.trim && v.isString(value)) { - value = value.trim(); - } - if (options.nullify !== false && value === "") { - return null; - } - return value; - }, - capitalize: function(str) { - if (!v.isString(str)) { - return str; - } - return str[0].toUpperCase() + str.slice(1); - }, - // Remove all errors who's error attribute is empty (null or undefined) - pruneEmptyErrors: function(errors) { - return errors.filter(function(error) { - return !v.isEmpty(error.error); - }); - }, - // In - // [{error: ["err1", "err2"], ...}] - // Out - // [{error: "err1", ...}, {error: "err2", ...}] - // - // All attributes in an error with multiple messages are duplicated - // when expanding the errors. - expandMultipleErrors: function(errors) { - var ret = []; - errors.forEach(function(error) { - if (v.isArray(error.error)) { - error.error.forEach(function(msg) { - ret.push(v.extend({}, error, { error: msg })); - }); - } else { - ret.push(error); - } - }); - return ret; - }, - // Converts the error mesages by prepending the attribute name unless the - // message is prefixed by ^ - convertErrorMessages: function(errors, options) { - options = options || {}; - var ret = [], prettify = options.prettify || v.prettify; - errors.forEach(function(errorInfo) { - var error = v.result( - errorInfo.error, - errorInfo.value, - errorInfo.attribute, - errorInfo.options, - errorInfo.attributes, - errorInfo.globalOptions - ); - if (!v.isString(error)) { - ret.push(errorInfo); - return; - } - if (error[0] === "^") { - error = error.slice(1); - } else if (options.fullMessages !== false) { - error = v.capitalize(prettify(errorInfo.attribute)) + " " + error; - } - error = error.replace(/\\\^/g, "^"); - error = v.format(error, { - value: v.stringifyValue(errorInfo.value, options) - }); - ret.push(v.extend({}, errorInfo, { error })); - }); - return ret; - }, - // In: - // [{attribute: "", ...}] - // Out: - // {"": [{attribute: "", ...}]} - groupErrorsByAttribute: function(errors) { - var ret = {}; - errors.forEach(function(error) { - var list = ret[error.attribute]; - if (list) { - list.push(error); - } else { - ret[error.attribute] = [error]; - } - }); - return ret; - }, - // In: - // [{error: "", ...}, {error: "", ...}] - // Out: - // ["", ""] - flattenErrorsToArray: function(errors) { - return errors.map(function(error) { - return error.error; - }).filter(function(value, index, self) { - return self.indexOf(value) === index; - }); - }, - cleanAttributes: function(attributes, whitelist) { - function whitelistCreator(obj, key, last) { - if (v.isObject(obj[key])) { - return obj[key]; - } - return obj[key] = last ? true : {}; - } - function buildObjectWhitelist(whitelist2) { - var ow = {}, lastObject, attr; - for (attr in whitelist2) { - if (!whitelist2[attr]) { - continue; - } - v.forEachKeyInKeypath(ow, attr, whitelistCreator); - } - return ow; - } - function cleanRecursive(attributes2, whitelist2) { - if (!v.isObject(attributes2)) { - return attributes2; - } - var ret = v.extend({}, attributes2), w, attribute; - for (attribute in attributes2) { - w = whitelist2[attribute]; - if (v.isObject(w)) { - ret[attribute] = cleanRecursive(ret[attribute], w); - } else if (!w) { - delete ret[attribute]; - } - } - return ret; - } - if (!v.isObject(whitelist) || !v.isObject(attributes)) { - return {}; - } - whitelist = buildObjectWhitelist(whitelist); - return cleanRecursive(attributes, whitelist); - }, - exposeModule: function(validate4, root, exports3, module3, define3) { - if (exports3) { - if (module3 && module3.exports) { - exports3 = module3.exports = validate4; - } - exports3.validate = validate4; - } else { - root.validate = validate4; - if (validate4.isFunction(define3) && define3.amd) { - define3([], function() { - return validate4; - }); - } - } - }, - warn: function(msg) { - if (typeof console !== "undefined" && console.warn) { - console.warn("[validate.js] " + msg); - } - }, - error: function(msg) { - if (typeof console !== "undefined" && console.error) { - console.error("[validate.js] " + msg); - } - } - }); - validate3.validators = { - // Presence validates that the value isn't empty - presence: function(value, options) { - options = v.extend({}, this.options, options); - if (options.allowEmpty !== false ? !v.isDefined(value) : v.isEmpty(value)) { - return options.message || this.message || "can't be blank"; - } - }, - length: function(value, options, attribute) { - if (!v.isDefined(value)) { - return; - } - options = v.extend({}, this.options, options); - var is = options.is, maximum = options.maximum, minimum = options.minimum, tokenizer = options.tokenizer || function(val) { - return val; - }, err, errors = []; - value = tokenizer(value); - var length = value.length; - if (!v.isNumber(length)) { - return options.message || this.notValid || "has an incorrect length"; - } - if (v.isNumber(is) && length !== is) { - err = options.wrongLength || this.wrongLength || "is the wrong length (should be %{count} characters)"; - errors.push(v.format(err, { count: is })); - } - if (v.isNumber(minimum) && length < minimum) { - err = options.tooShort || this.tooShort || "is too short (minimum is %{count} characters)"; - errors.push(v.format(err, { count: minimum })); - } - if (v.isNumber(maximum) && length > maximum) { - err = options.tooLong || this.tooLong || "is too long (maximum is %{count} characters)"; - errors.push(v.format(err, { count: maximum })); - } - if (errors.length > 0) { - return options.message || errors; - } - }, - numericality: function(value, options, attribute, attributes, globalOptions) { - if (!v.isDefined(value)) { - return; - } - options = v.extend({}, this.options, options); - var errors = [], name, count, checks = { - greaterThan: function(v2, c) { - return v2 > c; - }, - greaterThanOrEqualTo: function(v2, c) { - return v2 >= c; - }, - equalTo: function(v2, c) { - return v2 === c; - }, - lessThan: function(v2, c) { - return v2 < c; - }, - lessThanOrEqualTo: function(v2, c) { - return v2 <= c; - }, - divisibleBy: function(v2, c) { - return v2 % c === 0; - } - }, prettify = options.prettify || globalOptions && globalOptions.prettify || v.prettify; - if (v.isString(value) && options.strict) { - var pattern = "^-?(0|[1-9]\\d*)"; - if (!options.onlyInteger) { - pattern += "(\\.\\d+)?"; - } - pattern += "$"; - if (!new RegExp(pattern).test(value)) { - return options.message || options.notValid || this.notValid || this.message || "must be a valid number"; - } - } - if (options.noStrings !== true && v.isString(value) && !v.isEmpty(value)) { - value = +value; - } - if (!v.isNumber(value)) { - return options.message || options.notValid || this.notValid || this.message || "is not a number"; - } - if (options.onlyInteger && !v.isInteger(value)) { - return options.message || options.notInteger || this.notInteger || this.message || "must be an integer"; - } - for (name in checks) { - count = options[name]; - if (v.isNumber(count) && !checks[name](value, count)) { - var key = "not" + v.capitalize(name); - var msg = options[key] || this[key] || this.message || "must be %{type} %{count}"; - errors.push(v.format(msg, { - count, - type: prettify(name) - })); - } - } - if (options.odd && value % 2 !== 1) { - errors.push(options.notOdd || this.notOdd || this.message || "must be odd"); - } - if (options.even && value % 2 !== 0) { - errors.push(options.notEven || this.notEven || this.message || "must be even"); - } - if (errors.length) { - return options.message || errors; - } - }, - datetime: v.extend(function(value, options) { - if (!v.isFunction(this.parse) || !v.isFunction(this.format)) { - throw new Error("Both the parse and format functions needs to be set to use the datetime/date validator"); - } - if (!v.isDefined(value)) { - return; - } - options = v.extend({}, this.options, options); - var err, errors = [], earliest = options.earliest ? this.parse(options.earliest, options) : NaN, latest = options.latest ? this.parse(options.latest, options) : NaN; - value = this.parse(value, options); - if (isNaN(value) || options.dateOnly && value % 864e5 !== 0) { - err = options.notValid || options.message || this.notValid || "must be a valid date"; - return v.format(err, { value: arguments[0] }); - } - if (!isNaN(earliest) && value < earliest) { - err = options.tooEarly || options.message || this.tooEarly || "must be no earlier than %{date}"; - err = v.format(err, { - value: this.format(value, options), - date: this.format(earliest, options) - }); - errors.push(err); - } - if (!isNaN(latest) && value > latest) { - err = options.tooLate || options.message || this.tooLate || "must be no later than %{date}"; - err = v.format(err, { - date: this.format(latest, options), - value: this.format(value, options) - }); - errors.push(err); - } - if (errors.length) { - return v.unique(errors); - } - }, { - parse: null, - format: null - }), - date: function(value, options) { - options = v.extend({}, options, { dateOnly: true }); - return v.validators.datetime.call(v.validators.datetime, value, options); - }, - format: function(value, options) { - if (v.isString(options) || options instanceof RegExp) { - options = { pattern: options }; - } - options = v.extend({}, this.options, options); - var message = options.message || this.message || "is invalid", pattern = options.pattern, match; - if (!v.isDefined(value)) { - return; - } - if (!v.isString(value)) { - return message; - } - if (v.isString(pattern)) { - pattern = new RegExp(options.pattern, options.flags); - } - match = pattern.exec(value); - if (!match || match[0].length != value.length) { - return message; - } - }, - inclusion: function(value, options) { - if (!v.isDefined(value)) { - return; - } - if (v.isArray(options)) { - options = { within: options }; - } - options = v.extend({}, this.options, options); - if (v.contains(options.within, value)) { - return; - } - var message = options.message || this.message || "^%{value} is not included in the list"; - return v.format(message, { value }); - }, - exclusion: function(value, options) { - if (!v.isDefined(value)) { - return; - } - if (v.isArray(options)) { - options = { within: options }; - } - options = v.extend({}, this.options, options); - if (!v.contains(options.within, value)) { - return; - } - var message = options.message || this.message || "^%{value} is restricted"; - if (v.isString(options.within[value])) { - value = options.within[value]; - } - return v.format(message, { value }); - }, - email: v.extend(function(value, options) { - options = v.extend({}, this.options, options); - var message = options.message || this.message || "is not a valid email"; - if (!v.isDefined(value)) { - return; - } - if (!v.isString(value)) { - return message; - } - if (!this.PATTERN.exec(value)) { - return message; - } - }, { - PATTERN: /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i - }), - equality: function(value, options, attribute, attributes, globalOptions) { - if (!v.isDefined(value)) { - return; - } - if (v.isString(options)) { - options = { attribute: options }; - } - options = v.extend({}, this.options, options); - var message = options.message || this.message || "is not equal to %{attribute}"; - if (v.isEmpty(options.attribute) || !v.isString(options.attribute)) { - throw new Error("The attribute must be a non empty string"); - } - var otherValue = v.getDeepObjectValue(attributes, options.attribute), comparator = options.comparator || function(v1, v2) { - return v1 === v2; - }, prettify = options.prettify || globalOptions && globalOptions.prettify || v.prettify; - if (!comparator(value, otherValue, options, attribute, attributes)) { - return v.format(message, { attribute: prettify(options.attribute) }); - } - }, - // A URL validator that is used to validate URLs with the ability to - // restrict schemes and some domains. - url: function(value, options) { - if (!v.isDefined(value)) { - return; - } - options = v.extend({}, this.options, options); - var message = options.message || this.message || "is not a valid url", schemes = options.schemes || this.schemes || ["http", "https"], allowLocal = options.allowLocal || this.allowLocal || false, allowDataUrl = options.allowDataUrl || this.allowDataUrl || false; - if (!v.isString(value)) { - return message; - } - var regex = "^(?:(?:" + schemes.join("|") + ")://)(?:\\S+(?::\\S*)?@)?(?:"; - var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))"; - if (allowLocal) { - tld += "?"; - } else { - regex += // IP address exclusion - // private & local networks - "(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})"; - } - regex += // IP address dotted notation octets - // excludes loopback network 0.0.0.0 - // excludes reserved space >= 224.0.0.0 - // excludes network & broacast addresses - // (first & last IP address of each class) - "(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*" + tld + ")(?::\\d{2,5})?(?:[/?#]\\S*)?$"; - if (allowDataUrl) { - var mediaType = "\\w+\\/[-+.\\w]+(?:;[\\w=]+)*"; - var urlchar = "[A-Za-z0-9-_.!~\\*'();\\/?:@&=+$,%]*"; - var dataurl = "data:(?:" + mediaType + ")?(?:;base64)?," + urlchar; - regex = "(?:" + regex + ")|(?:^" + dataurl + "$)"; - } - var PATTERN = new RegExp(regex, "i"); - if (!PATTERN.exec(value)) { - return message; - } - }, - type: v.extend(function(value, originalOptions, attribute, attributes, globalOptions) { - if (v.isString(originalOptions)) { - originalOptions = { type: originalOptions }; - } - if (!v.isDefined(value)) { - return; - } - var options = v.extend({}, this.options, originalOptions); - var type = options.type; - if (!v.isDefined(type)) { - throw new Error("No type was specified"); - } - var check; - if (v.isFunction(type)) { - check = type; - } else { - check = this.types[type]; - } - if (!v.isFunction(check)) { - throw new Error("validate.validators.type.types." + type + " must be a function."); - } - if (!check(value, options, attribute, attributes, globalOptions)) { - var message = originalOptions.message || this.messages[type] || this.message || options.message || (v.isFunction(type) ? "must be of the correct type" : "must be of type %{type}"); - if (v.isFunction(message)) { - message = message(value, originalOptions, attribute, attributes, globalOptions); - } - return v.format(message, { attribute: v.prettify(attribute), type }); - } - }, { - types: { - object: function(value) { - return v.isObject(value) && !v.isArray(value); - }, - array: v.isArray, - integer: v.isInteger, - number: v.isNumber, - string: v.isString, - date: v.isDate, - boolean: v.isBoolean - }, - messages: {} - }) - }; - validate3.formatters = { - detailed: function(errors) { - return errors; - }, - flat: v.flattenErrorsToArray, - grouped: function(errors) { - var attr; - errors = v.groupErrorsByAttribute(errors); - for (attr in errors) { - errors[attr] = v.flattenErrorsToArray(errors[attr]); - } - return errors; - }, - constraint: function(errors) { - var attr; - errors = v.groupErrorsByAttribute(errors); - for (attr in errors) { - errors[attr] = errors[attr].map(function(result) { - return result.validator; - }).sort(); - } - return errors; - } - }; - validate3.exposeModule(validate3, this, exports2, module2, define2); - }).call( - exports, - typeof exports !== "undefined" ? ( - /* istanbul ignore next */ - exports - ) : null, - typeof module !== "undefined" ? ( - /* istanbul ignore next */ - module - ) : null, - typeof define !== "undefined" ? ( - /* istanbul ignore next */ - define - ) : null - ); - } - }); - - // src/js/ekyc.js - var import_validate2 = __toESM(require_validate(), 1); - - // src/js/components/ConsentScreen.js - function templateString() { - return ` - - - - - - - - `; - } - var EndUserConsent = class extends HTMLElement { - constructor() { - super(); - this.idRequiresTotpConsent = ["BVN_MFA"]; - this.templateString = templateString.bind(this); - this.render = () => { - return this.templateString(); - }; - this.attachShadow({ mode: "open" }); - } - connectedCallback() { - this.pages = []; - const template = document.createElement("template"); - template.innerHTML = this.render(); - this.shadowRoot.appendChild(template.content.cloneNode(true)); - this.consentScreen = this.shadowRoot.querySelector("#consent-screen"); - this.totpConsentApp = this.shadowRoot.querySelector("totp-consent-app"); - this.consentRejectedScreen = this.shadowRoot.querySelector( - "#consent-rejected-screen" - ); - this.allowButton = this.shadowRoot.querySelector("#allow"); - this.rejectButton = this.shadowRoot.querySelector("#cancel"); - this.backToConsentButton = this.shadowRoot.querySelector("#back-to-consent"); - this.confirmConsentRejectionButton = this.shadowRoot.querySelector( - "#confirm-consent-rejection" - ); - this.backButton = this.shadowRoot.querySelector("#back-button"); - const CloseIframeButtons = this.shadowRoot.querySelectorAll(".close-iframe"); - this.allowButton.addEventListener( - "click", - (e) => this.handleConsentGrant(e) - ); - this.rejectButton.addEventListener( - "click", - (e) => this.handleConsentGrant(e) - ); - this.backToConsentButton.addEventListener( - "click", - () => this.setActiveScreen(this.consentScreen) - ); - this.confirmConsentRejectionButton.addEventListener( - "click", - (e) => this.handleConsentRejection(e) - ); - this.totpConsentApp.addEventListener( - "SmileIdentity::ConsentDenied::TOTP::ContactMethodsOutdated", - (e) => this.handleTotpConsentEvents(e) - ); - this.totpConsentApp.addEventListener( - "SmileIdentity::ConsentGranted::TOTP", - (e) => this.handleTotpConsentEvents(e) - ); - this.totpConsentApp.addEventListener( - "SmileIdentity::ConsentDenied::Back", - (e) => this.handleBackEvents(e) - ); - this.backButton.addEventListener("click", (e) => { - this.handleBackEvents(e); - }); - CloseIframeButtons.forEach((button) => { - button.addEventListener( - "click", - () => { - this.closeWindow(); - }, - false - ); - }); - this.activeScreen = this.consentScreen; - } - setActiveScreen(screen) { - this.activeScreen.hidden = true; - screen.hidden = false; - this.activeScreen = screen; - } - get baseUrl() { - return this.getAttribute("base-url"); - } - get country() { - return this.getAttribute("country"); - } - get demoMode() { - return !!this.hasAttribute("demo-mode"); - } - get hideBack() { - return this.hasAttribute("hide-back-to-host"); - } - get idHint() { - return this.getAttribute("id-hint") || "Your BVN should be 11 digits long"; - } - get idRegex() { - return this.getAttribute("id-regex"); - } - get idType() { - return this.getAttribute("id-type"); - } - get idTypeLabel() { - return this.getAttribute("id-type-label"); - } - get partnerId() { - return this.getAttribute("partner-id"); - } - get partnerName() { - return this.getAttribute("partner-name"); - } - get partnerLogoURL() { - return this.getAttribute("partner-logo"); - } - get partnerPolicyURL() { - return this.getAttribute("policy-url"); - } - get themeColor() { - return this.getAttribute("theme-color") || "#043C93"; - } - get token() { - return this.getAttribute("token"); - } - handleConsentGrant(e) { - const granted = e.target === this.allowButton; - if (granted) { - if (this.idRequiresTotpConsent.includes(this.idType)) { - this.setActiveScreen(this.totpConsentApp); - this.pages.push(this.consentScreen); - } else { - this.dispatchEvent( - new CustomEvent("SmileIdentity::ConsentGranted", { - detail: { - consented: { - personal_details: granted, - contact_information: granted, - document_information: granted - } - } - }) - ); - } - } else { - this.setActiveScreen(this.consentRejectedScreen); - } - } - handleConsentRejection() { - this.dispatchEvent(new CustomEvent("SmileIdentity::ConsentDenied")); - } - handleTotpConsentEvents(e) { - const customEvent = new CustomEvent(e.type, { - detail: { - ...e.detail - } - }); - this.dispatchEvent(customEvent); - } - handleBackEvents() { - const page = this.pages.pop(); - if (page) { - this.setActiveScreen(page); - } else { - this.dispatchEvent(new CustomEvent("SmileIdentity::Exit")); - } - } - closeWindow() { - const referenceWindow = window.parent; - referenceWindow.postMessage("SmileIdentity::Close", "*"); - } - }; - var ConsentScreen_default = EndUserConsent; - - // src/js/components/TotpConsentApp.js - var import_validate = __toESM(require_validate(), 1); - function postData(url, data) { - return fetch(url, { - method: "POST", - mode: "cors", - cache: "no-cache", - headers: { - Accept: "application/json", - "Content-Type": "application/json" - }, - body: JSON.stringify(data) - }); - } - function markup() { - return ` - - -
- -

- Enter your ${this.idTypeLabel} -

- -
-
- - - - -

- ${this.idHint} -

-
- - -
-
- - - - - `; - } - var TotpBasedConsent = class extends HTMLElement { - constructor() { - super(); - this.templateString = markup.bind(this); - this.render = () => { - return this.templateString(); - }; - this.attachShadow({ mode: "open" }); - this.modes = []; - this["otp-delivery-mode"] = ""; - this.queryOtpModes = this.queryOtpModes.bind(this); - this.selectOtpMode = this.selectOtpMode.bind(this); - this.submitOtp = this.submitOtp.bind(this); - this.switchContactMethod = this.switchContactMethod.bind(this); - this.handleTotpConsentGrant = this.handleTotpConsentGrant.bind(this); - this.handleTotpConsentContactMethodsOutdated = this.handleTotpConsentContactMethodsOutdated.bind(this); - this.pages = []; - } - static get observedAttributes() { - return ["modes", "otp-delivery-mode"]; - } - attributeChangedCallback(name) { - switch (name) { - case "modes": - case "otp-delivery-mode": { - const updatedTemplate = document.createElement("template"); - updatedTemplate.innerHTML = this.render(); - const updatedNode = updatedTemplate.content.cloneNode(true).querySelector(`#${this.activeScreen.id}`); - updatedNode.hidden = false; - this.shadowRoot.replaceChild(updatedNode, this.activeScreen); - this.setUpEventListeners(); - this.setActiveScreen(updatedNode); - break; - } - default: - break; - } - } - setUpEventListeners() { - this.idEntryScreen = this.shadowRoot.querySelector("#id-entry"); - this.selectModeScreen = this.shadowRoot.querySelector("#select-mode"); - this.otpVerificationScreen = this.shadowRoot.querySelector("#otp-verification"); - if (!this.activeScreen) { - this.activeScreen = this.idEntryScreen; - } - this.queryOtpModesButton = this.idEntryScreen.querySelector("#query-otp-modes"); - this.backButton = this.idEntryScreen.querySelector("#back-button"); - this.selectOtpModeButton = this.selectModeScreen.querySelector("#select-otp-mode"); - this.entryBackbutton = this.selectModeScreen.querySelector( - "#back-to-entry-button" - ); - this.contactMethodsOutdatedButton = this.selectModeScreen.querySelector( - "#contact-methods-outdated" - ); - this.submitOtpButton = this.otpVerificationScreen.querySelector("#submit-otp"); - this.switchContactMethodButton = this.otpVerificationScreen.querySelector( - ".try-another-method" - ); - const CloseIframeButtons = this.shadowRoot.querySelectorAll(".close-iframe"); - this.idNumberInput = this.idEntryScreen.querySelector("#id_number"); - this.modeInputs = this.selectModeScreen.querySelectorAll('[name="mode"]'); - this.otpInput = this.otpVerificationScreen.querySelector("#totp-token"); - this.queryOtpModesButton.addEventListener( - "click", - (e) => this.queryOtpModes(e) - ); - this.selectOtpModeButton.addEventListener( - "click", - (e) => this.selectOtpMode(e) - ); - this.submitOtpButton.addEventListener("click", (e) => this.submitOtp(e)); - this.switchContactMethodButton.addEventListener( - "click", - (e) => this.switchContactMethod(e) - ); - this.contactMethodsOutdatedButton.addEventListener( - "click", - (e) => this.handleTotpConsentContactMethodsOutdated(e) - ); - this.entryBackbutton.addEventListener("click", () => { - this.handleBackClick(); - }); - this.backButton.addEventListener("click", () => { - this.handleBackClick(); - }); - CloseIframeButtons.forEach((button) => { - button.addEventListener( - "click", - () => { - this.closeWindow(); - }, - false - ); - }); - } - closeWindow() { - const referenceWindow = window.parent; - referenceWindow.postMessage("SmileIdentity::Close", "*"); - } - handleBackClick() { - const page = this.pages.pop(); - if (page) { - this.setActiveScreen(page); - } else { - this.dispatchEvent( - new CustomEvent("SmileIdentity::ConsentDenied::Back", {}) - ); - } - } - connectedCallback() { - const template = document.createElement("template"); - template.innerHTML = this.render(); - this.shadowRoot.appendChild(template.content.cloneNode(true)); - this.setUpEventListeners(); - } - switchContactMethod() { - this.queryOtpModes(); - } - resetForm() { - const invalidElements = this.activeScreen.querySelectorAll("[aria-invalid]"); - invalidElements.forEach((el) => el.removeAttribute("aria-invalid")); - const validationMessages = this.activeScreen.querySelectorAll( - ".validation-message" - ); - validationMessages.forEach((el) => el.remove()); - } - handleIdNumberValidationErrors(errors) { - const fields = Object.keys(errors); - fields.forEach((field) => { - const input = this.activeScreen.querySelector(`#${field}`); - input.setAttribute("aria-invalid", "true"); - input.setAttribute("aria-describedby", `${field}-hint`); - const errorDiv = document.createElement("div"); - errorDiv.setAttribute("id", `${field}-hint`); - errorDiv.setAttribute("class", "validation-message"); - errorDiv.textContent = errors[field][0]; - input.insertAdjacentElement("afterend", errorDiv); - }); - } - handleActiveScreenErrors(error) { - const submitButton = this.activeScreen.querySelector('[type="submit"]'); - const errorDiv = document.createElement("div"); - errorDiv.setAttribute("class", "validation-message"); - errorDiv.textContent = error; - submitButton.insertAdjacentElement("beforebegin", errorDiv); - } - validateIdNumber(idNumber) { - const validationConstraints = { - id_number: { - presence: { - allowEmpty: false, - message: "is required" - }, - format: new RegExp(this.idRegex) - } - }; - const errors = (0, import_validate.default)({ id_number: idNumber }, validationConstraints); - if (errors) { - this.handleIdNumberValidationErrors(errors); - } - return errors; - } - async queryOtpModes(event) { - if (event) { - event.preventDefault(); - this.resetForm(); - } - const validationErrors = this.validateIdNumber(this.idNumberInput.value); - localStorage.setItem("idNumber", this.idNumberInput.value || this.idNumber); - if (!validationErrors) { - const data = { - country: this.country, - id_number: this.idNumber, - id_type: this.idType, - partner_id: this.partnerId, - token: this.token - }; - const url = `${this.baseUrl}/totp_consent`; - try { - this.toggleLoading(); - const response = await postData(url, data); - const json = await response.json(); - this.toggleLoading(); - if (!response.ok) { - this.handleActiveScreenErrors(json.error); - } else { - this.sessionId = json.session_id; - this.modes = json.modes; - this.setActiveScreen(this.selectModeScreen); - this.setAttribute("modes", json.modes); - } - } catch (error) { - this.toggleLoading(); - this.handleActiveScreenErrors(error.message); - } - } - } - async selectOtpMode(event) { - event.preventDefault(); - this.resetForm(); - this.mode = Array.prototype.find.call( - this.modeInputs, - (node) => node.checked - ).value; - const data = { - country: this.country, - id_number: this.idNumber, - id_type: this.idType, - mode: this.mode, - partner_id: this.partnerId, - session_id: this.sessionId, - token: this.token - }; - const url = `${this.baseUrl}/totp_consent/mode`; - try { - this.toggleLoading(); - const response = await postData(url, data); - const json = await response.json(); - this.toggleLoading(); - if (!response.ok) { - this.handleActiveScreenErrors(json.error); - } else { - this.selectedOtpDeliveryMode = this.modes.filter( - (mode) => mode[this.mode] - )[0][this.mode]; - this.setActiveScreen(this.otpVerificationScreen); - this.setAttribute("otp-delivery-mode", this.selectedOtpDeliveryMode); - } - } catch (error) { - this.toggleLoading(); - this.handleActiveScreenErrors(error.message); - } - } - async submitOtp(event) { - event.preventDefault(); - this.resetForm(); - this.otp = this.otpInput.value; - const data = { - country: this.country, - id_number: this.idNumber, - id_type: this.idType, - otp: this.otp, - partner_id: this.partnerId, - session_id: this.sessionId, - token: this.token - }; - const url = `${this.baseUrl}/totp_consent/otp`; - try { - this.toggleLoading(); - const response = await postData(url, data); - const json = await response.json(); - this.toggleLoading(); - if (!response.ok) { - this.handleActiveScreenErrors(json.error); - } else { - this.handleTotpConsentGrant(event); - } - } catch (error) { - this.toggleLoading(); - this.handleActiveScreenErrors(error.message); - } - } - toggleLoading() { - const button = this.activeScreen.querySelector('button[type="submit"]'); - const text = button.querySelector(".text"); - const arrow = button.querySelector("svg"); - const spinner = button.querySelector(".spinner"); - button.toggleAttribute("disabled"); - text.toggleAttribute("hidden"); - arrow.toggleAttribute("hidden"); - spinner.toggleAttribute("hidden"); - } - setActiveScreen(screen) { - this.activeScreen.hidden = true; - screen.hidden = false; - this.activeScreen = screen; - } - get baseUrl() { - return this.getAttribute("base-url"); - } - get country() { - return this.getAttribute("country"); - } - get idHint() { - return this.getAttribute("id-hint") || "Your BVN should be 11 digits long"; - } - get idNumber() { - return localStorage.getItem("idNumber"); - } - get idRegex() { - return this.getAttribute("id-regex"); - } - get idType() { - return this.getAttribute("id-type"); - } - get idTypeLabel() { - return this.getAttribute("id-type-label"); - } - get partnerId() { - return this.getAttribute("partner-id"); - } - get partnerName() { - return this.getAttribute("partner-name"); - } - get token() { - return this.getAttribute("token"); - } - handleTotpConsentGrant() { - const customEvent = new CustomEvent("SmileIdentity::ConsentGranted::TOTP", { - detail: { - id_number: this.idNumber, - session_id: this.sessionId, - consented: { - personal_details: true, - contact_information: true, - document_information: true - } - } - }); - this.dispatchEvent(customEvent); - } - handleTotpConsentContactMethodsOutdated() { - const tag = "SmileIdentity::ConsentDenied::TOTP::ContactMethodsOutdated"; - const customEvent = new CustomEvent(tag, { - detail: { - message: tag, - data: { - id_number: this.idNumber, - session_id: this.sessionId - } - } - }); - this.dispatchEvent(customEvent); - } - }; - var TotpConsentApp_default = TotpBasedConsent; - - // src/js/components/Combobox.js - function generateId(prefix) { - const id = [...Array(30)].map(() => Math.random().toString(36)[3]).join(""); - return `${prefix}-${id}`; - } - function isElementInView(element) { - const bounding = element.getBoundingClientRect(); - return bounding.top >= 0 && bounding.left >= 0 && bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) && bounding.right <= (window.innerWidth || document.documentElement.clientWidth); - } - function isScrollable(element) { - return element && element.clientHeight < element.scrollHeight; - } - function maintainScrollVisibility(activeElement, scrollParent) { - const { offsetHeight, offsetTop } = activeElement; - const { offsetHeight: parentOffsetHeight, scrollTop } = scrollParent; - const isAbove = offsetTop < scrollTop; - const isBelow = offsetTop + offsetHeight > scrollTop + parentOffsetHeight; - if (isAbove) { - scrollParent.scrollTo(0, offsetTop); - } else if (isBelow) { - scrollParent.scrollTo(0, offsetTop - parentOffsetHeight + offsetHeight); - } - } - var ComboboxRoot = class extends HTMLElement { - constructor() { - super(); - this.handleRoaming = this.handleRoaming.bind(this); - } - connectedCallback() { - this.trigger = this.querySelector("smileid-combobox-trigger"); - document.addEventListener("click", this.handleRoaming); - this.addEventListener("focusout", this.handleRoaming); - this.addEventListener("blur", this.handleRoaming); - } - disconnectedCallback() { - document.removeEventListener("click", this.handleRoaming); - this.removeEventListener("focusout", this.handleRoaming); - this.removeEventListener("blur", this.handleRoaming); - } - handleRoaming(event) { - const target = event.relatedTarget || event.target; - if (this.contains(target)) { - return; - } - if (this.trigger.getAttribute("expanded") === "true") { - this.trigger.setAttribute("expanded", "false"); - } - } - }; - var ComboboxTrigger = class extends HTMLElement { - constructor() { - super(); - this.handleKeyUp = this.handleKeyUp.bind(this); - this.handleKeyDown = this.handleKeyDown.bind(this); - this.handleSelection = this.handleSelection.bind(this); - this.toggleExpansionState = this.toggleExpansionState.bind(this); - } - get type() { - return this.getAttribute("type") || "text"; - } - get label() { - return this.getAttribute("label") || ""; - } - get value() { - return this.getAttribute("value") || ""; - } - get disabled() { - return this.hasAttribute("disabled"); - } - connectedCallback() { - if (!this.label) { - throw new Error(": a label attribute is required"); - } - this.innerHTML = `${this.type === "text" ? ` -
- - -
- ` : ``}`; - this.setAttribute("expanded", false); - this.inputTrigger = this.querySelector("input"); - this.buttonTrigger = this.querySelector("button"); - this.buttonTrigger.setAttribute("aria-expanded", false); - this.buttonTrigger.setAttribute("role", "combobox"); - this.buttonTrigger.addEventListener("keydown", this.handleKeyDown); - this.buttonTrigger.addEventListener("click", this.toggleExpansionState); - if (this.inputTrigger) { - this.inputTrigger.setAttribute("aria-expanded", false); - this.inputTrigger.setAttribute("role", "combobox"); - this.inputTrigger.addEventListener("keydown", this.handleKeyDown); - this.inputTrigger.addEventListener("keyup", this.handleKeyUp); - this.inputTrigger.addEventListener("change", (e) => e.stopPropagation()); - } - this.listbox = this.parentElement.querySelector("smileid-combobox-listbox"); - this.options = Array.from( - this.parentElement.querySelectorAll("smileid-combobox-option") - ); - this.options.forEach((node) => { - node.addEventListener("Combobox::Option::Select", this.handleSelection); - }); - } - disconnectedCallback() { - this.buttonTrigger.removeEventListener("keydown", this.handleKeyDown); - this.buttonTrigger.removeEventListener("click", this.toggleExpansionState); - if (this.inputTrigger) { - this.inputTrigger.removeEventListener("keydown", this.handleKeyDown); - this.inputTrigger.removeEventListener("keyup", this.handleKeyUp); - this.inputTrigger.removeEventListener( - "change", - (e) => e.stopPropagation() - ); - } - if (this.options) { - this.options.forEach((node) => { - node.removeEventListener( - "Combobox::Option::Select", - this.handleSelection - ); - }); - } - } - handleKeyDown(event) { - if (event.ctrlKey || event.shiftKey) { - return; - } - const key = event.key; - switch (key) { - case "Enter": - case "Space": - case " ": - if (this.getAttribute("expanded") === "true") { - if (this.inputTrigger && (key === "Space" || key === " ")) { - this.resetListbox(); - } else { - event.preventDefault(); - const selectedOption = this.buttonTrigger.getAttribute( - "aria-activedescendant" - ); - if (selectedOption) { - document.getElementById(selectedOption).click(); - } - } - } else { - event.preventDefault(); - this.toggleExpansionState(); - } - break; - case "Esc": - case "Escape": - event.preventDefault(); - if (this.getAttribute("expanded") === "true") { - this.toggleExpansionState(); - } - break; - case "Down": - case "ArrowDown": - event.preventDefault(); - if (this.getAttribute("expanded") !== "true") { - this.toggleExpansionState(); - this.focusListbox("First"); - } else { - this.focusListbox("Down"); - } - break; - case "Up": - case "ArrowUp": - event.preventDefault(); - if (this.getAttribute("expanded") !== "true") { - this.toggleExpansionState(); - this.focusListbox("Last"); - } else { - this.focusListbox("Up"); - } - break; - case "Left": - case "ArrowLeft": - case "Right": - case "ArrowRight": - case "Home": - case "End": - this.resetListbox(); - break; - case "Tab": - break; - default: - break; - } - } - handleKeyUp(event) { - const key = event.key; - const isPrintableCharacter = (str) => str.length === 1 && str.match(/\S| /); - if (event.key === "Escape" || event.key === "Esc") { - event.preventDefault(); - if (this.getAttribute("expanded") === "true") { - this.toggleExpansionState(); - } else if (this.inputTrigger) { - this.inputTrigger.value = ""; - this.listbox.dispatchEvent( - new CustomEvent("Combobox::Listbox::Filter", { detail: "" }) - ); - } - } - if (isPrintableCharacter(key) || key === "Backspace") { - this.resetListbox(); - this.filterListbox(event.target.value); - } - } - toggleExpansionState() { - const listboxIsExpanded = this.getAttribute("expanded") === "true"; - this.setAttribute("expanded", !listboxIsExpanded); - this.buttonTrigger.setAttribute("aria-expanded", !listboxIsExpanded); - if (this.inputTrigger) { - this.inputTrigger.setAttribute("aria-expanded", !listboxIsExpanded); - } - } - handleSelection(event) { - if (this.inputTrigger) { - this.inputTrigger.value = event.detail.label; - } else { - this.buttonTrigger.textContent = event.detail.label; - } - this.toggleExpansionState(); - this.parentElement.dispatchEvent( - new CustomEvent("change", { - detail: { - value: event.detail.value - } - }) - ); - } - filterListbox(value) { - if (this.getAttribute("expanded") !== "true") { - this.toggleExpansionState(); - } - this.listbox.dispatchEvent( - new CustomEvent("Combobox::Listbox::Filter", { detail: value }) - ); - } - focusListbox(direction) { - this.resetListbox(); - this.listbox.dispatchEvent( - new CustomEvent("Combobox::Listbox::Focus", { - detail: { - direction - } - }) - ); - } - resetListbox() { - this.listbox.dispatchEvent(new CustomEvent("Combobox::Listbox::Reset")); - } - }; - var ComboboxListbox = class extends HTMLElement { - constructor() { - super(); - this.handleFilter = this.handleFilter.bind(this); - this.handleFocus = this.handleFocus.bind(this); - this.handleReset = this.handleReset.bind(this); - this.handleOptionSelection = this.handleOptionSelection.bind(this); - } - get emptyLabel() { - return this.getAttribute("empty-label"); - } - get emptyState() { - return ` -

- ${this.emptyLabel || "No items"} -

- `; - } - connectedCallback() { - this.setAttribute("role", "listbox"); - this.setAttribute("id", generateId("listbox")); - this.addEventListener("Combobox::Listbox::Filter", this.handleFilter); - this.addEventListener("Combobox::Listbox::Focus", this.handleFocus); - this.addEventListener("Combobox::Listbox::Reset", this.handleReset); - this.triggers = Array.from( - this.parentElement.querySelectorAll( - "smileid-combobox-trigger input, smileid-combobox-trigger button" - ) - ); - this.triggers.forEach( - (node) => node.setAttribute("aria-controls", this.getAttribute("id")) - ); - this.optionNodes = Array.from( - this.querySelectorAll("smileid-combobox-option") - ); - this.selectedNode = this.optionNodes.find( - (node) => !node.hasAttribute("hidden") && node.hasAttribute("aria-selected") - ) || this.optionNodes.filter((node) => !node.hasAttribute("hidden"))[0]; - this.selectedNode.setAttribute("tabindex", "0"); - this.optionNodes.forEach((node) => { - node.addEventListener( - "Combobox::Option::Select", - this.handleOptionSelection - ); - }); - if (this.optionNodes.length === 0) { - this.innerHTML = this.emptyState; - } - } - disconnectedCallback() { - this.removeEventListener("Combobox::Listbox::Filter", this.handleFilter); - this.removeEventListener("Combobox::Listbox::Focus", this.handleFocus); - this.removeEventListener("Combobox::Listbox::Reset", this.handleReset); - this.optionNodes.forEach((node) => { - node.removeEventListener( - "Combobox::Option::Select", - this.handleOptionSelection - ); - }); - } - static get observedAttributes() { - return ["search-term"]; - } - attributeChangedCallback(name, oldValue, newValue) { - switch (name) { - case "search-term": - if (oldValue && !newValue) { - this.optionNodes.forEach((node) => { - node.removeAttribute("hidden"); - }); - } else if (newValue) { - this.filterNodes(newValue); - } - break; - default: - break; - } - } - filterNodes(searchTerm) { - this.optionNodes.forEach((node) => { - const value = node.getAttribute("value").toLowerCase(); - const label = node.getAttribute("label").toLowerCase(); - const containsSearchTerm = value.includes(searchTerm.toLowerCase()) || label.includes(searchTerm.toLowerCase()); - if (containsSearchTerm) { - node.removeAttribute("hidden"); - } else { - node.setAttribute("hidden", true); - } - }); - const optionsVisible = this.optionNodes.find( - (node) => !node.hasAttribute("hidden") - ); - const emptyState = this.querySelector("#empty-state"); - if (!optionsVisible && !emptyState) { - this.insertAdjacentHTML("afterbegin", this.emptyState); - } else if (optionsVisible && emptyState) { - this.removeChild(emptyState); - } - } - handleFilter(event) { - const searchTerm = event.detail; - this.setAttribute("search-term", searchTerm); - } - handleFocus(event) { - this.setSelected(event.detail.direction); - } - handleReset() { - this.optionNodes.forEach((node) => node.setAttribute("tabindex", "-1")); - } - handleOptionSelection(event) { - const inputTrigger = this.triggers.filter( - (node) => node.tagName === "INPUT" - )[0]; - if (inputTrigger) { - this.setAttribute("search-term", event.detail.label); - } - } - setSelected(direction) { - const visibleOptions = this.optionNodes.filter( - (node) => !node.hasAttribute("hidden") - ); - this.selectedNode.setAttribute("tabindex", "0"); - const currentIndex = visibleOptions.findIndex( - (node) => node === this.selectedNode - ); - const lastIndex = visibleOptions.length - 1; - let nextIndex; - switch (direction) { - case "First": - nextIndex = 0; - break; - case "Last": - nextIndex = lastIndex; - break; - case "Up": - if (currentIndex === 0) { - nextIndex = lastIndex; - } else { - nextIndex = currentIndex - 1; - } - break; - default: - if (currentIndex === lastIndex) { - nextIndex = 0; - } else { - nextIndex = currentIndex + 1; - } - break; - } - if (currentIndex !== nextIndex) { - this.swapSelected(this.selectedNode, visibleOptions[nextIndex]); - } - } - swapSelected(currentNode, newNode) { - currentNode.setAttribute("tabindex", "-1"); - newNode.setAttribute("tabindex", "0"); - this.selectedNode = newNode; - if (isScrollable(this)) { - maintainScrollVisibility(this.selectedNode, this); - } - if (!isElementInView(newNode)) { - newNode.scrollIntoView({ behavior: "smooth", block: "nearest" }); - } - this.triggers.forEach( - (node) => node.setAttribute("aria-activedescendant", newNode.id) - ); - } - }; - var ComboboxOption = class extends HTMLElement { - connectedCallback() { - this.setAttribute("role", "option"); - this.setAttribute("tabindex", "-1"); - this.setAttribute("id", generateId("option")); - this.options = Array.from( - this.parentElement.querySelectorAll("smileid-combobox-option") - ); - this.addEventListener("click", this.select); - } - disconnectedCallback() { - this.removeEventListener("click", this.select); - } - get value() { - return this.getAttribute("value"); - } - get label() { - return this.getAttribute("label"); - } - select() { - const selectedOption = this.options.find( - (node) => node.getAttribute("aria-selected") - ); - if (selectedOption) { - selectedOption.removeAttribute("aria-selected"); - } - this.setAttribute("aria-selected", true); - this.dispatchEvent( - new CustomEvent("Combobox::Option::Select", { - detail: { - label: this.label, - value: this.value, - id: this.getAttribute("id") - } - }) - ); - } - }; - var Combobox_default = { - Root: ComboboxRoot, - Trigger: ComboboxTrigger, - List: ComboboxListbox, - Option: ComboboxOption - }; - - // package.json - var version = "v1.2.3"; - - // src/js/ekyc.js - (function eKYC() { - "use strict"; - const endpoints = { - development: "https://devapi.smileidentity.com/v1", - sandbox: "https://testapi.smileidentity.com/v1", - live: "https://api.smileidentity.com/v1", - production: "https://api.smileidentity.com/v1" - }; - const referenceWindow = window.parent; - referenceWindow.postMessage("SmileIdentity::ChildPageReady", "*"); - window.customElements.define("end-user-consent", ConsentScreen_default); - window.customElements.define("totp-consent-app", TotpConsentApp_default); - window.customElements.define("smileid-combobox", Combobox_default.Root); - window.customElements.define("smileid-combobox-trigger", Combobox_default.Trigger); - window.customElements.define("smileid-combobox-listbox", Combobox_default.List); - window.customElements.define("smileid-combobox-option", Combobox_default.Option); - const pages = []; - let activeScreen; - let config; - let consent_information; - let EndUserConsent2; - let id_info; - let partner_params; - let ngBankCodes; - let productConstraints; - const LoadingScreen = document.querySelector("#loading-screen"); - const SelectIDType = document.querySelector("#select-id-type"); - const IDInfoForm = document.querySelector("#id-info"); - const CompleteScreen = document.querySelector("#complete-screen"); - let disableBackOnFirstScreen = false; - const CloseIframeButtons = document.querySelectorAll(".close-iframe"); - function postData2(url = "", data = {}) { - return fetch(url, { - method: "POST", - mode: "cors", - cache: "no-cache", - headers: { - Accept: "application/json", - "Content-Type": "application/json" - }, - body: JSON.stringify(data) - }); - } - async function getProductConstraints() { - try { - const productsConfigPayload = { - partner_id: config.partner_details.partner_id, - token: config.token, - partner_params - }; - const productsConfigUrl = `${endpoints[config.environment]}/products_config`; - const productsConfigPromise = postData2( - productsConfigUrl, - productsConfigPayload - ); - const servicesPromise = fetch( - `${endpoints[config.environment]}/services` - ); - const [productsConfigResponse, servicesResponse] = await Promise.all([ - productsConfigPromise, - servicesPromise - ]); - if (productsConfigResponse.ok && servicesResponse.ok) { - const partnerConstraints = await productsConfigResponse.json(); - const generalConstraints = await servicesResponse.json(); - ngBankCodes = generalConstraints.bank_codes; - const previewBvnMfa = config.previewBVNMFA; - if (previewBvnMfa) { - generalConstraints.hosted_web.enhanced_kyc.NG.id_types.BVN_MFA = { - id_number_regex: "^[0-9]{11}$", - label: "Bank Verification Number (with OTP)", - required_fields: [ - "country", - "id_type", - "session_id", - "user_id", - "job_id" - ], - test_data: "00000000000" - }; - } - return { - partnerConstraints, - generalConstraints: generalConstraints.hosted_web.enhanced_kyc - }; - } - throw new Error("Failed to get supported ID types"); - } catch (e) { - throw new Error("Failed to get supported ID types", { cause: e }); - } - } - window.addEventListener( - "message", - async (event) => { - if (event.data && event.data.includes("SmileIdentity::Configuration")) { - config = JSON.parse(event.data); - activeScreen = LoadingScreen; - getPartnerParams(); - const { partnerConstraints, generalConstraints } = await getProductConstraints(); - productConstraints = generalConstraints; - initializeSession(generalConstraints, partnerConstraints); - } - }, - false - ); - function setInitialScreen(partnerConstraints) { - const { country: selectedCountry, id_type: selectedIDType } = id_info; - const selectedIdRequiresConsent = partnerConstraints.consentRequired[selectedCountry] ? partnerConstraints.consentRequired[selectedCountry].includes( - selectedIDType - ) : false; - if (selectedIdRequiresConsent || config.consent_required || config.demo_mode) { - const IDRequiresConsent = selectedIdRequiresConsent || config.consent_required && config.consent_required[selectedCountry] && config.consent_required[selectedCountry].includes(selectedIDType); - if (IDRequiresConsent || config.demo_mode) { - customizeConsentScreen(); - setActiveScreen(EndUserConsent2); - } else { - setActiveScreen(IDInfoForm); - } - } else { - hideIdFromBackExit(); - setActiveScreen(IDInfoForm); - } - customizeForm(); - } - function hideIdFromBackExit() { - if (!disableBackOnFirstScreen) - return; - IDInfoForm.querySelector(".nav").classList.add("justify-right"); - IDInfoForm.querySelector(".back-wrapper").style.display = "none"; - } - function initializeSession(generalConstraints, partnerConstraints) { - const supportedCountries = Object.keys(generalConstraints).map((countryCode) => ({ - code: countryCode, - name: generalConstraints[countryCode].name - })).sort((a, b) => { - if (a.name < b.name) { - return -1; - } - if (a.name > b.name) { - return 1; - } - return 0; - }).map((item) => item.code); - let validCountries = []; - if (config.id_selection) { - const selectedCountryList = Object.keys(config.id_selection); - validCountries = supportedCountries.filter( - (value) => selectedCountryList.includes(value) - ); - if (validCountries.length === 1) { - const selectedCountry = validCountries[0]; - id_info = { - country: validCountries[0] - }; - const idTypes = config.id_selection[selectedCountry]; - if (idTypes.length === 1 || typeof idTypes === "string") { - id_info.id_type = Array.isArray(idTypes) ? idTypes[0] : idTypes; - disableBackOnFirstScreen = true; - setInitialScreen(partnerConstraints); - } - } - } else { - validCountries = Object.keys(partnerConstraints.idSelection.enhanced_kyc); - } - if (!id_info || !id_info.id_type) { - const selectCountry = SelectIDType.querySelector("#country"); - const selectIDType = SelectIDType.querySelector("#id_type"); - const hostedWebConfigForm = document.querySelector( - 'form[name="hosted-web-config"]' - ); - selectCountry.disabled = false; - setActiveScreen(SelectIDType); - const loadIdTypes = (countryCode) => { - if (countryCode) { - const validIDTypes = config.id_selection ? config.id_selection : partnerConstraints.idSelection.enhanced_kyc; - const constrainedIDTypes = Object.keys( - generalConstraints[countryCode].id_types - ); - const selectedIDTypes = validIDTypes[countryCode].filter( - (value) => constrainedIDTypes.includes(value) - ); - selectIDType.innerHTML = ""; - const initialOption = document.createElement("option"); - initialOption.setAttribute("value", ""); - initialOption.textContent = "--Please Select--"; - selectIDType.appendChild(initialOption); - selectedIDTypes.forEach((IDType) => { - const option = document.createElement("option"); - option.setAttribute("value", IDType); - option.textContent = generalConstraints[countryCode].id_types[IDType].label; - selectIDType.appendChild(option); - }); - selectIDType.disabled = false; - } else { - selectIDType.innerHTML = ""; - const option = document.createElement("option"); - option.disabled = true; - option.setAttribute("value", ""); - option.textContent = "--Select Country First--"; - selectIDType.appendChild(option); - } - }; - selectCountry.addEventListener("change", (e) => { - loadIdTypes(e.target.value); - }); - validCountries.forEach((country) => { - const countryObject = generalConstraints[country]; - if (countryObject) { - const option = document.createElement("option"); - option.setAttribute("value", country); - option.textContent = countryObject.name; - if (id_info && id_info.country && country === id_info.country) { - option.setAttribute("selected", true); - selectCountry.value = country; - selectCountry.disabled = true; - loadIdTypes(country); - } - selectCountry.appendChild(option); - } - }); - hostedWebConfigForm.addEventListener("submit", (e) => { - e.preventDefault(); - const selectedCountry = selectCountry.value; - const selectedIDType = selectIDType.value; - id_info = { - country: selectedCountry, - id_type: selectedIDType - }; - setInitialScreen(partnerConstraints); - }); - } - } - function initiateDemoMode() { - const demoTips = document.querySelectorAll(".demo-tip"); - Array.prototype.forEach.call(demoTips, (tip) => { - tip.hidden = false; - }); - const script = document.createElement("script"); - script.type = "text/javascript"; - script.src = "js/demo-ekyc.min.js"; - document.body.appendChild(script); - } - IDInfoForm.querySelector("#submitForm").addEventListener( - "click", - (event) => { - handleFormSubmit(event); - }, - false - ); - IDInfoForm.querySelector("#back-button").addEventListener( - "click", - (event) => { - event.preventDefault(); - const page = pages.pop(); - setActiveScreen(page); - }, - false - ); - CloseIframeButtons.forEach((button) => { - button.addEventListener( - "click", - () => { - closeWindow(true); - }, - false - ); - }); - function customizeConsentScreen() { - const partnerDetails = config.partner_details; - const main = document.querySelector("main"); - EndUserConsent2 = document.querySelector("end-user-consent"); - if (EndUserConsent2) { - main.removeChild(EndUserConsent2); - } - EndUserConsent2 = document.createElement("end-user-consent"); - EndUserConsent2.setAttribute( - "base-url", - endpoints[config.environment] || config.environment - ); - EndUserConsent2.setAttribute("country", id_info.country); - EndUserConsent2.setAttribute( - "id-regex", - productConstraints[id_info.country].id_types[id_info.id_type].id_number_regex - ); - EndUserConsent2.setAttribute("id-type", id_info.id_type); - EndUserConsent2.setAttribute( - "id-type-label", - productConstraints[id_info.country].id_types[id_info.id_type].label - ); - EndUserConsent2.setAttribute("partner-id", partnerDetails.partner_id); - EndUserConsent2.setAttribute("partner-name", partnerDetails.name); - EndUserConsent2.setAttribute("partner-logo", partnerDetails.logo_url); - EndUserConsent2.setAttribute("policy-url", partnerDetails.policy_url); - EndUserConsent2.setAttribute("theme-color", partnerDetails.theme_color); - EndUserConsent2.setAttribute("token", config.token); - if (disableBackOnFirstScreen) { - EndUserConsent2.setAttribute("hide-back-to-host", true); - } - if (config.demo_mode) { - EndUserConsent2.setAttribute("demo-mode", config.demo_mode); - localStorage.setItem( - "SmileIdentityConstraints", - JSON.stringify(productConstraints, null, 2) - ); - initiateDemoMode(); - } - EndUserConsent2.addEventListener( - "SmileIdentity::Exit", - () => { - setActiveScreen(SelectIDType); - }, - false - ); - EndUserConsent2.addEventListener( - "SmileIdentity::ConsentGranted", - (event) => { - consent_information = event.detail; - if (consent_information.consented.personal_details) { - id_info.consent_information = consent_information; - setActiveScreen(IDInfoForm); - } - }, - false - ); - EndUserConsent2.addEventListener( - "SmileIdentity::ConsentGranted::TOTP", - (event) => { - consent_information = event.detail; - if (consent_information.consented.personal_details) { - id_info.id_number = consent_information.id_number; - id_info.session_id = consent_information.session_id; - id_info.consent_information = consent_information; - handleFormSubmit(); - } - }, - false - ); - EndUserConsent2.addEventListener( - "SmileIdentity::ConsentDenied", - () => { - referenceWindow.postMessage("SmileIdentity::ConsentDenied", "*"); - closeWindow(); - }, - false - ); - EndUserConsent2.addEventListener( - "SmileIdentity::ConsentDenied::TOTP::ContactMethodsOutdated", - (event) => { - referenceWindow.postMessage(event.detail, "*"); - closeWindow(); - }, - false - ); - main.appendChild(EndUserConsent2); - } - function customizeForm() { - setGuideTextForIDType(); - setFormInputs(); - } - function setGuideTextForIDType() { - const label = document.querySelector('[for="id_number"]'); - const input = document.querySelector("#id_number"); - label.innerHTML = productConstraints[id_info.country].id_types[id_info.id_type].label; - input.setAttribute( - "placeholder", - productConstraints[id_info.country].id_types[id_info.id_type].test_data - ); - input.setAttribute( - "pattern", - productConstraints[id_info.country].id_types[id_info.id_type].id_number_regex - ); - } - function loadBankCodes(bankCodes, placeholderElement) { - const autocomplete = document.createElement("smileid-combobox"); - autocomplete.setAttribute("id", "bank_code"); - autocomplete.innerHTML = ` - - - - - ${bankCodes.map( - (bank) => ` - - ${bank.name} - - ` - ).join("\n")} - - `; - placeholderElement.replaceWith(autocomplete); - autocomplete.addEventListener("change", (e) => { - id_info.bank_code = e.detail ? e.detail.value : ""; - }); - return autocomplete; - } - function setFormInputs() { - const requiredFields = productConstraints[id_info.country].id_types[id_info.id_type].required_fields; - const showIdNumber = requiredFields.some( - (fieldName) => fieldName.includes("id_number") - ); - if (showIdNumber) { - const IdNumber = IDInfoForm.querySelector("div#id-number"); - IdNumber.hidden = false; - } - const showNames = requiredFields.some( - (fieldName) => fieldName.includes("name") - ); - if (showNames) { - const Names = IDInfoForm.querySelector("fieldset#names"); - Names.hidden = false; - } - const showDOB = requiredFields.some( - (fieldName) => fieldName.includes("dob") - ); - if (showDOB) { - const DOB = IDInfoForm.querySelector("fieldset#dob"); - DOB.hidden = false; - } - const showCitizenship = requiredFields.some( - (fieldName) => fieldName.includes("citizenship") - ); - if (showCitizenship) { - const Citizenship = IDInfoForm.querySelector("fieldset#citizenships"); - Citizenship.hidden = false; - } - const showBankCode = requiredFields.some( - (fieldName) => fieldName.includes("bank_code") - ); - if (showBankCode) { - const BankCode = IDInfoForm.querySelector("fieldset#bank-code"); - loadBankCodes(ngBankCodes, BankCode.querySelector("#bank_code")); - BankCode.hidden = false; - } - } - function getPartnerParams() { - function parseJWT(token) { - const base64Url = token.split(".")[1]; - const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/"); - const jsonPayload = decodeURIComponent( - atob(base64).split("").map(function(c) { - return `%${c.charCodeAt(0).toString(16)}`; - }).join("") - ); - return JSON.parse(jsonPayload); - } - const { partner_params: partnerParams } = parseJWT(config.token); - partner_params = { ...partnerParams, ...config.partner_params || {} }; - } - function setActiveScreen(node) { - activeScreen.hidden = true; - node.hidden = false; - pages.push(activeScreen); - activeScreen = node; - } - function resetForm() { - const invalidElements = IDInfoForm.querySelectorAll("[aria-invalid]"); - invalidElements.forEach((el) => el.removeAttribute("aria-invalid")); - const validationMessages = document.querySelectorAll(".validation-message"); - validationMessages.forEach((el) => el.remove()); - } - function validateInputs(payload) { - const validationConstraints = {}; - const requiredFields = productConstraints[id_info.country].id_types[id_info.id_type].required_fields; - const showIdNumber = requiredFields.some( - (fieldName) => fieldName.includes("id_number") - ); - if (showIdNumber) { - validationConstraints.id_number = { - presence: { - allowEmpty: false, - message: "is required" - }, - format: new RegExp( - productConstraints[id_info.country].id_types[id_info.id_type].id_number_regex - ) - }; - } - const showNames = requiredFields.some( - (fieldName) => fieldName.includes("name") - ); - if (showNames) { - validationConstraints.first_name = { - presence: { - allowEmpty: false, - message: "is required" - } - }; - validationConstraints.last_name = { - presence: { - allowEmpty: false, - message: "is required" - } - }; - } - const showDOB = requiredFields.some( - (fieldName) => fieldName.includes("dob") - ); - if (showDOB) { - validationConstraints.day = { - presence: { - allowEmpty: false, - message: "is required" - } - }; - validationConstraints.month = { - presence: { - allowEmpty: false, - message: "is required" - } - }; - validationConstraints.year = { - presence: { - allowEmpty: false, - message: "is required" - } - }; - } - const showCitizenship = requiredFields.some( - (fieldName) => fieldName.includes("citizenship") - ); - if (showCitizenship) { - validationConstraints.citizenship = { - presence: { - allowEmpty: false, - message: "is required" - } - }; - } - const showBankCode = requiredFields.some( - (fieldName) => fieldName.includes("bank_code") - ); - if (showBankCode) { - validationConstraints.bank_code = { - presence: { - allowEmpty: false, - message: "is required" - } - }; - } - const validation = (0, import_validate2.default)(payload, validationConstraints); - if (validation) { - handleValidationErrors(validation); - const submitButton = IDInfoForm.querySelector('[type="button"]'); - submitButton.removeAttribute("disabled"); - } - return validation; - } - function handleValidationErrors(errors) { - const fields = Object.keys(errors); - fields.forEach((field) => { - const input = IDInfoForm.querySelector(`#${field}`); - input.setAttribute("aria-invalid", "true"); - input.setAttribute("aria-describedby", `${field}-hint`); - const errorDiv = document.createElement("div"); - errorDiv.setAttribute("id", `${field}-hint`); - errorDiv.setAttribute("class", "validation-message"); - errorDiv.textContent = errors[field][0]; - input.insertAdjacentElement("afterend", errorDiv); - }); - } - async function handleFormSubmit(event) { - if (event) { - event.preventDefault(); - resetForm(); - } - const form = IDInfoForm.querySelector("form"); - const formData = new FormData(form); - const payload = { ...id_info, ...Object.fromEntries(formData.entries()) }; - const isInvalid = validateInputs(payload); - if (isInvalid) { - return; - } - id_info = { - dob: `${payload.year}-${payload.month}-${payload.day}`, - entered: true, - ...payload, - ...id_info - }; - try { - if (event && event.target) - event.target.disabled = true; - await submitIdInfoForm(); - if (event && event.target) - event.target.disabled = false; - complete(); - } catch (error) { - if (event && event.target) - event.target.disabled = false; - displayErrorMessage("Something went wrong"); - console.error( - `SmileIdentity - ${error.name || error.message}: ${error.cause}` - ); - } - } - function displayErrorMessage(message) { - const p = document.createElement("p"); - p.textContent = message; - p.classList.add("validation-message"); - p.style.fontSize = "1.5rem"; - p.style.textAlign = "center"; - const main = document.querySelector("main"); - main.prepend(p); - } - async function submitIdInfoForm() { - const { year, month, day, ...data } = id_info; - const dob = year && month && day ? `${year}-${month}-${day}` : void 0; - const { - callback_url, - token, - partner_details: { partner_id } - } = config; - const payload = { - ...data, - dob, - partner_id, - callback_url, - token, - source_sdk: config.sdk || "hosted_web", - source_sdk_version: config.sdk_version || version, - partner_params: { - ...partner_params, - job_type: 5 - } - }; - const URL = `${endpoints[config.environment]}/async_id_verification`; - const response = await postData2(URL, payload); - const json = await response.json(); - if (json.error) - throw new Error(json.error); - } - function complete() { - const countryName = productConstraints[id_info.country].name; - const idTypeName = productConstraints[id_info.country].id_types[id_info.id_type].label; - const thankYouMessage = CompleteScreen.querySelector("#thank-you-message"); - thankYouMessage.textContent = `We will process your ${countryName} - ${idTypeName} information to verify your identity`; - setActiveScreen(CompleteScreen); - handleSuccess(); - window.setTimeout(closeWindow, 2e3); - } - function closeWindow(userTriggered) { - const message = userTriggered ? "SmileIdentity::Close" : "SmileIdentity::Close::System"; - referenceWindow.postMessage(message, "*"); - } - function handleSuccess() { - referenceWindow.postMessage("SmileIdentity::Success", "*"); - } - })(); -})(); -/*! Bundled license information: - -validate.js/validate.js: - (*! - * validate.js 0.13.1 - * - * (c) 2013-2019 Nicklas Ansman, 2013 Wrapp - * Validate.js may be freely distributed under the MIT license. - * For all details and documentation: - * http://validatejs.org/ - *) -*/ diff --git a/packages/embed/build/js/enhanced-document-verification.min.js b/packages/embed/build/js/enhanced-document-verification.min.js deleted file mode 100644 index faa10499..00000000 --- a/packages/embed/build/js/enhanced-document-verification.min.js +++ /dev/null @@ -1,4838 +0,0 @@ -(() => { - var __create = Object.create; - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __getProtoOf = Object.getPrototypeOf; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { - get: (a, b) => (typeof require !== "undefined" ? require : a)[b] - }) : x)(function(x) { - if (typeof require !== "undefined") - return require.apply(this, arguments); - throw Error('Dynamic require of "' + x + '" is not supported'); - }); - var __commonJS = (cb, mod) => function __require2() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod - )); - - // ../../node_modules/jszip/dist/jszip.min.js - var require_jszip_min = __commonJS({ - "../../node_modules/jszip/dist/jszip.min.js"(exports, module) { - !function(e) { - if ("object" == typeof exports && "undefined" != typeof module) - module.exports = e(); - else if ("function" == typeof define && define.amd) - define([], e); - else { - ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).JSZip = e(); - } - }(function() { - return function s(a, o, h) { - function u(r, e2) { - if (!o[r]) { - if (!a[r]) { - var t = "function" == typeof __require && __require; - if (!e2 && t) - return t(r, true); - if (l) - return l(r, true); - var n = new Error("Cannot find module '" + r + "'"); - throw n.code = "MODULE_NOT_FOUND", n; - } - var i = o[r] = { exports: {} }; - a[r][0].call(i.exports, function(e3) { - var t2 = a[r][1][e3]; - return u(t2 || e3); - }, i, i.exports, s, a, o, h); - } - return o[r].exports; - } - for (var l = "function" == typeof __require && __require, e = 0; e < h.length; e++) - u(h[e]); - return u; - }({ 1: [function(e, t, r) { - "use strict"; - var d = e("./utils"), c = e("./support"), p = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - r.encode = function(e2) { - for (var t2, r2, n, i, s, a, o, h = [], u = 0, l = e2.length, f = l, c2 = "string" !== d.getTypeOf(e2); u < e2.length; ) - f = l - u, n = c2 ? (t2 = e2[u++], r2 = u < l ? e2[u++] : 0, u < l ? e2[u++] : 0) : (t2 = e2.charCodeAt(u++), r2 = u < l ? e2.charCodeAt(u++) : 0, u < l ? e2.charCodeAt(u++) : 0), i = t2 >> 2, s = (3 & t2) << 4 | r2 >> 4, a = 1 < f ? (15 & r2) << 2 | n >> 6 : 64, o = 2 < f ? 63 & n : 64, h.push(p.charAt(i) + p.charAt(s) + p.charAt(a) + p.charAt(o)); - return h.join(""); - }, r.decode = function(e2) { - var t2, r2, n, i, s, a, o = 0, h = 0, u = "data:"; - if (e2.substr(0, u.length) === u) - throw new Error("Invalid base64 input, it looks like a data url."); - var l, f = 3 * (e2 = e2.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4; - if (e2.charAt(e2.length - 1) === p.charAt(64) && f--, e2.charAt(e2.length - 2) === p.charAt(64) && f--, f % 1 != 0) - throw new Error("Invalid base64 input, bad content length."); - for (l = c.uint8array ? new Uint8Array(0 | f) : new Array(0 | f); o < e2.length; ) - t2 = p.indexOf(e2.charAt(o++)) << 2 | (i = p.indexOf(e2.charAt(o++))) >> 4, r2 = (15 & i) << 4 | (s = p.indexOf(e2.charAt(o++))) >> 2, n = (3 & s) << 6 | (a = p.indexOf(e2.charAt(o++))), l[h++] = t2, 64 !== s && (l[h++] = r2), 64 !== a && (l[h++] = n); - return l; - }; - }, { "./support": 30, "./utils": 32 }], 2: [function(e, t, r) { - "use strict"; - var n = e("./external"), i = e("./stream/DataWorker"), s = e("./stream/Crc32Probe"), a = e("./stream/DataLengthProbe"); - function o(e2, t2, r2, n2, i2) { - this.compressedSize = e2, this.uncompressedSize = t2, this.crc32 = r2, this.compression = n2, this.compressedContent = i2; - } - o.prototype = { getContentWorker: function() { - var e2 = new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")), t2 = this; - return e2.on("end", function() { - if (this.streamInfo.data_length !== t2.uncompressedSize) - throw new Error("Bug : uncompressed data size mismatch"); - }), e2; - }, getCompressedWorker: function() { - return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression); - } }, o.createWorkerFrom = function(e2, t2, r2) { - return e2.pipe(new s()).pipe(new a("uncompressedSize")).pipe(t2.compressWorker(r2)).pipe(new a("compressedSize")).withStreamInfo("compression", t2); - }, t.exports = o; - }, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function(e, t, r) { - "use strict"; - var n = e("./stream/GenericWorker"); - r.STORE = { magic: "\0\0", compressWorker: function() { - return new n("STORE compression"); - }, uncompressWorker: function() { - return new n("STORE decompression"); - } }, r.DEFLATE = e("./flate"); - }, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function(e, t, r) { - "use strict"; - var n = e("./utils"); - var o = function() { - for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) { - e2 = r2; - for (var n2 = 0; n2 < 8; n2++) - e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1; - t2[r2] = e2; - } - return t2; - }(); - t.exports = function(e2, t2) { - return void 0 !== e2 && e2.length ? "string" !== n.getTypeOf(e2) ? function(e3, t3, r2, n2) { - var i = o, s = n2 + r2; - e3 ^= -1; - for (var a = n2; a < s; a++) - e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3[a])]; - return -1 ^ e3; - }(0 | t2, e2, e2.length, 0) : function(e3, t3, r2, n2) { - var i = o, s = n2 + r2; - e3 ^= -1; - for (var a = n2; a < s; a++) - e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3.charCodeAt(a))]; - return -1 ^ e3; - }(0 | t2, e2, e2.length, 0) : 0; - }; - }, { "./utils": 32 }], 5: [function(e, t, r) { - "use strict"; - r.base64 = false, r.binary = false, r.dir = false, r.createFolders = true, r.date = null, r.compression = null, r.compressionOptions = null, r.comment = null, r.unixPermissions = null, r.dosPermissions = null; - }, {}], 6: [function(e, t, r) { - "use strict"; - var n = null; - n = "undefined" != typeof Promise ? Promise : e("lie"), t.exports = { Promise: n }; - }, { lie: 37 }], 7: [function(e, t, r) { - "use strict"; - var n = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array, i = e("pako"), s = e("./utils"), a = e("./stream/GenericWorker"), o = n ? "uint8array" : "array"; - function h(e2, t2) { - a.call(this, "FlateWorker/" + e2), this._pako = null, this._pakoAction = e2, this._pakoOptions = t2, this.meta = {}; - } - r.magic = "\b\0", s.inherits(h, a), h.prototype.processChunk = function(e2) { - this.meta = e2.meta, null === this._pako && this._createPako(), this._pako.push(s.transformTo(o, e2.data), false); - }, h.prototype.flush = function() { - a.prototype.flush.call(this), null === this._pako && this._createPako(), this._pako.push([], true); - }, h.prototype.cleanUp = function() { - a.prototype.cleanUp.call(this), this._pako = null; - }, h.prototype._createPako = function() { - this._pako = new i[this._pakoAction]({ raw: true, level: this._pakoOptions.level || -1 }); - var t2 = this; - this._pako.onData = function(e2) { - t2.push({ data: e2, meta: t2.meta }); - }; - }, r.compressWorker = function(e2) { - return new h("Deflate", e2); - }, r.uncompressWorker = function() { - return new h("Inflate", {}); - }; - }, { "./stream/GenericWorker": 28, "./utils": 32, pako: 38 }], 8: [function(e, t, r) { - "use strict"; - function A(e2, t2) { - var r2, n2 = ""; - for (r2 = 0; r2 < t2; r2++) - n2 += String.fromCharCode(255 & e2), e2 >>>= 8; - return n2; - } - function n(e2, t2, r2, n2, i2, s2) { - var a, o, h = e2.file, u = e2.compression, l = s2 !== O.utf8encode, f = I.transformTo("string", s2(h.name)), c = I.transformTo("string", O.utf8encode(h.name)), d = h.comment, p = I.transformTo("string", s2(d)), m = I.transformTo("string", O.utf8encode(d)), _ = c.length !== h.name.length, g = m.length !== d.length, b = "", v = "", y = "", w = h.dir, k = h.date, x = { crc32: 0, compressedSize: 0, uncompressedSize: 0 }; - t2 && !r2 || (x.crc32 = e2.crc32, x.compressedSize = e2.compressedSize, x.uncompressedSize = e2.uncompressedSize); - var S = 0; - t2 && (S |= 8), l || !_ && !g || (S |= 2048); - var z = 0, C = 0; - w && (z |= 16), "UNIX" === i2 ? (C = 798, z |= function(e3, t3) { - var r3 = e3; - return e3 || (r3 = t3 ? 16893 : 33204), (65535 & r3) << 16; - }(h.unixPermissions, w)) : (C = 20, z |= function(e3) { - return 63 & (e3 || 0); - }(h.dosPermissions)), a = k.getUTCHours(), a <<= 6, a |= k.getUTCMinutes(), a <<= 5, a |= k.getUTCSeconds() / 2, o = k.getUTCFullYear() - 1980, o <<= 4, o |= k.getUTCMonth() + 1, o <<= 5, o |= k.getUTCDate(), _ && (v = A(1, 1) + A(B(f), 4) + c, b += "up" + A(v.length, 2) + v), g && (y = A(1, 1) + A(B(p), 4) + m, b += "uc" + A(y.length, 2) + y); - var E = ""; - return E += "\n\0", E += A(S, 2), E += u.magic, E += A(a, 2), E += A(o, 2), E += A(x.crc32, 4), E += A(x.compressedSize, 4), E += A(x.uncompressedSize, 4), E += A(f.length, 2), E += A(b.length, 2), { fileRecord: R.LOCAL_FILE_HEADER + E + f + b, dirRecord: R.CENTRAL_FILE_HEADER + A(C, 2) + E + A(p.length, 2) + "\0\0\0\0" + A(z, 4) + A(n2, 4) + f + b + p }; - } - var I = e("../utils"), i = e("../stream/GenericWorker"), O = e("../utf8"), B = e("../crc32"), R = e("../signature"); - function s(e2, t2, r2, n2) { - i.call(this, "ZipFileWorker"), this.bytesWritten = 0, this.zipComment = t2, this.zipPlatform = r2, this.encodeFileName = n2, this.streamFiles = e2, this.accumulate = false, this.contentBuffer = [], this.dirRecords = [], this.currentSourceOffset = 0, this.entriesCount = 0, this.currentFile = null, this._sources = []; - } - I.inherits(s, i), s.prototype.push = function(e2) { - var t2 = e2.meta.percent || 0, r2 = this.entriesCount, n2 = this._sources.length; - this.accumulate ? this.contentBuffer.push(e2) : (this.bytesWritten += e2.data.length, i.prototype.push.call(this, { data: e2.data, meta: { currentFile: this.currentFile, percent: r2 ? (t2 + 100 * (r2 - n2 - 1)) / r2 : 100 } })); - }, s.prototype.openedSource = function(e2) { - this.currentSourceOffset = this.bytesWritten, this.currentFile = e2.file.name; - var t2 = this.streamFiles && !e2.file.dir; - if (t2) { - var r2 = n(e2, t2, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); - this.push({ data: r2.fileRecord, meta: { percent: 0 } }); - } else - this.accumulate = true; - }, s.prototype.closedSource = function(e2) { - this.accumulate = false; - var t2 = this.streamFiles && !e2.file.dir, r2 = n(e2, t2, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); - if (this.dirRecords.push(r2.dirRecord), t2) - this.push({ data: function(e3) { - return R.DATA_DESCRIPTOR + A(e3.crc32, 4) + A(e3.compressedSize, 4) + A(e3.uncompressedSize, 4); - }(e2), meta: { percent: 100 } }); - else - for (this.push({ data: r2.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length; ) - this.push(this.contentBuffer.shift()); - this.currentFile = null; - }, s.prototype.flush = function() { - for (var e2 = this.bytesWritten, t2 = 0; t2 < this.dirRecords.length; t2++) - this.push({ data: this.dirRecords[t2], meta: { percent: 100 } }); - var r2 = this.bytesWritten - e2, n2 = function(e3, t3, r3, n3, i2) { - var s2 = I.transformTo("string", i2(n3)); - return R.CENTRAL_DIRECTORY_END + "\0\0\0\0" + A(e3, 2) + A(e3, 2) + A(t3, 4) + A(r3, 4) + A(s2.length, 2) + s2; - }(this.dirRecords.length, r2, e2, this.zipComment, this.encodeFileName); - this.push({ data: n2, meta: { percent: 100 } }); - }, s.prototype.prepareNextSource = function() { - this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume(); - }, s.prototype.registerPrevious = function(e2) { - this._sources.push(e2); - var t2 = this; - return e2.on("data", function(e3) { - t2.processChunk(e3); - }), e2.on("end", function() { - t2.closedSource(t2.previous.streamInfo), t2._sources.length ? t2.prepareNextSource() : t2.end(); - }), e2.on("error", function(e3) { - t2.error(e3); - }), this; - }, s.prototype.resume = function() { - return !!i.prototype.resume.call(this) && (!this.previous && this._sources.length ? (this.prepareNextSource(), true) : this.previous || this._sources.length || this.generatedError ? void 0 : (this.end(), true)); - }, s.prototype.error = function(e2) { - var t2 = this._sources; - if (!i.prototype.error.call(this, e2)) - return false; - for (var r2 = 0; r2 < t2.length; r2++) - try { - t2[r2].error(e2); - } catch (e3) { - } - return true; - }, s.prototype.lock = function() { - i.prototype.lock.call(this); - for (var e2 = this._sources, t2 = 0; t2 < e2.length; t2++) - e2[t2].lock(); - }, t.exports = s; - }, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function(e, t, r) { - "use strict"; - var u = e("../compressions"), n = e("./ZipFileWorker"); - r.generateWorker = function(e2, a, t2) { - var o = new n(a.streamFiles, t2, a.platform, a.encodeFileName), h = 0; - try { - e2.forEach(function(e3, t3) { - h++; - var r2 = function(e4, t4) { - var r3 = e4 || t4, n3 = u[r3]; - if (!n3) - throw new Error(r3 + " is not a valid compression method !"); - return n3; - }(t3.options.compression, a.compression), n2 = t3.options.compressionOptions || a.compressionOptions || {}, i = t3.dir, s = t3.date; - t3._compressWorker(r2, n2).withStreamInfo("file", { name: e3, dir: i, date: s, comment: t3.comment || "", unixPermissions: t3.unixPermissions, dosPermissions: t3.dosPermissions }).pipe(o); - }), o.entriesCount = h; - } catch (e3) { - o.error(e3); - } - return o; - }; - }, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function(e, t, r) { - "use strict"; - function n() { - if (!(this instanceof n)) - return new n(); - if (arguments.length) - throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide."); - this.files = /* @__PURE__ */ Object.create(null), this.comment = null, this.root = "", this.clone = function() { - var e2 = new n(); - for (var t2 in this) - "function" != typeof this[t2] && (e2[t2] = this[t2]); - return e2; - }; - } - (n.prototype = e("./object")).loadAsync = e("./load"), n.support = e("./support"), n.defaults = e("./defaults"), n.version = "3.10.1", n.loadAsync = function(e2, t2) { - return new n().loadAsync(e2, t2); - }, n.external = e("./external"), t.exports = n; - }, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function(e, t, r) { - "use strict"; - var u = e("./utils"), i = e("./external"), n = e("./utf8"), s = e("./zipEntries"), a = e("./stream/Crc32Probe"), l = e("./nodejsUtils"); - function f(n2) { - return new i.Promise(function(e2, t2) { - var r2 = n2.decompressed.getContentWorker().pipe(new a()); - r2.on("error", function(e3) { - t2(e3); - }).on("end", function() { - r2.streamInfo.crc32 !== n2.decompressed.crc32 ? t2(new Error("Corrupted zip : CRC32 mismatch")) : e2(); - }).resume(); - }); - } - t.exports = function(e2, o) { - var h = this; - return o = u.extend(o || {}, { base64: false, checkCRC32: false, optimizedBinaryString: false, createFolders: false, decodeFileName: n.utf8decode }), l.isNode && l.isStream(e2) ? i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")) : u.prepareContent("the loaded zip file", e2, true, o.optimizedBinaryString, o.base64).then(function(e3) { - var t2 = new s(o); - return t2.load(e3), t2; - }).then(function(e3) { - var t2 = [i.Promise.resolve(e3)], r2 = e3.files; - if (o.checkCRC32) - for (var n2 = 0; n2 < r2.length; n2++) - t2.push(f(r2[n2])); - return i.Promise.all(t2); - }).then(function(e3) { - for (var t2 = e3.shift(), r2 = t2.files, n2 = 0; n2 < r2.length; n2++) { - var i2 = r2[n2], s2 = i2.fileNameStr, a2 = u.resolve(i2.fileNameStr); - h.file(a2, i2.decompressed, { binary: true, optimizedBinaryString: true, date: i2.date, dir: i2.dir, comment: i2.fileCommentStr.length ? i2.fileCommentStr : null, unixPermissions: i2.unixPermissions, dosPermissions: i2.dosPermissions, createFolders: o.createFolders }), i2.dir || (h.file(a2).unsafeOriginalName = s2); - } - return t2.zipComment.length && (h.comment = t2.zipComment), h; - }); - }; - }, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function(e, t, r) { - "use strict"; - var n = e("../utils"), i = e("../stream/GenericWorker"); - function s(e2, t2) { - i.call(this, "Nodejs stream input adapter for " + e2), this._upstreamEnded = false, this._bindStream(t2); - } - n.inherits(s, i), s.prototype._bindStream = function(e2) { - var t2 = this; - (this._stream = e2).pause(), e2.on("data", function(e3) { - t2.push({ data: e3, meta: { percent: 0 } }); - }).on("error", function(e3) { - t2.isPaused ? this.generatedError = e3 : t2.error(e3); - }).on("end", function() { - t2.isPaused ? t2._upstreamEnded = true : t2.end(); - }); - }, s.prototype.pause = function() { - return !!i.prototype.pause.call(this) && (this._stream.pause(), true); - }, s.prototype.resume = function() { - return !!i.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), true); - }, t.exports = s; - }, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function(e, t, r) { - "use strict"; - var i = e("readable-stream").Readable; - function n(e2, t2, r2) { - i.call(this, t2), this._helper = e2; - var n2 = this; - e2.on("data", function(e3, t3) { - n2.push(e3) || n2._helper.pause(), r2 && r2(t3); - }).on("error", function(e3) { - n2.emit("error", e3); - }).on("end", function() { - n2.push(null); - }); - } - e("../utils").inherits(n, i), n.prototype._read = function() { - this._helper.resume(); - }, t.exports = n; - }, { "../utils": 32, "readable-stream": 16 }], 14: [function(e, t, r) { - "use strict"; - t.exports = { isNode: "undefined" != typeof Buffer, newBufferFrom: function(e2, t2) { - if (Buffer.from && Buffer.from !== Uint8Array.from) - return Buffer.from(e2, t2); - if ("number" == typeof e2) - throw new Error('The "data" argument must not be a number'); - return new Buffer(e2, t2); - }, allocBuffer: function(e2) { - if (Buffer.alloc) - return Buffer.alloc(e2); - var t2 = new Buffer(e2); - return t2.fill(0), t2; - }, isBuffer: function(e2) { - return Buffer.isBuffer(e2); - }, isStream: function(e2) { - return e2 && "function" == typeof e2.on && "function" == typeof e2.pause && "function" == typeof e2.resume; - } }; - }, {}], 15: [function(e, t, r) { - "use strict"; - function s(e2, t2, r2) { - var n2, i2 = u.getTypeOf(t2), s2 = u.extend(r2 || {}, f); - s2.date = s2.date || /* @__PURE__ */ new Date(), null !== s2.compression && (s2.compression = s2.compression.toUpperCase()), "string" == typeof s2.unixPermissions && (s2.unixPermissions = parseInt(s2.unixPermissions, 8)), s2.unixPermissions && 16384 & s2.unixPermissions && (s2.dir = true), s2.dosPermissions && 16 & s2.dosPermissions && (s2.dir = true), s2.dir && (e2 = g(e2)), s2.createFolders && (n2 = _(e2)) && b.call(this, n2, true); - var a2 = "string" === i2 && false === s2.binary && false === s2.base64; - r2 && void 0 !== r2.binary || (s2.binary = !a2), (t2 instanceof c && 0 === t2.uncompressedSize || s2.dir || !t2 || 0 === t2.length) && (s2.base64 = false, s2.binary = true, t2 = "", s2.compression = "STORE", i2 = "string"); - var o2 = null; - o2 = t2 instanceof c || t2 instanceof l ? t2 : p.isNode && p.isStream(t2) ? new m(e2, t2) : u.prepareContent(e2, t2, s2.binary, s2.optimizedBinaryString, s2.base64); - var h2 = new d(e2, o2, s2); - this.files[e2] = h2; - } - var i = e("./utf8"), u = e("./utils"), l = e("./stream/GenericWorker"), a = e("./stream/StreamHelper"), f = e("./defaults"), c = e("./compressedObject"), d = e("./zipObject"), o = e("./generate"), p = e("./nodejsUtils"), m = e("./nodejs/NodejsStreamInputAdapter"), _ = function(e2) { - "/" === e2.slice(-1) && (e2 = e2.substring(0, e2.length - 1)); - var t2 = e2.lastIndexOf("/"); - return 0 < t2 ? e2.substring(0, t2) : ""; - }, g = function(e2) { - return "/" !== e2.slice(-1) && (e2 += "/"), e2; - }, b = function(e2, t2) { - return t2 = void 0 !== t2 ? t2 : f.createFolders, e2 = g(e2), this.files[e2] || s.call(this, e2, null, { dir: true, createFolders: t2 }), this.files[e2]; - }; - function h(e2) { - return "[object RegExp]" === Object.prototype.toString.call(e2); - } - var n = { load: function() { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); - }, forEach: function(e2) { - var t2, r2, n2; - for (t2 in this.files) - n2 = this.files[t2], (r2 = t2.slice(this.root.length, t2.length)) && t2.slice(0, this.root.length) === this.root && e2(r2, n2); - }, filter: function(r2) { - var n2 = []; - return this.forEach(function(e2, t2) { - r2(e2, t2) && n2.push(t2); - }), n2; - }, file: function(e2, t2, r2) { - if (1 !== arguments.length) - return e2 = this.root + e2, s.call(this, e2, t2, r2), this; - if (h(e2)) { - var n2 = e2; - return this.filter(function(e3, t3) { - return !t3.dir && n2.test(e3); - }); - } - var i2 = this.files[this.root + e2]; - return i2 && !i2.dir ? i2 : null; - }, folder: function(r2) { - if (!r2) - return this; - if (h(r2)) - return this.filter(function(e3, t3) { - return t3.dir && r2.test(e3); - }); - var e2 = this.root + r2, t2 = b.call(this, e2), n2 = this.clone(); - return n2.root = t2.name, n2; - }, remove: function(r2) { - r2 = this.root + r2; - var e2 = this.files[r2]; - if (e2 || ("/" !== r2.slice(-1) && (r2 += "/"), e2 = this.files[r2]), e2 && !e2.dir) - delete this.files[r2]; - else - for (var t2 = this.filter(function(e3, t3) { - return t3.name.slice(0, r2.length) === r2; - }), n2 = 0; n2 < t2.length; n2++) - delete this.files[t2[n2].name]; - return this; - }, generate: function() { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); - }, generateInternalStream: function(e2) { - var t2, r2 = {}; - try { - if ((r2 = u.extend(e2 || {}, { streamFiles: false, compression: "STORE", compressionOptions: null, type: "", platform: "DOS", comment: null, mimeType: "application/zip", encodeFileName: i.utf8encode })).type = r2.type.toLowerCase(), r2.compression = r2.compression.toUpperCase(), "binarystring" === r2.type && (r2.type = "string"), !r2.type) - throw new Error("No output type specified."); - u.checkSupport(r2.type), "darwin" !== r2.platform && "freebsd" !== r2.platform && "linux" !== r2.platform && "sunos" !== r2.platform || (r2.platform = "UNIX"), "win32" === r2.platform && (r2.platform = "DOS"); - var n2 = r2.comment || this.comment || ""; - t2 = o.generateWorker(this, r2, n2); - } catch (e3) { - (t2 = new l("error")).error(e3); - } - return new a(t2, r2.type || "string", r2.mimeType); - }, generateAsync: function(e2, t2) { - return this.generateInternalStream(e2).accumulate(t2); - }, generateNodeStream: function(e2, t2) { - return (e2 = e2 || {}).type || (e2.type = "nodebuffer"), this.generateInternalStream(e2).toNodejsStream(t2); - } }; - t.exports = n; - }, { "./compressedObject": 2, "./defaults": 5, "./generate": 9, "./nodejs/NodejsStreamInputAdapter": 12, "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31, "./utils": 32, "./zipObject": 35 }], 16: [function(e, t, r) { - "use strict"; - t.exports = e("stream"); - }, { stream: void 0 }], 17: [function(e, t, r) { - "use strict"; - var n = e("./DataReader"); - function i(e2) { - n.call(this, e2); - for (var t2 = 0; t2 < this.data.length; t2++) - e2[t2] = 255 & e2[t2]; - } - e("../utils").inherits(i, n), i.prototype.byteAt = function(e2) { - return this.data[this.zero + e2]; - }, i.prototype.lastIndexOfSignature = function(e2) { - for (var t2 = e2.charCodeAt(0), r2 = e2.charCodeAt(1), n2 = e2.charCodeAt(2), i2 = e2.charCodeAt(3), s = this.length - 4; 0 <= s; --s) - if (this.data[s] === t2 && this.data[s + 1] === r2 && this.data[s + 2] === n2 && this.data[s + 3] === i2) - return s - this.zero; - return -1; - }, i.prototype.readAndCheckSignature = function(e2) { - var t2 = e2.charCodeAt(0), r2 = e2.charCodeAt(1), n2 = e2.charCodeAt(2), i2 = e2.charCodeAt(3), s = this.readData(4); - return t2 === s[0] && r2 === s[1] && n2 === s[2] && i2 === s[3]; - }, i.prototype.readData = function(e2) { - if (this.checkOffset(e2), 0 === e2) - return []; - var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2); - return this.index += e2, t2; - }, t.exports = i; - }, { "../utils": 32, "./DataReader": 18 }], 18: [function(e, t, r) { - "use strict"; - var n = e("../utils"); - function i(e2) { - this.data = e2, this.length = e2.length, this.index = 0, this.zero = 0; - } - i.prototype = { checkOffset: function(e2) { - this.checkIndex(this.index + e2); - }, checkIndex: function(e2) { - if (this.length < this.zero + e2 || e2 < 0) - throw new Error("End of data reached (data length = " + this.length + ", asked index = " + e2 + "). Corrupted zip ?"); - }, setIndex: function(e2) { - this.checkIndex(e2), this.index = e2; - }, skip: function(e2) { - this.setIndex(this.index + e2); - }, byteAt: function() { - }, readInt: function(e2) { - var t2, r2 = 0; - for (this.checkOffset(e2), t2 = this.index + e2 - 1; t2 >= this.index; t2--) - r2 = (r2 << 8) + this.byteAt(t2); - return this.index += e2, r2; - }, readString: function(e2) { - return n.transformTo("string", this.readData(e2)); - }, readData: function() { - }, lastIndexOfSignature: function() { - }, readAndCheckSignature: function() { - }, readDate: function() { - var e2 = this.readInt(4); - return new Date(Date.UTC(1980 + (e2 >> 25 & 127), (e2 >> 21 & 15) - 1, e2 >> 16 & 31, e2 >> 11 & 31, e2 >> 5 & 63, (31 & e2) << 1)); - } }, t.exports = i; - }, { "../utils": 32 }], 19: [function(e, t, r) { - "use strict"; - var n = e("./Uint8ArrayReader"); - function i(e2) { - n.call(this, e2); - } - e("../utils").inherits(i, n), i.prototype.readData = function(e2) { - this.checkOffset(e2); - var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2); - return this.index += e2, t2; - }, t.exports = i; - }, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function(e, t, r) { - "use strict"; - var n = e("./DataReader"); - function i(e2) { - n.call(this, e2); - } - e("../utils").inherits(i, n), i.prototype.byteAt = function(e2) { - return this.data.charCodeAt(this.zero + e2); - }, i.prototype.lastIndexOfSignature = function(e2) { - return this.data.lastIndexOf(e2) - this.zero; - }, i.prototype.readAndCheckSignature = function(e2) { - return e2 === this.readData(4); - }, i.prototype.readData = function(e2) { - this.checkOffset(e2); - var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2); - return this.index += e2, t2; - }, t.exports = i; - }, { "../utils": 32, "./DataReader": 18 }], 21: [function(e, t, r) { - "use strict"; - var n = e("./ArrayReader"); - function i(e2) { - n.call(this, e2); - } - e("../utils").inherits(i, n), i.prototype.readData = function(e2) { - if (this.checkOffset(e2), 0 === e2) - return new Uint8Array(0); - var t2 = this.data.subarray(this.zero + this.index, this.zero + this.index + e2); - return this.index += e2, t2; - }, t.exports = i; - }, { "../utils": 32, "./ArrayReader": 17 }], 22: [function(e, t, r) { - "use strict"; - var n = e("../utils"), i = e("../support"), s = e("./ArrayReader"), a = e("./StringReader"), o = e("./NodeBufferReader"), h = e("./Uint8ArrayReader"); - t.exports = function(e2) { - var t2 = n.getTypeOf(e2); - return n.checkSupport(t2), "string" !== t2 || i.uint8array ? "nodebuffer" === t2 ? new o(e2) : i.uint8array ? new h(n.transformTo("uint8array", e2)) : new s(n.transformTo("array", e2)) : new a(e2); - }; - }, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function(e, t, r) { - "use strict"; - r.LOCAL_FILE_HEADER = "PK", r.CENTRAL_FILE_HEADER = "PK", r.CENTRAL_DIRECTORY_END = "PK", r.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x07", r.ZIP64_CENTRAL_DIRECTORY_END = "PK", r.DATA_DESCRIPTOR = "PK\x07\b"; - }, {}], 24: [function(e, t, r) { - "use strict"; - var n = e("./GenericWorker"), i = e("../utils"); - function s(e2) { - n.call(this, "ConvertWorker to " + e2), this.destType = e2; - } - i.inherits(s, n), s.prototype.processChunk = function(e2) { - this.push({ data: i.transformTo(this.destType, e2.data), meta: e2.meta }); - }, t.exports = s; - }, { "../utils": 32, "./GenericWorker": 28 }], 25: [function(e, t, r) { - "use strict"; - var n = e("./GenericWorker"), i = e("../crc32"); - function s() { - n.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0); - } - e("../utils").inherits(s, n), s.prototype.processChunk = function(e2) { - this.streamInfo.crc32 = i(e2.data, this.streamInfo.crc32 || 0), this.push(e2); - }, t.exports = s; - }, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function(e, t, r) { - "use strict"; - var n = e("../utils"), i = e("./GenericWorker"); - function s(e2) { - i.call(this, "DataLengthProbe for " + e2), this.propName = e2, this.withStreamInfo(e2, 0); - } - n.inherits(s, i), s.prototype.processChunk = function(e2) { - if (e2) { - var t2 = this.streamInfo[this.propName] || 0; - this.streamInfo[this.propName] = t2 + e2.data.length; - } - i.prototype.processChunk.call(this, e2); - }, t.exports = s; - }, { "../utils": 32, "./GenericWorker": 28 }], 27: [function(e, t, r) { - "use strict"; - var n = e("../utils"), i = e("./GenericWorker"); - function s(e2) { - i.call(this, "DataWorker"); - var t2 = this; - this.dataIsReady = false, this.index = 0, this.max = 0, this.data = null, this.type = "", this._tickScheduled = false, e2.then(function(e3) { - t2.dataIsReady = true, t2.data = e3, t2.max = e3 && e3.length || 0, t2.type = n.getTypeOf(e3), t2.isPaused || t2._tickAndRepeat(); - }, function(e3) { - t2.error(e3); - }); - } - n.inherits(s, i), s.prototype.cleanUp = function() { - i.prototype.cleanUp.call(this), this.data = null; - }, s.prototype.resume = function() { - return !!i.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = true, n.delay(this._tickAndRepeat, [], this)), true); - }, s.prototype._tickAndRepeat = function() { - this._tickScheduled = false, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (n.delay(this._tickAndRepeat, [], this), this._tickScheduled = true)); - }, s.prototype._tick = function() { - if (this.isPaused || this.isFinished) - return false; - var e2 = null, t2 = Math.min(this.max, this.index + 16384); - if (this.index >= this.max) - return this.end(); - switch (this.type) { - case "string": - e2 = this.data.substring(this.index, t2); - break; - case "uint8array": - e2 = this.data.subarray(this.index, t2); - break; - case "array": - case "nodebuffer": - e2 = this.data.slice(this.index, t2); - } - return this.index = t2, this.push({ data: e2, meta: { percent: this.max ? this.index / this.max * 100 : 0 } }); - }, t.exports = s; - }, { "../utils": 32, "./GenericWorker": 28 }], 28: [function(e, t, r) { - "use strict"; - function n(e2) { - this.name = e2 || "default", this.streamInfo = {}, this.generatedError = null, this.extraStreamInfo = {}, this.isPaused = true, this.isFinished = false, this.isLocked = false, this._listeners = { data: [], end: [], error: [] }, this.previous = null; - } - n.prototype = { push: function(e2) { - this.emit("data", e2); - }, end: function() { - if (this.isFinished) - return false; - this.flush(); - try { - this.emit("end"), this.cleanUp(), this.isFinished = true; - } catch (e2) { - this.emit("error", e2); - } - return true; - }, error: function(e2) { - return !this.isFinished && (this.isPaused ? this.generatedError = e2 : (this.isFinished = true, this.emit("error", e2), this.previous && this.previous.error(e2), this.cleanUp()), true); - }, on: function(e2, t2) { - return this._listeners[e2].push(t2), this; - }, cleanUp: function() { - this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = []; - }, emit: function(e2, t2) { - if (this._listeners[e2]) - for (var r2 = 0; r2 < this._listeners[e2].length; r2++) - this._listeners[e2][r2].call(this, t2); - }, pipe: function(e2) { - return e2.registerPrevious(this); - }, registerPrevious: function(e2) { - if (this.isLocked) - throw new Error("The stream '" + this + "' has already been used."); - this.streamInfo = e2.streamInfo, this.mergeStreamInfo(), this.previous = e2; - var t2 = this; - return e2.on("data", function(e3) { - t2.processChunk(e3); - }), e2.on("end", function() { - t2.end(); - }), e2.on("error", function(e3) { - t2.error(e3); - }), this; - }, pause: function() { - return !this.isPaused && !this.isFinished && (this.isPaused = true, this.previous && this.previous.pause(), true); - }, resume: function() { - if (!this.isPaused || this.isFinished) - return false; - var e2 = this.isPaused = false; - return this.generatedError && (this.error(this.generatedError), e2 = true), this.previous && this.previous.resume(), !e2; - }, flush: function() { - }, processChunk: function(e2) { - this.push(e2); - }, withStreamInfo: function(e2, t2) { - return this.extraStreamInfo[e2] = t2, this.mergeStreamInfo(), this; - }, mergeStreamInfo: function() { - for (var e2 in this.extraStreamInfo) - Object.prototype.hasOwnProperty.call(this.extraStreamInfo, e2) && (this.streamInfo[e2] = this.extraStreamInfo[e2]); - }, lock: function() { - if (this.isLocked) - throw new Error("The stream '" + this + "' has already been used."); - this.isLocked = true, this.previous && this.previous.lock(); - }, toString: function() { - var e2 = "Worker " + this.name; - return this.previous ? this.previous + " -> " + e2 : e2; - } }, t.exports = n; - }, {}], 29: [function(e, t, r) { - "use strict"; - var h = e("../utils"), i = e("./ConvertWorker"), s = e("./GenericWorker"), u = e("../base64"), n = e("../support"), a = e("../external"), o = null; - if (n.nodestream) - try { - o = e("../nodejs/NodejsStreamOutputAdapter"); - } catch (e2) { - } - function l(e2, o2) { - return new a.Promise(function(t2, r2) { - var n2 = [], i2 = e2._internalType, s2 = e2._outputType, a2 = e2._mimeType; - e2.on("data", function(e3, t3) { - n2.push(e3), o2 && o2(t3); - }).on("error", function(e3) { - n2 = [], r2(e3); - }).on("end", function() { - try { - var e3 = function(e4, t3, r3) { - switch (e4) { - case "blob": - return h.newBlob(h.transformTo("arraybuffer", t3), r3); - case "base64": - return u.encode(t3); - default: - return h.transformTo(e4, t3); - } - }(s2, function(e4, t3) { - var r3, n3 = 0, i3 = null, s3 = 0; - for (r3 = 0; r3 < t3.length; r3++) - s3 += t3[r3].length; - switch (e4) { - case "string": - return t3.join(""); - case "array": - return Array.prototype.concat.apply([], t3); - case "uint8array": - for (i3 = new Uint8Array(s3), r3 = 0; r3 < t3.length; r3++) - i3.set(t3[r3], n3), n3 += t3[r3].length; - return i3; - case "nodebuffer": - return Buffer.concat(t3); - default: - throw new Error("concat : unsupported type '" + e4 + "'"); - } - }(i2, n2), a2); - t2(e3); - } catch (e4) { - r2(e4); - } - n2 = []; - }).resume(); - }); - } - function f(e2, t2, r2) { - var n2 = t2; - switch (t2) { - case "blob": - case "arraybuffer": - n2 = "uint8array"; - break; - case "base64": - n2 = "string"; - } - try { - this._internalType = n2, this._outputType = t2, this._mimeType = r2, h.checkSupport(n2), this._worker = e2.pipe(new i(n2)), e2.lock(); - } catch (e3) { - this._worker = new s("error"), this._worker.error(e3); - } - } - f.prototype = { accumulate: function(e2) { - return l(this, e2); - }, on: function(e2, t2) { - var r2 = this; - return "data" === e2 ? this._worker.on(e2, function(e3) { - t2.call(r2, e3.data, e3.meta); - }) : this._worker.on(e2, function() { - h.delay(t2, arguments, r2); - }), this; - }, resume: function() { - return h.delay(this._worker.resume, [], this._worker), this; - }, pause: function() { - return this._worker.pause(), this; - }, toNodejsStream: function(e2) { - if (h.checkSupport("nodestream"), "nodebuffer" !== this._outputType) - throw new Error(this._outputType + " is not supported by this method"); - return new o(this, { objectMode: "nodebuffer" !== this._outputType }, e2); - } }, t.exports = f; - }, { "../base64": 1, "../external": 6, "../nodejs/NodejsStreamOutputAdapter": 13, "../support": 30, "../utils": 32, "./ConvertWorker": 24, "./GenericWorker": 28 }], 30: [function(e, t, r) { - "use strict"; - if (r.base64 = true, r.array = true, r.string = true, r.arraybuffer = "undefined" != typeof ArrayBuffer && "undefined" != typeof Uint8Array, r.nodebuffer = "undefined" != typeof Buffer, r.uint8array = "undefined" != typeof Uint8Array, "undefined" == typeof ArrayBuffer) - r.blob = false; - else { - var n = new ArrayBuffer(0); - try { - r.blob = 0 === new Blob([n], { type: "application/zip" }).size; - } catch (e2) { - try { - var i = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)(); - i.append(n), r.blob = 0 === i.getBlob("application/zip").size; - } catch (e3) { - r.blob = false; - } - } - } - try { - r.nodestream = !!e("readable-stream").Readable; - } catch (e2) { - r.nodestream = false; - } - }, { "readable-stream": 16 }], 31: [function(e, t, s) { - "use strict"; - for (var o = e("./utils"), h = e("./support"), r = e("./nodejsUtils"), n = e("./stream/GenericWorker"), u = new Array(256), i = 0; i < 256; i++) - u[i] = 252 <= i ? 6 : 248 <= i ? 5 : 240 <= i ? 4 : 224 <= i ? 3 : 192 <= i ? 2 : 1; - u[254] = u[254] = 1; - function a() { - n.call(this, "utf-8 decode"), this.leftOver = null; - } - function l() { - n.call(this, "utf-8 encode"); - } - s.utf8encode = function(e2) { - return h.nodebuffer ? r.newBufferFrom(e2, "utf-8") : function(e3) { - var t2, r2, n2, i2, s2, a2 = e3.length, o2 = 0; - for (i2 = 0; i2 < a2; i2++) - 55296 == (64512 & (r2 = e3.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n2 = e3.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), o2 += r2 < 128 ? 1 : r2 < 2048 ? 2 : r2 < 65536 ? 3 : 4; - for (t2 = h.uint8array ? new Uint8Array(o2) : new Array(o2), i2 = s2 = 0; s2 < o2; i2++) - 55296 == (64512 & (r2 = e3.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n2 = e3.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), r2 < 128 ? t2[s2++] = r2 : (r2 < 2048 ? t2[s2++] = 192 | r2 >>> 6 : (r2 < 65536 ? t2[s2++] = 224 | r2 >>> 12 : (t2[s2++] = 240 | r2 >>> 18, t2[s2++] = 128 | r2 >>> 12 & 63), t2[s2++] = 128 | r2 >>> 6 & 63), t2[s2++] = 128 | 63 & r2); - return t2; - }(e2); - }, s.utf8decode = function(e2) { - return h.nodebuffer ? o.transformTo("nodebuffer", e2).toString("utf-8") : function(e3) { - var t2, r2, n2, i2, s2 = e3.length, a2 = new Array(2 * s2); - for (t2 = r2 = 0; t2 < s2; ) - if ((n2 = e3[t2++]) < 128) - a2[r2++] = n2; - else if (4 < (i2 = u[n2])) - a2[r2++] = 65533, t2 += i2 - 1; - else { - for (n2 &= 2 === i2 ? 31 : 3 === i2 ? 15 : 7; 1 < i2 && t2 < s2; ) - n2 = n2 << 6 | 63 & e3[t2++], i2--; - 1 < i2 ? a2[r2++] = 65533 : n2 < 65536 ? a2[r2++] = n2 : (n2 -= 65536, a2[r2++] = 55296 | n2 >> 10 & 1023, a2[r2++] = 56320 | 1023 & n2); - } - return a2.length !== r2 && (a2.subarray ? a2 = a2.subarray(0, r2) : a2.length = r2), o.applyFromCharCode(a2); - }(e2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2)); - }, o.inherits(a, n), a.prototype.processChunk = function(e2) { - var t2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2.data); - if (this.leftOver && this.leftOver.length) { - if (h.uint8array) { - var r2 = t2; - (t2 = new Uint8Array(r2.length + this.leftOver.length)).set(this.leftOver, 0), t2.set(r2, this.leftOver.length); - } else - t2 = this.leftOver.concat(t2); - this.leftOver = null; - } - var n2 = function(e3, t3) { - var r3; - for ((t3 = t3 || e3.length) > e3.length && (t3 = e3.length), r3 = t3 - 1; 0 <= r3 && 128 == (192 & e3[r3]); ) - r3--; - return r3 < 0 ? t3 : 0 === r3 ? t3 : r3 + u[e3[r3]] > t3 ? r3 : t3; - }(t2), i2 = t2; - n2 !== t2.length && (h.uint8array ? (i2 = t2.subarray(0, n2), this.leftOver = t2.subarray(n2, t2.length)) : (i2 = t2.slice(0, n2), this.leftOver = t2.slice(n2, t2.length))), this.push({ data: s.utf8decode(i2), meta: e2.meta }); - }, a.prototype.flush = function() { - this.leftOver && this.leftOver.length && (this.push({ data: s.utf8decode(this.leftOver), meta: {} }), this.leftOver = null); - }, s.Utf8DecodeWorker = a, o.inherits(l, n), l.prototype.processChunk = function(e2) { - this.push({ data: s.utf8encode(e2.data), meta: e2.meta }); - }, s.Utf8EncodeWorker = l; - }, { "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./support": 30, "./utils": 32 }], 32: [function(e, t, a) { - "use strict"; - var o = e("./support"), h = e("./base64"), r = e("./nodejsUtils"), u = e("./external"); - function n(e2) { - return e2; - } - function l(e2, t2) { - for (var r2 = 0; r2 < e2.length; ++r2) - t2[r2] = 255 & e2.charCodeAt(r2); - return t2; - } - e("setimmediate"), a.newBlob = function(t2, r2) { - a.checkSupport("blob"); - try { - return new Blob([t2], { type: r2 }); - } catch (e2) { - try { - var n2 = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)(); - return n2.append(t2), n2.getBlob(r2); - } catch (e3) { - throw new Error("Bug : can't construct the Blob."); - } - } - }; - var i = { stringifyByChunk: function(e2, t2, r2) { - var n2 = [], i2 = 0, s2 = e2.length; - if (s2 <= r2) - return String.fromCharCode.apply(null, e2); - for (; i2 < s2; ) - "array" === t2 || "nodebuffer" === t2 ? n2.push(String.fromCharCode.apply(null, e2.slice(i2, Math.min(i2 + r2, s2)))) : n2.push(String.fromCharCode.apply(null, e2.subarray(i2, Math.min(i2 + r2, s2)))), i2 += r2; - return n2.join(""); - }, stringifyByChar: function(e2) { - for (var t2 = "", r2 = 0; r2 < e2.length; r2++) - t2 += String.fromCharCode(e2[r2]); - return t2; - }, applyCanBeUsed: { uint8array: function() { - try { - return o.uint8array && 1 === String.fromCharCode.apply(null, new Uint8Array(1)).length; - } catch (e2) { - return false; - } - }(), nodebuffer: function() { - try { - return o.nodebuffer && 1 === String.fromCharCode.apply(null, r.allocBuffer(1)).length; - } catch (e2) { - return false; - } - }() } }; - function s(e2) { - var t2 = 65536, r2 = a.getTypeOf(e2), n2 = true; - if ("uint8array" === r2 ? n2 = i.applyCanBeUsed.uint8array : "nodebuffer" === r2 && (n2 = i.applyCanBeUsed.nodebuffer), n2) - for (; 1 < t2; ) - try { - return i.stringifyByChunk(e2, r2, t2); - } catch (e3) { - t2 = Math.floor(t2 / 2); - } - return i.stringifyByChar(e2); - } - function f(e2, t2) { - for (var r2 = 0; r2 < e2.length; r2++) - t2[r2] = e2[r2]; - return t2; - } - a.applyFromCharCode = s; - var c = {}; - c.string = { string: n, array: function(e2) { - return l(e2, new Array(e2.length)); - }, arraybuffer: function(e2) { - return c.string.uint8array(e2).buffer; - }, uint8array: function(e2) { - return l(e2, new Uint8Array(e2.length)); - }, nodebuffer: function(e2) { - return l(e2, r.allocBuffer(e2.length)); - } }, c.array = { string: s, array: n, arraybuffer: function(e2) { - return new Uint8Array(e2).buffer; - }, uint8array: function(e2) { - return new Uint8Array(e2); - }, nodebuffer: function(e2) { - return r.newBufferFrom(e2); - } }, c.arraybuffer = { string: function(e2) { - return s(new Uint8Array(e2)); - }, array: function(e2) { - return f(new Uint8Array(e2), new Array(e2.byteLength)); - }, arraybuffer: n, uint8array: function(e2) { - return new Uint8Array(e2); - }, nodebuffer: function(e2) { - return r.newBufferFrom(new Uint8Array(e2)); - } }, c.uint8array = { string: s, array: function(e2) { - return f(e2, new Array(e2.length)); - }, arraybuffer: function(e2) { - return e2.buffer; - }, uint8array: n, nodebuffer: function(e2) { - return r.newBufferFrom(e2); - } }, c.nodebuffer = { string: s, array: function(e2) { - return f(e2, new Array(e2.length)); - }, arraybuffer: function(e2) { - return c.nodebuffer.uint8array(e2).buffer; - }, uint8array: function(e2) { - return f(e2, new Uint8Array(e2.length)); - }, nodebuffer: n }, a.transformTo = function(e2, t2) { - if (t2 = t2 || "", !e2) - return t2; - a.checkSupport(e2); - var r2 = a.getTypeOf(t2); - return c[r2][e2](t2); - }, a.resolve = function(e2) { - for (var t2 = e2.split("/"), r2 = [], n2 = 0; n2 < t2.length; n2++) { - var i2 = t2[n2]; - "." === i2 || "" === i2 && 0 !== n2 && n2 !== t2.length - 1 || (".." === i2 ? r2.pop() : r2.push(i2)); - } - return r2.join("/"); - }, a.getTypeOf = function(e2) { - return "string" == typeof e2 ? "string" : "[object Array]" === Object.prototype.toString.call(e2) ? "array" : o.nodebuffer && r.isBuffer(e2) ? "nodebuffer" : o.uint8array && e2 instanceof Uint8Array ? "uint8array" : o.arraybuffer && e2 instanceof ArrayBuffer ? "arraybuffer" : void 0; - }, a.checkSupport = function(e2) { - if (!o[e2.toLowerCase()]) - throw new Error(e2 + " is not supported by this platform"); - }, a.MAX_VALUE_16BITS = 65535, a.MAX_VALUE_32BITS = -1, a.pretty = function(e2) { - var t2, r2, n2 = ""; - for (r2 = 0; r2 < (e2 || "").length; r2++) - n2 += "\\x" + ((t2 = e2.charCodeAt(r2)) < 16 ? "0" : "") + t2.toString(16).toUpperCase(); - return n2; - }, a.delay = function(e2, t2, r2) { - setImmediate(function() { - e2.apply(r2 || null, t2 || []); - }); - }, a.inherits = function(e2, t2) { - function r2() { - } - r2.prototype = t2.prototype, e2.prototype = new r2(); - }, a.extend = function() { - var e2, t2, r2 = {}; - for (e2 = 0; e2 < arguments.length; e2++) - for (t2 in arguments[e2]) - Object.prototype.hasOwnProperty.call(arguments[e2], t2) && void 0 === r2[t2] && (r2[t2] = arguments[e2][t2]); - return r2; - }, a.prepareContent = function(r2, e2, n2, i2, s2) { - return u.Promise.resolve(e2).then(function(n3) { - return o.blob && (n3 instanceof Blob || -1 !== ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(n3))) && "undefined" != typeof FileReader ? new u.Promise(function(t2, r3) { - var e3 = new FileReader(); - e3.onload = function(e4) { - t2(e4.target.result); - }, e3.onerror = function(e4) { - r3(e4.target.error); - }, e3.readAsArrayBuffer(n3); - }) : n3; - }).then(function(e3) { - var t2 = a.getTypeOf(e3); - return t2 ? ("arraybuffer" === t2 ? e3 = a.transformTo("uint8array", e3) : "string" === t2 && (s2 ? e3 = h.decode(e3) : n2 && true !== i2 && (e3 = function(e4) { - return l(e4, o.uint8array ? new Uint8Array(e4.length) : new Array(e4.length)); - }(e3))), e3) : u.Promise.reject(new Error("Can't read the data of '" + r2 + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?")); - }); - }; - }, { "./base64": 1, "./external": 6, "./nodejsUtils": 14, "./support": 30, setimmediate: 54 }], 33: [function(e, t, r) { - "use strict"; - var n = e("./reader/readerFor"), i = e("./utils"), s = e("./signature"), a = e("./zipEntry"), o = e("./support"); - function h(e2) { - this.files = [], this.loadOptions = e2; - } - h.prototype = { checkSignature: function(e2) { - if (!this.reader.readAndCheckSignature(e2)) { - this.reader.index -= 4; - var t2 = this.reader.readString(4); - throw new Error("Corrupted zip or bug: unexpected signature (" + i.pretty(t2) + ", expected " + i.pretty(e2) + ")"); - } - }, isSignature: function(e2, t2) { - var r2 = this.reader.index; - this.reader.setIndex(e2); - var n2 = this.reader.readString(4) === t2; - return this.reader.setIndex(r2), n2; - }, readBlockEndOfCentral: function() { - this.diskNumber = this.reader.readInt(2), this.diskWithCentralDirStart = this.reader.readInt(2), this.centralDirRecordsOnThisDisk = this.reader.readInt(2), this.centralDirRecords = this.reader.readInt(2), this.centralDirSize = this.reader.readInt(4), this.centralDirOffset = this.reader.readInt(4), this.zipCommentLength = this.reader.readInt(2); - var e2 = this.reader.readData(this.zipCommentLength), t2 = o.uint8array ? "uint8array" : "array", r2 = i.transformTo(t2, e2); - this.zipComment = this.loadOptions.decodeFileName(r2); - }, readBlockZip64EndOfCentral: function() { - this.zip64EndOfCentralSize = this.reader.readInt(8), this.reader.skip(4), this.diskNumber = this.reader.readInt(4), this.diskWithCentralDirStart = this.reader.readInt(4), this.centralDirRecordsOnThisDisk = this.reader.readInt(8), this.centralDirRecords = this.reader.readInt(8), this.centralDirSize = this.reader.readInt(8), this.centralDirOffset = this.reader.readInt(8), this.zip64ExtensibleData = {}; - for (var e2, t2, r2, n2 = this.zip64EndOfCentralSize - 44; 0 < n2; ) - e2 = this.reader.readInt(2), t2 = this.reader.readInt(4), r2 = this.reader.readData(t2), this.zip64ExtensibleData[e2] = { id: e2, length: t2, value: r2 }; - }, readBlockZip64EndOfCentralLocator: function() { - if (this.diskWithZip64CentralDirStart = this.reader.readInt(4), this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8), this.disksCount = this.reader.readInt(4), 1 < this.disksCount) - throw new Error("Multi-volumes zip are not supported"); - }, readLocalFiles: function() { - var e2, t2; - for (e2 = 0; e2 < this.files.length; e2++) - t2 = this.files[e2], this.reader.setIndex(t2.localHeaderOffset), this.checkSignature(s.LOCAL_FILE_HEADER), t2.readLocalPart(this.reader), t2.handleUTF8(), t2.processAttributes(); - }, readCentralDir: function() { - var e2; - for (this.reader.setIndex(this.centralDirOffset); this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER); ) - (e2 = new a({ zip64: this.zip64 }, this.loadOptions)).readCentralPart(this.reader), this.files.push(e2); - if (this.centralDirRecords !== this.files.length && 0 !== this.centralDirRecords && 0 === this.files.length) - throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length); - }, readEndOfCentral: function() { - var e2 = this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END); - if (e2 < 0) - throw !this.isSignature(0, s.LOCAL_FILE_HEADER) ? new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html") : new Error("Corrupted zip: can't find end of central directory"); - this.reader.setIndex(e2); - var t2 = e2; - if (this.checkSignature(s.CENTRAL_DIRECTORY_END), this.readBlockEndOfCentral(), this.diskNumber === i.MAX_VALUE_16BITS || this.diskWithCentralDirStart === i.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === i.MAX_VALUE_16BITS || this.centralDirRecords === i.MAX_VALUE_16BITS || this.centralDirSize === i.MAX_VALUE_32BITS || this.centralDirOffset === i.MAX_VALUE_32BITS) { - if (this.zip64 = true, (e2 = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR)) < 0) - throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator"); - if (this.reader.setIndex(e2), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR), this.readBlockZip64EndOfCentralLocator(), !this.isSignature(this.relativeOffsetEndOfZip64CentralDir, s.ZIP64_CENTRAL_DIRECTORY_END) && (this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.relativeOffsetEndOfZip64CentralDir < 0)) - throw new Error("Corrupted zip: can't find the ZIP64 end of central directory"); - this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.readBlockZip64EndOfCentral(); - } - var r2 = this.centralDirOffset + this.centralDirSize; - this.zip64 && (r2 += 20, r2 += 12 + this.zip64EndOfCentralSize); - var n2 = t2 - r2; - if (0 < n2) - this.isSignature(t2, s.CENTRAL_FILE_HEADER) || (this.reader.zero = n2); - else if (n2 < 0) - throw new Error("Corrupted zip: missing " + Math.abs(n2) + " bytes."); - }, prepareReader: function(e2) { - this.reader = n(e2); - }, load: function(e2) { - this.prepareReader(e2), this.readEndOfCentral(), this.readCentralDir(), this.readLocalFiles(); - } }, t.exports = h; - }, { "./reader/readerFor": 22, "./signature": 23, "./support": 30, "./utils": 32, "./zipEntry": 34 }], 34: [function(e, t, r) { - "use strict"; - var n = e("./reader/readerFor"), s = e("./utils"), i = e("./compressedObject"), a = e("./crc32"), o = e("./utf8"), h = e("./compressions"), u = e("./support"); - function l(e2, t2) { - this.options = e2, this.loadOptions = t2; - } - l.prototype = { isEncrypted: function() { - return 1 == (1 & this.bitFlag); - }, useUTF8: function() { - return 2048 == (2048 & this.bitFlag); - }, readLocalPart: function(e2) { - var t2, r2; - if (e2.skip(22), this.fileNameLength = e2.readInt(2), r2 = e2.readInt(2), this.fileName = e2.readData(this.fileNameLength), e2.skip(r2), -1 === this.compressedSize || -1 === this.uncompressedSize) - throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)"); - if (null === (t2 = function(e3) { - for (var t3 in h) - if (Object.prototype.hasOwnProperty.call(h, t3) && h[t3].magic === e3) - return h[t3]; - return null; - }(this.compressionMethod))) - throw new Error("Corrupted zip : compression " + s.pretty(this.compressionMethod) + " unknown (inner file : " + s.transformTo("string", this.fileName) + ")"); - this.decompressed = new i(this.compressedSize, this.uncompressedSize, this.crc32, t2, e2.readData(this.compressedSize)); - }, readCentralPart: function(e2) { - this.versionMadeBy = e2.readInt(2), e2.skip(2), this.bitFlag = e2.readInt(2), this.compressionMethod = e2.readString(2), this.date = e2.readDate(), this.crc32 = e2.readInt(4), this.compressedSize = e2.readInt(4), this.uncompressedSize = e2.readInt(4); - var t2 = e2.readInt(2); - if (this.extraFieldsLength = e2.readInt(2), this.fileCommentLength = e2.readInt(2), this.diskNumberStart = e2.readInt(2), this.internalFileAttributes = e2.readInt(2), this.externalFileAttributes = e2.readInt(4), this.localHeaderOffset = e2.readInt(4), this.isEncrypted()) - throw new Error("Encrypted zip are not supported"); - e2.skip(t2), this.readExtraFields(e2), this.parseZIP64ExtraField(e2), this.fileComment = e2.readData(this.fileCommentLength); - }, processAttributes: function() { - this.unixPermissions = null, this.dosPermissions = null; - var e2 = this.versionMadeBy >> 8; - this.dir = !!(16 & this.externalFileAttributes), 0 == e2 && (this.dosPermissions = 63 & this.externalFileAttributes), 3 == e2 && (this.unixPermissions = this.externalFileAttributes >> 16 & 65535), this.dir || "/" !== this.fileNameStr.slice(-1) || (this.dir = true); - }, parseZIP64ExtraField: function() { - if (this.extraFields[1]) { - var e2 = n(this.extraFields[1].value); - this.uncompressedSize === s.MAX_VALUE_32BITS && (this.uncompressedSize = e2.readInt(8)), this.compressedSize === s.MAX_VALUE_32BITS && (this.compressedSize = e2.readInt(8)), this.localHeaderOffset === s.MAX_VALUE_32BITS && (this.localHeaderOffset = e2.readInt(8)), this.diskNumberStart === s.MAX_VALUE_32BITS && (this.diskNumberStart = e2.readInt(4)); - } - }, readExtraFields: function(e2) { - var t2, r2, n2, i2 = e2.index + this.extraFieldsLength; - for (this.extraFields || (this.extraFields = {}); e2.index + 4 < i2; ) - t2 = e2.readInt(2), r2 = e2.readInt(2), n2 = e2.readData(r2), this.extraFields[t2] = { id: t2, length: r2, value: n2 }; - e2.setIndex(i2); - }, handleUTF8: function() { - var e2 = u.uint8array ? "uint8array" : "array"; - if (this.useUTF8()) - this.fileNameStr = o.utf8decode(this.fileName), this.fileCommentStr = o.utf8decode(this.fileComment); - else { - var t2 = this.findExtraFieldUnicodePath(); - if (null !== t2) - this.fileNameStr = t2; - else { - var r2 = s.transformTo(e2, this.fileName); - this.fileNameStr = this.loadOptions.decodeFileName(r2); - } - var n2 = this.findExtraFieldUnicodeComment(); - if (null !== n2) - this.fileCommentStr = n2; - else { - var i2 = s.transformTo(e2, this.fileComment); - this.fileCommentStr = this.loadOptions.decodeFileName(i2); - } - } - }, findExtraFieldUnicodePath: function() { - var e2 = this.extraFields[28789]; - if (e2) { - var t2 = n(e2.value); - return 1 !== t2.readInt(1) ? null : a(this.fileName) !== t2.readInt(4) ? null : o.utf8decode(t2.readData(e2.length - 5)); - } - return null; - }, findExtraFieldUnicodeComment: function() { - var e2 = this.extraFields[25461]; - if (e2) { - var t2 = n(e2.value); - return 1 !== t2.readInt(1) ? null : a(this.fileComment) !== t2.readInt(4) ? null : o.utf8decode(t2.readData(e2.length - 5)); - } - return null; - } }, t.exports = l; - }, { "./compressedObject": 2, "./compressions": 3, "./crc32": 4, "./reader/readerFor": 22, "./support": 30, "./utf8": 31, "./utils": 32 }], 35: [function(e, t, r) { - "use strict"; - function n(e2, t2, r2) { - this.name = e2, this.dir = r2.dir, this.date = r2.date, this.comment = r2.comment, this.unixPermissions = r2.unixPermissions, this.dosPermissions = r2.dosPermissions, this._data = t2, this._dataBinary = r2.binary, this.options = { compression: r2.compression, compressionOptions: r2.compressionOptions }; - } - var s = e("./stream/StreamHelper"), i = e("./stream/DataWorker"), a = e("./utf8"), o = e("./compressedObject"), h = e("./stream/GenericWorker"); - n.prototype = { internalStream: function(e2) { - var t2 = null, r2 = "string"; - try { - if (!e2) - throw new Error("No output type specified."); - var n2 = "string" === (r2 = e2.toLowerCase()) || "text" === r2; - "binarystring" !== r2 && "text" !== r2 || (r2 = "string"), t2 = this._decompressWorker(); - var i2 = !this._dataBinary; - i2 && !n2 && (t2 = t2.pipe(new a.Utf8EncodeWorker())), !i2 && n2 && (t2 = t2.pipe(new a.Utf8DecodeWorker())); - } catch (e3) { - (t2 = new h("error")).error(e3); - } - return new s(t2, r2, ""); - }, async: function(e2, t2) { - return this.internalStream(e2).accumulate(t2); - }, nodeStream: function(e2, t2) { - return this.internalStream(e2 || "nodebuffer").toNodejsStream(t2); - }, _compressWorker: function(e2, t2) { - if (this._data instanceof o && this._data.compression.magic === e2.magic) - return this._data.getCompressedWorker(); - var r2 = this._decompressWorker(); - return this._dataBinary || (r2 = r2.pipe(new a.Utf8EncodeWorker())), o.createWorkerFrom(r2, e2, t2); - }, _decompressWorker: function() { - return this._data instanceof o ? this._data.getContentWorker() : this._data instanceof h ? this._data : new i(this._data); - } }; - for (var u = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"], l = function() { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); - }, f = 0; f < u.length; f++) - n.prototype[u[f]] = l; - t.exports = n; - }, { "./compressedObject": 2, "./stream/DataWorker": 27, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31 }], 36: [function(e, l, t) { - (function(t2) { - "use strict"; - var r, n, e2 = t2.MutationObserver || t2.WebKitMutationObserver; - if (e2) { - var i = 0, s = new e2(u), a = t2.document.createTextNode(""); - s.observe(a, { characterData: true }), r = function() { - a.data = i = ++i % 2; - }; - } else if (t2.setImmediate || void 0 === t2.MessageChannel) - r = "document" in t2 && "onreadystatechange" in t2.document.createElement("script") ? function() { - var e3 = t2.document.createElement("script"); - e3.onreadystatechange = function() { - u(), e3.onreadystatechange = null, e3.parentNode.removeChild(e3), e3 = null; - }, t2.document.documentElement.appendChild(e3); - } : function() { - setTimeout(u, 0); - }; - else { - var o = new t2.MessageChannel(); - o.port1.onmessage = u, r = function() { - o.port2.postMessage(0); - }; - } - var h = []; - function u() { - var e3, t3; - n = true; - for (var r2 = h.length; r2; ) { - for (t3 = h, h = [], e3 = -1; ++e3 < r2; ) - t3[e3](); - r2 = h.length; - } - n = false; - } - l.exports = function(e3) { - 1 !== h.push(e3) || n || r(); - }; - }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}); - }, {}], 37: [function(e, t, r) { - "use strict"; - var i = e("immediate"); - function u() { - } - var l = {}, s = ["REJECTED"], a = ["FULFILLED"], n = ["PENDING"]; - function o(e2) { - if ("function" != typeof e2) - throw new TypeError("resolver must be a function"); - this.state = n, this.queue = [], this.outcome = void 0, e2 !== u && d(this, e2); - } - function h(e2, t2, r2) { - this.promise = e2, "function" == typeof t2 && (this.onFulfilled = t2, this.callFulfilled = this.otherCallFulfilled), "function" == typeof r2 && (this.onRejected = r2, this.callRejected = this.otherCallRejected); - } - function f(t2, r2, n2) { - i(function() { - var e2; - try { - e2 = r2(n2); - } catch (e3) { - return l.reject(t2, e3); - } - e2 === t2 ? l.reject(t2, new TypeError("Cannot resolve promise with itself")) : l.resolve(t2, e2); - }); - } - function c(e2) { - var t2 = e2 && e2.then; - if (e2 && ("object" == typeof e2 || "function" == typeof e2) && "function" == typeof t2) - return function() { - t2.apply(e2, arguments); - }; - } - function d(t2, e2) { - var r2 = false; - function n2(e3) { - r2 || (r2 = true, l.reject(t2, e3)); - } - function i2(e3) { - r2 || (r2 = true, l.resolve(t2, e3)); - } - var s2 = p(function() { - e2(i2, n2); - }); - "error" === s2.status && n2(s2.value); - } - function p(e2, t2) { - var r2 = {}; - try { - r2.value = e2(t2), r2.status = "success"; - } catch (e3) { - r2.status = "error", r2.value = e3; - } - return r2; - } - (t.exports = o).prototype.finally = function(t2) { - if ("function" != typeof t2) - return this; - var r2 = this.constructor; - return this.then(function(e2) { - return r2.resolve(t2()).then(function() { - return e2; - }); - }, function(e2) { - return r2.resolve(t2()).then(function() { - throw e2; - }); - }); - }, o.prototype.catch = function(e2) { - return this.then(null, e2); - }, o.prototype.then = function(e2, t2) { - if ("function" != typeof e2 && this.state === a || "function" != typeof t2 && this.state === s) - return this; - var r2 = new this.constructor(u); - this.state !== n ? f(r2, this.state === a ? e2 : t2, this.outcome) : this.queue.push(new h(r2, e2, t2)); - return r2; - }, h.prototype.callFulfilled = function(e2) { - l.resolve(this.promise, e2); - }, h.prototype.otherCallFulfilled = function(e2) { - f(this.promise, this.onFulfilled, e2); - }, h.prototype.callRejected = function(e2) { - l.reject(this.promise, e2); - }, h.prototype.otherCallRejected = function(e2) { - f(this.promise, this.onRejected, e2); - }, l.resolve = function(e2, t2) { - var r2 = p(c, t2); - if ("error" === r2.status) - return l.reject(e2, r2.value); - var n2 = r2.value; - if (n2) - d(e2, n2); - else { - e2.state = a, e2.outcome = t2; - for (var i2 = -1, s2 = e2.queue.length; ++i2 < s2; ) - e2.queue[i2].callFulfilled(t2); - } - return e2; - }, l.reject = function(e2, t2) { - e2.state = s, e2.outcome = t2; - for (var r2 = -1, n2 = e2.queue.length; ++r2 < n2; ) - e2.queue[r2].callRejected(t2); - return e2; - }, o.resolve = function(e2) { - if (e2 instanceof this) - return e2; - return l.resolve(new this(u), e2); - }, o.reject = function(e2) { - var t2 = new this(u); - return l.reject(t2, e2); - }, o.all = function(e2) { - var r2 = this; - if ("[object Array]" !== Object.prototype.toString.call(e2)) - return this.reject(new TypeError("must be an array")); - var n2 = e2.length, i2 = false; - if (!n2) - return this.resolve([]); - var s2 = new Array(n2), a2 = 0, t2 = -1, o2 = new this(u); - for (; ++t2 < n2; ) - h2(e2[t2], t2); - return o2; - function h2(e3, t3) { - r2.resolve(e3).then(function(e4) { - s2[t3] = e4, ++a2 !== n2 || i2 || (i2 = true, l.resolve(o2, s2)); - }, function(e4) { - i2 || (i2 = true, l.reject(o2, e4)); - }); - } - }, o.race = function(e2) { - var t2 = this; - if ("[object Array]" !== Object.prototype.toString.call(e2)) - return this.reject(new TypeError("must be an array")); - var r2 = e2.length, n2 = false; - if (!r2) - return this.resolve([]); - var i2 = -1, s2 = new this(u); - for (; ++i2 < r2; ) - a2 = e2[i2], t2.resolve(a2).then(function(e3) { - n2 || (n2 = true, l.resolve(s2, e3)); - }, function(e3) { - n2 || (n2 = true, l.reject(s2, e3)); - }); - var a2; - return s2; - }; - }, { immediate: 36 }], 38: [function(e, t, r) { - "use strict"; - var n = {}; - (0, e("./lib/utils/common").assign)(n, e("./lib/deflate"), e("./lib/inflate"), e("./lib/zlib/constants")), t.exports = n; - }, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function(e, t, r) { - "use strict"; - var a = e("./zlib/deflate"), o = e("./utils/common"), h = e("./utils/strings"), i = e("./zlib/messages"), s = e("./zlib/zstream"), u = Object.prototype.toString, l = 0, f = -1, c = 0, d = 8; - function p(e2) { - if (!(this instanceof p)) - return new p(e2); - this.options = o.assign({ level: f, method: d, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: c, to: "" }, e2 || {}); - var t2 = this.options; - t2.raw && 0 < t2.windowBits ? t2.windowBits = -t2.windowBits : t2.gzip && 0 < t2.windowBits && t2.windowBits < 16 && (t2.windowBits += 16), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new s(), this.strm.avail_out = 0; - var r2 = a.deflateInit2(this.strm, t2.level, t2.method, t2.windowBits, t2.memLevel, t2.strategy); - if (r2 !== l) - throw new Error(i[r2]); - if (t2.header && a.deflateSetHeader(this.strm, t2.header), t2.dictionary) { - var n2; - if (n2 = "string" == typeof t2.dictionary ? h.string2buf(t2.dictionary) : "[object ArrayBuffer]" === u.call(t2.dictionary) ? new Uint8Array(t2.dictionary) : t2.dictionary, (r2 = a.deflateSetDictionary(this.strm, n2)) !== l) - throw new Error(i[r2]); - this._dict_set = true; - } - } - function n(e2, t2) { - var r2 = new p(t2); - if (r2.push(e2, true), r2.err) - throw r2.msg || i[r2.err]; - return r2.result; - } - p.prototype.push = function(e2, t2) { - var r2, n2, i2 = this.strm, s2 = this.options.chunkSize; - if (this.ended) - return false; - n2 = t2 === ~~t2 ? t2 : true === t2 ? 4 : 0, "string" == typeof e2 ? i2.input = h.string2buf(e2) : "[object ArrayBuffer]" === u.call(e2) ? i2.input = new Uint8Array(e2) : i2.input = e2, i2.next_in = 0, i2.avail_in = i2.input.length; - do { - if (0 === i2.avail_out && (i2.output = new o.Buf8(s2), i2.next_out = 0, i2.avail_out = s2), 1 !== (r2 = a.deflate(i2, n2)) && r2 !== l) - return this.onEnd(r2), !(this.ended = true); - 0 !== i2.avail_out && (0 !== i2.avail_in || 4 !== n2 && 2 !== n2) || ("string" === this.options.to ? this.onData(h.buf2binstring(o.shrinkBuf(i2.output, i2.next_out))) : this.onData(o.shrinkBuf(i2.output, i2.next_out))); - } while ((0 < i2.avail_in || 0 === i2.avail_out) && 1 !== r2); - return 4 === n2 ? (r2 = a.deflateEnd(this.strm), this.onEnd(r2), this.ended = true, r2 === l) : 2 !== n2 || (this.onEnd(l), !(i2.avail_out = 0)); - }, p.prototype.onData = function(e2) { - this.chunks.push(e2); - }, p.prototype.onEnd = function(e2) { - e2 === l && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = o.flattenChunks(this.chunks)), this.chunks = [], this.err = e2, this.msg = this.strm.msg; - }, r.Deflate = p, r.deflate = n, r.deflateRaw = function(e2, t2) { - return (t2 = t2 || {}).raw = true, n(e2, t2); - }, r.gzip = function(e2, t2) { - return (t2 = t2 || {}).gzip = true, n(e2, t2); - }; - }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(e, t, r) { - "use strict"; - var c = e("./zlib/inflate"), d = e("./utils/common"), p = e("./utils/strings"), m = e("./zlib/constants"), n = e("./zlib/messages"), i = e("./zlib/zstream"), s = e("./zlib/gzheader"), _ = Object.prototype.toString; - function a(e2) { - if (!(this instanceof a)) - return new a(e2); - this.options = d.assign({ chunkSize: 16384, windowBits: 0, to: "" }, e2 || {}); - var t2 = this.options; - t2.raw && 0 <= t2.windowBits && t2.windowBits < 16 && (t2.windowBits = -t2.windowBits, 0 === t2.windowBits && (t2.windowBits = -15)), !(0 <= t2.windowBits && t2.windowBits < 16) || e2 && e2.windowBits || (t2.windowBits += 32), 15 < t2.windowBits && t2.windowBits < 48 && 0 == (15 & t2.windowBits) && (t2.windowBits |= 15), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new i(), this.strm.avail_out = 0; - var r2 = c.inflateInit2(this.strm, t2.windowBits); - if (r2 !== m.Z_OK) - throw new Error(n[r2]); - this.header = new s(), c.inflateGetHeader(this.strm, this.header); - } - function o(e2, t2) { - var r2 = new a(t2); - if (r2.push(e2, true), r2.err) - throw r2.msg || n[r2.err]; - return r2.result; - } - a.prototype.push = function(e2, t2) { - var r2, n2, i2, s2, a2, o2, h = this.strm, u = this.options.chunkSize, l = this.options.dictionary, f = false; - if (this.ended) - return false; - n2 = t2 === ~~t2 ? t2 : true === t2 ? m.Z_FINISH : m.Z_NO_FLUSH, "string" == typeof e2 ? h.input = p.binstring2buf(e2) : "[object ArrayBuffer]" === _.call(e2) ? h.input = new Uint8Array(e2) : h.input = e2, h.next_in = 0, h.avail_in = h.input.length; - do { - if (0 === h.avail_out && (h.output = new d.Buf8(u), h.next_out = 0, h.avail_out = u), (r2 = c.inflate(h, m.Z_NO_FLUSH)) === m.Z_NEED_DICT && l && (o2 = "string" == typeof l ? p.string2buf(l) : "[object ArrayBuffer]" === _.call(l) ? new Uint8Array(l) : l, r2 = c.inflateSetDictionary(this.strm, o2)), r2 === m.Z_BUF_ERROR && true === f && (r2 = m.Z_OK, f = false), r2 !== m.Z_STREAM_END && r2 !== m.Z_OK) - return this.onEnd(r2), !(this.ended = true); - h.next_out && (0 !== h.avail_out && r2 !== m.Z_STREAM_END && (0 !== h.avail_in || n2 !== m.Z_FINISH && n2 !== m.Z_SYNC_FLUSH) || ("string" === this.options.to ? (i2 = p.utf8border(h.output, h.next_out), s2 = h.next_out - i2, a2 = p.buf2string(h.output, i2), h.next_out = s2, h.avail_out = u - s2, s2 && d.arraySet(h.output, h.output, i2, s2, 0), this.onData(a2)) : this.onData(d.shrinkBuf(h.output, h.next_out)))), 0 === h.avail_in && 0 === h.avail_out && (f = true); - } while ((0 < h.avail_in || 0 === h.avail_out) && r2 !== m.Z_STREAM_END); - return r2 === m.Z_STREAM_END && (n2 = m.Z_FINISH), n2 === m.Z_FINISH ? (r2 = c.inflateEnd(this.strm), this.onEnd(r2), this.ended = true, r2 === m.Z_OK) : n2 !== m.Z_SYNC_FLUSH || (this.onEnd(m.Z_OK), !(h.avail_out = 0)); - }, a.prototype.onData = function(e2) { - this.chunks.push(e2); - }, a.prototype.onEnd = function(e2) { - e2 === m.Z_OK && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = d.flattenChunks(this.chunks)), this.chunks = [], this.err = e2, this.msg = this.strm.msg; - }, r.Inflate = a, r.inflate = o, r.inflateRaw = function(e2, t2) { - return (t2 = t2 || {}).raw = true, o(e2, t2); - }, r.ungzip = o; - }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/constants": 44, "./zlib/gzheader": 47, "./zlib/inflate": 49, "./zlib/messages": 51, "./zlib/zstream": 53 }], 41: [function(e, t, r) { - "use strict"; - var n = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Int32Array; - r.assign = function(e2) { - for (var t2 = Array.prototype.slice.call(arguments, 1); t2.length; ) { - var r2 = t2.shift(); - if (r2) { - if ("object" != typeof r2) - throw new TypeError(r2 + "must be non-object"); - for (var n2 in r2) - r2.hasOwnProperty(n2) && (e2[n2] = r2[n2]); - } - } - return e2; - }, r.shrinkBuf = function(e2, t2) { - return e2.length === t2 ? e2 : e2.subarray ? e2.subarray(0, t2) : (e2.length = t2, e2); - }; - var i = { arraySet: function(e2, t2, r2, n2, i2) { - if (t2.subarray && e2.subarray) - e2.set(t2.subarray(r2, r2 + n2), i2); - else - for (var s2 = 0; s2 < n2; s2++) - e2[i2 + s2] = t2[r2 + s2]; - }, flattenChunks: function(e2) { - var t2, r2, n2, i2, s2, a; - for (t2 = n2 = 0, r2 = e2.length; t2 < r2; t2++) - n2 += e2[t2].length; - for (a = new Uint8Array(n2), t2 = i2 = 0, r2 = e2.length; t2 < r2; t2++) - s2 = e2[t2], a.set(s2, i2), i2 += s2.length; - return a; - } }, s = { arraySet: function(e2, t2, r2, n2, i2) { - for (var s2 = 0; s2 < n2; s2++) - e2[i2 + s2] = t2[r2 + s2]; - }, flattenChunks: function(e2) { - return [].concat.apply([], e2); - } }; - r.setTyped = function(e2) { - e2 ? (r.Buf8 = Uint8Array, r.Buf16 = Uint16Array, r.Buf32 = Int32Array, r.assign(r, i)) : (r.Buf8 = Array, r.Buf16 = Array, r.Buf32 = Array, r.assign(r, s)); - }, r.setTyped(n); - }, {}], 42: [function(e, t, r) { - "use strict"; - var h = e("./common"), i = true, s = true; - try { - String.fromCharCode.apply(null, [0]); - } catch (e2) { - i = false; - } - try { - String.fromCharCode.apply(null, new Uint8Array(1)); - } catch (e2) { - s = false; - } - for (var u = new h.Buf8(256), n = 0; n < 256; n++) - u[n] = 252 <= n ? 6 : 248 <= n ? 5 : 240 <= n ? 4 : 224 <= n ? 3 : 192 <= n ? 2 : 1; - function l(e2, t2) { - if (t2 < 65537 && (e2.subarray && s || !e2.subarray && i)) - return String.fromCharCode.apply(null, h.shrinkBuf(e2, t2)); - for (var r2 = "", n2 = 0; n2 < t2; n2++) - r2 += String.fromCharCode(e2[n2]); - return r2; - } - u[254] = u[254] = 1, r.string2buf = function(e2) { - var t2, r2, n2, i2, s2, a = e2.length, o = 0; - for (i2 = 0; i2 < a; i2++) - 55296 == (64512 & (r2 = e2.charCodeAt(i2))) && i2 + 1 < a && 56320 == (64512 & (n2 = e2.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), o += r2 < 128 ? 1 : r2 < 2048 ? 2 : r2 < 65536 ? 3 : 4; - for (t2 = new h.Buf8(o), i2 = s2 = 0; s2 < o; i2++) - 55296 == (64512 & (r2 = e2.charCodeAt(i2))) && i2 + 1 < a && 56320 == (64512 & (n2 = e2.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), r2 < 128 ? t2[s2++] = r2 : (r2 < 2048 ? t2[s2++] = 192 | r2 >>> 6 : (r2 < 65536 ? t2[s2++] = 224 | r2 >>> 12 : (t2[s2++] = 240 | r2 >>> 18, t2[s2++] = 128 | r2 >>> 12 & 63), t2[s2++] = 128 | r2 >>> 6 & 63), t2[s2++] = 128 | 63 & r2); - return t2; - }, r.buf2binstring = function(e2) { - return l(e2, e2.length); - }, r.binstring2buf = function(e2) { - for (var t2 = new h.Buf8(e2.length), r2 = 0, n2 = t2.length; r2 < n2; r2++) - t2[r2] = e2.charCodeAt(r2); - return t2; - }, r.buf2string = function(e2, t2) { - var r2, n2, i2, s2, a = t2 || e2.length, o = new Array(2 * a); - for (r2 = n2 = 0; r2 < a; ) - if ((i2 = e2[r2++]) < 128) - o[n2++] = i2; - else if (4 < (s2 = u[i2])) - o[n2++] = 65533, r2 += s2 - 1; - else { - for (i2 &= 2 === s2 ? 31 : 3 === s2 ? 15 : 7; 1 < s2 && r2 < a; ) - i2 = i2 << 6 | 63 & e2[r2++], s2--; - 1 < s2 ? o[n2++] = 65533 : i2 < 65536 ? o[n2++] = i2 : (i2 -= 65536, o[n2++] = 55296 | i2 >> 10 & 1023, o[n2++] = 56320 | 1023 & i2); - } - return l(o, n2); - }, r.utf8border = function(e2, t2) { - var r2; - for ((t2 = t2 || e2.length) > e2.length && (t2 = e2.length), r2 = t2 - 1; 0 <= r2 && 128 == (192 & e2[r2]); ) - r2--; - return r2 < 0 ? t2 : 0 === r2 ? t2 : r2 + u[e2[r2]] > t2 ? r2 : t2; - }; - }, { "./common": 41 }], 43: [function(e, t, r) { - "use strict"; - t.exports = function(e2, t2, r2, n) { - for (var i = 65535 & e2 | 0, s = e2 >>> 16 & 65535 | 0, a = 0; 0 !== r2; ) { - for (r2 -= a = 2e3 < r2 ? 2e3 : r2; s = s + (i = i + t2[n++] | 0) | 0, --a; ) - ; - i %= 65521, s %= 65521; - } - return i | s << 16 | 0; - }; - }, {}], 44: [function(e, t, r) { - "use strict"; - t.exports = { Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, Z_BUF_ERROR: -5, Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, Z_BINARY: 0, Z_TEXT: 1, Z_UNKNOWN: 2, Z_DEFLATED: 8 }; - }, {}], 45: [function(e, t, r) { - "use strict"; - var o = function() { - for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) { - e2 = r2; - for (var n = 0; n < 8; n++) - e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1; - t2[r2] = e2; - } - return t2; - }(); - t.exports = function(e2, t2, r2, n) { - var i = o, s = n + r2; - e2 ^= -1; - for (var a = n; a < s; a++) - e2 = e2 >>> 8 ^ i[255 & (e2 ^ t2[a])]; - return -1 ^ e2; - }; - }, {}], 46: [function(e, t, r) { - "use strict"; - var h, c = e("../utils/common"), u = e("./trees"), d = e("./adler32"), p = e("./crc32"), n = e("./messages"), l = 0, f = 4, m = 0, _ = -2, g = -1, b = 4, i = 2, v = 8, y = 9, s = 286, a = 30, o = 19, w = 2 * s + 1, k = 15, x = 3, S = 258, z = S + x + 1, C = 42, E = 113, A = 1, I = 2, O = 3, B = 4; - function R(e2, t2) { - return e2.msg = n[t2], t2; - } - function T(e2) { - return (e2 << 1) - (4 < e2 ? 9 : 0); - } - function D(e2) { - for (var t2 = e2.length; 0 <= --t2; ) - e2[t2] = 0; - } - function F(e2) { - var t2 = e2.state, r2 = t2.pending; - r2 > e2.avail_out && (r2 = e2.avail_out), 0 !== r2 && (c.arraySet(e2.output, t2.pending_buf, t2.pending_out, r2, e2.next_out), e2.next_out += r2, t2.pending_out += r2, e2.total_out += r2, e2.avail_out -= r2, t2.pending -= r2, 0 === t2.pending && (t2.pending_out = 0)); - } - function N(e2, t2) { - u._tr_flush_block(e2, 0 <= e2.block_start ? e2.block_start : -1, e2.strstart - e2.block_start, t2), e2.block_start = e2.strstart, F(e2.strm); - } - function U(e2, t2) { - e2.pending_buf[e2.pending++] = t2; - } - function P(e2, t2) { - e2.pending_buf[e2.pending++] = t2 >>> 8 & 255, e2.pending_buf[e2.pending++] = 255 & t2; - } - function L(e2, t2) { - var r2, n2, i2 = e2.max_chain_length, s2 = e2.strstart, a2 = e2.prev_length, o2 = e2.nice_match, h2 = e2.strstart > e2.w_size - z ? e2.strstart - (e2.w_size - z) : 0, u2 = e2.window, l2 = e2.w_mask, f2 = e2.prev, c2 = e2.strstart + S, d2 = u2[s2 + a2 - 1], p2 = u2[s2 + a2]; - e2.prev_length >= e2.good_match && (i2 >>= 2), o2 > e2.lookahead && (o2 = e2.lookahead); - do { - if (u2[(r2 = t2) + a2] === p2 && u2[r2 + a2 - 1] === d2 && u2[r2] === u2[s2] && u2[++r2] === u2[s2 + 1]) { - s2 += 2, r2++; - do { - } while (u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && s2 < c2); - if (n2 = S - (c2 - s2), s2 = c2 - S, a2 < n2) { - if (e2.match_start = t2, o2 <= (a2 = n2)) - break; - d2 = u2[s2 + a2 - 1], p2 = u2[s2 + a2]; - } - } - } while ((t2 = f2[t2 & l2]) > h2 && 0 != --i2); - return a2 <= e2.lookahead ? a2 : e2.lookahead; - } - function j(e2) { - var t2, r2, n2, i2, s2, a2, o2, h2, u2, l2, f2 = e2.w_size; - do { - if (i2 = e2.window_size - e2.lookahead - e2.strstart, e2.strstart >= f2 + (f2 - z)) { - for (c.arraySet(e2.window, e2.window, f2, f2, 0), e2.match_start -= f2, e2.strstart -= f2, e2.block_start -= f2, t2 = r2 = e2.hash_size; n2 = e2.head[--t2], e2.head[t2] = f2 <= n2 ? n2 - f2 : 0, --r2; ) - ; - for (t2 = r2 = f2; n2 = e2.prev[--t2], e2.prev[t2] = f2 <= n2 ? n2 - f2 : 0, --r2; ) - ; - i2 += f2; - } - if (0 === e2.strm.avail_in) - break; - if (a2 = e2.strm, o2 = e2.window, h2 = e2.strstart + e2.lookahead, u2 = i2, l2 = void 0, l2 = a2.avail_in, u2 < l2 && (l2 = u2), r2 = 0 === l2 ? 0 : (a2.avail_in -= l2, c.arraySet(o2, a2.input, a2.next_in, l2, h2), 1 === a2.state.wrap ? a2.adler = d(a2.adler, o2, l2, h2) : 2 === a2.state.wrap && (a2.adler = p(a2.adler, o2, l2, h2)), a2.next_in += l2, a2.total_in += l2, l2), e2.lookahead += r2, e2.lookahead + e2.insert >= x) - for (s2 = e2.strstart - e2.insert, e2.ins_h = e2.window[s2], e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[s2 + 1]) & e2.hash_mask; e2.insert && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[s2 + x - 1]) & e2.hash_mask, e2.prev[s2 & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = s2, s2++, e2.insert--, !(e2.lookahead + e2.insert < x)); ) - ; - } while (e2.lookahead < z && 0 !== e2.strm.avail_in); - } - function Z(e2, t2) { - for (var r2, n2; ; ) { - if (e2.lookahead < z) { - if (j(e2), e2.lookahead < z && t2 === l) - return A; - if (0 === e2.lookahead) - break; - } - if (r2 = 0, e2.lookahead >= x && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), 0 !== r2 && e2.strstart - r2 <= e2.w_size - z && (e2.match_length = L(e2, r2)), e2.match_length >= x) - if (n2 = u._tr_tally(e2, e2.strstart - e2.match_start, e2.match_length - x), e2.lookahead -= e2.match_length, e2.match_length <= e2.max_lazy_match && e2.lookahead >= x) { - for (e2.match_length--; e2.strstart++, e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart, 0 != --e2.match_length; ) - ; - e2.strstart++; - } else - e2.strstart += e2.match_length, e2.match_length = 0, e2.ins_h = e2.window[e2.strstart], e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + 1]) & e2.hash_mask; - else - n2 = u._tr_tally(e2, 0, e2.window[e2.strstart]), e2.lookahead--, e2.strstart++; - if (n2 && (N(e2, false), 0 === e2.strm.avail_out)) - return A; - } - return e2.insert = e2.strstart < x - 1 ? e2.strstart : x - 1, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : e2.last_lit && (N(e2, false), 0 === e2.strm.avail_out) ? A : I; - } - function W(e2, t2) { - for (var r2, n2, i2; ; ) { - if (e2.lookahead < z) { - if (j(e2), e2.lookahead < z && t2 === l) - return A; - if (0 === e2.lookahead) - break; - } - if (r2 = 0, e2.lookahead >= x && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), e2.prev_length = e2.match_length, e2.prev_match = e2.match_start, e2.match_length = x - 1, 0 !== r2 && e2.prev_length < e2.max_lazy_match && e2.strstart - r2 <= e2.w_size - z && (e2.match_length = L(e2, r2), e2.match_length <= 5 && (1 === e2.strategy || e2.match_length === x && 4096 < e2.strstart - e2.match_start) && (e2.match_length = x - 1)), e2.prev_length >= x && e2.match_length <= e2.prev_length) { - for (i2 = e2.strstart + e2.lookahead - x, n2 = u._tr_tally(e2, e2.strstart - 1 - e2.prev_match, e2.prev_length - x), e2.lookahead -= e2.prev_length - 1, e2.prev_length -= 2; ++e2.strstart <= i2 && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), 0 != --e2.prev_length; ) - ; - if (e2.match_available = 0, e2.match_length = x - 1, e2.strstart++, n2 && (N(e2, false), 0 === e2.strm.avail_out)) - return A; - } else if (e2.match_available) { - if ((n2 = u._tr_tally(e2, 0, e2.window[e2.strstart - 1])) && N(e2, false), e2.strstart++, e2.lookahead--, 0 === e2.strm.avail_out) - return A; - } else - e2.match_available = 1, e2.strstart++, e2.lookahead--; - } - return e2.match_available && (n2 = u._tr_tally(e2, 0, e2.window[e2.strstart - 1]), e2.match_available = 0), e2.insert = e2.strstart < x - 1 ? e2.strstart : x - 1, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : e2.last_lit && (N(e2, false), 0 === e2.strm.avail_out) ? A : I; - } - function M(e2, t2, r2, n2, i2) { - this.good_length = e2, this.max_lazy = t2, this.nice_length = r2, this.max_chain = n2, this.func = i2; - } - function H() { - this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = v, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new c.Buf16(2 * w), this.dyn_dtree = new c.Buf16(2 * (2 * a + 1)), this.bl_tree = new c.Buf16(2 * (2 * o + 1)), D(this.dyn_ltree), D(this.dyn_dtree), D(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new c.Buf16(k + 1), this.heap = new c.Buf16(2 * s + 1), D(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new c.Buf16(2 * s + 1), D(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0; - } - function G(e2) { - var t2; - return e2 && e2.state ? (e2.total_in = e2.total_out = 0, e2.data_type = i, (t2 = e2.state).pending = 0, t2.pending_out = 0, t2.wrap < 0 && (t2.wrap = -t2.wrap), t2.status = t2.wrap ? C : E, e2.adler = 2 === t2.wrap ? 0 : 1, t2.last_flush = l, u._tr_init(t2), m) : R(e2, _); - } - function K(e2) { - var t2 = G(e2); - return t2 === m && function(e3) { - e3.window_size = 2 * e3.w_size, D(e3.head), e3.max_lazy_match = h[e3.level].max_lazy, e3.good_match = h[e3.level].good_length, e3.nice_match = h[e3.level].nice_length, e3.max_chain_length = h[e3.level].max_chain, e3.strstart = 0, e3.block_start = 0, e3.lookahead = 0, e3.insert = 0, e3.match_length = e3.prev_length = x - 1, e3.match_available = 0, e3.ins_h = 0; - }(e2.state), t2; - } - function Y(e2, t2, r2, n2, i2, s2) { - if (!e2) - return _; - var a2 = 1; - if (t2 === g && (t2 = 6), n2 < 0 ? (a2 = 0, n2 = -n2) : 15 < n2 && (a2 = 2, n2 -= 16), i2 < 1 || y < i2 || r2 !== v || n2 < 8 || 15 < n2 || t2 < 0 || 9 < t2 || s2 < 0 || b < s2) - return R(e2, _); - 8 === n2 && (n2 = 9); - var o2 = new H(); - return (e2.state = o2).strm = e2, o2.wrap = a2, o2.gzhead = null, o2.w_bits = n2, o2.w_size = 1 << o2.w_bits, o2.w_mask = o2.w_size - 1, o2.hash_bits = i2 + 7, o2.hash_size = 1 << o2.hash_bits, o2.hash_mask = o2.hash_size - 1, o2.hash_shift = ~~((o2.hash_bits + x - 1) / x), o2.window = new c.Buf8(2 * o2.w_size), o2.head = new c.Buf16(o2.hash_size), o2.prev = new c.Buf16(o2.w_size), o2.lit_bufsize = 1 << i2 + 6, o2.pending_buf_size = 4 * o2.lit_bufsize, o2.pending_buf = new c.Buf8(o2.pending_buf_size), o2.d_buf = 1 * o2.lit_bufsize, o2.l_buf = 3 * o2.lit_bufsize, o2.level = t2, o2.strategy = s2, o2.method = r2, K(e2); - } - h = [new M(0, 0, 0, 0, function(e2, t2) { - var r2 = 65535; - for (r2 > e2.pending_buf_size - 5 && (r2 = e2.pending_buf_size - 5); ; ) { - if (e2.lookahead <= 1) { - if (j(e2), 0 === e2.lookahead && t2 === l) - return A; - if (0 === e2.lookahead) - break; - } - e2.strstart += e2.lookahead, e2.lookahead = 0; - var n2 = e2.block_start + r2; - if ((0 === e2.strstart || e2.strstart >= n2) && (e2.lookahead = e2.strstart - n2, e2.strstart = n2, N(e2, false), 0 === e2.strm.avail_out)) - return A; - if (e2.strstart - e2.block_start >= e2.w_size - z && (N(e2, false), 0 === e2.strm.avail_out)) - return A; - } - return e2.insert = 0, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : (e2.strstart > e2.block_start && (N(e2, false), e2.strm.avail_out), A); - }), new M(4, 4, 8, 4, Z), new M(4, 5, 16, 8, Z), new M(4, 6, 32, 32, Z), new M(4, 4, 16, 16, W), new M(8, 16, 32, 32, W), new M(8, 16, 128, 128, W), new M(8, 32, 128, 256, W), new M(32, 128, 258, 1024, W), new M(32, 258, 258, 4096, W)], r.deflateInit = function(e2, t2) { - return Y(e2, t2, v, 15, 8, 0); - }, r.deflateInit2 = Y, r.deflateReset = K, r.deflateResetKeep = G, r.deflateSetHeader = function(e2, t2) { - return e2 && e2.state ? 2 !== e2.state.wrap ? _ : (e2.state.gzhead = t2, m) : _; - }, r.deflate = function(e2, t2) { - var r2, n2, i2, s2; - if (!e2 || !e2.state || 5 < t2 || t2 < 0) - return e2 ? R(e2, _) : _; - if (n2 = e2.state, !e2.output || !e2.input && 0 !== e2.avail_in || 666 === n2.status && t2 !== f) - return R(e2, 0 === e2.avail_out ? -5 : _); - if (n2.strm = e2, r2 = n2.last_flush, n2.last_flush = t2, n2.status === C) - if (2 === n2.wrap) - e2.adler = 0, U(n2, 31), U(n2, 139), U(n2, 8), n2.gzhead ? (U(n2, (n2.gzhead.text ? 1 : 0) + (n2.gzhead.hcrc ? 2 : 0) + (n2.gzhead.extra ? 4 : 0) + (n2.gzhead.name ? 8 : 0) + (n2.gzhead.comment ? 16 : 0)), U(n2, 255 & n2.gzhead.time), U(n2, n2.gzhead.time >> 8 & 255), U(n2, n2.gzhead.time >> 16 & 255), U(n2, n2.gzhead.time >> 24 & 255), U(n2, 9 === n2.level ? 2 : 2 <= n2.strategy || n2.level < 2 ? 4 : 0), U(n2, 255 & n2.gzhead.os), n2.gzhead.extra && n2.gzhead.extra.length && (U(n2, 255 & n2.gzhead.extra.length), U(n2, n2.gzhead.extra.length >> 8 & 255)), n2.gzhead.hcrc && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending, 0)), n2.gzindex = 0, n2.status = 69) : (U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 9 === n2.level ? 2 : 2 <= n2.strategy || n2.level < 2 ? 4 : 0), U(n2, 3), n2.status = E); - else { - var a2 = v + (n2.w_bits - 8 << 4) << 8; - a2 |= (2 <= n2.strategy || n2.level < 2 ? 0 : n2.level < 6 ? 1 : 6 === n2.level ? 2 : 3) << 6, 0 !== n2.strstart && (a2 |= 32), a2 += 31 - a2 % 31, n2.status = E, P(n2, a2), 0 !== n2.strstart && (P(n2, e2.adler >>> 16), P(n2, 65535 & e2.adler)), e2.adler = 1; - } - if (69 === n2.status) - if (n2.gzhead.extra) { - for (i2 = n2.pending; n2.gzindex < (65535 & n2.gzhead.extra.length) && (n2.pending !== n2.pending_buf_size || (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending !== n2.pending_buf_size)); ) - U(n2, 255 & n2.gzhead.extra[n2.gzindex]), n2.gzindex++; - n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), n2.gzindex === n2.gzhead.extra.length && (n2.gzindex = 0, n2.status = 73); - } else - n2.status = 73; - if (73 === n2.status) - if (n2.gzhead.name) { - i2 = n2.pending; - do { - if (n2.pending === n2.pending_buf_size && (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending === n2.pending_buf_size)) { - s2 = 1; - break; - } - s2 = n2.gzindex < n2.gzhead.name.length ? 255 & n2.gzhead.name.charCodeAt(n2.gzindex++) : 0, U(n2, s2); - } while (0 !== s2); - n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), 0 === s2 && (n2.gzindex = 0, n2.status = 91); - } else - n2.status = 91; - if (91 === n2.status) - if (n2.gzhead.comment) { - i2 = n2.pending; - do { - if (n2.pending === n2.pending_buf_size && (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending === n2.pending_buf_size)) { - s2 = 1; - break; - } - s2 = n2.gzindex < n2.gzhead.comment.length ? 255 & n2.gzhead.comment.charCodeAt(n2.gzindex++) : 0, U(n2, s2); - } while (0 !== s2); - n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), 0 === s2 && (n2.status = 103); - } else - n2.status = 103; - if (103 === n2.status && (n2.gzhead.hcrc ? (n2.pending + 2 > n2.pending_buf_size && F(e2), n2.pending + 2 <= n2.pending_buf_size && (U(n2, 255 & e2.adler), U(n2, e2.adler >> 8 & 255), e2.adler = 0, n2.status = E)) : n2.status = E), 0 !== n2.pending) { - if (F(e2), 0 === e2.avail_out) - return n2.last_flush = -1, m; - } else if (0 === e2.avail_in && T(t2) <= T(r2) && t2 !== f) - return R(e2, -5); - if (666 === n2.status && 0 !== e2.avail_in) - return R(e2, -5); - if (0 !== e2.avail_in || 0 !== n2.lookahead || t2 !== l && 666 !== n2.status) { - var o2 = 2 === n2.strategy ? function(e3, t3) { - for (var r3; ; ) { - if (0 === e3.lookahead && (j(e3), 0 === e3.lookahead)) { - if (t3 === l) - return A; - break; - } - if (e3.match_length = 0, r3 = u._tr_tally(e3, 0, e3.window[e3.strstart]), e3.lookahead--, e3.strstart++, r3 && (N(e3, false), 0 === e3.strm.avail_out)) - return A; - } - return e3.insert = 0, t3 === f ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I; - }(n2, t2) : 3 === n2.strategy ? function(e3, t3) { - for (var r3, n3, i3, s3, a3 = e3.window; ; ) { - if (e3.lookahead <= S) { - if (j(e3), e3.lookahead <= S && t3 === l) - return A; - if (0 === e3.lookahead) - break; - } - if (e3.match_length = 0, e3.lookahead >= x && 0 < e3.strstart && (n3 = a3[i3 = e3.strstart - 1]) === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]) { - s3 = e3.strstart + S; - do { - } while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && i3 < s3); - e3.match_length = S - (s3 - i3), e3.match_length > e3.lookahead && (e3.match_length = e3.lookahead); - } - if (e3.match_length >= x ? (r3 = u._tr_tally(e3, 1, e3.match_length - x), e3.lookahead -= e3.match_length, e3.strstart += e3.match_length, e3.match_length = 0) : (r3 = u._tr_tally(e3, 0, e3.window[e3.strstart]), e3.lookahead--, e3.strstart++), r3 && (N(e3, false), 0 === e3.strm.avail_out)) - return A; - } - return e3.insert = 0, t3 === f ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I; - }(n2, t2) : h[n2.level].func(n2, t2); - if (o2 !== O && o2 !== B || (n2.status = 666), o2 === A || o2 === O) - return 0 === e2.avail_out && (n2.last_flush = -1), m; - if (o2 === I && (1 === t2 ? u._tr_align(n2) : 5 !== t2 && (u._tr_stored_block(n2, 0, 0, false), 3 === t2 && (D(n2.head), 0 === n2.lookahead && (n2.strstart = 0, n2.block_start = 0, n2.insert = 0))), F(e2), 0 === e2.avail_out)) - return n2.last_flush = -1, m; - } - return t2 !== f ? m : n2.wrap <= 0 ? 1 : (2 === n2.wrap ? (U(n2, 255 & e2.adler), U(n2, e2.adler >> 8 & 255), U(n2, e2.adler >> 16 & 255), U(n2, e2.adler >> 24 & 255), U(n2, 255 & e2.total_in), U(n2, e2.total_in >> 8 & 255), U(n2, e2.total_in >> 16 & 255), U(n2, e2.total_in >> 24 & 255)) : (P(n2, e2.adler >>> 16), P(n2, 65535 & e2.adler)), F(e2), 0 < n2.wrap && (n2.wrap = -n2.wrap), 0 !== n2.pending ? m : 1); - }, r.deflateEnd = function(e2) { - var t2; - return e2 && e2.state ? (t2 = e2.state.status) !== C && 69 !== t2 && 73 !== t2 && 91 !== t2 && 103 !== t2 && t2 !== E && 666 !== t2 ? R(e2, _) : (e2.state = null, t2 === E ? R(e2, -3) : m) : _; - }, r.deflateSetDictionary = function(e2, t2) { - var r2, n2, i2, s2, a2, o2, h2, u2, l2 = t2.length; - if (!e2 || !e2.state) - return _; - if (2 === (s2 = (r2 = e2.state).wrap) || 1 === s2 && r2.status !== C || r2.lookahead) - return _; - for (1 === s2 && (e2.adler = d(e2.adler, t2, l2, 0)), r2.wrap = 0, l2 >= r2.w_size && (0 === s2 && (D(r2.head), r2.strstart = 0, r2.block_start = 0, r2.insert = 0), u2 = new c.Buf8(r2.w_size), c.arraySet(u2, t2, l2 - r2.w_size, r2.w_size, 0), t2 = u2, l2 = r2.w_size), a2 = e2.avail_in, o2 = e2.next_in, h2 = e2.input, e2.avail_in = l2, e2.next_in = 0, e2.input = t2, j(r2); r2.lookahead >= x; ) { - for (n2 = r2.strstart, i2 = r2.lookahead - (x - 1); r2.ins_h = (r2.ins_h << r2.hash_shift ^ r2.window[n2 + x - 1]) & r2.hash_mask, r2.prev[n2 & r2.w_mask] = r2.head[r2.ins_h], r2.head[r2.ins_h] = n2, n2++, --i2; ) - ; - r2.strstart = n2, r2.lookahead = x - 1, j(r2); - } - return r2.strstart += r2.lookahead, r2.block_start = r2.strstart, r2.insert = r2.lookahead, r2.lookahead = 0, r2.match_length = r2.prev_length = x - 1, r2.match_available = 0, e2.next_in = o2, e2.input = h2, e2.avail_in = a2, r2.wrap = s2, m; - }, r.deflateInfo = "pako deflate (from Nodeca project)"; - }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./messages": 51, "./trees": 52 }], 47: [function(e, t, r) { - "use strict"; - t.exports = function() { - this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = false; - }; - }, {}], 48: [function(e, t, r) { - "use strict"; - t.exports = function(e2, t2) { - var r2, n, i, s, a, o, h, u, l, f, c, d, p, m, _, g, b, v, y, w, k, x, S, z, C; - r2 = e2.state, n = e2.next_in, z = e2.input, i = n + (e2.avail_in - 5), s = e2.next_out, C = e2.output, a = s - (t2 - e2.avail_out), o = s + (e2.avail_out - 257), h = r2.dmax, u = r2.wsize, l = r2.whave, f = r2.wnext, c = r2.window, d = r2.hold, p = r2.bits, m = r2.lencode, _ = r2.distcode, g = (1 << r2.lenbits) - 1, b = (1 << r2.distbits) - 1; - e: - do { - p < 15 && (d += z[n++] << p, p += 8, d += z[n++] << p, p += 8), v = m[d & g]; - t: - for (; ; ) { - if (d >>>= y = v >>> 24, p -= y, 0 === (y = v >>> 16 & 255)) - C[s++] = 65535 & v; - else { - if (!(16 & y)) { - if (0 == (64 & y)) { - v = m[(65535 & v) + (d & (1 << y) - 1)]; - continue t; - } - if (32 & y) { - r2.mode = 12; - break e; - } - e2.msg = "invalid literal/length code", r2.mode = 30; - break e; - } - w = 65535 & v, (y &= 15) && (p < y && (d += z[n++] << p, p += 8), w += d & (1 << y) - 1, d >>>= y, p -= y), p < 15 && (d += z[n++] << p, p += 8, d += z[n++] << p, p += 8), v = _[d & b]; - r: - for (; ; ) { - if (d >>>= y = v >>> 24, p -= y, !(16 & (y = v >>> 16 & 255))) { - if (0 == (64 & y)) { - v = _[(65535 & v) + (d & (1 << y) - 1)]; - continue r; - } - e2.msg = "invalid distance code", r2.mode = 30; - break e; - } - if (k = 65535 & v, p < (y &= 15) && (d += z[n++] << p, (p += 8) < y && (d += z[n++] << p, p += 8)), h < (k += d & (1 << y) - 1)) { - e2.msg = "invalid distance too far back", r2.mode = 30; - break e; - } - if (d >>>= y, p -= y, (y = s - a) < k) { - if (l < (y = k - y) && r2.sane) { - e2.msg = "invalid distance too far back", r2.mode = 30; - break e; - } - if (S = c, (x = 0) === f) { - if (x += u - y, y < w) { - for (w -= y; C[s++] = c[x++], --y; ) - ; - x = s - k, S = C; - } - } else if (f < y) { - if (x += u + f - y, (y -= f) < w) { - for (w -= y; C[s++] = c[x++], --y; ) - ; - if (x = 0, f < w) { - for (w -= y = f; C[s++] = c[x++], --y; ) - ; - x = s - k, S = C; - } - } - } else if (x += f - y, y < w) { - for (w -= y; C[s++] = c[x++], --y; ) - ; - x = s - k, S = C; - } - for (; 2 < w; ) - C[s++] = S[x++], C[s++] = S[x++], C[s++] = S[x++], w -= 3; - w && (C[s++] = S[x++], 1 < w && (C[s++] = S[x++])); - } else { - for (x = s - k; C[s++] = C[x++], C[s++] = C[x++], C[s++] = C[x++], 2 < (w -= 3); ) - ; - w && (C[s++] = C[x++], 1 < w && (C[s++] = C[x++])); - } - break; - } - } - break; - } - } while (n < i && s < o); - n -= w = p >> 3, d &= (1 << (p -= w << 3)) - 1, e2.next_in = n, e2.next_out = s, e2.avail_in = n < i ? i - n + 5 : 5 - (n - i), e2.avail_out = s < o ? o - s + 257 : 257 - (s - o), r2.hold = d, r2.bits = p; - }; - }, {}], 49: [function(e, t, r) { - "use strict"; - var I = e("../utils/common"), O = e("./adler32"), B = e("./crc32"), R = e("./inffast"), T = e("./inftrees"), D = 1, F = 2, N = 0, U = -2, P = 1, n = 852, i = 592; - function L(e2) { - return (e2 >>> 24 & 255) + (e2 >>> 8 & 65280) + ((65280 & e2) << 8) + ((255 & e2) << 24); - } - function s() { - this.mode = 0, this.last = false, this.wrap = 0, this.havedict = false, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new I.Buf16(320), this.work = new I.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0; - } - function a(e2) { - var t2; - return e2 && e2.state ? (t2 = e2.state, e2.total_in = e2.total_out = t2.total = 0, e2.msg = "", t2.wrap && (e2.adler = 1 & t2.wrap), t2.mode = P, t2.last = 0, t2.havedict = 0, t2.dmax = 32768, t2.head = null, t2.hold = 0, t2.bits = 0, t2.lencode = t2.lendyn = new I.Buf32(n), t2.distcode = t2.distdyn = new I.Buf32(i), t2.sane = 1, t2.back = -1, N) : U; - } - function o(e2) { - var t2; - return e2 && e2.state ? ((t2 = e2.state).wsize = 0, t2.whave = 0, t2.wnext = 0, a(e2)) : U; - } - function h(e2, t2) { - var r2, n2; - return e2 && e2.state ? (n2 = e2.state, t2 < 0 ? (r2 = 0, t2 = -t2) : (r2 = 1 + (t2 >> 4), t2 < 48 && (t2 &= 15)), t2 && (t2 < 8 || 15 < t2) ? U : (null !== n2.window && n2.wbits !== t2 && (n2.window = null), n2.wrap = r2, n2.wbits = t2, o(e2))) : U; - } - function u(e2, t2) { - var r2, n2; - return e2 ? (n2 = new s(), (e2.state = n2).window = null, (r2 = h(e2, t2)) !== N && (e2.state = null), r2) : U; - } - var l, f, c = true; - function j(e2) { - if (c) { - var t2; - for (l = new I.Buf32(512), f = new I.Buf32(32), t2 = 0; t2 < 144; ) - e2.lens[t2++] = 8; - for (; t2 < 256; ) - e2.lens[t2++] = 9; - for (; t2 < 280; ) - e2.lens[t2++] = 7; - for (; t2 < 288; ) - e2.lens[t2++] = 8; - for (T(D, e2.lens, 0, 288, l, 0, e2.work, { bits: 9 }), t2 = 0; t2 < 32; ) - e2.lens[t2++] = 5; - T(F, e2.lens, 0, 32, f, 0, e2.work, { bits: 5 }), c = false; - } - e2.lencode = l, e2.lenbits = 9, e2.distcode = f, e2.distbits = 5; - } - function Z(e2, t2, r2, n2) { - var i2, s2 = e2.state; - return null === s2.window && (s2.wsize = 1 << s2.wbits, s2.wnext = 0, s2.whave = 0, s2.window = new I.Buf8(s2.wsize)), n2 >= s2.wsize ? (I.arraySet(s2.window, t2, r2 - s2.wsize, s2.wsize, 0), s2.wnext = 0, s2.whave = s2.wsize) : (n2 < (i2 = s2.wsize - s2.wnext) && (i2 = n2), I.arraySet(s2.window, t2, r2 - n2, i2, s2.wnext), (n2 -= i2) ? (I.arraySet(s2.window, t2, r2 - n2, n2, 0), s2.wnext = n2, s2.whave = s2.wsize) : (s2.wnext += i2, s2.wnext === s2.wsize && (s2.wnext = 0), s2.whave < s2.wsize && (s2.whave += i2))), 0; - } - r.inflateReset = o, r.inflateReset2 = h, r.inflateResetKeep = a, r.inflateInit = function(e2) { - return u(e2, 15); - }, r.inflateInit2 = u, r.inflate = function(e2, t2) { - var r2, n2, i2, s2, a2, o2, h2, u2, l2, f2, c2, d, p, m, _, g, b, v, y, w, k, x, S, z, C = 0, E = new I.Buf8(4), A = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; - if (!e2 || !e2.state || !e2.output || !e2.input && 0 !== e2.avail_in) - return U; - 12 === (r2 = e2.state).mode && (r2.mode = 13), a2 = e2.next_out, i2 = e2.output, h2 = e2.avail_out, s2 = e2.next_in, n2 = e2.input, o2 = e2.avail_in, u2 = r2.hold, l2 = r2.bits, f2 = o2, c2 = h2, x = N; - e: - for (; ; ) - switch (r2.mode) { - case P: - if (0 === r2.wrap) { - r2.mode = 13; - break; - } - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (2 & r2.wrap && 35615 === u2) { - E[r2.check = 0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0), l2 = u2 = 0, r2.mode = 2; - break; - } - if (r2.flags = 0, r2.head && (r2.head.done = false), !(1 & r2.wrap) || (((255 & u2) << 8) + (u2 >> 8)) % 31) { - e2.msg = "incorrect header check", r2.mode = 30; - break; - } - if (8 != (15 & u2)) { - e2.msg = "unknown compression method", r2.mode = 30; - break; - } - if (l2 -= 4, k = 8 + (15 & (u2 >>>= 4)), 0 === r2.wbits) - r2.wbits = k; - else if (k > r2.wbits) { - e2.msg = "invalid window size", r2.mode = 30; - break; - } - r2.dmax = 1 << k, e2.adler = r2.check = 1, r2.mode = 512 & u2 ? 10 : 12, l2 = u2 = 0; - break; - case 2: - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (r2.flags = u2, 8 != (255 & r2.flags)) { - e2.msg = "unknown compression method", r2.mode = 30; - break; - } - if (57344 & r2.flags) { - e2.msg = "unknown header flags set", r2.mode = 30; - break; - } - r2.head && (r2.head.text = u2 >> 8 & 1), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0, r2.mode = 3; - case 3: - for (; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.head && (r2.head.time = u2), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, E[2] = u2 >>> 16 & 255, E[3] = u2 >>> 24 & 255, r2.check = B(r2.check, E, 4, 0)), l2 = u2 = 0, r2.mode = 4; - case 4: - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.head && (r2.head.xflags = 255 & u2, r2.head.os = u2 >> 8), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0, r2.mode = 5; - case 5: - if (1024 & r2.flags) { - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.length = u2, r2.head && (r2.head.extra_len = u2), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0; - } else - r2.head && (r2.head.extra = null); - r2.mode = 6; - case 6: - if (1024 & r2.flags && (o2 < (d = r2.length) && (d = o2), d && (r2.head && (k = r2.head.extra_len - r2.length, r2.head.extra || (r2.head.extra = new Array(r2.head.extra_len)), I.arraySet(r2.head.extra, n2, s2, d, k)), 512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, r2.length -= d), r2.length)) - break e; - r2.length = 0, r2.mode = 7; - case 7: - if (2048 & r2.flags) { - if (0 === o2) - break e; - for (d = 0; k = n2[s2 + d++], r2.head && k && r2.length < 65536 && (r2.head.name += String.fromCharCode(k)), k && d < o2; ) - ; - if (512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, k) - break e; - } else - r2.head && (r2.head.name = null); - r2.length = 0, r2.mode = 8; - case 8: - if (4096 & r2.flags) { - if (0 === o2) - break e; - for (d = 0; k = n2[s2 + d++], r2.head && k && r2.length < 65536 && (r2.head.comment += String.fromCharCode(k)), k && d < o2; ) - ; - if (512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, k) - break e; - } else - r2.head && (r2.head.comment = null); - r2.mode = 9; - case 9: - if (512 & r2.flags) { - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (u2 !== (65535 & r2.check)) { - e2.msg = "header crc mismatch", r2.mode = 30; - break; - } - l2 = u2 = 0; - } - r2.head && (r2.head.hcrc = r2.flags >> 9 & 1, r2.head.done = true), e2.adler = r2.check = 0, r2.mode = 12; - break; - case 10: - for (; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - e2.adler = r2.check = L(u2), l2 = u2 = 0, r2.mode = 11; - case 11: - if (0 === r2.havedict) - return e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, 2; - e2.adler = r2.check = 1, r2.mode = 12; - case 12: - if (5 === t2 || 6 === t2) - break e; - case 13: - if (r2.last) { - u2 >>>= 7 & l2, l2 -= 7 & l2, r2.mode = 27; - break; - } - for (; l2 < 3; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - switch (r2.last = 1 & u2, l2 -= 1, 3 & (u2 >>>= 1)) { - case 0: - r2.mode = 14; - break; - case 1: - if (j(r2), r2.mode = 20, 6 !== t2) - break; - u2 >>>= 2, l2 -= 2; - break e; - case 2: - r2.mode = 17; - break; - case 3: - e2.msg = "invalid block type", r2.mode = 30; - } - u2 >>>= 2, l2 -= 2; - break; - case 14: - for (u2 >>>= 7 & l2, l2 -= 7 & l2; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if ((65535 & u2) != (u2 >>> 16 ^ 65535)) { - e2.msg = "invalid stored block lengths", r2.mode = 30; - break; - } - if (r2.length = 65535 & u2, l2 = u2 = 0, r2.mode = 15, 6 === t2) - break e; - case 15: - r2.mode = 16; - case 16: - if (d = r2.length) { - if (o2 < d && (d = o2), h2 < d && (d = h2), 0 === d) - break e; - I.arraySet(i2, n2, s2, d, a2), o2 -= d, s2 += d, h2 -= d, a2 += d, r2.length -= d; - break; - } - r2.mode = 12; - break; - case 17: - for (; l2 < 14; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (r2.nlen = 257 + (31 & u2), u2 >>>= 5, l2 -= 5, r2.ndist = 1 + (31 & u2), u2 >>>= 5, l2 -= 5, r2.ncode = 4 + (15 & u2), u2 >>>= 4, l2 -= 4, 286 < r2.nlen || 30 < r2.ndist) { - e2.msg = "too many length or distance symbols", r2.mode = 30; - break; - } - r2.have = 0, r2.mode = 18; - case 18: - for (; r2.have < r2.ncode; ) { - for (; l2 < 3; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.lens[A[r2.have++]] = 7 & u2, u2 >>>= 3, l2 -= 3; - } - for (; r2.have < 19; ) - r2.lens[A[r2.have++]] = 0; - if (r2.lencode = r2.lendyn, r2.lenbits = 7, S = { bits: r2.lenbits }, x = T(0, r2.lens, 0, 19, r2.lencode, 0, r2.work, S), r2.lenbits = S.bits, x) { - e2.msg = "invalid code lengths set", r2.mode = 30; - break; - } - r2.have = 0, r2.mode = 19; - case 19: - for (; r2.have < r2.nlen + r2.ndist; ) { - for (; g = (C = r2.lencode[u2 & (1 << r2.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (b < 16) - u2 >>>= _, l2 -= _, r2.lens[r2.have++] = b; - else { - if (16 === b) { - for (z = _ + 2; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (u2 >>>= _, l2 -= _, 0 === r2.have) { - e2.msg = "invalid bit length repeat", r2.mode = 30; - break; - } - k = r2.lens[r2.have - 1], d = 3 + (3 & u2), u2 >>>= 2, l2 -= 2; - } else if (17 === b) { - for (z = _ + 3; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - l2 -= _, k = 0, d = 3 + (7 & (u2 >>>= _)), u2 >>>= 3, l2 -= 3; - } else { - for (z = _ + 7; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - l2 -= _, k = 0, d = 11 + (127 & (u2 >>>= _)), u2 >>>= 7, l2 -= 7; - } - if (r2.have + d > r2.nlen + r2.ndist) { - e2.msg = "invalid bit length repeat", r2.mode = 30; - break; - } - for (; d--; ) - r2.lens[r2.have++] = k; - } - } - if (30 === r2.mode) - break; - if (0 === r2.lens[256]) { - e2.msg = "invalid code -- missing end-of-block", r2.mode = 30; - break; - } - if (r2.lenbits = 9, S = { bits: r2.lenbits }, x = T(D, r2.lens, 0, r2.nlen, r2.lencode, 0, r2.work, S), r2.lenbits = S.bits, x) { - e2.msg = "invalid literal/lengths set", r2.mode = 30; - break; - } - if (r2.distbits = 6, r2.distcode = r2.distdyn, S = { bits: r2.distbits }, x = T(F, r2.lens, r2.nlen, r2.ndist, r2.distcode, 0, r2.work, S), r2.distbits = S.bits, x) { - e2.msg = "invalid distances set", r2.mode = 30; - break; - } - if (r2.mode = 20, 6 === t2) - break e; - case 20: - r2.mode = 21; - case 21: - if (6 <= o2 && 258 <= h2) { - e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, R(e2, c2), a2 = e2.next_out, i2 = e2.output, h2 = e2.avail_out, s2 = e2.next_in, n2 = e2.input, o2 = e2.avail_in, u2 = r2.hold, l2 = r2.bits, 12 === r2.mode && (r2.back = -1); - break; - } - for (r2.back = 0; g = (C = r2.lencode[u2 & (1 << r2.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (g && 0 == (240 & g)) { - for (v = _, y = g, w = b; g = (C = r2.lencode[w + ((u2 & (1 << v + y) - 1) >> v)]) >>> 16 & 255, b = 65535 & C, !(v + (_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - u2 >>>= v, l2 -= v, r2.back += v; - } - if (u2 >>>= _, l2 -= _, r2.back += _, r2.length = b, 0 === g) { - r2.mode = 26; - break; - } - if (32 & g) { - r2.back = -1, r2.mode = 12; - break; - } - if (64 & g) { - e2.msg = "invalid literal/length code", r2.mode = 30; - break; - } - r2.extra = 15 & g, r2.mode = 22; - case 22: - if (r2.extra) { - for (z = r2.extra; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.length += u2 & (1 << r2.extra) - 1, u2 >>>= r2.extra, l2 -= r2.extra, r2.back += r2.extra; - } - r2.was = r2.length, r2.mode = 23; - case 23: - for (; g = (C = r2.distcode[u2 & (1 << r2.distbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (0 == (240 & g)) { - for (v = _, y = g, w = b; g = (C = r2.distcode[w + ((u2 & (1 << v + y) - 1) >> v)]) >>> 16 & 255, b = 65535 & C, !(v + (_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - u2 >>>= v, l2 -= v, r2.back += v; - } - if (u2 >>>= _, l2 -= _, r2.back += _, 64 & g) { - e2.msg = "invalid distance code", r2.mode = 30; - break; - } - r2.offset = b, r2.extra = 15 & g, r2.mode = 24; - case 24: - if (r2.extra) { - for (z = r2.extra; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.offset += u2 & (1 << r2.extra) - 1, u2 >>>= r2.extra, l2 -= r2.extra, r2.back += r2.extra; - } - if (r2.offset > r2.dmax) { - e2.msg = "invalid distance too far back", r2.mode = 30; - break; - } - r2.mode = 25; - case 25: - if (0 === h2) - break e; - if (d = c2 - h2, r2.offset > d) { - if ((d = r2.offset - d) > r2.whave && r2.sane) { - e2.msg = "invalid distance too far back", r2.mode = 30; - break; - } - p = d > r2.wnext ? (d -= r2.wnext, r2.wsize - d) : r2.wnext - d, d > r2.length && (d = r2.length), m = r2.window; - } else - m = i2, p = a2 - r2.offset, d = r2.length; - for (h2 < d && (d = h2), h2 -= d, r2.length -= d; i2[a2++] = m[p++], --d; ) - ; - 0 === r2.length && (r2.mode = 21); - break; - case 26: - if (0 === h2) - break e; - i2[a2++] = r2.length, h2--, r2.mode = 21; - break; - case 27: - if (r2.wrap) { - for (; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 |= n2[s2++] << l2, l2 += 8; - } - if (c2 -= h2, e2.total_out += c2, r2.total += c2, c2 && (e2.adler = r2.check = r2.flags ? B(r2.check, i2, c2, a2 - c2) : O(r2.check, i2, c2, a2 - c2)), c2 = h2, (r2.flags ? u2 : L(u2)) !== r2.check) { - e2.msg = "incorrect data check", r2.mode = 30; - break; - } - l2 = u2 = 0; - } - r2.mode = 28; - case 28: - if (r2.wrap && r2.flags) { - for (; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (u2 !== (4294967295 & r2.total)) { - e2.msg = "incorrect length check", r2.mode = 30; - break; - } - l2 = u2 = 0; - } - r2.mode = 29; - case 29: - x = 1; - break e; - case 30: - x = -3; - break e; - case 31: - return -4; - case 32: - default: - return U; - } - return e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, (r2.wsize || c2 !== e2.avail_out && r2.mode < 30 && (r2.mode < 27 || 4 !== t2)) && Z(e2, e2.output, e2.next_out, c2 - e2.avail_out) ? (r2.mode = 31, -4) : (f2 -= e2.avail_in, c2 -= e2.avail_out, e2.total_in += f2, e2.total_out += c2, r2.total += c2, r2.wrap && c2 && (e2.adler = r2.check = r2.flags ? B(r2.check, i2, c2, e2.next_out - c2) : O(r2.check, i2, c2, e2.next_out - c2)), e2.data_type = r2.bits + (r2.last ? 64 : 0) + (12 === r2.mode ? 128 : 0) + (20 === r2.mode || 15 === r2.mode ? 256 : 0), (0 == f2 && 0 === c2 || 4 === t2) && x === N && (x = -5), x); - }, r.inflateEnd = function(e2) { - if (!e2 || !e2.state) - return U; - var t2 = e2.state; - return t2.window && (t2.window = null), e2.state = null, N; - }, r.inflateGetHeader = function(e2, t2) { - var r2; - return e2 && e2.state ? 0 == (2 & (r2 = e2.state).wrap) ? U : ((r2.head = t2).done = false, N) : U; - }, r.inflateSetDictionary = function(e2, t2) { - var r2, n2 = t2.length; - return e2 && e2.state ? 0 !== (r2 = e2.state).wrap && 11 !== r2.mode ? U : 11 === r2.mode && O(1, t2, n2, 0) !== r2.check ? -3 : Z(e2, t2, n2, n2) ? (r2.mode = 31, -4) : (r2.havedict = 1, N) : U; - }, r.inflateInfo = "pako inflate (from Nodeca project)"; - }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(e, t, r) { - "use strict"; - var D = e("../utils/common"), F = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], N = [16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78], U = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0], P = [16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64]; - t.exports = function(e2, t2, r2, n, i, s, a, o) { - var h, u, l, f, c, d, p, m, _, g = o.bits, b = 0, v = 0, y = 0, w = 0, k = 0, x = 0, S = 0, z = 0, C = 0, E = 0, A = null, I = 0, O = new D.Buf16(16), B = new D.Buf16(16), R = null, T = 0; - for (b = 0; b <= 15; b++) - O[b] = 0; - for (v = 0; v < n; v++) - O[t2[r2 + v]]++; - for (k = g, w = 15; 1 <= w && 0 === O[w]; w--) - ; - if (w < k && (k = w), 0 === w) - return i[s++] = 20971520, i[s++] = 20971520, o.bits = 1, 0; - for (y = 1; y < w && 0 === O[y]; y++) - ; - for (k < y && (k = y), b = z = 1; b <= 15; b++) - if (z <<= 1, (z -= O[b]) < 0) - return -1; - if (0 < z && (0 === e2 || 1 !== w)) - return -1; - for (B[1] = 0, b = 1; b < 15; b++) - B[b + 1] = B[b] + O[b]; - for (v = 0; v < n; v++) - 0 !== t2[r2 + v] && (a[B[t2[r2 + v]]++] = v); - if (d = 0 === e2 ? (A = R = a, 19) : 1 === e2 ? (A = F, I -= 257, R = N, T -= 257, 256) : (A = U, R = P, -1), b = y, c = s, S = v = E = 0, l = -1, f = (C = 1 << (x = k)) - 1, 1 === e2 && 852 < C || 2 === e2 && 592 < C) - return 1; - for (; ; ) { - for (p = b - S, _ = a[v] < d ? (m = 0, a[v]) : a[v] > d ? (m = R[T + a[v]], A[I + a[v]]) : (m = 96, 0), h = 1 << b - S, y = u = 1 << x; i[c + (E >> S) + (u -= h)] = p << 24 | m << 16 | _ | 0, 0 !== u; ) - ; - for (h = 1 << b - 1; E & h; ) - h >>= 1; - if (0 !== h ? (E &= h - 1, E += h) : E = 0, v++, 0 == --O[b]) { - if (b === w) - break; - b = t2[r2 + a[v]]; - } - if (k < b && (E & f) !== l) { - for (0 === S && (S = k), c += y, z = 1 << (x = b - S); x + S < w && !((z -= O[x + S]) <= 0); ) - x++, z <<= 1; - if (C += 1 << x, 1 === e2 && 852 < C || 2 === e2 && 592 < C) - return 1; - i[l = E & f] = k << 24 | x << 16 | c - s | 0; - } - } - return 0 !== E && (i[c + E] = b - S << 24 | 64 << 16 | 0), o.bits = k, 0; - }; - }, { "../utils/common": 41 }], 51: [function(e, t, r) { - "use strict"; - t.exports = { 2: "need dictionary", 1: "stream end", 0: "", "-1": "file error", "-2": "stream error", "-3": "data error", "-4": "insufficient memory", "-5": "buffer error", "-6": "incompatible version" }; - }, {}], 52: [function(e, t, r) { - "use strict"; - var i = e("../utils/common"), o = 0, h = 1; - function n(e2) { - for (var t2 = e2.length; 0 <= --t2; ) - e2[t2] = 0; - } - var s = 0, a = 29, u = 256, l = u + 1 + a, f = 30, c = 19, _ = 2 * l + 1, g = 15, d = 16, p = 7, m = 256, b = 16, v = 17, y = 18, w = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], k = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], x = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], S = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], z = new Array(2 * (l + 2)); - n(z); - var C = new Array(2 * f); - n(C); - var E = new Array(512); - n(E); - var A = new Array(256); - n(A); - var I = new Array(a); - n(I); - var O, B, R, T = new Array(f); - function D(e2, t2, r2, n2, i2) { - this.static_tree = e2, this.extra_bits = t2, this.extra_base = r2, this.elems = n2, this.max_length = i2, this.has_stree = e2 && e2.length; - } - function F(e2, t2) { - this.dyn_tree = e2, this.max_code = 0, this.stat_desc = t2; - } - function N(e2) { - return e2 < 256 ? E[e2] : E[256 + (e2 >>> 7)]; - } - function U(e2, t2) { - e2.pending_buf[e2.pending++] = 255 & t2, e2.pending_buf[e2.pending++] = t2 >>> 8 & 255; - } - function P(e2, t2, r2) { - e2.bi_valid > d - r2 ? (e2.bi_buf |= t2 << e2.bi_valid & 65535, U(e2, e2.bi_buf), e2.bi_buf = t2 >> d - e2.bi_valid, e2.bi_valid += r2 - d) : (e2.bi_buf |= t2 << e2.bi_valid & 65535, e2.bi_valid += r2); - } - function L(e2, t2, r2) { - P(e2, r2[2 * t2], r2[2 * t2 + 1]); - } - function j(e2, t2) { - for (var r2 = 0; r2 |= 1 & e2, e2 >>>= 1, r2 <<= 1, 0 < --t2; ) - ; - return r2 >>> 1; - } - function Z(e2, t2, r2) { - var n2, i2, s2 = new Array(g + 1), a2 = 0; - for (n2 = 1; n2 <= g; n2++) - s2[n2] = a2 = a2 + r2[n2 - 1] << 1; - for (i2 = 0; i2 <= t2; i2++) { - var o2 = e2[2 * i2 + 1]; - 0 !== o2 && (e2[2 * i2] = j(s2[o2]++, o2)); - } - } - function W(e2) { - var t2; - for (t2 = 0; t2 < l; t2++) - e2.dyn_ltree[2 * t2] = 0; - for (t2 = 0; t2 < f; t2++) - e2.dyn_dtree[2 * t2] = 0; - for (t2 = 0; t2 < c; t2++) - e2.bl_tree[2 * t2] = 0; - e2.dyn_ltree[2 * m] = 1, e2.opt_len = e2.static_len = 0, e2.last_lit = e2.matches = 0; - } - function M(e2) { - 8 < e2.bi_valid ? U(e2, e2.bi_buf) : 0 < e2.bi_valid && (e2.pending_buf[e2.pending++] = e2.bi_buf), e2.bi_buf = 0, e2.bi_valid = 0; - } - function H(e2, t2, r2, n2) { - var i2 = 2 * t2, s2 = 2 * r2; - return e2[i2] < e2[s2] || e2[i2] === e2[s2] && n2[t2] <= n2[r2]; - } - function G(e2, t2, r2) { - for (var n2 = e2.heap[r2], i2 = r2 << 1; i2 <= e2.heap_len && (i2 < e2.heap_len && H(t2, e2.heap[i2 + 1], e2.heap[i2], e2.depth) && i2++, !H(t2, n2, e2.heap[i2], e2.depth)); ) - e2.heap[r2] = e2.heap[i2], r2 = i2, i2 <<= 1; - e2.heap[r2] = n2; - } - function K(e2, t2, r2) { - var n2, i2, s2, a2, o2 = 0; - if (0 !== e2.last_lit) - for (; n2 = e2.pending_buf[e2.d_buf + 2 * o2] << 8 | e2.pending_buf[e2.d_buf + 2 * o2 + 1], i2 = e2.pending_buf[e2.l_buf + o2], o2++, 0 === n2 ? L(e2, i2, t2) : (L(e2, (s2 = A[i2]) + u + 1, t2), 0 !== (a2 = w[s2]) && P(e2, i2 -= I[s2], a2), L(e2, s2 = N(--n2), r2), 0 !== (a2 = k[s2]) && P(e2, n2 -= T[s2], a2)), o2 < e2.last_lit; ) - ; - L(e2, m, t2); - } - function Y(e2, t2) { - var r2, n2, i2, s2 = t2.dyn_tree, a2 = t2.stat_desc.static_tree, o2 = t2.stat_desc.has_stree, h2 = t2.stat_desc.elems, u2 = -1; - for (e2.heap_len = 0, e2.heap_max = _, r2 = 0; r2 < h2; r2++) - 0 !== s2[2 * r2] ? (e2.heap[++e2.heap_len] = u2 = r2, e2.depth[r2] = 0) : s2[2 * r2 + 1] = 0; - for (; e2.heap_len < 2; ) - s2[2 * (i2 = e2.heap[++e2.heap_len] = u2 < 2 ? ++u2 : 0)] = 1, e2.depth[i2] = 0, e2.opt_len--, o2 && (e2.static_len -= a2[2 * i2 + 1]); - for (t2.max_code = u2, r2 = e2.heap_len >> 1; 1 <= r2; r2--) - G(e2, s2, r2); - for (i2 = h2; r2 = e2.heap[1], e2.heap[1] = e2.heap[e2.heap_len--], G(e2, s2, 1), n2 = e2.heap[1], e2.heap[--e2.heap_max] = r2, e2.heap[--e2.heap_max] = n2, s2[2 * i2] = s2[2 * r2] + s2[2 * n2], e2.depth[i2] = (e2.depth[r2] >= e2.depth[n2] ? e2.depth[r2] : e2.depth[n2]) + 1, s2[2 * r2 + 1] = s2[2 * n2 + 1] = i2, e2.heap[1] = i2++, G(e2, s2, 1), 2 <= e2.heap_len; ) - ; - e2.heap[--e2.heap_max] = e2.heap[1], function(e3, t3) { - var r3, n3, i3, s3, a3, o3, h3 = t3.dyn_tree, u3 = t3.max_code, l2 = t3.stat_desc.static_tree, f2 = t3.stat_desc.has_stree, c2 = t3.stat_desc.extra_bits, d2 = t3.stat_desc.extra_base, p2 = t3.stat_desc.max_length, m2 = 0; - for (s3 = 0; s3 <= g; s3++) - e3.bl_count[s3] = 0; - for (h3[2 * e3.heap[e3.heap_max] + 1] = 0, r3 = e3.heap_max + 1; r3 < _; r3++) - p2 < (s3 = h3[2 * h3[2 * (n3 = e3.heap[r3]) + 1] + 1] + 1) && (s3 = p2, m2++), h3[2 * n3 + 1] = s3, u3 < n3 || (e3.bl_count[s3]++, a3 = 0, d2 <= n3 && (a3 = c2[n3 - d2]), o3 = h3[2 * n3], e3.opt_len += o3 * (s3 + a3), f2 && (e3.static_len += o3 * (l2[2 * n3 + 1] + a3))); - if (0 !== m2) { - do { - for (s3 = p2 - 1; 0 === e3.bl_count[s3]; ) - s3--; - e3.bl_count[s3]--, e3.bl_count[s3 + 1] += 2, e3.bl_count[p2]--, m2 -= 2; - } while (0 < m2); - for (s3 = p2; 0 !== s3; s3--) - for (n3 = e3.bl_count[s3]; 0 !== n3; ) - u3 < (i3 = e3.heap[--r3]) || (h3[2 * i3 + 1] !== s3 && (e3.opt_len += (s3 - h3[2 * i3 + 1]) * h3[2 * i3], h3[2 * i3 + 1] = s3), n3--); - } - }(e2, t2), Z(s2, u2, e2.bl_count); - } - function X(e2, t2, r2) { - var n2, i2, s2 = -1, a2 = t2[1], o2 = 0, h2 = 7, u2 = 4; - for (0 === a2 && (h2 = 138, u2 = 3), t2[2 * (r2 + 1) + 1] = 65535, n2 = 0; n2 <= r2; n2++) - i2 = a2, a2 = t2[2 * (n2 + 1) + 1], ++o2 < h2 && i2 === a2 || (o2 < u2 ? e2.bl_tree[2 * i2] += o2 : 0 !== i2 ? (i2 !== s2 && e2.bl_tree[2 * i2]++, e2.bl_tree[2 * b]++) : o2 <= 10 ? e2.bl_tree[2 * v]++ : e2.bl_tree[2 * y]++, s2 = i2, u2 = (o2 = 0) === a2 ? (h2 = 138, 3) : i2 === a2 ? (h2 = 6, 3) : (h2 = 7, 4)); - } - function V(e2, t2, r2) { - var n2, i2, s2 = -1, a2 = t2[1], o2 = 0, h2 = 7, u2 = 4; - for (0 === a2 && (h2 = 138, u2 = 3), n2 = 0; n2 <= r2; n2++) - if (i2 = a2, a2 = t2[2 * (n2 + 1) + 1], !(++o2 < h2 && i2 === a2)) { - if (o2 < u2) - for (; L(e2, i2, e2.bl_tree), 0 != --o2; ) - ; - else - 0 !== i2 ? (i2 !== s2 && (L(e2, i2, e2.bl_tree), o2--), L(e2, b, e2.bl_tree), P(e2, o2 - 3, 2)) : o2 <= 10 ? (L(e2, v, e2.bl_tree), P(e2, o2 - 3, 3)) : (L(e2, y, e2.bl_tree), P(e2, o2 - 11, 7)); - s2 = i2, u2 = (o2 = 0) === a2 ? (h2 = 138, 3) : i2 === a2 ? (h2 = 6, 3) : (h2 = 7, 4); - } - } - n(T); - var q = false; - function J(e2, t2, r2, n2) { - P(e2, (s << 1) + (n2 ? 1 : 0), 3), function(e3, t3, r3, n3) { - M(e3), n3 && (U(e3, r3), U(e3, ~r3)), i.arraySet(e3.pending_buf, e3.window, t3, r3, e3.pending), e3.pending += r3; - }(e2, t2, r2, true); - } - r._tr_init = function(e2) { - q || (function() { - var e3, t2, r2, n2, i2, s2 = new Array(g + 1); - for (n2 = r2 = 0; n2 < a - 1; n2++) - for (I[n2] = r2, e3 = 0; e3 < 1 << w[n2]; e3++) - A[r2++] = n2; - for (A[r2 - 1] = n2, n2 = i2 = 0; n2 < 16; n2++) - for (T[n2] = i2, e3 = 0; e3 < 1 << k[n2]; e3++) - E[i2++] = n2; - for (i2 >>= 7; n2 < f; n2++) - for (T[n2] = i2 << 7, e3 = 0; e3 < 1 << k[n2] - 7; e3++) - E[256 + i2++] = n2; - for (t2 = 0; t2 <= g; t2++) - s2[t2] = 0; - for (e3 = 0; e3 <= 143; ) - z[2 * e3 + 1] = 8, e3++, s2[8]++; - for (; e3 <= 255; ) - z[2 * e3 + 1] = 9, e3++, s2[9]++; - for (; e3 <= 279; ) - z[2 * e3 + 1] = 7, e3++, s2[7]++; - for (; e3 <= 287; ) - z[2 * e3 + 1] = 8, e3++, s2[8]++; - for (Z(z, l + 1, s2), e3 = 0; e3 < f; e3++) - C[2 * e3 + 1] = 5, C[2 * e3] = j(e3, 5); - O = new D(z, w, u + 1, l, g), B = new D(C, k, 0, f, g), R = new D(new Array(0), x, 0, c, p); - }(), q = true), e2.l_desc = new F(e2.dyn_ltree, O), e2.d_desc = new F(e2.dyn_dtree, B), e2.bl_desc = new F(e2.bl_tree, R), e2.bi_buf = 0, e2.bi_valid = 0, W(e2); - }, r._tr_stored_block = J, r._tr_flush_block = function(e2, t2, r2, n2) { - var i2, s2, a2 = 0; - 0 < e2.level ? (2 === e2.strm.data_type && (e2.strm.data_type = function(e3) { - var t3, r3 = 4093624447; - for (t3 = 0; t3 <= 31; t3++, r3 >>>= 1) - if (1 & r3 && 0 !== e3.dyn_ltree[2 * t3]) - return o; - if (0 !== e3.dyn_ltree[18] || 0 !== e3.dyn_ltree[20] || 0 !== e3.dyn_ltree[26]) - return h; - for (t3 = 32; t3 < u; t3++) - if (0 !== e3.dyn_ltree[2 * t3]) - return h; - return o; - }(e2)), Y(e2, e2.l_desc), Y(e2, e2.d_desc), a2 = function(e3) { - var t3; - for (X(e3, e3.dyn_ltree, e3.l_desc.max_code), X(e3, e3.dyn_dtree, e3.d_desc.max_code), Y(e3, e3.bl_desc), t3 = c - 1; 3 <= t3 && 0 === e3.bl_tree[2 * S[t3] + 1]; t3--) - ; - return e3.opt_len += 3 * (t3 + 1) + 5 + 5 + 4, t3; - }(e2), i2 = e2.opt_len + 3 + 7 >>> 3, (s2 = e2.static_len + 3 + 7 >>> 3) <= i2 && (i2 = s2)) : i2 = s2 = r2 + 5, r2 + 4 <= i2 && -1 !== t2 ? J(e2, t2, r2, n2) : 4 === e2.strategy || s2 === i2 ? (P(e2, 2 + (n2 ? 1 : 0), 3), K(e2, z, C)) : (P(e2, 4 + (n2 ? 1 : 0), 3), function(e3, t3, r3, n3) { - var i3; - for (P(e3, t3 - 257, 5), P(e3, r3 - 1, 5), P(e3, n3 - 4, 4), i3 = 0; i3 < n3; i3++) - P(e3, e3.bl_tree[2 * S[i3] + 1], 3); - V(e3, e3.dyn_ltree, t3 - 1), V(e3, e3.dyn_dtree, r3 - 1); - }(e2, e2.l_desc.max_code + 1, e2.d_desc.max_code + 1, a2 + 1), K(e2, e2.dyn_ltree, e2.dyn_dtree)), W(e2), n2 && M(e2); - }, r._tr_tally = function(e2, t2, r2) { - return e2.pending_buf[e2.d_buf + 2 * e2.last_lit] = t2 >>> 8 & 255, e2.pending_buf[e2.d_buf + 2 * e2.last_lit + 1] = 255 & t2, e2.pending_buf[e2.l_buf + e2.last_lit] = 255 & r2, e2.last_lit++, 0 === t2 ? e2.dyn_ltree[2 * r2]++ : (e2.matches++, t2--, e2.dyn_ltree[2 * (A[r2] + u + 1)]++, e2.dyn_dtree[2 * N(t2)]++), e2.last_lit === e2.lit_bufsize - 1; - }, r._tr_align = function(e2) { - P(e2, 2, 3), L(e2, m, z), function(e3) { - 16 === e3.bi_valid ? (U(e3, e3.bi_buf), e3.bi_buf = 0, e3.bi_valid = 0) : 8 <= e3.bi_valid && (e3.pending_buf[e3.pending++] = 255 & e3.bi_buf, e3.bi_buf >>= 8, e3.bi_valid -= 8); - }(e2); - }; - }, { "../utils/common": 41 }], 53: [function(e, t, r) { - "use strict"; - t.exports = function() { - this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0; - }; - }, {}], 54: [function(e, t, r) { - (function(e2) { - !function(r2, n) { - "use strict"; - if (!r2.setImmediate) { - var i, s, t2, a, o = 1, h = {}, u = false, l = r2.document, e3 = Object.getPrototypeOf && Object.getPrototypeOf(r2); - e3 = e3 && e3.setTimeout ? e3 : r2, i = "[object process]" === {}.toString.call(r2.process) ? function(e4) { - process.nextTick(function() { - c(e4); - }); - } : function() { - if (r2.postMessage && !r2.importScripts) { - var e4 = true, t3 = r2.onmessage; - return r2.onmessage = function() { - e4 = false; - }, r2.postMessage("", "*"), r2.onmessage = t3, e4; - } - }() ? (a = "setImmediate$" + Math.random() + "$", r2.addEventListener ? r2.addEventListener("message", d, false) : r2.attachEvent("onmessage", d), function(e4) { - r2.postMessage(a + e4, "*"); - }) : r2.MessageChannel ? ((t2 = new MessageChannel()).port1.onmessage = function(e4) { - c(e4.data); - }, function(e4) { - t2.port2.postMessage(e4); - }) : l && "onreadystatechange" in l.createElement("script") ? (s = l.documentElement, function(e4) { - var t3 = l.createElement("script"); - t3.onreadystatechange = function() { - c(e4), t3.onreadystatechange = null, s.removeChild(t3), t3 = null; - }, s.appendChild(t3); - }) : function(e4) { - setTimeout(c, 0, e4); - }, e3.setImmediate = function(e4) { - "function" != typeof e4 && (e4 = new Function("" + e4)); - for (var t3 = new Array(arguments.length - 1), r3 = 0; r3 < t3.length; r3++) - t3[r3] = arguments[r3 + 1]; - var n2 = { callback: e4, args: t3 }; - return h[o] = n2, i(o), o++; - }, e3.clearImmediate = f; - } - function f(e4) { - delete h[e4]; - } - function c(e4) { - if (u) - setTimeout(c, 0, e4); - else { - var t3 = h[e4]; - if (t3) { - u = true; - try { - !function(e5) { - var t4 = e5.callback, r3 = e5.args; - switch (r3.length) { - case 0: - t4(); - break; - case 1: - t4(r3[0]); - break; - case 2: - t4(r3[0], r3[1]); - break; - case 3: - t4(r3[0], r3[1], r3[2]); - break; - default: - t4.apply(n, r3); - } - }(t3); - } finally { - f(e4), u = false; - } - } - } - } - function d(e4) { - e4.source === r2 && "string" == typeof e4.data && 0 === e4.data.indexOf(a) && c(+e4.data.slice(a.length)); - } - }("undefined" == typeof self ? void 0 === e2 ? this : e2 : self); - }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}); - }, {}] }, {}, [10])(10); - }); - } - }); - - // ../components/smart-camera-web.js - var VERSION = "1.0.2"; - var DEFAULT_NO_OF_LIVENESS_FRAMES = 8; - var PORTRAIT_ID_PREVIEW_WIDTH = 396; - var PORTRAIT_ID_PREVIEW_HEIGHT = 527; - function isSamsungMultiCameraDevice() { - const matchedModelNumber = navigator.userAgent.match(/SM-[N|G]\d{3}/); - if (!matchedModelNumber) { - return false; - } - const modelNumber = parseInt(matchedModelNumber[0].match(/\d{3}/)[0], 10); - const smallerModelNumber = 970; - return !Number.isNaN(modelNumber) && modelNumber >= smallerModelNumber; - } - function getLivenessFramesIndices(totalNoOfFrames, numberOfFramesRequired = DEFAULT_NO_OF_LIVENESS_FRAMES) { - const selectedFrames = []; - if (totalNoOfFrames < numberOfFramesRequired) { - throw new Error("SmartCameraWeb: Minimum required no of frames is ", numberOfFramesRequired); - } - const frameDivisor = numberOfFramesRequired - 1; - const frameInterval = Math.floor(totalNoOfFrames / frameDivisor); - let replacementFrameIndex = 1; - for (let i = 0; i < totalNoOfFrames; i += frameInterval) { - if (selectedFrames.length < 8) { - selectedFrames.push(i); - } else { - selectedFrames[replacementFrameIndex] = i; - selectedFrames.sort((a, b) => a - b); - replacementFrameIndex += 1; - } - } - const lastFrameIndex = totalNoOfFrames - 1; - if (selectedFrames.length < 8 && !selectedFrames.includes(lastFrameIndex)) { - selectedFrames.push(lastFrameIndex); - } - return selectedFrames; - } - var SmartFileUpload = class _SmartFileUpload { - static memoryLimit = 1024e4; - static supportedTypes = ["image/jpeg", "image/png"]; - static getHumanSize(numberOfBytes) { - const units = [ - "B", - "kB", - "MB", - "GB", - "TB", - "PB", - "EB", - "ZB", - "YB" - ]; - const exponent = Math.min( - Math.floor(Math.log(numberOfBytes) / Math.log(1024)), - units.length - 1 - ); - const approx = numberOfBytes / 1024 ** exponent; - const output = exponent === 0 ? `${numberOfBytes} bytes` : `${approx.toFixed(0)} ${units[exponent]}`; - return output; - } - static getData(file) { - return new Promise((resolve, reject) => { - const reader = new FileReader(); - reader.onload = (e) => { - resolve(e.target.result); - }; - reader.onerror = () => { - reject(new Error("An error occurred reading the file. Please check the file, and try again")); - }; - reader.readAsDataURL(file); - }); - } - static async retrieve(files) { - if (files.length > 1) { - throw new Error("Only one file upload is permitted at a time"); - } - const file = files[0]; - if (!_SmartFileUpload.supportedTypes.includes(file.type)) { - throw new Error("Unsupported file format. Please ensure that you are providing a JPG or PNG image"); - } - if (file.size > _SmartFileUpload.memoryLimit) { - throw new Error(`${file.name} is too large. Please ensure that the file is less than ${_SmartFileUpload.getHumanSize(_SmartFileUpload.memoryLimit)}.`); - } - const imageAsDataUrl = await _SmartFileUpload.getData(file); - return imageAsDataUrl; - } - }; - function scwTemplateString() { - return ` - - - - - - - - - - - - - - - -
-

-

-
- -
- ${this.showNavigation ? ` - - ` : ""} -
-

- We need access to your camera so that we can take selfie and proof-of-life images. -

- - - - ${this.hideAttribution ? "" : ` - - `} -
-
- - - - - - - - - - - - - - - - - - - - - - `; - } - var PoweredBySmileId = class extends HTMLElement { - constructor() { - super(); - const template = document.createElement("template"); - template.innerHTML = ` -

- - - - - - - - - - - - - - - - - - - -

- `; - this.attachShadow({ mode: "open" }).appendChild(template.content.cloneNode(true)); - } - }; - function hasMoreThanNColors(data, n = 16) { - const colors = /* @__PURE__ */ new Set(); - for (let i = 0; i < Math.min(data.length, 1e4); i += 4) { - colors.add(data[i] << 16 | data[i + 1] << 8 | data[i + 2]); - if (colors.size > n) { - return true; - } - } - return false; - } - window.customElements.define("powered-by-smile-id", PoweredBySmileId); - var SmartCameraWeb = class extends HTMLElement { - constructor() { - super(); - this.scwTemplateString = scwTemplateString.bind(this); - this.render = () => this.scwTemplateString(); - this.attachShadow({ mode: "open" }); - this.activeScreen = null; - } - setActiveScreen(element) { - this.activeScreen.hidden = true; - element.hidden = false; - this.activeScreen = element; - } - connectedCallback() { - this.shadowRoot.innerHTML = this.render(); - if ("mediaDevices" in navigator && "getUserMedia" in navigator.mediaDevices) { - this.setUpEventListeners(); - } else { - const heading = document.createElement("h1"); - heading.classList.add("error-message"); - heading.textContent = "Your browser does not support this integration"; - this.shadowRoot.innerHTML = heading; - } - } - disconnectedCallback() { - if (this.activeScreen) { - this.activeScreen.hidden = true; - } - this.activeScreen = null; - this.shadowRoot.innerHTML = ""; - } - static get observedAttributes() { - return ["document-capture-modes", "document-type", "hide-back-to-host", "show-navigation"]; - } - attributeChangedCallback(name) { - switch (name) { - case "document-capture-modes": - case "document-type": - case "hide-back-to-host": - case "show-navigation": - this.shadowRoot.innerHTML = this.render(); - this.setUpEventListeners(); - break; - default: - break; - } - } - setUpEventListeners() { - this.errorMessage = this.shadowRoot.querySelector("#error"); - this.requestScreen = this.shadowRoot.querySelector("#request-screen"); - this.activeScreen = this.requestScreen; - this.cameraScreen = this.shadowRoot.querySelector("#camera-screen"); - this.failedImageTestScreen = this.shadowRoot.querySelector("#failed-image-test-screen"); - this.reviewScreen = this.shadowRoot.querySelector("#review-screen"); - this.idEntryScreen = this.shadowRoot.querySelector("#id-entry-screen"); - this.IDCameraScreen = this.shadowRoot.querySelector("#id-camera-screen"); - this.IDReviewScreen = this.shadowRoot.querySelector("#id-review-screen"); - this.backOfIdEntryScreen = this.shadowRoot.querySelector("#back-of-id-entry-screen"); - this.backOfIDCameraScreen = this.shadowRoot.querySelector("#back-of-id-camera-screen"); - this.backOfIDReviewScreen = this.shadowRoot.querySelector("#back-of-id-review-screen"); - this.thanksScreen = this.shadowRoot.querySelector("#thanks-screen"); - this.videoContainer = this.shadowRoot.querySelector(".video-container > .video"); - this.smileCTA = this.shadowRoot.querySelector("#smile-cta"); - this.imageOutline = this.shadowRoot.querySelector("#image-outline path"); - this.startImageCapture = this.shadowRoot.querySelector("#start-image-capture"); - this.captureIDImage = this.shadowRoot.querySelector("#capture-id-image"); - this.captureBackOfIDImage = this.shadowRoot.querySelector("#capture-back-of-id-image"); - this.reviewImage = this.shadowRoot.querySelector("#review-image"); - this.IDReviewImage = this.shadowRoot.querySelector("#id-review-image"); - this.backOfIDReviewImage = this.shadowRoot.querySelector("#back-of-id-review-image"); - this.reStartImageCapture = this.shadowRoot.querySelector("#restart-image-capture"); - this.reCaptureIDImage = this.shadowRoot.querySelector("#re-capture-id-image"); - this.reCaptureBackOfIDImage = this.shadowRoot.querySelector("#re-capture-back-of-id-image"); - this.selectSelfie = this.shadowRoot.querySelector("#select-selfie"); - this.selectIDImage = this.shadowRoot.querySelector("#select-id-image"); - this.selectBackOfIDImage = this.shadowRoot.querySelector("#select-back-of-id-image"); - this.takeDocumentPhotoButton = this.idEntryScreen.querySelector("#take-photo"); - this.uploadDocumentPhotoButton = this.idEntryScreen.querySelector("#upload-photo"); - this.skipBackOfDocumentPhotoButton = this.backOfIdEntryScreen.querySelector("#skip-this-step"); - this.takeBackOfDocumentPhotoButton = this.backOfIdEntryScreen.querySelector("#take-photo"); - this.uploadBackOfDocumentPhotoButton = this.backOfIdEntryScreen.querySelector("#upload-photo"); - this.shadowRoot.querySelector("#request-camera-access").addEventListener("click", () => this.init()); - if (this.showNavigation) { - const backButtons = this.shadowRoot.querySelectorAll(".back-button-exit"); - backButtons.forEach((button) => { - button.addEventListener("click", () => { - this._backAndExit(); - }); - }); - const closeButtons = this.shadowRoot.querySelectorAll(".close-iframe"); - closeButtons.forEach((button) => { - button.addEventListener("click", () => { - this._exitSmartCamera(); - }); - }); - } - if (this.takeDocumentPhotoButton) - this.takeDocumentPhotoButton.addEventListener("click", () => this._startIDCamera()); - if (this.skipBackOfDocumentPhotoButton) - this.skipBackOfDocumentPhotoButton.addEventListener("click", () => this._skipBackDocument()); - if (this.takeBackOfDocumentPhotoButton) - this.takeBackOfDocumentPhotoButton.addEventListener("click", () => this._startIDCamera()); - if (this.uploadDocumentPhotoButton) - this.uploadDocumentPhotoButton.addEventListener("change", (e) => this._uploadDocument(e)); - if (this.uploadBackOfDocumentPhotoButton) - this.uploadBackOfDocumentPhotoButton.addEventListener("change", (e) => this._uploadDocument(e)); - this.backToSelfie = this.shadowRoot.querySelector("#back-button-selfie"); - this.backToIdEntryButton = this.shadowRoot.querySelector("#back-button-id-entry"); - this.backToBackIdEntryButton = this.shadowRoot.querySelector("#back-button-back-id-entry"); - this.backToIdImageButton = this.shadowRoot.querySelector("#back-button-id-image"); - if (this.backToSelfie) { - this.backToSelfie.addEventListener("click", () => { - this._reStartImageCapture(); - }); - } - if (this.backToIdEntryButton) { - this.backToIdEntryButton.addEventListener("click", () => { - this.setActiveScreen(this.idEntryScreen); - }); - } - if (this.backToBackIdEntryButton) { - this.backToBackIdEntryButton.addEventListener("click", () => { - this.setActiveScreen(this.backOfIdEntryScreen); - }); - } - if (this.backToIdImageButton) { - this.backToIdImageButton.addEventListener("click", () => { - this.setActiveScreen(this.IDReviewScreen); - }); - } - this.startImageCapture.addEventListener("click", () => { - this._startImageCapture(); - }); - this.selectSelfie.addEventListener("click", () => { - this._selectSelfie(); - }); - this.selectIDImage.addEventListener("click", () => { - this._selectIDImage(); - }); - this.selectBackOfIDImage.addEventListener("click", () => { - this._selectIDImage(true); - }); - this.captureIDImage.addEventListener("click", () => { - this._captureIDImage(); - }); - this.captureBackOfIDImage.addEventListener("click", () => { - this._captureIDImage(); - }); - this.reStartImageCapture.addEventListener("click", () => { - this._reStartImageCapture(); - }); - this.reCaptureIDImage.addEventListener("click", () => { - this._reCaptureIDImage(); - }); - this.reCaptureBackOfIDImage.addEventListener("click", () => { - this._reCaptureIDImage(); - }); - } - init() { - this._videoStreamDurationInMS = 7800; - this._imageCaptureIntervalInMS = 200; - this._data = { - images: [], - partner_params: { - libraryVersion: VERSION, - permissionGranted: false - } - }; - this._rawImages = []; - navigator.mediaDevices.getUserMedia({ audio: false, video: true }).then((stream) => { - this.handleSuccess(stream); - }).catch((e) => { - this.handleError(e); - }); - } - reset() { - this.disconnectedCallback(); - this.connectedCallback(); - } - resetErrorMessage() { - this.errorMessage.textContent = ""; - } - handleSuccess(stream) { - const videoExists = !!this.videoContainer.querySelector("video"); - const video = videoExists ? this.videoContainer.querySelector("video") : document.createElement("video"); - video.autoplay = true; - video.playsInline = true; - video.muted = true; - if ("srcObject" in video) { - video.srcObject = stream; - } else { - video.src = window.URL.createObjectURL(stream); - } - video.play(); - if (!videoExists) - this.videoContainer.prepend(video); - this._data.partner_params.permissionGranted = true; - this.setActiveScreen(this.cameraScreen); - this._stream = stream; - this._video = video; - } - handleIDStream(stream) { - const videoExists = this.activeScreen === this.IDCameraScreen ? !!this.IDCameraScreen.querySelector("video") : !!this.backOfIDCameraScreen.querySelector("video"); - let video = null; - if (videoExists) { - if (this.activeScreen === this.IDCameraScreen) { - video = this.IDCameraScreen.querySelector("video"); - } else { - video = this.backOfIDCameraScreen.querySelector("video"); - } - } else { - video = document.createElement("video"); - } - video.autoplay = true; - video.playsInline = true; - video.muted = true; - if ("srcObject" in video) { - video.srcObject = stream; - } else { - video.src = window.URL.createObjectURL(stream); - } - video.play(); - const videoContainer = this.activeScreen === this.IDCameraScreen ? this.IDCameraScreen.querySelector(".id-video-container") : this.backOfIDCameraScreen.querySelector(".id-video-container"); - video.onloadedmetadata = () => { - videoContainer.querySelector(".actions").hidden = false; - }; - if (!videoExists) { - videoContainer.prepend(video); - } - this._IDStream = stream; - this._IDVideo = video; - } - handleError(e) { - switch (e.name) { - case "NotAllowedError": - case "SecurityError": - this.errorMessage.textContent = ` - Looks like camera access was not granted, or was blocked by a browser - level setting / extension. Please follow the prompt from the URL bar, - or extensions, and enable access. - You may need to refresh to start all over again - `; - break; - case "AbortError": - this.errorMessage.textContent = ` - Oops! Something happened, and we lost access to your stream. - Please refresh to start all over again - `; - break; - case "NotReadableError": - this.errorMessage.textContent = ` - There seems to be a problem with your device's camera, or its connection. - Please check this, and when resolved, try again. Or try another device. - `; - break; - case "NotFoundError": - this.errorMessage.textContent = ` - We are unable to find a video stream. - You may need to refresh to start all over again - `; - break; - case "TypeError": - this.errorMessage.textContent = ` - This site is insecure, and as such cannot have access to your camera. - Try to navigate to a secure version of this page, or contact the owner. - `; - break; - default: - this.errorMessage.textContent = e.message; - } - } - _startImageCapture() { - this.startImageCapture.disabled = true; - const imageOutlineLength = this.imageOutline.getTotalLength(); - this.imageOutline.style.transition = "none"; - this.imageOutline.style.strokeDasharray = `${imageOutlineLength} ${imageOutlineLength}`; - this.imageOutline.style.strokeDashoffset = imageOutlineLength; - this.imageOutline.getBoundingClientRect(); - this.imageOutline.style.transition = `stroke-dashoffset ${this._videoStreamDurationInMS / 1e3}s ease-in-out`; - this.imageOutline.style.strokeDashoffset = "0"; - this.smileCTA.style.animation = `fadeInOut ease ${this._videoStreamDurationInMS / 1e3}s`; - this._imageCaptureInterval = setInterval(() => { - this._capturePOLPhoto(); - }, this._imageCaptureIntervalInMS); - this._videoStreamTimeout = setTimeout(() => { - this._stopVideoStream(this._stream); - }, this._videoStreamDurationInMS); - } - _captureIDImage() { - const image = this._drawIDImage(); - if (this.activeScreen === this.IDCameraScreen) { - this.IDReviewImage.src = image; - } else { - this.backOfIDReviewImage.src = image; - } - this._data.images.push({ - image: image.split(",")[1], - image_type_id: this.activeScreen === this.IDCameraScreen ? 3 : 7 - }); - this._stopIDVideoStream(); - if (this.activeScreen === this.IDCameraScreen) { - this.setActiveScreen(this.IDReviewScreen); - } else { - this.setActiveScreen(this.backOfIDReviewScreen); - } - } - _drawImage(canvas, enableImageTests = true, video = this._video) { - this.resetErrorMessage(); - const context = canvas.getContext("2d"); - context.drawImage( - video, - 0, - 0, - video.videoWidth, - video.videoHeight, - 0, - 0, - canvas.width, - canvas.height - ); - if (enableImageTests) { - const imageData = context.getImageData(0, 0, canvas.width, canvas.height); - const hasEnoughColors = hasMoreThanNColors(imageData.data); - if (hasEnoughColors) { - return context; - } - throw new Error("Unable to capture webcam images - Please try another device"); - } else { - return context; - } - } - _capturePOLPhoto() { - const canvas = document.createElement("canvas"); - canvas.width = 240; - canvas.height = canvas.width * this._video.videoHeight / this._video.videoWidth; - this._drawImage(canvas, false); - this._rawImages.push(canvas.toDataURL("image/jpeg")); - } - _captureReferencePhoto() { - const canvas = document.createElement("canvas"); - canvas.width = 480; - canvas.height = canvas.width * this._video.videoHeight / this._video.videoWidth; - this._drawImage(canvas, !this.disableImageTests); - const image = canvas.toDataURL("image/jpeg"); - this._referenceImage = image; - this._data.images.push({ - image: image.split(",")[1], - image_type_id: 2 - }); - } - _skipBackDocument() { - this._publishSelectedImages(); - } - async _uploadDocument(event) { - this.resetErrorMessage(); - try { - const { files } = event.target; - const fileData = await SmartFileUpload.retrieve(files); - this._data.images.push({ - // NOTE: data URLs start with a file type before the base64 data, - // separated by a comma. - // - // we are only interested in the base64 segment, so we extract it - image: fileData.split(",")[1], - image_type_id: this.activeScreen === this.idEntryScreen ? 3 : 7 - }); - const nextScreen = this.activeScreen === this.idEntryScreen ? this.IDReviewScreen : this.backOfIDReviewScreen; - const previewImage = nextScreen.querySelector("img"); - previewImage.src = fileData; - this.setActiveScreen(nextScreen); - } catch (error) { - this.handleError(error); - } - } - _drawIDImage(video = this._IDVideo) { - const canvas = document.createElement("canvas"); - if (this.isPortraitCaptureView) { - canvas.width = video.videoWidth; - canvas.height = video.videoHeight; - const ctx = canvas.getContext("2d"); - ctx.drawImage(video, 0, 0, canvas.width, canvas.height); - const previewWidth = PORTRAIT_ID_PREVIEW_WIDTH; - const previewHeight = PORTRAIT_ID_PREVIEW_HEIGHT; - const paddingPercent = 0.5; - const paddedWidth = previewWidth * (1 + paddingPercent); - const paddedHeight = previewHeight * (1 + paddingPercent); - const cropWidth = paddedWidth; - const cropHeight = paddedHeight; - const cropLeft = (canvas.width - cropWidth) / 2; - const cropTop = (canvas.height - cropHeight) / 2; - const croppedCanvas = document.createElement("canvas"); - croppedCanvas.width = cropWidth; - croppedCanvas.height = cropHeight; - const croppedCtx = croppedCanvas.getContext("2d"); - croppedCtx.drawImage(canvas, cropLeft, cropTop, cropWidth, cropHeight, 0, 0, cropWidth, cropHeight); - return croppedCanvas.toDataURL("image/jpeg"); - } - canvas.width = 2240; - canvas.height = 1260; - const context = canvas.getContext("2d"); - const aspectRatio = video.videoWidth / video.videoHeight; - if (aspectRatio < 1) { - const imageFrame = this.activeScreen.querySelector('[class*="image-frame"]:not([hidden]) [href*="image-frame"]'); - const videoBox = video.getBoundingClientRect(); - const frameBox = imageFrame.getBoundingClientRect(); - const sourceXOffset = (frameBox.left - videoBox.left) / videoBox.width * video.videoWidth; - const sourceYOffset = (frameBox.top - videoBox.top) / videoBox.height * video.videoHeight; - const sourceWidth = frameBox.width * (video.videoWidth / videoBox.width); - const sourceHeight = frameBox.height * (video.videoHeight / videoBox.height); - canvas.height = canvas.width * frameBox.height / frameBox.width; - context.drawImage(video, sourceXOffset, sourceYOffset, sourceWidth, sourceHeight, 0, 0, canvas.width, canvas.height); - return canvas.toDataURL("image/jpeg"); - } - context.drawImage(video, 0, 0, canvas.width, canvas.height); - return canvas.toDataURL("image/jpeg"); - } - _stopVideoStream(stream) { - try { - clearTimeout(this._videoStreamTimeout); - clearInterval(this._imageCaptureInterval); - clearInterval(this._drawingInterval); - this.smileCTA.style.animation = "none"; - this._capturePOLPhoto(); - this._captureReferencePhoto(); - stream.getTracks().forEach((track) => track.stop()); - this.reviewImage.src = this._referenceImage; - const totalNoOfFrames = this._rawImages.length; - const livenessFramesIndices = getLivenessFramesIndices(totalNoOfFrames); - this._data.images = this._data.images.concat(livenessFramesIndices.map((imageIndex) => ({ - image: this._rawImages[imageIndex].split(",")[1], - image_type_id: 6 - }))); - this.setActiveScreen(this.reviewScreen); - } catch (error) { - this.setActiveScreen(this.failedImageTestScreen); - } - } - _stopIDVideoStream(stream = this._IDStream) { - stream.getTracks().forEach((track) => track.stop()); - } - async _startIDCamera() { - try { - const stream = await navigator.mediaDevices.getUserMedia({ - audio: false, - video: { - facingMode: "environment", - width: { min: 1280 }, - // NOTE: Special case for multi-camera Samsung devices (learnt from Acuant) - // "We found out that some triple camera Samsung devices (S10, S20, Note 20, etc) capture images blurry at edges. - // Zooming to 2X, matching the telephoto lens, doesn't solve it completely but mitigates it." - zoom: isSamsungMultiCameraDevice() ? 2 : 1 - } - }); - if (this.activeScreen === this.idEntryScreen) { - this.setActiveScreen(this.IDCameraScreen); - } else if (this.activeScreen === this.backOfIdEntryScreen) { - this.setActiveScreen(this.backOfIDCameraScreen); - } - this.handleIDStream(stream); - } catch (e) { - this.handleError(e); - } - } - _selectSelfie() { - if (!this.captureID) { - this._publishSelectedImages(); - } else { - this.setActiveScreen(this.idEntryScreen); - } - } - _selectIDImage(backOfIDCaptured = false) { - if (!this.captureBackOfID || backOfIDCaptured) { - this._publishSelectedImages(); - } else { - this.setActiveScreen(this.backOfIdEntryScreen); - } - } - _publishSelectedImages() { - this.dispatchEvent( - new CustomEvent("imagesComputed", { detail: this._data }) - ); - this.setActiveScreen(this.thanksScreen); - } - _exitSmartCamera() { - this.dispatchEvent( - new CustomEvent("close", { detail: {} }) - ); - } - _backAndExit() { - this.dispatchEvent( - new CustomEvent("backExit", { detail: {} }) - ); - } - async _reStartImageCapture() { - this.startImageCapture.disabled = false; - this._rawImages = []; - this._data.images = []; - try { - const stream = await navigator.mediaDevices.getUserMedia({ - audio: false, - video: true - }); - this.handleSuccess(stream); - } catch (e) { - this.handleError(e); - } - } - async _reCaptureIDImage() { - const previousScreen = this.activeScreen === this.IDReviewScreen ? this.idEntryScreen : this.backOfIdEntryScreen; - this.setActiveScreen(previousScreen); - this._data.images.pop(); - } - get captureID() { - return this.hasAttribute("capture-id"); - } - get captureBackOfID() { - return this.getAttribute("capture-id") === "back" || false; - } - get hideAttribution() { - return this.hasAttribute("hide-attribution"); - } - get showNavigation() { - return this.hasAttribute("show-navigation"); - } - get hideBackToHost() { - return this.hasAttribute("hide-back-to-host"); - } - get documentType() { - return this.getAttribute("document-type"); - } - get isPortraitCaptureView() { - return this.getAttribute("document-type") === "GREEN_BOOK"; - } - get documentCaptureModes() { - return this.getAttribute("document-capture-modes") || "camera"; - } - get supportBothCaptureModes() { - const value = this.documentCaptureModes; - return value.includes("camera") && value.includes("upload"); - } - get disableImageTests() { - return this.hasAttribute("disable-image-tests"); - } - get doNotUpload() { - return this.getAttribute("document-capture-modes") === "camera"; - } - }; - window.customElements.define("smart-camera-web", SmartCameraWeb); - - // src/js/enhanced-document-verification.js - var import_jszip = __toESM(require_jszip_min(), 1); - - // package.json - var version = "v1.2.3"; - - // src/js/enhanced-document-verification.js - (function enhancedDocumentVerification() { - "use strict"; - const endpoints = { - sandbox: "https://testapi.smileidentity.com/v1", - live: "https://api.smileidentity.com/v1", - production: "https://api.smileidentity.com/v1" - }; - const referenceWindow = window.parent; - referenceWindow.postMessage("SmileIdentity::ChildPageReady", "*"); - let config; - let activeScreen; - let id_info; - let images; - let partner_params; - let productConstraints; - const LoadingScreen = document.querySelector("#loading-screen"); - const SelectIDType = document.querySelector("#select-id-type"); - const SmartCameraWeb2 = document.querySelector("smart-camera-web"); - const UploadProgressScreen = document.querySelector( - "#upload-progress-screen" - ); - const UploadFailureScreen = document.querySelector("#upload-failure-screen"); - const CompleteScreen = document.querySelector("#complete-screen"); - const CloseIframeButtons = document.querySelectorAll(".close-iframe"); - const RetryUploadButton = document.querySelector("#retry-upload"); - let fileToUpload; - let uploadURL; - async function getProductConstraints() { - try { - const response = await fetch(`${endpoints[config.environment]}/services`); - const json = await response.json(); - return json.hosted_web.enhanced_document_verification; - } catch (e) { - throw new Error("Failed to get supported ID types", { cause: e }); - } - } - window.addEventListener( - "message", - async (event) => { - if (event.data && event.data.includes("SmileIdentity::Configuration")) { - config = JSON.parse(event.data); - activeScreen = LoadingScreen; - productConstraints = await getProductConstraints(); - initializeSession(productConstraints); - getPartnerParams(); - } - }, - false - ); - function initializeSession(constraints) { - const supportedCountries = Object.keys(constraints).map((countryCode) => ({ - code: countryCode, - name: constraints[countryCode].name - })).sort((a, b) => { - if (a.name < b.name) { - return -1; - } - if (a.name > b.name) { - return 1; - } - return 0; - }).map((item) => item.code); - let validCountries = []; - if (config.id_selection) { - const selectedCountryList = Object.keys(config.id_selection); - validCountries = supportedCountries.filter( - (value) => selectedCountryList.includes(value) - ); - if (validCountries.length === 1) { - const selectedCountry = validCountries[0]; - id_info = { - country: validCountries[0] - }; - const idTypes = config.id_selection[selectedCountry]; - if (idTypes.length === 1 || typeof idTypes === "string") { - id_info.id_type = Array.isArray(idTypes) ? idTypes[0] : idTypes; - SmartCameraWeb2.setAttribute("document-type", id_info.id_type); - if (config.document_capture_modes) { - SmartCameraWeb2.setAttribute( - "document-capture-modes", - config.document_capture_modes.join(",") - ); - } - SmartCameraWeb2.setAttribute("hide-back-to-host", true); - setActiveScreen(SmartCameraWeb2); - } - } - } else { - validCountries = supportedCountries; - } - if (!id_info || !id_info.id_type) { - const selectCountry = SelectIDType.querySelector("#country"); - const selectIDType = SelectIDType.querySelector("#id_type"); - const hostedWebConfigForm = document.querySelector( - 'form[name="hosted-web-config"]' - ); - selectCountry.disabled = false; - setActiveScreen(SelectIDType); - const loadIdTypes = (countryCode) => { - if (countryCode) { - const constrainedIDTypes = Object.keys( - productConstraints[countryCode].id_types - ); - const validIDTypes = config.id_selection ? config.id_selection[countryCode] : constrainedIDTypes; - const selectedIDTypes = validIDTypes.filter( - (value) => constrainedIDTypes.includes(value) - ); - selectIDType.innerHTML = ""; - const initialOption = document.createElement("option"); - initialOption.setAttribute("value", ""); - initialOption.textContent = "--Please Select--"; - selectIDType.appendChild(initialOption); - selectedIDTypes.forEach((IDType) => { - const option = document.createElement("option"); - option.setAttribute("value", IDType); - option.textContent = productConstraints[countryCode].id_types[IDType].label; - selectIDType.appendChild(option); - }); - selectIDType.disabled = false; - } else { - selectIDType.innerHTML = ""; - const option = document.createElement("option"); - option.disabled = true; - option.setAttribute("value", ""); - option.textContent = "--Select Country First--"; - selectIDType.appendChild(option); - } - }; - validCountries.forEach((country) => { - const countryObject = productConstraints[country]; - if (countryObject) { - const option = document.createElement("option"); - option.setAttribute("value", country); - option.textContent = constraints[country].name; - if (id_info && id_info.country && country === id_info.country) { - option.setAttribute("selected", true); - selectCountry.value = country; - selectCountry.disabled = true; - loadIdTypes(country); - } - selectCountry.appendChild(option); - } - }); - selectCountry.addEventListener("change", (e) => { - loadIdTypes(e.target.value); - }); - hostedWebConfigForm.addEventListener("submit", (e) => { - e.preventDefault(); - const selectedCountry = selectCountry.value; - const selectedIDType = selectIDType.value; - id_info = { - country: selectedCountry, - id_type: selectedIDType - }; - SmartCameraWeb2.setAttribute("document-type", selectedIDType); - if (config.document_capture_modes) { - SmartCameraWeb2.setAttribute( - "document-capture-modes", - config.document_capture_modes.join(",") - ); - } - setActiveScreen(SmartCameraWeb2); - }); - } - } - function initiateDemoMode() { - const demoTips = document.querySelectorAll(".demo-tip"); - Array.prototype.forEach.call(demoTips, (tip) => { - tip.hidden = false; - }); - const script = document.createElement("script"); - script.type = "text/javascript"; - script.src = "js/demo-doc-verification.min.js"; - document.body.appendChild(script); - } - SmartCameraWeb2.addEventListener( - "imagesComputed", - (event) => { - images = event.detail.images; - setActiveScreen(UploadProgressScreen); - handleFormSubmit(event); - }, - false - ); - SmartCameraWeb2.addEventListener( - "backExit", - () => { - setActiveScreen(SelectIDType); - }, - false - ); - SmartCameraWeb2.addEventListener( - "close", - () => { - closeWindow(); - }, - false - ); - RetryUploadButton.addEventListener( - "click", - () => { - retryUpload(); - }, - false - ); - CloseIframeButtons.forEach((button) => { - button.addEventListener( - "click", - () => { - closeWindow(); - }, - false - ); - }); - function getPartnerParams() { - function parseJWT(token) { - const base64Url = token.split(".")[1]; - const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/"); - const jsonPayload = decodeURIComponent( - atob(base64).split("").map(function(c) { - return `%${c.charCodeAt(0).toString(16)}`; - }).join("") - ); - return JSON.parse(jsonPayload); - } - const { partner_params: partnerParams } = parseJWT(config.token); - partner_params = { ...partnerParams, ...config.partner_params || {} }; - } - function setActiveScreen(node) { - activeScreen.hidden = true; - node.hidden = false; - activeScreen = node; - } - async function handleFormSubmit(event) { - event.preventDefault(); - try { - [uploadURL, fileToUpload] = await Promise.all([ - getUploadURL(), - createZip() - ]); - uploadZip(fileToUpload, uploadURL); - } catch (error) { - displayErrorMessage("Something went wrong"); - console.error( - `SmileIdentity - ${error.name || error.message}: ${error.cause}` - ); - } - } - function displayErrorMessage(message) { - const p = document.createElement("p"); - p.textContent = message; - p.style.color = "red"; - p.style.fontSize = "1.5rem"; - p.style.textAlign = "center"; - const main = document.querySelector("main"); - main.prepend(p); - } - async function createZip() { - const zip = new import_jszip.default(); - zip.file( - "info.json", - JSON.stringify({ - package_information: { - language: "Hosted Web Integration", - apiVersion: { - buildNumber: 0, - majorVersion: 2, - minorVersion: 0 - } - }, - id_info, - images - }) - ); - try { - const zipFile = await zip.generateAsync({ type: "blob" }); - return zipFile; - } catch (error) { - throw new Error("createZip failed", { cause: error }); - } - } - async function getUploadURL() { - const payload = { - source_sdk: config.sdk || "hosted_web", - source_sdk_version: config.sdk_version || version, - file_name: `${config.product}.zip`, - smile_client_id: config.partner_details.partner_id, - callback_url: config.callback_url, - token: config.token, - partner_params: { - ...partner_params, - job_type: 11 - } - }; - const fetchConfig = { - cache: "no-cache", - mode: "cors", - headers: { - Accept: "application/json", - "Content-Type": "application/json" - }, - method: "POST", - body: JSON.stringify(payload) - }; - const URL = `${endpoints[config.environment] || config.environment}/upload`; - try { - const response = await fetch(URL, fetchConfig); - const json = await response.json(); - if (json.error) - throw new Error(json.error); - return json.upload_url; - } catch (error) { - throw new Error("getUploadURL failed", { cause: error }); - } - } - function uploadZip(file, destination) { - const request = new XMLHttpRequest(); - request.open("PUT", destination); - request.upload.addEventListener("load", function() { - return request.response; - }); - request.upload.addEventListener("error", function(e) { - setActiveScreen(UploadFailureScreen); - throw new Error("uploadZip failed", { cause: e }); - }); - request.onreadystatechange = function() { - if (request.readyState === XMLHttpRequest.DONE && request.status === 200) { - setActiveScreen(CompleteScreen); - handleSuccess(); - window.setTimeout(closeWindow, 2e3); - } - if (request.readyState === XMLHttpRequest.DONE && request.status !== 200) { - setActiveScreen(UploadFailureScreen); - throw new Error("uploadZip failed", { cause: request }); - } - }; - request.setRequestHeader("Content-type", "application/zip"); - request.send(file); - } - function retryUpload() { - const fileUploaded = uploadZip(fileToUpload, uploadURL); - return fileUploaded; - } - function closeWindow() { - referenceWindow.postMessage("SmileIdentity::Close", "*"); - } - function handleSuccess() { - referenceWindow.postMessage("SmileIdentity::Success", "*"); - } - })(); -})(); -/*! Bundled license information: - -jszip/dist/jszip.min.js: - (*! - - JSZip v3.10.1 - A JavaScript class for generating and reading zip files - - - (c) 2009-2016 Stuart Knightley - Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. - - JSZip uses the library pako released under the MIT license : - https://github.com/nodeca/pako/blob/main/LICENSE - *) -*/ diff --git a/packages/embed/build/js/product-selection.min.js b/packages/embed/build/js/product-selection.min.js deleted file mode 100644 index dfbabd76..00000000 --- a/packages/embed/build/js/product-selection.min.js +++ /dev/null @@ -1,281 +0,0 @@ -(() => { - // src/js/product-selection.js - (function productSelection() { - "use strict"; - const endpoints = { - sandbox: "https://testapi.smileidentity.com/v1", - live: "https://api.smileidentity.com/v1", - production: "https://api.smileidentity.com/v1" - }; - const referenceWindow = window.parent; - referenceWindow.postMessage("SmileIdentity::ChildPageReady", "*"); - let config; - let verificationMethodMap; - let activeScreen; - const LoadingScreen = document.querySelector("#loading-screen"); - const SelectIdType = document.querySelector("#select-id-type"); - const ConfigForm = document.querySelector('form[name="hosted-web-config"]'); - const CloseIframeButtons = document.querySelectorAll(".close-iframe"); - CloseIframeButtons.forEach((button) => { - button.addEventListener( - "click", - () => { - closeWindow(); - }, - false - ); - }); - function setActiveScreen(element) { - activeScreen.hidden = true; - element.hidden = false; - activeScreen = element; - } - async function getProductConstraints() { - const payload = { - token: config.token, - partner_id: config.partner_details.partner_id - }; - const fetchConfig = { - cache: "no-cache", - mode: "cors", - headers: { - Accept: "application/json", - "Content-Type": "application/json" - }, - method: "POST", - body: JSON.stringify(payload) - }; - try { - const response = await fetch( - `${endpoints[config.environment]}/valid_documents`, - fetchConfig - ); - const json = await response.json(); - return json.valid_documents; - } catch (e) { - throw new Error("Failed to get supported ID types", { cause: e }); - } - } - async function getLegacyProductConstraints() { - const fetchConfig = { - cache: "no-cache", - mode: "cors", - headers: { - Accept: "application/json", - "Content-Type": "application/json" - }, - method: "GET" - }; - try { - const response = await fetch( - `${endpoints[config.environment]}/services`, - fetchConfig - ); - const json = await response.json(); - return json.hosted_web; - } catch (e) { - throw new Error("Failed to get supported ID types", { cause: e }); - } - } - function getIdTypeName(country, id_type, productConstraints, legacyProductConstraints) { - const validDocumentsCountry = productConstraints.find( - (item) => item.country.code === country - ); - if (!validDocumentsCountry) { - throw new Error(`SmileIdentity - ${country} is not supported`); - } - let validIdType = validDocumentsCountry.id_types.find( - (item) => item.code === id_type - ); - if (!validIdType) { - const legacyValidIdType = legacyProductConstraints.doc_verification[country].id_types[id_type] || legacyProductConstraints.enhanced_kyc[country].id_types[id_type]; - if (legacyValidIdType) { - validIdType = { - name: legacyValidIdType.label - }; - } - } - if (!validIdType) { - throw new Error(`SmileIdentity - ${country} ${id_type} is not supported`); - } - return validIdType.name; - } - function transformIdTypesToVerificationMethodMap(idTypes, productConstraints, legacyProductConstraints) { - return idTypes.reduce( - (idSelectionMap, { country, id_type, verification_method }) => { - idSelectionMap[country] = idSelectionMap[country] || { - name: productConstraints.find((item) => item.country.code === country)?.country?.name, - id_types: {} - }; - idSelectionMap[country].id_types[id_type] = { - name: getIdTypeName( - country, - id_type, - productConstraints, - legacyProductConstraints - ), - verification_method - }; - return idSelectionMap; - }, - {} - ); - } - function loadIdTypes(localVerificationMethodMap, idTypeSelector, countryCode) { - if (countryCode) { - idTypeSelector.innerHTML = ""; - const initialOption = document.createElement("option"); - initialOption.setAttribute("value", ""); - initialOption.textContent = "--Please Select--"; - idTypeSelector.appendChild(initialOption); - const idTypes = Object.keys( - localVerificationMethodMap[countryCode].id_types - ); - const isSingleIdType = idTypes.length === 1; - idTypes.forEach((idType) => { - const option = document.createElement("option"); - option.setAttribute("value", idType); - option.textContent = localVerificationMethodMap[countryCode].id_types[idType].name; - if (isSingleIdType) { - option.setAttribute("selected", true); - } - idTypeSelector.appendChild(option); - }); - idTypeSelector.disabled = false; - } else { - idTypeSelector.innerHTML = ""; - const option = document.createElement("option"); - option.disabled = true; - option.setAttribute("value", ""); - option.textContent = "--Select Country First--"; - idTypeSelector.appendChild(option); - } - } - function getVerificationMethod(country, id_type) { - return verificationMethodMap[country].id_types[id_type].verification_method; - } - function initializeForm(form, localVerificationMethodMap) { - const countrySelector = form.querySelector("#country"); - const idTypeSelector = form.querySelector("#id_type"); - countrySelector.addEventListener("change", (e) => { - loadIdTypes(localVerificationMethodMap, idTypeSelector, e.target.value); - }); - const countries = Object.keys(localVerificationMethodMap); - const isSingleCountry = countries.length === 1; - countries.forEach((countryCode) => { - const country = localVerificationMethodMap[countryCode]; - const option = document.createElement("option"); - option.setAttribute("value", countryCode); - option.textContent = country.name; - if (isSingleCountry) { - option.setAttribute("selected", true); - loadIdTypes(localVerificationMethodMap, idTypeSelector, countryCode); - } - countrySelector.appendChild(option); - }); - countrySelector.disabled = false; - setActiveScreen(form); - } - function getSiteURL() { - const urlParts = location.href.split("/"); - const url = urlParts.slice(0, -1).join("/"); - return `${url}/`; - } - function getIFrameURL(product) { - switch (product) { - case "biometric_kyc": - return "biometric-kyc.html"; - case "doc_verification": - return "doc-verification.html"; - case "enhanced_document_verification": - return "enhanced-document-verification.html"; - case "enhanced_kyc": - return "ekyc.html"; - default: - throw new Error("Unsupported product"); - } - } - function createIframe(productName) { - const iframe = document.createElement("iframe"); - iframe.setAttribute("src", `${getSiteURL()}${getIFrameURL(productName)}`); - iframe.setAttribute( - "id", - "smile-identity-hosted-web-integration-post-product-selection" - ); - iframe.setAttribute( - "name", - "smile-identity-hosted-web-integration-post-product-selection" - ); - iframe.setAttribute( - "data-cy", - "smile-identity-hosted-web-integration-post-product-selection" - ); - iframe.setAttribute("frameborder", "0"); - iframe.setAttribute( - "allow", - "camera; geolocation; encrypted-media; fullscreen" - ); - iframe.setAttribute("allowtransparency", "true"); - iframe.style.cssText = ` - background-color: #F9F0E7; - border: none; - height: 100%; - left: 0; - position: fixed; - top: 0; - width: 100%; - z-index: 999999; - `; - document.body.prepend(iframe); - } - function closeWindow() { - referenceWindow.postMessage("SmileIdentity::Close", "*"); - } - function publishMessage() { - const targetWindow = document.querySelector( - "[name='smile-identity-hosted-web-integration-post-product-selection']" - ).contentWindow; - config.source = "SmileIdentity::Configuration"; - targetWindow.postMessage(JSON.stringify(config), "*"); - } - function setProductPage(selectedCountry, selectedIdType) { - config.id_selection = {}; - config.id_selection[selectedCountry] = [selectedIdType]; - config.product = getVerificationMethod(selectedCountry, selectedIdType); - createIframe(config.product); - } - ConfigForm.addEventListener("submit", (e) => { - e.preventDefault(); - const selectedCountry = ConfigForm.querySelector("#country").value; - const selectedIdType = ConfigForm.querySelector("#id_type").value; - setProductPage(selectedCountry, selectedIdType); - }); - window.addEventListener( - "message", - async (event) => { - if (event.data) { - if (event.data.includes("SmileIdentity::Configuration")) { - config = JSON.parse(event.data); - activeScreen = LoadingScreen; - const constraintsPromises = [ - getProductConstraints(), - getLegacyProductConstraints() - ]; - const [productConstraints, legacyConstraints] = await Promise.all(constraintsPromises); - verificationMethodMap = transformIdTypesToVerificationMethodMap( - config.id_types, - productConstraints, - legacyConstraints - ); - initializeForm(SelectIdType, verificationMethodMap); - } else if (event.data.includes("SmileIdentity::ChildPageReady")) { - publishMessage(config); - } - } else { - referenceWindow.postMessage(event.detail || event.data, "*"); - } - }, - false - ); - })(); -})(); diff --git a/packages/embed/build/js/script.min.js b/packages/embed/build/js/script.min.js deleted file mode 100644 index fba73daa..00000000 --- a/packages/embed/build/js/script.min.js +++ /dev/null @@ -1,162 +0,0 @@ -(() => { - // src/js/script.js - window.SmileIdentity = function() { - "use strict"; - function getSiteURL() { - const currentScriptSrc = document.currentScript.src; - const qualifiedURL = currentScriptSrc.split("script")[0]; - return qualifiedURL; - } - const innerConfig = { - siteURL: getSiteURL() - }; - function getIFrameURL(product) { - switch (product) { - case "biometric_kyc": - case "ekyc_smartselfie": - return "./../biometric-kyc.html"; - case "enhanced_kyc": - return "./../ekyc.html"; - case "authentication": - case "smartselfie": - return "./../smartselfie-auth.html"; - case "doc_verification": - return "./../doc-verification.html"; - case "enhanced_document_verification": - return "./../enhanced-document-verification.html"; - case "basic_kyc": - case "identity_verification": - return "./../basic-kyc.html"; - case void 0: - return "./../product-selection.html"; - default: - throw new Error( - `SmileIdentity: ${product} is not currently supported in this integration` - ); - } - } - function createIframe(productName) { - const iframe = document.createElement("iframe"); - iframe.setAttribute( - "src", - `${innerConfig.siteURL}${getIFrameURL(productName)}` - ); - iframe.setAttribute("id", "smile-identity-hosted-web-integration"); - iframe.setAttribute("name", "smile-identity-hosted-web-integration"); - iframe.setAttribute("data-cy", "smile-identity-hosted-web-integration"); - iframe.setAttribute("frameborder", "0"); - iframe.setAttribute( - "allow", - "camera; geolocation; encrypted-media; fullscreen" - ); - iframe.setAttribute("allowtransparency", "true"); - iframe.style.cssText = ` - background-color: #F9F0E7; - border: none; - height: 100%; - left: 0; - position: fixed; - top: 0; - width: 100%; - z-index: 999999; - `; - document.body.prepend(iframe); - } - function closeIFrame(config, userTriggered) { - const iframe = document.querySelector( - "#smile-identity-hosted-web-integration" - ); - iframe.remove(); - if (config.onClose && userTriggered) { - config.onClose(); - } - } - function handleSuccess(config) { - if (config.onSuccess) { - config.onSuccess(); - } - } - function handleConsentRejection(config, error) { - if (config.onError) { - config.onError(error); - } - } - const requiredPartnerDetails = [ - "name", - "logo_url", - "partner_id", - "policy_url", - "theme_color" - ]; - function isConfigValid(config) { - if (!config.token) - throw new Error( - "SmileIdentity: Please provide your web token via the `token` attribute" - ); - if (!config.callback_url) - throw new Error( - "SmileIdentity: Please provide a callback URL via the `callback_url` attribute" - ); - if (!config.product && !config.id_types) - throw new Error( - "SmileIdentity: Please select a product via the `product` attribute." - ); - if ((config.product === "biometric_kyc" || config.product === "ekyc_smartselfie") && !config.partner_details) { - throw new Error( - "SmileIdentity: Please provide Partner Details via the `partner_details` attribute" - ); - } - if ((config.product === "biometric_kyc" || config.product === "ekyc_smartselfie") && config.partner_details) { - requiredPartnerDetails.forEach((param) => { - if (!config.partner_details[param]) { - throw new Error( - `SmileIdentity: Please include ${param} in the "partner_details" object` - ); - } - }); - } - if (config.document_capture_modes && !Array.isArray(config.document_capture_modes)) { - throw new Error( - "SmileIdentity: document_capture_modes must be an array containing one of `camera` or `upload`, or both" - ); - } - return true; - } - function publishConfigToIFrame(config) { - const targetWindow = document.querySelector( - "[name='smile-identity-hosted-web-integration']" - ).contentWindow; - config.source = "SmileIdentity::Configuration"; - targetWindow.postMessage(JSON.stringify(config), "*"); - } - function SmileIdentity(config) { - const configIsValid = isConfigValid(config); - if (configIsValid) { - createIframe(config.product); - window.addEventListener( - "message", - (event) => { - const tag = event.data.message || event.data; - switch (tag) { - case "SmileIdentity::ChildPageReady": - return publishConfigToIFrame(config); - case "SmileIdentity::Close": - return closeIFrame(config, true); - case "SmileIdentity::Close::System": - return closeIFrame(config, false); - case "SmileIdentity::Success": - return handleSuccess(config); - case "SmileIdentity::ConsentDenied": - case "SmileIdentity::ConsentDenied::TOTP::ContactMethodsOutdated": - return handleConsentRejection(config, event.data); - default: - return void 0; - } - }, - false - ); - } - } - return SmileIdentity; - }(); -})(); diff --git a/packages/embed/build/js/smartselfie-auth.min.js b/packages/embed/build/js/smartselfie-auth.min.js deleted file mode 100644 index 4192ea34..00000000 --- a/packages/embed/build/js/smartselfie-auth.min.js +++ /dev/null @@ -1,4693 +0,0 @@ -(() => { - var __create = Object.create; - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __getProtoOf = Object.getPrototypeOf; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { - get: (a, b) => (typeof require !== "undefined" ? require : a)[b] - }) : x)(function(x) { - if (typeof require !== "undefined") - return require.apply(this, arguments); - throw Error('Dynamic require of "' + x + '" is not supported'); - }); - var __commonJS = (cb, mod) => function __require2() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod - )); - - // ../../node_modules/jszip/dist/jszip.min.js - var require_jszip_min = __commonJS({ - "../../node_modules/jszip/dist/jszip.min.js"(exports, module) { - !function(e) { - if ("object" == typeof exports && "undefined" != typeof module) - module.exports = e(); - else if ("function" == typeof define && define.amd) - define([], e); - else { - ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).JSZip = e(); - } - }(function() { - return function s(a, o, h) { - function u(r, e2) { - if (!o[r]) { - if (!a[r]) { - var t = "function" == typeof __require && __require; - if (!e2 && t) - return t(r, true); - if (l) - return l(r, true); - var n = new Error("Cannot find module '" + r + "'"); - throw n.code = "MODULE_NOT_FOUND", n; - } - var i = o[r] = { exports: {} }; - a[r][0].call(i.exports, function(e3) { - var t2 = a[r][1][e3]; - return u(t2 || e3); - }, i, i.exports, s, a, o, h); - } - return o[r].exports; - } - for (var l = "function" == typeof __require && __require, e = 0; e < h.length; e++) - u(h[e]); - return u; - }({ 1: [function(e, t, r) { - "use strict"; - var d = e("./utils"), c = e("./support"), p = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - r.encode = function(e2) { - for (var t2, r2, n, i, s, a, o, h = [], u = 0, l = e2.length, f = l, c2 = "string" !== d.getTypeOf(e2); u < e2.length; ) - f = l - u, n = c2 ? (t2 = e2[u++], r2 = u < l ? e2[u++] : 0, u < l ? e2[u++] : 0) : (t2 = e2.charCodeAt(u++), r2 = u < l ? e2.charCodeAt(u++) : 0, u < l ? e2.charCodeAt(u++) : 0), i = t2 >> 2, s = (3 & t2) << 4 | r2 >> 4, a = 1 < f ? (15 & r2) << 2 | n >> 6 : 64, o = 2 < f ? 63 & n : 64, h.push(p.charAt(i) + p.charAt(s) + p.charAt(a) + p.charAt(o)); - return h.join(""); - }, r.decode = function(e2) { - var t2, r2, n, i, s, a, o = 0, h = 0, u = "data:"; - if (e2.substr(0, u.length) === u) - throw new Error("Invalid base64 input, it looks like a data url."); - var l, f = 3 * (e2 = e2.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4; - if (e2.charAt(e2.length - 1) === p.charAt(64) && f--, e2.charAt(e2.length - 2) === p.charAt(64) && f--, f % 1 != 0) - throw new Error("Invalid base64 input, bad content length."); - for (l = c.uint8array ? new Uint8Array(0 | f) : new Array(0 | f); o < e2.length; ) - t2 = p.indexOf(e2.charAt(o++)) << 2 | (i = p.indexOf(e2.charAt(o++))) >> 4, r2 = (15 & i) << 4 | (s = p.indexOf(e2.charAt(o++))) >> 2, n = (3 & s) << 6 | (a = p.indexOf(e2.charAt(o++))), l[h++] = t2, 64 !== s && (l[h++] = r2), 64 !== a && (l[h++] = n); - return l; - }; - }, { "./support": 30, "./utils": 32 }], 2: [function(e, t, r) { - "use strict"; - var n = e("./external"), i = e("./stream/DataWorker"), s = e("./stream/Crc32Probe"), a = e("./stream/DataLengthProbe"); - function o(e2, t2, r2, n2, i2) { - this.compressedSize = e2, this.uncompressedSize = t2, this.crc32 = r2, this.compression = n2, this.compressedContent = i2; - } - o.prototype = { getContentWorker: function() { - var e2 = new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")), t2 = this; - return e2.on("end", function() { - if (this.streamInfo.data_length !== t2.uncompressedSize) - throw new Error("Bug : uncompressed data size mismatch"); - }), e2; - }, getCompressedWorker: function() { - return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression); - } }, o.createWorkerFrom = function(e2, t2, r2) { - return e2.pipe(new s()).pipe(new a("uncompressedSize")).pipe(t2.compressWorker(r2)).pipe(new a("compressedSize")).withStreamInfo("compression", t2); - }, t.exports = o; - }, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function(e, t, r) { - "use strict"; - var n = e("./stream/GenericWorker"); - r.STORE = { magic: "\0\0", compressWorker: function() { - return new n("STORE compression"); - }, uncompressWorker: function() { - return new n("STORE decompression"); - } }, r.DEFLATE = e("./flate"); - }, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function(e, t, r) { - "use strict"; - var n = e("./utils"); - var o = function() { - for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) { - e2 = r2; - for (var n2 = 0; n2 < 8; n2++) - e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1; - t2[r2] = e2; - } - return t2; - }(); - t.exports = function(e2, t2) { - return void 0 !== e2 && e2.length ? "string" !== n.getTypeOf(e2) ? function(e3, t3, r2, n2) { - var i = o, s = n2 + r2; - e3 ^= -1; - for (var a = n2; a < s; a++) - e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3[a])]; - return -1 ^ e3; - }(0 | t2, e2, e2.length, 0) : function(e3, t3, r2, n2) { - var i = o, s = n2 + r2; - e3 ^= -1; - for (var a = n2; a < s; a++) - e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3.charCodeAt(a))]; - return -1 ^ e3; - }(0 | t2, e2, e2.length, 0) : 0; - }; - }, { "./utils": 32 }], 5: [function(e, t, r) { - "use strict"; - r.base64 = false, r.binary = false, r.dir = false, r.createFolders = true, r.date = null, r.compression = null, r.compressionOptions = null, r.comment = null, r.unixPermissions = null, r.dosPermissions = null; - }, {}], 6: [function(e, t, r) { - "use strict"; - var n = null; - n = "undefined" != typeof Promise ? Promise : e("lie"), t.exports = { Promise: n }; - }, { lie: 37 }], 7: [function(e, t, r) { - "use strict"; - var n = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array, i = e("pako"), s = e("./utils"), a = e("./stream/GenericWorker"), o = n ? "uint8array" : "array"; - function h(e2, t2) { - a.call(this, "FlateWorker/" + e2), this._pako = null, this._pakoAction = e2, this._pakoOptions = t2, this.meta = {}; - } - r.magic = "\b\0", s.inherits(h, a), h.prototype.processChunk = function(e2) { - this.meta = e2.meta, null === this._pako && this._createPako(), this._pako.push(s.transformTo(o, e2.data), false); - }, h.prototype.flush = function() { - a.prototype.flush.call(this), null === this._pako && this._createPako(), this._pako.push([], true); - }, h.prototype.cleanUp = function() { - a.prototype.cleanUp.call(this), this._pako = null; - }, h.prototype._createPako = function() { - this._pako = new i[this._pakoAction]({ raw: true, level: this._pakoOptions.level || -1 }); - var t2 = this; - this._pako.onData = function(e2) { - t2.push({ data: e2, meta: t2.meta }); - }; - }, r.compressWorker = function(e2) { - return new h("Deflate", e2); - }, r.uncompressWorker = function() { - return new h("Inflate", {}); - }; - }, { "./stream/GenericWorker": 28, "./utils": 32, pako: 38 }], 8: [function(e, t, r) { - "use strict"; - function A(e2, t2) { - var r2, n2 = ""; - for (r2 = 0; r2 < t2; r2++) - n2 += String.fromCharCode(255 & e2), e2 >>>= 8; - return n2; - } - function n(e2, t2, r2, n2, i2, s2) { - var a, o, h = e2.file, u = e2.compression, l = s2 !== O.utf8encode, f = I.transformTo("string", s2(h.name)), c = I.transformTo("string", O.utf8encode(h.name)), d = h.comment, p = I.transformTo("string", s2(d)), m = I.transformTo("string", O.utf8encode(d)), _ = c.length !== h.name.length, g = m.length !== d.length, b = "", v = "", y = "", w = h.dir, k = h.date, x = { crc32: 0, compressedSize: 0, uncompressedSize: 0 }; - t2 && !r2 || (x.crc32 = e2.crc32, x.compressedSize = e2.compressedSize, x.uncompressedSize = e2.uncompressedSize); - var S = 0; - t2 && (S |= 8), l || !_ && !g || (S |= 2048); - var z = 0, C = 0; - w && (z |= 16), "UNIX" === i2 ? (C = 798, z |= function(e3, t3) { - var r3 = e3; - return e3 || (r3 = t3 ? 16893 : 33204), (65535 & r3) << 16; - }(h.unixPermissions, w)) : (C = 20, z |= function(e3) { - return 63 & (e3 || 0); - }(h.dosPermissions)), a = k.getUTCHours(), a <<= 6, a |= k.getUTCMinutes(), a <<= 5, a |= k.getUTCSeconds() / 2, o = k.getUTCFullYear() - 1980, o <<= 4, o |= k.getUTCMonth() + 1, o <<= 5, o |= k.getUTCDate(), _ && (v = A(1, 1) + A(B(f), 4) + c, b += "up" + A(v.length, 2) + v), g && (y = A(1, 1) + A(B(p), 4) + m, b += "uc" + A(y.length, 2) + y); - var E = ""; - return E += "\n\0", E += A(S, 2), E += u.magic, E += A(a, 2), E += A(o, 2), E += A(x.crc32, 4), E += A(x.compressedSize, 4), E += A(x.uncompressedSize, 4), E += A(f.length, 2), E += A(b.length, 2), { fileRecord: R.LOCAL_FILE_HEADER + E + f + b, dirRecord: R.CENTRAL_FILE_HEADER + A(C, 2) + E + A(p.length, 2) + "\0\0\0\0" + A(z, 4) + A(n2, 4) + f + b + p }; - } - var I = e("../utils"), i = e("../stream/GenericWorker"), O = e("../utf8"), B = e("../crc32"), R = e("../signature"); - function s(e2, t2, r2, n2) { - i.call(this, "ZipFileWorker"), this.bytesWritten = 0, this.zipComment = t2, this.zipPlatform = r2, this.encodeFileName = n2, this.streamFiles = e2, this.accumulate = false, this.contentBuffer = [], this.dirRecords = [], this.currentSourceOffset = 0, this.entriesCount = 0, this.currentFile = null, this._sources = []; - } - I.inherits(s, i), s.prototype.push = function(e2) { - var t2 = e2.meta.percent || 0, r2 = this.entriesCount, n2 = this._sources.length; - this.accumulate ? this.contentBuffer.push(e2) : (this.bytesWritten += e2.data.length, i.prototype.push.call(this, { data: e2.data, meta: { currentFile: this.currentFile, percent: r2 ? (t2 + 100 * (r2 - n2 - 1)) / r2 : 100 } })); - }, s.prototype.openedSource = function(e2) { - this.currentSourceOffset = this.bytesWritten, this.currentFile = e2.file.name; - var t2 = this.streamFiles && !e2.file.dir; - if (t2) { - var r2 = n(e2, t2, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); - this.push({ data: r2.fileRecord, meta: { percent: 0 } }); - } else - this.accumulate = true; - }, s.prototype.closedSource = function(e2) { - this.accumulate = false; - var t2 = this.streamFiles && !e2.file.dir, r2 = n(e2, t2, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); - if (this.dirRecords.push(r2.dirRecord), t2) - this.push({ data: function(e3) { - return R.DATA_DESCRIPTOR + A(e3.crc32, 4) + A(e3.compressedSize, 4) + A(e3.uncompressedSize, 4); - }(e2), meta: { percent: 100 } }); - else - for (this.push({ data: r2.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length; ) - this.push(this.contentBuffer.shift()); - this.currentFile = null; - }, s.prototype.flush = function() { - for (var e2 = this.bytesWritten, t2 = 0; t2 < this.dirRecords.length; t2++) - this.push({ data: this.dirRecords[t2], meta: { percent: 100 } }); - var r2 = this.bytesWritten - e2, n2 = function(e3, t3, r3, n3, i2) { - var s2 = I.transformTo("string", i2(n3)); - return R.CENTRAL_DIRECTORY_END + "\0\0\0\0" + A(e3, 2) + A(e3, 2) + A(t3, 4) + A(r3, 4) + A(s2.length, 2) + s2; - }(this.dirRecords.length, r2, e2, this.zipComment, this.encodeFileName); - this.push({ data: n2, meta: { percent: 100 } }); - }, s.prototype.prepareNextSource = function() { - this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume(); - }, s.prototype.registerPrevious = function(e2) { - this._sources.push(e2); - var t2 = this; - return e2.on("data", function(e3) { - t2.processChunk(e3); - }), e2.on("end", function() { - t2.closedSource(t2.previous.streamInfo), t2._sources.length ? t2.prepareNextSource() : t2.end(); - }), e2.on("error", function(e3) { - t2.error(e3); - }), this; - }, s.prototype.resume = function() { - return !!i.prototype.resume.call(this) && (!this.previous && this._sources.length ? (this.prepareNextSource(), true) : this.previous || this._sources.length || this.generatedError ? void 0 : (this.end(), true)); - }, s.prototype.error = function(e2) { - var t2 = this._sources; - if (!i.prototype.error.call(this, e2)) - return false; - for (var r2 = 0; r2 < t2.length; r2++) - try { - t2[r2].error(e2); - } catch (e3) { - } - return true; - }, s.prototype.lock = function() { - i.prototype.lock.call(this); - for (var e2 = this._sources, t2 = 0; t2 < e2.length; t2++) - e2[t2].lock(); - }, t.exports = s; - }, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function(e, t, r) { - "use strict"; - var u = e("../compressions"), n = e("./ZipFileWorker"); - r.generateWorker = function(e2, a, t2) { - var o = new n(a.streamFiles, t2, a.platform, a.encodeFileName), h = 0; - try { - e2.forEach(function(e3, t3) { - h++; - var r2 = function(e4, t4) { - var r3 = e4 || t4, n3 = u[r3]; - if (!n3) - throw new Error(r3 + " is not a valid compression method !"); - return n3; - }(t3.options.compression, a.compression), n2 = t3.options.compressionOptions || a.compressionOptions || {}, i = t3.dir, s = t3.date; - t3._compressWorker(r2, n2).withStreamInfo("file", { name: e3, dir: i, date: s, comment: t3.comment || "", unixPermissions: t3.unixPermissions, dosPermissions: t3.dosPermissions }).pipe(o); - }), o.entriesCount = h; - } catch (e3) { - o.error(e3); - } - return o; - }; - }, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function(e, t, r) { - "use strict"; - function n() { - if (!(this instanceof n)) - return new n(); - if (arguments.length) - throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide."); - this.files = /* @__PURE__ */ Object.create(null), this.comment = null, this.root = "", this.clone = function() { - var e2 = new n(); - for (var t2 in this) - "function" != typeof this[t2] && (e2[t2] = this[t2]); - return e2; - }; - } - (n.prototype = e("./object")).loadAsync = e("./load"), n.support = e("./support"), n.defaults = e("./defaults"), n.version = "3.10.1", n.loadAsync = function(e2, t2) { - return new n().loadAsync(e2, t2); - }, n.external = e("./external"), t.exports = n; - }, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function(e, t, r) { - "use strict"; - var u = e("./utils"), i = e("./external"), n = e("./utf8"), s = e("./zipEntries"), a = e("./stream/Crc32Probe"), l = e("./nodejsUtils"); - function f(n2) { - return new i.Promise(function(e2, t2) { - var r2 = n2.decompressed.getContentWorker().pipe(new a()); - r2.on("error", function(e3) { - t2(e3); - }).on("end", function() { - r2.streamInfo.crc32 !== n2.decompressed.crc32 ? t2(new Error("Corrupted zip : CRC32 mismatch")) : e2(); - }).resume(); - }); - } - t.exports = function(e2, o) { - var h = this; - return o = u.extend(o || {}, { base64: false, checkCRC32: false, optimizedBinaryString: false, createFolders: false, decodeFileName: n.utf8decode }), l.isNode && l.isStream(e2) ? i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")) : u.prepareContent("the loaded zip file", e2, true, o.optimizedBinaryString, o.base64).then(function(e3) { - var t2 = new s(o); - return t2.load(e3), t2; - }).then(function(e3) { - var t2 = [i.Promise.resolve(e3)], r2 = e3.files; - if (o.checkCRC32) - for (var n2 = 0; n2 < r2.length; n2++) - t2.push(f(r2[n2])); - return i.Promise.all(t2); - }).then(function(e3) { - for (var t2 = e3.shift(), r2 = t2.files, n2 = 0; n2 < r2.length; n2++) { - var i2 = r2[n2], s2 = i2.fileNameStr, a2 = u.resolve(i2.fileNameStr); - h.file(a2, i2.decompressed, { binary: true, optimizedBinaryString: true, date: i2.date, dir: i2.dir, comment: i2.fileCommentStr.length ? i2.fileCommentStr : null, unixPermissions: i2.unixPermissions, dosPermissions: i2.dosPermissions, createFolders: o.createFolders }), i2.dir || (h.file(a2).unsafeOriginalName = s2); - } - return t2.zipComment.length && (h.comment = t2.zipComment), h; - }); - }; - }, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function(e, t, r) { - "use strict"; - var n = e("../utils"), i = e("../stream/GenericWorker"); - function s(e2, t2) { - i.call(this, "Nodejs stream input adapter for " + e2), this._upstreamEnded = false, this._bindStream(t2); - } - n.inherits(s, i), s.prototype._bindStream = function(e2) { - var t2 = this; - (this._stream = e2).pause(), e2.on("data", function(e3) { - t2.push({ data: e3, meta: { percent: 0 } }); - }).on("error", function(e3) { - t2.isPaused ? this.generatedError = e3 : t2.error(e3); - }).on("end", function() { - t2.isPaused ? t2._upstreamEnded = true : t2.end(); - }); - }, s.prototype.pause = function() { - return !!i.prototype.pause.call(this) && (this._stream.pause(), true); - }, s.prototype.resume = function() { - return !!i.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), true); - }, t.exports = s; - }, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function(e, t, r) { - "use strict"; - var i = e("readable-stream").Readable; - function n(e2, t2, r2) { - i.call(this, t2), this._helper = e2; - var n2 = this; - e2.on("data", function(e3, t3) { - n2.push(e3) || n2._helper.pause(), r2 && r2(t3); - }).on("error", function(e3) { - n2.emit("error", e3); - }).on("end", function() { - n2.push(null); - }); - } - e("../utils").inherits(n, i), n.prototype._read = function() { - this._helper.resume(); - }, t.exports = n; - }, { "../utils": 32, "readable-stream": 16 }], 14: [function(e, t, r) { - "use strict"; - t.exports = { isNode: "undefined" != typeof Buffer, newBufferFrom: function(e2, t2) { - if (Buffer.from && Buffer.from !== Uint8Array.from) - return Buffer.from(e2, t2); - if ("number" == typeof e2) - throw new Error('The "data" argument must not be a number'); - return new Buffer(e2, t2); - }, allocBuffer: function(e2) { - if (Buffer.alloc) - return Buffer.alloc(e2); - var t2 = new Buffer(e2); - return t2.fill(0), t2; - }, isBuffer: function(e2) { - return Buffer.isBuffer(e2); - }, isStream: function(e2) { - return e2 && "function" == typeof e2.on && "function" == typeof e2.pause && "function" == typeof e2.resume; - } }; - }, {}], 15: [function(e, t, r) { - "use strict"; - function s(e2, t2, r2) { - var n2, i2 = u.getTypeOf(t2), s2 = u.extend(r2 || {}, f); - s2.date = s2.date || /* @__PURE__ */ new Date(), null !== s2.compression && (s2.compression = s2.compression.toUpperCase()), "string" == typeof s2.unixPermissions && (s2.unixPermissions = parseInt(s2.unixPermissions, 8)), s2.unixPermissions && 16384 & s2.unixPermissions && (s2.dir = true), s2.dosPermissions && 16 & s2.dosPermissions && (s2.dir = true), s2.dir && (e2 = g(e2)), s2.createFolders && (n2 = _(e2)) && b.call(this, n2, true); - var a2 = "string" === i2 && false === s2.binary && false === s2.base64; - r2 && void 0 !== r2.binary || (s2.binary = !a2), (t2 instanceof c && 0 === t2.uncompressedSize || s2.dir || !t2 || 0 === t2.length) && (s2.base64 = false, s2.binary = true, t2 = "", s2.compression = "STORE", i2 = "string"); - var o2 = null; - o2 = t2 instanceof c || t2 instanceof l ? t2 : p.isNode && p.isStream(t2) ? new m(e2, t2) : u.prepareContent(e2, t2, s2.binary, s2.optimizedBinaryString, s2.base64); - var h2 = new d(e2, o2, s2); - this.files[e2] = h2; - } - var i = e("./utf8"), u = e("./utils"), l = e("./stream/GenericWorker"), a = e("./stream/StreamHelper"), f = e("./defaults"), c = e("./compressedObject"), d = e("./zipObject"), o = e("./generate"), p = e("./nodejsUtils"), m = e("./nodejs/NodejsStreamInputAdapter"), _ = function(e2) { - "/" === e2.slice(-1) && (e2 = e2.substring(0, e2.length - 1)); - var t2 = e2.lastIndexOf("/"); - return 0 < t2 ? e2.substring(0, t2) : ""; - }, g = function(e2) { - return "/" !== e2.slice(-1) && (e2 += "/"), e2; - }, b = function(e2, t2) { - return t2 = void 0 !== t2 ? t2 : f.createFolders, e2 = g(e2), this.files[e2] || s.call(this, e2, null, { dir: true, createFolders: t2 }), this.files[e2]; - }; - function h(e2) { - return "[object RegExp]" === Object.prototype.toString.call(e2); - } - var n = { load: function() { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); - }, forEach: function(e2) { - var t2, r2, n2; - for (t2 in this.files) - n2 = this.files[t2], (r2 = t2.slice(this.root.length, t2.length)) && t2.slice(0, this.root.length) === this.root && e2(r2, n2); - }, filter: function(r2) { - var n2 = []; - return this.forEach(function(e2, t2) { - r2(e2, t2) && n2.push(t2); - }), n2; - }, file: function(e2, t2, r2) { - if (1 !== arguments.length) - return e2 = this.root + e2, s.call(this, e2, t2, r2), this; - if (h(e2)) { - var n2 = e2; - return this.filter(function(e3, t3) { - return !t3.dir && n2.test(e3); - }); - } - var i2 = this.files[this.root + e2]; - return i2 && !i2.dir ? i2 : null; - }, folder: function(r2) { - if (!r2) - return this; - if (h(r2)) - return this.filter(function(e3, t3) { - return t3.dir && r2.test(e3); - }); - var e2 = this.root + r2, t2 = b.call(this, e2), n2 = this.clone(); - return n2.root = t2.name, n2; - }, remove: function(r2) { - r2 = this.root + r2; - var e2 = this.files[r2]; - if (e2 || ("/" !== r2.slice(-1) && (r2 += "/"), e2 = this.files[r2]), e2 && !e2.dir) - delete this.files[r2]; - else - for (var t2 = this.filter(function(e3, t3) { - return t3.name.slice(0, r2.length) === r2; - }), n2 = 0; n2 < t2.length; n2++) - delete this.files[t2[n2].name]; - return this; - }, generate: function() { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); - }, generateInternalStream: function(e2) { - var t2, r2 = {}; - try { - if ((r2 = u.extend(e2 || {}, { streamFiles: false, compression: "STORE", compressionOptions: null, type: "", platform: "DOS", comment: null, mimeType: "application/zip", encodeFileName: i.utf8encode })).type = r2.type.toLowerCase(), r2.compression = r2.compression.toUpperCase(), "binarystring" === r2.type && (r2.type = "string"), !r2.type) - throw new Error("No output type specified."); - u.checkSupport(r2.type), "darwin" !== r2.platform && "freebsd" !== r2.platform && "linux" !== r2.platform && "sunos" !== r2.platform || (r2.platform = "UNIX"), "win32" === r2.platform && (r2.platform = "DOS"); - var n2 = r2.comment || this.comment || ""; - t2 = o.generateWorker(this, r2, n2); - } catch (e3) { - (t2 = new l("error")).error(e3); - } - return new a(t2, r2.type || "string", r2.mimeType); - }, generateAsync: function(e2, t2) { - return this.generateInternalStream(e2).accumulate(t2); - }, generateNodeStream: function(e2, t2) { - return (e2 = e2 || {}).type || (e2.type = "nodebuffer"), this.generateInternalStream(e2).toNodejsStream(t2); - } }; - t.exports = n; - }, { "./compressedObject": 2, "./defaults": 5, "./generate": 9, "./nodejs/NodejsStreamInputAdapter": 12, "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31, "./utils": 32, "./zipObject": 35 }], 16: [function(e, t, r) { - "use strict"; - t.exports = e("stream"); - }, { stream: void 0 }], 17: [function(e, t, r) { - "use strict"; - var n = e("./DataReader"); - function i(e2) { - n.call(this, e2); - for (var t2 = 0; t2 < this.data.length; t2++) - e2[t2] = 255 & e2[t2]; - } - e("../utils").inherits(i, n), i.prototype.byteAt = function(e2) { - return this.data[this.zero + e2]; - }, i.prototype.lastIndexOfSignature = function(e2) { - for (var t2 = e2.charCodeAt(0), r2 = e2.charCodeAt(1), n2 = e2.charCodeAt(2), i2 = e2.charCodeAt(3), s = this.length - 4; 0 <= s; --s) - if (this.data[s] === t2 && this.data[s + 1] === r2 && this.data[s + 2] === n2 && this.data[s + 3] === i2) - return s - this.zero; - return -1; - }, i.prototype.readAndCheckSignature = function(e2) { - var t2 = e2.charCodeAt(0), r2 = e2.charCodeAt(1), n2 = e2.charCodeAt(2), i2 = e2.charCodeAt(3), s = this.readData(4); - return t2 === s[0] && r2 === s[1] && n2 === s[2] && i2 === s[3]; - }, i.prototype.readData = function(e2) { - if (this.checkOffset(e2), 0 === e2) - return []; - var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2); - return this.index += e2, t2; - }, t.exports = i; - }, { "../utils": 32, "./DataReader": 18 }], 18: [function(e, t, r) { - "use strict"; - var n = e("../utils"); - function i(e2) { - this.data = e2, this.length = e2.length, this.index = 0, this.zero = 0; - } - i.prototype = { checkOffset: function(e2) { - this.checkIndex(this.index + e2); - }, checkIndex: function(e2) { - if (this.length < this.zero + e2 || e2 < 0) - throw new Error("End of data reached (data length = " + this.length + ", asked index = " + e2 + "). Corrupted zip ?"); - }, setIndex: function(e2) { - this.checkIndex(e2), this.index = e2; - }, skip: function(e2) { - this.setIndex(this.index + e2); - }, byteAt: function() { - }, readInt: function(e2) { - var t2, r2 = 0; - for (this.checkOffset(e2), t2 = this.index + e2 - 1; t2 >= this.index; t2--) - r2 = (r2 << 8) + this.byteAt(t2); - return this.index += e2, r2; - }, readString: function(e2) { - return n.transformTo("string", this.readData(e2)); - }, readData: function() { - }, lastIndexOfSignature: function() { - }, readAndCheckSignature: function() { - }, readDate: function() { - var e2 = this.readInt(4); - return new Date(Date.UTC(1980 + (e2 >> 25 & 127), (e2 >> 21 & 15) - 1, e2 >> 16 & 31, e2 >> 11 & 31, e2 >> 5 & 63, (31 & e2) << 1)); - } }, t.exports = i; - }, { "../utils": 32 }], 19: [function(e, t, r) { - "use strict"; - var n = e("./Uint8ArrayReader"); - function i(e2) { - n.call(this, e2); - } - e("../utils").inherits(i, n), i.prototype.readData = function(e2) { - this.checkOffset(e2); - var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2); - return this.index += e2, t2; - }, t.exports = i; - }, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function(e, t, r) { - "use strict"; - var n = e("./DataReader"); - function i(e2) { - n.call(this, e2); - } - e("../utils").inherits(i, n), i.prototype.byteAt = function(e2) { - return this.data.charCodeAt(this.zero + e2); - }, i.prototype.lastIndexOfSignature = function(e2) { - return this.data.lastIndexOf(e2) - this.zero; - }, i.prototype.readAndCheckSignature = function(e2) { - return e2 === this.readData(4); - }, i.prototype.readData = function(e2) { - this.checkOffset(e2); - var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2); - return this.index += e2, t2; - }, t.exports = i; - }, { "../utils": 32, "./DataReader": 18 }], 21: [function(e, t, r) { - "use strict"; - var n = e("./ArrayReader"); - function i(e2) { - n.call(this, e2); - } - e("../utils").inherits(i, n), i.prototype.readData = function(e2) { - if (this.checkOffset(e2), 0 === e2) - return new Uint8Array(0); - var t2 = this.data.subarray(this.zero + this.index, this.zero + this.index + e2); - return this.index += e2, t2; - }, t.exports = i; - }, { "../utils": 32, "./ArrayReader": 17 }], 22: [function(e, t, r) { - "use strict"; - var n = e("../utils"), i = e("../support"), s = e("./ArrayReader"), a = e("./StringReader"), o = e("./NodeBufferReader"), h = e("./Uint8ArrayReader"); - t.exports = function(e2) { - var t2 = n.getTypeOf(e2); - return n.checkSupport(t2), "string" !== t2 || i.uint8array ? "nodebuffer" === t2 ? new o(e2) : i.uint8array ? new h(n.transformTo("uint8array", e2)) : new s(n.transformTo("array", e2)) : new a(e2); - }; - }, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function(e, t, r) { - "use strict"; - r.LOCAL_FILE_HEADER = "PK", r.CENTRAL_FILE_HEADER = "PK", r.CENTRAL_DIRECTORY_END = "PK", r.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x07", r.ZIP64_CENTRAL_DIRECTORY_END = "PK", r.DATA_DESCRIPTOR = "PK\x07\b"; - }, {}], 24: [function(e, t, r) { - "use strict"; - var n = e("./GenericWorker"), i = e("../utils"); - function s(e2) { - n.call(this, "ConvertWorker to " + e2), this.destType = e2; - } - i.inherits(s, n), s.prototype.processChunk = function(e2) { - this.push({ data: i.transformTo(this.destType, e2.data), meta: e2.meta }); - }, t.exports = s; - }, { "../utils": 32, "./GenericWorker": 28 }], 25: [function(e, t, r) { - "use strict"; - var n = e("./GenericWorker"), i = e("../crc32"); - function s() { - n.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0); - } - e("../utils").inherits(s, n), s.prototype.processChunk = function(e2) { - this.streamInfo.crc32 = i(e2.data, this.streamInfo.crc32 || 0), this.push(e2); - }, t.exports = s; - }, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function(e, t, r) { - "use strict"; - var n = e("../utils"), i = e("./GenericWorker"); - function s(e2) { - i.call(this, "DataLengthProbe for " + e2), this.propName = e2, this.withStreamInfo(e2, 0); - } - n.inherits(s, i), s.prototype.processChunk = function(e2) { - if (e2) { - var t2 = this.streamInfo[this.propName] || 0; - this.streamInfo[this.propName] = t2 + e2.data.length; - } - i.prototype.processChunk.call(this, e2); - }, t.exports = s; - }, { "../utils": 32, "./GenericWorker": 28 }], 27: [function(e, t, r) { - "use strict"; - var n = e("../utils"), i = e("./GenericWorker"); - function s(e2) { - i.call(this, "DataWorker"); - var t2 = this; - this.dataIsReady = false, this.index = 0, this.max = 0, this.data = null, this.type = "", this._tickScheduled = false, e2.then(function(e3) { - t2.dataIsReady = true, t2.data = e3, t2.max = e3 && e3.length || 0, t2.type = n.getTypeOf(e3), t2.isPaused || t2._tickAndRepeat(); - }, function(e3) { - t2.error(e3); - }); - } - n.inherits(s, i), s.prototype.cleanUp = function() { - i.prototype.cleanUp.call(this), this.data = null; - }, s.prototype.resume = function() { - return !!i.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = true, n.delay(this._tickAndRepeat, [], this)), true); - }, s.prototype._tickAndRepeat = function() { - this._tickScheduled = false, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (n.delay(this._tickAndRepeat, [], this), this._tickScheduled = true)); - }, s.prototype._tick = function() { - if (this.isPaused || this.isFinished) - return false; - var e2 = null, t2 = Math.min(this.max, this.index + 16384); - if (this.index >= this.max) - return this.end(); - switch (this.type) { - case "string": - e2 = this.data.substring(this.index, t2); - break; - case "uint8array": - e2 = this.data.subarray(this.index, t2); - break; - case "array": - case "nodebuffer": - e2 = this.data.slice(this.index, t2); - } - return this.index = t2, this.push({ data: e2, meta: { percent: this.max ? this.index / this.max * 100 : 0 } }); - }, t.exports = s; - }, { "../utils": 32, "./GenericWorker": 28 }], 28: [function(e, t, r) { - "use strict"; - function n(e2) { - this.name = e2 || "default", this.streamInfo = {}, this.generatedError = null, this.extraStreamInfo = {}, this.isPaused = true, this.isFinished = false, this.isLocked = false, this._listeners = { data: [], end: [], error: [] }, this.previous = null; - } - n.prototype = { push: function(e2) { - this.emit("data", e2); - }, end: function() { - if (this.isFinished) - return false; - this.flush(); - try { - this.emit("end"), this.cleanUp(), this.isFinished = true; - } catch (e2) { - this.emit("error", e2); - } - return true; - }, error: function(e2) { - return !this.isFinished && (this.isPaused ? this.generatedError = e2 : (this.isFinished = true, this.emit("error", e2), this.previous && this.previous.error(e2), this.cleanUp()), true); - }, on: function(e2, t2) { - return this._listeners[e2].push(t2), this; - }, cleanUp: function() { - this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = []; - }, emit: function(e2, t2) { - if (this._listeners[e2]) - for (var r2 = 0; r2 < this._listeners[e2].length; r2++) - this._listeners[e2][r2].call(this, t2); - }, pipe: function(e2) { - return e2.registerPrevious(this); - }, registerPrevious: function(e2) { - if (this.isLocked) - throw new Error("The stream '" + this + "' has already been used."); - this.streamInfo = e2.streamInfo, this.mergeStreamInfo(), this.previous = e2; - var t2 = this; - return e2.on("data", function(e3) { - t2.processChunk(e3); - }), e2.on("end", function() { - t2.end(); - }), e2.on("error", function(e3) { - t2.error(e3); - }), this; - }, pause: function() { - return !this.isPaused && !this.isFinished && (this.isPaused = true, this.previous && this.previous.pause(), true); - }, resume: function() { - if (!this.isPaused || this.isFinished) - return false; - var e2 = this.isPaused = false; - return this.generatedError && (this.error(this.generatedError), e2 = true), this.previous && this.previous.resume(), !e2; - }, flush: function() { - }, processChunk: function(e2) { - this.push(e2); - }, withStreamInfo: function(e2, t2) { - return this.extraStreamInfo[e2] = t2, this.mergeStreamInfo(), this; - }, mergeStreamInfo: function() { - for (var e2 in this.extraStreamInfo) - Object.prototype.hasOwnProperty.call(this.extraStreamInfo, e2) && (this.streamInfo[e2] = this.extraStreamInfo[e2]); - }, lock: function() { - if (this.isLocked) - throw new Error("The stream '" + this + "' has already been used."); - this.isLocked = true, this.previous && this.previous.lock(); - }, toString: function() { - var e2 = "Worker " + this.name; - return this.previous ? this.previous + " -> " + e2 : e2; - } }, t.exports = n; - }, {}], 29: [function(e, t, r) { - "use strict"; - var h = e("../utils"), i = e("./ConvertWorker"), s = e("./GenericWorker"), u = e("../base64"), n = e("../support"), a = e("../external"), o = null; - if (n.nodestream) - try { - o = e("../nodejs/NodejsStreamOutputAdapter"); - } catch (e2) { - } - function l(e2, o2) { - return new a.Promise(function(t2, r2) { - var n2 = [], i2 = e2._internalType, s2 = e2._outputType, a2 = e2._mimeType; - e2.on("data", function(e3, t3) { - n2.push(e3), o2 && o2(t3); - }).on("error", function(e3) { - n2 = [], r2(e3); - }).on("end", function() { - try { - var e3 = function(e4, t3, r3) { - switch (e4) { - case "blob": - return h.newBlob(h.transformTo("arraybuffer", t3), r3); - case "base64": - return u.encode(t3); - default: - return h.transformTo(e4, t3); - } - }(s2, function(e4, t3) { - var r3, n3 = 0, i3 = null, s3 = 0; - for (r3 = 0; r3 < t3.length; r3++) - s3 += t3[r3].length; - switch (e4) { - case "string": - return t3.join(""); - case "array": - return Array.prototype.concat.apply([], t3); - case "uint8array": - for (i3 = new Uint8Array(s3), r3 = 0; r3 < t3.length; r3++) - i3.set(t3[r3], n3), n3 += t3[r3].length; - return i3; - case "nodebuffer": - return Buffer.concat(t3); - default: - throw new Error("concat : unsupported type '" + e4 + "'"); - } - }(i2, n2), a2); - t2(e3); - } catch (e4) { - r2(e4); - } - n2 = []; - }).resume(); - }); - } - function f(e2, t2, r2) { - var n2 = t2; - switch (t2) { - case "blob": - case "arraybuffer": - n2 = "uint8array"; - break; - case "base64": - n2 = "string"; - } - try { - this._internalType = n2, this._outputType = t2, this._mimeType = r2, h.checkSupport(n2), this._worker = e2.pipe(new i(n2)), e2.lock(); - } catch (e3) { - this._worker = new s("error"), this._worker.error(e3); - } - } - f.prototype = { accumulate: function(e2) { - return l(this, e2); - }, on: function(e2, t2) { - var r2 = this; - return "data" === e2 ? this._worker.on(e2, function(e3) { - t2.call(r2, e3.data, e3.meta); - }) : this._worker.on(e2, function() { - h.delay(t2, arguments, r2); - }), this; - }, resume: function() { - return h.delay(this._worker.resume, [], this._worker), this; - }, pause: function() { - return this._worker.pause(), this; - }, toNodejsStream: function(e2) { - if (h.checkSupport("nodestream"), "nodebuffer" !== this._outputType) - throw new Error(this._outputType + " is not supported by this method"); - return new o(this, { objectMode: "nodebuffer" !== this._outputType }, e2); - } }, t.exports = f; - }, { "../base64": 1, "../external": 6, "../nodejs/NodejsStreamOutputAdapter": 13, "../support": 30, "../utils": 32, "./ConvertWorker": 24, "./GenericWorker": 28 }], 30: [function(e, t, r) { - "use strict"; - if (r.base64 = true, r.array = true, r.string = true, r.arraybuffer = "undefined" != typeof ArrayBuffer && "undefined" != typeof Uint8Array, r.nodebuffer = "undefined" != typeof Buffer, r.uint8array = "undefined" != typeof Uint8Array, "undefined" == typeof ArrayBuffer) - r.blob = false; - else { - var n = new ArrayBuffer(0); - try { - r.blob = 0 === new Blob([n], { type: "application/zip" }).size; - } catch (e2) { - try { - var i = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)(); - i.append(n), r.blob = 0 === i.getBlob("application/zip").size; - } catch (e3) { - r.blob = false; - } - } - } - try { - r.nodestream = !!e("readable-stream").Readable; - } catch (e2) { - r.nodestream = false; - } - }, { "readable-stream": 16 }], 31: [function(e, t, s) { - "use strict"; - for (var o = e("./utils"), h = e("./support"), r = e("./nodejsUtils"), n = e("./stream/GenericWorker"), u = new Array(256), i = 0; i < 256; i++) - u[i] = 252 <= i ? 6 : 248 <= i ? 5 : 240 <= i ? 4 : 224 <= i ? 3 : 192 <= i ? 2 : 1; - u[254] = u[254] = 1; - function a() { - n.call(this, "utf-8 decode"), this.leftOver = null; - } - function l() { - n.call(this, "utf-8 encode"); - } - s.utf8encode = function(e2) { - return h.nodebuffer ? r.newBufferFrom(e2, "utf-8") : function(e3) { - var t2, r2, n2, i2, s2, a2 = e3.length, o2 = 0; - for (i2 = 0; i2 < a2; i2++) - 55296 == (64512 & (r2 = e3.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n2 = e3.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), o2 += r2 < 128 ? 1 : r2 < 2048 ? 2 : r2 < 65536 ? 3 : 4; - for (t2 = h.uint8array ? new Uint8Array(o2) : new Array(o2), i2 = s2 = 0; s2 < o2; i2++) - 55296 == (64512 & (r2 = e3.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n2 = e3.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), r2 < 128 ? t2[s2++] = r2 : (r2 < 2048 ? t2[s2++] = 192 | r2 >>> 6 : (r2 < 65536 ? t2[s2++] = 224 | r2 >>> 12 : (t2[s2++] = 240 | r2 >>> 18, t2[s2++] = 128 | r2 >>> 12 & 63), t2[s2++] = 128 | r2 >>> 6 & 63), t2[s2++] = 128 | 63 & r2); - return t2; - }(e2); - }, s.utf8decode = function(e2) { - return h.nodebuffer ? o.transformTo("nodebuffer", e2).toString("utf-8") : function(e3) { - var t2, r2, n2, i2, s2 = e3.length, a2 = new Array(2 * s2); - for (t2 = r2 = 0; t2 < s2; ) - if ((n2 = e3[t2++]) < 128) - a2[r2++] = n2; - else if (4 < (i2 = u[n2])) - a2[r2++] = 65533, t2 += i2 - 1; - else { - for (n2 &= 2 === i2 ? 31 : 3 === i2 ? 15 : 7; 1 < i2 && t2 < s2; ) - n2 = n2 << 6 | 63 & e3[t2++], i2--; - 1 < i2 ? a2[r2++] = 65533 : n2 < 65536 ? a2[r2++] = n2 : (n2 -= 65536, a2[r2++] = 55296 | n2 >> 10 & 1023, a2[r2++] = 56320 | 1023 & n2); - } - return a2.length !== r2 && (a2.subarray ? a2 = a2.subarray(0, r2) : a2.length = r2), o.applyFromCharCode(a2); - }(e2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2)); - }, o.inherits(a, n), a.prototype.processChunk = function(e2) { - var t2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2.data); - if (this.leftOver && this.leftOver.length) { - if (h.uint8array) { - var r2 = t2; - (t2 = new Uint8Array(r2.length + this.leftOver.length)).set(this.leftOver, 0), t2.set(r2, this.leftOver.length); - } else - t2 = this.leftOver.concat(t2); - this.leftOver = null; - } - var n2 = function(e3, t3) { - var r3; - for ((t3 = t3 || e3.length) > e3.length && (t3 = e3.length), r3 = t3 - 1; 0 <= r3 && 128 == (192 & e3[r3]); ) - r3--; - return r3 < 0 ? t3 : 0 === r3 ? t3 : r3 + u[e3[r3]] > t3 ? r3 : t3; - }(t2), i2 = t2; - n2 !== t2.length && (h.uint8array ? (i2 = t2.subarray(0, n2), this.leftOver = t2.subarray(n2, t2.length)) : (i2 = t2.slice(0, n2), this.leftOver = t2.slice(n2, t2.length))), this.push({ data: s.utf8decode(i2), meta: e2.meta }); - }, a.prototype.flush = function() { - this.leftOver && this.leftOver.length && (this.push({ data: s.utf8decode(this.leftOver), meta: {} }), this.leftOver = null); - }, s.Utf8DecodeWorker = a, o.inherits(l, n), l.prototype.processChunk = function(e2) { - this.push({ data: s.utf8encode(e2.data), meta: e2.meta }); - }, s.Utf8EncodeWorker = l; - }, { "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./support": 30, "./utils": 32 }], 32: [function(e, t, a) { - "use strict"; - var o = e("./support"), h = e("./base64"), r = e("./nodejsUtils"), u = e("./external"); - function n(e2) { - return e2; - } - function l(e2, t2) { - for (var r2 = 0; r2 < e2.length; ++r2) - t2[r2] = 255 & e2.charCodeAt(r2); - return t2; - } - e("setimmediate"), a.newBlob = function(t2, r2) { - a.checkSupport("blob"); - try { - return new Blob([t2], { type: r2 }); - } catch (e2) { - try { - var n2 = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)(); - return n2.append(t2), n2.getBlob(r2); - } catch (e3) { - throw new Error("Bug : can't construct the Blob."); - } - } - }; - var i = { stringifyByChunk: function(e2, t2, r2) { - var n2 = [], i2 = 0, s2 = e2.length; - if (s2 <= r2) - return String.fromCharCode.apply(null, e2); - for (; i2 < s2; ) - "array" === t2 || "nodebuffer" === t2 ? n2.push(String.fromCharCode.apply(null, e2.slice(i2, Math.min(i2 + r2, s2)))) : n2.push(String.fromCharCode.apply(null, e2.subarray(i2, Math.min(i2 + r2, s2)))), i2 += r2; - return n2.join(""); - }, stringifyByChar: function(e2) { - for (var t2 = "", r2 = 0; r2 < e2.length; r2++) - t2 += String.fromCharCode(e2[r2]); - return t2; - }, applyCanBeUsed: { uint8array: function() { - try { - return o.uint8array && 1 === String.fromCharCode.apply(null, new Uint8Array(1)).length; - } catch (e2) { - return false; - } - }(), nodebuffer: function() { - try { - return o.nodebuffer && 1 === String.fromCharCode.apply(null, r.allocBuffer(1)).length; - } catch (e2) { - return false; - } - }() } }; - function s(e2) { - var t2 = 65536, r2 = a.getTypeOf(e2), n2 = true; - if ("uint8array" === r2 ? n2 = i.applyCanBeUsed.uint8array : "nodebuffer" === r2 && (n2 = i.applyCanBeUsed.nodebuffer), n2) - for (; 1 < t2; ) - try { - return i.stringifyByChunk(e2, r2, t2); - } catch (e3) { - t2 = Math.floor(t2 / 2); - } - return i.stringifyByChar(e2); - } - function f(e2, t2) { - for (var r2 = 0; r2 < e2.length; r2++) - t2[r2] = e2[r2]; - return t2; - } - a.applyFromCharCode = s; - var c = {}; - c.string = { string: n, array: function(e2) { - return l(e2, new Array(e2.length)); - }, arraybuffer: function(e2) { - return c.string.uint8array(e2).buffer; - }, uint8array: function(e2) { - return l(e2, new Uint8Array(e2.length)); - }, nodebuffer: function(e2) { - return l(e2, r.allocBuffer(e2.length)); - } }, c.array = { string: s, array: n, arraybuffer: function(e2) { - return new Uint8Array(e2).buffer; - }, uint8array: function(e2) { - return new Uint8Array(e2); - }, nodebuffer: function(e2) { - return r.newBufferFrom(e2); - } }, c.arraybuffer = { string: function(e2) { - return s(new Uint8Array(e2)); - }, array: function(e2) { - return f(new Uint8Array(e2), new Array(e2.byteLength)); - }, arraybuffer: n, uint8array: function(e2) { - return new Uint8Array(e2); - }, nodebuffer: function(e2) { - return r.newBufferFrom(new Uint8Array(e2)); - } }, c.uint8array = { string: s, array: function(e2) { - return f(e2, new Array(e2.length)); - }, arraybuffer: function(e2) { - return e2.buffer; - }, uint8array: n, nodebuffer: function(e2) { - return r.newBufferFrom(e2); - } }, c.nodebuffer = { string: s, array: function(e2) { - return f(e2, new Array(e2.length)); - }, arraybuffer: function(e2) { - return c.nodebuffer.uint8array(e2).buffer; - }, uint8array: function(e2) { - return f(e2, new Uint8Array(e2.length)); - }, nodebuffer: n }, a.transformTo = function(e2, t2) { - if (t2 = t2 || "", !e2) - return t2; - a.checkSupport(e2); - var r2 = a.getTypeOf(t2); - return c[r2][e2](t2); - }, a.resolve = function(e2) { - for (var t2 = e2.split("/"), r2 = [], n2 = 0; n2 < t2.length; n2++) { - var i2 = t2[n2]; - "." === i2 || "" === i2 && 0 !== n2 && n2 !== t2.length - 1 || (".." === i2 ? r2.pop() : r2.push(i2)); - } - return r2.join("/"); - }, a.getTypeOf = function(e2) { - return "string" == typeof e2 ? "string" : "[object Array]" === Object.prototype.toString.call(e2) ? "array" : o.nodebuffer && r.isBuffer(e2) ? "nodebuffer" : o.uint8array && e2 instanceof Uint8Array ? "uint8array" : o.arraybuffer && e2 instanceof ArrayBuffer ? "arraybuffer" : void 0; - }, a.checkSupport = function(e2) { - if (!o[e2.toLowerCase()]) - throw new Error(e2 + " is not supported by this platform"); - }, a.MAX_VALUE_16BITS = 65535, a.MAX_VALUE_32BITS = -1, a.pretty = function(e2) { - var t2, r2, n2 = ""; - for (r2 = 0; r2 < (e2 || "").length; r2++) - n2 += "\\x" + ((t2 = e2.charCodeAt(r2)) < 16 ? "0" : "") + t2.toString(16).toUpperCase(); - return n2; - }, a.delay = function(e2, t2, r2) { - setImmediate(function() { - e2.apply(r2 || null, t2 || []); - }); - }, a.inherits = function(e2, t2) { - function r2() { - } - r2.prototype = t2.prototype, e2.prototype = new r2(); - }, a.extend = function() { - var e2, t2, r2 = {}; - for (e2 = 0; e2 < arguments.length; e2++) - for (t2 in arguments[e2]) - Object.prototype.hasOwnProperty.call(arguments[e2], t2) && void 0 === r2[t2] && (r2[t2] = arguments[e2][t2]); - return r2; - }, a.prepareContent = function(r2, e2, n2, i2, s2) { - return u.Promise.resolve(e2).then(function(n3) { - return o.blob && (n3 instanceof Blob || -1 !== ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(n3))) && "undefined" != typeof FileReader ? new u.Promise(function(t2, r3) { - var e3 = new FileReader(); - e3.onload = function(e4) { - t2(e4.target.result); - }, e3.onerror = function(e4) { - r3(e4.target.error); - }, e3.readAsArrayBuffer(n3); - }) : n3; - }).then(function(e3) { - var t2 = a.getTypeOf(e3); - return t2 ? ("arraybuffer" === t2 ? e3 = a.transformTo("uint8array", e3) : "string" === t2 && (s2 ? e3 = h.decode(e3) : n2 && true !== i2 && (e3 = function(e4) { - return l(e4, o.uint8array ? new Uint8Array(e4.length) : new Array(e4.length)); - }(e3))), e3) : u.Promise.reject(new Error("Can't read the data of '" + r2 + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?")); - }); - }; - }, { "./base64": 1, "./external": 6, "./nodejsUtils": 14, "./support": 30, setimmediate: 54 }], 33: [function(e, t, r) { - "use strict"; - var n = e("./reader/readerFor"), i = e("./utils"), s = e("./signature"), a = e("./zipEntry"), o = e("./support"); - function h(e2) { - this.files = [], this.loadOptions = e2; - } - h.prototype = { checkSignature: function(e2) { - if (!this.reader.readAndCheckSignature(e2)) { - this.reader.index -= 4; - var t2 = this.reader.readString(4); - throw new Error("Corrupted zip or bug: unexpected signature (" + i.pretty(t2) + ", expected " + i.pretty(e2) + ")"); - } - }, isSignature: function(e2, t2) { - var r2 = this.reader.index; - this.reader.setIndex(e2); - var n2 = this.reader.readString(4) === t2; - return this.reader.setIndex(r2), n2; - }, readBlockEndOfCentral: function() { - this.diskNumber = this.reader.readInt(2), this.diskWithCentralDirStart = this.reader.readInt(2), this.centralDirRecordsOnThisDisk = this.reader.readInt(2), this.centralDirRecords = this.reader.readInt(2), this.centralDirSize = this.reader.readInt(4), this.centralDirOffset = this.reader.readInt(4), this.zipCommentLength = this.reader.readInt(2); - var e2 = this.reader.readData(this.zipCommentLength), t2 = o.uint8array ? "uint8array" : "array", r2 = i.transformTo(t2, e2); - this.zipComment = this.loadOptions.decodeFileName(r2); - }, readBlockZip64EndOfCentral: function() { - this.zip64EndOfCentralSize = this.reader.readInt(8), this.reader.skip(4), this.diskNumber = this.reader.readInt(4), this.diskWithCentralDirStart = this.reader.readInt(4), this.centralDirRecordsOnThisDisk = this.reader.readInt(8), this.centralDirRecords = this.reader.readInt(8), this.centralDirSize = this.reader.readInt(8), this.centralDirOffset = this.reader.readInt(8), this.zip64ExtensibleData = {}; - for (var e2, t2, r2, n2 = this.zip64EndOfCentralSize - 44; 0 < n2; ) - e2 = this.reader.readInt(2), t2 = this.reader.readInt(4), r2 = this.reader.readData(t2), this.zip64ExtensibleData[e2] = { id: e2, length: t2, value: r2 }; - }, readBlockZip64EndOfCentralLocator: function() { - if (this.diskWithZip64CentralDirStart = this.reader.readInt(4), this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8), this.disksCount = this.reader.readInt(4), 1 < this.disksCount) - throw new Error("Multi-volumes zip are not supported"); - }, readLocalFiles: function() { - var e2, t2; - for (e2 = 0; e2 < this.files.length; e2++) - t2 = this.files[e2], this.reader.setIndex(t2.localHeaderOffset), this.checkSignature(s.LOCAL_FILE_HEADER), t2.readLocalPart(this.reader), t2.handleUTF8(), t2.processAttributes(); - }, readCentralDir: function() { - var e2; - for (this.reader.setIndex(this.centralDirOffset); this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER); ) - (e2 = new a({ zip64: this.zip64 }, this.loadOptions)).readCentralPart(this.reader), this.files.push(e2); - if (this.centralDirRecords !== this.files.length && 0 !== this.centralDirRecords && 0 === this.files.length) - throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length); - }, readEndOfCentral: function() { - var e2 = this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END); - if (e2 < 0) - throw !this.isSignature(0, s.LOCAL_FILE_HEADER) ? new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html") : new Error("Corrupted zip: can't find end of central directory"); - this.reader.setIndex(e2); - var t2 = e2; - if (this.checkSignature(s.CENTRAL_DIRECTORY_END), this.readBlockEndOfCentral(), this.diskNumber === i.MAX_VALUE_16BITS || this.diskWithCentralDirStart === i.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === i.MAX_VALUE_16BITS || this.centralDirRecords === i.MAX_VALUE_16BITS || this.centralDirSize === i.MAX_VALUE_32BITS || this.centralDirOffset === i.MAX_VALUE_32BITS) { - if (this.zip64 = true, (e2 = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR)) < 0) - throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator"); - if (this.reader.setIndex(e2), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR), this.readBlockZip64EndOfCentralLocator(), !this.isSignature(this.relativeOffsetEndOfZip64CentralDir, s.ZIP64_CENTRAL_DIRECTORY_END) && (this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.relativeOffsetEndOfZip64CentralDir < 0)) - throw new Error("Corrupted zip: can't find the ZIP64 end of central directory"); - this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.readBlockZip64EndOfCentral(); - } - var r2 = this.centralDirOffset + this.centralDirSize; - this.zip64 && (r2 += 20, r2 += 12 + this.zip64EndOfCentralSize); - var n2 = t2 - r2; - if (0 < n2) - this.isSignature(t2, s.CENTRAL_FILE_HEADER) || (this.reader.zero = n2); - else if (n2 < 0) - throw new Error("Corrupted zip: missing " + Math.abs(n2) + " bytes."); - }, prepareReader: function(e2) { - this.reader = n(e2); - }, load: function(e2) { - this.prepareReader(e2), this.readEndOfCentral(), this.readCentralDir(), this.readLocalFiles(); - } }, t.exports = h; - }, { "./reader/readerFor": 22, "./signature": 23, "./support": 30, "./utils": 32, "./zipEntry": 34 }], 34: [function(e, t, r) { - "use strict"; - var n = e("./reader/readerFor"), s = e("./utils"), i = e("./compressedObject"), a = e("./crc32"), o = e("./utf8"), h = e("./compressions"), u = e("./support"); - function l(e2, t2) { - this.options = e2, this.loadOptions = t2; - } - l.prototype = { isEncrypted: function() { - return 1 == (1 & this.bitFlag); - }, useUTF8: function() { - return 2048 == (2048 & this.bitFlag); - }, readLocalPart: function(e2) { - var t2, r2; - if (e2.skip(22), this.fileNameLength = e2.readInt(2), r2 = e2.readInt(2), this.fileName = e2.readData(this.fileNameLength), e2.skip(r2), -1 === this.compressedSize || -1 === this.uncompressedSize) - throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)"); - if (null === (t2 = function(e3) { - for (var t3 in h) - if (Object.prototype.hasOwnProperty.call(h, t3) && h[t3].magic === e3) - return h[t3]; - return null; - }(this.compressionMethod))) - throw new Error("Corrupted zip : compression " + s.pretty(this.compressionMethod) + " unknown (inner file : " + s.transformTo("string", this.fileName) + ")"); - this.decompressed = new i(this.compressedSize, this.uncompressedSize, this.crc32, t2, e2.readData(this.compressedSize)); - }, readCentralPart: function(e2) { - this.versionMadeBy = e2.readInt(2), e2.skip(2), this.bitFlag = e2.readInt(2), this.compressionMethod = e2.readString(2), this.date = e2.readDate(), this.crc32 = e2.readInt(4), this.compressedSize = e2.readInt(4), this.uncompressedSize = e2.readInt(4); - var t2 = e2.readInt(2); - if (this.extraFieldsLength = e2.readInt(2), this.fileCommentLength = e2.readInt(2), this.diskNumberStart = e2.readInt(2), this.internalFileAttributes = e2.readInt(2), this.externalFileAttributes = e2.readInt(4), this.localHeaderOffset = e2.readInt(4), this.isEncrypted()) - throw new Error("Encrypted zip are not supported"); - e2.skip(t2), this.readExtraFields(e2), this.parseZIP64ExtraField(e2), this.fileComment = e2.readData(this.fileCommentLength); - }, processAttributes: function() { - this.unixPermissions = null, this.dosPermissions = null; - var e2 = this.versionMadeBy >> 8; - this.dir = !!(16 & this.externalFileAttributes), 0 == e2 && (this.dosPermissions = 63 & this.externalFileAttributes), 3 == e2 && (this.unixPermissions = this.externalFileAttributes >> 16 & 65535), this.dir || "/" !== this.fileNameStr.slice(-1) || (this.dir = true); - }, parseZIP64ExtraField: function() { - if (this.extraFields[1]) { - var e2 = n(this.extraFields[1].value); - this.uncompressedSize === s.MAX_VALUE_32BITS && (this.uncompressedSize = e2.readInt(8)), this.compressedSize === s.MAX_VALUE_32BITS && (this.compressedSize = e2.readInt(8)), this.localHeaderOffset === s.MAX_VALUE_32BITS && (this.localHeaderOffset = e2.readInt(8)), this.diskNumberStart === s.MAX_VALUE_32BITS && (this.diskNumberStart = e2.readInt(4)); - } - }, readExtraFields: function(e2) { - var t2, r2, n2, i2 = e2.index + this.extraFieldsLength; - for (this.extraFields || (this.extraFields = {}); e2.index + 4 < i2; ) - t2 = e2.readInt(2), r2 = e2.readInt(2), n2 = e2.readData(r2), this.extraFields[t2] = { id: t2, length: r2, value: n2 }; - e2.setIndex(i2); - }, handleUTF8: function() { - var e2 = u.uint8array ? "uint8array" : "array"; - if (this.useUTF8()) - this.fileNameStr = o.utf8decode(this.fileName), this.fileCommentStr = o.utf8decode(this.fileComment); - else { - var t2 = this.findExtraFieldUnicodePath(); - if (null !== t2) - this.fileNameStr = t2; - else { - var r2 = s.transformTo(e2, this.fileName); - this.fileNameStr = this.loadOptions.decodeFileName(r2); - } - var n2 = this.findExtraFieldUnicodeComment(); - if (null !== n2) - this.fileCommentStr = n2; - else { - var i2 = s.transformTo(e2, this.fileComment); - this.fileCommentStr = this.loadOptions.decodeFileName(i2); - } - } - }, findExtraFieldUnicodePath: function() { - var e2 = this.extraFields[28789]; - if (e2) { - var t2 = n(e2.value); - return 1 !== t2.readInt(1) ? null : a(this.fileName) !== t2.readInt(4) ? null : o.utf8decode(t2.readData(e2.length - 5)); - } - return null; - }, findExtraFieldUnicodeComment: function() { - var e2 = this.extraFields[25461]; - if (e2) { - var t2 = n(e2.value); - return 1 !== t2.readInt(1) ? null : a(this.fileComment) !== t2.readInt(4) ? null : o.utf8decode(t2.readData(e2.length - 5)); - } - return null; - } }, t.exports = l; - }, { "./compressedObject": 2, "./compressions": 3, "./crc32": 4, "./reader/readerFor": 22, "./support": 30, "./utf8": 31, "./utils": 32 }], 35: [function(e, t, r) { - "use strict"; - function n(e2, t2, r2) { - this.name = e2, this.dir = r2.dir, this.date = r2.date, this.comment = r2.comment, this.unixPermissions = r2.unixPermissions, this.dosPermissions = r2.dosPermissions, this._data = t2, this._dataBinary = r2.binary, this.options = { compression: r2.compression, compressionOptions: r2.compressionOptions }; - } - var s = e("./stream/StreamHelper"), i = e("./stream/DataWorker"), a = e("./utf8"), o = e("./compressedObject"), h = e("./stream/GenericWorker"); - n.prototype = { internalStream: function(e2) { - var t2 = null, r2 = "string"; - try { - if (!e2) - throw new Error("No output type specified."); - var n2 = "string" === (r2 = e2.toLowerCase()) || "text" === r2; - "binarystring" !== r2 && "text" !== r2 || (r2 = "string"), t2 = this._decompressWorker(); - var i2 = !this._dataBinary; - i2 && !n2 && (t2 = t2.pipe(new a.Utf8EncodeWorker())), !i2 && n2 && (t2 = t2.pipe(new a.Utf8DecodeWorker())); - } catch (e3) { - (t2 = new h("error")).error(e3); - } - return new s(t2, r2, ""); - }, async: function(e2, t2) { - return this.internalStream(e2).accumulate(t2); - }, nodeStream: function(e2, t2) { - return this.internalStream(e2 || "nodebuffer").toNodejsStream(t2); - }, _compressWorker: function(e2, t2) { - if (this._data instanceof o && this._data.compression.magic === e2.magic) - return this._data.getCompressedWorker(); - var r2 = this._decompressWorker(); - return this._dataBinary || (r2 = r2.pipe(new a.Utf8EncodeWorker())), o.createWorkerFrom(r2, e2, t2); - }, _decompressWorker: function() { - return this._data instanceof o ? this._data.getContentWorker() : this._data instanceof h ? this._data : new i(this._data); - } }; - for (var u = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"], l = function() { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); - }, f = 0; f < u.length; f++) - n.prototype[u[f]] = l; - t.exports = n; - }, { "./compressedObject": 2, "./stream/DataWorker": 27, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31 }], 36: [function(e, l, t) { - (function(t2) { - "use strict"; - var r, n, e2 = t2.MutationObserver || t2.WebKitMutationObserver; - if (e2) { - var i = 0, s = new e2(u), a = t2.document.createTextNode(""); - s.observe(a, { characterData: true }), r = function() { - a.data = i = ++i % 2; - }; - } else if (t2.setImmediate || void 0 === t2.MessageChannel) - r = "document" in t2 && "onreadystatechange" in t2.document.createElement("script") ? function() { - var e3 = t2.document.createElement("script"); - e3.onreadystatechange = function() { - u(), e3.onreadystatechange = null, e3.parentNode.removeChild(e3), e3 = null; - }, t2.document.documentElement.appendChild(e3); - } : function() { - setTimeout(u, 0); - }; - else { - var o = new t2.MessageChannel(); - o.port1.onmessage = u, r = function() { - o.port2.postMessage(0); - }; - } - var h = []; - function u() { - var e3, t3; - n = true; - for (var r2 = h.length; r2; ) { - for (t3 = h, h = [], e3 = -1; ++e3 < r2; ) - t3[e3](); - r2 = h.length; - } - n = false; - } - l.exports = function(e3) { - 1 !== h.push(e3) || n || r(); - }; - }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}); - }, {}], 37: [function(e, t, r) { - "use strict"; - var i = e("immediate"); - function u() { - } - var l = {}, s = ["REJECTED"], a = ["FULFILLED"], n = ["PENDING"]; - function o(e2) { - if ("function" != typeof e2) - throw new TypeError("resolver must be a function"); - this.state = n, this.queue = [], this.outcome = void 0, e2 !== u && d(this, e2); - } - function h(e2, t2, r2) { - this.promise = e2, "function" == typeof t2 && (this.onFulfilled = t2, this.callFulfilled = this.otherCallFulfilled), "function" == typeof r2 && (this.onRejected = r2, this.callRejected = this.otherCallRejected); - } - function f(t2, r2, n2) { - i(function() { - var e2; - try { - e2 = r2(n2); - } catch (e3) { - return l.reject(t2, e3); - } - e2 === t2 ? l.reject(t2, new TypeError("Cannot resolve promise with itself")) : l.resolve(t2, e2); - }); - } - function c(e2) { - var t2 = e2 && e2.then; - if (e2 && ("object" == typeof e2 || "function" == typeof e2) && "function" == typeof t2) - return function() { - t2.apply(e2, arguments); - }; - } - function d(t2, e2) { - var r2 = false; - function n2(e3) { - r2 || (r2 = true, l.reject(t2, e3)); - } - function i2(e3) { - r2 || (r2 = true, l.resolve(t2, e3)); - } - var s2 = p(function() { - e2(i2, n2); - }); - "error" === s2.status && n2(s2.value); - } - function p(e2, t2) { - var r2 = {}; - try { - r2.value = e2(t2), r2.status = "success"; - } catch (e3) { - r2.status = "error", r2.value = e3; - } - return r2; - } - (t.exports = o).prototype.finally = function(t2) { - if ("function" != typeof t2) - return this; - var r2 = this.constructor; - return this.then(function(e2) { - return r2.resolve(t2()).then(function() { - return e2; - }); - }, function(e2) { - return r2.resolve(t2()).then(function() { - throw e2; - }); - }); - }, o.prototype.catch = function(e2) { - return this.then(null, e2); - }, o.prototype.then = function(e2, t2) { - if ("function" != typeof e2 && this.state === a || "function" != typeof t2 && this.state === s) - return this; - var r2 = new this.constructor(u); - this.state !== n ? f(r2, this.state === a ? e2 : t2, this.outcome) : this.queue.push(new h(r2, e2, t2)); - return r2; - }, h.prototype.callFulfilled = function(e2) { - l.resolve(this.promise, e2); - }, h.prototype.otherCallFulfilled = function(e2) { - f(this.promise, this.onFulfilled, e2); - }, h.prototype.callRejected = function(e2) { - l.reject(this.promise, e2); - }, h.prototype.otherCallRejected = function(e2) { - f(this.promise, this.onRejected, e2); - }, l.resolve = function(e2, t2) { - var r2 = p(c, t2); - if ("error" === r2.status) - return l.reject(e2, r2.value); - var n2 = r2.value; - if (n2) - d(e2, n2); - else { - e2.state = a, e2.outcome = t2; - for (var i2 = -1, s2 = e2.queue.length; ++i2 < s2; ) - e2.queue[i2].callFulfilled(t2); - } - return e2; - }, l.reject = function(e2, t2) { - e2.state = s, e2.outcome = t2; - for (var r2 = -1, n2 = e2.queue.length; ++r2 < n2; ) - e2.queue[r2].callRejected(t2); - return e2; - }, o.resolve = function(e2) { - if (e2 instanceof this) - return e2; - return l.resolve(new this(u), e2); - }, o.reject = function(e2) { - var t2 = new this(u); - return l.reject(t2, e2); - }, o.all = function(e2) { - var r2 = this; - if ("[object Array]" !== Object.prototype.toString.call(e2)) - return this.reject(new TypeError("must be an array")); - var n2 = e2.length, i2 = false; - if (!n2) - return this.resolve([]); - var s2 = new Array(n2), a2 = 0, t2 = -1, o2 = new this(u); - for (; ++t2 < n2; ) - h2(e2[t2], t2); - return o2; - function h2(e3, t3) { - r2.resolve(e3).then(function(e4) { - s2[t3] = e4, ++a2 !== n2 || i2 || (i2 = true, l.resolve(o2, s2)); - }, function(e4) { - i2 || (i2 = true, l.reject(o2, e4)); - }); - } - }, o.race = function(e2) { - var t2 = this; - if ("[object Array]" !== Object.prototype.toString.call(e2)) - return this.reject(new TypeError("must be an array")); - var r2 = e2.length, n2 = false; - if (!r2) - return this.resolve([]); - var i2 = -1, s2 = new this(u); - for (; ++i2 < r2; ) - a2 = e2[i2], t2.resolve(a2).then(function(e3) { - n2 || (n2 = true, l.resolve(s2, e3)); - }, function(e3) { - n2 || (n2 = true, l.reject(s2, e3)); - }); - var a2; - return s2; - }; - }, { immediate: 36 }], 38: [function(e, t, r) { - "use strict"; - var n = {}; - (0, e("./lib/utils/common").assign)(n, e("./lib/deflate"), e("./lib/inflate"), e("./lib/zlib/constants")), t.exports = n; - }, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function(e, t, r) { - "use strict"; - var a = e("./zlib/deflate"), o = e("./utils/common"), h = e("./utils/strings"), i = e("./zlib/messages"), s = e("./zlib/zstream"), u = Object.prototype.toString, l = 0, f = -1, c = 0, d = 8; - function p(e2) { - if (!(this instanceof p)) - return new p(e2); - this.options = o.assign({ level: f, method: d, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: c, to: "" }, e2 || {}); - var t2 = this.options; - t2.raw && 0 < t2.windowBits ? t2.windowBits = -t2.windowBits : t2.gzip && 0 < t2.windowBits && t2.windowBits < 16 && (t2.windowBits += 16), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new s(), this.strm.avail_out = 0; - var r2 = a.deflateInit2(this.strm, t2.level, t2.method, t2.windowBits, t2.memLevel, t2.strategy); - if (r2 !== l) - throw new Error(i[r2]); - if (t2.header && a.deflateSetHeader(this.strm, t2.header), t2.dictionary) { - var n2; - if (n2 = "string" == typeof t2.dictionary ? h.string2buf(t2.dictionary) : "[object ArrayBuffer]" === u.call(t2.dictionary) ? new Uint8Array(t2.dictionary) : t2.dictionary, (r2 = a.deflateSetDictionary(this.strm, n2)) !== l) - throw new Error(i[r2]); - this._dict_set = true; - } - } - function n(e2, t2) { - var r2 = new p(t2); - if (r2.push(e2, true), r2.err) - throw r2.msg || i[r2.err]; - return r2.result; - } - p.prototype.push = function(e2, t2) { - var r2, n2, i2 = this.strm, s2 = this.options.chunkSize; - if (this.ended) - return false; - n2 = t2 === ~~t2 ? t2 : true === t2 ? 4 : 0, "string" == typeof e2 ? i2.input = h.string2buf(e2) : "[object ArrayBuffer]" === u.call(e2) ? i2.input = new Uint8Array(e2) : i2.input = e2, i2.next_in = 0, i2.avail_in = i2.input.length; - do { - if (0 === i2.avail_out && (i2.output = new o.Buf8(s2), i2.next_out = 0, i2.avail_out = s2), 1 !== (r2 = a.deflate(i2, n2)) && r2 !== l) - return this.onEnd(r2), !(this.ended = true); - 0 !== i2.avail_out && (0 !== i2.avail_in || 4 !== n2 && 2 !== n2) || ("string" === this.options.to ? this.onData(h.buf2binstring(o.shrinkBuf(i2.output, i2.next_out))) : this.onData(o.shrinkBuf(i2.output, i2.next_out))); - } while ((0 < i2.avail_in || 0 === i2.avail_out) && 1 !== r2); - return 4 === n2 ? (r2 = a.deflateEnd(this.strm), this.onEnd(r2), this.ended = true, r2 === l) : 2 !== n2 || (this.onEnd(l), !(i2.avail_out = 0)); - }, p.prototype.onData = function(e2) { - this.chunks.push(e2); - }, p.prototype.onEnd = function(e2) { - e2 === l && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = o.flattenChunks(this.chunks)), this.chunks = [], this.err = e2, this.msg = this.strm.msg; - }, r.Deflate = p, r.deflate = n, r.deflateRaw = function(e2, t2) { - return (t2 = t2 || {}).raw = true, n(e2, t2); - }, r.gzip = function(e2, t2) { - return (t2 = t2 || {}).gzip = true, n(e2, t2); - }; - }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(e, t, r) { - "use strict"; - var c = e("./zlib/inflate"), d = e("./utils/common"), p = e("./utils/strings"), m = e("./zlib/constants"), n = e("./zlib/messages"), i = e("./zlib/zstream"), s = e("./zlib/gzheader"), _ = Object.prototype.toString; - function a(e2) { - if (!(this instanceof a)) - return new a(e2); - this.options = d.assign({ chunkSize: 16384, windowBits: 0, to: "" }, e2 || {}); - var t2 = this.options; - t2.raw && 0 <= t2.windowBits && t2.windowBits < 16 && (t2.windowBits = -t2.windowBits, 0 === t2.windowBits && (t2.windowBits = -15)), !(0 <= t2.windowBits && t2.windowBits < 16) || e2 && e2.windowBits || (t2.windowBits += 32), 15 < t2.windowBits && t2.windowBits < 48 && 0 == (15 & t2.windowBits) && (t2.windowBits |= 15), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new i(), this.strm.avail_out = 0; - var r2 = c.inflateInit2(this.strm, t2.windowBits); - if (r2 !== m.Z_OK) - throw new Error(n[r2]); - this.header = new s(), c.inflateGetHeader(this.strm, this.header); - } - function o(e2, t2) { - var r2 = new a(t2); - if (r2.push(e2, true), r2.err) - throw r2.msg || n[r2.err]; - return r2.result; - } - a.prototype.push = function(e2, t2) { - var r2, n2, i2, s2, a2, o2, h = this.strm, u = this.options.chunkSize, l = this.options.dictionary, f = false; - if (this.ended) - return false; - n2 = t2 === ~~t2 ? t2 : true === t2 ? m.Z_FINISH : m.Z_NO_FLUSH, "string" == typeof e2 ? h.input = p.binstring2buf(e2) : "[object ArrayBuffer]" === _.call(e2) ? h.input = new Uint8Array(e2) : h.input = e2, h.next_in = 0, h.avail_in = h.input.length; - do { - if (0 === h.avail_out && (h.output = new d.Buf8(u), h.next_out = 0, h.avail_out = u), (r2 = c.inflate(h, m.Z_NO_FLUSH)) === m.Z_NEED_DICT && l && (o2 = "string" == typeof l ? p.string2buf(l) : "[object ArrayBuffer]" === _.call(l) ? new Uint8Array(l) : l, r2 = c.inflateSetDictionary(this.strm, o2)), r2 === m.Z_BUF_ERROR && true === f && (r2 = m.Z_OK, f = false), r2 !== m.Z_STREAM_END && r2 !== m.Z_OK) - return this.onEnd(r2), !(this.ended = true); - h.next_out && (0 !== h.avail_out && r2 !== m.Z_STREAM_END && (0 !== h.avail_in || n2 !== m.Z_FINISH && n2 !== m.Z_SYNC_FLUSH) || ("string" === this.options.to ? (i2 = p.utf8border(h.output, h.next_out), s2 = h.next_out - i2, a2 = p.buf2string(h.output, i2), h.next_out = s2, h.avail_out = u - s2, s2 && d.arraySet(h.output, h.output, i2, s2, 0), this.onData(a2)) : this.onData(d.shrinkBuf(h.output, h.next_out)))), 0 === h.avail_in && 0 === h.avail_out && (f = true); - } while ((0 < h.avail_in || 0 === h.avail_out) && r2 !== m.Z_STREAM_END); - return r2 === m.Z_STREAM_END && (n2 = m.Z_FINISH), n2 === m.Z_FINISH ? (r2 = c.inflateEnd(this.strm), this.onEnd(r2), this.ended = true, r2 === m.Z_OK) : n2 !== m.Z_SYNC_FLUSH || (this.onEnd(m.Z_OK), !(h.avail_out = 0)); - }, a.prototype.onData = function(e2) { - this.chunks.push(e2); - }, a.prototype.onEnd = function(e2) { - e2 === m.Z_OK && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = d.flattenChunks(this.chunks)), this.chunks = [], this.err = e2, this.msg = this.strm.msg; - }, r.Inflate = a, r.inflate = o, r.inflateRaw = function(e2, t2) { - return (t2 = t2 || {}).raw = true, o(e2, t2); - }, r.ungzip = o; - }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/constants": 44, "./zlib/gzheader": 47, "./zlib/inflate": 49, "./zlib/messages": 51, "./zlib/zstream": 53 }], 41: [function(e, t, r) { - "use strict"; - var n = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Int32Array; - r.assign = function(e2) { - for (var t2 = Array.prototype.slice.call(arguments, 1); t2.length; ) { - var r2 = t2.shift(); - if (r2) { - if ("object" != typeof r2) - throw new TypeError(r2 + "must be non-object"); - for (var n2 in r2) - r2.hasOwnProperty(n2) && (e2[n2] = r2[n2]); - } - } - return e2; - }, r.shrinkBuf = function(e2, t2) { - return e2.length === t2 ? e2 : e2.subarray ? e2.subarray(0, t2) : (e2.length = t2, e2); - }; - var i = { arraySet: function(e2, t2, r2, n2, i2) { - if (t2.subarray && e2.subarray) - e2.set(t2.subarray(r2, r2 + n2), i2); - else - for (var s2 = 0; s2 < n2; s2++) - e2[i2 + s2] = t2[r2 + s2]; - }, flattenChunks: function(e2) { - var t2, r2, n2, i2, s2, a; - for (t2 = n2 = 0, r2 = e2.length; t2 < r2; t2++) - n2 += e2[t2].length; - for (a = new Uint8Array(n2), t2 = i2 = 0, r2 = e2.length; t2 < r2; t2++) - s2 = e2[t2], a.set(s2, i2), i2 += s2.length; - return a; - } }, s = { arraySet: function(e2, t2, r2, n2, i2) { - for (var s2 = 0; s2 < n2; s2++) - e2[i2 + s2] = t2[r2 + s2]; - }, flattenChunks: function(e2) { - return [].concat.apply([], e2); - } }; - r.setTyped = function(e2) { - e2 ? (r.Buf8 = Uint8Array, r.Buf16 = Uint16Array, r.Buf32 = Int32Array, r.assign(r, i)) : (r.Buf8 = Array, r.Buf16 = Array, r.Buf32 = Array, r.assign(r, s)); - }, r.setTyped(n); - }, {}], 42: [function(e, t, r) { - "use strict"; - var h = e("./common"), i = true, s = true; - try { - String.fromCharCode.apply(null, [0]); - } catch (e2) { - i = false; - } - try { - String.fromCharCode.apply(null, new Uint8Array(1)); - } catch (e2) { - s = false; - } - for (var u = new h.Buf8(256), n = 0; n < 256; n++) - u[n] = 252 <= n ? 6 : 248 <= n ? 5 : 240 <= n ? 4 : 224 <= n ? 3 : 192 <= n ? 2 : 1; - function l(e2, t2) { - if (t2 < 65537 && (e2.subarray && s || !e2.subarray && i)) - return String.fromCharCode.apply(null, h.shrinkBuf(e2, t2)); - for (var r2 = "", n2 = 0; n2 < t2; n2++) - r2 += String.fromCharCode(e2[n2]); - return r2; - } - u[254] = u[254] = 1, r.string2buf = function(e2) { - var t2, r2, n2, i2, s2, a = e2.length, o = 0; - for (i2 = 0; i2 < a; i2++) - 55296 == (64512 & (r2 = e2.charCodeAt(i2))) && i2 + 1 < a && 56320 == (64512 & (n2 = e2.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), o += r2 < 128 ? 1 : r2 < 2048 ? 2 : r2 < 65536 ? 3 : 4; - for (t2 = new h.Buf8(o), i2 = s2 = 0; s2 < o; i2++) - 55296 == (64512 & (r2 = e2.charCodeAt(i2))) && i2 + 1 < a && 56320 == (64512 & (n2 = e2.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), r2 < 128 ? t2[s2++] = r2 : (r2 < 2048 ? t2[s2++] = 192 | r2 >>> 6 : (r2 < 65536 ? t2[s2++] = 224 | r2 >>> 12 : (t2[s2++] = 240 | r2 >>> 18, t2[s2++] = 128 | r2 >>> 12 & 63), t2[s2++] = 128 | r2 >>> 6 & 63), t2[s2++] = 128 | 63 & r2); - return t2; - }, r.buf2binstring = function(e2) { - return l(e2, e2.length); - }, r.binstring2buf = function(e2) { - for (var t2 = new h.Buf8(e2.length), r2 = 0, n2 = t2.length; r2 < n2; r2++) - t2[r2] = e2.charCodeAt(r2); - return t2; - }, r.buf2string = function(e2, t2) { - var r2, n2, i2, s2, a = t2 || e2.length, o = new Array(2 * a); - for (r2 = n2 = 0; r2 < a; ) - if ((i2 = e2[r2++]) < 128) - o[n2++] = i2; - else if (4 < (s2 = u[i2])) - o[n2++] = 65533, r2 += s2 - 1; - else { - for (i2 &= 2 === s2 ? 31 : 3 === s2 ? 15 : 7; 1 < s2 && r2 < a; ) - i2 = i2 << 6 | 63 & e2[r2++], s2--; - 1 < s2 ? o[n2++] = 65533 : i2 < 65536 ? o[n2++] = i2 : (i2 -= 65536, o[n2++] = 55296 | i2 >> 10 & 1023, o[n2++] = 56320 | 1023 & i2); - } - return l(o, n2); - }, r.utf8border = function(e2, t2) { - var r2; - for ((t2 = t2 || e2.length) > e2.length && (t2 = e2.length), r2 = t2 - 1; 0 <= r2 && 128 == (192 & e2[r2]); ) - r2--; - return r2 < 0 ? t2 : 0 === r2 ? t2 : r2 + u[e2[r2]] > t2 ? r2 : t2; - }; - }, { "./common": 41 }], 43: [function(e, t, r) { - "use strict"; - t.exports = function(e2, t2, r2, n) { - for (var i = 65535 & e2 | 0, s = e2 >>> 16 & 65535 | 0, a = 0; 0 !== r2; ) { - for (r2 -= a = 2e3 < r2 ? 2e3 : r2; s = s + (i = i + t2[n++] | 0) | 0, --a; ) - ; - i %= 65521, s %= 65521; - } - return i | s << 16 | 0; - }; - }, {}], 44: [function(e, t, r) { - "use strict"; - t.exports = { Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, Z_BUF_ERROR: -5, Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, Z_BINARY: 0, Z_TEXT: 1, Z_UNKNOWN: 2, Z_DEFLATED: 8 }; - }, {}], 45: [function(e, t, r) { - "use strict"; - var o = function() { - for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) { - e2 = r2; - for (var n = 0; n < 8; n++) - e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1; - t2[r2] = e2; - } - return t2; - }(); - t.exports = function(e2, t2, r2, n) { - var i = o, s = n + r2; - e2 ^= -1; - for (var a = n; a < s; a++) - e2 = e2 >>> 8 ^ i[255 & (e2 ^ t2[a])]; - return -1 ^ e2; - }; - }, {}], 46: [function(e, t, r) { - "use strict"; - var h, c = e("../utils/common"), u = e("./trees"), d = e("./adler32"), p = e("./crc32"), n = e("./messages"), l = 0, f = 4, m = 0, _ = -2, g = -1, b = 4, i = 2, v = 8, y = 9, s = 286, a = 30, o = 19, w = 2 * s + 1, k = 15, x = 3, S = 258, z = S + x + 1, C = 42, E = 113, A = 1, I = 2, O = 3, B = 4; - function R(e2, t2) { - return e2.msg = n[t2], t2; - } - function T(e2) { - return (e2 << 1) - (4 < e2 ? 9 : 0); - } - function D(e2) { - for (var t2 = e2.length; 0 <= --t2; ) - e2[t2] = 0; - } - function F(e2) { - var t2 = e2.state, r2 = t2.pending; - r2 > e2.avail_out && (r2 = e2.avail_out), 0 !== r2 && (c.arraySet(e2.output, t2.pending_buf, t2.pending_out, r2, e2.next_out), e2.next_out += r2, t2.pending_out += r2, e2.total_out += r2, e2.avail_out -= r2, t2.pending -= r2, 0 === t2.pending && (t2.pending_out = 0)); - } - function N(e2, t2) { - u._tr_flush_block(e2, 0 <= e2.block_start ? e2.block_start : -1, e2.strstart - e2.block_start, t2), e2.block_start = e2.strstart, F(e2.strm); - } - function U(e2, t2) { - e2.pending_buf[e2.pending++] = t2; - } - function P(e2, t2) { - e2.pending_buf[e2.pending++] = t2 >>> 8 & 255, e2.pending_buf[e2.pending++] = 255 & t2; - } - function L(e2, t2) { - var r2, n2, i2 = e2.max_chain_length, s2 = e2.strstart, a2 = e2.prev_length, o2 = e2.nice_match, h2 = e2.strstart > e2.w_size - z ? e2.strstart - (e2.w_size - z) : 0, u2 = e2.window, l2 = e2.w_mask, f2 = e2.prev, c2 = e2.strstart + S, d2 = u2[s2 + a2 - 1], p2 = u2[s2 + a2]; - e2.prev_length >= e2.good_match && (i2 >>= 2), o2 > e2.lookahead && (o2 = e2.lookahead); - do { - if (u2[(r2 = t2) + a2] === p2 && u2[r2 + a2 - 1] === d2 && u2[r2] === u2[s2] && u2[++r2] === u2[s2 + 1]) { - s2 += 2, r2++; - do { - } while (u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && s2 < c2); - if (n2 = S - (c2 - s2), s2 = c2 - S, a2 < n2) { - if (e2.match_start = t2, o2 <= (a2 = n2)) - break; - d2 = u2[s2 + a2 - 1], p2 = u2[s2 + a2]; - } - } - } while ((t2 = f2[t2 & l2]) > h2 && 0 != --i2); - return a2 <= e2.lookahead ? a2 : e2.lookahead; - } - function j(e2) { - var t2, r2, n2, i2, s2, a2, o2, h2, u2, l2, f2 = e2.w_size; - do { - if (i2 = e2.window_size - e2.lookahead - e2.strstart, e2.strstart >= f2 + (f2 - z)) { - for (c.arraySet(e2.window, e2.window, f2, f2, 0), e2.match_start -= f2, e2.strstart -= f2, e2.block_start -= f2, t2 = r2 = e2.hash_size; n2 = e2.head[--t2], e2.head[t2] = f2 <= n2 ? n2 - f2 : 0, --r2; ) - ; - for (t2 = r2 = f2; n2 = e2.prev[--t2], e2.prev[t2] = f2 <= n2 ? n2 - f2 : 0, --r2; ) - ; - i2 += f2; - } - if (0 === e2.strm.avail_in) - break; - if (a2 = e2.strm, o2 = e2.window, h2 = e2.strstart + e2.lookahead, u2 = i2, l2 = void 0, l2 = a2.avail_in, u2 < l2 && (l2 = u2), r2 = 0 === l2 ? 0 : (a2.avail_in -= l2, c.arraySet(o2, a2.input, a2.next_in, l2, h2), 1 === a2.state.wrap ? a2.adler = d(a2.adler, o2, l2, h2) : 2 === a2.state.wrap && (a2.adler = p(a2.adler, o2, l2, h2)), a2.next_in += l2, a2.total_in += l2, l2), e2.lookahead += r2, e2.lookahead + e2.insert >= x) - for (s2 = e2.strstart - e2.insert, e2.ins_h = e2.window[s2], e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[s2 + 1]) & e2.hash_mask; e2.insert && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[s2 + x - 1]) & e2.hash_mask, e2.prev[s2 & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = s2, s2++, e2.insert--, !(e2.lookahead + e2.insert < x)); ) - ; - } while (e2.lookahead < z && 0 !== e2.strm.avail_in); - } - function Z(e2, t2) { - for (var r2, n2; ; ) { - if (e2.lookahead < z) { - if (j(e2), e2.lookahead < z && t2 === l) - return A; - if (0 === e2.lookahead) - break; - } - if (r2 = 0, e2.lookahead >= x && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), 0 !== r2 && e2.strstart - r2 <= e2.w_size - z && (e2.match_length = L(e2, r2)), e2.match_length >= x) - if (n2 = u._tr_tally(e2, e2.strstart - e2.match_start, e2.match_length - x), e2.lookahead -= e2.match_length, e2.match_length <= e2.max_lazy_match && e2.lookahead >= x) { - for (e2.match_length--; e2.strstart++, e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart, 0 != --e2.match_length; ) - ; - e2.strstart++; - } else - e2.strstart += e2.match_length, e2.match_length = 0, e2.ins_h = e2.window[e2.strstart], e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + 1]) & e2.hash_mask; - else - n2 = u._tr_tally(e2, 0, e2.window[e2.strstart]), e2.lookahead--, e2.strstart++; - if (n2 && (N(e2, false), 0 === e2.strm.avail_out)) - return A; - } - return e2.insert = e2.strstart < x - 1 ? e2.strstart : x - 1, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : e2.last_lit && (N(e2, false), 0 === e2.strm.avail_out) ? A : I; - } - function W(e2, t2) { - for (var r2, n2, i2; ; ) { - if (e2.lookahead < z) { - if (j(e2), e2.lookahead < z && t2 === l) - return A; - if (0 === e2.lookahead) - break; - } - if (r2 = 0, e2.lookahead >= x && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), e2.prev_length = e2.match_length, e2.prev_match = e2.match_start, e2.match_length = x - 1, 0 !== r2 && e2.prev_length < e2.max_lazy_match && e2.strstart - r2 <= e2.w_size - z && (e2.match_length = L(e2, r2), e2.match_length <= 5 && (1 === e2.strategy || e2.match_length === x && 4096 < e2.strstart - e2.match_start) && (e2.match_length = x - 1)), e2.prev_length >= x && e2.match_length <= e2.prev_length) { - for (i2 = e2.strstart + e2.lookahead - x, n2 = u._tr_tally(e2, e2.strstart - 1 - e2.prev_match, e2.prev_length - x), e2.lookahead -= e2.prev_length - 1, e2.prev_length -= 2; ++e2.strstart <= i2 && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), 0 != --e2.prev_length; ) - ; - if (e2.match_available = 0, e2.match_length = x - 1, e2.strstart++, n2 && (N(e2, false), 0 === e2.strm.avail_out)) - return A; - } else if (e2.match_available) { - if ((n2 = u._tr_tally(e2, 0, e2.window[e2.strstart - 1])) && N(e2, false), e2.strstart++, e2.lookahead--, 0 === e2.strm.avail_out) - return A; - } else - e2.match_available = 1, e2.strstart++, e2.lookahead--; - } - return e2.match_available && (n2 = u._tr_tally(e2, 0, e2.window[e2.strstart - 1]), e2.match_available = 0), e2.insert = e2.strstart < x - 1 ? e2.strstart : x - 1, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : e2.last_lit && (N(e2, false), 0 === e2.strm.avail_out) ? A : I; - } - function M(e2, t2, r2, n2, i2) { - this.good_length = e2, this.max_lazy = t2, this.nice_length = r2, this.max_chain = n2, this.func = i2; - } - function H() { - this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = v, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new c.Buf16(2 * w), this.dyn_dtree = new c.Buf16(2 * (2 * a + 1)), this.bl_tree = new c.Buf16(2 * (2 * o + 1)), D(this.dyn_ltree), D(this.dyn_dtree), D(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new c.Buf16(k + 1), this.heap = new c.Buf16(2 * s + 1), D(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new c.Buf16(2 * s + 1), D(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0; - } - function G(e2) { - var t2; - return e2 && e2.state ? (e2.total_in = e2.total_out = 0, e2.data_type = i, (t2 = e2.state).pending = 0, t2.pending_out = 0, t2.wrap < 0 && (t2.wrap = -t2.wrap), t2.status = t2.wrap ? C : E, e2.adler = 2 === t2.wrap ? 0 : 1, t2.last_flush = l, u._tr_init(t2), m) : R(e2, _); - } - function K(e2) { - var t2 = G(e2); - return t2 === m && function(e3) { - e3.window_size = 2 * e3.w_size, D(e3.head), e3.max_lazy_match = h[e3.level].max_lazy, e3.good_match = h[e3.level].good_length, e3.nice_match = h[e3.level].nice_length, e3.max_chain_length = h[e3.level].max_chain, e3.strstart = 0, e3.block_start = 0, e3.lookahead = 0, e3.insert = 0, e3.match_length = e3.prev_length = x - 1, e3.match_available = 0, e3.ins_h = 0; - }(e2.state), t2; - } - function Y(e2, t2, r2, n2, i2, s2) { - if (!e2) - return _; - var a2 = 1; - if (t2 === g && (t2 = 6), n2 < 0 ? (a2 = 0, n2 = -n2) : 15 < n2 && (a2 = 2, n2 -= 16), i2 < 1 || y < i2 || r2 !== v || n2 < 8 || 15 < n2 || t2 < 0 || 9 < t2 || s2 < 0 || b < s2) - return R(e2, _); - 8 === n2 && (n2 = 9); - var o2 = new H(); - return (e2.state = o2).strm = e2, o2.wrap = a2, o2.gzhead = null, o2.w_bits = n2, o2.w_size = 1 << o2.w_bits, o2.w_mask = o2.w_size - 1, o2.hash_bits = i2 + 7, o2.hash_size = 1 << o2.hash_bits, o2.hash_mask = o2.hash_size - 1, o2.hash_shift = ~~((o2.hash_bits + x - 1) / x), o2.window = new c.Buf8(2 * o2.w_size), o2.head = new c.Buf16(o2.hash_size), o2.prev = new c.Buf16(o2.w_size), o2.lit_bufsize = 1 << i2 + 6, o2.pending_buf_size = 4 * o2.lit_bufsize, o2.pending_buf = new c.Buf8(o2.pending_buf_size), o2.d_buf = 1 * o2.lit_bufsize, o2.l_buf = 3 * o2.lit_bufsize, o2.level = t2, o2.strategy = s2, o2.method = r2, K(e2); - } - h = [new M(0, 0, 0, 0, function(e2, t2) { - var r2 = 65535; - for (r2 > e2.pending_buf_size - 5 && (r2 = e2.pending_buf_size - 5); ; ) { - if (e2.lookahead <= 1) { - if (j(e2), 0 === e2.lookahead && t2 === l) - return A; - if (0 === e2.lookahead) - break; - } - e2.strstart += e2.lookahead, e2.lookahead = 0; - var n2 = e2.block_start + r2; - if ((0 === e2.strstart || e2.strstart >= n2) && (e2.lookahead = e2.strstart - n2, e2.strstart = n2, N(e2, false), 0 === e2.strm.avail_out)) - return A; - if (e2.strstart - e2.block_start >= e2.w_size - z && (N(e2, false), 0 === e2.strm.avail_out)) - return A; - } - return e2.insert = 0, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : (e2.strstart > e2.block_start && (N(e2, false), e2.strm.avail_out), A); - }), new M(4, 4, 8, 4, Z), new M(4, 5, 16, 8, Z), new M(4, 6, 32, 32, Z), new M(4, 4, 16, 16, W), new M(8, 16, 32, 32, W), new M(8, 16, 128, 128, W), new M(8, 32, 128, 256, W), new M(32, 128, 258, 1024, W), new M(32, 258, 258, 4096, W)], r.deflateInit = function(e2, t2) { - return Y(e2, t2, v, 15, 8, 0); - }, r.deflateInit2 = Y, r.deflateReset = K, r.deflateResetKeep = G, r.deflateSetHeader = function(e2, t2) { - return e2 && e2.state ? 2 !== e2.state.wrap ? _ : (e2.state.gzhead = t2, m) : _; - }, r.deflate = function(e2, t2) { - var r2, n2, i2, s2; - if (!e2 || !e2.state || 5 < t2 || t2 < 0) - return e2 ? R(e2, _) : _; - if (n2 = e2.state, !e2.output || !e2.input && 0 !== e2.avail_in || 666 === n2.status && t2 !== f) - return R(e2, 0 === e2.avail_out ? -5 : _); - if (n2.strm = e2, r2 = n2.last_flush, n2.last_flush = t2, n2.status === C) - if (2 === n2.wrap) - e2.adler = 0, U(n2, 31), U(n2, 139), U(n2, 8), n2.gzhead ? (U(n2, (n2.gzhead.text ? 1 : 0) + (n2.gzhead.hcrc ? 2 : 0) + (n2.gzhead.extra ? 4 : 0) + (n2.gzhead.name ? 8 : 0) + (n2.gzhead.comment ? 16 : 0)), U(n2, 255 & n2.gzhead.time), U(n2, n2.gzhead.time >> 8 & 255), U(n2, n2.gzhead.time >> 16 & 255), U(n2, n2.gzhead.time >> 24 & 255), U(n2, 9 === n2.level ? 2 : 2 <= n2.strategy || n2.level < 2 ? 4 : 0), U(n2, 255 & n2.gzhead.os), n2.gzhead.extra && n2.gzhead.extra.length && (U(n2, 255 & n2.gzhead.extra.length), U(n2, n2.gzhead.extra.length >> 8 & 255)), n2.gzhead.hcrc && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending, 0)), n2.gzindex = 0, n2.status = 69) : (U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 9 === n2.level ? 2 : 2 <= n2.strategy || n2.level < 2 ? 4 : 0), U(n2, 3), n2.status = E); - else { - var a2 = v + (n2.w_bits - 8 << 4) << 8; - a2 |= (2 <= n2.strategy || n2.level < 2 ? 0 : n2.level < 6 ? 1 : 6 === n2.level ? 2 : 3) << 6, 0 !== n2.strstart && (a2 |= 32), a2 += 31 - a2 % 31, n2.status = E, P(n2, a2), 0 !== n2.strstart && (P(n2, e2.adler >>> 16), P(n2, 65535 & e2.adler)), e2.adler = 1; - } - if (69 === n2.status) - if (n2.gzhead.extra) { - for (i2 = n2.pending; n2.gzindex < (65535 & n2.gzhead.extra.length) && (n2.pending !== n2.pending_buf_size || (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending !== n2.pending_buf_size)); ) - U(n2, 255 & n2.gzhead.extra[n2.gzindex]), n2.gzindex++; - n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), n2.gzindex === n2.gzhead.extra.length && (n2.gzindex = 0, n2.status = 73); - } else - n2.status = 73; - if (73 === n2.status) - if (n2.gzhead.name) { - i2 = n2.pending; - do { - if (n2.pending === n2.pending_buf_size && (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending === n2.pending_buf_size)) { - s2 = 1; - break; - } - s2 = n2.gzindex < n2.gzhead.name.length ? 255 & n2.gzhead.name.charCodeAt(n2.gzindex++) : 0, U(n2, s2); - } while (0 !== s2); - n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), 0 === s2 && (n2.gzindex = 0, n2.status = 91); - } else - n2.status = 91; - if (91 === n2.status) - if (n2.gzhead.comment) { - i2 = n2.pending; - do { - if (n2.pending === n2.pending_buf_size && (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending === n2.pending_buf_size)) { - s2 = 1; - break; - } - s2 = n2.gzindex < n2.gzhead.comment.length ? 255 & n2.gzhead.comment.charCodeAt(n2.gzindex++) : 0, U(n2, s2); - } while (0 !== s2); - n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), 0 === s2 && (n2.status = 103); - } else - n2.status = 103; - if (103 === n2.status && (n2.gzhead.hcrc ? (n2.pending + 2 > n2.pending_buf_size && F(e2), n2.pending + 2 <= n2.pending_buf_size && (U(n2, 255 & e2.adler), U(n2, e2.adler >> 8 & 255), e2.adler = 0, n2.status = E)) : n2.status = E), 0 !== n2.pending) { - if (F(e2), 0 === e2.avail_out) - return n2.last_flush = -1, m; - } else if (0 === e2.avail_in && T(t2) <= T(r2) && t2 !== f) - return R(e2, -5); - if (666 === n2.status && 0 !== e2.avail_in) - return R(e2, -5); - if (0 !== e2.avail_in || 0 !== n2.lookahead || t2 !== l && 666 !== n2.status) { - var o2 = 2 === n2.strategy ? function(e3, t3) { - for (var r3; ; ) { - if (0 === e3.lookahead && (j(e3), 0 === e3.lookahead)) { - if (t3 === l) - return A; - break; - } - if (e3.match_length = 0, r3 = u._tr_tally(e3, 0, e3.window[e3.strstart]), e3.lookahead--, e3.strstart++, r3 && (N(e3, false), 0 === e3.strm.avail_out)) - return A; - } - return e3.insert = 0, t3 === f ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I; - }(n2, t2) : 3 === n2.strategy ? function(e3, t3) { - for (var r3, n3, i3, s3, a3 = e3.window; ; ) { - if (e3.lookahead <= S) { - if (j(e3), e3.lookahead <= S && t3 === l) - return A; - if (0 === e3.lookahead) - break; - } - if (e3.match_length = 0, e3.lookahead >= x && 0 < e3.strstart && (n3 = a3[i3 = e3.strstart - 1]) === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]) { - s3 = e3.strstart + S; - do { - } while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && i3 < s3); - e3.match_length = S - (s3 - i3), e3.match_length > e3.lookahead && (e3.match_length = e3.lookahead); - } - if (e3.match_length >= x ? (r3 = u._tr_tally(e3, 1, e3.match_length - x), e3.lookahead -= e3.match_length, e3.strstart += e3.match_length, e3.match_length = 0) : (r3 = u._tr_tally(e3, 0, e3.window[e3.strstart]), e3.lookahead--, e3.strstart++), r3 && (N(e3, false), 0 === e3.strm.avail_out)) - return A; - } - return e3.insert = 0, t3 === f ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I; - }(n2, t2) : h[n2.level].func(n2, t2); - if (o2 !== O && o2 !== B || (n2.status = 666), o2 === A || o2 === O) - return 0 === e2.avail_out && (n2.last_flush = -1), m; - if (o2 === I && (1 === t2 ? u._tr_align(n2) : 5 !== t2 && (u._tr_stored_block(n2, 0, 0, false), 3 === t2 && (D(n2.head), 0 === n2.lookahead && (n2.strstart = 0, n2.block_start = 0, n2.insert = 0))), F(e2), 0 === e2.avail_out)) - return n2.last_flush = -1, m; - } - return t2 !== f ? m : n2.wrap <= 0 ? 1 : (2 === n2.wrap ? (U(n2, 255 & e2.adler), U(n2, e2.adler >> 8 & 255), U(n2, e2.adler >> 16 & 255), U(n2, e2.adler >> 24 & 255), U(n2, 255 & e2.total_in), U(n2, e2.total_in >> 8 & 255), U(n2, e2.total_in >> 16 & 255), U(n2, e2.total_in >> 24 & 255)) : (P(n2, e2.adler >>> 16), P(n2, 65535 & e2.adler)), F(e2), 0 < n2.wrap && (n2.wrap = -n2.wrap), 0 !== n2.pending ? m : 1); - }, r.deflateEnd = function(e2) { - var t2; - return e2 && e2.state ? (t2 = e2.state.status) !== C && 69 !== t2 && 73 !== t2 && 91 !== t2 && 103 !== t2 && t2 !== E && 666 !== t2 ? R(e2, _) : (e2.state = null, t2 === E ? R(e2, -3) : m) : _; - }, r.deflateSetDictionary = function(e2, t2) { - var r2, n2, i2, s2, a2, o2, h2, u2, l2 = t2.length; - if (!e2 || !e2.state) - return _; - if (2 === (s2 = (r2 = e2.state).wrap) || 1 === s2 && r2.status !== C || r2.lookahead) - return _; - for (1 === s2 && (e2.adler = d(e2.adler, t2, l2, 0)), r2.wrap = 0, l2 >= r2.w_size && (0 === s2 && (D(r2.head), r2.strstart = 0, r2.block_start = 0, r2.insert = 0), u2 = new c.Buf8(r2.w_size), c.arraySet(u2, t2, l2 - r2.w_size, r2.w_size, 0), t2 = u2, l2 = r2.w_size), a2 = e2.avail_in, o2 = e2.next_in, h2 = e2.input, e2.avail_in = l2, e2.next_in = 0, e2.input = t2, j(r2); r2.lookahead >= x; ) { - for (n2 = r2.strstart, i2 = r2.lookahead - (x - 1); r2.ins_h = (r2.ins_h << r2.hash_shift ^ r2.window[n2 + x - 1]) & r2.hash_mask, r2.prev[n2 & r2.w_mask] = r2.head[r2.ins_h], r2.head[r2.ins_h] = n2, n2++, --i2; ) - ; - r2.strstart = n2, r2.lookahead = x - 1, j(r2); - } - return r2.strstart += r2.lookahead, r2.block_start = r2.strstart, r2.insert = r2.lookahead, r2.lookahead = 0, r2.match_length = r2.prev_length = x - 1, r2.match_available = 0, e2.next_in = o2, e2.input = h2, e2.avail_in = a2, r2.wrap = s2, m; - }, r.deflateInfo = "pako deflate (from Nodeca project)"; - }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./messages": 51, "./trees": 52 }], 47: [function(e, t, r) { - "use strict"; - t.exports = function() { - this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = false; - }; - }, {}], 48: [function(e, t, r) { - "use strict"; - t.exports = function(e2, t2) { - var r2, n, i, s, a, o, h, u, l, f, c, d, p, m, _, g, b, v, y, w, k, x, S, z, C; - r2 = e2.state, n = e2.next_in, z = e2.input, i = n + (e2.avail_in - 5), s = e2.next_out, C = e2.output, a = s - (t2 - e2.avail_out), o = s + (e2.avail_out - 257), h = r2.dmax, u = r2.wsize, l = r2.whave, f = r2.wnext, c = r2.window, d = r2.hold, p = r2.bits, m = r2.lencode, _ = r2.distcode, g = (1 << r2.lenbits) - 1, b = (1 << r2.distbits) - 1; - e: - do { - p < 15 && (d += z[n++] << p, p += 8, d += z[n++] << p, p += 8), v = m[d & g]; - t: - for (; ; ) { - if (d >>>= y = v >>> 24, p -= y, 0 === (y = v >>> 16 & 255)) - C[s++] = 65535 & v; - else { - if (!(16 & y)) { - if (0 == (64 & y)) { - v = m[(65535 & v) + (d & (1 << y) - 1)]; - continue t; - } - if (32 & y) { - r2.mode = 12; - break e; - } - e2.msg = "invalid literal/length code", r2.mode = 30; - break e; - } - w = 65535 & v, (y &= 15) && (p < y && (d += z[n++] << p, p += 8), w += d & (1 << y) - 1, d >>>= y, p -= y), p < 15 && (d += z[n++] << p, p += 8, d += z[n++] << p, p += 8), v = _[d & b]; - r: - for (; ; ) { - if (d >>>= y = v >>> 24, p -= y, !(16 & (y = v >>> 16 & 255))) { - if (0 == (64 & y)) { - v = _[(65535 & v) + (d & (1 << y) - 1)]; - continue r; - } - e2.msg = "invalid distance code", r2.mode = 30; - break e; - } - if (k = 65535 & v, p < (y &= 15) && (d += z[n++] << p, (p += 8) < y && (d += z[n++] << p, p += 8)), h < (k += d & (1 << y) - 1)) { - e2.msg = "invalid distance too far back", r2.mode = 30; - break e; - } - if (d >>>= y, p -= y, (y = s - a) < k) { - if (l < (y = k - y) && r2.sane) { - e2.msg = "invalid distance too far back", r2.mode = 30; - break e; - } - if (S = c, (x = 0) === f) { - if (x += u - y, y < w) { - for (w -= y; C[s++] = c[x++], --y; ) - ; - x = s - k, S = C; - } - } else if (f < y) { - if (x += u + f - y, (y -= f) < w) { - for (w -= y; C[s++] = c[x++], --y; ) - ; - if (x = 0, f < w) { - for (w -= y = f; C[s++] = c[x++], --y; ) - ; - x = s - k, S = C; - } - } - } else if (x += f - y, y < w) { - for (w -= y; C[s++] = c[x++], --y; ) - ; - x = s - k, S = C; - } - for (; 2 < w; ) - C[s++] = S[x++], C[s++] = S[x++], C[s++] = S[x++], w -= 3; - w && (C[s++] = S[x++], 1 < w && (C[s++] = S[x++])); - } else { - for (x = s - k; C[s++] = C[x++], C[s++] = C[x++], C[s++] = C[x++], 2 < (w -= 3); ) - ; - w && (C[s++] = C[x++], 1 < w && (C[s++] = C[x++])); - } - break; - } - } - break; - } - } while (n < i && s < o); - n -= w = p >> 3, d &= (1 << (p -= w << 3)) - 1, e2.next_in = n, e2.next_out = s, e2.avail_in = n < i ? i - n + 5 : 5 - (n - i), e2.avail_out = s < o ? o - s + 257 : 257 - (s - o), r2.hold = d, r2.bits = p; - }; - }, {}], 49: [function(e, t, r) { - "use strict"; - var I = e("../utils/common"), O = e("./adler32"), B = e("./crc32"), R = e("./inffast"), T = e("./inftrees"), D = 1, F = 2, N = 0, U = -2, P = 1, n = 852, i = 592; - function L(e2) { - return (e2 >>> 24 & 255) + (e2 >>> 8 & 65280) + ((65280 & e2) << 8) + ((255 & e2) << 24); - } - function s() { - this.mode = 0, this.last = false, this.wrap = 0, this.havedict = false, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new I.Buf16(320), this.work = new I.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0; - } - function a(e2) { - var t2; - return e2 && e2.state ? (t2 = e2.state, e2.total_in = e2.total_out = t2.total = 0, e2.msg = "", t2.wrap && (e2.adler = 1 & t2.wrap), t2.mode = P, t2.last = 0, t2.havedict = 0, t2.dmax = 32768, t2.head = null, t2.hold = 0, t2.bits = 0, t2.lencode = t2.lendyn = new I.Buf32(n), t2.distcode = t2.distdyn = new I.Buf32(i), t2.sane = 1, t2.back = -1, N) : U; - } - function o(e2) { - var t2; - return e2 && e2.state ? ((t2 = e2.state).wsize = 0, t2.whave = 0, t2.wnext = 0, a(e2)) : U; - } - function h(e2, t2) { - var r2, n2; - return e2 && e2.state ? (n2 = e2.state, t2 < 0 ? (r2 = 0, t2 = -t2) : (r2 = 1 + (t2 >> 4), t2 < 48 && (t2 &= 15)), t2 && (t2 < 8 || 15 < t2) ? U : (null !== n2.window && n2.wbits !== t2 && (n2.window = null), n2.wrap = r2, n2.wbits = t2, o(e2))) : U; - } - function u(e2, t2) { - var r2, n2; - return e2 ? (n2 = new s(), (e2.state = n2).window = null, (r2 = h(e2, t2)) !== N && (e2.state = null), r2) : U; - } - var l, f, c = true; - function j(e2) { - if (c) { - var t2; - for (l = new I.Buf32(512), f = new I.Buf32(32), t2 = 0; t2 < 144; ) - e2.lens[t2++] = 8; - for (; t2 < 256; ) - e2.lens[t2++] = 9; - for (; t2 < 280; ) - e2.lens[t2++] = 7; - for (; t2 < 288; ) - e2.lens[t2++] = 8; - for (T(D, e2.lens, 0, 288, l, 0, e2.work, { bits: 9 }), t2 = 0; t2 < 32; ) - e2.lens[t2++] = 5; - T(F, e2.lens, 0, 32, f, 0, e2.work, { bits: 5 }), c = false; - } - e2.lencode = l, e2.lenbits = 9, e2.distcode = f, e2.distbits = 5; - } - function Z(e2, t2, r2, n2) { - var i2, s2 = e2.state; - return null === s2.window && (s2.wsize = 1 << s2.wbits, s2.wnext = 0, s2.whave = 0, s2.window = new I.Buf8(s2.wsize)), n2 >= s2.wsize ? (I.arraySet(s2.window, t2, r2 - s2.wsize, s2.wsize, 0), s2.wnext = 0, s2.whave = s2.wsize) : (n2 < (i2 = s2.wsize - s2.wnext) && (i2 = n2), I.arraySet(s2.window, t2, r2 - n2, i2, s2.wnext), (n2 -= i2) ? (I.arraySet(s2.window, t2, r2 - n2, n2, 0), s2.wnext = n2, s2.whave = s2.wsize) : (s2.wnext += i2, s2.wnext === s2.wsize && (s2.wnext = 0), s2.whave < s2.wsize && (s2.whave += i2))), 0; - } - r.inflateReset = o, r.inflateReset2 = h, r.inflateResetKeep = a, r.inflateInit = function(e2) { - return u(e2, 15); - }, r.inflateInit2 = u, r.inflate = function(e2, t2) { - var r2, n2, i2, s2, a2, o2, h2, u2, l2, f2, c2, d, p, m, _, g, b, v, y, w, k, x, S, z, C = 0, E = new I.Buf8(4), A = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; - if (!e2 || !e2.state || !e2.output || !e2.input && 0 !== e2.avail_in) - return U; - 12 === (r2 = e2.state).mode && (r2.mode = 13), a2 = e2.next_out, i2 = e2.output, h2 = e2.avail_out, s2 = e2.next_in, n2 = e2.input, o2 = e2.avail_in, u2 = r2.hold, l2 = r2.bits, f2 = o2, c2 = h2, x = N; - e: - for (; ; ) - switch (r2.mode) { - case P: - if (0 === r2.wrap) { - r2.mode = 13; - break; - } - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (2 & r2.wrap && 35615 === u2) { - E[r2.check = 0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0), l2 = u2 = 0, r2.mode = 2; - break; - } - if (r2.flags = 0, r2.head && (r2.head.done = false), !(1 & r2.wrap) || (((255 & u2) << 8) + (u2 >> 8)) % 31) { - e2.msg = "incorrect header check", r2.mode = 30; - break; - } - if (8 != (15 & u2)) { - e2.msg = "unknown compression method", r2.mode = 30; - break; - } - if (l2 -= 4, k = 8 + (15 & (u2 >>>= 4)), 0 === r2.wbits) - r2.wbits = k; - else if (k > r2.wbits) { - e2.msg = "invalid window size", r2.mode = 30; - break; - } - r2.dmax = 1 << k, e2.adler = r2.check = 1, r2.mode = 512 & u2 ? 10 : 12, l2 = u2 = 0; - break; - case 2: - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (r2.flags = u2, 8 != (255 & r2.flags)) { - e2.msg = "unknown compression method", r2.mode = 30; - break; - } - if (57344 & r2.flags) { - e2.msg = "unknown header flags set", r2.mode = 30; - break; - } - r2.head && (r2.head.text = u2 >> 8 & 1), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0, r2.mode = 3; - case 3: - for (; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.head && (r2.head.time = u2), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, E[2] = u2 >>> 16 & 255, E[3] = u2 >>> 24 & 255, r2.check = B(r2.check, E, 4, 0)), l2 = u2 = 0, r2.mode = 4; - case 4: - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.head && (r2.head.xflags = 255 & u2, r2.head.os = u2 >> 8), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0, r2.mode = 5; - case 5: - if (1024 & r2.flags) { - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.length = u2, r2.head && (r2.head.extra_len = u2), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0; - } else - r2.head && (r2.head.extra = null); - r2.mode = 6; - case 6: - if (1024 & r2.flags && (o2 < (d = r2.length) && (d = o2), d && (r2.head && (k = r2.head.extra_len - r2.length, r2.head.extra || (r2.head.extra = new Array(r2.head.extra_len)), I.arraySet(r2.head.extra, n2, s2, d, k)), 512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, r2.length -= d), r2.length)) - break e; - r2.length = 0, r2.mode = 7; - case 7: - if (2048 & r2.flags) { - if (0 === o2) - break e; - for (d = 0; k = n2[s2 + d++], r2.head && k && r2.length < 65536 && (r2.head.name += String.fromCharCode(k)), k && d < o2; ) - ; - if (512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, k) - break e; - } else - r2.head && (r2.head.name = null); - r2.length = 0, r2.mode = 8; - case 8: - if (4096 & r2.flags) { - if (0 === o2) - break e; - for (d = 0; k = n2[s2 + d++], r2.head && k && r2.length < 65536 && (r2.head.comment += String.fromCharCode(k)), k && d < o2; ) - ; - if (512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, k) - break e; - } else - r2.head && (r2.head.comment = null); - r2.mode = 9; - case 9: - if (512 & r2.flags) { - for (; l2 < 16; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (u2 !== (65535 & r2.check)) { - e2.msg = "header crc mismatch", r2.mode = 30; - break; - } - l2 = u2 = 0; - } - r2.head && (r2.head.hcrc = r2.flags >> 9 & 1, r2.head.done = true), e2.adler = r2.check = 0, r2.mode = 12; - break; - case 10: - for (; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - e2.adler = r2.check = L(u2), l2 = u2 = 0, r2.mode = 11; - case 11: - if (0 === r2.havedict) - return e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, 2; - e2.adler = r2.check = 1, r2.mode = 12; - case 12: - if (5 === t2 || 6 === t2) - break e; - case 13: - if (r2.last) { - u2 >>>= 7 & l2, l2 -= 7 & l2, r2.mode = 27; - break; - } - for (; l2 < 3; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - switch (r2.last = 1 & u2, l2 -= 1, 3 & (u2 >>>= 1)) { - case 0: - r2.mode = 14; - break; - case 1: - if (j(r2), r2.mode = 20, 6 !== t2) - break; - u2 >>>= 2, l2 -= 2; - break e; - case 2: - r2.mode = 17; - break; - case 3: - e2.msg = "invalid block type", r2.mode = 30; - } - u2 >>>= 2, l2 -= 2; - break; - case 14: - for (u2 >>>= 7 & l2, l2 -= 7 & l2; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if ((65535 & u2) != (u2 >>> 16 ^ 65535)) { - e2.msg = "invalid stored block lengths", r2.mode = 30; - break; - } - if (r2.length = 65535 & u2, l2 = u2 = 0, r2.mode = 15, 6 === t2) - break e; - case 15: - r2.mode = 16; - case 16: - if (d = r2.length) { - if (o2 < d && (d = o2), h2 < d && (d = h2), 0 === d) - break e; - I.arraySet(i2, n2, s2, d, a2), o2 -= d, s2 += d, h2 -= d, a2 += d, r2.length -= d; - break; - } - r2.mode = 12; - break; - case 17: - for (; l2 < 14; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (r2.nlen = 257 + (31 & u2), u2 >>>= 5, l2 -= 5, r2.ndist = 1 + (31 & u2), u2 >>>= 5, l2 -= 5, r2.ncode = 4 + (15 & u2), u2 >>>= 4, l2 -= 4, 286 < r2.nlen || 30 < r2.ndist) { - e2.msg = "too many length or distance symbols", r2.mode = 30; - break; - } - r2.have = 0, r2.mode = 18; - case 18: - for (; r2.have < r2.ncode; ) { - for (; l2 < 3; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.lens[A[r2.have++]] = 7 & u2, u2 >>>= 3, l2 -= 3; - } - for (; r2.have < 19; ) - r2.lens[A[r2.have++]] = 0; - if (r2.lencode = r2.lendyn, r2.lenbits = 7, S = { bits: r2.lenbits }, x = T(0, r2.lens, 0, 19, r2.lencode, 0, r2.work, S), r2.lenbits = S.bits, x) { - e2.msg = "invalid code lengths set", r2.mode = 30; - break; - } - r2.have = 0, r2.mode = 19; - case 19: - for (; r2.have < r2.nlen + r2.ndist; ) { - for (; g = (C = r2.lencode[u2 & (1 << r2.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (b < 16) - u2 >>>= _, l2 -= _, r2.lens[r2.have++] = b; - else { - if (16 === b) { - for (z = _ + 2; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (u2 >>>= _, l2 -= _, 0 === r2.have) { - e2.msg = "invalid bit length repeat", r2.mode = 30; - break; - } - k = r2.lens[r2.have - 1], d = 3 + (3 & u2), u2 >>>= 2, l2 -= 2; - } else if (17 === b) { - for (z = _ + 3; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - l2 -= _, k = 0, d = 3 + (7 & (u2 >>>= _)), u2 >>>= 3, l2 -= 3; - } else { - for (z = _ + 7; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - l2 -= _, k = 0, d = 11 + (127 & (u2 >>>= _)), u2 >>>= 7, l2 -= 7; - } - if (r2.have + d > r2.nlen + r2.ndist) { - e2.msg = "invalid bit length repeat", r2.mode = 30; - break; - } - for (; d--; ) - r2.lens[r2.have++] = k; - } - } - if (30 === r2.mode) - break; - if (0 === r2.lens[256]) { - e2.msg = "invalid code -- missing end-of-block", r2.mode = 30; - break; - } - if (r2.lenbits = 9, S = { bits: r2.lenbits }, x = T(D, r2.lens, 0, r2.nlen, r2.lencode, 0, r2.work, S), r2.lenbits = S.bits, x) { - e2.msg = "invalid literal/lengths set", r2.mode = 30; - break; - } - if (r2.distbits = 6, r2.distcode = r2.distdyn, S = { bits: r2.distbits }, x = T(F, r2.lens, r2.nlen, r2.ndist, r2.distcode, 0, r2.work, S), r2.distbits = S.bits, x) { - e2.msg = "invalid distances set", r2.mode = 30; - break; - } - if (r2.mode = 20, 6 === t2) - break e; - case 20: - r2.mode = 21; - case 21: - if (6 <= o2 && 258 <= h2) { - e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, R(e2, c2), a2 = e2.next_out, i2 = e2.output, h2 = e2.avail_out, s2 = e2.next_in, n2 = e2.input, o2 = e2.avail_in, u2 = r2.hold, l2 = r2.bits, 12 === r2.mode && (r2.back = -1); - break; - } - for (r2.back = 0; g = (C = r2.lencode[u2 & (1 << r2.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (g && 0 == (240 & g)) { - for (v = _, y = g, w = b; g = (C = r2.lencode[w + ((u2 & (1 << v + y) - 1) >> v)]) >>> 16 & 255, b = 65535 & C, !(v + (_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - u2 >>>= v, l2 -= v, r2.back += v; - } - if (u2 >>>= _, l2 -= _, r2.back += _, r2.length = b, 0 === g) { - r2.mode = 26; - break; - } - if (32 & g) { - r2.back = -1, r2.mode = 12; - break; - } - if (64 & g) { - e2.msg = "invalid literal/length code", r2.mode = 30; - break; - } - r2.extra = 15 & g, r2.mode = 22; - case 22: - if (r2.extra) { - for (z = r2.extra; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.length += u2 & (1 << r2.extra) - 1, u2 >>>= r2.extra, l2 -= r2.extra, r2.back += r2.extra; - } - r2.was = r2.length, r2.mode = 23; - case 23: - for (; g = (C = r2.distcode[u2 & (1 << r2.distbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (0 == (240 & g)) { - for (v = _, y = g, w = b; g = (C = r2.distcode[w + ((u2 & (1 << v + y) - 1) >> v)]) >>> 16 & 255, b = 65535 & C, !(v + (_ = C >>> 24) <= l2); ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - u2 >>>= v, l2 -= v, r2.back += v; - } - if (u2 >>>= _, l2 -= _, r2.back += _, 64 & g) { - e2.msg = "invalid distance code", r2.mode = 30; - break; - } - r2.offset = b, r2.extra = 15 & g, r2.mode = 24; - case 24: - if (r2.extra) { - for (z = r2.extra; l2 < z; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - r2.offset += u2 & (1 << r2.extra) - 1, u2 >>>= r2.extra, l2 -= r2.extra, r2.back += r2.extra; - } - if (r2.offset > r2.dmax) { - e2.msg = "invalid distance too far back", r2.mode = 30; - break; - } - r2.mode = 25; - case 25: - if (0 === h2) - break e; - if (d = c2 - h2, r2.offset > d) { - if ((d = r2.offset - d) > r2.whave && r2.sane) { - e2.msg = "invalid distance too far back", r2.mode = 30; - break; - } - p = d > r2.wnext ? (d -= r2.wnext, r2.wsize - d) : r2.wnext - d, d > r2.length && (d = r2.length), m = r2.window; - } else - m = i2, p = a2 - r2.offset, d = r2.length; - for (h2 < d && (d = h2), h2 -= d, r2.length -= d; i2[a2++] = m[p++], --d; ) - ; - 0 === r2.length && (r2.mode = 21); - break; - case 26: - if (0 === h2) - break e; - i2[a2++] = r2.length, h2--, r2.mode = 21; - break; - case 27: - if (r2.wrap) { - for (; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 |= n2[s2++] << l2, l2 += 8; - } - if (c2 -= h2, e2.total_out += c2, r2.total += c2, c2 && (e2.adler = r2.check = r2.flags ? B(r2.check, i2, c2, a2 - c2) : O(r2.check, i2, c2, a2 - c2)), c2 = h2, (r2.flags ? u2 : L(u2)) !== r2.check) { - e2.msg = "incorrect data check", r2.mode = 30; - break; - } - l2 = u2 = 0; - } - r2.mode = 28; - case 28: - if (r2.wrap && r2.flags) { - for (; l2 < 32; ) { - if (0 === o2) - break e; - o2--, u2 += n2[s2++] << l2, l2 += 8; - } - if (u2 !== (4294967295 & r2.total)) { - e2.msg = "incorrect length check", r2.mode = 30; - break; - } - l2 = u2 = 0; - } - r2.mode = 29; - case 29: - x = 1; - break e; - case 30: - x = -3; - break e; - case 31: - return -4; - case 32: - default: - return U; - } - return e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, (r2.wsize || c2 !== e2.avail_out && r2.mode < 30 && (r2.mode < 27 || 4 !== t2)) && Z(e2, e2.output, e2.next_out, c2 - e2.avail_out) ? (r2.mode = 31, -4) : (f2 -= e2.avail_in, c2 -= e2.avail_out, e2.total_in += f2, e2.total_out += c2, r2.total += c2, r2.wrap && c2 && (e2.adler = r2.check = r2.flags ? B(r2.check, i2, c2, e2.next_out - c2) : O(r2.check, i2, c2, e2.next_out - c2)), e2.data_type = r2.bits + (r2.last ? 64 : 0) + (12 === r2.mode ? 128 : 0) + (20 === r2.mode || 15 === r2.mode ? 256 : 0), (0 == f2 && 0 === c2 || 4 === t2) && x === N && (x = -5), x); - }, r.inflateEnd = function(e2) { - if (!e2 || !e2.state) - return U; - var t2 = e2.state; - return t2.window && (t2.window = null), e2.state = null, N; - }, r.inflateGetHeader = function(e2, t2) { - var r2; - return e2 && e2.state ? 0 == (2 & (r2 = e2.state).wrap) ? U : ((r2.head = t2).done = false, N) : U; - }, r.inflateSetDictionary = function(e2, t2) { - var r2, n2 = t2.length; - return e2 && e2.state ? 0 !== (r2 = e2.state).wrap && 11 !== r2.mode ? U : 11 === r2.mode && O(1, t2, n2, 0) !== r2.check ? -3 : Z(e2, t2, n2, n2) ? (r2.mode = 31, -4) : (r2.havedict = 1, N) : U; - }, r.inflateInfo = "pako inflate (from Nodeca project)"; - }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(e, t, r) { - "use strict"; - var D = e("../utils/common"), F = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], N = [16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78], U = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0], P = [16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64]; - t.exports = function(e2, t2, r2, n, i, s, a, o) { - var h, u, l, f, c, d, p, m, _, g = o.bits, b = 0, v = 0, y = 0, w = 0, k = 0, x = 0, S = 0, z = 0, C = 0, E = 0, A = null, I = 0, O = new D.Buf16(16), B = new D.Buf16(16), R = null, T = 0; - for (b = 0; b <= 15; b++) - O[b] = 0; - for (v = 0; v < n; v++) - O[t2[r2 + v]]++; - for (k = g, w = 15; 1 <= w && 0 === O[w]; w--) - ; - if (w < k && (k = w), 0 === w) - return i[s++] = 20971520, i[s++] = 20971520, o.bits = 1, 0; - for (y = 1; y < w && 0 === O[y]; y++) - ; - for (k < y && (k = y), b = z = 1; b <= 15; b++) - if (z <<= 1, (z -= O[b]) < 0) - return -1; - if (0 < z && (0 === e2 || 1 !== w)) - return -1; - for (B[1] = 0, b = 1; b < 15; b++) - B[b + 1] = B[b] + O[b]; - for (v = 0; v < n; v++) - 0 !== t2[r2 + v] && (a[B[t2[r2 + v]]++] = v); - if (d = 0 === e2 ? (A = R = a, 19) : 1 === e2 ? (A = F, I -= 257, R = N, T -= 257, 256) : (A = U, R = P, -1), b = y, c = s, S = v = E = 0, l = -1, f = (C = 1 << (x = k)) - 1, 1 === e2 && 852 < C || 2 === e2 && 592 < C) - return 1; - for (; ; ) { - for (p = b - S, _ = a[v] < d ? (m = 0, a[v]) : a[v] > d ? (m = R[T + a[v]], A[I + a[v]]) : (m = 96, 0), h = 1 << b - S, y = u = 1 << x; i[c + (E >> S) + (u -= h)] = p << 24 | m << 16 | _ | 0, 0 !== u; ) - ; - for (h = 1 << b - 1; E & h; ) - h >>= 1; - if (0 !== h ? (E &= h - 1, E += h) : E = 0, v++, 0 == --O[b]) { - if (b === w) - break; - b = t2[r2 + a[v]]; - } - if (k < b && (E & f) !== l) { - for (0 === S && (S = k), c += y, z = 1 << (x = b - S); x + S < w && !((z -= O[x + S]) <= 0); ) - x++, z <<= 1; - if (C += 1 << x, 1 === e2 && 852 < C || 2 === e2 && 592 < C) - return 1; - i[l = E & f] = k << 24 | x << 16 | c - s | 0; - } - } - return 0 !== E && (i[c + E] = b - S << 24 | 64 << 16 | 0), o.bits = k, 0; - }; - }, { "../utils/common": 41 }], 51: [function(e, t, r) { - "use strict"; - t.exports = { 2: "need dictionary", 1: "stream end", 0: "", "-1": "file error", "-2": "stream error", "-3": "data error", "-4": "insufficient memory", "-5": "buffer error", "-6": "incompatible version" }; - }, {}], 52: [function(e, t, r) { - "use strict"; - var i = e("../utils/common"), o = 0, h = 1; - function n(e2) { - for (var t2 = e2.length; 0 <= --t2; ) - e2[t2] = 0; - } - var s = 0, a = 29, u = 256, l = u + 1 + a, f = 30, c = 19, _ = 2 * l + 1, g = 15, d = 16, p = 7, m = 256, b = 16, v = 17, y = 18, w = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], k = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], x = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], S = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], z = new Array(2 * (l + 2)); - n(z); - var C = new Array(2 * f); - n(C); - var E = new Array(512); - n(E); - var A = new Array(256); - n(A); - var I = new Array(a); - n(I); - var O, B, R, T = new Array(f); - function D(e2, t2, r2, n2, i2) { - this.static_tree = e2, this.extra_bits = t2, this.extra_base = r2, this.elems = n2, this.max_length = i2, this.has_stree = e2 && e2.length; - } - function F(e2, t2) { - this.dyn_tree = e2, this.max_code = 0, this.stat_desc = t2; - } - function N(e2) { - return e2 < 256 ? E[e2] : E[256 + (e2 >>> 7)]; - } - function U(e2, t2) { - e2.pending_buf[e2.pending++] = 255 & t2, e2.pending_buf[e2.pending++] = t2 >>> 8 & 255; - } - function P(e2, t2, r2) { - e2.bi_valid > d - r2 ? (e2.bi_buf |= t2 << e2.bi_valid & 65535, U(e2, e2.bi_buf), e2.bi_buf = t2 >> d - e2.bi_valid, e2.bi_valid += r2 - d) : (e2.bi_buf |= t2 << e2.bi_valid & 65535, e2.bi_valid += r2); - } - function L(e2, t2, r2) { - P(e2, r2[2 * t2], r2[2 * t2 + 1]); - } - function j(e2, t2) { - for (var r2 = 0; r2 |= 1 & e2, e2 >>>= 1, r2 <<= 1, 0 < --t2; ) - ; - return r2 >>> 1; - } - function Z(e2, t2, r2) { - var n2, i2, s2 = new Array(g + 1), a2 = 0; - for (n2 = 1; n2 <= g; n2++) - s2[n2] = a2 = a2 + r2[n2 - 1] << 1; - for (i2 = 0; i2 <= t2; i2++) { - var o2 = e2[2 * i2 + 1]; - 0 !== o2 && (e2[2 * i2] = j(s2[o2]++, o2)); - } - } - function W(e2) { - var t2; - for (t2 = 0; t2 < l; t2++) - e2.dyn_ltree[2 * t2] = 0; - for (t2 = 0; t2 < f; t2++) - e2.dyn_dtree[2 * t2] = 0; - for (t2 = 0; t2 < c; t2++) - e2.bl_tree[2 * t2] = 0; - e2.dyn_ltree[2 * m] = 1, e2.opt_len = e2.static_len = 0, e2.last_lit = e2.matches = 0; - } - function M(e2) { - 8 < e2.bi_valid ? U(e2, e2.bi_buf) : 0 < e2.bi_valid && (e2.pending_buf[e2.pending++] = e2.bi_buf), e2.bi_buf = 0, e2.bi_valid = 0; - } - function H(e2, t2, r2, n2) { - var i2 = 2 * t2, s2 = 2 * r2; - return e2[i2] < e2[s2] || e2[i2] === e2[s2] && n2[t2] <= n2[r2]; - } - function G(e2, t2, r2) { - for (var n2 = e2.heap[r2], i2 = r2 << 1; i2 <= e2.heap_len && (i2 < e2.heap_len && H(t2, e2.heap[i2 + 1], e2.heap[i2], e2.depth) && i2++, !H(t2, n2, e2.heap[i2], e2.depth)); ) - e2.heap[r2] = e2.heap[i2], r2 = i2, i2 <<= 1; - e2.heap[r2] = n2; - } - function K(e2, t2, r2) { - var n2, i2, s2, a2, o2 = 0; - if (0 !== e2.last_lit) - for (; n2 = e2.pending_buf[e2.d_buf + 2 * o2] << 8 | e2.pending_buf[e2.d_buf + 2 * o2 + 1], i2 = e2.pending_buf[e2.l_buf + o2], o2++, 0 === n2 ? L(e2, i2, t2) : (L(e2, (s2 = A[i2]) + u + 1, t2), 0 !== (a2 = w[s2]) && P(e2, i2 -= I[s2], a2), L(e2, s2 = N(--n2), r2), 0 !== (a2 = k[s2]) && P(e2, n2 -= T[s2], a2)), o2 < e2.last_lit; ) - ; - L(e2, m, t2); - } - function Y(e2, t2) { - var r2, n2, i2, s2 = t2.dyn_tree, a2 = t2.stat_desc.static_tree, o2 = t2.stat_desc.has_stree, h2 = t2.stat_desc.elems, u2 = -1; - for (e2.heap_len = 0, e2.heap_max = _, r2 = 0; r2 < h2; r2++) - 0 !== s2[2 * r2] ? (e2.heap[++e2.heap_len] = u2 = r2, e2.depth[r2] = 0) : s2[2 * r2 + 1] = 0; - for (; e2.heap_len < 2; ) - s2[2 * (i2 = e2.heap[++e2.heap_len] = u2 < 2 ? ++u2 : 0)] = 1, e2.depth[i2] = 0, e2.opt_len--, o2 && (e2.static_len -= a2[2 * i2 + 1]); - for (t2.max_code = u2, r2 = e2.heap_len >> 1; 1 <= r2; r2--) - G(e2, s2, r2); - for (i2 = h2; r2 = e2.heap[1], e2.heap[1] = e2.heap[e2.heap_len--], G(e2, s2, 1), n2 = e2.heap[1], e2.heap[--e2.heap_max] = r2, e2.heap[--e2.heap_max] = n2, s2[2 * i2] = s2[2 * r2] + s2[2 * n2], e2.depth[i2] = (e2.depth[r2] >= e2.depth[n2] ? e2.depth[r2] : e2.depth[n2]) + 1, s2[2 * r2 + 1] = s2[2 * n2 + 1] = i2, e2.heap[1] = i2++, G(e2, s2, 1), 2 <= e2.heap_len; ) - ; - e2.heap[--e2.heap_max] = e2.heap[1], function(e3, t3) { - var r3, n3, i3, s3, a3, o3, h3 = t3.dyn_tree, u3 = t3.max_code, l2 = t3.stat_desc.static_tree, f2 = t3.stat_desc.has_stree, c2 = t3.stat_desc.extra_bits, d2 = t3.stat_desc.extra_base, p2 = t3.stat_desc.max_length, m2 = 0; - for (s3 = 0; s3 <= g; s3++) - e3.bl_count[s3] = 0; - for (h3[2 * e3.heap[e3.heap_max] + 1] = 0, r3 = e3.heap_max + 1; r3 < _; r3++) - p2 < (s3 = h3[2 * h3[2 * (n3 = e3.heap[r3]) + 1] + 1] + 1) && (s3 = p2, m2++), h3[2 * n3 + 1] = s3, u3 < n3 || (e3.bl_count[s3]++, a3 = 0, d2 <= n3 && (a3 = c2[n3 - d2]), o3 = h3[2 * n3], e3.opt_len += o3 * (s3 + a3), f2 && (e3.static_len += o3 * (l2[2 * n3 + 1] + a3))); - if (0 !== m2) { - do { - for (s3 = p2 - 1; 0 === e3.bl_count[s3]; ) - s3--; - e3.bl_count[s3]--, e3.bl_count[s3 + 1] += 2, e3.bl_count[p2]--, m2 -= 2; - } while (0 < m2); - for (s3 = p2; 0 !== s3; s3--) - for (n3 = e3.bl_count[s3]; 0 !== n3; ) - u3 < (i3 = e3.heap[--r3]) || (h3[2 * i3 + 1] !== s3 && (e3.opt_len += (s3 - h3[2 * i3 + 1]) * h3[2 * i3], h3[2 * i3 + 1] = s3), n3--); - } - }(e2, t2), Z(s2, u2, e2.bl_count); - } - function X(e2, t2, r2) { - var n2, i2, s2 = -1, a2 = t2[1], o2 = 0, h2 = 7, u2 = 4; - for (0 === a2 && (h2 = 138, u2 = 3), t2[2 * (r2 + 1) + 1] = 65535, n2 = 0; n2 <= r2; n2++) - i2 = a2, a2 = t2[2 * (n2 + 1) + 1], ++o2 < h2 && i2 === a2 || (o2 < u2 ? e2.bl_tree[2 * i2] += o2 : 0 !== i2 ? (i2 !== s2 && e2.bl_tree[2 * i2]++, e2.bl_tree[2 * b]++) : o2 <= 10 ? e2.bl_tree[2 * v]++ : e2.bl_tree[2 * y]++, s2 = i2, u2 = (o2 = 0) === a2 ? (h2 = 138, 3) : i2 === a2 ? (h2 = 6, 3) : (h2 = 7, 4)); - } - function V(e2, t2, r2) { - var n2, i2, s2 = -1, a2 = t2[1], o2 = 0, h2 = 7, u2 = 4; - for (0 === a2 && (h2 = 138, u2 = 3), n2 = 0; n2 <= r2; n2++) - if (i2 = a2, a2 = t2[2 * (n2 + 1) + 1], !(++o2 < h2 && i2 === a2)) { - if (o2 < u2) - for (; L(e2, i2, e2.bl_tree), 0 != --o2; ) - ; - else - 0 !== i2 ? (i2 !== s2 && (L(e2, i2, e2.bl_tree), o2--), L(e2, b, e2.bl_tree), P(e2, o2 - 3, 2)) : o2 <= 10 ? (L(e2, v, e2.bl_tree), P(e2, o2 - 3, 3)) : (L(e2, y, e2.bl_tree), P(e2, o2 - 11, 7)); - s2 = i2, u2 = (o2 = 0) === a2 ? (h2 = 138, 3) : i2 === a2 ? (h2 = 6, 3) : (h2 = 7, 4); - } - } - n(T); - var q = false; - function J(e2, t2, r2, n2) { - P(e2, (s << 1) + (n2 ? 1 : 0), 3), function(e3, t3, r3, n3) { - M(e3), n3 && (U(e3, r3), U(e3, ~r3)), i.arraySet(e3.pending_buf, e3.window, t3, r3, e3.pending), e3.pending += r3; - }(e2, t2, r2, true); - } - r._tr_init = function(e2) { - q || (function() { - var e3, t2, r2, n2, i2, s2 = new Array(g + 1); - for (n2 = r2 = 0; n2 < a - 1; n2++) - for (I[n2] = r2, e3 = 0; e3 < 1 << w[n2]; e3++) - A[r2++] = n2; - for (A[r2 - 1] = n2, n2 = i2 = 0; n2 < 16; n2++) - for (T[n2] = i2, e3 = 0; e3 < 1 << k[n2]; e3++) - E[i2++] = n2; - for (i2 >>= 7; n2 < f; n2++) - for (T[n2] = i2 << 7, e3 = 0; e3 < 1 << k[n2] - 7; e3++) - E[256 + i2++] = n2; - for (t2 = 0; t2 <= g; t2++) - s2[t2] = 0; - for (e3 = 0; e3 <= 143; ) - z[2 * e3 + 1] = 8, e3++, s2[8]++; - for (; e3 <= 255; ) - z[2 * e3 + 1] = 9, e3++, s2[9]++; - for (; e3 <= 279; ) - z[2 * e3 + 1] = 7, e3++, s2[7]++; - for (; e3 <= 287; ) - z[2 * e3 + 1] = 8, e3++, s2[8]++; - for (Z(z, l + 1, s2), e3 = 0; e3 < f; e3++) - C[2 * e3 + 1] = 5, C[2 * e3] = j(e3, 5); - O = new D(z, w, u + 1, l, g), B = new D(C, k, 0, f, g), R = new D(new Array(0), x, 0, c, p); - }(), q = true), e2.l_desc = new F(e2.dyn_ltree, O), e2.d_desc = new F(e2.dyn_dtree, B), e2.bl_desc = new F(e2.bl_tree, R), e2.bi_buf = 0, e2.bi_valid = 0, W(e2); - }, r._tr_stored_block = J, r._tr_flush_block = function(e2, t2, r2, n2) { - var i2, s2, a2 = 0; - 0 < e2.level ? (2 === e2.strm.data_type && (e2.strm.data_type = function(e3) { - var t3, r3 = 4093624447; - for (t3 = 0; t3 <= 31; t3++, r3 >>>= 1) - if (1 & r3 && 0 !== e3.dyn_ltree[2 * t3]) - return o; - if (0 !== e3.dyn_ltree[18] || 0 !== e3.dyn_ltree[20] || 0 !== e3.dyn_ltree[26]) - return h; - for (t3 = 32; t3 < u; t3++) - if (0 !== e3.dyn_ltree[2 * t3]) - return h; - return o; - }(e2)), Y(e2, e2.l_desc), Y(e2, e2.d_desc), a2 = function(e3) { - var t3; - for (X(e3, e3.dyn_ltree, e3.l_desc.max_code), X(e3, e3.dyn_dtree, e3.d_desc.max_code), Y(e3, e3.bl_desc), t3 = c - 1; 3 <= t3 && 0 === e3.bl_tree[2 * S[t3] + 1]; t3--) - ; - return e3.opt_len += 3 * (t3 + 1) + 5 + 5 + 4, t3; - }(e2), i2 = e2.opt_len + 3 + 7 >>> 3, (s2 = e2.static_len + 3 + 7 >>> 3) <= i2 && (i2 = s2)) : i2 = s2 = r2 + 5, r2 + 4 <= i2 && -1 !== t2 ? J(e2, t2, r2, n2) : 4 === e2.strategy || s2 === i2 ? (P(e2, 2 + (n2 ? 1 : 0), 3), K(e2, z, C)) : (P(e2, 4 + (n2 ? 1 : 0), 3), function(e3, t3, r3, n3) { - var i3; - for (P(e3, t3 - 257, 5), P(e3, r3 - 1, 5), P(e3, n3 - 4, 4), i3 = 0; i3 < n3; i3++) - P(e3, e3.bl_tree[2 * S[i3] + 1], 3); - V(e3, e3.dyn_ltree, t3 - 1), V(e3, e3.dyn_dtree, r3 - 1); - }(e2, e2.l_desc.max_code + 1, e2.d_desc.max_code + 1, a2 + 1), K(e2, e2.dyn_ltree, e2.dyn_dtree)), W(e2), n2 && M(e2); - }, r._tr_tally = function(e2, t2, r2) { - return e2.pending_buf[e2.d_buf + 2 * e2.last_lit] = t2 >>> 8 & 255, e2.pending_buf[e2.d_buf + 2 * e2.last_lit + 1] = 255 & t2, e2.pending_buf[e2.l_buf + e2.last_lit] = 255 & r2, e2.last_lit++, 0 === t2 ? e2.dyn_ltree[2 * r2]++ : (e2.matches++, t2--, e2.dyn_ltree[2 * (A[r2] + u + 1)]++, e2.dyn_dtree[2 * N(t2)]++), e2.last_lit === e2.lit_bufsize - 1; - }, r._tr_align = function(e2) { - P(e2, 2, 3), L(e2, m, z), function(e3) { - 16 === e3.bi_valid ? (U(e3, e3.bi_buf), e3.bi_buf = 0, e3.bi_valid = 0) : 8 <= e3.bi_valid && (e3.pending_buf[e3.pending++] = 255 & e3.bi_buf, e3.bi_buf >>= 8, e3.bi_valid -= 8); - }(e2); - }; - }, { "../utils/common": 41 }], 53: [function(e, t, r) { - "use strict"; - t.exports = function() { - this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0; - }; - }, {}], 54: [function(e, t, r) { - (function(e2) { - !function(r2, n) { - "use strict"; - if (!r2.setImmediate) { - var i, s, t2, a, o = 1, h = {}, u = false, l = r2.document, e3 = Object.getPrototypeOf && Object.getPrototypeOf(r2); - e3 = e3 && e3.setTimeout ? e3 : r2, i = "[object process]" === {}.toString.call(r2.process) ? function(e4) { - process.nextTick(function() { - c(e4); - }); - } : function() { - if (r2.postMessage && !r2.importScripts) { - var e4 = true, t3 = r2.onmessage; - return r2.onmessage = function() { - e4 = false; - }, r2.postMessage("", "*"), r2.onmessage = t3, e4; - } - }() ? (a = "setImmediate$" + Math.random() + "$", r2.addEventListener ? r2.addEventListener("message", d, false) : r2.attachEvent("onmessage", d), function(e4) { - r2.postMessage(a + e4, "*"); - }) : r2.MessageChannel ? ((t2 = new MessageChannel()).port1.onmessage = function(e4) { - c(e4.data); - }, function(e4) { - t2.port2.postMessage(e4); - }) : l && "onreadystatechange" in l.createElement("script") ? (s = l.documentElement, function(e4) { - var t3 = l.createElement("script"); - t3.onreadystatechange = function() { - c(e4), t3.onreadystatechange = null, s.removeChild(t3), t3 = null; - }, s.appendChild(t3); - }) : function(e4) { - setTimeout(c, 0, e4); - }, e3.setImmediate = function(e4) { - "function" != typeof e4 && (e4 = new Function("" + e4)); - for (var t3 = new Array(arguments.length - 1), r3 = 0; r3 < t3.length; r3++) - t3[r3] = arguments[r3 + 1]; - var n2 = { callback: e4, args: t3 }; - return h[o] = n2, i(o), o++; - }, e3.clearImmediate = f; - } - function f(e4) { - delete h[e4]; - } - function c(e4) { - if (u) - setTimeout(c, 0, e4); - else { - var t3 = h[e4]; - if (t3) { - u = true; - try { - !function(e5) { - var t4 = e5.callback, r3 = e5.args; - switch (r3.length) { - case 0: - t4(); - break; - case 1: - t4(r3[0]); - break; - case 2: - t4(r3[0], r3[1]); - break; - case 3: - t4(r3[0], r3[1], r3[2]); - break; - default: - t4.apply(n, r3); - } - }(t3); - } finally { - f(e4), u = false; - } - } - } - } - function d(e4) { - e4.source === r2 && "string" == typeof e4.data && 0 === e4.data.indexOf(a) && c(+e4.data.slice(a.length)); - } - }("undefined" == typeof self ? void 0 === e2 ? this : e2 : self); - }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}); - }, {}] }, {}, [10])(10); - }); - } - }); - - // ../components/smart-camera-web.js - var VERSION = "1.0.2"; - var DEFAULT_NO_OF_LIVENESS_FRAMES = 8; - var PORTRAIT_ID_PREVIEW_WIDTH = 396; - var PORTRAIT_ID_PREVIEW_HEIGHT = 527; - function isSamsungMultiCameraDevice() { - const matchedModelNumber = navigator.userAgent.match(/SM-[N|G]\d{3}/); - if (!matchedModelNumber) { - return false; - } - const modelNumber = parseInt(matchedModelNumber[0].match(/\d{3}/)[0], 10); - const smallerModelNumber = 970; - return !Number.isNaN(modelNumber) && modelNumber >= smallerModelNumber; - } - function getLivenessFramesIndices(totalNoOfFrames, numberOfFramesRequired = DEFAULT_NO_OF_LIVENESS_FRAMES) { - const selectedFrames = []; - if (totalNoOfFrames < numberOfFramesRequired) { - throw new Error("SmartCameraWeb: Minimum required no of frames is ", numberOfFramesRequired); - } - const frameDivisor = numberOfFramesRequired - 1; - const frameInterval = Math.floor(totalNoOfFrames / frameDivisor); - let replacementFrameIndex = 1; - for (let i = 0; i < totalNoOfFrames; i += frameInterval) { - if (selectedFrames.length < 8) { - selectedFrames.push(i); - } else { - selectedFrames[replacementFrameIndex] = i; - selectedFrames.sort((a, b) => a - b); - replacementFrameIndex += 1; - } - } - const lastFrameIndex = totalNoOfFrames - 1; - if (selectedFrames.length < 8 && !selectedFrames.includes(lastFrameIndex)) { - selectedFrames.push(lastFrameIndex); - } - return selectedFrames; - } - var SmartFileUpload = class _SmartFileUpload { - static memoryLimit = 1024e4; - static supportedTypes = ["image/jpeg", "image/png"]; - static getHumanSize(numberOfBytes) { - const units = [ - "B", - "kB", - "MB", - "GB", - "TB", - "PB", - "EB", - "ZB", - "YB" - ]; - const exponent = Math.min( - Math.floor(Math.log(numberOfBytes) / Math.log(1024)), - units.length - 1 - ); - const approx = numberOfBytes / 1024 ** exponent; - const output = exponent === 0 ? `${numberOfBytes} bytes` : `${approx.toFixed(0)} ${units[exponent]}`; - return output; - } - static getData(file) { - return new Promise((resolve, reject) => { - const reader = new FileReader(); - reader.onload = (e) => { - resolve(e.target.result); - }; - reader.onerror = () => { - reject(new Error("An error occurred reading the file. Please check the file, and try again")); - }; - reader.readAsDataURL(file); - }); - } - static async retrieve(files) { - if (files.length > 1) { - throw new Error("Only one file upload is permitted at a time"); - } - const file = files[0]; - if (!_SmartFileUpload.supportedTypes.includes(file.type)) { - throw new Error("Unsupported file format. Please ensure that you are providing a JPG or PNG image"); - } - if (file.size > _SmartFileUpload.memoryLimit) { - throw new Error(`${file.name} is too large. Please ensure that the file is less than ${_SmartFileUpload.getHumanSize(_SmartFileUpload.memoryLimit)}.`); - } - const imageAsDataUrl = await _SmartFileUpload.getData(file); - return imageAsDataUrl; - } - }; - function scwTemplateString() { - return ` - - - - - - - - - - - - - - - -
-

-

-
- -
- ${this.showNavigation ? ` - - ` : ""} -
-

- We need access to your camera so that we can take selfie and proof-of-life images. -

- - - - ${this.hideAttribution ? "" : ` - - `} -
-
- - - - - - - - - - - - - - - - - - - - - - `; - } - var PoweredBySmileId = class extends HTMLElement { - constructor() { - super(); - const template = document.createElement("template"); - template.innerHTML = ` -

- - - - - - - - - - - - - - - - - - - -

- `; - this.attachShadow({ mode: "open" }).appendChild(template.content.cloneNode(true)); - } - }; - function hasMoreThanNColors(data, n = 16) { - const colors = /* @__PURE__ */ new Set(); - for (let i = 0; i < Math.min(data.length, 1e4); i += 4) { - colors.add(data[i] << 16 | data[i + 1] << 8 | data[i + 2]); - if (colors.size > n) { - return true; - } - } - return false; - } - window.customElements.define("powered-by-smile-id", PoweredBySmileId); - var SmartCameraWeb = class extends HTMLElement { - constructor() { - super(); - this.scwTemplateString = scwTemplateString.bind(this); - this.render = () => this.scwTemplateString(); - this.attachShadow({ mode: "open" }); - this.activeScreen = null; - } - setActiveScreen(element) { - this.activeScreen.hidden = true; - element.hidden = false; - this.activeScreen = element; - } - connectedCallback() { - this.shadowRoot.innerHTML = this.render(); - if ("mediaDevices" in navigator && "getUserMedia" in navigator.mediaDevices) { - this.setUpEventListeners(); - } else { - const heading = document.createElement("h1"); - heading.classList.add("error-message"); - heading.textContent = "Your browser does not support this integration"; - this.shadowRoot.innerHTML = heading; - } - } - disconnectedCallback() { - if (this.activeScreen) { - this.activeScreen.hidden = true; - } - this.activeScreen = null; - this.shadowRoot.innerHTML = ""; - } - static get observedAttributes() { - return ["document-capture-modes", "document-type", "hide-back-to-host", "show-navigation"]; - } - attributeChangedCallback(name) { - switch (name) { - case "document-capture-modes": - case "document-type": - case "hide-back-to-host": - case "show-navigation": - this.shadowRoot.innerHTML = this.render(); - this.setUpEventListeners(); - break; - default: - break; - } - } - setUpEventListeners() { - this.errorMessage = this.shadowRoot.querySelector("#error"); - this.requestScreen = this.shadowRoot.querySelector("#request-screen"); - this.activeScreen = this.requestScreen; - this.cameraScreen = this.shadowRoot.querySelector("#camera-screen"); - this.failedImageTestScreen = this.shadowRoot.querySelector("#failed-image-test-screen"); - this.reviewScreen = this.shadowRoot.querySelector("#review-screen"); - this.idEntryScreen = this.shadowRoot.querySelector("#id-entry-screen"); - this.IDCameraScreen = this.shadowRoot.querySelector("#id-camera-screen"); - this.IDReviewScreen = this.shadowRoot.querySelector("#id-review-screen"); - this.backOfIdEntryScreen = this.shadowRoot.querySelector("#back-of-id-entry-screen"); - this.backOfIDCameraScreen = this.shadowRoot.querySelector("#back-of-id-camera-screen"); - this.backOfIDReviewScreen = this.shadowRoot.querySelector("#back-of-id-review-screen"); - this.thanksScreen = this.shadowRoot.querySelector("#thanks-screen"); - this.videoContainer = this.shadowRoot.querySelector(".video-container > .video"); - this.smileCTA = this.shadowRoot.querySelector("#smile-cta"); - this.imageOutline = this.shadowRoot.querySelector("#image-outline path"); - this.startImageCapture = this.shadowRoot.querySelector("#start-image-capture"); - this.captureIDImage = this.shadowRoot.querySelector("#capture-id-image"); - this.captureBackOfIDImage = this.shadowRoot.querySelector("#capture-back-of-id-image"); - this.reviewImage = this.shadowRoot.querySelector("#review-image"); - this.IDReviewImage = this.shadowRoot.querySelector("#id-review-image"); - this.backOfIDReviewImage = this.shadowRoot.querySelector("#back-of-id-review-image"); - this.reStartImageCapture = this.shadowRoot.querySelector("#restart-image-capture"); - this.reCaptureIDImage = this.shadowRoot.querySelector("#re-capture-id-image"); - this.reCaptureBackOfIDImage = this.shadowRoot.querySelector("#re-capture-back-of-id-image"); - this.selectSelfie = this.shadowRoot.querySelector("#select-selfie"); - this.selectIDImage = this.shadowRoot.querySelector("#select-id-image"); - this.selectBackOfIDImage = this.shadowRoot.querySelector("#select-back-of-id-image"); - this.takeDocumentPhotoButton = this.idEntryScreen.querySelector("#take-photo"); - this.uploadDocumentPhotoButton = this.idEntryScreen.querySelector("#upload-photo"); - this.skipBackOfDocumentPhotoButton = this.backOfIdEntryScreen.querySelector("#skip-this-step"); - this.takeBackOfDocumentPhotoButton = this.backOfIdEntryScreen.querySelector("#take-photo"); - this.uploadBackOfDocumentPhotoButton = this.backOfIdEntryScreen.querySelector("#upload-photo"); - this.shadowRoot.querySelector("#request-camera-access").addEventListener("click", () => this.init()); - if (this.showNavigation) { - const backButtons = this.shadowRoot.querySelectorAll(".back-button-exit"); - backButtons.forEach((button) => { - button.addEventListener("click", () => { - this._backAndExit(); - }); - }); - const closeButtons = this.shadowRoot.querySelectorAll(".close-iframe"); - closeButtons.forEach((button) => { - button.addEventListener("click", () => { - this._exitSmartCamera(); - }); - }); - } - if (this.takeDocumentPhotoButton) - this.takeDocumentPhotoButton.addEventListener("click", () => this._startIDCamera()); - if (this.skipBackOfDocumentPhotoButton) - this.skipBackOfDocumentPhotoButton.addEventListener("click", () => this._skipBackDocument()); - if (this.takeBackOfDocumentPhotoButton) - this.takeBackOfDocumentPhotoButton.addEventListener("click", () => this._startIDCamera()); - if (this.uploadDocumentPhotoButton) - this.uploadDocumentPhotoButton.addEventListener("change", (e) => this._uploadDocument(e)); - if (this.uploadBackOfDocumentPhotoButton) - this.uploadBackOfDocumentPhotoButton.addEventListener("change", (e) => this._uploadDocument(e)); - this.backToSelfie = this.shadowRoot.querySelector("#back-button-selfie"); - this.backToIdEntryButton = this.shadowRoot.querySelector("#back-button-id-entry"); - this.backToBackIdEntryButton = this.shadowRoot.querySelector("#back-button-back-id-entry"); - this.backToIdImageButton = this.shadowRoot.querySelector("#back-button-id-image"); - if (this.backToSelfie) { - this.backToSelfie.addEventListener("click", () => { - this._reStartImageCapture(); - }); - } - if (this.backToIdEntryButton) { - this.backToIdEntryButton.addEventListener("click", () => { - this.setActiveScreen(this.idEntryScreen); - }); - } - if (this.backToBackIdEntryButton) { - this.backToBackIdEntryButton.addEventListener("click", () => { - this.setActiveScreen(this.backOfIdEntryScreen); - }); - } - if (this.backToIdImageButton) { - this.backToIdImageButton.addEventListener("click", () => { - this.setActiveScreen(this.IDReviewScreen); - }); - } - this.startImageCapture.addEventListener("click", () => { - this._startImageCapture(); - }); - this.selectSelfie.addEventListener("click", () => { - this._selectSelfie(); - }); - this.selectIDImage.addEventListener("click", () => { - this._selectIDImage(); - }); - this.selectBackOfIDImage.addEventListener("click", () => { - this._selectIDImage(true); - }); - this.captureIDImage.addEventListener("click", () => { - this._captureIDImage(); - }); - this.captureBackOfIDImage.addEventListener("click", () => { - this._captureIDImage(); - }); - this.reStartImageCapture.addEventListener("click", () => { - this._reStartImageCapture(); - }); - this.reCaptureIDImage.addEventListener("click", () => { - this._reCaptureIDImage(); - }); - this.reCaptureBackOfIDImage.addEventListener("click", () => { - this._reCaptureIDImage(); - }); - } - init() { - this._videoStreamDurationInMS = 7800; - this._imageCaptureIntervalInMS = 200; - this._data = { - images: [], - partner_params: { - libraryVersion: VERSION, - permissionGranted: false - } - }; - this._rawImages = []; - navigator.mediaDevices.getUserMedia({ audio: false, video: true }).then((stream) => { - this.handleSuccess(stream); - }).catch((e) => { - this.handleError(e); - }); - } - reset() { - this.disconnectedCallback(); - this.connectedCallback(); - } - resetErrorMessage() { - this.errorMessage.textContent = ""; - } - handleSuccess(stream) { - const videoExists = !!this.videoContainer.querySelector("video"); - const video = videoExists ? this.videoContainer.querySelector("video") : document.createElement("video"); - video.autoplay = true; - video.playsInline = true; - video.muted = true; - if ("srcObject" in video) { - video.srcObject = stream; - } else { - video.src = window.URL.createObjectURL(stream); - } - video.play(); - if (!videoExists) - this.videoContainer.prepend(video); - this._data.partner_params.permissionGranted = true; - this.setActiveScreen(this.cameraScreen); - this._stream = stream; - this._video = video; - } - handleIDStream(stream) { - const videoExists = this.activeScreen === this.IDCameraScreen ? !!this.IDCameraScreen.querySelector("video") : !!this.backOfIDCameraScreen.querySelector("video"); - let video = null; - if (videoExists) { - if (this.activeScreen === this.IDCameraScreen) { - video = this.IDCameraScreen.querySelector("video"); - } else { - video = this.backOfIDCameraScreen.querySelector("video"); - } - } else { - video = document.createElement("video"); - } - video.autoplay = true; - video.playsInline = true; - video.muted = true; - if ("srcObject" in video) { - video.srcObject = stream; - } else { - video.src = window.URL.createObjectURL(stream); - } - video.play(); - const videoContainer = this.activeScreen === this.IDCameraScreen ? this.IDCameraScreen.querySelector(".id-video-container") : this.backOfIDCameraScreen.querySelector(".id-video-container"); - video.onloadedmetadata = () => { - videoContainer.querySelector(".actions").hidden = false; - }; - if (!videoExists) { - videoContainer.prepend(video); - } - this._IDStream = stream; - this._IDVideo = video; - } - handleError(e) { - switch (e.name) { - case "NotAllowedError": - case "SecurityError": - this.errorMessage.textContent = ` - Looks like camera access was not granted, or was blocked by a browser - level setting / extension. Please follow the prompt from the URL bar, - or extensions, and enable access. - You may need to refresh to start all over again - `; - break; - case "AbortError": - this.errorMessage.textContent = ` - Oops! Something happened, and we lost access to your stream. - Please refresh to start all over again - `; - break; - case "NotReadableError": - this.errorMessage.textContent = ` - There seems to be a problem with your device's camera, or its connection. - Please check this, and when resolved, try again. Or try another device. - `; - break; - case "NotFoundError": - this.errorMessage.textContent = ` - We are unable to find a video stream. - You may need to refresh to start all over again - `; - break; - case "TypeError": - this.errorMessage.textContent = ` - This site is insecure, and as such cannot have access to your camera. - Try to navigate to a secure version of this page, or contact the owner. - `; - break; - default: - this.errorMessage.textContent = e.message; - } - } - _startImageCapture() { - this.startImageCapture.disabled = true; - const imageOutlineLength = this.imageOutline.getTotalLength(); - this.imageOutline.style.transition = "none"; - this.imageOutline.style.strokeDasharray = `${imageOutlineLength} ${imageOutlineLength}`; - this.imageOutline.style.strokeDashoffset = imageOutlineLength; - this.imageOutline.getBoundingClientRect(); - this.imageOutline.style.transition = `stroke-dashoffset ${this._videoStreamDurationInMS / 1e3}s ease-in-out`; - this.imageOutline.style.strokeDashoffset = "0"; - this.smileCTA.style.animation = `fadeInOut ease ${this._videoStreamDurationInMS / 1e3}s`; - this._imageCaptureInterval = setInterval(() => { - this._capturePOLPhoto(); - }, this._imageCaptureIntervalInMS); - this._videoStreamTimeout = setTimeout(() => { - this._stopVideoStream(this._stream); - }, this._videoStreamDurationInMS); - } - _captureIDImage() { - const image = this._drawIDImage(); - if (this.activeScreen === this.IDCameraScreen) { - this.IDReviewImage.src = image; - } else { - this.backOfIDReviewImage.src = image; - } - this._data.images.push({ - image: image.split(",")[1], - image_type_id: this.activeScreen === this.IDCameraScreen ? 3 : 7 - }); - this._stopIDVideoStream(); - if (this.activeScreen === this.IDCameraScreen) { - this.setActiveScreen(this.IDReviewScreen); - } else { - this.setActiveScreen(this.backOfIDReviewScreen); - } - } - _drawImage(canvas, enableImageTests = true, video = this._video) { - this.resetErrorMessage(); - const context = canvas.getContext("2d"); - context.drawImage( - video, - 0, - 0, - video.videoWidth, - video.videoHeight, - 0, - 0, - canvas.width, - canvas.height - ); - if (enableImageTests) { - const imageData = context.getImageData(0, 0, canvas.width, canvas.height); - const hasEnoughColors = hasMoreThanNColors(imageData.data); - if (hasEnoughColors) { - return context; - } - throw new Error("Unable to capture webcam images - Please try another device"); - } else { - return context; - } - } - _capturePOLPhoto() { - const canvas = document.createElement("canvas"); - canvas.width = 240; - canvas.height = canvas.width * this._video.videoHeight / this._video.videoWidth; - this._drawImage(canvas, false); - this._rawImages.push(canvas.toDataURL("image/jpeg")); - } - _captureReferencePhoto() { - const canvas = document.createElement("canvas"); - canvas.width = 480; - canvas.height = canvas.width * this._video.videoHeight / this._video.videoWidth; - this._drawImage(canvas, !this.disableImageTests); - const image = canvas.toDataURL("image/jpeg"); - this._referenceImage = image; - this._data.images.push({ - image: image.split(",")[1], - image_type_id: 2 - }); - } - _skipBackDocument() { - this._publishSelectedImages(); - } - async _uploadDocument(event) { - this.resetErrorMessage(); - try { - const { files } = event.target; - const fileData = await SmartFileUpload.retrieve(files); - this._data.images.push({ - // NOTE: data URLs start with a file type before the base64 data, - // separated by a comma. - // - // we are only interested in the base64 segment, so we extract it - image: fileData.split(",")[1], - image_type_id: this.activeScreen === this.idEntryScreen ? 3 : 7 - }); - const nextScreen = this.activeScreen === this.idEntryScreen ? this.IDReviewScreen : this.backOfIDReviewScreen; - const previewImage = nextScreen.querySelector("img"); - previewImage.src = fileData; - this.setActiveScreen(nextScreen); - } catch (error) { - this.handleError(error); - } - } - _drawIDImage(video = this._IDVideo) { - const canvas = document.createElement("canvas"); - if (this.isPortraitCaptureView) { - canvas.width = video.videoWidth; - canvas.height = video.videoHeight; - const ctx = canvas.getContext("2d"); - ctx.drawImage(video, 0, 0, canvas.width, canvas.height); - const previewWidth = PORTRAIT_ID_PREVIEW_WIDTH; - const previewHeight = PORTRAIT_ID_PREVIEW_HEIGHT; - const paddingPercent = 0.5; - const paddedWidth = previewWidth * (1 + paddingPercent); - const paddedHeight = previewHeight * (1 + paddingPercent); - const cropWidth = paddedWidth; - const cropHeight = paddedHeight; - const cropLeft = (canvas.width - cropWidth) / 2; - const cropTop = (canvas.height - cropHeight) / 2; - const croppedCanvas = document.createElement("canvas"); - croppedCanvas.width = cropWidth; - croppedCanvas.height = cropHeight; - const croppedCtx = croppedCanvas.getContext("2d"); - croppedCtx.drawImage(canvas, cropLeft, cropTop, cropWidth, cropHeight, 0, 0, cropWidth, cropHeight); - return croppedCanvas.toDataURL("image/jpeg"); - } - canvas.width = 2240; - canvas.height = 1260; - const context = canvas.getContext("2d"); - const aspectRatio = video.videoWidth / video.videoHeight; - if (aspectRatio < 1) { - const imageFrame = this.activeScreen.querySelector('[class*="image-frame"]:not([hidden]) [href*="image-frame"]'); - const videoBox = video.getBoundingClientRect(); - const frameBox = imageFrame.getBoundingClientRect(); - const sourceXOffset = (frameBox.left - videoBox.left) / videoBox.width * video.videoWidth; - const sourceYOffset = (frameBox.top - videoBox.top) / videoBox.height * video.videoHeight; - const sourceWidth = frameBox.width * (video.videoWidth / videoBox.width); - const sourceHeight = frameBox.height * (video.videoHeight / videoBox.height); - canvas.height = canvas.width * frameBox.height / frameBox.width; - context.drawImage(video, sourceXOffset, sourceYOffset, sourceWidth, sourceHeight, 0, 0, canvas.width, canvas.height); - return canvas.toDataURL("image/jpeg"); - } - context.drawImage(video, 0, 0, canvas.width, canvas.height); - return canvas.toDataURL("image/jpeg"); - } - _stopVideoStream(stream) { - try { - clearTimeout(this._videoStreamTimeout); - clearInterval(this._imageCaptureInterval); - clearInterval(this._drawingInterval); - this.smileCTA.style.animation = "none"; - this._capturePOLPhoto(); - this._captureReferencePhoto(); - stream.getTracks().forEach((track) => track.stop()); - this.reviewImage.src = this._referenceImage; - const totalNoOfFrames = this._rawImages.length; - const livenessFramesIndices = getLivenessFramesIndices(totalNoOfFrames); - this._data.images = this._data.images.concat(livenessFramesIndices.map((imageIndex) => ({ - image: this._rawImages[imageIndex].split(",")[1], - image_type_id: 6 - }))); - this.setActiveScreen(this.reviewScreen); - } catch (error) { - this.setActiveScreen(this.failedImageTestScreen); - } - } - _stopIDVideoStream(stream = this._IDStream) { - stream.getTracks().forEach((track) => track.stop()); - } - async _startIDCamera() { - try { - const stream = await navigator.mediaDevices.getUserMedia({ - audio: false, - video: { - facingMode: "environment", - width: { min: 1280 }, - // NOTE: Special case for multi-camera Samsung devices (learnt from Acuant) - // "We found out that some triple camera Samsung devices (S10, S20, Note 20, etc) capture images blurry at edges. - // Zooming to 2X, matching the telephoto lens, doesn't solve it completely but mitigates it." - zoom: isSamsungMultiCameraDevice() ? 2 : 1 - } - }); - if (this.activeScreen === this.idEntryScreen) { - this.setActiveScreen(this.IDCameraScreen); - } else if (this.activeScreen === this.backOfIdEntryScreen) { - this.setActiveScreen(this.backOfIDCameraScreen); - } - this.handleIDStream(stream); - } catch (e) { - this.handleError(e); - } - } - _selectSelfie() { - if (!this.captureID) { - this._publishSelectedImages(); - } else { - this.setActiveScreen(this.idEntryScreen); - } - } - _selectIDImage(backOfIDCaptured = false) { - if (!this.captureBackOfID || backOfIDCaptured) { - this._publishSelectedImages(); - } else { - this.setActiveScreen(this.backOfIdEntryScreen); - } - } - _publishSelectedImages() { - this.dispatchEvent( - new CustomEvent("imagesComputed", { detail: this._data }) - ); - this.setActiveScreen(this.thanksScreen); - } - _exitSmartCamera() { - this.dispatchEvent( - new CustomEvent("close", { detail: {} }) - ); - } - _backAndExit() { - this.dispatchEvent( - new CustomEvent("backExit", { detail: {} }) - ); - } - async _reStartImageCapture() { - this.startImageCapture.disabled = false; - this._rawImages = []; - this._data.images = []; - try { - const stream = await navigator.mediaDevices.getUserMedia({ - audio: false, - video: true - }); - this.handleSuccess(stream); - } catch (e) { - this.handleError(e); - } - } - async _reCaptureIDImage() { - const previousScreen = this.activeScreen === this.IDReviewScreen ? this.idEntryScreen : this.backOfIdEntryScreen; - this.setActiveScreen(previousScreen); - this._data.images.pop(); - } - get captureID() { - return this.hasAttribute("capture-id"); - } - get captureBackOfID() { - return this.getAttribute("capture-id") === "back" || false; - } - get hideAttribution() { - return this.hasAttribute("hide-attribution"); - } - get showNavigation() { - return this.hasAttribute("show-navigation"); - } - get hideBackToHost() { - return this.hasAttribute("hide-back-to-host"); - } - get documentType() { - return this.getAttribute("document-type"); - } - get isPortraitCaptureView() { - return this.getAttribute("document-type") === "GREEN_BOOK"; - } - get documentCaptureModes() { - return this.getAttribute("document-capture-modes") || "camera"; - } - get supportBothCaptureModes() { - const value = this.documentCaptureModes; - return value.includes("camera") && value.includes("upload"); - } - get disableImageTests() { - return this.hasAttribute("disable-image-tests"); - } - get doNotUpload() { - return this.getAttribute("document-capture-modes") === "camera"; - } - }; - window.customElements.define("smart-camera-web", SmartCameraWeb); - - // src/js/smartselfie-auth.js - var import_jszip = __toESM(require_jszip_min(), 1); - - // package.json - var version = "v1.2.3"; - - // src/js/smartselfie-auth.js - (function SmartSelfie() { - "use strict"; - const endpoints = { - sandbox: "https://testapi.smileidentity.com/v1", - live: "https://api.smileidentity.com/v1", - production: "https://api.smileidentity.com/v1" - }; - const referenceWindow = window.parent; - referenceWindow.postMessage("SmileIdentity::ChildPageReady", "*"); - const labels = { - 2: { - title: "SmartSelfie\u2122 Authentication", - upload: "Authenticating User" - }, - 4: { - title: "SmartSelfie\u2122 Registration", - upload: "Registering User" - } - }; - let config; - let activeScreen; - let id_info; - let images; - let partner_params; - const SmartCameraWeb2 = document.querySelector("smart-camera-web"); - const UploadProgressScreen = document.querySelector( - "#upload-progress-screen" - ); - const UploadFailureScreen = document.querySelector("#upload-failure-screen"); - const CompleteScreen = document.querySelector("#complete-screen"); - const CloseIframeButton = document.querySelector("#close-iframe"); - const RetryUploadButton = document.querySelector("#retry-upload"); - let fileToUpload; - let uploadURL; - window.addEventListener( - "message", - async (event) => { - if (event.data && event.data.includes("SmileIdentity::Configuration")) { - config = JSON.parse(event.data); - partner_params = getPartnerParams(); - id_info = {}; - setActiveScreen(SmartCameraWeb2); - } - }, - false - ); - SmartCameraWeb2.addEventListener( - "imagesComputed", - (event) => { - images = event.detail.images; - const title = document.querySelector("#uploadTitle"); - title.innerHTML = labels[`${partner_params.job_type}`].upload; - setActiveScreen(UploadProgressScreen); - handleFormSubmit(); - }, - false - ); - RetryUploadButton.addEventListener( - "click", - () => { - retryUpload(); - }, - false - ); - CloseIframeButton.addEventListener( - "click", - () => { - closeWindow(true); - }, - false - ); - function parseJWT(token) { - const base64Url = token.split(".")[1]; - const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/"); - const jsonPayload = decodeURIComponent( - atob(base64).split("").map(function(c) { - return `%${c.charCodeAt(0).toString(16)}`; - }).join("") - ); - return JSON.parse(jsonPayload); - } - function getPartnerParams() { - const { partner_params: partnerParams } = parseJWT(config.token); - partner_params = { ...partnerParams, ...config.partner_params || {} }; - return partner_params; - } - function setActiveScreen(node) { - if (activeScreen) - activeScreen.hidden = true; - node.hidden = false; - activeScreen = node; - } - async function handleFormSubmit() { - const errorMessage = document.querySelector(".validation-message"); - if (errorMessage) - errorMessage.remove(); - try { - [uploadURL, fileToUpload] = await Promise.all([ - getUploadURL(), - createZip() - ]); - uploadZip(fileToUpload, uploadURL); - } catch (error) { - displayErrorMessage("Something went wrong"); - console.error( - `SmileIdentity - ${error.name || error.message}: ${error.cause}` - ); - } - } - function displayErrorMessage(message) { - const p = document.createElement("p"); - p.textContent = message; - p.style.color = "red"; - p.style.fontSize = "1.5rem"; - p.style.textAlign = "center"; - const main = document.querySelector("main"); - main.prepend(p); - } - async function createZip() { - const zip = new import_jszip.default(); - zip.file( - "info.json", - JSON.stringify({ - package_information: { - language: "Hosted Web Integration", - apiVersion: { - buildNumber: 0, - majorVersion: 2, - minorVersion: 0 - } - }, - id_info, - images - }) - ); - try { - const zipFile = await zip.generateAsync({ type: "blob" }); - return zipFile; - } catch (error) { - throw new Error("createZip failed", { cause: error }); - } - } - async function getUploadURL() { - const payload = { - source_sdk: config.sdk || "hosted_web", - source_sdk_version: config.sdk_version || version, - file_name: `${config.product}.zip`, - smile_client_id: config.partner_details.partner_id, - callback_url: config.callback_url, - token: config.token, - partner_params - }; - const fetchConfig = { - cache: "no-cache", - mode: "cors", - headers: { - Accept: "application/json", - "Content-Type": "application/json" - }, - method: "POST", - body: JSON.stringify(payload) - }; - const URL = `${endpoints[config.environment]}/upload`; - const response = await fetch(URL, fetchConfig); - const json = await response.json(); - if (json.error) - throw new Error(json.error); - return json.upload_url; - } - function uploadZip(file, destination) { - const request = new XMLHttpRequest(); - request.open("PUT", destination); - request.upload.addEventListener("load", function() { - return request.response; - }); - request.upload.addEventListener("error", function(e) { - setActiveScreen(UploadFailureScreen); - throw new Error("uploadZip failed", { cause: e }); - }); - request.onreadystatechange = function() { - if (request.readyState === XMLHttpRequest.DONE && request.status === 200) { - setActiveScreen(CompleteScreen); - handleSuccess(); - window.setTimeout(closeWindow, 2e3); - } - if (request.readyState === XMLHttpRequest.DONE && request.status !== 200) { - setActiveScreen(UploadFailureScreen); - throw new Error("uploadZip failed", { cause: request }); - } - }; - request.setRequestHeader("Content-type", "application/zip"); - request.send(file); - } - function retryUpload() { - const fileUploaded = uploadZip(fileToUpload, uploadURL); - return fileUploaded; - } - function closeWindow(userTriggered) { - const message = userTriggered ? "SmileIdentity::Close" : "SmileIdentity::Close::System"; - referenceWindow.postMessage(message, "*"); - } - function handleSuccess() { - referenceWindow.postMessage("SmileIdentity::Success", "*"); - } - })(); -})(); -/*! Bundled license information: - -jszip/dist/jszip.min.js: - (*! - - JSZip v3.10.1 - A JavaScript class for generating and reading zip files - - - (c) 2009-2016 Stuart Knightley - Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. - - JSZip uses the library pako released under the MIT license : - https://github.com/nodeca/pako/blob/main/LICENSE - *) -*/ diff --git a/packages/embed/build/kra-verification-basic-kyc.html b/packages/embed/build/kra-verification-basic-kyc.html deleted file mode 100644 index 2dd54544..00000000 --- a/packages/embed/build/kra-verification-basic-kyc.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/kra-verification-ekyc.html b/packages/embed/build/kra-verification-ekyc.html deleted file mode 100644 index 7d895add..00000000 --- a/packages/embed/build/kra-verification-ekyc.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/product-selection.html b/packages/embed/build/product-selection.html deleted file mode 100644 index b6abe38a..00000000 --- a/packages/embed/build/product-selection.html +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - SmileIdentity - ID Type Selection - - - - - - - - - - - - - - -
-
- -
-

- -

Setting up

- -

- Just a few more seconds -
- We are setting up your verification flow -

- -

- Powered by SmileID - -

-
- - -
- - - - diff --git a/packages/embed/build/smartselfie-auth.html b/packages/embed/build/smartselfie-auth.html deleted file mode 100644 index 5aaf8105..00000000 --- a/packages/embed/build/smartselfie-auth.html +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - SmileIdentity - SmartSelfie Authentication - - - - - - - - - - - - - -
- - - - - - - - -
- - - - diff --git a/packages/embed/build/smartselfie.html b/packages/embed/build/smartselfie.html deleted file mode 100644 index 69ced52f..00000000 --- a/packages/embed/build/smartselfie.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/verification-method-selection-single-country-multiple-id-types.html b/packages/embed/build/verification-method-selection-single-country-multiple-id-types.html deleted file mode 100644 index b379917d..00000000 --- a/packages/embed/build/verification-method-selection-single-country-multiple-id-types.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/verification-method-selection-single-country-single-id-type.html b/packages/embed/build/verification-method-selection-single-country-single-id-type.html deleted file mode 100644 index 811f2a71..00000000 --- a/packages/embed/build/verification-method-selection-single-country-single-id-type.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/embed/build/verification-method-selection.html b/packages/embed/build/verification-method-selection.html deleted file mode 100644 index 410dd737..00000000 --- a/packages/embed/build/verification-method-selection.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - -