Server : Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.6 System : Windows NT USER-PC 6.1 build 7601 (Windows 7 Professional Edition Service Pack 1) AMD64 User : User ( 0) PHP Version : 7.4.6 Disable Function : NONE Directory : C:/Program Files/Avast Software/Avast/gui_resources/default_av/ |
//{"name":"PrivacyPasswords","version":"1.2.319","created":"2020-10-07T08:16:16.993Z"} import Ractive from './ractive.js'; import { Router } from './libs.js'; import NAPI$1 from './napiAdapter.js'; const template = {"v":3,"t":[{"t":7,"e":"Standalone","a":{"module":"PrivacyPasswords","product":"passwords","title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.product.AVAST_PASSWORDS\")"}}],"minimizeIconTitle":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.minimize\")"}}],"closeIconTitle":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.close\")"}}]},"f":[{"t":7,"e":"div","a":{"class":"nui_page pam"},"f":[{"t":4,"f":[{"t":7,"e":"Header","a":{"section":"privacy","customBreadcrumbs":0,"moduleId":"passwords","gradient":"false","cssCls":["pam_header ",{"t":2,"x":{"r":["page"],"s":"_0===\"passwordsList\"?\"pam_top-menu-header\":\"\""}}],"innerYield":0},"f":[{"t":7,"e":"div","a":{"class":"nui_header__buttons pam_lock"},"f":[{"t":4,"f":[{"t":7,"e":"button","a":{"class":"a"},"v":{"click":"lock"},"f":[{"t":7,"e":"Icon","a":{"name":"lock"}},{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.lock\")"}}]}],"n":50,"x":{"r":["page","hasSystemLogin"],"s":"_0===\"passwordsList\"&&!_1"}}," ",{"t":4,"f":[{"t":7,"e":"button","a":{"class":"a g-margin-left--5"},"v":{"click":"openSettings"},"f":[{"t":7,"e":"Icon","a":{"name":"settings"}},{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings\")"}}]}],"n":50,"x":{"r":["page"],"s":"_0===\"passwordsList\"||_0===\"unlockScreen\"||_0===\"systemLoginError\""}}]}]}],"n":50,"x":{"r":["IS_STANDALONE_WINDOW","offerStandaloneUi"],"s":"!_0&&!_1"}}," ",{"t":4,"f":[{"t":7,"e":"Settings","a":{"page":[{"t":2,"r":"page"}]}}],"n":50,"r":"showSettings"}," ",{"t":4,"f":[{"t":7,"e":"OpenStandaloneUi"}],"n":50,"r":"offerStandaloneUi"},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["page"],"s":"_0===\"setMasterPassword\""},"f":[{"t":7,"e":"MasterPasswordModal","a":{"masterPasswordSet":[{"t":2,"r":"sensitiveModalParams.masterPasswordSet"}]}}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"setMasterPassword\"))&&(_0===\"unlockCefDialog\")"},"f":[" ",{"t":7,"e":"UnlockCefDialog"}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"setMasterPassword\"))&&((!(_0===\"unlockCefDialog\"))&&(_0===\"passwordDetails\"))"},"f":[" ",{"t":7,"e":"Modal","a":{"cssCls":"pam_detail_modal","scrollable":0,"autoClose":0,"title":[{"t":4,"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.addPassword\")"}}],"n":50,"x":{"r":["sensitiveModalParams.mode","CONST.MODES.PASSWORDADD"],"s":"_0===_1"}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["sensitiveModalParams.mode","CONST.MODES.PASSWORDVIEW"],"s":"_0===_1"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordDetail\")"}}]},{"t":4,"n":50,"x":{"r":["CONST.MODES.PASSWORDVIEW","sensitiveModalParams.mode","CONST.MODES.PASSWORDEDIT"],"s":"(!(_1===_0))&&(_1===_2)"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.editPassword\")"}}]}],"x":{"r":["sensitiveModalParams.mode","CONST.MODES.PASSWORDADD"],"s":"_0===_1"}}]},"f":[{"t":7,"e":"PasswordDetails","a":{"mode":[{"t":2,"r":"sensitiveModalParams.mode"}],"passwordId":[{"t":2,"r":"sensitiveModalParams.passwordId"}]}}]}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"setMasterPassword\"))&&((!(_0===\"unlockCefDialog\"))&&((!(_0===\"passwordDetails\"))&&(_0===\"loading\")))"},"f":[" ",{"t":7,"e":"div","a":{"class":"center__wrap"},"f":[{"t":7,"e":"div","a":{"class":"center"},"f":[{"t":7,"e":"Loading","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.loading\")"}}]}}]}]}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"setMasterPassword\"))&&((!(_0===\"unlockCefDialog\"))&&((!(_0===\"passwordDetails\"))&&((!(_0===\"loading\"))&&(_0===\"onboarding\"))))"},"f":[" ",{"t":7,"e":"Onboarding"}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"setMasterPassword\"))&&((!(_0===\"unlockCefDialog\"))&&((!(_0===\"passwordDetails\"))&&((!(_0===\"loading\"))&&((!(_0===\"onboarding\"))&&(_0===\"unlockScreen\")))))"},"f":[" ",{"t":7,"e":"div","a":{"class":"nui_page__scroll"},"f":[{"t":7,"e":"Unlock","a":{"isStandAlone":[{"t":2,"r":"IS_STANDALONE_WINDOW"},"/"]},"f":[]}]}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"setMasterPassword\"))&&((!(_0===\"unlockCefDialog\"))&&((!(_0===\"passwordDetails\"))&&((!(_0===\"loading\"))&&((!(_0===\"onboarding\"))&&((!(_0===\"unlockScreen\"))&&(_0===\"enterAccountScreen\"))))))"},"f":[" ",{"t":7,"e":"div","a":{"class":"nui_page__scroll"},"f":[{"t":7,"e":"EnterAccountScreen","a":{"syncState":[{"t":2,"r":"syncState"}],"reason":[{"t":2,"r":"enterAccountScreen.reason"}],"email":[{"t":2,"r":"email"}],"isStandAlone":[{"t":2,"r":"IS_STANDALONE_WINDOW"},"/"]},"f":[]}]}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"setMasterPassword\"))&&((!(_0===\"unlockCefDialog\"))&&((!(_0===\"passwordDetails\"))&&((!(_0===\"loading\"))&&((!(_0===\"onboarding\"))&&((!(_0===\"unlockScreen\"))&&((!(_0===\"enterAccountScreen\"))&&(_0===\"passwordsList\")))))))"},"f":[" ",{"t":7,"e":"List","a":{"isStandAlone":[{"t":2,"r":"IS_STANDALONE_WINDOW"}],"page":[{"t":2,"r":"page"}],"hasSystemLogin":[{"t":2,"r":"hasSystemLogin"}]}}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"setMasterPassword\"))&&((!(_0===\"unlockCefDialog\"))&&((!(_0===\"passwordDetails\"))&&((!(_0===\"loading\"))&&((!(_0===\"onboarding\"))&&((!(_0===\"unlockScreen\"))&&((!(_0===\"enterAccountScreen\"))&&((!(_0===\"passwordsList\"))&&(_0===\"systemLoginError\"))))))))"},"f":[" ",{"t":7,"e":"div","a":{"class":"center__wrap"},"f":[{"t":7,"e":"div","a":{"class":"center"},"f":[{"t":7,"e":"div","a":{"style":"font-size: 150px; margin: 50px; color:#f5203e;"},"f":[{"t":7,"e":"Icon","a":{"name":"exclamation-sign"}}]}," ",{"t":7,"e":"p","f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.error\")"}}," 0x8009000BU"]}]}]}]}],"r":"offerStandaloneUi"}]}," ",{"t":4,"f":[{"t":7,"e":"CaptchaModal","a":{"syncState":[{"t":2,"r":"syncState"}],"openedFromMainUi":[{"t":2,"r":"solvingCaptcha.openedFromMainUi"}],"cid":[{"t":2,"r":"solvingCaptcha.cid"}],"url":[{"t":2,"r":"solvingCaptcha.url"}]}}],"n":50,"r":"solvingCaptcha.show"},{"t":4,"f":[{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.allDone.title\")"}}]},"f":[{"t":7,"e":"Icon","a":{"name":"tick-circle","cssCls":"g-font--120 g-margin-top--20 g-margin-bottom--20 color-ok -text"}}," ",{"t":7,"e":"div","a":{"class":"modal__actions g-margin-top--20"},"f":[{"t":7,"e":"button","a":{"class":"btn"},"v":{"click":"hideSyncEnabledModal"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.done\")"}}]}]}]}],"n":50,"r":"showSyncEnabledModal"}]}]}; var css_248z = ".pam_wizzard {\n display: block;\n text-align: center;\n padding: 0;\n}\n.pam_wizzard__icon {\n margin: 0 auto;\n display: block;\n font-size: calc(100px + 10vh);\n}\n.pam_wizzard li {\n width: 30%;\n display: inline-block;\n margin: 0 1%;\n vertical-align: top;\n}\n.pam_flex {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: space-around;\n align-content: center;\n}\n.pam_flex.pam_-check {\n height: 100%;\n}\n.pam_title {\n max-width: 540px;\n margin: 0 auto;\n}\n.pam_description {\n max-width: 520px;\n margin: auto;\n margin-top: 14px;\n opacity: 0.7;\n}\n.pam_onboarding_screen {\n min-width: 600px;\n width: 100%;\n text-align: center;\n}\n.pam_onboarding_carousel {\n position: relative;\n height: 350px;\n margin-bottom: 30px;\n}\n.pam_carousel_padding {\n padding-top: 45px;\n}\n.pam-onboarding-modal .modal {\n width: 600px;\n}\n.pam-onboarding-modal-button {\n margin-bottom: 20px;\n}\n.pam_wizzard_icon_rectangle {\n margin-top: -30px;\n margin-bottom: -30px;\n font-size: calc(160px + 10vh);\n}\n.pam_create-pwd {\n position: relative;\n width: 100%;\n}\n.pam .pam_create-pwd__btn {\n min-width: 300px;\n}\n.pam_syncing {\n position: relative;\n width: 100%;\n}\n.pam_onboarding__result {\n min-height: 30px;\n}\n.pam_issues__key {\n width: 64px;\n height: 64px;\n background: #2d364c;\n border-radius: 50%;\n position: absolute;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n[dir='rtl'] .pam_issues__key {\n left: auto;\n right: 0;\n}\n.pam_issues__number {\n position: absolute;\n top: -10px;\n right: -2px;\n width: 32px;\n height: 32px;\n border-radius: 50%;\n background: #d0011b;\n color: #fff;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n[dir='rtl'] .pam_issues__number {\n right: auto;\n left: -2px;\n}\n.pam_issues {\n width: 490px;\n padding: 0 0 0 85px;\n margin: 0 auto;\n position: relative;\n}\n[dir='rtl'] .pam_issues {\n padding: 0 85px 0 0;\n}\n.pam_issues strong {\n font-weight: 700;\n color: #d0021b;\n}\n.pam_issues__promo {\n position: relative;\n max-width: 574px;\n padding: 25px;\n border: 1px solid #efe0ad;\n border-radius: 20px;\n background: #fffcea;\n font-size: 14px;\n color: #4e4e4e;\n margin: 15px auto;\n}\n.pam_issues__promo:before {\n display: block;\n content: '';\n position: absolute;\n top: -18px;\n right: 84px;\n border-bottom: 18px solid #fffcea;\n border-left: 18px solid transparent;\n width: 0;\n height: 0;\n z-index: 1;\n}\n.pam_issues__promo:after {\n display: block;\n content: '';\n position: absolute;\n top: -21px;\n right: 83px;\n border-bottom: 20px solid #efe0ad;\n border-left: 20px solid transparent;\n width: 0;\n height: 0;\n}\n.pam_issues__promo h3 {\n font-size: 16px;\n color: #ff7800;\n margin-bottom: 10px;\n}\n.pam_pendingdeletes {\n flex-direction: row;\n}\n.pam_pendingdeletes__cta {\n min-height: 80px;\n}\n.pam_install-extension {\n display: flex;\n align-items: center;\n height: 23vh;\n}\n.pam_install-extension .pam_browser {\n font-size: 16px;\n}\n.pam_install-extension .pam_browser .pam_browser_icon {\n margin-right: 15px;\n font-size: 60px;\n}\n.pam_install-extension .pam_browser .pam_browser_label {\n font-weight: bold;\n}\n[dir='rtl'] .pam_install-extension .pam_browser .pam_browser_icon {\n margin-left: 15px;\n margin-right: 0;\n}\n#import-ok-state-icon {\n width: 150px;\n height: 150px;\n}\n#import-ok-state-icon path {\n stroke-width: 5px;\n fill: none;\n}\n.pam_importedpasswords {\n font-weight: 600;\n}\n.longgrid {\n display: flex;\n position: relative;\n flex-direction: row;\n margin-left: -1.6%;\n margin-right: -1.6%;\n}\n.longgrid .filtered_out {\n display: none;\n}\n.longgrid__1,\n.longgrid__2,\n.longgrid__3,\n.longgrid__4,\n.longgrid__5,\n.longgrid__6 {\n margin: 0 1.6%;\n position: relative;\n}\n.longgrid__1.-margins,\n.longgrid__2.-margins,\n.longgrid__3.-margins,\n.longgrid__4.-margins,\n.longgrid__5.-margins,\n.longgrid__6.-margins {\n margin-bottom: 1.6%;\n margin-top: 1.6%;\n}\n.longgrid__1 {\n width: 12.9%;\n max-width: 12.9%;\n min-width: 12.9%;\n flex-grow: 1;\n}\n.longgrid__2 {\n width: 30.1%;\n max-width: 30.1%;\n min-width: 30.1%;\n flex-grow: 2;\n}\n.longgrid__3 {\n width: 47.3%;\n max-width: 47.3%;\n min-width: 47.3%;\n flex-grow: 3;\n}\n.longgrid__4 {\n width: 64.5%;\n max-width: 64.5%;\n min-width: 64.5%;\n flex-grow: 4;\n}\n.longgrid__5 {\n width: 81.7%;\n max-width: 81.7%;\n min-width: 81.7%;\n flex-grow: 5;\n}\n.longgrid__6 {\n width: 98.9%;\n max-width: 98.9%;\n min-width: 98.9%;\n flex-grow: 6;\n}\n.longgrid.-wrap {\n flex-wrap: wrap;\n}\n[dir=rtl] .longgrid.-wrap {\n flex-wrap: wrap;\n}\n.pam_login_modal_form,\n.pam_master_password_form,\n.pam_account_password_form {\n width: 380px;\n margin: auto;\n}\n.pam_login_modal_form .pam_settings_input_reveal_secret_cont,\n.pam_master_password_form .pam_settings_input_reveal_secret_cont,\n.pam_account_password_form .pam_settings_input_reveal_secret_cont {\n position: relative;\n}\n.pam_login_modal_form .input__row,\n.pam_master_password_form .input__row,\n.pam_account_password_form .input__row {\n height: 60px;\n}\n.pam_login_modal_form .pam_settings_reveal_secret,\n.pam_master_password_form .pam_settings_reveal_secret,\n.pam_account_password_form .pam_settings_reveal_secret {\n position: absolute;\n z-index: 1;\n bottom: 26;\n padding-top: 4px;\n right: 1;\n border: 0 !important;\n background: 0;\n}\n.visible {\n display: block;\n}\n.hidden {\n display: none;\n}\nstrong {\n font-weight: 700;\n}\n.pam_filter {\n text-align: right;\n top: 60px;\n right: 30px;\n z-index: 4;\n position: absolute;\n}\n.pam_filter.pam_-info {\n display: none;\n}\n.pam_filter__ok {\n padding: 6px 0;\n}\n.pam_filter__icon {\n font-size: 1.3em;\n margin: -0.2em 5px 0 0;\n}\n.pam_header.pam_top-menu-header {\n height: 162px;\n}\n.pam_list {\n margin-top: 52px;\n}\n.pam_list .longgrid .-add .cube__label:before {\n content: '+';\n padding-right: 0.5em;\n font-size: 1.1em;\n}\n.pam_item .cube__icon {\n opacity: 1;\n}\n.pam_ul:before,\n.pam_ul:after {\n content: '';\n display: table;\n clear: both;\n}\n.pam .pam_item {\n height: 80px;\n min-height: 80px;\n min-width: 0;\n}\n.pam .pam_item .pam_state_badge {\n position: absolute;\n top: 16px;\n right: 10px;\n box-shadow: -5px 7px 10px #fff, -20px 7px 20px #fff;\n transition: all 0.15s ease-in-out;\n}\n.pam .pam_item:hover .pam_state_badge {\n box-shadow: -5px 7px 10px #dddee3, -20px 7px 20px #dddee3;\n}\n.pam_tip__container span {\n display: inline-block;\n}\n.pam_tip__container img,\n.pam_tip__container span {\n vertical-align: middle;\n}\n.pam_single_line {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.pam_hidden_href:hover {\n text-decoration: underline;\n cursor: pointer;\n}\n.pam_panel_container {\n display: flex;\n}\n.pam_panel_button {\n white-space: nowrap;\n}\n.pam_panel_text,\n.pam_panel_ipm {\n width: 100%;\n height: 72px;\n position: relative;\n margin: 1% 0 18px;\n}\n.pam .pam_score {\n opacity: 1;\n padding-left: 8px;\n padding-right: 8px;\n margin-right: 8px;\n margin-left: 3px;\n text-transform: uppercase;\n font-weight: 700;\n}\n.pam_colors {\n display: inline-block;\n vertical-align: middle;\n}\n.pam_color {\n width: 100%;\n height: 100%;\n border-radius: 100px;\n background-color: #5591f7;\n display: inline-block;\n text-align: center;\n}\n.pam_color__text {\n fill: #fff;\n font-family: inherit;\n font-size: 0.5em;\n text-anchor: middle;\n text-shadow: 0 1px 0 rgba(0,0,0,0.4);\n}\n.pam_card_icon {\n width: 50px;\n height: 50px;\n display: inline-block;\n text-align: center;\n vertical-align: middle;\n font-size: 50px;\n}\n.-preview {\n display: inline-block;\n width: 50px;\n height: 50px;\n vertical-align: middle;\n font-size: 40px;\n}\n.-preview .pam_note {\n line-height: 50px;\n}\n.avs .pam_icon {\n border-radius: 50%;\n overflow: hidden;\n}\n.avs .pam_icon_image {\n width: 100%;\n height: 100%;\n margin-top: -50px;\n opacity: 0;\n transition: opacity 0.2s;\n border-radius: 0;\n}\n.avs .pam_icon_image.loaded {\n opacity: 1;\n}\n.avs .pam_icon_image.notransition {\n transition: none;\n}\n.avs .pam_icon_image.nomargin {\n margin-top: 0;\n}\ninput.pam_color {\n width: 24px;\n height: 24px;\n border: solid 2px #fff;\n margin: 0 5px 0 -2px;\n cursor: pointer;\n -webkit-appearance: none;\n}\ninput.pam_color:focus,\ninput.pam_color:checked {\n border-color: #2c3156;\n outline: 0;\n}\n.pam_edit__title {\n display: inline-block;\n vertical-align: middle;\n margin-left: 10px;\n width: 365px;\n}\n.avs .modal {\n max-height: 100%;\n}\n.avs .modal.pam_form {\n height: 70%;\n}\n.avs .nui_main.nui_main_standalone .modal.pam_form {\n height: 100%;\n}\n.avs .modal__scroll {\n padding-top: 0px;\n padding-bottom: 0px;\n}\n.pam_detail_modal .modal__header,\n.pam_detail_modal .modal__footer,\n.pam_detail_modal .modal {\n min-width: initial;\n width: 500px;\n}\n.pam_detail_modal .pam_form {\n text-align: initial;\n width: 500px;\n}\n.pam_detail_modal .btn__split .btn {\n border-radius: 0;\n}\n.pam .pam_label {\n display: block;\n padding: 20px 0 0;\n}\n.pam .pam_label__sub {\n padding: 5px 0 0;\n}\n.pam_value {\n -webkit-user-select: text;\n min-height: 20px;\n font-size: 16px;\n}\n.pam_value:read-only {\n opacity: 1;\n cursor: default;\n border: 0;\n border-left-width: 0;\n box-shadow: none;\n padding: 4px 0;\n height: auto;\n}\np.pam_value:read-only {\n padding: 0;\n}\n.pam_input_actions_row {\n display: flex;\n justify-content: space-between;\n}\n.pam_pwd {\n float: left;\n flex-grow: 3;\n position: relative;\n z-index: 2;\n}\n.pam_pwd:read-only {\n margin-right: 10px;\n}\n.pam_pwd__wrap {\n display: flex;\n position: relative;\n margin-top: -2px;\n}\n.pam_pwd__wrap.pam_-edit {\n margin-top: 0;\n}\n.pam_pwd__twin {\n position: absolute;\n z-index: 1;\n bottom: 0;\n left: 0;\n}\n.pam_copied {\n pointer-events: none;\n overflow: hidden;\n max-width: 0;\n min-width: 0;\n padding-left: 0;\n padding-right: 0;\n border-right: none !important;\n transition: width 0.5s, max-width 0.5s, min-width 0.5s, padding-left 0.5s, padding-right 0.5s;\n position: absolute;\n right: 100%;\n}\n.pam_copied_open {\n padding-left: 10;\n padding-right: 10;\n max-width: 160px;\n}\n.pam_history {\n position: absolute;\n top: 18px;\n right: 0;\n}\n.pam_note {\n color: #fff;\n}\n.pam .pam_textarea {\n height: 150px;\n}\n.pam .pam_textarea:read-only {\n resize: none;\n height: 46px;\n}\n.pam_round-corner {\n border-radius: inherit;\n}\n.pam_row {\n position: relative;\n width: 100%;\n min-height: 36px;\n}\n.pam_show {\n position: absolute;\n top: 4px;\n left: 50%;\n margin-left: 118px;\n}\n.pam_hints {\n position: absolute;\n left: 52%;\n margin-left: 150px;\n top: 0;\n bottom: auto;\n right: 0;\n color: #fff;\n background-color: rgba(0,0,0,0.95);\n text-align: initial;\n padding: 10px 12px;\n border-radius: 3px;\n}\n.pam .pam_lock {\n bottom: auto;\n top: 3px !important;\n}\n.pam_section_title {\n display: none;\n}\n.pam_no-accounts {\n font-size: 27vh;\n margin: 0 auto 3vh;\n display: block;\n}\n.pam_progress {\n position: relative;\n height: 48px;\n margin-bottom: 10px;\n margin-top: 5px;\n color: #2d364c;\n}\n.pam_progress progress[value] {\n position: absolute;\n appearance: none;\n background: #fff;\n width: 100%;\n height: 48px;\n}\n.pam_progress progress[value]::-webkit-progress-bar {\n border: solid 3px #787c9f;\n background-color: #bbbdce;\n}\n.pam_progress progress[value]::-webkit-progress-value {\n background-color: #eeeff4;\n}\n.pam_progress__spinner {\n margin-right: 12px;\n margin-top: -2px;\n border-left-color: rgba(120,124,159,0.7);\n border-bottom-color: rgba(120,124,159,0.7);\n border-right-color: rgba(120,124,159,0.7);\n}\n.pam_progress__percentage {\n position: absolute;\n top: 13px;\n left: 20px;\n}\n.pam_progress__count {\n position: absolute;\n top: 13px;\n right: 20px;\n}\n[dir=rtl] .pam_login_modal_form .pam_settings_reveal_secret,\n[dir=rtl] .pam_master_password_form .pam_settings_reveal_secret,\n[dir=rtl] .pam_account_password_form .pam_settings_reveal_secret {\n left: 1;\n right: auto;\n}\n[dir=rtl] .pam_login_modal_form .pam_settings_reveal_secret .icon,\n[dir=rtl] .pam_master_password_form .pam_settings_reveal_secret .icon,\n[dir=rtl] .pam_account_password_form .pam_settings_reveal_secret .icon {\n padding-right: 4px;\n}\n[dir=rtl] .pam .pam_item .pam_state_badge {\n box-shadow: initial;\n}\n[dir=rtl] .pam_detail_modal .btn__split .btn {\n border-radius: 0;\n border: 1px solid;\n}\n[dir=rtl] .pam_detail_modal .btn__split .icon {\n margin: 0;\n}\n[dir=rtl] .pam_detail_modal .btn__split .pam_copied_open {\n border: 1px solid !important;\n}\n[dir=rtl] .pam_filter {\n text-align: left;\n left: 30px;\n right: auto;\n}\n[dir=rtl] .pam_filter__icon {\n margin-right: 0;\n margin-left: 5px;\n}\n[dir=rtl] .pam_login {\n padding-right: 8px;\n padding-left: 50px;\n}\n[dir=rtl] .pam_show {\n right: 50%;\n left: auto;\n margin-right: 118px;\n margin-left: 0;\n}\n[dir=rtl] .pam_hints {\n right: 52%;\n margin-right: 150px;\n margin-left: 0;\n left: 0;\n}\n[dir=rtl] .pam_edit__title {\n margin-left: initial;\n margin-right: 10px;\n}\n[dir=rtl] .pam_analyze {\n right: auto;\n left: 15px;\n}\n[dir=rtl] .pam_copied {\n right: auto;\n left: 100%;\n}\n.pam_error_label {\n width: 100%;\n height: 2em;\n}\n.pam_error_label.-hidden {\n display: none;\n}\n.pam_error_label p {\n border-radius: 2px;\n}\n"; class onboarding { static get origin() { return 'Direct'; } static viewIntro() { this.trackUserInteraction('Intro', 'View'); } static clickExtensionInstall(browserId) { this.track('Click extension install', browserId); } static skipExtensionInstall(isDefaultBrowser) { this.track( 'Skip extension install', isDefaultBrowser ? 'Default browser' : 'Non-default browser'); } static extensionInstalled(isDefaultBrowser) { this.track( 'Extension installed', isDefaultBrowser ? 'Default browser' : 'Non-default browser'); } static importStarted() { this.track('Import started'); } static importFinsihed() { this.track('Import finished'); } static importCancelled() { this.track('Import cancelled'); } static showPendingBrowserDelete() { this.track('Pending browser delete', 'Show in onboarding'); } static resolvedPendingBrowserDelete() { this.track('Pending browser delete', 'Request resolved'); } static skipPendingBrowserDelete() { this.track('Pending browser delete', 'Request skipped'); } static track(action, label) { NAPI$1.track.event('Passwords-Onboarding', action, label || ''); } static trackUserInteraction(subAction, label) { NAPI$1.request('app.pam.TrackActivityToBurger', { category: 'User Interaction', action: 'Onboarding / ' + subAction, label: label, origin: this.origin }); } } class view { static changed(subPage) { let gaSubPage = ''; switch (subPage) { case 'passwordGuardian': gaSubPage = 'PasswordGuardian'; break; case 'accounts': gaSubPage = 'Logins'; break; case 'creditCards': gaSubPage = 'CreditCards'; break; case 'secureNotes': gaSubPage = 'SecureNotes'; break; } NAPI$1.track.view('PrivacyPasswords/' + gaSubPage); } } class panel { static showPendingBrowserDelete() { this.track('Pending browser delete', 'Show in list'); } static resolvedPendingBrowserDelete() { this.track('Pending browser delete', 'Request resolved'); } static clickExtensionInstall(browserId) { this.track('Click extension install', browserId); } static extensionInstalled(isDefaultBrowser) { this.track( 'Extension installed', isDefaultBrowser ? 'Default browser' : 'Non-default browser'); } static track(action, label) { NAPI$1.track.event('Passwords-Panel', action, label || ''); } } class vault { static lockedManually() { this.track('Locked', 'Manually'); } static track(action, label) { NAPI$1.track.event('Passwords-Vault', action, label || ''); } } class account { static createNew() { this.track('Create new'); } static edited() { this.track('Edited'); } static deleted() { this.track('Deleted'); } static passwordCopied() { this.track('Password copied'); } static passwordRevealed() { this.track('Password revealed'); } static websiteLinkClicked() { this.track('Website link clicked'); } static track(action, label) { NAPI$1.track.event('Passwords-Account', action, label || ''); } } class secureNote { static createNew() { this.track('Create new'); } static edited() { this.track('Edited'); } static deleted() { this.track('Deleted'); } static track(action, label) { NAPI$1.track.event('Passwords-Secure note', action, label || ''); } } class creditCard { static viewDetail() { NAPI$1.request('app.pam.TrackActivityToBurger', { category: 'User Interaction', action: 'View detail', label: 'Card' }); } static createNew() { this.track('Create new'); } static edited() { this.track('Edited'); } static deleted() { this.track('Deleted'); } static track(action, label) { NAPI$1.track.event('Passwords-Credit Card', action, label || ''); } } const track = { onboarding, panel, vault, account, secureNote, creditCard, view }; const template$1 = {"v":3,"t":[{"t":7,"e":"div","a":{"class":"nui_page__scroll g-align--center pam_flex"},"f":[{"t":4,"f":[{"t":7,"e":"Intro"}],"n":50,"x":{"r":["page"],"s":"_0==\"Intro\""}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["page"],"s":"_0===\"InstallBrowsersExtensions\""},"f":[{"t":7,"e":"InstallBrowsersExtensions"}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"InstallBrowsersExtensions\"))&&(_0==\"ImportBrowsersPasswords\")"},"f":[" ",{"t":7,"e":"ImportBrowsersPasswords","a":{"showSuccessScreen":"true"}}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"InstallBrowsersExtensions\"))&&((!(_0==\"ImportBrowsersPasswords\"))&&(_0==\"Error\"))"},"f":[" ",{"t":7,"e":"Error"}]}],"x":{"r":["page"],"s":"_0==\"Intro\""}}]}]}; const template$2 = {"v":3,"t":[{"t":7,"e":"div","a":{"class":"pam_onboarding_screen"},"f":[{"t":7,"e":"div","a":{"class":"pam_onboarding_carousel"},"f":[{"t":7,"e":"div","a":{"class":"nui_carousel__flex pam_carousel_padding"},"f":[{"t":7,"e":"SvgIcon","a":{"name":"pam-onboarding-tour-4","cssCls":"pam_wizzard__icon"}}," ",{"t":7,"e":"div","f":[{"t":7,"e":"h2","a":{"class":"h2 pam_title"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.intro.tour4.title\")"}}]}," ",{"t":7,"e":"p","a":{"class":"pam_description"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.intro.tour4.description\")"}}]}]}]}]}," ",{"t":7,"e":"ApiButton","a":{"cssCls":"-large pam-onboarding-modal-button"},"v":{"domClick":"start"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.intro.start\")"}}]}]}]}; const template$3 = {"v":3,"t":[{"t":7,"e":"Button","a":{"cssCls":[{"t":2,"r":"cssCls"}],"attr":[{"t":2,"r":"attr"}],"href":[{"t":2,"r":"href"}],"wraped":[{"t":2,"r":"wraped"}],"disabled":[{"t":2,"r":"disabled"}]},"v":{"domClick":"click"},"f":[{"t":16}]}]}; // ApiButton component is useful when you want to prevent user to trigger click // events multiple times. After first click is registered button gets disabled. // It can be later re-enabled using enableButton function which is passed inside // click event. // Flow: // 1. Click on button // 2. Call some API in click handler // 3. (If required) Re-enable button when API finishes const ApiButton = Ractive.extend({ isolated: true, template: template$3, data: function() { return { attr: null, cssCls: '', disabled: false, href: null, wraped: false, eventDelay: 300 }; }, onconfig() { // Detect that button is wrapped inside some group (copy&paste from spawn/Button.js) if (this.container && this.container.component.name.match(/^(ButtonDrop|ButtonDropSplit)$/)) this.set('wraped', true); this.on('click', e => { this.set('disabled', true); // Make possible for listener to re-enable button using e.enableButton() // (e.g., when API finishes) e.enableButton = () => this.set('disabled', false); this.fire('domClick', e); }); } }); /** * Password Manager - onboarding - intro screen **/ const Intro = Ractive.extend({ template: template$2, components: { ApiButton } }); var css_248z$1 = ".pam_browser {\n display: inline-flex;\n margin-right: 20px;\n align-items: center;\n flex-direction: row;\n font-weight: 700;\n font-size: 14px;\n}\n.pam_browser .pam_browser_icon {\n margin-right: 7px;\n font-size: 30px;\n}\n.pam_browser .pam_browser_label {\n font-weight: bold;\n}\n[dir=rtl] .pam_browser {\n margin-right: 0;\n margin-left: 20px;\n}\n[dir=rtl] .pam_browser .pam_browser_icon {\n margin-right: 0;\n margin-left: 7px;\n}\n"; const template$4 = {"v":3,"t":[{"t":7,"e":"div","a":{"class":"pam_browser"},"f":[{"t":7,"e":"SvgIcon","a":{"name":[{"t":2,"r":"cssClass"}],"cssCls":"pam_browser_icon"}}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_browser_label"},"f":[{"t":2,"x":{"r":["nls","stringId"],"s":"_0(_1)"}}]}],"n":50,"r":"stringId"},{"t":4,"n":51,"f":[{"t":7,"e":"div","a":{"class":"pam_browser_label"},"f":[{"t":2,"r":"name"}]}],"r":"stringId"}]}]}; var chrome = { stringId: "passwords.install.chrome", cssClass: "chrome", extensionSupported: true }; var firefox = { stringId: "passwords.install.firefox", cssClass: "firefox", extensionSupported: true }; var edge = { stringId: "passwords.install.edge", cssClass: "edge", extensionSupported: false }; var msedge = { stringId: "passwords.install.edge", cssClass: "edge", extensionSupported: true }; var asb = { stringId: "passwords.install.asb", cssClass: "safezone", extensionSupported: true }; const browsersInfo = { chrome: chrome, firefox: firefox, "safe zone": { stringId: "passwords.install.safeZone", cssClass: "safezone", extensionSupported: false }, "safe zone browser": { stringId: "passwords.install.safeZone", cssClass: "safezone", extensionSupported: false }, edge: edge, msedge: msedge, asb: asb }; function getBrowserName(id) { var name = ''; if (browsersInfo[id] && browsersInfo[id].stringId) { name = Ractive.localization.nls(browsersInfo[id].stringId); } else { name = id.substr(0, 1).toLocaleUpperCase() + id.substr(1); } return name; } function getBrowserCssClass(id) { var cssClass = null; if (browsersInfo[id] && browsersInfo[id].cssClass) { cssClass = browsersInfo[id].cssClass; } return cssClass; } /** * Get list of browsers where the extension should be, but isn't yet, installed. * Ordered by expected user's preference. The default one first. * @param {Object[]} installedBrowser - a list of the installed browsers objects * @param {String} installedBrowser[].browser - the id of the browser * @param {Boolean} installedBrowser[].extension - if has extension installed * @param {Boolean} installedBrowser[].default - if is set as default * @returns {Object[]} filtered array with the same structure as the input */ function getBrowsersToInstallExtension(installedBrowsers) { var allBrowsersSupportingExtension = Object.keys(browsersInfo).filter( key => browsersInfo[key].extensionSupported ); var installedBrowsersSupportingExtension = installedBrowsers.filter( browser => allBrowsersSupportingExtension.includes(browser.browser) ); var browsersToInstallExtension = installedBrowsersSupportingExtension.filter( browser => !browser.extension ); var sortedBrowsersToInstallExtension = browsersToInstallExtension.sort( (a, b) => { if (a.default) return -1; if (b.default) return 1; return (allBrowsersSupportingExtension.indexOf(a.browser) < allBrowsersSupportingExtension.indexOf(b.browser)) ? -1 : 1; } ); return sortedBrowsersToInstallExtension; } /** * Find out whether user has any browser with extension enabled. * @param response GetBrowserStatus() response */ function shouldInstallExtension(response) { const safezoneDefault = response.some(b => b.browser == 'szb' && b.default); if (safezoneDefault) { return false; } var supported = response.filter( b => browsersInfo[b.browser] && browsersInfo[b.browser].extensionSupported); var noExtension = supported.every(b => !b.extension); return supported.length > 0 && noExtension; } const Browser = Ractive.extend({ template: template$4, css: css_248z$1, data() { return { browserId: null, name: null, cssClass: null }; }, oninit() { this.observe('browserId', () => this.update()); this.update(); }, update() { var id = this.get('browserId'); if (id) { this.set('name', getBrowserName(id)); this.set('cssClass', getBrowserCssClass(id)); } } }); class RecentlyInstalledExtensionFinder { /** * Return browser which got extension installed since last run of this method. * @param currentBrowserStatus GetBrowserStatus() response */ find(currentBrowserStatus) { if (!this.previousBrowserStatus) { this.previousBrowserStatus = currentBrowserStatus; return null; } var previouslyNotInstalledIds = this.previousBrowserStatus.filter(b => !b.extension).map(b => b.browser); var recentlyInstalled = currentBrowserStatus.find( b => b.extension && previouslyNotInstalledIds.indexOf(b.browser) !== -1); this.previousBrowserStatus = currentBrowserStatus; return recentlyInstalled; } } const template$5 = {"v":3,"t":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"center__wrap"},"f":[{"t":7,"e":"div","a":{"class":"center"},"f":[{"t":7,"e":"Loading","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.creatingStorage\")"}}]}}]}]}],"n":50,"r":"isLoadingNextStep"},{"t":4,"n":51,"f":[{"t":7,"e":"h3","a":{"class":"h2 pam_title"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.installBrowsersExtensions.desc\")"}}]}," ",{"t":7,"e":"div","a":{"class":"pam_install-extension"},"f":[{"t":7,"e":"browser","a":{"browserId":[{"t":2,"r":"browser.id"}]}}]}," ",{"t":7,"e":"div","a":{"class":"pam_pendingdeletes__cta"},"f":[{"t":7,"e":"Button","a":{"cssCls":"-primary -large","eventDelay":"5000"},"v":{"domClick":"installExtension"},"f":[{"t":3,"x":{"r":["nls","browser.name"],"s":"_0(\"passwords.installBrowsersExtensions.activate\",_1)"}}]}," ",{"t":7,"e":"br"}," ",{"t":7,"e":"button","a":{"type":"button","class":"a g-margin-top--10","data-test":"pam_ext-install-skip"},"v":{"click":{"n":"skipBrowser","d":[{"t":2,"r":"browser.id"}]}},"f":[{"t":3,"x":{"r":["nls","browser.name"],"s":"_0(\"passwords.installBrowsersExtensions.skip\",_1)"}}]}]}],"r":"isLoadingNextStep"}]}; function focusMainWindow() { if (/module=PrivacyPasswords/.test(location.search)) { NAPI$1.request('app.windowManager.ShowWindow', { url: 'https://local.avast.com/MainWindow.html?module=PrivacyPasswords', id: 'pam', type: 'CEF', width: 1010, height: 674, setAsForegroundWnd: true, title: 'Avast Password Manager', iconSmall: 215, iconBig: 215, appUserModelRelaunchIcon: 215, appUserModelID: 'avast.pam' }); } else { NAPI$1.request('app.windowManager.FocusMainWindow'); } } /** * Password Manager - onboarding - install browsers extensions **/ const skippedBrowsers = []; const InstallBrowsersExtensions = Ractive.extend({ template: template$5, components: { browser: Browser }, data:() => { return { browser: { id: '', name: '', isDefault: null }, isLoadingNextStep: false }; }, oninit() { this.recentlyInstalledExtensionFinder = new RecentlyInstalledExtensionFinder(); this.on('installExtension', () => { var browser = this.get('browser'); track.onboarding.clickExtensionInstall(browser.id); NAPI$1.request('av.command', 'install_pam_plugin(browser=' + browser.id + ',cn=User%20extension%20install,cs=Onboarding)') .catch(ex => console.error('install_pam_plugin', ex)); }); this.on('skipBrowser', (event, browserId) => { var browser = this.get('browser'); track.onboarding.skipExtensionInstall(browser.isDefault); skippedBrowsers.push(browserId); this.updateBrowserToInstallExtension(); }); this.updateBrowserToInstallExtension(); this.browsersStatusChangedOff = NAPI$1.on('app.pam.onStatusChanged.browserStatus', () => this.updateBrowserToInstallExtension()); }, updateBrowserToInstallExtension() { return NAPI$1.request('app.pam.GetBrowserStatus') .then((response) => { var recentlyInstalled = this.recentlyInstalledExtensionFinder.find(response); console.log('recentlyInstalled', recentlyInstalled); if (recentlyInstalled) { focusMainWindow(); track.onboarding.extensionInstalled(recentlyInstalled.default); } var browsers = getBrowsersToInstallExtension(response).filter( browser => skippedBrowsers.indexOf(browser.browser) < 0 ); if (browsers.length > 0) { this.set('browser', { id: browsers[0].browser, name: getBrowserName(browsers[0].browser), isDefault: browsers[0].default }); } else { this.fire('done'); this.set('isLoadingNextStep', true); } }) .catch(error => console.error('app.pam.GetBrowserStatus', error)); }, onteardown() { if (this.browsersStatusChangedOff) this.browsersStatusChangedOff(); } }); const template$6 = {"v":3,"t":[{"t":7,"e":"h3","a":{"class":"h2 pam_title"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.importBrowsersPasswords.desc\")"}}]}," ",{"t":7,"e":"div","f":[{"t":4,"f":[{"t":7,"e":"div","f":[{"t":7,"e":"Loading","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.importing\")"}}]}}," ",{"t":2,"r":"importingPasswordNumber"}," / ",{"t":2,"r":"browsersPasswordsCount"}]}],"n":50,"r":"isImportRunning"},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["showSuccessScreen"],"s":"_0"},"f":[{"t":7,"e":"svg","a":{"version":"1.1","class":"color-ok -text","id":"import-ok-state-icon","xmlns":"http://www.w3.org/2000/svg","width":"100%","height":"100%","viewBox":"0 0 500 500"},"f":[{"t":7,"e":"path","a":{"d":"M250.3,10.1c132.5,0,239.9,107.4,239.9,239.9S382.8,489.9,250.3,489.9S10.5,382.5,10.5,250\n\t\t\t\tS117.9,10.1,250.3,10.1z"}}," ",{"t":7,"e":"path","a":{"d":"M103.6,254.2l101,101l195.5-195.5"}}]}]}],"r":"isImportRunning"}]}," ",{"t":7,"e":"div","a":{"class":"pam_onboarding__result"},"f":[{"t":4,"f":[{"t":4,"f":[{"t":4,"f":[{"t":7,"e":"p","a":{"data-test":"pam_pwd_import_skip_lbl"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.importBrowsersPasswords.canceling\")"}}]}],"n":50,"r":"skipping"},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["disableSkip"],"s":"!_0"},"f":[{"t":7,"e":"button","a":{"type":"button","class":"a","data-test":"pam_pwd-import-skip"},"v":{"click":"skip"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.importBrowsersPasswords.skip\")"}}]}]}],"r":"skipping"}],"n":50,"r":"allowSkip"}],"n":50,"r":"isImportRunning"},{"t":4,"n":51,"f":[{"t":4,"f":[{"t":7,"e":"p","a":{"class":"pam_importedpasswords color-ok -text"},"f":[{"t":3,"x":{"r":["nls","browsersPasswordsCount"],"s":"_0(\"passwords.onboardingFinish.importedPasswords\",_1)"}}]}],"n":50,"r":"showSuccessScreen"}],"r":"isImportRunning"}]}]}; var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function createCommonjsModule(fn, module) { return module = { exports: {} }, fn(module, module.exports), module.exports; } var vivus = createCommonjsModule(function (module, exports) { (function () { /** * Pathformer * Beta version * * Take any SVG version 1.1 and transform * child elements to 'path' elements * * This code is purely forked from * https://github.com/Waest/SVGPathConverter */ /** * Class constructor * * @param {DOM|String} element Dom element of the SVG or id of it */ function Pathformer(element) { // Test params if (typeof element === 'undefined') { throw new Error('Pathformer [constructor]: "element" parameter is required'); } // Set the element if (element.constructor === String) { element = document.getElementById(element); if (!element) { throw new Error('Pathformer [constructor]: "element" parameter is not related to an existing ID'); } } if (element instanceof window.SVGElement || element instanceof window.SVGGElement || /^svg$/i.test(element.nodeName)) { this.el = element; } else { throw new Error('Pathformer [constructor]: "element" parameter must be a string or a SVGelement'); } // Start this.scan(element); } /** * List of tags which can be transformed * to path elements * * @type {Array} */ Pathformer.prototype.TYPES = ['line', 'ellipse', 'circle', 'polygon', 'polyline', 'rect']; /** * List of attribute names which contain * data. This array list them to check if * they contain bad values, like percentage. * * @type {Array} */ Pathformer.prototype.ATTR_WATCH = ['cx', 'cy', 'points', 'r', 'rx', 'ry', 'x', 'x1', 'x2', 'y', 'y1', 'y2']; /** * Finds the elements compatible for transform * and apply the liked method * * @param {object} options Object from the constructor */ Pathformer.prototype.scan = function (svg) { var fn, element, pathData, pathDom, elements = svg.querySelectorAll(this.TYPES.join(',')); for (var i = 0; i < elements.length; i++) { element = elements[i]; fn = this[element.tagName.toLowerCase() + 'ToPath']; pathData = fn(this.parseAttr(element.attributes)); pathDom = this.pathMaker(element, pathData); element.parentNode.replaceChild(pathDom, element); } }; /** * Read `line` element to extract and transform * data, to make it ready for a `path` object. * * @param {DOMelement} element Line element to transform * @return {object} Data for a `path` element */ Pathformer.prototype.lineToPath = function (element) { var newElement = {}, x1 = element.x1 || 0, y1 = element.y1 || 0, x2 = element.x2 || 0, y2 = element.y2 || 0; newElement.d = 'M' + x1 + ',' + y1 + 'L' + x2 + ',' + y2; return newElement; }; /** * Read `rect` element to extract and transform * data, to make it ready for a `path` object. * The radius-border is not taken in charge yet. * (your help is more than welcomed) * * @param {DOMelement} element Rect element to transform * @return {object} Data for a `path` element */ Pathformer.prototype.rectToPath = function (element) { var newElement = {}, x = parseFloat(element.x) || 0, y = parseFloat(element.y) || 0, width = parseFloat(element.width) || 0, height = parseFloat(element.height) || 0; if (element.rx || element.ry) { var rx = parseInt(element.rx, 10) || -1, ry = parseInt(element.ry, 10) || -1; rx = Math.min(Math.max(rx < 0 ? ry : rx, 0), width/2); ry = Math.min(Math.max(ry < 0 ? rx : ry, 0), height/2); newElement.d = 'M ' + (x + rx) + ',' + y + ' ' + 'L ' + (x + width - rx) + ',' + y + ' ' + 'A ' + rx + ',' + ry + ',0,0,1,' + (x + width) + ',' + (y + ry) + ' ' + 'L ' + (x + width) + ',' + (y + height - ry) + ' ' + 'A ' + rx + ',' + ry + ',0,0,1,' + (x + width - rx) + ',' + (y + height) + ' ' + 'L ' + (x + rx) + ',' + (y + height) + ' ' + 'A ' + rx + ',' + ry + ',0,0,1,' + x + ',' + (y + height - ry) + ' ' + 'L ' + x + ',' + (y + ry) + ' ' + 'A ' + rx + ',' + ry + ',0,0,1,' + (x + rx) + ',' + y; } else { newElement.d = 'M' + x + ' ' + y + ' ' + 'L' + (x + width) + ' ' + y + ' ' + 'L' + (x + width) + ' ' + (y + height) + ' ' + 'L' + x + ' ' + (y + height) + ' Z'; } return newElement; }; /** * Read `polyline` element to extract and transform * data, to make it ready for a `path` object. * * @param {DOMelement} element Polyline element to transform * @return {object} Data for a `path` element */ Pathformer.prototype.polylineToPath = function (element) { var newElement = {}, points = element.points.trim().split(' '), i, path; // Reformatting if points are defined without commas if (element.points.indexOf(',') === -1) { var formattedPoints = []; for (i = 0; i < points.length; i+=2) { formattedPoints.push(points[i] + ',' + points[i+1]); } points = formattedPoints; } // Generate the path.d value path = 'M' + points[0]; for(i = 1; i < points.length; i++) { if (points[i].indexOf(',') !== -1) { path += 'L' + points[i]; } } newElement.d = path; return newElement; }; /** * Read `polygon` element to extract and transform * data, to make it ready for a `path` object. * This method rely on polylineToPath, because the * logic is similar. The path created is just closed, * so it needs an 'Z' at the end. * * @param {DOMelement} element Polygon element to transform * @return {object} Data for a `path` element */ Pathformer.prototype.polygonToPath = function (element) { var newElement = Pathformer.prototype.polylineToPath(element); newElement.d += 'Z'; return newElement; }; /** * Read `ellipse` element to extract and transform * data, to make it ready for a `path` object. * * @param {DOMelement} element ellipse element to transform * @return {object} Data for a `path` element */ Pathformer.prototype.ellipseToPath = function (element) { var newElement = {}, rx = parseFloat(element.rx) || 0, ry = parseFloat(element.ry) || 0, cx = parseFloat(element.cx) || 0, cy = parseFloat(element.cy) || 0, startX = cx - rx, startY = cy, endX = parseFloat(cx) + parseFloat(rx), endY = cy; newElement.d = 'M' + startX + ',' + startY + 'A' + rx + ',' + ry + ' 0,1,1 ' + endX + ',' + endY + 'A' + rx + ',' + ry + ' 0,1,1 ' + startX + ',' + endY; return newElement; }; /** * Read `circle` element to extract and transform * data, to make it ready for a `path` object. * * @param {DOMelement} element Circle element to transform * @return {object} Data for a `path` element */ Pathformer.prototype.circleToPath = function (element) { var newElement = {}, r = parseFloat(element.r) || 0, cx = parseFloat(element.cx) || 0, cy = parseFloat(element.cy) || 0, startX = cx - r, startY = cy, endX = parseFloat(cx) + parseFloat(r), endY = cy; newElement.d = 'M' + startX + ',' + startY + 'A' + r + ',' + r + ' 0,1,1 ' + endX + ',' + endY + 'A' + r + ',' + r + ' 0,1,1 ' + startX + ',' + endY; return newElement; }; /** * Create `path` elements form original element * and prepared objects * * @param {DOMelement} element Original element to transform * @param {object} pathData Path data (from `toPath` methods) * @return {DOMelement} Path element */ Pathformer.prototype.pathMaker = function (element, pathData) { var i, attr, pathTag = document.createElementNS('http://www.w3.org/2000/svg','path'); for(i = 0; i < element.attributes.length; i++) { attr = element.attributes[i]; if (this.ATTR_WATCH.indexOf(attr.name) === -1) { pathTag.setAttribute(attr.name, attr.value); } } for(i in pathData) { pathTag.setAttribute(i, pathData[i]); } return pathTag; }; /** * Parse attributes of a DOM element to * get an object of attribute => value * * @param {NamedNodeMap} attributes Attributes object from DOM element to parse * @return {object} Object of attributes */ Pathformer.prototype.parseAttr = function (element) { var attr, output = {}; for (var i = 0; i < element.length; i++) { attr = element[i]; // Check if no data attribute contains '%', or the transformation is impossible if (this.ATTR_WATCH.indexOf(attr.name) !== -1 && attr.value.indexOf('%') !== -1) { throw new Error('Pathformer [parseAttr]: a SVG shape got values in percentage. This cannot be transformed into \'path\' tags. Please use \'viewBox\'.'); } output[attr.name] = attr.value; } return output; }; var setupEnv, requestAnimFrame, cancelAnimFrame, parsePositiveInt; /** * Vivus * Beta version * * Take any SVG and make the animation * to give give the impression of live drawing * * This in more than just inspired from codrops * At that point, it's a pure fork. */ /** * Class constructor * option structure * type: 'delayed'|'sync'|'oneByOne'|'script' (to know if the items must be drawn synchronously or not, default: delayed) * duration: <int> (in frames) * start: 'inViewport'|'manual'|'autostart' (start automatically the animation, default: inViewport) * delay: <int> (delay between the drawing of first and last path) * dashGap <integer> whitespace extra margin between dashes * pathTimingFunction <function> timing animation function for each path element of the SVG * animTimingFunction <function> timing animation function for the complete SVG * forceRender <boolean> force the browser to re-render all updated path items * selfDestroy <boolean> removes all extra styling on the SVG, and leaves it as original * * The attribute 'type' is by default on 'delayed'. * - 'delayed' * all paths are draw at the same time but with a * little delay between them before start * - 'sync' * all path are start and finish at the same time * - 'oneByOne' * only one path is draw at the time * the end of the first one will trigger the draw * of the next one * * All these values can be overwritten individually * for each path item in the SVG * The value of frames will always take the advantage of * the duration value. * If you fail somewhere, an error will be thrown. * Good luck. * * @constructor * @this {Vivus} * @param {DOM|String} element Dom element of the SVG or id of it * @param {Object} options Options about the animation * @param {Function} callback Callback for the end of the animation */ function Vivus (element, options, callback) { setupEnv(); // Setup this.isReady = false; this.setElement(element, options); this.setOptions(options); this.setCallback(callback); if (this.isReady) { this.init(); } } /** * Timing functions ************************************** * * Default functions to help developers. * It always take a number as parameter (between 0 to 1) then * return a number (between 0 and 1) */ Vivus.LINEAR = function (x) {return x;}; Vivus.EASE = function (x) {return -Math.cos(x * Math.PI) / 2 + 0.5;}; Vivus.EASE_OUT = function (x) {return 1 - Math.pow(1-x, 3);}; Vivus.EASE_IN = function (x) {return Math.pow(x, 3);}; Vivus.EASE_OUT_BOUNCE = function (x) { var base = -Math.cos(x * (0.5 * Math.PI)) + 1, rate = Math.pow(base,1.5), rateR = Math.pow(1 - x, 2), progress = -Math.abs(Math.cos(rate * (2.5 * Math.PI) )) + 1; return (1- rateR) + (progress * rateR); }; /** * Setters ************************************** */ /** * Check and set the element in the instance * The method will not return anything, but will throw an * error if the parameter is invalid * * @param {DOM|String} element SVG Dom element or id of it */ Vivus.prototype.setElement = function (element, options) { var onLoad, self; // Basic check if (typeof element === 'undefined') { throw new Error('Vivus [constructor]: "element" parameter is required'); } // Set the element if (element.constructor === String) { element = document.getElementById(element); if (!element) { throw new Error('Vivus [constructor]: "element" parameter is not related to an existing ID'); } } this.parentEl = element; // Load the SVG with XMLHttpRequest and extract the SVG if (options && options.file) { var self = this; onLoad = function (e) { var domSandbox = document.createElement('div'); domSandbox.innerHTML = this.responseText; var svgTag = domSandbox.querySelector('svg'); if (!svgTag) { throw new Error('Vivus [load]: Cannot find the SVG in the loaded file : ' + options.file); } self.el = svgTag; self.el.setAttribute('width', '100%'); self.el.setAttribute('height', '100%'); self.parentEl.appendChild(self.el); self.isReady = true; self.init(); self = null; }; var oReq = new window.XMLHttpRequest(); oReq.addEventListener('load', onLoad); oReq.open('GET', options.file); oReq.send(); return; } switch (element.constructor) { case window.SVGSVGElement: case window.SVGElement: case window.SVGGElement: this.el = element; this.isReady = true; break; case window.HTMLObjectElement: self = this; onLoad = function (e) { if (self.isReady) { return; } self.el = element.contentDocument && element.contentDocument.querySelector('svg'); if (!self.el && e) { throw new Error('Vivus [constructor]: object loaded does not contain any SVG'); } else if (self.el) { if (element.getAttribute('built-by-vivus')) { self.parentEl.insertBefore(self.el, element); self.parentEl.removeChild(element); self.el.setAttribute('width', '100%'); self.el.setAttribute('height', '100%'); } self.isReady = true; self.init(); self = null; } }; if (!onLoad()) { element.addEventListener('load', onLoad); } break; default: throw new Error('Vivus [constructor]: "element" parameter is not valid (or miss the "file" attribute)'); } }; /** * Set up user option to the instance * The method will not return anything, but will throw an * error if the parameter is invalid * * @param {object} options Object from the constructor */ Vivus.prototype.setOptions = function (options) { var allowedTypes = ['delayed', 'sync', 'async', 'nsync', 'oneByOne', 'scenario', 'scenario-sync']; var allowedStarts = ['inViewport', 'manual', 'autostart']; // Basic check if (options !== undefined && options.constructor !== Object) { throw new Error('Vivus [constructor]: "options" parameter must be an object'); } else { options = options || {}; } // Set the animation type if (options.type && allowedTypes.indexOf(options.type) === -1) { throw new Error('Vivus [constructor]: ' + options.type + ' is not an existing animation `type`'); } else { this.type = options.type || allowedTypes[0]; } // Set the start type if (options.start && allowedStarts.indexOf(options.start) === -1) { throw new Error('Vivus [constructor]: ' + options.start + ' is not an existing `start` option'); } else { this.start = options.start || allowedStarts[0]; } this.isIE = (window.navigator.userAgent.indexOf('MSIE') !== -1 || window.navigator.userAgent.indexOf('Trident/') !== -1 || window.navigator.userAgent.indexOf('Edge/') !== -1 ); this.duration = parsePositiveInt(options.duration, 120); this.delay = parsePositiveInt(options.delay, null); this.dashGap = parsePositiveInt(options.dashGap, 1); this.forceRender = options.hasOwnProperty('forceRender') ? !!options.forceRender : this.isIE; this.reverseStack = !!options.reverseStack; this.selfDestroy = !!options.selfDestroy; this.onReady = options.onReady; this.map = []; this.frameLength = this.currentFrame = this.delayUnit = this.speed = this.handle = null; this.ignoreInvisible = options.hasOwnProperty('ignoreInvisible') ? !!options.ignoreInvisible : false; this.animTimingFunction = options.animTimingFunction || Vivus.LINEAR; this.pathTimingFunction = options.pathTimingFunction || Vivus.LINEAR; if (this.delay >= this.duration) { throw new Error('Vivus [constructor]: delay must be shorter than duration'); } }; /** * Set up callback to the instance * The method will not return enything, but will throw an * error if the parameter is invalid * * @param {Function} callback Callback for the animation end */ Vivus.prototype.setCallback = function (callback) { // Basic check if (!!callback && callback.constructor !== Function) { throw new Error('Vivus [constructor]: "callback" parameter must be a function'); } this.callback = callback || function () {}; }; /** * Core ************************************** */ /** * Map the svg, path by path. * The method return nothing, it just fill the * `map` array. Each item in this array represent * a path element from the SVG, with informations for * the animation. * * ``` * [ * { * el: <DOMobj> the path element * length: <number> length of the path line * startAt: <number> time start of the path animation (in frames) * duration: <number> path animation duration (in frames) * }, * ... * ] * ``` * */ Vivus.prototype.mapping = function () { var i, paths, path, pAttrs, pathObj, totalLength, lengthMeter, timePoint; timePoint = totalLength = lengthMeter = 0; paths = this.el.querySelectorAll('path'); for (i = 0; i < paths.length; i++) { path = paths[i]; if (this.isInvisible(path)) { continue; } pathObj = { el: path, length: Math.ceil(path.getTotalLength()) }; // Test if the path length is correct if (isNaN(pathObj.length)) { if (window.console && console.warn) { console.warn('Vivus [mapping]: cannot retrieve a path element length', path); } continue; } this.map.push(pathObj); path.style.strokeDasharray = pathObj.length + ' ' + (pathObj.length + this.dashGap * 2); path.style.strokeDashoffset = pathObj.length + this.dashGap; pathObj.length += this.dashGap; totalLength += pathObj.length; this.renderPath(i); } totalLength = totalLength === 0 ? 1 : totalLength; this.delay = this.delay === null ? this.duration / 3 : this.delay; this.delayUnit = this.delay / (paths.length > 1 ? paths.length - 1 : 1); // Reverse stack if asked if (this.reverseStack) { this.map.reverse(); } for (i = 0; i < this.map.length; i++) { pathObj = this.map[i]; switch (this.type) { case 'delayed': pathObj.startAt = this.delayUnit * i; pathObj.duration = this.duration - this.delay; break; case 'oneByOne': pathObj.startAt = lengthMeter / totalLength * this.duration; pathObj.duration = pathObj.length / totalLength * this.duration; break; case 'sync': case 'async': case 'nsync': pathObj.startAt = 0; pathObj.duration = this.duration; break; case 'scenario-sync': path = pathObj.el; pAttrs = this.parseAttr(path); pathObj.startAt = timePoint + (parsePositiveInt(pAttrs['data-delay'], this.delayUnit) || 0); pathObj.duration = parsePositiveInt(pAttrs['data-duration'], this.duration); timePoint = pAttrs['data-async'] !== undefined ? pathObj.startAt : pathObj.startAt + pathObj.duration; this.frameLength = Math.max(this.frameLength, (pathObj.startAt + pathObj.duration)); break; case 'scenario': path = pathObj.el; pAttrs = this.parseAttr(path); pathObj.startAt = parsePositiveInt(pAttrs['data-start'], this.delayUnit) || 0; pathObj.duration = parsePositiveInt(pAttrs['data-duration'], this.duration); this.frameLength = Math.max(this.frameLength, (pathObj.startAt + pathObj.duration)); break; } lengthMeter += pathObj.length; this.frameLength = this.frameLength || this.duration; } }; /** * Interval method to draw the SVG from current * position of the animation. It update the value of * `currentFrame` and re-trace the SVG. * * It use this.handle to store the requestAnimationFrame * and clear it one the animation is stopped. So this * attribute can be used to know if the animation is * playing. * * Once the animation at the end, this method will * trigger the Vivus callback. * */ Vivus.prototype.drawer = function () { var self = this; this.currentFrame += this.speed; if (this.currentFrame <= 0) { this.stop(); this.reset(); } else if (this.currentFrame >= this.frameLength) { this.stop(); this.currentFrame = this.frameLength; this.trace(); if (this.selfDestroy) { this.destroy(); } } else { this.trace(); this.handle = requestAnimFrame(function () { self.drawer(); }); return; } this.callback(this); if (this.instanceCallback) { this.instanceCallback(this); this.instanceCallback = null; } }; /** * Draw the SVG at the current instant from the * `currentFrame` value. Here is where most of the magic is. * The trick is to use the `strokeDashoffset` style property. * * For optimisation reasons, a new property called `progress` * is added in each item of `map`. This one contain the current * progress of the path element. Only if the new value is different * the new value will be applied to the DOM element. This * method save a lot of resources to re-render the SVG. And could * be improved if the animation couldn't be played forward. * */ Vivus.prototype.trace = function () { var i, progress, path, currentFrame; currentFrame = this.animTimingFunction(this.currentFrame / this.frameLength) * this.frameLength; for (i = 0; i < this.map.length; i++) { path = this.map[i]; progress = (currentFrame - path.startAt) / path.duration; progress = this.pathTimingFunction(Math.max(0, Math.min(1, progress))); if (path.progress !== progress) { path.progress = progress; path.el.style.strokeDashoffset = Math.floor(path.length * (1 - progress)); this.renderPath(i); } } }; /** * Method forcing the browser to re-render a path element * from it's index in the map. Depending on the `forceRender` * value. * The trick is to replace the path element by it's clone. * This practice is not recommended because it's asking more * ressources, too much DOM manupulation.. * but it's the only way to let the magic happen on IE. * By default, this fallback is only applied on IE. * * @param {Number} index Path index */ Vivus.prototype.renderPath = function (index) { if (this.forceRender && this.map && this.map[index]) { var pathObj = this.map[index], newPath = pathObj.el.cloneNode(true); pathObj.el.parentNode.replaceChild(newPath, pathObj.el); pathObj.el = newPath; } }; /** * When the SVG object is loaded and ready, * this method will continue the initialisation. * * This this mainly due to the case of passing an * object tag in the constructor. It will wait * the end of the loading to initialise. * */ Vivus.prototype.init = function () { // Set object variables this.frameLength = 0; this.currentFrame = 0; this.map = []; // Start new Pathformer(this.el); this.mapping(); this.starter(); if (this.onReady) { this.onReady(this); } }; /** * Trigger to start of the animation. * Depending on the `start` value, a different script * will be applied. * * If the `start` value is not valid, an error will be thrown. * Even if technically, this is impossible. * */ Vivus.prototype.starter = function () { switch (this.start) { case 'manual': return; case 'autostart': this.play(); break; case 'inViewport': var self = this, listener = function () { if (self.isInViewport(self.parentEl, 1)) { self.play(); window.removeEventListener('scroll', listener); } }; window.addEventListener('scroll', listener); listener(); break; } }; /** * Controls ************************************** */ /** * Get the current status of the animation between * three different states: 'start', 'progress', 'end'. * @return {string} Instance status */ Vivus.prototype.getStatus = function () { return this.currentFrame === 0 ? 'start' : this.currentFrame === this.frameLength ? 'end' : 'progress'; }; /** * Reset the instance to the initial state : undraw * Be careful, it just reset the animation, if you're * playing the animation, this won't stop it. But just * make it start from start. * */ Vivus.prototype.reset = function () { return this.setFrameProgress(0); }; /** * Set the instance to the final state : drawn * Be careful, it just set the animation, if you're * playing the animation on rewind, this won't stop it. * But just make it start from the end. * */ Vivus.prototype.finish = function () { return this.setFrameProgress(1); }; /** * Set the level of progress of the drawing. * * @param {number} progress Level of progress to set */ Vivus.prototype.setFrameProgress = function (progress) { progress = Math.min(1, Math.max(0, progress)); this.currentFrame = Math.round(this.frameLength * progress); this.trace(); return this; }; /** * Play the animation at the desired speed. * Speed must be a valid number (no zero). * By default, the speed value is 1. * But a negative value is accepted to go forward. * * And works with float too. * But don't forget we are in JavaScript, se be nice * with him and give him a 1/2^x value. * * @param {number} speed Animation speed [optional] */ Vivus.prototype.play = function (speed, callback) { this.instanceCallback = null; if (speed && typeof speed === 'function') { this.instanceCallback = speed; // first parameter is actually the callback function speed = null; } else if (speed && typeof speed !== 'number') { throw new Error('Vivus [play]: invalid speed'); } // if the first parameter wasn't the callback, check if the seconds was if (callback && typeof(callback) === 'function' && !this.instanceCallback) { this.instanceCallback = callback; } this.speed = speed || 1; if (!this.handle) { this.drawer(); } return this; }; /** * Stop the current animation, if on progress. * Should not trigger any error. * */ Vivus.prototype.stop = function () { if (this.handle) { cancelAnimFrame(this.handle); this.handle = null; } return this; }; /** * Destroy the instance. * Remove all bad styling attributes on all * path tags * */ Vivus.prototype.destroy = function () { this.stop(); var i, path; for (i = 0; i < this.map.length; i++) { path = this.map[i]; path.el.style.strokeDashoffset = null; path.el.style.strokeDasharray = null; this.renderPath(i); } }; /** * Utils methods * include methods from Codrops ************************************** */ /** * Method to best guess if a path should added into * the animation or not. * * 1. Use the `data-vivus-ignore` attribute if set * 2. Check if the instance must ignore invisible paths * 3. Check if the path is visible * * For now the visibility checking is unstable. * It will be used for a beta phase. * * Other improvments are planned. Like detecting * is the path got a stroke or a valid opacity. */ Vivus.prototype.isInvisible = function (el) { var rect, ignoreAttr = el.getAttribute('data-ignore'); if (ignoreAttr !== null) { return ignoreAttr !== 'false'; } if (this.ignoreInvisible) { rect = el.getBoundingClientRect(); return !rect.width && !rect.height; } else { return false; } }; /** * Parse attributes of a DOM element to * get an object of {attributeName => attributeValue} * * @param {object} element DOM element to parse * @return {object} Object of attributes */ Vivus.prototype.parseAttr = function (element) { var attr, output = {}; if (element && element.attributes) { for (var i = 0; i < element.attributes.length; i++) { attr = element.attributes[i]; output[attr.name] = attr.value; } } return output; }; /** * Reply if an element is in the page viewport * * @param {object} el Element to observe * @param {number} h Percentage of height * @return {boolean} */ Vivus.prototype.isInViewport = function (el, h) { var scrolled = this.scrollY(), viewed = scrolled + this.getViewportH(), elBCR = el.getBoundingClientRect(), elHeight = elBCR.height, elTop = scrolled + elBCR.top, elBottom = elTop + elHeight; // if 0, the element is considered in the viewport as soon as it enters. // if 1, the element is considered in the viewport only when it's fully inside // value in percentage (1 >= h >= 0) h = h || 0; return (elTop + elHeight * h) <= viewed && (elBottom) >= scrolled; }; /** * Get the viewport height in pixels * * @return {integer} Viewport height */ Vivus.prototype.getViewportH = function () { var client = this.docElem.clientHeight, inner = window.innerHeight; if (client < inner) { return inner; } else { return client; } }; /** * Get the page Y offset * * @return {integer} Page Y offset */ Vivus.prototype.scrollY = function () { return window.pageYOffset || this.docElem.scrollTop; }; setupEnv = function () { if (Vivus.prototype.docElem) { return; } /** * Alias for document element * * @type {DOMelement} */ Vivus.prototype.docElem = window.document.documentElement; /** * Alias for `requestAnimationFrame` or * `setTimeout` function for deprecated browsers. * */ requestAnimFrame = (function () { return ( window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(/* function */ callback){ return window.setTimeout(callback, 1000 / 60); } ); })(); /** * Alias for `cancelAnimationFrame` or * `cancelTimeout` function for deprecated browsers. * */ cancelAnimFrame = (function () { return ( window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || window.oCancelAnimationFrame || window.msCancelAnimationFrame || function(id){ return window.clearTimeout(id); } ); })(); }; /** * Parse string to integer. * If the number is not positive or null * the method will return the default value * or 0 if undefined * * @param {string} value String to parse * @param {*} defaultValue Value to return if the result parsed is invalid * @return {number} * */ parsePositiveInt = function (value, defaultValue) { var output = parseInt(value, 10); return (output >= 0) ? output : defaultValue; }; { // Node. Does not work with strict CommonJS, but // only CommonJS-like environments that support module.exports, // like Node. module.exports = Vivus; } }()); }); /** * Password Manager - onboarding - import browsers passwords **/ const IMPORT_DELAY = 6; // time in seconds const SHOW_SUCCESS_SCREEN_TIME = 3; // time in seconds const ImportBrowsersPasswords = Ractive.extend({ template : template$6, data: () => { return { browsersPasswordsCount: '-', importingPasswordNumber: '-', isImportRunning: true, allowSkip: true, showSuccessScreen: false, disableSkip: false, skipping: false }; }, /** * fire done(true) on success, done(false) on a user skip */ oninit() { let notSkipped = true; this.importProgressOff = NAPI$1.on('app.pam.onStatusChanged.importProgress', (response) => { console.log('onStatusChanged.mportProgress', response); this.set('browsersPasswordsCount', response.browserpasswordscount); this.set('importingPasswordNumber', response.importedcount); if (response.browserpasswordscount == response.importedcount) { this.set('disableSkip', true); } }); track.onboarding.importStarted(); this.importBrowserPasswords() .then(() => { this.set('isImportRunning', false); this.done(this.get('importingPasswordNumber')); if (notSkipped) { track.onboarding.importFinsihed(); this.done(this.get('importingPasswordNumber')); } }); this.on('skip', () => { this.set('skipping', true); notSkipped = false; track.onboarding.importCancelled(); this.stopImportBrowserPasswords() .then(() => { this.done(0); }); }); }, /** * onteardown * @return {void} */ onteardown() { if (this.importProgressOff) this.importProgressOff(); }, /** * requests ImportBrowserPasswords * @protected * @return {string} [success] */ importBrowserPasswords() { return NAPI$1.request('app.pam.ImportBrowserPasswords', IMPORT_DELAY * 1000) .then((response) => { console.log('ImportBrowserPasswords', response); }) .catch((response) => { console.error('ImportBrowserPasswords', response); }); }, /** * stops ImportBrowserPasswords * @protected * @return {promise} */ stopImportBrowserPasswords() { return NAPI$1.request('app.pam.StopImportBrowserPasswordsOnboarding') .then((response) => { console.log('StopImportBrowserPasswordsOnboarding', response); }) .catch((response) => { console.error('StopImportBrowserPasswordsOnboarding', response); }); }, done(finishedImport) { var numImportedPasswords = finishedImport ? this.get('browsersPasswordsCount') : 0; if (finishedImport && this.get('showSuccessScreen')) { new vivus('import-ok-state-icon', { duration: 70, type: 'delayed', animTimingFunction: vivus.EASE_OUT }); setTimeout(() => { this.fire('done', numImportedPasswords); }, SHOW_SUCCESS_SCREEN_TIME * 1000); } else { this.fire('done', numImportedPasswords); } } }); const template$7 = {"v":3,"t":[{"t":7,"e":"div","f":[{"t":7,"e":"h3","a":{"class":"h2 pam_title"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.onboardingError.title\")"}}]}," ",{"t":7,"e":"div","a":{"style":"font-size: 150px; margin: 50px; color:#f5203e;"},"f":[{"t":7,"e":"Icon","a":{"name":"exclamation-sign"}}]}," ",{"t":7,"e":"p","f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.onboardingError.description\")"}}]}," ",{"t":7,"e":"br"}]}]}; /** * Password Manager - errors and notifications **/ const Error$1 = Ractive.extend({ template : template$7, oninit() { NAPI$1.track.view('PrivacyPasswords/Onboarding/Error'); } }); /** * Password Manager - onboarding **/ const Onboarding = Ractive.extend({ template : template$1, data: () => { return { page: 'Intro', fromSzb: window.location.href.endsWith('/szb') }; }, components: { Intro, InstallBrowsersExtensions, ImportBrowsersPasswords, Error: Error$1 }, oninit() { NAPI$1.track.view('PrivacyPasswords/Onboarding/Intro'); track.onboarding.viewIntro(); if (this.get('fromSzb')) { window.location.hash = window.location.hash.substr(0, window.location.hash.length - 4); // otherwise it spoils breadcrumbs } this.on('Intro.start', () => { return NAPI$1.request('app.pam.CreateVaultWithSystemLogin') .then(() => this.onCreateVaultDone()) .catch(ex => { console.error('app.pam.CreateVaultWithSystemLogin', ex); this.onCreateVaultError(); }); }); this.on('InstallBrowsersExtensions.done', this.onInstallExtensionsDone.bind(this)); this.on('ImportBrowsersPasswords.done', () => { this.fire('done', true); }); }, onCreateVaultDone() { if (this.get('fromSzb')) { this.onInstallExtensionsDone(); return; } this.set('page', 'InstallBrowsersExtensions'); NAPI$1.track.view('PrivacyPasswords/Onboarding/InstallBrowsersExtensions'); }, onCreateVaultError() { this.set('page', 'Error'); }, onInstallExtensionsDone() { focusMainWindow(); this.getBrowsersPasswordsCount() .then(response => { if (response > 0) { this.set('page', 'ImportBrowsersPasswords'); NAPI$1.track.view('PrivacyPasswords/Onboarding/ImportBrowsersPasswords'); } else { this.fire('done', false); } }); }, getBrowsersPasswordsCount() { return NAPI$1.request('app.pam.GetBrowserPasswordCount') .then(response => { return response.browserPasswordCount; }) .catch(response => { console.error('GetBrowserPasswordCount', response); }); } }); const template$8 = {"v":3,"t":[{"t":7,"e":"kin-page","a":{"heading":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords\")"}}],"csscls":"pam","backhash":"#privacy"},"f":[{"t":7,"e":"div","a":{"slot":"breadcrumbs"},"f":[{"t":7,"e":"Crumbs","a":{"customBreadcrumbs":0,"section":"privacy","moduleId":"passwords"}}]}," ",{"t":7,"e":"div","a":{"slot":"page-content"},"f":[{"t":7,"e":"kin-view","f":[{"t":7,"e":"div","a":{"slot":"view-content"},"f":[{"t":7,"e":"div","a":{"class":"pam_onboarding_screen"},"f":[{"t":7,"e":"div","a":{"class":"pam_onboarding_carousel"},"f":[{"t":7,"e":"div","a":{"class":"nui_carousel__flex"},"f":[{"t":7,"e":"SvgIcon","a":{"name":"pam-onboarding-tour-4","cssCls":"pam_wizzard__icon"}}," ",{"t":7,"e":"div","f":[{"t":7,"e":"h2","a":{"class":"h2 pam_title"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.product.AVAST_PASSWORDS\")"}}]}," ",{"t":7,"e":"p","a":{"class":"pam_description"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.intro.tour4.description\")"}}]}]}]}," ",{"t":7,"e":"button","a":{"class":"btn -large g-margin-top--30"},"v":{"click":{"m":"openStandalonePam","a":{"r":[],"s":"[]"}}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.openPasswords\")"}}]}]}," ",{"t":7,"e":"div","a":{"class":"pam_tip__container"},"f":[{"t":7,"e":"span","a":{"class":"g-align--left"},"f":[{"t":7,"e":"img","a":{"class":"g-margin-right--20","src":"data:image/png;base64,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"}}," ",{"t":7,"e":"span","a":{"class":"span -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.openStandaloneUi.tip\")"}}]}]}]}]}]}]}]}]}]}; const OpenStandaloneUi = Ractive.extend({ template : template$8, openStandalonePam() { NAPI$1.request('app.windowManager.ShowWindow', { url: 'https://local.avast.com/MainWindow.html?module=PrivacyPasswords', id: 'pam', type: 'CEF', width: 1010, height: 674, setAsForegroundWnd: true, title: 'Avast Password Manager', iconSmall: 215, iconBig: 215, appUserModelRelaunchIcon: 215, appUserModelID: 'avast.pam' }).catch(()=>{ // Show restart modal if opening PAM Standalone failed // https://butr.avast.com/browse/PM-1238 const message = Ractive.localization.nls('system.toasters.restart.text'); const options = { title: Ractive.localization.nls('system.toasters.restart.title'), ok: Ractive.localization.nls('system.toasters.restart.restartComputer') }; return Ractive.UI.confirm(message, options) .then(()=>{ NAPI$1.request('app.system.Restart', { rebootType: 'RebootFromUI' }); }); }); } }); const template$9 = {"v":3,"t":[{"t":7,"e":"div","a":{"class":["g-align--center ",{"t":2,"x":{"r":["isStandAlone"],"s":"_0?\"pam_unlock_standalone\":\"\""}}]},"f":[{"t":7,"e":"div","f":[{"t":7,"e":"SvgIcon","a":{"name":"pam-lock","cssCls":"pam_unlock__icon"}}," ",{"t":7,"e":"h2","a":{"class":"h2 pam_title"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.enterMasterPassword\")"}}]}," ",{"t":7,"e":"br"}," ",{"t":7,"e":"br"}," ",{"t":7,"e":"button","a":{"class":"btn -large"},"v":{"click":"showUnlockDialog"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.unlock\")"}}]}]}]}]}; var css_248z$2 = ".pam_login {\n display: block;\n width: 300px;\n margin: 0 auto;\n padding-right: 50px;\n}\n.pam_login__wrap {\n width: 300px;\n position: relative;\n margin: 0 auto;\n text-align: center;\n}\n.pam_login__strength {\n width: 298px;\n margin-left: auto;\n margin-right: auto;\n display: block;\n}\n.pam_login__show {\n position: absolute;\n left: 148px;\n}\n.pam button.pam_login {\n min-width: 300px;\n width: auto;\n}\n.pam_error {\n height: 22px;\n font-weight: 700;\n}\n.pam_acknowledge {\n width: 300px;\n margin-left: auto;\n margin-right: auto;\n display: block;\n}\n.pam_acknowledge_checkbox {\n float: left;\n margin-top: 3px;\n}\n.pam_acknowledge_label {\n display: block;\n text-align: initial;\n margin-left: 25px;\n}\n.pam_unlock {\n width: 100%;\n margin: 3vh 0 2vh;\n}\n.pam_unlock__field {\n text-align: center;\n width: 300px;\n display: block;\n margin: 0 auto;\n}\n.pam_unlock__icon {\n font-size: 120px;\n margin: 0 0 3vh;\n}\n.pam_mobile {\n padding-top: 15px;\n}\n@media (max-width: 500px), (max-height: 500px) {\n .animated {\n -webkit-animation-duration: 0.8s;\n -webkit-animation-delay: 0s;\n }\n #nui_titlebar {\n background-color: #f00 !important;\n }\n .input {\n height: 30px;\n }\n .pam_unlock__icon {\n font-size: 80px;\n margin-bottom: 32px;\n }\n .pam_title {\n font-size: 1.7rem;\n }\n .pam_unlock {\n margin-top: 20px;\n margin-bottom: 5px;\n }\n .pam_unlock__field {\n width: 260px;\n }\n .btn.-large {\n font-size: 14px;\n min-height: 36px;\n padding: 6px 34px 5px;\n }\n .pam_mobile {\n font-size: 14px;\n margin-bottom: 32px;\n }\n}\n[dir='rtl'] .pam_acknowledge_checkbox {\n float: right;\n}\n[dir='rtl'] .pam_acknowledge_label {\n margin-left: 0;\n margin-right: 25px;\n}\n"; function showSensitiveModal (name, options = { width: 700, height: 500, params: {} }) { const based64Params = window.btoa(JSON.stringify(options.params)); NAPI.request('app.windowManager.ShowModal', { 'url': 'https://local.avast.com/MainWindow.html?module=PrivacyPasswords&sensitiveModal=' + name + '&sensitiveModalParams=' + based64Params, 'id': 'pam_' + name, 'type': 'CEF', 'width': options.width, 'height': options.height, 'setAsForegroundWnd': true }); } const Unlock = Ractive.extend({ template: template$9, css: css_248z$2, data: () => { return {}; }, oninit() { this.on('showUnlockDialog', () => { showSensitiveModal('unlockCefDialog', { width: 680, height: 368, params: { type: 'unlock' } }); }); } }); const template$a = {"v":3,"t":[{"t":7,"e":"div","a":{"class":["pam_filter ",{"t":4,"f":["pam_-info"],"r":"showInfo"}]},"f":[{"t":4,"f":[{"t":7,"e":"input","o":"eventHandler","a":{"class":["input -expand -search ",{"t":4,"f":["-is-focused"],"r":"searchQuery"}],"type":"text","value":[{"t":2,"r":"searchQuery"}],"placeholder":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.searchVault\")"}}]}},{"t":7,"e":"Icon","a":{"name":"search","cssCls":"input__expand"}}],"n":50,"r":"showSearchField"}]}," ",{"t":7,"e":"div","a":{"class":[{"t":2,"x":{"r":["loading"],"s":"_0?\"hidden\":\"visible\""}}]},"f":[{"t":4,"f":[{"t":7,"e":"StandAloneMenu","a":{"page":[{"t":2,"r":"page"}],"hasSystemLogin":[{"t":2,"r":"hasSystemLogin"}]}}],"n":50,"r":"isStandAlone"},{"t":4,"n":51,"f":[{"t":7,"e":"TopMenu","a":{"isLicensed":[{"t":2,"r":"isLicensed"}]}}],"r":"isStandAlone"}]}," ",{"t":7,"e":"div","a":{"class":["center__wrap ",{"t":2,"x":{"r":["loading"],"s":"_0?\"visible\":\"hidden\""}}]},"f":[{"t":7,"e":"div","a":{"class":"center"},"f":[{"t":7,"e":"Loading","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.loading\")"}}]}}]}]}," ",{"t":7,"e":"div","a":{"class":["nui_page__scroll color-light -bg pam_list ",{"t":2,"x":{"r":["loading"],"s":"_0?\"hidden\":\"visible\""}}]},"f":[{"t":4,"f":[{"t":4,"f":[{"t":7,"e":"Panel","f":[{"t":7,"e":"div","a":{"data-test":"pam_panel-pending-browser-deletes"},"f":[{"t":7,"e":"p","f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.pendingBrowserDeletes.message\")"}}]}," ",{"t":7,"e":"div","a":{"class":"browsers"},"f":[{"t":4,"f":[{"t":7,"e":"Browser","a":{"browserId":[{"t":2,"r":"."}]},"f":[]}],"r":"pendingBrowserDeletes"}]}]}," ",{"t":7,"e":"div","a":{"class":"pam_panel__right"},"f":[{"t":7,"e":"Button","v":{"domClick":"retryBrowserDeletes"},"a":{"disabled":[{"t":2,"r":"processingBrowserDeletes"}],"cssCls":"-critical"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.pendingBrowserDeletes.retry\")"}}]}]}]}],"n":50,"r":"showPendingBrowserDeletesPanel"},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["isLicensed","showInstallExtensionPanel"],"s":"_0&&_1"},"f":[{"t":7,"e":"Panel","f":[{"t":7,"e":"p","f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.installExtension\")"}}]}," ",{"t":7,"e":"div","a":{"class":"pam_panel__right"},"f":[{"t":7,"e":"select","a":{"value":[{"t":2,"r":"installBrowserId"}],"class":"input g-margin-right--10"},"f":[{"t":4,"f":[{"t":7,"e":"option","a":{"value":[{"t":2,"r":"id"}]},"f":[{"t":2,"r":"name"}]}],"i":"i","r":"browsersToInstallExtension"}]}," ",{"t":7,"e":"Button","v":{"domClick":"installExtensionClick"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.install\")"}}]}]}]}]}],"r":"showPendingBrowserDeletesPanel"}," ",{"t":4,"f":[{"t":7,"e":"Panel","f":[{"t":7,"e":"div","a":{"class":"pam_sync_stopped_cont"},"f":[{"t":7,"e":"div","a":{"class":"pam_sync_stopped_icon"},"f":[{"t":7,"e":"Icon","a":{"name":"passwords-sync","cssCls":"pam_sync_icon"}}," ",{"t":7,"e":"Icon","a":{"cssCls":"badge -small color-critical -x -bg"}}]}," ",{"t":7,"e":"p","a":{"class":"p"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.banner.syncStopped.desc\")"}}]}]}," ",{"t":7,"e":"div","a":{"class":"pam_panel__right"},"f":[{"t":7,"e":"Button","v":{"domClick":"showLoginModal"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.login.btn.login\")"}}]}]}]}],"n":50,"r":"showSyncStoppedPanel"}," ",{"t":4,"f":[{"t":4,"f":[{"t":7,"e":"WaitingIdentityPanel","a":{"identity":[{"t":2,"r":"."}]}}],"n":52,"r":"waitingIdentities"}],"n":50,"r":"showWaitingIdentitiesPanel"}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":["pam_panel_ipm ",{"t":2,"x":{"r":["ipmLoaded"],"s":"_0?\"visible\":\"hidden\""}}]},"f":[{"t":7,"e":"IPM","a":{"id":"269"},"v":{"success":"setIpmLoaded"}}]}],"n":50,"x":{"r":["showIpmBanner","isStandAlone"],"s":"_0&&!_1"}}],"n":50,"x":{"r":["isLicensed","subPage"],"s":"_0||_1!==\"passwordGuardian\""}}," ",{"t":7,"e":"ImportProgress"}," ",{"t":7,"e":"div","a":{"class":[{"t":2,"x":{"r":["subPage"],"s":"_0===\"passwordGuardian\"?\"visible\":\"hidden\""}}]},"f":[{"t":7,"e":"PasswordGuardian"}]}," ",{"t":7,"e":"div","a":{"class":[{"t":2,"x":{"r":["subPage"],"s":"_0===\"accounts\"?\"visible\":\"hidden\""}}]},"f":[{"t":7,"e":"Accounts"}]}," ",{"t":7,"e":"div","a":{"class":[{"t":2,"x":{"r":["subPage"],"s":"_0===\"creditCards\"?\"visible\":\"hidden\""}}]},"f":[{"t":7,"e":"CreditCards"}]}," ",{"t":7,"e":"div","a":{"class":[{"t":2,"x":{"r":["subPage"],"s":"_0===\"secureNotes\"?\"visible\":\"hidden\""}}]},"f":[{"t":7,"e":"SecureNotes"}]}]}]}; const template$b = {"v":3,"t":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"modal"},"f":[{"t":7,"e":"div","a":{"class":"center__wrap"},"f":[{"t":7,"e":"div","a":{"class":"center"},"f":[{"t":7,"e":"Loading","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.loading\")"}}]}}]}]}]}," ",{"t":7,"e":"div","a":{"class":"modal__footer"}}],"n":50,"r":"loading"},{"t":4,"n":51,"f":[{"t":7,"e":"div","a":{"class":"modal pam_form"},"f":[" ",{"t":7,"e":"figure","a":{"class":"pam_icon -preview"},"f":[{"t":7,"e":"PasswordIcon","a":{"imgSrc":[{"t":2,"r":"password.domainIco"}],"serviceName":[{"t":2,"r":"password.customServiceName"}],"url":[{"t":2,"r":"password.url"}],"color":[{"t":2,"r":"password.color"}]}}]}," ",{"t":7,"e":"div","a":{"class":"pam_edit__title"},"f":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_colors"},"f":[{"t":4,"f":[{"t":7,"e":"input","o":"eventHandler","a":{"class":"pam_color","style":["background-color:",{"t":2,"rx":{"r":"CONST.COLORS","m":[{"t":30,"n":"i"}]}}],"type":"radio","name":"color","id":["color-",{"t":2,"x":{"r":["i"],"s":"_0+1"}}],"value":[{"t":2,"x":{"r":["i"],"s":"_0+1"}}]},"v":{"click":"selectColor"},"m":[{"t":4,"f":["checked=\"checked\""],"n":50,"x":{"r":["i","password.color"],"s":"_0+1==_1"}}]}],"i":"i","r":"CONST.COLORS"}]}],"n":50,"x":{"r":["mode","CONST.MODES.PASSWORDVIEW","iconLoaded"],"s":"_0!==_1&&!_2"}},{"t":4,"n":51,"f":[{"t":7,"e":"h3","a":{"class":"h3 pam_single_line"},"f":[{"t":2,"r":"password.customServiceName"}]}],"x":{"r":["mode","CONST.MODES.PASSWORDVIEW","iconLoaded"],"s":"_0!==_1&&!_2"}}]}," ",{"t":4,"f":[{"t":7,"e":"label","a":{"for":"serviceName","class":"pam_label text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.password.title\")"}}]}," ",{"t":4,"f":[{"t":7,"e":"p","a":{"class":"pam_value pam_single_line","id":"serviceName"},"f":[{"t":2,"r":"password.customServiceName"}]}],"n":50,"x":{"r":["mode","CONST.MODES.PASSWORDVIEW"],"s":"_0===_1"}},{"t":4,"n":51,"f":[{"t":7,"e":"input","o":"eventHandler","a":{"type":"text","class":["input -full pam_value ",{"t":4,"f":["-error"],"n":50,"x":{"r":["submitted","isServiceNameAndUrlEmpty"],"s":"_0&&_1"}}],"name":"serviceName","id":"serviceName","value":[{"t":2,"r":"password.customServiceName"}],"readonly":[{"t":2,"x":{"r":["mode","CONST.MODES.PASSWORDVIEW"],"s":"_0===_1"}}],"autofocus":"true"}}],"x":{"r":["mode","CONST.MODES.PASSWORDVIEW"],"s":"_0===_1"}}],"n":50,"x":{"r":["mode","CONST.MODES.PASSWORDVIEW","password.customServiceName"],"s":"_0!==_1||_2"}}," ",{"t":4,"f":[{"t":7,"e":"label","a":{"for":"url","class":"pam_label text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.password.url\")"}}]}," ",{"t":4,"f":[{"t":7,"e":"p","a":{"class":"pam_value pam_single_line"},"f":[{"t":7,"e":"span","a":{"class":"pam_hidden_href","id":"url"},"v":{"click":{"n":"openUrl","d":[{"t":2,"r":"password.url"}]}},"f":[{"t":2,"r":"password.url"}]}]}],"n":50,"x":{"r":["mode","CONST.MODES.PASSWORDVIEW"],"s":"_0===_1"}},{"t":4,"n":51,"f":[{"t":7,"e":"input","o":"eventHandler","a":{"type":"text","class":["input -full pam_value ",{"t":4,"f":["-error"],"n":50,"x":{"r":["submitted","isServiceNameAndUrlEmpty"],"s":"_0&&_1"}}],"name":"url","id":"url","value":[{"t":2,"r":"password.url"}]}}],"x":{"r":["mode","CONST.MODES.PASSWORDVIEW"],"s":"_0===_1"}}],"n":50,"x":{"r":["mode","CONST.MODES.PASSWORDVIEW","password.url"],"s":"_0!==_1||_2"}}," ",{"t":4,"f":[{"t":7,"e":"label","a":{"for":"userLoginName","class":"pam_label text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.password.username\")"}}]}," ",{"t":7,"e":"input","o":"eventHandler","a":{"type":"text","class":"input -full pam_value","name":"userLoginName","id":"userLoginName","value":[{"t":2,"r":"password.userLoginName"}],"readonly":[{"t":2,"x":{"r":["mode","CONST.MODES.PASSWORDVIEW"],"s":"_0===_1"}}]}}],"n":50,"x":{"r":["mode","CONST.MODES.PASSWORDVIEW","password.userLoginName"],"s":"_0!==_1||_2"}}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"style":"position:relative;"},"f":[{"t":7,"e":"label","a":{"for":"password","class":"pam_label text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.password.password\")"}}," ",{"t":4,"f":[{"t":7,"e":"span","a":{"class":[{"t":2,"r":"passwordStrength.class"}," -text pam_score"]},"f":[{"t":2,"r":"passwordStrength.text"}]}],"n":50,"x":{"r":["password.password.length","CONST.MODES.PASSWORDEDIT","mode","CONST.MODES.PASSWORDADD"],"s":"_0>0&&(_2===_1||_2===_3)"}}]}," ",{"t":7,"e":"div","a":{"class":["pam_pwd__wrap ",{"t":4,"f":["submit pam_-edit"],"n":50,"x":{"r":["mode","CONST.MODES.PASSWORDVIEW"],"s":"_0!=_1"}}]},"f":[{"t":4,"f":[{"t":7,"e":"SensitiveInput","a":{"value":[{"t":2,"r":"password.password"}],"canvasId":"passwordCanvas","classes":"input pam_value pam_pwd"}}],"n":50,"r":"showPassword"},{"t":4,"n":51,"f":[{"t":7,"e":"input","o":"eventHandler","a":{"id":"password","name":"password","value":[{"t":2,"r":"password.password"}],"type":"password","class":["input pam_value pam_pwd ",{"t":4,"f":["-error"],"n":50,"x":{"r":["submitted","isPasswordEmpty"],"s":"_0&&_1"}}],"readonly":[{"t":2,"x":{"r":["mode","CONST.MODES.PASSWORDVIEW"],"s":"_0===_1"}}]}}],"r":"showPassword"}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":"btn__split g-relative"},"f":[{"t":7,"e":"ButtonCopyToClipboard","a":{"text":[{"t":2,"r":"password.password"}]}}," ",{"t":7,"e":"ButtonRevealSecret","a":{"isRevealed":[{"t":2,"r":"showPassword"}]}}]}],"n":50,"r":"password.password"}]}]}],"n":50,"x":{"r":["mode","CONST.MODES.PASSWORDVIEW","password.password"],"s":"_0!==_1||_2"}}," ",{"t":4,"f":[{"t":7,"e":"WithFeature","a":{"feature":"AccountNoteFeature"},"f":[{"t":7,"e":"label","a":{"for":"note","class":"pam_label text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.label.note\")"}}]}," ",{"t":7,"e":"textarea","o":"eventHandler","a":{"name":"note","class":"input -full pam_value pam_textarea","id":"note","value":[{"t":2,"r":"password.note"}]},"m":[{"t":4,"f":["twoway=\"false\" readonly=\"true\""],"n":50,"x":{"r":["mode","CONST.MODES.PASSWORDVIEW"],"s":"_0===_1"}}]}]}],"n":50,"x":{"r":["mode","CONST.MODES.PASSWORDVIEW","password.note"],"s":"_0!==_1||_2"}}]}," ",{"t":7,"e":"div","a":{"class":"modal__footer"},"f":[{"t":7,"e":"ErrorLabel","a":{"error":[{"t":2,"r":"apiError"}]}}," ",{"t":4,"f":[{"t":7,"e":"button","a":{"type":"button","class":"btn","autofocus":"true"},"v":{"click":{"n":"edit","d":[{"t":2,"r":"password.itemUID"}]}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.edit\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","class":"btn -secondary g-margin-left--10"},"v":{"click":"close"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.close\")"}}]}],"n":50,"x":{"r":["mode","CONST.MODES.PASSWORDVIEW"],"s":"_0===_1"}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["mode","CONST.MODES.PASSWORDEDIT"],"s":"_0===_1"},"f":[{"t":7,"e":"button","a":{"type":"submit","disabled":[{"t":2,"r":"processing"}],"class":"btn"},"v":{"click":"submit"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.save\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","disabled":[{"t":2,"r":"processing"}],"class":"btn -secondary g-margin-left--10"},"v":{"click":"cancelEdit"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.cancel\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","disabled":[{"t":2,"r":"processing"}],"class":"btn -critical g-margin-left--10"},"v":{"click":{"n":"delete","d":[{"t":2,"r":"password.itemUID"}]}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.delete\")"}}]}]},{"t":4,"n":50,"x":{"r":["mode","CONST.MODES.PASSWORDEDIT"],"s":"!(_0===_1)"},"f":[" ",{"t":7,"e":"button","a":{"type":"submit","disabled":[{"t":2,"r":"processing"}],"class":"btn"},"v":{"click":"submit"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.save\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","disabled":[{"t":2,"r":"processing"}],"class":"btn -secondary g-margin-left--10"},"v":{"click":"close"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.close\")"}}]}]}],"x":{"r":["mode","CONST.MODES.PASSWORDVIEW"],"s":"_0===_1"}}]}],"r":"loading"}]}; var MODES = { LISTVIEW: "listView", PASSWORDADD: "passwordAdd", PASSWORDEDIT: "passwordEdit", PASSWORDVIEW: "passwordView", NOTEADD: "noteAdd", NOTEEDIT: "noteEdit", NOTEVIEW: "noteView", CREDIT_CARD_ADD: "creditCardAdd", CREDIT_CARD_EDIT: "creditCardEdit", CREDIT_CARD_VIEW: "creditCardView" }; var VAULTSTATES = { UNKNOWN: 1, NO_VAULT: 2, VAULT_EXISTS: 3, LOGGED: 4, IDENTITY_REGISTERED: 5, IDENTITY_AUTHORIZED: 6, SYNC_START_PENDING: 7, SYNC_RUNNING: 8, SYNC_END_PENDING: 9 }; var COLORS = [ "#FD4B5E", "#FF8B45", "#FFD83B", "#3EE4BA", "#A1EA53", "#4DD1FF", "#4898FE", "#9B72FF", "#F76FBF", "#656C78" ]; var PASSWORD_SCORE = { VERY_WEAK: 0, WEAK: 1, AVERAGE: 2, STRONG: 3, VERY_STRONG: 4 }; const CONST = { MODES: MODES, VAULTSTATES: VAULTSTATES, COLORS: COLORS, PASSWORD_SCORE: PASSWORD_SCORE }; const translateScore = { password: (value) => { switch (+value) { case CONST.PASSWORD_SCORE.VERY_WEAK: return { text: Ractive.localization.nls('passwords.strength.veryWeak'), level: 'veryWeak', class: 'color-danger' }; case CONST.PASSWORD_SCORE.WEAK: return { text: Ractive.localization.nls('passwords.strength.weak'), level: 'weak', class: 'color-danger' }; case CONST.PASSWORD_SCORE.AVERAGE: return { text: Ractive.localization.nls('passwords.strength.good'), level: 'good', class: 'color-attention' }; case CONST.PASSWORD_SCORE.STRONG: return { text: Ractive.localization.nls('passwords.strength.strong'), level: 'strong', class: 'color-ok' }; default: return { text: Ractive.localization.nls('passwords.strength.veryStrong'), level: 'veryStrong', class: 'color-ok' }; } } }; const template$c = {"v":3,"t":[{"t":7,"e":"svg","a":{"class":["pam_color__circle ",{"t":2,"r":"cssCls"}],"style":[{"t":2,"r":"cssInline"}]},"f":[{"t":7,"e":"text","a":{"class":"pam_color__text","x":"50%","y":"50%","dy":".35em"},"f":[{"t":2,"r":"initials"}]}]}]}; const Initials = Ractive.extend({ template : template$c, computed: { initials: function() { return this.getInitials(this.get('text'), this.get('url')); } }, stripProtocol(url) { var regex = /((ht|f)tps?:[\/]{2})?(w{3}\.)?\S*?(.*)/i; // eslint-disable-line no-useless-escape return url.replace(regex, '$4'); }, removeNonWordChars(string) { // http://stackoverflow.com/questions/5185326/java-script-regular-expression-for-detecting-non-ascii-characters/5185722 var regex = /[^\u00BF-\u1FFF\u2C00-\uD7FF\w]/gi; return string.replace(regex, ''); }, capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase(); }, getInitials(text, url) { var string = ''; if (text && text.length > 0) { string = text; } else if (url && url.length > 0) { string = this.stripProtocol(url); } if (string.length > 0) { string = this.removeNonWordChars(string); string = this.capitalizeFirstLetter(string); } return string.substring(0, 2); } }); const template$d = {"v":3,"t":[{"t":4,"f":[{"t":7,"e":"Initials","a":{"text":[{"t":2,"r":"serviceName"}],"url":[{"t":2,"r":"url"}],"cssCls":"pam_color","cssInline":["background-color:",{"t":2,"rx":{"r":"CONST.COLORS","m":[{"r":["color"],"s":"_0-1"}]}}]}}],"n":50,"r":"showInitials"},{"t":4,"f":[{"t":7,"e":"img","a":{"src":[{"t":2,"r":"imgSrc"}],"class":["pam_icon_image",{"t":4,"f":[" notransition"],"n":50,"r":"isCached"},{"t":4,"f":[" loaded"],"n":50,"r":"isLoaded"},{"t":4,"f":[" nomargin"],"n":50,"x":{"r":["showInitials"],"s":"!_0"}}]}}],"n":50,"r":"imgSrc"}]}; // Because of this bug https://butr.avast.com/browse/AV-13254 // We give images only some time to load, to prevent changing initials to img const TIME_TO_LOAD_LOCAL_IMAGES = 200; const PasswordIcon = Ractive.extend({ template: template$d, components: { Initials }, data: () => { return { isLoaded: false, isCached: false, showInitials: false, CONST: CONST }; }, oninit: function() { if (this.get('imgSrc')) { var img = document.createElement('img'); img.src = this.get('imgSrc'); img.onload = () => { if (!this.imgOnLoadTimeout) { this.imgOnLoadTimeout = setTimeout(() => { this.set('isLoaded', true); this._clearTimeouts(); }); } }; this.set('isCached', img.complete || img.width + img.height > 0); if (this.imgWaitTimeout) { this.imgWaitTimeout = setTimeout(() => { if (!this.get('isLoaded')) { this.set('showInitials', true); } this._clearTimeouts(); }, TIME_TO_LOAD_LOCAL_IMAGES); } } else { this.set('showInitials', true); } }, _clearTimeouts() { if (this.imgOnLoadTimeout) { clearTimeout(this.imgOnLoadTimeout); this.imgOnLoadTimeout = undefined; } if (this.imgWaitTimeout) { clearTimeout(this.imgWaitTimeout); this.imgWaitTimeout = undefined; } }, onteardown() { this._clearTimeouts(); } }); /** * Fetch feature flag defined in config.def * @param featuName {String} Name of the feature * @return {bool} enabled */ function fetchFeatureFlag(featureName) { return NAPI$1.request('app.settings.Get', {name: ('avdef://config/Pam/' + featureName)}) .then((response) => { return response.value; }); } /** * Retrieve operating system and device name from identity description. * @param featuName {String} Identity description * @return {Object} os, deviceName, dateAdded, prefix */ function parseIdentityDescription(description) { var prefix2os = { mac: 'Mac', win: 'Windows', ios: 'iOS', and: 'Android', bak: '' // backup identity }; var match = description.match(/(mac|win|ios|and|bak)-(\d+)-?(.*)/); if (match) { var prefix = match[1]; var os = prefix2os[prefix]; const dateAdded = match[2]; return { os: os, deviceName: match[3] ? match[3] : os, dateAdded: dateAdded, prefix: prefix }; } return { os: '', deviceName: description }; } /** * Prevent two way bindind by cloning given object. */ function preventTwoWayBinding(data) { return JSON.parse(JSON.stringify(data)); } /** * Returns an alphabetivally sorted array of objects by property passed as param. * * Invalid items (i.e., where given property value isn't a string) are placed at * the beginning. * * @param arr {Array} Array to be sorted * @param prop {String} Property based on which the array should be sorted * @return {Array} */ function sortAlphabetically(arr, prop) { arr.sort(function(a, b) { const textA = a[prop]; const textB = b[prop]; const isStringA = typeof textA === 'string'; const isStringB = typeof textB === 'string'; if (!isStringA || !isStringB) { console.error('sortAlphabetically cannot sort', arr, 'by property', prop); if (!isStringA && !isStringB) return 0; return !isStringA ? -1 : 1; } return textA.localeCompare(textB); }); return arr; } const template$e = {"v":3,"t":[{"t":7,"e":"span","a":{"class":["btn -secondary pam_copied",{"t":4,"f":[" pam_copied_open"],"n":50,"r":"showCopyConfirmation"}]},"f":[{"t":7,"e":"div","f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.copied\")"}}]}]}," ",{"t":7,"e":"button","a":{"type":"button","class":"btn -secondary -icon-only","title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.password.copyToClipboard\")"}}]},"v":{"click":"click"},"f":[{"t":7,"e":"Icon","a":{"name":"copy"}}]}]}; function copy(elemOrString) { var val = ''; if (typeof elemOrString === 'string') { val = elemOrString; } else if (typeof elemOrString.select === 'function' && typeof elemOrString.value === 'string') { val = elemOrString.value; } else if (elemOrString instanceof HTMLElement) { val = elemOrString.innerText; } else if (typeof elemOrString.toString === 'function') { val = elemOrString.toString(); } else { return Promise.reject({ error: 'invalid argument', detail: elemOrString }); } return new Promise(function(resolve, reject) { try { var rtl = document.documentElement.getAttribute('dir') == 'rtl'; var elem = document.createElement('textarea'); elem.style.fontSize = '12pt'; elem.style.position = 'absolute'; elem.style.width = '128px'; if (rtl) { elem.style.right = '-4096px'; } else { elem.style.left = '-4096px'; } elem.tabIndex = -1; elem.value = val; document.body.appendChild(elem); elem.select(); if (!document.execCommand('copy')) { reject('clipboard is disabled'); } document.body.removeChild(elem); resolve(); } catch (ex) { reject(ex); } }); } function clear() { return copy('\u200B'); // zero width space is normally ignored later on, but it does trigger the copy, unlike just '' } const clipboard = { copy, clear }; const ButtonCopyToClipboard = Ractive.extend({ isolated: true, template: template$e, data: function() { return { text: '', showCopyConfirmation: false }; }, oninit() { this.on('click', () => { var text = this.get('text'); clipboard.copy(text).then(() => { this.set('showCopyConfirmation', true); window.setTimeout(() => this.set('showCopyConfirmation', false), 1500); }); }); } }); const template$f = {"v":3,"t":[{"t":7,"e":"div","a":{"class":[{"t":2,"r":"cssCls"}," btn -secondary -icon-only"],"title":[{"t":4,"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.hide\")"}}],"n":50,"r":"isRevealed"},{"t":4,"n":51,"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.show\")"}}],"r":"isRevealed"}]},"v":{"click":"toggle"},"f":[{"t":7,"e":"Icon","a":{"name":["eye",{"t":4,"f":["-hide"],"n":50,"r":"isRevealed"}]}}]}]}; const ButtonRevealSecret = Ractive.extend({ isolated: true, template: template$f, data: function() { return { isRevealed: false, onChange: null, cssCls: '' }; }, oninit() { this.on('toggle', () => this.set('isRevealed', !this.get('isRevealed'))); } }); // Renders content if given feature is enabled. const WithFeature = Ractive.extend({ isolated: true, template: '{{#if hasFeature}}{{yield}}{{/if}}', data() { return { feature: null, hasFeature: false }; }, oninit() { fetchFeatureFlag(this.get('feature')) .then(isEnabled => this.set('hasFeature', isEnabled)) .catch(err => console.error('Failed to fetch feature flag.', err)); } }); const template$g = {"v":3,"t":[{"t":7,"e":"div","a":{"class":["pam_error_label ",{"t":4,"f":["-hidden"],"n":50,"x":{"r":["error"],"s":"!_0"}}]},"f":[{"t":7,"e":"p","a":{"class":"color-danger -bg"},"f":[{"t":2,"r":"error"}]}]}]}; const ErrorLabel = Ractive.extend({ isolated: true, template: template$g, data() { } }); const template$h = {"v":3,"t":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_password-problem color-light-grey -bg"},"f":[{"t":7,"e":"button","a":{"type":"button","class":"drop-clickable"},"v":{"mouseover":{"n":"setHover","a":[true]},"mouseout":{"n":"setHover","a":[false]},"click":"toggleDrop"},"f":[{"t":7,"e":"div","a":{"class":"guardian-icon-cont"},"f":[{"t":7,"e":"Icon","a":{"name":"guardian","cssCls":"guardian guardian-icon"}}," ",{"t":7,"e":"Icon","a":{"name":"guardian-shield","cssCls":["guardian-icon color-",{"t":2,"r":"passwordState"},{"t":2,"x":{"r":["isHover"],"s":"_0?\"-secondary\":\"\""}}," -text"]}}," ",{"t":4,"f":[{"t":7,"e":"Icon","a":{"name":"guardian-shield-error","cssCls":"guardian-icon"}}],"n":50,"x":{"r":["passwordState"],"s":"_0===\"critical\""}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["passwordState"],"s":"_0===\"attention\""},"f":[{"t":7,"e":"Icon","a":{"name":"guardian-shield-warning","cssCls":"guardian-icon"}}]},{"t":4,"n":50,"x":{"r":["passwordState"],"s":"!(_0===\"attention\")"},"f":[" ",{"t":7,"e":"Icon","a":{"name":"guardian-shield-ok","cssCls":"guardian-icon"}}]}],"x":{"r":["passwordState"],"s":"_0===\"critical\""}}]}," ",{"t":7,"e":"div","a":{"class":["password-state color-",{"t":2,"r":"passwordState"},{"t":2,"x":{"r":["isHover"],"s":"_0?\"-secondary\":\"\""}}," -text"]},"f":[{"t":4,"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.passwordProblem.title.leaked\")"}}],"n":50,"x":{"r":["passwordMainProblem"],"s":"_0===\"isLeaked\""}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["passwordMainProblem"],"s":"_0===\"isDuplicateToLeaked\""},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.passwordProblem.title.duplicateToLeak\")"}}]},{"t":4,"n":50,"x":{"r":["passwordMainProblem"],"s":"(!(_0===\"isDuplicateToLeaked\"))&&(_0===\"isDuplicate\")"},"f":[" ",{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.passwordProblem.title.duplicate\")"}}]},{"t":4,"n":50,"x":{"r":["passwordMainProblem"],"s":"(!(_0===\"isDuplicateToLeaked\"))&&((!(_0===\"isDuplicate\"))&&(_0===\"isWeak\"))"},"f":[" ",{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.passwordProblem.title.weak\")"}}]}],"x":{"r":["passwordMainProblem"],"s":"_0===\"isLeaked\""}}]}," ",{"t":7,"e":"div","a":{"class":["drop-arrow ",{"t":2,"x":{"r":["isExpanded"],"s":"_0?\"-is-expanded\":\"\""}}]},"f":[{"t":7,"e":"Icon","a":{"name":"arrow-more"}}]}]}," ",{"t":7,"e":"div","a":{"class":["drop-content text -small ",{"t":2,"x":{"r":["isExpanded"],"s":"_0?\"-is-expanded\":\"\""}}]},"f":[{"t":4,"f":[{"t":7,"e":"div","f":[{"t":3,"x":{"r":["nls","passwordLeakTime"],"s":"_0(\"passwords.passwordGuardian.passwordProblem.desc1.leaked\",_1)"}}," ",{"t":3,"x":{"r":["nls","password.serviceName"],"s":"_0(\"passwords.passwordGuardian.passwordProblem.desc2.leaked\",_1)"}}]}],"n":50,"x":{"r":["passwordMainProblem"],"s":"_0===\"isLeaked\""}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["passwordMainProblem"],"s":"_0===\"isDuplicateToLeaked\""},"f":[{"t":7,"e":"div","f":[{"t":3,"x":{"r":["nls","password.leakDuplicateWith.0.serviceName"],"s":"_0(\"passwords.passwordGuardian.passwordProblem.desc1.duplicateToLeaked\",_1)"}}," ",{"t":3,"x":{"r":["nls","password.serviceName"],"s":"_0(\"passwords.passwordGuardian.passwordProblem.desc2.leaked\",_1)"}}]}]},{"t":4,"n":50,"x":{"r":["passwordMainProblem"],"s":"(!(_0===\"isDuplicateToLeaked\"))&&(_0===\"isDuplicate\")"},"f":[" ",{"t":7,"e":"div","f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.passwordProblem.desc1.pt1.duplicate\")"}}," ",{"t":7,"e":"strong","f":[{"t":7,"e":"button","a":{"class":"a"},"v":{"click":{"n":"viewPasswordDuplicates","d":[{"t":2,"r":"password"}]}},"f":[{"t":3,"x":{"r":["nls","password.duplicateWith.length"],"s":"_0(\"passwords.passwordGuardian.passwordProblem.desc1.pt2.duplicate\",_1)"}}]}]}," ",{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.passwordProblem.desc2.duplicate\")"}}," ",{"t":3,"x":{"r":["nls","password.serviceName"],"s":"_0(\"passwords.passwordGuardian.passwordProblem.desc3.duplicate\",_1)"}}]}]},{"t":4,"n":50,"x":{"r":["passwordMainProblem"],"s":"(!(_0===\"isDuplicateToLeaked\"))&&((!(_0===\"isDuplicate\"))&&(_0===\"isWeak\"))"},"f":[" ",{"t":7,"e":"div","f":[{"t":3,"x":{"r":["nls","password.serviceName"],"s":"_0(\"passwords.passwordGuardian.passwordProblem.desc.weak\",_1)"}}]}]}],"x":{"r":["passwordMainProblem"],"s":"_0===\"isLeaked\""}}," ",{"t":7,"e":"button","a":{"type":"button","class":["btn -",{"t":2,"r":"passwordState"}]},"v":{"click":"logIn"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.passwordProblem.logIn\")"}}]}]}]}],"n":50,"r":"passwordMainProblem"}]}; var css_248z$3 = ".pam_password-problem {\n margin-top: 15px;\n border-radius: 3px;\n box-shadow: 0 2px 4px 0 rgba(44,49,86,0.2);\n}\n.pam_password-problem .drop-clickable {\n cursor: pointer;\n display: flex;\n padding: 10px 15px;\n width: 100%;\n text-align: left;\n text-decoration: none;\n}\n.pam_password-problem .drop-clickable .drop-arrow {\n transform: rotate(90deg);\n width: 14px;\n height: 14px;\n margin-top: 12px;\n}\n.pam_password-problem .drop-clickable .drop-arrow.-is-expanded {\n transform: rotate(-90deg);\n}\n.pam_password-problem .drop-clickable .password-state {\n text-transform: uppercase;\n font-size: 18px;\n font-weight: bold;\n padding-top: 8px;\n flex-grow: 1;\n}\n.pam_password-problem .drop-clickable .guardian-icon-cont {\n font-size: 37px;\n position: relative;\n width: 37px;\n height: 37px;\n margin-left: 10px;\n}\n.pam_password-problem .drop-clickable .guardian-icon-cont .guardian-icon {\n position: absolute;\n top: 0;\n right: 0;\n}\n.pam_password-problem .drop-clickable .guardian-icon-cont .guardian-icon.guardian {\n opacity: 0.3;\n}\n.pam_password-problem .drop-content {\n display: none;\n padding: 0 47px 10px 63px;\n margin-top: -10px;\n}\n.pam_password-problem .drop-content .btn {\n margin-top: 15px;\n margin-bottom: 5px;\n}\n.pam_password-problem .drop-content.-is-expanded {\n display: block;\n}\n[dir=rtl] .pam_password-problem .drop-clickable {\n text-align: right;\n}\n[dir=rtl] .pam_password-problem .drop-clickable .guardian-icon {\n left: 0;\n}\n[dir=rtl] .drop-content {\n padding: 0 63px 10px 47px;\n}\n"; const PasswordProblem = Ractive.extend({ template: template$h, css: css_248z$3, data: () => { return { password: {}, passwordMainProblem: undefined, passwordLeakTime: undefined, passwordState: undefined, isExpanded: false, isHover: false, }; }, oninit() { const password = this.get('password'); const passwordGuardian = this.parent.parent.parent.findComponent('PasswordGuardian'); const vulnerablePassword = passwordGuardian.getVulnerablePasswordById(password.itemUID); if (vulnerablePassword) { this._setPasswordGuardianData(vulnerablePassword); } // If opened in PasswordGuardian tab, problem will be always expanded. if (this.parent.parent.component.name === 'PasswordGuardian') { this.set('isExpanded', true); } this.on('toggleDrop', () => { this.toggle('isExpanded'); }); this.on('setHover', (event, val) => { this.set('isHover', val); }); this.on('logIn', () => { const password = this.get('password'); this.fire('closePasswordDetail'); NAPI.request('app.pam.OpenUrlInBrowserAndShowToaster', {url: password.url, serviceName: password.serviceName, id: password.itemUID}) .catch(err => { console.error('app.pam.OpenUrlInBrowserAndShowToaster error: ', JSON.stringify(err)); }); }); }, _setPasswordGuardianData(password) { this.set({ 'password.leakTimestamp': password.leakTimestamp, 'password.leakDuplicateWith': password.leakDuplicateWith, 'password.duplicateWith': password.duplicateWith, 'password.isWeak': password.isWeak }); this._setPasswordState(password); this._setPasswordLeakTime(password); }, _setPasswordState(password) { const mainProblem = this._getPasswordMainProblem(password); this.set('passwordMainProblem', mainProblem); switch (mainProblem) { case 'isLeaked': case 'isDuplicateToLeaked': this.set('passwordState', 'critical'); // Critical problems will be always expanded this.set('isExpanded', true); break; case 'isDuplicate': case 'isWeak': this.set('passwordState', 'attention'); break; default: this.set('passwordState', 'ok'); } }, _setPasswordLeakTime(password) { if (password.leakTimestamp > 0) { const time = Ractive.localization.moment(password.leakTimestamp); this.set('passwordLeakTime', time.format('ll')); } }, _getPasswordMainProblem(password) { const isLeaked = function(password) { return password.isLeaked === true; // TODO: We don't use password.leakTimestamp > 0 for now //return password.leakTimestamp > 0; }; const isDuplicateToLeaked = function(password) { return password.leakDuplicateWith.length > 0; }; const isDuplicate = function(password) { return password.duplicateWith.length > 0; }; const isWeak = function(password) { return password.isWeak; }; if (isLeaked(password)) { return 'isLeaked'; } else if (isDuplicateToLeaked(password)) { return 'isDuplicateToLeaked'; } else if (isDuplicate(password)) { return 'isDuplicate'; } else if (isWeak(password)) { return 'isWeak'; } else { return undefined; } } }); // concatenated components/core-min.js+rollups/sha1.js+rollups/aes.js+components/enc-base64-min.js+components/enc-utf16-min.js+rollups/pbkdf2.js+rollups/hmac-sha256.js /* CryptoJS v3.1.2 code.google.com/p/crypto-js (c) 2009-2013 by Jeff Mott. All rights reserved. code.google.com/p/crypto-js/wiki/License */ var CryptoJS=CryptoJS||function(h,r){var k={},l=k.lib={},n=function(){},f=l.Base={extend:function(a){n.prototype=this;var b=new n;a&&b.mixIn(a);b.hasOwnProperty("init")||(b.init=function(){b.$super.init.apply(this,arguments);});b.init.prototype=b;b.$super=this;return b},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString);},clone:function(){return this.init.prototype.extend(this)}}, j=l.WordArray=f.extend({init:function(a,b){a=this.words=a||[];this.sigBytes=b!=r?b:4*a.length;},toString:function(a){return (a||s).stringify(this)},concat:function(a){var b=this.words,d=a.words,c=this.sigBytes;a=a.sigBytes;this.clamp();if(c%4)for(var e=0;e<a;e++)b[c+e>>>2]|=(d[e>>>2]>>>24-8*(e%4)&255)<<24-8*((c+e)%4);else if(65535<d.length)for(e=0;e<a;e+=4)b[c+e>>>2]=d[e>>>2];else b.push.apply(b,d);this.sigBytes+=a;return this},clamp:function(){var a=this.words,b=this.sigBytes;a[b>>>2]&=4294967295<< 32-8*(b%4);a.length=h.ceil(b/4);},clone:function(){var a=f.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var b=[],d=0;d<a;d+=4)b.push(4294967296*h.random()|0);return new j.init(b,a)}}),m=k.enc={},s=m.Hex={stringify:function(a){var b=a.words;a=a.sigBytes;for(var d=[],c=0;c<a;c++){var e=b[c>>>2]>>>24-8*(c%4)&255;d.push((e>>>4).toString(16));d.push((e&15).toString(16));}return d.join("")},parse:function(a){for(var b=a.length,d=[],c=0;c<b;c+=2)d[c>>>3]|=parseInt(a.substr(c, 2),16)<<24-4*(c%8);return new j.init(d,b/2)}},p=m.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var d=[],c=0;c<a;c++)d.push(String.fromCharCode(b[c>>>2]>>>24-8*(c%4)&255));return d.join("")},parse:function(a){for(var b=a.length,d=[],c=0;c<b;c++)d[c>>>2]|=(a.charCodeAt(c)&255)<<24-8*(c%4);return new j.init(d,b)}},t=m.Utf8={stringify:function(a){try{return decodeURIComponent(escape(p.stringify(a)))}catch(b){throw Error("Malformed UTF-8 data");}},parse:function(a){return p.parse(unescape(encodeURIComponent(a)))}}, q=l.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new j.init;this._nDataBytes=0;},_append:function(a){"string"==typeof a&&(a=t.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes;},_process:function(a){var b=this._data,d=b.words,c=b.sigBytes,e=this.blockSize,f=c/(4*e),f=a?h.ceil(f):h.max((f|0)-this._minBufferSize,0);a=f*e;c=h.min(4*a,c);if(a){for(var g=0;g<a;g+=e)this._doProcessBlock(d,g);g=d.splice(0,a);b.sigBytes-=c;}return new j.init(g,c)},clone:function(){var a=f.clone.call(this); a._data=this._data.clone();return a},_minBufferSize:0});l.Hasher=q.extend({cfg:f.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset();},reset:function(){q.reset.call(this);this._doReset();},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);return this._doFinalize()},blockSize:16,_createHelper:function(a){return function(b,d){return (new a.init(d)).finalize(b)}},_createHmacHelper:function(a){return function(b,d){return (new u.HMAC.init(a, d)).finalize(b)}}});var u=k.algo={};return k}(Math); /* CryptoJS v3.1.2 code.google.com/p/crypto-js (c) 2009-2013 by Jeff Mott. All rights reserved. code.google.com/p/crypto-js/wiki/License */ var CryptoJS=CryptoJS||function(e,m){var p={},j=p.lib={},l=function(){},f=j.Base={extend:function(a){l.prototype=this;var c=new l;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments);});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString);},clone:function(){return this.init.prototype.extend(this)}}, n=j.WordArray=f.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=m?c:4*a.length;},toString:function(a){return (a||h).stringify(this)},concat:function(a){var c=this.words,q=a.words,d=this.sigBytes;a=a.sigBytes;this.clamp();if(d%4)for(var b=0;b<a;b++)c[d+b>>>2]|=(q[b>>>2]>>>24-8*(b%4)&255)<<24-8*((d+b)%4);else if(65535<q.length)for(b=0;b<a;b+=4)c[d+b>>>2]=q[b>>>2];else c.push.apply(c,q);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<< 32-8*(c%4);a.length=e.ceil(c/4);},clone:function(){var a=f.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],b=0;b<a;b+=4)c.push(4294967296*e.random()|0);return new n.init(c,a)}}),b=p.enc={},h=b.Hex={stringify:function(a){var c=a.words;a=a.sigBytes;for(var b=[],d=0;d<a;d++){var f=c[d>>>2]>>>24-8*(d%4)&255;b.push((f>>>4).toString(16));b.push((f&15).toString(16));}return b.join("")},parse:function(a){for(var c=a.length,b=[],d=0;d<c;d+=2)b[d>>>3]|=parseInt(a.substr(d, 2),16)<<24-4*(d%8);return new n.init(b,c/2)}},g=b.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var b=[],d=0;d<a;d++)b.push(String.fromCharCode(c[d>>>2]>>>24-8*(d%4)&255));return b.join("")},parse:function(a){for(var c=a.length,b=[],d=0;d<c;d++)b[d>>>2]|=(a.charCodeAt(d)&255)<<24-8*(d%4);return new n.init(b,c)}},r=b.Utf8={stringify:function(a){try{return decodeURIComponent(escape(g.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return g.parse(unescape(encodeURIComponent(a)))}}, k=j.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new n.init;this._nDataBytes=0;},_append:function(a){"string"==typeof a&&(a=r.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes;},_process:function(a){var c=this._data,b=c.words,d=c.sigBytes,f=this.blockSize,h=d/(4*f),h=a?e.ceil(h):e.max((h|0)-this._minBufferSize,0);a=h*f;d=e.min(4*a,d);if(a){for(var g=0;g<a;g+=f)this._doProcessBlock(b,g);g=b.splice(0,a);c.sigBytes-=d;}return new n.init(g,d)},clone:function(){var a=f.clone.call(this); a._data=this._data.clone();return a},_minBufferSize:0});j.Hasher=k.extend({cfg:f.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset();},reset:function(){k.reset.call(this);this._doReset();},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);return this._doFinalize()},blockSize:16,_createHelper:function(a){return function(c,b){return (new a.init(b)).finalize(c)}},_createHmacHelper:function(a){return function(b,f){return (new s.HMAC.init(a, f)).finalize(b)}}});var s=p.algo={};return p}(Math); (function(){var e=CryptoJS,m=e.lib,p=m.WordArray,j=m.Hasher,l=[],m=e.algo.SHA1=j.extend({_doReset:function(){this._hash=new p.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(f,n){for(var b=this._hash.words,h=b[0],g=b[1],e=b[2],k=b[3],j=b[4],a=0;80>a;a++){if(16>a)l[a]=f[n+a]|0;else {var c=l[a-3]^l[a-8]^l[a-14]^l[a-16];l[a]=c<<1|c>>>31;}c=(h<<5|h>>>27)+j+l[a];c=20>a?c+((g&e|~g&k)+1518500249):40>a?c+((g^e^k)+1859775393):60>a?c+((g&e|g&k|e&k)-1894007588):c+((g^e^ k)-899497514);j=k;k=e;e=g<<30|g>>>2;g=h;h=c;}b[0]=b[0]+h|0;b[1]=b[1]+g|0;b[2]=b[2]+e|0;b[3]=b[3]+k|0;b[4]=b[4]+j|0;},_doFinalize:function(){var f=this._data,e=f.words,b=8*this._nDataBytes,h=8*f.sigBytes;e[h>>>5]|=128<<24-h%32;e[(h+64>>>9<<4)+14]=Math.floor(b/4294967296);e[(h+64>>>9<<4)+15]=b;f.sigBytes=4*e.length;this._process();return this._hash},clone:function(){var e=j.clone.call(this);e._hash=this._hash.clone();return e}});e.SHA1=j._createHelper(m);e.HmacSHA1=j._createHmacHelper(m);})(); /* CryptoJS v3.1.2 code.google.com/p/crypto-js (c) 2009-2013 by Jeff Mott. All rights reserved. code.google.com/p/crypto-js/wiki/License */ var CryptoJS=CryptoJS||function(u,p){var d={},l=d.lib={},s=function(){},t=l.Base={extend:function(a){s.prototype=this;var c=new s;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments);});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString);},clone:function(){return this.init.prototype.extend(this)}}, r=l.WordArray=t.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=p?c:4*a.length;},toString:function(a){return (a||v).stringify(this)},concat:function(a){var c=this.words,e=a.words,j=this.sigBytes;a=a.sigBytes;this.clamp();if(j%4)for(var k=0;k<a;k++)c[j+k>>>2]|=(e[k>>>2]>>>24-8*(k%4)&255)<<24-8*((j+k)%4);else if(65535<e.length)for(k=0;k<a;k+=4)c[j+k>>>2]=e[k>>>2];else c.push.apply(c,e);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<< 32-8*(c%4);a.length=u.ceil(c/4);},clone:function(){var a=t.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],e=0;e<a;e+=4)c.push(4294967296*u.random()|0);return new r.init(c,a)}}),w=d.enc={},v=w.Hex={stringify:function(a){var c=a.words;a=a.sigBytes;for(var e=[],j=0;j<a;j++){var k=c[j>>>2]>>>24-8*(j%4)&255;e.push((k>>>4).toString(16));e.push((k&15).toString(16));}return e.join("")},parse:function(a){for(var c=a.length,e=[],j=0;j<c;j+=2)e[j>>>3]|=parseInt(a.substr(j, 2),16)<<24-4*(j%8);return new r.init(e,c/2)}},b=w.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var e=[],j=0;j<a;j++)e.push(String.fromCharCode(c[j>>>2]>>>24-8*(j%4)&255));return e.join("")},parse:function(a){for(var c=a.length,e=[],j=0;j<c;j++)e[j>>>2]|=(a.charCodeAt(j)&255)<<24-8*(j%4);return new r.init(e,c)}},x=w.Utf8={stringify:function(a){try{return decodeURIComponent(escape(b.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return b.parse(unescape(encodeURIComponent(a)))}}, q=l.BufferedBlockAlgorithm=t.extend({reset:function(){this._data=new r.init;this._nDataBytes=0;},_append:function(a){"string"==typeof a&&(a=x.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes;},_process:function(a){var c=this._data,e=c.words,j=c.sigBytes,k=this.blockSize,b=j/(4*k),b=a?u.ceil(b):u.max((b|0)-this._minBufferSize,0);a=b*k;j=u.min(4*a,j);if(a){for(var q=0;q<a;q+=k)this._doProcessBlock(e,q);q=e.splice(0,a);c.sigBytes-=j;}return new r.init(q,j)},clone:function(){var a=t.clone.call(this); a._data=this._data.clone();return a},_minBufferSize:0});l.Hasher=q.extend({cfg:t.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset();},reset:function(){q.reset.call(this);this._doReset();},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);return this._doFinalize()},blockSize:16,_createHelper:function(a){return function(b,e){return (new a.init(e)).finalize(b)}},_createHmacHelper:function(a){return function(b,e){return (new n.HMAC.init(a, e)).finalize(b)}}});var n=d.algo={};return d}(Math); (function(){var u=CryptoJS,p=u.lib.WordArray;u.enc.Base64={stringify:function(d){var l=d.words,p=d.sigBytes,t=this._map;d.clamp();d=[];for(var r=0;r<p;r+=3)for(var w=(l[r>>>2]>>>24-8*(r%4)&255)<<16|(l[r+1>>>2]>>>24-8*((r+1)%4)&255)<<8|l[r+2>>>2]>>>24-8*((r+2)%4)&255,v=0;4>v&&r+0.75*v<p;v++)d.push(t.charAt(w>>>6*(3-v)&63));if(l=t.charAt(64))for(;d.length%4;)d.push(l);return d.join("")},parse:function(d){var l=d.length,s=this._map,t=s.charAt(64);t&&(t=d.indexOf(t),-1!=t&&(l=t));for(var t=[],r=0,w=0;w< l;w++)if(w%4){var v=s.indexOf(d.charAt(w-1))<<2*(w%4),b=s.indexOf(d.charAt(w))>>>6-2*(w%4);t[r>>>2]|=(v|b)<<24-8*(r%4);r++;}return p.create(t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};})(); (function(u){function p(b,n,a,c,e,j,k){b=b+(n&a|~n&c)+e+k;return (b<<j|b>>>32-j)+n}function d(b,n,a,c,e,j,k){b=b+(n&c|a&~c)+e+k;return (b<<j|b>>>32-j)+n}function l(b,n,a,c,e,j,k){b=b+(n^a^c)+e+k;return (b<<j|b>>>32-j)+n}function s(b,n,a,c,e,j,k){b=b+(a^(n|~c))+e+k;return (b<<j|b>>>32-j)+n}for(var t=CryptoJS,r=t.lib,w=r.WordArray,v=r.Hasher,r=t.algo,b=[],x=0;64>x;x++)b[x]=4294967296*u.abs(u.sin(x+1))|0;r=r.MD5=v.extend({_doReset:function(){this._hash=new w.init([1732584193,4023233417,2562383102,271733878]);}, _doProcessBlock:function(q,n){for(var a=0;16>a;a++){var c=n+a,e=q[c];q[c]=(e<<8|e>>>24)&16711935|(e<<24|e>>>8)&4278255360;}var a=this._hash.words,c=q[n+0],e=q[n+1],j=q[n+2],k=q[n+3],z=q[n+4],r=q[n+5],t=q[n+6],w=q[n+7],v=q[n+8],A=q[n+9],B=q[n+10],C=q[n+11],u=q[n+12],D=q[n+13],E=q[n+14],x=q[n+15],f=a[0],m=a[1],g=a[2],h=a[3],f=p(f,m,g,h,c,7,b[0]),h=p(h,f,m,g,e,12,b[1]),g=p(g,h,f,m,j,17,b[2]),m=p(m,g,h,f,k,22,b[3]),f=p(f,m,g,h,z,7,b[4]),h=p(h,f,m,g,r,12,b[5]),g=p(g,h,f,m,t,17,b[6]),m=p(m,g,h,f,w,22,b[7]), f=p(f,m,g,h,v,7,b[8]),h=p(h,f,m,g,A,12,b[9]),g=p(g,h,f,m,B,17,b[10]),m=p(m,g,h,f,C,22,b[11]),f=p(f,m,g,h,u,7,b[12]),h=p(h,f,m,g,D,12,b[13]),g=p(g,h,f,m,E,17,b[14]),m=p(m,g,h,f,x,22,b[15]),f=d(f,m,g,h,e,5,b[16]),h=d(h,f,m,g,t,9,b[17]),g=d(g,h,f,m,C,14,b[18]),m=d(m,g,h,f,c,20,b[19]),f=d(f,m,g,h,r,5,b[20]),h=d(h,f,m,g,B,9,b[21]),g=d(g,h,f,m,x,14,b[22]),m=d(m,g,h,f,z,20,b[23]),f=d(f,m,g,h,A,5,b[24]),h=d(h,f,m,g,E,9,b[25]),g=d(g,h,f,m,k,14,b[26]),m=d(m,g,h,f,v,20,b[27]),f=d(f,m,g,h,D,5,b[28]),h=d(h,f, m,g,j,9,b[29]),g=d(g,h,f,m,w,14,b[30]),m=d(m,g,h,f,u,20,b[31]),f=l(f,m,g,h,r,4,b[32]),h=l(h,f,m,g,v,11,b[33]),g=l(g,h,f,m,C,16,b[34]),m=l(m,g,h,f,E,23,b[35]),f=l(f,m,g,h,e,4,b[36]),h=l(h,f,m,g,z,11,b[37]),g=l(g,h,f,m,w,16,b[38]),m=l(m,g,h,f,B,23,b[39]),f=l(f,m,g,h,D,4,b[40]),h=l(h,f,m,g,c,11,b[41]),g=l(g,h,f,m,k,16,b[42]),m=l(m,g,h,f,t,23,b[43]),f=l(f,m,g,h,A,4,b[44]),h=l(h,f,m,g,u,11,b[45]),g=l(g,h,f,m,x,16,b[46]),m=l(m,g,h,f,j,23,b[47]),f=s(f,m,g,h,c,6,b[48]),h=s(h,f,m,g,w,10,b[49]),g=s(g,h,f,m, E,15,b[50]),m=s(m,g,h,f,r,21,b[51]),f=s(f,m,g,h,u,6,b[52]),h=s(h,f,m,g,k,10,b[53]),g=s(g,h,f,m,B,15,b[54]),m=s(m,g,h,f,e,21,b[55]),f=s(f,m,g,h,v,6,b[56]),h=s(h,f,m,g,x,10,b[57]),g=s(g,h,f,m,t,15,b[58]),m=s(m,g,h,f,D,21,b[59]),f=s(f,m,g,h,z,6,b[60]),h=s(h,f,m,g,C,10,b[61]),g=s(g,h,f,m,j,15,b[62]),m=s(m,g,h,f,A,21,b[63]);a[0]=a[0]+f|0;a[1]=a[1]+m|0;a[2]=a[2]+g|0;a[3]=a[3]+h|0;},_doFinalize:function(){var b=this._data,n=b.words,a=8*this._nDataBytes,c=8*b.sigBytes;n[c>>>5]|=128<<24-c%32;var e=u.floor(a/ 4294967296);n[(c+64>>>9<<4)+15]=(e<<8|e>>>24)&16711935|(e<<24|e>>>8)&4278255360;n[(c+64>>>9<<4)+14]=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360;b.sigBytes=4*(n.length+1);this._process();b=this._hash;n=b.words;for(a=0;4>a;a++)c=n[a],n[a]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;return b},clone:function(){var b=v.clone.call(this);b._hash=this._hash.clone();return b}});t.MD5=v._createHelper(r);t.HmacMD5=v._createHmacHelper(r);})(Math); (function(){var u=CryptoJS,p=u.lib,d=p.Base,l=p.WordArray,p=u.algo,s=p.EvpKDF=d.extend({cfg:d.extend({keySize:4,hasher:p.MD5,iterations:1}),init:function(d){this.cfg=this.cfg.extend(d);},compute:function(d,r){for(var p=this.cfg,s=p.hasher.create(),b=l.create(),u=b.words,q=p.keySize,p=p.iterations;u.length<q;){n&&s.update(n);var n=s.update(d).finalize(r);s.reset();for(var a=1;a<p;a++)n=s.finalize(n),s.reset();b.concat(n);}b.sigBytes=4*q;return b}});u.EvpKDF=function(d,l,p){return s.create(p).compute(d, l)};})(); CryptoJS.lib.Cipher||function(u){var p=CryptoJS,d=p.lib,l=d.Base,s=d.WordArray,t=d.BufferedBlockAlgorithm,r=p.enc.Base64,w=p.algo.EvpKDF,v=d.Cipher=t.extend({cfg:l.extend(),createEncryptor:function(e,a){return this.create(this._ENC_XFORM_MODE,e,a)},createDecryptor:function(e,a){return this.create(this._DEC_XFORM_MODE,e,a)},init:function(e,a,b){this.cfg=this.cfg.extend(b);this._xformMode=e;this._key=a;this.reset();},reset:function(){t.reset.call(this);this._doReset();},process:function(e){this._append(e);return this._process()}, finalize:function(e){e&&this._append(e);return this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return {encrypt:function(b,k,d){return ("string"==typeof k?c:a).encrypt(e,b,k,d)},decrypt:function(b,k,d){return ("string"==typeof k?c:a).decrypt(e,b,k,d)}}}});d.StreamCipher=v.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var b=p.mode={},x=function(e,a,b){var c=this._iv;c?this._iv=u:c=this._prevBlock;for(var d=0;d<b;d++)e[a+d]^= c[d];},q=(d.BlockCipherMode=l.extend({createEncryptor:function(e,a){return this.Encryptor.create(e,a)},createDecryptor:function(e,a){return this.Decryptor.create(e,a)},init:function(e,a){this._cipher=e;this._iv=a;}})).extend();q.Encryptor=q.extend({processBlock:function(e,a){var b=this._cipher,c=b.blockSize;x.call(this,e,a,c);b.encryptBlock(e,a);this._prevBlock=e.slice(a,a+c);}});q.Decryptor=q.extend({processBlock:function(e,a){var b=this._cipher,c=b.blockSize,d=e.slice(a,a+c);b.decryptBlock(e,a);x.call(this, e,a,c);this._prevBlock=d;}});b=b.CBC=q;q=(p.pad={}).Pkcs7={pad:function(a,b){for(var c=4*b,c=c-a.sigBytes%c,d=c<<24|c<<16|c<<8|c,l=[],n=0;n<c;n+=4)l.push(d);c=s.create(l,c);a.concat(c);},unpad:function(a){a.sigBytes-=a.words[a.sigBytes-1>>>2]&255;}};d.BlockCipher=v.extend({cfg:v.cfg.extend({mode:b,padding:q}),reset:function(){v.reset.call(this);var a=this.cfg,b=a.iv,a=a.mode;if(this._xformMode==this._ENC_XFORM_MODE)var c=a.createEncryptor;else c=a.createDecryptor,this._minBufferSize=1;this._mode=c.call(a, this,b&&b.words);},_doProcessBlock:function(a,b){this._mode.processBlock(a,b);},_doFinalize:function(){var a=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){a.pad(this._data,this.blockSize);var b=this._process(!0);}else b=this._process(!0),a.unpad(b);return b},blockSize:4});var n=d.CipherParams=l.extend({init:function(a){this.mixIn(a);},toString:function(a){return (a||this.formatter).stringify(this)}}),b=(p.format={}).OpenSSL={stringify:function(a){var b=a.ciphertext;a=a.salt;return (a?s.create([1398893684, 1701076831]).concat(a).concat(b):b).toString(r)},parse:function(a){a=r.parse(a);var b=a.words;if(1398893684==b[0]&&1701076831==b[1]){var c=s.create(b.slice(2,4));b.splice(0,4);a.sigBytes-=16;}return n.create({ciphertext:a,salt:c})}},a=d.SerializableCipher=l.extend({cfg:l.extend({format:b}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var l=a.createEncryptor(c,d);b=l.finalize(b);l=l.cfg;return n.create({ciphertext:b,key:c,iv:l.iv,algorithm:a,mode:l.mode,padding:l.padding,blockSize:a.blockSize,formatter:d.format})}, decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);return a.createDecryptor(c,d).finalize(b.ciphertext)},_parse:function(a,b){return "string"==typeof a?b.parse(a,this):a}}),p=(p.kdf={}).OpenSSL={execute:function(a,b,c,d){d||(d=s.random(8));a=w.create({keySize:b+c}).compute(a,d);c=s.create(a.words.slice(b),4*c);a.sigBytes=4*b;return n.create({key:a,iv:c,salt:d})}},c=d.PasswordBasedCipher=a.extend({cfg:a.cfg.extend({kdf:p}),encrypt:function(b,c,d,l){l=this.cfg.extend(l);d=l.kdf.execute(d, b.keySize,b.ivSize);l.iv=d.iv;b=a.encrypt.call(this,b,c,d.key,l);b.mixIn(d);return b},decrypt:function(b,c,d,l){l=this.cfg.extend(l);c=this._parse(c,l.format);d=l.kdf.execute(d,b.keySize,b.ivSize,c.salt);l.iv=d.iv;return a.decrypt.call(this,b,c,d.key,l)}});}(); (function(){for(var u=CryptoJS,p=u.lib.BlockCipher,d=u.algo,l=[],s=[],t=[],r=[],w=[],v=[],b=[],x=[],q=[],n=[],a=[],c=0;256>c;c++)a[c]=128>c?c<<1:c<<1^283;for(var e=0,j=0,c=0;256>c;c++){var k=j^j<<1^j<<2^j<<3^j<<4,k=k>>>8^k&255^99;l[e]=k;s[k]=e;var z=a[e],F=a[z],G=a[F],y=257*a[k]^16843008*k;t[e]=y<<24|y>>>8;r[e]=y<<16|y>>>16;w[e]=y<<8|y>>>24;v[e]=y;y=16843009*G^65537*F^257*z^16843008*e;b[k]=y<<24|y>>>8;x[k]=y<<16|y>>>16;q[k]=y<<8|y>>>24;n[k]=y;e?(e=z^a[a[a[G^z]]],j^=a[a[j]]):e=j=1;}var H=[0,1,2,4,8, 16,32,64,128,27,54],d=d.AES=p.extend({_doReset:function(){for(var a=this._key,c=a.words,d=a.sigBytes/4,a=4*((this._nRounds=d+6)+1),e=this._keySchedule=[],j=0;j<a;j++)if(j<d)e[j]=c[j];else {var k=e[j-1];j%d?6<d&&4==j%d&&(k=l[k>>>24]<<24|l[k>>>16&255]<<16|l[k>>>8&255]<<8|l[k&255]):(k=k<<8|k>>>24,k=l[k>>>24]<<24|l[k>>>16&255]<<16|l[k>>>8&255]<<8|l[k&255],k^=H[j/d|0]<<24);e[j]=e[j-d]^k;}c=this._invKeySchedule=[];for(d=0;d<a;d++)j=a-d,k=d%4?e[j]:e[j-4],c[d]=4>d||4>=j?k:b[l[k>>>24]]^x[l[k>>>16&255]]^q[l[k>>> 8&255]]^n[l[k&255]];},encryptBlock:function(a,b){this._doCryptBlock(a,b,this._keySchedule,t,r,w,v,l);},decryptBlock:function(a,c){var d=a[c+1];a[c+1]=a[c+3];a[c+3]=d;this._doCryptBlock(a,c,this._invKeySchedule,b,x,q,n,s);d=a[c+1];a[c+1]=a[c+3];a[c+3]=d;},_doCryptBlock:function(a,b,c,d,e,j,l,f){for(var m=this._nRounds,g=a[b]^c[0],h=a[b+1]^c[1],k=a[b+2]^c[2],n=a[b+3]^c[3],p=4,r=1;r<m;r++)var q=d[g>>>24]^e[h>>>16&255]^j[k>>>8&255]^l[n&255]^c[p++],s=d[h>>>24]^e[k>>>16&255]^j[n>>>8&255]^l[g&255]^c[p++],t= d[k>>>24]^e[n>>>16&255]^j[g>>>8&255]^l[h&255]^c[p++],n=d[n>>>24]^e[g>>>16&255]^j[h>>>8&255]^l[k&255]^c[p++],g=q,h=s,k=t;q=(f[g>>>24]<<24|f[h>>>16&255]<<16|f[k>>>8&255]<<8|f[n&255])^c[p++];s=(f[h>>>24]<<24|f[k>>>16&255]<<16|f[n>>>8&255]<<8|f[g&255])^c[p++];t=(f[k>>>24]<<24|f[n>>>16&255]<<16|f[g>>>8&255]<<8|f[h&255])^c[p++];n=(f[n>>>24]<<24|f[g>>>16&255]<<16|f[h>>>8&255]<<8|f[k&255])^c[p++];a[b]=q;a[b+1]=s;a[b+2]=t;a[b+3]=n;},keySize:8});u.AES=p._createHelper(d);})(); /* CryptoJS v3.1.2 code.google.com/p/crypto-js (c) 2009-2013 by Jeff Mott. All rights reserved. code.google.com/p/crypto-js/wiki/License */ (function(){var h=CryptoJS,j=h.lib.WordArray;h.enc.Base64={stringify:function(b){var e=b.words,f=b.sigBytes,c=this._map;b.clamp();b=[];for(var a=0;a<f;a+=3)for(var d=(e[a>>>2]>>>24-8*(a%4)&255)<<16|(e[a+1>>>2]>>>24-8*((a+1)%4)&255)<<8|e[a+2>>>2]>>>24-8*((a+2)%4)&255,g=0;4>g&&a+0.75*g<f;g++)b.push(c.charAt(d>>>6*(3-g)&63));if(e=c.charAt(64))for(;b.length%4;)b.push(e);return b.join("")},parse:function(b){var e=b.length,f=this._map,c=f.charAt(64);c&&(c=b.indexOf(c),-1!=c&&(e=c));for(var c=[],a=0,d=0;d< e;d++)if(d%4){var g=f.indexOf(b.charAt(d-1))<<2*(d%4),h=f.indexOf(b.charAt(d))>>>6-2*(d%4);c[a>>>2]|=(g|h)<<24-8*(a%4);a++;}return j.create(c,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};})(); /* CryptoJS v3.1.2 code.google.com/p/crypto-js (c) 2009-2013 by Jeff Mott. All rights reserved. code.google.com/p/crypto-js/wiki/License */ (function(){var e=CryptoJS,f=e.lib.WordArray,e=e.enc;e.Utf16=e.Utf16BE={stringify:function(b){var d=b.words;b=b.sigBytes;for(var c=[],a=0;a<b;a+=2)c.push(String.fromCharCode(d[a>>>2]>>>16-8*(a%4)&65535));return c.join("")},parse:function(b){for(var d=b.length,c=[],a=0;a<d;a++)c[a>>>1]|=b.charCodeAt(a)<<16-16*(a%2);return f.create(c,2*d)}};e.Utf16LE={stringify:function(b){var d=b.words;b=b.sigBytes;for(var c=[],a=0;a<b;a+=2)c.push(String.fromCharCode((d[a>>>2]>>>16-8*(a%4)&65535)<<8&4278255360|(d[a>>> 2]>>>16-8*(a%4)&65535)>>>8&16711935));return c.join("")},parse:function(b){for(var d=b.length,c=[],a=0;a<d;a++){var e=c,g=a>>>1,j=e[g],h=b.charCodeAt(a)<<16-16*(a%2);e[g]=j|h<<8&4278255360|h>>>8&16711935;}return f.create(c,2*d)}};})(); /* CryptoJS v3.1.2 code.google.com/p/crypto-js (c) 2009-2013 by Jeff Mott. All rights reserved. code.google.com/p/crypto-js/wiki/License */ var CryptoJS=CryptoJS||function(g,j){var e={},d=e.lib={},m=function(){},n=d.Base={extend:function(a){m.prototype=this;var c=new m;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments);});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString);},clone:function(){return this.init.prototype.extend(this)}}, q=d.WordArray=n.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=j?c:4*a.length;},toString:function(a){return (a||l).stringify(this)},concat:function(a){var c=this.words,p=a.words,f=this.sigBytes;a=a.sigBytes;this.clamp();if(f%4)for(var b=0;b<a;b++)c[f+b>>>2]|=(p[b>>>2]>>>24-8*(b%4)&255)<<24-8*((f+b)%4);else if(65535<p.length)for(b=0;b<a;b+=4)c[f+b>>>2]=p[b>>>2];else c.push.apply(c,p);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<< 32-8*(c%4);a.length=g.ceil(c/4);},clone:function(){var a=n.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],b=0;b<a;b+=4)c.push(4294967296*g.random()|0);return new q.init(c,a)}}),b=e.enc={},l=b.Hex={stringify:function(a){var c=a.words;a=a.sigBytes;for(var b=[],f=0;f<a;f++){var d=c[f>>>2]>>>24-8*(f%4)&255;b.push((d>>>4).toString(16));b.push((d&15).toString(16));}return b.join("")},parse:function(a){for(var c=a.length,b=[],f=0;f<c;f+=2)b[f>>>3]|=parseInt(a.substr(f, 2),16)<<24-4*(f%8);return new q.init(b,c/2)}},k=b.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var b=[],f=0;f<a;f++)b.push(String.fromCharCode(c[f>>>2]>>>24-8*(f%4)&255));return b.join("")},parse:function(a){for(var c=a.length,b=[],f=0;f<c;f++)b[f>>>2]|=(a.charCodeAt(f)&255)<<24-8*(f%4);return new q.init(b,c)}},h=b.Utf8={stringify:function(a){try{return decodeURIComponent(escape(k.stringify(a)))}catch(b){throw Error("Malformed UTF-8 data");}},parse:function(a){return k.parse(unescape(encodeURIComponent(a)))}}, u=d.BufferedBlockAlgorithm=n.extend({reset:function(){this._data=new q.init;this._nDataBytes=0;},_append:function(a){"string"==typeof a&&(a=h.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes;},_process:function(a){var b=this._data,d=b.words,f=b.sigBytes,l=this.blockSize,e=f/(4*l),e=a?g.ceil(e):g.max((e|0)-this._minBufferSize,0);a=e*l;f=g.min(4*a,f);if(a){for(var h=0;h<a;h+=l)this._doProcessBlock(d,h);h=d.splice(0,a);b.sigBytes-=f;}return new q.init(h,f)},clone:function(){var a=n.clone.call(this); a._data=this._data.clone();return a},_minBufferSize:0});d.Hasher=u.extend({cfg:n.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset();},reset:function(){u.reset.call(this);this._doReset();},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);return this._doFinalize()},blockSize:16,_createHelper:function(a){return function(b,d){return (new a.init(d)).finalize(b)}},_createHmacHelper:function(a){return function(b,d){return (new w.HMAC.init(a, d)).finalize(b)}}});var w=e.algo={};return e}(Math); (function(){var g=CryptoJS,j=g.lib,e=j.WordArray,d=j.Hasher,m=[],j=g.algo.SHA1=d.extend({_doReset:function(){this._hash=new e.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(d,e){for(var b=this._hash.words,l=b[0],k=b[1],h=b[2],g=b[3],j=b[4],a=0;80>a;a++){if(16>a)m[a]=d[e+a]|0;else {var c=m[a-3]^m[a-8]^m[a-14]^m[a-16];m[a]=c<<1|c>>>31;}c=(l<<5|l>>>27)+j+m[a];c=20>a?c+((k&h|~k&g)+1518500249):40>a?c+((k^h^g)+1859775393):60>a?c+((k&h|k&g|h&g)-1894007588):c+((k^h^ g)-899497514);j=g;g=h;h=k<<30|k>>>2;k=l;l=c;}b[0]=b[0]+l|0;b[1]=b[1]+k|0;b[2]=b[2]+h|0;b[3]=b[3]+g|0;b[4]=b[4]+j|0;},_doFinalize:function(){var d=this._data,e=d.words,b=8*this._nDataBytes,l=8*d.sigBytes;e[l>>>5]|=128<<24-l%32;e[(l+64>>>9<<4)+14]=Math.floor(b/4294967296);e[(l+64>>>9<<4)+15]=b;d.sigBytes=4*e.length;this._process();return this._hash},clone:function(){var e=d.clone.call(this);e._hash=this._hash.clone();return e}});g.SHA1=d._createHelper(j);g.HmacSHA1=d._createHmacHelper(j);})(); (function(){var g=CryptoJS,j=g.enc.Utf8;g.algo.HMAC=g.lib.Base.extend({init:function(e,d){e=this._hasher=new e.init;"string"==typeof d&&(d=j.parse(d));var g=e.blockSize,n=4*g;d.sigBytes>n&&(d=e.finalize(d));d.clamp();for(var q=this._oKey=d.clone(),b=this._iKey=d.clone(),l=q.words,k=b.words,h=0;h<g;h++)l[h]^=1549556828,k[h]^=909522486;q.sigBytes=b.sigBytes=n;this.reset();},reset:function(){var e=this._hasher;e.reset();e.update(this._iKey);},update:function(e){this._hasher.update(e);return this},finalize:function(e){var d= this._hasher;e=d.finalize(e);d.reset();return d.finalize(this._oKey.clone().concat(e))}});})(); (function(){var g=CryptoJS,j=g.lib,e=j.Base,d=j.WordArray,j=g.algo,m=j.HMAC,n=j.PBKDF2=e.extend({cfg:e.extend({keySize:4,hasher:j.SHA1,iterations:1}),init:function(d){this.cfg=this.cfg.extend(d);},compute:function(e,b){for(var g=this.cfg,k=m.create(g.hasher,e),h=d.create(),j=d.create([1]),n=h.words,a=j.words,c=g.keySize,g=g.iterations;n.length<c;){var p=k.update(b).finalize(j);k.reset();for(var f=p.words,v=f.length,s=p,t=1;t<g;t++){s=k.finalize(s);k.reset();for(var x=s.words,r=0;r<v;r++)f[r]^=x[r];}h.concat(p); a[0]++;}h.sigBytes=4*c;return h}});g.PBKDF2=function(d,b,e){return n.create(e).compute(d,b)};})(); /* CryptoJS v3.1.2 code.google.com/p/crypto-js (c) 2009-2013 by Jeff Mott. All rights reserved. code.google.com/p/crypto-js/wiki/License */ var CryptoJS=CryptoJS||function(h,s){var f={},g=f.lib={},q=function(){},m=g.Base={extend:function(a){q.prototype=this;var c=new q;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments);});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString);},clone:function(){return this.init.prototype.extend(this)}}, r=g.WordArray=m.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=s?c:4*a.length;},toString:function(a){return (a||k).stringify(this)},concat:function(a){var c=this.words,d=a.words,b=this.sigBytes;a=a.sigBytes;this.clamp();if(b%4)for(var e=0;e<a;e++)c[b+e>>>2]|=(d[e>>>2]>>>24-8*(e%4)&255)<<24-8*((b+e)%4);else if(65535<d.length)for(e=0;e<a;e+=4)c[b+e>>>2]=d[e>>>2];else c.push.apply(c,d);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<< 32-8*(c%4);a.length=h.ceil(c/4);},clone:function(){var a=m.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],d=0;d<a;d+=4)c.push(4294967296*h.random()|0);return new r.init(c,a)}}),l=f.enc={},k=l.Hex={stringify:function(a){var c=a.words;a=a.sigBytes;for(var d=[],b=0;b<a;b++){var e=c[b>>>2]>>>24-8*(b%4)&255;d.push((e>>>4).toString(16));d.push((e&15).toString(16));}return d.join("")},parse:function(a){for(var c=a.length,d=[],b=0;b<c;b+=2)d[b>>>3]|=parseInt(a.substr(b, 2),16)<<24-4*(b%8);return new r.init(d,c/2)}},n=l.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var d=[],b=0;b<a;b++)d.push(String.fromCharCode(c[b>>>2]>>>24-8*(b%4)&255));return d.join("")},parse:function(a){for(var c=a.length,d=[],b=0;b<c;b++)d[b>>>2]|=(a.charCodeAt(b)&255)<<24-8*(b%4);return new r.init(d,c)}},j=l.Utf8={stringify:function(a){try{return decodeURIComponent(escape(n.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return n.parse(unescape(encodeURIComponent(a)))}}, u=g.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new r.init;this._nDataBytes=0;},_append:function(a){"string"==typeof a&&(a=j.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes;},_process:function(a){var c=this._data,d=c.words,b=c.sigBytes,e=this.blockSize,f=b/(4*e),f=a?h.ceil(f):h.max((f|0)-this._minBufferSize,0);a=f*e;b=h.min(4*a,b);if(a){for(var g=0;g<a;g+=e)this._doProcessBlock(d,g);g=d.splice(0,a);c.sigBytes-=b;}return new r.init(g,b)},clone:function(){var a=m.clone.call(this); a._data=this._data.clone();return a},_minBufferSize:0});g.Hasher=u.extend({cfg:m.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset();},reset:function(){u.reset.call(this);this._doReset();},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);return this._doFinalize()},blockSize:16,_createHelper:function(a){return function(c,d){return (new a.init(d)).finalize(c)}},_createHmacHelper:function(a){return function(c,d){return (new t.HMAC.init(a, d)).finalize(c)}}});var t=f.algo={};return f}(Math); (function(h){for(var s=CryptoJS,f=s.lib,g=f.WordArray,q=f.Hasher,f=s.algo,m=[],r=[],l=function(a){return 4294967296*(a-(a|0))|0},k=2,n=0;64>n;){var j;a:{j=k;for(var u=h.sqrt(j),t=2;t<=u;t++)if(!(j%t)){j=!1;break a}j=!0;}j&&(8>n&&(m[n]=l(h.pow(k,0.5))),r[n]=l(h.pow(k,1/3)),n++);k++;}var a=[],f=f.SHA256=q.extend({_doReset:function(){this._hash=new g.init(m.slice(0));},_doProcessBlock:function(c,d){for(var b=this._hash.words,e=b[0],f=b[1],g=b[2],j=b[3],h=b[4],m=b[5],n=b[6],q=b[7],p=0;64>p;p++){if(16>p)a[p]= c[d+p]|0;else {var k=a[p-15],l=a[p-2];a[p]=((k<<25|k>>>7)^(k<<14|k>>>18)^k>>>3)+a[p-7]+((l<<15|l>>>17)^(l<<13|l>>>19)^l>>>10)+a[p-16];}k=q+((h<<26|h>>>6)^(h<<21|h>>>11)^(h<<7|h>>>25))+(h&m^~h&n)+r[p]+a[p];l=((e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22))+(e&f^e&g^f&g);q=n;n=m;m=h;h=j+k|0;j=g;g=f;f=e;e=k+l|0;}b[0]=b[0]+e|0;b[1]=b[1]+f|0;b[2]=b[2]+g|0;b[3]=b[3]+j|0;b[4]=b[4]+h|0;b[5]=b[5]+m|0;b[6]=b[6]+n|0;b[7]=b[7]+q|0;},_doFinalize:function(){var a=this._data,d=a.words,b=8*this._nDataBytes,e=8*a.sigBytes; d[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=h.floor(b/4294967296);d[(e+64>>>9<<4)+15]=b;a.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var a=q.clone.call(this);a._hash=this._hash.clone();return a}});s.SHA256=q._createHelper(f);s.HmacSHA256=q._createHmacHelper(f);})(Math); (function(){var h=CryptoJS,s=h.enc.Utf8;h.algo.HMAC=h.lib.Base.extend({init:function(f,g){f=this._hasher=new f.init;"string"==typeof g&&(g=s.parse(g));var h=f.blockSize,m=4*h;g.sigBytes>m&&(g=f.finalize(g));g.clamp();for(var r=this._oKey=g.clone(),l=this._iKey=g.clone(),k=r.words,n=l.words,j=0;j<h;j++)k[j]^=1549556828,n[j]^=909522486;r.sigBytes=l.sigBytes=m;this.reset();},reset:function(){var f=this._hasher;f.reset();f.update(this._iKey);},update:function(f){this._hasher.update(f);return this},finalize:function(f){var g= this._hasher;f=g.finalize(f);g.reset();return g.finalize(this._oKey.clone().concat(f))}});})(); var CryptoJS_1 = CryptoJS; var crypto = { CryptoJS: CryptoJS_1 }; var dataConv = createCommonjsModule(function (module, exports) { // // DataConvertor.js // cryptocom // // Created by Petr Vanek on 13/06/15. // Copyright (c) 2015 Petr Vanek. All rights reserved. // (function () { var CryptoJS; CryptoJS = crypto.CryptoJS; var DataConvertor = { arrayBuf2str: function (buf) { var bufView = new Uint16Array(buf); var unis = []; for (var i = 0; i < bufView.length; i++) { unis.push(bufView[i]); } return String.fromCharCode.apply(null, unis); }, str2arrayBuf: function (str) { var buf = new ArrayBuffer(str.length * 2); var bufView = new Uint16Array(buf); for (var i = 0; i < str.length; i++) { bufView[i] = str.charCodeAt(i); } return buf; }, insertIntoNative: function (fromPosition, originArray, insertedArray) { if (((originArray - fromPosition) - originArray.length ) < 0) return; for (var i = 0; i < insertedArray.length; i++) { originArray[i + fromPosition] = insertedArray[i]; } }, arrayNativeCpy: function (toArray, posToArray, fromArray, posFromArray, count) { for (var i = 0; i < count; i++) { toArray[i + posToArray] = fromArray[i + posFromArray]; } }, crypto2nativeArray: function (cryptoArray) { var words = cryptoArray.words; var sigBytes = cryptoArray.sigBytes; var nativearray = new Uint8Array(sigBytes); for (var i = 0; i < sigBytes; i++) { var byte = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; nativearray[i] = byte; } return nativearray; }, uint642native: function (uint64value) { var nativearray = new Uint8Array(8); var offset = 0; nativearray[offset++] = ((uint64value & 0xFF00000000000000) >> 56); nativearray[offset++] = ((uint64value & 0x00FF000000000000) >> 48); nativearray[offset++] = ((uint64value & 0x0000FF0000000000) >> 40); nativearray[offset++] = ((uint64value & 0x000000FF00000000) >> 32); nativearray[offset++] = ((uint64value & 0x00000000FF000000) >> 24); nativearray[offset++] = ((uint64value & 0x0000000000FF0000) >> 16); nativearray[offset++] = ((uint64value & 0x000000000000FF00) >> 8); nativearray[offset++] = ((uint64value & 0X00000000000000FF) ); return nativearray; }, native2int64: function (nativeArray) { var int64 = 0; var i = 0; int64 = ( (nativeArray[i++] << 56) | (nativeArray[i++] << 48) | (nativeArray[i++] << 40) | (nativeArray[i++] << 32) | (nativeArray[i++] << 24) | (nativeArray[i++] << 16) | (nativeArray[i++] << 8) | (nativeArray[i++] << 0) ); return int64; }, //array to cryptoJS array (word big-endian) native2cryptoArray: function (nativeArray) { var len = nativeArray.length; // Convert var words = []; for (var i = 0; i < len; i++) { words[i >>> 2] |= (nativeArray[i] & 0xff) << (24 - (i % 4) * 8); } return CryptoJS.lib.WordArray.create(words, len); }, //array to binary string native2string: function (nativeArray) { var i = 0; var len = nativeArray.length; var s = ""; for (i = 0; i < len; i++) { s += String.fromCharCode(nativeArray[i]); } return s; }, //string to array string2native: function (str) { var i = 0; len = str.length; nativeArray = new Uint8Array(len); for (var i = 0; i < len; i++) { nativeArray[i] = str.charCodeAt(i); } return nativeArray; }, hex2dec: function (s) { return parseInt(s, 16); } }; exports.DataConvertor = DataConvertor; })(); }); var dataConv_1 = dataConv.DataConvertor; var exchangeCrypto = createCommonjsModule(function (module, exports) { // // ExchangeCrypto.js // cryptocom // // Created by Petr Vanek on 13/06/15. // Copyright (c) 2015 Petr Vanek. All rights reserved. // (function () { var DataConvertor = dataConv.DataConvertor; var CryptoJS = crypto.CryptoJS; var ExchangeCrypto = { //params magics: "01F00F45225233128895DD8165FF00AA", vers: 1, versK: 2, iter: 10, //1000 too slow keysize: 256 / 32, KeyIDndigits: 8, //loader = loads all required parts //hash comparator hashsIsIdentical: function (a, b) { var i = a.length; if (i != b.length) return false; while (i--) { if (a[i] !== b[i]) return false; } return true; }, // errCode == 1 invalid format // == 2 invalid version // == 3 HMAC/ integrity corrupted exchangeException: function (errCode) { this.error = errCode; this.name = "exchange-crypto"; }, //Decrypt message - ArrayBuffer decryptArrayBuffer: function (encryptedMsg, sharedPasswd) { var byteArray = new Uint8Array(encryptedMsg); return this.decryptMessage(byteArray, sharedPasswd); }, //Decrypt message - native (Uint8Array) array decryptMessage: function (encryptedMsg, sharedPasswd) { var hmac; //minimal encrypted size if (encryptedMsg.length < 33) throw new this.exchangeException(1); //version if (encryptedMsg[0] != this.vers) throw new this.exchangeException(2); //salt convert to CryptoJS array var salt = DataConvertor.native2cryptoArray(encryptedMsg.subarray(1, 1 + 8)); //256 bits key length var key = CryptoJS.PBKDF2(sharedPasswd, salt, {keySize: this.keysize, iterations: this.iter}); var xlen = encryptedMsg.subarray(9, 9 + 8); var plen = DataConvertor.native2int64(xlen); var iv = DataConvertor.native2cryptoArray(encryptedMsg.subarray(17, 17 + 16)); var payload = DataConvertor.native2cryptoArray(encryptedMsg.subarray(17 + 16, (17 + plen))); cipherParams = CryptoJS.lib.CipherParams.create({ ciphertext: payload }); var decrypted = CryptoJS.AES.decrypt(cipherParams, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7}); var dd = DataConvertor.crypto2nativeArray(decrypted); var ddd = DataConvertor.native2cryptoArray(dd); if (plen != 0) { var hm = encryptedMsg.subarray(17 + plen, 17 + plen + 32); hmac = DataConvertor.native2cryptoArray(hm); var hmacx = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); hmacx.update(ddd); var hashx = DataConvertor.crypto2nativeArray(hmacx.finalize()); if (this.hashsIsIdentical(hashx, hm) == false) { throw new this.exchangeException(3); } } return DataConvertor.crypto2nativeArray(decrypted); }, //Encrypt message with shared password - native (Uint8Array) array encryptMessage: function (plainMsg, sharedPasswd) { //compute new message size [ Version [1] | Salt [8] | Length [8] | IV [16] | Data [N * 16] | HMAC [32]] var payloadsz = ( (16 + plainMsg.length) - (plainMsg.length % 16) ); var msgsize = 65 + payloadsz; var byteArray = new Uint8Array(msgsize); var plainText = DataConvertor.native2cryptoArray(plainMsg); //version byteArray[0] = this.vers; //salt var salt = CryptoJS.lib.WordArray.random(8); DataConvertor.insertIntoNative(1, byteArray, DataConvertor.crypto2nativeArray(salt)); //Length var szdt = DataConvertor.uint642native(payloadsz + 16); DataConvertor.insertIntoNative(9, byteArray, szdt); //IV var iv = CryptoJS.lib.WordArray.random(16); DataConvertor.insertIntoNative(17, byteArray, DataConvertor.crypto2nativeArray(iv)); //256 bits key length var key = CryptoJS.PBKDF2(sharedPasswd, salt, {keySize: this.keysize, iterations: this.iter}); ///plainText var encr = CryptoJS.AES.encrypt( plainText, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); DataConvertor.insertIntoNative(33, byteArray, DataConvertor.crypto2nativeArray(encr.ciphertext)); //hmac var hmacx = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); hmacx.update(plainText); var hashx = DataConvertor.crypto2nativeArray(hmacx.finalize()); DataConvertor.insertIntoNative(msgsize - 32, byteArray, hashx); return byteArray; }, decryptMessagewithKey: function (encryptedMsg, enckey) { var hmac; //minimal encrypted size if (encryptedMsg.length < 33) throw new this.exchangeException(1); //version if (encryptedMsg[0] != this.versK) throw new this.exchangeException(2); //salt convert to CryptoJS array var salt = DataConvertor.native2cryptoArray(encryptedMsg.subarray(1, 1 + 8)); //256 bits key length var dfextr = ExchangeCrypto.HkdfExtract(salt, enckey); var key = ExchangeCrypto.HkdfExpand(dfextr, "", 4*this.keysize); var xlen = encryptedMsg.subarray(9, 9 + 8); var plen = DataConvertor.native2int64(xlen); var iv = DataConvertor.native2cryptoArray(encryptedMsg.subarray(17, 17 + 16)); var payload = DataConvertor.native2cryptoArray(encryptedMsg.subarray(17 + 16, (17 + plen))); cipherParams = CryptoJS.lib.CipherParams.create({ ciphertext: payload }); var decrypted = CryptoJS.AES.decrypt(cipherParams, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7}); var dd = DataConvertor.crypto2nativeArray(decrypted); var ddd = DataConvertor.native2cryptoArray(dd); if (plen != 0) { var hm = encryptedMsg.subarray(17 + plen, 17 + plen + 32); hmac = DataConvertor.native2cryptoArray(hm); var hmacx = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); hmacx.update(ddd); var hashx = DataConvertor.crypto2nativeArray(hmacx.finalize()); if (this.hashsIsIdentical(hashx, hm) == false) { throw new this.exchangeException(3); } } return DataConvertor.crypto2nativeArray(decrypted); }, encryptMessageWithKey: function (plainMsg, enckey) { //compute new message size [ Version [1] | Salt [8] | Length [8] | IV [16] | Data [N * 16] | HMAC [32]] var payloadsz = ( (16 + plainMsg.length) - (plainMsg.length % 16) ); var msgsize = 65 + payloadsz; var byteArray = new Uint8Array(msgsize); var plainText = DataConvertor.native2cryptoArray(plainMsg); //version byteArray[0] = this.versK; //salt var salt = CryptoJS.lib.WordArray.random(8); //var salt = CryptoJS.enc.Hex.parse('0000000000000000'); DataConvertor.insertIntoNative(1, byteArray, DataConvertor.crypto2nativeArray(salt)); //Length var szdt = DataConvertor.uint642native(payloadsz + 16); DataConvertor.insertIntoNative(9, byteArray, szdt); //IV var iv = CryptoJS.lib.WordArray.random(16); //var iv = CryptoJS.enc.Hex.parse('00000000000000000000000000000000'); DataConvertor.insertIntoNative(17, byteArray, DataConvertor.crypto2nativeArray(iv)); //256 bits key length var dfextr = ExchangeCrypto.HkdfExtract(salt, enckey); var key = ExchangeCrypto.HkdfExpand(dfextr, "", 4*this.keysize); ///plainText var encr = CryptoJS.AES.encrypt( plainText, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); DataConvertor.insertIntoNative(33, byteArray, DataConvertor.crypto2nativeArray(encr.ciphertext)); //hmac var hmacx = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); hmacx.update(plainText); var hashx = DataConvertor.crypto2nativeArray(hmacx.finalize()); DataConvertor.insertIntoNative(msgsize - 32, byteArray, hashx); return byteArray; }, //derive key from password deriveKey: function (password) { //256 bits key length var key = CryptoJS.PBKDF2( password, CryptoJS.enc.Hex.parse(this.magics), { keySize: this.keysize, iterations: this.iter } ); var base64key = CryptoJS.enc.Base64.stringify(key); return base64key; }, keyID: function (b64deriveKey, counter) { var rawkey = CryptoJS.enc.Base64.parse(b64deriveKey); var cnt = counter; var toSign = new Uint8Array(8); for (var i = (toSign.length - 1); i >= 0; i--) { toSign[i] = (cnt & 0xff); cnt >>= 8; } var powers10 = [10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 1000000000]; var outhash = DataConvertor.crypto2nativeArray(CryptoJS.HmacSHA1(DataConvertor.native2cryptoArray(toSign), rawkey)); var hash_len = outhash.length; var offset = outhash[hash_len - 1] & 0x0f; var value = ((outhash[offset] & 0x7f) << 24) | ((outhash[offset + 1] & 0xff) << 16) | ((outhash[offset + 2] & 0xff) << 8) | (outhash[offset + 3] & 0xff); var notp = value % powers10[this.KeyIDndigits - 1]; var str = notp.toString(); while (str.length < this.KeyIDndigits) { str += "0"; } return str; }, HkdfExtract: function (salt, ikm) { var slt = []; var ik = CryptoJS.enc.Base64.parse(ikm); if (salt.length == 0) { var byteArray = new Uint8Array(32); byteArray.fill(0); slt = DataConvertor.native2cryptoArray(byteArray); } else { slt = salt; } var hmacx = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, slt); hmacx.update(ik); return hmacx.finalize(); }, HkdfExpand: function (prk, info, reqlen) { var step = 0; var N = Math.ceil(reqlen / 32); //256bits var inf = DataConvertor.crypto2nativeArray(CryptoJS.enc.Base64.parse(info)); var TLen = N * 32; var Wlen = 32 + inf.length + 1; var T = new Uint8Array(TLen); var W = new Uint8Array(Wlen); for (var iter = 0; iter < N; iter++) { DataConvertor.arrayNativeCpy(W, 0, T, step, 32); DataConvertor.arrayNativeCpy(W, 32, inf, 0, inf.length); W[Wlen - 1] = ( iter + 1 ); var hmacx = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, prk); if (iter == 0) { var IZ = new Uint8Array(W.length - 32); DataConvertor.arrayNativeCpy(IZ, 0, W, 32, W.length - 32); hmacx.update(DataConvertor.native2cryptoArray(IZ)); } else { hmacx.update(DataConvertor.native2cryptoArray(W)); } step = 32 * iter; var aux = DataConvertor.crypto2nativeArray(hmacx.finalize()); DataConvertor.arrayNativeCpy(T, step, aux, 0, aux.length); } var RV = new Uint8Array(reqlen); DataConvertor.arrayNativeCpy(RV, 0, T, 0, reqlen); return DataConvertor.native2cryptoArray(RV); } }; exports.ExchangeCrypto = ExchangeCrypto; })(); }); var exchangeCrypto_1 = exchangeCrypto.ExchangeCrypto; var aesConnection = createCommonjsModule(function (module) { (function () { var ExchangeCrypto = exchangeCrypto.ExchangeCrypto; var DataConvertor = dataConv.DataConvertor; var CryptoJS = crypto.CryptoJS; function needsConversion(requestData) { return typeof requestData !== 'object'; } var AESConnection = function() { this._encryptMap = {}; }; AESConnection.prototype.setPassword = function (url, passwd) { if (typeof passwd === 'undefined') { return this.setPassword("http://localhost", url); } if (passwd) { this._encryptMap[url.toLowerCase()] = ExchangeCrypto.deriveKey(passwd); } else { delete this._encryptMap[url.toLowerCase()]; } }; AESConnection.prototype.encryptMsg = function (message, keyHash) { if (!message) { return message; } if (needsConversion(message)) { // strings have to be converted var nativeStr = DataConvertor.string2native(message); return ExchangeCrypto.encryptMessageWithKey(nativeStr, keyHash); } else { // GPB messages (Uint8Array) are encrypted directly return ExchangeCrypto.encryptMessageWithKey(message, keyHash); } }; AESConnection.prototype.decryptMsg = function (encryptedData, keyHash) { if (typeof encryptedData === "undefined") { return null; } return ExchangeCrypto.decryptMessagewithKey(encryptedData, keyHash); }; AESConnection.prototype.decryptMsgToString = function (encryptedData, keyHash) { if (typeof encryptedData === "undefined") { return null; } var nativeDecrypted = ExchangeCrypto.decryptMessagewithKey(encryptedData, keyHash); return DataConvertor.native2string(nativeDecrypted); }; /** * encrypts body and sets X-AVAST-ID HTTP header to 1/2 of the hash * @msg { url, options: { method }, data } * @callback (decrypted) XMLHttpRequest response * @keyHash overwrite AESConnection.keyHash for this request, null for no encryption */ AESConnection.prototype.xhr = function (msg, callback, password) { var keyHash; if (typeof password === 'undefined') { for (var k in this._encryptMap) { if (msg.url.toLowerCase().indexOf(k) == 0) { keyHash = this._encryptMap[k]; break; } } } else if (password) { keyHash = ExchangeCrypto.deriveKey(password); } var xhr = new XMLHttpRequest(); var options = msg.options; if (!options) { options = {}; } // encrypted messages: only convert responses of text requests, otherwise it's a GPB // might need an option if we had GPB-to-text or text-to-GPB conversations var convertResponseToString = msg.data && needsConversion(msg.data); var method = msg.data ? "POST" : "GET"; if (options.method) { method = options.method; } xhr.open(method, msg.url, true, options.user, options.password); if (callback) { xhr.onreadystatechange = function () { if (xhr.readyState == 4) { var JSONableObj = {}; for (var k in xhr) { try { if ((typeof xhr[k] !== 'function' && typeof xhr[k] !== 'object') || (k === 'response' && options.responseType)) { JSONableObj[k] = xhr[k]; } } catch (e) { } } if (!JSONableObj.responseURL) { JSONableObj.responseURL = msg.url; } if (xhr.response == null) { JSONableObj.response = null; JSONableObj.responseText = null; callback(JSONableObj); return; } if (keyHash) { if (xhr.getResponseHeader('Content-Length') !== '0' && (xhr.response.byteLength > 0 || xhr.response.length > 0)) { try { var view = new Uint8Array(xhr.response); var decrypted; if (convertResponseToString) { decrypted = this.decryptMsgToString(view, keyHash); } else { decrypted = this.decryptMsg(view, keyHash); } JSONableObj.response = decrypted; JSONableObj.responseText = JSONableObj.response; } catch (ex) { callback({ status: (xhr.status === 200 ? 526 : xhr.status), response: ex, responseURL: msg.url, requestString: dumpRequest(xhr) }); return; } } else { JSONableObj.response = null; JSONableObj.responseText = null; } } callback(JSONableObj); } }.bind(this); } if (options.timeout) { xhr.timeout = options.timeout; } if (keyHash) { xhr.responseType = "arraybuffer"; } else if (options.responseType) { xhr.responseType = options.responseType; } if (keyHash && msg.data) { msg.data = this.encryptMsg(msg.data, keyHash); var safVer = typeof navigator !== 'undefined' ? navigator.appVersion.match(/([0-9]+)[0-9.]*[ ]Safari/) : null; if (safVer && safVer.length == 2 && safVer[1] == 5) { msg.data = msg.data.buffer; } } if (keyHash) { xhr.setRequestHeader("X-AVAST-APP-ID", ExchangeCrypto.keyID(keyHash, 0)); } // TODO: check on IE 8, may not process send() parameters try { xhr.send(msg.data); } catch (e) { if (callback) { callback({ status: 400, response: e.toString(), responseURL: msg.url }); } } }; function dumpRequest(xhr) { var dump = {}; ['readyState', 'response', 'responseText', 'responseType', 'responseURL', 'status', 'statusText'].forEach(function (key) { try { dump[key] = xhr[key].toString(); } catch (ex) { if (key !== 'responseText') { // responseText is not normaly available for responseType arraybuffer dump[key] = '<exception:' + ex.toString() + '>'; } } }); try { var responseArray = new Uint8Array(xhr.response); dump.responseBytes = (responseArray).toString(); if (dump.responseBytes.length > 42) { dump.responseBytes = dump.responseBytes.substring(0, 35) + '... (' + responseArray.length + ')'; } } catch (ex) { } if (dump.response.length > 42) { dump.response = dump.response.substring(0, 35) + '... (' + dump.response.length + ')'; } dump.headers = xhr.getAllResponseHeaders(); if (dump.headers.length > 88) { dump.headers = dump.headers.substring(0, 80) + '...'; } return JSON.stringify(dump); } module.exports = AESConnection; module.exports.DataConvertor = DataConvertor; module.exports.CryptoJS = CryptoJS; })(); }); var aesConnection_1 = aesConnection.DataConvertor; var aesConnection_2 = aesConnection.CryptoJS; // class ExchangeCrypto2 { //params constructor() { this.versionproto = 3; this.CryptoJS = aesConnection_2; this.DataConvertor = aesConnection_1; } hashsIsIdentical(a, b){ var i = a.length; if (i != b.length) return false; while (i--) { if (a[i] !== b[i]) return false; } return true; } decryptMessageWithKey( b64encryptedMsg, b64key) { var key = this.CryptoJS.enc.Base64.parse(b64key); var encMsg = this.CryptoJS.enc.Base64.parse(b64encryptedMsg); var encryptedMsg = this.DataConvertor.crypto2nativeArray(encMsg); //minimal encrypted size if (encryptedMsg.length < 33) throw new Error('Decryption failed - Invalid format'); //version if (encryptedMsg[0] != this.versionproto) throw new Error('Decryption failed - Invalid version'); var xlen = encryptedMsg.subarray(9, 9 + 8); var plen = this.DataConvertor.native2int64(xlen); var iv = this.DataConvertor.native2cryptoArray(encryptedMsg.subarray(17, 17+ 16)); var payload = this.DataConvertor.native2cryptoArray(encryptedMsg.subarray(17 + 16, (17 + plen))); var cipherParams = this.CryptoJS.lib.CipherParams.create({ ciphertext: payload }); var decrypted = this.CryptoJS.AES.decrypt(cipherParams, key, { iv: iv, mode: this.CryptoJS.mode.CBC, padding: this.CryptoJS.pad.Pkcs7}); var dd = this.DataConvertor.crypto2nativeArray(decrypted); var ddd = this.DataConvertor.native2cryptoArray(dd); if ( plen != 0 ) { var hm = encryptedMsg.subarray(17 + plen, 17 + plen + 32); var hmacx = this.CryptoJS.algo.HMAC.create(this.CryptoJS.algo.SHA256, key); hmacx.update( ddd ); var hashx = this.DataConvertor.crypto2nativeArray( hmacx.finalize()); if ( this.hashsIsIdentical(hashx, hm) == false ) { throw new Error('Decryption failed - HMAC/ integrity corrupted'); } } return decrypted.toString(this.CryptoJS.enc.Utf8); } encryptMessageWithKey(plainTextIn, b64key) { var plainText = this.CryptoJS.enc.Utf8.parse(plainTextIn); //this.DataConvertor.native2cryptoArray(plainTextIn); var key = this.CryptoJS.enc.Base64.parse(b64key); //compute new message size [ Version [3] | Salt [8] | Length [8] | IV [16] | Data [N * 16] | HMAC [32]] var payloadsz = ( (16 + plainText.sigBytes) - (plainText.sigBytes % 16) ); var msgsize = 65 + payloadsz; var byteArray = new Uint8Array(msgsize); //version byteArray[0] = this.versionproto; //salt var salt = this.CryptoJS.lib.WordArray.random(8); this.DataConvertor.insertIntoNative(1, byteArray, this.DataConvertor.crypto2nativeArray(salt)); //Length var szdt = this.DataConvertor.uint642native(payloadsz + 16); this.DataConvertor.insertIntoNative(9, byteArray, szdt); //IV var iv = this.CryptoJS.lib.WordArray.random(16); this.DataConvertor.insertIntoNative(17, byteArray, this.DataConvertor.crypto2nativeArray(iv)); ///plainText const options = {iv: iv, mode: this.CryptoJS.mode.CBC, padding: this.CryptoJS.pad.Pkcs7}; const encr = this.CryptoJS.AES.encrypt(plainText, key, options); this.DataConvertor.insertIntoNative(33, byteArray, this.DataConvertor.crypto2nativeArray(encr.ciphertext)); //hmac var hmacx = this.CryptoJS.algo.HMAC.create(this.CryptoJS.algo.SHA256, key); hmacx.update(plainText); var hashx = this.DataConvertor.crypto2nativeArray(hmacx.finalize()); this.DataConvertor.insertIntoNative(msgsize - 32, byteArray, hashx); return this.CryptoJS.enc.Base64.stringify(this.DataConvertor.native2cryptoArray(byteArray)); } } const DEFAULT_CRYPTO_API_VERSION = 1; const SUPPORTED_CRYPTO_API_VERSION = 3; class PamCrypto { //params constructor() { this.apiVersion = DEFAULT_CRYPTO_API_VERSION; this.key = null; this.crypto = new ExchangeCrypto2(); this.masterPasswordCryptoEnabled = false; this.dataCryptoEnabled = false; } initPamCrypto() { NAPI$1.request('app.pam.InitSession', {av: SUPPORTED_CRYPTO_API_VERSION}).then((response) => { if (response && response.s1 && response.av) { this.key = response.s1; this.apiVersion = response.av; switch (this.apiVersion) { case 1: this.masterPasswordCryptoEnabled = false; this.dataCryptoEnabled = false; break; case 2: this.masterPasswordCryptoEnabled = true; this.dataCryptoEnabled = false; break; case 3: this.masterPasswordCryptoEnabled = true; this.dataCryptoEnabled = true; break; default: this.masterPasswordCryptoEnabled = false; this.dataCryptoEnabled = false; break; } } else { console.error('app.pam.InitSession', 'Invalid response'); } }).catch((err) => { console.error('app.pam.InitSession', JSON.stringify(err)); }); } encrypt(input) { const result = this.crypto.encryptMessageWithKey(input, this.key); input = ''; return result; } decrypt(input) { const result = this.crypto.decryptMessageWithKey(input, this.key); input = ''; return result; } } const PamCrypto$1 = new PamCrypto(); const template$i = {"v":3,"t":[{"t":7,"e":"div","a":{"class":[{"t":2,"r":"classes"}]},"f":[{"t":7,"e":"canvas","a":{"width":"350","height":"28","id":[{"t":2,"r":"canvasId"}]}}]}]}; var css_248z$4 = ".input__row {\n text-align: start;\n}\n"; const SensitiveInput = Ractive.extend({ isolated: true, template: template$i, css: css_248z$4, data: function () { return { value: '', canvasId: 'passwordCanvas', classes: '' }; }, oncomplete() { const canvas = document.getElementById(this.get('canvasId')); const ctx = canvas.getContext("2d"); ctx.font = "14px Arial"; ctx.fillStyle = "#fff"; ctx.fillText(this.get('value'), 0, 20); } }); /** * Password Manager - Password details - edit/update **/ const PasswordDetails = Ractive.extend({ data: () => { return { loading: true, processing: false, // true if form action has been triggered CONST, passwordStrength: '', password: null, initialPasswordData: null, showPassword: false, showPasswordHistory: false, submitted: false, isServiceNameAndUrlEmpty: true, isPasswordEmpty: true, mode: CONST.MODES.VIEW, iconLoaded: false, apiError: '' }; }, components: { ButtonCopyToClipboard, ButtonRevealSecret, PasswordIcon, ErrorLabel, WithFeature, PasswordProblem, SensitiveInput }, template: template$b, oninit() { var id = this.get('passwordId'); if (id) { // Otherwise it's a "New account" dialog NAPI$1.track.view('PrivacyPasswords/Account/Detail'); } function processPasswordDetailData(data) { if (!data.color) { data.color = 7; } return data; } switch (this.get('mode')) { case CONST.MODES.PASSWORDADD: this.set('password.color', Math.ceil(Math.random()*CONST.COLORS.length)); this.set('loading', false); break; case CONST.MODES.PASSWORDVIEW: if (id) { this.getPasswordDetail(id) .then(response => { let pwdData = processPasswordDetailData(response); this.set('password', preventTwoWayBinding(pwdData)); this.set('initialPasswordData', preventTwoWayBinding(pwdData)); pwdData = null; this.set('loading', false); }); } break; } this.on('close', () => { this.teardown(); }); this.on('edit', () => { this.set('showPassword', false); NAPI$1.track.view('PrivacyPasswords/Account/Edit'); this.set('mode', CONST.MODES.PASSWORDEDIT); this._setPasswordStrength(this.get('password')); }); this.on('cancelEdit', () => { this.set('showPassword', false); NAPI$1.track.view('PrivacyPasswords/Account/Detail'); this.clearApiError(); this.set('password', preventTwoWayBinding(this.get('initialPasswordData'))); this.set('mode', CONST.MODES.PASSWORDVIEW); }); this.on('PasswordProblem.viewPasswordDuplicates', () => { this.set('mode', CONST.MODES.LISTVIEW); }); this.on('PasswordProblem.closePasswordDetail', () => { this.set('mode', CONST.MODES.LISTVIEW); }); this.on('selectColor', (event) => { this.set('password.color', event.node.value); }); this.on('togglePassword', () => { var show = !this.get('showPassword'); if (show) { track.account.passwordRevealed(); } this.set('showPassword', show); }); this.observe('password.customServiceName password.url', () => { var serviceName = this.get('password.customServiceName'), url = this.get('password.url'), isServiceNameAndUrlEmpty = !(serviceName.length > 0 || url.length > 0); this.set('isServiceNameAndUrlEmpty', isServiceNameAndUrlEmpty); }, {init: false}); this.observe('password.password password.userLoginName', (newValue, oldValue, keypath) => { let password = this.get('password'); const isEmpty = !password.password || password.password.length === 0; this.set('isPasswordEmpty', isEmpty); // Calculate password strength only in add/edit mode const mode = this.get('mode'); if (mode === CONST.MODES.PASSWORDEDIT || mode === CONST.MODES.PASSWORDADD) { // Call _setPasswordStrength only once on when values changed from undefined if (oldValue !== undefined || keypath !== 'password.userLoginName') { this._setPasswordStrength(password); } } password = null; }, {init: false}); this.on('submit', (event) => { this.set('showPassword', false); var data = this.get('password'); this.set('submitted', true); if (!this.get('isServiceNameAndUrlEmpty') && !this.get('isPasswordEmpty')) { this.set('processing', true); if (PamCrypto$1.dataCryptoEnabled){ data.password = data.password ? PamCrypto$1.encrypt(data.password) : data.password; data.note = data.note ? PamCrypto$1.encrypt(data.note) : data.note; } data.color = data.color ? parseInt(data.color) : data.color; data.customServiceName = data.customServiceName ? data.customServiceName.trim() : null; // send null, not undefined etc. data.url = data.url ? data.url.trim() : data.url; data.userLoginName = data.userLoginName ? data.userLoginName.trim() : data.userLoginName; if (this.get('mode') === CONST.MODES.PASSWORDEDIT) { this.updatePassword(data) .then(() => { this.clearApiError(); track.account.edited(); this.fire('edited', data); data = null; }) .catch(err => { this.setApiError('UpdatePAMPassword', err); }) .then(() => { this.set('processing', false); this.teardown(); }); } else { this.addPassword(data) .then(() => { this.set('processing', false); this.clearApiError(); track.account.createNew(); this.fire('edited', data); data = null; }) .catch(err => { this.setApiError('AddPAMPassword', err); }) .then(() => { this.set('processing', false); this.teardown(); }); } } event.original.preventDefault(); }); this.on('delete', (event, id) => { this.set('showPassword', false); this.deletePassword(id) .then(() => { this.clearApiError(); track.account.deleted(); this.fire('edited', this.get('password')); }) .catch(err => { this.setApiError('DeletePAMPassword', err); }) .then(() => { this.set('processing', false); this.teardown(); }); }); this.on('openUrl', (event, url) => { track.account.websiteLinkClicked(); if (!url) { return; } // We touch it to update the timestamp for the extension (in case there are more accounts for one domain) let data = this.get('password'); this.updatePassword(data); data = null; if (!/^[a-zA-Z]+[:][/[/]/.test(url)) { url = 'https://' + url; } NAPI$1.browse(url); }); }, getPasswordDetail(id) { return NAPI$1.request('app.pam.GetPAMPasswordDetail', {id: parseInt(id), basic: true}) .then(response => { if (PamCrypto$1.dataCryptoEnabled){ response.password = response.password ? PamCrypto$1.decrypt(response.password) : response.password; response.note = response.note ? PamCrypto$1.decrypt(response.note) : response.note; } return response; }) .catch(response => { console.error('GetPAMPasswordDetail', response); }); }, getPAMPasswordStrength(password, userLoginName) { return NAPI$1.request('app.pam.GetPAMPasswordStrength', { password: PamCrypto$1.masterPasswordCryptoEnabled? PamCrypto$1.encrypt(password) : password, userLoginName: userLoginName }) .then((response) => { password = null; return response; }) .catch(response => { console.error('GetPAMPasswordStrength', response); }); }, updatePassword(data) { return NAPI$1.request('app.pam.UpdatePAMPassword', data) .then(response => { console.log('UpdatePAMPassword', response); }); }, addPassword(data) { return NAPI$1.request('app.pam.AddPAMPassword', data) .then(response => { console.log('AddPAMPassword', response); }); }, deletePassword(id) { return NAPI$1.request('app.pam.DeletePAMPassword', id) .then(response => { console.log('DeletePAMPassword', response); }); }, clearApiError() { this.set('apiError', ''); }, setApiError(request, error) { this.set('apiError', Ractive.localization.nls(request === 'DeletePAMPassword' ? 'passwords.errorLabel.delete' : 'passwords.errorLabel.save')); console.error(request, error); }, setIconLoaded() { this.set('iconLoaded', true); }, _setPasswordStrength(password) { this.getPAMPasswordStrength(password.password, password.userLoginName) .then(response => { this.set('passwordStrength', translateScore.password(response.secureScore)); password = null; }); }, onteardown(){ this.set('showPassword', false); this.set('password', null); this.set('initialPasswordData', null); NAPI$1.emit('sensitiveModal.initPamCrypto'); setTimeout(() => { window.app.asyncCall('window.close', response => {}, []); }, 0); } }); const template$j = {"v":3,"t":[{"t":7,"e":"div","a":{"class":"modal pam_form"},"f":[{"t":7,"e":"div","a":{"class":"pam_color -preview","style":["background-color:",{"t":2,"rx":{"r":"CONST.COLORS","m":[{"r":["note.color"],"s":"_0-1"}]}}]},"f":[{"t":7,"e":"Icon","a":{"name":"securenotes","cssCls":"pam_note"}}]}," ",{"t":7,"e":"div","a":{"class":"pam_edit__title"},"f":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_colors"},"f":[{"t":4,"f":[{"t":7,"e":"input","o":"eventHandler","a":{"class":"pam_color","style":["background-color:",{"t":2,"rx":{"r":"CONST.COLORS","m":[{"t":30,"n":"i"}]}}],"type":"radio","name":"color","id":["color-",{"t":2,"x":{"r":["i"],"s":"_0+1"}}],"value":[{"t":2,"x":{"r":["i"],"s":"_0+1"}}]},"v":{"click":"selectColor"},"m":[{"t":4,"f":["checked=\"checked\""],"n":50,"x":{"r":["i","note.color"],"s":"_0+1==_1"}}]}],"i":"i","r":"CONST.COLORS"}]}],"n":50,"x":{"r":["CONST.MODES.NOTEEDIT","mode","CONST.MODES.NOTEADD"],"s":"_1===_0||_1===_2"}},{"t":4,"n":51,"f":[{"t":7,"e":"h3","a":{"class":"h3 pam_single_line"},"f":[{"t":2,"r":"note.label"}]}],"x":{"r":["CONST.MODES.NOTEEDIT","mode","CONST.MODES.NOTEADD"],"s":"_1===_0||_1===_2"}}]}," ",{"t":7,"e":"label","a":{"for":"title","class":"pam_label text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.secureNote.title\")"}}]}," ",{"t":4,"f":[{"t":7,"e":"p","a":{"class":"pam_value pam_single_line"},"f":[{"t":2,"r":"note.label"}]}],"n":50,"x":{"r":["mode","CONST.MODES.NOTEVIEW"],"s":"_0===_1"}},{"t":4,"n":51,"f":[{"t":7,"e":"input","o":"eventHandler","a":{"type":"text","class":["input -full pam_value ",{"t":4,"f":["-error"],"n":50,"x":{"r":["submitted","islabelEmpty"],"s":"_0&&_1"}}],"name":"title","id":"title","value":[{"t":2,"r":"note.label"}],"autofocus":"true"}}],"x":{"r":["mode","CONST.MODES.NOTEVIEW"],"s":"_0===_1"}}," ",{"t":7,"e":"label","a":{"for":"note","class":"pam_label text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.secureNote.note\")"}}]}," ",{"t":4,"f":[{"t":7,"e":"p","a":{"class":"pam_value pam_single_line"},"f":[{"t":2,"r":"note.note"}]}],"n":50,"x":{"r":["mode","CONST.MODES.NOTEVIEW"],"s":"_0===_1"}},{"t":4,"n":51,"f":[{"t":7,"e":"textarea","o":"eventHandler","a":{"name":"note","class":["input -full pam_value pam_textarea ",{"t":4,"f":["-error"],"n":50,"x":{"r":["submitted","isnoteEmpty"],"s":"_0&&_1"}}],"id":"note","value":[{"t":2,"r":"note.note"}]}}],"x":{"r":["mode","CONST.MODES.NOTEVIEW"],"s":"_0===_1"}}]}," ",{"t":7,"e":"div","a":{"class":"modal__footer"},"f":[{"t":7,"e":"ErrorLabel","a":{"error":[{"t":2,"r":"apiError"}]}}," ",{"t":4,"f":[{"t":7,"e":"button","a":{"type":"button","class":"btn","autofocus":"true"},"v":{"click":{"n":"edit","d":[{"t":2,"r":"note.itemUID"}]}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.edit\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","class":"btn -secondary g-margin-left--10"},"v":{"click":"close"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.close\")"}}]}],"n":50,"x":{"r":["mode","CONST.MODES.NOTEVIEW"],"s":"_0===_1"}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["mode","CONST.MODES.NOTEEDIT"],"s":"_0===_1"},"f":[{"t":7,"e":"button","a":{"type":"submit","disabled":[{"t":2,"r":"processing"}],"class":"btn"},"v":{"click":"submit"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.save\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","disabled":[{"t":2,"r":"processing"}],"class":"btn -secondary g-margin-left--10"},"v":{"click":"cancelEdit"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.cancel\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","disabled":[{"t":2,"r":"processing"}],"class":"btn -critical g-margin-left--10"},"v":{"click":{"n":"delete","d":[{"t":2,"r":"note.itemUID"}]}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.delete\")"}}]}]},{"t":4,"n":50,"x":{"r":["mode","CONST.MODES.NOTEEDIT"],"s":"!(_0===_1)"},"f":[" ",{"t":7,"e":"button","a":{"type":"submit","disabled":[{"t":2,"r":"processing"}],"class":"btn"},"v":{"click":"submit"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.save\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","disabled":[{"t":2,"r":"processing"}],"class":"btn -secondary g-margin-left--10"},"v":{"click":"close"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.close\")"}}]}]}],"x":{"r":["mode","CONST.MODES.NOTEVIEW"],"s":"_0===_1"}}]}]}; /** * Password Manager - Note details - edit/update **/ const NoteDetails = Ractive.extend({ template : template$j, components: { ErrorLabel }, data: () => { return { CONST: CONST, processing: false, // true if form action has been triggered submitted: false, islabelEmpty: true, isnoteEmpty: true, note: null, initialNoteData: null, apiError: '' }; }, oninit() { var id = this.get('noteId'); if (id) { // Otherwise it's a "New note" dialog NAPI$1.track.view('PrivacyPasswords/Secure note/Detail'); } function processNoteDetailData(data) { if (!data.color) { data.color = 7; } return data; } switch (this.get('mode')) { case CONST.MODES.NOTEADD: this.set('note.color', Math.ceil(Math.random()*CONST.COLORS.length)); break; case CONST.MODES.NOTEVIEW: // case CONST.MODES.NOTEEDIT: this.getNoteDetail(id) .then((response) => { let noteData = processNoteDetailData(response); this.set('note', preventTwoWayBinding(noteData)); this.set('initialNoteData', preventTwoWayBinding(noteData)); noteData = null; }); break; } this.on('selectColor', (event) => { this.set('note.color', event.node.value); }); this.observe('note.label note.note', (newValue, oldValue, keypath) => { var isEmpty = newValue.length === 0; this.set('is' + keypath.split('.')[1] + 'Empty', isEmpty); }, {init: false}); this.on('edit', () => { NAPI$1.track.view('PrivacyPasswords/Secure note/Edit'); this.set('mode', CONST.MODES.NOTEEDIT); }); this.on('cancelEdit', () => { NAPI$1.track.view('PrivacyPasswords/Secure note/Detail'); this.clearApiError(); this.set('mode', CONST.MODES.NOTEVIEW); this.set('note', preventTwoWayBinding(this.get('initialNoteData'))); }); this.on('submit', (event) => { var data = this.get('note'); // Encrypt if necessary if (PamCrypto$1.dataCryptoEnabled){ data.note = data.note ? PamCrypto$1.encrypt(data.note) : data.note; } data.color = parseInt(data.color); data.label = data.label.trim(); this.set('submitted', true); if (!this.get('islabelEmpty') && !this.get('isnoteEmpty')) { this.clearApiError(); this.set('processing', true); if (this.get('mode') === CONST.MODES.NOTEEDIT) { this.updateNote(data) .then(() => { track.secureNote.edited(); this.fire('edited'); }) .catch(err => this.setApiError('UpdateNote', err)) .then(() => this.set('processing', false)); } else { this.addNote(data) .then(() => { track.secureNote.createNew(); this.fire('edited'); }) .catch(err => this.setApiError('AddNote', err)) .then(() => this.set('processing', false)); } } data = null; event.original.preventDefault(); }); this.on('delete', (event, id) => { this.clearApiError(); this.set('processing', true); this.deleteNote(id) .then(() => { track.secureNote.deleted(); this.fire('edited'); }) .catch(err => this.setApiError('DeleteNote', err)) .then(() => this.set('processing', false)); }); }, getNoteDetail(id) { return NAPI$1.request('app.pamNotes.GetNoteDetail', id) .then((response) => { if (PamCrypto$1.dataCryptoEnabled){ response.note = response.note ? PamCrypto$1.decrypt(response.note) : response.note; } return response; }) .catch((response) => { console.error('GetNoteDetail', response); }); }, updateNote(data) { return NAPI$1.request('app.pamNotes.UpdateNote', data) .then((response) => { console.log('UpdateNote', response); }); }, addNote(data) { return NAPI$1.request('app.pamNotes.CreateNote', data) .then((response) => { console.log('AddNote', response); }); }, deleteNote(id) { return NAPI$1.request('app.pamNotes.DeleteNote', id) .then((response) => { console.log('DeleteNote', response); }); }, clearApiError() { this.set('apiError', ''); }, setApiError(request, error) { this.set('apiError', Ractive.localization.nls(request === 'DeleteNote' ? 'passwords.errorLabel.delete' : 'passwords.errorLabel.save')); console.error(request, error); }, onteardown(){ this.set('note', null); this.set('initialNoteData', null); } }); var css_248z$5 = ".pam_panel {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n border: solid 1px rgba(0,0,0,0.1);\n background-color: #fef9d6 !important;\n padding: 15px 20px;\n margin: 1% 0 1.6%;\n}\n.pam_panel strong {\n font-weight: 700;\n}\n.pam_panel__right {\n white-space: nowrap;\n padding-left: 20px;\n}\n.pam_panel div.browsers {\n margin-top: 10px;\n}\n.pam_panel .pam_sync_stopped_cont {\n display: flex;\n align-items: center;\n}\n.pam_panel .pam_sync_stopped_cont .pam_sync_stopped_icon {\n position: relative;\n margin-right: 20px;\n}\n.pam_panel .pam_sync_stopped_cont .pam_sync_stopped_icon .pam_sync_icon {\n font-size: 35px;\n}\n.pam_panel .pam_sync_stopped_cont .pam_sync_stopped_icon .badge {\n position: absolute;\n top: 20;\n right: 0;\n}\n"; const template$k = {"v":3,"t":[{"t":7,"e":"div","a":{"class":"pam_panel color-white -bg"},"f":[{"t":16}]}]}; const Panel = Ractive.extend({ template: template$k, css: css_248z$5, data(){ return { attr: null, cssCls: '' }; } }); const template$l = {"v":3,"t":[{"t":7,"e":"Panel","f":[{"t":7,"e":"div","f":[{"t":7,"e":"p","f":[{"t":3,"x":{"r":["nls","device"],"s":"_0(\"passwords.syncRequest.message\",_0(\"passwords.syncRequest.device.\"+_1))"}},{"t":7,"e":"br"},{"t":7,"e":"strong","f":[{"t":2,"r":"deviceName"},", ",{"t":3,"x":{"r":["nls","confirmCode"],"s":"_0(\"passwords.syncRequest.verificationCode\",_1)"}}]}]}]}," ",{"t":7,"e":"div","a":{"class":"pam_panel__right"},"f":[{"t":7,"e":"Button","v":{"domClick":"declineIdentity"},"a":{"cssCls":"-critical","disabled":[{"t":2,"r":"isSubmitted"}]},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.waitingIdentity.decline\")"}}]}," ",{"t":7,"e":"Button","v":{"domClick":"approveIdentity"},"a":{"disabled":[{"t":2,"r":"isSubmitted"}]},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.allow\")"}}]}]}]}]}; const WaitingIdentityPanel = Ractive.extend({ isolated: true, components: { Panel }, template: template$l, css: css_248z$5, data() { return { identity: null, // {id, description, confirmCode} isSubmitted: false }; }, computed: { confirmCode: function() { return this.get('identity') && this.get('identity').confirmCode; }, device: function() { return this.get('_parsedDescription') && this.get('_parsedDescription').prefix; }, deviceName: function() { return this.get('_parsedDescription') && this.get('_parsedDescription').deviceName; }, _parsedDescription: function() { return parseIdentityDescription(this.get('identity.description')); } }, oninit() { this.on('approveIdentity', () => this.approveIdentity()); this.on('declineIdentity', () => this.declineIdentity()); }, approveIdentity() { var identity = this.get('identity'); console.log('Going to approve', identity); NAPI$1.request('app.pam.ApproveIdentity', {identity: identity}); this.set('isSubmitted', true); }, declineIdentity() { var identity = this.get('identity'); console.log('Going to decline', identity); NAPI$1.request('app.pam.DeclineIdentity', {identity: identity}); this.set('isSubmitted', true); } }); const template$m = {"v":3,"t":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_progress"},"f":[{"t":7,"e":"progress","a":{"max":[{"t":2,"r":"browsersPasswordsCount"}],"value":[{"t":2,"r":"importedCount"}]}}," ",{"t":7,"e":"div","a":{"class":"pam_progress__percentage"},"f":[{"t":7,"e":"span","a":{"class":"pam_progress__spinner spinner -tiny"}}," ",{"t":3,"x":{"r":["nls","importedPercentage"],"s":"_0(\"passwords.list.importProgress\",_1)"}}]}," ",{"t":7,"e":"div","a":{"class":"pam_progress__count"},"f":[{"t":3,"x":{"r":["nls","importedCount","browsersPasswordsCount"],"s":"_0(\"passwords.list.importProgress.2\",_1,_2)"}}]}]}],"n":50,"r":"showProgress"}]}; /** * Password Manager - progress of the browsers passwords importing **/ const ImportProgress = Ractive.extend({ template : template$m, data: () => { return { browsersPasswordsCount: 0, importedCount: 0, importedPercentage: 0, showProgress: false }; }, oninit() { this.importProgressOff = NAPI$1.on('app.pam.onStatusChanged.importProgress', (response) => { console.log('onStatusChanged.importProgress', response); this.set('browsersPasswordsCount', response.browserpasswordscount); this.set('importedCount', response.importedcount); this.set('importedPercentage', Math.floor( (response.importedcount / response.browserpasswordscount) * 100) ); if (response.browserpasswordscount > response.importedcount) { this.set('showProgress', true); this.fire('status', 'importing'); } else { this.set('showProgress', false); this.fire('status', 'finished'); } }); }, onteardown() { if (this.importProgressOff) this.importProgressOff(); } }); const template$n = {"v":3,"t":[{"t":7,"e":"div","a":{"class":"pam_top-menu"},"f":[{"t":4,"f":[{"t":7,"e":"button","a":{"type":"button","class":["a menu-item ",{"t":2,"x":{"r":["subPage"],"s":"_0===\"passwordGuardian\"?\"selected\":\"\""}}],"sid":"setSubPage:passwordGuardian"},"v":{"click":{"n":"setSubPage","a":"passwordGuardian"}},"f":[{"t":7,"e":"div","a":{"class":"menu-label text -strong -light"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian\")"}}," ",{"t":4,"f":[{"t":7,"e":"span","a":{"class":"pam_state_badge badge color-critical -bg -small"},"f":[{"t":7,"e":"div","a":{"class":"exclamation-mark"},"f":["!"]}]}],"n":50,"x":{"r":["globalState"],"s":"_0===\"critical\""}}]}," ",{"t":7,"e":"div","a":{"class":"menu-underline color-brand-lila -bg"}}]}],"n":50,"x":{"r":["isLicensed","isBusinessEdition"],"s":"_0&&!_1"}}," ",{"t":7,"e":"button","a":{"type":"button","class":["a menu-item ",{"t":2,"x":{"r":["subPage"],"s":"_0===\"accounts\"?\"selected\":\"\""}}],"sid":"setSubPage:accounts"},"v":{"click":{"n":"setSubPage","a":"accounts"}},"f":[{"t":7,"e":"div","a":{"class":"menu-label text -strong -light"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.logins\")"}}]}," ",{"t":7,"e":"div","a":{"class":"menu-underline color-brand-lila -bg"}}]}," ",{"t":7,"e":"button","a":{"type":"button","class":["a menu-item ",{"t":2,"x":{"r":["subPage"],"s":"_0===\"creditCards\"?\"selected\":\"\""}}],"sid":"setSubPage:creditCards"},"v":{"click":{"n":"setSubPage","a":"creditCards"}},"f":[{"t":7,"e":"div","a":{"class":"menu-label text -strong -light"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.creditCards\")"}}]}," ",{"t":7,"e":"div","a":{"class":"menu-underline color-brand-lila -bg"}}]}," ",{"t":7,"e":"button","a":{"type":"button","class":["a menu-item ",{"t":2,"x":{"r":["subPage"],"s":"_0===\"secureNotes\"?\"selected\":\"\""}}],"sid":"setSubPage:secureNotes"},"v":{"click":{"n":"setSubPage","a":"secureNotes"}},"f":[{"t":7,"e":"div","a":{"class":"menu-label text -strong -light"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.secureNotes\")"}}]}," ",{"t":7,"e":"div","a":{"class":"menu-underline color-brand-lila -bg"}}]}]}]}; var css_248z$6 = ".pam_top-menu {\n top: 110px;\n left: 27px;\n z-index: 4;\n position: absolute;\n display: flex;\n}\n.pam_top-menu .menu-item {\n margin: 10px 15px 0;\n text-decoration: none;\n}\n.pam_top-menu .menu-item .pam_state_badge {\n margin-top: -6px;\n width: 10px;\n padding-left: 5px;\n}\n.pam_top-menu .menu-item .pam_state_badge .exclamation-mark {\n font-size: 13px;\n}\n.pam_top-menu .menu-item .menu-underline {\n margin-top: 12px;\n height: 8px;\n width: 100%;\n opacity: 0;\n}\n.pam_top-menu .menu-item.selected .menu-label {\n color: #fff;\n}\n.pam_top-menu .menu-item.selected .menu-underline {\n opacity: 1;\n}\n.pam_top-menu .menu-item:hover .menu-label {\n color: #fff;\n}\n"; const TopMenu = Ractive.extend({ css: css_248z$6, template: template$n, data: () => { return { globalState: undefined, isBusinessEdition: (NAPI.ProductModel.isAfbEdition()), isLicensed: undefined, }; }, setGlobalstate(globalState) { this.set('globalState', globalState); } }); const template$o = {"v":3,"t":[{"t":7,"e":"div","a":{"class":"pam_standalone_menu"},"f":[{"t":7,"e":"div","a":{"class":["pam_standalone_menu__item ",{"t":2,"x":{"r":["subPage"],"s":"_0===\"passwordGuardian\"?\"-active\":\"\""}}],"sid":"setSubPage:passwordGuardian"},"v":{"click":{"n":"setSubPage","a":"passwordGuardian"}},"f":[{"t":7,"e":"svg","a":{"xmlns":"http://www.w3.org/2000/svg","width":"20","height":"28","viewBox":"0 0 20 28"},"f":[{"t":7,"e":"path","a":{"fill":"#fff","fill-rule":"evenodd","d":"M8.884.2C.427 3.36 0 9.353 0 9.353v8.429a6.13 6.13 0 0 1 1.811 3.73l.256 2.122L7.5 27.576 6.442 16.682l-3.132-.66a1.458 1.458 0 0 1-1.168-1.419v-2.317l5.77 2.779c.435.21.72.631.748 1.105l.281 4.826c.635.44 1.483.44 2.118 0l.281-4.826c.028-.474.313-.896.748-1.105l5.77-2.78v2.318c0 .684-.486 1.275-1.168 1.419l-3.132.66L12.484 27.7l5.433-3.942.272-2.247A6.13 6.13 0 0 1 20 17.781V9.35s-.427-5.992-8.884-9.15a3.201 3.201 0 0 0-2.232 0z"}}]}," ",{"t":7,"e":"span","f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian\")"}}]}]}," ",{"t":7,"e":"div","a":{"class":["pam_standalone_menu__item ",{"t":2,"x":{"r":["subPage"],"s":"_0===\"accounts\"?\"-active\":\"\""}}],"sid":"setSubPage:accounts"},"v":{"click":{"n":"setSubPage","a":"accounts"}},"f":[{"t":7,"e":"svg","a":{"xmlns":"http://www.w3.org/2000/svg","width":"23","height":"23","viewBox":"0 0 27 25"},"f":[{"t":7,"e":"path","a":{"fill":"#FFF","fill-rule":"evenodd","d":"M25.799 25.795a.7.7 0 0 1-.495.205h-4.178l-.407-.406V22.75h-2.843l-.406-.406v-2.843h-2.844l-.406-.407-1.625-1.624-.265-.263a8.901 8.901 0 0 1-3.394.668C4.004 17.875 0 13.871 0 8.939S4.004.003 8.936.003s8.936 4.004 8.936 8.936a8.911 8.911 0 0 1-.476 2.883l-.26.442 8.861 8.862.003 4.183a.686.686 0 0 1-.201.486zM5.687 3.252a2.438 2.438 0 0 1 0 4.875 2.438 2.438 0 0 1 0-4.875z"}}]}," ",{"t":7,"e":"span","f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.logins\")"}}]}]}," ",{"t":7,"e":"div","a":{"class":["pam_standalone_menu__item ",{"t":2,"x":{"r":["subPage"],"s":"_0===\"creditCards\"?\"-active\":\"\""}}],"sid":"setSubPage:creditCards"},"v":{"click":{"n":"setSubPage","a":"creditCards"}},"f":[{"t":7,"e":"svg","a":{"xmlns":"http://www.w3.org/2000/svg","width":"22","height":"16","viewBox":"0 0 22 16"},"f":[{"t":7,"e":"path","a":{"fill":"#fff","fill-rule":"evenodd","d":"M0 7h22v7.006C22 15.107 21.11 16 20.009 16H1.99C.891 16 0 15.105 0 14.006V7zm0-4V1.994C0 .893.89 0 1.991 0H20.01C21.109 0 22 .895 22 1.994V3H0z"}}]}," ",{"t":7,"e":"span","f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.creditCards\")"}}]}]}," ",{"t":7,"e":"div","a":{"class":["pam_standalone_menu__item ",{"t":2,"x":{"r":["subPage"],"s":"_0===\"secureNotes\"?\"-active\":\"\""}}],"sid":"setSubPage:secureNotes"},"v":{"click":{"n":"setSubPage","a":"secureNotes"}},"f":[{"t":7,"e":"svg","a":{"xmlns":"http://www.w3.org/2000/svg","width":"22","height":"22","viewBox":"0 0 25 25"},"f":[{"t":7,"e":"path","a":{"fill":"#FFF","fill-rule":"evenodd","d":"M.55 25a.548.548 0 0 1-.55-.546V.546C0 .244.246 0 .55 0H4.4a.548.548 0 0 0-.55.546v1.637H3.3v2.182h2.2V2.183h-.55V.546A.548.548 0 0 0 4.4 0h4.4a.548.548 0 0 0-.55.546v1.637H7.7v2.182h2.2V2.183h-.55V.546A.548.548 0 0 0 8.8 0h4.4a.548.548 0 0 0-.55.546v1.637h-.55v2.182h2.2V2.183h-.55V.546A.548.548 0 0 0 13.2 0h4.4a.548.548 0 0 0-.55.546v1.637h-.55v2.182h2.2V2.183h-.55V.546A.548.548 0 0 0 17.6 0h3.85c.304 0 .55.244.55.546v23.908a.548.548 0 0 1-.55.546H.55zM3 9v2h14V9H3zm0 4v2h14v-2H3zm0 4v2h10v-2H3z"}}]}," ",{"t":7,"e":"span","f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.secureNotes\")"}}]}]}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_standalone_menu__bottom"},"f":[{"t":7,"e":"div","a":{"class":"pam_standalone_menu__item"},"v":{"click":"lock"},"f":[{"t":7,"e":"SvgIcon","a":{"name":"pam-lock","cssCls":"pam_unlock__icon"}}," ",{"t":7,"e":"span","f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.lock\")"}}]}]}]}],"n":50,"x":{"r":["hasSystemLogin"],"s":"!_0"}}]}]}; var css_248z$7 = ".nui_standalone .pam_standalone_menu {\n padding-top: 10px;\n position: absolute;\n top: 42px;\n left: 0;\n bottom: 0;\n width: 218px;\n}\n.nui_standalone .pam_standalone_menu__bottom {\n position: absolute;\n width: 100%;\n bottom: 10px;\n}\n.nui_standalone .pam_standalone_menu__bottom .pam_standalone_menu__item {\n border: 0;\n}\n.nui_standalone .pam_standalone_menu__bottom .pam_standalone_menu__item .pam_unlock__icon {\n width: 32px;\n height: 28px;\n font-size: 27px;\n}\n.nui_standalone .pam_standalone_menu__item {\n display: flex;\n align-items: center;\n height: 50px;\n color: #fff;\n opacity: 0.5;\n cursor: pointer;\n padding: 0 22px;\n border-left: 7px solid transparent;\n transition: all 0.2s;\n font-size: var(--font-size-small);\n}\n.nui_standalone .pam_standalone_menu__item:hover {\n opacity: 1;\n}\n.nui_standalone .pam_standalone_menu__item.-active {\n opacity: 1;\n border-color: var(--color-highlight);\n}\n.nui_standalone .pam_standalone_menu__item svg {\n margin-right: 19px;\n}\n.nui_standalone .pam_standalone_menu__item i {\n margin-right: 14px;\n}\n[dir=rtl] .nui_standalone .pam_standalone_menu {\n right: 0;\n}\n[dir=rtl] .nui_standalone .pam_standalone_menu .pam_standalone_menu__item {\n border-right: 7px solid transparent;\n border-left: 0;\n}\n[dir=rtl] .nui_standalone .pam_standalone_menu .pam_standalone_menu__item.-active {\n border-color: var(--color-highlight);\n}\n[dir=rtl] .nui_standalone .pam_standalone_menu .pam_standalone_menu__item svg {\n margin-right: 0;\n margin-left: 19px;\n}\n[dir=rtl] .nui_standalone .pam_standalone_menu .pam_standalone_menu__item i {\n margin-right: 0;\n margin-left: 14px;\n}\n"; const StandaloneMenu = Ractive.extend({ template: template$o, css: css_248z$7, data: () => { return { globalState: undefined }; }, oninit() { this._init(); }, _init() { this.on('lock', () => { NAPI.request('app.pam.LockPAMVault') .then((response) => { track.vault.lockedManually(); console.log('LockPAMVault', response); }) .catch((response) => { console.error('LockPAMVault', response); }); }); }, setGlobalstate(globalState) { this.set('globalState', globalState); } }); const template$p = {"v":3,"t":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_password-guardian"},"f":[{"t":4,"f":[{"t":7,"e":"EmptyScreen","a":{"screen":"upgradePasswordGuardian"}}],"n":50,"x":{"r":["loading","isLicensed"],"s":"_0===false&&!_1"}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["loading","isEmptyVault.accounts"],"s":"_0===false&&_1"},"f":[{"t":7,"e":"EmptyScreen","a":{"screen":"passwordGuardian"}}]},{"t":4,"n":50,"x":{"r":["loading","isEmptyVault.accounts"],"s":"!(_0===false&&_1)"},"f":[" ",{"t":4,"f":[{"t":7,"e":"ReusedGroupOverlay","a":{"reusedPassword":[{"t":2,"r":"reusedGroupOverlay.reusedPassword"}]}}],"n":50,"r":"reusedGroupOverlay.show"}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":"center__wrap"},"f":[{"t":7,"e":"div","a":{"class":"center"},"f":[{"t":7,"e":"Loading","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.loading\")"}}]}}]}]}],"n":50,"r":"loading"},{"t":4,"n":51,"f":[{"t":7,"e":"div","a":{"class":"global-state"},"f":[{"t":7,"e":"div","a":{"class":"guardian-icon-cont color-light-grey -bg"},"f":[{"t":7,"e":"Icon","a":{"name":"guardian","cssCls":"guardian guardian-icon"}}," ",{"t":7,"e":"Icon","a":{"name":"guardian-shield","cssCls":["guardian-icon color-",{"t":2,"r":"globalState"}," -text"]}}," ",{"t":4,"f":[{"t":7,"e":"Icon","a":{"name":"guardian-shield-error","cssCls":"guardian-icon"}}],"n":50,"x":{"r":["globalState"],"s":"_0===\"critical\""}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["globalState"],"s":"_0===\"attention\""},"f":[{"t":7,"e":"Icon","a":{"name":"guardian-shield-warning","cssCls":"guardian-icon"}}]},{"t":4,"n":50,"x":{"r":["globalState"],"s":"!(_0===\"attention\")"},"f":[" ",{"t":7,"e":"Icon","a":{"name":"guardian-shield-ok","cssCls":"guardian-icon"}}]}],"x":{"r":["globalState"],"s":"_0===\"critical\""}}]}]}," ",{"t":7,"e":"div","a":{"class":"g-align--center g-margin-bottom--20 color-light-grey -bg"},"f":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"h2"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.globalState.title.critical\")"}}]}," ",{"t":7,"e":"div","f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.globalState.desc.critical\")"}}]}],"n":50,"x":{"r":["globalState"],"s":"_0===\"critical\""}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["globalState"],"s":"_0===\"attention\""},"f":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"h2"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.globalState.title.cannotCheckLeaks\")"}}]}," ",{"t":7,"e":"div","f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.globalState.desc.cannotCheckLeaks\")"}}]}],"n":50,"r":"cannotCheckLeaked"},{"t":4,"n":51,"f":[{"t":7,"e":"div","a":{"class":"h2"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.globalState.title.warning\")"}}]}," ",{"t":7,"e":"div","f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.globalState.desc.warning\")"}}]}],"r":"cannotCheckLeaked"}]},{"t":4,"n":50,"x":{"r":["globalState"],"s":"!(_0===\"attention\")"},"f":[" ",{"t":7,"e":"div","a":{"class":"h2"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.globalState.title.ok\")"}}]}," ",{"t":7,"e":"div","f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.globalState.desc.ok\")"}}]}]}],"x":{"r":["globalState"],"s":"_0===\"critical\""}}]}," ",{"t":7,"e":"div","f":[{"t":8,"r":"leaked_partial"}," ",{"t":8,"r":"duplicateToLeaked_partial"}," ",{"t":8,"r":"reusedGroups_partial"}," ",{"t":8,"r":"weak_partial"}]}],"r":"loading"}]}],"x":{"r":["loading","isLicensed"],"s":"_0===false&&!_1"}}]}],"n":50,"x":{"r":["subPage"],"s":"_0===\"passwordGuardian\""}}," "],"p":{"leaked_partial":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"group color-white -bg","sid":"leaked"},"f":[{"t":7,"e":"div","a":{"class":"group-icon color-critical -text"},"f":[{"t":7,"e":"Icon","a":{"name":"exclamation"}}]}," ",{"t":7,"e":"div","a":{"class":"issue-cont"},"f":[{"t":7,"e":"div","a":{"class":"g-font--bold"},"f":[{"t":3,"x":{"r":["nls","leakedPasswords.length"],"s":"_0(\"passwords.passwordGuardian.leakedAccounts\",_1)"}}]}," ",{"t":7,"e":"div","a":{"class":"g-margin-bottom--15 text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.vulnerablePasswords.desc\")"}}]}," ",{"t":7,"e":"Issues","a":{"issues":[{"t":2,"r":"leakedPasswords"}],"state":"critical"}}]}]}],"n":50,"x":{"r":["leakedPasswords.length"],"s":"_0>0"}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["cannotCheckLeaked"],"s":"_0"},"f":[{"t":7,"e":"div","a":{"class":"group color-white -bg","sid":"leaked"},"f":[{"t":7,"e":"div","a":{"class":"group-icon color-attention -text"},"f":[{"t":7,"e":"Icon","a":{"name":"titlebar-help"}}]}," ",{"t":7,"e":"div","a":{"class":"issue-cont"},"f":[{"t":7,"e":"div","a":{"class":"g-font--bold"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.leakedAccounts.cannotCheckLeaks\")"}}]}," ",{"t":7,"e":"div","a":{"class":"text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.leakedAccounts.cannotCheckLeaks.desc\")"}}]}]}]}]},{"t":4,"n":50,"x":{"r":["cannotCheckLeaked"],"s":"!(_0)"},"f":[" ",{"t":7,"e":"div","a":{"class":"group color-white -bg","sid":"leaked"},"f":[{"t":7,"e":"div","a":{"class":"group-icon color-ok -text"},"f":[{"t":7,"e":"Icon","a":{"name":"tick"}}]}," ",{"t":7,"e":"div","a":{"class":"issue-cont"},"f":[{"t":7,"e":"div","a":{"class":"g-font--bold"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.noLeakedAccounts\")"}}]}," ",{"t":7,"e":"div","a":{"class":"text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.noLeakedAccounts.desc\")"}}]}]}]}]}],"x":{"r":["leakedPasswords.length"],"s":"_0>0"}}],"duplicateToLeaked_partial":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"group color-white -bg","sid":"duplicateToLeaked"},"f":[{"t":7,"e":"div","a":{"class":"group-icon color-critical -text"},"f":[{"t":7,"e":"Icon","a":{"name":"exclamation"}}]}," ",{"t":7,"e":"div","a":{"class":"issue-cont"},"f":[{"t":7,"e":"div","a":{"class":"g-font--bold"},"f":[{"t":3,"x":{"r":["nls","duplicateToLeakedPasswords.length"],"s":"_0(\"passwords.passwordGuardian.duplicateToLeakedPasswords\",_1)"}}]}," ",{"t":7,"e":"div","a":{"class":"g-margin-bottom--15 text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.duplicateToLeakedPasswords.desc\")"}}]}," ",{"t":7,"e":"Issues","a":{"issues":[{"t":2,"r":"duplicateToLeakedPasswords"}],"state":"critical"}}]}]}],"n":50,"x":{"r":["duplicateToLeakedPasswords.length"],"s":"_0>0"}}],"reusedGroups_partial":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"group color-white -bg","sid":"reusedGroups"},"f":[{"t":7,"e":"div","a":{"class":"group-icon color-attention -text"},"f":[{"t":7,"e":"Icon","a":{"name":"exclamation"}}]}," ",{"t":7,"e":"div","a":{"class":"issue-cont"},"f":[{"t":7,"e":"div","a":{"class":"g-font--bold"},"f":[{"t":3,"x":{"r":["nls","reusedPasswords.length"],"s":"_0(\"passwords.passwordGuardian.duplicatePasswords\",_1)"}}]}," ",{"t":7,"e":"div","a":{"class":"g-margin-bottom--15 text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.vulnerablePasswords.desc\")"}}]}," ",{"t":7,"e":"ReusedGroups","a":{"reusedGroups":[{"t":2,"r":"reusedPasswordGroups"}]}}]}]}],"n":50,"x":{"r":["reusedPasswords.length"],"s":"_0>0"}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["reusedPasswords.length","duplicateToLeakedPasswords.length"],"s":"_0===0&&_1===0"},"f":[{"t":7,"e":"div","a":{"class":"group color-white -bg","sid":"reusedGroups"},"f":[{"t":7,"e":"div","a":{"class":"group-icon color-ok -text"},"f":[{"t":7,"e":"Icon","a":{"name":"tick"}}]}," ",{"t":7,"e":"div","a":{"class":"issue-cont"},"f":[{"t":7,"e":"div","a":{"class":"g-font--bold"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.noDuplicatePasswords\")"}}]}," ",{"t":7,"e":"div","a":{"class":"text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.noDuplicatePasswords.desc\")"}}]}]}]}]}],"x":{"r":["reusedPasswords.length"],"s":"_0>0"}}],"weak_partial":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"group color-white -bg","sid":"weak"},"f":[{"t":7,"e":"div","a":{"class":"group-icon color-attention -text"},"f":[{"t":7,"e":"Icon","a":{"name":"exclamation"}}]}," ",{"t":7,"e":"div","a":{"class":"issue-cont"},"f":[{"t":7,"e":"div","a":{"class":"g-font--bold"},"f":[{"t":3,"x":{"r":["nls","weakPasswords.length"],"s":"_0(\"passwords.passwordGuardian.weakPasswords\",_1)"}}]}," ",{"t":7,"e":"div","a":{"class":"g-margin-bottom--15 text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.vulnerablePasswords.desc\")"}}]}," ",{"t":7,"e":"Issues","a":{"issues":[{"t":2,"r":"weakPasswords"}],"state":"attention"}}]}]}],"n":50,"x":{"r":["weakPasswords.length"],"s":"_0>0"}},{"t":4,"n":51,"f":[{"t":7,"e":"div","a":{"class":"group color-white -bg","sid":"weak"},"f":[{"t":7,"e":"div","a":{"class":"group-icon color-ok -text"},"f":[{"t":7,"e":"Icon","a":{"name":"tick"}}]}," ",{"t":7,"e":"div","a":{"class":"issue-cont"},"f":[{"t":7,"e":"div","a":{"class":"g-font--bold"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.noWeakPasswords\")"}}]}," ",{"t":7,"e":"div","a":{"class":"text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.noWeakPasswords.desc\")"}}]}]}]}],"x":{"r":["weakPasswords.length"],"s":"_0>0"}}]}}; var css_248z$8 = ".pam_password-guardian .global-state .guardian-icon-cont {\n height: 62px;\n width: 77px;\n margin: 20px auto 10px;\n position: relative;\n}\n.pam_password-guardian .global-state .guardian-icon-cont .guardian-icon {\n font-size: 62px;\n position: absolute;\n top: 0;\n right: 0;\n}\n.pam_password-guardian .global-state .guardian-icon-cont .guardian-icon.guardian {\n opacity: 0.3;\n}\n.pam_password-guardian .group {\n border-radius: 3px;\n margin: 0 60px 15px;\n padding: 25px 35px 25px 25px;\n display: flex;\n box-shadow: 0 2px 4px 0 rgba(44,49,86,0.2);\n}\n.pam_password-guardian .group .issue-cont {\n width: 100%;\n}\n.pam_password-guardian .group .group-icon {\n width: 32px;\n height: 30px;\n margin-right: 25px;\n border-width: 2px;\n border-style: solid;\n border-radius: 100px;\n}\n.pam_password-guardian .group .group-icon .icon {\n font-size: 15px;\n margin: 5px 5px 5px 6px;\n}\n[dir=rtl] .pam_password-guardian .group {\n padding: 25px 25px 25px 35px;\n}\n[dir=rtl] .pam_password-guardian .group .group-icon {\n margin-left: 25px;\n margin-right: 0;\n}\n"; const template$q = {"v":3,"t":[{"t":4,"f":[{"t":7,"e":"button","a":{"class":"issue"},"v":{"click":{"n":"viewPassword","d":[{"t":2,"r":"itemUID"}]}},"f":[{"t":7,"e":"div","a":{"class":"issue-icon"},"f":[{"t":7,"e":"PasswordIcon","a":{"imgSrc":[{"t":2,"r":"domainIco"}],"serviceName":[{"t":2,"r":"customServiceName"}],"url":[{"t":2,"r":"url"}],"color":[{"t":2,"r":"color"}]}}]}," ",{"t":7,"e":"div","a":{"class":"flex-cont"},"f":[{"t":7,"e":"div","a":{"class":"service-name"},"f":[{"t":2,"x":{"r":["customServiceName","url"],"s":"_0||_1"}}]}," ",{"t":7,"e":"div","a":{"class":"user-name -secondary text"},"f":[{"t":2,"r":"userLoginName"}]}," ",{"t":7,"e":"div","a":{"class":"action"},"f":[{"t":7,"e":"span","a":{"class":[{"t":2,"x":{"r":["state"],"s":"\"color-\"+_0"}}," -text"]},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.details\")"}}]}," ",{"t":7,"e":"Icon","a":{"name":"arrow-more"}}]}]}]}],"n":52,"r":"issues"}]}; var css_248z$9 = ".issue {\n cursor: pointer;\n padding: 13px 0;\n border-bottom-style: solid;\n border-bottom-width: 1px;\n border-color: #f6f6f6;\n margin-top: -1px;\n width: 100%;\n text-align: left;\n text-decoration: none;\n}\n.issue:hover {\n box-shadow: -20px 0 0 0 #f6f6f6, 20px 0 0 0 #f6f6f6;\n background: #f6f6f6;\n}\n.issue:last-child {\n border-color: rgba(246,246,246,0);\n}\n.issue .issue-icon {\n overflow: hidden;\n width: 25px;\n height: 25px;\n float: left;\n margin-right: 18px;\n}\n.issue .issue-icon .pam_icon_image:not(.nomargin) {\n margin-top: -25px;\n}\n.issue .issue-icon .pam_color__circle .pam_color__text {\n font-size: 0.8em;\n}\n.issue .flex-cont {\n display: flex;\n justify-content: space-around;\n margin-top: 3px;\n}\n.issue .flex-cont .service-name {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 15px;\n width: 40%;\n max-width: 220px;\n}\n.issue .flex-cont .user-name {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 14px;\n padding-top: 2px;\n width: 30%;\n}\n.issue .flex-cont .action {\n font-size: 15px;\n width: 30%;\n text-align: right;\n}\n.issue .flex-cont .action .icon {\n font-size: 13px;\n margin-top: -1px;\n}\n[dir=rtl] .issue {\n text-align: right;\n}\n[dir=rtl] .issue .flex-cont .action {\n text-align: left;\n}\n[dir=rtl] .issue .issue-icon {\n margin-right: 0;\n margin-left: 18px;\n float: right;\n}\n"; const Issues = Ractive.extend({ template: template$q, css: css_248z$9, data: function() { return { issues: [], state: '' }; } }); const template$r = {"v":3,"t":[{"t":4,"f":[{"t":7,"e":"button","a":{"class":"reused-group"},"v":{"click":{"n":"viewGroup","d":[{"t":2,"r":"."}]}},"f":[{"t":7,"e":"div","a":{"class":"flex-cont"},"f":[{"t":7,"e":"div","a":{"class":"reused-group-icons"},"f":[{"t":4,"f":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"reused-group-icon"},"f":[{"t":7,"e":"PasswordIcon","a":{"imgSrc":[{"t":2,"r":"domainIco"}],"serviceName":[{"t":2,"r":"customServiceName"}],"url":[{"t":2,"r":"url"}],"color":[{"t":2,"r":"color"}]}}]}],"n":50,"x":{"r":["index"],"s":"_0<3"}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["index","icons.length"],"s":"_0===3&&_1>3"},"f":[{"t":7,"e":"div","a":{"class":[{"t":2,"x":{"r":["icons.length"],"s":"_0>99?\"smaller-font\":\"\""}}," reused-group-icon plus color-white -text"]},"f":[{"t":7,"e":"div","a":{"class":"g-align--center"},"f":["+",{"t":3,"x":{"r":["icons.length","index"],"s":"_0-_1"}}]}]}]}],"x":{"r":["index"],"s":"_0<3"}}],"n":52,"i":"index","r":"icons"}]}," ",{"t":7,"e":"div","a":{"class":"message"},"f":[{"t":3,"x":{"r":["nls","icons.length"],"s":"_0(\"passwords.passwordGuardian.sharedPasswords\",_1)"}}]}," ",{"t":7,"e":"div","a":{"class":"action"},"f":[{"t":7,"e":"span","a":{"class":"color-attention -text"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.details\")"}}]}," ",{"t":7,"e":"Icon","a":{"name":"arrow-more"}}]}]}]}],"n":52,"i":"index","r":"groups"}]}; var css_248z$a = ".reused-group {\n cursor: pointer;\n padding: 13px 0;\n border-bottom-style: solid;\n border-bottom-width: 1px;\n border-color: #f6f6f6;\n margin-top: -1px;\n width: 100%;\n text-align: left;\n text-decoration: none;\n}\n.reused-group:hover {\n box-shadow: -20px 0 0 0 #f6f6f6, 20px 0 0 0 #f6f6f6;\n background: #f6f6f6;\n}\n.reused-group:last-child {\n border-color: rgba(246,246,246,0);\n}\n.reused-group .flex-cont {\n display: flex;\n justify-content: space-around;\n}\n.reused-group .flex-cont .reused-group-icons {\n width: 20%;\n display: flex;\n justify-content: flex-start;\n}\n.reused-group .flex-cont .reused-group-icons .reused-group-icon {\n overflow: hidden;\n width: 29px;\n height: 29px;\n float: left;\n border: 2px solid #fff;\n border-radius: 100px;\n margin-right: -10px;\n}\n.reused-group .flex-cont .reused-group-icons .reused-group-icon .pam_icon_image:not(.nomargin) {\n margin-top: -25px;\n}\n.reused-group .flex-cont .reused-group-icons .reused-group-icon .pam_color__circle .pam_color__text {\n font-size: 0.8em;\n}\n.reused-group .flex-cont .reused-group-icons .reused-group-icon.plus {\n font-size: 13px;\n padding-top: 4px;\n background-color: #babdc5;\n}\n.reused-group .flex-cont .reused-group-icons .reused-group-icon.plus.smaller-font {\n font-size: 10px;\n padding-top: 6px;\n}\n.reused-group .flex-cont .message {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 15px;\n width: 50%;\n margin-top: 4px;\n}\n.reused-group .flex-cont .action {\n font-size: 15px;\n width: 30%;\n text-align: right;\n margin-top: 4px;\n}\n.reused-group .flex-cont .action .icon {\n font-size: 13px;\n margin-top: -1px;\n}\n[dir=rtl] .reused-group {\n text-align: right;\n}\n[dir=rtl] .reused-group .flex-cont .action {\n text-align: left;\n}\n"; const ReusedGroups = Ractive.extend({ template: template$r, css: css_248z$a, data: function() { return { reusedGroups: [], }; }, oninit() { this.observe('reusedGroups', (newValue) => { this._initGroup(newValue); }, { init: true }); }, _initGroup(reusedGroups) { const groups = []; for (const group of reusedGroups) { group.icons = []; for (const item of group) { if (item) { group.icons.push({ domainIco: item.domainIco, customServiceName: item.customServiceName, url: item.url, color: item.color }); } } group.icons = sortAlphabetically(group.icons, 'customServiceName'); groups.push(group); } // Sort by groups with most duplicates groups.sort(function(a, b) { return b.length - a.length; }); this.set('groups', groups); } }); const template$s = {"v":3,"t":[{"t":7,"e":"Overlay","a":{"cssCls":"pam_reused-group-overlay","txt":["{close:'",{"t":3,"x":{"r":["nls"],"s":"_0(\"global.close\")"}},"'}"]},"f":[{"t":7,"e":"div","a":{"class":"keys-icon-cont color-white -bg"},"f":[{"t":7,"e":"Icon","a":{"name":"keys","cssCls":"keys-icon"}}]}," ",{"t":7,"e":"div","a":{"class":"g-align--center g-margin-bottom--15 color-white -bg"},"f":[{"t":7,"e":"div","f":[{"t":3,"x":{"r":["nls","reusedGroup.length"],"s":"_0(\"passwords.passwordGuardian.sharedPasswords.revealPassword\",_1)"}}]}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":"g-margin-top--10 g-font--24"},"f":[{"t":2,"x":{"r":["showPassword","visiblePassword","maskedPassword"],"s":"_0?_1:_2"}}," ",{"t":7,"e":"ButtonRevealSecret","a":{"cssCls":"g-margin-left--5 -small","isRevealed":[{"t":2,"r":"showPassword"}]}}]}],"n":50,"r":"visiblePassword"}]}," ",{"t":7,"e":"div","a":{"class":"group color-white -bg"},"f":[{"t":7,"e":"div","a":{"class":"issue-cont"},"f":[{"t":7,"e":"div","a":{"class":"g-font--20"},"f":[{"t":3,"x":{"r":["nls","reusedGroup.length"],"s":"_0(\"passwords.passwordGuardian.duplicatePasswords\",_1)"}}]}," ",{"t":7,"e":"div","a":{"class":"g-margin-bottom--15 text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.vulnerablePasswords.desc\")"}}]}," ",{"t":7,"e":"Issues","a":{"issues":[{"t":2,"r":"reusedGroup"}],"state":"attention"}}]}]}]}]}; var css_248z$b = ".pam_reused-group-overlay .overlay__contents {\n background: #fff;\n color: #000;\n}\n.pam_reused-group-overlay .overlay__contents .btn.-secondary {\n border: 0;\n padding-top: 4px;\n color: var(--color-dark);\n}\n.pam_reused-group-overlay .overlay__contents .group {\n border: 0;\n box-shadow: none;\n margin: 0 60px 15px;\n padding: 25px 35px 25px 25px;\n}\n.pam_reused-group-overlay .overlay__contents .keys-icon-cont {\n height: 53px;\n width: 38px;\n margin: 40px auto 10px;\n position: relative;\n}\n.pam_reused-group-overlay .overlay__contents .keys-icon-cont .keys-icon {\n font-size: 53px;\n position: absolute;\n top: 0;\n right: 0;\n opacity: 0.3;\n}\n"; const ReusedGroupOverlay = Ractive.extend({ template: template$s, css: css_248z$b, components: { Issues: Issues, ButtonRevealSecret: ButtonRevealSecret }, data: function() { return { reusedPassword: undefined, visiblePassword: undefined, maskedPassword: undefined, showPassword: false, reusedGroup: [] }; }, oninit() { this.observe('reusedPassword', (newValue, oldValue) => { this._updateReusedGroup(newValue, oldValue); }, { init: true }); }, _updateReusedGroup(password, oldPassword) { const passwordGuardian = this.parent.parent.parent.findComponent('PasswordGuardian'); if (!password) { // UpdatedPassword was not found, // it was probably deleted - get another duplicated password in group let anotherPassword = this._getAnotherReusedPassword(oldPassword); if (anotherPassword) { // Another password was found, update over passwordGuardian passwordGuardian.updateReusedPasswordOverlay(anotherPassword); } password = anotherPassword; anotherPassword = null; } if (!password) { // There are no more passwords duplicated passwords in this group, close overlay this.fire('overlayClose'); } else { const reusedGroup = []; for (const id of password.duplicateWith) { const reusedPassword = passwordGuardian.getVulnerablePasswordById(id, 'reusedPasswords'); if (reusedPassword) { reusedGroup.push(reusedPassword); } } const sortedGroup = sortAlphabetically(reusedGroup, 'customServiceName'); this.set('reusedGroup', sortedGroup); // Get reused password for dislaying its chars this._getReusedPassword(password); } }, _getAnotherReusedPassword(oldPassword) { const passwordGuardian = this.parent.parent.parent.findComponent('PasswordGuardian'); let anotherPassword = undefined; for (const id of oldPassword.duplicateWith) { anotherPassword = passwordGuardian.getVulnerablePasswordById(id, 'reusedPasswords'); if (anotherPassword) { break; } } return anotherPassword; }, _getReusedPassword(password) { NAPI.request('app.pam.GetPAMPasswordDetail', {id: parseInt(password.itemUID), basic:true}) .then(response => { if (response && response.password) { if (PamCrypto$1.dataCryptoEnabled){ response.password = PamCrypto$1.decrypt(response.password); } this.set('visiblePassword', response.password); // We create masked password manually, we cannot use input type="password" // because of problems with input width vs center align. const maskStr = '•'; this.set('maskedPassword', maskStr.repeat(response.password.length)); response = null; password = null; } }) .catch(err => { console.error('GetPAMPasswordDetail error: ', JSON.stringify(err)); }); } }); const template$t = {"v":3,"t":[{"t":7,"e":"div","a":{"class":"pam_empty-screen"},"f":[{"t":7,"e":"div","a":{"class":"empty-screen-icon-cont"},"f":[{"t":7,"e":"ImgIcon","a":{"src":[{"t":2,"rx":{"r":"ICONS","m":[{"t":30,"n":"screen"}]}}],"cssCls":[{"t":2,"r":"screen"}]}}]}," ",{"t":7,"e":"div","a":{"class":"empty-screen-content"},"f":[{"t":4,"f":[{"t":7,"e":"h2","a":{"class":"h2"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian\")"}}]}," ",{"t":7,"e":"p","a":{"class":"p"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.emptyScreen.buy.desc\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","class":"btn","sid":"upgradeNowBtn"},"v":{"click":"upgradeNowBtn"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.emptyScreen.buy.button\")"}}]}],"n":50,"x":{"r":["screen"],"s":"_0===\"upgradePasswordGuardian\""}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["screen"],"s":"_0===\"passwordGuardian\""},"f":[{"t":7,"e":"h2","a":{"class":"h2"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.emptyScreen.title\")"}}]}," ",{"t":7,"e":"p","a":{"class":"p"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.emptyScreen.desc\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","class":"btn","sid":"setSubPage:accounts"},"v":{"click":{"n":"setSubPage","a":"accounts"}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.emptyScreen.openLogins\")"}}]}]},{"t":4,"n":50,"x":{"r":["screen"],"s":"(!(_0===\"passwordGuardian\"))&&(_0===\"accounts\")"},"f":[" ",{"t":7,"e":"h2","a":{"class":"h2"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.logins\")"}}]}," ",{"t":7,"e":"p","a":{"class":"p"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.accounts.emptyScreen.desc\")"}}]}," ",{"t":4,"f":[{"t":7,"e":"button","a":{"type":"button","class":"btn g-margin-right--10","sid":"importBrowserPasswords"},"v":{"click":"importBrowserPasswords"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.accounts.emptyScreen.importLogins\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","class":["btn ",{"t":2,"x":{"r":["showImportButton"],"s":"_0?\"-secondary\":\"\""}}],"sid":"addPassword"},"v":{"click":"addPassword"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.accounts.emptyScreen.addManually\")"}}]}],"n":50,"r":"showImportButton"},{"t":4,"n":51,"f":[{"t":7,"e":"button","a":{"type":"button","class":["btn ",{"t":2,"x":{"r":["showImportButton"],"s":"_0?\"-secondary\":\"\""}}],"sid":"addPassword"},"v":{"click":"addPassword"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.accounts.emptyScreen.addManually\")"}}]}],"r":"showImportButton"}]},{"t":4,"n":50,"x":{"r":["screen"],"s":"(!(_0===\"passwordGuardian\"))&&((!(_0===\"accounts\"))&&(_0===\"creditCards\"))"},"f":[" ",{"t":7,"e":"h2","a":{"class":"h2"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.creditCards\")"}}]}," ",{"t":7,"e":"p","a":{"class":"p"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.creditCards.emptyScreen.desc\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","class":"btn","sid":"addCreditCard"},"v":{"click":"addCreditCard"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.addCreditCard\")"}}]}]},{"t":4,"n":50,"x":{"r":["screen"],"s":"(!(_0===\"passwordGuardian\"))&&((!(_0===\"accounts\"))&&((!(_0===\"creditCards\"))&&(_0===\"secureNotes\")))"},"f":[" ",{"t":7,"e":"h2","a":{"class":"h2"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.secureNotes\")"}}]}," ",{"t":7,"e":"p","a":{"class":"p"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.secureNotes.emptyScreen.desc\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","class":"btn","sid":"addNote"},"v":{"click":"addNote"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.addNote\")"}}]}]}],"x":{"r":["screen"],"s":"_0===\"upgradePasswordGuardian\""}}]}]}]}; var css_248z$c = ".pam_empty-screen {\n margin-top: 70px;\n text-align: center;\n}\n.pam_empty-screen .empty-screen-icon-cont {\n height: 134px;\n}\n.pam_empty-screen .empty-screen-icon-cont .passwordGuardian,\n.pam_empty-screen .empty-screen-icon-cont .upgradePasswordGuardian {\n font-size: 105px;\n}\n.pam_empty-screen .empty-screen-icon-cont .accounts {\n font-size: 96px;\n}\n.pam_empty-screen .empty-screen-icon-cont .secureNotes {\n font-size: 98px;\n}\n.pam_empty-screen .empty-screen-icon-cont .creditCards {\n font-size: 112px;\n}\n.pam_empty-screen .empty-screen-content {\n margin: auto;\n}\n.pam_empty-screen .empty-screen-content .btn {\n margin-top: 40px;\n}\n.pam_empty-screen .empty-screen-content .btn.-secondary {\n border-color: var(--color-dark);\n color: var(--color-dark);\n}\n"; const ICONS = { upgradePasswordGuardian: 'data:image/png;base64,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', secureNotes: 'data:image/png;base64,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', creditCards: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIgAAABwCAYAAADFezgmAAAThElEQVR42u1daWxcVxU2dAvtTOw0aUsLhZSWQtfQuh6PHSedGTtOkzZtSOaN/RY7ThenDUlbmrWkqQ0SixCLWISQAIGK4A8CxCbPJK6C2kogCEWAAKGCBIhNLZQdChIK5zv33lmexzNvZt6bec++V7qKPXm2Z94975zvLN85XV0RX6nU7Nnr77w7nhieXI1/z5w587IuvZb3GthsXJhMWSPJlHNvf9p+PJGyZtWm1x9LZuz7kml7fSo11aPv1jJavSNGdzJlj5EgzEAY+lPWwUTK3pVMO3cmMmaGvr4jkbYtEppHpcDM0DXjgxnrtfruLfE1mJq4Xh18f8p21qedN8zOzr58MbNDJufqRMYxi8KUtqYHRuwbDMM4S9/NJbaSGedmKRhHcfCN/CywCWuWlH2MtUrafGQg4wyS+Vmh7+wSWKwJhBbYB+zRtHnaNn1+X8baSEJ2QAiK9baBlHPb0O3WKn2XI+uhTK3AgQJ4btiy+yK/vJ6BkfGbkhnrAYVTEhnLoL/zan3Ho+at0BOOQxwctvuC+P19I9brgGdKHhB5RcP2tYthG71CtPq32CuhOQAug/5b0E7whPD3JNZ5mHZyy5b95+mTCCv2SDu382Ftsl7frr85OjpxAWmRFAHZQ8LzsR/tz9ijIyPT3fpEQrRwIKQ5jkPldwb7zJ4Nz4kEZK8UlMdJo2QHMpOv0qcTCrfW3MbYI7Pryo6bOtJg5PFMKpzSn3F2D6TMN2qc0jnPpQfagw7jnlBhomHzkkTK3C7fG6K4Dw1krAQF3s7Vp9ZO7YGwOR0APIxwCvDeWCIzkaGQ/mEhKOZR5IUAqvXpBbwQtGJ7nzF3h/299k5Pn5NITdyCAJ7CKcm0tWPDZudSfZJBeS6kwkU8YmptVN4zygsQ7SUtMlWKp9i78JouPfBTOChnwk8h3dyofoa+1NQroUUUTklk7P3QMtA2+oRbxh7WDtzUoZHJ19S7dmVhvD8+Z3yJ9s9ic8bv43njK7GC8cAlhYkLwvBZULgk6lWsI1KrHAFuwev6pJsCfuYart3IWBP1ro0Xcu8iwXghPpd9dGXeSKw8OZaMzeU+HJvLnqHXX4zns+9Z/aQRingFPBx4OiT8D8qSg+PsCZFHpE+9ERcy7exkz2V0/PLamiNrk8b4zaqTRoWWIcH4QixvfCR+0hiCZiFheYkE6LOrCmPXh+HzIWaC2AliKMXqN4qtIMaicUqdhTyIqPyynVrXXXTKiAnNYXwnVshtVK+vmjdvJIH455p8yXvofnLsShaYvPF30iiHZ8+EJ6i1ftP4ZYjKqlJJ+votiNpqnLIYOKVUO25UvTB2vGAcpcP+Nu130sH/ifZpMjEW44987oPVfqYnP7aONMkv6Lp9oXOTqXwSeR4ugmKNYh9GHiiVMmJaKpRp4egk3xyr1nVrnrk7ToLxx+58bgTfX3Z6+vxYIbsXhw/tcfH84jYd2oZ+9s/dT4ezMAgZY2SOEZktFl1TsHBwdOJi7bmIAuRZqN1a15EQPAYA6sYU9NpX4/nc+9T3a09NrYjNG9cu0D757E978rl0mO8FcApqUZBiKOZ9yOwOZsauXJbCgZiBzGmM17oO2kJ6J1+EtqBdWDmX27xyfqyPzMs/Yk8ZxUozev1BArH/w7XxwvhgmYA8BXMUGc1K1W3S9MqCa3svquCQZV4+5oUEgz0XEpSansuJ3FYShJ/wQZ8y1xDeOE4A9A+0/w2XtkJ75I3f0v/fT3jlvTArwCwkNCYEiwTkqui5/1M9qKorVfNbB4nCsXEb1dcuaeGASZEh6bF61xLWmCEN8smFuII8lPnJ1ZXaI/tsudfDr+WzvyPB+VG040RTK1CJT67xWxVOQaU+4kdL03MhUMpPhIeAEWGM+0gTfM2FSQrwZiq1BwvCydjJsWvU69f92DiXXvsVXW8shfsGnAJ+EJiDpXgK3cvRiSuWjHDAnRV5CsvToeHAoS2650X6H9iCNMpfyWQUKRD09UMkBD8gofkUm5454xvdJ8aH4ekQJvnhUgxGISVRzjIkjXI/lWmuizwxTFaRzzRCY0Ccg1za7/bMja8lQZhfmc++w609SCjuxPdweUlg3k7fPw/AGpsb29GRB8EwXoEwOyryUesa2N8BTzljbwHPR3o+B6hGZQh/P3qeC4XSBSp3djbyc1c9t/88EpAPQJPwoZeZEdYeeeN7CwNruYP0+vc7oT3gbSiqJyii4A0jUhpksg4CAcGgGMojUqMco/ewFVny6GgPSsZBezQLrti8cOQUZiT7GWR1WXsUctsqPB9O4Bn/Kg/JtxVjESZAsKvitWFzANoT9bZBuqswMYTtbqSk4J5IEdhhMxmBU1q/1d8Vnx+7mjTHx2Rc5CXae7oLRi/iI4Q7PsSvE/7o2GdFZRxVxal6Va4+Iw8E5gCgEg8IAmBBk7RQeBUZAjsKgThB5aPKA1AlL+cIEnicn5kzfk7/PtGdH7u505934+juy5kqsfmeC+GiIu+C8kQk5jhqSocFfJJIOdthBoMUFCawM8+oRGCX/VNWhEQ4xtcKdWdu71qGKzHsbIAWofiFjeJmNgFUbQbBwevQKIiW9qXt4SDZfCCw472IviqCwA7B7bigQN1Ceyx3Jj3KD4X2sPeiOh5mlzEDgXaYAw4BSPc/yPQ/MFBfynpTkcBOmeRB+r4zngvRFwT2qARty3VBIAZGJm9CDAPAkethqHhICQUOTYUDYJ6AVYIyPzBt/cOTNyrPp3/Y2dR2r4+elruhPXS/sCoqH+AVKj9t3YUEXX/a3InUP/BLX9rMcSUaxVKEOaLgc0DeD0wPzkkwB+3Rtt0AUCelT36HFoca94lqPwBYVWof4QBVDwKzhEIiStpdFaT3IWI3QkhQHtkmcIouhNZxzY73vrilJ3kc6tAQQneDSOSwIFB+k8kBoIFHEI0NvLSASc8MgMSHXWyJQhnzEk2GroLfCDjCBLm1Mp705MjENYjQwkP01+MyB2TMpDdg7GFNcwOYOpxVFMIoMnQyPdGvm7ZUgki3WUGgzV2OCCwDHONHtBTBPVl/Ehx5nvMP8FwoiVTvWuQQECwqsebto0DTKOrVIlL1wdtKAPa6CuGgUDoEBNlcYZqmelpJECL6ivMIzNWmA98D7dFIcgrXIlCUkGw0JnETqq9Xr7oM3eRz8QD1D1vpYvCNQC28HsVKxPfI+QDcNmdmnA1eaoWbWsWciwftsdgN4BA081pV0xaTm7ZokpHbCRhfi3wOd4Pk4JsRg5nBAyr4Rs4evo5MdyOtvNi15gY+AST4FEO/1baVEAaYqgrWPFEYITy6aUtVrb1dYBRi7FHwCw8Y6n0Rxsc95OAcJUq9OAOIxQQmINwhkKS5ts89tQLeDZCyFzvHbDQEkSQbDaToATJHmgztCnjRvcQDpJKBArOYO1VJIkL6Xso8RWdqa9Z3EheebIEfzJ21bdzkatVykv1usqde3oxMdG1SbDQAqYGM/eZ6lfHLbXHQi0yPpLWyNwLQCpqnF+0L7YNYiP8STJ6HzBJurv8hpnpwXbGknw6bXTUPjDJ8SLarko0mo7W6aUuV+8SlBuzhkHvswWQIDOMx5M5paJSxUWIJUVFgAByKeyv7x+nkBkPriHvIaquHS6CUQs0eOhxClSJgpELEcu/zarr0qqI9JOOgZtUfQrjl4JBtPxWZcOU0IWP3VplaHJgonm28SxB+Fv49BLHs7+4FuPIS9lVstOKAoQZMl16lc6/JOIB6lrEIIRTkkeBJbiRJJOpO7WOtxPIXlPSnzUMD6YlbvQR/WjFdyz4IV4txIJ/gnKz8urdZNxXYQMRBnJbL/lBgVFHST4fuNcK6mOlCVjTST3hmIgN8AG3rZ3a3xDhYxMGQNZMIdWdbefqlJ3MEeMUvHAC3GDWU0GiNlse1arrCspRmr9z2/X7xdGU36eqMgyFZ9YUWSX5IJfNI21BFhvgImyKPjLJWTFdHgSPFMRYKRzF4uEOZ1mbjQspzQcigKu5QuRO/EmRcyibnsDSbD/AkiBR+Lw04tA8gh+CFUeY2XWJSprnNr6FF/n9OMTen+raPiSCY1Ssx112NRpprMg6YOxFAqZkoY7OmFZMuqKd0QUk//sX3HugVRdPFHlp4ydAIDi4qICTkwnt01pVMqLXVu3BM1WYcKOkMojUjZx5lHxD2Kjw+4c0KpCjplzPpeNSYY3opqBGFxPYNSqDDRoaW7TJmqgkINIZwDkSPe+WBen3fgBU1GQeg6KGqOcgPyMEsFfUMeJggbgxXYnHMpngTPTPKFrDRGjBdQS7kWIodnEtDpKfgrXFDvJR5tPz/vGhsT4wDkGgQiQz6A+JwBisPbgZudb3eqC0hf7oBqJcoqWPvjLJqpqvTZGg5KqWXs63SDHLik8ISlVrF9kQ7RZ4GQleTcYCD8tLpx8815Dq4oIcJ8kw6LqBRM+mshxoxXRXjVENEhuZUfpHNXwKtXgp9EA/ylBbhPmH0JHfwA7ZtmCDULswFtEi7TVdwANa+llP6FMeA6fbqiXpmHHRSQMoPrtowwbCSrYZaMF2h8Iok48CTtxMGASlplGgNE3SbLgBwxFfCzkH2yjgInYC4baRsOKOAF3NBwsifcWtAxnVpJwcKZdjeayOMg4YFBI3h4nnj/egmiOa0FXvO+GY8n/sEfb07dcq/HAeysFEZJujWgAqAIxcUFsFumHHgRUB6T0+fg5ZP6JeOhnIkIHnaJ9C9uLgxqqOQnRHdBo3T3QXjCn9vvhEDk6w0TNAO9TDBBRoQWWXKLneSGMZsPI8Vfw0JCLoKolGcapqPDsexfPajVQ+StEe8kPs4aZRvGWf8R/dimOD4gmGCYeXPQAMye19pQESU6YDaDcCRHxP9QFCr00ARVT0BQZsnEo7/lncWrCUgWGhgK8aFBdfAtjRMkGpRyyKLsLFhrEvFoaDCragBJQBHJVy73GHVA6RBm1RbQMhUbMK0hPLX6PDfXUtAsLi3KeGVdnx4VLUjVV0+TDCs/Bm3BmwHAOfsOnAReVkNJ03rCQg6CMbmjP9geKDaPGWhTEAIf+wv/3++Zi77N4wHaytCl8MEExEYJqg0YKJMAyoCu9+CjfbdUsOONIFq6wsIHfTT5MHcojYAa7mAYMCgbH9duoYnLhhf7sTNV8MEFX1TaBZne1j5M24NKAjsxP/xAYBzKQC0FWmP3maqzzwJSN74ei0TwwKSN55wYZd9nRKQ8qc0SsMEoenAGEz6SGAXTXVhdicyTfrFXkxM9lkyI+Nqi27HbgHJPuW65tOdFpCKm8/0TadI3wwzf6Yagb0ZAM7aAyw58pyaLlfwaGJepP2M2hhNWsXEPF9+DebJhUlAik8U0zedTVEYJljSgGZJA5YAeN0Qgqoya6nss76bm50kgXiywsS43NxqJoaE5BBd8/mukC5R7VYaJgj7H+Zhgm4CO4JudT7fWYIJaR5tKYlYT0B4tChFUMtVmxcBodjJ59Amuyvka/FhgrtCOUwQ6XxoEDTirXUdaB1cqZ42b23pD9YTEI6M5o3nypvj1xMQTJ7E6I6wTL72bH5c9M2oDhPk7s1wmQnsthza9xJqj5/IrUfsg8zNw5yXqSEgnNCby/4SeZmuiC43fVPwZ8zQ82eKgi4pEO4OiYEJiAiGjfdj+qQc+fUCJk8i34JNX/8aZkhs4y8UA7mnawksN30zCsMEoT14+CGBb18Sg43Wg2AsGMZ/Ic9SsfO5ncArfqb6w4RTeJhgGX0zrMMExYgRVKo3Xlbpi4As9xXmYYLcmRkksLRzyLdwvRaQJgXF3XkgBPwZ1Z0Q3GjffqkWkJYBrYu+6Z366av7yw11MfHSOuhrdFgLiH/g0EXfbCt/RrWuxL++/mItIAEARbRTaOMwQdFW1DwEDeJ7bkkLSHCrXcMEFXEbnpb/H0ILSPDgEQMLyjsP+MifkdVp1Zu/aAGJHk4RGdYSgR0us2rC38jiTK/s5ISwemDV8lpAOmR+MJ3bRWD3yp/ZsNm5VBVroxSgXuJOC0ik3WQisFfQN4mdR7gFdSAoPUCdCkwRB+gIv1Q0DaZ8UeABOi0g4VjFzgNqlu3i+wiI7Rjz3h5V50FAgMZ5bKfeDe96FfVoKeHGD7jfaLaDviQAs4L366yDFml7iWQ9AYG9qyPRetfc9rFaZgCZ13Z0eApMQDgBBBeNx2Dp3eiu13EaAkJa4r7ICoheAd9/LSB6aQHRa3kLCFA20Hgju1qTeYC1Rn8P9lKeyh15AZH9LY43g+Dd470rOxl738kmBhRpAfFRQNBPq5b24AmVopeF543kkZuExN2CG/w9/LuIerB0BYQyvBRmD/EbtA8jnq/RQGcWh9ipADq8b5BCuyjr10fV/sXhde44aG4LsYkRQ3Q72YN8uS6ekI1ajjCbUNV1N8jBP3otal6Q7p8JNWOPi1hkDwm/5p/pVX8VBxgTCI+AqpMd8KgKW0+uDn5xkTE/lNbxsLftLi64pWwPU85tWkiCWxw2kNVgIDpFSKpnzy52sqGS/agw2SNlVjjoKNp0e+6VHjYhSUhNwpTCjJkJ6yTIqCykCVDog27Lkicz4ys1siPmRowb3VfWcecAj70Cox2EIL3rbuGhmHuSpZ6tKB7aFdaW4U1JPma+YegMcgUYfcUzRghY6V1/84w7oiOgWgwtuFGZF0U5+D9+/qFmAxNoRAAAAABJRU5ErkJggg==', passwordGuardian: 'data:image/png;base64,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', accounts: 'data:image/png;base64,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' }; const EmptyScreen = Ractive.extend({ template: template$t, css: css_248z$c, data: function() { return { ICONS: ICONS, screen: '', showImportButton: false }; }, oninit() { const screen = this.get('screen'); if (screen === 'accounts') { this._getBrowsersPasswordsCount().then(count => this.set('showImportButton', count > 0)); this.on('importBrowserPasswords', () => { location.hash = '#PrivacyPasswords/settings/importExport'; }); } if (screen === 'upgradePasswordGuardian') { this.on('upgradeNowBtn', () => { NAPI.openIpmWindow(274); }); } }, _getBrowsersPasswordsCount() { return NAPI.request('app.pam.GetBrowserPasswordCount') .then(response => response.browserPasswordCount) .catch(response => { console.error('GetBrowserPasswordCount', response); return 0; }); } }); var lodash_filter = createCommonjsModule(function (module, exports) { /** * lodash (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors <https://jquery.org/> * Released under MIT license <https://lodash.com/license> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** Used to compose bitmasks for comparison styles. */ var UNORDERED_COMPARE_FLAG = 1, PARTIAL_COMPARE_FLAG = 2; /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', boolTag = '[object Boolean]', dateTag = '[object Date]', errorTag = '[object Error]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', mapTag = '[object Map]', numberTag = '[object Number]', objectTag = '[object Object]', promiseTag = '[object Promise]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', symbolTag = '[object Symbol]', weakMapTag = '[object WeakMap]'; var arrayBufferTag = '[object ArrayBuffer]', dataViewTag = '[object DataView]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', int16Tag = '[object Int16Array]', int32Tag = '[object Int32Array]', uint8Tag = '[object Uint8Array]', uint8ClampedTag = '[object Uint8ClampedArray]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, reLeadingDot = /^\./, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; /** * Used to match `RegExp` * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; /** Detect free variable `global` from Node.js. */ var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; /** Detect free variable `self`. */ var freeSelf = typeof self == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); /** Detect free variable `exports`. */ var freeExports = exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Detect free variable `process` from Node.js. */ var freeProcess = moduleExports && freeGlobal.process; /** Used to access faster Node.js helpers. */ var nodeUtil = (function() { try { return freeProcess && freeProcess.binding('util'); } catch (e) {} }()); /* Node.js helper references. */ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; /** * A specialized version of `_.filter` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { var index = -1, length = array ? array.length : 0, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result[resIndex++] = value; } } return result; } /** * A specialized version of `_.some` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. */ function arraySome(array, predicate) { var index = -1, length = array ? array.length : 0; while (++index < length) { if (predicate(array[index], index, array)) { return true; } } return false; } /** * The base implementation of `_.property` without support for deep paths. * * @private * @param {string} key The key of the property to get. * @returns {Function} Returns the new accessor function. */ function baseProperty(key) { return function(object) { return object == null ? undefined : object[key]; }; } /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. * * @private * @param {number} n The number of times to invoke `iteratee`. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the array of results. */ function baseTimes(n, iteratee) { var index = -1, result = Array(n); while (++index < n) { result[index] = iteratee(index); } return result; } /** * The base implementation of `_.unary` without support for storing metadata. * * @private * @param {Function} func The function to cap arguments for. * @returns {Function} Returns the new capped function. */ function baseUnary(func) { return function(value) { return func(value); }; } /** * Gets the value at `key` of `object`. * * @private * @param {Object} [object] The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function getValue(object, key) { return object == null ? undefined : object[key]; } /** * Checks if `value` is a host object in IE < 9. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a host object, else `false`. */ function isHostObject(value) { // Many host objects are `Object` objects that can coerce to strings // despite having improperly defined `toString` methods. var result = false; if (value != null && typeof value.toString != 'function') { try { result = !!(value + ''); } catch (e) {} } return result; } /** * Converts `map` to its key-value pairs. * * @private * @param {Object} map The map to convert. * @returns {Array} Returns the key-value pairs. */ function mapToArray(map) { var index = -1, result = Array(map.size); map.forEach(function(value, key) { result[++index] = [key, value]; }); return result; } /** * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. * @param {Function} transform The argument transform. * @returns {Function} Returns the new function. */ function overArg(func, transform) { return function(arg) { return func(transform(arg)); }; } /** * Converts `set` to an array of its values. * * @private * @param {Object} set The set to convert. * @returns {Array} Returns the values. */ function setToArray(set) { var index = -1, result = Array(set.size); set.forEach(function(value) { result[++index] = value; }); return result; } /** Used for built-in method references. */ var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ var coreJsData = root['__core-js_shared__']; /** Used to detect methods masquerading as native. */ var maskSrcKey = (function() { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); return uid ? ('Symbol(src)_1.' + uid) : ''; }()); /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ var Symbol = root.Symbol, Uint8Array = root.Uint8Array, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeKeys = overArg(Object.keys, Object); /* Built-in method references that are verified to be native. */ var DataView = getNative(root, 'DataView'), Map = getNative(root, 'Map'), Promise = getNative(root, 'Promise'), Set = getNative(root, 'Set'), WeakMap = getNative(root, 'WeakMap'), nativeCreate = getNative(Object, 'create'); /** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap); /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined; /** * Creates a hash object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Hash(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the hash. * * @private * @name clear * @memberOf Hash */ function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; } /** * Removes `key` and its value from the hash. * * @private * @name delete * @memberOf Hash * @param {Object} hash The hash to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(key) { return this.has(key) && delete this.__data__[key]; } /** * Gets the hash value for `key`. * * @private * @name get * @memberOf Hash * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function hashGet(key) { var data = this.__data__; if (nativeCreate) { var result = data[key]; return result === HASH_UNDEFINED ? undefined : result; } return hasOwnProperty.call(data, key) ? data[key] : undefined; } /** * Checks if a hash value for `key` exists. * * @private * @name has * @memberOf Hash * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function hashHas(key) { var data = this.__data__; return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); } /** * Sets the hash `key` to `value`. * * @private * @name set * @memberOf Hash * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the hash instance. */ function hashSet(key, value) { var data = this.__data__; data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; return this; } // Add methods to `Hash`. Hash.prototype.clear = hashClear; Hash.prototype['delete'] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; /** * Creates an list cache object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function ListCache(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the list cache. * * @private * @name clear * @memberOf ListCache */ function listCacheClear() { this.__data__ = []; } /** * Removes `key` and its value from the list cache. * * @private * @name delete * @memberOf ListCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function listCacheDelete(key) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { return false; } var lastIndex = data.length - 1; if (index == lastIndex) { data.pop(); } else { splice.call(data, index, 1); } return true; } /** * Gets the list cache value for `key`. * * @private * @name get * @memberOf ListCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function listCacheGet(key) { var data = this.__data__, index = assocIndexOf(data, key); return index < 0 ? undefined : data[index][1]; } /** * Checks if a list cache value for `key` exists. * * @private * @name has * @memberOf ListCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function listCacheHas(key) { return assocIndexOf(this.__data__, key) > -1; } /** * Sets the list cache `key` to `value`. * * @private * @name set * @memberOf ListCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the list cache instance. */ function listCacheSet(key, value) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { data.push([key, value]); } else { data[index][1] = value; } return this; } // Add methods to `ListCache`. ListCache.prototype.clear = listCacheClear; ListCache.prototype['delete'] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; /** * Creates a map cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function MapCache(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the map. * * @private * @name clear * @memberOf MapCache */ function mapCacheClear() { this.__data__ = { 'hash': new Hash, 'map': new (Map || ListCache), 'string': new Hash }; } /** * Removes `key` and its value from the map. * * @private * @name delete * @memberOf MapCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function mapCacheDelete(key) { return getMapData(this, key)['delete'](key); } /** * Gets the map value for `key`. * * @private * @name get * @memberOf MapCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function mapCacheGet(key) { return getMapData(this, key).get(key); } /** * Checks if a map value for `key` exists. * * @private * @name has * @memberOf MapCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function mapCacheHas(key) { return getMapData(this, key).has(key); } /** * Sets the map `key` to `value`. * * @private * @name set * @memberOf MapCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the map cache instance. */ function mapCacheSet(key, value) { getMapData(this, key).set(key, value); return this; } // Add methods to `MapCache`. MapCache.prototype.clear = mapCacheClear; MapCache.prototype['delete'] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; /** * * Creates an array cache object to store unique values. * * @private * @constructor * @param {Array} [values] The values to cache. */ function SetCache(values) { var index = -1, length = values ? values.length : 0; this.__data__ = new MapCache; while (++index < length) { this.add(values[index]); } } /** * Adds `value` to the array cache. * * @private * @name add * @memberOf SetCache * @alias push * @param {*} value The value to cache. * @returns {Object} Returns the cache instance. */ function setCacheAdd(value) { this.__data__.set(value, HASH_UNDEFINED); return this; } /** * Checks if `value` is in the array cache. * * @private * @name has * @memberOf SetCache * @param {*} value The value to search for. * @returns {number} Returns `true` if `value` is found, else `false`. */ function setCacheHas(value) { return this.__data__.has(value); } // Add methods to `SetCache`. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; SetCache.prototype.has = setCacheHas; /** * Creates a stack cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Stack(entries) { this.__data__ = new ListCache(entries); } /** * Removes all key-value entries from the stack. * * @private * @name clear * @memberOf Stack */ function stackClear() { this.__data__ = new ListCache; } /** * Removes `key` and its value from the stack. * * @private * @name delete * @memberOf Stack * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function stackDelete(key) { return this.__data__['delete'](key); } /** * Gets the stack value for `key`. * * @private * @name get * @memberOf Stack * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function stackGet(key) { return this.__data__.get(key); } /** * Checks if a stack value for `key` exists. * * @private * @name has * @memberOf Stack * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function stackHas(key) { return this.__data__.has(key); } /** * Sets the stack `key` to `value`. * * @private * @name set * @memberOf Stack * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the stack cache instance. */ function stackSet(key, value) { var cache = this.__data__; if (cache instanceof ListCache) { var pairs = cache.__data__; if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { pairs.push([key, value]); return this; } cache = this.__data__ = new MapCache(pairs); } cache.set(key, value); return this; } // Add methods to `Stack`. Stack.prototype.clear = stackClear; Stack.prototype['delete'] = stackDelete; Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; /** * Creates an array of the enumerable property names of the array-like `value`. * * @private * @param {*} value The value to query. * @param {boolean} inherited Specify returning inherited property names. * @returns {Array} Returns the array of property names. */ function arrayLikeKeys(value, inherited) { // Safari 8.1 makes `arguments.callee` enumerable in strict mode. // Safari 9 makes `arguments.length` enumerable in strict mode. var result = (isArray(value) || isArguments(value)) ? baseTimes(value.length, String) : []; var length = result.length, skipIndexes = !!length; for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == 'length' || isIndex(key, length)))) { result.push(key); } } return result; } /** * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; } } return -1; } /** * The base implementation of `_.forEach` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array|Object} Returns `collection`. */ var baseEach = createBaseEach(baseForOwn); /** * The base implementation of `_.filter` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function baseFilter(collection, predicate) { var result = []; baseEach(collection, function(value, index, collection) { if (predicate(value, index, collection)) { result.push(value); } }); return result; } /** * The base implementation of `baseForOwn` which iterates over `object` * properties returned by `keysFunc` and invokes `iteratee` for each property. * Iteratee functions may exit iteration early by explicitly returning `false`. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ var baseFor = createBaseFor(); /** * The base implementation of `_.forOwn` without support for iteratee shorthands. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns `object`. */ function baseForOwn(object, iteratee) { return object && baseFor(object, iteratee, keys); } /** * The base implementation of `_.get` without support for default values. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @returns {*} Returns the resolved value. */ function baseGet(object, path) { path = isKey(path, object) ? [path] : castPath(path); var index = 0, length = path.length; while (object != null && index < length) { object = object[toKey(path[index++])]; } return (index && index == length) ? object : undefined; } /** * The base implementation of `getTag`. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { return objectToString.call(value); } /** * The base implementation of `_.hasIn` without support for deep paths. * * @private * @param {Object} [object] The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ function baseHasIn(object, key) { return object != null && key in Object(object); } /** * The base implementation of `_.isEqual` which supports partial comparisons * and tracks traversed objects. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {Function} [customizer] The function to customize comparisons. * @param {boolean} [bitmask] The bitmask of comparison flags. * The bitmask may be composed of the following flags: * 1 - Unordered comparison * 2 - Partial comparison * @param {Object} [stack] Tracks traversed `value` and `other` objects. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(value, other, customizer, bitmask, stack) { if (value === other) { return true; } if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { return value !== value && other !== other; } return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack); } /** * A specialized version of `baseIsEqual` for arrays and objects which performs * deep comparisons and tracks traversed objects enabling objects with circular * references to be compared. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} [customizer] The function to customize comparisons. * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` * for more details. * @param {Object} [stack] Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { var objIsArr = isArray(object), othIsArr = isArray(other), objTag = arrayTag, othTag = arrayTag; if (!objIsArr) { objTag = getTag(object); objTag = objTag == argsTag ? objectTag : objTag; } if (!othIsArr) { othTag = getTag(other); othTag = othTag == argsTag ? objectTag : othTag; } var objIsObj = objTag == objectTag && !isHostObject(object), othIsObj = othTag == objectTag && !isHostObject(other), isSameTag = objTag == othTag; if (isSameTag && !objIsObj) { stack || (stack = new Stack); return (objIsArr || isTypedArray(object)) ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack); } if (!(bitmask & PARTIAL_COMPARE_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; stack || (stack = new Stack); return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack); } } if (!isSameTag) { return false; } stack || (stack = new Stack); return equalObjects(object, other, equalFunc, customizer, bitmask, stack); } /** * The base implementation of `_.isMatch` without support for iteratee shorthands. * * @private * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @param {Array} matchData The property names, values, and compare flags to match. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if `object` is a match, else `false`. */ function baseIsMatch(object, source, matchData, customizer) { var index = matchData.length, length = index, noCustomizer = !customizer; if (object == null) { return !length; } object = Object(object); while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) ? data[1] !== object[data[0]] : !(data[0] in object) ) { return false; } } while (++index < length) { data = matchData[index]; var key = data[0], objValue = object[key], srcValue = data[1]; if (noCustomizer && data[2]) { if (objValue === undefined && !(key in object)) { return false; } } else { var stack = new Stack; if (customizer) { var result = customizer(objValue, srcValue, key, object, source, stack); } if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result )) { return false; } } } return true; } /** * The base implementation of `_.isNative` without bad shim checks. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, * else `false`. */ function baseIsNative(value) { if (!isObject(value) || isMasked(value)) { return false; } var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } /** * The base implementation of `_.isTypedArray` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. */ function baseIsTypedArray(value) { return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; } /** * The base implementation of `_.iteratee`. * * @private * @param {*} [value=_.identity] The value to convert to an iteratee. * @returns {Function} Returns the iteratee. */ function baseIteratee(value) { // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. if (typeof value == 'function') { return value; } if (value == null) { return identity; } if (typeof value == 'object') { return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); } return property(value); } /** * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeys(object) { if (!isPrototype(object)) { return nativeKeys(object); } var result = []; for (var key in Object(object)) { if (hasOwnProperty.call(object, key) && key != 'constructor') { result.push(key); } } return result; } /** * The base implementation of `_.matches` which doesn't clone `source`. * * @private * @param {Object} source The object of property values to match. * @returns {Function} Returns the new spec function. */ function baseMatches(source) { var matchData = getMatchData(source); if (matchData.length == 1 && matchData[0][2]) { return matchesStrictComparable(matchData[0][0], matchData[0][1]); } return function(object) { return object === source || baseIsMatch(object, source, matchData); }; } /** * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. * * @private * @param {string} path The path of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new spec function. */ function baseMatchesProperty(path, srcValue) { if (isKey(path) && isStrictComparable(srcValue)) { return matchesStrictComparable(toKey(path), srcValue); } return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) ? hasIn(object, path) : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); }; } /** * A specialized version of `baseProperty` which supports deep paths. * * @private * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new accessor function. */ function basePropertyDeep(path) { return function(object) { return baseGet(object, path); }; } /** * The base implementation of `_.toString` which doesn't convert nullish * values to empty strings. * * @private * @param {*} value The value to process. * @returns {string} Returns the string. */ function baseToString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value; } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /** * Casts `value` to a path array if it's not one. * * @private * @param {*} value The value to inspect. * @returns {Array} Returns the cast property path array. */ function castPath(value) { return isArray(value) ? value : stringToPath(value); } /** * Creates a `baseEach` or `baseEachRight` function. * * @private * @param {Function} eachFunc The function to iterate over a collection. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new base function. */ function createBaseEach(eachFunc, fromRight) { return function(collection, iteratee) { if (collection == null) { return collection; } if (!isArrayLike(collection)) { return eachFunc(collection, iteratee); } var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection); while ((fromRight ? index-- : ++index < length)) { if (iteratee(iterable[index], index, iterable) === false) { break; } } return collection; }; } /** * Creates a base function for methods like `_.forIn` and `_.forOwn`. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new base function. */ function createBaseFor(fromRight) { return function(object, iteratee, keysFunc) { var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length; while (length--) { var key = props[fromRight ? length : ++index]; if (iteratee(iterable[key], key, iterable) === false) { break; } } return object; }; } /** * A specialized version of `baseIsEqualDeep` for arrays with support for * partial deep comparisons. * * @private * @param {Array} array The array to compare. * @param {Array} other The other array to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} customizer The function to customize comparisons. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` * for more details. * @param {Object} stack Tracks traversed `array` and `other` objects. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { var isPartial = bitmask & PARTIAL_COMPARE_FLAG, arrLength = array.length, othLength = other.length; if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } // Assume cyclic values are equal. var stacked = stack.get(array); if (stacked && stack.get(other)) { return stacked == other; } var index = -1, result = true, seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined; stack.set(array, other); stack.set(other, array); // Ignore non-index properties. while (++index < arrLength) { var arrValue = array[index], othValue = other[index]; if (customizer) { var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { continue; } result = false; break; } // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function(othValue, othIndex) { if (!seen.has(othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { return seen.add(othIndex); } })) { result = false; break; } } else if (!( arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack) )) { result = false; break; } } stack['delete'](array); stack['delete'](other); return result; } /** * A specialized version of `baseIsEqualDeep` for comparing objects of * the same `toStringTag`. * * **Note:** This function only supports comparing values with tags of * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {string} tag The `toStringTag` of the objects to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} customizer The function to customize comparisons. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` * for more details. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) { switch (tag) { case dataViewTag: if ((object.byteLength != other.byteLength) || (object.byteOffset != other.byteOffset)) { return false; } object = object.buffer; other = other.buffer; case arrayBufferTag: if ((object.byteLength != other.byteLength) || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { return false; } return true; case boolTag: case dateTag: case numberTag: // Coerce booleans to `1` or `0` and dates to milliseconds. // Invalid dates are coerced to `NaN`. return eq(+object, +other); case errorTag: return object.name == other.name && object.message == other.message; case regexpTag: case stringTag: // Coerce regexes to strings and treat strings, primitives and objects, // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring // for more details. return object == (other + ''); case mapTag: var convert = mapToArray; case setTag: var isPartial = bitmask & PARTIAL_COMPARE_FLAG; convert || (convert = setToArray); if (object.size != other.size && !isPartial) { return false; } // Assume cyclic values are equal. var stacked = stack.get(object); if (stacked) { return stacked == other; } bitmask |= UNORDERED_COMPARE_FLAG; // Recursively compare objects (susceptible to call stack limits). stack.set(object, other); var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack); stack['delete'](object); return result; case symbolTag: if (symbolValueOf) { return symbolValueOf.call(object) == symbolValueOf.call(other); } } return false; } /** * A specialized version of `baseIsEqualDeep` for objects with support for * partial deep comparisons. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} customizer The function to customize comparisons. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` * for more details. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { var isPartial = bitmask & PARTIAL_COMPARE_FLAG, objProps = keys(object), objLength = objProps.length, othProps = keys(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { return false; } var index = objLength; while (index--) { var key = objProps[index]; if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { return false; } } // Assume cyclic values are equal. var stacked = stack.get(object); if (stacked && stack.get(other)) { return stacked == other; } var result = true; stack.set(object, other); stack.set(other, object); var skipCtor = isPartial; while (++index < objLength) { key = objProps[index]; var objValue = object[key], othValue = other[key]; if (customizer) { var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack)) : compared )) { result = false; break; } skipCtor || (skipCtor = key == 'constructor'); } if (result && !skipCtor) { var objCtor = object.constructor, othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal. if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } stack['delete'](object); stack['delete'](other); return result; } /** * Gets the data for `map`. * * @private * @param {Object} map The map to query. * @param {string} key The reference key. * @returns {*} Returns the map data. */ function getMapData(map, key) { var data = map.__data__; return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; } /** * Gets the property names, values, and compare flags of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the match data of `object`. */ function getMatchData(object) { var result = keys(object), length = result.length; while (length--) { var key = result[length], value = object[key]; result[length] = [key, value, isStrictComparable(value)]; } return result; } /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : undefined; } /** * Gets the `toStringTag` of `value`. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11, // for data views in Edge < 14, and promises in Node.js. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || (Map && getTag(new Map) != mapTag) || (Promise && getTag(Promise.resolve()) != promiseTag) || (Set && getTag(new Set) != setTag) || (WeakMap && getTag(new WeakMap) != weakMapTag)) { getTag = function(value) { var result = objectToString.call(value), Ctor = result == objectTag ? value.constructor : undefined, ctorString = Ctor ? toSource(Ctor) : undefined; if (ctorString) { switch (ctorString) { case dataViewCtorString: return dataViewTag; case mapCtorString: return mapTag; case promiseCtorString: return promiseTag; case setCtorString: return setTag; case weakMapCtorString: return weakMapTag; } } return result; }; } /** * Checks if `path` exists on `object`. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @param {Function} hasFunc The function to check properties. * @returns {boolean} Returns `true` if `path` exists, else `false`. */ function hasPath(object, path, hasFunc) { path = isKey(path, object) ? [path] : castPath(path); var result, index = -1, length = path.length; while (++index < length) { var key = toKey(path[index]); if (!(result = object != null && hasFunc(object, key))) { break; } object = object[key]; } if (result) { return result; } var length = object ? object.length : 0; return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); } /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (typeof value == 'number' || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); } /** * Checks if `value` is a property name and not a property path. * * @private * @param {*} value The value to check. * @param {Object} [object] The object to query keys on. * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { if (isArray(value)) { return false; } var type = typeof value; if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object)); } /** * Checks if `value` is suitable for use as unique object key. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is suitable, else `false`. */ function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') ? (value !== '__proto__') : (value === null); } /** * Checks if `func` has its source masked. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` is masked, else `false`. */ function isMasked(func) { return !!maskSrcKey && (maskSrcKey in func); } /** * Checks if `value` is likely a prototype object. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. */ function isPrototype(value) { var Ctor = value && value.constructor, proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; return value === proto; } /** * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` if suitable for strict * equality comparisons, else `false`. */ function isStrictComparable(value) { return value === value && !isObject(value); } /** * A specialized version of `matchesProperty` for source values suitable * for strict equality comparisons, i.e. `===`. * * @private * @param {string} key The key of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new spec function. */ function matchesStrictComparable(key, srcValue) { return function(object) { if (object == null) { return false; } return object[key] === srcValue && (srcValue !== undefined || (key in Object(object))); }; } /** * Converts `string` to a property path array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ var stringToPath = memoize(function(string) { string = toString(string); var result = []; if (reLeadingDot.test(string)) { result.push(''); } string.replace(rePropName, function(match, number, quote, string) { result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); }); return result; }); /** * Converts `value` to a string key if it's not a string or symbol. * * @private * @param {*} value The value to inspect. * @returns {string|symbol} Returns the key. */ function toKey(value) { if (typeof value == 'string' || isSymbol(value)) { return value; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /** * Converts `func` to its source code. * * @private * @param {Function} func The function to process. * @returns {string} Returns the source code. */ function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) {} try { return (func + ''); } catch (e) {} } return ''; } /** * Iterates over elements of `collection`, returning an array of all elements * `predicate` returns truthy for. The predicate is invoked with three * arguments: (value, index|key, collection). * * **Note:** Unlike `_.remove`, this method returns a new array. * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [predicate=_.identity] * The function invoked per iteration. * @returns {Array} Returns the new filtered array. * @see _.reject * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': true }, * { 'user': 'fred', 'age': 40, 'active': false } * ]; * * _.filter(users, function(o) { return !o.active; }); * // => objects for ['fred'] * * // The `_.matches` iteratee shorthand. * _.filter(users, { 'age': 36, 'active': true }); * // => objects for ['barney'] * * // The `_.matchesProperty` iteratee shorthand. * _.filter(users, ['active', false]); * // => objects for ['fred'] * * // The `_.property` iteratee shorthand. * _.filter(users, 'active'); * // => objects for ['barney'] */ function filter(collection, predicate) { var func = isArray(collection) ? arrayFilter : baseFilter; return func(collection, baseIteratee(predicate)); } /** * Creates a function that memoizes the result of `func`. If `resolver` is * provided, it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument * provided to the memoized function is used as the map cache key. The `func` * is invoked with the `this` binding of the memoized function. * * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) * method interface of `delete`, `get`, `has`, and `set`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] The function to resolve the cache key. * @returns {Function} Returns the new memoized function. * @example * * var object = { 'a': 1, 'b': 2 }; * var other = { 'c': 3, 'd': 4 }; * * var values = _.memoize(_.values); * values(object); * // => [1, 2] * * values(other); * // => [3, 4] * * object.a = 2; * values(object); * // => [1, 2] * * // Modify the result cache. * values.cache.set(object, ['a', 'b']); * values(object); * // => ['a', 'b'] * * // Replace `_.memoize.Cache`. * _.memoize.Cache = WeakMap; */ function memoize(func, resolver) { if (typeof func != 'function' || (resolver && typeof resolver != 'function')) { throw new TypeError(FUNC_ERROR_TEXT); } var memoized = function() { var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; if (cache.has(key)) { return cache.get(key); } var result = func.apply(this, args); memoized.cache = cache.set(key, result); return result; }; memoized.cache = new (memoize.Cache || MapCache); return memoized; } // Assign cache to `_.memoize`. memoize.Cache = MapCache; /** * Performs a * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ function eq(value, other) { return value === other || (value !== value && other !== other); } /** * Checks if `value` is likely an `arguments` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, * else `false`. * @example * * _.isArguments(function() { return arguments; }()); * // => true * * _.isArguments([1, 2, 3]); * // => false */ function isArguments(value) { // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray = Array.isArray; /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ function isArrayLike(value) { return value != null && isLength(value.length) && !isFunction(value); } /** * This method is like `_.isArrayLike` except that it also checks if `value` * is an object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, * else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); * // => true * * _.isArrayLikeObject(document.body.children); * // => true * * _.isArrayLikeObject('abc'); * // => false * * _.isArrayLikeObject(_.noop); * // => false */ function isArrayLikeObject(value) { return isObjectLike(value) && isArrayLike(value); } /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } /** * Checks if `value` is a valid array-like length. * * **Note:** This method is loosely based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value; return !!value && (type == 'object' || type == 'function'); } /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return !!value && typeof value == 'object'; } /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol(value) { return typeof value == 'symbol' || (isObjectLike(value) && objectToString.call(value) == symbolTag); } /** * Checks if `value` is classified as a typed array. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. * @example * * _.isTypedArray(new Uint8Array); * // => true * * _.isTypedArray([]); * // => false */ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; /** * Converts `value` to a string. An empty string is returned for `null` * and `undefined` values. The sign of `-0` is preserved. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {string} Returns the string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ function toString(value) { return value == null ? '' : baseToString(value); } /** * Gets the value at `path` of `object`. If the resolved value is * `undefined`, the `defaultValue` is returned in its place. * * @static * @memberOf _ * @since 3.7.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.get(object, 'a[0].b.c'); * // => 3 * * _.get(object, ['a', '0', 'b', 'c']); * // => 3 * * _.get(object, 'a.b.c', 'default'); * // => 'default' */ function get(object, path, defaultValue) { var result = object == null ? undefined : baseGet(object, path); return result === undefined ? defaultValue : result; } /** * Checks if `path` is a direct or inherited property of `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * * var object = _.create({ 'a': _.create({ 'b': 2 }) }); * * _.hasIn(object, 'a'); * // => true * * _.hasIn(object, 'a.b'); * // => true * * _.hasIn(object, ['a', 'b']); * // => true * * _.hasIn(object, 'b'); * // => false */ function hasIn(object, path) { return object != null && hasPath(object, path, baseHasIn); } /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keys(new Foo); * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] */ function keys(object) { return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } /** * This method returns the first argument it receives. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {*} value Any value. * @returns {*} Returns `value`. * @example * * var object = { 'a': 1 }; * * console.log(_.identity(object) === object); * // => true */ function identity(value) { return value; } /** * Creates a function that returns the value at `path` of a given object. * * @static * @memberOf _ * @since 2.4.0 * @category Util * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new accessor function. * @example * * var objects = [ * { 'a': { 'b': 2 } }, * { 'a': { 'b': 1 } } * ]; * * _.map(objects, _.property('a.b')); * // => [2, 1] * * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); * // => [1, 2] */ function property(path) { return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); } module.exports = filter; }); /** * Contains logic and provides methods of Password Guardian feature. * This means everything about vulnerable passwords. */ const PasswordGuardian = Ractive.extend({ css: css_248z$8, template: template$p, components: { Issues: Issues, ReusedGroups: ReusedGroups, ReusedGroupOverlay: ReusedGroupOverlay, PasswordIcon: PasswordIcon, EmptyScreen: EmptyScreen }, data: () => { return { CONST: CONST, globalState: 'ok', cannotCheckLeaked: undefined, // State if we cannot check leaked passwords, for example if we are offline. leakedPasswords: [], duplicateToLeakedPasswords: [], weakPasswords: [], reusedPasswords: [], reusedPasswordGroups: [], reusedGroupOverlay: { show: false, reusedPassword: undefined } }; }, oninit() { this.searchObj = {}; this.on('Issues.viewPassword', (event, id) => { this.showPasswordDetail(id); }); this.on('PasswordProblem.viewPasswordDuplicates', () => { this.set('mode', CONST.MODES.LISTVIEW); }); this.on('*.overlayClose', () => { this.set('reusedGroupOverlay.show', false); }); this.on('ReusedGroups.viewGroup', (event, reusedGroup) => { this.updateReusedPasswordOverlay(reusedGroup[0]); this.set('reusedGroupOverlay.show', true); }); this.on('PasswordDetails.edited', (password) => { this.parent.findComponent('Accounts').passwordEdited(password); }); this.on('PasswordDetails.close', () => { this.set('mode', CONST.MODES.LISTVIEW); }); }, showPasswordDetail(id) { this.set('passwordId', parseInt(id)); this.set('mode', CONST.MODES.PASSWORDVIEW); showSensitiveModal('passwordDetails', { width: 500, height: 594, params: { passwordId: parseInt(id), mode: CONST.MODES.PASSWORDVIEW } }); }, /** * Public method for updating vulnerable passwords. * @param {array} array of all passwords */ updateVulnerablePasswords(data) { const cannotCheckLeaked = false; // TODO: We don't use password.leakTimestamp -1 for now /*const cannotCheckLeaked = data.some(password => { // If we find at least one password with leakTimestamp: -1 //return password.leakTimestamp && password.leakTimestamp === -1; }); */ const isLeaked = function(password) { return password.isLeaked === true; // TODO: We don't use password.leakTimestamp > 0 for now // Passord is leaked if timestamp is not 0 //return cannotCheckLeaked === false && password.leakTimestamp && password.leakTimestamp > 0; }; const isDuplicateToLeaked = function(password) { return password.leakDuplicateWith && password.leakDuplicateWith.length > 0; }; const isDuplicate = function(password) { return password.duplicateWith && password.duplicateWith.length > 0; }; const isWeak = function(password) { return password.isWeak; }; const leakedPasswords = lodash_filter(data, password => isLeaked(password) ); const duplicateToLeakedPasswords = lodash_filter(data, password => !isLeaked(password) && isDuplicateToLeaked(password) ); const reusedPasswords = lodash_filter(data, password => !isLeaked(password) && !isDuplicateToLeaked(password) && isDuplicate(password) ); const weakPasswords = lodash_filter(data, password => !isLeaked(password) && !isDuplicateToLeaked(password) && !isDuplicate(password) && isWeak(password) ); const passwords = { cannotCheckLeaked: cannotCheckLeaked, leakedPasswords: leakedPasswords, weakPasswords: weakPasswords, reusedPasswords: reusedPasswords, duplicateToLeakedPasswords: duplicateToLeakedPasswords }; // Search object for faster searching for specific password by ID this.searchObj = { leakedPasswords: this._createSearchObj(passwords.leakedPasswords), duplicateToLeakedPasswords: this._createSearchObj(passwords.duplicateToLeakedPasswords), reusedPasswords: this._createSearchObj(passwords.reusedPasswords), weakPasswords: this._createSearchObj(passwords.weakPasswords), allVulnerablePasswords: this._createSearchObj(passwords.leakedPasswords .concat(passwords.duplicateToLeakedPasswords) .concat(passwords.weakPasswords).concat(passwords.reusedPasswords)) }; this.set({ 'leakedPasswords': passwords.leakedPasswords, 'duplicateToLeakedPasswords': passwords.duplicateToLeakedPasswords, 'reusedPasswords': passwords.reusedPasswords, 'reusedPasswordGroups': this._getReusedPasswordGroups(passwords.reusedPasswords), 'weakPasswords': passwords.weakPasswords, 'cannotCheckLeaked': cannotCheckLeaked }); const globalState = this._getGlobalState(passwords); this.set('globalState', globalState); const topMenu = this.parent.findComponent('TopMenu'); const standAloneMenu = this.parent.findComponent('StandAloneMenu'); if (standAloneMenu) { standAloneMenu.setGlobalstate(globalState); } else { topMenu.setGlobalstate(globalState); } this.updateReusedPasswordOverlay(this.get('reusedGroupOverlay.reusedPassword')); }, /** * Public method for getting vulnerable password by ID * @param {int} id Password id * @param {string} passwordsPool Array of vulnerable passwords to be searched. Default is all vulnerable passwords. * @return {object} password */ getVulnerablePasswordById(id, passwordsPoolName = undefined) { const passwordsPool = this.searchObj[passwordsPoolName] || this.searchObj.allVulnerablePasswords; if (!passwordsPool) { return undefined; } return passwordsPool[parseInt(id)]; }, /** * Public method for updating ReusedPasswordOverlay, if reused password is passed * @return {object} localReusedPassword - one of the reused passwords */ updateReusedPasswordOverlay(localReusedPassword) { if (!localReusedPassword) { return; } // We update reused password from data, in case it was changed const reusedPassword = this.getVulnerablePasswordById(localReusedPassword.itemUID, 'reusedPasswords'); // We have to update the password both on Guardian tab and Accounts tab, // since ReusedPasswordOverlay can be openened from both tabs this.set('reusedGroupOverlay.reusedPassword', reusedPassword); this.parent.findComponent('Accounts').set('reusedGroupOverlay.reusedPassword', reusedPassword); }, _getGlobalState(passwords) { let state = 'ok'; if (passwords.leakedPasswords.length > 0 || passwords.duplicateToLeakedPasswords.length > 0) { state = 'critical'; } else if (passwords.cannotCheckLeaked || passwords.reusedPasswords.length > 0 || passwords.weakPasswords > 0) { state = 'attention'; } return state; }, _createSearchObj(array) { const obj = {}; for (var i = 0, len = array.length; i < len; i++) { obj[array[i].itemUID] = array[i]; } return obj; }, /** * Returns groups of duplicate passwords * @param {array} reusedPasswords All reused passwords * @return {array} array of passwords objects */ _getReusedPasswordGroups(reusedPasswords) { const reusedGroups = {}; for (const password of reusedPasswords) { // Skip if password.duplicateWith empty if (!password.duplicateWith) { return; } // Push password id among reused passwords, if not already there if (password.duplicateWith.indexOf(password.itemUID) === -1) { password.duplicateWith.push(parseInt(password.itemUID)); } const duplicateWithSorted = password.duplicateWith.sort(); // Sorted array and converted to string will be key reusedGroups[duplicateWithSorted.toString()] = duplicateWithSorted; } // get password objects instead of Ids const objGroups = []; for (const group in reusedGroups) { const objGroup = reusedGroups[group].reduce((res, pwdId) => { const pwd = this.getVulnerablePasswordById(parseInt(pwdId), 'reusedPasswords'); if (pwd) { res.push(pwd); } return res; }, []); objGroups.push(objGroup); } return objGroups; } }); const template$u = {"v":3,"t":[{"t":4,"f":[{"t":4,"f":[{"t":7,"e":"EmptyScreen","a":{"screen":"accounts"}}],"n":50,"x":{"r":["loading","isEmptyVault"],"s":"_0===false&&_1"}},{"t":4,"n":51,"f":[{"t":4,"f":[{"t":7,"e":"ReusedGroupOverlay","a":{"reusedPassword":[{"t":2,"r":"reusedGroupOverlay.reusedPassword"}]}}],"n":50,"r":"reusedGroupOverlay.show"}," ",{"t":7,"e":"div","a":{"class":"pam_section_title"},"f":[{"t":7,"e":"h2","a":{"class":"h2"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.logins\")"}}]}]}," ",{"t":7,"e":"div","a":{"class":"pam_section_content"},"f":[{"t":7,"e":"ul","a":{"class":"longgrid -wrap g-margin-bottom--20"},"f":[{"t":4,"f":[{"t":8,"r":"password"}],"n":52,"r":"allPasswords"}," ",{"t":7,"e":"li","a":{"class":"longgrid__2 -margins"},"f":[{"t":7,"e":"Cube","v":{"click":"addPassword"},"a":{"cssCls":"-add -dashed -banner pam_item","label":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.addPassword\")"}}]}}]}]}]}],"x":{"r":["loading","isEmptyVault"],"s":"_0===false&&_1"}}],"n":50,"x":{"r":["subPage"],"s":"_0===\"accounts\""}}],"p":{"password":[{"t":7,"e":"li","a":{"class":["longgrid__2 -margins ",{"t":2,"r":"filter"}]},"f":[{"t":7,"e":"button","a":{"class":"cube -banner pam_item"},"v":{"click":{"n":"viewPassword","d":[{"t":2,"r":"itemUID"}]}},"f":[{"t":7,"e":"figure","a":{"class":"icon pam_icon cube__icon"},"f":[{"t":7,"e":"PasswordIcon","a":{"imgSrc":[{"t":2,"r":"domainIco"}],"serviceName":[{"t":2,"r":"customServiceName"}],"url":[{"t":2,"r":"url"}],"color":[{"t":2,"r":"color"}]}}]}," ",{"t":7,"e":"span","a":{"class":"cube__label pam_single_line"},"f":[{"t":2,"x":{"r":["customServiceName","url"],"s":"_0||_1"}}," ",{"t":4,"f":[{"t":7,"e":"span","a":{"class":"pam_state_badge badge color-critical -bg -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.passwordBadge.leaked\")"}}]}],"n":50,"x":{"r":["mainProblem"],"s":"_0===\"isLeaked\""}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["mainProblem"],"s":"_0===\"isDuplicateToLeaked\""},"f":[{"t":7,"e":"span","a":{"class":"pam_state_badge badge color-critical -bg -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.passwordBadge.atRisk\")"}}]}]}],"x":{"r":["mainProblem"],"s":"_0===\"isLeaked\""}}," ",{"t":7,"e":"span","a":{"class":"cube__desc pam_single_line"},"f":[{"t":2,"r":"userLoginName"}]}]}]}]}]}}; var css_248z$d = ""; /** * Contains logic and provides methods connected to Accounts. * If PasswordGuardian is licensed, it calls methods of this component to get vulnerable passwords. */ const Accounts = Ractive.extend({ css: css_248z$d, template: template$u, components: { PasswordIcon, ReusedGroupOverlay, EmptyScreen }, computed: { isEmptyVault: function() { this.fire('vaultChanged'); return this.isEmpty(); } }, data: () => { return { allPasswords: [], CONST: CONST, }; }, oninit() { this.getPasswordsLoadingTimeout = undefined; this.on('addPassword', () => { this._addPassword(); }); this.on('EmptyScreen.addPassword', () => { this._addPassword(); }); this.on('viewPassword', (event, id) => { this.showPasswordDetail(id); }); this.on('PasswordDetails.edited', (password) => { this.passwordEdited(password); }); this.on('PasswordDetails.close', () => { this.set('mode', CONST.MODES.LISTVIEW); }); this._addPasswordGuardianListeners(); }, isEmpty() { return this.get('allPasswords').length === 0; }, /** * Public method for updating passwords. * Based on params.getPasswordGuardianData, either basic data or extended data are used * @param {object} params.getPasswordGuardianData {boolean} */ updatePasswords(params = undefined) { const getPasswordGuardianData = params.getPasswordGuardianData || false; return this._getPasswords(getPasswordGuardianData).then(response => { response = response || []; if (getPasswordGuardianData) { // Update vulnerable passwords only in case of PasswordGuardianData const passwordGuardian = this.parent.findComponent('PasswordGuardian'); passwordGuardian.updateVulnerablePasswords(response); } this._updateAllPasswords(response); // Filter passwords, if there is some searchQuery const query = this.get('searchQuery'); if (query.length > 0) { this.searchPasswords(query); } }); }, searchPasswords(query) { const loQuery = query.toLowerCase(); this.get('allPasswords').forEach((r) => { r.filter = (r.customServiceName.toLowerCase().indexOf(loQuery) > -1) ? '' : 'filtered_out'; }); return this.update('allPasswords'); }, showPasswordDetail(id) { this.set('passwordId', parseInt(id)); this.set('mode', CONST.MODES.PASSWORDVIEW); showSensitiveModal('passwordDetails', { width: 500, height: 594, params: { passwordId: parseInt(id), mode: CONST.MODES.PASSWORDVIEW } }); }, passwordEdited(password) { this.set('mode', CONST.MODES.LISTVIEW); const getPasswordGuardianData = this.get('isLicensed'); this._localUpdatePassword(password, getPasswordGuardianData); }, /** * Function locally updating edited password * It quickly updates JS values so the change is visible to the user immediately * Update passwords propertly from C++ as soon as possible!!! * @param {object} password * @param {boolean} getPasswordGuardianData */ _localUpdatePassword(password, getPasswordGuardianData = false) { const allPasswords = this.get('allPasswords'); const index = allPasswords.findIndex(item => item.itemUID === password.itemUID); if (index > -1) { allPasswords[index] = password; this._updateAllPasswords(allPasswords); if (getPasswordGuardianData) { const passwordGuardian = this.parent.findComponent('PasswordGuardian'); passwordGuardian.updateVulnerablePasswords(allPasswords); } } }, _updateAllPasswords(response) { response.forEach(r => { r.filter = ''; }); this.set('allPasswords', response); // The fix below causes Ractive memory leak // the next line replaces the code from above, fixes AV-12249 /*return this.splice.apply(this, ['allPasswords', 0, this.get('allPasswords').length ].concat(response));*/ }, _addPasswordGuardianListeners() { // These listeners make sense only if PasswordGuardian is licensed this.observe('allPasswords', (allPasswords) => { this._updatePasswordBadges(allPasswords); }, { init: false }); this.on('Issues.viewPassword', (event, id) => { this.showPasswordDetail(id); }); // Hide reusedGroupOverlay when overlay component is closed this.on('*.overlayClose', () => { this.set('reusedGroupOverlay.show', false); }); // Open reusedGroupOverlay with duplicates of specific password this.on('PasswordProblem.viewPasswordDuplicates', (event, password) => { this.set('mode', CONST.MODES.LISTVIEW); this.parent.findComponent('PasswordGuardian').updateReusedPasswordOverlay(password); this.set('reusedGroupOverlay.show', true); }); }, _getPasswords(getPasswordGuardianData = false) { // Password loading can take a long time after sync. // If user had no password and loading is not instant, show loading // in order not to scare user that nothing happened this.getPasswordsLoadingTimeout = setTimeout(() => { if (this.isEmpty()) { this.set('loading', true); } }, 2000); if (getPasswordGuardianData === false) { return NAPI.request('app.pam.GetPAMPasswordsForExport', {showPasswords: false}).then((result) => { this._clearGetPasswordsLoadingTimeout(); this.set('loading', false); return sortAlphabetically(result, 'customServiceName'); }); } else { return NAPI.request('app.pam.GetPAMPasswords').then((result) => { this._clearGetPasswordsLoadingTimeout(); this.set('loading', false); return sortAlphabetically(result, 'customServiceName'); }); } }, _clearGetPasswordsLoadingTimeout() { if (this.getPasswordsLoadingTimeout) { clearTimeout(this.getPasswordsLoadingTimeout); this.getPasswordsLoadingTimeout = undefined; } }, _addPassword() { showSensitiveModal('passwordDetails', { width: 500, height: 594, params: { mode: CONST.MODES.PASSWORDADD } }); }, /** * Updates password labels in accounts list. * Labels are shown only for leaked and duplicated to leak passwords. */ _updatePasswordBadges(allPasswords) { const passwordGuardian = this.parent.findComponent('PasswordGuardian'); for (const password of allPasswords) { if (passwordGuardian.getVulnerablePasswordById(password.itemUID, 'leakedPasswords')) { password.mainProblem = 'isLeaked'; } else if (passwordGuardian.getVulnerablePasswordById(password.itemUID, 'duplicateToLeakedPasswords')) { password.mainProblem = 'isDuplicateToLeaked'; } } this.set('allPasswords', allPasswords); }, onteardown() { this._clearGetPasswordsLoadingTimeout(); } }); const template$v = {"v":3,"t":[{"t":4,"f":[{"t":4,"f":[{"t":7,"e":"Modal","a":{"cssCls":"pam_detail_modal","scrollable":0,"autoClose":0,"title":[{"t":4,"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.addCreditCard\")"}}],"n":50,"x":{"r":["mode","CONST.MODES.CREDIT_CARD_ADD"],"s":"_0===_1"}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW"],"s":"_0===_1"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.creditCardDetail\")"}}]},{"t":4,"n":50,"x":{"r":["CONST.MODES.CREDIT_CARD_VIEW","mode","CONST.MODES.CREDIT_CARD_EDIT"],"s":"(!(_1===_0))&&(_1===_2)"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.editCreditCard\")"}}]}],"x":{"r":["mode","CONST.MODES.CREDIT_CARD_ADD"],"s":"_0===_1"}}]},"f":[{"t":7,"e":"CreditCardDetails","a":{"mode":[{"t":2,"r":"mode"}],"creditCard":[{"t":2,"r":"currentCreditCard"}]}}]}],"n":50,"x":{"r":["CONST.MODES.CREDIT_CARD_ADD","CONST.MODES.CREDIT_CARD_VIEW","mode","CONST.MODES.CREDIT_CARD_EDIT"],"s":"_2===_0||_2===_1||_2===_3"}}," ",{"t":4,"f":[{"t":7,"e":"EmptyScreen","a":{"screen":"creditCards"}}],"n":50,"x":{"r":["loading","isEmptyVault"],"s":"_0===false&&_1"}},{"t":4,"n":51,"f":[{"t":7,"e":"div","a":{"class":"pam_section_title"},"f":[{"t":7,"e":"h2","a":{"class":"h2"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.creditCards\")"}}]}]}," ",{"t":7,"e":"div","a":{"class":"pam_section_content"},"f":[{"t":7,"e":"ul","a":{"class":"longgrid -wrap g-margin-bottom--20"},"f":[{"t":4,"f":[{"t":7,"e":"li","a":{"class":["longgrid__2 -margins ",{"t":2,"r":"filter"}]},"f":[{"t":7,"e":"CreditCardItem","a":{"creditCard":[{"t":2,"r":"."}]}}]}],"n":52,"r":"allCreditCards"}," ",{"t":7,"e":"li","a":{"class":"longgrid__2 -margins"},"f":[{"t":7,"e":"Cube","v":{"click":"addCreditCard"},"a":{"cssCls":"-add -dashed -banner pam_item","label":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.addCreditCard\")"}}]}}]}]}]}],"x":{"r":["loading","isEmptyVault"],"s":"_0===false&&_1"}}],"n":50,"x":{"r":["subPage"],"s":"_0===\"creditCards\""}}]}; const template$w = {"v":3,"t":[{"t":7,"e":"button","a":{"class":"cube -banner pam_item"},"v":{"click":{"n":"viewCreditCard","d":[{"t":2,"r":"creditCard.itemUID"}]}},"f":[{"t":7,"e":"SvgIcon","a":{"name":[{"t":2,"r":"cardIcon"}],"cssCls":"cube__icon"}}," ",{"t":7,"e":"span","a":{"class":"cube__label pam_single_line"},"f":[{"t":2,"r":"label"}," ",{"t":7,"e":"span","a":{"class":["cube__desc pam_single_line ",{"t":2,"x":{"r":["expiresSoon"],"s":"_0?\"color-danger -text\":\"\""}}]},"f":[{"t":4,"f":[{"t":3,"x":{"r":["nls","isExpired","creditCard.expiresOn.month","creditCard.expiresOn.year"],"s":"_0(_1?\"passwords.creditCardExpiredOn\":\"passwords.creditCardExpiresOn\",_2,_3)"}}],"n":50,"r":"hasExpiration"}]}]}]}]}; var types = {}; var VISA = 'visa'; var MASTERCARD = 'master-card'; var AMERICAN_EXPRESS = 'american-express'; var DINERS_CLUB = 'diners-club'; var DISCOVER = 'discover'; var JCB = 'jcb'; var UNIONPAY = 'unionpay'; var MAESTRO = 'maestro'; var CVV = 'CVV'; var CID = 'CID'; var CVC = 'CVC'; var CVN = 'CVN'; var testOrder = [ VISA, MASTERCARD, AMERICAN_EXPRESS, DINERS_CLUB, DISCOVER, JCB, UNIONPAY, MAESTRO ]; function clone(x) { var prefixPattern, exactPattern, dupe; if (!x) { return null; } // TODO: in the next major version, we should // consider removing these pattern properties. // They are not useful extnerally and can be // confusing because the exactPattern does not // always match (for instance, Maestro cards // can start with 62, but the exact pattern // does not include that since it would // exclude UnionPay and Discover cards // when it is not sure whether or not // the card is a UnionPay, Discover or // Maestro card). prefixPattern = x.prefixPattern.source; exactPattern = x.exactPattern.source; dupe = JSON.parse(JSON.stringify(x)); dupe.prefixPattern = prefixPattern; dupe.exactPattern = exactPattern; return dupe; } types[VISA] = { niceType: 'Visa', type: VISA, prefixPattern: /^4$/, exactPattern: /^4\d*$/, gaps: [4, 8, 12], lengths: [16, 18, 19], code: { name: CVV, size: 3 } }; types[MASTERCARD] = { niceType: 'MasterCard', type: MASTERCARD, prefixPattern: /^(5|5[1-5]|2|22|222|222[1-9]|2[3-6]|27|27[0-2]|2720)$/, exactPattern: /^(5[1-5]|222[1-9]|2[3-6]|27[0-1]|2720)\d*$/, gaps: [4, 8, 12], lengths: [16], code: { name: CVC, size: 3 } }; types[AMERICAN_EXPRESS] = { niceType: 'American Express', type: AMERICAN_EXPRESS, prefixPattern: /^(3|34|37)$/, exactPattern: /^3[47]\d*$/, isAmex: true, gaps: [4, 10], lengths: [15], code: { name: CID, size: 4 } }; types[DINERS_CLUB] = { niceType: 'Diners Club', type: DINERS_CLUB, prefixPattern: /^(3|3[0689]|30[0-5])$/, exactPattern: /^3(0[0-5]|[689])\d*$/, gaps: [4, 10], lengths: [14, 16, 19], code: { name: CVV, size: 3 } }; types[DISCOVER] = { niceType: 'Discover', type: DISCOVER, prefixPattern: /^(6|60|601|6011|65|64|64[4-9])$/, exactPattern: /^(6011|65|64[4-9])\d*$/, gaps: [4, 8, 12], lengths: [16, 19], code: { name: CID, size: 3 } }; types[JCB] = { niceType: 'JCB', type: JCB, prefixPattern: /^(2|21|213|2131|1|18|180|1800|3|35)$/, exactPattern: /^(2131|1800|35)\d*$/, gaps: [4, 8, 12], lengths: [16], code: { name: CVV, size: 3 } }; types[UNIONPAY] = { niceType: 'UnionPay', type: UNIONPAY, prefixPattern: /^((6|62|62\d|(621(?!83|88|98|99))|622(?!06)|627[02,06,07]|628(?!0|1)|629[1,2])|622018)$/, exactPattern: /^(((620|(621(?!83|88|98|99))|622(?!06|018)|62[3-6]|627[02,06,07]|628(?!0|1)|629[1,2]))\d*|622018\d{12})$/, gaps: [4, 8, 12], lengths: [16, 17, 18, 19], code: { name: CVN, size: 3 } }; types[MAESTRO] = { niceType: 'Maestro', type: MAESTRO, prefixPattern: /^(5|5[06-9]|6\d*)$/, exactPattern: /^(5[06-9]|6[37])\d*$/, gaps: [4, 8, 12], lengths: [12, 13, 14, 15, 16, 17, 18, 19], code: { name: CVC, size: 3 } }; function creditCardType(cardNumber) { var type, value, i; var prefixResults = []; var exactResults = []; if (!(typeof cardNumber === 'string' || cardNumber instanceof String)) { return []; } for (i = 0; i < testOrder.length; i++) { type = testOrder[i]; value = types[type]; if (cardNumber.length === 0) { prefixResults.push(clone(value)); continue; } if (value.exactPattern.test(cardNumber)) { exactResults.push(clone(value)); } else if (value.prefixPattern.test(cardNumber)) { prefixResults.push(clone(value)); } } return exactResults.length ? exactResults : prefixResults; } creditCardType.getTypeInfo = function (type) { return clone(types[type]); }; creditCardType.types = { VISA: VISA, MASTERCARD: MASTERCARD, AMERICAN_EXPRESS: AMERICAN_EXPRESS, DINERS_CLUB: DINERS_CLUB, DISCOVER: DISCOVER, JCB: JCB, UNIONPAY: UNIONPAY, MAESTRO: MAESTRO }; var creditCardType_1 = creditCardType; /** * Return true if given string is empty (or contain just whitespace). * @return {bool} is empty */ var isEmptyString = function(s) { if (!s) return true; if (s.length === 0) return true; if (s.trim().length === 0) return true; return false; }; /** * Return new string with `what` inserted at given position. * @param s {String} Source string * @param index {Number} Index of insertion * @param what {String} String to insert into s * @return {String} */ var insertString = function(s, index, what) { return s.slice(0, index) + what + s.slice(index); }; var utils = { isEmptyString: isEmptyString, insertString: insertString }; function getDefaultGaps() { return [4, 8, 12, 16]; } /** * Return Credit Card number with non-digit chars removed. * @return {String} */ function cleanCreditCardNumber(cardNumber) { return cardNumber.replace(/\D+/g, ""); } /** * Returns Credit Card type information. * @return {Object} See https://www.npmjs.com/package/credit-card-type */ function getCreditCardTypeInfo(cardNumber) { var types = creditCardType_1(cardNumber.replace(/\s/g, "")); if (types.length === 0) return null; return types[0]; } /** * Try to determine Credit Card brand from given number. * @return {String} (e.g., "Visa", "MasterCard", ...) */ function getCreditCardBrand(cardNumber) { var types = creditCardType_1(cardNumber); // TODO: What to do when card is of unknown type? if (types.length === 0) return null; return types[0].niceType; } /** * Return icon name for given Credit Card. * @return {String} (e.g., "card-master-card") */ function getCreditCardIcon(creditCard) { if (!creditCard) return "card-unknown"; if (!creditCard.cardNumber) return "card-unknown"; var cardInfo = getCreditCardTypeInfo(creditCard.cardNumber); if (!cardInfo) return "card-unknown"; return "card-" + cardInfo.type; } /** * Format Credit Card number. * @return {String} (e.g., "4111 1111 1111 1111") */ function formatCreditCardNumber(cardNumber) { if (!cardNumber) return ""; var cardInfo = getCreditCardTypeInfo(cardNumber); var gaps = cardInfo ? cardInfo.gaps : getDefaultGaps(); cardNumber = cleanCreditCardNumber(cardNumber); // Add gaps var gapPosition; while ((gapPosition = gaps.pop()) !== undefined) { if (gapPosition + 1 > cardNumber.length) continue; cardNumber = utils.insertString(cardNumber, gapPosition, " "); } return cardNumber; } /** * Mask Credit Card number (only show last 4 digits). * @return {String} (e.g., "•••• •••• •••• 1111") */ function maskCreditCardNumber(cardNumber) { if (!cardNumber) return ""; var cardInfo = getCreditCardTypeInfo(cardNumber); var gaps = cardInfo ? cardInfo.gaps : getDefaultGaps(); // Mask cardNumber = cardNumber.replace(/\s/g, ""); if (cardNumber.length < 4) return cardNumber; var dots = new Array(cardNumber.length - 3).join("•"); var maskedCardNumber = dots + cardNumber.substring(cardNumber.length - 4); // Add gaps var gapPosition; while ((gapPosition = gaps.pop()) !== undefined) { if (gapPosition + 1 > maskedCardNumber.length) continue; maskedCardNumber = utils.insertString(maskedCardNumber, gapPosition, " "); } return maskedCardNumber; } /** * Generate label for given Credit Card. * @return {String} (e.g., "Visa X-1234") */ function getCreditCardLabel(creditCard) { if (!creditCard) return null; if (!utils.isEmptyString(creditCard.customName)) return creditCard.customName; if (utils.isEmptyString(creditCard.cardNumber)) return null; var cardNumber = creditCard.cardNumber.replace(/\s/g, ""); var brand = getCreditCardBrand(cardNumber); var masked = "X-" + cardNumber.slice(-4); if (!brand) return masked; return brand + " " + masked; } /** * Formate expire date into MM/YYYY format. * @return {String} (e.g., "08/2016", "10/2017") */ function formatExpireDate(expiresOn) { var month, year; if (typeof expiresOn === "number") { // Time in milliseconds since Unix epoch var expiresOnDate = new Date(expiresOn); year = expiresOnDate.getFullYear(); month = expiresOnDate.getUTCMonth() + 1; } else if ( typeof expiresOn === "object" && expiresOn.year && expiresOn.month ) { // LocalDate from passwdmgr.proto year = expiresOn.year; month = expiresOn.month; } else { return ""; } return ("0" + month).slice(-2) + "/" + year; } var cleanCreditCardNumber_1 = cleanCreditCardNumber; var getCreditCardIcon_1 = getCreditCardIcon; var formatCreditCardNumber_1 = formatCreditCardNumber; var maskCreditCardNumber_1 = maskCreditCardNumber; var getCreditCardLabel_1 = getCreditCardLabel; var formatExpireDate_1 = formatExpireDate; const CreditCardItem = Ractive.extend({ isolated: true, template: template$w, data: function() { return { creditCard: null }; }, computed: { hasExpiration: function() { var expiresOn = this.get('creditCard.expiresOn'); return expiresOn && expiresOn.year && expiresOn.month; }, expiresSoon: function() { const ONE_MONTH = 31 * 24 * 60 * 60 * 1000; var expiresOn = this.get('creditCard.expiresOn'); if (!expiresOn || !expiresOn.year || !expiresOn.month) { return false; } var expires = new Date(expiresOn.year, expiresOn.month); // it's actually the first ms of the next month return expires - Date.now() < ONE_MONTH; }, isExpired: function() { var expiresOn = this.get('creditCard.expiresOn'); if (!expiresOn || !expiresOn.year || !expiresOn.month) { return false; } var expires = new Date(expiresOn.year, expiresOn.month); // it's actually the first ms of the next month return expires < Date.now(); }, label: function() { return getCreditCardLabel_1(this.get('creditCard')); }, cardIcon: function() { return getCreditCardIcon_1(this.get('creditCard')); } }, oninit() {} }); const template$x = {"v":3,"t":[{"t":7,"e":"div","a":{"class":"modal pam_form"},"f":[{"t":7,"e":"SvgIcon","a":{"name":[{"t":2,"r":"cardIcon"}],"cssCls":"pam_card_icon"}}," ",{"t":7,"e":"div","a":{"class":"pam_edit__title"},"f":[{"t":7,"e":"h3","a":{"class":"h3 pam_single_line"},"f":[{"t":2,"r":"label"}]}]}," ",{"t":7,"e":"div","a":{"class":["form__row ",{"t":4,"f":["-error"],"n":50,"x":{"r":["submitted","errors.cardNumber"],"s":"_0&&_1"}}," ",{"t":4,"f":["-warning"],"n":50,"x":{"r":["isCcWarningVisible","submitted","errors.cardNumber"],"s":"_0&&!(_1&&_2)"}}," g-margin-top--10"]},"f":[{"t":7,"e":"label","a":{"for":"cardNumber","class":"pam_label text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.creditCard.label.cardNumber\")"}}]}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_input_actions_row"},"f":[{"t":7,"e":"input","o":"eventHandler","a":{"type":"text","class":"input -full pam_value","value":[{"t":2,"x":{"r":["isCardNumberRevealed","creditCard.cardNumber","maskedCardNumber"],"s":"_0?_1:_2"}}],"name":"cardNumber","id":"cardNumber","twoway":"false","readonly":"true"}}," ",{"t":7,"e":"div","a":{"class":"btn__split"},"f":[{"t":7,"e":"ButtonCopyToClipboard","a":{"text":[{"t":2,"r":"creditCard.cardNumber"}]}}," ",{"t":7,"e":"ButtonRevealSecret","a":{"isRevealed":[{"t":2,"r":"isCardNumberRevealed"}]}}]}]}],"n":50,"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW"],"s":"_0===_1"}},{"t":4,"n":51,"f":[{"t":7,"e":"ValidatedInput","a":{"type":"text","class":"input -full pam_value","name":"cardNumber","id":"cardNumber","value":[{"t":2,"r":"creditCard.cardNumber"}],"placeholder":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.creditCardExample\")"}}],"autofocus":"true","formatter":[{"t":2,"r":"formatCreditCardNumber"}],"filter":"[^0-9]*"},"v":{"inputblur":"inputNumberBlured"}}," ",{"t":4,"f":[{"t":7,"e":"p","a":{"class":"input__message"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.creditCardNumberWarning\")"}}]}],"n":50,"r":"isCcWarningVisible"}],"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW"],"s":"_0===_1"}}]}," ",{"t":4,"f":[{"t":7,"e":"label","a":{"for":"customName","class":"pam_label text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.creditCard.label.customName\")"}}]}," ",{"t":7,"e":"input","o":"eventHandler","a":{"type":"text","class":"input -full pam_value","name":"customName","id":"customName","value":[{"t":2,"r":"creditCard.customName"}]},"m":[{"t":4,"f":["twoway=\"false\" readonly=\"true\""],"n":50,"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW"],"s":"_0===_1"}}]}],"n":50,"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW","creditCard.customName"],"s":"_0!==_1||_2"}}," ",{"t":4,"f":[{"t":7,"e":"label","a":{"for":"cardholderName","class":"pam_label text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.creditCard.label.cardholderName\")"}}]}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_input_actions_row"},"f":[{"t":7,"e":"input","o":"eventHandler","a":{"type":"text","class":"input -full pam_value","name":"cardholderName","id":"cardholderName","value":[{"t":2,"r":"creditCard.cardholderName"}],"twoway":"false","readonly":"true"}}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":"btn__split"},"f":[{"t":7,"e":"ButtonCopyToClipboard","a":{"text":[{"t":2,"r":"creditCard.cardholderName"}]}}]}],"n":50,"r":"creditCard.cardholderName"}]}],"n":50,"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW"],"s":"_0===_1"}},{"t":4,"n":51,"f":[{"t":7,"e":"input","o":"eventHandler","a":{"type":"text","class":"input -full pam_value","name":"cardholderName","id":"cardholderName","value":[{"t":2,"r":"creditCard.cardholderName"}]}}],"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW"],"s":"_0===_1"}}],"n":50,"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW","creditCard.cardholderName"],"s":"_0!==_1||_2"}}," ",{"t":4,"f":[{"t":7,"e":"label","a":{"class":"pam_label text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.creditCard.label.expiresOn\")"}}]}," ",{"t":4,"f":[{"t":7,"e":"input","o":"eventHandler","a":{"type":"text","class":"input -full pam_value","value":[{"t":2,"r":"expiresOn"}],"twoway":"false","readonly":"true"}}],"n":50,"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW"],"s":"_0===_1"}},{"t":4,"n":51,"f":[{"t":7,"e":"div","a":{"style":"display: flex; justify-content: flex-start"},"f":[{"t":7,"e":"div","a":{"style":"margin-right: 16px"},"f":[{"t":7,"e":"label","a":{"for":"expiresOnMonth","class":"pam_label__sub text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.month\")"}}]}," ",{"t":7,"e":"select","a":{"value":[{"t":2,"r":"creditCard.expiresOn.month"}],"id":"expiresOnMonth","class":"input -full"},"f":[{"t":7,"e":"option","a":{"value":""},"f":["--"]}," ",{"t":4,"f":[{"t":7,"e":"option","a":{"value":[{"t":2,"r":"."}]},"f":[{"t":4,"f":["0"],"n":50,"x":{"r":["."],"s":"_0<10"}},{"t":2,"r":"."}]}],"r":"expirationMonths"}]}]}," ",{"t":7,"e":"div","f":[{"t":7,"e":"label","a":{"for":"expiresOnYear","class":"pam_label__sub text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.year\")"}}]}," ",{"t":7,"e":"select","a":{"value":[{"t":2,"r":"creditCard.expiresOn.year"}],"id":"expiresOnYear","class":"input"},"f":[{"t":7,"e":"option","a":{"value":""},"f":["----"]}," ",{"t":4,"f":[{"t":7,"e":"option","a":{"value":[{"t":2,"r":"."}]},"f":[{"t":2,"r":"."}]}],"r":"expirationYears"}]}]}]}],"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW"],"s":"_0===_1"}}],"n":50,"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW","creditCard.expiresOn.month","creditCard.expiresOn.year"],"s":"_0!==_1||(_2&&_3)"}}," ",{"t":4,"f":[{"t":7,"e":"label","a":{"for":"cvv","class":"pam_label text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.creditCard.label.cvv\")"}}]}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_input_actions_row"},"f":[{"t":4,"f":[{"t":7,"e":"input","o":"eventHandler","a":{"type":"text","name":"cvv","id":"cvv","twoway":"false","readonly":"true","class":"input pam_value","value":[{"t":2,"r":"creditCard.cvv"}]}}],"n":50,"r":"isCvvRevealed"},{"t":4,"n":51,"f":[{"t":7,"e":"input","o":"eventHandler","a":{"type":"password","name":"cvv","id":"cvv","twoway":"false","readonly":"true","class":"input pam_value","value":[{"t":2,"r":"creditCard.cvv"}]}}],"r":"isCvvRevealed"}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":"btn__split"},"f":[{"t":7,"e":"ButtonCopyToClipboard","a":{"text":[{"t":2,"r":"creditCard.cvv"}]}}," ",{"t":7,"e":"ButtonRevealSecret","a":{"isRevealed":[{"t":2,"r":"isCvvRevealed"}]}}]}],"n":50,"r":"creditCard.cvv"}]}],"n":50,"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW"],"s":"_0===_1"}},{"t":4,"n":51,"f":[{"t":7,"e":"ValidatedInput","a":{"type":"text","class":"input pam_value","name":"cvv","id":"cvv","size":"6","value":[{"t":2,"r":"creditCard.cvv"}],"filter":"[^0-9]*"}}],"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW"],"s":"_0===_1"}}],"n":50,"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW","creditCard.cvv"],"s":"_0!==_1||_2"}}," ",{"t":4,"f":[{"t":7,"e":"label","a":{"for":"pin","class":"pam_label text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.creditCard.label.pin\")"}}]}," ",{"t":7,"e":"div","f":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_input_actions_row"},"f":[{"t":4,"f":[{"t":7,"e":"input","o":"eventHandler","a":{"type":"text","name":"pin","id":"pin","twoway":"false","readonly":"true","class":"input pam_value","value":[{"t":2,"r":"creditCard.pin"}]}}],"n":50,"r":"isPinRevealed"},{"t":4,"n":51,"f":[{"t":7,"e":"input","o":"eventHandler","a":{"type":"password","name":"pin","id":"pin","twoway":"false","readonly":"true","class":"input pam_value","value":[{"t":2,"r":"creditCard.pin"}]}}],"r":"isPinRevealed"}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":"btn__split"},"f":[{"t":7,"e":"ButtonCopyToClipboard","a":{"text":[{"t":2,"r":"creditCard.pin"}]}}," ",{"t":7,"e":"ButtonRevealSecret","a":{"isRevealed":[{"t":2,"r":"isPinRevealed"}]}}]}],"n":50,"r":"creditCard.pin"}]}],"n":50,"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW"],"s":"_0===_1"}},{"t":4,"n":51,"f":[{"t":7,"e":"ValidatedInput","a":{"type":"text","class":"input pam_value","name":"pin","id":"pin","size":"6","value":[{"t":2,"r":"creditCard.pin"}],"filter":"[^0-9]*"}}],"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW"],"s":"_0===_1"}}]}],"n":50,"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW","creditCard.pin"],"s":"_0!==_1||_2"}}," ",{"t":4,"f":[{"t":7,"e":"label","a":{"for":"note","class":"pam_label text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.label.note\")"}}]}," ",{"t":7,"e":"textarea","o":"eventHandler","a":{"name":"note","class":"input -full pam_value pam_textarea","id":"note","value":[{"t":2,"r":"creditCard.note"}]},"m":[{"t":4,"f":["twoway=\"false\" readonly=\"true\""],"n":50,"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW"],"s":"_0===_1"}}]}],"n":50,"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW","creditCard.note"],"s":"_0!==_1||_2"}}]}," ",{"t":7,"e":"div","a":{"class":"modal__footer"},"f":[{"t":7,"e":"ErrorLabel","a":{"error":[{"t":2,"r":"apiError"}]}}," ",{"t":4,"f":[{"t":7,"e":"button","a":{"type":"button","disabled":[{"t":2,"r":"processing"}],"class":"btn","autofocus":"true"},"v":{"click":{"n":"edit","d":[{"t":2,"r":"creditCard.itemUID"}]}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.edit\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","disabled":[{"t":2,"r":"processing"}],"class":"btn -secondary g-margin-left--10"},"v":{"click":"close"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.close\")"}}]}],"n":50,"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW"],"s":"_0===_1"}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["mode","CONST.MODES.CREDIT_CARD_EDIT"],"s":"_0===_1"},"f":[{"t":7,"e":"button","a":{"type":"submit","disabled":[{"t":2,"r":"processing"}],"class":"btn"},"v":{"click":"submit"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.save\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","disabled":[{"t":2,"r":"processing"}],"class":"btn -secondary g-margin-left--10"},"v":{"click":"cancelEdit"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.cancel\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","disabled":[{"t":2,"r":"processing"}],"class":"btn -critical g-margin-left--10"},"v":{"click":{"n":"delete","d":[{"t":2,"r":"creditCard.itemUID"}]}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.delete\")"}}]}]},{"t":4,"n":50,"x":{"r":["mode","CONST.MODES.CREDIT_CARD_EDIT"],"s":"!(_0===_1)"},"f":[" ",{"t":7,"e":"button","a":{"type":"submit","disabled":[{"t":2,"r":"processing"}],"class":"btn"},"v":{"click":"submit"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.save\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","disabled":[{"t":2,"r":"processing"}],"class":"btn -secondary g-margin-left--10"},"v":{"click":"close"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.close\")"}}]}]}],"x":{"r":["mode","CONST.MODES.CREDIT_CARD_VIEW"],"s":"_0===_1"}}]}]}; var css_248z$e = "#cardNumber {\n font-size: 18px;\n letter-spacing: 1px;\n}\n"; function getSelection(input) { return { start: input.selectionStart, end: input.selectionEnd }; } function setCursorPos(input, startPos, endPos) { if (typeof startPos === 'object') { endPos = startPos.end; startPos = startPos.start; } if (!startPos) { startPos = 0; } if (typeof endPos === 'undefined') { endPos = startPos; } input.setSelectionRange(startPos, endPos); } function adjustCursorBeforeChange(event) { const currentSelection = getSelection(event.node), isTextSelected = currentSelection.start !== currentSelection.end, isSpaceBehind = event.node.value.charAt(currentSelection.start - 1) === ' '; if (event.original.key === 'Backspace' && !isTextSelected && isSpaceBehind) { setCursorPos(event.node, currentSelection.start - 1); // move cursor behind the space to remove the number before } } function adjustCursorAfterChange(event) { const currentSelection = getSelection(event.node), currentValue = event.node.value; const onAfterValueChange = () => { const afterChangeValue = event.node.value, isTextSelected = currentSelection.start !== currentSelection.end, isDeleting = event.original.key === 'Backspace' || event.original.key === 'Delete'; let position = currentSelection.start; // if there's no change - for ex.: user navigates with arrow keys if (afterChangeValue === currentValue) { return; } // if just one number was selected and replaced if (afterChangeValue.length === currentValue.length) { position += 1; } // if the user added one number if (afterChangeValue.length > currentValue.length) { position += 1; // if next char is a space added by the formatter if (afterChangeValue.charAt(currentSelection.start) === ' ') { position += 1; } } if (afterChangeValue.length < currentValue.length) { if (isTextSelected && !isDeleting) { position += 1; } else if (event.original.key === 'Backspace') { position -= 1; } } setCursorPos(event.node, position); }; setTimeout(onAfterValueChange); } const ValidatedInput = Ractive.extend({ isolated: true, template: '<input decorator="eventHandler" {{attr}} value="{{value}}" on-focus="inputfocus" on-blur="inputblur" on-keydown="keyDown" on-input="valueChange" />', data() {}, computed: { attr: function() { var args=this.get(); var rv = ''; var key; for (key in args) { if (this.possibleAttributes.indexOf(key) === -1 || this.privateAttributes[key]) continue; rv += key + '="' + args[key] + '" '; } for (key in this.defaultAttributes) { if (this.possibleAttributes.indexOf(key) === -1 || typeof args[key] !== 'undefined') continue; rv += key + '="' + this.defaultAttributes[key] + '" '; } return rv; } }, possibleAttributes: [ 'type', 'class', 'name', 'id', 'placeholder', 'autofocus', 'filter', 'formatter', 'value', 'attr', 'size' ], privateAttributes: { filter: true, // regex for characters to filer-out formatter: true, // use as: parent: { data: { func(value) { return value; }}} + <ValidatedInput formatter="func" /> value: true, attr: true }, defaultAttributes: { type: 'text' }, oninit() { this.on('valueChange', this._onValueChange.bind(this)); this.on('keyDown', this._onKeyDown.bind(this)); }, _onValueChange() { var value = this.get('value') || '', refVal = value, filter = this.get('filter'), formatter = this.get('formatter'); if (filter) { value = refVal.replace(new RegExp(filter, 'g'), ''); } if (formatter) { refVal = value; value = formatter(refVal); } return this.set('value', value); }, _onKeyDown(event) { adjustCursorBeforeChange(event); adjustCursorAfterChange(event); } }); // regex var pattern = /^[0-9]+$/; /** * [isNaN description] * @param {[type]} num [description] * @return {Boolean} [description] */ function isNotANumber (num) { return (isNaN(num) || !pattern.test(num)) } /** * [exports description] * @param {[type]} cardNumber [description] * @return {[type]} [description] */ var nodeLuhn = function (cardNumber) { if (!cardNumber) return if (typeof (cardNumber) !== 'string') { cardNumber = String(cardNumber); } // trim the string and validate it has length var trimmed = cardNumber.trim(); var trimmedLength = trimmed.length; if (trimmedLength === 0) return // parse the string to an int and validate it's a number var cardNum = parseInt(trimmed, 10); if (isNotANumber(cardNum)) return var total = 0; var calc1; var calc2; // traverse through card digits // starting from the most right for (var i = trimmedLength; i > 0; i--) { // right most digit calc1 = Math.floor(cardNum) % 10; total += calc1; // move the decimal cardNum = cardNum / 10; // the next right most digit calc1 = Math.floor(cardNum) % 10; calc2 = calc1 * 2; switch (calc2) { case 10: calc2 = 1; break case 12: calc2 = 3; break case 14: calc2 = 5; break case 16: calc2 = 7; break case 18: calc2 = 9; break default: calc2 = calc2; } // move decimal cardNum = cardNum / 10; total += calc2; i--; } // return a boolean return ((total % 10) === 0) }; var validate = createCommonjsModule(function (module, exports) { /*! * validate.js 0.11.1 * * (c) 2013-2016 Nicklas Ansman, 2013 Wrapp * Validate.js may be freely distributed under the MIT license. * For all details and documentation: * http://validatejs.org/ */ (function(exports, module, define) { // The main function that calls the validators specified by the constraints. // The options are the following: // - format (string) - An option that controls how the returned value is formatted // * flat - Returns a flat array of just the error messages // * grouped - Returns the messages grouped by attribute (default) // * detailed - Returns an array of the raw validation data // - fullMessages (boolean) - If `true` (default) the attribute name is prepended to the error. // // Please note that the options are also passed to each validator. var validate = function(attributes, constraints, options) { options = v.extend({}, v.options, options); var results = v.runValidations(attributes, constraints, options) , attr , validator; for (attr in results) { for (validator in results[attr]) { if (v.isPromise(results[attr][validator])) { throw new Error("Use validate.async if you want support for promises"); } } } return validate.processValidationResults(results, options); }; var v = validate; // Copies over attributes from one or more sources to a single destination. // Very much similar to underscore's extend. // The first argument is the target object and the remaining arguments will be // used as sources. v.extend = function(obj) { [].slice.call(arguments, 1).forEach(function(source) { for (var attr in source) { obj[attr] = source[attr]; } }); return obj; }; v.extend(validate, { // 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: 11, patch: 1, metadata: null, toString: function() { var version = v.format("%{major}.%{minor}.%{patch}", v.version); if (!v.isEmpty(v.version.metadata)) { version += "+" + v.version.metadata; } return version; } }, // 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: "<attribute name>", error: "<validation result>"}, ...] 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); } // Loops through each constraints, finds the correct validator and run it. for (attr in constraints) { value = v.getDeepObjectValue(attributes, attr); // This allows the constraints for an attribute to be a function. // The function will be called with the value, attribute name, the complete dict of // attributes as well as the options and constraints passed in. // This is useful when you want to have different // validations depending on the attribute value. 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]; // This allows the options to be a function. The function will be // called with the value, attribute name, the complete dict of // attributes as well as the options and constraints passed in. // This is useful when you want to have different // validations depending on the attribute value. validatorOptions = v.result(validatorOptions, value, attributes, attr, options, constraints); if (!validatorOptions) { continue; } results.push({ attribute: attr, value: value, validator: validatorName, globalOptions: options, attributes: 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) ? undefined : 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; }; // Removes unknown attributes 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) { // Create a sequence of all the results starting with a resolved promise. return results.reduce(function(memo, result) { // If this result isn't a promise skip it in the sequence. 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(); })); // A resolved promise }, // 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 !== undefined; }, // 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; } // http://stackoverflow.com/a/384380/699304 /* istanbul ignore else */ 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; // Null and undefined are empty if (!v.isDefined(value)) { return true; } // functions are non empty if (v.isFunction(value)) { return false; } // Whitespace only strings are empty if (v.isString(value)) { return v.EMPTY_STRING_REGEXP.test(value); } // For arrays we use the length property if (v.isArray(value)) { return value.length === 0; } // Dates have no attributes but aren't empty if (v.isDate(value)) { return false; } // If we find at least one property we consider it non empty 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 there are more than 2 decimals round it to two 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)) { return str.toString(); } // Ensure the string is actually a string str = "" + str; return str // Splits keys separated by periods .replace(/([^\s])\.([^\s])/g, '$1 $2') // Removes backslashes .replace(/\\+/g, '') // Replaces - and - with space .replace(/[_-]/g, ' ') // Splits camel cased words .replace(/([a-z])([A-Z])/g, function(m0, m1, m2) { return "" + m1 + " " + m2.toLowerCase(); }) .toLowerCase(); }, stringifyValue: function(value) { return v.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, array) { return array.indexOf(el) == index; }); }, forEachKeyInKeypath: function(object, keypath, callback) { if (!v.isString(keypath)) { return undefined; } 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 undefined; } return v.forEachKeyInKeypath(obj, keypath, function(obj, key) { if (v.isObject(obj)) { return obj[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: // <input type="text" name="email" value="foo@bar.com" /> // 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; } 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[input.name] || null; } } else { value = input.checked; } } else if (input.type === "radio") { if (!input.checked) { value = values[input.name] || null; } } values[input.name] = value; } inputs = form.querySelectorAll("select[name]"); for (i = 0; i < inputs.length; ++i) { input = inputs.item(i); if (input.multiple) { value = []; for (j in input.options) { option = input.options[j]; if (option.selected) { value.push(v.sanitizeFormValue(option.value, options)); } } } else { value = v.sanitizeFormValue(input.options[input.selectedIndex].value, 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) { // Removes errors without a message 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 = []; 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(v.prettify(errorInfo.attribute)) + " " + error; } error = error.replace(/\\\^/g, "^"); error = v.format(error, {value: v.stringifyValue(errorInfo.value)}); ret.push(v.extend({}, errorInfo, {error: error})); }); return ret; }, // In: // [{attribute: "<attributeName>", ...}] // Out: // {"<attributeName>": [{attribute: "<attributeName>", ...}]} 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: "<message 1>", ...}, {error: "<message 2>", ...}] // Out: // ["<message 1>", "<message 2>"] 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(whitelist) { var ow = {} , attr; for (attr in whitelist) { if (!whitelist[attr]) { continue; } v.forEachKeyInKeypath(ow, attr, whitelistCreator); } return ow; } function cleanRecursive(attributes, whitelist) { if (!v.isObject(attributes)) { return attributes; } var ret = v.extend({}, attributes) , w , attribute; for (attribute in attributes) { w = whitelist[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(validate, root, exports, module, define) { if (exports) { if (module && module.exports) { exports = module.exports = validate; } exports.validate = validate; } else { root.validate = validate; if (validate.isFunction(define) && define.amd) { define([], function () { return validate; }); } } }, 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); } } }); validate.validators = { // Presence validates that the value isn't empty presence: function(value, options) { options = v.extend({}, this.options, options); if (options.allowEmpty ? !v.isDefined(value) : v.isEmpty(value)) { return options.message || this.message || "can't be blank"; } }, length: function(value, options, attribute) { // Empty values are allowed 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)) { v.error(v.format("Attribute %{attr} has a non numeric value for `length`", {attr: attribute})); return options.message || this.notValid || "has an incorrect length"; } // Is checks 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) { // Empty values are fine if (!v.isDefined(value)) { return; } options = v.extend({}, this.options, options); var errors = [] , name , count , checks = { greaterThan: function(v, c) { return v > c; }, greaterThanOrEqualTo: function(v, c) { return v >= c; }, equalTo: function(v, c) { return v === c; }, lessThan: function(v, c) { return v < c; }, lessThanOrEqualTo: function(v, c) { return v <= c; }, divisibleBy: function(v, c) { return v % c === 0; } }; // Strict will check that it is a valid looking number 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"; } } // Coerce the value to a number unless we're being strict. if (options.noStrings !== true && v.isString(value) && !v.isEmpty(value)) { value = +value; } // If it's not a number we shouldn't continue since it will compare it. if (!v.isNumber(value)) { return options.message || options.notValid || this.notValid || this.message || "is not a number"; } // Same logic as above, sort of. Don't bother with comparisons if this // doesn't pass. 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)) { // This picks the default message if specified // For example the greaterThan check uses the message from // this.notGreaterThan so we capitalize the name and prepend "not" var key = "not" + v.capitalize(name); var msg = options[key] || this[key] || this.message || "must be %{type} %{count}"; errors.push(v.format(msg, { count: count, type: v.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"); } // Empty values are fine 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); // 86400000 is the number of seconds in a day, this is used to remove // the time from the date if (isNaN(value) || options.dateOnly && value % 86400000 !== 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; // Empty values are allowed 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) { // Empty values are fine 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: value}); }, exclusion: function(value, options) { // Empty values are fine 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"; return v.format(message, {value: value}); }, email: v.extend(function(value, options) { options = v.extend({}, this.options, options); var message = options.message || this.message || "is not a valid email"; // Empty values are fine if (!v.isDefined(value)) { return; } if (!v.isString(value)) { return message; } if (!this.PATTERN.exec(value)) { return message; } }, { PATTERN: /^[a-z0-9\u007F-\uffff!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9\u007F-\uffff!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z]{2,}$/i }), equality: function(value, options, attribute, attributes) { 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; }; if (!comparator(value, otherValue, options, attribute, attributes)) { return v.format(message, {attribute: v.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; if (!v.isString(value)) { return message; } // https://gist.github.com/dperini/729294 var regex = "^" + // protocol identifier "(?:(?:" + schemes.join("|") + ")://)" + // user:pass authentication "(?:\\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]))" + "|" + // host name "(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)" + // domain name "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*" + tld + ")" + // port number "(?::\\d{2,5})?" + // resource path "(?:[/?#]\\S*)?" + "$"; var PATTERN = new RegExp(regex, 'i'); if (!PATTERN.exec(value)) { return message; } } }; validate.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; } }; validate.exposeModule(validate, this, exports, module, define); }).call(commonjsGlobal, /* istanbul ignore next */ exports , /* istanbul ignore next */ module , null); }); /** * lodash (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors <https://jquery.org/> * Released under MIT license <https://lodash.com/license> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 1.7976931348623157e+308, NAN = 0 / 0; /** `Object#toString` result references. */ var funcTag = '[object Function]', genTag = '[object GeneratorFunction]', symbolTag = '[object Symbol]'; /** Used to match leading and trailing whitespace. */ var reTrim = /^\s+|\s+$/g; /** Used to detect bad signed hexadecimal string values. */ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; /** Used to detect binary string values. */ var reIsBinary = /^0b[01]+$/i; /** Used to detect octal string values. */ var reIsOctal = /^0o[0-7]+$/i; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeCeil = Math.ceil, nativeMax = Math.max; /** * The base implementation of `_.range` and `_.rangeRight` which doesn't * coerce arguments. * * @private * @param {number} start The start of the range. * @param {number} end The end of the range. * @param {number} step The value to increment or decrement by. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Array} Returns the range of numbers. */ function baseRange(start, end, step, fromRight) { var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result = Array(length); while (length--) { result[fromRight ? length : ++index] = start; start += step; } return result; } /** * Creates a `_.range` or `_.rangeRight` function. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new range function. */ function createRange(fromRight) { return function(start, end, step) { if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { end = step = undefined; } // Ensure the sign of `-0` is preserved. start = toFinite(start); if (end === undefined) { end = start; start = 0; } else { end = toFinite(end); } step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); return baseRange(start, end, step, fromRight); }; } /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (typeof value == 'number' || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); } /** * Checks if the given arguments are from an iteratee call. * * @private * @param {*} value The potential iteratee value argument. * @param {*} index The potential iteratee index or key argument. * @param {*} object The potential iteratee object argument. * @returns {boolean} Returns `true` if the arguments are from an iteratee call, * else `false`. */ function isIterateeCall(value, index, object) { if (!isObject(object)) { return false; } var type = typeof index; if (type == 'number' ? (isArrayLike(object) && isIndex(index, object.length)) : (type == 'string' && index in object) ) { return eq(object[index], value); } return false; } /** * Performs a * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ function eq(value, other) { return value === other || (value !== value && other !== other); } /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ function isArrayLike(value) { return value != null && isLength(value.length) && !isFunction(value); } /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } /** * Checks if `value` is a valid array-like length. * * **Note:** This method is loosely based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value; return !!value && (type == 'object' || type == 'function'); } /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return !!value && typeof value == 'object'; } /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol(value) { return typeof value == 'symbol' || (isObjectLike(value) && objectToString.call(value) == symbolTag); } /** * Converts `value` to a finite number. * * @static * @memberOf _ * @since 4.12.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted number. * @example * * _.toFinite(3.2); * // => 3.2 * * _.toFinite(Number.MIN_VALUE); * // => 5e-324 * * _.toFinite(Infinity); * // => 1.7976931348623157e+308 * * _.toFinite('3.2'); * // => 3.2 */ function toFinite(value) { if (!value) { return value === 0 ? value : 0; } value = toNumber(value); if (value === INFINITY || value === -INFINITY) { var sign = (value < 0 ? -1 : 1); return sign * MAX_INTEGER; } return value === value ? value : 0; } /** * Converts `value` to a number. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. * @example * * _.toNumber(3.2); * // => 3.2 * * _.toNumber(Number.MIN_VALUE); * // => 5e-324 * * _.toNumber(Infinity); * // => Infinity * * _.toNumber('3.2'); * // => 3.2 */ function toNumber(value) { if (typeof value == 'number') { return value; } if (isSymbol(value)) { return NAN; } if (isObject(value)) { var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; } if (typeof value != 'string') { return value === 0 ? value : +value; } value = value.replace(reTrim, ''); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : (reIsBadHex.test(value) ? NAN : +value); } /** * Creates an array of numbers (positive and/or negative) progressing from * `start` up to, but not including, `end`. A step of `-1` is used if a negative * `start` is specified without an `end` or `step`. If `end` is not specified, * it's set to `start` with `start` then set to `0`. * * **Note:** JavaScript follows the IEEE-754 standard for resolving * floating-point values which can produce unexpected results. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {number} [start=0] The start of the range. * @param {number} end The end of the range. * @param {number} [step=1] The value to increment or decrement by. * @returns {Array} Returns the range of numbers. * @see _.inRange, _.rangeRight * @example * * _.range(4); * // => [0, 1, 2, 3] * * _.range(-4); * // => [0, -1, -2, -3] * * _.range(1, 5); * // => [1, 2, 3, 4] * * _.range(0, 20, 5); * // => [0, 5, 10, 15] * * _.range(0, -4, -1); * // => [0, -1, -2, -3] * * _.range(1, 4, 0); * // => [1, 1, 1] * * _.range(0); * // => [] */ var range = createRange(); var lodash_range = range; const creditCardContraints = { cardNumber: { presence: true }, 'expiresOn.month': { numericality: { greaterThan: 0, lessThan: 13, onlyInteger: true } }, 'expiresOn.year': { numericality: { greaterThan: 1981, lessThan: 3000, onlyInteger: true } } }; const CreditCardDetails = Ractive.extend({ isolated: true, template : template$x, css: css_248z$e, components: { ButtonCopyToClipboard, ButtonRevealSecret, ValidatedInput, ErrorLabel }, data: () => { return { CONST: CONST, processing: false, // true if form action has been triggered // formatCreditCardNumber function contains " character, and it breaks // Ractive rendering so we are creating closure here in order to work // around this problem. formatCreditCardNumber: formatCreditCardNumber_1.bind(null), creditCard: null, initialCcData: null, isCardNumberRevealed: false, isPinRevealed: false, isCvvRevealed: false, apiError: '', isValidCcNumber: true, hasFocusMovedOutOfNumber: false }; }, computed: { hasErrors: function() { return Object.keys(this.get('errors')).length > 0; }, errors: function() { var creditCard = this.get('creditCard'); if (!creditCard) return {}; // Cleanup data for validation creditCard.expiresOn.month = creditCard.expiresOn.month === '' ? null : creditCard.expiresOn.month; creditCard.expiresOn.year = creditCard.expiresOn.year === '' ? null : creditCard.expiresOn.year; var validateResult = validate(creditCard, creditCardContraints) || {}; creditCard = null; return validateResult; }, maskedCardNumber: function() { return maskCreditCardNumber_1(this.get('creditCard.cardNumber')); }, label: function() { return getCreditCardLabel_1(this.get('creditCard')); }, cardIcon: function() { return getCreditCardIcon_1(this.get('creditCard')); }, expirationMonths: function() { return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; }, expirationYears: function() { var currentYear = new Date().getUTCFullYear(); var expirationYears = lodash_range(currentYear, currentYear + 20); var expiresOnYear = this.get('creditCard.expiresOn.year'); if (expiresOnYear && expiresOnYear < currentYear) { expirationYears.unshift(expiresOnYear); } return expirationYears; }, expiresOn: function() { var creditCard = this.get('creditCard'); if (!creditCard) return ''; if (!creditCard.expiresOn) { creditCard = null; return ''; } var expiration = formatExpireDate_1(creditCard.expiresOn); creditCard = null; return expiration; }, isCcWarningVisible: function() { return (this.get('initialCcData.cardNumber') || this.get('hasFocusMovedOutOfNumber') || this.get('submitted') ) && !this.get('isValidCcNumber'); } }, oninit() { var itemUID = this.get('creditCard.itemUID'); this.set('initialCcData', preventTwoWayBinding(this.get('creditCard'))); if (itemUID) { this.getCreditCardDetail(itemUID) .then(response => { this.set('initialCcData', preventTwoWayBinding(response)); this.set('creditCard', preventTwoWayBinding(response)); response = null; }); } this.observe('creditCard.cardNumber', () => { this.set('isValidCcNumber', this.get('creditCard.cardNumber') && nodeLuhn(this.get('creditCard.cardNumber').replace(/\s/g, '')) ); }); if (itemUID) { // Otherwise it's a "New card" dialog NAPI$1.track.view('PrivacyPasswords/Credit Card/Detail'); track.creditCard.viewDetail(); this.set('creditCard.cardNumber', formatCreditCardNumber_1(this.get('creditCard.cardNumber'))); } this.on('edit', () => { NAPI$1.track.view('PrivacyPasswords/Credit Card/Edit'); this.set('mode', CONST.MODES.CREDIT_CARD_EDIT); }); this.on('cancelEdit', () => { NAPI$1.track.view('PrivacyPasswords/Credit Card/Detail'); this.set('apiError', ''); this.set('mode', CONST.MODES.CREDIT_CARD_VIEW); this.set('creditCard', preventTwoWayBinding(this.get('initialCcData'))); }); this.on('submit', (event) => { event.original.preventDefault(); var data = this.get('creditCard'); this.set('submitted', true); // Validation if (this.get('hasErrors')) { return null; } // Encrypt if necessary if (PamCrypto$1.dataCryptoEnabled){ data.cardholderName = data.cardholderName? PamCrypto$1.encrypt(data.cardholderName) : data.cardholderName; data.cvv = data.cvv ? PamCrypto$1.encrypt(data.cvv) : data.cvv; data.pin = data.pin ? PamCrypto$1.encrypt(data.pin) : data.pin; data.note = data.note ? PamCrypto$1.encrypt(data.note) : data.note; } // Cleanup data for API data.cardNumber = cleanCreditCardNumber_1(data.cardNumber); data.cardholderName = data.cardholderName || ''; data.customName = data.customName || ''; data.expiresOn = data.expiresOn || {}; data.expiresOn.month = data.expiresOn.month ? parseInt(data.expiresOn.month) : null; data.expiresOn.year = data.expiresOn.year ? parseInt(data.expiresOn.year) : null; data.cvv = data.cvv; data.pin = data.pin; data.note = data.note || ''; this.clearApiError(); this.set('processing', true); if (this.get('mode') === CONST.MODES.CREDIT_CARD_EDIT) { return NAPI$1.request('app.pam.UpdateCreditCard', data) .then(() => { track.creditCard.edited(); data = null; this.fire('edited'); }) .catch(err => this.setApiError('UpdateCreditCard', err)) .then(() => this.set('processing', false)); } else { return NAPI$1.request('app.pam.AddCreditCard', data) .then(() => { track.creditCard.createNew(); data = null; this.fire('edited'); }) .catch(err => this.setApiError('AddCreditCard', err)) .then(() => this.set('processing', false)); } }); this.on('delete', (event, itemUID) => { this.clearApiError(); this.set('processing', true); return NAPI$1.request('app.pam.DeleteCreditCard', {itemUID: itemUID}) .then(() => { track.creditCard.deleted(); this.fire('edited'); }) .catch(err => this.setApiError('DeleteCreditCard', err)) .then(() => this.set('processing', false)); }); this.on('inputNumberBlured', () => { setTimeout(() => { // this timeout is needed, otherwise the focus remains on the number when the warning becomes visible this.set('hasFocusMovedOutOfNumber', true); }); }); }, // oninit getCreditCardDetail(itemUID) { return NAPI$1.request('app.pam.GetCreditCardDetail', {itemUID: parseInt(itemUID)}) .then(response => { if (PamCrypto$1.dataCryptoEnabled){ // eslint-disable-next-line max-len response.cardholderName = response.cardholderName ? PamCrypto$1.decrypt(response.cardholderName) : response.cardholderName; response.cvv = response.cvv ? PamCrypto$1.decrypt(response.cvv) : response.cvv; response.pin = response.pin ? PamCrypto$1.decrypt(response.pin) : response.pin; response.note = response.note ? PamCrypto$1.decrypt(response.note) : response.note; } return response; }) .catch(response => { console.error('GetCreditCardDetail', response); }); }, clearApiError() { this.set('apiError', ''); }, setApiError(request, error) { this.set('apiError', Ractive.localization.nls(request === 'DeleteCreditCard' ? 'passwords.errorLabel.delete' : 'passwords.errorLabel.save')); console.error(request, error); }, onteardown() { this.set('creditCard', null); this.set('initialCcData', null); } }); const CreditCards = Ractive.extend({ template: template$v, components: { CreditCardItem, CreditCardDetails, EmptyScreen }, computed: { isEmptyVault: function() { this.fire('vaultChanged'); return this.isEmpty(); } }, data: () => { return { currentCreditCard: null, creditCardsFeature: false, allCreditCards: [], CONST: CONST }; }, oninit() { this.on('addCreditCard', () => { this._addCreditCard(); }); this.on('EmptyScreen.addCreditCard', () => { this._addCreditCard(); }); this.on('CreditCardDetails.edited', () => { this.updateAllCreditCards(); this.set('mode', CONST.MODES.LISTVIEW); }); this.on('CreditCardItem.viewCreditCard', (event, id) => { var currentCreditCard = this.get('allCreditCards').find( x => x.itemUID === id); this.set('currentCreditCard', currentCreditCard); this.set('mode', CONST.MODES.CREDIT_CARD_VIEW); }); this.on('CreditCardDetails.close', () => { this.set('mode', CONST.MODES.LISTVIEW); }); }, isEmpty() { return this.get('allCreditCards').length === 0; }, /** * Updates data of the allCreditCards */ updateAllCreditCards() { return fetchFeatureFlag('CreditCardsFeature') .then(isEnabled => { this.set('creditCardsFeature', isEnabled); if (!isEnabled) return null; return NAPI.request('app.pam.GetCreditCards', {}) .then(response => { this.set('allCreditCards', response); }) .catch(response => { console.error('updateAllCreditCards error:', response); }); }); }, searchCreditCards(query) { var loQuery = query.toLowerCase(); this.get('allCreditCards').forEach(r => { r.filter = (getCreditCardLabel_1(r).toLowerCase().indexOf(loQuery) > -1) ? '' : 'filtered_out'; }); return this.update('allCreditCards'); }, _addCreditCard() { this.set('currentCreditCard', null); this.set('mode', CONST.MODES.CREDIT_CARD_ADD); } }); const template$y = {"v":3,"t":[{"t":4,"f":[{"t":4,"f":[{"t":7,"e":"Modal","a":{"cssCls":"pam_detail_modal","scrollable":0,"autoClose":0,"title":[{"t":4,"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.addNote\")"}}],"n":50,"x":{"r":["mode","CONST.MODES.NOTEADD"],"s":"_0===_1"}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["mode","CONST.MODES.NOTEVIEW"],"s":"_0===_1"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.noteDetail\")"}}]},{"t":4,"n":50,"x":{"r":["CONST.MODES.NOTEVIEW","mode","CONST.MODES.NOTEEDIT"],"s":"(!(_1===_0))&&(_1===_2)"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.editNote\")"}}]}],"x":{"r":["mode","CONST.MODES.NOTEADD"],"s":"_0===_1"}}]},"f":[{"t":7,"e":"NoteDetails","a":{"mode":[{"t":2,"r":"mode"}],"noteId":[{"t":2,"r":"noteId"}]}}]}],"n":50,"x":{"r":["CONST.MODES.NOTEADD","CONST.MODES.NOTEVIEW","mode","CONST.MODES.NOTEEDIT"],"s":"_2===_0||_2===_1||_2===_3"}}," ",{"t":4,"f":[{"t":7,"e":"EmptyScreen","a":{"screen":"secureNotes"}}],"n":50,"x":{"r":["loading","isEmptyVault"],"s":"_0===false&&_1"}},{"t":4,"n":51,"f":[{"t":7,"e":"div","a":{"class":"pam_section_title"},"f":[{"t":7,"e":"h2","a":{"class":"h2"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.secureNotes\")"}}]}]}," ",{"t":7,"e":"div","a":{"class":"pam_section_content"},"f":[{"t":7,"e":"ul","a":{"class":"longgrid -wrap"},"f":[{"t":4,"f":[{"t":8,"r":"note"}],"n":52,"r":"allNotes"}," ",{"t":7,"e":"li","a":{"class":"longgrid__2 -margins"},"f":[{"t":7,"e":"Cube","v":{"click":"addNote"},"a":{"cssCls":"-add -dashed -banner pam_item","label":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.addNote\")"}}]}}]}]}]}],"x":{"r":["loading","isEmptyVault"],"s":"_0===false&&_1"}}],"n":50,"x":{"r":["subPage"],"s":"_0===\"secureNotes\""}}],"p":{"note":[{"t":7,"e":"li","a":{"class":["longgrid__2 -margins ",{"t":2,"r":"filter"}]},"f":[{"t":7,"e":"button","a":{"class":"cube -banner pam_item"},"v":{"click":{"n":"viewNote","d":[{"t":2,"r":"itemUID"}]}},"f":[{"t":7,"e":"span","a":{"class":"cube__icon pam_color","style":["background-color:",{"t":2,"rx":{"r":"CONST.COLORS","m":[{"r":["color"],"s":"_0-1"}]}}]},"f":[{"t":7,"e":"Icon","a":{"name":"securenotes","cssCls":"pam_note"}}]}," ",{"t":7,"e":"span","a":{"class":"cube__label pam_single_line"},"f":[{"t":2,"r":"label"}]}]}]}]}}; var css_248z$f = ""; const SecureNotes = Ractive.extend({ css: css_248z$f, template: template$y, components: { EmptyScreen }, computed: { isEmptyVault: function() { this.fire('vaultChanged'); return this.isEmpty(); } }, data: () => { return { allNotes: [], CONST: CONST }; }, oninit() { this.on('addNote', () => { this._addNote(); }); this.on('EmptyScreen.addNote', () => { this._addNote(); }); this.on('viewNote', (event, id) => { this.set('noteId', id); this.set('mode', CONST.MODES.NOTEVIEW); }); this.on('NoteDetails.edited', () => { this.updateNotes(); this.set('mode', CONST.MODES.LISTVIEW); }); this.on('NoteDetails.close', () => { this.set('mode', CONST.MODES.LISTVIEW); }); }, _addNote() { this.set('mode', CONST.MODES.NOTEADD); }, isEmpty() { return this.get('allNotes').length === 0; }, updateNotes() { return this.updateAllNotes() .then(() => { var query = this.get('searchQuery'); if (query.length > 0) { this.searchNotes(query); } }); }, /** * Updates data of the allNotes */ updateAllNotes() { return NAPI.request('app.pamNotes.GetNotes', []) .then(response => { if (response.length) { response.forEach((r) => { r.filter = ''; }); response = sortAlphabetically(response, 'label'); this.set('allNotes', response); // The fix below causes Ractive memory leak // the next line replaces the code from above, fixes AV-12249 //return this.splice.apply(this, ['allNotes', 0, this.get('allNotes').length].concat(response)); } else { // GetNotes returns {} if there are no notes so let's convert it to [] this.set('allNotes', []); } }) .catch(response => { console.error('getNotes error:', response); }); }, searchNotes(query) { var loQuery = query.toLowerCase(); this.get('allNotes').forEach((r) => { r.filter = (r.label.toLowerCase().indexOf(loQuery) > -1) ? '' : 'filtered_out'; }); return this.update('allNotes'); }, }); /** * Password Manager - common functionality of all tabs **/ const List = Ractive.extend({ template: template$a, components: { PasswordDetails, NoteDetails, Panel, WaitingIdentityPanel, Browser, ImportProgress, TopMenu, StandAloneMenu: StandaloneMenu, PasswordGuardian, Accounts, CreditCards, SecureNotes }, data: () => { return { CONST: CONST, loading: false, isLicensed: undefined, ipmLoaded: undefined, searchQuery: '', shouldInstallExtension: false, browsersToInstallExtension: [], installBrowserId: '', // Waiting identities waitingIdentities: [], // Pending browser deletes processingBrowserDeletes: false, pendingBrowserDeletes: [], subPage: 'accounts', // Default subpage isEmptyVault: { creditCards: undefined, accounts: undefined, secureNotes: undefined } }; }, computed: { showSyncStoppedPanel: function() { // showSyncStopped set on parent(index.js) return this.get('showSyncStopped'); }, hasPendingBrowserDeletes: function() { return this.get('pendingBrowserDeletes').length > 0; }, showPendingBrowserDeletesPanel: function() { return this.get('hasPendingBrowserDeletes') && // Display only on accounts and creditCars, if they are not empty (this._isOnEmptyScreen('accounts') || this._isOnEmptyScreen('creditCards')); }, showInstallExtensionPanel: function() { return this.get('shouldInstallExtension') && // Display only on accounts and creditCars, if they are not empty (this._isOnEmptyScreen('accounts') || this._isOnEmptyScreen('creditCards')); }, showWaitingIdentitiesPanel: function() { return this.get('waitingIdentities').length > 0 && // Display everywhere, if not empty (this._isOnEmptyScreen('passwordGuardian') || this._isOnEmptyScreen('accounts') || this._isOnEmptyScreen('creditCards') || this._isOnEmptyScreen('secureNotes')); }, isAnyPanelDisplayed: function() { return this.get('showPendingBrowserDeletesPanel') || this.get('showInstallExtensionPanel') || this.get('showWaitingIdentitiesPanel'); }, showIpmBanner: function() { if (this.get('isAnyPanelDisplayed')) return false; if (this.get('isLicensed')) return false; // Display IPM only on accounts tab, if accounts are not empty if (this._isOnEmptyScreen('accounts')) return true; }, showSearchField: function() { // Display everywhere except from PasswordGuardian, if not empty return (!this.get('subPage') === 'passwordGuardian' || this._isOnEmptyScreen('accounts') || this._isOnEmptyScreen('creditCards') || this._isOnEmptyScreen('secureNotes')); } }, oninit() { this.listeners = []; this.accounts = this.findComponent('Accounts'); this.secureNotes = this.findComponent('SecureNotes'); this.creditCards = this.findComponent('CreditCards'); this.recentlyInstalledExtensionFinder = new RecentlyInstalledExtensionFinder(); NAPI$1.request('app.pam.OnOpeningMainScreen'); this._addRactiveListeners(); this.set('mode', CONST.MODES.LISTVIEW); this.set('loading', true); NAPI$1.request('app.pam.IsPAMLicensed') .then(licensed => { this.set('isLicensed', licensed); return Promise.all([ this._updatePasswords(), this.secureNotes.updateAllNotes(), this.creditCards.updateAllCreditCards() ]); }).then(() => { this._addListeners(); this._setIsEmptyVault(); this.set('loading', false); this.fire('loaded', true); }); // Fetch & watch pending browser deletes. fetchFeatureFlag('DeleteBrowserPasswordsFeature') .then(enabled => { if (!enabled) return; NAPI$1.request('app.pam.GetPendingBrowserDeletes').then(pendingBrowserDeletes => { if (pendingBrowserDeletes.length > 0) { track.panel.showPendingBrowserDelete(); } this.setPendingBrowserDeletes(pendingBrowserDeletes); }).catch(response => console.error('GetPendingBrowserDeletes error:', response)); this.listeners.push(NAPI$1.on('app.pam.onStatusChanged.pendingBrowserDeletes', pendingBrowserDeletes => { if (pendingBrowserDeletes.length === 0) { track.panel.resolvedPendingBrowserDelete(); } this.setPendingBrowserDeletes(pendingBrowserDeletes); })); }); // Fetch & watch status of extension in supported browsers. this.updateBrowserExtensionStatus(); }, setPendingBrowserDeletes(pendingBrowserDeletes) { setTimeout(() => this.set('processingBrowserDeletes', false), 1000); this.set('pendingBrowserDeletes', pendingBrowserDeletes); }, /** * Updates browser extension installation status */ updateBrowserExtensionStatus() { return NAPI$1.request('app.pam.GetBrowserStatus') .then(response => { const recentlyInstalled = this.recentlyInstalledExtensionFinder.find(response); if (recentlyInstalled) { focusMainWindow(); track.panel.extensionInstalled(recentlyInstalled.default); } const browsers = getBrowsersToInstallExtension(response) .map(browser => { return { id: browser.browser, name: getBrowserName(browser.browser) }; }); this.set('shouldInstallExtension', shouldInstallExtension(response)); this.set('browsersToInstallExtension', browsers); this.set('installBrowserId', browsers.length > 0 ? browsers[0].id : ''); }) .catch(response => { console.error('GetBrowserStatus error:', response); }); }, /** * Filters the data by the query string passed */ searchVault(query) { this.accounts.searchPasswords(query); this.secureNotes.searchNotes(query); this.creditCards.searchCreditCards(query); }, _setIsEmptyVault() { this.set({ isEmptyVault: { accounts: this.accounts.isEmpty(), secureNotes: this.secureNotes.isEmpty(), creditCards: this.creditCards.isEmpty() } }); }, _networkStateChanged(connected) { if (connected) { NAPI$1.request('app.pam.checkLeaks').catch(err => { console.error('app.pam.checkLeaks error: ', JSON.stringify(err)); }); } }, _updatePasswords() { return this.accounts.updatePasswords({getPasswordGuardianData: this.get('isLicensed')}); }, _addRactiveListeners() { this.observe('searchQuery', (query) => { this.searchVault(query.trim()); }, {init: false}); this.observe('subPage', (subPage) => { track.view.changed(subPage); }, {init: true}); this.on('setIpmLoaded', () => { this.set('ipmLoaded', true); }); this.on('*.setSubPage', (e, page) => { this.set('subPage', page); }); this.on('*.vaultChanged', () => { this._setIsEmptyVault(); }); this.on('Modal.close', () => { this.set('mode', CONST.MODES.LISTVIEW); }); this.on('ImportProgress.status', () => { this._updatePasswords(); }); this.on('retryBrowserDeletes', () => { this.set('processingBrowserDeletes', true); return NAPI$1.request('app.pam.DeletePendingBrowserPasswords'); }); this.on('showLoginModalClick', () => { this.fire('showLoginModal'); }); this.on('installExtensionClick', () => { const browserId = this.get('installBrowserId'); track.panel.clickExtensionInstall(browserId); NAPI$1.request('av.command', 'install_pam_plugin(browser=' + browserId + ',cn=User%20extension%20install,cs=Panel)') .catch(ex => { console.error('install_pam_plugin', JSON.stringify(ex)); }); }); }, _addListeners() { this.listeners.push(NAPI$1.on('RefreshUI', () => { this._refreshUI(); })); this.listeners.push(NAPI$1.on('app.pam.onStatusChanged.vaultRecordsChanged', (data) => { if (data.logins.anyChange) { this._updatePasswords(); } if (data.creditCards.anyChange) { this.creditCards.updateAllCreditCards(); } if (data.secureNotes.anyChange) { this.secureNotes.updateNotes(); } })); this.listeners.push(NAPI$1.on('app.pam.onStatusChanged.synchronizationDone', () => { this._updateWaitingIdentities(); })); this.listeners.push(NAPI$1.on('app.pam.onStatusChanged.browserStatus', () => { this.updateBrowserExtensionStatus(); })); this.listeners.push(NAPI$1.on('app.pam.onPasswordAdded', () => { this._updatePasswords(); })); this.listeners.push(NAPI$1.on('app.pam.onPasswordChanged', () => { this._updatePasswords(); })); this.listeners.push(NAPI$1.on('app.pam.onPasswordDeleted', () => { this._updatePasswords(); })); this.listeners.push(NAPI$1.on('app.pam.onStatusChanged.guardianChanged', () => { this._updatePasswords(); })); this.listeners.push(NAPI$1.on('app.pam.OnPAMLicenseStateChanged', (response) => { this.set('isLicensed', response.licensed); this._updatePasswords(); })); this.listeners.push(NAPI$1.on('app.pam.onInternetStateChanged', (connected) => { this._networkStateChanged(connected); })); }, _refreshUI() { this._updatePasswords(); this.secureNotes.updateNotes(); this.creditCards.updateAllCreditCards(); this._updateWaitingIdentities(); }, _isOnEmptyScreen(screenName) { if (screenName === 'passwordGuardian') { return this.get('isEmptyVault.accounts') === false; } return this.get('subPage') === screenName && this.get('isEmptyVault')[screenName] === false; }, _updateWaitingIdentities() { NAPI$1.request('app.pam.IsRegisteredAndAuthorized') .then(response => { if (response.isAuthorized) { NAPI$1.request('app.pam.GetWaitingIdentityList') .then(response => { return this.set('waitingIdentities', response.waitingIdentities); }) .catch(err => { console.error('app.pam.GetWaitingIdentityList error: ', JSON.stringify(err)); }); } }) .catch(err => { console.error('app.pam.IsRegisteredAndAuthorized error: ', JSON.stringify(err)); }); }, onteardown() { this.listeners.forEach((off) => { off(); }); } }); var css_248z$g = ".pam_settings__content {\n padding: 3rem 14rem;\n}\n.pam_line {\n border-bottom: 1px solid #000;\n opacity: 0.2;\n}\n.pam_ipm_modal .modal {\n height: 440px;\n}\n.pam_ipm_modal .modal .nui_ipm {\n margin-top: 30px;\n}\n.pam_steps {\n display: flex;\n list-style: none;\n margin: 20px 10px 0 30px;\n counter-reset: li;\n flex-direction: column;\n justify-content: space-around;\n}\n.pam_steps .pam_step {\n text-align: left;\n padding: 5px 0;\n position: relative;\n flex-grow: 1;\n font-size: 12px;\n}\n.pam_steps .pam_step:before {\n content: counter(li);\n counter-increment: li;\n position: absolute;\n left: -28px;\n top: 4px;\n border: 1px solid rgba(255,255,255,0.7);\n width: 15px;\n height: 15px;\n border-radius: 30px;\n padding-top: 2px;\n text-align: center;\n font-size: 9px;\n}\n.pam_steps .pam_step.pam_step_big {\n padding: 5px 0 10px 20px;\n}\n.pam_steps .pam_step.pam_step_big:before {\n left: -23px;\n width: 30px;\n height: 30px;\n padding-top: 4px;\n font-size: 15px;\n}\n"; const template$z = {"v":3,"t":[{"t":7,"e":"Overlay","a":{"type":"main","title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.product.AVAST_PASSWORDS\")"}}," ",{"t":3,"x":{"r":["nls"],"s":"_0(\"settings\")"}}]},"f":[{"t":7,"e":"div","a":{"class":"settings"},"f":[{"t":7,"e":"div","a":{"class":"settings__menu -single-column"},"f":[{"t":7,"e":"button","a":{"disabled":[{"t":2,"x":{"r":["loading","settingsLocked"],"s":"_0||_1"}}],"class":["settings__item ",{"t":2,"x":{"r":["category"],"s":"_0===\"security\"?\"-active\":\"\""}}]},"v":{"click":{"n":"setCategory","a":"security"}},"f":[{"t":7,"e":"Icon","a":{"name":"security"}}," ",{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.security\")"}}]}," ",{"t":7,"e":"button","a":{"disabled":[{"t":2,"x":{"r":["loading","settingsLocked"],"s":"_0||_1"}}],"class":["settings__item ",{"t":2,"x":{"r":["category"],"s":"_0===\"browserIntegration\"?\"-active\":\"\""}}]},"v":{"click":{"n":"setCategory","a":"browserIntegration"}},"f":[{"t":7,"e":"Icon","a":{"name":"passwords-browser-integration"}}," ",{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.browserIntegration\")"}}]}," ",{"t":7,"e":"button","a":{"disabled":[{"t":2,"x":{"r":["loading","settingsLocked"],"s":"_0||_1"}}],"class":["settings__item ",{"t":2,"x":{"r":["category"],"s":"_0===\"syncBackup\"?\"-active\":\"\""}}]},"v":{"click":{"n":"setCategory","a":"syncBackup"}},"f":[{"t":7,"e":"Icon","a":{"name":"passwords-sync"}}," ",{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.syncBackup\")"}}]}," ",{"t":7,"e":"button","a":{"disabled":[{"t":2,"x":{"r":["loading","settingsLocked"],"s":"_0||_1"}}],"class":["settings__item ",{"t":2,"x":{"r":["category"],"s":"_0===\"importExport\"?\"-active\":\"\""}}]},"v":{"click":{"n":"setCategory","a":"importExport"}},"f":[{"t":7,"e":"Icon","a":{"name":"passwords-import"}}," ",{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.importExport\")"}}]}]}," ",{"t":7,"e":"div","a":{"class":"settings__content pam_settings__content"},"f":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"center__wrap"},"f":[{"t":7,"e":"div","a":{"class":"center"},"f":[{"t":7,"e":"Loading","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.loading\")"}}]}}]}]}],"n":50,"x":{"r":["loading"],"s":"_0===true"}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["settingsLocked"],"s":"_0===true"},"f":[{"t":4,"f":[{"t":7,"e":"h3","a":{"class":"h3"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.locked.msg\")"}}]}," ",{"t":7,"e":"button","a":{"class":"g-margin-top--20 btn -small","data-test":"Overlay.close"},"v":{"click":"Overlay.close"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.unlock\")"}}]}],"n":50,"x":{"r":["page"],"s":"_0!==\"systemLoginError\""}}," ",{"t":7,"e":"p","a":{"class":"g-margin-top--20 p -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.locked.reset.title\")"}}]}," ",{"t":7,"e":"p","a":{"class":"p -tiny -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.locked.reset.desc\")"}}]}," ",{"t":7,"e":"p","a":{"class":"g-margin-top--20 p -small"},"f":[{"t":7,"e":"button","a":{"class":"a","data-test":"showModal:deleteVault"},"v":{"click":{"n":"showModal","a":"deleteVault"}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.locked.deleteAll\")"}}]}]}]},{"t":4,"n":50,"x":{"r":["settingsLocked","category"],"s":"(!(_0===true))&&(_1===\"security\")"},"f":[" ",{"t":7,"e":"Security"}]},{"t":4,"n":50,"x":{"r":["settingsLocked","category"],"s":"(!(_0===true))&&((!(_1===\"security\"))&&(_1===\"browserIntegration\"))"},"f":[" ",{"t":7,"e":"BrowserIntegration"}]},{"t":4,"n":50,"x":{"r":["settingsLocked","category"],"s":"(!(_0===true))&&((!(_1===\"security\"))&&((!(_1===\"browserIntegration\"))&&(_1===\"syncBackup\")))"},"f":[" ",{"t":7,"e":"SyncBackup"}]},{"t":4,"n":50,"x":{"r":["settingsLocked","category"],"s":"(!(_0===true))&&((!(_1===\"security\"))&&((!(_1===\"browserIntegration\"))&&((!(_1===\"syncBackup\"))&&(_1===\"importExport\"))))"},"f":[" ",{"t":7,"e":"ImportExport"}]}],"x":{"r":["loading"],"s":"_0===true"}}]}]}]}," ",{"t":4,"f":[{"t":7,"e":"DeleteVaultModal"}],"n":50,"x":{"r":["modalDialog"],"s":"_0===\"deleteVault\""}},{"t":4,"f":[{"t":7,"e":"AirbondModal"}],"n":50,"x":{"r":["modalDialog"],"s":"_0===\"airbond\""}}]}; var css_248z$h = ".pam_select {\n font-size: 12px;\n height: 26px;\n}\n.pam_disabled h3,\n.pam_disabled input,\n.pam_disabled label,\n.pam_disabled select {\n opacity: 0.5;\n}\n.pam_disabled .-secondary {\n opacity: 0.4;\n}\n"; const template$A = {"v":3,"t":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"center__wrap"},"f":[{"t":7,"e":"div","a":{"class":"center"},"f":[{"t":7,"e":"Loading","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.loading\")"}}]}}]}]}],"n":50,"x":{"r":["loading"],"s":"_0===true"}},{"t":4,"n":51,"f":[{"t":7,"e":"h3","a":{"class":"h3 g-margin-bottom--20"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.masterPassword\")"}}]}," ",{"t":7,"e":"p","a":{"class":"p -tiny -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.masterPassword.desc\")"}}]}," ",{"t":4,"f":[{"t":7,"e":"button","a":{"class":"g-margin-top--20 btn -small","data-test":"openMasterPasswordModal"},"v":{"click":"openMasterPasswordModal"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.masterPassword.change.btn\")"}}]}],"n":50,"r":"masterPasswordSet"},{"t":4,"n":51,"f":[{"t":7,"e":"button","a":{"class":"g-margin-top--20 btn -small","data-test":"openMasterPasswordModal"},"v":{"click":"openMasterPasswordModal"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.masterPassword.create.btn\")"}}]}],"r":"masterPasswordSet"}," ",{"t":7,"e":"div","a":{"class":"pam_line g-margin-top--20 g-margin-bottom--20"}}," ",{"t":7,"e":"div","a":{"class":[{"t":2,"x":{"r":["masterPasswordSet"],"s":"!_0?\"pam_disabled\":\"\""}}]},"f":[{"t":7,"e":"h3","a":{"class":"h3 g-margin-bottom--20"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.autoLock\")"}}]}," ",{"t":7,"e":"p","a":{"class":"p -tiny -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.autoLock.desc\")"}}]}," ",{"t":7,"e":"fieldset","m":[{"t":2,"x":{"r":["masterPasswordSet"],"s":"!_0?\"disabled\":\"\""}}],"f":[{"t":7,"e":"p","a":{"class":"p -small g-margin-top--20"},"f":[{"t":7,"e":"input","a":{"id":"lockOnLogout","class":"checkbox g-margin-right--5","type":"checkbox","checked":[{"t":2,"x":{"r":["secureSettings.lockOnLogout.value"],"s":"_0===1"}}]},"v":{"change":{"n":"setSecureSettings","a":"secureSettings.lockOnLogout"}}}," ",{"t":7,"e":"label","a":{"for":"lockOnLogout"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.lock.onClose\")"}}]}]}," ",{"t":7,"e":"p","a":{"class":"p -small g-margin-top--20"},"f":[{"t":7,"e":"input","a":{"id":"lockAfter","class":"checkbox g-margin-right--5","type":"checkbox","checked":[{"t":2,"x":{"r":["secureSettings.lockAfter.value"],"s":"_0>0"}}]},"v":{"change":{"n":"setSecureSettings","a":"secureSettings.lockAfter"}}}," ",{"t":7,"e":"label","a":{"for":"lockAfter"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.lock.after\")"}}]}," ",{"t":7,"e":"select","a":{"class":"input -small pam_select -dark","disabled":[{"t":2,"x":{"r":["secureSettings.lockAfter.value"],"s":"_0===0"}}]},"v":{"change":{"n":"setSecureSettings","a":"secureSettings.lockAfter"}},"f":[{"t":7,"e":"option","a":{"selected":[{"t":2,"x":{"r":["secureSettings.lockAfter.value"],"s":"_0===1"}}]},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.lock.after.hours\",1)"}}]}," ",{"t":7,"e":"option","a":{"selected":[{"t":2,"x":{"r":["secureSettings.lockAfter.value"],"s":"_0===2"}}]},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.lock.after.hours\",2)"}}]}," ",{"t":7,"e":"option","a":{"selected":[{"t":2,"x":{"r":["secureSettings.lockAfter.value"],"s":"_0===6"}}]},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.lock.after.hours\",6)"}}]}," ",{"t":7,"e":"option","a":{"selected":[{"t":2,"x":{"r":["secureSettings.lockAfter.value"],"s":"_0===12"}}]},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.lock.after.hours\",12)"}}]}," ",{"t":7,"e":"option","a":{"selected":[{"t":2,"x":{"r":["secureSettings.lockAfter.value"],"s":"_0===24"}}]},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.lock.after.hours\",24)"}}]}]}]}," ",{"t":7,"e":"p","a":{"class":"p -small g-margin-top--20"},"f":[{"t":7,"e":"input","a":{"id":"lockOnBrowserClose","class":"checkbox g-margin-right--5","type":"checkbox","checked":[{"t":2,"x":{"r":["secureSettings.lockOnBrowserClose.value"],"s":"_0===1"}}]},"v":{"change":{"n":"setSecureSettings","a":"secureSettings.lockOnBrowserClose"}}}," ",{"t":7,"e":"label","a":{"for":"lockOnBrowserClose"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.lock.onBrowserClose\")"}}]}]}]}]}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_line g-margin-top--20 g-margin-bottom--20"}}," ",{"t":7,"e":"div","a":{"class":[{"t":2,"x":{"r":["masterPasswordSet","syncOn"],"s":"!_0||!_1?\"pam_disabled\":\"\""}}]},"f":[{"t":7,"e":"h3","a":{"class":"h3 g-margin-bottom--20"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.oneTouchLogin\")"}}]}," ",{"t":7,"e":"p","a":{"class":"p -tiny -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.oneTouchLogin.desc\")"}}]}," ",{"t":4,"f":[{"t":7,"e":"button","a":{"disabled":[{"t":2,"x":{"r":["masterPasswordSet","syncOn"],"s":"!_0||!_1"}}],"class":"g-margin-top--20 btn -small","data-test":"toggleAirBondOn"},"v":{"click":"toggleAirBond"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.turnOn.btn\")"}}]}],"n":50,"x":{"r":["airBondActive"],"s":"!_0"}},{"t":4,"n":51,"f":[{"t":7,"e":"button","a":{"disabled":[{"t":2,"x":{"r":["masterPasswordSet","syncOn"],"s":"!_0||!_1"}}],"class":"g-margin-top--20 btn -small -secondary","data-test":"toggleAirBondOff"},"v":{"click":"toggleAirBond"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.turnOff.btn\")"}}]}],"x":{"r":["airBondActive"],"s":"!_0"}}]}],"n":50,"x":{"r":["licensed"],"s":"_0===true"}}," ",{"t":4,"f":[{"t":7,"e":"AirbondModal"}],"n":50,"x":{"r":["modalDialog"],"s":"_0===\"airbond\""}}],"x":{"r":["loading"],"s":"_0===true"}}]}; const template$B = {"v":3,"t":[{"t":4,"f":[{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.airbond.title\")"}}]},"f":[{"t":7,"e":"div","a":{"class":"g-margin-top--15 g-margin-bottom--10"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.airbond.step1.desc\")"}}]}," ",{"t":7,"e":"svg","a":{"class":"icon-mobile-ok","xmlns":"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","viewBox":"0 0 240 240"},"f":[{"t":7,"e":"defs","f":[{"t":7,"e":"circle","a":{"id":"a","cx":"120","cy":"120","r":"120"}}]},{"t":7,"e":"use","a":{"xlink:href":"#a","overflow":"visible","fill":"#E7E7EF"}},{"t":7,"e":"clipPath","a":{"id":"b"},"f":[{"t":7,"e":"use","a":{"xlink:href":"#a","overflow":"visible"}}]},{"t":7,"e":"circle","a":{"cx":"120","cy":"120","r":"120.67","clip-path":"url(#b)","fill":"#D4FFC4"}},{"t":7,"e":"radialGradient","a":{"id":"c","cx":"120","cy":"120","r":"121","gradientUnits":"userSpaceOnUse"},"f":[{"t":7,"e":"stop","a":{"offset":"0","stop-color":"#FFF","stop-opacity":"0"}},{"t":7,"e":"stop","a":{"offset":"1","stop-opacity":".05"}}]},{"t":7,"e":"circle","a":{"cx":"120","cy":"120","r":"121","clip-path":"url(#b)","fill":"url(#c)"}},{"t":7,"e":"g","a":{"clip-path":"url(#b)"},"f":[{"t":7,"e":"path","a":{"d":"M205.5 62.86L105.11 43.75c-4.84-1.19-10.49 1.94-12.65 6.99L13.82 234.16c-2.27 5.29-.35 11.13 4.3 13.05l96.12 39.64c5.39 2.22 11.72-.65 14.1-6.43l82.4-199.79c2.27-5.48.33-16.4-5.24-17.77z","fill":"#23242D"}},{"t":7,"e":"path","a":{"d":"M203.32 61.92L103.7 37.45c-4.84-1.19-10.49 1.94-12.65 6.99L12.42 227.86c-2.27 5.29-.35 11.13 4.3 13.05l96.12 39.64c5.39 2.22 11.72-.65 14.1-6.43l82.4-199.79c2.27-5.48-.45-11.04-6.02-12.41z","fill":"#4F515E"}},{"t":7,"e":"path","a":{"d":"M95.62 53.88L197.01 80.1c2.12.55 3.18 2.6 2.36 4.58l-69.69 168.67c-.85 2.07-3.22 3.09-5.29 2.28L25.86 217c-1.79-.7-2.57-2.82-1.75-4.72L90.86 56.34c.79-1.83 2.91-2.94 4.76-2.46z","fill-rule":"evenodd","clip-rule":"evenodd","fill":"#3BB151"}},{"t":7,"e":"path","a":{"d":"M75.14 255.57l-17.19-6.98c-1.07-.43-1.53-1.76-1.03-2.94l2.29-5.41c.5-1.18 1.78-1.8 2.85-1.37l17.22 6.85c1.1.44 1.59 1.78 1.08 2.98l-2.31 5.5c-.5 1.2-1.81 1.81-2.91 1.37z","fill":"#30313E"}},{"t":7,"e":"path","a":{"d":"M169.62 65.15l-43.57-11.04c-.71-.18-1.03-.92-.72-1.65l.2-.48c.31-.73 1.14-1.18 1.85-1l43.6 10.94c.75.19 1.11.96.8 1.71l-.21.49c-.32.76-1.2 1.22-1.95 1.03zM192.71 69.58c-.74 1.79-2.81 2.87-4.61 2.41-1.8-.46-2.66-2.27-1.92-4.06.74-1.78 2.8-2.86 4.6-2.41 1.81.45 2.67 2.27 1.93 4.06z","fill":"#23242D"}},{"t":7,"e":"path","a":{"d":"M122.07 119.66C107 115.15 89.64 124.2 83 139.85c-6.67 15.71-.22 32.57 14.7 37.71 15.24 5.25 33.37-3.71 40.19-20.06 6.79-16.27-.43-33.23-15.82-37.84zm13.77 37.19c-6.31 15.13-23.1 23.44-37.22 18.59-13.84-4.75-19.83-20.38-13.64-34.95 6.16-14.51 22.26-22.9 36.23-18.7 14.24 4.27 20.92 19.98 14.63 35.06zm-8.69-13.07c-.23-.55-.88-.75-1.46-.46l-22.87 11.59-3.9-9.78c-.21-.54-.84-.74-1.41-.45l-.39.2c-.56.29-.85.96-.63 1.5l4.37 11.01c.12.3.38.49.67.56.28.13.62.15.95-.02l24.19-12.23c.58-.29.86-.97.64-1.52l-.16-.4z","fill-rule":"evenodd","clip-rule":"evenodd","fill":"#FFF"}}]}]}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--15 g-margin-bottom--20 g-font--small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.airbond.step1.desc2\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","class":"btn"},"v":{"click":{"n":"goTo","a":"step2"}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.airbond.step1.btn.start\")"}}]}]}],"n":50,"x":{"r":["page"],"s":"_0===\"step1\""}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["page"],"s":"_0===\"step2\""},"f":[{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.airbond.title\")"}}]},"f":[{"t":7,"e":"div","a":{"class":"g-margin-top--15 g-margin-bottom--20"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.airbond.step2.desc\")"}}]}," ",{"t":7,"e":"div","a":{"class":"g-clearfix step2-icon-wrapper"},"f":[{"t":7,"e":"div","a":{"class":"column"},"f":[{"t":7,"e":"svg","a":{"class":"icon-android","xmlns":"http://www.w3.org/2000/svg","viewBox":"0 0 40 40"},"f":[{"t":7,"e":"g","a":{"fill":"#ffffff"},"f":[{"t":7,"e":"path","a":{"d":"M20 13.42h10.82c.21 0 .21 0 .21.21v15.75c0 1.5-1.18 2.69-2.69 2.7h-1.58c-.14 0-.18.03-.18.17v5.29c0 1.15-.77 2.13-1.88 2.39-1.69.39-3.04-.91-3.05-2.32-.01-1.78-.01-3.56 0-5.34 0-.15-.02-.2-.19-.2-.97.01-1.95.01-2.92 0-.16 0-.19.05-.19.2 0 1.78.01 3.56 0 5.34-.01 1.28-1.05 2.32-2.33 2.38-1.22.06-2.26-.72-2.54-1.89-.05-.18-.06-.37-.06-.56v-5.29c0-.15-.04-.18-.18-.17-.53.01-1.07 0-1.6 0-1.48 0-2.67-1.2-2.67-2.68V13.64c0-.21 0-.21.2-.21 3.61-.01 7.22-.01 10.83-.01zM19.98 12.54H9.16c-.2 0-.2 0-.19-.2.03-.87.14-1.73.39-2.57.43-1.43 1.17-2.68 2.19-3.77.86-.92 1.82-1.7 2.93-2.29.11-.06.06-.11.03-.17L12.86.57c-.11-.21-.07-.4.1-.5.2-.11.39-.06.5.15l1.08 1.95c.2.36.4.71.59 1.07.05.1.1.11.2.07.9-.4 1.84-.65 2.81-.79 1.07-.15 2.14-.17 3.21-.06 1.14.12 2.24.39 3.29.85.11.05.15.01.21-.08.55-1 1.11-2 1.67-3 .08-.15.25-.23.38-.2.17.04.27.17.29.35.01.09-.04.17-.08.24-.54.98-1.08 1.95-1.63 2.93-.06.11-.04.15.06.21 2 1.13 3.58 2.67 4.6 4.76.46.95.73 1.97.82 3.03.02.28.03.57.06.85.01.13-.02.17-.16.17h-3.77c-2.37-.03-4.74-.03-7.11-.03zm6.03-4.95c0-.51-.41-.93-.91-.93s-.92.41-.92.9c0 .51.42.94.93.94.49 0 .89-.4.9-.91zm-12.02-.01c0 .51.42.93.92.92.51-.01.92-.43.92-.93s-.44-.92-.94-.91c-.5.01-.9.42-.9.92zM3.1 20.61v-5.06c0-1.06.47-1.86 1.41-2.31 1.68-.8 3.42.43 3.52 2 .01.13.02.27.02.4v10.1c0 .72-.25 1.33-.77 1.83-1.06 1.01-2.75.88-3.65-.27-.37-.48-.53-1.02-.53-1.62v-5.07zM36.9 20.62v5.05c0 1.1-.48 1.93-1.48 2.36-1.74.76-3.36-.55-3.45-2.02-.01-.15-.02-.3-.02-.45V15.5c0-1.24.85-2.26 2.07-2.46 1.6-.26 2.77.98 2.85 2.17l.03.51v4.9z"}}]}]}]}," ",{"t":7,"e":"div","a":{"class":"column"},"f":[{"t":7,"e":"svg","a":{"class":"icon-ios","xmlns":"http://www.w3.org/2000/svg","viewBox":"0 0 40 40"},"f":[{"t":7,"e":"path","a":{"d":"M32.48 20.8c0-3.23 1.66-6.07 4.19-7.78-2.05-2.45-5-3.97-8.3-3.97-2.98 0-6.02 1.72-7.64 1.72s-4.66-1.72-7.64-1.72c-6.15 0-11.16 5.27-11.16 12.03C1.93 31.6 8.9 40 13.68 40c2.74 0 4.85-1.72 7.05-1.72S25.05 40 27.78 40c3.43 0 7.98-4.32 10.28-10.64-3.29-1.51-5.58-4.77-5.58-8.56zm-6.01-14C28.73 4.01 28.31 0 28.31 0s-4.1.5-6.38 3.29-1.85 6.8-1.85 6.8 4.12-.51 6.39-3.29z","fill":"#ffffff"}}]}]}]}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--30 g-margin-bottom--20 g-font--small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.airbond.step2.desc2\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","class":"btn"},"v":{"click":{"n":"goTo","a":"step3"}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.airbond.step2.btn.ready\")"}}]}]}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"step2\"))&&(_0===\"step3\")"},"f":[" ",{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.airbond.title\")"}}]},"f":[{"t":7,"e":"div","a":{"class":"g-margin-top--15"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.airbond.step3.desc\")"}}]}," ",{"t":7,"e":"div","a":{"class":"white-block g-margin-top--15"},"f":[{"t":7,"e":"div","a":{"class":"g-margin-top--15 g-padding-top--10 g-margin-bottom--10 black-font"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.airbond.step3.desc2\")"}}]}," ",{"t":7,"e":"div","a":{"class":"g-clearfix step3-icon-wrapper"},"f":[{"t":7,"e":"div","a":{"class":"column g-margin-top--5 g-margin-bottom--5 g-margin-left--5"},"f":[{"t":7,"e":"svg","a":{"class":"icon-mobile-qr","xmlns":"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","viewBox":"0 0 240 240"},"f":[{"t":7,"e":"defs","f":[{"t":7,"e":"circle","a":{"id":"first","cx":"120","cy":"120","r":"120"}}]},{"t":7,"e":"use","a":{"xlink:href":"#first","overflow":"visible","fill":"#E7E7EF"}},{"t":7,"e":"clipPath","a":{"id":"second"},"f":[{"t":7,"e":"use","a":{"xlink:href":"#first","overflow":"visible"}}]},{"t":7,"e":"circle","a":{"cx":"120","cy":"120","r":"120.67","clip-path":"url(#second)","fill":"#C4F0FF"}},{"t":7,"e":"radialGradient","a":{"id":"third","cx":"120","cy":"120","r":"121","gradientUnits":"userSpaceOnUse"},"f":[{"t":7,"e":"stop","a":{"offset":"0","stop-color":"#FFF","stop-opacity":"0"}},{"t":7,"e":"stop","a":{"offset":"1","stop-opacity":".05"}}]},{"t":7,"e":"circle","a":{"cx":"120","cy":"120","r":"121","clip-path":"url(#second)","fill":"url(#third)"}},{"t":7,"e":"g","a":{"clip-path":"url(#second)"},"f":[{"t":7,"e":"path","a":{"d":"M205.5 62.86L105.11 43.75c-4.84-1.19-10.49 1.94-12.65 6.99L13.82 234.16c-2.27 5.29-.35 11.13 4.3 13.05l96.12 39.64c5.39 2.22 11.72-.65 14.1-6.43l82.4-199.79c2.27-5.48.33-16.4-5.24-17.77z","fill":"#23242D"}},{"t":7,"e":"path","a":{"d":"M203.32 61.92L103.7 37.45c-4.84-1.19-10.49 1.94-12.65 6.99L12.42 227.86c-2.27 5.29-.35 11.13 4.3 13.05l96.12 39.64c5.39 2.22 11.72-.65 14.1-6.43l82.4-199.79c2.27-5.48-.45-11.04-6.02-12.41z","fill":"#4F515E"}},{"t":7,"e":"path","a":{"d":"M95.62 53.88L197.01 80.1c2.12.55 3.18 2.6 2.36 4.58l-69.69 168.67c-.85 2.07-3.22 3.09-5.29 2.28L25.86 217c-1.79-.7-2.57-2.82-1.75-4.72L90.86 56.34c.79-1.83 2.91-2.94 4.76-2.46z","fill-rule":"evenodd","clip-rule":"evenodd","fill":"#F2F2F6"}},{"t":7,"e":"path","a":{"d":"M75.14 255.57l-17.19-6.98c-1.07-.43-1.53-1.76-1.03-2.94l2.29-5.41c.5-1.18 1.78-1.8 2.85-1.37l17.22 6.85c1.1.44 1.59 1.78 1.08 2.98l-2.31 5.5c-.5 1.2-1.81 1.81-2.91 1.37z","fill":"#30313E"}},{"t":7,"e":"path","a":{"d":"M169.62 65.15l-43.57-11.04c-.71-.18-1.03-.92-.72-1.65l.2-.48c.31-.73 1.14-1.18 1.85-1l43.6 10.94c.75.19 1.11.96.8 1.71l-.21.49c-.32.76-1.2 1.22-1.95 1.03zM192.71 69.58c-.74 1.79-2.81 2.87-4.61 2.41-1.8-.46-2.66-2.27-1.92-4.06.74-1.78 2.8-2.86 4.6-2.41 1.81.45 2.67 2.27 1.93 4.06z","fill":"#23242D"}}]},{"t":7,"e":"g","f":[{"t":7,"e":"path","a":{"d":"M114.22 116.85c-2.61 6.09-5.22 12.16-7.88 18.36-5.62-1.85-11.07-3.64-16.47-5.42 2.57-6.03 5.14-12.08 7.72-18.13 5.49 1.72 11.04 3.45 16.63 5.19zm-3.31 2.23c-4.15-1.31-8.06-2.54-11.92-3.75-1.89 4.44-3.74 8.78-5.6 13.13 3.42 1.12 6.74 2.19 10.06 3.3.69.23 1.33.44 2.13-.27 1.74-4.04 3.51-8.17 5.33-12.41zM81.96 148.36c5.35 1.85 10.74 3.72 16.31 5.65-2.64 6.14-5.21 12.14-7.78 18.12-5.43-1.97-10.82-3.93-16.15-5.87 2.54-5.96 5.08-11.92 7.62-17.9zm1.58 3.1L78 164.45c3.8 1.37 7.54 2.72 11.3 4.08.07.03.17.01.25-.01.09-.03.17-.09.13-.07 1.79-4.16 3.53-8.24 5.25-12.23-.13-.37-.23-.63-.33-.9-3.67-1.28-7.34-2.56-11.06-3.86zM141.18 146.68c-5.81-1.91-11.57-3.81-17.4-5.73 2.72-6.28 5.38-12.43 8.05-18.6 5.8 1.81 11.66 3.64 17.57 5.49-2.74 6.29-5.48 12.57-8.22 18.84zm-8.41-20.77c-1.93 4.45-3.75 8.65-5.52 12.75.14.38.24.64.35.91 3.89 1.27 7.82 2.56 11.84 3.87l5.92-13.57c-4.26-1.34-8.39-2.64-12.59-3.96zM112.2 180.02c.79-1.82 1.58-3.63 2.4-5.54-.89-.32-1.63-.58-2.56-.92.52-1 .48-2.19 2.18-2.47.29.1.86.31 1.6.57.35-.8.66-1.51.97-2.23 4.15 1.47 8.32 2.94 12.53 4.43-.74 1.69-1.47 3.38-2.21 5.07-.85-.3-1.69-.61-2.53-.91.3-.9.54-1.61.75-2.25-2.45-.87-4.75-1.69-7.09-2.53-.73 1.68-1.43 3.28-2.12 4.88.87.4 1.65.75 2.41 1.1-.44 1.02-.8 1.85-1.16 2.68-1.73-.63-3.45-1.26-5.17-1.88zM109.6 166.89c-.68 1.56-1.35 3.13-2.11 4.88.75.34 1.52.69 2.46 1.12-.37.86-.75 1.73-1.16 2.69.74.27 1.31.47 2.05.74-.42.98-.81 1.88-1.2 2.78-.68-.25-1.36-.5-2.04-.74.31-.71.61-1.41.79-1.82-.27-1.64-1.26-1.62-2.2-1.74-.43.99-.78 1.81-1.14 2.63-1.69-.61-3.38-1.23-5.06-1.84.35-.82.71-1.64 1.14-2.64.8.22 1.61.44 2.52.68.37-.85.74-1.71 1.15-2.66-.79-.28-1.52-.54-2.3-.83.27-1.12.46-2.15 1.88-2.55.43.15 1 .35 1.72.61.34-.79.65-1.5.95-2.21.85.29 1.7.59 2.55.9zM121.93 119.26c-1.51 3.5-3.01 6.99-4.59 10.65-.91-.29-1.74-.56-2.57-.83.28-.65.56-1.29.86-2-.72-.47-1.45-.95-2.21-1.44.77-1.8 1.44-3.34 2.18-5.08.74.18 1.56.38 2.56.63.4-.92.79-1.82 1.17-2.73.88.26 1.74.53 2.6.8zM121.99 131.4c-.78-.25-1.55-.5-2.47-.8.25-1.02.46-2.02 1.82-2.55.49.12 1.08.27 1.78.45.27-.63.54-1.26.9-2.09-.67-.28-1.45-.6-2.4-.99.79-1.83 1.59-3.68 2.38-5.52 1.73.54 3.47 1.08 5.21 1.63-.39.91-.78 1.82-1.21 2.8-.91-.29-1.66-.52-2.45-.77-.68 1-1.29 1.9-.56 3.04.45.14 1.03.33 1.52.48.26.69-.48 1.78-1.73 2.67-.52-.16-1.09-.35-1.83-.58-.35.8-.66 1.52-.96 2.23zM132.77 165.96c-.79-.27-1.58-.55-2.51-.87-.37.66-.74 1.33-1.17 2.09-.76-.26-1.52-.53-2.41-.84 1.08-2.48 2.2-5.04 3.39-7.8 1.69.58 3.42 1.17 5.16 1.76-.82 1.89-1.64 3.78-2.46 5.66zM88.7 132.53c1.61.53 3.22 1.07 4.89 1.62-.72 1.68-1.37 3.2-2.01 4.72-.26.14-.52.27-.89.47-.46-.16-1.01-.34-1.73-.58.28-.76.6-1.64.98-2.69-.8-.27-1.6-.53-2.39-.8.38-.91.76-1.82 1.15-2.74zM92.98 173.03c.74-1.73 1.49-3.46 2.31-5.39.79.24 1.58.48 2.56.77-.82 1.92-1.6 3.72-2.38 5.52l-2.49-.9zM136.47 157.47c-1.18.33-2.22.38-2.51-1.22.66-1.5 1.37-3.14 2.08-4.77.89.3 1.77.59 2.66.89-.74 1.7-1.49 3.4-2.23 5.1zM84.28 142.91c.73.25 1.46.5 2.36.81-.32.85-.65 1.71-1.05 2.77-.89-.3-1.68-.58-2.47-.85.39-.91.78-1.82 1.16-2.73z"}},{"t":7,"e":"path","a":{"d":"M119.44 182.65c.36-.83.73-1.67 1.17-2.7.82.25 1.65.5 2.66.82-.44 1.01-.84 1.92-1.23 2.83-.87-.32-1.74-.64-2.6-.95zM117.01 136.22c.34-.88.7-1.72 1.14-2.74.82.2 1.65.4 2.66.65.39-.9.78-1.81 1.17-2.72.77.25 1.55.5 2.56.82-1.42 3.51-3 6.98-4.52 10.58-1.51-.5-2.94-.97-4.29-1.42-1.66 1.07-1.66 1.07-1.38 2.79.51.2 1.08.42 1.73.68-.28.65-.55 1.26-.9 2.08.86.34 1.65.65 2.53 1 .32-.74.59-1.36.92-2.13.75.17 1.42.32 1.91.42 1.47-.2 1.43-1.46 2.07-2.33 2.34.78 4.72 1.57 7.2 2.39-.7 1.61-1.38 3.18-2.04 4.71.51.95 2.34.26 1.84 2.64-.77 1.76-1.85 4.26-3.02 6.94-1.76-.6-3.47-1.19-5.17-1.78.36-.84.73-1.68 1.18-2.71.83.22 1.68.45 2.6.7.7-1.6 1.38-3.17 2.11-4.87-.76-.26-1.58-.53-2.49-.84-.36.82-.71 1.64-1.15 2.65-.9-.31-1.72-.58-2.63-.89-.36.82-.63 1.45-.98 2.27-.75-.26-1.42-.48-2.03-.69.22-.72.37-1.44.56-2.3.11-.05.46-.23.85-.43.49.17 1 .35 1.52.51.07.02.17-.06.26-.1 1.03-1.92 1.05-1.95 2.25-2.39.45.15 1.02.34 1.58.53.32-.74.59-1.37.87-2.01-1.58-.53-3.09-1.03-4.61-1.54-.5.97-.59 2.13-1.93 2.33-.57-.12-1.24-.26-1.89-.39-.32.73-.55 1.28-.92 2.12-.89-.03-1.83-.05-2.76-.08-.68 1.56-1.37 3.18-2.03 4.71.87.3 1.61.55 2.38.82.47-.94.9-1.8 1.32-2.65.95.32 1.72.59 2.54.87-.82 1.75-1.58 3.52-2.43 5.47-.82-.22-1.65-.45-2.56-.7-.28.66-.55 1.28-.87 2.02.47.7 2.07.26 1.92 2.04-.53 1.23-1.2 2.78-1.96 4.52-.85-.3-1.68-.59-2.51-.89l1.2-2.78c-.93-.33-1.74-.61-2.55-.9.68-1.57 1.36-3.14 2.12-4.9-.77-.33-1.55-.66-2.4-1.03 1.08-2.5 2.14-4.97 3.34-7.74.79.02 1.73.04 2.75.06.23-.54.5-1.16.82-1.89-.58-.19-1.14-.39-1.96-.66.14-1.01.28-1.99.43-3.08-.45-.15-1.02-.34-1.67-.56-.13.19-.32.42-.43.67-.33.73-.51 1.59-1.55 1.78-.57-.19-1.14-.38-1.69-.57-.58.87-1.1 1.65-1.7 2.56l-2.13-.72c-.35.81-.61 1.43-.92 2.14 1.59.54 3.17 1.08 4.65 1.59.09.21.14.29.15.38.01.08.02.19-.02.27-1.82 4.23-3.64 8.46-5.54 12.86l-2.52-.89c.67-1.55 1.34-3.11 2.13-4.95l-2.09-1.69c.59-1.38 1.25-2.91 1.98-4.62-3.2-1.1-6.3-2.17-9.56-3.29.45-1.05.83-1.94 1.22-2.86 2.3.74 4.58 1.53 6.9 2.32.32-.75.61-1.42.92-2.14-1.26-.43-2.4-.85-3.57-1.2-1.13-.35-2.18-.91-3.38-1.01-.34.8-.61 1.43-.87 2.03-.76-.22-1.5-.47-2.41-.78.25-.67.51-1.36.66-1.77 1.16-1.16 1.89-.34 2.83-.26.25-.58.51-1.19.83-1.94-.6-.4-1.31-.87-2.05-1.36.76-1.78 1.41-3.31 2.12-4.97.7.23 1.48.49 2.35.78-.64 1.5-1.3 3.04-2.01 4.69.86.29 1.64.55 2.51.84.29-.6.58-1.21.93-1.93.55.18 1.1.37 1.16.39 1.95-.03 1.92-1.44 2.64-2.41 1.46.48 2.95.98 4.46 1.53-.65 1.59-1.34 3.21-2.04 4.84.86.29 1.65.55 2.42.81.71-1.65 1.37-3.18 2.06-4.8-.86-.28-1.68-.56-2.44-.86 1.47-3.51 2.96-6.98 4.53-10.62.91.29 1.73.56 2.56.82-1.1 2.55-2.19 5.1-3.32 7.72.84.28 1.57.52 2.45.81.31-.59.67-1.26 1.12-2.09.65.24 1.3.45 1.98.72-.25.68-.56 1.39-.86 2.09.87.29 1.67.55 2.44.8.32-.74.58-1.35.88-2.04-.87-.29-1.69-.56-2.46-.85zm-16.16 6.53c.86 0 1.52-.01 2.28-.01.24-.67.49-1.35.7-1.92-.74-.25-1.29-.43-1.88-.63-.39.89-.73 1.68-1.1 2.56z"}},{"t":7,"e":"path","a":{"d":"M107.05 165.98l-2.45-.87c.33-.86.67-1.74 1.08-2.81.92.32 1.74.61 2.56.9-.39.94-.79 1.86-1.19 2.78zM99.87 163.53c-.35.8-.73 1.69-1.13 2.62-.79-.28-1.51-.54-2.33-.83.36-.83.72-1.68 1.12-2.61.8.28 1.61.56 2.34.82zM116.79 169.43c-.77-.27-1.54-.55-2.55-.9 1.44-3.49 2.99-6.94 4.56-10.62.91.31 1.76.6 2.6.89-.28.65-.56 1.3-.97 2.23.65.51 1.36 1.08 2.17 1.72-.2.47-.47 1.09-.83 1.9.89.31 1.71.6 2.6.91-.43.99-.78 1.8-1.22 2.8-1.61-.57-3.29-1.15-5.12-1.8-.45 1.07-.84 1.97-1.24 2.87zM135.99 151.37c-1.47-.49-3.02-1.01-4.62-1.54.38-.89.74-1.7 1.14-2.63 1.49.49 3.01 1 4.62 1.53-.38.9-.77 1.81-1.14 2.64zM99.81 118.72c2.51.8 4.91 1.56 7.36 2.34-1.09 2.55-2.14 5.01-3.24 7.57-2.3-.75-4.58-1.48-6.81-2.21-.12-.31-.21-.56-.28-.75 1.02-2.39 2.02-4.71 2.97-6.95zM84.04 155.55c.38-.19.63-.33.89-.46 2.18.76 4.36 1.53 6.63 2.33-1.06 2.48-2.1 4.91-3.2 7.47-2.34-.84-4.74-1.7-7.21-2.58.94-2.19 1.9-4.42 2.89-6.76zM130.77 137.34c1.13-2.6 2.21-5.11 3.35-7.72 2.61.83 5.2 1.65 7.86 2.5-1.05 2.4-2.06 4.74-3.08 7.07-.28.14-.55.28-.96.49-2.26-.74-4.6-1.5-7.17-2.34z"}}]}]}]}," ",{"t":7,"e":"div","a":{"class":"column g-margin-top--5 g-margin-bottom--5 g-margin-right--5"},"f":[{"t":3,"r":"qrCode"}]}]}," ",{"t":7,"e":"a","a":{"class":"a black-font"},"v":{"click":{"n":"goTo","a":"step2"}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.back\")"}}]}]}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--20 g-font--small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.airbond.step3.desc3\")"}}]}]}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"step2\"))&&((!(_0===\"step3\"))&&(_0===\"step4\"))"},"f":[" ",{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.airbond.title\")"}}]},"f":[{"t":7,"e":"div","a":{"class":"img-done-circle"},"f":[{"t":7,"e":"svg","a":{"class":"icon-done","version":"1.1","xmlns":"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","x":"0px","y":"0px","viewBox":"0 0 160 160","style":"enable-background:new 0 0 160 160;","xml:space":"preserve"},"f":[{"t":7,"e":"g","f":[{"t":7,"e":"path","a":{"style":"fill-rule:evenodd;clip-rule:evenodd;fill:#1cb84a;","d":"M80,0C35.82,0,0,35.82,0,80c0,44.18,35.82,80,80,80\n\t\t\t\t\t\t\ts80-35.82,80-80C160,35.82,124.18,0,80,0z M80,155.99c-41.97,0-75.99-34.02-75.99-75.99S38.03,4.01,80,4.01\n\t\t\t\t\t\t\tS155.99,38.03,155.99,80S121.97,155.99,80,155.99z M119.46,52.58c-0.81-0.81-2.12-0.81-2.93,0l-48.56,48.56L46.42,79.58\n\t\t\t\t\t\t\tc-0.81-0.81-2.11-0.81-2.92,0l-2.92,2.92c-0.81,0.81-0.81,2.11,0,2.92l22.79,22.79c0.06,0.09,0.13,0.18,0.21,0.26l2.93,2.93\n\t\t\t\t\t\t\tc0.41,0.41,0.95,0.61,1.49,0.6c0.54,0.01,1.07-0.19,1.48-0.6l2.92-2.92c0.07-0.07,0.13-0.16,0.19-0.24l49.8-49.8\n\t\t\t\t\t\t\tc0.81-0.81,0.81-2.12,0-2.93L119.46,52.58z"}}]}]}]}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--20"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.airbond.step4.desc\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","class":"btn g-margin-top--20"},"v":{"click":"close"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.close\")"}}]}]}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"step2\"))&&((!(_0===\"step3\"))&&((!(_0===\"step4\"))&&(_0===\"error\")))"},"f":[" ",{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.airbond.title\")"}}]},"f":[{"t":7,"e":"div","a":{"class":"img-done-circle"},"f":[{"t":7,"e":"svg","a":{"class":"icon-done","version":"1.1","xmlns":"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","x":"0px","y":"0px","viewBox":"0 0 160 160","style":"enable-background:new 0 0 160 160;","xml:space":"preserve"},"f":[{"t":7,"e":"g","f":[{"t":7,"e":"path","a":{"style":"fill-rule:evenodd;clip-rule:evenodd;fill:#DA2C2C;","d":"M109.39,53.5l-2.93-2.93c-0.81-0.81-2.12-0.81-2.93,0\n\t\t\t\tL79.97,74.15L56.43,50.61c-0.81-0.81-2.12-0.81-2.93,0l-2.93,2.93c-0.81,0.81-0.81,2.12,0,2.93L74.12,80l-23.54,23.54\n\t\t\t\tc-0.81,0.81-0.81,2.12,0,2.93l2.93,2.93c0.81,0.81,2.12,0.81,2.93,0l23.54-23.54l23.57,23.57c0.81,0.81,2.12,0.81,2.93,0\n\t\t\t\tl2.93-2.93c0.81-0.81,0.81-2.12,0-2.93L85.82,80l23.57-23.57C110.2,55.62,110.2,54.31,109.39,53.5z M80,0C35.82,0,0,35.82,0,80\n\t\t\t\tc0,44.18,35.82,80,80,80s80-35.82,80-80C160,35.82,124.18,0,80,0z M80,155.99c-41.97,0-75.99-34.02-75.99-75.99\n\t\t\t\tS38.03,4.01,80,4.01S155.99,38.03,155.99,80S121.97,155.99,80,155.99z"}}]}]}]}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--20"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.airbond.stepError.desc\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","class":"btn g-margin-top--20"},"v":{"click":"close"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.close\")"}}]}]}]}],"x":{"r":["page"],"s":"_0===\"step1\""}}]}; var css_248z$i = ".icon-mobile-ok {\n width: 120px;\n height: 120px;\n}\n.icon-mobile-qr {\n width: 154px;\n height: 154px;\n}\n.icon-android,\n.icon-ios {\n height: 80px;\n width: 80px;\n}\n.step2-icon-wrapper {\n display: flex;\n width: 35%;\n margin: auto;\n}\n.step3-icon-wrapper {\n display: flex;\n width: 92%;\n margin: auto;\n}\n.black-font {\n color: #000;\n}\n.white-block {\n background-color: #fff;\n width: 65%;\n margin: auto;\n}\n.column {\n float: left;\n width: 50%;\n}\n.img-done-circle {\n margin: auto;\n}\n.icon-done {\n width: 82px;\n margin: 7px auto 0;\n}\n"; class PamQrGen { constructor(dataString) { const B = '13'; const r = 'L'; const qrGenerator = this.qrGenerator()(B, r); qrGenerator.addData(dataString); qrGenerator.make(); this.qrImageTag = qrGenerator.createImgTag(); } qrGenerator(){ /* eslint-disable */ return (function(){var n=function(B,r){var J=236;var I=17;var v=B;var x=i[r];var t=null;var E=0;var p=null;var z=new Array();var F={};var C=function(L,K){E=v*4+17;t=function(P){var N=new Array(P);for(var O=0;O<P;O+=1){N[O]=new Array(P);for(var M=0;M<P;M+=1){N[O][M]=null;}}return N}(E);y(0,0);y(E-7,0);y(0,E-7);A();q();H(L,K);if(v>=7){w(L);}if(p==null){p=s(v,x,z);}D(p,K);};var y=function(M,K){for(var L=-1;L<=7;L+=1){if(M+L<=-1||E<=M+L){continue}for(var N=-1;N<=7;N+=1){if(K+N<=-1||E<=K+N){continue}if((0<=L&&L<=6&&(N==0||N==6))||(0<=N&&N<=6&&(L==0||L==6))||(2<=L&&L<=4&&2<=N&&N<=4)){t[M+L][K+N]=true;}else {t[M+L][K+N]=false;}}}};var u=function(){var N=0;var M=0;for(var L=0;L<8;L+=1){C(true,L);var K=h.getLostPoint(F);if(L==0||N>K){N=K;M=L;}}return M};var q=function(){for(var K=8;K<E-8;K+=1){if(t[K][6]!=null){continue}t[K][6]=(K%2==0);}for(var L=8;L<E-8;L+=1){if(t[6][L]!=null){continue}t[6][L]=(L%2==0);}};var A=function(){var Q=h.getPatternPosition(v);for(var M=0;M<Q.length;M+=1){for(var L=0;L<Q.length;L+=1){var O=Q[M];var K=Q[L];if(t[O][K]!=null){continue}for(var N=-2;N<=2;N+=1){for(var P=-2;P<=2;P+=1){if(N==-2||N==2||P==-2||P==2||(N==0&&P==0)){t[O+N][K+P]=true;}else {t[O+N][K+P]=false;}}}}}};var w=function(N){var M=h.getBCHTypeNumber(v);for(var L=0;L<18;L+=1){var K=(!N&&((M>>L)&1)==1);t[Math.floor(L/3)][L%3+E-8-3]=K;}for(var L=0;L<18;L+=1){var K=(!N&&((M>>L)&1)==1);t[L%3+E-8-3][Math.floor(L/3)]=K;}};var H=function(P,O){var N=(x<<3)|O;var M=h.getBCHTypeInfo(N);for(var L=0;L<15;L+=1){var K=(!P&&((M>>L)&1)==1);if(L<6){t[L][8]=K;}else {if(L<8){t[L+1][8]=K;}else {t[E-15+L][8]=K;}}}for(var L=0;L<15;L+=1){var K=(!P&&((M>>L)&1)==1);if(L<8){t[8][E-L-1]=K;}else {if(L<9){t[8][15-L-1+1]=K;}else {t[8][15-L-1]=K;}}}t[E-8][8]=(!P);};var D=function(P,L){var N=-1;var U=E-1;var O=7;var K=0;var S=h.getMaskFunction(L);for(var M=E-1;M>0;M-=2){if(M==6){M-=1;}while(true){for(var R=0;R<2;R+=1){if(t[U][M-R]==null){var Q=false;if(K<P.length){Q=(((P[K]>>>O)&1)==1);}var T=S(U,M-R);if(T){Q=!Q;}t[U][M-R]=Q;O-=1;if(O==-1){K+=1;O=7;}}}U+=N;if(U<0||E<=U){U-=N;N=-N;break}}}};var G=function(U,X){var M=0;var aa=0;var Y=0;var L=new Array(X.length);var P=new Array(X.length);for(var S=0;S<X.length;S+=1){var T=X[S].dataCount;var K=X[S].totalCount-T;aa=Math.max(aa,T);Y=Math.max(Y,K);L[S]=new Array(T);for(var V=0;V<L[S].length;V+=1){L[S][V]=255&U.getBuffer()[V+M];}M+=T;var Q=h.getErrorCorrectPolynomial(K);var Z=e(L[S],Q.getLength()-1);var N=Z.mod(Q);P[S]=new Array(Q.getLength()-1);for(var V=0;V<P[S].length;V+=1){var R=V+N.getLength()-P[S].length;P[S][V]=(R>=0)?N.getAt(R):0;}}var W=0;for(var V=0;V<X.length;V+=1){W+=X[V].totalCount;}var ab=new Array(W);var O=0;for(var V=0;V<aa;V+=1){for(var S=0;S<X.length;S+=1){if(V<L[S].length){ab[O]=L[S][V];O+=1;}}}for(var V=0;V<Y;V+=1){for(var S=0;S<X.length;S+=1){if(V<P[S].length){ab[O]=P[S][V];O+=1;}}}return ab};var s=function(R,Q,N){var L=g.getRSBlocks(R,Q);var K=f();for(var M=0;M<N.length;M+=1){var P=N[M];K.put(P.getMode(),4);K.put(P.getLength(),h.getLengthInBits(P.getMode(),R));P.write(K);}var O=0;for(var M=0;M<L.length;M+=1){O+=L[M].dataCount;}if(K.getLengthInBits()>O*8){throw new Error("code length overflow. ("+K.getLengthInBits()+">"+O*8+")")}if(K.getLengthInBits()+4<=O*8){K.put(0,4);}while(K.getLengthInBits()%8!=0){K.putBit(false);}while(true){if(K.getLengthInBits()>=O*8){break}K.put(J,8);if(K.getLengthInBits()>=O*8){break}K.put(I,8);}return G(K,L)};F.addData=function(L){var K=m(L);z.push(K);p=null;};F.isDark=function(L,K){if(L<0||E<=L||K<0||E<=K){throw new Error(L+","+K)}return t[L][K]};F.getModuleCount=function(){return E};F.make=function(){C(false,u());};F.createTableTag=function(O,M){O=O||2;M=(typeof M=="undefined")?O*4:M;var K="";K+='<table style="';K+=" border-width: 0px; border-style: none;";K+=" border-collapse: collapse;";K+=" padding: 0px; margin: "+M+"px;";K+='">';K+="<tbody>";for(var L=0;L<F.getModuleCount();L+=1){K+="<tr>";for(var N=0;N<F.getModuleCount();N+=1){K+='<td style="';K+=" border-width: 0px; border-style: none;";K+=" border-collapse: collapse;";K+=" padding: 0px; margin: 0px;";K+=" width: "+O+"px;";K+=" height: "+O+"px;";K+=" background-color: ";K+=F.isDark(L,N)?"#000000":"#ffffff";K+=";";K+='"/>';}K+="</tr>";}K+="</tbody>";K+="</table>";return K};F.createImgTag=function(O,N){O=O||2;N=(typeof N=="undefined")?O*4:N;var M=F.getModuleCount()*O+N*2;var L=N;var K=M-N;return d(M,M,function(P,S){if(L<=P&&P<K&&L<=S&&S<K){var R=Math.floor((P-L)/O);var Q=Math.floor((S-L)/O);return F.isDark(Q,R)?0:1}else {return 1}})};return F};n.stringToBytes=function(r){var p=new Array();for(var q=0;q<r.length;q+=1){var t=r.charCodeAt(q);p.push(t&255);}return p};n.createStringToBytes=function(s,r){var q=function(){var D=a(s);var t=function(){var v=D.read();if(v==-1){throw new Error()}return v};var w=0;var x={};while(true){var B=D.read();if(B==-1){break}var A=t();var z=t();var y=t();var u=String.fromCharCode((B<<8)|A);var C=(z<<8)|y;x[u]=C;w+=1;}if(w!=r){throw new Error(w+" != "+r)}return x}();var p="?".charCodeAt(0);return function(w){var u=new Array();for(var v=0;v<w.length;v+=1){var x=w.charCodeAt(v);if(x<128){u.push(x);}else {var t=q[w.charAt(v)];if(typeof t=="number"){if((t&255)==t){u.push(t);}else {u.push(t>>>8);u.push(t&255);}}else {u.push(p);}}}return u}};var j={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3};var i={L:1,M:0,Q:3,H:2};var c={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var h=function(){var s=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]];var p=(1<<10)|(1<<8)|(1<<5)|(1<<4)|(1<<2)|(1<<1)|(1<<0);var u=(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8)|(1<<5)|(1<<2)|(1<<0);var r=(1<<14)|(1<<12)|(1<<10)|(1<<4)|(1<<1);var t={};var q=function(v){var w=0;while(v!=0){w+=1;v>>>=1;}return w};t.getBCHTypeInfo=function(v){var w=v<<10;while(q(w)-q(p)>=0){w^=(p<<(q(w)-q(p)));}return ((v<<10)|w)^r};t.getBCHTypeNumber=function(v){var w=v<<12;while(q(w)-q(u)>=0){w^=(u<<(q(w)-q(u)));}return (v<<12)|w};t.getPatternPosition=function(v){return s[v-1]};t.getMaskFunction=function(v){switch(v){case c.PATTERN000:return function(x,w){return (x+w)%2==0};case c.PATTERN001:return function(x,w){return x%2==0};case c.PATTERN010:return function(x,w){return w%3==0};case c.PATTERN011:return function(x,w){return (x+w)%3==0};case c.PATTERN100:return function(x,w){return (Math.floor(x/2)+Math.floor(w/3))%2==0};case c.PATTERN101:return function(x,w){return (x*w)%2+(x*w)%3==0};case c.PATTERN110:return function(x,w){return ((x*w)%2+(x*w)%3)%2==0};case c.PATTERN111:return function(x,w){return ((x*w)%3+(x+w)%2)%2==0};default:throw new Error("bad maskPattern:"+v)}};t.getErrorCorrectPolynomial=function(w){var v=e([1],0);for(var x=0;x<w;x+=1){v=v.multiply(e([1,o.gexp(x)],0));}return v};t.getLengthInBits=function(w,v){if(1<=v&&v<10){switch(w){case j.MODE_NUMBER:return 10;case j.MODE_ALPHA_NUM:return 9;case j.MODE_8BIT_BYTE:return 8;case j.MODE_KANJI:return 8;default:throw new Error("mode:"+w)}}else {if(v<27){switch(w){case j.MODE_NUMBER:return 12;case j.MODE_ALPHA_NUM:return 11;case j.MODE_8BIT_BYTE:return 16;case j.MODE_KANJI:return 10;default:throw new Error("mode:"+w)}}else {if(v<41){switch(w){case j.MODE_NUMBER:return 14;case j.MODE_ALPHA_NUM:return 13;case j.MODE_8BIT_BYTE:return 16;case j.MODE_KANJI:return 12;default:throw new Error("mode:"+w)}}else {throw new Error("type:"+v)}}}};t.getLostPoint=function(E){var x=E.getModuleCount();var y=0;for(var G=0;G<x;G+=1){for(var w=0;w<x;w+=1){var D=0;var C=E.isDark(G,w);for(var v=-1;v<=1;v+=1){if(G+v<0||x<=G+v){continue}for(var B=-1;B<=1;B+=1){if(w+B<0||x<=w+B){continue}if(v==0&&B==0){continue}if(C==E.isDark(G+v,w+B)){D+=1;}}}if(D>5){y+=(3+D-5);}}}for(var G=0;G<x-1;G+=1){for(var w=0;w<x-1;w+=1){var z=0;if(E.isDark(G,w)){z+=1;}if(E.isDark(G+1,w)){z+=1;}if(E.isDark(G,w+1)){z+=1;}if(E.isDark(G+1,w+1)){z+=1;}if(z==0||z==4){y+=3;}}}for(var G=0;G<x;G+=1){for(var w=0;w<x-6;w+=1){if(E.isDark(G,w)&&!E.isDark(G,w+1)&&E.isDark(G,w+2)&&E.isDark(G,w+3)&&E.isDark(G,w+4)&&!E.isDark(G,w+5)&&E.isDark(G,w+6)){y+=40;}}}for(var w=0;w<x;w+=1){for(var G=0;G<x-6;G+=1){if(E.isDark(G,w)&&!E.isDark(G+1,w)&&E.isDark(G+2,w)&&E.isDark(G+3,w)&&E.isDark(G+4,w)&&!E.isDark(G+5,w)&&E.isDark(G+6,w)){y+=40;}}}var F=0;for(var w=0;w<x;w+=1){for(var G=0;G<x;G+=1){if(E.isDark(G,w)){F+=1;}}}var A=Math.abs(100*F/x/x-50)/5;y+=A*10;return y};return t}();var o=function(){var p=new Array(256);var r=new Array(256);for(var q=0;q<8;q+=1){p[q]=1<<q;}for(var q=8;q<256;q+=1){p[q]=p[q-4]^p[q-5]^p[q-6]^p[q-8];}for(var q=0;q<255;q+=1){r[p[q]]=q;}var s={};s.glog=function(t){if(t<1){throw new Error("glog("+t+")")}return r[t]};s.gexp=function(t){while(t<0){t+=255;}while(t>=256){t-=255;}return p[t]};return s}();function e(q,p){if(typeof q.length=="undefined"){throw new Error(q.length+"/"+p)}var r=function(){var v=0;while(v<q.length&&q[v]==0){v+=1;}var u=new Array(q.length-v+p);for(var t=0;t<q.length-v;t+=1){u[t]=q[t+v];}return u}();var s={};s.getAt=function(t){return r[t]};s.getLength=function(){return r.length};s.multiply=function(w){var u=new Array(s.getLength()+w.getLength()-1);for(var v=0;v<s.getLength();v+=1){for(var t=0;t<w.getLength();t+=1){u[v+t]^=o.gexp(o.glog(s.getAt(v))+o.glog(w.getAt(t)));}}return e(u,0)};s.mod=function(w){if(s.getLength()-w.getLength()<0){return s}var v=o.glog(s.getAt(0))-o.glog(w.getAt(0));var t=new Array(s.getLength());for(var u=0;u<s.getLength();u+=1){t[u]=s.getAt(u);}for(var u=0;u<w.getLength();u+=1){t[u]^=o.gexp(o.glog(w.getAt(u))+v);}return e(t,0).mod(w)};return s}var g=function(){var q=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];var p=function(t,u){var v={};v.totalCount=t;v.dataCount=u;return v};var s={};var r=function(u,t){switch(t){case i.L:return q[(u-1)*4+0];case i.M:return q[(u-1)*4+1];case i.Q:return q[(u-1)*4+2];case i.H:return q[(u-1)*4+3];default:return undefined}};s.getRSBlocks=function(v,B){var u=r(v,B);if(typeof u=="undefined"){throw new Error("bad rs block @ typeNumber:"+v+"/errorCorrectLevel:"+B)}var t=u.length/3;var z=new Array();for(var x=0;x<t;x+=1){var y=u[x*3+0];var C=u[x*3+1];var A=u[x*3+2];for(var w=0;w<y;w+=1){z.push(p(C,A));}}return z};return s}();var f=function(){var p=new Array();var r=0;var q={};q.getBuffer=function(){return p};q.getAt=function(s){var t=Math.floor(s/8);return ((p[t]>>>(7-s%8))&1)==1};q.put=function(s,u){for(var t=0;t<u;t+=1){q.putBit(((s>>>(u-t-1))&1)==1);}};q.getLengthInBits=function(){return r};q.putBit=function(t){var s=Math.floor(r/8);if(p.length<=s){p.push(0);}if(t){p[s]|=(128>>>(r%8));}r+=1;};return q};var m=function(s){var r=j.MODE_8BIT_BYTE;var q=n.stringToBytes(s);var t={};t.getMode=function(){return r};t.getLength=function(u){return q.length};t.write=function(u){for(var v=0;v<q.length;v+=1){u.put(q[v],8);}};return t};var k=function(){var p=new Array();var q={};q.writeByte=function(r){p.push(r&255);};q.writeShort=function(r){q.writeByte(r);q.writeByte(r>>>8);};q.writeBytes=function(s,u,r){u=u||0;r=r||s.length;for(var t=0;t<r;t+=1){q.writeByte(s[t+u]);}};q.writeString=function(t){for(var r=0;r<t.length;r+=1){q.writeByte(t.charCodeAt(r));}};q.toByteArray=function(){return p};q.toString=function(){var t="";t+="[";for(var r=0;r<p.length;r+=1){if(r>0){t+=",";}t+=p[r];}t+="]";return t};return q};var b=function(){var q=0;var t=0;var v=0;var p="";var u={};var s=function(w){p+=String.fromCharCode(r(w&63));};var r=function(w){if(w<0);else {if(w<26){return 65+w}else {if(w<52){return 97+(w-26)}else {if(w<62){return 48+(w-52)}else {if(w==62){return 43}else {if(w==63){return 47}}}}}}throw new Error("n:"+w)};u.writeByte=function(w){q=(q<<8)|(w&255);t+=8;v+=1;while(t>=6){s(q>>>(t-6));t-=6;}};u.flush=function(){if(t>0){s(q<<(6-t));q=0;t=0;}if(v%3!=0){var x=3-v%3;for(var w=0;w<x;w+=1){p+="=";}}};u.toString=function(){return p};return u};var a=function(t){var v=t;var p=0;var q=0;var r=0;var u={};u.read=function(){while(r<8){if(p>=v.length){if(r==0){return -1}throw new Error("unexpected end of file./"+r)}var x=v.charAt(p);p+=1;if(x=="="){r=0;return -1}else {if(x.match(/^\s$/)){continue}}q=(q<<6)|s(x.charCodeAt(0));r+=6;}var w=(q>>>(r-8))&255;r-=8;return w};var s=function(w){if(65<=w&&w<=90){return w-65}else {if(97<=w&&w<=122){return w-97+26}else {if(48<=w&&w<=57){return w-48+52}else {if(w==43){return 62}else {if(w==47){return 63}else {throw new Error("c:"+w)}}}}}};return u};var l=function(p,w){var s=p;var t=w;var q=new Array(p*w);var u={};u.setPixel=function(z,B,A){q[B*s+z]=A;};u.write=function(z){z.writeString("GIF87a");z.writeShort(s);z.writeShort(t);z.writeByte(128);z.writeByte(0);z.writeByte(0);z.writeByte(0);z.writeByte(0);z.writeByte(0);z.writeByte(255);z.writeByte(255);z.writeByte(255);z.writeString(",");z.writeShort(0);z.writeShort(0);z.writeShort(s);z.writeShort(t);z.writeByte(0);var A=2;var y=r(A);z.writeByte(A);var B=0;while(y.length-B>255){z.writeByte(255);z.writeBytes(y,B,255);B+=255;}z.writeByte(y.length-B);z.writeBytes(y,B,y.length-B);z.writeByte(0);z.writeString(";");};var v=function(z){var A=z;var B=0;var y=0;var C={};C.write=function(E,D){if((E>>>D)!=0){throw new Error("length over")}while(B+D>=8){A.writeByte(255&((E<<B)|y));D-=(8-B);E>>>=(8-B);y=0;B=0;}y=(E<<B)|y;B=B+D;};C.flush=function(){if(B>0){A.writeByte(y);}};return C};var r=function(z){var D=1<<z;var B=(1<<z)+1;var F=z+1;var H=x();for(var C=0;C<D;C+=1){H.add(String.fromCharCode(C));}H.add(String.fromCharCode(D));H.add(String.fromCharCode(B));var A=k();var y=v(A);y.write(D,F);var G=0;var I=String.fromCharCode(q[G]);G+=1;while(G<q.length){var E=String.fromCharCode(q[G]);G+=1;if(H.contains(I+E)){I=I+E;}else {y.write(H.indexOf(I),F);if(H.size()<4095){if(H.size()==(1<<F)){F+=1;}H.add(I+E);}I=E;}}y.write(H.indexOf(I),F);y.write(B,F);y.flush();return A.toByteArray()};var x=function(){var z={};var y=0;var A={};A.add=function(B){if(A.contains(B)){throw new Error("dup key:"+B)}z[B]=y;y+=1;};A.size=function(){return y};A.indexOf=function(B){return z[B]};A.contains=function(B){return typeof z[B]!="undefined"};return A};return u};var d=function(p,B,v,t){var s=l(p,B);for(var w=0;w<B;w+=1){for(var A=0;A<p;A+=1){s.setPixel(A,w,v(A,w));}}var z=k();s.write(z);var u=b();var C=z.toByteArray();for(var r=0;r<C.length;r+=1){u.writeByte(C[r]);}u.flush();var q="";q+="<img";q+='\u0020src="';q+="data:image/gif;base64,";q+=u;q+='"';q+='\u0020width="';q+=p;q+='"';q+='\u0020height="';q+=B;q+='"';if(t){q+='\u0020alt="';q+=t;q+='"';}q+="/>";return q};return n})(); } } const AirbondModal = Ractive.extend({ template: template$B, css: css_248z$i, data: function() { return { page: 'step1', qrCode: '' }; }, oninit: function() { this.on('Modal.close', () => { this.fire('close'); }); this.on('goTo', (e, page) => { if (page === 'step3') { this.generateQrCode().then(() => { this.set('page', 'step3'); this.startStateListener(); }).catch((err) => { console.error('Qrcode generation failed', JSON.stringify(err)); this.set('page', 'error'); }); } else { this.stopStateListener(); this.set('page', page); } }); }, generateQrCode() { return NAPI$1.request('app.pam.GetAirBondQRString').then((qrDataString) => { var qrGen = new PamQrGen(qrDataString); this.set('qrCode', qrGen.qrImageTag); }); }, startStateListener() { this.airbondRegisteredOff = NAPI$1.on('app.pam.onStatusChanged.airbondRegistered', (airbondRegistered) => { this.stopStateListener(); if (airbondRegistered) { this.set('page', 'step4'); } else { this.set('page', 'error'); } }); }, stopStateListener(){ if (this.airbondRegisteredOff) { this.airbondRegisteredOff(); } }, onteardown() { this.stopStateListener(); } }); const Security = Ractive.extend({ template: template$A, css: css_248z$h, components: { AirbondModal }, twoway: false, data: function() { return { modalDialog: undefined, masterPasswordSet: false, syncOn: false, licensed: false, loading: true, airBondActive: false, secureSettings: { lockAfter: { id: 'LOCK_VAULT_INTERVAL', value: 0, predefinedValues: [1, 2, 6, 12, 24] }, lockOnLogout: { id: 'LOCK_VAULT_ON_LOGOUT', value: 0 }, lockOnBrowserClose: { id: 'LOCK_VAULT_ON_BROWSER_CLOSE', value: 0 }, } }; }, oninit: function() { this._init(); NAPI.on('sensitiveModal.masterPasswordModal.masterPasswordCreated', () => { this._init(); }); NAPI.on('sensitiveModal.masterPasswordModal.masterPasswordChanged', () => { this._init(); }); this.on('openMasterPasswordModal', () => { const masterPasswordSet = this.get('masterPasswordSet'); showSensitiveModal('setMasterPassword', { width: 680, height: masterPasswordSet ? 480 : 423, params: { masterPasswordSet } }); }); this.on('MasterPasswordModal.close AirbondModal.close', () => { this.set('modalDialog', undefined); }); this.on('Modal.close', () => { this.set('modalDialog', undefined); }); this.airbondRegisteredOff = NAPI.on('app.pam.onStatusChanged.airbondRegistered', (airBondActive) => { this.set('airBondActive', airBondActive); }); this.on('setSecureSettings', (e, changedSettingKeyName) => { const changedSetting = this.get(changedSettingKeyName); let changedValue; if (e.node.selectedIndex || e.node.selectedIndex > -1) { // If select element was changed (has selectedIndex property) changedValue = changedSetting.predefinedValues[e.node.selectedIndex]; } else { changedValue = e.node.checked ? 1 : 0; } // Update ractive changedSetting this.set(changedSettingKeyName + '.value', changedValue); // Get all settings, we have to pass everything to NAPI call const allSettings = this.get('secureSettings'); const params = {}; Object.keys(allSettings).forEach((keyName) => { const item = allSettings[keyName]; params[item.id] = item.value.toString(); }); NAPI.request('app.pam.SetSecureSettings', params).catch((err) => { console.error('app.pam.SetSecureSettings', JSON.stringify(err)); }); }); this.on('toggleAirBond', () => { if (this.get('airBondActive')) { NAPI.request('app.pam.AirBondDisable').then(() => { this._init(); }).catch((err) => { console.error('app.pam.AirBondDisable', JSON.stringify(err)); }); } else { this.set('modalDialog', 'airbond'); } }); }, _init() { this.set('loading', true); Promise.all([ this._getSecureSettings(), this._getIsMasterPasswordSet(), this._getIsSyncOn(), this._setPamLicensed(), this._setAirBondActive() ]).then(() => { this.set('loading', false); }).catch(() => { this.set('loading', false); }); }, _getSecureSettings() { const secureSetting = this.get('secureSettings'); NAPI.request('app.pam.GetSecureSettings').then((res) => { secureSetting['lockAfter'].value = parseInt(res[secureSetting['lockAfter'].id]); secureSetting['lockOnLogout'].value = parseInt(res[secureSetting['lockOnLogout'].id]); secureSetting['lockOnBrowserClose'].value = parseInt(res[secureSetting['lockOnBrowserClose'].id]); this.set('secureSettings', secureSetting); }).catch((err) => { console.error('_getSecureSettings', err); }); }, _setAirBondActive() { return NAPI.request('app.pam.IsPAMAirBondActive').then((active) => { this.set('airBondActive', active); }).catch((err) => { console.error('app.pam.IsPAMAirBondActive', err); }); }, _setPamLicensed() { return NAPI.request('app.pam.IsPAMLicensed').then((licensed) => { this.set('licensed', licensed); }); }, _getIsMasterPasswordSet() { return NAPI.request('app.pam.GetLoginMethods').then((response) => { this.set('masterPasswordSet', !response.hasSystemLogin); }); }, _getIsSyncOn() { return NAPI.request('app.pam.SynchronizationSetup', {request: 'getState'}) .then((response) => { this.set('syncOn', response.setupCompleted); }).catch(() => { const message = Ractive.localization.nls('system.toasters.restart.text'); const options = { title: Ractive.localization.nls('system.toasters.restart.title'), ok: Ractive.localization.nls('system.toasters.restart.restartComputer') }; return Ractive.UI.confirm(message, options) .then(()=>{ NAPI.request('app.system.Restart', { rebootType: 'RebootFromUI' }); }); }); }, onteardown(){ NAPI.on('sensitiveModal.masterPasswordModal.masterPasswordCreated', () => {}); NAPI.on('sensitiveModal.masterPasswordModal.masterPasswordChanged', () => {}); if (this.airbondRegisteredOff) { this.airbondRegisteredOff(); } } }); var css_248z$j = ".pam_settings_browsers .pam_settings_browser_ext {\n display: flex;\n align-items: center;\n}\n.pam_settings_browsers .pam_settings_browser {\n flex-grow: 1;\n}\n.pam_settings_browsers .pam_settings_browser .pam_browser {\n font-size: 15px;\n}\n.pam_settings_browsers .pam_settings_browser .pam_browser .pam_browser_icon {\n margin-right: 30px;\n font-size: 40px;\n}\n.pam_settings_browsers .pam_settings_browser .pam_browser .pam_browser_label {\n font-weight: normal;\n}\n"; const template$C = {"v":3,"t":[{"t":7,"e":"h3","a":{"class":"h3 g-margin-bottom--20"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.browserExtensions\")"}}]}," ",{"t":7,"e":"p","a":{"class":"p -tiny -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.browserExtensions.desc\")"}}]}," ",{"t":7,"e":"div","a":{"class":"pam_settings_browsers"},"f":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_settings_browser_ext g-margin-top--20"},"f":[{"t":7,"e":"div","a":{"class":"pam_settings_browser"},"f":[{"t":7,"e":"Browser","a":{"browserId":[{"t":2,"r":"browser"}]}}]}," ",{"t":4,"f":[{"t":7,"e":"button","a":{"class":"btn -small -secondary"},"v":{"click":{"n":"installExtension","d":[{"t":2,"r":"browser"}]}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.browserExtensions.reAdd\")"}}]}],"n":50,"x":{"r":["extension"],"s":"_0===true"}},{"t":4,"n":51,"f":[{"t":7,"e":"button","a":{"class":"btn -small"},"v":{"click":{"n":"installExtension","d":[{"t":2,"r":"browser"}]}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.browserExtensions.add\")"}}]}],"x":{"r":["extension"],"s":"_0===true"}}]}],"n":52,"r":"browsers"}]}]}; const BrowserIntegration = Ractive.extend({ template: template$C, css: css_248z$j, components: { Browser }, data: function() { return { browsers: [] }; }, oninit: function() { this.listeners = []; this._initBrowsers(); this.listeners.push(NAPI.on('app.pam.onStatusChanged.browserStatus', () => { this._initBrowsers(); })); this.on('installExtension', (e, browser) => { if (browser) { const command = 'install_pam_plugin(browser=' + browser + ',cn=User%20extension%20install,cs=Settings)'; NAPI.request('av.command', command).catch((err) => { console.error('av.command', command, JSON.stringify(err)); }); } }); }, _initBrowsers() { NAPI.request('app.pam.GetBrowserStatus').then((res) => { this.set('browsers', res); }).catch((err) => { console.error('app.pam.GetBrowserStatus', JSON.stringify(err)); }); }, onteardown() { this.listeners.forEach(off => off()); } }); var css_248z$k = ".pam_settings_sync_info {\n display: flex;\n margin-bottom: 20px;\n}\n.pam_settings_sync_info .pam_email {\n color: #fff;\n font-weight: bold;\n}\n.pam_settings_sync_info .pam_steps {\n color: rgba(255,255,255,0.7);\n}\n.pam_settings_sync_info .pam_settings_sync_icon {\n font-size: 36px;\n margin-right: 40px;\n}\n.pam_info_icon {\n font-size: 13px;\n margin-left: 4px;\n margin-top: -1px;\n}\n.pam_last_synced_time_cont {\n background-color: var(--overlay-bg);\n position: absolute;\n bottom: 0;\n width: 80%;\n height: 55px;\n padding-top: 15px;\n}\n.pam_last_synced_time_cont .pam_last_synced_time {\n cursor: pointer;\n color: rgba(255,255,255,0.7);\n}\n.pam_last_synced_time_cont .pam_last_synced_time:hover:not(.-syncing) {\n color: #fff;\n}\n.pam_last_synced_time_cont .pam_last_synced_time .pam_synchronize_icon {\n font-size: 16px;\n margin-right: 10px;\n}\n.pam_last_synced_time_cont .pam_last_synced_time.-syncing {\n cursor: default;\n}\n.pam_last_synced_time_cont .pam_last_synced_time.-syncing .pam_synchronize_icon {\n -webkit-animation: rotation 0.95s linear infinite;\n animation: rotation 0.95s linear infinite;\n}\n"; const template$D = {"v":3,"t":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"center__wrap"},"f":[{"t":7,"e":"div","a":{"class":"center"},"f":[{"t":7,"e":"Loading","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.loading\")"}}]}}]}]}],"n":50,"x":{"r":["loading"],"s":"_0===true"}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["syncState.state"],"s":"_0===\"enabled\""},"f":[" ",{"t":7,"e":"h3","a":{"class":"h3 g-margin-bottom--20"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.syncedDevices.syncStatus\")"}}," ",{"t":7,"e":"span","a":{"class":"color-ok -text g-font--uppercase"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.switcher.on\")"}}]}]}," ",{"t":7,"e":"p","a":{"class":"p"},"f":[{"t":7,"e":"span","a":{"class":"span -tiny -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.syncedDevices.usingAccount\")"}}]}," ",{"t":7,"e":"span","a":{"class":"span -tiny"},"f":[{"t":2,"r":"email"}]}]}," ",{"t":7,"e":"button","a":{"class":"g-margin-top--20 btn -small -secondary"},"v":{"click":"askTurnOffSync"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.syncedDevices.turnOffSync.btn\")"}}]}," ",{"t":7,"e":"div","a":{"class":"pam_line g-margin-top--20 g-margin-bottom--20"}}," ",{"t":7,"e":"SyncedDevices"}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_last_synced_time_cont text -tiny"},"f":[{"t":4,"f":[{"t":7,"e":"span","a":{"class":"pam_last_synced_time -syncing"},"f":[{"t":7,"e":"Icon","a":{"name":"passwords-sync","cssCls":"pam_synchronize_icon"}},{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.syncedDevices.syncing\")"}}]}],"n":50,"r":"synchronizing"},{"t":4,"n":51,"f":[{"t":7,"e":"span","a":{"class":"pam_last_synced_time"},"v":{"click":"synchronize"},"f":[{"t":7,"e":"Icon","a":{"name":"passwords-sync","cssCls":"pam_synchronize_icon"}},{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.syncedDevices.lastSyncedAt\")"}}," ",{"t":2,"r":"lastSyncTime"}]}],"r":"synchronizing"}]}],"n":50,"r":"lastSyncTime"}]},{"t":4,"n":50,"x":{"r":["syncState.state"],"s":"(!(_0===\"enabled\"))&&(_0===\"waitApproval\")"},"f":[" ",{"t":7,"e":"h3","a":{"class":"h3 g-margin-bottom--20"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.pending.device.title\")"}}]}," ",{"t":7,"e":"div","a":{"class":"pam_settings_sync_info"},"f":[{"t":7,"e":"Icon","a":{"name":"passwords-all-devices","cssCls":"pam_settings_sync_icon"}}," ",{"t":7,"e":"div","a":{"class":"pam_settings_sync_text"},"f":[{"t":7,"e":"div","a":{"class":"text -tiny"},"f":[{"t":7,"e":"span","a":{"class":"span -tiny -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.pending.device.desc\")"}}]}," ",{"t":7,"e":"div","a":{"class":"pam_steps text -tiny"},"f":[{"t":7,"e":"div","a":{"class":"pam_step"},"f":[{"t":7,"e":"div","f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.pending.device.step1\")"}}]}]}," ",{"t":7,"e":"div","a":{"class":"pam_step"},"f":[{"t":7,"e":"div","f":[{"t":3,"x":{"r":["nls","email"],"s":"_0(\"passwords.settings.sync.pending.device.step2\",_1)"}}]}]}," ",{"t":7,"e":"div","a":{"class":"pam_step"},"f":[{"t":7,"e":"div","f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.pending.device.step3\")"}}]}]}]}]}]}]}," ",{"t":7,"e":"p","a":{"class":"p -tiny -secondary g-margin-bottom--10"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.pending.device.alreadyApproved\")"}}]}," ",{"t":7,"e":"button","a":{"class":"btn -small"},"v":{"click":"recheck"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.pending.device.refresh\")"}}]}," ",{"t":7,"e":"button","a":{"class":"g-margin-left--10 btn -small -secondary"},"v":{"click":"askCancelSync"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.cancel\")"}}]}," ",{"t":7,"e":"div","a":{"class":"text -tiny -secondary g-margin-top--20"},"f":[{"t":7,"e":"div","f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.pending.device.noSyncedDevice\")"}},{"t":7,"e":"Icon","a":{"name":"info","cssCls":"pam_info_icon"}}]}," ",{"t":7,"e":"Tooltip","a":{"alignment":"bottom","position":"bottom","maxWidth":"400"},"f":[{"t":7,"e":"span","a":{"class":"text -tiny"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.pending.device.noSyncedDevice.tooltip\")"}}]}]}]}]},{"t":4,"n":50,"x":{"r":["invalidSyncState","syncState.state","syncState.reason"],"s":"(!(_1===\"enabled\"))&&((!(_1===\"waitApproval\"))&&(_0||((_1===\"enterIDAPwd\"||_1===\"enterIDAEmail\"||_1===\"accountSetup\")&&(_2===\"afterUpdate\"||_2===\"prove\"))))"},"f":[" ",{"t":7,"e":"h3","a":{"class":"h3 g-margin-bottom--20"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.banner.syncStopped.desc\")"}}]}," ",{"t":7,"e":"button","a":{"class":"btn -small"},"v":{"click":{"n":"showLoginModal","a":["loginAfterUpdate"]}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.login.btn.login\")"}}]}," ",{"t":7,"e":"button","a":{"class":"g-margin-left--10 btn -small -secondary"},"v":{"click":"askTurnOffSync"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.syncedDevices.turnOffSync.btn\")"}}]}]},{"t":4,"n":50,"x":{"r":["invalidSyncState","syncState.state","syncState.reason"],"s":"(!(_1===\"enabled\"))&&((!(_1===\"waitApproval\"))&&(!(_0||((_1===\"enterIDAPwd\"||_1===\"enterIDAEmail\"||_1===\"accountSetup\")&&(_2===\"afterUpdate\"||_2===\"prove\")))))"},"f":[" ",{"t":7,"e":"h3","a":{"class":"h3 g-margin-bottom--20"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.notSynced.title\")"}}]}," ",{"t":7,"e":"div","a":{"class":"pam_settings_sync_info"},"f":[{"t":7,"e":"Icon","a":{"name":"passwords-all-devices","cssCls":"pam_settings_sync_icon"}}," ",{"t":7,"e":"div","a":{"class":"pam_settings_sync_text"},"f":[{"t":7,"e":"div","a":{"class":"text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.notSynced.subtitle1\")"}}]}," ",{"t":7,"e":"div","a":{"class":"text -tiny -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.notSynced.desc1\")"}}]}]}]}," ",{"t":7,"e":"div","a":{"class":"pam_settings_sync_info"},"f":[{"t":7,"e":"Icon","a":{"name":"passwords-all-backed","cssCls":"pam_settings_sync_icon"}}," ",{"t":7,"e":"div","a":{"class":"pam_settings_sync_text"},"f":[{"t":7,"e":"div","a":{"class":"text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.notSynced.subtitle2\")"}}]}," ",{"t":7,"e":"div","a":{"class":"text -tiny -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.notSynced.desc2\")"}}]}]}]}," ",{"t":7,"e":"div","a":{"class":"pam_settings_sync_info"},"f":[{"t":7,"e":"Icon","a":{"name":"passwords-all-secure","cssCls":"pam_settings_sync_icon"}}," ",{"t":7,"e":"div","a":{"class":"pam_settings_sync_text"},"f":[{"t":7,"e":"div","a":{"class":"text -small"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.notSynced.subtitle3\")"}}]}," ",{"t":7,"e":"div","a":{"class":"text -tiny -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.notSynced.desc3\")"}}]}]}]}," ",{"t":7,"e":"button","a":{"class":"g-margin-top--20 btn -small"},"v":{"click":"startSync"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.turnOn.btn\")"}}]}]}],"x":{"r":["loading"],"s":"_0===true"}},{"t":4,"f":[{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.turnOff.title\")"}}]},"f":[{"t":7,"e":"p","a":{"class":"p"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.turnOff.desc\")"}}]}," ",{"t":7,"e":"div","a":{"class":"modal__actions"},"f":[{"t":7,"e":"Button","a":{"cssCls":"-secondary"},"v":{"click":"turnOffSync"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.turnOffAndDeleteData.btn\")"}}]}," ",{"t":7,"e":"Button","a":{"cssCls":"g-margin-left--10"},"v":{"click":"Modal.close"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.cancel\")"}}]}]}]}],"n":50,"x":{"r":["modalDialog"],"s":"_0===\"turnOffSync\""}},{"t":4,"f":[{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.info.title\")"}}]},"f":[{"t":7,"e":"div","a":{"class":"pam_steps"},"f":[{"t":7,"e":"div","a":{"class":"pam_step pam_step_big"},"f":[{"t":7,"e":"div","f":[{"t":7,"e":"h3","a":{"class":"h3"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.info.subtitle1\")"}}]}," ",{"t":7,"e":"p","a":{"class":"p"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.info.desc1\")"}}]}]}]}," ",{"t":7,"e":"div","a":{"class":"pam_step pam_step_big"},"f":[{"t":7,"e":"div","f":[{"t":7,"e":"h3","a":{"class":"h3"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.info.subtitle2\")"}}]}," ",{"t":7,"e":"p","a":{"class":"p"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.info.desc2\")"}}]}]}]}]}," ",{"t":7,"e":"div","a":{"class":"modal__actions"},"f":[{"t":7,"e":"button","a":{"class":"btn"},"v":{"click":"showMasterPasswordModal"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.continue\")"}}]}]}]}],"n":50,"x":{"r":["modalDialog"],"s":"_0===\"createMasterPasswordInfo\""}},{"t":4,"f":[{"t":7,"e":"RestoreIdentity"}],"n":50,"x":{"r":["modalDialog"],"s":"_0===\"restoreIdentity\""}},{"t":4,"f":[{"t":7,"e":"AskCancelSyncModal"}],"n":50,"x":{"r":["modalDialog"],"s":"_0===\"askCancelSync\""}},{"t":4,"f":[{"t":7,"e":"CheckEmailModal","a":{"syncState":[{"t":2,"r":"syncState"}]}}],"n":50,"x":{"r":["modalDialog"],"s":"_0===\"checkEmail\""}},{"t":4,"f":[{"t":7,"e":"ChangeAvastIdPasswordModal","a":{"syncState":[{"t":2,"r":"syncState"}]}}],"n":50,"x":{"r":["modalDialog"],"s":"_0===\"changeAvastIdPassword\""}},{"t":4,"f":[{"t":7,"e":"EnterBtokModal","a":{"syncState":[{"t":2,"r":"syncState"}]}}],"n":50,"x":{"r":["modalDialog"],"s":"_0===\"enterBtok\""}},{"t":4,"f":[{"t":7,"e":"EnterBackupPasswordModal","a":{"syncState":[{"t":2,"r":"syncState"}],"backupString":[{"t":2,"r":"restoringIdentity.backupString"}]}}],"n":50,"x":{"r":["modalDialog"],"s":"_0===\"enterBackupPassword\""}},{"t":4,"f":[{"t":7,"e":"LoginModal","a":{"syncState":[{"t":2,"r":"syncState"}],"socialLoginType":[{"t":2,"r":"socialLoginType"}],"email":[{"t":2,"r":"email"}]}}],"n":50,"x":{"r":["modalDialog"],"s":"_0===\"login\""}},{"t":4,"f":[{"t":7,"e":"CaptchaModal","a":{"syncState":[{"t":2,"r":"syncState"}],"cid":[{"t":2,"r":"solvingCaptcha.cid"}],"url":[{"t":2,"r":"solvingCaptcha.url"}]}}],"n":50,"x":{"r":["modalDialog"],"s":"_0===\"captcha\""}}]}; var css_248z$l = ".pam_device_cont {\n padding-top: 15px;\n padding-bottom: 15px;\n display: flex;\n border-bottom: 1px solid rgba(255,255,255,0.15);\n}\n.pam_device_cont .pam_device_icon {\n min-width: 70px;\n height: 70px;\n border-radius: 70px;\n margin-right: 20px;\n text-align: center;\n font-size: 40px;\n padding-top: 15px;\n}\n.pam_device_cont .pam_device_info {\n margin-top: 14px;\n width: 60%;\n}\n.pam_device_cont .pam_device_info .pam_device_info_line {\n display: flex;\n margin-top: 5px;\n}\n.pam_device_cont .pam_device_info .pam_device_info_line >div {\n display: inline-block;\n overflow: hidden;\n}\n.pam_device_cont .pam_device_info .pam_device_info_line .pam_device_info_type {\n width: 40%;\n}\n.pam_device_cont .pam_device_info .pam_device_info_line .pam_device_info_date {\n width: 60%;\n}\n.pam_device_cont .pam_device_action {\n margin-top: 20px;\n width: 30%;\n text-align: right;\n}\n"; const template$E = {"v":3,"t":[{"t":4,"f":[{"t":7,"e":"h3","a":{"class":"h3"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.syncedDevices.title\")"}}]}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_device_cont"},"f":[{"t":7,"e":"div","a":{"class":"pam_device_icon color-dark -bg"},"f":[{"t":7,"e":"Icon","a":{"name":["pam_device_",{"t":2,"r":"info.os"}]}}]}," ",{"t":7,"e":"div","a":{"class":"pam_device_info text -tiny"},"f":[{"t":7,"e":"div","f":[{"t":2,"r":"info.name"}]}," ",{"t":7,"e":"div","a":{"class":"pam_device_info_line"},"f":[{"t":7,"e":"div","a":{"class":"pam_device_info_type"},"f":[{"t":7,"e":"span","a":{"class":"span -tiny -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.syncedDevices.type\")"}}," "]},{"t":2,"r":"info.os"}]}," ",{"t":7,"e":"div","a":{"class":"pam_device_info_date"},"f":[{"t":3,"x":{"r":["nls","confirmCode"],"s":"_0(\"passwords.settings.sync.syncedDevices.pending\",_1)"}}]}]}]}," ",{"t":7,"e":"div","a":{"class":"pam_device_action"},"f":[{"t":4,"f":[{"t":7,"e":"span","a":{"class":"g-margin-right--20 spinner -tiny"}}],"n":50,"r":"_actionInProgress"},{"t":4,"n":51,"f":[{"t":7,"e":"button","a":{"class":"a text -tiny -secondary"},"v":{"click":{"n":"declineDevice","d":[{"t":2,"r":"."}]}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.decline\")"}}]}," ",{"t":7,"e":"button","a":{"class":"btn -small g-margin-left--5"},"v":{"click":{"n":"approveDevice","d":[{"t":2,"r":"."}]}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.allow\")"}}]}],"r":"_actionInProgress"}]}]}],"n":52,"r":"pendingDevices"}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_device_cont"},"f":[{"t":7,"e":"div","a":{"class":"pam_device_icon color-dark -bg"},"f":[{"t":7,"e":"Icon","a":{"name":["pam_device_",{"t":2,"r":"info.os"}]}}]}," ",{"t":7,"e":"div","a":{"class":"pam_device_info text -tiny"},"f":[{"t":7,"e":"div","f":[{"t":2,"r":"info.name"}," ",{"t":4,"f":[{"t":7,"e":"span","a":{"class":"color-ok -text"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.syncedDevices.thisDevice\")"}}]}],"n":50,"r":"info.currentDevice"}]}," ",{"t":7,"e":"div","a":{"class":"pam_device_info_line"},"f":[{"t":7,"e":"div","a":{"class":"pam_device_info_type"},"f":[{"t":7,"e":"span","a":{"class":"span -tiny -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.syncedDevices.type\")"}}," "]},{"t":2,"r":"info.os"}]}," ",{"t":7,"e":"div","a":{"class":"pam_device_info_date"},"f":[{"t":7,"e":"span","a":{"class":"span -tiny -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.syncedDevices.dateAdded\")"}}," "]},{"t":2,"r":"info.dateAdded"}]}]}]}," ",{"t":7,"e":"div","a":{"class":"pam_device_action"},"f":[{"t":4,"f":[{"t":4,"f":[{"t":7,"e":"span","a":{"class":"g-margin-right--20 spinner -tiny"}}],"n":50,"r":"_actionInProgress"},{"t":4,"n":51,"f":[{"t":7,"e":"span","a":{"class":"a -tiny text -secondary"},"v":{"click":{"n":"confirmRemoveDevice","d":[{"t":2,"r":"."}]}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.remove\")"}}]}],"r":"_actionInProgress"}],"n":50,"x":{"r":["info.currentDevice"],"s":"!_0"}}]}]}],"n":52,"r":"devices"}],"n":50,"x":{"r":["devices.length","pendingDevices.length"],"s":"_0>0||_1>0"}},{"t":4,"f":[{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls","deviceToRemove.info.name"],"s":"_0(\"passwords.settings.sync.syncedDevices.remove.title\",_1)"}}]},"f":[{"t":7,"e":"p","a":{"class":"p"},"f":[{"t":3,"x":{"r":["nls","deviceToRemove.info.name"],"s":"_0(\"passwords.settings.sync.syncedDevices.remove.info\",_1)"}}]}," ",{"t":7,"e":"div","a":{"class":"modal__actions"},"f":[{"t":7,"e":"Button","a":{"disabled":[{"t":2,"r":"deviceToRemove._actionInProgress"}],"cssCls":[{"t":2,"x":{"r":["deviceToRemove._actionInProgress"],"s":"_0?\"-loading\":\"\""}}," -secondary"]},"v":{"click":"removeDevice"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.syncedDevices.removeAndDelete.btn\")"}}]}," ",{"t":7,"e":"Button","a":{"disabled":[{"t":2,"r":"deviceToRemove._actionInProgress"}],"cssCls":"g-margin-left--10"},"v":{"click":"Modal.close"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.cancel\")"}}]}]}]}],"n":50,"x":{"r":["modalDialog"],"s":"_0===\"removeDevice\""}}]}; const DEVICES_SYNC_INTERVAL = 12000; const SyncedDevices = Ractive.extend({ isolated: true, template: template$E, css: css_248z$l, data: function() { return { devices: [], pendingDevices: [], deviceToRemove: undefined }; }, onrender: function() { // For some reason, oninit was called twice and then setInterval was called twice this._syncCheckInterval = undefined; this.listeners = []; this._initDevices(); this.listeners.push(NAPI.on('app.pam.onStatusChanged.synchronizationDone', () => { this._initDevices(); })); this.on('confirmRemoveDevice', (e, device) => { this.set('deviceToRemove', device); this.set('modalDialog', 'removeDevice'); }); this.on('Modal.close', () => { this.set('modalDialog', undefined); }); this.on('removeDevice', () => { const device = this.get('deviceToRemove'); this.set('deviceToRemove._actionInProgress', true); this._doDeviceAction('app.pam.RemoveDeviceIdentity', device).then(() => { this.set('modalDialog', undefined); }).catch(() => { this.set('modalDialog', undefined); }); }); this.on('approveDevice', (e, device) => { this._doDeviceAction('app.pam.ApproveIdentity', device); }); this.on('declineDevice', (e, device) => { this._doDeviceAction('app.pam.DeclineIdentity', device); }); this._startPollingSync(); }, _doDeviceAction(request, device) { // delete device.info not to send delete device.info in params delete device.info; // copy object not to send _actionInProgress in params const identity = Object.assign({}, device); device._actionInProgress = true; return NAPI.request(request, {identity: identity}) .then(() => { this._initDevices(); }).catch((err) => { console.error(request, JSON.stringify(err)); this._initDevices(); }); }, _initDevices() { NAPI.request('app.pam.GetTrustedIdentityList').then((data) => { const devices = []; // Current Device const device = this._getDevice(data.myIdentity, true); if (device) { devices.push(device); } // Approved devices const trustedIdentities = data.trustedIdentities; if (trustedIdentities && trustedIdentities.length > 0) { for (const trustedIdentity of trustedIdentities) { const approvedDevice = this._getDevice(trustedIdentity); if (approvedDevice) { devices.push(approvedDevice); } } } this.set('devices', undefined); this.set('devices', devices); }).catch((err) => { console.error('app.pam.GetTrustedIdentityList', JSON.stringify(err)); }); NAPI.request('app.pam.GetWaitingIdentityList').then((data) => { // Pending devices const pendingDevices = []; const waitingIdentities = data.waitingIdentities; if (waitingIdentities && waitingIdentities.length > 0) { for (const waitingIdentity of waitingIdentities) { const pendingDevice = this._getDevice(waitingIdentity); if (pendingDevice) { pendingDevices.push(pendingDevice); } } } this.set('pendingDevices', undefined); this.set('pendingDevices', pendingDevices); }).catch((err) => { console.error('app.pam.GetWaitingIdentityList', JSON.stringify(err)); }); }, _getDevice(device, currentDevice = false){ if (device) { const deviceInfo = this._getDeviceInfo(device.description, currentDevice); if (deviceInfo) { device.info = deviceInfo; return device; } } }, _getDeviceInfo(desc, currentDevice = false) { const parsedIdentity = parseIdentityDescription(desc); if (parsedIdentity.os.length === 0) { // Don't display backup identity return undefined; } const os = parsedIdentity.os; let dateAdded = parsedIdentity.dateAdded; const time = Ractive.localization.moment(dateAdded, 'YYYYMMDDhhmmss'); dateAdded = time.format('ll'); const name = parsedIdentity.deviceName; return {os: os, dateAdded: dateAdded, name: name, currentDevice: currentDevice}; }, _startPollingSync() { if (!this._syncCheckInterval) { this._syncCheckInterval = setInterval(() => { this._callSync(); }, DEVICES_SYNC_INTERVAL); } }, _callSync() { console.debug('_callSync syncedDevices.js'); NAPI.request('app.pam.Synchronize'); }, _clearPollingSyncInterval() { if (this._syncCheckInterval) { clearInterval(this._syncCheckInterval); this._syncCheckInterval = undefined; } }, onteardown() { this._clearPollingSyncInterval(); this.listeners.forEach(off => off()); } }); var css_248z$m = ".pam_links_cont {\n display: flex;\n justify-content: space-between;\n padding-top: 20px;\n}\n"; const template$F = {"v":3,"t":[{"t":4,"f":[{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.loginFromMainUi.title\")"}}]},"f":[{"t":7,"e":"form","a":{"class":"pam_login_modal_form"},"f":[{"t":4,"f":[{"t":8,"r":"prefilled_email_partial"}],"n":50,"r":"email"},{"t":4,"n":51,"f":[{"t":8,"r":"email_partial"}],"r":"email"}," ",{"t":8,"r":"password_partial"}," ",{"t":7,"e":"button","a":{"type":"submit","disabled":[{"t":2,"r":"inProgress"}],"class":["btn ",{"t":2,"x":{"r":["inProgress"],"s":"_0?\"-loading\":\"\""}}]},"v":{"click":"loginClick"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.login.btn.login\")"}}]}," ",{"t":7,"e":"GenericError","a":{"show":[{"t":2,"r":"showGenericError"}]}}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":"g-margin-top--10 color-critical -text"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.error.wrongAccount\")"}}]}],"n":50,"r":"showWrongAccount"}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--15 g-margin-bottom--10"},"f":[{"t":7,"e":"a","a":{"class":"a","href":"https://id.avast.com/#recoverPassword"},"v":{"click":"browser"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.lnk.forgotPassword\")"}}]}]}," ",{"t":7,"e":"div","a":{"class":"strike lic_strike"},"f":[{"t":7,"e":"div","a":{"class":"span -secondary -small g-font--uppercase"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.login.desc2\")"}}]}]}," ",{"t":4,"f":[{"t":7,"e":"GoogleLogin"}," ",{"t":7,"e":"FacebookLogin"}],"n":50,"r":"socialLoginsReadyToLoad"}]}]}],"n":50,"x":{"r":["page"],"s":"_0===\"loginAfterUpdate\"||_0===\"loginAfterUpdateFromMainUi\""}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["page"],"s":"_0===\"login\""},"f":[{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.login.title\")"}}]},"f":[{"t":7,"e":"p","a":{"class":"modal__content g-margin-bottom--20"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.login.desc\")"}}]}," ",{"t":7,"e":"form","a":{"class":"pam_login_modal_form"},"f":[{"t":8,"r":"email_partial"}," ",{"t":8,"r":"password_partial"}," ",{"t":7,"e":"button","a":{"type":"submit","disabled":[{"t":2,"r":"inProgress"}],"class":["btn ",{"t":2,"x":{"r":["inProgress"],"s":"_0?\"-loading\":\"\""}}],"data-test":"login"},"v":{"click":"loginClick"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.login.btn.login\")"}}]}," ",{"t":7,"e":"GenericError","a":{"show":[{"t":2,"r":"showGenericError"}]}}," ",{"t":7,"e":"div","a":{"class":"form__row pam_links_cont"},"f":[{"t":7,"e":"a","a":{"class":"a"},"v":{"click":{"n":"setPage","a":"createAccount"}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.login.lnk.dontHaveAccount\")"}}]}," ",{"t":7,"e":"a","a":{"class":"a","href":"https://id.avast.com/#recoverPassword"},"v":{"click":"browser"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.lnk.forgotPassword\")"}}]}]}," ",{"t":7,"e":"div","a":{"class":"strike lic_strike"},"f":[{"t":7,"e":"div","a":{"class":"span -secondary -small g-font--uppercase"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.login.desc2\")"}}]}]}," ",{"t":4,"f":[{"t":7,"e":"GoogleLogin"}," ",{"t":7,"e":"FacebookLogin"}],"n":50,"r":"socialLoginsReadyToLoad"}]}]}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"login\"))&&(_0===\"createAccount\")"},"f":[" ",{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.create.title\")"}}]},"f":[{"t":7,"e":"form","a":{"class":"pam_login_modal_form"},"f":[{"t":8,"r":"email_partial"}," ",{"t":8,"r":"new_password_partial"}," ",{"t":7,"e":"button","a":{"type":"submit","disabled":[{"t":2,"r":"inProgress"}],"class":["btn ",{"t":2,"x":{"r":["inProgress"],"s":"_0?\"-loading\":\"\""}}]},"v":{"click":{"n":"createAccountClick","a":["Avast"]}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.create.title\")"}}]}," ",{"t":7,"e":"GenericError","a":{"show":[{"t":2,"r":"showGenericError"}]}}," ",{"t":7,"e":"div","a":{"class":"form__row pam_links_cont"},"f":[{"t":7,"e":"a","a":{"class":"a"},"v":{"click":{"n":"setPage","a":"login"}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.create.lnk.alreadyHaveAccount\")"}}]}]}," ",{"t":7,"e":"LegalInfo"}]}]}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"login\"))&&((!(_0===\"createAccount\"))&&(_0===\"createPasswordSocial\"))"},"f":[" ",{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.createPassword.title\")"}}]},"f":[{"t":7,"e":"p","a":{"class":"modal__content g-margin-bottom--20"},"f":[{"t":3,"x":{"r":["nls","input.email","socialLoginType"],"s":"_0(\"passwords.settings.sync.modal.createPassword.desc\",_1,_2)"}}]}," ",{"t":7,"e":"form","a":{"class":"pam_login_modal_form"},"f":[{"t":8,"r":"prefilled_email_partial"}," ",{"t":8,"r":"new_password_partial"}," ",{"t":7,"e":"button","a":{"type":"submit","disabled":[{"t":2,"r":"inProgress"}],"class":["btn ",{"t":2,"x":{"r":["inProgress"],"s":"_0?\"-loading\":\"\""}}]},"v":{"click":"createPasswordClick"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.createPassword.btn.save\")"}}]}]}]}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"login\"))&&((!(_0===\"createAccount\"))&&((!(_0===\"createPasswordSocial\"))&&(_0===\"loginPasswordSocial\")))"},"f":[" ",{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.loginPassword.title\")"}}]},"f":[{"t":7,"e":"p","a":{"class":"modal__content g-margin-bottom--20"},"f":[{"t":3,"x":{"r":["nls","input.email","socialLoginType"],"s":"_0(\"passwords.settings.sync.modal.loginPassword.desc\",_1,_2)"}}]}," ",{"t":7,"e":"form","a":{"class":"pam_login_modal_form"},"f":[{"t":8,"r":"prefilled_email_partial"}," ",{"t":8,"r":"password_partial"}," ",{"t":7,"e":"button","a":{"type":"submit","disabled":[{"t":2,"r":"inProgress"}],"class":["btn ",{"t":2,"x":{"r":["inProgress"],"s":"_0?\"-loading\":\"\""}}]},"v":{"click":"loginPasswordClick"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.login.btn.login\")"}}]}," ",{"t":7,"e":"GenericError","a":{"show":[{"t":2,"r":"showGenericError"}]}}," ",{"t":7,"e":"div","a":{"class":"form__row pam_links_cont"},"f":[{"t":7,"e":"a","a":{"class":"a","href":"https://id.avast.com/#recoverPassword"},"v":{"click":"browser"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.lnk.forgotPassword\")"}}]}]}]}]}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"login\"))&&((!(_0===\"createAccount\"))&&((!(_0===\"createPasswordSocial\"))&&((!(_0===\"loginPasswordSocial\"))&&(_0===\"createAccountSocial\"))))"},"f":[" ",{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.createAccountSocial.title\")"}}]},"f":[{"t":7,"e":"form","a":{"class":"pam_login_modal_form"},"f":[{"t":7,"e":"p","a":{"class":"modal__content g-margin-bottom--20"},"f":[{"t":3,"x":{"r":["nls","socialLoginType"],"s":"_0(\"passwords.settings.sync.modal.createAccountSocial.desc\",_1)"}}]}," ",{"t":8,"r":"email_partial"}," ",{"t":8,"r":"password_partial"}," ",{"t":7,"e":"button","a":{"type":"submit","disabled":[{"t":2,"r":"inProgress"}],"class":["btn ",{"t":2,"x":{"r":["inProgress"],"s":"_0?\"-loading\":\"\""}}]},"v":{"click":{"n":"createAccountClick","d":[{"t":2,"r":"socialLoginType"}]}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.createAccountSocial.btn.createLogin\")"}}]}," ",{"t":7,"e":"GenericError","a":{"show":[{"t":2,"r":"showGenericError"}]}}]}]}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"login\"))&&((!(_0===\"createAccount\"))&&((!(_0===\"createPasswordSocial\"))&&((!(_0===\"loginPasswordSocial\"))&&((!(_0===\"createAccountSocial\"))&&(_0===\"enterPreviousPassword\")))))"},"f":[" ",{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.enterPreviousPassword.title\")"}}]},"f":[{"t":7,"e":"p","a":{"class":"modal__content g-margin-bottom--20"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.enterPreviousPassword.desc\")"}}]}," ",{"t":7,"e":"form","a":{"class":"pam_login_modal_form"},"f":[{"t":8,"r":"prefilled_email_partial"}," ",{"t":8,"r":"password_partial"}," ",{"t":7,"e":"button","a":{"type":"submit","disabled":[{"t":2,"r":"inProgress"}],"class":["btn ",{"t":2,"x":{"r":["inProgress"],"s":"_0?\"-loading\":\"\""}}]},"v":{"click":"loginPasswordClick"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.loginPassword.btn.confirm\")"}}]}," ",{"t":7,"e":"GenericError","a":{"show":[{"t":2,"r":"showGenericError"}]}}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--15 g-margin-bottom--10"},"f":[{"t":7,"e":"a","a":{"class":"a"},"v":{"click":"showChangeAvastIdPasswordModal"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.back\")"}}]}]}]}]}]}],"x":{"r":["page"],"s":"_0===\"loginAfterUpdate\"||_0===\"loginAfterUpdateFromMainUi\""}}," "],"p":{"email_partial":[{"t":7,"e":"div","a":{"class":"form__row"},"v":{"click":{"n":"clearInputErrors","a":"email"}},"f":[{"t":7,"e":"Input","a":{"id":"email","innerValue":[{"t":2,"r":"input.email"}],"label":[{"t":3,"x":{"r":["page","nls"],"s":"_0===\"createAccount\"?_1(\"passwords.settings.sync.label.email\"):_1(\"passwords.settings.sync.label.enterEmail\")"}}],"type":"text","message":[{"t":2,"r":"inputError.email.message"}],"error":[{"t":2,"r":"inputError.email.error"}]}}]}],"prefilled_email_partial":[{"t":7,"e":"div","a":{"class":"form__row"},"f":[{"t":7,"e":"Input","a":{"disabled":0,"id":"email","innerValue":[{"t":2,"r":"email"}],"label":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.label.email\")"}}],"type":"text"}}]}],"password_partial":[{"t":7,"e":"div","a":{"class":"form__row"},"f":[{"t":7,"e":"div","a":{"class":"pam_settings_input_reveal_secret_cont"},"v":{"click":{"n":"clearInputErrors","a":"password"}},"f":[{"t":7,"e":"ButtonRevealSecret","a":{"isRevealed":[{"t":2,"r":"inputReveal.password"}],"cssCls":"pam_settings_reveal_secret"}}," ",{"t":4,"f":[{"t":7,"e":"Input","a":{"id":"password","innerValue":[{"t":2,"r":"input.password"}],"label":[{"t":3,"x":{"r":["page","nls"],"s":"_0===\"enterPreviousPassword\"?_1(\"passwords.settings.sync.label.enterPreviousPassword\"):_1(\"passwords.settings.sync.label.enterPassword\")"}}],"type":"text","readonly":"true","message":[{"t":2,"r":"inputError.password.message"}],"error":[{"t":2,"r":"inputError.password.error"}]}}],"n":50,"r":"inputReveal.password"},{"t":4,"n":51,"f":[{"t":7,"e":"Input","a":{"id":"password","innerValue":[{"t":2,"r":"input.password"}],"label":[{"t":3,"x":{"r":["page","nls"],"s":"_0===\"enterPreviousPassword\"?_1(\"passwords.settings.sync.label.enterPreviousPassword\"):_1(\"passwords.settings.sync.label.enterPassword\")"}}],"type":"password","message":[{"t":2,"r":"inputError.password.message"}],"error":[{"t":2,"r":"inputError.password.error"}]}}],"r":"inputReveal.password"}]}]}],"new_password_partial":[{"t":7,"e":"div","a":{"class":"form__row"},"f":[{"t":7,"e":"div","a":{"class":"pam_settings_input_reveal_secret_cont"},"f":[{"t":7,"e":"ButtonRevealSecret","a":{"isRevealed":[{"t":2,"r":"inputReveal.newPassword"}],"cssCls":"pam_settings_reveal_secret"}}," ",{"t":4,"f":[{"t":7,"e":"Input","a":{"id":"newPassword","innerValue":[{"t":2,"r":"input.newPassword"}],"label":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.label.createPassword\")"}}],"type":"text","readonly":"true","message":[{"t":2,"r":"inputError.newPassword.message"}],"error":[{"t":2,"r":"inputError.newPassword.error"}]},"v":{"blur":"newPasswordBlur","focus":"newPasswordFocus"}}],"n":50,"r":"inputReveal.newPassword"},{"t":4,"n":51,"f":[{"t":7,"e":"Input","a":{"id":"newPassword","innerValue":[{"t":2,"r":"input.newPassword"}],"label":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.label.createPassword\")"}}],"type":"password","message":[{"t":2,"r":"inputError.newPassword.message"}],"error":[{"t":2,"r":"inputError.newPassword.error"}]},"v":{"blur":"newPasswordBlur","focus":"newPasswordFocus"}}],"r":"inputReveal.newPassword"}]}]}]}}; const template$G = {"v":3,"t":[{"t":7,"e":"script","a":{"src":"https://apis.google.com/js/api:client.js?onload=ongapiLoadCallback","async":0,"defer":0}}," ",{"t":7,"e":"button","a":{"type":"button","class":"btn -secondary"},"v":{"click":"googleLoginClick"},"f":[{"t":7,"e":"i","a":{"class":"svg -google"}},{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.social.btn.google\")"}}]}]}; const GOOGLE_ID_AVAST = '267505377073.apps.googleusercontent.com'; const GoogleLogin = Ractive.extend({ template: template$G, data() { return { googleApiPromise: null }; }, oninit: function() { this.auth2 = undefined; this.on('googleLoginClick', () => { this.fire('loginInProgress'); this.get('googleApiPromise').then(rdata => { if (typeof this.auth2 === 'undefined') { gapi && gapi.load('auth2', () => { // eslint-disable-line no-undef try { this.auth2 = gapi.auth2.init({ // eslint-disable-line no-undef 'client_id': rdata[0], 'scope': 'profile email' }); } catch (e) { console.error('Google api failed to load', e); this.fire('loginFailed'); return; } this._login(); }); } else { this._login(); } }); }); const googleIdPromise = this.getGoogleId(); const apiLoadPromise = new Promise(res => { window.ongapiLoadCallback = () => res(); }); this.set({googleApiPromise: Promise.all([ googleIdPromise, apiLoadPromise ])}); }, _login() { if (!this.auth2) { this.fire('loginFailed'); console.error('Google api failed to load'); return; } this.auth2.signIn().then(() => { const googleUser = this.auth2.currentUser.get(); this.fire('loggedIn', 'Google'); NAPI.request('app.pam.SynchronizationSetup', { request: 'accountSetup', data: { account: 'Google', //eslint-disable-next-line max-len idToken: PamCrypto$1.dataCryptoEnabled? PamCrypto$1.encrypt(googleUser.Zi.id_token) : googleUser.Zi.id_token, name: googleUser.w3.ofa, surname: googleUser.w3.wea, imageUrl: googleUser.w3.Paa } }).catch((err) => { console.error('app.pam.SynchronizationSetup', JSON.stringify(err)); }); this.auth2.disconnect().catch(() => { console.error('Google disconnect failed'); }); }).catch(() => { console.error('Google login failed'); this.fire('loginFailed'); }); }, getGoogleId(){ return NAPI.request('app.settings.Get', {name: 'avdef://config/Licensing.UI/googleClientID'}).then((response) => { if (response != null) { return response.value; } else { return GOOGLE_ID_AVAST; } }).catch(() => { return GOOGLE_ID_AVAST; }); }, onteardown() { delete window.ongapiLoadCallback; } }); const template$H = {"v":3,"t":[{"t":7,"e":"script","f":["// Load the SDK asynchronously\n (function(d, s, id) {\n var js, fjs = d.getElementsByTagName(s)[0];\n if (d.getElementById(id)) return;\n js = d.createElement(s); js.id = id;\n js.src = \"https://connect.facebook.net/en_US/sdk.js\";\n fjs.parentNode.insertBefore(js, fjs);\n }(document, 'script', 'facebook-jssdk'));"]}," ",{"t":7,"e":"button","a":{"type":"button","class":"btn -secondary g-margin-left--10"},"v":{"click":"facebookLoginClick"},"f":[{"t":7,"e":"i","a":{"class":"svg -facebook"}},{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.social.btn.facebook\")"}}]}]}; const FACEBOOK_ID_AVAST = '392390561304951'; const FacebookLogin = Ractive.extend({ template: template$H, data() { return { fbApiPromise: null, fbInitialized: false }; }, oninit() { this.on('facebookLoginClick', () => { this.fire('loginInProgress'); if (this.get('fbInitialized')) { this._login(); return; } this.get('fbApiPromise').then(rdata => { try { FB && FB.init({ // eslint-disable-line no-undef appId: rdata[0], cookie: true, // enable cookies to allow the server to access the session xfbml: true, // parse social plugins on this page version: 'v2.8' // use version 2.8 }); this.set({fbInitialized: true}); this._login(); } catch (e) { console.error('FB api failed to load'); this.fire('loginFailed'); } }); }); const fbIdPromise = this.getFacebookId(); const fbInitPromise = new Promise(res => { window.fbAsyncInit = () => res(); }); this.set({fbApiPromise: Promise.all([ fbIdPromise, fbInitPromise ])}); }, _login() { try { FB; // eslint-disable-line no-undef } catch (e) { if (e instanceof ReferenceError) { this.fire('loginFailed'); console.error('FB api failed to load'); return; } } // Logout user if already logged in FB.getLoginStatus((response) => { // eslint-disable-line no-undef if (response.status === 'connected') { FB.logout((response) => { // eslint-disable-line no-undef console.log('FB logout, status: ', response.status); this.login(); }); } else { this.login(); } }); }, getFacebookId() { return NAPI$1.request('app.settings.Get', {name: 'avdef://config/Licensing.UI/facebookClientID'}).then((response) => { if (response != null) { return response.value; } else { return FACEBOOK_ID_AVAST; } }).catch(() => { return FACEBOOK_ID_AVAST; }); }, login() { FB.login((response) => { // eslint-disable-line no-undef if (response.status === 'connected') { this.fire('loggedIn', 'Facebook'); NAPI$1.request('app.pam.SynchronizationSetup', { request: 'accountSetup', data: { account: 'Facebook', //eslint-disable-next-line max-len token: PamCrypto$1.dataCryptoEnabled? PamCrypto$1.encrypt(response.authResponse.accessToken) : response.authResponse.accessToken, expiration: response.authResponse.expiresIn } }).catch((err) => { console.error('app.pam.SynchronizationSetup', JSON.stringify(err)); }); } else if (response.status === 'not_authorized') { // The person is logged into Facebook, but not your app. console.error('Facebook login failed', response.status); this.fire('loginFailed'); } else { // The person is not logged into Facebook, so we're not sure if they are logged into this app or not. console.error('Facebook login failed', response.status); this.fire('loginFailed'); } }, { scope: 'email' }); }, onteardown() { delete window.fbAsyncInit; } }); const template$I = {"v":3,"t":[{"t":7,"e":"div","a":{"class":"text -small -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.legal.desc\")"}}," ",{"t":7,"e":"a","v":{"click":{"n":"openLink","a":"privacyPolicy"}},"a":{"class":"a"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.legal.lnk.privacyPolicy\")"}}]}," ",{"t":7,"e":"a","v":{"click":{"n":"openLink","a":"eula"}},"a":{"class":"a"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"about.eula\")"}}]}]}]}; const EULA_IPM_ID = 34; const PRIVACY_POLICY_IPM_ID = 11; const LegalInfo = Ractive.extend({ template: template$I, oninit() { this.on('openLink', (e, legalDoc) => { let ipmId; if (legalDoc === 'eula') { ipmId = EULA_IPM_ID; } else if (legalDoc === 'privacyPolicy') { ipmId = PRIVACY_POLICY_IPM_ID; } else { return; } NAPI.request('app.utils.GetUrlParameters', ipmId).then(url => { const isAction = url.indexOf('&action=') > -1; // make sure action is =2 return isAction ? url.replace(/&action=\d*/, '&action=2') : url + '&action=2'; }).then(url => { NAPI.request('av.command', 'shell_exec:open:' + url); }); }); } }); const template$J = {"v":3,"t":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"g-margin-top--10 color-critical -text"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.error.generic\")"}}]}],"n":50,"r":"show"}]}; const GenericError = Ractive.extend({ template: template$J }); const LoginModal = Ractive.extend({ template: template$F, css: css_248z$m, components: { ButtonRevealSecret, GoogleLogin, FacebookLogin, LegalInfo, GenericError }, data: function() { return { socialLoginsReadyToLoad: false, showGenericError: false, showWrongAccount: false, page: 'login', inProgress: false, input: { password: '', email: '', newPassword: '' }, inputReveal: { password: false, newPassword: false }, inputError: { password: { error: false, message: '' }, email: { error: false, message: '' }, newPassword: { error: false, message: '' }, } }; }, oninit() { // Needed for loading FB/Google api, if login is opened from main UI setTimeout(() => this.set('socialLoginsReadyToLoad', true)); this.observe('email', (email) => { if (email) { // Update ractive. For some reason, value was overridden by init data value this.update('input.email'); this.set('input.email', email); } }, { init: true }); this.observe('syncState', (syncState) => { if (!syncState) { return; } this.set('inProgress', false); const page = this.get('page'); if (syncState.reason === 'wrongAccount') { this.set('showWrongAccount', true); } else if (syncState.reason === 'alreadyExist') { this.set({ 'inputError.email.error': true, 'inputError.email.message': Ractive.localization.nls('passwords.settings.sync.modal.create.error.emailAlreadyUsed') }); } else if (syncState.reason === 'invalid') { if (page.indexOf('createAccount') > -1) { this.set({ 'inputError.email.error': true, 'inputError.email.message': Ractive.localization.nls('passwords.settings.sync.modal.create.error.emailAlreadyUsed') }); } else { this.set({ 'inputError.password.error': true, 'inputError.email.error': true, 'inputError.password.message': Ractive.localization.nls('passwords.settings.sync.modal.login.error.incorrectEmailPassword') }); } } else if (syncState.reason === 'error') { this.set('showGenericError', true); } }, { init: true }); this.observe('input.newPassword', () => { this._validateInput('newPassword'); this._clearInputErrors('newPassword', false); }, { init: false }); this.on('Modal.close', () => { const page = this.get('page'); if (page === 'loginAfterUpdateFromMainUi') { // Login modal can be opened from mainUi // In this case, don't cancel sync and close settings this.fire('loginClosed'); } else if (page === 'loginAfterUpdate') { this.fire('close'); } else { this.fire('modalAskCancelSync', {page: this.get('page')}); } }); this.on('setPage', (e, page) => { if (this.get('inProgress')) { return false; } this.set('page', page); }); this.on('clearInputErrors', (e, input, clearMessage) => { this._clearInputErrors(input, clearMessage); }); this.on('newPasswordFocus', () => { this._validateInput('newPassword'); this._clearInputErrors('newPassword', false); }); this.on('newPasswordBlur', () => { this._clearInputErrors('newPassword'); }); this.on('loginClick', () => { this._validateInput('email'); this._validateInput('password'); if (this.get('inputError.email.error') || this.get('inputError.password.error')) { return false; } this.set('inProgress', true); NAPI.request('app.pam.SynchronizationSetup', { request: 'accountSetup', data: { create: false, account: 'Avast', email: PamCrypto$1.dataCryptoEnabled? PamCrypto$1.encrypt(this.get('input.email')) : this.get('input.email'), pwd: PamCrypto$1.dataCryptoEnabled? PamCrypto$1.encrypt(this.get('input.password')) : this.get('input.password') } }).catch((err) => { console.error('app.pam.SynchronizationSetup', JSON.stringify(err)); }); }); this.on('createAccountClick', (e, account = 'Avast') => { this._validateInput('email'); this._validateInput('newPassword'); if (this.get('inputError.email.error') || this.get('inputError.newPassword.error')) { return false; } this.set('inProgress', true); NAPI.request('app.pam.SynchronizationSetup', { request: 'accountSetup', data: { create: true, account: account, email: PamCrypto$1.dataCryptoEnabled? PamCrypto$1.encrypt(this.get('input.email')) : this.get('input.email'), pwd: PamCrypto$1.dataCryptoEnabled? PamCrypto$1.encrypt(this.get('input.newPassword')) : this.get('input.newPassword') } }).catch((err) => { console.error('app.pam.SynchronizationSetup', JSON.stringify(err)); }); }); this.on('FacebookLogin.loginInProgress GoogleLogin.loginInProgress', () => { this.set('showGenericError', false); this.set('inProgress', true); }); this.on('FacebookLogin.loginFailed GoogleLogin.loginFailed', () => { this.set('showGenericError', true); this.set('inProgress', false); }); this.on('createPasswordClick', () => { this._validateInput('newPassword'); if (this.get('inputError.newPassword.error')) { return false; } this._enterPassword(this.get('input.newPassword')); }); this.on('loginPasswordClick', () => { this._validateInput('password'); if (this.get('inputError.password.error')) { return false; } this._enterPassword(this.get('input.password')); }); this.on('showChangeAvastIdPasswordModal', () => { this.fire('enterPreviousPassword', false); }); }, _enterPassword(password) { this.set('inProgress', true); NAPI.request('app.pam.SynchronizationSetup', { request: this.get('page') === 'enterPreviousPassword' ? 'enterCredForBackup' : 'enterIDAPwd', data: { pwd: PamCrypto$1.dataCryptoEnabled? PamCrypto$1.encrypt(password) : password } }).catch((err) => { console.error('app.pam.SynchronizationSetup', JSON.stringify(err)); }); }, _validateInput(input) { // eslint-disable-next-line max-len, no-useless-escape const EMAIL_REGEXP = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@(([a-zA-Z0-9]+(\.|\-))*([a-zA-Z0-9]+)\.)+[a-zA-Z]{2,}$/; switch (input) { case 'email': this._clearInputErrors(input); if (!EMAIL_REGEXP.test(this.get('input.email'))) { this.set({ 'inputError.email.error': true, 'inputError.email.message': Ractive.localization.nls('passwords.settings.sync.modal.create.error.invalidEmail') }); } break; case 'newPassword': this._clearInputErrors(input); if (this.get('input.newPassword').length < 8) { this.set({ 'inputError.newPassword.error': true, 'inputError.newPassword.message': Ractive.localization.nls('passwords.settings.sync.modal.createPassword.error.passwordTooShort') }); } break; case 'password': this._clearInputErrors(input); if (this.get('input.password').length === 0) { this.set({ 'inputError.password.error': true }); } break; } }, _clearInputErrors(input, clearMessage = true) { this.set('showGenericError', false); this.set('showWrongAccount', false); if (input) { if (clearMessage) { this.set('inputError.' + input, { error: false, message: '' }); } else { this.set('inputError.' + input + '.error', false); } } } }); const template$K = {"v":3,"t":[{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.restoreIdentity.title\")"}}]},"f":[{"t":7,"e":"div","a":{"class":"pam_steps"},"f":[{"t":7,"e":"div","a":{"class":"pam_step pam_step_big"},"f":[{"t":7,"e":"div","f":[{"t":7,"e":"h3","a":{"class":"h3"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.restoreIdentity.subtitle1\")"}}]}," ",{"t":7,"e":"p","a":{"class":"p"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.restoreIdentity.desc1\")"}}]}]}]}," ",{"t":7,"e":"div","a":{"class":"pam_step pam_step_big"},"f":[{"t":7,"e":"div","f":[{"t":7,"e":"h3","a":{"class":"h3"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.restoreIdentity.subtitle2\")"}}]}," ",{"t":7,"e":"p","a":{"class":"p"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.restoreIdentity.desc2\")"}}]}]}]}]}," ",{"t":7,"e":"div","a":{"class":"modal__actions"},"f":[{"t":7,"e":"button","a":{"disabled":[{"t":2,"r":"inProgress"}],"class":["btn ",{"t":2,"x":{"r":["inProgress"],"s":"_0?\"-loading\":\"\""}}]},"v":{"click":"continue"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.continue\")"}}]}]}]}]}; const RestoreIdentity = Ractive.extend({ template: template$K, data() { return { inProgress: false }; }, oninit() { this.on('continue', () => { this.set('inProgress', true); this.fire('restoreStart', { backupString: decodeURIComponent(this.get('backupString')) }); return NAPI$1.request('app.pam.SynchronizationSetup', {request: 'getState'}).then((data) => { if (data.lastSyncState === 'disabled') { // Start sync to in order to start restore identity flow. Only if the sync is not running yet. NAPI$1.request('app.pam.SynchronizationSetup', {request: 'startSync'}).catch((err) => { console.error('app.pam.SynchronizationSetup', JSON.stringify(err)); }); } }).catch((err) => { console.error('app.pam.SynchronizationSetup', JSON.stringify(err)); }); }); } }); const template$L = {"v":3,"t":[{"t":7,"e":"Modal","f":[{"t":7,"e":"Icon","a":{"name":"passwords-email","cssCls":"g-font--40"}}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--20 modal__title"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.pending.email.title\")"}}]}," ",{"t":7,"e":"span","a":{"class":"span -small -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.btok.desc\")"}}]}," ",{"t":7,"e":"span","a":{"class":"span -small g-font--bold"},"f":[{"t":2,"r":"email"}]},". ",{"t":7,"e":"div","a":{"class":"g-margin-top--20 g-margin-bottom--20 text -small -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.btok.desc2\")"}}]}," ",{"t":7,"e":"div","a":{"class":[{"t":2,"x":{"r":["codeError"],"s":"_0?\"animated shakeLess\":\"\""}}]},"f":[{"t":7,"e":"span","a":{"class":"pam_digit_input_group"},"f":[{"t":4,"f":[{"t":7,"e":"span","a":{"class":"input__row -letters"},"f":[{"t":7,"e":"input","a":{"disabled":[{"t":2,"r":"inProgress"}],"class":[{"t":2,"x":{"r":["codeError"],"s":"_0?\"-error\":\"\""}}," input"],"type":"text","value":[{"t":2,"rx":{"r":"code","m":[{"t":30,"n":"i"}]}}],"maxlength":[{"t":2,"r":"DIGITS_PER_GROUP"}],"onkeydown":"this.value=''","spellcheck":"false"},"v":{"keyup":"inputKeyup","focus":"inputFocus","click":"inputClick","paste":"codePasted"},"m":[{"t":2,"x":{"r":["i"],"s":"_0===0?\"autofocus\":\"\""}}]}]}],"n":52,"i":"i","r":"GROUPS_COUNT"}]}," ",{"t":7,"e":"div","a":{"class":"pam_spinner_cont"},"f":[{"t":4,"f":[{"t":7,"e":"span","a":{"class":"spinner -small"}}],"n":50,"r":"inProgress"}]}]}," ",{"t":7,"e":"GenericError","a":{"show":[{"t":2,"r":"showGenericError"}]}}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--30 modal__actions"},"f":[{"t":7,"e":"button","a":{"class":"btn -secondary"},"v":{"click":"Modal.close"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.cancel\")"}}]}]}]}]}; var css_248z$n = ".modal__content {\n opacity: 1;\n}\n.pam_digit_input_group {\n padding-left: 48px;\n}\n.pam_spinner_cont {\n width: 44px;\n display: inline-block;\n padding-left: 10px;\n}\n"; const GROUPS_COUNT = 6; // how many groups (boxes) are in code format: [][][][][][] const DIGITS_PER_GROUP = 1; // how many digits are in one group [.] const EnterBtokModal = Ractive.extend({ css: css_248z$n, template: template$L, components: { GenericError }, data() { return { GROUPS_COUNT: '', // computed in oninit() DIGITS_PER_GROUP: DIGITS_PER_GROUP, code: [], inProgress: false, codeError: false, showGenericError: false }; }, oninit() { this.observe('syncState', (syncState) => { if (!syncState) { return; } this.set('inProgress', false); if (syncState.reason === 'invalid') { this.set('codeError', true); } else if (syncState.reason === 'error') { this.set('showGenericError', true); } }, { init: true }); // mustache is state-less so for-loop wont work for INT, needs array with GROUP_COUNT items const groupsCount = []; for (let i = 0; i < GROUPS_COUNT; i++) { groupsCount.push([]); } this.set('GROUPS_COUNT', groupsCount); this.on('Modal.close', () => { this.fire('modalAskCancelSync'); }); this.on('inputKeyup', (event) => { const BACKSPACE_KEYCODE = 8; const inputElm = event.original.srcElement; const keyCode = event.original.keyCode; inputElm.classList.remove('-error'); if (inputElm.value.length === 0 && keyCode === BACKSPACE_KEYCODE) { this._selectPrevInputSibling(event); return; } if (inputElm.value.length === 0) { // Ignore if keyup did not change value, such in case ctrl, alt, etc was pressed return; } else if (inputElm.value.length === DIGITS_PER_GROUP && this._isNumeric(keyCode)) { const code = this._getCodeAsString(); if (this._codeIsValid(code)) { this._sendCode(code); } else { this._selectNextInputSibling(event); } } else { inputElm.value = ''; inputElm.classList.add('-error'); } }); this.on('inputClick', (event) => { const inputElm = event.original.srcElement; inputElm.value = ''; inputElm.classList.remove('-error'); this.set('codeError', false); this.set('showGenericError', false); }); this.on('inputFocus', (event) => { event.original.srcElement.classList.remove('-error'); }); this.on('codePasted', (event) => { event.original.srcElement.blur(); if (event.original && event.original.clipboardData && typeof event.original.clipboardData.getData !== 'function') { return; } const sanitizedCode = this._getSanitizedCode(event.original.clipboardData.getData('Text')); this.set('code', sanitizedCode); const code = this._getCodeAsString(); if (this._codeIsValid(code)) { this._sendCode(code); } else { this.set('codeError', true); } }); }, _selectPrevInputSibling(event) { const prevSibling = event.original.srcElement.parentElement.previousSibling; if (prevSibling && prevSibling.childNodes[0]) { prevSibling.childNodes[0].focus(); // Clear input prevSibling.childNodes[0].value = ''; } }, _selectNextInputSibling(event) { const nextSibling = event.original.srcElement.parentElement.nextSibling; if (nextSibling && nextSibling.childNodes[0]) { nextSibling.childNodes[0].focus(); // Clear input nextSibling.childNodes[0].value = ''; } }, _getCodeAsString() { const code = this.get('code').join(''); return code; }, _codeIsValid(code) { const hasValidLength = code.length === (GROUPS_COUNT * DIGITS_PER_GROUP); const containsOnlyDigits = (/^\d+$/).test(code); return hasValidLength && containsOnlyDigits; }, _sendCode(code){ this.set('inProgress', true); NAPI$1.request('app.pam.SynchronizationSetup', { request: 'enterBTOK', data: { btok: PamCrypto$1.dataCryptoEnabled? PamCrypto$1.encrypt(code) : code } }).catch((err) => { console.error('app.pam.SynchronizationSetup', JSON.stringify(err)); }); }, _isNumeric(keyCode) { const isNumeric = (keyCode >= 48 && keyCode <= 57) || (keyCode >= 96 && keyCode <= 105); return isNumeric; }, _getSanitizedCode(code) { if (typeof code !== 'string') { return; } const trimmedCode = code.replace(/\s/g, ''); const codeArray = trimmedCode.split('').slice(0, GROUPS_COUNT); return codeArray; } }); const template$M = {"v":3,"t":[{"t":7,"e":"Modal","f":[{"t":7,"e":"Icon","a":{"name":"passwords-email","cssCls":"g-font--40"}}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--20 modal__title"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.pending.email.title\")"}}]}," ",{"t":7,"e":"span","a":{"class":"span -small -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.pending.email.desc\")"}}]}," ",{"t":7,"e":"span","a":{"class":"span -small g-font--bold"},"f":[{"t":2,"r":"email"}]},". ",{"t":7,"e":"div","a":{"class":"g-margin-top--20 g-margin-bottom--20 text -small -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.pending.email.alreadyClicked\")"}}]}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--30 modal__actions"},"f":[{"t":7,"e":"button","a":{"disabled":[{"t":2,"r":"inProgress"}],"class":["btn ",{"t":2,"x":{"r":["inProgress"],"s":"_0?\"-loading\":\"\""}}]},"v":{"click":"refreshSync"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.pending.device.refresh\")"}}]}," ",{"t":7,"e":"button","a":{"disabled":[{"t":2,"r":"inProgress"}],"class":"btn -secondary"},"v":{"click":"Modal.close"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.cancel\")"}}]}]}," ",{"t":7,"e":"GenericError","a":{"show":[{"t":2,"r":"showGenericError"}]}}]}]}; const CheckEmailModal = Ractive.extend({ template: template$M, components: { GenericError }, data: function() { return { inProgress: false, showGenericError: false }; }, oninit() { this.observe('syncState', (syncState) => { if (!syncState) { return; } this.set('inProgress', false); if (syncState.reason === 'error') { this.set('showGenericError', true); } }, { init: true }); this.set('inProgress', false); this.on('Modal.close', () => { if (!this.get('inProgress')) { this.fire('modalAskCancelSync'); } }); this.on('refreshSync', () => { this.set('inProgress', true); this.set('showGenericError', false); NAPI.request('app.pam.SynchronizationSetup', { request: 'checkActivation' }).catch((err) => { console.error('app.pam.SynchronizationSetup', JSON.stringify(err)); }); }); } }); const template$N = {"v":3,"t":[{"t":7,"e":"Modal","f":[{"t":7,"e":"Icon","a":{"name":"passwords-email","cssCls":"g-font--40"}}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--20 modal__title"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.changeAvastIdPassword.title\")"}}]}," ",{"t":7,"e":"span","a":{"class":"span -small -secondary"},"f":[{"t":3,"x":{"r":["nls","email"],"s":"_0(\"passwords.settings.sync.modal.changeAvastIdPassword.desc\",_1)"}}]}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--20 g-margin-bottom--20 text -small -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.changeAvastIdPassword.desc2\")"}}]}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--30 modal__actions"},"f":[{"t":7,"e":"button","a":{"disabled":[{"t":2,"r":"inProgress"}],"class":["btn ",{"t":2,"x":{"r":["inProgress"],"s":"_0?\"-loading\":\"\""}}]},"v":{"click":"refreshSync"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.pending.device.refresh\")"}}]}," ",{"t":7,"e":"button","a":{"disabled":[{"t":2,"r":"inProgress"}],"class":"btn -secondary"},"v":{"click":"Modal.close"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.cancel\")"}}]}]}," ",{"t":7,"e":"GenericError","a":{"show":[{"t":2,"r":"showGenericError"}]}}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--15 g-margin-bottom--10"},"f":[{"t":7,"e":"a","a":{"class":"a"},"v":{"click":"showPrevPasswordForm"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.changeAvastIdPassword.lnk.dontHaveAnotherDevice\")"}}]}]}]}]}; const ChangeAvastIdPasswordModal = Ractive.extend({ template: template$N, components: { GenericError }, data: function() { return { inProgress: false, showGenericError: false }; }, oninit() { this.observe('syncState', (syncState) => { if (!syncState) { return; } this.set('inProgress', false); if (syncState.reason === 'error') { this.set('showGenericError', true); } }, { init: true }); this.on('Modal.close', () => { if (!this.get('inProgress')) { this.fire('modalAskCancelSync'); } }); this.on('refreshSync', () => { this.set('inProgress', true); this.set('showGenericError', false); NAPI.request('app.pam.SynchronizationSetup', { request: 'refreshSync' }).catch((err) => { console.error('app.pam.SynchronizationSetup', JSON.stringify(err)); }); }); this.on('showPrevPasswordForm', () => { this.fire('enterPreviousPassword', true); }); } }); const template$O = {"v":3,"t":[{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.cancel.title\")"}}]},"f":[{"t":7,"e":"p","a":{"class":"p"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.cancel.desc\")"}}]}," ",{"t":7,"e":"div","a":{"class":"modal__actions"},"f":[{"t":7,"e":"button","a":{"class":"btn -secondary"},"v":{"click":"callCancelSync"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.yesCancel.btn\")"}}]}," ",{"t":7,"e":"button","a":{"class":"btn g-margin-left--10"},"v":{"click":"callOpenPreviousModal"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.no\")"}}]}]}]}]}; const AskCancelSyncModal = Ractive.extend({ template: template$O, oninit() { this.previoslyOpenedModal = undefined; this.previoslyOpenedModalParams = undefined; this.on('callOpenPreviousModal', () => { this.fire('openPreviousModal', this.previoslyOpenedModal, this.previoslyOpenedModalParams); }); this.on('Modal.close', () => { this.fire('openPreviousModal'); }); this.on('callCancelSync', () => { this.fire('cancelSync'); }); }, setPrevioslyOpenedModal(prevModal, params) { this.previoslyOpenedModal = prevModal; this.previoslyOpenedModalParams = params; } }); const template$P = {"v":3,"t":[{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.restoreIdentity.passcode.title\")"}}]},"f":[{"t":7,"e":"form","a":{"class":"pam_master_password_form"},"f":[{"t":7,"e":"div","a":{"class":"form__row g-margin-top--20"},"f":[{"t":7,"e":"div","a":{"class":"pam_settings_input_reveal_secret_cont"},"v":{"click":"clearInputErrors"},"f":[{"t":4,"f":[{"t":7,"e":"Input","a":{"id":"backupPassword","innerValue":[{"t":2,"r":"backupPassword"}],"label":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.enterYourPassword\")"}}],"type":"text","readonly":"true","message":[{"t":3,"x":{"r":["backupPasswordError","nls"],"s":"_0?_1(\"passwords.settings.masterPassword.error.incorrect\"):\"\""}}],"error":[{"t":2,"r":"backupPasswordError"}]}}],"n":50,"r":"showBackupPassword"},{"t":4,"n":51,"f":[{"t":7,"e":"Input","a":{"id":"backupPassword","innerValue":[{"t":2,"r":"backupPassword"}],"label":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.enterYourPassword\")"}}],"type":"password","message":[{"t":3,"x":{"r":["backupPasswordError","nls"],"s":"_0?_1(\"passwords.settings.masterPassword.error.incorrect\"):\"\""}}],"error":[{"t":2,"r":"backupPasswordError"}]}}],"r":"showBackupPassword"}]}," ",{"t":7,"e":"ButtonRevealSecret","a":{"isRevealed":[{"t":2,"r":"showBackupPassword"}],"cssCls":"pam_settings_reveal_secret"}}]}," ",{"t":7,"e":"div","a":{"class":"modal__actions g-margin-top--20"},"f":[{"t":7,"e":"button","a":{"type":"submit","disabled":[{"t":2,"r":"inProgress"}],"class":["btn ",{"t":2,"x":{"r":["inProgress"],"s":"_0?\"-loading\":\"\""}}]},"v":{"click":"restoreIdentity"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.continue\")"}}]}]}," ",{"t":7,"e":"GenericError","a":{"show":[{"t":2,"r":"showGenericError"}]}}]}]}]}; const EnterBackupPasswordModal = Ractive.extend({ template: template$P, components: { ButtonRevealSecret, GenericError }, data() { return { backupString: '', backupPassword: '', backupPasswordError: false, inProgress: false, showBackupPassword: false, showGenericError: false }; }, oninit() { this.observe('syncState', (syncState) => { if (!syncState) { return; } this.set('inProgress', false); if (syncState.reason === 'invalid') { this.set('backupPasswordError', true); } else if (syncState.reason === 'error') { this.set('showGenericError', true); } }, { init: true }); this.on('Modal.close', () => { if (!this.get('inProgress')) { this.fire('modalAskCancelSync'); } }); this.on('clearInputErrors', () => { this.set('backupPasswordError', false); }); this.on('restoreIdentity', () => { this.set('inProgress', true); NAPI$1.request('app.pam.SynchronizationSetup', { request: 'selfApprovalLegacyBackup', data: { backupString: PamCrypto$1.dataCryptoEnabled ? PamCrypto$1.encrypt(this.get('backupString')) : this.get('backupString'), backupPassword: PamCrypto$1.dataCryptoEnabled ? PamCrypto$1.encrypt(this.get('backupPassword')) : this.get('backupPassword') } }).catch((err) => { console.error('app.pam.SynchronizationSetup', JSON.stringify(err)); this.set('showGenericError', true); this.set('inProgress', false); }); }); } }); const template$Q = {"v":3,"t":[{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.solveCaptcha.title\")"}}]},"f":[{"t":7,"e":"div","a":{"class":"g-margin-top--30"},"f":[{"t":7,"e":"img","a":{"class":"captchaImg","src":[{"t":2,"r":"url"}]}}]}," ",{"t":7,"e":"form","a":{"class":"pam_login_modal_form"},"f":[{"t":7,"e":"div","a":{"class":"form__row g-margin-top--40"},"v":{"click":"clearInputErrors"},"f":[{"t":7,"e":"Input","a":{"id":"captchaFormInput","innerValue":[{"t":2,"r":"captchaInput"}],"label":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.solveCaptcha.label.retype\")"}}],"type":"text","message":[{"t":3,"x":{"r":["captchaError","nls"],"s":"_0?_1(\"passwords.settings.sync.modal.solveCaptcha.error\"):\"\""}}],"error":[{"t":2,"r":"captchaError"}]}}]}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--30 modal__actions"},"f":[{"t":7,"e":"button","a":{"type":"submit","disabled":[{"t":2,"r":"inProgress"}],"class":["btn ",{"t":2,"x":{"r":["inProgress"],"s":"_0?\"-loading\":\"\""}}]},"v":{"click":"submitCaptcha"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.solveCaptcha.btn.submit\")"}}]}," ",{"t":7,"e":"button","a":{"disabled":[{"t":2,"r":"inProgress"}],"class":"btn -secondary"},"v":{"click":"Modal.close"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.cancel\")"}}]}]}]}," ",{"t":7,"e":"GenericError","a":{"show":[{"t":2,"r":"showGenericError"}]}}]}]}; var css_248z$o = ".captchaImg {\n background-color: #fff;\n}\n"; const CaptchaModal = Ractive.extend({ template: template$Q, css: css_248z$o, components: { GenericError }, data: function() { return { captchaInput: '', captchaError: false, inProgress: false, showGenericError: false }; }, oninit() { this.observe('syncState', (syncState) => { if (!syncState || syncState.state !== 'solveCaptcha') { return; } this.set('inProgress', false); if (syncState.reason === 'invalid') { this.set('captchaError', true); } else if (syncState.reason === 'error') { this.set('showGenericError', true); } else { // Clear input on new captcha this.set('captchaInput', ''); } }, { init: true }); this.set('inProgress', false); this.on('Modal.close', () => { if (this.get('openedFromMainUi')) { // Captcha modal can be opened from mainUi // In this case, don't cancel sync this.fire('captchaClosed'); } else { if (!this.get('inProgress')) { this.fire('modalAskCancelSync'); } } }); this.on('clearInputErrors', () => { this.set('showGenericError', false); this.set('captchaError', false); }); this.on('submitCaptcha', () => { if (this.get('captchaInput').length === 0) { this.set('captchaError', true); return false; } this.set('inProgress', true); this.set('showGenericError', false); this.set('captchaError', false); NAPI.request('app.pam.SynchronizationSetup', { request: 'solveCaptcha', data: { cid: this.get('cid'), answer: this.get('captchaInput') } }).catch((err) => { console.error('app.pam.SynchronizationSetup', JSON.stringify(err)); }); }); } }); const WAIT_APPROVAL_SYNC_INTERVAL = 4000; const SyncBackup = Ractive.extend({ template: template$D, css: css_248z$k, components: { SyncedDevices, LoginModal, RestoreIdentity, EnterBtokModal, CheckEmailModal, ChangeAvastIdPasswordModal, AskCancelSyncModal, EnterBackupPasswordModal, CaptchaModal }, data: function() { return { loading: undefined, modalDialog: undefined, syncState: undefined, email: undefined, socialLoginType: undefined, lastSyncTime: undefined, synchronizing: false, restoringIdentity: {inProgress: false, backupString: ''}, solvingCaptcha: {cid:undefined, url: undefined}, changeAvastIdPassword: {enterPreviousPassword: false}, invalidSyncState: false, }; }, onrender() { this.fire('render'); }, oninit: function() { this.set('loading', true); NAPI$1.emit('sensitiveModal.initPamCrypto'); this.synchronizeTimeout = undefined; this._callSyncInterval = undefined; this.listeners = []; this._setInitSyncState(); this.listeners.push(NAPI$1.on('app.pam.onSyncSetup.statusChanged', (stateData) => { this._setSyncState(stateData); })); this.listeners.push(NAPI$1.on('app.pam.onStatusChanged.synchronizationDone', () => { this.set('synchronizing', false); this._getLastSyncTime(); })); this.on('showMasterPasswordModal', () => { showSensitiveModal('setMasterPassword', { width: 680, height: 423 }); }); this.on('showLoginModal', (e, page) => { this._showLoginModal(page); }); this.on('RestoreIdentity.restoreStart', (data) => { this.set('restoringIdentity', {inProgress: true, backupString: data.backupString}); if (this.get('syncState').state === 'waitApproval') { this.set('modalDialog', 'enterBackupPassword'); } }); this.on('LoginModal.enterPreviousPassword ChangeAvastIdPasswordModal.enterPreviousPassword', (val) => { this.set('changeAvastIdPassword.enterPreviousPassword', val); this._refreshSyncState(); }); this.on('FacebookLogin.loggedIn GoogleLogin.loggedIn', (socialLoginType) => { this.set('socialLoginType', socialLoginType); }); this.on('recheck', () => { this._callSync(); }); this.on('synchronize', () => { this.set('synchronizing', true); this._clearSynchronizeTimeout(); this.synchronizeTimeout = setTimeout(() => { NAPI$1.request('app.pam.Synchronize').catch((err) => { console.error('app.pam.Synchronize', JSON.stringify(err)); }); }, 2000); }); this.on('startSync', () => { NAPI$1.request('app.pam.SynchronizationSetup', { request: 'startSync' }).catch((err) => { console.error('app.pam.SynchronizationSetup', JSON.stringify(err)); const message = Ractive.localization.nls('system.toasters.restart.text'); const options = { title: Ractive.localization.nls('system.toasters.restart.title'), ok: Ractive.localization.nls('system.toasters.restart.restartComputer') }; return Ractive.UI.confirm(message, options) .then(()=>{ NAPI$1.request('app.system.Restart', { rebootType: 'RebootFromUI' }); }); }); }); this.on('askCancelSync', () => { this.set('modalDialog', 'askCancelSync'); }); this.on('AskCancelSyncModal.openPreviousModal', (modalDialog, modalDialogParams) => { if (modalDialog === 'login') { this._showLoginModal(modalDialogParams.page); } else { this.set('modalDialog', modalDialog); } }); this.on('*.modalAskCancelSync', (params) => { const previouslyOpenedModal = this.get('modalDialog'); console.debug('previouslyOpenedModal', previouslyOpenedModal); this._isSetupCompleted().then((isSetupCompleted) => { if (isSetupCompleted) { // Show show ask dialog to cancel sync // Timeout to prevent closing new modal if closing by X button this.set('modalDialog', undefined); setTimeout(() => { this.set('modalDialog', 'askCancelSync'); const askCancelSyncModal = this.findComponent('AskCancelSyncModal'); askCancelSyncModal.setPrevioslyOpenedModal(previouslyOpenedModal, params); }); } else { // We can cancelSync without worries if setup is not completed, // so don't show ask dialog this._cancelSync(); } }); }); this.on('turnOffSync', () => { this.set('modalDialog', undefined); this.set('loading', true); NAPI$1.request('app.pam.SynchronizationSetup', { request: 'stopSync' }).catch((err) => { console.error('app.pam.SynchronizationSetup', JSON.stringify(err)); const message = Ractive.localization.nls('system.toasters.restart.text'); const options = { title: Ractive.localization.nls('system.toasters.restart.title'), ok: Ractive.localization.nls('system.toasters.restart.restartComputer') }; return Ractive.UI.confirm(message, options) .then(()=>{ NAPI$1.request('app.system.Restart', { rebootType: 'RebootFromUI' }); }); }); }); this.on('askTurnOffSync', () => { this.set('modalDialog', 'turnOffSync'); }); this.on('*.cancelSync', () => { this.set('modalDialog', undefined); this.set('loading', true); this._cancelSync(); }); this.on('Modal.close LoginModal.close RestoreIdentity.close', () => { this.set('modalDialog', undefined); }); }, _setSyncState(stateData) { this.set('invalidSyncState', false); this.set('syncState', stateData); this._initAccountInfo().then(() => { this.set('loading', false); }).catch(() => { this.set('loading', false); }); this._clearCallSyncInterval(); this._getLastSyncTime(); const unableToHandleReasons = ['invalid', 'wrongAccount', 'error', 'alreadyExist']; if (unableToHandleReasons.includes(stateData.reason)) { const modalDialog = this.get('modalDialog'); if (modalDialog === 'captcha') { // Set sync state to stateData.lastRequest to open original modal before captcha this._setSyncState(stateData.lastRequest); // Set current state to display the recent reason on original modal before captcha this._setSyncState(stateData); return; } else if (modalDialog) { // Ignore these reasons if some modal is opened, they either handle these reasons by themselves // or they can cancel sync to get out of this state return; } else { // No modal is opened and we are in state we cannot handle, we have to cancel sync to get out of here. this._tryCancelSync(stateData); } } switch (stateData.state) { case 'disabled': this.set('modalDialog', undefined); break; case 'enabled': if (this._isLoginModalPageOpened('loginAfterUpdateFromMainUi')) { // If login was opened from main UI, fire event to main UI this.fire('syncEnabled'); } // Prevent closing when polling synced devies in enabled state if (this.get('modalDialog') !== 'turnOffSync') { this.set('modalDialog', undefined); } break; case 'accountSetup': if (stateData.reason === 'afterUpdate' || stateData.reason === 'prove') ; else { this._showLoginModal('login'); } break; case 'enterIDAPwd': case 'enterIDAEmail': if (stateData.reason === 'addNew') { if (stateData.state === 'enterIDAEmail') { this._showLoginModal('createLoginSocial'); } else { this._showLoginModal('createPasswordSocial'); } } else if (stateData.reason === 'none') { this._showLoginModal('loginPasswordSocial'); } else if (stateData.reason === 'afterUpdate' || stateData.reason === 'prove') ; else { this._callSyncAndWaitForEvent(); } break; case 'enterCredForBackup': if (this.get('changeAvastIdPassword.enterPreviousPassword') === true) { this._showLoginModal('enterPreviousPassword'); } else { this.set('modalDialog', 'changeAvastIdPassword'); } break; case 'enterBTOK': this._startCallSyncInterval(); this.set('modalDialog', 'enterBtok'); break; case 'waitActivation': this.set('modalDialog', 'checkEmail'); break; case 'solveCaptcha': if (!stateData.data.cid || !stateData.data.url) { this._callSyncAndWaitForEvent(); } else { this.set('modalDialog', 'captcha'); this.set('solvingCaptcha', {cid: stateData.data.cid, url: stateData.data.url}); } break; case 'waitApproval': this._startCallSyncInterval(); if (this.get('restoringIdentity.inProgress') === true) { this.set('modalDialog', 'enterBackupPassword'); } else { this.set('modalDialog', undefined); } break; } }, // Call sync and wait for event. // Such in case we don't have enough data from NAPI.request('app.pam.SynchronizationSetup', {request: 'getState'}) // to display state. _callSyncAndWaitForEvent() { this.set('loading', true); this._callSync(); }, _tryCancelSync(stateData) { this._isSetupCompleted().then((isSetupCompleted) => { if (isSetupCompleted) { // Special screen is displayed in template console.debug('Uncertain sync state, diplay afterUpdate page. setupCompleted: true, state: ', JSON.stringify(stateData)); this.set('invalidSyncState', true); this.set('loading', false); } else { // We can cancelSync without worries if setup is not completed, // so don't show ask dialog console.debug('Uncertain sync state, call cancel sync, setupCompleted: false, state: ', JSON.stringify(stateData)); this._cancelSync(); } }); }, _showLoginModal(page) { this.set('modalDialog', undefined); this.set('modalDialog', 'login'); if (page) { this.findComponent('LoginModal').set({ 'page': page }); } }, _isLoginModalPageOpened(page) { const LoginModal = this.findComponent('LoginModal'); return LoginModal && LoginModal.get('page') === page; }, _callSync() { console.debug('_callSync syncBackup.js'); NAPI$1.request('app.pam.Synchronize'); }, _cancelSync() { NAPI$1.request('app.pam.SynchronizationSetup', { request: 'cancelSync' }).catch((err) => { console.error('app.pam.SynchronizationSetup', JSON.stringify(err)); }); }, _refreshSyncState() { this._getSyncState().then((stateData) => { this._setSyncState({state: stateData.lastSyncState}); }); }, _setInitSyncState() { this._getSyncState().then((stateData) => { const allowedInitStates = ['enabled', 'disabled', 'waitApproval']; if (allowedInitStates.includes(stateData.lastSyncState) === false) { this._tryCancelSync({state: stateData.lastSyncState}); } else { this._setSyncState({state: stateData.lastSyncState}); } }); }, _isSetupCompleted() { return this._getSyncState().then((stateData) => { return stateData.setupCompleted; }); }, _getSyncState() { return NAPI$1.request('app.pam.SynchronizationSetup', {request: 'getState'}).catch((err) => { console.error('app.pam.SynchronizationSetup', JSON.stringify(err)); }); }, _getLastSyncTime() { NAPI$1.request('app.pam.GetLastSynchronizationTime').then((response) => { if (response && response.LastSyncTime) { const lastSyncTime = Ractive.localization.moment(response.LastSyncTime * 1000).format('LT'); this.set('lastSyncTime', lastSyncTime); } }); }, _initAccountInfo() { return NAPI$1.request('app.pam.GetSyncAccountInfo').then((response) => { if (response && response.primaryEmail) { this.set('email', response.primaryEmail); } else { this.set('email', undefined); } }).catch((err) => { console.error('app.pam.GetSyncAccountInfo', JSON.stringify(err)); }); }, _clearSynchronizeTimeout() { if (this.synchronizeTimeout) { clearTimeout(this.synchronizeTimeout); this.synchronizeTimeout = undefined; } }, _startCallSyncInterval() { if (!this._callSyncInterval) { console.debug('_startCallSyncInterval'); this._callSyncInterval = setInterval(() => { this._callSync(); }, WAIT_APPROVAL_SYNC_INTERVAL); } }, _clearCallSyncInterval() { if (this._callSyncInterval) { console.debug('_clearCallSyncInterval'); clearInterval(this._callSyncInterval); this._callSyncInterval = undefined; } }, onteardown() { this._clearCallSyncInterval(); this._clearSynchronizeTimeout(); this.listeners.forEach(off => off()); } }); var css_248z$p = ".pam_settings_browsers .pam_settings_browser_ext {\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n.pam_settings_browsers .pam_settings_browser_ext .pam_csv_export_icon {\n font-size: 36px;\n padding-left: 2px;\n}\n.pam_settings_browsers .pam_settings_browser_ext .pam_settings_browser_text {\n font-size: 15px;\n}\n.pam_settings_browsers .pam_settings_browser_ext .btn {\n white-space: nowrap;\n}\n.pam_settings_browsers .pam_settings_browser_ext .pam_settings_browser {\n display: flex;\n align-items: center;\n}\n.pam_settings_browsers .pam_settings_browser_ext .pam_settings_browser .pam_browser {\n width: 40px;\n font-size: 15px;\n display: inline-flex;\n align-items: center;\n flex-direction: row;\n margin-right: 20px;\n}\n.pam_settings_browsers .pam_settings_browser_ext .pam_settings_browser .pam_browser .pam_browser_icon {\n font-size: 40px;\n}\n.pam_settings_browsers .pam_settings_browser_ext .pam_settings_browser .pam_browser .pam_browser_label {\n display: none;\n}\n"; const template$R = {"v":3,"t":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"center__wrap"},"f":[{"t":7,"e":"div","a":{"class":"center"},"f":[{"t":7,"e":"Loading","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.loading\")"}}]}}]}]}],"n":50,"x":{"r":["loading"],"s":"_0===true"}},{"t":4,"n":51,"f":[" ",{"t":4,"f":[{"t":7,"e":"h3","a":{"class":"h3 g-margin-bottom--20"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.importExport.title\")"}}]}," ",{"t":7,"e":"div","a":{"class":"pam_settings_browsers g-margin-bottom--20"},"f":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_settings_browser_ext g-margin-top--20"},"f":[{"t":7,"e":"div","a":{"class":"pam_settings_browser"},"f":[{"t":7,"e":"Browser","a":{"browserId":[{"t":2,"r":"browser"}]}}," ",{"t":7,"e":"div","a":{"class":"pam_settings_browser_text"},"f":[{"t":3,"x":{"r":["nls","name"],"s":"_0(\"passwords.settings.importExport.import.browser\",_1)"}}]}]}," ",{"t":7,"e":"button","a":{"class":"btn -small -secondary"},"v":{"click":{"n":"beginImportFromBrowser","d":[{"t":2,"r":"browser"}]}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.importExport.import.btn\")"}}]}]}],"n":52,"r":"browsers"}]}],"n":50,"x":{"r":["browsers.length"],"s":"_0>0"}}," ",{"t":7,"e":"div","a":{"class":"pam_settings_browsers"},"f":[{"t":7,"e":"div","a":{"class":"pam_line g-margin-top--20 g-margin-bottom--20"}}]}," ",{"t":7,"e":"h3","a":{"class":"h3 g-margin-bottom--20"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.importExport.export.title\")"}}]}," ",{"t":7,"e":"div","a":{"class":"pam_settings_browsers g-margin-bottom--20"},"f":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_settings_browser_ext g-margin-top--20"},"f":[{"t":7,"e":"div","a":{"class":"pam_settings_browser"},"f":[{"t":7,"e":"Browser","a":{"browserId":[{"t":2,"r":"browser"}]}}," ",{"t":7,"e":"div","a":{"class":"pam_settings_browser_text"},"f":[{"t":3,"x":{"r":["nls","name"],"s":"_0(\"passwords.settings.importExport.export.browser\",_1)"}}," ",{"t":7,"e":"span","a":{"class":"span -secondary"},"f":[{"t":7,"e":"a","a":{"class":"a","href":[{"t":2,"r":"link"}]},"v":{"click":"browser"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.importExport.export.browser.seeHow\")"}}]}]}]}]}," ",{"t":7,"e":"button","a":{"class":"btn -small -secondary"},"v":{"click":{"n":"export","d":[{"t":2,"r":"browser"}]}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.importExport.export.btn\")"}}]}]}],"n":52,"r":"browserExports"}]}," ",{"t":7,"e":"div","a":{"class":"pam_settings_browsers"},"f":[{"t":7,"e":"div","a":{"class":"pam_line g-margin-top--20 g-margin-bottom--20"}}]}," ",{"t":7,"e":"h3","a":{"class":"h3 g-margin-bottom--20"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.importExport.allData.title\")"}}]}," ",{"t":7,"e":"div","a":{"class":"pam_settings_browsers g-margin-bottom--20"},"f":[{"t":7,"e":"div","a":{"class":"pam_settings_browser_ext g-margin-top--20"},"f":[{"t":7,"e":"div","a":{"class":""},"f":[{"t":7,"e":"button","a":{"class":"btn -small -secondary g-margin-right--10"},"v":{"click":{"n":"beginBackup","a":"export"}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.importExport.exportToFile.btn\")"}}]}," ",{"t":7,"e":"button","a":{"class":"btn -small -secondary"},"v":{"click":{"n":"beginBackup","a":"import"}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.importExport.importFromFile.btn\")"}}]}]}]}]}],"x":{"r":["loading"],"s":"_0===true"}},{"t":4,"f":[{"t":7,"e":"BrowserImportModal","a":{"browserId":[{"t":2,"r":"importingBrowser"}]}}],"n":50,"x":{"r":["modalDialog"],"s":"_0===\"browserImportModal\""}},{"t":4,"f":[{"t":7,"e":"BackupModal","a":{"mode":[{"t":2,"r":"backupMode"}]}}],"n":50,"x":{"r":["modalDialog"],"s":"_0===\"backupModal\""}}]}; var css_248z$q = "#import-ok-state-icon {\n width: 75px !important;\n height: 75px !important;\n}\n#import-ok-state-icon path {\n stroke-width: 10px !important;\n}\n.pam_settings_import_modal_browser .pam_browser {\n margin-right: 0;\n margin-bottom: 20px;\n}\n.pam_settings_import_modal_browser .pam_browser_label {\n display: none;\n}\n.pam_settings_import_modal_browser .pam_browser_icon {\n font-size: 40px;\n}\n"; const template$S = {"v":3,"t":[{"t":4,"f":[{"t":7,"e":"Modal","f":[{"t":7,"e":"div","a":{"class":"center__wrap"},"f":[{"t":7,"e":"div","a":{"class":"center"},"f":[{"t":7,"e":"Loading","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.loading\")"}}]}}]}]}]}],"n":50,"x":{"r":["loading"],"s":"_0===true"}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["page","browserPasswordCount"],"s":"_0===\"loginsFound\"&&_1>0"},"f":[{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls","browserPasswordCount"],"s":"_0(\"passwords.settings.import.loginsFound\",_1)"}}," ",{"t":2,"r":"browserName"}]},"f":[{"t":7,"e":"div","a":{"class":"pam_settings_import_modal_browser"},"f":[{"t":7,"e":"Browser","a":{"browserId":[{"t":2,"r":"browserId"}]}}]}," ",{"t":7,"e":"p","a":{"class":"p -small -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.import.loginsFound.subtitle\")"}}]}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--20 modal__actions"},"f":[{"t":7,"e":"button","a":{"class":"btn"},"v":{"click":"importFromBrowser"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.import.loginsFound.importNow.btn\")"}}]}," ",{"t":7,"e":"button","a":{"class":"btn -secondary g-margin-left--10"},"v":{"click":"Modal.close"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.cancel\")"}}]}]}]}]},{"t":4,"n":50,"x":{"r":["page","browserPasswordCount"],"s":"(!(_0===\"loginsFound\"&&_1>0))&&(_0===\"loginsFound\"&&_1===0)"},"f":[" ",{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.import.noLoginsFound\")"}}," ",{"t":2,"r":"browserName"}]},"f":[{"t":7,"e":"div","a":{"class":"g-margin-top--20 modal__actions"},"f":[{"t":7,"e":"button","a":{"class":"btn -secondary"},"v":{"click":"Modal.close"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.ok\")"}}]}]}]}]},{"t":4,"n":50,"x":{"r":["browserPasswordCount","page"],"s":"(!(_1===\"loginsFound\"&&_0>0))&&((!(_1===\"loginsFound\"&&_0===0))&&(_1===\"importing\"))"},"f":[" ",{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.import.importing\")"}}]},"f":[{"t":7,"e":"div","a":{"class":"spinner"}}]}]},{"t":4,"n":50,"x":{"r":["browserPasswordCount","page"],"s":"(!(_1===\"loginsFound\"&&_0>0))&&((!(_1===\"loginsFound\"&&_0===0))&&((!(_1===\"importing\"))&&(_1===\"importComplete\")))"},"f":[" ",{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.import.complete\")"}}]},"f":[{"t":7,"e":"svg","a":{"version":"1.1","class":"color-ok -text","id":"import-ok-state-icon","xmlns":"http://www.w3.org/2000/svg","width":"100%","height":"100%","viewBox":"0 0 500 500"},"f":[{"t":7,"e":"path","a":{"d":"M250.3,10.1c132.5,0,239.9,107.4,239.9,239.9S382.8,489.9,250.3,489.9S10.5,382.5,10.5,250\n\t\t\t\tS117.9,10.1,250.3,10.1z"}}," ",{"t":7,"e":"path","a":{"d":"M103.6,254.2l101,101l195.5-195.5"}}]}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--20 modal__actions"},"f":[{"t":7,"e":"button","a":{"class":"btn"},"v":{"click":"Modal.close"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.ok\")"}}]}]}]}]}],"x":{"r":["loading"],"s":"_0===true"}}]}; const browserMap = { chrome: 1, firefox: 2, asb: 32, msedge: 64 }; const BrowserImportModal = Ractive.extend({ template: template$S, css: css_248z$q, components: { Browser, }, data: function() { return { page: 'loginsFound', browserId: undefined, browserName: undefined, browserPasswordCount: 0, loading: true }; }, oninit: function() { this._init(); this.on('Modal.close', () => { this.fire('close'); }); this.on('importFromBrowser', () => { this._importFromBrowser(this.get('browserId')); }); }, _init() { const browserId = this.get('browserId'); this.set('browserName', getBrowserName(browserId)); this.set('loading', true); NAPI.request('app.pam.GetSelectedBrowserPasswordCount', { 'browser': browserMap[browserId] }).then((res) => { this.set('browserPasswordCount', res[browserMap[browserId]]); this.set('loading', false); }).catch((err) => { console.error('app.pam.GetSelectedBrowserPasswordCount', JSON.stringify(err)); this.set('loading', false); }); }, _importFromBrowser(browser) { this.set('page', 'importing'); this.importProgressOff = NAPI.on('app.pam.onStatusChanged.importProgress', (res) => { this.set('browserPasswordCount', res.browserpasswordscount); if (res.importedcount >= res.browserpasswordscount) { this.set('page', 'importComplete'); new vivus('import-ok-state-icon', { duration: 70, type: 'delayed', animTimingFunction: vivus.EASE_OUT }); } }); NAPI.request('app.pam.ImportBrowserPasswords', { 'browser': browserMap[browser] }).catch((err) => { console.error('app.pam.GetBrowserStatus', JSON.stringify(err)); }); }, onteardown() { if (this.importProgressOff) { this.importProgressOff(); } } }); var css_248z$r = ".icon-warning {\n width: 60px;\n height: 60px;\n margin-bottom: 20px;\n}\n.icon-done {\n width: 82px;\n margin: 7px auto 7px;\n}\n.icon-error {\n width: 82px;\n margin: 20px auto 20px;\n}\n"; const template$T = {"v":3,"t":[{"t":4,"f":[{"t":7,"e":"Modal","f":[{"t":7,"e":"div","a":{"class":"modal__title"},"f":[{"t":3,"x":{"r":["mode","nls"],"s":"_0===\"import\"?_1(\"passwords.settings.import.importing\"):_1(\"passwords.settings.export.exporting\")"}}]}," ",{"t":7,"e":"div","a":{"class":"pam_spinner_cont g-margin-top--60 g-margin-bottom--80"},"f":[{"t":7,"e":"span","a":{"class":"spinner -big"}}]}]}],"n":50,"x":{"r":["page"],"s":"_0===\"PAGE_LOADING\""}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["page"],"s":"_0===\"PAGE_WAITING_FOR_FILE\""},"f":[{"t":7,"e":"Modal","f":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"modal__title"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.import.fileSelect.title\")"}}]}],"n":50,"x":{"r":["mode"],"s":"_0===\"import\""}},{"t":4,"n":51,"f":[{"t":7,"e":"div","a":{"class":"modal__title"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.export.fileSelect.title\")"}}]}],"x":{"r":["mode"],"s":"_0===\"import\""}}," ",{"t":7,"e":"div","a":{"class":"modal__subtitle"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.importExport.fileSelect.subtitle\")"}}]}," ",{"t":7,"e":"div","a":{"class":"pam_spinner_cont g-margin-top--60 g-margin-bottom--80"},"f":[{"t":7,"e":"span","a":{"class":"spinner -big"}}]}]}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"PAGE_WAITING_FOR_FILE\"))&&(_0===\"PAGE_IMPORT_WARNING\")"},"f":[" ",{"t":7,"e":"Modal","f":[{"t":7,"e":"svg","a":{"class":"icon-warning","xmlns":"http://www.w3.org/2000/svg","viewBox":"0 0 48 48"},"f":[{"t":7,"e":"path","a":{"fill":"#F1C80B","fill-rule":"nonzero","d":"M25.557.962L47.81 45.48A1.74 1.74 0 0 1 46.26 48H1.745C.45 48-.395 46.639.187 45.48L22.447.962c.638-1.283 2.471-1.283 3.11 0zM22 41h4v-4h-4v4zm0-9h4V16h-4v16z"}}]}," ",{"t":7,"e":"div","a":{"class":"modal__title"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.import.dataInVault.title\")"}}]}," ",{"t":7,"e":"div","a":{"class":"modal__subtitle g-margin-top--10"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.import.dataInVault.subtitle\")"}}]}," ",{"t":7,"e":"div","a":{"class":"radio__group g-margin-left--20 g-align--left"},"f":[{"t":7,"e":"div","a":{"class":"radio__row"},"f":[{"t":7,"e":"input","a":{"id":"radio_merge","type":"radio","class":"radio","name":"import_mode_radio","checked":"checked","value":"merge"},"v":{"click":"setImportMode"}}," ",{"t":7,"e":"label","a":{"for":"radio_merge","class":"radio__label"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.import.dataInVault.mergeSelection.title\")"}}]}," ",{"t":7,"e":"p","a":{"class":"settings__indent checkbox__desc "},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.import.dataInVault.mergeSelection.subtitle\")"}}]}]}," ",{"t":7,"e":"div","a":{"class":"radio__row"},"f":[{"t":7,"e":"input","a":{"id":"radio_replace","type":"radio","class":"radio","name":"import_mode_radio","value":"replace"},"v":{"click":"setImportMode"}}," ",{"t":7,"e":"label","a":{"for":"radio_replace","class":"radio__label"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.import.dataInVault.replaceSelection.title\")"}}]}," ",{"t":7,"e":"p","a":{"class":"settings__indent checkbox__desc"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.import.dataInVault.replaceSelection.subtitle\")"}}]}]}]}," ",{"t":7,"e":"div","a":{"class":"modal__actions"},"f":[{"t":7,"e":"button","a":{"type":"button","class":"btn"},"v":{"click":{"n":"doAction","a":"continue"}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.continue\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","class":"btn -secondary"},"v":{"click":{"n":"doAction","a":"close"}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.cancel\")"}}]}]}]}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"PAGE_WAITING_FOR_FILE\"))&&((!(_0===\"PAGE_IMPORT_WARNING\"))&&(_0===\"PAGE_SUCCESS\"))"},"f":[" ",{"t":7,"e":"Modal","f":[{"t":7,"e":"div","a":{"class":"modal__title"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.general.success\")"}}]}," ",{"t":7,"e":"svg","a":{"class":"icon-done","version":"1.1","xmlns":"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","x":"0px","y":"0px","viewBox":"0 0 160 160","style":"enable-background:new 0 0 160 160;","xml:space":"preserve"},"f":[{"t":7,"e":"g","f":[{"t":7,"e":"path","a":{"style":"fill-rule:evenodd;clip-rule:evenodd;fill:#1cb84a;","d":"M80,0C35.82,0,0,35.82,0,80c0,44.18,35.82,80,80,80\n\ts80-35.82,80-80C160,35.82,124.18,0,80,0z M80,155.99c-41.97,0-75.99-34.02-75.99-75.99S38.03,4.01,80,4.01\n\tS155.99,38.03,155.99,80S121.97,155.99,80,155.99z M119.46,52.58c-0.81-0.81-2.12-0.81-2.93,0l-48.56,48.56L46.42,79.58\n\tc-0.81-0.81-2.11-0.81-2.92,0l-2.92,2.92c-0.81,0.81-0.81,2.11,0,2.92l22.79,22.79c0.06,0.09,0.13,0.18,0.21,0.26l2.93,2.93\n\tc0.41,0.41,0.95,0.61,1.49,0.6c0.54,0.01,1.07-0.19,1.48-0.6l2.92-2.92c0.07-0.07,0.13-0.16,0.19-0.24l49.8-49.8\n\tc0.81-0.81,0.81-2.12,0-2.93L119.46,52.58z"}}]}]}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":"g-margin-top--15"},"f":[{"t":3,"x":{"r":["nls","stats.processedCount"],"s":"_0(\"passwords.settings.export.countOfItems\",_1)"}}]}," ",{"t":7,"e":"div","a":{"class":"modal__actions"},"f":[{"t":7,"e":"button","a":{"type":"button","class":"btn g-margin-top--20"},"v":{"click":{"n":"doAction","a":"close"}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.done\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","class":"btn -secondary g-margin-top--20"},"v":{"click":{"n":"doAction","a":"showFolder"}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.export.showFile.btn\")"}}]}]}],"n":50,"x":{"r":["mode"],"s":"_0===\"export\""}},{"t":4,"n":51,"f":[{"t":7,"e":"div","a":{"class":"g-margin-top--20 g-margin-bottom--20"},"f":[{"t":3,"x":{"r":["nls","stats.processedCount","stats.diffCount"],"s":"_0(\"passwords.settings.import.countOfItems\",_1,_2)"}}]}," ",{"t":7,"e":"div","a":{"class":"modal__actions"},"f":[{"t":7,"e":"button","a":{"type":"button","class":"btn"},"v":{"click":{"n":"doAction","a":"close"}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.done\")"}}]}]}],"x":{"r":["mode"],"s":"_0===\"export\""}}]}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"PAGE_WAITING_FOR_FILE\"))&&((!(_0===\"PAGE_IMPORT_WARNING\"))&&((!(_0===\"PAGE_SUCCESS\"))&&(_0===\"PAGE_EXPORT_NO_DATA\")))"},"f":[" ",{"t":7,"e":"Modal","f":[{"t":7,"e":"div","a":{"class":"modal__title"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.export.noDataInVault.title\")"}}]}," ",{"t":7,"e":"svg","a":{"class":"icon-error","version":"1.1","xmlns":"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","x":"0px","y":"0px","viewBox":"0 0 160 160","style":"enable-background:new 0 0 160 160;","xml:space":"preserve"},"f":[{"t":7,"e":"g","f":[{"t":7,"e":"path","a":{"style":"fill-rule:evenodd;clip-rule:evenodd;fill:#DA2C2C;","d":"M109.39,53.5l-2.93-2.93c-0.81-0.81-2.12-0.81-2.93,0\n\tL79.97,74.15L56.43,50.61c-0.81-0.81-2.12-0.81-2.93,0l-2.93,2.93c-0.81,0.81-0.81,2.12,0,2.93L74.12,80l-23.54,23.54\n\tc-0.81,0.81-0.81,2.12,0,2.93l2.93,2.93c0.81,0.81,2.12,0.81,2.93,0l23.54-23.54l23.57,23.57c0.81,0.81,2.12,0.81,2.93,0\n\tl2.93-2.93c0.81-0.81,0.81-2.12,0-2.93L85.82,80l23.57-23.57C110.2,55.62,110.2,54.31,109.39,53.5z M80,0C35.82,0,0,35.82,0,80\n\tc0,44.18,35.82,80,80,80s80-35.82,80-80C160,35.82,124.18,0,80,0z M80,155.99c-41.97,0-75.99-34.02-75.99-75.99\n\tS38.03,4.01,80,4.01S155.99,38.03,155.99,80S121.97,155.99,80,155.99z"}}]}]}," ",{"t":7,"e":"div","a":{"class":"modal__actions"},"f":[{"t":7,"e":"button","a":{"type":"button","class":"btn"},"v":{"click":{"n":"doAction","a":"close"}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.ok\")"}}]}]}]}]},{"t":4,"n":50,"x":{"r":["page"],"s":"(!(_0===\"PAGE_WAITING_FOR_FILE\"))&&((!(_0===\"PAGE_IMPORT_WARNING\"))&&((!(_0===\"PAGE_SUCCESS\"))&&((!(_0===\"PAGE_EXPORT_NO_DATA\"))&&(_0===\"PAGE_ERROR\"))))"},"f":[" ",{"t":7,"e":"Modal","f":[{"t":7,"e":"div","a":{"class":"modal__title"},"f":[{"t":3,"r":"errorTitle"}]}," ",{"t":7,"e":"div","f":[{"t":3,"r":"errorMessage"}]}," ",{"t":7,"e":"svg","a":{"class":"icon-error","version":"1.1","xmlns":"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","x":"0px","y":"0px","viewBox":"0 0 160 160","style":"enable-background:new 0 0 160 160;","xml:space":"preserve"},"f":[{"t":7,"e":"g","f":[{"t":7,"e":"path","a":{"style":"fill-rule:evenodd;clip-rule:evenodd;fill:#DA2C2C;","d":"M109.39,53.5l-2.93-2.93c-0.81-0.81-2.12-0.81-2.93,0\n\tL79.97,74.15L56.43,50.61c-0.81-0.81-2.12-0.81-2.93,0l-2.93,2.93c-0.81,0.81-0.81,2.12,0,2.93L74.12,80l-23.54,23.54\n\tc-0.81,0.81-0.81,2.12,0,2.93l2.93,2.93c0.81,0.81,2.12,0.81,2.93,0l23.54-23.54l23.57,23.57c0.81,0.81,2.12,0.81,2.93,0\n\tl2.93-2.93c0.81-0.81,0.81-2.12,0-2.93L85.82,80l23.57-23.57C110.2,55.62,110.2,54.31,109.39,53.5z M80,0C35.82,0,0,35.82,0,80\n\tc0,44.18,35.82,80,80,80s80-35.82,80-80C160,35.82,124.18,0,80,0z M80,155.99c-41.97,0-75.99-34.02-75.99-75.99\n\tS38.03,4.01,80,4.01S155.99,38.03,155.99,80S121.97,155.99,80,155.99z"}}]}]}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":"modal__content g-margin-bottom--20"},"f":[{"t":3,"r":"errorMessageStatistics"}]}],"n":50,"r":"errorMessageStatistics"}," ",{"t":7,"e":"div","a":{"class":"modal__actions"},"f":[{"t":7,"e":"button","a":{"type":"button","class":"btn"},"v":{"click":{"n":"doAction","a":"tryAgain"}},"f":[{"t":3,"x":{"r":["buttonTryAgain","nls"],"s":"_0?_1(\"passwords.settings.general.tryAgain.btn\"):_1(\"passwords.settings.general.tryAnother.btn\")"}}]}," ",{"t":7,"e":"button","a":{"type":"button","class":"btn -secondary"},"v":{"click":{"n":"doAction","a":"close"}},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.cancel\")"}}]}]}]}]}],"x":{"r":["page"],"s":"_0===\"PAGE_LOADING\""}}]}; const BackupModal = Ractive.extend({ template: template$T, css: css_248z$r, data: function() { return { mode: '', page: '', stats: undefined, filePath: '', errorMessageStatistics: '', errorMessage: '', errorTitle: '', importMode: 'merge', buttonTryAgain: true }; }, oninit: function() { this._init(); this.on('Modal.close', () => { this.fire('close'); }); this.on('doAction', (e, action) => { switch (action) { case 'import': case 'export': this.proceedWithAction(action, this.get('path')); break; case 'tryAgain': this._init(); break; case 'close': this.fire('close'); break; case 'showFolder': this.showFolder().then(()=>{ this.fire('close'); }).catch(()=>{ this.fire('close'); }); break; case 'continue': this.set('page', 'PAGE_LOADING'); if (this.get('importMode') === 'replace') { this.wipeVaultData().then(()=>{ this.proceedWithAction('import', this.get('filePath')); }).catch(() => { this.set('errorMessage', 'Failed to delete data from vault. Please try again.'); this.set('page', 'PAGE_ERROR'); }); } else { this.proceedWithAction('import', this.get('filePath')); } break; default: this.fire('close'); } }); this.on('setImportMode', (event) => { this.set('importMode', event.node.value); }); }, _init() { const mode = this.get('mode'); this.set('page', 'PAGE_WAITING_FOR_FILE'); this.wipeData(); Promise.all([ NAPI.request('app.pam.ExportImportPAMData', { aType: (mode === 'import') ? 'getImpPath' : 'getExpPath' }), NAPI.request('app.pam.ExportImportPAMData', { aType: 'getState' }) ]).then(response => { const filePath = response[0].path; if (!filePath) { this.fire('close'); return; } this.set('filePath', filePath); const vaultData = response[1].state; let dataInVault = false; // lCnt - Logins Count, cCnt - Cards count, mCmt - Notes count if (vaultData.lCnt > 0 || vaultData.cCnt > 0 || vaultData.nCnt > 0){ dataInVault = true; } if (dataInVault === true && mode === 'import') { this.set('page', 'PAGE_IMPORT_WARNING'); } else if (dataInVault === false && mode === 'export') { this.set('page', 'PAGE_EXPORT_NO_DATA'); } else { this.proceedWithAction(mode, filePath); } }).catch(err => { console.error('app.pam.ExportImportPAMData', JSON.stringify(err)); this.set('errorMessage', Ractive.localization.nls('passwords.settings.export.error.title')); this.set('page', 'PAGE_ERROR'); }); }, wipeVaultData(){ return NAPI.request('app.pam.ExportImportPAMData', { aType: 'wipeData' }); }, proceedWithAction(actionMode, path) { this.set('page', 'PAGE_LOADING'); NAPI.request('app.pam.ExportImportPAMData', { aType: (actionMode === 'import') ? 'imp' : 'exp', path: path }).then(response => { const data = this.processStats(response); const pathArr = path.split('\\'); if (data.sourceCount === 0) { this.set('errorTitle', Ractive.localization.nls('passwords.settings.import.emptyFileError.title')); this.set('errorMessage', Ractive.localization.nls('passwords.settings.import.emptyFileError.subtitle', (pathArr[pathArr.length -1]))); this.set({'errorMessageStatistics': '', 'buttonTryAgain': false, 'page': 'PAGE_ERROR'}); } else { this.set('stats', data); this.set('page', 'PAGE_SUCCESS'); } }).catch(err => { if (err.stats) { const data = this.processStats(err); this.set('stats', data); } const pathArr = path.split('\\'); let errorMessage = Ractive.localization.nls('passwords.settings.exportImport.error.subtitle'); let errorMessageStatistics = ''; let errorTitle = ''; let buttonTryAgain = true; if (!err.id) { err.id = 'nan'; } switch (err.id) { case 'expFileCreationFailed': errorTitle = Ractive.localization.nls('passwords.settings.export.fileError.title'); errorMessage = Ractive.localization.nls('passwords.settings.export.fileError.subtitle', (pathArr[pathArr.length -2])); break; case 'genericExpError': case 'expError': errorTitle = Ractive.localization.nls('passwords.settings.export.error.title'); if (this.get('stats.processedCount') === 0) { errorMessageStatistics = Ractive.localization.nls('passwords.settings.export.error.zeroCountOfItems', this.get('stats.processedCount'), this.get('stats.sourceCount')); } else if (this.get('stats.processedCount') > 0) { errorMessageStatistics = Ractive.localization.nls('passwords.settings.export.error.countOfItems', this.get('stats.processedCount'), this.get('stats.sourceCount')); } break; case 'impFileOpenFailed': errorTitle = Ractive.localization.nls('passwords.settings.import.fileError.title'); errorMessage = Ractive.localization.nls('passwords.settings.import.fileError.subtitle', (pathArr[pathArr.length -1])); break; case 'genericImpError': case 'impError': errorTitle = Ractive.localization.nls('passwords.settings.import.error.title'); if (this.get('stats.processedCount') === 0) { errorMessageStatistics = Ractive.localization.nls('passwords.settings.import.error.zeroCountOfItems', this.get('stats.processedCount'), this.get('stats.sourceCount')); } else if (this.get('stats.processedCount') > 0) { errorMessageStatistics = Ractive.localization.nls('passwords.settings.import.error.countOfItems', this.get('stats.processedCount'), this.get('stats.sourceCount')); } break; case 'impDataDeleteFailed': errorTitle = Ractive.localization.nls('passwords.settings.import.vaultDeleteError.title'); break; case 'impFileEmptyError': errorTitle = Ractive.localization.nls('passwords.settings.import.emptyFileError.title'); errorMessage = Ractive.localization.nls('passwords.settings.import.emptyFileError.subtitle', (pathArr[pathArr.length -1])); buttonTryAgain = false; break; default: if (actionMode === 'import') { errorTitle = Ractive.localization.nls('passwords.settings.export.error.title'); } else { errorTitle = Ractive.localization.nls('passwords.settings.import.error.title'); } } this.set({'errorMessage': errorMessage, 'errorMessageStatistics': errorMessageStatistics, 'errorTitle': errorTitle, 'buttonTryAgain': buttonTryAgain, 'page': 'PAGE_ERROR'}); }); }, processStats(root){ /* LA - number of Logins in file / vault CA - number of Cards in file / vault NA - number of Notes in file / vault LS - number of processed Logins CS - number of processed Cards NS - number of processed Notes */ const sourceCount = root.stats.LA + root.stats.CA + root.stats.NA; const processedCount = root.stats.LS + root.stats.CS + root.stats.NS; return { sourceCount: sourceCount, processedCount: processedCount, diffCount: (sourceCount - processedCount) }; }, showFolder(){ return NAPI.request('app.pam.ExportImportPAMData', { aType: 'showFolder', path: this.get('filePath') }); }, wipeData() { this.set({ 'filePath': '', 'stats': null, 'errorMessage': '', 'errorMessageStatistics': '', 'buttonTryAgain': true, 'errorTitle': '', 'importMode': 'merge', 'goToCustomerSupport' :'https://support.avast.com' }); } }); const ImportExport = Ractive.extend({ template: template$R, css: css_248z$p, components: { Browser, BrowserImportModal, BackupModal }, data: function() { return { browsers: [], browserExports: [], modalDialog: undefined, importingBrowser: undefined, backupMode: undefined, loading: true }; }, oninit: function() { this._initBrowsers(); this._initBrowserExports(); this.on('Modal.close', () => { this.set('modalDialog', undefined); }); this.on('BrowserImportModal.close', () => { this.set('modalDialog', undefined); }); this.on('BackupModal.close', () => { this.set('modalDialog', undefined); }); this.on('beginImportFromBrowser', (e, browser) => { this.set('importingBrowser', browser); this.set('modalDialog', 'browserImportModal'); }); this.on('beginBackup', (e, mode) => { this.set('backupMode', mode); this.set('modalDialog', 'backupModal'); }); this.on('export', (e, where) => { const command = 'pam_export_' + where; // chrome, firefox, csv NAPI.request('av.command', command).catch((err) => { console.error('av.command', command, JSON.stringify(err)); }); }); }, _initBrowsers() { this.set('loading', true); NAPI.request('app.pam.GetBrowserStatus').then((res) => { const browsers = []; for (const browser of res) { browser.name = getBrowserName(browser.browser); browsers.push(browser); } this.set('browsers', browsers); this.set('loading', false); }).catch((err) => { console.error('app.pam.GetBrowserStatus', JSON.stringify(err)); }); }, _initBrowserExports() { const browserExports = [{ browser: 'chrome', name: getBrowserName('chrome'), link: 'https://www.avast.com/FAQ/AVKB273' }, { browser: 'firefox', name: getBrowserName('firefox'), link: 'https://www.avast.com/FAQ/AVKB274' }]; this.set('browserExports', browserExports); } }); const template$U = {"v":3,"t":[{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.deleteVault.title\")"}}]},"f":[{"t":7,"e":"p","a":{"class":"p -small -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.deleteVault.subtitle\")"}}]}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--20 modal__actions"},"f":[{"t":7,"e":"button","a":{"class":"btn -secondary","data-test":"deleteVault"},"v":{"click":"deleteVault"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.delete\")"}}]}," ",{"t":7,"e":"button","a":{"class":"btn g-margin-left--10","data-test":"Modal.close"},"v":{"click":"Modal.close"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.cancel\")"}}]}]}]}]}; const DeleteVaultModal = Ractive.extend({ template: template$U, oninit: function() { this.on('Modal.close', () => { this.fire('close'); }); this.on('deleteVault', () => { NAPI.request('app.pam.DeletePAMVault').then(() => { this.fire('close'); this.fire('vaultDeleted'); }).catch((err) => { console.error('app.pam.DeletePAMVault', JSON.stringify(err)); }); }); } }); const DEFAULT_CATEGORY = 'security'; const Settings = Ractive.extend({ template: template$z, css: css_248z$g, components: { Security, BrowserIntegration, SyncBackup, ImportExport, DeleteVaultModal, AirbondModal }, data: function() { return { category: undefined, settingsLocked: undefined, loading: true, modalDialog: undefined }; }, oninit: function() { this.listeners = []; this.listeners.push(NAPI.on('app.pam.onStatusChanged.vaultLocked', () => { this._init(); })); this.on('Overlay.close', () => { this.fire('overlayClose'); }); this.on('setCategory', (e, category) => { this.setCategory(category); }); this.on('DeleteVaultModal.close', () => { this.set('modalDialog', undefined); }); this.on('LoginModal.loginClosed DeleteVaultModal.vaultDeleted', () => { this.fire('overlayClose'); }); this.on('showModal', (e, modalDialog) => { this.set('modalDialog', modalDialog); }); this.on('Modal.close', () => { this.set('modalDialog', undefined); }); this._init(); }, // Called also from index.js when changing routes setCategory(category) { this.set('category', category); const gaCategory = category.charAt(0).toUpperCase() + category.slice(1); NAPI.track.view('PrivacyPasswords/Settings/' + gaCategory); }, _getCategory() { const category = this.get('category'); return category || DEFAULT_CATEGORY; }, _init() { this.set('loading', true); NAPI.request('app.pam.GetPAMVaultState') .then((res) => { const UNKNOWN = 1; const NO_VAULT = 2; const VAULT_EXISTS = 3; if (res === VAULT_EXISTS || res === UNKNOWN || res === NO_VAULT) { this.set({ settingsLocked: true, loading: false, category: this._getCategory() }); NAPI.track.view('PrivacyPasswords/Settings/Locked'); } else { this.set({ settingsLocked: false, loading: false }); this.setCategory(this._getCategory()); } }).catch((err) => { console.error('app.pam.GetPAMVaultState', JSON.stringify(err)); }); }, onteardown() { this.listeners.forEach((off) => { off(); }); }, }); const template$V = {"v":3,"t":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"avs nui_standalone","data-product":[{"t":2,"r":"product"}]},"f":[{"t":7,"e":"div","a":{"class":"nui_main nui_main_standalone"},"f":[{"t":16}]}," ",{"t":7,"e":"Titlebar","a":{"product":[{"t":2,"r":"product"}],"title":[{"t":2,"r":"title"}],"menuIcon":"true","menuIconTitle":[{"t":2,"x":{"r":["nls"],"s":"_0(\"menu\")"}}],"menuItems":[{"t":2,"x":{"r":["onSettings","nls","onLicenses"],"s":"[{title:_1(\"passwords.settings\"),icon:\"settings\",onclick:_0},{title:_1(\"my.licenses\"),icon:\"avast-ameba-outline\",onclick:_2}]"}}],"minimizeIconTitle":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.minimize\")"}}],"closeIconTitle":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.close\")"}}]}}," ",{"t":4,"f":[{"t":7,"e":"Overlay","a":{"type":"main","title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"my.licenses\")"}}]},"f":[{"t":7,"e":"Module","a":{"name":"MyLicenses"}}]}],"n":50,"r":"showLicenses"}]}],"n":50,"r":"IS_STANDALONE_WINDOW"},{"t":4,"n":51,"f":[{"t":16}],"r":"IS_STANDALONE_WINDOW"}]}; var css_248z$s = ".nui_standalone .nui_main {\n z-index: auto;\n}\n.nui_standalone .pam_list {\n top: 0;\n padding-top: 8rem;\n margin-top: 0;\n left: 218px;\n}\n.nui_standalone .pam_empty-screen {\n margin-top: 10rem;\n}\n.nui_standalone .pam_panel {\n margin-top: 0;\n}\n.nui_standalone .pam_section_content {\n margin-top: 3rem;\n}\n.nui_standalone .pam_section_title {\n position: fixed;\n background: linear-gradient(to bottom, #f4f4f4 69%, rgba(244,244,244,0) 100%);\n height: 90px;\n padding-top: 30px;\n top: 42;\n left: 240;\n z-index: 1;\n width: 750px;\n text-align: center;\n display: block;\n}\n.nui_standalone .pam_filter {\n top: 3rem;\n color: #767683;\n}\n.nui_standalone .pam_unlock_standalone {\n margin-top: 50px;\n}\n.nui_standalone .nui_page__scroll {\n --scrollbar-bg: rgba(180,180,180,0.4);\n --scrollbar-bg-hover: rgba(180,180,180,0.6);\n}\n.nui_standalone .color-light-grey.-bg {\n background-color: #f4f4f4;\n color: #2d364c;\n}\n.nui_standalone .color-light.-bg {\n background-color: #f4f4f4;\n color: #767683;\n}\n.nui_standalone .color-white.-bg {\n background-color: #fff;\n color: #3d5870;\n}\n.nui_standalone .color-white.-text {\n color: #fff;\n}\n[dir=rtl] .nui_standalone .pam_section_title {\n right: 240;\n}\n[dir=rtl] .nui_standalone .pam_list {\n right: 218px;\n left: 0;\n}\n"; /* Opening standalone: NAPI.request('app.windowManager.ShowWindow', {'url':'https://local.avast.com/MainWindow.html?module=PrivacyPasswords', 'type': 'CEF', 'width': 1010, 'height': 674}); */ const Standalone = Ractive.extend({ template: template$V, css: css_248z$s, components: { StandaloneMenu, Settings }, data: function() { return { module: null, product: null, showSettings: false, onSettings: this._onSettings, onLicenses: this._onLicenses }; }, computed: { IS_STANDALONE_WINDOW: function() { return (new RegExp('module=' + this.get('module'))).test(location.search); } }, oninit() { this.on('Titlebar.minimizeWindow', () => { NAPI$1.Window.minimize(); }); this.on('Titlebar.closeWindow', () => { NAPI$1.Window.close(); }); this.on('*.overlayClose', () => { this.set('showLicenses', false); }); }, _onSettings() { this.parent.fire('openSettings'); }, _onLicenses() { this.set('showLicenses', true); } }); class ConfigDef { static isStandalonePamAllowed(){ // if flag isnt defined or is 0 (falsy value - it is not standalone) return this.get('avdef://config/Pam/StandaloneUiFeature').then((response)=>{ return parseInt(response); }).catch(()=>{ return 0; }); } static get(path) { return NAPI$1.request('app.settings.Get', { name: path }).then((response) => { return response.value; }); } } const template$W = {"v":3,"t":[{"t":7,"e":"div","a":{"class":["g-align--center ",{"t":2,"x":{"r":["isStandAlone"],"s":"_0?\"pam_unlock_standalone\":\"\""}}]},"f":[{"t":7,"e":"SvgIcon","a":{"name":"pam-lock","cssCls":"pam_unlock__icon"}}," ",{"t":4,"f":[{"t":7,"e":"h2","a":{"class":"h2"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.sync.page.enterAccountPassword.desc\")"}}]}," ",{"t":7,"e":"p","a":{"class":"p g-margin-top--10 g-margin-bottom--10"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.sync.page.enterAccountPassword.desc2\")"}}]}],"n":50,"x":{"r":["syncState.reason","syncState.lastRequest.reason"],"s":"_0===\"changed\"||_1===\"changed\""}},{"t":4,"n":51,"f":[{"t":7,"e":"div","a":{"class":"pam_account_generic"},"f":[{"t":7,"e":"h2","a":{"class":"h2"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.banner.syncStopped.desc\")"}}]}]}],"x":{"r":["syncState.reason","syncState.lastRequest.reason"],"s":"_0===\"changed\"||_1===\"changed\""}}," ",{"t":7,"e":"form","a":{"class":"pam_account_password_form"},"f":[{"t":4,"f":[{"t":8,"r":"prefilled_email_partial"}],"n":50,"r":"email"},{"t":4,"n":51,"f":[{"t":8,"r":"email_partial"}],"r":"email"}," ",{"t":8,"r":"password_partial"}," ",{"t":4,"f":[{"t":7,"e":"button","a":{"type":"submit","disabled":[{"t":2,"r":"inProgress"}],"class":["btn -large ",{"t":2,"x":{"r":["inProgress"],"s":"_0?\"-loading\":\"\""}}]},"v":{"click":"loginPasswordClick"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.login.btn.login\")"}}]}],"n":50,"x":{"r":["syncState.state"],"s":"_0===\"enterIDAPwd\""}},{"t":4,"n":51,"f":[{"t":7,"e":"button","a":{"type":"submit","disabled":[{"t":2,"r":"inProgress"}],"class":["btn -large ",{"t":2,"x":{"r":["inProgress"],"s":"_0?\"-loading\":\"\""}}]},"v":{"click":"loginClick"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.modal.login.btn.login\")"}}]}],"x":{"r":["syncState.state"],"s":"_0===\"enterIDAPwd\""}}," ",{"t":7,"e":"GenericError","a":{"show":[{"t":2,"r":"showGenericError"}]}}," ",{"t":7,"e":"div","a":{"class":"form__row"},"f":[{"t":7,"e":"a","a":{"class":"a","href":"https://id.avast.com/#recoverPassword"},"v":{"click":"browser"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.sync.lnk.forgotPassword\")"}}]}]}]}]}," ",{"t":4,"f":[{"t":7,"e":"CaptchaModal","a":{"cid":[{"t":2,"r":"solvingCaptcha.cid"}],"url":[{"t":2,"r":"solvingCaptcha.url"}]}}],"n":50,"x":{"r":["modalDialog"],"s":"_0===\"captcha\""}}," "],"p":{"email_partial":[{"t":7,"e":"div","a":{"class":"form__row"},"v":{"click":{"n":"clearInputErrors","a":"email"}},"f":[{"t":7,"e":"Input","a":{"id":"email","innerValue":[{"t":2,"r":"input.email"}],"label":[{"t":2,"x":{"r":["page","nls"],"s":"_0===\"createAccount\"?_1(\"passwords.settings.sync.label.email\"):_1(\"passwords.settings.sync.label.enterEmail\")"}}],"type":"text","message":[{"t":2,"r":"inputError.email.message"}],"error":[{"t":2,"r":"inputError.email.error"}]}}]}],"prefilled_email_partial":[{"t":7,"e":"div","a":{"class":"form__row"},"f":[{"t":7,"e":"Input","a":{"disabled":0,"id":"email","innerValue":[{"t":2,"r":"email"}],"label":"","type":"text"}}]}],"password_partial":[{"t":7,"e":"div","a":{"class":"form__row"},"f":[{"t":7,"e":"div","a":{"class":"pam_settings_input_reveal_secret_cont"},"v":{"click":{"n":"clearInputErrors","a":"password"}},"f":[{"t":7,"e":"ButtonRevealSecret","a":{"isRevealed":[{"t":2,"r":"inputReveal.password"}],"cssCls":"pam_settings_reveal_secret"}}," ",{"t":4,"f":[{"t":7,"e":"Input","a":{"id":"password","innerValue":[{"t":2,"r":"input.password"}],"label":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.sync.page.enterAccountPassword.inputPassword.label\")"}}],"type":"text","readonly":"true","message":[{"t":2,"r":"inputError.password.message"}],"error":[{"t":2,"r":"inputError.password.error"}]}}],"n":50,"r":"inputReveal.password"},{"t":4,"n":51,"f":[{"t":7,"e":"Input","a":{"id":"password","innerValue":[{"t":2,"r":"input.password"}],"label":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.sync.page.enterAccountPassword.inputPassword.label\")"}}],"type":"password","message":[{"t":2,"r":"inputError.password.message"}],"error":[{"t":2,"r":"inputError.password.error"}]}}],"r":"inputReveal.password"}]}]}]}}; var css_248z$t = ".pam_unlock__icon {\n font-size: 80px;\n margin-bottom: 15px;\n}\n.pam_account_generic {\n width: 400px;\n margin: auto;\n}\n.pam_account_password_form {\n width: 300px !important;\n margin-top: 20px !important;\n}\n.pam_account_password_form .form__row {\n min-height: 6rem !important;\n}\n"; const EnterAccountScreen = Ractive.extend({ template: template$W, css: css_248z$t, components: { ButtonRevealSecret, GenericError }, data: () => { return { inProgress: false, input: { password: '', email: '', }, inputReveal: { password: false, }, inputError: { password: { error: false, message: '' }, email: { error: false, message: '' } } }; }, oninit() { this.observe('email', (email) => { // Update ractive. For some reason, value was overridden by init data value this.update('input.email'); this.set('input.email', email); }, { init: true }); this.observe('syncState', (syncState) => { if (!syncState) { return; } this.set('inProgress', false); if (syncState.reason === 'invalid') { this.set({ 'inputError.password.error': true, 'inputError.password.message': Ractive.localization.nls('passwords.settings.sync.modal.loginPassword.error.incorrectPassword') }); } else if (syncState.reason === 'error') { this.set('showGenericError', true); } }, { init: true }); this.on('clearInputErrors', (e, input, clearMessage) => { this._clearInputErrors(input, clearMessage); }); this.on('loginPasswordClick', () => { this._validateInput('password'); if (this.get('inputError.password.error')) { return false; } this.set('inProgress', true); NAPI$1.request('app.pam.SynchronizationSetup', { request: 'enterIDAPwd', data: { pwd: PamCrypto$1.dataCryptoEnabled? PamCrypto$1.encrypt(this.get('input.password')) : this.get('input.password') } }).catch((err) => { console.error('app.pam.SynchronizationSetup', JSON.stringify(err)); }); }); this.on('loginClick', () => { this._validateInput('email'); this._validateInput('password'); if (this.get('inputError.email.error') || this.get('inputError.password.error')) { return false; } this.set('inProgress', true); NAPI$1.request('app.pam.SynchronizationSetup', { request: 'accountSetup', data: { create: false, account: 'Avast', email: PamCrypto$1.dataCryptoEnabled? PamCrypto$1.encrypt(this.get('input.email')) : this.get('input.email'), pwd: PamCrypto$1.dataCryptoEnabled? PamCrypto$1.encrypt(this.get('input.password')) : this.get('input.password') } }).catch((err) => { console.error('app.pam.SynchronizationSetup', JSON.stringify(err)); }); }); }, _validateInput(input) { // eslint-disable-next-line max-len, no-useless-escape const EMAIL_REGEXP = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@(([a-zA-Z0-9]+(\.|\-))*([a-zA-Z0-9]+)\.)+[a-zA-Z]{2,}$/; switch (input) { case 'email': this._clearInputErrors(input); if (!EMAIL_REGEXP.test(this.get('input.email'))) { this.set({ 'inputError.email.error': true, 'inputError.email.message': Ractive.localization.nls('passwords.settings.sync.modal.create.error.invalidEmail') }); } break; case 'password': this._clearInputErrors(input); if (this.get('input.password').length === 0) { this.set({ 'inputError.password.error': true }); } break; } }, _clearInputErrors(input, clearMessage = true) { this.set('showGenericError', false); if (input) { if (clearMessage) { this.set('inputError.' + input, { error: false, message: '' }); } else { this.set('inputError.' + input + '.error', false); } } } }); var css_248z$u = ".pam_master_password_form .pam_master_password_checkbox {\n display: flex;\n}\n.pam_master_password_form .pam_master_password_checkbox .input__label {\n opacity: 1;\n font-size: 15px;\n}\n.pam_master_password_form .pam_master_password_checkbox .input__label:not(.color-critical) {\n color: rgba(255,255,255,0.7);\n}\n.pam_master_password_form .pam_master_password_checkbox .input__label:not(.color-critical) strong {\n color: #fff;\n}\n.pam_master_password_form .pam_master_password_checkbox .checkbox {\n flex-shrink: 0;\n}\n.pam_master_password_form .pam_password_tooltip_cont {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n}\n.pam_master_password_form .pam_password_tooltip_cont .pam_password_tooltip {\n position: absolute;\n z-index: 9999;\n margin-left: -10px;\n width: 400px;\n padding: 10px;\n}\n.pam_master_password_form .pam_password_tooltip_cont .pam_password_tooltip .pam_password_tooltip_text_cont {\n display: flex;\n text-align: left;\n}\n.pam_master_password_form .pam_password_tooltip_cont .pam_password_tooltip .pam_password_tooltip_text_cont .icon {\n margin-right: 10px;\n}\n.pam_master_password_form .pam_password_tooltip_cont .pam_password_tooltip::after {\n content: '';\n position: absolute;\n top: 100%;\n left: 50%;\n margin-left: -7px;\n border-width: 7px;\n border-style: solid;\n border-color: rgba(20,28,45,0.9) transparent transparent transparent;\n}\n"; const template$X = {"v":3,"t":[{"t":7,"e":"Modal","a":{"title":[{"t":3,"x":{"r":["masterPasswordSet","nls"],"s":"_0?_1(\"passwords.settings.masterPassword.change.title\"):_1(\"passwords.settings.masterPassword.create.title\")"}}]},"f":[{"t":4,"f":[{"t":7,"e":"p","a":{"class":"p -small -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.masterPassword.create.desc\")"}}]}],"n":50,"x":{"r":["masterPasswordSet"],"s":"!_0"}}," ",{"t":7,"e":"form","a":{"class":"pam_master_password_form","onsubmit":"return false"},"f":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"form__row g-margin-top--20 g-margin-bottom--20"},"f":[{"t":7,"e":"div","a":{"class":"pam_settings_input_reveal_secret_cont"},"v":{"click":{"n":"clearInputErrors","a":"oldMasterPassword"}},"f":[{"t":7,"e":"ButtonRevealSecret","a":{"isRevealed":[{"t":2,"r":"inputReveal.oldMasterPassword"}],"cssCls":"pam_settings_reveal_secret"}}," ",{"t":4,"f":[{"t":7,"e":"SensitiveInput","a":{"value":[{"t":2,"r":"input.oldMasterPassword"}],"canvasId":"oldMasterPasswordCanvas","classes":"input__row isDark"}}],"n":50,"r":"inputReveal.oldMasterPassword"},{"t":4,"n":51,"f":[{"t":7,"e":"Input","a":{"id":"oldMasterPassword","innerValue":[{"t":2,"r":"input.oldMasterPassword"}],"label":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.masterPassword.current.label\")"}}],"type":"password","message":[{"t":2,"r":"inputError.oldMasterPassword.message"}],"error":[{"t":2,"r":"inputError.oldMasterPassword.error"}]}}],"r":"inputReveal.oldMasterPassword"}]}]}],"n":50,"r":"masterPasswordSet"}," ",{"t":7,"e":"div","a":{"class":"form__row g-margin-top--20"},"f":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_password_tooltip_cont"},"f":[{"t":7,"e":"div","a":{"class":"tooltip pam_password_tooltip"},"f":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_password_tooltip_text_cont"},"f":[{"t":7,"e":"Icon","a":{"name":"tick-circle-small","cssCls":"color-ok -text"}}," ",{"t":7,"e":"div","a":{"class":"color-ok -text text -tiny"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.masterPassword.strong.tooltip\")"}}]}]}],"n":50,"x":{"r":["passwordStrength"],"s":"_0===3"}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["passwordStrength"],"s":"_0===4"},"f":[{"t":7,"e":"div","a":{"class":"pam_password_tooltip_text_cont"},"f":[{"t":7,"e":"Icon","a":{"name":"tick-circle-small","cssCls":"color-ok -text"}}," ",{"t":7,"e":"div","a":{"class":"color-ok -text text -tiny"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.masterPassword.veryStrong.tooltip\")"}}]}]}]},{"t":4,"n":50,"x":{"r":["passwordStrength"],"s":"(!(_0===4))&&(_0===2)"},"f":[" ",{"t":7,"e":"div","a":{"class":"pam_password_tooltip_text_cont"},"f":[{"t":7,"e":"Icon","a":{"name":"info"}}," ",{"t":7,"e":"div","a":{"class":"text -tiny"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.masterPassword.good.tooltip\")"}}]}]}]},{"t":4,"n":50,"x":{"r":["passwordStrength"],"s":"(!(_0===4))&&((!(_0===2))&&(_0<2))"},"f":[" ",{"t":7,"e":"div","a":{"class":"pam_password_tooltip_text_cont"},"f":[{"t":7,"e":"Icon","a":{"name":"info"}}," ",{"t":7,"e":"div","a":{"class":"text -tiny"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.masterPassword.weak.tooltip\")"}}]}]}]}],"x":{"r":["passwordStrength"],"s":"_0===3"}}]}]}],"n":50,"x":{"r":["passwordStrength","input.masterPassword.length","hidePasswordTooltip"],"s":"_0>-1&&_1>0&&!_2"}}," ",{"t":7,"e":"div","a":{"class":"pam_settings_input_reveal_secret_cont"},"v":{"click":{"n":"clearInputErrors","a":"masterPassword"}},"f":[{"t":7,"e":"ButtonRevealSecret","a":{"isRevealed":[{"t":2,"r":"inputReveal.masterPassword"}],"cssCls":"pam_settings_reveal_secret"}}," ",{"t":4,"f":[{"t":7,"e":"SensitiveInput","a":{"value":[{"t":2,"r":"input.masterPassword"}],"canvasId":"masterPasswordCanvas","classes":"input__row isDark"}}],"n":50,"r":"inputReveal.masterPassword"},{"t":4,"n":51,"f":[{"t":7,"e":"Input","a":{"id":"masterPassword","innerValue":[{"t":2,"r":"input.masterPassword"}],"label":[{"t":3,"x":{"r":["masterPasswordSet","nls"],"s":"_0?_1(\"passwords.settings.masterPassword.new.label\"):_1(\"passwords.settings.masterPassword.create.btn\")"}}],"type":"password","message":[{"t":2,"r":"inputError.masterPassword.message"}],"error":[{"t":2,"r":"inputError.masterPassword.error"}]},"v":{"blur":"hidePasswordTooltip","focus":"showPasswordTooltip"}}],"r":"inputReveal.masterPassword"}]}]}," ",{"t":7,"e":"div","a":{"class":"form__row"},"f":[{"t":7,"e":"div","a":{"class":"pam_settings_input_reveal_secret_cont"},"v":{"click":{"n":"clearInputErrors","a":"masterPasswordConfirm"}},"f":[{"t":7,"e":"ButtonRevealSecret","a":{"isRevealed":[{"t":2,"r":"inputReveal.masterPasswordConfirm"}],"cssCls":"pam_settings_reveal_secret"}}," ",{"t":4,"f":[{"t":7,"e":"SensitiveInput","a":{"value":[{"t":2,"r":"input.masterPasswordConfirm"}],"canvasId":"masterPasswordConfirmCanvas","classes":"input__row isDark"}}],"n":50,"r":"inputReveal.masterPasswordConfirm"},{"t":4,"n":51,"f":[{"t":7,"e":"Input","a":{"id":"masterPasswordConfirm","innerValue":[{"t":2,"r":"input.masterPasswordConfirm"}],"label":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.masterPassword.retype.label\")"}}],"type":"password","message":[{"t":2,"r":"inputError.masterPasswordConfirm.message"}],"error":[{"t":2,"r":"inputError.masterPasswordConfirm.error"}]}}],"r":"inputReveal.masterPasswordConfirm"}]}]}," ",{"t":7,"e":"div","a":{"class":"pam_master_password_checkbox text -small g-margin-top--20"},"f":[{"t":7,"e":"input","a":{"id":"masterPasswordAcknowledge","class":"checkbox g-margin-right--10","type":"checkbox","checked":[{"t":2,"r":"input.masterPasswordAcknowledged"}]},"v":{"click":{"n":"clearInputErrors","a":"masterPasswordAcknowledged"}}}," ",{"t":7,"e":"label","a":{"class":["g-align--left ",{"t":2,"x":{"r":["inputError.masterPasswordAcknowledged.error"],"s":"_0?\"color-critical -text\":\"\""}}],"for":"masterPasswordAcknowledge"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.masterPassword.acknowledgeCheckbox\")"}}]}]}," ",{"t":7,"e":"button","a":{"type":"submit","class":"g-margin-top--20 btn -large","data-test":"saveMasterPassword"},"v":{"click":"saveMasterPassword"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.settings.masterPassword.save.btn\")"}}]}]}]}]}; const MasterPasswordModal = Ractive.extend({ template: template$X, css: css_248z$u, components: { ButtonRevealSecret, SensitiveInput }, data: function() { return { input: { masterPassword: '', masterPasswordConfirm: '', oldMasterPassword: '', masterPasswordAcknowledged: false }, inputReveal: { masterPassword: false, masterPasswordConfirm: false, oldMasterPassword: false, }, inputError: { masterPassword: { error: false, message: '' }, masterPasswordConfirm: { error: false, message: '' }, oldMasterPassword: { error: false, message: '' }, masterPasswordAcknowledged: { error: false, message: '' } }, passwordStrength: -1, hidePasswordTooltip: true, masterPasswordSet: undefined, }; }, oninit: function() { this.typingPasswordTimeout = undefined; this.observe('input.masterPassword', (newValue) => { this.set('hidePasswordTooltip', false); this._setPAMPasswordStrength(newValue); newValue = ''; }, { init: false }); this.on('close', () => { NAPI.emit('sensitiveModal.initPamCrypto'); setTimeout(() => { window.app.asyncCall('window.close', response => {}, []); }, 100); }); this.on('Modal.close', () => { this.fire('close'); }); this.on('clearInputErrors', (e, input) => { this._clearInputErrors(input); }); this.on('hidePasswordTooltip', () => { this.set('hidePasswordTooltip', true); }); this.on('showPasswordTooltip', () => { this.set('hidePasswordTooltip', false); }); this.on('saveMasterPassword', () => { this._clearInputErrors(); const masterPasswordSet = this.get('masterPasswordSet'); let masterPassword = this.get('input.masterPassword'); let masterPasswordConfirm = this.get('input.masterPasswordConfirm'); let oldMasterPassword = this.get('input.oldMasterPassword'); const masterPasswordAcknowledged = this.get('input.masterPasswordAcknowledged'); let errors = 0; if (masterPasswordSet && oldMasterPassword.length === 0) { errors += 1; this.set('inputError.oldMasterPassword', { error: true, message: '' }); } if (masterPassword.length === 0) { errors += 1; this.set('inputError.masterPassword', { error: true, message: '' }); } else if (masterPassword !== masterPasswordConfirm) { errors += 1; this.set('inputError.masterPassword', { error: true, message: '' }); this.set('inputError.masterPasswordConfirm', { error: true, message: Ractive.localization.nls('passwords.settings.masterPassword.error.passwordsDontMatch') }); } if (!masterPasswordAcknowledged) { errors += 1; this.set('inputError.masterPasswordAcknowledged', { error: true }); } if (errors > 0) { return false; } if (masterPasswordSet) { this._clearInputErrors(); NAPI.request('app.pam.ChangeDevicePassword', { 'oldPassword': PamCrypto$1.masterPasswordCryptoEnabled? PamCrypto$1.encrypt(oldMasterPassword) : oldMasterPassword, 'newPassword': PamCrypto$1.masterPasswordCryptoEnabled? PamCrypto$1.encrypt(masterPassword) : masterPassword }).then(() => { masterPassword = ''; oldMasterPassword = ''; NAPI.emit('sensitiveModal.masterPasswordModal.masterPasswordChanged'); this.fire('close'); }).catch((err) => { console.error('app.pam.ChangeDevicePassword', JSON.stringify(err)); this.set('inputError.oldMasterPassword', { error: true, message: Ractive.localization.nls('passwords.settings.masterPassword.error.incorrect') }); }); } else { this._clearInputErrors(); NAPI.request('app.pam.CreateMasterPasswordAndRemoveSystemLogin', { 'masterPassword': PamCrypto$1.masterPasswordCryptoEnabled? PamCrypto$1.encrypt(masterPassword) : masterPassword }).then(() => { masterPassword = ''; masterPasswordConfirm = ''; NAPI.emit('sensitiveModal.masterPasswordModal.masterPasswordCreated'); this.fire('close'); }).catch((err) => { console.error('app.pam.CreateMasterPasswordAndRemoveSystemLogin', JSON.stringify(err)); }); } }); }, _clearInputErrors(input = undefined) { if (input) { this.set('inputError.' + input, { error: false, message: '' }); } else { this.set('inputError', { masterPassword: { error: false, message: '' }, masterPasswordConfirm: { error: false, message: '' }, oldMasterPassword: { error: false, message: '' }, masterPasswordAcknowledged: { error: false }, }); } }, _setPAMPasswordStrength(password) { if (password.length === 0) { this.set('passwordStrength', -1); this._clearTypingPasswordTimeout(); password = ''; return; } NAPI.request('app.pam.GetPAMPasswordStrength', { password: PamCrypto$1.masterPasswordCryptoEnabled? PamCrypto$1.encrypt(password) : password }).then((response) => { if (response.secureScore <= 2) { this._clearTypingPasswordTimeout(); // UX requirement - We show hint in a little delay (when user stops typing) so user // is not bothered with error messages before he enter whole password. this.typingPasswordTimeout = setTimeout(() => { this.set('passwordStrength', response.secureScore); }, 800); } else { // Green message is shown immediatelly. this._clearTypingPasswordTimeout(); this.set('passwordStrength', response.secureScore); } }); password = ''; }, _clearTypingPasswordTimeout() { if (this.typingPasswordTimeout) { clearTimeout(this.typingPasswordTimeout); this.typingPasswordTimeout = undefined; } }, onteardown() { this._clearTypingPasswordTimeout(); this.set('input.oldMasterPassword', ''); this.set('input.masterPassword', ''); this.set('input.masterPasswordConfirm', ''); } }); const template$Y = {"v":3,"t":[{"t":7,"e":"Modal","a":{"title":"","autoClose":0},"f":[{"t":7,"e":"div","a":{"class":["g-align--center ",{"t":2,"x":{"r":["isStandAlone"],"s":"_0?\"pam_unlock_standalone\":\"\""}}]},"f":[{"t":7,"e":"div","m":[{"t":4,"f":["class=\"animated shakeLess\""],"n":50,"r":"shake"}],"f":[{"t":7,"e":"SvgIcon","a":{"name":"pam-lock","cssCls":"pam_unlock__icon"}}," ",{"t":7,"e":"h2","a":{"class":"h2 pam_title"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.enterMasterPassword\")"}}]}," ",{"t":7,"e":"br"}," ",{"t":7,"e":"form","a":{"class":"pam_unlock"},"f":[{"t":7,"e":"input","o":"eventHandler","a":{"class":["input ",{"t":4,"f":["-error"],"n":50,"x":{"r":["error"],"s":"_0===\"wrongPassword\"||_0===\"forgotPassword\""}}," pam_unlock__field"],"type":"password","name":"password","value":[{"t":2,"r":"password"}],"placeholder":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.enterYourPassword\")"}}],"aria-label":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.enterYourPassword\")"}}],"autofocus":"true"}}," ",{"t":7,"e":"p","a":{"class":"pam_error text -small color-danger -text"}}," ",{"t":7,"e":"br"}," ",{"t":7,"e":"button","a":{"class":"btn -large","type":"submit"},"v":{"click":"unlock"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.unlock\")"}}]}," ",{"t":7,"e":"br"}]}]}]}]}]}; var isMainWnd = window.location.href.indexOf('#PrivacyPasswords') != -1 || window.location.href.includes("sensitiveModal"); console.log('isMainWnd: ', isMainWnd); function notifyClose() { NAPI$1.request('app.pam.OnClosingLockScreen'); } const UnlockCefDialog = Ractive.extend({ template : template$Y, css: css_248z$2, data: () => { return { password: '', error: '', shake: false }; }, oninit() { NAPI$1.track.view('PrivacyPasswords/' + (isMainWnd ? 'Unlock' : 'UnlockDialog')); var attemptMatch = window.location.href.match(/&attempt=([0-9]+)/); if (attemptMatch) { if (parseInt(attemptMatch[1]) > 1) { this.set('error', 'wrongPassword'); } } this.on('unlock', (event) => { var password = this.get('password'); if (password.length > 0) { this.unlock(password) .then((response) => { if (response === 'success') { password = ''; NAPI$1.track.event('Passwords-Unlock', 'Success', ''); this.setError(''); this.fire('success'); NAPI$1.emit('sensitiveModal.unlockCefDialog.success'); this.fire('close'); } else { NAPI$1.track.event('Passwords-Unlock', 'Error', response); this.setError(response); } }); } else { this.setError('emptyPassword'); } event.original.preventDefault(); }); this.on('Modal.close', () => { this.fire('close'); }); this.on('close', () => { NAPI$1.emit('sensitiveModal.initPamCrypto'); setTimeout(() => { window.app.asyncCall('window.close', response => {}, []); }, 100); }); if (isMainWnd) { NAPI$1.request('app.pam.OnOpeningLockScreen') .catch((response) => { console.error('OnOpeningLockScreen', response); }); window.addEventListener('beforeunload', notifyClose); } }, onteardown() { if (isMainWnd) { window.removeEventListener('beforeunload', notifyClose); notifyClose(); } this.set('password', ''); }, /** * requests EnterDevicePassword * @protected * @param {password} * @return {success/wrongPassword/forgotPassword} */ unlock(password) { return NAPI$1.request('app.pam.EnterDevicePassword', PamCrypto$1.masterPasswordCryptoEnabled ? PamCrypto$1.encrypt(password) : password) .then((response) => { console.log('EnterDevicePassword', response); if (response.login_successfull === true) { password = ''; return 'success'; } else { return 'wrongPassword'; } }) .catch((response) => { console.error('EnterDevicePassword error:', response); return 'serviceError'; }); }, setError(error) { var errorPromise = [this.set('error', error)]; if (error) { errorPromise.push(this.set('shake', true)); } setTimeout(() => { this.set('shake', false); }, 800); return Promise.all(errorPromise); } }); /** * Password Manager **/ const IS_STANDALONE_WINDOW = /module=PrivacyPasswords/.test(location.search); // // Time before settings opening animation finished const SETTINGS_MODAL_DELAY = 400; const app = Ractive.extend({ router : new Router(), template : template, css : css_248z, components : { Onboarding, Unlock, List, Settings, Standalone, OpenStandaloneUi, EnterAccountScreen, CaptchaModal, MasterPasswordModal, PasswordDetails, UnlockCefDialog }, data: () => { return { IS_STANDALONE_WINDOW: IS_STANDALONE_WINDOW, hasSystemLogin: false, hasDevicePasswordLogin: true, showInfo: false, vaultState: null, showSettings: false, offerStandaloneUi: false, syncState: undefined, showSyncStopped: false, showEnterAccountScreen: false, solvingCaptcha: {show: false, cid: undefined, url: undefined, openedFromMainUi: undefined}, email: undefined, showSyncEnabledModal: false, sensitiveModalParams: {} }; }, computed: { page: function() { const state = this.get('vaultState'); if (!state) return 'loading'; const hasSystemLogin = this.get('hasSystemLogin'); const hasDevicePasswordLogin = this.get('hasDevicePasswordLogin'); const showEnterAccountScreen = this.get('showEnterAccountScreen'); const isSensitiveModal = window.location.href.includes('sensitiveModal'); if (isSensitiveModal) { const urlParams = new URLSearchParams(window.location.href); const sensitiveModalParams = JSON.parse(window.atob(urlParams.get('sensitiveModalParams'))); this.set('sensitiveModalParams', sensitiveModalParams); return urlParams.get('sensitiveModal'); } switch (state) { case CONST.VAULTSTATES.UNKNOWN: case CONST.VAULTSTATES.NO_VAULT: return 'onboarding'; case CONST.VAULTSTATES.VAULT_EXISTS: if (hasSystemLogin && !hasDevicePasswordLogin) { // System login failed :/ (and there is no master password login) return 'systemLoginError'; } return 'unlockScreen'; default: if (showEnterAccountScreen) { return 'enterAccountScreen'; } return 'passwordsList'; } } }, oninit() { this._initRouter(); PamCrypto$1.initPamCrypto(); ConfigDef.isStandalonePamAllowed().then(isStandalonePamAllowed => { // if flag is set to truthly value, show button to open standalone PAM if (!IS_STANDALONE_WINDOW && isStandalonePamAllowed) { this.set('offerStandaloneUi', true); } else { // otherwise PAM is still integrated inside AV UI this._init(); } }); }, _init() { this._callSync(); this.updatePage(); this.on('Settings.overlayClose', () => { this.set('showSettings', false); this.updatePage(); }); this.on('SyncBackup.syncEnabled', () => { this.set('showSettings', false); this.set('showSyncEnabledModal', true); }); this.on('hideSyncEnabledModal', () => { this.set('showSyncEnabledModal', false); }); this.on('openSettings', () => { this.set('showSettings', true); }); this.on('Onboarding.done', (status) => { console.log('Onboarding.done', status); this.updatePage(); }); this.on('Unlock.success', () => { this.updatePage(); }); NAPI$1.on('sensitiveModal.unlockCefDialog.success', () => { this.updatePage(); }); NAPI$1.on('sensitiveModal.initPamCrypto', () => { PamCrypto$1.initPamCrypto(); }); this.vaultLockedStatusOff = NAPI$1.on('app.pam.onStatusChanged.vaultLocked', () => { if (this.get('page') !== 'onboarding') { this.updatePage(); } }); this.vaultDeletedStatusOff = NAPI$1.on('pam.onStatusChanged.vaultDeleted', () => { this.updatePage(); }); this.syncStatusChangedOff = NAPI$1.on('app.pam.onSyncSetup.statusChanged', (stateData) => { console.debug('Sync state changed event', JSON.stringify(stateData)); this.set('syncState', stateData); const showEnterAccountCond = (stateData) => { const secondaryReasons = ['none', 'error', 'invalid']; return stateData && (stateData.state === 'enterIDAPwd' || stateData.state === 'accountSetup') && (stateData.reason === 'changed' || (secondaryReasons.includes(stateData.reason) && !this._isSettingsCategoryOpened('SyncBackup'))); }; const showEnterAccountUnderCaptcha = stateData.state === 'solveCaptcha' && showEnterAccountCond(stateData.lastRequest); const showEnterAccount = showEnterAccountCond(stateData); const syncStoppedCond = (stateData) => { return stateData && (stateData.state === 'enterIDAPwd' || stateData.state === 'accountSetup') && (stateData.reason === 'afterUpdate' || stateData.reason === 'prove'); }; const syncStoppedUnderCaptcha = stateData.state === 'solveCaptcha' && syncStoppedCond(stateData.lastRequest); const syncStopped = syncStoppedCond(stateData); const showCaptcha = stateData.state === 'solveCaptcha' && !this._isSettingsCategoryOpened('SyncBackup'); if (showCaptcha) { this.set('solvingCaptcha', {show: true, cid: stateData.data.cid, url: stateData.data.url, openedFromMainUi: true}); } else { this.set('solvingCaptcha', {show: false, cid: undefined, url: undefined, openedFromMainUi: undefined}); } if (syncStopped || syncStoppedUnderCaptcha) { this._initAccountInfo().then(() => { this.set('showSyncStopped', true); }); } else { this.set('showSyncStopped', false); } if (showEnterAccount || showEnterAccountUnderCaptcha) { this.set('showSettings', false); this.set('loading', true); this._initAccountInfo().then(() => { this.set('showEnterAccountScreen', true); this.set('loading', false); }); } else { this.set('showEnterAccountScreen', false); } }); this.on('List.showLoginModal', () => { this._openSyncBackupModal('login', 'LoginModal', {page: 'loginAfterUpdateFromMainUi', email: this.get('email')}); }); this.on('CaptchaModal.captchaClosed', () => { this.set('solvingCaptcha', {show: false, cid: undefined, url: undefined, openedFromMainUi: undefined}); }); this.on('lock', () => { NAPI$1.request('app.pam.LockPAMVault') .then((response) => { track.vault.lockedManually(); console.log('LockPAMVault', response); }) .catch((response) => { console.error('LockPAMVault', response); }); }); this.updateRouter(); }, _initRouter() { if (IS_STANDALONE_WINDOW) { const updateRouterRef = this.updateRouter.bind(this); window.addEventListener('hashchange', updateRouterRef); this.offHashChange = window.removeEventListener.bind(window, 'hashchange', updateRouterRef); this.router.on('/:level1', (params) => { if (params.level1 === 'PrivacyPasswords') { this.router.emit('/' + params.level2); } }); this.router.on('/:level1/:level2', (params) => { if (params.level1 === 'PrivacyPasswords') { this.router.emit('/' + params.level2); } }); this.router.on('/:level1/:level2/:level3', (params) => { if (params.level1 === 'PrivacyPasswords') { this.router.emit('/' + params.level2 + '/' + params.level3); } }); } this.router.on('/', () => {}); // Leaked detection dialog handling, otherwise we don't use routes. this.router.on('passwordGuardian', this._showPasswordGuardian.bind(this)); this.router.on('passwordGuardian/:id', this._showPasswordGuardian.bind(this)); this.router.on('restoreIdentity/*', (params)=>{ this._restoreIdentity({ backupString: params.wildcard }); }); this.router.on('setupAirbond', this._setupAirbond.bind(this)); this.router.on('settings/:category', this._openSettingsCategory.bind(this)); this.router.on('settings', this._openSettings.bind(this)); }, _initAccountInfo() { return NAPI$1.request('app.pam.GetSyncAccountInfo').then((response) => { if (response && response.primaryEmail) { this.set('email', response.primaryEmail); } }).catch((err) => { console.error('app.pam.GetSyncAccountInfo', JSON.stringify(err)); }); }, _setupAirbond() { // Since we don't use routes for general navigation, just reset route to default location.hash = 'PrivacyPasswords'; this.set('showSettings', true); const Settings = this.findComponent('Settings'); setTimeout(() => { Settings.set('modalDialog', 'airbond'); }, SETTINGS_MODAL_DELAY); }, _openSettings() { // Since we don't use routes for general navigation, just reset route to default location.hash = 'PrivacyPasswords'; this.set('showSettings', true); }, _openSettingsCategory(params) { // Since we don't use routes for general navigation, just reset route to default location.hash = 'PrivacyPasswords'; this.set('showSettings', true); const Settings = this.findComponent('Settings'); Settings.setCategory(params.category); }, _restoreIdentity(params) { // Since we don't use routes for general navigation, just reset route to default location.hash = 'PrivacyPasswords'; this._openSyncBackupModal('restoreIdentity', 'RestoreIdentity', {backupString: params.backupString}); }, _isSettingsCategoryOpened(categoryComponent) { const Settings = this.findComponent('Settings'); return Settings && Settings.findComponent(categoryComponent); }, _openSyncBackupModal(modalDialog, component, params) { this.set('showSettings', true); const Settings = this.findComponent('Settings'); Settings.setCategory('syncBackup'); const openModal = params => { const SyncBackup = this.findComponent('SyncBackup'); setTimeout(() => { SyncBackup.set('modalDialog', modalDialog); const modalComponent = this.findComponent(component); modalComponent.set(params); }, SETTINGS_MODAL_DELAY); }; // If SyncBackup component is undefined (in case when UI was closed) // Listen to SyncBackup.render event and after that open RestoreIdentity modal if (this.findComponent('SyncBackup')) { openModal(params); } else { this.on('SyncBackup.render', () => { this.off('SyncBackup.render'); openModal(params); }); } }, // leakedDialog / passwordGeneratorToaster handling, otherwise we don't use routes. _showPasswordGuardian(params) { // Since we don't use routes for general navigation, just reset route to default location.hash = 'PrivacyPasswords'; const openPasswordDetail = params => { const list = this.findComponent('List'); const subpage = list.get('subPage'); // If subpage is accounts, stay on accounts tab // Otherwise diplay passwordGuardian let component = undefined; if (subpage === 'accounts') { component = this.findComponent('Accounts'); } else { component = this.findComponent('PasswordGuardian'); list.set('subPage', 'passwordGuardian'); } if (component && params.id) { component.showPasswordDetail(params.id); } else { // If no password id is present, display just PasswordGuardian main page. list.set('subPage', 'passwordGuardian'); } }; // If List component is undefined (in case when UI was closed) // Listen to List.loaded event and after that open password detail if (this.findComponent('List')) { openPasswordDetail(params); } else { this.on('List.loaded', () => { this.off('List.loaded'); openPasswordDetail(params); }); } }, _callSync() { console.debug('_callSync index.js'); NAPI$1.request('app.pam.Synchronize'); }, updateLoginMethods() { NAPI$1.request('app.pam.GetLoginMethods') .then(response => { this.set('hasSystemLogin', response.hasSystemLogin); this.set('hasDevicePasswordLogin', response.hasDevicePasswordLogin); }) .catch(response => console.error('GetLoginMethods', response)); }, onteardown() { if (this.vaultLockedStatusOff) this.vaultLockedStatusOff(); if (this.vaultDeletedStatusOff) this.vaultDeletedStatusOff(); if (this.offHashChange) this.offHashChange(); if (this.syncStatusChangedOff) this.syncStatusChangedOff(); }, updateRouter() { this.router.emit(window.location.hash); }, updatePage() { this.updateLoginMethods(); NAPI$1.request('app.pam.GetPAMVaultState') .then((response) => { this.set('vaultState', response); console.log('getPAMVaultState', response); }) .catch((response) => { console.error('GetPAMVaultState', response); }); } }); const template$Z = {"v":3,"t":[{"t":7,"e":"header","a":{"id":"nui_titlebar","class":"nui_titlebar nui_caption","style":"border-bottom: 0px;"},"f":[{"t":7,"e":"h1","a":{"class":"nui_logo"},"f":[{"t":7,"e":"span","a":{"class":"logo -white -width-70"}}]}," ",{"t":7,"e":"div","a":{"class":"nui_controls"},"f":[{"t":7,"e":"button","v":{"click":"closeDlg"},"a":{"class":"nui_controls__item -close -win nui_caption_client","title":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.close\")"}}]},"f":[{"t":7,"e":"Icon","a":{"name":"titlebar-close"}}]}]}]}," ",{"t":7,"e":"div","a":{"style":"padding-top:44px; visibility: hidden"}}," ",{"t":7,"e":"Unlock"}]}; /** * Password Manager - list of passwords and securenotes **/ const unlockView = Ractive.extend({ template : template$Z, components: { Unlock }, data: () => { return { windowWidth: 400, windowHeight: 355 }; }, oninit() { NAPI$1.on('app.pam.onStatusChanged.vaultLocked', (lockStatus) => { console.log('onStatusChanged.vaultLocked', lockStatus); if (!lockStatus) { NAPI$1.MainWindow.close(); } }); this.on('Unlock.success', () => { NAPI$1.MainWindow.close(); }); this.on('Unlock.airbondIntro', () => { NAPI$1.MainWindow.close(); }); this.on('Unlock.airbondSetup', () => { NAPI$1.MainWindow.close(); }); this.on('closeDlg', this.closeDialog.bind(this, { keyCode: 27 })); window.addEventListener('keyup', this.closeDialog); }, onteardown() { window.removeEventListener('keyup', this.closeDialog); }, closeDialog(event) { if (event.keyCode == 27) { NAPI$1.track.event('Passwords-Unlock', 'Cancel', 'Dismiss'); NAPI$1.MainWindow.close(); } } }); const template$_ = {"v":3,"t":[{"t":7,"e":"Toaster","a":{"loading":[{"t":2,"r":"loading"}],"icon":["icon-s-programs-",{"t":2,"r":"browser"}],"iconSize":"64","theme":0,"skin":"white","customContent":0,"autoResize":"true","windowHeight":[{"t":2,"r":"windowHeight"}],"title":[{"t":3,"x":{"r":["nls","browser"],"s":"_0(\"passwords.extensionActivationToaster.caption.\"+_1)"}}],"text":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.extensionActivationToaster.description\")"}}]},"f":[{"t":7,"e":"div","a":{"class":"toaster__content"},"f":[{"t":7,"e":"button","a":{"class":"btn toaster__btn -block","type":"button"},"v":{"click":"activateExtension"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.extensionActivationToaster.activateButton\")"}}]}," ",{"t":4,"f":[{"t":7,"e":"button","a":{"class":"a g-margin-top--5 span -small -secondary"},"v":{"click":"disableToaster"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.extensionActivationToaster.disable\")"}}]}],"n":50,"x":{"r":["displayCount"],"s":"_0>0"}},{"t":4,"n":51,"f":[{"t":7,"e":"br"}],"x":{"r":["displayCount"],"s":"_0>0"}}]}]}]}; /** * Password Manager - list of passwords and securenotes **/ const extensionActivationToasterView = Ractive.extend({ template : template$_, data: () => { return { browser: 'chrome', browserPath: null, displayCount: '0', windowWidth: 360 }; }, asyncLoad : true, oninit() { var options = this.parseOptions(); this.on('Toaster.close', function() { NAPI$1.MainWindow.close(); }); for (var key in options) { this.set(key, options[key]); } this.on('activateExtension', () => { NAPI$1.request('av.command', 'install_pam_plugin(' + 'browser=' + this.get('browser') + (this.get('browserPath') ? (',path=' + this.get('browserPath')) : '') + ',cn=App%20extension%20install,cs=Toaster' + ')') .catch(ex => console.error('install_pam_plugin', ex)); NAPI$1.track.event('Passwords-Setup', 'Install button', this.get('browser')); NAPI$1.MainWindow.close(); }); this.on('disableToaster', () => { NAPI$1.request('app.pam.SetFlagDisablingActivationExtensionToaster', {browser: this.get('browser'), flag: true}) .catch(ex => { console.error('app.pam.SetFlagDisablingActivationExtensionToaster', ex); }); NAPI$1.track.event('Passwords-Setup', 'Dont show again button', this.get('browser')); NAPI$1.MainWindow.close(); }); if (this.get('browser')) { this.set('loading', false); this.ready(); } else { console.error('browser not loaded'); } }, parseOptions() { var IGNORE_KEYS = ['module', 'view']; if (!window.location.search) { return {}; } var optList = window.location.search.substr(1).split('&'); var opts = {}; optList.forEach(opt => { var pair = opt.split('='); if (IGNORE_KEYS.indexOf(pair[0]) != -1) { return; } opts[pair[0]] = pair.length > 1 ? pair[1] : null; }); return this.validateOptions(opts); }, validateOptions(opts) { var browserVal = ['chrome', 'firefox']; if (!opts.browser || browserVal.indexOf(opts.browser) == -1) { opts.browser = browserVal[0]; } if (typeof opts.displayCount === 'undefined') { opts.displayCount = 1; } return opts; } }); const template$$ = {"v":3,"t":[{"t":7,"e":"div","a":{"class":"nui_page__scroll -actions nui_page__step"},"t1":{"n":"animatecss","a":"fadeIn"},"f":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_flex pam_-check"},"f":[{"t":7,"e":"h2","a":{"class":"h2 -margins g-align--center"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"smartscan.scanPasswords.title\")"}}]}," ",{"t":7,"e":"Screen","f":[{"t":7,"e":"div","a":{"class":"pam_issues"},"f":[{"t":7,"e":"div","a":{"class":"pam_issues__key pam_flex_center"},"f":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"pam_issues__number pam_flex_center"},"f":[{"t":2,"r":"numberOfPasswordsWarning"}]}],"n":50,"r":"numberOfPasswordsWarning"}," ",{"t":7,"e":"svg","a":{"width":"35","height":"34","viewBox":"0 0 35 34","version":"1.1"},"f":[{"t":7,"e":"g","a":{"style":"fill-rule:evenodd;fill:none"},"f":[{"t":7,"e":"g","a":{"fill":"#FFF"},"f":[{"t":7,"e":"path","a":{"d":"M34 33.3C33.8 33.5 33.6 33.6 33.3 33.6L27.9 33.6 27.4 33.1 27.4 29.4 23.7 29.4 23.2 28.9 23.2 25.2 19.5 25.2 19 24.7 16.9 22.6 16.6 22.2C15.2 22.8 13.7 23.1 12.2 23.1 5.8 23.1 0.7 17.9 0.7 11.5 0.7 5.2 5.8 0 12.2 0 18.6 0 23.7 5.2 23.7 11.5 23.7 12.8 23.5 14.1 23.1 15.3L22.8 15.8 34.2 27.3C34.2 27.3 34.2 31.4 34.2 32.7 34.2 32.9 34.1 33.1 34 33.3 34 33.3 34 33.3 34 33.3L34 33.3ZM8 4.2C9.7 4.2 11.1 5.6 11.1 7.3 11.1 9.1 9.7 10.5 8 10.5 6.3 10.5 4.8 9.1 4.8 7.3 4.8 5.6 6.3 4.2 8 4.2L8 4.2Z"}}]}]}]}]}," ",{"t":3,"x":{"r":["nls","numberOfVulnerablePasswords"],"s":"_0(\"smartscan.scanPasswords.message\",_1)"}}]}," ",{"t":7,"e":"div","a":{"class":"p pam_issues__promo"},"f":[{"t":4,"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"smartscan.scanPasswords.withSetup.description\")"}}],"n":50,"r":"hasPasswordsSetup"},{"t":4,"n":51,"f":[{"t":7,"e":"h3","f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"smartscan.scanPasswords.noSetup.title\")"}}]}," ",{"t":3,"x":{"r":["nls"],"s":"_0(\"smartscan.scanPasswords.noSetup.description\")"}}],"r":"hasPasswordsSetup"}]}]}]}],"n":50,"x":{"r":["page"],"s":"_0===\"Result\""}},{"t":4,"n":51,"f":[{"t":7,"e":"div","a":{"class":"pam_smartscan pam_flex"},"f":[{"t":4,"f":[{"t":7,"e":"h2","a":{"class":"h2"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.setupTitle\",1,2)"}}]}," ",{"t":7,"e":"InstallBrowsersExtensions","a":{"smartscan":"true"}}],"n":50,"x":{"r":["page"],"s":"_0===\"InstallBrowsersExtensions\""}}," ",{"t":4,"f":[{"t":7,"e":"h2","a":{"class":"h2"},"f":[{"t":3,"x":{"r":["nls","skipExtension"],"s":"_0(\"passwords.setupTitle\",2-_1,2-_1)"}}]}," ",{"t":7,"e":"ImportBrowsersPasswords","a":{"allowSkip":"false"}}],"n":50,"x":{"r":["page"],"s":"_0===\"ImportBrowsersPasswords\""}}," ",{"t":4,"f":[{"t":7,"e":"h2","a":{"class":"h2"},"f":[{"t":3,"x":{"r":["nls","skipExtension"],"s":"_0(\"passwords.setupTitle\",2-_1,2-_1)"}}]}," ",{"t":7,"e":"h3","a":{"class":"h2 pam_title"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.onboardingFinish.desc\")"}}]}," ",{"t":7,"e":"div","a":{"class":"pam_navigation_hint"},"f":[{"t":7,"e":"div","a":{"class":"pam_navigation_hint__item"},"f":[{"t":7,"e":"i","a":{"class":"logo -ameba","style":"height: 64px; width: 64px"}}," ",{"t":3,"x":{"r":["nls"],"s":"_0(\"global.av\")"}}]}," ",{"t":7,"e":"Icon","a":{"name":"arrow-more","cssCls":"pam_navigation__arrow"}}," ",{"t":7,"e":"div","a":{"class":"pam_navigation_hint__item"},"f":[{"t":7,"e":"i","a":{"class":"icon -privacy nui_menu__icon_circle color-brand-lila -bg"}}," ",{"t":3,"x":{"r":["nls"],"s":"_0(\"privacy\")"}}]}," ",{"t":7,"e":"Icon","a":{"name":"arrow-more","cssCls":"pam_navigation__arrow"}}," ",{"t":7,"e":"div","a":{"class":"pam_navigation_hint__item"},"f":[{"t":7,"e":"i","a":{"class":"icon -passwords nui_menu__icon_circle color-brand-lila -bg"}}," ",{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords\")"}}]}]}," ",{"t":7,"e":"div","a":{"class":"pam_importedpasswords color-ok -text"},"f":[{"t":3,"x":{"r":["nls","numImportedPasswords"],"s":"_0(\"passwords.onboardingFinish.importedPasswords\",_1)"}}]}],"n":50,"x":{"r":["page"],"s":"_0===\"Finish\""}}]}],"x":{"r":["page"],"s":"_0===\"Result\""}}]}," ",{"t":4,"f":[{"t":7,"e":"div","a":{"class":"nui_actions color-white -bg"},"f":[{"t":4,"f":[{"t":4,"f":[{"t":7,"e":"ApiButton","v":{"domClick":"movePasswords"},"a":{"cssCls":"-large g-margin-right--10"},"m":[{"t":4,"f":["disabled"],"n":50,"x":{"r":["numberOfVulnerablePasswords"],"s":"!_0"}}],"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"smartscan.scanPasswords.withSetup.resolve\")"}}]}],"n":50,"r":"hasPasswordsSetup"},{"t":4,"n":51,"f":[{"t":7,"e":"ApiButton","a":{"cssCls":"-large g-margin-right--10"},"v":{"domClick":"setupPasswords"},"m":[{"t":4,"f":["disabled"],"n":50,"x":{"r":["numberOfVulnerablePasswords"],"s":"!_0"}}],"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"smartscan.scanPasswords.noSetup.resolve\")"}}]}],"r":"hasPasswordsSetup"}," ",{"t":7,"e":"button","v":{"click":"skip"},"a":{"class":"btn -large -secondary"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.skipThisStep\")"}}]}],"n":50,"x":{"r":["page"],"s":"_0===\"Result\""}}," ",{"t":4,"f":[{"t":7,"e":"button","a":{"class":"btn -large","type":"button"},"v":{"click":"done"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.continue\")"}}]}],"n":50,"x":{"r":["page"],"s":"_0===\"Finish\""}}]}],"n":50,"x":{"r":["page"],"s":"_0===\"Result\"||_0===\"Finish\""}}]}; var module = "PrivacyPasswords"; /** * Smartscan - Password security check **/ const SmartScanView = Ractive.extend({ template: template$$, css : css_248z, data: () => { return { page: 'Result', hasPasswordsSetup: null, numberOfVulnerablePasswords: null, numberOfPasswordsWarning: null, skipExtension: 0 }; }, components: { ApiButton, InstallBrowsersExtensions, ImportBrowsersPasswords }, oninit() { this.updatePasswordsSetupStatus(); this.updateNumberOfVulnerablePasswords(); this.showPageAfterGettingData(); NAPI$1.track.view('SmartScan/Resolve/' + module + '/Intro'); NAPI$1.request('app.smartScan.SendBurgerEvent', {event: '1.1.15.10'}); track.onboarding.smartscan.viewIntro(); this.on('setupPasswords', () => { return NAPI$1.request('app.pam.CreateVaultWithSystemLogin') .then(() => this.maybeInstallBrowserExtensionsPage()) .catch(response => console.error('app.pam.CreateVaultWithSystemLogin', response)); }); this.on('InstallBrowsersExtensions.done', () => { this.fire('movePasswords'); }); this.on('movePasswords', () => { this.set('page', 'ImportBrowsersPasswords'); NAPI$1.track.view('SmartScan/Resolve/' + module + '/ImportBrowsersPasswords'); }); this.on('ImportBrowsersPasswords.done', (numImportedPasswords) => { this.set('numImportedPasswords', numImportedPasswords); this.set('page', 'Finish'); NAPI$1.track.view('SmartScan/Resolve/' + module + '/Finish'); }); this.on('done', () => { this.emit('next', 'done'); }); this.on('skip', () => { console.log('skipped'); this.emit('next', ''); }); }, maybeInstallBrowserExtensionsPage() { fetchFeatureFlag('SmartScanOnboardingSkipExtensionFeature') .then(isEnabled => { if (!isEnabled) { this.set('page', 'InstallBrowsersExtensions'); NAPI$1.track.view('SmartScan/Resolve/' + module + '/InstallBrowsersExtensions'); return; } this.set('skipExtension', 1); this.fire('movePasswords'); return; }); }, showPageAfterGettingData() { this.observe('hasPasswordsSetup numberOfVulnerablePasswords', () => { var numberOfPasswords = this.get('numberOfVulnerablePasswords'); if (numberOfPasswords !== null) { this.set('numberOfPasswordsWarning', numberOfPasswords < 100 ? numberOfPasswords : '99+'); } if (this.get('hasPasswordsSetup') !== null && numberOfPasswords !== null){ this.screenReady(); } }, {init: false}); }, updatePasswordsSetupStatus() { return NAPI$1.request('app.pam.GetPAMVaultState') .then(response => { if (response === CONST.VAULTSTATES.UNKNOWN || response === CONST.VAULTSTATES.NO_VAULT) { this.set('hasPasswordsSetup', false); } else { this.set('hasPasswordsSetup', true); } }) .catch(response => { console.error('GetPAMVaultState', response); }); }, updateNumberOfVulnerablePasswords() { return NAPI$1.request('app.pam.GetBrowserPasswordCount') .then(response => { this.set('numberOfVulnerablePasswords', response.browserPasswordCount); }) .catch(response => { console.error('app.pam.GetBrowserPasswordCount', response); }); } }); var css_248z$v = ".toaster-content {\n padding: 0 20px;\n}\n.toaster-content .password-changed-cont {\n flex-direction: column;\n display: flex;\n justify-content: center;\n height: 200px;\n}\n.toaster-content .guardian-icon-cont {\n height: 50px;\n width: 50px;\n margin: 0 auto 15px;\n position: relative;\n}\n.toaster-content .guardian-icon-cont .guardian-icon {\n font-size: 50px;\n position: absolute;\n top: 0;\n right: 0;\n}\n.toaster-content .pam_steps {\n display: flex;\n list-style: none;\n margin: 0 10px 0 30px;\n counter-reset: li;\n flex-direction: column;\n justify-content: space-around;\n height: 150px;\n}\n.toaster-content .pam_steps .pam_step_space {\n flex-grow: 1;\n}\n.toaster-content .pam_steps .pam_step {\n text-align: left;\n padding: 6px 0 5px 10px;\n position: relative;\n flex-grow: 1;\n font-size: 13px;\n}\n.toaster-content .pam_steps .pam_step:before {\n content: counter(li);\n counter-increment: li;\n position: absolute;\n left: -28px;\n top: 3px;\n background-color: rgba(0,0,0,0.2);\n width: 25px;\n height: 25px;\n border-radius: 30px;\n padding-top: 4px;\n text-align: center;\n font-size: 13px;\n z-index: -1;\n}\n"; const template$10 = {"v":3,"t":[{"t":7,"e":"Toaster","a":{"windowHeight":[{"t":2,"r":"windowHeight"}],"windowWidth":[{"t":2,"r":"windowWidth"}],"customContent":"true"},"f":[{"t":7,"e":"div","a":{"class":"toaster-content"},"f":[{"t":4,"f":[{"t":7,"e":"div","a":{"class":"password-changed-cont"},"f":[{"t":7,"e":"div","f":[{"t":7,"e":"kin-icon","a":{"name":"circle-ok","size":"64"}}," ",{"t":7,"e":"div","a":{"class":"g-margin-top--20 g-margin-bottom--30 small -text"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.guardianToaster.passwordChanged\")"}}]}," ",{"t":7,"e":"button","a":{"class":"btn -small"},"v":{"click":"confirmToaster"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"global.ok\")"}}]}]}]}],"n":50,"x":{"r":["page"],"s":"_0===\"passwordChanged\""}},{"t":4,"n":51,"f":[{"t":4,"n":50,"x":{"r":["page"],"s":"_0===\"passwordSteps\""},"f":[{"t":7,"e":"div","a":{"class":"guardian-icon-cont"},"f":[{"t":7,"e":"kin-icon","a":{"name":"icon-m-guardian-full","size":"48","class":"guardian guardian-icon"}}]}," ",{"t":7,"e":"div","a":{"class":"g-font--bold g-font--bold -small text"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.guardianToaster.title\")"}}]}," ",{"t":7,"e":"div","a":{"class":"pam_steps"},"f":[{"t":7,"e":"div","a":{"class":"pam_step_space"}}," ",{"t":7,"e":"div","a":{"class":"pam_step"},"f":[{"t":3,"x":{"r":["nls","serviceName"],"s":"_0(\"passwords.passwordGuardian.guardianToaster.step1\",_1)"}}]}," ",{"t":7,"e":"div","a":{"class":"pam_step_space"}}," ",{"t":7,"e":"div","a":{"class":"pam_step"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.guardianToaster.step2\")"}}]}," ",{"t":7,"e":"div","a":{"class":"pam_step_space"}}," ",{"t":7,"e":"div","a":{"class":"pam_step"},"f":[{"t":3,"x":{"r":["nls"],"s":"_0(\"passwords.passwordGuardian.guardianToaster.step3\")"}}]}," ",{"t":7,"e":"div","a":{"class":"pam_step_space"}}]}]}],"x":{"r":["page"],"s":"_0===\"passwordChanged\""}}]}]}]}; const CLOSE_DIALOG_TIMEOUT = 5000; const guardianToaster = Ractive.extend({ // notifying the service manually when loaded (this.ready) asyncLoad: true, template: template$10, css: css_248z$v, data: function() { return { page: 'passwordSteps', windowWidth: 380, windowHeight: 300, windowPlacement: 'right_bottom', serviceName: undefined, isStandalonePamAllowed: false }; }, oninit: function() { this.set('serviceName', this.get('params').serviceName); const passwordId = parseInt(this.get('params').id); this.set('passwordId', passwordId); this.listeners = []; this.listeners.push(NAPI$1.on('app.pam.onPasswordChanged', (props) => { if (passwordId === props.id) { this._removeListeners(); this._setPage('passwordChanged'); } })); this.on('Toaster.close', () => NAPI$1.MainWindow.close()); this.on('confirmToaster', () => this._openPasswords()); ConfigDef.isStandalonePamAllowed().then(isStandalonePamAllowed => { this.set('isStandalonePamAllowed', isStandalonePamAllowed); // async to have everything really ready setTimeout(this.ready.bind(this), 0); }); }, _setPage(page) { switch (page) { case 'passwordChanged': this.set('page', 'passwordChanged'); NAPI$1.track.event('Toaster', 'PasswordChanged', ''); if (!this.closeDialogTimeout) { this.closeDialogTimeout = setTimeout(() => { this._clearCloseDialogTimeout(); NAPI$1.MainWindow.close(); }, CLOSE_DIALOG_TIMEOUT); } break; case 'passwordSteps': this.set('page', 'passwordSteps'); break; } }, _openPasswords() { const passwordId = this.get('passwordId') || ''; if (this.get('isStandalonePamAllowed')) { NAPI$1.request('app.windowManager.ShowWindow', { url: 'https://local.avast.com/MainWindow.html?module=PrivacyPasswords#PrivacyPasswords/passwordGuardian/' + passwordId, id: 'pam', type: 'CEF', width: 1010, height: 674, setAsForegroundWnd: true, title: 'Avast Password Manager', iconSmall: 215, iconBig: 215, appUserModelRelaunchIcon: 215, appUserModelID: 'avast.pam' }); } else { NAPI$1.request('app.windowManager.ShowMainWindow', { route: 'PrivacyPasswords/passwordGuardian/' + passwordId }); NAPI$1.MainWindow.close(); } }, _removeListeners() { this.listeners.forEach((off) => { off(); }); }, onteardown() { this._removeListeners(); this._clearCloseDialogTimeout(); }, _clearCloseDialogTimeout() { if (this.closeDialogTimeout) { clearTimeout(this.closeDialogTimeout); this.closeDialogTimeout = null; } } }); var css_248z$w = ".guardian-icon {\n font-size: 50px !important;\n margin-top: 4px !important;\n}\nbutton.btn {\n margin-bottom: 30px !important;\n}\n"; const leakedDialog = Ractive.components.DetectionDialog.extend({ asyncLoad: true, css: css_248z$w, windowClose: function() { NAPI$1.MainWindow.close(); }, oninit: function() { this._super(); this._data = {}; this.set('config', this.getConfig()); ConfigDef.isStandalonePamAllowed().then(isStandalonePamAllowed => { this.set('isStandalonePamAllowed', isStandalonePamAllowed); // async to have everything really ready setTimeout(this.ready.bind(this), 0); }); }, getConfig() { const serviceName = this.get('params').serviceName; const leakCount = parseInt(this.get('params').leakCount); const title = Ractive.localization.nls('passwords.passwordGuardian.leakedDialog.title', leakCount); const text = leakCount > 1 ? Ractive.localization.nls('passwords.passwordGuardian.leakedDialog.desc2') : Ractive.localization.nls('passwords.passwordGuardian.leakedDialog.desc1', serviceName); const config = { color: 'red', icon: { name: 'icon-m-guardian-full', cssCls: 'guardian-icon' }, title: title, text: text, actions: [{ label: Ractive.localization.nls('global.showDetails'), action: this.doUserAction.bind(this) }], details: this.getDetails() }; return config; }, getDetails() { return []; }, doUserAction() { const passwordId = parseInt(this.get('params').id) || ''; if (this.get('isStandalonePamAllowed')) { NAPI$1.request('app.windowManager.ShowWindow', { url: 'https://local.avast.com/MainWindow.html?module=PrivacyPasswords#PrivacyPasswords/passwordGuardian/' + passwordId, id: 'pam', type: 'CEF', width: 1010, height: 674, setAsForegroundWnd: true, title: 'Avast Password Manager', iconSmall: 215, iconBig: 215, appUserModelRelaunchIcon: 215, appUserModelID: 'avast.pam' }); } else { NAPI$1.request('app.windowManager.ShowMainWindow', { route: 'PrivacyPasswords/passwordGuardian/' + passwordId }); NAPI$1.MainWindow.close(); } }, }); const unlock = unlockView; const extensionActivationToaster = extensionActivationToasterView; const activateToaster = extensionActivationToasterView; // backwards compatibility (remove) const SmartScan = SmartScanView; const GuardianToaster = guardianToaster; const LeakedDialog = leakedDialog; export default app; export { GuardianToaster, LeakedDialog, SmartScan, activateToaster, extensionActivationToaster, unlock }; const __nitro_metadata = {"name":"PrivacyPasswords","version":"1.2.319","created":"2020-10-07T08:16:16.993Z"}; export {__nitro_metadata as metadata};