Files

495 lines
2.8 MiB
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
!function(){var e,t,i,n,r,s,o,a,l={3095:function(e,t,i){i(7607),i(45506)},7607:function(e,t,i){"use strict";i.r(t)},25156:function(){},45506:function(e,t,i){"use strict";i.r(t)},49701:function(){},80369:function(e,t,i){"use strict";var n={};i.r(n),i.d(n,{Lq:function(){return Wm},Mt:function(){return qm},sF:function(){return jm},Zx:function(){return tg},f3:function(){return lm},zT:function(){return ng},QS:function(){return sg}});var r={};i.r(r),i.d(r,{B:function(){return By},KQ:function(){return _y},ji:function(){return Ry},jK:function(){return Uy},gb:function(){return Ny},Vm:function(){return Gy}});var s=i(38450),o=i(94573),a=i(74208),l=i(3204);class c{}class u{}class d{}class h{}class p{}function v(e){return t=>null==t?null:t.map(t=>e(t))}function f(e){return t=>{if(null==t)return null;const i={};return Object.entries(t).forEach(([t,n])=>{i[t]=e(n)}),i}}class m{constructor(e,t,i){var n;if(this.stateDefinition=e,this.key=t,this.options=i,null==i.deserializer)throw new Error(`'deserializer' is a required property on key ${this.errorKeyName}`);if(i.cleanupDelayMs<0)throw new Error(`'cleanupDelayMs' must be greater than or equal to 0. Value of ${i.cleanupDelayMs} passed to key ${this.errorKeyName} `);const{enableUpdateLogging:r=!1,enableRetrievalLogging:s=!1}=null!==(n=i.debug)&&void 0!==n?n:{};this.debug={enableUpdateLogging:r,enableRetrievalLogging:s}}get deserializer(){return this.options.deserializer}get cleanupDelayMs(){var e;return this.options.cleanupDelayMs<0?0:null!==(e=this.options.cleanupDelayMs)&&void 0!==e?e:1e3}static array(e,t,i){return new m(e,t,Object.assign(Object.assign({},i),{deserializer:v(e=>i.deserializer(e))}))}static record(e,t,i){return new m(e,t,Object.assign(Object.assign({},i),{deserializer:f(e=>i.deserializer(e))}))}get fullName(){return`${this.stateDefinition.name}_${this.key}`}get errorKeyName(){return`${this.stateDefinition.name} > ${this.key}`}}const g=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function y(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function b(e){return g.test(e)}var w;const S=Symbol("UserKeyDefinition");class k{constructor(e,t,i){var n;if(this.stateDefinition=e,this.key=t,this.options=i,this[w]=!0,null==i.deserializer)throw new Error(`'deserializer' is a required property on key ${this.errorKeyName}`);if(i.cleanupDelayMs<0)throw new Error(`'cleanupDelayMs' must be greater than or equal to 0. Value of ${i.cleanupDelayMs} passed to key ${this.errorKeyName} `);this.clearOn=Array.from(new Set(i.clearOn));const{enableUpdateLogging:r=!1,enableRetrievalLogging:s=!1}=null!==(n=i.debug)&&void 0!==n?n:{};this.debug={enableUpdateLogging:r,enableRetrievalLogging:s}}get deserializer(){return this.options.deserializer}get cleanupDelayMs(){var e;return this.options.cleanupDelayMs<0?0:null!==(e=this.options.cleanupDelayMs)&&void 0!==e?e:1e3}static array(e,t,i){return new k(e,t,Object.assign(Object.assign({},i),{deserializer:v(e=>i.deserializer(e))}))}static record(e,t,i){return new k(e,t,Object.assign(Object.assign({},i),{deserializer:f(e=>i.deserializer(e))}))}get fullName(){return`${this.stateDefinition.name}_${this.key}`}buildKey(e){if(!b(e))throw new Error(`You cannot build a user key without a valid UserId, building for key ${this.fullName}`);return`user_${e}_${this.stateDefinition.name}_${this.key}`}get errorKeyName(){return`${this.stateDefinition.name} > ${this.key}`}}w=S;class I{}Symbol("active");class C{constructor(e,t,i){this.name=e,this.defaultStorageLocation=t,this.storageLocationOverrides=null!=i?i:{}}}const T=new C("organizations","disk"),P=new C("policies","disk"),F=new C("providers","disk"),R=new C("organizationManagementPreferences","disk",{web:"disk-local"}),x=(new C("showDeleteManagedUserWarning","disk",{web:"disk-local"}),new C("autoConfirm","disk",{web:"disk-local"})),A=new C("billing","disk"),D=(new C("billing","memory"),new C("account","disk")),E=(new C("account","memory"),new C("authRequestLocal","disk",{web:"disk-local"})),$=new C("avatar","disk",{web:"disk-local"}),O=new C("deviceTrust","disk",{web:"disk-local",browser:"disk-backup-local-storage"}),U=new C("loginEmail","disk",{web:"disk-local"}),M=new C("loginEmail","memory"),N=new C("loginStrategy","memory"),V=new C("masterPassword","disk"),B=new C("masterPassword","memory"),j=new C("masterPasswordUnlock","disk"),G=(new C("router","disk"),new C("ssoLogin","disk")),L=new C("ssoLoginLocal","disk",{web:"disk-local"}),z=new C("token","disk"),_=new C("tokenDiskLocal","disk",{web:"disk-local"}),K=new C("token","memory"),X=new C("sendAccess","disk"),q=new C("twoFactor","memory"),W=new C("userDecryptionOptions","disk"),Y=(new C("organizationInvite","disk"),new C("vaultTimeoutSettings","disk",{web:"disk-local"})),H=new C("badgeSettings","disk"),J=new C("userNotificationSettings","disk"),Z=new C("domainSettings","disk"),Q=new C("autofillSettings","disk"),ee=new C("autofillSettingsLocal","disk",{web:"disk-local"}),te=(new C("autotypeSettings","disk"),new C("newWebLayoutBanner","disk",{web:"disk-local"}),new C("bitSideNav","disk"),new C("phishingDetection","disk")),ie=(new C("applicationId","disk",{web:"disk-local"}),new C("clearEvent","disk")),ne=new C("config","disk",{web:"disk-local"}),re=(new C("desktopSettings","disk"),new C("environment","disk")),se=new C("environment","memory"),oe=new C("interProcessCommunication","memory"),ae=new C("popupView","memory",{browser:"memory-large-object"}),le=new C("sync","disk",{web:"memory"}),ce=new C("theming","disk",{web:"disk-local"}),ue=new C("translation","disk",{web:"disk-local"}),de=new C("animation","disk"),he=new C("taskScheduler","disk"),pe=(new C("extensionInitialInstall","disk"),new C("webPushSubscription","disk",{web:"disk-local"})),ve=new C("popupStyle","disk"),fe=(new C("smOnboarding","disk",{web:"disk-local"}),new C("extension","disk")),me=new C("generator","disk"),ge=new C("generator","memory"),ye=(new C("sendBrowser","memory"),new C("eventCollection","disk")),be=new C("encryptedSend","disk",{web:"memory"}),we=new C("decryptedSend","memory",{browser:"memory-large-object"}),Se=(new C("sendAccessAuth","memory"),new C("collection","disk",{web:"memory"})),ke=new C("decryptedCollections","memory",{browser:"memory-large-object"}),Ie=new C("folder","disk",{web:"memory"}),Ce=new C("decryptedFolders","memory",{browser:"memory-large-object"}),Te=new C("vaultFilter","disk",{web:"disk-local"}),Pe=(new C("vaultOnboarding","disk",{web:"disk-local"}),new C("vaultSettings","disk",{web:"disk-local"})),Fe=(new C("vaultBrowser","memory",{browser:"memory-large-object"}),new C("vaultSearch","memory",{browser:"memory-large-object"})),Re=new C("ciphers","disk",{web:"memory"}),xe=new C("ciphersLocal","disk",{web:"disk-local"}),Ae=new C("ciphersMemory","memory",{browser:"memory-large-object"}),De=(new C("bannersDismissed","disk"),new C("vaultAppearance","disk")),Ee=new C("securityTasks","disk"),$e=new C("atRiskPasswordsPage","disk"),Oe=new C("notifications","disk"),Ue=new C("nudges","disk",{web:"disk-local"}),Me=(new C("setupExtensionDismissed","disk",{web:"disk-local"}),new C("vaultWelcomeDialog","disk",{web:"disk-local"}),new C("vaultBrowserIntroCarousel","disk")),Ne=new C("vaultAtRiskPasswords","memory"),Ve=(new C("vaultWelcomeExtensionDialogDismissed","disk",{web:"disk-local"}),new C("biometricSettings","disk")),Be=new C("encryptedMigration","disk"),je=new C("pinUnlock","disk"),Ge=new C("pinUnlock","memory"),Le=new C("crypto","disk"),ze=new C("crypto","memory"),_e=new C("kdfConfig","disk"),Ke=new C("keyConnector","disk");class Xe{}var qe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class We{static create(){return new We([])}constructor(e){this.migrations=e}with(...e){return this.addMigrator(e,"up")}rollback(...e){return 3===e.length&&(e=[e[0],e[2],e[1]]),this.addMigrator(e,"down")}migrate(e){return this.migrations.reduce((t,i)=>t.then(()=>qe(this,void 0,void 0,function*(){yield this.runMigrator(i.migrator,e,i.direction)})),Promise.resolve())}addMigrator(e,t="up"){const i=1===e.length?{migrator:new e[0],direction:t}:{migrator:new e[0](e[1],e[2]),direction:t};return new We([...this.migrations,i])}runMigrator(e,t,i){return qe(this,void 0,void 0,function*(){const n=yield e.shouldMigrate(t,i);if(t.info(`Migrator ${e.constructor.name} (to version ${e.toVersion}) should migrate: ${n} - ${i}`),n){const n="up"===i?e.migrate:e.rollback;yield n.bind(e)(t),t.info(`Migrator ${e.constructor.name} (to version ${e.toVersion}) migrated - ${i}`),yield e.updateVersion(t,i),t.info(`Migrator ${e.constructor.name} (to version ${e.toVersion}) updated version - ${i}`)}})}}var Ye=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const He=new Error("Irreversible migration");class Je{constructor(e,t){if(this.fromVersion=e,this.toVersion=t,null==e||null==t)throw new Error("Invalid migration");if(e>t)throw new Error("Invalid migration")}shouldMigrate(e,t){const i="up"===t?this.fromVersion:this.toVersion;return Promise.resolve(e.currentVersion===i)}updateVersion(e,t){return Ye(this,void 0,void 0,function*(){const i="up"===t?this.toVersion:this.fromVersion;e.currentVersion=i,yield e.set("stateVersion",i)})}}var Ze=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Qe={key:"everHadUserKey",stateDefinition:{name:"crypto"}};class et extends Je{migrate(e){return Ze(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Ze(this,void 0,void 0,function*(){var n;const r=null===(n=null==i?void 0:i.profile)||void 0===n?void 0:n.everHadUserKey;yield e.setToUser(t,Qe,null!=r&&r),null!=r&&delete i.profile.everHadUserKey,yield e.set(t,i)})}(t,i))])})}rollback(e){return Ze(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Ze(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,Qe);i&&(i.profile=Object.assign(null!==(n=i.profile)&&void 0!==n?n:{},{everHadUserKey:r}),yield e.set(t,i)),yield e.setToUser(t,Qe,null)})}(t,i))])})}}var tt=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const it={key:"organizationKeys",stateDefinition:{name:"crypto"}};class nt extends Je{migrate(e){return tt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return tt(this,void 0,void 0,function*(){var n,r;const s=null===(r=null===(n=null==i?void 0:i.keys)||void 0===n?void 0:n.organizationKeys)||void 0===r?void 0:r.encrypted;null!=s&&(yield e.setToUser(t,it,s),delete i.keys.organizationKeys,yield e.set(t,i))})}(t,i))])})}rollback(e){return tt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return tt(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,it);i&&r&&(i.keys=Object.assign(null!==(n=i.keys)&&void 0!==n?n:{},{organizationKeys:{encrypted:r}}),yield e.set(t,i)),yield e.setToUser(t,it,null)})}(t,i))])})}}var rt=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const st={name:"environment"},ot={key:"region",stateDefinition:st},at={key:"urls",stateDefinition:st};class lt extends Je{migrate(e){return rt(this,void 0,void 0,function*(){const t=yield e.get("global");null!=(null==t?void 0:t.region)&&(yield e.setToGlobal(ot,t.region)),null!=(null==t?void 0:t.environmentUrls)&&(yield e.setToGlobal(at,t.environmentUrls));const i=yield e.getAccounts();yield Promise.all(i.map(t=>rt(this,[t],void 0,function*({userId:t,account:i}){var n,r,s,o;null!=(null===(n=null==i?void 0:i.settings)||void 0===n?void 0:n.region)&&(yield e.setToUser(t,ot,i.settings.region)),null!=(null===(r=null==i?void 0:i.settings)||void 0===r?void 0:r.environmentUrls)&&(yield e.setToUser(t,at,i.settings.environmentUrls)),null===(s=null==i?void 0:i.settings)||void 0===s||delete s.region,null===(o=null==i?void 0:i.settings)||void 0===o||delete o.environmentUrls,yield e.set(t,i)}))),null==t||delete t.region,null==t||delete t.environmentUrls,yield e.set("global",t)})}rollback(e){return rt(this,void 0,void 0,function*(){let t=yield e.get("global"),i=!1;const n=yield e.getFromGlobal(ot);n&&(t||(t={}),i=!0,t.region=n,yield e.setToGlobal(ot,null));const r=yield e.getFromGlobal(at);r&&(t||(t={}),i=!0,t.environmentUrls=r,yield e.setToGlobal(at,null)),i&&(yield e.set("global",t));const s=yield e.getAccounts();yield Promise.all(s.map(({userId:t,account:i})=>function(t,i){return rt(this,void 0,void 0,function*(){let n=!1;const r=yield e.getFromUser(t,ot);r&&(i||(i={}),i.settings||(i.settings={}),n=!0,i.settings.region=r,yield e.setToUser(t,ot,null));const s=yield e.getFromUser(t,at);s&&(i||(i={}),i.settings||(i.settings={}),n=!0,i.settings.environmentUrls=s,yield e.setToUser(t,at,null)),n&&(yield e.set(t,i))})}(t,i)))})}}var ct=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const ut={key:"providerKeys",stateDefinition:{name:"crypto"}};class dt extends Je{migrate(e){return ct(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return ct(this,void 0,void 0,function*(){var n,r;const s=null===(r=null===(n=null==i?void 0:i.keys)||void 0===n?void 0:n.providerKeys)||void 0===r?void 0:r.encrypted;null!=s&&(yield e.setToUser(t,ut,s),delete i.keys.providerKeys,yield e.set(t,i))})}(t,i))])})}rollback(e){return ct(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return ct(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,ut);i&&r&&(i.keys=Object.assign(null!==(n=i.keys)&&void 0!==n?n:{},{providerKeys:{encrypted:r}}),yield e.set(t,i)),yield e.setToUser(t,ut,null)})}(t,i))])})}}var ht=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const pt={key:"clientKeyHalf",stateDefinition:{name:"biometricSettings"}};class vt extends Je{migrate(e){return ht(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(t=>ht(this,[t],void 0,function*({userId:t,account:i}){var n,r;null!=(null===(n=null==i?void 0:i.keys)||void 0===n?void 0:n.biometricEncryptionClientKeyHalf)&&(yield e.setToUser(t,pt,i.keys.biometricEncryptionClientKeyHalf),null===(r=null==i?void 0:i.keys)||void 0===r||delete r.biometricEncryptionClientKeyHalf,yield e.set(t,i))})))})}rollback(e){return ht(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(({userId:t,account:i})=>function(t,i){return ht(this,void 0,void 0,function*(){var n;let r=!1;const s=yield e.getFromUser(t,pt);s&&(null!=i||(i={}),null!==(n=i.keys)&&void 0!==n||(i.keys={}),r=!0,i.keys.biometricEncryptionClientKeyHalf=s,yield e.setToUser(t,pt,null)),r&&(yield e.set(t,i))})}(t,i)))})}}var ft=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const mt={key:"folders",stateDefinition:{name:"folder"}};class gt extends Je{migrate(e){return ft(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return ft(this,void 0,void 0,function*(){var n,r;const s=null===(r=null===(n=null==i?void 0:i.data)||void 0===n?void 0:n.folders)||void 0===r?void 0:r.encrypted;null!=s&&(yield e.setToUser(t,mt,s),delete i.data.folders,yield e.set(t,i))})}(t,i))])})}rollback(e){return ft(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return ft(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,mt);i&&(i.data=Object.assign(null!==(n=i.data)&&void 0!==n?n:{},{folders:{encrypted:r}}),yield e.set(t,i)),yield e.setToUser(t,mt,null)})}(t,i))])})}}var yt=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const bt={key:"lastSync",stateDefinition:{name:"sync"}};class wt extends Je{migrate(e){return yt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return yt(this,void 0,void 0,function*(){var n;const r=null===(n=null==i?void 0:i.profile)||void 0===n?void 0:n.lastSync;yield e.setToUser(t,bt,null!=r?r:null),null!=r&&(delete i.profile.lastSync,yield e.set(t,i))})}(t,i))])})}rollback(e){return yt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return yt(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,bt);i&&(i.profile=Object.assign(null!==(n=i.profile)&&void 0!==n?n:{},{lastSync:r}),yield e.set(t,i)),yield e.setToUser(t,bt,null)})}(t,i))])})}}var St=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const kt={key:"enablePasskeys",stateDefinition:{name:"vaultSettings"}};class It extends Je{migrate(e){return St(this,void 0,void 0,function*(){const t=yield e.get("global");null!=(null==t?void 0:t.enablePasskeys)&&(yield e.setToGlobal(kt,t.enablePasskeys),null==t||delete t.enablePasskeys,yield e.set("global",t))})}rollback(e){return St(this,void 0,void 0,function*(){let t=yield e.get("global");const i=yield e.getFromGlobal(kt);null!=i&&(t=Object.assign(null!=t?t:{},{enablePasskeys:i}),yield e.set("global",t),yield e.setToGlobal(kt,void 0))})}}var Ct=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Tt={stateDefinition:{name:"autofillSettings"}};class Pt extends Je{migrate(e){return Ct(this,void 0,void 0,function*(){const t=yield e.get("global");null!=(null==t?void 0:t.autoFillOverlayVisibility)&&(yield e.setToGlobal({stateDefinition:{name:"autofillSettingsLocal"},key:"inlineMenuVisibility"},t.autoFillOverlayVisibility),delete t.autoFillOverlayVisibility,yield e.set("global",t));const i=yield e.getAccounts();yield Promise.all([...i.map(({userId:t,account:i})=>function(t,i){return Ct(this,void 0,void 0,function*(){let n=!1;const r=null==i?void 0:i.settings;null!=(null==r?void 0:r.autoFillOnPageLoadDefault)&&(yield e.setToUser(t,Object.assign(Object.assign({},Tt),{key:"autofillOnPageLoadDefault"}),r.autoFillOnPageLoadDefault),delete i.settings.autoFillOnPageLoadDefault,n=!0),null!=(null==r?void 0:r.enableAutoFillOnPageLoad)&&(yield e.setToUser(t,Object.assign(Object.assign({},Tt),{key:"autofillOnPageLoad"}),null==r?void 0:r.enableAutoFillOnPageLoad),delete i.settings.enableAutoFillOnPageLoad,n=!0),null!=(null==r?void 0:r.dismissedAutoFillOnPageLoadCallout)&&(yield e.setToUser(t,Object.assign(Object.assign({},Tt),{key:"autofillOnPageLoadCalloutIsDismissed"}),null==r?void 0:r.dismissedAutoFillOnPageLoadCallout),delete i.settings.dismissedAutoFillOnPageLoadCallout,n=!0),null!=(null==r?void 0:r.disableAutoTotpCopy)&&(yield e.setToUser(t,Object.assign(Object.assign({},Tt),{key:"autoCopyTotp"}),!(null==r?void 0:r.disableAutoTotpCopy)),delete i.settings.disableAutoTotpCopy,n=!0),null!=(null==r?void 0:r.activateAutoFillOnPageLoadFromPolicy)&&(yield e.setToUser(t,{stateDefinition:{name:"autofillSettingsLocal"},key:"activateAutofillOnPageLoadFromPolicy"},null==r?void 0:r.activateAutoFillOnPageLoadFromPolicy),delete i.settings.activateAutoFillOnPageLoadFromPolicy,n=!0),n&&(yield e.set(t,i))})}(t,i))])})}rollback(e){return Ct(this,void 0,void 0,function*(){const t=(yield e.get("global"))||{},i=yield e.getFromGlobal({stateDefinition:{name:"autofillSettingsLocal"},key:"inlineMenuVisibility"});i&&(yield e.set("global",Object.assign(Object.assign({},t),{autoFillOverlayVisibility:i})),yield e.setToGlobal({stateDefinition:{name:"autofillSettingsLocal"},key:"inlineMenuVisibility"},null));const n=yield e.getAccounts();yield Promise.all([...n.map(({userId:t,account:i})=>function(t,i){return Ct(this,void 0,void 0,function*(){let n=!1,r=(null==i?void 0:i.settings)||{};const s=yield e.getFromUser(t,Object.assign(Object.assign({},Tt),{key:"autofillOnPageLoadDefault"})),o=yield e.getFromUser(t,Object.assign(Object.assign({},Tt),{key:"autofillOnPageLoad"})),a=yield e.getFromUser(t,Object.assign(Object.assign({},Tt),{key:"autofillOnPageLoadCalloutIsDismissed"})),l=yield e.getFromUser(t,Object.assign(Object.assign({},Tt),{key:"autoCopyTotp"})),c=yield e.getFromUser(t,{stateDefinition:{name:"autofillSettingsLocal"},key:"activateAutofillOnPageLoadFromPolicy"});null!=s&&(r=Object.assign(Object.assign({},r),{autoFillOnPageLoadDefault:s}),yield e.setToUser(t,Object.assign(Object.assign({},Tt),{key:"autofillOnPageLoadDefault"}),null),n=!0),null!=o&&(r=Object.assign(Object.assign({},r),{enableAutoFillOnPageLoad:o}),yield e.setToUser(t,Object.assign(Object.assign({},Tt),{key:"autofillOnPageLoad"}),null),n=!0),null!=a&&(r=Object.assign(Object.assign({},r),{dismissedAutoFillOnPageLoadCallout:a}),yield e.setToUser(t,Object.assign(Object.assign({},Tt),{key:"autofillOnPageLoadCalloutIsDismissed"}),null),n=!0),null!=l&&(r=Object.assign(Object.assign({},r),{disableAutoTotpCopy:!l}),yield e.setToUser(t,Object.assign(Object.assign({},Tt),{key:"autoCopyTotp"}),null),n=!0),null!=c&&(r=Object.assign(Object.assign({},r),{activateAutoFillOnPageLoadFromPolicy:c}),yield e.setToUser(t,{stateDefinition:{name:"autofillSettingsLocal"},key:"activateAutofillOnPageLoadFromPolicy"},null),n=!0),n&&(yield e.set(t,Object.assign(Object.assign({},i),{settings:r})))})}(t,i))])})}}var Ft=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Rt={key:"requirePasswordOnStart",stateDefinition:{name:"biometricSettings"}};class xt extends Je{migrate(e){return Ft(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(t=>Ft(this,[t],void 0,function*({userId:t,account:i}){var n;null!=(null===(n=null==i?void 0:i.settings)||void 0===n?void 0:n.requirePasswordOnStart)&&(yield e.setToUser(t,Rt,i.settings.requirePasswordOnStart),delete i.settings.requirePasswordOnStart,yield e.set(t,i))})))})}rollback(e){return Ft(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(({userId:t,account:i})=>function(t,i){return Ft(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,Rt);r&&(null!=i||(i={}),null!==(n=i.settings)&&void 0!==n||(i.settings={}),i.settings.requirePasswordOnStart=r,yield e.setToUser(t,Rt,null),yield e.set(t,i))})}(t,i)))})}}var At=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Dt={key:"privateKey",stateDefinition:{name:"crypto"}};class Et extends Je{migrate(e){return At(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return At(this,void 0,void 0,function*(){var n,r;const s=null===(r=null===(n=null==i?void 0:i.keys)||void 0===n?void 0:n.privateKey)||void 0===r?void 0:r.encrypted;null!=s&&(yield e.setToUser(t,Dt,s),delete i.keys.privateKey,yield e.set(t,i))})}(t,i))])})}rollback(e){return At(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return At(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,Dt);i&&r&&(i.keys=Object.assign(null!==(n=i.keys)&&void 0!==n?n:{},{privateKey:{encrypted:r}}),yield e.set(t,i)),yield e.setToUser(t,Dt,null)})}(t,i))])})}}var $t=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Ot={key:"collections",stateDefinition:{name:"collection"}};class Ut extends Je{migrate(e){return $t(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return $t(this,void 0,void 0,function*(){var n,r;const s=null===(r=null===(n=null==i?void 0:i.data)||void 0===n?void 0:n.collections)||void 0===r?void 0:r.encrypted;null!=s&&(yield e.setToUser(t,Ot,s),delete i.data.collections,yield e.set(t,i))})}(t,i))])})}rollback(e){return $t(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return $t(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,Ot);i&&(i.data=Object.assign(null!==(n=i.data)&&void 0!==n?n:{},{collections:{encrypted:r}}),yield e.set(t,i)),yield e.setToUser(t,Ot,null)})}(t,i))])})}}var Mt=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Nt={key:"collapsedGroupings",stateDefinition:{name:"vaultFilter"}};class Vt extends Je{migrate(e){return Mt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Mt(this,void 0,void 0,function*(){var n;const r=null===(n=null==i?void 0:i.settings)||void 0===n?void 0:n.collapsedGroupings;null!=r&&(yield e.setToUser(t,Nt,r),delete i.settings.collapsedGroupings,yield e.set(t,i))})}(t,i))])})}rollback(e){return Mt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Mt(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,Nt);i&&(i.settings=Object.assign(null!==(n=i.settings)&&void 0!==n?n:{},{collapsedGroupings:r}),yield e.set(t,i)),yield e.setToUser(t,Nt,null)})}(t,i))])})}}var Bt=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const jt={key:"dismissedBiometricRequirePasswordOnStartCallout",stateDefinition:{name:"biometricSettings"}},Gt={key:"promptAutomatically",stateDefinition:{name:"biometricSettings"}};class Lt extends Je{migrate(e){return Bt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(t=>Bt(this,[t],void 0,function*({userId:t,account:i}){var n,r,s,o;null!=i&&(null!=(null===(n=null==i?void 0:i.settings)||void 0===n?void 0:n.dismissedBiometricRequirePasswordOnStartCallout)&&(yield e.setToUser(t,jt,i.settings.dismissedBiometricRequirePasswordOnStartCallout)),null!=(null===(r=null==i?void 0:i.settings)||void 0===r?void 0:r.disableAutoBiometricsPrompt)&&(yield e.setToUser(t,Gt,!i.settings.disableAutoBiometricsPrompt)),null===(s=null==i?void 0:i.settings)||void 0===s||delete s.dismissedBiometricRequirePasswordOnStartCallout,null===(o=null==i?void 0:i.settings)||void 0===o||delete o.disableAutoBiometricsPrompt,yield e.set(t,i))})))})}rollback(e){return Bt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(({userId:t,account:i})=>function(t,i){return Bt(this,void 0,void 0,function*(){var n,r;let s=!1;const o=yield e.getFromUser(t,jt);o&&(null!=i||(i={}),null!==(n=i.settings)&&void 0!==n||(i.settings={}),s=!0,i.settings.dismissedBiometricRequirePasswordOnStartCallout=o,yield e.setToUser(t,jt,null));const a=yield e.getFromUser(t,Gt);null!=a&&(null!=i||(i={}),null!==(r=i.settings)&&void 0!==r||(i.settings={}),s=!0,i.settings.disableAutoBiometricsPrompt=!a,yield e.setToUser(t,Gt,null)),s&&(yield e.set(t,i))})}(t,i)))})}}var zt=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const _t={key:"tasks",stateDefinition:{name:"smOnboarding"}};class Kt extends Je{migrate(e){return zt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(t=>zt(this,[t],void 0,function*({userId:t,account:i}){var n;null!=(null===(n=null==i?void 0:i.settings)||void 0===n?void 0:n.smOnboardingTasks)&&(yield e.setToUser(t,_t,i.settings.smOnboardingTasks),delete i.settings.smOnboardingTasks,yield e.set(t,i))})))})}rollback(e){return zt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(({userId:t,account:i})=>function(t,i){return zt(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,_t);r&&(null!=i||(i={}),null!==(n=i.settings)&&void 0!==n||(i.settings={}),i.settings.smOnboardingTasks=r,yield e.setToUser(t,_t,null),yield e.set(t,i))})}(t,i)))})}}var Xt=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const qt={stateDefinition:{name:"autofillSettingsLocal"}};class Wt extends Je{migrate(e){return Xt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Xt(this,void 0,void 0,function*(){const n=null==i?void 0:i.settings;void 0!==(null==n?void 0:n.clearClipboard)&&(yield e.setToUser(t,Object.assign(Object.assign({},qt),{key:"clearClipboardDelay"}),n.clearClipboard),delete i.settings.clearClipboard,yield e.set(t,i))})}(t,i))])})}rollback(e){return Xt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Xt(this,void 0,void 0,function*(){let n=(null==i?void 0:i.settings)||{};const r=yield e.getFromUser(t,Object.assign(Object.assign({},qt),{key:"clearClipboardDelay"}));void 0!==r&&(n=Object.assign(Object.assign({},n),{clearClipboard:r}),yield e.setToUser(t,Object.assign(Object.assign({},qt),{key:"clearClipboardDelay"}),null),yield e.set(t,Object.assign(Object.assign({},i),{settings:n})))})}(t,i))])})}}var Yt=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Ht={key:"lastSync",stateDefinition:{name:"sync"}};class Jt extends Je{rollback(e){return Yt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Yt(this,void 0,void 0,function*(){var n;const r=null===(n=null==i?void 0:i.profile)||void 0===n?void 0:n.lastSync;yield e.setToUser(t,Ht,null!=r?r:null),null!=r&&(delete i.profile.lastSync,yield e.set(t,i))})}(t,i))])})}migrate(e){return Yt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Yt(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,Ht);i&&(i.profile=Object.assign(null!==(n=i.profile)&&void 0!==n?n:{},{lastSync:r}),yield e.set(t,i)),yield e.setToUser(t,Ht,null)})}(t,i))])})}}var Zt=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Qt={stateDefinition:{name:"badgeSettings"},key:"enableBadgeCounter"};class ei extends Je{migrate(e){return Zt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Zt(this,void 0,void 0,function*(){const n=null==i?void 0:i.settings;null!=(null==n?void 0:n.disableBadgeCounter)&&(yield e.setToUser(t,Qt,!n.disableBadgeCounter),delete i.settings.disableBadgeCounter,yield e.set(t,i))})}(t,i))])})}rollback(e){return Zt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Zt(this,void 0,void 0,function*(){let n=(null==i?void 0:i.settings)||{};const r=yield e.getFromUser(t,Qt);null!=r&&(n=Object.assign(Object.assign({},n),{disableBadgeCounter:!r}),yield e.setToUser(t,Qt,null),yield e.set(t,Object.assign(Object.assign({},i),{settings:n})))})}(t,i))])})}}var ti=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const ii={key:"biometricUnlockEnabled",stateDefinition:{name:"biometricSettings"}};class ni extends Je{migrate(e){return ti(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(t=>ti(this,[t],void 0,function*({userId:t,account:i}){var n,r;null!=i&&(null!=(null===(n=null==i?void 0:i.settings)||void 0===n?void 0:n.biometricUnlock)&&(yield e.setToUser(t,ii,i.settings.biometricUnlock)),null===(r=null==i?void 0:i.settings)||void 0===r||delete r.biometricUnlock,yield e.set(t,i))})))})}rollback(e){return ti(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(({userId:t,account:i})=>function(t,i){return ti(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,ii);null!=r&&(null!=i||(i={}),null!==(n=i.settings)&&void 0!==n||(i.settings={}),i.settings.biometricUnlock=r,yield e.setToUser(t,ii,null),yield e.set(t,i))})}(t,i)))})}}var ri=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class si extends Je{migrate(e){return ri(this,void 0,void 0,function*(){const t=yield e.get("global");null!=(null==t?void 0:t.disableAddLoginNotification)&&(yield e.setToGlobal({stateDefinition:{name:"userNotificationSettings"},key:"enableAddedLoginPrompt"},!t.disableAddLoginNotification),delete t.disableAddLoginNotification,yield e.set("global",t)),null!=(null==t?void 0:t.disableChangedPasswordNotification)&&(yield e.setToGlobal({stateDefinition:{name:"userNotificationSettings"},key:"enableChangedPasswordPrompt"},!t.disableChangedPasswordNotification),delete t.disableChangedPasswordNotification,yield e.set("global",t))})}rollback(e){return ri(this,void 0,void 0,function*(){const t=(yield e.get("global"))||{},i=yield e.getFromGlobal({stateDefinition:{name:"userNotificationSettings"},key:"enableAddedLoginPrompt"}),n=yield e.getFromGlobal({stateDefinition:{name:"userNotificationSettings"},key:"enableChangedPasswordPrompt"});i&&(yield e.set("global",Object.assign(Object.assign({},t),{disableAddLoginNotification:!i})),yield e.setToGlobal({stateDefinition:{name:"userNotificationSettings"},key:"enableAddedLoginPrompt"},null)),n&&(yield e.set("global",Object.assign(Object.assign({},t),{disableChangedPasswordNotification:!n})),yield e.setToGlobal({stateDefinition:{name:"userNotificationSettings"},key:"enableChangedPasswordPrompt"},null))})}}var oi,ai=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};!function(e){e[e.TwoFactorAuthentication=0]="TwoFactorAuthentication",e[e.MasterPassword=1]="MasterPassword",e[e.PasswordGenerator=2]="PasswordGenerator",e[e.SingleOrg=3]="SingleOrg",e[e.RequireSso=4]="RequireSso",e[e.PersonalOwnership=5]="PersonalOwnership",e[e.DisableSend=6]="DisableSend",e[e.SendOptions=7]="SendOptions",e[e.ResetPassword=8]="ResetPassword",e[e.MaximumVaultTimeout=9]="MaximumVaultTimeout",e[e.DisablePersonalVaultExport=10]="DisablePersonalVaultExport",e[e.ActivateAutofill=11]="ActivateAutofill"}(oi||(oi={}));const li={key:"policies",stateDefinition:{name:"policies"}};class ci extends Je{migrate(e){return ai(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(({userId:t,account:i})=>function(t,i){return ai(this,void 0,void 0,function*(){var n,r;const s=null===(r=null===(n=null==i?void 0:i.data)||void 0===n?void 0:n.policies)||void 0===r?void 0:r.encrypted;null!=s&&(yield e.setToUser(t,li,s),delete i.data.policies,yield e.set(t,i))})}(t,i)))})}rollback(e){return ai(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(({userId:t,account:i})=>function(t,i){return ai(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,li);i&&(i.data=Object.assign(null!==(n=i.data)&&void 0!==n?n:{},{policies:{encrypted:r}}),yield e.set(t,i)),yield e.setToUser(t,li,null)})}(t,i)))})}}var ui=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const di={stateDefinition:{name:"autofillSettings"},key:"enableContextMenu"};class hi extends Je{migrate(e){return ui(this,void 0,void 0,function*(){const t=yield e.get("global");null!=(null==t?void 0:t.disableContextMenuItem)&&(yield e.setToGlobal(di,!t.disableContextMenuItem),delete t.disableContextMenuItem,yield e.set("global",t))})}rollback(e){return ui(this,void 0,void 0,function*(){const t=(yield e.get("global"))||{},i=yield e.getFromGlobal(di);null!=i&&(yield e.set("global",Object.assign(Object.assign({},t),{disableContextMenuItem:!i})),yield e.setToGlobal(di,null))})}}var pi=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const vi={key:"locale",stateDefinition:{name:"translation"}};class fi extends Je{migrate(e){return pi(this,void 0,void 0,function*(){const t=yield e.get("global");(null==t?void 0:t.locale)&&(yield e.setToGlobal(vi,t.locale),delete t.locale,yield e.set("global",t))})}rollback(e){return pi(this,void 0,void 0,function*(){var t;const i=yield e.getFromGlobal(vi);if(!i)return;const n=null!==(t=yield e.get("global"))&&void 0!==t?t:{};n.locale=i,yield e.set("global",n),yield e.setToGlobal(vi,null)})}}var mi=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const gi="appId",yi="anonymousAppId",bi={key:gi,stateDefinition:{name:"applicationId"}},wi={key:yi,stateDefinition:{name:"applicationId"}};class Si extends Je{migrate(e){return mi(this,void 0,void 0,function*(){const t=yield e.get(gi),i=yield e.get(yi);null!=t&&(yield e.setToGlobal(bi,t),yield e.set(gi,null)),null!=i&&(yield e.setToGlobal(wi,i),yield e.set(yi,null))})}rollback(e){return mi(this,void 0,void 0,function*(){const t=yield e.getFromGlobal(bi),i=yield e.getFromGlobal(wi);null!=t&&(yield e.set(gi,t),yield e.setToGlobal(bi,null)),null!=i&&(yield e.set(yi,i),yield e.setToGlobal(wi,null))})}}var ki=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Ii={stateDefinition:{name:"domainSettings"},key:"defaultUriMatchStrategy"},Ci={stateDefinition:{name:"domainSettings"},key:"equivalentDomains"},Ti={stateDefinition:{name:"domainSettings"},key:"neverDomains"};class Pi extends Je{migrate(e){return ki(this,void 0,void 0,function*(){let t=!1;const i=yield e.get("global");null!=(null==i?void 0:i.neverDomains)&&(yield e.setToGlobal(Ti,i.neverDomains),delete i.neverDomains,yield e.set("global",i));const n=yield e.getAccounts();yield Promise.all([...n.map(({userId:i,account:n})=>function(i,n){return ki(this,void 0,void 0,function*(){var r;const s=null==n?void 0:n.settings;null!=(null==s?void 0:s.defaultUriMatch)&&(yield e.setToUser(i,Ii,s.defaultUriMatch),delete n.settings.defaultUriMatch,t=!0),null!=(null===(r=null==s?void 0:s.settings)||void 0===r?void 0:r.equivalentDomains)&&(yield e.setToUser(i,Ci,s.settings.equivalentDomains),delete n.settings.settings.equivalentDomains,delete n.settings.settings,t=!0),t&&(yield e.set(i,n))})}(i,n))])})}rollback(e){return ki(this,void 0,void 0,function*(){let t=!1;const i=(yield e.get("global"))||{},n=yield e.getFromGlobal(Ti);null!=n&&(yield e.set("global",Object.assign(Object.assign({},i),{neverDomains:n})),yield e.setToGlobal(Ti,null));const r=yield e.getAccounts();yield Promise.all([...r.map(({userId:i,account:n})=>function(i,n){return ki(this,void 0,void 0,function*(){let r=(null==n?void 0:n.settings)||{};const s=yield e.getFromUser(i,Ii),o=yield e.getFromUser(i,Ci);null!=s&&(r=Object.assign(Object.assign({},r),{defaultUriMatch:s}),yield e.setToUser(i,Ii,null),t=!0),null!=o&&(r=Object.assign(Object.assign({},r),{settings:{equivalentDomains:o}}),yield e.setToUser(i,Ci,null),t=!0),t&&(yield e.set(i,Object.assign(Object.assign({},n),{settings:r})))})}(i,n))])})}}var Fi=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Ri={key:"selection",stateDefinition:{name:"theming"}};class xi extends Je{migrate(e){return Fi(this,void 0,void 0,function*(){const t=yield e.get("global"),i=null==t?void 0:t.theme;null!=i&&(yield e.setToGlobal(Ri,i),delete t.theme,yield e.set("global",t))})}rollback(e){return Fi(this,void 0,void 0,function*(){var t;const i=yield e.getFromGlobal(Ri);if(null!=i){const n=null!==(t=yield e.get("global"))&&void 0!==t?t:{};n.theme=i,yield e.set("global",n),yield e.removeFromGlobal(Ri)}})}}var Ai=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Di={stateDefinition:{name:"vaultSettings"}};class Ei extends Je{migrate(e){return Ai(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Ai(this,void 0,void 0,function*(){let n=!1;const r=null==i?void 0:i.settings;null!=(null==r?void 0:r.dontShowCardsCurrentTab)&&(yield e.setToUser(t,Object.assign(Object.assign({},Di),{key:"showCardsCurrentTab"}),!r.dontShowCardsCurrentTab),delete i.settings.dontShowCardsCurrentTab,n=!0),null!=(null==r?void 0:r.dontShowIdentitiesCurrentTab)&&(yield e.setToUser(t,Object.assign(Object.assign({},Di),{key:"showIdentitiesCurrentTab"}),!r.dontShowIdentitiesCurrentTab),delete i.settings.dontShowIdentitiesCurrentTab,n=!0),n&&(yield e.set(t,i))})}(t,i))])})}rollback(e){return Ai(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Ai(this,void 0,void 0,function*(){var n;let r=!1,s=null!==(n=null==i?void 0:i.settings)&&void 0!==n?n:{};const o=yield e.getFromUser(t,Object.assign(Object.assign({},Di),{key:"showCardsCurrentTab"})),a=yield e.getFromUser(t,Object.assign(Object.assign({},Di),{key:"showIdentitiesCurrentTab"}));null!=o&&(s=Object.assign(Object.assign({},s),{dontShowCardsCurrentTab:!o}),yield e.setToUser(t,Object.assign(Object.assign({},Di),{key:"showCardsCurrentTab"}),null),r=!0),null!=a&&(s=Object.assign(Object.assign({},s),{dontShowIdentitiesCurrentTab:!a}),yield e.setToUser(t,Object.assign(Object.assign({},Di),{key:"showIdentitiesCurrentTab"}),null),r=!0),r&&(yield e.set(t,Object.assign(Object.assign({},i),{settings:s})))})}(t,i))])})}}var $i=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Oi={key:"avatarColor",stateDefinition:{name:"avatar"}};class Ui extends Je{migrate(e){return $i(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(t=>$i(this,[t],void 0,function*({userId:t,account:i}){var n,r;null!=(null===(n=null==i?void 0:i.settings)||void 0===n?void 0:n.avatarColor)&&(yield e.setToUser(t,Oi,i.settings.avatarColor),null===(r=null==i?void 0:i.settings)||void 0===r||delete r.avatarColor,yield e.set(t,i))})))})}rollback(e){return $i(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(({userId:t,account:i})=>function(t,i){return $i(this,void 0,void 0,function*(){let n=!1;const r=yield e.getFromUser(t,Oi);r&&(i||(i={}),n=!0,i.settings.avatarColor=r,yield e.setToUser(t,Oi,null)),n&&(yield e.set(t,i))})}(t,i)))})}}var Mi=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Ni={key:"emailTwoFactorTokenRecord",stateDefinition:{name:"tokenDiskLocal"}},Vi={name:"token"},Bi={key:"accessToken",stateDefinition:Vi},ji={key:"refreshToken",stateDefinition:Vi},Gi={key:"apiKeyClientId",stateDefinition:Vi},Li={key:"apiKeyClientSecret",stateDefinition:Vi};class zi extends Je{migrate(e){return Mi(this,void 0,void 0,function*(){const t=yield e.get("global"),i={},n=yield e.getAccounts();yield Promise.all([...n.map(({userId:n,account:r})=>function(t,i,n,r){return Mi(this,void 0,void 0,function*(){var s,o,a,l,c;let u=!1;const d=null===(s=null==i?void 0:i.profile)||void 0===s?void 0:s.email;null!=n&&null!=i&&null!=d&&(r[d]=n);const h=null===(o=null==i?void 0:i.tokens)||void 0===o?void 0:o.accessToken;null!=h&&("web-disk-local"!==e.type&&(yield e.setToUser(t,Bi,h)),delete i.tokens.accessToken,u=!0);const p=null===(a=null==i?void 0:i.tokens)||void 0===a?void 0:a.refreshToken;null!=p&&("web-disk-local"!==e.type&&(yield e.setToUser(t,ji,p)),delete i.tokens.refreshToken,u=!0);const v=null===(l=null==i?void 0:i.profile)||void 0===l?void 0:l.apiKeyClientId;null!=v&&("web-disk-local"!==e.type&&(yield e.setToUser(t,Gi,v)),delete i.profile.apiKeyClientId,u=!0);const f=null===(c=null==i?void 0:i.keys)||void 0===c?void 0:c.apiKeyClientSecret;null!=f&&("web-disk-local"!==e.type&&(yield e.setToUser(t,Li,f)),delete i.keys.apiKeyClientSecret,u=!0),u&&(yield e.set(t,i))})}(n,r,null==t?void 0:t.twoFactorToken,i))]),yield e.setToGlobal(Ni,i),null==t||delete t.twoFactorToken,yield e.set("global",t)})}rollback(e){return Mi(this,void 0,void 0,function*(){var t;const i=yield e.getAccounts();let n=null;for(const{account:r}of i){const i=null===(t=null==r?void 0:r.profile)||void 0===t?void 0:t.email;if(null==i)continue;if(n=(yield e.getFromGlobal(Ni))[i],null!=n)break}if(null!=n){let t=yield e.get("global");t||(t={}),t.twoFactorToken=n,yield e.set("global",t)}yield e.setToGlobal(Ni,null),yield Promise.all([...i.map(({userId:t,account:i})=>function(t,i){return Mi(this,void 0,void 0,function*(){let n=!1;const r=yield e.getFromUser(t,Bi);(null==i?void 0:i.tokens)&&null!=r&&(i.tokens.accessToken=r,n=!0),yield e.setToUser(t,Bi,null);const s=yield e.getFromUser(t,ji);(null==i?void 0:i.tokens)&&null!=s&&(i.tokens.refreshToken=s,n=!0),yield e.setToUser(t,ji,null);const o=yield e.getFromUser(t,Gi);(null==i?void 0:i.profile)&&null!=o&&(i.profile.apiKeyClientId=o,n=!0),yield e.setToUser(t,Gi,null);const a=yield e.getFromUser(t,Li);(null==i?void 0:i.keys)&&null!=a&&(i.keys.apiKeyClientSecret=a,n=!0),yield e.setToUser(t,Li,null),n&&(yield e.set(t,i))})}(t,i))])})}}var _i=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Ki={key:"accountProfile",stateDefinition:{name:"billing"}};class Xi extends Je{migrate(e){return _i(this,void 0,void 0,function*(){const t=yield e.getAccounts(),i=(t,i)=>_i(this,void 0,void 0,function*(){var n,r,s,o;const a=null===(n=null==i?void 0:i.profile)||void 0===n?void 0:n.hasPremiumPersonally,l=null===(r=null==i?void 0:i.profile)||void 0===r?void 0:r.hasPremiumFromOrganization;null==a&&null==l||(yield e.setToUser(t,Ki,{hasPremiumPersonally:a,hasPremiumFromOrganization:l}),null===(s=null==i?void 0:i.profile)||void 0===s||delete s.hasPremiumPersonally,null===(o=null==i?void 0:i.profile)||void 0===o||delete o.hasPremiumFromOrganization,yield e.set(t,i))});yield Promise.all([...t.map(({userId:e,account:t})=>i(e,t))])})}rollback(e){return _i(this,void 0,void 0,function*(){const t=yield e.getAccounts(),i=(t,i)=>_i(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,Ki);i&&r&&(i.profile=Object.assign(null!==(n=i.profile)&&void 0!==n?n:{},{hasPremiumPersonally:null==r?void 0:r.hasPremiumPersonally,hasPremiumFromOrganization:null==r?void 0:r.hasPremiumFromOrganization}),yield e.set(t,i)),yield e.setToUser(t,Ki,null)});yield Promise.all([...t.map(({userId:e,account:t})=>i(e,t))])})}}var qi=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Wi extends Je{migrate(e){return qi(this,void 0,void 0,function*(){const t=yield e.getAccounts();Promise.all(t.map(({userId:t,account:i})=>function(t,i){return qi(this,void 0,void 0,function*(){var n;if(null!=(null===(n=null==i?void 0:i.profile)||void 0===n?void 0:n.everBeenUnlocked))return delete i.profile.everBeenUnlocked,e.set(t,i)})}(t,i)))})}rollback(e){throw He}updateVersion(e,t){return qi(this,void 0,void 0,function*(){const i="up"===t?this.toVersion:this.fromVersion;e.currentVersion=i;const n=(yield e.get("global"))||{};yield e.set("global",Object.assign(Object.assign({},n),{stateVersion:i}))})}}var Yi,Hi,Ji,Zi,Qi=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};!function(e){e[e.Invited=0]="Invited",e[e.Accepted=1]="Accepted",e[e.Confirmed=2]="Confirmed",e[e.Revoked=-1]="Revoked"}(Yi||(Yi={})),function(e){e[e.Owner=0]="Owner",e[e.Admin=1]="Admin",e[e.User=2]="User",e[e.Manager=3]="Manager",e[e.Custom=4]="Custom"}(Hi||(Hi={})),function(e){e[e.Msp=0]="Msp",e[e.Reseller=1]="Reseller"}(Ji||(Ji={})),function(e){e[e.Free=0]="Free",e[e.Families=1]="Families",e[e.Teams=2]="Teams",e[e.Enterprise=3]="Enterprise",e[e.TeamsStarter=4]="TeamsStarter"}(Zi||(Zi={}));const en={key:"organizations",stateDefinition:{name:"organizations"}};class tn extends Je{migrate(e){return Qi(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(({userId:t,account:i})=>function(t,i){return Qi(this,void 0,void 0,function*(){var n;const r=null===(n=null==i?void 0:i.data)||void 0===n?void 0:n.organizations;null!=r&&(yield e.setToUser(t,en,r),delete i.data.organizations,yield e.set(t,i))})}(t,i)))})}rollback(e){return Qi(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(({userId:t,account:i})=>function(t,i){return Qi(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,en);i&&(i.data=Object.assign(null!==(n=i.data)&&void 0!==n?n:{},{organizations:r}),yield e.set(t,i)),yield e.setToUser(t,en,null)})}(t,i)))})}}var nn=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const rn={stateDefinition:{name:"eventCollection"},key:"eventCollection"};class sn extends Je{migrate(e){return nn(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return nn(this,void 0,void 0,function*(){var n;const r=null===(n=null==i?void 0:i.data)||void 0===n?void 0:n.eventCollection;null!=r&&(yield e.setToUser(t,rn,r),delete i.data.eventCollection,yield e.set(t,i))})}(t,i))])})}rollback(e){return nn(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return nn(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,rn);i&&(i.data=Object.assign(null!==(n=i.data)&&void 0!==n?n:{},{eventCollection:r}),yield e.set(t,i)),yield e.setToUser(t,rn,null)})}(t,i))])})}}var on=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const an={stateDefinition:{name:"domainSettings"},key:"showFavicons"};class ln extends Je{migrate(e){return on(this,void 0,void 0,function*(){const t=yield e.get("global");null!=(null==t?void 0:t.disableFavicon)&&(yield e.setToGlobal(an,!t.disableFavicon),delete t.disableFavicon,yield e.set("global",t))})}rollback(e){return on(this,void 0,void 0,function*(){const t=(yield e.get("global"))||{},i=yield e.getFromGlobal(an);null!=i&&(yield e.set("global",Object.assign(Object.assign({},t),{disableFavicon:!i})),yield e.setToGlobal(an,null))})}}var cn=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const un={key:"autoConfirmFingerPrints",stateDefinition:{name:"organizationManagementPreferences"}};class dn extends Je{migrate(e){return cn(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(t=>cn(this,[t],void 0,function*({userId:t,account:i}){var n,r;null!=(null===(n=null==i?void 0:i.settings)||void 0===n?void 0:n.autoConfirmFingerPrints)&&(yield e.setToUser(t,un,i.settings.autoConfirmFingerPrints),null===(r=null==i?void 0:i.settings)||void 0===r||delete r.autoConfirmFingerPrints,yield e.set(t,i))})))})}rollback(e){return cn(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(({userId:t,account:i})=>function(t,i){return cn(this,void 0,void 0,function*(){let n=!1;const r=yield e.getFromUser(t,un);r&&(i||(i={}),n=!0,i.settings.autoConfirmFingerPrints=r,yield e.setToUser(t,un,null)),n&&(yield e.set(t,i))})}(t,i)))})}}var hn=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const pn={key:"decryptionOptions",stateDefinition:{name:"userDecryptionOptions"}};class vn extends Je{migrate(e){return hn(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return hn(this,void 0,void 0,function*(){const n=null==i?void 0:i.decryptionOptions;null!=n&&(yield e.setToUser(t,pn,n),delete i.decryptionOptions,yield e.set(t,i))})}(t,i))])})}rollback(e){return hn(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return hn(this,void 0,void 0,function*(){const n=yield e.getFromUser(t,pn);i&&(i.decryptionOptions=Object.assign(i.decryptionOptions,n),yield e.set(t,i)),yield e.setToUser(t,pn,null)})}(t,i))])})}}var fn=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const mn={name:"environment"},gn={key:"region",stateDefinition:mn},yn={key:"urls",stateDefinition:mn},bn={key:"environment",stateDefinition:mn};class wn extends Je{migrate(e){return fn(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t){return fn(this,void 0,void 0,function*(){const i=yield e.getFromUser(t,gn),n=yield e.getFromUser(t,yn);null==i&&null==n||(yield e.setToUser(t,bn,{region:i,urls:n}),yield e.removeFromUser(t,gn),yield e.removeFromUser(t,yn))})}(t))]);const i=yield e.getFromGlobal(gn),n=yield e.getFromGlobal(yn);null==i&&null==n||(yield e.setToGlobal(bn,{region:i,urls:n}),yield e.removeFromGlobal(gn),yield e.removeFromGlobal(yn))})}rollback(e){return fn(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t){return fn(this,void 0,void 0,function*(){const i=yield e.getFromUser(t,bn);yield e.setToUser(t,gn,null==i?void 0:i.region),yield e.setToUser(t,yn,null==i?void 0:i.urls),yield e.removeFromUser(t,bn)})}(t))]);const i=yield e.getFromGlobal(bn);yield e.setToGlobal(gn,null==i?void 0:i.region),yield e.setToGlobal(yn,null==i?void 0:i.urls),yield e.removeFromGlobal(bn)})}}var Sn=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const kn={key:"promptCancelled",stateDefinition:{name:"biometricSettings"}};class In extends Je{migrate(e){return Sn(this,void 0,void 0,function*(){yield Promise.all((yield e.getAccounts()).map(t=>Sn(this,[t],void 0,function*({userId:t}){null!=e.getFromUser(t,kn)&&(yield e.removeFromUser(t,kn))})))})}rollback(e){return Sn(this,void 0,void 0,function*(){throw He})}}var Cn=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Tn={name:"desktopSettings"},Pn={key:"window",stateDefinition:Tn},Fn={key:"closeToTray",stateDefinition:Tn},Rn={key:"minimizeToTray",stateDefinition:Tn},xn={key:"startToTray",stateDefinition:Tn},An={key:"trayEnabled",stateDefinition:Tn},Dn={key:"openAtLogin",stateDefinition:Tn},En={key:"alwaysShowDock",stateDefinition:Tn},$n={key:"alwaysOnTop",stateDefinition:Tn};class On extends Je{migrate(e){return Cn(this,void 0,void 0,function*(){const t=yield e.get("global");let i=!1;void 0!==(null==t?void 0:t.window)&&(yield e.setToGlobal(Pn,t.window),i=!0,delete t.window),null!=(null==t?void 0:t.enableCloseToTray)&&(yield e.setToGlobal(Fn,t.enableCloseToTray),i=!0,delete t.enableCloseToTray),null!=(null==t?void 0:t.enableMinimizeToTray)&&(yield e.setToGlobal(Rn,t.enableMinimizeToTray),i=!0,delete t.enableMinimizeToTray),null!=(null==t?void 0:t.enableStartToTray)&&(yield e.setToGlobal(xn,t.enableStartToTray),i=!0,delete t.enableStartToTray),null!=(null==t?void 0:t.enableTray)&&(yield e.setToGlobal(An,t.enableTray),i=!0,delete t.enableTray),null!=(null==t?void 0:t.openAtLogin)&&(yield e.setToGlobal(Dn,t.openAtLogin),i=!0,delete t.openAtLogin),null!=(null==t?void 0:t.alwaysShowDock)&&(yield e.setToGlobal(En,t.alwaysShowDock),i=!0,delete t.alwaysShowDock),null!=(null==t?void 0:t.enableAlwaysOnTop)&&(yield e.setToGlobal($n,t.enableAlwaysOnTop),i=!0,delete t.enableAlwaysOnTop),i&&(yield e.set("global",t));const n=yield e.getAccounts();yield Promise.all(n.map(({userId:t,account:i})=>function(t,i){return Cn(this,void 0,void 0,function*(){var n;null!=(null===(n=null==i?void 0:i.settings)||void 0===n?void 0:n.enableAlwaysOnTop)&&(delete i.settings.enableAlwaysOnTop,yield e.set(t,i))})}(t,i)))})}rollback(e){throw He}}var Un=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Mn={key:"enableDuckDuckGoBrowserIntegration",stateDefinition:{name:"autofillSettings"}};class Nn extends Je{migrate(e){return Un(this,void 0,void 0,function*(){const t=yield e.get("global");null!=(null==t?void 0:t.enableDuckDuckGoBrowserIntegration)&&(yield e.setToGlobal(Mn,t.enableDuckDuckGoBrowserIntegration),delete t.enableDuckDuckGoBrowserIntegration,yield e.set("global",t))})}rollback(e){return Un(this,void 0,void 0,function*(){var t;const i=yield e.getFromGlobal(Mn);if(!i)return;const n=null!==(t=yield e.get("global"))&&void 0!==t?t:{};n.enableDuckDuckGoBrowserIntegration=i,yield e.set("global",n),yield e.removeFromGlobal(Mn)})}}var Vn=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Bn={stateDefinition:{name:"config"},key:"serverConfig"};class jn extends Je{migrate(e){return Vn(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Vn(this,void 0,void 0,function*(){var n;null!=(null===(n=null==i?void 0:i.settings)||void 0===n?void 0:n.serverConfig)&&(yield e.setToUser(t,Bn,i.settings.serverConfig),delete i.settings.serverConfig,yield e.set(t,i))})}(t,i))])})}rollback(e){return Vn(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Vn(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,Bn);r&&(null!=i||(i={}),null!==(n=i.settings)&&void 0!==n||(i.settings={}),i.settings.serverConfig=r,yield e.setToUser(t,Bn,null),yield e.set(t,i))})}(t,i))])})}}var Gn=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Ln extends Je{migrate(e){return Gn(this,void 0,void 0,function*(){const t=yield e.getAccounts();Promise.all(t.map(({userId:t,account:i})=>function(t,i){return Gn(this,void 0,void 0,function*(){var n,r;const s=null===(r=null===(n=null==i?void 0:i.keys)||void 0===n?void 0:n.organizationKeys)||void 0===r?void 0:r.encrypted;if(null==s)return;const o={};Object.entries(s).forEach(([e,t])=>{o[e]={type:"organization",key:t}}),i.keys.organizationKeys.encrypted=o,yield e.set(t,i)})}(t,i)))})}rollback(e){return Gn(this,void 0,void 0,function*(){const t=yield e.getAccounts();Promise.all(t.map(t=>Gn(this,[t],void 0,function*({userId:t,account:i}){return function(t,i){return Gn(this,void 0,void 0,function*(){var n,r;const s=null===(r=null===(n=null==i?void 0:i.keys)||void 0===n?void 0:n.organizationKeys)||void 0===r?void 0:r.encrypted;if(null==s)return;const o={};Object.entries(s).forEach(([e,t])=>{o[e]=t.key}),i.keys.organizationKeys.encrypted=o,yield e.set(t,i)})}(t,i)})))})}updateVersion(e,t){return Gn(this,void 0,void 0,function*(){const i="up"===t?this.toVersion:this.fromVersion;e.currentVersion=i;const n=(yield e.get("global"))||{};yield e.set("global",Object.assign(Object.assign({},n),{stateVersion:i}))})}}var zn=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const _n={key:"usesKeyConnector",stateDefinition:{name:"keyConnector"}},Kn={key:"convertAccountToKeyConnector",stateDefinition:{name:"keyConnector"}};class Xn extends Je{migrate(e){return zn(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return zn(this,void 0,void 0,function*(){var n,r;const s=null===(n=null==i?void 0:i.profile)||void 0===n?void 0:n.usesKeyConnector,o=null===(r=null==i?void 0:i.profile)||void 0===r?void 0:r.convertAccountToKeyConnector;null==s&&null==o||(null!=s&&(yield e.setToUser(t,_n,s),delete i.profile.usesKeyConnector),null!=o&&(yield e.setToUser(t,Kn,o),delete i.profile.convertAccountToKeyConnector),yield e.set(t,i))})}(t,i))])})}rollback(e){return zn(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return zn(this,void 0,void 0,function*(){const n=yield e.getFromUser(t,_n),r=yield e.getFromUser(t,Kn);null==n&&null==r||(null!=n&&(i.profile.usesKeyConnector=n,yield e.setToUser(t,_n,null)),null!=r&&(i.profile.convertAccountToKeyConnector=r,yield e.setToUser(t,Kn,null)),yield e.set(t,i))})}(t,i))])})}}var qn=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Wn={key:"storedEmail",stateDefinition:{name:"loginEmail"}};class Yn extends Je{migrate(e){return qn(this,void 0,void 0,function*(){const t=yield e.get("global");null!=(null==t?void 0:t.rememberedEmail)&&(yield e.setToGlobal(Wn,t.rememberedEmail)),null==t||delete t.rememberedEmail,yield e.set("global",t)})}rollback(e){return qn(this,void 0,void 0,function*(){let t=yield e.get("global"),i=!1;const n=yield e.getFromGlobal(Wn);n&&(t||(t={}),i=!0,t.rememberedEmail=n,yield e.setToGlobal(Wn,null)),i&&(yield e.set("global",t))})}}var Hn=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Jn extends Je{migrate(e){return Hn(this,void 0,void 0,function*(){const t=yield e.get("global");null!=(null==t?void 0:t.installedVersion)&&(delete t.installedVersion,yield e.set("global",t))})}rollback(e){throw He}}var Zn=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Qn={key:"deviceKey",stateDefinition:{name:"deviceTrust"}},er={key:"shouldTrustDevice",stateDefinition:{name:"deviceTrust"}};class tr extends Je{migrate(e){return Zn(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Zn(this,void 0,void 0,function*(){var n,r;let s=!1;const o=null===(n=null==i?void 0:i.keys)||void 0===n?void 0:n.deviceKey;null!=o&&(yield e.setToUser(t,Qn,o),delete i.keys.deviceKey,s=!0);const a=null===(r=null==i?void 0:i.settings)||void 0===r?void 0:r.trustDeviceChoiceForDecryption;null!=a&&(yield e.setToUser(t,er,a),delete i.settings.trustDeviceChoiceForDecryption,s=!0),s&&(yield e.set(t,i))})}(t,i))])})}rollback(e){return Zn(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Zn(this,void 0,void 0,function*(){const n=yield e.getFromUser(t,Qn);(null==i?void 0:i.keys)&&null!=n&&(i.keys.deviceKey=n,yield e.set(t,i)),yield e.setToUser(t,Qn,null);const r=yield e.getFromUser(t,er);(null==i?void 0:i.settings)&&null!=r&&(i.settings.trustDeviceChoiceForDecryption=r,yield e.set(t,i)),yield e.setToUser(t,er,null)})}(t,i))])})}}var ir,nr=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};!function(e){e[e.Text=0]="Text",e[e.File=1]="File"}(ir||(ir={}));const rr={stateDefinition:{name:"send"},key:"sends"};class sr extends Je{migrate(e){return nr(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return nr(this,void 0,void 0,function*(){var n,r;const s=null===(r=null===(n=null==i?void 0:i.data)||void 0===n?void 0:n.sends)||void 0===r?void 0:r.encrypted;null!=s&&(yield e.setToUser(t,rr,s),delete i.data.sends,yield e.set(t,i))})}(t,i))])})}rollback(e){return nr(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return nr(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,rr);i&&(i.data=Object.assign(null!==(n=i.data)&&void 0!==n?n:{},{sends:{encrypted:r}}),yield e.set(t,i)),yield e.setToUser(t,rr,null)})}(t,i))])})}}var or=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const ar={key:"forceSetPasswordReason",stateDefinition:{name:"masterPassword"}},lr={key:"masterKeyHash",stateDefinition:{name:"masterPassword"}},cr={key:"masterKeyEncryptedUserKey",stateDefinition:{name:"masterPassword"}};class ur extends Je{migrate(e){return or(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return or(this,void 0,void 0,function*(){var n,r,s;const o=null===(n=null==i?void 0:i.profile)||void 0===n?void 0:n.forceSetPasswordReason;null!=o&&(yield e.setToUser(t,ar,o),delete i.profile.forceSetPasswordReason,yield e.set(t,i));const a=null===(r=null==i?void 0:i.profile)||void 0===r?void 0:r.keyHash;null!=a&&(yield e.setToUser(t,lr,a),delete i.profile.keyHash,yield e.set(t,i));const l=null===(s=null==i?void 0:i.keys)||void 0===s?void 0:s.masterKeyEncryptedUserKey;null!=l&&(yield e.setToUser(t,cr,l),delete i.keys.masterKeyEncryptedUserKey,yield e.set(t,i))})}(t,i))])})}rollback(e){return or(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return or(this,void 0,void 0,function*(){var n,r,s;const o=yield e.getFromUser(t,ar),a=yield e.getFromUser(t,lr),l=yield e.getFromUser(t,cr);null!=i&&(null!=o&&(i.profile=Object.assign(null!==(n=i.profile)&&void 0!==n?n:{},{forceSetPasswordReason:o})),null!=a&&(i.profile=Object.assign(null!==(r=i.profile)&&void 0!==r?r:{},{keyHash:a})),null!=l&&(i.keys=Object.assign(null!==(s=i.keys)&&void 0!==s?s:{},{masterKeyEncryptedUserKey:l})),yield e.set(t,i)),yield e.setToUser(t,ar,null),yield e.setToUser(t,lr,null)})}(t,i))])})}}var dr=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const hr={stateDefinition:{name:"authRequestLocal"},key:"adminAuthRequest"},pr={stateDefinition:{name:"authRequestLocal"},key:"acceptAuthRequests"};class vr extends Je{migrate(e){return dr(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return dr(this,void 0,void 0,function*(){var n;let r=!1;const s=null==i?void 0:i.adminAuthRequest;null!=s&&(yield e.setToUser(t,hr,s),delete i.adminAuthRequest,r=!0);const o=null===(n=null==i?void 0:i.settings)||void 0===n?void 0:n.approveLoginRequests;null!=o&&(yield e.setToUser(t,pr,o),delete i.settings.approveLoginRequests,r=!0),r&&(yield e.set(t,i))})}(t,i))])})}rollback(e){return dr(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return dr(this,void 0,void 0,function*(){var n;let r=!1;const s=yield e.getFromUser(t,hr);null!=s&&(i.adminAuthRequest=s,r=!0),yield e.setToUser(t,hr,null);const o=yield e.getFromUser(t,pr);null!=o&&(i.settings=Object.assign(null!==(n=i.settings)&&void 0!==n?n:{},{approveLoginRequests:o}),r=!0),yield e.setToUser(t,pr,null),r&&(yield e.set(t,i))})}(t,i))])})}}var fr=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const mr={key:"localData",stateDefinition:{name:"ciphersLocal"}},gr={key:"ciphers",stateDefinition:{name:"ciphers"}};class yr extends Je{migrate(e){return fr(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return fr(this,void 0,void 0,function*(){var n,r,s;let o=!1;const a=null===(n=null==i?void 0:i.data)||void 0===n?void 0:n.localData;null!=a&&(yield e.setToUser(t,mr,a),delete i.data.localData,o=!0);const l=null===(s=null===(r=null==i?void 0:i.data)||void 0===r?void 0:r.ciphers)||void 0===s?void 0:s.encrypted;null!=l&&(yield e.setToUser(t,gr,l),delete i.data.ciphers,o=!0),o&&(yield e.set(t,i))})}(t,i))])})}rollback(e){return fr(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return fr(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,mr);i.data&&null!=r&&(i.data.localData=r,yield e.set(t,i)),yield e.setToUser(t,mr,null);const s=yield e.getFromUser(t,gr);i.data&&null!=s&&((n=i.data).ciphers||(n.ciphers={encrypted:null}),i.data.ciphers.encrypted=s,yield e.set(t,i)),yield e.setToUser(t,gr,null)})}(t,i))])})}}var br=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const wr={key:"refreshTokenMigratedToSecureStorage",stateDefinition:{name:"token"}};class Sr extends Je{migrate(e){return br(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t){return br(this,void 0,void 0,function*(){null!=(yield e.getFromUser(t,wr))&&(yield e.removeFromUser(t,wr))})}(t))])})}rollback(e){return br(this,void 0,void 0,function*(){throw He})}}var kr,Ir=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};!function(e){e[e.PBKDF2_SHA256=0]="PBKDF2_SHA256",e[e.Argon2id=1]="Argon2id"}(kr||(kr={}));const Cr={key:"kdfConfig",stateDefinition:{name:"kdfConfig"}};class Tr extends Je{migrate(e){return Ir(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Ir(this,void 0,void 0,function*(){var n,r,s,o,a,l,c,u;const d={iterations:null===(n=null==i?void 0:i.profile)||void 0===n?void 0:n.kdfIterations,kdfType:null===(r=null==i?void 0:i.profile)||void 0===r?void 0:r.kdfType,memory:null===(s=null==i?void 0:i.profile)||void 0===s?void 0:s.kdfMemory,parallelism:null===(o=null==i?void 0:i.profile)||void 0===o?void 0:o.kdfParallelism};null!=d&&(yield e.setToUser(t,Cr,d),null===(a=null==i?void 0:i.profile)||void 0===a||delete a.kdfIterations,null===(l=null==i?void 0:i.profile)||void 0===l||delete l.kdfType,null===(c=null==i?void 0:i.profile)||void 0===c||delete c.kdfMemory,null===(u=null==i?void 0:i.profile)||void 0===u||delete u.kdfParallelism),yield e.set(t,i)})}(t,i))])})}rollback(e){return Ir(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Ir(this,void 0,void 0,function*(){const n=yield e.getFromUser(t,Cr);null!=n&&(i.profile.kdfIterations=n.iterations,i.profile.kdfType=n.kdfType,i.profile.kdfMemory=n.memory,i.profile.kdfParallelism=n.parallelism,yield e.setToUser(t,Cr,null)),yield e.set(t,i)})}(t,i))])})}}var Pr=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Fr extends Je{migrate(e){return Pr(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(({userId:t,account:i})=>function(t,i){return Pr(this,void 0,void 0,function*(){var n;(null===(n=null==i?void 0:i.keys)||void 0===n?void 0:n.legacyEtmKey)&&(delete i.keys.legacyEtmKey,yield e.set(t,i))})}(t,i)))})}rollback(e){return Pr(this,void 0,void 0,function*(){throw He})}updateVersion(e,t){return Pr(this,void 0,void 0,function*(){const i="up"===t?this.toVersion:this.fromVersion;e.currentVersion=i;const n=(yield e.get("global"))||{};yield e.set("global",Object.assign(Object.assign({},n),{stateVersion:i}))})}}var Rr=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const xr={stateDefinition:{name:"account"},key:"accounts"},Ar={stateDefinition:{name:"account"},key:"activeAccountId"},Dr={stateDefinition:{name:"account"},key:"activity"};class Er extends Je{migrate(e){return Rr(this,void 0,void 0,function*(){yield this.migrateAuthenticatedAccounts(e),yield this.migrateActiveAccountId(e),yield this.migrateAccountActivity(e)})}rollback(e){return Rr(this,void 0,void 0,function*(){var t;const i=null!==(t=yield e.getKnownUserIds())&&void 0!==t?t:[];yield e.set("authenticatedAccounts",i),yield e.removeFromGlobal(xr);const n=yield e.getFromGlobal(Ar);n&&(yield e.set("activeUserId",n)),yield e.removeFromGlobal(Ar);const r=yield e.getFromGlobal(Dr);if(r){const t=Object.entries(r).reduce((e,[t,i])=>(e[t]=new Date(i).getTime(),e),{});yield e.set("accountActivity",t)}yield e.removeFromGlobal(Dr)})}migrateAuthenticatedAccounts(e){return Rr(this,void 0,void 0,function*(){var t;const i=null!==(t=yield e.get("authenticatedAccounts"))&&void 0!==t?t:[],n=(yield Promise.all(i.map(t=>Rr(this,void 0,void 0,function*(){const i=yield e.get(t);return{userId:t,account:i}})))).reduce((e,{userId:t,account:i})=>{var n,r;return(null==i?void 0:i.profile)&&(e[t]={email:null!==(n=i.profile.email)&&void 0!==n?n:"",emailVerified:null!==(r=i.profile.emailVerified)&&void 0!==r&&r,name:i.profile.name}),e},{});yield e.setToGlobal(xr,n),yield e.remove("authenticatedAccounts")})}migrateAccountActivity(e){return Rr(this,void 0,void 0,function*(){const t=yield e.get("accountActivity"),i=Object.entries(null!=t?t:{}).reduce((e,[t,i])=>(e[t]=JSON.stringify(new Date(i)),e),{});yield e.setToGlobal(Dr,i),yield e.remove("accountActivity")})}migrateActiveAccountId(e){return Rr(this,void 0,void 0,function*(){const t=yield e.get("activeUserId");yield e.setToGlobal(Ar,t),yield e.remove("activeUserId")})}}var $r=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Or={name:"pinUnlock"},Ur={stateDefinition:Or,key:"pinKeyEncryptedUserKeyPersistent"},Mr={stateDefinition:Or,key:"userKeyEncryptedPin"},Nr={stateDefinition:Or,key:"oldPinKeyEncryptedMasterKey"};class Vr extends Je{migrate(e){return $r(this,void 0,void 0,function*(){const t=yield e.getAccounts();let i=!1;yield Promise.all([...t.map(({userId:t,account:n})=>function(t,n){return $r(this,void 0,void 0,function*(){var r,s,o,a;null!=(null===(r=null==n?void 0:n.settings)||void 0===r?void 0:r.pinKeyEncryptedUserKey)&&(yield e.setToUser(t,Ur,n.settings.pinKeyEncryptedUserKey),delete n.settings.pinKeyEncryptedUserKey,i=!0),null!=(null===(s=null==n?void 0:n.settings)||void 0===s?void 0:s.protectedPin)&&(yield e.setToUser(t,Mr,n.settings.protectedPin),delete n.settings.protectedPin,i=!0),null!=(null===(a=null===(o=null==n?void 0:n.settings)||void 0===o?void 0:o.pinProtected)||void 0===a?void 0:a.encrypted)&&(yield e.setToUser(t,Nr,n.settings.pinProtected.encrypted),delete n.settings.pinProtected,i=!0),i&&(yield e.set(t,n))})}(t,n))])})}rollback(e){return $r(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(({userId:t,account:i})=>function(t,i){return $r(this,void 0,void 0,function*(){var n;let r=!1;const s=yield e.getFromUser(t,Ur),o=yield e.getFromUser(t,Mr),a=yield e.getFromUser(t,Nr);i||(i={}),null!=s&&(i.settings.pinKeyEncryptedUserKey=s,yield e.setToUser(t,Ur,null),r=!0),null!=o&&(i.settings.protectedPin=o,yield e.setToUser(t,Mr,null),r=!0),null!=a&&(i.settings=Object.assign(null!==(n=i.settings)&&void 0!==n?n:{},{pinProtected:{encrypted:a}}),yield e.setToUser(t,Nr,null),r=!0),r&&(yield e.set(t,i))})}(t,i)))})}}var Br=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const jr={name:"vaultTimeoutSettings"},Gr={key:"vaultTimeout",stateDefinition:jr},Lr={key:"vaultTimeoutAction",stateDefinition:jr},zr={null:"never","-1":"onRestart","-2":"onLocked","-3":"onSleep","-4":"onIdle"},_r={never:null,onRestart:-1,onLocked:-2,onSleep:-3,onIdle:-4};var Kr;!function(e){e.Web="web",e.Browser="browser",e.Desktop="desktop",e.Cli="cli"}(Kr||(Kr={}));class Xr extends Je{migrate(e){return Br(this,void 0,void 0,function*(){const t=yield e.get("global"),i=yield e.getAccounts();yield Promise.all([...i.map(({userId:t,account:i})=>function(t,i){return Br(this,void 0,void 0,function*(){var n,r,s,o;let a=!1,l=null===(n=null==i?void 0:i.settings)||void 0===n?void 0:n.vaultTimeout;if(e.clientType===Kr.Cli&&void 0===l&&(l=null),void 0!==l){if(null===l||l<0){const i=zr[l];yield e.setToUser(t,Gr,i)}else yield e.setToUser(t,Gr,l);null===(r=null==i?void 0:i.settings)||void 0===r||delete r.vaultTimeout,a=!0}const c=null===(s=null==i?void 0:i.settings)||void 0===s?void 0:s.vaultTimeoutAction;null!=c&&(yield e.setToUser(t,Lr,c),null===(o=null==i?void 0:i.settings)||void 0===o||delete o.vaultTimeoutAction,a=!0),a&&(yield e.set(t,i))})}(t,i))]),null==t||delete t.vaultTimeout,null==t||delete t.vaultTimeoutAction,yield e.set("global",t),yield e.remove("global\\.vaultTimeout"),yield e.remove("global\\.vaultTimeoutAction")})}rollback(e){return Br(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Br(this,void 0,void 0,function*(){let n=!1;const r=yield e.getFromUser(t,Gr);(null==i?void 0:i.settings)&&null!=r&&(i.settings.vaultTimeout="string"==typeof r?_r[r]:r,n=!0),yield e.setToUser(t,Gr,null);const s=yield e.getFromUser(t,Lr);(null==i?void 0:i.settings)&&null!=s&&(i.settings.vaultTimeoutAction=s,n=!0),yield e.setToUser(t,Lr,null),n&&(yield e.set(t,i))})}(t,i))])})}}var qr=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Wr={stateDefinition:{name:"generator"},key:"generatorSettings"},Yr={stateDefinition:{name:"generator"},key:"passwordGeneratorSettings"},Hr={stateDefinition:{name:"generator"},key:"passphraseGeneratorSettings"};class Jr extends Je{migrate(e){return qr(this,void 0,void 0,function*(){const t=yield e.getAccounts();function i(t,i){return qr(this,void 0,void 0,function*(){var n;const r=null===(n=null==i?void 0:i.settings)||void 0===n?void 0:n.passwordGenerationOptions;if(r){const n=function(e){const t={length:e.length,ambiguous:e.ambiguous,uppercase:e.uppercase,minUppercase:e.minUppercase,lowercase:e.lowercase,minLowercase:e.minLowercase,number:e.number,minNumber:e.minNumber,special:e.special,minSpecial:e.minSpecial},i={type:e.type},n={numWords:e.numWords,wordSeparator:e.wordSeparator,capitalize:e.capitalize,includeNumber:e.includeNumber};return{generator:i,password:t,passphrase:n}}(r);yield function(e,t,i){return qr(this,void 0,void 0,function*(){var n;const r=null!==(n=yield e.getFromUser(t,Wr))&&void 0!==n?n:{},s=Object.assign(r,i.generator);yield Promise.all([e.setToUser(t,Wr,s),e.setToUser(t,Hr,i.passphrase),e.setToUser(t,Yr,i.password)])})}(e,t,n),yield function(e,t,i){return qr(this,void 0,void 0,function*(){var n;null===(n=null==i?void 0:i.settings)||void 0===n||delete n.passwordGenerationOptions,yield e.set(t,i)})}(e,t,i)}})}yield Promise.all([...t.map(({userId:e,account:t})=>i(e,t))])})}rollback(e){return qr(this,void 0,void 0,function*(){})}}var Zr=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Qr={stateDefinition:{name:"generator"},key:"localGeneratorHistoryBuffer"};class es extends Je{migrate(e){return Zr(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Zr(this,void 0,void 0,function*(){var n;const r=null===(n=null==i?void 0:i.data)||void 0===n?void 0:n.passwordGenerationHistory;r&&r.encrypted&&(yield e.setToUser(t,Qr,r.encrypted),delete i.data.passwordGenerationHistory,yield e.set(t,i))})}(t,i))])})}rollback(e){return Zr(this,void 0,void 0,function*(){})}}var ts=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const is={stateDefinition:{name:"generator"},key:"generatorSettings"},ns={stateDefinition:{name:"generator"},key:"catchallGeneratorSettings"},rs={stateDefinition:{name:"generator"},key:"effUsernameGeneratorSettings"},ss={stateDefinition:{name:"generator"},key:"subaddressGeneratorSettings"},os={stateDefinition:{name:"generator"},key:"addyIoBuffer"},as={stateDefinition:{name:"generator"},key:"duckDuckGoBuffer"},ls={stateDefinition:{name:"generator"},key:"fastmailBuffer"},cs={stateDefinition:{name:"generator"},key:"firefoxRelayBuffer"},us={stateDefinition:{name:"generator"},key:"forwardEmailBuffer"},ds={stateDefinition:{name:"generator"},key:"simpleLoginBuffer"};class hs extends Je{migrate(e){return ts(this,void 0,void 0,function*(){const t=yield e.getAccounts();function i(t,i){return ts(this,void 0,void 0,function*(){var n;const r=null===(n=null==i?void 0:i.settings)||void 0===n?void 0:n.usernameGenerationOptions;if(r){const n=function(e){const t={addyIo:{baseUrl:e.forwardedAnonAddyBaseUrl,token:e.forwardedAnonAddyApiToken,domain:e.forwardedAnonAddyDomain},duckDuckGo:{token:e.forwardedDuckDuckGoToken},fastmail:{token:e.forwardedFastmailApiToken},firefoxRelay:{token:e.forwardedFirefoxApiToken},forwardEmail:{token:e.forwardedForwardEmailApiToken,domain:e.forwardedForwardEmailDomain},simpleLogin:{token:e.forwardedSimpleLoginApiKey,baseUrl:e.forwardedSimpleLoginBaseUrl}},i={username:e.type,forwarder:e.forwardedService},n={effUsername:{wordCapitalize:e.wordCapitalize,wordIncludeNumber:e.wordIncludeNumber},subaddress:{subaddressType:e.subaddressType,subaddressEmail:e.subaddressEmail},catchall:{catchallType:e.catchallType,catchallDomain:e.catchallDomain}};return{generator:i,algorithms:n,forwarders:t}}(r);yield function(e,t,i){return ts(this,void 0,void 0,function*(){yield Promise.all([e.setToUser(t,is,i.generator),e.setToUser(t,ns,i.algorithms.catchall),e.setToUser(t,rs,i.algorithms.effUsername),e.setToUser(t,ss,i.algorithms.subaddress),e.setToUser(t,os,i.forwarders.addyIo),e.setToUser(t,as,i.forwarders.duckDuckGo),e.setToUser(t,ls,i.forwarders.fastmail),e.setToUser(t,cs,i.forwarders.firefoxRelay),e.setToUser(t,us,i.forwarders.forwardEmail),e.setToUser(t,ds,i.forwarders.simpleLogin)])})}(e,t,n),yield function(e,t,i){return ts(this,void 0,void 0,function*(){var n;null===(n=null==i?void 0:i.settings)||void 0===n||delete n.usernameGenerationOptions,yield e.set(t,i)})}(e,t,i)}})}yield Promise.all([...t.map(({userId:e,account:t})=>i(e,t))])})}rollback(e){return ts(this,void 0,void 0,function*(){})}}var ps=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const vs={name:"desktopSettings"},fs={key:"browserIntegrationEnabled",stateDefinition:vs},ms={key:"browserIntegrationFingerprintEnabled",stateDefinition:vs},gs={key:"minimizeOnCopy",stateDefinition:vs};class ys extends Je{migrate(e){return ps(this,void 0,void 0,function*(){const t=yield e.get("global"),i=null==t?void 0:t.enableBrowserIntegration,n=null==t?void 0:t.enableBrowserIntegrationFingerprint;let r=!1;null!=i&&(yield e.setToGlobal(fs,i),delete t.enableBrowserIntegration,r=!0),null!=n&&(yield e.setToGlobal(ms,n),delete t.enableBrowserIntegrationFingerprint,r=!0),r&&(yield e.set("global",t));const s=yield e.getAccounts();yield Promise.all(s.map(({userId:t,account:i})=>function(t,i){return ps(this,void 0,void 0,function*(){var n;const r=null===(n=null==i?void 0:i.settings)||void 0===n?void 0:n.minimizeOnCopyToClipboard;null!=r&&(yield e.setToUser(t,gs,r),delete i.settings.minimizeOnCopyToClipboard,yield e.set(t,i))})}(t,i)))})}rollback(e){return ps(this,void 0,void 0,function*(){const t=yield e.getFromGlobal(fs),i=yield e.getFromGlobal(ms);if(null!=t){let i=yield e.get("global");null!=i||(i={}),i.enableBrowserIntegration=t,yield e.set("global",i),yield e.removeFromGlobal(fs)}if(null!=i){let t=yield e.get("global");null!=t||(t={}),t.enableBrowserIntegrationFingerprint=i,yield e.set("global",t),yield e.removeFromGlobal(ms)}const n=yield e.getAccounts();yield Promise.all(n.map(({userId:t,account:i})=>function(t,i){return ps(this,void 0,void 0,function*(){const n=yield e.getFromUser(t,gs);null!=n&&(null!=i||(i={settings:{}}),i.settings.minimizeOnCopyToClipboard=n,yield e.set(t,i),yield e.removeFromUser(t,gs))})}(t,i)))})}}var bs=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const ws={key:"showBanner",stateDefinition:{name:"unassignedItemsBanner"}};class Ss extends Je{migrate(e){return bs(this,void 0,void 0,function*(){yield Promise.all((yield e.getAccounts()).map(t=>bs(this,[t],void 0,function*({userId:t}){null!=e.getFromUser(t,ws)&&(yield e.removeFromUser(t,ws))})))})}rollback(e){return bs(this,void 0,void 0,function*(){throw He})}}var ks=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Is={key:"lastSync",stateDefinition:{name:"sync"}};class Cs extends Je{migrate(e){return ks(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(({userId:t,account:i})=>function(t,i){return ks(this,void 0,void 0,function*(){var n;const r=null===(n=null==i?void 0:i.profile)||void 0===n?void 0:n.lastSync;null!=r&&(yield e.setToUser(t,Is,r),delete i.profile.lastSync,yield e.set(t,i))})}(t,i)))})}rollback(e){return ks(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(({userId:t,account:i})=>function(t,i){return ks(this,void 0,void 0,function*(){var n;const r=yield e.getFromUser(t,Is);null!=r&&(null!=i||(i={}),null!==(n=i.profile)&&void 0!==n||(i.profile={}),i.profile.lastSync=r,yield e.set(t,i),yield e.removeFromUser(t,Is))})}(t,i)))})}}var Ts=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Ps={key:"folder",stateDefinition:{name:"folder"}},Fs={key:"folders",stateDefinition:{name:"folder"}};class Rs extends Je{migrate(e){return Ts(this,void 0,void 0,function*(){const t=yield e.getKnownUserIds();yield Promise.all(t.map(t=>function(t){return Ts(this,void 0,void 0,function*(){const i=yield e.getFromUser(t,Ps);null!=i&&(yield e.setToUser(t,Fs,i)),yield e.removeFromUser(t,Ps)})}(t)))})}rollback(e){return Ts(this,void 0,void 0,function*(){const t=yield e.getKnownUserIds();yield Promise.all(t.map(t=>function(t){return Ts(this,void 0,void 0,function*(){const i=yield e.getFromUser(t,Fs);null!=i&&(yield e.setToUser(t,Ps,i)),yield e.removeFromUser(t,Fs)})}(t)))})}}var xs=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class As extends Je{migrate(e){return xs(this,void 0,void 0,function*(){var t;const i=yield e.get("global"),n=null!==(t=null==i?void 0:i.noAutoPromptBiometrics)&&void 0!==t&&t,r=yield e.getAccounts();delete i.noAutoPromptBiometrics,yield Promise.all([...r.map(({userId:t,account:i})=>function(t,i){return xs(this,void 0,void 0,function*(){var r;null!=i&&n&&(i.settings=Object.assign(null!==(r=null==i?void 0:i.settings)&&void 0!==r?r:{},{disableAutoBiometricsPrompt:!0}),yield e.set(t,i))})}(t,i)),e.set("global",i)])})}rollback(e){return xs(this,void 0,void 0,function*(){throw He})}updateVersion(e,t){return xs(this,void 0,void 0,function*(){const i="up"===t?this.toVersion:this.fromVersion;e.currentVersion=i;const n=(yield e.get("global"))||{};yield e.set("global",Object.assign(Object.assign({},n),{stateVersion:i}))})}}var Ds=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Es={key:"acBannersDismissed",stateDefinition:{name:"showProviderClientVaultPrivacyBanner"}};class $s extends Je{migrate(e){return Ds(this,void 0,void 0,function*(){yield Promise.all((yield e.getAccounts()).map(t=>Ds(this,[t],void 0,function*({userId:t}){null!=e.getFromUser(t,Es)&&(yield e.removeFromUser(t,Es))})))})}rollback(e){return Ds(this,void 0,void 0,function*(){throw He})}}var Os=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Us={key:"newCustomizationOptionsCalloutDismissed",stateDefinition:{name:"bannersDismissed"}};class Ms extends Je{migrate(e){return Os(this,void 0,void 0,function*(){yield Promise.all((yield e.getAccounts()).map(t=>Os(this,[t],void 0,function*({userId:t}){null!=e.getFromUser(t,Us)&&(yield e.removeFromUser(t,Us))})))})}rollback(e){return Os(this,void 0,void 0,function*(){throw He})}}var Ns=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Vs={key:"showAccountDeprovisioningBanner",stateDefinition:{name:"accountDeprovisioningBanner"}};class Bs extends Je{migrate(e){return Ns(this,void 0,void 0,function*(){yield Promise.all((yield e.getAccounts()).map(t=>Ns(this,[t],void 0,function*({userId:t}){null!=e.getFromUser(t,Vs)&&(yield e.removeFromUser(t,Vs))})))})}rollback(e){return Ns(this,void 0,void 0,function*(){throw He})}}var js=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Gs={stateDefinition:{name:"account"},key:"accounts"},Ls={key:"masterPasswordUnlockKey",stateDefinition:{name:"masterPasswordUnlock"}},zs={key:"masterKeyEncryptedUserKey",stateDefinition:{name:"masterPassword"}},_s={key:"kdfConfig",stateDefinition:{name:"kdfConfig"}};class Ks extends Je{migrate(e){return js(this,void 0,void 0,function*(){const t=yield e.getFromGlobal(Gs),i=yield e.getAccounts();yield Promise.all(i.map(({userId:i})=>function(t,i){return js(this,void 0,void 0,function*(){const n=null==i?void 0:i.email,r=yield e.getFromUser(t,_s),s=yield e.getFromUser(t,zs);null==(yield e.getFromUser(t,Ls))&&null!=n&&null!=r&&null!=s&&(yield e.setToUser(t,Ls,{salt:n.trim().toLowerCase(),kdf:r,masterKeyWrappedUserKey:s}))})}(i,t[i])))})}rollback(e){return js(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all(t.map(({userId:t})=>function(t){return js(this,void 0,void 0,function*(){null!=(yield e.getFromUser(t,Ls))&&(yield e.removeFromUser(t,Ls))})}(t)))})}}var Xs=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const qs={key:"pinKeyEncryptedUserKeyPersistent",stateDefinition:{name:"pinUnlock"}};class Ws extends Je{migrate(e){return Xs(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t){return Xs(this,void 0,void 0,function*(){null!=(yield e.getFromUser(t,qs))&&(yield e.removeFromUser(t,qs))})}(t))])})}rollback(e){return Xs(this,void 0,void 0,function*(){throw He})}}var Ys=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Hs={key:"privateKey",stateDefinition:{name:"crypto"}},Js={key:"userSigningKey",stateDefinition:{name:"crypto"}},Zs={key:"userSignedPublicKey",stateDefinition:{name:"crypto"}},Qs={key:"accountSecurityState",stateDefinition:{name:"crypto"}},eo={key:"accountCryptographicState",stateDefinition:{name:"crypto"}};class to extends Je{migrate(e){return Ys(this,void 0,void 0,function*(){const t=yield e.getAccounts();for(const{userId:i}of t){const t=yield e.getFromUser(i,eo),n=yield e.getFromUser(i,Hs),r=yield e.getFromUser(i,Js),s=yield e.getFromUser(i,Zs),o=yield e.getFromUser(i,Qs);if(!t){let t;null!=n&&null==r&&null==s&&null==o?(t={V1:{private_key:n}},yield e.setToUser(i,eo,t)):null!=n&&null!=r&&null!=s&&null!=o?(t={V2:{private_key:n,signing_key:r,signed_public_key:s,security_state:o}},yield e.setToUser(i,eo,t)):e.logService.warning(`Incomplete cryptographic state for user ${i}, skipping migration of account cryptographic state.`)}null!=n&&(yield e.removeFromUser(i,Hs)),null!=r&&(yield e.removeFromUser(i,Js)),null!=s&&(yield e.removeFromUser(i,Zs)),null!=o&&(yield e.removeFromUser(i,Qs))}})}rollback(e){return Ys(this,void 0,void 0,function*(){throw He})}}var io=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class no extends Je{migrate(e){return io(this,void 0,void 0,function*(){const t=yield e.get("global");if(!t.stateVersion)throw new Error("Migration failed, state version not found");yield e.set("stateVersion",t.stateVersion),delete t.stateVersion,yield e.set("global",t)})}rollback(e){return io(this,void 0,void 0,function*(){const t=yield e.get("stateVersion"),i=yield e.get("global");yield e.set("global",Object.assign(Object.assign({},i),{stateVersion:t})),yield e.set("stateVersion",void 0)})}updateVersion(e,t){return io(this,void 0,void 0,function*(){const i="up"===t?this.toVersion:this.fromVersion;if(e.currentVersion=i,"up"===t)yield e.set("stateVersion",i);else{const t=(yield e.get("global"))||{};yield e.set("global",Object.assign(Object.assign({},t),{stateVersion:i}))}})}}var ro=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class so extends Je{tryAddSetting(e,t,i){if(e.some(({account:e})=>void 0!==t(e))){const n=!e.some(({account:e})=>{var i;return!1===(null!==(i=t(e))&&void 0!==i&&i)});i(n)}}migrate(e){return ro(this,void 0,void 0,function*(){const t=yield e.get("global"),i=yield e.getAccounts(),n=i.reduce((e,{account:t})=>{var i,n;const r=null!==(n=null===(i=t.settings)||void 0===i?void 0:i.neverDomains)&&void 0!==n?n:{};for(const[t,i]of Object.entries(r))null!=e||(e={}),e[t]=i;return e},void 0),r={};null!=n&&(r.neverDomains=n),this.tryAddSetting(i,e=>{var t;return null===(t=e.settings)||void 0===t?void 0:t.disableAddLoginNotification},e=>r.disableAddLoginNotification=e),this.tryAddSetting(i,e=>{var t;return null===(t=e.settings)||void 0===t?void 0:t.disableChangedPasswordNotification},e=>r.disableChangedPasswordNotification=e),this.tryAddSetting(i,e=>{var t;return null===(t=e.settings)||void 0===t?void 0:t.disableContextMenuItem},e=>r.disableContextMenuItem=e),yield e.set("global",Object.assign(Object.assign({},t),r)),yield Promise.all(i.map(t=>ro(this,[t],void 0,function*({userId:t,account:i}){var n,r,s,o;null===(n=i.settings)||void 0===n||delete n.disableAddLoginNotification,null===(r=i.settings)||void 0===r||delete r.disableChangedPasswordNotification,null===(s=i.settings)||void 0===s||delete s.disableContextMenuItem,null===(o=i.settings)||void 0===o||delete o.neverDomains,yield e.set(t,i)})))})}rollback(e){throw new Error("Method not implemented.")}}var oo=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class ao extends Je{constructor(){super(0,co)}shouldMigrate(e){return Promise.resolve(e.currentVersion<co)}migrate(e){return oo(this,void 0,void 0,function*(){if(e.currentVersion<co)throw new Error(`Your local data is too old to be migrated. Your current state version is ${e.currentVersion}, but minimum version is ${co}.`)})}rollback(e){return oo(this,void 0,void 0,function*(){throw He})}}var lo=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const co=3;function uo(e,t){return lo(this,void 0,void 0,function*(){var i;let n=yield e.get("stateVersion");return null==n&&(n=null===(i=yield e.get("global"))||void 0===i?void 0:i.stateVersion),null==n?(t.info("No state version found, assuming empty state."),-1):(t.info(`State version: ${n}`),n)})}var ho=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class po{constructor(e,t,i,n,r){this.currentVersion=e,this.storageService=t,this.logService=i,this.clientType=r,this.type=n}get(e){return this.storageService.get(e)}set(e,t){return this.logService.info(`Setting ${e}`),this.storageService.save(e,t)}remove(e){return this.logService.info(`Removing ${e}`),this.storageService.remove(e)}getFromGlobal(e){return this.get(this.getGlobalKey(e))}setToGlobal(e,t){return this.set(this.getGlobalKey(e),t)}removeFromGlobal(e){return this.remove(this.getGlobalKey(e))}getFromUser(e,t){return this.get(this.getUserKey(e,t))}setToUser(e,t,i){return this.set(this.getUserKey(e,t),i)}removeFromUser(e,t){return this.remove(this.getUserKey(e,t))}info(e){this.logService.info(e)}getAccounts(){return ho(this,void 0,void 0,function*(){const e=yield this.getKnownUserIds();return Promise.all(e.map(e=>ho(this,void 0,void 0,function*(){return{userId:e,account:yield this.get(e)}})))})}getKnownUserIds(){return ho(this,void 0,void 0,function*(){return this.currentVersion<60?function(e){return ho(this,void 0,void 0,function*(){var t;return null!==(t=yield e.get("authenticatedAccounts"))&&void 0!==t?t:[]})}(this.storageService):function(e){return ho(this,void 0,void 0,function*(){const t=yield e.get(vo({stateDefinition:{name:"account"},key:"accounts"}));return Object.keys(null!=t?t:{})})}(this.storageService)})}getUserKey(e,t){return this.currentVersion<9?function(){throw Error("No key builder should be used for versions prior to 9.")}():function(e,t){return`user_${e}_${t.stateDefinition.name}_${t.key}`}(e,t)}getGlobalKey(e){return this.currentVersion<9?function(){throw Error("No key builder should be used for versions prior to 9.")}():vo(e)}}function vo(e){return`global_${e.stateDefinition.name}_${e.key}`}class fo{}var mo=i(34040),go=i(44500),yo=i(81714),bo=i(72245),wo=i(22485),So=i(37567),ko=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Io{constructor(e,t,i){this.keyDefinition=e,this.activeUserId$=t,this.singleUserStateProvider=i,this.combinedState$=this.activeUserId$.pipe((0,go.n)(e=>null!=e?this.singleUserStateProvider.get(e,this.keyDefinition).combinedState$:yo.t)),this.state$=this.combinedState$.pipe((0,l.T)(([e,t])=>t))}update(e){return ko(this,arguments,void 0,function*(e,t={}){const i=yield(0,bo._)(this.activeUserId$.pipe((0,wo.w)({first:1e3,with:()=>(0,So.$)(()=>new Error(`Timeout while retrieving active user for key ${this.keyDefinition.fullName}.`))})));if(null==i)throw new Error(`Error storing ${this.keyDefinition.fullName} for the active user: No active user at this time.`);return[i,yield this.singleUserStateProvider.get(i,this.keyDefinition).update(e,t)]})}}var Co=i(98908),To=i(73276),Po=i(83892),Fo=i(3097),Ro=i(72737),xo=i(8029),Ao=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Do{constructor(e,t,i){this.parentState$=e,this.deriveDefinition=t,this.dependencies=i,this.forcedValueSubject=new Co.B,this.storageKey=t.storageKey;const n=this.parentState$.pipe((0,To.H)(e=>Ao(this,void 0,void 0,function*(){let t=this.deriveDefinition.derive(e,this.dependencies);t instanceof Promise&&(t=yield t);return t})));this.state$=(0,Po.h)(this.forcedValueSubject,n).pipe((0,Fo.u)({connector:()=>new Ro.m(1),resetOnRefCountZero:()=>(0,xo.O)(this.deriveDefinition.cleanupDelayMs)}))}forceValue(e){return Ao(this,void 0,void 0,function*(){return this.forcedValueSubject.next(e),e})}}var Eo=i(69194),$o=i(43008),Oo=i(36359),Uo=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function Mo(e,t,i){return Uo(this,void 0,void 0,function*(){if(t.valuesRequireDeserialization){const n=yield t.get(e);return i(n)}{const i=yield t.get(e);return null!=i?i:null}})}var No=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Vo{constructor(e,t,i,n){this.key=e,this.storageService=t,this.keyDefinition=i,this.logService=n;const r=t.updates$.pipe((0,Eo.p)(t=>t.key===e),(0,go.n)(n=>No(this,void 0,void 0,function*(){return"remove"===n.updateType?null:yield Mo(e,t,i.deserializer)})));let s=(0,Po.h)((0,$o.v)(()=>Mo(e,t,i.deserializer)),r);i.debug.enableRetrievalLogging&&(s=s.pipe((0,Oo.M)({next:t=>{this.logService.info(`Retrieving '${e}' from storage, value is ${null==t?"null":"non-null"}`)}}))),0!==i.cleanupDelayMs&&(s=s.pipe((0,Fo.u)({connector:()=>new Ro.m(1),resetOnRefCountZero:()=>(0,xo.O)(i.cleanupDelayMs)}))),this.state$=s}update(e){return No(this,arguments,void 0,function*(e,t={}){const i=function(e){const{combineLatestWith:t=null,shouldUpdate:i=()=>!0,msTimeout:n=1e3}=e;return{combineLatestWith:t,shouldUpdate:i,msTimeout:n}}(t);null!=this.updatePromise&&(yield this.updatePromise);try{return this.updatePromise=this.internalUpdate(e,i),yield this.updatePromise}finally{this.updatePromise=null}})}internalUpdate(e,t){return No(this,void 0,void 0,function*(){const i=yield this.getStateForUpdate(),n=null!=t.combineLatestWith?yield(0,bo._)(t.combineLatestWith.pipe((0,wo.w)(t.msTimeout))):null;if(!t.shouldUpdate(i,n))return i;const r=e(i,n);return yield this.doStorageSave(r,i),r})}doStorageSave(e,t){return No(this,void 0,void 0,function*(){this.keyDefinition.debug.enableUpdateLogging&&this.logService.info(`Updating '${this.key}' from ${null==t?"null":"non-null"} to ${null==e?"null":"non-null"}`),yield this.storageService.save(this.key,e)})}getStateForUpdate(){return No(this,void 0,void 0,function*(){return yield Mo(this.key,this.storageService,this.keyDefinition.deserializer)})}}class Bo extends Vo{constructor(e,t,i){super(function(e){return`global_${e.stateDefinition.name}_${e.key}`}(e),t,e,i)}}var jo=i(33338),Go=i(93695),Lo=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class zo extends Vo{constructor(e,t,i,n,r){super(t.buildKey(e),i,t,r),this.userId=e,this.stateEventRegistrarService=n,this.combinedState$=(0,jo.z)([(0,Go.of)(e),this.state$])}doStorageSave(e,t){const i=Object.create(null,{doStorageSave:{get:()=>super.doStorageSave}});return Lo(this,void 0,void 0,function*(){yield i.doStorageSave.call(this,e,t),yield this.stateEventRegistrarService.registerEvents(this.keyDefinition)})}}var _o=i(58363),Ko=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Xo=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class qo{constructor(e,t,i){this.state$=e.pipe((0,To.H)(e=>Xo(this,void 0,void 0,function*(){return yield t.derive(e,i)})))}forceValue(e){return Promise.resolve(e)}}class Wo{}class Yo{}var Ho=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Jo="global",Zo="_user_auto",Qo="_user_biometric",ea="DuckDuckGoSharedKey";var ta=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const ia=m.array(ie,"lock",{deserializer:e=>e}),na=m.array(ie,"logout",{deserializer:e=>e});var ra=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var sa=i(25479),oa=i(30082),aa=i(48479);const la=["/","-","."," "],ca="\\"+la.join("\\").replace(" ","s"),ua=(new RegExp(`[${ca}]`,"g"),new RegExp(`[^\\d${ca}]`,"g"),new RegExp("^(([1]{1}[0-2]{1})|(0?[1-9]{1}))$"),new RegExp("^2[0-1]{1}\\d{2}$"),null),da=10,ha=20,pa=30,va=60,fa=120,ma=300,ga="autofill",ya="copy-password",ba="copy-totp",wa=0,Sa=1,ka=2,Ia="Chrome",Ca="Opera",Ta="Edge",Pa="Vivaldi",Fa="Unknown",Ra={Chrome:"chrome://extensions/shortcuts",Opera:"opera://extensions/shortcuts",Edge:"edge://extensions/shortcuts",Vivaldi:"vivaldi://extensions/shortcuts",Unknown:"https://bitwarden.com/help/keyboard-shortcuts"},xa={Chrome:"chrome://settings/autofill",Opera:"opera://settings/autofill",Edge:"edge://settings/passwords",Vivaldi:"vivaldi://settings/autofill",Unknown:"https://bitwarden.com/help/disable-browser-autofill/"},Aa="autofill_login";var Da,Ea;!function(e){e.Web="web",e.Browser="browser",e.Desktop="desktop",e.Cli="cli"}(Da||(Da={})),function(e){e[e.Android=0]="Android",e[e.iOS=1]="iOS",e[e.ChromeExtension=2]="ChromeExtension",e[e.FirefoxExtension=3]="FirefoxExtension",e[e.OperaExtension=4]="OperaExtension",e[e.EdgeExtension=5]="EdgeExtension",e[e.WindowsDesktop=6]="WindowsDesktop",e[e.MacOsDesktop=7]="MacOsDesktop",e[e.LinuxDesktop=8]="LinuxDesktop",e[e.ChromeBrowser=9]="ChromeBrowser",e[e.FirefoxBrowser=10]="FirefoxBrowser",e[e.OperaBrowser=11]="OperaBrowser",e[e.EdgeBrowser=12]="EdgeBrowser",e[e.IEBrowser=13]="IEBrowser",e[e.UnknownBrowser=14]="UnknownBrowser",e[e.AndroidAmazon=15]="AndroidAmazon",e[e.UWP=16]="UWP",e[e.SafariBrowser=17]="SafariBrowser",e[e.VivaldiBrowser=18]="VivaldiBrowser",e[e.VivaldiExtension=19]="VivaldiExtension",e[e.SafariExtension=20]="SafariExtension",e[e.SDK=21]="SDK",e[e.Server=22]="Server",e[e.WindowsCLI=23]="WindowsCLI",e[e.MacOsCLI=24]="MacOsCLI",e[e.LinuxCLI=25]="LinuxCLI",e[e.DuckDuckGoBrowser=26]="DuckDuckGoBrowser"}(Ea||(Ea={}));const $a={[Ea.Android]:{category:"mobile",platform:"Android"},[Ea.iOS]:{category:"mobile",platform:"iOS"},[Ea.AndroidAmazon]:{category:"mobile",platform:"Amazon"},[Ea.ChromeExtension]:{category:"extension",platform:"Chrome"},[Ea.FirefoxExtension]:{category:"extension",platform:"Firefox"},[Ea.OperaExtension]:{category:"extension",platform:"Opera"},[Ea.EdgeExtension]:{category:"extension",platform:"Edge"},[Ea.VivaldiExtension]:{category:"extension",platform:"Vivaldi"},[Ea.SafariExtension]:{category:"extension",platform:"Safari"},[Ea.ChromeBrowser]:{category:"webApp",platform:"Chrome"},[Ea.FirefoxBrowser]:{category:"webApp",platform:"Firefox"},[Ea.OperaBrowser]:{category:"webApp",platform:"Opera"},[Ea.EdgeBrowser]:{category:"webApp",platform:"Edge"},[Ea.IEBrowser]:{category:"webApp",platform:"IE"},[Ea.SafariBrowser]:{category:"webApp",platform:"Safari"},[Ea.VivaldiBrowser]:{category:"webApp",platform:"Vivaldi"},[Ea.DuckDuckGoBrowser]:{category:"webApp",platform:"DuckDuckGo"},[Ea.UnknownBrowser]:{category:"webApp",platform:"Unknown"},[Ea.WindowsDesktop]:{category:"desktop",platform:"Windows"},[Ea.MacOsDesktop]:{category:"desktop",platform:"macOS"},[Ea.LinuxDesktop]:{category:"desktop",platform:"Linux"},[Ea.UWP]:{category:"desktop",platform:"Windows UWP"},[Ea.WindowsCLI]:{category:"cli",platform:"Windows"},[Ea.MacOsCLI]:{category:"cli",platform:"macOS"},[Ea.LinuxCLI]:{category:"cli",platform:"Linux"},[Ea.SDK]:{category:"sdk",platform:""},[Ea.Server]:{category:"server",platform:""}};var Oa,Ua,Ma,Na,Va,Ba;!function(e){e[e.SCIM=1]="SCIM",e[e.DomainVerification=2]="DomainVerification",e[e.PublicApi=3]="PublicApi",e[e.BitwardenPortal=5]="BitwardenPortal"}(Oa||(Oa={})),function(e){e[e.User_LoggedIn=1e3]="User_LoggedIn",e[e.User_ChangedPassword=1001]="User_ChangedPassword",e[e.User_Updated2fa=1002]="User_Updated2fa",e[e.User_Disabled2fa=1003]="User_Disabled2fa",e[e.User_Recovered2fa=1004]="User_Recovered2fa",e[e.User_FailedLogIn=1005]="User_FailedLogIn",e[e.User_FailedLogIn2fa=1006]="User_FailedLogIn2fa",e[e.User_ClientExportedVault=1007]="User_ClientExportedVault",e[e.User_UpdatedTempPassword=1008]="User_UpdatedTempPassword",e[e.User_MigratedKeyToKeyConnector=1009]="User_MigratedKeyToKeyConnector",e[e.User_RequestedDeviceApproval=1010]="User_RequestedDeviceApproval",e[e.User_TdeOffboardingPasswordSet=1011]="User_TdeOffboardingPasswordSet",e[e.Cipher_Created=1100]="Cipher_Created",e[e.Cipher_Updated=1101]="Cipher_Updated",e[e.Cipher_Deleted=1102]="Cipher_Deleted",e[e.Cipher_AttachmentCreated=1103]="Cipher_AttachmentCreated",e[e.Cipher_AttachmentDeleted=1104]="Cipher_AttachmentDeleted",e[e.Cipher_Shared=1105]="Cipher_Shared",e[e.Cipher_UpdatedCollections=1106]="Cipher_UpdatedCollections",e[e.Cipher_ClientViewed=1107]="Cipher_ClientViewed",e[e.Cipher_ClientToggledPasswordVisible=1108]="Cipher_ClientToggledPasswordVisible",e[e.Cipher_ClientToggledHiddenFieldVisible=1109]="Cipher_ClientToggledHiddenFieldVisible",e[e.Cipher_ClientToggledCardCodeVisible=1110]="Cipher_ClientToggledCardCodeVisible",e[e.Cipher_ClientCopiedPassword=1111]="Cipher_ClientCopiedPassword",e[e.Cipher_ClientCopiedHiddenField=1112]="Cipher_ClientCopiedHiddenField",e[e.Cipher_ClientCopiedCardCode=1113]="Cipher_ClientCopiedCardCode",e[e.Cipher_ClientAutofilled=1114]="Cipher_ClientAutofilled",e[e.Cipher_SoftDeleted=1115]="Cipher_SoftDeleted",e[e.Cipher_Restored=1116]="Cipher_Restored",e[e.Cipher_ClientToggledCardNumberVisible=1117]="Cipher_ClientToggledCardNumberVisible",e[e.Cipher_ClientToggledTOTPSeedVisible=1118]="Cipher_ClientToggledTOTPSeedVisible",e[e.Collection_Created=1300]="Collection_Created",e[e.Collection_Updated=1301]="Collection_Updated",e[e.Collection_Deleted=1302]="Collection_Deleted",e[e.Group_Created=1400]="Group_Created",e[e.Group_Updated=1401]="Group_Updated",e[e.Group_Deleted=1402]="Group_Deleted",e[e.OrganizationUser_Invited=1500]="OrganizationUser_Invited",e[e.OrganizationUser_Confirmed=1501]="OrganizationUser_Confirmed",e[e.OrganizationUser_Updated=1502]="OrganizationUser_Updated",e[e.OrganizationUser_Removed=1503]="OrganizationUser_Removed",e[e.OrganizationUser_UpdatedGroups=1504]="OrganizationUser_UpdatedGroups",e[e.OrganizationUser_UnlinkedSso=1505]="OrganizationUser_UnlinkedSso",e[e.OrganizationUser_ResetPassword_Enroll=1506]="OrganizationUser_ResetPassword_Enroll",e[e.OrganizationUser_ResetPassword_Withdraw=1507]="OrganizationUser_ResetPassword_Withdraw",e[e.OrganizationUser_AdminResetPassword=1508]="OrganizationUser_AdminResetPassword",e[e.OrganizationUser_ResetSsoLink=1509]="OrganizationUser_ResetSsoLink",e[e.OrganizationUser_FirstSsoLogin=1510]="OrganizationUser_FirstSsoLogin",e[e.OrganizationUser_Revoked=1511]="OrganizationUser_Revoked",e[e.OrganizationUser_Restored=1512]="OrganizationUser_Restored",e[e.OrganizationUser_ApprovedAuthRequest=1513]="OrganizationUser_ApprovedAuthRequest",e[e.OrganizationUser_RejectedAuthRequest=1514]="OrganizationUser_RejectedAuthRequest",e[e.OrganizationUser_Deleted=1515]="OrganizationUser_Deleted",e[e.OrganizationUser_Left=1516]="OrganizationUser_Left",e[e.OrganizationUser_AutomaticallyConfirmed=1517]="OrganizationUser_AutomaticallyConfirmed",e[e.Organization_Updated=1600]="Organization_Updated",e[e.Organization_PurgedVault=1601]="Organization_PurgedVault",e[e.Organization_ClientExportedVault=1602]="Organization_ClientExportedVault",e[e.Organization_VaultAccessed=1603]="Organization_VaultAccessed",e[e.Organization_EnabledSso=1604]="Organization_EnabledSso",e[e.Organization_DisabledSso=1605]="Organization_DisabledSso",e[e.Organization_EnabledKeyConnector=1606]="Organization_EnabledKeyConnector",e[e.Organization_DisabledKeyConnector=1607]="Organization_DisabledKeyConnector",e[e.Organization_SponsorshipsSynced=1608]="Organization_SponsorshipsSynced",e[e.Organization_CollectionManagementUpdated=1609]="Organization_CollectionManagementUpdated",e[e.Organization_CollectionManagement_LimitCollectionCreationEnabled=1610]="Organization_CollectionManagement_LimitCollectionCreationEnabled",e[e.Organization_CollectionManagement_LimitCollectionCreationDisabled=1611]="Organization_CollectionManagement_LimitCollectionCreationDisabled",e[e.Organization_CollectionManagement_LimitCollectionDeletionEnabled=1612]="Organization_CollectionManagement_LimitCollectionDeletionEnabled",e[e.Organization_CollectionManagement_LimitCollectionDeletionDisabled=1613]="Organization_CollectionManagement_LimitCollectionDeletionDisabled",e[e.Organization_CollectionManagement_LimitItemDeletionEnabled=1614]="Organization_CollectionManagement_LimitItemDeletionEnabled",e[e.Organization_CollectionManagement_LimitItemDeletionDisabled=1615]="Organization_CollectionManagement_LimitItemDeletionDisabled",e[e.Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsEnabled=1616]="Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsEnabled",e[e.Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsDisabled=1617]="Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsDisabled",e[e.Organization_ItemOrganization_Accepted=1618]="Organization_ItemOrganization_Accepted",e[e.Organization_ItemOrganization_Declined=1619]="Organization_ItemOrganization_Declined",e[e.Organization_AutoConfirmEnabled_Admin=1620]="Organization_AutoConfirmEnabled_Admin",e[e.Organization_AutoConfirmDisabled_Admin=1621]="Organization_AutoConfirmDisabled_Admin",e[e.Organization_AutoConfirmEnabled_Portal=1622]="Organization_AutoConfirmEnabled_Portal",e[e.Organization_AutoConfirmDisabled_Portal=1623]="Organization_AutoConfirmDisabled_Portal",e[e.Policy_Updated=1700]="Policy_Updated",e[e.ProviderUser_Invited=1800]="ProviderUser_Invited",e[e.ProviderUser_Confirmed=1801]="ProviderUser_Confirmed",e[e.ProviderUser_Updated=1802]="ProviderUser_Updated",e[e.ProviderUser_Removed=1803]="ProviderUser_Removed",e[e.ProviderOrganization_Created=1900]="ProviderOrganization_Created",e[e.ProviderOrganization_Added=1901]="ProviderOrganization_Added",e[e.ProviderOrganization_Removed=1902]="ProviderOrganization_Removed",e[e.ProviderOrganization_VaultAccessed=1903]="ProviderOrganization_VaultAccessed",e[e.OrganizationDomain_Added=2e3]="OrganizationDomain_Added",e[e.OrganizationDomain_Removed=2001]="OrganizationDomain_Removed",e[e.OrganizationDomain_Verified=2002]="OrganizationDomain_Verified",e[e.OrganizationDomain_NotVerified=2003]="OrganizationDomain_NotVerified",e[e.Secret_Retrieved=2100]="Secret_Retrieved",e[e.Secret_Created=2101]="Secret_Created",e[e.Secret_Edited=2102]="Secret_Edited",e[e.Secret_Deleted=2103]="Secret_Deleted",e[e.Secret_Permanently_Deleted=2104]="Secret_Permanently_Deleted",e[e.Secret_Restored=2105]="Secret_Restored",e[e.Project_Retrieved=2200]="Project_Retrieved",e[e.Project_Created=2201]="Project_Created",e[e.Project_Edited=2202]="Project_Edited",e[e.Project_Deleted=2203]="Project_Deleted",e[e.ServiceAccount_UserAdded=2300]="ServiceAccount_UserAdded",e[e.ServiceAccount_UserRemoved=2301]="ServiceAccount_UserRemoved",e[e.ServiceAccount_GroupAdded=2302]="ServiceAccount_GroupAdded",e[e.ServiceAccount_GroupRemoved=2303]="ServiceAccount_GroupRemoved",e[e.ServiceAccount_Created=2304]="ServiceAccount_Created",e[e.ServiceAccount_Deleted=2305]="ServiceAccount_Deleted"}(Ua||(Ua={})),function(e){e[e.Continue=100]="Continue",e[e.SwitchingProtocols=101]="SwitchingProtocols",e[e.Processing=102]="Processing",e[e.Ok=200]="Ok",e[e.Created=201]="Created",e[e.Accepted=202]="Accepted",e[e.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",e[e.NoContent=204]="NoContent",e[e.ResetContent=205]="ResetContent",e[e.PartialContent=206]="PartialContent",e[e.MultiStatus=207]="MultiStatus",e[e.AlreadyReported=208]="AlreadyReported",e[e.ImUsed=226]="ImUsed",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.Found=302]="Found",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.SwitchProxy=306]="SwitchProxy",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.LengthRequired=411]="LengthRequired",e[e.PreconditionFailed=412]="PreconditionFailed",e[e.PayloadTooLarge=413]="PayloadTooLarge",e[e.UriTooLong=414]="UriTooLong",e[e.UnsupportedMediaType=415]="UnsupportedMediaType",e[e.RangeNotSatisfiable=416]="RangeNotSatisfiable",e[e.ExpectationFailed=417]="ExpectationFailed",e[e.IAmATeapot=418]="IAmATeapot",e[e.MisdirectedRequest=421]="MisdirectedRequest",e[e.UnprocessableEntity=422]="UnprocessableEntity",e[e.Locked=423]="Locked",e[e.FailedDependency=424]="FailedDependency",e[e.UpgradeRequired=426]="UpgradeRequired",e[e.PreconditionRequired=428]="PreconditionRequired",e[e.TooManyRequests=429]="TooManyRequests",e[e.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",e[e.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout",e[e.HttpVersionNotSupported=505]="HttpVersionNotSupported",e[e.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",e[e.InsufficientStorage=507]="InsufficientStorage",e[e.LoopDetected=508]="LoopDetected",e[e.NotExtended=510]="NotExtended",e[e.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired"}(Ma||(Ma={})),function(e){e.Integration="integration",e.SDK="sdk",e.SSO="sso",e.SCIM="scim",e.BWDC="bwdc",e.EVENT="event",e.DEVICE="device"}(Na||(Na={})),function(e){e[e.One=1]="One",e[e.Latest=1]="Latest"}(Va||(Va={})),function(e){e[e.SyncCipherUpdate=0]="SyncCipherUpdate",e[e.SyncCipherCreate=1]="SyncCipherCreate",e[e.SyncLoginDelete=2]="SyncLoginDelete",e[e.SyncFolderDelete=3]="SyncFolderDelete",e[e.SyncCiphers=4]="SyncCiphers",e[e.SyncVault=5]="SyncVault",e[e.SyncOrgKeys=6]="SyncOrgKeys",e[e.SyncFolderCreate=7]="SyncFolderCreate",e[e.SyncFolderUpdate=8]="SyncFolderUpdate",e[e.SyncCipherDelete=9]="SyncCipherDelete",e[e.SyncSettings=10]="SyncSettings",e[e.LogOut=11]="LogOut",e[e.SyncSendCreate=12]="SyncSendCreate",e[e.SyncSendUpdate=13]="SyncSendUpdate",e[e.SyncSendDelete=14]="SyncSendDelete",e[e.AuthRequest=15]="AuthRequest",e[e.AuthRequestResponse=16]="AuthRequestResponse",e[e.SyncOrganizations=17]="SyncOrganizations",e[e.SyncOrganizationStatusChanged=18]="SyncOrganizationStatusChanged",e[e.SyncOrganizationCollectionSettingChanged=19]="SyncOrganizationCollectionSettingChanged",e[e.Notification=20]="Notification",e[e.NotificationStatus=21]="NotificationStatus",e[e.RefreshSecurityTasks=22]="RefreshSecurityTasks",e[e.OrganizationBankAccountVerified=23]="OrganizationBankAccountVerified",e[e.ProviderBankAccountVerified=24]="ProviderBankAccountVerified",e[e.SyncPolicy=25]="SyncPolicy",e[e.AutoConfirmMember=26]="AutoConfirmMember"}(Ba||(Ba={}));const ja=Object.freeze({KdfChange:0});function Ga(){return-1!==navigator.userAgent.indexOf(" Safari/")&&-1===navigator.userAgent.indexOf(" Chrome/")&&-1===navigator.userAgent.indexOf(" Chromium/")}class La{}var za=i(70891),_a=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Ka extends La{constructor(e){super(),this.logService=e,this.taskHandlers=new Map}setTimeout(e,t){this.validateRegisteredTask(e);const i=globalThis.setTimeout(()=>this.triggerTask(e),t);return new za.yU(()=>globalThis.clearTimeout(i))}setInterval(e,t,i){this.validateRegisteredTask(e);const n=globalThis.setInterval(()=>this.triggerTask(e),t);return new za.yU(()=>globalThis.clearInterval(n))}registerTaskHandler(e,t){this.taskHandlers.get(e)&&(this.logService.warning(`Task handler for ${e} already exists. Overwriting.`),this.unregisterTaskHandler(e)),this.taskHandlers.set(e,t)}unregisterTaskHandler(e){this.taskHandlers.delete(e)}triggerTask(e,t){return _a(this,void 0,void 0,function*(){const t=this.taskHandlers.get(e);t&&t()})}validateRegisteredTask(e){if(!this.taskHandlers.has(e))throw new Error(`Task handler for ${e} not registered. Unable to schedule task.`)}}const Xa="loginStrategySessionTimeout",qa="eventUploadsInterval",Wa="vaultTimeoutCheckInterval";function Ya(e){if(e instanceof URL)return e;try{return new URL(e)}catch(e){return null}}function Ha(e){return e.host?`${e.protocol}//${e.host}`:null}class Ja{static sendMessageToApp(e,t=null,i=!1){return ul.isSafariApi?new Promise(i=>{const n=(new Date).getTime().toString()+"_"+Math.floor(Math.random()*Number.MAX_SAFE_INTEGER);browser.runtime.sendNativeMessage("com.bitwarden.desktop",{id:n,command:e,data:t,responseData:null},e=>{i(e)})}):Promise.resolve(null)}}class Za{}var Qa;!function(e){e[e.Debug=0]="Debug",e[e.Info=1]="Info",e[e.Warning=2]="Warning",e[e.Error=3]="Error"}(Qa||(Qa={}));class el{constructor(e,t=null){this.isDev=e,this.filter=t,this.timersMap=new Map}debug(e,...t){this.isDev&&this.write(Qa.Debug,e,...t)}info(e,...t){this.write(Qa.Info,e,...t)}warning(e,...t){this.write(Qa.Warning,e,...t)}error(e,...t){this.write(Qa.Error,e,...t)}write(e,t,...i){if(null==this.filter||!this.filter(e))switch(e){case Qa.Debug:case Qa.Info:console.log(t,...i);break;case Qa.Warning:console.warn(t,...i);break;case Qa.Error:console.error(t,...i)}}measure(e,t,i,n,r){const s=`[${i}]: ${n}`,o=performance.measure(s,{start:e,detail:{devtools:{dataType:"track-entry",track:i,trackGroup:t,properties:r}}});return this.info(`${s} took ${o.duration}`,r),o}mark(e){const t=performance.mark(e,{detail:{devtools:{dataType:"marker"}}});return this.info(t.name,(new Date).toISOString()),t}}var tl=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class il{static copy(e,t){return tl(this,void 0,void 0,function*(){if(il.isClipboardApiSupported(e,"writeText"))try{yield e.navigator.clipboard.writeText(t)}catch(i){il.consoleLogService.debug(`Error copying to clipboard using the clipboard API, attempting legacy method: ${i}`),this.useLegacyCopyMethod(e,t)}else this.useLegacyCopyMethod(e,t)})}static read(e){return tl(this,void 0,void 0,function*(){if(!il.isClipboardApiSupported(e,"readText"))return this.useLegacyReadMethod(e);try{return yield e.navigator.clipboard.readText()}catch(t){return il.consoleLogService.debug(`Error reading from clipboard using the clipboard API, attempting legacy method: ${t}`),this.useLegacyReadMethod(e)}})}static useLegacyCopyMethod(e,t){if(!il.isLegacyClipboardMethodSupported(e,"copy"))return void il.consoleLogService.warning("Legacy copy method not supported");const i=e.document.createElement("textarea");i.textContent=t||" ",i.style.position="fixed",e.document.body.appendChild(i),i.select();try{e.document.execCommand("copy")}catch(e){il.consoleLogService.warning(`Error writing to clipboard: ${e}`)}finally{e.document.body.removeChild(i)}}static useLegacyReadMethod(e){if(!il.isLegacyClipboardMethodSupported(e,"paste"))return il.consoleLogService.warning("Legacy paste method not supported"),"";const t=e.document.createElement("textarea");t.style.position="fixed",e.document.body.appendChild(t),t.focus();try{return e.document.execCommand("paste")?t.value:""}catch(e){il.consoleLogService.warning(`Error reading from clipboard: ${e}`)}finally{e.document.body.removeChild(t)}return""}static isClipboardApiSupported(e,t){return"clipboard"in e.navigator&&t in e.navigator.clipboard}static isLegacyClipboardMethodSupported(e,t){return"queryCommandSupported"in e.document&&e.document.queryCommandSupported(t)}}il.consoleLogService=new el(!1);var nl=il,rl=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class sl{constructor(e,t,i){this.clipboardWriteCallback=e,this.globalContext=t,this.offscreenDocumentService=i}static getDevice(e){return this.deviceCache||(sl.isFirefox()?this.deviceCache=Ea.FirefoxExtension:sl.isOpera(e)?this.deviceCache=Ea.OperaExtension:sl.isEdge()?this.deviceCache=Ea.EdgeExtension:sl.isVivaldi()?this.deviceCache=Ea.VivaldiExtension:sl.isChrome(e)?this.deviceCache=Ea.ChromeExtension:sl.isSafari(e)&&(this.deviceCache=Ea.SafariExtension)),this.deviceCache}getDevice(){return sl.getDevice(this.globalContext)}getDeviceString(){return Ea[this.getDevice()].toLowerCase().replace("extension","")}getClientType(){return Da.Browser}static isFirefox(){return-1!==navigator.userAgent.indexOf(" Firefox/")||-1!==navigator.userAgent.indexOf(" Gecko/")}isFirefox(){return this.getDevice()===Ea.FirefoxExtension}static isChrome(e){return e.chrome&&-1!==navigator.userAgent.indexOf(" Chrome/")}isChrome(){return this.getDevice()===Ea.ChromeExtension}static isEdge(){return-1!==navigator.userAgent.indexOf(" Edg/")}isEdge(){return this.getDevice()===Ea.EdgeExtension}static isOpera(e){var t;return!!(null===(t=e.opr)||void 0===t?void 0:t.addons)||!!e.opera||navigator.userAgent.indexOf(" OPR/")>=0}isOpera(){return this.getDevice()===Ea.OperaExtension}static isVivaldi(){return-1!==navigator.userAgent.indexOf(" Vivaldi/")}isVivaldi(){return this.getDevice()===Ea.VivaldiExtension}static isSafari(e){return!sl.isOpera(e)&&-1!==navigator.userAgent.indexOf(" Safari/")}static safariVersion(){var e;return null===(e=navigator.userAgent.match("Version/([0-9.]*)"))||void 0===e?void 0:e[1]}isSafari(){return this.getDevice()===Ea.SafariExtension}isChromium(){return this.isChrome()||this.isEdge()||this.isOpera()||this.isVivaldi()}static shouldApplySafariHeightFix(e){var t;if(sl.getDevice(e)!==Ea.SafariExtension)return!1;const i=sl.safariVersion(),n=null===(t=null==i?void 0:i.split("."))||void 0===t?void 0:t.map(e=>Number(e));return(null==n?void 0:n[0])<16||16===(null==n?void 0:n[0])&&0===(null==n?void 0:n[1])}isIE(){return!1}isMacAppStore(){return!1}isPopupOpen(){return rl(this,void 0,void 0,function*(){return this.isSafari()?ul.isPopupOpen():new Promise((e,t)=>{chrome.runtime.sendMessage({command:"checkVaultPopupHeartbeat"},i=>{if(null!=chrome.runtime.lastError)return"Could not establish connection. Receiving end does not exist."===chrome.runtime.lastError.message?void e(!1):void t(chrome.runtime.lastError);e(Boolean(i))})})})}lockTimeout(){return null}launchUri(e,t){ul.createNewTab(e,t&&!0===t.extensionPage)}getApplicationVersion(){var e;const t=chrome.runtime.getManifest();return Promise.resolve(null!==(e=t.version_name)&&void 0!==e?e:t.version)}getApplicationVersionNumber(){const e=chrome.runtime.getManifest();return Promise.resolve(e.version.split(RegExp("[+|-]"))[0].trim())}supportsWebAuthn(e){return"undefined"!=typeof PublicKeyCredential}supportsDuo(){return!0}supportsAutofill(){return!0}supportsFileDownloads(){return!1}isDev(){return!1}isSelfHost(){return!1}copyToClipboard(e,t){const i=(null==t?void 0:t.window)||this.globalContext,n=Boolean(null==t?void 0:t.clearing),r=(null==t?void 0:t.clearMs)||null,s=()=>{n||null==this.clipboardWriteCallback||this.clipboardWriteCallback(e,r)};this.isSafari()?Ja.sendMessageToApp("copyToClipboard",e).then(s):(this.isChrome()&&""===e&&(e="\0"),ul.isManifestVersion(3)&&this.offscreenDocumentService.offscreenApiSupported()?this.triggerOffscreenCopyToClipboard(e).then(s):nl.copy(i,e).then(s))}readFromClipboard(e){return rl(this,void 0,void 0,function*(){const t=(null==e?void 0:e.window)||this.globalContext;return this.isSafari()?yield Ja.sendMessageToApp("readFromClipboard"):ul.isManifestVersion(3)&&this.offscreenDocumentService.offscreenApiSupported()?yield this.triggerOffscreenReadFromClipboard():yield nl.read(t)})}supportsSecureStorage(){return!1}getAutofillKeyboardShortcut(){return rl(this,void 0,void 0,function*(){let e;return this.isSafari()?e="Cmd+Shift+L":this.isFirefox()?(e=(yield browser.commands.getAll()).find(e=>e.name===Aa).shortcut,"mac"===(yield browser.runtime.getPlatformInfo()).os&&"Ctrl+Shift+L"===e&&(e="Cmd+Shift+L")):yield new Promise(t=>chrome.commands.getAll(i=>t(e=i.find(e=>e.name===Aa).shortcut))),e})}packageType(){return rl(this,void 0,void 0,function*(){switch(this.getDevice()){case Ea.ChromeExtension:return"Chrome Extension";case Ea.FirefoxExtension:return"Firefox Extension";case Ea.OperaExtension:return"Opera Extension";case Ea.EdgeExtension:return"Edge Extension";case Ea.VivaldiExtension:return"Vivaldi Extension";case Ea.SafariExtension:return"Safari Extension";default:return"Unknown Browser Extension"}})}triggerOffscreenCopyToClipboard(e){return rl(this,void 0,void 0,function*(){yield this.offscreenDocumentService.withDocument([chrome.offscreen.Reason.CLIPBOARD],"Write text to the clipboard.",()=>rl(this,void 0,void 0,function*(){yield ul.sendMessageWithResponse("offscreenCopyToClipboard",{text:e})}))})}triggerOffscreenReadFromClipboard(){return rl(this,void 0,void 0,function*(){const e=yield this.offscreenDocumentService.withDocument([chrome.offscreen.Reason.CLIPBOARD],"Read text from the clipboard.",()=>rl(this,void 0,void 0,function*(){return yield ul.sendMessageWithResponse("offscreenReadFromClipboard")}));return"string"==typeof e?e:""})}}sl.deviceCache=null;var ol=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};let al;function ll(e,t){return ol(this,void 0,void 0,function*(){return al||(al=function(){var e,t;const i=new el(!1),n=globalThis.chrome&&l(globalThis.chrome),r=/^(https?|wss?|file|ftp|\*):\/\/(\*|\*\.[^*/]+|[^*/]+)\/.*$|^file:\/\/\/.*$|^resource:\/\/(\*|\*\.[^*/]+|[^*/]+)\/.*$|^about:/,s=null===(e=globalThis.navigator)||void 0===e?void 0:e.userAgent.includes("Firefox/"),o=Boolean(null===(t=globalThis.chrome)||void 0===t?void 0:t.scripting),a="object"==typeof chrome&&"webNavigation"in chrome;function l(e){return new Proxy(e,{get(e,t){if(e[t])return"function"!=typeof e[t]?l(e[t]):(...i)=>new Promise((n,r)=>{e[t](...i,e=>{chrome.runtime.lastError?r(new Error(chrome.runtime.lastError.message)):n(e)})})}})}function c(e){if(!u(e))throw new Error(`${e} is an invalid pattern, it must match ${String(r)}`)}function u(e){return"<all_urls>"===e||r.test(e)}function d(e){c(e);let[,t,i="",n]=e.split(/(^[^:]+:[/][/])([^/]+)?/);return t=t.replace("*",s?"(https?|wss?)":"https?").replaceAll(/[/]/g,"[/]"),"*"===i?i="[^/]+":i&&(i=i.replace(/^[*][.]/,"([^/]+.)*").replaceAll(/[.]/g,"[.]").replace(/[*]$/,"[^.]+")),n=n.replaceAll(/[/]/g,"[/]").replaceAll(/[.]/g,"[.]").replaceAll(/[*]/g,".*"),"^"+t+i+"("+n+")?$"}function h(...e){return 0===e.length?/$./:e.includes("<all_urls>")?/^(https?|file|ftp):[/]+/:e.includes("*://*/*")?s?/^(https?|wss?):[/][/][^/]+([/].*)?$/:/^https?:[/][/][^/]+([/].*)?$/:new RegExp(e.map(e=>d(e)).join("|"))}function p(e){return"object"==typeof e?Object.assign(Object.assign({},e),{allFrames:!1}):{tabId:e,frameId:void 0,allFrames:!0}}function v(e){return Array.isArray(e)?e:[e]}function f(e,t,i){return void 0===t?{tabId:e,frameIds:void 0,allFrames:i}:{tabId:e,frameIds:[t],allFrames:void 0}}function m(e){return ol(this,arguments,void 0,function*({tabId:e,frameId:t,files:i,allFrames:r,matchAboutBlank:s,runAt:a},{ignoreTargetErrors:l}={}){const c=Promise.all(i.map(i=>ol(this,void 0,void 0,function*(){return"string"==typeof i&&(i={file:i}),o?"file"in i?chrome.scripting.insertCSS({target:f(e,t,r),files:[i.file]}):chrome.scripting.insertCSS({target:f(e,t,r),css:i.code}):n.tabs.insertCSS(e,Object.assign(Object.assign({},i),{matchAboutBlank:s,allFrames:r,frameId:t,runAt:null!=a?a:"document_start"}))})));l?yield S(c):yield c})}function g(e){if(e.some(e=>"code"in e))throw new Error("chrome.scripting does not support injecting strings of `code`")}function y(e){return ol(this,arguments,void 0,function*({tabId:e,frameId:t,files:i,allFrames:r,matchAboutBlank:s,runAt:a},{ignoreTargetErrors:l}={}){const c=i.map(e=>"string"==typeof e?{file:e}:e);if(o){g(c);const i=chrome.scripting.executeScript({target:f(e,t,r),files:c.map(({file:e})=>e)});return void(l?yield S(i):yield i)}const u=[];for(const i of c)"code"in i&&(yield u.at(-1)),u.push(n.tabs.executeScript(e,Object.assign(Object.assign({},i),{matchAboutBlank:s,allFrames:r,frameId:t,runAt:a})));l?yield S(Promise.all(u)):yield Promise.all(u)})}function b(e,t){return ol(this,arguments,void 0,function*(e,t,i={}){const n=v(e);yield Promise.all(n.map(e=>ol(this,void 0,void 0,function*(){return w(p(e),t,i)})))})}function w(e,t){return ol(this,arguments,void 0,function*({frameId:e,tabId:t,allFrames:i},n,r={}){const s=v(n).flatMap(n=>{var s,o,a,l,c,u;return[m({tabId:t,frameId:e,allFrames:i,files:null!==(s=n.css)&&void 0!==s?s:[],matchAboutBlank:null!==(o=n.matchAboutBlank)&&void 0!==o?o:n.match_about_blank,runAt:null!==(a=n.runAt)&&void 0!==a?a:n.run_at},r),y({tabId:t,frameId:e,allFrames:i,files:null!==(l=n.js)&&void 0!==l?l:[],matchAboutBlank:null!==(c=n.matchAboutBlank)&&void 0!==c?c:n.match_about_blank,runAt:null!==(u=n.runAt)&&void 0!==u?u:n.run_at},r)]});yield Promise.all(s)})}function S(e){return ol(this,void 0,void 0,function*(){try{yield e}catch(e){if(!/^No frame with id \d+ in tab \d+.$|^No tab with id: \d+.$|^The tab was closed.$|^The frame was removed.$/.test(null==e?void 0:e.message))throw e}})}function k(e){return ol(this,void 0,void 0,function*(){return n.permissions.contains({origins:[new URL(e).origin+"/*"]})})}return(e,t)=>ol(this,void 0,void 0,function*(){const{js:r=[],css:s=[],matchAboutBlank:o,matches:l=[],excludeMatches:c,runAt:u}=e;let{allFrames:d}=e;if(a?d=!1:d&&i.warning("`allFrames: true` requires the `webNavigation` permission to work correctly: https://github.com/fregante/content-scripts-register-polyfill#permissions"),0===l.length)throw new Error("Type error for parameter contentScriptOptions (Error processing matches: Array requires at least 1 items; you have 0) for contentScripts.register.");yield Promise.all(l.map(e=>ol(this,void 0,void 0,function*(){if(!(yield n.permissions.contains({origins:[e]})))throw new Error(`Permission denied to register a content script for ${e}`)})));const p=h(...l),v=h(...null!=c?c:[]),f=(e,t,...i)=>ol(this,[e,t,...i],void 0,function*(e,t,i=0){p.test(e)&&!v.test(e)&&(yield k(e))&&(yield b({tabId:t,frameId:i},{css:s,js:r,matchAboutBlank:o,runAt:u},{ignoreTargetErrors:!0}))}),m=(e,t,i)=>ol(this,[e,t,i],void 0,function*(e,{status:t},{url:i}){"loading"===t&&i&&f(i,e)}),g=e=>ol(this,[e],void 0,function*({tabId:e,frameId:t,url:i}){f(i,e,t)});a?ul.addListener(chrome.webNavigation.onCommitted,g):ul.addListener(chrome.tabs.onUpdated,m);const y={unregister(){return ol(this,void 0,void 0,function*(){a?chrome.webNavigation.onCommitted.removeListener(g):chrome.tabs.onUpdated.removeListener(m)})}};return"function"==typeof t&&t(y),y})}()),al(e,t)})}var cl=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class ul{static get manifestVersion(){return chrome.runtime.getManifest().manifest_version}static isManifestVersion(e){return ul.manifestVersion===e}static senderIsInternal(e,t){var i;if(!(null==e?void 0:e.origin))return null==t||t.warning("[BrowserApi] Message sender has no origin"),!1;const n=null!==(i=ul.getRuntimeURL(""))&&void 0!==i?i:"";return n?function(e,t){const i=Ya(e),n=Ya(t);if(!i||!n)return!1;const r=Ha(i),s=Ha(n),o=null==r?void 0:r.replace(/\/$/,"").toLowerCase(),a=null==s?void 0:s.replace(/\/$/,"").toLowerCase();return!(!o||!a)&&o===a}(n,e.origin)?"frameId"in e&&0!==e.frameId?(null==t||t.warning("[BrowserApi] Message sender is not from the top-level frame"),!1):(null==t||t.info("[BrowserApi] Message sender appears to be internal"),!0):(null==t||t.warning(`[BrowserApi] Message sender origin (${e.origin}) does not match extension URL (${n})`),!1):(null==t||t.warning("[BrowserApi] Unable to determine extension URL"),!1)}static getWindows(){return cl(this,void 0,void 0,function*(){return new Promise(e=>chrome.windows.getAll({populate:!0},e))})}static getWindow(e){return cl(this,void 0,void 0,function*(){return e?yield ul.getWindowById(e):ul.getCurrentWindow()})}static getCurrentWindow(){return cl(this,void 0,void 0,function*(){return new Promise(e=>chrome.windows.getCurrent({populate:!0},e))})}static getWindowById(e){return cl(this,void 0,void 0,function*(){return new Promise(t=>chrome.windows.get(e,{populate:!0},t))})}static createWindow(e){return cl(this,void 0,void 0,function*(){return new Promise(t=>{chrome.windows.create(e,e=>cl(this,void 0,void 0,function*(){if(!ul.isSafariApi)return t(e);const i=yield new Promise(e=>{chrome.windows.getAll({windowTypes:["normal"]},t=>e(t))}),n=i.find(t=>t.id!==e.id);if(null==n||!n.id)return t(e);chrome.windows.update(n.id,{focused:!0},()=>{chrome.windows.update(e.id,{focused:!0},()=>{t(e)})})}))})})}static removeWindow(e){return cl(this,void 0,void 0,function*(){return new Promise(t=>chrome.windows.remove(e,()=>t()))})}static updateWindowProperties(e,t){return cl(this,void 0,void 0,function*(){return new Promise(i=>chrome.windows.update(e,t,()=>{i()}))})}static focusWindow(e){return cl(this,void 0,void 0,function*(){yield ul.updateWindowProperties(e,{focused:!0})})}static getTabFromCurrentWindowId(){return cl(this,void 0,void 0,function*(){return yield ul.tabsQueryFirstCurrentWindowForSafari({active:!0,windowId:chrome.windows.WINDOW_ID_CURRENT})})}static getBrowserClientVendor(e){switch(sl.getDevice(e)){case Ea.ChromeExtension:case Ea.ChromeBrowser:return Ia;case Ea.OperaExtension:case Ea.OperaBrowser:return Ca;case Ea.EdgeExtension:case Ea.EdgeBrowser:return Ta;case Ea.VivaldiExtension:case Ea.VivaldiBrowser:return Pa;default:return Fa}}static getTab(e){return cl(this,void 0,void 0,function*(){return e?ul.isManifestVersion(3)?yield chrome.tabs.get(e):new Promise(t=>chrome.tabs.get(e,e=>{t(e)})):null})}static getTabFromCurrentWindow(){return cl(this,void 0,void 0,function*(){return yield ul.tabsQueryFirstCurrentWindowForSafari({active:!0,currentWindow:!0})})}static getActiveTabs(){return cl(this,void 0,void 0,function*(){return yield ul.tabsQuery({active:!0})})}static getCurrentTab(){return cl(this,void 0,void 0,function*(){return ul.isManifestVersion(3)?yield chrome.tabs.getCurrent():new Promise(e=>chrome.tabs.getCurrent(t=>{e(t)}))})}static closeTab(e){return cl(this,void 0,void 0,function*(){e&&(ul.isWebExtensionsApi?yield browser.tabs.remove(e).catch(e=>{throw new Error("[BrowserApi] Failed to remove current tab: "+e.message)}):ul.isChromeApi&&(yield chrome.tabs.remove(e).catch(e=>{throw new Error("[BrowserApi] Failed to remove current tab: "+e.message)})))})}static navigateTabToUrl(e,t){return cl(this,void 0,void 0,function*(){e&&(ul.isWebExtensionsApi?yield browser.tabs.update(e,{url:t.href}).catch(e=>{throw new Error("Failed to navigate tab to URL: "+e.message)}):ul.isChromeApi&&chrome.tabs.update(e,{url:t.href},()=>{if(chrome.runtime.lastError)throw new Error("Failed to navigate tab to URL: "+chrome.runtime.lastError.message)}))})}static tabsQuery(e){return cl(this,void 0,void 0,function*(){return new Promise(t=>{chrome.tabs.query(e,e=>{t(e)})})})}static tabsQueryFirst(e){return cl(this,void 0,void 0,function*(){const t=yield ul.tabsQuery(e);return t.length>0?t[0]:null})}static tabsQueryFirstCurrentWindowForSafari(e){return cl(this,void 0,void 0,function*(){var t;if(!ul.isSafariApi)return yield ul.tabsQueryFirst(e);const i=(yield ul.getCurrentWindow()).id,n=yield ul.tabsQuery(e);return n.length<=1||null==i?n[0]:null!==(t=n.find(e=>e.windowId===i))&&void 0!==t?t:n[0]})}static tabSendMessageData(e,t,i=null){const n={command:t};return null!=i&&(n.data=i),ul.tabSendMessage(e,n)}static tabSendMessage(e,t){return cl(this,arguments,void 0,function*(e,t,i=null,n=!1){if(e&&e.id)return new Promise((r,s)=>{chrome.tabs.sendMessage(e.id,t,i,e=>{chrome.runtime.lastError&&n&&s(),r(e)})})})}static sendTabsMessage(e,t,i,n){chrome.tabs.sendMessage(e,t,i,n)}static getRuntimeURL(e){return ul.isWebExtensionsApi?browser.runtime.getURL(e):ul.isChromeApi?chrome.runtime.getURL(e):void 0}static onWindowCreated(e){return cl(this,void 0,void 0,function*(){return chrome.windows.onCreated.addListener(e)})}static getBackgroundPage(){return void 0===chrome.extension.getBackgroundPage?null:chrome.extension.getBackgroundPage()}static isBackgroundPage(e){return void 0!==e&&e===ul.getBackgroundPage()}static getExtensionViews(e){return void 0===chrome.extension.getViews?[]:chrome.extension.getViews(e)}static isPopupOpen(){return cl(this,void 0,void 0,function*(){return Promise.resolve(ul.getExtensionViews({type:"popup"}).length>0)})}static createNewTab(e,t=!0){return new Promise(i=>chrome.tabs.create({url:e,active:t},e=>i(e)))}static getFrameDetails(e){return cl(this,void 0,void 0,function*(){return new Promise(t=>chrome.webNavigation.getFrame(e,t))})}static getAllFrameDetails(e){return cl(this,void 0,void 0,function*(){return new Promise(t=>chrome.webNavigation.getAllFrames({tabId:e},t))})}static messageListener(e,t){ul.addListener(chrome.runtime.onMessage,t)}static messageListener$(){return new aa.c(e=>{const t=t=>{e.next(t)};return ul.addListener(chrome.runtime.onMessage,t),()=>ul.removeListener(chrome.runtime.onMessage,t)})}static storageChangeListener(e){ul.addListener(chrome.storage.onChanged,e)}static addListener(e,t){e.addListener(t),ul.isSafariApi&&!ul.isBackgroundPage(self)&&(ul.trackedChromeEventListeners.push([e,t]),ul.setupUnloadListeners())}static removeListener(e,t){if(e.removeListener(t),ul.isSafariApi&&!ul.isBackgroundPage(self)){const e=ul.trackedChromeEventListeners.findIndex(([e,i])=>i==t);-1!==e&&ul.trackedChromeEventListeners.splice(e,1)}}static setupUnloadListeners(){self.addEventListener("pagehide",()=>{for(const[e,t]of ul.trackedChromeEventListeners)e.removeListener(t)})}static sendMessage(e,t={}){const i=Object.assign({},{command:e},t);return chrome.runtime.sendMessage(i)}static sendMessageWithResponse(e,t={}){const i=Object.assign({},{command:e},t);return new Promise(e=>chrome.runtime.sendMessage(i,e))}static focusTab(e){return cl(this,void 0,void 0,function*(){chrome.tabs.update(e,{active:!0,highlighted:!0})})}static closePopup(e){ul.isWebExtensionsApi&&ul.isFirefoxOnAndroid?browser.tabs.update({active:!0}).finally(e.close):e.close()}static gaFilter(){return!1}static getUILanguage(){return chrome.i18n.getUILanguage()}static reloadExtension(){return this.isSafariApi?self.location.reload():chrome.runtime.reload()}static reloadOpenWindows(e=!1){const t=ul.getExtensionViews();if(!t.length)return;const i=self.location.href;t.filter(e=>null!=e.location.href&&!e.location.href.includes("background.html")).filter(t=>!e||t.location.href!==i).forEach(e=>e.location.reload())}static connectNative(e){return ul.isWebExtensionsApi?browser.runtime.connectNative(e):ul.isChromeApi?chrome.runtime.connectNative(e):void 0}static requestPermission(e){return ul.isWebExtensionsApi?browser.permissions.request(e):new Promise(t=>{chrome.permissions.request(e,t)})}static permissionsGranted(e){return cl(this,void 0,void 0,function*(){return new Promise(t=>chrome.permissions.contains({permissions:e},e=>t(e)))})}static getPlatformInfo(){return ul.isWebExtensionsApi?browser.runtime.getPlatformInfo():new Promise(e=>{chrome.runtime.getPlatformInfo(e)})}static getBrowserAction(){return ul.isManifestVersion(3)?chrome.action:chrome.browserAction}static getSidebarAction(e){var t;const i=sl.getDevice(e);return i===Ea.FirefoxExtension?browser.sidebarAction:i===Ea.OperaExtension?null===(t=e.opr)||void 0===t?void 0:t.sidebarAction:null}static captureVisibleTab(){return new Promise(e=>{chrome.tabs.captureVisibleTab(null,{format:"png"},e)})}static executeScriptInTab(e,t,i){if(ul.isManifestVersion(3)){let n;return n="number"==typeof t.frameId?{tabId:e,frameIds:[t.frameId]}:t.allFrames?{tabId:e,allFrames:!0}:{tabId:e},chrome.scripting.executeScript({target:n,files:t.file?[t.file]:null,injectImmediately:"document_start"===t.runAt,world:(null==i?void 0:i.world)||chrome.scripting.ExecutionWorld.ISOLATED})}return new Promise(i=>{chrome.tabs.executeScript(e,t,e=>{i(e)})})}static browserAutofillSettingsOverridden(){return cl(this,void 0,void 0,function*(){if(!(yield ul.permissionsGranted(["privacy"])))return!1;const e=e=>"controlled_by_this_extension"===e.levelOfControl&&!e.value,t=yield new Promise(t=>chrome.privacy.services.autofillAddressEnabled.get({},i=>t(e(i)))),i=yield new Promise(t=>chrome.privacy.services.autofillCreditCardEnabled.get({},i=>t(e(i)))),n=yield new Promise(t=>chrome.privacy.services.passwordSavingEnabled.get({},i=>t(e(i))));return t&&i&&n})}static updateDefaultBrowserAutofillSettings(e){return cl(this,void 0,void 0,function*(){yield chrome.privacy.services.autofillAddressEnabled.set({value:e}),yield chrome.privacy.services.autofillCreditCardEnabled.set({value:e}),yield chrome.privacy.services.passwordSavingEnabled.set({value:e})})}static registerContentScriptsMv2(e){return cl(this,void 0,void 0,function*(){var t;return"undefined"!=typeof browser&&(null===(t=browser.contentScripts)||void 0===t?void 0:t.register)?yield browser.contentScripts.register(e):yield ll(e)})}static registerContentScriptsMv3(e){return cl(this,void 0,void 0,function*(){yield chrome.scripting.registerContentScripts(e)})}static unregisterContentScriptsMv3(e){return cl(this,void 0,void 0,function*(){yield chrome.scripting.unregisterContentScripts(e)})}}ul.isWebExtensionsApi="undefined"!=typeof browser,ul.isSafariApi=Ga(),ul.isChromeApi=!ul.isSafariApi&&"undefined"!=typeof chrome,ul.isFirefoxOnAndroid=-1!==navigator.userAgent.indexOf("Firefox/")&&-1!==navigator.userAgent.indexOf("Android"),ul.trackedChromeEventListeners=[];var dl=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const hl=Object.freeze({default:480,wide:600,narrow:380});class pl{static inSidebar(e){return pl.urlContainsSearchParams(e,"uilocation","sidebar")}static inPopout(e){return pl.urlContainsSearchParams(e,"uilocation","popout")}static isInTab(){return dl(this,void 0,void 0,function*(){var e;const t=null===(e=yield ul.getCurrentTab())||void 0===e?void 0:e.id;if(null==t)return!1;return ul.getExtensionViews({tabId:t,type:"tab"}).length>0})}static inSingleActionPopout(e,t){return pl.urlContainsSearchParams(e,"singleActionPopout",t)}static inPopup(e){return-1===e.location.href.indexOf("uilocation=")||e.location.href.indexOf("uilocation=popup")>-1}static getContentScrollY(e,t="main"){return e.document.getElementsByTagName(t)[0].scrollTop}static setContentScrollY(e,t){return dl(this,arguments,void 0,function*(e,t,i={delay:0,containerSelector:"main"}){const{delay:n,containerSelector:r}=i;return new Promise(i=>e.setTimeout(()=>{const n=e.document.querySelector(r);!isNaN(t)&&n&&(n.scrollTop=t),i()},n))})}static backgroundInitializationRequired(){return!ul.getBackgroundPage()||ul.isManifestVersion(3)}static openPopout(e){return dl(this,arguments,void 0,function*(e,t={}){const{senderWindowId:i,singleActionKey:n,forceCloseExistingWindows:r,windowOptions:s}=t,o={type:"popup",focused:!0,width:Math.max(hl.default,"undefined"==typeof document?hl.default:document.body.clientWidth),height:630},a=o.width,l=yield ul.getWindow(i),c=Object.assign(Object.assign(Object.assign({left:l.left+l.width-a-15,top:l.top+90},o),s),{url:pl.buildPopoutUrl(e,n)});if(!(yield pl.isSingleActionPopoutOpen(n,c,r))||r)return yield ul.createWindow(c)})}static closeSingleActionPopout(e){return dl(this,arguments,void 0,function*(e,t=0){const i=chrome.runtime.getURL("popup/index.html"),n=yield ul.tabsQuery({url:`${i}*`});for(const i of n)i.url.includes(`singleActionPopout=${e}`)&&setTimeout(()=>ul.removeWindow(i.windowId),t)})}static openCurrentPagePopout(e){return dl(this,arguments,void 0,function*(e,t=null){const i=t||e.location.href,n=new URL(i);let r=n.hash;r.startsWith("#/tabs/current")&&(r="#/tabs/vault"),yield pl.openPopout(`${n.pathname}${r}`),pl.inPopup(e)&&ul.closePopup(e)})}static waitForAllPopupsClose(){return dl(this,arguments,void 0,function*(e=1e3){yield(0,bo._)((0,sa.Y)(100).pipe((0,go.n)(()=>ul.isPopupOpen()),(0,oa.v)(e=>e,!0),(0,Eo.p)(e=>!e),(0,wo.w)({first:e,with:()=>(0,Go.of)(!0)})))})}static isSingleActionPopoutOpen(e,t){return dl(this,arguments,void 0,function*(e,t,i=!1){if(!e)return!1;const n=chrome.runtime.getURL("popup/index.html"),r=(yield ul.tabsQuery({url:`${n}*`})).filter(t=>t.url.includes(`singleActionPopout=${e}`));if(0===r.length)return!1;if(!i){const e=r.shift();yield ul.updateWindowProperties(e.windowId,{focused:!0,width:t.width,height:t.height,top:t.top,left:t.left})}return r.forEach(e=>ul.removeWindow(e.windowId)),!0})}static urlContainsSearchParams(e,t,i){return e.location.href.indexOf(`${t}=${i}`)>-1}static buildPopoutUrl(e,t){const i=new URL(chrome.runtime.getURL(e));return i.searchParams.set("uilocation","popout"),t&&i.searchParams.set("singleActionPopout",t),i.toString()}}var vl=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const fl=new m(ve,"popup-width",{deserializer:e=>e});class ml{constructor(){this.state=(0,a.WQX)(d).get(fl),this.width$=this.state.state$.pipe((0,l.T)(e=>null!=e?e:"default"))}setWidth(e){return vl(this,void 0,void 0,function*(){yield this.state.update(()=>e)})}init(){return vl(this,void 0,void 0,function*(){this.width$.subscribe(e=>{ml.setStyle(e),localStorage.setItem(ml.LocalStorageKey,e)})})}setHeight(){return vl(this,void 0,void 0,function*(){const e=yield pl.isInTab(),t=window.innerHeight,i=window.screen.availHeight-100,n=i<600?i:t;!pl.inPopup(window)||e?window.document.documentElement.classList.add("body-full"):n<300?window.document.documentElement.classList.add("body-3xs"):n<400?window.document.documentElement.classList.add("body-xxs"):n<500?window.document.documentElement.classList.add("body-xs"):n<600&&window.document.documentElement.classList.add("body-sm")})}static setStyle(e){return vl(this,void 0,void 0,function*(){var t;const i=yield pl.isInTab();if(!pl.inPopup(window)||i)return;const n=null!==(t=hl[e])&&void 0!==t?t:hl.default;document.body.style.width=`${n}px`})}static initBodyWidthFromLocalStorage(){const e=localStorage.getItem(ml.LocalStorageKey);this.setStyle(e)}}ml.LocalStorageKey="bw-popup-width",ml.ɵfac=function(e){return new(e||ml)},ml.ɵprov=a.jDH({token:ml,factory:ml.ɵfac,providedIn:"root"});var gl=i(60989),yl=i(34003),bl=i(45795),wl=i(43380),Sl=i(94251),kl=i(77468),Il=i(51757),Cl=i(71458),Tl=i(82630),Pl=i(28846),Fl=i(33812),Rl=i(33277),xl=i(83731),Al=i(50147);function Dl({element:e,title:t,label:i}){t&&e.setAttribute("title",t),i&&e.setAttribute("aria-label",i)}class El{}class $l{}class Ol{}class Ul extends Ol{}function Ml(e,t){if(1&e&&(Fl.j41(0,"span",4),Fl.EFF(1),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.JRh(e.title)}}class Nl{get classList(){return["tw-inline-block","tw-overflow-hidden","tw-flex","tw-items-center"].concat(this.sizeClass).concat([this.noColor?"":"tw-text-primary-600"])}constructor(e){this.i18nService=e,this.size="large",this.noColor=!1,this.title=this.i18nService.t("loading"),this.sr=!0}get sizeClass(){switch(this.size){case"small":return["tw-h-4"];case"large":return["tw-h-16"];default:return["tw-h-full","tw-w-full"]}}}Nl.ɵfac=function(e){return new(e||Nl)(Fl.rXU(Ul))},Nl.ɵcmp=Fl.VBU({type:Nl,selectors:[["bit-spinner"]],hostVars:2,hostBindings:function(e,t){2&e&&Fl.HbH(t.classList)},inputs:{size:"size",noColor:[2,"noColor","noColor",o.L39],title:"title",sr:[2,"sr","sr",o.L39]},decls:4,vars:1,consts:[["xmlns","http://www.w3.org/2000/svg","viewBox","0 0 56 56","fill","none","aria-hidden","true",1,"tw-size-full","tw-animate-spin"],["cx","28","cy","28","r","23","pathLength","4","stroke-width","5","stroke-dasharray","1 3","stroke-linecap","round",1,"tw-stroke-primary-600"],["cx","28","cy","28","r","23","stroke-width","5","opacity","0.4",1,"tw-stroke-primary-600"],["class","tw-sr-only",4,"ngIf"],[1,"tw-sr-only"]],template:function(e,t){1&e&&(a.qSk(),Fl.j41(0,"svg",0),Fl.nrm(1,"circle",1)(2,"circle",2),Fl.k0s(),Fl.DNE(3,Ml,2,1,"span",3)),2&e&&(Fl.R7$(3),Fl.Y8G("ngIf",t.sr))},dependencies:[kl.MD,kl.bT],encapsulation:2});var Vl=i(37831);const Bl=[{id:"right-center",offsetX:10,originX:"end",originY:"center",overlayX:"start",overlayY:"center",panelClass:["bit-tooltip-right-center"]},{id:"left-center",offsetX:-10,originX:"start",originY:"center",overlayX:"end",overlayY:"center",panelClass:["bit-tooltip-left-center"]},{id:"below-center",offsetY:10,originX:"center",originY:"bottom",overlayX:"center",overlayY:"top",panelClass:["bit-tooltip-below-center"]},{id:"above-center",offsetY:-10,originX:"center",originY:"top",overlayX:"center",overlayY:"bottom",panelClass:["bit-tooltip-above-center"]}];function jl(e,t){if(1&e&&Fl.EFF(0),2&e){const e=Fl.XpG(2);Fl.JRh(e.tooltipData.content())}}function Gl(e,t){if(1&e&&(Fl.rj2(0,"div",0)(1,"div",1),Fl.SdG(2,0,null,jl,1,1),Fl.eux()()),2&e){const e=Fl.XpG();Fl.BMQ("data-position",e.tooltipData.tooltipPosition())("data-visible",e.tooltipData.isVisible()),Fl.R7$(),Fl.Avn("id",e.tooltipData.id())}}const Ll=new a.nKC("TOOLTIP_DATA");class zl{constructor(){this.templateRef=o.ebz.required(Fl.C4Q),this.elementRef=(0,a.WQX)(Fl.aKT),this.tooltipData=(0,a.WQX)(Ll)}}zl.ɵfac=function(e){return new(e||zl)},zl.ɵcmp=Fl.VBU({type:zl,selectors:[["bit-tooltip"]],viewQuery:function(e,t){1&e&&Fl.wEZ(t.templateRef,Fl.C4Q,5),2&e&&Fl.NyB()},ngContentSelectors:["*"],decls:1,vars:1,consts:[[1,"bit-tooltip-container"],["role","tooltip",1,"bit-tooltip",3,"id"]],template:function(e,t){1&e&&(Fl.NAR(),Fl.nVh(0,Gl,4,3,"div",0)),2&e&&Fl.vxM(t.tooltipData.content()?0:-1)},dependencies:[kl.MD],encapsulation:2});class _l{constructor(){this.tooltipContent=(0,o.geq)("",{alias:"bitTooltip"}),this.tooltipPosition=(0,o.hFB)("above-center"),this.addTooltipToDescribedby=(0,o.hFB)(!1),this.isVisible=(0,a.vPA)(!1),this.elementRef=(0,a.WQX)(Fl.aKT),this.overlay=(0,a.WQX)(wl.hJ),this.viewContainerRef=(0,a.WQX)(Fl.c1b),this.positionStrategy=this.overlay.position().flexibleConnectedTo(this.elementRef).withFlexibleDimensions(!1).withPush(!0),this.tooltipId="bit-tooltip-"+_l.nextId++,this.currentDescribedByIds=this.elementRef.nativeElement.getAttribute("aria-describedby")||null,this.tooltipPortal=new Vl.A8(zl,this.viewContainerRef,a.zZn.create({providers:[{provide:Ll,useValue:{content:this.tooltipContent,isVisible:this.isVisible,tooltipPosition:this.tooltipPosition,id:(0,a.vPA)(this.tooltipId)}}]})),this.destroyTooltip=()=>{var e;this.clearTimeout(),null===(e=this.overlayRef)||void 0===e||e.dispose(),this.overlayRef=void 0,this.isVisible.set(!1)},this.showTooltip=()=>{this.clearTimeout(),this.overlayRef||(this.overlayRef=this.overlay.create(Object.assign(Object.assign({},this.defaultPopoverConfig),{positionStrategy:this.positionStrategy})),this.overlayRef.attach(this.tooltipPortal)),this.showTimeoutId=setTimeout(()=>{this.isVisible.set(!0),this.showTimeoutId=void 0},800)},this.hideTooltip=()=>{this.destroyTooltip()},this.resolvedDescribedByIds=(0,Rl.EW)(()=>this.addTooltipToDescribedby()?this.currentDescribedByIds?`${this.currentDescribedByIds||""} ${this.tooltipId}`:this.tooltipId:this.currentDescribedByIds)}clearTimeout(){void 0!==this.showTimeoutId&&(clearTimeout(this.showTimeoutId),this.showTimeoutId=void 0)}onFocusIn(e){e.target.matches(":focus-visible")&&this.showTooltip()}onFocusOut(){this.hideTooltip()}computePositions(e){const t=Bl.find(t=>t.id===e);return t?[t,...Bl]:Bl}get defaultPopoverConfig(){return{hasBackdrop:!1,scrollStrategy:this.overlay.scrollStrategies.reposition()}}ngOnInit(){this.positionStrategy.withPositions(this.computePositions(this.tooltipPosition()))}ngOnDestroy(){this.destroyTooltip()}}function Kl(e,t){(0,xl.br)(t).pipe((0,xl.pQ)()).subscribe(t=>{t?(e.removeAttribute("disabled"),e.setAttribute("aria-disabled","true")):e.removeAttribute("aria-disabled")})}_l.nextId=0,_l.ɵfac=function(e){return new(e||_l)},_l.ɵdir=Fl.FsC({type:_l,selectors:[["","bitTooltip",""]],hostVars:1,hostBindings:function(e,t){1&e&&Fl.bIt("mouseenter",function(){return t.showTooltip()})("mouseleave",function(){return t.hideTooltip()})("focusin",function(e){return t.onFocusIn(e)})("focusout",function(){return t.onFocusOut()}),2&e&&Fl.BMQ("aria-describedby",t.resolvedDescribedByIds())},inputs:{tooltipContent:[1,"bitTooltip","tooltipContent"],tooltipPosition:[1,"tooltipPosition"],addTooltipToDescribedby:[1,"addTooltipToDescribedby"]},outputs:{tooltipContent:"bitTooltipChange"}});class Xl{constructor(e,t){this.document=e,this.ngZone=t,this.ngZone.runOutsideAngular(()=>{this.listener=e=>{if(e.target.closest('[aria-disabled="true"][bit-aria-disable="true"]'))return e.stopPropagation(),e.preventDefault(),!1},this.document.addEventListener("click",this.listener,!0)})}ngOnDestroy(){this.document.removeEventListener("click",this.listener,!0)}}Xl.ɵfac=function(e){return new(e||Xl)(a.KVO(a.qQL),a.KVO(Fl.SKi))},Xl.ɵprov=a.jDH({token:Xl,factory:Xl.ɵfac,providedIn:"root"});class ql{constructor(){this.ariaDisabledClickCaptureService=(0,a.WQX)(Xl)}}ql.ɵfac=function(e){return new(e||ql)},ql.ɵdir=Fl.FsC({type:ql,hostVars:1,hostBindings:function(e,t){2&e&&Fl.BMQ("bit-aria-disable",!0)}});const Wl=e=>({"tw-invisible":e}),Yl=["tw-relative","before:tw-content-['']","before:tw-block","before:tw-absolute","before:-tw-inset-[1px]","before:tw-rounded-lg","before:tw-transition","before:tw-ring-2","before:tw-ring-transparent","focus-visible:tw-z-10"],Hl={contrast:["!tw-text-contrast","tw-border-transparent","hover:!tw-bg-hover-contrast","focus-visible:before:tw-ring-text-contrast",...Yl],main:["!tw-text-main","focus-visible:before:tw-ring-primary-600",...Yl],muted:["!tw-text-muted","tw-border-transparent","aria-expanded:tw-bg-text-muted","aria-expanded:!tw-text-contrast","focus-visible:before:tw-ring-primary-600","aria-expanded:hover:tw-bg-secondary-700","aria-expanded:hover:tw-border-secondary-700",...Yl],primary:["!tw-text-primary-600","focus-visible:before:tw-ring-primary-600",...Yl],danger:["!tw-text-danger-600","focus-visible:before:tw-ring-primary-600",...Yl],"nav-contrast":["!tw-text-fg-sidenav-text","hover:!tw-bg-hover-contrast","focus-visible:before:tw-ring-border-focus",...Yl]},Jl={default:["tw-text-xl","tw-p-2.5","tw-rounded-md"],small:["tw-text-base","tw-p-2","tw-rounded"]};class Zl{get classList(){return["tw-font-medium","tw-leading-[0px]","tw-border-none","tw-transition","tw-bg-transparent","hover:tw-no-underline","hover:tw-bg-hover-default","focus:tw-outline-none"].concat(Hl[this.buttonType()]).concat(Jl[this.size()]).concat(this.showDisabledStyles()||this.disabled()?["aria-disabled:tw-opacity-60","aria-disabled:hover:!tw-bg-transparent","tw-cursor-default"]:[])}getFocusTarget(){return this.elementRef.nativeElement}constructor(){this.icon=o.geq.required({alias:"bitIconButton"}),this.buttonType=(0,o.hFB)("main"),this.size=(0,o.geq)("default"),this.elementRef=(0,a.WQX)(Fl.aKT),this.tooltip=(0,a.WQX)(_l,{host:!0,optional:!0}),this.label=(0,o.hFB)(),this.iconClass=(0,Rl.EW)(()=>[this.icon(),"!tw-m-0"]),this.disabledAttr=(0,Rl.EW)(()=>null!=this.disabled()&&!1!==this.disabled()||this.loading()),this.showDisabledStyles=(0,Rl.EW)(()=>this.showLoadingStyle()||this.disabledAttr()&&!1===this.loading()),this.loading=(0,o.geq)(!1),this.showLoadingStyle=(0,xl.ot)((0,xl.br)(this.loading).pipe((0,Al.s)(e=>(0,sa.Y)(e?75:0)))),this.disabled=(0,o.geq)(!1);const e=this.elementRef.nativeElement;Kl(e,this.disabledAttr);const t=e.getAttribute("title");(0,Rl.QZ)(()=>{var e;Dl({element:this.elementRef.nativeElement,title:void 0,label:this.label()});const i=t||this.label();i&&(null===(e=this.tooltip)||void 0===e||e.tooltipContent.set(i))})}}Zl.ɵfac=function(e){return new(e||Zl)},Zl.ɵcmp=Fl.VBU({type:Zl,selectors:[["button","bitIconButton","",5,"button","bitButton",""]],hostVars:3,hostBindings:function(e,t){2&e&&(Fl.BMQ("bitIconButton",t.icon()),Fl.HbH(t.classList))},inputs:{icon:[1,"bitIconButton","icon"],buttonType:[1,"buttonType"],size:[1,"size"],label:[1,"label"],loading:[1,"loading"],disabled:[1,"disabled"]},outputs:{icon:"bitIconButtonChange",size:"sizeChange",loading:"loadingChange",disabled:"disabledChange"},features:[Fl.Jv_([{provide:El,useExisting:Zl},{provide:$l,useExisting:Zl}]),Fl.nM4([ql,{directive:_l,inputs:["tooltipPosition","tooltipPosition"]}])],attrs:["bitIconButton",""],decls:5,vars:7,consts:[[1,"tw-relative","tw-inline-block","tw-leading-[0px]"],[1,"tw-inline-block","tw-leading-[0px]",3,"ngClass"],["aria-hidden","true",1,"bwi",3,"ngClass"],[1,"tw-absolute","tw-inset-0","tw-flex","tw-items-center","tw-justify-center",3,"ngClass"],["size","fill","noColor",""]],template:function(e,t){1&e&&(Fl.j41(0,"span",0)(1,"span",1),Fl.nrm(2,"i",2),Fl.k0s(),Fl.j41(3,"span",3),Fl.nrm(4,"bit-spinner",4),Fl.k0s()()),2&e&&(Fl.R7$(),Fl.Y8G("ngClass",Fl.eq3(3,Wl,t.showLoadingStyle())),Fl.R7$(),Fl.Y8G("ngClass",t.iconClass()),Fl.R7$(),Fl.Y8G("ngClass",Fl.eq3(5,Wl,!t.showLoadingStyle())))},dependencies:[kl.YU,Nl],encapsulation:2});class Ql{}Ql.ɵfac=function(e){return new(e||Ql)},Ql.ɵmod=Fl.$C({type:Ql}),Ql.ɵinj=a.G2t({imports:[Zl]});class ec{}ec.ɵfac=function(e){return new(e||ec)},ec.ɵmod=Fl.$C({type:ec}),ec.ɵinj=a.G2t({imports:[kl.MD,kl.MD]});class tc{}tc.ɵfac=function(e){return new(e||tc)},tc.ɵmod=Fl.$C({type:tc}),tc.ɵinj=a.G2t({});const ic={h1:["!tw-text-3xl","tw-text-main","tw-font-medium"],h2:["!tw-text-2xl","tw-text-main","tw-font-medium"],h3:["!tw-text-xl","tw-text-main","tw-font-medium"],h4:["!tw-text-lg","tw-text-main","tw-font-medium"],h5:["!tw-text-base","tw-text-main","tw-font-medium"],h6:["!tw-text-sm","tw-text-main","tw-font-medium"],body1:["!tw-text-base"],body2:["!tw-text-sm"],helper:["!tw-text-xs"]},nc={h1:["tw-mb-2"],h2:["tw-mb-2"],h3:["tw-mb-2"],h4:["tw-mb-2"],h5:["tw-mb-1.5"],h6:["tw-mb-1.5"],body1:[],body2:[],helper:[]};class rc{constructor(){this.bitTypography=o.hFB.required(),this.noMargin=(0,o.hFB)(!1,{transform:o.L39})}get classList(){return ic[this.bitTypography()].concat(this.noMargin()?[]:nc[this.bitTypography()])}}rc.ɵfac=function(e){return new(e||rc)},rc.ɵdir=Fl.FsC({type:rc,selectors:[["","bitTypography",""]],hostVars:2,hostBindings:function(e,t){2&e&&Fl.HbH(t.classList)},inputs:{bitTypography:[1,"bitTypography"],noMargin:[1,"noMargin"]}});class sc{constructor(e){this.i18nService=e}transform(e,t,i,n){return this.i18nService.t(e,t,i,n)}}function oc(e,t){1&e&&(Fl.j41(0,"p",3),Fl.EFF(1),Fl.k0s()),2&e&&(Fl.R7$(),Fl.JRh(t))}function ac(e,t){if(1&e&&(Fl.j41(0,"p",4),Fl.EFF(1),Fl.k0s()),2&e){const e=t.$implicit;Fl.R7$(),Fl.SpI(" ",e," ")}}sc.ɵfac=function(e){return new(e||sc)(Fl.rXU(Ul,16))},sc.ɵpipe=Fl.EJ8({name:"i18n",type:sc,pure:!0});const lc={success:{icon:"bwi-check-circle",bgColor:"tw-bg-success-100"},error:{icon:"bwi-error",bgColor:"tw-bg-danger-100"},info:{icon:"bwi-info-circle",bgColor:"tw-bg-info-100"},warning:{icon:"bwi-exclamation-triangle",bgColor:"tw-bg-warning-100"}};class cc{constructor(){this.variant=(0,o.hFB)("info"),this.message=o.hFB.required(),this.title=(0,o.hFB)(),this.progressWidth=(0,o.hFB)(0),this.onClose=new Fl.bkB}get iconClass(){return lc[this.variant()].icon}get bgColor(){return lc[this.variant()].bgColor}get messageArray(){const e=this.message();return Array.isArray(e)?e:[e]}}cc.ɵfac=function(e){return new(e||cc)},cc.ɵcmp=Fl.VBU({type:cc,selectors:[["bit-toast"]],inputs:{variant:[1,"variant"],message:[1,"message"],title:[1,"title"],progressWidth:[1,"progressWidth"]},outputs:{onClose:"onClose"},decls:13,vars:16,consts:[[1,"tw-flex","tw-items-center","tw-gap-4","tw-px-2","tw-pb-1","tw-pt-2"],["aria-hidden","true"],[1,"tw-sr-only"],["data-testid","toast-title",1,"tw-font-medium","tw-mb-0"],["bitTypography","body2","data-testid","toast-message",1,"tw-mb-2","last:tw-mb-0"],["bitIconButton","bwi-close","buttonType","main","type","button","size","small",1,"tw-ms-auto","hover:tw-border-text-main","focus-visible:before:tw-ring-text-main",3,"click","label"],[1,"tw-h-1","tw-w-full","tw-bg-text-main/30"]],template:function(e,t){if(1&e&&(Fl.j41(0,"div")(1,"div",0),Fl.nrm(2,"i",1),Fl.j41(3,"div")(4,"span",2),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.nVh(7,oc,2,1,"p",3),Fl.Z7z(8,ac,2,1,"p",4,Fl.fX1),Fl.k0s(),Fl.j41(10,"button",5),Fl.nI1(11,"i18n"),Fl.bIt("click",function(){return t.onClose.emit()}),Fl.k0s()(),Fl.nrm(12,"div",6),Fl.k0s()),2&e){let e;Fl.HbH(Fl.VkB("tw-mb-1 tw-min-w-[--bit-toast-width] tw-text-main tw-flex tw-flex-col tw-justify-between tw-rounded-md tw-pointer-events-auto tw-cursor-default tw-overflow-hidden tw-shadow-lg ",t.bgColor)),Fl.BMQ("role","error"===t.variant()?"alert":null),Fl.R7$(2),Fl.HbH(Fl.VkB("bwi tw-text-xl tw-py-1.5 tw-px-2.5 ",t.iconClass)),Fl.R7$(3),Fl.JRh(Fl.bMT(6,12,t.variant())),Fl.R7$(2),Fl.vxM((e=t.title())?7:-1,e),Fl.R7$(),Fl.Dyx(t.messageArray),Fl.R7$(2),Fl.Y8G("label",Fl.bMT(11,14,"close")),Fl.R7$(2),Fl.xc7("width",t.progressWidth()+"%")}},dependencies:[ec,Ql,Zl,tc,rc,sc],encapsulation:2});class uc extends Tl.y8{constructor(e,t){super(e,t)}}uc.ɵfac=function(e){return new(e||uc)(Fl.rXU(Tl.tw),Fl.rXU(Tl.sn))},uc.ɵcmp=Fl.VBU({type:uc,selectors:[["ng-component"]],features:[Fl.Vt3],decls:1,vars:4,consts:[[3,"onClose","title","variant","message","progressWidth"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-toast",0),Fl.bIt("onClose",function(){return t.remove()}),Fl.k0s()),2&e&&Fl.Y8G("title",null==t.options||null==t.options.payload?null:t.options.payload.title)("variant",null==t.options||null==t.options.payload?null:t.options.payload.variant)("message",null==t.options||null==t.options.payload?null:t.options.payload.message)("progressWidth",t.width())},dependencies:[cc],encapsulation:2,data:{animation:[(0,Pl.hZ)("flyInOut",[(0,Pl.wk)("inactive",(0,Pl.iF)({opacity:0})),(0,Pl.wk)("active",(0,Pl.iF)({opacity:1})),(0,Pl.wk)("removed",(0,Pl.iF)({opacity:0})),(0,Pl.kY)("inactive => active",(0,Pl.i0)("{{ easeTime }}ms {{ easing }}")),(0,Pl.kY)("active => removed",(0,Pl.i0)("{{ easeTime }}ms {{ easing }}"))])]}});class dc{static forRoot(e={}){return{ngModule:dc,providers:[{provide:Tl.lt,useValue:{default:hc,config:e}}]}}}dc.ɵfac=function(e){return new(e||dc)},dc.ɵmod=Fl.$C({type:dc}),dc.ɵinj=a.G2t({imports:[uc]});const hc=Object.assign(Object.assign({},Tl.H5),{toastComponent:uc,tapToDismiss:!1,timeOut:5e3,extendedTimeOut:2e3,maxOpened:5,autoDismiss:!0,progressBar:!0});class pc{}pc.ɵfac=function(e){return new(e||pc)},pc.ɵmod=Fl.$C({type:pc}),pc.ɵinj=a.G2t({});class vc extends a.nKC{}class fc{}const mc=["*",[["bit-label"]],[["bit-hint"]]],gc=e=>[e];function yc(e,t){1&e&&(Fl.j41(0,"span",3),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" (",Fl.bMT(2,1,"required"),")"))}function bc(e,t){1&e&&(Fl.j41(0,"span",4),Fl.SdG(1,2),Fl.k0s())}function wc(e,t){if(1&e&&(Fl.j41(0,"div",5),Fl.nrm(1,"i",6),Fl.EFF(2),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.SpI(" ",e.displayError," ")}}class Sc{get classes(){return[].concat(this.inline()?["tw-inline-block","tw-me-4"]:["tw-block"]).concat(this.disableMargin()?[]:["tw-mb-4"])}constructor(e){this.i18nService=e,this.label=(0,o.hFB)(),this.inline=(0,o.hFB)(!1,{transform:o.L39}),this.disableMargin=(0,o.hFB)(!1,{transform:o.L39}),this.formControl=o.sbv.required(fc)}get required(){return this.formControl().required}get hasError(){return this.formControl().hasError}get error(){return this.formControl().error}get displayError(){var e,t;return"required"===this.error[0]?this.i18nService.t("inputRequired"):(null===(e=this.error[1])||void 0===e?void 0:e.message)?null===(t=this.error[1])||void 0===t?void 0:t.message:this.error}}Sc.ɵfac=function(e){return new(e||Sc)(Fl.rXU(Ul))},Sc.ɵcmp=Fl.VBU({type:Sc,selectors:[["bit-form-control"]],contentQueries:function(e,t,i){1&e&&Fl.C6U(i,t.formControl,fc,5),2&e&&Fl.NyB()},hostVars:2,hostBindings:function(e,t){2&e&&Fl.HbH(t.classes)},inputs:{label:[1,"label"],inline:[1,"inline"],disableMargin:[1,"disableMargin"]},ngContentSelectors:["*","bit-label","bit-hint"],decls:8,vars:7,consts:[[1,"tw-transition","tw-items-start","[&:has(input[type='checkbox'])]:tw-gap-1","[&:has(input[type='radio'])]:tw-gap-1.5","tw-select-none","tw-mb-0","tw-inline-flex","tw-rounded","has-[:focus-visible]:tw-ring","has-[:focus-visible]:tw-ring-primary-600",3,"ngClass"],[1,"tw-inline-flex","tw-flex-col",3,"ngClass"],["bitTypography","body2"],[1,"tw-text-xs","tw-font-normal"],[1,"[&_bit-hint]:tw-mt-0","tw-leading-none"],[1,"tw-mt-1","tw-text-danger","tw-text-xs","tw-ms-0.5"],[1,"bwi","bwi-error"]],template:function(e,t){1&e&&(Fl.NAR(mc),Fl.j41(0,"label",0),Fl.SdG(1),Fl.j41(2,"span",1)(3,"span",2),Fl.SdG(4,1),Fl.nVh(5,yc,3,3,"span",3),Fl.k0s(),Fl.nVh(6,bc,2,0,"span",4),Fl.k0s()(),Fl.nVh(7,wc,3,1,"div",5)),2&e&&(Fl.Y8G("ngClass",Fl.eq3(5,gc,t.formControl().disabled?"tw-cursor-auto":"tw-cursor-pointer")),Fl.R7$(2),Fl.Y8G("ngClass",t.formControl().disabled?"tw-text-muted":"tw-text-main"),Fl.R7$(3),Fl.vxM(t.required?5:-1),Fl.R7$(),Fl.vxM(t.hasError?-1:6),Fl.R7$(),Fl.vxM(t.hasError?7:-1))},dependencies:[kl.YU,rc,sc],encapsulation:2});const kc=["*",[["","slot","end"]]],Ic=e=>({"tw-truncate":e});function Cc(e,t){1&e&&Fl.SdG(0,1)}function Tc(e,t){1&e&&Fl.eu8(0)}function Pc(e,t){if(1&e&&Fl.DNE(0,Tc,1,0,"ng-container",2),2&e){Fl.XpG();const e=Fl.sdS(1);Fl.Y8G("ngTemplateOutlet",e)}}function Fc(e,t){1&e&&Fl.eu8(0)}function Rc(e,t){if(1&e&&Fl.DNE(0,Fc,1,0,"ng-container",2),2&e){Fl.XpG();const e=Fl.sdS(1);Fl.Y8G("ngTemplateOutlet",e)}}let xc=0;class Ac{constructor(e,t){this.elementRef=e,this.parentFormControl=t,this.classList=["tw-inline-flex","tw-gap-1","tw-items-baseline","tw-flex-row","tw-min-w-0"],this.id=(0,o.hFB)("bit-label-"+xc++)}get title(){var e,t;return null!==(t=null===(e=this.elementRef.nativeElement.textContent)||void 0===e?void 0:e.trim())&&void 0!==t?t:""}get isInsideFormControl(){return!!this.parentFormControl}}Ac.ɵfac=function(e){return new(e||Ac)(Fl.rXU(Fl.aKT),Fl.rXU(Sc,8))},Ac.ɵcmp=Fl.VBU({type:Ac,selectors:[["bit-label"]],hostVars:4,hostBindings:function(e,t){2&e&&(Fl.Avn("id",t.id())("title",t.title),Fl.HbH(t.classList))},inputs:{id:[1,"id"]},ngContentSelectors:["*","[slot=end]"],decls:6,vars:5,consts:[["endSlotContent",""],[3,"ngClass"],[4,"ngTemplateOutlet"]],template:function(e,t){1&e&&(Fl.NAR(kc),Fl.DNE(0,Cc,1,0,"ng-template",null,0,Fl.C5r),Fl.j41(2,"span",1),Fl.SdG(3),Fl.nVh(4,Pc,1,1,"ng-container"),Fl.k0s(),Fl.nVh(5,Rc,1,1,"ng-container")),2&e&&(Fl.R7$(2),Fl.Y8G("ngClass",Fl.eq3(3,Ic,!t.isInsideFormControl)),Fl.R7$(2),Fl.vxM(t.isInsideFormControl?4:-1),Fl.R7$(),Fl.vxM(t.isInsideFormControl?-1:5))},dependencies:[kl.MD,kl.YU,kl.T3],encapsulation:2});class Dc{}Dc.ɵfac=function(e){return new(e||Dc)},Dc.ɵmod=Fl.$C({type:Dc}),Dc.ɵinj=a.G2t({imports:[Ac]});let Ec=0;class $c{constructor(e){this.ngControl=e,this.id=(0,o.hFB)("bit-radio-input-"+Ec++),this.inputClasses=["tw-appearance-none","tw-outline-none","tw-relative","tw-transition","tw-cursor-pointer","tw-inline-block","tw-rounded-full","tw-border","tw-border-solid","tw-border-secondary-600","tw-w-[1.12rem]","tw-h-[1.12rem]","!tw-p-[.125rem]","tw-flex-none","hover:tw-border-2","[&>label:hover]:tw-border-2","[&:not(bit-form-control_*)]:focus-visible:tw-ring-2","[&:not(bit-form-control_*)]:focus-visible:tw-ring-offset-2","[&:not(bit-form-control_*)]:focus-visible:tw-ring-primary-600","before:tw-content-['']","before:tw-transition","before:tw-block","before:tw-rounded-full","before:tw-size-full","disabled:tw-cursor-auto","disabled:tw-bg-secondary-100","disabled:hover:tw-border","checked:tw-bg-text-contrast","checked:tw-border-primary-600","checked:tw-border-2","checked:hover:tw-border-2","checked:hover:tw-border-primary-700","checked:hover:before:tw-bg-primary-700","[&>label:hover]:checked:tw-bg-primary-700","[&>label:hover]:checked:tw-border-primary-700","checked:before:tw-bg-primary-600","checked:disabled:tw-border-secondary-600","checked:disabled:hover:tw-border-secondary-600","checked:disabled:hover:tw-border-2","checked:disabled:tw-bg-background","checked:disabled:hover:before:tw-bg-secondary-600","checked:disabled:before:tw-bg-secondary-600"],this.disabledInput=(0,o.hFB)(!1,{transform:o.L39,alias:"disabled"})}get disabled(){var e;return this.disabledInput()||(null===(e=this.ngControl)||void 0===e?void 0:e.disabled)||!1}get required(){var e,t,i;return null!==(i=null===(t=null===(e=this.ngControl)||void 0===e?void 0:e.control)||void 0===t?void 0:t.hasValidator(Il.k0.requiredTrue))&&void 0!==i&&i}get hasError(){var e,t;return!("INVALID"!==(null===(e=this.ngControl)||void 0===e?void 0:e.status)||!(null===(t=this.ngControl)||void 0===t?void 0:t.touched))}get error(){var e,t;const i=null!==(t=null===(e=this.ngControl)||void 0===e?void 0:e.errors)&&void 0!==t?t:{},n=Object.keys(i)[0];return[n,i[n]]}}$c.ɵfac=function(e){return new(e||$c)(Fl.rXU(Il.vO,10))},$c.ɵcmp=Fl.VBU({type:$c,selectors:[["input","type","radio","bitRadio",""]],hostVars:4,hostBindings:function(e,t){2&e&&(Fl.Avn("id",t.id())("disabled",t.disabled),Fl.HbH(t.inputClasses))},inputs:{id:[1,"id"],disabledInput:[1,"disabled","disabledInput"]},features:[Fl.Jv_([{provide:fc,useExisting:$c}])],attrs:["type","radio","bitRadio",""],decls:0,vars:0,template:function(e,t){},encapsulation:2});const Oc=[[["bit-label"]],"*",[["bit-hint"]]];function Uc(e,t){1&e&&(Fl.j41(0,"span",2),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" (",Fl.bMT(2,1,"required"),")"))}function Mc(e,t){1&e&&Fl.eu8(0)}function Nc(e,t){if(1&e&&(Fl.j41(0,"fieldset")(1,"legend",1),Fl.SdG(2),Fl.nVh(3,Uc,3,3,"span",2),Fl.k0s(),Fl.DNE(4,Mc,1,0,"ng-container",3),Fl.k0s()),2&e){const e=Fl.XpG(),t=Fl.sdS(3);Fl.R7$(3),Fl.vxM(e.required?3:-1),Fl.R7$(),Fl.Y8G("ngTemplateOutlet",t)}}function Vc(e,t){1&e&&Fl.eu8(0)}function Bc(e,t){if(1&e&&Fl.DNE(0,Vc,1,0,"ng-container",3),2&e){Fl.XpG();const e=Fl.sdS(3);Fl.Y8G("ngTemplateOutlet",e)}}function jc(e,t){1&e&&(Fl.j41(0,"div"),Fl.SdG(1,1),Fl.k0s(),Fl.SdG(2,2,["ngProjectAs","bit-hint",5,["bit-hint"]]))}let Gc=0;class Lc{get name(){var e,t;return null===(t=null===(e=this.ngControl)||void 0===e?void 0:e.name)||void 0===t?void 0:t.toString()}constructor(e){this.ngControl=e,this.disabled=!1,this.block=(0,o.hFB)(!1),this.role="radiogroup",this.id=(0,o.hFB)("bit-radio-group-"+Gc++),this.classList=["tw-block","tw-mb-4"],this.label=(0,o.sbv)(Ac),null!=e&&(e.valueAccessor=this)}get required(){var e,t,i;return null!==(i=null===(t=null===(e=this.ngControl)||void 0===e?void 0:e.control)||void 0===t?void 0:t.hasValidator(Il.k0.required))&&void 0!==i&&i}writeValue(e){this.selected=e}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){this.disabled=e}onInputChange(e){var t;this.selected=e,null===(t=this.onChange)||void 0===t||t.call(this,this.selected)}onBlur(){var e;null===(e=this.onTouched)||void 0===e||e.call(this)}}Lc.ɵfac=function(e){return new(e||Lc)(Fl.rXU(Il.vO,10))},Lc.ɵcmp=Fl.VBU({type:Lc,selectors:[["bit-radio-group"]],contentQueries:function(e,t,i){1&e&&Fl.C6U(i,t.label,Ac,5),2&e&&Fl.NyB()},hostVars:4,hostBindings:function(e,t){2&e&&(Fl.Avn("id",t.id()),Fl.BMQ("role",t.role),Fl.HbH(t.classList))},inputs:{block:[1,"block"],id:[1,"id"]},ngContentSelectors:["bit-label","*","bit-hint"],decls:4,vars:2,consts:[["content",""],[1,"tw-mb-1","tw-block","tw-text-sm","tw-font-medium","tw-text-main"],[1,"tw-text-xs","tw-font-normal"],[4,"ngTemplateOutlet"]],template:function(e,t){1&e&&(Fl.NAR(Oc),Fl.nVh(0,Nc,5,2,"fieldset"),Fl.nVh(1,Bc,1,1,"ng-container"),Fl.DNE(2,jc,3,0,"ng-template",null,0,Fl.C5r)),2&e&&(Fl.vxM(t.label()?0:-1),Fl.R7$(),Fl.vxM(t.label()?-1:1))},dependencies:[kl.T3,sc],encapsulation:2});const zc=[[["bit-label"]],[["bit-hint"]]];let _c=0;class Kc{get classList(){return[this.block?"tw-block":"tw-inline-block","tw-mb-1","[&_bit-hint]:tw-mt-0"]}constructor(e){this.groupComponent=e,this.id=(0,o.hFB)("bit-radio-button-"+_c++),this.value=(0,o.hFB)(),this.disabled=(0,o.hFB)(!1)}get inputId(){return`${this.id()}-input`}get name(){return this.groupComponent.name}get selected(){return this.groupComponent.selected===this.value()}get groupDisabled(){return this.groupComponent.disabled}get block(){return this.groupComponent.block()}onInputChange(){this.groupComponent.onInputChange(this.value())}onBlur(){this.groupComponent.onBlur()}}Kc.ɵfac=function(e){return new(e||Kc)(Fl.rXU(Lc))},Kc.ɵcmp=Fl.VBU({type:Kc,selectors:[["bit-radio-button"]],hostVars:3,hostBindings:function(e,t){2&e&&(Fl.Avn("id",t.id()),Fl.HbH(t.classList))},inputs:{id:[1,"id"],value:[1,"value"],disabled:[1,"disabled"]},ngContentSelectors:["bit-label","bit-hint"],decls:4,vars:5,consts:[["disableMargin","",3,"inline"],["type","radio","bitRadio","",3,"change","blur","id","disabled","value","checked"]],template:function(e,t){1&e&&(Fl.NAR(zc),Fl.j41(0,"bit-form-control",0)(1,"input",1),Fl.bIt("change",function(){return t.onInputChange()})("blur",function(){return t.onBlur()}),Fl.k0s(),Fl.SdG(2,0,["ngProjectAs","bit-label",5,["bit-label"]]),Fl.SdG(3,1,["ngProjectAs","bit-hint",5,["bit-hint"]]),Fl.k0s()),2&e&&(Fl.Y8G("inline",!t.block),Fl.R7$(),Fl.Y8G("id",t.inputId)("disabled",t.groupDisabled||t.disabled())("value",t.value())("checked",t.selected))},dependencies:[Dc,Sc,$c],encapsulation:2});class Xc{}Xc.ɵfac=function(e){return new(e||Xc)},Xc.ɵmod=Fl.$C({type:Xc}),Xc.ɵinj=a.G2t({imports:[Dc,Kc,Dc]});class qc{}qc.ɵfac=function(e){return new(e||qc)},qc.ɵmod=Fl.$C({type:qc}),qc.ɵinj=a.G2t({});var Wc=i(39180),Yc=i(97658);const Hc=e=>({"tw-truncate tw-block":e}),Jc={primary:["tw-bg-primary-100","tw-border-primary-700","!tw-text-primary-700"],secondary:["tw-bg-secondary-100","tw-border-secondary-700","!tw-text-secondary-700"],success:["tw-bg-success-100","tw-border-success-700","!tw-text-success-700"],danger:["tw-bg-danger-100","tw-border-danger-700","!tw-text-danger-700"],warning:["tw-bg-warning-100","tw-border-warning-700","!tw-text-warning-700"],info:["tw-bg-info-100","tw-border-info-700","!tw-text-info-700"],notification:["tw-bg-notification-100","tw-border-notification-600","!tw-text-notification-600"]},Zc={primary:["hover:tw-bg-primary-600","hover:tw-border-primary-600","hover:!tw-text-contrast"],secondary:["hover:tw-bg-secondary-600","hover:tw-border-secondary-600","hover:!tw-text-contrast"],success:["hover:tw-bg-success-600","hover:tw-border-success-600","hover:!tw-text-contrast"],danger:["hover:tw-bg-danger-600","hover:tw-border-danger-600","hover:!tw-text-contrast"],warning:["hover:tw-bg-warning-600","hover:tw-border-warning-600","hover:!tw-text-black"],info:["hover:tw-bg-info-600","hover:tw-border-info-600","hover:!tw-text-black"],notification:["hover:tw-bg-notification-600","hover:tw-border-notification-600","hover:!tw-text-contrast"]};class Qc{constructor(){this.el=(0,a.WQX)(Fl.aKT),this.hasHoverEffects="SPAN"!==this.el.nativeElement.nodeName,this.title=(0,o.hFB)(),this.variant=(0,o.hFB)("primary"),this.truncate=(0,o.hFB)(!0),this.maxWidthClass=(0,o.hFB)("tw-max-w-40"),this.classList=(0,Rl.EW)(()=>["tw-inline-block","tw-py-1","tw-px-2","tw-font-medium","tw-text-center","tw-align-text-top","tw-rounded-full","tw-border-[0.5px]","tw-border-solid","tw-box-border","tw-whitespace-nowrap","tw-text-xs","hover:tw-no-underline","focus-visible:tw-outline-none","focus-visible:tw-ring-2","focus-visible:tw-ring-offset-2","focus-visible:tw-ring-primary-600","disabled:tw-bg-secondary-300","disabled:hover:tw-bg-secondary-300","disabled:tw-border-secondary-300","disabled:hover:tw-border-secondary-300","disabled:!tw-text-muted","disabled:hover:!tw-text-muted","disabled:tw-cursor-not-allowed"].concat(Jc[this.variant()]).concat(this.hasHoverEffects?[...Zc[this.variant()],"tw-min-w-10"]:[]).concat(this.truncate()?this.maxWidthClass():[])),this.titleAttr=(0,Rl.EW)(()=>{var e,t;const i=this.title();return void 0!==i?i:this.truncate()?null===(t=null===(e=this.el.nativeElement)||void 0===e?void 0:e.textContent)||void 0===t?void 0:t.trim():null})}getFocusTarget(){return this.el.nativeElement}}Qc.ɵfac=function(e){return new(e||Qc)},Qc.ɵcmp=Fl.VBU({type:Qc,selectors:[["span","bitBadge",""],["a","bitBadge",""],["button","bitBadge",""]],hostVars:3,hostBindings:function(e,t){2&e&&(Fl.BMQ("title",t.titleAttr()),Fl.HbH(t.classList()))},inputs:{title:[1,"title"],variant:[1,"variant"],truncate:[1,"truncate"],maxWidthClass:[1,"maxWidthClass"]},features:[Fl.Jv_([{provide:$l,useExisting:Qc}])],attrs:["bitBadge",""],ngContentSelectors:["*"],decls:2,vars:3,consts:[[3,"ngClass"]],template:function(e,t){1&e&&(Fl.NAR(),Fl.j41(0,"span",0),Fl.SdG(1),Fl.k0s()),2&e&&Fl.Y8G("ngClass",Fl.eq3(1,Hc,t.truncate()))},dependencies:[kl.MD,kl.YU],encapsulation:2,changeDetection:0});class eu{}eu.ɵfac=function(e){return new(e||eu)},eu.ɵmod=Fl.$C({type:eu}),eu.ɵinj=a.G2t({imports:[Qc]});class tu{}function iu(e,t){1&e&&Fl.nrm(0,"bit-spinner")}function nu(e,t){if(1&e&&Fl.nrm(0,"i",8),2&e){const e=Fl.XpG().item;Fl.HbH(Fl.VkB("bwi bwi-fw ",e.icon))}}function ru(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",4),Fl.bIt("click",function(){const t=a.eBV(e),i=t.item,n=t.clear;return a.Njj(n(i))}),Fl.nVh(1,nu,1,3,"i",5),Fl.j41(2,"span",6),Fl.EFF(3),Fl.k0s(),Fl.nrm(4,"i",7),Fl.k0s()}if(2&e){const e=t.item,i=Fl.XpG();Fl.Y8G("disabled",i.disabled),Fl.R7$(),Fl.vxM(null!=e.icon?1:-1),Fl.R7$(2),Fl.SpI(" ",e.labelName," ")}}function su(e,t){1&e&&Fl.nrm(0,"i",11)}function ou(e,t){if(1&e&&Fl.nrm(0,"i",8),2&e){const e=Fl.XpG().item;Fl.HbH(Fl.VkB("bwi bwi-fw ",e.icon))}}function au(e,t){if(1&e&&(Fl.j41(0,"div",9)(1,"div",10),Fl.nVh(2,su,1,0,"i",11),Fl.k0s(),Fl.j41(3,"div",12),Fl.nVh(4,ou,1,3,"i",5),Fl.k0s(),Fl.j41(5,"div",13),Fl.EFF(6),Fl.k0s()()),2&e){const e=t.item,i=Fl.XpG();Fl.R7$(2),Fl.vxM(i.isSelected(e)?2:-1),Fl.R7$(2),Fl.vxM(null!=e.icon?4:-1),Fl.R7$(2),Fl.SpI(" ",e.listName," ")}}let lu=0;class cu{constructor(e,t){this.i18nService=e,this.ngControl=t,this.select=o.ebz.required(Yc.vr),this.baseItems=o.geq.required(),this.removeSelectedItems=(0,o.hFB)(!1),this.placeholder=(0,o.geq)(),this.loading=(0,o.hFB)(!1),this.selectedItems=null,this.searchInputId="search-input-"+lu++,this.onItemsConfirmed=new Fl.bkB,this.keyDown=e=>{const t=this.select();return!(!t.isOpen()&&"Enter"===e.key&&!(0,Wc.rp)(e))&&(!(t.isOpen()&&"Escape"===e.key&&!(0,Wc.rp)(e))||(this.selectedItems=[],t.close(),e.stopPropagation(),!1))},this.id=(0,o.hFB)("bit-multi-select-"+lu++),null!=t&&(t.valueAccessor=this)}ngOnInit(){this.placeholder.update(e=>null!=e?e:this.i18nService.t("multiSelectPlaceholder")),this.loadingText=this.i18nService.t("multiSelectLoading")}isSelected(e){var t;return null!=(null===(t=this.selectedItems)||void 0===t?void 0:t.find(t=>t.id===e.id))}onDropdownClosed(){if(null!=this.selectedItems&&0!=this.selectedItems.length&&(this.onItemsConfirmed.emit(this.selectedItems),this.removeSelectedItems())){let e=this.baseItems();this.selectedItems.forEach(t=>{e=e.filter(e=>t.id!==e.id)}),this.selectedItems=null,this.baseItems.set(e)}}writeValue(e){this.selectedItems=e}registerOnChange(e){this.notifyOnChange=e}registerOnTouched(e){this.notifyOnTouched=e}setDisabledState(e){this.disabled=e}onChange(e){this.notifyOnChange&&this.notifyOnChange(e)}onBlur(){this.notifyOnTouched&&this.notifyOnTouched()}get ariaDescribedBy(){return this._ariaDescribedBy}set ariaDescribedBy(e){var t;this._ariaDescribedBy=e,null===(t=this.select())||void 0===t||t.searchInput().nativeElement.setAttribute("aria-describedby",null!=e?e:"")}get labelForId(){return this.searchInputId}get required(){var e,t,i,n;return null!==(n=null!==(e=this._required)&&void 0!==e?e:null===(i=null===(t=this.ngControl)||void 0===t?void 0:t.control)||void 0===i?void 0:i.hasValidator(Il.k0.required))&&void 0!==n&&n}set required(e){this._required=null!=e&&!1!==e}get hasError(){var e,t;return!("INVALID"!==(null===(e=this.ngControl)||void 0===e?void 0:e.status)||!(null===(t=this.ngControl)||void 0===t?void 0:t.touched))}get error(){var e,t;const i=null!==(t=null===(e=this.ngControl)||void 0===e?void 0:e.errors)&&void 0!==t?t:{},n=Object.keys(i)[0];return[n,i[n]]}}cu.ɵfac=function(e){return new(e||cu)(Fl.rXU(Ul),Fl.rXU(Il.vO,10))},cu.ɵcmp=Fl.VBU({type:cu,selectors:[["bit-multi-select"]],viewQuery:function(e,t){1&e&&Fl.wEZ(t.select,Yc.vr,5),2&e&&Fl.NyB()},hostVars:3,hostBindings:function(e,t){2&e&&(Fl.Avn("id",t.id()),Fl.BMQ("aria-describedby",t.ariaDescribedBy)("required",t.required))},inputs:{baseItems:[1,"baseItems"],removeSelectedItems:[1,"removeSelectedItems"],placeholder:[1,"placeholder"],loading:[1,"loading"],disabled:[2,"disabled","disabled",o.L39],id:[1,"id"],required:"required"},outputs:{baseItems:"baseItemsChange",placeholder:"placeholderChange",onItemsConfirmed:"onItemsConfirmed"},features:[Fl.Jv_([{provide:tu,useExisting:cu}])],decls:6,vars:19,consts:[["bindLabel","listName","groupBy","parentGrouping","appendTo","body",3,"ngModelChange","blur","close","items","ngModel","placeholder","loading","loadingText","notFoundText","clearAllText","multiple","closeOnSelect","disabled","clearSearchOnAdd","labelForId","keyDownFn"],["ng-loadingspinner-tmp",""],["ng-label-tmp",""],["ng-option-tmp",""],["type","button","bitBadge","","variant","primary",1,"tw-me-1","disabled:tw-border-0","tw-flex","tw-gap-1.5","tw-items-center",3,"click","disabled"],["aria-hidden","true",3,"class"],[1,"tw-truncate"],["aria-hidden","true",1,"bwi","bwi-fw","bwi-close","bwi-sm"],["aria-hidden","true"],[1,"tw-flex"],[1,"tw-w-7","tw-flex-none"],["aria-hidden","true",1,"bwi","bwi-fw","bwi-check"],[1,"tw-me-2","tw-flex-initial"],[1,"tw-flex-1"]],template:function(e,t){1&e&&(Fl.j41(0,"ng-select",0),Fl.nI1(1,"i18n"),Fl.nI1(2,"i18n"),Fl.mxI("ngModelChange",function(e){return Fl.DH7(t.selectedItems,e)||(t.selectedItems=e),e}),Fl.bIt("ngModelChange",function(e){return t.onChange(e)})("blur",function(){return t.onBlur()})("close",function(){return t.onDropdownClosed()}),Fl.DNE(3,iu,1,0,"ng-template",1)(4,ru,5,3,"ng-template",2)(5,au,7,3,"ng-template",3),Fl.k0s()),2&e&&(Fl.Y8G("notFoundText",Fl.mNQ(Fl.bMT(1,15,"multiSelectNotFound")))("clearAllText",Fl.mNQ(Fl.bMT(2,17,"multiSelectClearAll")))("items",t.baseItems()),Fl.R50("ngModel",t.selectedItems),Fl.Y8G("placeholder",t.placeholder())("loading",t.loading())("loadingText",t.loadingText)("multiple",!0)("closeOnSelect",!1)("disabled",t.disabled)("clearSearchOnAdd",!0)("labelForId",t.labelForId)("keyDownFn",t.keyDown))},dependencies:[Yc.MQ,Yc.vr,Yc.Uq,Yc.ZZ,Yc.QQ,Il.X1,Il.BC,Il.YN,Il.vS,eu,Qc,Nl,sc],encapsulation:2});class uu{}uu.ɵfac=function(e){return new(e||uu)},uu.ɵmod=Fl.$C({type:uu}),uu.ɵinj=a.G2t({imports:[cu]});let du=0;class hu{constructor(){this.id="bit-hint-"+du++}}hu.ɵfac=function(e){return new(e||hu)},hu.ɵdir=Fl.FsC({type:hu,selectors:[["bit-hint"]],hostAttrs:[1,"tw-text-muted","tw-font-normal","tw-inline-block","tw-mt-1","tw-text-xs"],hostVars:1,hostBindings:function(e,t){2&e&&Fl.Avn("id",t.id)}});let pu=0;function vu(e){return["tw-border","!tw-border-solid",e?"tw-border-danger-600":"tw-border-secondary-500","focus:tw-outline-none"]}class fu{classList(){const e=["tw-block","tw-w-full","tw-h-full","tw-px-1","tw-text-main","tw-placeholder-text-muted","tw-bg-background","tw-border-none","focus:tw-outline-none","[&:is(input,textarea):disabled]:tw-bg-secondary-100"];return null===this.parentFormField&&e.push(...vu(this.hasError),...this.standaloneInputClasses),e.filter(e=>""!=e)}get ariaInvalid(){return!!this.hasError||void 0}get required(){var e,t,i,n;return null!==(n=null!==(e=this._required)&&void 0!==e?e:null===(i=null===(t=this.ngControl)||void 0===t?void 0:t.control)||void 0===i?void 0:i.hasValidator(Il.k0.required))&&void 0!==n&&n}set required(e){this._required=null!=e&&!1!==e}get labelForId(){return this.id()}onInput(){var e,t;null===(t=null===(e=this.ngControl)||void 0===e?void 0:e.control)||void 0===t||t.markAsUntouched()}get hasError(){var e,t,i,n,r,s;return this.showErrorsWhenDisabled()?!("INVALID"!==(null===(e=this.ngControl)||void 0===e?void 0:e.status)&&"DISABLED"!==(null===(t=this.ngControl)||void 0===t?void 0:t.status)||!(null===(i=this.ngControl)||void 0===i?void 0:i.touched)||null==(null===(n=this.ngControl)||void 0===n?void 0:n.errors)):!("INVALID"!==(null===(r=this.ngControl)||void 0===r?void 0:r.status)||!(null===(s=this.ngControl)||void 0===s?void 0:s.touched))}get error(){var e;const t=null!==(e=this.ngControl.errors)&&void 0!==e?e:{},i=Object.keys(t)[0];return[i,t[i]]}constructor(e,t,i,n){this.ngControl=e,this.ngZone=t,this.elementRef=i,this.parentFormField=n,this.id=(0,o.hFB)("bit-input-"+pu++),this.type=(0,o.geq)(),this.spellcheck=(0,o.geq)(),this.hasPrefix=(0,o.hFB)(!1),this.hasSuffix=(0,o.hFB)(!1),this.showErrorsWhenDisabled=(0,o.hFB)(!1)}focus(){this.ngZone.runOutsideAngular(()=>{const e=this.elementRef.nativeElement.value.length;this.elementRef.nativeElement.setSelectionRange(e,e),this.elementRef.nativeElement.focus()})}get readOnly(){return this.elementRef.nativeElement.readOnly}get standaloneInputClasses(){return["tw-px-3","tw-py-2","tw-rounded-lg",this.hasError?"hover:tw-border-danger-700":"hover:tw-border-primary-600","focus:hover:tw-border-primary-600","disabled:tw-bg-secondary-100","disabled:hover:tw-border-secondary-500","focus:tw-border-primary-600","focus:tw-ring-1","focus:tw-ring-inset","focus:tw-ring-primary-600","focus:tw-z-10"]}}fu.ɵfac=function(e){return new(e||fu)(Fl.rXU(Il.vO,10),Fl.rXU(Fl.SKi),Fl.rXU(Fl.aKT),Fl.rXU(ju,8))},fu.ɵdir=Fl.FsC({type:fu,selectors:[["input","bitInput",""],["select","bitInput",""],["textarea","bitInput",""]],hostVars:8,hostBindings:function(e,t){1&e&&Fl.bIt("input",function(){return t.onInput()}),2&e&&(Fl.Avn("id",t.id())("required",t.required),Fl.BMQ("type",t.type())("spellcheck",t.spellcheck())("aria-describedby",t.ariaDescribedBy)("aria-invalid",t.ariaInvalid),Fl.HbH(t.classList()))},inputs:{id:[1,"id"],type:[1,"type"],spellcheck:[1,"spellcheck"],required:"required",hasPrefix:[1,"hasPrefix"],hasSuffix:[1,"hasSuffix"],showErrorsWhenDisabled:[1,"showErrorsWhenDisabled"]},outputs:{type:"typeChange",spellcheck:"spellcheckChange"},features:[Fl.Jv_([{provide:tu,useExisting:fu}])]});let mu=0;class gu{constructor(e){this.i18nService=e,this.id="bit-error-"+mu++,this.error=(0,o.hFB)()}get displayError(){var e,t,i,n,r,s,o;const a=this.error();if(!a)return"";switch(a[0]){case"required":return this.i18nService.t("inputRequired");case"email":return this.i18nService.t("inputEmail");case"minlength":return this.i18nService.t("inputMinLength",null===(e=a[1])||void 0===e?void 0:e.requiredLength);case"maxlength":return this.i18nService.t("inputMaxLength",null===(t=a[1])||void 0===t?void 0:t.requiredLength);case"min":return this.i18nService.t("inputMinValue",null===(i=a[1])||void 0===i?void 0:i.min);case"max":return this.i18nService.t("inputMaxValue",null===(n=a[1])||void 0===n?void 0:n.max);case"forbiddenCharacters":return this.i18nService.t("inputForbiddenCharacters",null===(r=a[1])||void 0===r?void 0:r.characters.join(", "));case"multipleEmails":return this.i18nService.t("multipleInputEmails");case"trim":return this.i18nService.t("inputTrimValidator");default:return(null===(s=a[1])||void 0===s?void 0:s.message)?null===(o=a[1])||void 0===o?void 0:o.message:a}}}gu.ɵfac=function(e){return new(e||gu)(Fl.rXU(Ul))},gu.ɵcmp=Fl.VBU({type:gu,selectors:[["bit-error"]],hostAttrs:["aria-live","assertive",1,"tw-block","tw-mt-1","tw-text-danger","tw-text-xs"],hostVars:1,hostBindings:function(e,t){2&e&&Fl.Avn("id",t.id)},inputs:{error:[1,"error"]},decls:2,vars:1,consts:[[1,"bwi","bwi-error"]],template:function(e,t){1&e&&(Fl.Hgh(0,"i",0),Fl.EFF(1)),2&e&&(Fl.R7$(),Fl.SpI(" ",t.displayError))},encapsulation:2});const yu=["prefixContainer"],bu=["suffixContainer"],wu=["*",[["bit-label"]],[["","bitPrefix",""]],[["","bitSuffix",""]],[["bit-hint"]]],Su=(e,t)=>[e,t],ku=(e,t)=>({"tw-border-secondary-300/50 tw-border-b tw-pb-[2px]":e,"tw-border-transparent tw-pb-[3px]":t});function Iu(e,t){1&e&&Fl.SdG(0)}function Cu(e,t){1&e&&Fl.SdG(0,1)}function Tu(e,t){1&e&&Fl.SdG(0,2)}function Pu(e,t){1&e&&Fl.SdG(0,3)}function Fu(e,t){1&e&&Fl.eu8(0)}function Ru(e,t){1&e&&(Fl.j41(0,"span",15),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" (",Fl.bMT(2,1,"required"),")"))}function xu(e,t){1&e&&Fl.eu8(0)}function Au(e,t){1&e&&Fl.eu8(0)}function Du(e,t){1&e&&Fl.eu8(0)}function Eu(e,t){if(1&e&&(Fl.j41(0,"div",6)(1,"div",9)(2,"div",10),Fl.nrm(3,"div",11),Fl.j41(4,"div",12)(5,"label",13),Fl.DNE(6,Fu,1,0,"ng-container",14),Fl.nVh(7,Ru,3,3,"span",15),Fl.k0s()(),Fl.nrm(8,"div",16),Fl.k0s()(),Fl.j41(9,"div",17)(10,"div",18,4),Fl.DNE(12,xu,1,0,"ng-container",14),Fl.k0s(),Fl.j41(13,"div",19),Fl.DNE(14,Au,1,0,"ng-container",14),Fl.k0s(),Fl.j41(15,"div",20,5),Fl.DNE(17,Du,1,0,"ng-container",14),Fl.k0s()()()),2&e){const e=Fl.XpG(),t=Fl.sdS(1),i=Fl.sdS(3),n=Fl.sdS(5),r=Fl.sdS(7);Fl.R7$(3),Fl.Y8G("ngClass",e.inputBorderClasses),Fl.R7$(),Fl.Y8G("ngClass",e.inputBorderClasses),Fl.R7$(),Fl.BMQ("for",e.input().labelForId),Fl.R7$(),Fl.Y8G("ngTemplateOutlet",i),Fl.R7$(),Fl.vxM(e.input().required?7:-1),Fl.R7$(),Fl.Y8G("ngClass",e.inputBorderClasses),Fl.R7$(2),Fl.Y8G("hidden",!e.prefixHasChildren()),Fl.R7$(2),Fl.Y8G("ngTemplateOutlet",n),Fl.R7$(),Fl.Y8G("ngClass",Fl.l_i(12,Su,e.prefixHasChildren()?"":"tw-rounded-s-lg tw-ps-3",e.suffixHasChildren()?"":"tw-rounded-e-lg tw-pe-3")),Fl.R7$(),Fl.Y8G("ngTemplateOutlet",t),Fl.R7$(),Fl.Y8G("hidden",!e.suffixHasChildren()),Fl.R7$(2),Fl.Y8G("ngTemplateOutlet",r)}}function $u(e,t){1&e&&Fl.eu8(0)}function Ou(e,t){1&e&&Fl.eu8(0)}function Uu(e,t){1&e&&Fl.eu8(0)}function Mu(e,t){1&e&&Fl.eu8(0)}function Nu(e,t){if(1&e&&(Fl.j41(0,"div",7)(1,"label",21),Fl.DNE(2,$u,1,0,"ng-container",14),Fl.k0s(),Fl.j41(3,"div",22)(4,"div",23,4),Fl.DNE(6,Ou,1,0,"ng-container",14),Fl.k0s(),Fl.j41(7,"div",24),Fl.DNE(8,Uu,1,0,"ng-container",14),Fl.k0s(),Fl.j41(9,"div",25,5),Fl.DNE(11,Mu,1,0,"ng-container",14),Fl.k0s()()()),2&e){const e=Fl.XpG(),t=Fl.sdS(1),i=Fl.sdS(3),n=Fl.sdS(5),r=Fl.sdS(7);Fl.R7$(),Fl.BMQ("for",e.input().labelForId),Fl.R7$(),Fl.Y8G("ngTemplateOutlet",i),Fl.R7$(),Fl.Y8G("ngClass",Fl.l_i(8,ku,!e.disableReadOnlyBorder,e.disableReadOnlyBorder)),Fl.R7$(),Fl.Y8G("hidden",!e.prefixHasChildren()),Fl.R7$(2),Fl.Y8G("ngTemplateOutlet",n),Fl.R7$(2),Fl.Y8G("ngTemplateOutlet",t),Fl.R7$(),Fl.Y8G("hidden",!e.suffixHasChildren()),Fl.R7$(2),Fl.Y8G("ngTemplateOutlet",r)}}function Vu(e,t){1&e&&Fl.SdG(0,4)}function Bu(e,t){if(1&e&&Fl.nrm(0,"bit-error",8),2&e){const e=Fl.XpG();Fl.Y8G("error",e.input().error)}}class ju{constructor(){this.input=o.sbv.required(tu),this.hint=(0,o.sbv)(hu),this.label=(0,o.sbv)(Ac),this.prefixContainer=(0,o.ebz)("prefixContainer"),this.suffixContainer=(0,o.ebz)("suffixContainer"),this.error=(0,o.ebz)(gu),this.disableMargin=(0,o.hFB)(!1,{transform:o.L39}),this.disableReadOnlyBorder=!1,this.prefixHasChildren=(0,a.vPA)(!1),this.suffixHasChildren=(0,a.vPA)(!1),this.defaultContentIsFocused=(0,a.vPA)(!1)}get inputBorderClasses(){const e=this.defaultContentIsFocused(),t=[this.input().hasError?"group-hover/bit-form-field:tw-border-danger-700":"group-hover/bit-form-field:tw-border-primary-600","group-has-[input:read-only]/bit-form-field:group-hover/bit-form-field:tw-border-secondary-500","group-has-[textarea:read-only]/bit-form-field:group-hover/bit-form-field:tw-border-secondary-500","group-focus-within/bit-form-field:tw-outline-none",e?"group-focus-within/bit-form-field:tw-border-2":"",e?"group-focus-within/bit-form-field:tw-border-primary-600":"",e?"group-focus-within/bit-form-field:group-hover/bit-form-field:tw-border-primary-600":""];return vu(this.input().hasError).concat(t).join(" ")}get classList(){return["tw-block"].concat(this.disableMargin()?[]:["tw-mb-4","bit-compact:tw-mb-3"]).concat(this.readOnly?[]:"tw-pt-2")}onFocusIn(e){this.defaultContentIsFocused.set(e.matches("[data-default-content] *:focus-visible"))}onFocusOut(){this.defaultContentIsFocused.set(!1)}get readOnly(){return!!this.input().readOnly}ngAfterContentChecked(){var e,t,i,n;const r=this.error(),s=this.hint();this.input().ariaDescribedBy=r?r.id:s?s.id:void 0,this.prefixHasChildren.set((null!==(t=null===(e=this.prefixContainer())||void 0===e?void 0:e.nativeElement.childElementCount)&&void 0!==t?t:0)>0),this.suffixHasChildren.set((null!==(n=null===(i=this.suffixContainer())||void 0===i?void 0:i.nativeElement.childElementCount)&&void 0!==n?n:0)>0)}}ju.ɵfac=function(e){return new(e||ju)},ju.ɵcmp=Fl.VBU({type:ju,selectors:[["bit-form-field"]],contentQueries:function(e,t,i){1&e&&(Fl.C6U(i,t.input,tu,5),Fl.C6U(i,t.hint,hu,5),Fl.C6U(i,t.label,Ac,5)),2&e&&Fl.NyB(3)},viewQuery:function(e,t){1&e&&(Fl.wEZ(t.prefixContainer,yu,5),Fl.wEZ(t.suffixContainer,bu,5),Fl.wEZ(t.error,gu,5)),2&e&&Fl.NyB(3)},hostVars:2,hostBindings:function(e,t){1&e&&Fl.bIt("focusin",function(e){return t.onFocusIn(e.target)})("focusout",function(){return t.onFocusOut()}),2&e&&Fl.HbH(t.classList)},inputs:{disableMargin:[1,"disableMargin"],disableReadOnlyBorder:[2,"disableReadOnlyBorder","disableReadOnlyBorder",o.L39]},ngContentSelectors:["*","bit-label","[bitPrefix]","[bitSuffix]","bit-hint"],decls:12,vars:2,consts:[["defaultContent",""],["labelContent",""],["prefixContent",""],["suffixContent",""],["prefixContainer",""],["suffixContainer",""],[1,"tw-w-full","tw-relative","tw-group/bit-form-field"],[1,"tw-w-full","tw-relative"],[3,"error"],[1,"tw-absolute","tw-size-full","tw-top-0","tw-pointer-events-none","tw-z-20"],[1,"tw-size-full","tw-flex"],[1,"tw-min-w-3","tw-border-r-0","group-focus-within/bit-form-field:tw-border-r-0","!tw-rounded-s-lg",3,"ngClass"],[1,"tw-px-1","tw-shrink","tw-min-w-0","tw-mt-px","tw-border-x-0","tw-border-t-0","group-focus-within/bit-form-field:tw-border-x-0","group-focus-within/bit-form-field:tw-border-t-0","tw-hidden","group-has-[bit-label]/bit-form-field:tw-block",3,"ngClass"],[1,"tw-flex","tw-gap-1","tw-text-sm","tw-text-muted","-tw-translate-y-[0.675rem]","tw-mb-0","tw-max-w-full","tw-pointer-events-auto"],[4,"ngTemplateOutlet"],[1,"tw-text-[0.625rem]","tw-relative","tw-bottom-[-1px]"],[1,"tw-min-w-3","tw-grow","tw-border-l-0","group-focus-within/bit-form-field:tw-border-l-0","!tw-rounded-e-lg",3,"ngClass"],[1,"tw-gap-1","tw-bg-background","tw-rounded-lg","tw-flex","tw-min-h-11","[&:has(input:read-only,textarea:read-only):not(:has(button:not([aria-disabled='true'])))]:tw-bg-secondary-100"],[1,"tw-flex","tw-items-center","tw-gap-1","tw-ps-3","has-[[biticonbutton]]:tw-ps-1","tw-py-1",3,"hidden"],["data-default-content","",1,"tw-w-full","tw-relative","tw-py-1","[&:has(select)_select]:tw-pe-6","has-[select]:after:tw-absolute","has-[select]:after:tw-end-4","has-[select]:after:tw-top-[calc(50%_-_2px)]","has-[select]:after:tw-rotate-[45deg]","has-[select]:after:-tw-translate-y-1/2","has-[select]:after:tw-size-2","has-[select]:after:tw-border-text-main","has-[select]:after:tw-border-r-[2px]","has-[select]:after:tw-border-b-[2px]","has-[bit-select]:tw-p-0","has-[bit-multi-select]:tw-p-0","has-[input:read-only:not([hidden])]:tw-bg-secondary-100","has-[textarea:read-only:not([hidden])]:tw-bg-secondary-100","has-[textarea]:tw-my-1",3,"ngClass"],[1,"tw-flex","tw-items-center","tw-pe-3","has-[[biticonbutton]]:tw-pe-1","tw-py-1",3,"hidden"],[1,"tw-flex","tw-gap-1","tw-text-sm","tw-text-muted","tw-mb-0","tw-max-w-full"],[1,"tw-gap-1","tw-flex","tw-min-h-[1.85rem]","tw-border-0","tw-border-solid","tw-items-center",3,"ngClass"],[1,"tw-flex","tw-items-center","tw-gap-1","tw-ps-1",3,"hidden"],["data-default-content","",1,"tw-w-full","tw-min-w-0","tw-pb-0","tw-relative","[&>*]:tw-p-0","[&>*::selection]:tw-bg-primary-700","[&>*::selection]:tw-text-contrast"],[1,"tw-flex","tw-items-center","tw-pe-1",3,"hidden"]],template:function(e,t){if(1&e&&(Fl.NAR(wu),Fl.DNE(0,Iu,1,0,"ng-template",null,0,Fl.C5r)(2,Cu,1,0,"ng-template",null,1,Fl.C5r)(4,Tu,1,0,"ng-template",null,2,Fl.C5r)(6,Pu,1,0,"ng-template",null,3,Fl.C5r),Fl.nVh(8,Eu,18,15,"div",6)(9,Nu,12,11,"div",7),Fl.nVh(10,Vu,1,0)(11,Bu,1,1,"bit-error",8)),2&e){let e;Fl.R7$(8),Fl.vxM(t.readOnly?9:8),Fl.R7$(2),Fl.vxM(!1===(e=t.input().hasError)?10:!0===e?11:-1)}},dependencies:[kl.MD,kl.YU,kl.T3,gu,sc],encapsulation:2});class Gu{}Gu.ɵfac=function(e){return new(e||Gu)},Gu.ɵmod=Fl.$C({type:Gu}),Gu.ɵinj=a.G2t({imports:[Dc,qc,uu,ju,Dc,qc,uu]});function Lu(e,t){1&e&&Fl.SdG(0)}class zu{constructor(){this.icon=(0,o.hFB)(),this.value=o.hFB.required(),this.label=o.hFB.required(),this.disabled=(0,o.hFB)(void 0,{transform:o.L39})}}function _u(e,t){if(1&e&&Fl.nrm(0,"i",6),2&e){const e=Fl.XpG().item;Fl.HbH(Fl.VkB("bwi bwi-fw ",e.icon))}}function Ku(e,t){if(1&e&&(Fl.j41(0,"div",2)(1,"div",3),Fl.nVh(2,_u,1,3,"i",4),Fl.k0s(),Fl.j41(3,"div",5),Fl.EFF(4),Fl.k0s()()),2&e){const e=t.item;Fl.Y8G("title",e.label),Fl.R7$(2),Fl.vxM(null!=e.icon?2:-1),Fl.R7$(2),Fl.SpI(" ",e.label," ")}}zu.ɵfac=function(e){return new(e||zu)},zu.ɵcmp=Fl.VBU({type:zu,selectors:[["bit-option"]],inputs:{icon:[1,"icon"],value:[1,"value"],label:[1,"label"],disabled:[1,"disabled"]},ngContentSelectors:["*"],decls:1,vars:0,template:function(e,t){1&e&&(Fl.NAR(),Fl.PeT(0,Lu,1,0,"ng-template"))},encapsulation:2});let Xu=0;class qu{constructor(e,t){this.i18nService=e,this.ngControl=t,this.select=o.ebz.required(Yc.vr),this.items=(0,o.geq)(),this.placeholder=(0,o.hFB)(this.i18nService.t("selectPlaceholder")),this.closed=new Fl.bkB,this.selectedValue=(0,a.vPA)(void 0),this.selectedOption=(0,Rl.EW)(()=>this.findSelectedOption(this.items(),this.selectedValue())),this.searchInputId="bit-select-search-input-"+Xu++,this.classes=["tw-block","tw-w-full","tw-h-full"],this.id=(0,o.hFB)("bit-multi-select-"+Xu++),this.onKeyDown=e=>(this.select().isOpen()&&"Escape"===e.key&&!(0,Wc.rp)(e)&&e.stopPropagation(),!0),null!=t&&(t.valueAccessor=this)}set options(e){null!=e&&0!=e.length&&this.items.set(e.toArray().map(e=>({icon:e.icon(),value:e.value(),label:e.label(),disabled:e.disabled()})))}get disabledAttr(){return this.disabled||null}get disabled(){var e,t,i;return null!==(i=null!==(e=this._disabled)&&void 0!==e?e:null===(t=this.ngControl)||void 0===t?void 0:t.disabled)&&void 0!==i&&i}set disabled(e){this._disabled=null!=e&&!1!==e}writeValue(e){this.selectedValue.set(e)}registerOnChange(e){this.notifyOnChange=e}registerOnTouched(e){this.notifyOnTouched=e}setDisabledState(e){this.disabled=e}onChange(e){this.selectedValue.set(null==e?void 0:e.value),this.notifyOnChange&&this.notifyOnChange(null==e?void 0:e.value)}onBlur(){this.notifyOnTouched&&this.notifyOnTouched()}get ariaDescribedBy(){return this._ariaDescribedBy}set ariaDescribedBy(e){var t;this._ariaDescribedBy=e,null===(t=this.select())||void 0===t||t.searchInput().nativeElement.setAttribute("aria-describedby",null!=e?e:"")}get labelForId(){return this.searchInputId}get required(){var e,t,i,n;return null!==(n=null!==(e=this._required)&&void 0!==e?e:null===(i=null===(t=this.ngControl)||void 0===t?void 0:t.control)||void 0===i?void 0:i.hasValidator(Il.k0.required))&&void 0!==n&&n}set required(e){this._required=null!=e&&!1!==e}get hasError(){var e,t;return!("INVALID"!==(null===(e=this.ngControl)||void 0===e?void 0:e.status)||!(null===(t=this.ngControl)||void 0===t?void 0:t.touched))}get error(){var e,t;const i=null!==(t=null===(e=this.ngControl)||void 0===e?void 0:e.errors)&&void 0!==t?t:{},n=Object.keys(i)[0];return[n,i[n]]}findSelectedOption(e,t){return null==e?void 0:e.find(e=>e.value===t)}onClose(){this.closed.emit()}}qu.ɵfac=function(e){return new(e||qu)(Fl.rXU(Ul),Fl.rXU(Il.vO,10))},qu.ɵcmp=Fl.VBU({type:qu,selectors:[["bit-select"]],contentQueries:function(e,t,i){if(1&e&&Fl.wni(i,zu,4),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.options=e)}},viewQuery:function(e,t){1&e&&Fl.wEZ(t.select,Yc.vr,5),2&e&&Fl.NyB()},hostVars:6,hostBindings:function(e,t){2&e&&(Fl.Avn("id",t.id()),Fl.BMQ("disabled",t.disabledAttr)("aria-describedby",t.ariaDescribedBy)("required",t.required),Fl.HbH(t.classes))},inputs:{items:[1,"items"],placeholder:[1,"placeholder"],disabled:"disabled",id:[1,"id"],required:"required"},outputs:{items:"itemsChange",closed:"closed"},features:[Fl.Jv_([{provide:tu,useExisting:qu}])],decls:2,vars:8,consts:[["appendTo","body",3,"ngModelChange","blur","close","ngModel","disabled","placeholder","items","labelForId","clearable","keyDownFn"],["ng-option-tmp",""],[1,"tw-flex",3,"title"],[1,"tw-me-2","tw-flex-initial"],["aria-hidden","true",3,"class"],[1,"tw-flex-1","tw-text-ellipsis","tw-overflow-hidden"],["aria-hidden","true"]],template:function(e,t){var i;if(1&e&&(Fl.j41(0,"ng-select",0),Fl.bIt("ngModelChange",function(e){return t.onChange(e)})("blur",function(){return t.onBlur()})("close",function(){return t.onClose()}),Fl.DNE(1,Ku,5,3,"ng-template",1),Fl.k0s()),2&e){let e;Fl.Y8G("ngModel",t.selectedOption())("disabled",t.disabled)("placeholder",t.placeholder())("items",t.items())("labelForId",t.labelForId)("clearable",!1)("keyDownFn",t.onKeyDown),Fl.BMQ("aria-label",null!==(i=null==(e=t.selectedOption())?null:e.label)&&void 0!==i?i:t.placeholder())}},dependencies:[Yc.MQ,Yc.vr,Yc.Uq,Il.X1,Il.BC,Il.YN,Il.vS],encapsulation:2});class Wu{}Wu.ɵfac=function(e){return new(e||Wu)},Wu.ɵmod=Fl.$C({type:Wu}),Wu.ɵinj=a.G2t({imports:[qu]});function Yu(e,t){if(1&e&&Fl.nrm(0,"i"),2&e){const e=Fl.XpG();Fl.HbH(e.startIconClasses())}}function Hu(e,t){if(1&e&&Fl.nrm(0,"i"),2&e){const e=Fl.XpG();Fl.HbH(e.endIconClasses())}}function Ju(e,t){1&e&&(Fl.j41(0,"span",3),Fl.nrm(1,"bit-spinner",4),Fl.k0s())}const Zu=["focus-visible:tw-ring-2","focus-visible:tw-ring-offset-2","focus-visible:tw-ring-primary-600","focus-visible:tw-z-10"],Qu={small:["tw-py-1","tw-px-3","tw-text-sm"],default:["tw-py-1.5","tw-px-3"]},ed={primary:["tw-border-primary-600","tw-bg-primary-600","!tw-text-contrast","hover:tw-bg-primary-700","hover:tw-border-primary-700",...Zu],secondary:["tw-bg-transparent","tw-border-primary-600","!tw-text-primary-600","hover:tw-bg-hover-default",...Zu],danger:["tw-bg-transparent","tw-border-danger-600","!tw-text-danger","hover:tw-bg-danger-600","hover:tw-border-danger-600","hover:!tw-text-contrast",...Zu],dangerPrimary:["tw-border-danger-600","tw-bg-danger-600","!tw-text-contrast","hover:tw-bg-danger-700","hover:tw-border-danger-700",...Zu],unstyled:[]};class td{get classList(){var e;return["tw-font-medium","tw-rounded-full","tw-transition","tw-border-2","tw-border-solid","tw-text-center","tw-no-underline","hover:tw-no-underline","focus:tw-outline-none"].concat(this.block()?["tw-w-full","tw-block"]:["tw-inline-block"]).concat(ed[null!==(e=this.buttonType())&&void 0!==e?e:"secondary"]).concat(this.showDisabledStyles()||this.disabled()?["aria-disabled:!tw-bg-secondary-300","hover:tw-bg-secondary-300","aria-disabled:tw-border-secondary-300","hover:tw-border-secondary-300","aria-disabled:!tw-text-muted","hover:!tw-text-muted","aria-disabled:tw-cursor-not-allowed","hover:tw-no-underline"]:[]).concat(Qu[this.size()||"default"])}constructor(){this.disabledAttr=(0,Rl.EW)(()=>null!=this.disabled()&&!1!==this.disabled()||this.loading()),this.showDisabledStyles=(0,Rl.EW)(()=>this.showLoadingStyle()||this.disabledAttr()&&!1===this.loading()),this.buttonType=(0,o.hFB)("secondary"),this.startIcon=(0,o.hFB)(void 0),this.endIcon=(0,o.hFB)(void 0),this.size=(0,o.hFB)("default"),this.block=(0,o.hFB)(!1,{transform:o.L39}),this.loading=(0,o.geq)(!1),this.startIconClasses=(0,Rl.EW)(()=>["bwi",this.startIcon()]),this.endIconClasses=(0,Rl.EW)(()=>["bwi",this.endIcon()]),this.showLoadingStyle=(0,xl.ot)((0,xl.br)(this.loading).pipe((0,Al.s)(e=>(0,sa.Y)(e?75:0)))),this.disabled=(0,o.geq)(!1),this.el=(0,a.WQX)(Fl.aKT),Kl(this.el.nativeElement,this.disabledAttr)}}td.ɵfac=function(e){return new(e||td)},td.ɵcmp=Fl.VBU({type:td,selectors:[["button","bitButton",""],["a","bitButton",""]],hostVars:2,hostBindings:function(e,t){2&e&&Fl.HbH(t.classList)},inputs:{buttonType:[1,"buttonType"],startIcon:[1,"startIcon"],endIcon:[1,"endIcon"],size:[1,"size"],block:[1,"block"],loading:[1,"loading"],disabled:[1,"disabled"]},outputs:{loading:"loadingChange",disabled:"disabledChange"},features:[Fl.Jv_([{provide:El,useExisting:td}]),Fl.nM4([ql])],attrs:["bitButton",""],ngContentSelectors:["*"],decls:7,vars:5,consts:[[1,"tw-relative","tw-flex","tw-items-center","tw-justify-center"],[1,"tw-flex","tw-items-center","tw-gap-2"],[3,"class"],[1,"tw-absolute","tw-inset-0","tw-flex","tw-items-center","tw-justify-center"],["size","fill","noColor",""]],template:function(e,t){1&e&&(Fl.NAR(),Fl.j41(0,"span",0)(1,"span",1),Fl.nVh(2,Yu,1,2,"i",2),Fl.j41(3,"div"),Fl.SdG(4),Fl.k0s(),Fl.nVh(5,Hu,1,2,"i",2),Fl.k0s(),Fl.nVh(6,Ju,2,0,"span",3),Fl.k0s()),2&e&&(Fl.R7$(),Fl.AVh("tw-invisible",t.showLoadingStyle()),Fl.R7$(),Fl.vxM(t.startIcon()?2:-1),Fl.R7$(3),Fl.vxM(t.endIcon()?5:-1),Fl.R7$(),Fl.vxM(t.showLoadingStyle()?6:-1))},dependencies:[Nl],encapsulation:2});class id{}id.ɵfac=function(e){return new(e||id)},id.ɵmod=Fl.$C({type:id}),id.ɵinj=a.G2t({imports:[td]});const nd=e=>[e],rd=(e,t)=>[e,t];function sd(e,t){if(1&e&&Fl.nrm(0,"i",1),2&e){Fl.XpG();const e=Fl.r8f(1),t=Fl.r8f(2);Fl.Y8G("ngClass",Fl.l_i(1,rd,t,e?"tw-top-[3px] tw-self-start":"tw-top-[1px]"))}}function od(e,t){if(1&e&&(Fl.j41(0,"header",3),Fl.EFF(1),Fl.k0s()),2&e){const e=Fl.XpG(),t=Fl.r8f(1);Fl.Y8G("id",Fl.mNQ(e.titleId)),Fl.R7$(),Fl.SpI(" ",t," ")}}const ad={success:"bwi-check-circle",info:"bwi-info-circle",warning:"bwi-exclamation-triangle",danger:"bwi-error",default:"bwi-star"},ld={warning:"warning",danger:"error"};let cd=0;class ud{constructor(e){this.i18nService=e,this.type=(0,o.hFB)("info"),this.icon=(0,o.hFB)(),this.title=(0,o.hFB)(),this.useAlertRole=(0,o.hFB)(!1),this.iconComputed=(0,Rl.EW)(()=>void 0===this.icon()?ad[this.type()]:this.icon()),this.titleComputed=(0,Rl.EW)(()=>{const e=this.title();if(null===e)return;const t=this.type();return null==e&&null!=ld[t]?this.i18nService.t(ld[t]):e}),this.titleId="bit-callout-title-"+cd++,this.calloutClass=(0,Rl.EW)(()=>{switch(this.type()){case"danger":return"tw-bg-danger-100 tw-border-danger-700 tw-text-danger-700";case"info":return"tw-bg-info-100 tw-bg-info-100 tw-border-info-700 tw-text-info-700";case"success":return"tw-bg-success-100 tw-bg-success-100 tw-border-success-700 tw-text-success-700";case"warning":return"tw-bg-warning-100 tw-bg-warning-100 tw-border-warning-700 tw-text-warning-700";case"default":return"tw-bg-background-alt tw-border-secondary-700 tw-text-secondary-700"}})}}ud.ɵfac=function(e){return new(e||ud)(Fl.rXU(Ul))},ud.ɵcmp=Fl.VBU({type:ud,selectors:[["bit-callout"]],inputs:{type:[1,"type"],icon:[1,"icon"],title:[1,"title"],useAlertRole:[1,"useAlertRole"]},ngContentSelectors:["*"],decls:8,vars:8,consts:[[1,"tw-mb-4","tw-box-border","tw-border","tw-border-solid","tw-rounded-lg","tw-bg-background","tw-ps-4","tw-pe-4","tw-py-3","tw-leading-5","tw-flex","tw-gap-2",3,"ngClass"],["aria-hidden","true",1,"bwi","tw-relative",3,"ngClass"],[1,"tw-flex","tw-flex-col","tw-gap-0.5"],[1,"tw-text-base","tw-font-medium",3,"id"],["bitTypography","body2"]],template:function(e,t){if(1&e&&(Fl.NAR(),Fl.j41(0,"aside",0),Fl.SS7(1)(2),Fl.nVh(3,sd,1,4,"i",1),Fl.j41(4,"div",2),Fl.nVh(5,od,2,3,"header",3),Fl.j41(6,"div",4),Fl.SdG(7),Fl.k0s()()()),2&e){Fl.Y8G("ngClass",Fl.eq3(6,nd,t.calloutClass())),Fl.BMQ("aria-labelledby",t.titleId),Fl.R7$();const e=Fl.bH3(t.titleComputed());Fl.R7$();const i=Fl.bH3(t.iconComputed());Fl.R7$(),Fl.vxM(i?3:-1),Fl.R7$(2),Fl.vxM(e?5:-1)}},dependencies:[ec,kl.YU,tc,rc],encapsulation:2});class dd{}dd.ɵfac=function(e){return new(e||dd)},dd.ɵmod=Fl.$C({type:dd}),dd.ɵinj=a.G2t({imports:[ud]});class hd{}hd.ɵfac=function(e){return new(e||hd)},hd.ɵmod=Fl.$C({type:hd}),hd.ɵinj=a.G2t({});var pd=i(81525),vd=i(58803),fd=i(97763),md=i(90934),gd=(i(14049),i(45202));const yd="undefined"==typeof self?i(10967):null;class bd{static init(){bd.inited||(bd.inited=!0,bd.isNode=void 0!==gd&&null!=gd.release&&"node"===gd.release.name,bd.isBrowser="undefined"!=typeof window,bd.isMobileBrowser=bd.isBrowser&&this.isMobile(window),bd.isAppleMobileBrowser=bd.isBrowser&&this.isAppleMobile(window),bd.isNode?bd.global=i.g:bd.isBrowser?bd.global=window:bd.global=self)}static fromB64ToArray(e){if(null==e)return null;if(bd.isNode)return new Uint8Array(Buffer.from(e,"base64"));{const t=bd.global.atob(e),i=new Uint8Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);return i}}static fromUrlB64ToArray(e){return bd.fromB64ToArray(bd.fromUrlB64ToB64(e))}static fromHexToArray(e){if(bd.isNode)return new Uint8Array(Buffer.from(e,"hex"));{const t=new Uint8Array(e.length/2);for(let i=0;i<e.length;i+=2)t[i/2]=parseInt(e.substr(i,2),16);return t}}static fromUtf8ToArray(e){if(bd.isNode)return new Uint8Array(Buffer.from(e,"utf8"));{const t=unescape(encodeURIComponent(e)),i=new Uint8Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);return i}}static fromByteStringToArray(e){if(null==e)return null;const t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}static fromArrayToHex(e){return null==e?null:e.toHex()}static fromArrayToB64(e){return null==e?null:e.toBase64({alphabet:"base64"})}static fromArrayToUrlB64(e){return null==e?null:e.toBase64({alphabet:"base64url"})}static fromArrayToByteString(e){if(null==e)return null;let t="";for(let i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return t}static fromArrayToUtf8(e){return null==e?null:fd.hp.from(e).toString("utf8")}static fromBufferToB64(e){if(null==e)return null;const t=bd.normalizeToUint8Array(e);if(0===t.length)return"";if(bd.isNode)return Buffer.from(t).toString("base64");{let e="";for(let i=0;i<t.byteLength;i++)e+=String.fromCharCode(t[i]);return bd.global.btoa(e)}}static normalizeToUint8Array(e){if(e instanceof Uint8Array)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);{const t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}}static fromBufferToUrlB64(e){return bd.fromB64toUrlB64(bd.fromBufferToB64(e))}static fromB64toUrlB64(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}static fromBufferToUtf8(e){return fd.hp.from(e).toString("utf8")}static fromBufferToByteString(e){return String.fromCharCode.apply(null,new Uint8Array(e))}static fromBufferToHex(e){if(bd.isNode)return Buffer.from(e).toString("hex");{const t=new Uint8Array(e);return Array.prototype.map.call(t,e=>("00"+e.toString(16)).slice(-2)).join("")}}static hexStringToArrayBuffer(e){if(e.length%2!=0)throw"HexString has to be an even length";const t=new ArrayBuffer(e.length/2),i=new Uint8Array(t);for(let t=0;t<i.length;t++){const n=e.substr(2*t,2),r=parseInt(n,16);i[t]=r}return t}static fromUrlB64ToB64(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Illegal base64url string!")}return t}static fromUrlB64ToUtf8(e){return bd.fromB64ToUtf8(bd.fromUrlB64ToB64(e))}static fromUtf8ToB64(e){return bd.isNode?Buffer.from(e,"utf8").toString("base64"):fd.hp.from(e,"utf8").toString("base64")}static fromUtf8ToUrlB64(e){return bd.fromArrayToUrlB64(bd.fromUtf8ToArray(e))}static fromB64ToUtf8(e){return bd.isNode?Buffer.from(e,"base64").toString("utf8"):fd.hp.from(e,"base64").toString("utf8")}static newGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}static isGuid(e){return RegExp(bd.guidRegex,"i").test(e)}static getHostname(e){if(bd.isNullOrWhitespace(e))return null;if((e=e.trim()).startsWith("data:"))return null;if(e.startsWith("about:"))return null;if(e.startsWith("file:"))return null;if(e.indexOf("!")>0)return null;try{const t=(0,md.EW)(e,{validHosts:this.validHosts});if(null!=t)return t}catch(e){return null}return null}static getHost(e){const t=bd.getUrl(e);try{return null!=t&&""!==t.host?t.host:null}catch(e){return null}}static getDomain(e){if(bd.isNullOrWhitespace(e))return null;if((e=e.trim()).startsWith("data:"))return null;if(e.startsWith("about:"))return null;try{const t=(0,md.qg)(e,{validHosts:this.validHosts,allowPrivateDomains:!0});if(null!=t&&null!=t.hostname)return"localhost"===t.hostname||t.isIp?t.hostname:null!=t.domain?t.domain:null}catch(e){return null}return null}static getQueryParams(e){const t=bd.getUrl(e);if(null==t||null==t.search||""===t.search)return null;const i=new Map;return("?"===t.search[0]?t.search.substr(1):t.search).split("&").forEach(e=>{const t=e.split("=");t.length<1||i.set(decodeURIComponent(t[0]).toLowerCase(),null==t[1]?"":decodeURIComponent(t[1]))}),i}static getSortFunction(e,t){return(i,n)=>null==i[t]&&null!=n[t]?-1:null!=i[t]&&null==n[t]?1:null==i[t]&&null==n[t]?0:e.collator?e.collator.compare(i[t],n[t]):i[t].localeCompare(n[t])}static isNullOrWhitespace(e){return null==e||"string"!=typeof e||""===e.trim()}static isNullOrEmpty(e){return null==e||"string"!=typeof e||""==e}static isPromise(e){return null!=e&&"function"==typeof e.then&&"function"==typeof e.catch}static nameOf(e){return e}static assign(e,t){return Object.assign(e,t)}static iterateEnum(e){return Object.keys(e).filter(e=>Number.isNaN(+e)).map(t=>e[t])}static getUrl(e){return this.isNullOrWhitespace(e)?null:(e=e.trim(),bd.getUrlObject(e))}static camelToPascalCase(e){return e.charAt(0).toUpperCase()+e.slice(1)}static pickTextColorBasedOnBgColor(e,t=186,i=!1){const n="#"===e.charAt(0)?e.substring(1,7):e;return.299*parseInt(n.substring(0,2),16)+.587*parseInt(n.substring(2,4),16)+.114*parseInt(n.substring(4,6),16)>t?i?"black":"black !important":i?"white":"white !important"}static stringToColor(e){let t=0;for(let i=0;i<e.length;i++)t=e.charCodeAt(i)+((t<<5)-t);let i="#";for(let e=0;e<3;e++){i+=("00"+(t>>8*e&255).toString(16)).substr(-2)}return i}static getContainerService(){if(null==this.global.bitwardenContainerService)throw new Error("global bitwardenContainerService not initialized.");return this.global.bitwardenContainerService}static validateHexColor(e){return/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(e)}static mapToRecord(e){return null==e?null:e instanceof Map?Object.fromEntries(e):e}static recordToMap(e){if(null==e)return null;if(e instanceof Map)return e;const t=Object.entries(e);return 0===t.length?new Map:isNaN(Number(t[0][0]))?new Map(t):new Map(t.map(e=>[Number(e[0]),e[1]]))}static merge(e,t){return Object.assign(e,t)}static encodeRFC3986URIComponent(e){return encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}static normalizePath(e){return vd.normalize(decodeURIComponent(e)).replace(/^(\.\.(\/|\\|$))+/,"")}static invalidUrlPatterns(e){const t=decodeURIComponent(e.toLocaleLowerCase());if(["..","%2e","\\","%5c"].some(e=>t.includes(e)))return!0;if(t.includes("?")){if(this.validateQueryParameters(t))return!0}return!1}static validateQueryParameters(e){try{let t;if(!e.includes("?"))return!1;t=e.split("?")[1];return["/","%2f","#","%23"].some(e=>t.includes(e))}catch(e){throw new Error(`Error validating query parameters: ${e}`)}}static isMobile(e){let t=!1;var i;return i=e.navigator.userAgent||e.navigator.vendor||e.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(i)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(i.substr(0,4)))&&(t=!0),t||null!=e.navigator.userAgent.match(/iPad/i)}static delay(e){return new Promise(t=>setTimeout(t,e))}static asyncToObservable(e){return(0,Go.of)(void 0).pipe((0,go.n)(()=>e()))}static daysRemaining(e){const t=e.getTime()-Date.now();return Math.max(0,Math.floor(t/864e5))}static isAppleMobile(e){return null!=e.navigator.userAgent.match(/iPhone/i)||null!=e.navigator.userAgent.match(/iPad/i)}static getUrlObject(e){const t=e.indexOf("://")>-1;if(!t&&e.indexOf(".")>-1)e="http://"+e;else if(!t)return null;try{return null!=yd?new yd.URL(e):new URL(e)}catch(e){}return null}}bd.inited=!1,bd.isNode=!1,bd.isBrowser=!0,bd.isMobileBrowser=!1,bd.isAppleMobileBrowser=!1,bd.global=null,bd.regexpEmojiPresentation=/(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])/g,bd.validHosts=["localhost"],bd.originalMinimumPasswordLength=8,bd.minimumPasswordLength=12,bd.maximumPasswordLength=128,bd.DomainMatchBlacklist=new Map([["google.com",new Set(["script.google.com"])]]),bd.guidRegex=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/,bd.init();class wd{constructor(e,t,i){this.el=e,this.ngZone=t,this.focusableElement=i,this.appAutofocus=(0,o.hFB)(void 0,{transform:o.L39}),this.focused=!1}ngAfterContentChecked(){if(this.focused||!this.appAutofocus()||bd.isMobileBrowser)return;null!=this.getElement()&&(this.ngZone.isStable?this.focus():this.ngZone.onStable.pipe((0,_o.s)(1)).subscribe(this.focus.bind(this)))}focus(){const e=this.getElement();e&&(e.focus(),this.focused=e===document.activeElement)}getElement(){return this.focusableElement?this.focusableElement.getFocusTarget():this.el.nativeElement}}wd.ɵfac=function(e){return new(e||wd)(Fl.rXU(Fl.aKT),Fl.rXU(Fl.SKi),Fl.rXU($l,8))},wd.ɵdir=Fl.FsC({type:wd,selectors:[["","appAutofocus",""],["","bitAutofocus",""]],inputs:{appAutofocus:[1,"appAutofocus"]}});var Sd=i(79026),kd=i(12610),Id=i(50037),Cd=i(79243);const Td=(e,t,i=1)=>((e,t)=>new aa.c(i=>{const n=new IntersectionObserver(e=>{for(const t of e)i.next(t)},t);return n.observe(e),()=>n.disconnect()}))(t,{root:e,threshold:i}).pipe((0,kd.Z)(null),(0,Id.Z)(0,Sd.X),(0,Cd.Q)(Sd.X),(0,l.T)(t=>t?!t.isIntersecting:e.scrollHeight>e.clientHeight),(0,mo.F)());var Pd,Fd=i(23649);class Rd{}!function(e){e[e.LoggedOut=0]="LoggedOut",e[e.Locked=1]="Locked",e[e.Unlocked=2]="Unlocked"}(Pd||(Pd={}));const xd={sm:640,md:768,lg:1024,xl:1280,"2xl":1536};class Ad{constructor(){this.portal=(0,a.vPA)(void 0),this.pushWidthPx=(0,a.vPA)(0),this.isPushMode=(0,a.vPA)(!1)}open(e){this.portal.set(e)}close(e){e===this.portal()&&(this.portal.set(void 0),this.pushWidthPx.set(0),this.isPushMode.set(!1))}declarePushWidth(e){this.pushWidthPx.set(e)}}Ad.ɵfac=function(e){return new(e||Ad)},Ad.ɵprov=a.jDH({token:Ad,factory:Ad.ɵfac,providedIn:"root"});var Dd=i(16878),Ed=i(75811),$d=i(55318);function Od(e){let t;try{t=e()}catch(e){return(0,So.$)(()=>e)}return bd.isPromise(t)?(0,$d.H)(t):t instanceof aa.c?t:(0,Go.of)(t)}class Ud{}class Md{constructor(e,t,i){this.formGroupDirective=e,this.destroyRef=(0,a.WQX)(a.abz),this._loading$=new Dd.t(!1),this._disabled$=new Dd.t(!1),this.handler=o.hFB.required({alias:"bitSubmit"}),this.allowDisabledFormSubmit=(0,o.hFB)(!1),this.loading$=this._loading$.asObservable(),this.disabled$=this._disabled$.asObservable(),e.ngSubmit.pipe((0,Eo.p)(()=>!this.disabled),(0,go.n)(()=>{const e=Od(this.handler());return this.loading=!0,e.pipe((0,Ed.W)(e=>(null==i||i.error(`Async submit exception: ${e}`),null==t||t.showError(e),(0,Go.of)(void 0))))}),(0,xl.pQ)()).subscribe({next:()=>this.loading=!1,complete:()=>this.loading=!1})}ngOnInit(){var e;null===(e=this.formGroupDirective.statusChanges)||void 0===e||e.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.allowDisabledFormSubmit()?this._disabled$.next(!1):this._disabled$.next("DISABLED"===e)})}get disabled(){return this._disabled$.value}set disabled(e){this._disabled$.next(e)}get loading(){return this._loading$.value}set loading(e){this.disabled=e,this._loading$.next(e)}}Md.ɵfac=function(e){return new(e||Md)(Fl.rXU(Il.j4),Fl.rXU(Ud,8),Fl.rXU(Za,8))},Md.ɵdir=Fl.FsC({type:Md,selectors:[["","formGroup","","bitSubmit",""]],inputs:{handler:[1,"bitSubmit","handler"],allowDisabledFormSubmit:[1,"allowDisabledFormSubmit"]}});var Nd=i(96070),Vd=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Bd{get loading(){return this._loading$.value}set loading(e){this._loading$.next(e),this.buttonComponent.loading.set(e)}constructor(e,t,i){this.buttonComponent=e,this.validationService=t,this.logService=i,this._loading$=new Dd.t(!1),this.loading$=this._loading$.asObservable(),this.disabled=!1,this.handler=o.geq.required({alias:"bitAction"}),this.destroyRef=(0,a.WQX)(a.abz)}onClick(){return Vd(this,void 0,void 0,function*(){!this.handler()||this.loading||this.disabled||this.buttonComponent.disabled()||(this.loading=!0,Od(this.handler()).pipe((0,Oo.M)({error:e=>{var t,i;null===(t=this.logService)||void 0===t||t.error(`Async action exception: ${e}`),null===(i=this.validationService)||void 0===i||i.showError(e)}}),(0,Nd.j)(()=>this.loading=!1),(0,xl.pQ)(this.destroyRef)).subscribe())})}}Bd.ɵfac=function(e){return new(e||Bd)(Fl.rXU(El),Fl.rXU(Ud,8),Fl.rXU(Za,8))},Bd.ɵdir=Fl.FsC({type:Bd,selectors:[["","bitAction",""]],hostBindings:function(e,t){1&e&&Fl.bIt("click",function(){return t.onClick()})},inputs:{handler:[1,"bitAction","handler"]},outputs:{handler:"bitActionChange"}});class jd{constructor(e,t,i){this.type=(0,o.hFB)(),this.disabled=(0,o.hFB)(),t&&e&&(t.loading$.pipe((0,xl.pQ)()).subscribe(t=>{"submit"===this.type()?e.loading.set(t):e.disabled.set(this.disabled()||t)}),t.disabled$.pipe((0,xl.pQ)()).subscribe(t=>{const i=this.disabled();!1!==i&&e.disabled.set(i||t)})),t&&i&&(i.loading$.pipe((0,xl.pQ)()).subscribe(e=>{t.disabled=e}),t.disabled$.pipe((0,xl.pQ)()).subscribe(e=>{i.disabled=e}))}}jd.ɵfac=function(e){return new(e||jd)(Fl.rXU(El),Fl.rXU(Md,8),Fl.rXU(Bd,8))},jd.ɵdir=Fl.FsC({type:jd,selectors:[["button","bitFormButton",""]],inputs:{type:[1,"type"],disabled:[1,"disabled"]}});const Gd=(0,Pl.hZ)("fadeIn",[(0,Pl.kY)(":enter",[(0,Pl.iF)({opacity:0,transform:"translateY(-50px)"}),(0,Pl.Os)([(0,Pl.i0)("0.15s linear",(0,Pl.iF)({opacity:1})),(0,Pl.i0)("0.3s ease-out",(0,Pl.iF)({transform:"none"}))])])]);let Ld=0;class zd{constructor(e){this.dialogRef=e,this.id="bit-dialog-title-"+Ld++,this.simple=(0,o.hFB)(!1)}ngOnInit(){this.dialogRef&&Promise.resolve().then(()=>{const e=this.dialogRef.containerInstance;e&&0===e._ariaLabelledByQueue.length&&e._ariaLabelledByQueue.push(this.id)})}}zd.ɵfac=function(e){return new(e||zd)(Fl.rXU(pd.ce,8))},zd.ɵdir=Fl.FsC({type:zd,selectors:[["","bitDialogTitleContainer",""]],hostVars:1,hostBindings:function(e,t){2&e&&Fl.Avn("id",t.id)},inputs:{simple:[1,"simple"]}});const _d=[[["","bitDialogTitle",""]],[["","bitDialogContent",""]],[["","bitDialogFooter",""]],[["","bitDialogIcon",""]]];function Kd(e,t){1&e&&Fl.SdG(0,3)}function Xd(e,t){1&e&&Fl.nrm(0,"i",5)}function qd(e,t){if(1&e&&Fl.nVh(0,Kd,1,0)(1,Xd,1,0,"i",5),2&e){const e=Fl.XpG();Fl.vxM(e.hasIcon?0:1)}}class Wd{}Wd.ɵfac=function(e){return new(e||Wd)},Wd.ɵdir=Fl.FsC({type:Wd,selectors:[["","bitDialogIcon",""]]});class Yd{constructor(){this.hideIcon=(0,o.hFB)(!1,{transform:o.L39})}get hasIcon(){return null!=this.icon}}Yd.ɵfac=function(e){return new(e||Yd)},Yd.ɵcmp=Fl.VBU({type:Yd,selectors:[["bit-simple-dialog"],["","bit-simple-dialog",""]],contentQueries:function(e,t,i){if(1&e&&Fl.wni(i,Wd,5),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.icon=e.first)}},inputs:{hideIcon:[1,"hideIcon"]},ngContentSelectors:["[bitDialogTitle]","[bitDialogContent]","[bitDialogFooter]","[bitDialogIcon]"],decls:9,vars:2,consts:[[1,"tw-my-4","tw-pb-6","tw-pt-8","tw-flex","tw-max-h-screen","tw-w-96","tw-max-w-90vw","tw-flex-col","tw-overflow-hidden","tw-rounded-3xl","tw-border","tw-border-solid","tw-border-secondary-100","tw-shadow-lg","tw-bg-text-contrast","tw-text-main"],[1,"tw-flex","tw-px-6","tw-flex-col","tw-items-center","tw-gap-2","tw-text-center"],["bitDialogTitleContainer","","bitTypography","h3","noMargin","",1,"tw-w-full","tw-text-main","tw-break-words","tw-hyphens-auto"],[1,"tw-overflow-y-auto","tw-px-6","tw-mb-6","tw-text-center","tw-text-base","tw-break-words","tw-hyphens-auto"],[1,"tw-flex","tw-flex-col","tw-gap-2","tw-px-6"],["aria-hidden","true",1,"bwi","bwi-exclamation-triangle","tw-text-3xl","tw-text-warning"]],template:function(e,t){1&e&&(Fl.NAR(_d),Fl.j41(0,"div",0)(1,"div",1),Fl.nVh(2,qd,2,1),Fl.j41(3,"h1",2),Fl.SdG(4),Fl.k0s()(),Fl.j41(5,"div",3),Fl.SdG(6,1),Fl.k0s(),Fl.j41(7,"div",4),Fl.SdG(8,2),Fl.k0s()()),2&e&&(Fl.Y8G("@fadeIn",void 0),Fl.R7$(2),Fl.vxM(t.hideIcon()?-1:2))},dependencies:[zd,rc],encapsulation:2,data:{animation:[Gd]}});var Hd=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function Jd(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",7),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.dialogRef.close(!1))}),Fl.EFF(1),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.R7$(),Fl.SpI(" ",e.cancelButtonText," ")}}const Zd={primary:"bwi-business",success:"bwi-star",info:"bwi-info-circle",warning:"bwi-exclamation-triangle",danger:"bwi-error"},Qd={primary:"tw-text-primary-600",success:"tw-text-success",info:"tw-text-info",warning:"tw-text-warning",danger:"tw-text-danger"};class eh{get iconClasses(){var e;return[null!==(e=this.simpleDialogOpts.icon)&&void 0!==e?e:Zd[this.simpleDialogOpts.type],Qd[this.simpleDialogOpts.type]]}constructor(e,t,i){this.dialogRef=e,this.i18nService=t,this.simpleDialogOpts=i,this.formGroup=new Il.gE({}),this.showCancelButton=null!==this.simpleDialogOpts.cancelButtonText,this.accept=()=>Hd(this,void 0,void 0,function*(){this.simpleDialogOpts.acceptAction&&(yield this.simpleDialogOpts.acceptAction()),this.simpleDialogOpts.disableClose||this.dialogRef.close(!0)}),this.localizeText()}localizeText(){var e,t;this.title=this.translate(this.simpleDialogOpts.title),this.content=this.translate(this.simpleDialogOpts.content),this.acceptButtonText=this.translate(null!==(e=this.simpleDialogOpts.acceptButtonText)&&void 0!==e?e:{key:"yes"}),this.showCancelButton&&(this.cancelButtonText=this.translate(null!==(t=this.simpleDialogOpts.cancelButtonText)&&void 0!==t?t:void 0!==this.simpleDialogOpts.acceptButtonText?{key:"cancel"}:{key:"no"}))}translate(e){var t;return"object"==typeof e?this.i18nService.t(e.key,...null!==(t=e.placeholders)&&void 0!==t?t:[]):e}}eh.ɵfac=function(e){return new(e||eh)(Fl.rXU(pd.ce),Fl.rXU(Ul),Fl.rXU(pd.Qs))},eh.ɵcmp=Fl.VBU({type:eh,selectors:[["ng-component"]],decls:10,vars:8,consts:[["bit-simple-dialog","",3,"formGroup","bitSubmit"],["bitDialogIcon","","aria-hidden","true",1,"bwi","tw-text-3xl"],["bitDialogTitle",""],["bitDialogContent",""],["bitDialogFooter",""],["type","submit","bitButton","","bitFormButton","","buttonType","primary"],["type","button","bitButton","","bitFormButton","","buttonType","secondary"],["type","button","bitButton","","bitFormButton","","buttonType","secondary",3,"click"]],template:function(e,t){1&e&&(Fl.j41(0,"form",0),Fl.nrm(1,"i",1),Fl.j41(2,"span",2),Fl.EFF(3),Fl.k0s(),Fl.j41(4,"div",3),Fl.EFF(5),Fl.k0s(),Fl.qex(6,4),Fl.j41(7,"button",5),Fl.EFF(8),Fl.k0s(),Fl.nVh(9,Jd,2,1,"button",6),Fl.bVm(),Fl.k0s()),2&e&&(Fl.Y8G("formGroup",t.formGroup)("bitSubmit",t.accept),Fl.R7$(),Fl.HbH(t.iconClasses),Fl.R7$(2),Fl.JRh(t.title),Fl.R7$(2),Fl.JRh(t.content),Fl.R7$(3),Fl.SpI(" ",t.acceptButtonText," "),Fl.R7$(),Fl.vxM(t.showCancelButton?9:-1))},dependencies:[Il.X1,Il.qT,Il.cb,Il.j4,Md,Yd,Wd,td,jd],encapsulation:2});var th=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class ih{enable(){document.body.classList.add("tw-overflow-hidden")}disable(){document.body.classList.remove("tw-overflow-hidden")}attach(){}detach(){}}class nh{}class rh extends wl.qC{constructor(){super(),this.abortController=null,this.prevBreakpoint=null,"undefined"!=typeof window&&(this.abortController=new AbortController,this.updatePosition(),window.addEventListener("resize",this.updatePosition.bind(this),{signal:this.abortController.signal}))}dispose(){var e;null===(e=this.abortController)||void 0===e||e.abort(),this.abortController=null,super.dispose()}updatePosition(){const e=!(e=>{if("undefined"==typeof window||!window.matchMedia)return!1;const t=`(min-width: ${xd[e]}px)`;return window.matchMedia(t).matches})("md"),t=e?"small":"large";this.prevBreakpoint!==t&&(this.prevBreakpoint=t,e?this.bottom().centerHorizontally():this.centerVertically().centerHorizontally(),this.apply())}}class sh extends wl.qC{constructor(){super(),this.centerHorizontally().centerVertically()}}class oh{constructor(e){this.drawerService=e,this.isDrawer=!0,this._closed=new Co.B,this.closed=this._closed.asObservable(),this.disableClose=!1,this.componentInstance=null}close(e,t){this.disableClose||(this.drawerService.close(this.portal),this._closed.next(e),this._closed.complete())}}class ah{constructor(){this.isDrawer=!1}close(e,t){this.cdkDialogRefBase.close(e,t)}get closed(){return this.cdkDialogRefBase.closed}get disableClose(){return this.cdkDialogRefBase.disableClose}set disableClose(e){this.cdkDialogRefBase.disableClose=e}get componentInstance(){return this.cdkDialogRefBase.componentInstance}}class lh{constructor(){this.dialog=(0,a.WQX)(pd.lG),this.drawerService=(0,a.WQX)(Ad),this.injector=(0,a.WQX)(a.zZn),this.router=(0,a.WQX)(Fd.Ix,{optional:!0}),this.authService=(0,a.WQX)(Rd,{optional:!0}),this.backDropClasses=["tw-fixed","tw-bg-black","tw-bg-opacity-30","tw-inset-0"],this.defaultScrollStrategy=new ih,this.activeDrawer=null,this.router&&this.authService&&this.router.events.pipe((0,Eo.p)(e=>e instanceof Fd.wF),(0,go.n)(()=>this.authService.getAuthStatus()),(0,Eo.p)(e=>e!==Pd.Unlocked),(0,xl.pQ)()).subscribe(()=>this.closeAll())}open(e,t){var i;const n=new ah,r=this.createInjector({data:null==t?void 0:t.data,dialogRef:n}),s=Object.assign({backdropClass:this.backDropClasses,scrollStrategy:this.defaultScrollStrategy,positionStrategy:null!==(i=null==t?void 0:t.positionStrategy)&&void 0!==i?i:new rh,injector:r},t);return n.cdkDialogRefBase=this.dialog.open(e,s),void 0===(null==t?void 0:t.restoreFocus)&&this.setRestoreFocusEl(n),n}openDrawer(e,t){var i;null===(i=this.activeDrawer)||void 0===i||i.close(),this.activeDrawer=new oh(this.drawerService);const n=new Vl.A8(e,null,this.createInjector({data:null==t?void 0:t.data,dialogRef:this.activeDrawer}));return this.activeDrawer.portal=n,this.drawerService.open(n),this.activeDrawer}openSimpleDialog(e){return th(this,void 0,void 0,function*(){const t=this.openSimpleDialogRef(e);return(0,bo._)(t.closed.pipe((0,l.T)(e=>!!e)))})}openSimpleDialogRef(e){return this.open(eh,{data:e,disableClose:e.disableClose,positionStrategy:new sh})}closeAll(){return this.dialog.closeAll()}closeDrawer(){var e;return null===(e=this.activeDrawer)||void 0===e?void 0:e.close()}setRestoreFocusEl(e){const t=document.activeElement,i=setTimeout(()=>{let i=t;(null==i?void 0:i.isConnected)||(i=document.activeElement),i instanceof HTMLElement&&(e.cdkDialogRefBase.config.restoreFocus=i)},0);e.closed.pipe((0,_o.s)(1)).subscribe(()=>{clearTimeout(i)})}createInjector(e){return a.zZn.create({providers:[{provide:pd.Qs,useValue:e.data},{provide:nh,useValue:e.dialogRef},{provide:pd.ce,useValue:e.dialogRef}],parent:this.injector})}}lh.ɵfac=function(e){return new(e||lh)},lh.ɵprov=a.jDH({token:lh,factory:lh.ɵfac});class ch{constructor(e){this.dialogRef=e,this.dialogResult=(0,o.hFB)(void 0,{alias:"bitDialogClose"})}get disableClose(){var e;return!!(null===(e=this.dialogRef)||void 0===e?void 0:e.disableClose)||null}close(){this.disableClose||this.dialogRef.close(this.dialogResult())}}ch.ɵfac=function(e){return new(e||ch)(Fl.rXU(pd.ce,8))},ch.ɵdir=Fl.FsC({type:ch,selectors:[["","bitDialogClose",""]],hostVars:1,hostBindings:function(e,t){1&e&&Fl.bIt("click",function(){return t.close()}),2&e&&Fl.BMQ("disabled",t.disableClose)},inputs:{dialogResult:[1,"bitDialogClose","dialogResult"]}});var uh=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const dh=["dialogHeader"],hh=["scrollBottom"],ph=[[["","bitDialogTitle",""]],[["","bitDialogHeaderEnd",""]],[["","bitDialogContent",""]],[["","bitDialogFooter",""]]],vh=(e,t)=>[e,t],fh=(e,t,i,n)=>({"tw-p-4 has-[[biticonbutton]]:tw-pe-2":e,"tw-px-6 tw-py-4 has-[[biticonbutton]]:tw-pe-4":t,"tw-border-secondary-100":i,"tw-border-transparent":n}),mh=(e,t,i)=>({"tw-min-h-60":e,"tw-bg-background":t,"tw-bg-background-alt":i}),gh=(e,t,i,n)=>({"tw-py-2 tw-ps-6 tw-pe-6":e,"tw-overflow-y-auto":t,"tw-invisible tw-overflow-y-hidden":i,"tw-py-4":n}),yh=(e,t)=>({"tw-border-transparent":e,"tw-border-secondary-100":t}),bh=(e,t)=>({"tw-px-6 tw-py-4":e,"tw-p-4 has-[[biticonbutton]]:tw-pe-2":t});function wh(e,t){1&e&&(Fl.j41(0,"span",5),Fl.EFF(1),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",t," "))}function Sh(e,t){1&e&&(Fl.nrm(0,"button",7),Fl.nI1(1,"i18n")),2&e&&Fl.Y8G("label",Fl.bMT(1,1,"close"))}function kh(e,t){1&e&&(Fl.j41(0,"div",9),Fl.nrm(1,"bit-spinner"),Fl.k0s())}const Ih={small:"md:tw-max-w-sm",default:"md:tw-max-w-xl",large:"md:tw-max-w-3xl"},Ch={small:"md:tw-max-w-sm",default:"md:tw-max-w-lg",large:"md:tw-max-w-2xl"},Th={small:24,default:32,large:42};class Ph{constructor(){this.destroyRef=(0,a.WQX)(a.abz),this.ngZone=(0,a.WQX)(Fl.SKi),this.el=(0,a.WQX)(Fl.aKT),this.drawerService=(0,a.WQX)(Ad),this.dialogHeader=o.ebz.required("dialogHeader"),this.scrollableBody=o.ebz.required(Sl.uv),this.scrollBottom=o.ebz.required("scrollBottom"),this.dialogRef=(0,a.WQX)(nh,{optional:!0}),this.bodyHasScrolledFrom=(e=>{const t=null!=e?e:(0,a.vPA)((0,a.WQX)(Sl.uv)),i=(0,xl.br)(t).pipe((0,go.n)(e=>e.elementScrolled().pipe((0,kd.Z)(null),(0,l.T)(()=>({top:e.measureScrollOffset("top")>0,bottom:e.measureScrollOffset("bottom")>1})))));return(0,xl.ot)(i,{initialValue:{top:!1,bottom:!1}})})(this.scrollableBody),this.scrollableBody$=(0,xl.br)(this.scrollableBody),this.scrollBottom$=(0,xl.br)(this.scrollBottom),this.isScrollable$=(0,jo.z)([this.scrollableBody$,this.scrollBottom$]).pipe((0,go.n)(([e,t])=>Td(e.getElementRef().nativeElement,t.nativeElement))),this.background=(0,o.hFB)("default"),this.dialogSize=(0,o.hFB)("default"),this.title=(0,o.hFB)(),this.subtitle=(0,o.hFB)(),this.disablePadding=(0,o.hFB)(!1,{transform:o.L39}),this.disableAnimations=(0,o.hFB)(!1,{transform:o.L39}),this.loading=(0,o.hFB)(!1),this.animationCompleted=(0,a.vPA)(!1),this.width=(0,Rl.EW)(()=>{var e;const t=this.dialogSize();return(null===(e=this.dialogRef)||void 0===e?void 0:e.isDrawer)?this.drawerService.isPushMode()?Ch[t]:"":Ih[t]}),this.classes=(0,Rl.EW)(()=>{var e,t;const i=null===(e=this.dialogRef)||void 0===e?void 0:e.isDrawer,n=["tw-flex","tw-flex-col",i?"tw-w-full":"tw-w-screen"],r=i?["tw-h-full"]:["md:tw-p-4","tw-max-h-[90vh]"],s=this.dialogSize(),o=this.disableAnimations()||this.animationCompleted()||(null===(t=this.dialogRef)||void 0===t?void 0:t.isDrawer)?[]:"small"===s?["tw-animate-slide-down"]:["tw-animate-slide-up","md:tw-animate-slide-down"];return[...n,this.width(),...r,...o]}),(0,Rl.QZ)(()=>{var e,t;if(!(null===(e=this.dialogRef)||void 0===e?void 0:e.isDrawer))return;const i=this.dialogSize(),n="undefined"!=typeof document&&parseFloat(getComputedStyle(document.documentElement).fontSize)||16;this.drawerService.declarePushWidth((null!==(t=Th[i])&&void 0!==t?t:32)*n)})}handleEsc(e){var t,i;(null===(t=this.dialogRef)||void 0===t?void 0:t.disableClose)||(null===(i=this.dialogRef)||void 0===i||i.close(),e.stopPropagation())}onAnimationEnd(){this.animationCompleted.set(!0)}ngAfterViewInit(){return uh(this,void 0,void 0,function*(){this.ngZone.isStable||(yield(0,bo._)(this.ngZone.onStable)),this.handleAutofocus()})}handleAutofocus(){const e=function(e){return e.querySelectorAll("[appAutofocus], [bitAutofocus]")}(this.el.nativeElement);if(!(e.length>0)){const e=setTimeout(()=>{this.dialogHeader().nativeElement.focus()},0);this.destroyRef.onDestroy(()=>clearTimeout(e))}}}Ph.ɵfac=function(e){return new(e||Ph)},Ph.ɵcmp=Fl.VBU({type:Ph,selectors:[["bit-dialog"],["","bit-dialog",""]],viewQuery:function(e,t){1&e&&(Fl.wEZ(t.dialogHeader,dh,5),Fl.wEZ(t.scrollableBody,Sl.uv,5),Fl.wEZ(t.scrollBottom,hh,5)),2&e&&Fl.NyB(3)},hostVars:2,hostBindings:function(e,t){1&e&&Fl.bIt("keydown.esc",function(e){return t.handleEsc(e)})("animationend",function(){return t.onAnimationEnd()}),2&e&&Fl.HbH(t.classes())},inputs:{background:[1,"background"],dialogSize:[1,"dialogSize"],title:[1,"title"],subtitle:[1,"subtitle"],disablePadding:[1,"disablePadding"],disableAnimations:[1,"disableAnimations"],loading:[1,"loading"]},ngContentSelectors:["[bitDialogTitle]","[bitDialogHeaderEnd]","[bitDialogContent]","[bitDialogFooter]"],decls:21,vars:35,consts:[["dialogHeader",""],["scrollBottom",""],["cdkTrapFocus","",1,"tw-flex","tw-w-full","tw-flex-col","tw-self-center","tw-overflow-hidden","tw-border","tw-border-solid","tw-border-secondary-100","tw-bg-background","tw-text-main",3,"ngClass"],[1,"tw-flex","tw-justify-between","tw-items-center","tw-gap-4","tw-border-0","tw-border-b","tw-border-solid","tw-py-3","tw-ps-6","tw-pe-4",3,"ngClass"],["bitDialogTitleContainer","","bitTypography","h3","noMargin","","tabindex","-1",1,"tw-text-main","tw-mb-0","tw-line-clamp-2","tw-text-ellipsis","tw-break-words","focus-visible:tw-outline-none"],[1,"tw-text-muted","tw-font-normal","tw-text-sm"],[1,"tw-flex","tw-items-center","tw-justify-center"],["type","button","bitIconButton","bwi-close","buttonType","main","size","default","bitDialogClose","",3,"label"],[1,"tw-relative","tw-flex-1","tw-flex","tw-flex-col","tw-overflow-hidden",3,"ngClass"],[1,"tw-absolute","tw-flex","tw-size-full","tw-items-center","tw-justify-center"],["cdkScrollable","",3,"ngClass"],["data-chromatic","ignore",1,"tw-border-0","tw-border-t","tw-border-solid",3,"ngClass"],[1,"tw-flex","tw-flex-row","tw-items-center","tw-gap-2","tw-bg-background","tw-py-5","tw-ps-6","tw-pe-4",3,"ngClass"]],template:function(e,t){var i;if(1&e&&(Fl.NAR(ph),Fl.j41(0,"section",2)(1,"header",3)(2,"h2",4,0),Fl.EFF(4),Fl.nVh(5,wh,2,1,"span",5),Fl.SdG(6),Fl.k0s(),Fl.j41(7,"div",6),Fl.SdG(8,1),Fl.nVh(9,Sh,2,3,"button",7),Fl.k0s()(),Fl.j41(10,"div",8),Fl.nVh(11,kh,2,0,"div",9),Fl.j41(12,"div",10),Fl.SdG(13,2),Fl.nrm(14,"div",null,1),Fl.k0s()(),Fl.SS7(16),Fl.nI1(17,"async"),Fl.nrm(18,"div",11),Fl.j41(19,"footer",12),Fl.SdG(20,3),Fl.k0s()()),2&e){let e;const n=null==t.dialogRef?null:t.dialogRef.isDrawer,r=null!==(i=t.width())&&void 0!==i?i:"";Fl.Y8G("ngClass",Fl.l_i(12,vh,r,n?"tw-h-full tw-border-t-0":"tw-rounded-t-xl md:tw-rounded-xl tw-shadow-lg"));const s=t.bodyHasScrolledFrom().top;Fl.R7$(),Fl.Y8G("ngClass",Fl.ziG(15,fh,!n,n,s,!s)),Fl.R7$(3),Fl.SpI(" ",t.title()," "),Fl.R7$(),Fl.vxM((e=t.subtitle())?5:-1,e),Fl.R7$(4),Fl.vxM(null!=t.dialogRef&&t.dialogRef.disableClose?-1:9),Fl.R7$(),Fl.Y8G("ngClass",Fl.sMw(20,mh,t.loading(),"default"===t.background(),"alt"===t.background())),Fl.R7$(),Fl.vxM(t.loading()?11:-1),Fl.R7$(),Fl.Y8G("ngClass",Fl.ziG(24,gh,!t.disablePadding(),!t.loading(),t.loading(),"alt"===t.background()));const o=Fl.bMT(17,10,t.isScrollable$),a=!t.bodyHasScrolledFrom().top&&o||t.bodyHasScrolledFrom().bottom;Fl.R7$(6),Fl.Y8G("ngClass",Fl.l_i(29,yh,!a,a)),Fl.R7$(),Fl.Y8G("ngClass",Fl.l_i(32,bh,n,!n))}},dependencies:[kl.MD,kl.YU,zd,rc,Zl,ch,gl.kB,Sl.uv,Nl,kl.Jj,sc],encapsulation:2});class Fh{}Fh.ɵfac=function(e){return new(e||Fh)},Fh.ɵmod=Fl.$C({type:Fh}),Fh.ɵinj=a.G2t({providers:[lh],imports:[pd.Ph,Ph,pd.Ph]});var Rh=i(31436);class xh{constructor(){this.scrollableRef=(0,a.vPA)(null),this.scrollableRef$=(0,xl.br)(this.scrollableRef)}}xh.ɵfac=function(e){return new(e||xh)},xh.ɵprov=a.jDH({token:xh,factory:xh.ɵfac,providedIn:"root"});class Ah{constructor(){this.ref=(0,a.WQX)(Fl.aKT),this.service=(0,a.WQX)(xh),this.service.scrollableRef.set(this.ref)}ngOnDestroy(){this.service.scrollableRef.set(null)}}Ah.ɵfac=function(e){return new(e||Ah)},Ah.ɵdir=Fl.FsC({type:Ah,selectors:[["","bitScrollLayoutHost",""]],hostAttrs:[1,"cdk-virtual-scrollable"]});class Dh extends Sl.fI{constructor(){super(),this.service=(0,a.WQX)(xh),(0,Rl.QZ)(()=>{const e=this.service.scrollableRef();e?this.elementRef=e:console.error("ScrollLayoutDirective can't find scroll host")})}elementScrolled(){return this.service.scrollableRef$.pipe((0,Eo.p)(e=>null!==e),(0,go.n)(e=>(0,Rh.R)(e.nativeElement,"scroll")))}getElementRef(){return this.service.scrollableRef()}measureBoundingClientRectWithScrollOffset(e){return this.service.scrollableRef().nativeElement.getBoundingClientRect()[e]-this.measureScrollOffset(e)}}Dh.ɵfac=function(e){return new(e||Dh)},Dh.ɵdir=Fl.FsC({type:Dh,selectors:[["","bitScrollLayout",""]],features:[Fl.Jv_([{provide:Sl.qy,useExisting:Dh}]),Fl.Vt3]});class Eh{constructor(){this.alignContent=(0,o.hFB)("middle")}get alignmentClass(){switch(this.alignContent()){case"top":return"tw-align-top";case"middle":return"tw-align-middle";case"bottom":return"tw-align-bottom";default:return"tw-align-baseline"}}get classList(){return["tw-border-0","tw-border-b","tw-border-secondary-300","tw-border-solid","hover:tw-bg-hover-default","last:tw-border-0",this.alignmentClass]}}Eh.ɵfac=function(e){return new(e||Eh)},Eh.ɵdir=Fl.FsC({type:Eh,selectors:[["tr","bitRow",""]],hostVars:2,hostBindings:function(e,t){2&e&&Fl.HbH(t.classList)},inputs:{alignContent:[1,"alignContent"]}});var $h=i(93585);const Oh=[[["","header",""]]],Uh=e=>({$implicit:e});function Mh(e,t){1&e&&Fl.eu8(0)}class Nh{constructor(e){this.template=e}}Nh.ɵfac=function(e){return new(e||Nh)(Fl.rXU(Fl.C4Q))},Nh.ɵdir=Fl.FsC({type:Nh,selectors:[["ng-template","body",""]]});class Vh{constructor(){this.dataSource=(0,o.hFB)(),this.layout=(0,o.hFB)("auto"),this.templateVariable=(0,o.sbv)(Nh),this._initialized=!1}get tableClass(){return["tw-w-full","tw-leading-normal","tw-text-main","tw-border-collapse","tw-text-start","auto"===this.layout()?"tw-table-auto":"tw-table-fixed"]}ngAfterContentChecked(){const e=this.dataSource();if(!this._initialized&&(0,$h.y)(e)){this._initialized=!0;const t=e.connect();this.rows$=t}}ngOnDestroy(){const e=this.dataSource();(0,$h.y)(e)&&e.disconnect()}}Vh.ɵfac=function(e){return new(e||Vh)},Vh.ɵcmp=Fl.VBU({type:Vh,selectors:[["bit-table"]],contentQueries:function(e,t,i){1&e&&Fl.C6U(i,t.templateVariable,Nh,5),2&e&&Fl.NyB()},inputs:{dataSource:[1,"dataSource"],layout:[1,"layout"]},ngContentSelectors:["[header]"],decls:5,vars:5,consts:[[3,"ngClass"],[1,"tw-border-0","tw-border-b-2","tw-border-solid","tw-border-secondary-300","tw-font-medium","tw-text-muted"],[4,"ngTemplateOutlet","ngTemplateOutletContext"]],template:function(e,t){1&e&&(Fl.NAR(Oh),Fl.j41(0,"table",0)(1,"thead",1),Fl.SdG(2),Fl.k0s(),Fl.j41(3,"tbody"),Fl.DNE(4,Mh,1,0,"ng-container",2),Fl.k0s()()),2&e&&(Fl.Y8G("ngClass",t.tableClass),Fl.R7$(4),Fl.Y8G("ngTemplateOutlet",t.templateVariable().template)("ngTemplateOutletContext",Fl.eq3(3,Uh,t.rows$)))},dependencies:[kl.MD,kl.YU,kl.T3],encapsulation:2});const Bh=[[["","header",""]]],jh=e=>({paddingBottom:e}),Gh=e=>({$implicit:e});function Lh(e,t){1&e&&Fl.eu8(0)}function zh(e,t){if(1&e&&(Fl.j41(0,"tr",4),Fl.DNE(1,Lh,1,0,"ng-container",5),Fl.k0s()),2&e){const e=t.$implicit,i=Fl.XpG();Fl.R7$(),Fl.Y8G("ngTemplateOutlet",i.rowDef().template)("ngTemplateOutletContext",Fl.eq3(2,Gh,e))}}class _h{constructor(e){this.template=e}}_h.ɵfac=function(e){return new(e||_h)(Fl.rXU(Fl.C4Q))},_h.ɵdir=Fl.FsC({type:_h,selectors:[["","bitRowDef",""]]});class Kh extends Vh{constructor(e,t){super(),this.zone=e,this.el=t,this.rowSize=o.hFB.required(),this.trackBy=(0,o.hFB)(),this.rowDef=(0,o.sbv)(_h),this.headerHeight=0}ngAfterViewInit(){this.headerObserver=new ResizeObserver(e=>{this.zone.run(()=>{this.headerHeight=e[0].contentRect.height})}),this.headerObserver.observe(this.el.nativeElement.querySelector("thead"))}ngOnDestroy(){super.ngOnDestroy(),this.headerObserver&&this.headerObserver.disconnect()}}Kh.ɵfac=function(e){return new(e||Kh)(Fl.rXU(Fl.SKi),Fl.rXU(Fl.aKT))},Kh.ɵcmp=Fl.VBU({type:Kh,selectors:[["bit-table-scroll"]],contentQueries:function(e,t,i){1&e&&Fl.C6U(i,t.rowDef,_h,5),2&e&&Fl.NyB()},inputs:{rowSize:[1,"rowSize"],trackBy:[1,"trackBy"]},features:[Fl.Jv_([{provide:Vh,useExisting:Kh}]),Fl.Vt3],ngContentSelectors:["[header]"],decls:7,vars:8,consts:[["bitScrollLayout","",3,"itemSize","ngStyle"],[3,"ngClass"],[1,"tw-border-0","tw-border-b-2","tw-border-solid","tw-border-secondary-300","tw-font-medium","tw-text-muted"],["bitRow","",4,"cdkVirtualFor","cdkVirtualForOf","cdkVirtualForTrackBy","cdkVirtualForTemplateCacheSize"],["bitRow",""],[4,"ngTemplateOutlet","ngTemplateOutletContext"]],template:function(e,t){1&e&&(Fl.NAR(Bh),Fl.j41(0,"cdk-virtual-scroll-viewport",0)(1,"table",1)(2,"thead",2)(3,"tr"),Fl.SdG(4),Fl.k0s()(),Fl.j41(5,"tbody"),Fl.DNE(6,zh,2,4,"tr",3),Fl.k0s()()()),2&e&&(Fl.Y8G("itemSize",t.rowSize())("ngStyle",Fl.eq3(6,jh,t.headerHeight+"px")),Fl.R7$(),Fl.Y8G("ngClass",t.tableClass),Fl.R7$(5),Fl.Y8G("cdkVirtualForOf",t.rows$)("cdkVirtualForTrackBy",t.trackBy())("cdkVirtualForTemplateCacheSize",0))},dependencies:[kl.MD,kl.YU,kl.T3,kl.B3,Sl.d6,Sl.yg,Sl.E$,Eh,Dh],encapsulation:2});class Xh{}Xh.ɵfac=function(e){return new(e||Xh)},Xh.ɵmod=Fl.$C({type:Xh}),Xh.ɵinj=a.G2t({imports:[kl.MD,Sl.E9,Vh,Kh]});class qh{}qh.ɵfac=function(e){return new(e||qh)},qh.ɵmod=Fl.$C({type:qh}),qh.ɵinj=a.G2t({});class Wh{}Wh.ɵfac=function(e){return new(e||Wh)},Wh.ɵmod=Fl.$C({type:Wh}),Wh.ɵinj=a.G2t({});class Yh{}Yh.ɵfac=function(e){return new(e||Yh)},Yh.ɵmod=Fl.$C({type:Yh}),Yh.ɵinj=a.G2t({});class Hh{}Hh.ɵfac=function(e){return new(e||Hh)},Hh.ɵmod=Fl.$C({type:Hh}),Hh.ɵinj=a.G2t({});const Jh={Visa:[{cardLength:16,blocks:[4,4,4,4]}],Mastercard:[{cardLength:16,blocks:[4,4,4,4]}],Maestro:[{cardLength:16,blocks:[4,4,4,4]},{cardLength:13,blocks:[4,4,5]},{cardLength:15,blocks:[4,6,5]},{cardLength:19,blocks:[4,4,4,4,3]}],Discover:[{cardLength:16,blocks:[4,4,4,4]}],"Diners Club":[{cardLength:14,blocks:[4,6,4]}],JCB:[{cardLength:16,blocks:[4,4,4,4]}],UnionPay:[{cardLength:16,blocks:[4,4,4,4]},{cardLength:19,blocks:[6,13]}],Amex:[{cardLength:15,blocks:[4,6,5]}],Other:[{cardLength:16,blocks:[4,4,4,4]}]};class Zh{transform(e,t){let i=Jh[t];null==i&&(i=Jh.Other);const n=e.length;let r=i.find(e=>e.cardLength==n);null==r&&(r=i[0]);const s=r.blocks,o=[];let a=0;return s.forEach(t=>{o.push(e.slice(a,a+t)),a+=t}),n>a&&o.push(e.slice(a)),o.join(" ")}}Zh.ɵfac=function(e){return new(e||Zh)},Zh.ɵpipe=Fl.EJ8({name:"creditCardNumber",type:Zh,pure:!0,standalone:!1});class Qh{transform(e,t,i){return`${e} ${1===e?t:i}`}}Qh.ɵfac=function(e){return new(e||Qh)},Qh.ɵpipe=Fl.EJ8({name:"pluralize",type:Qh,pure:!0});class ep{transform(e,t,i,n,r){return null==e||0===e.length?[]:null==t||t.length<2?e:(t=t.trim().toLowerCase(),e.filter(e=>{if(null!=i){const n="function"==typeof i?i(e):e[i];if((null==n?void 0:n.toString().toLowerCase().indexOf(t))>-1)return!0}if(null!=n){const i="function"==typeof n?n(e):e[n];if((null==i?void 0:i.toString().toLowerCase().indexOf(t))>-1)return!0}if(null!=r){const i="function"==typeof r?r(e):e[r];if((null==i?void 0:i.toString().toLowerCase().indexOf(t))>-1)return!0}return!1}))}}ep.ɵfac=function(e){return new(e||ep)},ep.ɵpipe=Fl.EJ8({name:"search",type:ep,pure:!0,standalone:!1});class tp{transform(e){return null==e||null==e.name&&null==e.email?null:null==e.name||""===e.name.trim()?e.email:e.name}}var ip,np,rp,sp,op,ap,lp,cp,up,dp,hp;tp.ɵfac=function(e){return new(e||tp)},tp.ɵpipe=Fl.EJ8({name:"userName",type:tp,pure:!0,standalone:!1}),function(e){e[e.Default=0]="Default",e[e.BillingSync=1]="BillingSync",e[e.Scim=2]="Scim"}(ip||(ip={})),function(e){e[e.CloudBillingSync=1]="CloudBillingSync",e[e.Scim=2]="Scim"}(np||(np={})),function(e){e[e.Invited=0]="Invited",e[e.Accepted=1]="Accepted",e[e.Confirmed=2]="Confirmed",e[e.Revoked=-1]="Revoked"}(rp||(rp={})),function(e){e[e.Owner=0]="Owner",e[e.Admin=1]="Admin",e[e.User=2]="User",e[e.Custom=4]="Custom"}(sp||(sp={})),function(e){e[e.TwoFactorAuthentication=0]="TwoFactorAuthentication",e[e.MasterPassword=1]="MasterPassword",e[e.PasswordGenerator=2]="PasswordGenerator",e[e.SingleOrg=3]="SingleOrg",e[e.RequireSso=4]="RequireSso",e[e.OrganizationDataOwnership=5]="OrganizationDataOwnership",e[e.DisableSend=6]="DisableSend",e[e.SendOptions=7]="SendOptions",e[e.ResetPassword=8]="ResetPassword",e[e.MaximumVaultTimeout=9]="MaximumVaultTimeout",e[e.DisablePersonalVaultExport=10]="DisablePersonalVaultExport",e[e.ActivateAutofill=11]="ActivateAutofill",e[e.AutomaticAppLogIn=12]="AutomaticAppLogIn",e[e.FreeFamiliesSponsorshipPolicy=13]="FreeFamiliesSponsorshipPolicy",e[e.RemoveUnlockWithPin=14]="RemoveUnlockWithPin",e[e.RestrictedItemTypes=15]="RestrictedItemTypes",e[e.UriMatchDefaults=16]="UriMatchDefaults",e[e.AutotypeDefaultSetting=17]="AutotypeDefaultSetting",e[e.AutoConfirm=18]="AutoConfirm",e[e.BlockClaimedDomainAccountCreation=19]="BlockClaimedDomainAccountCreation"}(op||(op={})),function(e){e[e.Msp=0]="Msp",e[e.Reseller=1]="Reseller",e[e.BusinessUnit=2]="BusinessUnit"}(ap||(ap={})),function(e){e[e.Invited=0]="Invited",e[e.Accepted=1]="Accepted",e[e.Confirmed=2]="Confirmed",e[e.Revoked=-1]="Revoked"}(lp||(lp={})),function(e){e[e.ProviderAdmin=0]="ProviderAdmin",e[e.ServiceUser=1]="ServiceUser"}(cp||(cp={})),function(e){e[e.Default=0]="Default",e[e.AzureAd=1]="AzureAd",e[e.Okta=2]="Okta",e[e.OneLogin=3]="OneLogin",e[e.JumpCloud=4]="JumpCloud",e[e.GoogleWorkspace=5]="GoogleWorkspace",e[e.Rippling=6]="Rippling"}(up||(up={})),function(e){e[e.Pending=0]="Pending",e[e.Created=1]="Created",e[e.Billable=2]="Billable"}(dp||(dp={}));class pp{constructor(e){this.i18nService=e}transform(e){if(null==e)return this.i18nService.t("unknown");switch(e){case sp.Owner:return this.i18nService.t("owner");case sp.Admin:return this.i18nService.t("admin");case sp.User:return this.i18nService.t("user");case sp.Custom:return this.i18nService.t("custom")}}}pp.ɵfac=function(e){return new(e||pp)(Fl.rXU(Ul,16))},pp.ɵpipe=Fl.EJ8({name:"userType",type:pp,pure:!0,standalone:!1}),function(e){e[e.AesCbc256_B64=0]="AesCbc256_B64",e[e.AesCbc256_HmacSha256_B64=2]="AesCbc256_HmacSha256_B64",e[e.CoseEncrypt0=7]="CoseEncrypt0",e[e.Rsa2048_OaepSha256_B64=3]="Rsa2048_OaepSha256_B64",e[e.Rsa2048_OaepSha1_B64=4]="Rsa2048_OaepSha1_B64",e[e.Rsa2048_OaepSha256_HmacSha256_B64=5]="Rsa2048_OaepSha256_HmacSha256_B64",e[e.Rsa2048_OaepSha1_HmacSha256_B64=6]="Rsa2048_OaepSha1_HmacSha256_B64"}(hp||(hp={}));const vp={[hp.AesCbc256_B64]:2,[hp.AesCbc256_HmacSha256_B64]:3,[hp.Rsa2048_OaepSha256_B64]:1,[hp.Rsa2048_OaepSha1_B64]:1,[hp.Rsa2048_OaepSha256_HmacSha256_B64]:2,[hp.Rsa2048_OaepSha1_HmacSha256_B64]:2,[hp.CoseEncrypt0]:1};var fp,mp,gp;!function(e){e[e.Direct=0]="Direct",e[e.Azure=1]="Azure"}(fp||(fp={})),function(e){e[e.ServerAuthorization=1]="ServerAuthorization",e[e.LocalAuthorization=2]="LocalAuthorization"}(mp||(mp={})),function(e){e.Local="local",e.Memory="memory",e.Session="session"}(gp||(gp={}));class yp{}var bp,wp,Sp;!function(e){e.Both="both",e.Disk="disk",e.Memory="memory"}(bp||(bp={}));class kp{constructor(e,t){this.diskStorageService=e,this.memoryStorageService=t}get(e,t){switch(e){case"disk":return[e,this.diskStorageService];case"memory":return[e,this.memoryStorageService];default:throw new Error(`Unexpected location: ${e}`)}}}!function(e){e.Auto="auto",e.Pin="pin"}(wp||(wp={})),function(e){e.System="system",e.Light="light",e.Dark="dark"}(Sp||(Sp={}));const Ip={System:"system",Light:"light",Dark:"dark"};var Cp=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Tp="[error: cannot decrypt]";class Pp{constructor(e,t,i,n){null!=t?this.initFromData(e,t,i,n):this.initFromEncryptedString(e)}get ivBytes(){return null==this.iv?null:bd.fromB64ToArray(this.iv)}get macBytes(){return null==this.mac?null:bd.fromB64ToArray(this.mac)}get dataBytes(){return null==this.data?null:bd.fromB64ToArray(this.data)}toSdk(){return this.encryptedString}toJSON(){return this.encryptedString}static fromJSON(e){return null==e?null:new Pp(e)}initFromData(e,t,i,n){this.encryptedString=null!=i?e+"."+i+"|"+t:e+"."+t,null!=n&&(this.encryptedString=this.encryptedString+"|"+n),this.encryptionType=e,this.data=t,this.iv=i,this.mac=n}initFromEncryptedString(e){if(this.encryptedString=e,!this.encryptedString)return;const{encType:t,encPieces:i}=Pp.parseEncryptedString(this.encryptedString);if(this.encryptionType=t,i.length===vp[t])switch(t){case hp.AesCbc256_HmacSha256_B64:this.iv=i[0],this.data=i[1],this.mac=i[2];break;case hp.AesCbc256_B64:this.iv=i[0],this.data=i[1];break;case hp.Rsa2048_OaepSha256_B64:case hp.Rsa2048_OaepSha1_B64:this.data=i[0];break;case hp.Rsa2048_OaepSha256_HmacSha256_B64:case hp.Rsa2048_OaepSha1_HmacSha256_B64:this.data=i[0],this.mac=i[1];break;default:return}}static parseEncryptedString(e){const t=e.split(".");let i,n=null;if(2===t.length)try{i=parseInt(t[0],null),n=t[1].split("|")}catch(e){return{encType:NaN,encPieces:[]}}else n=e.split("|"),i=hp.AesCbc256_B64;return{encType:i,encPieces:n}}static isSerializedEncString(e){if(null==e)return!1;const{encType:t,encPieces:i}=this.parseEncryptedString(e);return!isNaN(t)&&0!==i.length&&vp[t]===i.length}decrypt(e){return Cp(this,arguments,void 0,function*(e,t=null,i){if(null!=this.decryptedValue)return this.decryptedValue;try{if(null==t&&(t=yield this.getKeyForDecryption(e)),null==t)throw new Error("No key to decrypt EncString with orgId "+e);const i=bd.getContainerService().getEncryptService();this.decryptedValue=yield i.decryptString(this,t)}catch(e){console.error("[EncString Generic Decrypt] failed to decrypt encstring. Context: "+(null!=i?i:"No context"),e),this.decryptedValue=Tp}return this.decryptedValue})}getKeyForDecryption(e){return Cp(this,void 0,void 0,function*(){const t=bd.getContainerService().getKeyService();return null!=e?yield t.getOrgKey(e):yield t.getUserKey()})}}const Fp=new k(Ve,"biometricUnlockEnabled",{deserializer:e=>e,clearOn:[]}),Rp=new k(Ve,"clientKeyHalf",{deserializer:e=>e,clearOn:["logout"]}),xp=m.record(Ve,"promptCancelled",{deserializer:e=>e}),Ap=new k(Ve,"promptAutomatically",{deserializer:e=>e,clearOn:[]}),Dp=new m(Ve,"fingerprintValidated",{deserializer:e=>e}),Ep=new m(Ve,"lastProcessReload",{deserializer:e=>new Date(e)});var $p,Op,Up=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Mp{}function Np(e){return null==e?null:new Pp(e)}!function(e){e[e.Available=0]="Available",e[e.UnlockNeeded=1]="UnlockNeeded",e[e.HardwareUnavailable=2]="HardwareUnavailable",e[e.AutoSetupNeeded=3]="AutoSetupNeeded",e[e.ManualSetupNeeded=4]="ManualSetupNeeded",e[e.PlatformUnsupported=5]="PlatformUnsupported",e[e.DesktopDisconnected=6]="DesktopDisconnected",e[e.NotEnabledLocally=7]="NotEnabledLocally",e[e.NotEnabledInConnectedDesktopApp=8]="NotEnabledInConnectedDesktopApp",e[e.NativeMessagingPermissionMissing=9]="NativeMessagingPermissionMissing"}($p||($p={})),function(e){e.AuthenticateWithBiometrics="authenticateWithBiometrics",e.GetBiometricsStatus="getBiometricsStatus",e.UnlockWithBiometricsForUser="unlockWithBiometricsForUser",e.GetBiometricsStatusForUser="getBiometricsStatusForUser",e.CanEnableBiometricUnlock="canEnableBiometricUnlock"}(Op||(Op={}));class Vp{supportsBiometric(){throw new Error("Method not implemented.")}}Error;class Bp{}var jp=i(69636),Gp=i(27442),Lp=i(96718),zp=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class _p{static fromData(e){switch(e.type){case"organization":return new Kp(e.key);case"provider":return new Xp(e.key,e.providerId);default:return null}}static isProviderEncrypted(e){return"provider"===e.toData().type}}class Kp{constructor(e){this.key=e}decrypt(e,t){return zp(this,void 0,void 0,function*(){return yield e.decapsulateKeyUnsigned(this.encryptedOrganizationKey,t)})}get encryptedOrganizationKey(){return new Pp(this.key)}toData(){return{type:"organization",key:this.key}}}class Xp{constructor(e,t){this.key=e,this.providerId=t}decrypt(e,t){return zp(this,void 0,void 0,function*(){const i=yield e.unwrapSymmetricKey(new Pp(this.key),t[this.providerId]);if(null==i)throw new Error("Failed to decrypt organization key");return i})}get encryptedOrganizationKey(){return new Pp(this.key)}toData(){return{type:"provider",key:this.key,providerId:this.providerId}}}class qp{}var Wp=i(99969),Yp=i(80909),Hp=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Jp=m.record(D,"accounts",{deserializer:e=>Object.assign(Object.assign({},e),{creationDate:e.creationDate?new Date(e.creationDate):void 0})}),Zp=new m(D,"activeAccountId",{deserializer:e=>e}),Qp=m.record(D,"activity",{deserializer:e=>new Date(e)}),ev=new k(D,"verifyNewDeviceLogin",{deserializer:e=>e,clearOn:["logout"]}),tv={email:"",emailVerified:!1,name:void 0,creationDate:void 0},iv=(0,l.T)(e=>{if(null==e)throw new Error("Null or undefined account");return e.id}),nv=(0,l.T)(e=>{var t;return null!==(t=null==e?void 0:e.id)&&void 0!==t?t:null});var rv=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class sv{buildDomainModel(e,t,i,n=[]){for(const r in i){if(!i.hasOwnProperty(r))continue;const s=t[i[r]||r];n.indexOf(r)>-1?e[r]=s||null:e[r]=s?new Pp(s):null}}buildDataModel(e,t,i,n=[]){for(const r in i){if(!i.hasOwnProperty(r))continue;const s=e[i[r]||r];n.indexOf(r)>-1?t[r]=null!=s?s:null:t[r]=null!=s?s.encryptedString:null}}decryptObj(e,t,i){return rv(this,arguments,void 0,function*(e,t,i,n=null,r="No Domain Context"){var s,o;for(const a of i)t[a]=null!==(o=yield null===(s=e[a])||void 0===s?void 0:s.decrypt(null,n,`Property: ${a}; ObjectContext: ${r}`))&&void 0!==o?o:null;return t})}}class ov extends sv{constructor(){super(...arguments),this.minComplexity=0,this.minLength=0,this.requireUpper=!1,this.requireLower=!1,this.requireNumbers=!1,this.requireSpecial=!1,this.enforceOnLogin=!1}static fromResponse(e){if(null==e)return null;const t=new ov;return t.minComplexity=e.minComplexity,t.minLength=e.minLength,t.requireUpper=e.requireUpper,t.requireLower=e.requireLower,t.requireNumbers=e.requireNumbers,t.requireSpecial=e.requireSpecial,t.enforceOnLogin=e.enforceOnLogin,t}}class av{constructor(e){null!=e&&(this.id=e.id,this.organizationId=e.organizationId,this.type=e.type,this.data=e.data,this.enabled=e.enabled,this.revisionDate=e.revisionDate)}static fromPolicy(e){return Object.assign(new av,e)}}class lv extends sv{constructor(e){super(),null!=e&&(this.id=e.id,this.organizationId=e.organizationId,this.type=e.type,this.data=e.data,this.enabled=e.enabled,this.revisionDate=new Date(e.revisionDate))}static fromResponse(e){return new lv(new av(e))}static fromListResponse(e){return e.data.map(e=>lv.fromResponse(e))}}class cv extends sv{constructor(){super(...arguments),this.autoEnrollEnabled=!1}}const uv=k.record(P,"policies",{deserializer:e=>e,clearOn:["logout"]});var dv=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const hv=(0,l.T)(e=>{var t;return null!==(t=e.at(0))&&void 0!==t?t:void 0});var pv;!function(e){e.Lock="lock",e.LogOut="logOut"}(pv||(pv={}));const vv="never",fv="onRestart",mv="onLocked",gv="onSleep",yv="onIdle",bv="custom",wv=0,Sv=1,kv=480;function Iv(e){return"number"==typeof e}const Cv=new k(Y,"vaultTimeoutAction",{deserializer:e=>e,clearOn:[]}),Tv=new k(Y,"vaultTimeout",{deserializer:e=>e,clearOn:[]});var Pv=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Fv{}var Rv=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class xv{constructor(e,t,i,n,r,s,o,a){this.accountService=e,this.platformUtilsService=t,this.authService=i,this.vaultTimeoutSettingsService=n,this.taskSchedulerService=r,this.logService=s,this.lockService=o,this.logoutService=a,this.inited=!1,this.taskSchedulerService.registerTaskHandler(Wa,()=>this.checkVaultTimeout())}init(e){return Rv(this,void 0,void 0,function*(){this.inited||(this.inited=!0,e&&this.startCheck())})}startCheck(){this.checkVaultTimeout().catch(e=>this.logService.error(e)),this.taskSchedulerService.setInterval(Wa,1e4)}checkVaultTimeout(){return Rv(this,void 0,void 0,function*(){const e=yield this.platformUtilsService.isPopupOpen();yield(0,bo._)((0,jo.z)([this.accountService.activeAccount$,this.accountService.accountActivity$]).pipe((0,To.H)(t=>Rv(this,[t],void 0,function*([t,i]){const n=null==t?void 0:t.id;for(const t in i){const r=t;null!=r&&(yield this.shouldLock(r,i[r],n,e))&&(yield this.executeTimeoutAction(r))}}))))})}shouldLock(e,t,i,n){return Rv(this,void 0,void 0,function*(){if(n&&e===i)return!1;const r=yield this.authService.getAuthStatus(e);if(r===Pd.Locked||r===Pd.LoggedOut)return!1;const s=yield(0,bo._)(this.vaultTimeoutSettingsService.getVaultTimeoutByUserId$(e));if("string"==typeof s)return!1;if(null==t)return!1;const o=60*s;return((new Date).getTime()-t.getTime())/1e3>=o})}executeTimeoutAction(e){return Rv(this,void 0,void 0,function*(){(yield(0,bo._)(this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(e)))===pv.LogOut?yield this.logoutService.logout(e,"vaultTimeout"):yield this.lockService.lock(e)})}}const Av=["abacus","abdomen","abdominal","abide","abiding","ability","ablaze","able","abnormal","abrasion","abrasive","abreast","abridge","abroad","abruptly","absence","absentee","absently","absinthe","absolute","absolve","abstain","abstract","absurd","accent","acclaim","acclimate","accompany","account","accuracy","accurate","accustom","acetone","achiness","aching","acid","acorn","acquaint","acquire","acre","acrobat","acronym","acting","action","activate","activator","active","activism","activist","activity","actress","acts","acutely","acuteness","aeration","aerobics","aerosol","aerospace","afar","affair","affected","affecting","affection","affidavit","affiliate","affirm","affix","afflicted","affluent","afford","affront","aflame","afloat","aflutter","afoot","afraid","afterglow","afterlife","aftermath","aftermost","afternoon","aged","ageless","agency","agenda","agent","aggregate","aghast","agile","agility","aging","agnostic","agonize","agonizing","agony","agreeable","agreeably","agreed","agreeing","agreement","aground","ahead","ahoy","aide","aids","aim","ajar","alabaster","alarm","albatross","album","alfalfa","algebra","algorithm","alias","alibi","alienable","alienate","aliens","alike","alive","alkaline","alkalize","almanac","almighty","almost","aloe","aloft","aloha","alone","alongside","aloof","alphabet","alright","although","altitude","alto","aluminum","alumni","always","amaretto","amaze","amazingly","amber","ambiance","ambiguity","ambiguous","ambition","ambitious","ambulance","ambush","amendable","amendment","amends","amenity","amiable","amicably","amid","amigo","amino","amiss","ammonia","ammonium","amnesty","amniotic","among","amount","amperage","ample","amplifier","amplify","amply","amuck","amulet","amusable","amused","amusement","amuser","amusing","anaconda","anaerobic","anagram","anatomist","anatomy","anchor","anchovy","ancient","android","anemia","anemic","aneurism","anew","angelfish","angelic","anger","angled","angler","angles","angling","angrily","angriness","anguished","angular","animal","animate","animating","animation","animator","anime","animosity","ankle","annex","annotate","announcer","annoying","annually","annuity","anointer","another","answering","antacid","antarctic","anteater","antelope","antennae","anthem","anthill","anthology","antibody","antics","antidote","antihero","antiquely","antiques","antiquity","antirust","antitoxic","antitrust","antiviral","antivirus","antler","antonym","antsy","anvil","anybody","anyhow","anymore","anyone","anyplace","anything","anytime","anyway","anywhere","aorta","apache","apostle","appealing","appear","appease","appeasing","appendage","appendix","appetite","appetizer","applaud","applause","apple","appliance","applicant","applied","apply","appointee","appraisal","appraiser","apprehend","approach","approval","approve","apricot","april","apron","aptitude","aptly","aqua","aqueduct","arbitrary","arbitrate","ardently","area","arena","arguable","arguably","argue","arise","armadillo","armband","armchair","armed","armful","armhole","arming","armless","armoire","armored","armory","armrest","army","aroma","arose","around","arousal","arrange","array","arrest","arrival","arrive","arrogance","arrogant","arson","art","ascend","ascension","ascent","ascertain","ashamed","ashen","ashes","ashy","aside","askew","asleep","asparagus","aspect","aspirate","aspire","aspirin","astonish","astound","astride","astrology","astronaut","astronomy","astute","atlantic","atlas","atom","atonable","atop","atrium","atrocious","atrophy","attach","attain","attempt","attendant","attendee","attention","attentive","attest","attic","attire","attitude","attractor","attribute","atypical","auction","audacious","audacity","audible","audibly","audience","audio","audition","augmented","august","authentic","author","autism","autistic","autograph","automaker","automated","automatic","autopilot","available","avalanche","avatar","avenge","avenging","avenue","average","aversion","avert","aviation","aviator","avid","avoid","await","awaken","award","aware","awhile","awkward","awning","awoke","awry","axis","babble","babbling","babied","baboon","backache","backboard","backboned","backdrop","backed","backer","backfield","backfire","backhand","backing","backlands","backlash","backless","backlight","backlit","backlog","backpack","backpedal","backrest","backroom","backshift","backside","backslid","backspace","backspin","backstab","backstage","backtalk","backtrack","backup","backward","backwash","backwater","backyard","bacon","bacteria","bacterium","badass","badge","badland","badly","badness","baffle","baffling","bagel","bagful","baggage","bagged","baggie","bagginess","bagging","baggy","bagpipe","baguette","baked","bakery","bakeshop","baking","balance","balancing","balcony","balmy","balsamic","bamboo","banana","banish","banister","banjo","bankable","bankbook","banked","banker","banking","banknote","bankroll","banner","bannister","banshee","banter","barbecue","barbed","barbell","barber","barcode","barge","bargraph","barista","baritone","barley","barmaid","barman","barn","barometer","barrack","barracuda","barrel","barrette","barricade","barrier","barstool","bartender","barterer","bash","basically","basics","basil","basin","basis","basket","batboy","batch","bath","baton","bats","battalion","battered","battering","battery","batting","battle","bauble","bazooka","blabber","bladder","blade","blah","blame","blaming","blanching","blandness","blank","blaspheme","blasphemy","blast","blatancy","blatantly","blazer","blazing","bleach","bleak","bleep","blemish","blend","bless","blighted","blimp","bling","blinked","blinker","blinking","blinks","blip","blissful","blitz","blizzard","bloated","bloating","blob","blog","bloomers","blooming","blooper","blot","blouse","blubber","bluff","bluish","blunderer","blunt","blurb","blurred","blurry","blurt","blush","blustery","boaster","boastful","boasting","boat","bobbed","bobbing","bobble","bobcat","bobsled","bobtail","bodacious","body","bogged","boggle","bogus","boil","bok","bolster","bolt","bonanza","bonded","bonding","bondless","boned","bonehead","boneless","bonelike","boney","bonfire","bonnet","bonsai","bonus","bony","boogeyman","boogieman","book","boondocks","booted","booth","bootie","booting","bootlace","bootleg","boots","boozy","borax","boring","borough","borrower","borrowing","boss","botanical","botanist","botany","botch","both","bottle","bottling","bottom","bounce","bouncing","bouncy","bounding","boundless","bountiful","bovine","boxcar","boxer","boxing","boxlike","boxy","breach","breath","breeches","breeching","breeder","breeding","breeze","breezy","brethren","brewery","brewing","briar","bribe","brick","bride","bridged","brigade","bright","brilliant","brim","bring","brink","brisket","briskly","briskness","bristle","brittle","broadband","broadcast","broaden","broadly","broadness","broadside","broadways","broiler","broiling","broken","broker","bronchial","bronco","bronze","bronzing","brook","broom","brought","browbeat","brownnose","browse","browsing","bruising","brunch","brunette","brunt","brush","brussels","brute","brutishly","bubble","bubbling","bubbly","buccaneer","bucked","bucket","buckle","buckshot","buckskin","bucktooth","buckwheat","buddhism","buddhist","budding","buddy","budget","buffalo","buffed","buffer","buffing","buffoon","buggy","bulb","bulge","bulginess","bulgur","bulk","bulldog","bulldozer","bullfight","bullfrog","bullhorn","bullion","bullish","bullpen","bullring","bullseye","bullwhip","bully","bunch","bundle","bungee","bunion","bunkbed","bunkhouse","bunkmate","bunny","bunt","busboy","bush","busily","busload","bust","busybody","buzz","cabana","cabbage","cabbie","cabdriver","cable","caboose","cache","cackle","cacti","cactus","caddie","caddy","cadet","cadillac","cadmium","cage","cahoots","cake","calamari","calamity","calcium","calculate","calculus","caliber","calibrate","calm","caloric","calorie","calzone","camcorder","cameo","camera","camisole","camper","campfire","camping","campsite","campus","canal","canary","cancel","candied","candle","candy","cane","canine","canister","cannabis","canned","canning","cannon","cannot","canola","canon","canopener","canopy","canteen","canyon","capable","capably","capacity","cape","capillary","capital","capitol","capped","capricorn","capsize","capsule","caption","captivate","captive","captivity","capture","caramel","carat","caravan","carbon","cardboard","carded","cardiac","cardigan","cardinal","cardstock","carefully","caregiver","careless","caress","caretaker","cargo","caring","carless","carload","carmaker","carnage","carnation","carnival","carnivore","carol","carpenter","carpentry","carpool","carport","carried","carrot","carrousel","carry","cartel","cartload","carton","cartoon","cartridge","cartwheel","carve","carving","carwash","cascade","case","cash","casing","casino","casket","cassette","casually","casualty","catacomb","catalog","catalyst","catalyze","catapult","cataract","catatonic","catcall","catchable","catcher","catching","catchy","caterer","catering","catfight","catfish","cathedral","cathouse","catlike","catnap","catnip","catsup","cattail","cattishly","cattle","catty","catwalk","caucasian","caucus","causal","causation","cause","causing","cauterize","caution","cautious","cavalier","cavalry","caviar","cavity","cedar","celery","celestial","celibacy","celibate","celtic","cement","census","ceramics","ceremony","certainly","certainty","certified","certify","cesarean","cesspool","chafe","chaffing","chain","chair","chalice","challenge","chamber","chamomile","champion","chance","change","channel","chant","chaos","chaperone","chaplain","chapped","chaps","chapter","character","charbroil","charcoal","charger","charging","chariot","charity","charm","charred","charter","charting","chase","chasing","chaste","chastise","chastity","chatroom","chatter","chatting","chatty","cheating","cheddar","cheek","cheer","cheese","cheesy","chef","chemicals","chemist","chemo","cherisher","cherub","chess","chest","chevron","chevy","chewable","chewer","chewing","chewy","chief","chihuahua","childcare","childhood","childish","childless","childlike","chili","chill","chimp","chip","chirping","chirpy","chitchat","chivalry","chive","chloride","chlorine","choice","chokehold","choking","chomp","chooser","choosing","choosy","chop","chosen","chowder","chowtime","chrome","chubby","chuck","chug","chummy","chump","chunk","churn","chute","cider","cilantro","cinch","cinema","cinnamon","circle","circling","circular","circulate","circus","citable","citadel","citation","citizen","citric","citrus","city","civic","civil","clad","claim","clambake","clammy","clamor","clamp","clamshell","clang","clanking","clapped","clapper","clapping","clarify","clarinet","clarity","clash","clasp","class","clatter","clause","clavicle","claw","clay","clean","clear","cleat","cleaver","cleft","clench","clergyman","clerical","clerk","clever","clicker","client","climate","climatic","cling","clinic","clinking","clip","clique","cloak","clobber","clock","clone","cloning","closable","closure","clothes","clothing","cloud","clover","clubbed","clubbing","clubhouse","clump","clumsily","clumsy","clunky","clustered","clutch","clutter","coach","coagulant","coastal","coaster","coasting","coastland","coastline","coat","coauthor","cobalt","cobbler","cobweb","cocoa","coconut","cod","coeditor","coerce","coexist","coffee","cofounder","cognition","cognitive","cogwheel","coherence","coherent","cohesive","coil","coke","cola","cold","coleslaw","coliseum","collage","collapse","collar","collected","collector","collide","collie","collision","colonial","colonist","colonize","colony","colossal","colt","coma","come","comfort","comfy","comic","coming","comma","commence","commend","comment","commerce","commode","commodity","commodore","common","commotion","commute","commuting","compacted","compacter","compactly","compactor","companion","company","compare","compel","compile","comply","component","composed","composer","composite","compost","composure","compound","compress","comprised","computer","computing","comrade","concave","conceal","conceded","concept","concerned","concert","conch","concierge","concise","conclude","concrete","concur","condense","condiment","condition","condone","conducive","conductor","conduit","cone","confess","confetti","confidant","confident","confider","confiding","configure","confined","confining","confirm","conflict","conform","confound","confront","confused","confusing","confusion","congenial","congested","congrats","congress","conical","conjoined","conjure","conjuror","connected","connector","consensus","consent","console","consoling","consonant","constable","constant","constrain","constrict","construct","consult","consumer","consuming","contact","container","contempt","contend","contented","contently","contents","contest","context","contort","contour","contrite","control","contusion","convene","convent","copartner","cope","copied","copier","copilot","coping","copious","copper","copy","coral","cork","cornball","cornbread","corncob","cornea","corned","corner","cornfield","cornflake","cornhusk","cornmeal","cornstalk","corny","coronary","coroner","corporal","corporate","corral","correct","corridor","corrode","corroding","corrosive","corsage","corset","cortex","cosigner","cosmetics","cosmic","cosmos","cosponsor","cost","cottage","cotton","couch","cough","could","countable","countdown","counting","countless","country","county","courier","covenant","cover","coveted","coveting","coyness","cozily","coziness","cozy","crabbing","crabgrass","crablike","crabmeat","cradle","cradling","crafter","craftily","craftsman","craftwork","crafty","cramp","cranberry","crane","cranial","cranium","crank","crate","crave","craving","crawfish","crawlers","crawling","crayfish","crayon","crazed","crazily","craziness","crazy","creamed","creamer","creamlike","crease","creasing","creatable","create","creation","creative","creature","credible","credibly","credit","creed","creme","creole","crepe","crept","crescent","crested","cresting","crestless","crevice","crewless","crewman","crewmate","crib","cricket","cried","crier","crimp","crimson","cringe","cringing","crinkle","crinkly","crisped","crisping","crisply","crispness","crispy","criteria","critter","croak","crock","crook","croon","crop","cross","crouch","crouton","crowbar","crowd","crown","crucial","crudely","crudeness","cruelly","cruelness","cruelty","crumb","crummiest","crummy","crumpet","crumpled","cruncher","crunching","crunchy","crusader","crushable","crushed","crusher","crushing","crust","crux","crying","cryptic","crystal","cubbyhole","cube","cubical","cubicle","cucumber","cuddle","cuddly","cufflink","culinary","culminate","culpable","culprit","cultivate","cultural","culture","cupbearer","cupcake","cupid","cupped","cupping","curable","curator","curdle","cure","curfew","curing","curled","curler","curliness","curling","curly","curry","curse","cursive","cursor","curtain","curtly","curtsy","curvature","curve","curvy","cushy","cusp","cussed","custard","custodian","custody","customary","customer","customize","customs","cut","cycle","cyclic","cycling","cyclist","cylinder","cymbal","cytoplasm","cytoplast","dab","dad","daffodil","dagger","daily","daintily","dainty","dairy","daisy","dallying","dance","dancing","dandelion","dander","dandruff","dandy","danger","dangle","dangling","daredevil","dares","daringly","darkened","darkening","darkish","darkness","darkroom","darling","darn","dart","darwinism","dash","dastardly","data","datebook","dating","daughter","daunting","dawdler","dawn","daybed","daybreak","daycare","daydream","daylight","daylong","dayroom","daytime","dazzler","dazzling","deacon","deafening","deafness","dealer","dealing","dealmaker","dealt","dean","debatable","debate","debating","debit","debrief","debtless","debtor","debug","debunk","decade","decaf","decal","decathlon","decay","deceased","deceit","deceiver","deceiving","december","decency","decent","deception","deceptive","decibel","decidable","decimal","decimeter","decipher","deck","declared","decline","decode","decompose","decorated","decorator","decoy","decrease","decree","dedicate","dedicator","deduce","deduct","deed","deem","deepen","deeply","deepness","deface","defacing","defame","default","defeat","defection","defective","defendant","defender","defense","defensive","deferral","deferred","defiance","defiant","defile","defiling","define","definite","deflate","deflation","deflator","deflected","deflector","defog","deforest","defraud","defrost","deftly","defuse","defy","degraded","degrading","degrease","degree","dehydrate","deity","dejected","delay","delegate","delegator","delete","deletion","delicacy","delicate","delicious","delighted","delirious","delirium","deliverer","delivery","delouse","delta","deluge","delusion","deluxe","demanding","demeaning","demeanor","demise","democracy","democrat","demote","demotion","demystify","denatured","deniable","denial","denim","denote","dense","density","dental","dentist","denture","deny","deodorant","deodorize","departed","departure","depict","deplete","depletion","deplored","deploy","deport","depose","depraved","depravity","deprecate","depress","deprive","depth","deputize","deputy","derail","deranged","derby","derived","desecrate","deserve","deserving","designate","designed","designer","designing","deskbound","desktop","deskwork","desolate","despair","despise","despite","destiny","destitute","destruct","detached","detail","detection","detective","detector","detention","detergent","detest","detonate","detonator","detoxify","detract","deuce","devalue","deviancy","deviant","deviate","deviation","deviator","device","devious","devotedly","devotee","devotion","devourer","devouring","devoutly","dexterity","dexterous","diabetes","diabetic","diabolic","diagnoses","diagnosis","diagram","dial","diameter","diaper","diaphragm","diary","dice","dicing","dictate","dictation","dictator","difficult","diffused","diffuser","diffusion","diffusive","dig","dilation","diligence","diligent","dill","dilute","dime","diminish","dimly","dimmed","dimmer","dimness","dimple","diner","dingbat","dinghy","dinginess","dingo","dingy","dining","dinner","diocese","dioxide","diploma","dipped","dipper","dipping","directed","direction","directive","directly","directory","direness","dirtiness","disabled","disagree","disallow","disarm","disarray","disaster","disband","disbelief","disburse","discard","discern","discharge","disclose","discolor","discount","discourse","discover","discuss","disdain","disengage","disfigure","disgrace","dish","disinfect","disjoin","disk","dislike","disliking","dislocate","dislodge","disloyal","dismantle","dismay","dismiss","dismount","disobey","disorder","disown","disparate","disparity","dispatch","dispense","dispersal","dispersed","disperser","displace","display","displease","disposal","dispose","disprove","dispute","disregard","disrupt","dissuade","distance","distant","distaste","distill","distinct","distort","distract","distress","district","distrust","ditch","ditto","ditzy","dividable","divided","dividend","dividers","dividing","divinely","diving","divinity","divisible","divisibly","division","divisive","divorcee","dizziness","dizzy","doable","docile","dock","doctrine","document","dodge","dodgy","doily","doing","dole","dollar","dollhouse","dollop","dolly","dolphin","domain","domelike","domestic","dominion","dominoes","donated","donation","donator","donor","donut","doodle","doorbell","doorframe","doorknob","doorman","doormat","doornail","doorpost","doorstep","doorstop","doorway","doozy","dork","dormitory","dorsal","dosage","dose","dotted","doubling","douche","dove","down","dowry","doze","drab","dragging","dragonfly","dragonish","dragster","drainable","drainage","drained","drainer","drainpipe","dramatic","dramatize","drank","drapery","drastic","draw","dreaded","dreadful","dreadlock","dreamboat","dreamily","dreamland","dreamless","dreamlike","dreamt","dreamy","drearily","dreary","drench","dress","drew","dribble","dried","drier","drift","driller","drilling","drinkable","drinking","dripping","drippy","drivable","driven","driver","driveway","driving","drizzle","drizzly","drone","drool","droop","drop-down","dropbox","dropkick","droplet","dropout","dropper","drove","drown","drowsily","drudge","drum","dry","dubbed","dubiously","duchess","duckbill","ducking","duckling","ducktail","ducky","duct","dude","duffel","dugout","duh","duke","duller","dullness","duly","dumping","dumpling","dumpster","duo","dupe","duplex","duplicate","duplicity","durable","durably","duration","duress","during","dusk","dust","dutiful","duty","duvet","dwarf","dweeb","dwelled","dweller","dwelling","dwindle","dwindling","dynamic","dynamite","dynasty","dyslexia","dyslexic","each","eagle","earache","eardrum","earflap","earful","earlobe","early","earmark","earmuff","earphone","earpiece","earplugs","earring","earshot","earthen","earthlike","earthling","earthly","earthworm","earthy","earwig","easeful","easel","easiest","easily","easiness","easing","eastbound","eastcoast","easter","eastward","eatable","eaten","eatery","eating","eats","ebay","ebony","ebook","ecard","eccentric","echo","eclair","eclipse","ecologist","ecology","economic","economist","economy","ecosphere","ecosystem","edge","edginess","edging","edgy","edition","editor","educated","education","educator","eel","effective","effects","efficient","effort","eggbeater","egging","eggnog","eggplant","eggshell","egomaniac","egotism","egotistic","either","eject","elaborate","elastic","elated","elbow","eldercare","elderly","eldest","electable","election","elective","elephant","elevate","elevating","elevation","elevator","eleven","elf","eligible","eligibly","eliminate","elite","elitism","elixir","elk","ellipse","elliptic","elm","elongated","elope","eloquence","eloquent","elsewhere","elude","elusive","elves","email","embargo","embark","embassy","embattled","embellish","ember","embezzle","emblaze","emblem","embody","embolism","emboss","embroider","emcee","emerald","emergency","emission","emit","emote","emoticon","emotion","empathic","empathy","emperor","emphases","emphasis","emphasize","emphatic","empirical","employed","employee","employer","emporium","empower","emptier","emptiness","empty","emu","enable","enactment","enamel","enchanted","enchilada","encircle","enclose","enclosure","encode","encore","encounter","encourage","encroach","encrust","encrypt","endanger","endeared","endearing","ended","ending","endless","endnote","endocrine","endorphin","endorse","endowment","endpoint","endurable","endurance","enduring","energetic","energize","energy","enforced","enforcer","engaged","engaging","engine","engorge","engraved","engraver","engraving","engross","engulf","enhance","enigmatic","enjoyable","enjoyably","enjoyer","enjoying","enjoyment","enlarged","enlarging","enlighten","enlisted","enquirer","enrage","enrich","enroll","enslave","ensnare","ensure","entail","entangled","entering","entertain","enticing","entire","entitle","entity","entomb","entourage","entrap","entree","entrench","entrust","entryway","entwine","enunciate","envelope","enviable","enviably","envious","envision","envoy","envy","enzyme","epic","epidemic","epidermal","epidermis","epidural","epilepsy","epileptic","epilogue","epiphany","episode","equal","equate","equation","equator","equinox","equipment","equity","equivocal","eradicate","erasable","erased","eraser","erasure","ergonomic","errand","errant","erratic","error","erupt","escalate","escalator","escapable","escapade","escapist","escargot","eskimo","esophagus","espionage","espresso","esquire","essay","essence","essential","establish","estate","esteemed","estimate","estimator","estranged","estrogen","etching","eternal","eternity","ethanol","ether","ethically","ethics","euphemism","evacuate","evacuee","evade","evaluate","evaluator","evaporate","evasion","evasive","even","everglade","evergreen","everybody","everyday","everyone","evict","evidence","evident","evil","evoke","evolution","evolve","exact","exalted","example","excavate","excavator","exceeding","exception","excess","exchange","excitable","exciting","exclaim","exclude","excluding","exclusion","exclusive","excretion","excretory","excursion","excusable","excusably","excuse","exemplary","exemplify","exemption","exerciser","exert","exes","exfoliate","exhale","exhaust","exhume","exile","existing","exit","exodus","exonerate","exorcism","exorcist","expand","expanse","expansion","expansive","expectant","expedited","expediter","expel","expend","expenses","expensive","expert","expire","expiring","explain","expletive","explicit","explode","exploit","explore","exploring","exponent","exporter","exposable","expose","exposure","express","expulsion","exquisite","extended","extending","extent","extenuate","exterior","external","extinct","extortion","extradite","extras","extrovert","extrude","extruding","exuberant","fable","fabric","fabulous","facebook","facecloth","facedown","faceless","facelift","faceplate","faceted","facial","facility","facing","facsimile","faction","factoid","factor","factsheet","factual","faculty","fade","fading","failing","falcon","fall","false","falsify","fame","familiar","family","famine","famished","fanatic","fancied","fanciness","fancy","fanfare","fang","fanning","fantasize","fantastic","fantasy","fascism","fastball","faster","fasting","fastness","faucet","favorable","favorably","favored","favoring","favorite","fax","feast","federal","fedora","feeble","feed","feel","feisty","feline","felt-tip","feminine","feminism","feminist","feminize","femur","fence","fencing","fender","ferment","fernlike","ferocious","ferocity","ferret","ferris","ferry","fervor","fester","festival","festive","festivity","fetal","fetch","fever","fiber","fiction","fiddle","fiddling","fidelity","fidgeting","fidgety","fifteen","fifth","fiftieth","fifty","figment","figure","figurine","filing","filled","filler","filling","film","filter","filth","filtrate","finale","finalist","finalize","finally","finance","financial","finch","fineness","finer","finicky","finished","finisher","finishing","finite","finless","finlike","fiscally","fit","five","flaccid","flagman","flagpole","flagship","flagstick","flagstone","flail","flakily","flaky","flame","flammable","flanked","flanking","flannels","flap","flaring","flashback","flashbulb","flashcard","flashily","flashing","flashy","flask","flatbed","flatfoot","flatly","flatness","flatten","flattered","flatterer","flattery","flattop","flatware","flatworm","flavored","flavorful","flavoring","flaxseed","fled","fleshed","fleshy","flick","flier","flight","flinch","fling","flint","flip","flirt","float","flock","flogging","flop","floral","florist","floss","flounder","flyable","flyaway","flyer","flying","flyover","flypaper","foam","foe","fog","foil","folic","folk","follicle","follow","fondling","fondly","fondness","fondue","font","food","fool","footage","football","footbath","footboard","footer","footgear","foothill","foothold","footing","footless","footman","footnote","footpad","footpath","footprint","footrest","footsie","footsore","footwear","footwork","fossil","foster","founder","founding","fountain","fox","foyer","fraction","fracture","fragile","fragility","fragment","fragrance","fragrant","frail","frame","framing","frantic","fraternal","frayed","fraying","frays","freckled","freckles","freebase","freebee","freebie","freedom","freefall","freehand","freeing","freeload","freely","freemason","freeness","freestyle","freeware","freeway","freewill","freezable","freezing","freight","french","frenzied","frenzy","frequency","frequent","fresh","fretful","fretted","friction","friday","fridge","fried","friend","frighten","frightful","frigidity","frigidly","frill","fringe","frisbee","frisk","fritter","frivolous","frolic","from","front","frostbite","frosted","frostily","frosting","frostlike","frosty","froth","frown","frozen","fructose","frugality","frugally","fruit","frustrate","frying","gab","gaffe","gag","gainfully","gaining","gains","gala","gallantly","galleria","gallery","galley","gallon","gallows","gallstone","galore","galvanize","gambling","game","gaming","gamma","gander","gangly","gangrene","gangway","gap","garage","garbage","garden","gargle","garland","garlic","garment","garnet","garnish","garter","gas","gatherer","gathering","gating","gauging","gauntlet","gauze","gave","gawk","gazing","gear","gecko","geek","geiger","gem","gender","generic","generous","genetics","genre","gentile","gentleman","gently","gents","geography","geologic","geologist","geology","geometric","geometry","geranium","gerbil","geriatric","germicide","germinate","germless","germproof","gestate","gestation","gesture","getaway","getting","getup","giant","gibberish","giblet","giddily","giddiness","giddy","gift","gigabyte","gigahertz","gigantic","giggle","giggling","giggly","gigolo","gilled","gills","gimmick","girdle","giveaway","given","giver","giving","gizmo","gizzard","glacial","glacier","glade","gladiator","gladly","glamorous","glamour","glance","glancing","glandular","glare","glaring","glass","glaucoma","glazing","gleaming","gleeful","glider","gliding","glimmer","glimpse","glisten","glitch","glitter","glitzy","gloater","gloating","gloomily","gloomy","glorified","glorifier","glorify","glorious","glory","gloss","glove","glowing","glowworm","glucose","glue","gluten","glutinous","glutton","gnarly","gnat","goal","goatskin","goes","goggles","going","goldfish","goldmine","goldsmith","golf","goliath","gonad","gondola","gone","gong","good","gooey","goofball","goofiness","goofy","google","goon","gopher","gore","gorged","gorgeous","gory","gosling","gossip","gothic","gotten","gout","gown","grab","graceful","graceless","gracious","gradation","graded","grader","gradient","grading","gradually","graduate","graffiti","grafted","grafting","grain","granddad","grandkid","grandly","grandma","grandpa","grandson","granite","granny","granola","grant","granular","grape","graph","grapple","grappling","grasp","grass","gratified","gratify","grating","gratitude","gratuity","gravel","graveness","graves","graveyard","gravitate","gravity","gravy","gray","grazing","greasily","greedily","greedless","greedy","green","greeter","greeting","grew","greyhound","grid","grief","grievance","grieving","grievous","grill","grimace","grimacing","grime","griminess","grimy","grinch","grinning","grip","gristle","grit","groggily","groggy","groin","groom","groove","grooving","groovy","grope","ground","grouped","grout","grove","grower","growing","growl","grub","grudge","grudging","grueling","gruffly","grumble","grumbling","grumbly","grumpily","grunge","grunt","guacamole","guidable","guidance","guide","guiding","guileless","guise","gulf","gullible","gully","gulp","gumball","gumdrop","gumminess","gumming","gummy","gurgle","gurgling","guru","gush","gusto","gusty","gutless","guts","gutter","guy","guzzler","gyration","habitable","habitant","habitat","habitual","hacked","hacker","hacking","hacksaw","had","haggler","haiku","half","halogen","halt","halved","halves","hamburger","hamlet","hammock","hamper","hamster","hamstring","handbag","handball","handbook","handbrake","handcart","handclap","handclasp","handcraft","handcuff","handed","handful","handgrip","handgun","handheld","handiness","handiwork","handlebar","handled","handler","handling","handmade","handoff","handpick","handprint","handrail","handsaw","handset","handsfree","handshake","handstand","handwash","handwork","handwoven","handwrite","handyman","hangnail","hangout","hangover","hangup","hankering","hankie","hanky","haphazard","happening","happier","happiest","happily","happiness","happy","harbor","hardcopy","hardcore","hardcover","harddisk","hardened","hardener","hardening","hardhat","hardhead","hardiness","hardly","hardness","hardship","hardware","hardwired","hardwood","hardy","harmful","harmless","harmonica","harmonics","harmonize","harmony","harness","harpist","harsh","harvest","hash","hassle","haste","hastily","hastiness","hasty","hatbox","hatchback","hatchery","hatchet","hatching","hatchling","hate","hatless","hatred","haunt","haven","hazard","hazelnut","hazily","haziness","hazing","hazy","headache","headband","headboard","headcount","headdress","headed","header","headfirst","headgear","heading","headlamp","headless","headlock","headphone","headpiece","headrest","headroom","headscarf","headset","headsman","headstand","headstone","headway","headwear","heap","heat","heave","heavily","heaviness","heaving","hedge","hedging","heftiness","hefty","helium","helmet","helper","helpful","helping","helpless","helpline","hemlock","hemstitch","hence","henchman","henna","herald","herbal","herbicide","herbs","heritage","hermit","heroics","heroism","herring","herself","hertz","hesitancy","hesitant","hesitate","hexagon","hexagram","hubcap","huddle","huddling","huff","hug","hula","hulk","hull","human","humble","humbling","humbly","humid","humiliate","humility","humming","hummus","humongous","humorist","humorless","humorous","humpback","humped","humvee","hunchback","hundredth","hunger","hungrily","hungry","hunk","hunter","hunting","huntress","huntsman","hurdle","hurled","hurler","hurling","hurray","hurricane","hurried","hurry","hurt","husband","hush","husked","huskiness","hut","hybrid","hydrant","hydrated","hydration","hydrogen","hydroxide","hyperlink","hypertext","hyphen","hypnoses","hypnosis","hypnotic","hypnotism","hypnotist","hypnotize","hypocrisy","hypocrite","ibuprofen","ice","iciness","icing","icky","icon","icy","idealism","idealist","idealize","ideally","idealness","identical","identify","identity","ideology","idiocy","idiom","idly","igloo","ignition","ignore","iguana","illicitly","illusion","illusive","image","imaginary","imagines","imaging","imbecile","imitate","imitation","immature","immerse","immersion","imminent","immobile","immodest","immorally","immortal","immovable","immovably","immunity","immunize","impaired","impale","impart","impatient","impeach","impeding","impending","imperfect","imperial","impish","implant","implement","implicate","implicit","implode","implosion","implosive","imply","impolite","important","importer","impose","imposing","impotence","impotency","impotent","impound","imprecise","imprint","imprison","impromptu","improper","improve","improving","improvise","imprudent","impulse","impulsive","impure","impurity","iodine","iodize","ion","ipad","iphone","ipod","irate","irk","iron","irregular","irrigate","irritable","irritably","irritant","irritate","islamic","islamist","isolated","isolating","isolation","isotope","issue","issuing","italicize","italics","item","itinerary","itunes","ivory","ivy","jab","jackal","jacket","jackknife","jackpot","jailbird","jailbreak","jailer","jailhouse","jalapeno","jam","janitor","january","jargon","jarring","jasmine","jaundice","jaunt","java","jawed","jawless","jawline","jaws","jaybird","jaywalker","jazz","jeep","jeeringly","jellied","jelly","jersey","jester","jet","jiffy","jigsaw","jimmy","jingle","jingling","jinx","jitters","jittery","job","jockey","jockstrap","jogger","jogging","john","joining","jokester","jokingly","jolliness","jolly","jolt","jot","jovial","joyfully","joylessly","joyous","joyride","joystick","jubilance","jubilant","judge","judgingly","judicial","judiciary","judo","juggle","juggling","jugular","juice","juiciness","juicy","jujitsu","jukebox","july","jumble","jumbo","jump","junction","juncture","june","junior","juniper","junkie","junkman","junkyard","jurist","juror","jury","justice","justifier","justify","justly","justness","juvenile","kabob","kangaroo","karaoke","karate","karma","kebab","keenly","keenness","keep","keg","kelp","kennel","kept","kerchief","kerosene","kettle","kick","kiln","kilobyte","kilogram","kilometer","kilowatt","kilt","kimono","kindle","kindling","kindly","kindness","kindred","kinetic","kinfolk","king","kinship","kinsman","kinswoman","kissable","kisser","kissing","kitchen","kite","kitten","kitty","kiwi","kleenex","knapsack","knee","knelt","knickers","knoll","koala","kooky","kosher","krypton","kudos","kung","labored","laborer","laboring","laborious","labrador","ladder","ladies","ladle","ladybug","ladylike","lagged","lagging","lagoon","lair","lake","lance","landed","landfall","landfill","landing","landlady","landless","landline","landlord","landmark","landmass","landmine","landowner","landscape","landside","landslide","language","lankiness","lanky","lantern","lapdog","lapel","lapped","lapping","laptop","lard","large","lark","lash","lasso","last","latch","late","lather","latitude","latrine","latter","latticed","launch","launder","laundry","laurel","lavender","lavish","laxative","lazily","laziness","lazy","lecturer","left","legacy","legal","legend","legged","leggings","legible","legibly","legislate","lego","legroom","legume","legwarmer","legwork","lemon","lend","length","lens","lent","leotard","lesser","letdown","lethargic","lethargy","letter","lettuce","level","leverage","levers","levitate","levitator","liability","liable","liberty","librarian","library","licking","licorice","lid","life","lifter","lifting","liftoff","ligament","likely","likeness","likewise","liking","lilac","lilly","lily","limb","limeade","limelight","limes","limit","limping","limpness","line","lingo","linguini","linguist","lining","linked","linoleum","linseed","lint","lion","lip","liquefy","liqueur","liquid","lisp","list","litigate","litigator","litmus","litter","little","livable","lived","lively","liver","livestock","lividly","living","lizard","lubricant","lubricate","lucid","luckily","luckiness","luckless","lucrative","ludicrous","lugged","lukewarm","lullaby","lumber","luminance","luminous","lumpiness","lumping","lumpish","lunacy","lunar","lunchbox","luncheon","lunchroom","lunchtime","lung","lurch","lure","luridness","lurk","lushly","lushness","luster","lustfully","lustily","lustiness","lustrous","lusty","luxurious","luxury","lying","lyrically","lyricism","lyricist","lyrics","macarena","macaroni","macaw","mace","machine","machinist","magazine","magenta","maggot","magical","magician","magma","magnesium","magnetic","magnetism","magnetize","magnifier","magnify","magnitude","magnolia","mahogany","maimed","majestic","majesty","majorette","majority","makeover","maker","makeshift","making","malformed","malt","mama","mammal","mammary","mammogram","manager","managing","manatee","mandarin","mandate","mandatory","mandolin","manger","mangle","mango","mangy","manhandle","manhole","manhood","manhunt","manicotti","manicure","manifesto","manila","mankind","manlike","manliness","manly","manmade","manned","mannish","manor","manpower","mantis","mantra","manual","many","map","marathon","marauding","marbled","marbles","marbling","march","mardi","margarine","margarita","margin","marigold","marina","marine","marital","maritime","marlin","marmalade","maroon","married","marrow","marry","marshland","marshy","marsupial","marvelous","marxism","mascot","masculine","mashed","mashing","massager","masses","massive","mastiff","matador","matchbook","matchbox","matcher","matching","matchless","material","maternal","maternity","math","mating","matriarch","matrimony","matrix","matron","matted","matter","maturely","maturing","maturity","mauve","maverick","maximize","maximum","maybe","mayday","mayflower","moaner","moaning","mobile","mobility","mobilize","mobster","mocha","mocker","mockup","modified","modify","modular","modulator","module","moisten","moistness","moisture","molar","molasses","mold","molecular","molecule","molehill","mollusk","mom","monastery","monday","monetary","monetize","moneybags","moneyless","moneywise","mongoose","mongrel","monitor","monkhood","monogamy","monogram","monologue","monopoly","monorail","monotone","monotype","monoxide","monsieur","monsoon","monstrous","monthly","monument","moocher","moodiness","moody","mooing","moonbeam","mooned","moonlight","moonlike","moonlit","moonrise","moonscape","moonshine","moonstone","moonwalk","mop","morale","morality","morally","morbidity","morbidly","morphine","morphing","morse","mortality","mortally","mortician","mortified","mortify","mortuary","mosaic","mossy","most","mothball","mothproof","motion","motivate","motivator","motive","motocross","motor","motto","mountable","mountain","mounted","mounting","mourner","mournful","mouse","mousiness","moustache","mousy","mouth","movable","move","movie","moving","mower","mowing","much","muck","mud","mug","mulberry","mulch","mule","mulled","mullets","multiple","multiply","multitask","multitude","mumble","mumbling","mumbo","mummified","mummify","mummy","mumps","munchkin","mundane","municipal","muppet","mural","murkiness","murky","murmuring","muscular","museum","mushily","mushiness","mushroom","mushy","music","musket","muskiness","musky","mustang","mustard","muster","mustiness","musty","mutable","mutate","mutation","mute","mutilated","mutilator","mutiny","mutt","mutual","muzzle","myself","myspace","mystified","mystify","myth","nacho","nag","nail","name","naming","nanny","nanometer","nape","napkin","napped","napping","nappy","narrow","nastily","nastiness","national","native","nativity","natural","nature","naturist","nautical","navigate","navigator","navy","nearby","nearest","nearly","nearness","neatly","neatness","nebula","nebulizer","nectar","negate","negation","negative","neglector","negligee","negligent","negotiate","nemeses","nemesis","neon","nephew","nerd","nervous","nervy","nest","net","neurology","neuron","neurosis","neurotic","neuter","neutron","never","next","nibble","nickname","nicotine","niece","nifty","nimble","nimbly","nineteen","ninetieth","ninja","nintendo","ninth","nuclear","nuclei","nucleus","nugget","nullify","number","numbing","numbly","numbness","numeral","numerate","numerator","numeric","numerous","nuptials","nursery","nursing","nurture","nutcase","nutlike","nutmeg","nutrient","nutshell","nuttiness","nutty","nuzzle","nylon","oaf","oak","oasis","oat","obedience","obedient","obituary","object","obligate","obliged","oblivion","oblivious","oblong","obnoxious","oboe","obscure","obscurity","observant","observer","observing","obsessed","obsession","obsessive","obsolete","obstacle","obstinate","obstruct","obtain","obtrusive","obtuse","obvious","occultist","occupancy","occupant","occupier","occupy","ocean","ocelot","octagon","octane","october","octopus","ogle","oil","oink","ointment","okay","old","olive","olympics","omega","omen","ominous","omission","omit","omnivore","onboard","oncoming","ongoing","onion","online","onlooker","only","onscreen","onset","onshore","onslaught","onstage","onto","onward","onyx","oops","ooze","oozy","opacity","opal","open","operable","operate","operating","operation","operative","operator","opium","opossum","opponent","oppose","opposing","opposite","oppressed","oppressor","opt","opulently","osmosis","other","otter","ouch","ought","ounce","outage","outback","outbid","outboard","outbound","outbreak","outburst","outcast","outclass","outcome","outdated","outdoors","outer","outfield","outfit","outflank","outgoing","outgrow","outhouse","outing","outlast","outlet","outline","outlook","outlying","outmatch","outmost","outnumber","outplayed","outpost","outpour","output","outrage","outrank","outreach","outright","outscore","outsell","outshine","outshoot","outsider","outskirts","outsmart","outsource","outspoken","outtakes","outthink","outward","outweigh","outwit","oval","ovary","oven","overact","overall","overarch","overbid","overbill","overbite","overblown","overboard","overbook","overbuilt","overcast","overcoat","overcome","overcook","overcrowd","overdraft","overdrawn","overdress","overdrive","overdue","overeager","overeater","overexert","overfed","overfeed","overfill","overflow","overfull","overgrown","overhand","overhang","overhaul","overhead","overhear","overheat","overhung","overjoyed","overkill","overlabor","overlaid","overlap","overlay","overload","overlook","overlord","overlying","overnight","overpass","overpay","overplant","overplay","overpower","overprice","overrate","overreach","overreact","override","overripe","overrule","overrun","overshoot","overshot","oversight","oversized","oversleep","oversold","overspend","overstate","overstay","overstep","overstock","overstuff","oversweet","overtake","overthrow","overtime","overtly","overtone","overture","overturn","overuse","overvalue","overview","overwrite","owl","oxford","oxidant","oxidation","oxidize","oxidizing","oxygen","oxymoron","oyster","ozone","paced","pacemaker","pacific","pacifier","pacifism","pacifist","pacify","padded","padding","paddle","paddling","padlock","pagan","pager","paging","pajamas","palace","palatable","palm","palpable","palpitate","paltry","pampered","pamperer","pampers","pamphlet","panama","pancake","pancreas","panda","pandemic","pang","panhandle","panic","panning","panorama","panoramic","panther","pantomime","pantry","pants","pantyhose","paparazzi","papaya","paper","paprika","papyrus","parabola","parachute","parade","paradox","paragraph","parakeet","paralegal","paralyses","paralysis","paralyze","paramedic","parameter","paramount","parasail","parasite","parasitic","parcel","parched","parchment","pardon","parish","parka","parking","parkway","parlor","parmesan","parole","parrot","parsley","parsnip","partake","parted","parting","partition","partly","partner","partridge","party","passable","passably","passage","passcode","passenger","passerby","passing","passion","passive","passivism","passover","passport","password","pasta","pasted","pastel","pastime","pastor","pastrami","pasture","pasty","patchwork","patchy","paternal","paternity","path","patience","patient","patio","patriarch","patriot","patrol","patronage","patronize","pauper","pavement","paver","pavestone","pavilion","paving","pawing","payable","payback","paycheck","payday","payee","payer","paying","payment","payphone","payroll","pebble","pebbly","pecan","pectin","peculiar","peddling","pediatric","pedicure","pedigree","pedometer","pegboard","pelican","pellet","pelt","pelvis","penalize","penalty","pencil","pendant","pending","penholder","penknife","pennant","penniless","penny","penpal","pension","pentagon","pentagram","pep","perceive","percent","perch","percolate","perennial","perfected","perfectly","perfume","periscope","perish","perjurer","perjury","perkiness","perky","perm","peroxide","perpetual","perplexed","persecute","persevere","persuaded","persuader","pesky","peso","pessimism","pessimist","pester","pesticide","petal","petite","petition","petri","petroleum","petted","petticoat","pettiness","petty","petunia","phantom","phobia","phoenix","phonebook","phoney","phonics","phoniness","phony","phosphate","photo","phrase","phrasing","placard","placate","placidly","plank","planner","plant","plasma","plaster","plastic","plated","platform","plating","platinum","platonic","platter","platypus","plausible","plausibly","playable","playback","player","playful","playgroup","playhouse","playing","playlist","playmaker","playmate","playoff","playpen","playroom","playset","plaything","playtime","plaza","pleading","pleat","pledge","plentiful","plenty","plethora","plexiglas","pliable","plod","plop","plot","plow","ploy","pluck","plug","plunder","plunging","plural","plus","plutonium","plywood","poach","pod","poem","poet","pogo","pointed","pointer","pointing","pointless","pointy","poise","poison","poker","poking","polar","police","policy","polio","polish","politely","polka","polo","polyester","polygon","polygraph","polymer","poncho","pond","pony","popcorn","pope","poplar","popper","poppy","popsicle","populace","popular","populate","porcupine","pork","porous","porridge","portable","portal","portfolio","porthole","portion","portly","portside","poser","posh","posing","possible","possibly","possum","postage","postal","postbox","postcard","posted","poster","posting","postnasal","posture","postwar","pouch","pounce","pouncing","pound","pouring","pout","powdered","powdering","powdery","power","powwow","pox","praising","prance","prancing","pranker","prankish","prankster","prayer","praying","preacher","preaching","preachy","preamble","precinct","precise","precision","precook","precut","predator","predefine","predict","preface","prefix","preflight","preformed","pregame","pregnancy","pregnant","preheated","prelaunch","prelaw","prelude","premiere","premises","premium","prenatal","preoccupy","preorder","prepaid","prepay","preplan","preppy","preschool","prescribe","preseason","preset","preshow","president","presoak","press","presume","presuming","preteen","pretended","pretender","pretense","pretext","pretty","pretzel","prevail","prevalent","prevent","preview","previous","prewar","prewashed","prideful","pried","primal","primarily","primary","primate","primer","primp","princess","print","prior","prism","prison","prissy","pristine","privacy","private","privatize","prize","proactive","probable","probably","probation","probe","probing","probiotic","problem","procedure","process","proclaim","procreate","procurer","prodigal","prodigy","produce","product","profane","profanity","professed","professor","profile","profound","profusely","progeny","prognosis","program","progress","projector","prologue","prolonged","promenade","prominent","promoter","promotion","prompter","promptly","prone","prong","pronounce","pronto","proofing","proofread","proofs","propeller","properly","property","proponent","proposal","propose","props","prorate","protector","protegee","proton","prototype","protozoan","protract","protrude","proud","provable","proved","proven","provided","provider","providing","province","proving","provoke","provoking","provolone","prowess","prowler","prowling","proximity","proxy","prozac","prude","prudishly","prune","pruning","pry","psychic","public","publisher","pucker","pueblo","pug","pull","pulmonary","pulp","pulsate","pulse","pulverize","puma","pumice","pummel","punch","punctual","punctuate","punctured","pungent","punisher","punk","pupil","puppet","puppy","purchase","pureblood","purebred","purely","pureness","purgatory","purge","purging","purifier","purify","purist","puritan","purity","purple","purplish","purposely","purr","purse","pursuable","pursuant","pursuit","purveyor","pushcart","pushchair","pusher","pushiness","pushing","pushover","pushpin","pushup","pushy","putdown","putt","puzzle","puzzling","pyramid","pyromania","python","quack","quadrant","quail","quaintly","quake","quaking","qualified","qualifier","qualify","quality","qualm","quantum","quarrel","quarry","quartered","quarterly","quarters","quartet","quench","query","quicken","quickly","quickness","quicksand","quickstep","quiet","quill","quilt","quintet","quintuple","quirk","quit","quiver","quizzical","quotable","quotation","quote","rabid","race","racing","racism","rack","racoon","radar","radial","radiance","radiantly","radiated","radiation","radiator","radio","radish","raffle","raft","rage","ragged","raging","ragweed","raider","railcar","railing","railroad","railway","raisin","rake","raking","rally","ramble","rambling","ramp","ramrod","ranch","rancidity","random","ranged","ranger","ranging","ranked","ranking","ransack","ranting","rants","rare","rarity","rascal","rash","rasping","ravage","raven","ravine","raving","ravioli","ravishing","reabsorb","reach","reacquire","reaction","reactive","reactor","reaffirm","ream","reanalyze","reappear","reapply","reappoint","reapprove","rearrange","rearview","reason","reassign","reassure","reattach","reawake","rebalance","rebate","rebel","rebirth","reboot","reborn","rebound","rebuff","rebuild","rebuilt","reburial","rebuttal","recall","recant","recapture","recast","recede","recent","recess","recharger","recipient","recital","recite","reckless","reclaim","recliner","reclining","recluse","reclusive","recognize","recoil","recollect","recolor","reconcile","reconfirm","reconvene","recopy","record","recount","recoup","recovery","recreate","rectal","rectangle","rectified","rectify","recycled","recycler","recycling","reemerge","reenact","reenter","reentry","reexamine","referable","referee","reference","refill","refinance","refined","refinery","refining","refinish","reflected","reflector","reflex","reflux","refocus","refold","reforest","reformat","reformed","reformer","reformist","refract","refrain","refreeze","refresh","refried","refueling","refund","refurbish","refurnish","refusal","refuse","refusing","refutable","refute","regain","regalia","regally","reggae","regime","region","register","registrar","registry","regress","regretful","regroup","regular","regulate","regulator","rehab","reheat","rehire","rehydrate","reimburse","reissue","reiterate","rejoice","rejoicing","rejoin","rekindle","relapse","relapsing","relatable","related","relation","relative","relax","relay","relearn","release","relenting","reliable","reliably","reliance","reliant","relic","relieve","relieving","relight","relish","relive","reload","relocate","relock","reluctant","rely","remake","remark","remarry","rematch","remedial","remedy","remember","reminder","remindful","remission","remix","remnant","remodeler","remold","remorse","remote","removable","removal","removed","remover","removing","rename","renderer","rendering","rendition","renegade","renewable","renewably","renewal","renewed","renounce","renovate","renovator","rentable","rental","rented","renter","reoccupy","reoccur","reopen","reorder","repackage","repacking","repaint","repair","repave","repaying","repayment","repeal","repeated","repeater","repent","rephrase","replace","replay","replica","reply","reporter","repose","repossess","repost","repressed","reprimand","reprint","reprise","reproach","reprocess","reproduce","reprogram","reps","reptile","reptilian","repugnant","repulsion","repulsive","repurpose","reputable","reputably","request","require","requisite","reroute","rerun","resale","resample","rescuer","reseal","research","reselect","reseller","resemble","resend","resent","reset","reshape","reshoot","reshuffle","residence","residency","resident","residual","residue","resigned","resilient","resistant","resisting","resize","resolute","resolved","resonant","resonate","resort","resource","respect","resubmit","result","resume","resupply","resurface","resurrect","retail","retainer","retaining","retake","retaliate","retention","rethink","retinal","retired","retiree","retiring","retold","retool","retorted","retouch","retrace","retract","retrain","retread","retreat","retrial","retrieval","retriever","retry","return","retying","retype","reunion","reunite","reusable","reuse","reveal","reveler","revenge","revenue","reverb","revered","reverence","reverend","reversal","reverse","reversing","reversion","revert","revisable","revise","revision","revisit","revivable","revival","reviver","reviving","revocable","revoke","revolt","revolver","revolving","reward","rewash","rewind","rewire","reword","rework","rewrap","rewrite","rhyme","ribbon","ribcage","rice","riches","richly","richness","rickety","ricotta","riddance","ridden","ride","riding","rifling","rift","rigging","rigid","rigor","rimless","rimmed","rind","rink","rinse","rinsing","riot","ripcord","ripeness","ripening","ripping","ripple","rippling","riptide","rise","rising","risk","risotto","ritalin","ritzy","rival","riverbank","riverbed","riverboat","riverside","riveter","riveting","roamer","roaming","roast","robbing","robe","robin","robotics","robust","rockband","rocker","rocket","rockfish","rockiness","rocking","rocklike","rockslide","rockstar","rocky","rogue","roman","romp","rope","roping","roster","rosy","rotten","rotting","rotunda","roulette","rounding","roundish","roundness","roundup","roundworm","routine","routing","rover","roving","royal","rubbed","rubber","rubbing","rubble","rubdown","ruby","ruckus","rudder","rug","ruined","rule","rumble","rumbling","rummage","rumor","runaround","rundown","runner","running","runny","runt","runway","rupture","rural","ruse","rush","rust","rut","sabbath","sabotage","sacrament","sacred","sacrifice","sadden","saddlebag","saddled","saddling","sadly","sadness","safari","safeguard","safehouse","safely","safeness","saffron","saga","sage","sagging","saggy","said","saint","sake","salad","salami","salaried","salary","saline","salon","saloon","salsa","salt","salutary","salute","salvage","salvaging","salvation","same","sample","sampling","sanction","sanctity","sanctuary","sandal","sandbag","sandbank","sandbar","sandblast","sandbox","sanded","sandfish","sanding","sandlot","sandpaper","sandpit","sandstone","sandstorm","sandworm","sandy","sanitary","sanitizer","sank","santa","sapling","sappiness","sappy","sarcasm","sarcastic","sardine","sash","sasquatch","sassy","satchel","satiable","satin","satirical","satisfied","satisfy","saturate","saturday","sauciness","saucy","sauna","savage","savanna","saved","savings","savior","savor","saxophone","say","scabbed","scabby","scalded","scalding","scale","scaling","scallion","scallop","scalping","scam","scandal","scanner","scanning","scant","scapegoat","scarce","scarcity","scarecrow","scared","scarf","scarily","scariness","scarring","scary","scavenger","scenic","schedule","schematic","scheme","scheming","schilling","schnapps","scholar","science","scientist","scion","scoff","scolding","scone","scoop","scooter","scope","scorch","scorebook","scorecard","scored","scoreless","scorer","scoring","scorn","scorpion","scotch","scoundrel","scoured","scouring","scouting","scouts","scowling","scrabble","scraggly","scrambled","scrambler","scrap","scratch","scrawny","screen","scribble","scribe","scribing","scrimmage","script","scroll","scrooge","scrounger","scrubbed","scrubber","scruffy","scrunch","scrutiny","scuba","scuff","sculptor","sculpture","scurvy","scuttle","secluded","secluding","seclusion","second","secrecy","secret","sectional","sector","secular","securely","security","sedan","sedate","sedation","sedative","sediment","seduce","seducing","segment","seismic","seizing","seldom","selected","selection","selective","selector","self","seltzer","semantic","semester","semicolon","semifinal","seminar","semisoft","semisweet","senate","senator","send","senior","senorita","sensation","sensitive","sensitize","sensually","sensuous","sepia","september","septic","septum","sequel","sequence","sequester","series","sermon","serotonin","serpent","serrated","serve","service","serving","sesame","sessions","setback","setting","settle","settling","setup","sevenfold","seventeen","seventh","seventy","severity","shabby","shack","shaded","shadily","shadiness","shading","shadow","shady","shaft","shakable","shakily","shakiness","shaking","shaky","shale","shallot","shallow","shame","shampoo","shamrock","shank","shanty","shape","shaping","share","sharpener","sharper","sharpie","sharply","sharpness","shawl","sheath","shed","sheep","sheet","shelf","shell","shelter","shelve","shelving","sherry","shield","shifter","shifting","shiftless","shifty","shimmer","shimmy","shindig","shine","shingle","shininess","shining","shiny","ship","shirt","shivering","shock","shone","shoplift","shopper","shopping","shoptalk","shore","shortage","shortcake","shortcut","shorten","shorter","shorthand","shortlist","shortly","shortness","shorts","shortwave","shorty","shout","shove","showbiz","showcase","showdown","shower","showgirl","showing","showman","shown","showoff","showpiece","showplace","showroom","showy","shrank","shrapnel","shredder","shredding","shrewdly","shriek","shrill","shrimp","shrine","shrink","shrivel","shrouded","shrubbery","shrubs","shrug","shrunk","shucking","shudder","shuffle","shuffling","shun","shush","shut","shy","siamese","siberian","sibling","siding","sierra","siesta","sift","sighing","silenced","silencer","silent","silica","silicon","silk","silliness","silly","silo","silt","silver","similarly","simile","simmering","simple","simplify","simply","sincere","sincerity","singer","singing","single","singular","sinister","sinless","sinner","sinuous","sip","siren","sister","sitcom","sitter","sitting","situated","situation","sixfold","sixteen","sixth","sixties","sixtieth","sixtyfold","sizable","sizably","size","sizing","sizzle","sizzling","skater","skating","skedaddle","skeletal","skeleton","skeptic","sketch","skewed","skewer","skid","skied","skier","skies","skiing","skilled","skillet","skillful","skimmed","skimmer","skimming","skimpily","skincare","skinhead","skinless","skinning","skinny","skintight","skipper","skipping","skirmish","skirt","skittle","skydiver","skylight","skyline","skype","skyrocket","skyward","slab","slacked","slacker","slacking","slackness","slacks","slain","slam","slander","slang","slapping","slapstick","slashed","slashing","slate","slather","slaw","sled","sleek","sleep","sleet","sleeve","slept","sliceable","sliced","slicer","slicing","slick","slider","slideshow","sliding","slighted","slighting","slightly","slimness","slimy","slinging","slingshot","slinky","slip","slit","sliver","slobbery","slogan","sloped","sloping","sloppily","sloppy","slot","slouching","slouchy","sludge","slug","slum","slurp","slush","sly","small","smartly","smartness","smasher","smashing","smashup","smell","smelting","smile","smilingly","smirk","smite","smith","smitten","smock","smog","smoked","smokeless","smokiness","smoking","smoky","smolder","smooth","smother","smudge","smudgy","smuggler","smuggling","smugly","smugness","snack","snagged","snaking","snap","snare","snarl","snazzy","sneak","sneer","sneeze","sneezing","snide","sniff","snippet","snipping","snitch","snooper","snooze","snore","snoring","snorkel","snort","snout","snowbird","snowboard","snowbound","snowcap","snowdrift","snowdrop","snowfall","snowfield","snowflake","snowiness","snowless","snowman","snowplow","snowshoe","snowstorm","snowsuit","snowy","snub","snuff","snuggle","snugly","snugness","speak","spearfish","spearhead","spearman","spearmint","species","specimen","specked","speckled","specks","spectacle","spectator","spectrum","speculate","speech","speed","spellbind","speller","spelling","spendable","spender","spending","spent","spew","sphere","spherical","sphinx","spider","spied","spiffy","spill","spilt","spinach","spinal","spindle","spinner","spinning","spinout","spinster","spiny","spiral","spirited","spiritism","spirits","spiritual","splashed","splashing","splashy","splatter","spleen","splendid","splendor","splice","splicing","splinter","splotchy","splurge","spoilage","spoiled","spoiler","spoiling","spoils","spoken","spokesman","sponge","spongy","sponsor","spoof","spookily","spooky","spool","spoon","spore","sporting","sports","sporty","spotless","spotlight","spotted","spotter","spotting","spotty","spousal","spouse","spout","sprain","sprang","sprawl","spray","spree","sprig","spring","sprinkled","sprinkler","sprint","sprite","sprout","spruce","sprung","spry","spud","spur","sputter","spyglass","squabble","squad","squall","squander","squash","squatted","squatter","squatting","squeak","squealer","squealing","squeamish","squeegee","squeeze","squeezing","squid","squiggle","squiggly","squint","squire","squirt","squishier","squishy","stability","stabilize","stable","stack","stadium","staff","stage","staging","stagnant","stagnate","stainable","stained","staining","stainless","stalemate","staleness","stalling","stallion","stamina","stammer","stamp","stand","stank","staple","stapling","starboard","starch","stardom","stardust","starfish","stargazer","staring","stark","starless","starlet","starlight","starlit","starring","starry","starship","starter","starting","startle","startling","startup","starved","starving","stash","state","static","statistic","statue","stature","status","statute","statutory","staunch","stays","steadfast","steadier","steadily","steadying","steam","steed","steep","steerable","steering","steersman","stegosaur","stellar","stem","stench","stencil","step","stereo","sterile","sterility","sterilize","sterling","sternness","sternum","stew","stick","stiffen","stiffly","stiffness","stifle","stifling","stillness","stilt","stimulant","stimulate","stimuli","stimulus","stinger","stingily","stinging","stingray","stingy","stinking","stinky","stipend","stipulate","stir","stitch","stock","stoic","stoke","stole","stomp","stonewall","stoneware","stonework","stoning","stony","stood","stooge","stool","stoop","stoplight","stoppable","stoppage","stopped","stopper","stopping","stopwatch","storable","storage","storeroom","storewide","storm","stout","stove","stowaway","stowing","straddle","straggler","strained","strainer","straining","strangely","stranger","strangle","strategic","strategy","stratus","straw","stray","streak","stream","street","strength","strenuous","strep","stress","stretch","strewn","stricken","strict","stride","strife","strike","striking","strive","striving","strobe","strode","stroller","strongbox","strongly","strongman","struck","structure","strudel","struggle","strum","strung","strut","stubbed","stubble","stubbly","stubborn","stucco","stuck","student","studied","studio","study","stuffed","stuffing","stuffy","stumble","stumbling","stump","stung","stunned","stunner","stunning","stunt","stupor","sturdily","sturdy","styling","stylishly","stylist","stylized","stylus","suave","subarctic","subatomic","subdivide","subdued","subduing","subfloor","subgroup","subheader","subject","sublease","sublet","sublevel","sublime","submarine","submerge","submersed","submitter","subpanel","subpar","subplot","subprime","subscribe","subscript","subsector","subside","subsiding","subsidize","subsidy","subsoil","subsonic","substance","subsystem","subtext","subtitle","subtly","subtotal","subtract","subtype","suburb","subway","subwoofer","subzero","succulent","such","suction","sudden","sudoku","suds","sufferer","suffering","suffice","suffix","suffocate","suffrage","sugar","suggest","suing","suitable","suitably","suitcase","suitor","sulfate","sulfide","sulfite","sulfur","sulk","sullen","sulphate","sulphuric","sultry","superbowl","superglue","superhero","superior","superjet","superman","supermom","supernova","supervise","supper","supplier","supply","support","supremacy","supreme","surcharge","surely","sureness","surface","surfacing","surfboard","surfer","surgery","surgical","surging","surname","surpass","surplus","surprise","surreal","surrender","surrogate","surround","survey","survival","survive","surviving","survivor","sushi","suspect","suspend","suspense","sustained","sustainer","swab","swaddling","swagger","swampland","swan","swapping","swarm","sway","swear","sweat","sweep","swell","swept","swerve","swifter","swiftly","swiftness","swimmable","swimmer","swimming","swimsuit","swimwear","swinger","swinging","swipe","swirl","switch","swivel","swizzle","swooned","swoop","swoosh","swore","sworn","swung","sycamore","sympathy","symphonic","symphony","symptom","synapse","syndrome","synergy","synopses","synopsis","synthesis","synthetic","syrup","system","t-shirt","tabasco","tabby","tableful","tables","tablet","tableware","tabloid","tackiness","tacking","tackle","tackling","tacky","taco","tactful","tactical","tactics","tactile","tactless","tadpole","taekwondo","tag","tainted","take","taking","talcum","talisman","tall","talon","tamale","tameness","tamer","tamper","tank","tanned","tannery","tanning","tantrum","tapeless","tapered","tapering","tapestry","tapioca","tapping","taps","tarantula","target","tarmac","tarnish","tarot","tartar","tartly","tartness","task","tassel","taste","tastiness","tasting","tasty","tattered","tattle","tattling","tattoo","taunt","tavern","thank","that","thaw","theater","theatrics","thee","theft","theme","theology","theorize","thermal","thermos","thesaurus","these","thesis","thespian","thicken","thicket","thickness","thieving","thievish","thigh","thimble","thing","think","thinly","thinner","thinness","thinning","thirstily","thirsting","thirsty","thirteen","thirty","thong","thorn","those","thousand","thrash","thread","threaten","threefold","thrift","thrill","thrive","thriving","throat","throbbing","throng","throttle","throwaway","throwback","thrower","throwing","thud","thumb","thumping","thursday","thus","thwarting","thyself","tiara","tibia","tidal","tidbit","tidiness","tidings","tidy","tiger","tighten","tightly","tightness","tightrope","tightwad","tigress","tile","tiling","till","tilt","timid","timing","timothy","tinderbox","tinfoil","tingle","tingling","tingly","tinker","tinkling","tinsel","tinsmith","tint","tinwork","tiny","tipoff","tipped","tipper","tipping","tiptoeing","tiptop","tiring","tissue","trace","tracing","track","traction","tractor","trade","trading","tradition","traffic","tragedy","trailing","trailside","train","traitor","trance","tranquil","transfer","transform","translate","transpire","transport","transpose","trapdoor","trapeze","trapezoid","trapped","trapper","trapping","traps","trash","travel","traverse","travesty","tray","treachery","treading","treadmill","treason","treat","treble","tree","trekker","tremble","trembling","tremor","trench","trend","trespass","triage","trial","triangle","tribesman","tribunal","tribune","tributary","tribute","triceps","trickery","trickily","tricking","trickle","trickster","tricky","tricolor","tricycle","trident","tried","trifle","trifocals","trillion","trilogy","trimester","trimmer","trimming","trimness","trinity","trio","tripod","tripping","triumph","trivial","trodden","trolling","trombone","trophy","tropical","tropics","trouble","troubling","trough","trousers","trout","trowel","truce","truck","truffle","trump","trunks","trustable","trustee","trustful","trusting","trustless","truth","try","tubby","tubeless","tubular","tucking","tuesday","tug","tuition","tulip","tumble","tumbling","tummy","turban","turbine","turbofan","turbojet","turbulent","turf","turkey","turmoil","turret","turtle","tusk","tutor","tutu","tux","tweak","tweed","tweet","tweezers","twelve","twentieth","twenty","twerp","twice","twiddle","twiddling","twig","twilight","twine","twins","twirl","twistable","twisted","twister","twisting","twisty","twitch","twitter","tycoon","tying","tyke","udder","ultimate","ultimatum","ultra","umbilical","umbrella","umpire","unabashed","unable","unadorned","unadvised","unafraid","unaired","unaligned","unaltered","unarmored","unashamed","unaudited","unawake","unaware","unbaked","unbalance","unbeaten","unbend","unbent","unbiased","unbitten","unblended","unblessed","unblock","unbolted","unbounded","unboxed","unbraided","unbridle","unbroken","unbuckled","unbundle","unburned","unbutton","uncanny","uncapped","uncaring","uncertain","unchain","unchanged","uncharted","uncheck","uncivil","unclad","unclaimed","unclamped","unclasp","uncle","unclip","uncloak","unclog","unclothed","uncoated","uncoiled","uncolored","uncombed","uncommon","uncooked","uncork","uncorrupt","uncounted","uncouple","uncouth","uncover","uncross","uncrown","uncrushed","uncured","uncurious","uncurled","uncut","undamaged","undated","undaunted","undead","undecided","undefined","underage","underarm","undercoat","undercook","undercut","underdog","underdone","underfed","underfeed","underfoot","undergo","undergrad","underhand","underline","underling","undermine","undermost","underpaid","underpass","underpay","underrate","undertake","undertone","undertook","undertow","underuse","underwear","underwent","underwire","undesired","undiluted","undivided","undocked","undoing","undone","undrafted","undress","undrilled","undusted","undying","unearned","unearth","unease","uneasily","uneasy","uneatable","uneaten","unedited","unelected","unending","unengaged","unenvied","unequal","unethical","uneven","unexpired","unexposed","unfailing","unfair","unfasten","unfazed","unfeeling","unfiled","unfilled","unfitted","unfitting","unfixable","unfixed","unflawed","unfocused","unfold","unfounded","unframed","unfreeze","unfrosted","unfrozen","unfunded","unglazed","ungloved","unglue","ungodly","ungraded","ungreased","unguarded","unguided","unhappily","unhappy","unharmed","unhealthy","unheard","unhearing","unheated","unhelpful","unhidden","unhinge","unhitched","unholy","unhook","unicorn","unicycle","unified","unifier","uniformed","uniformly","unify","unimpeded","uninjured","uninstall","uninsured","uninvited","union","uniquely","unisexual","unison","unissued","unit","universal","universe","unjustly","unkempt","unkind","unknotted","unknowing","unknown","unlaced","unlatch","unlawful","unleaded","unlearned","unleash","unless","unleveled","unlighted","unlikable","unlimited","unlined","unlinked","unlisted","unlit","unlivable","unloaded","unloader","unlocked","unlocking","unlovable","unloved","unlovely","unloving","unluckily","unlucky","unmade","unmanaged","unmanned","unmapped","unmarked","unmasked","unmasking","unmatched","unmindful","unmixable","unmixed","unmolded","unmoral","unmovable","unmoved","unmoving","unnamable","unnamed","unnatural","unneeded","unnerve","unnerving","unnoticed","unopened","unopposed","unpack","unpadded","unpaid","unpainted","unpaired","unpaved","unpeeled","unpicked","unpiloted","unpinned","unplanned","unplanted","unpleased","unpledged","unplowed","unplug","unpopular","unproven","unquote","unranked","unrated","unraveled","unreached","unread","unreal","unreeling","unrefined","unrelated","unrented","unrest","unretired","unrevised","unrigged","unripe","unrivaled","unroasted","unrobed","unroll","unruffled","unruly","unrushed","unsaddle","unsafe","unsaid","unsalted","unsaved","unsavory","unscathed","unscented","unscrew","unsealed","unseated","unsecured","unseeing","unseemly","unseen","unselect","unselfish","unsent","unsettled","unshackle","unshaken","unshaved","unshaven","unsheathe","unshipped","unsightly","unsigned","unskilled","unsliced","unsmooth","unsnap","unsocial","unsoiled","unsold","unsolved","unsorted","unspoiled","unspoken","unstable","unstaffed","unstamped","unsteady","unsterile","unstirred","unstitch","unstopped","unstuck","unstuffed","unstylish","unsubtle","unsubtly","unsuited","unsure","unsworn","untagged","untainted","untaken","untamed","untangled","untapped","untaxed","unthawed","unthread","untidy","untie","until","untimed","untimely","untitled","untoasted","untold","untouched","untracked","untrained","untreated","untried","untrimmed","untrue","untruth","unturned","untwist","untying","unusable","unused","unusual","unvalued","unvaried","unvarying","unveiled","unveiling","unvented","unviable","unvisited","unvocal","unwanted","unwarlike","unwary","unwashed","unwatched","unweave","unwed","unwelcome","unwell","unwieldy","unwilling","unwind","unwired","unwitting","unwomanly","unworldly","unworn","unworried","unworthy","unwound","unwoven","unwrapped","unwritten","unzip","upbeat","upchuck","upcoming","upcountry","update","upfront","upgrade","upheaval","upheld","uphill","uphold","uplifted","uplifting","upload","upon","upper","upright","uprising","upriver","uproar","uproot","upscale","upside","upstage","upstairs","upstart","upstate","upstream","upstroke","upswing","uptake","uptight","uptown","upturned","upward","upwind","uranium","urban","urchin","urethane","urgency","urgent","urging","urologist","urology","usable","usage","useable","used","uselessly","user","usher","usual","utensil","utility","utilize","utmost","utopia","utter","vacancy","vacant","vacate","vacation","vagabond","vagrancy","vagrantly","vaguely","vagueness","valiant","valid","valium","valley","valuables","value","vanilla","vanish","vanity","vanquish","vantage","vaporizer","variable","variably","varied","variety","various","varmint","varnish","varsity","varying","vascular","vaseline","vastly","vastness","veal","vegan","veggie","vehicular","velcro","velocity","velvet","vendetta","vending","vendor","veneering","vengeful","venomous","ventricle","venture","venue","venus","verbalize","verbally","verbose","verdict","verify","verse","version","versus","vertebrae","vertical","vertigo","very","vessel","vest","veteran","veto","vexingly","viability","viable","vibes","vice","vicinity","victory","video","viewable","viewer","viewing","viewless","viewpoint","vigorous","village","villain","vindicate","vineyard","vintage","violate","violation","violator","violet","violin","viper","viral","virtual","virtuous","virus","visa","viscosity","viscous","viselike","visible","visibly","vision","visiting","visitor","visor","vista","vitality","vitalize","vitally","vitamins","vivacious","vividly","vividness","vixen","vocalist","vocalize","vocally","vocation","voice","voicing","void","volatile","volley","voltage","volumes","voter","voting","voucher","vowed","vowel","voyage","wackiness","wad","wafer","waffle","waged","wager","wages","waggle","wagon","wake","waking","walk","walmart","walnut","walrus","waltz","wand","wannabe","wanted","wanting","wasabi","washable","washbasin","washboard","washbowl","washcloth","washday","washed","washer","washhouse","washing","washout","washroom","washstand","washtub","wasp","wasting","watch","water","waviness","waving","wavy","whacking","whacky","wham","wharf","wheat","whenever","whiff","whimsical","whinny","whiny","whisking","whoever","whole","whomever","whoopee","whooping","whoops","why","wick","widely","widen","widget","widow","width","wieldable","wielder","wife","wifi","wikipedia","wildcard","wildcat","wilder","wildfire","wildfowl","wildland","wildlife","wildly","wildness","willed","willfully","willing","willow","willpower","wilt","wimp","wince","wincing","wind","wing","winking","winner","winnings","winter","wipe","wired","wireless","wiring","wiry","wisdom","wise","wish","wisplike","wispy","wistful","wizard","wobble","wobbling","wobbly","wok","wolf","wolverine","womanhood","womankind","womanless","womanlike","womanly","womb","woof","wooing","wool","woozy","word","work","worried","worrier","worrisome","worry","worsening","worshiper","worst","wound","woven","wow","wrangle","wrath","wreath","wreckage","wrecker","wrecking","wrench","wriggle","wriggly","wrinkle","wrinkly","wrist","writing","written","wrongdoer","wronged","wrongful","wrongly","wrongness","wrought","xbox","xerox","yahoo","yam","yanking","yapping","yard","yarn","yeah","yearbook","yearling","yearly","yearning","yeast","yelling","yelp","yen","yesterday","yiddish","yield","yin","yippee","yo-yo","yodel","yoga","yogurt","yonder","yoyo","yummy","zap","zealous","zebra","zen","zeppelin","zero","zestfully","zesty","zigzagged","zipfile","zipping","zippy","zips","zit","zodiac","zombie","zone","zoning","zookeeper","zoologist","zoology","zoom"];class Dv{constructor(e){if(null==e)throw new Error("Must provide key");if(32===e.byteLength)this.innerKey={type:hp.AesCbc256_B64,encryptionKey:e},this.keyB64=this.toBase64();else if(64===e.byteLength)this.innerKey={type:hp.AesCbc256_HmacSha256_B64,encryptionKey:e.slice(0,32),authenticationKey:e.slice(32)},this.keyB64=this.toBase64();else{if(!(e.byteLength>64))throw new Error(`Unsupported encType/key length ${e.byteLength}`);this.innerKey={type:hp.CoseEncrypt0,encryptionKey:e},this.keyB64=this.toBase64()}}toJSON(){return{keyB64:this.keyB64}}inner(){return this.innerKey}toBase64(){return bd.fromBufferToB64(this.toEncoded())}toEncoded(){if(this.innerKey.type===hp.AesCbc256_B64)return this.innerKey.encryptionKey;if(this.innerKey.type===hp.AesCbc256_HmacSha256_B64){const e=new Uint8Array(64);return e.set(this.innerKey.encryptionKey,0),e.set(this.innerKey.authenticationKey,32),e}if(this.innerKey.type===hp.CoseEncrypt0)return this.innerKey.encryptionKey;throw new Error("Unsupported encryption type.")}static fromString(e){if(null==e)return null;const t=bd.fromB64ToArray(e);return new Dv(t)}static fromJSON(e){return Dv.fromString(null==e?void 0:e.keyB64)}}const Ev=k.record(Le,"organizationKeys",{deserializer:e=>e,clearOn:["logout"]}),$v=k.record(Le,"providerKeys",{deserializer:e=>e,clearOn:["logout"]}),Ov=new k(Le,"everHadUserKey",{deserializer:e=>e,clearOn:["logout"]}),Uv=new k(ze,"userKey",{deserializer:e=>Dv.fromJSON(e),clearOn:["logout","lock"]});var Mv,Nv=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Vv{constructor(e,t,i,n,r,s,o,a,l,c,u){this.masterPasswordService=e,this.keyGenerationService=t,this.cryptoFunctionService=i,this.encryptService=n,this.platformUtilService=r,this.logService=s,this.stateService=o,this.accountService=a,this.stateProvider=l,this.kdfConfigService=c,this.accountCryptographyStateService=u,this.activeUserOrgKeys$=this.stateProvider.activeUserId$.pipe((0,go.n)(e=>null!=e?this.orgKeys$(e):yo.t),(0,Eo.p)(e=>null!=e),(0,mo.F)(),(0,Gp.t)({bufferSize:1,refCount:!1}))}setUserKey(e,t){return Nv(this,void 0,void 0,function*(){if(null==e)throw new Error("No key provided. Lock the user to clear the key");if(null==t)throw new Error("No userId provided.");yield this.stateProvider.setUserState(Uv,e,t),yield this.stateProvider.setUserState(Ov,!0,t),yield this.storeAdditionalKeys(e,t);if(null==(yield(0,bo._)(this.userKey$(t).pipe((0,Eo.p)(e=>null!=e)))))throw new Error("Failed to set user key")})}refreshAdditionalKeys(e){return Nv(this,void 0,void 0,function*(){if(null==e)throw new Error("UserId is required.");const t=yield(0,bo._)(this.userKey$(e));if(null==t)throw new Error("No user key found for: "+e);yield this.setUserKey(t,e)})}everHadUserKey$(e){return this.stateProvider.getUser(e,Ov).state$.pipe((0,l.T)(e=>null!=e&&e))}getInMemoryUserKeyFor$(e){return this.stateProvider.getUserState$(Uv,e)}getUserKey(e){return Nv(this,void 0,void 0,function*(){return yield(0,bo._)(this.stateProvider.getUserState$(Uv,e))})}getUserKeyFromStorage(e,t){return Nv(this,void 0,void 0,function*(){if(null==t)throw new Error("UserId is required");const i=yield this.getKeyFromStorage(e,t);return null==i?null:((yield this.validateUserKey(i,t))||(this.logService.warning("Invalid key, throwing away stored keys"),yield this.clearAllStoredUserKeys(t)),i)})}hasUserKey(e){return Nv(this,void 0,void 0,function*(){return null!=e&&null!=(yield(0,bo._)(this.stateProvider.getUserState$(Uv,e)))})}makeUserKey(e){return Nv(this,void 0,void 0,function*(){if(!e)throw new Error("MasterKey is required");const t=yield this.keyGenerationService.createKey(512);return this.buildProtectedSymmetricKey(e,t)})}clearUserKey(e){return Nv(this,void 0,void 0,function*(){null!=e&&(yield this.stateProvider.setUserState(Uv,null,e),yield this.clearAllStoredUserKeys(e))})}clearStoredUserKey(e){return Nv(this,void 0,void 0,function*(){if(null==e)throw new Error("UserId is required");yield this.stateService.setUserKeyAutoUnlock(null,{userId:e})})}getOrDeriveMasterKey(e,t){return Nv(this,void 0,void 0,function*(){if(null==t)throw new Error("User ID is required.");const i=yield(0,bo._)(this.masterPasswordService.masterKey$(t));if(null!=i)return i;const n=yield(0,bo._)(this.accountService.accounts$.pipe((0,l.T)(e=>{var i;return null===(i=e[t])||void 0===i?void 0:i.email})));if(null==n)throw new Error("No email found for user "+t);const r=yield(0,bo._)(this.kdfConfigService.getKdfConfig$(t));if(null==r)throw new Error("No kdf found for user "+t);return yield this.makeMasterKey(e,n,r)})}makeMasterKey(e,t,i){return Nv(this,void 0,void 0,function*(){const n=(new Date).getTime();t=t.trim().toLowerCase();const r=yield this.keyGenerationService.deriveKeyFromPassword(e,t,i),s=(new Date).getTime();return this.logService.info(`[KeyService] Deriving master key took ${s-n}ms`),r})}encryptUserKeyWithMasterKey(e,t){return Nv(this,void 0,void 0,function*(){if(null==e)throw new Error("masterKey is required.");if(null==t)throw new Error("userKey is required.");return yield this.buildProtectedSymmetricKey(e,t)})}hashMasterKey(e,t,i){return Nv(this,void 0,void 0,function*(){if(null==e)throw new Error("password is required.");if(null==t)throw new Error("key is required.");const n=i===mp.LocalAuthorization?2:1,r=yield this.cryptoFunctionService.pbkdf2(t.inner().encryptionKey,e,"sha256",n);return bd.fromBufferToB64(r)})}compareKeyHash(e,t,i){return Nv(this,void 0,void 0,function*(){if(null==t)throw new Error("'masterKey' is required to be non-null.");if(null==e)return!1;const n=yield(0,bo._)(this.masterPasswordService.masterKeyHash$(i));if(null==n)return!1;const r=yield this.hashMasterKey(e,t,mp.LocalAuthorization);return null!=r&&n===r})}setOrgKeys(e,t,i){return Nv(this,void 0,void 0,function*(){yield this.stateProvider.getUser(i,Ev).update(()=>{const i={};for(const t of e)i[t.id]={type:"organization",key:t.key};for(const e of t)i[e.id]={type:"provider",providerId:e.providerId,key:e.key};return i})})}getOrgKey(e){return Nv(this,void 0,void 0,function*(){return yield(0,bo._)(this.activeUserOrgKeys$.pipe((0,l.T)(t=>{var i;return null!==(i=t[e])&&void 0!==i?i:null})))})}makeDataEncKey(e){return Nv(this,void 0,void 0,function*(){if(null==e)throw new Error("No key provided");const t=yield this.keyGenerationService.createKey(512);return[t,yield this.encryptService.wrapSymmetricKey(t,e)]})}clearOrgKeys(e){return Nv(this,void 0,void 0,function*(){null!=e&&(yield this.stateProvider.setUserState(Ev,null,e))})}setProviderKeys(e,t){return Nv(this,void 0,void 0,function*(){yield this.stateProvider.getUser(t,$v).update(()=>{const t={};return e.forEach(e=>{t[e.id]=e.key}),t})})}providerKeys$(e){return this.userPrivateKey$(e).pipe((0,go.n)(t=>null==t?(0,Go.of)(null):this.providerKeysHelper$(e,t)))}clearProviderKeys(e){return Nv(this,void 0,void 0,function*(){null!=e&&(yield this.stateProvider.setUserState($v,null,e))})}makeOrgKey(e){return Nv(this,void 0,void 0,function*(){if(null==e)throw new Error("UserId is required");const t=yield(0,bo._)(this.userPublicKey$(e));if(null==t)throw new Error("No public key found for user "+e);const i=yield this.keyGenerationService.createKey(512);return[yield this.encryptService.encapsulateKeyUnsigned(i,t),i]})}getFingerprint(e,t){return Nv(this,void 0,void 0,function*(){if(null==t)throw new Error("Public key is required to generate a fingerprint.");const i=yield this.cryptoFunctionService.hash(t,"sha256"),n=yield this.cryptoFunctionService.hkdfExpand(i,e,32,"sha256");return this.hashPhrase(n)})}makeKeyPair(e){return Nv(this,void 0,void 0,function*(){if(null==e)throw new Error("'key' is a required parameter and must be non-null.");const t=yield this.cryptoFunctionService.rsaGenerateKeyPair(2048);return[bd.fromBufferToB64(t[0]),yield this.encryptService.wrapDecapsulationKey(t[1],e)]})}makeSendKey(e){return Nv(this,void 0,void 0,function*(){return yield this.keyGenerationService.deriveKeyFromMaterial(e,"bitwarden-send","send")})}makeCipherKey(){return Nv(this,void 0,void 0,function*(){return yield this.keyGenerationService.createKey(512)})}clearKeys(e){return Nv(this,void 0,void 0,function*(){if(null==e)throw new Error("UserId is required");yield this.masterPasswordService.clearMasterKeyHash(e),yield this.clearUserKey(e),yield this.clearOrgKeys(e),yield this.clearProviderKeys(e),yield this.stateProvider.setUserState(Ov,null,e),yield this.accountCryptographyStateService.clearAccountCryptographicState(e)})}validateUserKey(e,t){return Nv(this,void 0,void 0,function*(){if(null==e)return!1;try{const i=yield(0,bo._)(this.userEncryptedPrivateKey$(t));if(null==i)return!1;const n=yield this.decryptPrivateKey(i,e);if(null==n)return!1;if(null==(yield this.derivePublicKey(n)))return!1}catch(e){return!1}return!0})}initAccount(e){return Nv(this,void 0,void 0,function*(){if(null==e)throw new Error("UserId is required.");if(null!=(yield(0,bo._)(this.userKey$(e))))throw this.logService.error("Tried to initialize account with existing user key."),new Error("Cannot initialize account, keys already exist.");const t=yield this.keyGenerationService.createKey(512),[i,n]=yield this.makeKeyPair(t);if(null==n.encryptedString)throw new Error("Failed to create valid private key.");return yield this.setUserKey(t,e),yield this.accountCryptographyStateService.setAccountCryptographicState({V1:{private_key:n.encryptedString}},e),{userKey:t,publicKey:i,privateKey:n}})}storeAdditionalKeys(e,t){return Nv(this,void 0,void 0,function*(){(yield this.shouldStoreKey(wp.Auto,t))?yield this.stateService.setUserKeyAutoUnlock(e.keyB64,{userId:t}):yield this.stateService.setUserKeyAutoUnlock(null,{userId:t})})}shouldStoreKey(e,t){return Nv(this,void 0,void 0,function*(){if(e===wp.Auto){if(this.platformUtilService.getClientType()==Da.Cli)return!0;const e=yield(0,bo._)(this.stateProvider.getUserState$(Tv,t).pipe((0,Eo.p)(e=>null!=e)));return this.logService.debug(`[KeyService] Should store auto key for vault timeout ${e}`),e==vv}return!1})}getKeyFromStorage(e,t){return Nv(this,void 0,void 0,function*(){if(e===wp.Auto){const e=yield this.stateService.getUserKeyAutoUnlock({userId:t});if(e)return new Dv(bd.fromB64ToArray(e))}return null})}clearAllStoredUserKeys(e){return Nv(this,void 0,void 0,function*(){yield this.stateService.setUserKeyAutoUnlock(null,{userId:e})})}hashPhrase(e){return Nv(this,arguments,void 0,function*(e,t=64){const i=Math.log(Av.length)/Math.log(2);let n=Math.ceil(t/i);const r=Array.from(new Uint8Array(e));if(n*i>4*r.length)throw new Error("Output entropy of hash function is too small");const s=[];let o=jp.fromArray(r,256);for(;n--;){const e=o.mod(Av.length);o=o.divide(Av.length),s.push(Av[e])}return s})}buildProtectedSymmetricKey(e,t){return Nv(this,void 0,void 0,function*(){let i;if(e.inner().type===hp.AesCbc256_B64){const n=yield this.keyGenerationService.stretchKey(e);i=yield this.encryptService.wrapSymmetricKey(t,n)}else{if(e.inner().type!==hp.AesCbc256_HmacSha256_B64)throw new Error("Invalid key size.");i=yield this.encryptService.wrapSymmetricKey(t,e)}return[t,i]})}userKey$(e){return this.stateProvider.getUser(e,Uv).state$}userPublicKey$(e){return this.userPrivateKey$(e).pipe((0,go.n)(e=>Nv(this,void 0,void 0,function*(){return yield this.derivePublicKey(e)})))}derivePublicKey(e){return Nv(this,void 0,void 0,function*(){return null==e?null:yield this.cryptoFunctionService.rsaExtractPublicKey(e)})}userPrivateKey$(e){return this.userPrivateKeyHelper$(e).pipe((0,l.T)(e=>{var t;return null!==(t=null==e?void 0:e.userPrivateKey)&&void 0!==t?t:null}))}userEncryptionKeyPair$(e){return this.userPrivateKey$(e).pipe((0,go.n)(e=>Nv(this,void 0,void 0,function*(){if(null==e)return null;const t=yield this.derivePublicKey(e);return{privateKey:e,publicKey:t}})))}userEncryptedPrivateKey$(e){return this.accountCryptographyStateService.accountCryptographicState$(e).pipe((0,l.T)(e=>null==e?null:"V2"in e?e.V2.private_key:"V1"in e?e.V1.private_key:null))}userPrivateKeyHelper$(e){return this.userKey$(e).pipe((0,go.n)(t=>null==t?(0,Go.of)(null):this.userEncryptedPrivateKey$(e).pipe((0,go.n)(e=>Nv(this,void 0,void 0,function*(){return yield this.decryptPrivateKey(e,t)})),(0,l.T)(e=>({userKey:t,userPrivateKey:e})),(0,Ed.W)(i=>(this.logService.error(`Failed to decrypt private key for user ${e}`),(0,Go.of)({userKey:t,userPrivateKey:null}))))))}decryptPrivateKey(e,t){return Nv(this,void 0,void 0,function*(){return null==e?null:yield this.encryptService.unwrapDecapsulationKey(new Pp(e),t)})}providerKeysHelper$(e,t){return this.stateProvider.getUser(e,$v).state$.pipe((i=(e,i)=>Nv(this,void 0,void 0,function*(){return yield this.encryptService.decapsulateKeyUnsigned(new Pp(i),t)}),(0,l.T)(e=>{if(null==e)return null;const t={};for(const[n,r]of Object.entries(e))t[n]=i(n,r);return t})),(0,go.n)(e=>null==e?(0,Go.of)(null):0===Object.keys(e).length?(0,Go.of)({}):(0,Lp.p)(e)));var i}userSigningKey$(e){return this.accountCryptographyStateService.accountCryptographicState$(e).pipe((0,l.T)(e=>null==e?null:"V2"in e?e.V2.signing_key:null))}orgKeys$(e){return this.cipherDecryptionKeys$(e).pipe((0,l.T)(e=>{var t;return null!==(t=null==e?void 0:e.orgKeys)&&void 0!==t?t:null}))}encryptedOrgKeys$(e){var t;return null===(t=this.userPrivateKey$(e))||void 0===t?void 0:t.pipe((0,go.n)(t=>null==t?(0,Go.of)({}):(0,jo.z)([this.stateProvider.getUser(e,Ev).state$,this.providerKeysHelper$(e,t)]).pipe((0,go.n)(e=>Nv(this,[e],void 0,function*([e,i]){const n=yield this.derivePublicKey(t),r={};e=null!=e?e:{};for(const t of Object.keys(e)){if(null!=r[t])continue;const s=_p.fromData(e[t]);if(null==s)continue;let o;if(_p.isProviderEncrypted(s)){if(null==i)continue;o=yield this.encryptService.encapsulateKeyUnsigned(yield s.decrypt(this.encryptService,i),n)}else o=s.encryptedOrganizationKey;r[t]=o}return r})),(0,Ed.W)(t=>(this.logService.error(`Failed to get encrypted organization keys for user ${e}`,t),(0,Go.of)({}))))))}cipherDecryptionKeys$(e){var t;return null===(t=this.userPrivateKeyHelper$(e))||void 0===t?void 0:t.pipe((0,go.n)(t=>{if(null==t)return(0,Go.of)(null);const i=t.userPrivateKey;return null==i?(0,Go.of)({userKey:t.userKey,orgKeys:null}):(0,jo.z)([this.stateProvider.getUser(e,Ev).state$,this.providerKeysHelper$(e,i)]).pipe((0,go.n)(e=>Nv(this,[e],void 0,function*([e,t]){const n={};e=null!=e?e:{};for(const r of Object.keys(e)){if(null!=n[r])continue;const s=_p.fromData(e[r]);if(null==s)continue;let o;if(_p.isProviderEncrypted(s)){if(null==t)continue;o=yield s.decrypt(this.encryptService,t)}else o=yield s.decrypt(this.encryptService,i);n[r]=o}return n})),(0,l.T)(e=>({userKey:t.userKey,orgKeys:e})))}))}userSignedPublicKey$(e){return this.accountCryptographyStateService.accountCryptographicState$(e).pipe((0,l.T)(e=>null==e?null:"V2"in e?e.V2.signed_public_key:null))}}class Bv{constructor(e,t,i){if(this.min=e,this.max=t,this.defaultValue=i,e>t)throw new Error(`${e} is greater than ${t}.`);if(!1===this.inRange(i))throw new Error("Default value is not in range.")}inRange(e){return e>=this.min&&e<=this.max}}!function(e){e[e.PBKDF2_SHA256=0]="PBKDF2_SHA256",e[e.Argon2id=1]="Argon2id"}(Mv||(Mv={}));class jv{constructor(e){this.kdfType=Mv.PBKDF2_SHA256,this.iterations=null!=e?e:jv.ITERATIONS.defaultValue}validateKdfConfigForSetting(){if(!jv.ITERATIONS.inRange(this.iterations))throw new Error(`PBKDF2 iterations must be between ${jv.ITERATIONS.min} and ${jv.ITERATIONS.max}`)}validateKdfConfigForPrelogin(){if(jv.PRELOGIN_ITERATIONS_MIN>this.iterations)throw new Error(`PBKDF2 iterations must be at least ${jv.PRELOGIN_ITERATIONS_MIN}, but was ${this.iterations}; possible pre-login downgrade attack detected.`)}static fromJSON(e){return new jv(e.iterations)}toSdkConfig(){return{pBKDF2:{iterations:this.iterations}}}}jv.ITERATIONS=new Bv(6e5,2e6,6e5),jv.PRELOGIN_ITERATIONS_MIN=5e3;class Gv{constructor(e,t,i){this.kdfType=Mv.Argon2id,this.iterations=null!=e?e:Gv.ITERATIONS.defaultValue,this.memory=null!=t?t:Gv.MEMORY.defaultValue,this.parallelism=null!=i?i:Gv.PARALLELISM.defaultValue}validateKdfConfigForSetting(){if(!Gv.ITERATIONS.inRange(this.iterations))throw new Error(`Argon2 iterations must be between ${Gv.ITERATIONS.min} and ${Gv.ITERATIONS.max}`);if(!Gv.MEMORY.inRange(this.memory))throw new Error(`Argon2 memory must be between ${Gv.MEMORY.min} MiB and ${Gv.MEMORY.max} MiB`);if(!Gv.PARALLELISM.inRange(this.parallelism))throw new Error(`Argon2 parallelism must be between ${Gv.PARALLELISM.min} and ${Gv.PARALLELISM.max}.`)}validateKdfConfigForPrelogin(){if(Gv.PRELOGIN_ITERATIONS_MIN>this.iterations)throw new Error(`Argon2 iterations must be at least ${Gv.PRELOGIN_ITERATIONS_MIN}, but was ${this.iterations}; possible pre-login downgrade attack detected.`);if(Gv.PRELOGIN_MEMORY_MIN>this.memory)throw new Error(`Argon2 memory must be at least ${Gv.PRELOGIN_MEMORY_MIN} MiB, but was ${this.memory} MiB; possible pre-login downgrade attack detected.`);if(Gv.PRELOGIN_PARALLELISM_MIN>this.parallelism)throw new Error(`Argon2 parallelism must be at least ${Gv.PRELOGIN_PARALLELISM_MIN}, but was ${this.parallelism}; possible pre-login downgrade attack detected.`)}static fromJSON(e){return new Gv(e.iterations,e.memory,e.parallelism)}toSdkConfig(){return{argon2id:{iterations:this.iterations,memory:this.memory,parallelism:this.parallelism}}}}function Lv(e){if("pBKDF2"in e)return new jv(e.pBKDF2.iterations);if("argon2id"in e)return new Gv(e.argon2id.iterations,e.argon2id.memory,e.argon2id.parallelism);throw new Error("Unsupported KDF type")}Gv.MEMORY=new Bv(16,1024,64),Gv.PARALLELISM=new Bv(1,16,4),Gv.ITERATIONS=new Bv(2,10,3),Gv.PRELOGIN_MEMORY_MIN=16,Gv.PRELOGIN_PARALLELISM_MIN=1,Gv.PRELOGIN_ITERATIONS_MIN=2;const zv=new jv(jv.ITERATIONS.defaultValue);class _v{}var Kv=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Xv=new k(_e,"kdfConfig",{deserializer:e=>null==e?null:e.kdfType===Mv.PBKDF2_SHA256?jv.fromJSON(e):Gv.fromJSON(e),clearOn:["logout"]});class qv{}var Wv;!function(e){e.AutoConfirm="pm-19934-auto-confirm-organization-users",e.DefaultUserCollectionRestore="pm-30883-my-items-restored-users",e.BulkReinviteUI="pm-28416-bulk-reinvite-ux-improvements",e.PM23801_PrefetchPasswordPrelogin="pm-23801-prefetch-password-prelogin",e.PM27086_UpdateAuthenticationApisForInputPassword="pm-27086-update-authentication-apis-for-input-password",e.SafariAccountSwitching="pm-5594-safari-account-switching",e.PM31088_MasterPasswordServiceEmitSalt="pm-31088-master-password-service-emit-salt",e.UseUndeterminedCipherScenarioTriggeringLogic="undetermined-cipher-scenario-logic",e.MacOsNativeCredentialSync="macos-native-credential-sync",e.WindowsDesktopAutotype="windows-desktop-autotype",e.WindowsDesktopAutotypeGA="windows-desktop-autotype-ga",e.SSHAgentV2="ssh-agent-v2",e.TrialPaymentOptional="PM-8163-trial-payment",e.PM24032_NewNavigationPremiumUpgradeButton="pm-24032-new-navigation-premium-upgrade-button",e.PM23713_PremiumBadgeOpensNewPremiumUpgradeDialog="pm-23713-premium-badge-opens-new-premium-upgrade-dialog",e.PM26462_Milestone_3="pm-26462-milestone-3",e.PM23341_Milestone_2="pm-23341-milestone-2",e.PM29594_UpdateIndividualSubscriptionPage="pm-29594-update-individual-subscription-page",e.PM29593_PremiumToOrganizationUpgrade="pm-29593-premium-to-organization-upgrade",e.PrivateKeyRegeneration="pm-12241-private-key-regeneration",e.EnrollAeadOnKeyRotation="enroll-aead-on-key-rotation",e.ForceUpdateKDFSettings="pm-18021-force-update-kdf-settings",e.SdkKeyRotation="pm-30144-sdk-key-rotation",e.LinuxBiometricsV2="pm-26340-linux-biometrics-v2",e.NoLogoutOnKdfChange="pm-23995-no-logout-on-kdf-change",e.PasskeyUnlock="pm-2035-passkey-unlock",e.DataRecoveryTool="pm-28813-data-recovery-tool",e.ConsolidatedSessionTimeoutComponent="pm-26056-consolidated-session-timeout-component",e.PM27279_V2RegistrationTdeJit="pm-27279-v2-registration-tde-jit",e.EnableAccountEncryptionV2KeyConnectorRegistration="enable-account-encryption-v2-key-connector-registration",e.EnableAccountEncryptionV2JitPasswordRegistration="enable-account-encryption-v2-jit-password-registration",e.UseSdkPasswordGenerators="pm-19976-use-sdk-password-generators",e.SendUIRefresh="pm-28175-send-ui-refresh",e.SendEmailOTP="pm-19051-send-email-verification",e.EventManagementForDataDogAndCrowdStrike="event-management-for-datadog-and-crowdstrike",e.EventManagementForHuntress="event-management-for-huntress",e.PhishingDetection="phishing-detection",e.Milestone11AppPageImprovements="pm-30538-dirt-milestone-11-app-page-improvements",e.PM19941MigrateCipherDomainToSdk="pm-19941-migrate-cipher-domain-to-sdk",e.PM22134SdkCipherListView="pm-22134-sdk-cipher-list-view",e.PM22136_SdkCipherEncryption="pm-22136-sdk-cipher-encryption",e.CipherKeyEncryption="cipher-key-encryption",e.BrowserPremiumSpotlight="pm-23384-browser-premium-spotlight",e.MigrateMyVaultToMyItems="pm-20558-migrate-myvault-to-myitems",e.PM27632_SdkCipherCrudOperations="pm-27632-cipher-crud-operations-to-sdk",e.PM30521_AutofillButtonViewLoginScreen="pm-30521-autofill-button-view-login-screen",e.PM29438_WelcomeDialogWithExtensionPrompt="pm-29438-welcome-dialog-with-extension-prompt",e.PM29438_DialogWithExtensionPromptAccountAge="pm-29438-dialog-with-extension-prompt-account-age",e.PM29437_WelcomeDialog="pm-29437-welcome-dialog-no-ext-prompt",e.PM31039ItemActionInExtension="pm-31039-item-action-in-extension",e.ContentScriptIpcChannelFramework="content-script-ipc-channel-framework",e.WebAuthnRelatedOrigins="pm-30529-webauthn-related-origins",e.PM19148_InnovationArchive="pm-19148-innovation-archive",e.DesktopUiMigrationMilestone1="desktop-ui-migration-milestone-1",e.DesktopUiMigrationMilestone2="desktop-ui-migration-milestone-2",e.RouterFocusManagement="router-focus-management"}(Wv||(Wv={}));const Yv=!1,Hv={[Wv.AutoConfirm]:Yv,[Wv.DefaultUserCollectionRestore]:Yv,[Wv.BulkReinviteUI]:Yv,[Wv.UseUndeterminedCipherScenarioTriggeringLogic]:Yv,[Wv.MacOsNativeCredentialSync]:Yv,[Wv.WindowsDesktopAutotype]:Yv,[Wv.WindowsDesktopAutotypeGA]:Yv,[Wv.SSHAgentV2]:Yv,[Wv.PM31039ItemActionInExtension]:Yv,[Wv.UseSdkPasswordGenerators]:Yv,[Wv.SendUIRefresh]:Yv,[Wv.SendEmailOTP]:Yv,[Wv.EventManagementForDataDogAndCrowdStrike]:Yv,[Wv.EventManagementForHuntress]:Yv,[Wv.PhishingDetection]:Yv,[Wv.Milestone11AppPageImprovements]:Yv,[Wv.CipherKeyEncryption]:Yv,[Wv.PM19941MigrateCipherDomainToSdk]:Yv,[Wv.PM22134SdkCipherListView]:Yv,[Wv.PM22136_SdkCipherEncryption]:Yv,[Wv.BrowserPremiumSpotlight]:Yv,[Wv.PM27632_SdkCipherCrudOperations]:Yv,[Wv.MigrateMyVaultToMyItems]:Yv,[Wv.PM30521_AutofillButtonViewLoginScreen]:Yv,[Wv.PM29438_WelcomeDialogWithExtensionPrompt]:Yv,[Wv.PM29438_DialogWithExtensionPromptAccountAge]:5,[Wv.PM29437_WelcomeDialog]:Yv,[Wv.PM23801_PrefetchPasswordPrelogin]:Yv,[Wv.PM27086_UpdateAuthenticationApisForInputPassword]:Yv,[Wv.SafariAccountSwitching]:Yv,[Wv.PM31088_MasterPasswordServiceEmitSalt]:Yv,[Wv.TrialPaymentOptional]:Yv,[Wv.PM24032_NewNavigationPremiumUpgradeButton]:Yv,[Wv.PM23713_PremiumBadgeOpensNewPremiumUpgradeDialog]:Yv,[Wv.PM26462_Milestone_3]:Yv,[Wv.PM23341_Milestone_2]:Yv,[Wv.PM29594_UpdateIndividualSubscriptionPage]:Yv,[Wv.PM29593_PremiumToOrganizationUpgrade]:Yv,[Wv.PrivateKeyRegeneration]:Yv,[Wv.EnrollAeadOnKeyRotation]:Yv,[Wv.ForceUpdateKDFSettings]:Yv,[Wv.SdkKeyRotation]:Yv,[Wv.LinuxBiometricsV2]:Yv,[Wv.NoLogoutOnKdfChange]:Yv,[Wv.PasskeyUnlock]:Yv,[Wv.DataRecoveryTool]:Yv,[Wv.ConsolidatedSessionTimeoutComponent]:Yv,[Wv.PM27279_V2RegistrationTdeJit]:Yv,[Wv.EnableAccountEncryptionV2KeyConnectorRegistration]:Yv,[Wv.EnableAccountEncryptionV2JitPasswordRegistration]:Yv,[Wv.ContentScriptIpcChannelFramework]:Yv,[Wv.WebAuthnRelatedOrigins]:Yv,[Wv.PM19148_InnovationArchive]:Yv,[Wv.DesktopUiMigrationMilestone1]:Yv,[Wv.DesktopUiMigrationMilestone2]:Yv,[Wv.RouterFocusManagement]:Yv};function Jv(e,t){return null==(null==e?void 0:e.featureStates)||null==e.featureStates[t]?Hv[t]:e.featureStates[t]}var Zv=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Qv{}var ef=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var tf=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class nf{constructor(e){this.keyService=e}transform(e,t){return tf(this,void 0,void 0,function*(){try{"string"==typeof e&&(e=bd.fromB64ToArray(e));const i=yield this.keyService.getFingerprint(t,e);return null!=i?i.join("-"):""}catch(e){return""}})}}nf.ɵfac=function(e){return new(e||nf)(Fl.rXU(Bp,16))},nf.ɵpipe=Fl.EJ8({name:"fingerprint",type:nf,pure:!0,standalone:!1});class rf{constructor(e){this.i18nService=e}transform(e,t,i,n){return this.i18nService.t(e,t,i,n)}}rf.ɵfac=function(e){return new(e||rf)(Fl.rXU(Ul,16))},rf.ɵpipe=Fl.EJ8({name:"i18n",type:rf,pure:!0,standalone:!1});class sf{}sf.ɵfac=function(e){return new(e||sf)},sf.ɵmod=Fl.$C({type:sf}),sf.ɵinj=a.G2t({providers:[Zh,kl.vh,rf,ep,tp,pp,nf,Qh],imports:[dc.forRoot({maxOpened:5,autoDismiss:!0,closeButton:!0}),kl.MD,Il.YN,Il.X1,pc,Xc,Gu,Wu,id,dd,hd,Fh,tc,Xh,qh,Wh,Ql,Yh,Hh,Yh,dc]});class of{constructor(e){this.data=e}static open(e,t){return e.open(of,{data:t,positionStrategy:new sh})}}of.ɵfac=function(e){return new(e||of)(Fl.rXU(pd.Qs))},of.ɵcmp=Fl.VBU({type:of,selectors:[["ng-component"]],decls:16,vars:10,consts:[["bitDialogIcon","","aria-hidden","true",1,"bwi","bwi-info-circle","tw-text-info","tw-text-3xl"],["bitDialogTitle",""],["bitDialogContent",""],["bitDialogFooter",""],["bitButton","","href","https://bitwarden.com/help/fingerprint-phrase/","target","_blank","rel","noreferrer","buttonType","primary","bitDialogClose",""],["aria-hidden","true",1,"bwi","bwi-external-link","bwi-fw"],["bitButton","","type","button","buttonType","secondary","bitDialogClose",""]],template:function(e,t){1&e&&(Fl.j41(0,"bit-simple-dialog"),Fl.nrm(1,"i",0),Fl.j41(2,"span",1)(3,"strong"),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()(),Fl.j41(6,"span",2),Fl.EFF(7),Fl.k0s(),Fl.qex(8,3),Fl.j41(9,"a",4),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.nrm(12,"i",5),Fl.k0s(),Fl.j41(13,"button",6),Fl.EFF(14),Fl.nI1(15,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e&&(Fl.R7$(4),Fl.SpI("",Fl.bMT(5,4,"yourAccountsFingerprint"),":"),Fl.R7$(3),Fl.SpI(" ",t.data.fingerprint.join("-")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(11,6,"learnMore")," "),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(15,8,"close")," "))},dependencies:[sf,id,td,Fh,ch,Wd,Yd,rf],encapsulation:2});class af{}var lf=i(77789),cf=i.n(lf);const uf=e=>({width:e});function df(e,t){if(1&e&&(Fl.j41(0,"div",2)(1,"div",3),Fl.EFF(2," "),Fl.k0s(),Fl.j41(3,"div",4),Fl.EFF(4),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(4),Fl.JRh(e.textContent)}}const hf={small:["tw-h-1"],default:["tw-h-4"],large:["tw-h-6"]},pf={danger:["tw-bg-danger-600"],primary:["tw-bg-primary-600"],success:["tw-bg-success-600"],warning:["tw-bg-warning-600"]};class vf{constructor(){this.barWidth=(0,o.hFB)(0),this.bgColor=(0,o.hFB)("primary"),this.showText=(0,o.hFB)(!0),this.size=(0,o.hFB)("default"),this.text=(0,o.hFB)()}get displayText(){return this.showText()&&"small"!==this.size()}get outerBarStyles(){return["tw-overflow-hidden","tw-rounded","tw-bg-secondary-100"].concat(hf[this.size()])}get innerBarStyles(){return["tw-flex","tw-justify-center","tw-items-center","tw-whitespace-nowrap","tw-text-xs","tw-font-medium","tw-text-contrast","tw-transition-all"].concat(hf[this.size()]).concat(pf[this.bgColor()])}get textContent(){return this.text()||this.barWidth()+"%"}}vf.ɵfac=function(e){return new(e||vf)},vf.ɵcmp=Fl.VBU({type:vf,selectors:[["bit-progress"]],inputs:{barWidth:[1,"barWidth"],bgColor:[1,"bgColor"],showText:[1,"showText"],size:[1,"size"],text:[1,"text"]},decls:3,vars:7,consts:[[3,"ngClass"],["role","progressbar","aria-valuemin","0","aria-valuemax","100",3,"ngClass","ngStyle"],[1,"tw-flex","tw-h-full","tw-flex-wrap","tw-items-center","tw-overflow-hidden"],[1,"tw-h-full"],[1,"tw-pe-1"]],template:function(e,t){1&e&&(Fl.j41(0,"div",0)(1,"div",1),Fl.nVh(2,df,5,1,"div",2),Fl.k0s()()),2&e&&(Fl.Y8G("ngClass",t.outerBarStyles),Fl.R7$(),Fl.Y8G("ngClass",t.innerBarStyles)("ngStyle",Fl.eq3(5,uf,t.barWidth()+"%")),Fl.BMQ("aria-valuenow",t.barWidth()),Fl.R7$(),Fl.vxM(t.displayText?2:-1))},dependencies:[kl.MD,kl.YU,kl.B3],encapsulation:2});class ff{}ff.ɵfac=function(e){return new(e||ff)},ff.ɵmod=Fl.$C({type:ff}),ff.ɵinj=a.G2t({imports:[vf]});class mf{set password(e){this.updatePasswordStrength(e)}constructor(e,t){this.i18nService=e,this.passwordStrengthService=t,this.size="default",this.showText=!1,this.passwordStrengthScore=new Fl.bkB,this.passwordScoreTextWithColor=new Fl.bkB,this.scoreWidth=0,this.color="danger"}ngOnChanges(){this.passwordStrengthTimeout=setTimeout(()=>{switch(this.scoreWidth=null==this.passwordScore?0:20*(this.passwordScore+1),this.passwordScore){case 4:this.color="success",this.text=this.i18nService.t("strong");break;case 3:this.color="primary",this.text=this.i18nService.t("good");break;case 2:this.color="warning",this.text=this.i18nService.t("weak");break;default:this.color="danger",this.text=null!=this.passwordScore?this.i18nService.t("weak"):null}this.passwordScoreTextWithColor.emit({color:this.color,text:this.text})},300)}updatePasswordStrength(e){var t;null!=this.passwordStrengthTimeout&&clearTimeout(this.passwordStrengthTimeout);const i=this.passwordStrengthService.getPasswordStrength(e,this.email,null===(t=this.name)||void 0===t?void 0:t.trim().toLowerCase().split(" "));this.passwordScore=null==i?null:i.score,this.passwordStrengthScore.emit(this.passwordScore)}}mf.ɵfac=function(e){return new(e||mf)(Fl.rXU(Ul),Fl.rXU(af))},mf.ɵcmp=Fl.VBU({type:mf,selectors:[["tools-password-strength"]],inputs:{size:"size",showText:"showText",email:"email",name:"name",password:"password"},outputs:{passwordStrengthScore:"passwordStrengthScore",passwordScoreTextWithColor:"passwordScoreTextWithColor"},features:[Fl.OA$],decls:4,vars:9,consts:[[3,"size","text","bgColor","showText","barWidth"],["aria-live","polite",1,"tw-sr-only"]],template:function(e,t){1&e&&(Fl.nrm(0,"bit-progress",0),Fl.j41(1,"div",1),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()),2&e&&(Fl.Y8G("size",t.size)("text",t.text)("bgColor",t.color)("showText",t.showText)("barWidth",t.scoreWidth),Fl.R7$(2),Fl.SpI(" ",Fl.i5U(3,6,"passwordStrengthScore",t.text),"\n"))},dependencies:[kl.MD,sf,ff,vf,rf],encapsulation:2});class gf{}class yf{}const bf=Object.freeze({catchallType:"random",catchallDomain:"",website:null});const wf=function(){const e=Object.freeze({min:3,max:20});return Object.freeze({numWords:e})}();const Sf=function(){const e=Object.freeze({min:5,max:128}),t=Object.freeze({min:0,max:9}),i=Object.freeze({min:0,max:9});return Object.freeze({length:e,minDigits:t,minSpecialCharacters:i})}(),kf=Object.freeze({wordCapitalize:!1,wordIncludeNumber:!1,website:null}),If=Object.freeze({numWords:6,wordSeparator:"-",capitalize:!1,includeNumber:!1}),Cf=Object.freeze({length:14,minLength:Sf.length.min,ambiguous:!0,uppercase:!0,minUppercase:1,lowercase:!0,minLowercase:1,number:!0,minNumber:1,special:!1,minSpecial:0}),Tf=Object.freeze({subaddressType:"random",subaddressEmail:"",website:null}),Pf=Object.freeze({addyio:"addyio",bitwarden:"bitwarden",duckduckgo:"duckduckgo",fastmail:"fastmail",forwardemail:"forwardemail",mozilla:"mozilla",simplelogin:"simplelogin"});class Ff{constructor(e=void 0){this.keys=e}classify(e){var t;const i=JSON.parse(JSON.stringify(e)),n=null!==(t=this.keys)&&void 0!==t?t:Object.keys(i),r={};for(const e of n)r[e]=i[e];return{disclosed:null,secret:r}}declassify(e,t){var i;const n={},r=null!==(i=this.keys)&&void 0!==i?i:Object.keys(t);for(const e of r)n[e]=t[e];return n}}class Rf{constructor(e){this.keys=e}classify(e){const t=JSON.parse(JSON.stringify(e)),i={};for(const e of this.keys)i[e]=t[e];return{disclosed:i,secret:null}}declassify(e,t){const i={};for(const t of this.keys)i[t]=e[t];return i}}class xf{constructor(e,t,i){this.stateDefinition=e,this.key=t,this.options=i}toKeyDefinition(){return new k(this.stateDefinition,this.key,this.options)}shouldOverwrite(e){var t;const i=null===(t=this.options)||void 0===t?void 0:t.shouldOverwrite;return i?i(e):!!e}map(e,t){var i;const n=null===(i=this.options)||void 0===i?void 0:i.map;return n?n(e,t):Promise.resolve(e)}isValid(e,t){var i;if(null===e)return Promise.resolve(!1);const n=null===(i=this.options)||void 0===i?void 0:i.isValid;return n?n(e,t):Promise.resolve(!!e)}}const Af=Object.freeze({token:"",domain:"",baseUrl:""}),Df=Object.freeze({url(e,t){return t.baseUrl()+"/api/v1/aliases"},body(e,t){return{domain:t.emailDomain(),description:t.generatedBy(e,{extractHostname:!0,maxLength:200})}},hasJsonPayload(e){return 200===e.status||201===e.status},processJson(e){var t;return[null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.email]}}),Ef=Object.freeze({defaultSettings:Af,createForwardingEmail:Df,request:["token","baseUrl","domain"],settingsConstraints:{token:{required:!0},domain:{required:!0},baseUrl:{}},local:{settings:{key:"addyIoForwarder",target:"object",format:"secret-state",frame:512,classifier:new Ff,state:me,initial:Af,options:{deserializer:e=>e,clearOn:["logout"]}},import:{key:"forwarder.AddyIo.local.import",target:"object",format:"plain",classifier:new Rf(["token","baseUrl","domain"]),state:ge,options:{deserializer:e=>e,clearOn:["logout","lock"]}}},settings:new k(me,"addyIoForwarder",{deserializer:e=>e,clearOn:[]}),importBuffer:new xf(me,"addyIoBuffer",{deserializer:e=>e,clearOn:["logout"]})}),$f=Object.freeze({id:Pf.addyio,name:"Addy.io",extends:["forwarder"],selfHost:"maybe",baseUrl:"https://app.addy.io",authenticate(e,t){return{Authorization:"Bearer "+t.authenticationToken()}},forwarder:Ef}),Of=Object.freeze({token:""}),Uf=Object.freeze({url(e,t){return t.baseUrl()+"/email/addresses"},body(e,t){},hasJsonPayload(e){return 200===e.status||201===e.status},processJson(e){return[`${e.address}@duck.com`]}}),Mf=Object.freeze({defaultSettings:Of,createForwardingEmail:Uf,request:["token"],settingsConstraints:{token:{required:!0}},local:{settings:{key:"duckDuckGoForwarder",target:"object",format:"secret-state",frame:512,classifier:new Ff,state:me,initial:Of,options:{deserializer:e=>e,clearOn:["logout"]}},import:{key:"forwarder.DuckDuckGo.local.import",target:"object",format:"plain",classifier:new Rf(["token"]),state:ge,options:{deserializer:e=>e,clearOn:["logout","lock"]}}},settings:new k(me,"duckDuckGoForwarder",{deserializer:e=>e,clearOn:[]}),importBuffer:new xf(me,"duckDuckGoBuffer",{deserializer:e=>e,clearOn:["logout"]})}),Nf=Object.freeze({id:Pf.duckduckgo,name:"DuckDuckGo",baseUrl:"https://quack.duckduckgo.com/api",selfHost:"never",extends:["forwarder"],authenticate(e,t){return{Authorization:"Bearer "+t.authenticationToken()}},forwarder:Mf}),Vf=Object.freeze({domain:"",prefix:"",token:""}),Bf=Object.freeze({url(e,t){return t.baseUrl()+"/jmap/session"},hasJsonPayload(e){return 200===e.status},processJson(e,t){var i,n;const r=null!==(n=null===(i=e.primaryAccounts)||void 0===i?void 0:i["https://www.fastmail.com/dev/maskedemail"])&&void 0!==n?n:void 0;return[r,r?void 0:t.missingAccountIdCause()]}}),jf=Object.freeze({url(e,t){return t.baseUrl()+"/jmap/api/"},body(e,t){return{using:["https://www.fastmail.com/dev/maskedemail","urn:ietf:params:jmap:core"],methodCalls:[["MaskedEmail/set",{accountId:e.accountId,create:{"new-masked-email":{state:"enabled",description:"",forDomain:t.website(e),emailPrefix:""}}},"0"]]}},hasJsonPayload(e){return 200===e.status},processJson(e){var t,i,n,r,s,o,a,l,c,u,d;if(null!=e.methodResponses&&e.methodResponses.length>0&&e.methodResponses[0].length>0)if("MaskedEmail/set"===e.methodResponses[0][0]){if(null!=(null===(i=null===(t=e.methodResponses[0][1])||void 0===t?void 0:t.created)||void 0===i?void 0:i["new-masked-email"])){return[null===(s=null===(r=null===(n=e.methodResponses[0][1])||void 0===n?void 0:n.created)||void 0===r?void 0:r["new-masked-email"])||void 0===s?void 0:s.email]}if(null!=(null===(a=null===(o=e.methodResponses[0][1])||void 0===o?void 0:o.notCreated)||void 0===a?void 0:a["new-masked-email"])){return[void 0,null===(u=null===(c=null===(l=e.methodResponses[0][1])||void 0===l?void 0:l.notCreated)||void 0===c?void 0:c["new-masked-email"])||void 0===u?void 0:u.description]}}else if("error"===e.methodResponses[0][0]){return[void 0,null===(d=e.methodResponses[0][1])||void 0===d?void 0:d.description]}}}),Gf=Object.freeze({defaultSettings:Vf,createForwardingEmail:jf,getAccountId:Bf,request:["token"],settingsConstraints:{token:{required:!0},domain:{required:!0},prefix:{}},local:{settings:{key:"fastmailForwarder",target:"object",format:"secret-state",frame:512,classifier:new Ff,state:me,initial:Vf,options:{deserializer:e=>e,clearOn:["logout"]}},import:{key:"forwarder.Fastmail.local.import",target:"object",format:"plain",classifier:new Rf(["token"]),state:ge,options:{deserializer:e=>e,clearOn:["logout","lock"]}}},settings:new k(me,"fastmailForwarder",{deserializer:e=>e,clearOn:[]}),importBuffer:new xf(me,"fastmailBuffer",{deserializer:e=>e,clearOn:["logout"]})}),Lf=Object.freeze({id:Pf.fastmail,name:"Fastmail",baseUrl:"https://api.fastmail.com",selfHost:"maybe",extends:["forwarder"],authenticate(e,t){return{Authorization:"Bearer "+t.authenticationToken()}},forwarder:Gf}),zf=Object.freeze({token:""}),_f=Object.freeze({url(e,t){return t.baseUrl()+"/v1/relayaddresses/"},body(e,t){return{enabled:!0,generated_for:t.website(e,{maxLength:255}),description:t.generatedBy(e,{extractHostname:!0,maxLength:64})}},hasJsonPayload(e){return 200===e.status||201===e.status},processJson(e){return[e.full_address]}}),Kf=Object.freeze({defaultSettings:zf,createForwardingEmail:_f,request:["token"],settingsConstraints:{token:{required:!0}},local:{settings:{key:"firefoxRelayForwarder",target:"object",format:"secret-state",frame:512,classifier:new Ff,state:me,initial:zf,options:{deserializer:e=>e,clearOn:["logout"]}},import:{key:"forwarder.Firefox.local.import",target:"object",format:"plain",classifier:new Rf(["token"]),state:ge,options:{deserializer:e=>e,clearOn:["logout","lock"]}}},settings:new k(me,"firefoxRelayForwarder",{deserializer:e=>e,clearOn:[]}),importBuffer:new xf(me,"firefoxRelayBuffer",{deserializer:e=>e,clearOn:["logout"]})}),Xf=Object.freeze({id:Pf.mozilla,name:"Firefox Relay",baseUrl:"https://relay.firefox.com/api",selfHost:"never",extends:["forwarder"],authenticate(e,t){return{Authorization:"Token "+t.authenticationToken()}},forwarder:Kf}),qf=Object.freeze({token:"",domain:""}),Wf=Object.freeze({url(e,t){const i=t.emailDomain();return t.baseUrl()+`/v1/domains/${i}/aliases`},body(e,t){return{labels:t.website(e),description:t.generatedBy(e)}},hasJsonPayload(e){return 200===e.status||201===e.status},processJson(e,t){var i;const{name:n,domain:r}=e;return[`${n}@${null!==(i=null==r?void 0:r.name)&&void 0!==i?i:t.emailDomain()}`]}}),Yf=Object.freeze({defaultSettings:qf,request:["token","domain"],settingsConstraints:{token:{required:!0},domain:{required:!0}},local:{settings:{key:"forwardEmailForwarder",target:"object",format:"secret-state",frame:512,classifier:new Ff,state:me,initial:qf,options:{deserializer:e=>e,clearOn:["logout"]}},import:{key:"forwarder.ForwardEmail.local.import",target:"object",format:"plain",classifier:new Rf(["token","domain"]),state:ge,options:{deserializer:e=>e,clearOn:["logout","lock"]}}},settings:new k(me,"forwardEmailForwarder",{deserializer:e=>e,clearOn:[]}),importBuffer:new xf(me,"forwardEmailBuffer",{deserializer:e=>e,clearOn:["logout"]}),createForwardingEmail:Wf}),Hf=Object.freeze({id:Pf.forwardemail,name:"Forward Email",extends:["forwarder"],selfHost:"never",baseUrl:"https://api.forwardemail.net",authenticate(e,t){return{Authorization:"Basic "+t.authenticationToken({base64:!0,suffix:":"})}},forwarder:Yf}),Jf=Object.freeze({token:"",domain:"",baseUrl:""}),Zf=Object.freeze({url(e,t){const i=t.baseUrl()+"/api/alias/random/new",n=t.website(e);return""!==n?`${i}?hostname=${n}`:i},body(e,t){return{note:t.generatedBy(e)}},hasJsonPayload(e){return 200===e.status||201===e.status},processJson(e){return[null==e?void 0:e.alias]}}),Qf=Object.freeze({defaultSettings:Jf,createForwardingEmail:Zf,request:["token","baseUrl"],settingsConstraints:{token:{required:!0}},local:{settings:{key:"simpleLoginForwarder",target:"object",format:"secret-state",frame:512,classifier:new Ff,state:me,initial:Jf,options:{deserializer:e=>e,clearOn:["logout"]}},import:{key:"forwarder.SimpleLogin.local.import",target:"object",format:"plain",classifier:new Rf(["token","baseUrl"]),state:ge,options:{deserializer:e=>e,clearOn:["logout","lock"]}}},settings:new k(me,"simpleLoginForwarder",{deserializer:e=>e,clearOn:[]}),importBuffer:new xf(me,"simpleLoginBuffer",{deserializer:e=>e,clearOn:["logout"]})}),em=Object.freeze({id:Pf.simplelogin,name:"SimpleLogin",selfHost:"maybe",extends:["forwarder"],baseUrl:"https://app.simplelogin.io",authenticate(e,t){return{Authentication:t.authenticationToken()}},forwarder:Qf}),tm=Object.freeze({AddyIo:$f,DuckDuckGo:Nf,Fastmail:Lf,FirefoxRelay:Xf,ForwardEmail:Hf,SimpleLogin:em}),im=new Map(Object.values(tm).map(e=>[e.id,e]));var nm=i(82781),rm=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class sm extends Error{constructor(e){super(`SDK loading failed: ${e}`)}}class om{loadAndInit(){return rm(this,void 0,void 0,function*(){try{yield this.load(),(0,nm.Geh)(om.logLevel),om.markAsReady()}catch(e){om.markAsFailed(e)}})}}om.logLevel=nm.$bb.Info,om.Ready=new Promise((e,t)=>{om.markAsReady=e,om.markAsFailed=e=>t(new sm(e))});var am=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class lm{constructor(){}pick(e){return am(this,void 0,void 0,function*(){var t;if((null!==(t=null==e?void 0:e.length)&&void 0!==t?t:0)<=0)throw new Error("list must have at least one entry.");const i=yield this.uniform(0,e.length-1);return e[i]})}pickWord(e,t){return am(this,void 0,void 0,function*(){var i,n;let r=yield this.pick(e);if(null!==(i=null==t?void 0:t.titleCase)&&void 0!==i&&i&&(r=r.charAt(0).toUpperCase()+r.slice(1)),null!==(n=null==t?void 0:t.number)&&void 0!==n&&n){yield om.Ready;r+=nm.IEs.random_number(0,9).toString()}return r})}shuffle(e,t){return am(this,void 0,void 0,function*(){var i,n;if((null!==(i=null==e?void 0:e.length)&&void 0!==i?i:0)<=0)throw new Error("items must have at least one entry.");const r=null===(n=null==t?void 0:t.copy)||void 0===n||n?[...e]:e;for(let e=r.length-1;e>0;e--){const t=yield this.uniform(0,e);[r[e],r[t]]=[r[t],r[e]]}return r})}chars(e){return am(this,void 0,void 0,function*(){let t="";const i="abcdefghijklmnopqrstuvwxyz1234567890";for(let n=0;n<e;n++){const e=yield this.uniform(0,35);t+=i.charAt(e)}return t})}uniform(e,t){return am(this,void 0,void 0,function*(){return yield om.Ready,nm.IEs.random_number(e,t)})}}var cm=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class um{constructor(e,t){this.strategy=e,this.policy=t,this._evaluators$=new Map}options$(e){return this.strategy.durableState(e).state$}defaults$(e){return this.strategy.defaults$(e)}saveOptions(e,t){return cm(this,void 0,void 0,function*(){yield this.strategy.durableState(e).update(()=>t)})}evaluator$(e){let t=this._evaluators$.get(e);return t||(t=this.createEvaluator(e),this._evaluators$.set(e,t)),t}createEvaluator(e){return this.policy.policiesByType$(this.strategy.policy,e).pipe(this.strategy.toEvaluator())}enforcePolicy(e,t){return cm(this,void 0,void 0,function*(){const i=yield(0,bo._)(this.evaluator$(e)),n=i.applyPolicy(t);return i.sanitize(n)})}generate(e){return cm(this,void 0,void 0,function*(){return yield this.strategy.generate(e)})}}var dm=i(14928),hm=i(88507),pm=i(96141),vm=i(14803),fm=i(45505),mm=i(39444),gm=i(43219),ym=i(11891),bm=i(61687),wm=i(21991),Sm=i(57886),km=i(8131),Im=i(32097);function Cm(e){return e}function Tm(e,t){return{expectedValue:e,actualValue:t}}function Pm(e=Cm,t=Tm){return(0,fm.F)((0,kd.Z)(null),(0,mm.J)(),(0,l.T)(([i,n],r)=>{if(0===r)return n;const s=e(i),o=e(n);if(s===o)return n;throw t(s,o)}))}function Fm(e,t){return(0,l.T)(i=>(null!=i?i:[]).reduce(e,structuredClone(t)))}function Rm(){return(0,mo.F)((e,t)=>{let i=!0;for(const n in t)i&&(i=e[n]===t[n]);return i})}function xm(e){if(Array.isArray(e)){const t=e.filter(e=>!!e).map(e=>e.pipe((0,gm.w)(),(0,ym.q)(!0)));return(0,bm.O)(t)}return e.pipe((0,gm.w)(),(0,ym.q)(!0))}function Am(e){const t=Array.isArray(e)?e:[e];return(0,fm.F)((0,wm.N)(e=>{const i=new Ro.m(1);return e.subscribe(i),(0,Sm.x)((0,hm.y)(t).pipe((0,dm.$)(),(0,gm.w)()),i).pipe((0,vm.Q)(xm(i)))}))}function Dm(...e){return(0,wm.N)(t=>{const i=new Ro.m(1);t.subscribe(i);const n=e.map(e=>{const t=new Ro.m(1);return e.subscribe(t),t});return(0,Sm.x)((0,hm.y)(n).pipe((0,dm.$)(),(0,gm.w)()),i).pipe((0,km.E)(...n),(0,vm.Q)(xm(i)))})}function Em(e){return(0,fm.F)((null==e?void 0:e.distinct)?(0,mo.F)(e.distinct):e=>e,(0,l.T)((t,i)=>{var n,r;if(i>0)throw new Error(`${null!==(r=null===(n=null==e?void 0:e.name)||void 0===n?void 0:n.call(e))&&void 0!==r?r:"unknown"} observable should only emit one value.`);return t}))}function $m(e,t){return(0,fm.F)((0,Im.S)(([i],n)=>{var r,s,o,a;const l=null!==(s=null===(r=null==t?void 0:t.key)||void 0===r?void 0:r.call(t,n))&&void 0!==s?s:n;let c=null==i?void 0:i.get(l);if(c)return[i,c];c=e(n),null==i||i.set(l,c);const u=i.size-(null!==(o=null==t?void 0:t.size)&&void 0!==o?o:1);return u>0&&Array.from(null!==(a=null==i?void 0:i.keys())&&void 0!==a?a:[]).slice(0,u).forEach(e=>null==i?void 0:i.delete(e)),[i,c]},[new Map,null]),(0,l.T)(([,e])=>e),(0,Eo.p)(e=>!!e))}function Om(e){const t=Reflect.ownKeys(e);for(const i of t){const t=e[i];t&&"object"==typeof t&&Om(t)}return Object.freeze(e)}const Um=Object.freeze({password:"password",passphrase:"passphrase",username:"username",catchall:"catchall",plusAddress:"subaddress"}),Mm=Object.freeze({password:"password",username:"username",email:"email"}),Nm=Object.freeze({account:"account"}),Vm=Om({[Mm.password]:[Um.password,Um.passphrase],[Mm.username]:[Um.username],[Mm.email]:[Um.catchall,Um.plusAddress]});class Bm{constructor(e,t,i){this.metadata=e,this.settings=t,this.i18n=i}baseUrl(){var e,t;const i=null!==(e=this.settings&&"baseUrl"in this.settings?this.settings.baseUrl:void 0)&&void 0!==e?e:"";let n="";if(n="always"===this.metadata.selfHost?i:"never"===this.metadata.selfHost||i.length<=0?null!==(t=this.metadata.baseUrl)&&void 0!==t?t:"":i,""===n){throw this.i18n.t("forwarderNoUrl",this.metadata.name)}return n}authenticationToken(e=null){var t,i;let n="token"in this.settings&&null!==(t=this.settings.token)&&void 0!==t?t:"";if(""===n){throw this.i18n.t("forwaderInvalidToken",this.metadata.name)}return n+=null!==(i=null==e?void 0:e.suffix)&&void 0!==i?i:"",(null==e?void 0:e.base64)&&(n=bd.fromUtf8ToB64(n)),n}website(e,t){var i,n;let r=null!==(i=e.website)&&void 0!==i?i:"";return(null==t?void 0:t.extractHostname)&&(r=null!==(n=bd.getHost(r))&&void 0!==n?n:r),r.slice(0,null==t?void 0:t.maxLength)}generatedBy(e,t){var i;const n=this.website(e,{extractHostname:null!==(i=null==t?void 0:t.extractHostname)&&void 0!==i&&i}),r=""===n?"forwarderGeneratedBy":"forwarderGeneratedByWithWebsite";return this.i18n.t(r,n).slice(0,null==t?void 0:t.maxLength)}}class jm extends Bm{constructor(e,t,i){super(e,t,i),this.configuration=e}emailDomain(){var e;const t="domain"in this.settings&&null!==(e=this.settings.domain)&&void 0!==e?e:"";if(""===t){throw this.i18n.t("forwarderNoDomain",this.configuration.name)}return t}emailPrefix(){var e;const t="prefix"in this.settings&&null!==(e=this.settings.prefix)&&void 0!==e?e:"";if(""===t){throw this.i18n.t("forwarderNoPrefix",this.configuration.name)}return t}missingAccountIdCause(){return this.i18n.t("forwarderNoAccountId",this.configuration.name)}}class Gm{constructor(e,t,i,n,r){this.credential=e,this.category=t,this.source=n,this.website=r,this.generationDate="number"==typeof i?new Date(i):i}static fromJSON(e){return new Gm(e.credential,e.category,e.generationDate)}toJSON(){return{credential:this.credential,category:this.category,generationDate:this.generationDate.valueOf()}}}function Lm(e){const t=e.split("");return Object.freeze(t)}const zm=Lm("!@#$%^&*"),_m=Object.freeze({Full:Object.freeze({Uppercase:Lm("ABCDEFGHIJKLMNOPQRSTUVWXYZ"),Lowercase:Lm("abcdefghijklmnopqrstuvwxyz"),Digit:Lm("0123456789"),Special:zm}),Unmistakable:Object.freeze({Uppercase:Lm("ABCDEFGHJKLMNPQRSTUVWXYZ"),Lowercase:Lm("abcdefghijkmnopqrstuvwxyz"),Digit:Lm("23456789"),Special:zm})}),Km=new RegExp("(?<username>[^@+]+)(?<subaddress>\\+.+)?(?<domain>@.+)");var Xm=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class qm{constructor(e){this.random=e}randomAsciiSubaddress(e,t){return Xm(this,void 0,void 0,function*(){var i,n;let r=null!=e?e:"";const s=null!==(i=null==t?void 0:t.length)&&void 0!==i?i:8;if(s<1)return r;const o=Km.exec(r);if(!o)return r;let a=null!==(n=o.groups.subaddress)&&void 0!==n?n:"+";return a+=(yield this.random.chars(s)),r=`${o.groups.username}${a}${o.groups.domain}`,r})}randomAsciiCatchall(e,t){return Xm(this,void 0,void 0,function*(){var i;if(((null==e?void 0:e.startsWith("@"))?e.substring(1,1/0):null!=e?e:"").length<1)return null;const n=null!==(i=null==t?void 0:t.length)&&void 0!==i?i:8;if(n<1)return null;return`${yield this.random.chars(n)}@${e}`})}randomWordsCatchall(e,t){return Xm(this,void 0,void 0,function*(){var i,n;if(((null==e?void 0:e.startsWith("@"))?e.substring(1,1/0):null!=e?e:"").length<1)return null;const r=null!==(i=null==t?void 0:t.numberOfWords)&&void 0!==i?i:1;if(r<1)return null;const s=null!==(n=null==t?void 0:t.words)&&void 0!==n?n:Av,o=[];for(let e=0;e<r;e++)o[e]=yield this.random.pickWord(s,{titleCase:0!==e});return`${o.join("")}@${e}`})}generate(e,t){return Xm(this,void 0,void 0,function*(){if(function(e){return"catchallDomain"in(null!=e?e:{})}(t)){const i=yield this.randomAsciiCatchall(t.catchallDomain);return new Gm(i,Mm.email,Date.now(),e.source,e.website)}if(function(e){return"subaddressEmail"in(null!=e?e:{})}(t)){const i=yield this.randomAsciiSubaddress(t.subaddressEmail);return new Gm(i,Mm.email,Date.now(),e.source,e.website)}throw new Error("Invalid settings received by generator.")})}}class Wm{appendToSubaddress(e,t){var i;let n=(null!=t?t:"").trim();const r=(null!=e?e:"").trim();if(r.length<1)return n;const s=Km.exec(n);if(!s)return n;const o=(null!==(i=s.groups.subaddress)&&void 0!==i?i:"+")+r;return n=`${s.groups.username}${o}${s.groups.domain}`,n}concatenate(e,t){const i=(null==t?void 0:t.startsWith("@"))?t.substring(1,1/0):null!=t?t:"";if(i.length<1)return null;const n=null!=e?e:"";if(n.length<1)return null;return`${n}@${i}`}}function Ym(e){const t=new Map;return i=>{let n=t.get(i);if(void 0===n){const r=e();n=new Dd.t(Object.assign({},r)),t.set(i,n)}return n.asObservable()}}function Hm(e,t){return i=>t.getUser(i,e)}const Jm=(...e)=>(null!=e?e:[]).reduce((e,t)=>e+(null!=t?t:0),0);function Zm(e){var t,i;function n(e,t,i,n){return(null!=e?e:i)?null!=t?t:n:void 0}const r={uppercase:n(e.uppercase,e.minUppercase,Cf.uppercase,Cf.minUppercase),lowercase:n(e.lowercase,e.minLowercase,Cf.lowercase,Cf.minLowercase),digits:n(e.number,e.minNumber,Cf.number,Cf.minNumber),special:n(e.special,e.minSpecial,Cf.special,Cf.minSpecial),ambiguous:null!==(t=e.ambiguous)&&void 0!==t?t:Cf.ambiguous,all:0},s=Jm(r.uppercase,r.lowercase,r.digits,r.special),o=(null!==(i=e.length)&&void 0!==i?i:0)-s;return r.all=Math.max(o,0),r}function Qm(e){var t,i,n,r;const s=null!==(t=e.numWords)&&void 0!==t?t:If.numWords;return{numberOfWords:Math.max(s,wf.numWords.min),capitalize:null!==(i=e.capitalize)&&void 0!==i?i:If.capitalize,number:null!==(n=e.includeNumber)&&void 0!==n?n:If.includeNumber,separator:null!==(r=e.wordSeparator)&&void 0!==r?r:If.wordSeparator}}var eg=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class tg{constructor(e,t){this.randomizer=e,this.currentTime=t}randomAscii(e){return eg(this,void 0,void 0,function*(){const t=function(e){function t(e,t){const i=new Array(e>0?e:0);return i.fill(t,0,e),i}const i=[],n=e.ambiguous?_m.Full:_m.Unmistakable,r=[];void 0!==e.uppercase&&(r.push(...t(e.uppercase,n.Uppercase)),i.push(...n.Uppercase));void 0!==e.lowercase&&(r.push(...t(e.lowercase,n.Lowercase)),i.push(...n.Lowercase));void 0!==e.digits&&(r.push(...t(e.digits,n.Digit)),i.push(...n.Digit));void 0!==e.special&&(r.push(...t(e.special,n.Special)),i.push(...n.Special));return r.push(...t(e.all,i)),r}(e),i=(yield this.randomizer.shuffle(t)).flatMap(e=>this.randomizer.pick(e));return(yield Promise.all(i)).join("")})}randomEffLongWords(e){return eg(this,void 0,void 0,function*(){let t=-1;e.number&&(t=yield this.randomizer.uniform(0,e.numberOfWords-1));const i=new Array(e.numberOfWords);for(let n=0;n<e.numberOfWords;n++){const r=yield this.randomizer.pickWord(Av,{titleCase:e.capitalize,number:n===t});i[n]=r}return i.join(e.separator)})}generate(e,t){return eg(this,void 0,void 0,function*(){if(function(e){return"length"in(null!=e?e:{})}(t)){const i=Zm(t),n=yield this.randomAscii(i);return new Gm(n,Mm.password,this.currentTime(),e.source,e.website)}if(function(e){return"numWords"in(null!=e?e:{})}(t)){const i=Qm(t),n=yield this.randomEffLongWords(i);return new Gm(n,Mm.password,this.currentTime(),e.source,e.website)}throw new Error("Invalid settings received by generator.")})}}var ig=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class ng{constructor(e,t){this.client=e,this.currentTime=t}generate(e,t){return ig(this,void 0,void 0,function*(){if(function(e){return"length"in(null!=e?e:{})}(t)){const i=yield this.client.generator().password(function(e){return{lowercase:e.lowercase,uppercase:e.uppercase,numbers:e.number,special:e.special,length:e.length,avoidAmbiguous:e.ambiguous,minLowercase:e.minLowercase,minUppercase:e.minUppercase,minNumber:e.minNumber,minSpecial:e.minSpecial}}(t));return new Gm(i,Mm.password,this.currentTime(),e.source,e.website)}if(function(e){return"numWords"in(null!=e?e:{})}(t)){const i=yield this.client.generator().passphrase(function(e){return{numWords:e.numWords,wordSeparator:e.wordSeparator,capitalize:e.capitalize,includeNumber:e.includeNumber}}(t));return new Gm(i,Mm.password,this.currentTime(),e.source,e.website)}throw new Error("Invalid settings received by generator.")})}}var rg=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class sg{constructor(e){this.random=e}randomWords(e){return rg(this,void 0,void 0,function*(){var t,i,n;const r=null!==(t=null==e?void 0:e.numberOfWords)&&void 0!==t?t:1;if(r<1)return"";const s=Math.max(null!==(i=null==e?void 0:e.digits)&&void 0!==i?i:0,0);let o=e=>!1;"camelCase"===(null==e?void 0:e.casing)?o=e=>0!==e:"TitleCase"===(null==e?void 0:e.casing)&&(o=e=>!0);const a=null!==(n=null==e?void 0:e.words)&&void 0!==n?n:Av,l=[];for(let e=0;e<r;e++){const t=yield this.random.pickWord(a,{titleCase:o(e)});l.push(t)}for(let e=0;e<s;e++){const e=yield this.random.uniform(0,9);l.push(e.toString())}return l.join("")})}generate(e,t){return rg(this,void 0,void 0,function*(){if(function(e){return"wordIncludeNumber"in(null!=e?e:{})}(t)){const i=yield this.randomWords({digits:t.wordIncludeNumber?4:0,casing:t.wordCapitalize?"TitleCase":"lowercase"});return new Gm(i,"username",Date.now(),e.source,e.website)}throw new Error("Invalid settings received by generator.")})}}const og=new RegExp("[^@]+@(?<domain>.+)");class ag{constructor(e){var t;if(this.constraints={},!e)return void(this.domain="");const i=og.exec(e);i&&(null===(t=i.groups)||void 0===t?void 0:t.domain)&&(this.domain=i.groups.domain)}adjust(e){var t;if(""!==(null!==(t=e.catchallDomain)&&void 0!==t?t:"").trim())return e;const i=Object.assign({},e);return i.catchallDomain=this.domain,i}fix(e){return e}}const lg=Om({id:Um.catchall,type:Mm.email,weight:210,i18nKeys:{name:"catchallEmail",description:"catchallEmailDesc",credentialType:"email",generateCredential:"generateEmail",credentialGenerated:"emailGenerated",copyCredential:"copyEmail",useCredential:"useThisEmail"},capabilities:{autogenerate:!0,fields:[]},engine:{create(e){return new qm(e.randomizer)}},profiles:{[Nm.account]:{type:"core",storage:{key:"catchallGeneratorSettings",target:"object",format:"plain",classifier:new Rf(["catchallType","catchallDomain"]),state:me,initial:{catchallType:"random",catchallDomain:""},options:{deserializer:e=>e,clearOn:["logout"]}},constraints:{default:{catchallDomain:{minLength:1}},create(e,t){var i;return new ag(null!==(i=t.email)&&void 0!==i?i:"")}}}}});var cg=lg;class ug{constructor(e){this.email=e,this.constraints={},e||(this.email="")}adjust(e){var t;if(""!==(null!==(t=e.subaddressEmail)&&void 0!==t?t:"").trim())return e;const i=Object.assign({},e);return i.subaddressEmail=this.email,i}fix(e){return e}}const dg=Om({id:Um.plusAddress,type:Mm.email,weight:200,i18nKeys:{name:"plusAddressedEmail",description:"plusAddressedEmailDesc",credentialType:"email",generateCredential:"generateEmail",credentialGenerated:"emailGenerated",copyCredential:"copyEmail",useCredential:"useThisEmail"},capabilities:{autogenerate:!0,fields:[]},engine:{create(e){return new qm(e.randomizer)}},profiles:{[Nm.account]:{type:"core",storage:{key:"subaddressGeneratorSettings",target:"object",format:"plain",classifier:new Rf(["subaddressType","subaddressEmail"]),state:me,initial:{subaddressType:"random",subaddressEmail:""},options:{deserializer(e){return e},clearOn:["logout"]}},constraints:{default:{},create(e,t){var i;return new ug(null!==(i=t.email)&&void 0!==i?i:"")}}}}});var hg=dg;class pg{get policy(){return{}}get policyInEffect(){return!1}applyPolicy(e){return e}sanitize(e){return e}}const vg={min:0,max:0},fg={min:1},mg={requiredValue:!0};function gg(e,t){var i;const n=Jm(...t.map(e=>null==e?void 0:e.min));return bg(Math.max(null!==(i=null==e?void 0:e.min)&&void 0!==i?i:0,n),e)}function yg(e,t){return e?t:void 0}function bg(e,t){var i;if(null==e)return t;const n=Object.assign({},null!=t?t:{});return n.min=Math.max(null!==(i=n.min)&&void 0!==i?i:-1/0,e),"max"in n&&(n.max=Math.max(n.max,e)),n}function wg(e,t){if(!t)return e;const{min:i,max:n}=t,r=Math.min(null!=e?e:0,null!=n?n:1/0);return Math.max(r,null!=i?i:-1/0)}function Sg(e,t,i){if(!t)return e;const{minLength:n,maxLength:r}=t,{fillString:s}=null!=i?i:{fillString:" "},o=(null!=e?e:"").slice(0,null!=r?r:1/0);return o.padEnd(null!=n?n:o.length,s)}function kg(e,t){return(null==t?void 0:t.readonly)?t.requiredValue:e}function Ig(e){return yg(e,function(e,t){if(!e)return t;const i=Object.assign({},null!=t?t:{});return i.readonly=!0,i}(e,mg))}class Cg{constructor(e){this.constraints=e}adjust(e){const t=Object.assign(Object.assign({},null!=e?e:Cf),{length:wg(e.length,this.constraints.length),lowercase:kg(e.lowercase,this.constraints.lowercase),uppercase:kg(e.uppercase,this.constraints.uppercase),number:kg(e.number,this.constraints.number),special:kg(e.special,this.constraints.special),minLowercase:wg(e.minLowercase,this.constraints.minLowercase),minUppercase:wg(e.minUppercase,this.constraints.minUppercase),minNumber:wg(e.minNumber,this.constraints.minNumber),minSpecial:wg(e.minSpecial,this.constraints.minSpecial)});t.lowercase||(t.lowercase=e.minLowercase>0),t.uppercase||(t.uppercase=e.minUppercase>0),t.number||(t.number=e.minNumber>0),t.special||(t.special=e.minSpecial>0);return[t.lowercase,t.uppercase,t.number,t.special].some(e=>e)||(t.lowercase=!0,t.uppercase=!0),t}fix(e){return e}}class Tg{constructor(e,t){this.defaults=t;const i=yg(e.useLowercase,fg),n=yg(e.useUppercase,fg),r=bg(e.numberCount||e.useNumbers&&fg.min,t.minNumber),s=bg(e.specialCount||e.useSpecial&&fg.min,t.minSpecial),o=gg(bg(e.minLength,t.length),[i,n,r,s]);this.constraints=Object.freeze({policyInEffect:Pg(e,t),lowercase:Ig(e.useLowercase),uppercase:Ig(e.useUppercase),number:Ig(e.useNumbers),special:Ig(e.useSpecial),length:o,minLowercase:i,minUppercase:n,minNumber:r,minSpecial:s})}calibrate(e){var t,i,n,r,s,o,a,l;const c=e.lowercase||(null===(t=this.constraints.lowercase)||void 0===t?void 0:t.requiredValue)||!1,u=e.uppercase||(null===(i=this.constraints.uppercase)||void 0===i?void 0:i.requiredValue)||!1,d=e.number||(null===(n=this.constraints.number)||void 0===n?void 0:n.requiredValue)||!1,h=e.special||(null===(r=this.constraints.special)||void 0===r?void 0:r.requiredValue)||!1,p=Object.assign(Object.assign({},this.constraints),{minLowercase:yg(c,null!==(s=this.constraints.minLowercase)&&void 0!==s?s:fg),minUppercase:yg(u,null!==(o=this.constraints.minUppercase)&&void 0!==o?o:fg),minNumber:null!==(a=yg(d,this.constraints.minNumber))&&void 0!==a?a:vg,minSpecial:null!==(l=yg(h,this.constraints.minSpecial))&&void 0!==l?l:vg});p.length=gg(this.constraints.length,[bg(e.minNumber,p.minNumber),bg(e.minSpecial,p.minSpecial),bg(e.minLowercase,p.minLowercase),bg(e.minUppercase,p.minUppercase)]);return new Cg(p)}}function Pg(e,t){return[e.useUppercase,e.useLowercase,e.useNumbers,e.useSpecial,e.minLength>t.length.min,e.numberCount>t.minNumber.min,e.specialCount>t.minSpecial.min].includes(!0)}class Fg{constructor(e){var t,i;this.policy=structuredClone(e),this.numWords=(t=e.minNumberWords,i=wf.numWords,{min:Math.max(i.min,t),max:Math.max(i.max,t)})}get policyInEffect(){return[this.policy.capitalize,this.policy.includeNumber,this.policy.minNumberWords>wf.numWords.min].includes(!0)}applyPolicy(e){const t=this.policy.capitalize||e.capitalize||!1,i=this.policy.includeNumber||e.includeNumber||!1,n=function(e,t){const{min:i,max:n}=t,r=Math.min(null!=e?e:t.min,n);return Math.max(r,i)}(e.numWords,this.numWords);return Object.assign(Object.assign({},e),{numWords:n,capitalize:t,includeNumber:i})}sanitize(e){var t,i;const n=""===e.wordSeparator?"":null!==(i=null===(t=e.wordSeparator)||void 0===t?void 0:t[0])&&void 0!==i?i:If.wordSeparator;return Object.assign(Object.assign({},e),{wordSeparator:n})}}class Rg{constructor(e,t){this.policy=e,this.defaults=t,this.constraints={policyInEffect:xg(e,t),wordSeparator:{minLength:0,maxLength:1},capitalize:Ig(e.capitalize),includeNumber:Ig(e.includeNumber),numWords:bg(e.minNumberWords,t.numWords)}}adjust(e){return{wordSeparator:Sg(e.wordSeparator,this.constraints.wordSeparator,{fillString:If.wordSeparator}),capitalize:kg(e.capitalize,this.constraints.capitalize),includeNumber:kg(e.includeNumber,this.constraints.includeNumber),numWords:wg(e.numWords,this.constraints.numWords)}}fix(e){return e}}function xg(e,t){return[e.capitalize,e.includeNumber,e.minNumberWords>t.numWords.min].includes(!0)}class Ag{get minNumber(){return this.minDigits}get minSpecial(){return this.minSpecialCharacters}constructor(e){function t(e,t){return{min:Math.max(t.min,e),max:Math.max(t.max,e)}}this.policy=structuredClone(e),this.minDigits=t(e.numberCount,Sf.minDigits),this.minSpecialCharacters=t(e.specialCount,Sf.minSpecialCharacters);const i=this.minDigits.min+this.minSpecialCharacters.min,n=e.minLength>0?e.minLength:Sf.length.min,r=Math.max(n,i,Sf.length.min);this.length={min:r,max:Math.max(Sf.length.max,r)}}get policyInEffect(){return[this.policy.useUppercase,this.policy.useLowercase,this.policy.useNumbers,this.policy.useSpecial,this.policy.minLength>Sf.length.min,this.policy.numberCount>Sf.minDigits.min,this.policy.specialCount>Sf.minSpecialCharacters.min].includes(!0)}applyPolicy(e){function t(e,t){const{min:i,max:n}=t,r=Math.min(e||0,n);return Math.max(r,i)}const i=this.policy.useUppercase||e.uppercase||!1,n=this.policy.useLowercase||e.lowercase||!1,r=this.policy.useNumbers||e.number||e.minNumber>0,s=this.policy.useSpecial||e.special||e.minSpecial>0,o=t(e.length,this.length),a=t(e.minNumber,this.minDigits),l=t(e.minSpecial,this.minSpecialCharacters);return Object.assign(Object.assign({},e),{length:o,uppercase:i,lowercase:n,number:r,minNumber:a,special:s,minSpecial:l})}sanitize(e){var t;function i(e,t){const i=null!=e?e:t>0;return[i,i?t||1:0]}const[n,r]=i(e.lowercase,e.minLowercase),[s,o]=i(e.uppercase,e.minUppercase),[a,l]=i(e.number,e.minNumber),[c,u]=i(e.special,e.minSpecial),d=r+o+l+u,h=Math.max(d,this.length.min),p=Math.max(null!==(t=e.length)&&void 0!==t?t:h,h);return Object.assign(Object.assign({},e),{length:p,minLength:h,lowercase:n,minLowercase:r,uppercase:s,minUppercase:o,number:a,minNumber:l,special:c,minSpecial:u})}}function Dg(e,t){var i;return t.type!==op.PasswordGenerator?e:{minNumberWords:Math.max(e.minNumberWords,null!==(i=t.data.minNumberWords)&&void 0!==i?i:e.minNumberWords),capitalize:t.data.capitalize||e.capitalize,includeNumber:t.data.includeNumber||e.includeNumber}}function Eg(e,t){var i,n,r;return t.type===op.PasswordGenerator&&t.enabled?{minLength:Math.max(e.minLength,null!==(i=t.data.minLength)&&void 0!==i?i:e.minLength),useUppercase:t.data.useUpper||e.useUppercase,useLowercase:t.data.useLower||e.useLowercase,useNumbers:t.data.useNumbers||e.useNumbers,numberCount:Math.max(e.numberCount,null!==(n=t.data.minNumbers)&&void 0!==n?n:e.numberCount),useSpecial:t.data.useSpecial||e.useSpecial,specialCount:Math.max(e.specialCount,null!==(r=t.data.minSpecial)&&void 0!==r?r:e.specialCount)}:e}class $g{constructor(e,t,i){this.algorithms=e,this.isAvailable=t,this.system=i,this.constraints={},this.log=i.log({type:"AvailableAlgorithmsConstraint"})}adjust(e){const t={},i=Object.keys(e);for(const n of i)t[n]=this.adjustPreference(n,e[n]);return t}adjustPreference(e,t){var i;if(this.isAvailable(t.algorithm))return this.log.debug({preference:t,type:e},"using preferred algorithm"),t;const n=null!==(i=(e?this.algorithms({type:e}):[]).find(this.isAvailable))&&void 0!==i?i:null;let r;return n?(r=Object.assign(Object.assign({},t),{algorithm:n,updated:this.system.now()}),this.log.debug({preference:t,defaultAlgorithm:n,type:e},"preference not available; defaulting the algorithm")):(this.log.warn({preference:t,type:e},"preference not available and default algorithm not found; continuing with preference"),r=t),r}fix(e){return e}}var Og={id:Um.passphrase,type:Mm.password,weight:110,i18nKeys:{name:"passphrase",credentialType:"passphrase",generateCredential:"generatePassphrase",credentialGenerated:"passphraseGenerated",copyCredential:"copyPassphrase",useCredential:"useThisPassphrase"},capabilities:{autogenerate:!0,fields:[]},engine:{create(e){return null==e.sdk?new tg(e.randomizer,e.now):new ng(e.sdk,e.now)}},profiles:{[Nm.account]:{type:"core",storage:{key:"passphraseGeneratorSettings",target:"object",format:"plain",classifier:new Rf(["numWords","wordSeparator","capitalize","includeNumber"]),state:me,initial:{numWords:6,wordSeparator:"-",capitalize:!1,includeNumber:!1},options:{deserializer(e){return e},clearOn:["logout"]}},constraints:{type:op.PasswordGenerator,default:{wordSeparator:{maxLength:1},numWords:{min:3,max:20,recommendation:6}},create(e,t){const i=e.reduce(Dg,{minNumberWords:0,capitalize:!1,includeNumber:!1});return new Rg(i,t.defaultConstraints)}}}}};var Ug=Om({id:Um.password,type:Mm.password,weight:100,i18nKeys:{name:"password",generateCredential:"generatePassword",credentialGenerated:"passwordGenerated",credentialType:"password",copyCredential:"copyPassword",useCredential:"useThisPassword"},capabilities:{autogenerate:!0,fields:[]},engine:{create(e){return null==e.sdk?new tg(e.randomizer,e.now):new ng(e.sdk,e.now)}},profiles:{[Nm.account]:{type:"core",storage:{key:"passwordGeneratorSettings",target:"object",format:"plain",classifier:new Rf(["length","ambiguous","uppercase","minUppercase","lowercase","minLowercase","number","minNumber","special","minSpecial"]),state:me,initial:{length:14,ambiguous:!0,uppercase:!0,minUppercase:1,lowercase:!0,minLowercase:1,number:!0,minNumber:1,special:!1,minSpecial:0},options:{deserializer(e){return e},clearOn:["logout"]}},constraints:{type:op.PasswordGenerator,default:{length:{min:5,max:128,recommendation:14},minNumber:{min:0,max:9},minSpecial:{min:0,max:9}},create(e,t){const i=e.reduce(Eg,{minLength:0,useUppercase:!1,useLowercase:!1,useNumbers:!1,numberCount:0,useSpecial:!1,specialCount:0});return new Tg(i,t.defaultConstraints)}}}}});const Mg=new Proxy(Object.freeze({}),{get(){return{}}});class Ng{constructor(){this.constraints=Mg}calibrate(){return this}adjust(e){return e}fix(e){return e}}var Vg=Om({id:Um.username,type:Mm.username,weight:400,i18nKeys:{name:"randomWord",credentialType:"username",generateCredential:"generateUsername",credentialGenerated:"usernameGenerated",copyCredential:"copyUsername",useCredential:"useThisUsername"},capabilities:{autogenerate:!0,fields:[]},engine:{create(e){return new sg(e.randomizer)}},profiles:{[Nm.account]:{type:"core",storage:{key:"effUsernameGeneratorSettings",target:"object",format:"plain",classifier:new Rf(["wordCapitalize","wordIncludeNumber"]),state:me,initial:{wordCapitalize:!1,wordIncludeNumber:!1,website:null},options:{deserializer:e=>e,clearOn:["logout"]}},constraints:{default:{},create(e,t){return new Ng}}}}});class Bg{constructor(e,t){this.requestor=e,this.context=t}get createForwardingEmail(){return this.requestor.forwarder.createForwardingEmail}toRequest(e){const t=this.createForwardingEmail.url(e,this.context),i=this.requestor.authenticate(e,this.context),n=this.body(e);return new Request(t,{redirect:"manual",cache:"no-store",method:"POST",headers:new Headers(Object.assign(Object.assign({},i),{"Content-Type":"application/json",Accept:"application/json"})),body:n})}body(e){const t=this.createForwardingEmail.body;if(!t)return;const i=t(e,this.context);return i?JSON.stringify(i):void 0}hasJsonPayload(e){return this.createForwardingEmail.hasJsonPayload(e,this.context)}processJson(e){return this.createForwardingEmail.processJson(e,this.context)}}class jg{constructor(e,t){this.requestor=e,this.context=t}hasJsonPayload(e){return this.requestor.forwarder.getAccountId.hasJsonPayload(e,this.context)}processJson(e){return this.requestor.forwarder.getAccountId.processJson(e,this.context)}toRequest(e){const t=this.requestor.forwarder.getAccountId.url(e,this.context),i=this.requestor.authenticate(e,this.context);return new Request(t,{redirect:"manual",cache:"no-store",method:"GET",headers:new Headers(Object.assign(Object.assign({},i),{"Content-Type":"application/json",Accept:"application/json"}))})}}var Gg=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Lg{constructor(e,t,i){this.configuration=e,this.client=t,this.i18nService=i}generate(e,t){return Gg(this,void 0,void 0,function*(){const i={website:e.website},n=yield this.getAccountId(this.configuration,t);n&&(i.accountId=yield this.client.fetchJson(n,i));const r=this.createForwardingAddress(this.configuration,t),s=yield this.client.fetchJson(r,i);return new Gm(s,Mm.email,Date.now())})}createContext(e,t){return new jm(e,t,this.i18nService)}createForwardingAddress(e,t){const i=this.createContext(e,t);return new Bg(e,i)}getAccountId(e,t){if(!e.forwarder.getAccountId)return null;const i=this.createContext(e,t);return new jg(e,i)}}function zg(e){var t;if("forwarder"!==e.site.id)throw new Error(`expected forwarder extension; received ${e.site.id} (${e.product.vendor.id})`);const i={literal:null!==(t=e.product.name)&&void 0!==t?t:e.product.vendor.name},n={id:{forwarder:e.product.vendor.id},type:Mm.email,weight:300,i18nKeys:{name:i,description:"forwardedEmailDesc",generateCredential:"generateEmail",credentialGenerated:"emailGenerated",useCredential:"useThisEmail",credentialType:"email",copyCredential:"copyEmail"},capabilities:{autogenerate:!1,fields:[...e.requestedFields]},engine:{create(t){const i=function(e){const t=im.get(e);return t&&"forwarder"in t?t:null}(e.product.vendor.id);return new Lg(i,t.client,t.i18nService)}},profiles:{[Nm.account]:{type:"extension",site:"forwarder",storage:{key:"forwarder",frame:512,initial:{token:"",baseUrl:"",domain:"",prefix:""},options:{deserializer:e=>e,clearOn:["logout"]}},constraints:{default:{},create(){return new Ng}}}}};return n}function _g(e){return Vm.password.includes(e)}function Kg(e){return Vm.username.includes(e)}function Xg(e){return!(!e||"object"!=typeof e||!("forwarder"in e))}function qg(e){return Vm.email.includes(e)||Xg(e)}function Wg(e,t){return e===t||!(!Xg(e)||!Xg(t))&&e.forwarder===t.forwarder}const Yg=Object.freeze({catchall:cg,plusAddress:hg,passphrase:Og,password:Ug,effWordList:Vg}),Hg=Vm,Jg=Object.freeze(Object.values(Um)),Zg=Object.freeze(Object.values(Mm));function Qg(e){return!!e.algorithm}function ey(e){return!!e.type}const ty=18e4;var iy=i(12916),ny=i(62179);function ry(e){return!!e&&"id"in e&&"secret"in e&&"disclosed"in e&&"string"==typeof e.secret&&"object"==typeof e.disclosed}function sy(e){return e&&"calibrate"in e}var oy=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const ay="$^$ALWAYS_UPDATE_KLUDGE_PROPERTY$^$";class ly extends aa.c{constructor(e,t,i){var n,r,s;super(),this.key=e,this.providers=t,this.context=i,this.input=new Ro.m(1),this.output=new Ro.m(1),this.counter=0,!function(e){return"object"===e.target&&"format"in e&&"classifier"in e}(this.key)?(this.objectKey=null,this.stateKey=this.key):(this.objectKey=this.key,this.stateKey=function(e){if("plain"===e.format)return new k(e.state,e.key,e.options);if("classified"===e.format)return new k(e.state,e.key,{cleanupDelayMs:e.options.cleanupDelayMs,deserializer:e=>e,clearOn:e.options.clearOn});if("secret-state"===e.format)return new k(e.state,e.key,{cleanupDelayMs:e.options.cleanupDelayMs,deserializer:e=>e,clearOn:e.options.clearOn});throw new Error(`unknown format: ${e.format}`)}(this.key)),this.log=this.providers.log({contextId:this.contextId,type:"UserStateSubject",storage:{state:this.stateKey.stateDefinition.name,key:this.stateKey.key}});const o=(null!==(n=this.context.when$)&&void 0!==n?n:new Dd.t(!0)).pipe((0,mo.F)()),a=i.account$.pipe(Em({name:()=>`${this.contextId} { account$ }`,distinct(e,t){return e.id===t.id}}),(0,Gp.t)({refCount:!0,bufferSize:1})),c=this.encryptor(a),u=(null!==(r=this.context.constraints$)&&void 0!==r?r:function(){const e=new Ng;return new Dd.t(e)}()).pipe((0,Ed.W)(e=>(this.log.error(e,"constraints$ dependency failed; using last-known constraints"),Wp.w)),(0,Gp.t)({refCount:!0,bufferSize:1})),d=(null!==(s=this.context.dependencies$)&&void 0!==s?s:new Dd.t(null)).pipe((0,Gp.t)({refCount:!0,bufferSize:1})),h=a.pipe((0,Oo.M)(e=>this.log.debug({accountId:e.id},"loading user state")),(0,l.T)(e=>this.providers.state.getUser(e.id,this.stateKey)),(0,Gp.t)({refCount:!0,bufferSize:1}));this.outputSubscription=h.pipe((0,go.n)(e=>e.state$),(0,l.T)(e=>(e&&"object"==typeof e&&ay in e&&delete e[ay],e)),this.declassify(c),this.adjust((0,Yp.v)(u)),(0,vm.Q)(xm(a))).subscribe(this.output);const p=new Ro.m(1);this.output.pipe((0,iy.H)(),(0,l.T)(e=>e.state)).subscribe(p);const v=(0,Sm.x)(this.input.pipe(this.when(o),this.adjust(Dm(u)),this.prepareUpdate(this,d)),p.pipe(this.fix(u),this.prepareUpdate(p,d)));this.inputSubscription=v.pipe(this.classify(c),(0,km.E)(h),(0,vm.Q)(xm([o,this.input,c]))).subscribe({next:([e,t])=>this.onNext(e,t),error:e=>this.onError(e),complete:()=>this.onComplete()})}get contextId(){return`UserStateSubject(${this.stateKey.stateDefinition.name}, ${this.stateKey.key})`}encryptor(e){var t,i;const n=e.pipe((0,l.T)(e=>e.id)),r=null!==(i=null===(t=this.objectKey)||void 0===t?void 0:t.frame)&&void 0!==i?i:32;return this.providers.encryptor.userEncryptor$(r,{singleUserId$:n}).pipe((0,Oo.M)(()=>this.log.debug("encryptor constructed")),(0,l.T)(({encryptor:e})=>e),(0,Gp.t)({refCount:!0,bufferSize:1}))}when(e){return(0,fm.F)((0,Yp.v)(e.pipe((0,mo.F)())),(0,Oo.M)(([e,t])=>this.log.debug({when:t},"when status")),(0,Eo.p)(([e,t])=>!!t),(0,l.T)(([e])=>e))}prepareUpdate(e,t){return i=>(0,Sm.x)(e.pipe((0,dm.$)(),(0,l.T)(e=>[e,null])),i.pipe((0,l.T)(e=>e.state),(0,km.E)(t))).pipe((0,Im.S)(([e],[t,i])=>{var n,r,s,o,a,l;if(null===(s=null===(r=(n=this.context).shouldUpdate)||void 0===r?void 0:r.call(n,e,t,i))||void 0===s||s){return[null!==(l=null===(a=(o=this.context).nextValue)||void 0===a?void 0:a.call(o,e,t,i))&&void 0!==l?l:t,i]}return this.log.debug("shouldUpdate prevented write"),[e,null]}),(0,ny.i)(1),(0,l.T)(([e])=>e),(0,mo.F)())}adjust(e){return(0,fm.F)(e,(0,l.T)(([e,t])=>{var i;if(!e&&!(null===(i=this.objectKey)||void 0===i?void 0:i.initial))return this.log.debug("no value; bypassing adjustment"),{constraints:{},state:null};this.log.debug("adjusting");const n=null!=e?e:structuredClone(this.objectKey.initial),r=sy(t)?t.calibrate(n):t,s=r.adjust(n);return this.log.debug("adjusted"),{constraints:r.constraints,state:s}}))}fix(e){return(0,fm.F)((0,Yp.v)(e),(0,l.T)(([e,t])=>{this.log.debug("fixing");const i=sy(t)?t.calibrate(e):t,n=i.fix(e);return this.log.debug("fixed"),{constraints:i.constraints,state:n}}))}declassify(e){return this.objectKey&&"plain"!==this.objectKey.format?(0,fm.F)(this.mapToClassifiedFormat(),(0,Yp.v)(e),(0,To.H)(e=>oy(this,[e],void 0,function*([e,t]){if(null==e)return this.log.debug("no value; bypassing declassification"),null;this.log.debug("declassifying");const{secret:i,disclosed:n}=e,r=Pp.fromJSON(i),s=yield t.decrypt(r),o=this.objectKey.classifier.declassify(n,s),a=this.objectKey.options.deserializer(o);return this.log.debug("declassified"),a}))):(this.log.debug("key uses plain format; bypassing declassification"),e=>e)}mapToClassifiedFormat(){return this.objectKey&&"classified"===this.objectKey.format?(0,l.T)(e=>ry(e)?e:(this.log.warn("classified data must be in classified format; dropping"),null)):this.objectKey&&"secret-state"===this.objectKey.format?(0,l.T)(e=>{if(!Array.isArray(e))return this.log.warn("secret-state requires array formatting; dropping"),null;const[t]=e;return ry(t)?t:(this.log.warn("unwrapped secret-state must be in classified format; dropping"),null)}):void this.log.panic({format:this.objectKey.format},"unsupported serialization format")}classify(e){return this.objectKey&&"plain"!==this.objectKey.format?(0,fm.F)(Dm(e),(0,To.H)(e=>oy(this,[e],void 0,function*([e,t]){if(null==e)return this.log.debug("no value; bypassing classification"),null;this.log.debug("classifying");const i=JSON.parse(JSON.stringify(e)),n=this.objectKey.classifier.classify(i),r=yield t.encrypt(n.secret),s={id:null,secret:JSON.parse(JSON.stringify(r)),disclosed:n.disclosed};return this.log.debug("classified"),s})),this.mapToStorageFormat()):(this.log.debug("key uses plain format; bypassing classification"),(0,fm.F)(Am(e),(0,l.T)(e=>e)))}mapToStorageFormat(){return this.objectKey&&"classified"===this.objectKey.format?(0,l.T)(e=>e):this.objectKey&&"secret-state"===this.objectKey.format?(0,l.T)(e=>[e]):void this.log.panic({format:this.objectKey.format},"unsupported serialization format")}next(e){var t;null===(t=this.input)||void 0===t||t.next(e)}error(e){var t;null===(t=this.input)||void 0===t||t.error(e)}complete(){var e;null===(e=this.input)||void 0===e||e.complete()}subscribe(e){return this.output.pipe((0,l.T)(e=>e.state),(0,mo.F)()).subscribe(e)}get withConstraints$(){return this.output.asObservable()}onNext(e,t){t.update(()=>{if(this.log.debug("updating"),"object"==typeof e){const t=this.counter++;t>Number.MAX_SAFE_INTEGER&&(this.counter=0);Object.assign({},e)[ay]=t}return this.log.debug("updated"),e}).catch(e=>{this.log.error(e,"updating failed"),this.onError(e)})}onError(e){this.isDisposed||(this.log.debug(e,"forwarding error to subscribers"),this.output.error(e)),this.dispose()}onComplete(){this.isDisposed||this.output.complete(),this.dispose()}get isDisposed(){return null===this.input}dispose(){var e,t;this.isDisposed||(this.log.debug("disposing"),null===(e=this.inputSubscription)||void 0===e||e.unsubscribe(),null===(t=this.outputSubscription)||void 0===t||t.unsubscribe(),this.inputSubscription=null,this.outputSubscription=null,this.input=null,this.log.debug("disposed"))}}const cy=new k(me,"credentialPreferences",{deserializer:e=>{var t;const i=null!==(t=e)&&void 0!==t?t:{};for(const e in Hg){const t=e;if(i[t])i[t].updated=new Date(i[t].updated);else{const[e]=Hg[t];i[t]={algorithm:e,updated:new Date}}}return i},clearOn:["logout"]});class uy{constructor(e,t,i){this.system=e,this.application=t,this.log=e.log({type:"GeneratorMetadataProvider"});const n=t.extension.site("forwarder");n||this.log.panic("forwarder extension site not found"),this.site=n,this._metadata=new Map(i.map(e=>[e.id,e]))}metadata(e){let t=null;if(Xg(e)){const i=this.site.extensions.get(e.forwarder);i||this.log.panic(e,"extension not found"),t=zg(i)}else t=this._metadata.get(e);return t||this.log.panic({algorithm:e},"metadata not found"),t}types(){return Zg}algorithms(e){let t;if(ey(e)){let i=[];e.type===Mm.email&&(i=Array.from(this.site.extensions.keys()).map(e=>({forwarder:e}))),t=Hg[e.type].concat(i)}else Qg(e)&&Xg(e.algorithm)?t=this.site.extensions.has(e.algorithm.forwarder)?[e.algorithm]:[]:Qg(e)?t=Jg.includes(e.algorithm)?[e.algorithm]:[]:this.log.panic(e,"algorithm or type required");return t}isAvailable$(e){const t=e.account$.pipe((0,l.T)(e=>e.id),Em(),(0,Gp.t)({bufferSize:1,refCount:!0})),i=t.pipe((0,go.n)(e=>{const i=this.application.policy.policiesByType$(op.PasswordGenerator,e).pipe((0,l.T)(e=>function(e){const t=e.filter(e=>e.type===op.PasswordGenerator&&e.enabled).reduce((e,t)=>{var i;return"password"===e?e:null!==(i=t.data.overridePasswordType)&&void 0!==i?i:e},null),i=[...Hg[Mm.email],...Hg[Mm.username]];return t?i.push(t):i.push(...Hg[Mm.password]),i}(e).filter(e=>this._metadata.has(e)).sort()),$m(e=>new Set(e),{key:e=>e.join(":")}),(0,mo.F)(),(0,vm.Q)(xm(t)));return i}),(0,l.T)(e=>function(t){return Xg(t)||e.has(t)}));return i}algorithms$(e,t){if(ey(e)){const{type:i}=e;return this.isAvailable$(t).pipe((0,l.T)(e=>this.algorithms({type:i}).filter(e)))}if(Qg(e)){const{algorithm:i}=e;return this.isAvailable$(t).pipe((0,l.T)(e=>e(i)?[i]:[]))}this.log.panic(e,"algorithm or type required")}preference$(e,t){const i=t.account$.pipe((0,Gp.t)({bufferSize:1,refCount:!0}));return this.preferences({account$:i}).pipe((0,l.T)(t=>t[e].algorithm),(0,mo.F)())}preferences(e){const t=e.account$.pipe((0,Gp.t)({bufferSize:1,refCount:!0})),i=this.isAvailable$({account$:t}).pipe((0,l.T)(e=>new $g(this.algorithms.bind(this),e,this.system)));return new ly(cy,this.system,{account$:t,constraints$:i})}}class dy{constructor(e,t){this.providers=e,this.policyService=t,this.log=e.log({type:"GeneratorProfileProvider"})}settings(e,t){const i=t.account$.pipe((0,Gp.t)({bufferSize:1,refCount:!0})),n=this.constraints$(e,{account$:i});return new ly(e.storage,this.providers,{constraints$:n,account$:i})}constraints$(e,t){const i=t.account$.pipe((0,Gp.t)({bufferSize:1,refCount:!0})),n=i.pipe((0,mo.F)((e,t)=>e.email===t.email&&e.emailVerified===t.emailVerified),(0,go.n)(t=>{var i;this.log.debug({accountId:t.id,profileType:e.type,policyType:null!==(i=e.constraints.type)&&void 0!==i?i:"N/A",defaultConstraints:e.constraints.default},"initializing constraints$");const n=e.constraints.type?this.policyService.policiesByType$(e.constraints.type,t.id):(0,Go.of)([]),r={defaultConstraints:e.constraints.default};t.emailVerified&&(this.log.debug({email:t.email},"verified email detected; including in context"),r.email=t.email);const s=n.pipe((0,l.T)(t=>e.constraints.create(t,r)),(0,mo.F)((e,t)=>function(e,t){var i,n;if(e.constraints.policyInEffect!==t.constraints.policyInEffect)return!1;const r=Object.keys(e.constraints);for(const s of r){if(!(s in t.constraints))return!1;const r=null!==(i=e.constraints[s])&&void 0!==i?i:{},o=null!==(n=t.constraints[s])&&void 0!==n?n:{};if(Object.keys(r).some(e=>r[e]!==o[e]))return!1}return!0}(e,t)),(0,Oo.M)(e=>this.log.debug(e,"constraints updated")));return s}),(0,vm.Q)(xm(i)));return n}}function hy(e){return(0,fm.F)(Fm(e.combine,e.disabledValue),Rm(),(0,l.T)(e.createEvaluator))}function py(){return()=>(0,fm.F)((0,l.T)(e=>new pg))}class vy{}var fy=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class my extends vy{constructor(e,t,i,n){super(),this.userId=e,this.encryptService=t,this.key=i,this.dataPacker=n,this.assertHasValue("userId",e),this.assertHasValue("key",i),this.assertHasValue("dataPacker",n),this.assertHasValue("encryptService",t)}encrypt(e){return fy(this,void 0,void 0,function*(){this.assertHasValue("secret",e);let t=this.dataPacker.pack(e);const i=yield this.encryptService.encryptString(t,this.key);return t=null,i})}decrypt(e){return fy(this,void 0,void 0,function*(){this.assertHasValue("secret",e);let t=yield this.encryptService.decryptString(e,this.key);const i=this.dataPacker.unpack(t);return t=null,i})}assertHasValue(e,t){if(null==t)throw new Error(`${e} cannot be null or undefined`)}}var gy=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class yy{constructor(e,t,i,n=null){this.key=t,this.output=i,this.bufferedState=e.getUser(i.userId,t.toKeyDefinition());const r=(0,Sm.x)((0,Go.of)(null),this.bufferedState.state$).pipe((0,l.T)(e=>null!==(null!=e?e:null))),s=(null!=n?n:(0,Go.of)(!0)).pipe((0,l.T)(e=>[t.shouldOverwrite(e),e])),o=(0,jo.z)([r,s]).pipe((0,To.H)(e=>gy(this,[e],void 0,function*([e,[t,i]]){return e&&t&&(yield this.overwriteOutput(i)),[!1,null]}))),a=this.output.state$.pipe((0,l.T)(e=>[!0,e]));this.state$=(0,Po.h)(o,a).pipe((0,Eo.p)(([e])=>e),(0,l.T)(([,e])=>e)),this.combinedState$=this.state$.pipe((0,l.T)(e=>[this.output.userId,e])),this.bufferedState$=this.bufferedState.state$}overwriteOutput(e){return gy(this,void 0,void 0,function*(){let t;yield this.bufferedState.update(e=>(t=null!=e?e:null,null));if(yield this.key.isValid(t,e)){const i=yield this.key.map(t,e);yield this.output.update(()=>i)}})}get userId(){return this.output.userId}buffer(e){return gy(this,void 0,void 0,function*(){const t=null!=e?e:null;null!==t&&(yield this.bufferedState.update(()=>t))})}update(e,t=null){return this.output.update(e,t)}}class by{}const wy=Object.freeze({padding:"0",divider:"|",hasInvalidPadding:/[^0]/});class Sy extends by{constructor(e){super(),this.frameSize=e}pack(e){const t=JSON.stringify(e),i=bd.fromUtf8ToB64(t),n=JSON.stringify(this.frameSize),r=2*wy.divider.length,s=i.length+n.length+r,o=this.frameSize-s%this.frameSize;return`${n}|${i}|${wy.padding.repeat(o)}`}unpack(e){const t=e.indexOf(wy.divider);if(t<1)throw new Error("missing frame size");const i=parseInt(e.slice(0,t),10),n=t+1;if(e.length%i>0)throw new Error("invalid length");const r=e.lastIndexOf(wy.divider);if(r==t)throw new Error("missing json object");const s=r+1;if(e.slice(s).match(wy.hasInvalidPadding))throw new Error("invalid padding");const o=e.slice(n,r),a=bd.fromB64ToUtf8(o);return JSON.parse(a)}}class ky{constructor(e,t,i,n,r,s){this.stateDefinition=e,this.key=t,this.classifier=i,this.options=n,this.deconstruct=r,this.reconstruct=s}toEncryptedStateKey(){return new k(this.stateDefinition,this.key,{cleanupDelayMs:this.options.cleanupDelayMs,deserializer:e=>e,clearOn:this.options.clearOn})}static value(e,t,i,n){return new ky(e,t,i,n,e=>[[null,e]],([[,e]])=>e)}static array(e,t,i,n){return new ky(e,t,i,n,e=>e.map((e,t)=>[t,e]),e=>e.map(([,e])=>e))}static record(e,t,i,n){return new ky(e,t,i,n,e=>Object.entries(e),e=>Object.fromEntries(e))}}var Iy=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Cy{constructor(e,t,i,n){this.key=e,this.$encryptor=t,this.encryptedState=n.getUser(i,e.toEncryptedStateKey()),this.combinedState$=(0,jo.z)([this.encryptedState.combinedState$,this.$encryptor]).pipe((0,To.H)(e=>Iy(this,[e],void 0,function*([[e,t],i]){return[e,yield this.declassifyAll(i,t)]})),(0,Fo.u)({connector:()=>new Ro.m(1),resetOnRefCountZero:()=>{var t;return(0,xo.O)(null!==(t=e.options.cleanupDelayMs)&&void 0!==t?t:6e4)}})),this.state$=this.combinedState$.pipe((0,l.T)(([,e])=>e))}get userId(){return this.encryptedState.userId}static from(e,t,i,n){return new Cy(t,n,e,i)}declassifyItem(e,t){return Iy(this,arguments,void 0,function*(e,{id:t,secret:i,disclosed:n}){const r=Pp.fromJSON(i),s=yield e.decrypt(r),o=this.key.classifier.declassify(n,s);return[t,this.key.options.deserializer(o)]})}declassifyAll(e,t){return Iy(this,void 0,void 0,function*(){if(null==t)return null;const i=t.map(t=>Iy(this,void 0,void 0,function*(){return this.declassifyItem(e,t)})),n=yield Promise.all(i);return this.key.reconstruct(n)})}classifyItem(e,t){return Iy(this,arguments,void 0,function*(e,[t,i]){const n=this.key.classifier.classify(i),r=yield e.encrypt(n.secret);return{id:t,secret:JSON.parse(JSON.stringify(r)),disclosed:n.disclosed}})}classifyAll(e,t){return Iy(this,void 0,void 0,function*(){if(null==t)return null;const i=this.key.deconstruct(t).map(t=>Iy(this,void 0,void 0,function*(){return this.classifyItem(e,t)}));return yield Promise.all(i)})}update(e){return Iy(this,arguments,void 0,function*(e,t=null){var i,n,r;const s=(0,jo.z)([null!==(i=null==t?void 0:t.combineLatestWith)&&void 0!==i?i:(0,Go.of)(null),this.$encryptor]);let o,a,l;yield this.encryptedState.update(e=>e,{shouldUpdate:(e,t)=>(o=e,[a,l]=t,!1),combineLatestWith:s});const c=yield this.declassifyAll(l,o);if(!(null===(r=null===(n=null==t?void 0:t.shouldUpdate)||void 0===n?void 0:n.call(t,c,a))||void 0===r||r))return c;const u=e(c,a),d=yield this.classifyAll(l,u);return yield this.encryptedState.update(()=>d),u})}}class Ty{}class Py{classify(e){const t=JSON.parse(JSON.stringify(e));delete t.website;return{disclosed:{},secret:t}}declassify(e,t){return Object.assign(Object.assign({},t),{website:null})}}var Fy=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Ry extends Ty{constructor(e,t,i,n,r,s){super(),this.configuration=e,this.client=t,this.i18nService=i,this.encryptService=n,this.keyService=r,this.stateProvider=s,this.policy=op.PasswordGenerator,this.defaults$=Ym(()=>this.configuration.forwarder.defaultSettings),this.toEvaluator=py(),this.durableState=function(e){const t=new Map;return i=>{let n=t.get(i);return void 0===n&&(n=e(i),t.set(i,n)),n}}(e=>this.getUserSecrets(e)),this.generate=e=>Fy(this,void 0,void 0,function*(){const t={website:e.website},i=yield this.getAccountId(this.configuration,e);i&&(t.accountId=yield this.client.fetchJson(i,t));const n=this.createForwardingAddress(this.configuration,e);return yield this.client.fetchJson(n,t)})}get key(){return this.configuration.forwarder.settings}get rolloverKey(){return this.configuration.forwarder.importBuffer}getUserSecrets(e){const t=new Sy(512),i=this.keyService.userKey$(e).pipe((0,l.T)(i=>i?new my(e,this.encryptService,i,t):null),(0,Eo.p)(e=>!!e)),n=new Py,r=ky.value(this.key.stateDefinition,this.key.key,n,{deserializer:e=>this.key.deserializer(e),cleanupDelayMs:this.key.cleanupDelayMs,clearOn:this.key.clearOn}),s=Cy.from(e,r,this.stateProvider,i),o=this.keyService.userKey$(e).pipe((0,l.T)(e=>null!==e));return new yy(this.stateProvider,this.rolloverKey,s,o)}createContext(e,t){return new jm(e,t,this.i18nService)}createForwardingAddress(e,t){const i=this.createContext(e,t);return new Bg(e,i)}getAccountId(e,t){if(!e.forwarder.getAccountId)return null;const i=this.createContext(e,t);return new jg(e,i)}}const xy=new k(me,"passwordGeneratorSettings",{deserializer:e=>e,clearOn:[]}),Ay=new k(me,"passphraseGeneratorSettings",{deserializer:e=>e,clearOn:[]}),Dy=new k(me,"effUsernameGeneratorSettings",{deserializer:e=>e,clearOn:[]}),Ey=new k(me,"catchallGeneratorSettings",{deserializer:e=>e,clearOn:[]}),$y=new k(me,"subaddressGeneratorSettings",{deserializer:e=>e,clearOn:[]});var Oy=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Uy{constructor(e,t){this.randomizer=e,this.stateProvider=t,this.durableState=Hm(Ay,this.stateProvider),this.defaults$=Ym(()=>If),this.policy=op.PasswordGenerator}toEvaluator(){return hy({type:op.PasswordGenerator,disabledValue:Object.freeze({minNumberWords:0,capitalize:!1,includeNumber:!1}),combine:Dg,createEvaluator:e=>new Fg(e)})}generate(e){return Oy(this,void 0,void 0,function*(){const t=Qm(e);return this.randomizer.randomEffLongWords(t)})}}var My=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Ny{constructor(e,t){this.randomizer=e,this.stateProvider=t,this.durableState=Hm(xy,this.stateProvider),this.defaults$=Ym(()=>Cf),this.policy=op.PasswordGenerator}toEvaluator(){return hy({type:op.PasswordGenerator,disabledValue:{minLength:0,useUppercase:!1,useLowercase:!1,useNumbers:!1,numberCount:0,useSpecial:!1,specialCount:0},combine:Eg,createEvaluator:e=>new Ag(e)})}generate(e){return My(this,void 0,void 0,function*(){const t=Zm(e);return yield this.randomizer.randomAscii(t)})}}var Vy=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class By{constructor(e,t,i,n=bf){this.emailCalculator=e,this.emailRandomizer=t,this.stateProvider=i,this.defaultOptions=n,this.durableState=Hm(Ey,this.stateProvider),this.defaults$=Ym(()=>this.defaultOptions),this.toEvaluator=py(),this.policy=op.PasswordGenerator}generate(e){return Vy(this,void 0,void 0,function*(){return null==e.catchallType&&(e.catchallType="random"),"website-name"===e.catchallType?yield this.emailCalculator.concatenate(e.website,e.catchallDomain):this.emailRandomizer.randomAsciiCatchall(e.catchallDomain)})}}var jy=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Gy{constructor(e,t,i,n=Tf){this.emailCalculator=e,this.emailRandomizer=t,this.stateProvider=i,this.defaultOptions=n,this.durableState=Hm($y,this.stateProvider),this.defaults$=Ym(()=>this.defaultOptions),this.toEvaluator=py(),this.policy=op.PasswordGenerator}generate(e){return jy(this,void 0,void 0,function*(){return null==e.subaddressType&&(e.subaddressType="random"),"website-name"===e.subaddressType?this.emailCalculator.appendToSubaddress(e.website,e.subaddressEmail):this.emailRandomizer.randomAsciiSubaddress(e.subaddressEmail)})}}var Ly=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const zy=Object.freeze({enabled:4,disabled:0});class _y{constructor(e,t,i=kf){this.randomizer=e,this.stateProvider=t,this.defaultOptions=i,this.durableState=Hm(Dy,this.stateProvider),this.defaults$=Ym(()=>this.defaultOptions),this.toEvaluator=py(),this.policy=op.PasswordGenerator}generate(e){return Ly(this,void 0,void 0,function*(){var t,i;const n=(null!==(t=e.wordCapitalize)&&void 0!==t?t:kf.wordCapitalize)?"TitleCase":"lowercase",r=(null!==(i=e.wordIncludeNumber)&&void 0!==i?i:kf.wordIncludeNumber)?zy.enabled:zy.disabled;return yield this.randomizer.randomWords({numberOfWords:1,casing:n,digits:r})})}}class Ky{constructor(e,t){this.password=e,this.date=t}}class Xy{}class qy{constructor(e,t,i){this.credential=e,this.category=t,this.generationDate="number"==typeof i?new Date(i):i}static fromJSON(e){return new qy(e.credential,e.category,e.generationDate)}toJSON(){return{credential:this.credential,category:this.category,generationDate:this.generationDate.valueOf()}}}class Wy{constructor(e,t){this.disclosed=e,this.excluded=t}static allSecret(){const e=Object.freeze([]),t=Object.freeze([]);return new Wy(e,t)}disclose(e){const t=[...this.disclosed,e];return new Wy(Object.freeze(t),this.excluded)}exclude(e){const t=[...this.excluded,e];return new Wy(this.disclosed,Object.freeze(t))}classify(e){const t=JSON.parse(JSON.stringify(e));for(const e of this.excluded)delete t[e];const i={};for(const e of this.disclosed)i[e]=t[e],delete t[e];return{disclosed:i,secret:t}}declassify(e,t){const i={};for(const t of this.disclosed)i[t]=e[t];const n=Object.assign(i,t);for(const e of this.excluded)delete n[e];return n}}var Yy=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Hy=ky.array(me,"localGeneratorHistory",Wy.allSecret(),{deserializer:qy.fromJSON,clearOn:["logout"]}),Jy=new xf(me,"localGeneratorHistoryBuffer",{deserializer(e){const t=e;return null==t?void 0:t.map(e=>new Ky(e.password,e.date))},isValid(e){return Yy(this,void 0,void 0,function*(){return!!e.length})},map(e,t){return Yy(this,void 0,void 0,function*(){return(yield t.decrypt(e)).map(e=>new qy(e.password,"password",e.date))})},clearOn:["logout"]});var Zy=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Qy{constructor(e,t,i){this.userId=e,this.keyService=t,this.encryptService=i}decrypt(e){return Zy(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.keyService.userKey$(this.userId));if(null==t)throw new Error("No user key found for decryption");const i=(null!=e?e:[]).map(e=>Zy(this,void 0,void 0,function*(){const i=new Pp(e.password),n=yield this.encryptService.decryptString(i,t);return new Ky(n,e.date)}));return yield Promise.all(i)})}}var eb=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class tb extends Xy{constructor(e,t,i,n={maxTotal:200}){super(),this.encryptService=e,this.keyService=t,this.stateProvider=i,this.options=n,this._credentialStates=new Map,this.track=(e,t,i,n)=>eb(this,void 0,void 0,function*(){const r=this.getCredentialState(e);let s=null;return yield r.update(e=>{e=null!=e?e:[],s=new qy(t,i,null!=n?n:Date.now()),e.unshift(s);const r=Math.max(0,this.options.maxTotal);return e.splice(r,1/0),e},{shouldUpdate:e=>{var i;return!(null!==(i=null==e?void 0:e.some(e=>e.credential===t))&&void 0!==i&&i)}}),s}),this.take=(e,t)=>eb(this,void 0,void 0,function*(){const i=this.getCredentialState(e);let n,r=null;return yield i.update(e=>(e=null!=e?e:[],[r]=e.splice(n,1),e),{shouldUpdate:e=>{var i;return n=null!==(i=null==e?void 0:e.findIndex(e=>e.credential===t))&&void 0!==i?i:-1,n>=0}}),r}),this.clear=e=>eb(this,void 0,void 0,function*(){var t;const i=this.getCredentialState(e);return null!==(t=yield i.update(()=>null))&&void 0!==t?t:[]}),this.credentials$=e=>this.getCredentialState(e).state$.pipe((0,l.T)(e=>null!=e?e:[]))}getCredentialState(e){let t=this._credentialStates.get(e);return t||(t=this.createSecretState(e),this._credentialStates.set(e,t)),t}createSecretState(e){const t=new Sy(2048),i=this.keyService.userKey$(e).pipe((0,l.T)(i=>i?new my(e,this.encryptService,i,t):null),(0,Eo.p)(e=>!!e)),n=Cy.from(e,Hy,this.stateProvider,i),r=new Qy(e,this.keyService,this.encryptService),s=this.keyService.userKey$(e).pipe((0,l.T)(e=>e&&r));return new yy(this.stateProvider,Jy,n,s)}}const ib=Object.freeze({type:"password",username:"word",forwarder:""});class nb{constructor(e){this.policy=e}get policyInEffect(){var e;return Hg[Mm.password].includes(null===(e=this.policy)||void 0===e?void 0:e.overridePasswordType)}applyPolicy(e){var t;const i=Object.assign({},e);return this.policyInEffect&&(i.type=null!==(t=this.policy.overridePasswordType)&&void 0!==t?t:i.type),i}sanitize(e){var t;return Object.assign(Object.assign({},e),{type:null!==(t=e.type)&&void 0!==t?t:ib.type})}}function rb(e,t){if(!(t.type===op.PasswordGenerator&&t.enabled))return e;return"password"!==e.overridePasswordType&&t.data.overridePasswordType?Object.assign(Object.assign({},e),{overridePasswordType:t.data.overridePasswordType}):e}const sb=Object.freeze({overridePasswordType:null}),ob=new k(me,"generatorSettings",{deserializer:e=>e,clearOn:["logout"]});var ab=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class lb{constructor(e,t){this.stateProvider=e,this.policy=t}options$(e){return this.stateProvider.getUserState$(ob,e)}defaults$(e){return new Dd.t(Object.assign({},ib))}evaluator$(e){return this.policy.policiesByType$(op.PasswordGenerator,e).pipe(Fm(rb,sb),Rm(),(0,l.T)(e=>new nb(e)))}enforcePolicy(e,t){return ab(this,void 0,void 0,function*(){const i=yield(0,bo._)(this.evaluator$(e)),n=i.applyPolicy(t);return i.sanitize(n)})}saveOptions(e,t){return ab(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(ob,t,e)})}}class cb extends sv{constructor(){super(...arguments),this.overridePasswordType="",this.minLength=0,this.useUppercase=!1,this.useLowercase=!1,this.useNumbers=!1,this.numberCount=0,this.useSpecial=!1,this.specialCount=0,this.minNumberWords=0,this.capitalize=!1,this.includeNumber=!1}inEffect(){return this.overridePasswordType||this.minLength>0||this.numberCount>0||this.specialCount>0||this.useUppercase||this.useLowercase||this.useNumbers||this.useSpecial||this.minNumberWords>0||this.capitalize||this.includeNumber}clone(){const e=new cb;return Object.assign(e,this),e}}var ub=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class db{constructor(e,t,i,n,r){this.accountService=e,this.navigation=t,this.passwords=i,this.passphrases=n,this.history=r}generatePassword(e){return"password"===e.type?this.passwords.generate(e):this.passphrases.generate(e)}generatePassphrase(e){return this.passphrases.generate(e)}getRawOptions$(){function e(e){return e.pipe((0,l.T)((e,t)=>[e,t]))}return this.accountService.activeAccount$.pipe((0,To.H)(t=>(0,Sm.x)((0,Go.of)([null,null,[null,-1],null,null,[null,-1],null,null,[null,-1]]),(0,jo.z)([this.passwords.options$(t.id),this.passwords.defaults$(t.id),e(this.passwords.evaluator$(t.id)),this.passphrases.options$(t.id),this.passphrases.defaults$(t.id),e(this.passphrases.evaluator$(t.id)),this.navigation.options$(t.id),this.navigation.defaults$(t.id),e(this.navigation.evaluator$(t.id))]))),(0,mm.J)(),(0,l.T)(function([e,t]){const[,,[,i],,,[,n],,,[,r]]=e,[s,o,[a,l],c,u,[d,h],p,v,[f,m]]=t;return[s,o,a,c,u,d,p,v,f,i<l||n<h||r<m]}))}getOptions$(){return this.getRawOptions$().pipe((0,l.T)(([e,t,i,n,r,s,o,a,l,c])=>{const u=i.applyPolicy(null!=e?e:t),d=s.applyPolicy(null!=n?n:r),h=l.applyPolicy(null!=o?o:a);return[this.toPasswordGeneratorOptions({password:i.sanitize(u),passphrase:s.sanitize(d),generator:l.sanitize(h),policyUpdated:c}),Object.assign(new cb,i.policy,s.policy,l.policy)]}))}getOptions(){return ub(this,void 0,void 0,function*(){return yield(0,bo._)(this.getOptions$())})}enforcePasswordGeneratorPoliciesOnOptions(e){return ub(this,void 0,void 0,function*(){const t=this.accountService.activeAccount$.pipe((0,To.H)(e=>(0,hm.y)(this.passwords.evaluator$(e.id),this.passphrases.evaluator$(e.id),this.navigation.evaluator$(e.id))),(0,l.T)(([t,i,n])=>{const r=Object.assign(new cb,t.policy,i.policy,n.policy),s=n.applyPolicy(e),o=Object.assign(Object.assign({},e),n.sanitize(s));if("password"===o.type){const e=t.applyPolicy(o);return[t.sanitize(e),r]}{const e=i.applyPolicy(o);return[i.sanitize(e),r]}})),[i,n]=yield(0,bo._)(t);return[Object.assign(e,i),n]})}saveOptions(e){return ub(this,void 0,void 0,function*(){const t=this.toStoredOptions(e),i=yield(0,bo._)(this.accountService.activeAccount$),n=(0,hm.y)(this.navigation.options$(i.id),this.navigation.defaults$(i.id)).pipe((0,l.T)(([e,t])=>null!=e?e:t));let r=yield(0,bo._)(n);r=Object.assign(r,t.generator),yield this.navigation.saveOptions(i.id,r),yield this.passwords.saveOptions(i.id,t.password),yield this.passphrases.saveOptions(i.id,t.passphrase)})}toStoredOptions(e){return{generator:{type:e.type},password:{length:e.length,minLength:e.minLength,ambiguous:e.ambiguous,uppercase:e.uppercase,minUppercase:e.minUppercase,lowercase:e.lowercase,minLowercase:e.minLowercase,number:e.number,minNumber:e.minNumber,special:e.special,minSpecial:e.minSpecial},passphrase:{numWords:e.numWords,wordSeparator:e.wordSeparator,capitalize:e.capitalize,includeNumber:e.includeNumber},policyUpdated:!1}}toPasswordGeneratorOptions(e){return{type:e.generator.type,length:e.password.length,minLength:e.password.minLength,ambiguous:e.password.ambiguous,uppercase:e.password.uppercase,minUppercase:e.password.minUppercase,lowercase:e.password.lowercase,minLowercase:e.password.minLowercase,number:e.password.number,minNumber:e.password.minNumber,special:e.password.special,minSpecial:e.password.minSpecial,numWords:e.passphrase.numWords,wordSeparator:e.passphrase.wordSeparator,capitalize:e.passphrase.capitalize,includeNumber:e.passphrase.includeNumber,policyUpdated:e.policyUpdated}}getHistory(){const e=this.accountService.activeAccount$.pipe((0,To.H)(e=>this.history.credentials$(e.id)),(0,wo.w)({each:1e3,with(){return[]}}),(0,l.T)(e=>e.map(hb)));return(0,bo._)(e)}addHistory(e){return ub(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.accountService.activeAccount$);(null==t?void 0:t.id)&&(yield this.history.track(t.id,e,"password"))})}clear(){const e=this.accountService.activeAccount$.pipe((0,Eo.p)(e=>!!(null==e?void 0:e.id)),(0,To.H)(e=>this.history.clear(e.id)),(0,wo.w)({each:1e3,with(){return[]}}),(0,l.T)(e=>e.map(hb)));return(0,bo._)(e)}}function hb(e){return new Ky(e.credential,e.generationDate.valueOf())}const{jK:pb,gb:vb}=r,{f3:fb,Zx:mb}=n,gb=um;class yb{}var bb=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class wb{constructor(e,t){this.api=e,this.i18n=t}fetchJson(e,t){return bb(this,void 0,void 0,function*(){const i=e.toRequest(t),n=yield this.api.nativeFetch(i);let r,s,o;const a=yield this.detectCommonErrors(n);if(a?[s,o]=a:e.hasJsonPayload(n)&&([r,o]=e.processJson(yield n.json())),r)return r;null!=s||(s=o?"forwarderError":"forwarderUnknownError");throw this.i18n.t(s,e.requestor.name,o)})}detectCommonErrors(e){return bb(this,void 0,void 0,function*(){if(401===e.status){const t=yield this.tryGetErrorMessage(e);return[t?"forwaderInvalidTokenWithMessage":"forwaderInvalidToken",t]}if(403===e.status){const t=yield this.tryGetErrorMessage(e);return[t?"forwaderInvalidOperationWithMessage":"forwaderInvalidOperation",t]}if(e.status>=400){const t=yield this.tryGetErrorMessage(e);return[t?"forwarderError":"forwarderUnknownError",t]}})}tryGetErrorMessage(e){return bb(this,void 0,void 0,function*(){var t,i,n;const r=null!==(t=yield e.text())&&void 0!==t?t:"";return(null!==(n=null!==(i=this.tryFindErrorAsJson(r))&&void 0!==i?i:this.tryFindErrorAsText(r))&&void 0!==n?n:e.statusText)||void 0})}tryFindErrorAsJson(e){var t,i,n,r,s;if(!(e.startsWith("{")||e.startsWith("'")||e.startsWith('"')))return;let o;try{o=JSON.parse(e)}catch(e){return!1}if(o&&"string"==typeof o)return o;const a=null!==(i=null===(t=o.error)||void 0===t?void 0:t.toString())&&void 0!==i?i:null,l=null!==(r=null===(n=o.message)||void 0===n?void 0:n.toString())&&void 0!==r?r:null;return a&&l?`${a}: ${l}`:null!==(s=null!=a?a:l)&&void 0!==s&&s}tryFindErrorAsText(e){if(e.length&&!e.includes("<"))return e}}const Sb=Object.freeze({AddyIo:Object.freeze({id:"anonaddy",name:"Addy.io",validForSelfHosted:!0}),DuckDuckGo:Object.freeze({id:"duckduckgo",name:"DuckDuckGo",validForSelfHosted:!1}),Fastmail:Object.freeze({id:"fastmail",name:"Fastmail",validForSelfHosted:!0}),FirefoxRelay:Object.freeze({id:"firefoxrelay",name:"Firefox Relay",validForSelfHosted:!1}),ForwardEmail:Object.freeze({id:"forwardemail",name:"Forward Email",validForSelfHosted:!0}),SimpleLogin:Object.freeze({id:"simplelogin",name:"SimpleLogin",validForSelfHosted:!0})});var kb=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Ib{constructor(e,t,i,n,r,s,o,a,l,c,u){this.accountService=e,this.navigation=t,this.catchall=i,this.effUsername=n,this.subaddress=r,this.addyIo=s,this.duckDuckGo=o,this.fastmail=a,this.firefoxRelay=l,this.forwardEmail=c,this.simpleLogin=u}generateUsername(e){return"catchall"===e.type?this.generateCatchall(e):"subaddress"===e.type?this.generateSubaddress(e):"forwarded"===e.type?this.generateForwarded(e):this.generateWord(e)}generateWord(e){return this.effUsername.generate(e)}generateSubaddress(e){return this.subaddress.generate(e)}generateCatchall(e){return this.catchall.generate(e)}generateForwarded(e){if(!e.forwardedService)return null;const t=this.toStoredOptions(e);switch(e.forwardedService){case Sb.AddyIo.id:case Pf.addyio:return this.addyIo.generate(t.forwarders.addyIo);case Sb.DuckDuckGo.id:return this.duckDuckGo.generate(t.forwarders.duckDuckGo);case Sb.Fastmail.id:return this.fastmail.generate(t.forwarders.fastmail);case Sb.FirefoxRelay.id:case Pf.mozilla:return this.firefoxRelay.generate(t.forwarders.firefoxRelay);case Sb.ForwardEmail.id:return this.forwardEmail.generate(t.forwarders.forwardEmail);case Sb.SimpleLogin.id:return this.simpleLogin.generate(t.forwarders.simpleLogin)}}getOptions$(){return this.accountService.activeAccount$.pipe((0,To.H)(e=>(0,jo.z)([this.navigation.options$(e.id),this.navigation.defaults$(e.id),this.catchall.options$(e.id),this.catchall.defaults$(e.id),this.effUsername.options$(e.id),this.effUsername.defaults$(e.id),this.subaddress.options$(e.id),this.subaddress.defaults$(e.id),this.addyIo.options$(e.id),this.addyIo.defaults$(e.id),this.duckDuckGo.options$(e.id),this.duckDuckGo.defaults$(e.id),this.fastmail.options$(e.id),this.fastmail.defaults$(e.id),this.firefoxRelay.options$(e.id),this.firefoxRelay.defaults$(e.id),this.forwardEmail.options$(e.id),this.forwardEmail.defaults$(e.id),this.simpleLogin.options$(e.id),this.simpleLogin.defaults$(e.id)])),(0,l.T)(([e,t,i,n,r,s,o,a,l,c,u,d,h,p,v,f,m,g,y,b])=>this.toUsernameOptions({generator:null!=e?e:t,algorithms:{catchall:null!=i?i:n,effUsername:null!=r?r:s,subaddress:null!=o?o:a},forwarders:{addyIo:null!=l?l:c,duckDuckGo:null!=u?u:d,fastmail:null!=h?h:p,firefoxRelay:null!=v?v:f,forwardEmail:null!=m?m:g,simpleLogin:null!=y?y:b}})))}getOptions(){return(0,bo._)(this.getOptions$())}saveOptions(e){return kb(this,void 0,void 0,function*(){const t=this.toStoredOptions(e),i=yield(0,bo._)(this.accountService.activeAccount$);(yield this.saveGeneratorOptions(i.id,e.type,t))||(yield this.saveForwarderOptions(i.id,e.forwardedService,t)),yield this.saveNavigationOptions(i.id,t)})}saveNavigationOptions(e,t){return kb(this,void 0,void 0,function*(){const i=(0,hm.y)(this.navigation.options$(e),this.navigation.defaults$(e)).pipe((0,l.T)(([e,t])=>null!=e?e:t));let n=yield(0,bo._)(i);n=Object.assign(n,t.generator),yield this.navigation.saveOptions(e,n)})}saveGeneratorOptions(e,t,i){return kb(this,void 0,void 0,function*(){switch(t){case"word":return yield this.effUsername.saveOptions(e,i.algorithms.effUsername),!0;case"subaddress":return yield this.subaddress.saveOptions(e,i.algorithms.subaddress),!0;case"catchall":return yield this.catchall.saveOptions(e,i.algorithms.catchall),!0;default:return!1}})}saveForwarderOptions(e,t,i){return kb(this,void 0,void 0,function*(){switch(t){case Sb.AddyIo.id:case Pf.addyio:return yield this.addyIo.saveOptions(e,i.forwarders.addyIo),!0;case Sb.DuckDuckGo.id:return yield this.duckDuckGo.saveOptions(e,i.forwarders.duckDuckGo),!0;case Sb.Fastmail.id:return yield this.fastmail.saveOptions(e,i.forwarders.fastmail),!0;case Sb.FirefoxRelay.id:case Pf.mozilla:return yield this.firefoxRelay.saveOptions(e,i.forwarders.firefoxRelay),!0;case Sb.ForwardEmail.id:return yield this.forwardEmail.saveOptions(e,i.forwarders.forwardEmail),!0;case Sb.SimpleLogin.id:return yield this.simpleLogin.saveOptions(e,i.forwarders.simpleLogin),!0;default:return!1}})}toStoredOptions(e){const t={addyIo:{baseUrl:e.forwardedAnonAddyBaseUrl,token:e.forwardedAnonAddyApiToken,domain:e.forwardedAnonAddyDomain,website:e.website},duckDuckGo:{token:e.forwardedDuckDuckGoToken,website:e.website},fastmail:{token:e.forwardedFastmailApiToken,website:e.website},firefoxRelay:{token:e.forwardedFirefoxApiToken,website:e.website},forwardEmail:{token:e.forwardedForwardEmailApiToken,domain:e.forwardedForwardEmailDomain,website:e.website},simpleLogin:{token:e.forwardedSimpleLoginApiKey,baseUrl:e.forwardedSimpleLoginBaseUrl,website:e.website}};return{generator:{username:e.type,forwarder:e.forwardedService},algorithms:{effUsername:{wordCapitalize:e.wordCapitalize,wordIncludeNumber:e.wordIncludeNumber,website:e.website},subaddress:{subaddressType:e.subaddressType,subaddressEmail:e.subaddressEmail,website:e.website},catchall:{catchallType:e.catchallType,catchallDomain:e.catchallDomain,website:e.website}},forwarders:t}}toUsernameOptions(e){return{type:e.generator.username,wordCapitalize:e.algorithms.effUsername.wordCapitalize,wordIncludeNumber:e.algorithms.effUsername.wordIncludeNumber,subaddressType:e.algorithms.subaddress.subaddressType,subaddressEmail:e.algorithms.subaddress.subaddressEmail,catchallType:e.algorithms.catchall.catchallType,catchallDomain:e.algorithms.catchall.catchallDomain,forwardedService:e.generator.forwarder,forwardedAnonAddyApiToken:e.forwarders.addyIo.token,forwardedAnonAddyDomain:e.forwarders.addyIo.domain,forwardedAnonAddyBaseUrl:e.forwarders.addyIo.baseUrl,forwardedDuckDuckGoToken:e.forwarders.duckDuckGo.token,forwardedFirefoxApiToken:e.forwarders.firefoxRelay.token,forwardedFastmailApiToken:e.forwarders.fastmail.token,forwardedForwardEmailApiToken:e.forwarders.forwardEmail.token,forwardedForwardEmailDomain:e.forwarders.forwardEmail.domain,forwardedSimpleLoginApiKey:e.forwarders.simpleLogin.token,forwardedSimpleLoginBaseUrl:e.forwarders.simpleLogin.baseUrl}}}const{f3:Cb,QS:Tb,Mt:Pb,Lq:Fb}=n,Rb=um,{B:xb,Vm:Ab,KQ:Db,ji:Eb}=r;function $b(e,t){if(1&e&&(Fl.j41(0,"li"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.SpI(" ",Fl.i5U(2,1,"policyInEffectMinComplexity",e.getPasswordScoreAlertDisplay())," ")}}function Ob(e,t){if(1&e&&(Fl.j41(0,"li"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.SpI(" ",Fl.i5U(2,1,"policyInEffectMinLength",null==e.policy?null:e.policy.minLength.toString())," ")}}function Ub(e,t){1&e&&(Fl.j41(0,"li"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"policyInEffectUppercase")," "))}function Mb(e,t){1&e&&(Fl.j41(0,"li"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"policyInEffectLowercase")," "))}function Nb(e,t){1&e&&(Fl.j41(0,"li"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"policyInEffectNumbers")," "))}function Vb(e,t){1&e&&(Fl.j41(0,"li"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.i5U(2,1,"policyInEffectSpecial","!@#$%^&*")," "))}function Bb(e,t){if(1&e&&(Fl.j41(0,"ul",1),Fl.DNE(1,$b,3,4,"li",2)(2,Ob,3,4,"li",2)(3,Ub,3,3,"li",2)(4,Mb,3,3,"li",2)(5,Nb,3,3,"li",2)(6,Vb,3,4,"li",2),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("ngIf",(null==e.policy?null:e.policy.minComplexity)>0),Fl.R7$(),Fl.Y8G("ngIf",(null==e.policy?null:e.policy.minLength)>0),Fl.R7$(),Fl.Y8G("ngIf",null==e.policy?null:e.policy.requireUpper),Fl.R7$(),Fl.Y8G("ngIf",null==e.policy?null:e.policy.requireLower),Fl.R7$(),Fl.Y8G("ngIf",null==e.policy?null:e.policy.requireNumbers),Fl.R7$(),Fl.Y8G("ngIf",null==e.policy?null:e.policy.requireSpecial)}}class jb{constructor(e){this.i18nService=e,this.message="masterPasswordPolicyInEffect"}getPasswordScoreAlertDisplay(){let e;switch(this.policy.minComplexity){case 4:e=this.i18nService.t("strong");break;case 3:e=this.i18nService.t("good");break;default:e=this.i18nService.t("weak")}return e+" ("+this.policy.minComplexity+")"}}var Gb;function Lb(e,t,i,n,r="controlB"){return s=>{if(!(s instanceof Il.gE))throw new Error("compareInputs only supports validation at the FormGroup level");const o=s.get(t),a=s.get(i);if(!o||!a)throw new Error("[compareInputs validator] one or both of the specified controls could not be found in the form group");const l="controlA"===r?o:a;if(""===o.value&&""===a.value)return d();const c=o.value===a.value;return e===Gb.InputsShouldMatch?c?d():u():e===Gb.InputsShouldNotMatch?c?u():d():null;function u(){return l.setErrors(Object.assign(Object.assign({},l.errors||{}),{compareInputsError:{message:n}})),{compareInputsError:{message:n}}}function d(){const e=null==l?void 0:l.errors;if(null!=e){(null==e?void 0:e.compareInputsError)&&delete e.compareInputsError;const t=0===Object.keys(e).length;l.setErrors(t?null:e)}return null}}}jb.ɵfac=function(e){return new(e||jb)(Fl.rXU(Ul))},jb.ɵcmp=Fl.VBU({type:jb,selectors:[["auth-password-callout"]],inputs:{message:"message",policy:"policy"},decls:4,vars:4,consts:[["class","tw-mb-0 tw-ml-8 tw-ps-0",4,"ngIf"],[1,"tw-mb-0","tw-ml-8","tw-ps-0"],[4,"ngIf"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-callout"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.DNE(3,Bb,7,6,"ul",0),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,2,t.message)," "),Fl.R7$(2),Fl.Y8G("ngIf",t.policy))},dependencies:[kl.MD,kl.bT,sf,dd,ud,rf],encapsulation:2}),function(e){e[e.InputsShouldMatch=0]="InputsShouldMatch",e[e.InputsShouldNotMatch=1]="InputsShouldNotMatch"}(Gb||(Gb={}));class zb{}class _b{}class Kb{}const Xb=e=>{const t=(Array.isArray(e)?e:[e]).map(e=>e.split(/\s+/).filter(e=>""!==e)).flat().length;return 5e3+1e3*Math.floor(t/120)};class qb{constructor(e){this.toastrService=e}showToast(e){const t={payload:{message:e.message,variant:e.variant,title:e.title},timeOut:null!=e.timeout&&e.timeout>0?e.timeout:Xb(e.message)};this.toastrService.show(void 0,e.title,t)}_showToast(e){var t;this.showToast({message:e.text,variant:e.type,title:e.title,timeout:null===(t=e.options)||void 0===t?void 0:t.timeout})}}qb.ɵfac=function(e){return new(e||qb)(a.KVO(Tl.tw))},qb.ɵprov=a.jDH({token:qb,factory:qb.ɵfac,providedIn:"root"});class Wb{}class Yb extends Wb{}class Hb{}class Jb{}class Zb extends Jb{}class Qb{constructor(e){this.ngControl=e,this.inputClasses=["tw-appearance-none","tw-outline-none","tw-box-border","tw-relative","tw-transition","tw-cursor-pointer","disabled:tw-cursor-default","tw-inline-block","tw-align-sub","tw-flex-none","!tw-p-1","tw-h-[calc(1.12rem_+_theme(spacing.2))]","tw-w-[calc(1.12rem_+_theme(spacing.2))]","after:tw-inset-1","!-tw-mt-1","!-tw-mb-1","!-tw-ms-1","before:tw-content-['']","before:tw-block","before:tw-inset-0","before:tw-h-[1.12rem]","before:tw-w-[1.12rem]","before:tw-rounded","before:tw-border","before:tw-border-solid","before:tw-border-secondary-500","before:tw-box-border","after:tw-content-['']","after:tw-block","after:tw-absolute","after:tw-inset-0","after:tw-h-[1.12rem]","after:tw-w-[1.12rem]","after:tw-box-border","hover:before:tw-border-2","[&>label]:before:tw-border-2","[&:not(bit-form-control_*)]:focus-visible:before:tw-ring-2","[&:not(bit-form-control_*)]:focus-visible:before:tw-ring-offset-2","[&:not(bit-form-control_*)]:focus-visible:before:tw-ring-primary-600","disabled:before:tw-cursor-default","disabled:before:tw-border","disabled:before:hover:tw-border","disabled:before:tw-bg-secondary-100","disabled:hover:before:tw-bg-secondary-100","checked:before:tw-bg-primary-600","checked:before:tw-border-primary-600","checked:before:hover:tw-bg-primary-700","checked:before:hover:tw-border-primary-700","[&>label:hover]:checked:before:tw-bg-primary-700","[&>label:hover]:checked:before:tw-border-primary-700","checked:after:tw-bg-text-contrast","checked:after:tw-mask-position-[center]","checked:after:tw-mask-repeat-[no-repeat]","checked:disabled:before:tw-border-secondary-100","checked:disabled:hover:before:tw-border-secondary-100","checked:disabled:before:tw-bg-secondary-100","checked:disabled:after:tw-bg-text-muted","[&:not(:indeterminate)]:checked:after:tw-mask-image-[var(--mask-image)]","indeterminate:after:tw-mask-image-[var(--indeterminate-mask-image)]","indeterminate:before:tw-bg-primary-600","indeterminate:before:tw-border-primary-600","indeterminate:hover:before:tw-bg-primary-700","indeterminate:hover:before:tw-border-primary-700","[&>label:hover]:indeterminate:before:tw-bg-primary-700","[&>label:hover]:indeterminate:before:tw-border-primary-700","indeterminate:after:tw-bg-text-contrast","indeterminate:after:tw-mask-position-[center]","indeterminate:after:tw-mask-repeat-[no-repeat]","indeterminate:after:tw-mask-image-[var(--indeterminate-mask-image)]","indeterminate:disabled:tw-border-secondary-100","indeterminate:disabled:tw-bg-secondary-100","indeterminate:disabled:after:tw-bg-text-muted"],this.maskImage='url(\'data:image/svg+xml,%3Csvg class="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="10" height="10" viewBox="0 0 10 10"%3E%3Cpath d="M0.5 6.2L2.9 8.6L9.5 1.4" fill="none" stroke="white" stroke-width="2"%3E%3C/path%3E%3C/svg%3E\')',this.indeterminateImage='url(\'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="none" viewBox="0 0 13 13"%3E%3Cpath stroke="%23fff" stroke-width="2" d="M2.5 6.5h8"/%3E%3C/svg%3E%0A\')',this.disabledInput=(0,o.hFB)(!1,{transform:o.L39,alias:"disabled"})}get disabled(){var e;return this.disabledInput()||(null===(e=this.ngControl)||void 0===e?void 0:e.disabled)||!1}get required(){var e,t,i;return null!==(i=null===(t=null===(e=this.ngControl)||void 0===e?void 0:e.control)||void 0===t?void 0:t.hasValidator(Il.k0.requiredTrue))&&void 0!==i&&i}get hasError(){var e,t;return!("INVALID"!==(null===(e=this.ngControl)||void 0===e?void 0:e.status)||!(null===(t=this.ngControl)||void 0===t?void 0:t.touched))}get error(){var e,t;const i=null!==(t=null===(e=this.ngControl)||void 0===e?void 0:e.errors)&&void 0!==t?t:{},n=Object.keys(i)[0];return[n,i[n]]}}function ew(e,t){if(1&e&&(Fl.Hgh(0,"i",0),Fl.EFF(1),Fl.nI1(2,"i18n")),2&e){const e=Fl.XpG();Fl.R7$(),Fl.SpI(" ",Fl.i5U(2,1,"fieldsNeedAttention",e.errorString)," ")}}Qb.ɵfac=function(e){return new(e||Qb)(Fl.rXU(Il.vO,10))},Qb.ɵcmp=Fl.VBU({type:Qb,selectors:[["input","type","checkbox","bitCheckbox",""]],hostVars:7,hostBindings:function(e,t){2&e&&(Fl.Avn("disabled",t.disabled),Fl.HbH(t.inputClasses),Fl.xc7("--mask-image",t.maskImage)("--indeterminate-mask-image",t.indeterminateImage))},inputs:{disabledInput:[1,"disabled","disabledInput"]},features:[Fl.Jv_([{provide:fc,useExisting:Qb}])],attrs:["type","checkbox","bitCheckbox",""],decls:0,vars:0,template:function(e,t){},encapsulation:2});class tw{constructor(){this.formGroup=(0,o.hFB)()}get errorCount(){const e=this.formGroup();return e?this.getErrorCount(e):0}get errorString(){return this.errorCount.toString()}getErrorCount(e){return Object.values(e.controls).reduce((e,t)=>t instanceof Il.J3?e+this.getErrorCount(t):null==t.errors||!t.dirty&&t.untouched?e:e+Object.keys(t.errors).length,0)}}tw.ɵfac=function(e){return new(e||tw)},tw.ɵcmp=Fl.VBU({type:tw,selectors:[["bit-error-summary"]],hostAttrs:["aria-live","assertive",1,"tw-block","tw-text-danger","tw-mt-2"],inputs:{formGroup:[1,"formGroup"]},decls:1,vars:1,consts:[[1,"bwi","bwi-error"]],template:function(e,t){1&e&&Fl.nVh(0,ew,3,4),2&e&&Fl.vxM(t.errorCount>0?0:-1)},dependencies:[sc],encapsulation:2});class iw{onClick(){this.toggled.update(e=>!e),this.toggledChange.emit(this.toggled()),this.update()}constructor(e,t,i){this.button=e,this.formField=t,this.i18nService=i,this.toggled=(0,o.geq)(!1),this.toggledChange=new Fl.bkB,this.title=this.i18nService.t("toggleVisibility"),this.label=this.i18nService.t("toggleVisibility")}get icon(){return this.toggled()?"bwi-eye-slash":"bwi-eye"}ngOnChanges(){this.update()}ngAfterContentInit(){const e=this.formField.input();(null==e?void 0:e.type)&&this.toggled.set("password"!==e.type()),this.button.icon.set(this.icon)}update(){var e;this.button.icon.set(this.icon);const t=this.formField.input();null!=(null==t?void 0:t.type)&&(t.type.set(this.toggled()?"text":"password"),null===(e=null==t?void 0:t.spellcheck)||void 0===e||e.set(!this.toggled()&&void 0))}}iw.ɵfac=function(e){return new(e||iw)(Fl.rXU(Zl,1),Fl.rXU(ju),Fl.rXU(Ul))},iw.ɵdir=Fl.FsC({type:iw,selectors:[["","bitPasswordInputToggle",""]],hostVars:3,hostBindings:function(e,t){1&e&&Fl.bIt("click",function(){return t.onClick()}),2&e&&Fl.BMQ("aria-pressed",t.toggled())("title",t.title)("aria-label",t.label)},inputs:{toggled:[1,"toggled"]},outputs:{toggled:"toggledChange",toggledChange:"toggledChange"},features:[Fl.OA$]});class nw{constructor(e){this.iconButtonComponent=e,this.classList=["tw-text-muted"]}ngOnInit(){this.iconButtonComponent&&this.iconButtonComponent.size.set("small")}}nw.ɵfac=function(e){return new(e||nw)(Fl.rXU(Zl,8))},nw.ɵdir=Fl.FsC({type:nw,selectors:[["","bitSuffix",""]],hostVars:2,hostBindings:function(e,t){2&e&&Fl.HbH(t.classList)}});class rw{constructor(e){this.el=e,this.title=o.hFB.required({alias:"appA11yTitle"});const t=this.el.nativeElement.getAttribute("title"),i=this.el.nativeElement.getAttribute("aria-label");(0,Rl.QZ)(()=>{Dl({element:this.el.nativeElement,title:null!=t?t:this.title(),label:null!=i?i:this.title()})})}}rw.ɵfac=function(e){return new(e||rw)(Fl.rXU(Fl.aKT))},rw.ɵdir=Fl.FsC({type:rw,selectors:[["","appA11yTitle",""]],inputs:{title:[1,"appA11yTitle","title"]}});const sw=e=>["bwi",e];function ow(e,t){if(1&e&&Fl.Hgh(0,"i",2),2&e){const e=Fl.XpG();Fl.HbH(Fl.eq3(2,sw,e.startIcon()))}}function aw(e,t){if(1&e&&Fl.Hgh(0,"i",2),2&e){const e=Fl.XpG();Fl.HbH(Fl.eq3(2,sw,e.endIcon()))}}const lw={primary:["tw-text-fg-brand","hover:tw-text-fg-brand-strong"],default:["tw-text-fg-brand","hover:tw-text-fg-brand-strong"],secondary:["tw-text-fg-heading","hover:tw-text-fg-heading"],light:["tw-text-fg-white","hover:tw-text-fg-white","focus-visible:before:tw-ring-fg-contrast"],subtle:["!tw-text-fg-heading","hover:tw-text-fg-heading"],success:["tw-text-fg-success","hover:tw-text-fg-success-strong"],warning:["tw-text-fg-warning","hover:tw-text-fg-warning-strong"],danger:["tw-text-fg-danger","hover:tw-text-fg-danger-strong"],contrast:["tw-text-fg-contrast","hover:tw-text-fg-contrast","focus-visible:before:tw-ring-fg-contrast"]},cw=["tw-text-unset","tw-leading-none","tw-px-0","tw-py-0.5","tw-font-semibold","tw-bg-transparent","tw-border-0","tw-border-none","tw-rounded","tw-transition","tw-no-underline","tw-cursor-pointer","[&:hover_span]:tw-underline","[&.tw-test-hover_span]:tw-underline","[&:hover_span]:tw-decoration-[.125em]","[&.tw-test-hover_span]:tw-decoration-[.125em]","focus-visible:tw-outline-none","focus-visible:before:tw-ring-border-focus","[&:focus-visible_span]:tw-underline","[&:focus-visible_span]:tw-decoration-[.125em]","[&.tw-test-focus-visible_span]:tw-underline","[&.tw-test-focus-visible_span]:tw-decoration-[.125em]","tw-relative","before:tw-content-['']","before:tw-block","before:tw-absolute","before:-tw-inset-x-[0.1em]","before:-tw-inset-y-[0]","before:tw-rounded-md","before:tw-transition","before:tw-h-full","before:tw-w-[calc(100%_+_.25rem)]","before:tw-pointer-events-none","focus-visible:before:tw-ring-2","focus-visible:tw-z-10","aria-disabled:tw-no-underline","aria-disabled:tw-pointer-events-none","aria-disabled:!tw-text-fg-disabled","aria-disabled:hover:!tw-text-fg-disabled","aria-disabled:hover:tw-no-underline","[&[aria-disabled]:focus-visible_span]:!tw-no-underline"];class uw{focus(){this.el.nativeElement.focus()}constructor(){this.el=(0,a.WQX)(Fl.aKT),this.linkType=(0,o.hFB)("primary"),this.startIcon=(0,o.hFB)(void 0),this.endIcon=(0,o.hFB)(void 0),this.disabled=(0,o.hFB)(!1,{transform:o.L39}),this.isButton="BUTTON"===this.el.nativeElement.tagName,this.classList=(0,Rl.EW)(()=>{var e;return[!this.isButton&&"tw-inline-flex"].concat(cw).concat(null!==(e=lw[this.linkType()])&&void 0!==e?e:[])}),this.isButton&&Kl(this.el.nativeElement,this.disabled)}}uw.ɵfac=function(e){return new(e||uw)},uw.ɵcmp=Fl.VBU({type:uw,selectors:[["a","bitLink",""],["button","bitLink",""]],hostVars:3,hostBindings:function(e,t){2&e&&(Fl.BMQ("bit-aria-disable",!!t.isButton||null),Fl.HbH(t.classList()))},inputs:{linkType:[1,"linkType"],startIcon:[1,"startIcon"],endIcon:[1,"endIcon"],disabled:[1,"disabled"]},attrs:["bitLink",""],ngContentSelectors:["*"],decls:5,vars:2,consts:[[1,"tw-flex","tw-gap-2","tw-items-center"],["aria-hidden","true",3,"class"],["aria-hidden","true"]],template:function(e,t){1&e&&(Fl.NAR(),Fl.rj2(0,"div",0),Fl.nVh(1,ow,1,4,"i",1),Fl.rj2(2,"span"),Fl.SdG(3),Fl.eux(),Fl.nVh(4,aw,1,4,"i",1),Fl.eux()),2&e&&(Fl.R7$(),Fl.vxM(t.startIcon()?1:-1),Fl.R7$(3),Fl.vxM(t.endIcon()?4:-1))},encapsulation:2,changeDetection:0});var dw,hw=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function pw(e,t){if(1&e&&Fl.nrm(0,"auth-password-callout",13),2&e){const e=Fl.XpG();Fl.Y8G("message",e.flow===e.InputPasswordFlow.ChangePasswordDelegation?"changePasswordDelegationMasterPasswordPolicyInEffect":"masterPasswordPolicyInEffect")("policy",e.masterPasswordPolicyOptions)}}function vw(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-form-field")(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",14),Fl.j41(5,"button",8),Fl.mxI("toggledChange",function(t){a.eBV(e);const i=Fl.XpG();return Fl.DH7(i.showPassword,t)||(i.showPassword=t),a.Njj(t)}),Fl.k0s()()}if(2&e){const e=Fl.XpG();Fl.R7$(2),Fl.JRh(Fl.bMT(3,2,"currentMasterPass")),Fl.R7$(3),Fl.R50("toggled",e.showPassword)}}function fw(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",15),Fl.nI1(1,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.generatePassword())}),Fl.k0s()}2&e&&Fl.Y8G("label",Fl.bMT(1,1,"generatePassword"))}function mw(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",16),Fl.nI1(1,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.copy())}),Fl.k0s()}2&e&&Fl.Y8G("label",Fl.mNQ(Fl.bMT(1,2,"copyPassword")))}function gw(e,t){if(1&e&&(Fl.j41(0,"bit-hint")(1,"span",17),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.SpI("",Fl.bMT(3,3,"important")," "),Fl.R7$(2),Fl.Lme(" ",Fl.bMT(5,5,"masterPassImportant")," ",e.minPasswordLengthMsg,". ")}}function yw(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"bit-form-field")(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.nrm(5,"input",18),Fl.j41(6,"bit-hint"),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s()(),Fl.j41(9,"bit-form-control"),Fl.nrm(10,"input",19),Fl.j41(11,"bit-label"),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s()(),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(3),Fl.JRh(Fl.bMT(4,3,"masterPassHintLabel")),Fl.R7$(4),Fl.SpI(" ",Fl.brH(8,5,"masterPassHintText",e.formGroup.value.newPasswordHint.length.toString(),e.maxHintLength.toString())," "),Fl.R7$(5),Fl.JRh(Fl.bMT(13,9,"checkForBreaches"))}}function bw(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-form-control")(1,"input",20),Fl.bIt("change",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.rotateUserKeyClicked())}),Fl.k0s(),Fl.j41(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.j41(5,"a",21),Fl.nI1(6,"i18n"),Fl.nrm(7,"i",22),Fl.k0s()()()}2&e&&(Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,3,"rotateAccountEncKey")," "),Fl.R7$(2),Fl.Y8G("appA11yTitle",Fl.mNQ(Fl.bMT(6,5,"impactOfRotatingYourEncryptionKey"))))}function ww(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",26),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.onSecondaryButtonClick.emit())}),Fl.EFF(1),Fl.k0s()}if(2&e){const e=Fl.XpG(2);Fl.Y8G("loading",e.loading),Fl.R7$(),Fl.SpI(" ",e.secondaryButtonTextStr," ")}}function Sw(e,t){if(1&e&&(Fl.j41(0,"div",23)(1,"button",24),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.DNE(4,ww,2,2,"button",25),Fl.k0s()),2&e){const e=Fl.XpG();Fl.Y8G("ngClass",e.inlineButtons?"tw-flex-row":"tw-flex-col"),Fl.R7$(),Fl.Y8G("loading",e.loading),Fl.R7$(),Fl.SpI(" ",e.primaryButtonTextStr||Fl.bMT(3,4,"setMasterPassword")," "),Fl.R7$(2),Fl.Y8G("ngIf",e.secondaryButtonText)}}function kw(e,t){if(1&e&&Fl.nrm(0,"bit-error-summary",27),2&e){const e=Fl.XpG();Fl.Y8G("formGroup",e.formGroup)}}!function(e){e[e.SetInitialPasswordAccountRegistration=0]="SetInitialPasswordAccountRegistration",e[e.SetInitialPasswordAuthedUser=1]="SetInitialPasswordAuthedUser",e[e.ChangePassword=2]="ChangePassword",e[e.ChangePasswordWithOptionalUserKeyRotation=3]="ChangePasswordWithOptionalUserKeyRotation",e[e.ChangePasswordDelegation=4]="ChangePasswordDelegation"}(dw||(dw={}));class Iw{get minPasswordLengthMsg(){return null!=this.masterPasswordPolicyOptions&&this.masterPasswordPolicyOptions.minLength>0?this.i18nService.t("characterMinimum",this.masterPasswordPolicyOptions.minLength):this.i18nService.t("characterMinimum",this.minPasswordLength)}constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p){this.auditService=e,this.cipherService=t,this.configService=i,this.dialogService=n,this.formBuilder=r,this.i18nService=s,this.kdfConfigService=o,this.keyService=a,this.masterPasswordService=l,this.passwordGenerationService=c,this.platformUtilsService=u,this.policyService=d,this.toastService=h,this.validationService=p,this.passwordStrengthComponent=void 0,this.onPasswordFormSubmit=new Fl.bkB,this.onSecondaryButtonClick=new Fl.bkB,this.isSubmitting=new Fl.bkB,this.loading=!1,this.inlineButtons=!1,this.primaryButtonTextStr="",this.secondaryButtonTextStr="",this.InputPasswordFlow=dw,this.kdfConfig=null,this.minHintLength=0,this.maxHintLength=50,this.minPasswordLength=bd.minimumPasswordLength,this.minPasswordMsg="",this.passwordStrengthScore=0,this.showErrorSummary=!1,this.showPassword=!1,this.formGroup=this.formBuilder.nonNullable.group({newPassword:this.formBuilder.nonNullable.control("",[Il.k0.required,Il.k0.minLength(this.minPasswordLength)]),newPasswordConfirm:this.formBuilder.nonNullable.control("",Il.k0.required)},{validators:[Lb(Gb.InputsShouldMatch,"newPassword","newPasswordConfirm",this.i18nService.t("masterPassDoesntMatch"))]}),this.submit=()=>hw(this,void 0,void 0,function*(){var e,t,i,n,r,s,o,a;try{if(this.isSubmitting.emit(!0),this.verifyFlow(),this.formGroup.markAllAsTouched(),this.formGroup.invalid)return void(this.showErrorSummary=!0);const l=null!==(t=null===(e=this.formGroup.controls.currentPassword)||void 0===e?void 0:e.value)&&void 0!==t?t:"",c=this.formGroup.controls.newPassword.value,u=null!==(n=null===(i=this.formGroup.controls.newPasswordHint)||void 0===i?void 0:i.value)&&void 0!==n?n:"",d=null===(s=null===(r=this.formGroup.controls.checkForBreaches)||void 0===r?void 0:r.value)||void 0===s||s;if(this.flow===dw.ChangePasswordDelegation)return yield this.handleChangePasswordDelegationFlow(c);if(!this.email)throw new Error("Email not found.");if(this.flow===dw.SetInitialPasswordAccountRegistration)this.kdfConfig=zv;else{if(!this.userId)throw new Error("userId not found.");this.kdfConfig=yield(0,bo._)(this.kdfConfigService.getKdfConfig$(this.userId))}if(null==this.kdfConfig)throw new Error("KdfConfig not found.");const h=null!=this.userId?yield(0,bo._)(this.masterPasswordService.saltForUser$(this.userId)):this.masterPasswordService.emailToSalt(this.email);if(null==h)throw new Error("Salt not found.");if(this.flow===dw.ChangePassword||this.flow===dw.ChangePasswordWithOptionalUserKeyRotation){if(!(yield this.verifyCurrentPassword(l,this.kdfConfig)))return}if(!(yield this.verifyNewPassword(c,this.passwordStrengthScore,d)))return;const p=yield this.configService.getFeatureFlag(Wv.PM27086_UpdateAuthenticationApisForInputPassword);if(p){const e={newPassword:c,kdfConfig:this.kdfConfig,salt:h,newPasswordHint:u,newApisWithInputPasswordFlagEnabled:p};return this.flow!==dw.ChangePassword&&this.flow!==dw.ChangePasswordWithOptionalUserKeyRotation||(e.currentPassword=l),this.flow===dw.ChangePasswordWithOptionalUserKeyRotation&&(e.rotateUserKey=null===(o=this.formGroup.controls.rotateUserKey)||void 0===o?void 0:o.value),this.onPasswordFormSubmit.emit(e),e}const v=yield this.keyService.makeMasterKey(c,this.email,this.kdfConfig),f=yield this.keyService.hashMasterKey(c,v,mp.ServerAuthorization),m={newPassword:c,salt:h,newMasterKey:v,newServerMasterKeyHash:f,newLocalMasterKeyHash:yield this.keyService.hashMasterKey(c,v,mp.LocalAuthorization),newPasswordHint:u,kdfConfig:this.kdfConfig};if(this.flow===dw.ChangePassword||this.flow===dw.ChangePasswordWithOptionalUserKeyRotation){const e=yield this.keyService.makeMasterKey(l,this.email,this.kdfConfig),t=yield this.keyService.hashMasterKey(l,e,mp.ServerAuthorization),i=yield this.keyService.hashMasterKey(l,e,mp.LocalAuthorization);m.currentPassword=l,m.currentMasterKey=e,m.currentServerMasterKeyHash=t,m.currentLocalMasterKeyHash=i}return this.flow===dw.ChangePasswordWithOptionalUserKeyRotation&&(m.rotateUserKey=null===(a=this.formGroup.controls.rotateUserKey)||void 0===a?void 0:a.value),this.onPasswordFormSubmit.emit(m),m}catch(e){this.validationService.showError(e)}finally{this.isSubmitting.emit(!1)}})}ngOnInit(){this.addFormFieldsIfNecessary(),this.setButtonText()}addFormFieldsIfNecessary(){this.flow!==dw.ChangePasswordDelegation&&(this.formGroup.addControl("newPasswordHint",this.formBuilder.nonNullable.control("",[Il.k0.minLength(this.minHintLength),Il.k0.maxLength(this.maxHintLength)])),this.formGroup.addValidators([Lb(Gb.InputsShouldNotMatch,"newPassword","newPasswordHint",this.i18nService.t("hintEqualsPassword"))]),this.formGroup.addControl("checkForBreaches",this.formBuilder.nonNullable.control(!0))),this.flow!==dw.ChangePassword&&this.flow!==dw.ChangePasswordWithOptionalUserKeyRotation||(this.formGroup.addControl("currentPassword",this.formBuilder.nonNullable.control("",Il.k0.required)),this.formGroup.addValidators([Lb(Gb.InputsShouldNotMatch,"currentPassword","newPassword",this.i18nService.t("yourNewPasswordCannotBeTheSameAsYourCurrentPassword"))])),this.flow===dw.ChangePasswordWithOptionalUserKeyRotation&&this.formGroup.addControl("rotateUserKey",this.formBuilder.nonNullable.control(!1))}setButtonText(){var e,t,i,n;this.primaryButtonText&&(this.primaryButtonTextStr=this.i18nService.t(this.primaryButtonText.key,...null!==(t=null===(e=this.primaryButtonText)||void 0===e?void 0:e.placeholders)&&void 0!==t?t:[])),this.secondaryButtonText&&(this.secondaryButtonTextStr=this.i18nService.t(this.secondaryButtonText.key,...null!==(n=null===(i=this.secondaryButtonText)||void 0===i?void 0:i.placeholders)&&void 0!==n?n:[]))}verifyFlow(){if((this.flow===dw.SetInitialPasswordAccountRegistration||this.flow===dw.ChangePasswordDelegation)&&this.userId)throw new Error("There should be no active account userId passed down in a this flow.");if(this.flow!==dw.SetInitialPasswordAccountRegistration&&this.flow!==dw.ChangePasswordDelegation&&!this.userId)throw new Error("This flow requires that an active account userId be passed down.");if(this.flow===dw.ChangePasswordDelegation&&this.email)throw new Error("There should be no email passed down in this flow.");if(this.flow!==dw.ChangePasswordDelegation&&!this.email)throw new Error("This flow requires that an email be passed down.")}handleChangePasswordDelegationFlow(e){return hw(this,void 0,void 0,function*(){if(!(yield this.verifyNewPassword(e,this.passwordStrengthScore,!1)))return;const t={newPassword:e};return this.onPasswordFormSubmit.emit(t),t})}verifyCurrentPassword(e,t){return hw(this,void 0,void 0,function*(){if(!this.email)throw new Error("Email is required to verify current password.");if(!this.userId)throw new Error("userId is required to verify current password.");const i=yield this.keyService.makeMasterKey(e,this.email,t);return null!=(yield this.masterPasswordService.decryptUserKeyWithMasterKey(i,this.userId))||(this.toastService.showToast({variant:"error",title:"",message:this.i18nService.t("invalidMasterPassword")}),!1)})}verifyNewPassword(e,t,i){return hw(this,void 0,void 0,function*(){const n=i&&(yield this.auditService.passwordLeaked(e))>0,r=null!=t&&t<3;if(n&&r){if(!(yield this.dialogService.openSimpleDialog({title:{key:"weakAndExposedMasterPassword"},content:{key:"weakAndBreachedMasterPasswordDesc"},type:"warning"})))return!1}else if(r){if(!(yield this.dialogService.openSimpleDialog({title:{key:"weakMasterPassword"},content:{key:"weakMasterPasswordDesc"},type:"warning"})))return!1}else if(n){if(!(yield this.dialogService.openSimpleDialog({title:{key:"exposedMasterPassword"},content:{key:"exposedMasterPasswordDesc"},type:"warning"})))return!1}return!(null!=this.masterPasswordPolicyOptions&&!this.policyService.evaluateMasterPassword(this.passwordStrengthScore,e,this.masterPasswordPolicyOptions))||(this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("masterPasswordPolicyRequirementsNotMet")}),!1)})}rotateUserKeyClicked(){return hw(this,void 0,void 0,function*(){const e=this.formGroup.controls.rotateUserKey;if(null==e?void 0:e.value){if(!this.userId)throw new Error("userId not passed down");const t=yield this.cipherService.getAllDecrypted(this.userId);let i=!1;if(null!=t)for(let e=0;e<t.length;e++)if(null==t[e].organizationId&&t[e].hasOldAttachments){i=!0;break}if(i){return(yield this.dialogService.openSimpleDialog({title:{key:"warning"},content:{key:"oldAttachmentsNeedFixDesc"},acceptButtonText:{key:"learnMore"},cancelButtonText:{key:"close"},type:"warning"}))&&this.platformUtilsService.launchUri("https://bitwarden.com/help/attachments/#add-storage-space"),void e.setValue(!1)}(yield this.dialogService.openSimpleDialog({title:{key:"rotateEncKeyTitle"},content:this.i18nService.t("updateEncryptionKeyWarning")+" "+this.i18nService.t("updateEncryptionKeyAccountExportWarning")+" "+this.i18nService.t("rotateEncKeyConfirmation"),type:"warning"}))||e.setValue(!1)}})}getPasswordStrengthScore(e){this.passwordStrengthScore=e}generatePassword(){return hw(this,void 0,void 0,function*(){var e,t;const i=null!==(t=null===(e=yield this.passwordGenerationService.getOptions())||void 0===e?void 0:e[0])&&void 0!==t?t:{};if(this.formGroup.patchValue({newPassword:yield this.passwordGenerationService.generatePassword(i)}),!this.passwordStrengthComponent)throw new Error("PasswordStrengthComponent is not initialized");this.passwordStrengthComponent.updatePasswordStrength(this.formGroup.controls.newPassword.value)})}copy(){const e=this.formGroup.value.newPassword;null!=e&&(this.platformUtilsService.copyToClipboard(e,{window:window}),this.toastService.showToast({variant:"info",title:"",message:this.i18nService.t("valueCopied",this.i18nService.t("password"))}))}}Iw.ɵfac=function(e){return new(e||Iw)(Fl.rXU(zb),Fl.rXU(_b),Fl.rXU(Kb),Fl.rXU(lh),Fl.rXU(Il.ok),Fl.rXU(Ul),Fl.rXU(_v),Fl.rXU(Bp),Fl.rXU(Wb),Fl.rXU(gf),Fl.rXU(Hb),Fl.rXU(Jb),Fl.rXU(qb),Fl.rXU(Ud))},Iw.ɵcmp=Fl.VBU({type:Iw,selectors:[["auth-input-password"]],viewQuery:function(e,t){if(1&e&&Fl.GBs(mf,5),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.passwordStrengthComponent=e.first)}},inputs:{flow:"flow",email:[2,"email","email",e=>null==e?void 0:e.trim().toLowerCase()],userId:"userId",loading:"loading",masterPasswordPolicyOptions:"masterPasswordPolicyOptions",inlineButtons:"inlineButtons",primaryButtonText:"primaryButtonText",secondaryButtonText:"secondaryButtonText"},outputs:{onPasswordFormSubmit:"onPasswordFormSubmit",onSecondaryButtonClick:"onSecondaryButtonClick",isSubmitting:"isSubmitting"},decls:26,vars:27,consts:[[3,"formGroup","bitSubmit"],[3,"message","policy",4,"ngIf"],[4,"ngIf"],[1,"tw-mb-6"],[3,"disableMargin"],["id","input-password-form_new-password","bitInput","","type","password","formControlName","newPassword"],["type","button","bitIconButton","bwi-generate","bitSuffix","",3,"label","click",4,"ngIf"],["type","button","bitSuffix","","bitIconButton","bwi-clone",3,"label","click",4,"ngIf"],["type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle","",3,"toggledChange","toggled"],[3,"passwordStrengthScore","showText","email","password"],["id","input-password-form_new-password-confirm","bitInput","","type","password","formControlName","newPasswordConfirm"],["class","tw-flex tw-gap-2",3,"ngClass",4,"ngIf"],[3,"formGroup",4,"ngIf"],[3,"message","policy"],["id","input-password-form_current-password","bitInput","","type","password","formControlName","currentPassword"],["type","button","bitIconButton","bwi-generate","bitSuffix","",3,"click","label"],["type","button","bitSuffix","","bitIconButton","bwi-clone",3,"click","label"],[1,"tw-font-medium"],["id","input-password-form_new-password-hint","bitInput","","formControlName","newPasswordHint"],["id","input-password-form_check-for-breaches","type","checkbox","bitCheckbox","","formControlName","checkForBreaches"],["id","input-password-form_rotate-user-key","type","checkbox","bitCheckbox","","formControlName","rotateUserKey",3,"change"],["bitLink","","href","https://bitwarden.com/help/account-encryption-key/#rotate-your-encryption-key","target","_blank","rel","noreferrer",3,"appA11yTitle"],["aria-hidden","true",1,"bwi","bwi-question-circle"],[1,"tw-flex","tw-gap-2",3,"ngClass"],["type","submit","bitButton","","bitFormButton","","buttonType","primary",3,"loading"],["type","button","bitButton","","bitFormButton","","buttonType","secondary",3,"loading","click",4,"ngIf"],["type","button","bitButton","","bitFormButton","","buttonType","secondary",3,"click","loading"],[3,"formGroup"]],template:function(e,t){1&e&&(Fl.j41(0,"form",0),Fl.DNE(1,pw,1,2,"auth-password-callout",1)(2,vw,6,4,"bit-form-field",2),Fl.j41(3,"div",3)(4,"bit-form-field",4)(5,"bit-label"),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.nrm(9,"input",5),Fl.DNE(10,fw,2,3,"button",6)(11,mw,2,4,"button",7),Fl.j41(12,"button",8),Fl.mxI("toggledChange",function(e){return Fl.DH7(t.showPassword,e)||(t.showPassword=e),e}),Fl.k0s(),Fl.DNE(13,gw,6,7,"bit-hint",2),Fl.k0s(),Fl.j41(14,"tools-password-strength",9),Fl.bIt("passwordStrengthScore",function(e){return t.getPasswordStrengthScore(e)}),Fl.k0s()(),Fl.j41(15,"bit-form-field")(16,"bit-label"),Fl.EFF(17),Fl.nI1(18,"i18n"),Fl.nI1(19,"i18n"),Fl.k0s(),Fl.nrm(20,"input",10),Fl.j41(21,"button",8),Fl.mxI("toggledChange",function(e){return Fl.DH7(t.showPassword,e)||(t.showPassword=e),e}),Fl.k0s()(),Fl.DNE(22,yw,14,11,"ng-container",2)(23,bw,8,7,"bit-form-control",2)(24,Sw,5,6,"div",11)(25,kw,1,1,"bit-error-summary",12),Fl.k0s()),2&e&&(Fl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),Fl.R7$(),Fl.Y8G("ngIf",t.masterPasswordPolicyOptions),Fl.R7$(),Fl.Y8G("ngIf",t.flow===t.InputPasswordFlow.ChangePassword||t.flow===t.InputPasswordFlow.ChangePasswordWithOptionalUserKeyRotation),Fl.R7$(2),Fl.Y8G("disableMargin",!0),Fl.R7$(2),Fl.JRh(t.flow===t.InputPasswordFlow.SetInitialPasswordAccountRegistration||t.flow===t.InputPasswordFlow.SetInitialPasswordAuthedUser?Fl.bMT(7,19,"masterPassword"):Fl.bMT(8,21,"newMasterPass")),Fl.R7$(4),Fl.Y8G("ngIf",t.flow===t.InputPasswordFlow.ChangePasswordDelegation),Fl.R7$(),Fl.Y8G("ngIf",t.flow===t.InputPasswordFlow.ChangePasswordDelegation),Fl.R7$(),Fl.R50("toggled",t.showPassword),Fl.R7$(),Fl.Y8G("ngIf",t.flow!==t.InputPasswordFlow.ChangePasswordDelegation),Fl.R7$(),Fl.Y8G("showText",!0)("email",t.email)("password",t.formGroup.controls.newPassword.value),Fl.R7$(3),Fl.JRh(t.flow===t.InputPasswordFlow.SetInitialPasswordAccountRegistration||t.flow===t.InputPasswordFlow.SetInitialPasswordAuthedUser?Fl.bMT(18,23,"confirmMasterPassword"):Fl.bMT(19,25,"confirmNewMasterPass")),Fl.R7$(4),Fl.R50("toggled",t.showPassword),Fl.R7$(),Fl.Y8G("ngIf",t.flow!==t.InputPasswordFlow.ChangePasswordDelegation),Fl.R7$(),Fl.Y8G("ngIf",t.flow===t.InputPasswordFlow.ChangePasswordWithOptionalUserKeyRotation),Fl.R7$(),Fl.Y8G("ngIf",t.flow!==t.InputPasswordFlow.ChangePasswordDelegation),Fl.R7$(),Fl.Y8G("ngIf",t.showErrorSummary))},dependencies:[pc,jd,Md,id,td,hd,Qb,Gu,Sc,Ac,hu,fu,tw,ju,iw,nw,Ql,Zl,qc,sf,rw,jb,mf,Il.X1,Il.qT,Il.me,Il.Zm,Il.BC,Il.cb,Il.j4,Il.JD,Hh,uw,ec,kl.YU,kl.bT,sc],encapsulation:2});var Cw=i(6056);class Tw{constructor(e){this.svg=e}}class Pw extends Error{constructor(){super("Dynamic content in icons is not allowed due to risk of user-injected XSS.")}}function Fw(e,...t){if(t.length>0)throw new Pw;return new Tw(e[0])}const Rw=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="3.33 3.33 73.33 73.33">
<path class="tw-fill-illustration-bg-primary" d="m16.921 66.662-1.673-1.674a17.425 17.425 0 0 1-3.735-19.09l3.215-7.627c.717-1.7 1.283-3.46 1.692-5.26l3.285-14.46a2.222 2.222 0 0 1 2.666-1.673 5.079 5.079 0 0 1 3.855 5.857l-2.025 11.138a4.14 4.14 0 0 0 .58 2.963c.433.68 1.443.626 1.8-.097l9.292-18.772L41.46 8.09a2.163 2.163 0 0 1 2.85-.87 4.944 4.944 0 0 1 2.158 6.735l-3.95 7.46-4.144 10.261a3.619 3.619 0 0 0 .252 3.218.905.905 0 0 0 1.478.105l9.44-11.595 10.003-10.718a2.359 2.359 0 0 1 3.474.026 5.392 5.392 0 0 1-.048 7.287l-7.595 8.178-8.34 10.405a3.512 3.512 0 0 0-.649 3.12.878.878 0 0 0 1.344.493l11.092-7.608 11.191-5.598a2.29 2.29 0 0 1 3.215 1.375 5.236 5.236 0 0 1-2.74 6.26l-8.625 4.14c-.26.124-.51.267-.749.428l-9.414 6.322a3.73 3.73 0 0 0-1.64 3.383.933.933 0 0 0 1.284.792l8.651-3.544 8.318-2.138a1.731 1.731 0 0 1 2.057 1.084 3.957 3.957 0 0 1-2.402 5.088l-6.886 2.428-9.987 4.926c-.446.22-.863.495-1.241.818l-8.522 7.274c-7.143 6.098-17.774 5.68-24.415-.962Z"/>
<path class="tw-fill-illustration-bg-secondary" fill-rule="evenodd" d="M24.185 36.4a.833.833 0 0 1 1.175-.082c6.917 6.003 7.658 16.477 1.655 23.394a.833.833 0 1 1-1.259-1.093c5.4-6.221 4.734-15.643-1.488-21.043a.833.833 0 0 1-.083-1.175Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" fill-rule="evenodd" d="M75.833 61.667c.46 0 .834.373.834.833 0 7.824-6.343 14.167-14.167 14.167a.833.833 0 1 1 0-1.667C69.403 75 75 69.404 75 62.5c0-.46.373-.833.833-.833ZM4.167 18.334a.833.833 0 0 1-.834-.833c0-7.824 6.343-14.167 14.167-14.167a.833.833 0 0 1 0 1.667C10.596 5 5 10.597 5 17.5c0 .46-.373.833-.833.833Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" fill-rule="evenodd" d="M71.667 61.667c.46 0 .833.373.833.833 0 5.523-4.477 10-10 10a.833.833 0 0 1 0-1.666 8.333 8.333 0 0 0 8.333-8.334c0-.46.373-.833.834-.833ZM8.333 18.334a.833.833 0 0 1-.833-.833c0-5.523 4.477-10 10-10a.833.833 0 0 1 0 1.666 8.333 8.333 0 0 0-8.333 8.334c0 .46-.373.833-.834.833Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M58.968 12.05a3.16 3.16 0 0 1 4.632.058 6.15 6.15 0 0 1-.164 8.427l-7.431 7.597-8.351 10.945a2.74 2.74 0 0 0-.466 2.384c.004.014.01.02.014.025a.063.063 0 0 0 .024.015c.01.004.02.005.028.004a.056.056 0 0 0 .027-.01l11.12-7.63 11.244-5.622a3.124 3.124 0 0 1 4.383 1.875 6.07 6.07 0 0 1-3.175 7.257l-7.942 3.811c-.678.325-1.332.7-1.957 1.119l-8.785 5.9a2.898 2.898 0 0 0-1.274 2.628.1.1 0 0 0 .137.084l8.705-3.565 8.372-2.153a2.565 2.565 0 0 1 3.048 1.605 4.79 4.79 0 0 1-2.907 6.16l-6.84 2.41-9.942 4.905c-.384.19-.743.426-1.069.704l-8.522 7.275c-7.474 6.38-18.597 5.942-25.545-1.007l-1.674-1.673a18.259 18.259 0 0 1-3.913-20.004l3.215-7.627a30.676 30.676 0 0 0 1.647-5.12l3.285-14.461a3.055 3.055 0 0 1 3.667-2.3 5.912 5.912 0 0 1 4.487 6.818l-2.025 11.138a3.306 3.306 0 0 0 .463 2.366c.085.133.281.122.351-.018l9.301-18.793 5.6-9.899a2.996 2.996 0 0 1 3.947-1.204 5.777 5.777 0 0 1 2.522 7.87l-3.93 7.422-4.128 10.223a2.782 2.782 0 0 0 .194 2.473.07.07 0 0 0 .115.008l10.415-12.856 9.096-9.564Zm3.396 1.176a1.493 1.493 0 0 0-2.189-.027l-9.05 9.516L40.75 35.52a1.737 1.737 0 0 1-2.84-.2 4.45 4.45 0 0 1-.31-3.955l4.16-10.302 3.971-7.499a4.11 4.11 0 0 0-1.794-5.6 1.33 1.33 0 0 0-1.752.535l-5.576 9.859-9.281 18.75c-.646 1.305-2.47 1.403-3.25.175a4.972 4.972 0 0 1-.698-3.559l2.025-11.138a4.246 4.246 0 0 0-3.222-4.896 1.389 1.389 0 0 0-1.667 1.045l-3.284 14.461c-.42 1.847-1.001 3.654-1.737 5.399l-3.215 7.627a16.592 16.592 0 0 0 3.556 18.177l1.674 1.674c6.333 6.333 16.472 6.733 23.284.918l8.522-7.275c.43-.368.906-.68 1.414-.931l10.031-4.949 6.933-2.444a3.124 3.124 0 0 0 1.897-4.017.898.898 0 0 0-1.068-.562l-8.261 2.124-8.6 3.522a1.766 1.766 0 0 1-2.43-1.499 4.564 4.564 0 0 1 2.007-4.139l8.785-5.9c.691-.464 1.414-.877 2.165-1.237l7.942-3.812a4.403 4.403 0 0 0 2.303-5.264 1.457 1.457 0 0 0-2.045-.875l-11.14 5.572-11.027 7.564c-.98.672-2.33.177-2.642-.97a4.407 4.407 0 0 1 .748-3.833l8.413-11.026 7.502-7.67a4.483 4.483 0 0 0 .12-6.144Z" clip-rule="evenodd"/>
</svg>
`,xw=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 8.33 80 66.67">
<path class="tw-fill-illustration-bg-primary" d="M8.333 66.667H20L18.333 75H10l-1.667-8.333Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M8.333 66.667 10 75h8.333L20 66.667H8.333Zm2.033 1.667 1 5h5.601l1-5h-7.6Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="M60 66.667h11.667L70 75h-8.333L60 66.667Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M60 66.667 61.667 75H70l1.667-8.333H60Zm2.033 1.667 1 5h5.6l1-5h-7.6Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" fill-rule="evenodd" d="m10.417 68.334.416 2.5H17.5l.417-2.5h-7.5ZM62.084 68.334l.416 2.5h6.667l.416-2.5h-7.5Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="M0 15a6.667 6.667 0 0 1 6.667-6.666h66.666A6.667 6.667 0 0 1 80 15.001v46.666a6.667 6.667 0 0 1-6.666 6.667H6.666A6.667 6.667 0 0 1 0 61.667V15.001Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M73.334 10H6.666a5 5 0 0 0-5 5v46.667a5 5 0 0 0 5 5h66.666a5 5 0 0 0 5-5V15.001a5 5 0 0 0-5-5ZM6.666 8.335A6.667 6.667 0 0 0 0 15.001v46.666a6.667 6.667 0 0 0 6.667 6.667h66.666A6.667 6.667 0 0 0 80 61.667V15.001a6.667 6.667 0 0 0-6.666-6.667H6.666Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M6.667 18.333A3.333 3.333 0 0 1 10 15h60a3.333 3.333 0 0 1 3.333 3.333v40A3.333 3.333 0 0 1 70 61.667H10a3.333 3.333 0 0 1-3.333-3.334v-40Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M70 16.667H10c-.92 0-1.667.746-1.667 1.666v40C8.333 59.253 9.08 60 10 60h60c.92 0 1.667-.746 1.667-1.667v-40c0-.92-.746-1.666-1.667-1.666ZM10 15a3.333 3.333 0 0 0-3.333 3.333v40A3.333 3.333 0 0 0 10 61.667h60a3.333 3.333 0 0 0 3.333-3.334v-40A3.333 3.333 0 0 0 70 15H10Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="M45 38.333c0 8.745-7.089 15.834-15.833 15.834-8.745 0-15.834-7.09-15.834-15.834S20.423 22.5 29.167 22.5 45 29.589 45 38.333Z"/>
<path class="tw-fill-illustration-tertiary" d="M36.667 38.334a7.5 7.5 0 1 1-15 0 7.5 7.5 0 0 1 15 0Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M30 25a.833.833 0 0 0-1.666 0v4.204A9.125 9.125 0 0 0 23.3 31.29l-2.973-2.973a.834.834 0 0 0-1.179 1.179l2.973 2.973a9.125 9.125 0 0 0-2.084 5.032h-4.204a.833.833 0 1 0 0 1.667h4.204a9.125 9.125 0 0 0 2.084 5.032l-2.973 2.974a.833.833 0 1 0 1.179 1.178l2.973-2.973a9.127 9.127 0 0 0 5.033 2.085v4.204a.833.833 0 0 0 1.666 0v-4.204a9.127 9.127 0 0 0 5.033-2.085l2.973 2.973a.833.833 0 0 0 1.178-1.178l-2.973-2.974a9.125 9.125 0 0 0 2.085-5.032H42.5a.833.833 0 1 0 0-1.667h-4.204a9.125 9.125 0 0 0-2.085-5.032l2.973-2.973a.833.833 0 1 0-1.178-1.179l-2.973 2.973A9.125 9.125 0 0 0 30 29.204V25Zm4.468 18.64a7.5 7.5 0 1 1 0-10.61h.002l.003.003a7.476 7.476 0 0 1 2.194 5.297v.004c0 2.07-.839 3.944-2.195 5.301l-.002.002-.002.002ZM32.5 38.333a3.333 3.333 0 1 1-6.667 0 3.333 3.333 0 0 1 6.667 0Zm1.667 0a5 5 0 1 1-10 0 5 5 0 0 1 10 0Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="M69.167 21.667c0-.92.746-1.667 1.666-1.667h3.334c.92 0 1.666.746 1.666 1.667V30c0 .92-.746 1.667-1.666 1.667h-3.334c-.92 0-1.666-.747-1.666-1.667v-8.333Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M74.167 21.667h-3.334V30h3.334v-8.333ZM70.833 20c-.92 0-1.666.746-1.666 1.667V30c0 .92.746 1.667 1.666 1.667h3.334c.92 0 1.666-.747 1.666-1.667v-8.333c0-.92-.746-1.667-1.666-1.667h-3.334Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="M69.167 46.667c0-.92.746-1.667 1.666-1.667h3.334c.92 0 1.666.746 1.666 1.667V55c0 .92-.746 1.667-1.666 1.667h-3.334c-.92 0-1.666-.747-1.666-1.667v-8.333Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M74.167 46.667h-3.334V55h3.334v-8.333ZM70.833 45c-.92 0-1.666.746-1.666 1.667V55c0 .92.746 1.667 1.666 1.667h3.334c.92 0 1.666-.747 1.666-1.667v-8.333c0-.92-.746-1.667-1.666-1.667h-3.334Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" fill-rule="evenodd" d="M70.834 51.667V55h3.333v-3.333h-3.334ZM70.834 26.667V30h3.333v-3.333h-3.334Z" clip-rule="evenodd"/>
</svg>
`;class Aw{}class Dw{}class Ew{}class $w{}class Ow extends $w{}class Uw{}class Mw{}class Nw{}var Vw;!function(e){e[e.Password=0]="Password",e[e.Sso=1]="Sso",e[e.UserApiKey=2]="UserApiKey",e[e.AuthRequest=3]="AuthRequest",e[e.WebAuthn=4]="WebAuthn"}(Vw||(Vw={}));class Bw{constructor(e=null,t=null,i=!1){this.provider=e,this.token=t,this.remember=i}}class jw{constructor(e){this.id=e.id,this.rawId=bd.fromBufferToUrlB64(e.rawId),this.type=e.type,this.extensions={}}}class Gw extends jw{constructor(e){if(super(e),!(e.response instanceof AuthenticatorAssertionResponse))throw new Error("Invalid authenticator response");this.response={authenticatorData:bd.fromBufferToUrlB64(e.response.authenticatorData),signature:bd.fromBufferToUrlB64(e.response.signature),clientDataJSON:bd.fromBufferToUrlB64(e.response.clientDataJSON),userHandle:bd.fromBufferToUrlB64(e.response.userHandle)}}static fromJSON(e){return Object.assign(Object.create(Gw.prototype),e)}}class Lw{constructor(e,t,i,n){this.email=e,this.masterPassword=t,this.twoFactor=i,this.masterPasswordPoliciesFromOrgInvite=n,this.type=Vw.Password}}class zw{constructor(e,t,i,n,r,s){this.code=e,this.codeVerifier=t,this.redirectUrl=i,this.orgId=n,this.email=r,this.twoFactor=s,this.type=Vw.Sso}}class _w{constructor(e,t,i,n,r){this.email=e,this.accessCode=t,this.authRequestId=i,this.decryptedUserKey=n,this.twoFactor=r,this.type=Vw.AuthRequest}static fromJSON(e){return Object.assign(new _w(e.email,e.accessCode,e.authRequestId,null,e.twoFactor?new Bw(e.twoFactor.provider,e.twoFactor.token,e.twoFactor.remember):e.twoFactor),{decryptedUserKey:Dv.fromJSON(e.decryptedUserKey)})}}class Kw{constructor(e,t,i){this.token=e,this.deviceResponse=t,this.prfKey=i,this.type=Vw.WebAuthn}static fromJSON(e){return new Kw(e.token,Object.assign(Object.create(Gw.prototype),e.deviceResponse),Dv.fromJSON(e.prfKey))}}class Xw{static fromResponse(e){var t;if(null==e)return;const i=new Xw;return i.keyConnectorUrl=null!==(t=null==e?void 0:e.keyConnectorUrl)&&void 0!==t?t:null,i}static fromJSON(e){if(null!=e)return Object.assign(new Xw,e)}}class qw{static fromResponse(e){if(null==e)return;if(!e.encryptedPrivateKey||!e.encryptedUserKey)return;const t=new qw;return t.encryptedPrivateKey=e.encryptedPrivateKey.encryptedString,t.encryptedUserKey=e.encryptedUserKey.encryptedString,t.credentialId=e.credentialId,t.transports=e.transports||[],t}static fromJSON(e){if(null!=e)return Object.assign(new qw,e)}}class Ww{static fromResponse(e){var t,i,n,r;if(null==e)return;const s=new Ww;return s.hasAdminApproval=null!==(t=null==e?void 0:e.hasAdminApproval)&&void 0!==t&&t,s.hasLoginApprovingDevice=null!==(i=null==e?void 0:e.hasLoginApprovingDevice)&&void 0!==i&&i,s.hasManageResetPasswordPermission=null!==(n=null==e?void 0:e.hasManageResetPasswordPermission)&&void 0!==n&&n,s.isTdeOffboarding=null!==(r=null==e?void 0:e.isTdeOffboarding)&&void 0!==r&&r,s}static fromJSON(e){if(null!=e)return Object.assign(new Ww,e)}}class Yw{static fromIdentityTokenResponse(e){if(null==e)throw new Error("User Decryption Options are required for client initialization. Response is nullish.");const t=new Yw;if(!e.userDecryptionOptions)throw new Error("User Decryption Options are required for client initialization. userDecryptionOptions is missing in response.");{const i=e.userDecryptionOptions;if(t.hasMasterPassword=i.hasMasterPassword,t.trustedDeviceOption=Ww.fromResponse(i.trustedDeviceOption),t.keyConnectorOption=Xw.fromResponse(i.keyConnectorOption),i.webAuthnPrfOption){const e=qw.fromResponse(i.webAuthnPrfOption);e&&(t.webAuthnPrfOptions=[e])}}return t}static fromJSON(e){const t=Object.assign(new Yw,e);return t.trustedDeviceOption=Ww.fromJSON(null==e?void 0:e.trustedDeviceOption),t.keyConnectorOption=Xw.fromJSON(null==e?void 0:e.keyConnectorOption),(null==e?void 0:e.webAuthnPrfOptions)&&Array.isArray(e.webAuthnPrfOptions)&&(t.webAuthnPrfOptions=e.webAuthnPrfOptions.map(e=>qw.fromJSON(e)).filter(e=>void 0!==e)),t}}var Hw=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Jw=new m(M,"loginEmail",{deserializer:e=>e}),Zw=new m(U,"storedEmail",{deserializer:e=>e});class Qw{constructor(e,t,i){this.accountService=e,this.authService=t,this.stateProvider=i,this.loginEmailState=this.stateProvider.getGlobal(Jw),this.storedEmailState=this.stateProvider.getGlobal(Zw),this.addingAccount$=this.authService.authStatuses$.pipe((0,go.n)(e=>Hw(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.accountService.activeAccount$);return t&&delete e[t.id],Object.values(e).some(e=>e!==Pd.LoggedOut)}))),this.loginEmail$=this.loginEmailState.state$,this.rememberedEmail$=this.storedEmailState.state$.pipe((0,go.n)(e=>Hw(this,void 0,void 0,function*(){return(yield(0,bo._)(this.addingAccount$))?null:e})))}setLoginEmail(e){return Hw(this,void 0,void 0,function*(){yield this.loginEmailState.update(t=>e)})}clearLoginEmail(){return Hw(this,void 0,void 0,function*(){yield this.loginEmailState.update(e=>null)})}setRememberedEmailChoice(e,t){return Hw(this,void 0,void 0,function*(){t?yield this.storedEmailState.update(t=>e):yield this.storedEmailState.update(e=>null)})}clearRememberedEmail(){return Hw(this,void 0,void 0,function*(){yield this.storedEmailState.update(e=>null)})}}class eS{constructor(e){this.email=e}}class tS{constructor(e){this.response=e}getResponseProperty(e,t=null,i=!1){if(null==e||""===e)throw new Error("propertyName must not be null/empty.");if(null==t&&null!=this.response&&(t=this.response),null==t)return null;if(!i&&void 0===t[e]){let i=null;i=e.charAt(0)===e.charAt(0).toUpperCase()?e.charAt(0).toLowerCase():e.charAt(0).toUpperCase(),e.length>1&&(i+=e.slice(1)),void 0===t[e=i]&&(e=e.toLowerCase()),void 0===t[e]&&(e=e.toUpperCase())}return t[e]}}class iS extends tS{constructor(e,t,i){super(e);let n=null;if(null!=e){const t=this.getResponseProperty("ErrorModel");n=t&&i?t:e}429===t?this.message="Rate limit exceeded. Try again later.":n&&(this.message=this.getResponseProperty("Message",n),this.validationErrors=this.getResponseProperty("ValidationErrors",n)),this.statusCode=t}getSingleMessage(){if(null==this.validationErrors)return this.message;for(const e in this.validationErrors)if(this.validationErrors.hasOwnProperty(e)&&this.validationErrors[e].length)return this.validationErrors[e][0];return this.message}getAllMessages(){const e=[];if(null==this.validationErrors)return e;for(const t in this.validationErrors)this.validationErrors.hasOwnProperty(t)&&this.validationErrors[t].forEach(i=>{let n="";if(t.indexOf("[")>-1&&t.indexOf("]")>-1){const e=t.lastIndexOf(".");n=t.substr(0,e>-1?e:t.length)+": "}e.push(n+i)});return e}}class nS{constructor(e,t){this.type=t.getDevice(),this.name=t.getDeviceString(),this.identifier=e,this.pushToken=null}static fromJSON(e){return Object.assign(Object.create(nS.prototype),e)}}class rS{constructor(e,t){this.twoFactor=e,this.device=null!=t?t:null}setTwoFactor(e){this.twoFactor=e}setAuthRequestAccessCode(e){this.authRequest=e}toIdentityToken(e){const t={scope:"api offline_access",client_id:e};return this.device&&(t.deviceType=this.device.type,t.deviceIdentifier=this.device.identifier,t.deviceName=this.device.name),this.authRequest&&(t.authRequest=this.authRequest),this.twoFactor&&this.twoFactor.token&&null!=this.twoFactor.provider&&(t.twoFactorToken=this.twoFactor.token,t.twoFactorProvider=this.twoFactor.provider,t.twoFactorRemember=this.twoFactor.remember?"1":"0"),t}}class sS extends rS{constructor(e,t,i,n,r){super(i,n),this.email=e,this.masterPasswordHash=t,this.twoFactor=i,this.newDeviceOtp=r}toIdentityToken(e){const t=super.toIdentityToken(e);return t.grant_type="password",t.username=this.email,t.password=this.masterPasswordHash,this.newDeviceOtp&&(t.newDeviceOtp=this.newDeviceOtp),t}static fromJSON(e){return Object.assign(Object.create(sS.prototype),e,{device:e.device?nS.fromJSON(e.device):void 0,twoFactor:e.twoFactor?Object.assign(new Bw,e.twoFactor):void 0})}}var oS,aS;!function(e){e[e.Authenticator=0]="Authenticator",e[e.Email=1]="Email",e[e.Duo=2]="Duo",e[e.Yubikey=3]="Yubikey",e[e.U2f=4]="U2f",e[e.Remember=5]="Remember",e[e.OrganizationDuo=6]="OrganizationDuo",e[e.WebAuthn=7]="WebAuthn",e[e.RecoveryCode=8]="RecoveryCode"}(oS||(oS={}));class lS{constructor(){this.twoFactorProviders=null}get requiresTwoFactor(){return null!=this.twoFactorProviders}get requiresSso(){return!bd.isNullOrWhitespace(this.ssoOrganizationIdentifier)}}!function(e){e[e.None=0]="None",e[e.SsoNewJitProvisionedUser=1]="SsoNewJitProvisionedUser",e[e.TdeUserWithoutPasswordHasPasswordResetPermission=2]="TdeUserWithoutPasswordHasPasswordResetPermission",e[e.TdeOffboarding=3]="TdeOffboarding",e[e.TdeOffboardingUntrustedDevice=4]="TdeOffboardingUntrustedDevice",e[e.AdminForcePasswordReset=5]="AdminForcePasswordReset",e[e.WeakMasterPassword=6]="WeakMasterPassword"}(aS||(aS={}));class cS extends tS{constructor(e){var t;super(e),this.deviceVerified=null!==(t=this.getResponseProperty("DeviceVerified"))&&void 0!==t&&t}}class uS extends tS{constructor(e){super(e),this.ssoOrganizationIdentifier=this.getResponseProperty("SsoOrganizationIdentifier")}}class dS{constructor(e){if(this.securityState=null,"object"!=typeof e||null==e)throw new TypeError("Response must be an object");if(!("securityState"in e)||"string"!=typeof e.securityState)throw new TypeError("Response must contain a valid securityState");this.securityState=e.securityState}}class hS{constructor(e){if(this.signedPublicKey=null,"object"!=typeof e||null==e)throw new TypeError("Response must be an object");if(!("publicKey"in e)||"string"!=typeof e.publicKey)throw new TypeError("Response must contain a valid publicKey");if(this.publicKey=bd.fromB64ToArray(e.publicKey),!("wrappedPrivateKey"in e)||"string"!=typeof e.wrappedPrivateKey)throw new TypeError("Response must contain a valid wrappedPrivateKey");this.wrappedPrivateKey=e.wrappedPrivateKey,"signedPublicKey"in e&&"string"==typeof e.signedPublicKey?this.signedPublicKey=e.signedPublicKey:this.signedPublicKey=null}}class pS{constructor(e){if("object"!=typeof e||null==e)throw new TypeError("Response must be an object");if(!("wrappedSigningKey"in e)||"string"!=typeof e.wrappedSigningKey)throw new TypeError("Response must contain a valid wrappedSigningKey");if(this.wrappedSigningKey=e.wrappedSigningKey,!("verifyingKey"in e)||"string"!=typeof e.verifyingKey)throw new TypeError("Response must contain a valid verifyingKey");this.verifyingKey=e.verifyingKey}}class vS{constructor(e){if(this.signatureKeyPair=null,this.securityState=null,"object"!=typeof e||null==e)throw new TypeError("Response must be an object");if(!("publicKeyEncryptionKeyPair"in e)||"object"!=typeof e.publicKeyEncryptionKeyPair)throw new TypeError("Response must contain a valid publicKeyEncryptionKeyPair");if(this.publicKeyEncryptionKeyPair=new hS(e.publicKeyEncryptionKeyPair),"signatureKeyPair"in e&&"object"==typeof e.signatureKeyPair&&null!=e.signatureKeyPair&&(this.signatureKeyPair=new pS(e.signatureKeyPair)),"securityState"in e&&"object"==typeof e.securityState&&null!=e.securityState&&(this.securityState=new dS(e.securityState)),null!==this.signatureKeyPair&&null===this.securityState||null===this.signatureKeyPair&&null!==this.securityState)throw new TypeError("Both signatureKeyPair and securityState must be present or absent together")}toWrappedAccountCryptographicState(){if(null===this.signatureKeyPair&&null===this.securityState)return{V1:{private_key:this.publicKeyEncryptionKeyPair.wrappedPrivateKey}};if(null!==this.signatureKeyPair&&null!==this.securityState)return{V2:{private_key:this.publicKeyEncryptionKeyPair.wrappedPrivateKey,signing_key:this.signatureKeyPair.wrappedSigningKey,signed_public_key:this.publicKeyEncryptionKeyPair.signedPublicKey,security_state:this.securityState.securityState}};throw new Error("Both signatureKeyPair and securityState must be present or absent together")}isV2Encryption(){return null!==this.signatureKeyPair&&null!==this.securityState}}class fS extends tS{constructor(e){super(e),this.minComplexity=this.getResponseProperty("MinComplexity"),this.minLength=this.getResponseProperty("MinLength"),this.requireUpper=this.getResponseProperty("RequireUpper"),this.requireLower=this.getResponseProperty("RequireLower"),this.requireNumbers=this.getResponseProperty("RequireNumbers"),this.requireSpecial=this.getResponseProperty("RequireSpecial"),this.enforceOnLogin=this.getResponseProperty("EnforceOnLogin")}}class mS extends tS{constructor(e){super(e);const t=this.getResponseProperty("KdfType");if(null==t||"number"!=typeof t)throw new Error("KDF config response does not contain a valid KDF type");this.kdfType=t;const i=this.getResponseProperty("Iterations");if(null==i||"number"!=typeof i)throw new Error("KDF config response does not contain a valid number of iterations");if(this.iterations=i,this.kdfType===Mv.Argon2id){const e=this.getResponseProperty("Memory");if(null==e||"number"!=typeof e)throw new Error("KDF config response does not contain a valid memory size for Argon2id");const t=this.getResponseProperty("Parallelism");if(null==t||"number"!=typeof t)throw new Error("KDF config response does not contain a valid parallelism for Argon2id");this.memory=e,this.parallelism=t}}toKdfConfig(){switch(this.kdfType){case Mv.Argon2id:return new Gv(this.iterations,this.memory,this.parallelism);case Mv.PBKDF2_SHA256:return new jv(this.iterations)}}}class gS{constructor(e,t,i){this.salt=e,this.kdf=t,this.masterKeyWrappedUserKey=i}static fromSdk(e){return new gS(e.salt,Lv(e.kdf),e.masterKeyWrappedUserKey)}toJSON(){return{salt:this.salt,kdf:this.kdf,masterKeyWrappedUserKey:this.masterKeyWrappedUserKey}}static fromJSON(e){return null==e?null:new gS(e.salt,e.kdf.kdfType===Mv.PBKDF2_SHA256?jv.fromJSON(e.kdf):Gv.fromJSON(e.kdf),e.masterKeyWrappedUserKey)}}function yS(e){return{salt:e.salt,kdf:Lv(e.kdf),masterPasswordAuthenticationHash:e.masterPasswordAuthenticationHash}}class bS extends tS{constructor(e){super(e);const t=this.getResponseProperty("Salt");if(null==t||"string"!=typeof t)throw new Error("MasterPasswordUnlockResponse does not contain a valid salt");this.salt=t,this.kdf=new mS(this.getResponseProperty("Kdf"));const i=this.getResponseProperty("MasterKeyEncryptedUserKey");if(null==i||"string"!=typeof i)throw new Error("MasterPasswordUnlockResponse does not contain a valid master key encrypted user key");this.masterKeyWrappedUserKey=i}toMasterPasswordUnlockData(){return new gS(this.salt,this.kdf.toKdfConfig(),this.masterKeyWrappedUserKey)}}class wS extends tS{constructor(e){super(e),this.keyConnectorUrl=this.getResponseProperty("KeyConnectorUrl")}}class SS extends tS{constructor(e){super(e),this.hasAdminApproval=this.getResponseProperty("HasAdminApproval"),this.hasLoginApprovingDevice=this.getResponseProperty("HasLoginApprovingDevice"),this.hasManageResetPasswordPermission=this.getResponseProperty("HasManageResetPasswordPermission"),this.isTdeOffboarding=this.getResponseProperty("IsTdeOffboarding"),e.EncryptedPrivateKey&&(this.encryptedPrivateKey=new Pp(this.getResponseProperty("EncryptedPrivateKey"))),e.EncryptedUserKey&&(this.encryptedUserKey=new Pp(this.getResponseProperty("EncryptedUserKey")))}}class kS extends tS{constructor(e){super(e);const t=this.getResponseProperty("EncryptedPrivateKey");t&&(this.encryptedPrivateKey=new Pp(t));const i=this.getResponseProperty("EncryptedUserKey");i&&(this.encryptedUserKey=new Pp(i)),this.credentialId=this.getResponseProperty("CredentialId"),this.transports=this.getResponseProperty("Transports")||[]}}class IS extends tS{constructor(e){super(e),this.hasMasterPassword=this.getResponseProperty("HasMasterPassword");const t=this.getResponseProperty("MasterPasswordUnlock");null!=t&&"object"==typeof t&&(this.masterPasswordUnlock=new bS(t)),e.TrustedDeviceOption&&(this.trustedDeviceOption=new SS(this.getResponseProperty("TrustedDeviceOption"))),e.KeyConnectorOption&&(this.keyConnectorOption=new wS(this.getResponseProperty("KeyConnectorOption"))),e.WebAuthnPrfOption&&(this.webAuthnPrfOption=new kS(this.getResponseProperty("WebAuthnPrfOption")))}}class CS extends tS{constructor(e){super(e),this.accountKeysResponseModel=null;const t=this.getResponseProperty("access_token");if(null==t||"string"!=typeof t)throw new Error("Identity response does not contain a valid access token");const i=this.getResponseProperty("token_type");if(null==i||"string"!=typeof i)throw new Error("Identity response does not contain a valid token type");this.accessToken=t,this.tokenType=i;const n=this.getResponseProperty("expires_in");null!=n&&"number"==typeof n&&(this.expiresIn=n);const r=this.getResponseProperty("refresh_token");null!=r&&"string"==typeof r&&(this.refreshToken=r),this.privateKey=this.getResponseProperty("PrivateKey"),null!=this.getResponseProperty("AccountKeys")&&(this.accountKeysResponseModel=new vS(this.getResponseProperty("AccountKeys")));const s=this.getResponseProperty("Key");s&&(this.key=new Pp(s)),this.twoFactorToken=this.getResponseProperty("TwoFactorToken");const o=this.getResponseProperty("Kdf"),a=this.getResponseProperty("KdfIterations"),l=this.getResponseProperty("KdfMemory"),c=this.getResponseProperty("KdfParallelism");this.kdfConfig=o==Mv.PBKDF2_SHA256?new jv(a):new Gv(a,l,c),this.forcePasswordReset=this.getResponseProperty("ForcePasswordReset"),this.apiUseKeyConnector=this.getResponseProperty("ApiUseKeyConnector"),this.masterPasswordPolicy=new fS(this.getResponseProperty("MasterPasswordPolicy"));const u=this.getResponseProperty("UserDecryptionOptions");null!=u&&"object"==typeof u&&(this.userDecryptionOptions=new IS(u))}hasMasterKeyEncryptedUserKey(){return Boolean(this.key)}}class TS extends tS{constructor(e){super(e),this.twoFactorProviders=this.getResponseProperty("TwoFactorProviders"),this.twoFactorProviders2=this.getResponseProperty("TwoFactorProviders2"),this.masterPasswordPolicy=new fS(this.getResponseProperty("MasterPasswordPolicy")),this.ssoEmail2faSessionToken=this.getResponseProperty("SsoEmail2faSessionToken"),this.email=this.getResponseProperty("Email")}}var PS=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class FS{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,v,f,m,g,y){this.accountService=e,this.masterPasswordService=t,this.keyService=i,this.encryptService=n,this.apiService=r,this.tokenService=s,this.appIdService=o,this.platformUtilsService=a,this.messagingService=l,this.logService=c,this.stateService=u,this.twoFactorService=d,this.userDecryptionOptionsService=h,this.billingAccountProfileStateService=p,this.vaultTimeoutSettingsService=v,this.KdfConfigService=f,this.environmentService=m,this.configService=g,this.accountCryptographicStateService=y,this.sessionTimeoutSubject=new Dd.t(!1),this.sessionTimeout$=this.sessionTimeoutSubject.asObservable()}logInTwoFactor(e){return PS(this,void 0,void 0,function*(){var t;const i=this.cache.value;if(!i.tokenRequest)throw new Error("Token request is undefined");i.tokenRequest.setTwoFactor(e),this.cache.next(i);const[n]=yield this.startLogIn();return n.masterPassword=null!==(t=this.cache.value.masterPassword)&&void 0!==t?t:null,n})}startLogIn(){return PS(this,void 0,void 0,function*(){yield this.twoFactorService.clearSelectedProvider();const e=this.cache.value.tokenRequest;if(!e)throw new Error("Token request is undefined");const t=yield this.apiService.postIdentityToken(e);if(t instanceof TS)return[yield this.processTwoFactorResponse(t),t];if(t instanceof CS)return[yield this.processTokenResponse(t),t];if(t instanceof cS)return[yield this.processDeviceVerificationResponse(t),t];if(t instanceof uS)return[yield this.processSsoRequiredResponse(t),t];throw new Error("Invalid response object.")})}buildDeviceRequest(){return PS(this,void 0,void 0,function*(){const e=yield this.appIdService.getAppId();return new nS(e,this.platformUtilsService)})}buildTwoFactor(e,t){return PS(this,void 0,void 0,function*(){if(null!=e)return e;if(t){const e=yield this.tokenService.getTwoFactorToken(t);if(null!=e)return new Bw(oS.Remember,e,!1)}return new Bw})}saveAccountInformation(e){return PS(this,void 0,void 0,function*(){var t,i,n,r;const s=yield this.tokenService.decodeAccessToken(e.accessToken),o=s.sub;if(yield this.accountService.addAccount(o,{name:s.name,email:null!==(t=s.email)&&void 0!==t?t:"",emailVerified:null!==(i=s.email_verified)&&void 0!==i&&i,creationDate:void 0}),yield this.environmentService.seedUserEnvironment(o),yield this.accountService.switchAccount(o),yield this.verifyAccountAdded(o),yield this.userDecryptionOptionsService.setUserDecryptionOptionsById(o,Yw.fromIdentityTokenResponse(e)),null!=(null===(n=e.userDecryptionOptions)||void 0===n?void 0:n.masterPasswordUnlock)){const t=e.userDecryptionOptions.masterPasswordUnlock.toMasterPasswordUnlockData();yield this.masterPasswordService.setMasterPasswordUnlockData(t,o)}const a=yield(0,bo._)(this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(o)),l=yield(0,bo._)(this.vaultTimeoutSettingsService.getVaultTimeoutByUserId$(o));return yield this.tokenService.setTokens(e.accessToken,a,l,e.refreshToken),yield this.KdfConfigService.setKdfConfig(o,e.kdfConfig),yield this.billingAccountProfileStateService.setHasPremium(null!==(r=s.premium)&&void 0!==r&&r,!1,o),o})}processTokenResponse(e){return PS(this,void 0,void 0,function*(){var t;const i=new lS;if(this.encryptionKeyMigrationRequired(e))return i.requiresEncryptionKeyMigration=!0,i;const n=yield this.saveAccountInformation(e);if(i.userId=n,null!=e.twoFactorToken){const t=yield this.tokenService.getEmail();yield this.tokenService.setTwoFactorToken(t,e.twoFactorToken)}return yield this.setMasterKey(e,n),yield this.setUserKey(e,n),yield this.setAccountCryptographicState(e,n),yield this.processForceSetPasswordReason(e.forcePasswordReset,n),this.messagingService.send("loggedIn"),i.masterPassword=null!==(t=this.cache.value.masterPassword)&&void 0!==t?t:null,i})}encryptionKeyMigrationRequired(e){return!1}processForceSetPasswordReason(e,t){return PS(this,void 0,void 0,function*(){return!!e&&(yield this.masterPasswordService.setForceSetPasswordReason(aS.AdminForcePasswordReset,t),!0)})}processTwoFactorResponse(e){return PS(this,void 0,void 0,function*(){var t;yield this.clearTwoFactorToken();const i=new lS;return i.twoFactorProviders=e.twoFactorProviders2,yield this.twoFactorService.setProviders(e),i.ssoEmail2FaSessionToken=e.ssoEmail2faSessionToken,i.email=null!==(t=e.email)&&void 0!==t?t:"",i})}clearTwoFactorToken(){return PS(this,void 0,void 0,function*(){const e=this.cache.value.userEnteredEmail;e&&(yield this.tokenService.clearTwoFactorToken(e))})}verifyAccountAdded(e){return PS(this,void 0,void 0,function*(){yield(0,bo._)(this.accountService.activeAccount$.pipe((0,Eo.p)(t=>(null==t?void 0:t.id)===e),(0,wo.w)({first:1e3,with:()=>{throw new Error("Expected user never made active user after initialization.")}})))})}processDeviceVerificationResponse(e){return PS(this,void 0,void 0,function*(){const e=new lS;return e.requiresDeviceVerification=!0,e})}processSsoRequiredResponse(e){return PS(this,void 0,void 0,function*(){const t=new lS;return t.ssoOrganizationIdentifier=e.ssoOrganizationIdentifier,t})}}var RS=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class xS{static fromJSON(e){return Object.assign(new xS,e,{tokenRequest:sS.fromJSON(e.tokenRequest),authRequestCredentials:_w.fromJSON(e.authRequestCredentials)})}}class AS extends FS{constructor(e,t,...i){super(...i),this.deviceTrustService=t,this.cache=new Dd.t(e),this.email$=this.cache.pipe((0,l.T)(e=>e.tokenRequest.email)),this.accessCode$=this.cache.pipe((0,l.T)(e=>e.authRequestCredentials.accessCode)),this.authRequestId$=this.cache.pipe((0,l.T)(e=>e.authRequestCredentials.authRequestId))}logIn(e){return RS(this,void 0,void 0,function*(){const t=new xS;t.tokenRequest=new sS(e.email,e.accessCode,yield this.buildTwoFactor(e.twoFactor,e.email),yield this.buildDeviceRequest()),t.tokenRequest.setAuthRequestAccessCode(e.authRequestId),t.authRequestCredentials=e,this.cache.next(t);const[i]=yield this.startLogIn();return i})}logInTwoFactor(e){const t=Object.create(null,{logInTwoFactor:{get:()=>super.logInTwoFactor}});return RS(this,void 0,void 0,function*(){const i=this.cache.value;return this.cache.next(i),t.logInTwoFactor.call(this,e)})}setMasterKey(e,t){return RS(this,void 0,void 0,function*(){})}setUserKey(e,t){return RS(this,void 0,void 0,function*(){const i=this.cache.value.authRequestCredentials;e.key&&(yield this.masterPasswordService.setMasterKeyEncryptedUserKey(e.key,t)),i.decryptedUserKey?yield this.keyService.setUserKey(i.decryptedUserKey,t):(yield this.trySetUserKeyWithMasterKey(t),yield this.deviceTrustService.trustDeviceIfRequired(t))})}trySetUserKeyWithMasterKey(e){return RS(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.masterPasswordService.masterKey$(e));if(t){const i=yield this.masterPasswordService.decryptUserKeyWithMasterKey(t,e);yield this.keyService.setUserKey(i,e)}})}setAccountCryptographicState(e,t){return RS(this,void 0,void 0,function*(){yield this.accountCryptographicStateService.setAccountCryptographicState(e.accountKeysResponseModel.toWrappedAccountCryptographicState(),t)})}exportCache(){return{authRequest:this.cache.value}}}var DS=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class ES{constructor(){this.forcePasswordResetReason=aS.None}static fromJSON(e){return Object.assign(new ES,e,{tokenRequest:sS.fromJSON(e.tokenRequest),masterKey:Dv.fromJSON(e.masterKey)})}}class $S extends FS{constructor(e,t,i,n,...r){super(...r),this.passwordStrengthService=t,this.policyService=i,this.loginStrategyService=n,this.cache=new Dd.t(e),this.email$=this.cache.pipe((0,l.T)(e=>e.tokenRequest.email)),this.serverMasterKeyHash$=this.cache.pipe((0,l.T)(e=>e.tokenRequest.masterPasswordHash)),this.localMasterKeyHash$=this.cache.pipe((0,l.T)(e=>e.localMasterKeyHash))}logIn(e){return DS(this,void 0,void 0,function*(){const{email:t,masterPassword:i,twoFactor:n}=e,r=new ES;r.masterKey=yield this.loginStrategyService.makePasswordPreLoginMasterKey(i,t),r.masterPassword=i,r.userEnteredEmail=t,r.localMasterKeyHash=yield this.keyService.hashMasterKey(i,r.masterKey,mp.LocalAuthorization);const s=yield this.keyService.hashMasterKey(i,r.masterKey);r.tokenRequest=new sS(t,s,yield this.buildTwoFactor(n,t),yield this.buildDeviceRequest()),this.cache.next(r);const[o,a]=yield this.startLogIn();return yield this.evaluateMasterPasswordIfRequired(a,e,o),o})}logInTwoFactor(e){const t=Object.create(null,{logInTwoFactor:{get:()=>super.logInTwoFactor}});return DS(this,void 0,void 0,function*(){return yield t.logInTwoFactor.call(this,e)})}setMasterKey(e,t){return DS(this,void 0,void 0,function*(){const{masterKey:e,localMasterKeyHash:i}=this.cache.value;yield this.masterPasswordService.setMasterKey(e,t),yield this.masterPasswordService.setMasterKeyHash(i,t)})}setUserKey(e,t){return DS(this,void 0,void 0,function*(){if(this.encryptionKeyMigrationRequired(e))return;e.key&&(yield this.masterPasswordService.setMasterKeyEncryptedUserKey(e.key,t));const i=yield(0,bo._)(this.masterPasswordService.masterKey$(t));if(i){const e=yield this.masterPasswordService.decryptUserKeyWithMasterKey(i,t);yield this.keyService.setUserKey(e,t)}})}setAccountCryptographicState(e,t){return DS(this,void 0,void 0,function*(){yield this.accountCryptographicStateService.setAccountCryptographicState(e.accountKeysResponseModel.toWrappedAccountCryptographicState(),t)})}encryptionKeyMigrationRequired(e){return!e.key}evaluateMasterPasswordIfRequired(e,t,i){return DS(this,void 0,void 0,function*(){if(e instanceof cS||e instanceof uS)return;const n=this.policyService.combineMasterPasswordPolicyOptions(t.masterPasswordPoliciesFromOrgInvite,this.getMasterPasswordPolicyOptionsFromResponse(e));if(!t.masterPasswordPoliciesFromOrgInvite&&!(null==n?void 0:n.enforceOnLogin))return;this.evaluateMasterPassword(t,n)||(e instanceof TS?this.cache.next(Object.assign(Object.assign({},this.cache.value),{forcePasswordResetReason:aS.WeakMasterPassword})):yield this.masterPasswordService.setForceSetPasswordReason(aS.WeakMasterPassword,i.userId))})}getMasterPasswordPolicyOptionsFromResponse(e){return null==e?null:ov.fromResponse(e.masterPasswordPolicy)}evaluateMasterPassword({masterPassword:e,email:t},i){var n;const r=null===(n=this.passwordStrengthService.getPasswordStrength(e,t))||void 0===n?void 0:n.score;return this.policyService.evaluateMasterPassword(r,e,i)}exportCache(){return{password:this.cache.value}}logInNewDeviceVerification(e){return DS(this,void 0,void 0,function*(){var t;const i=this.cache.value;i.tokenRequest.newDeviceOtp=e,this.cache.next(i);const[n]=yield this.startLogIn();return n.masterPassword=null!==(t=this.cache.value.masterPassword)&&void 0!==t?t:null,n})}processForceSetPasswordReason(e,t){const i=Object.create(null,{processForceSetPasswordReason:{get:()=>super.processForceSetPasswordReason}});return DS(this,void 0,void 0,function*(){if(yield i.processForceSetPasswordReason.call(this,e,t))return!1;const n=this.cache.value.forcePasswordResetReason;return n!==aS.None&&(yield this.masterPasswordService.setForceSetPasswordReason(n,t),!0)})}}class OS extends rS{constructor(e,t,i,n,r){super(n,r),this.code=e,this.codeVerifier=t,this.redirectUri=i,this.twoFactor=n}toIdentityToken(e){const t=super.toIdentityToken(e);return t.grant_type="authorization_code",t.code=this.code,t.code_verifier=this.codeVerifier,t.redirect_uri=this.redirectUri,t}static fromJSON(e){return Object.assign(Object.create(OS.prototype),e,{device:e.device?nS.fromJSON(e.device):void 0,twoFactor:e.twoFactor?Object.assign(new Bw,e.twoFactor):void 0})}}var US=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class MS{static fromJSON(e){return Object.assign(new MS,e,{tokenRequest:OS.fromJSON(e.tokenRequest)})}}class NS extends FS{constructor(e,t,i,n,r,...s){super(...s),this.keyConnectorService=t,this.deviceTrustService=i,this.authRequestService=n,this.i18nService=r,this.cache=new Dd.t(e),this.email$=this.cache.pipe((0,l.T)(e=>e.email)),this.orgId$=this.cache.pipe((0,l.T)(e=>e.orgId)),this.ssoEmail2FaSessionToken$=this.cache.pipe((0,l.T)(e=>e.ssoEmail2FaSessionToken))}logIn(e){return US(this,void 0,void 0,function*(){const t=new MS;t.orgId=e.orgId,t.userEnteredEmail=e.email;const i=yield this.buildDeviceRequest();this.logService.info("Logging in with appId %s.",i.identifier),t.tokenRequest=new OS(e.code,e.codeVerifier,e.redirectUrl,yield this.buildTwoFactor(e.twoFactor,e.email),i),this.cache.next(t);const[n]=yield this.startLogIn(),r=n.email,s=n.ssoEmail2FaSessionToken;return this.cache.next(Object.assign(Object.assign({},this.cache.value),{email:r,ssoEmail2FaSessionToken:s})),n})}setMasterKey(e,t){return US(this,void 0,void 0,function*(){if(this.shouldSetMasterKeyFromKeyConnector(e)){if(null==e.key)yield this.keyConnectorService.setNewSsoUserKeyConnectorConversionData({kdfConfig:e.kdfConfig,keyConnectorUrl:this.getKeyConnectorUrl(e),organizationId:this.cache.value.orgId},t);else{const i=this.getKeyConnectorUrl(e);yield this.keyConnectorService.setMasterKeyFromUrl(i,t)}}})}shouldSetMasterKeyFromKeyConnector(e){var t;const i=null==e?void 0:e.userDecryptionOptions;if(null!=i){const e=i.hasMasterPassword;return null!=(null===(t=i.keyConnectorOption)||void 0===t?void 0:t.keyConnectorUrl)&&!e}}getKeyConnectorUrl(e){var t;const i=null==e?void 0:e.userDecryptionOptions;return null===(t=null==i?void 0:i.keyConnectorOption)||void 0===t?void 0:t.keyConnectorUrl}setUserKey(e,t){return US(this,void 0,void 0,function*(){const i=e.key;i&&(yield this.masterPasswordService.setMasterKeyEncryptedUserKey(i,t));const n=null==e?void 0:e.userDecryptionOptions;if(null==n?void 0:n.trustedDeviceOption){this.logService.info("Attempting to set user key with approved admin auth request."),yield this.trySetUserKeyWithApprovedAdminRequestIfExists(t);(yield this.keyService.hasUserKey(t))||(this.logService.info("Attempting to set user key with device key."),yield this.trySetUserKeyWithDeviceKey(e,t))}else null!=i&&null!=this.getKeyConnectorUrl(e)&&(yield this.trySetUserKeyWithMasterKey(t))})}trySetUserKeyWithApprovedAdminRequestIfExists(e){return US(this,void 0,void 0,function*(){const t=yield this.authRequestService.getAdminAuthRequest(e);if(!t)return;let i;try{i=yield this.apiService.getAuthRequest(t.id)}catch(t){return void(t instanceof iS&&t.statusCode===Ma.NotFound&&(yield this.authRequestService.clearAdminAuthRequest(e)))}(null==i?void 0:i.requestApproved)&&(yield this.authRequestService.setUserKeyAfterDecryptingSharedUserKey(i,t.privateKey,e),(yield this.keyService.hasUserKey(e))&&(yield this.deviceTrustService.trustDeviceIfRequired(e),yield this.authRequestService.clearAdminAuthRequest(e),this.authRequestService.emitAdminLoginApproved()))})}trySetUserKeyWithDeviceKey(e,t){return US(this,void 0,void 0,function*(){var i;const n=null===(i=e.userDecryptionOptions)||void 0===i?void 0:i.trustedDeviceOption;if(!n)return void this.logService.error("Unable to set user key due to missing trustedDeviceOption.");const r=yield this.deviceTrustService.getDeviceKey(t),s=null==n?void 0:n.encryptedPrivateKey,o=null==n?void 0:n.encryptedUserKey;if(!r||!s||!o)return r?s&&o||(yield this.deviceTrustService.recordDeviceTrustLoss()):this.logService.warning("Unable to set user key due to missing device key."),s||this.logService.warning("Unable to set user key due to missing encrypted device private key."),void(o||this.logService.warning("Unable to set user key due to missing encrypted user key."));const a=yield this.deviceTrustService.decryptUserKeyWithDeviceKey(t,s,o,r);a&&(yield this.keyService.setUserKey(a,t))})}trySetUserKeyWithMasterKey(e){return US(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.masterPasswordService.masterKey$(e));if(!t)return;const i=yield this.masterPasswordService.decryptUserKeyWithMasterKey(t,e);yield this.keyService.setUserKey(i,e)})}setAccountCryptographicState(e,t){return US(this,void 0,void 0,function*(){e.accountKeysResponseModel&&(yield this.accountCryptographicStateService.setAccountCryptographicState(e.accountKeysResponseModel.toWrappedAccountCryptographicState(),t))})}exportCache(){return{sso:this.cache.value}}processForceSetPasswordReason(e,t){const i=Object.create(null,{processForceSetPasswordReason:{get:()=>super.processForceSetPasswordReason}});return US(this,void 0,void 0,function*(){var n,r,s,o;if(yield i.processForceSetPasswordReason.call(this,e,t))return!1;const a=yield(0,bo._)(this.userDecryptionOptionsService.userDecryptionOptionsById$(t));if(!a)return!1;if(null===(n=a.trustedDeviceOption)||void 0===n?void 0:n.isTdeOffboarding)return yield this.masterPasswordService.setForceSetPasswordReason(aS.TdeOffboarding,t),!0;const l=yield(0,bo._)(this.keyService.userEncryptedPrivateKey$(t)),c=yield this.keyService.hasUserKey(t);return a.trustedDeviceOption||a.hasMasterPassword||(null===(r=a.keyConnectorOption)||void 0===r?void 0:r.keyConnectorUrl)||!l||c?!a.hasMasterPassword&&(null===(s=a.trustedDeviceOption)||void 0===s?void 0:s.hasManageResetPasswordPermission)?(yield this.masterPasswordService.setForceSetPasswordReason(aS.TdeUserWithoutPasswordHasPasswordResetPermission,t),!0):!(a.hasMasterPassword||(null===(o=a.keyConnectorOption)||void 0===o?void 0:o.keyConnectorUrl)||a.trustedDeviceOption)&&(yield this.masterPasswordService.setForceSetPasswordReason(aS.SsoNewJitProvisionedUser,t),!0):(yield this.masterPasswordService.setForceSetPasswordReason(aS.TdeOffboardingUntrustedDevice,t),!0)})}}class VS extends rS{constructor(e,t,i,n){super(i,n),this.clientId=e,this.clientSecret=t,this.twoFactor=i}toIdentityToken(){const e=super.toIdentityToken(this.clientId);return e.scope=this.clientId.startsWith("organization")?"api.organization":"api",e.grant_type="client_credentials",e.client_secret=this.clientSecret,e}static fromJSON(e){return Object.assign(Object.create(VS.prototype),e,{device:e.device?nS.fromJSON(e.device):void 0,twoFactor:e.twoFactor?Object.assign(new Bw,e.twoFactor):void 0})}}var BS=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class jS{static fromJSON(e){return Object.assign(new jS,e,{tokenRequest:VS.fromJSON(e.tokenRequest)})}}class GS extends FS{constructor(e,t,...i){super(...i),this.keyConnectorService=t,this.cache=new Dd.t(e)}logIn(e){return BS(this,void 0,void 0,function*(){const t=new jS;t.tokenRequest=new VS(e.clientId,e.clientSecret,yield this.buildTwoFactor(),yield this.buildDeviceRequest()),this.cache.next(t);const[i]=yield this.startLogIn();return i})}setMasterKey(e,t){return BS(this,void 0,void 0,function*(){if(e.apiUseKeyConnector){const e=(yield(0,bo._)(this.environmentService.environment$)).getKeyConnectorUrl();yield this.keyConnectorService.setMasterKeyFromUrl(e,t)}})}setUserKey(e,t){return BS(this,void 0,void 0,function*(){if(e.key&&(yield this.masterPasswordService.setMasterKeyEncryptedUserKey(e.key,t)),e.apiUseKeyConnector){const e=yield(0,bo._)(this.masterPasswordService.masterKey$(t));if(e){const i=yield this.masterPasswordService.decryptUserKeyWithMasterKey(e,t);yield this.keyService.setUserKey(i,t)}}})}setAccountCryptographicState(e,t){return BS(this,void 0,void 0,function*(){yield this.accountCryptographicStateService.setAccountCryptographicState(e.accountKeysResponseModel.toWrappedAccountCryptographicState(),t)})}saveAccountInformation(e){const t=Object.create(null,{saveAccountInformation:{get:()=>super.saveAccountInformation}});return BS(this,void 0,void 0,function*(){const i=yield t.saveAccountInformation.call(this,e),n=yield(0,bo._)(this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(i)),r=yield(0,bo._)(this.vaultTimeoutSettingsService.getVaultTimeoutByUserId$(i)),s=this.cache.value.tokenRequest;return yield this.tokenService.setClientId(s.clientId,n,r),yield this.tokenService.setClientSecret(s.clientSecret,n,r),i})}exportCache(){return{userApiKey:this.cache.value}}}class LS extends rS{constructor(e,t,i){super(void 0,i),this.token=e,this.deviceResponse=t}toIdentityToken(e){const t=super.toIdentityToken(e);return t.grant_type="webauthn",t.token=this.token,t.deviceResponse=JSON.stringify(this.deviceResponse),t}static fromJSON(e){return Object.assign(Object.create(LS.prototype),e,{deviceResponse:Gw.fromJSON(e.deviceResponse),device:e.device?nS.fromJSON(e.device):void 0,twoFactor:e.twoFactor?Object.assign(new Bw,e.twoFactor):void 0})}}var zS=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class _S{static fromJSON(e){return Object.assign(new _S,e,{tokenRequest:LS.fromJSON(e.tokenRequest),credentials:Kw.fromJSON(e.credentials)})}}class KS extends FS{constructor(e,...t){super(...t),this.cache=new Dd.t(e)}logIn(e){return zS(this,void 0,void 0,function*(){const t=new _S;t.credentials=e,t.tokenRequest=new LS(e.token,e.deviceResponse,yield this.buildDeviceRequest()),this.cache.next(t);const[i]=yield this.startLogIn();return i})}logInTwoFactor(){return zS(this,void 0,void 0,function*(){throw new Error("2FA not supported yet for WebAuthn Login.")})}setMasterKey(e,t){return zS(this,void 0,void 0,function*(){})}setUserKey(e,t){return zS(this,void 0,void 0,function*(){const i=e.key;i&&(yield this.masterPasswordService.setMasterKeyEncryptedUserKey(i,t));const n=null==e?void 0:e.userDecryptionOptions;if(null==n?void 0:n.webAuthnPrfOption){const e=this.cache.value.credentials;if(!e.prfKey)return;const i=n.webAuthnPrfOption,r=yield this.encryptService.unwrapDecapsulationKey(i.encryptedPrivateKey,e.prfKey),s=yield this.encryptService.decapsulateKeyUnsigned(new Pp(i.encryptedUserKey.encryptedString),r);s&&(yield this.keyService.setUserKey(s,t))}})}setAccountCryptographicState(e,t){return zS(this,void 0,void 0,function*(){yield this.accountCryptographicStateService.setAccountCryptographicState(e.accountKeysResponseModel.toWrappedAccountCryptographicState(),t)})}exportCache(){return{webAuthn:this.cache.value}}}const XS=new m(N,"currentLoginStrategy",{deserializer:e=>e}),qS=new m(N,"loginStrategyCacheExpiration",{deserializer:e=>e?null:new Date(e)}),WS=new m(N,"authRequestPushNotification",{deserializer:e=>e}),YS=new m(N,"loginStrategyCache",{deserializer:e=>null==e?null:{password:e.password?ES.fromJSON(e.password):void 0,sso:e.sso?MS.fromJSON(e.sso):void 0,userApiKey:e.userApiKey?jS.fromJSON(e.userApiKey):void 0,authRequest:e.authRequest?xS.fromJSON(e.authRequest):void 0,webAuthn:e.webAuthn?_S.fromJSON(e.webAuthn):void 0}});var HS=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const JS=3e5;var ZS=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const QS=new k(W,"decryptionOptions",{deserializer:e=>Yw.fromJSON(e),clearOn:["logout"]});class ek{constructor(e){e&&Object.assign(this,e)}toJSON(){return{id:this.id,privateKey:bd.fromBufferToByteString(this.privateKey)}}static fromJSON(e){if(null==e)return null;let t=null;return e.privateKey&&(t=bd.fromByteStringToArray(e.privateKey)),new ek({id:e.id,privateKey:t})}}class tk{constructor(e,t,i,n){this.key=e,this.masterPasswordHash=t,this.deviceIdentifier=i,this.requestApproved=n}}class ik extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.publicKey=this.getResponseProperty("PublicKey"),this.requestDeviceType=this.getResponseProperty("RequestDeviceType"),this.requestDeviceTypeValue=this.getResponseProperty("RequestDeviceTypeValue"),this.requestDeviceIdentifier=this.getResponseProperty("RequestDeviceIdentifier"),this.requestIpAddress=this.getResponseProperty("RequestIpAddress"),this.requestCountryName=this.getResponseProperty("RequestCountryName"),this.key=this.getResponseProperty("Key"),this.creationDate=this.getResponseProperty("CreationDate"),this.requestApproved=this.getResponseProperty("RequestApproved"),this.responseDate=this.getResponseProperty("ResponseDate"),this.deviceId=this.getResponseProperty("RequestDeviceId");const t=new Date(this.creationDate),i=Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds()),n=new Date(Date.now()),r=Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),n.getUTCMilliseconds());this.isExpired=r-i>=9e5,this.isAnswered=null!=this.requestApproved&&null!=this.responseDate}}var nk=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const rk=new k(E,"adminAuthRequest",{deserializer:e=>e,clearOn:[]});class sk extends tS{constructor(e,t){super(e);const i=this.getResponseProperty("Data");this.data=null==i?[]:i.map(e=>new t(e)),this.continuationToken=this.getResponseProperty("ContinuationToken")}}var ok=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function ak(e,t,i){if(null==e)throw new Error(`${t} is null or undefined.${i?` ${i}`:""}`)}var lk=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class ck{}var uk=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class dk{buildSsoUrl(e,t,i,n,r,s,o){let a=e+"/#/sso?clientId="+t+"&redirectUri="+encodeURIComponent(i)+"&state="+n+"&codeChallenge="+r;return s&&(a+="&email="+encodeURIComponent(s)),o&&(a+="&identifier="+encodeURIComponent(o)),a}}var hk,pk=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class vk{constructor(e){this.messagingService=e}logout(e,t){return pk(this,void 0,void 0,function*(){this.messagingService.send("logout",{userId:e,logoutReason:t})})}}function fk(e){if(null==e)throw new Error("JWT token not found");const t=e.split(".");if(3!==t.length)throw new Error("JWT must have 3 parts");const i=t[1];let n;try{n=bd.fromUrlB64ToUtf8(i)}catch(e){throw new Error("Cannot decode the token")}try{return JSON.parse(n)}catch(e){throw new Error("Cannot parse the token's payload into JSON")}}!function(e){e.US="US",e.EU="EU",e.SelfHosted="Self-hosted"}(hk||(hk={}));class mk{}class gk{constructor(e){this.messageStream=e,this.allMessages$=this.messageStream}messages$(e){return this.allMessages$.pipe((0,Eo.p)(t=>(null==t?void 0:t.command)===e.command))}}gk.EMPTY=new gk(Wp.w);class yk{constructor(e){this.innerMessageSenders=e}send(e,t={}){for(const i of this.innerMessageSenders)i.send(e,t)}}class bk{static combine(...e){return new yk(e)}}bk.EMPTY=new yk([]);class wk{constructor(e){this.command=e}}const Sk=Symbol("externalSource"),kk=e=>"string"==typeof e?e:e.command;class Ik{constructor(e){this.messagesSubject=e}send(e,t={}){const i=kk(e);this.messagesSubject.next(Object.assign(null!=t?t:{},{command:i}))}}class Ck{}class Tk{}class Pk{}class Fk{}class Rk{}class xk{}var Ak=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Dk=["masterPasswordInputRef"],Ek=e=>({"tw-hidden":e});function $k(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"button",16),Fl.nI1(2,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.handleLoginWithPasskeyClick())}),Fl.nrm(3,"i",17),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s(),Fl.bVm()}if(2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("bitTooltip",e.ssoRequired?Fl.bMT(2,4,"yourOrganizationRequiresSingleSignOn"):"")("addTooltipToDescribedby",e.ssoRequired)("disabled",e.ssoRequired),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(5,6,"logInWithPasskey")," ")}}function Ok(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"div",7),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"button",18),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.startAuthRequestLogin())}),Fl.nrm(5,"i",19),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s(),Fl.bVm()}2&e&&(Fl.R7$(2),Fl.JRh(Fl.bMT(3,2,"or")),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(7,4,"loginWithDevice")," "))}function Uk(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"button",18),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.backButtonClicked())}),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.bVm()}2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"back")," "))}const Mk="LoginComponent";var Nk;!function(e){e.EMAIL_ENTRY="EmailEntry",e.MASTER_PASSWORD_ENTRY="MasterPasswordEntry"}(Nk||(Nk={}));class Vk{get emailFormControl(){return this.formGroup.controls.email}constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,v,f,m,g,y,b,w,S,k,I){this.activatedRoute=e,this.anonLayoutWrapperDataService=t,this.appIdService=i,this.broadcasterService=n,this.destroyRef=r,this.devicesApiService=s,this.formBuilder=o,this.i18nService=a,this.loginEmailService=l,this.loginComponentService=c,this.loginStrategyService=u,this.messagingService=d,this.ngZone=h,this.passwordStrengthService=p,this.platformUtilsService=v,this.policyService=f,this.router=m,this.toastService=g,this.logService=y,this.validationService=b,this.loginSuccessHandlerService=w,this.configService=S,this.ssoLoginService=k,this.environmentService=I,this.destroy$=new Co.B,this.Icons={WaveIcon:Rw,VaultIcon:xw},this.ClientType=Da,this.orgPoliciesFromInvite=null,this.LoginUiState=Nk,this.isKnownDevice=!1,this.loginUiState=Nk.EMAIL_ENTRY,this.ssoRequired=!1,this.formGroup=this.formBuilder.group({email:["",[Il.k0.required,Il.k0.email]],masterPassword:["",[Il.k0.required,Il.k0.minLength(bd.originalMinimumPasswordLength)]],rememberEmail:[!1]},{updateOn:"submit"}),this.deferFocus=null,this.submit=()=>Ak(this,void 0,void 0,function*(){var e;if(this.clientType===Da.Desktop&&this.loginUiState!==Nk.MASTER_PASSWORD_ENTRY)return;const{email:t,masterPassword:i}=this.formGroup.value;if(this.formGroup.markAllAsTouched(),this.formGroup.invalid)return;if(!t||!i)return void this.logService.error("Email and master password are required");this.orgPoliciesFromInvite=this.loginComponentService.getOrgPoliciesFromOrgInvite?yield this.loginComponentService.getOrgPoliciesFromOrgInvite(t):null;const n=null===(e=this.orgPoliciesFromInvite)||void 0===e?void 0:e.enforcedPasswordPolicyOptions,r=new Lw(t,i,void 0,n);try{const e=yield this.loginStrategyService.logIn(r);yield this.handleAuthResult(e)}catch(e){this.logService.error(e),yield this.handleSubmitError(e)}}),this.handlePopState=e=>Ak(this,void 0,void 0,function*(){this.loginUiState===Nk.MASTER_PASSWORD_ENTRY?(e.preventDefault(),this.toggleLoginUiState(Nk.EMAIL_ENTRY)):this.loginUiState===Nk.EMAIL_ENTRY&&(e.preventDefault(),yield this.continue())}),this.clientType=this.platformUtilsService.getClientType()}ngOnInit(){return Ak(this,void 0,void 0,function*(){window.addEventListener("popstate",this.handlePopState),yield this.defaultOnInit(),this.clientType===Da.Desktop&&(yield this.desktopOnInit())})}ngOnDestroy(){window.removeEventListener("popstate",this.handlePopState),this.clientType===Da.Desktop&&this.broadcasterService.unsubscribe(Mk),this.destroy$.next(),this.destroy$.complete()}defaultOnInit(){return Ak(this,void 0,void 0,function*(){let e=!1;const t=yield(0,bo._)(this.activatedRoute.queryParams);if(t){const i=t.email;null!=i&&i.indexOf("@")>-1&&(this.formGroup.controls.email.setValue(i),e=!0)}e||(yield this.loadRememberedEmail()),this.emailFormControl.value&&(yield this.getKnownDevice(this.emailFormControl.value)),this.activatedRoute||(yield this.loadRememberedEmail()),yield this.determineIfSsoRequired()})}desktopOnInit(){return Ak(this,void 0,void 0,function*(){this.broadcasterService.subscribe(Mk,e=>Ak(this,void 0,void 0,function*(){this.ngZone.run(()=>{if("windowIsFocused"===e.command)null===this.deferFocus?(this.deferFocus=!e.windowIsFocused,this.deferFocus||this.focusInput()):this.deferFocus&&e.windowIsFocused&&(this.focusInput(),this.deferFocus=!1)})})),this.messagingService.send("getWindowIsFocused")})}determineIfSsoRequired(){return Ak(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.ssoLoginService.ssoRequiredCache$);null!=e&&e.size>0&&(this.emailFormControl.value&&e.has(this.emailFormControl.value.toLowerCase())&&(this.ssoRequired=!0),this.listenForEmailChanges(e))})}listenForEmailChanges(e){this.formGroup.controls.email.valueChanges.pipe((0,xl.pQ)(this.destroyRef)).subscribe(()=>{this.emailFormControl.value&&e.has(this.emailFormControl.value.toLowerCase())?this.ssoRequired=!0:this.ssoRequired=!1})}handleSubmitError(e){return Ak(this,void 0,void 0,function*(){var t;if(e instanceof iS)if(e.statusCode===Ma.BadRequest)if(null===(t=e.message)||void 0===t?void 0:t.toLowerCase().includes("username or password is incorrect")){const e=yield(0,bo._)(this.environmentService.environment$),t=bd.getHost(e.getWebVaultUrl());this.formGroup.controls.masterPassword.setErrors({error:{message:this.i18nService.t("invalidMasterPasswordConfirmEmailAndHost",t)}})}else this.validationService.showError(e);else this.validationService.showError(e);else this.validationService.showError(e)})}handleAuthResult(e){return Ak(this,void 0,void 0,function*(){var t,i;if(e.requiresEncryptionKeyMigration)this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("legacyEncryptionUnsupported")});else if(e.requiresTwoFactor)yield this.router.navigate(["2fa"]);else if(e.requiresDeviceVerification)yield this.router.navigate(["device-verification"]);else{if(e.requiresSso){const n=null===(i=null===(t=this.formGroup)||void 0===t?void 0:t.value)||void 0===i?void 0:i.email;return n?void(yield this.loginComponentService.redirectToSsoLoginWithOrganizationSsoIdentifier(n,e.ssoOrganizationIdentifier)):void this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("emailRequiredForSsoLogin")})}if(yield this.loginSuccessHandlerService.run(e.userId,e.masterPassword),this.orgPoliciesFromInvite){yield this.setPoliciesIntoState(e.userId,this.orgPoliciesFromInvite.policies);if(yield this.isPasswordChangeRequiredByOrgPolicy(this.orgPoliciesFromInvite.enforcedPasswordPolicyOptions))return void(yield this.router.navigate(["change-password"]))}this.clientType===Da.Browser?yield this.router.navigate(["/tabs/vault"]):yield this.router.navigate(["vault"])}})}isPasswordChangeRequiredByOrgPolicy(e){return Ak(this,void 0,void 0,function*(){var t,i;try{if(null==e)return!1;const n=this.formGroup.controls.masterPassword.value;if(!n)return!1;const r=null===(i=this.passwordStrengthService.getPasswordStrength(n,null!==(t=this.formGroup.value.email)&&void 0!==t?t:void 0))||void 0===i?void 0:i.score;return!this.policyService.evaluateMasterPassword(r,n,e)}catch(e){return this.logService.error(e),!1}})}setPoliciesIntoState(e,t){return Ak(this,void 0,void 0,function*(){const i={};t.map(e=>i[e.id]=av.fromPolicy(e)),yield this.policyService.replace(i,e)})}startAuthRequestLogin(){return Ak(this,void 0,void 0,function*(){var e,t;null===(e=this.formGroup.get("masterPassword"))||void 0===e||e.clearValidators(),null===(t=this.formGroup.get("masterPassword"))||void 0===t||t.updateValueAndValidity(),this.formGroup.valid&&(yield this.router.navigate(["/login-with-device"]))})}toggleLoginUiState(e){return Ak(this,void 0,void 0,function*(){var t,i;if(this.loginUiState=e,this.loginUiState===Nk.EMAIL_ENTRY)this.loginComponentService.showBackButton(!1),this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageTitle:{key:"logInToBitwarden"},pageIcon:this.Icons.VaultIcon,pageSubtitle:null}),this.formGroup.controls.masterPassword.reset(),this.isKnownDevice=!1;else if(this.loginUiState===Nk.MASTER_PASSWORD_ENTRY){this.loginComponentService.showBackButton(!0),this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageTitle:{key:"welcomeBack"},pageSubtitle:this.emailFormControl.value,pageIcon:this.Icons.WaveIcon}),this.formGroup.controls.masterPassword.markAsUntouched(),this.ngZone.isStable?null===(i=null===(t=this.masterPasswordInputRef)||void 0===t?void 0:t.nativeElement)||void 0===i||i.focus():this.ngZone.onStable.pipe((0,_o.s)(1),(0,vm.Q)(this.destroy$)).subscribe(()=>{var e,t;null===(t=null===(e=this.masterPasswordInputRef)||void 0===e?void 0:e.nativeElement)||void 0===t||t.focus()});const e=this.emailFormControl.value;e&&(yield this.getKnownDevice(e))}})}isLoginWithPasskeySupported(){return this.loginComponentService.isLoginWithPasskeySupported()}goToHint(){return Ak(this,void 0,void 0,function*(){yield this.router.navigateByUrl("/hint")})}continuePressed(){return Ak(this,void 0,void 0,function*(){history.pushState({},"",window.location.href),yield this.continue()})}continue(){return Ak(this,void 0,void 0,function*(){this.validateEmail()&&(yield this.makePasswordPreloginCall(),yield this.toggleLoginUiState(Nk.MASTER_PASSWORD_ENTRY))})}handleLoginWithPasskeyClick(){return Ak(this,void 0,void 0,function*(){yield this.router.navigate(["/login-with-passkey"])})}handleSsoClick(){return Ak(this,void 0,void 0,function*(){if(!this.validateEmail())return;const e=this.formGroup.value.email;e?yield this.loginComponentService.redirectToSsoLogin(e):this.logService.error("Email is required for SSO")})}getKnownDevice(e){return Ak(this,void 0,void 0,function*(){if(e)try{const t=yield this.appIdService.getAppId();this.isKnownDevice=yield this.devicesApiService.getKnownDevice(e,t)}catch(e){this.isKnownDevice=!1}else this.isKnownDevice=!1})}loadRememberedEmail(){return Ak(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.loginEmailService.rememberedEmail$);e?(this.formGroup.controls.email.setValue(e),this.formGroup.controls.rememberEmail.setValue(!0),yield this.loginEmailService.setLoginEmail(e)):this.formGroup.controls.rememberEmail.setValue(!1)})}focusInput(){var e;null===(e=document.getElementById(null==this.emailFormControl.value||""===this.emailFormControl.value?"email":"masterPassword"))||void 0===e||e.focus()}shouldShowBackButton(){return this.loginUiState===Nk.MASTER_PASSWORD_ENTRY&&this.clientType!==Da.Browser}backButtonClicked(){return Ak(this,void 0,void 0,function*(){history.back()})}makePasswordPreloginCall(){return Ak(this,void 0,void 0,function*(){try{if(yield this.configService.getFeatureFlag(Wv.PM23801_PrefetchPasswordPrelogin)){const e=this.formGroup.value.email;e&&this.loginStrategyService.getPasswordPrelogin(e)}}catch(e){this.logService.error("Failed to prefetch prelogin data.",e)}})}validateEmail(){return this.formGroup.controls.email.markAsTouched(),this.formGroup.controls.email.updateValueAndValidity({onlySelf:!0,emitEvent:!0}),this.formGroup.controls.email.valid}persistEmailIfValid(){return Ak(this,void 0,void 0,function*(){var e;if(this.formGroup.controls.email.valid){const t=this.formGroup.value.email,i=null!==(e=this.formGroup.value.rememberEmail)&&void 0!==e&&e;if(!t)return;yield this.loginEmailService.setLoginEmail(t),yield this.loginEmailService.setRememberedEmailChoice(t,i)}else yield this.loginEmailService.clearLoginEmail(),yield this.loginEmailService.clearRememberedEmail()})}onEmailInput(e){return Ak(this,void 0,void 0,function*(){const t=e.target;this.formGroup.controls.email.setValue(t.value),yield this.persistEmailIfValid()})}onRememberEmailInput(e){return Ak(this,void 0,void 0,function*(){const t=e.target;this.formGroup.controls.rememberEmail.setValue(t.checked),yield this.persistEmailIfValid()})}}Vk.ɵfac=function(e){return new(e||Vk)(Fl.rXU(Fd.nX),Fl.rXU(Ck),Fl.rXU(Tk),Fl.rXU(Pk),Fl.rXU(a.abz),Fl.rXU(Fk),Fl.rXU(Il.ok),Fl.rXU(Ul),Fl.rXU(Dw),Fl.rXU(Rk),Fl.rXU(Ew),Fl.rXU(bk),Fl.rXU(Fl.SKi),Fl.rXU(af),Fl.rXU(Hb),Fl.rXU(Zb),Fl.rXU(Fd.Ix),Fl.rXU(qb),Fl.rXU(Za),Fl.rXU(Ud),Fl.rXU(Mw),Fl.rXU(Kb),Fl.rXU(xk),Fl.rXU(mk))},Vk.ɵcmp=Fl.VBU({type:Vk,selectors:[["ng-component"]],viewQuery:function(e,t){if(1&e&&Fl.GBs(Dk,5),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.masterPasswordInputRef=e.first)}},decls:42,vars:41,consts:[["masterPasswordInputRef",""],[3,"bitSubmit","formGroup"],[3,"ngClass"],["type","email","formControlName","email","bitInput","","appAutofocus","",3,"input","keyup.enter"],["type","checkbox","formControlName","rememberEmail","bitCheckbox","",3,"input"],[1,"tw-grid","tw-gap-3"],["type","button","bitButton","","block","","buttonType","primary",3,"click","bitTooltip","addTooltipToDescribedby","disabled"],[1,"tw-text-center"],[4,"ngIf"],["type","button","bitButton","","block","",3,"click","buttonType"],["aria-hidden","true",1,"bwi","bwi-provider","tw-mr-1"],[1,"!tw-mb-1"],["type","password","formControlName","masterPassword","bitInput",""],["type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle",""],["bitLink","","routerLink","/hint",1,"tw-inline-block","tw-mb-4",3,"click"],["type","submit","bitButton","","bitFormButton","","block","","buttonType","primary"],["type","button","bitButton","","block","","buttonType","secondary",3,"click","bitTooltip","addTooltipToDescribedby","disabled"],["aria-hidden","true",1,"bwi","bwi-passkey","tw-mr-1"],["type","button","bitButton","","block","","buttonType","secondary",3,"click"],["aria-hidden","true",1,"bwi","bwi-mobile"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"form",1)(1,"div",2)(2,"bit-form-field")(3,"bit-label"),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s(),Fl.j41(6,"input",3),Fl.bIt("input",function(i){return a.eBV(e),a.Njj(t.onEmailInput(i))})("keyup.enter",function(){return a.eBV(e),a.Njj(t.ssoRequired?t.handleSsoClick():t.continuePressed())}),Fl.k0s()(),Fl.j41(7,"bit-form-control")(8,"input",4),Fl.bIt("input",function(i){return a.eBV(e),a.Njj(t.onRememberEmailInput(i))}),Fl.k0s(),Fl.j41(9,"bit-label"),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s()(),Fl.j41(12,"div",5)(13,"button",6),Fl.nI1(14,"i18n"),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.continuePressed())}),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s(),Fl.j41(17,"div",7),Fl.EFF(18),Fl.nI1(19,"i18n"),Fl.k0s(),Fl.DNE(20,$k,6,8,"ng-container",8),Fl.j41(21,"button",9),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.handleSsoClick())}),Fl.nrm(22,"i",10),Fl.EFF(23),Fl.nI1(24,"i18n"),Fl.k0s()()(),Fl.j41(25,"div",2)(26,"bit-form-field",11)(27,"bit-label"),Fl.EFF(28),Fl.nI1(29,"i18n"),Fl.k0s(),Fl.nrm(30,"input",12,0)(32,"button",13),Fl.k0s(),Fl.j41(33,"a",14),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.goToHint())}),Fl.EFF(34),Fl.nI1(35,"i18n"),Fl.k0s(),Fl.j41(36,"div",5)(37,"button",15),Fl.EFF(38),Fl.nI1(39,"i18n"),Fl.k0s(),Fl.DNE(40,Ok,8,6,"ng-container",8)(41,Uk,4,3,"ng-container",8),Fl.k0s()()()}2&e&&(Fl.Y8G("bitSubmit",t.submit)("formGroup",t.formGroup),Fl.R7$(),Fl.Y8G("ngClass",Fl.eq3(37,Ek,t.loginUiState!==t.LoginUiState.EMAIL_ENTRY)),Fl.R7$(3),Fl.JRh(Fl.bMT(5,19,"emailAddress")),Fl.R7$(6),Fl.JRh(Fl.bMT(11,21,"rememberEmail")),Fl.R7$(3),Fl.Y8G("bitTooltip",t.ssoRequired?Fl.bMT(14,23,"yourOrganizationRequiresSingleSignOn"):"")("addTooltipToDescribedby",t.ssoRequired)("disabled",t.ssoRequired),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(16,25,"continue")," "),Fl.R7$(3),Fl.JRh(Fl.bMT(19,27,"or")),Fl.R7$(2),Fl.Y8G("ngIf",t.isLoginWithPasskeySupported()),Fl.R7$(),Fl.Y8G("buttonType",t.ssoRequired?"primary":"secondary"),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(24,29,"useSingleSignOn")," "),Fl.R7$(2),Fl.Y8G("ngClass",Fl.eq3(39,Ek,t.loginUiState!==t.LoginUiState.MASTER_PASSWORD_ENTRY)),Fl.R7$(3),Fl.JRh(Fl.bMT(29,31,"masterPass")),Fl.R7$(6),Fl.SpI(" ",Fl.bMT(35,33,"getMasterPasswordHint")," "),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(39,35,"loginWithMasterPassword")," "),Fl.R7$(2),Fl.Y8G("ngIf",t.isKnownDevice),Fl.R7$(),Fl.Y8G("ngIf",t.shouldShowBackButton()))},dependencies:[pc,jd,Md,id,td,hd,Qb,kl.MD,kl.YU,kl.bT,Gu,Sc,Ac,fu,ju,iw,nw,Ql,Zl,Hh,uw,sf,wd,Il.X1,Il.qT,Il.me,Il.Zm,Il.BC,Il.cb,Il.j4,Il.JD,Cw.iI,Cw.Wk,_l,rf],encapsulation:2});class Bk{constructor(e){this.configService=e}getSettings$(){return this.configService.serverSettings$}get isUserRegistrationDisabled$(){return this.getSettings$().pipe((0,l.T)(e=>e.disableUserRegistration))}}function jk(e,t){1&e&&(Fl.j41(0,"div",1),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.j41(3,"a",2),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,2,"newToBitwarden")," "),Fl.R7$(3),Fl.JRh(Fl.bMT(5,4,"createAccount")))}class Gk{constructor(){this.serverSettingsService=(0,a.WQX)(Bk),this.isUserRegistrationDisabled$=this.serverSettingsService.isUserRegistrationDisabled$}}Gk.ɵfac=function(e){return new(e||Gk)},Gk.ɵcmp=Fl.VBU({type:Gk,selectors:[["ng-component"]],decls:2,vars:3,consts:[["class","tw-text-center",4,"ngIf"],[1,"tw-text-center"],["bitLink","","routerLink","/signup"]],template:function(e,t){1&e&&(Fl.DNE(0,jk,6,6,"div",0),Fl.nI1(1,"async")),2&e&&Fl.Y8G("ngIf",!Fl.bMT(1,1,t.isUserRegistrationDisabled$))},dependencies:[kl.MD,kl.bT,sf,Hh,uw,Cw.iI,Cw.Wk,kl.Jj,rf],encapsulation:2});var Lk=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class zk{constructor(e,t,i,n,r){this.cryptoFunctionService=e,this.environmentService=t,this.passwordGenerationService=i,this.platformUtilsService=n,this.ssoLoginService=r,this.clientType=this.platformUtilsService.getClientType()}isLoginWithPasskeySupported(){return this.clientType===Da.Web}redirectToSsoLogin(e){return Lk(this,void 0,void 0,function*(){const[t,i]=yield this.setSsoPreLoginState(e);yield this.redirectToSso(e,t,i)})}redirectToSsoLoginWithOrganizationSsoIdentifier(e,t){return Lk(this,void 0,void 0,function*(){const[i,n]=yield this.setSsoPreLoginState(e);yield this.redirectToSso(e,i,n,t)})}redirectToSso(e,t,i,n){return Lk(this,void 0,void 0,function*(){})}showBackButton(e){}setSsoPreLoginState(e){return Lk(this,void 0,void 0,function*(){const t={type:"password",length:64,uppercase:!0,lowercase:!0,numbers:!0,special:!1};let i=yield this.passwordGenerationService.generatePassword(t);this.clientType===Da.Browser&&(i+=":clientId=browser");const n=yield this.passwordGenerationService.generatePassword(t),r=yield this.cryptoFunctionService.hash(n,"sha256"),s=bd.fromBufferToUrlB64(r);return yield this.ssoLoginService.setSsoState(i),yield this.ssoLoginService.setCodeVerifier(n),yield this.ssoLoginService.setSsoEmail(e),[i,s]})}}class _k{constructor(e,t){this.publicKey=e,this.encryptedPrivateKey=t}}Error;Error;class Kk{}class Xk extends Error{constructor(e){super(`User (${e}) is not logged in`)}}class qk extends Error{constructor(e){super(`Invalid UUID: ${e}`)}}function Wk(e){switch(e){case Ea.Android:return"Android";case Ea.iOS:return"iOS";case Ea.ChromeExtension:return"ChromeExtension";case Ea.FirefoxExtension:return"FirefoxExtension";case Ea.OperaExtension:return"OperaExtension";case Ea.EdgeExtension:return"EdgeExtension";case Ea.WindowsDesktop:return"WindowsDesktop";case Ea.MacOsDesktop:return"MacOsDesktop";case Ea.LinuxDesktop:return"LinuxDesktop";case Ea.ChromeBrowser:return"ChromeBrowser";case Ea.FirefoxBrowser:return"FirefoxBrowser";case Ea.OperaBrowser:return"OperaBrowser";case Ea.EdgeBrowser:return"EdgeBrowser";case Ea.IEBrowser:return"IEBrowser";case Ea.UnknownBrowser:return"UnknownBrowser";case Ea.AndroidAmazon:return"AndroidAmazon";case Ea.UWP:return"UWP";case Ea.SafariBrowser:return"SafariBrowser";case Ea.VivaldiBrowser:return"VivaldiBrowser";case Ea.VivaldiExtension:return"VivaldiExtension";case Ea.SafariExtension:return"SafariExtension";case Ea.Server:return"Server";case Ea.WindowsCLI:return"WindowsCLI";case Ea.MacOsCLI:return"MacOsCLI";case Ea.LinuxCLI:return"LinuxCLI";default:return"SDK"}}function Yk(e){if(bd.isGuid(e))return e;throw new qk(e)}function Hk(e){return e}class Jk{}class Zk{}class Qk extends Zk{}class eI{}class tI{}class iI{}class nI{}class rI{}class sI{}class oI{}var aI,lI=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})},cI=function(e,t,i){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var n,r;if(i){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],i&&(r=n)}if("function"!=typeof n)throw new TypeError("Object not disposable.");r&&(n=function(){try{r.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:n,async:i})}else i&&e.stack.push({async:!0});return t},uI=function(e){return function(t){function i(i){t.error=t.hasError?new e(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var n,r=0;return function e(){for(;n=t.stack.pop();)try{if(!n.async&&1===r)return r=0,t.stack.push(n),Promise.resolve().then(e);if(n.dispose){var s=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(s).then(e,function(t){return i(t),e()})}else r|=1}catch(e){i(e)}if(1===r)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,i){var n=new Error(i);return n.name="SuppressedError",n.error=e,n.suppressed=t,n});function dI(e,t){1&e&&(Fl.qex(0),Fl.j41(1,"div",2),Fl.nrm(2,"i",3),Fl.nI1(3,"i18n"),Fl.j41(4,"span",4),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s()(),Fl.bVm()),2&e&&(Fl.R7$(2),Fl.Y8G("title",Fl.mNQ(Fl.bMT(3,3,"loading"))),Fl.R7$(3),Fl.JRh(Fl.bMT(6,5,"loading")))}function hI(e,t){if(1&e&&(Fl.j41(0,"form",5)(1,"bit-form-control"),Fl.nrm(2,"input",6),Fl.j41(3,"bit-label"),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s(),Fl.j41(6,"bit-hint",7),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s()()()),2&e){const e=Fl.XpG();Fl.Y8G("formGroup",e.formGroup),Fl.R7$(4),Fl.JRh(Fl.bMT(5,3,"rememberThisDevice")),Fl.R7$(3),Fl.JRh(Fl.bMT(8,5,"uncheckIfPublicDevice"))}}function pI(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"button",8),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("bitAction",e.createUser),Fl.R7$(),Fl.SpI(" ",Fl.bMT(3,2,"continue")," ")}}function vI(e,t){1&e&&(Fl.j41(0,"div",2),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"or")," "))}function fI(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"button",12),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.approveFromOtherDevice())}),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.DNE(4,vI,3,3,"div",13),Fl.bVm()}if(2&e){const e=Fl.XpG(2);Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,2,"approveFromYourOtherDevice")," "),Fl.R7$(2),Fl.Y8G("ngIf",e.canApproveWithMasterPassword||e.canRequestAdminApproval)}}function mI(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",14),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.approveWithMasterPassword())}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"useMasterPassword")," "))}function gI(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",14),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.requestAdminApproval())}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"requestAdminApproval")," "))}function yI(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"div",9),Fl.DNE(2,fI,5,4,"ng-container",0)(3,mI,3,3,"button",10)(4,gI,3,3,"button",10),Fl.j41(5,"button",11),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.logOut())}),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s()(),Fl.bVm()}if(2&e){const e=Fl.XpG();Fl.R7$(2),Fl.Y8G("ngIf",e.canApproveFromOtherDevice),Fl.R7$(),Fl.Y8G("ngIf",e.canApproveWithMasterPassword),Fl.R7$(),Fl.Y8G("ngIf",e.canRequestAdminApproval),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(7,4,"logOut")," ")}}!function(e){e[e.NewUser=0]="NewUser",e[e.ExistingUserUntrustedDevice=1]="ExistingUserUntrustedDevice"}(aI||(aI={}));class bI{get rememberDeviceControl(){return this.formGroup.controls.rememberDevice}constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,v,f,m,g,y,b,w,S,k,I,C,T){this.accountService=e,this.anonLayoutWrapperDataService=t,this.apiService=i,this.destroyRef=n,this.deviceTrustService=r,this.dialogService=s,this.formBuilder=o,this.i18nService=a,this.keyService=l,this.loginDecryptionOptionsService=c,this.loginEmailService=u,this.messagingService=d,this.organizationApiService=h,this.passwordResetEnrollmentService=p,this.platformUtilsService=v,this.router=f,this.ssoLoginService=m,this.toastService=g,this.userDecryptionOptionsService=y,this.validationService=b,this.logoutService=w,this.registerSdkService=S,this.securityStateService=k,this.appIdService=I,this.configService=C,this.accountCryptographicStateService=T,this.loading=!1,this.State=aI,this.formGroup=this.formBuilder.group({rememberDevice:[!0]}),this.canApproveFromOtherDevice=!1,this.canRequestAdminApproval=!1,this.canApproveWithMasterPassword=!1,this.createUser=()=>lI(this,void 0,void 0,function*(){if(this.state===aI.NewUser)try{if(yield this.configService.getFeatureFlag(Wv.PM27279_V2RegistrationTdeJit)){const e=yield this.appIdService.getAppId(),t=this.activeAccountId,i=this.newUserOrgId,n=yield this.organizationApiService.getKeys(i),r=yield(0,bo._)(this.registerSdkService.registerClient$(t).pipe((0,To.H)(r=>lI(this,void 0,void 0,function*(){const s={stack:[],error:void 0,hasError:!1};try{if(!r)throw new Error("SDK not available");const o=cI(s,r.take(),!1);return yield o.value.auth().registration().post_keys_for_tde_registration({org_id:Yk(i),org_public_key:n.publicKey,user_id:Yk(t),device_identifier:e,trust_device:this.formGroup.value.rememberDevice})}catch(e){s.error=e,s.hasError=!0}finally{uI(s)}}))));if("V1"in r.account_cryptographic_state)throw new Error("Unexpected V1 account cryptographic state");yield this.accountCryptographicStateService.setAccountCryptographicState(r.account_cryptographic_state,t),yield this.deviceTrustService.setDeviceKey(t,Dv.fromString(r.device_key)),yield this.keyService.setUserKey(Dv.fromString(r.user_key),t)}else{const{publicKey:e,privateKey:t}=yield this.keyService.initAccount(this.activeAccountId),i=new _k(e,t.encryptedString);yield this.apiService.postAccountKeys(i),yield this.passwordResetEnrollmentService.enroll(this.newUserOrgId),this.formGroup.value.rememberDevice&&(yield this.deviceTrustService.trustDevice(this.activeAccountId))}this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("accountSuccessfullyCreated")}),yield this.loginDecryptionOptionsService.handleCreateUserSuccess(),this.clientType===Da.Desktop&&this.messagingService.send("redrawMenu"),yield this.handleCreateUserSuccessNavigation()}catch(e){this.validationService.showError(e)}}),this.clientType=this.platformUtilsService.getClientType()}ngOnInit(){return lI(this,void 0,void 0,function*(){var e,t;if(this.loading=!0,this.activeAccountId=null===(e=yield(0,bo._)(this.accountService.activeAccount$))||void 0===e?void 0:e.id,this.email=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.email))),this.email){this.observeAndPersistRememberDeviceValueChanges(),yield this.setRememberDeviceDefaultValueFromState();try{const e=yield(0,bo._)(this.userDecryptionOptionsService.userDecryptionOptionsById$(this.activeAccountId));(null===(t=null==e?void 0:e.trustedDeviceOption)||void 0===t?void 0:t.hasAdminApproval)||(null==e?void 0:e.hasMasterPassword)?this.loadExistingUserUntrustedDeviceData(e):yield this.loadNewUserData()}catch(e){this.validationService.showError(e)}finally{this.loading=!1}}else yield this.handleMissingEmail()})}handleMissingEmail(){return lI(this,void 0,void 0,function*(){this.toastService.showToast({variant:"error",title:null,message:this.i18nService.t("activeUserEmailNotFoundLoggingYouOut")}),yield this.logoutService.logout(this.activeAccountId),yield this.router.navigate(["/"])})}observeAndPersistRememberDeviceValueChanges(){this.rememberDeviceControl.valueChanges.pipe((0,xl.pQ)(this.destroyRef),(0,go.n)(e=>(0,$o.v)(()=>this.deviceTrustService.setShouldTrustDevice(this.activeAccountId,e)))).subscribe()}setRememberDeviceDefaultValueFromState(){return lI(this,void 0,void 0,function*(){const e=yield this.deviceTrustService.getShouldTrustDevice(this.activeAccountId),t=null==e||e;this.rememberDeviceControl.setValue(t)})}loadNewUserData(){return lI(this,void 0,void 0,function*(){this.state=aI.NewUser,this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageTitle:{key:"loggedInExclamation"},pageSubtitle:{key:"rememberThisDeviceToMakeFutureLoginsSeamless"}});const e=(0,$o.v)(()=>this.ssoLoginService.getActiveUserOrganizationSsoIdentifier(this.activeAccountId)).pipe((0,go.n)(e=>null==e?(0,So.$)(()=>new Error(this.i18nService.t("ssoIdentifierRequired"))):(0,$d.H)(this.organizationApiService.getAutoEnrollStatus(e))),(0,Ed.W)(e=>(this.validationService.showError(e),(0,Go.of)(void 0)))),t=yield(0,bo._)(e);this.newUserOrgId=t.id})}loadExistingUserUntrustedDeviceData(e){var t,i;this.state=aI.ExistingUserUntrustedDevice,this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageTitle:{key:"deviceApprovalRequiredV2"},pageSubtitle:{key:"selectAnApprovalOptionBelow"}}),this.canApproveFromOtherDevice=(null===(t=null==e?void 0:e.trustedDeviceOption)||void 0===t?void 0:t.hasLoginApprovingDevice)||!1,this.canRequestAdminApproval=(null===(i=null==e?void 0:e.trustedDeviceOption)||void 0===i?void 0:i.hasAdminApproval)||!1,this.canApproveWithMasterPassword=(null==e?void 0:e.hasMasterPassword)||!1}handleCreateUserSuccessNavigation(){return lI(this,void 0,void 0,function*(){this.clientType===Da.Browser?yield this.router.navigate(["/tabs/vault"]):yield this.router.navigate(["/vault"])})}approveFromOtherDevice(){return lI(this,void 0,void 0,function*(){yield this.router.navigate(["/login-with-device"])})}approveWithMasterPassword(){return lI(this,void 0,void 0,function*(){yield this.router.navigate(["/lock"],{queryParams:{from:"login-initiated"}})})}requestAdminApproval(){return lI(this,void 0,void 0,function*(){yield this.router.navigate(["/admin-approval-requested"])})}logOut(){return lI(this,void 0,void 0,function*(){var e;const t=yield this.dialogService.openSimpleDialog({title:{key:"logOut"},content:{key:"logOutConfirmation"},acceptButtonText:{key:"logOut"},type:"warning"}),i=null===(e=yield(0,bo._)(this.accountService.activeAccount$))||void 0===e?void 0:e.id;t&&(yield this.logoutService.logout(i),yield this.router.navigate(["/"]))})}}bI.ɵfac=function(e){return new(e||bI)(Fl.rXU(Zk),Fl.rXU(Ck),Fl.rXU(eI),Fl.rXU(a.abz),Fl.rXU(tI),Fl.rXU(lh),Fl.rXU(Il.ok),Fl.rXU(Ul),Fl.rXU(Bp),Fl.rXU(iI),Fl.rXU(Dw),Fl.rXU(bk),Fl.rXU(nI),Fl.rXU(rI),Fl.rXU(Hb),Fl.rXU(Fd.Ix),Fl.rXU(xk),Fl.rXU(qb),Fl.rXU($w),Fl.rXU(Ud),Fl.rXU(Nw),Fl.rXU(Kk),Fl.rXU(sI),Fl.rXU(Tk),Fl.rXU(Kb),Fl.rXU(oI))},bI.ɵcmp=Fl.VBU({type:bI,selectors:[["ng-component"]],decls:4,vars:4,consts:[[4,"ngIf"],[3,"formGroup",4,"ngIf"],[1,"tw-text-center"],["aria-hidden","true",1,"bwi","bwi-spinner","bwi-spin","bwi-2x","tw-text-muted",3,"title"],[1,"tw-sr-only"],[3,"formGroup"],["type","checkbox","bitCheckbox","","formControlName","rememberDevice"],["bitTypography","body2"],["type","button","bitButton","","block","","buttonType","primary",3,"bitAction"],[1,"tw-grid","tw-gap-3"],["type","button","bitButton","","block","","buttonType","secondary",3,"click",4,"ngIf"],["type","button","bitButton","","bitFormButton","","block","",3,"click"],["type","button","bitButton","","block","","buttonType","primary",3,"click"],["class","tw-text-center",4,"ngIf"],["type","button","bitButton","","block","","buttonType","secondary",3,"click"]],template:function(e,t){1&e&&Fl.DNE(0,dI,7,7,"ng-container",0)(1,hI,9,7,"form",1)(2,pI,4,4,"ng-container",0)(3,yI,8,6,"ng-container",0),2&e&&(Fl.Y8G("ngIf",t.loading),Fl.R7$(),Fl.Y8G("ngIf",!t.loading),Fl.R7$(),Fl.Y8G("ngIf",t.state===t.State.NewUser),Fl.R7$(),Fl.Y8G("ngIf",t.state===t.State.ExistingUserUntrustedDevice))},dependencies:[pc,Bd,jd,id,td,hd,Qb,kl.MD,kl.bT,Gu,Sc,Ac,hu,sf,Il.X1,Il.qT,Il.Zm,Il.BC,Il.cb,Il.j4,Il.JD,tc,rc,rf],encapsulation:2});var wI,SI=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};!function(e){e[e.AuthenticateAndUnlock=0]="AuthenticateAndUnlock",e[e.Unlock=1]="Unlock",e[e.AdminApproval=2]="AdminApproval"}(wI||(wI={}));class kI{constructor(e,t,i,n,r){this.email=e,this.deviceIdentifier=t,this.publicKey=i,this.type=n,this.accessCode=r}}class II{}class CI{constructor(){this.id=void 0,this.accessCode=void 0,this.privateKey=void 0}static fromJSON(e){return null==e?null:Object.assign(new CI,e)}}class TI{constructor(){this.viewCacheService=(0,a.WQX)(II),this.defaultLoginViaAuthRequestCache=this.viewCacheService.signal({key:"login-via-auth-request-form-cache",initialValue:null,deserializer:CI.fromJSON})}cacheLoginView(e,t,i){this.defaultLoginViaAuthRequestCache.set({id:e,privateKey:bd.fromBufferToB64(t.buffer),accessCode:i})}clearCacheLoginView(){this.defaultLoginViaAuthRequestCache.set(null)}getCachedLoginViaAuthRequestView(){return this.defaultLoginViaAuthRequestCache()}}TI.ɵfac=function(e){return new(e||TI)},TI.ɵprov=a.jDH({token:TI,factory:TI.ɵfac});class PI{}class FI{}var RI,xI=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function AI(e,t){1&e&&(Fl.qex(0),Fl.j41(1,"div",1),Fl.nrm(2,"i",2),Fl.k0s(),Fl.bVm())}function DI(e,t){if(1&e&&(Fl.j41(0,"p"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.j41(3,"a",8),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s(),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(3);Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,4,"notificationSentDevicePart1")," "),Fl.R7$(2),Fl.Y8G("href",e.deviceManagementUrl,Fl.B4B),Fl.R7$(),Fl.JRh(Fl.bMT(5,6,"notificationSentDeviceAnchor")),Fl.R7$(2),Fl.SpI(". ",Fl.bMT(7,8,"notificationSentDevicePart2")," ")}}function EI(e,t){1&e&&(Fl.j41(0,"p"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"notificationSentDeviceComplete")," "))}function $I(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",9),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(3);return a.Njj(t.handleNewStandardAuthRequestLogin())}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"resendNotification")," "))}function OI(e,t){if(1&e&&(Fl.j41(0,"div",10)(1,"span"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.EFF(4,"  "),Fl.j41(5,"a",11),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s()()),2&e){const e=Fl.XpG(3);Fl.R7$(2),Fl.JRh(Fl.bMT(3,3,"needAnotherOptionV1")),Fl.R7$(3),Fl.Y8G("routerLink",e.backToRoute),Fl.R7$(),Fl.JRh(Fl.bMT(7,5,"viewAllLogInOptions"))}}function UI(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,DI,8,10,"p",0)(2,EI,3,3,"p",0),Fl.j41(3,"div",4),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s(),Fl.j41(6,"code",5),Fl.EFF(7),Fl.k0s(),Fl.DNE(8,$I,3,3,"button",6)(9,OI,8,7,"div",7),Fl.bVm()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("ngIf",e.clientType!==e.ClientType.Web),Fl.R7$(),Fl.Y8G("ngIf",e.clientType===e.ClientType.Web),Fl.R7$(2),Fl.JRh(Fl.bMT(5,6,"fingerprintPhraseHeader")),Fl.R7$(3),Fl.JRh(e.fingerprintPhrase),Fl.R7$(),Fl.Y8G("ngIf",e.showResendNotification),Fl.R7$(),Fl.Y8G("ngIf",e.clientType!==e.ClientType.Browser)}}function MI(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"p"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"div",4),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.j41(7,"code",5),Fl.EFF(8),Fl.k0s(),Fl.j41(9,"div",10)(10,"span"),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s(),Fl.EFF(13,"  "),Fl.j41(14,"a",11),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s()(),Fl.bVm()),2&e){const e=Fl.XpG(2);Fl.R7$(2),Fl.JRh(Fl.bMT(3,6,"youWillBeNotifiedOnceTheRequestIsApproved")),Fl.R7$(3),Fl.JRh(Fl.bMT(6,8,"fingerprintPhraseHeader")),Fl.R7$(3),Fl.JRh(e.fingerprintPhrase),Fl.R7$(3),Fl.JRh(Fl.bMT(12,10,"troubleLoggingIn")),Fl.R7$(3),Fl.Y8G("routerLink",e.backToRoute),Fl.R7$(),Fl.JRh(Fl.bMT(16,12,"viewAllLogInOptions"))}}function NI(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"div",3),Fl.DNE(2,UI,10,8,"ng-container",0)(3,MI,17,14,"ng-container",0),Fl.k0s(),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.Y8G("ngIf",e.flow===e.Flow.StandardAuthRequest),Fl.R7$(),Fl.Y8G("ngIf",e.flow===e.Flow.AdminAuthRequest)}}!function(e){e[e.StandardAuthRequest=0]="StandardAuthRequest",e[e.AdminAuthRequest=1]="AdminAuthRequest"}(RI||(RI={}));const VI={paths:"exact",queryParams:"ignored",fragment:"ignored",matrixParams:"ignored"};class BI{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,v,f,m,g,y,b){this.accountService=e,this.anonymousHubService=t,this.appIdService=i,this.authRequestApiService=n,this.authRequestService=r,this.authService=s,this.cryptoFunctionService=o,this.deviceTrustService=a,this.environmentService=l,this.i18nService=c,this.logService=u,this.loginEmailService=d,this.loginStrategyService=h,this.passwordGenerationService=p,this.platformUtilsService=v,this.router=f,this.toastService=m,this.validationService=g,this.loginSuccessHandlerService=y,this.loginViaAuthRequestCacheService=b,this.authRequestKeyPair=void 0,this.accessCode=void 0,this.authStatus=void 0,this.showResendNotificationTimeoutSeconds=12,this.loading=!0,this.backToRoute="/login",this.ClientType=Da,this.email=void 0,this.fingerprintPhrase=void 0,this.showResendNotification=!1,this.Flow=RI,this.flow=RI.StandardAuthRequest,this.webVaultUrl=void 0,this.clientType=this.platformUtilsService.getClientType(),this.authRequestService.authRequestPushNotification$.pipe((0,xl.pQ)()).subscribe(e=>{this.loading=!0,this.handleExistingAuthRequestLogin(e).catch(e=>{this.toastService.showToast({variant:"error",title:this.i18nService.t("error"),message:e.message}),this.loading=!1,this.logService.error("Failed to use approved auth request: "+e.message)})}),this.environmentService.environment$.pipe((0,xl.pQ)()).subscribe(e=>{this.webVaultUrl=e.getWebVaultUrl(),this.deviceManagementUrl=`${this.webVaultUrl}/#/settings/security/device-management`})}ngOnInit(){return xI(this,void 0,void 0,function*(){this.authStatus=yield(0,bo._)(this.authService.activeAccountStatus$);this.authStatus===Pd.Locked&&(this.backToRoute="/login-initiated"),this.router.isActive("admin-approval-requested",VI)?yield this.initAdminAuthRequestFlow():yield this.initStandardAuthRequestFlow(),this.loading=!1})}initAdminAuthRequestFlow(){return xI(this,void 0,void 0,function*(){var e;this.flow=RI.AdminAuthRequest;const t=null===(e=yield(0,bo._)(this.accountService.activeAccount$))||void 0===e?void 0:e.id;if(!t)return void this.logService.error("Not able to get a user id from the account service active account observable.");const i=yield this.reloadCachedAdminAuthRequest(t);i?yield this.handleExistingAdminAuthRequestLogin(i,t):yield this.handleNewAdminAuthRequestLogin()})}initStandardAuthRequestFlow(){return xI(this,void 0,void 0,function*(){var e,t;this.flow=RI.StandardAuthRequest;const i=this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.email)),n=this.loginEmailService.loginEmail$;let r=null!==(e=yield(0,bo._)(n))&&void 0!==e?e:void 0;if(r||(r=null!==(t=yield(0,bo._)(i))&&void 0!==t?t:void 0),this.email=r,!this.email)return void(yield this.handleMissingEmail());const s=this.loginViaAuthRequestCacheService.getCachedLoginViaAuthRequestView();if(s){if(this.logService.info("Found cached auth request."),!s.id)return void this.logService.error("No id on the cached auth request when in the standard auth request flow.");yield this.reloadCachedStandardAuthRequest(s),yield this.handleExistingAuthRequestLogin(s.id)}else yield this.handleNewStandardAuthRequestLogin()})}handleMissingEmail(){return xI(this,void 0,void 0,function*(){this.toastService.showToast({variant:"error",message:this.i18nService.t("userEmailMissing")}),yield this.router.navigate([this.backToRoute])})}ngOnDestroy(){return xI(this,void 0,void 0,function*(){yield this.anonymousHubService.stopHubConnection(),this.loginViaAuthRequestCacheService.clearCacheLoginView()})}handleNewAdminAuthRequestLogin(){return xI(this,void 0,void 0,function*(){var e;try{if(!this.email)return void this.logService.error("No email when starting admin auth request login.");const t=yield this.buildAuthRequest(this.email,wI.AdminApproval);if(!t)return void this.logService.error("Auth request failed to build.");if(!this.authRequestKeyPair)return void this.logService.error("Key pairs failed to initialize from buildAuthRequest.");const i=yield this.authRequestApiService.postAdminAuthRequest(t),n=new ek({id:i.id,privateKey:this.authRequestKeyPair.privateKey}),r=null===(e=yield(0,bo._)(this.accountService.activeAccount$))||void 0===e?void 0:e.id;if(!r)return void this.logService.error("Not able to get a user id from the account service active account observable.");yield this.authRequestService.setAdminAuthRequest(n,r),i.id&&(yield this.anonymousHubService.createHubConnection(i.id))}catch(e){this.logService.error(e)}})}reloadCachedAdminAuthRequest(e){return xI(this,void 0,void 0,function*(){return this.email=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.email))),this.email?yield this.authRequestService.getAdminAuthRequest(e):(yield this.handleMissingEmail(),null)})}reloadCachedStandardAuthRequest(e){return xI(this,void 0,void 0,function*(){if(e){if(!this.email)return void this.logService.error("Email not defined when trying to reload cached standard auth request.");if(!e.privateKey)return void this.logService.error("No private key on the cached auth request when trying to reload cached standard auth request.");if(!e.accessCode)return void this.logService.error("No access code on the cached auth request when trying to reload cached standard auth request.");const t=bd.fromB64ToArray(e.privateKey),i=yield this.cryptoFunctionService.rsaExtractPublicKey(t);this.fingerprintPhrase=yield this.authRequestService.getFingerprintPhrase(this.email,i),this.authRequestKeyPair={privateKey:t,publicKey:void 0},this.accessCode=e.accessCode}})}handleNewStandardAuthRequestLogin(){return xI(this,void 0,void 0,function*(){this.showResendNotification=!1;try{if(!this.email)return void this.logService.error("Email not defined when starting standard auth request login.");const e=yield this.buildAuthRequest(this.email,wI.AuthenticateAndUnlock);if(!e)return void this.logService.error("AuthRequest failed to initialize from buildAuthRequest.");if(!this.fingerprintPhrase)return void this.logService.error("FingerprintPhrase failed to initialize from buildAuthRequest.");if(!this.authRequestKeyPair)return void this.logService.error("KeyPair failed to initialize from buildAuthRequest.");const t=yield this.authRequestApiService.postAuthRequest(e);if(!this.authRequestKeyPair.privateKey)return void this.logService.error("No private key when trying to cache the login view.");if(!this.accessCode)return void this.logService.error("No access code when trying to cache the login view.");this.loginViaAuthRequestCacheService.cacheLoginView(t.id,this.authRequestKeyPair.privateKey,this.accessCode),t.id&&(yield this.anonymousHubService.createHubConnection(t.id))}catch(e){this.logService.error(e)}setTimeout(()=>{this.showResendNotification=!0},1e3*this.showResendNotificationTimeoutSeconds)})}buildAuthRequest(e,t){return xI(this,void 0,void 0,function*(){const i=yield this.cryptoFunctionService.rsaGenerateKeyPair(2048);this.authRequestKeyPair={publicKey:i[0],privateKey:i[1]};const n=yield this.appIdService.getAppId();if(!this.authRequestKeyPair.publicKey){const e="No public key when building an auth request.";throw this.logService.error(e),new Error(e)}this.fingerprintPhrase=yield this.authRequestService.getFingerprintPhrase(e,this.authRequestKeyPair.publicKey),this.accessCode=yield this.passwordGenerationService.generatePassword({type:"password",length:25});const r=bd.fromBufferToB64(this.authRequestKeyPair.publicKey);return new kI(e,n,r,t,this.accessCode)})}handleExistingAdminAuthRequestLogin(e,t){return xI(this,void 0,void 0,function*(){let i;try{i=yield this.authRequestApiService.getAuthRequest(e.id)}catch(e){return e instanceof iS&&e.statusCode===Ma.NotFound?yield this.clearExistingAdminAuthRequestAndStartNewRequest(t):void this.logService.error(e)}if(!i)return yield this.clearExistingAdminAuthRequestAndStartNewRequest(t);if(i.isAnswered&&!i.requestApproved)return yield this.clearExistingAdminAuthRequestAndStartNewRequest(t);if(i.requestApproved)return yield this.decryptViaApprovedAuthRequest(i,e.privateKey,t);if(!this.email)return void this.logService.error("Email not defined when handling an existing an admin auth request.");const n=yield this.cryptoFunctionService.rsaExtractPublicKey(e.privateKey);this.fingerprintPhrase=yield this.authRequestService.getFingerprintPhrase(this.email,n),this.authRequestKeyPair={privateKey:e.privateKey,publicKey:void 0},yield this.anonymousHubService.createHubConnection(e.id)})}retrieveAuthRequest(e){return xI(this,void 0,void 0,function*(){let t;try{if(this.authStatus===Pd.Locked)t=yield this.authRequestApiService.getAuthRequest(e);else{if(!this.accessCode){const e="No access code available when handling approved auth request.";throw this.logService.error(e),new Error(e)}t=yield this.authRequestApiService.getAuthResponse(e,this.accessCode)}}catch(e){e instanceof iS&&e.statusCode===Ma.NotFound?t=void 0:this.logService.error(e)}if(void 0===t)throw new Error("Auth request response not generated");return t})}handleExistingAuthRequestLogin(e){return xI(this,void 0,void 0,function*(){this.showResendNotification=!1;try{const t=yield this.retrieveAuthRequest(e);if(!t)return yield this.clearExistingStandardAuthRequestAndStartNewRequest();if(t.isAnswered&&!t.requestApproved)return yield this.clearExistingStandardAuthRequestAndStartNewRequest();if(t.requestApproved){return this.authStatus===Pd.Locked?yield this.handleAuthenticatedFlows(t):yield this.handleUnauthenticatedFlows(t,e)}yield this.anonymousHubService.createHubConnection(e)}catch(e){e instanceof iS&&(yield this.router.navigate([this.backToRoute]),this.validationService.showError(e)),this.logService.error(e)}setTimeout(()=>{this.showResendNotification=!0},1e3*this.showResendNotificationTimeoutSeconds)})}handleAuthenticatedFlows(e){return xI(this,void 0,void 0,function*(){var t;const i=null===(t=yield(0,bo._)(this.accountService.activeAccount$))||void 0===t?void 0:t.id;i?this.authRequestKeyPair&&this.authRequestKeyPair.privateKey?yield this.decryptViaApprovedAuthRequest(e,this.authRequestKeyPair.privateKey,i):this.logService.error("No private key set when handling the authenticated flows."):this.logService.error("Not able to get a user id from the account service active account observable.")})}handleUnauthenticatedFlows(e,t){return xI(this,void 0,void 0,function*(){const i=yield this.buildAuthRequestLoginCredentials(t,e);if(!i)return void this.logService.error("Didn't set up auth request login credentials properly.");this.loginViaAuthRequestCacheService.clearCacheLoginView();const n=yield this.loginStrategyService.logIn(i);yield this.handlePostLoginNavigation(n)})}decryptViaApprovedAuthRequest(e,t,i){return xI(this,void 0,void 0,function*(){yield this.authRequestService.setUserKeyAfterDecryptingSharedUserKey(e,t,i),yield this.authRequestService.clearAdminAuthRequest(i),this.loginViaAuthRequestCacheService.clearCacheLoginView(),this.toastService.showToast({variant:"success",message:this.i18nService.t("loginApproved")});const n=yield(0,bo._)(this.accountService.activeAccount$);n?(yield this.deviceTrustService.trustDeviceIfRequired(n.id),yield this.handleSuccessfulLoginNavigation(i)):this.logService.error("No active account defined from the account service.")})}buildAuthRequestLoginCredentials(e,t){return xI(this,void 0,void 0,function*(){if(!this.authRequestKeyPair||!this.authRequestKeyPair.privateKey)return void this.logService.error("No private key set when building auth request login credentials.");if(!this.email)return void this.logService.error("Email not defined.");if(!this.accessCode)return void this.logService.error("Access code not defined when building auth request login credentials.");const i=yield this.authRequestService.decryptPubKeyEncryptedUserKey(t.key,this.authRequestKeyPair.privateKey);return new _w(this.email,this.accessCode,e,i)})}clearExistingAdminAuthRequestAndStartNewRequest(e){return xI(this,void 0,void 0,function*(){yield this.authRequestService.clearAdminAuthRequest(e),yield this.handleNewAdminAuthRequestLogin()})}clearExistingStandardAuthRequestAndStartNewRequest(){return xI(this,void 0,void 0,function*(){this.loginViaAuthRequestCacheService.clearCacheLoginView(),yield this.handleNewStandardAuthRequestLogin()})}handlePostLoginNavigation(e){return xI(this,void 0,void 0,function*(){e.requiresTwoFactor?yield this.router.navigate(["2fa"]):yield this.handleSuccessfulLoginNavigation(e.userId)})}handleSuccessfulLoginNavigation(e){return xI(this,void 0,void 0,function*(){yield this.loginSuccessHandlerService.run(e,null),yield this.router.navigate(["vault"])})}}BI.ɵfac=function(e){return new(e||BI)(Fl.rXU(Zk),Fl.rXU(PI),Fl.rXU(Tk),Fl.rXU(Aw),Fl.rXU(Uw),Fl.rXU(Rd),Fl.rXU(FI),Fl.rXU(tI),Fl.rXU(mk),Fl.rXU(Ul),Fl.rXU(Za),Fl.rXU(Dw),Fl.rXU(Ew),Fl.rXU(gf),Fl.rXU(Hb),Fl.rXU(Fd.Ix),Fl.rXU(qb),Fl.rXU(Ud),Fl.rXU(Mw),Fl.rXU(TI))},BI.ɵcmp=Fl.VBU({type:BI,selectors:[["ng-component"]],features:[Fl.Jv_([{provide:TI}])],decls:2,vars:2,consts:[[4,"ngIf"],[1,"tw-flex","tw-items-center","tw-justify-center"],["aria-hidden","true",1,"bwi","bwi-spinner","bwi-spin","bwi-3x"],[1,"tw-text-center"],[1,"tw-font-medium"],[1,"tw-text-code"],["type","button","bitButton","","block","","buttonType","secondary","class","tw-mt-4",3,"click",4,"ngIf"],["class","tw-mt-4",4,"ngIf"],["bitLink","","linkType","primary","target","_blank","rel","noreferrer",1,"tw-cursor-pointer",3,"href"],["type","button","bitButton","","block","","buttonType","secondary",1,"tw-mt-4",3,"click"],[1,"tw-mt-4"],["bitLink","","linkType","primary",3,"routerLink"]],template:function(e,t){1&e&&Fl.DNE(0,AI,3,0,"ng-container",0)(1,NI,4,2,"ng-container",0),2&e&&(Fl.Y8G("ngIf",t.loading),Fl.R7$(),Fl.Y8G("ngIf",!t.loading))},dependencies:[id,td,kl.MD,kl.bT,sf,Hh,uw,Cw.iI,Cw.Wk,rf],encapsulation:2});class jI{constructor(e){this.email=e}}class GI{set appInputVerbatim(e){this.disableComplete=""===e||!0===e}constructor(e,t){this.el=e,this.renderer=t}ngOnInit(){this.disableComplete&&!this.el.nativeElement.hasAttribute("autocomplete")&&this.renderer.setAttribute(this.el.nativeElement,"autocomplete","off"),this.el.nativeElement.hasAttribute("autocapitalize")||this.renderer.setAttribute(this.el.nativeElement,"autocapitalize","none"),this.el.nativeElement.hasAttribute("autocorrect")||this.renderer.setAttribute(this.el.nativeElement,"autocorrect","none"),this.el.nativeElement.hasAttribute("spellcheck")||this.renderer.setAttribute(this.el.nativeElement,"spellcheck","false"),this.el.nativeElement.hasAttribute("inputmode")||this.renderer.setAttribute(this.el.nativeElement,"inputmode","verbatim")}}GI.ɵfac=function(e){return new(e||GI)(Fl.rXU(Fl.aKT),Fl.rXU(Fl.sFG))},GI.ɵdir=Fl.FsC({type:GI,selectors:[["","appInputVerbatim",""]],inputs:{appInputVerbatim:"appInputVerbatim"},standalone:!1});var LI=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function zI(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-form-field")(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",4),Fl.k0s(),Fl.j41(5,"button",5),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s(),Fl.j41(8,"button",6),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.cancel())}),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(2),Fl.JRh(Fl.bMT(3,5,"accountEmail")),Fl.R7$(3),Fl.Y8G("block",!0),Fl.R7$(),Fl.SpI(" ",Fl.bMT(7,7,"requestHint")," "),Fl.R7$(2),Fl.Y8G("block",!0),Fl.R7$(),Fl.SpI(" ",Fl.bMT(10,9,"cancel")," "))}function _I(e,t){1&e&&Fl.eu8(0)}function KI(e,t){if(1&e&&(Fl.j41(0,"main",7),Fl.DNE(1,_I,1,0,"ng-container",8),Fl.k0s()),2&e){Fl.XpG();const e=Fl.sdS(2);Fl.R7$(),Fl.Y8G("ngTemplateOutlet",e)}}function XI(e,t){1&e&&Fl.eu8(0)}function qI(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,XI,1,0,"ng-container",8),Fl.bVm()),2&e){Fl.XpG();const e=Fl.sdS(2);Fl.R7$(),Fl.Y8G("ngTemplateOutlet",e)}}class WI{get email(){return this.formGroup.controls.email.value}constructor(e,t,i,n,r,s,o){this.apiService=e,this.formBuilder=t,this.i18nService=i,this.loginEmailService=n,this.platformUtilsService=r,this.toastService=s,this.router=o,this.formGroup=this.formBuilder.group({email:["",[Il.k0.required,Il.k0.email]]}),this.submit=()=>LI(this,void 0,void 0,function*(){this.validateEmailOrShowToast(this.email)&&(yield this.apiService.postPasswordHint(new jI(this.email)),this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("masterPassSent")}),yield this.router.navigate(["login"]))}),this.clientType=this.platformUtilsService.getClientType()}ngOnInit(){return LI(this,void 0,void 0,function*(){var e;const t=null!==(e=yield(0,bo._)(this.loginEmailService.loginEmail$))&&void 0!==e?e:"";this.formGroup.controls.email.setValue(t)})}cancel(){return LI(this,void 0,void 0,function*(){yield this.loginEmailService.setLoginEmail(this.email),yield this.router.navigate(["login"])})}validateEmailOrShowToast(e){return null==e||""===e?(this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("emailRequired")}),!1):-1!==e.indexOf("@")||(this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("invalidEmail")}),!1)}}WI.ɵfac=function(e){return new(e||WI)(Fl.rXU(eI),Fl.rXU(Il.ok),Fl.rXU(Ul),Fl.rXU(Dw),Fl.rXU(Hb),Fl.rXU(qb),Fl.rXU(Fd.Ix))},WI.ɵcmp=Fl.VBU({type:WI,selectors:[["ng-component"]],decls:5,vars:4,consts:[["formContentTemplate",""],[3,"bitSubmit","formGroup"],["tabindex","-1",4,"ngIf"],[4,"ngIf"],["bitInput","","appAutofocus","","inputmode","email","appInputVerbatim","false","type","email","formControlName","email"],["type","submit","bitButton","","bitFormButton","","buttonType","primary",1,"tw-mb-2",3,"block"],["type","button","bitButton","","buttonType","secondary",3,"click","block"],["tabindex","-1"],[4,"ngTemplateOutlet"]],template:function(e,t){1&e&&(Fl.j41(0,"form",1),Fl.DNE(1,zI,11,11,"ng-template",null,0,Fl.C5r)(3,KI,2,1,"main",2)(4,qI,2,1,"ng-container",3),Fl.k0s()),2&e&&(Fl.Y8G("bitSubmit",t.submit)("formGroup",t.formGroup),Fl.R7$(3),Fl.Y8G("ngIf","browser"===t.clientType),Fl.R7$(),Fl.Y8G("ngIf","browser"!==t.clientType))},dependencies:[pc,jd,Md,id,td,kl.MD,kl.bT,kl.T3,Gu,Ac,fu,ju,sf,wd,GI,Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,Cw.iI,rf],encapsulation:2});const YI=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="3.33 0.87 76.36 76.8">
<path class="tw-fill-illustration-bg-primary" d="M3.333 33.298a5 5 0 0 1 1.745-3.794L37.287 1.87a4.167 4.167 0 0 1 5.426 0l32.21 27.634a5 5 0 0 1 1.744 3.794v41.035a3.333 3.333 0 0 1-3.334 3.334H6.667a3.333 3.333 0 0 1-3.334-3.334V33.299Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M75 74.334V33.297c0-.972-.425-1.896-1.163-2.53L41.627 3.136a2.5 2.5 0 0 0-3.255 0L6.162 30.769A3.333 3.333 0 0 0 5 33.299v41.035C5 75.254 5.746 76 6.667 76h66.666c.92 0 1.667-.746 1.667-1.666ZM5.078 29.504a5 5 0 0 0-1.745 3.794v41.035a3.333 3.333 0 0 0 3.334 3.334h66.666a3.333 3.333 0 0 0 3.334-3.334V33.299a5 5 0 0 0-1.745-3.794L42.713 1.87a4.167 4.167 0 0 0-5.426 0L5.077 29.504Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M41.98 55.17a3.333 3.333 0 0 1-3.96 0L5.496 31.161a.833.833 0 1 0-.99 1.341L37.031 56.51a5 5 0 0 0 5.938 0l32.526-24.007a.833.833 0 0 0-.99-1.34L41.98 55.168Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M12.5 10.166h55v28.333L40.999 58.175a1.667 1.667 0 0 1-1.994-.005L12.5 38.29V10.166Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M65.833 11.833H14.167v25.625l25.838 19.379L65.833 37.66V11.833ZM67.5 38.499 40.999 58.175a1.667 1.667 0 0 1-1.994-.005L12.5 38.29V10.166h55v28.333Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="m40 50.166 18.333 10.417L40 70.999 21.667 60.583 40 50.166Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M42.02 51.92a3.333 3.333 0 0 0-4.04 0L5.505 76.663a.833.833 0 0 1-1.01-1.326L36.97 50.594a5 5 0 0 1 6.06 0l-.494.648.494-.648 32.475 24.743a.833.833 0 0 1-1.01 1.326L42.02 51.92Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M70 41c0 9.204-7.462 16.666-16.667 16.666-9.204 0-16.666-7.462-16.666-16.666 0-9.205 7.462-16.667 16.666-16.667C62.538 24.333 70 31.795 70 41Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M53.333 56c8.285 0 15-6.716 15-15 0-8.285-6.715-15-15-15-8.284 0-15 6.715-15 15 0 8.284 6.716 15 15 15Zm0 1.666C62.538 57.666 70 50.204 70 41c0-9.205-7.462-16.667-16.667-16.667-9.204 0-16.666 7.462-16.666 16.667 0 9.204 7.462 16.666 16.666 16.666Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" d="M65.833 41c0 6.904-5.596 12.5-12.5 12.5-6.903 0-12.5-5.596-12.5-12.5s5.597-12.5 12.5-12.5c6.904 0 12.5 5.596 12.5 12.5Z"/>
<path class="tw-fill-illustration-outline" d="M79.17 65.24 65.417 52.25l-1.667 1.667L76.74 67.67a1.667 1.667 0 0 0 2.39.034l.074-.075a1.667 1.667 0 0 0-.034-2.39Z"/>
<path class="tw-fill-illustration-tertiary" fill-rule="evenodd" d="M18.333 17.666a.833.833 0 0 0 0 1.667h8.334a.833.833 0 0 0 0-1.667h-8.334ZM55 20.999a.833.833 0 0 1 0 1.667h-8.333a.833.833 0 1 1 0-1.667H55Zm.453 3.467a.83.83 0 0 0-.453-.133h-8.333a.833.833 0 0 0-.397 1.566 16.603 16.603 0 0 1 7.063-1.566c.718 0 1.425.045 2.12.133Zm-17.737 10.7a16.551 16.551 0 0 0-.524 1.667H35a.833.833 0 0 1 0-1.667h2.716Zm1.696-3.333a16.643 16.643 0 0 0-.966 1.666H32.5a.833.833 0 1 1 0-1.666h6.912ZM30 17.666a.833.833 0 0 0 0 1.667h8.333a.833.833 0 1 0 0-1.667H30Zm14.167 4.167a.833.833 0 0 0-.834-.834H35a.833.833 0 0 0 0 1.667h8.333c.46 0 .834-.373.834-.833Zm-.834 4.166a.833.833 0 1 0 0-1.666h-10a.833.833 0 0 0 0 1.666h10Zm-1.666-8.333a.833.833 0 1 0 0 1.667h1.666a.833.833 0 1 0 0-1.667h-1.666ZM32.5 21.833a.833.833 0 0 0-.833-.834H30a.833.833 0 0 0 0 1.667h1.667c.46 0 .833-.373.833-.833ZM30 25.999a.833.833 0 1 0 0-1.666h-3.333a.833.833 0 1 0 0 1.666H30Zm0 6.667c0 .46-.373.833-.833.833h-5a.833.833 0 1 1 0-1.666h5c.46 0 .833.373.833.833Zm1.667 4.167a.833.833 0 0 0 0-1.667H18.333a.833.833 0 0 0 0 1.667h13.334Zm15-19.167a.833.833 0 1 0 0 1.667H55a.833.833 0 0 0 0-1.667h-8.333ZM27.5 21.833a.833.833 0 0 0-.833-.834h-8.334a.833.833 0 0 0 0 1.667h8.334c.46 0 .833-.373.833-.833Zm-4.167 4.166a.833.833 0 1 0 0-1.666h-5a.833.833 0 0 0 0 1.666h5Zm-1.666 6.667c0 .46-.373.833-.834.833h-2.5a.833.833 0 1 1 0-1.666h2.5c.46 0 .834.373.834.833Z" clip-rule="evenodd"/>
</svg>
`,HI=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 10 80 60">
<path class="tw-fill-illustration-bg-primary" d="M0 14.8A4.8 4.8 0 0 1 4.8 10h45.4a4.8 4.8 0 0 1 4.8 4.8v32.067a4.8 4.8 0 0 1-4.8 4.8H4.8a4.8 4.8 0 0 1-4.8-4.8V14.8Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M50.2 11.6H4.8a3.2 3.2 0 0 0-3.2 3.2v32.067a3.2 3.2 0 0 0 3.2 3.2h45.4a3.2 3.2 0 0 0 3.2-3.2V14.8a3.2 3.2 0 0 0-3.2-3.2ZM4.8 10A4.8 4.8 0 0 0 0 14.8v32.067a4.8 4.8 0 0 0 4.8 4.8h45.4a4.8 4.8 0 0 0 4.8-4.8V14.8a4.8 4.8 0 0 0-4.8-4.8H4.8Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M54.167 19.966H.834v-1.6h53.333v1.6Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" d="M51.667 15a1.667 1.667 0 1 1-3.333 0 1.667 1.667 0 0 1 3.333 0ZM46.667 15a1.667 1.667 0 1 1-3.333 0 1.667 1.667 0 0 1 3.333 0ZM41.667 15a1.667 1.667 0 1 1-3.333 0 1.667 1.667 0 0 1 3.333 0Z"/>
<path class="tw-fill-illustration-bg-secondary" d="M33.6 50.4c0 7.29-5.91 13.2-13.2 13.2-7.29 0-13.2-5.91-13.2-13.2 0-7.29 5.91-13.2 13.2-13.2 7.29 0 13.2 5.91 13.2 13.2Z"/>
<path class="tw-fill-illustration-tertiary" d="M30.3 50.4c0 5.468-4.432 9.9-9.9 9.9-5.467 0-9.9-4.432-9.9-9.9s4.433-9.9 9.9-9.9c5.468 0 9.9 4.432 9.9 9.9Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M20.4 58.716a8.316 8.316 0 1 0 0-16.632 8.316 8.316 0 0 0 0 16.632Zm0 1.584c5.468 0 9.9-4.432 9.9-9.9s-4.432-9.9-9.9-9.9c-5.467 0-9.9 4.432-9.9 9.9s4.433 9.9 9.9 9.9Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" d="M19.575 46.275a.825.825 0 1 1 1.65 0v8.25a.825.825 0 0 1-1.65 0v-8.25Z"/>
<path class="tw-fill-illustration-outline" d="M24.525 49.575a.825.825 0 1 1 0 1.65h-8.25a.825.825 0 0 1 0-1.65h8.25Z"/>
<path class="tw-fill-illustration-bg-tertiary" d="M68.333 35c0 6.443-5.223 11.666-11.666 11.666C50.223 46.666 45 41.443 45 35c0-6.444 5.223-11.667 11.667-11.667 6.443 0 11.666 5.223 11.666 11.667Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M56.667 45.066c5.56 0 10.066-4.507 10.066-10.066 0-5.56-4.507-10.067-10.066-10.067C51.107 24.933 46.6 29.44 46.6 35c0 5.56 4.507 10.066 10.067 10.066Zm0 1.6c6.443 0 11.666-5.223 11.666-11.666 0-6.444-5.223-11.667-11.666-11.667C50.223 23.333 45 28.556 45 35c0 6.443 5.223 11.666 11.667 11.666Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M78.255 59.98A22.916 22.916 0 0 1 80 68.75c0 .69-.56 1.25-1.25 1.25H35.417c-.69 0-1.25-.56-1.25-1.25a22.916 22.916 0 0 1 44.088-8.77Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M78.397 68.4a21.317 21.317 0 0 0-42.628 0h42.628Zm1.603.35a22.916 22.916 0 0 0-45.833 0c0 .69.56 1.25 1.25 1.25H78.75c.69 0 1.25-.56 1.25-1.25Z" clip-rule="evenodd"/>
</svg>
`;class JI{constructor(e,t,i){this.email=e,this.name=t,this.receiveMarketingEmails=i}}var ZI=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const QI=(e,t)=>({"bwi-angle-right":e,"bwi-angle-down":t});function eC(e,t){1&e&&(Fl.qex(0),Fl.j41(1,"p",11),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"bit-form-field")(5,"bit-label"),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s(),Fl.nrm(8,"input",12),Fl.k0s(),Fl.j41(9,"bit-form-field")(10,"bit-label"),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s(),Fl.nrm(13,"input",13),Fl.k0s(),Fl.j41(14,"bit-form-field")(15,"bit-label"),Fl.EFF(16),Fl.nI1(17,"i18n"),Fl.k0s(),Fl.nrm(18,"input",14),Fl.k0s(),Fl.j41(19,"bit-form-field")(20,"bit-label"),Fl.EFF(21),Fl.nI1(22,"i18n"),Fl.k0s(),Fl.nrm(23,"input",15),Fl.k0s(),Fl.j41(24,"bit-form-field")(25,"bit-label"),Fl.EFF(26),Fl.nI1(27,"i18n"),Fl.k0s(),Fl.nrm(28,"input",16),Fl.k0s(),Fl.bVm()),2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,6,"selfHostedCustomEnvHeader")," "),Fl.R7$(4),Fl.JRh(Fl.bMT(7,8,"webVaultUrl")),Fl.R7$(5),Fl.JRh(Fl.bMT(12,10,"apiUrl")),Fl.R7$(5),Fl.JRh(Fl.bMT(17,12,"identityUrl")),Fl.R7$(5),Fl.JRh(Fl.bMT(22,14,"notificationsUrl")),Fl.R7$(5),Fl.JRh(Fl.bMT(27,16,"iconsUrl")))}function tC(e,t){1&e&&(Fl.j41(0,"span",17),Fl.nrm(1,"i",18),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"selfHostedEnvFormInvalid")," "))}function iC(){const e=(0,a.WQX)(Ul),t=(0,a.WQX)(Hb);return i=>{const n=i.value;return!n||n.startsWith("https://")||t.isDev()?null:{onlyHttpsAllowed:{message:e.t("selfHostedEnvMustUseHttps")}}}}class nC{static open(e){return ZI(this,void 0,void 0,function*(){const t=e.open(nC,{disableClose:!1}),i=yield(0,bo._)(t.closed);return null!=i&&i})}get baseUrl(){return this.formGroup.get("baseUrl")}get webVaultUrl(){return this.formGroup.get("webVaultUrl")}get apiUrl(){return this.formGroup.get("apiUrl")}get identityUrl(){return this.formGroup.get("identityUrl")}get iconsUrl(){return this.formGroup.get("iconsUrl")}get notificationsUrl(){return this.formGroup.get("notificationsUrl")}constructor(e,t,i){this.dialogRef=e,this.formBuilder=t,this.environmentService=i,this.formGroup=this.formBuilder.group({baseUrl:["",[iC()]],webVaultUrl:["",[iC()]],apiUrl:["",[iC()]],identityUrl:["",[iC()]],iconsUrl:["",[iC()]],notificationsUrl:["",[iC()]]},{validators:e=>{var t,i,n,r,s,o;const a=e,l=null===(t=a.get("baseUrl"))||void 0===t?void 0:t.value,c=null===(i=a.get("webVaultUrl"))||void 0===i?void 0:i.value,u=null===(n=a.get("apiUrl"))||void 0===n?void 0:n.value,d=null===(r=a.get("identityUrl"))||void 0===r?void 0:r.value,h=null===(s=a.get("iconsUrl"))||void 0===s?void 0:s.value,p=null===(o=a.get("notificationsUrl"))||void 0===o?void 0:o.value;return l||c||u||d||h||p?null:{atLeastOneUrlIsRequired:!0}}}),this.showCustomEnv=!1,this.showErrorSummary=!1,this.destroy$=new Co.B,this.submit=()=>ZI(this,void 0,void 0,function*(){var e;this.formGroup.markAllAsTouched(),this.showErrorSummary=!1,this.formGroup.invalid?this.showErrorSummary=Boolean(null===(e=this.formGroup.errors)||void 0===e?void 0:e.atLeastOneUrlIsRequired):(yield this.environmentService.setEnvironment(hk.SelfHosted,{base:this.baseUrl.value,api:this.apiUrl.value,identity:this.identityUrl.value,webVault:this.webVaultUrl.value,icons:this.iconsUrl.value,notifications:this.notificationsUrl.value}),this.dialogRef.close(!0))})}ngOnInit(){this.environmentService.environment$.pipe((0,_o.s)(1),(0,Eo.p)(e=>e.getRegion()===hk.SelfHosted),(0,vm.Q)(this.destroy$)).subscribe({next:e=>{const t=e.getUrls();this.formGroup.patchValue({baseUrl:t.base||"",webVaultUrl:t.webVault||"",apiUrl:t.api||"",identityUrl:t.identity||"",iconsUrl:t.icons||"",notificationsUrl:t.notifications||""})}})}cancel(){return ZI(this,void 0,void 0,function*(){this.dialogRef.close(!1)})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}}nC.ɵfac=function(e){return new(e||nC)(Fl.rXU(nh),Fl.rXU(Il.ok),Fl.rXU(mk))},nC.ɵcmp=Fl.VBU({type:nC,selectors:[["self-hosted-env-config-dialog"]],decls:26,vars:23,consts:[[3,"formGroup","bitSubmit"],["bitDialogTitle",""],["bitDialogContent",""],["id","self_hosted_env_settings_form_input_base_url","bitInput","","type","text","formControlName","baseUrl","appAutofocus","","appInputVerbatim",""],["bitLink","","linkType","primary","type","button",3,"click"],["aria-hidden","true",1,"bwi","bwi-fw","bwi-sm",3,"ngClass"],[4,"ngIf"],["class","tw-block tw-text-danger tw-mt-2","aria-live","assertive","role","alert",4,"ngIf"],["bitDialogFooter",""],["type","submit","bitButton","","bitFormButton","","buttonType","primary"],["type","button","bitButton","","bitFormButton","","buttonType","secondary",3,"click"],["bitTypography","body1",1,"tw-text-muted","tw-mt-3"],["id","self_hosted_env_settings_form_input_web_vault_url","bitInput","","type","text","formControlName","webVaultUrl","appInputVerbatim",""],["id","self_hosted_env_settings_form_input_api_url","bitInput","","type","text","formControlName","apiUrl","appInputVerbatim",""],["id","self_hosted_env_settings_form_input_identity_url","bitInput","","type","text","formControlName","identityUrl","appInputVerbatim",""],["id","self_hosted_env_settings_form_input_notifications_url","bitInput","","type","text","formControlName","notificationsUrl","appInputVerbatim",""],["id","self_hosted_env_settings_form_input_icons_url","bitInput","","type","text","formControlName","iconsUrl","appInputVerbatim",""],["aria-live","assertive","role","alert",1,"tw-block","tw-text-danger","tw-mt-2"],[1,"bwi","bwi-error"]],template:function(e,t){1&e&&(Fl.j41(0,"form",0)(1,"bit-dialog")(2,"span",1),Fl.EFF(3," Self-hosted environment"),Fl.k0s(),Fl.qex(4,2),Fl.j41(5,"bit-form-field")(6,"bit-label"),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.nrm(9,"input",3),Fl.j41(10,"bit-hint"),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s()(),Fl.j41(13,"button",4),Fl.bIt("click",function(){return t.showCustomEnv=!t.showCustomEnv}),Fl.nrm(14,"i",5),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s(),Fl.DNE(17,eC,29,18,"ng-container",6)(18,tC,4,3,"span",7),Fl.bVm(),Fl.qex(19,8),Fl.j41(20,"button",9),Fl.EFF(21),Fl.nI1(22,"i18n"),Fl.k0s(),Fl.j41(23,"button",10),Fl.bIt("click",function(){return t.cancel()}),Fl.EFF(24),Fl.nI1(25,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()()),2&e&&(Fl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),Fl.R7$(7),Fl.JRh(Fl.bMT(8,10,"baseUrl")),Fl.R7$(4),Fl.JRh(Fl.bMT(12,12,"selfHostedBaseUrlHint")),Fl.R7$(3),Fl.Y8G("ngClass",Fl.l_i(20,QI,!t.showCustomEnv,t.showCustomEnv)),Fl.R7$(),Fl.SpI(" ",Fl.bMT(16,14,"customEnvironment")," "),Fl.R7$(2),Fl.Y8G("ngIf",t.showCustomEnv),Fl.R7$(),Fl.Y8G("ngIf",t.showErrorSummary),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(22,16,"save")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(25,18,"cancel")," "))},dependencies:[kl.MD,kl.YU,kl.bT,sf,wd,GI,Fh,Ph,id,td,Hh,uw,tc,rc,Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,Gu,Ac,hu,fu,ju,pc,jd,Md,rf],encapsulation:2});var rC=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function sC(e,t){if(1&e&&Fl.nrm(0,"bit-option",5),2&e){const e=t.$implicit;Fl.Y8G("value",e)("label",e.domain)}}function oC(e,t){if(1&e&&(Fl.nrm(0,"bit-option",5),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG(2);Fl.Y8G("value",e.ServerEnvironmentType.SelfHosted)("label",Fl.bMT(1,2,"selfHostedServer"))}}function aC(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"form",1)(1,"bit-form-field")(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"bit-select",2),Fl.bIt("closed",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.onSelectClosed())}),Fl.DNE(6,sC,1,2,"bit-option",3)(7,oC,2,4,"bit-option",4),Fl.k0s()()()}if(2&e){const e=Fl.XpG();Fl.Y8G("formGroup",e.formGroup),Fl.R7$(3),Fl.JRh(Fl.bMT(4,4,"creatingAccountOn")),Fl.R7$(3),Fl.Y8G("ngForOf",e.availableRegionConfigs),Fl.R7$(),Fl.Y8G("ngIf",e.isDesktopOrBrowserExtension)}}class lC{get selectedRegion(){return this.formGroup.get("selectedRegion")}constructor(e,t,i,n,r,s){this.formBuilder=e,this.environmentService=t,this.dialogService=i,this.i18nService=n,this.toastService=r,this.platformUtilsService=s,this.selectedRegionChange=new Fl.bkB,this.ServerEnvironmentType=hk,this.formGroup=this.formBuilder.group({selectedRegion:[null,Il.k0.required]}),this.availableRegionConfigs=this.environmentService.availableRegions(),this.hideEnvSelector=!1,this.isDesktopOrBrowserExtension=!1,this.destroy$=new Co.B;const o=s.getClientType();this.isDesktopOrBrowserExtension=o===Da.Desktop||o===Da.Browser,this.hideEnvSelector=o===Da.Web&&this.platformUtilsService.isSelfHost()}ngOnInit(){return rC(this,void 0,void 0,function*(){this.hideEnvSelector||(yield this.initSelectedRegionAndListenForEnvChanges(),this.listenForSelectedRegionChanges())})}initSelectedRegionAndListenForEnvChanges(){return rC(this,void 0,void 0,function*(){this.environmentService.environment$.pipe((0,l.T)(e=>{const t=e.getRegion(),i=this.availableRegionConfigs.find(e=>e.key===t);return void 0===i?hk.SelfHosted:i}),(0,Oo.M)(e=>{e!==this.selectedRegion.value&&this.selectedRegion.setValue(e,{emitEvent:!1}),this.selectedRegionFromEnv=e,this.selectedRegionChange.emit(e)}),(0,vm.Q)(this.destroy$)).subscribe()})}listenForSelectedRegionChanges(){this.selectedRegion.valueChanges.pipe((0,kd.Z)(null),(0,mm.J)(),(0,go.n)(([e,t])=>null===t?(this.selectedRegionChange.emit(t),(0,Go.of)(null)):t!==hk.SelfHosted?(this.selectedRegionChange.emit(t),(0,$d.H)(this.environmentService.setEnvironment(t.key))):(0,Go.of)(null)),(0,vm.Q)(this.destroy$)).subscribe()}handleSelfHostedEnvConfigDialogResult(e,t){if(!0===e)return this.selectedRegionChange.emit(hk.SelfHosted),void this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("environmentSaved")});!1!==e&&void 0!==e||null===t||t===hk.SelfHosted?(this.selectedRegionChange.emit(this.selectedRegionFromEnv),this.selectedRegion.setValue(this.selectedRegionFromEnv,{emitEvent:!1})):(this.selectedRegionChange.emit(t),this.selectedRegion.setValue(t,{emitEvent:!1}))}onSelectClosed(){return rC(this,void 0,void 0,function*(){if(this.selectedRegion.value===hk.SelfHosted){const e=yield nC.open(this.dialogService);return this.handleSelfHostedEnvConfigDialogResult(e,this.selectedRegion.value)}})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}}lC.ɵfac=function(e){return new(e||lC)(Fl.rXU(Il.ok),Fl.rXU(mk),Fl.rXU(lh),Fl.rXU(Ul),Fl.rXU(qb),Fl.rXU(Hb))},lC.ɵcmp=Fl.VBU({type:lC,selectors:[["auth-registration-env-selector"]],outputs:{selectedRegionChange:"selectedRegionChange"},decls:1,vars:1,consts:[[3,"formGroup",4,"ngIf"],[3,"formGroup"],["formControlName","selectedRegion",3,"closed"],[3,"value","label",4,"ngFor","ngForOf"],[3,"value","label",4,"ngIf"],[3,"value","label"]],template:function(e,t){1&e&&Fl.DNE(0,aC,8,6,"form",0),2&e&&Fl.Y8G("ngIf",!t.hideEnvSelector)},dependencies:[kl.MD,kl.Sq,kl.bT,sf,Il.X1,Il.qT,Il.BC,Il.cb,Il.j4,Il.JD,Gu,Ac,ju,Wu,qu,zu,rf],encapsulation:2});class cC{}var uC,dC=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function hC(e,t){1&e&&(Fl.j41(0,"bit-form-control"),Fl.nrm(1,"input",10),Fl.j41(2,"bit-label",11),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.j41(5,"a",12),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s(),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s()()),2&e&&(Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,3,"receiveMarketingEmailsV2")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(7,5,"unsubscribe")," "),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(9,7,"atAnyTime")," "))}function pC(e,t){if(1&e&&Fl.nrm(0,"bit-error-summary",13),2&e){const e=Fl.XpG(2);Fl.Y8G("formGroup",e.formGroup)}}function vC(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"form",1)(2,"auth-registration-env-selector",2),Fl.bIt("selectedRegionChange",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.handleSelectedRegionChange(t))}),Fl.k0s(),Fl.j41(3,"bit-form-field")(4,"bit-label"),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.nrm(7,"input",3),Fl.k0s(),Fl.j41(8,"bit-form-field")(9,"bit-label"),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s(),Fl.nrm(12,"input",4),Fl.k0s(),Fl.DNE(13,hC,10,9,"bit-form-control",0),Fl.j41(14,"button",5),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s(),Fl.j41(17,"p",6),Fl.EFF(18),Fl.nI1(19,"i18n"),Fl.j41(20,"a",7),Fl.EFF(21),Fl.nI1(22,"i18n"),Fl.k0s(),Fl.EFF(23),Fl.nI1(24,"i18n"),Fl.j41(25,"a",8),Fl.EFF(26),Fl.nI1(27,"i18n"),Fl.k0s()(),Fl.DNE(28,pC,1,1,"bit-error-summary",9),Fl.k0s(),Fl.bVm()}if(2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("formGroup",e.formGroup)("bitSubmit",e.submit),Fl.R7$(4),Fl.JRh(Fl.bMT(6,13,"emailAddress")),Fl.R7$(2),Fl.BMQ("readonly",!!e.emailReadonly||null),Fl.R7$(3),Fl.JRh(Fl.bMT(11,15,"name")),Fl.R7$(3),Fl.Y8G("ngIf",!e.isSelfHost),Fl.R7$(),Fl.Y8G("block",!0),Fl.R7$(),Fl.SpI(" ",Fl.bMT(16,17,"continue")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(19,19,"byContinuingYouAgreeToThe")," "),Fl.R7$(3),Fl.JRh(Fl.bMT(22,21,"termsOfService")),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(24,23,"and")," "),Fl.R7$(3),Fl.JRh(Fl.bMT(27,25,"privacyPolicy")),Fl.R7$(2),Fl.Y8G("ngIf",e.showErrorSummary)}}function fC(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"div",14)(2,"p",15),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.j41(5,"span",16),Fl.EFF(6),Fl.k0s(),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.j41(9,"p",17),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.j41(12,"a",18),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.goBack())}),Fl.EFF(13),Fl.nI1(14,"i18n"),Fl.k0s(),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s()(),Fl.bVm()}if(2&e){const e=Fl.XpG();Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,6,"followTheLinkInTheEmailSentTo")," "),Fl.R7$(3),Fl.JRh(e.email.value),Fl.R7$(),Fl.SpI(" ",Fl.bMT(8,8,"andContinueCreatingYourAccount")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(11,10,"noEmail")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(14,12,"goBack")," "),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(16,14,"toEditYourEmailAddress")," ")}}!function(e){e.USER_DATA_ENTRY="UserDataEntry",e.CHECK_EMAIL="CheckEmail"}(uC||(uC={}));const mC={[hk.US]:!0,[hk.EU]:!1,[hk.SelfHosted]:!1};class gC{get email(){return this.formGroup.controls.email}get name(){return this.formGroup.controls.name}get receiveMarketingEmails(){return this.formGroup.controls.receiveMarketingEmails}constructor(e,t,i,n,r,s,o){this.formBuilder=e,this.route=t,this.platformUtilsService=i,this.accountApiService=n,this.router=r,this.loginEmailService=s,this.anonLayoutWrapperDataService=o,this.registrationStartStateChange=new Fl.bkB,this.state=uC.USER_DATA_ENTRY,this.RegistrationStartState=uC,this.isSelfHost=!1,this.formGroup=this.formBuilder.group({email:["",[Il.k0.required,Il.k0.email]],name:[""],receiveMarketingEmails:[!1]}),this.emailReadonly=!1,this.showErrorSummary=!1,this.destroy$=new Co.B,this.submit=()=>dC(this,void 0,void 0,function*(){if(!this.validateForm())return;const e=""===this.name.value?null:this.name.value,t=new JI(this.email.value,e,this.receiveMarketingEmails.value),i=yield this.accountApiService.registerSendVerificationEmail(t);"string"!=typeof i?(this.state=uC.CHECK_EMAIL,this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageTitle:{key:"checkYourEmail"},pageIcon:YI}),this.registrationStartStateChange.emit(this.state)):yield this.router.navigate(["/finish-signup"],{queryParams:{token:i,email:this.email.value}})}),this.isSelfHost=i.isSelfHost()}ngOnInit(){return dC(this,void 0,void 0,function*(){this.registrationStartStateChange.emit(this.state),this.listenForQueryParamChanges(),this.loginEmailService.loginEmail$.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{e&&this.formGroup.patchValue({email:e})})})}listenForQueryParamChanges(){this.route.queryParams.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{var t;null!=e.email&&e.email.indexOf("@")>-1&&(null===(t=this.email)||void 0===t||t.setValue(e.email),this.emailReadonly="true"===e.emailReadonly)})}setReceiveMarketingEmailsByRegion(e){let t;if(e===hk.SelfHosted)t=mC[e];else{const i=e.key;t=mC[i]}this.receiveMarketingEmails.setValue(t)}handleSelectedRegionChange(e){this.isSelfHost=e===hk.SelfHosted,null!==e&&this.setReceiveMarketingEmailsByRegion(e)}validateForm(){return this.formGroup.markAllAsTouched(),this.formGroup.invalid&&(this.showErrorSummary=!0),this.formGroup.valid}goBack(){this.state=uC.USER_DATA_ENTRY,this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageIcon:HI,pageTitle:{key:"createAccount"}}),this.registrationStartStateChange.emit(this.state)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}}gC.ɵfac=function(e){return new(e||gC)(Fl.rXU(Il.ok),Fl.rXU(Fd.nX),Fl.rXU(Hb),Fl.rXU(cC),Fl.rXU(Fd.Ix),Fl.rXU(Qw),Fl.rXU(Ck))},gC.ɵcmp=Fl.VBU({type:gC,selectors:[["auth-registration-start"]],outputs:{registrationStartStateChange:"registrationStartStateChange"},decls:2,vars:2,consts:[[4,"ngIf"],[3,"formGroup","bitSubmit"],[3,"selectedRegionChange"],["id","register-start_form_input_email","bitInput","","type","email","formControlName","email"],["id","register-start_form_input_name","bitInput","","type","text","formControlName","name"],["type","submit","buttonType","primary","bitButton","","bitFormButton","",1,"tw-mb-3",3,"block"],["bitTypography","helper",1,"tw-text-main","tw-text-xs","tw-mb-0"],["bitLink","","linkType","primary","href","https://bitwarden.com/terms/","target","_blank","rel","noreferrer"],["bitLink","","linkType","primary","href","https://bitwarden.com/privacy/","target","_blank","rel","noreferrer"],[3,"formGroup",4,"ngIf"],["id","register-start-form-input-receive-marketing-emails","type","checkbox","bitCheckbox","","formControlName","receiveMarketingEmails"],["for","register-start-form-input-receive-marketing-emails"],["bitLink","","linkType","primary","href","https://bitwarden.com/email-preferences","target","_blank","rel","noreferrer"],[3,"formGroup"],[1,"tw-flex","tw-flex-col","tw-items-center","tw-justify-center"],["bitTypography","body1","id","follow_the_link_body",1,"tw-text-center","tw-mb-3","tw-text-main"],[1,"tw-font-medium"],["bitTypography","helper",1,"tw-text-center","tw-text-main"],["bitLink","","linkType","primary","tabindex","0",1,"tw-cursor-pointer",3,"click"]],template:function(e,t){1&e&&Fl.DNE(0,vC,29,27,"ng-container",0)(1,fC,17,16,"ng-container",0),2&e&&(Fl.Y8G("ngIf",t.state===t.RegistrationStartState.USER_DATA_ENTRY),Fl.R7$(),Fl.Y8G("ngIf",t.state===t.RegistrationStartState.CHECK_EMAIL))},dependencies:[kl.MD,kl.bT,Il.X1,Il.qT,Il.me,Il.Zm,Il.BC,Il.cb,Il.j4,Il.JD,sf,Gu,Sc,Ac,fu,tw,ju,pc,jd,Md,hd,Qb,id,td,Hh,uw,Yh,lC,rf],encapsulation:2});class yC{constructor(e,t){this.email=e,this.emailVerificationToken=t}}class bC{}class wC{}var SC=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const kC=()=>({key:"createAccount"});function IC(e,t){1&e&&(Fl.j41(0,"div",2),Fl.nrm(1,"i",3),Fl.k0s())}function CC(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"auth-input-password",4),Fl.bIt("onPasswordFormSubmit",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.handlePasswordFormSubmit(t))}),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.Y8G("email",e.email)("flow",e.inputPasswordFlow)("masterPasswordPolicyOptions",e.masterPasswordPolicyOptions)("loading",e.submitting)("primaryButtonText",Fl.lJ4(5,kC))}}const TC=Object.freeze({Premium:"premium"});class PC{constructor(e,t,i,n,r,s,o,a,l,c,u,d){this.activatedRoute=e,this.router=t,this.toastService=i,this.i18nService=n,this.registrationFinishService=r,this.validationService=s,this.accountApiService=o,this.loginStrategyService=a,this.logService=l,this.anonLayoutWrapperDataService=c,this.loginSuccessHandlerService=u,this.premiumInterestStateService=d,this.destroy$=new Co.B,this.inputPasswordFlow=dw.SetInitialPasswordAccountRegistration,this.loading=!0,this.submitting=!1,this.premiumInterest=!1,this.masterPasswordPolicyOptions=null}ngOnInit(){return SC(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.activatedRoute.queryParams);if(this.handleQueryParams(e),e.fromEmail&&"true"===e.fromEmail&&this.email&&this.emailVerificationToken)yield this.initEmailVerificationFlow();else{(yield this.initOrgInviteFlowIfPresent())||this.initRegistrationWithEmailVerificationDisabledFlow()}this.loading=!1})}handleQueryParams(e){null!=e.email&&e.email.indexOf("@")>-1&&(this.email=e.email),null!=e.token&&(this.emailVerificationToken=e.token),null!=e.orgSponsoredFreeFamilyPlanToken&&(this.orgSponsoredFreeFamilyPlanToken=e.orgSponsoredFreeFamilyPlanToken),null!=e.acceptEmergencyAccessInviteToken&&e.emergencyAccessId&&(this.acceptEmergencyAccessInviteToken=e.acceptEmergencyAccessInviteToken,this.emergencyAccessId=e.emergencyAccessId),null!=e.providerInviteToken&&null!=e.providerUserId&&(this.providerInviteToken=e.providerInviteToken,this.providerUserId=e.providerUserId),null!=e.fromMarketing&&e.fromMarketing===TC.Premium&&(this.premiumInterest=!0)}initOrgInviteFlowIfPresent(){return SC(this,void 0,void 0,function*(){this.masterPasswordPolicyOptions=yield this.registrationFinishService.getMasterPasswordPolicyOptsFromOrgInvite();const e=yield this.registrationFinishService.getOrgNameFromOrgInvite();return!!e&&(this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageTitle:{key:"joinOrganizationName",placeholders:[e]},pageSubtitle:{key:"finishJoiningThisOrganizationBySettingAMasterPassword"}}),!0)})}handlePasswordFormSubmit(e){return SC(this,void 0,void 0,function*(){var t;this.submitting=!0;try{yield this.registrationFinishService.finishRegistration(this.email,e,this.emailVerificationToken,this.orgSponsoredFreeFamilyPlanToken,this.acceptEmergencyAccessInviteToken,this.emergencyAccessId,this.providerInviteToken,this.providerUserId)}catch(e){return this.validationService.showError(e),void(this.submitting=!1)}this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("newAccountCreated2")});try{const i=new Lw(this.email,e.newPassword),n=yield this.loginStrategyService.logIn(i);if(null==n?void 0:n.requiresTwoFactor)return void(yield this.router.navigate(["/2fa"]));yield this.loginSuccessHandlerService.run(n.userId,null!==(t=n.masterPassword)&&void 0!==t?t:null),this.premiumInterest&&(yield this.premiumInterestStateService.setPremiumInterest(n.userId,!0)),yield this.router.navigate(["/vault"])}catch(e){this.logService.error("Error logging in after registration: ",e.message),yield this.router.navigate(["/login"],{queryParams:{email:this.email}})}this.submitting=!1})}setDefaultPageTitleAndSubtitle(){this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageTitle:{key:"setAStrongPassword"},pageSubtitle:{key:"finishCreatingYourAccountBySettingAPassword"}})}initEmailVerificationFlow(){return SC(this,void 0,void 0,function*(){this.setDefaultPageTitleAndSubtitle(),yield this.registerVerificationEmailClicked(this.email,this.emailVerificationToken)})}registerVerificationEmailClicked(e,t){return SC(this,void 0,void 0,function*(){const i=new yC(e,t);try{null==(yield this.accountApiService.registerVerificationEmailClicked(i))&&this.toastService.showToast({title:null,message:this.i18nService.t("emailVerifiedV2"),variant:"success"})}catch(e){yield this.handleRegisterVerificationEmailClickedError(e)}})}handleRegisterVerificationEmailClickedError(e){return SC(this,void 0,void 0,function*(){if(e instanceof iS){const t=e;if(t.statusCode===Ma.BadRequest)t.message.includes("Expired link")?yield this.router.navigate(["/signup-link-expired"]):this.validationService.showError(t);else this.validationService.showError(t)}else this.validationService.showError(e)})}initRegistrationWithEmailVerificationDisabledFlow(){this.setDefaultPageTitleAndSubtitle()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}}PC.ɵfac=function(e){return new(e||PC)(Fl.rXU(Fd.nX),Fl.rXU(Fd.Ix),Fl.rXU(qb),Fl.rXU(Ul),Fl.rXU(bC),Fl.rXU(Ud),Fl.rXU(cC),Fl.rXU(Ew),Fl.rXU(Za),Fl.rXU(Ck),Fl.rXU(Mw),Fl.rXU(wC))},PC.ɵcmp=Fl.VBU({type:PC,selectors:[["auth-registration-finish"]],decls:2,vars:2,consts:[["class","tw-flex tw-items-center tw-justify-center",4,"ngIf"],[3,"email","flow","masterPasswordPolicyOptions","loading","primaryButtonText","onPasswordFormSubmit",4,"ngIf"],[1,"tw-flex","tw-items-center","tw-justify-center"],["aria-hidden","true",1,"bwi","bwi-spinner","bwi-spin","bwi-3x"],[3,"onPasswordFormSubmit","email","flow","masterPasswordPolicyOptions","loading","primaryButtonText"]],template:function(e,t){1&e&&Fl.DNE(0,IC,2,0,"div",0)(1,CC,1,6,"auth-input-password",1),2&e&&(Fl.Y8G("ngIf",t.loading),Fl.R7$(),Fl.Y8G("ngIf",!t.loading))},dependencies:[kl.MD,kl.bT,sf,Cw.iI,Iw],encapsulation:2});const FC=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="5 4 87 87">
<circle cx="48" cy="48" r="42" class="tw-fill-illustration-bg-primary tw-stroke-illustration-outline" stroke-width="2"/>
<rect width="18" height="14" x="12" y="70" class="tw-fill-illustration-bg-secondary tw-stroke-illustration-outline" stroke-width="2" rx="2"/>
<rect width="2" height="6" x="20" y="74" class="tw-fill-illustration-outline" rx="1"/>
<path class="tw-stroke-illustration-outline" stroke-width="2" d="M25 69v-1a4 4 0 0 0-8 0v1"/>
<circle cx="80" cy="16" r="11" class="tw-fill-illustration-tertiary tw-stroke-illustration-outline" stroke-width="2"/>
<path class="tw-stroke-illustration-outline" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m76.673 19.495 3.5-3.5m3.5-3.5-3.5 3.5m0 0-3.5-3.5 7 7"/>
<circle cx="48" cy="48" r="15.5" class="tw-fill-illustration-bg-tertiary tw-stroke-illustration-outline" stroke-width="2"/>
<path class="tw-stroke-illustration-outline" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M52.95 52.243 48 48.707v-9.9"/>
</svg>
`;var RC=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class xC{constructor(e){this.activatedRoute=e,this.destroy$=new Co.B,this.Icons={TwoFactorTimeoutIcon:FC}}ngOnInit(){return RC(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.activatedRoute.data);this.loginRoute=e.loginRoute})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}}xC.ɵfac=function(e){return new(e||xC)(Fl.rXU(Fd.nX))},xC.ɵcmp=Fl.VBU({type:xC,selectors:[["auth-registration-link-expired"]],decls:13,vars:15,consts:[[1,"tw-flex","tw-flex-col","tw-items-center","tw-justify-center"],["bitTypography","body1","id","restart_registration_body",1,"tw-text-center","tw-mb-3","tw-text-main"],["type","button","buttonType","primary","bitButton","","routerLink","/signup",1,"tw-mb-3",3,"block"],["type","button","buttonType","secondary","bitButton","",3,"block","routerLink"]],template:function(e,t){1&e&&(Fl.j41(0,"div",0)(1,"p",1),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.nrm(4,"br"),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.j41(7,"a",2),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.j41(10,"a",3),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s()()),2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,7,"pleaseRestartRegistrationOrTryLoggingIn")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(6,9,"youMayAlreadyHaveAnAccount")," "),Fl.R7$(2),Fl.Y8G("block",!0),Fl.R7$(),Fl.SpI(" ",Fl.bMT(9,11,"restartRegistration")," "),Fl.R7$(2),Fl.Y8G("block",!0)("routerLink",t.loginRoute),Fl.R7$(),Fl.SpI(" ",Fl.bMT(12,13,"logIn")," "))},dependencies:[kl.MD,sf,Cw.iI,Cw.Wk,Yh,id,td,rf],encapsulation:2});var AC=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class DC{constructor(e){this.activatedRoute=e}ngOnInit(){return AC(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.activatedRoute.data);this.loginRoute=e.loginRoute})}}DC.ɵfac=function(e){return new(e||DC)(Fl.rXU(Fd.nX))},DC.ɵcmp=Fl.VBU({type:DC,selectors:[["auth-registration-start-secondary"]],decls:6,vars:7,consts:[["bitLink","",3,"routerLink"]],template:function(e,t){1&e&&(Fl.j41(0,"span"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.j41(3,"a",0),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()()),2&e&&(Fl.R7$(),Fl.SpI("",Fl.bMT(2,3,"alreadyHaveAccount")," "),Fl.R7$(2),Fl.Y8G("routerLink",t.loginRoute),Fl.R7$(),Fl.JRh(Fl.bMT(5,5,"logIn")))},dependencies:[kl.MD,sf,Cw.iI,Cw.Wk,Hh,uw,rf],encapsulation:2});class EC{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,v,f,m){this.email=e,this.masterPasswordHash=t,this.masterPasswordHint=i,this.userSymmetricKey=n,this.userAsymmetricKeys=r,this.kdf=s,this.kdfIterations=o,this.kdfMemory=a,this.kdfParallelism=l,this.emailVerificationToken=c,this.orgSponsoredFreeFamilyPlanToken=u,this.acceptEmergencyAccessInviteToken=d,this.acceptEmergencyAccessId=h,this.providerInviteToken=p,this.providerUserId=v,this.organizationUserId=f,this.orgInviteToken=m}}var $C,OC=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};!function(e){e.MasterPassword="masterPassword",e.Pin="pin",e.Biometrics="biometrics",e.None="none"}($C||($C={}));const UC=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="4 4 88 88">
<path class="tw-fill-illustration-bg-primary" d="M4 10a6 6 0 0 1 6-6h50a6 6 0 0 1 6 6v50a6 6 0 0 1-6 6H10a6 6 0 0 1-6-6V10Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M60 6H10a4 4 0 0 0-4 4v50a4 4 0 0 0 4 4h50a4 4 0 0 0 4-4V10a4 4 0 0 0-4-4ZM10 4a6 6 0 0 0-6 6v50a6 6 0 0 0 6 6h50a6 6 0 0 0 6-6V10a6 6 0 0 0-6-6H10Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M14 19a5 5 0 0 1 5-5h7a1 1 0 1 1 0 2h-7a3 3 0 0 0-3 3v7a1 1 0 1 1-2 0v-7Zm29-4a1 1 0 0 1 1-1h7a5 5 0 0 1 5 5v7a1 1 0 1 1-2 0v-7a3 3 0 0 0-3-3h-7a1 1 0 0 1-1-1ZM15 43a1 1 0 0 1 1 1v7a3 3 0 0 0 3 3h7a1 1 0 1 1 0 2h-7a5 5 0 0 1-5-5v-7a1 1 0 0 1 1-1Zm40 0a1 1 0 0 1 1 1v7a5 5 0 0 1-5 5h-7a1 1 0 1 1 0-2h7a3 3 0 0 0 3-3v-7a1 1 0 0 1 1-1ZM26 27a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0v-5a1 1 0 0 1 1-1Zm11 0a1 1 0 1 0-2 0v10a1 1 0 0 1-1 1h-2a1 1 0 1 0 0 2h2a3 3 0 0 0 3-3V27Zm-2 19c-2.234 0-4.411-.64-6.494-1.862a1 1 0 1 0-1.012 1.724C29.845 47.242 32.368 48 35 48c2.632 0 5.155-.758 7.506-2.138a1 1 0 1 0-1.012-1.724C39.41 45.36 37.234 46 35 46ZM23.565 24.825C24.378 24.268 25.192 24 26 24s1.622.268 2.435.825a1 1 0 1 0 1.13-1.65C28.478 22.43 27.277 22 26 22c-1.277 0-2.478.43-3.565 1.175a1 1 0 1 0 1.13 1.65ZM44 24c-.808 0-1.622.268-2.435.825a1 1 0 1 1-1.13-1.65C41.522 22.43 42.722 22 44 22s2.478.43 3.565 1.175a1 1 0 1 1-1.13 1.65C45.622 24.268 44.808 24 44 24Zm1 4a1 1 0 1 0-2 0v5a1 1 0 1 0 2 0v-5Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" d="M92 61.5C92 78.345 80.807 92 67 92S42 78.345 42 61.5 53.193 31 67 31s25 13.655 25 30.5Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M67 90c12.349 0 23-12.37 23-28.5C90 45.37 79.349 33 67 33S44 45.37 44 61.5C44 77.63 54.651 90 67 90Zm0 2c13.807 0 25-13.655 25-30.5S80.807 31 67 31 42 44.655 42 61.5 53.193 92 67 92Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M60.351 49.196A18.953 18.953 0 0 1 67.001 48c2.342 0 4.582.423 6.65 1.196a1 1 0 0 0 .7-1.873A20.954 20.954 0 0 0 67.001 46c-2.584 0-5.06.467-7.35 1.323a1 1 0 1 0 .7 1.873ZM67.001 52c-4.58 0-8.646 2.198-11.201 5.6a1 1 0 1 1-1.6-1.2A15.977 15.977 0 0 1 67.001 50c5.198 0 9.537 2.124 12.708 5.293a1 1 0 1 1-1.414 1.414C75.462 53.877 71.618 52 67.001 52Zm-.14 2c-6.453 0-11.555 5.467-11.111 11.905l.09 1.297a15.002 15.002 0 0 0 1.175 4.873l.565 1.319a1 1 0 1 0 1.838-.788l-.565-1.319a13 13 0 0 1-1.019-4.223l-.09-1.297C57.382 60.485 61.568 56 66.863 56A9.138 9.138 0 0 1 76 65.138V66a1 1 0 1 1-2 0v-1c0-1.61-.58-3.358-1.827-4.713C70.908 58.912 69.01 58 66.5 58c-2.607 0-4.29 1.188-5.276 2.705C60.276 62.164 60 63.871 60 65c0 2.792.25 4.826.952 6.51.712 1.71 1.848 2.958 3.408 4.258a1 1 0 1 0 1.28-1.536c-1.44-1.2-2.304-2.202-2.842-3.492C62.25 69.424 62 67.708 62 65c0-.871.224-2.164.9-3.205.64-.983 1.707-1.795 3.6-1.795 1.99 0 3.342.707 4.202 1.642A5.018 5.018 0 0 1 72 65v1a3 3 0 1 0 6 0v-.862C78 58.987 73.013 54 66.862 54Zm-.905 10.94c0-.505.417-.94.988-.94.583 0 1.056.473 1.056 1.056v1.636c0 1.768.832 3.432 2.246 4.493l.82.615a6 6 0 0 0 3.6 1.2H75a1 1 0 1 0 0-2h-.333a4 4 0 0 1-2.4-.8l-.82-.615A3.615 3.615 0 0 1 70 66.692v-1.636A3.056 3.056 0 0 0 66.944 62c-1.61 0-2.99 1.267-2.988 2.943.002.984.039 2.22.177 3.365.15 1.243.753 2.218 1.396 3.031.293.372.611.73.909 1.065l.079.09c.328.369.631.715.903 1.072.663.875.84 1.591.651 2.063a1 1 0 0 0 1.858.742c.604-1.51-.165-3.023-.916-4.013a20.143 20.143 0 0 0-1-1.193l-.073-.082c-.306-.344-.587-.66-.842-.983-.546-.692-.893-1.32-.98-2.031-.124-1.034-.16-2.181-.162-3.129Z" clip-rule="evenodd"/>
</svg>
`;var MC;!function(e){e[e.MasterPassword=0]="MasterPassword",e[e.OTP=1]="OTP",e[e.PIN=2]="PIN",e[e.Biometrics=3]="Biometrics"}(MC||(MC={}));class NC{}var VC=i(23197);class BC{constructor(){this.domSanitizer=(0,a.WQX)(VC.up),this.content=(0,o.hFB)(),this.ariaLabel=(0,o.hFB)(),this.innerHtml=(0,Rl.EW)(()=>{const e=this.content();if(!(e instanceof Tw))return null;const t=e.svg;return this.domSanitizer.bypassSecurityTrustHtml(t)})}}BC.ɵfac=function(e){return new(e||BC)},BC.ɵcmp=Fl.VBU({type:BC,selectors:[["bit-svg"]],hostAttrs:[1,"tw-max-h-full","tw-flex","tw-justify-center"],hostVars:3,hostBindings:function(e,t){2&e&&(Fl.Avn("innerHTML",t.innerHtml(),Fl.npT),Fl.BMQ("aria-hidden",!t.ariaLabel())("aria-label",t.ariaLabel()))},inputs:{content:[1,"content"],ariaLabel:[1,"ariaLabel"]},decls:0,vars:0,template:function(e,t){},encapsulation:2,changeDetection:0});var jC=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function GC(e,t){1&e&&Fl.eu8(0)}function LC(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,GC,1,0,"ng-container",4),Fl.bVm()),2&e){Fl.XpG(2);const e=Fl.sdS(3);Fl.R7$(),Fl.Y8G("ngTemplateOutlet",e)}}function zC(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"bit-form-field",5)(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.nrm(5,"input",6)(6,"button",7),Fl.j41(7,"bit-hint"),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s()(),Fl.bVm()),2&e){const e=Fl.XpG(2);Fl.R7$(3),Fl.JRh(Fl.bMT(4,3,"pin")),Fl.R7$(2),Fl.Y8G("formControl",e.secret),Fl.R7$(3),Fl.JRh(Fl.bMT(9,5,"confirmIdentity"))}}function _C(e,t){1&e&&(Fl.j41(0,"div"),Fl.nrm(1,"i",13),Fl.nI1(2,"i18n"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.Y8G("title",Fl.mNQ(Fl.bMT(2,3,"loading"))),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(4,5,"awaitingConfirmation")," "))}function KC(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-callout",14),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.j41(3,"button",15),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(3);return a.Njj(t.verifyUserViaBiometrics())}),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,2,"couldNotCompleteBiometrics")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(5,4,"tryAgain")," "))}function XC(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"div",8)(2,"div",9),Fl.nrm(3,"bit-svg",10),Fl.k0s(),Fl.j41(4,"p",11),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.DNE(7,_C,5,7,"div",1),Fl.k0s(),Fl.DNE(8,KC,6,6,"bit-callout",12),Fl.bVm()),2&e){const e=Fl.XpG(2);Fl.R7$(3),Fl.Y8G("content",e.Icons.UserVerificationBiometricsIcon),Fl.R7$(2),Fl.JRh(Fl.bMT(6,4,"verifyWithBiometrics")),Fl.R7$(2),Fl.Y8G("ngIf",!e.biometricsVerificationFailed),Fl.R7$(),Fl.Y8G("ngIf",e.biometricsVerificationFailed)}}function qC(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",20),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(3);return a.Njj(t.activeClientVerificationOption=t.ActiveClientVerificationOption.Biometrics)}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"useBiometrics")," "))}function WC(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",20),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(3);return a.Njj(t.activeClientVerificationOption=t.ActiveClientVerificationOption.Pin)}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"usePin")," "))}function YC(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",21),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(3);return a.Njj(t.activeClientVerificationOption=t.ActiveClientVerificationOption.MasterPassword)}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"useMasterPassword")," "))}function HC(e,t){if(1&e&&(Fl.j41(0,"div",16)(1,"p",17),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.DNE(4,qC,3,3,"button",18)(5,WC,3,3,"button",18)(6,YC,3,3,"button",19),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(2),Fl.JRh(Fl.bMT(3,4,"needADifferentMethod")),Fl.R7$(2),Fl.Y8G("ngIf",e.userVerificationOptions.client.biometrics&&e.activeClientVerificationOption!==e.ActiveClientVerificationOption.Biometrics),Fl.R7$(),Fl.Y8G("ngIf",e.userVerificationOptions.client.pin&&e.activeClientVerificationOption!==e.ActiveClientVerificationOption.Pin),Fl.R7$(),Fl.Y8G("ngIf",e.userVerificationOptions.client.masterPassword&&e.activeClientVerificationOption!==e.ActiveClientVerificationOption.MasterPassword)}}function JC(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"div",2),Fl.DNE(2,LC,2,1,"ng-container",1)(3,zC,10,7,"ng-container",1)(4,XC,9,6,"ng-container",1)(5,HC,7,6,"div",3),Fl.k0s(),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.Y8G("ngIf",e.userVerificationOptions.client.masterPassword&&e.activeClientVerificationOption==e.ActiveClientVerificationOption.MasterPassword),Fl.R7$(),Fl.Y8G("ngIf",e.userVerificationOptions.client.pin&&e.activeClientVerificationOption==e.ActiveClientVerificationOption.Pin),Fl.R7$(),Fl.Y8G("ngIf",e.userVerificationOptions.client.biometrics&&e.activeClientVerificationOption==e.ActiveClientVerificationOption.Biometrics),Fl.R7$(),Fl.Y8G("ngIf",e.hasMultipleClientVerificationOptions)}}function ZC(e,t){1&e&&Fl.eu8(0)}function QC(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,ZC,1,0,"ng-container",4),Fl.bVm()),2&e){Fl.XpG(2);const e=Fl.sdS(3);Fl.R7$(),Fl.Y8G("ngTemplateOutlet",e)}}function eT(e,t){1&e&&(Fl.j41(0,"div",24),Fl.nrm(1,"i",13),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.Y8G("title",Fl.mNQ(Fl.bMT(2,2,"loading"))))}function tT(e,t){1&e&&(Fl.j41(0,"span",27),Fl.nrm(1,"i",28),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()),2&e&&(Fl.Y8G("@sent",void 0),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,2,"codeSent")," "))}function iT(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"div",24),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.j41(3,"p",25)(4,"button",15),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(3);return a.Njj(t.requestOTP())}),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.DNE(7,tT,4,4,"span",26),Fl.k0s()()}if(2&e){const e=Fl.XpG(3);Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,3,"enterVerificationCodeSentToEmail")," "),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(6,5,"resendCode")," "),Fl.R7$(2),Fl.Y8G("ngIf",e.sentCode)}}function nT(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,eT,3,4,"div",22)(2,iT,8,7,"div",22),Fl.j41(3,"bit-form-field",5)(4,"bit-label"),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.nrm(7,"input",23),Fl.j41(8,"bit-hint"),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s()(),Fl.bVm()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("ngIf",!e.sentInitialCode),Fl.R7$(),Fl.Y8G("ngIf",e.sentInitialCode),Fl.R7$(3),Fl.JRh(Fl.bMT(6,5,"verificationCode")),Fl.R7$(2),Fl.Y8G("formControl",e.secret),Fl.R7$(2),Fl.JRh(Fl.bMT(10,7,"confirmIdentity"))}}function rT(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,QC,2,1,"ng-container",1)(2,nT,11,9,"ng-container",1),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("ngIf",e.userVerificationOptions.server.masterPassword),Fl.R7$(),Fl.Y8G("ngIf",e.userVerificationOptions.server.otp)}}function sT(e,t){if(1&e&&(Fl.j41(0,"bit-form-field",5)(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",29)(5,"button",7),Fl.j41(6,"bit-hint"),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.JRh(Fl.bMT(3,3,"masterPass")),Fl.R7$(2),Fl.Y8G("formControl",e.secret),Fl.R7$(3),Fl.JRh(Fl.bMT(8,5,"confirmIdentity"))}}class oT{get invalidSecret(){return this._invalidSecret}set invalidSecret(e){this._invalidSecret=e,this.invalidSecretChange.emit(e),e&&this.secret.markAsTouched(),this.secret.updateValueAndValidity({emitEvent:!1})}set activeClientVerificationOption(e){this._activeClientVerificationOptionSubject.next(e)}get activeClientVerificationOption(){return this._activeClientVerificationOptionSubject.getValue()}get hasMultipleClientVerificationOptions(){let e=0;return this.userVerificationOptions.client.masterPassword&&e++,this.userVerificationOptions.client.pin&&e++,this.userVerificationOptions.client.biometrics&&e++,e>=2}getInvalidSecretErrorMessage(){return"server"===this.verificationType?this.userVerificationOptions.server.masterPassword?this.i18nService.t("incorrectPassword"):this.i18nService.t("incorrectCode"):this.activeClientVerificationOption===$C.MasterPassword?this.i18nService.t("incorrectPassword"):this.activeClientVerificationOption===$C.Pin?this.i18nService.t("incorrectPin"):void 0}constructor(e,t){this.userVerificationService=e,this.i18nService=t,this.verificationType="server",this._invalidSecret=!1,this.invalidSecretChange=new Fl.bkB,this.activeClientVerificationOptionChange=new Fl.bkB,this.biometricsVerificationResultChange=new Fl.bkB,this.Icons={UserVerificationBiometricsIcon:UC},this.userVerificationOptions={client:{masterPassword:!1,pin:!1,biometrics:!1},server:{masterPassword:!1,otp:!1}},this.ActiveClientVerificationOption=$C,this._activeClientVerificationOptionSubject=new Dd.t(null),this.activeClientVerificationOption$=this._activeClientVerificationOptionSubject.asObservable(),this.biometricsVerificationFailed=!1,this.disableRequestOTP=!1,this.sentInitialCode=!1,this.sentCode=!1,this.secret=new Il.MJ("",[Il.k0.required,()=>{if(this.invalidSecret)return{invalidSecret:{message:this.getInvalidSecretErrorMessage()}}}]),this.destroy$=new Co.B,this.requestOTP=()=>jC(this,void 0,void 0,function*(){if(!this.userVerificationOptions.server.masterPassword){this.disableRequestOTP=!0;try{yield this.userVerificationService.requestOTP(),this.sentCode=!0,this.sentInitialCode=!0,setTimeout(()=>{this.sentCode=!1},3e3)}finally{this.disableRequestOTP=!1}}})}ngOnInit(){return jC(this,void 0,void 0,function*(){this.userVerificationOptions=yield this.userVerificationService.getAvailableVerificationOptions(this.verificationType),"client"===this.verificationType?(this.setDefaultActiveClientVerificationOption(),this.setupClientVerificationOptionChangeHandler()):this.userVerificationOptions.server.otp&&this.requestOTP(),this.activeClientVerificationOption!==$C.Biometrics&&this.processSecretChanges(this.secret.value),this.secret.valueChanges.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>this.processSecretChanges(e))})}setDefaultActiveClientVerificationOption(){this.userVerificationOptions.client.biometrics?this.activeClientVerificationOption=$C.Biometrics:this.userVerificationOptions.client.pin?this.activeClientVerificationOption=$C.Pin:this.userVerificationOptions.client.masterPassword?this.activeClientVerificationOption=$C.MasterPassword:this.activeClientVerificationOption=$C.None}setupClientVerificationOptionChangeHandler(){this.activeClientVerificationOption$.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{this.handleActiveClientVerificationOptionChange(e)})}handleActiveClientVerificationOptionChange(e){return jC(this,void 0,void 0,function*(){this.activeClientVerificationOptionChange.emit(e),this.secret.setValue(null),this.secret.markAsUntouched(),this.secret.updateValueAndValidity({emitEvent:!1}),"biometrics"===e&&(this.biometricsVerificationFailed=!1,yield this.verifyUserViaBiometrics())})}verifyUserViaBiometrics(){return jC(this,void 0,void 0,function*(){this.biometricsVerificationFailed=!1;const e=yield this.userVerificationService.verifyUser({type:MC.Biometrics});this.biometricsVerificationResultChange.emit(e),this.biometricsVerificationFailed=!e})}writeValue(e){this.secret.setValue(e)}registerOnChange(e){this.onChange=e}registerOnTouched(e){}setDisabledState(e){this.disableRequestOTP=e,e?this.secret.disable():this.secret.enable()}processSecretChanges(e){this.invalidSecret=!1,this.activeClientVerificationOption!==$C.Biometrics&&null!=this.onChange&&this.onChange({type:this.determineVerificationWithSecretType(),secret:bd.isNullOrWhitespace(e)?null:e})}determineVerificationWithSecretType(){return"server"===this.verificationType?this.userVerificationOptions.server.masterPassword?MC.MasterPassword:MC.OTP:this.userVerificationOptions.client.masterPassword&&this.activeClientVerificationOption===$C.MasterPassword?MC.MasterPassword:MC.PIN}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}}oT.ɵfac=function(e){return new(e||oT)(Fl.rXU(NC),Fl.rXU(Ul))},oT.ɵcmp=Fl.VBU({type:oT,selectors:[["app-user-verification-form-input"]],inputs:{verificationType:"verificationType",invalidSecret:"invalidSecret"},outputs:{invalidSecretChange:"invalidSecretChange",activeClientVerificationOptionChange:"activeClientVerificationOptionChange",biometricsVerificationResultChange:"biometricsVerificationResultChange"},features:[Fl.Jv_([{provide:Il.kq,multi:!0,useExisting:oT}])],decls:4,vars:2,consts:[["masterPasswordFormField",""],[4,"ngIf"],[1,"tw-flex","tw-flex-col"],["class","tw-flex tw-flex-col tw-items-center tw-justify-center tw-mt-2",4,"ngIf"],[4,"ngTemplateOutlet"],["disableMargin",""],["bitInput","","id","pin","type","password","name","pin","appAutofocus","","appInputVerbatim","",3,"formControl"],["type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle",""],[1,"tw-flex","tw-flex-col","tw-items-center"],[1,"tw-size-16","tw-content-center","tw-mb-4"],[3,"content"],[1,"tw-font-medium","tw-mb-1"],["type","danger",4,"ngIf"],["aria-hidden","true",1,"bwi","bwi-spinner","bwi-spin",3,"title"],["type","danger"],["bitLink","","type","button","linkType","primary",3,"click"],[1,"tw-flex","tw-flex-col","tw-items-center","tw-justify-center","tw-mt-2"],[1,"tw-mb-1"],["type","button","class","tw-mb-1","bitLink","","linkType","primary",3,"click",4,"ngIf"],["type","button","bitLink","","linkType","primary",3,"click",4,"ngIf"],["type","button","bitLink","","linkType","primary",1,"tw-mb-1",3,"click"],["type","button","bitLink","","linkType","primary",3,"click"],["class","tw-mb-6",4,"ngIf"],["bitInput","","type","text","id","verificationCode","name","verificationCode","appInputVerbatim","",3,"formControl"],[1,"tw-mb-6"],[1,"tw-mb-0"],["class","tw-ml-2 tw-text-success","role","alert",4,"ngIf"],["role","alert",1,"tw-ml-2","tw-text-success"],["aria-hidden","true",1,"bwi","bwi-check-circle"],["bitInput","","id","masterPassword","type","password","name","MasterPasswordHash","appAutofocus","","appInputVerbatim","",3,"formControl"]],template:function(e,t){1&e&&Fl.DNE(0,JC,6,4,"ng-container",1)(1,rT,3,2,"ng-container",1)(2,sT,9,7,"ng-template",null,0,Fl.C5r),2&e&&(Fl.Y8G("ngIf","client"===t.verificationType),Fl.R7$(),Fl.Y8G("ngIf","server"===t.verificationType))},dependencies:[kl.MD,kl.bT,kl.T3,Il.X1,Il.me,Il.BC,Il.l_,sf,wd,GI,Gu,Ac,hu,fu,ju,iw,nw,pc,Ql,Zl,Yh,BC,Hh,uw,id,dd,ud,rf],encapsulation:2,data:{animation:[(0,Pl.hZ)("sent",[(0,Pl.kY)(":enter",[(0,Pl.iF)({opacity:0}),(0,Pl.i0)("100ms",(0,Pl.iF)({opacity:1}))])])]}});var aT=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function lT(e,t){if(1&e&&(Fl.j41(0,"p",9),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,e.dialogOptions.bodyText)," ")}}function cT(e,t){if(1&e&&(Fl.j41(0,"bit-callout",10),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.Y8G("type",e.dialogOptions.calloutOptions.type),Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,2,e.dialogOptions.calloutOptions.text)," ")}}function uT(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,lT,3,3,"p",7)(2,cT,3,4,"bit-callout",8),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("ngIf",e.dialogOptions.bodyText),Fl.R7$(),Fl.Y8G("ngIf",e.dialogOptions.calloutOptions)}}function dT(e,t){1&e&&(Fl.qex(0),Fl.j41(1,"p",9),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.bVm()),2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"verificationRequiredForActionSetPinToContinue")," "))}function hT(e,t){1&e&&(Fl.j41(0,"button",13),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"submit")," "))}function pT(e,t){if(1&e&&(Fl.j41(0,"button",14),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(3);Fl.Y8G("buttonType",e.dialogOptions.confirmButtonOptions.type),Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,2,e.dialogOptions.confirmButtonOptions.text)," ")}}function vT(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,hT,3,3,"button",11)(2,pT,3,4,"button",12),Fl.bVm()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("ngIf",!e.dialogOptions.confirmButtonOptions),Fl.R7$(),Fl.Y8G("ngIf",e.dialogOptions.confirmButtonOptions)}}function fT(e,t){1&e&&(Fl.qex(0),Fl.j41(1,"button",13),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.bVm()),2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"setPin")," "))}function mT(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,vT,3,2,"ng-container",3)(2,fT,4,3,"ng-container",3),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("ngIf",e.activeClientVerificationOption!==e.ActiveClientVerificationOption.None),Fl.R7$(),Fl.Y8G("ngIf",e.activeClientVerificationOption===e.ActiveClientVerificationOption.None)}}class gT{get secret(){return this.verificationForm.controls.secret}constructor(e,t,i,n,r,s,o){this.dialogOptions=e,this.dialogRef=t,this.formBuilder=i,this.userVerificationService=n,this.platformUtilsService=r,this.i18nService=s,this.toastService=o,this.verificationForm=this.formBuilder.group({secret:this.formBuilder.control(null)}),this.invalidSecret=!1,this.ActiveClientVerificationOption=$C,this.submit=()=>aT(this,void 0,void 0,function*(){if(this.activeClientVerificationOption!==$C.None){if(this.verificationForm.markAllAsTouched(),!this.verificationForm.invalid)try{if("object"==typeof this.dialogOptions.verificationType&&"custom"===this.dialogOptions.verificationType.type){const e=yield this.dialogOptions.verificationType.verificationFn(this.secret.value);return void this.close({userAction:"confirm",verificationSuccess:e})}(yield this.userVerificationService.verifyUser(this.secret.value))?(this.invalidSecret=!1,this.close({userAction:"confirm",verificationSuccess:!0,noAvailableClientVerificationMethods:!1})):(this.invalidSecret=!0,this.activeClientVerificationOption===$C.Pin?this.toastService.showToast({variant:"error",title:this.i18nService.t("error"),message:this.i18nService.t("invalidPin")}):this.toastService.showToast({variant:"error",title:null,message:this.i18nService.t("unexpectedError")}))}catch(e){return this.invalidSecret=!0,void this.toastService.showToast({variant:"error",title:this.i18nService.t("error"),message:this.i18nService.t("userVerificationFailed")})}}else this.close({userAction:"confirm",verificationSuccess:!1,noAvailableClientVerificationMethods:!0})})}static open(e,t){return aT(this,void 0,void 0,function*(){const i=e.open(gT,{data:t}),n=yield(0,bo._)(i.closed);return"string"==typeof n||void 0===n?{userAction:"cancel",verificationSuccess:!1}:n})}handleActiveClientVerificationOptionChange(e){this.activeClientVerificationOption=e}handleBiometricsVerificationResultChange(e){e&&this.close({userAction:"confirm",verificationSuccess:!0,noAvailableClientVerificationMethods:!1})}cancel(){this.close({userAction:"cancel",verificationSuccess:!1})}close(e){this.dialogRef.close(e)}}gT.ɵfac=function(e){return new(e||gT)(Fl.rXU(pd.Qs),Fl.rXU(nh),Fl.rXU(Il.ok),Fl.rXU(NC),Fl.rXU(Hb),Fl.rXU(Ul),Fl.rXU(qb))},gT.ɵcmp=Fl.VBU({type:gT,selectors:[["ng-component"]],decls:15,vars:15,consts:[[3,"formGroup","bitSubmit"],["bitDialogTitle",""],["bitDialogContent",""],[4,"ngIf"],["formControlName","secret",3,"invalidSecretChange","activeClientVerificationOptionChange","biometricsVerificationResultChange","invalidSecret","verificationType"],["bitDialogFooter",""],["type","button","bitButton","","bitFormButton","","buttonType","secondary",3,"click"],["bitTypography","body1",4,"ngIf"],[3,"type",4,"ngIf"],["bitTypography","body1"],[3,"type"],["type","submit","bitButton","","bitFormButton","","buttonType","primary",4,"ngIf"],["type","submit","bitButton","","bitFormButton","",3,"buttonType",4,"ngIf"],["type","submit","bitButton","","bitFormButton","","buttonType","primary"],["type","submit","bitButton","","bitFormButton","",3,"buttonType"]],template:function(e,t){1&e&&(Fl.j41(0,"form",0)(1,"bit-dialog")(2,"span",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.nI1(5,"i18n"),Fl.k0s(),Fl.qex(6,2),Fl.DNE(7,uT,3,2,"ng-container",3)(8,dT,4,3,"ng-container",3),Fl.j41(9,"app-user-verification-form-input",4),Fl.mxI("invalidSecretChange",function(e){return Fl.DH7(t.invalidSecret,e)||(t.invalidSecret=e),e}),Fl.bIt("activeClientVerificationOptionChange",function(e){return t.handleActiveClientVerificationOptionChange(e)})("biometricsVerificationResultChange",function(e){return t.handleBiometricsVerificationResultChange(e)}),Fl.k0s(),Fl.bVm(),Fl.qex(10,5),Fl.DNE(11,mT,3,2,"ng-container",3),Fl.j41(12,"button",6),Fl.bIt("click",function(){return t.cancel()}),Fl.EFF(13),Fl.nI1(14,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()()),2&e&&(Fl.Y8G("formGroup",t.verificationForm)("bitSubmit",t.submit),Fl.R7$(3),Fl.SpI(" ",t.dialogOptions.title?Fl.bMT(4,9,t.dialogOptions.title):Fl.bMT(5,11,"verificationRequired")),Fl.R7$(4),Fl.Y8G("ngIf","client"!==t.dialogOptions.verificationType||"client"===t.dialogOptions.verificationType&&t.activeClientVerificationOption!==t.ActiveClientVerificationOption.None),Fl.R7$(),Fl.Y8G("ngIf","client"===t.dialogOptions.verificationType&&t.activeClientVerificationOption===t.ActiveClientVerificationOption.None),Fl.R7$(),Fl.R50("invalidSecret",t.invalidSecret),Fl.Y8G("verificationType","client"===t.dialogOptions.verificationType?"client":"server"),Fl.R7$(2),Fl.Y8G("ngIf","client"!==t.dialogOptions.verificationType||"client"===t.dialogOptions.verificationType&&t.activeClientVerificationOption!==t.ActiveClientVerificationOption.Biometrics),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(14,13,"cancel")," "))},dependencies:[kl.MD,kl.bT,Il.X1,Il.qT,Il.BC,Il.cb,Il.j4,Il.JD,sf,id,td,Fh,Ph,pc,jd,Md,oT,dd,ud,rf],encapsulation:2});class yT{}class bT{}class wT{}var ST,kT=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function IT(e,t){1&e&&(Fl.j41(0,"div"),Fl.nrm(1,"i",2),Fl.nI1(2,"i18n"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.Y8G("title",Fl.mNQ(Fl.bMT(2,3,"loading"))),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(4,5,"loading")," "))}function CT(e,t){1&e&&(Fl.j41(0,"div")(1,"bit-form-field")(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.nrm(5,"input",3),Fl.k0s(),Fl.j41(6,"div",4)(7,"button",5),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s()()()),2&e&&(Fl.R7$(3),Fl.JRh(Fl.bMT(4,3,"ssoIdentifier")),Fl.R7$(4),Fl.Y8G("block",!0),Fl.R7$(),Fl.SpI(" ",Fl.bMT(9,5,"continue")," "))}class TT{get identifierFormControl(){return this.formGroup.controls.identifier}constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,v,f,m,g,y,b){this.ssoLoginService=e,this.loginStrategyService=t,this.router=i,this.i18nService=n,this.route=r,this.orgDomainApiService=s,this.validationService=o,this.platformUtilsService=a,this.apiService=l,this.cryptoFunctionService=c,this.environmentService=u,this.passwordGenerationService=d,this.logService=h,this.userDecryptionOptionsService=p,this.masterPasswordService=v,this.accountService=f,this.toastService=m,this.ssoComponentService=g,this.loginSuccessHandlerService=y,this.keyConnectorService=b,this.formGroup=new Il.gE({identifier:new Il.MJ(null,[Il.k0.required])}),this.loggingIn=!1,this.submit=()=>kT(this,void 0,void 0,function*(){var e,t,i;if(this.formGroup.invalid)return;const n=null!=(yield(0,bo._)(this.route.queryParams)).identifier;this.identifier=null!==(e=this.identifierFormControl.value)&&void 0!==e?e:"",yield this.ssoLoginService.setOrganizationSsoIdentifier(this.identifier),null===(i=(t=this.ssoComponentService).setDocumentCookies)||void 0===i||i.call(t);try{yield this.submitSso()}catch(e){n?yield this.router.navigate(["/login"]):this.validationService.showError(e)}}),u.environment$.pipe((0,xl.pQ)()).subscribe(e=>{this.redirectUri=e.getWebVaultUrl()+"/sso-connector.html"});const w=this.platformUtilsService.getClientType();this.isValidSsoClientType(w)&&(this.clientId=w)}ngOnInit(){return kT(this,void 0,void 0,function*(){var e;const t=yield(0,bo._)(this.route.queryParams);if(this.email=null!==(e=t.email)&&void 0!==e?e:yield this.ssoLoginService.getSsoEmail(),this.userCompletedSsoAuthentication(t))yield this.handleTokenRequestForAuthenticatedUser(t);else{if(this.hasParametersFromOtherClientRedirect(t)&&this.initializeFromRedirectFromOtherClient(t),null!=t.identifier)return this.identifierFormControl.setValue(t.identifier),this.loggingIn=!0,void(yield this.submit());yield this.initializeIdentifierFromEmailOrStorage()}})}initializeFromRedirectFromOtherClient(e){var t,i,n,r;this.redirectUri=null!==(t=e.redirectUri)&&void 0!==t?t:"",this.state=null!==(i=e.state)&&void 0!==i?i:"",this.codeChallenge=null!==(n=e.codeChallenge)&&void 0!==n?n:"";const s=null!==(r=e.clientId)&&void 0!==r?r:"";if(!this.isValidSsoClientType(s))throw new Error(`Invalid SSO client type: ${e.clientId}`);this.clientId=s}isValidSsoClientType(e){return[Da.Web,Da.Browser,Da.Desktop,Da.Cli].includes(e)}hasParametersFromOtherClientRedirect(e){return null!=e.clientId&&null!=e.redirectUri&&null!=e.state&&null!=e.codeChallenge}handleTokenRequestForAuthenticatedUser(e){return kT(this,void 0,void 0,function*(){var t,i;const n=yield this.ssoLoginService.getCodeVerifier(),r=yield this.ssoLoginService.getSsoState();if(yield this.ssoLoginService.setCodeVerifier(""),yield this.ssoLoginService.setSsoState(""),null!=e.redirectUri&&(this.redirectUri=e.redirectUri),null!=e.code&&null!=n&&null!=r&&this.verifyStateMatches(r,null!==(t=e.state)&&void 0!==t?t:"")){const t=this.getOrgIdentifierFromState(null!==(i=e.state)&&void 0!==i?i:"");yield this.logIn(e.code,n,t)}})}userCompletedSsoAuthentication(e){return null!=e.code&&null!=e.state}handleGetClaimedDomainByEmailError(e){if(e instanceof iS){const t=e;if(t.statusCode===Ma.NotFound)return;this.validationService.showError(t)}}submitSso(e,t){return kT(this,void 0,void 0,function*(){if(null==this.identifier||""===this.identifier)return void this.toastService.showToast({variant:"error",title:this.i18nService.t("ssoValidationFailed"),message:this.i18nService.t("ssoIdentifierRequired")});if(null==this.clientId)throw new Error("Client ID is required");this.initiateSsoFormPromise=this.apiService.preValidateSso(this.identifier);const i=yield this.initiateSsoFormPromise,n=yield this.buildAuthorizeUrl(e,t,i.token);this.platformUtilsService.launchUri(n,{sameWindow:!0})})}buildAuthorizeUrl(e,t,i){return kT(this,void 0,void 0,function*(){var n,r;let s=this.codeChallenge,o=this.state;const a={type:"password",length:64,uppercase:!0,lowercase:!0,numbers:!0,special:!1};if(null==s){const e=yield this.passwordGenerationService.generatePassword(a),t=yield this.cryptoFunctionService.hash(e,"sha256");s=bd.fromBufferToUrlB64(t),yield this.ssoLoginService.setCodeVerifier(e)}null==o&&(o=yield this.passwordGenerationService.generatePassword(a)),e&&(o+=`_returnUri='${e}'`),o+=`_identifier=${this.identifier}`,yield this.ssoLoginService.setSsoState(o);let l=(yield(0,bo._)(this.environmentService.environment$)).getIdentityUrl()+"/connect/authorize?client_id="+this.clientId+"&redirect_uri="+encodeURIComponent(null!==(n=this.redirectUri)&&void 0!==n?n:"")+"&response_type=code&scope=api offline_access&state="+o+"&code_challenge="+s+"&code_challenge_method=S256&response_mode=query&domain_hint="+encodeURIComponent(null!==(r=this.identifier)&&void 0!==r?r:"")+"&ssoToken="+encodeURIComponent(null!=i?i:"");if(t){const e=yield this.apiService.getSsoUserIdentifier();l+=`&user_identifier=${encodeURIComponent(e)}`}return l})}logIn(e,t,i){return kT(this,void 0,void 0,function*(){var n,r;this.loggingIn=!0;try{const s=null!==(n=this.redirectUri)&&void 0!==n?n:"",o=new zw(e,t,s,i,null!==(r=this.email)&&void 0!==r?r:void 0);this.formPromise=this.loginStrategyService.logIn(o);const a=yield this.formPromise;if(a.requiresTwoFactor)return yield this.handleTwoFactorRequired(i);if(yield this.loginSuccessHandlerService.run(a.userId,null),yield this.ssoLoginService.setActiveUserOrganizationSsoIdentifier(i,a.userId),null!=(yield(0,bo._)(this.keyConnectorService.requiresDomainConfirmation$(a.userId))))return void(yield this.router.navigate(["confirm-key-connector-domain"]));const l=yield(0,bo._)(this.userDecryptionOptionsService.userDecryptionOptionsById$(a.userId));if(!!l.trustedDeviceOption&&(yield this.isTrustedDeviceEncEnabled(l.trustedDeviceOption)))return yield this.handleTrustedDeviceEncryptionEnabled(l);return!l.hasMasterPassword&&void 0===l.keyConnectorOption?yield this.handleChangePasswordRequired(i):yield this.handleSuccessfulLogin()}catch(e){yield this.handleLoginError(e)}})}isTrustedDeviceEncEnabled(e){return kT(this,void 0,void 0,function*(){return void 0!==e})}handleTwoFactorRequired(e){return kT(this,void 0,void 0,function*(){yield this.router.navigate(["2fa"],{queryParams:{identifier:e,sso:"true"}})})}handleTrustedDeviceEncryptionEnabled(e){return kT(this,void 0,void 0,function*(){var t,i,n,r;const s=null===(t=yield(0,bo._)(this.accountService.activeAccount$))||void 0===t?void 0:t.id;s&&(!e.hasMasterPassword&&(null===(i=e.trustedDeviceOption)||void 0===i?void 0:i.isTdeOffboarding)?yield this.masterPasswordService.setForceSetPasswordReason(aS.TdeOffboarding,s):!e.hasMasterPassword&&(null===(n=e.trustedDeviceOption)||void 0===n?void 0:n.hasManageResetPasswordPermission)&&(yield this.masterPasswordService.setForceSetPasswordReason(aS.TdeUserWithoutPasswordHasPasswordResetPermission,s)),(null===(r=this.ssoComponentService)||void 0===r?void 0:r.closeWindow)?yield this.ssoComponentService.closeWindow():yield this.router.navigate(["login-initiated"]))})}handleChangePasswordRequired(e){return kT(this,void 0,void 0,function*(){yield this.router.navigate(["set-initial-password"],{queryParams:{identifier:e}})})}handleSuccessfulLogin(){return kT(this,void 0,void 0,function*(){yield this.router.navigate(["lock"])})}handleLoginError(e){return kT(this,void 0,void 0,function*(){this.logService.error(e),e instanceof Error&&"Key Connector error"===e.message&&this.toastService.showToast({variant:"error",title:"",message:this.i18nService.t("ssoKeyConnectorError")})})}getOrgIdentifierFromState(e){if(null==e)return"";const t=e.split("_identifier=");return t.length>1?t[1]:""}verifyStateMatches(e,t){if(null==e)return!1;if(null==t)return!1;const i=e.split("_identifier="),n=t.split("_identifier=");return i[0]===n[0]}initializeIdentifierFromEmailOrStorage(){return kT(this,void 0,void 0,function*(){if(this.email){this.loggingIn=!0;try{const e=yield this.orgDomainApiService.getVerifiedOrgDomainsByEmail(this.email);if(e.data.length>0)return this.identifierFormControl.setValue(e.data[0].organizationIdentifier),void(yield this.submit())}catch(e){this.handleGetClaimedDomainByEmailError(e)}this.loggingIn=!1}const e=yield this.ssoLoginService.getOrganizationSsoIdentifier();null!=e&&this.identifierFormControl.setValue(e)})}}TT.ɵfac=function(e){return new(e||TT)(Fl.rXU(xk),Fl.rXU(Ew),Fl.rXU(Fd.Ix),Fl.rXU(Ul),Fl.rXU(Fd.nX),Fl.rXU(yT),Fl.rXU(Ud),Fl.rXU(Hb),Fl.rXU(eI),Fl.rXU(FI),Fl.rXU(mk),Fl.rXU(gf),Fl.rXU(Za),Fl.rXU($w),Fl.rXU(Yb),Fl.rXU(Zk),Fl.rXU(qb),Fl.rXU(bT),Fl.rXU(Mw),Fl.rXU(wT))},TT.ɵcmp=Fl.VBU({type:TT,selectors:[["ng-component"]],decls:3,vars:4,consts:[[1,"tw-container",3,"formGroup","bitSubmit"],[4,"ngIf"],["aria-hidden","true",1,"bwi","bwi-spinner","bwi-spin",3,"title"],["bitInput","","type","text","formControlName","identifier","appAutofocus",""],[1,"tw-flex","tw-gap-2"],["type","submit","bitButton","","bitFormButton","","buttonType","primary",3,"block"]],template:function(e,t){1&e&&(Fl.j41(0,"form",0),Fl.DNE(1,IT,5,7,"div",1)(2,CT,10,7,"div",1),Fl.k0s()),2&e&&(Fl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),Fl.R7$(),Fl.Y8G("ngIf",t.loggingIn),Fl.R7$(),Fl.Y8G("ngIf",!t.loggingIn))},dependencies:[pc,jd,Md,id,td,hd,kl.MD,kl.bT,Gu,Ac,fu,ju,Ql,Hh,sf,wd,Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,Cw.iI,rf],encapsulation:2});class PT{}!function(e){e[e.DIRECT_LAUNCH=0]="DIRECT_LAUNCH",e[e.SINGLE_ACTION_POPOUT=1]="SINGLE_ACTION_POPOUT"}(ST||(ST={}));class FT{}class RT{shouldCheckForWebAuthnQueryParamResponse(){return!1}determineDuoLaunchAction(){return ST.DIRECT_LAUNCH}}var xT=i(88565);const AT=new vc("WINDOW"),DT=new vc("DOCUMENT"),ET=new vc("OBSERVABLE_MEMORY_STORAGE"),$T=new vc("OBSERVABLE_DISK_STORAGE"),OT=(new vc("OBSERVABLE_DISK_LOCAL_STORAGE"),new vc("MEMORY_STORAGE")),UT=new vc("SECURE_STORAGE"),MT=new vc("LOGOUT_CALLBACK"),NT=new vc("SUPPORTS_SECURE_STORAGE"),VT=new vc("LOCALES_DIRECTORY"),BT=new vc("SYSTEM_LANGUAGE"),jT=new vc("LOG_MAC_FAILURES"),GT=new vc("SYSTEM_THEME_OBSERVABLE"),LT=new vc("DEFAULT_VAULT_TIMEOUT"),zT=new vc("INTRAPROCESS_MESSAGING_SUBJECT"),_T=new vc("CLIENT_TYPE"),KT=new vc("REFRESH_ACCESS_TOKEN_ERROR_CALLBACK"),XT=new vc("ENV_ADDITIONAL_REGIONS"),qT=new vc("HTTP_OPERATIONS"),WT=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 10 80 66.67">
<path class="tw-fill-illustration-bg-secondary" d="M13.333 15a5 5 0 0 1 5-5H75a5 5 0 0 1 5 5v40a5 5 0 0 1-5 5H18.333a5 5 0 0 1-5-5V15Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M75 11.667H18.333A3.333 3.333 0 0 0 15 15v40a3.333 3.333 0 0 0 3.333 3.333H75A3.333 3.333 0 0 0 78.333 55V15A3.333 3.333 0 0 0 75 11.667ZM18.333 10a5 5 0 0 0-5 5v40a5 5 0 0 0 5 5H75a5 5 0 0 0 5-5V15a5 5 0 0 0-5-5H18.333Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M79.167 20h-65v-1.667h65V20Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" d="M76.667 15a1.667 1.667 0 1 1-3.334 0 1.667 1.667 0 0 1 3.334 0ZM71.667 15a1.667 1.667 0 1 1-3.334 0 1.667 1.667 0 0 1 3.334 0ZM66.667 15a1.667 1.667 0 1 1-3.334 0 1.667 1.667 0 0 1 3.334 0Z"/>
<path class="tw-fill-illustration-tertiary" d="M15 37.5a6.667 6.667 0 0 1 6.667-6.667H65a6.667 6.667 0 0 1 6.667 6.667v3.333A6.667 6.667 0 0 1 65 47.5H21.667A6.667 6.667 0 0 1 15 40.833V37.5Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M65 32.5H21.667a5 5 0 0 0-5 5v3.333a5 5 0 0 0 5 5H65a5 5 0 0 0 5-5V37.5a5 5 0 0 0-5-5Zm-43.333-1.667A6.667 6.667 0 0 0 15 37.5v3.333a6.667 6.667 0 0 0 6.667 6.667H65a6.667 6.667 0 0 0 6.667-6.667V37.5A6.667 6.667 0 0 0 65 30.833H21.667Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M24.167 40.834v-3.137l-2.333 4.665a1.667 1.667 0 0 0 2.332-1.528Zm-3.334-.197 2.333-4.665a1.667 1.667 0 0 0-2.332 1.528v3.137Zm5-3.137a3.333 3.333 0 0 0-6.666 0v3.334a3.333 3.333 0 0 0 6.666 0V37.5Zm6.667.197v3.137a1.667 1.667 0 0 1-2.332 1.528l2.332-4.665Zm-1-1.725-2.333 4.665V37.5a1.667 1.667 0 0 1 2.332-1.528Zm-.667-1.805a3.333 3.333 0 0 1 3.334 3.333v3.334a3.333 3.333 0 1 1-6.667 0V37.5a3.333 3.333 0 0 1 3.333-3.333Zm10 6.667v-3.137l-2.332 4.665a1.667 1.667 0 0 0 2.332-1.528Zm-3.333-.197 2.333-4.665A1.667 1.667 0 0 0 37.5 37.5v3.137Zm5-3.137a3.333 3.333 0 0 0-6.667 0v3.334a3.333 3.333 0 0 0 6.667 0V37.5Zm6.667.197v3.137a1.667 1.667 0 0 1-2.333 1.528l2.333-4.665Zm-1.001-1.725-2.333 4.665V37.5a1.667 1.667 0 0 1 2.333-1.528Zm-.666-1.805a3.333 3.333 0 0 1 3.333 3.333v3.334a3.333 3.333 0 0 1-6.666 0V37.5a3.333 3.333 0 0 1 3.333-3.333Zm10 6.667v-3.137l-2.332 4.665a1.667 1.667 0 0 0 2.333-1.528Zm-3.333-.197 2.332-4.665a1.667 1.667 0 0 0-2.333 1.528v3.137Zm5-3.137a3.333 3.333 0 1 0-6.667 0v3.334a3.333 3.333 0 0 0 6.667 0V37.5Zm6.666 3.334v-3.137l-2.332 4.665a1.667 1.667 0 0 0 2.332-1.528Zm-3.333-.197 2.333-4.665A1.667 1.667 0 0 0 62.5 37.5v3.137Zm5-3.137a3.333 3.333 0 0 0-6.667 0v3.334a3.333 3.333 0 0 0 6.667 0V37.5Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="M0 23.333a5 5 0 0 1 5-5h24.167a5 5 0 0 1 5 5v48.333a5 5 0 0 1-5 5H5a5 5 0 0 1-5-5V23.333Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M29.167 20H5a3.333 3.333 0 0 0-3.333 3.333v48.333A3.333 3.333 0 0 0 5 75h24.167a3.333 3.333 0 0 0 3.333-3.334V23.333A3.333 3.333 0 0 0 29.167 20ZM5 18.333a5 5 0 0 0-5 5v48.333a5 5 0 0 0 5 5h24.167a5 5 0 0 0 5-5V23.333a5 5 0 0 0-5-5H5Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M6.667 33.75a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Zm3.333 0a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0ZM12.083 35a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm11.667 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm-3.333 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm-3.334 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" fill-rule="evenodd" d="M6.667 33.75a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Zm3.333 0a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0ZM12.083 35a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm11.667 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm-3.333 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm-3.334 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M6.667 42.917a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Zm3.333 0a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Zm2.083 1.25a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm11.667 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm-3.333 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm-3.334 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" fill-rule="evenodd" d="M6.667 42.917a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Zm3.333 0a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Zm2.083 1.25a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm11.667 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm-3.333 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm-3.334 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M13.333 23.333c0-.46.373-.833.834-.833H20a.833.833 0 1 1 0 1.667h-5.833a.833.833 0 0 1-.834-.834Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" fill-rule="evenodd" d="M16.25 54.166a7.083 7.083 0 1 0 7.083 7.084 1.667 1.667 0 1 1 3.334 0c0 5.753-4.664 10.416-10.417 10.416S5.833 67.003 5.833 61.25s4.664-10.417 10.417-10.417a1.667 1.667 0 1 1 0 3.333Z" clip-rule="evenodd"/>
</svg>
`,YT=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="3.33 0.46 73.33 76.8">
<path class="tw-fill-illustration-bg-primary" d="M3.333 32.89a5 5 0 0 1 1.745-3.796L37.287 1.46a4.167 4.167 0 0 1 5.426 0l32.21 27.635a5 5 0 0 1 1.744 3.794v41.035a3.333 3.333 0 0 1-3.334 3.334H6.667a3.333 3.333 0 0 1-3.334-3.334V32.89Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M75 73.924V32.89c0-.972-.425-1.896-1.163-2.53L41.627 2.725a2.5 2.5 0 0 0-3.255 0L6.162 30.36A3.333 3.333 0 0 0 5 32.89v41.035c0 .92.746 1.667 1.667 1.667h66.666c.92 0 1.667-.746 1.667-1.667ZM5.078 29.094a5 5 0 0 0-1.745 3.795v41.035a3.333 3.333 0 0 0 3.334 3.334h66.666a3.333 3.333 0 0 0 3.334-3.334V32.89a5 5 0 0 0-1.745-3.795L42.713 1.46a4.167 4.167 0 0 0-5.426 0L5.077 29.095Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" d="M5.793 32.464a2.5 2.5 0 0 1-.113-3.886L37.287 1.46a4.167 4.167 0 0 1 5.426 0L74.32 28.578a2.5 2.5 0 0 1-.114 3.886L42.02 56.97a3.333 3.333 0 0 1-4.038 0L5.793 32.464Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="m41.01 55.644 32.187-24.506a.833.833 0 0 0 .038-1.295L41.628 2.725a2.5 2.5 0 0 0-3.256 0L6.765 29.843a.833.833 0 0 0 .038 1.295L38.99 55.644a1.667 1.667 0 0 0 2.02 0ZM5.68 28.578a2.5 2.5 0 0 0 .113 3.886L37.981 56.97a3.333 3.333 0 0 0 4.038 0l32.187-24.506a2.5 2.5 0 0 0 .114-3.886L42.713 1.46a4.167 4.167 0 0 0-5.426 0L5.68 28.578Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M41.98 54.761a3.333 3.333 0 0 1-3.96 0L5.496 30.754a.833.833 0 1 0-.99 1.341l32.526 24.007a5 5 0 0 0 5.938 0l32.526-24.007a.833.833 0 0 0-.99-1.341L41.98 54.761Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M12.5 9.758h55V38.09L40.999 57.766a1.667 1.667 0 0 1-1.994-.004L12.5 37.882V9.759Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M65.833 11.425H14.167v25.624l25.838 19.38 25.828-19.176V11.425ZM67.5 38.09 40.999 57.766a1.667 1.667 0 0 1-1.994-.004L12.5 37.882V9.759h55V38.09Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="m40 49.758 18.333 10.416L40 70.591 21.667 60.175 40 49.758Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M42.02 51.51a3.333 3.333 0 0 0-4.04 0L5.505 76.254a.833.833 0 1 1-1.01-1.325L36.97 50.185a5 5 0 0 1 6.06 0l-.494.648.494-.648 32.475 24.743a.833.833 0 0 1-1.01 1.325L42.02 51.511Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" d="M21.667 29.757a5.833 5.833 0 0 1 5.833-5.833h25a5.833 5.833 0 0 1 0 11.666h-25a5.833 5.833 0 0 1-5.833-5.833Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M52.5 25.59h-25a4.167 4.167 0 0 0 0 8.334h25a4.167 4.167 0 1 0 0-8.334Zm-25-1.666a5.833 5.833 0 1 0 0 11.666h25a5.833 5.833 0 0 0 0-11.666h-25Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M27.5 31.424a1.667 1.667 0 1 0 0-3.333 1.667 1.667 0 0 0 0 3.333Zm5 0a1.667 1.667 0 1 0 0-3.333 1.667 1.667 0 0 0 0 3.333Zm6.667-1.666a1.667 1.667 0 1 1-3.334 0 1.667 1.667 0 0 1 3.334 0Zm3.333 1.666a1.667 1.667 0 1 0 0-3.333 1.667 1.667 0 0 0 0 3.333Zm6.667-1.666a1.667 1.667 0 1 1-3.334 0 1.667 1.667 0 0 1 3.334 0Zm3.333 1.666a1.667 1.667 0 1 0 0-3.333 1.667 1.667 0 0 0 0 3.333Z" clip-rule="evenodd"/>
</svg>
`,HT=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 120 40">
<g clip-path="url(#two-factor-auth-duo-clip)">
<path fill="#7BCD54" d="M19.359 39.412H0V20.97h38.694c-.505 10.27-8.968 18.44-19.335 18.44Z" />
<path fill="#63C43F"
d="M19.359.588H0V19.03h38.694C38.188 8.76 29.726.59 19.358.59ZM100.666.588c-10.367 0-18.83 8.172-19.335 18.441H120C119.496 8.76 111.033.59 100.666.59Z" />
<path fill="#7BCD54"
d="M100.666 39.412c-10.367 0-18.83-8.171-19.335-18.441H120c-.504 10.27-8.967 18.44-19.334 18.44Z" />
<path fill="#63C43F" d="M40.653.588V20c0 10.395 8.15 18.882 18.391 19.388V.588h-18.39Z" />
<path fill="#7BCD54" d="M79.37 39.412H60.98V.588h18.39v38.824Z" />
</g>
<defs>
<clipPath id="two-factor-auth-duo-clip">
<path class="tw-fill-text-alt2" d="M0 .588h120v38.824H0z" />
</clipPath>
</defs>
</svg>
`,JT=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="3.33 10 71.27 66.67">
<path class="tw-fill-illustration-bg-primary" d="M19.6 14.8a4.8 4.8 0 0 1 4.8-4.8h45.4a4.8 4.8 0 0 1 4.8 4.8v32.067a4.8 4.8 0 0 1-4.8 4.8H24.4a4.8 4.8 0 0 1-4.8-4.8V14.8Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M69.8 11.6H24.4a3.2 3.2 0 0 0-3.2 3.2v32.067a3.2 3.2 0 0 0 3.2 3.2h45.4a3.2 3.2 0 0 0 3.2-3.2V14.8a3.2 3.2 0 0 0-3.2-3.2ZM24.4 10a4.8 4.8 0 0 0-4.8 4.8v32.067a4.8 4.8 0 0 0 4.8 4.8h45.4a4.8 4.8 0 0 0 4.8-4.8V14.8a4.8 4.8 0 0 0-4.8-4.8H24.4Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M73.767 19.966H20.434v-1.6h53.333v1.6Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" d="M71.267 15a1.667 1.667 0 1 1-3.333 0 1.667 1.667 0 0 1 3.333 0ZM66.267 15a1.667 1.667 0 1 1-3.333 0 1.667 1.667 0 0 1 3.333 0ZM61.267 15a1.667 1.667 0 1 1-3.333 0 1.667 1.667 0 0 1 3.333 0Z"/>
<path class="tw-fill-illustration-bg-secondary" d="M67.2 50.4c0 7.29-5.91 13.2-13.2 13.2-7.29 0-13.2-5.91-13.2-13.2 0-7.29 5.91-13.2 13.2-13.2 7.29 0 13.2 5.91 13.2 13.2Z"/>
<path class="tw-fill-illustration-tertiary" d="M46.235 47.977a2.236 2.236 0 0 1 2.236-2.236h11.057a2.236 2.236 0 0 1 2.236 2.236v7.952a2.236 2.236 0 0 1-2.236 2.236H48.471a2.236 2.236 0 0 1-2.236-2.236v-7.952Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M59.528 47.232H48.471a.745.745 0 0 0-.745.745v7.952c0 .411.334.745.745.745h11.057a.745.745 0 0 0 .746-.745v-7.952a.745.745 0 0 0-.746-.745Zm-11.057-1.49a2.236 2.236 0 0 0-2.236 2.235v7.952a2.236 2.236 0 0 0 2.236 2.236h11.057a2.236 2.236 0 0 0 2.236-2.236v-7.952a2.236 2.236 0 0 0-2.236-2.236H48.471Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" d="M53.223 50.4a.776.776 0 1 1 1.553 0v3.105a.776.776 0 1 1-1.553 0V50.4Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M50.148 44.965a3.851 3.851 0 0 1 7.703 0v.776h-1.49v-.776a2.36 2.36 0 1 0-4.722 0v.776h-1.49v-.776Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" d="M7.5 25.767a1.6 1.6 0 0 1 1.6-1.6h12.633a1.6 1.6 0 0 1 1.6 1.6v12.567H7.5V25.767Z"/>
<path class="tw-fill-illustration-tertiary" d="M10 26.667h2.5v9.167H10v-9.167ZM14.167 28.333h2.5v7.5h-2.5v-7.5ZM18.333 26.667h2.5v9.167h-2.5v-9.167Z"/>
<path class="tw-fill-illustration-bg-secondary" fill-rule="evenodd" d="M6.533 36.667a3.2 3.2 0 0 0-3.2 3.2v33.6a3.2 3.2 0 0 0 3.2 3.2H24.3a3.2 3.2 0 0 0 3.2-3.2v-33.6a3.2 3.2 0 0 0-3.2-3.2H6.533Zm8.884 30a2.083 2.083 0 1 1 0 4.167 2.083 2.083 0 0 1 0-4.167Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M6.533 38.267a1.6 1.6 0 0 0-1.6 1.6v33.6a1.6 1.6 0 0 0 1.6 1.6H24.3a1.6 1.6 0 0 0 1.6-1.6v-33.6a1.6 1.6 0 0 0-1.6-1.6H6.533Zm8.884 26.8a3.683 3.683 0 1 1 0 7.367 3.683 3.683 0 0 1 0-7.367Zm-12.084-25.2a3.2 3.2 0 0 1 3.2-3.2H24.3a3.2 3.2 0 0 1 3.2 3.2v33.6a3.2 3.2 0 0 1-3.2 3.2H6.533a3.2 3.2 0 0 1-3.2-3.2v-33.6ZM17.5 68.75a2.083 2.083 0 1 0-4.167 0 2.083 2.083 0 0 0 4.167 0Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" fill-rule="evenodd" d="M15.417 60.066a6.317 6.317 0 1 0 0-12.633 6.317 6.317 0 0 0 0 12.633Zm0 1.6a7.917 7.917 0 1 0 0-15.833 7.917 7.917 0 0 0 0 15.833Z" clip-rule="evenodd"/>
</svg>
`,ZT=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="3.33 3.33 76.49 75.83">
<path class="tw-fill-illustration-bg-primary" d="M3.333 8.334a5 5 0 0 1 5-5H35a5 5 0 0 1 5 5v56.667a5 5 0 0 1-5 5H8.333a5 5 0 0 1-5-5V8.334Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M35 5H8.333A3.333 3.333 0 0 0 5 8.335v56.667a3.333 3.333 0 0 0 3.333 3.333H35a3.333 3.333 0 0 0 3.333-3.333V8.334A3.333 3.333 0 0 0 35 5.001ZM8.333 3.335a5 5 0 0 0-5 5v56.667a5 5 0 0 0 5 5H35a5 5 0 0 0 5-5V8.334a5 5 0 0 0-5-5H8.333Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M18.333 9.167c0-.46.373-.833.834-.833h5a.833.833 0 0 1 0 1.667h-5a.833.833 0 0 1-.834-.834Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" d="M36.667 38.333c0 10.126-6.716 18.334-15 18.334-8.285 0-15-8.208-15-18.334 0-10.125 6.715-18.333 15-18.333 8.284 0 15 8.208 15 18.333Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M21.667 55C28.733 55 35 47.866 35 38.333c0-9.533-6.267-16.666-13.333-16.666-7.067 0-13.334 7.133-13.334 16.666C8.333 47.866 14.6 55 21.667 55Zm0 1.667c8.284 0 15-8.208 15-18.334 0-10.125-6.716-18.333-15-18.333-8.285 0-15 8.208-15 18.333 0 10.126 6.715 18.334 15 18.334Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M68.333 35c0 6.444-5.223 11.667-11.666 11.667C50.223 46.667 45 41.444 45 35.001c0-6.444 5.223-11.667 11.667-11.667 6.443 0 11.666 5.223 11.666 11.667Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M56.667 45c5.523 0 10-4.477 10-10 0-5.522-4.477-10-10-10s-10 4.478-10 10c0 5.523 4.477 10 10 10Zm0 1.667c6.443 0 11.666-5.223 11.666-11.666 0-6.444-5.223-11.667-11.666-11.667C50.223 23.334 45 28.557 45 35.001c0 6.443 5.223 11.666 11.667 11.666Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" fill-rule="evenodd" d="M78.255 59.98a22.918 22.918 0 0 1 1.559 5.854H41.667v-8.333h-4.549a22.916 22.916 0 0 1 41.137 2.48Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M43.333 55.834v8.333h34.5a21.238 21.238 0 0 0-5.724-10.442 21.25 21.25 0 0 0-31.9 2.109h3.124Zm-5.18 0c-.368.54-.714 1.096-1.035 1.667h4.549v8.333h38.147a22.875 22.875 0 0 0-1.558-5.853 22.915 22.915 0 0 0-40.102-4.147Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" fill-rule="evenodd" d="M39.167 79.167c5.272 0 9.829-3.06 11.993-7.5h5.65c.442 0 .866-.176 1.178-.489L60 69.168l1.91 1.91a.833.833 0 0 0 1.18 0l.66-.66.66.66a.833.833 0 0 0 1.18 0l1.91-1.91 2.012 2.011c.312.313.736.489 1.178.489h2.786c.442 0 .866-.176 1.179-.489l5.05-5.05a.417.417 0 0 0 0-.59l-5.05-5.05A1.667 1.667 0 0 0 73.476 60H51.16c-2.164-4.44-6.721-7.5-11.993-7.5-7.364 0-13.334 5.97-13.334 13.333 0 7.364 5.97 13.334 13.334 13.334Zm-5-10.834a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M50.118 70h6.692L60 66.81l2.5 2.5 1.25-1.25L65 69.31l2.5-2.5L70.69 70h2.786l4.167-4.167-4.167-4.166H50.118l-.457-.937a11.667 11.667 0 0 0-10.494-6.563c-6.444 0-11.667 5.223-11.667 11.666 0 6.444 5.223 11.667 11.667 11.667 4.61 0 8.6-2.674 10.494-6.563l.457-.937Zm29.587-3.872a.417.417 0 0 0 0-.59l-5.05-5.05A1.667 1.667 0 0 0 73.476 60H51.16c-2.164-4.44-6.721-7.5-11.993-7.5-7.364 0-13.334 5.97-13.334 13.333 0 7.364 5.97 13.334 13.334 13.334 5.272 0 9.829-3.06 11.993-7.5h5.65c.442 0 .866-.176 1.178-.489L60 69.168l1.91 1.91a.833.833 0 0 0 1.179.001l.661-.661.66.66.002.001a.833.833 0 0 0 1.177 0l1.911-1.911 2.012 2.011c.312.313.736.489 1.178.489h2.786c.442 0 .866-.176 1.179-.489l5.05-5.05Zm-41.372-.295a4.167 4.167 0 1 1-8.333 0 4.167 4.167 0 0 1 8.333 0Zm-1.666 0a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0ZM16.126 28.497a15.793 15.793 0 0 1 5.542-.996c1.95 0 3.818.352 5.541.996a.833.833 0 0 0 .584-1.56 17.462 17.462 0 0 0-6.125-1.103c-2.154 0-4.218.39-6.125 1.102a.833.833 0 1 0 .583 1.561Zm5.542 2.337a11.648 11.648 0 0 0-9.335 4.667.833.833 0 1 1-1.332-1 13.314 13.314 0 0 1 10.667-5.334c4.331 0 7.947 1.77 10.59 4.41a.833.833 0 1 1-1.179 1.18c-2.36-2.36-5.564-3.923-9.411-3.923Zm-.117 1.667c-5.377 0-9.63 4.555-9.26 9.92l.075 1.081c.097 1.4.428 2.772.98 4.061l.47 1.099a.833.833 0 1 0 1.532-.656l-.47-1.1a10.835 10.835 0 0 1-.85-3.519l-.074-1.08a7.615 7.615 0 1 1 15.212-.524v.718a.833.833 0 0 1-1.666 0v-.834a5.848 5.848 0 0 0-1.522-3.927c-1.054-1.146-2.637-1.906-4.728-1.906-2.173 0-3.575.99-4.397 2.254-.79 1.216-1.02 2.639-1.02 3.58 0 2.326.209 4.02.794 5.424.593 1.425 1.54 2.465 2.84 3.549a.833.833 0 1 0 1.067-1.28c-1.2-1-1.921-1.835-2.369-2.91-.457-1.097-.665-2.527-.665-4.784 0-.726.187-1.803.75-2.67.533-.82 1.423-1.496 3-1.496 1.659 0 2.785.589 3.501 1.368a4.181 4.181 0 0 1 1.082 2.798v.834a2.5 2.5 0 0 0 5 0v-.718a9.282 9.282 0 0 0-9.282-9.282Zm-.754 9.116c0-.42.347-.783.823-.783a.88.88 0 0 1 .88.88v1.364a4.68 4.68 0 0 0 1.872 3.743l.684.513a5 5 0 0 0 3 1h.277a.833.833 0 0 0 0-1.667h-.277a3.334 3.334 0 0 1-2-.666l-.684-.513a3.013 3.013 0 0 1-1.205-2.41v-1.364a2.547 2.547 0 0 0-2.547-2.547c-1.342 0-2.492 1.056-2.49 2.453.001.82.033 1.85.148 2.804.125 1.035.627 1.848 1.163 2.526.244.31.509.608.757.887l.066.074c.274.308.526.597.752.895.553.729.7 1.326.544 1.719a.833.833 0 0 0 1.547.619c.504-1.26-.137-2.52-.763-3.345-.27-.356-.562-.688-.834-.994l-.06-.069a18.78 18.78 0 0 1-.701-.819c-.456-.577-.745-1.1-.817-1.693a23.012 23.012 0 0 1-.135-2.607Z" clip-rule="evenodd"/>
</svg>
`;class QT{}const eP={[oS.Authenticator]:{type:oS.Authenticator,name:null,description:null,priority:1,sort:2,premium:!1},[oS.Yubikey]:{type:oS.Yubikey,name:null,description:null,priority:3,sort:4,premium:!0},[oS.Duo]:{type:oS.Duo,name:"Duo",description:null,priority:2,sort:5,premium:!0},[oS.OrganizationDuo]:{type:oS.OrganizationDuo,name:"Duo (Organization)",description:null,priority:10,sort:6,premium:!1},[oS.Email]:{type:oS.Email,name:null,description:null,priority:0,sort:1,premium:!1},[oS.WebAuthn]:{type:oS.WebAuthn,name:null,description:null,priority:4,sort:3,premium:!1}},tP=m.record(q,"providers",{deserializer:e=>e}),iP=new m(q,"selected",{deserializer:e=>e});class nP{}class rP extends tS{constructor(e){super(e),this.enabled=this.getResponseProperty("Enabled"),this.key=this.getResponseProperty("Key"),this.userVerificationToken=this.getResponseProperty("UserVerificationToken")}}class sP extends tS{constructor(e){super(e),this.enabled=this.getResponseProperty("Enabled"),this.host=this.getResponseProperty("Host"),this.clientSecret=this.getResponseProperty("ClientSecret"),this.clientId=this.getResponseProperty("ClientId")}}class oP extends tS{constructor(e){super(e),this.enabled=this.getResponseProperty("Enabled"),this.email=this.getResponseProperty("Email")}}class aP extends tS{constructor(e){super(e),this.enabled=this.getResponseProperty("Enabled"),this.type=this.getResponseProperty("Type")}}class lP extends tS{constructor(e){super(e),this.code=this.getResponseProperty("Code")}}class cP extends tS{constructor(e){super(e),this.enabled=this.getResponseProperty("Enabled");const t=this.getResponseProperty("Keys");this.keys=null==t?null:t.map(e=>new uP(e))}}class uP extends tS{constructor(e){super(e),this.name=this.getResponseProperty("Name"),this.id=this.getResponseProperty("Id"),this.migrated=this.getResponseProperty("Migrated")}}class dP extends tS{constructor(e){super(e),this.attestation=this.getResponseProperty("attestation"),this.authenticatorSelection=this.getResponseProperty("authenticatorSelection"),this.challenge=bd.fromUrlB64ToArray(this.getResponseProperty("challenge")),this.excludeCredentials=this.getResponseProperty("excludeCredentials").map(e=>(e.id=bd.fromUrlB64ToArray(e.id).buffer,e)),this.extensions=this.getResponseProperty("extensions"),this.pubKeyCredParams=this.getResponseProperty("pubKeyCredParams"),this.rp=this.getResponseProperty("rp"),this.timeout=this.getResponseProperty("timeout");const t=this.getResponseProperty("user");t.id=bd.fromUrlB64ToArray(t.id),this.user=t}}class hP extends tS{constructor(e){super(e),this.enabled=this.getResponseProperty("Enabled"),this.key1=this.getResponseProperty("Key1"),this.key2=this.getResponseProperty("Key2"),this.key3=this.getResponseProperty("Key3"),this.key4=this.getResponseProperty("Key4"),this.key5=this.getResponseProperty("Key5"),this.nfc=this.getResponseProperty("Nfc")}}var pP=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var vP=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class fP{constructor(){this.tokenFormControl=void 0,this.tokenChange=new Fl.bkB}onTokenChange(e){const t=e.target.value||"";this.tokenChange.emit({token:t})}}fP.ɵfac=function(e){return new(e||fP)},fP.ɵcmp=Fl.VBU({type:fP,selectors:[["app-two-factor-auth-authenticator"]],inputs:{tokenFormControl:"tokenFormControl"},outputs:{tokenChange:"tokenChange"},features:[Fl.Jv_([])],decls:6,vars:4,consts:[["bitInput","","type","text","appAutofocus","","appInputVerbatim","",3,"keyup","formControl"]],template:function(e,t){1&e&&(Fl.qex(0),Fl.j41(1,"bit-form-field")(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"input",0),Fl.bIt("keyup",function(e){return t.onTokenChange(e)}),Fl.k0s()(),Fl.bVm()),2&e&&(Fl.R7$(3),Fl.JRh(Fl.bMT(4,2,"verificationCode")),Fl.R7$(2),Fl.Y8G("formControl",t.tokenFormControl))},dependencies:[kl.MD,sf,wd,GI,Fh,id,Hh,tc,Il.X1,Il.me,Il.BC,Il.l_,Gu,Ac,fu,ju,pc,Il.YN,rf],encapsulation:2});class mP{}var gP=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class yP{constructor(e,t,i,n,r){this.i18nService=e,this.platformUtilsService=t,this.toastService=i,this.twoFactorAuthDuoComponentService=n,this.destroyRef=r,this.tokenEmitter=new Fl.bkB,this.duoFramelessUrl=void 0}ngOnInit(){return gP(this,void 0,void 0,function*(){this.twoFactorAuthDuoComponentService.listenForDuo2faResult$().pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.tokenEmitter.emit(e.token)}),this.duoFramelessUrl=this.providerData.AuthUrl})}launchDuoFrameless(e){return gP(this,void 0,void 0,function*(){var t,i;switch(e){case ST.DIRECT_LAUNCH:yield this.launchDuoFramelessDirectly();break;case ST.SINGLE_ACTION_POPOUT:yield null===(i=(t=this.twoFactorAuthDuoComponentService).openTwoFactorAuthDuoPopout)||void 0===i?void 0:i.call(t)}})}launchDuoFramelessDirectly(){return gP(this,void 0,void 0,function*(){null!==this.duoFramelessUrl&&void 0!==this.duoFramelessUrl?yield this.twoFactorAuthDuoComponentService.launchDuoFrameless(this.duoFramelessUrl):this.toastService.showToast({variant:"error",title:"",message:this.i18nService.t("duoHealthCheckResultsInNullAuthUrlError")})})}}yP.ɵfac=function(e){return new(e||yP)(Fl.rXU(Ul),Fl.rXU(Hb),Fl.rXU(qb),Fl.rXU(mP),Fl.rXU(a.abz))},yP.ɵcmp=Fl.VBU({type:yP,selectors:[["app-two-factor-auth-duo"]],inputs:{providerData:"providerData"},outputs:{tokenEmitter:"tokenEmitter"},features:[Fl.Jv_([])],decls:0,vars:0,template:function(e,t){},dependencies:[kl.MD,sf,Fh,id,Hh,tc,Il.X1,Gu,pc,Il.YN],encapsulation:2});class bP{authenticateWith(e){return this.masterPasswordHash=e.masterPasswordAuthenticationHash,this}}class wP extends bP{}class SP{constructor(){this.emailSent=!1}static fromJSON(e){return null==e?null:Object.assign(new SP,e)}}class kP{constructor(){this.viewCacheService=(0,a.WQX)(II),this.emailCache=this.viewCacheService.signal({key:"two-factor-auth-email-component-cache",initialValue:null,deserializer:SP.fromJSON})}cacheData(e){this.emailCache.set({emailSent:e.emailSent})}clearCachedData(){this.emailCache.set(null)}getCachedData(){return this.emailCache()}}kP.ɵfac=function(e){return new(e||kP)},kP.ɵprov=a.jDH({token:kP,factory:kP.ɵfac});class IP{onClick(e){e.preventDefault()}}IP.ɵfac=function(e){return new(e||IP)},IP.ɵdir=Fl.FsC({type:IP,selectors:[["","appStopClick",""]],hostBindings:function(e,t){1&e&&Fl.bIt("click",function(e){return t.onClick(e)})},standalone:!1});var CP=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class TP{constructor(e,t,i,n,r,s,o,a){this.i18nService=e,this.twoFactorService=t,this.loginStrategyService=i,this.platformUtilsService=n,this.logService=r,this.appIdService=s,this.toastService=o,this.cacheService=a,this.tokenFormControl=void 0,this.tokenChange=new Fl.bkB,this.twoFactorEmail=void 0,this.emailSent=!1}ngOnInit(){return CP(this,void 0,void 0,function*(){const e=this.cacheService.getCachedData();(null==e?void 0:e.emailSent)&&(this.emailSent=!0);const t=yield this.twoFactorService.getProviders();if(!t||0===t.size)throw new Error("User has no 2FA Providers");const i=t.get(oS.Email);if(!i)throw new Error("Unable to retrieve email 2FA provider data");this.twoFactorEmail=i.Email,this.emailSent||(yield this.sendEmail(!1))})}onTokenChange(e){const t=e.target.value||"";this.tokenChange.emit({token:t})}sendEmail(e){return CP(this,void 0,void 0,function*(){var t,i,n,r;if(void 0!==this.emailPromise)return;const s=yield this.loginStrategyService.getEmail();if(null!=s){try{const o=new wP;o.email=s,o.masterPasswordHash=null!==(t=yield this.loginStrategyService.getMasterPasswordHash())&&void 0!==t?t:"",o.ssoEmail2FaSessionToken=null!==(i=yield this.loginStrategyService.getSsoEmail2FaSessionToken())&&void 0!==i?i:"",o.deviceIdentifier=yield this.appIdService.getAppId(),o.authRequestAccessCode=null!==(n=yield this.loginStrategyService.getAccessCode())&&void 0!==n?n:"",o.authRequestId=null!==(r=yield this.loginStrategyService.getAuthRequestId())&&void 0!==r?r:"",this.emailPromise=this.twoFactorService.postTwoFactorEmail(o),yield this.emailPromise,this.emailSent=!0,this.cacheService.cacheData({emailSent:this.emailSent}),e&&this.toastService.showToast({variant:"success",title:"",message:this.i18nService.t("verificationCodeEmailSent",this.twoFactorEmail)})}catch(e){this.logService.error(e)}this.emailPromise=void 0}else this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("sessionTimeout")})})}}TP.ɵfac=function(e){return new(e||TP)(Fl.rXU(Ul),Fl.rXU(nP),Fl.rXU(Ew),Fl.rXU(Hb),Fl.rXU(Za),Fl.rXU(Tk),Fl.rXU(qb),Fl.rXU(kP))},TP.ɵcmp=Fl.VBU({type:TP,selectors:[["app-two-factor-auth-email"]],inputs:{tokenFormControl:"tokenFormControl"},outputs:{tokenChange:"tokenChange"},features:[Fl.Jv_([{provide:kP,useClass:kP}])],decls:9,vars:7,consts:[[1,"!tw-mb-0"],["bitInput","","type","text","appAutofocus","","appInputVerbatim","",3,"keyup","formControl"],[1,"tw-mb-4"],["bitTypography","helper","bitLink","","href","#","appStopClick","",1,"tw-text-main",3,"click"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-form-field",0)(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"input",1),Fl.bIt("keyup",function(e){return t.onTokenChange(e)}),Fl.k0s()(),Fl.j41(5,"div",2)(6,"a",3),Fl.bIt("click",function(){return t.sendEmail(!0)}),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s()()),2&e&&(Fl.R7$(2),Fl.JRh(Fl.bMT(3,3,"verificationCode")),Fl.R7$(2),Fl.Y8G("formControl",t.tokenFormControl),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(8,5,"resendCode")," "))},dependencies:[kl.MD,sf,wd,GI,IP,Fh,id,Hh,uw,tc,rc,Il.X1,Il.me,Il.BC,Il.l_,Gu,Ac,fu,ju,pc,Il.YN,rf],encapsulation:2});class PP{constructor(e,t,i,n,r,s,o,a){this.win=e,this.webVaultUrl=t,this.webAuthnNewTab=i,this.platformUtilsService=n,this.i18nService=r,this.successCallback=s,this.errorCallback=o,this.infoCallback=a,this.iframe=null,this.parseFunction=this.parseMessage.bind(this),this.connectorLink=e.document.createElement("a")}init(e){const t=new URLSearchParams({data:this.base64Encode(JSON.stringify(e)),parent:encodeURIComponent(this.win.document.location.href),btnText:encodeURIComponent(this.i18nService.t("readSecurityKey")),btnAwaitingInteractionText:encodeURIComponent(this.i18nService.t("awaitingSecurityKeyInteraction")),v:"1"});this.webAuthnNewTab?(t.append("locale",this.i18nService.translationLocale),this.platformUtilsService.launchUri(`${this.webVaultUrl}/webauthn-fallback-connector.html?${t}`)):(this.connectorLink.href=`${this.webVaultUrl}/webauthn-connector.html?${t}`,this.iframe=this.win.document.getElementById("webauthn_iframe"),this.iframe.allow="publickey-credentials-get "+new URL(this.webVaultUrl).origin,this.iframe.src=this.connectorLink.href,this.win.addEventListener("message",this.parseFunction,!1))}stop(){this.sendMessage("stop")}start(){this.sendMessage("start")}sendMessage(e){this.iframe&&this.iframe.src&&this.iframe.contentWindow&&this.iframe.contentWindow.postMessage(e,this.iframe.src)}base64Encode(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode("0x"+t)))}cleanup(){this.win.removeEventListener("message",this.parseFunction,!1)}parseMessage(e){if(!this.validMessage(e))return;const t=e.data.split("|");"success"===t[0]&&this.successCallback?this.successCallback(t[1]):"error"===t[0]&&this.errorCallback?this.errorCallback(t[1]):"info"===t[0]&&this.infoCallback&&this.infoCallback(t[1])}validMessage(e){return null!=e.origin&&""!==e.origin&&e.origin===this.connectorLink.origin&&null!=e.data&&"string"==typeof e.data&&(0===e.data.indexOf("success|")||0===e.data.indexOf("error|")||0===e.data.indexOf("info|"))}}class FP{}var RP=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const xP=e=>({"tw-hidden":e});function AP(e,t){1&e&&(Fl.j41(0,"div",5),Fl.nrm(1,"i",6),Fl.k0s())}function DP(e,t){if(1&e&&(Fl.j41(0,"div",2),Fl.DNE(1,AP,2,0,"div",3),Fl.nrm(2,"iframe",4),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("ngIf",!e.webAuthnReady),Fl.R7$(),Fl.Y8G("ngClass",Fl.eq3(2,xP,!e.webAuthnReady))}}function EP(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"button",7),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.authWebAuthn())}),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.bVm()}2&e&&(Fl.R7$(),Fl.Y8G("block",!0),Fl.R7$(),Fl.SpI(" ",Fl.bMT(3,2,"openInNewTab")," "))}class $P{constructor(e,t,i,n,r,s,o,a,l){this.i18nService=e,this.platformUtilsService=t,this.win=i,this.environmentService=n,this.twoFactorService=r,this.route=s,this.toastService=o,this.twoFactorAuthWebAuthnComponentService=a,this.logService=l,this.webAuthnResultEmitter=new Fl.bkB,this.webAuthnInNewTabEmitter=new Fl.bkB,this.webAuthnReady=!1,this.webAuthnNewTab=!1,this.webAuthnSupported=!1,this.webAuthnIframe=void 0,this.webAuthnSupported=this.platformUtilsService.supportsWebAuthn(i),this.webAuthnNewTab=this.twoFactorAuthWebAuthnComponentService.shouldOpenWebAuthnInNewTab()}ngOnInit(){return RP(this,void 0,void 0,function*(){this.webAuthnInNewTabEmitter.emit(this.webAuthnNewTab),this.webAuthnNewTab&&this.route.snapshot.paramMap.has("webAuthnResponse")?this.submitWebAuthnNewTabResponse():yield this.buildWebAuthnIFrame()})}submitWebAuthnNewTabResponse(){const e=this.route.snapshot.paramMap.get("webAuthnResponse"),t="true"===this.route.snapshot.paramMap.get("remember");null!=e&&this.webAuthnResultEmitter.emit({token:e,remember:t})}buildWebAuthnIFrame(){return RP(this,void 0,void 0,function*(){if(null!=this.win&&this.webAuthnSupported){const e=(yield(0,bo._)(this.environmentService.environment$)).getWebVaultUrl();this.webAuthnIframe=new PP(this.win,e,this.webAuthnNewTab,this.platformUtilsService,this.i18nService,e=>{this.webAuthnResultEmitter.emit({token:e})},e=>{this.logService.error("WebAuthn error: ",e),this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("webauthnCancelOrTimeout")})},e=>{"ready"===e&&(this.webAuthnReady=!0)}),this.webAuthnNewTab||setTimeout(()=>RP(this,void 0,void 0,function*(){yield this.authWebAuthn()}),500)}})}ngOnDestroy(){this.cleanupWebAuthnIframe()}authWebAuthn(){return RP(this,void 0,void 0,function*(){const e=yield this.twoFactorService.getProviders();if(null==e)return void this.logService.error("No 2FA providers found. Unable to authenticate with WebAuthn.");const t=null==e?void 0:e.get(oS.WebAuthn);this.webAuthnSupported&&null!=this.webAuthnIframe&&this.webAuthnIframe.init(t)})}cleanupWebAuthnIframe(){null!=this.webAuthnIframe&&(this.webAuthnIframe.stop(),this.webAuthnIframe.cleanup())}}$P.ɵfac=function(e){return new(e||$P)(Fl.rXU(Ul),Fl.rXU(Hb),Fl.rXU(AT),Fl.rXU(mk),Fl.rXU(nP),Fl.rXU(Fd.nX),Fl.rXU(qb),Fl.rXU(FP),Fl.rXU(Za))},$P.ɵcmp=Fl.VBU({type:$P,selectors:[["app-two-factor-auth-webauthn"]],outputs:{webAuthnResultEmitter:"webAuthnResultEmitter",webAuthnInNewTabEmitter:"webAuthnInNewTabEmitter"},features:[Fl.Jv_([])],decls:2,vars:2,consts:[["id","web-authn-frame","class","tw-mb-3",4,"ngIf"],[4,"ngIf"],["id","web-authn-frame",1,"tw-mb-3"],["class","tw-flex tw-items-center tw-justify-center",4,"ngIf"],["id","webauthn_iframe","sandbox","allow-scripts allow-same-origin",3,"ngClass"],[1,"tw-flex","tw-items-center","tw-justify-center"],["aria-hidden","true",1,"bwi","bwi-spinner","bwi-spin","bwi-3x"],["buttonType","primary","bitButton","","type","button","appStopClick","",1,"tw-mb-3",3,"click","block"]],template:function(e,t){1&e&&Fl.DNE(0,DP,3,4,"div",0)(1,EP,4,4,"ng-container",1),2&e&&(Fl.Y8G("ngIf",!t.webAuthnNewTab),Fl.R7$(),Fl.Y8G("ngIf",t.webAuthnNewTab))},dependencies:[kl.MD,kl.YU,kl.bT,sf,IP,Fh,id,td,Hh,tc,Il.X1,Gu,pc,Il.YN,rf],encapsulation:2});class OP{constructor(){this.tokenFormControl=void 0}}OP.ɵfac=function(e){return new(e||OP)},OP.ɵcmp=Fl.VBU({type:OP,selectors:[["app-two-factor-auth-yubikey"]],inputs:{tokenFormControl:"tokenFormControl"},features:[Fl.Jv_([])],decls:5,vars:4,consts:[[1,""],["type","password","bitInput","","appAutofocus","","appInputVerbatim","",3,"formControl"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label",0),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",1),Fl.k0s()),2&e&&(Fl.R7$(2),Fl.JRh(Fl.bMT(3,2,"verificationCode")),Fl.R7$(2),Fl.Y8G("formControl",t.tokenFormControl))},dependencies:[kl.MD,sf,wd,GI,Fh,id,Hh,tc,Il.X1,Il.me,Il.BC,Il.l_,Gu,Ac,fu,ju,pc,Il.YN,rf],encapsulation:2});class UP{constructor(){this.token=void 0,this.remember=void 0,this.selectedProviderType=void 0}static fromJSON(e){return null==e?null:Object.assign(new UP,e)}}class MP{constructor(){this.viewCacheService=(0,a.WQX)(II),this.twoFactorAuthComponentCache=this.viewCacheService.signal({key:"two-factor-auth-component-cache",initialValue:null,deserializer:UP.fromJSON})}cacheData(e){this.twoFactorAuthComponentCache.set({token:e.token,remember:e.remember,selectedProviderType:e.selectedProviderType})}clearCachedData(){this.twoFactorAuthComponentCache.set(null)}getCachedData(){return this.twoFactorAuthComponentCache()}}MP.ɵfac=function(e){return new(e||MP)},MP.ɵprov=a.jDH({token:MP,factory:MP.ɵfac});const NP=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 121 33">
<g fill="#84BD00" clip-path="url(#two-factor-auth-yubico-clip)">
<path
d="M11.011 19.366 15.18 7.47h6.02L11.054 32.622H4.698l2.903-6.891L.5 7.47h6.147l4.364 11.895ZM42.446 25.872h-5.87V23.84c-.925.73-1.92 1.364-2.971 1.892-.9.432-1.971.648-3.216.646-2.014 0-3.562-.584-4.645-1.751-1.082-1.168-1.627-2.895-1.633-5.18V7.471h5.865v9.127c0 .929.03 1.702.09 2.319.036.533.177 1.054.414 1.532.199.396.53.71.935.884.418.186 1 .279 1.749.279a5.726 5.726 0 0 0 1.657-.28 7.101 7.101 0 0 0 1.757-.818V7.47h5.868v18.4ZM66.065 16.42c0 2.894-.793 5.254-2.38 7.078-1.586 1.824-3.565 2.736-5.935 2.736a9.864 9.864 0 0 1-2.68-.327 9.183 9.183 0 0 1-2.191-.95l-.245.916H47.01V.377h5.87v9.012a14.137 14.137 0 0 1 2.753-1.754 7.413 7.413 0 0 1 3.24-.671c2.305 0 4.08.84 5.327 2.52 1.245 1.68 1.867 3.992 1.865 6.935Zm-6.032.122c0-1.637-.276-2.897-.828-3.78-.553-.884-1.537-1.326-2.952-1.326-.577.004-1.15.09-1.704.254a6.987 6.987 0 0 0-1.67.72v9.227c.388.144.79.249 1.2.311a9.8 9.8 0 0 0 1.363.083c1.548 0 2.7-.459 3.455-1.375.755-.918 1.135-2.289 1.138-4.114h-.002ZM75.961 4.85h-6.195V.377h6.195V4.85ZM75.8 25.872h-5.87v-18.4h5.87v18.4ZM90.789 26.363a15.651 15.651 0 0 1-4.36-.572 9.575 9.575 0 0 1-3.438-1.77 8.005 8.005 0 0 1-2.244-3.015c-.53-1.211-.796-2.631-.797-4.26 0-1.716.285-3.196.854-4.44a8.377 8.377 0 0 1 2.382-3.097A9.675 9.675 0 0 1 86.6 7.504a14.864 14.864 0 0 1 4.017-.54c1.16-.01 2.319.127 3.446.408 1.013.26 1.999.616 2.944 1.066v5.03h-.83c-.225-.197-.499-.426-.82-.688a7.315 7.315 0 0 0-1.176-.77 7.73 7.73 0 0 0-1.46-.598 6.497 6.497 0 0 0-1.858-.234c-1.56 0-2.76.5-3.598 1.5-.839 1-1.255 2.357-1.25 4.072 0 1.77.43 3.114 1.29 4.03.86.918 2.08 1.376 3.662 1.376a7.202 7.202 0 0 0 1.988-.254 6.426 6.426 0 0 0 1.47-.597c.344-.201.67-.431.974-.688.282-.241.536-.475.779-.706h.829v5.041c-.931.434-1.9.778-2.896 1.028a13.455 13.455 0 0 1-3.323.383ZM120.4 16.68c0 3.027-.875 5.411-2.626 7.153-1.751 1.741-4.209 2.613-7.375 2.614-3.165 0-5.624-.871-7.374-2.614-1.751-1.743-2.627-4.127-2.627-7.153 0-3.048.882-5.44 2.644-7.176 1.763-1.735 4.215-2.603 7.357-2.605 3.187 0 5.651.874 7.391 2.622 1.74 1.747 2.61 4.134 2.61 7.16Zm-7.203 4.474a4.741 4.741 0 0 0 .852-1.696c.192-.661.287-1.576.286-2.745.018-.915-.08-1.829-.293-2.719a4.768 4.768 0 0 0-.818-1.753 2.853 2.853 0 0 0-1.251-.95 4.4 4.4 0 0 0-1.577-.28 4.607 4.607 0 0 0-1.504.229c-.489.192-.92.508-1.251.918a4.687 4.687 0 0 0-.854 1.754 10.45 10.45 0 0 0-.318 2.8c-.014.88.079 1.758.277 2.615.141.645.418 1.251.813 1.778a3.11 3.11 0 0 0 1.25.935 4.6 4.6 0 0 0 3.17.023 2.794 2.794 0 0 0 1.218-.909Z" />
</g>
<defs>
<clipPath id="two-factor-auth-yubico-clip">
<path class="tw-fill-text-alt2" d="M.5.377h120v32.247H.5z" />
</clipPath>
</defs>
</svg>
`;class VP{}VP.ɵfac=function(e){return new(e||VP)},VP.ɵmod=Fl.$C({type:VP}),VP.ɵinj=a.G2t({});class BP{}BP.ɵfac=function(e){return new(e||BP)},BP.ɵcmp=Fl.VBU({type:BP,selectors:[["bit-item-action"]],hostAttrs:[1,"[&>button]:tw-relative","[&>button:not([bit-item-content])]:after:tw-content-['']","[&>button]:after:tw-absolute","[&>button]:after:tw-block","bit-compact:[&>button]:after:tw-top-[-0.7rem]","bit-compact:[&>button]:after:tw-bottom-[-0.7rem]","[&>button]:after:tw-top-[-0.8rem]","[&>button]:after:tw-bottom-[-0.80rem]","[&>button]:after:tw-right-0","[&>button]:after:tw-left-0"],ngContentSelectors:["*"],decls:1,vars:0,template:function(e,t){1&e&&(Fl.NAR(),Fl.SdG(0))},encapsulation:2});const jP=["*",[["","slot","end"]]];class GP{constructor(){this.focusVisibleWithin=(0,a.vPA)(!1)}onFocusIn(e){this.focusVisibleWithin.set(e.matches("[data-fvw-target]:focus-visible"))}onFocusOut(){this.focusVisibleWithin.set(!1)}get classList(){return[this.focusVisibleWithin()?"tw-z-10 tw-rounded tw-outline-none tw-ring-2 bit-compact:tw-ring-inset tw-ring-primary-600 tw-border-transparent".split(" "):"tw-border-b-shadow"].flat()}}GP.ɵfac=function(e){return new(e||GP)},GP.ɵcmp=Fl.VBU({type:GP,selectors:[["bit-item"]],hostAttrs:[1,"tw-block","tw-box-border","tw-overflow-hidden","tw-flex","tw-bg-background","[&:has([data-item-main-content]_button:hover,[data-item-main-content]_a:hover)]:tw-cursor-pointer","[&:has([data-item-main-content]_button:enabled:hover,[data-item-main-content]_a:hover)]:tw-bg-hover-default","tw-text-main","tw-border-solid","tw-border-b","tw-border-0","[&:not(bit-layout_*)]:tw-rounded-lg","bit-compact:[&:not(bit-layout_*)]:tw-rounded-none","bit-compact:[&:not(bit-layout_*)]:last-of-type:tw-rounded-b-lg","bit-compact:[&:not(bit-layout_*)]:first-of-type:tw-rounded-t-lg","tw-min-h-9","tw-mb-1.5","bit-compact:tw-mb-0"],hostVars:2,hostBindings:function(e,t){1&e&&Fl.bIt("focusin",function(e){return t.onFocusIn(e.target)})("focusout",function(){return t.onFocusOut()}),2&e&&Fl.HbH(t.classList)},ngContentSelectors:["*","[slot=end]"],decls:5,vars:1,consts:[["endSlot",""],["data-item-main-content","",1,"tw-flex","tw-flex-1","tw-overflow-hidden"],[1,"tw-px-2","tw-flex","tw-items-center","tw-gap-2","[&_button[biticonbutton]]:-tw-mx-1",3,"hidden"]],template:function(e,t){if(1&e&&(Fl.NAR(jP),Fl.j41(0,"bit-item-action",1),Fl.SdG(1),Fl.k0s(),Fl.j41(2,"div",2,0),Fl.SdG(4,1),Fl.k0s()),2&e){const e=Fl.sdS(3);Fl.R7$(2),Fl.Y8G("hidden",0===e.childElementCount)}},dependencies:[BP],encapsulation:2,changeDetection:0});const LP=["endSlot"],zP=[[["","slot","start"]],"*",[["","slot","default-trailing"]],[["","slot","secondary"]],[["","slot","end"]]],_P=(e,t)=>({"tw-truncate":e,"tw-text-wrap tw-overflow-auto tw-break-words":t});class KP{constructor(){this.endSlot=(0,o.ebz)("endSlot"),this.endSlotHasChildren=(0,a.vPA)(!1),this.truncate=(0,o.hFB)(!0)}ngAfterContentChecked(){var e,t;this.endSlotHasChildren.set((null!==(t=null===(e=this.endSlot())||void 0===e?void 0:e.nativeElement.childElementCount)&&void 0!==t?t:0)>0)}}KP.ɵfac=function(e){return new(e||KP)},KP.ɵcmp=Fl.VBU({type:KP,selectors:[["bit-item-content"],["","bit-item-content",""]],viewQuery:function(e,t){1&e&&Fl.wEZ(t.endSlot,LP,5),2&e&&Fl.NyB()},hostAttrs:["data-fvw-target","",1,"tw-outline-none","tw-text-main","hover:tw-text-main","tw-no-underline","hover:tw-no-underline","tw-text-base","tw-py-2","tw-px-4","bit-compact:tw-py-1.5","bit-compact:tw-px-2","tw-bg-transparent","tw-w-full","tw-border-none","tw-flex","tw-gap-4","tw-items-center","tw-justify-between","disabled:tw-cursor-not-allowed","[&[disabled]_[bittypography]]:!tw-text-secondary-300","[&[disabled]_i]:!tw-text-secondary-300"],inputs:{truncate:[1,"truncate"]},ngContentSelectors:["[slot=start]","*","[slot=default-trailing]","[slot=secondary]","[slot=end]"],decls:13,vars:9,consts:[["endSlot",""],[1,"tw-flex","tw-gap-2","tw-items-center","tw-w-full","tw-min-w-0"],[1,"tw-flex","tw-flex-col","tw-items-start","tw-text-start","tw-w-full","tw-truncate","[&_p]:tw-mb-0"],["bitTypography","body2",1,"tw-text-main","tw-truncate","tw-inline-flex","tw-items-center","tw-gap-1.5","tw-w-full"],[3,"ngClass"],[1,"tw-flex-grow"],["bitTypography","helper",1,"tw-text-muted","tw-w-full",3,"ngClass"],[1,"tw-flex","tw-gap-2","tw-items-center",3,"hidden"]],template:function(e,t){1&e&&(Fl.NAR(zP),Fl.j41(0,"div",1),Fl.SdG(1),Fl.j41(2,"div",2)(3,"div",3)(4,"div",4),Fl.SdG(5,1),Fl.k0s(),Fl.j41(6,"div",5),Fl.SdG(7,2),Fl.k0s()(),Fl.j41(8,"div",6),Fl.SdG(9,3),Fl.k0s()()(),Fl.j41(10,"div",7,0),Fl.SdG(12,4),Fl.k0s()),2&e&&(Fl.R7$(4),Fl.Y8G("ngClass",Fl.l_i(3,_P,t.truncate(),!t.truncate())),Fl.R7$(4),Fl.Y8G("ngClass",Fl.l_i(6,_P,t.truncate(),!t.truncate())),Fl.R7$(2),Fl.Y8G("hidden",!t.endSlotHasChildren()))},dependencies:[tc,rc,kl.YU],encapsulation:2,changeDetection:0});class XP{}XP.ɵfac=function(e){return new(e||XP)},XP.ɵcmp=Fl.VBU({type:XP,selectors:[["bit-item-group"]],hostAttrs:[1,"tw-block"],ngContentSelectors:["*"],decls:1,vars:0,template:function(e,t){1&e&&(Fl.NAR(),Fl.SdG(0))},encapsulation:2,changeDetection:0});var qP=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function WP(e,t){if(1&e&&Fl.nrm(0,"bit-svg",11),2&e){const e=Fl.XpG(2);Fl.Y8G("content",e.Icons.TwoFactorAuthAuthenticatorIcon)}}function YP(e,t){if(1&e&&Fl.nrm(0,"bit-svg",11),2&e){const e=Fl.XpG(2);Fl.Y8G("content",e.Icons.TwoFactorAuthEmailIcon)}}function HP(e,t){if(1&e&&Fl.nrm(0,"bit-svg",11),2&e){const e=Fl.XpG(2);Fl.Y8G("content",e.Icons.TwoFactorAuthDuoIcon)}}function JP(e,t){if(1&e&&Fl.nrm(0,"bit-svg",11),2&e){const e=Fl.XpG(2);Fl.Y8G("content",e.Icons.TwoFactorAuthYubicoIcon)}}function ZP(e,t){if(1&e&&Fl.nrm(0,"bit-svg",11),2&e){const e=Fl.XpG(2);Fl.Y8G("content",e.Icons.TwoFactorAuthDuoIcon)}}function QP(e,t){if(1&e&&Fl.nrm(0,"bit-svg",11),2&e){const e=Fl.XpG(2);Fl.Y8G("content",e.Icons.TwoFactorAuthWebAuthnIcon)}}function eF(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-item",6),Fl.bIt("click",function(){const t=a.eBV(e).$implicit,i=Fl.XpG();return a.Njj(i.choose(t))}),Fl.j41(1,"button",7)(2,"div",8),Fl.DNE(3,WP,1,1,"bit-svg",9)(4,YP,1,1,"bit-svg",9)(5,HP,1,1,"bit-svg",9)(6,JP,1,1,"bit-svg",9)(7,ZP,1,1,"bit-svg",9)(8,QP,1,1,"bit-svg",9),Fl.k0s(),Fl.EFF(9),Fl.qex(10,10),Fl.EFF(11),Fl.bVm(),Fl.k0s()()}if(2&e){const e=t.$implicit,i=Fl.XpG();Fl.R7$(),Fl.Y8G("truncate",!1),Fl.R7$(),Fl.Y8G("ngSwitch",e.type),Fl.R7$(),Fl.Y8G("ngSwitchCase",i.TwoFactorProviderType.Authenticator),Fl.R7$(),Fl.Y8G("ngSwitchCase",i.TwoFactorProviderType.Email),Fl.R7$(),Fl.Y8G("ngSwitchCase",i.TwoFactorProviderType.Duo),Fl.R7$(),Fl.Y8G("ngSwitchCase",i.TwoFactorProviderType.Yubikey),Fl.R7$(),Fl.Y8G("ngSwitchCase",i.TwoFactorProviderType.OrganizationDuo),Fl.R7$(),Fl.Y8G("ngSwitchCase",i.TwoFactorProviderType.WebAuthn),Fl.R7$(),Fl.SpI(" ",e.name," "),Fl.R7$(2),Fl.SpI(" ",e.description," ")}}class tF{constructor(e,t){this.twoFactorService=e,this.dialogRef=t,this.providers=[],this.TwoFactorProviderType=oS,this.Icons={TwoFactorAuthAuthenticatorIcon:WT,TwoFactorAuthEmailIcon:YT,TwoFactorAuthDuoIcon:HT,TwoFactorAuthYubicoIcon:NP,TwoFactorAuthWebAuthnIcon:ZT}}ngOnInit(){return qP(this,void 0,void 0,function*(){const e=yield this.twoFactorService.getSupportedProviders(window);e.sort((e,t)=>e.sort-t.sort),this.providers=e})}choose(e){return qP(this,void 0,void 0,function*(){this.dialogRef.close({type:e.type})})}static open(e){return e.open(tF)}cancel(){this.dialogRef.close()}}tF.ɵfac=function(e){return new(e||tF)(Fl.rXU(nP),Fl.rXU(nh))},tF.ɵcmp=Fl.VBU({type:tF,selectors:[["app-two-factor-options"]],features:[Fl.Jv_([])],decls:11,vars:8,consts:[["dialogSize","large",3,"background"],["bitDialogTitle",""],["bitDialogContent",""],[3,"click",4,"ngFor","ngForOf"],["bitDialogFooter",""],["bitButton","","type","button","buttonType","secondary",3,"click"],[3,"click"],["bit-item-content","","type","button",1,"tw-h-auto","md:tw-h-20",3,"truncate"],["slot","start",1,"tw-w-16","md:tw-w-20","tw-mr-2","sm:tw-mr-4",3,"ngSwitch"],[3,"content",4,"ngSwitchCase"],["slot","secondary"],[3,"content"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-dialog",0)(1,"span",1),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.qex(4,2),Fl.j41(5,"bit-item-group"),Fl.DNE(6,eF,12,10,"bit-item",3),Fl.k0s(),Fl.bVm(),Fl.qex(7,4),Fl.j41(8,"button",5),Fl.bIt("click",function(){return t.cancel()}),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e&&(Fl.Y8G("background","alt"),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,4,"selectTwoStepLoginMethod")," "),Fl.R7$(4),Fl.Y8G("ngForOf",t.providers),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(10,6,"cancel")," "))},dependencies:[kl.MD,kl.Sq,kl.ux,kl.e1,sf,Fh,Ph,id,td,tc,VP,GP,KP,XP,Yh,BC,rf],encapsulation:2});var iF=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const nF=["continueButton"],rF=["duoComponent"];function sF(e,t){1&e&&(Fl.qex(0),Fl.j41(1,"div",3),Fl.nrm(2,"i",4),Fl.k0s(),Fl.bVm())}function oF(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"app-two-factor-auth-email",16),Fl.bIt("tokenChange",function(t){a.eBV(e);const i=Fl.XpG(2);return a.Njj(i.saveFormDataWithPartialData(t))}),Fl.k0s()}if(2&e){const e=Fl.XpG(2);Fl.Y8G("tokenFormControl",e.tokenFormControl)}}function aF(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"app-two-factor-auth-authenticator",16),Fl.bIt("tokenChange",function(t){a.eBV(e);const i=Fl.XpG(2);return a.Njj(i.saveFormDataWithPartialData(t))}),Fl.k0s()}if(2&e){const e=Fl.XpG(2);Fl.Y8G("tokenFormControl",e.tokenFormControl)}}function lF(e,t){if(1&e&&Fl.nrm(0,"app-two-factor-auth-yubikey",17),2&e){const e=Fl.XpG(2);Fl.Y8G("tokenFormControl",e.tokenFormControl)}}function cF(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"app-two-factor-auth-duo",18,0),Fl.bIt("tokenEmitter",function(t){a.eBV(e);const i=Fl.XpG(2);return a.Njj(i.submit(t))}),Fl.k0s()}if(2&e){const e=Fl.XpG(2);Fl.Y8G("providerData",e.selectedProviderData)}}function uF(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-form-control")(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"input",19),Fl.bIt("change",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.onRememberChange())}),Fl.k0s()()}2&e&&(Fl.R7$(2),Fl.JRh(Fl.bMT(3,1,"dontAskAgainOnThisDeviceFor30Days")))}function dF(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"app-two-factor-auth-webauthn",20),Fl.bIt("webAuthnResultEmitter",function(t){a.eBV(e);const i=Fl.XpG(2);return a.Njj(i.submit(t.token,t.remember))})("webAuthnInNewTabEmitter",function(t){a.eBV(e);const i=Fl.XpG(2);return a.Njj(i.webAuthInNewTab=t)}),Fl.k0s()}}function hF(e,t){1&e&&(Fl.qex(0),Fl.j41(1,"p",21),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"p",21),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.bVm()),2&e&&(Fl.R7$(2),Fl.JRh(Fl.bMT(3,2,"noTwoStepProviders")),Fl.R7$(3),Fl.JRh(Fl.bMT(6,4,"noTwoStepProviders2")))}function pF(e,t){1&e&&(Fl.j41(0,"button",22,1)(2,"span"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()()),2&e&&(Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,1,"continueLoggingIn")," "))}function vF(e,t){1&e&&(Fl.j41(0,"span"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"launchDuo")))}function fF(e,t){1&e&&(Fl.j41(0,"span"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"popoutExtension")))}function mF(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",23),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.launchDuo())}),Fl.DNE(1,vF,3,3,"span",2)(2,fF,3,3,"span",2),Fl.k0s()}if(2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("ngIf",e.duoLaunchAction===e.DuoLaunchAction.DIRECT_LAUNCH),Fl.R7$(),Fl.Y8G("ngIf",e.duoLaunchAction===e.DuoLaunchAction.SINGLE_ACTION_POPOUT)}}function gF(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",15),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.selectOtherTwoFactorMethod())}),Fl.j41(1,"span"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()()}2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"selectAnotherMethod")," "))}function yF(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"form",5),Fl.bIt("keydown.enter",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.handleEnterKeyPress())}),Fl.DNE(2,oF,1,1,"app-two-factor-auth-email",6)(3,aF,1,1,"app-two-factor-auth-authenticator",6)(4,lF,1,1,"app-two-factor-auth-yubikey",7)(5,cF,2,1,"app-two-factor-auth-duo",8)(6,uF,5,3,"bit-form-control",2)(7,dF,1,0,"app-two-factor-auth-webauthn",9)(8,hF,7,6,"ng-container",2),Fl.j41(9,"div",10),Fl.DNE(10,pF,5,3,"button",11)(11,mF,3,2,"button",12),Fl.j41(12,"p",13),Fl.EFF(13),Fl.nI1(14,"i18n"),Fl.k0s(),Fl.DNE(15,gF,4,3,"button",14),Fl.j41(16,"button",15),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.use2faRecoveryCode())}),Fl.j41(17,"span"),Fl.EFF(18),Fl.nI1(19,"i18n"),Fl.k0s()()()(),Fl.bVm()}if(2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("bitSubmit",e.submit)("formGroup",e.form),Fl.R7$(),Fl.Y8G("ngIf",e.selectedProviderType===e.providerType.Email),Fl.R7$(),Fl.Y8G("ngIf",e.selectedProviderType===e.providerType.Authenticator),Fl.R7$(),Fl.Y8G("ngIf",e.selectedProviderType===e.providerType.Yubikey),Fl.R7$(),Fl.Y8G("ngIf",e.selectedProviderType===e.providerType.OrganizationDuo||e.selectedProviderType===e.providerType.Duo),Fl.R7$(),Fl.Y8G("ngIf",!e.hideRememberMe()),Fl.R7$(),Fl.Y8G("ngIf",e.selectedProviderType===e.providerType.WebAuthn),Fl.R7$(),Fl.Y8G("ngIf",null==e.selectedProviderType),Fl.R7$(2),Fl.Y8G("ngIf",e.showContinueButton()),Fl.R7$(),Fl.Y8G("ngIf",e.selectedProviderType===e.providerType.Duo||e.selectedProviderType===e.providerType.OrganizationDuo),Fl.R7$(2),Fl.JRh(Fl.bMT(14,14,"or")),Fl.R7$(2),Fl.Y8G("ngIf",(null==e.twoFactorProviders?null:e.twoFactorProviders.size)>1),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(19,16,"useYourRecoveryCode")," ")}}class bF{get tokenFormControl(){return this.form.controls.token}get rememberFormControl(){return this.form.controls.remember}constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,v,f,m,g,y,b,w,S,k){this.loginStrategyService=e,this.router=t,this.i18nService=i,this.platformUtilsService=n,this.dialogService=r,this.activatedRoute=s,this.logService=o,this.twoFactorService=a,this.userDecryptionOptionsService=l,this.ssoLoginService=c,this.masterPasswordService=u,this.accountService=d,this.formBuilder=h,this.win=p,this.toastService=v,this.twoFactorAuthComponentService=f,this.destroyRef=m,this.anonLayoutWrapperDataService=g,this.environmentService=y,this.loginSuccessHandlerService=b,this.twoFactorAuthComponentCacheService=w,this.authService=S,this.keyConnectorService=k,this.continueButton=void 0,this.loading=!0,this.orgSsoIdentifier=void 0,this.providerType=oS,this.selectedProviderType=oS.Authenticator,this.twoFactorProviders=null,this.form=this.formBuilder.group({token:["",{validators:[Il.k0.required],updateOn:"submit"}],remember:[!1]}),this.duoLaunchAction=void 0,this.DuoLaunchAction=ST,this.webAuthInNewTab=!1,this.authenticationSessionTimeoutRoute="authentication-timeout",this.submit=(e,t)=>iF(this,void 0,void 0,function*(){var i;let n;if(void 0!==e){if(""===e||null===e)return void this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("verificationCodeRequired")});n=e}else{if(this.tokenFormControl.markAsTouched(),this.tokenFormControl.markAsDirty(),this.tokenFormControl.updateValueAndValidity(),this.form.invalid)return;const e=this.tokenFormControl.value;if(!e)return;n=e.trim()}const r=null!==(i=null!=t?t:this.rememberFormControl.value)&&void 0!==i&&i;this.twoFactorAuthComponentCacheService.cacheData({token:n,remember:r,selectedProviderType:this.selectedProviderType});try{this.formPromise=this.loginStrategyService.logInTwoFactor(new Bw(this.selectedProviderType,n,r));const e=yield this.formPromise;this.logService.info("Successfully submitted two factor token"),yield this.handleAuthResult(e)}catch(e){this.logService.error("Error submitting two factor token"),this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("invalidVerificationCode")})}})}ngOnInit(){return iF(this,void 0,void 0,function*(){var e,t,i;this.orgSsoIdentifier=null!==(e=this.activatedRoute.snapshot.queryParamMap.get("identifier"))&&void 0!==e?e:void 0,this.listenForAuthnSessionTimeout();let n=!1;const r=this.twoFactorAuthComponentCacheService.getCachedData();r&&(r.token&&this.form.patchValue({token:r.token}),void 0!==r.remember&&this.form.patchValue({remember:r.remember}),void 0!==r.selectedProviderType&&(this.selectedProviderType=r.selectedProviderType,n=!0)),n||(this.selectedProviderType=yield this.initializeSelected2faProviderType(),this.twoFactorAuthComponentCacheService.cacheData({selectedProviderType:this.selectedProviderType})),yield this.set2faProvidersAndData(),yield this.setAnonLayoutDataByTwoFactorProviderType(),yield null===(i=(t=this.twoFactorAuthComponentService).extendPopupWidthIfRequired)||void 0===i?void 0:i.call(t,this.selectedProviderType),this.duoLaunchAction=this.twoFactorAuthComponentService.determineDuoLaunchAction(),this.loading=!1})}saveFormDataWithPartialData(e){return iF(this,void 0,void 0,function*(){var t,i,n,r,s;const o=this.twoFactorAuthComponentCacheService.getCachedData();this.twoFactorAuthComponentCacheService.cacheData({token:null!==(i=null!==(t=null==e?void 0:e.token)&&void 0!==t?t:null==o?void 0:o.token)&&void 0!==i?i:"",remember:null!==(r=null!==(n=null==e?void 0:e.remember)&&void 0!==n?n:null==o?void 0:o.remember)&&void 0!==r&&r,selectedProviderType:null!==(s=null==e?void 0:e.selectedProviderType)&&void 0!==s?s:null==o?void 0:o.selectedProviderType})})}onRememberChange(){return iF(this,void 0,void 0,function*(){const e=!!this.rememberFormControl.value;yield this.saveFormDataWithPartialData({remember:e})})}initializeSelected2faProviderType(){return iF(this,void 0,void 0,function*(){const e=this.platformUtilsService.supportsWebAuthn(this.win);if(this.twoFactorAuthComponentService.shouldCheckForWebAuthnQueryParamResponse()&&e){if(this.activatedRoute.snapshot.paramMap.get("webAuthnResponse"))return oS.WebAuthn}return yield this.twoFactorService.getDefaultProvider(e)})}set2faProvidersAndData(){return iF(this,void 0,void 0,function*(){var e;if(this.twoFactorProviders=yield this.twoFactorService.getProviders(),void 0!==this.selectedProviderType){const t=null===(e=this.twoFactorProviders)||void 0===e?void 0:e.get(this.selectedProviderType);this.selectedProviderData=t}})}listenForAuthnSessionTimeout(){this.loginStrategyService.authenticationSessionTimeout$.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>iF(this,void 0,void 0,function*(){if(e)try{yield this.router.navigate([this.authenticationSessionTimeoutRoute])}catch(e){this.logService.error(`Failed to navigate to ${this.authenticationSessionTimeoutRoute} route`,e)}}))}selectOtherTwoFactorMethod(){return iF(this,void 0,void 0,function*(){const e=tF.open(this.dialogService),t=yield(0,xT.s)(e.closed);if(null!=t&&"string"!=typeof t){const e=yield this.twoFactorService.getProviders().then(e=>null==e?void 0:e.get(t.type));this.selectedProviderData=e,this.selectedProviderType=t.type,yield this.setAnonLayoutDataByTwoFactorProviderType(),this.twoFactorAuthComponentCacheService.cacheData({token:"",remember:!1,selectedProviderType:t.type}),this.form.reset(),this.form.updateValueAndValidity()}})}launchDuo(){return iF(this,void 0,void 0,function*(){null!=this.duoComponent&&void 0!==this.duoLaunchAction&&(yield this.duoComponent.launchDuoFrameless(this.duoLaunchAction))})}handleMigrateEncryptionKey(e){return iF(this,void 0,void 0,function*(){return!!e.requiresEncryptionKeyMigration&&(this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("legacyEncryptionUnsupported")}),!0)})}setAnonLayoutDataByTwoFactorProviderType(){return iF(this,void 0,void 0,function*(){switch(this.selectedProviderType){case oS.Authenticator:this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageSubtitle:this.i18nService.t("enterTheCodeFromYourAuthenticatorApp"),pageIcon:WT});break;case oS.Email:this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageSubtitle:this.i18nService.t("enterTheCodeSentToYourEmail"),pageIcon:YT});break;case oS.Duo:case oS.OrganizationDuo:this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageSubtitle:this.i18nService.t("duoTwoFactorRequiredPageSubtitle"),pageIcon:HT});break;case oS.Yubikey:this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageSubtitle:this.i18nService.t("pressYourYubiKeyToAuthenticate"),pageIcon:JT});break;case oS.WebAuthn:this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageSubtitle:this.i18nService.t("followTheStepsBelowToFinishLoggingInWithSecurityKey"),pageIcon:ZT});break;default:this.logService.error("setAnonLayoutDataByTwoFactorProviderType: Unhandled 2FA provider type",this.selectedProviderType)}})}handleAuthResult(e){return iF(this,void 0,void 0,function*(){var t,i,n,r,s;if(this.twoFactorAuthComponentCacheService.clearCachedData(),yield this.handleMigrateEncryptionKey(e))return;if(yield this.loginSuccessHandlerService.run(e.userId,e.masterPassword),void 0!==this.orgSsoIdentifier){const e=null===(t=yield(0,bo._)(this.accountService.activeAccount$))||void 0===t?void 0:t.id;yield this.ssoLoginService.setActiveUserOrganizationSsoIdentifier(this.orgSsoIdentifier,e)}if(null!=(yield(0,bo._)(this.keyConnectorService.requiresDomainConfirmation$(e.userId))))return void(yield this.router.navigate(["confirm-key-connector-domain"]));const o=yield(0,bo._)(this.userDecryptionOptionsService.userDecryptionOptionsById$(e.userId));if(yield this.isTrustedDeviceEncEnabled(o.trustedDeviceOption))return yield this.handleTrustedDeviceEncryptionEnabled(e.userId,o);if(!o.hasMasterPassword&&void 0===o.keyConnectorOption)return yield this.handleChangePasswordRequired(this.orgSsoIdentifier);null===(n=(i=this.twoFactorAuthComponentService).reloadOpenWindows)||void 0===n||n.call(i);if(yield null===(s=(r=this.twoFactorAuthComponentService).closeSingleActionPopouts)||void 0===s?void 0:s.call(r))return;const a=yield this.determineDefaultSuccessRoute(e.userId);yield this.router.navigate([a],{queryParams:{identifier:this.orgSsoIdentifier}})})}determineDefaultSuccessRoute(e){return iF(this,void 0,void 0,function*(){if((yield(0,bo._)(this.authService.activeAccountStatus$))===Pd.Locked)return"lock";const t=yield(0,bo._)(this.masterPasswordService.forceSetPasswordReason$(e));return t===aS.WeakMasterPassword||t===aS.AdminForcePasswordReset?"change-password":"vault"})}isTrustedDeviceEncEnabled(e){return iF(this,void 0,void 0,function*(){return"true"===this.activatedRoute.snapshot.queryParamMap.get("sso")&&void 0!==e})}handleTrustedDeviceEncryptionEnabled(e,t){return iF(this,void 0,void 0,function*(){var i,n,r,s,o,a;!t.hasMasterPassword&&(null===(i=t.trustedDeviceOption)||void 0===i?void 0:i.isTdeOffboarding)?yield this.masterPasswordService.setForceSetPasswordReason(aS.TdeOffboarding,e):!t.hasMasterPassword&&(null===(n=t.trustedDeviceOption)||void 0===n?void 0:n.hasManageResetPasswordPermission)&&(yield this.masterPasswordService.setForceSetPasswordReason(aS.TdeUserWithoutPasswordHasPasswordResetPermission,e)),null===(s=(r=this.twoFactorAuthComponentService).reloadOpenWindows)||void 0===s||s.call(r);(yield null===(a=(o=this.twoFactorAuthComponentService).closeSingleActionPopouts)||void 0===a?void 0:a.call(o))||(yield this.router.navigate(["login-initiated"]))})}handleChangePasswordRequired(e){return iF(this,void 0,void 0,function*(){yield this.router.navigate(["set-initial-password"],{queryParams:{identifier:e}})})}showContinueButton(){return null!=this.selectedProviderType&&this.selectedProviderType!==oS.WebAuthn&&this.selectedProviderType!==oS.Duo&&this.selectedProviderType!==oS.OrganizationDuo}hideRememberMe(){return(this.selectedProviderType===oS.Duo||this.selectedProviderType===oS.OrganizationDuo)&&this.duoLaunchAction===ST.SINGLE_ACTION_POPOUT||this.selectedProviderType===oS.WebAuthn&&this.webAuthInNewTab}use2faRecoveryCode(){return iF(this,void 0,void 0,function*(){const e=(yield(0,bo._)(this.environmentService.environment$)).getWebVaultUrl();this.platformUtilsService.launchUri(e+"/#/recover-2fa")})}handleEnterKeyPress(){return iF(this,void 0,void 0,function*(){var e,t;switch(this.selectedProviderType){case oS.Authenticator:case oS.Email:null===(t=null===(e=this.continueButton)||void 0===e?void 0:e.nativeElement)||void 0===t||t.click();break;case oS.Duo:case oS.OrganizationDuo:case oS.WebAuthn:case oS.Yubikey:break;default:this.logService.error("handleEnterKeyPress: Unhandled 2FA provider type",this.selectedProviderType)}})}ngOnDestroy(){return iF(this,void 0,void 0,function*(){var e,t;null===(t=(e=this.twoFactorAuthComponentService).removePopupWidthExtension)||void 0===t||t.call(e)})}}bF.ɵfac=function(e){return new(e||bF)(Fl.rXU(Ew),Fl.rXU(Fd.Ix),Fl.rXU(Ul),Fl.rXU(Hb),Fl.rXU(lh),Fl.rXU(Fd.nX),Fl.rXU(Za),Fl.rXU(nP),Fl.rXU($w),Fl.rXU(xk),Fl.rXU(Yb),Fl.rXU(Zk),Fl.rXU(Il.ok),Fl.rXU(AT),Fl.rXU(qb),Fl.rXU(FT),Fl.rXU(a.abz),Fl.rXU(Ck),Fl.rXU(mk),Fl.rXU(Mw),Fl.rXU(MP),Fl.rXU(Rd),Fl.rXU(wT))},bF.ɵcmp=Fl.VBU({type:bF,selectors:[["app-two-factor-auth"]],viewQuery:function(e,t){if(1&e&&(Fl.GBs(nF,5,Fl.aKT),Fl.GBs(rF,5)),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.continueButton=e.first),Fl.mGM(e=Fl.lsd())&&(t.duoComponent=e.first)}},features:[Fl.Jv_([{provide:MP}])],decls:2,vars:2,consts:[["duoComponent",""],["continueButton",""],[4,"ngIf"],[1,"tw-flex","tw-items-center","tw-justify-center"],["aria-hidden","true",1,"bwi","bwi-spinner","bwi-spin","bwi-3x"],["autocomplete","off",3,"keydown.enter","bitSubmit","formGroup"],[3,"tokenFormControl","tokenChange",4,"ngIf"],[3,"tokenFormControl",4,"ngIf"],[3,"providerData","tokenEmitter",4,"ngIf"],[3,"webAuthnResultEmitter","webAuthnInNewTabEmitter",4,"ngIf"],[1,"tw-flex","tw-flex-col","tw-space-y-3"],["type","submit","buttonType","primary","bitButton","","bitFormButton","",4,"ngIf"],["type","button","buttonType","primary","bitButton","",3,"click",4,"ngIf"],[1,"tw-text-center","tw-mb-0"],["type","button","buttonType","secondary","bitButton","","bitFormButton","",3,"click",4,"ngIf"],["type","button","buttonType","secondary","bitButton","","bitFormButton","",3,"click"],[3,"tokenChange","tokenFormControl"],[3,"tokenFormControl"],[3,"tokenEmitter","providerData"],["type","checkbox","bitCheckbox","","formControlName","remember",3,"change"],[3,"webAuthnResultEmitter","webAuthnInNewTabEmitter"],["bitTypography","body1"],["type","submit","buttonType","primary","bitButton","","bitFormButton",""],["type","button","buttonType","primary","bitButton","",3,"click"]],template:function(e,t){1&e&&Fl.DNE(0,sF,3,0,"ng-container",2)(1,yF,20,18,"ng-container",2),2&e&&(Fl.Y8G("ngIf",t.loading),Fl.R7$(),Fl.Y8G("ngIf",!t.loading))},dependencies:[kl.MD,kl.bT,sf,Il.X1,Il.qT,Il.Zm,Il.BC,Il.cb,Il.j4,Il.JD,Gu,Sc,Ac,pc,jd,Md,hd,Qb,id,td,fP,TP,yP,OP,$P,rf],encapsulation:2});var wF=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class SF{shouldOpenWebAuthnInNewTab(){return!1}}class kF{}var IF=i(96331),CF=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function TF(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"div",6),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s(),Fl.j41(3,"button",7),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.goBack())}),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.JRh(Fl.bMT(2,2,"or")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(5,4,"back")," "))}class PF{constructor(e,t,i,n,r,s,o,a,l,c,u){this.router=e,this.formBuilder=t,this.apiService=i,this.loginStrategyService=n,this.logService=r,this.i18nService=s,this.loginSuccessHandlerService=o,this.accountService=a,this.masterPasswordService=l,this.newDeviceVerificationComponentService=c,this.location=u,this.formGroup=this.formBuilder.group({code:["",{validators:[Il.k0.required],updateOn:"change"}]}),this.disableRequestOTP=!1,this.destroy$=new Co.B,this.authenticationSessionTimeoutRoute="/authentication-timeout",this.showBackButton=!0,this.submit=()=>CF(this,void 0,void 0,function*(){var e,t;const i=this.formGroup.get("code");if(i&&i.value)try{const e=yield this.loginStrategyService.logInNewDeviceVerification(i.value);if(e.requiresTwoFactor)return void(yield this.router.navigate(["/2fa"]));yield this.loginSuccessHandlerService.run(e.userId,e.masterPassword);const t=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv)),n=yield(0,bo._)(this.masterPasswordService.forceSetPasswordReason$(t));n===aS.WeakMasterPassword||n===aS.AdminForcePasswordReset?yield this.router.navigate(["/change-password"]):yield this.router.navigate(["/vault"])}catch(n){this.logService.error(n);let r=null!==(t=null===(e=null==n?void 0:n.response)||void 0===e?void 0:e.error_description)&&void 0!==t?t:this.i18nService.t("errorOccurred");r.includes("Invalid New Device OTP")&&(r=this.i18nService.t("invalidVerificationCode")),i.setErrors({serverError:{message:r}}),i.markAsTouched()}})}ngOnInit(){return CF(this,void 0,void 0,function*(){this.showBackButton=this.newDeviceVerificationComponentService.showBackButton(),this.loginStrategyService.authenticationSessionTimeout$.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{if(e)try{this.router.navigate([this.authenticationSessionTimeoutRoute])}catch(e){this.logService.error(`Failed to navigate to ${this.authenticationSessionTimeoutRoute} route`,e)}})})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}resendOTP(){return CF(this,void 0,void 0,function*(){this.disableRequestOTP=!0;try{const e=yield this.loginStrategyService.getEmail(),t=yield this.loginStrategyService.getMasterPasswordHash();if(!e||!t)throw new Error("Missing email or master password hash");yield this.apiService.send("POST","/accounts/resend-new-device-otp",{email:e,masterPasswordHash:t},!1,!1)}catch(e){this.logService.error(e)}finally{this.disableRequestOTP=!1}})}goBack(){this.location.back()}}PF.ɵfac=function(e){return new(e||PF)(Fl.rXU(Fd.Ix),Fl.rXU(Il.ok),Fl.rXU(eI),Fl.rXU(Ew),Fl.rXU(Za),Fl.rXU(Ul),Fl.rXU(Mw),Fl.rXU(Zk),Fl.rXU(Wb),Fl.rXU(kF),Fl.rXU(IF.aZ))},PF.ɵcmp=Fl.VBU({type:PF,selectors:[["app-new-device-verification"]],decls:14,vars:15,consts:[[3,"formGroup","bitSubmit"],[1,"!tw-mb-1"],["bitInput","","type","text","id","verificationCode","name","verificationCode","formControlName","code","appInputVerbatim",""],["bitLink","","type","button","linkType","primary",1,"tw-text-sm",3,"click","disabled"],[1,"tw-grid","tw-gap-3","tw-mt-4"],["bitButton","","bitFormButton","","buttonType","primary","type","submit",3,"block","disabled"],[1,"tw-text-center"],["type","button","bitButton","","block","","buttonType","secondary",3,"click"]],template:function(e,t){1&e&&(Fl.j41(0,"form",0)(1,"bit-form-field",1)(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.nrm(5,"input",2),Fl.k0s(),Fl.j41(6,"button",3),Fl.bIt("click",function(){return t.resendOTP()}),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.j41(9,"div",4)(10,"button",5),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s(),Fl.nVh(13,TF,6,6),Fl.k0s()()),2&e&&(Fl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),Fl.R7$(3),Fl.JRh(Fl.bMT(4,9,"verificationCode")),Fl.R7$(3),Fl.Y8G("disabled",t.disableRequestOTP),Fl.R7$(),Fl.SpI(" ",Fl.bMT(8,11,"resendCode")," "),Fl.R7$(3),Fl.Y8G("block",!0)("disabled",t.formGroup.invalid),Fl.R7$(),Fl.SpI(" ",Fl.bMT(12,13,"continueLoggingIn")," "),Fl.R7$(2),Fl.vxM(t.showBackButton?13:-1))},dependencies:[kl.MD,Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,pc,jd,Md,sf,GI,id,td,Gu,Ac,fu,ju,Ql,Hh,uw,rf],encapsulation:2});class FF{showBackButton(){return!0}}class RF{}function xF(e){return new aa.c(t=>{const i=(...e)=>{chrome.runtime.lastError?t.error(chrome.runtime.lastError):t.next(e)};return ul.addListener(e,i),()=>ul.removeListener(e,i)})}RF.ɵfac=function(e){return new(e||RF)},RF.ɵmod=Fl.$C({type:RF}),RF.ɵinj=a.G2t({});class AF{}var DF=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class EF{constructor(e,t,i,n,r,s,o){this.accountService=e,this.avatarService=t,this.messagingService=i,this.environmentService=n,this.logService=r,this.configService=s,this.ACCOUNT_LIMIT=5,this.SPECIAL_ADD_ACCOUNT_ID="addAccount",this.availableAccounts$=(0,jo.z)([e.accounts$,o.authStatuses$,this.accountService.activeAccount$]).pipe((0,go.n)(e=>DF(this,[e],void 0,function*([e,t,i]){const n=Object.keys(e).filter(e=>t[e]!==Pd.LoggedOut),r=n.length>=this.ACCOUNT_LIMIT,s=yield Promise.all(n.map(n=>DF(this,void 0,void 0,function*(){var r;const s=yield(0,bo._)(this.environmentService.getEnvironment$(n));return{name:null!==(r=e[n].name)&&void 0!==r?r:e[n].email,email:e[n].email,id:n,server:null==s?void 0:s.getHostname(),status:t[n],isActive:n===(null==i?void 0:i.id),avatarColor:yield(0,bo._)(this.avatarService.getUserAvatarColor$(n))}})));return r||s.push({name:"addAccount",id:this.SPECIAL_ADD_ACCOUNT_ID,isActive:!1}),s.sort((e,t)=>e.isActive?-1:t.id===this.SPECIAL_ADD_ACCOUNT_ID?0:1)}))),this.switchAccountFinished$=xF(chrome.runtime.onMessage).pipe((0,Eo.p)(([e])=>"switchAccountFinish"===e.command),(0,l.T)(([e])=>({userId:e.userId,authenticationStatus:e.status})))}accountSwitchingEnabled$(){return ul.isSafariApi?this.configService.getFeatureFlag$(Wv.SafariAccountSwitching):(0,Go.of)(!0)}get specialAccountAddId(){return this.SPECIAL_ADD_ACCOUNT_ID}selectAccount(e){return DF(this,void 0,void 0,function*(){e===this.SPECIAL_ADD_ACCOUNT_ID&&(e=null);const t=e,i=this.listenForSwitchAccountFinish(t);return this.messagingService.send("switchAccount",{userId:t}),yield i})}listenForSwitchAccountFinish(e){return(0,bo._)(this.switchAccountFinished$.pipe((0,Eo.p)(({userId:t})=>!e||t===e),(0,wo.w)({first:6e4,with:()=>(0,So.$)(()=>new Error(EF.incompleteAccountSwitchError))}))).catch(e=>{if(e instanceof Error&&e.message===EF.incompleteAccountSwitchError)return this.logService.warning("message 'switchAccount' never responded."),null;throw e})}}EF.incompleteAccountSwitchError="Account switch did not complete.",EF.ɵfac=function(e){return new(e||EF)(a.KVO(Zk),a.KVO(AF),a.KVO(bk),a.KVO(mk),a.KVO(Za),a.KVO(Kb),a.KVO(Rd))},EF.ɵprov=a.jDH({token:EF,factory:EF.ɵfac,providedIn:"root"});const $F={xlarge:["tw-h-24","tw-w-24","tw-min-w-24"],large:["tw-h-16","tw-w-16","tw-min-w-16"],default:["tw-h-10","tw-w-10","tw-min-w-10"],small:["tw-h-7","tw-w-7","tw-min-w-7"],xsmall:["tw-h-6","tw-w-6","tw-min-w-6"]};class OF{constructor(){this.border=(0,o.hFB)(!1),this.color=(0,o.hFB)(),this.id=(0,o.hFB)(),this.text=(0,o.hFB)(),this.title=(0,o.hFB)(),this.size=(0,o.hFB)("default"),this.svgCharCount=2,this.svgFontSize=20,this.svgFontWeight=300,this.svgSize=48,this.classList=(0,Rl.EW)(()=>{var e;return["tw-rounded-full"].concat(null!==(e=$F[this.size()])&&void 0!==e?e:[]).concat(this.border()?["tw-border","tw-border-solid","tw-border-secondary-600"]:[])}),this.backgroundColor=(0,Rl.EW)(()=>{var e,t;const i=this.id(),n=null!==(t=null===(e=this.text())||void 0===e?void 0:e.toUpperCase())&&void 0!==t?t:"";return bd.isNullOrWhitespace(this.color())?bd.isNullOrWhitespace(i)?bd.stringToColor(n):bd.stringToColor(i.toString()):this.color()}),this.textColor=(0,Rl.EW)(()=>bd.pickTextColorBasedOnBgColor(this.backgroundColor(),135,!0)),this.displayChars=(0,Rl.EW)(()=>{var e,t;const i=null!==(t=null===(e=this.text())||void 0===e?void 0:e.toUpperCase())&&void 0!==t?t:"";let n=this.getFirstLetters(i,this.svgCharCount);null==n&&(n=this.unicodeSafeSubstring(i,this.svgCharCount));const r=n.match(bd.regexpEmojiPresentation);return r&&(n=r[0]),n})}getFirstLetters(e,t){const i=e.split(" ");if(i.length>1){let e="";for(let n=0;n<t;n++)e+=this.unicodeSafeSubstring(i[n],1);return e}}unicodeSafeSubstring(e,t){const i=e.match(/./gu);return null!=i?i.slice(0,t).join(""):""}}OF.ɵfac=function(e){return new(e||OF)},OF.ɵcmp=Fl.VBU({type:OF,selectors:[["bit-avatar"]],inputs:{border:[1,"border"],color:[1,"color"],id:[1,"id"],text:[1,"text"],title:[1,"title"],size:[1,"size"]},decls:4,vars:13,consts:[[3,"title"],["xmlns","http://www.w3.org/2000/svg","pointer-events","none",3,"ngClass"],["text-anchor","middle","y","50%","x","50%","dy","0.35em","pointer-events","auto","font-family",'Inter,"Helvetica Neue",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"']],template:function(e,t){1&e&&(Fl.j41(0,"span",0),a.qSk(),Fl.j41(1,"svg",1)(2,"text",2),Fl.EFF(3),Fl.k0s()()()),2&e&&(Fl.Y8G("title",t.title()||t.text()),Fl.R7$(),Fl.xc7("background-color",t.backgroundColor()),Fl.BMQ("viewBox",Fl.ai1("0 0 ",t.svgSize," ",t.svgSize)),Fl.Y8G("ngClass",t.classList()),Fl.R7$(),Fl.xc7("font-weight",t.svgFontWeight)("font-size",t.svgFontSize,"px"),Fl.BMQ("fill",t.textColor()),Fl.R7$(),Fl.SpI(" ",t.displayChars()," "))},dependencies:[kl.YU],encapsulation:2,changeDetection:0});var UF=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function MF(e,t){1&e&&(Fl.j41(0,"span",7),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"activeAccount"),": "))}function NF(e,t){1&e&&(Fl.j41(0,"span",7),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"switchToAccount")," "))}function VF(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-item")(1,"button",1),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.selectAccount(t.account.id))}),Fl.nrm(2,"bit-avatar",2),Fl.DNE(3,MF,3,3,"span",3)(4,NF,3,3,"span",3),Fl.j41(5,"div",4),Fl.EFF(6),Fl.k0s(),Fl.qex(7,5),Fl.j41(8,"div",6)(9,"span",7),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s(),Fl.EFF(12),Fl.k0s(),Fl.j41(13,"div",8)(14,"span",7),Fl.EFF(15,"("),Fl.k0s(),Fl.j41(16,"span",9),Fl.EFF(17),Fl.k0s(),Fl.j41(18,"span",7),Fl.EFF(19,")"),Fl.k0s()(),Fl.bVm(),Fl.nrm(20,"i",10),Fl.k0s()()}if(2&e){const e=Fl.XpG();Fl.R7$(2),Fl.Y8G("id",e.account.id)("text",e.account.name)("color",e.account.avatarColor),Fl.R7$(),Fl.Y8G("ngIf","active"===e.status.text),Fl.R7$(),Fl.Y8G("ngIf","active"!==e.status.text),Fl.R7$(2),Fl.SpI(" ",e.account.email," "),Fl.R7$(4),Fl.JRh(Fl.bMT(11,12,"hostedAt")),Fl.R7$(2),Fl.SpI(" ",e.account.server," "),Fl.R7$(),Fl.BMQ("aria-hidden","active"===e.status.text),Fl.R7$(3),Fl.Y8G("ngClass","active"===e.status.text?"tw-font-medium tw-text-success":""),Fl.R7$(),Fl.JRh(e.status.text),Fl.R7$(3),Fl.Y8G("ngClass",e.status.icon)}}function BF(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-item")(1,"button",11),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.selectAccount(t.account.id))}),Fl.nrm(2,"i",12),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()()}if(2&e){const e=Fl.XpG();Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,1,e.account.name)," ")}}class jF{constructor(e,t,i,n,r){this.accountSwitcherService=e,this.router=t,this.i18nService=i,this.logService=n,this.biometricsService=r,this.loading=new Fl.bkB}get specialAccountAddId(){return this.accountSwitcherService.SPECIAL_ADD_ACCOUNT_ID}selectAccount(e){return UF(this,void 0,void 0,function*(){let t;this.loading.emit(!0);try{t=yield this.accountSwitcherService.selectAccount(e)}catch(e){this.logService.error("Error selecting account",e)}(null==t?void 0:t.authenticationStatus)===Pd.Unlocked?(yield this.router.navigate(["vault"]),yield this.biometricsService.setShouldAutopromptNow(!1)):yield this.biometricsService.setShouldAutopromptNow(!0),this.loading.emit(!1)})}get status(){return this.account.isActive?{text:this.i18nService.t("active"),icon:"bwi-check-circle"}:this.account.status===Pd.Unlocked?{text:this.i18nService.t("unlocked"),icon:"bwi-unlock"}:{text:this.i18nService.t("locked"),icon:"bwi-lock"}}}jF.ɵfac=function(e){return new(e||jF)(Fl.rXU(EF),Fl.rXU(Fd.Ix),Fl.rXU(Ul),Fl.rXU(Za),Fl.rXU(Vp))},jF.ɵcmp=Fl.VBU({type:jF,selectors:[["auth-account"]],inputs:{account:"account"},outputs:{loading:"loading"},decls:2,vars:2,consts:[[4,"ngIf"],["bit-item-content","","type","button",3,"click"],["slot","start","size","small","aria-hidden","true",3,"id","text","color"],["class","tw-sr-only",4,"ngIf"],[1,"tw-max-w-64","tw-truncate"],["slot","secondary"],[1,"tw-max-w-64","tw-truncate","tw-text-sm"],[1,"tw-sr-only"],[1,"tw-text-sm","tw-italic"],[3,"ngClass"],["slot","end","aria-hidden","true",1,"bwi","tw-text-lg",3,"ngClass"],["type","button","bit-item-content","",3,"click"],["slot","start","aria-hidden","true",1,"bwi","bwi-plus","tw-text-lg","tw-text-main"]],template:function(e,t){1&e&&Fl.DNE(0,VF,21,14,"bit-item",0)(1,BF,5,3,"bit-item",0),2&e&&(Fl.Y8G("ngIf",t.account.id!==t.specialAccountAddId),Fl.R7$(),Fl.Y8G("ngIf",t.account.id===t.specialAccountAddId))},dependencies:[kl.MD,kl.YU,kl.bT,sf,RF,OF,VP,GP,KP,rf],encapsulation:2});var GF=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function LF(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",3),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.currentAccountClicked())}),Fl.j41(1,"span",4),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"bit-avatar",5),Fl.k0s()}if(2&e){const e=t.ngIf;Fl.R7$(2),Fl.Lme(" ",Fl.bMT(3,5,"bitwardenAccount")," ",e.email),Fl.R7$(2),Fl.Y8G("id",e.id)("text",e.name)("color",e.avatarColor)}}function zF(e,t){1&e&&(Fl.j41(0,"button",6)(1,"span",4),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"bit-avatar",7),Fl.k0s()),2&e&&(Fl.R7$(2),Fl.JRh(Fl.bMT(3,3,"switchAccounts")),Fl.R7$(2),Fl.Y8G("text","…")("color","#6795E8"))}class _F{constructor(e,t,i,n,r,s){this.accountService=e,this.avatarService=t,this.router=i,this.location=n,this.route=r,this.authService=s,this.currentAccount$=(0,jo.z)([this.accountService.activeAccount$,this.avatarService.avatarColor$,this.authService.activeAccountStatus$]).pipe((0,go.n)(e=>GF(this,[e],void 0,function*([e,t,i]){if(null==e)return null;return{id:e.id,name:e.name||e.email,email:e.email,status:i,avatarColor:t}})))}currentAccountClicked(){return GF(this,void 0,void 0,function*(){var e,t;(null===(t=null===(e=this.route.snapshot.data)||void 0===e?void 0:e.state)||void 0===t?void 0:t.includes("account-switcher"))?this.location.back():yield this.router.navigate(["/account-switcher"])})}}_F.ɵfac=function(e){return new(e||_F)(Fl.rXU(Zk),Fl.rXU(AF),Fl.rXU(Fd.Ix),Fl.rXU(IF.aZ),Fl.rXU(Fd.nX),Fl.rXU(Rd))},_F.ɵcmp=Fl.VBU({type:_F,selectors:[["app-current-account"]],decls:5,vars:4,consts:[["defaultButton",""],[1,"tw-me-2","tw-mt-1"],["type","button","class","tw-rounded-full hover:tw-outline hover:tw-outline-1 hover:tw-outline-primary-600",3,"click",4,"ngIf","ngIfElse"],["type","button",1,"tw-rounded-full","hover:tw-outline","hover:tw-outline-1","hover:tw-outline-primary-600",3,"click"],[1,"tw-sr-only"],["size","small","aria-hidden","true",3,"id","text","color"],["type","button","routerLink","/account-switcher",1,"tw-rounded-full","hover:tw-outline","hover:tw-outline-1","hover:tw-outline-offset-1"],["size","small","aria-hidden","true",1,"[&>img]:tw-block",3,"text","color"]],template:function(e,t){if(1&e&&(Fl.j41(0,"div",1),Fl.DNE(1,LF,5,7,"button",2),Fl.nI1(2,"async"),Fl.DNE(3,zF,5,5,"ng-template",null,0,Fl.C5r),Fl.k0s()),2&e){const e=Fl.sdS(4);Fl.R7$(),Fl.Y8G("ngIf",Fl.bMT(2,2,t.currentAccount$))("ngIfElse",e)}},dependencies:[kl.MD,kl.bT,sf,RF,OF,Cw.iI,Cw.Wk,kl.Jj,rf],encapsulation:2});var KF=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class XF{constructor(){this.apiService=(0,a.WQX)(eI),this.userId=null,this.profileCreatedDate=null}getProfileCreationDate(e){return KF(this,void 0,void 0,function*(){if(this.profileCreatedDate&&e===this.userId)return Promise.resolve(new Date(this.profileCreatedDate));const t=yield this.fetchAndCacheProfile();return new Date(t.creationDate)})}fetchAndCacheProfile(){return KF(this,void 0,void 0,function*(){const e=yield this.apiService.getProfile();return this.userId=e.id,this.profileCreatedDate=e.creationDate,e})}}function qF(e){return(0,l.T)(t=>t.find(t=>t.id===e))}XF.ɵfac=function(e){return new(e||XF)},XF.ɵprov=a.jDH({token:XF,factory:XF.ɵfac,providedIn:"root"});class WF{}class YF extends WF{}class HF{}var JF=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class ZF{constructor(e){this.stateProvider=e}getNudgeStatus$(e,t){return this.stateProvider.getUser(t,kx).state$.pipe((0,l.T)(t=>{var i;return null!==(i=null==t?void 0:t[e])&&void 0!==i?i:{hasBadgeDismissed:!1,hasSpotlightDismissed:!1}}))}nudgeStatus$(e,t){return this.getNudgeStatus$(e,t)}setNudgeStatus(e,t,i){return JF(this,void 0,void 0,function*(){yield this.stateProvider.getUser(i,kx).update(i=>(null!=i||(i={}),i[e]=t,i))})}}ZF.ɵfac=function(e){return new(e||ZF)(a.KVO(u))},ZF.ɵprov=a.jDH({token:ZF,factory:ZF.ɵfac,providedIn:"root"});var QF=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class eR extends ZF{constructor(){super(...arguments),this.vaultProfileService=(0,a.WQX)(XF),this.logService=(0,a.WQX)(Za),this.pinService=(0,a.WQX)(HF),this.biometricStateService=(0,a.WQX)(Mp),this.policyService=(0,a.WQX)(Jb),this.organizationService=(0,a.WQX)(WF)}nudgeStatus$(e,t){const i=(0,$d.H)(this.vaultProfileService.getProfileCreationDate(t)).pipe((0,Ed.W)(()=>(this.logService.error("Failed to load profile date:"),(0,Go.of)(new Date))));return(0,jo.z)([i,this.getNudgeStatus$(e,t),(0,Go.of)(Date.now()-2592e6),(0,$d.H)(this.pinService.isPinSet(t)),this.biometricStateService.biometricUnlockEnabled$(t),this.organizationService.organizations$(t),this.policyService.policiesByType$(op.RemoveUnlockWithPin,t)]).pipe((0,go.n)(i=>QF(this,[i],void 0,function*([i,n,r,s,o,a,l]){const c=i.getTime()<r,u=a.some(e=>l.some(t=>t.type===op.RemoveUnlockWithPin&&t.organizationId===e.id)),d=c||s||o||u,h={hasBadgeDismissed:n.hasBadgeDismissed||d,hasSpotlightDismissed:n.hasSpotlightDismissed||d};return(s||o||u)&&!n.hasSpotlightDismissed&&(yield this.setNudgeStatus(e,h,t)),h})))}}eR.ɵfac=(()=>{let e;return function(t){return(e||(e=Fl.xGo(eR)))(t||eR)}})(),eR.ɵprov=a.jDH({token:eR,factory:eR.ɵfac,providedIn:"root"});class tR{}class iR{constructor(){this.enabled=!1,this.showSetupDialog=!0}}const nR=k.record(x,"autoConfirm",{deserializer:e=>e,clearOn:[]}),rR=e=>(0,l.T)(t=>t.find(t=>t.id===e)),sR=e=>{const t=new Set(e);return(0,l.T)(e=>e.filter(e=>e.id&&t.has(e.id)))};var oR=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class aR extends ZF{constructor(e,t){super(e),this.autoConfirmService=t}nudgeStatus$(e,t){return(0,jo.z)([this.getNudgeStatus$(e,t),this.autoConfirmService.configuration$(t),this.autoConfirmService.canManageAutoConfirm$(t)]).pipe((0,l.T)(([e,t,i])=>{if(!i)return{hasBadgeDismissed:!0,hasSpotlightDismissed:!0};if(e.hasBadgeDismissed||e.hasSpotlightDismissed)return e;const n=!1===t.showBrowserNotification;return{hasBadgeDismissed:n,hasSpotlightDismissed:n}}))}}aR.ɵfac=function(e){return new(e||aR)(a.KVO(u),a.KVO(tR))},aR.ɵprov=a.jDH({token:aR,factory:aR.ɵfac});var lR=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class cR extends ZF{constructor(){super(...arguments),this.cipherService=(0,a.WQX)(_b),this.accountService=(0,a.WQX)(Zk),this.logService=(0,a.WQX)(Za)}nudgeStatus$(e,t){const i=this.accountService.activeAccount$.pipe((0,l.T)(e=>{var t;return null!==(t=null==e?void 0:e.creationDate)&&void 0!==t?t:new Date}),(0,Ed.W)(()=>(this.logService.error("Error getting profile creation date"),(0,Go.of)(new Date))));return(0,jo.z)([this.cipherService.cipherViews$(t),this.getNudgeStatus$(e,t),i,(0,Go.of)(Date.now()-2592e6)]).pipe((0,go.n)(i=>lR(this,[i],void 0,function*([i,n,r,s]){const o=r.getTime()<s,a=null==i?void 0:i.filter(e=>null==e.deletedDate);if(o&&a.length>0&&!n.hasSpotlightDismissed){const i={hasSpotlightDismissed:!0,hasBadgeDismissed:!0};return yield this.setNudgeStatus(e,i,t),yield this.setNudgeStatus(Sx.EmptyVaultNudge,i,t),i}return n.hasSpotlightDismissed?n:{hasBadgeDismissed:null==a||0===a.length,hasSpotlightDismissed:null==a||0===a.length}})))}}cR.ɵfac=(()=>{let e;return function(t){return(e||(e=Fl.xGo(cR)))(t||cR)}})(),cR.ɵprov=a.jDH({token:cR,factory:cR.ɵfac,providedIn:"root"});class uR{}class dR{constructor(e){this.groups=[],this.users=[],this.externalId=e.externalId,e.groups&&(this.groups=e.groups),e.users&&(this.users=e.users)}}dR.isUpdate=e=>e instanceof hR;class hR extends dR{constructor(e){var t,i;super(e),this.name=null!==(i=null===(t=e.name)||void 0===t?void 0:t.encryptedString)&&void 0!==i?i:null}}class pR extends dR{constructor(e){if(null==e||null==e.name||null==e.name.encryptedString)throw new Error("CollectionWithIdRequest must contain name.");super({externalId:e.externalId}),this.name=e.name.encryptedString,this.id=e.id}}class vR{}class fR extends vR{constructor(e){super(),e&&(this.id=e.id,this.readOnly=e.readOnly,this.hidePasswords=e.hidePasswords,this.manage=e.manage)}}var mR=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const gR=0,yR=1;class bR extends sv{constructor(e){super(),this.readOnly=!1,this.hidePasswords=!1,this.manage=!1,this.type=gR,this.id=e.id,this.name=e.name,this.organizationId=e.organizationId}static fromCollectionData(e){if(null==e||null==e.name||null==e.organizationId)throw new Error("CollectionData must contain name and organizationId.");const t=new bR(Object.assign(Object.assign({},e),{name:new Pp(e.name)}));return t.externalId=e.externalId,t.readOnly=e.readOnly,t.hidePasswords=e.hidePasswords,t.manage=e.manage,t.type=e.type,t.defaultUserCollectionEmail=e.defaultUserCollectionEmail,t}static fromCollectionView(e,t,i){return mR(this,void 0,void 0,function*(){const n=new bR({name:yield t.encryptString(e.name,i),id:e.id,organizationId:e.organizationId});return n.externalId=e.externalId,n.readOnly=e.readOnly,n.hidePasswords=e.hidePasswords,n.manage=e.manage,n.type=e.type,n})}decrypt(e,t){return SR.fromCollection(this,t,e)}static isCollectionId(e){return"string"==typeof e&&null!=e}}var wR=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class SR{constructor(e){this.readOnly=!1,this.hidePasswords=!1,this.manage=!1,this.assigned=!1,this.type=gR,this.id=e.id,this.organizationId=e.organizationId,this._name=e.name}set name(e){this._name=e}get name(){var e;return null!==(e=this.defaultUserCollectionEmail)&&void 0!==e?e:this._name}canEditItems(e){if(null!=e&&e.id!==this.organizationId)throw new Error("Id of the organization provided does not match the org id of the collection.");return(null==e?void 0:e.canEditAllCiphers)||this.manage||this.assigned&&!this.readOnly}canEdit(e){if(this.isDefaultCollection)return!1;if(null!=e&&e.id!==this.organizationId)throw new Error("Id of the organization provided does not match the org id of the collection.");return this.manage}canDelete(e){if(null!=e&&e.id!==this.organizationId)throw new Error("Id of the organization provided does not match the org id of the collection.");return(!(null==e?void 0:e.limitCollectionDeletion)||e.isAdmin)&&this.manage&&!this.isDefaultCollection}canViewCollectionInfo(e){return!1}canEditName(e){return this.canEdit(e)&&!this.defaultUserCollectionEmail}get isDefaultCollection(){return this.type==yR}static vaultFilterHead(){return new SR({id:"",organizationId:"",name:""})}static fromCollection(e,t,i){return wR(this,void 0,void 0,function*(){const n=new SR(Object.assign(Object.assign({},e),{name:""}));try{n.name=yield t.decryptString(e.name,i)}catch(e){n.name="[error: cannot decrypt]",console.error("[CollectionView] Error decrypting collection name",e)}return n.assigned=!0,n.externalId=e.externalId,n.readOnly=e.readOnly,n.hidePasswords=e.hidePasswords,n.manage=e.manage,n.type=e.type,n.defaultUserCollectionEmail=e.defaultUserCollectionEmail,n})}static fromCollectionAccessDetails(e,t,i){return wR(this,void 0,void 0,function*(){const n=new SR(Object.assign({},e));try{n.name=yield t.decryptString(new Pp(e.name),i)}catch(e){throw console.error("[CollectionView] Error decrypting collection name",e),e}return n.externalId=e.externalId,n.type=e.type,n.assigned=e.assigned,n.defaultUserCollectionEmail=e.defaultUserCollectionEmail,n})}static fromJSON(e){return Object.assign(new SR(Object.assign({},e)),e)}encrypt(e,t){return bR.fromCollectionView(this,t,e)}}var kR=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const IR="unassigned";class CR extends SR{constructor(){super(...arguments),this.groups=[],this.users=[],this.unmanaged=!1,this.assigned=!1}canEdit(e){return!this.isDefaultCollection&&((null==e?void 0:e.canEditAnyCollection)||this.unmanaged&&(null==e?void 0:e.canEditUnmanagedCollections)||super.canEdit(e))}canDelete(e){return!this.isDefaultCollection&&((null==e?void 0:e.canDeleteAnyCollection)||super.canDelete(e))}canEditUserAccess(e){return!this.isDefaultCollection&&(e.permissions.manageUsers&&e.allowAdminAccessToAllCollectionItems||this.canEdit(e))}canEditGroupAccess(e){return!this.isDefaultCollection&&(e.permissions.manageGroups&&e.allowAdminAccessToAllCollectionItems||this.canEdit(e))}canViewCollectionInfo(e){var t,i;if(this.isUnassignedCollection||this.isDefaultCollection)return!1;const n=null!==(t=null==e?void 0:e.isAdmin)&&void 0!==t&&t,r=null!==(i=null==e?void 0:e.permissions.editAnyCollection)&&void 0!==i&&i;return this.manage||n||r}get isUnassignedCollection(){return this.id===IR}canEditName(e){return this.canEdit(e)&&!this.defaultUserCollectionEmail||super.canEditName(e)}static fromCollectionAccessDetails(e,t,i){return kR(this,void 0,void 0,function*(){const n=new CR(Object.assign({},e));try{n.name=yield t.decryptString(new Pp(n.name),i)}catch(e){n.name="[error: cannot decrypt]",console.error("[CollectionAdminView/fromCollectionAccessDetails] Error decrypting collection name",e)}return n.assigned=e.assigned,n.readOnly=e.readOnly,n.hidePasswords=e.hidePasswords,n.manage=e.manage,n.unmanaged=e.unmanaged,n.type=e.type,n.externalId=e.externalId,n.defaultUserCollectionEmail=e.defaultUserCollectionEmail,n.groups=e.groups?e.groups.map(e=>new fR(e)):[],n.users=e.users?e.users.map(e=>new fR(e)):[],n})}static fromCollectionResponse(e,t,i){return kR(this,void 0,void 0,function*(){let n;try{n=yield t.decryptString(new Pp(e.name),i)}catch(e){throw console.error("[CollectionAdminView/fromCollectionResponse] Failed to decrypt the collection name",e),e}const r=new CR({id:e.id,name:n,organizationId:e.organizationId});return r.externalId=e.externalId,r})}}class TR extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.readOnly=this.getResponseProperty("ReadOnly"),this.hidePasswords=this.getResponseProperty("HidePasswords"),this.manage=this.getResponseProperty("Manage")}}class PR extends tS{constructor(e){var t;super(e),this.type=gR,this.id=this.getResponseProperty("Id"),this.organizationId=this.getResponseProperty("OrganizationId"),this.name=this.getResponseProperty("Name"),this.externalId=this.getResponseProperty("ExternalId"),this.defaultUserCollectionEmail=this.getResponseProperty("DefaultUserCollectionEmail"),this.type=null!==(t=this.getResponseProperty("Type"))&&void 0!==t?t:gR}}class FR extends PR{constructor(e){super(e),this.readOnly=this.getResponseProperty("ReadOnly")||!1,this.manage=this.getResponseProperty("Manage")||!1,this.hidePasswords=this.getResponseProperty("HidePasswords")||!1,this.assigned="collectionDetails"==this.getResponseProperty("object")}}class RR extends FR{constructor(e){super(e),this.groups=[],this.users=[],this.assigned=this.getResponseProperty("Assigned")||!1,this.unmanaged=this.getResponseProperty("Unmanaged")||!1;const t=this.getResponseProperty("Groups");null!=t&&(this.groups=t.map(e=>new TR(e)));const i=this.getResponseProperty("Users");null!=i&&(this.users=i.map(e=>new TR(e)))}}class xR{constructor(e){this.readOnly=!1,this.manage=!1,this.hidePasswords=!1,this.type=gR,this.id=e.id,this.organizationId=e.organizationId,this.name=e.name,this.externalId=e.externalId,this.readOnly=e.readOnly,this.manage=e.manage,this.hidePasswords=e.hidePasswords,this.type=e.type,this.defaultUserCollectionEmail=e.defaultUserCollectionEmail}static fromJSON(e){return null==e?null:Object.assign(new xR(new FR({})),e)}}var AR=i(84679);class DR{constructor(e,t,i,n){this.children=[],this.parent=t,this.node=e,i&&(this.node.name=i),n&&(this.node.id=n)}}class ER{static nestedTraverse(e,t,i,n,r,s){if(i.length<=t)return;const o=t===i.length-1,a=i[t];if(o)return void e.push(new DR(n,r,a));const l=e.filter(e=>e.node.name===a);if(0===l.length){const o=a+s+i[t+1];ER.nestedTraverse(e,0,[o,...i.slice(t+2)],n,r,s)}else ER.nestedTraverse(l[0].children,t+1,i,n,l[0],s)}static getTreeNodeObject(e,t){if(e.node.id===t)return e;for(let i=0;i<e.children.length;i++)if(null!=e.children[i].children){const n=ER.getTreeNodeObject(e.children[i],t);if(null!==n)return n}return null}static getTreeNodeObjectFromList(e,t){for(let i=0;i<e.length;i++){if(e[i].node.id===t)return e[i];if(null!=e[i].children){const n=ER.getTreeNodeObjectFromList(e[i].children,t);if(null!==n)return n}}return null}}const $R=k.record(Se,"collections",{deserializer:e=>xR.fromJSON(e),clearOn:["logout"]}),OR=new k(ke,"decryptedCollections",{deserializer:e=>{var t;return null!==(t=null==e?void 0:e.map(e=>SR.fromJSON(e)))&&void 0!==t?t:null},clearOn:["logout","lock"]});var UR=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class MR{}class NR{}class VR{constructor(e){this.ids=null==e?[]:e}}class BR extends tS{constructor(e=null){if(super(e),null==e)return this;this.accessEventLogs=this.getResponseProperty("AccessEventLogs"),this.accessImportExport=this.getResponseProperty("AccessImportExport"),this.accessReports=this.getResponseProperty("AccessReports"),this.createNewCollections=this.getResponseProperty("CreateNewCollections"),this.editAnyCollection=this.getResponseProperty("EditAnyCollection"),this.deleteAnyCollection=this.getResponseProperty("DeleteAnyCollection"),this.manageCiphers=this.getResponseProperty("ManageCiphers"),this.manageGroups=this.getResponseProperty("ManageGroups"),this.manageSso=this.getResponseProperty("ManageSso"),this.managePolicies=this.getResponseProperty("ManagePolicies"),this.manageUsers=this.getResponseProperty("ManageUsers"),this.manageResetPassword=this.getResponseProperty("ManageResetPassword"),this.manageScim=this.getResponseProperty("ManageScim")}}class jR extends tS{constructor(e){super(e),this.collections=[],this.groups=[],this.id=this.getResponseProperty("Id"),this.userId=this.getResponseProperty("UserId"),this.type=this.getResponseProperty("Type"),this.status=this.getResponseProperty("Status"),this.permissions=new BR(this.getResponseProperty("Permissions")),this.externalId=this.getResponseProperty("ExternalId"),this.accessSecretsManager=this.getResponseProperty("AccessSecretsManager"),this.resetPasswordEnrolled=this.getResponseProperty("ResetPasswordEnrolled"),this.hasMasterPassword=this.getResponseProperty("HasMasterPassword");const t=this.getResponseProperty("Collections");null!=t&&(this.collections=t.map(e=>new TR(e)));const i=this.getResponseProperty("Groups");null!=i&&(this.groups=i)}}class GR extends jR{constructor(e){var t,i;super(e),this.name=this.getResponseProperty("Name"),this.email=this.getResponseProperty("Email"),this.avatarColor=this.getResponseProperty("AvatarColor"),this.twoFactorEnabled=this.getResponseProperty("TwoFactorEnabled"),this.usesKeyConnector=null!==(t=this.getResponseProperty("UsesKeyConnector"))&&void 0!==t&&t,this.managedByOrganization=null!==(i=this.getResponseProperty("ManagedByOrganization"))&&void 0!==i&&i}}class LR extends jR{constructor(e){var t;super(e),this.managedByOrganization=null!==(t=this.getResponseProperty("ManagedByOrganization"))&&void 0!==t&&t,this.ssoExternalId=this.getResponseProperty("SsoExternalId")}}class zR extends tS{constructor(e){super(e),this.organizationUserId=this.getResponseProperty("OrganizationUserId"),this.kdf=this.getResponseProperty("Kdf"),this.kdfIterations=this.getResponseProperty("KdfIterations"),this.kdfMemory=this.getResponseProperty("KdfMemory"),this.kdfParallelism=this.getResponseProperty("KdfParallelism"),this.resetPasswordKey=this.getResponseProperty("ResetPasswordKey"),this.encryptedPrivateKey=this.getResponseProperty("EncryptedPrivateKey")}}class _R extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.error=this.getResponseProperty("Error")}}class KR extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.userId=this.getResponseProperty("UserId"),this.key=this.getResponseProperty("Key")}}class XR extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.userId=this.getResponseProperty("UserId"),this.email=this.getResponseProperty("Email"),this.name=this.getResponseProperty("Name"),this.type=this.getResponseProperty("Type"),this.status=this.getResponseProperty("Status")}}var qR=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class WR{constructor(e,t){this.ids=e,this.defaultUserCollectionName=t}}class YR{constructor(e){this.defaultUserCollectionName=e}}class HR{constructor(e,t){this.keys=e,this.defaultUserCollectionName=t}}class JR{static newConstructor(e,t){const i=new JR;return i.newMasterPasswordHash=e.masterPasswordAuthenticationHash,i.key=t.masterKeyWrappedUserKey,i}}class ZR extends bP{}class QR extends ZF{constructor(){super(...arguments),this.cipherService=(0,a.WQX)(_b),this.organizationService=(0,a.WQX)(WF),this.collectionService=(0,a.WQX)(uR)}nudgeStatus$(e,t){return(0,jo.z)([this.getNudgeStatus$(e,t),this.cipherService.cipherListViews$(t),this.organizationService.organizations$(t),this.collectionService.decryptedCollections$(t)]).pipe((0,go.n)(([e,t,i,n])=>{const r=!(null==t||0===t.length);if(null==i||0===i.length)return e.hasBadgeDismissed||e.hasSpotlightDismissed?(0,Go.of)(e):(0,Go.of)({hasSpotlightDismissed:r,hasBadgeDismissed:r});const s=new Set(i.map(e=>e.id)),o=i.some(e=>e.canCreateNewCollections),a=n.some(e=>e.manage&&s.has(e.organizationId));return e.hasBadgeDismissed||e.hasSpotlightDismissed?(0,Go.of)(e):a||o?(0,Go.of)({hasSpotlightDismissed:r,hasBadgeDismissed:r}):(0,Go.of)({hasSpotlightDismissed:!0,hasBadgeDismissed:!0})}))}}QR.ɵfac=(()=>{let e;return function(t){return(e||(e=Fl.xGo(QR)))(t||QR)}})(),QR.ɵprov=a.jDH({token:QR,factory:QR.ɵfac,providedIn:"root"});class ex extends ZF{constructor(){super(...arguments),this.cipherService=(0,a.WQX)(_b),this.organizationService=(0,a.WQX)(WF),this.collectionService=(0,a.WQX)(uR)}nudgeStatus$(e,t){return(0,jo.z)([this.getNudgeStatus$(e,t),this.cipherService.cipherViews$(t),this.organizationService.organizations$(t),this.collectionService.decryptedCollections$(t)]).pipe((0,go.n)(([e,t,i,n])=>{var r,s;const o=(null!==(r=null==t?void 0:t.length)&&void 0!==r?r:0)>1,{hasBadgeDismissed:a,hasSpotlightDismissed:l}=e;if(0===(null!==(s=null==i?void 0:i.length)&&void 0!==s?s:0))return a||l?(0,Go.of)(e):(0,Go.of)({hasSpotlightDismissed:o,hasBadgeDismissed:o});const c=new Set(i.map(e=>e.id)),u=i.some(e=>e.canCreateNewCollections),d=n.some(e=>e.manage&&c.has(e.organizationId));return a||l?(0,Go.of)(e):d||u?(0,Go.of)({hasSpotlightDismissed:o,hasBadgeDismissed:o}):(0,Go.of)({hasSpotlightDismissed:!0,hasBadgeDismissed:!0})}))}}ex.ɵfac=(()=>{let e;return function(t){return(e||(e=Fl.xGo(ex)))(t||ex)}})(),ex.ɵprov=a.jDH({token:ex,factory:ex.ɵfac,providedIn:"root"});const tx={None:0,Password:1};function ix(e){switch(e){case tx.None:case tx.Password:return e;default:return tx.None}}const nx=Object.freeze({Login:1,SecureNote:2,Card:3,Identity:4,SshKey:5}),rx=Object.freeze(Object.fromEntries(Object.entries(nx).map(([e,t])=>[t,e])));const sx=e=>Object.values(nx).includes(e),ox=Object.freeze({Text:0,Hidden:1,Boolean:2,Linked:3});function ax(e){switch(e){case ox.Text:case ox.Hidden:case ox.Boolean:case ox.Linked:return e;default:return ox.Text}}const lx={Username:100,Password:101},cx={CardholderName:300,ExpMonth:301,ExpYear:302,Code:303,Brand:304,Number:305},ux={Title:400,MiddleName:401,Address1:402,Address2:403,Address3:404,City:405,State:406,PostalCode:407,Country:408,Company:409,Email:410,Phone:411,Ssn:412,Username:413,PassportNumber:414,LicenseNumber:415,FirstName:416,LastName:417,FullName:418};function dx(e){if(null==e)return;return[...Object.values(lx),...Object.values(cx),...Object.values(ux)].includes(e)?e:void 0}const hx=0;var px=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class vx extends ZF{constructor(){super(...arguments),this.cipherService=(0,a.WQX)(_b)}nudgeStatus$(e,t){return(0,jo.z)([this.getNudgeStatus$(e,t),this.cipherService.cipherViews$(t).pipe((0,Eo.p)(e=>null!=e))]).pipe((0,go.n)(i=>px(this,[i],void 0,function*([i,n]){if(i.hasSpotlightDismissed)return i;let r;switch(e){case Sx.NewLoginItemStatus:r=nx.Login;break;case Sx.NewCardItemStatus:r=nx.Card;break;case Sx.NewIdentityItemStatus:r=nx.Identity;break;case Sx.NewNoteItemStatus:r=nx.SecureNote;break;case Sx.NewSshItemStatus:r=nx.SshKey}if(n.some(e=>e.type===r)&&!i.hasSpotlightDismissed){const i={hasSpotlightDismissed:!0,hasBadgeDismissed:!0};return yield this.setNudgeStatus(e,i,t),i}return i})))}}vx.ɵfac=(()=>{let e;return function(t){return(e||(e=Fl.xGo(vx)))(t||vx)}})(),vx.ɵprov=a.jDH({token:vx,factory:vx.ɵfac,providedIn:"root"});class fx extends ZF{constructor(e,t,i){super(e),this.vaultProfileService=t,this.logService=i}nudgeStatus$(e,t){const i=(0,$d.H)(this.vaultProfileService.getProfileCreationDate(t)).pipe((0,Ed.W)(()=>(this.logService.error("Error getting profile creation date"),(0,Go.of)(new Date))));return(0,jo.z)([i,this.getNudgeStatus$(e,t),(0,Go.of)(Date.now()-2592e6)]).pipe((0,l.T)(([e,t,i])=>{const n=e.getTime()<i;return{hasBadgeDismissed:t.hasBadgeDismissed||n,hasSpotlightDismissed:t.hasSpotlightDismissed||n}}))}}fx.ɵfac=function(e){return new(e||fx)(a.KVO(u),a.KVO(XF),a.KVO(Za))},fx.ɵprov=a.jDH({token:fx,factory:fx.ɵfac,providedIn:"root"});var mx=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class gx{nudgeStatus$(e,t){return(0,Go.of)({hasBadgeDismissed:!0,hasSpotlightDismissed:!0})}setNudgeStatus(e,t,i){return mx(this,void 0,void 0,function*(){})}}gx.ɵfac=function(e){return new(e||gx)},gx.ɵprov=a.jDH({token:gx,factory:gx.ɵfac,providedIn:"root"});const yx=new a.nKC("AutofillNudgeService"),bx=new a.nKC("AutoConfirmNudgeService");var wx=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Sx={EmptyVaultNudge:"empty-vault-nudge",VaultSettingsImportNudge:"vault-settings-import-nudge",HasVaultItems:"has-vault-items",AutofillNudge:"autofill-nudge",AccountSecurity:"account-security",DownloadBitwarden:"download-bitwarden",NewLoginItemStatus:"new-login-item-status",NewCardItemStatus:"new-card-item-status",NewIdentityItemStatus:"new-identity-item-status",NewNoteItemStatus:"new-note-item-status",NewSshItemStatus:"new-ssh-item-status",GeneratorNudgeStatus:"generator-nudge-status",AutoConfirmNudge:"auto-confirm-nudge",PremiumUpgrade:"premium-upgrade"},kx=new k(Ue,"vaultNudgeDismissed",{deserializer:e=>e,clearOn:[]});class Ix{constructor(){var e,t;this.newItemNudgeService=(0,a.WQX)(vx),this.newAcctNudgeService=(0,a.WQX)(fx),this.noOpNudgeService=(0,a.WQX)(gx),this.autofillNudgeService=(0,a.WQX)(yx,{optional:!0}),this.autoConfirmNudgeService=(0,a.WQX)(bx,{optional:!0}),this.customNudgeServices={[Sx.HasVaultItems]:(0,a.WQX)(cR),[Sx.EmptyVaultNudge]:(0,a.WQX)(QR),[Sx.VaultSettingsImportNudge]:(0,a.WQX)(ex),[Sx.AccountSecurity]:(0,a.WQX)(eR),[Sx.AutofillNudge]:null!==(e=this.autofillNudgeService)&&void 0!==e?e:this.noOpNudgeService,[Sx.DownloadBitwarden]:this.newAcctNudgeService,[Sx.GeneratorNudgeStatus]:this.newAcctNudgeService,[Sx.NewLoginItemStatus]:this.newItemNudgeService,[Sx.NewCardItemStatus]:this.newItemNudgeService,[Sx.NewIdentityItemStatus]:this.newItemNudgeService,[Sx.NewNoteItemStatus]:this.newItemNudgeService,[Sx.NewSshItemStatus]:this.newItemNudgeService,[Sx.AutoConfirmNudge]:null!==(t=this.autoConfirmNudgeService)&&void 0!==t?t:this.noOpNudgeService},this.defaultNudgeService=(0,a.WQX)(ZF)}getNudgeService(e){var t;return null!==(t=this.customNudgeServices[e])&&void 0!==t?t:this.defaultNudgeService}showNudgeSpotlight$(e,t){return this.getNudgeService(e).nudgeStatus$(e,t).pipe((0,l.T)(e=>!e.hasSpotlightDismissed))}showNudgeBadge$(e,t){return this.getNudgeService(e).nudgeStatus$(e,t).pipe((0,l.T)(e=>!e.hasBadgeDismissed))}showNudgeStatus$(e,t){return this.getNudgeService(e).nudgeStatus$(e,t)}dismissNudge(e,t){return wx(this,arguments,void 0,function*(e,t,i=!1){const n=i?{hasBadgeDismissed:!0,hasSpotlightDismissed:!1}:{hasBadgeDismissed:!0,hasSpotlightDismissed:!0};yield this.getNudgeService(e).setNudgeStatus(e,n,t)})}hasActiveBadges$(e){const t=[Sx.EmptyVaultNudge,Sx.DownloadBitwarden,Sx.AutofillNudge,Sx.AutoConfirmNudge].map(t=>this.getNudgeService(t).nudgeStatus$(t,e).pipe((0,l.T)(e=>!(null==e?void 0:e.hasBadgeDismissed)),(0,Gp.t)({refCount:!1,bufferSize:1})));return(0,jo.z)(t).pipe((0,l.T)(e=>e.some(e=>!0===e)))}}Ix.ɵfac=function(e){return new(e||Ix)},Ix.ɵprov=a.jDH({token:Ix,factory:Ix.ɵfac,providedIn:"root"});function Cx(e,t){if(1&e&&(Fl.j41(0,"h2",7),Fl.EFF(1),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.JRh(e.title())}}function Tx(e,t){if(1&e&&Fl.nrm(0,"p",8),2&e){const e=Fl.XpG();Fl.Y8G("innerHTML",e.subtitle(),Fl.npT)}}function Px(e,t){1&e&&Fl.SdG(0,0,["*ngIf","!subtitle()"])}function Fx(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",9),Fl.nI1(1,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.handleDismiss())}),Fl.k0s()}2&e&&Fl.Y8G("label",Fl.bMT(1,1,"close"))}function Rx(e,t){if(1&e&&Fl.nrm(0,"i",12),2&e){const e=Fl.XpG(2);Fl.Y8G("ngClass",e.buttonIcon())}}function xx(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",10),Fl.bIt("click",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.handleButtonClick(t))}),Fl.EFF(1),Fl.DNE(2,Rx,1,1,"i",11),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.R7$(),Fl.SpI(" ",e.buttonText()," "),Fl.R7$(),Fl.Y8G("ngIf",e.buttonIcon())}}class Ax{constructor(){this.title=(0,o.hFB)(),this.subtitle=(0,o.hFB)(),this.buttonText=(0,o.hFB)(),this.persistent=(0,o.hFB)(!1,{transform:o.L39}),this.buttonIcon=(0,o.hFB)(),this.onDismiss=(0,o.CGW)(),this.onButtonClick=(0,o.CGW)()}handleButtonClick(e){this.onButtonClick.emit(e)}handleDismiss(){this.onDismiss.emit()}}Ax.ɵfac=function(e){return new(e||Ax)},Ax.ɵcmp=Fl.VBU({type:Ax,selectors:[["bit-spotlight"]],inputs:{title:[1,"title"],subtitle:[1,"subtitle"],buttonText:[1,"buttonText"],persistent:[1,"persistent"],buttonIcon:[1,"buttonIcon"]},outputs:{onDismiss:"onDismiss",onButtonClick:"onButtonClick"},ngContentSelectors:["*"],decls:8,vars:5,consts:[[1,"tw-rounded-2xl","tw-bg-primary-100","tw-border-primary-600","tw-border-solid","tw-border","tw-p-4","tw-pt-2","tw-flex","tw-flex-col","tw-gap-2","tw-mb-4"],[1,"tw-flex","tw-justify-between","tw-items-start","tw-flex-grow"],["bitTypography","h4","class","tw-font-medium !tw-mb-1",4,"ngIf"],["class","tw-text-main tw-mb-0","bitTypography","body2",3,"innerHTML",4,"ngIf"],[4,"ngIf"],["type","button","bitIconButton","bwi-close","size","small","class","-tw-me-2",3,"label","click",4,"ngIf"],["class","tw-w-full","bitButton","","type","button","buttonType","primary",3,"click",4,"ngIf"],["bitTypography","h4",1,"tw-font-medium","!tw-mb-1"],["bitTypography","body2",1,"tw-text-main","tw-mb-0",3,"innerHTML"],["type","button","bitIconButton","bwi-close","size","small",1,"-tw-me-2",3,"click","label"],["bitButton","","type","button","buttonType","primary",1,"tw-w-full",3,"click"],["class","bwi tw-ml-1","aria-hidden","true",3,"ngClass",4,"ngIf"],["aria-hidden","true",1,"bwi","tw-ml-1",3,"ngClass"]],template:function(e,t){1&e&&(Fl.NAR(),Fl.j41(0,"div",0)(1,"div",1)(2,"div"),Fl.DNE(3,Cx,2,1,"h2",2)(4,Tx,1,1,"p",3)(5,Px,1,0,"ng-content",4),Fl.k0s(),Fl.DNE(6,Fx,2,3,"button",5),Fl.k0s(),Fl.DNE(7,xx,3,2,"button",6),Fl.k0s()),2&e&&(Fl.R7$(3),Fl.Y8G("ngIf",t.title()),Fl.R7$(),Fl.Y8G("ngIf",t.subtitle()),Fl.R7$(),Fl.Y8G("ngIf",!t.subtitle()),Fl.R7$(),Fl.Y8G("ngIf",!t.persistent()),Fl.R7$(),Fl.Y8G("ngIf",t.buttonText()))},dependencies:[id,td,kl.MD,kl.YU,kl.bT,Ql,Zl,tc,rc,sc],encapsulation:2,changeDetection:0});class Dx{}Dx.ɵfac=function(e){return new(e||Dx)},Dx.ɵdir=Fl.FsC({type:Dx,hostAttrs:[1,"tw-box-border","tw-block","tw-bg-background","tw-text-main","tw-border","tw-border-solid","tw-border-secondary-100","tw-shadow","tw-rounded-xl"]});class Ex{}Ex.ɵfac=function(e){return new(e||Ex)},Ex.ɵcmp=Fl.VBU({type:Ex,selectors:[["bit-card"]],hostAttrs:[1,"tw-p-4","[@media(min-width:650px)]:tw-p-6"],features:[Fl.nM4([Dx])],ngContentSelectors:["*"],decls:1,vars:0,template:function(e,t){1&e&&(Fl.NAR(),Fl.SdG(0))},encapsulation:2,changeDetection:0});var $x=i(93161);const Ox=e=>({"tw-mb-5 bit-compact:tw-mb-4 [&:not(bit-dialog_*):not(popup-page_*)]:md:tw-mb-12":e});class Ux{constructor(){this.disableMargin=(0,o.hFB)(!1,{transform:$x.he})}}Ux.ɵfac=function(e){return new(e||Ux)},Ux.ɵcmp=Fl.VBU({type:Ux,selectors:[["bit-section"]],inputs:{disableMargin:[1,"disableMargin"]},ngContentSelectors:["*"],decls:2,vars:3,consts:[[3,"ngClass"]],template:function(e,t){1&e&&(Fl.NAR(),Fl.j41(0,"section",0),Fl.SdG(1),Fl.k0s()),2&e&&Fl.Y8G("ngClass",Fl.eq3(1,Ox,!t.disableMargin()))},dependencies:[kl.MD,kl.YU],encapsulation:2});const Mx=["*",[["","slot","end"]]];class Nx{}Nx.ɵfac=function(e){return new(e||Nx)},Nx.ɵcmp=Fl.VBU({type:Nx,selectors:[["bit-section-header"]],hostAttrs:[1,"tw-block","has-[+_*_bit-card]:tw-pb-1","has-[+_bit-card]:tw-pb-1","has-[+_*_bit-item]:tw-pb-1","has-[+_bit-item]:tw-pb-1","has-[+_*_bit-card]:tw-px-1","has-[+_bit-card]:tw-px-1","has-[+_*_bit-item]:tw-px-1","has-[+_bit-item]:tw-px-1"],ngContentSelectors:["*","[slot=end]"],decls:5,vars:0,consts:[[1,"tw-flex","tw-justify-between","tw-items-end","tw-gap-1"],[1,"[&>*]:tw-mb-0","[&>*]:tw-text-main","tw-flex","tw-items-center","tw-gap-1"],[1,"tw-text-muted","-tw-mb-0.5"]],template:function(e,t){1&e&&(Fl.NAR(Mx),Fl.rj2(0,"div",0)(1,"div",1),Fl.SdG(2),Fl.eux(),Fl.rj2(3,"div",2),Fl.SdG(4,1),Fl.eux()())},dependencies:[tc],encapsulation:2});const Vx=[[["bit-label"]],[["bit-hint"]]],Bx=(e,t)=>({"tw-cursor-default":e,"tw-cursor-pointer":t}),jx=e=>({"tw-text-muted tw-pointer-events-none":e}),Gx=(e,t,i)=>({"tw-bg-secondary-100":e,"tw-bg-primary-600 [&:has(input:focus-visible)]:after:tw-bg-primary-700 group-hover/switch-label:after:tw-bg-primary-700":t,"tw-bg-secondary-300 [&:has(input:focus-visible)]:after:tw-bg-hover-default group-hover/switch-label:after:tw-bg-hover-default":i}),Lx=e=>({"tw-translate-x-[calc(theme(spacing.9)_-_(1.125rem_+_4px))] rtl:-tw-translate-x-[calc(theme(spacing.9)_-_(1.125rem_+_4px))]":e});function zx(e,t){if(1&e&&(Fl.j41(0,"div",7),Fl.EFF(1),Fl.k0s()),2&e){const e=Fl.XpG(),t=Fl.r8f(0);Fl.BMQ("id",e.disabledReasonTextId),Fl.R7$(),Fl.SpI(" ",t," ")}}let _x=0;class Kx{constructor(){this.el=(0,a.WQX)(Fl.aKT),this.label=o.sbv.required(Ac),this.selected=(0,o.geq)(!1),this.disabled=(0,o.geq)(!1),this.disabledReasonText=(0,o.hFB)(null),this.hintComponent=(0,o.sbv)(hu),this.disabledReasonTextId="bit-switch-disabled-text-"+_x++,this.describedByIds=(0,Rl.EW)(()=>{var e;const t=[];if(this.disabledReasonText()&&this.disabled())t.push(this.disabledReasonTextId);else{const i=null===(e=this.hintComponent())||void 0===e?void 0:e.id;i&&t.push(i)}return t.join(" ")}),this.notifyOnChange=()=>{},this.notifyOnTouch=()=>{},this.id=(0,o.hFB)("bit-switch-"+_x++)}writeValue(e){this.selected.set(e)}onChange(e){this.selected.set(e),null!=this.notifyOnChange&&this.notifyOnChange(e)}onTouch(){null!=this.notifyOnTouch&&this.notifyOnTouch()}registerOnChange(e){this.notifyOnChange=e}registerOnTouched(e){this.notifyOnTouch=e}setDisabledState(e){this.disabled.set(e)}onInputChange(e){const t=e.target.checked;this.onChange(t),this.onTouch()}get inputId(){return`${this.id()}-input`}ngAfterViewInit(){this.label()||console.error("No label component provided. <bit-switch> must be used with a <bit-label>.")}}Kx.ɵfac=function(e){return new(e||Kx)},Kx.ɵcmp=Fl.VBU({type:Kx,selectors:[["bit-switch"]],contentQueries:function(e,t,i){1&e&&(Fl.C6U(i,t.label,Ac,5),Fl.C6U(i,t.hintComponent,hu,5)),2&e&&Fl.NyB(2)},hostVars:3,hostBindings:function(e,t){2&e&&(Fl.Avn("id",t.id()),Fl.BMQ("aria-disabled",t.disabled())("title",t.disabled()?t.disabledReasonText():null))},inputs:{selected:[1,"selected"],disabled:[1,"disabled"],disabledReasonText:[1,"disabledReasonText"],id:[1,"id"]},outputs:{selected:"selectedChange",disabled:"disabledChange"},features:[Fl.Jv_([{provide:Il.kq,useExisting:Kx,multi:!0}]),Fl.nM4([ql])],ngContentSelectors:["bit-label","bit-hint"],decls:12,vars:22,consts:[[1,"tw-rounded-md","tw-flex","tw-flex-col","[&:has(input:focus-visible)]:tw-ring-2","[&:has(input:focus-visible)]:tw-ring-offset-2","[&:has(input:focus-visible)]:tw-ring-primary-600"],[1,"tw-inline-flex","tw-gap-2","tw-justify-between","tw-group/switch-label",3,"ngClass"],["bitTypography","body2",1,"tw-block","[&_*]:tw-whitespace-normal","tw-max-w-[60ch]",3,"ngClass"],[1,"tw-relative","tw-w-9","tw-shrink-0","tw-h-[1.375rem]","tw-rounded-full","tw-relative","after:tw-transition-[background-color]","after:tw-absolute","after:tw-inset-0","after:tw-rounded-full","after:tw-size-full",3,"ngClass"],["type","checkbox","role","switch",1,"tw-sr-only",3,"change","id","checked"],[1,"tw-absolute","tw-z-10","tw-block","tw-size-[1.125rem]","tw-top-[2px]","tw-start-[2px]","tw-bg-text-alt2","tw-rounded-full","tw-shadow-md","tw-transform","tw-transition-transform",3,"ngClass"],[1,"[&_bit-hint]:tw-mt-0","tw-max-w-[60ch]","tw-leading-none"],[1,"tw-sr-only"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.NAR(Vx),Fl.SS7(0),Fl.j41(1,"div",0)(2,"label",1)(3,"div")(4,"span",2),Fl.SdG(5),Fl.k0s()(),Fl.j41(6,"span",3)(7,"input",4),Fl.bIt("change",function(i){return a.eBV(e),a.Njj(t.onInputChange(i))}),Fl.k0s(),Fl.nrm(8,"span",5),Fl.k0s()(),Fl.j41(9,"div",6),Fl.SdG(10,1,["ngProjectAs","bit-hint",5,["bit-hint"]]),Fl.k0s(),Fl.nVh(11,zx,2,2,"div",7),Fl.k0s()}if(2&e){const e=Fl.bH3(t.disabledReasonText());Fl.R7$(2),Fl.Y8G("ngClass",Fl.l_i(11,Bx,t.disabled(),!t.disabled())),Fl.BMQ("for",t.inputId),Fl.R7$(2),Fl.Y8G("ngClass",Fl.eq3(14,jx,t.disabled())),Fl.R7$(2),Fl.Y8G("ngClass",Fl.sMw(16,Gx,t.disabled(),t.selected()&&!t.disabled(),!t.selected()&&!t.disabled())),Fl.R7$(),Fl.Y8G("id",t.inputId)("checked",t.selected()),Fl.BMQ("aria-disabled",t.disabled())("aria-describedby",t.describedByIds()),Fl.R7$(),Fl.Y8G("ngClass",Fl.eq3(20,Lx,t.selected())),Fl.R7$(3),Fl.vxM(e&&t.disabled()?11:-1)}},dependencies:[Dc,kl.YU],encapsulation:2});var Xx=i(21898);class qx{}class Wx extends tS{constructor(e){var t;super(e),this.id=this.getResponseProperty("Id"),this.organizationId=this.getResponseProperty("OrganizationId"),this.type=this.getResponseProperty("Type"),this.data=this.getResponseProperty("Data"),this.enabled=this.getResponseProperty("Enabled"),this.canToggleState=null===(t=this.getResponseProperty("CanToggleState"))||void 0===t||t,this.revisionDate=this.getResponseProperty("RevisionDate")}}class Yx extends tS{constructor(e){super(e);const t=this.getResponseProperty("MasterPasswordUnlock");null!=t&&"object"==typeof t&&(this.masterPasswordUnlock=new bS(t));const i=this.getResponseProperty("WebAuthnPrfOptions");null!=i&&Array.isArray(i)&&(this.webAuthnPrfOptions=i.map(e=>new kS(e)))}}class Hx extends tS{constructor(e){super(e),this.type=this.getResponseProperty("Type"),this.domains=this.getResponseProperty("Domains"),this.excluded=this.getResponseProperty("Excluded")}}class Jx extends tS{constructor(e){super(e),this.globalEquivalentDomains=[],this.equivalentDomains=this.getResponseProperty("EquivalentDomains");const t=this.getResponseProperty("GlobalEquivalentDomains");this.globalEquivalentDomains=null!=t?t.map(e=>new Hx(e)):[]}}class Zx extends tS{constructor(e){var t,i,n,r,s,o,a;super(e),this.id=this.getResponseProperty("Id"),this.name=this.getResponseProperty("Name"),this.usePolicies=this.getResponseProperty("UsePolicies"),this.useGroups=this.getResponseProperty("UseGroups"),this.useDirectory=this.getResponseProperty("UseDirectory"),this.useEvents=this.getResponseProperty("UseEvents"),this.useTotp=this.getResponseProperty("UseTotp"),this.use2fa=this.getResponseProperty("Use2fa"),this.useApi=this.getResponseProperty("UseApi"),this.useSso=this.getResponseProperty("UseSso"),this.useOrganizationDomains=this.getResponseProperty("UseOrganizationDomains"),this.useKeyConnector=null!==(t=this.getResponseProperty("UseKeyConnector"))&&void 0!==t&&t,this.useScim=null!==(i=this.getResponseProperty("UseScim"))&&void 0!==i&&i,this.useCustomPermissions=null!==(n=this.getResponseProperty("UseCustomPermissions"))&&void 0!==n&&n,this.useResetPassword=this.getResponseProperty("UseResetPassword"),this.useSecretsManager=this.getResponseProperty("UseSecretsManager"),this.usePasswordManager=this.getResponseProperty("UsePasswordManager"),this.useActivateAutofillPolicy=this.getResponseProperty("UseActivateAutofillPolicy"),this.useAutomaticUserConfirmation=this.getResponseProperty("UseAutomaticUserConfirmation"),this.selfHost=this.getResponseProperty("SelfHost"),this.usersGetPremium=this.getResponseProperty("UsersGetPremium"),this.seats=this.getResponseProperty("Seats"),this.maxCollections=this.getResponseProperty("MaxCollections"),this.maxStorageGb=this.getResponseProperty("MaxStorageGb"),this.key=this.getResponseProperty("Key"),this.hasPublicAndPrivateKeys=this.getResponseProperty("HasPublicAndPrivateKeys"),this.status=this.getResponseProperty("Status"),this.type=this.getResponseProperty("Type"),this.enabled=this.getResponseProperty("Enabled"),this.ssoBound=this.getResponseProperty("SsoBound"),this.identifier=this.getResponseProperty("Identifier"),this.permissions=new BR(this.getResponseProperty("permissions")),this.resetPasswordEnrolled=this.getResponseProperty("ResetPasswordEnrolled"),this.userId=this.getResponseProperty("UserId"),this.organizationUserId=this.getResponseProperty("OrganizationUserId"),this.providerId=this.getResponseProperty("ProviderId"),this.providerName=this.getResponseProperty("ProviderName"),this.providerType=this.getResponseProperty("ProviderType"),this.familySponsorshipFriendlyName=this.getResponseProperty("FamilySponsorshipFriendlyName"),this.familySponsorshipAvailable=this.getResponseProperty("FamilySponsorshipAvailable"),this.productTierType=this.getResponseProperty("ProductTierType"),this.keyConnectorEnabled=null!==(r=this.getResponseProperty("KeyConnectorEnabled"))&&void 0!==r&&r,this.keyConnectorUrl=this.getResponseProperty("KeyConnectorUrl");const l=this.getResponseProperty("FamilySponsorshipLastSyncDate");l&&(this.familySponsorshipLastSyncDate=new Date(l));const c=this.getResponseProperty("FamilySponsorshipValidUntil");c&&(this.familySponsorshipValidUntil=new Date(c)),this.familySponsorshipToDelete=this.getResponseProperty("FamilySponsorshipToDelete"),this.accessSecretsManager=this.getResponseProperty("AccessSecretsManager"),this.limitCollectionCreation=this.getResponseProperty("LimitCollectionCreation"),this.limitCollectionDeletion=this.getResponseProperty("LimitCollectionDeletion"),this.limitItemDeletion=this.getResponseProperty("LimitItemDeletion"),this.allowAdminAccessToAllCollectionItems=this.getResponseProperty("AllowAdminAccessToAllCollectionItems"),this.userIsManagedByOrganization=this.getResponseProperty("UserIsManagedByOrganization"),this.useAccessIntelligence=this.getResponseProperty("UseRiskInsights"),this.useAdminSponsoredFamilies=this.getResponseProperty("UseAdminSponsoredFamilies"),this.useDisableSMAdsForUsers=null!==(s=this.getResponseProperty("UseDisableSMAdsForUsers"))&&void 0!==s&&s,this.isAdminInitiated=this.getResponseProperty("IsAdminInitiated"),this.ssoEnabled=null!==(o=this.getResponseProperty("SsoEnabled"))&&void 0!==o&&o,this.ssoMemberDecryptionType=this.getResponseProperty("SsoMemberDecryptionType"),this.usePhishingBlocker=null!==(a=this.getResponseProperty("UsePhishingBlocker"))&&void 0!==a&&a}}class Qx extends Zx{constructor(e){super(e),this.keyConnectorEnabled=!1}}class eA extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.name=this.getResponseProperty("Name"),this.key=this.getResponseProperty("Key"),this.status=this.getResponseProperty("Status"),this.type=this.getResponseProperty("Type"),this.enabled=this.getResponseProperty("Enabled"),this.permissions=new BR(this.getResponseProperty("permissions")),this.userId=this.getResponseProperty("UserId"),this.useEvents=this.getResponseProperty("UseEvents"),this.providerStatus=this.getResponseProperty("ProviderStatus"),this.providerType=this.getResponseProperty("ProviderType")}}class tA extends tS{constructor(e){var t,i,n;super(e),this.accountKeys=null,this.organizations=[],this.providers=[],this.providerOrganizations=[],this.id=this.getResponseProperty("Id"),this.name=this.getResponseProperty("Name"),this.email=this.getResponseProperty("Email"),this.emailVerified=this.getResponseProperty("EmailVerified"),this.premiumPersonally=this.getResponseProperty("Premium"),this.premiumFromOrganization=this.getResponseProperty("PremiumFromOrganization"),this.culture=this.getResponseProperty("Culture"),this.twoFactorEnabled=this.getResponseProperty("TwoFactorEnabled");const r=this.getResponseProperty("Key");r&&(this.key=new Pp(r)),null!=this.getResponseProperty("AccountKeys")&&(this.accountKeys=new vS(this.getResponseProperty("AccountKeys"))),this.avatarColor=this.getResponseProperty("AvatarColor"),this.creationDate=this.getResponseProperty("CreationDate"),this.privateKey=this.getResponseProperty("PrivateKey"),this.securityStamp=this.getResponseProperty("SecurityStamp"),this.forcePasswordReset=null!==(t=this.getResponseProperty("ForcePasswordReset"))&&void 0!==t&&t,this.usesKeyConnector=null!==(i=this.getResponseProperty("UsesKeyConnector"))&&void 0!==i&&i,this.verifyDevices=null===(n=this.getResponseProperty("VerifyDevices"))||void 0===n||n;const s=this.getResponseProperty("Organizations");null!=s&&(this.organizations=s.map(e=>new Zx(e)));const o=this.getResponseProperty("Providers");null!=o&&(this.providers=o.map(e=>new eA(e)));const a=this.getResponseProperty("ProviderOrganizations");null!=a&&(this.providerOrganizations=a.map(e=>new Qx(e)))}}class iA extends tS{constructor(e=null){super(e),null!=e&&(this.id=this.getResponseProperty("Id"),this.fileName=this.getResponseProperty("FileName"),this.size=this.getResponseProperty("Size"),this.sizeName=this.getResponseProperty("SizeName"))}}class nA extends tS{constructor(e=null){super(e),null!=e&&(this.text=this.getResponseProperty("Text"),this.hidden=this.getResponseProperty("Hidden")||!1)}}class rA extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.accessId=this.getResponseProperty("AccessId"),this.type=this.getResponseProperty("Type"),this.authType=this.getResponseProperty("AuthType"),this.name=this.getResponseProperty("Name"),this.notes=this.getResponseProperty("Notes"),this.key=this.getResponseProperty("Key"),this.maxAccessCount=this.getResponseProperty("MaxAccessCount"),this.accessCount=this.getResponseProperty("AccessCount"),this.revisionDate=this.getResponseProperty("RevisionDate"),this.expirationDate=this.getResponseProperty("ExpirationDate"),this.deletionDate=this.getResponseProperty("DeletionDate"),this.password=this.getResponseProperty("Password"),this.emails=this.getResponseProperty("Emails"),this.disable=this.getResponseProperty("Disabled")||!1,this.hideEmail=this.getResponseProperty("HideEmail")||!1,this.authType=this.getResponseProperty("AuthType");const t=this.getResponseProperty("Text");null!=t&&(this.text=new nA(t));const i=this.getResponseProperty("File");null!=i&&(this.file=new iA(i))}}class sA extends tS{constructor(e=null){super(e),null!=e&&(this.cardholderName=this.getResponseProperty("CardholderName"),this.brand=this.getResponseProperty("Brand"),this.number=this.getResponseProperty("Number"),this.expMonth=this.getResponseProperty("ExpMonth"),this.expYear=this.getResponseProperty("ExpYear"),this.code=this.getResponseProperty("Code"))}}class oA extends tS{constructor(e=null){super(e),this.delete=!1,this.restore=!1,null!=e&&(this.delete=this.getResponseProperty("Delete"),this.restore=this.getResponseProperty("Restore"))}static fromJSON(e){return Object.assign(new oA,e)}static fromSdkCipherPermissions(e){if(!e)return;const t=new oA;return t.delete=e.delete,t.restore=e.restore,t}toSdkCipherPermissions(){return this}}class aA extends tS{constructor(e=null){super(e),null!=e&&(this.type=this.getResponseProperty("Type"),this.name=this.getResponseProperty("Name"),this.value=this.getResponseProperty("Value"),this.linkedId=this.getResponseProperty("linkedId"))}}class lA extends tS{constructor(e=null){super(e),null!=e&&(this.title=this.getResponseProperty("Title"),this.firstName=this.getResponseProperty("FirstName"),this.middleName=this.getResponseProperty("MiddleName"),this.lastName=this.getResponseProperty("LastName"),this.address1=this.getResponseProperty("Address1"),this.address2=this.getResponseProperty("Address2"),this.address3=this.getResponseProperty("Address3"),this.city=this.getResponseProperty("City"),this.state=this.getResponseProperty("State"),this.postalCode=this.getResponseProperty("PostalCode"),this.country=this.getResponseProperty("Country"),this.company=this.getResponseProperty("Company"),this.email=this.getResponseProperty("Email"),this.phone=this.getResponseProperty("Phone"),this.ssn=this.getResponseProperty("SSN"),this.username=this.getResponseProperty("Username"),this.passportNumber=this.getResponseProperty("PassportNumber"),this.licenseNumber=this.getResponseProperty("LicenseNumber"))}}class cA extends tS{constructor(e=null){super(e),null!=e&&(this.credentialId=this.getResponseProperty("CredentialId"),this.keyType=this.getResponseProperty("KeyType"),this.keyAlgorithm=this.getResponseProperty("KeyAlgorithm"),this.keyCurve=this.getResponseProperty("KeyCurve"),this.keyValue=this.getResponseProperty("keyValue"),this.rpId=this.getResponseProperty("RpId"),this.userHandle=this.getResponseProperty("UserHandle"),this.userName=this.getResponseProperty("UserName"),this.counter=this.getResponseProperty("Counter"),this.rpName=this.getResponseProperty("RpName"),this.userDisplayName=this.getResponseProperty("UserDisplayName"),this.discoverable=this.getResponseProperty("Discoverable"),this.creationDate=this.getResponseProperty("CreationDate"))}}class uA extends tS{constructor(e=null){if(super(e),this.match=null,null==e)return;this.uri=this.getResponseProperty("Uri"),this.uriChecksum=this.getResponseProperty("UriChecksum");const t=this.getResponseProperty("Match");this.match=null!=t?t:null}}class dA extends tS{constructor(e=null){if(super(e),null==e)return;this.username=this.getResponseProperty("Username"),this.password=this.getResponseProperty("Password"),this.passwordRevisionDate=this.getResponseProperty("PasswordRevisionDate"),this.totp=this.getResponseProperty("Totp"),this.autofillOnPageLoad=this.getResponseProperty("AutofillOnPageLoad");const t=this.getResponseProperty("Uris");null!=t&&(this.uris=t.map(e=>new uA(e)));const i=this.getResponseProperty("Fido2Credentials");null!=i&&(this.fido2Credentials=i.map(e=>new cA(e)))}}class hA extends tS{constructor(e=null){super(e),null!=e&&(this.type=this.getResponseProperty("Type"))}}class pA extends tS{constructor(e=null){super(e),null!=e&&(this.privateKey=this.getResponseProperty("PrivateKey"),this.publicKey=this.getResponseProperty("PublicKey"),this.keyFingerprint=this.getResponseProperty("KeyFingerprint"))}}class vA extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.url=this.getResponseProperty("Url"),this.fileName=this.getResponseProperty("FileName"),this.key=this.getResponseProperty("Key"),this.size=this.getResponseProperty("Size"),this.sizeName=this.getResponseProperty("SizeName")}}class fA extends tS{constructor(e){super(e),this.password=this.getResponseProperty("Password"),this.lastUsedDate=this.getResponseProperty("LastUsedDate")}}class mA extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.organizationId=this.getResponseProperty("OrganizationId"),this.folderId=this.getResponseProperty("FolderId")||null,this.type=this.getResponseProperty("Type"),this.name=this.getResponseProperty("Name"),this.notes=this.getResponseProperty("Notes"),this.favorite=this.getResponseProperty("Favorite")||!1,this.edit=!!this.getResponseProperty("Edit"),null==this.getResponseProperty("ViewPassword")?this.viewPassword=!0:this.viewPassword=this.getResponseProperty("ViewPassword"),this.permissions=new oA(this.getResponseProperty("Permissions")),this.organizationUseTotp=this.getResponseProperty("OrganizationUseTotp"),this.revisionDate=this.getResponseProperty("RevisionDate"),this.collectionIds=this.getResponseProperty("CollectionIds"),this.creationDate=this.getResponseProperty("CreationDate"),this.deletedDate=this.getResponseProperty("DeletedDate"),this.archivedDate=this.getResponseProperty("ArchivedDate");const t=this.getResponseProperty("Login");null!=t&&(this.login=new dA(t));const i=this.getResponseProperty("Card");null!=i&&(this.card=new sA(i));const n=this.getResponseProperty("Identity");null!=n&&(this.identity=new lA(n));const r=this.getResponseProperty("SecureNote");null!=r&&(this.secureNote=new hA(r));const s=this.getResponseProperty("sshKey");null!=s&&(this.sshKey=new pA(s));const o=this.getResponseProperty("Fields");null!=o&&(this.fields=o.map(e=>new aA(e)));const a=this.getResponseProperty("Attachments");null!=a&&(this.attachments=a.map(e=>new vA(e)));const l=this.getResponseProperty("PasswordHistory");null!=l&&(this.passwordHistory=l.map(e=>new fA(e))),this.reprompt=this.getResponseProperty("Reprompt")||tx.None,this.key=this.getResponseProperty("Key")||null}}class gA extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.name=this.getResponseProperty("Name"),this.revisionDate=this.getResponseProperty("RevisionDate")}}class yA extends tS{constructor(e){super(e),this.folders=[],this.collections=[],this.ciphers=[],this.policies=[],this.sends=[];const t=this.getResponseProperty("Profile");null!=t&&(this.profile=new tA(t));const i=this.getResponseProperty("Folders");null!=i&&(this.folders=i.map(e=>new gA(e)));const n=this.getResponseProperty("Collections");null!=n&&(this.collections=n.map(e=>new FR(e)));const r=this.getResponseProperty("Ciphers");null!=r&&(this.ciphers=r.map(e=>new mA(e)));const s=this.getResponseProperty("Domains");null!=s&&(this.domains=new Jx(s));const o=this.getResponseProperty("Policies");null!=o&&(this.policies=o.map(e=>new Wx(e)));const a=this.getResponseProperty("Sends");null!=a&&(this.sends=a.map(e=>new rA(e)));const l=this.getResponseProperty("UserDecryption");null!=l&&"object"==typeof l&&(this.userDecryption=new Yx(l))}}const bA=Object.freeze({MasterPassword:"masterPassword",Pin:"pin",Biometrics:"biometrics",Prf:"prf"});class wA{}class SA{}class kA{}var IA=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function CA(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",2),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.unlockViaPrf())}),Fl.nrm(1,"i",3),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()}if(2&e){const e=Fl.XpG(2);Fl.Y8G("disabled",e.unlocking)("loading",e.unlocking),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,3,"unlockWithPasskey")," ")}}function TA(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",4),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.unlockViaPrf())}),Fl.nrm(1,"i",3),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()}if(2&e){const e=Fl.XpG(2);Fl.Y8G("disabled",e.unlocking)("loading",e.unlocking),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,3,"unlockWithPasskey")," ")}}function PA(e,t){if(1&e&&(Fl.nVh(0,CA,4,5,"button",0),Fl.nVh(1,TA,4,5,"button",1)),2&e){const e=Fl.XpG();Fl.vxM(e.formButton()?0:-1),Fl.R7$(),Fl.vxM(e.formButton()?-1:1)}}class FA{constructor(e,t,i,n,r){this.accountService=e,this.webAuthnPrfUnlockService=t,this.dialogService=i,this.i18nService=n,this.logService=r,this.formButton=(0,o.hFB)(!1),this.unlockSuccess=(0,o.CGW)(),this.unlocking=!1,this.isAvailable=!1,this.userId=null}ngOnInit(){return IA(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.accountService.activeAccount$);(null==e?void 0:e.id)&&(this.userId=e.id,this.isAvailable=yield this.webAuthnPrfUnlockService.isPrfUnlockAvailable(this.userId))})}unlockViaPrf(){return IA(this,void 0,void 0,function*(){if(this.userId&&this.isAvailable){this.unlocking=!0;try{const e=yield this.webAuthnPrfUnlockService.unlockVaultWithPrf(this.userId);this.unlockSuccess.emit(e)}catch(e){this.logService.error("[UnlockViaPrfComponent] Failed to unlock via PRF:",e);let t=this.i18nService.t("unexpectedError");if(e instanceof Error)if(e.message.includes("No PRF credentials"))t=this.i18nService.t("noPrfCredentialsAvailable");else if(e.message.includes("canceled"))return void(this.unlocking=!1);yield this.dialogService.openSimpleDialog({title:{key:"error"},content:t,acceptButtonText:{key:"ok"},type:"danger"})}finally{this.unlocking=!1}}})}}FA.ɵfac=function(e){return new(e||FA)(Fl.rXU(Zk),Fl.rXU(kA),Fl.rXU(lh),Fl.rXU(Ul),Fl.rXU(Za))},FA.ɵcmp=Fl.VBU({type:FA,selectors:[["bit-unlock-via-prf"]],inputs:{formButton:[1,"formButton"]},outputs:{unlockSuccess:"unlockSuccess"},decls:1,vars:1,consts:[["type","button","bitButton","","bitFormButton","","buttonType","secondary","block","",3,"disabled","loading"],["type","button","bitButton","","buttonType","secondary","block","",3,"disabled","loading"],["type","button","bitButton","","bitFormButton","","buttonType","secondary","block","",3,"click","disabled","loading"],["aria-hidden","true",1,"bwi","bwi-passkey","tw-mr-1"],["type","button","bitButton","","buttonType","secondary","block","",3,"click","disabled","loading"]],template:function(e,t){1&e&&Fl.nVh(0,PA,2,2),2&e&&Fl.vxM(t.isAvailable?0:-1)},dependencies:[kl.MD,sf,id,td,pc,jd,rf],encapsulation:2});var RA=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function xA(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",10),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.activeUnlockOption.set(t.UnlockOption.Biometrics))}),Fl.j41(1,"span"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()()}if(2&e){const e=Fl.XpG();Fl.Y8G("disabled",!e.biometricsAvailable()),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,2,e.biometricUnlockBtnText()))}}function AA(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",11),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.activeUnlockOption.set(t.UnlockOption.Pin))}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"unlockWithPin")," "))}class DA{constructor(){this.accountService=(0,a.WQX)(Zk),this.masterPasswordUnlockService=(0,a.WQX)(SA),this.i18nService=(0,a.WQX)(Ul),this.toastService=(0,a.WQX)(qb),this.logService=(0,a.WQX)(Za),this.platformUtilsService=(0,a.WQX)(Hb),this.messageListener=(0,a.WQX)(gk),this.UnlockOption=bA,this.activeUnlockOption=o.geq.required(),this.unlockOptions=o.hFB.required(),this.biometricUnlockBtnText=o.hFB.required(),this.showPinSwap=(0,Rl.EW)(()=>{var e;return null!==(e=this.unlockOptions().pin.enabled)&&void 0!==e&&e}),this.biometricsAvailable=(0,Rl.EW)(()=>{var e;return null!==(e=this.unlockOptions().biometrics.enabled)&&void 0!==e&&e}),this.showBiometricsSwap=(0,Rl.EW)(()=>{const e=this.unlockOptions().biometrics.biometricsStatus;return e!==$p.PlatformUnsupported&&e!==$p.NotEnabledLocally}),this.successfulUnlock=(0,o.CGW)(),this.prfUnlockSuccess=(0,o.CGW)(),this.logOut=(0,o.CGW)(),this.showPassword=!1,this.destroy$=new Co.B,this.formGroup=new Il.gE({masterPassword:new Il.MJ("",{validators:[Il.k0.required],updateOn:"submit"})}),this.submit=()=>RA(this,void 0,void 0,function*(){this.formGroup.markAllAsTouched();const e=this.formGroup.controls.masterPassword.value;if(this.formGroup.invalid||!e)return void this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("masterPasswordRequired")});const t=yield(0,bo._)(iv(this.accountService.activeAccount$));yield this.unlockViaMasterPassword(e,t)})}ngOnInit(){return RA(this,void 0,void 0,function*(){this.platformUtilsService.getClientType()===Da.Desktop&&this.messageListener.messages$(new wk("windowHidden")).pipe((0,vm.Q)(this.destroy$)).subscribe(()=>{this.showPassword=!1})})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}unlockViaMasterPassword(e,t){return RA(this,void 0,void 0,function*(){try{const i=yield this.masterPasswordUnlockService.unlockWithMasterPassword(e,t);this.successfulUnlock.emit({userKey:i,masterPassword:e})}catch(e){this.logService.error("[MasterPasswordLockComponent] Failed to unlock via master password",e),this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("invalidMasterPassword")})}})}onPrfUnlockSuccess(e){this.prfUnlockSuccess.emit(e)}}DA.ɵfac=function(e){return new(e||DA)},DA.ɵcmp=Fl.VBU({type:DA,selectors:[["bit-master-password-lock"]],inputs:{activeUnlockOption:[1,"activeUnlockOption"],unlockOptions:[1,"unlockOptions"],biometricUnlockBtnText:[1,"biometricUnlockBtnText"]},outputs:{activeUnlockOption:"activeUnlockOptionChange",successfulUnlock:"successfulUnlock",prfUnlockSuccess:"prfUnlockSuccess",logOut:"logOut"},decls:20,vars:18,consts:[[3,"formGroup","bitSubmit"],["type","password","formControlName","masterPassword","bitInput","","appAutofocus","","name","masterPassword","required","","appInputVerbatim","",1,"tw-font-mono"],["type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle","",3,"toggledChange","toggled"],[1,"tw-flex","tw-flex-col","tw-space-y-3"],["type","submit","bitButton","","bitFormButton","","buttonType","primary","block",""],[1,"tw-text-center"],["type","button","bitButton","","bitFormButton","","buttonType","secondary","block","",3,"disabled"],["type","button","bitButton","","bitFormButton","","buttonType","secondary","block",""],[3,"unlockSuccess","formButton"],["type","button","bitButton","","bitFormButton","","block","",3,"click"],["type","button","bitButton","","bitFormButton","","buttonType","secondary","block","",3,"click","disabled"],["type","button","bitButton","","bitFormButton","","buttonType","secondary","block","",3,"click"]],template:function(e,t){1&e&&(Fl.j41(0,"form",0)(1,"bit-form-field")(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.nrm(5,"input",1),Fl.j41(6,"button",2),Fl.mxI("toggledChange",function(e){return Fl.DH7(t.showPassword,e)||(t.showPassword=e),e}),Fl.k0s()(),Fl.j41(7,"div",3)(8,"button",4),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s(),Fl.j41(11,"p",5),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s(),Fl.nVh(14,xA,4,4,"button",6),Fl.nVh(15,AA,3,3,"button",7),Fl.j41(16,"bit-unlock-via-prf",8),Fl.bIt("unlockSuccess",function(e){return t.onPrfUnlockSuccess(e)}),Fl.k0s(),Fl.j41(17,"button",9),Fl.bIt("click",function(){return t.logOut.emit()}),Fl.EFF(18),Fl.nI1(19,"i18n"),Fl.k0s()()()),2&e&&(Fl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),Fl.R7$(3),Fl.JRh(Fl.bMT(4,10,"masterPass")),Fl.R7$(3),Fl.R50("toggled",t.showPassword),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(10,12,"unlock")," "),Fl.R7$(3),Fl.JRh(Fl.bMT(13,14,"or")),Fl.R7$(2),Fl.vxM(t.showBiometricsSwap()?14:-1),Fl.R7$(),Fl.vxM(t.showPinSwap()?15:-1),Fl.R7$(),Fl.Y8G("formButton",!0),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(19,16,"logOut")," "))},dependencies:[sf,wd,GI,Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.YS,Il.j4,Il.JD,id,td,Gu,Ac,fu,ju,iw,nw,pc,jd,Md,Ql,Zl,FA,rf],encapsulation:2});class EA{}var $A=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function OA(e,t){1&e&&(Fl.j41(0,"div",2),Fl.nrm(1,"i",3),Fl.k0s())}function UA(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"button",11),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(3);return a.Njj(t.activeUnlockOption=t.UnlockOption.Pin)}),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.bVm()}2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"unlockWithPin")," "))}function MA(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"button",11),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(3);return a.Njj(t.activeUnlockOption=t.UnlockOption.MasterPassword)}),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.bVm()}2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"unlockWithMasterPassword")," "))}function NA(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"button",6),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.unlockViaBiometrics())}),Fl.j41(2,"span"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"div",7)(6,"p",8),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.DNE(9,UA,4,3,"ng-container",4)(10,MA,4,3,"ng-container",4),Fl.j41(11,"bit-unlock-via-prf",9),Fl.bIt("unlockSuccess",function(t){a.eBV(e);const i=Fl.XpG(2);return a.Njj(i.onPrfUnlockSuccess(t))}),Fl.k0s(),Fl.j41(12,"button",10),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.logOut())}),Fl.EFF(13),Fl.nI1(14,"i18n"),Fl.k0s()(),Fl.bVm()}if(2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("disabled",e.unlockingViaBiometrics||!e.biometricsAvailable)("loading",e.unlockingViaBiometrics)("bitTooltip",e.biometricUnavailabilityReason),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(4,8,e.biometricUnlockBtnText)),Fl.R7$(4),Fl.JRh(Fl.bMT(8,10,"or")),Fl.R7$(2),Fl.Y8G("ngIf",e.unlockOptions.pin.enabled),Fl.R7$(),Fl.Y8G("ngIf",e.unlockOptions.masterPassword.enabled),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(14,12,"logOut")," ")}}function VA(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"button",19),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(3);return a.Njj(t.activeUnlockOption=t.UnlockOption.Biometrics)}),Fl.j41(2,"span"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.bVm()}if(2&e){const e=Fl.XpG(3);Fl.R7$(),Fl.Y8G("disabled",!e.biometricsAvailable),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(4,2,e.biometricUnlockBtnText))}}function BA(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"button",20),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(3);return a.Njj(t.activeUnlockOption=t.UnlockOption.MasterPassword)}),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.bVm()}2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"unlockWithMasterPassword")," "))}function jA(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"form",12)(2,"bit-form-field")(3,"bit-label"),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s(),Fl.nrm(6,"input",13),Fl.j41(7,"button",14),Fl.mxI("toggledChange",function(t){a.eBV(e);const i=Fl.XpG(2);return Fl.DH7(i.showPassword,t)||(i.showPassword=t),a.Njj(t)}),Fl.k0s()(),Fl.j41(8,"div",7)(9,"button",15),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s(),Fl.j41(12,"p",16),Fl.EFF(13),Fl.nI1(14,"i18n"),Fl.k0s(),Fl.DNE(15,VA,5,4,"ng-container",4)(16,BA,4,3,"ng-container",4),Fl.j41(17,"bit-unlock-via-prf",17),Fl.bIt("unlockSuccess",function(t){a.eBV(e);const i=Fl.XpG(2);return a.Njj(i.onPrfUnlockSuccess(t))}),Fl.k0s(),Fl.j41(18,"button",18),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.logOut())}),Fl.EFF(19),Fl.nI1(20,"i18n"),Fl.k0s()()(),Fl.bVm()}if(2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("bitSubmit",e.submit)("formGroup",e.formGroup),Fl.R7$(3),Fl.JRh(Fl.bMT(5,10,"pin")),Fl.R7$(3),Fl.R50("toggled",e.showPassword),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(11,12,"unlock")," "),Fl.R7$(3),Fl.JRh(Fl.bMT(14,14,"or")),Fl.R7$(2),Fl.Y8G("ngIf",e.showBiometrics),Fl.R7$(),Fl.Y8G("ngIf",e.unlockOptions.masterPassword.enabled),Fl.R7$(),Fl.Y8G("formButton",!0),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(20,16,"logOut")," ")}}function GA(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-master-password-lock",21),Fl.mxI("activeUnlockOptionChange",function(t){a.eBV(e);const i=Fl.XpG(2);return Fl.DH7(i.activeUnlockOption,t)||(i.activeUnlockOption=t),a.Njj(t)}),Fl.bIt("successfulUnlock",function(t){a.eBV(e);const i=Fl.XpG(2);return a.Njj(i.successfulMasterPasswordUnlock(t))})("prfUnlockSuccess",function(t){a.eBV(e);const i=Fl.XpG(2);return a.Njj(i.onPrfUnlockSuccess(t))})("logOut",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.logOut())}),Fl.k0s()}if(2&e){const e=Fl.XpG(2);Fl.R50("activeUnlockOption",e.activeUnlockOption),Fl.Y8G("unlockOptions",e.unlockOptions)("biometricUnlockBtnText",e.biometricUnlockBtnText)}}function LA(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,NA,15,14,"ng-container",4)(2,jA,21,18,"ng-container",4),Fl.nVh(3,GA,1,3,"bit-master-password-lock",5),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("ngIf",e.activeUnlockOption===e.UnlockOption.Biometrics),Fl.R7$(),Fl.Y8G("ngIf",e.unlockOptions.pin.enabled&&e.activeUnlockOption===e.UnlockOption.Pin),Fl.R7$(),Fl.vxM(e.unlockOptions.masterPassword.enabled&&e.activeUnlockOption===e.UnlockOption.MasterPassword?3:-1)}}const zA="LockComponent",_A={[Da.Web]:"vault",[Da.Desktop]:"vault",[Da.Browser]:"/tabs/current"},KA=[$p.HardwareUnavailable,$p.DesktopDisconnected,$p.NotEnabledInConnectedDesktopApp];class XA{set activeUnlockOption(e){this._activeUnlockOptionBSubject.next(e)}get activeUnlockOption(){return this._activeUnlockOptionBSubject.value}constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,v,f,m,g,y,b,w,S,k,I,C,T){this.accountService=e,this.pinService=t,this.keyService=i,this.platformUtilsService=n,this.router=r,this.activatedRoute=s,this.dialogService=o,this.messagingService=a,this.biometricStateService=l,this.ngZone=c,this.i18nService=u,this.masterPasswordService=d,this.logService=h,this.deviceTrustService=p,this.syncService=v,this.policyService=f,this.passwordStrengthService=m,this.formBuilder=g,this.toastService=y,this.userAsymmetricKeysRegenerationService=b,this.biometricService=w,this.logoutService=S,this.lockComponentService=k,this.anonLayoutWrapperDataService=I,this.encryptedMigrator=C,this.broadcasterService=T,this.destroy$=new Co.B,this.loading=!0,this.activeAccount=null,this.unlockOptions=null,this.UnlockOption=bA,this._activeUnlockOptionBSubject=new Dd.t(null),this.activeUnlockOption$=this._activeUnlockOptionBSubject.asObservable(),this.invalidPinAttempts=0,this.showPassword=!1,this.enforcedMasterPasswordOptions=void 0,this.formGroup=null,this.shouldClosePopout=!1,this.deferFocus=null,this.biometricAsked=!1,this.defaultUnlockOptionSetForUser=!1,this.unlockingViaBiometrics=!1,this.submit=()=>$A(this,void 0,void 0,function*(){if(this.activeUnlockOption===bA.Pin)return yield this.unlockViaPin()})}ngOnInit(){return $A(this,void 0,void 0,function*(){this.listenForActiveUnlockOptionChanges(),this.listenForActiveAccountChanges(),this.listenForUnlockOptionsChanges(),this.clientType=this.platformUtilsService.getClientType(),this.clientType===Da.Desktop?yield this.desktopOnInit():this.clientType===Da.Browser&&(this.biometricUnlockBtnText=this.lockComponentService.getBiometricsUnlockBtnText())})}listenForUnlockOptionsChanges(){(0,xo.O)(0,1e3).pipe((0,Xx.Z)(()=>$A(this,void 0,void 0,function*(){var e,t,i;if(!1===this.loading&&null!=(null===(e=this.activeAccount)||void 0===e?void 0:e.id)){const e=null===(t=this.unlockOptions)||void 0===t?void 0:t.biometrics.enabled;this.unlockOptions=yield(0,bo._)(this.lockComponentService.getAvailableUnlockOptions$(this.activeAccount.id)),null==this.activeUnlockOption?yield this.setDefaultActiveUnlockOption(this.unlockOptions):!e&&(null===(i=this.unlockOptions)||void 0===i?void 0:i.biometrics.enabled)&&(yield this.setDefaultActiveUnlockOption(this.unlockOptions),this.activeUnlockOption===bA.Biometrics&&(yield this.handleBiometricsUnlockEnabled()))}})),(0,vm.Q)(this.destroy$)).subscribe()}listenForActiveUnlockOptionChanges(){this.activeUnlockOption$.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{e===bA.Pin&&this.buildPinForm()})}buildPinForm(){this.formGroup=this.formBuilder.group({pin:["",[Il.k0.required]]},{updateOn:"submit"})}listenForActiveAccountChanges(){this.accountService.activeAccount$.pipe((0,Oo.M)(e=>{this.loading=!0,this.activeAccount=e,this.resetDataOnActiveAccountChange()}),(0,Eo.p)(e=>null!=e),(0,go.n)(e=>$A(this,void 0,void 0,function*(){yield this.handleActiveAccountChange(e),this.loading=!1})),(0,vm.Q)(this.destroy$)).subscribe()}handleActiveAccountChange(e){return $A(this,void 0,void 0,function*(){var t,i,n;if(!(yield this.keyService.hasUserKey(e.id))){if(this.setEmailAsPageSubtitle(e.email),this.unlockOptions=yield(0,bo._)(this.lockComponentService.getAvailableUnlockOptions$(e.id)),!(null===(t=this.unlockOptions)||void 0===t?void 0:t.masterPassword.enabled)&&!(null===(i=this.unlockOptions)||void 0===i?void 0:i.pin.enabled)){if(![$p.Available,...KA].includes(yield this.biometricService.getBiometricsStatusForUser(e.id)))return this.logService.warning("[LockComponent] User cannot unlock again. Logging out!"),void(yield this.logoutService.logout(e.id))}yield this.setDefaultActiveUnlockOption(this.unlockOptions),(null===(n=this.unlockOptions)||void 0===n?void 0:n.biometrics.enabled)&&(yield this.handleBiometricsUnlockEnabled())}})}resetDataOnActiveAccountChange(){this.defaultUnlockOptionSetForUser=!1,this.unlockOptions=null,this.activeUnlockOption=null,this.formGroup=null,this.biometricAsked=!1}setEmailAsPageSubtitle(e){this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageSubtitle:e})}setDefaultActiveUnlockOption(e){return $A(this,void 0,void 0,function*(){(null==e?void 0:e.biometrics.enabled)?this.activeUnlockOption=bA.Biometrics:(null==e?void 0:e.pin.enabled)?this.activeUnlockOption=bA.Pin:(null==e?void 0:e.masterPassword.enabled)?this.activeUnlockOption=bA.MasterPassword:null!=e&&KA.includes(e.biometrics.biometricsStatus)&&(this.activeUnlockOption=bA.Biometrics)})}handleBiometricsUnlockEnabled(){return $A(this,void 0,void 0,function*(){var e;this.biometricUnlockBtnText=this.lockComponentService.getBiometricsUnlockBtnText();const t=yield(0,bo._)(this.biometricStateService.promptAutomatically$);if("desktop"===this.clientType&&t&&(this.loading=!1,yield this.desktopAutoPromptBiometrics()),"browser"===this.clientType&&(null===(e=this.unlockOptions)||void 0===e?void 0:e.biometrics.enabled)&&t&&(yield this.biometricService.getShouldAutopromptNow())){yield this.biometricService.setShouldAutopromptNow(!1);const e=yield this.biometricStateService.getLastProcessReload();(null==e||isNaN(e.getTime())||Date.now()-e.getTime()>5e3)&&(this.platformUtilsService.getDevice()===Ea.FirefoxExtension&&(yield this.lockComponentService.popOutBrowserExtension(),this.shouldClosePopout=!0),this.loading=!1,yield this.unlockViaBiometrics())}})}logOut(){return $A(this,void 0,void 0,function*(){(yield this.dialogService.openSimpleDialog({title:{key:"logOut"},content:{key:"logOutConfirmation"},acceptButtonText:{key:"logOut"},type:"warning"}))&&null!=this.activeAccount&&(yield this.logoutService.logout(this.activeAccount.id),yield this.router.navigate(["/"]))})}unlockViaBiometrics(){return $A(this,void 0,void 0,function*(){if(this.unlockingViaBiometrics=!0,null!=this.unlockOptions&&this.unlockOptions.biometrics.enabled&&null!=this.activeAccount)try{yield this.biometricStateService.setUserPromptCancelled();const e=yield this.biometricService.unlockWithBiometricsForUser(this.activeAccount.id);e&&(yield this.setUserKeyAndContinue(e)),this.unlockingViaBiometrics=!1}catch(e){if(e instanceof Error&&"canceled"===e.message)return void(this.unlockingViaBiometrics=!1);let t;if(this.logService.error("[LockComponent] Failed to unlock via biometrics.",e),"browser"===this.clientType){const i=this.lockComponentService.getBiometricsError(e);i&&(t=this.i18nService.t(i))}t||(t=this.i18nService.t("unexpectedError"));(yield this.dialogService.openSimpleDialog({title:{key:"error"},content:t,acceptButtonText:{key:"tryAgain"},type:"danger"}))&&(yield this.unlockViaBiometrics()),this.unlockingViaBiometrics=!1}else this.unlockingViaBiometrics=!1})}onPrfUnlockSuccess(e){return $A(this,void 0,void 0,function*(){yield this.setUserKeyAndContinue(e)})}togglePassword(){this.showPassword=!this.showPassword}validatePin(){var e;return!(null===(e=this.formGroup)||void 0===e?void 0:e.invalid)||(this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("pinRequired")}),!1)}unlockViaPin(){return $A(this,void 0,void 0,function*(){if(!this.validatePin()||null==this.formGroup||null==this.activeAccount)return;const e=this.formGroup.controls.pin.value;try{const t=yield this.pinService.decryptUserKeyWithPin(e,this.activeAccount.id);if(t)return void(yield this.setUserKeyAndContinue(t));if(this.invalidPinAttempts++,this.invalidPinAttempts>=5)return this.toastService.showToast({variant:"error",message:this.i18nService.t("tooManyInvalidPinEntryAttemptsLoggingOut")}),void this.messagingService.send("logout");this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("invalidPin")})}catch(e){this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("unexpectedError")})}})}successfulMasterPasswordUnlock(e){return $A(this,void 0,void 0,function*(){null!=e.userKey&&e.masterPassword?yield this.setUserKeyAndContinue(e.userKey,{passwordEvaluation:{masterPassword:e.masterPassword}}):this.logService.error("[LockComponent] successfulMasterPasswordUnlock called with invalid data.")})}setUserKeyAndContinue(e){return $A(this,arguments,void 0,function*(e,t={}){if(null==this.activeAccount)throw new Error("No active user.");this.logService.mark("Vault unlocked"),yield this.keyService.setUserKey(e,this.activeAccount.id),yield this.pinService.userUnlocked(this.activeAccount.id),yield this.deviceTrustService.trustDeviceIfRequired(this.activeAccount.id),yield this.doContinue(t)})}doContinue(e){return $A(this,void 0,void 0,function*(){var t,i,n;if(null==this.activeAccount)throw new Error("No active user.");yield this.biometricStateService.resetUserPromptCancelled();try{yield this.encryptedMigrator.runMigrations(this.activeAccount.id,null!==(i=null===(t=e.passwordEvaluation)||void 0===t?void 0:t.masterPassword)&&void 0!==i?i:null)}catch(e){}if(this.messagingService.send("unlocked"),e.passwordEvaluation){const t=null===(n=yield(0,bo._)(this.accountService.activeAccount$))||void 0===n?void 0:n.id;if(null==t)throw new Error("No active user.");try{null==this.enforcedMasterPasswordOptions&&(this.enforcedMasterPasswordOptions=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.policyService.masterPasswordPolicyOptions$(e))))),this.requirePasswordChange(e.passwordEvaluation.masterPassword)&&(yield this.masterPasswordService.setForceSetPasswordReason(aS.WeakMasterPassword,t))}catch(e){this.logService.error(e)}}const r=(new Date).getTime();yield this.syncService.fullSync(!1),this.logService.info(`[LockComponent] Sync took ${(new Date).getTime()-r}ms`);const s=(new Date).getTime();if(yield this.userAsymmetricKeysRegenerationService.regenerateIfNeeded(this.activeAccount.id),this.logService.info(`[LockComponent] Private key regeneration took ${(new Date).getTime()-s}ms`),"browser"===this.clientType){const e=this.lockComponentService.getPreviousUrl();if(e)return void(yield this.router.navigateByUrl(e))}if(null!=this.clientType&&null===this.activatedRoute.snapshot.paramMap.get("disable-redirect")){const e=_A[this.clientType];yield this.router.navigate([e])}this.shouldClosePopout&&this.platformUtilsService.getDevice()===Ea.FirefoxExtension&&this.lockComponentService.closeBrowserExtensionPopout()})}requirePasswordChange(e){var t;if(null==this.enforcedMasterPasswordOptions||!this.enforcedMasterPasswordOptions.enforceOnLogin||null==this.activeAccount)return!1;const i=null===(t=this.passwordStrengthService.getPasswordStrength(e,this.activeAccount.email))||void 0===t?void 0:t.score;return!this.policyService.evaluateMasterPassword(i,e,this.enforcedMasterPasswordOptions)}desktopOnInit(){return $A(this,void 0,void 0,function*(){this.biometricUnlockBtnText=this.lockComponentService.getBiometricsUnlockBtnText(),this.broadcasterService.subscribe(zA,e=>$A(this,void 0,void 0,function*(){this.ngZone.run(()=>{switch(e.command){case"windowHidden":this.onWindowHidden();break;case"windowIsFocused":null===this.deferFocus?(this.deferFocus=!e.windowIsFocused,this.deferFocus||this.focusInput()):this.deferFocus&&e.windowIsFocused&&(this.focusInput(),this.deferFocus=!1)}})})),this.messagingService.send("getWindowIsFocused")})}desktopAutoPromptBiometrics(){return $A(this,void 0,void 0,function*(){var e,t;if(!(null===(t=null===(e=this.unlockOptions)||void 0===e?void 0:e.biometrics)||void 0===t?void 0:t.enabled)||this.biometricAsked)return;if(!(yield this.biometricService.getShouldAutopromptNow()))return;if(yield(0,bo._)(this.biometricStateService.promptCancelled$))return;(yield this.lockComponentService.isWindowVisible())&&(this.biometricAsked=!0,yield this.unlockViaBiometrics())})}onWindowHidden(){this.showPassword=!1}focusInput(){var e;this.unlockOptions&&(null===(e=document.getElementById(this.unlockOptions.pin.enabled?"pin":"masterPassword"))||void 0===e||e.focus())}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),"desktop"===this.clientType&&this.broadcasterService.unsubscribe(zA)}get biometricsAvailable(){var e,t;return null!==(t=null===(e=this.unlockOptions)||void 0===e?void 0:e.biometrics.enabled)&&void 0!==t&&t}get showBiometrics(){return null!=this.unlockOptions&&(this.unlockOptions.biometrics.biometricsStatus!==$p.PlatformUnsupported&&this.unlockOptions.biometrics.biometricsStatus!==$p.NotEnabledLocally)}get biometricUnavailabilityReason(){var e,t,i,n;switch(null===(e=this.unlockOptions)||void 0===e?void 0:e.biometrics.biometricsStatus){case $p.Available:return"";case $p.UnlockNeeded:return this.i18nService.t("biometricsStatusHelptextUnlockNeeded");case $p.HardwareUnavailable:return this.i18nService.t("biometricsStatusHelptextHardwareUnavailable");case $p.AutoSetupNeeded:return this.i18nService.t("biometricsStatusHelptextAutoSetupNeeded");case $p.ManualSetupNeeded:return this.i18nService.t("biometricsStatusHelptextManualSetupNeeded");case $p.NotEnabledInConnectedDesktopApp:return this.i18nService.t("biometricsStatusHelptextNotEnabledInDesktop",null===(t=this.activeAccount)||void 0===t?void 0:t.email);case $p.NotEnabledLocally:return this.i18nService.t("biometricsStatusHelptextNotEnabledInDesktop",null===(i=this.activeAccount)||void 0===i?void 0:i.email);case $p.DesktopDisconnected:return this.i18nService.t("biometricsStatusHelptextDesktopDisconnected");default:return this.i18nService.t("biometricsStatusHelptextUnavailableReasonUnknown")+(null===(n=this.unlockOptions)||void 0===n?void 0:n.biometrics.biometricsStatus)}}}XA.ɵfac=function(e){return new(e||XA)(Fl.rXU(Zk),Fl.rXU(HF),Fl.rXU(Bp),Fl.rXU(Hb),Fl.rXU(Fd.Ix),Fl.rXU(Fd.nX),Fl.rXU(lh),Fl.rXU(bk),Fl.rXU(Mp),Fl.rXU(Fl.SKi),Fl.rXU(Ul),Fl.rXU(Yb),Fl.rXU(Za),Fl.rXU(tI),Fl.rXU(qx),Fl.rXU(Zb),Fl.rXU(af),Fl.rXU(Il.ok),Fl.rXU(qb),Fl.rXU(qv),Fl.rXU(Vp),Fl.rXU(Nw),Fl.rXU(wA),Fl.rXU(Ck),Fl.rXU(EA),Fl.rXU(Pk))},XA.ɵcmp=Fl.VBU({type:XA,selectors:[["bit-lock"]],decls:3,vars:2,consts:[["spinner",""],[4,"ngIf","ngIfElse"],[1,"tw-flex","tw-items-center","tw-justify-center"],["aria-hidden","true",1,"bwi","bwi-spinner","bwi-spin","bwi-3x"],[4,"ngIf"],[3,"activeUnlockOption","unlockOptions","biometricUnlockBtnText"],["type","button","bitButton","","appAutofocus","","buttonType","primary","block","",1,"tw-mb-3",3,"click","disabled","loading","bitTooltip"],[1,"tw-flex","tw-flex-col","tw-space-y-3"],[1,"tw-text-center","tw-mb-0"],[3,"unlockSuccess"],["type","button","bitButton","","block","",3,"click"],["type","button","bitButton","","buttonType","secondary","block","",3,"click"],[3,"bitSubmit","formGroup"],["type","password","formControlName","pin","bitInput","","appAutofocus","","name","pin","required","","appInputVerbatim","",1,"tw-font-mono"],["type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle","",3,"toggledChange","toggled"],["type","submit","bitButton","","bitFormButton","","buttonType","primary","block",""],[1,"tw-text-center"],[3,"unlockSuccess","formButton"],["type","button","bitButton","","bitFormButton","","block","",3,"click"],["type","button","bitButton","","bitFormButton","","buttonType","secondary","block","",3,"click","disabled"],["type","button","bitButton","","bitFormButton","","buttonType","secondary","block","",3,"click"],[3,"activeUnlockOptionChange","successfulUnlock","prfUnlockSuccess","logOut","activeUnlockOption","unlockOptions","biometricUnlockBtnText"]],template:function(e,t){if(1&e&&Fl.DNE(0,OA,2,0,"ng-template",null,0,Fl.C5r)(2,LA,4,3,"ng-container",1),2&e){const e=Fl.sdS(1);Fl.R7$(2),Fl.Y8G("ngIf",t.unlockOptions&&!t.loading)("ngIfElse",e)}},dependencies:[kl.MD,kl.bT,sf,wd,GI,Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.YS,Il.j4,Il.JD,id,td,Gu,Ac,fu,ju,iw,nw,pc,jd,Md,Ql,Zl,FA,DA,_l,rf],encapsulation:2});class qA{static createResultToJson(e){return{id:e.credentialId,rawId:e.credentialId,response:{clientDataJSON:e.clientDataJSON,authenticatorData:e.authData,transports:e.transports,publicKey:e.publicKey,publicKeyAlgorithm:e.publicKeyAlgorithm,attestationObject:e.attestationObject},authenticatorAttachment:"platform",clientExtensionResults:e.extensions,type:"public-key"}}static getResultToJson(e){return{id:e.credentialId,rawId:e.credentialId,response:{clientDataJSON:e.clientDataJSON,authenticatorData:e.authenticatorData,signature:e.signature,userHandle:e.userHandle},authenticatorAttachment:"platform",clientExtensionResults:{},type:"public-key"}}static bufferToString(e){return qA.fromBufferToB64(qA.bufferSourceToUint8Array(e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}static stringToBuffer(e){return qA.fromB64ToArray(qA.fromUrlB64ToB64(e)).buffer}static bufferSourceToUint8Array(e){return qA.isArrayBuffer(e)?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}static isArrayBuffer(e){return e instanceof ArrayBuffer||void 0===e.buffer}static fromB64toUrlB64(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}static fromBufferToB64(e){if(null==e)return null;let t="";const i=new Uint8Array(e);for(let e=0;e<i.byteLength;e++)t+=String.fromCharCode(i[e]);return globalThis.btoa(t)}static fromB64ToArray(e){if(null==e)return null;const t=globalThis.atob(e),i=new Uint8Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);return i}static fromUrlB64ToB64(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Illegal base64url string!")}return t}static cipherHasNoOtherPasskeys(e,t){return null==e.login.fido2Credentials||0===e.login.fido2Credentials.length||e.login.fido2Credentials.some(e=>e.userHandle===t)}}var WA=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var YA=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function HA(e,t){if(1&e&&(Fl.j41(0,"li"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.SpI(" ",Fl.i5U(2,1,"userkeyRotationDisclaimerAccountRecoveryOrgsText",e.params.orgName)," ")}}function JA(e,t){if(1&e&&(Fl.j41(0,"li"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.SpI(" ",Fl.i5U(2,1,"userkeyRotationDisclaimerEmergencyAccessText",e.params.numberOfEmergencyAccessUsers)," ")}}class ZA{constructor(e,t,i){this.params=e,this.logService=t,this.dialogRef=i}submit(){return YA(this,void 0,void 0,function*(){try{this.dialogRef.close(!0)}catch(e){this.logService.error(e)}})}static open(e,t){return e.open(ZA,{data:t})}}ZA.ɵfac=function(e){return new(e||ZA)(Fl.rXU(pd.Qs),Fl.rXU(Za),Fl.rXU(pd.ce))},ZA.ɵcmp=Fl.VBU({type:ZA,selectors:[["key-rotation-trust-info"]],decls:18,vars:14,consts:[["dialogSize","large"],["bitDialogTitle",""],["bitDialogContent",""],[1,"tw-mt-2","tw-mb-0","tw-pl-4"],[4,"ngIf"],["bitDialogFooter",""],["bitButton","","target","_blank","rel","noreferrer","buttonType","primary",3,"click"],["bitButton","","type","button","buttonType","secondary","bitDialogClose",""]],template:function(e,t){1&e&&(Fl.j41(0,"bit-dialog",0)(1,"span",1)(2,"strong"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"span",2),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.j41(8,"ul",3),Fl.DNE(9,HA,3,4,"li",4)(10,JA,3,4,"li",4),Fl.k0s()(),Fl.qex(11,5),Fl.j41(12,"a",6),Fl.bIt("click",function(){return t.submit()}),Fl.EFF(13),Fl.nI1(14,"i18n"),Fl.k0s(),Fl.j41(15,"button",7),Fl.EFF(16),Fl.nI1(17,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e&&(Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,6,"userkeyRotationDisclaimerTitle")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(7,8,"userkeyRotationDisclaimerDescription")," "),Fl.R7$(3),Fl.Y8G("ngIf",null!=t.params.orgName),Fl.R7$(),Fl.Y8G("ngIf",t.params.numberOfEmergencyAccessUsers>0),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(14,10,"continue")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(17,12,"close")," "))},dependencies:[kl.MD,kl.bT,sf,Fh,ch,Ph,id,td,Il.X1,pc,Il.YN,rf],encapsulation:2});var QA=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class eD{constructor(e,t,i,n,r){this.params=e,this.formBuilder=t,this.keyService=i,this.logService=n,this.dialogRef=r,this.loading=!0,this.fingerprint="",this.confirmForm=this.formBuilder.group({})}ngOnInit(){return QA(this,void 0,void 0,function*(){try{const e=yield this.keyService.getFingerprint(this.params.orgId,this.params.publicKey);null!=e&&(this.fingerprint=e.join("-"))}catch(e){this.logService.error(e)}this.loading=!1})}submit(){return QA(this,void 0,void 0,function*(){this.loading||this.dialogRef.close(!0)})}static open(e,t){return e.open(eD,{data:t})}}eD.ɵfac=function(e){return new(e||eD)(Fl.rXU(pd.Qs),Fl.rXU(Il.ok),Fl.rXU(Bp),Fl.rXU(Za),Fl.rXU(pd.ce))},eD.ɵcmp=Fl.VBU({type:eD,selectors:[["account-recovery-trust"]],decls:20,vars:18,consts:[["dialogSize","large",3,"loading","title","subtitle"],["bitDialogContent",""],["bitTypography","body1"],["bitDialogFooter",""],["buttonType","primary","bitButton","","bitFormButton","","type","button",3,"click"],["bitButton","","bitFormButton","","buttonType","secondary","type","button","bitDialogClose",""]],template:function(e,t){1&e&&(Fl.j41(0,"bit-dialog",0),Fl.nI1(1,"i18n"),Fl.qex(2,1),Fl.j41(3,"p",2),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.nrm(6,"br")(7,"br"),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.j41(10,"code"),Fl.EFF(11),Fl.k0s()(),Fl.bVm(),Fl.qex(12,3),Fl.j41(13,"button",4),Fl.bIt("click",function(){return t.submit()}),Fl.j41(14,"span"),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s()(),Fl.j41(17,"button",5),Fl.EFF(18),Fl.nI1(19,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e&&(Fl.Y8G("loading",t.loading)("title",Fl.bMT(1,8,"trustOrganization"))("subtitle",t.params.name),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(5,10,"orgTrustWarning1")," "),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(9,12,"fingerprintPhrase")," "),Fl.R7$(3),Fl.JRh(t.fingerprint),Fl.R7$(4),Fl.JRh(Fl.bMT(16,14,"trust")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(19,16,"doNotTrust")," "))},dependencies:[kl.MD,sf,Fh,ch,Ph,id,td,Hh,tc,rc,Il.X1,Gu,pc,jd,Il.YN,dd,rf],encapsulation:2});var tD=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class iD{constructor(e,t,i,n,r){this.params=e,this.formBuilder=t,this.keyService=i,this.logService=n,this.dialogRef=r,this.loading=!0,this.fingerprint="",this.confirmForm=this.formBuilder.group({})}ngOnInit(){return tD(this,void 0,void 0,function*(){try{const e=yield this.keyService.getFingerprint(this.params.userId,this.params.publicKey);null!=e&&(this.fingerprint=e.join("-"))}catch(e){this.logService.error(e)}this.loading=!1})}submit(){return tD(this,void 0,void 0,function*(){this.loading||this.dialogRef.close(!0)})}static open(e,t){return e.open(iD,{data:t})}}iD.ɵfac=function(e){return new(e||iD)(Fl.rXU(pd.Qs),Fl.rXU(Il.ok),Fl.rXU(Bp),Fl.rXU(Za),Fl.rXU(pd.ce))},iD.ɵcmp=Fl.VBU({type:iD,selectors:[["emergency-access-trust"]],decls:23,vars:21,consts:[["dialogSize","large",3,"loading","title","subtitle"],["bitDialogContent",""],["type","warning"],["bitTypography","body1"],["bitLink","","href","https://bitwarden.com/help/fingerprint-phrase/","target","_blank","rel","noopener"],["bitDialogFooter",""],["buttonType","primary","bitButton","","bitFormButton","","type","button",3,"click"],["bitButton","","bitFormButton","","buttonType","secondary","type","button","bitDialogClose",""]],template:function(e,t){1&e&&(Fl.j41(0,"bit-dialog",0),Fl.nI1(1,"i18n"),Fl.qex(2,1),Fl.j41(3,"bit-callout",2),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s(),Fl.j41(6,"p",3),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.j41(9,"a",4),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s()(),Fl.j41(12,"p",3)(13,"code"),Fl.EFF(14),Fl.k0s()(),Fl.bVm(),Fl.qex(15,5),Fl.j41(16,"button",6),Fl.bIt("click",function(){return t.submit()}),Fl.j41(17,"span"),Fl.EFF(18),Fl.nI1(19,"i18n"),Fl.k0s()(),Fl.j41(20,"button",7),Fl.EFF(21),Fl.nI1(22,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e&&(Fl.Y8G("loading",t.loading)("title",Fl.bMT(1,9,"trustUser"))("subtitle",t.params.name),Fl.R7$(4),Fl.JRh(Fl.bMT(5,11,"emergencyAccessTrustWarning")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(8,13,"fingerprintEnsureIntegrityVerify")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(11,15,"learnMore")),Fl.R7$(4),Fl.JRh(t.fingerprint),Fl.R7$(4),Fl.JRh(Fl.bMT(19,17,"trust")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(22,19,"doNotTrust")," "))},dependencies:[kl.MD,sf,Fh,ch,Ph,id,td,Hh,uw,tc,rc,Il.X1,Gu,pc,jd,Il.YN,dd,ud,rf],encapsulation:2});var nD=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function rD(e,t){1&e&&(Fl.j41(0,"div",0),Fl.nrm(1,"i",1),Fl.nI1(2,"i18n"),Fl.j41(3,"span",2),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()()),2&e&&(Fl.R7$(),Fl.Y8G("title",Fl.mNQ(Fl.bMT(2,3,"loading"))),Fl.R7$(3),Fl.JRh(Fl.bMT(5,5,"loading")))}function sD(e,t){if(1&e&&(Fl.j41(0,"p"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s(),Fl.j41(3,"p",3),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s(),Fl.j41(6,"p",4),Fl.EFF(7),Fl.k0s(),Fl.j41(8,"p",5),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.nrm(11,"button",6),Fl.nI1(12,"i18n"),Fl.k0s(),Fl.j41(13,"p",7),Fl.EFF(14),Fl.k0s(),Fl.j41(15,"div",8)(16,"button",9),Fl.EFF(17),Fl.nI1(18,"i18n"),Fl.k0s(),Fl.j41(19,"button",10),Fl.EFF(20),Fl.nI1(21,"i18n"),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.JRh(Fl.bMT(2,12,"removeMasterPasswordForOrgUserKeyConnector")),Fl.R7$(3),Fl.JRh(Fl.bMT(5,14,"organization")),Fl.R7$(3),Fl.JRh(e.organization.name),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(10,16,"domain")," "),Fl.R7$(2),Fl.Y8G("label",Fl.bMT(12,18,"keyConnectorDomainTooltip")),Fl.R7$(3),Fl.JRh(e.keyConnectorHostName),Fl.R7$(2),Fl.Y8G("block",!0)("bitAction",e.convert),Fl.R7$(),Fl.SpI(" ",Fl.bMT(18,20,"continueWithLogIn")," "),Fl.R7$(2),Fl.Y8G("block",!0)("bitAction",e.leave),Fl.R7$(),Fl.SpI(" ",Fl.bMT(21,22,"doNotContinue")," ")}}class oD{constructor(e,t,i,n,r,s,o,a,l){this.logService=e,this.router=t,this.accountService=i,this.syncService=n,this.i18nService=r,this.keyConnectorService=s,this.organizationApiService=o,this.dialogService=a,this.toastService=l,this.continuing=!1,this.leaving=!1,this.loading=!0,this.convert=()=>nD(this,void 0,void 0,function*(){this.continuing=!0;try{yield this.keyConnectorService.migrateUser(this.organization.keyConnectorUrl,this.activeUserId),this.toastService.showToast({variant:"success",message:this.i18nService.t("organizationVerified")}),yield this.router.navigate(["/"])}catch(e){this.continuing=!1,this.handleActionError(e)}}),this.leave=()=>nD(this,void 0,void 0,function*(){if(!(yield this.dialogService.openSimpleDialog({title:{key:"leaveOrganization"},content:{key:"leaveOrganizationContent"},type:"warning",acceptButtonText:{key:"leaveNow"},cancelButtonText:{key:"cancel"}})))return!1;this.leaving=!0;try{yield this.organizationApiService.leave(this.organization.id),this.toastService.showToast({variant:"success",message:this.i18nService.t("leftOrganization")}),yield this.router.navigate(["/"])}catch(e){this.leaving=!1,this.handleActionError(e)}})}ngOnInit(){return nD(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.accountService.activeAccount$);return null==e?(this.logService.info("[Key Connector remove password] No active account found, redirecting to login."),void(yield this.router.navigate(["/"]))):(this.activeUserId=e.id,yield this.syncService.fullSync(!1),this.organization=yield this.keyConnectorService.getManagingOrganization(this.activeUserId),null==this.organization?(this.logService.info("[Key Connector remove password] No organization found, redirecting to login."),void(yield this.router.navigate(["/"]))):(this.keyConnectorHostName=bd.getHostname(this.organization.keyConnectorUrl),void(this.loading=!1)))})}get action(){return this.continuing||this.leaving}handleActionError(e){let t="";(e instanceof iS||e instanceof Error)&&(t=e.message),this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:t})}}oD.ɵfac=function(e){return new(e||oD)(Fl.rXU(Za),Fl.rXU(Fd.Ix),Fl.rXU(Zk),Fl.rXU(qx),Fl.rXU(Ul),Fl.rXU(wT),Fl.rXU(nI),Fl.rXU(lh),Fl.rXU(qb))},oD.ɵcmp=Fl.VBU({type:oD,selectors:[["km-ui-remove-password"]],decls:2,vars:1,consts:[[1,"tw-text-center"],["aria-hidden","true",1,"bwi","bwi-spinner","bwi-spin","bwi-2x","tw-text-muted",3,"title"],[1,"tw-sr-only"],[1,"tw-mb-0","tw-font-bold"],[1,"tw-mb-6"],[1,"tw-mb-0","tw-font-bold","tw-inline-flex","tw-items-center"],["type","button","tooltipPosition","above-center","bitIconButton","bwi-info-circle","size","small",3,"label"],[1,"tw-mb-6","tw-font-mono"],[1,"tw-flex","tw-flex-col","tw-gap-2"],["bitButton","","type","button","buttonType","primary",3,"block","bitAction"],["bitButton","","type","button","buttonType","secondary",3,"block","bitAction"]],template:function(e,t){1&e&&Fl.nVh(0,rD,6,7,"div",0)(1,sD,22,24),2&e&&Fl.vxM(t.loading?0:1)},dependencies:[kl.MD,id,td,Bd,Ql,Zl,sc],encapsulation:2});class aD{}var lD=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function cD(e,t){1&e&&(Fl.j41(0,"div",0),Fl.nrm(1,"i",1),Fl.nI1(2,"i18n"),Fl.j41(3,"span",2),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()()),2&e&&(Fl.R7$(),Fl.Y8G("title",Fl.mNQ(Fl.bMT(2,3,"loading"))),Fl.R7$(3),Fl.JRh(Fl.bMT(5,5,"loading")))}function uD(e,t){if(1&e&&(Fl.j41(0,"p"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s(),Fl.j41(3,"p",9),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s(),Fl.j41(6,"p",10),Fl.EFF(7),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.JRh(Fl.bMT(2,3,"confirmKeyConnectorOrganizationUserDescription")),Fl.R7$(3),Fl.JRh(Fl.bMT(5,5,"organization")),Fl.R7$(3),Fl.JRh(e.organizationName)}}function dD(e,t){1&e&&(Fl.j41(0,"p"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.JRh(Fl.bMT(2,1,"verifyYourDomainDescription")))}function hD(e,t){if(1&e&&(Fl.nVh(0,uD,8,7)(1,dD,3,3,"p"),Fl.j41(2,"p",3),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.nrm(5,"button",4),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.j41(7,"p",5),Fl.EFF(8),Fl.k0s(),Fl.j41(9,"div",6)(10,"button",7),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s(),Fl.j41(13,"button",8),Fl.EFF(14),Fl.nI1(15,"i18n"),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.vxM(e.organizationName?0:1),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,10,"domain")," "),Fl.R7$(2),Fl.Y8G("label",Fl.bMT(6,12,"keyConnectorDomainTooltip")),Fl.R7$(3),Fl.JRh(e.keyConnectorHostName),Fl.R7$(2),Fl.Y8G("bitAction",e.confirm)("block",!0),Fl.R7$(),Fl.SpI(" ",Fl.bMT(12,14,"continueWithLogIn")," "),Fl.R7$(2),Fl.Y8G("bitAction",e.cancel)("block",!0),Fl.R7$(),Fl.SpI(" ",Fl.bMT(15,16,"doNotContinue")," ")}}class pD{constructor(e,t,i,n,r,s,o,a,l,c){this.router=e,this.logService=t,this.keyConnectorService=i,this.messagingService=n,this.syncService=r,this.accountService=s,this.keyConnectorApiService=o,this.toastService=a,this.i18nService=l,this.anonLayoutWrapperDataService=c,this.loading=!0,this.onBeforeNavigation=()=>lD(this,void 0,void 0,function*(){}),this.confirm=()=>lD(this,void 0,void 0,function*(){yield this.keyConnectorService.convertNewSsoUserToKeyConnector(this.userId),this.organizationName?this.toastService.showToast({variant:"success",message:this.i18nService.t("organizationVerified")}):this.toastService.showToast({variant:"success",message:this.i18nService.t("domainVerified")}),yield this.syncService.fullSync(!0),this.messagingService.send("loggedIn"),yield this.onBeforeNavigation(),yield this.router.navigate(["/"])}),this.cancel=()=>lD(this,void 0,void 0,function*(){this.messagingService.send("logout")})}ngOnInit(){return lD(this,void 0,void 0,function*(){try{this.userId=yield(0,bo._)(iv(this.accountService.activeAccount$))}catch(e){return this.logService.info("[confirm-key-connector-domain] no active account"),void this.messagingService.send("logout")}const e=yield(0,bo._)(this.keyConnectorService.requiresDomainConfirmation$(this.userId));if(null==e)return this.logService.info("[confirm-key-connector-domain] missing required parameters"),void this.messagingService.send("logout");this.organizationName=yield this.getOrganizationName(e.organizationSsoIdentifier),null==this.organizationName&&this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageTitle:{key:"verifyYourDomainToLogin"}}),this.keyConnectorUrl=e.keyConnectorUrl,this.keyConnectorHostName=bd.getHostname(e.keyConnectorUrl),this.loading=!1})}getOrganizationName(e){return lD(this,void 0,void 0,function*(){try{return(yield this.keyConnectorApiService.getConfirmationDetails(e)).organizationName}catch(t){return void this.logService.warning(`[ConfirmKeyConnectorDomainComponent] Unable to get key connector confirmation details for organizationSsoIdentifier ${e}:`,t)}})}}pD.ɵfac=function(e){return new(e||pD)(Fl.rXU(Fd.Ix),Fl.rXU(Za),Fl.rXU(wT),Fl.rXU(bk),Fl.rXU(qx),Fl.rXU(Zk),Fl.rXU(aD),Fl.rXU(qb),Fl.rXU(Ul),Fl.rXU(Ck))},pD.ɵcmp=Fl.VBU({type:pD,selectors:[["confirm-key-connector-domain"]],inputs:{onBeforeNavigation:"onBeforeNavigation"},decls:2,vars:1,consts:[[1,"tw-text-center"],["aria-hidden","true",1,"bwi","bwi-spinner","bwi-spin","bwi-2x","tw-text-muted",3,"title"],[1,"tw-sr-only"],[1,"tw-mb-0","tw-font-bold","tw-inline-flex","tw-items-center"],["type","button","tooltipPosition","above-center","bitIconButton","bwi-info-circle","size","small",3,"label"],[1,"tw-mb-6","tw-font-mono"],[1,"tw-flex","tw-flex-col","tw-gap-2"],["bitButton","","type","button","buttonType","primary",3,"bitAction","block"],["bitButton","","type","button","buttonType","secondary",3,"bitAction","block"],[1,"tw-mb-0","tw-font-bold"],[1,"tw-mb-6"]],template:function(e,t){1&e&&Fl.nVh(0,cD,6,7,"div",0)(1,hD,16,18),2&e&&Fl.vxM(t.loading?0:1)},dependencies:[kl.MD,id,td,Bd,Ql,Zl,sc],encapsulation:2});var vD=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class fD{constructor(e,t,i){this.i18nService=e,this.sessionTimeoutTypeService=t,this.policyService=i,this.availableTimeoutOptions$=(0,$o.v)(()=>vD(this,void 0,void 0,function*(){const e=this.getAllTimeoutOptions();return(yield Promise.all(e.map(e=>vD(this,void 0,void 0,function*(){return{option:e,available:yield this.sessionTimeoutTypeService.isAvailable(e.value)}})))).filter(e=>e.available).map(e=>e.option)}))}onTimeoutSave(e){}policyFilteredTimeoutOptions$(e){const t=this.policyService.policiesByType$(op.MaximumVaultTimeout,e).pipe(hv,(0,l.T)(e=>{var t;return null!==(t=null==e?void 0:e.data)&&void 0!==t?t:null}));return(0,jo.z)([this.availableTimeoutOptions$,t,t.pipe((0,To.H)(e=>vD(this,void 0,void 0,function*(){if(null==e)return null;switch(e.type){case"immediately":return yield this.sessionTimeoutTypeService.getOrPromoteToAvailable(wv);case"onSystemLock":return yield this.sessionTimeoutTypeService.getOrPromoteToAvailable(mv)}return null})))]).pipe((0,To.H)(e=>vD(this,[e],void 0,function*([e,t,i]){return null==t?e:e.filter(e=>{switch(t.type){case"immediately":return e.value===i;case"onSystemLock":return!(e.value!==wv&&!Iv(e.value)&&e.value!==bv&&e.value!==mv&&e.value!==yv&&e.value!==gv)||e.value===i;case"onAppRestart":return e.value===wv||Iv(e.value)||e.value===bv||e.value===fv;case"custom":case null:case void 0:return e.value===wv||e.value===bv||Iv(e.value)&&e.value<=t.minutes;case"never":return!0;default:throw Error(`Unsupported policy type: ${t.type}`)}})})))}getAllTimeoutOptions(){return[{name:"immediately",value:wv},{name:"oneMinute",value:Sv},{name:"fiveMinutes",value:5},{name:"fifteenMinutes",value:15},{name:"thirtyMinutes",value:30},{name:"oneHour",value:60},{name:"fourHours",value:240},{name:"onIdle",value:yv},{name:"onSleep",value:gv},{name:"onLocked",value:mv},{name:"sessionTimeoutOnRestart",value:fv},{name:"never",value:vv},{name:"custom",value:bv}]}}class mD{}var gD=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const yD=(e,t)=>t.value;function bD(e,t){if(1&e&&(Fl.nrm(0,"bit-option",3),Fl.nI1(1,"i18n")),2&e){const e=t.$implicit;Fl.Y8G("value",e.value)("label",Fl.bMT(1,2,e.name))}}function wD(e,t){if(1&e&&(Fl.j41(0,"div",4)(1,"bit-form-field",6),Fl.nrm(2,"input",7),Fl.j41(3,"bit-label"),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()(),Fl.j41(6,"bit-form-field",8),Fl.nrm(7,"input",9),Fl.j41(8,"bit-label"),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s()()()),2&e){const e=Fl.XpG();Fl.R7$(4),Fl.JRh(Fl.bMT(5,3,"hours")),Fl.R7$(3),Fl.Y8G("min",e.customMinutesMin),Fl.R7$(2),Fl.JRh(Fl.bMT(10,5,"minutes"))}}function SD(e,t){if(1&e&&(Fl.j41(0,"div",5),Fl.nrm(1,"i",10),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.SpI(" ",Fl.brH(3,1,"sessionTimeoutSettingsPolicyMaximumError",e.maxSessionTimeoutPolicyHours,e.maxSessionTimeoutPolicyMinutes)," ")}}function kD(e,t){if(1&e&&(Fl.j41(0,"bit-hint",11),Fl.EFF(1),Fl.k0s()),2&e){Fl.XpG();const e=Fl.r8f(0);Fl.R7$(),Fl.SpI(" ",e," ")}}function ID(e,t){if(1&e&&(Fl.SS7(0),Fl.nI1(1,"async"),Fl.nVh(2,kD,2,1,"bit-hint",11)),2&e){const e=Fl.bH3(Fl.bMT(1,1,Fl.XpG().policyTimeoutMessage$));Fl.R7$(2),Fl.vxM(null!=e?2:-1)}}class CD{constructor(){this.formBuilder=(0,a.WQX)(Il.ok),this.policyService=(0,a.WQX)(Jb),this.i18nService=(0,a.WQX)(Ul),this.accountService=(0,a.WQX)(Zk),this.destroyRef=(0,a.WQX)(a.abz),this.sessionTimeoutTypeService=(0,a.WQX)(mD),this.logService=(0,a.WQX)(Za),this.availableTimeoutOptions=o.hFB.required(),this.maxSessionTimeoutPolicyData=null,this.form=this.formBuilder.group({vaultTimeout:[null],custom:this.formBuilder.group({hours:[0,[Il.k0.required,Il.k0.min(0)]],minutes:[0,[Il.k0.required,Il.k0.min(0),Il.k0.max(59)]]})},{validators:[this.formValidator.bind(this)]}),this.onChange=null,this.validatorChange=null}get isCustomTimeoutType(){return this.form.controls.vaultTimeout.value===bv}get customMinutesMin(){return 0===this.form.controls.custom.controls.hours.value?1:0}get exceedsPolicyMaximumTimeout(){var e;return(null===(e=this.maxSessionTimeoutPolicyData)||void 0===e?void 0:e.type)===bv&&this.isCustomTimeoutType&&this.getTotalMinutesFromCustomValue(this.form.value.custom)>this.maxSessionTimeoutPolicyMinutes+60*this.maxSessionTimeoutPolicyHours}ngOnInit(){const e=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.policyService.policiesByType$(op.MaximumVaultTimeout,e)),hv,(0,Eo.p)(e=>null!=e),(0,l.T)(e=>e.data));this.policyTimeoutMessage$=e.pipe((0,go.n)(e=>this.getPolicyTimeoutMessage(e))),e.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.maxSessionTimeoutPolicyData=e,this.form.controls.custom.updateValueAndValidity(),this.validatorChange&&this.validatorChange()}),this.form.valueChanges.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{if(this.onChange){const t=this.getVaultTimeout(e);if(null!=t){(!this.isCustomTimeoutType||this.form.controls.custom.valid)&&this.onChange(t)}}}),this.form.controls.vaultTimeout.valueChanges.pipe((0,Eo.p)(e=>null!=e&&e!==bv),(0,xl.pQ)(this.destroyRef)).subscribe(e=>{const t=Iv(e)?e:kv;this.form.patchValue({custom:{hours:Math.floor(t/60),minutes:t%60}},{emitEvent:!1}),this.form.controls.custom.markAllAsTouched()})}get maxSessionTimeoutPolicyHours(){var e,t;return Math.floor((null!==(t=null===(e=this.maxSessionTimeoutPolicyData)||void 0===e?void 0:e.minutes)&&void 0!==t?t:0)/60)}get maxSessionTimeoutPolicyMinutes(){var e,t;return(null!==(t=null===(e=this.maxSessionTimeoutPolicyData)||void 0===e?void 0:e.minutes)&&void 0!==t?t:0)%60}writeValue(e){if(null==e)return;if(!this.availableTimeoutOptions().some(t=>t.value===e))return this.logService.debug(`[SessionTimeoutInputComponent] form control write value as custom ${e}`),void this.form.setValue({vaultTimeout:bv,custom:{hours:Math.floor(e/60),minutes:e%60}});this.logService.debug(`[SessionTimeoutInputComponent] form control write value as preset ${e}`),this.form.patchValue({vaultTimeout:e})}registerOnChange(e){this.onChange=e}registerOnTouched(e){}setDisabledState(e){}validate(e){return this.form.errors}registerOnValidatorChange(e){this.validatorChange=e}getTotalMinutesFromCustomValue(e){var t,i;return 60*(null!==(t=null==e?void 0:e.hours)&&void 0!==t?t:0)+(null!==(i=null==e?void 0:e.minutes)&&void 0!==i?i:0)}formValidator(e){var t,i;const n=e.value;if(!(n.vaultTimeout===bv))return null;const r=null===(t=n.custom)||void 0===t?void 0:t.hours,s=null===(i=n.custom)||void 0===i?void 0:i.minutes;if(null==r||null==s)return{required:!0};return 0===this.getTotalMinutesFromCustomValue(n.custom)?{minTimeoutError:!0}:this.exceedsPolicyMaximumTimeout?{maxTimeoutError:!0}:null}getVaultTimeout(e){var t;return e.vaultTimeout!==bv?null!==(t=e.vaultTimeout)&&void 0!==t?t:null:this.getTotalMinutesFromCustomValue(e.custom)}getPolicyTimeoutMessage(e){return gD(this,void 0,void 0,function*(){const t=yield this.getPolicyAppliedTimeout(e);switch(t){case null:return null;case wv:return this.i18nService.t("sessionTimeoutSettingsPolicySetDefaultTimeoutToImmediately");case mv:return this.i18nService.t("sessionTimeoutSettingsPolicySetDefaultTimeoutToOnLocked");case fv:return this.i18nService.t("sessionTimeoutSettingsPolicySetDefaultTimeoutToOnRestart");default:if(Iv(t)){const e=Math.floor(t/60),i=t%60;return this.i18nService.t("sessionTimeoutSettingsPolicySetMaximumTimeoutToHoursMinutes",e,i)}throw new Error("Invalid timeout parameter")}})}getPolicyAppliedTimeout(e){return gD(this,void 0,void 0,function*(){switch(e.type){case"immediately":return yield this.sessionTimeoutTypeService.getOrPromoteToAvailable(wv);case"onSystemLock":return yield this.sessionTimeoutTypeService.getOrPromoteToAvailable(mv);case"onAppRestart":return fv;case"never":{const e=yield this.sessionTimeoutTypeService.getOrPromoteToAvailable(vv);return e==vv?null:e}default:return e.minutes}})}}CD.MIN_CUSTOM_MINUTES=0,CD.ɵfac=function(e){return new(e||CD)},CD.ɵcmp=Fl.VBU({type:CD,selectors:[["bit-session-timeout-input"]],inputs:{availableTimeoutOptions:[1,"availableTimeoutOptions"]},features:[Fl.Jv_([{provide:Il.kq,multi:!0,useExisting:CD},{provide:Il.cz,multi:!0,useExisting:CD}])],decls:11,vars:7,consts:[[1,"tw-mb-4",3,"formGroup"],[3,"disableMargin"],["formControlName","vaultTimeout"],[3,"value","label"],["formGroupName","custom",1,"tw-grid","tw-grid-cols-12","tw-gap-4"],["id","session-timeout-maximum-error",1,"tw-mt-1","tw-text-danger","tw-text-xs"],["disableMargin","",1,"tw-col-span-6"],["bitInput","","type","number","min","0","formControlName","hours","aria-describedby","session-timeout-maximum-error"],["disableMargin","",1,"tw-col-span-6","tw-self-start"],["bitInput","","type","number","max","59","formControlName","minutes","aria-describedby","session-timeout-maximum-error",3,"min"],["aria-hidden","true",1,"bwi","bwi-error"],["id","session-timeout-maximum-error",1,"tw-mb-1"]],template:function(e,t){1&e&&(Fl.j41(0,"div",0)(1,"bit-form-field",1)(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"bit-select",2),Fl.Z7z(6,bD,2,4,"bit-option",3,yD),Fl.k0s()(),Fl.nVh(8,wD,11,7,"div",4),Fl.nVh(9,SD,4,5,"div",5)(10,ID,3,4),Fl.k0s()),2&e&&(Fl.Y8G("formGroup",t.form),Fl.R7$(),Fl.Y8G("disableMargin",!t.isCustomTimeoutType),Fl.R7$(2),Fl.JRh(Fl.bMT(4,5,"vaultTimeout1")),Fl.R7$(3),Fl.Dyx(t.availableTimeoutOptions()),Fl.R7$(2),Fl.vxM(t.isCustomTimeoutType?8:-1),Fl.R7$(),Fl.vxM(t.form.hasError("maxTimeoutError")?9:null!=t.maxSessionTimeoutPolicyData?10:-1))},dependencies:[kl.MD,sf,Il.X1,Il.me,Il.Q0,Il.BC,Il.cb,Il.VZ,Il.zX,Il.j4,Il.JD,Il.$R,Gu,Ac,hu,fu,ju,Wu,qu,zu,kl.Jj,rf],encapsulation:2,changeDetection:0});var TD=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function PD(e,t){if(1&e&&Fl.nrm(0,"bit-session-timeout-input",1),2&e){const e=Fl.XpG();Fl.Y8G("availableTimeoutOptions",t)("formControl",e.formGroup.controls.timeout)}}function FD(e,t){if(1&e&&(Fl.nrm(0,"bit-option",4),Fl.nI1(1,"i18n")),2&e){const e=t.$implicit;Fl.Y8G("value",e)("label",Fl.bMT(1,2,e))}}function RD(e,t){1&e&&(Fl.j41(0,"bit-hint"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.JRh(Fl.bMT(2,1,"sessionTimeoutSettingsSetUnlockMethodToChangeTimeoutAction")))}function xD(e,t){1&e&&(Fl.j41(0,"bit-hint"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.JRh(Fl.bMT(2,1,"sessionTimeoutSettingsManagedByOrganization")))}class AD{constructor(){this.refreshTimeoutActionSettings=(0,o.hFB)(new Dd.t(void 0)),this.vaultTimeoutSettingsService=(0,a.WQX)(qp),this.sessionTimeoutSettingsComponentService=(0,a.WQX)(fD),this.i18nService=(0,a.WQX)(Ul),this.toastService=(0,a.WQX)(qb),this.policyService=(0,a.WQX)(Jb),this.accountService=(0,a.WQX)(Zk),this.dialogService=(0,a.WQX)(lh),this.logService=(0,a.WQX)(Za),this.destroyRef=(0,a.WQX)(a.abz),this.platformUtilsService=(0,a.WQX)(Hb),this.formGroup=new Il.gE({timeout:new Il.MJ(null,[Il.k0.required]),timeoutAction:new Il.MJ(pv.Lock,[Il.k0.required])}),this.availableTimeoutActions=(0,a.vPA)([]),this.availableTimeoutOptions$=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.sessionTimeoutSettingsComponentService.policyFilteredTimeoutOptions$(e)),(0,Oo.M)(e=>{this.logService.debug("[SessionTimeoutSettings] Available timeout options",e)})),this.sessionTimeoutActionFromPolicy$=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.policyService.policiesByType$(op.MaximumVaultTimeout,e)),hv,(0,l.T)(e=>null==e?void 0:e.data),(0,l.T)(e=>{var t;return null!==(t=null==e?void 0:e.action)&&void 0!==t?t:null})),this.sessionTimeoutActionFromPolicy=(0,xl.ot)(this.sessionTimeoutActionFromPolicy$)}get canLock(){return this.availableTimeoutActions().includes(pv.Lock)}get supportsLock(){return this.platformUtilsService.getClientType()!==Da.Web&&"logOut"!==this.sessionTimeoutActionFromPolicy()}ngOnInit(){return TD(this,void 0,void 0,function*(){this.userId=yield(0,bo._)(iv(this.accountService.activeAccount$));const e=yield(0,bo._)(this.vaultTimeoutSettingsService.getVaultTimeoutByUserId$(this.userId));this.formGroup.patchValue({timeout:e,timeoutAction:yield(0,bo._)(this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(this.userId))},{emitEvent:!1}),this.vaultTimeoutSettingsService.getVaultTimeoutByUserId$(this.userId).pipe((0,Eo.p)(e=>this.formGroup.controls.timeout.value!==e),(0,Oo.M)(e=>this.logService.debug(`[SessionTimeoutSettings] Updating initial form timeout from ${this.formGroup.controls.timeout.value} to ${e}`)),(0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.formGroup.controls.timeout.setValue(e,{emitEvent:!1})}),this.refreshTimeoutActionSettings().pipe((0,kd.Z)(void 0),(0,go.n)(()=>(0,jo.z)([this.vaultTimeoutSettingsService.availableVaultTimeoutActions$(this.userId),this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(this.userId),this.sessionTimeoutActionFromPolicy$])),(0,xl.pQ)(this.destroyRef)).subscribe(([e,t,i])=>{this.availableTimeoutActions.set(e),this.formGroup.controls.timeoutAction.setValue(t,{emitEvent:!1}),null!=i||e.length<=1?this.formGroup.controls.timeoutAction.disable({emitEvent:!1}):this.formGroup.controls.timeoutAction.enable({emitEvent:!1})}),this.formGroup.controls.timeout.valueChanges.pipe((0,kd.Z)(e),(0,Eo.p)(e=>null!=e),(0,mo.F)(),(0,mm.J)(),(0,To.H)(e=>TD(this,[e],void 0,function*([e,t]){yield this.saveTimeout(e,t)})),(0,xl.pQ)(this.destroyRef)).subscribe(),this.formGroup.controls.timeoutAction.valueChanges.pipe((0,Eo.p)(e=>null!=e),(0,l.T)(e=>TD(this,void 0,void 0,function*(){yield this.saveTimeoutAction(e)})),(0,xl.pQ)(this.destroyRef)).subscribe()})}saveTimeout(e,t){return TD(this,void 0,void 0,function*(){if(this.formGroup.controls.timeout.markAllAsTouched(),this.formGroup.controls.timeout.invalid)return;if(this.logService.debug("[SessionTimeoutSettings] Saving timeout",{previousValue:e,newValue:t}),t===vv){if(!(yield this.dialogService.openSimpleDialog({title:{key:"warning"},content:{key:"neverLockWarning"},type:"warning"})))return void this.formGroup.controls.timeout.setValue(e,{emitEvent:!1})}const i=yield(0,bo._)(this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(this.userId));yield this.vaultTimeoutSettingsService.setVaultTimeoutOptions(this.userId,t,i),this.sessionTimeoutSettingsComponentService.onTimeoutSave(t)})}saveTimeoutAction(e){return TD(this,void 0,void 0,function*(){if(this.logService.debug("[SessionTimeoutSettings] Saving timeout action",e),e===pv.LogOut){if(!(yield this.dialogService.openSimpleDialog({title:{key:"vaultTimeoutLogOutConfirmationTitle"},content:{key:"vaultTimeoutLogOutConfirmation"},type:"warning"})))return void this.formGroup.controls.timeoutAction.setValue(pv.Lock,{emitEvent:!1})}this.formGroup.controls.timeout.hasError("policyError")?this.toastService.showToast({variant:"error",message:this.i18nService.t("vaultTimeoutTooLarge")}):yield this.vaultTimeoutSettingsService.setVaultTimeoutOptions(this.userId,this.formGroup.controls.timeout.value,e)})}}AD.ɵfac=function(e){return new(e||AD)},AD.ɵcmp=Fl.VBU({type:AD,selectors:[["bit-session-timeout-settings"]],inputs:{refreshTimeoutActionSettings:[1,"refreshTimeoutActionSettings"]},decls:13,vars:13,consts:[[3,"formGroup"],[3,"availableTimeoutOptions","formControl"],[3,"disableMargin"],["id","timeoutAction",3,"formControl","required"],[3,"value","label"]],template:function(e,t){if(1&e&&(Fl.j41(0,"div",0),Fl.nVh(1,PD,1,2,"bit-session-timeout-input",1),Fl.nI1(2,"async"),Fl.j41(3,"bit-form-field",2)(4,"bit-label"),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.j41(7,"bit-select",3),Fl.Z7z(8,FD,2,4,"bit-option",4,Fl.fX1),Fl.k0s(),Fl.nVh(10,RD,3,3,"bit-hint"),Fl.nI1(11,"async"),Fl.vZN(12,xD,3,3,"bit-hint"),Fl.k0s()()),2&e){let e;Fl.Y8G("formGroup",t.formGroup),Fl.R7$(),Fl.vxM((e=Fl.bMT(2,7,t.availableTimeoutOptions$))?1:-1,e),Fl.R7$(2),Fl.Y8G("disableMargin",!0),Fl.R7$(2),Fl.JRh(Fl.bMT(6,9,"sessionTimeoutSettingsAction")),Fl.R7$(2),Fl.Y8G("formControl",t.formGroup.controls.timeoutAction)("required",!1),Fl.R7$(),Fl.Dyx(t.availableTimeoutActions()),Fl.R7$(2),Fl.vxM(!t.canLock&&t.supportsLock?10:null!=Fl.bMT(11,11,t.sessionTimeoutActionFromPolicy$)?12:-1)}},dependencies:[hd,kl.MD,Gu,Ac,hu,ju,Il.YN,Il.BC,Il.cb,Il.YS,Il.X1,Il.l_,Il.j4,Ql,VP,sf,Hh,Cw.iI,Wu,qu,zu,tc,CD,kl.Jj,rf],encapsulation:2});var DD=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function ED(e,t){if(1&e&&Fl.nrm(0,"bit-option",8),2&e){const e=t.$implicit;Fl.Y8G("value",e.value)("label",e.name)}}function $D(e,t){1&e&&(Fl.j41(0,"div",9)(1,"bit-form-field",10),Fl.nrm(2,"input",11),Fl.j41(3,"bit-label"),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()(),Fl.j41(6,"bit-form-field",12),Fl.nrm(7,"input",13),Fl.j41(8,"bit-label"),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s()()()),2&e&&(Fl.R7$(4),Fl.JRh(Fl.bMT(5,2,"hours")),Fl.R7$(5),Fl.JRh(Fl.bMT(10,4,"minutes")))}function OD(e,t){if(1&e&&(Fl.j41(0,"bit-hint"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.SpI(" ",Fl.brH(2,1,"vaultTimeoutPolicyInEffect1",e.vaultTimeoutPolicyHours,e.vaultTimeoutPolicyMinutes)," ")}}function UD(e,t){1&e&&(Fl.j41(0,"small",14),Fl.nrm(1,"i",15),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"vaultCustomTimeoutMinimum")," "))}function MD(e,t){if(1&e&&(Fl.j41(0,"small",16),Fl.nrm(1,"i",15),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.SpI(" ",Fl.brH(3,1,"vaultTimeoutPolicyMaximumError",e.vaultTimeoutPolicyHours,e.vaultTimeoutPolicyMinutes)," ")}}class ND{constructor(e,t,i,n,r){this.formBuilder=e,this.policyService=t,this.vaultTimeoutSettingsService=i,this.i18nService=n,this.accountService=r,this.form=this.formBuilder.group({vaultTimeout:[null],custom:this.formBuilder.group({hours:[null],minutes:[null]})}),this.VaultTimeoutAction=pv,this.destroy$=new Co.B}get showCustom(){return this.form.get("vaultTimeout").value===ND.CUSTOM_VALUE}get exceedsMinimumTimeout(){return!this.showCustom||this.customTimeInMinutes()>ND.MIN_CUSTOM_MINUTES}get exceedsMaximumTimeout(){return this.showCustom&&this.customTimeInMinutes()>this.vaultTimeoutPolicyMinutes+60*this.vaultTimeoutPolicyHours}get filteredVaultTimeoutOptions(){return null==this.vaultTimeoutPolicy||null==this.vaultTimeoutPolicy.data?this.vaultTimeoutOptions:this.vaultTimeoutOptions.filter(e=>"number"==typeof e.value&&e.value<=this.vaultTimeoutPolicy.data.minutes)}ngOnInit(){return DD(this,void 0,void 0,function*(){this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.policyService.policiesByType$(op.MaximumVaultTimeout,e)),hv,(0,Eo.p)(e=>null!=e),(0,vm.Q)(this.destroy$)).subscribe(e=>{this.vaultTimeoutPolicy=e,this.applyVaultTimeoutPolicy()}),this.form.valueChanges.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{this.onChange&&this.onChange(this.getVaultTimeout(e))}),this.form.controls.vaultTimeout.valueChanges.pipe((0,Eo.p)(e=>e!==ND.CUSTOM_VALUE),(0,vm.Q)(this.destroy$)).subscribe(e=>{const t="string"==typeof e?0:Math.max(e,0);this.form.patchValue({custom:{hours:Math.floor(t/60),minutes:t%60}},{emitEvent:!1})}),this.canLockVault$=this.vaultTimeoutSettingsService.availableVaultTimeoutActions$().pipe((0,l.T)(e=>e.includes(pv.Lock)))})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngOnChanges(){this.vaultTimeoutOptions.find(e=>e.value===ND.CUSTOM_VALUE)||this.vaultTimeoutOptions.push({name:this.i18nService.t("custom"),value:ND.CUSTOM_VALUE})}getVaultTimeout(e){return e.vaultTimeout!==ND.CUSTOM_VALUE?e.vaultTimeout:60*e.custom.hours+e.custom.minutes}writeValue(e){null!=e&&(this.vaultTimeoutOptions.every(t=>t.value!==e)?this.form.setValue({vaultTimeout:ND.CUSTOM_VALUE,custom:{hours:Math.floor(e/60),minutes:e%60}}):this.form.patchValue({vaultTimeout:e}))}registerOnChange(e){this.onChange=e}registerOnTouched(e){}setDisabledState(e){}validate(e){var t,i;return this.vaultTimeoutPolicy&&(null===(i=null===(t=this.vaultTimeoutPolicy)||void 0===t?void 0:t.data)||void 0===i?void 0:i.minutes)<e.value?{policyError:!0}:this.exceedsMinimumTimeout?null:{minTimeoutError:!0}}registerOnValidatorChange(e){this.validatorChange=e}customTimeInMinutes(){return 60*this.form.value.custom.hours+this.form.value.custom.minutes}applyVaultTimeoutPolicy(){this.vaultTimeoutPolicyHours=Math.floor(this.vaultTimeoutPolicy.data.minutes/60),this.vaultTimeoutPolicyMinutes=this.vaultTimeoutPolicy.data.minutes%60,this.vaultTimeoutOptions=this.vaultTimeoutOptions.filter(e=>e.value===ND.CUSTOM_VALUE||"number"==typeof e.value&&e.value<=this.vaultTimeoutPolicy.data.minutes),this.validatorChange&&this.validatorChange()}}ND.CUSTOM_VALUE=-100,ND.MIN_CUSTOM_MINUTES=0,ND.ɵfac=function(e){return new(e||ND)(Fl.rXU(Il.ok),Fl.rXU(Jb),Fl.rXU(qp),Fl.rXU(Ul),Fl.rXU(Zk))},ND.ɵcmp=Fl.VBU({type:ND,selectors:[["bit-session-timeout-input-legacy"]],inputs:{vaultTimeoutOptions:"vaultTimeoutOptions"},features:[Fl.Jv_([{provide:Il.kq,multi:!0,useExisting:ND},{provide:Il.cz,multi:!0,useExisting:ND}]),Fl.OA$],decls:11,vars:10,consts:[[1,"tw-mb-4",3,"formGroup"],[3,"disableMargin"],["formControlName","vaultTimeout"],[3,"value","label",4,"ngFor","ngForOf"],["class","tw-grid tw-grid-cols-12 tw-gap-4","formGroupName","custom",4,"ngIf"],[4,"ngIf"],["class","tw-text-danger",4,"ngIf"],["class","tw-text-danger","id","maximum-error",4,"ngIf"],[3,"value","label"],["formGroupName","custom",1,"tw-grid","tw-grid-cols-12","tw-gap-4"],["disableMargin","",1,"tw-col-span-6"],["bitInput","","type","number","min","0","formControlName","hours","aria-labelledby","maximum-error"],["disableMargin","",1,"tw-col-span-6","tw-self-end"],["bitInput","","type","number","min","0","name","minutes","formControlName","minutes","aria-labelledby","maximum-error"],[1,"tw-text-danger"],["aria-hidden","true",1,"bwi","bwi-error"],["id","maximum-error",1,"tw-text-danger"]],template:function(e,t){1&e&&(Fl.j41(0,"div",0)(1,"bit-form-field",1)(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"bit-select",2),Fl.DNE(6,ED,1,2,"bit-option",3),Fl.k0s()(),Fl.DNE(7,$D,11,6,"div",4)(8,OD,3,5,"bit-hint",5)(9,UD,4,3,"small",6)(10,MD,4,5,"small",7),Fl.k0s()),2&e&&(Fl.Y8G("formGroup",t.form),Fl.R7$(),Fl.Y8G("disableMargin",!t.showCustom),Fl.R7$(2),Fl.JRh(Fl.bMT(4,8,"vaultTimeout1")),Fl.R7$(3),Fl.Y8G("ngForOf",t.filteredVaultTimeoutOptions),Fl.R7$(),Fl.Y8G("ngIf",t.showCustom),Fl.R7$(),Fl.Y8G("ngIf",null!=t.vaultTimeoutPolicy&&!t.exceedsMaximumTimeout),Fl.R7$(),Fl.Y8G("ngIf",!t.exceedsMinimumTimeout),Fl.R7$(),Fl.Y8G("ngIf",t.exceedsMaximumTimeout))},dependencies:[kl.MD,kl.Sq,kl.bT,sf,Il.X1,Il.me,Il.Q0,Il.BC,Il.cb,Il.VZ,Il.j4,Il.JD,Il.$R,Gu,Ac,hu,fu,ju,Wu,qu,zu,rf],encapsulation:2});const VD={startDesktop:{title:"startDesktopTitle",description:"startDesktopDesc"},desktopIntegrationDisabled:{title:"desktopIntegrationDisabledTitle",description:"desktopIntegrationDisabledDesc"},"not enabled":{title:"biometricsNotEnabledTitle",description:"biometricsNotEnabledDesc"},"not supported":{title:"biometricsNotSupportedTitle",description:"biometricsNotSupportedDesc"},"not unlocked":{title:"biometricsUnlockNotUnlockedTitle",description:"biometricsUnlockNotUnlockedDesc"},invalidateEncryption:{title:"nativeMessagingInvalidEncryptionTitle",description:"nativeMessagingInvalidEncryptionDesc"},"userkey wrong":{title:"nativeMessagingWrongUserKeyTitle",description:"nativeMessagingWrongUserKeyDesc"},wrongUserId:{title:"biometricsWrongUserTitle",description:"biometricsWrongUserDesc"},"not available":{title:"biometricsNotAvailableTitle",description:"biometricsNotAvailableDesc"}};var BD=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function jD(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"button",1),Fl.nI1(2,"i18n"),Fl.nI1(3,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.expand())}),Fl.k0s(),Fl.bVm()}2&e&&(Fl.R7$(),Fl.Y8G("label",Fl.mNQ(Fl.bMT(2,3,"popOutNewWindow")))("title",Fl.bMT(3,5,"popOutNewWindow")))}class GD{constructor(e){this.platformUtilsService=e,this.show=!0}ngOnInit(){return BD(this,void 0,void 0,function*(){this.show&&(pl.inSidebar(window)&&this.platformUtilsService.isFirefox()||pl.inPopout(window))&&(this.show=!1)})}expand(){return BD(this,void 0,void 0,function*(){yield pl.openCurrentPagePopout(window)})}}GD.ɵfac=function(e){return new(e||GD)(Fl.rXU(Hb))},GD.ɵcmp=Fl.VBU({type:GD,selectors:[["app-pop-out"]],inputs:{show:"show"},decls:1,vars:1,consts:[[4,"ngIf"],["bitIconButton","bwi-popout","size","small","type","button",3,"click","label","title"]],template:function(e,t){1&e&&Fl.DNE(0,jD,4,7,"ng-container",0),2&e&&Fl.Y8G("ngIf",t.show)},dependencies:[kl.MD,kl.bT,sf,Ql,Zl,rf],encapsulation:2});const LD="new_popup",zD=m.record(ae,"popup-view-cache",{deserializer:e=>e}),_D=new m(ae,"popup-route-history-details",{deserializer:e=>e}),KD=new wk("save-view-cache"),XD=new wk("clear-view-cache");var qD=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class WD{get hasRestoredCache(){return this._hasRestoredCache}constructor(){this.router=(0,a.WQX)(Fd.Ix),this.state=(0,a.WQX)(d).get(_D),this.location=(0,a.WQX)(IF.aZ),this.hasNavigated=!1,this._hasRestoredCache=!1,this.history$().pipe((0,dm.$)()).subscribe(e=>Array.isArray(e)&&e.forEach(({url:e})=>this.location.go(e))),this.router.events.pipe((0,Eo.p)(e=>e instanceof Fd.wF),(0,Oo.M)(()=>{this.hasNavigated=!0}),(0,l.T)(e=>{let t=this.router.routerState.snapshot.root.firstChild;for(;t.firstChild;)t=t.firstChild;return{event:e,data:t.data}}),(0,Eo.p)(({data:e})=>!(null==e?void 0:e.doNotSaveUrl)),(0,go.n)(({event:e,data:t})=>this.push(e.url,t))).subscribe()}history$(){return this.state.state$}setHistory(e){return qD(this,void 0,void 0,function*(){return this.state.update(()=>e)})}last$(){return this.history$().pipe((0,l.T)(e=>e&&0!==e.length?e[e.length-1]:null))}push(e,t){return qD(this,void 0,void 0,function*(){var i;if(!pl.inPopup(window)||e===(yield(0,bo._)(this.last$().pipe((0,l.T)(e=>null==e?void 0:e.url)))))return;const n={url:e,options:{resetRouterCacheOnTabChange:null!==(i=null==t?void 0:t.resetRouterCacheOnTabChange)&&void 0!==i&&i}};yield this.state.update(e=>null==e?[n]:e.concat(n))})}back(){return qD(this,arguments,void 0,function*(e=!1){if(!e&&!pl.inPopup(window))return void this.location.back();const t=yield this.state.update(e=>e?e.slice(0,-1):[]);this.hasNavigated&&t.length?this.location.back():yield this.router.navigate([""])})}markCacheRestored(){this._hasRestoredCache=!0}}WD.ɵfac=function(e){return new(e||WD)},WD.ɵprov=a.jDH({token:WD,factory:WD.ɵfac,providedIn:"root"});class YD{}YD.ɵfac=function(e){return new(e||YD)},YD.ɵmod=Fl.$C({type:YD}),YD.ɵinj=a.G2t({});class HD{constructor(){this.name=o.hFB.required(),this.ariaLabel=(0,o.hFB)(),this.classList=(0,Rl.EW)(()=>["bwi",this.name()].join(" "))}}HD.ɵfac=function(e){return new(e||HD)},HD.ɵcmp=Fl.VBU({type:HD,selectors:[["bit-icon"]],hostVars:4,hostBindings:function(e,t){2&e&&(Fl.BMQ("aria-hidden",!t.ariaLabel()||null)("aria-label",t.ariaLabel()),Fl.HbH(t.classList()))},inputs:{name:[1,"name"],ariaLabel:[1,"ariaLabel"]},decls:0,vars:0,template:function(e,t){},encapsulation:2,changeDetection:0});const JD=[[["","slot","header"]],[["","slot","full-width-notice"]],[["","slot","above-scroll-area"]],"*",[["","slot","footer"]]],ZD=(e,t,i)=>({"tw-invisible !tw-p-0 !tw-border-none":e,"tw-border-secondary-300":t,"tw-border-transparent":i}),QD=(e,t,i,n)=>({"!tw-overflow-hidden":e,"tw-overflow-y-auto":t,"tw-invisible":i,"tw-relative tw-py-3 bit-compact:tw-py-2 tw-px-[max(0.75rem,calc((100%-(var(--tw-sm-breakpoint)))/2))] bit-compact:tw-px-[max(0.5rem,calc((100%-(var(--tw-sm-breakpoint)))/2))]":n}),eE=e=>({"tw-invisible":e});class tE{constructor(){this.i18nService=(0,a.WQX)(Ul),this.scrollLayout=(0,a.WQX)(xh),this.destroyRef=(0,a.WQX)(a.abz),this.loading=(0,o.hFB)(!1),this.disablePadding=(0,o.hFB)(!1,{transform:o.L39}),this.hideOverflow=(0,o.hFB)(!1,{transform:o.L39}),this.scrolled=(0,a.vPA)(!1),this.isScrolled=this.scrolled.asReadonly(),this.loadingText=(0,o.hFB)(this.i18nService.t("loading")),this.scrollLayout.scrollableRef$.pipe((0,Eo.p)(e=>null!=e),(0,go.n)(e=>(0,Rh.R)(e.nativeElement,"scroll").pipe((0,kd.Z)(null),(0,l.T)(()=>0!==e.nativeElement.scrollTop))),(0,xl.pQ)(this.destroyRef)).subscribe(e=>this.scrolled.set(e))}}tE.ɵfac=function(e){return new(e||tE)},tE.ɵcmp=Fl.VBU({type:tE,selectors:[["popup-page"]],hostAttrs:[1,"tw-h-full","tw-flex","tw-flex-col","tw-overflow-y-hidden"],inputs:{loading:[1,"loading"],disablePadding:[1,"disablePadding"],hideOverflow:[1,"hideOverflow"],loadingText:[1,"loadingText"]},ngContentSelectors:["[slot=header]","[slot=full-width-notice]","[slot=above-scroll-area]","*","[slot=footer]"],decls:11,vars:15,consts:[["nonScrollable",""],[1,"tw-flex-1","tw-overflow-hidden","tw-flex","tw-flex-col","tw-relative","tw-bg-background-alt"],[1,"tw-transition-colors","tw-duration-200","tw-border-0","tw-border-b","tw-border-solid","tw-py-3","bit-compact:tw-py-2","tw-px-[max(0.75rem,calc((100%-(var(--tw-sm-breakpoint)))/2))]","bit-compact:tw-px-[max(0.5rem,calc((100%-(var(--tw-sm-breakpoint)))/2))]",3,"ngClass"],["data-testid","popup-layout-scroll-region","bitScrollLayoutHost","",1,"tw-size-full","tw-styled-scrollbar",3,"ngClass"],[1,"tw-absolute","tw-inset-0","tw-flex","tw-items-center","tw-justify-center","tw-text-main",3,"ngClass"],["name","bwi-spinner",1,"bwi-lg","bwi-spin",3,"ariaLabel"]],template:function(e,t){if(1&e&&(Fl.NAR(JD),Fl.SdG(0),Fl.j41(1,"main",1),Fl.SdG(2,1),Fl.j41(3,"div",2,0),Fl.SdG(5,2),Fl.k0s(),Fl.j41(6,"div",3),Fl.SdG(7,3),Fl.k0s(),Fl.j41(8,"span",4),Fl.nrm(9,"bit-icon",5),Fl.k0s()(),Fl.SdG(10,4)),2&e){const e=Fl.sdS(4);Fl.R7$(3),Fl.Y8G("ngClass",Fl.sMw(4,ZD,t.loading()||0===e.childElementCount,t.scrolled(),!t.scrolled())),Fl.R7$(3),Fl.Y8G("ngClass",Fl.ziG(8,QD,t.hideOverflow(),!t.hideOverflow(),t.loading(),!t.disablePadding())),Fl.R7$(2),Fl.Y8G("ngClass",Fl.eq3(13,eE,!t.loading())),Fl.R7$(),Fl.Y8G("ariaLabel",t.loadingText())}},dependencies:[kl.MD,kl.YU,YD,HD,Ah],encapsulation:2,changeDetection:0});var iE=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const nE=["*",[["","slot","end"]]],rE=(e,t,i,n)=>({"tw-bg-background-alt tw-border-transparent":e,"tw-bg-background tw-border-secondary-300":t,"tw-ps-4 bit-compact:tw-ps-3":i,"tw-ps-1 bit-compact:tw-ps-0":n});function sE(e,t){if(1&e&&(Fl.nrm(0,"button",5),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG();Fl.Y8G("label",Fl.bMT(1,2,"back"))("bitAction",e.backAction)}}function oE(e,t){if(1&e&&(Fl.j41(0,"h1",6),Fl.EFF(1),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.SpI(" ",e.pageTitle," ")}}class aE{constructor(){this.popupRouterCacheService=(0,a.WQX)(WD),this.pageContentScrolled=(0,a.WQX)(tE).isScrolled,this.background="default",this._showBackButton=!1,this.backAction=()=>iE(this,void 0,void 0,function*(){return this.popupRouterCacheService.back()})}get showBackButton(){return this._showBackButton}set showBackButton(e){this._showBackButton=(0,$x.he)(e)}}aE.ɵfac=function(e){return new(e||aE)},aE.ɵcmp=Fl.VBU({type:aE,selectors:[["popup-header"]],inputs:{background:"background",showBackButton:"showBackButton",pageTitle:"pageTitle",backAction:"backAction"},ngContentSelectors:["*","[slot=end]"],decls:8,vars:8,consts:[[1,"tw-py-3","bit-compact:tw-py-2","tw-pe-1","bit-compact:tw-pe-0.5","tw-transition-colors","tw-duration-200","tw-border-0","tw-border-b","tw-border-solid",3,"ngClass"],[1,"tw-max-w-screen-sm","tw-mx-auto","tw-flex","tw-justify-between","tw-w-full"],[1,"tw-inline-flex","tw-items-center","tw-gap-2","tw-h-9"],["bitIconButton","bwi-angle-left","type","button",3,"label","bitAction",4,"ngIf"],["bitTypography","h3","class","!tw-mb-0.5",4,"ngIf"],["bitIconButton","bwi-angle-left","type","button",3,"label","bitAction"],["bitTypography","h3",1,"!tw-mb-0.5"]],template:function(e,t){1&e&&(Fl.NAR(nE),Fl.j41(0,"header",0)(1,"div",1)(2,"div",2),Fl.DNE(3,sE,2,4,"button",3)(4,oE,2,1,"h1",4),Fl.SdG(5),Fl.k0s(),Fl.j41(6,"div",2),Fl.SdG(7,1),Fl.k0s()()()),2&e&&(Fl.Y8G("ngClass",Fl.ziG(3,rE,"alt"===t.background&&!t.pageContentScrolled(),"alt"===t.background&&t.pageContentScrolled()||"default"===t.background,!t.showBackButton,t.showBackButton)),Fl.R7$(3),Fl.Y8G("ngIf",t.showBackButton),Fl.R7$(),Fl.Y8G("ngIf",t.pageTitle))},dependencies:[tc,rc,kl.MD,kl.YU,kl.bT,Ql,Zl,sf,pc,Bd,rf],encapsulation:2});var lE=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class cE{constructor(e,t,i,n,r){this.accountService=e,this.dialogRef=t,this.formBuilder=i,this.pinService=n,this.userVerificationService=r,this.showMasterPasswordOnClientRestartOption=!0,this.setPinForm=this.formBuilder.group({pin:["",[Il.k0.required,Il.k0.minLength(4)]],requireMasterPasswordOnClientRestart:!0}),this.submit=()=>lE(this,void 0,void 0,function*(){var e;const t=this.setPinForm.controls.pin,i=this.setPinForm.get("requireMasterPasswordOnClientRestart").value;if(bd.isNullOrWhitespace(t.value)||t.invalid)return;const n=null===(e=yield(0,bo._)(this.accountService.activeAccount$))||void 0===e?void 0:e.id;yield this.pinService.setPin(t.value,i?"EPHEMERAL":"PERSISTENT",n),this.dialogRef.close(!0)})}ngOnInit(){return lE(this,void 0,void 0,function*(){const e=yield this.userVerificationService.hasMasterPassword();this.setPinForm.controls.requireMasterPasswordOnClientRestart.setValue(e),this.showMasterPasswordOnClientRestartOption=e})}}function uE(e,t){1&e&&(Fl.j41(0,"label",9),Fl.nrm(1,"input",10),Fl.j41(2,"span"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()()),2&e&&(Fl.R7$(3),Fl.JRh(Fl.bMT(4,1,"lockWithMasterPassOnRestart1")))}cE.ɵfac=function(e){return new(e||cE)(Fl.rXU(Zk),Fl.rXU(nh),Fl.rXU(Il.ok),Fl.rXU(HF),Fl.rXU(NC))},cE.ɵdir=Fl.FsC({type:cE});class dE extends cE{static open(e){return e.open(dE)}}dE.ɵfac=(()=>{let e;return function(t){return(e||(e=Fl.xGo(dE)))(t||dE)}})(),dE.ɵcmp=Fl.VBU({type:dE,selectors:[["ng-component"]],features:[Fl.Vt3],decls:24,vars:18,consts:[[3,"bitSubmit","formGroup"],["bitDialogTitle","",1,"tw-font-medium"],["bitDialogContent",""],["bitInput","","type","password","formControlName","pin",1,"tw-font-mono"],["type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle",""],["class","tw-flex tw-items-start tw-gap-2",4,"ngIf"],["bitDialogFooter",""],["type","submit","bitButton","","bitFormButton","","buttonType","primary"],["type","button","bitButton","","bitFormButton","","buttonType","secondary","bitDialogClose",""],[1,"tw-flex","tw-items-start","tw-gap-2"],["type","checkbox","bitCheckbox","","formControlName","requireMasterPasswordOnClientRestart",1,"tw-mt-1"]],template:function(e,t){1&e&&(Fl.j41(0,"form",0)(1,"bit-dialog")(2,"div",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"div",2)(6,"p"),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.j41(9,"bit-form-field")(10,"bit-label"),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s(),Fl.nrm(13,"input",3)(14,"button",4),Fl.k0s(),Fl.DNE(15,uE,5,3,"label",5),Fl.k0s(),Fl.qex(16,6),Fl.j41(17,"button",7)(18,"span"),Fl.EFF(19),Fl.nI1(20,"i18n"),Fl.k0s()(),Fl.j41(21,"button",8),Fl.EFF(22),Fl.nI1(23,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()()),2&e&&(Fl.Y8G("bitSubmit",t.submit)("formGroup",t.setPinForm),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,8,"setYourPinTitle")," "),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(8,10,"setPinCode")," "),Fl.R7$(4),Fl.JRh(Fl.bMT(12,12,"pin")),Fl.R7$(4),Fl.Y8G("ngIf",t.showMasterPasswordOnClientRestartOption),Fl.R7$(4),Fl.JRh(Fl.bMT(20,14,"setYourPinButton")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(23,16,"cancel")," "))},dependencies:[Fh,ch,Ph,kl.MD,kl.bT,sf,id,td,Ql,Zl,Il.X1,Il.qT,Il.me,Il.Zm,Il.BC,Il.cb,Il.j4,Il.JD,pc,jd,Md,Gu,Ac,fu,ju,iw,nw,rf],encapsulation:2});class hE{static open(e){return e.open(hE,{positionStrategy:new sh})}}hE.ɵfac=function(e){return new(e||hE)},hE.ɵcmp=Fl.VBU({type:hE,selectors:[["ng-component"]],decls:11,vars:10,consts:[["bitDialogTitle",""],["bitDialogContent",""],["bitDialogFooter",""],["bitButton","","type","button","buttonType","secondary",3,"bitDialogClose"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-simple-dialog")(1,"span",0),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"span",1),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.qex(7,2),Fl.j41(8,"button",3),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e&&(Fl.R7$(2),Fl.JRh(Fl.bMT(3,4,"awaitDesktop")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(6,6,"awaitDesktopDesc")," "),Fl.R7$(3),Fl.Y8G("bitDialogClose",!1),Fl.R7$(),Fl.SpI(" ",Fl.bMT(10,8,"close")," "))},dependencies:[sf,id,td,Fh,ch,Yd,rf],encapsulation:2});class pE{}var vE=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function fE(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-spotlight",17),Fl.nI1(1,"i18n"),Fl.nI1(2,"i18n"),Fl.bIt("onDismiss",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.dismissAccountSecurityNudge())}),Fl.k0s()}2&e&&Fl.Y8G("title",Fl.bMT(1,2,"unlockVault"))("subtitle",Fl.bMT(2,4,"unlockVaultDesc"))}function mE(e,t){if(1&e&&(Fl.j41(0,"bit-hint"),Fl.EFF(1),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.SpI(" ",e.biometricUnavailabilityReason," ")}}function gE(e,t){if(1&e&&(Fl.j41(0,"bit-form-control",18),Fl.nI1(1,"async"),Fl.nrm(2,"input",19),Fl.j41(3,"bit-label",20),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.Y8G("disableMargin",!(Fl.bMT(1,2,e.pinEnabled$)||e.form.value.pin)),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(5,4,"enableAutoBiometricsPrompt")," ")}}function yE(e,t){if(1&e&&(Fl.j41(0,"bit-form-control",5),Fl.nrm(1,"input",21),Fl.j41(2,"bit-label",22),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.Y8G("disableMargin",!(e.form.value.pin&&e.showMasterPasswordOnClientRestartOption)),Fl.R7$(3),Fl.JRh(Fl.bMT(4,2,"unlockWithPin"))}}function bE(e,t){1&e&&(Fl.j41(0,"bit-form-control",23),Fl.nrm(1,"input",24),Fl.j41(2,"bit-label",25),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()()),2&e&&(Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,1,"lockWithMasterPassOnRestart1")," "))}function wE(e,t){if(1&e&&(Fl.j41(0,"bit-section-header")(1,"h2",4),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()(),Fl.j41(4,"bit-card"),Fl.nrm(5,"bit-session-timeout-settings",26),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,2,"sessionTimeoutHeader")," "),Fl.R7$(3),Fl.Y8G("refreshTimeoutActionSettings",e.refreshTimeoutSettings$)}}function SE(e,t){if(1&e&&(Fl.nrm(0,"bit-option",32),Fl.nI1(1,"i18n")),2&e){const e=t.$implicit;Fl.Y8G("value",e)("label",Fl.bMT(1,2,e))}}function kE(e,t){1&e&&(Fl.j41(0,"bit-hint"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.nrm(3,"br"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"unlockMethodNeededToChangeTimeoutActionDesc")))}function IE(e,t){1&e&&(Fl.j41(0,"bit-hint",33),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"vaultTimeoutPolicyAffectingOptions")," "))}function CE(e,t){if(1&e&&(Fl.j41(0,"bit-section-header")(1,"h2",4),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()(),Fl.j41(4,"bit-card"),Fl.nrm(5,"bit-session-timeout-input-legacy",27),Fl.j41(6,"bit-form-field",14)(7,"bit-label",28),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.j41(10,"bit-select",29),Fl.DNE(11,SE,2,4,"bit-option",30),Fl.k0s(),Fl.DNE(12,kE,4,3,"bit-hint",8),Fl.k0s(),Fl.DNE(13,IE,3,3,"bit-hint",31),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,7,"vaultTimeoutHeader")," "),Fl.R7$(3),Fl.Y8G("vaultTimeoutOptions",e.vaultTimeoutOptions)("formControl",e.form.controls.vaultTimeout),Fl.R7$(3),Fl.JRh(Fl.bMT(9,9,"vaultTimeoutAction1")),Fl.R7$(3),Fl.Y8G("ngForOf",e.availableVaultTimeoutActions),Fl.R7$(),Fl.Y8G("ngIf",!e.availableVaultTimeoutActions.includes(e.VaultTimeoutAction.Lock)),Fl.R7$(),Fl.Y8G("ngIf",e.hasVaultTimeoutPolicy)}}function TE(e,t){1&e&&(Fl.j41(0,"bit-section")(1,"bit-section-header")(2,"h2",4),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"bit-card")(6,"bit-switch",34)(7,"bit-label",35),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.j41(10,"bit-hint"),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s()()()()),2&e&&(Fl.R7$(3),Fl.JRh(Fl.bMT(4,3,"phishingBlocker")),Fl.R7$(5),Fl.JRh(Fl.bMT(9,5,"enablePhishingDetection")),Fl.R7$(3),Fl.JRh(Fl.bMT(12,7,"enablePhishingDetectionDesc")))}function PE(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-item")(1,"button",15),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.changePassword())}),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.nrm(4,"i",16),Fl.k0s()()}2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"changeMasterPassword")," "))}class FE{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,v,f,m,g,y,b,w,S){this.accountService=e,this.configService=t,this.pinService=i,this.policyService=n,this.formBuilder=r,this.platformUtilsService=s,this.i18nService=o,this.lockService=a,this.vaultTimeoutSettingsService=l,this.messagingService=c,this.environmentService=u,this.keyService=d,this.userVerificationService=h,this.dialogService=p,this.changeDetectorRef=v,this.biometricStateService=f,this.toastService=m,this.biometricsService=g,this.vaultNudgesService=y,this.validationService=b,this.logService=w,this.phishingDetectionSettingsService=S,this.VaultTimeoutAction=pv,this.showMasterPasswordOnClientRestartOption=!0,this.availableVaultTimeoutActions=[],this.vaultTimeoutOptions=[],this.hasVaultTimeoutPolicy=!1,this.showChangeMasterPass=!0,this.pinEnabled$=(0,Go.of)(!0),this.form=this.formBuilder.group({vaultTimeout:[null],vaultTimeoutAction:[pv.Lock],pin:[null],pinLockWithMasterPassword:!1,biometric:!1,enableAutoBiometricsPrompt:!0,enablePhishingDetection:!0}),this.showAccountSecurityNudge$=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.vaultNudgesService.showNudgeSpotlight$(Sx.AccountSecurity,e))),this.refreshTimeoutSettings$=new Dd.t(void 0),this.destroy$=new Co.B,this.BIOMETRICS_POLLING_INTERVAL=2e3,this.consolidatedSessionTimeoutComponent$=this.configService.getFeatureFlag$(Wv.ConsolidatedSessionTimeoutComponent),this.phishingDetectionAvailable$=this.phishingDetectionSettingsService.available$}ngOnInit(){return vE(this,void 0,void 0,function*(){const e=yield this.userVerificationService.hasMasterPassword();this.showMasterPasswordOnClientRestartOption=e;const t=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.policyService.policiesByType$(op.MaximumVaultTimeout,e)),hv);null!=(yield(0,bo._)(t))&&(this.hasVaultTimeoutPolicy=!0);const i=!(this.platformUtilsService.isFirefox()||this.platformUtilsService.isSafari()||this.platformUtilsService.isOpera()&&"MacIntel"===navigator.platform);this.vaultTimeoutOptions=[{name:this.i18nService.t("immediately"),value:0},{name:this.i18nService.t("oneMinute"),value:1},{name:this.i18nService.t("fiveMinutes"),value:5},{name:this.i18nService.t("fifteenMinutes"),value:15},{name:this.i18nService.t("thirtyMinutes"),value:30},{name:this.i18nService.t("oneHour"),value:60},{name:this.i18nService.t("fourHours"),value:240}],i&&this.vaultTimeoutOptions.push({name:this.i18nService.t("onLocked"),value:mv}),this.vaultTimeoutOptions.push({name:this.i18nService.t("onRestart"),value:fv}),this.vaultTimeoutOptions.push({name:this.i18nService.t("never"),value:vv});const n=yield(0,bo._)(this.accountService.activeAccount$);let r=yield(0,bo._)(this.vaultTimeoutSettingsService.getVaultTimeoutByUserId$(n.id));r!==mv||i||(r=fv),this.pinEnabled$=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.policyService.policiesByType$(op.RemoveUnlockWithPin,e)),hv,(0,l.T)(e=>null==e||!e.enabled));const s={vaultTimeout:r,vaultTimeoutAction:yield(0,bo._)(this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(n.id)),pin:yield this.pinService.isPinSet(n.id),pinLockWithMasterPassword:"EPHEMERAL"==(yield this.pinService.getPinLockType(n.id)),biometric:yield this.vaultTimeoutSettingsService.isBiometricLockSet(n.id),enableAutoBiometricsPrompt:yield(0,bo._)(this.biometricStateService.promptAutomatically$),enablePhishingDetection:yield(0,bo._)(this.phishingDetectionSettingsService.enabled$)};this.form.patchValue(s,{emitEvent:!1}),(0,xo.O)(0,this.BIOMETRICS_POLLING_INTERVAL).pipe((0,go.n)(()=>vE(this,void 0,void 0,function*(){const e=yield this.biometricsService.canEnableBiometricUnlock();e?this.form.controls.biometric.enable({emitEvent:!1}):this.form.controls.biometric.disable({emitEvent:!1});if(!(yield ul.permissionsGranted(["nativeMessaging"]))&&!this.platformUtilsService.isSafari())return;const t=yield this.biometricsService.getBiometricsStatusForUser(n.id);t!==$p.DesktopDisconnected||e?t!==$p.NotEnabledInConnectedDesktopApp||e?t!==$p.HardwareUnavailable||e?this.biometricUnavailabilityReason="":this.biometricUnavailabilityReason=this.i18nService.t("biometricsStatusHelptextHardwareUnavailable"):this.biometricUnavailabilityReason=this.i18nService.t("biometricsStatusHelptextNotEnabledInDesktop",n.email):this.biometricUnavailabilityReason=this.i18nService.t("biometricsStatusHelptextDesktopDisconnected")})),(0,vm.Q)(this.destroy$)).subscribe(),this.showChangeMasterPass=yield this.userVerificationService.hasMasterPassword(),this.form.controls.vaultTimeout.valueChanges.pipe((0,kd.Z)(s.vaultTimeout),(0,mm.J)(),(0,To.H)(e=>vE(this,[e],void 0,function*([e,t]){yield this.saveVaultTimeout(e,t)})),(0,vm.Q)(this.destroy$)).subscribe(),this.form.controls.vaultTimeoutAction.valueChanges.pipe((0,l.T)(e=>vE(this,void 0,void 0,function*(){yield this.saveVaultTimeoutAction(e)})),(0,vm.Q)(this.destroy$)).subscribe(),this.form.controls.pin.valueChanges.pipe((0,To.H)(e=>vE(this,void 0,void 0,function*(){yield this.updatePin(e),this.refreshTimeoutSettings$.next()})),(0,vm.Q)(this.destroy$)).subscribe(),this.form.controls.pinLockWithMasterPassword.valueChanges.pipe((0,To.H)(e=>vE(this,void 0,void 0,function*(){const t=(yield(0,bo._)(this.accountService.activeAccount$)).id,i=yield this.pinService.getPin(t);yield this.pinService.setPin(i,e?"EPHEMERAL":"PERSISTENT",t),this.refreshTimeoutSettings$.next()})),(0,vm.Q)(this.destroy$)).subscribe(),this.form.controls.biometric.valueChanges.pipe((0,mo.F)(),(0,To.H)(e=>vE(this,void 0,void 0,function*(){yield this.updateBiometric(e),e?this.form.controls.enableAutoBiometricsPrompt.enable():this.form.controls.enableAutoBiometricsPrompt.disable(),this.refreshTimeoutSettings$.next()})),(0,vm.Q)(this.destroy$)).subscribe(),this.form.controls.enableAutoBiometricsPrompt.valueChanges.pipe((0,To.H)(e=>vE(this,void 0,void 0,function*(){yield this.biometricStateService.setPromptAutomatically(e)})),(0,vm.Q)(this.destroy$)).subscribe(),this.form.controls.enablePhishingDetection.valueChanges.pipe((0,To.H)(e=>vE(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));yield this.phishingDetectionSettingsService.setEnabled(t,e)})),(0,vm.Q)(this.destroy$)).subscribe(),this.refreshTimeoutSettings$.pipe((0,go.n)(()=>(0,jo.z)([this.vaultTimeoutSettingsService.availableVaultTimeoutActions$(),this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(n.id)])),(0,vm.Q)(this.destroy$)).subscribe(([e,t])=>{this.availableVaultTimeoutActions=e,this.form.controls.vaultTimeoutAction.setValue(t,{emitEvent:!1}),this.changeDetectorRef.detectChanges()}),this.refreshTimeoutSettings$.pipe((0,go.n)(()=>(0,jo.z)([this.vaultTimeoutSettingsService.availableVaultTimeoutActions$(),t])),(0,vm.Q)(this.destroy$)).subscribe(([e,t])=>{var i;(null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.action)||e.length<=1?this.form.controls.vaultTimeoutAction.disable({emitEvent:!1}):this.form.controls.vaultTimeoutAction.enable({emitEvent:!1})})})}saveVaultTimeout(e,t){return vE(this,void 0,void 0,function*(){if(t===vv){if(!(yield this.dialogService.openSimpleDialog({title:{key:"warning"},content:{key:"neverLockWarning"},type:"warning"})))return void this.form.controls.vaultTimeout.setValue(e,{emitEvent:!1})}const i=yield(0,bo._)(this.accountService.activeAccount$),n=yield(0,bo._)(this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(i.id));yield this.vaultTimeoutSettingsService.setVaultTimeoutOptions(i.id,t,n),t===vv&&this.messagingService.send("bgReseedStorage")})}dismissAccountSecurityNudge(){return vE(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.accountService.activeAccount$);e&&(yield this.vaultNudgesService.dismissNudge(Sx.AccountSecurity,e.id))})}saveVaultTimeoutAction(e){return vE(this,void 0,void 0,function*(){if(e===pv.LogOut){if(!(yield this.dialogService.openSimpleDialog({title:{key:"vaultTimeoutLogOutConfirmationTitle"},content:{key:"vaultTimeoutLogOutConfirmation"},type:"warning"})))return void this.form.controls.vaultTimeoutAction.setValue(pv.Lock,{emitEvent:!1})}if(this.form.controls.vaultTimeout.hasError("policyError"))return void this.toastService.showToast({variant:"error",title:null,message:this.i18nService.t("vaultTimeoutTooLarge")});const t=yield(0,bo._)(this.accountService.activeAccount$);yield this.vaultTimeoutSettingsService.setVaultTimeoutOptions(t.id,this.form.value.vaultTimeout,e),this.refreshTimeoutSettings$.next()})}updatePin(e){return vE(this,void 0,void 0,function*(){if(e){const e=dE.open(this.dialogService);if(null==e)return void this.form.controls.pin.setValue(!1,{emitEvent:!1});const t=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>e.id))),i=yield(0,bo._)(e.closed);this.form.controls.pin.setValue(i,{emitEvent:!1});const n="EPHEMERAL"==(yield this.pinService.getPinLockType(t));this.form.controls.pinLockWithMasterPassword.setValue(n,{emitEvent:!1}),i&&(this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("unlockPinSet")}),yield this.vaultNudgesService.dismissNudge(Sx.AccountSecurity,t))}else{const e=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));yield this.pinService.unsetPin(e)}})}updateBiometric(e){return vE(this,void 0,void 0,function*(){if(e){let e;try{e=yield ul.requestPermission({permissions:["nativeMessaging"]})}catch(e){if(console.error(e),this.platformUtilsService.isFirefox()&&pl.inSidebar(window))return yield this.dialogService.openSimpleDialog({title:{key:"nativeMessaginPermissionSidebarTitle"},content:{key:"nativeMessaginPermissionSidebarDesc"},acceptButtonText:{key:"ok"},cancelButtonText:null,type:"info"}),void this.form.controls.biometric.setValue(!1)}if(!e)return yield this.dialogService.openSimpleDialog({title:{key:"nativeMessaginPermissionErrorTitle"},content:{key:"nativeMessaginPermissionErrorDesc"},acceptButtonText:{key:"ok"},cancelButtonText:null,type:"danger"}),void this.form.controls.biometric.setValue(!1);try{const e=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));yield this.keyService.refreshAdditionalKeys(e);const t=yield this.trySetupBiometrics();if(this.form.controls.biometric.setValue(t),yield this.biometricStateService.setBiometricUnlockEnabled(t),!t)return void(yield this.biometricStateService.setFingerprintValidated(!1));this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("unlockWithBiometricSet")})}catch(e){this.form.controls.biometric.setValue(!1),this.validationService.showError(e)}}else yield this.biometricStateService.setBiometricUnlockEnabled(!1),yield this.biometricStateService.setFingerprintValidated(!1)})}trySetupBiometrics(){return vE(this,void 0,void 0,function*(){let e,t=!1,i=!1;return yield Promise.all([(()=>vE(this,void 0,void 0,function*(){yield new Promise(e=>setTimeout(e,500)),t||(e=hE.open(this.dialogService),yield(0,bo._)(e.closed),t||(i=!1))}))(),(()=>vE(this,void 0,void 0,function*(){try{const n=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>e.id)));let r=!1;try{const e=yield this.biometricsService.unlockWithBiometricsForUser(n);r=yield this.keyService.validateUserKey(e,n)}catch(e){r=!1}if(t=!0,e&&e.close(r),!r)return this.platformUtilsService.showToast("error",this.i18nService.t("errorEnableBiometricTitle"),this.i18nService.t("errorEnableBiometricDesc")),void(i=!1);i=!0}catch(n){if(t=!0,e&&e.close(!0),"canceled"==n.message)return void(i=!1);const r=VD[n.message];if(!(yield this.dialogService.openSimpleDialog({title:{key:r.title},content:{key:r.description},acceptButtonText:{key:"retry"},cancelButtonText:null,type:"danger"})))return void(i=!1);i=yield this.trySetupBiometrics()}finally{e&&e.close(!0)}}))()]),i})}updateAutoBiometricsPrompt(){return vE(this,void 0,void 0,function*(){yield this.biometricStateService.setPromptAutomatically(this.form.value.enableAutoBiometricsPrompt)})}changePassword(){return vE(this,void 0,void 0,function*(){if(yield this.dialogService.openSimpleDialog({title:{key:"continueToWebApp"},content:{key:"changeMasterPasswordOnWebConfirmation"},type:"info",acceptButtonText:{key:"continue"},cancelButtonText:{key:"cancel"}})){const e=yield(0,bo._)(this.environmentService.environment$);yield ul.createNewTab(e.getWebVaultUrl())}})}twoStep(){return vE(this,void 0,void 0,function*(){(yield this.dialogService.openSimpleDialog({title:{key:"twoStepLoginConfirmationTitle"},content:{key:"twoStepLoginConfirmationContent"},type:"info",acceptButtonText:{key:"continue"},cancelButtonText:{key:"cancel"}}))&&ul.createNewTab("https://bitwarden.com/help/setup-two-step-login/")})}openAcctFingerprintDialog(){return vE(this,void 0,void 0,function*(){const e=yield(0,bo._)(iv(this.accountService.activeAccount$)),t=yield(0,bo._)(this.keyService.userPublicKey$(e));if(null==t)return void this.logService.error("[AccountSecurityComponent] No public key available for the user: "+e+" fingerprint can't be displayed.");const i=yield this.keyService.getFingerprint(e,t),n=of.open(this.dialogService,{fingerprint:i});return(0,bo._)(n.closed)})}lock(){return vE(this,void 0,void 0,function*(){const e=yield(0,bo._)(iv(this.accountService.activeAccount$));yield this.lockService.lock(e)})}logOut(){return vE(this,void 0,void 0,function*(){var e;const t=yield this.dialogService.openSimpleDialog({title:{key:"logOut"},content:{key:"logOutConfirmation"},type:"info"}),i=null===(e=yield(0,bo._)(this.accountService.activeAccount$))||void 0===e?void 0:e.id;t&&this.messagingService.send("logout",{userId:i})})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}}FE.ɵfac=function(e){return new(e||FE)(Fl.rXU(Zk),Fl.rXU(Kb),Fl.rXU(HF),Fl.rXU(Jb),Fl.rXU(Il.ok),Fl.rXU(Hb),Fl.rXU(Ul),Fl.rXU(ck),Fl.rXU(qp),Fl.rXU(bk),Fl.rXU(mk),Fl.rXU(Bp),Fl.rXU(NC),Fl.rXU(lh),Fl.rXU(o.gRc),Fl.rXU(Mp),Fl.rXU(qb),Fl.rXU(Vp),Fl.rXU(Ix),Fl.rXU(Ud),Fl.rXU(Za),Fl.rXU(pE))},FE.ɵcmp=Fl.VBU({type:FE,selectors:[["ng-component"]],decls:56,vars:45,consts:[["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],["class","tw-mb-6",3,"title","subtitle","onDismiss",4,"ngIf"],[3,"formGroup"],["bitTypography","h6"],[3,"disableMargin"],["bitCheckbox","","id","biometric","type","checkbox","formControlName","biometric"],["for","biometric",1,"tw-whitespace-normal"],[4,"ngIf"],["class","tw-pl-5",3,"disableMargin",4,"ngIf"],[3,"disableMargin",4,"ngIf"],["class","tw-pl-5","disableMargin","",4,"ngIf"],["bit-item-content","","type","button","appStopClick","","routerLink","/device-management"],["slot","end","aria-hidden","true",1,"bwi","bwi-chevron-right"],["disableMargin",""],["bit-item-content","","type","button","appStopClick","",3,"click"],["slot","end","aria-hidden","true",1,"bwi","bwi-external-link"],[1,"tw-mb-6",3,"onDismiss","title","subtitle"],[1,"tw-pl-5",3,"disableMargin"],["bitCheckbox","","id","autoBiometricsPrompt","type","checkbox","formControlName","enableAutoBiometricsPrompt"],["for","autoBiometricsPrompt",1,"tw-whitespace-normal"],["bitCheckbox","","id","pin","type","checkbox","formControlName","pin"],["for","pin",1,"tw-whitespace-normal"],["disableMargin","",1,"tw-pl-5"],["bitCheckbox","","id","pinEphemeral","type","checkbox","formControlName","pinLockWithMasterPassword"],["for","pinEphemeral",1,"tw-whitespace-normal"],[3,"refreshTimeoutActionSettings"],["ngDefaultControl","",3,"vaultTimeoutOptions","formControl"],["for","vaultTimeoutAction"],["id","vaultTimeoutAction","formControlName","vaultTimeoutAction"],[3,"value","label",4,"ngFor","ngForOf"],["class","tw-mt-4",4,"ngIf"],[3,"value","label"],[1,"tw-mt-4"],["formControlName","enablePhishingDetection","id","phishingDetectionAction"],["for","phishingDetectionAction"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page")(1,"popup-header",0),Fl.nI1(2,"i18n"),Fl.qex(3,1),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.DNE(5,fE,3,6,"bit-spotlight",2),Fl.nI1(6,"async"),Fl.j41(7,"div",3)(8,"bit-section")(9,"bit-section-header")(10,"h2",4),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s()(),Fl.j41(13,"bit-card")(14,"bit-form-control",5),Fl.nI1(15,"async"),Fl.nrm(16,"input",6),Fl.j41(17,"bit-label",7),Fl.EFF(18),Fl.nI1(19,"i18n"),Fl.k0s(),Fl.DNE(20,mE,2,1,"bit-hint",8),Fl.k0s(),Fl.DNE(21,gE,6,6,"bit-form-control",9)(22,yE,5,4,"bit-form-control",10),Fl.nI1(23,"async"),Fl.DNE(24,bE,5,3,"bit-form-control",11),Fl.k0s()(),Fl.j41(25,"bit-section"),Fl.nVh(26,wE,6,4),Fl.nI1(27,"async"),Fl.vZN(28,CE,14,11),Fl.k0s(),Fl.j41(29,"bit-section")(30,"bit-section-header")(31,"h2",4),Fl.EFF(32),Fl.nI1(33,"i18n"),Fl.k0s()(),Fl.j41(34,"bit-item")(35,"button",12),Fl.EFF(36),Fl.nI1(37,"i18n"),Fl.nrm(38,"i",13),Fl.k0s()()(),Fl.DNE(39,TE,13,9,"bit-section",8),Fl.nI1(40,"async"),Fl.j41(41,"bit-section",14)(42,"bit-section-header")(43,"h2",4),Fl.EFF(44),Fl.nI1(45,"i18n"),Fl.k0s()(),Fl.j41(46,"bit-item")(47,"button",15),Fl.bIt("click",function(){return t.openAcctFingerprintDialog()}),Fl.EFF(48),Fl.nI1(49,"i18n"),Fl.k0s()(),Fl.j41(50,"bit-item")(51,"button",15),Fl.bIt("click",function(){return t.twoStep()}),Fl.EFF(52),Fl.nI1(53,"i18n"),Fl.nrm(54,"i",16),Fl.k0s()(),Fl.DNE(55,PE,5,3,"bit-item",8),Fl.k0s()()()),2&e&&(Fl.R7$(),Fl.Y8G("pageTitle",Fl.mNQ(Fl.bMT(2,19,"accountSecurity"))),Fl.R7$(4),Fl.Y8G("ngIf",Fl.bMT(6,21,t.showAccountSecurityNudge$)),Fl.R7$(2),Fl.Y8G("formGroup",t.form),Fl.R7$(4),Fl.JRh(Fl.bMT(12,23,"unlockMethods")),Fl.R7$(3),Fl.Y8G("disableMargin",!(Fl.bMT(15,25,t.pinEnabled$)||t.form.value.pin)),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(19,27,"unlockWithBiometrics")," "),Fl.R7$(2),Fl.Y8G("ngIf",t.biometricUnavailabilityReason),Fl.R7$(),Fl.Y8G("ngIf",t.form.value.biometric),Fl.R7$(),Fl.Y8G("ngIf",Fl.bMT(23,29,t.pinEnabled$)||t.form.value.pin),Fl.R7$(2),Fl.Y8G("ngIf",t.form.value.pin&&t.showMasterPasswordOnClientRestartOption),Fl.R7$(2),Fl.vxM(Fl.bMT(27,31,t.consolidatedSessionTimeoutComponent$)?26:28),Fl.R7$(6),Fl.JRh(Fl.bMT(33,33,"manageDevices")),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(37,35,"devices")," "),Fl.R7$(3),Fl.Y8G("ngIf",Fl.bMT(40,37,t.phishingDetectionAvailable$)),Fl.R7$(5),Fl.JRh(Fl.bMT(45,39,"otherOptions")),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(49,41,"fingerprintPhrase")," "),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(53,43,"twoStepLogin")," "),Fl.R7$(3),Fl.Y8G("ngIf",t.showChangeMasterPass))},dependencies:[Ex,hd,Qb,kl.MD,kl.Sq,kl.bT,Gu,Sc,Ac,hu,ju,Il.YN,Il.me,Il.Zm,Il.BC,Il.cb,Il.X1,Il.l_,Il.j4,Il.JD,Ql,VP,GP,KP,sf,IP,Hh,GD,aE,tE,Cw.iI,Cw.Wk,Ux,Nx,Wu,qu,zu,AD,Ax,tc,rc,ND,Kx,kl.Jj,rf],encapsulation:2});var RE=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const xE=new k(Q,"autofillOnPageLoad",{deserializer:e=>null!=e&&e,clearOn:[]}),AE=new k(Q,"autofillOnPageLoadDefault",{deserializer:e=>null!=e&&e,clearOn:[]}),DE=new k(Q,"autofillOnPageLoadCalloutIsDismissed",{deserializer:e=>null!=e&&e,clearOn:[]}),EE=new k(Q,"autofillOnPageLoadPolicyToastHasDisplayed",{deserializer:e=>null!=e&&e,clearOn:[]}),$E=new k(Q,"autoCopyTotp",{deserializer:e=>null==e||e,clearOn:[]}),OE=new m(ee,"inlineMenuVisibility",{deserializer:e=>null!=e?e:wa}),UE=new k(Q,"showInlineMenuIdentities",{deserializer:e=>null==e||e,clearOn:[]}),ME=new k(Q,"showInlineMenuCards",{deserializer:e=>null==e||e,clearOn:[]}),NE=new m(Q,"enableContextMenu",{deserializer:e=>null==e||e}),VE=new k(ee,"clearClipboardDelay",{deserializer:e=>null!=e?e:ua,clearOn:[]});class BE{}class jE{constructor(e,t,i,n){this.stateProvider=e,this.policyService=t,this.accountService=i,this.restrictedItemTypesService=n,this.autofillOnPageLoadState=this.stateProvider.getActive(xE),this.autofillOnPageLoad$=this.autofillOnPageLoadState.state$.pipe((0,l.T)(e=>null!=e&&e)),this.autofillOnPageLoadDefaultState=this.stateProvider.getActive(AE),this.autofillOnPageLoadDefault$=this.autofillOnPageLoadDefaultState.state$.pipe((0,l.T)(e=>null==e||e)),this.autofillOnPageLoadCalloutIsDismissedState=this.stateProvider.getActive(DE),this.autofillOnPageLoadCalloutIsDismissed$=this.autofillOnPageLoadCalloutIsDismissedState.state$.pipe((0,l.T)(e=>null!=e&&e)),this.activateAutofillOnPageLoadFromPolicy$=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.policyService.policyAppliesToUser$(op.ActivateAutofill,e))),this.autofillOnPageLoadPolicyToastHasDisplayedState=this.stateProvider.getActive(EE),this.autofillOnPageLoadPolicyToastHasDisplayed$=this.autofillOnPageLoadPolicyToastHasDisplayedState.state$.pipe((0,l.T)(e=>null!=e&&e)),this.autoCopyTotpState=this.stateProvider.getActive($E),this.autoCopyTotp$=this.autoCopyTotpState.state$.pipe((0,l.T)(e=>null==e||e)),this.inlineMenuVisibilityState=this.stateProvider.getGlobal(OE),this.inlineMenuVisibility$=this.inlineMenuVisibilityState.state$.pipe((0,l.T)(e=>null!=e?e:wa)),this.showInlineMenuIdentitiesState=this.stateProvider.getActive(UE),this.showInlineMenuIdentities$=this.showInlineMenuIdentitiesState.state$.pipe((0,l.T)(e=>null==e||e)),this.showInlineMenuCardsState=this.stateProvider.getActive(ME),this.showInlineMenuCards$=(0,jo.z)([this.showInlineMenuCardsState.state$.pipe((0,l.T)(e=>null==e||e)),this.restrictedItemTypesService.restricted$]).pipe((0,l.T)(([e,t])=>e&&!t.some(e=>e.cipherType===nx.Card))),this.enableContextMenuState=this.stateProvider.getGlobal(NE),this.enableContextMenu$=this.enableContextMenuState.state$.pipe((0,l.T)(e=>null==e||e)),this.clearClipboardDelayState=this.stateProvider.getActive(VE),this.clearClipboardDelay$=this.clearClipboardDelayState.state$.pipe((0,l.T)(e=>null!=e?e:ua))}setAutofillOnPageLoad(e){return RE(this,void 0,void 0,function*(){yield this.autofillOnPageLoadState.update(()=>e)})}setAutofillOnPageLoadDefault(e){return RE(this,void 0,void 0,function*(){yield this.autofillOnPageLoadDefaultState.update(()=>e)})}setAutofillOnPageLoadCalloutIsDismissed(e){return RE(this,void 0,void 0,function*(){yield this.autofillOnPageLoadCalloutIsDismissedState.update(()=>e)})}setAutofillOnPageLoadPolicyToastHasDisplayed(e){return RE(this,void 0,void 0,function*(){yield this.autofillOnPageLoadPolicyToastHasDisplayedState.update(()=>e)})}setAutoCopyTotp(e){return RE(this,void 0,void 0,function*(){yield this.autoCopyTotpState.update(()=>e)})}setInlineMenuVisibility(e){return RE(this,void 0,void 0,function*(){yield this.inlineMenuVisibilityState.update(()=>e)})}setShowInlineMenuIdentities(e){return RE(this,void 0,void 0,function*(){yield this.showInlineMenuIdentitiesState.update(()=>e)})}setShowInlineMenuCards(e){return RE(this,void 0,void 0,function*(){yield this.showInlineMenuCardsState.update(()=>e)})}setEnableContextMenu(e){return RE(this,void 0,void 0,function*(){yield this.enableContextMenuState.update(()=>e)})}setClearClipboardDelay(e){return RE(this,void 0,void 0,function*(){yield this.clearClipboardDelayState.update(()=>e)})}}const GE={Domain:0,Host:1,StartsWith:2,Exact:3,RegularExpression:4,Never:5};function LE(e){if(null!=e)switch(e){case 0:case 1:case 2:case 3:case 4:case 5:return e;default:return}}var zE=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const _E=new m(Z,"showFavicons",{deserializer:e=>null==e||e}),KE=new m(Z,"neverDomains",{deserializer:e=>null!=e?e:null}),XE=new m(Z,"blockedInteractionsUris",{deserializer:e=>null!=e?e:{}}),qE=new k(Z,"equivalentDomains",{deserializer:e=>null!=e?e:null,clearOn:["logout"]}),WE=new k(Z,"defaultUriMatchStrategy",{deserializer:e=>null!=e?e:GE.Domain,clearOn:[]});class YE{}class HE{constructor(e,t,i){this.stateProvider=e,this.policyService=t,this.accountService=i,this.showFaviconsState=this.stateProvider.getGlobal(_E),this.showFavicons$=this.showFaviconsState.state$.pipe((0,l.T)(e=>null==e||e)),this.neverDomainsState=this.stateProvider.getGlobal(KE),this.neverDomains$=this.neverDomainsState.state$.pipe((0,l.T)(e=>null!=e?e:null)),this.blockedInteractionsUrisState=this.stateProvider.getGlobal(XE),this.blockedInteractionsUris$=this.blockedInteractionsUrisState.state$.pipe((0,l.T)(e=>null!=e?e:{})),this.equivalentDomainsState=this.stateProvider.getActive(qE),this.equivalentDomains$=this.equivalentDomainsState.state$.pipe((0,l.T)(e=>null!=e?e:null)),this.defaultUriMatchStrategyState=this.stateProvider.getActive(WE),this.defaultUriMatchStrategy$=this.defaultUriMatchStrategyState.state$.pipe((0,l.T)(e=>null!=e?e:GE.Domain)),this.defaultUriMatchStrategyPolicy$=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.policyService.policiesByType$(op.UriMatchDefaults,e)),hv,(0,l.T)(e=>{var t;if(!(null==e?void 0:e.enabled)||null==(null==e?void 0:e.data))return null;const i=null===(t=e.data)||void 0===t?void 0:t.uriMatchDetection;return Object.values(GE).includes(i)?i:null}),(0,Gp.t)({bufferSize:1,refCount:!0})),this.resolvedDefaultUriMatchStrategy$=(0,jo.z)([this.defaultUriMatchStrategy$,this.defaultUriMatchStrategyPolicy$]).pipe((0,l.T)(([e,t])=>t||e),(0,Gp.t)({bufferSize:1,refCount:!0}))}setShowFavicons(e){return zE(this,void 0,void 0,function*(){yield this.showFaviconsState.update(()=>e)})}setNeverDomains(e){return zE(this,void 0,void 0,function*(){yield this.neverDomainsState.update(()=>e)})}setBlockedInteractionsUris(e){return zE(this,void 0,void 0,function*(){yield this.blockedInteractionsUrisState.update(()=>e)})}setEquivalentDomains(e,t){return zE(this,void 0,void 0,function*(){yield this.stateProvider.getUser(t,qE).update(()=>e)})}setDefaultUriMatchStrategy(e){return zE(this,void 0,void 0,function*(){yield this.defaultUriMatchStrategyState.update(()=>e)})}getUrlEquivalentDomains(e){return this.equivalentDomains$.pipe((0,l.T)(t=>{const i=bd.getDomain(e);if(null==i||null==t)return new Set;const n=t.filter(e=>e.includes(i)).flat();return new Set(n)}))}}const JE=["https://","http://","ssh://","ftp://","sftp://","irc://","vnc://","rdp://","ms-rd:","chrome://","iosapp://","androidapp://"];class ZE{static canLaunch(e){if(bd.isNullOrWhitespace(e))return!1;for(let t=0;t<JE.length;t++)if(0===e.indexOf(JE[t]))return!0;return!1}}class QE{constructor(e){e&&(this.match=e.match)}get uri(){return this._uri}set uri(e){this._uri=e,this._domain=void 0,this._canLaunch=void 0}get domain(){return null==this._domain&&null!=this.uri&&(this._domain=bd.getDomain(this.uri),""===this._domain&&(this._domain=void 0)),this._domain}get hostname(){if(this.match!==GE.RegularExpression)return null==this._hostname&&null!=this.uri&&(this._hostname=bd.getHostname(this.uri),""===this._hostname&&(this._hostname=void 0)),this._hostname}get host(){if(this.match!==GE.RegularExpression)return null==this._host&&null!=this.uri&&(this._host=bd.getHost(this.uri),""===this._host&&(this._host=void 0)),this._host}get hostnameOrUri(){return null!=this.hostname?this.hostname:this.uri}get hostOrUri(){return null!=this.host?this.host:this.uri}get isWebsite(){return null!=this.uri&&(0===this.uri.indexOf("http://")||0===this.uri.indexOf("https://")||this.uri.indexOf("://")<0&&!bd.isNullOrWhitespace(bd.getDomain(this.uri)))}get canLaunch(){return null!=this._canLaunch||(null!=this.uri&&this.match!==GE.RegularExpression?this._canLaunch=ZE.canLaunch(this.launchUri):this._canLaunch=!1),this._canLaunch}get launchUri(){if(null!=this.uri)return this.uri.indexOf("://")<0&&!bd.isNullOrWhitespace(bd.getDomain(this.uri))?"http://"+this.uri:this.uri}static fromJSON(e){return Object.assign(new QE,e)}static fromSdkLoginUriView(e){if(null==e)return;const t=new QE;return t.uri=e.uri,t.match=e.match,t}toSdkLoginUriView(){var e,t;return{uri:null!==(e=this.uri)&&void 0!==e?e:void 0,match:null!==(t=this.match)&&void 0!==t?t:void 0,uriChecksum:void 0}}matchesUri(e,t,i,n){var r;if(!this.uri||!e)return!1;let s=null!==(r=this.match)&&void 0!==r?r:i;null!=s||(s=GE.Domain),n&&s===GE.Never&&(s=GE.Domain);const o=bd.getDomain(e),a=t.add(o);switch(s){case GE.Domain:return this.matchesDomain(e,a);case GE.Host:{const t=bd.getHost(e);return null!=t&&t===bd.getHost(this.uri)}case GE.Exact:return e===this.uri;case GE.StartsWith:return e.startsWith(this.uri);case GE.RegularExpression:try{return new RegExp(this.uri,"i").test(e)}catch(e){return!1}case GE.Never:return!1}return!1}matchesDomain(e,t){if(null==e||null==this.domain||!t.has(this.domain))return!1;if(bd.DomainMatchBlacklist.has(this.domain)){const t=bd.getHost(e);return!bd.DomainMatchBlacklist.get(this.domain).has(t)}return!0}}var e$;class t${}e$=t$,t$.isCipherListView=e=>"object"==typeof e.type||"string"==typeof e.type,t$.getLogin=e=>e$.isCipherListView(e)?"object"!=typeof e.type?null:"login"in e.type?e.type.login:null:e.type===nx.Login?e.login:null,t$.uri=e=>{var t;const i=e$.getLogin(e);return i?"uri"in i?i.uri:(null===(t=i.uris)||void 0===t?void 0:t.length)?i.uris[0].uri:null:null},t$.getCard=e=>e$.isCipherListView(e)?"object"!=typeof e.type?null:"card"in e.type?e.type.card:null:e.type===nx.Card?e.card:null,t$.isArchived=e=>e$.isCipherListView(e)?!!e.archivedDate:e.isArchived,t$.isDeleted=e=>e$.isCipherListView(e)?!!e.deletedDate:e.isDeleted,t$.isUnassigned=e=>e$.isCipherListView(e)?null!=e.organizationId&&(null==e.collectionIds||0===e.collectionIds.length):e.isUnassigned,t$.canAssignToCollections=e=>e$.isCipherListView(e)?!e.organizationId||e.edit&&e.viewPassword:e.canAssignToCollections,t$.getType=e=>{if(!e$.isCipherListView(e))return e.type;switch(!0){case"secureNote"===e.type:return nx.SecureNote;case"sshKey"===e.type:return nx.SshKey;case"identity"===e.type:return nx.Identity;case"object"==typeof e.type&&"card"in e.type:return nx.Card;case"object"==typeof e.type&&"login"in e.type:return nx.Login;default:throw new Error(`Unknown cipher type: ${e.type}`)}},t$.subtitle=e=>e$.isCipherListView(e)?e.subtitle:e.subTitle,t$.hasAttachments=e=>e$.isCipherListView(e)?"number"==typeof e.attachments&&e.attachments>0:e.hasAttachments,t$.canLaunch=e=>{var t;const i=e$.getLogin(e);return!!i&&!!(null===(t=i.uris)||void 0===t?void 0:t.map(e=>n$(e)).some(e=>e.canLaunch))},t$.getLaunchUri=e=>{var t,i;const n=e$.getLogin(e);if(n)return null===(i=null===(t=n.uris)||void 0===t?void 0:t.map(e=>n$(e)).find(e=>e.canLaunch))||void 0===i?void 0:i.launchUri},t$.matchesUri=(e,t,i,n=GE.Domain,r)=>{var s;if(e$.getType(e)!==nx.Login)return!1;if(!e$.isCipherListView(e))return e.login.matchesUri(t,i,n,r);const o=e$.getLogin(e);if(!(null===(s=null==o?void 0:o.uris)||void 0===s?void 0:s.length))return!1;const a=o.uris.filter(e=>!!e.uri).map(e=>{var t;const i=new QE;return i.match=null!==(t=e.match)&&void 0!==t?t:n,i.uri=e.uri,i});return a.some(e=>e.matchesUri(t,i,n,r))},t$.hasCopyableValue=(e,t)=>{var i,n,r,s,o,a,l,c,u,d,h,p;if(e$.isCipherListView(e)){let i=t;return"username"===i&&e$.getType(e)===nx.Login?i="usernameLogin":"username"===i&&e$.getType(e)===nx.Identity&&(i="usernameIdentity"),e.copyableFields.includes(i$[i])}switch(t){case"username":return!!(null===(i=e.login)||void 0===i?void 0:i.username)||!!(null===(n=e.identity)||void 0===n?void 0:n.username);case"password":return!!(null===(r=e.login)||void 0===r?void 0:r.password);case"totp":return!!(null===(s=e.login)||void 0===s?void 0:s.totp);case"cardNumber":return!!(null===(o=e.card)||void 0===o?void 0:o.number);case"securityCode":return!!(null===(a=e.card)||void 0===a?void 0:a.code);case"email":return!!(null===(l=e.identity)||void 0===l?void 0:l.email);case"phone":return!!(null===(c=e.identity)||void 0===c?void 0:c.phone);case"address":return!!(null===(u=e.identity)||void 0===u?void 0:u.fullAddressForCopy);case"secureNote":return!!e.notes;case"privateKey":return!!(null===(d=e.sshKey)||void 0===d?void 0:d.privateKey);case"publicKey":return!!(null===(h=e.sshKey)||void 0===h?void 0:h.publicKey);case"keyFingerprint":return!!(null===(p=e.sshKey)||void 0===p?void 0:p.keyFingerprint);default:return!1}},t$.hasFido2Credentials=e=>{var t;const i=e$.getLogin(e);return!!(null===(t=null==i?void 0:i.fido2Credentials)||void 0===t?void 0:t.length)},t$.decryptionFailure=e=>"decryptionFailure"in e&&e.decryptionFailure,t$.getNotes=e=>e.notes,t$.getFields=e=>(e$.isCipherListView(e),e.fields),t$.getAttachmentNames=e=>{var t;return e$.isCipherListView(e)?e.attachmentNames:null===(t=e.attachments)||void 0===t?void 0:t.map(e=>e.fileName).filter(e=>null!=e)},t$.getUriHostname=e=>{var t;if("hostname"in e&&void 0!==e.hostname)return null!==(t=e.hostname)&&void 0!==t?t:void 0;if(e.match!==GE.RegularExpression&&e.uri){const t=bd.getHostname(e.uri);return""===t?void 0:t}};const i$={usernameLogin:"LoginUsername",password:"LoginPassword",totp:"LoginTotp",cardNumber:"CardNumber",securityCode:"CardSecurityCode",usernameIdentity:"IdentityUsername",email:"IdentityEmail",phone:"IdentityPhone",address:"IdentityAddress",secureNote:"SecureNotes",privateKey:"SshKey",publicKey:"SshKey",keyFingerprint:"SshKey"},n$=e=>{if(e instanceof QE)return e;const t=new QE;return e.match&&(t.match=e.match),e.uri&&(t.uri=e.uri),t};class r${constructor(e,t,i){this.accountService=e,this.organizationService=t,this.policyService=i,this.restricted$=this.accountService.activeAccount$.pipe(nv,(0,go.n)(e=>null==e?(0,Go.of)([]):(0,jo.z)([this.organizationService.organizations$(e),this.policyService.policiesByType$(op.RestrictedItemTypes,e)]).pipe((0,l.T)(([e,t])=>{const i=e=>{var t;return null!==(t=e.data)&&void 0!==t?t:[nx.Card]};return Array.from(new Set(t.flatMap(i))).map(n=>{const r=e.filter(e=>{const r=t.find(t=>t.organizationId===e.id);return!r||!i(r).includes(n)}).map(e=>e.id);return{cipherType:n,allowViewOrgIds:r}})}))),(0,mo.F)(),(0,Gp.t)({bufferSize:1,refCount:!0}))}isCipherRestricted(e,t){const i=t.find(t=>t.cipherType===t$.getType(e));return!!i&&(!e.organizationId||!i.allowViewOrgIds.includes(e.organizationId))}isCipherRestricted$(e){return this.restricted$.pipe((0,l.T)(t=>this.isCipherRestricted(e,t)))}}const s$=0,o$=1,a$=0;class l${constructor(e){this.id=e.id,this.organizationId=e.organizationId,this.cipherId=e.cipherId,this.type=e.type,this.status=e.status,this.creationDate=e.creationDate,this.revisionDate=e.revisionDate}}class c${constructor(e){this.id=e.id,this.organizationId=e.organizationId,this.cipherId=e.cipherId,this.type=e.type,this.status=e.status,this.creationDate=e.creationDate,this.revisionDate=e.revisionDate}static fromJSON(e){return Object.assign(new c$({}),e,{creationDate:new Date(e.creationDate),revisionDate:new Date(e.revisionDate)})}}class u$ extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.organizationId=this.getResponseProperty("OrganizationId"),this.cipherId=this.getResponseProperty("CipherId")||void 0,this.type=this.getResponseProperty("Type"),this.status=this.getResponseProperty("Status"),this.creationDate=this.getResponseProperty("CreationDate"),this.revisionDate=this.getResponseProperty("RevisionDate")}}class d${}function h$(e,t=void 0){const i=new Map;return n=>{let r=i.get(n);return r||(null!=t||(t=Wp.w),r=(0,Po.h)(e(n),t.pipe((0,Eo.p)(e=>e===n||null===e),(0,l.T)(()=>null))).pipe((0,Gp.t)({bufferSize:1,refCount:!1})),i.set(n,r)),r}}function p$(){return(0,Eo.p)(e=>null!=e)}const v$=k.array(Ee,"securityTasks",{deserializer:e=>c$.fromJSON(e),clearOn:["logout","lock"]});var f$=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const m$=(0,l.T)(e=>Object.entries(null!=e?e:{}).filter(([,e])=>e>=Pd.Unlocked).map(([e])=>e));const g$=new k(Ne,"atRiskPasswords",{deserializer:e=>e,clearOn:["lock","logout"]});class y${constructor(e,t,i){this.taskService=e,this.cipherService=t,this.stateProvider=i}pendingTasks$(e){return(0,jo.z)([this.taskService.pendingTasks$(e),this.cipherService.cipherViews$(e)]).pipe((0,l.T)(([e,t])=>e.filter(e=>{const i=t.find(t=>t.id===e.cipherId);return e.type===a$&&i&&i.edit&&i.viewPassword&&!i.isDeleted})))}completedTasks$(e){return this.taskService.completedTasks$(e).pipe((0,l.T)(e=>e.find(e=>e.type===a$)))}showCompletedTasksBanner$(e){return(0,jo.z)([this.pendingTasks$(e),this.completedTasks$(e),this.atRiskPasswordState(e).state$]).pipe((0,l.T)(([e,t,i])=>{var n,r,s;const o=e.length>0,a=null!==(n=null==i?void 0:i.tasksBannerDismissed)&&void 0!==n&&n,l=null!==(r=null==i?void 0:i.hasInteractedWithTasks)&&void 0!==r&&r;return!!(o||l&&!a)&&!(!t||o||null!==(s=null==i?void 0:i.tasksBannerDismissed)&&void 0!==s&&s)}))}atRiskPasswordState(e){return this.stateProvider.getUser(e,g$)}updateAtRiskPasswordState(e,t){this.atRiskPasswordState(e).update(()=>t)}}y$.ɵfac=function(e){return new(e||y$)(a.KVO(d$),a.KVO(_b),a.KVO(u))},y$.ɵprov=a.jDH({token:y$,factory:y$.ɵfac});var b$=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class w${constructor(e,t,i,n,r,s,o){this.keyService=e,this.platformUtilsService=t,this.i18nService=i,this.formBuilder=n,this.dialogRef=r,this.toastService=s,this.accountService=o,this.formGroup=this.formBuilder.group({masterPassword:["",{validators:[Il.k0.required],updateOn:"submit"}]}),this.submit=()=>b$(this,void 0,void 0,function*(){if(!this.formGroup.value.masterPassword)return;const e=yield(0,bo._)(iv(this.accountService.activeAccount$));if(null==e)throw new Error("An active user is expected while doing password reprompt.");const t=yield this.keyService.getOrDeriveMasterKey(this.formGroup.value.masterPassword,e);(yield this.keyService.compareKeyHash(this.formGroup.value.masterPassword,t,e))?this.dialogRef.close(!0):this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("invalidMasterPassword")})})}}w$.ɵfac=function(e){return new(e||w$)(Fl.rXU(Bp),Fl.rXU(Hb),Fl.rXU(Ul),Fl.rXU(Il.ok),Fl.rXU(nh),Fl.rXU(qb),Fl.rXU(Zk))},w$.ɵcmp=Fl.VBU({type:w$,selectors:[["vault-password-reprompt"]],decls:22,vars:17,consts:[[3,"formGroup","bitSubmit"],["bitDialogTitle",""],["bitDialogContent",""],["disableMargin","",1,"tw-mt-6"],["bitInput","","appAutofocus","","id","masterPassword","type","password","formControlName","masterPassword"],["type","button","bitSuffix","","bitIconButton","","bitPasswordInputToggle",""],["bitDialogFooter",""],["bitButton","","buttonType","primary","bitFormButton","","type","submit"],["bitButton","","buttonType","secondary","bitDialogClose","","type","button"]],template:function(e,t){1&e&&(Fl.j41(0,"form",0)(1,"bit-dialog")(2,"span",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.qex(5,2),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.j41(8,"bit-form-field",3)(9,"bit-label"),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s(),Fl.nrm(12,"input",4)(13,"button",5),Fl.k0s(),Fl.bVm(),Fl.qex(14,6),Fl.j41(15,"button",7)(16,"span"),Fl.EFF(17),Fl.nI1(18,"i18n"),Fl.k0s()(),Fl.j41(19,"button",8),Fl.EFF(20),Fl.nI1(21,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()()),2&e&&(Fl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,7,"passwordConfirmation")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(7,9,"passwordConfirmationDesc")," "),Fl.R7$(4),Fl.JRh(Fl.bMT(11,11,"masterPass")),Fl.R7$(7),Fl.JRh(Fl.bMT(18,13,"ok")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(21,15,"cancel")," "))},dependencies:[sf,wd,pc,jd,Md,id,td,Fh,ch,Ph,Gu,Ac,fu,ju,iw,nw,Ql,Zl,Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,rf],encapsulation:2});var S$=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class k${constructor(e,t){this.dialogService=e,this.userVerificationService=t,this.enabled$=bd.asyncToObservable(()=>this.userVerificationService.hasMasterPasswordAndMasterKeyHash())}protectedFields(){return["TOTP","Password","H_Field","Card Number","Security Code"]}passwordRepromptCheck(e){return S$(this,void 0,void 0,function*(){return e.reprompt===tx.None||(yield this.showPasswordPrompt())})}showPasswordPrompt(){return S$(this,void 0,void 0,function*(){if(!(yield this.enabled()))return!0;const e=this.dialogService.open(w$,{ariaModal:!0});return!0===(yield(0,xT.s)(e.closed))})}enabled(){return(0,bo._)(this.enabled$)}}k$.ɵfac=function(e){return new(e||k$)(a.KVO(lh),a.KVO(NC))},k$.ɵprov=a.jDH({token:k$,factory:k$.ɵfac});class I${}class C${}class T${}var P$=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const F$={username:{typeI18nKey:"username",protected:!1},password:{typeI18nKey:"password",protected:!0,event:Ua.Cipher_ClientCopiedPassword},totp:{typeI18nKey:"verificationCodeTotp",protected:!0},cardNumber:{typeI18nKey:"number",protected:!0},securityCode:{typeI18nKey:"securityCode",protected:!0,event:Ua.Cipher_ClientCopiedCardCode},email:{typeI18nKey:"email",protected:!0},phone:{typeI18nKey:"phone",protected:!0},address:{typeI18nKey:"address",protected:!0},secureNote:{typeI18nKey:"note",protected:!0},privateKey:{typeI18nKey:"sshPrivateKey",protected:!0},publicKey:{typeI18nKey:"sshPublicKey",protected:!0},keyFingerprint:{typeI18nKey:"sshFingerprint",protected:!0},hiddenField:{typeI18nKey:"value",protected:!0,event:Ua.Cipher_ClientCopiedHiddenField}};class R${constructor(e,t,i,n,r,s,o,a){this.platformUtilsService=e,this.toastService=t,this.eventCollectionService=i,this.passwordRepromptService=n,this.totpService=r,this.i18nService=s,this.billingAccountProfileStateService=o,this.accountService=a}copy(e,t,i){return P$(this,arguments,void 0,function*(e,t,i,n=!1){const r=F$[t];if(!n&&i.reprompt!==tx.None&&r.protected&&!(yield this.passwordRepromptService.showPasswordPrompt()))return!1;if(null==e)return!1;if("totp"===t){if(!(yield this.totpAllowed(i)))return!1;const t=yield(0,bo._)(this.totpService.getCode$(e));if(!(null==t?void 0:t.code))return!1;e=t.code}return this.platformUtilsService.copyToClipboard(e),this.toastService.showToast({variant:"success",message:this.i18nService.t("valueCopied",this.i18nService.t(r.typeI18nKey)),title:""}),void 0!==r.event&&(yield this.eventCollectionService.collect(r.event,i.id?i.id:void 0,!1,i.organizationId?i.organizationId:void 0)),!0})}totpAllowed(e){return P$(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.accountService.activeAccount$);if(!(null==t?void 0:t.id))return!1;const i=t$.getLogin(e);return!!(null==i?void 0:i.totp)&&(e.organizationUseTotp||(yield(0,bo._)(this.billingAccountProfileStateService.hasPremiumFromAnySource$(t.id))))})}}R$.ɵfac=function(e){return new(e||R$)(a.KVO(Hb),a.KVO(qb),a.KVO(I$),a.KVO(k$),a.KVO(C$),a.KVO(Ul),a.KVO(T$),a.KVO(Zk))},R$.ɵprov=a.jDH({token:R$,factory:R$.ɵfac,providedIn:"root"});const x$=[[["","slot","start"]],"*",[["","slot","end"]]],A$=e=>({"tw-hidden":e});class D${get disabledAttr(){return this.disabled||null}constructor(e){this.elementRef=e,this.classList=["tw-block","tw-w-full","tw-py-1.5","tw-px-3","!tw-text-main","!tw-no-underline","tw-cursor-pointer","tw-border-none","tw-bg-background","tw-text-left","hover:tw-bg-hover-default","focus-visible:tw-z-50","focus-visible:tw-outline-none","focus-visible:tw-ring-2","focus-visible:tw-rounded-lg","focus-visible:tw-ring-inset","focus-visible:tw-ring-primary-600","active:!tw-ring-0","active:!tw-ring-offset-0","disabled:!tw-text-muted","disabled:hover:tw-bg-background","disabled:tw-cursor-not-allowed"],this.role="menuitem",this.tabIndex="-1",this.disabled=!1}focus(){this.elementRef.nativeElement.focus()}}D$.ɵfac=function(e){return new(e||D$)(Fl.rXU(Fl.aKT))},D$.ɵcmp=Fl.VBU({type:D$,selectors:[["","bitMenuItem",""]],hostVars:5,hostBindings:function(e,t){2&e&&(Fl.Avn("tabIndex",t.tabIndex),Fl.BMQ("role",t.role)("disabled",t.disabledAttr),Fl.HbH(t.classList))},inputs:{disabled:[2,"disabled","disabled",$x.he]},attrs:["bitMenuItem",""],ngContentSelectors:["[slot=start]","*","[slot=end]"],decls:10,vars:6,consts:[["startSlot",""],["endSlot",""],[1,"tw-flex","tw-w-full","tw-justify-between","tw-items-center","tw-gap-2"],[1,"tw-flex","tw-gap-2","tw-items-center","tw-overflow-hidden"],[3,"ngClass"],[1,"tw-truncate"]],template:function(e,t){if(1&e&&(Fl.NAR(x$),Fl.j41(0,"div",2)(1,"span",3)(2,"span",4,0),Fl.SdG(4),Fl.k0s(),Fl.j41(5,"span",5),Fl.SdG(6,1),Fl.k0s()(),Fl.j41(7,"span",4,1),Fl.SdG(9,2),Fl.k0s()()),2&e){const e=Fl.sdS(3),t=Fl.sdS(8);Fl.R7$(2),Fl.Y8G("ngClass",Fl.eq3(2,A$,0===e.childElementCount)),Fl.R7$(5),Fl.Y8G("ngClass",Fl.eq3(4,A$,0===t.childElementCount))}},dependencies:[kl.YU],encapsulation:2});var E$,$$,O$,U$,M$,N$,V$,B$=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class j${constructor(e,t,i,n,r){this.copyCipherFieldService=e,this.accountService=t,this.cipherService=i,this.menuItemComponent=n,this.iconButtonComponent=r,this.disabled=null}get hidden(){return this.disabled&&this.menuItemComponent}copy(){return B$(this,void 0,void 0,function*(){const e=yield this.getValueToCopy();yield this.copyCipherFieldService.copy(null!=e?e:"",this.action,this.cipher)})}ngOnChanges(){return B$(this,void 0,void 0,function*(){yield this.updateDisabledState()})}updateDisabledState(){return B$(this,void 0,void 0,function*(){var e,t;this.disabled=!this.cipher||!this.hasValueToCopy()||"totp"===this.action&&!(yield this.copyCipherFieldService.totpAllowed(this.cipher))||null,this.iconButtonComponent&&this.iconButtonComponent.disabled.set(null!==(e=this.disabled)&&void 0!==e&&e),this.menuItemComponent&&(this.menuItemComponent.disabled=null!==(t=this.disabled)&&void 0!==t&&t)})}hasValueToCopy(){return t$.hasCopyableValue(this.cipher,this.action)}getValueToCopy(){return B$(this,void 0,void 0,function*(){var e,t,i,n,r,s,o,a,l,c,u,d;let h;if(t$.isCipherListView(this.cipher)){const e=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv)),t=yield this.cipherService.get(this.cipher.id,e);h=yield this.cipherService.decrypt(t,e)}else h=this.cipher;switch(this.action){case"username":return(null===(e=h.login)||void 0===e?void 0:e.username)||(null===(t=h.identity)||void 0===t?void 0:t.username);case"password":return null===(i=h.login)||void 0===i?void 0:i.password;case"totp":return null===(n=h.login)||void 0===n?void 0:n.totp;case"cardNumber":return null===(r=h.card)||void 0===r?void 0:r.number;case"securityCode":return null===(s=h.card)||void 0===s?void 0:s.code;case"email":return null===(o=h.identity)||void 0===o?void 0:o.email;case"phone":return null===(a=h.identity)||void 0===a?void 0:a.phone;case"address":return null===(l=h.identity)||void 0===l?void 0:l.fullAddressForCopy;case"secureNote":return h.notes;case"privateKey":return null===(c=h.sshKey)||void 0===c?void 0:c.privateKey;case"publicKey":return null===(u=h.sshKey)||void 0===u?void 0:u.publicKey;case"keyFingerprint":return null===(d=h.sshKey)||void 0===d?void 0:d.keyFingerprint;default:return null}})}}j$.ɵfac=function(e){return new(e||j$)(Fl.rXU(R$),Fl.rXU(Zk),Fl.rXU(_b),Fl.rXU(D$,8),Fl.rXU(Zl,8))},j$.ɵdir=Fl.FsC({type:j$,selectors:[["","appCopyField",""]],hostVars:3,hostBindings:function(e,t){1&e&&Fl.bIt("click",function(){return t.copy()}),2&e&&(Fl.BMQ("disabled",t.disabled),Fl.AVh("tw-hidden",t.hidden))},inputs:{action:[0,"appCopyField","action"],cipher:"cipher"},features:[Fl.OA$]}),function(e){e[e.Card=0]="Card",e[e.BankAccount=1]="BankAccount",e[e.PayPal=2]="PayPal",e[e.BitPay=3]="BitPay",e[e.Credit=4]="Credit",e[e.WireTransfer=5]="WireTransfer",e[e.Check=8]="Check"}(E$||(E$={})),function(e){e[e.FamiliesForEnterprise=0]="FamiliesForEnterprise"}($$||($$={})),function(e){e[e.Free=0]="Free",e[e.FamiliesAnnually2019=1]="FamiliesAnnually2019",e[e.TeamsMonthly2019=2]="TeamsMonthly2019",e[e.TeamsAnnually2019=3]="TeamsAnnually2019",e[e.EnterpriseMonthly2019=4]="EnterpriseMonthly2019",e[e.EnterpriseAnnually2019=5]="EnterpriseAnnually2019",e[e.Custom=6]="Custom",e[e.FamiliesAnnually2025=7]="FamiliesAnnually2025",e[e.TeamsMonthly2020=8]="TeamsMonthly2020",e[e.TeamsAnnually2020=9]="TeamsAnnually2020",e[e.EnterpriseMonthly2020=10]="EnterpriseMonthly2020",e[e.EnterpriseAnnually2020=11]="EnterpriseAnnually2020",e[e.TeamsMonthly2023=12]="TeamsMonthly2023",e[e.TeamsAnnually2023=13]="TeamsAnnually2023",e[e.EnterpriseMonthly2023=14]="EnterpriseMonthly2023",e[e.EnterpriseAnnually2023=15]="EnterpriseAnnually2023",e[e.TeamsStarter2023=16]="TeamsStarter2023",e[e.TeamsMonthly=17]="TeamsMonthly",e[e.TeamsAnnually=18]="TeamsAnnually",e[e.EnterpriseMonthly=19]="EnterpriseMonthly",e[e.EnterpriseAnnually=20]="EnterpriseAnnually",e[e.TeamsStarter=21]="TeamsStarter",e[e.FamiliesAnnually=22]="FamiliesAnnually"}(O$||(O$={})),function(e){e[e.Charge=0]="Charge",e[e.Credit=1]="Credit",e[e.PromotionalCredit=2]="PromotionalCredit",e[e.ReferralCredit=3]="ReferralCredit",e[e.Refund=4]="Refund"}(U$||(U$={})),function(e){e[e.Free=0]="Free",e[e.Families=1]="Families",e[e.Teams=2]="Teams",e[e.Enterprise=3]="Enterprise",e[e.TeamsStarter=4]="TeamsStarter"}(M$||(M$={})),function(e){e[e.PasswordManager=0]="PasswordManager",e[e.SecretsManager=1]="SecretsManager"}(N$||(N$={})),function(e){e[e.Monthly=0]="Monthly",e[e.Annually=1]="Annually"}(V$||(V$={}));class G${constructor(e,t){this.el=e,this.renderer=t,this.size="default",this.renderer.setAttribute(this.el.nativeElement,"aria-hidden","true")}get iconSize(){switch(this.size){case"small":return"bwi-sm";case"large":return"bwi-lg";default:return""}}get orgIcon(){switch(this.tierType){case M$.Free:case M$.Families:return"bwi-family";case M$.Teams:case M$.Enterprise:case M$.TeamsStarter:return"bwi-business";default:return""}}get classList(){return["bwi",this.iconSize,this.orgIcon]}}G$.ɵfac=function(e){return new(e||G$)(Fl.rXU(Fl.aKT),Fl.rXU(Fl.sFG))},G$.ɵdir=Fl.FsC({type:G$,selectors:[["","appOrgIcon",""]],hostVars:2,hostBindings:function(e,t){2&e&&Fl.HbH(t.classList)},inputs:{tierType:"tierType",size:"size"}});class L${}class z${set cipher(e){this.viewContainer.clear(),this.cipherAuthorizationService.canDeleteCipher$(e).pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{e?this.viewContainer.createEmbeddedView(this.templateRef):this.viewContainer.clear()})}constructor(e,t,i){this.templateRef=e,this.viewContainer=t,this.cipherAuthorizationService=i,this.destroy$=new Co.B}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}}z$.ɵfac=function(e){return new(e||z$)(Fl.rXU(Fl.C4Q),Fl.rXU(Fl.c1b),Fl.rXU(L$))},z$.ɵdir=Fl.FsC({type:z$,selectors:[["","appCanDeleteCipher",""]],inputs:{cipher:[0,"appCanDeleteCipher","cipher"]}});var _$=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class K${}const X$=new m(ce,"selection",{deserializer:e=>e});class q${constructor(){this.themeService=(0,a.WQX)(K$),this.systemTheme$=(0,a.WQX)(GT),this.el=(0,a.WQX)(Fl.aKT),this.destroyRef=(0,a.WQX)(a.abz),this.darkImgSrc=o.hFB.required({alias:"appDarkImgSrc"})}ngOnInit(){this.lightImgSrc=this.el.nativeElement.getAttribute("src"),(0,jo.z)([this.themeService.selectedTheme$,this.systemTheme$]).pipe((0,xl.pQ)(this.destroyRef)).subscribe(([e,t])=>{const i="dark"===("system"===e?t:e);this.src=i?this.darkImgSrc():this.lightImgSrc})}}function W$(e){const t=null==e||""===e;let i=t?null:`${e}`;if(t||i&&/^[1-9]{1}\d{3}$/.test(i))return i;if(i=(i||"").replace(/[^\d]/g,"").replace(/^[0]+(?=.)/,""),""===i&&(i=null),i&&4!==i.length){const e=("00"+i).slice(-2);i=`${(new Date).getFullYear()}`.slice(0,2)+e}return i}function Y$(e="",t={}){const i=t&&Object.keys(t);if(i.length&&(null==e?void 0:e.length)){let t;try{t=bd.getHostname(e)}catch(e){return!1}if(t)return i.some(e=>t.endsWith(e))}return!1}q$.ɵfac=function(e){return new(e||q$)},q$.ɵdir=Fl.FsC({type:q$,selectors:[["","appDarkImgSrc",""]],hostVars:1,hostBindings:function(e,t){2&e&&Fl.BMQ("src",t.src,Fl.n$t)},inputs:{darkImgSrc:[1,"appDarkImgSrc","darkImgSrc"]}});class H${}const J$=["input"],Z$=(e,t)=>({"tw-opacity-0":e,"tw-bg-text-muted":t});function Q$(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",7),Fl.nI1(1,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.clearSearch())}),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.Y8G("ngClass",Fl.l_i(4,Z$,!e.showResetButton(),e.showResetButton())),Fl.BMQ("aria-label",Fl.bMT(1,2,"resetSearch"))}}let eO=0;class tO{constructor(){this.input=(0,o.ebz)("input"),this.id="search-id-"+eO++,this.inputType=Ga()?"text":"search",this.isInputFocused=(0,a.vPA)(!1),this.isFormHovered=(0,a.vPA)(!1),this.showResetButton=(0,Rl.EW)(()=>this.isInputFocused()||this.isFormHovered()),this.disabled=(0,o.geq)(),this.placeholder=(0,o.hFB)(),this.autocomplete=(0,o.hFB)()}getFocusTarget(){var e;return null===(e=this.input())||void 0===e?void 0:e.nativeElement}onChange(e){this.searchText=e,null!=this.notifyOnChange&&this.notifyOnChange(e)}clearSearch(){this.searchText="",this.notifyOnChange&&this.notifyOnChange("")}onTouch(){null!=this.notifyOnTouch&&this.notifyOnTouch()}registerOnChange(e){this.notifyOnChange=e}registerOnTouched(e){this.notifyOnTouch=e}writeValue(e){this.searchText=e}setDisabledState(e){this.disabled.set(e)}}tO.ɵfac=function(e){return new(e||tO)},tO.ɵcmp=Fl.VBU({type:tO,selectors:[["bit-search"]],viewQuery:function(e,t){1&e&&Fl.wEZ(t.input,J$,5),2&e&&Fl.NyB()},inputs:{disabled:[1,"disabled"],placeholder:[1,"placeholder"],autocomplete:[1,"autocomplete"]},outputs:{disabled:"disabledChange"},features:[Fl.Jv_([{provide:Il.kq,multi:!0,useExisting:tO},{provide:$l,useExisting:tO}])],decls:10,vars:14,consts:[["input",""],["role","search",1,"tw-relative","tw-flex","tw-items-center","tw-w-full","tw-h-10",3,"mouseenter","mouseleave"],[1,"tw-sr-only",3,"for"],["aria-hidden","true",1,"tw-absolute","tw-start-2","tw-z-20","!tw-mb-0","tw-cursor-text",3,"for"],[1,"bwi","bwi-search","bwi-fw","tw-text-muted"],["bitInput","","name","searchText",1,"tw-ps-9","tw-h-full",3,"ngModelChange","focus","blur","type","id","placeholder","ngModel","disabled"],["class","bw-reset-btn tw-size-6 tw-absolute hover:tw-bg-text-main tw-end-2 tw-z-20 !tw-mb-0 tw-cursor-pointer","type","reset",3,"ngClass","click",4,"ngIf"],["type","reset",1,"bw-reset-btn","tw-size-6","tw-absolute","hover:tw-bg-text-main","tw-end-2","tw-z-20","!tw-mb-0","tw-cursor-pointer",3,"click","ngClass"]],template:function(e,t){var i;if(1&e){const e=Fl.RV6();Fl.j41(0,"form",1),Fl.bIt("mouseenter",function(){return a.eBV(e),a.Njj(t.isFormHovered.set(!0))})("mouseleave",function(){return a.eBV(e),a.Njj(t.isFormHovered.set(!1))}),Fl.j41(1,"label",2),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"label",3),Fl.nrm(5,"i",4),Fl.k0s(),Fl.j41(6,"input",5,0),Fl.nI1(8,"i18n"),Fl.bIt("ngModelChange",function(i){return a.eBV(e),a.Njj(t.onChange(i))})("focus",function(){return a.eBV(e),a.Njj(t.isInputFocused.set(!0))})("blur",function(){return a.eBV(e),t.isInputFocused.set(!1),a.Njj(t.onTouch())}),Fl.k0s(),Fl.DNE(9,Q$,2,7,"button",6),Fl.k0s()}2&e&&(Fl.R7$(),Fl.Y8G("for",t.id),Fl.R7$(),Fl.JRh(Fl.bMT(3,10,"search")),Fl.R7$(2),Fl.Y8G("for",t.id),Fl.R7$(2),Fl.Y8G("type",t.inputType)("id",t.id)("placeholder",null!==(i=t.placeholder())&&void 0!==i?i:Fl.bMT(8,12,"search"))("ngModel",t.searchText)("disabled",t.disabled()),Fl.BMQ("autocomplete",t.autocomplete()),Fl.R7$(3),Fl.Y8G("ngIf",t.searchText&&t.showResetButton()))},dependencies:[qc,fu,Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.YN,Il.vS,Il.cV,kl.bT,kl.YU,sc],encapsulation:2});class iO{}iO.ɵfac=function(e){return new(e||iO)},iO.ɵmod=Fl.$C({type:iO}),iO.ɵinj=a.G2t({imports:[tO]});const nO=new a.nKC("CopyClickListener");class rO{constructor(e,t,i,n){this.platformUtilsService=e,this.toastService=t,this.i18nService=i,this.copyListener=n,this._showToast=(0,Rl.EW)(()=>void 0!==this.showToast()),this.toastVariant=(0,Rl.EW)(()=>{const e=this.showToast();return""===e||void 0===e?"success":e}),this.valueToCopy=(0,o.hFB)("",{alias:"appCopyClick"}),this.valueLabel=(0,o.hFB)(),this.showToast=(0,o.hFB)()}onClick(){const e=this.valueToCopy();if(this.platformUtilsService.copyToClipboard(e),this.copyListener&&this.copyListener.onCopy(e),this._showToast()){const e=this.valueLabel(),t=e?this.i18nService.t("valueCopied",e):this.i18nService.t("copySuccessful");this.toastService.showToast({variant:this.toastVariant(),message:t})}}}rO.ɵfac=function(e){return new(e||rO)(Fl.rXU(Hb),Fl.rXU(qb),Fl.rXU(Ul),Fl.rXU(nO,8))},rO.ɵdir=Fl.FsC({type:rO,selectors:[["","appCopyClick",""]],hostBindings:function(e,t){1&e&&Fl.bIt("click",function(){return t.onClick()})},inputs:{valueToCopy:[1,"appCopyClick","valueToCopy"],valueLabel:[1,"valueLabel"],showToast:[1,"showToast"]}});class sO{constructor(){this.data=""}onDragStart(e){var t;null===(t=e.dataTransfer)||void 0===t||t.setData("text",this.data)}}sO.ɵfac=function(e){return new(e||sO)},sO.ɵdir=Fl.FsC({type:sO,selectors:[["","appTextDrag",""]],hostAttrs:["draggable","true",1,"tw-cursor-move"],hostBindings:function(e,t){1&e&&Fl.bIt("dragstart",function(e){return t.onDragStart(e)})},inputs:{data:[0,"appTextDrag","data"]}});class oO{constructor(){this.notes=""}}var aO;function lO(e){if(null!=e)return{lastUsedDate:e.lastUsedDate?new Date(e.lastUsedDate).getTime():void 0,lastLaunched:e.lastLaunched?new Date(e.lastLaunched).getTime():void 0}}function cO(e){if(null!=e)return{lastUsedDate:e.lastUsedDate?new Date(e.lastUsedDate).toISOString():void 0,lastLaunched:e.lastLaunched?new Date(e.lastLaunched).toISOString():void 0}}oO.ɵfac=function(e){return new(e||oO)},oO.ɵcmp=Fl.VBU({type:oO,selectors:[["app-additional-options"]],inputs:{notes:"notes"},decls:15,vars:15,consts:[[1,"tw-mb-5","bit-compact:tw-mb-4"],["bitTypography","h6"],[1,"[&_bit-form-field:last-of-type]:tw-mb-0"],["disableReadOnlyBorder",""],[3,"appTextDrag"],["readonly","","id","notes","bitInput","","rows","5","aria-readonly","true"],["bitSuffix","","bitIconButton","bwi-clone","size","small","type","button","showToast","",3,"appCopyClick","valueLabel","label"]],template:function(e,t){1&e&&(Fl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"bit-card",2)(6,"bit-form-field",3)(7,"bit-label",4),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.j41(10,"textarea",5),Fl.EFF(11),Fl.k0s(),Fl.nrm(12,"button",6),Fl.nI1(13,"i18n"),Fl.nI1(14,"i18n"),Fl.k0s()()()),2&e&&(Fl.R7$(3),Fl.JRh(Fl.bMT(4,7,"additionalOptions")),Fl.R7$(4),Fl.Y8G("appTextDrag",t.notes),Fl.R7$(),Fl.JRh(Fl.bMT(9,9,"note")),Fl.R7$(3),Fl.JRh(t.notes),Fl.R7$(),Fl.Y8G("appCopyClick",t.notes)("valueLabel",Fl.bMT(13,11,"note"))("label",Fl.bMT(14,13,"copyNotes")))},dependencies:[kl.MD,sf,rO,sO,Ex,Ql,Zl,qc,fu,Nx,tc,rc,Gu,Ac,ju,nw,rf],encapsulation:2}),function(e){e[e.Cipher=0]="Cipher",e[e.CipherView=1]="CipherView"}(aO||(aO={}));class uO{constructor(e){e&&(this.id=e.id,this.url=e.url,this.size=e.size,this.sizeName=e.sizeName)}get fileSize(){try{if(null!=this.size)return parseInt(this.size)}catch(e){}return 0}get hasDecryptionError(){return this._hasDecryptionError||this.fileName===Tp}set hasDecryptionError(e){this._hasDecryptionError=e}static fromJSON(e){const t=null==e.key?null:Dv.fromJSON(e.key);let i;return null!=e.encryptedKey&&("string"==typeof e.encryptedKey?i=Pp.fromJSON(e.encryptedKey):e.encryptedKey instanceof Pp&&(i=e.encryptedKey)),Object.assign(new uO,e,{key:t,encryptedKey:i})}toSdkAttachmentView(){var e;return{id:this.id,url:this.url,size:this.size,sizeName:this.sizeName,fileName:this.fileName,key:null===(e=this.encryptedKey)||void 0===e?void 0:e.toSdk(),decryptedKey:this.key?this.key.toBase64():void 0}}static fromSdkAttachmentView(e,t=!1){if(!e)return;const i=new uO;return i.id=e.id,i.url=e.url,i.size=e.size,i.sizeName=e.sizeName,i.fileName=e.fileName,i.key=e.decryptedKey?Dv.fromString(e.decryptedKey):void 0,i.encryptedKey=e.key?new Pp(e.key):void 0,i._hasDecryptionError=t,i}}class dO{constructor(e,t){this.propertyKey=e,this._i18nKey=null==t?void 0:t.i18nKey,this.sortPosition=t.sortPosition}get i18nKey(){var e;return null!==(e=this._i18nKey)&&void 0!==e?e:this.propertyKey}}function hO(e,t){return(i,n)=>{null==i.linkedFieldOptions&&(i.linkedFieldOptions=new Map),i.linkedFieldOptions.set(e,new dO(n,t))}}class pO{}var vO=function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},fO=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class mO extends pO{get maskedCode(){return null!=this.code?"•".repeat(this.code.length):void 0}get maskedNumber(){return null!=this.number?"•".repeat(this.number.length):void 0}get brand(){return this._brand}set brand(e){this._brand=e,this._subTitle=void 0}get number(){return this._number}set number(e){this._number=e,this._subTitle=void 0}get subTitle(){if(null==this._subTitle&&(this._subTitle=this.brand,null!=this.number&&this.number.length>=4)){null!=this._subTitle&&""!==this._subTitle?this._subTitle+=", ":this._subTitle="";const e=this.number.length>=5&&null!=this.number.match(new RegExp("^3[47]"))?5:4;this._subTitle+="*"+this.number.substr(this.number.length-e)}return this._subTitle}get expiration(){const e=this.expYear?W$(this.expYear):void 0;if(!this.expMonth&&!e)return;let t=null!=this.expMonth?("0"+this.expMonth).slice(-2):"__";return t+=" / "+(e||"____"),t}static fromJSON(e){return Object.assign(new mO,e)}static getCardBrandByPatterns(e){if(null==e||"string"!=typeof e||""===e.trim())return;let t=new RegExp("^4");return null!=e.match(t)?"Visa":/^(5[1-5][0-9]{14}|2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12}))$/.test(e)?"Mastercard":(t=new RegExp("^3[47]"),null!=e.match(t)?"Amex":(t=new RegExp("^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)"),null!=e.match(t)?"Discover":(t=new RegExp("^36"),null!=e.match(t)?"Diners Club":(t=new RegExp("^30[0-5]"),null!=e.match(t)?"Diners Club":(t=new RegExp("^35(2[89]|[3-8][0-9])"),null!=e.match(t)?"JCB":(t=new RegExp("^(4026|417500|4508|4844|491(3|7))"),null!=e.match(t)?"Visa":void 0))))))}static fromSdkCardView(e){const t=new mO;return t.cardholderName=e.cardholderName,t.brand=e.brand,t.number=e.number,t.expMonth=e.expMonth,t.expYear=e.expYear,t.code=e.code,t}toSdkCardView(){return this}}vO([hO(cx.CardholderName,{sortPosition:0}),fO("design:type",String)],mO.prototype,"cardholderName",void 0),vO([hO(cx.ExpMonth,{sortPosition:3,i18nKey:"expirationMonth"}),fO("design:type",String)],mO.prototype,"expMonth",void 0),vO([hO(cx.ExpYear,{sortPosition:4,i18nKey:"expirationYear"}),fO("design:type",String)],mO.prototype,"expYear",void 0),vO([hO(cx.Code,{sortPosition:5,i18nKey:"securityCode"}),fO("design:type",String)],mO.prototype,"code",void 0),vO([hO(cx.Brand,{sortPosition:2}),fO("design:type",String),fO("design:paramtypes",[String])],mO.prototype,"brand",null),vO([hO(cx.Number,{sortPosition:1}),fO("design:type",String),fO("design:paramtypes",[String])],mO.prototype,"number",null);class gO{constructor(e){this.type=ox.Text,this.newField=!1,this.showValue=!1,this.showCount=!1,e&&(this.type=e.type,this.linkedId=e.linkedId)}get maskedValue(){return null!=this.value?"••••••••":void 0}static fromJSON(e){return Object.assign(new gO,e)}static fromSdkFieldView(e){if(!e)return;const t=new gO;return t.name=e.name,t.value=e.value,t.type=e.type,t.linkedId=e.linkedId,t}toSdkFieldView(){var e,t,i,n;return{name:null!==(e=this.name)&&void 0!==e?e:void 0,value:null!==(t=this.value)&&void 0!==t?t:void 0,type:null!==(i=this.type)&&void 0!==i?i:nm.PUO.Text,linkedId:null!==(n=this.linkedId)&&void 0!==n?n:void 0}}}var yO=function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},bO=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class wO extends pO{constructor(){super()}get firstName(){return this._firstName}set firstName(e){this._firstName=e,this._subTitle=void 0}get lastName(){return this._lastName}set lastName(e){this._lastName=e,this._subTitle=void 0}get subTitle(){return null!=this._subTitle||null==this.firstName&&null==this.lastName||(this._subTitle="",null!=this.firstName&&(this._subTitle=this.firstName),null!=this.lastName&&(""!==this._subTitle&&(this._subTitle+=" "),this._subTitle+=this.lastName)),this._subTitle}get fullName(){if(null!=this.title||null!=this.firstName||null!=this.middleName||null!=this.lastName){let e="";return bd.isNullOrWhitespace(this.title)||(e+=this.title+" "),bd.isNullOrWhitespace(this.firstName)||(e+=this.firstName+" "),bd.isNullOrWhitespace(this.middleName)||(e+=this.middleName+" "),bd.isNullOrWhitespace(this.lastName)||(e+=this.lastName),e.trim()}}get fullAddress(){var e;let t=null!==(e=this.address1)&&void 0!==e?e:"";return bd.isNullOrWhitespace(this.address2)||(bd.isNullOrWhitespace(t)||(t+=", "),t+=this.address2),bd.isNullOrWhitespace(this.address3)||(bd.isNullOrWhitespace(t)||(t+=", "),t+=this.address3),t}get fullAddressPart2(){const e=!bd.isNullOrWhitespace(this.city),t=!bd.isNullOrWhitespace(this.state),i=!bd.isNullOrWhitespace(this.postalCode);if(!e&&!t&&!i)return;const n=e?this.city:"-",r=this.state;let s=n;return t&&(s+=", "+r),s+=", "+(i?this.postalCode:"-"),s}get fullAddressForCopy(){let e=this.fullAddress;return null==this.city&&null==this.state&&null==this.postalCode||(e+="\n"+this.fullAddressPart2),null!=this.country&&(e+="\n"+this.country),e}static fromJSON(e){return Object.assign(new wO,e)}static fromSdkIdentityView(e){const t=new wO;return t.title=e.title,t.firstName=e.firstName,t.middleName=e.middleName,t.lastName=e.lastName,t.address1=e.address1,t.address2=e.address2,t.address3=e.address3,t.city=e.city,t.state=e.state,t.postalCode=e.postalCode,t.country=e.country,t.company=e.company,t.email=e.email,t.phone=e.phone,t.ssn=e.ssn,t.username=e.username,t.passportNumber=e.passportNumber,t.licenseNumber=e.licenseNumber,t}toSdkIdentityView(){return this}}yO([hO(ux.Title,{sortPosition:0}),bO("design:type",String)],wO.prototype,"title",void 0),yO([hO(ux.MiddleName,{sortPosition:2}),bO("design:type",String)],wO.prototype,"middleName",void 0),yO([hO(ux.Address1,{sortPosition:12}),bO("design:type",String)],wO.prototype,"address1",void 0),yO([hO(ux.Address2,{sortPosition:13}),bO("design:type",String)],wO.prototype,"address2",void 0),yO([hO(ux.Address3,{sortPosition:14}),bO("design:type",String)],wO.prototype,"address3",void 0),yO([hO(ux.City,{sortPosition:15,i18nKey:"cityTown"}),bO("design:type",String)],wO.prototype,"city",void 0),yO([hO(ux.State,{sortPosition:16,i18nKey:"stateProvince"}),bO("design:type",String)],wO.prototype,"state",void 0),yO([hO(ux.PostalCode,{sortPosition:17,i18nKey:"zipPostalCodeLabel"}),bO("design:type",String)],wO.prototype,"postalCode",void 0),yO([hO(ux.Country,{sortPosition:18}),bO("design:type",String)],wO.prototype,"country",void 0),yO([hO(ux.Company,{sortPosition:6}),bO("design:type",String)],wO.prototype,"company",void 0),yO([hO(ux.Email,{sortPosition:10}),bO("design:type",String)],wO.prototype,"email",void 0),yO([hO(ux.Phone,{sortPosition:11}),bO("design:type",String)],wO.prototype,"phone",void 0),yO([hO(ux.Ssn,{sortPosition:7}),bO("design:type",String)],wO.prototype,"ssn",void 0),yO([hO(ux.Username,{sortPosition:5}),bO("design:type",String)],wO.prototype,"username",void 0),yO([hO(ux.PassportNumber,{sortPosition:8}),bO("design:type",String)],wO.prototype,"passportNumber",void 0),yO([hO(ux.LicenseNumber,{sortPosition:9}),bO("design:type",String)],wO.prototype,"licenseNumber",void 0),yO([hO(ux.FirstName,{sortPosition:1}),bO("design:type",String),bO("design:paramtypes",[String])],wO.prototype,"firstName",null),yO([hO(ux.LastName,{sortPosition:4}),bO("design:type",String),bO("design:paramtypes",[String])],wO.prototype,"lastName",null),yO([hO(ux.FullName,{sortPosition:3}),bO("design:type",String),bO("design:paramtypes",[])],wO.prototype,"fullName",null);class SO extends pO{constructor(e){var t;super(),this.discoverable=!1,null!=e&&(this.credentialId=e.credentialId,this.keyType=e.keyType,this.keyAlgorithm=e.keyAlgorithm,this.keyCurve=e.keyCurve,this.keyValue=e.keyValue,this.rpId=e.rpId,this.userHandle=e.userHandle,this.userName=e.userName,this.counter=e.counter,this.rpName=e.rpName,this.userDisplayName=e.userDisplayName,this.discoverable=null!==(t=e.discoverable)&&void 0!==t&&t,this.creationDate=e.creationDate)}get subTitle(){return this.userDisplayName}static fromJSON(e){const t=null!=e.creationDate?new Date(e.creationDate):null;return Object.assign(new SO,e,{creationDate:t})}static fromSdkFido2CredentialView(e){var t;if(e)return new SO({credentialId:e.credentialId,keyType:e.keyType,keyAlgorithm:e.keyAlgorithm,keyCurve:e.keyCurve,keyValue:e.keyValue,rpId:e.rpId,userHandle:e.userHandle,userName:e.userName,counter:parseInt(e.counter),rpName:e.rpName,userDisplayName:e.userDisplayName,discoverable:"true"===(null===(t=e.discoverable)||void 0===t?void 0:t.toLowerCase()),creationDate:new Date(e.creationDate)})}toSdkFido2CredentialFullView(){var e;return{credentialId:this.credentialId,keyType:this.keyType,keyAlgorithm:this.keyAlgorithm,keyCurve:this.keyCurve,keyValue:this.keyValue,rpId:this.rpId,userHandle:this.userHandle,userName:this.userName,counter:this.counter.toString(),rpName:this.rpName,userDisplayName:this.userDisplayName,discoverable:this.discoverable?"true":"false",creationDate:null===(e=this.creationDate)||void 0===e?void 0:e.toISOString()}}}var kO=function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},IO=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class CO extends pO{constructor(e){super(),this.uris=[],this.fido2Credentials=[],e&&(this.passwordRevisionDate=e.passwordRevisionDate,this.autofillOnPageLoad=e.autofillOnPageLoad)}get uri(){return this.hasUris?this.uris[0].uri:void 0}get maskedPassword(){return null!=this.password?"••••••••":void 0}get subTitle(){var e;return bd.isNullOrEmpty(this.username)&&(null===(e=this.fido2Credentials)||void 0===e?void 0:e.length)>0?this.fido2Credentials[0].userName:this.username}get canLaunch(){return this.hasUris&&this.uris.some(e=>e.canLaunch)}get hasTotp(){return!bd.isNullOrWhitespace(this.totp)}get launchUri(){if(this.hasUris){const e=this.uris.find(e=>e.canLaunch);if(null!=e)return e.launchUri}}get hasUris(){return null!=this.uris&&this.uris.length>0}get hasFido2Credentials(){return null!=this.fido2Credentials&&this.fido2Credentials.length>0}matchesUri(e,t,i,n){return null!=this.uris&&this.uris.some(r=>r.matchesUri(e,t,i,n))}static fromJSON(e){var t,i,n,r;if(null==e)return new CO;const s=Object.assign(new CO,e);return s.passwordRevisionDate=null==e.passwordRevisionDate?void 0:new Date(e.passwordRevisionDate),s.uris=null!==(i=null===(t=e.uris)||void 0===t?void 0:t.map(e=>QE.fromJSON(e)))&&void 0!==i?i:[],s.fido2Credentials=null!==(r=null===(n=e.fido2Credentials)||void 0===n?void 0:n.map(e=>SO.fromJSON(e)))&&void 0!==r?r:[],s}static fromSdkLoginView(e){var t;const i=new CO;return i.username=e.username,i.password=e.password,i.passwordRevisionDate=null==e.passwordRevisionDate?void 0:new Date(e.passwordRevisionDate),i.totp=e.totp,i.autofillOnPageLoad=e.autofillOnPageLoad,i.uris=(null===(t=e.uris)||void 0===t?void 0:t.filter(e=>null!=e.uri&&""!==e.uri).map(e=>QE.fromSdkLoginUriView(e)))||[],i.fido2Credentials=[],i}toSdkLoginView(){var e,t,i;return{username:this.username,password:this.password,passwordRevisionDate:null===(e=this.passwordRevisionDate)||void 0===e?void 0:e.toISOString(),totp:this.totp,autofillOnPageLoad:null!==(t=this.autofillOnPageLoad)&&void 0!==t?t:void 0,uris:null===(i=this.uris)||void 0===i?void 0:i.map(e=>e.toSdkLoginUriView()),fido2Credentials:void 0}}}kO([hO(lx.Username,{sortPosition:0}),IO("design:type",String)],CO.prototype,"username",void 0),kO([hO(lx.Password,{sortPosition:1}),IO("design:type",String)],CO.prototype,"password",void 0);class TO{constructor(e){this.password=null,this.lastUsedDate=null,e&&(this.lastUsedDate=e.lastUsedDate)}static fromJSON(e){const t=null==e.lastUsedDate?null:new Date(e.lastUsedDate);return Object.assign(new TO,e,{lastUsedDate:t})}static fromSdkPasswordHistoryView(e){if(!e)return;const t=new TO;return t.password=e.password,t.lastUsedDate=null==e.lastUsedDate?null:new Date(e.lastUsedDate),t}toSdkPasswordHistoryView(){var e;return{password:null!==(e=this.password)&&void 0!==e?e:"",lastUsedDate:this.lastUsedDate.toISOString()}}}class PO extends pO{constructor(e){super(),this.type=hx,e&&(this.type=e.type)}get subTitle(){}static fromJSON(e){return Object.assign(new PO,e)}static fromSdkSecureNoteView(e){const t=new PO;return t.type=e.type,t}toSdkSecureNoteView(){return this}}class FO extends pO{get maskedPrivateKey(){if(!this.privateKey||0===this.privateKey.length)return"";let e=this.privateKey.split("\n").filter(e=>""!==e.trim());return e=e.map((t,i)=>0===i||i===e.length-1?t:this.maskLine(t)),e.join("\n")}maskLine(e){return"•".repeat(32)}get subTitle(){return this.keyFingerprint}static fromJSON(e){return Object.assign(new FO,e)}static fromSdkSshKeyView(e){const t=new FO;return t.privateKey=e.privateKey,t.publicKey=e.publicKey,t.keyFingerprint=e.fingerprint,t}toSdkSshKeyView(){return{privateKey:this.privateKey,publicKey:this.publicKey,fingerprint:this.keyFingerprint}}}class RO{constructor(e){var t;this.initializerKey=aO.CipherView,this.id="",this.name="",this.type=nx.Login,this.favorite=!1,this.organizationUseTotp=!1,this.permissions=new oA,this.edit=!1,this.viewPassword=!0,this.login=new CO,this.identity=new wO,this.card=new mO,this.secureNote=new PO,this.sshKey=new FO,this.attachments=[],this.fields=[],this.passwordHistory=[],this.collectionIds=[],this.reprompt=tx.None,this.decryptionFailure=!1,e?(this.id=e.id,this.organizationId=e.organizationId,this.folderId=e.folderId,this.favorite=e.favorite,this.organizationUseTotp=e.organizationUseTotp,this.edit=e.edit,this.viewPassword=e.viewPassword,this.permissions=e.permissions,this.type=e.type,this.localData=e.localData,this.collectionIds=e.collectionIds,this.revisionDate=e.revisionDate,this.creationDate=e.creationDate,this.deletedDate=e.deletedDate,this.archivedDate=e.archivedDate,this.reprompt=null!==(t=e.reprompt)&&void 0!==t?t:tx.None,this.key=e.key):this.creationDate=this.revisionDate=new Date}get item(){switch(this.type){case nx.Login:return this.login;case nx.SecureNote:return this.secureNote;case nx.Card:return this.card;case nx.Identity:return this.identity;case nx.SshKey:return this.sshKey}}get subTitle(){var e;return null===(e=this.item)||void 0===e?void 0:e.subTitle}get canBeArchived(){return!this.isDeleted&&!this.isArchived}get hasPasswordHistory(){return this.passwordHistory&&this.passwordHistory.length>0}get hasLoginPassword(){var e;return this.type===nx.Login&&null!=(null===(e=this.login)||void 0===e?void 0:e.password)&&""!==this.login.password}get hasAttachments(){return!!this.attachments&&this.attachments.length>0}get hasOldAttachments(){if(this.hasAttachments)for(let e=0;e<this.attachments.length;e++)if(null==this.attachments[e].key&&null==this.attachments[e].encryptedKey)return!0;return!1}get hasFields(){return this.fields&&this.fields.length>0}get passwordRevisionDisplayDate(){if(this.type===nx.Login&&null!=this.login&&null!=this.login.password&&""!==this.login.password)return this.login.passwordRevisionDate}get isDeleted(){return null!=this.deletedDate}get isArchived(){return null!=this.archivedDate}get linkedFieldOptions(){var e;return null===(e=this.item)||void 0===e?void 0:e.linkedFieldOptions}get isUnassigned(){return null!=this.organizationId&&(null==this.collectionIds||0===this.collectionIds.length)}get canAssignToCollections(){return null==this.organizationId||this.edit&&this.viewPassword}get canLaunch(){return this.type===nx.Login&&this.login.canLaunch}linkedFieldValue(e){var t;const i=null===(t=this.linkedFieldOptions)||void 0===t?void 0:t.get(e),n=this.item;if(null!=i&&null!=n)return n[i.propertyKey]}toJSON(){return this}static fromJSON(e){var t,i,n,r,s,o,a,l,c,u,d,h,p,v,f,m,g,y;if(null==e)return null;const b=new RO;if(b.type=null!==(t=e.type)&&void 0!==t?t:nx.Login,b.id=null!==(i=e.id)&&void 0!==i?i:"",b.organizationId=null!==(n=e.organizationId)&&void 0!==n?n:void 0,b.folderId=null!==(r=e.folderId)&&void 0!==r?r:void 0,b.collectionIds=null!==(s=e.collectionIds)&&void 0!==s?s:[],b.name=null!==(o=e.name)&&void 0!==o?o:"",b.notes=e.notes,b.edit=null!==(a=e.edit)&&void 0!==a&&a,b.viewPassword=null===(l=e.viewPassword)||void 0===l||l,b.favorite=null!==(c=e.favorite)&&void 0!==c&&c,b.organizationUseTotp=null!==(u=e.organizationUseTotp)&&void 0!==u&&u,b.localData=e.localData?e.localData:void 0,b.permissions=e.permissions?oA.fromJSON(e.permissions):void 0,b.reprompt=null!==(d=e.reprompt)&&void 0!==d?d:tx.None,b.decryptionFailure=null!==(h=e.decryptionFailure)&&void 0!==h&&h,e.creationDate&&(b.creationDate=new Date(e.creationDate)),e.revisionDate&&(b.revisionDate=new Date(e.revisionDate)),b.deletedDate=null==e.deletedDate?void 0:new Date(e.deletedDate),b.archivedDate=null==e.archivedDate?void 0:new Date(e.archivedDate),b.attachments=null!==(v=null===(p=e.attachments)||void 0===p?void 0:p.map(e=>uO.fromJSON(e)))&&void 0!==v?v:[],b.fields=null!==(m=null===(f=e.fields)||void 0===f?void 0:f.map(e=>gO.fromJSON(e)))&&void 0!==m?m:[],b.passwordHistory=null!==(y=null===(g=e.passwordHistory)||void 0===g?void 0:g.map(e=>TO.fromJSON(e)))&&void 0!==y?y:[],null!=e.key){let t;"string"==typeof e.key?t=Pp.fromJSON(e.key):e.key instanceof Pp&&(t=e.key),b.key=t}switch(e.type){case nx.Card:b.card=mO.fromJSON(e.card);break;case nx.Identity:b.identity=wO.fromJSON(e.identity);break;case nx.Login:b.login=CO.fromJSON(e.login);break;case nx.SecureNote:b.secureNote=PO.fromJSON(e.secureNote);break;case nx.SshKey:b.sshKey=FO.fromJSON(e.sshKey)}return b}static fromSdkCipherView(e){var t,i,n,r,s,o,a,l,c,u;if(null==e)return;const d=null!==(i=null===(t=e.attachments)||void 0===t?void 0:t.map(e=>uO.fromSdkAttachmentView(e)))&&void 0!==i?i:[];(null===(n=e.attachmentDecryptionFailures)||void 0===n?void 0:n.length)&&e.attachmentDecryptionFailures.forEach(e=>{const t=uO.fromSdkAttachmentView(e,!0);t&&d.push(t)});const h=new RO;switch(h.id=e.id,h.organizationId=e.organizationId,h.folderId=e.folderId,h.name=e.name,h.notes=e.notes,h.type=e.type,h.favorite=e.favorite,h.organizationUseTotp=e.organizationUseTotp,h.permissions=e.permissions?oA.fromSdkCipherPermissions(e.permissions):void 0,h.edit=e.edit,h.viewPassword=e.viewPassword,h.localData=lO(e.localData),h.attachments=d,h.fields=null!==(s=null===(r=e.fields)||void 0===r?void 0:r.map(e=>gO.fromSdkFieldView(e)))&&void 0!==s?s:[],h.passwordHistory=null!==(a=null===(o=e.passwordHistory)||void 0===o?void 0:o.map(e=>TO.fromSdkPasswordHistoryView(e)))&&void 0!==a?a:[],h.collectionIds=null!==(c=null===(l=e.collectionIds)||void 0===l?void 0:l.map(e=>e))&&void 0!==c?c:[],h.revisionDate=new Date(e.revisionDate),h.creationDate=new Date(e.creationDate),h.deletedDate=null==e.deletedDate?void 0:new Date(e.deletedDate),h.archivedDate=null==e.archivedDate?void 0:new Date(e.archivedDate),h.reprompt=null!==(u=e.reprompt)&&void 0!==u?u:tx.None,h.key=e.key?Pp.fromJSON(e.key):void 0,e.type){case nx.Card:h.card=e.card?mO.fromSdkCardView(e.card):new mO;break;case nx.Identity:h.identity=e.identity?wO.fromSdkIdentityView(e.identity):new wO;break;case nx.Login:h.login=e.login?CO.fromSdkLoginView(e.login):new CO;break;case nx.SecureNote:h.secureNote=e.secureNote?PO.fromSdkSecureNoteView(e.secureNote):new PO;break;case nx.SshKey:h.sshKey=e.sshKey?FO.fromSdkSshKeyView(e.sshKey):new FO}return h}toSdkCreateCipherRequest(){var e,t,i,n;return{organizationId:this.organizationId?Yk(this.organizationId):void 0,collectionIds:this.collectionIds?this.collectionIds.map(e=>Yk(e)):[],folderId:this.folderId?Yk(this.folderId):void 0,name:null!==(e=this.name)&&void 0!==e?e:"",notes:this.notes,favorite:null!==(t=this.favorite)&&void 0!==t&&t,reprompt:null!==(i=this.reprompt)&&void 0!==i?i:tx.None,fields:null===(n=this.fields)||void 0===n?void 0:n.map(e=>e.toSdkFieldView()),type:this.getSdkCipherViewType()}}toSdkUpdateCipherRequest(){var e,t,i,n,r,s,o,a;return{id:Yk(this.id),organizationId:this.organizationId?Yk(this.organizationId):void 0,folderId:this.folderId?Yk(this.folderId):void 0,name:null!==(e=this.name)&&void 0!==e?e:"",notes:this.notes,favorite:null!==(t=this.favorite)&&void 0!==t&&t,reprompt:null!==(i=this.reprompt)&&void 0!==i?i:tx.None,fields:null===(n=this.fields)||void 0===n?void 0:n.map(e=>e.toSdkFieldView()),type:this.getSdkCipherViewType(),revisionDate:null===(r=this.revisionDate)||void 0===r?void 0:r.toISOString(),archivedDate:null===(s=this.archivedDate)||void 0===s?void 0:s.toISOString(),attachments:null===(o=this.attachments)||void 0===o?void 0:o.map(e=>e.toSdkAttachmentView()),key:null===(a=this.key)||void 0===a?void 0:a.toSdk()}}getSdkCipherViewType(){var e,t,i,n,r;let s;switch(this.type){case nx.Card:s={card:null===(e=this.card)||void 0===e?void 0:e.toSdkCardView()};break;case nx.Identity:s={identity:null===(t=this.identity)||void 0===t?void 0:t.toSdkIdentityView()};break;case nx.Login:s={login:null===(i=this.login)||void 0===i?void 0:i.toSdkLoginView()};break;case nx.SecureNote:s={secureNote:null===(n=this.secureNote)||void 0===n?void 0:n.toSdkSecureNoteView()};break;case nx.SshKey:s={sshKey:null===(r=this.sshKey)||void 0===r?void 0:r.toSdkSshKeyView()};break;default:s={login:(new CO).toSdkLoginView()}}return s}toSdkCipherView(){var e,t,i,n,r,s,o,a,l,c,u,d,h,p,v,f,m,g,y,b,w,S,k;const I={id:this.id?Yk(this.id):void 0,organizationId:this.organizationId?Yk(this.organizationId):void 0,folderId:this.folderId?Yk(this.folderId):void 0,name:null!==(e=this.name)&&void 0!==e?e:"",notes:this.notes,type:null!==(t=this.type)&&void 0!==t?t:nx.Login,favorite:null!==(i=this.favorite)&&void 0!==i&&i,organizationUseTotp:null!==(n=this.organizationUseTotp)&&void 0!==n&&n,permissions:null===(r=this.permissions)||void 0===r?void 0:r.toSdkCipherPermissions(),edit:null===(s=this.edit)||void 0===s||s,viewPassword:null===(o=this.viewPassword)||void 0===o||o,localData:cO(this.localData),attachments:null===(a=this.attachments)||void 0===a?void 0:a.map(e=>e.toSdkAttachmentView()),fields:null===(l=this.fields)||void 0===l?void 0:l.map(e=>e.toSdkFieldView()),passwordHistory:null===(c=this.passwordHistory)||void 0===c?void 0:c.map(e=>e.toSdkPasswordHistoryView()),collectionIds:null!==(d=null===(u=this.collectionIds)||void 0===u?void 0:u.map(e=>Yk(e)))&&void 0!==d?d:[],revisionDate:(null!==(h=this.revisionDate)&&void 0!==h?h:new Date).toISOString(),creationDate:(null!==(p=this.creationDate)&&void 0!==p?p:new Date).toISOString(),deletedDate:null===(v=this.deletedDate)||void 0===v?void 0:v.toISOString(),archivedDate:null===(f=this.archivedDate)||void 0===f?void 0:f.toISOString(),reprompt:null!==(m=this.reprompt)&&void 0!==m?m:tx.None,key:null===(g=this.key)||void 0===g?void 0:g.toSdk(),login:void 0,card:void 0,identity:void 0,secureNote:void 0,sshKey:void 0};switch(this.type){case nx.Card:I.card=null===(y=this.card)||void 0===y?void 0:y.toSdkCardView();break;case nx.Identity:I.identity=null===(b=this.identity)||void 0===b?void 0:b.toSdkIdentityView();break;case nx.Login:I.login=null===(w=this.login)||void 0===w?void 0:w.toSdkLoginView();break;case nx.SecureNote:I.secureNote=null===(S=this.secureNote)||void 0===S?void 0:S.toSdkSecureNoteView();break;case nx.SshKey:I.sshKey=null===(k=this.sshKey)||void 0===k?void 0:k.toSdkSshKeyView()}return I}}class xO{}var AO=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function DO(e,t){if(1&e&&(Fl.nrm(0,"button",0),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG();Fl.Y8G("bitAction",e.download)("label",Fl.bMT(1,2,"downloadAttachmentLabel"))}}class EO{constructor(e,t,i,n,r,s){this.i18nService=e,this.apiService=t,this.fileDownloadService=i,this.toastService=n,this.stateProvider=r,this.cipherService=s,this.attachment=o.hFB.required(),this.cipher=o.hFB.required(),this.checkPwReprompt=(0,o.hFB)(!1),this.emergencyAccessId=(0,o.hFB)(),this.admin=(0,o.hFB)(!1),this.isDecryptionFailure=(0,Rl.EW)(()=>this.attachment().hasDecryptionError),this.download=()=>AO(this,void 0,void 0,function*(){const e=this.attachment(),t=this.cipher();let i;if(!e.id)return void this.toastService.showToast({variant:"error",message:this.i18nService.t("errorOccurred")});try{i=(this.admin()?yield this.apiService.getAttachmentDataAdmin(t.id,e.id):yield this.apiService.getAttachmentData(t.id,e.id,this.emergencyAccessId())).url}catch(t){if(!(t instanceof iS&&404===t.statusCode))throw t instanceof iS?new Error(t.getSingleMessage()):t;i=e.url}if(!i)return void this.toastService.showToast({variant:"error",message:this.i18nService.t("errorOccurred")});const n=yield fetch(new Request(i,{cache:"no-store"}));if(200===n.status)try{const i=yield(0,bo._)(this.stateProvider.activeUserId$);if(!i||!e.fileName)return void this.toastService.showToast({variant:"error",message:this.i18nService.t("errorOccurred")});const r=yield this.cipherService.getDecryptedAttachmentBuffer(t.id,e,n,i,Boolean(this.emergencyAccessId()));this.fileDownloadService.download({fileName:e.fileName,blobData:r})}catch(e){this.toastService.showToast({variant:"error",message:this.i18nService.t("errorOccurred")})}else this.toastService.showToast({variant:"error",message:this.i18nService.t("errorOccurred")})})}}function $O(e,t){if(1&e&&(Fl.j41(0,"span",4),Fl.EFF(1),Fl.k0s()),2&e){const e=Fl.XpG().$implicit;Fl.R7$(),Fl.JRh(e.sizeName)}}function OO(e,t){if(1&e&&(Fl.j41(0,"bit-item")(1,"bit-item-content")(2,"span",3),Fl.EFF(3),Fl.k0s(),Fl.nVh(4,$O,2,1,"span",4),Fl.k0s(),Fl.qex(5,5),Fl.j41(6,"bit-item-action",6),Fl.nrm(7,"app-download-attachment",7),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e){const e=t.$implicit,i=Fl.XpG();Fl.R7$(2),Fl.Y8G("title",i.getAttachmentFileName(e)),Fl.R7$(),Fl.SpI(" ",i.getAttachmentFileName(e)," "),Fl.R7$(),Fl.vxM(e.hasDecryptionError?-1:4),Fl.R7$(3),Fl.Y8G("admin",i.admin)("cipher",i.cipher)("attachment",e)("checkPwReprompt",!0)("emergencyAccessId",i.emergencyAccessId)}}EO.ɵfac=function(e){return new(e||EO)(Fl.rXU(Ul),Fl.rXU(eI),Fl.rXU(xO),Fl.rXU(qb),Fl.rXU(u),Fl.rXU(_b))},EO.ɵcmp=Fl.VBU({type:EO,selectors:[["app-download-attachment"]],inputs:{attachment:[1,"attachment"],cipher:[1,"cipher"],checkPwReprompt:[1,"checkPwReprompt"],emergencyAccessId:[1,"emergencyAccessId"],admin:[1,"admin"]},decls:1,vars:1,consts:[["bitIconButton","bwi-download","buttonType","main","size","small","type","button",3,"bitAction","label"]],template:function(e,t){1&e&&Fl.nVh(0,DO,2,4,"button",0),2&e&&Fl.vxM(t.isDecryptionFailure()?-1:0)},dependencies:[pc,Bd,kl.MD,sf,Ql,Zl,rf],encapsulation:2,changeDetection:0});class UO{constructor(e,t,i,n,r){this.keyService=e,this.billingAccountProfileStateService=t,this.stateProvider=i,this.accountService=n,this.i18nService=r,this.admin=!1,this.subscribeToHasPremiumCheck(),this.subscribeToOrgKey()}subscribeToHasPremiumCheck(){this.accountService.activeAccount$.pipe((0,go.n)(e=>this.billingAccountProfileStateService.hasPremiumFromAnySource$(e.id)),(0,xl.pQ)()).subscribe(e=>{this.canAccessPremium=e})}subscribeToOrgKey(){this.stateProvider.activeUserId$.pipe((0,go.n)(e=>null!=e?this.keyService.orgKeys$(e):yo.t),(0,xl.pQ)()).subscribe(e=>{e&&(this.orgKey=e[this.cipher.organizationId])})}getAttachmentFileName(e){var t;return e.hasDecryptionError?this.i18nService.t("errorCannotDecrypt"):null!==(t=e.fileName)&&void 0!==t?t:""}}UO.ɵfac=function(e){return new(e||UO)(Fl.rXU(Bp),Fl.rXU(T$),Fl.rXU(u),Fl.rXU(Zk),Fl.rXU(Ul))},UO.ɵcmp=Fl.VBU({type:UO,selectors:[["app-attachments-v2-view"]],inputs:{cipher:"cipher",emergencyAccessId:"emergencyAccessId",admin:"admin"},decls:7,vars:4,consts:[[1,"tw-mb-5","bit-compact:tw-mb-4"],["bitTypography","h6"],[4,"ngFor","ngForOf"],["data-testid","file-name",3,"title"],["slot","secondary","data-testid","file-size"],["slot","end"],[1,"tw-pr-4","[@media(min-width:650px)]:tw-pr-6"],[3,"admin","cipher","attachment","checkPwReprompt","emergencyAccessId"]],template:function(e,t){1&e&&(Fl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"bit-item-group"),Fl.DNE(6,OO,8,8,"bit-item",2),Fl.k0s()()),2&e&&(Fl.R7$(3),Fl.JRh(Fl.bMT(4,2,"attachments")),Fl.R7$(3),Fl.Y8G("ngForOf",t.cipher.attachments))},dependencies:[kl.MD,kl.Sq,sf,VP,GP,KP,BP,XP,Ql,Nx,tc,rc,EO,rf],encapsulation:2});var MO=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function NO(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"bit-form-field",3)(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.nrm(5,"input",4),Fl.j41(6,"button",5),Fl.nI1(7,"i18n"),Fl.bIt("click",function(){const t=a.eBV(e).$implicit,i=Fl.XpG();return a.Njj(i.openWebsite(t.launchUri))}),Fl.k0s(),Fl.nrm(8,"button",6),Fl.nI1(9,"i18n"),Fl.nI1(10,"i18n"),Fl.k0s(),Fl.bVm()}if(2&e){const e=t.$implicit,i=t.last;Fl.R7$(),Fl.Y8G("disableMargin",i)("disableReadOnlyBorder",i),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(4,8,"website")," "),Fl.R7$(2),Fl.Y8G("value",e.hostOrUri),Fl.R7$(),Fl.Y8G("label",Fl.bMT(7,10,"launch")+" "+e.hostOrUri),Fl.R7$(2),Fl.Y8G("appCopyClick",e.uri)("valueLabel",Fl.bMT(9,12,"website"))("label",Fl.bMT(10,14,"copyWebsite"))}}class VO{constructor(e,t,i){this.platformUtilsService=e,this.cipherService=t,this.accountService=i}openWebsite(e){return MO(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));yield this.cipherService.updateLastLaunchedDate(this.cipherId,t),this.platformUtilsService.launchUri(e)})}}VO.ɵfac=function(e){return new(e||VO)(Fl.rXU(Hb),Fl.rXU(_b),Fl.rXU(Zk))},VO.ɵcmp=Fl.VBU({type:VO,selectors:[["app-autofill-options-view"]],inputs:{loginUris:"loginUris",cipherId:"cipherId"},decls:7,vars:4,consts:[[1,"tw-mb-5","bit-compact:tw-mb-4"],["bitTypography","h6"],[4,"ngFor","ngForOf"],["data-testid","autofill-view-list",3,"disableMargin","disableReadOnlyBorder"],["readonly","","bitInput","","type","text","aria-readonly","true","data-testid","login-website",3,"value"],["bitIconButton","bwi-external-link","bitSuffix","","type","button","data-testid","launch-website",3,"click","label"],["bitIconButton","bwi-clone","bitSuffix","","type","button","showToast","","data-testid","copy-website",3,"appCopyClick","valueLabel","label"]],template:function(e,t){1&e&&(Fl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"bit-card"),Fl.DNE(6,NO,11,16,"ng-container",2),Fl.k0s()()),2&e&&(Fl.R7$(3),Fl.JRh(Fl.bMT(4,2,"autofillOptions")),Fl.R7$(3),Fl.Y8G("ngForOf",t.loginUris))},dependencies:[kl.MD,kl.Sq,sf,rO,Ex,Nx,tc,rc,Gu,Ac,fu,ju,nw,Ql,Zl,rf],encapsulation:2});class BO{ngAfterViewInit(){var e;(null===(e=this.formFields)||void 0===e?void 0:e.last)&&setTimeout(()=>{this.formFields&&(this.formFields.last.disableReadOnlyBorder=!0)})}}BO.ɵfac=function(e){return new(e||BO)},BO.ɵcmp=Fl.VBU({type:BO,selectors:[["read-only-cipher-card"]],contentQueries:function(e,t,i){if(1&e&&Fl.wni(i,ju,4),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.formFields=e)}},ngContentSelectors:["*"],decls:2,vars:0,consts:[[1,"[&_bit-form-field:last-of-type]:tw-mb-0"]],template:function(e,t){1&e&&(Fl.NAR(),Fl.j41(0,"bit-card",0),Fl.SdG(1),Fl.k0s())},dependencies:[Ex],encapsulation:2});var jO=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function GO(e,t){if(1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label",3),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",4),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("appTextDrag",e.card.cardholderName),Fl.R7$(),Fl.JRh(Fl.bMT(3,3,"cardholderName")),Fl.R7$(2),Fl.Y8G("value",e.card.cardholderName)}}function LO(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-form-field")(1,"bit-label",3),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",5),Fl.nI1(5,"creditCardNumber"),Fl.j41(6,"button",6),Fl.bIt("toggledChange",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.logCardEvent(t,i.EventType.Cipher_ClientToggledCardNumberVisible))}),Fl.k0s(),Fl.nrm(7,"button",7),Fl.nI1(8,"i18n"),Fl.nI1(9,"i18n"),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("appTextDrag",e.card.number),Fl.R7$(),Fl.JRh(Fl.bMT(3,7,"number")),Fl.R7$(2),Fl.Y8G("value",Fl.i5U(5,9,e.card.number,e.cipher.card.brand)),Fl.R7$(2),Fl.Y8G("toggled",e.revealCardNumber),Fl.R7$(),Fl.Y8G("appCopyClick",e.card.number)("valueLabel",Fl.bMT(8,12,"number"))("label",Fl.bMT(9,14,"copyNumber"))}}function zO(e,t){if(1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label",3),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",8),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("appTextDrag",e.card.expiration),Fl.R7$(),Fl.JRh(Fl.bMT(3,3,"expiration")),Fl.R7$(2),Fl.Y8G("value",e.card.expiration)}}function _O(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-form-field")(1,"bit-label",3),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",9),Fl.j41(5,"button",10),Fl.bIt("toggledChange",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.logCardEvent(t,i.EventType.Cipher_ClientToggledCardCodeVisible))}),Fl.k0s(),Fl.j41(6,"button",11),Fl.nI1(7,"i18n"),Fl.nI1(8,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.logCardEvent(!0,t.EventType.Cipher_ClientCopiedCardCode))}),Fl.k0s()()}if(2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("appTextDrag",e.card.code),Fl.R7$(),Fl.JRh(Fl.bMT(3,7,"securityCode")),Fl.R7$(2),Fl.Y8G("value",e.card.code),Fl.R7$(),Fl.Y8G("toggled",e.revealCardCode),Fl.R7$(),Fl.Y8G("appCopyClick",e.card.code)("valueLabel",Fl.bMT(7,9,"securityCode"))("label",Fl.bMT(8,11,"copySecurityCode"))}}class KO{constructor(e,t){this.i18nService=e,this.eventCollectionService=t,this.EventType=Ua,this.revealCardNumber=!1,this.revealCardCode=!1}get card(){return this.cipher.card}ngOnChanges(e){e.cipher&&(this.revealCardNumber=!1,this.revealCardCode=!1)}get setSectionTitle(){return this.card.brand&&"Other"!==this.card.brand?this.i18nService.t("cardBrandDetails",this.card.brand):this.i18nService.t("cardDetails")}logCardEvent(e,t){return jO(this,void 0,void 0,function*(){t===Ua.Cipher_ClientToggledCardNumberVisible?this.revealCardNumber=e:t===Ua.Cipher_ClientToggledCardCodeVisible&&(this.revealCardCode=e),e&&(yield this.eventCollectionService.collect(t,this.cipher.id,!1,this.cipher.organizationId))})}}KO.ɵfac=function(e){return new(e||KO)(Fl.rXU(Ul),Fl.rXU(I$))},KO.ɵcmp=Fl.VBU({type:KO,selectors:[["app-card-details-view"]],inputs:{cipher:"cipher"},features:[Fl.OA$],decls:9,vars:5,consts:[[1,"tw-mb-5","bit-compact:tw-mb-4"],["bitTypography","h6"],[4,"ngIf"],[3,"appTextDrag"],["id","cardholderName","readonly","","bitInput","","type","text","aria-readonly","true","data-testid","cardholder-name",3,"value"],["id","cardNumber","readonly","","bitInput","","type","password","aria-readonly","true","data-testid","cardholder-number",1,"tw-font-mono",3,"value"],["bitSuffix","","type","button","bitIconButton","","bitPasswordInputToggle","","data-testid","toggle-number",3,"toggledChange","toggled"],["bitIconButton","bwi-clone","bitSuffix","","type","button","showToast","","data-testid","copy-number",3,"appCopyClick","valueLabel","label"],["id","expiration","readonly","","bitInput","","type","text","aria-readonly","true","data-testid","cardholder-expiration",3,"value"],["id","securityCode","readonly","","bitInput","","type","password","aria-readonly","true","data-testid","cardholder-code",1,"tw-font-mono",3,"value"],["bitSuffix","","type","button","bitIconButton","","bitPasswordInputToggle","","data-testid","toggle-code",3,"toggledChange","toggled"],["bitIconButton","bwi-clone","bitSuffix","","type","button","showToast","","data-testid","copy-code",3,"click","appCopyClick","valueLabel","label"]],template:function(e,t){1&e&&(Fl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),Fl.EFF(3),Fl.k0s()(),Fl.j41(4,"read-only-cipher-card"),Fl.DNE(5,GO,5,5,"bit-form-field",2)(6,LO,10,16,"bit-form-field",2)(7,zO,5,5,"bit-form-field",2)(8,_O,9,13,"bit-form-field",2),Fl.k0s()()),2&e&&(Fl.R7$(3),Fl.JRh(t.setSectionTitle),Fl.R7$(2),Fl.Y8G("ngIf",t.card.cardholderName),Fl.R7$(),Fl.Y8G("ngIf",t.card.number),Fl.R7$(),Fl.Y8G("ngIf",t.card.expiration),Fl.R7$(),Fl.Y8G("ngIf",t.card.code))},dependencies:[kl.MD,kl.bT,sf,rO,sO,Nx,tc,rc,Gu,Ac,fu,ju,iw,nw,Ql,Zl,BO,Zh,rf],encapsulation:2});class XO{}XO.ɵfac=function(e){return new(e||XO)},XO.ɵmod=Fl.$C({type:XO}),XO.ɵinj=a.G2t({});var qO=i(40287),WO=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class YO{constructor(e,t){this.autosize=e,this.ngZone=t,this.autosize.enabled=!1}ngAfterViewInit(){return WO(this,void 0,void 0,function*(){yield(0,bo._)(this.ngZone.onStable),this.autosize.enabled=!0})}}function HO(e,t){if(1&e&&(Fl.rj2(0,"span",2),Fl.EFF(1),Fl.eux()),2&e){const e=Fl.XpG().$index;Fl.R7$(),Fl.JRh(e+1)}}function JO(e,t){if(1&e&&(Fl.rj2(0,"span",1)(1,"span"),Fl.EFF(2),Fl.eux(),Fl.nVh(3,HO,2,1,"span",2),Fl.eux()),2&e){const e=t.$implicit,i=Fl.XpG();Fl.HbH(i.getCharacterClass(e)),Fl.R7$(2),Fl.JRh(e),Fl.R7$(),Fl.vxM(i.showCount()?3:-1)}}YO.ɵfac=function(e){return new(e||YO)(Fl.rXU(qO.xb,1),Fl.rXU(Fl.SKi))},YO.ɵdir=Fl.FsC({type:YO,selectors:[["textarea","vaultAutosizeReadOnlyTextArea",""]],features:[Fl.Jv_([qO.EE]),Fl.nM4([qO.xb])]});class ZO{constructor(){this.password=(0,o.hFB)(""),this.showCount=(0,o.hFB)(!1),this.passwordCharArray=(0,Rl.EW)(()=>{var e;return Array.from(null!==(e=this.password())&&void 0!==e?e:"")}),this.platformUtilsService=(0,a.WQX)(Hb),this.elementRef=(0,a.WQX)(Fl.aKT),this.characterStyles={emoji:[],letter:["tw-text-main"],special:["tw-text-danger"],number:["tw-text-primary-600"]}}get classList(){return["tw-min-w-0","tw-whitespace-pre-wrap","tw-break-words"]}getCharacterClass(e){const t=this.getCharacterType(e),i=this.characterStyles[t];return this.showCount()?i.concat(["tw-inline-flex","tw-flex-col","tw-items-center","tw-w-7","tw-py-1","odd:tw-bg-secondary-100","even:tw-bg-background"]):i}getCharacterType(e){if(e.match(bd.regexpEmojiPresentation))return"emoji";if(e.match(/\d/))return"number";return["&","<",">"," "].includes(e)||e.match(/[^\w ]/)?"special":"letter"}onCopy(e){e.preventDefault();const t=window.getSelection();if(!t||0===t.rangeCount)return;const i=this.elementRef.nativeElement.querySelectorAll("span[data-password-character]");let n="";i.forEach((e,i)=>{t.containsNode(e,!0)&&(n+=this.passwordCharArray()[i])}),n&&this.platformUtilsService.copyToClipboard(n)}}ZO.ɵfac=function(e){return new(e||ZO)},ZO.ɵcmp=Fl.VBU({type:ZO,selectors:[["bit-color-password"]],hostVars:2,hostBindings:function(e,t){1&e&&Fl.bIt("copy",function(e){return t.onCopy(e)}),2&e&&Fl.HbH(t.classList)},inputs:{password:[1,"password"],showCount:[1,"showCount"]},decls:2,vars:0,consts:[["data-password-character","",1,"tw-font-mono",3,"class"],["data-password-character","",1,"tw-font-mono"],[1,"tw-whitespace-nowrap","tw-text-xs","tw-leading-5","tw-text-main"]],template:function(e,t){1&e&&Fl.Z7z(0,JO,4,4,"span",0,Fl.Vm6),2&e&&Fl.Dyx(t.passwordCharArray())},encapsulation:2});var QO=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const eU=e=>({"tw-mb-4":e}),tU=()=>({"tw-mt-3":!0,"tw-mb-2":!0});function iU(e,t){if(1&e&&(Fl.j41(0,"bit-form-field",7)(1,"bit-label",8),Fl.EFF(2),Fl.k0s(),Fl.nrm(3,"textarea",9)(4,"button",10),Fl.nI1(5,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(),t=e.$implicit,i=e.last;Fl.Y8G("disableReadOnlyBorder",i),Fl.R7$(),Fl.Y8G("appTextDrag",t.value),Fl.R7$(),Fl.JRh(t.name),Fl.R7$(),Fl.Y8G("value",t.value),Fl.R7$(),Fl.Y8G("appCopyClick",t.value)("valueLabel",t.name)("label",Fl.i5U(5,7,"copyCustomField",t.name))}}function nU(e,t){if(1&e&&Fl.nrm(0,"input",16),2&e){const e=Fl.XpG(2).$implicit;Fl.Y8G("value",e.value)}}function rU(e,t){if(1&e&&Fl.nrm(0,"textarea",17),2&e){const e=Fl.XpG(2).$implicit;Fl.Y8G("value",e.value)}}function sU(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",18),Fl.nI1(1,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2).index,i=Fl.XpG();return a.Njj(i.toggleCharacterCount(t))}),Fl.k0s()}if(2&e){const e=Fl.XpG(2).index,t=Fl.XpG();Fl.Y8G("label",Fl.bMT(1,2,t.showHiddenValueCountFields.includes(e)?"hideCharacterCount":"showCharacterCount")),Fl.BMQ("aria-expanded",t.showHiddenValueCountFields.includes(e))}}function oU(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",19),Fl.bIt("toggledChange",function(t){a.eBV(e);const i=Fl.XpG(2).index,n=Fl.XpG();return a.Njj(n.toggleHiddenField(t,i))}),Fl.k0s()}}function aU(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",20),Fl.nI1(1,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(3);return a.Njj(t.logCopyEvent())}),Fl.k0s()}if(2&e){const e=Fl.XpG(2).$implicit;Fl.Y8G("appCopyClick",e.value)("valueLabel",e.name)("label",Fl.i5U(1,3,"copyCustomField",e.name))}}function lU(e,t){if(1&e&&(Fl.j41(0,"bit-form-field",7)(1,"bit-label",8),Fl.EFF(2),Fl.k0s(),Fl.DNE(3,nU,1,1,"input",11)(4,rU,1,1,"textarea",12)(5,sU,2,4,"button",13)(6,oU,1,0,"button",14)(7,aU,2,6,"button",15),Fl.k0s()),2&e){const e=Fl.XpG(),t=e.$implicit,i=e.last,n=e.index,r=Fl.XpG();Fl.Y8G("disableReadOnlyBorder",i),Fl.R7$(),Fl.Y8G("appTextDrag",t.value),Fl.R7$(),Fl.JRh(t.name),Fl.R7$(),Fl.Y8G("ngIf",!r.revealedHiddenFields.includes(n)),Fl.R7$(),Fl.Y8G("ngIf",r.revealedHiddenFields.includes(n)),Fl.R7$(),Fl.Y8G("ngIf",r.canViewPassword&&r.revealedHiddenFields.includes(n)),Fl.R7$(),Fl.Y8G("ngIf",r.canViewPassword),Fl.R7$(),Fl.Y8G("ngIf",r.canViewPassword)}}function cU(e,t){if(1&e&&(Fl.j41(0,"div",21),Fl.nrm(1,"bit-color-password",22),Fl.k0s()),2&e){const e=Fl.XpG().$implicit;Fl.Y8G("ngClass",Fl.lJ4(3,tU)),Fl.R7$(),Fl.Y8G("password",e.value)("showCount",!0)}}function uU(e,t){if(1&e&&(Fl.j41(0,"bit-form-control"),Fl.nrm(1,"input",23),Fl.j41(2,"bit-label",8),Fl.EFF(3),Fl.k0s()()),2&e){const e=Fl.XpG().$implicit;Fl.R7$(),Fl.Y8G("checked","true"===e.value),Fl.R7$(),Fl.Y8G("appTextDrag",e.value),Fl.R7$(),Fl.SpI(" ",e.name," ")}}function dU(e,t){if(1&e&&(Fl.j41(0,"bit-form-field",7)(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",24),Fl.k0s()),2&e){const e=Fl.XpG(),t=e.$implicit,i=e.last,n=Fl.XpG();Fl.Y8G("disableReadOnlyBorder",i),Fl.R7$(2),Fl.Lme(" ",Fl.bMT(3,4,"cfTypeLinked"),": ",t.name," "),Fl.R7$(2),Fl.Y8G("value",n.getLinkedType(t.linkedId))}}function hU(e,t){if(1&e&&(Fl.j41(0,"div",3),Fl.DNE(1,iU,6,10,"bit-form-field",4)(2,lU,8,8,"bit-form-field",4)(3,cU,2,4,"div",5)(4,uU,4,3,"bit-form-control",6)(5,dU,5,6,"bit-form-field",4),Fl.k0s()),2&e){const e=t.$implicit,i=t.last,n=t.index,r=Fl.XpG();Fl.Y8G("ngClass",Fl.eq3(6,eU,!i)),Fl.R7$(),Fl.Y8G("ngIf",e.type===r.fieldType.Text),Fl.R7$(),Fl.Y8G("ngIf",e.type===r.fieldType.Hidden),Fl.R7$(),Fl.Y8G("ngIf",r.showHiddenValueCountFields.includes(n)&&r.revealedHiddenFields.includes(n)),Fl.R7$(),Fl.Y8G("ngIf",e.type===r.fieldType.Boolean),Fl.R7$(),Fl.Y8G("ngIf",e.type===r.fieldType.Linked)}}class pU{constructor(e,t){this.i18nService=e,this.eventCollectionService=t,this.fieldType=ox,this.revealedHiddenFields=[],this.showHiddenValueCountFields=[]}ngOnInit(){this.fieldOptions=this.getLinkedFieldsOptionsForCipher()}ngOnChanges(e){e.cipher&&(this.revealedHiddenFields=[],this.fieldOptions=this.getLinkedFieldsOptionsForCipher())}getLinkedType(e){var t;const i=null===(t=this.fieldOptions)||void 0===t?void 0:t.get(e);return i?this.i18nService.t(i.i18nKey):null}get canViewPassword(){return this.cipher.viewPassword}toggleCharacterCount(e){const t=this.showHiddenValueCountFields.indexOf(e);t>-1?this.showHiddenValueCountFields.splice(t,1):this.showHiddenValueCountFields.push(e)}toggleHiddenField(e,t){return QO(this,void 0,void 0,function*(){e?this.revealedHiddenFields.push(t):this.revealedHiddenFields=this.revealedHiddenFields.filter(e=>e!==t),e&&(yield this.eventCollectionService.collect(Ua.Cipher_ClientToggledHiddenFieldVisible,this.cipher.id,!1,this.cipher.organizationId))})}logCopyEvent(){return QO(this,void 0,void 0,function*(){yield this.eventCollectionService.collect(Ua.Cipher_ClientCopiedHiddenField,this.cipher.id,!1,this.cipher.organizationId)})}getLinkedFieldsOptionsForCipher(){switch(this.cipher.type){case nx.Login:return CO.prototype.linkedFieldOptions;case nx.Card:return mO.prototype.linkedFieldOptions;case nx.Identity:return wO.prototype.linkedFieldOptions;default:return}}}var vU,fU,mU,gU,yU,bU;pU.ɵfac=function(e){return new(e||pU)(Fl.rXU(Ul),Fl.rXU(I$))},pU.ɵcmp=Fl.VBU({type:pU,selectors:[["app-custom-fields-v2"]],inputs:{cipher:"cipher"},features:[Fl.OA$],decls:7,vars:4,consts:[[1,"tw-mb-5","bit-compact:tw-mb-4"],["bitTypography","h6"],["class","tw-border-secondary-300 [&_bit-form-field:last-of-type]:tw-mb-0","data-testid","custom-field",3,"ngClass",4,"ngFor","ngForOf"],["data-testid","custom-field",1,"tw-border-secondary-300","[&_bit-form-field:last-of-type]:tw-mb-0",3,"ngClass"],[3,"disableReadOnlyBorder",4,"ngIf"],[3,"ngClass",4,"ngIf"],[4,"ngIf"],[3,"disableReadOnlyBorder"],[3,"appTextDrag"],["readonly","","bitInput","","aria-readonly","true","vaultAutosizeReadOnlyTextArea","",3,"value"],["bitIconButton","bwi-clone","bitSuffix","","type","button","showToast","","data-testid","copy-custom-field",3,"appCopyClick","valueLabel","label"],["readonly","","bitInput","","type","password","aria-readonly","true","class","tw-font-mono",3,"value",4,"ngIf"],["readonly","","bitInput","","type","password","aria-readonly","true","class","tw-font-mono","vaultAutosizeReadOnlyTextArea","",3,"value",4,"ngIf"],["bitIconButton","bwi-numbered-list","bitSuffix","","type","button","data-testid","toggle-hidden-field-value-count","appStopClick","",3,"label","click",4,"ngIf"],["bitSuffix","","type","button","bitIconButton","","bitPasswordInputToggle","",3,"toggledChange",4,"ngIf"],["bitIconButton","bwi-clone","bitSuffix","","type","button","showToast","",3,"appCopyClick","valueLabel","label","click",4,"ngIf"],["readonly","","bitInput","","type","password","aria-readonly","true",1,"tw-font-mono",3,"value"],["readonly","","bitInput","","type","password","aria-readonly","true","vaultAutosizeReadOnlyTextArea","",1,"tw-font-mono",3,"value"],["bitIconButton","bwi-numbered-list","bitSuffix","","type","button","data-testid","toggle-hidden-field-value-count","appStopClick","",3,"click","label"],["bitSuffix","","type","button","bitIconButton","","bitPasswordInputToggle","",3,"toggledChange"],["bitIconButton","bwi-clone","bitSuffix","","type","button","showToast","",3,"click","appCopyClick","valueLabel","label"],[3,"ngClass"],[3,"password","showCount"],["bitCheckbox","","type","checkbox","aria-readonly","true","disabled","",3,"checked"],["readonly","","bitInput","","type","text","aria-readonly","true",3,"value"]],template:function(e,t){1&e&&(Fl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"bit-card"),Fl.DNE(6,hU,6,8,"div",2),Fl.k0s()()),2&e&&(Fl.R7$(3),Fl.JRh(Fl.bMT(4,2,"customFields")),Fl.R7$(3),Fl.Y8G("ngForOf",t.cipher.fields))},dependencies:[kl.MD,kl.YU,kl.Sq,kl.bT,sf,IP,rO,sO,Ex,Ql,Zl,Gu,Sc,Ac,fu,ju,iw,nw,qc,Nx,tc,rc,hd,Qb,XO,ZO,YO,rf],encapsulation:2}),function(e){e[e.None=0]="None",e[e.OpenIdConnect=1]="OpenIdConnect",e[e.Saml2=2]="Saml2"}(vU||(vU={})),function(e){e[e.MasterPassword=0]="MasterPassword",e[e.KeyConnector=1]="KeyConnector",e[e.TrustedDeviceEncryption=2]="TrustedDeviceEncryption"}(fU||(fU={})),function(e){e[e.RedirectGet=0]="RedirectGet",e[e.FormPost=1]="FormPost"}(mU||(mU={})),function(e){e[e.HttpRedirect=1]="HttpRedirect",e[e.HttpPost=2]="HttpPost"}(gU||(gU={})),function(e){e[e.NotConfigured=0]="NotConfigured",e[e.Unspecified=1]="Unspecified",e[e.EmailAddress=2]="EmailAddress",e[e.X509SubjectName=3]="X509SubjectName",e[e.WindowsDomainQualifiedName=4]="WindowsDomainQualifiedName",e[e.KerberosPrincipalName=5]="KerberosPrincipalName",e[e.EntityIdentifier=6]="EntityIdentifier",e[e.Persistent=7]="Persistent",e[e.Transient=8]="Transient"}(yU||(yU={})),function(e){e[e.IfIdpWantAuthnRequestsSigned=0]="IfIdpWantAuthnRequestsSigned",e[e.Always=1]="Always",e[e.Never=3]="Never"}(bU||(bU={}));class wU{constructor(e){var t;null!=e&&(this.id=e.id,this.name=e.name,this.status=e.status,this.type=e.type,this.enabled=e.enabled,this.usePolicies=e.usePolicies,this.useGroups=e.useGroups,this.useDirectory=e.useDirectory,this.useEvents=e.useEvents,this.useTotp=e.useTotp,this.use2fa=e.use2fa,this.useApi=e.useApi,this.useSso=e.useSso,this.useOrganizationDomains=e.useOrganizationDomains,this.useKeyConnector=e.useKeyConnector,this.useScim=e.useScim,this.useCustomPermissions=e.useCustomPermissions,this.useResetPassword=e.useResetPassword,this.useSecretsManager=e.useSecretsManager,this.usePasswordManager=e.usePasswordManager,this.useActivateAutofillPolicy=e.useActivateAutofillPolicy,this.useAutomaticUserConfirmation=e.useAutomaticUserConfirmation,this.selfHost=e.selfHost,this.usersGetPremium=e.usersGetPremium,this.seats=e.seats,this.maxCollections=e.maxCollections,this.maxStorageGb=e.maxStorageGb,this.ssoBound=e.ssoBound,this.identifier=e.identifier,this.permissions=e.permissions,this.resetPasswordEnrolled=e.resetPasswordEnrolled,this.userId=e.userId,this.organizationUserId=e.organizationUserId,this.hasPublicAndPrivateKeys=e.hasPublicAndPrivateKeys,this.providerId=e.providerId,this.providerName=e.providerName,this.providerType=e.providerType,this.isProviderUser=e.isProviderUser,this.isMember=e.isMember,this.familySponsorshipFriendlyName=e.familySponsorshipFriendlyName,this.familySponsorshipAvailable=e.familySponsorshipAvailable,this.productTierType=e.productTierType,this.keyConnectorEnabled=e.keyConnectorEnabled,this.keyConnectorUrl=e.keyConnectorUrl,this.familySponsorshipLastSyncDate=e.familySponsorshipLastSyncDate,this.familySponsorshipValidUntil=e.familySponsorshipValidUntil,this.familySponsorshipToDelete=e.familySponsorshipToDelete,this.accessSecretsManager=e.accessSecretsManager,this.limitCollectionCreation=e.limitCollectionCreation,this.limitCollectionDeletion=e.limitCollectionDeletion,this.limitItemDeletion=e.limitItemDeletion,this.allowAdminAccessToAllCollectionItems=e.allowAdminAccessToAllCollectionItems,this.userIsManagedByOrganization=e.userIsManagedByOrganization,this.useAccessIntelligence=e.useAccessIntelligence,this.useAdminSponsoredFamilies=e.useAdminSponsoredFamilies,this.useDisableSMAdsForUsers=null!==(t=e.useDisableSMAdsForUsers)&&void 0!==t&&t,this.isAdminInitiated=e.isAdminInitiated,this.ssoEnabled=e.ssoEnabled,this.ssoMemberDecryptionType=e.ssoMemberDecryptionType,this.usePhishingBlocker=e.usePhishingBlocker)}get canAccess(){return!!this.isOwner||this.enabled&&this.status===rp.Confirmed}get isAdmin(){return this.type===sp.Admin||this.isOwner}get isOwner(){return this.type===sp.Owner||this.isProviderUser}get canAccessEventLogs(){return(this.isAdmin||this.permissions.accessEventLogs)&&this.useEvents}get canAccessImport(){return this.isProviderUser||this.type===sp.Owner||this.type===sp.Admin||this.permissions.accessImportExport}get canAccessExport(){return this.isMember&&(this.type===sp.Owner||this.type===sp.Admin||this.permissions.accessImportExport)}get canAccessReports(){return this.isAdmin||this.permissions.accessReports}get canCreateNewCollections(){return!this.limitCollectionCreation||this.isAdmin||this.permissions.createNewCollections}get canEditAnyCollection(){return this.isProviderUser||this.type===sp.Custom&&this.permissions.editAnyCollection||this.allowAdminAccessToAllCollectionItems&&this.isAdmin}get canEditUnmanagedCollections(){return this.isAdmin||this.permissions.editAnyCollection}get canEditUnassignedCiphers(){return this.type===sp.Admin||this.type===sp.Owner||this.permissions.editAnyCollection}get canEditAllCiphers(){return this.type===sp.Custom&&this.permissions.editAnyCollection||this.allowAdminAccessToAllCollectionItems&&(this.type===sp.Admin||this.type===sp.Owner)}get canDeleteAnyCollection(){return!(!this.isProviderUser&&!this.permissions.deleteAnyCollection)||!!this.allowAdminAccessToAllCollectionItems&&(this.type==sp.Owner||this.type==sp.Admin)}get canViewAllCollections(){return this.isAdmin||this.permissions.editAnyCollection||this.permissions.deleteAnyCollection}get canManageGroups(){return(this.isAdmin||this.permissions.manageGroups)&&this.useGroups}get canManageSso(){return(this.isAdmin||this.permissions.manageSso)&&this.useSso}get canManageDomainVerification(){return(this.isAdmin||this.permissions.manageSso)&&this.useOrganizationDomains}get canManageScim(){return(this.isAdmin||this.permissions.manageScim)&&this.useScim}get canManagePolicies(){return(this.isAdmin||this.permissions.managePolicies)&&this.usePolicies}get canManageUsers(){return this.isAdmin||this.permissions.manageUsers}get canManageUsersPassword(){return this.isAdmin||this.permissions.manageResetPassword}get canEnableAutoConfirmPolicy(){return(this.canManageUsers||this.canManagePolicies)&&this.useAutomaticUserConfirmation&&!this.isProviderUser}get canManageDeviceApprovals(){return(this.isAdmin||this.permissions.manageResetPassword)&&this.useSso&&this.ssoEnabled&&this.ssoMemberDecryptionType===fU.TrustedDeviceEncryption}get isExemptFromPolicies(){return this.canManagePolicies}get canViewSubscription(){return!!this.canEditSubscription||(this.hasBillableProvider?this.isProviderUser:this.isOwner)}get canEditSubscription(){return this.hasProvider?this.isProviderUser:this.isOwner}get canEditPaymentMethods(){return this.canEditSubscription}get canViewBillingHistory(){return this.canEditSubscription}get hasProvider(){return null!=this.providerId||null!=this.providerName}get hasBillableProvider(){return this.hasProvider&&(this.providerType===ap.Msp||this.providerType===ap.BusinessUnit)}get hasReseller(){return this.hasProvider&&this.providerType===ap.Reseller}get canAccessSecretsManager(){return this.useSecretsManager&&this.accessSecretsManager}get isFreeOrg(){return!this.useTotp}get canManageSponsorships(){return this.familySponsorshipAvailable||null!==this.familySponsorshipFriendlyName}get canManageAutoConfirm(){return this.isMember&&this.canManageUsers&&this.useAutomaticUserConfirmation}static fromJSON(e){return null==e?null:Object.assign(new wU,e,{familySponsorshipLastSyncDate:new Date(e.familySponsorshipLastSyncDate),familySponsorshipValidUntil:new Date(e.familySponsorshipValidUntil)})}get canAccessIntegrations(){return(this.productTierType===M$.Teams||this.productTierType===M$.Enterprise)&&(this.isAdmin||this.permissions.manageUsers||this.permissions.manageGroups||this.permissions.accessEventLogs)}get canUseAccessIntelligence(){return this.productTierType===M$.Enterprise}}class SU{constructor(e){this.id="",this.name="",e?(this.id=e.id,this.revisionDate=e.revisionDate):this.revisionDate=new Date}static fromJSON(e){var t,i;const n=new SU;return n.id=null!==(t=e.id)&&void 0!==t?t:"",n.name=null!==(i=e.name)&&void 0!==i?i:"",null!=e.revisionDate&&(n.revisionDate=new Date(e.revisionDate)),n}}const kU=(e,t)=>({"tw-invisible tw-absolute":e,"tw-size-6":t}),IU=(e,t)=>({"tw-flex tw-items-center tw-justify-center":e,"tw-bg-illustration-bg-primary tw-rounded-full":t}),CU=(e,t,i,n)=>({color:e,width:t,height:i,fontSize:n});function TU(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"img",4),Fl.bIt("load",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.imageLoaded.set(!0))})("error",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.imageLoaded.set(!1))}),Fl.k0s()}if(2&e){const e=Fl.XpG().ngIf,t=Fl.XpG();Fl.Y8G("src",e.image,Fl.B4B)("ngClass",Fl.l_i(3,kU,!t.imageLoaded(),!t.coloredIcon()))("ngStyle",t.iconStyle())}}function PU(e,t){if(1&e&&(Fl.j41(0,"div",3),Fl.nrm(1,"i",5),Fl.k0s()),2&e){const e=Fl.XpG().ngIf,t=Fl.XpG();Fl.Y8G("ngClass",Fl.l_i(6,IU,t.coloredIcon(),(null==e.icon?null:e.icon.startsWith("bwi-"))&&t.coloredIcon()))("ngStyle",t.iconStyle()),Fl.R7$(),Fl.HbH(Fl.VkB("tw-text-muted bwi bwi-lg ",e.icon)),Fl.Y8G("ngStyle",Fl.ziG(9,CU,t.coloredIcon()?"rgb(var(--color-illustration-outline))":null,null!=e.icon&&e.icon.startsWith("credit-card")&&t.coloredIcon()?"36px":null,null!=e.icon&&e.icon.startsWith("credit-card")&&t.coloredIcon()?"30px":null,t.size()?t.size()+"px":null))}}function FU(e,t){if(1&e&&(Fl.qex(0),Fl.nVh(1,TU,1,6,"img",2),Fl.nVh(2,PU,2,14,"div",3),Fl.bVm()),2&e){const e=t.ngIf,i=Fl.XpG();Fl.R7$(),Fl.vxM(e.imageEnabled&&e.image?1:-1),Fl.R7$(),Fl.vxM(e.imageEnabled&&e.image&&i.imageLoaded()?-1:2)}}class RU{constructor(e,t){this.environmentService=e,this.domainSettingsService=t,this.cipher=o.hFB.required(),this.coloredIcon=(0,o.hFB)(!1),this.size=(0,o.hFB)(),this.imageLoaded=(0,a.vPA)(!1),this.iconStyle=(0,Rl.EW)(()=>{if(this.coloredIcon())return{width:"36px",height:"36px"};const e=this.size();return e?{width:e+"px",height:e+"px"}:{}});const i=(0,jo.z)([this.environmentService.environment$.pipe((0,l.T)(e=>e.getIconsUrl())),this.domainSettingsService.showFavicons$.pipe((0,mo.F)())]).pipe((0,l.T)(([e,t])=>({iconsUrl:e,showFavicon:t})),(0,kd.Z)({iconsUrl:null,showFavicon:!1}),(0,mo.F)());this.data$=(0,jo.z)([i,(0,xl.br)(this.cipher)]).pipe((0,l.T)(([{iconsUrl:e,showFavicon:t},i])=>function(e,t,i){let n="bwi-globe",r=null,s="";const o={Visa:"card-visa",Mastercard:"card-mastercard",Amex:"card-amex",Discover:"card-discover","Diners Club":"card-diners-club",JCB:"card-jcb",Maestro:"card-maestro",UnionPay:"card-union-pay",RuPay:"card-ru-pay"};null==e&&(i=!1);const a=t$.getType(t),l=t$.uri(t),c=t$.getCard(t);switch(a){case nx.Login:if(n="bwi-globe",l){let t=l,n=!1;if(0===t.indexOf("androidapp://")||0===t.indexOf("iosapp://")?r=null:i&&-1===t.indexOf("://")&&t.indexOf(".")>-1?(t=`http://${t}`,n=!0):i&&(n=0===t.indexOf("http")&&t.indexOf(".")>-1),n&&(t.endsWith(".onion")||t.endsWith(".i2p"))){r=null,s="images/bwi-globe.png";break}if(i&&n)try{r=`${e}/${bd.getHostname(t)}/icon.png`,s="images/bwi-globe.png"}catch(e){}}else r=null;break;case nx.SecureNote:n="bwi-sticky-note";break;case nx.Card:n="bwi-credit-card",i&&(null==c?void 0:c.brand)&&c.brand in o&&(n=`credit-card-icon ${o[c.brand]}`);break;case nx.Identity:n="bwi-id-card";break;case nx.SshKey:n="bwi-key"}return{imageEnabled:i,image:r,fallbackImage:s,icon:n}}(e,i,t)),(0,kd.Z)(null),(0,mm.J)(),(0,Oo.M)(([e,t])=>{(null==e?void 0:e.image)!==(null==t?void 0:t.image)&&this.imageLoaded.set(!1)}),(0,l.T)(([e,t])=>t))}}RU.ɵfac=function(e){return new(e||RU)(Fl.rXU(mk),Fl.rXU(YE))},RU.ɵcmp=Fl.VBU({type:RU,selectors:[["app-vault-icon"]],inputs:{cipher:[1,"cipher"],coloredIcon:[1,"coloredIcon"],size:[1,"size"]},standalone:!1,decls:3,vars:4,consts:[["aria-hidden","true",1,"tw-flex","tw-justify-center","tw-items-center",3,"ngStyle"],[4,"ngIf"],["alt","","decoding","async","loading","lazy",1,"tw-rounded-md",3,"src","ngClass","ngStyle"],[3,"ngClass","ngStyle"],["alt","","decoding","async","loading","lazy",1,"tw-rounded-md",3,"load","error","src","ngClass","ngStyle"],[3,"ngStyle"]],template:function(e,t){1&e&&(Fl.j41(0,"div",0),Fl.DNE(1,FU,3,2,"ng-container",1),Fl.nI1(2,"async"),Fl.k0s()),2&e&&(Fl.Y8G("ngStyle",t.iconStyle()),Fl.R7$(),Fl.Y8G("ngIf",Fl.bMT(2,2,t.data$)))},dependencies:[kl.YU,kl.bT,kl.B3,kl.Jj],encapsulation:2,changeDetection:0});const xU=e=>({"tw-mb-2":e}),AU=(e,t)=>t.id;function DU(e,t){1&e&&(Fl.j41(0,"span",5),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"archived")," "))}function EU(e,t){if(1&e&&(Fl.nrm(0,"i",9),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG(2);Fl.Y8G("tierType",e.organization().productTierType)("size","large")("title",Fl.bMT(1,3,"owner"))}}function $U(e,t){if(1&e&&Fl.nrm(0,"i",10),2&e){const e=Fl.XpG().$implicit,t=Fl.XpG();Fl.Y8G("ngClass",t.getIconClass(e))("title",t.getItemTitle(e))}}function OU(e,t){if(1&e&&(Fl.j41(0,"span",7),Fl.nVh(1,EU,2,5,"i",9)(2,$U,1,2,"i",10),Fl.j41(3,"span",11),Fl.EFF(4),Fl.k0s()()),2&e){const e=t.$implicit,i=t.$index,n=t.$count,r=Fl.XpG();Fl.Y8G("ngClass",Fl.eq3(4,xU,i===n-1&&r.hasSmallScreen())),Fl.BMQ("aria-label",r.getAriaLabel(e)),Fl.R7$(),Fl.vxM(r.isOrgIcon(e)?1:2),Fl.R7$(3),Fl.SpI(" ",e.name," ")}}function UU(e,t){1&e&&(Fl.j41(0,"span",8),Fl.nI1(1,"i18n"),Fl.nrm(2,"i",12),Fl.nI1(3,"i18n"),Fl.j41(4,"span",11),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s()()),2&e&&(Fl.BMQ("aria-label",Fl.bMT(1,3,"noneFolder")),Fl.R7$(2),Fl.Y8G("title",Fl.bMT(3,5,"folder")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(6,7,"noneFolder")," "))}function MU(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",14),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.toggleShowMore())}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"showMore")," "))}function NU(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",14),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.toggleShowMore())}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"showLess")," "))}function VU(e,t){if(1&e&&Fl.DNE(0,MU,3,3,"button",13)(1,NU,3,3,"button",13),2&e){const e=Fl.XpG();Fl.Y8G("ngIf",!e.showAllDetails()),Fl.R7$(),Fl.Y8G("ngIf",e.showAllDetails())}}class BU{constructor(e,t){this.i18nService=e,this.platformUtilsService=t,this.hideOwner=(0,o.hFB)(!1),this.cipher=o.hFB.required(),this.organization=(0,o.hFB)(),this.folder=(0,o.hFB)(),this.collections=(0,o.hFB)(),this.showAllDetails=(0,a.vPA)(!1),this.showOwnership=(0,Rl.EW)(()=>this.cipher().organizationId&&this.organization()&&!this.hideOwner()),this.hasSmallScreen=(0,xl.ot)((0,Rh.R)(window,"resize").pipe((0,l.T)(()=>window.innerWidth),(0,kd.Z)(window.innerWidth),(0,l.T)(e=>e<681))),this.allItems=(0,Rl.EW)(()=>{var e;let t=[];return this.showOwnership()&&this.organization()&&t.push(this.organization()),(null===(e=this.cipher().collectionIds)||void 0===e?void 0:e.length)>0&&this.collections()&&(t=[...t,...this.collections()]),this.cipher().folderId&&this.folder()&&t.push(this.folder()),t}),this.showItems=(0,Rl.EW)(()=>{var e;return this.hasSmallScreen()&&this.allItems().length>2&&!this.showAllDetails()&&(null===(e=this.cipher().collectionIds)||void 0===e?void 0:e.length)>1?this.allItems().slice(0,2):this.allItems()}),this.showArchiveBadge=(0,Rl.EW)(()=>this.cipher().isArchived&&this.platformUtilsService.getClientType()===Da.Desktop)}toggleShowMore(){this.showAllDetails.update(e=>!e)}getAriaLabel(e){return e instanceof wU?this.i18nService.t("owner")+e.name:e instanceof SR?this.i18nService.t("collection")+e.name:e instanceof SU?this.i18nService.t("folder")+e.name:""}getIconClass(e){return e instanceof SR?e.type===yR?"bwi-user":"bwi-collection-shared":e instanceof SU?"bwi-folder":""}getItemTitle(e){return e instanceof SR?this.i18nService.t("collection"):e instanceof SU?this.i18nService.t("folder"):""}isOrgIcon(e){return e instanceof wU}}BU.ɵfac=function(e){return new(e||BU)(Fl.rXU(Ul),Fl.rXU(Hb))},BU.ɵcmp=Fl.VBU({type:BU,selectors:[["app-item-details-v2"]],inputs:{hideOwner:[1,"hideOwner"],cipher:[1,"cipher"],organization:[1,"organization"],folder:[1,"folder"],collections:[1,"collections"]},ngContentSelectors:["*"],decls:15,vars:9,consts:[[1,"tw-mb-5","bit-compact:tw-mb-4"],[1,"tw-flex","tw-place-items-center","tw-w-full",3,"ngClass"],[1,"tw-flex","tw-items-center","tw-justify-center",2,"width","40px","height","40px"],[3,"cipher","coloredIcon"],["bitTypography","h4","data-testid","item-name",1,"tw-ml-2","tw-mt-2","tw-select-auto","tw-flex-1"],["bitBadge",""],[1,"tw-flex","tw-flex-col","tw-mt-2","md:tw-flex-row","md:tw-flex-wrap"],["bitTypography","body2","data-testid","item-details-list",1,"tw-flex","tw-items-center","tw-mt-2","tw-mr-4",3,"ngClass"],["bitTypography","body2",1,"tw-flex","tw-items-center","tw-mt-2","tw-mr-4"],["appOrgIcon","",3,"tierType","size","title"],["aria-hidden","true",1,"bwi","bwi-lg",3,"ngClass","title"],["aria-hidden","true",1,"tw-pl-1.5"],["aria-hidden","true",1,"bwi","bwi-folder","bwi-lg",3,"title"],["bitTypography","body2","type","button","bitLink","","linkType","primary","class","tw-mt-1.5",3,"click",4,"ngIf"],["bitTypography","body2","type","button","bitLink","","linkType","primary",1,"tw-mt-1.5",3,"click"]],template:function(e,t){1&e&&(Fl.NAR(),Fl.j41(0,"section",0)(1,"bit-card")(2,"div",1)(3,"div",2),Fl.nrm(4,"app-vault-icon",3),Fl.k0s(),Fl.j41(5,"h2",4),Fl.EFF(6),Fl.k0s(),Fl.nVh(7,DU,3,3,"span",5),Fl.k0s(),Fl.qex(8),Fl.j41(9,"div",6),Fl.Z7z(10,OU,5,6,"span",7,AU),Fl.nVh(12,UU,7,9,"span",8),Fl.nVh(13,VU,2,2),Fl.k0s(),Fl.bVm(),Fl.SdG(14),Fl.k0s()()),2&e&&(Fl.R7$(2),Fl.Y8G("ngClass",Fl.eq3(7,xU,t.allItems.length>0)),Fl.R7$(2),Fl.Y8G("cipher",t.cipher())("coloredIcon",!0),Fl.R7$(2),Fl.SpI(" ",t.cipher().name," "),Fl.R7$(),Fl.vxM(t.showArchiveBadge()?7:-1),Fl.R7$(3),Fl.Dyx(t.showItems()),Fl.R7$(2),Fl.vxM(0===t.allItems().length?12:-1),Fl.R7$(),Fl.vxM(t.hasSmallScreen()&&t.allItems().length>2&&t.cipher().collectionIds.length>1?13:-1))},dependencies:[kl.MD,kl.YU,kl.bT,sf,RU,Ex,tc,rc,G$,Gu,uw,eu,Qc,rf],encapsulation:2});class jU{}var GU=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const LU=(e,t)=>({"tw-mb-1 ":e,"tw-mb-0":t}),zU=e=>({"tw-mb-3":e});function _U(e,t){if(1&e&&(Fl.j41(0,"p",4)(1,"span",3),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.EFF(4),Fl.nI1(5,"date"),Fl.k0s()),2&e){const e=Fl.XpG();Fl.Y8G("ngClass",Fl.eq3(8,zU,e.cipher.hasPasswordHistory)),Fl.R7$(2),Fl.SpI("",Fl.bMT(3,3,"datePasswordUpdated"),":"),Fl.R7$(2),Fl.SpI(" ",Fl.i5U(5,5,e.cipher.passwordRevisionDisplayDate,"medium")," ")}}function KU(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",7),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.viewPasswordHistory())}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"passwordHistory")," "))}class XU{constructor(e){this.viewPasswordHistoryService=e}get isLogin(){return this.cipher.type===nx.Login}viewPasswordHistory(){return GU(this,void 0,void 0,function*(){yield this.viewPasswordHistoryService.viewPasswordHistory(this.cipher)})}}XU.ɵfac=function(e){return new(e||XU)(Fl.rXU(jU))},XU.ɵcmp=Fl.VBU({type:XU,selectors:[["app-item-history-v2"]],inputs:{cipher:"cipher"},decls:20,vars:23,consts:[["disableMargin",""],["bitTypography","h6"],[1,"tw-mb-1","tw-text-xs","tw-text-muted","tw-select-all"],[1,"tw-font-medium"],[1,"tw-text-xs","tw-text-muted","tw-select-all",3,"ngClass"],["class","tw-text-xs tw-text-muted tw-select-all",3,"ngClass",4,"ngIf"],["bitTypography","body2","bitLink","","type","button",3,"click",4,"ngIf"],["bitTypography","body2","bitLink","","type","button",3,"click"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-section",0)(1,"bit-section-header")(2,"h2",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"bit-card")(6,"p",2)(7,"span",3),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.EFF(10),Fl.nI1(11,"date"),Fl.k0s(),Fl.j41(12,"p",4)(13,"span",3),Fl.EFF(14),Fl.nI1(15,"i18n"),Fl.k0s(),Fl.EFF(16),Fl.nI1(17,"date"),Fl.k0s(),Fl.DNE(18,_U,6,10,"p",5)(19,KU,3,3,"button",6),Fl.k0s()()),2&e&&(Fl.R7$(3),Fl.JRh(Fl.bMT(4,8,"itemHistory")),Fl.R7$(5),Fl.SpI("",Fl.bMT(9,10,"lastEdited"),":"),Fl.R7$(2),Fl.SpI(" ",Fl.i5U(11,12,t.cipher.revisionDate,"medium")," "),Fl.R7$(2),Fl.Y8G("ngClass",Fl.l_i(20,LU,t.cipher.hasPasswordHistory,!t.cipher.hasPasswordHistory)),Fl.R7$(2),Fl.SpI("",Fl.bMT(15,15,"dateCreated"),":"),Fl.R7$(2),Fl.SpI(" ",Fl.i5U(17,17,t.cipher.creationDate,"medium")," "),Fl.R7$(2),Fl.Y8G("ngIf",t.cipher.passwordRevisionDisplayDate),Fl.R7$(),Fl.Y8G("ngIf",t.cipher.hasPasswordHistory))},dependencies:[kl.MD,kl.YU,kl.bT,sf,Cw.iI,Ex,Ux,Nx,tc,rc,Hh,uw,kl.vh,rf],encapsulation:2});class qU{}var WU=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class YU{constructor(e,t,i,n,r){this.templateRef=e,this.viewContainer=t,this.billingAccountProfileStateService=i,this.destroyRef=n,this.accountService=r}ngOnInit(){return WU(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.accountService.activeAccount$);e?this.billingAccountProfileStateService.hasPremiumFromAnySource$(e.id).pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{e?this.viewContainer.clear():this.viewContainer.createEmbeddedView(this.templateRef)}):this.viewContainer.createEmbeddedView(this.templateRef)})}}YU.ɵfac=function(e){return new(e||YU)(Fl.rXU(Fl.C4Q),Fl.rXU(Fl.c1b),Fl.rXU(T$),Fl.rXU(a.abz),Fl.rXU(Zk))},YU.ɵdir=Fl.FsC({type:YU,selectors:[["","appNotPremium",""]],standalone:!1});var HU=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function JU(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",1),Fl.bIt("click",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.promptForPremium(t))}),Fl.nrm(1,"i",2),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()}2&e&&(Fl.Y8G("variant","primary"),Fl.R7$(2),Fl.SpI("",Fl.bMT(3,2,"upgrade")," "))}class ZU{constructor(e){this.premiumUpgradePromptService=e,this.organizationId=(0,o.hFB)()}promptForPremium(e){return HU(this,void 0,void 0,function*(){e.stopPropagation(),e.preventDefault(),yield this.premiumUpgradePromptService.promptForPremium(this.organizationId())})}}ZU.ɵfac=function(e){return new(e||ZU)(Fl.rXU(qU))},ZU.ɵcmp=Fl.VBU({type:ZU,selectors:[["app-premium-badge"]],inputs:{organizationId:[1,"organizationId"]},decls:1,vars:0,consts:[["type","button","bitBadge","","class","!tw-text-primary-600 !tw-border-primary-600",3,"variant","click",4,"appNotPremium"],["type","button","bitBadge","",1,"!tw-text-primary-600","!tw-border-primary-600",3,"click","variant"],[1,"bwi","bwi-premium","tw-pe-1"]],template:function(e,t){1&e&&Fl.DNE(0,JU,4,4,"button",0)},dependencies:[eu,Qc,sf,YU,rf],encapsulation:2});var QU=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const eM=(e,t)=>({"tw-text-main":e,"tw-text-danger":t}),tM=(e,t)=>({"tw-stroke-text-main":e,"tw-stroke-danger-600":t}),iM=e=>({"stroke-dashoffset.px":e});function nM(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"div",1)(2,"span",2)(3,"span",3),Fl.EFF(4),Fl.k0s(),a.qSk(),Fl.j41(5,"svg",4)(6,"g"),Fl.nrm(7,"circle",5)(8,"circle",6),Fl.k0s()()()(),Fl.bVm()),2&e){const e=t.ngIf;Fl.R7$(3),Fl.Y8G("ngClass",Fl.l_i(5,eM,!e.totpLow,e.totpLow)),Fl.R7$(),Fl.JRh(e.totpSec),Fl.R7$(3),Fl.Y8G("ngClass",Fl.l_i(8,tM,!e.totpLow,e.totpLow))("ngStyle",Fl.eq3(11,iM,e.totpDash)),Fl.R7$(),Fl.Y8G("ngClass",Fl.l_i(13,tM,!e.totpLow,e.totpLow))}}class rM{constructor(e){this.totpService=e,this.sendCopyCode=new Fl.bkB}ngOnInit(){return QU(this,void 0,void 0,function*(){this.setTotpInfo()})}ngOnChanges(e){e.cipher&&this.setTotpInfo()}setTotpInfo(){var e,t;this.totpInfo$=(null===(t=null===(e=this.cipher)||void 0===e?void 0:e.login)||void 0===t?void 0:t.totp)?this.totpService.getCode$(this.cipher.login.totp).pipe((0,l.T)(e=>{const t=Math.round((new Date).getTime()/1e3)%e.period;return{totpCode:e.code,totpCodeFormatted:this.formatTotpCode(e.code),totpSec:e.period-t,totpDash:+(Math.round(60/e.period*t+"e+2")+"e-2"),totpLow:e.period-t<=7}}),(0,Oo.M)(e=>{e.totpCode&&e.totpCode.length>4&&this.sendCopyCode.emit({totpCode:e.totpCode,totpCodeFormatted:e.totpCodeFormatted})})):void 0}formatTotpCode(e){if(e.length>4){const t=Math.floor(e.length/2);return e.substring(0,t)+" "+e.substring(t)}return e}}rM.ɵfac=function(e){return new(e||rM)(Fl.rXU(C$))},rM.ɵcmp=Fl.VBU({type:rM,selectors:[["","bitTotpCountdown",""]],inputs:{cipher:"cipher"},outputs:{sendCopyCode:"sendCopyCode"},features:[Fl.OA$],attrs:["bitTotpCountdown",""],decls:2,vars:3,consts:[[4,"ngIf"],[1,"tw-flex","tw-items-center","tw-justify-center"],["aria-hidden","true",1,"tw-relative","tw-flex","tw-justify-center","tw-items-center"],["bitTypography","helper",1,"tw-absolute",3,"ngClass"],["transform","rotate(-90)","viewBox","0 0 28 28",1,"tw-size-7"],["r","9.5","cy","14","cx","14","stroke-width","2","stroke-dasharray","60",1,"tw-fill-none",3,"ngClass","ngStyle"],["r","11","cy","14","cx","14","stroke-width","1","stroke-dasharray","71","stroke-dashoffset","0",1,"tw-fill-none",3,"ngClass"]],template:function(e,t){1&e&&(Fl.DNE(0,nM,9,16,"ng-container",0),Fl.nI1(1,"async")),2&e&&Fl.Y8G("ngIf",Fl.bMT(1,1,t.totpInfo$))},dependencies:[kl.MD,kl.YU,kl.bT,kl.B3,tc,rc,kl.Jj],encapsulation:2});var sM=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const oM=["passwordInput"],aM=e=>({"tw-hidden":e}),lM=e=>({"tw-mt-3":e,"tw-mb-2":!0});function cM(e,t){if(1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label",5),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",6)(5,"button",7),Fl.nI1(6,"i18n"),Fl.nI1(7,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("appTextDrag",e.cipher.login.username),Fl.R7$(),Fl.SpI(" ",Fl.bMT(3,6,"username")," "),Fl.R7$(2),Fl.Y8G("value",e.cipher.login.username),Fl.R7$(),Fl.Y8G("appCopyClick",e.cipher.login.username)("valueLabel",Fl.bMT(6,8,"username"))("label",Fl.bMT(7,10,"copyUsername"))}}function uM(e,t){if(1&e&&(Fl.j41(0,"span",15),Fl.nrm(1,"bit-color-password",16),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.BMQ("aria-label",e.cipher.login.password),Fl.R7$(),Fl.Y8G("password",e.cipher.login.password)}}function dM(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",17),Fl.nI1(1,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.togglePasswordCount())}),Fl.k0s()}if(2&e){const e=Fl.XpG(2);Fl.Y8G("label",Fl.bMT(1,2,e.showPasswordCount?"hideCharacterCount":"showCharacterCount")),Fl.BMQ("aria-expanded",e.showPasswordCount)}}function hM(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",18),Fl.bIt("toggledChange",function(t){a.eBV(e);const i=Fl.XpG(2);return a.Njj(i.pwToggleValue(t))}),Fl.k0s()}if(2&e){const e=Fl.XpG(2);Fl.Y8G("toggled",e.passwordRevealed)}}function pM(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",19),Fl.nI1(1,"i18n"),Fl.nI1(2,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.logCopyEvent())}),Fl.k0s()}if(2&e){const e=Fl.XpG(2);Fl.Y8G("appCopyClick",e.cipher.login.password)("valueLabel",Fl.bMT(1,3,"password"))("label",Fl.bMT(2,5,"copyPassword"))}}function vM(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-hint",14),Fl.nrm(1,"i",20),Fl.j41(2,"span",21),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"a",22),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.launchChangePasswordEvent())}),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s()()}2&e&&(Fl.R7$(3),Fl.JRh(Fl.bMT(4,2,"vulnerablePassword")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(7,4,"changeNow")," "))}function fM(e,t){if(1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label",8),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",9,0),Fl.DNE(6,uM,2,2,"span",10)(7,dM,2,4,"button",11)(8,hM,1,1,"button",12)(9,pM,3,7,"button",13),Fl.nVh(10,vM,8,6,"bit-hint",14),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("appTextDrag",e.cipher.login.password),Fl.R7$(),Fl.SpI(" ",Fl.bMT(3,9,"password")," "),Fl.R7$(2),Fl.Y8G("ngClass",Fl.eq3(11,aM,e.passwordRevealed))("value",e.cipher.login.password),Fl.R7$(2),Fl.Y8G("ngIf",e.passwordRevealed),Fl.R7$(),Fl.Y8G("ngIf",e.cipher.viewPassword&&e.passwordRevealed),Fl.R7$(),Fl.Y8G("ngIf",e.cipher.viewPassword),Fl.R7$(),Fl.Y8G("ngIf",e.cipher.viewPassword),Fl.R7$(),Fl.vxM(e.showChangePasswordLink?10:-1)}}function mM(e,t){if(1&e&&(Fl.j41(0,"div",23),Fl.nrm(1,"bit-color-password",24),Fl.k0s()),2&e){const e=Fl.XpG();Fl.Y8G("ngClass",Fl.eq3(3,lM,!e.cipher.login.totp)),Fl.R7$(),Fl.Y8G("password",e.cipher.login.password)("showCount",!0)}}function gM(e,t){if(1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label",5),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",25),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("appTextDrag",e.fido2CredentialCreationDateValue),Fl.R7$(),Fl.SpI("",Fl.bMT(3,3,"typePasskey")," "),Fl.R7$(2),Fl.Y8G("value",e.fido2CredentialCreationDateValue)}}function yM(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"div",31),Fl.bIt("sendCopyCode",function(t){a.eBV(e);const i=Fl.XpG(2);return a.Njj(i.setTotpCopyCode(t))}),Fl.k0s()}if(2&e){const e=Fl.XpG(2);Fl.Y8G("cipher",e.cipher)}}function bM(e,t){if(1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label",5)(2,"div",26),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.nrm(5,"app-premium-badge",27),Fl.k0s()(),Fl.nrm(6,"input",28),Fl.nI1(7,"async"),Fl.DNE(8,yM,1,1,"div",29),Fl.nI1(9,"async"),Fl.nrm(10,"button",30),Fl.nI1(11,"i18n"),Fl.nI1(12,"i18n"),Fl.nI1(13,"async"),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("appTextDrag",null==e.totpCodeCopyObj?null:e.totpCodeCopyObj.totpCode),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(4,10,"verificationCodeTotp")," "),Fl.R7$(2),Fl.Y8G("organizationId",e.cipher.organizationId),Fl.R7$(),Fl.Y8G("type",Fl.bMT(7,12,e.isPremium$)?"text":"password")("value",(null==e.totpCodeCopyObj?null:e.totpCodeCopyObj.totpCodeFormatted)||"*** ***"),Fl.R7$(2),Fl.Y8G("ngIf",Fl.bMT(9,14,e.isPremium$)),Fl.R7$(2),Fl.Y8G("appCopyClick",null==e.totpCodeCopyObj?null:e.totpCodeCopyObj.totpCode)("valueLabel",Fl.bMT(11,16,"verificationCodeTotp"))("label",Fl.bMT(12,18,"copyVerificationCode"))("disabled",!Fl.bMT(13,20,e.isPremium$))}}class wM{constructor(e,t,i,n,r){this.billingAccountProfileStateService=e,this.i18nService=t,this.premiumUpgradeService=i,this.eventCollectionService=n,this.accountService=r,this.handleChangePassword=new Fl.bkB,this.isPremium$=this.accountService.activeAccount$.pipe((0,go.n)(e=>this.billingAccountProfileStateService.hasPremiumFromAnySource$(e.id))),this.showPasswordCount=!1,this.passwordRevealed=!1,this.datePipe=(0,a.WQX)(kl.vh)}get fido2CredentialCreationDateValue(){var e;return`${this.i18nService.t("dateCreated")} ${this.datePipe.transform(null===(e=this.cipher.login.fido2Credentials[0])||void 0===e?void 0:e.creationDate,"short")}`}ngOnChanges(e){var t;e.cipher&&((null===(t=this.passwordInput)||void 0===t?void 0:t.nativeElement)&&(this.passwordInput.nativeElement.type="password"),this.passwordRevealed=!1,this.showPasswordCount=!1)}pwToggleValue(e){return sM(this,void 0,void 0,function*(){this.passwordRevealed=e,e&&(yield this.eventCollectionService.collect(Ua.Cipher_ClientToggledPasswordVisible,this.cipher.id,!1,this.cipher.organizationId))})}togglePasswordCount(){this.showPasswordCount=!this.showPasswordCount}setTotpCopyCode(e){this.totpCodeCopyObj=e}logCopyEvent(){return sM(this,void 0,void 0,function*(){yield this.eventCollectionService.collect(Ua.Cipher_ClientCopiedPassword,this.cipher.id,!1,this.cipher.organizationId)})}launchChangePasswordEvent(){this.handleChangePassword.emit()}}wM.ɵfac=function(e){return new(e||wM)(Fl.rXU(T$),Fl.rXU(Ul),Fl.rXU(qU),Fl.rXU(I$),Fl.rXU(Zk))},wM.ɵcmp=Fl.VBU({type:wM,selectors:[["app-login-credentials-view"]],viewQuery:function(e,t){if(1&e&&Fl.GBs(oM,5),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.passwordInput=e.first)}},inputs:{cipher:"cipher",activeUserId:"activeUserId",showChangePasswordLink:"showChangePasswordLink"},outputs:{handleChangePassword:"handleChangePassword"},features:[Fl.OA$],decls:11,vars:8,consts:[["passwordInput",""],[1,"tw-mb-5","bit-compact:tw-mb-4"],["bitTypography","h6"],[4,"ngIf"],[3,"ngClass",4,"ngIf"],[3,"appTextDrag"],["id","userName","readonly","","bitInput","","type","text","aria-readonly","true","data-testid","login-username",3,"value"],["bitIconButton","bwi-clone","bitSuffix","","type","button","showToast","","data-testid","copy-username",3,"appCopyClick","valueLabel","label"],["id","password-label",3,"appTextDrag"],["id","password","readonly","","bitInput","","type","password","aria-readonly","true","data-testid","login-password",3,"ngClass","value"],["role","textbox","tabindex","0","data-testid","login-password-color","aria-readonly","true","aria-labelledby","password-label",4,"ngIf"],["bitIconButton","bwi-numbered-list","bitSuffix","","type","button","data-testid","toggle-password-count","appStopClick","",3,"label","click",4,"ngIf"],["bitSuffix","","type","button","bitIconButton","","bitPasswordInputToggle","","data-testid","toggle-password",3,"toggled","toggledChange",4,"ngIf"],["bitIconButton","bwi-clone","bitSuffix","","type","button","showToast","","data-testid","copy-password",3,"appCopyClick","valueLabel","label","click",4,"ngIf"],[1,"tw-flex","tw-mb-3","tw-items-center"],["role","textbox","tabindex","0","data-testid","login-password-color","aria-readonly","true","aria-labelledby","password-label"],[1,"tw-font-mono",3,"password"],["bitIconButton","bwi-numbered-list","bitSuffix","","type","button","data-testid","toggle-password-count","appStopClick","",3,"click","label"],["bitSuffix","","type","button","bitIconButton","","bitPasswordInputToggle","","data-testid","toggle-password",3,"toggledChange","toggled"],["bitIconButton","bwi-clone","bitSuffix","","type","button","showToast","","data-testid","copy-password",3,"click","appCopyClick","valueLabel","label"],["aria-hidden","true",1,"bwi","bwi-exclamation-triangle","tw-text-warning"],[1,"tw-ml-2","tw-mr-1"],["bitLink","","href","#","appStopClick","",3,"click"],[3,"ngClass"],[3,"password","showCount"],["id","fido","readonly","","bitInput","","type","text","aria-readonly","true","data-testid","login-passkey",3,"value"],[1,"tw-flex","tw-items-center","tw-gap-2"],[3,"organizationId"],["id","totp","readonly","","bitInput","","aria-readonly","true","data-testid","login-totp",1,"tw-font-mono",3,"type","value"],["bitTotpCountdown","","bitSuffix","",3,"cipher","sendCopyCode",4,"ngIf"],["bitIconButton","bwi-clone","bitSuffix","","type","button","showToast","","data-testid","copy-totp",1,"disabled:tw-cursor-default",3,"appCopyClick","valueLabel","label","disabled"],["bitTotpCountdown","","bitSuffix","",3,"sendCopyCode","cipher"]],template:function(e,t){1&e&&(Fl.j41(0,"section",1)(1,"bit-section-header")(2,"h2",2),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"read-only-cipher-card"),Fl.DNE(6,cM,8,12,"bit-form-field",3)(7,fM,11,13,"bit-form-field",3)(8,mM,2,5,"div",4)(9,gM,5,5,"bit-form-field",3)(10,bM,14,22,"bit-form-field",3),Fl.k0s()()),2&e&&(Fl.R7$(3),Fl.JRh(Fl.bMT(4,6,"loginCredentials")),Fl.R7$(3),Fl.Y8G("ngIf",t.cipher.login.username),Fl.R7$(),Fl.Y8G("ngIf",t.cipher.login.password),Fl.R7$(),Fl.Y8G("ngIf",t.showPasswordCount&&t.passwordRevealed),Fl.R7$(),Fl.Y8G("ngIf",(null==t.cipher.login||null==t.cipher.login.fido2Credentials?null:t.cipher.login.fido2Credentials.length)>0),Fl.R7$(),Fl.Y8G("ngIf",t.cipher.login.totp))},dependencies:[kl.MD,kl.YU,kl.bT,sf,IP,rO,sO,Nx,tc,rc,Gu,Ac,hu,fu,ju,iw,nw,Ql,Zl,eu,XO,ZO,rM,BO,Hh,uw,ZU,kl.Jj,rf],encapsulation:2});class SM{constructor(){this.revealSshKey=!1}ngOnChanges(e){e.sshKey&&(this.revealSshKey=!1)}}function kM(e,t){if(1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label",4),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",5)(5,"button",6),Fl.nI1(6,"i18n"),Fl.nI1(7,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("appTextDrag",e.cipher.identity.fullName),Fl.R7$(),Fl.JRh(Fl.bMT(3,6,"name")),Fl.R7$(2),Fl.Y8G("value",e.cipher.identity.fullName),Fl.R7$(),Fl.Y8G("label",Fl.bMT(6,8,"copyName"))("appCopyClick",e.cipher.identity.fullName)("valueLabel",Fl.bMT(7,10,"name"))}}function IM(e,t){if(1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label",4),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",7)(5,"button",8),Fl.nI1(6,"i18n"),Fl.nI1(7,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("appTextDrag",e.cipher.identity.username),Fl.R7$(),Fl.JRh(Fl.bMT(3,6,"username")),Fl.R7$(2),Fl.Y8G("value",e.cipher.identity.username),Fl.R7$(),Fl.Y8G("label",Fl.bMT(6,8,"copyUsername"))("appCopyClick",e.cipher.identity.username)("valueLabel",Fl.bMT(7,10,"username"))}}function CM(e,t){if(1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label",4),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",9)(5,"button",10),Fl.nI1(6,"i18n"),Fl.nI1(7,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("appTextDrag",e.cipher.identity.company),Fl.R7$(),Fl.JRh(Fl.bMT(3,6,"company")),Fl.R7$(2),Fl.Y8G("value",e.cipher.identity.company),Fl.R7$(),Fl.Y8G("label",Fl.bMT(6,8,"copyCompany"))("appCopyClick",e.cipher.identity.company)("valueLabel",Fl.bMT(7,10,"company"))}}function TM(e,t){if(1&e&&(Fl.j41(0,"section",1)(1,"bit-section-header")(2,"h2",2),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"read-only-cipher-card"),Fl.DNE(6,kM,8,12,"bit-form-field",3)(7,IM,8,12,"bit-form-field",3)(8,CM,8,12,"bit-form-field",3),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(3),Fl.JRh(Fl.bMT(4,4,"personalDetails")),Fl.R7$(3),Fl.Y8G("ngIf",e.cipher.identity.fullName),Fl.R7$(),Fl.Y8G("ngIf",e.cipher.identity.username),Fl.R7$(),Fl.Y8G("ngIf",e.cipher.identity.company)}}function PM(e,t){if(1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label",4),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",11)(5,"button",12)(6,"button",13),Fl.nI1(7,"i18n"),Fl.nI1(8,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("appTextDrag",e.cipher.identity.ssn),Fl.R7$(),Fl.JRh(Fl.bMT(3,6,"ssn")),Fl.R7$(2),Fl.Y8G("value",e.cipher.identity.ssn),Fl.R7$(2),Fl.Y8G("label",Fl.bMT(7,8,"copySSN"))("appCopyClick",e.cipher.identity.ssn)("valueLabel",Fl.bMT(8,10,"ssn"))}}function FM(e,t){if(1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label",4),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",14)(5,"button",15)(6,"button",16),Fl.nI1(7,"i18n"),Fl.nI1(8,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("appTextDrag",e.cipher.identity.passportNumber),Fl.R7$(),Fl.JRh(Fl.bMT(3,6,"passportNumber")),Fl.R7$(2),Fl.Y8G("value",e.cipher.identity.passportNumber),Fl.R7$(2),Fl.Y8G("label",Fl.bMT(7,8,"copyPassportNumber"))("appCopyClick",e.cipher.identity.passportNumber)("valueLabel",Fl.bMT(8,10,"passportNumber"))}}function RM(e,t){if(1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label",4),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",17)(5,"button",18),Fl.nI1(6,"i18n"),Fl.nI1(7,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("appTextDrag",e.cipher.identity.licenseNumber),Fl.R7$(),Fl.JRh(Fl.bMT(3,6,"licenseNumber")),Fl.R7$(2),Fl.Y8G("value",e.cipher.identity.licenseNumber),Fl.R7$(),Fl.Y8G("label",Fl.bMT(6,8,"copyLicenseNumber"))("appCopyClick",e.cipher.identity.licenseNumber)("valueLabel",Fl.bMT(7,10,"licenseNumber"))}}function xM(e,t){if(1&e&&(Fl.j41(0,"section",1)(1,"bit-section-header")(2,"h2",2),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"read-only-cipher-card"),Fl.DNE(6,PM,9,12,"bit-form-field",3)(7,FM,9,12,"bit-form-field",3)(8,RM,8,12,"bit-form-field",3),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(3),Fl.JRh(Fl.bMT(4,4,"identification")),Fl.R7$(3),Fl.Y8G("ngIf",e.cipher.identity.ssn),Fl.R7$(),Fl.Y8G("ngIf",e.cipher.identity.passportNumber),Fl.R7$(),Fl.Y8G("ngIf",e.cipher.identity.licenseNumber)}}function AM(e,t){if(1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label",4),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",19)(5,"button",20),Fl.nI1(6,"i18n"),Fl.nI1(7,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("appTextDrag",e.cipher.identity.email),Fl.R7$(),Fl.JRh(Fl.bMT(3,6,"email")),Fl.R7$(2),Fl.Y8G("value",e.cipher.identity.email),Fl.R7$(),Fl.Y8G("label",Fl.bMT(6,8,"copyEmail"))("appCopyClick",e.cipher.identity.email)("valueLabel",Fl.bMT(7,10,"email"))}}function DM(e,t){if(1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label",4),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",21)(5,"button",22),Fl.nI1(6,"i18n"),Fl.nI1(7,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("appTextDrag",e.cipher.identity.phone),Fl.R7$(),Fl.JRh(Fl.bMT(3,6,"phone")),Fl.R7$(2),Fl.Y8G("value",e.cipher.identity.phone),Fl.R7$(),Fl.Y8G("label",Fl.bMT(6,8,"copyPhone"))("appCopyClick",e.cipher.identity.phone)("valueLabel",Fl.bMT(7,10,"phone"))}}function EM(e,t){if(1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label",4),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"textarea",23)(5,"button",24),Fl.nI1(6,"i18n"),Fl.nI1(7,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("appTextDrag",e.addressFields),Fl.R7$(),Fl.JRh(Fl.bMT(3,7,"address")),Fl.R7$(2),Fl.Y8G("value",e.addressFields)("rows",e.addressRows),Fl.R7$(),Fl.Y8G("label",Fl.bMT(6,9,"copyAddress"))("appCopyClick",e.addressFields)("valueLabel",Fl.bMT(7,11,"address"))}}function $M(e,t){if(1&e&&(Fl.j41(0,"section",1)(1,"bit-section-header")(2,"h2",2),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"read-only-cipher-card"),Fl.DNE(6,AM,8,12,"bit-form-field",3)(7,DM,8,12,"bit-form-field",3)(8,EM,8,13,"bit-form-field",3),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(3),Fl.JRh(Fl.bMT(4,4,"contactInfo")),Fl.R7$(3),Fl.Y8G("ngIf",e.cipher.identity.email),Fl.R7$(),Fl.Y8G("ngIf",e.cipher.identity.phone),Fl.R7$(),Fl.Y8G("ngIf",e.addressFields)}}SM.ɵfac=function(e){return new(e||SM)},SM.ɵcmp=Fl.VBU({type:SM,selectors:[["app-sshkey-view"]],inputs:{sshKey:"sshKey"},features:[Fl.OA$],decls:31,vars:37,consts:[[1,"tw-mb-5","bit-compact:tw-mb-4"],["bitTypography","h6"],["readonly","","bitInput","","aria-readonly","true","type","password","data-testid","private-key",3,"value"],["bitSuffix","","type","button","bitIconButton","","bitPasswordInputToggle","","data-testid","toggle-privateKey",3,"toggledChange","toggled"],["bitIconButton","bwi-clone","bitSuffix","","type","button","showToast","",3,"label","appCopyClick","valueLabel"],["readonly","","bitInput","","aria-readonly","true","data-testid","public-key",3,"value"],["readonly","","bitInput","","aria-readonly","true","data-testid","fingerprint",3,"value"]],template:function(e,t){1&e&&(Fl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"read-only-cipher-card")(6,"bit-form-field")(7,"bit-label"),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.nrm(10,"input",2),Fl.j41(11,"button",3),Fl.mxI("toggledChange",function(e){return Fl.DH7(t.revealSshKey,e)||(t.revealSshKey=e),e}),Fl.k0s(),Fl.nrm(12,"button",4),Fl.nI1(13,"i18n"),Fl.nI1(14,"i18n"),Fl.k0s(),Fl.j41(15,"bit-form-field")(16,"bit-label"),Fl.EFF(17),Fl.nI1(18,"i18n"),Fl.k0s(),Fl.nrm(19,"input",5)(20,"button",4),Fl.nI1(21,"i18n"),Fl.nI1(22,"i18n"),Fl.k0s(),Fl.j41(23,"bit-form-field")(24,"bit-label"),Fl.EFF(25),Fl.nI1(26,"i18n"),Fl.k0s(),Fl.nrm(27,"input",6)(28,"button",4),Fl.nI1(29,"i18n"),Fl.nI1(30,"i18n"),Fl.k0s()()()),2&e&&(Fl.R7$(3),Fl.JRh(Fl.bMT(4,17,"typeSshKey")),Fl.R7$(5),Fl.JRh(Fl.bMT(9,19,"sshPrivateKey")),Fl.R7$(2),Fl.Y8G("value",t.sshKey.privateKey),Fl.R7$(),Fl.R50("toggled",t.revealSshKey),Fl.R7$(),Fl.Y8G("label",Fl.bMT(13,21,"copyPrivateKey"))("appCopyClick",t.sshKey.privateKey)("valueLabel",Fl.bMT(14,23,"sshPrivateKey")),Fl.R7$(5),Fl.JRh(Fl.bMT(18,25,"sshPublicKey")),Fl.R7$(2),Fl.Y8G("value",t.sshKey.publicKey),Fl.R7$(),Fl.Y8G("label",Fl.bMT(21,27,"copyPublicKey"))("appCopyClick",t.sshKey.publicKey)("valueLabel",Fl.bMT(22,29,"sshPublicKey")),Fl.R7$(5),Fl.JRh(Fl.bMT(26,31,"sshFingerprint")),Fl.R7$(2),Fl.Y8G("value",t.sshKey.keyFingerprint),Fl.R7$(),Fl.Y8G("label",Fl.bMT(29,33,"copyFingerprint"))("appCopyClick",t.sshKey.keyFingerprint)("valueLabel",Fl.bMT(30,35,"sshFingerprint")))},dependencies:[kl.MD,sf,rO,Nx,BO,tc,rc,Gu,Ac,fu,ju,iw,nw,Ql,Zl,rf],encapsulation:2});class OM{constructor(){this.cipher=null}get addressFields(){if(!this.cipher)return"";const{address1:e,address2:t,address3:i,fullAddressPart2:n,country:r}=this.cipher.identity;return[e,t,i,n,r].filter(Boolean).join("\n")}get addressRows(){return this.addressFields.split("\n").length}get hasPersonalDetails(){if(!this.cipher)return!1;const{username:e,company:t,fullName:i}=this.cipher.identity;return Boolean(i||e||t)}get hasIdentificationDetails(){if(!this.cipher)return!1;const{ssn:e,passportNumber:t,licenseNumber:i}=this.cipher.identity;return Boolean(e||t||i)}get hasContactDetails(){if(!this.cipher)return!1;const{email:e,phone:t}=this.cipher.identity;return Boolean(e||t||this.addressFields)}}OM.ɵfac=function(e){return new(e||OM)},OM.ɵcmp=Fl.VBU({type:OM,selectors:[["app-view-identity-sections"]],inputs:{cipher:"cipher"},decls:3,vars:3,consts:[["class","tw-mb-5 bit-compact:tw-mb-4",4,"ngIf"],[1,"tw-mb-5","bit-compact:tw-mb-4"],["bitTypography","h6"],[4,"ngIf"],[3,"appTextDrag"],["bitInput","","id","fullName","readonly","","data-testid","name",3,"value"],["type","button","bitIconButton","bwi-clone","bitSuffix","","showToast","","data-testid","copy-name",3,"label","appCopyClick","valueLabel"],["bitInput","","id","username","readonly","","data-testid","username",3,"value"],["type","button","bitIconButton","bwi-clone","bitSuffix","","showToast","",3,"label","appCopyClick","valueLabel"],["bitInput","","id","company","readonly","","data-testid","company",3,"value"],["type","button","bitIconButton","bwi-clone","bitSuffix","","showToast","","data-testid","copy-company",3,"label","appCopyClick","valueLabel"],["bitInput","","id","ssn","type","password","readonly","","data-testid","ssn",3,"value"],["type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle","","data-testid","ssn-toggle"],["type","button","bitIconButton","bwi-clone","bitSuffix","","showToast","","data-testid","copy-ssn",3,"label","appCopyClick","valueLabel"],["id","passportNumber","bitInput","","type","password","readonly","","data-testid","passport",3,"value"],["type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle","","data-testid","passport-toggle"],["type","button","bitIconButton","bwi-clone","bitSuffix","","showToast","","data-testid","copy-passport",3,"label","appCopyClick","valueLabel"],["bitInput","","id","licenseNumber","readonly","","data-testid","license",3,"value"],["type","button","bitIconButton","bwi-clone","bitSuffix","","showToast","","data-testid","copy-license",3,"label","appCopyClick","valueLabel"],["bitInput","","id","email","readonly","","data-testid","email",3,"value"],["type","button","bitIconButton","bwi-clone","bitSuffix","","showToast","","data-testid","copy-email",3,"label","appCopyClick","valueLabel"],["bitInput","","id","phone","readonly","","data-testid","phone",3,"value"],["type","button","bitIconButton","bwi-clone","bitSuffix","","showToast","","data-testid","copy-phone",3,"label","appCopyClick","valueLabel"],["bitInput","","id","address","readonly","","data-testid","address",1,"tw-resize-none",3,"value","rows"],["type","button","bitIconButton","bwi-clone","bitSuffix","","showToast","","data-testid","copy-address",3,"label","appCopyClick","valueLabel"]],template:function(e,t){1&e&&Fl.DNE(0,TM,9,6,"section",0)(1,xM,9,6,"section",0)(2,$M,9,6,"section",0),2&e&&(Fl.Y8G("ngIf",t.hasPersonalDetails),Fl.R7$(),Fl.Y8G("ngIf",t.hasIdentificationDetails),Fl.R7$(),Fl.Y8G("ngIf",t.hasContactDetails))},dependencies:[kl.bT,sf,rO,sO,Nx,tc,rc,Gu,Ac,fu,ju,iw,nw,Ql,Zl,BO,rf],encapsulation:2});class UM{}class MM extends UM{}class NM{}var VM=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const BM=[[["","slot","button"]]];function jM(e,t){1&e&&(Fl.j41(0,"bit-callout",10),Fl.nI1(1,"i18n"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()),2&e&&(Fl.Y8G("title",Fl.bMT(1,2,"cardExpiredTitle")),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,4,"cardExpiredMessage")," "))}function GM(e,t){1&e&&(Fl.j41(0,"bit-callout",11),Fl.nI1(1,"i18n"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()),2&e&&(Fl.Y8G("title",Fl.bMT(1,2,"missingWebsite")),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,4,"changeAtRiskPasswordAndAddWebsite")," "))}function LM(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-callout",11)(1,"a",12),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.launchChangePassword())}),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()()}2&e&&(Fl.Y8G("title",""),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,2,"changeAtRiskPassword")," "))}function zM(e,t){1&e&&(Fl.j41(0,"p",13),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"noEditPermissions")," "))}function _M(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"app-login-credentials-view",14),Fl.nI1(1,"async"),Fl.bIt("handleChangePassword",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.launchChangePassword())}),Fl.k0s()}if(2&e){const e=Fl.XpG(2);Fl.Y8G("cipher",e.cipher())("activeUserId",Fl.bMT(1,3,e.activeUserId$))("showChangePasswordLink",e.showChangePasswordLink())}}function KM(e,t){if(1&e&&Fl.nrm(0,"app-autofill-options-view",15),2&e){const e=Fl.XpG(2);Fl.Y8G("loginUris",e.cipher().login.uris)("cipherId",e.cipher().id)}}function XM(e,t){if(1&e&&Fl.nrm(0,"app-card-details-view",9),2&e){const e=Fl.XpG(2);Fl.Y8G("cipher",e.cipher())}}function qM(e,t){if(1&e&&Fl.nrm(0,"app-view-identity-sections",9),2&e){const e=Fl.XpG(2);Fl.Y8G("cipher",e.cipher())}}function WM(e,t){if(1&e&&Fl.nrm(0,"app-sshkey-view",16),2&e){const e=Fl.XpG(2);Fl.Y8G("sshKey",e.cipher().sshKey)}}function YM(e,t){if(1&e&&(Fl.qex(0),Fl.nrm(1,"app-additional-options",17),Fl.bVm()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("notes",e.cipher().notes)}}function HM(e,t){if(1&e&&(Fl.qex(0),Fl.nrm(1,"app-custom-fields-v2",9),Fl.bVm()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("cipher",e.cipher())}}function JM(e,t){if(1&e&&(Fl.qex(0),Fl.nrm(1,"app-attachments-v2-view",18),Fl.bVm()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("emergencyAccessId",e.emergencyAccessId())("cipher",e.cipher())("admin",e.isAdminConsole())}}function ZM(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,jM,4,6,"bit-callout",1)(2,GM,4,6,"bit-callout",2)(3,LM,4,4,"bit-callout",2)(4,zM,3,3,"p",3),Fl.j41(5,"app-item-details-v2",4),Fl.SdG(6),Fl.k0s(),Fl.DNE(7,_M,2,5,"app-login-credentials-view",5)(8,KM,1,2,"app-autofill-options-view",6)(9,XM,1,1,"app-card-details-view",7)(10,qM,1,1,"app-view-identity-sections",7)(11,WM,1,1,"app-sshkey-view",8)(12,YM,2,1,"ng-container",0)(13,HM,2,1,"ng-container",0)(14,JM,2,3,"ng-container",0),Fl.nrm(15,"app-item-history-v2",9),Fl.bVm()),2&e){let e,t,i,n,r;const s=Fl.XpG();Fl.R7$(),Fl.Y8G("ngIf",s.cardIsExpired()),Fl.R7$(),Fl.Y8G("ngIf",!s.hasLoginUri()&&s.hadPendingChangePasswordTask()),Fl.R7$(),Fl.Y8G("ngIf",s.showChangePasswordLink()),Fl.R7$(),Fl.Y8G("ngIf",(null==(e=s.cipher())?null:e.isDeleted)&&!(null!=(e=s.cipher())&&e.edit)),Fl.R7$(),Fl.Y8G("cipher",s.cipher())("organization",s.organization())("collections",s.resolvedCollections())("folder",s.folder())("hideOwner",s.isAdminConsole()),Fl.R7$(2),Fl.Y8G("ngIf",s.hasLogin()),Fl.R7$(),Fl.Y8G("ngIf",s.hasAutofill()),Fl.R7$(),Fl.Y8G("ngIf",s.hasCard()),Fl.R7$(),Fl.Y8G("ngIf",null==(t=s.cipher())?null:t.identity),Fl.R7$(),Fl.Y8G("ngIf",s.hasSshKey()),Fl.R7$(),Fl.Y8G("ngIf",null==(i=s.cipher())?null:i.notes),Fl.R7$(),Fl.Y8G("ngIf",null==(n=s.cipher())?null:n.hasFields),Fl.R7$(),Fl.Y8G("ngIf",null==(r=s.cipher())?null:r.hasAttachments),Fl.R7$(),Fl.Y8G("cipher",s.cipher())}}class QM{constructor(e,t,i,n,r,s,a,c,u,d,h){this.organizationService=e,this.collectionService=t,this.folderService=i,this.accountService=n,this.defaultTaskService=r,this.platformUtilsService=s,this.changeLoginPasswordService=a,this.cipherService=c,this.logService=u,this.cipherRiskService=d,this.billingAccountService=h,this.cipher=o.hFB.required(),this.cipher$=(0,xl.br)(this.cipher),this.emergencyAccessId=(0,o.hFB)(),this.collections=(0,o.hFB)(void 0),this.isAdminConsole=(0,o.hFB)(!1),this.activeUserId$=iv(this.accountService.activeAccount$),this.resolvedCollections=(0,xl.ot)((0,jo.z)([this.activeUserId$,this.cipher$,(0,xl.br)(this.collections)]).pipe((0,go.n)(([e,t,i])=>i&&i.length>0?(0,Go.of)(i):t.collectionIds&&t.collectionIds.length>0?this.collectionService.decryptedCollections$(e).pipe(sR(t.collectionIds)):(0,Go.of)(void 0)))),this.organization=(0,xl.ot)((0,jo.z)([this.activeUserId$,this.cipher$]).pipe((0,go.n)(([e,t])=>e&&(null==t?void 0:t.organizationId)?this.organizationService.organizations$(e).pipe((0,l.T)(e=>e.find(e=>e.id===t.organizationId))):(0,Go.of)(void 0)))),this.folder=(0,xl.ot)((0,jo.z)([this.activeUserId$,this.cipher$]).pipe((0,go.n)(([e,t])=>e&&(null==t?void 0:t.folderId)?this.folderService.getDecrypted$(t.folderId,e):(0,Go.of)(void 0)))),this.hadPendingChangePasswordTask=(0,xl.ot)((0,jo.z)([this.activeUserId$,this.cipher$]).pipe((0,go.n)(([e,t])=>(null==t?void 0:t.type)===nx.Login&&(null==t?void 0:t.organizationId)?(0,jo.z)([this.cipherService.ciphers$(e),this.defaultTaskService.pendingTasks$(e)]).pipe((0,l.T)(([e,i])=>{var n;const r=e[null==t?void 0:t.id];return!(!(null==r?void 0:r.edit)||!(null==r?void 0:r.viewPassword))&&(null!==(n=null==i?void 0:i.some(e=>e.cipherId===(null==t?void 0:t.id)&&e.type===a$))&&void 0!==n&&n)}),(0,Ed.W)(e=>(this.logService.error("Failed to retrieve change password tasks for cipher",e),(0,Go.of)(!1)))):(0,Go.of)(!1))),{initialValue:!1}),this.hasCard=(0,Rl.EW)(()=>{const e=this.cipher();if(!e)return!1;const{cardholderName:t,code:i,expMonth:n,expYear:r,number:s}=e.card;return t||i||n||r||s}),this.cardIsExpired=(0,Rl.EW)(()=>{const e=this.cipher();return null!=e&&function(e){if(e){const{expMonth:t=null,expYear:i=null}=e;if(!i)return!1;const n=new Date,r=W$(i),s=r?parseInt(r,10):NaN,o=s<n.getFullYear(),a=s>n.getFullYear();if(r&&o)return!0;if(r&&a)return!1;if(r&&t){const e=parseInt(t,10);return!(!e||isNaN(e))&&new Date(s,e-1+1,1)<=n}}return!1}(e.card)}),this.hasLogin=(0,Rl.EW)(()=>{const e=this.cipher();if(!e)return!1;const{username:t,password:i,totp:n,fido2Credentials:r}=e.login;return t||i||n||(null==r?void 0:r.length)>0}),this.hasAutofill=(0,Rl.EW)(()=>{var e,t;const i=this.cipher();return(null!==(t=null===(e=null==i?void 0:i.login)||void 0===e?void 0:e.uris.length)&&void 0!==t?t:0)>0}),this.hasSshKey=(0,Rl.EW)(()=>{var e;const t=this.cipher();return!!(null===(e=null==t?void 0:t.sshKey)||void 0===e?void 0:e.privateKey)}),this.hasLoginUri=(0,Rl.EW)(()=>{var e;const t=this.cipher();return null===(e=null==t?void 0:t.login)||void 0===e?void 0:e.hasUris}),this.passwordIsAtRisk=(0,xl.ot)((0,jo.z)([this.activeUserId$,this.cipher$]).pipe((0,go.n)(([e,t])=>!t.hasLoginPassword||!t.edit||t.organizationId||t.isDeleted?(0,Go.of)(!1):this.switchPremium$(e,()=>(0,$d.H)(this.checkIfPasswordIsAtRisk(t.id,e)).pipe((0,kd.Z)(!1)),()=>(0,Go.of)(!1)))),{initialValue:!1}),this.showChangePasswordLink=(0,Rl.EW)(()=>this.hasLoginUri()&&(this.hadPendingChangePasswordTask()||this.passwordIsAtRisk())),this.launchChangePassword=()=>VM(this,void 0,void 0,function*(){const e=this.cipher();if(null!=e){const t=yield this.changeLoginPasswordService.getChangePasswordUrl(e);if(null==t)return;this.platformUtilsService.launchUri(t)}})}switchPremium$(e,t,i){return this.billingAccountService.hasPremiumFromAnySource$(e).pipe((0,go.n)(e=>e?t():i()))}checkIfPasswordIsAtRisk(e,t){return VM(this,void 0,void 0,function*(){try{return function(e){var t;return"Found"===e.exposed_result.type&&e.exposed_result.value>0||(null!==(t=e.reuse_count)&&void 0!==t?t:1)>1||e.password_strength<3}(yield this.cipherRiskService.computeCipherRiskForUser(e,t,!0))}catch(e){return this.logService.error("Failed to check if password is at risk",e),!1}})}}QM.ɵfac=function(e){return new(e||QM)(Fl.rXU(WF),Fl.rXU(uR),Fl.rXU(UM),Fl.rXU(Zk),Fl.rXU(d$),Fl.rXU(Hb),Fl.rXU(NM),Fl.rXU(_b),Fl.rXU(Za),Fl.rXU(H$),Fl.rXU(T$))},QM.ɵcmp=Fl.VBU({type:QM,selectors:[["app-cipher-view"]],inputs:{cipher:[1,"cipher"],emergencyAccessId:[1,"emergencyAccessId"],collections:[1,"collections"],isAdminConsole:[1,"isAdminConsole"]},ngContentSelectors:["[slot=button]"],decls:1,vars:1,consts:[[4,"ngIf"],["type","info",3,"title",4,"ngIf"],["type","warning",3,"title",4,"ngIf"],["class","tw-text-muted","bitTypography","helper",4,"ngIf"],[3,"cipher","organization","collections","folder","hideOwner"],[3,"cipher","activeUserId","showChangePasswordLink","handleChangePassword",4,"ngIf"],[3,"loginUris","cipherId",4,"ngIf"],[3,"cipher",4,"ngIf"],[3,"sshKey",4,"ngIf"],[3,"cipher"],["type","info",3,"title"],["type","warning",3,"title"],["bitLink","","href","#","appStopClick","","linkType","secondary","endIcon","bwi-external-link",3,"click"],["bitTypography","helper",1,"tw-text-muted"],[3,"handleChangePassword","cipher","activeUserId","showChangePasswordLink"],[3,"loginUris","cipherId"],[3,"sshKey"],[3,"notes"],[3,"emergencyAccessId","cipher","admin"]],template:function(e,t){1&e&&(Fl.NAR(BM),Fl.DNE(0,ZM,16,18,"ng-container",0)),2&e&&Fl.Y8G("ngIf",!!t.cipher())},dependencies:[dd,ud,kl.MD,kl.bT,iO,sf,IP,BU,oO,UO,XU,pU,KO,SM,OM,wM,VO,uw,tc,rc,kl.Jj,rf],encapsulation:2});class eN{constructor(e){null!=e&&(this.id=e.id,this.url=e.url,this.fileName=e.fileName,this.key=e.key,this.size=e.size,this.sizeName=e.sizeName)}}class tN{constructor(e){null!=e&&(this.cardholderName=e.cardholderName,this.brand=e.brand,this.number=e.number,this.expMonth=e.expMonth,this.expYear=e.expYear,this.code=e.code)}}class iN{constructor(e){this.type=ox.Text,null!=e&&(this.type=e.type,this.name=e.name,this.value=e.value,this.linkedId=e.linkedId)}}class nN{constructor(e){null!=e&&(this.title=e.title,this.firstName=e.firstName,this.middleName=e.middleName,this.lastName=e.lastName,this.address1=e.address1,this.address2=e.address2,this.address3=e.address3,this.city=e.city,this.state=e.state,this.postalCode=e.postalCode,this.country=e.country,this.company=e.company,this.email=e.email,this.phone=e.phone,this.ssn=e.ssn,this.username=e.username,this.passportNumber=e.passportNumber,this.licenseNumber=e.licenseNumber)}}class rN{constructor(e){null!=e&&(this.credentialId=e.credentialId,this.keyType=e.keyType,this.keyAlgorithm=e.keyAlgorithm,this.keyCurve=e.keyCurve,this.keyValue=e.keyValue,this.rpId=e.rpId,this.userHandle=e.userHandle,this.userName=e.userName,this.counter=e.counter,this.rpName=e.rpName,this.userDisplayName=e.userDisplayName,this.discoverable=e.discoverable,this.creationDate=e.creationDate)}}class sN{constructor(e){null!=e&&(this.uri=e.uri,this.uriChecksum=e.uriChecksum,this.match=e.match)}}class oN{constructor(e){var t;null!=e&&(this.username=e.username,this.password=e.password,this.passwordRevisionDate=e.passwordRevisionDate,this.totp=e.totp,this.autofillOnPageLoad=e.autofillOnPageLoad,e.uris&&(this.uris=e.uris.map(e=>new sN(e))),e.fido2Credentials&&(this.fido2Credentials=null===(t=e.fido2Credentials)||void 0===t?void 0:t.map(e=>new rN(e))))}}class aN{constructor(e){null!=e&&(this.password=e.password,this.lastUsedDate=e.lastUsedDate)}}class lN{constructor(e){this.type=hx,null!=e&&(this.type=e.type)}}class cN{constructor(e){null!=e&&(this.privateKey=e.privateKey,this.publicKey=e.publicKey,this.keyFingerprint=e.keyFingerprint)}}class uN{constructor(e,t){if(this.id="",this.edit=!1,this.viewPassword=!0,this.organizationUseTotp=!1,this.favorite=!1,this.type=nx.Login,this.name="",this.reprompt=tx.None,null!=e){switch(this.id=e.id,this.organizationId=e.organizationId,this.folderId=e.folderId,this.edit=e.edit,this.viewPassword=e.viewPassword,this.permissions=e.permissions,this.organizationUseTotp=e.organizationUseTotp,this.favorite=e.favorite,this.revisionDate=e.revisionDate,this.type=e.type,this.name=e.name,this.notes=e.notes,this.collectionIds=null!=t?t:e.collectionIds,this.creationDate=e.creationDate,this.deletedDate=e.deletedDate,this.archivedDate=e.archivedDate,this.reprompt=e.reprompt,this.key=e.key,this.type){case nx.Login:this.login=new oN(e.login);break;case nx.SecureNote:this.secureNote=new lN(e.secureNote);break;case nx.Card:this.card=new tN(e.card);break;case nx.Identity:this.identity=new nN(e.identity);break;case nx.SshKey:this.sshKey=new cN(e.sshKey)}null!=e.fields&&(this.fields=e.fields.map(e=>new iN(e))),null!=e.attachments&&(this.attachments=e.attachments.map(e=>new eN(e))),null!=e.passwordHistory&&(this.passwordHistory=e.passwordHistory.map(e=>new aN(e)))}else this.creationDate=this.revisionDate=(new Date).toISOString()}static fromJSON(e){const t=Object.assign(new uN,e);return null!=e.permissions&&(t.permissions=oA.fromJSON(e.permissions)),t}}const dN=e=>null!=e?new Pp(e):void 0,hN=e=>null!=e?Pp.fromJSON(e):void 0;var pN=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class vN extends sv{constructor(e){super(),null!=e&&(this.id=e.id,this.url=e.url,this.size=e.size,this.sizeName=e.sizeName,this.fileName=dN(e.fileName),this.key=dN(e.key))}decrypt(e){return pN(this,arguments,void 0,function*(e,t="No Cipher Context"){const i=yield this.decryptObj(this,new uO(this),["fileName"],e,"DomainType: Attachment; "+t);return null!=this.key&&(i.key=yield this.decryptAttachmentKey(e),i.encryptedKey=this.key,i.key||(i.hasDecryptionError=!0)),i})}decryptAttachmentKey(e){return pN(this,void 0,void 0,function*(){try{if(null==this.key)return;const t=bd.getContainerService().getEncryptService();return yield t.unwrapSymmetricKey(this.key,e)}catch(e){return void console.error("[Attachment] Error decrypting attachment",e)}})}toAttachmentData(){const e=new eN;return null!=this.size&&(e.size=this.size),this.buildDataModel(this,e,{id:null,url:null,sizeName:null,fileName:null,key:null},["id","url","sizeName"]),e}static fromJSON(e){if(null==e)return;const t=new vN;return t.id=e.id,t.url=e.url,t.size=e.size,t.sizeName=e.sizeName,t.key=hN(e.key),t.fileName=hN(e.fileName),t}toSdkAttachment(){var e,t;return{id:this.id,url:this.url,size:this.size,sizeName:this.sizeName,fileName:null===(e=this.fileName)||void 0===e?void 0:e.toSdk(),key:null===(t=this.key)||void 0===t?void 0:t.toSdk()}}static fromSdkAttachment(e){if(!e)return;const t=new vN;return t.id=e.id,t.url=e.url,t.size=e.size,t.sizeName=e.sizeName,t.fileName=hN(e.fileName),t.key=hN(e.key),t}}var fN=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class mN extends sv{constructor(e){super(),null!=e&&(this.cardholderName=dN(e.cardholderName),this.brand=dN(e.brand),this.number=dN(e.number),this.expMonth=dN(e.expMonth),this.expYear=dN(e.expYear),this.code=dN(e.code))}decrypt(e){return fN(this,arguments,void 0,function*(e,t="No Cipher Context"){return this.decryptObj(this,new mO,["cardholderName","brand","number","expMonth","expYear","code"],e,"DomainType: Card; "+t)})}toCardData(){const e=new tN;return this.buildDataModel(this,e,{cardholderName:null,brand:null,number:null,expMonth:null,expYear:null,code:null}),e}static fromJSON(e){if(null==e)return;const t=new mN;return t.cardholderName=hN(e.cardholderName),t.brand=hN(e.brand),t.number=hN(e.number),t.expMonth=hN(e.expMonth),t.expYear=hN(e.expYear),t.code=hN(e.code),t}toSdkCard(){var e,t,i,n,r,s;return{cardholderName:null===(e=this.cardholderName)||void 0===e?void 0:e.toSdk(),brand:null===(t=this.brand)||void 0===t?void 0:t.toSdk(),number:null===(i=this.number)||void 0===i?void 0:i.toSdk(),expMonth:null===(n=this.expMonth)||void 0===n?void 0:n.toSdk(),expYear:null===(r=this.expYear)||void 0===r?void 0:r.toSdk(),code:null===(s=this.code)||void 0===s?void 0:s.toSdk()}}static fromSdkCard(e){if(!e)return;const t=new mN;return t.cardholderName=hN(e.cardholderName),t.brand=hN(e.brand),t.number=hN(e.number),t.expMonth=hN(e.expMonth),t.expYear=hN(e.expYear),t.code=hN(e.code),t}}class gN extends sv{constructor(e){var t;super(),this.type=ox.Text,null!=e&&(this.type=e.type,this.linkedId=null!==(t=e.linkedId)&&void 0!==t?t:void 0,this.name=dN(e.name),this.value=dN(e.value))}decrypt(e){return this.decryptObj(this,new gO(this),["name","value"],e)}toFieldData(){const e=new iN;return this.buildDataModel(this,e,{name:null,value:null,type:null,linkedId:null},["type","linkedId"]),e}static fromJSON(e){var t,i;if(null==e)return;const n=new gN;return n.type=null!==(t=e.type)&&void 0!==t?t:ox.Text,n.linkedId=null!==(i=e.linkedId)&&void 0!==i?i:void 0,n.name=hN(e.name),n.value=hN(e.value),n}toSdkField(){var e,t;return{name:null===(e=this.name)||void 0===e?void 0:e.toSdk(),value:null===(t=this.value)||void 0===t?void 0:t.toSdk(),type:ax(this.type),linkedId:dx(this.linkedId)}}static fromSdkField(e){if(null==e)return;const t=new gN;return t.name=hN(e.name),t.value=hN(e.value),t.type=e.type,t.linkedId=e.linkedId,t}}class yN extends sv{constructor(e){super(),null!=e&&(this.title=dN(e.title),this.firstName=dN(e.firstName),this.middleName=dN(e.middleName),this.lastName=dN(e.lastName),this.address1=dN(e.address1),this.address2=dN(e.address2),this.address3=dN(e.address3),this.city=dN(e.city),this.state=dN(e.state),this.postalCode=dN(e.postalCode),this.country=dN(e.country),this.company=dN(e.company),this.email=dN(e.email),this.phone=dN(e.phone),this.ssn=dN(e.ssn),this.username=dN(e.username),this.passportNumber=dN(e.passportNumber),this.licenseNumber=dN(e.licenseNumber))}decrypt(e,t="No Cipher Context"){return this.decryptObj(this,new wO,["title","firstName","middleName","lastName","address1","address2","address3","city","state","postalCode","country","company","email","phone","ssn","username","passportNumber","licenseNumber"],e,"DomainType: Identity; "+t)}toIdentityData(){const e=new nN;return this.buildDataModel(this,e,{title:null,firstName:null,middleName:null,lastName:null,address1:null,address2:null,address3:null,city:null,state:null,postalCode:null,country:null,company:null,email:null,phone:null,ssn:null,username:null,passportNumber:null,licenseNumber:null}),e}static fromJSON(e){if(null==e)return;const t=new yN;return t.title=hN(e.title),t.firstName=hN(e.firstName),t.middleName=hN(e.middleName),t.lastName=hN(e.lastName),t.address1=hN(e.address1),t.address2=hN(e.address2),t.address3=hN(e.address3),t.city=hN(e.city),t.state=hN(e.state),t.postalCode=hN(e.postalCode),t.country=hN(e.country),t.company=hN(e.company),t.email=hN(e.email),t.phone=hN(e.phone),t.ssn=hN(e.ssn),t.username=hN(e.username),t.passportNumber=hN(e.passportNumber),t.licenseNumber=hN(e.licenseNumber),t}toSdkIdentity(){var e,t,i,n,r,s,o,a,l,c,u,d,h,p,v,f,m,g;return{title:null===(e=this.title)||void 0===e?void 0:e.toSdk(),firstName:null===(t=this.firstName)||void 0===t?void 0:t.toSdk(),middleName:null===(i=this.middleName)||void 0===i?void 0:i.toSdk(),lastName:null===(n=this.lastName)||void 0===n?void 0:n.toSdk(),address1:null===(r=this.address1)||void 0===r?void 0:r.toSdk(),address2:null===(s=this.address2)||void 0===s?void 0:s.toSdk(),address3:null===(o=this.address3)||void 0===o?void 0:o.toSdk(),city:null===(a=this.city)||void 0===a?void 0:a.toSdk(),state:null===(l=this.state)||void 0===l?void 0:l.toSdk(),postalCode:null===(c=this.postalCode)||void 0===c?void 0:c.toSdk(),country:null===(u=this.country)||void 0===u?void 0:u.toSdk(),company:null===(d=this.company)||void 0===d?void 0:d.toSdk(),email:null===(h=this.email)||void 0===h?void 0:h.toSdk(),phone:null===(p=this.phone)||void 0===p?void 0:p.toSdk(),ssn:null===(v=this.ssn)||void 0===v?void 0:v.toSdk(),username:null===(f=this.username)||void 0===f?void 0:f.toSdk(),passportNumber:null===(m=this.passportNumber)||void 0===m?void 0:m.toSdk(),licenseNumber:null===(g=this.licenseNumber)||void 0===g?void 0:g.toSdk()}}static fromSdkIdentity(e){if(null==e)return;const t=new yN;return t.title=hN(e.title),t.firstName=hN(e.firstName),t.middleName=hN(e.middleName),t.lastName=hN(e.lastName),t.address1=hN(e.address1),t.address2=hN(e.address2),t.address3=hN(e.address3),t.city=hN(e.city),t.state=hN(e.state),t.postalCode=hN(e.postalCode),t.country=hN(e.country),t.company=hN(e.company),t.email=hN(e.email),t.phone=hN(e.phone),t.ssn=hN(e.ssn),t.username=hN(e.username),t.passportNumber=hN(e.passportNumber),t.licenseNumber=hN(e.licenseNumber),t}}var bN=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class wN extends sv{constructor(e){super(),null!=e?(this.credentialId=new Pp(e.credentialId),this.keyType=new Pp(e.keyType),this.keyAlgorithm=new Pp(e.keyAlgorithm),this.keyCurve=new Pp(e.keyCurve),this.keyValue=new Pp(e.keyValue),this.rpId=new Pp(e.rpId),this.counter=new Pp(e.counter),this.discoverable=new Pp(e.discoverable),this.userHandle=dN(e.userHandle),this.userName=dN(e.userName),this.rpName=dN(e.rpName),this.userDisplayName=dN(e.userDisplayName),this.creationDate=new Date(e.creationDate)):this.creationDate=new Date}decrypt(e){return bN(this,void 0,void 0,function*(){const t=yield this.decryptObj(this,new SO,["credentialId","keyType","keyAlgorithm","keyCurve","keyValue","rpId","userHandle","userName","rpName","userDisplayName"],e),{counter:i}=yield this.decryptObj(this,{counter:""},["counter"],e);t.counter=parseInt(i);const{discoverable:n}=yield this.decryptObj(this,{discoverable:""},["discoverable"],e);return t.discoverable="true"===n,t.creationDate=this.creationDate,t})}toFido2CredentialData(){const e=new rN;return e.creationDate=this.creationDate.toISOString(),this.buildDataModel(this,e,{credentialId:null,keyType:null,keyAlgorithm:null,keyCurve:null,keyValue:null,rpId:null,userHandle:null,userName:null,counter:null,rpName:null,userDisplayName:null,discoverable:null}),e}static fromJSON(e){if(null==e)return;const t=new wN;return t.credentialId=Pp.fromJSON(e.credentialId),t.keyType=Pp.fromJSON(e.keyType),t.keyAlgorithm=Pp.fromJSON(e.keyAlgorithm),t.keyCurve=Pp.fromJSON(e.keyCurve),t.keyValue=Pp.fromJSON(e.keyValue),t.rpId=Pp.fromJSON(e.rpId),t.userHandle=hN(e.userHandle),t.userName=hN(e.userName),t.counter=Pp.fromJSON(e.counter),t.rpName=hN(e.rpName),t.userDisplayName=hN(e.userDisplayName),t.discoverable=Pp.fromJSON(e.discoverable),t.creationDate=new Date(e.creationDate),t}toSdkFido2Credential(){var e,t,i,n,r,s;return{credentialId:null===(e=this.credentialId)||void 0===e?void 0:e.toSdk(),keyType:this.keyType.toSdk(),keyAlgorithm:this.keyAlgorithm.toSdk(),keyCurve:this.keyCurve.toSdk(),keyValue:this.keyValue.toSdk(),rpId:this.rpId.toSdk(),userHandle:null===(t=this.userHandle)||void 0===t?void 0:t.toSdk(),userName:null===(i=this.userName)||void 0===i?void 0:i.toSdk(),counter:this.counter.toSdk(),rpName:null===(n=this.rpName)||void 0===n?void 0:n.toSdk(),userDisplayName:null===(r=this.userDisplayName)||void 0===r?void 0:r.toSdk(),discoverable:null===(s=this.discoverable)||void 0===s?void 0:s.toSdk(),creationDate:this.creationDate.toISOString()}}static fromSdkFido2Credential(e){if(null==e)return;const t=new wN;return t.credentialId=Pp.fromJSON(e.credentialId),t.keyType=Pp.fromJSON(e.keyType),t.keyAlgorithm=Pp.fromJSON(e.keyAlgorithm),t.keyCurve=Pp.fromJSON(e.keyCurve),t.keyValue=Pp.fromJSON(e.keyValue),t.rpId=Pp.fromJSON(e.rpId),t.counter=Pp.fromJSON(e.counter),t.userHandle=hN(e.userHandle),t.userName=hN(e.userName),t.rpName=hN(e.rpName),t.userDisplayName=hN(e.userDisplayName),t.discoverable=Pp.fromJSON(e.discoverable),t.creationDate=new Date(e.creationDate),t}}var SN=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class kN extends sv{constructor(e){var t;super(),null!=e&&(this.uri=dN(e.uri),this.uriChecksum=dN(e.uriChecksum),this.match=null!==(t=e.match)&&void 0!==t?t:void 0)}decrypt(e,t="No Cipher Context"){return this.decryptObj(this,new QE(this),["uri"],e,t)}validateChecksum(e,t){return SN(this,void 0,void 0,function*(){if(null==this.uriChecksum)return!1;const i=bd.getContainerService().getEncryptService(),n=yield i.hash(e,"sha256");return(yield i.decryptString(this.uriChecksum,t))===n})}toLoginUriData(){const e=new sN;return this.buildDataModel(this,e,{uri:null,uriChecksum:null,match:null},["match"]),e}static fromJSON(e){var t;if(null==e)return;const i=new kN;return i.uri=hN(e.uri),i.match=null!==(t=e.match)&&void 0!==t?t:void 0,i.uriChecksum=hN(e.uriChecksum),i}toSdkLoginUri(){var e,t;return{uri:null===(e=this.uri)||void 0===e?void 0:e.toSdk(),uriChecksum:null===(t=this.uriChecksum)||void 0===t?void 0:t.toSdk(),match:LE(this.match)}}static fromSdkLoginUri(e){if(null==e)return;const t=new kN;return t.uri=hN(e.uri),t.uriChecksum=hN(e.uriChecksum),t.match=e.match,t}}var IN=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class CN extends sv{constructor(e){super(),null!=e&&(this.passwordRevisionDate=null!=e.passwordRevisionDate?new Date(e.passwordRevisionDate):void 0,this.autofillOnPageLoad=e.autofillOnPageLoad,this.username=dN(e.username),this.password=dN(e.password),this.totp=dN(e.totp),e.uris&&(this.uris=e.uris.map(e=>new kN(e))),e.fido2Credentials&&(this.fido2Credentials=e.fido2Credentials.map(e=>new wN(e))))}decrypt(e,t){return IN(this,arguments,void 0,function*(e,t,i="No Cipher Context"){const n=yield this.decryptObj(this,new CO(this),["username","password","totp"],t,`DomainType: Login; ${i}`);if(null!=this.uris){n.uris=[];for(let r=0;r<this.uris.length;r++){if(null==this.uris[r].uri)continue;const s=yield this.uris[r].decrypt(t,i),o=s.uri;if(null==o)continue;(e||(yield this.uris[r].validateChecksum(o,t)))&&n.uris.push(s)}}return null!=this.fido2Credentials&&(n.fido2Credentials=yield Promise.all(this.fido2Credentials.map(e=>e.decrypt(t)))),n})}toLoginData(){const e=new oN;return null!=this.passwordRevisionDate&&(e.passwordRevisionDate=this.passwordRevisionDate.toISOString()),null!=this.autofillOnPageLoad&&(e.autofillOnPageLoad=this.autofillOnPageLoad),this.buildDataModel(this,e,{username:null,password:null,totp:null}),null!=this.uris&&this.uris.length>0&&(e.uris=this.uris.map(e=>e.toLoginUriData())),null!=this.fido2Credentials&&this.fido2Credentials.length>0&&(e.fido2Credentials=this.fido2Credentials.map(e=>e.toFido2CredentialData())),e}static fromJSON(e){var t,i,n;if(null==e)return;const r=new CN;return r.passwordRevisionDate=null!=e.passwordRevisionDate?new Date(e.passwordRevisionDate):void 0,r.autofillOnPageLoad=e.autofillOnPageLoad,r.username=hN(e.username),r.password=hN(e.password),r.totp=hN(e.totp),r.uris=null===(t=e.uris)||void 0===t?void 0:t.map(e=>kN.fromJSON(e)).filter(e=>null!=e),r.fido2Credentials=null!==(n=null===(i=e.fido2Credentials)||void 0===i?void 0:i.map(e=>wN.fromJSON(e)).filter(e=>null!=e))&&void 0!==n?n:void 0,r}toSdkLogin(){var e,t,i,n,r,s,o;return{uris:null===(e=this.uris)||void 0===e?void 0:e.map(e=>e.toSdkLoginUri()),username:null===(t=this.username)||void 0===t?void 0:t.toSdk(),password:null===(i=this.password)||void 0===i?void 0:i.toSdk(),passwordRevisionDate:null===(n=this.passwordRevisionDate)||void 0===n?void 0:n.toISOString(),totp:null===(r=this.totp)||void 0===r?void 0:r.toSdk(),autofillOnPageLoad:null!==(s=this.autofillOnPageLoad)&&void 0!==s?s:void 0,fido2Credentials:null===(o=this.fido2Credentials)||void 0===o?void 0:o.map(e=>e.toSdkFido2Credential())}}static fromSdkLogin(e){var t,i,n,r;if(!e)return;const s=new CN;return s.passwordRevisionDate=null!=e.passwordRevisionDate?new Date(e.passwordRevisionDate):void 0,s.autofillOnPageLoad=e.autofillOnPageLoad,s.username=hN(e.username),s.password=hN(e.password),s.totp=hN(e.totp),s.uris=null!==(i=null===(t=e.uris)||void 0===t?void 0:t.filter(e=>null!=e.uri).map(e=>kN.fromSdkLoginUri(e)).filter(e=>null!=e))&&void 0!==i?i:void 0,s.fido2Credentials=null!==(r=null===(n=e.fido2Credentials)||void 0===n?void 0:n.map(e=>wN.fromSdkFido2Credential(e)).filter(e=>null!=e))&&void 0!==r?r:void 0,s}}class TN extends sv{constructor(e){super(),null!=e&&(this.password=new Pp(e.password),this.lastUsedDate=new Date(e.lastUsedDate))}decrypt(e){return this.decryptObj(this,new TO(this),["password"],e,"DomainType: PasswordHistory")}toPasswordHistoryData(){const e=new aN;return e.lastUsedDate=this.lastUsedDate.toISOString(),this.buildDataModel(this,e,{password:null}),e}static fromJSON(e){if(null==e)return;const t=new TN;return t.password=Pp.fromJSON(e.password),t.lastUsedDate=new Date(e.lastUsedDate),t}toSdkPasswordHistory(){return{password:this.password.toSdk(),lastUsedDate:this.lastUsedDate.toISOString()}}static fromSdkPasswordHistory(e){if(!e)return;const t=new TN;return t.password=Pp.fromJSON(e.password),t.lastUsedDate=new Date(e.lastUsedDate),t}}var PN=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class FN extends sv{constructor(e){super(),this.type=hx,null!=e&&(this.type=e.type)}decrypt(){return PN(this,void 0,void 0,function*(){return new PO(this)})}toSecureNoteData(){const e=new lN;return e.type=this.type,e}static fromJSON(e){if(null==e)return;const t=new FN;return t.type=e.type,t}toSdkSecureNote(){return{type:(this.type,hx)}}static fromSdkSecureNote(e){if(null==e)return;const t=new FN;return t.type=e.type,t}}class RN extends sv{constructor(e){super(),null!=e&&(this.privateKey=new Pp(e.privateKey),this.publicKey=new Pp(e.publicKey),this.keyFingerprint=new Pp(e.keyFingerprint))}decrypt(e,t="No Cipher Context"){return this.decryptObj(this,new FO,["privateKey","publicKey","keyFingerprint"],e,"DomainType: SshKey; "+t)}toSshKeyData(){const e=new cN;return this.buildDataModel(this,e,{privateKey:null,publicKey:null,keyFingerprint:null}),e}static fromJSON(e){if(null==e)return;const t=new RN;return t.privateKey=Pp.fromJSON(e.privateKey),t.publicKey=Pp.fromJSON(e.publicKey),t.keyFingerprint=Pp.fromJSON(e.keyFingerprint),t}toSdkSshKey(){return{privateKey:this.privateKey.toSdk(),publicKey:this.publicKey.toSdk(),fingerprint:this.keyFingerprint.toSdk()}}static fromSdkSshKey(e){if(null==e)return;const t=new RN;return t.privateKey=Pp.fromJSON(e.privateKey),t.publicKey=Pp.fromJSON(e.publicKey),t.keyFingerprint=Pp.fromJSON(e.fingerprint),t}}var xN=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class AN extends sv{constructor(e,t){var i;if(super(),this.initializerKey=aO.Cipher,this.id="",this.name=new Pp(""),this.type=nx.Login,this.favorite=!1,this.organizationUseTotp=!1,this.edit=!1,this.viewPassword=!0,this.collectionIds=[],this.reprompt=tx.None,null!=e){switch(this.id=e.id,this.organizationId=e.organizationId,this.folderId=e.folderId,this.name=new Pp(e.name),this.notes=dN(e.notes),this.type=e.type,this.favorite=e.favorite,this.organizationUseTotp=e.organizationUseTotp,this.edit=e.edit,this.viewPassword=e.viewPassword,this.permissions=e.permissions,this.revisionDate=new Date(e.revisionDate),this.localData=t,this.collectionIds=null!==(i=e.collectionIds)&&void 0!==i?i:[],this.creationDate=new Date(e.creationDate),this.deletedDate=null!=e.deletedDate?new Date(e.deletedDate):void 0,this.archivedDate=null!=e.archivedDate?new Date(e.archivedDate):void 0,this.reprompt=e.reprompt,this.key=dN(e.key),this.type){case nx.Login:this.login=new CN(e.login);break;case nx.SecureNote:this.secureNote=new FN(e.secureNote);break;case nx.Card:this.card=new mN(e.card);break;case nx.Identity:this.identity=new yN(e.identity);break;case nx.SshKey:this.sshKey=new RN(e.sshKey)}null!=e.attachments&&(this.attachments=e.attachments.map(e=>new vN(e))),null!=e.fields&&(this.fields=e.fields.map(e=>new gN(e))),null!=e.passwordHistory&&(this.passwordHistory=e.passwordHistory.map(e=>new TN(e)))}else this.creationDate=this.revisionDate=new Date}decrypt(e){return xN(this,void 0,void 0,function*(){ak(e,"userKeyOrOrgKey","Cipher decryption");const t=new RO(this);let i=!0,n=e;if(null!=this.key){const r=bd.getContainerService().getEncryptService();try{n=yield r.unwrapSymmetricKey(this.key,e),i=!1}catch(e){return t.name="[error: cannot decrypt]",t.decryptionFailure=!0,t}}switch(yield this.decryptObj(this,t,["name","notes"],n),this.type){case nx.Login:null!=this.login&&(t.login=yield this.login.decrypt(i,n,`Cipher Id: ${this.id}`));break;case nx.SecureNote:null!=this.secureNote&&(t.secureNote=yield this.secureNote.decrypt());break;case nx.Card:null!=this.card&&(t.card=yield this.card.decrypt(n,`Cipher Id: ${this.id}`));break;case nx.Identity:null!=this.identity&&(t.identity=yield this.identity.decrypt(n,`Cipher Id: ${this.id}`));break;case nx.SshKey:null!=this.sshKey&&(t.sshKey=yield this.sshKey.decrypt(n,`Cipher Id: ${this.id}`))}if(null!=this.attachments&&this.attachments.length>0){const e=[];for(const t of this.attachments){const i=yield t.decrypt(n,`Cipher Id: ${this.id}`);e.push(i)}t.attachments=e}if(null!=this.fields&&this.fields.length>0){const e=[];for(const t of this.fields){const i=yield t.decrypt(n);e.push(i)}t.fields=e}if(null!=this.passwordHistory&&this.passwordHistory.length>0){const e=[];for(const t of this.passwordHistory){const i=yield t.decrypt(n);e.push(i)}t.passwordHistory=e}return t})}toCipherData(){const e=new uN;switch(e.id=this.id,null!=this.organizationId&&(e.organizationId=this.organizationId),null!=this.folderId&&(e.folderId=this.folderId),e.edit=this.edit,e.viewPassword=this.viewPassword,e.organizationUseTotp=this.organizationUseTotp,e.favorite=this.favorite,e.revisionDate=this.revisionDate.toISOString(),e.type=this.type,e.collectionIds=this.collectionIds,e.creationDate=this.creationDate.toISOString(),e.deletedDate=null!=this.deletedDate?this.deletedDate.toISOString():void 0,e.reprompt=this.reprompt,null!=this.key&&null!=this.key.encryptedString&&(e.key=this.key.encryptedString),null!=this.permissions&&(e.permissions=this.permissions),e.archivedDate=null!=this.archivedDate?this.archivedDate.toISOString():void 0,this.buildDataModel(this,e,{name:null,notes:null}),e.type){case nx.Login:null!=this.login&&(e.login=this.login.toLoginData());break;case nx.SecureNote:null!=this.secureNote&&(e.secureNote=this.secureNote.toSecureNoteData());break;case nx.Card:null!=this.card&&(e.card=this.card.toCardData());break;case nx.Identity:null!=this.identity&&(e.identity=this.identity.toIdentityData());break;case nx.SshKey:null!=this.sshKey&&(e.sshKey=this.sshKey.toSshKeyData())}return null!=this.fields&&(e.fields=this.fields.map(e=>e.toFieldData())),null!=this.attachments&&(e.attachments=this.attachments.map(e=>e.toAttachmentData())),null!=this.passwordHistory&&(e.passwordHistory=this.passwordHistory.map(e=>e.toPasswordHistoryData())),e}static fromJSON(e){var t,i,n;if(null==e)return;const r=new AN;switch(r.id=e.id,r.organizationId=e.organizationId,r.folderId=e.folderId,r.type=e.type,r.favorite=e.favorite,r.organizationUseTotp=e.organizationUseTotp,r.edit=e.edit,r.viewPassword=e.viewPassword,null!=e.permissions&&(r.permissions=new oA(e.permissions)),r.collectionIds=e.collectionIds,r.localData=e.localData,r.reprompt=e.reprompt,r.creationDate=new Date(e.creationDate),r.revisionDate=new Date(e.revisionDate),r.deletedDate=null!=e.deletedDate?new Date(e.deletedDate):void 0,r.archivedDate=null!=e.archivedDate?new Date(e.archivedDate):void 0,r.name=Pp.fromJSON(e.name),r.notes=hN(e.notes),r.key=hN(e.key),r.attachments=null===(t=e.attachments)||void 0===t?void 0:t.map(e=>vN.fromJSON(e)).filter(e=>null!=e),r.fields=null===(i=e.fields)||void 0===i?void 0:i.map(e=>gN.fromJSON(e)).filter(e=>null!=e),r.passwordHistory=null===(n=e.passwordHistory)||void 0===n?void 0:n.map(e=>TN.fromJSON(e)).filter(e=>null!=e),e.type){case nx.Card:null!=e.card&&(r.card=mN.fromJSON(e.card));break;case nx.Identity:null!=e.identity&&(r.identity=yN.fromJSON(e.identity));break;case nx.Login:null!=e.login&&(r.login=CN.fromJSON(e.login));break;case nx.SecureNote:null!=e.secureNote&&(r.secureNote=FN.fromJSON(e.secureNote));break;case nx.SshKey:null!=e.sshKey&&(r.sshKey=RN.fromJSON(e.sshKey))}return r}toSdkCipher(){var e,t,i,n,r,s,o;const a={id:this.id?Yk(this.id):void 0,organizationId:this.organizationId?Yk(this.organizationId):void 0,folderId:this.folderId?Yk(this.folderId):void 0,collectionIds:this.collectionIds?this.collectionIds.map(Yk):[],key:null===(e=this.key)||void 0===e?void 0:e.toSdk(),name:this.name.toSdk(),notes:null===(t=this.notes)||void 0===t?void 0:t.toSdk(),type:this.type,favorite:this.favorite,organizationUseTotp:this.organizationUseTotp,edit:this.edit,permissions:this.permissions?{delete:this.permissions.delete,restore:this.permissions.restore}:void 0,viewPassword:this.viewPassword,localData:cO(this.localData),attachments:null===(i=this.attachments)||void 0===i?void 0:i.map(e=>e.toSdkAttachment()),fields:null===(n=this.fields)||void 0===n?void 0:n.map(e=>e.toSdkField()),passwordHistory:null===(r=this.passwordHistory)||void 0===r?void 0:r.map(e=>e.toSdkPasswordHistory()),revisionDate:this.revisionDate.toISOString(),creationDate:this.creationDate.toISOString(),deletedDate:null===(s=this.deletedDate)||void 0===s?void 0:s.toISOString(),archivedDate:null===(o=this.archivedDate)||void 0===o?void 0:o.toISOString(),reprompt:ix(this.reprompt),login:void 0,identity:void 0,card:void 0,secureNote:void 0,sshKey:void 0,data:void 0};switch(this.type){case nx.Login:null!=this.login&&(a.login=this.login.toSdkLogin());break;case nx.SecureNote:null!=this.secureNote&&(a.secureNote=this.secureNote.toSdkSecureNote());break;case nx.Card:null!=this.card&&(a.card=this.card.toSdkCard());break;case nx.Identity:null!=this.identity&&(a.identity=this.identity.toSdkIdentity());break;case nx.SshKey:null!=this.sshKey&&(a.sshKey=this.sshKey.toSdkSshKey())}return a}static fromSdkCipher(e){var t,i,n;if(null==e)return;const r=new AN;return r.id=e.id?e.id:"",r.organizationId=e.organizationId?e.organizationId:void 0,r.folderId=e.folderId?e.folderId:void 0,r.collectionIds=e.collectionIds?e.collectionIds.map(Hk):[],r.key=hN(e.key),r.name=Pp.fromJSON(e.name),r.notes=hN(e.notes),r.type=e.type,r.favorite=e.favorite,r.organizationUseTotp=e.organizationUseTotp,r.edit=e.edit,r.permissions=oA.fromSdkCipherPermissions(e.permissions),r.viewPassword=e.viewPassword,r.localData=lO(e.localData),r.attachments=null===(t=e.attachments)||void 0===t?void 0:t.map(e=>vN.fromSdkAttachment(e)).filter(e=>null!=e),r.fields=null===(i=e.fields)||void 0===i?void 0:i.map(e=>gN.fromSdkField(e)).filter(e=>null!=e),r.passwordHistory=null===(n=e.passwordHistory)||void 0===n?void 0:n.map(e=>TN.fromSdkPasswordHistory(e)).filter(e=>null!=e),r.creationDate=new Date(e.creationDate),r.revisionDate=new Date(e.revisionDate),r.deletedDate=e.deletedDate?new Date(e.deletedDate):void 0,r.archivedDate=e.archivedDate?new Date(e.archivedDate):void 0,r.reprompt=e.reprompt,r.login=CN.fromSdkLogin(e.login),r.secureNote=FN.fromSdkSecureNote(e.secureNote),r.card=mN.fromSdkCard(e.card),r.identity=yN.fromSdkIdentity(e.identity),r.sshKey=RN.fromSdkSshKey(e.sshKey),r}}var DN=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class EN{constructor(e,t,i,n,r,s){this.toastService=e,this.i18nService=t,this.cipherService=i,this.logService=n,this.dialogService=r,this.accountService=s,this.admin=!1,this.onDeletionSuccess=new Fl.bkB,this.delete=()=>DN(this,void 0,void 0,function*(){if(yield this.dialogService.openSimpleDialog({title:{key:"deleteAttachment"},content:{key:"permanentlyDeleteAttachmentConfirmation"},type:"warning"}))try{const e=yield(0,bo._)(this.accountService.activeAccount$.pipe(nv));if(null==e)throw new Error("An active user is expected while deleting an attachment.");yield this.cipherService.deleteAttachmentWithServer(this.cipherId,this.attachment.id,e,this.admin),this.toastService.showToast({variant:"success",title:"",message:this.i18nService.t("deletedAttachment")}),this.onDeletionSuccess.emit()}catch(e){this.logService.error(e)}})}}EN.ɵfac=function(e){return new(e||EN)(Fl.rXU(qb),Fl.rXU(Ul),Fl.rXU(_b),Fl.rXU(Za),Fl.rXU(lh),Fl.rXU(Zk))},EN.ɵcmp=Fl.VBU({type:EN,selectors:[["app-delete-attachment"]],inputs:{cipherId:"cipherId",attachment:"attachment",admin:"admin"},outputs:{onDeletionSuccess:"onDeletionSuccess"},decls:2,vars:5,consts:[["bitIconButton","bwi-trash","buttonType","danger","size","small","type","button",1,"tw-border-transparent",3,"label","bitAction"]],template:function(e,t){1&e&&(Fl.nrm(0,"button",0),Fl.nI1(1,"i18n")),2&e&&Fl.Y8G("label",Fl.i5U(1,2,"deleteAttachmentName",t.attachment.fileName))("bitAction",t.delete)},dependencies:[pc,Bd,kl.MD,sf,id,Ql,Zl,rf],encapsulation:2});var $N=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const ON=["fileInput"],UN=(e,t)=>t.id;function MN(e,t){1&e&&(Fl.nrm(0,"i",6),Fl.nI1(1,"i18n")),2&e&&Fl.Y8G("appA11yTitle",Fl.bMT(1,1,"fixEncryptionTooltip"))}function NN(e,t){if(1&e&&Fl.nrm(0,"app-download-attachment",8),2&e){let e;const t=Fl.XpG(2).$implicit,i=Fl.XpG(2);Fl.Y8G("admin",i.admin()&&(null==(e=i.organization())?null:e.canEditAllCiphers))("cipher",i.cipher())("attachment",t)}}function VN(e,t){if(1&e&&(Fl.j41(0,"button",9),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(2).$implicit,t=Fl.XpG(2);Fl.Y8G("bitAction",t.fixOldAttachment(e)),Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,2,"fixEncryption")," ")}}function BN(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-item-action")(1,"app-delete-attachment",10),Fl.bIt("onDeletionSuccess",function(){a.eBV(e);const t=Fl.XpG(2).$implicit,i=Fl.XpG(2);return a.Njj(i.removeAttachment(t))}),Fl.k0s()()}if(2&e){let e;const t=Fl.XpG(2).$implicit,i=Fl.XpG(2);Fl.R7$(),Fl.Y8G("admin",i.admin()&&(null==(e=i.organization())?null:e.canEditAllCiphers))("cipherId",i.cipher().id)("attachment",t)}}function jN(e,t){if(1&e&&(Fl.j41(0,"bit-item")(1,"bit-item-content")(2,"span",4),Fl.EFF(3),Fl.k0s(),Fl.j41(4,"span",5),Fl.EFF(5),Fl.k0s(),Fl.nVh(6,MN,2,3,"i",6),Fl.k0s(),Fl.qex(7,7),Fl.j41(8,"bit-item-action"),Fl.nVh(9,NN,1,3,"app-download-attachment",8)(10,VN,3,4,"button",9),Fl.k0s(),Fl.nVh(11,BN,2,3,"bit-item-action"),Fl.bVm(),Fl.k0s()),2&e){const e=Fl.XpG().$implicit,t=Fl.XpG(2);Fl.R7$(2),Fl.Y8G("title",e.fileName),Fl.R7$(),Fl.SpI(" ",e.fileName," "),Fl.R7$(2),Fl.JRh(e.sizeName),Fl.R7$(),Fl.vxM(null==e.key?6:-1),Fl.R7$(3),Fl.vxM(null!=e.key?9:10),Fl.R7$(2),Fl.vxM(t.cipher().edit?11:-1)}}function GN(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-item-action")(1,"app-delete-attachment",10),Fl.bIt("onDeletionSuccess",function(){a.eBV(e);const t=Fl.XpG(2).$implicit,i=Fl.XpG(2);return a.Njj(i.removeAttachment(t))}),Fl.k0s()()}if(2&e){let e;const t=Fl.XpG(2).$implicit,i=Fl.XpG(2);Fl.R7$(),Fl.Y8G("admin",i.admin()&&(null==(e=i.organization())?null:e.canEditAllCiphers))("cipherId",i.cipher().id)("attachment",t)}}function LN(e,t){if(1&e&&(Fl.j41(0,"bit-item")(1,"bit-item-content")(2,"span",4),Fl.nI1(3,"i18n"),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()(),Fl.qex(6,7),Fl.nVh(7,GN,2,3,"bit-item-action"),Fl.bVm(),Fl.k0s()),2&e){const e=Fl.XpG(3);Fl.R7$(2),Fl.Y8G("title",Fl.bMT(3,3,"errorCannotDecrypt")),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(5,5,"errorCannotDecrypt")," "),Fl.R7$(3),Fl.vxM(e.cipher().edit?7:-1)}}function zN(e,t){if(1&e&&(Fl.j41(0,"li"),Fl.nVh(1,jN,12,6,"bit-item")(2,LN,8,7,"bit-item"),Fl.k0s()),2&e){const e=t.$implicit;Fl.R7$(),Fl.vxM(e.hasDecryptionError?2:1)}}function _N(e,t){1&e&&(Fl.j41(0,"ul",2),Fl.Z7z(1,zN,3,1,"li",null,UN),Fl.k0s()),2&e&&(Fl.R7$(),Fl.Dyx(t))}function KN(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-card")(1,"label",11),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"div",12)(5,"input",13,0),Fl.bIt("change",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.onFileChange(t))}),Fl.k0s(),Fl.j41(7,"div",14)(8,"button",15),Fl.bIt("click",function(){a.eBV(e);const t=Fl.sdS(6);return a.Njj(t.click())}),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s(),Fl.j41(11,"p",16),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s()()(),Fl.j41(14,"p",17),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s()()}if(2&e){const e=Fl.XpG();Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,4,"addAttachment")," "),Fl.R7$(7),Fl.SpI(" ",Fl.bMT(10,6,"chooseFile")," "),Fl.R7$(3),Fl.SpI(" ",null!=e.attachmentForm.controls.file&&e.attachmentForm.controls.file.value?e.attachmentForm.controls.file.value.name:Fl.bMT(13,8,"noFileChosen")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(16,10,"maxFileSizeSansPunctuation")," ")}}class XN{constructor(e,t,i,n,r,s,l,c){this.cipherService=e,this.i18nService=t,this.formBuilder=i,this.logService=n,this.toastService=r,this.accountService=s,this.apiService=l,this.organizationService=c,this.fileInput=(0,o.ebz)("fileInput",{read:Fl.aKT}),this.bitSubmit=(0,o.ebz)(Md),this.cipherId=o.hFB.required(),this.organizationId=(0,o.hFB)(),this.admin=(0,o.hFB)(!1),this.submitBtn=(0,o.hFB)(),this.onUploadStarted=(0,o.CGW)(),this.onUploadSuccess=(0,o.CGW)(),this.onUploadFailed=(0,o.CGW)(),this.onRemoveSuccess=(0,o.CGW)(),this.onCloseButtonPress=(0,o.CGW)(),this.organization=(0,a.vPA)(null),this.cipher=(0,a.vPA)(null),this.attachmentForm=this.formBuilder.group({file:new Il.MJ(null,[Il.k0.required])}),this.cipherDomain=null,this.activeUserId=null,this.destroyRef=(0,a.WQX)(a.abz),this.submit=()=>$N(this,void 0,void 0,function*(){var e,t,i;if(null===(t=null===(e=this.cipher())||void 0===e?void 0:e.edit)||void 0===t||!t)return void this.onCloseButtonPress.emit();this.onUploadStarted.emit();const n=this.attachmentForm.value.file;if(null!=n){if(n.size>524288e3)this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("maxFileSize")});else if(this.cipherDomain&&this.activeUserId)try{this.cipherDomain=yield this.cipherService.saveAttachmentWithServer(this.cipherDomain,n,this.activeUserId,null===(i=this.organization())||void 0===i?void 0:i.canEditAllCiphers),this.cipher.set(yield this.cipherService.decrypt(this.cipherDomain,this.activeUserId));const e=this.fileInput();e&&(e.nativeElement.value=""),this.attachmentForm.controls.file.setValue(null),this.toastService.showToast({variant:"success",message:this.i18nService.t("attachmentSaved")}),this.onUploadSuccess.emit()}catch(e){this.logService.error(e);let t=this.i18nService.t("unexpectedError");"string"==typeof e?t=e:e instanceof Error&&(null==e?void 0:e.message)&&(t=e.message),this.toastService.showToast({variant:"error",message:t}),this.onUploadFailed.emit()}}else this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("selectFile")})}),this.fixOldAttachment=e=>()=>$N(this,void 0,void 0,function*(){const t=this.cipher(),i=this.activeUserId;if(e.id&&i&&t)try{const n=yield this.cipherService.upgradeOldCipherAttachments(t,i,e.id);this.cipher.set(n),this.toastService.showToast({variant:"success",message:this.i18nService.t("attachmentUpdated")}),this.onUploadSuccess.emit()}catch(e){this.toastService.showToast({variant:"error",message:this.i18nService.t("errorOccurred")})}else this.toastService.showToast({variant:"error",message:this.i18nService.t("errorOccurred")})}),this.attachmentForm.statusChanges.pipe((0,xl.pQ)()).subscribe(e=>{const t=this.submitBtn();t&&t.disabled.set("VALID"!==e)}),(0,Rl.QZ)(()=>$N(this,void 0,void 0,function*(){var e,t;const i=this.cipherId();if(!i)return;this.activeUserId=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv)),this.organization.set(yield this.getOrganization()),this.cipherDomain=yield this.getCipher(i),this.cipherDomain&&this.activeUserId&&this.cipher.set(yield this.cipherService.decrypt(this.cipherDomain,this.activeUserId));const n=this.submitBtn();n&&n.disabled.set(!this.attachmentForm.valid&&(null===(t=null===(e=this.cipher())||void 0===e?void 0:e.edit)||void 0===t||t))})),(0,Rl.QZ)(()=>{const e=this.bitSubmit(),t=this.submitBtn();e&&t&&(e.loading$.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{t.loading.set(e)}),e.disabled$.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{t.disabled.set(e)}))})}get attachmentFormId(){return XN.attachmentFormID}onFileChange(e){const t=e.target;t.files&&t.files.length>0&&this.attachmentForm.controls.file.setValue(t.files[0])}removeAttachment(e){const t=this.cipher();if(!(null==t?void 0:t.attachments))return;const i=t.attachments.indexOf(e);i>-1&&(t.attachments.splice(i,1),this.cipher.set(Object.assign(Object.create(Object.getPrototypeOf(t)),t))),this.onRemoveSuccess.emit()}getCipher(e){return $N(this,void 0,void 0,function*(){if(null==e||!this.activeUserId)return null;const t=yield this.cipherService.get(e,this.activeUserId);if(null!=t||!this.organizationId())return t;const i=this.organization();if(null!=i&&i.canEditAllCiphers){const t=yield this.apiService.getCipherAdmin(e),i=new uN(t);return new AN(i)}return null})}getOrganization(){return $N(this,void 0,void 0,function*(){const e=this.organizationId();if(!e||!this.activeUserId)return null;return(yield(0,bo._)(this.organizationService.organizations$(this.activeUserId))).find(t=>t.id===e)||null})}}function qN(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"app-cipher-attachments",7),Fl.bIt("onUploadStarted",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.uploadStarted())})("onUploadSuccess",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.uploadSuccessful())})("onUploadFailed",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.uploadFailed())})("onRemoveSuccess",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.removalSuccessful())})("onCloseButtonPress",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.closeButtonPressed())}),Fl.k0s()}if(2&e){const e=Fl.XpG(),t=Fl.sdS(8);Fl.Y8G("cipherId",e.cipherId)("organizationId",e.organizationId)("admin",e.admin)("submitBtn",t)}}XN.attachmentFormID="attachmentForm",XN.ɵfac=function(e){return new(e||XN)(Fl.rXU(_b),Fl.rXU(Ul),Fl.rXU(Il.ok),Fl.rXU(Za),Fl.rXU(qb),Fl.rXU(Zk),Fl.rXU(eI),Fl.rXU(WF))},XN.ɵcmp=Fl.VBU({type:XN,selectors:[["app-cipher-attachments"]],viewQuery:function(e,t){1&e&&(Fl.wEZ(t.fileInput,ON,5,Fl.aKT),Fl.wEZ(t.bitSubmit,Md,5)),2&e&&Fl.NyB(2)},inputs:{cipherId:[1,"cipherId"],organizationId:[1,"organizationId"],admin:[1,"admin"],submitBtn:[1,"submitBtn"]},outputs:{onUploadStarted:"onUploadStarted",onUploadSuccess:"onUploadSuccess",onUploadFailed:"onUploadFailed",onRemoveSuccess:"onRemoveSuccess",onCloseButtonPress:"onCloseButtonPress"},decls:6,vars:8,consts:[["fileInput",""],["id","attachments",1,"tw-sr-only"],["aria-labelledby","attachments",1,"tw-list-none","tw-pl-0"],[3,"id","formGroup","bitSubmit"],["data-testid","file-name",3,"title"],["slot","secondary","data-testid","file-size"],["slot","default-trailing",1,"bwi","bwi-exclamation-triangle","bwi-sm","tw-text-muted",3,"appA11yTitle"],["slot","end"],[3,"admin","cipher","attachment"],["bitButton","","buttonType","primary","size","small","type","button",3,"bitAction"],[3,"onDeletionSuccess","admin","cipherId","attachment"],["for","file","bitTypography","body2",1,"tw-block","tw-text-muted","tw-px-1","tw-pb-1.5"],[1,"tw-relative"],["type","file","id","file","name","file","aria-describedby","fileHelp","tabindex","-1","required","",1,"tw-sr-only",3,"change"],["aria-hidden","true",1,"tw-flex","tw-gap-2","tw-items-center"],["bitButton","","buttonType","secondary","type","button",1,"tw-whitespace-nowrap",3,"click"],["bitTypography","body2",1,"tw-text-muted","tw-mb-0"],["id","fileHelp","bitTypography","helper",1,"tw-text-muted","tw-px-1","tw-pt-1","tw-mb-0"]],template:function(e,t){if(1&e&&(Fl.j41(0,"h2",1),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s(),Fl.nVh(3,_N,3,0,"ul",2),Fl.j41(4,"form",3),Fl.nVh(5,KN,17,12,"bit-card"),Fl.k0s()),2&e){let e,i;Fl.R7$(),Fl.JRh(Fl.bMT(2,6,"attachments")),Fl.R7$(2),Fl.vxM((e=null==(e=t.cipher())?null:e.attachments)?3:-1,e),Fl.R7$(),Fl.Y8G("id",t.attachmentFormId)("formGroup",t.attachmentForm)("bitSubmit",t.submit),Fl.R7$(),Fl.vxM(null!=(i=t.cipher())&&i.edit?5:-1)}},dependencies:[pc,Bd,Md,id,td,kl.MD,VP,GP,KP,BP,sf,rw,Il.X1,Il.qT,Il.cb,Il.j4,tc,rc,Ex,EN,EO,rf],encapsulation:2,changeDetection:0});const WN="uploaded",YN="removed",HN="closed";class JN{constructor(e,t,i){var n,r;this.dialogRef=e,this.params=t,this.i18nService=i,this.admin=!1,this.attachmentFormId=XN.attachmentFormID,this.isUploading=!1,this.handleBeforeUnloadEvent=e=>{if(this.isUploading){e.preventDefault();const t="Upload in progress. Are you sure you want to leave?";return e.returnValue=t,t}},this.cipherId=t.cipherId,this.organizationId=t.organizationId,this.admin=null!==(n=t.admin)&&void 0!==n&&n,this.canEditCipher=null!==(r=null==t?void 0:t.canEditCipher)&&void 0!==r&&r,this.buttonText=this.canEditCipher||this.admin?this.i18nService.t("upload"):this.i18nService.t("close")}static open(e,t){return e.open(JN,{data:t})}uploadStarted(){this.isUploading=!0,this.dialogRef.disableClose=!0}uploadSuccessful(){this.isUploading=!1,this.dialogRef.disableClose=!1,this.dialogRef.close({action:WN})}uploadFailed(){this.isUploading=!1,this.dialogRef.disableClose=!1}removalSuccessful(){this.dialogRef.close({action:YN})}closeButtonPressed(){this.dialogRef.close({action:HN})}}JN.ɵfac=function(e){return new(e||JN)(Fl.rXU(nh),Fl.rXU(pd.Qs),Fl.rXU(Ul))},JN.ɵcmp=Fl.VBU({type:JN,selectors:[["app-vault-attachments-v2"]],hostBindings:function(e,t){1&e&&Fl.bIt("beforeunload",function(e){return t.handleBeforeUnloadEvent(e)},Fl.tSv)},decls:10,vars:6,consts:[["submitBtn",""],["dialogSize","default","background","alt"],["bitDialogTitle",""],["bitDialogContent",""],[3,"cipherId","organizationId","admin","submitBtn","onUploadStarted","onUploadSuccess","onUploadFailed","onRemoveSuccess","onCloseButtonPress",4,"ngIf"],["bitDialogFooter",""],["bitButton","","type","submit","buttonType","primary"],[3,"onUploadStarted","onUploadSuccess","onUploadFailed","onRemoveSuccess","onCloseButtonPress","cipherId","organizationId","admin","submitBtn"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-dialog",1)(1,"span",2),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.qex(4,3),Fl.DNE(5,qN,1,4,"app-cipher-attachments",4),Fl.bVm(),Fl.qex(6,5),Fl.j41(7,"button",6,0),Fl.EFF(9),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,4,"attachments")," "),Fl.R7$(3),Fl.Y8G("ngIf",t.cipherId),Fl.R7$(2),Fl.BMQ("form",t.attachmentFormId),Fl.R7$(2),Fl.SpI(" ",t.buttonText," "))},dependencies:[id,td,kl.MD,kl.bT,Fh,Ph,XN,sc],encapsulation:2});class ZN{}class QN{}class eV{}class tV{constructor(){this.viewCacheService=(0,a.WQX)(II),this.cipherCache=this.viewCacheService.signal({key:"cipher-form-cache",initialValue:null,deserializer:RO.fromJSON}),this.initializedWithValue=!!this.cipherCache(),this.initialCacheValue=this.cipherCache()}cacheCipherView(e){this.cipherCache.set(RO.fromJSON(e))}getCachedCipherView(){return this.initialCacheValue}clearCache(){this.initialCacheValue=null,this.cipherCache.set(null)}}function iV(e,t){if(1&e&&Fl.nrm(0,"bit-option",12),2&e){const e=t.$implicit;Fl.Y8G("value",e.value)("label",e.name)}}function nV(e,t){if(1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"bit-select",10),Fl.DNE(5,iV,1,2,"bit-option",11),Fl.k0s(),Fl.j41(6,"bit-hint"),Fl.EFF(7),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.JRh(Fl.bMT(3,3,"fieldType")),Fl.R7$(3),Fl.Y8G("ngForOf",e.fieldTypeOptions),Fl.R7$(2),Fl.SpI(" ",e.getTypeHint()," ")}}function rV(e,t){1&e&&(Fl.j41(0,"bit-hint"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"linkedLabelHelpText")," "))}function sV(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",13),Fl.nI1(1,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.removeField())}),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.Y8G("label",Fl.i5U(1,1,"deleteCustomField",e.customFieldForm.value.label))}}tV.ɵfac=function(e){return new(e||tV)},tV.ɵprov=a.jDH({token:tV,factory:tV.ɵfac});class oV{constructor(e,t,i){this.data=e,this.formBuilder=t,this.i18nService=i,this.customFieldForm=this.formBuilder.group({type:ox.Text,label:["",Il.k0.required]}),this.fieldTypeOptions=[{name:this.i18nService.t("cfTypeText"),value:ox.Text},{name:this.i18nService.t("cfTypeHidden"),value:ox.Hidden},{name:this.i18nService.t("cfTypeCheckbox"),value:ox.Boolean},{name:this.i18nService.t("cfTypeLinked"),value:ox.Linked}],this.FieldType=ox,this.submit=()=>{"add"===this.variant?this.addField():this.updateLabel()},this.variant=e.editLabelConfig?"edit":"add",this.fieldTypeOptions=this.fieldTypeOptions.filter(e=>(!this.data.disallowHiddenField||e.value!==ox.Hidden)&&(this.data.cipherType!==nx.SecureNote&&this.data.cipherType!==nx.SshKey||e.value!==ox.Linked)),"edit"===this.variant&&(this.customFieldForm.controls.label.setValue(e.editLabelConfig.label),this.customFieldForm.controls.type.disable())}getTypeHint(){var e;switch(null===(e=this.customFieldForm.get("type"))||void 0===e?void 0:e.value){case ox.Text:return this.i18nService.t("textHelpText");case ox.Hidden:return this.i18nService.t("hiddenHelpText");case ox.Boolean:return this.i18nService.t("checkBoxHelpText");case ox.Linked:return this.i18nService.t("linkedHelpText");default:return""}}addField(){if(this.customFieldForm.invalid)return;const{type:e,label:t}=this.customFieldForm.value;this.data.addField(e,t)}updateLabel(){if(this.customFieldForm.invalid)return;const{label:e}=this.customFieldForm.value;this.data.updateLabel(this.data.editLabelConfig.index,e)}removeField(){this.data.removeField(this.data.editLabelConfig.index)}}oV.ɵfac=function(e){return new(e||oV)(Fl.rXU(pd.Qs),Fl.rXU(Il.ok),Fl.rXU(Ul))},oV.ɵcmp=Fl.VBU({type:oV,selectors:[["vault-add-edit-custom-field-dialog"]],decls:21,vars:18,consts:[[3,"formGroup","bitSubmit"],["bitDialogTitle",""],["bitDialogContent",""],[4,"ngIf"],["disableMargin",""],["bitInput","","id","fieldLabel","formControlName","label","type","text"],["bitDialogFooter",""],["bitButton","","buttonType","primary","type","submit",3,"disabled"],["bitButton","","bitDialogClose","","buttonType","secondary","type","button"],["type","button","buttonType","danger","class","tw-ml-auto","bitIconButton","bwi-trash",3,"label","click",4,"ngIf"],["id","fieldType","formControlName","type"],[3,"value","label",4,"ngFor","ngForOf"],[3,"value","label"],["type","button","buttonType","danger","bitIconButton","bwi-trash",1,"tw-ml-auto",3,"click","label"]],template:function(e,t){1&e&&(Fl.j41(0,"form",0)(1,"bit-dialog")(2,"span",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"div",2),Fl.DNE(6,nV,8,5,"bit-form-field",3),Fl.j41(7,"bit-form-field",4)(8,"bit-label"),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s(),Fl.nrm(11,"input",5),Fl.DNE(12,rV,3,3,"bit-hint",3),Fl.k0s()(),Fl.qex(13,6),Fl.j41(14,"button",7),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s(),Fl.j41(17,"button",8),Fl.EFF(18),Fl.nI1(19,"i18n"),Fl.k0s(),Fl.DNE(20,sV,2,4,"button",9),Fl.bVm(),Fl.k0s()()),2&e&&(Fl.Y8G("formGroup",t.customFieldForm)("bitSubmit",t.submit),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,10,"add"===t.variant?"addField":"editField")," "),Fl.R7$(3),Fl.Y8G("ngIf","add"===t.variant),Fl.R7$(3),Fl.JRh(Fl.bMT(10,12,"fieldLabel")),Fl.R7$(3),Fl.Y8G("ngIf",t.customFieldForm.value.type===t.FieldType.Linked),Fl.R7$(2),Fl.Y8G("disabled",t.customFieldForm.invalid),Fl.R7$(),Fl.SpI(" ",Fl.bMT(16,14,"add"===t.variant?"add":"save")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(19,16,"cancel")," "),Fl.R7$(2),Fl.Y8G("ngIf","edit"===t.variant))},dependencies:[kl.MD,kl.Sq,kl.bT,sf,Fh,ch,Ph,id,td,Gu,Ac,hu,fu,ju,Wu,qu,zu,Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,Ql,Zl,pc,Md,rf],encapsulation:2});var aV=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const lV=["customFieldRow"],cV=e=>({"tw-mb-0":e}),uV=e=>({"tw-items-center":e});function dV(e,t){if(1&e&&(Fl.j41(0,"bit-form-field",12)(1,"bit-label"),Fl.EFF(2),Fl.k0s(),Fl.nrm(3,"input",13),Fl.k0s()),2&e){const e=Fl.XpG().$implicit;Fl.R7$(2),Fl.JRh(e.value.name)}}function hV(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",16),Fl.bIt("toggledChange",function(t){a.eBV(e);const i=Fl.XpG(4);return a.Njj(i.logHiddenEvent(t))}),Fl.k0s()}}function pV(e,t){if(1&e&&(Fl.j41(0,"bit-form-field",12)(1,"bit-label"),Fl.EFF(2),Fl.k0s(),Fl.nrm(3,"input",14),Fl.DNE(4,hV,1,0,"button",15),Fl.k0s()),2&e){const e=Fl.XpG(),t=e.$implicit,i=e.index,n=Fl.XpG(2);Fl.R7$(2),Fl.JRh(t.value.name),Fl.R7$(2),Fl.Y8G("ngIf",n.canViewPasswords(i))}}function vV(e,t){if(1&e&&(Fl.j41(0,"bit-form-control",12),Fl.nrm(1,"input",17),Fl.j41(2,"bit-label"),Fl.EFF(3),Fl.k0s()()),2&e){const e=Fl.XpG().$implicit;Fl.R7$(3),Fl.JRh(e.value.name)}}function fV(e,t){if(1&e&&Fl.nrm(0,"bit-option",20),2&e){const e=t.$implicit;Fl.Y8G("value",e.value)("label",e.name)}}function mV(e,t){if(1&e&&(Fl.j41(0,"bit-form-field",12)(1,"bit-label"),Fl.EFF(2),Fl.k0s(),Fl.j41(3,"bit-select",18),Fl.DNE(4,fV,1,2,"bit-option",19),Fl.k0s()()),2&e){const e=Fl.XpG().$implicit,t=Fl.XpG(2);Fl.R7$(2),Fl.JRh(e.value.name),Fl.R7$(2),Fl.Y8G("ngForOf",t.linkedFieldOptions)}}function gV(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",21),Fl.nI1(1,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(),i=t.$implicit,n=t.index,r=Fl.XpG(2);return a.Njj(r.openAddEditCustomFieldDialog({index:n,label:i.value.name}))}),Fl.k0s()}if(2&e){const e=Fl.XpG().$implicit,t=Fl.XpG(2);Fl.Y8G("label",Fl.i5U(1,2,"editFieldLabel",e.value.name))("disabled",t.parentFormDisabled)}}function yV(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",22),Fl.nI1(1,"i18n"),Fl.bIt("keydown",function(t){a.eBV(e);const i=Fl.XpG(),n=i.$implicit,r=i.index,s=Fl.XpG(2);return a.Njj(s.handleKeyDown(t,n.value.name,r))}),Fl.k0s()}if(2&e){const e=Fl.XpG().$implicit,t=Fl.XpG(2);Fl.Y8G("label",Fl.i5U(1,2,"reorderToggleButton",e.value.name))("disabled",t.parentFormDisabled)}}function bV(e,t){if(1&e&&(Fl.j41(0,"div",8,0),Fl.DNE(2,dV,4,1,"bit-form-field",9)(3,pV,5,2,"bit-form-field",9)(4,vV,4,1,"bit-form-control",9)(5,mV,5,2,"bit-form-field",9)(6,gV,2,5,"button",10)(7,yV,2,5,"button",11),Fl.k0s()),2&e){const e=t.$implicit,i=t.index,n=Fl.XpG(2);Fl.Y8G("formGroupName",i)("ngClass",Fl.eq3(10,uV,e.value.type===n.FieldType.Boolean))("cdkDragDisabled",!n.canEdit(e.value.type)),Fl.BMQ("data-testid",e.value.name+"-entry"),Fl.R7$(2),Fl.Y8G("ngIf",e.value.type===n.FieldType.Text),Fl.R7$(),Fl.Y8G("ngIf",e.value.type===n.FieldType.Hidden),Fl.R7$(),Fl.Y8G("ngIf",e.value.type===n.FieldType.Boolean),Fl.R7$(),Fl.Y8G("ngIf",e.value.type===n.FieldType.Linked),Fl.R7$(),Fl.Y8G("ngIf",n.canEdit(e.value.type)),Fl.R7$(),Fl.Y8G("ngIf",n.canEdit(e.value.type)&&n.fields.controls.length>1)}}function wV(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",23),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.openAddEditCustomFieldDialog())}),Fl.nrm(1,"i",24),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"addField")," "))}function SV(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"section",2)(1,"bit-section-header")(2,"h2",3),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"form",4)(6,"bit-card",5),Fl.bIt("cdkDropListDropped",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.drop(t))}),Fl.DNE(7,bV,8,12,"div",6)(8,wV,4,3,"button",7),Fl.k0s()()()}if(2&e){const e=Fl.XpG();Fl.Y8G("ngClass",Fl.eq3(7,cV,e.disableSectionMargin)),Fl.R7$(3),Fl.JRh(Fl.bMT(4,5,"customFields")),Fl.R7$(2),Fl.Y8G("formGroup",e.customFieldsForm),Fl.R7$(2),Fl.Y8G("ngForOf",e.fields.controls),Fl.R7$(),Fl.Y8G("ngIf",!e.isPartialEdit&&!e.parentFormDisabled)}}class kV{constructor(e,t,i,n,r,s){this.dialogService=e,this.cipherFormContainer=t,this.formBuilder=i,this.i18nService=n,this.liveAnnouncer=r,this.eventCollectionService=s,this.numberOfFieldsChange=new Fl.bkB,this.customFieldsForm=this.formBuilder.group({fields:new Il.Yp([])}),this.linkedFieldOptions=[],this.hasCustomFields=!1,this.focusOnNewInput$=new Co.B,this.parentFormDisabled=!1,this.FieldType=ox,this.destroyed$=(0,a.WQX)(a.abz),this.cipherFormContainer.registerChildForm("customFields",this.customFieldsForm),this.customFieldsForm.valueChanges.pipe((0,xl.pQ)()).subscribe(()=>{this.updateCipher(this.fields.getRawValue())}),this.cipherFormContainer.formStatusChange$.pipe((0,xl.pQ)()).subscribe(e=>{this.parentFormDisabled="disabled"===e})}get fields(){return this.customFieldsForm.controls.fields}canEdit(e){return!this.isPartialEdit&&(e!==ox.Hidden||null===this.cipherFormContainer.originalCipherView||this.cipherFormContainer.originalCipherView.viewPassword)}ngOnInit(){var e,t;const i=this.getLinkedFieldsOptionsForCipher(),n=Array.from(null!==(e=null==i?void 0:i.entries())&&void 0!==e?e:[]);n.sort((e,t)=>e[1].sortPosition-t[1].sortPosition),this.linkedFieldOptions=n.map(([e,t])=>({name:this.i18nService.t(t.i18nKey),value:e}));const r=this.cipherFormContainer.getInitialCipherView();null===(t=null==r?void 0:r.fields)||void 0===t||t.forEach(e=>{var t;let i=e.value;e.type===ox.Boolean&&(i="true"===e.value);const n=this.formBuilder.group({type:e.type,name:e.name,value:i,linkedId:e.linkedId,newField:!1});e.type!==ox.Hidden||(null===(t=this.cipherFormContainer.originalCipherView)||void 0===t?void 0:t.viewPassword)||n.controls.value.disable(),this.fields.push(n)}),"partial-edit"===this.cipherFormContainer.config.mode&&(this.isPartialEdit=!0,this.customFieldsForm.disable())}ngAfterViewInit(){(0,hm.y)(this.focusOnNewInput$,this.customFieldRows.changes).pipe((0,xl.pQ)(this.destroyed$)).subscribe(()=>{const e=this.customFieldRows.last.nativeElement,t=e.querySelector("input"),i=e.querySelector("label").textContent.trim();this.liveAnnouncer.announce(this.i18nService.t("fieldAdded",i),"polite").then(()=>{t.focus()})})}openAddEditCustomFieldDialog(e){const{cipherType:t,mode:i,originalCipher:n}=this.cipherFormContainer.config;this.dialogRef=this.dialogService.open(oV,{data:{addField:this.addField.bind(this),updateLabel:this.updateLabel.bind(this),removeField:this.removeField.bind(this),cipherType:t,editLabelConfig:e,disallowHiddenField:"edit"===i&&!n.viewPassword}})}canViewPasswords(e){return null===this.cipherFormContainer.originalCipherView||(this.cipherFormContainer.originalCipherView.viewPassword||this.fields.at(e).value.newField)}updateLabel(e,t){var i;this.fields.at(e).patchValue({name:t}),null===(i=this.dialogRef)||void 0===i||i.close()}removeField(e){var t;this.fields.removeAt(e),null===(t=this.dialogRef)||void 0===t||t.close()}addField(e,t){var i;null===(i=this.dialogRef)||void 0===i||i.close();let n=null,r=null;e===ox.Boolean&&(n=!1),e===ox.Linked&&this.linkedFieldOptions.length>0&&(r=this.linkedFieldOptions[0].value),this.fields.push(this.formBuilder.group({type:e,name:t,value:n,linkedId:r,newField:!0})),this.focusOnNewInput$.next()}drop(e){(0,yl.HD)(this.fields.controls,e.previousIndex,e.currentIndex),this.updateCipher(this.fields.controls.map(e=>e.value))}handleKeyDown(e,t,i){return aV(this,void 0,void 0,function*(){if("ArrowUp"===e.key&&0!==i){e.preventDefault();const n=i-1;this.drop({previousIndex:i,currentIndex:n}),yield this.liveAnnouncer.announce(this.i18nService.t("reorderFieldUp",t,n+1,this.fields.length),"assertive"),setTimeout(()=>{e.target.focus()})}if("ArrowDown"===e.key&&i!==this.fields.length-1){e.preventDefault();const n=i+1;this.drop({previousIndex:i,currentIndex:n}),yield this.liveAnnouncer.announce(this.i18nService.t("reorderFieldDown",t,n+1,this.fields.length),"assertive")}})}logHiddenEvent(e){return aV(this,void 0,void 0,function*(){const{mode:t,originalCipher:i}=this.cipherFormContainer.config,n=["edit","partial-edit"].includes(t);e&&n&&(yield this.eventCollectionService.collect(Ua.Cipher_ClientToggledHiddenFieldVisible,i.id,!1,i.organizationId))})}getLinkedFieldsOptionsForCipher(){switch(this.cipherFormContainer.config.cipherType){case nx.Login:return CO.prototype.linkedFieldOptions;case nx.Card:return mO.prototype.linkedFieldOptions;case nx.Identity:return wO.prototype.linkedFieldOptions;default:return null}}updateCipher(e){const t=e.map(e=>{var t;let i;i="number"==typeof e.value?`${e.value}`:"boolean"==typeof e.value?e.value?"true":"false":e.value;const n=new gO;return n.type=e.type,n.name=e.name,n.value=i,n.linkedId=null!==(t=e.linkedId)&&void 0!==t?t:void 0,n});this.hasCustomFields=t.length>0,this.numberOfFieldsChange.emit(t.length),this.cipherFormContainer.patchCipher(e=>(e.fields=t,e))}}kV.ɵfac=function(e){return new(e||kV)(Fl.rXU(lh),Fl.rXU(eV),Fl.rXU(Il.ok),Fl.rXU(Ul),Fl.rXU(gl.Ai),Fl.rXU(I$))},kV.ɵcmp=Fl.VBU({type:kV,selectors:[["vault-custom-fields"]],viewQuery:function(e,t){if(1&e&&Fl.GBs(lV,5),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.customFieldRows=e)}},inputs:{disableSectionMargin:"disableSectionMargin"},outputs:{numberOfFieldsChange:"numberOfFieldsChange"},decls:1,vars:1,consts:[["customFieldRow",""],["class","tw-mb-5 bit-compact:tw-mb-4",3,"ngClass",4,"ngIf"],[1,"tw-mb-5","bit-compact:tw-mb-4",3,"ngClass"],["bitTypography","h6"],[3,"formGroup"],["formArrayName","fields","cdkDropList","","data-testid","custom-fields",3,"cdkDropListDropped"],["class","tw-flex tw-p-3 -tw-mx-3 tw-gap-4 tw-bg-background tw-rounded-lg first:-tw-mt-3 last-of-type:tw-mb-0","cdkDrag","",3,"formGroupName","ngClass","cdkDragDisabled",4,"ngFor","ngForOf"],["type","button","bitLink","","linkType","primary","data-testid","add-field-button",3,"click",4,"ngIf"],["cdkDrag","",1,"tw-flex","tw-p-3","-tw-mx-3","tw-gap-4","tw-bg-background","tw-rounded-lg","first:-tw-mt-3","last-of-type:tw-mb-0",3,"formGroupName","ngClass","cdkDragDisabled"],["class","tw-flex-1","disableMargin","",4,"ngIf"],["type","button","bitIconButton","bwi-pencil-square","class","tw-self-center tw-mt-2","data-testid","edit-custom-field-button",3,"label","disabled","click",4,"ngIf"],["type","button","bitIconButton","bwi-drag-and-drop","class","tw-self-center tw-mt-2","cdkDragHandle","","data-testid","reorder-toggle-button",3,"label","disabled","keydown",4,"ngIf"],["disableMargin","",1,"tw-flex-1"],["bitInput","","formControlName","value","data-testid","custom-text-field"],["bitInput","","formControlName","value","type","password","data-testid","custom-hidden-field",1,"tw-font-mono"],["type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle","","data-testid","visibility-for-custom-hidden-field",3,"toggledChange",4,"ngIf"],["type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle","","data-testid","visibility-for-custom-hidden-field",3,"toggledChange"],["bitCheckbox","","formControlName","value","type","checkbox","data-testid","custom-boolean-field"],["formControlName","linkedId","data-testid","custom-linked-field"],[3,"value","label",4,"ngFor","ngForOf"],[3,"value","label"],["type","button","bitIconButton","bwi-pencil-square","data-testid","edit-custom-field-button",1,"tw-self-center","tw-mt-2",3,"click","label","disabled"],["type","button","bitIconButton","bwi-drag-and-drop","cdkDragHandle","","data-testid","reorder-toggle-button",1,"tw-self-center","tw-mt-2",3,"keydown","label","disabled"],["type","button","bitLink","","linkType","primary","data-testid","add-field-button",3,"click"],["aria-hidden","true",1,"bwi","bwi-plus","tw-font-medium"]],template:function(e,t){1&e&&Fl.DNE(0,SV,9,9,"section",1),2&e&&Fl.Y8G("ngIf",t.hasCustomFields)},dependencies:[sf,kl.MD,kl.YU,kl.Sq,kl.bT,Il.YN,Il.qT,Il.me,Il.Zm,Il.BC,Il.cb,Gu,Sc,Ac,fu,ju,iw,nw,Il.X1,Il.j4,Il.JD,Il.$R,Il.v8,Nx,tc,rc,Ex,Ql,Zl,hd,Qb,Wu,qu,zu,yl.ad,yl.O7,yl.T1,yl.Fb,Hh,uw,rf],encapsulation:2});const IV=e=>({"tw-mb-0":e});function CV(e,t){if(1&e&&(Fl.j41(0,"bit-form-control",6),Fl.nrm(1,"input",7),Fl.j41(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.Y8G("disableMargin",e.hasCustomFields||e.isPartialEdit),Fl.R7$(3),Fl.JRh(Fl.bMT(4,2,"passwordPrompt"))}}function TV(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",8),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.addCustomField())}),Fl.nrm(1,"i",9),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"addField")," "))}class PV{get allowNewField(){return this.additionalOptionsForm.enabled}constructor(e,t,i,n){this.cipherFormContainer=e,this.formBuilder=t,this.passwordRepromptService=i,this.changeDetectorRef=n,this.additionalOptionsForm=this.formBuilder.group({notes:[null],reprompt:[!1]}),this.passwordRepromptEnabled$=this.passwordRepromptService.enabled$.pipe((0,Gp.t)({refCount:!1,bufferSize:1})),this.hasCustomFields=!1,this.isPartialEdit=!1,this.cipherFormContainer.registerChildForm("additionalOptions",this.additionalOptionsForm),this.additionalOptionsForm.valueChanges.pipe((0,xl.pQ)()).subscribe(e=>{this.cipherFormContainer.patchCipher(t=>(t.notes=e.notes,t.reprompt=e.reprompt?tx.Password:tx.None,t))})}ngOnInit(){const e=this.cipherFormContainer.getInitialCipherView();e&&this.additionalOptionsForm.patchValue({notes:e.notes,reprompt:e.reprompt===tx.Password}),"partial-edit"===this.cipherFormContainer.config.mode&&(this.additionalOptionsForm.disable(),this.isPartialEdit=!0)}addCustomField(){this.customFieldsComponent.openAddEditCustomFieldDialog()}handleCustomFieldChange(e){this.hasCustomFields=e>0,this.changeDetectorRef.detectChanges()}}PV.ɵfac=function(e){return new(e||PV)(Fl.rXU(eV),Fl.rXU(Il.ok),Fl.rXU(k$),Fl.rXU(o.gRc))},PV.ɵcmp=Fl.VBU({type:PV,selectors:[["vault-additional-options-section"]],viewQuery:function(e,t){if(1&e&&Fl.GBs(kV,5),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.customFieldsComponent=e.first)}},inputs:{disableSectionMargin:"disableSectionMargin"},decls:15,vars:15,consts:[[1,"tw-mb-5","bit-compact:tw-mb-4",3,"ngClass","formGroup"],["bitTypography","h6"],["bitInput","","rows","5","formControlName","notes"],[3,"disableMargin",4,"ngIf"],["bitLink","","type","button","linkType","primary",3,"click",4,"ngIf"],[3,"numberOfFieldsChange","disableSectionMargin"],[3,"disableMargin"],["type","checkbox","bitCheckbox","","formControlName","reprompt"],["bitLink","","type","button","linkType","primary",3,"click"],["aria-hidden","true",1,"bwi","bwi-plus","tw-font-medium"]],template:function(e,t){1&e&&(Fl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"bit-card")(6,"bit-form-field")(7,"bit-label"),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.nrm(10,"textarea",2),Fl.k0s(),Fl.DNE(11,CV,5,4,"bit-form-control",3),Fl.nI1(12,"async"),Fl.DNE(13,TV,4,3,"button",4),Fl.k0s()(),Fl.j41(14,"vault-custom-fields",5),Fl.bIt("numberOfFieldsChange",function(e){return t.handleCustomFieldChange(e)}),Fl.k0s()),2&e&&(Fl.Y8G("ngClass",Fl.eq3(13,IV,t.disableSectionMargin&&!t.hasCustomFields))("formGroup",t.additionalOptionsForm),Fl.R7$(3),Fl.JRh(Fl.bMT(4,7,"additionalOptions")),Fl.R7$(5),Fl.JRh(Fl.bMT(9,9,"notes")),Fl.R7$(3),Fl.Y8G("ngIf",Fl.bMT(12,11,t.passwordRepromptEnabled$)),Fl.R7$(2),Fl.Y8G("ngIf",!t.hasCustomFields&&!t.isPartialEdit&&t.allowNewField),Fl.R7$(),Fl.Y8G("disableSectionMargin",t.disableSectionMargin))},dependencies:[kl.MD,kl.YU,kl.bT,Nx,tc,rc,sf,Ex,Gu,Sc,Ac,fu,ju,Il.X1,Il.me,Il.Zm,Il.BC,Il.cb,Il.j4,Il.JD,hd,Qb,kV,Hh,uw,kl.Jj,rf],encapsulation:2});var FV=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function RV(e,t){if(1&e&&Fl.nrm(0,"bit-option",14),2&e){const e=t.$implicit;Fl.Y8G("value",e.value)("label",e.name)}}function xV(e,t){if(1&e&&Fl.nrm(0,"bit-option",14),2&e){const e=t.$implicit;Fl.Y8G("value",e.value)("label",e.name)}}class AV{get initialValues(){return this.cipherFormContainer.config.initialValues}constructor(e,t,i,n){this.cipherFormContainer=e,this.formBuilder=t,this.i18nService=i,this.eventCollectionService=n,this.cardDetailsForm=this.formBuilder.group({cardholderName:"",number:"",brand:"",expMonth:"",expYear:"",code:""}),this.cardBrands=[{name:"-- "+this.i18nService.t("select")+" --",value:null},{name:"Visa",value:"Visa"},{name:"Mastercard",value:"Mastercard"},{name:"American Express",value:"Amex"},{name:"Discover",value:"Discover"},{name:"Diners Club",value:"Diners Club"},{name:"JCB",value:"JCB"},{name:"Maestro",value:"Maestro"},{name:"UnionPay",value:"UnionPay"},{name:"RuPay",value:"RuPay"},{name:this.i18nService.t("other"),value:"Other"}],this.expirationMonths=[{name:"-- "+this.i18nService.t("select")+" --",value:null},{name:"01 - "+this.i18nService.t("january"),value:"1"},{name:"02 - "+this.i18nService.t("february"),value:"2"},{name:"03 - "+this.i18nService.t("march"),value:"3"},{name:"04 - "+this.i18nService.t("april"),value:"4"},{name:"05 - "+this.i18nService.t("may"),value:"5"},{name:"06 - "+this.i18nService.t("june"),value:"6"},{name:"07 - "+this.i18nService.t("july"),value:"7"},{name:"08 - "+this.i18nService.t("august"),value:"8"},{name:"09 - "+this.i18nService.t("september"),value:"9"},{name:"10 - "+this.i18nService.t("october"),value:"10"},{name:"11 - "+this.i18nService.t("november"),value:"11"},{name:"12 - "+this.i18nService.t("december"),value:"12"}],this.EventType=Ua,this.cipherFormContainer.registerChildForm("cardDetails",this.cardDetailsForm),this.cardDetailsForm.valueChanges.pipe((0,xl.pQ)()).subscribe(({cardholderName:e,number:t,brand:i,expMonth:n,expYear:r,code:s})=>{this.cipherFormContainer.patchCipher(o=>{var a;const l=null!==(a=W$(r))&&void 0!==a?a:"";return o.card.cardholderName=e,o.card.number=t,o.card.brand=i,o.card.expMonth=n,o.card.expYear=l,o.card.code=s,o})}),this.cardDetailsForm.controls.number.valueChanges.pipe((0,xl.pQ)()).subscribe(e=>{const t=mO.getCardBrandByPatterns(e);t&&this.cardDetailsForm.controls.brand.setValue(t)})}ngOnInit(){const e=this.cipherFormContainer.getInitialCipherView();e?this.initFromExistingCipher(e.card):this.initNewCipher(),this.disabled&&this.cardDetailsForm.disable()}initFromExistingCipher(e){var t,i,n,r,s,o,a,l,c,u,d,h;this.cardDetailsForm.patchValue({cardholderName:null!==(i=null===(t=this.initialValues)||void 0===t?void 0:t.cardholderName)&&void 0!==i?i:e.cardholderName,number:null!==(r=null===(n=this.initialValues)||void 0===n?void 0:n.number)&&void 0!==r?r:e.number,brand:null!==(o=null===(s=this.initialValues)||void 0===s?void 0:s.brand)&&void 0!==o?o:e.brand,expMonth:null!==(l=null===(a=this.initialValues)||void 0===a?void 0:a.expMonth)&&void 0!==l?l:e.expMonth,expYear:null!==(u=null===(c=this.initialValues)||void 0===c?void 0:c.expYear)&&void 0!==u?u:e.expYear,code:null!==(h=null===(d=this.initialValues)||void 0===d?void 0:d.code)&&void 0!==h?h:e.code})}initNewCipher(){var e,t,i,n,r,s;this.cardDetailsForm.patchValue({cardholderName:(null===(e=this.initialValues)||void 0===e?void 0:e.cardholderName)||"",number:(null===(t=this.initialValues)||void 0===t?void 0:t.number)||"",expMonth:(null===(i=this.initialValues)||void 0===i?void 0:i.expMonth)||"",expYear:(null===(n=this.initialValues)||void 0===n?void 0:n.expYear)||"",code:(null===(r=this.initialValues)||void 0===r?void 0:r.code)||"",brand:mO.getCardBrandByPatterns(null===(s=this.initialValues)||void 0===s?void 0:s.number)||""})}getSectionHeading(){const{brand:e}=this.cardDetailsForm.value;return e&&"Other"!==e?this.i18nService.t("cardBrandDetails",e):this.i18nService.t("cardDetails")}logCardEvent(e,t){return FV(this,void 0,void 0,function*(){const{mode:i,originalCipher:n}=this.cipherFormContainer.config,r=["edit","partial-edit"].includes(i);e&&r&&(yield this.eventCollectionService.collect(t,n.id,!1,n.organizationId))})}}function DV(e,t){if(1&e&&Fl.nrm(0,"bit-option",25),2&e){const e=t.$implicit;Fl.Y8G("value",e.value)("label",e.name)}}AV.ɵfac=function(e){return new(e||AV)(Fl.rXU(eV),Fl.rXU(Il.ok),Fl.rXU(Ul),Fl.rXU(I$))},AV.ɵcmp=Fl.VBU({type:AV,selectors:[["vault-card-details-section"]],inputs:{originalCipherView:"originalCipherView",disabled:"disabled"},decls:40,vars:22,consts:[[1,"tw-mb-5","bit-compact:tw-mb-4",3,"formGroup"],["bitTypography","h6"],["id","cardholderName","bitInput","","formControlName","cardholderName"],["id","cardNumber","bitInput","","formControlName","number","type","password",1,"tw-font-mono"],["type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle","","data-testid","visibility-for-card-number",3,"toggledChange"],["id","cardBrand","formControlName","brand"],[3,"value","label",4,"ngFor","ngForOf"],[1,"tw-flex","tw-flex-wrap","tw-gap-1"],[1,"tw-flex-1"],["id","cardExpMonth","formControlName","expMonth"],["id","cardExpYear","bitInput","","formControlName","expYear","type","number"],["disableMargin",""],["id","cardCode","bitInput","","formControlName","code","type","password",1,"tw-font-mono"],["type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle","","data-testid","visibility-for-card-code",3,"toggledChange"],[3,"value","label"]],template:function(e,t){1&e&&(Fl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),Fl.EFF(3),Fl.k0s()(),Fl.j41(4,"bit-card")(5,"bit-form-field")(6,"bit-label"),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.nrm(9,"input",2),Fl.k0s(),Fl.j41(10,"bit-form-field")(11,"bit-label"),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s(),Fl.nrm(14,"input",3),Fl.j41(15,"button",4),Fl.bIt("toggledChange",function(e){return t.logCardEvent(e,t.EventType.Cipher_ClientToggledCardNumberVisible)}),Fl.k0s()(),Fl.j41(16,"bit-form-field")(17,"bit-label"),Fl.EFF(18),Fl.nI1(19,"i18n"),Fl.k0s(),Fl.j41(20,"bit-select",5),Fl.DNE(21,RV,1,2,"bit-option",6),Fl.k0s()(),Fl.j41(22,"div",7)(23,"bit-form-field",8)(24,"bit-label"),Fl.EFF(25),Fl.nI1(26,"i18n"),Fl.k0s(),Fl.j41(27,"bit-select",9),Fl.DNE(28,xV,1,2,"bit-option",6),Fl.k0s()(),Fl.j41(29,"bit-form-field",8)(30,"bit-label"),Fl.EFF(31),Fl.nI1(32,"i18n"),Fl.k0s(),Fl.nrm(33,"input",10),Fl.k0s()(),Fl.j41(34,"bit-form-field",11)(35,"bit-label"),Fl.EFF(36),Fl.nI1(37,"i18n"),Fl.k0s(),Fl.nrm(38,"input",12),Fl.j41(39,"button",13),Fl.bIt("toggledChange",function(e){return t.logCardEvent(e,t.EventType.Cipher_ClientToggledCardCodeVisible)}),Fl.k0s()()()()),2&e&&(Fl.Y8G("formGroup",t.cardDetailsForm),Fl.R7$(3),Fl.SpI(" ",t.getSectionHeading()," "),Fl.R7$(4),Fl.JRh(Fl.bMT(8,10,"cardholderName")),Fl.R7$(5),Fl.JRh(Fl.bMT(13,12,"number")),Fl.R7$(6),Fl.JRh(Fl.bMT(19,14,"brand")),Fl.R7$(3),Fl.Y8G("ngForOf",t.cardBrands),Fl.R7$(4),Fl.JRh(Fl.bMT(26,16,"expirationMonth")),Fl.R7$(3),Fl.Y8G("ngForOf",t.expirationMonths),Fl.R7$(3),Fl.JRh(Fl.bMT(32,18,"expirationYear")),Fl.R7$(5),Fl.JRh(Fl.bMT(37,20,"securityCode")))},dependencies:[Ex,tc,rc,Gu,Ac,fu,ju,iw,nw,Il.X1,Il.me,Il.Q0,Il.BC,Il.cb,Il.j4,Il.JD,Wu,qu,zu,Nx,Ql,Zl,sf,kl.MD,kl.Sq,rf],encapsulation:2});class EV{get initialValues(){return this.cipherFormContainer.config.initialValues}constructor(e,t,i){this.cipherFormContainer=e,this.formBuilder=t,this.i18nService=i,this.identityTitleOptions=[{name:"-- "+this.i18nService.t("select")+" --",value:null},{name:this.i18nService.t("mr"),value:this.i18nService.t("mr")},{name:this.i18nService.t("mrs"),value:this.i18nService.t("mrs")},{name:this.i18nService.t("ms"),value:this.i18nService.t("ms")},{name:this.i18nService.t("mx"),value:this.i18nService.t("mx")},{name:this.i18nService.t("dr"),value:this.i18nService.t("dr")}],this.identityForm=this.formBuilder.group({title:[null],firstName:[""],middleName:[""],lastName:[""],username:[""],company:[""],ssn:[""],passportNumber:[""],licenseNumber:[""],email:[""],phone:[""],address1:[""],address2:[""],address3:[""],city:[""],state:[""],postalCode:[""],country:[""]}),this.cipherFormContainer.registerChildForm("identityDetails",this.identityForm),this.identityForm.valueChanges.pipe((0,xl.pQ)()).subscribe(e=>{const t=new wO;t.title=e.title,t.firstName=e.firstName,t.middleName=e.middleName,t.lastName=e.lastName,t.username=e.username,t.company=e.company,t.ssn=e.ssn,t.passportNumber=e.passportNumber,t.licenseNumber=e.licenseNumber,t.email=e.email,t.phone=e.phone,t.address1=e.address1,t.address2=e.address2,t.address3=e.address3,t.city=e.city,t.state=e.state,t.postalCode=e.postalCode,t.country=e.country,this.cipherFormContainer.patchCipher(e=>(e.identity=t,e))})}ngOnInit(){var e;this.disabled&&this.identityForm.disable();const t=this.cipherFormContainer.getInitialCipherView();t?(this.initFromExistingCipher(t.identity),this.populateFormData(t)):(this.initNewCipher(),this.identityForm.patchValue({username:(null===(e=this.cipherFormContainer.config.initialValues)||void 0===e?void 0:e.username)||""}))}initFromExistingCipher(e){var t,i,n,r,s,o,a,l,c,u,d,h,p,v,f,m,g,y,b,w,S,k,I,C,T,P,F,R,x,A,D,E;this.identityForm.patchValue({firstName:null!==(i=null===(t=this.initialValues)||void 0===t?void 0:t.firstName)&&void 0!==i?i:e.firstName,middleName:null!==(r=null===(n=this.initialValues)||void 0===n?void 0:n.middleName)&&void 0!==r?r:e.middleName,lastName:null!==(o=null===(s=this.initialValues)||void 0===s?void 0:s.lastName)&&void 0!==o?o:e.lastName,company:null!==(l=null===(a=this.initialValues)||void 0===a?void 0:a.company)&&void 0!==l?l:e.company,ssn:null!==(u=null===(c=this.initialValues)||void 0===c?void 0:c.ssn)&&void 0!==u?u:e.ssn,passportNumber:null!==(h=null===(d=this.initialValues)||void 0===d?void 0:d.passportNumber)&&void 0!==h?h:e.passportNumber,licenseNumber:null!==(v=null===(p=this.initialValues)||void 0===p?void 0:p.licenseNumber)&&void 0!==v?v:e.licenseNumber,email:null!==(m=null===(f=this.initialValues)||void 0===f?void 0:f.email)&&void 0!==m?m:e.email,phone:null!==(y=null===(g=this.initialValues)||void 0===g?void 0:g.phone)&&void 0!==y?y:e.phone,address1:null!==(w=null===(b=this.initialValues)||void 0===b?void 0:b.address1)&&void 0!==w?w:e.address1,address2:null!==(k=null===(S=this.initialValues)||void 0===S?void 0:S.address2)&&void 0!==k?k:e.address2,address3:null!==(C=null===(I=this.initialValues)||void 0===I?void 0:I.address3)&&void 0!==C?C:e.address3,city:null!==(P=null===(T=this.initialValues)||void 0===T?void 0:T.city)&&void 0!==P?P:e.city,state:null!==(R=null===(F=this.initialValues)||void 0===F?void 0:F.state)&&void 0!==R?R:e.state,postalCode:null!==(A=null===(x=this.initialValues)||void 0===x?void 0:x.postalCode)&&void 0!==A?A:e.postalCode,country:null!==(E=null===(D=this.initialValues)||void 0===D?void 0:D.country)&&void 0!==E?E:e.country})}initNewCipher(){var e,t,i,n,r,s,o,a,l,c,u,d,h,p,v,f;this.identityForm.patchValue({firstName:(null===(e=this.initialValues)||void 0===e?void 0:e.firstName)||"",middleName:(null===(t=this.initialValues)||void 0===t?void 0:t.middleName)||"",lastName:(null===(i=this.initialValues)||void 0===i?void 0:i.lastName)||"",company:(null===(n=this.initialValues)||void 0===n?void 0:n.company)||"",ssn:(null===(r=this.initialValues)||void 0===r?void 0:r.ssn)||"",passportNumber:(null===(s=this.initialValues)||void 0===s?void 0:s.passportNumber)||"",licenseNumber:(null===(o=this.initialValues)||void 0===o?void 0:o.licenseNumber)||"",email:(null===(a=this.initialValues)||void 0===a?void 0:a.email)||"",phone:(null===(l=this.initialValues)||void 0===l?void 0:l.phone)||"",address1:(null===(c=this.initialValues)||void 0===c?void 0:c.address1)||"",address2:(null===(u=this.initialValues)||void 0===u?void 0:u.address2)||"",address3:(null===(d=this.initialValues)||void 0===d?void 0:d.address3)||"",city:(null===(h=this.initialValues)||void 0===h?void 0:h.city)||"",state:(null===(p=this.initialValues)||void 0===p?void 0:p.state)||"",postalCode:(null===(v=this.initialValues)||void 0===v?void 0:v.postalCode)||"",country:(null===(f=this.initialValues)||void 0===f?void 0:f.country)||""})}populateFormData(e){var t,i;const{identity:n}=e;this.identityForm.patchValue({title:n.title,firstName:n.firstName,middleName:n.middleName,lastName:n.lastName,username:null!==(i=null===(t=this.cipherFormContainer.config.initialValues)||void 0===t?void 0:t.username)&&void 0!==i?i:n.username,company:n.company,ssn:n.ssn,passportNumber:n.passportNumber,licenseNumber:n.licenseNumber,email:n.email,phone:n.phone,address1:n.address1,address2:n.address2,address3:n.address3,city:n.city,state:n.state,postalCode:n.postalCode,country:n.country})}}EV.ɵfac=function(e){return new(e||EV)(Fl.rXU(eV),Fl.rXU(Il.ok),Fl.rXU(Ul))},EV.ɵcmp=Fl.VBU({type:EV,selectors:[["vault-identity-section"]],inputs:{originalCipherView:"originalCipherView",disabled:"disabled"},decls:118,vars:68,consts:[[3,"formGroup"],[1,"tw-mb-5","bit-compact:tw-mb-4"],["bitTypography","h6"],["formControlName","title"],[3,"value","label",4,"ngFor","ngForOf"],["bitInput","","formControlName","firstName"],["bitInput","","formControlName","middleName"],["bitInput","","formControlName","lastName"],["bitInput","","formControlName","username"],["disableMargin",""],["bitInput","","formControlName","company"],["formControlName","ssn","bitInput","","type","password"],["type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle","","data-testid","visibility-for-ssn"],["formControlName","passportNumber","bitInput","","type","password"],["type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle","","data-testid","visibility-for-passport-number"],["bitInput","","formControlName","licenseNumber"],["bitInput","","formControlName","email"],["bitInput","","formControlName","phone"],["bitInput","","formControlName","address1"],["bitInput","","formControlName","address2"],["bitInput","","formControlName","address3"],["bitInput","","formControlName","city"],["bitInput","","formControlName","state"],["bitInput","","formControlName","postalCode"],["bitInput","","formControlName","country"],[3,"value","label"]],template:function(e,t){1&e&&(Fl.j41(0,"form",0)(1,"section",1)(2,"bit-section-header")(3,"h2",2),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()(),Fl.j41(6,"bit-card")(7,"bit-form-field")(8,"bit-label"),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s(),Fl.j41(11,"bit-select",3),Fl.DNE(12,DV,1,2,"bit-option",4),Fl.k0s()(),Fl.j41(13,"bit-form-field")(14,"bit-label"),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s(),Fl.nrm(17,"input",5),Fl.k0s(),Fl.j41(18,"bit-form-field")(19,"bit-label"),Fl.EFF(20),Fl.nI1(21,"i18n"),Fl.k0s(),Fl.nrm(22,"input",6),Fl.k0s(),Fl.j41(23,"bit-form-field")(24,"bit-label"),Fl.EFF(25),Fl.nI1(26,"i18n"),Fl.k0s(),Fl.nrm(27,"input",7),Fl.k0s(),Fl.j41(28,"bit-form-field")(29,"bit-label"),Fl.EFF(30),Fl.nI1(31,"i18n"),Fl.k0s(),Fl.nrm(32,"input",8),Fl.k0s(),Fl.j41(33,"bit-form-field",9)(34,"bit-label"),Fl.EFF(35),Fl.nI1(36,"i18n"),Fl.k0s(),Fl.nrm(37,"input",10),Fl.k0s()()(),Fl.j41(38,"section",1)(39,"bit-section-header")(40,"h2",2),Fl.EFF(41),Fl.nI1(42,"i18n"),Fl.k0s()(),Fl.j41(43,"bit-card")(44,"bit-form-field")(45,"bit-label"),Fl.EFF(46),Fl.nI1(47,"i18n"),Fl.k0s(),Fl.nrm(48,"input",11)(49,"button",12),Fl.k0s(),Fl.j41(50,"bit-form-field")(51,"bit-label"),Fl.EFF(52),Fl.nI1(53,"i18n"),Fl.k0s(),Fl.nrm(54,"input",13)(55,"button",14),Fl.k0s(),Fl.j41(56,"bit-form-field",9)(57,"bit-label"),Fl.EFF(58),Fl.nI1(59,"i18n"),Fl.k0s(),Fl.nrm(60,"input",15),Fl.k0s()()(),Fl.j41(61,"section",1)(62,"bit-section-header")(63,"h2",2),Fl.EFF(64),Fl.nI1(65,"i18n"),Fl.k0s()(),Fl.j41(66,"bit-card")(67,"bit-form-field")(68,"bit-label"),Fl.EFF(69),Fl.nI1(70,"i18n"),Fl.k0s(),Fl.nrm(71,"input",16),Fl.k0s(),Fl.j41(72,"bit-form-field",9)(73,"bit-label"),Fl.EFF(74),Fl.nI1(75,"i18n"),Fl.k0s(),Fl.nrm(76,"input",17),Fl.k0s()()(),Fl.j41(77,"section",1)(78,"bit-section-header")(79,"h2",2),Fl.EFF(80),Fl.nI1(81,"i18n"),Fl.k0s()(),Fl.j41(82,"bit-card")(83,"bit-form-field")(84,"bit-label"),Fl.EFF(85),Fl.nI1(86,"i18n"),Fl.k0s(),Fl.nrm(87,"input",18),Fl.k0s(),Fl.j41(88,"bit-form-field")(89,"bit-label"),Fl.EFF(90),Fl.nI1(91,"i18n"),Fl.k0s(),Fl.nrm(92,"input",19),Fl.k0s(),Fl.j41(93,"bit-form-field")(94,"bit-label"),Fl.EFF(95),Fl.nI1(96,"i18n"),Fl.k0s(),Fl.nrm(97,"input",20),Fl.k0s(),Fl.j41(98,"bit-form-field")(99,"bit-label"),Fl.EFF(100),Fl.nI1(101,"i18n"),Fl.k0s(),Fl.nrm(102,"input",21),Fl.k0s(),Fl.j41(103,"bit-form-field")(104,"bit-label"),Fl.EFF(105),Fl.nI1(106,"i18n"),Fl.k0s(),Fl.nrm(107,"input",22),Fl.k0s(),Fl.j41(108,"bit-form-field")(109,"bit-label"),Fl.EFF(110),Fl.nI1(111,"i18n"),Fl.k0s(),Fl.nrm(112,"input",23),Fl.k0s(),Fl.j41(113,"bit-form-field",9)(114,"bit-label"),Fl.EFF(115),Fl.nI1(116,"i18n"),Fl.k0s(),Fl.nrm(117,"input",24),Fl.k0s()()()()),2&e&&(Fl.Y8G("formGroup",t.identityForm),Fl.R7$(4),Fl.JRh(Fl.bMT(5,24,"personalDetails")),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(10,26,"title")," "),Fl.R7$(3),Fl.Y8G("ngForOf",t.identityTitleOptions),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(16,28,"firstName")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(21,30,"middleName")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(26,32,"lastName")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(31,34,"username")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(36,36,"company")," "),Fl.R7$(6),Fl.JRh(Fl.bMT(42,38,"identification")),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(47,40,"ssn")," "),Fl.R7$(6),Fl.SpI(" ",Fl.bMT(53,42,"passportNumber")," "),Fl.R7$(6),Fl.SpI(" ",Fl.bMT(59,44,"licenseNumber")," "),Fl.R7$(6),Fl.JRh(Fl.bMT(65,46,"contactInfo")),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(70,48,"email")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(75,50,"phone")," "),Fl.R7$(6),Fl.JRh(Fl.bMT(81,52,"address")),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(86,54,"address1")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(91,56,"address2")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(96,58,"address3")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(101,60,"cityTown")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(106,62,"stateProvince")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(111,64,"zipPostalCodeLabel")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(116,66,"country")," "))},dependencies:[kl.MD,kl.Sq,id,sf,Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,Nx,Ex,Gu,Ac,fu,ju,iw,nw,Ql,Zl,Wu,qu,zu,tc,rc,rf],encapsulation:2});class $V{}var OV=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function UV(e,t){1&e&&(Fl.j41(0,"span",2),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"archived")," "))}function MV(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",7),Fl.nI1(1,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.toggleFavorite())}),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.Y8G("bitIconButton",e.favoriteIcon)("label",Fl.bMT(1,4,"favorite"))("disabled",e.favoriteButtonDisabled),Fl.BMQ("aria-checked",e.itemDetailsForm.value.favorite)}}function NV(e,t){if(1&e&&(Fl.nrm(0,"bit-option",11),Fl.nI1(1,"async")),2&e){const e=Fl.XpG(2);Fl.Y8G("value",null)("label",Fl.bMT(1,2,e.userEmail$))}}function VV(e,t){if(1&e&&Fl.nrm(0,"bit-option",11),2&e){const e=t.$implicit;Fl.Y8G("value",e.id)("label",e.name)}}function BV(e,t){if(1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"bit-select",8),Fl.DNE(5,NV,2,4,"bit-option",9)(6,VV,1,2,"bit-option",10),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.JRh(Fl.bMT(3,3,"owner")),Fl.R7$(3),Fl.Y8G("ngIf",e.showPersonalOwnershipOption),Fl.R7$(),Fl.Y8G("ngForOf",e.organizations)}}function jV(e,t){if(1&e&&(Fl.j41(0,"bit-hint",15),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.SpI(" ",Fl.i5U(2,1,"cannotRemoveViewOnlyCollections",e.readOnlyCollectionsNames.join(", "))," ")}}function GV(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"bit-form-field",12)(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.nrm(5,"bit-multi-select",13),Fl.DNE(6,jV,3,4,"bit-hint",14),Fl.k0s(),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("disableMargin",e.config.hideIndividualVaultFields),Fl.R7$(2),Fl.JRh(Fl.bMT(4,4,"collections")),Fl.R7$(2),Fl.Y8G("baseItems",e.collectionOptions),Fl.R7$(),Fl.Y8G("ngIf",e.readOnlyCollectionsNames.length>0)}}function LV(e,t){if(1&e&&Fl.nrm(0,"bit-option",11),2&e){const e=t.$implicit;Fl.Y8G("value",e.id)("label",e.name)}}function zV(e,t){if(1&e&&(Fl.j41(0,"bit-form-field",16)(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"bit-select",17),Fl.DNE(5,LV,1,2,"bit-option",10),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.JRh(Fl.bMT(3,2,"folder")),Fl.R7$(3),Fl.Y8G("ngForOf",e.config.folders)}}class _V{get readOnlyCollectionsNames(){return this.readOnlyCollections.map(e=>e.name)}get partialEdit(){return"partial-edit"===this.config.mode}get allowPersonalOwnership(){return this.config.organizationDataOwnershipDisabled}get collections(){return this.config.collections}get initialValues(){return this.config.initialValues}get showPersonalOwnershipOption(){return this.allowPersonalOwnership||this.itemDetailsForm.controls.organizationId.disabled||!this.allowPersonalOwnership&&this.config.originalCipher&&null==this.itemDetailsForm.controls.organizationId.value}constructor(e,t,i,n,r,s,a,c){this.cipherFormContainer=e,this.formBuilder=t,this.i18nService=i,this.destroyRef=n,this.accountService=r,this.policyService=s,this.platformUtilsService=a,this.cipherArchiveService=c,this.itemDetailsForm=this.formBuilder.group({name:["",[Il.k0.required]],organizationId:[null],folderId:[null],collectionIds:new Il.MJ([],[Il.k0.required]),favorite:[!1]}),this.showArchiveBadge=(0,Rl.EW)(()=>{var e;return this.cipherArchiveService.hasArchiveFlagEnabled$&&(null===(e=this.originalCipherView())||void 0===e?void 0:e.isArchived)&&this.platformUtilsService.getClientType()===Da.Desktop}),this.collectionOptions=[],this.readOnlyCollections=[],this.userEmail$=this.accountService.activeAccount$.pipe((0,l.T)(e=>e.email)),this.organizations=[],this.favoriteButtonDisabled=!1,this.originalCipherView=(0,o.hFB)(),this.cipherFormContainer.registerChildForm("itemDetails",this.itemDetailsForm),this.itemDetailsForm.valueChanges.pipe((0,xl.pQ)(),(0,l.T)(()=>this.itemDetailsForm.getRawValue())).subscribe(e=>{this.cipherFormContainer.patchCipher(t=>{var i;return Object.assign(t,{name:e.name,organizationId:e.organizationId,folderId:e.folderId,collectionIds:[...(null===(i=e.collectionIds)||void 0===i?void 0:i.map(e=>e.id))||[],...this.readOnlyCollections.map(e=>e.id)],favorite:e.favorite}),t})})}get favoriteIcon(){return this.itemDetailsForm.controls.favorite.value?"bwi-star-f":"bwi-star"}toggleFavorite(){this.itemDetailsForm.controls.favorite.setValue(!this.itemDetailsForm.controls.favorite.value)}get allowOwnershipChange(){var e;return("edit"!==this.config.mode||null==(null===(e=this.originalCipherView())||void 0===e?void 0:e.organizationId))&&(this.allowPersonalOwnership?this.organizations.length>0:this.organizations.length>1)}get showOwnership(){const e=this.organizations.length>0&&"edit"===this.config.mode,t=this.config.isAdminConsole&&"clone"!==this.config.mode;return this.allowOwnershipChange||e&&!t}get defaultOwner(){return this.allowPersonalOwnership?null:this.organizations[0].id}ngOnInit(){return OV(this,void 0,void 0,function*(){var e,t,i,n;if(this.organizations=this.config.organizations.sort(bd.getSortFunction(this.i18nService,"name")),this.userId=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv)),!this.allowPersonalOwnership&&0===this.organizations.length)throw new Error("No organizations available for ownership.");const r=this.cipherFormContainer.getInitialCipherView();if(r)yield this.initFromExistingCipher(r);else{const r=null===(e=this.initialValues)||void 0===e?void 0:e.organizationId;this.itemDetailsForm.setValue({name:(null===(t=this.initialValues)||void 0===t?void 0:t.name)||"",organizationId:r||this.defaultOwner,folderId:(null===(i=this.initialValues)||void 0===i?void 0:i.folderId)||null,collectionIds:[],favorite:!1}),yield this.updateCollectionOptions(null===(n=this.initialValues)||void 0===n?void 0:n.collectionIds)}this.setFormState(),this.itemDetailsForm.controls.organizationId.valueChanges.pipe((0,xl.pQ)(this.destroyRef),(0,mo.F)(),(0,To.H)(()=>OV(this,void 0,void 0,function*(){yield this.updateCollectionOptions(),this.setFormState()}))).subscribe()})}setFormState(){this.config.originalCipher&&!this.allowPersonalOwnership?null==this.itemDetailsForm.controls.organizationId.value?(this.cipherFormContainer.disableFormFields(),this.itemDetailsForm.controls.organizationId.enable(),this.favoriteButtonDisabled=!0):(this.cipherFormContainer.enableFormFields(),this.favoriteButtonDisabled=!1,this.setCollectionControlState()):this.allowOwnershipChange||this.itemDetailsForm.controls.organizationId.disable({emitEvent:!1})}getDefaultCollectionId(e){return OV(this,void 0,void 0,function*(){if(!e||this.allowPersonalOwnership)return;if(!(yield(0,bo._)(this.policyService.policiesByType$(op.OrganizationDataOwnership,this.userId))).find(e=>e.organizationId))return;const t=this.collections.find(t=>t.organizationId===e&&t.type===yR);return null==t?void 0:t.id})}initFromExistingCipher(e){return OV(this,void 0,void 0,function*(){var t,i,n,r,s,o,a;const{name:l,folderId:c,collectionIds:u}=e;this.itemDetailsForm.patchValue({name:l||(null!==(i=null===(t=this.initialValues)||void 0===t?void 0:t.name)&&void 0!==i?i:""),organizationId:null!==(n=e.organizationId)&&void 0!==n?n:null,folderId:c||(null!==(s=null===(r=this.initialValues)||void 0===r?void 0:r.folderId)&&void 0!==s?s:null),collectionIds:[],favorite:e.favorite});const d=this.itemDetailsForm.controls.organizationId.value,h=this.cipherFormContainer.initializedWithCachedCipher();"clone"===this.config.mode&&(h||this.itemDetailsForm.controls.name.setValue(e.name+" - "+this.i18nService.t("clone")),this.allowPersonalOwnership||null!=e.organizationId||this.itemDetailsForm.controls.organizationId.setValue(this.defaultOwner));const p=(null==u?void 0:u.length)?u:null!==(a=null===(o=this.initialValues)||void 0===o?void 0:o.collectionIds)&&void 0!==a?a:[];yield this.updateCollectionOptions(p),this.setCollectionControlState(),this.partialEdit?(this.itemDetailsForm.disable(),this.itemDetailsForm.controls.favorite.enable(),this.itemDetailsForm.controls.folderId.enable()):"edit"===this.config.mode&&(this.config.isAdminConsole&&this.config.admin||(this.readOnlyCollections=this.collections.filter(e=>e.organizationId===d&&e.readOnly&&this.originalCipherView().collectionIds.includes(e.id))))})}setCollectionControlState(){const e=this.cipherFormContainer.getInitialCipherView(),t=this.itemDetailsForm.controls.organizationId.value,i=this.organizations.find(e=>e.id===t);i&&e&&((i.canEditAllCiphers||e.canAssignToCollections)&&(!i.allowAdminAccessToAllCollectionItems||e.viewPassword&&e.edit)&&(i.type!==sp.Custom||e.viewPassword)||this.itemDetailsForm.controls.collectionIds.disable())}updateCollectionOptions(){return OV(this,arguments,void 0,function*(e=[]){var t,i;const n=this.itemDetailsForm.controls.organizationId.value,r=this.itemDetailsForm.controls.collectionIds;if(null==n)return this.collectionOptions=[],r.reset(),r.disable(),void(this.showCollectionsControl=!1);r.enable(),this.showCollectionsControl=!0;const s=(null!==(i=null===(t=this.originalCipherView())||void 0===t?void 0:t.collectionIds)&&void 0!==i?i:[]).length>0&&this.originalCipherView().collectionIds.every(e=>{var t;return(null===(t=this.collections.find(t=>t.id===e))||void 0===t?void 0:t.type)===gR});if(this.collectionOptions=this.collections.filter(e=>e.organizationId===n&&(!!this.partialEdit||(!!this.config.admin||(!s||e.type!==yR)&&(e.assigned&&!e.readOnly)))).sort((e,t)=>(e.type===yR?-1:0)-(t.type===yR?-1:0)).map(e=>({id:e.id,name:e.name,listName:e.name,labelName:e.name})),r.reset(),r.enable(),this.showCollectionsControl=!0,1!==this.collectionOptions.length)if(e.filter(Boolean).length>0)r.setValue(this.collectionOptions.filter(t=>e.includes(t.id)));else{const e=yield this.getDefaultCollectionId(n);e&&r.setValue(this.collectionOptions.filter(t=>t.id===e))}else r.setValue(this.collectionOptions)})}}_V.ɵfac=function(e){return new(e||_V)(Fl.rXU(eV),Fl.rXU(Il.ok),Fl.rXU(Ul),Fl.rXU(a.abz),Fl.rXU(Zk),Fl.rXU(Jb),Fl.rXU(Hb),Fl.rXU($V))},_V.ɵcmp=Fl.VBU({type:_V,selectors:[["vault-item-details-section"]],inputs:{config:"config",originalCipherView:[1,"originalCipherView"]},decls:16,vars:12,consts:[[1,"tw-mb-5","bit-compact:tw-mb-4",3,"formGroup"],["bitTypography","h6"],["bitBadge",""],["slot","end","type","button","size","small","role","checkbox",3,"bitIconButton","label","disabled","click",4,"ngIf"],["bitInput","","formControlName","name"],[4,"ngIf"],["disableMargin","",4,"ngIf"],["slot","end","type","button","size","small","role","checkbox",3,"click","bitIconButton","label","disabled"],["formControlName","organizationId"],[3,"value","label",4,"ngIf"],[3,"value","label",4,"ngFor","ngForOf"],[3,"value","label"],[1,"tw-w-full",3,"disableMargin"],["formControlName","collectionIds",1,"tw-w-full",3,"baseItems"],["data-testid","view-only-hint",4,"ngIf"],["data-testid","view-only-hint"],["disableMargin",""],["formControlName","folderId"]],template:function(e,t){1&e&&(Fl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.nVh(5,UV,3,3,"span",2),Fl.DNE(6,MV,2,6,"button",3),Fl.k0s(),Fl.j41(7,"bit-card")(8,"bit-form-field")(9,"bit-label"),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s(),Fl.nrm(12,"input",4),Fl.k0s(),Fl.DNE(13,BV,7,5,"bit-form-field",5)(14,GV,7,6,"ng-container",5)(15,zV,6,4,"bit-form-field",6),Fl.k0s()()),2&e&&(Fl.Y8G("formGroup",t.itemDetailsForm),Fl.R7$(3),Fl.JRh(Fl.bMT(4,8,"itemDetails")),Fl.R7$(2),Fl.vxM(t.showArchiveBadge()?5:-1),Fl.R7$(),Fl.Y8G("ngIf",!t.config.hideIndividualVaultFields),Fl.R7$(4),Fl.JRh(Fl.bMT(11,10,"itemName")),Fl.R7$(3),Fl.Y8G("ngIf",t.showOwnership),Fl.R7$(),Fl.Y8G("ngIf",t.showCollectionsControl),Fl.R7$(),Fl.Y8G("ngIf",!t.config.hideIndividualVaultFields))},dependencies:[Ex,tc,rc,Gu,Ac,hu,fu,cu,ju,Il.X1,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,Wu,qu,zu,Nx,Ql,Zl,sf,kl.MD,kl.Sq,kl.bT,Qc,rf,kl.Jj],encapsulation:2});function KV(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"section",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"h2",4),Fl.EFF(5),Fl.k0s(),Fl.j41(6,"button",5),Fl.nI1(7,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.closed.emit())}),Fl.k0s()(),Fl.j41(8,"div",6),Fl.SdG(9),Fl.k0s()()(),Fl.nrm(10,"div",7),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.BMQ("aria-label",e.title()),Fl.R7$(5),Fl.SpI(" ",e.title()," "),Fl.R7$(),Fl.Y8G("label",Fl.bMT(7,3,"close"))}}class XV{constructor(){this.templateRef=o.ebz.required(Fl.C4Q),this.title=(0,o.hFB)(""),this.closed=new Fl.bkB}}XV.ɵfac=function(e){return new(e||XV)},XV.ɵcmp=Fl.VBU({type:XV,selectors:[["bit-popover"]],viewQuery:function(e,t){1&e&&Fl.wEZ(t.templateRef,Fl.C4Q,5),2&e&&Fl.NyB()},inputs:{title:[1,"title"]},outputs:{closed:"closed"},exportAs:["popoverComponent"],ngContentSelectors:["*"],decls:1,vars:0,consts:[["cdkTrapFocus","","cdkTrapFocusAutoCapture","","role","dialog","aria-modal","true",1,"tw-relative"],[1,"tw-overflow-hidden","tw-rounded-xl","tw-shadow-lg"],[1,"tw-relative","tw-z-20","tw-w-72","tw-break-words","tw-bg-primary-100","tw-pb-4","tw-pt-2","tw-text-main"],[1,"tw-me-2","tw-flex","tw-items-start","tw-justify-between","tw-gap-4","tw-ps-4"],["bitTypography","h5",1,"tw-font-medium","tw-mt-1"],["type","button","bitIconButton","bwi-close","size","small",3,"click","label"],["bitTypography","body2",1,"tw-px-4"],[1,"bit-popover-arrow"]],template:function(e,t){1&e&&(Fl.NAR(),Fl.DNE(0,KV,11,5,"ng-template"))},dependencies:[gl.Pd,gl.kB,Ql,Zl,ec,tc,rc,sc],encapsulation:2});class qV{}qV.ɵfac=function(e){return new(e||qV)},qV.ɵmod=Fl.$C({type:qV}),qV.ɵinj=a.G2t({imports:[XV]});class WV{constructor(e){this.dialogRef=e,this.platformUtilsService=(0,a.WQX)(Hb),this.params=(0,a.WQX)(pd.Qs)}get contentKey(){return this.params.contentKey}onCancel(){var e,t;null===(t=(e=this.params).onCancel)||void 0===t||t.call(e),this.dialogRef.close(!1)}onContinue(){var e,t;null===(t=(e=this.params).onContinue)||void 0===t||t.call(e),this.dialogRef.close(!0)}openLink(e){e.preventDefault(),this.platformUtilsService.launchUri("https://bitwarden.com/help/uri-match-detection/")}static open(e,t){return e.open(WV,{data:t,disableClose:!0,positionStrategy:new sh})}}WV.ɵfac=function(e){return new(e||WV)(Fl.rXU(nh))},WV.ɵcmp=Fl.VBU({type:WV,selectors:[["ng-component"]],decls:20,vars:15,consts:[["bitDialogIcon","","aria-hidden","true",1,"bwi","tw-text-3xl","bwi-exclamation-triangle","tw-text-warning"],["bitDialogTitle",""],["bitDialogContent","",1,"tw-mb-1"],[1,"tw-mb-1","tw-hyphens-none"],["bitLink","","type","button","linkType","primary",3,"click"],["bitDialogFooter",""],["bitButton","","type","button","buttonType","primary",3,"click"],["bitButton","","type","button","buttonType","secondary",3,"click"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-simple-dialog"),Fl.nrm(1,"i",0),Fl.j41(2,"span",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"div",2)(6,"p",3),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.nrm(9,"br"),Fl.j41(10,"button",4),Fl.bIt("click",function(e){return t.openLink(e)}),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s()()(),Fl.qex(13,5),Fl.j41(14,"button",6),Fl.bIt("click",function(){return t.onContinue()}),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s(),Fl.j41(17,"button",7),Fl.bIt("click",function(){return t.onCancel()}),Fl.EFF(18),Fl.nI1(19,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e&&(Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,5,"warningCapitalized")," "),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(8,7,t.contentKey)," "),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(12,9,"uriMatchWarningDialogLink")," "),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(16,11,"continue")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(19,13,"cancel")," "))},dependencies:[uw,id,td,Fh,Wd,Yd,sf,rf],encapsulation:2});var YV=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const HV=["uriInput"],JV=["matchDetectionSelect"];function ZV(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",11),Fl.nI1(1,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.removeUri())}),Fl.k0s()}2&e&&Fl.Y8G("label",Fl.bMT(1,1,"deleteWebsite"))}function QV(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"div",12)(1,"button",13),Fl.nI1(2,"i18n"),Fl.bIt("keydown",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.handleKeydown(t))}),Fl.k0s()()}if(2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("label",Fl.i5U(2,1,"reorderToggleButton",e.uriLabel))}}function eB(e,t){if(1&e&&Fl.nrm(0,"bit-option",18),2&e){const e=t.$implicit;Fl.Y8G("label",e.label)("value",e.value)("disabled",e.disabled)}}function tB(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"b"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.bVm()),2&e){const e=Fl.XpG().ngIf;Fl.R7$(2),Fl.SpI("",Fl.bMT(3,2,"warningCapitalized"),":"),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(5,4,e[1])," ")}}function iB(e,t){if(1&e&&(Fl.j41(0,"bit-hint"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.DNE(3,tB,6,6,"ng-container",17),Fl.k0s()),2&e){const e=t.ngIf;Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,2,e[0])," "),Fl.R7$(2),Fl.Y8G("ngIf",e.length>1)}}function nB(e,t){if(1&e&&(Fl.j41(0,"bit-form-field",14)(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"bit-select",15,1),Fl.DNE(6,eB,1,3,"bit-option",16),Fl.k0s(),Fl.DNE(7,iB,4,4,"bit-hint",17),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.JRh(Fl.bMT(3,3,"matchDetection")),Fl.R7$(4),Fl.Y8G("ngForOf",e.uriMatchOptions),Fl.R7$(),Fl.Y8G("ngIf",e.getMatchHints())}}class rB{set defaultMatchDetection(e){var t;null!==e&&(this.uriMatchOptions[0].label=this.i18nService.t("defaultLabelWithValue",null===(t=this.uriMatchOptions.find(t=>t.value===e))||void 0===t?void 0:t.label))}toggleMatchDetection(){this.showMatchDetection=!this.showMatchDetection,this.showMatchDetection&&setTimeout(()=>{var e,t;return null===(t=null===(e=this.matchDetectionSelect)||void 0===e?void 0:e.select())||void 0===t?void 0:t.focus()},0)}get uriLabel(){return 0===this.index?this.i18nService.t("websiteUri"):this.i18nService.t("websiteUriCount",this.index+1)}get toggleTitle(){return this.i18nService.t(this.showMatchDetection?"hideMatchDetectionNoPlaceholder":"showMatchDetectionNoPlaceholder")}handleKeydown(e){this.onKeydown.emit(e)}constructor(e,t,i){this.dialogService=e,this.formBuilder=t,this.i18nService=i,this.uriForm=this.formBuilder.group({uri:[null],matchDetection:[null]}),this.uriMatchOptions=[{label:this.i18nService.t("default"),value:null},{label:this.i18nService.t("baseDomain"),value:GE.Domain},{label:this.i18nService.t("host"),value:GE.Host},{label:this.i18nService.t("exact"),value:GE.Exact},{label:this.i18nService.t("never"),value:GE.Never},{label:this.i18nService.t("uriAdvancedOption"),value:null,disabled:!0},{label:this.i18nService.t("startsWith"),value:GE.StartsWith},{label:this.i18nService.t("regEx"),value:GE.RegularExpression}],this.advancedOptionWarningMap={[GE.StartsWith]:"startsWithAdvancedOptionWarning",[GE.RegularExpression]:"regExAdvancedOptionWarning"},this.onKeydown=new Fl.bkB,this.remove=new Fl.bkB,this.showMatchDetection=!1,this.onChange=()=>{},this.onTouched=()=>{},this.uriForm.valueChanges.pipe((0,xl.pQ)()).subscribe(e=>{this.onChange(e)}),this.uriForm.statusChanges.pipe((0,xl.pQ)()).subscribe(()=>{this.onTouched()}),this.uriForm.controls.matchDetection.valueChanges.pipe((0,mm.J)(),(0,To.H)(([e,t])=>this.handleAdvancedMatch(e,t)),(0,xl.pQ)()).subscribe()}handleAdvancedMatch(e,t){return YV(this,void 0,void 0,function*(){e!==t&&(t===GE.StartsWith||t===GE.RegularExpression)&&WV.open(this.dialogService,{contentKey:this.advancedOptionWarningMap[t],onContinue:()=>{this.uriForm.controls.matchDetection.setValue(t)},onCancel:()=>{this.uriForm.controls.matchDetection.setValue(e)}})})}focusInput(){var e;(null===(e=this.inputElement)||void 0===e?void 0:e.nativeElement)&&this.inputElement.nativeElement.focus()}removeUri(){this.remove.emit()}writeValue(e){var t,i;e&&this.uriForm.setValue({uri:null!==(t=e.uri)&&void 0!==t?t:"",matchDetection:null!==(i=e.matchDetection)&&void 0!==i?i:null},{emitEvent:!1})}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){e?this.uriForm.disable():this.uriForm.enable()}getMatchHints(){var e;const t=["uriMatchDefaultStrategyHint"],i=null===(e=this.uriForm.get("matchDetection"))||void 0===e?void 0:e.value;return i!==GE.StartsWith&&i!==GE.RegularExpression||t.push(this.advancedOptionWarningMap[i]),t}}rB.ɵfac=function(e){return new(e||rB)(Fl.rXU(lh),Fl.rXU(Il.ok),Fl.rXU(Ul))},rB.ɵcmp=Fl.VBU({type:rB,selectors:[["vault-autofill-uri-option"]],viewQuery:function(e,t){if(1&e&&(Fl.GBs(HV,5),Fl.GBs(JV,5)),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.inputElement=e.first),Fl.mGM(e=Fl.lsd())&&(t.matchDetectionSelect=e.first)}},inputs:{canReorder:"canReorder",canRemove:"canRemove",defaultMatchDetection:"defaultMatchDetection",index:"index"},outputs:{onKeydown:"onKeydown",remove:"remove"},features:[Fl.Jv_([{provide:Il.kq,useExisting:(0,a.Rfq)(()=>rB),multi:!0}])],decls:12,vars:9,consts:[["uriInput",""],["matchDetectionSelect",""],[3,"formGroup"],[1,"tw-mb-4","tw-pt-1"],[1,"tw-flex","tw-pt-2"],["disableMargin","",1,"tw-flex-1","!tw-pt-0"],["bitInput","","formControlName","uri"],["type","button","bitSuffix","","data-testid","toggle-match-detection-button",3,"click","bitIconButton","label"],["type","button","bitIconButton","bwi-minus-circle","buttonType","danger","bitSuffix","","data-testid","remove-uri-button",3,"label","click",4,"ngIf"],["class","tw-flex tw-items-center tw-ml-1.5",4,"ngIf"],["class","!tw-mb-5",4,"ngIf"],["type","button","bitIconButton","bwi-minus-circle","buttonType","danger","bitSuffix","","data-testid","remove-uri-button",3,"click","label"],[1,"tw-flex","tw-items-center","tw-ml-1.5"],["type","button","bitIconButton","bwi-drag-and-drop","cdkDragHandle","","data-testid","reorder-toggle-button",1,"!tw-py-0","!tw-px-1",3,"keydown","label"],[1,"!tw-mb-5"],["formControlName","matchDetection"],[3,"label","value","disabled",4,"ngFor","ngForOf"],[4,"ngIf"],[3,"label","value","disabled"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0,2),Fl.j41(1,"div",3)(2,"div",4)(3,"bit-form-field",5)(4,"bit-label"),Fl.EFF(5),Fl.k0s(),Fl.nrm(6,"input",6,0),Fl.j41(8,"button",7),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.toggleMatchDetection())}),Fl.k0s(),Fl.DNE(9,ZV,2,3,"button",8),Fl.k0s(),Fl.DNE(10,QV,3,4,"div",9),Fl.k0s(),Fl.DNE(11,nB,8,5,"bit-form-field",10),Fl.k0s(),Fl.bVm()}2&e&&(Fl.Y8G("formGroup",t.uriForm),Fl.R7$(2),Fl.AVh("!tw-mb-1",t.showMatchDetection),Fl.R7$(3),Fl.JRh(t.uriLabel),Fl.R7$(3),Fl.Y8G("bitIconButton",t.showMatchDetection?"bwi-cog-f":"bwi-cog")("label",t.toggleTitle),Fl.R7$(),Fl.Y8G("ngIf",t.canRemove),Fl.R7$(),Fl.Y8G("ngIf",t.canReorder),Fl.R7$(),Fl.Y8G("ngIf",t.showMatchDetection))},dependencies:[yl.ad,yl.Fb,Gu,Ac,hu,fu,ju,nw,Il.X1,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,Ql,Zl,sf,Wu,qu,zu,kl.Sq,kl.bT,rf],encapsulation:2});var sB=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function oB(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"vault-autofill-uri-option",7),Fl.nI1(1,"async"),Fl.bIt("remove",function(){const t=a.eBV(e).index,i=Fl.XpG();return a.Njj(i.removeUri(t))})("onKeydown",function(t){const i=a.eBV(e).index,n=Fl.XpG();return a.Njj(n.onUriItemKeydown(t,i))}),Fl.k0s()}if(2&e){const e=t.index,i=Fl.XpG();Fl.Y8G("cdkDragDisabled",i.uriControls.length<=1||i.autofillOptionsForm.disabled)("formControlName",e)("canReorder",i.uriControls.length>1&&i.autofillOptionsForm.enabled)("canRemove",i.uriControls.length>1&&i.autofillOptionsForm.enabled)("defaultMatchDetection",Fl.bMT(1,6,i.defaultMatchDetection$))("index",e)}}function aB(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",8),Fl.nI1(1,"async"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.addUri({uri:null,matchDetection:null},!0))}),Fl.nrm(2,"i",9),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.AVh("tw-mb-6",Fl.bMT(1,3,e.autofillOnPageLoadEnabled$)),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,5,"addWebsite")," ")}}function lB(e,t){if(1&e&&(Fl.j41(0,"bit-form-field",10)(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"bit-select",11),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.JRh(Fl.bMT(3,2,"autoFillOnPageLoad")),Fl.R7$(2),Fl.Y8G("items",e.autofillOptions)}}class cB{get uriControls(){return this.autofillOptionsForm.controls.uris.controls}get isPartialEdit(){return"partial-edit"===this.cipherFormContainer.config.mode}constructor(e,t,i,n,r,s,o){this.cipherFormContainer=e,this.formBuilder=t,this.i18nService=i,this.liveAnnouncer=n,this.domainSettingsService=r,this.autofillSettingsService=s,this.platformUtilsService=o,this.autofillOptionsForm=this.formBuilder.group({uris:this.formBuilder.array([]),autofillOnPageLoad:[null]}),this.defaultMatchDetection$=this.domainSettingsService.resolvedDefaultUriMatchStrategy$.pipe((0,Eo.p)(()=>this.platformUtilsService.getClientType()==Da.Browser)),this.autofillOnPageLoadEnabled$=this.autofillSettingsService.autofillOnPageLoad$,this.autofillOptions=[{label:this.i18nService.t("default"),value:null},{label:this.i18nService.t("yes"),value:!0},{label:this.i18nService.t("no"),value:!1}],this.focusOnNewInput$=new Co.B,this.cipherFormContainer.registerChildForm("autoFillOptions",this.autofillOptionsForm),this.autofillOptionsForm.valueChanges.pipe((0,xl.pQ)()).subscribe(e=>{this.cipherFormContainer.patchCipher(t=>{var i;return t.login.uris=null===(i=e.uris)||void 0===i?void 0:i.map(e=>Object.assign(new QE,{uri:e.uri,match:e.matchDetection})),t.login.autofillOnPageLoad=e.autofillOnPageLoad,t})}),this.updateDefaultAutofillLabel(),this.focusOnNewInput$.pipe((0,xl.pQ)(),(0,go.n)(()=>this.uriOptions.changes.pipe((0,_o.s)(1))),(0,go.n)(()=>this.liveAnnouncer.announce(this.i18nService.t("websiteAdded"),"polite"))).subscribe(()=>{var e,t;null===(t=null===(e=this.uriOptions)||void 0===e?void 0:e.last)||void 0===t||t.focusInput()}),this.cipherFormContainer.formStatusChange$.pipe((0,xl.pQ)()).subscribe(e=>{"disabled"===e?this.autofillOptionsForm.disable({emitEvent:!1}):this.isPartialEdit||this.autofillOptionsForm.enable({emitEvent:!1})})}ngOnInit(){const e=this.cipherFormContainer.getInitialCipherView();e?this.initFromExistingCipher(e.login):this.initNewCipher(),this.isPartialEdit&&this.autofillOptionsForm.disable()}initFromExistingCipher(e){var t,i,n;null===(t=e.uris)||void 0===t||t.forEach(e=>{this.addUri({uri:e.uri,matchDetection:e.match},!1,!1)}),this.autofillOptionsForm.patchValue({autofillOnPageLoad:e.autofillOnPageLoad}),(null===(i=this.cipherFormContainer.config.initialValues)||void 0===i?void 0:i.loginUri)&&!this.cipherFormContainer.initializedWithCachedCipher()&&-1===(null===(n=e.uris)||void 0===n?void 0:n.findIndex(e=>e.uri===this.cipherFormContainer.config.initialValues.loginUri))&&this.addUri({uri:this.cipherFormContainer.config.initialValues.loginUri,matchDetection:null})}initNewCipher(){var e,t;this.addUri({uri:null!==(t=null===(e=this.cipherFormContainer.config.initialValues)||void 0===e?void 0:e.loginUri)&&void 0!==t?t:null,matchDetection:null}),this.autofillOptionsForm.patchValue({autofillOnPageLoad:null})}updateDefaultAutofillLabel(){this.autofillSettingsService.autofillOnPageLoadDefault$.pipe((0,xl.pQ)()).subscribe(e=>{const t=this.autofillOptions.find(t=>t.value===e);t&&(this.autofillOptions[0].label=this.i18nService.t("defaultLabelWithValue",t.label),this.autofillOptions=[...this.autofillOptions])})}addUri(e={uri:null,matchDetection:null},t=!1,i=!0){this.autofillOptionsForm.controls.uris.push(this.formBuilder.control(e),{emitEvent:i}),t&&this.focusOnNewInput$.next()}removeUri(e){this.autofillOptionsForm.controls.uris.removeAt(e)}updateUriFields(){this.cipherFormContainer.patchCipher(e=>(e.login.uris=this.uriControls.map(e=>{var t;return Object.assign(new QE,{uri:e.value.uri,match:null!==(t=e.value.matchDetection)&&void 0!==t?t:null})}),e))}onUriItemDrop(e){(0,yl.HD)(this.uriControls,e.previousIndex,e.currentIndex),this.updateUriFields()}onUriItemKeydown(e,t){return sB(this,void 0,void 0,function*(){"ArrowUp"===e.key&&0!==t&&(yield this.reorderUriItems(e,t,"Up")),"ArrowDown"===e.key&&t!==this.uriControls.length-1&&(yield this.reorderUriItems(e,t,"Down"))})}reorderUriItems(e,t,i){return sB(this,void 0,void 0,function*(){const n=t+("Up"===i?-1:1);e.preventDefault(),yield this.liveAnnouncer.announce(this.i18nService.t(`reorderField${i}`,this.i18nService.t("websiteUri"),n+1,this.uriControls.length),"assertive"),(0,yl.HD)(this.uriControls,t,n),this.updateUriFields(),requestAnimationFrame(()=>{e.target.focus()})})}}cB.ɵfac=function(e){return new(e||cB)(Fl.rXU(eV),Fl.rXU(Il.ok),Fl.rXU(Ul),Fl.rXU(gl.Ai),Fl.rXU(YE),Fl.rXU(BE),Fl.rXU(Hb))},cB.ɵcmp=Fl.VBU({type:cB,selectors:[["vault-autofill-options"]],viewQuery:function(e,t){if(1&e&&Fl.GBs(rB,5),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.uriOptions=e)}},decls:11,vars:9,consts:[[1,"tw-mb-5","bit-compact:tw-mb-4",3,"formGroup"],["bitTypography","h6"],["cdkDropList","",3,"cdkDropListDropped"],["formArrayName","uris"],["cdkDrag","",3,"cdkDragDisabled","formControlName","canReorder","canRemove","defaultMatchDetection","index","remove","onKeydown",4,"ngFor","ngForOf"],["type","button","bitLink","","linkType","primary",3,"tw-mb-6","click",4,"ngIf"],["disableMargin","",4,"ngIf"],["cdkDrag","",3,"remove","onKeydown","cdkDragDisabled","formControlName","canReorder","canRemove","defaultMatchDetection","index"],["type","button","bitLink","","linkType","primary",3,"click"],["aria-hidden","true",1,"bwi","bwi-plus","tw-font-medium"],["disableMargin",""],["formControlName","autofillOnPageLoad",3,"items"]],template:function(e,t){1&e&&(Fl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"bit-card",2),Fl.bIt("cdkDropListDropped",function(e){return t.onUriItemDrop(e)}),Fl.qex(6,3),Fl.DNE(7,oB,2,8,"vault-autofill-uri-option",4),Fl.bVm(),Fl.DNE(8,aB,5,7,"button",5)(9,lB,5,4,"bit-form-field",6),Fl.nI1(10,"async"),Fl.k0s()()),2&e&&(Fl.Y8G("formGroup",t.autofillOptionsForm),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,5,"autofillOptions")," "),Fl.R7$(4),Fl.Y8G("ngForOf",t.uriControls),Fl.R7$(),Fl.Y8G("ngIf",t.autofillOptionsForm.enabled),Fl.R7$(),Fl.Y8G("ngIf",Fl.bMT(10,7,t.autofillOnPageLoadEnabled$)))},dependencies:[yl.ad,yl.O7,yl.T1,Nx,tc,rc,sf,Ex,Il.X1,Il.BC,Il.cb,Il.j4,Il.JD,Il.v8,kl.Sq,Gu,Ac,ju,Wu,qu,Ql,rB,Hh,uw,kl.bT,rf,kl.Jj],encapsulation:2});class uB{}var dB=i(65023);const hB=14,pB=24,vB=[{id:"right-start",offsetX:hB,offsetY:-24,originX:"end",originY:"center",overlayX:"start",overlayY:"top",panelClass:["bit-popover-right","bit-popover-right-start"]},{id:"right-center",offsetX:hB,originX:"end",originY:"center",overlayX:"start",overlayY:"center",panelClass:["bit-popover-right","bit-popover-right-center"]},{id:"right-end",offsetX:hB,offsetY:pB,originX:"end",originY:"center",overlayX:"start",overlayY:"bottom",panelClass:["bit-popover-right","bit-popover-right-end"]},{id:"left-start",offsetX:-14,offsetY:-24,originX:"start",originY:"center",overlayX:"end",overlayY:"top",panelClass:["bit-popover-left","bit-popover-left-start"]},{id:"left-center",offsetX:-14,originX:"start",originY:"center",overlayX:"end",overlayY:"center",panelClass:["bit-popover-left","bit-popover-left-center"]},{id:"left-end",offsetX:-14,offsetY:pB,originX:"start",originY:"center",overlayX:"end",overlayY:"bottom",panelClass:["bit-popover-left","bit-popover-left-end"]},{id:"below-center",offsetY:hB,originX:"center",originY:"bottom",overlayX:"center",overlayY:"top",panelClass:["bit-popover-below","bit-popover-below-center"]},{id:"below-start",offsetX:-24,offsetY:hB,originX:"center",originY:"bottom",overlayX:"start",overlayY:"top",panelClass:["bit-popover-below","bit-popover-below-start"]},{id:"below-end",offsetX:pB,offsetY:hB,originX:"center",originY:"bottom",overlayX:"end",overlayY:"top",panelClass:["bit-popover-below","bit-popover-below-end"]},{id:"above-center",offsetY:-14,originX:"center",originY:"top",overlayX:"center",overlayY:"bottom",panelClass:["bit-popover-above","bit-popover-above-center"]},{id:"above-start",offsetX:-24,offsetY:-14,originX:"center",originY:"top",overlayX:"start",overlayY:"bottom",panelClass:["bit-popover-above","bit-popover-above-start"]},{id:"above-end",offsetX:pB,offsetY:-14,originX:"center",originY:"top",overlayX:"end",overlayY:"bottom",panelClass:["bit-popover-above","bit-popover-above-end"]}];class fB{get positions(){if(!this.position())return vB;const e=vB.find(e=>e.id===this.position());return e?[e,...vB]:vB}get defaultPopoverConfig(){return{hasBackdrop:!0,backdropClass:"cdk-overlay-transparent-backdrop",scrollStrategy:this.overlay.scrollStrategies.reposition(),positionStrategy:this.overlay.position().flexibleConnectedTo(this.elementRef).withPositions(this.positions).withLockedPosition(!0).withFlexibleDimensions(!1).withPush(!0)}}constructor(e,t,i){this.elementRef=e,this.viewContainerRef=t,this.overlay=i,this.popoverOpen=(0,o.geq)(!1),this.popover=o.hFB.required({alias:"bitPopoverTriggerFor"}),this.position=(0,o.hFB)(),this.overlayRef=null,this.closedEventsSub=null,this.hasInitialized=!1,this.rafId1=null,this.rafId2=null,this.isDestroyed=!1,(0,Rl.QZ)(()=>{this.isDestroyed||!this.popoverOpen()||this.overlayRef||(this.hasInitialized?this.openPopover():null===this.rafId1&&null===this.rafId2&&(this.rafId1=requestAnimationFrame(()=>{this.rafId2=requestAnimationFrame(()=>{this.isDestroyed||!this.popoverOpen()||this.overlayRef||(this.openPopover(),this.hasInitialized=!0,this.rafId2=null)}),this.rafId1=null})))})}togglePopover(){this.isDestroyed||(this.popoverOpen()?this.closePopover():this.openPopover())}openPopover(){if(this.overlayRef)return;this.popoverOpen.set(!0),this.overlayRef=this.overlay.create(this.defaultPopoverConfig);const e=new Vl.VA(this.popover().templateRef(),this.viewContainerRef);this.overlayRef.attach(e),this.closedEventsSub=this.getClosedEvents().subscribe(()=>{this.destroyPopover()})}getClosedEvents(){if(!this.overlayRef)throw new Error("Overlay reference is not available");const e=this.overlayRef.detachments(),t=this.overlayRef.keydownEvents().pipe((0,Eo.p)(e=>"Escape"===e.key)),i=this.overlayRef.backdropClick(),n=this.popover().closed;return e.pipe((0,dB.X)(t,i,n))}destroyPopover(){this.popoverOpen()&&(this.popoverOpen.set(!1),this.disposeAll())}disposeAll(){var e,t;null===(e=this.closedEventsSub)||void 0===e||e.unsubscribe(),this.closedEventsSub=null,null===(t=this.overlayRef)||void 0===t||t.dispose(),this.overlayRef=null,null!==this.rafId1&&(cancelAnimationFrame(this.rafId1),this.rafId1=null),null!==this.rafId2&&(cancelAnimationFrame(this.rafId2),this.rafId2=null)}ngOnDestroy(){this.isDestroyed=!0,this.disposeAll()}closePopover(){this.destroyPopover()}}fB.ɵfac=function(e){return new(e||fB)(Fl.rXU(Fl.aKT),Fl.rXU(Fl.c1b),Fl.rXU(wl.hJ))},fB.ɵdir=Fl.FsC({type:fB,selectors:[["","bitPopoverTriggerFor",""]],hostVars:1,hostBindings:function(e,t){1&e&&Fl.bIt("click",function(){return t.togglePopover()}),2&e&&Fl.BMQ("aria-expanded",t.popoverOpen())},inputs:{popoverOpen:[1,"popoverOpen"],popover:[1,"bitPopoverTriggerFor","popover"],position:[1,"position"]},outputs:{popoverOpen:"popoverOpenChange"},exportAs:["popoverTrigger"]});var mB=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function gB(e,t){if(1&e&&(Fl.nrm(0,"button",18),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG();Fl.Y8G("label",Fl.bMT(1,2,"generateUsername"))("bitAction",e.generateUsername)}}function yB(e,t){1&e&&(Fl.qex(0),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.bVm()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"securePasswordGenerated")," "))}function bB(e,t){1&e&&(Fl.qex(0),Fl.j41(1,"span",19),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"span",20),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.nrm(8,"i",21),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s(),Fl.bVm()),2&e&&(Fl.R7$(2),Fl.Lme(" ",Fl.bMT(3,4,"useGeneratorHelpTextPartOne")," ",Fl.bMT(4,6,"useGeneratorHelpTextPartTwo")," "),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(7,8,"useGeneratorHelpTextPartOne")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(10,10,"useGeneratorHelpTextPartTwo")," "))}function wB(e,t){if(1&e&&(Fl.j41(0,"bit-hint"),Fl.DNE(1,yB,3,3,"ng-container",6)(2,bB,11,12,"ng-container",6),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("ngIf",e.newPasswordGenerated),Fl.R7$(),Fl.Y8G("ngIf",!e.newPasswordGenerated)}}function SB(e,t){if(1&e&&(Fl.nrm(0,"button",22),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG();Fl.Y8G("label",Fl.bMT(1,2,"checkPassword"))("bitAction",e.checkPassword)}}function kB(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",23),Fl.bIt("toggledChange",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.logVisibleEvent(t,i.EventType.Cipher_ClientToggledPasswordVisible))}),Fl.k0s()}}function IB(e,t){if(1&e&&(Fl.nrm(0,"button",24),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG();Fl.Y8G("label",Fl.bMT(1,2,"generatePassword"))("bitAction",e.generatePassword)}}function CB(e,t){if(1&e&&(Fl.nrm(0,"button",27),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG(2);Fl.Y8G("bitAction",e.removePasskey)("label",Fl.bMT(1,2,"removePasskey"))}}function TB(e,t){if(1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",25),Fl.DNE(5,CB,2,4,"button",26),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.JRh(Fl.bMT(3,3,"typePasskey")),Fl.R7$(2),Fl.Y8G("value",e.fido2CredentialCreationDateValue),Fl.R7$(),Fl.Y8G("ngIf",e.loginDetailsForm.enabled&&e.viewHiddenFields)}}function PB(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",28),Fl.bIt("toggledChange",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.logVisibleEvent(t,i.EventType.Cipher_ClientToggledTOTPSeedVisible))}),Fl.k0s()}}function FB(e,t){if(1&e&&(Fl.nrm(0,"button",29),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG();Fl.Y8G("bitAction",e.captureTotp)("label",Fl.bMT(1,2,"totpCapture"))}}class RB{get canCaptureTotp(){var e;return!!(null===(e=this.totpCaptureService)||void 0===e?void 0:e.canCaptureTotp(window))&&this.loginDetailsForm.controls.totp.enabled}get hasPasskey(){return null!=this.existingFido2Credentials&&this.existingFido2Credentials.length>0}get fido2CredentialCreationDateValue(){var e,t;return`${this.i18nService.t("dateCreated")} ${this.datePipe.transform(null===(t=null===(e=this.existingFido2Credentials)||void 0===e?void 0:e[0])||void 0===t?void 0:t.creationDate,"short")}`}get viewHiddenFields(){return!this.cipherFormContainer.originalCipherView||this.cipherFormContainer.originalCipherView.viewPassword}get initialValues(){return this.cipherFormContainer.config.initialValues}constructor(e,t,i,n,r,s,o,c){this.cipherFormContainer=e,this.formBuilder=t,this.i18nService=i,this.generationService=n,this.auditService=r,this.toastService=s,this.eventCollectionService=o,this.totpCaptureService=c,this.EventType=Ua,this.loginDetailsForm=this.formBuilder.group({username:[""],password:[""],totp:[""]}),this.datePipe=(0,a.WQX)(kl.vh),this.destroyRef=(0,a.WQX)(a.abz),this.logVisibleEvent=(e,t)=>mB(this,void 0,void 0,function*(){const{mode:i,originalCipher:n}=this.cipherFormContainer.config,r=["edit","partial-edit"].includes(i);e&&r&&n&&(yield this.eventCollectionService.collect(t,n.id,!1,n.organizationId))}),this.captureTotp=()=>mB(this,void 0,void 0,function*(){if(this.canCaptureTotp)try{const e=yield this.totpCaptureService.captureTotpSecret();e&&(this.loginDetailsForm.controls.totp.patchValue(e),this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("totpCaptureSuccess")}))}catch(e){this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("totpCaptureError")})}}),this.removePasskey=()=>mB(this,void 0,void 0,function*(){this.existingFido2Credentials=null,this.cipherFormContainer.patchCipher(e=>(e.login.fido2Credentials=null,e))}),this.generatePassword=()=>mB(this,void 0,void 0,function*(){const e=yield this.generationService.generatePassword();e&&(this.loginDetailsForm.controls.password.patchValue(e),this.newPasswordGenerated=!0)}),this.generateUsername=()=>mB(this,void 0,void 0,function*(){const e=yield this.generationService.generateUsername(this.cipherFormContainer.website);e&&this.loginDetailsForm.controls.username.patchValue(e)}),this.checkPassword=()=>mB(this,void 0,void 0,function*(){const e=this.loginDetailsForm.controls.password.value;if(null==e||""===e)return;const t=yield this.auditService.passwordLeaked(e);t>0?this.toastService.showToast({variant:"warning",title:null,message:this.i18nService.t("passwordExposed",t.toString())}):this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("passwordSafe")})}),this.cipherFormContainer.registerChildForm("loginDetails",this.loginDetailsForm),this.loginDetailsForm.valueChanges.pipe((0,xl.pQ)(),(0,l.T)(()=>this.loginDetailsForm.getRawValue())).subscribe(e=>{this.cipherFormContainer.patchCipher(t=>{var i;return Object.assign(t.login,{username:e.username,password:e.password,totp:null===(i=e.totp)||void 0===i?void 0:i.trim()}),t})})}ngOnInit(){const e=this.cipherFormContainer.getInitialCipherView();e?this.initFromExistingCipher(e.login):this.initNewCipher(),"partial-edit"===this.cipherFormContainer.config.mode&&this.loginDetailsForm.disable(),this.cipherFormContainer.formStatusChange$.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{"enabled"===e&&(this.viewHiddenFields||(this.loginDetailsForm.controls.password.disable(),this.loginDetailsForm.controls.totp.disable()))})}initFromExistingCipher(e){var t,i,n,r;this.loginDetailsForm.patchValue({username:null!==(i=null===(t=this.initialValues)||void 0===t?void 0:t.username)&&void 0!==i?i:e.username,password:null!==(r=null===(n=this.initialValues)||void 0===n?void 0:n.password)&&void 0!==r?r:e.password,totp:e.totp}),"clone"!=this.cipherFormContainer.config.mode&&(this.existingFido2Credentials=e.fido2Credentials),this.viewHiddenFields||(this.loginDetailsForm.controls.password.disable(),this.loginDetailsForm.controls.totp.disable())}initNewCipher(){var e,t;this.loginDetailsForm.patchValue({username:(null===(e=this.initialValues)||void 0===e?void 0:e.username)||"",password:(null===(t=this.initialValues)||void 0===t?void 0:t.password)||""})}}RB.ɵfac=function(e){return new(e||RB)(Fl.rXU(eV),Fl.rXU(Il.ok),Fl.rXU(Ul),Fl.rXU(ZN),Fl.rXU(zb),Fl.rXU(qb),Fl.rXU(I$),Fl.rXU(uB,8))},RB.ɵcmp=Fl.VBU({type:RB,selectors:[["vault-login-details-section"]],decls:39,vars:31,consts:[["totpPopover",""],[1,"tw-mb-5","bit-compact:tw-mb-4",3,"formGroup"],["bitTypography","h6"],["bitInput","","formControlName","username"],["type","button","bitIconButton","bwi-generate","bitSuffix","","data-testid","generate-username-button",3,"label","bitAction",4,"ngIf"],["bitInput","","formControlName","password","type","password",1,"tw-font-mono"],[4,"ngIf"],["type","button","bitIconButton","bwi-check-circle","bitSuffix","","data-testid","check-password-button",3,"label","bitAction",4,"ngIf"],["type","button","bitIconButton","","bitSuffix","","data-testid","toggle-password-visibility","bitPasswordInputToggle","",3,"toggledChange",4,"ngIf"],["type","button","bitIconButton","bwi-generate","bitSuffix","","data-testid","generate-password-button",3,"label","bitAction",4,"ngIf"],["disableMargin",""],["bitLink","","type","button","slot","end",3,"bitPopoverTriggerFor","appA11yTitle"],["aria-hidden","true",1,"bwi","bwi-sm","bwi-question-circle"],[3,"title"],[1,"tw-mb-0"],["bitInput","","formControlName","totp","type","password",1,"tw-font-mono"],["type","button","bitIconButton","","bitSuffix","","data-testid","toggle-totp-visibility","bitPasswordInputToggle","",3,"toggledChange",4,"ngIf"],["type","button","bitIconButton","bwi-camera","bitSuffix","","data-testid","capture-totp-button",3,"bitAction","label",4,"ngIf"],["type","button","bitIconButton","bwi-generate","bitSuffix","","data-testid","generate-username-button",3,"label","bitAction"],[1,"tw-sr-only"],["aria-hidden","true"],["aria-hidden","true",1,"bwi","bwi-generate"],["type","button","bitIconButton","bwi-check-circle","bitSuffix","","data-testid","check-password-button",3,"label","bitAction"],["type","button","bitIconButton","","bitSuffix","","data-testid","toggle-password-visibility","bitPasswordInputToggle","",3,"toggledChange"],["type","button","bitIconButton","bwi-generate","bitSuffix","","data-testid","generate-password-button",3,"label","bitAction"],["bitInput","","disabled","","data-testid","passkey-field",3,"value"],["type","button","bitIconButton","bwi-minus-circle","buttonType","danger","bitSuffix","","data-testid","remove-passkey-button",3,"bitAction","label",4,"ngIf"],["type","button","bitIconButton","bwi-minus-circle","buttonType","danger","bitSuffix","","data-testid","remove-passkey-button",3,"bitAction","label"],["type","button","bitIconButton","","bitSuffix","","data-testid","toggle-totp-visibility","bitPasswordInputToggle","",3,"toggledChange"],["type","button","bitIconButton","bwi-camera","bitSuffix","","data-testid","capture-totp-button",3,"bitAction","label"]],template:function(e,t){if(1&e&&(Fl.j41(0,"section",1)(1,"bit-section-header")(2,"h2",2),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"bit-card")(6,"bit-form-field")(7,"bit-label"),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.nrm(10,"input",3),Fl.DNE(11,gB,2,4,"button",4),Fl.k0s(),Fl.j41(12,"bit-form-field")(13,"bit-label"),Fl.EFF(14),Fl.nI1(15,"i18n"),Fl.k0s(),Fl.nrm(16,"input",5),Fl.DNE(17,wB,3,2,"bit-hint",6)(18,SB,2,4,"button",7)(19,kB,1,0,"button",8)(20,IB,2,4,"button",9),Fl.k0s(),Fl.DNE(21,TB,6,5,"bit-form-field",6),Fl.j41(22,"bit-form-field",10)(23,"bit-label"),Fl.EFF(24),Fl.nI1(25,"i18n"),Fl.j41(26,"button",11),Fl.nI1(27,"i18n"),Fl.nrm(28,"i",12),Fl.k0s(),Fl.j41(29,"bit-popover",13,0),Fl.nI1(31,"i18n"),Fl.j41(32,"p",14),Fl.EFF(33),Fl.nI1(34,"i18n"),Fl.k0s()()(),Fl.nrm(35,"input",15),Fl.DNE(36,PB,1,0,"button",16)(37,FB,2,4,"button",17),Fl.k0s()()(),Fl.nrm(38,"vault-autofill-options")),2&e){const e=Fl.sdS(30);Fl.Y8G("formGroup",t.loginDetailsForm),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,17,"loginCredentials")," "),Fl.R7$(5),Fl.JRh(Fl.bMT(9,19,"username")),Fl.R7$(3),Fl.Y8G("ngIf",t.loginDetailsForm.controls.username.enabled),Fl.R7$(3),Fl.JRh(Fl.bMT(15,21,"password")),Fl.R7$(3),Fl.Y8G("ngIf",t.loginDetailsForm.controls.password.enabled),Fl.R7$(),Fl.Y8G("ngIf",t.loginDetailsForm.controls.password.enabled&&(null==t.loginDetailsForm.controls.password.value?null:t.loginDetailsForm.controls.password.value.length)>0),Fl.R7$(),Fl.Y8G("ngIf",t.viewHiddenFields),Fl.R7$(),Fl.Y8G("ngIf",t.loginDetailsForm.controls.password.enabled),Fl.R7$(),Fl.Y8G("ngIf",t.hasPasskey),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(25,23,"authenticatorKey")," "),Fl.R7$(2),Fl.Y8G("bitPopoverTriggerFor",e)("appA11yTitle",Fl.bMT(27,25,"learnMoreAboutAuthenticators")),Fl.R7$(3),Fl.Y8G("title",Fl.bMT(31,27,"totpHelperTitle")),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(34,29,t.canCaptureTotp?"totpHelperWithCapture":"totpHelper")," "),Fl.R7$(3),Fl.Y8G("ngIf",t.viewHiddenFields),Fl.R7$(),Fl.Y8G("ngIf",t.canCaptureTotp)}},dependencies:[Il.X1,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,Nx,tc,rc,sf,rw,Ex,Gu,Ac,hu,fu,ju,iw,nw,Ql,Zl,pc,Bd,kl.bT,qV,XV,fB,cB,Hh,uw,rf],encapsulation:2});var xB=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function AB(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-spotlight",1),Fl.bIt("onDismiss",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.dismissNewItemSpotlight())}),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.Y8G("title",e.nudgeTitle)("subtitle",e.nudgeBody)}}class DB{constructor(e,t,i){this.i18nService=e,this.accountService=t,this.nudgesService=i,this.configType=o.hFB.required(),this.activeUserId$=this.accountService.activeAccount$.pipe(iv),this.showNewItemSpotlight$=(0,jo.z)([this.activeUserId$,(0,xl.br)(this.configType).pipe((0,l.T)(e=>this.mapToNudgeType(e)))]).pipe((0,go.n)(([e,t])=>this.nudgesService.showNudgeSpotlight$(t,e))),this.nudgeTitle="",this.nudgeBody="",this.dismissalNudgeType=null}mapToNudgeType(e){switch(e){case nm.gCH.Login:{const e=this.i18nService.t("newLoginNudgeBodyOne"),t=this.i18nService.t("newLoginNudgeBodyBold"),i=this.i18nService.t("newLoginNudgeBodyTwo");return this.dismissalNudgeType=Sx.NewLoginItemStatus,this.nudgeTitle=this.i18nService.t("newLoginNudgeTitle"),this.nudgeBody=`${e} <strong>${t}</strong> ${i}`,Sx.NewLoginItemStatus}case nm.gCH.Card:return this.dismissalNudgeType=Sx.NewCardItemStatus,this.nudgeTitle=this.i18nService.t("newCardNudgeTitle"),this.nudgeBody=this.i18nService.t("newCardNudgeBody"),Sx.NewCardItemStatus;case nm.gCH.Identity:return this.dismissalNudgeType=Sx.NewIdentityItemStatus,this.nudgeTitle=this.i18nService.t("newIdentityNudgeTitle"),this.nudgeBody=this.i18nService.t("newIdentityNudgeBody"),Sx.NewIdentityItemStatus;case nm.gCH.SecureNote:return this.dismissalNudgeType=Sx.NewNoteItemStatus,this.nudgeTitle=this.i18nService.t("newNoteNudgeTitle"),this.nudgeBody=this.i18nService.t("newNoteNudgeBody"),Sx.NewNoteItemStatus;case nm.gCH.SshKey:{const e=this.i18nService.t("newSshNudgeBodyOne"),t=this.i18nService.t("newSshNudgeBodyTwo");return this.dismissalNudgeType=Sx.NewSshItemStatus,this.nudgeTitle=this.i18nService.t("newSshNudgeTitle"),this.nudgeBody=`${e} <a href="https://bitwarden.com/help/ssh-agent" class="tw-text-primary-600 tw-font-medium" target="_blank">${t}</a>`,Sx.NewSshItemStatus}default:throw new Error("Unsupported cipher type")}}dismissNewItemSpotlight(){return xB(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.activeUserId$);this.dismissalNudgeType&&e&&(yield this.nudgesService.dismissNudge(this.dismissalNudgeType,e),this.showNewItemSpotlight$=(0,Go.of)(!1))})}}DB.ɵfac=function(e){return new(e||DB)(Fl.rXU(Ul),Fl.rXU(Zk),Fl.rXU(Ix))},DB.ɵcmp=Fl.VBU({type:DB,selectors:[["vault-new-item-nudge"]],inputs:{configType:[1,"configType"]},decls:2,vars:3,consts:[[3,"title","subtitle"],[3,"onDismiss","title","subtitle"]],template:function(e,t){1&e&&(Fl.nVh(0,AB,1,2,"bit-spotlight",0),Fl.nI1(1,"async")),2&e&&Fl.vxM(Fl.bMT(1,1,t.showNewItemSpotlight$)?0:-1)},dependencies:[Ax,kl.Jj],encapsulation:2});class EB{}var $B=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function OB(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",7),Fl.nI1(1,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.importSshKeyFromClipboard())}),Fl.k0s()}2&e&&Fl.Y8G("label",Fl.mNQ(Fl.bMT(1,2,"importSshKeyFromClipboard")))}class UB{constructor(e,t,i,n,r){this.cipherFormContainer=e,this.formBuilder=t,this.sdkService=i,this.sshImportPromptService=n,this.platformUtilsService=r,this.originalCipherView=(0,o.hFB)(null),this.disabled=(0,o.hFB)(!1),this.sshKeyForm=this.formBuilder.group({privateKey:[""],publicKey:[""],keyFingerprint:[""]}),this.showImport=(0,Rl.EW)(()=>{var e;return this.platformUtilsService.getClientType()!==Da.Web&&(null===(e=this.originalCipherView())||void 0===e?void 0:e.edit)}),this.destroyRef=(0,a.WQX)(a.abz),this.cipherFormContainer.registerChildForm("sshKeyDetails",this.sshKeyForm),this.sshKeyForm.valueChanges.pipe((0,xl.pQ)()).subscribe(e=>{const t=new FO;t.privateKey=e.privateKey,t.publicKey=e.publicKey,t.keyFingerprint=e.keyFingerprint,this.cipherFormContainer.patchCipher(e=>(e.sshKey=t,e))})}ngOnInit(){return $B(this,void 0,void 0,function*(){var e,t;const i=this.cipherFormContainer.getInitialCipherView(),n=null!==(e=null==i?void 0:i.sshKey)&&void 0!==e?e:null===(t=this.originalCipherView())||void 0===t?void 0:t.sshKey;n?this.setInitialValues(n):yield this.generateSshKey(),this.sshKeyForm.disable(),this.cipherFormContainer.formStatusChange$.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{"enabled"===e&&this.sshKeyForm.disable()})})}setInitialValues(e){const{privateKey:t,publicKey:i,keyFingerprint:n}=e;this.sshKeyForm.setValue({privateKey:t,publicKey:i,keyFingerprint:n})}importSshKeyFromClipboard(){return $B(this,void 0,void 0,function*(){const e=yield this.sshImportPromptService.importSshKeyFromClipboard();null!=e&&this.sshKeyForm.setValue({privateKey:e.privateKey,publicKey:e.publicKey,keyFingerprint:e.keyFingerprint})})}generateSshKey(){return $B(this,void 0,void 0,function*(){yield(0,bo._)(this.sdkService.client$);const e=(0,nm.v8c)("Ed25519");this.sshKeyForm.setValue({privateKey:e.privateKey,publicKey:e.publicKey,keyFingerprint:e.fingerprint})})}}UB.ɵfac=function(e){return new(e||UB)(Fl.rXU(eV),Fl.rXU(Il.ok),Fl.rXU(Jk),Fl.rXU(EB),Fl.rXU(Hb))},UB.ɵcmp=Fl.VBU({type:UB,selectors:[["vault-sshkey-section"]],inputs:{originalCipherView:[1,"originalCipherView"],disabled:[1,"disabled"]},decls:23,vars:14,consts:[[1,"tw-mb-5","bit-compact:tw-mb-4",3,"formGroup"],["bitTypography","h6"],["id","privateKey","bitInput","","formControlName","privateKey","type","password"],["type","button","bitIconButton","","bitSuffix","","data-testid","toggle-privateKey-visibility","bitPasswordInputToggle",""],["type","button","bitIconButton","bwi-import","bitSuffix","","data-testid","import-privateKey",3,"label"],["id","publicKey","bitInput","","formControlName","publicKey"],["id","keyFingerprint","bitInput","","formControlName","keyFingerprint"],["type","button","bitIconButton","bwi-import","bitSuffix","","data-testid","import-privateKey",3,"click","label"]],template:function(e,t){1&e&&(Fl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"bit-card")(6,"bit-form-field")(7,"bit-label"),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.nrm(10,"input",2)(11,"button",3),Fl.nVh(12,OB,2,4,"button",4),Fl.k0s(),Fl.j41(13,"bit-form-field")(14,"bit-label"),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s(),Fl.nrm(17,"input",5),Fl.k0s(),Fl.j41(18,"bit-form-field")(19,"bit-label"),Fl.EFF(20),Fl.nI1(21,"i18n"),Fl.k0s(),Fl.nrm(22,"input",6),Fl.k0s()()()),2&e&&(Fl.Y8G("formGroup",t.sshKeyForm),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,6,"typeSshKey")," "),Fl.R7$(5),Fl.JRh(Fl.bMT(9,8,"sshPrivateKey")),Fl.R7$(4),Fl.vxM(t.showImport()?12:-1),Fl.R7$(3),Fl.JRh(Fl.bMT(16,10,"sshPublicKey")),Fl.R7$(5),Fl.JRh(Fl.bMT(21,12,"sshFingerprint")))},dependencies:[Ex,tc,rc,Gu,Ac,fu,ju,iw,nw,Il.X1,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,Wu,Nx,Ql,Zl,sf,kl.MD,rf],encapsulation:2});var MB=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const NB=[[["","slot","attachment-button"]]];function VB(e,t){if(1&e&&Fl.nrm(0,"vault-new-item-nudge",3),2&e){const e=Fl.XpG();Fl.Y8G("configType",e.config.cipherType)}}function BB(e,t){1&e&&Fl.nrm(0,"vault-login-details-section")}function jB(e,t){if(1&e&&Fl.nrm(0,"vault-identity-section",8),2&e){const e=Fl.XpG(2);Fl.Y8G("disabled","partial-edit"===e.config.mode)("originalCipherView",e.originalCipherView)}}function GB(e,t){if(1&e&&Fl.nrm(0,"vault-card-details-section",9),2&e){const e=Fl.XpG(2);Fl.Y8G("originalCipherView",e.originalCipherView)("disabled","partial-edit"===e.config.mode)}}function LB(e,t){if(1&e&&Fl.nrm(0,"vault-sshkey-section",8),2&e){const e=Fl.XpG(2);Fl.Y8G("disabled","partial-edit"===e.config.mode)("originalCipherView",e.originalCipherView)}}function zB(e,t){1&e&&(Fl.qex(0),Fl.SdG(1),Fl.bVm())}function _B(e,t){if(1&e&&(Fl.qex(0),Fl.nrm(1,"vault-item-details-section",4),Fl.DNE(2,BB,1,0,"vault-login-details-section",2)(3,jB,1,2,"vault-identity-section",5)(4,GB,1,2,"vault-card-details-section",6)(5,LB,1,2,"vault-sshkey-section",5),Fl.nrm(6,"vault-additional-options-section",7),Fl.DNE(7,zB,2,0,"ng-container",2),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("config",e.config)("originalCipherView",e.originalCipherView),Fl.R7$(),Fl.Y8G("ngIf",e.config.cipherType===e.CipherType.Login),Fl.R7$(),Fl.Y8G("ngIf",e.config.cipherType===e.CipherType.Identity),Fl.R7$(),Fl.Y8G("ngIf",e.config.cipherType===e.CipherType.Card),Fl.R7$(),Fl.Y8G("ngIf",e.config.cipherType===e.CipherType.SshKey),Fl.R7$(),Fl.Y8G("disableSectionMargin","edit"!==e.config.mode),Fl.R7$(),Fl.Y8G("ngIf","edit"==e.config.mode)}}class KB{get website(){var e,t,i,n,r;return null!==(r=null===(n=null===(i=null===(t=null===(e=this.updatedCipherView)||void 0===e?void 0:e.login)||void 0===t?void 0:t.uris)||void 0===i?void 0:i[0])||void 0===n?void 0:n.uri)&&void 0!==r?r:null}ngAfterViewInit(){this.submitBtn&&(this.bitSubmit.loading$.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.submitBtn.loading.set(e)}),this.bitSubmit.disabled$.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.submitBtn.disabled.set(e)}))}disableFormFields(){this.cipherForm.disable({emitEvent:!1}),this.formStatusChangeSubject.next("disabled")}enableFormFields(){"disabled"===this.formStatusChangeSubject.getValue()&&(this.cipherForm.enable({emitEvent:!1}),this.formStatusChangeSubject.next("enabled"))}registerChildForm(e,t){this.cipherForm.setControl(e,t)}patchCipher(e){this.updatedCipherView=e(this.updatedCipherView),this.cipherFormCacheService.cacheCipherView(this.updatedCipherView)}getInitialCipherView(){const e=this.cipherFormCacheService.getCachedCipherView();return e&&this.initializedWithCachedCipher()?e:this.originalCipherView}initializedWithCachedCipher(){return this.cipherFormCacheService.initializedWithValue}ngOnChanges(){return MB(this,void 0,void 0,function*(){this._firstInitialized&&(yield this.init())})}ngOnInit(){return MB(this,void 0,void 0,function*(){yield this.init(),this._firstInitialized=!0})}init(){return MB(this,void 0,void 0,function*(){if(this.loading=!0,this.changeDetectorRef.detectChanges(),this.updatedCipherView=new RO,this.originalCipherView=null,this.cipherForm=this.formBuilder.group({}),null!=this.config){if("add"!==this.config.mode){if(null==this.config.originalCipher)throw new Error("Original cipher is required for edit or clone mode");this.originalCipherView=yield this.addEditFormService.decryptCipher(this.config.originalCipher),this.updatedCipherView=yield this.addEditFormService.decryptCipher(this.config.originalCipher),"clone"===this.config.mode&&(this.updatedCipherView.id=null,this.updatedCipherView.login&&(this.updatedCipherView.login.fido2Credentials=null))}else this.updatedCipherView.type=this.config.cipherType,this.config.cipherType===nx.SecureNote&&(this.updatedCipherView.secureNote.type=hx);this.setInitialCipherFromCache(),this.loading=!1,this.formReadySubject.next()}})}setInitialCipherFromCache(){if(this.config.initialValues&&(void 0!==this.config.initialValues.username||void 0!==this.config.initialValues.password))return void this.cipherFormCacheService.clearCache();const e=this.cipherFormCacheService.getCachedCipherView();if(null===e)return;const t=this.updatedCipherView.id&&this.updatedCipherView.id===e.id,i=!this.updatedCipherView.id&&!e.id&&this.updatedCipherView.type===e.type;(t||i)&&(this.updatedCipherView=e)}constructor(e,t,i,n,r,s,o,l){this.formBuilder=e,this.addEditFormService=t,this.toastService=i,this.i18nService=n,this.changeDetectorRef=r,this.cipherFormCacheService=s,this.cipherArchiveService=o,this.accountService=l,this.destroyRef=(0,a.WQX)(a.abz),this._firstInitialized=!1,this.cipherSaved=new Fl.bkB,this.formReadySubject=new Co.B,this.formReady=this.formReadySubject.asObservable(),this.formStatusChangeSubject=new Dd.t(null),this.formStatusChange$=this.formStatusChangeSubject.asObservable(),this.cipherForm=this.formBuilder.group({}),this.loading=!0,this.CipherType=nx,this.submit=()=>MB(this,void 0,void 0,function*(){let e="editedItem";if(this.cipherForm.invalid){this.cipherForm.markAllAsTouched();const e=this.countInvalidFields(this.cipherForm);return void(e>0&&this.toastService.showToast({variant:"error",title:null,message:1===e?this.i18nService.t("singleFieldNeedsAttention"):this.i18nService.t("multipleFieldsNeedAttention",e)}))}if(this.beforeSubmit){if(!(yield this.beforeSubmit()))return}!(yield(0,bo._)(this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.cipherArchiveService.userCanArchive$(e)))))&&this.updatedCipherView.archivedDate&&(this.updatedCipherView.archivedDate=null,e="itemRestored");const t=yield this.addEditFormService.saveCipher(this.updatedCipherView,this.config);this.cipherFormCacheService.clearCache(),this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("edit"===this.config.mode||"partial-edit"===this.config.mode?e:"addedItem")}),this.cipherSaved.emit(t)})}countInvalidFields(e){return Object.values(e.controls).reduce((e,t)=>t instanceof Il.gE?e+this.countInvalidFields(t):e+(t.invalid?1:0),0)}}KB.ɵfac=function(e){return new(e||KB)(Fl.rXU(Il.ok),Fl.rXU(QN),Fl.rXU(qb),Fl.rXU(Ul),Fl.rXU(o.gRc),Fl.rXU(tV),Fl.rXU($V),Fl.rXU(Zk))},KB.ɵcmp=Fl.VBU({type:KB,selectors:[["vault-cipher-form"]],viewQuery:function(e,t){if(1&e&&Fl.GBs(Md,5),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.bitSubmit=e.first)}},inputs:{formId:"formId",config:"config",submitBtn:"submitBtn",beforeSubmit:"beforeSubmit"},outputs:{cipherSaved:"cipherSaved",formReady:"formReady",formStatusChange$:"formStatusChange$"},features:[Fl.Jv_([{provide:eV,useExisting:(0,a.Rfq)(()=>KB)},{provide:tV}]),Fl.OA$],ngContentSelectors:["[slot=attachment-button]"],decls:3,vars:5,consts:[[3,"configType",4,"ngIf"],[3,"id","formGroup","bitSubmit"],[4,"ngIf"],[3,"configType"],[3,"config","originalCipherView"],[3,"disabled","originalCipherView",4,"ngIf"],[3,"originalCipherView","disabled",4,"ngIf"],[3,"disableSectionMargin"],[3,"disabled","originalCipherView"],[3,"originalCipherView","disabled"]],template:function(e,t){1&e&&(Fl.NAR(NB),Fl.DNE(0,VB,1,1,"vault-new-item-nudge",0),Fl.j41(1,"form",1),Fl.DNE(2,_B,8,8,"ng-container",2),Fl.k0s()),2&e&&(Fl.Y8G("ngIf",!t.loading),Fl.R7$(),Fl.Y8G("id",t.formId)("formGroup",t.cipherForm)("bitSubmit",t.submit),Fl.R7$(),Fl.Y8G("ngIf",!t.loading))},dependencies:[pc,Md,tc,VP,Gu,Il.X1,Il.qT,Il.cb,Il.j4,Wu,_V,AV,EV,UB,kl.bT,PV,RB,DB],encapsulation:2});var XB=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class qB{constructor(e,t){this.passwordGenerationService=e,this.usernameGenerationService=t}generatePassword(){return XB(this,void 0,void 0,function*(){const[e]=yield this.passwordGenerationService.getOptions();return yield this.passwordGenerationService.generatePassword(e)})}generateUsername(){return XB(this,void 0,void 0,function*(){const e=yield this.usernameGenerationService.getOptions();return yield this.usernameGenerationService.generateUsername(e)})}}qB.ɵfac=function(e){return new(e||qB)(a.KVO(gf),a.KVO(yb))},qB.ɵprov=a.jDH({token:qB,factory:qB.ɵfac});var WB=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class YB{constructor(){this.cipherService=(0,a.WQX)(_b),this.accountService=(0,a.WQX)(Zk),this.taskService=(0,a.WQX)(d$)}decryptCipher(e){return WB(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));return yield this.cipherService.decrypt(e,t)})}saveCipher(e,t){return WB(this,void 0,void 0,function*(){var i,n;const r=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));let s;if(null==e.id||""===e.id)return yield this.cipherService.createWithServer(e,r,t.admin);if(null==t.originalCipher)throw new Error("Original cipher is required for updating an existing cipher");const o=yield this.decryptCipher(t.originalCipher),a=new Set(null!==(i=t.originalCipher.collectionIds)&&void 0!==i?i:[]),l=new Set(null!==(n=e.collectionIds)&&void 0!==n?n:[]);if(null===t.originalCipher.organizationId&&null!=e.organizationId){const i=e.organizationId;e.organizationId=null,s=yield this.cipherService.shareWithServer(e,i,e.collectionIds,r,t.originalCipher)}else if(u=l,(c=a).size===u.size&&[...c].every(e=>u.has(e))){const i=yield this.cipherService.updateWithServer(e,r,o,t.admin);s=yield this.cipherService.encrypt(i,r).then(e=>e.cipher)}else{const i=e.collectionIds;e.collectionIds=t.originalCipher.collectionIds;const n=yield this.cipherService.updateWithServer(e,r,o,t.admin||0===a.size);n.collectionIds=i;const{cipher:l}=yield this.cipherService.encrypt(n,r);s=t.admin||0===a.size?yield this.cipherService.saveCollectionsWithServerAdmin(l):yield this.cipherService.saveCollectionsWithServer(l,r)}var c,u;return yield this.markAssociatedTaskAsComplete(r,e,t),null==s?null:yield this.cipherService.decrypt(s,r)})}markAssociatedTaskAsComplete(e,t,i){return WB(this,void 0,void 0,function*(){var n;const r=yield this.cipherService.decrypt(i.originalCipher,e),s=yield(0,bo._)(this.taskService.pendingTasks$(e).pipe((0,l.T)(e=>e.find(e=>e.type===a$&&e.cipherId===t.id)))),o=t.type===nx.Login&&t.login.password&&t.login.password!==(null===(n=null==r?void 0:r.login)||void 0===n?void 0:n.password);s&&o&&(yield this.taskService.markAsComplete(s.id,e))})}}YB.ɵfac=function(e){return new(e||YB)},YB.ɵprov=a.jDH({token:YB,factory:YB.ɵfac});class HB{}HB.ɵfac=function(e){return new(e||HB)},HB.ɵmod=Fl.$C({type:HB}),HB.ɵinj=a.G2t({providers:[{provide:QN,useClass:YB},{provide:ZN,useClass:qB}],imports:[KB]});class JB{}var ZB=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class QB{constructor(){this.policyService=(0,a.WQX)(Jb),this.organizationService=(0,a.WQX)(WF),this.cipherService=(0,a.WQX)(_b),this.folderService=(0,a.WQX)(UM),this.collectionService=(0,a.WQX)(uR),this.accountService=(0,a.WQX)(Zk),this.organizationDataOwnershipDisabled$=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.policyService.policyAppliesToUser$(op.OrganizationDataOwnership,e)),(0,l.T)(e=>!e))}buildConfig(e,t,i){return ZB(this,void 0,void 0,function*(){var n,r;const s=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv)),[o,a,c,u,d]=yield(0,bo._)((0,jo.z)([this.organizations$(s),this.collectionService.encryptedCollections$(s).pipe((0,l.T)(e=>null!=e?e:[]),(0,go.n)(e=>this.collectionService.decryptedCollections$(s).pipe((0,Eo.p)(t=>t.length===e.length)))),this.organizationDataOwnershipDisabled$,this.folderService.folders$(s).pipe((0,go.n)(e=>this.folderService.folderViews$(s).pipe((0,Eo.p)(t=>t.length>0||0===e.length)))),this.getCipher(s,t)]));return{mode:e,cipherType:null!==(r=null!==(n=null==d?void 0:d.type)&&void 0!==n?n:i)&&void 0!==r?r:nx.Login,admin:!1,organizationDataOwnershipDisabled:c,originalCipher:d,collections:a,organizations:o,folders:u}})}organizations$(e){return this.organizationService.organizations$(e).pipe((0,l.T)(e=>e.filter(e=>e.isMember&&e.enabled&&e.status===rp.Confirmed)))}getCipher(e,t){return null==t?Promise.resolve(null):this.cipherService.get(t,e)}}QB.ɵfac=function(e){return new(e||QB)},QB.ɵprov=a.jDH({token:QB,factory:QB.ɵfac});class ej{constructor(e,t,i=()=>Date.now()){this.logger=e,this.now=i,this.context=t&&"object"==typeof t?t:{}}debug(e,t){this.log(e,Qa.Debug,t)}info(e,t){this.log(e,Qa.Info,t)}warn(e,t){this.log(e,Qa.Warning,t)}error(e,t){this.log(e,Qa.Error,t)}panic(e,t){this.log(e,Qa.Error,t);throw new Error(null!=t?t:"string"==typeof e?e:"a fatal error occurred")}log(e,t,i){const n=Object.assign(Object.assign({},this.context),{message:i,content:null!=e?e:void 0,level:tj(t),"@timestamp":this.now()});"string"!=typeof e||i||(n.message=e,delete n.content),this.logger.write(t,n)}}function tj(e){switch(e){case Qa.Debug:return"debug";case Qa.Info:return"information";case Qa.Warning:return"warning";case Qa.Error:return"error";default:return`${e}`}}const ij=Om({debug(e,t){},info(e,t){},warn(e,t){},error(e,t){},panic(e,t){throw"string"!=typeof e||t?new Error(t):new Error(e)}});function nj(e,t,i){e.warning({method:t,context:i,provider:"tools/log",message:"Semantic logging enabled. 🦟 Please report this bug if you see it 🦟"})}function rj(e){return ij}function sj(e,t){return t.length&&nj(e,"enableLogForTypes",{types:t}),function(i){const{type:n}=i;if("string"==typeof n&&t.includes(n)){const r=new ej(e,i);return nj(e,"enableLogForTypes",{targetType:n,available:t,loggerContext:i}),r}return ij}}function oj(e,t,i){if(e){const e=new ej(t,i);return nj(t,"ifEnabledSemanticLoggerProvider",i),e}return ij}class aj{}aj.ɵfac=function(e){return new(e||aj)},aj.ɵmod=Fl.$C({type:aj}),aj.ɵinj=a.G2t({});var lj=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class cj{constructor(e,t){this.formBuilder=e,this.generatorService=t,this.account$=new Ro.m(1),this.onUpdated=new Fl.bkB,this.settings=this.formBuilder.group({catchallDomain:[""]}),this.saveSettings=new Co.B,this.destroyed$=new Co.B}ngOnChanges(e){return lj(this,void 0,void 0,function*(){"account"in e&&e.account&&this.account$.next(this.account)})}ngOnInit(){return lj(this,void 0,void 0,function*(){const e=yield this.generatorService.settings(Yg.catchall,{account$:this.account$});e.pipe((0,vm.Q)(this.destroyed$)).subscribe(e=>{this.settings.patchValue(e,{emitEvent:!1})}),e.pipe((0,ny.i)(1),(0,vm.Q)(this.destroyed$)).subscribe(this.onUpdated),this.saveSettings.pipe((0,km.E)(this.settings.valueChanges),(0,l.T)(([,e])=>e),(0,vm.Q)(this.destroyed$)).subscribe(e)})}save(e="component api call"){this.saveSettings.next(e)}ngOnDestroy(){this.account$.complete(),this.destroyed$.next(),this.destroyed$.complete()}}cj.ɵfac=function(e){return new(e||cj)(Fl.rXU(Il.ok),Fl.rXU(yf))},cj.ɵcmp=Fl.VBU({type:cj,selectors:[["tools-catchall-settings"]],inputs:{account:"account"},outputs:{onUpdated:"onUpdated"},features:[Fl.OA$],decls:6,vars:4,consts:[[1,"tw-container",3,"formGroup"],["bitInput","","formControlName","catchallDomain","type","text",3,"change"]],template:function(e,t){1&e&&(Fl.j41(0,"form",0)(1,"bit-form-field")(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"input",1),Fl.bIt("change",function(){return t.save("catchallDomain")}),Fl.k0s()()()),2&e&&(Fl.Y8G("formGroup",t.settings),Fl.R7$(3),Fl.JRh(Fl.bMT(4,2,"domainName")))},dependencies:[Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,Gu,Ac,fu,ju,sf,sc],encapsulation:2});var uj=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function dj(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-form-field")(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"input",2),Fl.bIt("change",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.save("domain"))}),Fl.k0s(),Fl.j41(5,"bit-hint"),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s()()}2&e&&(Fl.R7$(2),Fl.JRh(Fl.bMT(3,2,"forwarderDomainName")),Fl.R7$(4),Fl.JRh(Fl.bMT(7,4,"forwarderDomainNameHint")))}function hj(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-form-field")(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"input",3),Fl.bIt("change",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.save("password"))}),Fl.k0s(),Fl.j41(5,"button",4),Fl.bIt("change",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.save("token"))}),Fl.k0s()()}2&e&&(Fl.R7$(2),Fl.JRh(Fl.bMT(3,1,"apiKey")))}function pj(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-form-field",1)(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"input",5),Fl.bIt("change",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.save("baseUrl"))}),Fl.k0s()()}2&e&&(Fl.R7$(2),Fl.JRh(Fl.bMT(3,1,"selfHostBaseUrl")))}const vj=Object.freeze({domain:"domain",token:"token",baseUrl:"baseUrl"});class fj{constructor(e,t){this.formBuilder=e,this.generatorService=t,this.account=null,this.account$=new Ro.m(1),this.forwarder=null,this.onUpdated=new Fl.bkB,this.settings=this.formBuilder.group({[vj.domain]:[""],[vj.token]:[""],[vj.baseUrl]:[""]}),this.vendor=new Ro.m(1),this.saveSettings=new Co.B,this.displayDomain=!1,this.displayToken=!1,this.displayBaseUrl=!1,this.refresh$=new Co.B,this.destroyed$=new Co.B}ngOnInit(){return uj(this,void 0,void 0,function*(){const e=new Ro.m(1);this.vendor.pipe((0,l.T)(e=>this.generatorService.forwarder(e)),(0,vm.Q)(this.destroyed$)).subscribe(t=>{this.displayDomain=t.capabilities.fields.includes("domain"),this.displayToken=t.capabilities.fields.includes("token"),this.displayBaseUrl=t.capabilities.fields.includes("baseUrl"),e.next(t)});const t=e.pipe((0,l.T)(e=>this.generatorService.settings(e,{account$:this.account$})));t.pipe((0,pm.w)(),(0,vm.Q)(this.destroyed$)).subscribe(e=>{this.settings.patchValue(e,{emitEvent:!1})}),e.pipe((0,vm.Q)(this.destroyed$)).subscribe(e=>{for(const t in vj){const i=this.settings.get(t);e.capabilities.fields.includes(t)?null==i||i.enable({emitEvent:!1}):null==i||i.disable({emitEvent:!1})}}),t.pipe((0,l.T)(e=>e.pipe((0,ny.i)(1))),(0,pm.w)(),(0,vm.Q)(this.destroyed$)).subscribe(this.onUpdated),this.saveSettings.pipe((0,km.E)(this.settings.valueChanges,t),(0,vm.Q)(this.destroyed$)).subscribe(([,e,t])=>{t.next(e)})})}save(e="component api call"){this.saveSettings.next(e)}ngOnChanges(e){return uj(this,void 0,void 0,function*(){this.refresh$.complete(),"forwarder"in e&&this.vendor.next(this.forwarder),"account"in e&&this.account$.next(this.account)})}ngOnDestroy(){this.destroyed$.next(),this.destroyed$.complete()}}fj.ɵfac=function(e){return new(e||fj)(Fl.rXU(Il.ok),Fl.rXU(yf))},fj.ɵcmp=Fl.VBU({type:fj,selectors:[["tools-forwarder-settings"]],inputs:{account:"account",forwarder:"forwarder"},outputs:{onUpdated:"onUpdated"},features:[Fl.OA$],decls:4,vars:4,consts:[[1,"tw-container",3,"formGroup"],["disableMargin",""],["bitInput","","formControlName","domain","type","text","placeholder","example.com",3,"change"],["bitInput","","formControlName","token","type","password",3,"change"],["type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle","",3,"change"],["bitInput","","formControlName","baseUrl","type","text",3,"change"]],template:function(e,t){1&e&&(Fl.j41(0,"form",0),Fl.nVh(1,dj,8,6,"bit-form-field"),Fl.nVh(2,hj,6,3,"bit-form-field"),Fl.nVh(3,pj,5,3,"bit-form-field",1),Fl.k0s()),2&e&&(Fl.Y8G("formGroup",t.settings),Fl.R7$(),Fl.vxM(t.displayDomain?1:-1),Fl.R7$(),Fl.vxM(t.displayToken?2:-1),Fl.R7$(),Fl.vxM(t.displayBaseUrl?3:-1))},dependencies:[Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,Gu,Ac,hu,fu,ju,iw,nw,Zl,sf,sc],encapsulation:2});var mj=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function gj(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"div",0)(1,"bit-spotlight",1),Fl.nI1(2,"i18n"),Fl.bIt("onDismiss",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.dismissGeneratorSpotlight(t.NudgeType.GeneratorNudgeStatus))}),Fl.j41(3,"p",2)(4,"span",3),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.j41(7,"span",4),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.nrm(10,"i",5),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s()()()()}2&e&&(Fl.R7$(),Fl.Y8G("title",Fl.bMT(2,4,"generatorNudgeTitle")),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(6,6,"generatorNudgeBodyAria")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(9,8,"generatorNudgeBodyOne")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(12,10,"generatorNudgeBodyTwo")," "))}class yj{constructor(e,t){this.nudgesService=e,this.accountService=t,this.NudgeType=Sx,this.activeUserId$=this.accountService.activeAccount$.pipe(iv),this.showGeneratorSpotlight$=this.activeUserId$.pipe((0,go.n)(e=>this.nudgesService.showNudgeSpotlight$(Sx.GeneratorNudgeStatus,e)))}dismissGeneratorSpotlight(e){return mj(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.activeUserId$);yield this.nudgesService.dismissNudge(e,t)})}}yj.ɵfac=function(e){return new(e||yj)(Fl.rXU(Ix),Fl.rXU(Zk))},yj.ɵcmp=Fl.VBU({type:yj,selectors:[["nudge-generator-spotlight"]],decls:2,vars:3,consts:[[1,"tw-mb-4"],[3,"onDismiss","title"],["bitTypography","body2",1,"tw-text-main","tw-mb-0"],[1,"tw-sr-only"],["aria-hidden","true"],[1,"bwi","bwi-generate"]],template:function(e,t){1&e&&(Fl.nVh(0,gj,13,12,"div",0),Fl.nI1(1,"async")),2&e&&Fl.vxM(Fl.bMT(1,1,t.showGeneratorSpotlight$)?0:-1)},dependencies:[Ax,kl.MD,tc,rc,sc,kl.Jj],encapsulation:2});var bj=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function wj(e,t){1&e&&(Fl.j41(0,"bit-section-header")(1,"h6",9),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()()),2&e&&(Fl.R7$(2),Fl.JRh(Fl.bMT(3,1,"options")))}function Sj(e,t){1&e&&(Fl.j41(0,"p",8),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.JRh(Fl.bMT(2,1,"generatorPolicyInEffect")))}const kj=Object.freeze({numWords:"numWords",includeNumber:"includeNumber",capitalize:"capitalize",wordSeparator:"wordSeparator"});class Ij{constructor(e,t,i,n){this.formBuilder=e,this.generatorService=t,this.i18nService=i,this.logService=n,this.debug=!1,this.log=rj(),this.account=null,this.account$=new Ro.m(1),this.showHeader=!0,this.disableMargin=!1,this.onUpdated=new Fl.bkB,this.settings=this.formBuilder.group({[kj.numWords]:[0],[kj.wordSeparator]:[""],[kj.capitalize]:[!1],[kj.includeNumber]:[!1]}),this.wordSeparatorMaxLength=0,this.saveSettings=new Co.B,this.policyInEffect=!1,this.numWordsBoundariesHint=new Ro.m(1),this.numWordsBoundariesHint$=this.numWordsBoundariesHint.asObservable(),this.destroyed$=new Co.B}ngOnChanges(e){return bj(this,void 0,void 0,function*(){"account"in e&&e.account&&this.account$.next(this.account)})}ngOnInit(){return bj(this,void 0,void 0,function*(){this.log=oj(this.debug,this.logService,{type:"PassphraseSettingsComponent"});const e=yield this.generatorService.settings(Yg.passphrase,{account$:this.account$});e.withConstraints$.pipe((0,Oo.M)(e=>this.log.debug(e,"passphrase settings loaded with constraints")),(0,vm.Q)(this.destroyed$)).subscribe(({state:e,constraints:t})=>{var i,n,r,s,o,a,l,c,u;this.settings.patchValue(e,{emitEvent:!1});let d=this.i18nService.t("spinboxBoundariesHint",null===(n=null===(i=t.numWords)||void 0===i?void 0:i.min)||void 0===n?void 0:n.toString(),null===(s=null===(r=t.numWords)||void 0===r?void 0:r.max)||void 0===s?void 0:s.toString());(null!==(o=e.numWords)&&void 0!==o?o:0)<=(null!==(l=null===(a=t.numWords)||void 0===a?void 0:a.recommendation)&&void 0!==l?l:0)&&(d+=this.i18nService.t("passphraseNumWordsRecommendationHint",null===(u=null===(c=t.numWords)||void 0===c?void 0:c.recommendation)||void 0===u?void 0:u.toString())),this.numWordsBoundariesHint.next(d)}),e.pipe((0,ny.i)(1),(0,Oo.M)(e=>this.log.debug(e,"passphrase settings onUpdate event")),(0,vm.Q)(this.destroyed$)).subscribe(this.onUpdated),this.generatorService.policy$(Yg.passphrase,{account$:this.account$}).pipe((0,vm.Q)(this.destroyed$)).subscribe(({constraints:e})=>{var t,i,n,r,s;this.wordSeparatorMaxLength=null!==(i=null===(t=e.wordSeparator)||void 0===t?void 0:t.maxLength)&&void 0!==i?i:0,this.policyInEffect=null!==(n=e.policyInEffect)&&void 0!==n&&n,this.toggleEnabled(kj.capitalize,!(null===(r=e.capitalize)||void 0===r?void 0:r.readonly)),this.toggleEnabled(kj.includeNumber,!(null===(s=e.includeNumber)||void 0===s?void 0:s.readonly))}),this.saveSettings.pipe((0,km.E)(this.settings.valueChanges),(0,Oo.M)(([e,t])=>this.log.debug({source:e,form:t},"save passphrase settings request")),(0,l.T)(([,e])=>e),(0,vm.Q)(this.destroyed$)).subscribe(e)})}save(e="component api call"){this.saveSettings.next(e)}toggleEnabled(e,t){var i,n;t?null===(i=this.settings.get(e))||void 0===i||i.enable({emitEvent:!1}):null===(n=this.settings.get(e))||void 0===n||n.disable({emitEvent:!1})}ngOnDestroy(){this.destroyed$.next(),this.destroyed$.complete()}}function Cj(e,t){const i={id:e.id,type:e.type,name:Tj(e.i18nKeys.name,t),generate:Tj(e.i18nKeys.generateCredential,t),onGeneratedMessage:Tj(e.i18nKeys.credentialGenerated,t),credentialType:Tj(e.i18nKeys.credentialType,t),copy:Tj(e.i18nKeys.copyCredential,t),useGeneratedValue:Tj(e.i18nKeys.useCredential,t),onlyOnRequest:!e.capabilities.autogenerate,request:e.capabilities.fields};return e.i18nKeys.description&&(i.description=Tj(e.i18nKeys.description,t)),i}function Tj(e,t){return"string"==typeof e?t.t(e):e.literal}function Pj(e,t){return(null!=e?e:0)<(null!=t?t:Number.POSITIVE_INFINITY)}Ij.ɵfac=function(e){return new(e||Ij)(Fl.rXU(Il.ok),Fl.rXU(yf),Fl.rXU(Ul),Fl.rXU(Za))},Ij.ɵcmp=Fl.VBU({type:Ij,selectors:[["tools-passphrase-settings"]],inputs:{debug:"debug",account:"account",showHeader:"showHeader",disableMargin:[2,"disableMargin","disableMargin",$x.he]},outputs:{onUpdated:"onUpdated"},features:[Fl.OA$],decls:31,vars:21,consts:[[3,"disableMargin"],[1,"tw-container",3,"formGroup"],[1,"tw-mb-4"],["disableMargin",""],["bitInput","","formControlName","numWords","id","num-words","type","number",3,"change"],["bitInput","","formControlName","wordSeparator","id","word-separator","type","text",3,"change","maxlength"],["bitCheckbox","","formControlName","capitalize","id","capitalize","type","checkbox",3,"change"],["bitCheckbox","","formControlName","includeNumber","id","include-number","type","checkbox",3,"change"],["bitTypography","helper"],["bitTypography","h6"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-section",0),Fl.nVh(1,wj,4,3,"bit-section-header"),Fl.j41(2,"form",1)(3,"div",2)(4,"bit-card")(5,"bit-form-field",3)(6,"bit-label"),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.j41(9,"input",4),Fl.bIt("change",function(){return t.save("numWords")}),Fl.k0s(),Fl.j41(10,"bit-hint"),Fl.EFF(11),Fl.nI1(12,"async"),Fl.k0s()()()(),Fl.j41(13,"div")(14,"bit-card")(15,"bit-form-field")(16,"bit-label"),Fl.EFF(17),Fl.nI1(18,"i18n"),Fl.k0s(),Fl.j41(19,"input",5),Fl.bIt("change",function(){return t.save("wordSeparator")}),Fl.k0s()(),Fl.j41(20,"bit-form-control")(21,"input",6),Fl.bIt("change",function(){return t.save("capitalize")}),Fl.k0s(),Fl.j41(22,"bit-label"),Fl.EFF(23),Fl.nI1(24,"i18n"),Fl.k0s()(),Fl.j41(25,"bit-form-control",0)(26,"input",7),Fl.bIt("change",function(){return t.save("includeNumber")}),Fl.k0s(),Fl.j41(27,"bit-label"),Fl.EFF(28),Fl.nI1(29,"i18n"),Fl.k0s()(),Fl.nVh(30,Sj,3,3,"p",8),Fl.k0s()()()()),2&e&&(Fl.Y8G("disableMargin",t.disableMargin),Fl.R7$(),Fl.vxM(t.showHeader?1:-1),Fl.R7$(),Fl.Y8G("formGroup",t.settings),Fl.R7$(5),Fl.JRh(Fl.bMT(8,11,"numWords")),Fl.R7$(4),Fl.JRh(Fl.bMT(12,13,t.numWordsBoundariesHint$)),Fl.R7$(6),Fl.JRh(Fl.bMT(18,15,"wordSeparator")),Fl.R7$(2),Fl.Y8G("maxlength",t.wordSeparatorMaxLength),Fl.R7$(4),Fl.JRh(Fl.bMT(24,17,"capitalize")),Fl.R7$(2),Fl.Y8G("disableMargin",!t.policyInEffect),Fl.R7$(3),Fl.JRh(Fl.bMT(29,19,"includeNumber")),Fl.R7$(2),Fl.vxM(t.policyInEffect?30:-1))},dependencies:[Ux,Nx,tc,rc,Il.X1,Il.qT,Il.me,Il.Q0,Il.Zm,Il.BC,Il.cb,Il.tU,Il.j4,Il.JD,Ex,Gu,Sc,Ac,hu,fu,ju,hd,Qb,sf,kl.Jj,sc],encapsulation:2});var Fj=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function Rj(e,t){1&e&&(Fl.j41(0,"bit-section-header")(1,"h2",20),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()()),2&e&&(Fl.R7$(2),Fl.JRh(Fl.bMT(3,1,"options")))}function xj(e,t){1&e&&(Fl.j41(0,"p",19),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.JRh(Fl.bMT(2,1,"generatorPolicyInEffect")))}const Aj=Object.freeze({length:"length",uppercase:"uppercase",lowercase:"lowercase",number:"number",special:"special",minNumber:"minNumber",minSpecial:"minSpecial",avoidAmbiguous:"avoidAmbiguous"});class Dj{constructor(e,t,i){this.formBuilder=e,this.generatorService=t,this.i18nService=i,this.account=null,this.account$=new Ro.m(1),this.showHeader=!0,this.waitMs=100,this.disableMargin=!1,this.onUpdated=new Fl.bkB,this.settings=this.formBuilder.group({[Aj.length]:[0],[Aj.uppercase]:[!1],[Aj.lowercase]:[!1],[Aj.number]:[!1],[Aj.special]:[!1],[Aj.minNumber]:[0],[Aj.minSpecial]:[0],[Aj.avoidAmbiguous]:[!1]}),this.saveSettings=new Co.B,this.policyInEffect=!1,this.lengthBoundariesHint=new Ro.m(1),this.lengthBoundariesHint$=this.lengthBoundariesHint.asObservable(),this.destroyed$=new Co.B}ngOnChanges(e){return Fj(this,void 0,void 0,function*(){"account"in e&&e.account&&this.account$.next(this.account)})}get numbers(){return this.settings.get(Aj.number)}get special(){return this.settings.get(Aj.special)}get minNumber(){return this.settings.get(Aj.minNumber)}get minSpecial(){return this.settings.get(Aj.minSpecial)}ngOnInit(){return Fj(this,void 0,void 0,function*(){const e=yield this.generatorService.settings(Yg.password,{account$:this.account$});e.withConstraints$.pipe((0,l.T)(({state:e,constraints:t})=>{const i=Object.assign({},e);return i.avoidAmbiguous=!i.ambiguous,delete i.ambiguous,[i,t]}),(0,vm.Q)(this.destroyed$)).subscribe(([e,t])=>{var i,n,r,s,o,a,l,c;let u=this.i18nService.t("spinboxBoundariesHint",null===(n=null===(i=t.length)||void 0===i?void 0:i.min)||void 0===n?void 0:n.toString(),null===(s=null===(r=t.length)||void 0===r?void 0:r.max)||void 0===s?void 0:s.toString());e.length<=(null!==(a=null===(o=t.length)||void 0===o?void 0:o.recommendation)&&void 0!==a?a:0)&&(u+=this.i18nService.t("passwordLengthRecommendationHint",null===(c=null===(l=t.length)||void 0===l?void 0:l.recommendation)||void 0===c?void 0:c.toString())),this.lengthBoundariesHint.next(u),this.settings.patchValue(e,{emitEvent:!1})}),this.generatorService.policy$(Yg.password,{account$:this.account$}).pipe((0,vm.Q)(this.destroyed$)).subscribe(({constraints:e})=>{var t,i,n,r,s,o,a,l,c,u,d;this.policyInEffect=null!==(t=e.policyInEffect)&&void 0!==t&&t;const h=[[Aj.length,Pj(null===(i=e.length)||void 0===i?void 0:i.min,null===(n=e.length)||void 0===n?void 0:n.max)],[Aj.uppercase,!(null===(r=e.uppercase)||void 0===r?void 0:r.readonly)],[Aj.lowercase,!(null===(s=e.lowercase)||void 0===s?void 0:s.readonly)],[Aj.number,!(null===(o=e.number)||void 0===o?void 0:o.readonly)],[Aj.special,!(null===(a=e.special)||void 0===a?void 0:a.readonly)],[Aj.minNumber,Pj(null===(l=e.minNumber)||void 0===l?void 0:l.min,null===(c=e.minNumber)||void 0===c?void 0:c.max)],[Aj.minSpecial,Pj(null===(u=e.minSpecial)||void 0===u?void 0:u.min,null===(d=e.minSpecial)||void 0===d?void 0:d.max)]];for(const[e,t]of h)this.toggleEnabled(e,t)});let t=1;this.numbers.valueChanges.pipe((0,Eo.p)(e=>{var t;return!(e&&(null!==(t=this.minNumber.value)&&void 0!==t?t:0)>0)}),(0,l.T)(e=>e?t:0),(0,vm.Q)(this.destroyed$)).subscribe(e=>this.minNumber.setValue(e,{emitEvent:!1})),this.minNumber.valueChanges.pipe((0,l.T)(e=>[e,(null!=e?e:0)>0]),(0,Oo.M)(([e,i])=>t=i&&e?e:t),(0,vm.Q)(this.destroyed$)).subscribe(([,e])=>this.numbers.setValue(e,{emitEvent:!1}));let i=1;this.special.valueChanges.pipe((0,Eo.p)(e=>{var t;return!(e&&(null!==(t=this.minSpecial.value)&&void 0!==t?t:0)>0)}),(0,l.T)(e=>e?i:0),(0,vm.Q)(this.destroyed$)).subscribe(e=>this.minSpecial.setValue(e,{emitEvent:!1})),this.minSpecial.valueChanges.pipe((0,l.T)(e=>[e,(null!=e?e:0)>0]),(0,Oo.M)(([e,t])=>i=t&&e?e:i),(0,vm.Q)(this.destroyed$)).subscribe(([,e])=>this.special.setValue(e,{emitEvent:!1})),e.pipe((0,ny.i)(1),(0,vm.Q)(this.destroyed$)).subscribe(this.onUpdated),this.saveSettings.pipe((0,km.E)(this.settings.valueChanges),(0,l.T)(([,e])=>{const t=Object.assign({},e);return t.ambiguous=!t.avoidAmbiguous,delete t.avoidAmbiguous,t}),(0,vm.Q)(this.destroyed$)).subscribe(e)})}save(e="component api call"){this.saveSettings.next(e)}toggleEnabled(e,t){var i,n;t?null===(i=this.settings.get(e))||void 0===i||i.enable({emitEvent:!1}):null===(n=this.settings.get(e))||void 0===n||n.disable({emitEvent:!1})}ngOnDestroy(){this.destroyed$.next(),this.destroyed$.complete()}}Dj.ɵfac=function(e){return new(e||Dj)(Fl.rXU(Il.ok),Fl.rXU(yf),Fl.rXU(Ul))},Dj.ɵcmp=Fl.VBU({type:Dj,selectors:[["tools-password-settings"]],inputs:{account:"account",showHeader:"showHeader",waitMs:"waitMs",disableMargin:[2,"disableMargin","disableMargin",$x.he]},outputs:{onUpdated:"onUpdated"},features:[Fl.OA$],decls:66,vars:61,consts:[[3,"disableMargin"],[1,"tw-container",3,"formGroup"],[1,"tw-mb-4"],["disableMargin",""],["bitInput","","formControlName","length","type","number",3,"change"],[1,"tw-mb-4","tw-flex","tw-flex-wrap","tw-gap-4","sm:tw-gap-8"],[1,"!tw-mb-0",3,"title"],["bitCheckbox","","type","checkbox","formControlName","uppercase",3,"change"],["bitCheckbox","","type","checkbox","formControlName","lowercase",3,"change"],["bitCheckbox","","type","checkbox","formControlName","number",3,"change"],["bitCheckbox","","type","checkbox","formControlName","special",3,"change"],["aria-hidden","true"],[1,"tw-sr-only"],[1,"tw-flex"],[1,"tw-w-full","tw-basis-1/2","tw-mr-4"],["bitInput","","type","number","formControlName","minNumber",3,"change"],[1,"tw-w-full","tw-basis-1/2"],["bitInput","","type","number","formControlName","minSpecial",3,"change"],["bitCheckbox","","type","checkbox","formControlName","avoidAmbiguous",3,"change"],["bitTypography","helper"],["bitTypography","h6"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-section",0),Fl.nVh(1,Rj,4,3,"bit-section-header"),Fl.j41(2,"form",1)(3,"div",2)(4,"bit-card")(5,"bit-form-field",3)(6,"bit-label"),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.j41(9,"input",4),Fl.bIt("change",function(){return t.save("length")}),Fl.k0s(),Fl.j41(10,"bit-hint"),Fl.EFF(11),Fl.nI1(12,"async"),Fl.k0s()()()(),Fl.j41(13,"div")(14,"bit-card")(15,"div",2),Fl.EFF(16),Fl.nI1(17,"i18n"),Fl.k0s(),Fl.j41(18,"div",5)(19,"bit-form-control",6),Fl.nI1(20,"i18n"),Fl.nI1(21,"i18n"),Fl.j41(22,"input",7),Fl.bIt("change",function(){return t.save("uppercase")}),Fl.k0s(),Fl.j41(23,"bit-label"),Fl.EFF(24),Fl.nI1(25,"i18n"),Fl.k0s()(),Fl.j41(26,"bit-form-control",6),Fl.nI1(27,"i18n"),Fl.nI1(28,"i18n"),Fl.j41(29,"input",8),Fl.bIt("change",function(){return t.save("lowercase")}),Fl.k0s(),Fl.j41(30,"bit-label"),Fl.EFF(31),Fl.nI1(32,"i18n"),Fl.k0s()(),Fl.j41(33,"bit-form-control",6),Fl.nI1(34,"i18n"),Fl.nI1(35,"i18n"),Fl.j41(36,"input",9),Fl.bIt("change",function(){return t.save("number")}),Fl.k0s(),Fl.j41(37,"bit-label"),Fl.EFF(38),Fl.nI1(39,"i18n"),Fl.k0s()(),Fl.j41(40,"bit-form-control",6),Fl.nI1(41,"i18n"),Fl.j41(42,"input",10),Fl.bIt("change",function(){return t.save("special")}),Fl.k0s(),Fl.j41(43,"bit-label")(44,"span",11),Fl.EFF(45),Fl.k0s(),Fl.j41(46,"span",12),Fl.EFF(47),Fl.nI1(48,"i18n"),Fl.k0s()()()(),Fl.j41(49,"div",13)(50,"bit-form-field",14)(51,"bit-label"),Fl.EFF(52),Fl.nI1(53,"i18n"),Fl.k0s(),Fl.j41(54,"input",15),Fl.bIt("change",function(){return t.save("minNumbers")}),Fl.k0s()(),Fl.j41(55,"bit-form-field",16)(56,"bit-label"),Fl.EFF(57),Fl.nI1(58,"i18n"),Fl.k0s(),Fl.j41(59,"input",17),Fl.bIt("change",function(){return t.save("minSpecial")}),Fl.k0s()()(),Fl.j41(60,"bit-form-control",0)(61,"input",18),Fl.bIt("change",function(){return t.save("avoidAmbiguous")}),Fl.k0s(),Fl.j41(62,"bit-label"),Fl.EFF(63),Fl.nI1(64,"i18n"),Fl.k0s()(),Fl.nVh(65,xj,3,3,"p",19),Fl.k0s()()()()),2&e&&(Fl.Y8G("disableMargin",t.disableMargin),Fl.R7$(),Fl.vxM(t.showHeader?1:-1),Fl.R7$(),Fl.Y8G("formGroup",t.settings),Fl.R7$(5),Fl.JRh(Fl.bMT(8,27,"length")),Fl.R7$(4),Fl.JRh(Fl.bMT(12,29,t.lengthBoundariesHint$)),Fl.R7$(5),Fl.JRh(Fl.bMT(17,31,"include")),Fl.R7$(3),Fl.Y8G("title",Fl.mNQ(Fl.bMT(20,33,"uppercaseDescription"))),Fl.BMQ("aria-description",Fl.bMT(21,35,"uppercaseDescription")),Fl.R7$(5),Fl.JRh(Fl.bMT(25,37,"uppercaseLabel")),Fl.R7$(2),Fl.Y8G("title",Fl.mNQ(Fl.bMT(27,39,"lowercaseDescription"))),Fl.BMQ("aria-description",Fl.bMT(28,41,"lowercaseDescription")),Fl.R7$(5),Fl.JRh(Fl.bMT(32,43,"lowercaseLabel")),Fl.R7$(2),Fl.Y8G("title",Fl.mNQ(Fl.bMT(34,45,"numbersDescription"))),Fl.BMQ("aria-description",Fl.bMT(35,47,"numbersDescription")),Fl.R7$(5),Fl.JRh(Fl.bMT(39,49,"numbersLabel")),Fl.R7$(2),Fl.Y8G("title",Fl.mNQ(Fl.bMT(41,51,"specialCharactersDescription"))),Fl.R7$(5),Fl.JRh("!@#$%^&*"),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(48,53,"specialCharactersDescription")," "),Fl.R7$(5),Fl.JRh(Fl.bMT(53,55,"minNumbers")),Fl.R7$(5),Fl.JRh(Fl.bMT(58,57,"minSpecial")),Fl.R7$(3),Fl.Y8G("disableMargin",!t.policyInEffect),Fl.R7$(3),Fl.JRh(Fl.bMT(64,59,"avoidAmbiguous")),Fl.R7$(2),Fl.vxM(t.policyInEffect?65:-1))},dependencies:[Ux,Nx,tc,rc,Il.X1,Il.qT,Il.me,Il.Q0,Il.Zm,Il.BC,Il.cb,Il.j4,Il.JD,Ex,Gu,Sc,Ac,hu,fu,ju,hd,Qb,sf,kl.Jj,sc],encapsulation:2});var Ej=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class $j{constructor(e,t){this.formBuilder=e,this.generatorService=t,this.account=null,this.account$=new Ro.m(1),this.onUpdated=new Fl.bkB,this.settings=this.formBuilder.group({subaddressEmail:[""]}),this.saveSettings=new Co.B,this.destroyed$=new Co.B}ngOnChanges(e){return Ej(this,void 0,void 0,function*(){"account"in e&&e.account&&this.account$.next(this.account)})}ngOnInit(){return Ej(this,void 0,void 0,function*(){const e=yield this.generatorService.settings(Yg.plusAddress,{account$:this.account$});e.pipe((0,vm.Q)(this.destroyed$)).subscribe(e=>{this.settings.patchValue(e,{emitEvent:!1})}),e.pipe((0,ny.i)(1),(0,vm.Q)(this.destroyed$)).subscribe(this.onUpdated),this.saveSettings.pipe((0,km.E)(this.settings.valueChanges),(0,l.T)(([,e])=>e),(0,vm.Q)(this.destroyed$)).subscribe(e)})}save(e="component api call"){this.saveSettings.next(e)}ngOnDestroy(){this.destroyed$.next(),this.destroyed$.complete()}}$j.ɵfac=function(e){return new(e||$j)(Fl.rXU(Il.ok),Fl.rXU(yf))},$j.ɵcmp=Fl.VBU({type:$j,selectors:[["tools-subaddress-settings"]],inputs:{account:"account"},outputs:{onUpdated:"onUpdated"},features:[Fl.OA$],decls:6,vars:4,consts:[[1,"tw-container",3,"formGroup"],["bitInput","","formControlName","subaddressEmail","type","text",3,"change"]],template:function(e,t){1&e&&(Fl.j41(0,"form",0)(1,"bit-form-field")(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"input",1),Fl.bIt("change",function(){return t.save("subaddressEmail")}),Fl.k0s()()()),2&e&&(Fl.Y8G("formGroup",t.settings),Fl.R7$(3),Fl.JRh(Fl.bMT(4,2,"email")))},dependencies:[Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,Gu,Ac,fu,ju,sf,sc],encapsulation:2});var Oj=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Uj{constructor(e,t){this.formBuilder=e,this.generatorService=t,this.account=null,this.account$=new Ro.m(1),this.onUpdated=new Fl.bkB,this.settings=this.formBuilder.group({wordCapitalize:[!1],wordIncludeNumber:[!1]}),this.saveSettings=new Co.B,this.destroyed$=new Co.B}ngOnChanges(e){return Oj(this,void 0,void 0,function*(){"account"in e&&this.account$.next(this.account)})}ngOnInit(){return Oj(this,void 0,void 0,function*(){const e=yield this.generatorService.settings(Yg.effWordList,{account$:this.account$});e.pipe((0,vm.Q)(this.destroyed$)).subscribe(e=>{this.settings.patchValue(e,{emitEvent:!1})}),e.pipe((0,ny.i)(1),(0,vm.Q)(this.destroyed$)).subscribe(this.onUpdated),this.saveSettings.pipe((0,km.E)(this.settings.valueChanges),(0,l.T)(([,e])=>e),(0,vm.Q)(this.destroyed$)).subscribe(e)})}save(e="component api call"){this.saveSettings.next(e)}ngOnDestroy(){this.destroyed$.next(),this.destroyed$.complete()}}Uj.ɵfac=function(e){return new(e||Uj)(Fl.rXU(Il.ok),Fl.rXU(yf))},Uj.ɵcmp=Fl.VBU({type:Uj,selectors:[["tools-username-settings"]],inputs:{account:"account"},outputs:{onUpdated:"onUpdated"},features:[Fl.OA$],decls:11,vars:7,consts:[[1,"tw-container",3,"formGroup"],["bitCheckbox","","formControlName","wordCapitalize","type","checkbox",3,"change"],["bitCheckbox","","formControlName","wordIncludeNumber","type","checkbox",3,"change"]],template:function(e,t){1&e&&(Fl.j41(0,"form",0)(1,"bit-form-control")(2,"input",1),Fl.bIt("change",function(){return t.save("wordCapitalize")}),Fl.k0s(),Fl.j41(3,"bit-label"),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()(),Fl.j41(6,"bit-form-control")(7,"input",2),Fl.bIt("change",function(){return t.save("wordIncludeNumber")}),Fl.k0s(),Fl.j41(8,"bit-label"),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s()()()),2&e&&(Fl.Y8G("formGroup",t.settings),Fl.R7$(4),Fl.JRh(Fl.bMT(5,3,"capitalize")),Fl.R7$(5),Fl.JRh(Fl.bMT(10,5,"includeNumber")))},dependencies:[Il.X1,Il.qT,Il.Zm,Il.BC,Il.cb,Il.j4,Il.JD,Gu,Sc,Ac,hd,Qb,sf,sc],encapsulation:2});let Mj=0;class Nj{constructor(){this.id=Mj++,this.name=`bit-toggle-group-${this.id}`,this.fullWidth=(0,o.hFB)(void 0,{transform:o.L39}),this.selected=(0,o.geq)(),this.classlist=(0,Rl.EW)(()=>["tw-flex"].concat(this.fullWidth()?["tw-w-full","[&>*]:tw-flex-1"]:[]))}onInputInteraction(e){this.selected.set(e)}}Nj.ɵfac=function(e){return new(e||Nj)},Nj.ɵcmp=Fl.VBU({type:Nj,selectors:[["bit-toggle-group"]],hostAttrs:["role","radiogroup"],hostVars:2,hostBindings:function(e,t){2&e&&Fl.HbH(t.classlist())},inputs:{fullWidth:[1,"fullWidth"],selected:[1,"selected"]},outputs:{selected:"selectedChange"},ngContentSelectors:["*"],decls:1,vars:0,template:function(e,t){1&e&&(Fl.NAR(),Fl.SdG(0))},encapsulation:2,changeDetection:0});const Vj=["labelContent"],Bj=["*",[["","bitBadge",""]]];let jj=0;class Gj{constructor(){this.id="bit-toggle-"+jj++,this.groupComponent=(0,a.WQX)(Nj),this.value=o.hFB.required(),this.labelContent=(0,o.ebz)("labelContent"),this.badgeElement=(0,o.sbv)(Qc),this.hasBadge=(0,Rl.EW)(()=>!!this.badgeElement()),this.labelTitle=(0,a.vPA)(null),this.name=this.groupComponent.name,this.selected=(0,Rl.EW)(()=>this.groupComponent.selected()===this.value()),this.hostClasses=["tw-group/toggle","tw-flex","tw-min-w-16"],this.inputClasses=["tw-peer/toggle-input","tw-appearance-none","tw-outline-none"],this.labelClasses=["tw-h-full","tw-w-full","tw-flex","tw-items-center","tw-justify-center","tw-gap-1.5","!tw-font-medium","tw-leading-5","tw-transition","tw-text-center","tw-text-sm","tw-border-primary-600","!tw-text-primary-600","tw-border-solid","tw-border-y","tw-border-r","tw-border-l-0","tw-cursor-pointer","hover:tw-bg-hover-default","group-first-of-type/toggle:tw-border-l","group-first-of-type/toggle:tw-rounded-s-full","group-last-of-type/toggle:tw-rounded-e-full","peer-focus-visible/toggle-input:tw-outline-none","peer-focus-visible/toggle-input:tw-ring","peer-focus-visible/toggle-input:tw-ring-offset-2","peer-focus-visible/toggle-input:tw-ring-primary-600","peer-focus-visible/toggle-input:tw-z-10","peer-focus-visible/toggle-input:tw-bg-primary-600","peer-focus-visible/toggle-input:tw-border-primary-600","peer-focus-visible/toggle-input:!tw-text-contrast","peer-checked/toggle-input:tw-bg-primary-600","peer-checked/toggle-input:tw-border-primary-600","peer-checked/toggle-input:!tw-text-contrast","tw-py-1.5","tw-px-3","!tw-mb-0"],(0,Fl.mal)(()=>{var e;const t=null===(e=this.labelContent())||void 0===e?void 0:e.nativeElement.innerText;t&&this.labelTitle.set(t)})}handleInputChange(){this.groupComponent.onInputInteraction(this.value())}}Gj.ɵfac=function(e){return new(e||Gj)},Gj.ɵcmp=Fl.VBU({type:Gj,selectors:[["bit-toggle"]],contentQueries:function(e,t,i){1&e&&Fl.C6U(i,t.badgeElement,Qc,5),2&e&&Fl.NyB()},viewQuery:function(e,t){1&e&&Fl.wEZ(t.labelContent,Vj,5),2&e&&Fl.NyB()},hostAttrs:["tabindex","-1"],hostVars:2,hostBindings:function(e,t){2&e&&Fl.HbH(t.hostClasses)},inputs:{value:[1,"value"]},ngContentSelectors:["*","[bitBadge]"],decls:7,vars:10,consts:[["labelContent",""],["type","radio",3,"change","id","name","checked"],[3,"for","title"],[1,"tw-line-clamp-2","tw-break-words"],[1,"tw-shrink-0",3,"hidden"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.NAR(Bj),Fl.rj2(0,"input",1),Fl.VwU("change",function(){return a.eBV(e),a.Njj(t.handleInputChange())}),Fl.eux(),Fl.rj2(1,"label",2)(2,"span",3,0),Fl.SdG(4),Fl.eux(),Fl.rj2(5,"span",4),Fl.SdG(6,1),Fl.eux()()}2&e&&(Fl.HbH(t.inputClasses),Fl.Avn("id",t.id)("name",t.name)("checked",t.selected()),Fl.R7$(),Fl.HbH(t.labelClasses),Fl.Avn("htmlFor",t.id)("title",t.labelTitle()),Fl.R7$(4),Fl.Avn("hidden",!t.hasBadge()))},encapsulation:2,changeDetection:0});var Lj=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function zj(e,t){if(1&e&&(Fl.j41(0,"bit-toggle",1),Fl.EFF(1),Fl.k0s()),2&e){const e=t.$implicit;Fl.Y8G("value",e.value),Fl.R7$(),Fl.SpI(" ",e.label," ")}}function _j(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"tools-password-settings",9),Fl.bIt("onUpdated",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.generate("password settings"))}),Fl.k0s()}if(2&e){Fl.XpG();const e=Fl.r8f(24);Fl.Y8G("account",e)}}function Kj(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"tools-passphrase-settings",9),Fl.bIt("onUpdated",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.generate("passphrase settings"))}),Fl.k0s()}if(2&e){Fl.XpG();const e=Fl.r8f(24);Fl.Y8G("account",e)}}function Xj(e,t){if(1&e&&(Fl.j41(0,"bit-hint"),Fl.EFF(1),Fl.nI1(2,"async"),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.JRh(Fl.bMT(2,1,e.credentialTypeHint$))}}function qj(e,t){if(1&e&&(Fl.j41(0,"form",12)(1,"bit-form-field")(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.nrm(5,"bit-select",16),Fl.nI1(6,"async"),Fl.k0s()()),2&e){const e=Fl.XpG(2);Fl.Y8G("formGroup",e.forwarder),Fl.R7$(3),Fl.JRh(Fl.bMT(4,3,"service")),Fl.R7$(2),Fl.Y8G("items",Fl.bMT(6,5,e.forwarderOptions$))}}function Wj(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"tools-catchall-settings",17),Fl.bIt("onUpdated",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.generate("catchall settings"))}),Fl.k0s()}if(2&e){Fl.XpG(2);const e=Fl.r8f(24);Fl.Y8G("account",e)}}function Yj(e,t){if(1&e&&Fl.nrm(0,"tools-forwarder-settings",15),2&e){Fl.XpG(2);const e=Fl.r8f(24);Fl.Y8G("account",e)("forwarder",t)}}function Hj(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"tools-subaddress-settings",17),Fl.bIt("onUpdated",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.generate("subaddress settings"))}),Fl.k0s()}if(2&e){Fl.XpG(2);const e=Fl.r8f(24);Fl.Y8G("account",e)}}function Jj(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"tools-username-settings",17),Fl.bIt("onUpdated",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.generate("username settings"))}),Fl.k0s()}if(2&e){Fl.XpG(2);const e=Fl.r8f(24);Fl.Y8G("account",e)}}function Zj(e,t){if(1&e&&(Fl.j41(0,"bit-section")(1,"bit-section-header")(2,"h2",10),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"div",11)(6,"bit-card")(7,"form",12)(8,"bit-form-field")(9,"bit-label"),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s(),Fl.nrm(12,"bit-select",13),Fl.nI1(13,"async"),Fl.nVh(14,Xj,3,3,"bit-hint"),Fl.nI1(15,"async"),Fl.k0s()(),Fl.nVh(16,qj,7,7,"form",12),Fl.nI1(17,"async"),Fl.nVh(18,Wj,1,1,"tools-catchall-settings",14),Fl.nVh(19,Yj,1,2,"tools-forwarder-settings",15),Fl.nI1(20,"async"),Fl.nVh(21,Hj,1,1,"tools-subaddress-settings",14),Fl.nVh(22,Jj,1,1,"tools-username-settings",14),Fl.k0s()()()),2&e){let e;const t=Fl.XpG(),i=Fl.r8f(22);Fl.R7$(3),Fl.JRh(Fl.bMT(4,10,"options")),Fl.R7$(4),Fl.Y8G("formGroup",t.username),Fl.R7$(3),Fl.JRh(Fl.bMT(11,12,"type")),Fl.R7$(2),Fl.Y8G("items",Fl.bMT(13,14,t.usernameOptions$)),Fl.R7$(2),Fl.vxM(Fl.bMT(15,16,t.credentialTypeHint$)?14:-1),Fl.R7$(2),Fl.vxM(Fl.bMT(17,18,t.showForwarder$)?16:-1),Fl.R7$(2),Fl.vxM((null==i?null:i.id)===t.Algorithm.catchall?18:-1),Fl.R7$(),Fl.vxM((e=Fl.bMT(20,20,t.forwarderId$))?19:-1,e),Fl.R7$(2),Fl.vxM((null==i?null:i.id)===t.Algorithm.plusAddress?21:-1),Fl.R7$(),Fl.vxM((null==i?null:i.id)===t.Algorithm.username?22:-1)}}const Qj="identifier",eG="forwarder",tG="none";class iG{constructor(e,t,i,n,r,s,o,a,c){this.generatorService=e,this.generatorHistoryService=t,this.toastService=i,this.logService=n,this.i18nService=r,this.accountService=s,this.zone=o,this.formBuilder=a,this.ariaLive=c,this.destroyed=new Co.B,this.Algorithm=Um,this.account=null,this.debug=!1,this.log=rj(),this.account$=new Ro.m(1),this.website=null,this.onGenerated=new Fl.bkB,this.root$=new Dd.t({nav:null}),this.username=this.formBuilder.group({nav:[null]}),this.forwarder=this.formBuilder.group({nav:[null]}),this.rootOptions$=new Dd.t([]),this.usernameOptions$=new Dd.t([]),this.forwarderOptions$=new Dd.t([]),this.forwarderId$=new Dd.t(null),this.showForwarder$=new Dd.t(!1),this.maybeAlgorithm$=new Ro.m(1),this.algorithm$=this.maybeAlgorithm$.pipe((0,Eo.p)(e=>!!e)),this.showAlgorithm$=this.maybeAlgorithm$.pipe((0,Yp.v)(this.showForwarder$),(0,l.T)(([e,t])=>t?null:e)),this.credentialTypeCopyLabel$=this.algorithm$.pipe((0,l.T)(({i18nKeys:{copyCredential:e}})=>Tj(e,this.i18nService))),this.credentialTypeGenerateLabel$=this.algorithm$.pipe((0,l.T)(({i18nKeys:{generateCredential:e}})=>Tj(e,this.i18nService))),this.credentialTypeLabel$=this.algorithm$.pipe((0,l.T)(({i18nKeys:{credentialType:e}})=>Tj(e,this.i18nService))),this.credentialTypeHint$=new Ro.m(1),this.category$=new Ro.m(1),this.generatedCredential$=new Dd.t(void 0),this.value$=this.generatedCredential$.pipe((0,l.T)(e=>{var t;return null!==(t=null==e?void 0:e.credential)&&void 0!==t?t:"-"})),this.USER_REQUEST="user request",this.generate$=new Co.B}ngOnChanges(e){return Lj(this,void 0,void 0,function*(){var t,i,n,r,s;const o=null==e?void 0:e.account;(null===(t=null==o?void 0:o.previousValue)||void 0===t?void 0:t.id)!==(null===(i=null==o?void 0:o.currentValue)||void 0===i?void 0:i.id)&&(this.log.debug({previousUserId:null===(n=null==o?void 0:o.previousValue)||void 0===n?void 0:n.id,currentUserId:null===(r=null==o?void 0:o.currentValue)||void 0===r?void 0:r.id},"account input change detected"),this.account$.next(null!==(s=o.currentValue)&&void 0!==s?s:this.account))})}onRootChanged(e){this.root$.value.nav!==e.nav&&this.zone.run(()=>{this.root$.next(e)})}ngOnInit(){return Lj(this,void 0,void 0,function*(){if(this.log=oj(this.debug,this.logService,{type:"CredentialGeneratorComponent"}),!this.account){const e=yield(0,bo._)(this.accountService.activeAccount$);e||this.log.panic("active account cannot be `null`."),this.log.info({userId:e.id},"account not specified; using active account settings"),this.account$.next(e)}(0,jo.z)([this.generatorService.algorithms$("email",{account$:this.account$}),this.generatorService.algorithms$("username",{account$:this.account$})]).pipe((0,l.T)(e=>e.flat()),(0,l.T)(e=>{const t=e.filter(e=>!Xg(e.id));t.sort((e,t)=>e.weight-t.weight);const i=this.toOptions(t);i.splice(-1,0,{value:eG,label:this.i18nService.t("forwardedEmail")});const n=e.filter(e=>Xg(e.id));n.sort((e,t)=>e.weight-t.weight);const r=this.toOptions(n);return r.unshift({value:tG,label:this.i18nService.t("select")}),[i,r]}),(0,Oo.M)(e=>this.log.debug({algorithms:e},"algorithms loaded")),(0,vm.Q)(this.destroyed)).subscribe(([e,t])=>{this.zone.run(()=>{this.usernameOptions$.next(e),this.forwarderOptions$.next(t)})}),this.generatorService.algorithms$("password",{account$:this.account$}).pipe((0,l.T)(e=>{const t=this.toOptions(e);return t.push({value:Qj,label:this.i18nService.t("username")}),t}),(0,vm.Q)(this.destroyed)).subscribe(this.rootOptions$),this.maybeAlgorithm$.pipe((0,l.T)(e=>{var t;return(null===(t=null==e?void 0:e.i18nKeys)||void 0===t?void 0:t.description)?Tj(e.i18nKeys.description,this.i18nService):""}),(0,vm.Q)(this.destroyed)).subscribe(e=>{this.zone.run(()=>{this.credentialTypeHint$.next(e)})}),this.maybeAlgorithm$.pipe((0,l.T)(e=>null==e?void 0:e.type),(0,mo.F)(),(0,vm.Q)(this.destroyed)).subscribe(e=>{this.zone.run(()=>{this.category$.next(e)})}),this.generatorService.generate$({on$:this.generate$,account$:this.account$}).pipe((0,Ed.W)((e,t)=>("string"==typeof e?this.toastService.showToast({message:e,variant:"error",title:""}):this.logService.error(e),t)),(0,km.E)(this.account$,this.maybeAlgorithm$),(0,vm.Q)(this.destroyed)).subscribe(([e,t,i])=>{var n,r;this.log.debug({source:null!==(n=e.source)&&void 0!==n?n:null,algorithm:null!==(r=null==i?void 0:i.id)&&void 0!==r?r:null},"credential generated"),this.generatorHistoryService.track(t.id,e.credential,e.category,e.generationDate).catch(e=>{this.logService.error(e)}),this.zone.run(()=>{i&&e.source===this.USER_REQUEST&&this.announce(Tj(i.i18nKeys.credentialGenerated,this.i18nService)),this.generatedCredential$.next(e),this.onGenerated.next(e)})});const e=new Co.B,t=new Co.B,i=new Co.B;this.root$.pipe((0,l.T)(e=>e.nav===Qj?{nav:e.nav}:e.nav?{nav:e.nav,algorithm:JSON.parse(e.nav)}:{nav:Qj}),(0,vm.Q)(this.destroyed)).subscribe(e),this.username.valueChanges.pipe((0,l.T)(e=>{if(e.nav===eG)return{nav:e.nav};if(e.nav)return{nav:e.nav,algorithm:JSON.parse(e.nav)};{const[e]=Hg[Mm.username];return{nav:JSON.stringify(e),algorithm:e}}}),(0,vm.Q)(this.destroyed)).subscribe(t),this.forwarder.valueChanges.pipe((0,l.T)(e=>e.nav===tG?{nav:e.nav}:e.nav?{nav:e.nav,algorithm:JSON.parse(e.nav)}:{nav:tG}),(0,vm.Q)(this.destroyed)).subscribe(i),(0,jo.z)([e,t,i]).pipe((0,l.T)(([e,t,i])=>{const n=!e.algorithm&&!t.algorithm;return[n,n&&i.algorithm&&Xg(i.algorithm)?i.algorithm.forwarder:null]}),(0,mo.F)((e,t)=>e[0]===t[0]&&e[1]===t[1]),(0,vm.Q)(this.destroyed)).subscribe(([e,t])=>{this.log.debug({forwarderId:t,showForwarder:e},"forwarder visibility updated"),this.zone.run(()=>{this.showForwarder$.next(e),this.forwarderId$.next(t)})}),(0,jo.z)([e,t,i]).pipe((0,l.T)(([e,t,i])=>{var n,r;const s=null!==(r=null!==(n=e.algorithm)&&void 0!==n?n:t.algorithm)&&void 0!==r?r:i.algorithm;return s?this.generatorService.algorithm(s):null}),(0,mo.F)((e,t)=>null!==e&&null!==t&&Wg(e.id,t.id)),(0,vm.Q)(this.destroyed)).subscribe(e=>{var t;this.log.debug({algorithm:null!==(t=null==e?void 0:e.id)&&void 0!==t?t:null},"algorithm selected"),this.zone.run(()=>{this.maybeAlgorithm$.next(e)})});const n=yield this.generatorService.preferences({account$:this.account$});this.algorithm$.pipe((0,km.E)(n),(0,vm.Q)(this.destroyed)).subscribe(([e,t])=>{function i(i){const n=t[i];n.algorithm=e.id,n.updated=new Date}if(qg(e.id))i("email");else if(Kg(e.id))i("username");else{if(!_g(e.id))return;i("password")}this.log.info({algorithm:e.id,type:e.type},"algorithm preferences updated"),n.next(t)}),n.pipe((0,l.T)(({email:e,username:t,password:i})=>{const n=e.updated>t.updated?e:t,r=Xg(n.algorithm)?n:null,s=r?JSON.stringify(r.algorithm):tG,o=r?eG:JSON.stringify(n.algorithm),a=n.updated>i.updated?Qj:JSON.stringify(i.algorithm);return{root:{selection:{nav:a},active:{nav:a,algorithm:a===Qj?void 0:i.algorithm}},username:{selection:{nav:o},active:{nav:o,algorithm:r?void 0:n.algorithm}},forwarder:{selection:{nav:s},active:{nav:s,algorithm:null==r?void 0:r.algorithm}}}}),(0,vm.Q)(this.destroyed)).subscribe(({root:n,username:r,forwarder:s})=>{this.log.debug({root:n.selection,username:r.selection,forwarder:s.selection},"navigation updated"),this.onRootChanged(n.selection),this.username.setValue(r.selection,{emitEvent:!1}),this.forwarder.setValue(s.selection,{emitEvent:!1}),e.next(n.active),t.next(r.active),i.next(s.active)}),this.maybeAlgorithm$.pipe((0,vm.Q)(this.destroyed)).subscribe(e=>{this.zone.run(()=>{var t;(null===(t=null==e?void 0:e.capabilities)||void 0===t?void 0:t.autogenerate)?(this.log.debug("autogeneration enabled"),this.generate("autogenerate").catch(e=>{this.log.error(e,"a failure occurred during autogeneration")})):(this.log.debug("autogeneration disabled; clearing generated credential"),this.generatedCredential$.next(void 0))})}),this.log.debug("component initialized")})}announce(e){this.ariaLive.announce(e).catch(e=>this.logService.error(e))}generate(e){return Lj(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.algorithm$),i={source:e,algorithm:t.id};this.website&&(i.website=this.website),this.log.debug(i,"generation requested"),this.generate$.next(i)})}toOptions(e){return e.map(e=>({value:JSON.stringify(e.id),label:Tj(e.i18nKeys.name,this.i18nService)}))}ngOnDestroy(){this.destroyed.next(),this.destroyed.complete(),this.generate$.complete(),this.generatedCredential$.complete(),this.onGenerated.complete(),this.log.debug("component destroyed")}}iG.ɵfac=function(e){return new(e||iG)(Fl.rXU(yf),Fl.rXU(Xy),Fl.rXU(qb),Fl.rXU(Za),Fl.rXU(Ul),Fl.rXU(Zk),Fl.rXU(Fl.SKi),Fl.rXU(Il.ok),Fl.rXU(gl.Ai))},iG.ɵcmp=Fl.VBU({type:iG,selectors:[["tools-credential-generator"]],inputs:{account:"account",debug:"debug",website:"website"},outputs:{onGenerated:"onGenerated"},features:[Fl.OA$],decls:30,vars:42,consts:[["fullWidth","",1,"tw-mb-4",3,"selectedChange","selected"],[3,"value"],[1,"tw-flex","tw-justify-between","tw-mb-4"],[1,"tw-grow","tw-flex","tw-items-center","tw-min-w-0"],[1,"tw-font-mono",3,"password"],[1,"tw-flex","tw-items-center","tw-space-x-1"],["type","button","bitIconButton","bwi-generate","buttonType","main",3,"click","label","disabled"],["type","button","bitIconButton","bwi-clone","buttonType","main","showToast","",3,"label","appCopyClick","valueLabel","disabled"],[1,"tw-mt-6",3,"account"],[1,"tw-mt-6",3,"onUpdated","account"],["bitTypography","h6"],[1,"tw-mb-4"],[1,"tw-container",3,"formGroup"],["formControlName","nav","data-testid","username-type",3,"items"],[3,"account"],[3,"account","forwarder"],["formControlName","nav","data-testid","email-forwarding-service",3,"items"],[3,"onUpdated","account"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-toggle-group",0),Fl.nI1(1,"async"),Fl.nI1(2,"i18n"),Fl.bIt("selectedChange",function(i){return a.eBV(e),a.Njj(t.onRootChanged({nav:i}))}),Fl.Z7z(3,zj,2,2,"bit-toggle",1,Fl.fX1),Fl.nI1(5,"async"),Fl.k0s(),Fl.nrm(6,"nudge-generator-spotlight"),Fl.j41(7,"bit-card",2)(8,"div",3),Fl.nrm(9,"bit-color-password",4),Fl.nI1(10,"async"),Fl.k0s(),Fl.j41(11,"div",5)(12,"button",6),Fl.nI1(13,"async"),Fl.nI1(14,"async"),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.generate(t.USER_REQUEST))}),Fl.EFF(15),Fl.nI1(16,"async"),Fl.k0s(),Fl.nrm(17,"button",7),Fl.nI1(18,"async"),Fl.nI1(19,"async"),Fl.nI1(20,"async"),Fl.nI1(21,"async"),Fl.k0s()(),Fl.SS7(22),Fl.nI1(23,"async"),Fl.SS7(24),Fl.nI1(25,"async"),Fl.nVh(26,_j,1,1,"tools-password-settings",8)(27,Kj,1,1,"tools-passphrase-settings",8),Fl.nVh(28,Zj,23,22,"bit-section"),Fl.nI1(29,"async")}if(2&e){let e;Fl.Y8G("selected",Fl.bMT(1,12,t.root$).nav),Fl.BMQ("aria-label",Fl.bMT(2,14,"type")),Fl.R7$(3),Fl.Dyx(Fl.bMT(5,16,t.rootOptions$)),Fl.R7$(6),Fl.Y8G("password",Fl.bMT(10,18,t.value$)),Fl.R7$(3),Fl.Y8G("label",Fl.bMT(13,20,t.credentialTypeGenerateLabel$))("disabled",!Fl.bMT(14,22,t.algorithm$)),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(16,24,t.credentialTypeGenerateLabel$)," "),Fl.R7$(2),Fl.Y8G("label",Fl.bMT(18,26,t.credentialTypeCopyLabel$))("appCopyClick",Fl.bMT(19,28,t.value$))("valueLabel",Fl.bMT(20,30,t.credentialTypeLabel$))("disabled",!Fl.bMT(21,32,t.algorithm$)),Fl.R7$(5);const i=Fl.bH3(Fl.bMT(23,34,t.showAlgorithm$));Fl.R7$(2),Fl.bH3(Fl.bMT(25,37,t.account$)),Fl.R7$(2),Fl.vxM((e=null==i?null:i.id)===t.Algorithm.password?26:e===t.Algorithm.passphrase?27:-1),Fl.R7$(2),Fl.vxM("password"!==Fl.bMT(29,40,t.category$)?28:-1)}},dependencies:[aj,Nj,Gj,yj,Ex,ZO,Zl,rO,Dj,Ij,Ux,Nx,tc,rc,Il.X1,Il.qT,Il.BC,Il.cb,Il.j4,Il.JD,Gu,Ac,hu,ju,Wu,qu,cj,fj,$j,Uj,sf,kl.Jj,sc],encapsulation:2});var nG=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function rG(e,t){if(1&e&&(Fl.j41(0,"bit-item")(1,"bit-item-content"),Fl.nrm(2,"bit-color-password",0),Fl.j41(3,"div",1),Fl.EFF(4),Fl.nI1(5,"date"),Fl.k0s()(),Fl.qex(6,2),Fl.j41(7,"bit-item-action")(8,"button",3),Fl.EFF(9),Fl.k0s()(),Fl.bVm(),Fl.k0s()),2&e){const e=t.$implicit,i=Fl.XpG();Fl.R7$(2),Fl.Y8G("password",e.credential),Fl.R7$(2),Fl.SpI(" ",Fl.i5U(5,6,e.generationDate,"medium")," "),Fl.R7$(4),Fl.Y8G("appCopyClick",e.credential)("valueLabel",i.getGeneratedValueText(e))("label",i.getCopyText(e)),Fl.R7$(),Fl.SpI(" ",i.getCopyText(e)," ")}}class sG{constructor(e,t,i,n){this.generatorService=e,this.history=t,this.i18nService=i,this.logService=n,this.destroyed=new Co.B,this.credentials$=new Dd.t([]),this.account$=new Ro.m(1),this.debug=!1,this.log=rj()}ngOnChanges(e){return nG(this,void 0,void 0,function*(){var t,i,n,r,s;const o=null==e?void 0:e.account;(null===(t=null==o?void 0:o.previousValue)||void 0===t?void 0:t.id)!==(null===(i=null==o?void 0:o.currentValue)||void 0===i?void 0:i.id)&&(this.log.debug({previousUserId:null===(n=null==o?void 0:o.previousValue)||void 0===n?void 0:n.id,currentUserId:null===(r=null==o?void 0:o.currentValue)||void 0===r?void 0:r.id},"account input change detected"),this.account$.next(null!==(s=o.currentValue)&&void 0!==s?s:this.account))})}ngOnInit(){this.log=oj(this.debug,this.logService,{type:"CredentialGeneratorComponent"}),this.account$.pipe((0,Oo.M)(e=>this.log.info({accountId:e.id},"loading credential history")),(0,go.n)(e=>this.history.credentials$(e.id)),(0,l.T)(e=>e.filter(e=>{var t;return""!==(null!==(t=e.credential)&&void 0!==t?t:"")})),(0,vm.Q)(this.destroyed)).subscribe(this.credentials$)}getCopyText(e){const[t]=Hg[e.category];return Tj(this.generatorService.algorithm(t).i18nKeys.copyCredential,this.i18nService)}getGeneratedValueText(e){const[t]=Hg[e.category];return Tj(this.generatorService.algorithm(t).i18nKeys.credentialType,this.i18nService)}ngOnDestroy(){this.destroyed.next(),this.destroyed.complete(),this.log.debug("component destroyed")}}sG.ɵfac=function(e){return new(e||sG)(Fl.rXU(yf),Fl.rXU(Xy),Fl.rXU(Ul),Fl.rXU(Za))},sG.ɵcmp=Fl.VBU({type:sG,selectors:[["bit-credential-generator-history"]],inputs:{account:"account",debug:"debug"},features:[Fl.OA$],decls:3,vars:2,consts:[[1,"tw-font-mono",3,"password"],["slot","secondary"],["slot","end"],["type","button","bitIconButton","bwi-clone","showToast","",3,"appCopyClick","valueLabel","label"]],template:function(e,t){1&e&&(Fl.Z7z(0,rG,10,9,"bit-item",null,Fl.fX1),Fl.nI1(2,"async")),2&e&&Fl.Dyx(Fl.bMT(2,0,t.credentials$))},dependencies:[kl.MD,XO,ZO,Ql,Zl,Wh,sf,rO,VP,GP,KP,BP,kl.Jj,kl.vh],encapsulation:2});const oG=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 1.49 96 94.02">
<path class="tw-fill-illustration-bg-primary" d="M79 48.5c0 17.12-13.88 31-31 31-17.12 0-31-13.88-31-31 0-17.12 13.88-31 31-31 17.12 0 31 13.88 31 31Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M48 18.5c-16.569 0-30 13.431-30 30 0 16.569 13.431 30 30 30 16.569 0 30-13.431 30-30 0-16.569-13.431-30-30-30Zm-32 30c0-17.673 14.327-32 32-32 17.673 0 32 14.327 32 32 0 17.673-14.327 32-32 32-17.673 0-32-14.327-32-32Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" d="M0 48.5c0-6.627 5.373-12 12-12h72c6.627 0 12 5.373 12 12s-5.373 12-12 12H12c-6.627 0-12-5.373-12-12Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M84 38.5H12c-5.523 0-10 4.477-10 10s4.477 10 10 10h72c5.523 0 10-4.477 10-10s-4.477-10-10-10Zm-72-2c-6.627 0-12 5.373-12 12s5.373 12 12 12h72c6.627 0 12-5.373 12-12s-5.373-12-12-12H12Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M20 42.5c.552 0 1 .467 1 1.042v4.175l3.74-1.989c.508-.27 1.13-.094 1.39.394.259.488.057 1.102-.45 1.372l-4.038 2.147 3.228 3.462c.392.42.383 1.067-.02 1.444-.405.376-1.05.34-1.443-.08L20 50.813l-3.408 3.654c-.392.42-1.038.456-1.441.08-.404-.377-.414-1.023-.021-1.444l3.228-3.462-4.038-2.147c-.508-.27-.71-.884-.45-1.372.26-.488.881-.664 1.39-.394l3.74 1.99v-4.176c0-.575.448-1.042 1-1.042Zm16 0c.552 0 1 .467 1 1.042v4.175l3.74-1.989c.508-.27 1.13-.094 1.39.394.259.488.057 1.102-.45 1.372l-4.038 2.147 3.228 3.462c.392.42.383 1.067-.02 1.444-.405.376-1.05.34-1.443-.08L36 50.813l-3.408 3.654c-.392.42-1.038.456-1.441.08-.404-.377-.414-1.023-.021-1.444l3.228-3.462-4.038-2.147c-.508-.27-.71-.884-.45-1.372.26-.488.881-.664 1.39-.394l3.74 1.99v-4.176c0-.575.447-1.042 1-1.042Zm17 1.042c0-.575-.448-1.042-1-1.042-.553 0-1 .467-1 1.042v4.175l-3.74-1.989c-.509-.27-1.13-.094-1.39.394s-.058 1.102.45 1.372l4.038 2.147-3.228 3.462c-.393.42-.383 1.067.02 1.444.404.376 1.05.34 1.442-.08L52 50.813l3.407 3.654c.393.42 1.038.456 1.442.08.404-.377.413-1.023.02-1.444l-3.227-3.462 4.037-2.147c.508-.27.71-.884.45-1.372-.259-.488-.88-.664-1.389-.394L53 47.717v-4.175Zm8 9.958a1 1 0 0 1 1-1h8a1 1 0 1 1 0 2h-8a1 1 0 0 1-1-1Zm13-1a1 1 0 1 0 0 2h8a1 1 0 0 0 0-2h-8Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" fill-rule="evenodd" d="M58.327 92.299c11.605-2.736 21.09-9.736 27.192-18.952a1 1 0 1 1 1.667 1.104c-6.37 9.624-16.28 16.937-28.4 19.795-19.671 4.637-39.367-3.824-49.937-19.72a1 1 0 1 1 1.666-1.107c10.121 15.221 28.98 23.32 47.812 18.88Zm28.545-68.44a1 1 0 0 1-1.386-.278C75.364 8.359 56.505.26 37.674 4.7 25.348 7.607 15.413 15.322 9.385 25.394a1 1 0 1 1-1.716-1.027C13.963 13.85 24.342 5.79 37.215 2.754c19.67-4.638 39.367 3.824 49.936 19.72a1 1 0 0 1-.279 1.386Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" fill-rule="evenodd" d="M24 73.5a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v14a1 1 0 1 0 2 0v-13h13a1 1 0 0 0 1-1ZM72 23.5a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-14a1 1 0 1 0-2 0v13H73a1 1 0 0 0-1 1ZM22.618 64.5a29.913 29.913 0 0 1-2.122-4h55.008a29.913 29.913 0 0 1-2.122 4H22.618Z" clip-rule="evenodd"/>
</svg>
`,aG=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="4 4.5 91.63 88">
<path class="tw-fill-illustration-bg-secondary" d="M62 12.5a2 2 0 0 1 2 2v76a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-76a2 2 0 0 1 2-2h56Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M62 90.5v-76H6v76h56Zm2-76a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v76a2 2 0 0 0 2 2h56a2 2 0 0 0 2-2v-76Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M72 82.5v-76a2 2 0 0 0-2-2H27.328c-.53 0-1.034.206-1.41.581L12.585 18.416A1.993 1.993 0 0 0 12 19.828V82.5a2 2 0 0 0 2 2h56a2 2 0 0 0 2-2Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M70 82.5v-76H27.328L14 19.828V82.5h56ZM27.333 6.495ZM72 6.5v76a2 2 0 0 1-2 2H14a2 2 0 0 1-2-2V19.828c0-.53.209-1.037.584-1.412L25.919 5.081c.375-.375.879-.581 1.41-.581H70a2 2 0 0 1 2 2Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M84 48.5c0 11.046-8.954 20-20 20s-20-8.954-20-20 8.954-20 20-20 20 8.954 20 20Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M64 66.5c9.941 0 18-8.059 18-18s-8.059-18-18-18-18 8.059-18 18 8.059 18 18 18Zm0 2c11.046 0 20-8.954 20-20s-8.954-20-20-20-20 8.954-20 20 8.954 20 20 20Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" d="M79 48.5c0 8.284-6.716 15-15 15-8.284 0-15-6.716-15-15 0-8.284 6.716-15 15-15 8.284 0 15 6.716 15 15Z"/>
<path class="tw-fill-illustration-outline" d="M95.004 77.587 78.5 62l-2 2 15.587 16.504a2 2 0 0 0 2.868.04l.09-.089a2 2 0 0 0-.041-2.868Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M28 5.5a1 1 0 0 1 1 1v15H14a1 1 0 1 1 0-2h13v-13a1 1 0 0 1 1-1Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" fill-rule="evenodd" d="M20 28.5a1 1 0 1 0 0 2h10a1 1 0 1 0 0-2H20Zm14 0a1 1 0 1 0 0 2h10a1 1 0 1 0 0-2H34Zm16.983 4.815A1 1 0 0 0 50 32.5H40a1 1 0 1 0 0 2h9.717c.405-.413.827-.808 1.266-1.185ZM44.025 49.5c.033.676.1 1.343.199 2H40a1 1 0 1 1 0-2h4.025Zm.199-4a20.086 20.086 0 0 0-.2 2H37a1 1 0 1 1 0-2h7.224Zm3.775-9c-.48.638-.922 1.306-1.323 2H38a1 1 0 1 1 0-2h9.998ZM64 28.5c-3.13 0-6.09.719-8.728 2H54a1 1 0 1 1 0-2h10Zm-16 0a1 1 0 1 0 0 2h2a1 1 0 1 0 0-2h-2Zm-11 5a1 1 0 0 0-1-1h-2a1 1 0 1 0 0 2h2a1 1 0 0 0 1-1Zm-3 5a1 1 0 1 0 0-2h-4a1 1 0 1 0 0 2h4Zm0 8a1 1 0 0 1-1 1h-6a1 1 0 1 1 0-2h6a1 1 0 0 1 1 1Zm2 5a1 1 0 1 0 0-2H20a1 1 0 1 0 0 2h16Zm-5-18a1 1 0 0 0-1-1H20a1 1 0 1 0 0 2h10a1 1 0 0 0 1-1Zm-5 5a1 1 0 1 0 0-2h-6a1 1 0 1 0 0 2h6Zm-2 8a1 1 0 0 1-1 1h-3a1 1 0 1 1 0-2h3a1 1 0 0 1 1 1Z" clip-rule="evenodd"/>
</svg>
`,lG=[[["","slot","title"]],[["","slot","description"]],[["","slot","button"]]];class cG{constructor(){this.icon=(0,o.hFB)(aG)}}cG.ɵfac=function(e){return new(e||cG)},cG.ɵcmp=Fl.VBU({type:cG,selectors:[["bit-no-items"]],inputs:{icon:[1,"icon"]},ngContentSelectors:["[slot=title]","[slot=description]","[slot=button]"],decls:10,vars:1,consts:[[1,"tw-mx-auto","tw-flex","tw-flex-col","tw-items-center","tw-justify-center","tw-pt-6"],[1,"tw-max-w-sm","tw-flex","tw-flex-col","tw-items-center"],[1,"tw-size-24","tw-content-center"],["aria-hidden","true",3,"content"],[1,"tw-font-medium","tw-text-center","tw-mt-4"],[1,"tw-text-center"],[1,"tw-space-x-2"]],template:function(e,t){1&e&&(Fl.NAR(lG),Fl.j41(0,"div",0)(1,"div",1)(2,"div",2),Fl.nrm(3,"bit-svg",3),Fl.k0s(),Fl.j41(4,"h3",4),Fl.SdG(5),Fl.k0s(),Fl.j41(6,"p",5),Fl.SdG(7,1),Fl.k0s()(),Fl.j41(8,"div",6),Fl.SdG(9,2),Fl.k0s()()),2&e&&(Fl.R7$(3),Fl.Y8G("content",t.icon()))},dependencies:[BC],encapsulation:2,changeDetection:0});class uG{constructor(){this.noCredentialsIcon=oG}}uG.ɵfac=function(e){return new(e||uG)},uG.ɵcmp=Fl.VBU({type:uG,selectors:[["bit-empty-credential-history"]],decls:7,vars:7,consts:[[3,"icon"],["slot","title"],["slot","description"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-no-items",0),Fl.qex(1,1),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.bVm(),Fl.qex(4,2),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.bVm(),Fl.k0s()),2&e&&(Fl.Y8G("icon",t.noCredentialsIcon),Fl.R7$(2),Fl.JRh(Fl.bMT(3,3,"nothingToShow")),Fl.R7$(3),Fl.JRh(Fl.bMT(6,5,"nothingGeneratedRecently")))},dependencies:[sf,Wh,cG,rf],encapsulation:2});var dG=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function hG(e,t){if(1&e&&(Fl.nrm(0,"bit-credential-generator-history",4),Fl.nI1(1,"async")),2&e){const e=Fl.XpG();Fl.Y8G("account",Fl.bMT(1,1,e.account$))}}function pG(e,t){1&e&&Fl.nrm(0,"bit-empty-credential-history",5)}class vG{constructor(e,t,i,n){this.accountService=e,this.history=t,this.dialogService=i,this.logService=n,this.destroyed=new Co.B,this.hasHistory$=new Dd.t(!1),this.account$=new Ro.m(1),this.debug=!1,this.log=rj()}ngOnChanges(e){var t,i,n,r,s;const o=null==e?void 0:e.account;(null===(t=null==o?void 0:o.previousValue)||void 0===t?void 0:t.id)!==(null===(i=null==o?void 0:o.currentValue)||void 0===i?void 0:i.id)&&(this.log.debug({previousUserId:null===(n=null==o?void 0:o.previousValue)||void 0===n?void 0:n.id,currentUserId:null===(r=null==o?void 0:o.currentValue)||void 0===r?void 0:r.id},"account input change detected"),this.account$.next(null!==(s=o.currentValue)&&void 0!==s?s:this.account))}ngOnInit(){return dG(this,void 0,void 0,function*(){this.log=oj(this.debug,this.logService,{type:"CredentialGeneratorComponent"}),this.account||(this.account=yield(0,bo._)(this.accountService.activeAccount$),this.log.info({userId:this.account.id},"account not specified; using active account settings"),this.account$.next(this.account)),this.account$.pipe((0,go.n)(e=>e.id&&this.history.credentials$(e.id)),(0,l.T)(e=>e.length>0),(0,vm.Q)(this.destroyed)).subscribe(this.hasHistory$)})}clear(){return dG(this,void 0,void 0,function*(){(yield this.dialogService.openSimpleDialog({title:{key:"clearGeneratorHistoryTitle"},content:{key:"cleargGeneratorHistoryDescription"},type:"warning",acceptButtonText:{key:"clearHistory"},cancelButtonText:{key:"cancel"}}))&&(yield this.history.clear((yield(0,bo._)(this.account$)).id))})}ngOnDestroy(){this.destroyed.next(),this.destroyed.complete(),this.log.debug("component destroyed")}}vG.ɵfac=function(e){return new(e||vG)(Fl.rXU(Zk),Fl.rXU(Xy),Fl.rXU(lh),Fl.rXU(Za))},vG.ɵcmp=Fl.VBU({type:vG,selectors:[["ng-component"]],inputs:{account:"account",debug:"debug"},features:[Fl.OA$],decls:14,vars:12,consts:[["dialog",""],["background","alt"],["bitDialogTitle",""],["bitDialogContent",""],[3,"account"],[2,"display","contents"],["bitDialogFooter",""],["bitButton","","type","submit","buttonType","primary",3,"click","disabled"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-dialog",1,0)(2,"span",2),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.qex(5,3),Fl.nVh(6,hG,2,3,"bit-credential-generator-history",4),Fl.nI1(7,"async"),Fl.vZN(8,pG,1,0,"bit-empty-credential-history",5),Fl.bVm(),Fl.qex(9,6),Fl.j41(10,"button",7),Fl.nI1(11,"async"),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.clear())}),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()}2&e&&(Fl.R7$(3),Fl.JRh(Fl.bMT(4,4,"generatorHistory")),Fl.R7$(3),Fl.vxM(Fl.bMT(7,6,t.hasHistory$)?6:8),Fl.R7$(4),Fl.Y8G("disabled",!Fl.bMT(11,8,t.hasHistory$)),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(13,10,"clearHistory")," "))},dependencies:[id,td,kl.MD,sf,Fh,Ph,sG,uG,kl.Jj,rf],encapsulation:2});var fG=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function mG(e,t){if(1&e&&(Fl.j41(0,"bit-toggle",9),Fl.EFF(1),Fl.k0s()),2&e){const e=t.$implicit;Fl.Y8G("value",e.value),Fl.R7$(),Fl.SpI(" ",e.label," ")}}function gG(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-toggle-group",8),Fl.nI1(1,"async"),Fl.nI1(2,"i18n"),Fl.bIt("selectedChange",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.onCredentialTypeChanged(t))}),Fl.Z7z(3,mG,2,2,"bit-toggle",9,Fl.fX1),Fl.nI1(5,"async"),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.Y8G("selected",Fl.bMT(1,2,e.credentialType$)),Fl.BMQ("aria-label",Fl.bMT(2,4,"type")),Fl.R7$(3),Fl.Dyx(Fl.bMT(5,6,e.passwordOptions$))}}function yG(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"tools-password-settings",10),Fl.nI1(1,"async"),Fl.bIt("onUpdated",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.generate("password settings"))}),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.Y8G("account",Fl.bMT(1,2,e.account$))("disableMargin",e.disableMargin)}}function bG(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"tools-passphrase-settings",10),Fl.nI1(1,"async"),Fl.bIt("onUpdated",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.generate("passphrase settings"))}),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.Y8G("account",Fl.bMT(1,2,e.account$))("disableMargin",e.disableMargin)}}class wG{constructor(e,t,i,n,r,s,o,a){this.generatorService=e,this.generatorHistoryService=t,this.toastService=i,this.i18nService=n,this.logService=r,this.accountService=s,this.zone=o,this.ariaLive=a,this.Algorithm=Um,this.account=null,this.account$=new Ro.m(1),this.debug=!1,this.log=rj(),this.profile=Nm.account,this.disableMargin=!1,this.credentialType$=new Dd.t(null),this.value$=new Dd.t(""),this.generate$=new Co.B,this.USER_REQUEST="user request",this.onGenerated=new Fl.bkB,this.onAlgorithm=new Fl.bkB,this.passwordOptions$=new Dd.t([]),this.showCredentialTypes$=this.passwordOptions$.pipe((0,l.T)(e=>e.length>1)),this.maybeAlgorithm$=new Ro.m(1),this.algorithm$=this.maybeAlgorithm$.pipe((0,Eo.p)(e=>!!e)),this.credentialTypeCopyLabel$=this.algorithm$.pipe((0,l.T)(({i18nKeys:{copyCredential:e}})=>Tj(e,this.i18nService))),this.credentialTypeGenerateLabel$=this.algorithm$.pipe((0,l.T)(({i18nKeys:{generateCredential:e}})=>Tj(e,this.i18nService))),this.credentialTypeLabel$=this.algorithm$.pipe((0,l.T)(({i18nKeys:{credentialType:e}})=>Tj(e,this.i18nService))),this.destroyed=new Co.B}ngOnChanges(e){return fG(this,void 0,void 0,function*(){var t,i;const n=null==e?void 0:e.account;n&&n.currentValue.id&&n.previousValue.id!==n.currentValue.id&&(this.log.debug({previousUserId:null===(t=null==n?void 0:n.previousValue)||void 0===t?void 0:t.id,currentUserId:null===(i=null==n?void 0:n.currentValue)||void 0===i?void 0:i.id},"account input change detected"),this.account$.next(n.currentValue.id))})}generate(e){return fG(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.algorithm$),i={source:e,algorithm:t.id,profile:this.profile};this.log.debug(i,"generation requested"),this.generate$.next(i)})}onCredentialTypeChanged(e){this.credentialType$.value!==e&&this.zone.run(()=>{this.credentialType$.next(e)})}ngOnInit(){return fG(this,void 0,void 0,function*(){if(this.log=oj(this.debug,this.logService,{type:"PasswordGeneratorComponent"}),!this.account){const e=yield(0,bo._)(this.accountService.activeAccount$);e||this.log.panic("active account cannot be `null`."),this.log.info({userId:e.id},"account not specified; using active account settings"),this.account$.next(e)}this.generatorService.algorithms$("password",{account$:this.account$}).pipe((0,l.T)(e=>this.toOptions(e)),(0,vm.Q)(this.destroyed)).subscribe(this.passwordOptions$),this.generatorService.generate$({on$:this.generate$,account$:this.account$}).pipe((0,Ed.W)((e,t)=>("string"==typeof e?this.toastService.showToast({message:e,variant:"error",title:""}):this.logService.error(e),t)),(0,km.E)(this.account$,this.algorithm$),(0,vm.Q)(this.destroyed)).subscribe(([e,t,i])=>{var n;this.log.debug({source:null!==(n=e.source)&&void 0!==n?n:null},"credential generated"),this.generatorHistoryService.track(t.id,e.credential,e.category,e.generationDate).catch(e=>{this.logService.error(e)}),this.zone.run(()=>{e.source===this.USER_REQUEST&&this.announce(Tj(i.i18nKeys.credentialGenerated,this.i18nService)),this.onGenerated.next(e),this.value$.next(e.credential)})});const e=yield this.generatorService.preferences({account$:this.account$});this.credentialType$.pipe((0,Eo.p)(e=>!!e),(0,km.E)(e),(0,vm.Q)(this.destroyed)).subscribe(([t,i])=>{_g(t)&&(this.log.info({algorithm:t,type:Mm.password},"algorithm preferences updated"),i.password.algorithm=t,i.password.updated=new Date,e.next(i))}),e.pipe((0,l.T)(({password:e})=>this.generatorService.algorithm(e.algorithm)),(0,mo.F)((e,t)=>null!==e&&null!==t&&Wg(e.id,t.id)),(0,vm.Q)(this.destroyed)).subscribe(e=>{this.log.debug({algorithm:e.id},"algorithm selected"),this.onCredentialTypeChanged(e.id),this.zone.run(()=>{this.maybeAlgorithm$.next(e),this.onAlgorithm.next(Cj(e,this.i18nService))})}),this.maybeAlgorithm$.pipe((0,vm.Q)(this.destroyed)).subscribe(e=>{this.zone.run(()=>{var t;(null===(t=null==e?void 0:e.capabilities)||void 0===t?void 0:t.autogenerate)?(this.log.debug("autogeneration enabled"),this.generate("autogenerate").catch(e=>{this.log.error(e,"a failure occurred during autogeneration")})):(this.log.debug("autogeneration disabled; clearing generated credential"),this.value$.next("-"))})}),this.log.debug("component initialized")})}announce(e){this.ariaLive.announce(e).catch(e=>this.logService.error(e))}toOptions(e){return e.map(e=>({value:e.id,label:Tj(e.i18nKeys.name,this.i18nService)}))}ngOnDestroy(){this.destroyed.complete(),this.generate$.complete(),this.value$.complete(),this.onGenerated.complete()}}wG.ɵfac=function(e){return new(e||wG)(Fl.rXU(yf),Fl.rXU(Xy),Fl.rXU(qb),Fl.rXU(Ul),Fl.rXU(Za),Fl.rXU(Zk),Fl.rXU(Fl.SKi),Fl.rXU(gl.Ai))},wG.ɵcmp=Fl.VBU({type:wG,selectors:[["tools-password-generator"]],inputs:{account:"account",debug:"debug",profile:"profile",disableMargin:[2,"disableMargin","disableMargin",$x.he]},outputs:{onGenerated:"onGenerated",onAlgorithm:"onAlgorithm"},features:[Fl.OA$],decls:21,vars:33,consts:[["fullWidth","",1,"tw-mb-4",3,"selected"],[1,"tw-flex","tw-justify-between","tw-mb-4"],[1,"tw-grow","tw-flex","tw-items-center","tw-min-w-0"],[1,"tw-font-mono",3,"password"],[1,"tw-flex","tw-items-center","tw-space-x-1"],["type","button","bitIconButton","bwi-generate","buttonType","main",3,"click","label","disabled"],["type","button","bitIconButton","bwi-clone","buttonType","main","showToast","",3,"label","appCopyClick","valueLabel","disabled"],[1,"tw-mt-6",3,"account","disableMargin"],["fullWidth","",1,"tw-mb-4",3,"selectedChange","selected"],[3,"value"],[1,"tw-mt-6",3,"onUpdated","account","disableMargin"]],template:function(e,t){if(1&e&&(Fl.nVh(0,gG,6,8,"bit-toggle-group",0),Fl.nI1(1,"async"),Fl.j41(2,"bit-card",1)(3,"div",2),Fl.nrm(4,"bit-color-password",3),Fl.nI1(5,"async"),Fl.k0s(),Fl.j41(6,"div",4)(7,"button",5),Fl.nI1(8,"async"),Fl.nI1(9,"async"),Fl.bIt("click",function(){return t.generate(t.USER_REQUEST)}),Fl.EFF(10),Fl.nI1(11,"async"),Fl.k0s(),Fl.nrm(12,"button",6),Fl.nI1(13,"async"),Fl.nI1(14,"async"),Fl.nI1(15,"async"),Fl.nI1(16,"async"),Fl.k0s()(),Fl.nVh(17,yG,2,4,"tools-password-settings",7),Fl.nI1(18,"async"),Fl.nVh(19,bG,2,4,"tools-passphrase-settings",7),Fl.nI1(20,"async")),2&e){let e,i;Fl.vxM(Fl.bMT(1,11,t.showCredentialTypes$)?0:-1),Fl.R7$(4),Fl.Y8G("password",Fl.bMT(5,13,t.value$)),Fl.R7$(3),Fl.Y8G("label",Fl.bMT(8,15,t.credentialTypeGenerateLabel$))("disabled",!Fl.bMT(9,17,t.algorithm$)),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(11,19,t.credentialTypeGenerateLabel$)," "),Fl.R7$(2),Fl.Y8G("label",Fl.bMT(13,21,t.credentialTypeCopyLabel$))("appCopyClick",Fl.bMT(14,23,t.value$))("valueLabel",Fl.bMT(15,25,t.credentialTypeLabel$))("disabled",!Fl.bMT(16,27,t.algorithm$)),Fl.R7$(5),Fl.vxM((null==(e=Fl.bMT(18,29,t.algorithm$))?null:e.id)===t.Algorithm.password?17:-1),Fl.R7$(2),Fl.vxM((null==(i=Fl.bMT(20,31,t.algorithm$))?null:i.id)===t.Algorithm.passphrase?19:-1)}},dependencies:[aj,Nj,Gj,Ex,ZO,Zl,rO,Dj,Ij,sf,kl.Jj,sc],encapsulation:2});var SG=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const kG=e=>({"tw-mb-4":e});function IG(e,t){if(1&e&&(Fl.j41(0,"bit-hint"),Fl.EFF(1),Fl.nI1(2,"async"),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.JRh(Fl.bMT(2,1,e.credentialTypeHint$))}}function CG(e,t){if(1&e&&(Fl.j41(0,"form",9)(1,"bit-form-field")(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.nrm(5,"bit-select",13),Fl.nI1(6,"async"),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.Y8G("formGroup",e.forwarder),Fl.R7$(3),Fl.JRh(Fl.bMT(4,3,"service")),Fl.R7$(2),Fl.Y8G("items",Fl.bMT(6,5,e.forwarderOptions$))}}function TG(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"tools-catchall-settings",14),Fl.bIt("onUpdated",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.generate("catchall settings"))}),Fl.k0s()}if(2&e){Fl.XpG();const e=Fl.r8f(37);Fl.Y8G("account",e)}}function PG(e,t){if(1&e&&Fl.nrm(0,"tools-forwarder-settings",12),2&e){Fl.XpG();const e=Fl.r8f(37);Fl.Y8G("forwarder",t)("account",e)}}function FG(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"tools-subaddress-settings",14),Fl.bIt("onUpdated",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.generate("subaddress settings"))}),Fl.k0s()}if(2&e){Fl.XpG();const e=Fl.r8f(37);Fl.Y8G("account",e)}}function RG(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"tools-username-settings",14),Fl.bIt("onUpdated",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.generate("username settings"))}),Fl.k0s()}if(2&e){Fl.XpG();const e=Fl.r8f(37);Fl.Y8G("account",e)}}const xG="forwarder",AG="none";class DG{constructor(e,t,i,n,r,s,o,a,c){this.generatorService=e,this.generatorHistoryService=t,this.toastService=i,this.logService=n,this.i18nService=r,this.accountService=s,this.zone=o,this.formBuilder=a,this.ariaLive=c,this.Algorithm=Um,this.account=null,this.account$=new Ro.m(1),this.debug=!1,this.log=rj(),this.website=null,this.onGenerated=new Fl.bkB,this.onAlgorithm=new Fl.bkB,this.disableMargin=!1,this.username=this.formBuilder.group({nav:[null]}),this.forwarder=this.formBuilder.group({nav:[null]}),this.typeOptions$=new Dd.t([]),this.forwarderId$=new Dd.t(null),this.forwarderOptions$=new Dd.t([]),this.showForwarder$=new Dd.t(!1),this.maybeAlgorithm$=new Ro.m(1),this.algorithm$=this.maybeAlgorithm$.pipe((0,Eo.p)(e=>!!e)),this.credentialTypeHint$=new Ro.m(1),this.generatedCredential$=new Dd.t(void 0),this.value$=this.generatedCredential$.pipe((0,l.T)(e=>{var t;return null!==(t=null==e?void 0:e.credential)&&void 0!==t?t:"-"})),this.generate$=new Co.B,this.showAlgorithm$=this.maybeAlgorithm$.pipe((0,Yp.v)(this.showForwarder$),(0,l.T)(([e,t])=>t?null:e)),this.credentialTypeCopyLabel$=this.algorithm$.pipe((0,l.T)(({i18nKeys:{copyCredential:e}})=>Tj(e,this.i18nService))),this.credentialTypeGenerateLabel$=this.algorithm$.pipe((0,l.T)(({i18nKeys:{generateCredential:e}})=>Tj(e,this.i18nService))),this.credentialTypeLabel$=this.algorithm$.pipe((0,l.T)(({i18nKeys:{credentialType:e}})=>Tj(e,this.i18nService))),this.USER_REQUEST="user request",this.destroyed=new Co.B}ngOnChanges(e){return SG(this,void 0,void 0,function*(){var t,i;const n=null==e?void 0:e.account;n&&n.currentValue.id&&n.previousValue.id!==n.currentValue.id&&(this.log.debug({previousUserId:null===(t=null==n?void 0:n.previousValue)||void 0===t?void 0:t.id,currentUserId:null===(i=null==n?void 0:n.currentValue)||void 0===i?void 0:i.id},"account input change detected"),this.account$.next(n.currentValue.id))})}ngOnInit(){return SG(this,void 0,void 0,function*(){if(this.log=oj(this.debug,this.logService,{type:"UsernameGeneratorComponent"}),!this.account){const e=yield(0,bo._)(this.accountService.activeAccount$);e||this.log.panic("active account cannot be `null`."),this.log.info({userId:e.id},"account not specified; using active account settings"),this.account$.next(e)}(0,jo.z)([this.generatorService.algorithms$("email",{account$:this.account$}),this.generatorService.algorithms$("username",{account$:this.account$})]).pipe((0,l.T)(e=>e.flat()),(0,l.T)(e=>{const t=e.filter(e=>!Xg(e.id));t.sort((e,t)=>e.weight-t.weight);const i=this.toOptions(t);i.splice(-1,0,{value:xG,label:this.i18nService.t("forwardedEmail")});const n=e.filter(e=>Xg(e.id));n.sort((e,t)=>e.weight-t.weight);const r=this.toOptions(n);return r.unshift({value:AG,label:this.i18nService.t("select")}),[i,r]}),(0,Oo.M)(e=>this.log.debug({algorithms:e},"algorithms loaded")),(0,vm.Q)(this.destroyed)).subscribe(([e,t])=>{this.zone.run(()=>{this.typeOptions$.next(e),this.forwarderOptions$.next(t)})}),this.maybeAlgorithm$.pipe((0,l.T)(e=>{var t;return(null===(t=null==e?void 0:e.i18nKeys)||void 0===t?void 0:t.description)?Tj(e.i18nKeys.description,this.i18nService):""}),(0,vm.Q)(this.destroyed)).subscribe(e=>{this.zone.run(()=>{this.credentialTypeHint$.next(e)})}),this.generatorService.generate$({on$:this.generate$,account$:this.account$}).pipe((0,Ed.W)((e,t)=>("string"==typeof e?this.toastService.showToast({message:e,variant:"error",title:""}):this.logService.error(e),t)),(0,km.E)(this.account$,this.maybeAlgorithm$),(0,vm.Q)(this.destroyed)).subscribe(([e,t,i])=>{var n,r;this.log.debug({source:null!==(n=e.source)&&void 0!==n?n:null,algorithm:null!==(r=null==i?void 0:i.id)&&void 0!==r?r:null},"credential generated"),this.generatorHistoryService.track(t.id,e.credential,e.category,e.generationDate).catch(e=>{this.logService.error(e)}),this.zone.run(()=>{i&&e.source===this.USER_REQUEST&&this.announce(Tj(i.i18nKeys.credentialGenerated,this.i18nService)),this.generatedCredential$.next(e),this.onGenerated.next(e)})});const e=new Co.B,t=new Co.B;this.username.valueChanges.pipe((0,l.T)(e=>{if(e.nav===xG)return{nav:e.nav};if(e.nav)return{nav:e.nav,algorithm:JSON.parse(e.nav)};{const[e]=Hg[Mm.username];return{nav:JSON.stringify(e),algorithm:e}}}),(0,vm.Q)(this.destroyed)).subscribe(e),this.forwarder.valueChanges.pipe((0,l.T)(e=>e.nav===AG?{nav:e.nav}:e.nav?{nav:e.nav,algorithm:JSON.parse(e.nav)}:{nav:AG}),(0,vm.Q)(this.destroyed)).subscribe(t),(0,jo.z)([e,t]).pipe((0,l.T)(([e,t])=>{const i=!e.algorithm;return[i,i&&t.algorithm&&Xg(t.algorithm)?t.algorithm.forwarder:null]}),(0,mo.F)((e,t)=>e[0]===t[0]&&e[1]===t[1]),(0,vm.Q)(this.destroyed)).subscribe(([e,t])=>{this.log.debug({forwarderId:t,showForwarder:e},"forwarder visibility updated"),this.zone.run(()=>{this.showForwarder$.next(e),this.forwarderId$.next(t)})}),(0,jo.z)([e,t]).pipe((0,l.T)(([e,t])=>{var i;const n=null!==(i=e.algorithm)&&void 0!==i?i:t.algorithm;return n?this.generatorService.algorithm(n):null}),(0,mo.F)((e,t)=>null!==e&&null!==t&&Wg(e.id,t.id)),(0,vm.Q)(this.destroyed)).subscribe(e=>{var t;this.log.debug({algorithm:null!==(t=null==e?void 0:e.id)&&void 0!==t?t:null},"algorithm selected"),this.zone.run(()=>{this.maybeAlgorithm$.next(e),e?this.onAlgorithm.next(Cj(e,this.i18nService)):this.onAlgorithm.next(null)})});const i=yield this.generatorService.preferences({account$:this.account$});this.algorithm$.pipe((0,km.E)(i),(0,vm.Q)(this.destroyed)).subscribe(([e,t])=>{if(qg(e.id))t.email.algorithm=e.id,t.email.updated=new Date;else{if(!Kg(e.id))return;t.username.algorithm=e.id,t.username.updated=new Date}this.log.info({algorithm:e.id,type:e.type},"algorithm preferences updated"),i.next(t)}),i.pipe((0,l.T)(({email:e,username:t})=>{const i=e.updated>t.updated?e:t,n=Xg(i.algorithm)?i:null,r=n?JSON.stringify(n.algorithm):AG,s=n?xG:JSON.stringify(i.algorithm);return{username:{selection:{nav:s},active:{nav:s,algorithm:n?void 0:i.algorithm}},forwarder:{selection:{nav:r},active:{nav:r,algorithm:null==n?void 0:n.algorithm}}}}),(0,vm.Q)(this.destroyed)).subscribe(({username:i,forwarder:n})=>{this.log.debug({username:i.selection,forwarder:n.selection},"navigation updated"),this.username.setValue(i.selection,{emitEvent:!1}),this.forwarder.setValue(n.selection,{emitEvent:!1}),e.next(i.active),t.next(n.active)}),this.maybeAlgorithm$.pipe((0,vm.Q)(this.destroyed)).subscribe(e=>{this.zone.run(()=>{var t;(null===(t=null==e?void 0:e.capabilities)||void 0===t?void 0:t.autogenerate)?(this.log.debug("autogeneration enabled"),this.generate("autogenerate").catch(e=>{this.log.error(e,"a failure occurred during autogeneration")})):(this.log.debug("autogeneration disabled; clearing generated credential"),this.generatedCredential$.next(void 0))})}),this.log.debug("component initialized")})}announce(e){this.ariaLive.announce(e).catch(e=>this.logService.error(e))}generate(e){return SG(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.algorithm$),i={source:e,algorithm:t.id};this.website&&(i.website=this.website),this.log.debug(i,"generation requested"),this.generate$.next(i)})}toOptions(e){return e.map(e=>({value:JSON.stringify(e.id),label:Tj(e.i18nKeys.name,this.i18nService)}))}ngOnDestroy(){this.destroyed.next(),this.destroyed.complete(),this.generate$.complete(),this.generatedCredential$.complete(),this.onGenerated.complete(),this.log.debug("component destroyed")}}DG.ɵfac=function(e){return new(e||DG)(Fl.rXU(yf),Fl.rXU(Xy),Fl.rXU(qb),Fl.rXU(Za),Fl.rXU(Ul),Fl.rXU(Zk),Fl.rXU(Fl.SKi),Fl.rXU(Il.ok),Fl.rXU(gl.Ai))},DG.ɵcmp=Fl.VBU({type:DG,selectors:[["tools-username-generator"]],inputs:{account:"account",debug:"debug",website:"website",disableMargin:[2,"disableMargin","disableMargin",$x.he]},outputs:{onGenerated:"onGenerated",onAlgorithm:"onAlgorithm"},features:[Fl.OA$],decls:44,vars:58,consts:[[1,"tw-flex","tw-justify-between","tw-mb-4"],[1,"tw-grow","tw-flex","tw-items-center"],[1,"tw-font-mono",3,"password"],[1,"tw-flex","tw-items-center","tw-space-x-1"],["type","button","bitIconButton","bwi-generate","buttonType","main",3,"click","label","disabled"],["type","button","bitIconButton","bwi-clone","buttonType","main","showToast","",3,"label","appCopyClick","valueLabel","disabled"],[3,"disableMargin"],["bitTypography","h6"],[3,"ngClass"],[1,"tw-container",3,"formGroup"],["formControlName","nav","data-testid","username-type",3,"items"],[3,"account"],[3,"forwarder","account"],["formControlName","nav","data-testid","email-forwarding-service",3,"items"],[3,"onUpdated","account"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-card",0)(1,"div",1),Fl.nrm(2,"bit-color-password",2),Fl.nI1(3,"async"),Fl.k0s(),Fl.j41(4,"div",3)(5,"button",4),Fl.nI1(6,"async"),Fl.nI1(7,"async"),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.generate(t.USER_REQUEST))}),Fl.EFF(8),Fl.nI1(9,"async"),Fl.k0s(),Fl.j41(10,"button",5),Fl.nI1(11,"async"),Fl.nI1(12,"async"),Fl.nI1(13,"async"),Fl.nI1(14,"async"),Fl.EFF(15),Fl.nI1(16,"async"),Fl.k0s()()(),Fl.j41(17,"bit-section",6)(18,"bit-section-header")(19,"h2",7),Fl.EFF(20),Fl.nI1(21,"i18n"),Fl.k0s()(),Fl.j41(22,"div",8)(23,"bit-card")(24,"form",9)(25,"bit-form-field")(26,"bit-label"),Fl.EFF(27),Fl.nI1(28,"i18n"),Fl.k0s(),Fl.nrm(29,"bit-select",10),Fl.nI1(30,"async"),Fl.nVh(31,IG,3,3,"bit-hint"),Fl.nI1(32,"async"),Fl.k0s()(),Fl.nVh(33,CG,7,7,"form",9),Fl.nI1(34,"async"),Fl.SS7(35),Fl.nI1(36,"async"),Fl.SS7(37),Fl.nI1(38,"async"),Fl.nVh(39,TG,1,1,"tools-catchall-settings",11),Fl.nVh(40,PG,1,2,"tools-forwarder-settings",12),Fl.nI1(41,"async"),Fl.nVh(42,FG,1,1,"tools-subaddress-settings",11),Fl.nVh(43,RG,1,1,"tools-username-settings",11),Fl.k0s()()()}if(2&e){let e;Fl.R7$(2),Fl.Y8G("password",Fl.bMT(3,21,t.value$)),Fl.R7$(3),Fl.Y8G("label",Fl.bMT(6,23,t.credentialTypeGenerateLabel$))("disabled",!Fl.bMT(7,25,t.algorithm$)),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(9,27,t.credentialTypeGenerateLabel$)," "),Fl.R7$(2),Fl.Y8G("label",Fl.bMT(11,29,t.credentialTypeCopyLabel$))("appCopyClick",Fl.bMT(12,31,t.value$))("valueLabel",Fl.bMT(13,33,t.credentialTypeLabel$))("disabled",!Fl.bMT(14,35,t.algorithm$)),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(16,37,t.credentialTypeCopyLabel$)," "),Fl.R7$(2),Fl.Y8G("disableMargin",t.disableMargin),Fl.R7$(3),Fl.JRh(Fl.bMT(21,39,"options")),Fl.R7$(2),Fl.Y8G("ngClass",Fl.eq3(56,kG,!t.disableMargin)),Fl.R7$(2),Fl.Y8G("formGroup",t.username),Fl.R7$(3),Fl.JRh(Fl.bMT(28,41,"type")),Fl.R7$(2),Fl.Y8G("items",Fl.bMT(30,43,t.typeOptions$)),Fl.R7$(2),Fl.vxM(Fl.bMT(32,45,t.credentialTypeHint$)?31:-1),Fl.R7$(2),Fl.vxM(Fl.bMT(34,47,t.showForwarder$)?33:-1);const i=Fl.bMT(36,49,t.showAlgorithm$);Fl.R7$(4),Fl.bH3(Fl.bMT(38,51,t.account$)),Fl.R7$(2),Fl.vxM((null==i?null:i.id)===t.Algorithm.catchall?39:-1),Fl.R7$(),Fl.vxM((e=Fl.bMT(41,54,t.forwarderId$))?40:-1,e),Fl.R7$(2),Fl.vxM((null==i?null:i.id)===t.Algorithm.plusAddress?42:-1),Fl.R7$(),Fl.vxM((null==i?null:i.id)===t.Algorithm.username?43:-1)}},dependencies:[Ex,ZO,Zl,rO,Ux,Nx,tc,rc,kl.YU,Il.X1,Il.qT,Il.BC,Il.cb,Il.j4,Il.JD,qu,Gu,Ac,hu,ju,cj,fj,$j,Uj,sf,kl.Jj,sc],encapsulation:2});class EG{constructor(){}}EG.ɵfac=function(e){return new(e||EG)},EG.ɵmod=Fl.$C({type:EG}),EG.ɵinj=a.G2t({imports:[iG,wG,DG]});class $G{}var OG=i(69514),UG=i(24999),MG=i(7222);class NG{}var VG=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class BG extends NG{constructor(e,t,i,n){super(),this.organizationId=e,this.encryptService=t,this.key=i,this.dataPacker=n,this.assertHasValue("organizationId",e),this.assertHasValue("key",i),this.assertHasValue("dataPacker",n),this.assertHasValue("encryptService",t)}encrypt(e){return VG(this,void 0,void 0,function*(){this.assertHasValue("secret",e);let t=this.dataPacker.pack(e);const i=yield this.encryptService.encryptString(t,this.key);return t=null,i})}decrypt(e){return VG(this,void 0,void 0,function*(){this.assertHasValue("secret",e);let t=yield this.encryptService.decryptString(e,this.key);const i=this.dataPacker.unpack(t);return t=null,i})}assertHasValue(e,t){if(null==t)throw new Error(`${e} cannot be null or undefined`)}}class jG{constructor(e,t){this.encryptService=e,this.keyService=t}userEncryptor$(e,t){const i=new Sy(e);return t.singleUserId$.pipe(Pm(e=>e,(e,t)=>({expectedUserId:e,actualUserId:t})),(0,wm.N)(e=>{const t=new Ro.m(1);return e.subscribe(t),t.pipe((0,go.n)(e=>this.keyService.userKey$(e).pipe((0,OG.j)(e=>!e),(0,oa.v)(e=>!!e),(0,l.T)(t=>{const n=new my(e,this.encryptService,t,i);return{userId:e,encryptor:n}}),(0,UG.O)())),(0,MG.Z)(),(0,vm.Q)(xm(t)))}))}organizationEncryptor$(e,t){const i=new Sy(e),n=t.singleOrganizationId$.pipe(Pm(e=>e.userId,(e,t)=>({expectedUserId:e,actualUserId:t})),Pm(e=>e.organizationId,(e,t)=>({expectedOrganizationId:e,actualOrganizationId:t})),(0,wm.N)(e=>{const t=new Ro.m(1);return e.subscribe(t),t.pipe((0,go.n)(e=>this.keyService.orgKeys$(e.userId).pipe((0,OG.j)(e=>!e),(0,oa.v)(e=>!!e),(0,l.T)(t=>{const n=e.organizationId,r=t[n];return{organizationId:n,encryptor:new BG(n,this.encryptService,r,i)}}),(0,UG.O)())),(0,MG.Z)(),(0,vm.Q)(xm(t)))}));return n}}class GG{}const LG=Object.freeze({forwarder:"forwarder"}),zG=Object.freeze({token:"token",baseUrl:"baseUrl",domain:"domain",prefix:"prefix"}),_G=Object.freeze({default:"default",none:"none",allow:"allow",deny:"deny"});class KG{}class XG{constructor(e,t){this.registry=e,this.providers=t,this.log=t.log({type:"ExtensionService"})}settings(e,t,i){const n=this.registry.extension(e.site,t);n||this.log.panic({site:e.site,vendor:t},"extension not defined");const r=function(e,t){const i=new Ff;return Object.assign(Object.assign({},e.storage),{target:"object",key:`${t.site.id}.${t.product.vendor.id}.${e.storage.key}`,state:fe,classifier:i,format:"classified"})}(e,n),s=i.account$.pipe((0,Gp.t)({bufferSize:1,refCount:!0}));return new ly(r,this.providers,{account$:s})}site(e){return this.registry.build(e)}}const qG=Object.freeze(Object.keys(LG)),WG=Object.freeze(Object.keys(zG)),YG={[LG.forwarder]:{id:LG.forwarder,availableFields:[zG.baseUrl,zG.domain,zG.prefix,zG.token]}},HG=Object.freeze(Object.values(_G));class JG{constructor(e,t){this.site=e,this.extensions=t,Om(this)}}class ZG{constructor(e,t){this.allowedSites=e,this.allowedFields=t,this.allPermission="default",this.siteRegistrations=new Map,this.sitePermissions=new Map,this.vendorRegistrations=new Map,this.vendorPermissions=new Map,this.extensionRegistrations=new Array,this.extensionsBySiteByVendor=new Map,Object.freeze(this.allowedFields),Object.freeze(this.allowedSites)}registerSite(e){if(!this.allowedSites.includes(e.id))return this;const t=e.availableFields.filter(e=>this.allowedFields.includes(e)),i=Om({id:e.id,availableFields:t});return this.siteRegistrations.has(e.id)||this.siteRegistrations.set(e.id,i),this}site(e){return this.siteRegistrations.get(e)}sites(){const e=[];for(const[t,i]of this.siteRegistrations.entries()){const n={site:i},r=this.sitePermissions.get(t);r&&(n.permission=r),e.push(n)}return e}registerVendor(e){if(!this.vendorRegistrations.has(e.id)){const t=Om(e);this.vendorRegistrations.set(e.id,t)}return this}vendor(e){return this.vendorRegistrations.get(e)}vendors(){const e=[];for(const[t,i]of this.vendorRegistrations.entries()){const n={vendor:i},r=this.vendorPermissions.get(t);r&&(n.permission=r),e.push(n)}return e}setPermission(e,t){if(!HG.includes(t))throw new Error(`invalid extension permission: ${t}`);if("all"in e&&e.all)this.allPermission=t;else if("vendor"in e)this.vendorPermissions.set(e.vendor,t);else{if(!("site"in e))throw new Error(`Unrecognized extension set received: ${JSON.stringify(e)}.`);this.allowedSites.includes(e.site)&&this.sitePermissions.set(e.site,t)}return this}permission(e){return"all"in e&&e.all?this.allPermission:"vendor"in e?this.vendorPermissions.get(e.vendor):"site"in e?this.sitePermissions.get(e.site):void 0}permissions(){const e=[];e.push({set:{all:!0},permission:this.allPermission});for(const[t,i]of this.sitePermissions.entries())e.push({set:{site:t},permission:i});for(const[t,i]of this.vendorPermissions.entries())e.push({set:{vendor:t},permission:i});return e}registerExtension(e){var t;const i=this.siteRegistrations.get(e.site.id),n=this.vendorRegistrations.get(e.product.vendor.id);if(!i||!n)return this;const r=null!==(t=this.extensionsBySiteByVendor.get(e.site.id))&&void 0!==t?t:new Map;if(r.has(e.product.vendor.id))return this;const s={vendor:n};e.product.name&&(s.name=e.product.name);const o=Object.freeze({site:i,product:Object.freeze(s),host:Object.freeze(Object.assign({},e.host)),requestedFields:Object.freeze([...e.requestedFields])}),a=this.extensionRegistrations.push(o)-1;return r.set(n.id,a),this.extensionsBySiteByVendor.set(i.id,r),this}extension(e,t){var i,n;const r=null!==(n=null===(i=this.extensionsBySiteByVendor.get(e))||void 0===i?void 0:i.get(t))&&void 0!==n?n:-1;return r<0?void 0:this.extensionRegistrations[r]}getPermissions(e,t){return[this.sitePermissions.get(e),this.vendorPermissions.get(t),this.allPermission].filter(e=>!!e)}extensions(){const e=[];for(const t of this.extensionRegistrations){const i=this.getPermissions(t.site.id,t.product.vendor.id);e.push({extension:t,permissions:i})}return e}build(e){var t,i;const n=this.siteRegistrations.get(e);if(!n)return;if("deny"===this.allPermission)return new JG(n,new Map);const r=new Map,s=null!==(i=null===(t=this.extensionsBySiteByVendor.get(e))||void 0===t?void 0:t.entries())&&void 0!==i?i:[];for(const[t,i]of s){const n=QG(this.getPermissions(e,t),this.extensionRegistrations[i]);n&&r.set(t,n)}return new JG(n,r)}}function QG(e,t){if(!e.includes("deny")){if(e.includes("allow"))return t;if(!e.includes("none")){if(e.includes("default"))return t;throw new Error("failed to recognize any permissions")}}}const eL={id:Pf.addyio,name:"Addy.io"},tL=[{site:YG.forwarder,product:{vendor:eL},host:{authorization:"bearer",selfHost:"maybe",baseUrl:"https://app.addy.io"},requestedFields:[zG.token,zG.baseUrl,zG.domain]}],iL=Object.freeze({id:Pf.bitwarden,name:"Bitwarden"}),nL={id:Pf.duckduckgo,name:"DuckDuckGo"},rL=[{site:YG.forwarder,product:{vendor:nL},host:{authorization:"bearer",selfHost:"never",baseUrl:"https://quack.duckduckgo.com/api"},requestedFields:[zG.token]}],sL={id:Pf.fastmail,name:"Fastmail"},oL=[{site:YG.forwarder,product:{vendor:sL},host:{authorization:"bearer",selfHost:"maybe",baseUrl:"https://api.fastmail.com"},requestedFields:[zG.token]}],aL={id:Pf.forwardemail,name:"Forward Email"},lL=[{site:YG.forwarder,product:{vendor:aL},host:{authorization:"basic-username",selfHost:"never",baseUrl:"https://api.forwardemail.net"},requestedFields:[zG.domain,zG.token]}],cL={id:Pf.mozilla,name:"Mozilla"},uL=[{site:YG.forwarder,product:{vendor:cL,name:"Firefox Relay"},host:{authorization:"token",selfHost:"never",baseUrl:"https://relay.firefox.com/api"},requestedFields:[zG.token]}],dL={id:Pf.simplelogin,name:"SimpleLogin"},hL=[{site:YG.forwarder,product:{vendor:dL},host:{authentication:!0,selfHost:"maybe",baseUrl:"https://app.simplelogin.io"},requestedFields:[zG.baseUrl,zG.token,zG.domain]}],pL=Om([eL,iL,nL,sL,aL,cL,dL]),vL=Om([tL,rL,oL,lL,uL,hL].flat());const fL=new vc("Randomizer"),mL=new vc("CredentialGeneratorProviders"),gL=new vc("SystemServices");class yL{constructor(){}}function bL(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"tools-password-generator",2),Fl.bIt("onGenerated",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.onCredentialGenerated(t))})("onAlgorithm",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.onAlgorithmSelected(t))}),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.Y8G("disableMargin",e.disableMargin)}}function wL(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"tools-username-generator",3),Fl.bIt("onGenerated",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.onCredentialGenerated(t))})("onAlgorithm",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.onAlgorithmSelected(t))}),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.Y8G("website",e.uri)("disableMargin",e.disableMargin)}}yL.ɵfac=function(e){return new(e||yL)},yL.ɵmod=Fl.$C({type:yL}),yL.ɵinj=a.G2t({providers:[{provide:fL,useFactory:function(){return new lm},deps:[]},{provide:GG,useClass:jG,deps:[$G,Bp]},{provide:KG,useFactory:()=>{const e=new ZG(qG,WG);e.registerSite(YG[LG.forwarder]);for(const t of pL)e.registerVendor(t);for(const t of vL)e.registerExtension(t);return e.setPermission({all:!0},"default"),e},deps:[]},{provide:gL,useFactory:(e,t,i,n,r,s,o)=>{let a;a=s.isDev()?sj(r,[]):rj;return{policy:i,extension:new XG(n,{encryptor:e,state:t,log:a,now:Date.now}),log:a,configService:o}},deps:[GG,u,Jb,KG,Za,Hb,Kb]},{provide:mL,useFactory:(e,t,i,n,r,s)=>{const o={encryptor:i,state:n,log:e.log,now:Date.now},a=(0,$d.H)(e.configService.getFeatureFlag(Wv.UseSdkPasswordGenerators));let l=!1;a.pipe((0,_o.s)(1)).subscribe(e=>l=e);const c=new uy(o,e,Object.values(Yg)),u=l?e.sdk:void 0,d=new dy(o,e.policy),h={randomizer:t,client:new wb(s,r),i18nService:r,sdk:u,now:Date.now};return{userState:{encryptor:i,state:n,log:e.log,now:Date.now},generator:h,profile:d,metadata:c}},deps:[gL,fL,GG,u,Ul,eI]},{provide:class{},useFactory:(e,t)=>Object.freeze({encryptor:e,state:t,log:rj,now:Date.now}),deps:[GG,u]},{provide:yf,useClass:class{constructor(e,t){this.provide=e,this.system=t,this.log=t.log({type:"DefaultCredentialGeneratorService"})}generate$(e){const t=e.on$.pipe((0,Gp.t)({refCount:!0,bufferSize:1})),i=e.account$.pipe((0,Gp.t)({refCount:!0,bufferSize:1})),n=t.pipe((0,go.n)(e=>Qg(e)?(0,Go.of)(e.algorithm):ey(e)?this.provide.metadata.preference$(e.type,{account$:i}).pipe((0,dm.$)()):void this.log.panic(e,"algorithm or category required")),(0,Eo.p)(e=>!!e),$m(e=>this.provide.metadata.metadata(e),{size:10}),(0,Gp.t)({refCount:!0,bufferSize:1})),r=(0,hm.y)(t,n).pipe((0,l.T)(([e,t])=>{var i;return[Object.assign(Object.assign({},e),{profile:null!==(i=e.profile)&&void 0!==i?i:Nm.account}),t]}),$m(([e,t])=>{const[n,r]=[e.profile,t.id],s=this.settings(t,{account$:i},n).pipe((0,Oo.M)(()=>this.log.debug({algorithm:r,profile:n},"settings update received")),(0,Fo.u)({connector:()=>new Ro.m(1,ty),resetOnRefCountZero:()=>(0,xo.O)(ty)}),(0,Oo.M)({subscribe:()=>this.log.debug({algorithm:r,profile:n},"settings hot"),complete:()=>this.log.debug({algorithm:r,profile:n},"settings cold")}),(0,dm.$)());return this.log.debug({algorithm:r,profile:n},"settings cached"),s},{key:([e,t])=>`${t.id}:${e.profile}`}),(0,pm.w)()),s=n.pipe($m(e=>{const t=e.engine.create(this.provide.generator);return this.log.debug({algorithm:e.id},"engine cached"),t},{size:10}));return(0,hm.y)([t,r,s]).pipe((0,Oo.M)(([e])=>this.log.debug(e,"generating credential")),(0,To.H)(([e,t,i])=>i.generate(e,t)),(0,vm.Q)(xm([r])))}algorithms$(e,t){return this.provide.metadata.algorithms$({type:e},t).pipe((0,l.T)(e=>e.map(e=>this.algorithm(e))))}algorithms(e){return(Array.isArray(e)?e:[e]).flatMap(e=>this.provide.metadata.algorithms({type:e})).map(e=>this.algorithm(e))}algorithm(e){const t=this.provide.metadata.metadata(e);return t||this.log.panic({algorithm:e},"invalid credential algorithm"),t}forwarder(e){const t=this.provide.metadata.metadata({forwarder:e});return t||this.log.panic({algorithm:e},"invalid vendor"),t}preferences(e){return this.provide.metadata.preferences(e)}settings(e,t,i=Nm.account){const n=e.profiles[i];let r;if(n||this.log.panic({algorithm:e.id,profile:i},"failed to load settings; profile metadata not found"),"extension"===(s=n).type&&"forwarder"===s.site){const s=function(e){if(Xg(e))return e.forwarder}(e.id);s||this.log.panic({algorithm:e.id,profile:i},"failed to load extension profile; vendor not specified"),this.log.info({profile:i,vendor:s,site:n.site},"loading extension profile"),r=this.system.extension.settings(n,s,t)}else this.log.info({profile:i,algorithm:e.id},"loading generator profile"),r=this.provide.profile.settings(n,t);var s;return r}policy$(e,t,i=Nm.account){const n=e.profiles[i];return n||this.log.panic({algorithm:e.id,profile:i},"failed to load policy; profile metadata not found"),this.provide.profile.constraints$(n,t)}},deps:[mL,gL]}],imports:[sf]});class SL{constructor(){this.uri="",this.type="password",this.disableMargin=!1,this.algorithmSelected=new Fl.bkB,this.valueGenerated=new Fl.bkB,this.onAlgorithmSelected=e=>{this.algorithmSelected.emit(e)},this.onCredentialGenerated=e=>{this.valueGenerated.emit(e.credential)}}}SL.ɵfac=function(e){return new(e||SL)},SL.ɵcmp=Fl.VBU({type:SL,selectors:[["vault-cipher-form-generator"]],inputs:{uri:"uri",type:"type",disableMargin:[2,"disableMargin","disableMargin",$x.he]},outputs:{algorithmSelected:"algorithmSelected",valueGenerated:"valueGenerated"},decls:2,vars:2,consts:[[3,"disableMargin","onGenerated","onAlgorithm",4,"ngIf"],[3,"website","disableMargin","onGenerated","onAlgorithm",4,"ngIf"],[3,"onGenerated","onAlgorithm","disableMargin"],[3,"onGenerated","onAlgorithm","website","disableMargin"]],template:function(e,t){1&e&&Fl.DNE(0,bL,1,1,"tools-password-generator",0)(1,wL,1,2,"tools-username-generator",1),2&e&&(Fl.Y8G("ngIf","password"===t.type),Fl.R7$(),Fl.Y8G("ngIf","username"===t.type))},dependencies:[kl.MD,kl.bT,EG,wG,DG],encapsulation:2});var kL=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function IL(e,t){if(1&e&&(Fl.j41(0,"li")(1,"p"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.SpI(" ",Fl.brH(3,1,"bulkCollectionAssignmentWarning",e.totalItemCount,e.readonlyItemCount)," ")}}function CL(e,t){if(1&e&&(Fl.j41(0,"li")(1,"p"),Fl.EFF(2),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.SpI(" ",e.transferWarningText(e.orgName,e.personalItemsCount)," ")}}function TL(e,t){if(1&e&&Fl.nrm(0,"bit-option",11),2&e){const e=t.$implicit;Fl.Y8G("value",e.id)("label",e.name)}}function PL(e,t){if(1&e&&(Fl.j41(0,"div",4)(1,"bit-form-field",8)(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"bit-select",9),Fl.DNE(6,TL,1,2,"bit-option",10),Fl.nI1(7,"async"),Fl.k0s()()()),2&e){const e=Fl.XpG();Fl.R7$(3),Fl.JRh(Fl.bMT(4,2,"moveToOrganization")),Fl.R7$(3),Fl.Y8G("ngForOf",Fl.bMT(7,4,e.organizations$))}}function FL(e,t){if(1&e&&(Fl.j41(0,"bit-hint",12),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.SpI(" ",Fl.i5U(2,1,"cannotRemoveViewOnlyCollections",e.readOnlyCollectionNames.join(", "))," ")}}const RL="saved",xL="canceled",AL="MyVault";class DL{get selectedOrgId(){return this.formGroup.getRawValue().selectedOrg||this.params.organizationId}constructor(e,t,i,n,r,s,o){this.cipherService=e,this.i18nService=t,this.organizationService=i,this.collectionService=n,this.formBuilder=r,this.toastService=s,this.accountService=o,this.editableItemCountChange=new Fl.bkB,this.onCollectionAssign=new Fl.bkB,this.formGroup=this.formBuilder.group({selectedOrg:[null],collections:[[],[Il.k0.required]]}),this.readOnlyCollectionNames=[],this.availableCollections=[],this.showOrgSelector=!1,this.organizations$=this.accountService.activeAccount$.pipe((0,go.n)(e=>this.organizationService.organizations$(null==e?void 0:e.id).pipe((0,l.T)(e=>e.filter(e=>e.enabled&&e.status===rp.Confirmed).sort((e,t)=>e.name.localeCompare(t.name))),(0,Oo.M)(e=>{e.length>0&&this.showOrgSelector&&setTimeout(()=>{this.formGroup.patchValue({selectedOrg:e[0].id}),this.setFormValidators(),1===e.length&&this.formGroup.controls.selectedOrg.disable()})})))),this.transferWarningText=(e,t)=>{const i=!!e;return t>1&&i?this.i18nService.t("personalItemsWithOrgTransferWarningPlural",t,e):t>1&&!i?this.i18nService.t("personalItemsTransferWarningPlural",t):1===t&&i?this.i18nService.t("personalItemWithOrgTransferWarningSingular",e):this.i18nService.t("personalItemTransferWarningSingular")},this.editableItems=[],this.destroy$=new Co.B,this.submit=()=>kL(this,void 0,void 0,function*(){if(this.formGroup.markAllAsTouched(),this.formGroup.invalid)return;const e=this.editableItems.filter(e=>e.organizationId).map(e=>e.id),t=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));if(this.personalItemsCount>0&&(yield this.moveToOrganization(this.selectedOrgId,this.params.ciphers.filter(e=>null==e.organizationId),this.formGroup.controls.collections.value.map(e=>e.id),t)),e.length>0){const i=1===e.length&&0===this.personalItemsCount;yield i?this.updateAssignedCollections(this.editableItems[0],t):this.bulkUpdateCollections(e,t),this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("successfullyAssignedCollections")})}this.onCollectionAssign.emit(RL)}),this.sortItems=(e,t)=>this.i18nService.collator.compare(e.labelName,t.labelName)}ngOnInit(){return kL(this,void 0,void 0,function*(){const e=this.params.ciphers.every(e=>null==e.organizationId);(this.selectedOrgId===AL||e)&&(this.showOrgSelector=!0),yield this.initializeItems(this.selectedOrgId),this.selectedOrgId&&this.selectedOrgId!==AL&&(yield this.handleOrganizationCiphers(this.selectedOrgId)),this.setupFormSubscriptions()})}ngAfterViewInit(){this.bitSubmit.loading$.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{this.submitBtn&&this.submitBtn.loading.set(e)}),this.bitSubmit.disabled$.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{this.submitBtn&&this.submitBtn.disabled.set(e)})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}selectCollections(e){const t=[...this.formGroup.controls.collections.value,...e].sort(this.sortItems);this.formGroup.patchValue({collections:t})}handleOrganizationCiphers(e){return kL(this,void 0,void 0,function*(){if(0==this.editableItemCount)return this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("nothingSelected")}),void this.onCollectionAssign.emit(xL);const t=yield(0,bo._)(iv(this.accountService.activeAccount$)),i=yield(0,bo._)(this.organizationService.organizations$(t).pipe(qF(e)));yield this.setReadOnlyCollectionNames();const n=this.canAccessDefaultCollection(this.params.availableCollections);this.availableCollections=this.params.availableCollections.filter(e=>n?e.canEditItems(i):e.canEditItems(i)&&e.type!==yR).map(e=>({icon:e.type===yR?"bwi-user":"bwi-collection-shared",id:e.id,labelName:e.name,listName:e.name})),this.selectCollectionsAssignedToSingleCipher(),this.params.activeCollection&&this.selectCollections([{icon:"bwi-collection-shared",id:this.params.activeCollection.id,labelName:this.params.activeCollection.name,listName:this.params.activeCollection.name}])})}selectCollectionsAssignedToSingleCipher(){if(1!==this.params.ciphers.length)return;const e=this.params.ciphers[0].collectionIds,t=this.availableCollections.filter(t=>{var i;return e.includes(t.id)&&t.id!==(null===(i=this.params.activeCollection)||void 0===i?void 0:i.id)}).map(e=>({icon:e.icon,id:e.id,labelName:e.labelName,listName:e.listName}));t.length>0&&this.selectCollections(t)}initializeItems(e){return kL(this,void 0,void 0,function*(){if(this.totalItemCount=this.params.ciphers.length,!e||e===AL)return this.editableItems=this.params.ciphers,this.editableItemCount=this.params.ciphers.length,this.personalItemsCount=this.params.ciphers.length,void this.editableItemCountChange.emit(this.editableItemCount);const t=yield(0,bo._)(iv(this.accountService.activeAccount$)),i=yield(0,bo._)(this.organizationService.organizations$(t).pipe(qF(e)));this.orgName=i.name,this.editableItems=i.canEditAllCiphers?this.params.ciphers:this.params.ciphers.filter(e=>e.edit),this.editableItemCount=this.editableItems.length,this.editableItemCountChange.emit(this.editableItemCount),this.personalItemsCount=this.params.ciphers.filter(e=>null==e.organizationId).length,this.readonlyItemCount=this.totalItemCount-this.editableItemCount})}setFormValidators(){const e=this.formGroup.get("selectedOrg");null==e||e.setValidators([Il.k0.required]),null==e||e.updateValueAndValidity()}setupFormSubscriptions(){this.formGroup.controls.selectedOrg.valueChanges.pipe((0,Oo.M)(()=>{this.formGroup.controls.collections.setValue([],{emitEvent:!1})}),(0,go.n)(e=>this.getCollectionsForOrganization(e)),(0,vm.Q)(this.destroy$)).subscribe(e=>{this.availableCollections=e.map(e=>({icon:e.type===yR?"bwi-user":"bwi-collection-shared",id:e.id,labelName:e.name,listName:e.name}))})}getCollectionsForOrganization(e){return this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>(0,jo.z)([this.collectionService.decryptedCollections$(e),this.organizationService.organizations$(e)])),(0,l.T)(([t,i])=>{const n=i.find(t=>t.id===e);this.orgName=n.name;const r=t.filter(t=>t.organizationId===e),s=this.canAccessDefaultCollection(t);return r.filter(e=>s?!e.readOnly:!e.readOnly&&e.type!==yR)}),(0,Gp.t)({refCount:!0,bufferSize:1}))}moveToOrganization(e,t,i,n){return kL(this,void 0,void 0,function*(){var r;yield this.cipherService.shareManyWithServer(t,e,i,n),this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t(1===t.length?"itemMovedToOrg":"itemsMovedToOrg",null!==(r=this.orgName)&&void 0!==r?r:this.i18nService.t("organization"))})})}bulkUpdateCollections(e,t){return kL(this,void 0,void 0,function*(){this.formGroup.controls.collections.value.length>0&&(yield this.cipherService.bulkUpdateCollectionsWithServer(this.selectedOrgId,t,e,this.formGroup.controls.collections.value.map(e=>e.id),!1)),null!=this.params.activeCollection&&null==this.formGroup.controls.collections.value.find(e=>e.id===this.params.activeCollection.id)&&(yield this.cipherService.bulkUpdateCollectionsWithServer(this.selectedOrgId,t,e,[this.params.activeCollection.id],!0))})}updateAssignedCollections(e,t){return kL(this,void 0,void 0,function*(){const{collections:i}=this.formGroup.getRawValue();e.collectionIds=i.map(e=>e.id);const{cipher:n}=yield this.cipherService.encrypt(e,t);this.params.isSingleCipherAdmin?yield this.cipherService.saveCollectionsWithServerAdmin(n):yield this.cipherService.saveCollectionsWithServer(n,t)})}setReadOnlyCollectionNames(){return kL(this,void 0,void 0,function*(){const{availableCollections:e,ciphers:t}=this.params,i=yield(0,bo._)(this.organizations$.pipe((0,l.T)(e=>e.find(e=>e.id===this.selectedOrgId))));this.readOnlyCollectionNames=e.filter(e=>e.readOnly&&t.some(t=>t.collectionIds.includes(e.id))&&!e.canEditItems(i)).map(e=>e.name)})}canAccessDefaultCollection(e){const t=Object.fromEntries(e.map(e=>[e.id,e])),i=this.params.ciphers.every(e=>!e.collectionIds.length||e.collectionIds.some(e=>{var i;return(null===(i=t[e])||void 0===i?void 0:i.type)===yR}));return i}}function EL(e,t){if(1&e&&(Fl.j41(0,"bit-item")(1,"div",3),Fl.nrm(2,"bit-color-password",4),Fl.j41(3,"div",5),Fl.EFF(4),Fl.nI1(5,"date"),Fl.k0s()(),Fl.qex(6,6),Fl.j41(7,"bit-item-action"),Fl.nrm(8,"button",7),Fl.nI1(9,"i18n"),Fl.nI1(10,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e){const e=t.$implicit;Fl.R7$(2),Fl.Y8G("password",e.password)("showCount",!1),Fl.R7$(2),Fl.JRh(Fl.i5U(5,6,e.lastUsedDate,"medium")),Fl.R7$(4),Fl.Y8G("label",Fl.bMT(9,9,"copyPassword"))("appCopyClick",e.password)("valueLabel",Fl.bMT(10,11,"password"))}}function $L(e,t){if(1&e&&(Fl.j41(0,"div"),Fl.DNE(1,EL,11,13,"bit-item",2),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("ngForOf",e.history)}}function OL(e,t){1&e&&(Fl.j41(0,"div",8)(1,"p"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()()),2&e&&(Fl.R7$(2),Fl.JRh(Fl.bMT(3,1,"noPasswordsInList")))}DL.ɵfac=function(e){return new(e||DL)(Fl.rXU(_b),Fl.rXU(Ul),Fl.rXU(WF),Fl.rXU(uR),Fl.rXU(Il.ok),Fl.rXU(qb),Fl.rXU(Zk))},DL.ɵcmp=Fl.VBU({type:DL,selectors:[["assign-collections"]],viewQuery:function(e,t){if(1&e&&Fl.GBs(Md,5),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.bitSubmit=e.first)}},inputs:{params:"params",submitBtn:"submitBtn"},outputs:{editableItemCountChange:"editableItemCountChange",onCollectionAssign:"onCollectionAssign"},decls:15,vars:13,consts:[["id","assign_collections_form",3,"formGroup","bitSubmit"],[1,"tw-list-disc","tw-pl-5","tw-space-y-2","tw-break-words"],[4,"ngIf"],["class","tw-flex",4,"ngIf"],[1,"tw-flex"],["disableMargin","",1,"tw-grow","tw-max-w-full"],["formControlName","collections",1,"tw-w-full",3,"baseItems"],["data-testid","view-only-hint",4,"ngIf"],[1,"tw-grow","tw-max-w-full"],["formControlName","selectedOrg"],["icon","bwi-business",3,"value","label",4,"ngFor","ngForOf"],["icon","bwi-business",3,"value","label"],["data-testid","view-only-hint"]],template:function(e,t){1&e&&(Fl.j41(0,"form",0)(1,"p"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"ul",1),Fl.DNE(5,IL,4,5,"li",2)(6,CL,3,1,"li",2),Fl.k0s(),Fl.DNE(7,PL,8,6,"div",3),Fl.j41(8,"div",4)(9,"bit-form-field",5)(10,"bit-label"),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s(),Fl.nrm(13,"bit-multi-select",6),Fl.DNE(14,FL,3,4,"bit-hint",7),Fl.k0s()()()),2&e&&(Fl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,9,1===t.personalItemsCount?"bulkCollectionAssignmentDialogDescriptionSingular":"bulkCollectionAssignmentDialogDescriptionPlural")," "),Fl.R7$(3),Fl.Y8G("ngIf",t.readonlyItemCount>0),Fl.R7$(),Fl.Y8G("ngIf",t.personalItemsCount>0),Fl.R7$(),Fl.Y8G("ngIf",t.showOrgSelector),Fl.R7$(4),Fl.JRh(Fl.bMT(12,11,"selectCollectionsToAssign")),Fl.R7$(2),Fl.Y8G("baseItems",t.availableCollections),Fl.R7$(),Fl.Y8G("ngIf",t.readOnlyCollectionNames.length>0))},dependencies:[kl.MD,kl.Sq,kl.bT,sf,Gu,Ac,hu,cu,ju,pc,Md,uu,Wu,qu,zu,Il.X1,Il.qT,Il.BC,Il.cb,Il.j4,Il.JD,id,Fh,kl.Jj,rf],encapsulation:2});class UL{constructor(){this.history=[]}ngOnInit(){this.history=null==this.cipher.passwordHistory?[]:this.cipher.passwordHistory}}function ML(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"li",9,0),Fl.bIt("click",function(){a.eBV(e);const t=Fl.sdS(1),i=Fl.XpG();return a.Njj(i.selectText(t))}),Fl.EFF(2),Fl.k0s()}if(2&e){const e=t.$implicit;Fl.R7$(2),Fl.SpI(" ",e," ")}}UL.ɵfac=function(e){return new(e||UL)},UL.ɵcmp=Fl.VBU({type:UL,selectors:[["vault-password-history-view"]],inputs:{cipher:"cipher"},decls:2,vars:2,consts:[[4,"ngIf"],["class","tw-absolute tw-top-1/2 tw-left-1/2 tw-transform tw--translate-x-1/2 tw--translate-y-1/2 tw-text-center",4,"ngIf"],[4,"ngFor","ngForOf"],[1,"tw-pl-3","tw-py-2"],[1,"tw-text-base",3,"password","showCount"],[1,"tw-text-sm","tw-text-muted"],["slot","end"],["type","button","bitIconButton","bwi-clone","appStopClick","","showToast","",3,"label","appCopyClick","valueLabel"],[1,"tw-absolute","tw-top-1/2","tw-left-1/2","tw-transform","tw--translate-x-1/2","tw--translate-y-1/2","tw-text-center"]],template:function(e,t){1&e&&Fl.DNE(0,$L,2,1,"div",0)(1,OL,4,3,"div",1),2&e&&(Fl.Y8G("ngIf",t.history&&t.history.length),Fl.R7$(),Fl.Y8G("ngIf",!(null!=t.history&&t.history.length)))},dependencies:[kl.MD,kl.Sq,kl.bT,VP,GP,BP,XO,ZO,Ql,Zl,sf,IP,rO,kl.vh,rf],encapsulation:2});class NL{constructor(){this.dialogRef=(0,a.WQX)(nh),this.params=(0,a.WQX)(pd.Qs),this.platformUtilsService=(0,a.WQX)(Hb)}selectText(e){const t=window.getSelection();if(null==t)return;t.removeAllRanges();const i=document.createRange();i.selectNodeContents(e),t.addRange(i)}openContactSupport(e){e.preventDefault(),this.platformUtilsService.launchUri("https://bitwarden.com/contact")}static open(e,t){return e.open(NL,{data:t,positionStrategy:new sh})}}NL.ɵfac=function(e){return new(e||NL)},NL.ɵcmp=Fl.VBU({type:NL,selectors:[["vault-decryption-failure-dialog"]],decls:20,vars:16,consts:[["listItem",""],["bitDialogIcon","","aria-hidden","true",1,"bwi","tw-text-3xl","bwi-exclamation-triangle","tw-text-warning"],["bitDialogTitle",""],["bitDialogContent",""],["bitLink","","href","#",3,"click"],[1,"tw-list-none","tw-pl-0"],["class","tw-text-code tw-font-mono tw-py-0.5",3,"click",4,"ngFor","ngForOf"],["bitDialogFooter",""],["type","button","bitButton","","buttonType","primary",3,"click"],[1,"tw-text-code","tw-font-mono","tw-py-0.5",3,"click"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-simple-dialog"),Fl.nrm(1,"i",1),Fl.j41(2,"span",2),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"div",3)(6,"p"),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.j41(9,"a",4),Fl.bIt("click",function(e){return t.openContactSupport(e)}),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s(),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s(),Fl.j41(14,"ul",5),Fl.DNE(15,ML,3,1,"li",6),Fl.k0s()(),Fl.qex(16,7),Fl.j41(17,"button",8),Fl.bIt("click",function(){return t.dialogRef.close(!1)}),Fl.EFF(18),Fl.nI1(19,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e&&(Fl.R7$(3),Fl.JRh(Fl.bMT(4,6,"decryptionError")),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(8,8,"couldNotDecryptVaultItemsBelow")," "),Fl.R7$(3),Fl.JRh(Fl.bMT(11,10,"contactCSToAvoidDataLossPart1")),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(13,12,"contactCSToAvoidDataLossPart2")," "),Fl.R7$(3),Fl.Y8G("ngForOf",t.params.cipherIds),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(19,14,"close")," "))},dependencies:[Fh,Wd,Yd,kl.MD,kl.Sq,tc,sf,pc,id,td,uw,rf],encapsulation:2});class VL{constructor(e,t){this.params=e,this.dialogRef=t,this.cipher=e.cipher}close(){this.dialogRef.close()}}VL.ɵfac=function(e){return new(e||VL)(Fl.rXU(pd.Qs),Fl.rXU(nh))},VL.ɵcmp=Fl.VBU({type:VL,selectors:[["app-vault-password-history"]],decls:10,vars:7,consts:[["background","alt"],["bitDialogTitle",""],["bitDialogContent",""],[3,"cipher"],["bitDialogFooter",""],["bitButton","","buttonType","primary","type","button",3,"click"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-dialog",0)(1,"span",1),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.qex(4,2),Fl.nrm(5,"vault-password-history-view",3),Fl.bVm(),Fl.qex(6,4),Fl.j41(7,"button",5),Fl.bIt("click",function(){return t.close()}),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,3,"passwordHistory")," "),Fl.R7$(3),Fl.Y8G("cipher",t.cipher),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(9,5,"close")," "))},dependencies:[id,td,kl.MD,pc,Fh,Ph,UL,sc],encapsulation:2});class BL{}var jL=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const GL=["submitBtn"];function LL(e,t){if(1&e&&(Fl.nrm(0,"button",10),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG();Fl.Y8G("label",Fl.bMT(1,2,"deleteFolder"))("bitAction",e.deleteFolder)}}const zL="created",_L="deleted";class KL{constructor(e,t,i,n,r,s,o,c,u,d,h){this.formBuilder=e,this.folderService=t,this.folderApiService=i,this.accountService=n,this.keyService=r,this.toastService=s,this.i18nService=o,this.logService=c,this.dialogService=u,this.dialogRef=d,this.data=h,this.folder=new SU,this.variant="add",this.folderForm=this.formBuilder.group({name:["",Il.k0.required]}),this.activeUserId$=this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)),this.destroyRef=(0,a.WQX)(a.abz),this.submit=()=>jL(this,void 0,void 0,function*(){var e;if(!this.folderForm.invalid){this.folder.name=null!==(e=this.folderForm.controls.name.value)&&void 0!==e?e:"";try{const e=yield(0,bo._)(this.activeUserId$),t=yield this.keyService.getUserKey(e),i=yield this.folderService.encrypt(this.folder,t);yield this.folderApiService.save(i,e),this.toastService.showToast({variant:"success",title:"",message:this.i18nService.t("editedFolder")}),this.close(zL)}catch(e){this.logService.error(e)}}}),this.deleteFolder=()=>jL(this,void 0,void 0,function*(){if(yield this.dialogService.openSimpleDialog({title:{key:"deleteFolder"},content:{key:"deleteFolderPermanently"},type:"warning"})){try{const e=yield(0,bo._)(this.activeUserId$);yield this.folderApiService.delete(this.folder.id,e),this.toastService.showToast({variant:"success",title:"",message:this.i18nService.t("deletedFolder")})}catch(e){this.logService.error(e)}this.close(_L)}})}ngOnInit(){var e;(null===(e=this.data)||void 0===e?void 0:e.editFolderConfig)?(this.variant="edit",this.folderForm.controls.name.setValue(this.data.editFolderConfig.folder.name),this.folder=this.data.editFolderConfig.folder):this.folder=new SU}ngAfterViewInit(){var e;null===(e=this.bitSubmit)||void 0===e||e.loading$.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.submitBtn&&this.submitBtn.loading.set(e)})}close(e){this.dialogRef.close(e)}static open(e,t){return e.open(KL,{data:t})}}KL.ɵfac=function(e){return new(e||KL)(Fl.rXU(Il.ok),Fl.rXU(UM),Fl.rXU(BL),Fl.rXU(Zk),Fl.rXU(Bp),Fl.rXU(qb),Fl.rXU(Ul),Fl.rXU(Za),Fl.rXU(lh),Fl.rXU(nh),Fl.rXU(pd.Qs))},KL.ɵcmp=Fl.VBU({type:KL,selectors:[["vault-add-edit-folder-dialog"]],viewQuery:function(e,t){if(1&e&&(Fl.GBs(Md,5),Fl.GBs(GL,5)),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.bitSubmit=e.first),Fl.mGM(e=Fl.lsd())&&(t.submitBtn=e.first)}},decls:23,vars:19,consts:[["submitBtn",""],["id","add-edit-folder",3,"formGroup","bitSubmit"],["bitDialogTitle",""],["bitDialogContent",""],["disableMargin",""],["bitInput","","id","folderName","formControlName","name","type","text"],["bitDialogFooter",""],["bitButton","","buttonType","primary","type","submit","form","add-edit-folder",3,"disabled"],["bitButton","","bitDialogClose","","buttonType","secondary","type","button"],["type","button","buttonType","danger","class","tw-ml-auto","bitIconButton","bwi-trash",3,"label","bitAction",4,"ngIf"],["type","button","buttonType","danger","bitIconButton","bwi-trash",1,"tw-ml-auto",3,"label","bitAction"]],template:function(e,t){1&e&&(Fl.j41(0,"form",1)(1,"bit-dialog")(2,"span",2),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"div",3)(6,"bit-form-field",4)(7,"bit-label"),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.nrm(10,"input",5),Fl.j41(11,"bit-hint"),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s()()(),Fl.qex(14,6),Fl.j41(15,"button",7,0),Fl.EFF(17),Fl.nI1(18,"i18n"),Fl.k0s(),Fl.j41(19,"button",8),Fl.EFF(20),Fl.nI1(21,"i18n"),Fl.k0s(),Fl.DNE(22,LL,2,4,"button",9),Fl.bVm(),Fl.k0s()()),2&e&&(Fl.Y8G("formGroup",t.folderForm)("bitSubmit",t.submit),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,9,"add"===t.variant?"newFolder":"editFolder")," "),Fl.R7$(5),Fl.JRh(Fl.bMT(9,11,"folderName")),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(13,13,"folderHintText")," "),Fl.R7$(3),Fl.Y8G("disabled",t.folderForm.invalid),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(18,15,"save")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(21,17,"cancel")," "),Fl.R7$(2),Fl.Y8G("ngIf","edit"===t.variant))},dependencies:[kl.MD,kl.bT,sf,Fh,ch,Ph,id,td,Gu,Ac,hu,fu,ju,Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,Ql,Zl,pc,Bd,Md,rf],encapsulation:2});const XL=e=>({"tw-px-4 tw-py-5":e});function qL(e,t){if(1&e&&(Fl.j41(0,"div",0),Fl.SdG(1),Fl.k0s()),2&e){const e=Fl.XpG();Fl.Y8G("ngClass",Fl.eq3(2,XL,!e.disablePadding)),Fl.BMQ("tabIndex",e.noFocusableChildren?0:void 0)}}class WL{get content(){return this._contentPortal}constructor(e){this.viewContainerRef=e,this.disablePadding=!1,this._contentPortal=null}ngOnInit(){this._contentPortal=new Vl.VA(this.implicitContent,this.viewContainerRef)}}WL.ɵfac=function(e){return new(e||WL)(Fl.rXU(Fl.c1b))},WL.ɵcmp=Fl.VBU({type:WL,selectors:[["vault-carousel-slide"]],viewQuery:function(e,t){if(1&e&&Fl.GBs(Fl.C4Q,7),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.implicitContent=e.first)}},inputs:{label:"label",disablePadding:[2,"disablePadding","disablePadding",o.L39],noFocusableChildren:[2,"noFocusableChildren","noFocusableChildren",$x.he]},ngContentSelectors:["*"],decls:1,vars:0,consts:[["role","tabpanel",3,"ngClass"]],template:function(e,t){1&e&&(Fl.NAR(),Fl.DNE(0,qL,2,4,"ng-template"))},dependencies:[kl.MD,kl.YU],encapsulation:2});var YL=i(58716);const HL=Fw`
<svg class="tw-block" width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" data-testid="inactive-carousel-icon">
<rect class="tw-stroke-current" x="0.5" y="0.5" width="11" height="11" rx="5.5" />
</svg>
`,JL=["btn"];class ZL{constructor(){this.CarouselIcon=HL,this.onClick=new Fl.bkB}focus(){this.button.nativeElement.focus()}get dynamicClasses(){return this.isActive?["[&_rect]:tw-fill-primary-600","tw-text-primary-600"]:["tw-text-muted","[&_rect]:hover:tw-fill-text-muted","focus-visible:tw-text-info-700"]}}function QL(e,t){}ZL.ɵfac=function(e){return new(e||ZL)},ZL.ɵcmp=Fl.VBU({type:ZL,selectors:[["vault-carousel-button"]],viewQuery:function(e,t){if(1&e&&Fl.GBs(JL,7),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.button=e.first)}},inputs:{slide:"slide",isActive:"isActive"},outputs:{onClick:"onClick"},decls:3,vars:5,consts:[["btn",""],["type","button","role","tab",1,"tw-size-6","tw-p-0","tw-flex","tw-items-center","tw-justify-center","tw-border-2","tw-border-solid","tw-rounded-full","tw-transition","tw-bg-transparent","tw-border-transparent","focus-visible:tw-outline-none","focus-visible:tw-border-primary-600",3,"click","ngClass"],[3,"content"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",1,0),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.onClick.emit())}),Fl.nrm(2,"bit-svg",2),Fl.k0s()}2&e&&(Fl.Y8G("ngClass",t.dynamicClasses),Fl.BMQ("aria-selected",t.isActive)("tabindex",t.isActive?0:-1)("aria-label",t.slide.label),Fl.R7$(2),Fl.Y8G("content",t.CarouselIcon))},dependencies:[kl.MD,kl.YU,Yh,BC],encapsulation:2});class ez{}ez.ɵfac=function(e){return new(e||ez)},ez.ɵcmp=Fl.VBU({type:ez,selectors:[["vault-carousel-content"]],inputs:{content:"content"},decls:2,vars:1,consts:[["aria-live","polite","aria-atomic","false",1,"tw-m-auto","tw-text-main"],[3,"cdkPortalOutlet"]],template:function(e,t){1&e&&(Fl.j41(0,"div",0),Fl.DNE(1,QL,0,0,"ng-template",1),Fl.k0s()),2&e&&(Fl.R7$(),Fl.Y8G("cdkPortalOutlet",t.content))},dependencies:[Vl.I3],encapsulation:2});var tz=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const iz=["container"],nz=["carouselButtonWrapper"],rz=["tempSlideContainer"],sz=e=>({minHeight:e});function oz(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"vault-carousel-button",11),Fl.bIt("onClick",function(){const t=a.eBV(e).index,i=Fl.XpG();return a.Njj(i.selectSlide(t))}),Fl.k0s()}if(2&e){const e=t.$implicit,i=t.index,n=Fl.XpG();Fl.Y8G("slide",e)("isActive",i===n.selectedIndex)}}function az(e,t){}function lz(e,t){1&e&&(Fl.j41(0,"div",12,2),Fl.DNE(2,az,0,0,"ng-template",13),Fl.k0s())}class cz{constructor(e,t){this.ngZone=e,this.destroyRef=t,this.changeDetectorRef=(0,a.WQX)(o.gRc),this.label="",this.slideChange=new Fl.bkB,this.selectedIndex=0,this.minHeight=null,this.keyManager=null}selectSlide(e){this.selectedIndex=e,this.slideChange.emit(e)}nextSlide(){this.selectedIndex<this.slides.length-1&&this.selectSlide(this.selectedIndex+1)}prevSlide(){this.selectedIndex>0&&this.selectSlide(this.selectedIndex-1)}ngAfterViewInit(){return tz(this,void 0,void 0,function*(){this.keyManager=new YL.B(this.carouselButtons).withHorizontalOrientation("ltr").withWrap().withHomeAndEnd(),this.keyManager.setFirstItemActive(),this.ngZone.onStable.pipe((0,_o.s)(1),(0,xl.pQ)(this.destroyRef)).subscribe(()=>{this.setMinHeightOfCarousel()})})}setMinHeightOfCarousel(){return tz(this,void 0,void 0,function*(){const e=this.carouselButtonWrapper.nativeElement.offsetHeight,t=this.carouselContainer.nativeElement.offsetWidth,i=this.carouselContainer.nativeElement.offsetHeight;this.tempSlideContainer.nativeElement.style.width=`${t}px`;let n=i-e;for(let e=0;e<this.slides.length;e++)e!==this.selectedIndex&&(this.tempSlideOutlet.attach(this.slides.get(e).content),yield new Promise(requestAnimationFrame),this.tempSlideContainer.nativeElement.offsetHeight>n&&(n=this.tempSlideContainer.nativeElement.offsetHeight),this.tempSlideOutlet.detach());this.minHeight=`${n+e}px`,this.changeDetectorRef.detectChanges()})}}cz.ɵfac=function(e){return new(e||cz)(Fl.rXU(Fl.SKi),Fl.rXU(a.abz))},cz.ɵcmp=Fl.VBU({type:cz,selectors:[["vault-carousel"]],contentQueries:function(e,t,i){if(1&e&&Fl.wni(i,WL,4),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.slides=e)}},viewQuery:function(e,t){if(1&e&&(Fl.GBs(iz,5),Fl.GBs(nz,5),Fl.GBs(rz,5),Fl.GBs(Vl.I3,5),Fl.GBs(ZL,5)),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.carouselContainer=e.first),Fl.mGM(e=Fl.lsd())&&(t.carouselButtonWrapper=e.first),Fl.mGM(e=Fl.lsd())&&(t.tempSlideContainer=e.first),Fl.mGM(e=Fl.lsd())&&(t.tempSlideOutlet=e.first),Fl.mGM(e=Fl.lsd())&&(t.carouselButtons=e)}},inputs:{label:"label"},outputs:{slideChange:"slideChange"},decls:12,vars:17,consts:[["container",""],["carouselButtonWrapper",""],["tempSlideContainer",""],["aria-roledescription","carousel",1,"tw-flex","tw-flex-col",3,"ngStyle"],[3,"content"],[1,"tw-w-full","tw-flex","tw-justify-between","tw-mt-auto","tw-px-4","tw-pb-2","tw-pt-4"],["type","button","bitIconButton","bwi-angle-left","size","small",1,"tw-size-6","tw-p-0","tw-flex","tw-items-center","tw-justify-center",3,"click","disabled","label"],["role","tablist",1,"tw-w-full","tw-flex","tw-gap-2","tw-justify-center","tw-mt-auto",3,"keydown"],[3,"slide","isActive","onClick",4,"ngFor","ngForOf"],["type","button","bitIconButton","bwi-angle-right","size","small",1,"tw-size-6","tw-p-0","tw-flex","tw-items-center","tw-justify-center",3,"click","disabled","label"],["class","tw-absolute tw-invisible",4,"ngIf"],[3,"onClick","slide","isActive"],[1,"tw-absolute","tw-invisible"],["cdkPortalOutlet",""]],template:function(e,t){var i;if(1&e){const e=Fl.RV6();Fl.j41(0,"section",3,0),Fl.nrm(2,"vault-carousel-content",4),Fl.j41(3,"div",5)(4,"button",6),Fl.nI1(5,"i18n"),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.prevSlide())}),Fl.k0s(),Fl.j41(6,"div",7,1),Fl.bIt("keydown",function(i){return a.eBV(e),a.Njj(t.keyManager.onKeydown(i))}),Fl.DNE(8,oz,1,2,"vault-carousel-button",8),Fl.k0s(),Fl.j41(9,"button",9),Fl.nI1(10,"i18n"),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.nextSlide())}),Fl.k0s()(),Fl.DNE(11,lz,3,0,"div",10),Fl.k0s()}if(2&e){let e;Fl.Y8G("ngStyle",Fl.eq3(15,sz,null!==(i=t.minHeight)&&void 0!==i?i:void 0)),Fl.BMQ("aria-label",t.label),Fl.R7$(2),Fl.Y8G("content",null==(e=t.slides.get(t.selectedIndex))?null:e.content),Fl.R7$(2),Fl.Y8G("label",Fl.mNQ(Fl.bMT(5,11,"back")))("disabled",t.selectedIndex<=0),Fl.R7$(4),Fl.Y8G("ngForOf",t.slides),Fl.R7$(),Fl.Y8G("label",Fl.mNQ(Fl.bMT(10,13,"next")))("disabled",t.selectedIndex>=t.slides.length-1),Fl.R7$(2),Fl.Y8G("ngIf",null===t.minHeight)}},dependencies:[Vl.I3,kl.MD,kl.Sq,kl.bT,kl.B3,sf,Ql,Zl,id,ez,ZL,rf],encapsulation:2});class uz{}uz.ɵfac=function(e){return new(e||uz)},uz.ɵmod=Fl.$C({type:uz}),uz.ɵinj=a.G2t({imports:[cz,WL]});const dz=Object.freeze([{type:nx.Login,icon:"bwi-globe",labelKey:"typeLogin"},{type:nx.Card,icon:"bwi-credit-card",labelKey:"typeCard"},{type:nx.Identity,icon:"bwi-id-card",labelKey:"typeIdentity"},{type:nx.SecureNote,icon:"bwi-sticky-note",labelKey:"typeNote"},{type:nx.SshKey,icon:"bwi-key",labelKey:"typeSshKey"}]);function hz(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"div",0),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.closed.emit())}),Fl.SdG(1),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.Y8G("cdkTrapFocusAutoCapture","dialog"===e.ariaRole()),Fl.BMQ("role",e.ariaRole())("aria-label",e.ariaLabel())}}class pz{constructor(){this.templateRef=o.ebz.required(Fl.C4Q),this.closed=new Fl.bkB,this.menuItems=(0,o.tEk)(D$,{descendants:!0}),this.ariaRole=(0,o.hFB)("menu"),this.ariaLabel=(0,o.hFB)()}ngAfterContentInit(){"menu"===this.ariaRole()&&(this.keyManager=new YL.B(this.menuItems()).withWrap().skipPredicate(e=>!!e.disabled))}}pz.ɵfac=function(e){return new(e||pz)},pz.ɵcmp=Fl.VBU({type:pz,selectors:[["bit-menu"]],contentQueries:function(e,t,i){1&e&&Fl.C6U(i,t.menuItems,D$,5),2&e&&Fl.NyB()},viewQuery:function(e,t){1&e&&Fl.wEZ(t.templateRef,Fl.C4Q,5),2&e&&Fl.NyB()},inputs:{ariaRole:[1,"ariaRole"],ariaLabel:[1,"ariaLabel"]},outputs:{closed:"closed"},exportAs:["menuComponent"],ngContentSelectors:["*"],decls:1,vars:0,consts:[["cdkTrapFocus","",1,"tw-flex","tw-shrink-0","tw-flex-col","tw-rounded-lg","tw-border","tw-border-solid","tw-border-secondary-100","tw-bg-background","tw-shadow-md","tw-bg-clip-padding","tw-py-1","tw-overflow-y-auto",3,"click","cdkTrapFocusAutoCapture"]],template:function(e,t){1&e&&(Fl.NAR(),Fl.DNE(0,hz,2,3,"ng-template"))},dependencies:[gl.kB],encapsulation:2});const vz=[{originX:"start",originY:"top",overlayX:"start",overlayY:"top"},{originX:"start",originY:"bottom",overlayX:"start",overlayY:"bottom"},{originX:"end",originY:"top",overlayX:"end",overlayY:"top"},{originX:"end",originY:"bottom",overlayX:"end",overlayY:"bottom"}];class fz{get hasPopup(){var e;return(null===(e=this.menu())||void 0===e?void 0:e.ariaRole())||"menu"}constructor(e,t,i){this.elementRef=e,this.viewContainerRef=t,this.overlay=i,this.isOpen=!1,this.role=(0,o.hFB)("button"),this.menu=o.hFB.required({alias:"bitMenuTriggerFor"}),this.overlayRef=null,this.defaultMenuConfig={panelClass:"bit-menu-panel",hasBackdrop:!0,backdropClass:["cdk-overlay-transparent-backdrop","bit-menu-panel-backdrop"],scrollStrategy:this.overlay.scrollStrategies.reposition(),positionStrategy:this.overlay.position().flexibleConnectedTo(this.elementRef).withPositions([{originX:"start",originY:"bottom",overlayX:"start",overlayY:"top"},{originX:"end",originY:"bottom",overlayX:"end",overlayY:"top"},{originX:"start",originY:"top",overlayX:"start",overlayY:"bottom"},{originX:"end",originY:"top",overlayX:"end",overlayY:"bottom"}]).withLockedPosition(!0).withFlexibleDimensions(!1).withPush(!0)},this.closedEventsSub=null,this.keyDownEventsSub=null,this.menuCloseListenerSub=null}toggleMenu(){this.isOpen?this.destroyMenu():this.openMenu()}toggleMenuOnRightClick(e){e.preventDefault(),this.isOpen?this.updateMenuPosition(e):this.openMenu(e)}ngOnDestroy(){this.disposeAll()}openMenu(e){const t=this.menu();if(null==t)throw new Error("Cannot find bit-menu element");this.isOpen=!0;const i=e?this.overlay.position().flexibleConnectedTo({x:e.clientX,y:e.clientY}).withPositions(vz).withLockedPosition(!1).withFlexibleDimensions(!1).withPush(!0):this.defaultMenuConfig.positionStrategy,n=Object.assign(Object.assign({},this.defaultMenuConfig),{positionStrategy:i,hasBackdrop:!e});this.overlayRef=this.overlay.create(n);const r=new Vl.VA(t.templateRef(),this.viewContainerRef);this.overlayRef.attach(r);const s=!!e;this.setupClosingActions(s),this.setupMenuCloseListener(),t.keyManager&&(t.keyManager.setFirstItemActive(),this.keyDownEventsSub=this.overlayRef.keydownEvents().subscribe(e=>{var t;return null===(t=this.menu().keyManager)||void 0===t?void 0:t.onKeydown(e)}))}updateMenuPosition(e){if(null==this.overlayRef)return;const t=this.overlay.position().flexibleConnectedTo({x:e.clientX,y:e.clientY}).withPositions([{originX:"start",originY:"top",overlayX:"start",overlayY:"top"}]);this.overlayRef.updatePositionStrategy(t)}destroyMenu(){null!=this.overlayRef&&this.isOpen&&(this.isOpen=!1,this.disposeAll(),this.menu().closed.emit())}setupClosingActions(e){if(!this.overlayRef)return;const t=this.overlayRef.keydownEvents().pipe((0,Eo.p)(e=>("menu"===this.menu().ariaRole()?["Escape","Tab"]:["Escape"]).includes(e.key))),i=this.menu().closed,n=this.overlayRef.detachments(),r=e?(0,Po.h)(n,t,i):(0,Po.h)(n,t,this.overlayRef.backdropClick(),i);this.closedEventsSub=r.pipe((0,vm.Q)(this.overlayRef.detachments())).subscribe(e=>{e instanceof KeyboardEvent&&"Escape"===e.key&&!(0,Wc.rp)(e)&&e.preventDefault(),this.elementRef.nativeElement.focus(),this.destroyMenu()})}setupMenuCloseListener(){this.overlayRef&&(this.menuCloseListenerSub=this.overlayRef.outsidePointerEvents().pipe((0,ny.i)(1),(0,vm.Q)(this.overlayRef.detachments())).subscribe(e=>{this.destroyMenu()}))}disposeAll(){var e,t,i,n;null===(e=this.closedEventsSub)||void 0===e||e.unsubscribe(),null===(t=this.keyDownEventsSub)||void 0===t||t.unsubscribe(),null===(i=this.menuCloseListenerSub)||void 0===i||i.unsubscribe(),null===(n=this.overlayRef)||void 0===n||n.dispose()}}fz.ɵfac=function(e){return new(e||fz)(Fl.rXU(Fl.aKT),Fl.rXU(Fl.c1b),Fl.rXU(wl.hJ))},fz.ɵdir=Fl.FsC({type:fz,selectors:[["","bitMenuTriggerFor",""]],hostVars:3,hostBindings:function(e,t){1&e&&Fl.bIt("click",function(){return t.toggleMenu()}),2&e&&Fl.BMQ("role",t.role())("aria-expanded",t.isOpen)("aria-haspopup",t.hasPopup)},inputs:{role:[1,"role"],menu:[1,"bitMenuTriggerFor","menu"]},exportAs:["menuTrigger"]});class mz{}mz.ɵfac=function(e){return new(e||mz)},mz.ɵcmp=Fl.VBU({type:mz,selectors:[["bit-menu-divider"]],decls:1,vars:0,consts:[["role","separator","aria-hidden","true",1,"tw-my-2","tw-border-0","tw-border-t","tw-border-solid","tw-border-t-secondary-100"]],template:function(e,t){1&e&&Fl.Hgh(0,"div",0)},encapsulation:2});const gz=(e,t)=>t.type;function yz(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",7),Fl.bIt("click",function(){const t=a.eBV(e).$implicit,i=Fl.XpG(2);return a.Njj(i.cipherAdded.emit(t.type))}),Fl.nrm(1,"i",8),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()}if(2&e){const e=t.$implicit;Fl.R7$(),Fl.HbH(Fl.VkB("bwi ",e.icon)),Fl.R7$(),Fl.SpI(" ",Fl.bMT(3,4,e.labelKey)," ")}}function bz(e,t){1&e&&Fl.nrm(0,"bit-menu-divider")}function wz(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",7),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.folderAdded.emit())}),Fl.nrm(1,"i",9),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"folder")," "))}function Sz(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",7),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.collectionAdded.emit())}),Fl.nrm(1,"i",10),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"collection")," "))}function kz(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"div")(2,"button",2),Fl.nI1(3,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.handleButtonClick())}),Fl.nrm(4,"i",3),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.j41(7,"bit-menu",4,0),Fl.Z7z(9,yz,4,6,"button",5,gz),Fl.nI1(11,"async"),Fl.DNE(12,bz,1,0,"bit-menu-divider",1)(13,wz,4,3,"button",6)(14,Sz,4,3,"button",6),Fl.k0s()(),Fl.bVm()}if(2&e){const e=Fl.sdS(8),t=Fl.XpG();Fl.R7$(2),Fl.Y8G("bitMenuTriggerFor",t.isOnlyCollectionCreation()?null:e)("appA11yTitle",Fl.bMT(3,6,t.getButtonLabel())),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(6,8,t.getButtonLabel())," "),Fl.R7$(4),Fl.Dyx(Fl.bMT(11,10,t.cipherMenuItems$)),Fl.R7$(3),Fl.Y8G("ngIf",t.canCreateCipher()),Fl.R7$(),Fl.Y8G("ngIf",t.canCreateFolder()),Fl.R7$(),Fl.Y8G("ngIf",t.canCreateCollection())}}class Iz{constructor(e){this.restrictedItemTypesService=e,this.canCreateCipher=(0,o.hFB)(!1),this.canCreateFolder=(0,o.hFB)(!1),this.canCreateCollection=(0,o.hFB)(!1),this.canCreateSshKey=(0,o.hFB)(!1),this.folderAdded=(0,o.CGW)(),this.collectionAdded=(0,o.CGW)(),this.cipherAdded=(0,o.CGW)(),this.cipherMenuItems$=(0,jo.z)([this.restrictedItemTypesService.restricted$,(0,xl.br)(this.canCreateCipher),(0,xl.br)(this.canCreateSshKey)]).pipe((0,l.T)(([e,t,i])=>t?dz.filter(t=>!(!i&&t.type===nx.SshKey)&&!e.some(e=>e.cipherType===t.type)):[]),(0,Gp.t)({bufferSize:1,refCount:!0}))}getButtonLabel(){const e=this.canCreateCipher(),t=this.canCreateFolder(),i=this.canCreateCollection();return e||t||!i?"new":"newCollection"}isOnlyCollectionCreation(){return!this.canCreateCipher()&&!this.canCreateFolder()&&this.canCreateCollection()}handleButtonClick(){this.isOnlyCollectionCreation()&&this.collectionAdded.emit()}}Iz.ɵfac=function(e){return new(e||Iz)(Fl.rXU(r$))},Iz.ɵcmp=Fl.VBU({type:Iz,selectors:[["vault-new-cipher-menu"]],inputs:{canCreateCipher:[1,"canCreateCipher"],canCreateFolder:[1,"canCreateFolder"],canCreateCollection:[1,"canCreateCollection"],canCreateSshKey:[1,"canCreateSshKey"]},outputs:{folderAdded:"folderAdded",collectionAdded:"collectionAdded",cipherAdded:"cipherAdded"},decls:1,vars:1,consts:[["addOptions",""],[4,"ngIf"],["bitButton","","buttonType","primary","type","button","id","newItemDropdown",3,"click","bitMenuTriggerFor","appA11yTitle"],["aria-hidden","true",1,"bwi","bwi-plus","tw-me-2"],["aria-labelledby","newItemDropdown"],["type","button","bitMenuItem",""],["type","button","bitMenuItem","",3,"click",4,"ngIf"],["type","button","bitMenuItem","",3,"click"],["slot","start","aria-hidden","true"],["aria-hidden","true",1,"bwi","bwi-fw","bwi-folder"],["aria-hidden","true",1,"bwi","bwi-fw","bwi-collection-shared"]],template:function(e,t){1&e&&Fl.DNE(0,kz,15,12,"ng-container",1),2&e&&Fl.Y8G("ngIf",t.canCreateCipher()||t.canCreateCollection()||t.canCreateFolder())},dependencies:[id,td,kl.MD,kl.bT,qh,pz,fz,D$,mz,sf,rw,kl.Jj,rf],encapsulation:2});class Cz{constructor(){this.platformUtilService=(0,a.WQX)(Hb)}openLearnMore(e){e.preventDefault(),this.platformUtilService.launchUri("https://bitwarden.com/help/website-icons/")}}Cz.ɵfac=function(e){return new(e||Cz)},Cz.ɵcmp=Fl.VBU({type:Cz,selectors:[["vault-permit-cipher-details-popover"]],decls:14,vars:13,consts:[["permitDetailsPopover",""],["type","button","position","above-center","bitLink","",1,"tw-border-none","tw-bg-transparent","tw-text-primary-600","tw-p-0",3,"bitPopoverTriggerFor","appA11yTitle"],[1,"bwi","bwi-question-circle"],[3,"title"],[1,"tw-flex","tw-gap-1.5","tw-items-center"],["bitLink","","href","#",1,"tw-flex",3,"click"],["slot","end","aria-hidden","true",1,"bwi","bwi-external-link","tw-text-primary-600"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",1),Fl.nI1(1,"i18n"),Fl.nrm(2,"i",2),Fl.k0s(),Fl.j41(3,"bit-popover",3,0),Fl.nI1(5,"i18n"),Fl.j41(6,"p"),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.j41(9,"div",4)(10,"a",5),Fl.bIt("click",function(i){return a.eBV(e),a.Njj(t.openLearnMore(i))}),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s(),Fl.nrm(13,"i",6),Fl.k0s()()}if(2&e){const e=Fl.sdS(4);Fl.Y8G("bitPopoverTriggerFor",e)("appA11yTitle",Fl.bMT(1,5,"aboutThisSetting")),Fl.R7$(3),Fl.Y8G("title",Fl.bMT(5,7,"aboutThisSetting")),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(8,9,"permitCipherDetailsDescription")," "),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(12,11,"learnMore")," ")}},dependencies:[qV,XV,fB,sf,rw,Hh,uw,rf],encapsulation:2});const Tz=Object.freeze({Accepted:"accepted",Declined:"declined"});class Pz{constructor(){this.params=(0,a.WQX)(pd.Qs),this.dialogRef=(0,a.WQX)(nh),this.platformUtilsService=(0,a.WQX)(Hb),this.organizationName=this.params.organizationName}acceptTransfer(){this.dialogRef.close(Tz.Accepted)}decline(){this.dialogRef.close(Tz.Declined)}openLearnMore(e){e.preventDefault(),this.platformUtilsService.launchUri("https://bitwarden.com/help/transfer-ownership/")}static open(e,t){return e.open(Pz,Object.assign({positionStrategy:new sh,disableClose:!0},t))}}Pz.ɵfac=function(e){return new(e||Pz)},Pz.ɵcmp=Fl.VBU({type:Pz,selectors:[["ng-component"]],decls:18,vars:17,consts:[["hideIcon",""],["bitDialogTitle",""],["bitDialogContent",""],["bitDialogFooter",""],["bitButton","","type","button","buttonType","primary",3,"click"],["bitButton","","type","button","buttonType","secondary",3,"click"],["bitLink","","href","#",1,"tw-self-center","tw-text-sm",3,"click"],["name","bwi-external-link",1,"tw-ml-1"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-simple-dialog",0)(1,"span",1),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"span",2),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.qex(7,3),Fl.j41(8,"button",4),Fl.bIt("click",function(){return t.acceptTransfer()}),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s(),Fl.j41(11,"button",5),Fl.bIt("click",function(){return t.decline()}),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s(),Fl.j41(14,"a",6),Fl.bIt("click",function(e){return t.openLearnMore(e)}),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.nrm(17,"bit-icon",7),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e&&(Fl.R7$(2),Fl.JRh(Fl.i5U(3,5,"transferItemsToOrganizationTitle",t.organizationName)),Fl.R7$(3),Fl.SpI(" ",Fl.i5U(6,8,"transferItemsToOrganizationContent",t.organizationName)," "),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(10,11,"acceptTransfer")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(13,13,"declineAndLeave")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(16,15,"whyAmISeeingThis")," "))},dependencies:[id,td,Fh,Yd,YD,HD,Hh,uw,tc,sf,rf],encapsulation:2,changeDetection:0});const Fz=Object.freeze({Confirmed:"confirmed",Back:"back"});class Rz{constructor(){this.params=(0,a.WQX)(pd.Qs),this.dialogRef=(0,a.WQX)(nh),this.platformUtilsService=(0,a.WQX)(Hb),this.organizationName=this.params.organizationName}confirmLeave(){this.dialogRef.close(Fz.Confirmed)}goBack(){this.dialogRef.close(Fz.Back)}openLearnMore(e){e.preventDefault(),this.platformUtilsService.launchUri("https://bitwarden.com/help/transfer-ownership/")}static open(e,t){return e.open(Rz,Object.assign({positionStrategy:new sh,disableClose:!0},t))}}Rz.ɵfac=function(e){return new(e||Rz)},Rz.ɵcmp=Fl.VBU({type:Rz,selectors:[["ng-component"]],decls:23,vars:19,consts:[["bitDialogIcon","","name","bwi-exclamation-triangle",1,"tw-text-warning","tw-text-3xl"],["bitDialogTitle",""],["bitDialogContent",""],["bitTypography","body1"],["bitTypography","body1",1,"tw-mb-0"],["bitDialogFooter",""],["bitButton","","type","button","buttonType","dangerPrimary",3,"click"],["bitButton","","type","button","buttonType","secondary",3,"click"],["bitLink","","href","#",1,"tw-self-center","tw-text-sm",3,"click"],["name","bwi-external-link",1,"tw-ml-1"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-simple-dialog"),Fl.nrm(1,"bit-icon",0),Fl.j41(2,"span",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.qex(5,2),Fl.j41(6,"p",3),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.j41(9,"p",4),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s(),Fl.bVm(),Fl.qex(12,5),Fl.j41(13,"button",6),Fl.bIt("click",function(){return t.confirmLeave()}),Fl.EFF(14),Fl.nI1(15,"i18n"),Fl.k0s(),Fl.j41(16,"button",7),Fl.bIt("click",function(){return t.goBack()}),Fl.EFF(17),Fl.nI1(18,"i18n"),Fl.k0s(),Fl.j41(19,"a",8),Fl.bIt("click",function(e){return t.openLearnMore(e)}),Fl.EFF(20),Fl.nI1(21,"i18n"),Fl.nrm(22,"bit-icon",9),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e&&(Fl.R7$(3),Fl.JRh(Fl.bMT(4,6,"leaveConfirmationDialogTitle")),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(8,8,"leaveConfirmationDialogContentOne")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(11,10,"leaveConfirmationDialogContentTwo")," "),Fl.R7$(4),Fl.SpI(" ",Fl.i5U(15,12,"leaveConfirmationDialogConfirmButton",t.organizationName)," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(18,15,"goBack")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(21,17,"howToManageMyVault")," "))},dependencies:[id,td,Fh,Wd,Yd,YD,HD,Hh,uw,tc,rc,sf,rf],encapsulation:2,changeDetection:0});var xz=i(54539);class Az extends $h.q{constructor(){super(),this._filter=new Dd.t(()=>!0),this._renderData=new Dd.t([]),this._renderChangesSubscription=null,this._data=new Dd.t([]),this._sort=new Dd.t({direction:"asc"})}get data(){return this._data.value}set data(e){e=Array.isArray(e)?e:[],this._data.next(e),this._renderChangesSubscription||this.filterData(e)}set sort(e){this._sort.next(e)}get sort(){return this._sort.value}get filter(){return this._filter.value}set filter(e){this._filter.next(e),this._renderChangesSubscription||this.filterData(this.data)}connect(){return this._renderChangesSubscription||this.updateChangeSubscription(),this._renderData}disconnect(){var e;null===(e=this._renderChangesSubscription)||void 0===e||e.unsubscribe(),this._renderChangesSubscription=null}updateChangeSubscription(){var e;const t=(0,jo.z)([this._data,this._filter]).pipe((0,l.T)(([e])=>this.filterData(e))),i=(0,jo.z)([t,this._sort]).pipe((0,l.T)(([e,t])=>this.orderData(e,t)));null===(e=this._renderChangesSubscription)||void 0===e||e.unsubscribe(),this._renderChangesSubscription=i.subscribe(e=>this._renderData.next(e))}filterData(e){const t="string"==typeof this.filter?Az.simpleStringFilter(this.filter):this.filter;return this.filteredData=null==this.filter?e:e.filter(e=>t(e)),this.filteredData}orderData(e,t){return t?this.sortData(e,t):e}sortingDataAccessor(e,t){const i=e[t];if((0,xz.o1)(i)){const e=Number(i);return e<Number.MAX_SAFE_INTEGER?e:i}return i}sortData(e,t){const i=t.column,n="asc"===t.direction?1:-1;return i?e.sort((e,r)=>{if(t.fn)return t.fn(e,r,t.direction)*n;let s=this.sortingDataAccessor(e,i),o=this.sortingDataAccessor(r,i);const a=typeof s,l=typeof o;if(a!==l&&("number"===a&&(s+=""),"number"===l&&(o+="")),"string"==typeof s&&"string"==typeof o)return s.localeCompare(o)*n;let c=0;return null!=s&&null!=o?s>o?c=1:s<o&&(c=-1):null!=s?c=1:null!=o&&(c=-1),c*n}):e}}Az.simpleStringFilter=e=>t=>{if(!e)return!0;const i=Object.keys(t).reduce((e,i)=>e+t[i]+"◬","").toLowerCase(),n=e.trim().toLowerCase();return-1!=i.indexOf(n)};class Dz{get classList(){return["tw-p-3","has-[[biticonbutton]]:tw-py-1"]}}function Ez(e,t){if(1&e&&(Fl.j41(0,"tr",9)(1,"td",4),Fl.EFF(2),Fl.k0s(),Fl.j41(3,"td",4),Fl.EFF(4),Fl.k0s()()),2&e){const e=t.$implicit;Fl.R7$(2),Fl.JRh(e.type),Fl.R7$(2),Fl.JRh(e.message)}}function $z(e,t){if(1&e&&(Fl.DNE(0,Ez,5,2,"tr",8),Fl.nI1(1,"async")),2&e){const e=t.$implicit;Fl.Y8G("ngForOf",Fl.bMT(1,1,e))}}Dz.ɵfac=function(e){return new(e||Dz)},Dz.ɵdir=Fl.FsC({type:Dz,selectors:[["th","bitCell",""],["td","bitCell",""]],hostVars:2,hostBindings:function(e,t){2&e&&Fl.HbH(t.classList)}});class Oz{constructor(e,t){this.dialogRef=e,this.data=t,this.dataSource=new Az}ngOnInit(){const e=this.data.message.split("\n\n");if(1==e.length)return void(this.dataSource.data=[{type:"",message:this.data.message}]);const t=[];e.forEach(e=>{t.push({type:"",message:e})}),this.dataSource.data=t}}function Uz(e,t){if(1&e&&(Fl.j41(0,"tr",9)(1,"td",4),Fl.nrm(2,"i",10),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"td",4),Fl.EFF(6),Fl.k0s()()),2&e){const e=t.$implicit;Fl.R7$(2),Fl.HbH(Fl.VkB("bwi bwi-fw bwi-",e.icon)),Fl.R7$(),Fl.SpI(" ",Fl.bMT(4,5,e.type)," "),Fl.R7$(3),Fl.JRh(e.count)}}function Mz(e,t){if(1&e&&(Fl.DNE(0,Uz,7,7,"tr",8),Fl.nI1(1,"async")),2&e){const e=t.$implicit;Fl.Y8G("ngForOf",Fl.bMT(1,1,e))}}Oz.ɵfac=function(e){return new(e||Oz)(Fl.rXU(nh),Fl.rXU(pd.Qs))},Oz.ɵcmp=Fl.VBU({type:Oz,selectors:[["ng-component"]],decls:22,vars:16,consts:[["bitDialogTitle",""],["bitDialogContent",""],[3,"dataSource"],["header",""],["bitCell",""],["body",""],["bitDialogFooter",""],["bitButton","","bitDialogClose","","buttonType","primary","type","button"],["bitRow","",4,"ngFor","ngForOf"],["bitRow",""]],template:function(e,t){1&e&&(Fl.j41(0,"bit-dialog")(1,"span",0),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"span",1)(5,"div"),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s(),Fl.j41(8,"bit-table",2),Fl.qex(9,3),Fl.j41(10,"tr")(11,"th",4),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s(),Fl.j41(14,"th",4),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s()(),Fl.bVm(),Fl.DNE(17,$z,2,3,"ng-template",5),Fl.k0s()(),Fl.qex(18,6),Fl.j41(19,"button",7),Fl.EFF(20),Fl.nI1(21,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,6,"importError")," "),Fl.R7$(4),Fl.JRh(Fl.bMT(7,8,"resolveTheErrorsBelowAndTryAgain")),Fl.R7$(2),Fl.Y8G("dataSource",t.dataSource),Fl.R7$(4),Fl.JRh(Fl.bMT(13,10,"name")),Fl.R7$(3),Fl.JRh(Fl.bMT(16,12,"description")),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(21,14,"ok")," "))},dependencies:[kl.MD,kl.Sq,sf,Fh,ch,Ph,Xh,Dz,Eh,Nh,Vh,id,td,kl.Jj,rf],encapsulation:2});class Nz{constructor(e,t){this.dialogRef=e,this.data=t,this.dataSource=new Az}ngOnInit(){null!=this.data&&(this.dataSource.data=this.buildResultList())}buildResultList(){let e=0,t=0,i=0,n=0,r=0;this.data.ciphers.map(s=>{switch(s.type){case nx.Login:e++;break;case nx.Card:t++;break;case nx.SecureNote:n++;break;case nx.Identity:i++;break;case nx.SshKey:r++}});const s=[];return e>0&&s.push({icon:"globe",type:"typeLogin",count:e}),t>0&&s.push({icon:"credit-card",type:"typeCard",count:t}),i>0&&s.push({icon:"id-card",type:"typeIdentity",count:i}),n>0&&s.push({icon:"sticky-note",type:"typeSecureNote",count:n}),r>0&&s.push({icon:"key",type:"typeSshKey",count:r}),this.data.folders.length>0&&s.push({icon:"folder",type:"folders",count:this.data.folders.length}),this.data.collections.length>0&&s.push({icon:"collection",type:"collections",count:this.data.collections.length}),s}}Nz.ɵfac=function(e){return new(e||Nz)(Fl.rXU(nh),Fl.rXU(pd.Qs))},Nz.ɵcmp=Fl.VBU({type:Nz,selectors:[["ng-component"]],decls:22,vars:17,consts:[["bitDialogTitle",""],["bitDialogContent",""],[3,"dataSource"],["header",""],["bitCell",""],["body",""],["bitDialogFooter",""],["bitButton","","bitDialogClose","","buttonType","primary","type","button"],["bitRow","",4,"ngFor","ngForOf"],["bitRow",""],["aria-hidden","true"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-dialog")(1,"span",0),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"div",1)(5,"span"),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s(),Fl.j41(8,"bit-table",2),Fl.qex(9,3),Fl.j41(10,"tr")(11,"th",4),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s(),Fl.j41(14,"th",4),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s()(),Fl.bVm(),Fl.DNE(17,Mz,2,3,"ng-template",5),Fl.k0s()(),Fl.qex(18,6),Fl.j41(19,"button",7),Fl.EFF(20),Fl.nI1(21,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,6,"importSuccess")," "),Fl.R7$(4),Fl.JRh(Fl.i5U(7,8,"importSuccessNumberOfItems",t.data.ciphers.length)),Fl.R7$(2),Fl.Y8G("dataSource",t.dataSource),Fl.R7$(4),Fl.JRh(Fl.bMT(13,11,"type")),Fl.R7$(3),Fl.JRh(Fl.bMT(16,13,"total")),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(21,15,"ok")," "))},dependencies:[kl.MD,kl.Sq,sf,Fh,ch,Ph,Xh,Dz,Eh,Nh,Vh,id,td,kl.Jj,rf],encapsulation:2});class Vz{constructor(e,t){this.dialogRef=e,this.formBuilder=t,this.formGroup=this.formBuilder.group({filePassword:["",Il.k0.required]}),this.submit=()=>{this.formGroup.markAsTouched(),this.formGroup.valid&&this.dialogRef.close(this.formGroup.value.filePassword)}}}Vz.ɵfac=function(e){return new(e||Vz)(Fl.rXU(nh),Fl.rXU(Il.ok))},Vz.ɵcmp=Fl.VBU({type:Vz,selectors:[["ng-component"]],decls:23,vars:17,consts:[[3,"formGroup","bitSubmit"],["bitDialogTitle",""],["bitDialogContent",""],[1,"tw-mt-6"],["bitInput","","type","password","formControlName","filePassword","appAutofocus","","appInputVerbatim",""],["type","button","bitSuffix","","bitIconButton","","bitPasswordInputToggle",""],["bitDialogFooter",""],["bitButton","","buttonType","primary","type","submit"],["bitButton","","bitDialogClose","","buttonType","secondary","type","button"]],template:function(e,t){1&e&&(Fl.j41(0,"form",0)(1,"bit-dialog")(2,"span",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"div",2),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.j41(8,"bit-form-field",3)(9,"bit-label"),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s(),Fl.nrm(12,"input",4)(13,"button",5),Fl.k0s()(),Fl.qex(14,6),Fl.j41(15,"button",7)(16,"span"),Fl.EFF(17),Fl.nI1(18,"i18n"),Fl.k0s()(),Fl.j41(19,"button",8)(20,"span"),Fl.EFF(21),Fl.nI1(22,"i18n"),Fl.k0s()(),Fl.bVm(),Fl.k0s()()),2&e&&(Fl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,7,"confirmVaultImport")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(7,9,"confirmVaultImportDesc")," "),Fl.R7$(4),Fl.JRh(Fl.bMT(11,11,"confirmFilePassword")),Fl.R7$(7),Fl.JRh(Fl.bMT(18,13,"importVerb")),Fl.R7$(4),Fl.JRh(Fl.bMT(22,15,"cancel")))},dependencies:[kl.MD,sf,wd,GI,Fh,ch,Ph,Gu,Ac,fu,ju,iw,nw,pc,Md,id,td,Ql,Zl,Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,rf],encapsulation:2});class Bz{constructor(e,t){this.dialogRef=e,this.formBuilder=t,this.formGroup=this.formBuilder.group({sshKeyPassword:["",Il.k0.required]}),this.submit=()=>{this.formGroup.markAsTouched(),this.formGroup.valid&&this.dialogRef.close(this.formGroup.value.sshKeyPassword)}}}Bz.ɵfac=function(e){return new(e||Bz)(Fl.rXU(nh),Fl.rXU(Il.ok))},Bz.ɵcmp=Fl.VBU({type:Bz,selectors:[["ng-component"]],decls:23,vars:17,consts:[[3,"formGroup","bitSubmit"],["bitDialogTitle",""],["bitDialogContent",""],[1,"tw-mt-6"],["bitInput","","type","password","formControlName","sshKeyPassword","appAutofocus","","appInputVerbatim",""],["type","button","bitSuffix","","bitIconButton","","bitPasswordInputToggle",""],["bitDialogFooter",""],["bitButton","","buttonType","primary","type","submit"],["bitButton","","bitDialogClose","","buttonType","secondary","type","button"]],template:function(e,t){1&e&&(Fl.j41(0,"form",0)(1,"bit-dialog")(2,"span",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"div",2),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.j41(8,"bit-form-field",3)(9,"bit-label"),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s(),Fl.nrm(12,"input",4)(13,"button",5),Fl.k0s()(),Fl.qex(14,6),Fl.j41(15,"button",7)(16,"span"),Fl.EFF(17),Fl.nI1(18,"i18n"),Fl.k0s()(),Fl.j41(19,"button",8)(20,"span"),Fl.EFF(21),Fl.nI1(22,"i18n"),Fl.k0s()(),Fl.bVm(),Fl.k0s()()),2&e&&(Fl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,7,"enterSshKeyPassword")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(7,9,"enterSshKeyPasswordDesc")," "),Fl.R7$(4),Fl.JRh(Fl.bMT(11,11,"confirmSshKeyPassword")),Fl.R7$(7),Fl.JRh(Fl.bMT(18,13,"importSshKey")),Fl.R7$(4),Fl.JRh(Fl.bMT(22,15,"cancel")))},dependencies:[kl.MD,sf,wd,GI,Fh,ch,Ph,Gu,Ac,fu,ju,iw,nw,pc,Md,id,td,Ql,Zl,Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,rf],encapsulation:2});class jz{}var Gz=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Lz{}var zz=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class _z{}class Kz{constructor(){this.ciphers=[],this.folders=[],this.folderRelationships=[]}}class Xz{constructor(){this.ciphers=[],this.collections=[],this.collectionRelationships=[]}}class qz{constructor(e,t){this.key=e,this.value=t}}class Wz{}class Yz{constructor({cipher:e,encryptedFor:t}){var i,n,r;switch(this.type=e.type,this.encryptedFor=t,this.folderId=e.folderId,this.organizationId=e.organizationId,this.name=e.name?e.name.encryptedString:null,this.notes=e.notes?e.notes.encryptedString:null,this.favorite=e.favorite,this.lastKnownRevisionDate=e.revisionDate,this.archivedDate=e.archivedDate,this.reprompt=e.reprompt,this.key=null===(i=e.key)||void 0===i?void 0:i.encryptedString,this.type){case nx.Login:this.login=new dA,this.login.uris=null!==(r=null===(n=e.login.uris)||void 0===n?void 0:n.map(e=>{const t=new uA;return t.uri=null!=e.uri?e.uri.encryptedString:null,t.match=null!=e.match?e.match:null,t.uriChecksum=null!=e.uriChecksum?e.uriChecksum.encryptedString:null,t}))&&void 0!==r?r:[],this.login.username=e.login.username?e.login.username.encryptedString:null,this.login.password=e.login.password?e.login.password.encryptedString:null,this.login.passwordRevisionDate=null!=e.login.passwordRevisionDate?e.login.passwordRevisionDate.toISOString():null,this.login.totp=e.login.totp?e.login.totp.encryptedString:null,this.login.autofillOnPageLoad=e.login.autofillOnPageLoad,null!=e.login.fido2Credentials&&(this.login.fido2Credentials=e.login.fido2Credentials.map(e=>{const t=new cA;return t.credentialId=null!=e.credentialId?e.credentialId.encryptedString:null,t.keyType=null!=e.keyType?e.keyType.encryptedString:null,t.keyAlgorithm=null!=e.keyAlgorithm?e.keyAlgorithm.encryptedString:null,t.keyCurve=null!=e.keyCurve?e.keyCurve.encryptedString:null,t.keyValue=null!=e.keyValue?e.keyValue.encryptedString:null,t.rpId=null!=e.rpId?e.rpId.encryptedString:null,t.rpName=null!=e.rpName?e.rpName.encryptedString:null,t.counter=null!=e.counter?e.counter.encryptedString:null,t.userHandle=null!=e.userHandle?e.userHandle.encryptedString:null,t.userName=null!=e.userName?e.userName.encryptedString:null,t.userDisplayName=null!=e.userDisplayName?e.userDisplayName.encryptedString:null,t.discoverable=null!=e.discoverable?e.discoverable.encryptedString:null,t.creationDate=null!=e.creationDate?e.creationDate.toISOString():null,t}));break;case nx.SecureNote:this.secureNote=new hA,this.secureNote.type=e.secureNote.type;break;case nx.SshKey:this.sshKey=new pA,this.sshKey.privateKey=null!=e.sshKey.privateKey?e.sshKey.privateKey.encryptedString:null,this.sshKey.publicKey=null!=e.sshKey.publicKey?e.sshKey.publicKey.encryptedString:null,this.sshKey.keyFingerprint=null!=e.sshKey.keyFingerprint?e.sshKey.keyFingerprint.encryptedString:null;break;case nx.Card:this.card=new sA,this.card.cardholderName=null!=e.card.cardholderName?e.card.cardholderName.encryptedString:null,this.card.brand=null!=e.card.brand?e.card.brand.encryptedString:null,this.card.number=null!=e.card.number?e.card.number.encryptedString:null,this.card.expMonth=null!=e.card.expMonth?e.card.expMonth.encryptedString:null,this.card.expYear=null!=e.card.expYear?e.card.expYear.encryptedString:null,this.card.code=null!=e.card.code?e.card.code.encryptedString:null;break;case nx.Identity:this.identity=new lA,this.identity.title=null!=e.identity.title?e.identity.title.encryptedString:null,this.identity.firstName=null!=e.identity.firstName?e.identity.firstName.encryptedString:null,this.identity.middleName=null!=e.identity.middleName?e.identity.middleName.encryptedString:null,this.identity.lastName=null!=e.identity.lastName?e.identity.lastName.encryptedString:null,this.identity.address1=null!=e.identity.address1?e.identity.address1.encryptedString:null,this.identity.address2=null!=e.identity.address2?e.identity.address2.encryptedString:null,this.identity.address3=null!=e.identity.address3?e.identity.address3.encryptedString:null,this.identity.city=null!=e.identity.city?e.identity.city.encryptedString:null,this.identity.state=null!=e.identity.state?e.identity.state.encryptedString:null,this.identity.postalCode=null!=e.identity.postalCode?e.identity.postalCode.encryptedString:null,this.identity.country=null!=e.identity.country?e.identity.country.encryptedString:null,this.identity.company=null!=e.identity.company?e.identity.company.encryptedString:null,this.identity.email=null!=e.identity.email?e.identity.email.encryptedString:null,this.identity.phone=null!=e.identity.phone?e.identity.phone.encryptedString:null,this.identity.ssn=null!=e.identity.ssn?e.identity.ssn.encryptedString:null,this.identity.username=null!=e.identity.username?e.identity.username.encryptedString:null,this.identity.passportNumber=null!=e.identity.passportNumber?e.identity.passportNumber.encryptedString:null,this.identity.licenseNumber=null!=e.identity.licenseNumber?e.identity.licenseNumber.encryptedString:null}null!=e.fields&&(this.fields=e.fields.map(e=>{const t=new aA;return t.type=e.type,t.name=e.name?e.name.encryptedString:null,t.value=e.value?e.value.encryptedString:null,t.linkedId=e.linkedId,t})),null!=e.passwordHistory&&(this.passwordHistory=[],e.passwordHistory.forEach(e=>{this.passwordHistory.push({lastUsedDate:e.lastUsedDate,password:e.password?e.password.encryptedString:null})})),null!=e.attachments&&(this.attachments={},this.attachments2={},e.attachments.forEach(t=>{const i=t.fileName?t.fileName.encryptedString:null;this.attachments[t.id]=i;const n=new Wz;n.fileName=i,n.lastKnownRevisionDate=e.revisionDate,null!=t.key&&(n.key=t.key.encryptedString),this.attachments2[t.id]=n}))}}class Hz{constructor(e){this.name=e.name?e.name.encryptedString:null}}class Jz extends Hz{constructor(e){super(e),this.id=e.id||null}}class Zz{constructor(){this.success=!1,this.ciphers=[],this.folders=[],this.folderRelationships=[],this.collections=[],this.collectionRelationships=[]}}var Qz=i(98869);class e_{constructor(){this.organizationId=null,this.logService=new el(!1),this.newLineRegex=/(?:\r\n|\r|\n)/,this.passwordFieldNames=["password","pass word","passphrase","pass phrase","pass","code","code word","codeword","secret","secret word","personpwd","key","keyword","key word","keyphrase","key phrase","form_pw","wppassword","pin","pwd","pw","pword","passwd","p","serial","serial#","license key","reg #","passwort"],this.usernameFieldNames=["user","name","user name","username","login name","email","e-mail","id","userid","user id","login","form_loginname","wpname","mail","loginid","login id","log","personlogin","first name","last name","card#","account #","member","member #","nom","benutzername"],this.notesFieldNames=["note","notes","comment","comments","memo","description","free form","freeform","free text","freetext","free","kommentar"],this.uriFieldNames=["url","hyper link","hyperlink","link","host","hostname","host name","server","address","hyper ref","href","web","website","web site","site","web-site","uri","ort","adresse"],this.parseCsvOptions={encoding:"UTF-8",skipEmptyLines:!1}}get organization(){return null!=this.organizationId}parseXml(e){if(!this.validateNoExternalEntities(e))return null;const t=(new DOMParser).parseFromString(e,"application/xml");return null!=t&&null==t.querySelector("parsererror")?t:null}parseCsv(e,t,i={}){const n=Object.assign({header:t},this.parseCsvOptions,i);e=this.splitNewLine(e).join("\n").trim();const r=Qz.parse(e,n);return null!=r.errors&&r.errors.length>0&&r.errors.forEach(e=>{null!=e.row&&this.logService.warning("Error parsing row "+e.row+": "+e.message)}),r.data&&r.data.length>0?r.data:null}parseSingleRowCsv(e){if(this.isNullOrWhitespace(e))return null;const t=this.parseCsv(e,!1);return null!=t&&t.length>0&&t[0].length>0?t[0]:null}makeUriArray(e){if(null==e)return null;if("string"==typeof e){const t=new QE;return t.uri=this.fixUri(e),this.isNullOrWhitespace(t.uri)?null:[t]}if(e.length>0){const t=[];return e.forEach(e=>{const i=new QE;i.uri=this.fixUri(e),this.isNullOrWhitespace(i.uri)||t.push(i)}),0===t.length?null:t}return null}fixUri(e){return null==e?null:(-1===(e=e.trim()).indexOf("://")&&e.indexOf(".")>=0&&(e="http://"+e),e.length>1e3?e.substring(0,1e3):e)}nameFromUrl(e){const t=bd.getHostname(e);return this.isNullOrWhitespace(t)?null:t.startsWith("www.")?t.replace("www.",""):t}isNullOrWhitespace(e){return bd.isNullOrWhitespace(e)}getValueOrDefault(e,t=null){return this.isNullOrWhitespace(e)?t:e}splitNewLine(e){return e.split(this.newLineRegex)}setCardExpiration(e,t){if(this.isNullOrWhitespace(t))return!1;t=t.replace(/\s/g,"");const i=new RegExp("^0?(?<month>[1-9]|1[0-2])/(?<year>(?:[1-2][0-9])?[0-9]{2})$"),n=t.match(i);if(!n)return!1;e.card.expMonth=n.groups.month;const r=n.groups.year;return e.card.expYear=W$(r),!0}moveFoldersToCollections(e){e.folderRelationships.forEach(t=>e.collectionRelationships.push(t)),e.collections=e.folders.map(e=>new SR({name:e.name,organizationId:this.organizationId,id:e.id&&""!==e.id?e.id:null})),e.folderRelationships=[],e.folders=[]}querySelectorDirectChild(e,t){const i=this.querySelectorAllDirectChild(e,t);return 0===i.length?null:i[0]}querySelectorAllDirectChild(e,t){return Array.from(e.querySelectorAll(t)).filter(t=>t.parentNode===e)}initLoginCipher(){const e=new RO;return e.favorite=!1,e.notes="",e.fields=[],e.login=new CO,e.type=nx.Login,e}cleanupCipher(e){null!=e&&(e.type!==nx.Login&&(e.login=null),this.isNullOrWhitespace(e.name)&&(e.name="--"),this.isNullOrWhitespace(e.notes)&&(e.notes=null))}processKvp(e,t,i,n=ox.Text){if(!this.isNullOrWhitespace(i))if(this.isNullOrWhitespace(t)&&(t=""),i.length>200||i.trim().search(this.newLineRegex)>-1)null==e.notes&&(e.notes=""),e.notes+=t+": "+this.splitNewLine(i).join("\n")+"\n";else{null==e.fields&&(e.fields=[]);const r=new gO;r.type=n,r.name=t,r.value=i,e.fields.push(r)}}processFolder(e,t,i=!0){if(this.isNullOrWhitespace(t))return;let n=e.folders.length;t=t.replace(/\\/g,"/");let r=!0;for(let i=0;i<e.folders.length;i++)if(e.folders[i].name===t){r=!1,n=i;break}if(r){const i=new SU;i.name=t,e.folders.push(i)}i&&e.folderRelationships.push([e.ciphers.length,n]);const s=t.split("/");for(let t=s.length-1;t>0;t--){const i=s.slice(0,t).join("/");if(null==e.folders.find(e=>e.name===i)){const t=new SU;t.name=i,e.folders.push(t)}}}convertToNoteIfNeeded(e){e.type===nx.Login&&this.isNullOrWhitespace(e.login.username)&&this.isNullOrWhitespace(e.login.password)&&(null==e.login.uris||0===e.login.uris.length)&&(e.type=nx.SecureNote,e.secureNote=new PO,e.secureNote.type=hx)}processFullName(e,t){if(this.isNullOrWhitespace(t))return;const i=t.split(" ");i.length>0&&(e.identity.firstName=this.getValueOrDefault(i[0])),2===i.length?e.identity.lastName=this.getValueOrDefault(i[1]):i.length>=3&&(e.identity.middleName=this.getValueOrDefault(i[1]),e.identity.lastName=i.slice(2,i.length).join(" "))}validateNoExternalEntities(e){return!new RegExp("<!ENTITY","i").test(e)}}class t_ extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{var i;const n=this.initLoginCipher(),r=this.getValueOrDefault(e.url);n.name=this.getValueOrDefault(null!==(i=this.nameFromUrl(r))&&void 0!==i?i:"","--"),n.login.username=this.getValueOrDefault(e.username),n.login.password=this.getValueOrDefault(e.password),n.login.uris=this.makeUriArray(e.url),n.notes=this.getValueOrDefault(e.note),this.cleanupCipher(n),t.ciphers.push(n)}),t.success=!0,Promise.resolve(t))}}class i_ extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!1);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{if(e.length<2)return;const i=this.initLoginCipher();if(i.notes=this.getValueOrDefault(e[e.length-1]),i.name=this.getValueOrDefault(e[0],"--"),e.length>2&&e.length%2==0)for(let t=0;t<e.length-2;t+=2){const n=e[t+2],r=e[t+1];if(this.isNullOrWhitespace(n)||this.isNullOrWhitespace(r))continue;const s=r.toLowerCase();null==i.login.password&&this.passwordFieldNames.indexOf(s)>-1?i.login.password=this.getValueOrDefault(n):null==i.login.username&&this.usernameFieldNames.indexOf(s)>-1?i.login.username=this.getValueOrDefault(n):(null==i.login.uris||0===i.login.uris.length)&&this.uriFieldNames.indexOf(s)>-1?i.login.uris=this.makeUriArray(n):this.processKvp(i,r,n)}this.convertToNoteIfNeeded(i),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t))}}class n_ extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{const i=this.initLoginCipher();i.name=this.getValueOrDefault(e.name),i.login.uris=this.makeUriArray(e.web),i.login.password=this.getValueOrDefault(e.password),i.login.username=this.getValueOrDefault(e.login),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t))}}class r_ extends e_{parse(e){const t=new Zz,i=JSON.parse(e);return null==i?(t.success=!1,Promise.resolve(t)):(null!=i.logins&&i.logins.forEach(e=>{const i=this.initLoginCipher();i.name=this.getValueOrDefault(e.custName),i.notes=this.getValueOrDefault(e.note),i.login.uris=this.makeUriArray(e.url),i.login.password=this.getValueOrDefault(e.pwd),i.login.username=this.getValueOrDefault(e.loginName),this.cleanupCipher(i),t.ciphers.push(i)}),null!=i.notes&&i.notes.forEach(e=>{const i=this.initLoginCipher();i.type=nx.SecureNote,i.secureNote.type=hx,i.name=this.getValueOrDefault(e.label),i.notes=this.getValueOrDefault(e.text),this.cleanupCipher(i),t.ciphers.push(i)}),null!=i.cards&&i.cards.forEach(e=>{const i=this.initLoginCipher();i.type=nx.Card,i.name=this.getValueOrDefault(e.custName),i.notes=this.getValueOrDefault(e.note),i.card.cardholderName=this.getValueOrDefault(e.holderName),i.card.number=this.getValueOrDefault(e.cardNumber),i.card.code=this.getValueOrDefault(e.cvv),i.card.brand=mO.getCardBrandByPatterns(i.card.number),null!=e.expirationDate&&(null!=e.expirationDate.month&&(i.card.expMonth=e.expirationDate.month+""),null!=e.expirationDate.year&&(i.card.expYear=e.expirationDate.year+"")),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t))}}class s_ extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{const i=this.initLoginCipher();i.name=this.getValueOrDefault(e.name,this.getValueOrDefault(this.nameFromUrl(e.website),"--")),i.login.uris=this.makeUriArray(e.website),i.login.password=this.getValueOrDefault(e.password),this.isNullOrWhitespace(e.username)&&!this.isNullOrWhitespace(e.secondary_username)?i.login.username=e.secondary_username:(i.login.username=this.getValueOrDefault(e.username),i.notes=this.getValueOrDefault(e.secondary_username)),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t))}}class o_ extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{if("list"===e.grouping)return;const i=this.initLoginCipher();i.favorite="1"===e.fav,i.name=this.getValueOrDefault(e.name),i.notes=this.getValueOrDefault(e.extra),"note"!==e.grouping&&(i.login.uris=this.makeUriArray(e.url),i.login.password=this.getValueOrDefault(e.password),i.login.username=this.getValueOrDefault(e.username)),this.convertToNoteIfNeeded(i),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t))}}class a_ extends e_{constructor(){super(...arguments),this.androidPatternRegex=new RegExp("^android:\\/\\/.*(?<=@)(.*)(?=\\/)")}normalizeAndroidUrl(e){const t=null==e?void 0:e.match(this.androidPatternRegex);return t?`androidapp://${t[1]}`:e}parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{const i=this.initLoginCipher(),n=this.normalizeAndroidUrl(e.url);let r=e.name;!r&&this.androidPatternRegex.test(e.url)&&(r=e.url.match(this.androidPatternRegex)[1]),i.name=this.getValueOrDefault(r,"--"),i.login.username=this.getValueOrDefault(e.username),i.login.password=this.getValueOrDefault(e.password),i.login.uris=this.makeUriArray(n),i.notes=this.getValueOrDefault(e.note),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t))}}class l_ extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{if(this.organization&&!this.isNullOrWhitespace(e.collections)){e.collections.split(",").forEach(e=>{this.processFolder(t,e)})}else this.organization||this.processFolder(t,e.folder);const i=new RO;i.favorite=!this.organization&&"0"!==this.getValueOrDefault(e.favorite,"0"),i.type=nx.Login,i.notes=this.getValueOrDefault(e.notes),i.name=this.getValueOrDefault(e.name,"--");try{i.reprompt=parseInt(this.getValueOrDefault(e.reprompt,tx.None.toString()),10)}catch(e){console.error("Unable to parse reprompt value",e),i.reprompt=tx.None}if(!this.isNullOrWhitespace(e.archivedDate))try{i.archivedDate=new Date(e.archivedDate)}catch(e){console.error("Unable to parse archivedDate value",e)}if(!this.isNullOrWhitespace(e.fields)){const t=this.splitNewLine(e.fields);for(let e=0;e<t.length;e++){if(this.isNullOrWhitespace(t[e]))continue;const n=t[e].lastIndexOf(": ");if(-1===n)continue;null==i.fields&&(i.fields=[]);const r=new gO;r.name=t[e].substr(0,n),r.value=null,r.type=ox.Text,t[e].length>n+2&&(r.value=t[e].substr(n+2)),i.fields.push(r)}}switch(null!=e.type?e.type.toLowerCase():null){case"note":i.type=nx.SecureNote,i.secureNote=new PO,i.secureNote.type=hx;break;default:{i.type=nx.Login,i.login=new CO,i.login.totp=this.getValueOrDefault(e.login_totp||e.totp),i.login.username=this.getValueOrDefault(e.login_username||e.username),i.login.password=this.getValueOrDefault(e.login_password||e.password);const t=this.parseSingleRowCsv(e.login_uri||e.uri);i.login.uris=this.makeUriArray(t);break}}t.ciphers.push(i)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t))}}function c_(e){return null==e?null:"string"==typeof e?e:null==e?void 0:e.encryptedString}class u_{static template(){const e=new u_;return e.cardholderName="John Doe",e.brand="visa",e.number="4242424242424242",e.expMonth="04",e.expYear="2023",e.code="123",e}static toView(e,t=new mO){return t.cardholderName=e.cardholderName,t.brand=e.brand,t.number=e.number,t.expMonth=e.expMonth,t.expYear=e.expYear,t.code=e.code,t}static toDomain(e,t=new mN){return t.cardholderName=null!=e.cardholderName?new Pp(e.cardholderName):null,t.brand=null!=e.brand?new Pp(e.brand):null,t.number=null!=e.number?new Pp(e.number):null,t.expMonth=null!=e.expMonth?new Pp(e.expMonth):null,t.expYear=null!=e.expYear?new Pp(e.expYear):null,t.code=null!=e.code?new Pp(e.code):null,t}constructor(e){null!=e&&(this.cardholderName=c_(e.cardholderName),this.brand=c_(e.brand),this.number=c_(e.number),this.expMonth=c_(e.expMonth),this.expYear=c_(e.expYear),this.code=c_(e.code))}}class d_{static template(){const e=new d_;return e.name="Field name",e.value="Some value",e.type=ox.Text,e}static toView(e,t=new gO){return t.type=e.type,t.value=e.value,t.name=e.name,t.linkedId=e.linkedId,t}static toDomain(e,t=new gN){return t.type=e.type,t.value=null!=e.value?new Pp(e.value):null,t.name=null!=e.name?new Pp(e.name):null,t.linkedId=e.linkedId,t}constructor(e){null!=e&&(this.name=c_(e.name),this.value=c_(e.value),this.type=e.type,this.linkedId=e.linkedId)}}class h_{static template(){const e=new h_;return e.title="Mr",e.firstName="John",e.middleName="William",e.lastName="Doe",e.address1="123 Any St",e.address2="Apt #123",e.address3=null,e.city="New York",e.state="NY",e.postalCode="10001",e.country="US",e.company="Acme Inc.",e.email="john@company.com",e.phone="5555551234",e.ssn="000-123-4567",e.username="jdoe",e.passportNumber="US-123456789",e.licenseNumber="D123-12-123-12333",e}static toView(e,t=new wO){return t.title=e.title,t.firstName=e.firstName,t.middleName=e.middleName,t.lastName=e.lastName,t.address1=e.address1,t.address2=e.address2,t.address3=e.address3,t.city=e.city,t.state=e.state,t.postalCode=e.postalCode,t.country=e.country,t.company=e.company,t.email=e.email,t.phone=e.phone,t.ssn=e.ssn,t.username=e.username,t.passportNumber=e.passportNumber,t.licenseNumber=e.licenseNumber,t}static toDomain(e,t=new yN){return t.title=null!=e.title?new Pp(e.title):null,t.firstName=null!=e.firstName?new Pp(e.firstName):null,t.middleName=null!=e.middleName?new Pp(e.middleName):null,t.lastName=null!=e.lastName?new Pp(e.lastName):null,t.address1=null!=e.address1?new Pp(e.address1):null,t.address2=null!=e.address2?new Pp(e.address2):null,t.address3=null!=e.address3?new Pp(e.address3):null,t.city=null!=e.city?new Pp(e.city):null,t.state=null!=e.state?new Pp(e.state):null,t.postalCode=null!=e.postalCode?new Pp(e.postalCode):null,t.country=null!=e.country?new Pp(e.country):null,t.company=null!=e.company?new Pp(e.company):null,t.email=null!=e.email?new Pp(e.email):null,t.phone=null!=e.phone?new Pp(e.phone):null,t.ssn=null!=e.ssn?new Pp(e.ssn):null,t.username=null!=e.username?new Pp(e.username):null,t.passportNumber=null!=e.passportNumber?new Pp(e.passportNumber):null,t.licenseNumber=null!=e.licenseNumber?new Pp(e.licenseNumber):null,t}constructor(e){null!=e&&(this.title=c_(e.title),this.firstName=c_(e.firstName),this.middleName=c_(e.middleName),this.lastName=c_(e.lastName),this.address1=c_(e.address1),this.address2=c_(e.address2),this.address3=c_(e.address3),this.city=c_(e.city),this.state=c_(e.state),this.postalCode=c_(e.postalCode),this.country=c_(e.country),this.company=c_(e.company),this.email=c_(e.email),this.phone=c_(e.phone),this.ssn=c_(e.ssn),this.username=c_(e.username),this.passportNumber=c_(e.passportNumber),this.licenseNumber=c_(e.licenseNumber))}}class p_{static template(){const e=new p_;return e.credentialId="keyId",e.keyType="keyType",e.keyAlgorithm="keyAlgorithm",e.keyCurve="keyCurve",e.keyValue="keyValue",e.rpId="rpId",e.userHandle="userHandle",e.userName="userName",e.counter="counter",e.rpName="rpName",e.userDisplayName="userDisplayName",e.discoverable="false",e.creationDate=null,e}static toView(e,t=new SO){return t.credentialId=e.credentialId,t.keyType=e.keyType,t.keyAlgorithm=e.keyAlgorithm,t.keyCurve=e.keyCurve,t.keyValue=e.keyValue,t.rpId=e.rpId,t.userHandle=e.userHandle,t.userName=e.userName,t.counter=parseInt(e.counter),t.rpName=e.rpName,t.userDisplayName=e.userDisplayName,t.discoverable="true"===e.discoverable,t.creationDate=new Date(e.creationDate),t}static toDomain(e,t=new wN){return t.credentialId=null!=e.credentialId?new Pp(e.credentialId):null,t.keyType=null!=e.keyType?new Pp(e.keyType):null,t.keyAlgorithm=null!=e.keyAlgorithm?new Pp(e.keyAlgorithm):null,t.keyCurve=null!=e.keyCurve?new Pp(e.keyCurve):null,t.keyValue=null!=e.keyValue?new Pp(e.keyValue):null,t.rpId=null!=e.rpId?new Pp(e.rpId):null,t.userHandle=null!=e.userHandle?new Pp(e.userHandle):null,t.userName=null!=e.userName?new Pp(e.userName):null,t.counter=null!=e.counter?new Pp(e.counter):null,t.rpName=null!=e.rpName?new Pp(e.rpName):null,t.userDisplayName=null!=e.userDisplayName?new Pp(e.userDisplayName):null,t.discoverable=null!=e.discoverable?new Pp(e.discoverable):null,t.creationDate=null!=e.creationDate?new Date(e.creationDate):null,t}constructor(e){null!=e&&(this.credentialId=c_(e.credentialId),this.keyType=c_(e.keyType),this.keyAlgorithm=c_(e.keyAlgorithm),this.keyCurve=c_(e.keyCurve),this.keyValue=c_(e.keyValue),this.rpId=c_(e.rpId),this.userHandle=c_(e.userHandle),this.userName=c_(e.userName),this.counter=c_(e instanceof SO?String(e.counter):e.counter),this.rpName=c_(e.rpName),this.userDisplayName=c_(e.userDisplayName),this.discoverable=c_(e instanceof SO?String(e.discoverable):e.discoverable),this.creationDate=e.creationDate)}}class v_{static template(){const e=new v_;return e.uri="https://google.com",e.match=null,e}static toView(e,t=new QE){return t.uri=e.uri,t.match=e.match,t}static toDomain(e,t=new kN){return t.uri=null!=e.uri?new Pp(e.uri):null,t.uriChecksum=null!=e.uriChecksum?new Pp(e.uriChecksum):null,t.match=e.match,t}constructor(e){var t;this.match=null,null!=e&&(this.uri=c_(e.uri),"uriChecksum"in e&&(this.uriChecksum=null===(t=e.uriChecksum)||void 0===t?void 0:t.encryptedString),this.match=e.match)}}class f_{static template(){const e=new f_;return e.uris=[],e.username="jdoe",e.password="myp@ssword123",e.totp="JBSWY3DPEHPK3PXP",e.fido2Credentials=[],e}static toView(e,t=new CO){return null!=e.uris&&(t.uris=e.uris.map(e=>v_.toView(e))),t.username=e.username,t.password=e.password,t.totp=e.totp,null!=e.fido2Credentials&&(t.fido2Credentials=e.fido2Credentials.map(e=>p_.toView(e))),t}static toDomain(e,t=new CN){return null!=e.uris&&(t.uris=e.uris.map(e=>v_.toDomain(e))),t.username=null!=e.username?new Pp(e.username):null,t.password=null!=e.password?new Pp(e.password):null,t.totp=null!=e.totp?new Pp(e.totp):null,null!=e.fido2Credentials&&(t.fido2Credentials=e.fido2Credentials.map(e=>p_.toDomain(e))),t}constructor(e){null!=e&&(null!=e.uris&&(this.uris=e.uris.map(e=>new v_(e))),null!=e.fido2Credentials&&(this.fido2Credentials=e.fido2Credentials.map(e=>new p_(e))),this.username=c_(e.username),this.password=c_(e.password),this.totp=c_(e.totp))}}class m_{static template(){const e=new m_;return e.password=null,e.lastUsedDate=null,e}static toView(e,t=new TO){return t.password=e.password,t.lastUsedDate=e.lastUsedDate?new Date(e.lastUsedDate):null,t}static toDomain(e,t=new TN){return t.password=null!=e.password?new Pp(e.password):null,t.lastUsedDate=e.lastUsedDate?new Date(e.lastUsedDate):null,t}constructor(e){this.lastUsedDate=null,null!=e&&(this.password=c_(e.password),this.lastUsedDate=e.lastUsedDate)}}class g_{static template(){const e=new g_;return e.type=hx,e}static toView(e,t=new PO){return t.type=e.type,t}static toDomain(e,t=new FN){return t.type=e.type,t}constructor(e){null!=e&&(this.type=e.type)}}class y_{static template(){const e=new y_;return e.privateKey="",e.publicKey="",e.keyFingerprint="",e}static toView(e,t=new FO){if(null!=e){if(!e.privateKey||""===e.privateKey.trim())throw new Error("SSH key private key is required.");if(!e.publicKey||""===e.publicKey.trim())throw new Error("SSH key public key is required.");if(!e.keyFingerprint||""===e.keyFingerprint.trim())throw new Error("SSH key fingerprint is required.");return t.privateKey=e.privateKey,t.publicKey=e.publicKey,t.keyFingerprint=e.keyFingerprint,t}}static toDomain(e,t=new RN){return t.privateKey=new Pp(e.privateKey),t.publicKey=new Pp(e.publicKey),t.keyFingerprint=new Pp(e.keyFingerprint),t}constructor(e){null!=e&&(this.privateKey=c_(e.privateKey),this.publicKey=c_(e.publicKey),this.keyFingerprint=c_(e.keyFingerprint))}}class b_{constructor(){this.passwordHistory=null,this.revisionDate=null,this.creationDate=null,this.deletedDate=null,this.archivedDate=null}static template(){const e=new b_;return e.organizationId=null,e.collectionIds=null,e.folderId=null,e.type=nx.Login,e.name="Item name",e.notes="Some notes about this item.",e.favorite=!1,e.fields=[],e.login=null,e.secureNote=null,e.card=null,e.identity=null,e.sshKey=null,e.reprompt=tx.None,e.passwordHistory=[],e.creationDate=null,e.revisionDate=null,e.deletedDate=null,e.archivedDate=null,e}static toView(e,t=new RO){var i,n,r;if(t.type=e.type,t.folderId=e.folderId,null==t.organizationId&&(t.organizationId=e.organizationId),t.collectionIds||e.collectionIds){const r=new Set((null!==(i=t.collectionIds)&&void 0!==i?i:[]).concat(null!==(n=e.collectionIds)&&void 0!==n?n:[]));t.collectionIds=Array.from(r.values())}switch(t.name=e.name,t.notes=e.notes,t.favorite=e.favorite,t.reprompt=null!==(r=e.reprompt)&&void 0!==r?r:tx.None,t.key=null!=e.key?new Pp(e.key):null,null!=e.fields&&(t.fields=e.fields.map(e=>d_.toView(e))),e.type){case nx.Login:t.login=f_.toView(e.login);break;case nx.SecureNote:t.secureNote=g_.toView(e.secureNote);break;case nx.Card:t.card=u_.toView(e.card);break;case nx.Identity:t.identity=h_.toView(e.identity);break;case nx.SshKey:t.sshKey=y_.toView(e.sshKey)}return null!=e.passwordHistory&&(t.passwordHistory=e.passwordHistory.map(e=>m_.toView(e))),t.creationDate=e.creationDate?new Date(e.creationDate):t.creationDate,t.revisionDate=e.revisionDate?new Date(e.revisionDate):t.revisionDate,t.deletedDate=e.deletedDate?new Date(e.deletedDate):t.deletedDate,t.archivedDate=e.archivedDate?new Date(e.archivedDate):t.archivedDate,t}static toDomain(e,t=new AN){var i;switch(t.type=e.type,t.folderId=e.folderId,null==t.organizationId&&(t.organizationId=e.organizationId),t.name=null!=e.name?new Pp(e.name):null,t.notes=null!=e.notes?new Pp(e.notes):null,t.favorite=e.favorite,t.reprompt=null!==(i=e.reprompt)&&void 0!==i?i:tx.None,t.key=null!=e.key?new Pp(e.key):null,null!=e.fields&&(t.fields=e.fields.map(e=>d_.toDomain(e))),e.type){case nx.Login:t.login=f_.toDomain(e.login);break;case nx.SecureNote:t.secureNote=g_.toDomain(e.secureNote);break;case nx.Card:t.card=u_.toDomain(e.card);break;case nx.Identity:t.identity=h_.toDomain(e.identity);break;case nx.SshKey:t.sshKey=y_.toDomain(e.sshKey)}return null!=e.passwordHistory&&(t.passwordHistory=e.passwordHistory.map(e=>m_.toDomain(e))),t.creationDate=e.creationDate?new Date(e.creationDate):null,t.revisionDate=e.revisionDate?new Date(e.revisionDate):null,t.deletedDate=e.deletedDate?new Date(e.deletedDate):null,t.archivedDate=e.archivedDate?new Date(e.archivedDate):null,t}build(e){var t;switch(this.organizationId=e.organizationId,this.folderId=e.folderId,this.type=e.type,this.reprompt=e.reprompt,this.name=c_(e.name),this.notes=c_(e.notes),"key"in e&&(this.key=null===(t=e.key)||void 0===t?void 0:t.encryptedString),this.favorite=e.favorite,null!=e.fields&&(this.fields=e.fields.map(e=>new d_(e))),e.type){case nx.Login:this.login=new f_(e.login);break;case nx.SecureNote:this.secureNote=new g_(e.secureNote);break;case nx.Card:this.card=new u_(e.card);break;case nx.Identity:this.identity=new h_(e.identity);break;case nx.SshKey:this.sshKey=new y_(e.sshKey)}null!=e.passwordHistory&&(this.passwordHistory=e.passwordHistory.map(e=>new m_(e))),this.creationDate=e.creationDate,this.revisionDate=e.revisionDate,this.deletedDate=e.deletedDate,this.archivedDate=e.archivedDate}}class w_ extends b_{build(e){this.id=e.id,super.build(e),this.collectionIds=e.collectionIds}}function S_(e){return"string"==typeof e&&b(e)}class k_{static template(){const e=new k_;return e.organizationId="00000000-0000-0000-0000-000000000000",e.name="Collection name",e.externalId=null,e}static toView(e,t){const i=new SR({name:e.name,organizationId:e.organizationId,id:t});return i.externalId=e.externalId,i}static toDomain(e,t){return t.name=null!=e.name?new Pp(e.name):null,t.externalId=e.externalId,null==t.organizationId&&(t.organizationId=e.organizationId),t}build(e){this.organizationId=e.organizationId,this.name=c_(e.name),this.externalId=e.externalId}}class I_ extends k_{static toView(e){return super.toView(e,e.id)}static toDomain(e,t){return t.id=e.id,super.toDomain(e,t)}build(e){this.id=e.id,super.build(e)}}var C_=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class T_ extends sv{constructor(e){super(),this.id="",this.name=new Pp(""),this.revisionDate=new Date,null!=e&&(this.id=e.id,this.name=new Pp(e.name),this.revisionDate=new Date(e.revisionDate))}decrypt(e){return this.decryptObj(this,new SU(this),["name"],e)}decryptWithKey(e,t){return C_(this,void 0,void 0,function*(){const i=new SU;i.id=this.id,i.revisionDate=this.revisionDate;try{i.name=yield t.decryptString(this.name,e)}catch(e){throw console.error("[Folder] Error decrypting folder",e),e}return i})}static fromJSON(e){if(null==e)return null;const t=new T_;return t.id=e.id,t.name=Pp.fromJSON(e.name),t.revisionDate=new Date(e.revisionDate),t}}class P_{constructor(){this.name=""}static template(){const e=new P_;return e.name="Folder name",e}static toView(e,t=new SU){return t.name=e.name,t}static toDomain(e,t=new T_){return t.name=new Pp(e.name),t}build(e){var t,i;this.name=null!==(i=c_(null!==(t=e.name)&&void 0!==t?t:""))&&void 0!==i?i:""}}class F_ extends P_{static toView(e,t=new SU){return t.id=e.id,super.toView(e,t)}static toDomain(e,t=new T_){return t.id=e.id,super.toDomain(e,t)}build(e){this.id=e.id,super.build(e)}}function R_(e){return null!=e&&!0!==e.encrypted}function x_(e){return null!=e&&!0===e.encrypted}function A_(e){return null!=e&&!0===e.encrypted&&!0===e.passwordProtected}class D_{}var E_=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class $_{}var O_=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class U_{constructor(e,t,i,n){this.keyGenerationService=e,this.encryptService=t,this.cryptoFunctionService=i,this.kdfConfigService=n}buildPasswordExport(e,t,i){return O_(this,void 0,void 0,function*(){const n=yield this.kdfConfigService.getKdfConfig(e),r=bd.fromBufferToB64(yield this.cryptoFunctionService.randomBytes(16)),s=yield this.keyGenerationService.deriveVaultExportKey(i,r,n),o=yield this.encryptService.encryptString(bd.newGuid(),s),a=yield this.encryptService.encryptString(t,s),l={encrypted:!0,passwordProtected:!0,salt:r,kdfType:n.kdfType,kdfIterations:n.iterations,encKeyValidation_DO_NOT_EDIT:o.encryptedString,data:a.encryptedString};return n.kdfType===Mv.Argon2id&&(l.kdfMemory=n.memory,l.kdfParallelism=n.parallelism),JSON.stringify(l,null," ")})}buildCommonCipher(e,t){switch(e.type=null,e.name=t.name,e.notes=t.notes,e.fields=null,e.reprompt=t.reprompt,e.archivedDate=t.archivedDate?t.archivedDate.toISOString():null,e.login_uri=null,e.login_username=null,e.login_password=null,e.login_totp=null,t.fields&&t.fields.forEach(t=>{e.fields?e.fields+="\n":e.fields="",e.fields+=(t.name||"")+": "+t.value}),t.type){case nx.Login:e.type="login",e.login_username=t.login.username,e.login_password=t.login.password,e.login_totp=t.login.totp,t.login.uris&&(e.login_uri=[],t.login.uris.forEach(t=>{e.login_uri.push(t.uri)}));break;case nx.SecureNote:e.type="note";break;default:return}return e}}class M_{static getFileName(e="",t="csv"){"encrypted_json"===t&&(e=""==e?"encrypted":"encrypted_"+e,t="json");const i=new Date;return"bitwarden"+(e?"_"+e:"")+"_export_"+(i.getFullYear()+""+this.padNumber(i.getMonth()+1,2)+this.padNumber(i.getDate(),2)+this.padNumber(i.getHours(),2)+this.padNumber(i.getMinutes(),2)+this.padNumber(i.getSeconds(),2))+"."+t}static padNumber(e,t,i="0"){const n=e.toString();return n.length>=t?n:new Array(t-n.length+1).join(i)+n}}var N_=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class V_{}var B_=i(74794),j_=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class G_{}class L_ extends tS{constructor(e){super(e);const t=this.getResponseProperty("Collections");null!=t&&(this.collections=t.map(e=>new PR(e)));const i=this.getResponseProperty("Ciphers");null!=i&&(this.ciphers=i.map(e=>new mA(e)))}}var z_=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var __=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class K_ extends e_{constructor(){super()}parse(e){return __(this,void 0,void 0,function*(){const t=JSON.parse(e);if(null==t||null==t.items){const e=new Zz;return e.success=!1,e}if(!R_(t))throw new Error("Data is encrypted. Use BitwardenEncryptedJsonImporter instead.");return yield this.parseDecrypted(t)})}parseDecrypted(e){return __(this,void 0,void 0,function*(){const t=new Zz,i=R_(n=e)&&null!=n.collections?yield this.parseCollections(e,t):yield this.parseFolders(e,t);var n;return e.items.forEach(e=>{const n=w_.toView(e);n.id=null,n.organizationId=null,n.collectionIds=null,null!=n.passwordHistory&&n.passwordHistory.length>5&&(n.passwordHistory=n.passwordHistory.slice(0,5)),!this.organization&&null!=e.folderId&&i.has(e.folderId)?t.folderRelationships.push([t.ciphers.length,i.get(e.folderId)]):this.organization&&null!=e.collectionIds&&e.collectionIds.forEach(e=>{i.has(e)&&t.collectionRelationships.push([t.ciphers.length,i.get(e)])}),this.cleanupCipher(n),t.ciphers.push(n)}),t.success=!0,t})}parseFolders(e,t){return __(this,void 0,void 0,function*(){const i=new Map;if(null==e.folders)return i;for(const n of e.folders){const e=F_.toView(n);null!=e&&(i.set(n.id,t.folders.length),t.folders.push(e))}return i})}parseCollections(e,t){return __(this,void 0,void 0,function*(){const i=new Map;if(null==e.collections)return i;for(const n of e.collections){const e=I_.toView(n);e.organizationId=null,null!=e&&(i.set(n.id,t.collections.length),t.collections.push(e))}return i})}}var X_=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class q_ extends K_{constructor(e,t,i,n,r){super(),this.keyService=e,this.encryptService=t,this.i18nService=i,this.cipherService=n,this.accountService=r}parse(e){const t=Object.create(null,{parse:{get:()=>super.parse}});return X_(this,void 0,void 0,function*(){const i=JSON.parse(e);if(A_(i))throw new Error("Data is password-protected. Use BitwardenPasswordProtectedImporter instead.");if(null==i||null==i.items){const e=new Zz;return e.success=!1,e}return R_(i)?t.parse.call(this,e):yield this.parseEncrypted(i)})}parseEncrypted(e){return X_(this,void 0,void 0,function*(){const t=new Zz,i=yield(0,bo._)(this.accountService.activeAccount$);if(this.isNullOrWhitespace(e.encKeyValidation_DO_NOT_EDIT))return t.success=!1,t.errorMessage=this.i18nService.t("importEncKeyError"),t;const n=yield(0,bo._)(this.keyService.orgKeys$(i.id));let r=null==n?void 0:n[this.organizationId];if(r||(r=yield(0,bo._)(this.keyService.userKey$(i.id))),!r)return t.success=!1,t.errorMessage=this.i18nService.t("importEncKeyError"),t;const s=new Pp(e.encKeyValidation_DO_NOT_EDIT);try{yield this.encryptService.decryptString(s,r)}catch(e){return t.success=!1,t.errorMessage=this.i18nService.t("importEncKeyError"),t}let o=null;o=function(e){return x_(e)&&null!=e.collections}(e)?yield this.parseEncryptedCollections(i.id,e,t):yield this.parseEncryptedFolders(i.id,e,t);for(const n of e.items){const e=w_.toDomain(n);e.id=null,e.organizationId=this.organizationId,e.collectionIds=null,null!=e.passwordHistory&&e.passwordHistory.length>5&&(e.passwordHistory=e.passwordHistory.slice(0,5)),!this.organization&&null!=n.folderId&&o.has(n.folderId)?t.folderRelationships.push([t.ciphers.length,o.get(n.folderId)]):this.organization&&null!=n.collectionIds&&n.collectionIds.forEach(e=>{o.has(e)&&t.collectionRelationships.push([t.ciphers.length,o.get(e)])});const r=yield this.cipherService.decrypt(e,i.id);this.cleanupCipher(r),t.ciphers.push(r)}return t.success=!0,t})}parseEncryptedFolders(e,t,i){return X_(this,void 0,void 0,function*(){const n=new Map;if(null==t.folders)return n;const r=yield(0,bo._)(this.keyService.userKey$(e));for(const e of t.folders){let t;const s=F_.toDomain(e);null!=s&&(t=yield s.decrypt(r)),null!=t&&(n.set(e.id,i.folders.length),i.folders.push(t))}return n})}parseEncryptedCollections(e,t,i){return X_(this,void 0,void 0,function*(){const n=new Map;if(null==t.collections)return n;const r=yield(0,bo._)(this.keyService.orgKeys$(e).pipe((0,Eo.p)(e=>null!=e)));for(const e of t.collections){const t=I_.toDomain(e,new bR({id:e.id,name:new Pp(e.name),organizationId:this.organizationId})),s=r[e.organizationId],o=yield t.decrypt(s,this.encryptService);null!=o&&(n.set(e.id,i.collections.length),i.collections.push(o))}return n})}}var W_=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Y_ extends q_{constructor(e,t,i,n,r,s,o){super(e,t,i,n,s),this.keyGenerationService=r,this.promptForPassword_callback=o}parse(e){const t=Object.create(null,{parse:{get:()=>super.parse}});return W_(this,void 0,void 0,function*(){const i=new Zz,n=JSON.parse(e);if(!n)return i.success=!1,i;if(!A_(n))return yield t.parse.call(this,e);if(this.cannotParseFile(n))return i.success=!1,i;const r=yield this.promptForPassword_callback();if(!(yield this.checkPassword(n,r)))return i.success=!1,i.errorMessage=this.i18nService.t("invalidFilePassword"),i;const s=new Pp(n.data),o=yield this.encryptService.decryptString(s,this.key);return yield t.parse.call(this,o)})}checkPassword(e,t){return W_(this,void 0,void 0,function*(){if(this.isNullOrWhitespace(t))return!1;const i=e.kdfType===Mv.PBKDF2_SHA256?new jv(e.kdfIterations):new Gv(e.kdfIterations,e.kdfMemory,e.kdfParallelism);this.key=yield this.keyGenerationService.deriveVaultExportKey(t,e.salt,i);const n=new Pp(e.encKeyValidation_DO_NOT_EDIT);try{return yield this.encryptService.decryptString(n,this.key),!0}catch(e){return!1}})}cannotParseFile(e){return!(e&&e.encrypted&&e.passwordProtected&&e.salt&&e.kdfIterations&&"number"==typeof e.kdfIterations&&null!=e.kdfType&&null!=Mv[e.kdfType]&&e.encKeyValidation_DO_NOT_EDIT&&e.data)}}class H_ extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{"null"===e.label&&(e.label=null);const i=this.initLoginCipher();i.name=this.getValueOrDefault(e.label,this.getValueOrDefault(this.nameFromUrl(e.domain),"--")),i.login.uris=this.makeUriArray(e.domain),i.login.password=this.getValueOrDefault(e.password),this.isNullOrWhitespace(e.email)&&!this.isNullOrWhitespace(e.username)?i.login.username=e.username:(i.login.username=this.getValueOrDefault(e.email),i.notes=this.getValueOrDefault(e.username)),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t))}}const J_=["!group_id","!group_name","!type","title","username","password","URL","url","note","id"];class Z_ extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{this.processFolder(t,this.getValueOrDefault(e["!group_name"]));const i=this.initLoginCipher();i.name=this.getValueOrDefault(e.title,"--"),i.login.username=this.getValueOrDefault(e.username),i.login.password=this.getValueOrDefault(e.password);const n=e.URL||e.url||e.Url;i.login.uris=this.makeUriArray(n);const r=e.note||e.Note||e.notes||e.Notes;r&&(i.notes=r);for(const t in e)if(e.hasOwnProperty(t)){const n=t.toLowerCase();!J_.some(e=>e.toLowerCase()===n)&&e[t]&&this.processKvp(i,t,e[t])}this.cleanupCipher(i),t.ciphers.push(i)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t))}}class Q_ extends e_{parse(e){const t=new Zz,i=this.parseXml(e);if(null==i)return t.success=!1,Promise.resolve(t);const n=i.querySelector("textarea");if(null==n||this.isNullOrWhitespace(n.textContent))return t.errorMessage="Missing textarea.",t.success=!1,Promise.resolve(t);return JSON.parse(n.textContent).forEach(e=>{const i=this.initLoginCipher();if(this.isNullOrWhitespace(e.label)||(i.name=e.label.split(" ")[0]),null==e.data||this.isNullOrWhitespace(e.data.notes)||(i.notes=e.data.notes.split("\\n").join("\n")),null!=e.currentVersion&&null!=e.currentVersion.fields)for(const t in e.currentVersion.fields){if(!e.currentVersion.fields.hasOwnProperty(t))continue;const n=e.currentVersion.fields[t];switch(null!=n.actionType?n.actionType.toLowerCase():null){case"password":i.login.password=this.getValueOrDefault(n.value);break;case"email":case"username":case"user":case"name":i.login.username=this.getValueOrDefault(n.value);break;case"url":i.login.uris=this.makeUriArray(n.value);break;default:{const e=null!=n.label?n.label.toLowerCase():null;null==i.login.password&&this.passwordFieldNames.indexOf(e)>-1?i.login.password=this.getValueOrDefault(n.value):null==i.login.username&&this.usernameFieldNames.indexOf(e)>-1?i.login.username=this.getValueOrDefault(n.value):(null==i.login.uris||0===i.login.uris.length)&&this.uriFieldNames.indexOf(e)>-1?i.login.uris=this.makeUriArray(n.value):this.processKvp(i,n.label,n.value);break}}}this.convertToNoteIfNeeded(i),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t)}}class eK extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{this.processFolder(t,this.getValueOrDefault(e.Category));const i=this.initLoginCipher();i.favorite="True"===this.getValueOrDefault(e.Favorite),i.name=this.getValueOrDefault(e.Entry,"--"),i.notes=this.getValueOrDefault(e.Note),i.login.username=this.getValueOrDefault(e.Username,e.Email),i.login.password=this.getValueOrDefault(e.Password),i.login.totp=this.getValueOrDefault(e.TOTP),i.login.uris=this.makeUriArray(e.Website),this.isNullOrWhitespace(e.Username)||this.processKvp(i,"Email",e.Email),this.processKvp(i,"Phone",e.Phone),this.processKvp(i,"PIN",e.PIN),this.processKvp(i,"Account",e.Account),this.processKvp(i,"Date",e.Date),this.convertToNoteIfNeeded(i),this.cleanupCipher(i),t.ciphers.push(i)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t))}}const tK=new Set(["title","note","username","password","url","otpSecret","category"]),iK=new Set(["type","title","first_name","middle_name","last_name","login","email","phone_number","address","country","state","city","zip","item_name"]),nK=new Set(["title","note"]);class rK extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);if(null==i)return t.success=!1,Promise.resolve(t);if(null!=i[0].type&&null!=i[0].title){if(1===i.filter(e=>"name"===e.type).length){const e=this.initLoginCipher();return e.type=nx.Identity,e.identity=new wO,i.forEach(t=>{this.parsePersonalInformationRecordAsIdentity(e,t)}),this.cleanupCipher(e),t.ciphers.push(e),t.success=!0,Promise.resolve(t)}}return i.forEach(e=>{const i=this.initLoginCipher(),n=Object.keys(e);"username"===n[0]&&(this.processFolder(t,e.category),this.parseCredentialsRecord(i,e)),"type"===n[0]&&"account_name"===n[1]&&this.parsePaymentRecord(i,e),"type"===n[0]&&"number"===n[1]&&this.parseIdRecord(i,e),"type"===n[0]&&"title"===n[1]&&this.parsePersonalInformationRecord(i,e),"title"===n[0]&&"note"===n[1]&&this.parseSecureNoteRecords(i,e),this.convertToNoteIfNeeded(i),this.cleanupCipher(i),t.ciphers.push(i)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t)}parseCredentialsRecord(e,t){e.type=nx.Login,e.login=new CO,e.name=t.title,e.notes=t.note,e.login.username=t.username,e.login.password=t.password,e.login.totp=Object.keys(t).includes("otpUrl")?t.otpUrl:t.otpSecret,e.login.uris=this.makeUriArray(t.url),this.importUnmappedFields(e,t,tK)}parsePaymentRecord(e,t){e.type=nx.Card,e.card=new mO,e.name=t.account_name;let i=[];switch(t.type){case"credit_card":e.card.cardholderName=t.account_name,e.card.number=t.cc_number,e.card.brand=mO.getCardBrandByPatterns(e.card.number),e.card.code=t.code,this.setCardExpiration(e,`${t.expiration_month}/${t.expiration_year}`),i=["account_name","account_holder","cc_number","code","expiration_month","expiration_year"];break;case"bank":e.card.cardholderName=t.account_holder,e.card.number=t.account_number,i=["account_name","account_holder","account_number"]}this.importUnmappedFields(e,t,new Set(i))}parseIdRecord(e,t){e.type=nx.Identity,e.identity=new wO;const i=["name","number"];switch(t.type){case"card":e.name=`${t.name} ${t.type}`,this.processFullName(e,t.name),e.identity.licenseNumber=t.number;break;case"passport":e.name=`${t.name} ${t.type}`,this.processFullName(e,t.name),e.identity.passportNumber=t.number;break;case"license":e.name=`${t.name} ${t.type}`,this.processFullName(e,t.name),e.identity.licenseNumber=t.number,e.identity.state=t.state,i.push("state");break;case"social_security":e.name=`${t.name} ${t.type}`,this.processFullName(e,t.name),e.identity.ssn=t.number;break;case"tax_number":e.name=t.type,e.identity.licenseNumber=t.number}this.importUnmappedFields(e,t,new Set(i))}parsePersonalInformationRecord(e,t){e.type=nx.SecureNote,e.secureNote.type=hx,"name"===t.type?e.name=`${t.title} ${t.first_name} ${t.middle_name} ${t.last_name}`.replace(" "," ").trim():e.name=t.item_name;const i=t;Object.keys(t).forEach(t=>{this.processKvp(e,t,i[t])})}parsePersonalInformationRecordAsIdentity(e,t){switch(t.type){case"name":this.processFullName(e,`${t.first_name} ${t.middle_name} ${t.last_name}`),e.identity.title=t.title,e.name=e.identity.fullName,e.identity.username=t.login;break;case"email":e.identity.email=t.email;break;case"number":e.identity.phone=t.phone_number;break;case"address":e.identity.address1=t.address,e.identity.city=t.city,e.identity.postalCode=t.zip,e.identity.state=t.state,e.identity.country=t.country}this.importUnmappedFields(e,t,iK)}parseSecureNoteRecords(e,t){e.type=nx.SecureNote,e.secureNote.type=hx,e.name=t.title,e.notes=t.note,this.importUnmappedFields(e,t,nK)}importUnmappedFields(e,t,i){Object.keys(t).filter(e=>!i.has(e)).forEach(i=>{const n=t;this.processKvp(e,i,n[i])})}}const sK=new Set(["ADDRESS","AUTHENTIFIANT","BANKSTATEMENT","IDCARD","IDENTITY","PAYMENTMEANS_CREDITCARD","PAYMENTMEAN_PAYPAL","EMAIL"]);class oK extends e_{parse(e){this.result=new Zz;const t=JSON.parse(e);if(null==t||0===t.length)return this.result.success=!1,Promise.resolve(this.result);null!=t.ADDRESS&&this.processAddress(t.ADDRESS),null!=t.AUTHENTIFIANT&&this.processAuth(t.AUTHENTIFIANT),null!=t.BANKSTATEMENT&&this.processNote(t.BANKSTATEMENT,"BankAccountName"),null!=t.IDCARD&&this.processNote(t.IDCARD,"Fullname"),null!=t.PAYMENTMEANS_CREDITCARD&&this.processCard(t.PAYMENTMEANS_CREDITCARD),null!=t.IDENTITY&&this.processIdentity(t.IDENTITY);for(const e in t)t.hasOwnProperty(e)&&!sK.has(e)&&this.processNote(t[e],null,"Generic Note");return this.result.success=!0,Promise.resolve(this.result)}processAuth(e){e.forEach(e=>{const t=this.initLoginCipher();t.name=this.getValueOrDefault(e.title),t.login.username=this.getValueOrDefault(e.login,this.getValueOrDefault(e.secondaryLogin)),this.isNullOrWhitespace(t.login.username)?t.login.username=this.getValueOrDefault(e.email):this.isNullOrWhitespace(e.email)||(t.notes="Email: "+e.email+"\n"),t.login.password=this.getValueOrDefault(e.password),t.login.uris=this.makeUriArray(e.domain),t.notes+=this.getValueOrDefault(e.note,""),this.convertToNoteIfNeeded(t),this.cleanupCipher(t),this.result.ciphers.push(t)})}processIdentity(e){e.forEach(e=>{const t=new RO;t.identity=new wO,t.type=nx.Identity,t.name=this.getValueOrDefault(e.fullName,"");const i=t.name.split(" ");i.length>0&&(t.identity.firstName=this.getValueOrDefault(i[0])),2===i.length?t.identity.lastName=this.getValueOrDefault(i[1]):3===i.length&&(t.identity.middleName=this.getValueOrDefault(i[1]),t.identity.lastName=this.getValueOrDefault(i[2])),t.identity.username=this.getValueOrDefault(e.pseudo),this.cleanupCipher(t),this.result.ciphers.push(t)})}processAddress(e){e.forEach(e=>{const t=new RO;t.identity=new wO,t.type=nx.Identity,t.name=this.getValueOrDefault(e.addressName),t.identity.address1=this.getValueOrDefault(e.addressFull),t.identity.city=this.getValueOrDefault(e.city),t.identity.state=this.getValueOrDefault(e.state),t.identity.postalCode=this.getValueOrDefault(e.zipcode),t.identity.country=this.getValueOrDefault(e.country),null!=t.identity.country&&(t.identity.country=t.identity.country.toUpperCase()),this.cleanupCipher(t),this.result.ciphers.push(t)})}processCard(e){e.forEach(e=>{const t=new RO;t.card=new mO,t.type=nx.Card,t.name=this.getValueOrDefault(e.bank),t.card.number=this.getValueOrDefault(e.cardNumber),t.card.brand=mO.getCardBrandByPatterns(t.card.number),t.card.cardholderName=this.getValueOrDefault(e.owner),this.isNullOrWhitespace(t.card.brand)||(this.isNullOrWhitespace(t.name)?t.name=t.card.brand:t.name+=" - "+t.card.brand),this.cleanupCipher(t),this.result.ciphers.push(t)})}processNote(e,t,i=null){e.forEach(e=>{const n=new RO;n.secureNote=new PO,n.type=nx.SecureNote,n.secureNote.type=hx,n.name=null!=i?i:this.getValueOrDefault(e[t]);for(const i in e)e.hasOwnProperty(i)&&i!==t&&this.processKvp(n,i,e[i].toString());this.cleanupCipher(n),this.result.ciphers.push(n)})}}class aK extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{const i=this.initLoginCipher();i.name=this.getValueOrDefault(e.Label,"--"),i.notes=this.getValueOrDefault(e.Notes);const n=this.getValueOrDefault(e.Text);this.isNullOrWhitespace(n)||(this.isNullOrWhitespace(i.notes)?i.notes=n:i.notes+="\n\n"+n);const r=e["Entry Type"];if("Password"===r)i.login.username=this.getValueOrDefault(e.Username),i.login.password=this.getValueOrDefault(e.Password),i.login.uris=this.makeUriArray(e["Site URL"]);else if("Credit Card"===r){i.type=nx.Card,i.card=new mO,i.card.cardholderName=this.getValueOrDefault(e["Name on card"]),i.card.number=this.getValueOrDefault(e["Card Number"]),i.card.brand=mO.getCardBrandByPatterns(i.card.number),i.card.code=this.getValueOrDefault(e.CVV);const t=this.getValueOrDefault(e.Expiry);if(!this.isNullOrWhitespace(t)){const e=t.split("/");e.length>1&&(i.card.expMonth=parseInt(e[0],null).toString(),i.card.expYear=(2e3+parseInt(e[1],null)).toString())}}this.convertToNoteIfNeeded(i),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t))}}class lK extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!1);if(null==i)return t.success=!1,Promise.resolve(t);let n=!0;return i.forEach(e=>{if(e.length<2||n&&("Title"===e[0]||"title"===e[0]))return void(n=!1);const i=this.initLoginCipher();if(i.notes=this.getValueOrDefault(e[e.length-1]),i.name=this.getValueOrDefault(e[0],"--"),2!==e.length&&(this.containsField(e,"username")||this.containsField(e,"password")||this.containsField(e,"email")||this.containsField(e,"url"))||(i.type=nx.SecureNote,i.secureNote=new PO,i.secureNote.type=hx),this.containsField(e,"cardholder")&&this.containsField(e,"number")&&this.containsField(e,"expiry date")&&(i.type=nx.Card,i.card=new mO),e.length>2&&e.length%2==0)for(let t=0;t<e.length-2;t+=2){const n=e[t+2];if(this.isNullOrWhitespace(n))continue;const r=e[t+1],s=r.toLowerCase();if(i.type===nx.Login){if("url"===s&&(null==i.login.uris||0===i.login.uris.length)){i.login.uris=this.makeUriArray(n);continue}if(("username"===s||"email"===s)&&this.isNullOrWhitespace(i.login.username)){i.login.username=n;continue}if("password"===s&&this.isNullOrWhitespace(i.login.password)){i.login.password=n;continue}if("totp"===s&&this.isNullOrWhitespace(i.login.totp)){i.login.totp=n;continue}}else if(i.type===nx.Card){if("cardholder"===s&&this.isNullOrWhitespace(i.card.cardholderName)){i.card.cardholderName=n;continue}if("number"===s&&this.isNullOrWhitespace(i.card.number)){i.card.number=n,i.card.brand=mO.getCardBrandByPatterns(i.card.number);continue}if("cvc"===s&&this.isNullOrWhitespace(i.card.code)){i.card.code=n;continue}if("expiry date"===s&&this.isNullOrWhitespace(i.card.expMonth)&&this.isNullOrWhitespace(i.card.expYear)){if(this.setCardExpiration(i,n))continue}else if("type"===s)continue}this.processKvp(i,r,n)}this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t)}containsField(e,t){return null!=e&&null!=t&&e.filter(e=>!this.isNullOrWhitespace(e)&&e.toLowerCase()===t.toLowerCase()).length>0}}const cK=new RegExp("androidapp://.*==@","g");class uK extends e_{parse(e){const t=new Zz,i=JSON.parse(e);if(null==i||null==i.items||0===i.items.length)return t.success=!1,Promise.resolve(t);const n=new Map,r=new Map,s=this.buildFolderTree(i.folders);return this.flattenFolderTree(null,s,n),n.forEach((e,i)=>{r.set(i,t.folders.length);const n=new SU;n.name=e,t.folders.push(n)}),i.items.forEach(e=>{null!=e.folders&&e.folders.length>0&&r.has(e.folders[0])&&t.folderRelationships.push([t.ciphers.length,r.get(e.folders[0])]);const i=this.initLoginCipher();i.name=this.getValueOrDefault(e.title),i.favorite=e.favorite>0,null!=e.template_type&&null!=e.fields&&e.fields.length>0&&(0===e.template_type.indexOf("login.")||0===e.template_type.indexOf("password.")?this.processLogin(i,e.fields):0===e.template_type.indexOf("creditcard.")?this.processCard(i,e.fields):e.template_type.indexOf("identity.")<0&&e.fields.some(e=>"password"===e.type&&!this.isNullOrWhitespace(e.value))?this.processLogin(i,e.fields):this.processNote(i,e.fields));const n=this.getValueOrDefault(e.note,"");n&&(i.notes=n.trimEnd()),this.convertToNoteIfNeeded(i),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t)}processLogin(e,t){const i=[];t.forEach(t=>{if(!this.isNullOrWhitespace(t.value)&&"section"!==t.type)if("username"!==t.type&&"email"!==t.type||!this.isNullOrWhitespace(e.login.username))if("password"===t.type&&this.isNullOrWhitespace(e.login.password))e.login.password=t.value;else if("totp"===t.type&&this.isNullOrWhitespace(e.login.totp))e.login.totp=t.value;else if("url"===t.type)i.push(t.value);else if(".Android#"===t.type){let e=t.value.startsWith("androidapp://")?t.value:"androidapp://"+t.value;e=e.replace("android://",""),e=e.replace(cK,"androidapp://"),i.push(e)}else this.processKvp(e,t.label,t.value,1===t.sensitive?ox.Hidden:ox.Text);else e.login.username=t.value}),e.login.uris=this.makeUriArray(i)}processCard(e,t){e.card=new mO,e.type=nx.Card,t.forEach(t=>{this.isNullOrWhitespace(t.value)||"section"===t.type||"ccType"===t.type||("ccName"===t.type&&this.isNullOrWhitespace(e.card.cardholderName)?e.card.cardholderName=t.value:"ccNumber"===t.type&&this.isNullOrWhitespace(e.card.number)?(e.card.number=t.value,e.card.brand=mO.getCardBrandByPatterns(e.card.number)):"ccCvc"===t.type&&this.isNullOrWhitespace(e.card.code)?e.card.code=t.value:"ccExpiry"===t.type&&this.isNullOrWhitespace(e.card.expYear)&&this.setCardExpiration(e,t.value)||this.processKvp(e,t.label,t.value,1===t.sensitive?ox.Hidden:ox.Text))})}processNote(e,t){t.forEach(t=>{this.isNullOrWhitespace(t.value)||"section"===t.type||this.processKvp(e,t.label,t.value,1===t.sensitive?ox.Hidden:ox.Text)})}buildFolderTree(e){if(null==e)return[];const t=[],i=new Map([]);return e.forEach(e=>{i.set(e.uuid,e),e.children=[]}),e.forEach(e=>{null!=e.parent_uuid&&""!==e.parent_uuid&&i.has(e.parent_uuid)?i.get(e.parent_uuid).children.push(e):t.push(e)}),t}flattenFolderTree(e,t,i){null!=t&&t.forEach(t=>{if(null!=t.title&&""!==t.title.trim()){let n=t.title.trim();null!=e&&""!==e.trim()&&(n=e+"/"+n),i.set(t.uuid,n),null!=t.children&&0!==t.children.length&&this.flattenFolderTree(n,t.children,i)}})}}class dK extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.filter(e=>"chrome://FirefoxAccounts"!==e.url).forEach(e=>{const i=this.initLoginCipher(),n=this.getValueOrDefault(e.url,this.getValueOrDefault(e.hostname));i.name=this.getValueOrDefault(this.nameFromUrl(n),"--"),i.login.username=this.getValueOrDefault(e.username),i.login.password=this.getValueOrDefault(e.password),i.login.uris=this.makeUriArray(n),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t))}}const hK=Object.freeze({Login:1,CreditCard:2});class pK extends e_{parse(e){const t=new Zz,i=JSON.parse(e);if(null==i||null==i.data)return t.success=!1,Promise.resolve(t);for(const[,e]of Object.entries(i.data)){const i=this.parseEntry(e);null!=i&&t.ciphers.push(i)}return t.success=!0,Promise.resolve(t)}parseEntry(e){const t=this.initLoginCipher();switch(t.name=this.getValueOrDefault(e.service),t.notes=this.getValueOrDefault(e.notes),t.favorite=e.favorite>0,e.type){case hK.Login:this.handleLoginEntry(e,t);break;case hK.CreditCard:this.handleCreditCardEntry(e,t);break;default:return}return this.convertToNoteIfNeeded(t),this.cleanupCipher(t),t}handleLoginEntry(e,t){t.login.username=this.getValueOrDefault(e.username),t.login.password=this.getValueOrDefault(e.password),t.login.uris=this.makeUriArray(e.url)}handleCreditCardEntry(e,t){t.type=nx.Card,t.card=new mO,t.card.cardholderName=this.getValueOrDefault(e.username),t.card.number=this.getValueOrDefault(e.creditNumber),t.card.brand=mO.getCardBrandByPatterns(t.card.number),t.card.code=this.getValueOrDefault(e.creditCvv),this.isNullOrWhitespace(e.creditExpiry)||this.setCardExpiration(t,e.creditExpiry)||this.processKvp(t,"Expiration",e.creditExpiry),this.isNullOrWhitespace(e.password)||this.processKvp(t,"PIN",e.password)}}class vK extends e_{parse(e){const t=new Zz,i=JSON.parse(e);if(null==i||0===Object.keys(i).length)return t.success=!1,Promise.resolve(t);for(const e in i)i.hasOwnProperty(e)&&!this.isNullOrWhitespace(e)&&0!==i[e].length&&i[e].forEach(i=>{if(this.isNullOrWhitespace(i.display_name)||0!==i.display_name.indexOf("http"))return;this.processFolder(t,e);const n=this.initLoginCipher();if(n.name=i.display_name.replace("http://","").replace("https://",""),n.name.length>30&&(n.name=n.name.substring(0,30)),n.login.password=this.getValueOrDefault(i.secret),n.login.uris=this.makeUriArray(i.display_name),null!=i.attributes){n.login.username=null!=i.attributes?this.getValueOrDefault(i.attributes.username_value):null;for(const e in i.attributes)i.attributes.hasOwnProperty(e)&&"username_value"!==e&&"xdg:schema"!==e&&this.processKvp(n,e,i.attributes[e])}this.convertToNoteIfNeeded(n),this.cleanupCipher(n),t.ciphers.push(n)});return this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t)}}const fK="Notes\n\n",mK="Applications\n\n",gK="Websites\n\n",yK="\n---\n";class bK extends e_{parse(e){const t=new Zz;let i,n,r,s=this.splitNewLine(e).join("\n");if(-1!==s.indexOf(fK)){const e=s.split(fK);e.length>1&&(s=e[0],i=e[1])}if(-1!==s.indexOf(mK)){const e=s.split(mK);e.length>1&&(s=e[0],n=e[1])}if(0===s.indexOf(gK)){const e=s.split(gK);e.length>1&&(s=e[0],r=e[1])}const o=this.parseDataCategory(i),a=this.parseDataCategory(n),l=this.parseDataCategory(r);return o.forEach(e=>{const i=this.initLoginCipher();i.name=this.getValueOrDefault(e.get("Name")),i.notes=this.getValueOrDefault(e.get("Text")),this.cleanupCipher(i),t.ciphers.push(i)}),l.concat(a).forEach(e=>{const i=this.initLoginCipher(),n=e.has("Website name")?"Website name":"Application";i.name=this.getValueOrDefault(e.get(n),""),this.isNullOrWhitespace(e.get("Login name"))||(this.isNullOrWhitespace(i.name)||(i.name+=": "),i.name+=e.get("Login name")),i.notes=this.getValueOrDefault(e.get("Comment")),e.has("Website URL")&&(i.login.uris=this.makeUriArray(e.get("Website URL"))),i.login.username=this.getValueOrDefault(e.get("Login")),i.login.password=this.getValueOrDefault(e.get("Password")),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t)}parseDataCategory(e){if(this.isNullOrWhitespace(e)||-1===e.indexOf(yK))return[];const t=[];return e.split(yK).forEach(e=>{if(-1===e.indexOf("\n"))return;const i=new Map;let n,r;e.split("\n").forEach(e=>{if(null!=n)return void(n+="\n"+e);const t=e.indexOf(":");let s,o;-1!==t&&(s=e.substring(0,t),e.length>t+1&&(o=e.substring(t+2)),null!=s&&i.set(s,o),"Comment"!==s&&"Text"!==s||(n=o,r=s))}),null!=n&&null!=r&&i.set(r,n),0!==i.size&&t.push(i)}),t}}class wK extends e_{constructor(){super(...arguments),this.result=new Zz}parse(e){const t=this.parseXml(e);if(null==t)return this.result.success=!1,Promise.resolve(this.result);const i=t.querySelector("KeePassFile");if(null==i)return this.result.errorMessage="Missing `KeePassFile` node.",this.result.success=!1,Promise.resolve(this.result);const n=i.querySelector("Root");if(null==n)return this.result.errorMessage="Missing `KeePassFile > Root` node.",this.result.success=!1,Promise.resolve(this.result);const r=n.querySelector("Group");return null==r?(this.result.errorMessage="Missing `KeePassFile > Root > Group` node.",this.result.success=!1,Promise.resolve(this.result)):(this.traverse(r,!0,""),this.organization&&this.moveFoldersToCollections(this.result),this.result.success=!0,Promise.resolve(this.result))}traverse(e,t,i){const n=this.result.folders.length;let r=i;if(!t){""!==r&&(r+="/");const t=this.querySelectorDirectChild(e,"Name");r+=null==t?"-":t.textContent;const i=new SU;i.name=r,this.result.folders.push(i)}this.querySelectorAllDirectChild(e,"Entry").forEach(e=>{const i=this.result.ciphers.length,r=this.initLoginCipher();this.querySelectorAllDirectChild(e,"String").forEach(e=>{const t=this.querySelectorDirectChild(e,"Value"),i=null!=t?t.textContent:null;if(this.isNullOrWhitespace(i))return;const n=this.querySelectorDirectChild(e,"Key"),s=null!=n?n.textContent:null;if("URL"===s)r.login.uris=this.makeUriArray(i);else if("UserName"===s)r.login.username=i;else if("Password"===s)r.login.password=i;else if("otp"===s)r.login.totp=i.replace("key=","");else if("Title"===s)r.name=i;else if("Notes"===s)r.notes+=i+"\n";else{const e=t.attributes;if(e.length>0&&null!=e.ProtectInMemory&&"True"===e.ProtectInMemory.value){null==r.fields&&(r.fields=[]);const e=new gO;e.type=ox.Hidden,e.name=s,e.value=i,r.fields.push(e)}else this.processKvp(r,s,i,ox.Text)}}),this.cleanupCipher(r),this.result.ciphers.push(r),t||this.result.folderRelationships.push([i,n])}),this.querySelectorAllDirectChild(e,"Group").forEach(e=>{this.traverse(e,!1,r)})}}class SK extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{if(this.isNullOrWhitespace(e.Title))return;e.Group=!this.isNullOrWhitespace(e.Group)&&e.Group.startsWith("Root/")?e.Group.replace("Root/",""):e.Group;const i=this.isNullOrWhitespace(e.Group)?null:e.Group;this.processFolder(t,i);const n=this.initLoginCipher();n.notes=this.getValueOrDefault(e.Notes),n.name=this.getValueOrDefault(e.Title,"--"),n.login.username=this.getValueOrDefault(e.Username),n.login.password=this.getValueOrDefault(e.Password),n.login.uris=this.makeUriArray(e.URL),n.login.totp=this.getValueOrDefault(e.TOTP),this.cleanupCipher(n),t.ciphers.push(n)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t))}}class kK extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!1);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{if(e.length<6)return;this.processFolder(t,e[0]);const i=this.initLoginCipher(),n=this.getValueOrDefault(e[5]);if(n&&(i.notes=n.trimEnd()),i.name=this.getValueOrDefault(e[1],"--"),i.login.username=this.getValueOrDefault(e[2]),i.login.password=this.getValueOrDefault(e[3]),i.login.uris=this.makeUriArray(e[4]),e.length>7)for(let t=7;t<e.length;t+=2)"TFC:Keeper"==e[t]?i.login.totp=e[t+1]:this.processKvp(i,e[t],e[t+1]);this.cleanupCipher(i),t.ciphers.push(i)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t))}}class IK extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{const i=t.ciphers.length;let n=t.folders.length,r=e.grouping;null!=r&&(r=r.replace(/\\/g,"/").replace(/[\x00-\x1F\x7F-\x9F]/g,""));const s="(none)"!==this.getValueOrDefault(r,"(none)");let o=s;if(s)for(let e=0;e<t.folders.length;e++)if(t.folders[e].name===r){o=!1,n=e;break}const a=this.buildBaseCipher(e);if(a.type===nx.Login)a.notes=this.getValueOrDefault(e.extra),a.login=new CO,a.login.uris=this.makeUriArray(e.url),a.login.username=this.getValueOrDefault(e.username),a.login.password=this.getValueOrDefault(e.password),a.login.totp=this.getValueOrDefault(e.totp);else if(a.type===nx.SecureNote)this.parseSecureNote(e,a);else if(a.type===nx.Card)a.card=this.parseCard(e),a.notes=this.getValueOrDefault(e.notes);else if(a.type===nx.Identity&&(a.identity=this.parseIdentity(e),a.notes=this.getValueOrDefault(e.notes),!this.isNullOrWhitespace(e.ccnum))){const i=this.buildBaseCipher(e);i.identity=null,i.type=nx.Card,i.card=this.parseCard(e),t.ciphers.push(i)}if(t.ciphers.push(a),o){const e=new SU;e.name=r,t.folders.push(e)}s&&t.folderRelationships.push([i,n])}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t))}buildBaseCipher(e){const t=new RO;return e.hasOwnProperty("profilename")&&e.hasOwnProperty("profilelanguage")?(t.favorite=!1,t.name=this.getValueOrDefault(e.profilename,"--"),t.type=nx.Card,this.isNullOrWhitespace(e.title)&&this.isNullOrWhitespace(e.firstname)&&this.isNullOrWhitespace(e.lastname)&&this.isNullOrWhitespace(e.address1)&&this.isNullOrWhitespace(e.phone)&&this.isNullOrWhitespace(e.username)&&this.isNullOrWhitespace(e.email)||(t.type=nx.Identity)):(t.favorite=!this.organization&&"1"===this.getValueOrDefault(e.fav,"0"),t.name=this.getValueOrDefault(e.name,"--"),t.type="http://sn"===e.url?nx.SecureNote:nx.Login),t}parseCard(e){const t=new mO;if(t.cardholderName=this.getValueOrDefault(e.ccname),t.number=this.getValueOrDefault(e.ccnum),t.code=this.getValueOrDefault(e.cccsc),t.brand=mO.getCardBrandByPatterns(t.number),!this.isNullOrWhitespace(e.ccexp)&&e.ccexp.indexOf("-")>-1){const i=e.ccexp.split("-");i.length>1&&(t.expYear=i[0],t.expMonth=i[1],2===t.expMonth.length&&"0"===t.expMonth[0]&&(t.expMonth=t.expMonth[1]))}return t}parseIdentity(e){const t=new wO;return t.title=this.getValueOrDefault(e.title),t.firstName=this.getValueOrDefault(e.firstname),t.middleName=this.getValueOrDefault(e.middlename),t.lastName=this.getValueOrDefault(e.lastname),t.username=this.getValueOrDefault(e.username),t.company=this.getValueOrDefault(e.company),t.ssn=this.getValueOrDefault(e.ssn),t.address1=this.getValueOrDefault(e.address1),t.address2=this.getValueOrDefault(e.address2),t.address3=this.getValueOrDefault(e.address3),t.city=this.getValueOrDefault(e.city),t.state=this.getValueOrDefault(e.state),t.postalCode=this.getValueOrDefault(e.zip),t.country=this.getValueOrDefault(e.country),t.email=this.getValueOrDefault(e.email),t.phone=this.getValueOrDefault(e.phone),this.isNullOrWhitespace(t.title)||(t.title=t.title.charAt(0).toUpperCase()+t.title.slice(1)),t}parseSecureNote(e,t){const i=this.splitNewLine(e.extra);let n=!1;if(i.length){const e=i[0].split(":");if(e.length>1&&"NoteType"===e[0]&&("Credit Card"===e[1]||"Address"===e[1])){if("Credit Card"===e[1]){const e=this.parseSecureNoteMapping(t,i,{Number:"number","Name on Card":"cardholderName","Security Code":"code","Expiration Date":"expMonth"});if(this.isNullOrWhitespace(e.expMonth)||","===e.expMonth)e.expMonth=void 0;else{const[t,i]=e.expMonth.split(",");if(this.isNullOrWhitespace(t))e.expMonth=void 0;else{const i=new Date(Date.parse(t.trim()+" 1, 2012")).getMonth()+1;isNaN(i)?e.expMonth=void 0:e.expMonth=i.toString()}this.isNullOrWhitespace(i)||(e.expYear=i)}t.type=nx.Card,t.card=e}else if("Address"===e[1]){const e=this.parseSecureNoteMapping(t,i,{Title:"title","First Name":"firstName","Last Name":"lastName","Middle Name":"middleName",Company:"company","Address 1":"address1","Address 2":"address2","Address 3":"address3","City / Town":"city",State:"state","Zip / Postal Code":"postalCode",Country:"country","Email Address":"email",Username:"username"});t.type=nx.Identity,t.identity=e}n=!0}}n||(t.secureNote=new PO,t.secureNote.type=hx,t.notes=this.getValueOrDefault(e.extra))}parseSecureNoteMapping(e,t,i){const n={};let r=!1;return t.forEach(t=>{let s=null,o=null;if(!r){if(this.isNullOrWhitespace(t))return;const e=t.indexOf(":");if(-1===e?s=t:(s=t.substring(0,e),t.length>e&&(o=t.substring(e+1))),this.isNullOrWhitespace(s)||this.isNullOrWhitespace(o)||"NoteType"===s)return}r?e.notes+="\n"+t:"Notes"===s?(this.isNullOrWhitespace(e.notes)?e.notes=o:e.notes+="\n"+o,r=!0):i.hasOwnProperty(s)?n[i[s]]=o:this.processKvp(e,s,o)}),n}}class CK extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!1);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{if(e.length<4)return;const i=this.initLoginCipher();i.name=this.getValueOrDefault(e[0],"--"),i.login.username=this.getValueOrDefault(e[2]),i.login.password=this.getValueOrDefault(e[3]),i.login.uris=this.makeUriArray(e[1]),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t))}}class TK extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{const i=this.initLoginCipher();i.name=this.getValueOrDefault(e.DisplayName,"--"),i.notes=this.getValueOrDefault(e.Notes),i.login.username=this.getValueOrDefault(e.UserName),i.login.password=this.getValueOrDefault(e.Password),i.login.uris=this.makeUriArray(e.Url),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t))}}class PK extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!1,{delimiter:","});return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{if(e.length<3)return;const i="Unassigned"!==this.getValueOrDefault(e[2],"Unassigned")?e[2]:null;this.processFolder(t,i);const n=this.initLoginCipher();if(n.name=this.getValueOrDefault(e[0].split("|")[0],"--"),"Web Logins"===e[1]||"Login"===e[1])n.login.username=this.getValueOrDefault(this.splitValueRetainingLastPart(e[5])),n.login.uris=this.makeUriArray(this.splitValueRetainingLastPart(e[4])),n.login.password=this.getValueOrDefault(this.splitValueRetainingLastPart(e[6])),n.notes=this.isNullOrWhitespace(e[3])?null:e[3].split("\\n").join("\n");else if("Credit Card"===e[1]){n.type=nx.Card,n.card.number=this.getValueOrDefault(this.splitValueRetainingLastPart(e[4]));const[t,i]=this.getValueOrDefault(this.splitValueRetainingLastPart(e[5])).split("/");n.card.expMonth=t.trim(),n.card.expYear=i.trim();const r=RegExp("^Security Code\\|\\d*\\|"),s=e.find(e=>r.test(e));n.card.code=this.getValueOrDefault(this.splitValueRetainingLastPart(s));const o=RegExp("^Name on Card\\|\\d*\\|"),a=e.find(e=>e.match(o));n.card.cardholderName=this.getValueOrDefault(this.splitValueRetainingLastPart(a)),n.card.brand=this.getValueOrDefault(this.splitValueRetainingLastPart(e[9]),"");const l=RegExp("\\|\\d*\\|"),c=e.slice(2).filter(e=>!this.isNullOrWhitespace(e)&&!l.test(e)),u=[8,10,11].filter(t=>e[t]&&l.test(e[t])).map(t=>e[t]).map(e=>`${e.split("|")[0]}: ${this.getValueOrDefault(this.splitValueRetainingLastPart(e),"")}`);n.notes=[...c,...u].join("\n")}else if(e.length>3){n.type=nx.SecureNote,n.secureNote=new PO,n.secureNote.type=hx;for(let t=3;t<e.length;t++)this.isNullOrWhitespace(e[t])||(n.notes+=e[t]+"\n")}this.isNullOrWhitespace(e[1])||n.type===nx.Login||n.type===nx.Card||(n.name=e[1]+": "+n.name),this.cleanupCipher(n),t.ciphers.push(n)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t))}splitValueRetainingLastPart(e){return e&&e.split("|").slice(0,2).concat(e.split("|").slice(2).join("|")).pop()}}const FK=["nickname","additionalInfo"],RK=new Set(FK.concat(["url","username","password","twofaSecret"])),xK=new Set(FK.concat(["cardNumber","cardName","exp_month","exp_year","cvv"])),AK=new Set(FK.concat(["title","firstName","middleName","lastName","email","firstAddressLine","secondAddressLine","city","country","zipCode"])),DK=new Set(FK.concat(["idName","idNumber","idCountry"])),EK=new Set(FK.concat(["authToken"])),$K=new Set(FK.concat(["content"]));class OK extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{const i=this.initLoginCipher();if(i.name=this.getValueOrDefault(e.nickname,"--"),i.notes=this.getValueOrDefault(e.additionalInfo,"").trimEnd(),void 0!==e.url)i.login.uris=this.makeUriArray(e.url),i.login.username=this.getValueOrDefault(e.username),i.login.password=this.getValueOrDefault(e.password),i.login.totp=this.getValueOrDefault(e.twofaSecret),this.importUnmappedFields(i,e,RK);else if(void 0!==e.authToken)i.login.totp=this.getValueOrDefault(e.authToken),this.importUnmappedFields(i,e,EK);else if(void 0!==e.cardNumber)i.card=new mO,i.type=nx.Card,i.card.cardholderName=this.getValueOrDefault(e.cardName),i.card.number=this.getValueOrDefault(e.cardNumber),i.card.brand=mO.getCardBrandByPatterns(i.card.number),i.card.expMonth=this.getValueOrDefault(e.exp_month),i.card.expYear=this.getValueOrDefault(e.exp_year),i.card.code=this.getValueOrDefault(e.cvv),this.importUnmappedFields(i,e,xK);else if(void 0!==e.firstName)i.identity=new wO,i.type=nx.Identity,i.identity.title=this.getValueOrDefault(e.title),i.identity.firstName=this.getValueOrDefault(e.firstName),i.identity.middleName=this.getValueOrDefault(e.middleName),i.identity.lastName=this.getValueOrDefault(e.lastName),i.identity.phone=this.getValueOrDefault(e.number),i.identity.email=this.getValueOrDefault(e.email),i.identity.address1=this.getValueOrDefault(e.firstAddressLine),i.identity.address2=this.getValueOrDefault(e.secondAddressLine),i.identity.city=this.getValueOrDefault(e.city),i.identity.country=this.getValueOrDefault(e.country),i.identity.postalCode=this.getValueOrDefault(e.zipCode),this.importUnmappedFields(i,e,AK);else if(void 0!==e.idType){switch(i.identity=new wO,i.type=nx.Identity,this.processFullName(i,e.idName),i.identity.country=this.getValueOrDefault(e.idCountry),e.idType){case"Passport":i.identity.passportNumber=e.idNumber;break;case"Social Security":i.identity.ssn=e.idNumber;break;default:i.identity.licenseNumber=e.idNumber}this.importUnmappedFields(i,e,DK)}else{if(void 0===e.content)return;i.secureNote=new PO,i.type=nx.SecureNote,i.secureNote.type=hx,i.notes=this.getValueOrDefault(e.content,"").trimEnd(),this.importUnmappedFields(i,e,$K)}this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t))}importUnmappedFields(e,t,i){Object.keys(t).filter(e=>!i.has(e)).forEach(i=>{const n=t;this.processKvp(e,i,n[i])})}}const UK=new Set(["Organisationseinheit","Informationen","Beschreibung","Benutzername","Passwort","Internetseite","One-Time Passwort"]);class MK extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{this.processFolder(t,e.Organisationseinheit);const i=this.initLoginCipher(),n=this.getValueOrDefault(e.Informationen);n&&(i.notes=n.trimEnd()),i.name=this.getValueOrDefault(e.Beschreibung,"--"),i.login.username=this.getValueOrDefault(e.Benutzername),i.login.password=this.getValueOrDefault(e.Passwort),i.login.uris=this.makeUriArray(e.Internetseite),i.login.totp=this.getValueOrDefault(e["One-Time Passwort"]),this.importUnmappedFields(i,e,UK),this.cleanupCipher(i),t.ciphers.push(i)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t))}importUnmappedFields(e,t,i){Object.keys(t).filter(e=>!i.has(e)).forEach(i=>{const n=t;this.processKvp(e,i,n[i])})}}class NK extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{const i=this.evaluateType(e);if(void 0===i)return;this.processFolder(t,e.folder);const n=new RO;if(n.name=this.getValueOrDefault(e.name,"--"),n.notes=this.getValueOrDefault(e.note),e.custom_fields){const t=JSON.parse(e.custom_fields);t&&t.length>0&&t.forEach(e=>{let t=ox.Text;"hidden"==e.type&&(t=ox.Hidden),this.processKvp(n,e.label,e.value,t)})}switch(i){case nx.Login:if(n.type=nx.Login,n.login=new CO,n.login.username=this.getValueOrDefault(e.username),n.login.password=this.getValueOrDefault(e.password),e.additional_urls){const t=JSON.parse(e.additional_urls),i=[e.url,...t];n.login.uris=this.makeUriArray(i)}else n.login.uris=this.makeUriArray(e.url);break;case nx.Card:n.type=nx.Card,n.card.cardholderName=this.getValueOrDefault(e.cardholdername),n.card.number=this.getValueOrDefault(e.cardnumber),n.card.code=this.getValueOrDefault(e.cvc),n.card.brand=mO.getCardBrandByPatterns(n.card.number),this.setCardExpiration(n,e.expirydate);break;case nx.Identity:n.type=nx.Identity,this.processFullName(n,this.getValueOrDefault(e.full_name)),n.identity.address1=this.getValueOrDefault(e.address1),n.identity.address2=this.getValueOrDefault(e.address2),n.identity.city=this.getValueOrDefault(e.city),n.identity.state=this.getValueOrDefault(e.state),n.identity.postalCode=this.getValueOrDefault(e.zipcode),n.identity.country=this.getValueOrDefault(e.country),null!=n.identity.country&&(n.identity.country=n.identity.country.toUpperCase()),n.identity.email=this.getValueOrDefault(e.email),n.identity.phone=this.getValueOrDefault(e.phone_number);break;case nx.SecureNote:n.type=nx.SecureNote,n.secureNote.type=hx}this.cleanupCipher(n),t.ciphers.push(n)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t))}evaluateType(e){switch(e.type){case"password":return nx.Login;case"credit_card":return nx.Card;case"note":return nx.SecureNote;case"identity":return nx.Identity}}}class VK extends e_{constructor(){super(...arguments),this.result=new Zz}parse(e){return e.split(this.newLineRegex).forEach(e=>{if(this.isNullOrWhitespace(e)||"{"!==e[0])return;const t=JSON.parse(e);if(!0===t.trashed)return;const i=this.initLoginCipher();this.isNullOrWhitespace(t.hmac)?this.processStandardItem(t,i):this.processWinOpVaultItem(t,i),this.convertToNoteIfNeeded(i),this.cleanupCipher(i),this.result.ciphers.push(i)}),this.result.success=!0,Promise.resolve(this.result)}processWinOpVaultItem(e,t){if(null!=e.overview&&(t.name=this.getValueOrDefault(e.overview.title),null!=e.overview.URLs)){const i=[];e.overview.URLs.forEach(e=>{this.isNullOrWhitespace(e.u)||i.push(e.u)}),t.login.uris=this.makeUriArray(i)}null!=e.details&&(null!=e.details.passwordHistory&&this.parsePasswordHistory(e.details.passwordHistory,t),this.isNullOrWhitespace(e.details.ccnum)&&this.isNullOrWhitespace(e.details.cvv)?this.isNullOrWhitespace(e.details.firstname)&&this.isNullOrWhitespace(e.details.address1)||(t.type=nx.Identity,t.identity=new wO):(t.type=nx.Card,t.card=new mO),t.type!==nx.Login||this.isNullOrWhitespace(e.details.password)||(t.login.password=e.details.password),this.isNullOrWhitespace(e.details.notesPlain)||(t.notes=e.details.notesPlain.split(this.newLineRegex).join("\n")+"\n"),null!=e.details.fields&&this.parseFields(e.details.fields,t,"designation","value","name"),null!=e.details.sections&&e.details.sections.forEach(e=>{null!=e.fields&&this.parseFields(e.fields,t,"n","v","t")}))}processStandardItem(e,t){if(t.favorite=!(!e.openContents||!e.openContents.faveIndex),t.name=this.getValueOrDefault(e.title),"securenotes.SecureNote"===e.typeName?(t.type=nx.SecureNote,t.secureNote=new PO,t.secureNote.type=hx):"wallet.financial.CreditCard"===e.typeName?(t.type=nx.Card,t.card=new mO):"identities.Identity"===e.typeName?(t.type=nx.Identity,t.identity=new wO):t.login.uris=this.makeUriArray(e.location),null!=e.secureContents){if(null!=e.secureContents.passwordHistory&&this.parsePasswordHistory(e.secureContents.passwordHistory,t),this.isNullOrWhitespace(e.secureContents.notesPlain)||(t.notes=e.secureContents.notesPlain.split(this.newLineRegex).join("\n")+"\n"),t.type===nx.Login&&(this.isNullOrWhitespace(e.secureContents.password)||(t.login.password=e.secureContents.password),null!=e.secureContents.URLs)){const i=[];e.secureContents.URLs.forEach(e=>{this.isNullOrWhitespace(e.url)||i.push(e.url)}),i.length>0&&(t.login.uris=this.makeUriArray(i))}null!=e.secureContents.fields&&this.parseFields(e.secureContents.fields,t,"designation","value","name"),null!=e.secureContents.sections&&e.secureContents.sections.forEach(e=>{null!=e.fields&&this.parseFields(e.fields,t,"n","v","t")})}}parsePasswordHistory(e,t){const i=e.length>5?5:e.length;t.passwordHistory=e.filter(e=>!this.isNullOrWhitespace(e.value)&&null!=e.time).sort((e,t)=>t.time-e.time).slice(0,i).map(e=>{const t=new TO;return t.password=e.value,t.lastUsedDate=new Date((""+e.time).length>=13?e.time:1e3*e.time),t})}parseFields(e,t,i,n,r){e.forEach(e=>{if(null==e[n]||""===e[n].toString().trim())return;const s="date"===e.k?new Date(1e3*e[n]).toUTCString():e[n].toString(),o=null!=e[i]?e[i].toString():null;if(t.type===nx.Login){if(this.isNullOrWhitespace(t.login.username)&&"username"===o)return void(t.login.username=s);if(this.isNullOrWhitespace(t.login.password)&&"password"===o)return void(t.login.password=s);if(this.isNullOrWhitespace(t.login.totp)&&null!=o&&o.startsWith("TOTP_"))return void(t.login.totp=s)}else if(t.type===nx.Card){if(this.isNullOrWhitespace(t.card.number)&&"ccnum"===o)return t.card.number=s,void(t.card.brand=mO.getCardBrandByPatterns(t.card.number));if(this.isNullOrWhitespace(t.card.code)&&"cvv"===o)return void(t.card.code=s);if(this.isNullOrWhitespace(t.card.cardholderName)&&"cardholder"===o)return void(t.card.cardholderName=s);if(this.isNullOrWhitespace(t.card.expiration)&&"expiry"===o&&6===s.length)return t.card.expMonth=s.substr(4,2),"0"===t.card.expMonth[0]&&(t.card.expMonth=t.card.expMonth.substr(1,1)),void(t.card.expYear=s.substr(0,4));if("type"===o)return}else if(t.type===nx.Identity){const i=t.identity;if(this.isNullOrWhitespace(i.firstName)&&"firstname"===o)return void(i.firstName=s);if(this.isNullOrWhitespace(i.lastName)&&"lastname"===o)return void(i.lastName=s);if(this.isNullOrWhitespace(i.middleName)&&"initial"===o)return void(i.middleName=s);if(this.isNullOrWhitespace(i.phone)&&"defphone"===o)return void(i.phone=s);if(this.isNullOrWhitespace(i.company)&&"company"===o)return void(i.company=s);if(this.isNullOrWhitespace(i.email)&&"email"===o)return void(i.email=s);if(this.isNullOrWhitespace(i.username)&&"username"===o)return void(i.username=s);if("address"===o){const{street:t,city:r,country:s,zip:o}=e[n];return i.address1=this.getValueOrDefault(t),i.city=this.getValueOrDefault(r),this.isNullOrWhitespace(s)||(i.country=s.toUpperCase()),void(i.postalCode=this.getValueOrDefault(o))}}const a=this.isNullOrWhitespace(e[r])?"no_name":e[r];if("password"===a&&null!=t.passwordHistory&&t.passwordHistory.some(e=>e.password===s))return;const l="concealed"===e.k?ox.Hidden:ox.Text;this.processKvp(t,a,s,l)})}}const BK=Object.freeze({Login:"001",CreditCard:"002",SecureNote:"003",Identity:"004",Password:"005",Document:"006",SoftwareLicense:"100",BankAccount:"101",Database:"102",DriversLicense:"103",OutdoorLicense:"104",Membership:"105",Passport:"106",RewardsProgram:"107",SocialSecurityNumber:"108",WirelessRouter:"109",Server:"110",EmailAccount:"111",API_Credential:"112",MedicalRecord:"113",SSH_Key:"114"}),jK=Object.freeze({TextOrHtml:"T",EmailAddress:"E",URL:"U",Number:"N",Password:"P",TextArea:"A",PhoneNumber:"TEL",CheckBox:"C"});class GK extends e_{constructor(){super(...arguments),this.result=new Zz}parse(e){return JSON.parse(e).accounts[0].vaults.forEach(e=>{e.items.forEach(e=>{if("archived"===e.state)return;const t=this.initLoginCipher(),i=e.categoryUuid;switch(i){case BK.Login:case BK.Database:case BK.Password:case BK.WirelessRouter:case BK.Server:case BK.API_Credential:t.type=nx.Login,t.login=new CO;break;case BK.CreditCard:case BK.BankAccount:t.type=nx.Card,t.card=new mO;break;case BK.SecureNote:case BK.SoftwareLicense:case BK.EmailAccount:case BK.MedicalRecord:t.type=nx.SecureNote,t.secureNote=new PO,t.secureNote.type=hx;break;case BK.Identity:case BK.DriversLicense:case BK.OutdoorLicense:case BK.Membership:case BK.Passport:case BK.RewardsProgram:case BK.SocialSecurityNumber:t.type=nx.Identity,t.identity=new wO;break;case BK.SSH_Key:t.type=nx.SshKey,t.sshKey=new FO}t.favorite=1===e.favIndex,this.processOverview(e.overview,t),this.processLoginFields(e,t),this.processDetails(i,e.details,t),this.parsePasswordHistory(e.details.passwordHistory,t),this.processSections(i,e.details.sections,t),this.isNullOrWhitespace(e.details.notesPlain)||(t.notes=e.details.notesPlain.split(this.newLineRegex).join("\n").trimEnd()),this.convertToNoteIfNeeded(t),this.cleanupCipher(t),this.result.ciphers.push(t)})}),this.organization&&this.moveFoldersToCollections(this.result),this.result.success=!0,Promise.resolve(this.result)}processOverview(e,t){if(null!=e){if(t.name=this.getValueOrDefault(e.title),null!=e.urls){const i=[];e.urls.forEach(e=>{this.isNullOrWhitespace(e.url)||i.push(e.url)}),t.login.uris=this.makeUriArray(i)}if(null!=e.tags&&e.tags.length>0){const t=this.capitalize(e.tags[0]);this.processFolder(this.result,t)}}}capitalize(e){return e.trim().replace(/\w\S*/g,e=>e.replace(/^\w/,e=>e.toUpperCase()))}processLoginFields(e,t){null!=e.details&&null!=e.details.loginFields&&0!==e.details.loginFields.length&&e.details.loginFields.forEach(e=>{if("username"===e.designation&&""!==e.value)return t.type=nx.Login,void(t.login.username=e.value);if("password"===e.designation&&""!==e.value)return t.type=nx.Login,void(t.login.password=e.value);let i=e.value,n=ox.Text;switch(e.fieldType){case jK.Password:n=ox.Hidden;break;case jK.CheckBox:i=""!==e.value?"true":"false",n=ox.Boolean}this.processKvp(t,e.name,i,n)})}processDetails(e,t,i){e===BK.Password&&null!=t&&(i.login.password=t.password)}processSections(e,t,i){null!=t&&0!==t.length&&t.forEach(t=>{null!=t.fields&&this.parseSectionFields(e,t.fields,i,t.title)})}parseSectionFields(e,t,i,n){t.forEach(t=>{const r=Object.keys(t.value)[0],s=t;if(null==s.value||null==s.value[r]||""===s.value[r])return;const o=this.getFieldName(t.title,n),a=this.extractValue(t.value,r);if(i.type===nx.Login){if(this.fillLogin(t,a,i))return;switch(e){case BK.Login:case BK.Database:case BK.EmailAccount:case BK.WirelessRouter:break;case BK.Server:if(this.isNullOrWhitespace(i.login.uri)&&"url"===t.id)return void(i.login.uris=this.makeUriArray(a));break;case BK.API_Credential:if(this.fillApiCredentials(t,a,i))return}}else if(i.type===nx.Card){if(this.fillCreditCard(t,a,i))return;if(e===BK.BankAccount&&this.fillBankAccount(t,a,i))return}else if(i.type===nx.Identity){if(this.fillIdentity(t,a,i,r))return;if("address"===r){const{street:e,city:n,country:r,zip:s,state:o}=t.value.address;return i.identity.address1=this.getValueOrDefault(e),i.identity.city=this.getValueOrDefault(n),this.isNullOrWhitespace(r)||(i.identity.country=r.toUpperCase()),i.identity.postalCode=this.getValueOrDefault(s),void(i.identity.state=this.getValueOrDefault(o))}switch(e){case BK.Identity:break;case BK.DriversLicense:if(this.fillDriversLicense(t,a,i))return;break;case BK.OutdoorLicense:if(this.fillOutdoorLicense(t,a,i))return;break;case BK.Membership:if(this.fillMembership(t,a,i))return;break;case BK.Passport:if(this.fillPassport(t,a,i))return;break;case BK.RewardsProgram:if(this.fillRewardsProgram(t,a,i))return;break;case BK.SocialSecurityNumber:if(this.fillSSN(t,a,i))return}}else if(i.type===nx.SshKey&&"sshKey"===r){const{privateKey:e}=t.value.sshKey.metadata,n=(0,nm.bnN)(e);return i.sshKey.privateKey=n.privateKey,i.sshKey.publicKey=n.publicKey,void(i.sshKey.keyFingerprint=n.fingerprint)}if("email"===r){const{email_address:e,provider:n}=t.value.email;return this.processKvp(i,o,e,ox.Text),void this.processKvp(i,"provider",n,ox.Text)}if("password"===t.title&&null!=i.passwordHistory&&i.passwordHistory.some(e=>e.password===a))return;t.guarded&&i.reprompt===tx.None&&(i.reprompt=tx.Password);const l="concealed"===r?ox.Hidden:ox.Text;this.processKvp(i,o,a,l)})}getFieldName(e,t){return this.isNullOrWhitespace(e)?this.isNullOrWhitespace(t)?"":t:e}extractValue(e,t){return"date"===t?new Date(1e3*e.date).toUTCString():"monthYear"===t?e.monthYear.toString():e[t]}fillLogin(e,t,i){const n=this.getFieldName(e.title);return this.isNullOrWhitespace(i.login.username)&&"username"===n?(i.login.username=t,!0):this.isNullOrWhitespace(i.login.password)&&"password"===n?(i.login.password=t,!0):!(!this.isNullOrWhitespace(i.login.totp)||null==e.id||!e.id.startsWith("TOTP_"))&&(i.login.totp=t,!0)}fillApiCredentials(e,t,i){const n=this.getFieldName(e.title);return this.isNullOrWhitespace(i.login.password)&&"credential"===n?(i.login.password=t,!0):!(!this.isNullOrWhitespace(i.login.uri)||"hostname"!==n)&&(i.login.uris=this.makeUriArray(t),!0)}fillCreditCard(e,t,i){if(this.isNullOrWhitespace(i.card.number)&&"ccnum"===e.id)return i.card.number=t,i.card.brand=mO.getCardBrandByPatterns(i.card.number),!0;if(this.isNullOrWhitespace(i.card.code)&&"cvv"===e.id)return i.card.code=t,!0;if(this.isNullOrWhitespace(i.card.cardholderName)&&"cardholder"===e.id)return i.card.cardholderName=t,!0;if(this.isNullOrWhitespace(i.card.expiration)&&"expiry"===e.id){const e=t.toString().trim();return i.card.expMonth=e.substring(4,6),"0"===i.card.expMonth[0]&&(i.card.expMonth=i.card.expMonth.substring(1,2)),i.card.expYear=e.substring(0,4),!0}return"type"===e.id}fillBankAccount(e,t,i){return!(!this.isNullOrWhitespace(i.card.cardholderName)||"owner"!==e.id)&&(i.card.cardholderName=t,!0)}fillIdentity(e,t,i,n){if(this.isNullOrWhitespace(i.identity.firstName)&&"firstname"===e.id)return i.identity.firstName=t,!0;if(this.isNullOrWhitespace(i.identity.lastName)&&"lastname"===e.id)return i.identity.lastName=t,!0;if(this.isNullOrWhitespace(i.identity.middleName)&&"initial"===e.id)return i.identity.middleName=t,!0;if(this.isNullOrWhitespace(i.identity.phone)&&"defphone"===e.id)return i.identity.phone=t,!0;if(this.isNullOrWhitespace(i.identity.company)&&"company"===e.id)return i.identity.company=t,!0;if(this.isNullOrWhitespace(i.identity.email)){if("email"===n){const{email_address:t,provider:n}=e.value.email;return i.identity.email=this.getValueOrDefault(t),this.processKvp(i,"provider",n,ox.Text),!0}if("email"===e.id)return i.identity.email=t,!0}return!(!this.isNullOrWhitespace(i.identity.username)||"username"!==e.id)&&(i.identity.username=t,!0)}fillDriversLicense(e,t,i){return this.isNullOrWhitespace(i.identity.firstName)&&"fullname"===e.id?(this.processFullName(i,t),!0):this.isNullOrWhitespace(i.identity.address1)&&"address"===e.id?(i.identity.address1=t,!0):this.isNullOrWhitespace(i.identity.country)&&"country"===e.id?(i.identity.country=t,!0):this.isNullOrWhitespace(i.identity.state)&&"state"===e.id?(i.identity.state=t,!0):!(!this.isNullOrWhitespace(i.identity.licenseNumber)||"number"!==e.id)&&(i.identity.licenseNumber=t,!0)}fillOutdoorLicense(e,t,i){return this.isNullOrWhitespace(i.identity.firstName)&&"name"===e.id?(this.processFullName(i,t),!0):this.isNullOrWhitespace(i.identity.country)&&"country"===e.id?(i.identity.country=t,!0):!(!this.isNullOrWhitespace(i.identity.state)||"state"!==e.id)&&(i.identity.state=t,!0)}fillMembership(e,t,i){return this.isNullOrWhitespace(i.identity.firstName)&&"member_name"===e.id?(this.processFullName(i,t),!0):this.isNullOrWhitespace(i.identity.company)&&"org_name"===e.id?(i.identity.company=t,!0):!(!this.isNullOrWhitespace(i.identity.phone)||"phone"!==e.id)&&(i.identity.phone=t,!0)}fillPassport(e,t,i){return this.isNullOrWhitespace(i.identity.firstName)&&"fullname"===e.id?(this.processFullName(i,t),!0):this.isNullOrWhitespace(i.identity.country)&&"issuing_country"===e.id?(i.identity.country=t,!0):!(!this.isNullOrWhitespace(i.identity.passportNumber)||"number"!==e.id)&&(i.identity.passportNumber=t,!0)}fillRewardsProgram(e,t,i){return this.isNullOrWhitespace(i.identity.firstName)&&"member_name"===e.id?(this.processFullName(i,t),!0):!(!this.isNullOrWhitespace(i.identity.company)||"company_name"!==e.id)&&(i.identity.company=t,!0)}fillSSN(e,t,i){return this.isNullOrWhitespace(i.identity.firstName)&&"name"===e.id?(this.processFullName(i,t),!0):!(!this.isNullOrWhitespace(i.identity.ssn)||"number"!==e.id)&&(i.identity.ssn=t,!0)}parsePasswordHistory(e,t){if(null==e||0===e.length)return;const i=e.length>5?5:e.length;t.passwordHistory=e.filter(e=>!this.isNullOrWhitespace(e.value)&&null!=e.time).sort((e,t)=>t.time-e.time).slice(0,i).map(e=>{const t=new TO;return t.password=e.value,t.lastUsedDate=new Date((""+e.time).length>=13?e.time:1e3*e.time),t})}}class LK{constructor(e,t,i){this.importRecord=e,this.property=t,this.cipher=i,this.lowerProperty=t.toLowerCase()}}const zK=["ainfo","autosubmit","notesplain","ps","scope","tags","title","uuid","notes"];class _K extends e_{constructor(){super(...arguments),this.loginPropertyParsers=[this.setLoginUsername,this.setLoginPassword,this.setLoginUris],this.creditCardPropertyParsers=[this.setCreditCardNumber,this.setCreditCardVerification,this.setCreditCardCardholderName,this.setCreditCardExpiry],this.identityPropertyParsers=[this.setIdentityFirstName,this.setIdentityInitial,this.setIdentityLastName,this.setIdentityUserName,this.setIdentityEmail,this.setIdentityPhone,this.setIdentityCompany]}parse(e){const t=new Zz,i=this.parseCsv(e,!0,{quoteChar:'"',escapeChar:"\\"});return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{if(this.isNullOrWhitespace(this.getProp(e,"title")))return;const i=this.initLoginCipher();i.name=this.getValueOrDefault(this.getProp(e,"title"),"--"),this.setNotes(e,i),this.setCipherType(e,i);let n=null;for(const t in e){if(!e.hasOwnProperty(t)||this.isNullOrWhitespace(e[t]))continue;const r=new LK(e,t,i);i.type===nx.Login&&this.setKnownLoginValue(r)||(i.type===nx.Card&&this.setKnownCreditCardValue(r)||i.type===nx.Identity&&this.setKnownIdentityValue(r)||(n=this.setUnknownValue(r,n)))}i.type===nx.Login&&!this.isNullOrWhitespace(n)&&this.isNullOrWhitespace(i.login.username)&&-1===n.indexOf("://")&&(i.login.username=n),this.convertToNoteIfNeeded(i),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t))}getProp(e,t){return Object.entries(e).reduce((e,t)=>(e[t[0].toLowerCase()]=t[1],e),{})[t.toLowerCase()]}getPropByRegexp(e,t){const i=Object.keys(e).reduce((e,i)=>(i.match(t)&&e.push(i),e),[]);return 0===i.length?null:e[i[0]]}getPropIncluding(e,t){const i=Object.keys(e).reduce((e,i)=>(i.toLowerCase().includes(t.toLowerCase())&&e.push(i),e),[]);return 0===i.length?null:e[i[0]]}setNotes(e,t){t.notes=this.getValueOrDefault(this.getProp(e,"notesPlain"),"")+"\n"+this.getValueOrDefault(this.getProp(e,"notes"),"")+"\n",t.notes.trim()}setKnownLoginValue(e){return this.loginPropertyParsers.reduce((t,i)=>(t||(t=i.bind(this)(e)),t),!1)}setKnownCreditCardValue(e){return this.creditCardPropertyParsers.reduce((t,i)=>(t||(t=i.bind(this)(e)),t),!1)}setKnownIdentityValue(e){return this.identityPropertyParsers.reduce((t,i)=>(t||(t=i.bind(this)(e)),t),!1)}setUnknownValue(e,t){if(-1===zK.indexOf(e.lowerProperty)&&!e.lowerProperty.startsWith("section:")&&!e.lowerProperty.startsWith("section ")){if(null==t&&"email"===e.lowerProperty)return e.importRecord[e.property];if("created date"===e.lowerProperty||"modified date"===e.lowerProperty){const t=new Date(1e3*parseInt(e.importRecord[e.property],10)).toUTCString();return this.processKvp(e.cipher,"1Password "+e.property,t),null}e.lowerProperty.includes("password")||e.lowerProperty.includes("key")||e.lowerProperty.includes("secret")?this.processKvp(e.cipher,e.property,e.importRecord[e.property],ox.Hidden):this.processKvp(e.cipher,e.property,e.importRecord[e.property])}return null}setIdentityFirstName(e){return!(!this.isNullOrWhitespace(e.cipher.identity.firstName)||!e.lowerProperty.includes("first name"))&&(e.cipher.identity.firstName=e.importRecord[e.property],!0)}setIdentityInitial(e){return!(!this.isNullOrWhitespace(e.cipher.identity.middleName)||!e.lowerProperty.includes("initial"))&&(e.cipher.identity.middleName=e.importRecord[e.property],!0)}setIdentityLastName(e){return!(!this.isNullOrWhitespace(e.cipher.identity.lastName)||!e.lowerProperty.includes("last name"))&&(e.cipher.identity.lastName=e.importRecord[e.property],!0)}setIdentityUserName(e){return!(!this.isNullOrWhitespace(e.cipher.identity.username)||!e.lowerProperty.includes("username"))&&(e.cipher.identity.username=e.importRecord[e.property],!0)}setIdentityCompany(e){return!(!this.isNullOrWhitespace(e.cipher.identity.company)||!e.lowerProperty.includes("company"))&&(e.cipher.identity.company=e.importRecord[e.property],!0)}setIdentityPhone(e){return!(!this.isNullOrWhitespace(e.cipher.identity.phone)||!e.lowerProperty.includes("default phone"))&&(e.cipher.identity.phone=e.importRecord[e.property],!0)}setIdentityEmail(e){return!(!this.isNullOrWhitespace(e.cipher.identity.email)||!e.lowerProperty.includes("email"))&&(e.cipher.identity.email=e.importRecord[e.property],!0)}setCreditCardNumber(e){return!(!this.isNullOrWhitespace(e.cipher.card.number)||!e.lowerProperty.includes("number"))&&(e.cipher.card.number=e.importRecord[e.property],e.cipher.card.brand=mO.getCardBrandByPatterns(e.cipher.card.number),!0)}setCreditCardVerification(e){return!(!this.isNullOrWhitespace(e.cipher.card.code)||!e.lowerProperty.includes("verification number"))&&(e.cipher.card.code=e.importRecord[e.property],!0)}setCreditCardCardholderName(e){return!(!this.isNullOrWhitespace(e.cipher.card.cardholderName)||!e.lowerProperty.includes("cardholder name"))&&(e.cipher.card.cardholderName=e.importRecord[e.property],!0)}setCreditCardExpiry(e){return!(!this.isNullOrWhitespace(e.cipher.card.expiration)||!e.lowerProperty.includes("expiry date")||7!==e.importRecord[e.property].length)&&(e.cipher.card.expMonth=e.importRecord[e.property].substr(0,2),"0"===e.cipher.card.expMonth[0]&&(e.cipher.card.expMonth=e.cipher.card.expMonth.substr(1,1)),e.cipher.card.expYear=e.importRecord[e.property].substr(3,4),!0)}setLoginPassword(e){return!(!this.isNullOrWhitespace(e.cipher.login.password)||"password"!==e.lowerProperty)&&(e.cipher.login.password=e.importRecord[e.property],!0)}setLoginUsername(e){return!(!this.isNullOrWhitespace(e.cipher.login.username)||"username"!==e.lowerProperty)&&(e.cipher.login.username=e.importRecord[e.property],!0)}setLoginUris(e){if((null==e.cipher.login.uris||0===e.cipher.login.uris.length)&&"urls"===e.lowerProperty){const t=e.importRecord[e.property].split(this.newLineRegex);return e.cipher.login.uris=this.makeUriArray(t),!0}return"url"===e.lowerProperty&&(null==e.cipher.login.uris&&(e.cipher.login.uris=[]),e.cipher.login.uris.concat(this.makeUriArray(e.importRecord[e.property])),!0)}}class KK extends _K{setCipherType(e,t){switch(this.getValueOrDefault(this.getProp(e,"type"),"Login")){case"Credit Card":t.type=nx.Card,t.card=new mO,zK.push("type");break;case"Identity":t.type=nx.Identity,t.identity=new wO,zK.push("type");break;case"Login":case"Secure Note":zK.push("type")}}}class XK extends _K{constructor(){super(),this.identityPropertyParsers.push(this.setIdentityAddress)}setCipherType(e,t){t.type=nx.Login,t.login=new CO,this.isNullOrWhitespace(this.getPropByRegexp(e,/\d+: number/i))||this.isNullOrWhitespace(this.getPropByRegexp(e,/\d+: expiry date/i))||(t.type=nx.Card,t.card=new mO),this.isNullOrWhitespace(this.getPropByRegexp(e,/name \d+: first name/i))&&this.isNullOrWhitespace(this.getPropByRegexp(e,/name \d+: initial/i))&&this.isNullOrWhitespace(this.getPropByRegexp(e,/name \d+: last name/i))&&this.isNullOrWhitespace(this.getPropByRegexp(e,/internet \d+: email/i))||(t.type=nx.Identity,t.identity=new wO)}setIdentityAddress(e){return!!e.lowerProperty.match(/address \d+: address/i)&&(this.processKvp(e.cipher,"address",e.importRecord[e.property]),!0)}setCreditCardExpiry(e){if(this.isNullOrWhitespace(e.cipher.card.expiration)&&e.lowerProperty.includes("expiry date")){const t=e.importRecord[e.property].split("/");return e.cipher.card.expMonth=t[0],"0"===e.cipher.card.expMonth[0]&&2===e.cipher.card.expMonth.length&&(e.cipher.card.expMonth=e.cipher.card.expMonth.substr(1,1)),e.cipher.card.expYear=t[2].length>4?t[2].substr(0,4):t[2],!0}return!1}}class qK extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!1);if(null==i)return t.success=!1,Promise.resolve(t);let n=null;return i.forEach(e=>{if(null==n)return void(n=e.map(e=>e));if(e.length<2||e.length!==n.length)return;if(!this.isNullOrWhitespace(e[1]))if(this.organization){e[1].split(",").forEach(e=>{e=e.trim();let i=!0,n=t.collections.length;for(let r=0;r<t.collections.length;r++)if(t.collections[r].name===e){i=!1,n=r;break}if(i){const i=new SR({name:e});t.collections.push(i)}t.collectionRelationships.push([t.ciphers.length,n])})}else{const i=e[1].split(","),n=i.length>0?i[0].trim():null;this.processFolder(t,n)}const i=this.initLoginCipher();i.name=this.getValueOrDefault(e[0],"--");for(let t=2;t<e.length;t++){const r=n[t].trim().toLowerCase();this.isNullOrWhitespace(e[t])||this.isNullOrWhitespace(r)||(this.usernameFieldNames.indexOf(r)>-1?i.login.username=e[t]:this.passwordFieldNames.indexOf(r)>-1?i.login.password=e[t]:this.uriFieldNames.indexOf(r)>-1?i.login.uris=this.makeUriArray(e[t]):this.processKvp(i,n[t],e[t]))}this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t)}}class WK extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{this.processFolder(t,this.getValue("category",e));const i=this.initLoginCipher();i.notes=this.getValue("description",e),i.name=this.getValueOrDefault(this.getValue("title",e),"--"),i.login.username=this.getValue("username",e),i.login.password=this.getValue("password",e),i.login.uris=this.makeUriArray(this.getValue("site",e)),this.processKvp(i,"Password 2",this.getValue("password2",e)),this.cleanupCipher(i),t.ciphers.push(i)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t))}getValue(e,t){return this.getValueOrDefault(t[e],this.getValueOrDefault(t[" "+e]))}}class YK extends e_{parse(e){const t=new Zz,i=JSON.parse(e);return null==i||null==i.passwords||0===i.passwords.length?(t.success=!1,Promise.resolve(t)):1==i.encrypted?(t.success=!1,t.errorMessage="Unable to import an encrypted passky backup.",Promise.resolve(t)):(i.passwords.forEach(e=>{const i=this.initLoginCipher();i.name=e.website,i.login.username=e.username,i.login.password=e.password,i.login.uris=this.makeUriArray(e.website),i.notes=e.message,this.convertToNoteIfNeeded(i),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t))}}class HK extends e_{parse(e){const t=new Zz,i=JSON.parse(e);return null==i||0===i.length?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{if(null!=e.tags&&e.tags.length>0){const i=e.tags[0].text;this.processFolder(t,i)}const i=this.initLoginCipher();i.name=e.label,i.login.username=this.getValueOrDefault(e.username),this.isNullOrWhitespace(i.login.username)?i.login.username=this.getValueOrDefault(e.email):this.isNullOrWhitespace(e.email)||(i.notes="Email: "+e.email+"\n"),i.login.password=this.getValueOrDefault(e.password),i.login.uris=this.makeUriArray(e.url),i.notes+=this.getValueOrDefault(e.description,""),null!=e.otp&&(i.login.totp=this.getValueOrDefault(e.otp.secret)),null!=e.custom_fields&&e.custom_fields.forEach(e=>{switch(e.field_type){case"text":case"password":this.processKvp(i,e.label,e.value)}}),this.convertToNoteIfNeeded(i),this.cleanupCipher(i),t.ciphers.push(i)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t))}}class JK extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{const i=this.isNullOrWhitespace(e.Tags)?null:JSON.parse(e.Tags),n=null!=i&&null!=i.tags&&i.tags.length>0?i.tags.map(e=>{try{const t=JSON.parse(e);return this.getValueOrDefault(t.tag)}catch(e){}return null}).filter(e=>!this.isNullOrWhitespace(e)):null;this.organization&&null!=n&&n.length>0?n.forEach(e=>{let i=!0,n=t.collections.length;for(let r=0;r<t.collections.length;r++)if(t.collections[r].name===e){i=!1,n=r;break}if(i){const i=new SR({name:e});t.collections.push(i)}t.collectionRelationships.push([t.ciphers.length,n])}):!this.organization&&null!=n&&n.length>0&&this.processFolder(t,n[0]);const r=this.initLoginCipher();r.notes=this.getValueOrDefault(e.Notes,""),r.notes+="\n\n"+this.getValueOrDefault(e["Shared Notes"],"")+"\n",r.name=this.getValueOrDefault(e["Entry Name"],"--"),r.login.username=this.getValueOrDefault(e["User ID"]),r.login.password=this.getValueOrDefault(e.Password),r.login.uris=this.makeUriArray(e.URL),null!=e.__parsed_extra&&e.__parsed_extra.length>0&&e.__parsed_extra.forEach(e=>{this.isNullOrWhitespace(e)||(r.notes+="\n"+e)});const s=this.isNullOrWhitespace(e["Extra Fields"])?null:JSON.parse(e["Extra Fields"]),o=null!=s&&null!=s.extraFields&&s.extraFields.length>0?s.extraFields.map(e=>{try{return JSON.parse(e)}catch(e){}return null}):null;null!=o&&o.forEach(e=>{null!=e&&this.processKvp(r,e.name,e.data)}),this.cleanupCipher(r),t.ciphers.push(r)}),t.success=!0,Promise.resolve(t))}}class ZK extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!1);if(null==i)return t.success=!1,Promise.resolve(t);let n=!0;return i.forEach(e=>{if(5!==e.length&&e.length<9)return;const i=10===e.length&&"0"===e[0],r=this.initLoginCipher();if(r.name=this.getValueOrDefault(e[i?1:0],"--"),r.login.username=this.getValueOrDefault(e[i?2:1]),r.login.password=this.getValueOrDefault(e[i?3:2]),5===e.length)n=!1,r.notes=this.getValueOrDefault(e[4]),r.login.uris=this.makeUriArray(e[3]);else{const n=this.getValueOrDefault(e[i?9:8],"(None)");let s="(None)"!==n?n.split("\\").join("/"):null;null!=s&&(s=n.split(" > ").join("/"),s=n.split(">").join("/")),this.processFolder(t,s),r.notes=this.getValueOrDefault(e[i?5:3]),r.login.uris=this.makeUriArray(e[4])}this.convertToNoteIfNeeded(r),this.cleanupCipher(r),t.ciphers.push(r)}),n&&this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t)}}class QK extends e_{parse(e){const t=new Zz,i=JSON.parse(e);if(null==i||null==i.items)return t.success=!1,Promise.resolve(t);const n=new Map;i.folders.forEach(e=>{n.set(e.id,e.name)});const r=new Map;return n.forEach((e,i)=>{r.set(i,t.folders.length);const n=new SU;n.name=e,t.folders.push(n)}),i.items.forEach(e=>{const i=this.initLoginCipher();if(i.name=this.getValueOrDefault(e.name,"--"),i.login.uris=this.makeUriArray(e.login_url),null!=e.folder&&r.has(e.folder)&&t.folderRelationships.push([t.ciphers.length,r.get(e.folder)]),null!=e.identifiers){this.isNullOrWhitespace(e.identifiers.notes)||(i.notes=e.identifiers.notes.split("\\r\\n").join("\n").split("\\n").join("\n")),"CreditCard"===e.type&&(i.card=new mO,i.type=nx.Card);for(const t in e.identifiers){if(!e.identifiers.hasOwnProperty(t))continue;const n=e.identifiers[t],r=null!=n?n.toString():null;if(!this.isNullOrWhitespace(r)&&"notes"!==t&&"ignoreItemInSecurityScore"!==t)if("custom_fields"!==t){if(i.type===nx.Card){if("cardNumber"===t){i.card.number=r,i.card.brand=mO.getCardBrandByPatterns(i.card.number);continue}if("nameOnCard"===t){i.card.cardholderName=r;continue}if("security_code"===t){i.card.code=r;continue}if("expires"===t){try{const e=new Date(r);i.card.expYear=e.getFullYear().toString(),i.card.expMonth=(e.getMonth()+1).toString()}catch(e){}continue}if("cardType"===t)continue}else{if(("username"===t||"email"===t)&&this.isNullOrWhitespace(i.login.username)){i.login.username=r;continue}if("password"===t){i.login.password=r;continue}if("totp"===t){i.login.totp=r;continue}if((null==i.login.uris||0===i.login.uris.length)&&this.uriFieldNames.indexOf(t)>-1){i.login.uris=this.makeUriArray(r);continue}}this.processKvp(i,t,r)}else n.forEach(e=>{this.processKvp(i,e.name,e.value)})}this.convertToNoteIfNeeded(i),this.cleanupCipher(i),t.ciphers.push(i)}}),t.success=!0,Promise.resolve(t)}}const eX=Object.freeze({Password:"0",CreditCard:"1",SoftwareLicense:"2",Identity:"3",Information:"4",Banking:"5",EncryptedFile:"6",Document:"7",RDP:"8",Putty:"9",TeamViewer:"10",Certificate:"11"}),tX=Object.freeze({Password:"1",Memo:"2",Date:"3",Number:"4",Boolean:"5",Decimal:"6",Email:"7",URL:"8"});class iX extends e_{constructor(){super(...arguments),this.result=new Zz,this._favouritesLookupTable=new Set}parse(e){const t=this.parseXml(e);if(null==t)return this.result.success=!1,Promise.resolve(this.result);const i=t.querySelector("passwordfile");if(null==i)return this.result.errorMessage="Missing `passwordfile` node.",this.result.success=!1,Promise.resolve(this.result);const n=this.querySelectorDirectChild(i,"header");if(null==n)return this.result.success=!1,Promise.resolve(this.result);let r=this.querySelectorDirectChild(n,"version");if(null==r&&(r=this.querySelectorDirectChild(n,"dataformat"),null==r))return this.result.success=!1,Promise.resolve(this.result);if(!r.textContent.startsWith("17"))return this.result.errorMessage="Unsupported export version detected - (only 17.0 is supported)",this.result.success=!1,Promise.resolve(this.result);const s=this.querySelectorDirectChild(n,"encrypted");if(null!=s&&"True"==s.textContent)return this.result.errorMessage="Encrypted Password Depot files are not supported.",this.result.success=!1,Promise.resolve(this.result);const o=i.querySelector("passwords");return null==o?(this.result.errorMessage="Missing `passwordfile > passwords` node.",this.result.success=!1,Promise.resolve(this.result)):(this.buildFavouritesLookupTable(i),this.querySelectorAllDirectChild(o,"group").forEach(e=>{this.traverse(e,"")}),this.organization&&this.moveFoldersToCollections(this.result),this.result.success=!0,Promise.resolve(this.result))}traverse(e,t){const i=this.result.folders.length;let n=t;""!==n&&(n+="/");const r=e.attributes.getNamedItem("fingerprint");if(""!=(null==r?void 0:r.textContent)&&"null"!=r.textContent){const t=e.attributes.getNamedItem("name");n+=null==t?"-":t.textContent;const i=new SU;i.name=n,this.result.folders.push(i)}this.querySelectorAllDirectChild(e,"item").forEach(e=>{const t=this.result.ciphers.length,r=this.initLoginCipher();let s=eX.Password;const o=e.children;for(let e=0;e<o.length;e++){const t=o[e];if("hitems"!==t.tagName)if("description"!==t.tagName)if("comment"!==t.tagName)if("type"!==t.tagName)(s!==eX.Password&&s!==eX.RDP&&s!==eX.Putty&&s!==eX.TeamViewer&&s!==eX.Banking&&s!==eX.Certificate&&s!==eX.EncryptedFile||!this.parseLoginFields(t,r))&&("fingerprint"===t.tagName&&this._favouritesLookupTable.has(t.textContent)&&(r.favorite=!0),"customfields"!==t.tagName?s!==eX.Banking||"tans"!==t.tagName?this.processKvp(r,t.tagName,t.textContent,ox.Text):this.querySelectorAllDirectChild(t,"tan").forEach(e=>{this.parseBankingTANs(e,r)}):this.parseCustomFields(t,s,r));else switch(s=t.textContent,s){case eX.Password:case eX.RDP:case eX.Putty:case eX.TeamViewer:case eX.Banking:case eX.Certificate:case eX.EncryptedFile:r.type=nx.Login,r.login=new CO;break;case eX.CreditCard:r.type=nx.Card,r.card=new mO;break;case eX.SoftwareLicense:case eX.Information:case eX.Document:r.type=nx.SecureNote,r.secureNote=new PO,r.secureNote.type=hx;break;case eX.Identity:r.type=nx.Identity,r.identity=new wO}else r.notes=t.textContent;else r.name=t.textContent}this.cleanupCipher(r),this.result.ciphers.push(r),""!==n&&this.result.folderRelationships.push([t,i])}),this.querySelectorAllDirectChild(e,"group").forEach(e=>{this.traverse(e,n)})}parseCustomFields(e,t,i){this.querySelectorAllDirectChild(e,"field").forEach(e=>{const n=this.parseCustomField(e);if(null!=n){switch(t){case eX.CreditCard:if(this.parseCreditCardCustomFields(n,i))return;break;case eX.Identity:if(this.parseIdentityCustomFields(n,i))return;break;case eX.Information:if(this.parseInformationCustomFields(n,i))return}this.processKvp(i,n.name,n.value,n.type)}})}parseLoginFields(e,t){return"username"===e.tagName?(t.login.username=e.textContent,!0):"password"===e.tagName?(t.login.password=e.textContent,!0):"url"===e.tagName&&(t.login.uris=this.makeUriArray(e.textContent),!0)}parseCustomField(e){let t,i,n,r=tX.Memo;if(e.hasAttributes()){if(t=e.getAttribute("name"),null==t)return null;i=e.getAttribute("value");const s=e.getAttribute("type");r=null!=s?s:tX.Memo,n=e.getAttribute("visible")}else{const s=this.querySelectorDirectChild(e,"name");if(t=null!=s?s.textContent:null,null==t)return null;const o=this.querySelectorDirectChild(e,"value");i=null!=o?o.textContent:null;const a=this.querySelectorDirectChild(e,"type");r=null!=a?a.textContent:tX.Memo;const l=this.querySelectorDirectChild(e,"visible");n=null!=l?l.textContent:null}if(r===tX.Date&&!isNaN(i)){const e=parseInt(i);i=new Date((e-25569)*(1e3*86400)).toLocaleDateString()}return r===tX.Password?{name:t,value:i,type:ox.Hidden,linkedId:null}:r===tX.Boolean?{name:t,value:i,type:ox.Boolean,linkedId:null}:"0"==n?{name:t,value:i,type:ox.Hidden,linkedId:null}:{name:t,value:i,type:ox.Text,linkedId:null}}parseCreditCardCustomFields(e,t){return"IDS_CardHolder"===e.name?(t.card.cardholderName=e.value,!0):"IDS_CardNumber"===e.name?(t.card.number=e.value,t.card.brand=mO.getCardBrandByPatterns(t.card.number),!0):"IDS_CardExpires"===e.name?(this.setCardExpiration(t,e.value),!0):"IDS_CardCode"===e.name&&(t.card.code=e.value,!0)}parseIdentityCustomFields(e,t){return"IDS_IdentityName"===e.name?(this.processFullName(t,e.value),!0):"IDS_IdentityEmail"===e.name?(t.identity.email=e.value,!0):"IDS_IdentityFirstName"===e.name?(t.identity.firstName=e.value,!0):"IDS_IdentityLastName"===e.name?(t.identity.lastName=e.value,!0):"IDS_IdentityCompany"===e.name?(t.identity.company=e.value,!0):"IDS_IdentityAddress1"===e.name?(t.identity.address1=e.value,!0):"IDS_IdentityAddress2"===e.name?(t.identity.address2=e.value,!0):"IDS_IdentityCity"===e.name?(t.identity.city=e.value,!0):"IDS_IdentityState"===e.name?(t.identity.state=e.value,!0):"IDS_IdentityZIP"===e.name?(t.identity.postalCode=e.value,!0):"IDS_IdentityCountry"===e.name?(t.identity.country=e.value,!0):"IDS_IdentityPhone"===e.name&&(t.identity.phone=e.value,!0)}parseInformationCustomFields(e,t){return"IDS_InformationText"===e.name&&(t.notes=e.value,!0)}parseBankingTANs(e,t){let i="0";const n=e.children;for(let e=0;e<n.length;e++){const r=n[e];"number"!==r.tagName?this.processKvp(t,`tan_${i}_${r.tagName}`,r.textContent):i=r.textContent}}buildFavouritesLookupTable(e){const t=this.querySelectorDirectChild(e,"favorites");if(null==t)return;const i=atob(t.textContent);i.indexOf("\r\n")>0?i.split("\r\n").forEach(e=>{this._favouritesLookupTable.add(e)}):i.split("\n").forEach(e=>{this._favouritesLookupTable.add(e)})}}class nX extends e_{parse(e){const t=new Zz,i=this.parseXml(e);if(null==i)return t.success=!1,Promise.resolve(t);const n=i.querySelectorAll("PasswordManager > record");return Array.from(n).forEach(e=>{const i=this.querySelectorDirectChild(e,"Category"),n=null==i||this.isNullOrWhitespace(i.textContent)||"Unfiled"===i.textContent?null:i.textContent;this.processFolder(t,n);const r=this.querySelectorDirectChild(e,"Account-Name"),s=this.querySelectorDirectChild(e,"User-Id"),o=this.querySelectorDirectChild(e,"Password"),a=this.querySelectorDirectChild(e,"URL"),l=this.querySelectorDirectChild(e,"Notes"),c=this.initLoginCipher();c.name=null!=r?this.getValueOrDefault(r.textContent,"--"):"--",c.notes=null!=l?this.getValueOrDefault(l.textContent):"",c.login.username=null!=s?this.getValueOrDefault(s.textContent):null,c.login.password=null!=o?this.getValueOrDefault(o.textContent):null,c.login.uris=null!=a?this.makeUriArray(a.textContent):null;const u=[];for(let e=1;e<=10;e++)u.push("Attribute-"+e);this.querySelectorAllDirectChild(e,u.join(",")).forEach(e=>{this.isNullOrWhitespace(e.textContent)||"null"===e.textContent||this.processKvp(c,e.tagName,e.textContent)}),this.cleanupCipher(c),t.ciphers.push(c)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t)}}class rX extends e_{parse(e){const t=new Zz,i=this.parseXml(e);if(null==i)return t.success=!1,Promise.resolve(t);const n=i.querySelector("passwordsafe");if(null==n)return t.errorMessage="Missing `passwordsafe` node.",t.success=!1,Promise.resolve(t);const r=n.getAttribute("delimiter"),s=i.querySelectorAll("passwordsafe > entry");return Array.from(s).forEach(e=>{const i=this.querySelectorDirectChild(e,"group"),n=null==i||this.isNullOrWhitespace(i.textContent)?null:i.textContent.split(".").join("/");this.processFolder(t,n);const s=this.querySelectorDirectChild(e,"title"),o=this.querySelectorDirectChild(e,"username"),a=this.querySelectorDirectChild(e,"email"),l=this.querySelectorDirectChild(e,"password"),c=this.querySelectorDirectChild(e,"url"),u=this.querySelectorDirectChild(e,"notes"),d=this.initLoginCipher();d.name=null!=s?this.getValueOrDefault(s.textContent,"--"):"--",d.notes=null!=u?this.getValueOrDefault(u.textContent,"").split(r).join("\n"):null,d.login.username=null!=o?this.getValueOrDefault(o.textContent):null,d.login.password=null!=l?this.getValueOrDefault(l.textContent):null,d.login.uris=null!=c?this.makeUriArray(c.textContent):null,this.isNullOrWhitespace(d.login.username)&&null!=a?d.login.username=this.getValueOrDefault(a.textContent):null==a||this.isNullOrWhitespace(a.textContent)||(d.notes=this.isNullOrWhitespace(d.notes)?"Email: "+a.textContent:d.notes+"\nEmail: "+a.textContent),this.cleanupCipher(d),t.ciphers.push(d)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t)}}class sX extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!1);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{if(e.length<1)return;e.length>5&&this.processFolder(t,e[5]);const i=this.initLoginCipher();i.name=this.getValueOrDefault(e[0],"--"),e.length>4&&(i.notes=this.getValueOrDefault(e[4],"").split("¬").join("\n")),e.length>2&&(i.login.username=this.getValueOrDefault(e[2])),e.length>3&&(i.login.password=this.getValueOrDefault(e[3])),e.length>1&&(i.login.uris=this.makeUriArray(e[1])),this.cleanupCipher(i),t.ciphers.push(i)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t))}}const oX={Titel:"Title",Gebruikersnaam:"Username",Wachtwoord:"Password",Gewijzigd:"Modified",Gemaakt:"Created","Verloopt op":"Expire on",Beschrijving:"Description","Gewijzigd door":"Modified by"},aX={Titel:"Title",Benutzername:"Username",Konto:"Account",Passwort:"Password","Geändert am":"Modified","Erstellt am":"Created","Läuft ab am":"Expire on",Beschreibung:"Description","Geändert von":"Modified by"},lX=new Set(["Title","Username","URL","Password","Description"]);function cX(e){return Object.assign(Object.assign({"User name":"Username"},aX),oX)[e]||e}class uX extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0,{skipEmptyLines:!0,transformHeader:cX});if(null==i)return t.success=!1,Promise.resolve(t);if(!i[0].Title)return t.success=!1,Promise.resolve(t);let n="";return i.forEach(e=>{if(">>>"==e.Title)return;const i=e.Title;if(i.startsWith("[")&&i.endsWith("]"))return void(n=i.startsWith("/")?i.replace("/",""):i.substring(1,i.length-1));bd.isNullOrWhitespace(n)||this.processFolder(t,n);const r=this.initLoginCipher();r.name=this.getValueOrDefault(e.Title),r.login.username=this.getValueOrDefault(e.Username),r.notes=this.getValueOrDefault(e.Description),r.login.uris=this.makeUriArray(e.URL),r.login.password=this.getValueOrDefault(e.Password),this.importUnmappedFields(r,e,lX),this.convertToNoteIfNeeded(r),this.cleanupCipher(r),t.ciphers.push(r)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t)}importUnmappedFields(e,t,i){Object.keys(t).filter(e=>!i.has(e)).forEach(i=>{const n=t;this.processKvp(e,i,n[i])})}}function dX(e,t,i,n){let r=t,s=i,o=n;if(e){const a=e.trim().split(/\s+/);r=a[0]||t,o=a.length>1?a[a.length-1]:n,s=a.length>2?a.slice(1,-1).join(" "):i}return{mappedFirstName:r,mappedMiddleName:s,mappedLastName:o}}const hX=Object.freeze({ACTIVE:1,TRASHED:2});class pX extends e_{constructor(e){super(),this.i18nService=e,this.mappedIdentityItemKeys=["fullName","firstName","middleName","lastName","email","phoneNumber","company","socialSecurityNumber","passportNumber","licenseNumber","organization","streetAddress","floor","county","city","stateOrProvince","zipOrPostalCode","countryOrRegion"],this.identityItemExtraFieldsKeys=["extraPersonalDetails","extraAddressDetails","extraContactDetails","extraWorkDetails","extraSections"]}processIdentityItemUnmappedAndExtraFields(e,t){Object.keys(t).forEach(i=>{if(this.mappedIdentityItemKeys.includes(i)||this.identityItemExtraFieldsKeys.includes(i)){if(this.identityItemExtraFieldsKeys.includes(i))if("extraSections"!==i){const n=t[i];null==n||n.forEach(t=>{this.processKvp(e,t.fieldName,t.data.content,"hidden"===t.type?ox.Hidden:ox.Text)})}else{const n=t[i];null==n||n.forEach(t=>{var i;null===(i=t.sectionFields)||void 0===i||i.forEach(t=>{this.processKvp(e,t.fieldName,t.data.content,"hidden"===t.type?ox.Hidden:ox.Text)})})}}else this.processKvp(e,i,t[i])})}parse(e){var t,i;const n=new Zz,r=JSON.parse(e);if(null==r||null==r.vaults)return n.success=!1,Promise.resolve(n);if(r.encrypted)return n.success=!1,n.errorMessage=this.i18nService.t("unsupportedEncryptedImport"),Promise.resolve(n);for(const[,e]of Object.entries(r.vaults))for(const r of e.items){if(r.state==hX.TRASHED)continue;const s=this.initLoginCipher();switch(s.name=this.getValueOrDefault(r.data.metadata.name,"--"),s.notes=this.getValueOrDefault(r.data.metadata.note),s.favorite=r.pinned,r.data.type){case"login":{const e=r.data.content;s.login.uris=this.makeUriArray(e.urls),s.login.username=this.getValueOrDefault(e.itemUsername),null==s.login.username?s.login.username=this.getValueOrDefault(e.itemEmail):this.processKvp(s,"email",e.itemEmail),s.login.password=this.getValueOrDefault(e.password),s.login.totp=this.getValueOrDefault(e.totpUri);for(const e of r.data.extraFields)this.processKvp(s,e.fieldName,"totp"==e.type?e.data.totpUri:e.data.content,"text"==e.type?ox.Text:ox.Hidden);break}case"note":s.type=nx.SecureNote,s.secureNote=new PO,s.secureNote.type=hx;break;case"creditCard":{const e=r.data.content;s.type=nx.Card,s.card=new mO,s.card.cardholderName=this.getValueOrDefault(e.cardholderName),s.card.number=this.getValueOrDefault(e.number),s.card.brand=mO.getCardBrandByPatterns(e.number),s.card.code=this.getValueOrDefault(e.verificationNumber),this.isNullOrWhitespace(e.expirationDate)||(s.card.expMonth=e.expirationDate.substring(5,7),s.card.expMonth=s.card.expMonth.replace(/^0+/,""),s.card.expYear=e.expirationDate.substring(0,4)),this.isNullOrWhitespace(e.pin)||this.processKvp(s,"PIN",e.pin,ox.Hidden);break}case"identity":{const e=r.data.content;s.type=nx.Identity,s.identity=new wO;const{mappedFirstName:n,mappedMiddleName:o,mappedLastName:a}=dX(this.getValueOrDefault(e.fullName),this.getValueOrDefault(e.firstName),this.getValueOrDefault(e.middleName),this.getValueOrDefault(e.lastName));s.identity.firstName=n,s.identity.middleName=o,s.identity.lastName=a,s.identity.email=this.getValueOrDefault(e.email),s.identity.phone=this.getValueOrDefault(e.phoneNumber),s.identity.company=this.getValueOrDefault(e.company),s.identity.ssn=this.getValueOrDefault(e.socialSecurityNumber),s.identity.passportNumber=this.getValueOrDefault(e.passportNumber),s.identity.licenseNumber=this.getValueOrDefault(e.licenseNumber);const l=`${null!==(t=e.floor)&&void 0!==t?t:""} ${null!==(i=e.county)&&void 0!==i?i:""}`.trim();s.identity.address1=this.getValueOrDefault(e.organization),s.identity.address2=this.getValueOrDefault(e.streetAddress),s.identity.address3=this.getValueOrDefault(l),s.identity.city=this.getValueOrDefault(e.city),s.identity.state=this.getValueOrDefault(e.stateOrProvince),s.identity.postalCode=this.getValueOrDefault(e.zipOrPostalCode),s.identity.country=this.getValueOrDefault(e.countryOrRegion),this.processIdentityItemUnmappedAndExtraFields(s,e);for(const e of r.data.extraFields)this.processKvp(s,e.fieldName,e.data.content,"hidden"===e.type?ox.Hidden:ox.Text);break}default:continue}this.processFolder(n,e.name),this.cleanupCipher(s),n.ciphers.push(s)}return this.organization&&this.moveFoldersToCollections(n),n.success=!0,Promise.resolve(n)}}class vX extends e_{constructor(){super(...arguments),this.WEBSITE_mappedValues=new Set(["type","name","website_password_title","website_password_notes","website_password_username","website_password_password","website_password_url","autosubmit","website_password_auto_submit","urlfilter","website_password_url_filter"]),this.APP_PWD_mappedValues=new Set(["type","name","application_password_title","application_password_notes","application_password_username","application_password_password"]),this.BOOKMARK_mappedValues=new Set(["type","name","bookmark_title","bookmark_notes","bookmark_url"]),this.NOTES_mappedValues=new Set(["type","name","note_title","note_notes"]),this.TOTP_mappedValues=new Set(["type","name","totp_title","totp_notes","totp_code"]),this.ENV_VARIABLES_mappedValues=new Set(["type","name","environment_variables_title","environment_variables_notes","environment_variables_variables"]),this.GPG_mappedValues=new Set(["type","name","mail_gpg_own_key_title","mail_gpg_own_key_public","mail_gpg_own_key_name","mail_gpg_own_key_email","mail_gpg_own_key_private"])}parse(e){const t=new Zz,i=JSON.parse(e);return null==i?(t.success=!1,Promise.resolve(t)):(this.parseFolders(t,i.folders),this.handleItemParsing(t,i.items),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t))}parseFolders(e,t,i){null!=t&&0!==t.length&&t.forEach(t=>{const n=null!=t.items&&t.items.length>0,r=null!=t.folders&&t.folders.length>0;(n||r)&&(bd.isNullOrWhitespace(i)||(t.name=i+"/"+t.name),r&&this.parseFolders(e,t.folders,t.name),n?this.handleItemParsing(e,t.items,t.name):this.processFolder(e,t.name,n))})}handleItemParsing(e,t,i){null!=t&&0!==t.length&&t.forEach(t=>{const n=this.parsePsonoItem(t);this.processFolder(e,i,!0),this.cleanupCipher(n),e.ciphers.push(n)})}parsePsonoItem(e){const t=this.initLoginCipher();switch(e.type){case"website_password":this.parseWebsiteLogins(e,t);break;case"application_password":this.parseApplicationPasswords(e,t);break;case"environment_variables":this.parseEnvironmentVariables(e,t);break;case"totp":this.parseTOTP(e,t);break;case"bookmark":this.parseBookmarks(e,t);break;case"note":this.parseNotes(e,t)}return t}parseWebsiteLogins(e,t){var i;null!=e&&"website_password"==e.type&&(t.name=e.website_password_title,t.notes=e.website_password_notes,t.login.username=e.website_password_username,t.login.password=e.website_password_password,t.login.uris=this.makeUriArray(e.website_password_url),this.processKvp(t,"website_password_auto_submit",null===(i=e.website_password_auto_submit)||void 0===i?void 0:i.toString(),ox.Boolean),this.processKvp(t,"website_password_url_filter",e.website_password_url_filter),this.importUnmappedFields(t,e,this.WEBSITE_mappedValues))}parseApplicationPasswords(e,t){null!=e&&"application_password"==e.type&&(t.name=e.application_password_title,t.notes=e.application_password_notes,t.login.username=e.application_password_username,t.login.password=e.application_password_password,this.importUnmappedFields(t,e,this.APP_PWD_mappedValues))}parseBookmarks(e,t){null!=e&&"bookmark"==e.type&&(t.name=e.bookmark_title,t.notes=e.bookmark_notes,t.login.uris=this.makeUriArray(e.bookmark_url),this.importUnmappedFields(t,e,this.BOOKMARK_mappedValues))}parseNotes(e,t){null!=e&&"note"==e.type&&(t.type=nx.SecureNote,t.secureNote=new PO,t.secureNote.type=hx,t.name=e.note_title,t.notes=e.note_notes,this.importUnmappedFields(t,e,this.NOTES_mappedValues))}parseTOTP(e,t){null!=e&&"totp"==e.type&&(t.name=e.totp_title,t.notes=e.totp_notes,t.login.totp=e.totp_code,this.importUnmappedFields(t,e,this.TOTP_mappedValues))}parseEnvironmentVariables(e,t){null!=e&&"environment_variables"==e.type&&(t.type=nx.SecureNote,t.secureNote=new PO,t.secureNote.type=hx,t.name=e.environment_variables_title,t.notes=e.environment_variables_notes,e.environment_variables_variables.forEach(e=>{this.processKvp(t,e.key,e.value)}),this.importUnmappedFields(t,e,this.ENV_VARIABLES_mappedValues))}parseGPG(e,t){null!=e&&"mail_gpg_own_key"==e.type&&(t.type=nx.SecureNote,t.secureNote=new PO,t.secureNote.type=hx,t.name=e.mail_gpg_own_key_title,t.notes=e.mail_gpg_own_key_public,this.processKvp(t,"mail_gpg_own_key_name",e.mail_gpg_own_key_name),this.processKvp(t,"mail_gpg_own_key_email",e.mail_gpg_own_key_email),this.processKvp(t,"mail_gpg_own_key_private",e.mail_gpg_own_key_private,ox.Hidden),this.importUnmappedFields(t,e,this.GPG_mappedValues))}importUnmappedFields(e,t,i){Object.keys(t).filter(e=>!i.has(e)).forEach(i=>{const n=t;this.processKvp(e,i,n[i].toString())})}}class fX extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{if("true"===e.trash)return;const i=this.initLoginCipher();if(i.name=this.getValueOrDefault(e.name),i.notes=this.getValueOrDefault(e.notes),"LoginItem"===e.type)i.login.uris=this.makeUriArray(e.website),i.login.password=this.getValueOrDefault(e.password),i.login.username=this.getValueOrDefault(e.username);else if("CreditCardItem"===e.type){i.type=nx.Card,i.card=new mO,i.card.cardholderName=this.getValueOrDefault(e.cardholder),i.card.number=this.getValueOrDefault(e.number),i.card.brand=mO.getCardBrandByPatterns(i.card.number),i.card.code=this.getValueOrDefault(e.verification);try{const t=this.getValueOrDefault(e.expiryMonth);if(null!=t){const e=parseInt(t,null);null!=e&&e>=1&&e<=12&&(i.card.expMonth=e.toString())}}catch(e){}try{const t=this.getValueOrDefault(e.expiryYear);if(null!=t){const e=parseInt(t,null);null!=e&&(i.card.expYear=e.toString())}}catch(e){}const t=this.getValueOrDefault(e.pin);null!=t&&this.processKvp(i,"PIN",t);const n=this.getValueOrDefault(e.zipCode);null!=n&&this.processKvp(i,"Zip Code",n)}this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t))}}class mX extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);if(null==i)return t.success=!1,Promise.resolve(t);let n=1;return i.forEach(e=>{var r,s;const o=!this.isNullOrWhitespace(e.Folder)&&e.Folder.startsWith("/")?e.Folder.replace("/",""):e.Folder,a=this.isNullOrWhitespace(o)?null:o;this.processFolder(t,a);const l=this.initLoginCipher();l.notes=this.getValueOrDefault(e.Note),l.name=this.getValueOrDefault(e.Name,"--"),l.login.username=this.getValueOrDefault(e.Login),l.login.password=null!==(r=this.getValueOrDefault(e.Pwd))&&void 0!==r?r:this.getValueOrDefault(e.Password),l.login.uris=null!==(s=this.makeUriArray(e.Url))&&void 0!==s?s:this.makeUriArray(e.URL),this.isNullOrWhitespace(e.Rf_fields)?this.isNullOrWhitespace(e.RfFieldsV2)||this.parseRfFieldsV2(l,e):this.parseRfFields(l,e),this.convertToNoteIfNeeded(l),this.cleanupCipher(l),n===i.length&&"--"===l.name&&this.isNullOrWhitespace(l.login.password)||(t.ciphers.push(l),n++)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t)}parseRfFields(e,t){let i=[t.Rf_fields];null!=t.__parsed_extra&&t.__parsed_extra.length>0&&(i=i.concat(t.__parsed_extra)),i.forEach(t=>{const i=t.split(":");if(i.length<3)return;const n="-no-name-"===i[0]?null:i[0],r=4===i.length&&"rck"===i[2]?i[1]:i[2];this.processKvp(e,n,r)})}parseRfFieldsV2(e,t){let i=[t.RfFieldsV2];null!=t.__parsed_extra&&t.__parsed_extra.length>0&&(i=i.concat(t.__parsed_extra));let n=1,r=1;i.forEach(t=>{const i=t.split(",");if(i.length<5)return;const s="-no-name-"===i[0]?null:i[0],o="pwd"===i[3]?ox.Hidden:ox.Text,a=i[4];if("TOTP KEY$"===s)return void(e.login.totp=a);if("User ID$"===s&&a===e.login.username)return;if("Password$"===s&&a===e.login.password)return;let l=s;"User ID$"===s?l="Alternate User ID "+n++:"Password$"===s&&(l="Alternate Password "+r++),this.processKvp(e,l,a,o)})}}class gX extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{var i;const n=this.initLoginCipher();n.name=this.getValueOrDefault(e.Title,"--"),n.login.username=this.getValueOrDefault(e.Username),n.login.password=this.getValueOrDefault(e.Password),n.login.uris=this.makeUriArray(null!==(i=e.Url)&&void 0!==i?i:e.URL),n.login.totp=this.getValueOrDefault(e.OTPAuth),n.notes=this.getValueOrDefault(e.Notes),this.cleanupCipher(n),t.ciphers.push(n)}),t.success=!0,Promise.resolve(t))}}class yX extends e_{parse(e){const t=new Zz,i=this.parseXml(e);if(null==i)return t.success=!1,Promise.resolve(t);if(null==i.querySelector("database"))return t.errorMessage="Missing `database` node.",t.success=!1,Promise.resolve(t);const n=new Map;return Array.from(i.querySelectorAll("database > label")).forEach(e=>{const i=e.getAttribute("name"),r=e.getAttribute("id");if(!this.isNullOrWhitespace(i)&&!this.isNullOrWhitespace(r)){n.set(r,t.folders.length);const e=new SU;e.name=i,t.folders.push(e)}}),Array.from(i.querySelectorAll("database > card")).forEach(e=>{if("true"===e.getAttribute("template")||"true"===e.getAttribute("deleted"))return;const i=this.querySelectorDirectChild(e,"label_id");if(null!=i){const e=i.textContent;!this.isNullOrWhitespace(e)&&n.has(e)&&t.folderRelationships.push([t.ciphers.length,n.get(e)])}const r=this.initLoginCipher();r.name=this.getValueOrDefault(e.getAttribute("title"),"--"),"true"===e.getAttribute("star")&&(r.favorite=!0);"note"===e.getAttribute("type")?(r.type=nx.SecureNote,r.secureNote=new PO,r.secureNote.type=hx):Array.from(this.querySelectorAllDirectChild(e,"field")).forEach(e=>{const t=e.textContent;if(this.isNullOrWhitespace(t))return;const i=e.getAttribute("name"),n=this.getValueOrDefault(e.getAttribute("type"),"").toLowerCase();"login"===n?r.login.username=t:"password"===n||"secret"===n?this.processKvp(r,i,t,ox.Hidden):"one_time_password"===n?r.login.totp=t:"notes"===n?r.notes+=t+"\n":"weblogin"===n||"website"===n?r.login.uris.push(...this.makeUriArray(t)):this.processKvp(r,i,t)}),Array.from(this.querySelectorAllDirectChild(e,"notes")).forEach(e=>{r.notes+=e.textContent+"\n"}),this.setPassword(r),this.cleanupCipher(r),t.ciphers.push(r)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t)}setPassword(e){const t=e.fields.filter(e=>e.type===ox.Hidden);if(!t.length)return;let i;for(const n of t)if(this.passwordFieldNames.includes(n.name.toLowerCase())){i=n,e.fields=e.fields.filter(e=>e!==i);break}i||(i=t[0]),e.login.password=i.value}}class bX extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{const i=this.initLoginCipher();i.name=this.getValueOrDefault(this.nameFromUrl(e.url),"--"),i.notes=this.getValueOrDefault(e.notes),i.login.username=this.getValueOrDefault(e.username),i.login.password=this.getValueOrDefault(e.password),i.login.uris=this.makeUriArray(e.url),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t))}}class wX extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);if(null==i)return t.success=!1,Promise.resolve(t);const n=Object.keys(i[0]).find(e=>/url/i.test(e));return i.forEach(e=>{const i=this.initLoginCipher();i.name=this.getValueOrDefault(e.Title),i.notes=this.getValueOrDefault(e.Comment),i.login.uris=this.makeUriArray(e[n]),i.login.password=this.getValueOrDefault(e.Password),i.login.username=this.getValueOrDefault(e.Username),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t)}}class SX extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!1);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{if(e.length<3)return;this.processFolder(t,this.getValueOrDefault(e[e.length-1]));const i=this.initLoginCipher();i.notes=this.getValueOrDefault(e[e.length-2],""),i.name=this.getValueOrDefault(e[1],"--"),"Web Logins"===e[0]||"Servers"===e[0]||"Email Accounts"===e[0]?(i.login.username=this.getValueOrDefault(e[2]),i.login.password=this.getValueOrDefault(e[3]),i.login.uris=this.makeUriArray(e[4]),this.parseFieldsToNotes(i,5,e)):this.parseFieldsToNotes(i,2,e),this.convertToNoteIfNeeded(i),this.cleanupCipher(i),t.ciphers.push(i)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t))}parseFieldsToNotes(e,t,i){for(let n=t;n<i.length-3;n++)this.isNullOrWhitespace(i[n])||(e.notes+=i[n]+"\n")}}class kX extends e_{parse(e){const t=new Zz,i=this.parseXml(e);if(null==i)return t.success=!1,Promise.resolve(t);const n=i.querySelectorAll("root > Database > Logins > Login");return Array.from(n).forEach(e=>{const n=e.getAttribute("ID");if(this.isNullOrWhitespace(n))return;const r=e.getAttribute("Name"),s=e.getAttribute("Password");let o=null,a=null,l=null,c=null,u=null;const d=i.querySelector('root > Database > Accounts > Account > LoginLinks > Login[SourceLoginID="'+n+'"]');if(null!=d){const e=d.parentElement.parentElement;null!=e&&(o=e.getAttribute("Name"),a=e.getAttribute("Link"),c=e.getAttribute("ParentID"),l=e.getAttribute("Comments"),this.isNullOrWhitespace(l)||(l=l.split("/n").join("\n")))}this.isNullOrWhitespace(c)||(u=this.buildGroupText(i,c,""),this.processFolder(t,u));const h=this.initLoginCipher();h.name=this.getValueOrDefault(o,"--"),h.notes=this.getValueOrDefault(l),h.login.username=this.getValueOrDefault(r),h.login.password=this.getValueOrDefault(s),h.login.uris=this.makeUriArray(a),this.cleanupCipher(h),t.ciphers.push(h)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t)}buildGroupText(e,t,i){const n=e.querySelector('root > Database > Groups > Group[ID="'+t+'"]');return null==n?i:(this.isNullOrWhitespace(i)||(i="/"+i),i=n.getAttribute("Name")+i,this.buildGroupText(e,n.getAttribute("ParentID"),i))}}const IX=["kind","autologin","favorite","hexcolor","protectedwithpassword","subdomainonly","type","tk_export_version","note","title","document_content"];class CX extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{const i=this.initLoginCipher();if(i.favorite="true"===this.getValueOrDefault(e.favorite,"").toLowerCase(),i.name=this.getValueOrDefault(e.name,"--"),i.notes=this.getValueOrDefault(e.memo,""),i.login.username=this.getValueOrDefault(e.login),i.login.password=this.getValueOrDefault(e.password),i.login.uris=this.makeUriArray(e.url),"login"!==e.kind&&(i.name=this.getValueOrDefault(e.title,"--"),i.notes=this.getValueOrDefault(e.note,"")),"cc"===e.kind){if(i.type=nx.Card,i.card=new mO,i.card.cardholderName=this.getValueOrDefault(e.cardholder),i.card.number=this.getValueOrDefault(e.number),i.card.brand=mO.getCardBrandByPatterns(i.card.number),!this.isNullOrWhitespace(e.expiryDate))try{const t=new Date(e.expiryDate);i.card.expYear=t.getFullYear().toString(),i.card.expMonth=(t.getMonth()+1).toString()}catch(e){}}else if("login"!==e.kind){i.type=nx.SecureNote,i.secureNote=new PO,i.secureNote.type=hx,this.isNullOrWhitespace(i.notes)||(i.notes=this.getValueOrDefault(e.document_content,""));for(const t in e)e.hasOwnProperty(t)&&IX.indexOf(t.toLowerCase())<0&&!this.isNullOrWhitespace(e[t])&&this.processKvp(i,t,e[t])}this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t))}}class TX extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!1);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{if(5!==e.length)return;const i=this.initLoginCipher();i.name=this.getValueOrDefault(e[0],"--"),i.notes=this.getValueOrDefault(e[4]),i.login.username=this.getValueOrDefault(e[1]),i.login.password=this.getValueOrDefault(e[2]),i.login.uris=this.makeUriArray(e[3]),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t))}}class PX extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{const i=this.initLoginCipher();i.name=this.getValueOrDefault(e.Name,"--"),i.login.username=this.getValueOrDefault(e["User name"]),i.login.password=this.getValueOrDefault(e.Password),i.login.uris=this.makeUriArray(e.URL),this.cleanupCipher(i),t.ciphers.push(i)}),t.success=!0,Promise.resolve(t))}}class FX extends e_{parse(e){const t=new Zz,i=this.parseCsv(e,!0);return null==i?(t.success=!1,Promise.resolve(t)):(i.forEach(e=>{if(this.isNullOrWhitespace(e["Password Name"])&&this.isNullOrWhitespace(e["Secret Name"]))return;this.processFolder(t,this.getValueOrDefault(e["Folder Name"]));const i=this.initLoginCipher();i.favorite="1"===this.getValueOrDefault(e.Favorite,"0"),i.notes=this.getValueOrDefault(e.Notes),i.name=this.getValueOrDefault(e["Password Name"],this.getValueOrDefault(e["Secret Name"],"--")),i.login.uris=this.makeUriArray(this.getValueOrDefault(e["Password URL"],this.getValueOrDefault(e["Secret URL"]))),i.login.totp=this.getValueOrDefault(e.login_totp),this.parseData(i,e.SecretData),this.parseData(i,e.CustomData),this.convertToNoteIfNeeded(i),this.cleanupCipher(i),t.ciphers.push(i)}),this.organization&&this.moveFoldersToCollections(t),t.success=!0,Promise.resolve(t))}parseData(e,t){if(this.isNullOrWhitespace(t))return;this.splitNewLine(t).forEach(t=>{const i=t.indexOf(":");if(i<0)return;const n=t.substring(0,i),r=t.length>i?t.substring(i+1):null;if(this.isNullOrWhitespace(n)||this.isNullOrWhitespace(r)||"SecretType"===n)return;const s=n.toLowerCase();null==e.login.username&&this.usernameFieldNames.indexOf(s)>-1?e.login.username=r:null==e.login.password&&this.passwordFieldNames.indexOf(s)>-1?e.login.password=r:this.processKvp(e,n,r)})}}const RX=[{id:"bitwardenjson",name:"Bitwarden (json)"},{id:"bitwardencsv",name:"Bitwarden (csv)"},{id:"chromecsv",name:"Chrome"},{id:"dashlanecsv",name:"Dashlane (csv)"},{id:"firefoxcsv",name:"Firefox (csv)"},{id:"keepass2xml",name:"KeePass 2 (xml)"},{id:"lastpasscsv",name:"LastPass"},{id:"safaricsv",name:"Safari and macOS (csv)"},{id:"1password1pux",name:"1Password (1pux/json)"}],xX=[{id:"keepassxcsv",name:"KeePassX (csv)"},{id:"1password1pif",name:"1Password (1pif)"},{id:"1passwordwincsv",name:"1Password 6 and 7 Windows (csv)"},{id:"1passwordmaccsv",name:"1Password 6 and 7 Mac (csv)"},{id:"dashlanejson",name:"Dashlane (json)"},{id:"roboformcsv",name:"RoboForm (csv)"},{id:"keepercsv",name:"Keeper (csv)"},{id:"enpasscsv",name:"Enpass (csv)"},{id:"enpassjson",name:"Enpass (json)"},{id:"protonpass",name:"ProtonPass (zip/json)"},{id:"safeincloudxml",name:"SafeInCloud (xml)"},{id:"pwsafexml",name:"Password Safe - pwsafe.org (xml)"},{id:"stickypasswordxml",name:"Sticky Password (xml)"},{id:"msecurecsv",name:"mSecure (csv)"},{id:"truekeycsv",name:"True Key (csv)"},{id:"passwordbossjson",name:"Password Boss (json)"},{id:"zohovaultcsv",name:"Zoho Vault (csv)"},{id:"splashidcsv",name:"SplashID (csv)"},{id:"passworddragonxml",name:"Password Dragon (xml)"},{id:"padlockcsv",name:"Padlock (csv)"},{id:"passboltcsv",name:"Passbolt (csv)"},{id:"clipperzhtml",name:"Clipperz (html)"},{id:"aviracsv",name:"Avira (csv)"},{id:"saferpasscsv",name:"SaferPass (csv)"},{id:"upmcsv",name:"Universal Password Manager (csv)"},{id:"ascendocsv",name:"Ascendo DataVault (csv)"},{id:"meldiumcsv",name:"Meldium (csv)"},{id:"passkeepcsv",name:"PassKeep (csv)"},{id:"arccsv",name:"Arc"},{id:"edgecsv",name:"Edge"},{id:"operacsv",name:"Opera"},{id:"vivaldicsv",name:"Vivaldi"},{id:"bravecsv",name:"Brave"},{id:"gnomejson",name:"GNOME Passwords and Keys/Seahorse (json)"},{id:"blurcsv",name:"Blur (csv)"},{id:"passwordagentcsv",name:"Password Agent (csv)"},{id:"passpackcsv",name:"Passpack (csv)"},{id:"passmanjson",name:"Passman (json)"},{id:"avastcsv",name:"Avast Passwords (csv)"},{id:"avastjson",name:"Avast Passwords (json)"},{id:"fsecurefsk",name:"F-Secure KEY (fsk)"},{id:"kasperskytxt",name:"Kaspersky Password Manager (txt)"},{id:"remembearcsv",name:"RememBear (csv)"},{id:"passwordwallettxt",name:"PasswordWallet (txt)"},{id:"mykicsv",name:"Myki (csv)"},{id:"securesafecsv",name:"SecureSafe (csv)"},{id:"logmeoncecsv",name:"LogMeOnce (csv)"},{id:"blackberrycsv",name:"BlackBerry Password Keeper (csv)"},{id:"buttercupcsv",name:"Buttercup (csv)"},{id:"codebookcsv",name:"Codebook (csv)"},{id:"encryptrcsv",name:"Encryptr (csv)"},{id:"yoticsv",name:"Yoti (csv)"},{id:"nordpasscsv",name:"Nordpass (csv)"},{id:"psonojson",name:"Psono (json)"},{id:"passkyjson",name:"Passky (json)"},{id:"passwordxpcsv",name:"Password XP (csv)"},{id:"netwrixpasswordsecure",name:"Netwrix Password Secure (csv)"},{id:"passworddepot17xml",name:"Password Depot 17 (xml)"}];var AX=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class DX{}const EX=Object.freeze({file:"file",chromium:"chromium",ipc:"ipc",download:"download"}),$X=Object.freeze({unique:"unique",chromium:"chromium"}),OX=Om({[EX.chromium]:[Da.Desktop],[EX.download]:[Da.Browser],[EX.file]:[Da.Browser,Da.Desktop,Da.Web,Da.Cli],[EX.ipc]:[]}),UX=[{id:"bitwardenjson",loaders:[EX.file],instructions:$X.unique},{id:"chromecsv",loaders:[EX.file],instructions:$X.chromium},{id:"operacsv",loaders:[EX.file],instructions:$X.chromium},{id:"vivaldicsv",loaders:[EX.file],instructions:$X.chromium},{id:"bravecsv",loaders:[EX.file],instructions:$X.chromium},{id:"edgecsv",loaders:[EX.file],instructions:$X.chromium}],MX=Om(Object.fromEntries(UX.map(e=>[e.id,e])));var NX=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class VX{}const BX=new vc("SystemServices"),jX=[{provide:Lz,useClass:class{constructor(e){this.apiService=e}postImportCiphers(e){return zz(this,void 0,void 0,function*(){return yield this.apiService.send("POST","/ciphers/import",e,!0,!1)})}postImportOrganizationCiphers(e,t){return zz(this,void 0,void 0,function*(){return yield this.apiService.send("POST","/ciphers/import-organization?organizationId="+e,t,!0,!1)})}},deps:[eI]},{provide:GG,useClass:jG,deps:[$G,Bp]},{provide:KG,useFactory:()=>function(){const e=new ZG(qG,WG);for(const t of Reflect.ownKeys(YG))e.registerSite(YG[t]);for(const t of pL)e.registerVendor(t);for(const t of vL)e.registerExtension(t);return e}(),deps:[]},{provide:BX,useFactory:function(e,t,i,n,r,s,o){let a;return a=s.isDev()?sj(r,[]):rj,{policy:i,extension:new XG(n,{encryptor:e,state:t,log:a,now:Date.now}),log:a,configService:o,environment:s}},deps:[GG,u,Jb,KG,Za,Hb,Kb]},{provide:_z,useClass:class{constructor(e,t,i,n,r,s,o,a,l,c){this.cipherService=e,this.folderService=t,this.importApiService=i,this.i18nService=n,this.collectionService=r,this.keyService=s,this.encryptService=o,this.keyGenerationService=a,this.accountService=l,this.restrictedItemTypesService=c,this.featuredImportOptions=RX,this.regularImportOptions=xX}getImportOptions(){return this.featuredImportOptions.concat(this.regularImportOptions)}import(e,t){return AX(this,arguments,void 0,function*(e,t,i=null,n=null,r){let s;try{s=yield e.parse(t)}catch(e){if(e instanceof SyntaxError)throw new Error(this.i18nService.t("importFormatError"));throw e}if(!s.success){if(!bd.isNullOrWhitespace(s.errorMessage))throw new Error(s.errorMessage);throw new Error(this.i18nService.t("importFormatError"))}if(0===s.folders.length&&0===s.ciphers.length)throw new Error(this.i18nService.t("importNothingError"));if(s.ciphers.length>0){const e=Math.floor(s.ciphers.length/2),t=s.ciphers.length-1;if(this.badData(s.ciphers[0])&&this.badData(s.ciphers[e])&&this.badData(s.ciphers[t]))throw new Error(this.i18nService.t("importFormatError"))}const o=yield(0,bo._)(this.restrictedItemTypesService.restricted$.pipe((0,l.T)(e=>e.map(e=>e.cipherType))));if(s.ciphers=s.ciphers.filter(e=>!o.includes(e.type)),i&&!n&&!r){if(s.collectionRelationships.length<s.ciphers.length)throw new Error(this.i18nService.t("importUnassignedItemsError"))}try{yield this.setImportTarget(s,i,n);const e=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));null!=i?yield this.handleOrganizationalImport(s,i,e):yield this.handleIndividualImport(s,e)}catch(e){const t=new iS(e,400);throw this.handleServerError(t,s)}return s})}getImporter(e,t,i=null){if(null==t)return null;const n=this.getImporterInstance(e,t);return null==n?null:(n.organizationId=i,n)}getImporterInstance(e,t){if(null==e)return null;switch(e){case"bitwardencsv":return new l_;case"bitwardenjson":case"bitwardenpasswordprotected":return new Y_(this.keyService,this.encryptService,this.i18nService,this.cipherService,this.keyGenerationService,this.accountService,t);case"lastpasscsv":case"passboltcsv":return new IK;case"keepassxcsv":return new SK;case"aviracsv":return new s_;case"blurcsv":return new H_;case"safeincloudxml":return new yX;case"padlockcsv":return new qK;case"keepass2xml":return new wK;case"arccsv":return new t_;case"edgecsv":case"chromecsv":case"operacsv":case"vivaldicsv":case"bravecsv":return new a_;case"firefoxcsv":return new dK;case"upmcsv":return new TX;case"saferpasscsv":return new bX;case"safaricsv":return new gX;case"meldiumcsv":return new TK;case"1password1pif":return new VK;case"1password1pux":return new GK;case"1passwordwincsv":return new XK;case"1passwordmaccsv":return new KK;case"keepercsv":return new kK;case"passworddragonxml":return new nX;case"enpasscsv":return new lK;case"enpassjson":return new uK;case"pwsafexml":return new rX;case"dashlanecsv":return new rK;case"dashlanejson":return new oK;case"msecurecsv":return new PK;case"stickypasswordxml":return new kX;case"truekeycsv":return new CX;case"clipperzhtml":return new Q_;case"roboformcsv":return new mX;case"ascendocsv":return new i_;case"passwordbossjson":return new QK;case"zohovaultcsv":return new FX;case"splashidcsv":return new SX;case"passkeepcsv":return new WK;case"gnomejson":return new vK;case"passwordagentcsv":return new ZK;case"passpackcsv":return new JK;case"passmanjson":return new HK;case"avastcsv":return new n_;case"avastjson":return new r_;case"fsecurefsk":return new pK;case"kasperskytxt":return new bK;case"remembearcsv":return new fX;case"passwordwallettxt":return new sX;case"mykicsv":return new OK;case"securesafecsv":return new wX;case"logmeoncecsv":return new CK;case"blackberrycsv":return new o_;case"buttercupcsv":return new Z_;case"codebookcsv":return new eK;case"encryptrcsv":return new aK;case"yoticsv":return new PX;case"nordpasscsv":return new NK;case"psonojson":return new vX;case"passkyjson":return new YK;case"protonpass":return new pX(this.i18nService);case"passwordxpcsv":return new uX;case"netwrixpasswordsecure":return new MK;case"passworddepot17xml":return new iX;default:return null}}handleIndividualImport(e,t){return AX(this,void 0,void 0,function*(){const i=new Kz,n=yield this.cipherService.encryptMany(e.ciphers,t);for(const e of n)i.ciphers.push(new Yz(e));const r=yield(0,bo._)(this.keyService.userKey$(t));if(null!=e.folders)for(let t=0;t<e.folders.length;t++){const n=yield this.folderService.encrypt(e.folders[t],r);i.folders.push(new Jz(n))}return null!=e.folderRelationships&&e.folderRelationships.forEach(e=>i.folderRelationships.push(new qz(e[0],e[1]))),yield this.importApiService.postImportCiphers(i)})}handleOrganizationalImport(e,t,i){return AX(this,void 0,void 0,function*(){const n=new Xz;e.ciphers.forEach(e=>{e.organizationId=t});const r=yield this.cipherService.encryptMany(e.ciphers,i);for(const e of r)n.ciphers.push(new Yz(e));if(null!=e.collections)for(let r=0;r<e.collections.length;r++){e.collections[r].organizationId=t;const s=yield this.collectionService.encrypt(e.collections[r],i);n.collections.push(new pR(s))}return null!=e.collectionRelationships&&e.collectionRelationships.forEach(e=>n.collectionRelationships.push(new qz(e[0],e[1]))),yield this.importApiService.postImportOrganizationCiphers(t,n)})}badData(e){return(null==e.name||"--"===e.name)&&e.type===nx.Login&&null!=e.login&&bd.isNullOrWhitespace(e.login.password)}handleServerError(e,t){if(null==e.validationErrors)return new Error(e.message);let i="";return Object.entries(e.validationErrors).forEach(([e,n],r)=>{let s,o;const a=Number(e.match(/[0-9]+/)[0]);switch(e.match(/^\w+/)[0]){case"Ciphers":s=t.ciphers[a],l=s.type,o=rx[l];break;case"Folders":s=t.folders[a],o="Folder";break;case"Collections":s=t.collections[a],o="Collection";break;default:return}var l;r>0&&(i+="\n\n"),"Folder"!==o&&"Collection"!==o&&(i+="["+(a+1)+"] "),i+="["+o+'] "'+s.name+'": '+n}),new Error(i)}setImportTarget(e,t,i){return AX(this,void 0,void 0,function*(){if(!i)return;if(t){if(!(i instanceof SR))throw new Error(this.i18nService.t("errorAssigningTargetCollection"));const t=[];if(e.ciphers.forEach((i,n)=>{Array.isArray(e.collectionRelationships)&&e.collectionRelationships.some(([e])=>e===n)||t.push([n,0])}),i.type===yR){e.collections=[i];const t=[];return e.ciphers.forEach((e,i)=>{t.push([i,0])}),void(e.collectionRelationships=t)}const n=[...e.collections];e.collections=[i],n.map(t=>{const n=new SR(t);n.name=`${i.name}/${t.name}`,e.collections.push(n)});const r=[...e.collectionRelationships];return e.collectionRelationships=[...t],void r.map(t=>{e.collectionRelationships.push([t[0],t[1]+1])})}if(!(i instanceof SU))throw new Error(this.i18nService.t("errorAssigningTargetFolder"));const n=[];e.ciphers.forEach((e,t)=>{bd.isNullOrEmpty(e.folderId)&&(e.folderId=i.id,n.push([t,0]))});const r=[...e.folders];e.folders=[i],r.map(t=>{const n=`${i.name}/${t.name}`,r=new SU;r.name=n,e.folders.push(r)});const s=[...e.folderRelationships];e.folderRelationships=[...n],s.map(t=>{e.folderRelationships.push([t[0],t[1]+1])})})}},deps:[_b,UM,Lz,Ul,uR,Bp,$G,jz,Zk,r$]}];var GX=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function LX(e,t){if(1&e&&Fl.nrm(0,"bit-option",3),2&e){const e=t.$implicit;Fl.Y8G("value",e.id)("label",e.name)}}class zX{constructor(e,t,i,n){this.formBuilder=e,this.controlContainer=t,this.logService=i,this.i18nService=n,this.formGroup=this.formBuilder.group({profile:["",{nonNullable:!0,validators:[Il.k0.required],asyncValidators:[this.validateAndEmitData()],updateOn:"submit"}]}),this.profileList=[],this.format=o.hFB.required(),this.csvDataLoaded=new Fl.bkB,(0,Rl.QZ)(()=>GX(this,void 0,void 0,function*(){this.profileList=yield this.onLoadProfilesFromBrowser(this.getBrowserName(this.format()))}))}ngOnInit(){return GX(this,void 0,void 0,function*(){this._parentFormGroup=this.controlContainer.control,this._parentFormGroup.addControl("chromeOptions",this.formGroup)})}ngOnDestroy(){this._parentFormGroup.removeControl("chromeOptions")}validateAndEmitData(){return()=>GX(this,void 0,void 0,function*(){try{const e=yield this.onImportFromBrowser(this.getBrowserName(this.format()),this.formGroup.controls.profile.value);if(e.some(e=>null!=e.failure)){const t=e.find(e=>null!=e.failure);return this.logService.error("Chromium importer failure:",t.failure.error),{errors:{message:this.i18nService.t("errorOccurred")}}}if(0===e.length)return{errors:{message:this.i18nService.t("importNothingError")}};const t=[];for(const i of e)null!=i.login&&t.push(new _X(i.login));const i=Qz.unparse(t);return this.csvDataLoaded.emit(i),null}catch(e){return this.logService.error(`Chromium importer error: ${e}`),{errors:{message:this.i18nService.t(this.getValidationErrorI18nKey(e))}}}})}getValidationErrorI18nKey(e){"string"==typeof e||null==e||e.message;return"errorOccurred"}getBrowserName(e){return"edgecsv"===e?"Microsoft Edge":"operacsv"===e?"Opera":"bravecsv"===e?"Brave":"vivaldicsv"===e?"Vivaldi":"arccsv"===e?"Arc":"Chrome"}}zX.ɵfac=function(e){return new(e||zX)(Fl.rXU(Il.ok),Fl.rXU(Il.ZU),Fl.rXU(Za),Fl.rXU(Ul))},zX.ɵcmp=Fl.VBU({type:zX,selectors:[["import-chrome"]],inputs:{format:[1,"format"],onLoadProfilesFromBrowser:"onLoadProfilesFromBrowser",onImportFromBrowser:"onImportFromBrowser"},outputs:{csvDataLoaded:"csvDataLoaded"},decls:7,vars:5,consts:[[3,"formGroup"],["formControlName","profile"],[3,"value","label",4,"ngFor","ngForOf"],[3,"value","label"]],template:function(e,t){1&e&&(Fl.j41(0,"div",0)(1,"bit-form-field")(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"bit-select",1),Fl.DNE(6,LX,1,2,"bit-option",2),Fl.k0s()()()),2&e&&(Fl.Y8G("formGroup",t.formGroup),Fl.R7$(3),Fl.JRh(Fl.bMT(4,3,"browserProfile")),Fl.R7$(3),Fl.Y8G("ngForOf",t.profileList))},dependencies:[kl.MD,kl.Sq,sf,dd,tc,Gu,Ac,ju,Il.X1,Il.BC,Il.cb,Il.j4,Il.JD,Ql,hd,Wu,qu,zu,rf],encapsulation:2});class _X{constructor(e){const t=bd.getUrl(null==e?void 0:e.url);null!=t&&(this.name=new URL(t).hostname),null==this.name&&(this.name=e.url),this.url=e.url,this.username=e.username,this.password=e.password,this.note=e.note}}var KX=i(44280);class XX{}class qX{}const WX=Object.freeze({Azure:0,OktaAuthServer:1,OktaNoAuthServer:2,Google:3,PingOne:4,OneLogin:5}),YX=Object.freeze({MasterPassword:0,Federated:3}),HX=Object.freeze({GoogleAuth:0,MicrosoftAuth:1,Yubikey:2}),JX=Object.freeze({Desktop:0,Mobile:1});class ZX{static createClientInfo(e){return{platform:JX.Desktop,id:e,description:"Importer"}}}class QX{constructor(e){this.url=e.url,this.username=e.username,this.password=e.password,this.totp=e.totp,this.extra=e.notes,this.name=e.name,this.grouping="(none)"===e.path?null:e.path,this.fav=e.isFavorite?1:0}}class eq{}class tq{constructor(e,t,i){this.waitForOutOfBand=e,this.passcode=t,this.rememberMe=i}waitForApproval(e){return new tq(!0,"",e)}continueWithPasscode(e,t){return new tq(!1,e,t)}}tq.cancel=new tq(!1,"cancel",!1);class iq{constructor(e,t){this.passcode=e,this.rememberMe=t}}iq.cancel=new iq("cancel",!1);class nq{constructor(){this.parseSecureNotesToAccount=!0}}nq.default=new nq;class rq{}class sq{}class oq{isFederated(){return this.type===YX.Federated&&this.hasValue(this.identityProviderURL)&&this.hasValue(this.openIDConnectAuthority)&&this.hasValue(this.openIDConnectClientId)}get oidcScope(){let e="openid profile email";return this.provider===WX.PingOne&&(e+=" lastpass"),e}get openIDConnectAuthorityBase(){return this.openIDConnectAuthority.replace("/.well-known/openid-configuration","")}hasValue(e){return null!=e&&""!==e.trim()}}class aq{constructor(e){this.arr=e,this.position=0;const t=new Uint32Array([287454020]),i=new Uint8Array(t.buffer);this.isLittleEndian=68===i[0]}readBytes(e){if(this.position+e>this.arr.length)throw new Error("End of array reached");const t=this.arr.subarray(this.position,this.position+e);return this.position+=e,t}readUInt16(){const e=this.readBytes(2);return(e[0]|e[1]<<8)>>>0}readUInt32(){const e=this.readBytes(4);return(e[0]|e[1]<<8|e[2]<<16|e[3]<<24)>>>0}readUInt16BigEndian(){let e=this.readUInt16();if(this.isLittleEndian){e=(255&e)<<8|e>>8&255}return e}readUInt32BigEndian(){let e=this.readUInt32();if(this.isLittleEndian){e=(255&e)<<24|(e>>8&255)<<16|(e>>16&255)<<8|e>>24&255}return e}seekFromCurrentPosition(e){const t=this.position+e;if(t<0)throw new Error("Position cannot be negative");if(t>this.arr.length)throw new Error("Array not large enough to seek to this position");this.position=t}atEnd(){return this.position>=this.arr.length-1}}var lq=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class cq{constructor(){this.isBrowser=!0}get(e){return lq(this,arguments,void 0,function*(e,t=null,i=null){const n={method:"GET",credentials:"include"};this.setHeaders(n,t,i);const r=new Request(this.baseUrl+"/"+e,n);return yield fetch(r)})}postForm(e){return lq(this,arguments,void 0,function*(e,t=null,i=null,n=null){return yield this.post(e,(e,i)=>{if(null!=t&&t.size>0){const i=new FormData;for(const[e,n]of t)i.set(e,n);e.body=i}},i,n)})}postJson(e,t){return lq(this,arguments,void 0,function*(e,t,i=null,n=null){return yield this.post(e,(e,i)=>{null!=t&&(i.set("Content-Type","application/json; charset=utf-8"),e.body=JSON.stringify(t))},i,n)})}post(e,t){return lq(this,arguments,void 0,function*(e,t,i=null,n=null){const r={method:"POST",credentials:"include"};null==i&&(i=new Map),t(r,i),this.setHeaders(r,i,n);const s=new Request(this.baseUrl+"/"+e,r);return yield fetch(s)})}setHeaders(e,t=null,i=null){const n=new Headers;let r=!1;if(null!=t&&t.size>0){r=!0;for(const[e,i]of t)n.set(e,i)}if(!this.isBrowser&&null!=i&&i.size>0){r=!0;const e=Array.from(i.keys()).map(e=>`${e}=${i.get(e)}`).join("; ");n.set("cookie",e)}r&&(e.headers=n)}}var uq=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const dq=new Map([[JX.Desktop,"cli"],[JX.Mobile,"android"]]),hq=new Map([["googleauthrequired",HX.GoogleAuth],["microsoftauthrequired",HX.MicrosoftAuth],["otprequired",HX.Yubikey]]);class pq{constructor(e,t){this.parser=e,this.cryptoUtils=t}openVault(e,t,i,n,r,s){return uq(this,void 0,void 0,function*(){const o=e.toLowerCase(),[a,l]=yield this.login(o,t,i,n,r);try{const e=yield this.downloadVault(a,l),i=yield this.cryptoUtils.deriveKey(o,t,a.keyIterationCount);let n=null;return null!=a.encryptedPrivateKey&&""!=a.encryptedPrivateKey&&(n=yield this.parser.parseEncryptedPrivateKey(a.encryptedPrivateKey,i)),this.parseVault(e,i,n,s)}finally{yield this.logout(a,l)}})}parseVault(e,t,i,n){return uq(this,void 0,void 0,function*(){const r=new aq(e),s=this.parser.extractChunks(r);if(!this.isComplete(s))throw new Error("Blob is truncated or corrupted");return yield this.parseAccounts(s,t,i,n)})}parseAccounts(e,t,i,n){return uq(this,void 0,void 0,function*(){const r=new Array;let s=null;for(const o of e)if("ACCT"===o.id){const e=null==s?t:s.encryptionKey,i=yield this.parser.parseAcct(o,e,s,n);null!=i&&r.push(i)}else"SHAR"===o.id&&(s=yield this.parser.parseShar(o,t,i));return r})}isComplete(e){if(e.length>0&&"ENDM"===e[e.length-1].id){return"OK"===bd.fromBufferToUtf8(e[e.length-1].payload)}return!1}login(e,t,i,n,r){return uq(this,void 0,void 0,function*(){const s=new cq;s.baseUrl="https://lastpass.com";let o=100100,a=null,l=null;for(let r=0;r<3;r++){if(a=yield this.performSingleLoginRequest(e,t,i,o,new Map,n,s),l=this.extractSessionFromLoginResponse(a,o,n),null!=l)return[l,s];const r=this.getOptionalErrorAttribute(a,"server");if(null!=r&&""!=r.trim()){s.baseUrl="https://"+r;continue}const c=this.getOptionalErrorAttribute(a,"iterations");if(null==c)break;try{o=parseInt(c)}catch(e){throw"Failed to parse the iteration count, expected an integer value '"+c+"'"}}const c=this.getOptionalErrorAttribute(a,"cause");if(null==c)throw this.makeLoginError(a);const u=hq.get(c);if(null!=u?l=yield this.loginWithOtp(e,t,i,o,u,n,r,s):"outofbandrequired"===c&&(l=yield this.loginWithOob(e,t,i,o,this.getAllErrorAttributes(a),n,r,s)),null==l)throw this.makeLoginError(a);return[l,s]})}loginWithOtp(e,t,i,n,r,s,o,a){return uq(this,void 0,void 0,function*(){let l=null;switch(r){case HX.GoogleAuth:l=yield o.provideGoogleAuthPasscode();break;case HX.MicrosoftAuth:l=yield o.provideMicrosoftAuthPasscode();break;case HX.Yubikey:l=yield o.provideYubikeyPasscode();break;default:throw new Error("Invalid OTP method")}if(l==iq.cancel)throw new Error("Second factor step is canceled by the user");const c=yield this.performSingleLoginRequest(e,t,i,n,new Map([["otp",l.passcode]]),s,a),u=this.extractSessionFromLoginResponse(c,n,s);if(null==u)throw this.makeLoginError(c);return l.rememberMe&&(yield this.markDeviceAsTrusted(u,s,a)),u})}loginWithOob(e,t,i,n,r,s,o,a){return uq(this,void 0,void 0,function*(){const l=r=>uq(this,void 0,void 0,function*(){const o=yield this.performSingleLoginRequest(e,t,i,n,r,s,a),c=this.extractSessionFromLoginResponse(o,n,s);if(null!=c)return c;if("outofbandrequired"!=this.getOptionalErrorAttribute(o,"cause"))throw this.makeLoginError(o);return r.set("outofbandretry","1"),r.set("outofbandretryid",this.getErrorAttribute(o,"retryid")),l(r)});return yield Promise.race([(()=>{const e=new Map;return e.set("outofbandrequest",1),l(e)})(),(()=>uq(this,void 0,void 0,function*(){const t=yield this.approveOob(e,r,o,a);if(t==tq.cancel)throw new Error("Out of band step is canceled by the user");const i=new Map;i.set("otp",t.passcode);const n=yield l(i);return t.rememberMe&&(yield this.markDeviceAsTrusted(n,s,a)),n}))()]).finally(()=>{o.closeMFADialog()})})}approveOob(e,t,i,n){return uq(this,void 0,void 0,function*(){const r=t.get("outofbandtype");if(null==r)throw new Error("Out of band method is not specified");switch(r){case"lastpassauth":return i.approveLastPassAuth();case"duo":return this.approveDuo(e,t,i,n);case"salesforcehash":return i.approveSalesforceAuth();default:throw new Error("Out of band method "+r+" is not supported")}})}approveDuo(e,t,i,n){return uq(this,void 0,void 0,function*(){return"1"==t.get("preferduowebsdk")?this.approveDuoWebSdk(e,t,i,n):i.approveDuo()})}approveDuoWebSdk(e,t,i,n){return i.approveDuo()}markDeviceAsTrusted(e,t,i){return uq(this,void 0,void 0,function*(){const n=new Map([["uuid",t.id],["trustlabel",t.description],["token",e.token]]),r=yield i.postForm("trust.php",n,null,this.getSessionCookies(e));r.status!=Ma.Ok&&this.makeError(r)})}logout(e,t){return uq(this,void 0,void 0,function*(){const i=new Map([["method",dq.get(e.platform)],["noredirect",1]]),n=yield t.postForm("logout.php",i,null,this.getSessionCookies(e));n.status!=Ma.Ok&&this.makeError(n)})}downloadVault(e,t){return uq(this,void 0,void 0,function*(){const i="getaccts.php?mobile=1&b64=1&hash=0.0&hasplugin=3.0.23&requestsrc="+dq.get(e.platform),n=yield t.get(i,null,this.getSessionCookies(e));if(n.status==Ma.Ok){const e=yield n.text();return bd.fromB64ToArray(e)}this.makeError(n)})}getSessionCookies(e){return new Map([["PHPSESSID",encodeURIComponent(e.id)]])}getErrorAttribute(e,t){const i=this.getOptionalErrorAttribute(e,t);if(null!=i)return i;throw new Error("Unknown response schema: attribute "+t+" is missing")}getOptionalErrorAttribute(e,t){const i=e.querySelector("response > error");if(null==i)return null;const n=i.attributes.getNamedItem(t);return null==n?null:n.value}getAllErrorAttributes(e){const t=e.querySelector("response > error");if(null==t)return null;const i=new Map;for(const e of Array.from(t.attributes))i.set(e.name,e.value);return i}extractSessionFromLoginResponse(e,t,i){const n=e.querySelector("response > ok");if(null==n)return null;const r=n.attributes.getNamedItem("sessionid");if(null==r)return null;const s=n.attributes.getNamedItem("token");if(null==s)return null;const o=new rq;o.id=r.value,o.keyIterationCount=t,o.token=s.value,o.platform=i.platform;const a=n.attributes.getNamedItem("privatekeyenc");return null!=a&&null!=a.value&&""!=a.value.trim()&&(o.encryptedPrivateKey=a.value),o}performSingleLoginRequest(e,t,i,n,r,s,o){return uq(this,void 0,void 0,function*(){const a=yield this.cryptoUtils.deriveKeyHash(e,t,n),l=new Map([["method",dq.get(s.platform)],["xml","2"],["username",e],["hash",bd.fromBufferToHex(a.buffer)],["iterations",n],["includeprivatekeyenc","1"],["outofbandsupported","1"],["uuid",s.id],["trustlabel",s.description]]);null!=i&&(l.set("alpfragmentid",i),l.set("calculatedfragmentid",i));for(const[e,t]of r)l.set(e,t);const c=yield o.postForm("login.php",l);if(c.status==Ma.Ok){const e=yield c.text();return(new window.DOMParser).parseFromString(e,"text/xml")}this.makeError(c)})}makeError(e){throw new Error("HTTP request to "+e.url+" failed with status "+e.status+".")}makeLoginError(e){var t;const i=e.querySelector("response > error");if(null==i)return"Unknown response schema";const n=i.attributes.getNamedItem("cause"),r=i.attributes.getNamedItem("message");if(null!=n)switch(n.value){case"unknownemail":return"Invalid username";case"password_invalid":case"unknownpassword":return"Invalid password";case"googleauthfailed":case"microsoftauthfailed":case"otpfailed":return"Second factor code is incorrect";case"multifactorresponsefailed":return"Out of band authentication failed";case"unifiedloginresult":return"unifiedloginresult";default:return null!==(t=null==r?void 0:r.value)&&void 0!==t?t:n.value}return null!=r?r.value:"Unknown error"}}var vq=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class fq{constructor(e){this.cryptoFunctionService=e}deriveKey(e,t,i){return vq(this,void 0,void 0,function*(){if(i<0)throw new Error("Iteration count should be positive");return 1==i?yield this.cryptoFunctionService.hash(e+t,"sha256"):yield this.cryptoFunctionService.pbkdf2(t,e,"sha256",i)})}deriveKeyHash(e,t,i){return vq(this,void 0,void 0,function*(){const n=yield this.deriveKey(e,t,i);return 1==i?yield this.cryptoFunctionService.hash(bd.fromBufferToHex(n.buffer)+t,"sha256"):yield this.cryptoFunctionService.pbkdf2(n,t,"sha256",1)})}ExclusiveOr(e,t){if(e.length!==t.length)throw new Error("Arrays must be the same length.");const i=new Uint8Array(e.length);for(let n=0;n<e.length;n++)i[n]=e[n]^t[n];return i}decryptAes256PlainWithDefault(e,t,i){return vq(this,void 0,void 0,function*(){try{return this.decryptAes256Plain(e,t)}catch(e){return i}})}decryptAes256Base64WithDefault(e,t,i){return vq(this,void 0,void 0,function*(){try{return this.decryptAes256Base64(e,t)}catch(e){return i}})}decryptAes256Plain(e,t){return vq(this,void 0,void 0,function*(){return 0===e.length?"":33===e[0]&&e.length%16==1&&e.length>32?this.decryptAes256CbcPlain(e,t):this.decryptAes256EcbPlain(e,t)})}decryptAes256Base64(e,t){return vq(this,void 0,void 0,function*(){return 0===e.length?"":33===e[0]?this.decryptAes256CbcBase64(e,t):this.decryptAes256EcbBase64(e,t)})}decryptAes256(e,t,i){return vq(this,arguments,void 0,function*(e,t,i,n=new Uint8Array(16)){if(0===e.length)return"";const r=yield this.cryptoFunctionService.aesDecrypt(e,n,t,i);return bd.fromBufferToUtf8(r)})}decryptAes256EcbPlain(e,t){return vq(this,void 0,void 0,function*(){return this.decryptAes256(e,t,"ecb")})}decryptAes256EcbBase64(e,t){return vq(this,void 0,void 0,function*(){const i=bd.fromB64ToArray(bd.fromBufferToUtf8(e));return this.decryptAes256(i,t,"ecb")})}decryptAes256CbcPlain(e,t){return vq(this,void 0,void 0,function*(){const i=e.subarray(17),n=e.subarray(1,17);return this.decryptAes256(i,t,"cbc",n)})}decryptAes256CbcBase64(e,t){return vq(this,void 0,void 0,function*(){const i=bd.fromB64ToArray(bd.fromBufferToUtf8(e.subarray(26))),n=bd.fromB64ToArray(bd.fromBufferToUtf8(e.subarray(1,25)));return this.decryptAes256(i,t,"cbc",n)})}}var mq=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const gq=new Set(["Server","Email Account","Database","Instant Messenger"]);class yq{constructor(e,t){this.cryptoFunctionService=e,this.cryptoUtils=t}parseAcct(e,t,i,n){return mq(this,void 0,void 0,function*(){let r,s=0;try{const o="decryption failed",a=new aq(e.payload);r=bd.fromBufferToUtf8(this.readItem(a)),s=1;const l=yield this.cryptoUtils.decryptAes256PlainWithDefault(this.readItem(a),t,o);s=2;const c=yield this.cryptoUtils.decryptAes256PlainWithDefault(this.readItem(a),t,o);s=3;const u=this.readItem(a);let d=u.length>0&&33===u[0]?yield this.cryptoUtils.decryptAes256PlainWithDefault(u,t,o):bd.fromBufferToUtf8(this.decodeHexLoose(bd.fromBufferToUtf8(u)));if("http://group"==d)return null;s=4;const h=yield this.cryptoUtils.decryptAes256PlainWithDefault(this.readItem(a),t,o);s=5;const p="1"===bd.fromBufferToUtf8(this.readItem(a));this.skipItem(a),s=7;let v=yield this.cryptoUtils.decryptAes256PlainWithDefault(this.readItem(a),t,o);s=8;let f=yield this.cryptoUtils.decryptAes256PlainWithDefault(this.readItem(a),t,o);this.skipItem(a),this.skipItem(a),s=11;const m="1"===bd.fromBufferToUtf8(this.readItem(a));if(n.parseSecureNotesToAccount&&m){let e="";for(const t of h.split("\n")){const i=t.split(":",2);if(!(i.length<2))switch(i[0]){case"NoteType":e=i[1];break;case"Hostname":d=i[1];break;case"Username":v=i[1];break;case"Password":f=i[1]}}if(!gq.has(e))return null}this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),this.skipItem(a),s=39;const g=yield this.cryptoUtils.decryptAes256PlainWithDefault(this.readItem(a),t,o);s=42;const y=this.makeAccountPath(c,i),b=new XX;return b.id=r,b.name=l,b.username=v,b.password=f,b.url=d,b.path=y,b.notes=h,b.totp=g,b.isFavorite=p,b.isShared=null!=i,b}catch(e){throw new Error("Error parsing accounts on item with ID:"+r+" step #"+s+" errorMessage: "+e.message)}})}parseShar(e,t,i){return mq(this,void 0,void 0,function*(){let t;try{const n=new aq(e.payload);t=bd.fromBufferToUtf8(this.readItem(n));const r=this.readItem(n),s=bd.fromHexToArray(bd.fromBufferToUtf8(r)),o=yield this.cryptoFunctionService.rsaDecrypt(s,i,"sha1"),a=bd.fromHexToArray(bd.fromBufferToUtf8(o)),l=this.readItem(n),c=yield this.cryptoUtils.decryptAes256Base64(l,a),u=new sq;return u.id=t,u.name=c,u.encryptionKey=a,u}catch(e){throw new Error("Error parsing shared folder with ID:"+t+" errorMessage: "+e.message)}})}parseEncryptedPrivateKey(e,t){return mq(this,void 0,void 0,function*(){const i=yield this.cryptoUtils.decryptAes256(bd.fromHexToArray(e),t,"cbc",t.subarray(0,16)),n="LastPassPrivateKey<",r=">LastPassPrivateKey";if(!i.startsWith(n)||!i.endsWith(r))throw new Error("Failed to decrypt private key");const s=i.substring(19,i.length-19);return bd.fromHexToArray(s)})}makeAccountPath(e,t){const i=null==e||""===e.trim();return null==t?i?"(none)":e:i?t.name:t.name+"\\"+e}extractChunks(e){const t=new Array;for(;!e.atEnd();){const i=this.readChunk(e);t.push(i)}return t}readChunk(e){const t=new qX;return t.id=this.readId(e),t.payload=this.readPayload(e,this.readSize(e)),t}readItem(e){return this.readPayload(e,this.readSize(e))}skipItem(e){e.seekFromCurrentPosition(this.readSize(e))}readId(e){return bd.fromBufferToUtf8(e.readBytes(4))}readSize(e){return e.readUInt32BigEndian()}readPayload(e,t){return e.readBytes(t)}decodeHexLoose(e){return bd.fromHexToArray(e.length%2==0?e:"0"+e)}}var bq=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class wq{constructor(e){this.cryptoFunctionService=e,this.cryptoUtils=new fq(e);const t=new yq(e,this.cryptoUtils);this.client=new pq(t,this.cryptoUtils)}open(e,t,i,n){return bq(this,arguments,void 0,function*(e,t,i,n,r=nq.default){this.accounts=yield this.client.openVault(e,t,null,i,n,r)})}openFederated(e,t,i){return bq(this,arguments,void 0,function*(e,t,i,n=nq.default){if(null==e)throw new Error("Federated user context is not set.");const r=yield this.getK1(e),[s,o]=yield this.getK2FragmentId(e),a=yield this.cryptoFunctionService.hash(this.cryptoUtils.ExclusiveOr(r,s),"sha256"),l=bd.fromBufferToB64(a);this.accounts=yield this.client.openVault(e.username,l,o,t,i,n)})}setUserTypeContext(e){return bq(this,void 0,void 0,function*(){const t=e.toLowerCase(),i=new cq;i.baseUrl="https://lastpass.com";const n="lmiapi/login/type?username="+encodeURIComponent(t),r=yield i.get(n);if(r.status===Ma.Ok){const e=yield r.json();if(this.userType=new oq,this.userType.companyId=e.CompanyId,this.userType.identityProviderGUID=e.IdentityProviderGUID,this.userType.identityProviderURL=e.IdentityProviderURL,this.userType.isPasswordlessEnabled=e.IsPasswordlessEnabled,this.userType.openIDConnectAuthority=e.OpenIDConnectAuthority,this.userType.openIDConnectClientId=e.OpenIDConnectClientId,this.userType.pkceEnabled=e.PkceEnabled,this.userType.provider=e.Provider,this.userType.type=e.type,this.userType.provider===WX.Azure){const e=this.userType.openIDConnectAuthority.indexOf("?app");e>-1&&(this.userType.openIDConnectAuthority=this.userType.openIDConnectAuthority.substring(0,e))}return}throw new Error("Cannot determine LastPass user type.")})}accountsToExportedCsvString(e=!1){if(null==this.accounts)throw new Error("Vault has not opened any accounts.");const t=this.accounts.filter(t=>!t.isShared||t.isShared&&!e).map(e=>new QX(e));if(0===t.length)throw new Error("No accounts to transform");return Qz.unparse(t)}getK1(e){return bq(this,void 0,void 0,function*(){var t;if(null==this.userType)throw new Error("User type is not set.");if(!this.userType.isFederated())throw new Error("Cannot get k1 for LastPass user that is not federated.");if(null==e)throw new Error("Federated user is not set.");let i=null;if(null!=(null===(t=e.idpUserInfo)||void 0===t?void 0:t.LastPassK1))return bd.fromByteStringToArray(e.idpUserInfo.LastPassK1);if(this.userType.provider===WX.Azure)i=yield this.getK1Azure(e);else if(this.userType.provider===WX.Google)i=yield this.getK1Google(e);else{const t=this.userType.provider===WX.PingOne;i=yield this.getK1FromAccessToken(e,t)}if(null!=i)return i;throw new Error("Cannot get k1.")})}getK1Azure(e){return bq(this,void 0,void 0,function*(){const t=new cq;t.baseUrl="https://graph.microsoft.com";const i=yield t.get("v1.0/me?$select=id,displayName,mail&$expand=extensions",new Map([["Authorization","Bearer "+e.accessToken]]));if(i.status===Ma.Ok){const e=yield i.json();if(null!=(null==e?void 0:e.extensions)&&e.extensions.length>0){const t=e.extensions[0].LastPassK1;if(null!=t)return bd.fromB64ToArray(t)}}return null})}getK1Google(e){return bq(this,void 0,void 0,function*(){const t=new Map([["Authorization","Bearer "+e.accessToken]]),i=new cq;i.baseUrl="https://content.googleapis.com";const n=yield i.get("drive/v3/files?pageSize=1&q=name%20%3D%20%27k1.lp%27&spaces=appDataFolder&fields=nextPageToken%2C%20files(id%2C%20name)",t);if(n.status===Ma.Ok){const e=yield n.json(),r=null==e?void 0:e.files;if(null!=r&&r.length>0&&null!=r[0].id&&"k1.lp"===r[0].name){i.baseUrl="https://www.googleapis.com";const e=yield i.get("drive/v3/files/"+r[0].id+"?alt=media",t);if(e.status===Ma.Ok){const t=yield e.text();return bd.fromB64ToArray(t)}}}return null})}getK1FromAccessToken(e,t){return bq(this,void 0,void 0,function*(){const i=fk(e.accessToken),n=null==i?void 0:i.LastPassK1;return null!=n?t?bd.fromB64ToArray(n):bd.fromByteStringToArray(n):null})}getK2FragmentId(e){return bq(this,void 0,void 0,function*(){if(null==this.userType)throw new Error("User type is not set.");if(!this.userType.isFederated())throw new Error("Cannot get k2 for LastPass user that is not federated.");const t=new cq;t.baseUrl=this.userType.identityProviderURL;const i=yield t.postJson("federatedlogin/api/v1/getkey",{company_id:this.userType.companyId,id_token:e.idToken});if(i.status===Ma.Ok){const e=yield i.json(),t=null==e?void 0:e.k2,n=null==e?void 0:e.fragment_id;if(null!=t&&null!=n)return[bd.fromB64ToArray(t),n]}throw new Error("Cannot get k2 and/or fragment ID.")})}}class Sq{constructor(e){this.dialogRef=e,this.formGroup=new Il.gE({password:new Il.MJ("",{validators:Il.k0.required,updateOn:"submit"})}),this.submit=()=>{this.formGroup.markAsTouched(),this.formGroup.valid&&this.dialogRef.close(this.formGroup.controls.password.value)}}static open(e){const t=e.open(Sq);return(0,bo._)(t.closed)}}Sq.ɵfac=function(e){return new(e||Sq)(Fl.rXU(nh))},Sq.ɵcmp=Fl.VBU({type:Sq,selectors:[["ng-component"]],decls:24,vars:17,consts:[[3,"formGroup","bitSubmit"],["bitDialogTitle",""],["bitDialogContent",""],[1,"!tw-mb-0"],["bitInput","","type","password","formControlName","password","appAutofocus","","appInputVerbatim",""],["type","button","bitSuffix","","bitIconButton","","bitPasswordInputToggle",""],["bitDialogFooter",""],["bitButton","","buttonType","primary","type","submit","bitFormButton",""],["bitButton","","bitDialogClose","","buttonType","secondary","type","button","bitFormButton",""]],template:function(e,t){1&e&&(Fl.j41(0,"form",0)(1,"bit-dialog")(2,"span",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"div",2)(6,"bit-form-field",3)(7,"bit-label"),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.nrm(10,"input",4)(11,"button",5),Fl.j41(12,"bit-hint"),Fl.EFF(13),Fl.nI1(14,"i18n"),Fl.k0s()()(),Fl.qex(15,6),Fl.j41(16,"button",7)(17,"span"),Fl.EFF(18),Fl.nI1(19,"i18n"),Fl.k0s()(),Fl.j41(20,"button",8)(21,"span"),Fl.EFF(22),Fl.nI1(23,"i18n"),Fl.k0s()(),Fl.bVm(),Fl.k0s()()),2&e&&(Fl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,7,"lastPassAuthRequired")," "),Fl.R7$(5),Fl.JRh(Fl.bMT(9,9,"lastPassMasterPassword")),Fl.R7$(5),Fl.JRh(Fl.bMT(14,11,"confirmIdentity")),Fl.R7$(5),Fl.JRh(Fl.bMT(19,13,"submit")),Fl.R7$(4),Fl.JRh(Fl.bMT(23,15,"cancel")))},dependencies:[kl.MD,sf,wd,GI,Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,Fh,ch,Ph,Gu,Ac,hu,fu,ju,iw,nw,pc,jd,Md,id,td,Ql,Zl,tc,rf],encapsulation:2});class kq{get descriptionI18nKey(){switch(this.variant){case"oob":return"lastPassOOBDesc";case"yubikey":return"lastPassYubikeyDesc";default:return"lastPassMFADesc"}}constructor(e,t){this.dialogRef=e,this.data=t,this.variant=this.data.variant,this.formGroup=new Il.gE({passcode:new Il.MJ("",{validators:Il.k0.required,updateOn:"submit"})}),this.submit=()=>{this.formGroup.markAsTouched(),this.formGroup.valid&&this.dialogRef.close(this.formGroup.value.passcode)}}static open(e,t){return e.open(kq,{data:t})}}kq.ɵfac=function(e){return new(e||kq)(Fl.rXU(nh),Fl.rXU(pd.Qs))},kq.ɵcmp=Fl.VBU({type:kq,selectors:[["ng-component"]],decls:26,vars:20,consts:[[3,"formGroup","bitSubmit"],["bitDialogTitle",""],["bitDialogContent",""],[1,"!tw-mb-0"],["bitInput","","type","text","formControlName","passcode","appAutofocus","","appInputVerbatim",""],["bitDialogFooter",""],["bitButton","","buttonType","primary","type","submit","bitFormButton",""],["bitButton","","bitDialogClose","cancel","buttonType","secondary","type","button","bitFormButton",""]],template:function(e,t){1&e&&(Fl.j41(0,"form",0)(1,"bit-dialog")(2,"span",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"div",2)(6,"p"),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.j41(9,"bit-form-field",3)(10,"bit-label"),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s(),Fl.nrm(13,"input",4),Fl.j41(14,"bit-hint"),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s()()(),Fl.qex(17,5),Fl.j41(18,"button",6)(19,"span"),Fl.EFF(20),Fl.nI1(21,"i18n"),Fl.k0s()(),Fl.j41(22,"button",7)(23,"span"),Fl.EFF(24),Fl.nI1(25,"i18n"),Fl.k0s()(),Fl.bVm(),Fl.k0s()()),2&e&&(Fl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,8,"lastPassMFARequired")," "),Fl.R7$(4),Fl.JRh(Fl.bMT(8,10,t.descriptionI18nKey)),Fl.R7$(4),Fl.JRh(Fl.bMT(12,12,"passcode")),Fl.R7$(4),Fl.JRh(Fl.bMT(16,14,"confirmIdentity")),Fl.R7$(5),Fl.JRh(Fl.bMT(21,16,"continue")),Fl.R7$(4),Fl.JRh(Fl.bMT(25,18,"cancel")))},dependencies:[kl.MD,sf,wd,GI,Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,Fh,ch,Ph,Gu,Ac,hu,fu,ju,pc,jd,Md,id,td,Ql,tc,rf],encapsulation:2});var Iq=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Cq{constructor(e){this.dialogService=e}getOTPResult(e){return Iq(this,void 0,void 0,function*(){const t=yield this.openMFADialog(e);return new iq(t,!1)})}getOOBResult(e){return Iq(this,void 0,void 0,function*(){const t=yield this.openMFADialog(e);return new tq(!1,t,!1)})}openMFADialog(e){return this.mfaDialogRef=kq.open(this.dialogService,{variant:e}),(0,bo._)(this.mfaDialogRef.closed)}closeMFADialog(){var e;null===(e=this.mfaDialogRef)||void 0===e||e.close()}provideGoogleAuthPasscode(){return Iq(this,void 0,void 0,function*(){return this.getOTPResult("otp")})}provideMicrosoftAuthPasscode(){return Iq(this,void 0,void 0,function*(){return this.getOTPResult("otp")})}provideYubikeyPasscode(){return Iq(this,void 0,void 0,function*(){return this.getOTPResult("yubikey")})}approveLastPassAuth(){return Iq(this,void 0,void 0,function*(){return this.getOOBResult("oob")})}approveDuo(){return Iq(this,void 0,void 0,function*(){return this.getOOBResult("oob")})}approveSalesforceAuth(){return Iq(this,void 0,void 0,function*(){return this.getOOBResult("oob")})}}Cq.ɵfac=function(e){return new(e||Cq)(a.KVO(lh))},Cq.ɵprov=a.jDH({token:Cq,factory:Cq.ɵfac,providedIn:"root"});var Tq=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Pq{constructor(e,t,i,n,r,s,o,a,l,c){this.cryptoFunctionService=e,this.environmentService=t,this.appIdService=i,this.lastPassDirectImportUIService=n,this.platformUtilsService=r,this.passwordGenerationService=s,this.broadcasterService=o,this.ngZone=a,this.dialogService=l,this.i18nService=c,this._ssoImportCallback$=new Co.B,this.ssoImportCallback$=this._ssoImportCallback$.asObservable(),this.vault=new wq(this.cryptoFunctionService),this.broadcasterService.subscribe("LastPassDirectImportService",e=>{this.ngZone.run(()=>Tq(this,void 0,void 0,function*(){if("importCallbackLastPass"===e.command)this._ssoImportCallback$.next({oidcCode:e.code,oidcState:e.state})}))})}handleImport(e,t){return Tq(this,void 0,void 0,function*(){if(yield this.verifyLastPassAccountExists(e),this.isAccountFederated){const i=yield this.handleFederatedLogin(e);return yield this.handleFederatedImport(i.oidcCode,i.oidcState,t)}const i=yield Sq.open(this.dialogService);return yield this.handleStandardImport(e,i,t)})}get isAccountFederated(){return this.vault.userType.isFederated()}verifyLastPassAccountExists(e){return Tq(this,void 0,void 0,function*(){yield this.vault.setUserTypeContext(e)})}handleFederatedLogin(e){return Tq(this,void 0,void 0,function*(){const t=(0,bo._)(this.ssoImportCallback$),i=yield this.createOidcSigninRequest(e);this.platformUtilsService.launchUri(i.url);const n=this.dialogService.openSimpleDialogRef({title:this.i18nService.t("awaitingSSO"),content:this.i18nService.t("awaitingSSODesc"),type:"warning",icon:"bwi-key",acceptButtonText:this.i18nService.t("cancel"),cancelButtonText:null}),r=(0,bo._)(n.closed).then(e=>{throw Error("SSO auth cancelled")});return Promise.race([r,t]).finally(()=>{n.close()})})}createOidcSigninRequest(e){return Tq(this,void 0,void 0,function*(){return this.oidcClient=new KX.hz({authority:this.vault.userType.openIDConnectAuthorityBase,client_id:this.vault.userType.openIDConnectClientId,redirect_uri:yield this.getOidcRedirectUrl(),response_type:"code",scope:this.vault.userType.oidcScope,response_mode:"query",loadUserInfo:!0}),yield this.oidcClient.createSigninRequest({state:{email:e},nonce:yield this.passwordGenerationService.generatePassword({length:20,uppercase:!0,lowercase:!0,number:!0})})})}getOidcRedirectUrlWithParams(e,t){const i=this.oidcClient.settings.redirect_uri,n="code="+e+"&state="+t;return 0===i.indexOf("bitwarden://")?i+"/?"+n:i+"&"+n}getOidcRedirectUrl(){return Tq(this,void 0,void 0,function*(){if(this.platformUtilsService.getClientType()===Da.Desktop)return"bitwarden://import-callback-lp";return(yield(0,bo._)(this.environmentService.environment$)).getWebVaultUrl()+"/sso-connector.html?lp=1"})}handleStandardImport(e,t,i){return Tq(this,void 0,void 0,function*(){const n=yield this.createClientInfo(e);return yield this.vault.open(e,t,n,this.lastPassDirectImportUIService,{parseSecureNotesToAccount:!1}),this.vault.accountsToExportedCsvString(!i)})}handleFederatedImport(e,t,i){return Tq(this,void 0,void 0,function*(){const n=yield this.oidcClient.processSigninResponse(this.getOidcRedirectUrlWithParams(e,t)),r=n.userState,s=new eq;s.idToken=n.id_token,s.accessToken=n.access_token,s.idpUserInfo=n.profile,s.username=r.email;const o=yield this.createClientInfo(s.username);return yield this.vault.openFederated(s,o,this.lastPassDirectImportUIService,{parseSecureNotesToAccount:!1}),this.vault.accountsToExportedCsvString(!i)})}createClientInfo(e){return Tq(this,void 0,void 0,function*(){const t="lastpass"+(yield this.appIdService.getAppId())+e,i=yield this.cryptoFunctionService.hash(t,"sha256");return ZX.createClientInfo(bd.fromBufferToHex(i))})}}Pq.ɵfac=function(e){return new(e||Pq)(a.KVO(FI),a.KVO(mk),a.KVO(Tk),a.KVO(Cq),a.KVO(Hb),a.KVO(gf),a.KVO(Pk),a.KVO(Fl.SKi),a.KVO(lh),a.KVO(Ul))},Pq.ɵprov=a.jDH({token:Pq,factory:Pq.ɵfac,providedIn:"root"});var Fq=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Rq{constructor(e,t,i,n,r){this.formBuilder=e,this.controlContainer=t,this.logService=i,this.lastPassDirectImportService=n,this.i18nService=r,this.formGroup=this.formBuilder.group({email:["",{validators:[Il.k0.required,Il.k0.email],asyncValidators:[this.validateAndEmitData()],updateOn:"submit"}],includeSharedFolders:[!1]}),this.emailHint$=this.formGroup.controls.email.statusChanges.pipe((0,l.T)(e=>{if("PENDING"===e)return this.i18nService.t("importingYourAccount")})),this.csvDataLoaded=new Fl.bkB}ngOnInit(){this._parentFormGroup=this.controlContainer.control,this._parentFormGroup.addControl("lastpassOptions",this.formGroup)}ngOnDestroy(){this._parentFormGroup.removeControl("lastpassOptions")}validateAndEmitData(){return()=>Fq(this,void 0,void 0,function*(){try{const e=yield this.lastPassDirectImportService.handleImport(this.formGroup.controls.email.value,this.formGroup.controls.includeSharedFolders.value);return this.csvDataLoaded.emit(e),null}catch(e){return this.logService.error(`LP importer error: ${e}`),{errors:{message:this.i18nService.t(this.getValidationErrorI18nKey(e))}}}})}getValidationErrorI18nKey(e){switch("string"==typeof e?e:null==e?void 0:e.message){case"SSO auth cancelled":case"Second factor step is canceled by the user":case"Out of band step is canceled by the user":return"multifactorAuthenticationCancelled";case"No accounts to transform":case"Vault has not opened any accounts.":return"noLastPassDataFound";case"Invalid username":case"Invalid password":return"incorrectUsernameOrPassword";case"Second factor code is incorrect":case"Out of band authentication failed":return"multifactorAuthenticationFailed";case"unifiedloginresult":return"lastPassTryAgainCheckEmail";default:return"errorOccurred"}}}Rq.ɵfac=function(e){return new(e||Rq)(Fl.rXU(Il.ok),Fl.rXU(Il.ZU),Fl.rXU(Za),Fl.rXU(Pq),Fl.rXU(Ul))},Rq.ɵcmp=Fl.VBU({type:Rq,selectors:[["import-lastpass"]],outputs:{csvDataLoaded:"csvDataLoaded"},decls:14,vars:10,consts:[[3,"formGroup"],["bitInput","","type","text","formControlName","email"],["bitCheckbox","","type","checkbox","formControlName","includeSharedFolders","id","import-lastpass_input_includeSharedFolders"]],template:function(e,t){1&e&&(Fl.j41(0,"div",0)(1,"bit-form-field")(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.nrm(5,"input",1),Fl.j41(6,"bit-hint"),Fl.EFF(7),Fl.nI1(8,"async"),Fl.k0s()(),Fl.j41(9,"bit-form-control"),Fl.nrm(10,"input",2),Fl.j41(11,"bit-label"),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s()()()),2&e&&(Fl.Y8G("formGroup",t.formGroup),Fl.R7$(3),Fl.JRh(Fl.bMT(4,4,"lastPassEmail")),Fl.R7$(4),Fl.JRh(Fl.bMT(8,6,t.emailHint$)),Fl.R7$(5),Fl.JRh(Fl.bMT(13,8,"includeSharedFolders")))},dependencies:[kl.MD,sf,dd,tc,Gu,Sc,Ac,hu,fu,ju,Il.X1,Il.me,Il.Zm,Il.BC,Il.cb,Il.j4,Il.JD,Ql,hd,Qb,kl.Jj,rf],encapsulation:2});var xq=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function Aq(e,t){1&e&&(Fl.j41(0,"bit-callout",18),Fl.nI1(1,"i18n"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()),2&e&&(Fl.Y8G("title",Fl.bMT(1,2,"restrictCardTypeImport")),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,4,"restrictCardTypeImportDesc"),"\n"))}function Dq(e,t){1&e&&(Fl.nrm(0,"bit-option",19),Fl.nI1(1,"i18n")),2&e&&Fl.Y8G("label",Fl.bMT(1,1,"myVault"))}function Eq(e,t){if(1&e&&Fl.nrm(0,"bit-option",20),2&e){const e=t.$implicit;Fl.Y8G("value",e.id)("label",e.name)}}function $q(e,t){if(1&e&&Fl.nrm(0,"bit-option",23),2&e){const e=t.$implicit;Fl.Y8G("value",e)("label",e.name)}}function Oq(e,t){if(1&e&&(Fl.qex(0),Fl.nrm(1,"bit-option",21),Fl.nI1(2,"i18n"),Fl.DNE(3,$q,1,2,"bit-option",22),Fl.nI1(4,"async"),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("label",Fl.VkB("-- ",Fl.bMT(2,4,"selectImportFolder")," --"))("value",null),Fl.R7$(2),Fl.Y8G("ngForOf",Fl.bMT(4,6,e.folders$))}}function Uq(e,t){if(1&e&&Fl.nrm(0,"bit-option",25),2&e){const e=t.$implicit,i=Fl.XpG(2);Fl.Y8G("value",e)("label",e.name)("icon",e.type===i.DefaultCollectionType?"bwi-user":"bwi-collection-shared")}}function Mq(e,t){if(1&e&&(Fl.qex(0),Fl.nrm(1,"bit-option",21),Fl.nI1(2,"i18n"),Fl.DNE(3,Uq,1,3,"bit-option",24),Fl.nI1(4,"async"),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("label",Fl.VkB("-- ",Fl.bMT(2,4,"selectImportCollection")," --"))("value",null),Fl.R7$(2),Fl.Y8G("ngForOf",Fl.bMT(4,6,e.collections$))}}function Nq(e,t){if(1&e&&Fl.nrm(0,"bit-option",21),2&e){const e=t.$implicit;Fl.Y8G("value",e.id)("label",e.name)}}function Vq(e,t){if(1&e&&Fl.nrm(0,"bit-option",21),2&e){const e=t.$implicit;Fl.Y8G("value",e.id)("label",e.name)}}function Bq(e,t){if(1&e&&(Fl.qex(0),Fl.nrm(1,"bit-option",26),Fl.DNE(2,Vq,1,2,"bit-option",15),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.Y8G("ngForOf",e.importOptions)}}function jq(e,t){1&e&&(Fl.qex(0),Fl.EFF(1," See detailed instructions on our help site at "),Fl.j41(2,"a",27),Fl.EFF(3," https://bitwarden.com/help/export-your-data/"),Fl.k0s(),Fl.bVm())}function Gq(e,t){1&e&&(Fl.j41(0,"bit-radio-group",31)(1,"bit-radio-button",32)(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"bit-radio-button",33)(6,"bit-label"),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s()()()),2&e&&(Fl.R7$(3),Fl.JRh(Fl.bMT(4,2,"importDirectlyFromLastPass")),Fl.R7$(4),Fl.JRh(Fl.bMT(8,4,"importFromCSV")))}function Lq(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"p",28),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.j41(4,"a",29),Fl.EFF(5," https://bitwarden.com/help/import-from-lastpass/"),Fl.k0s()(),Fl.DNE(6,Gq,9,6,"bit-radio-group",30),Fl.bVm()),2&e){const e=Fl.XpG(2);Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,2,"seeDetailedInstructions")," "),Fl.R7$(4),Fl.Y8G("ngIf",e.showLastPassToggle)}}function zq(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the KeePassX desktop application, navigate to "Database" → "Export to CSV file" and save the CSV file. '),Fl.bVm())}function _q(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' In the Avira web vault, go to "Settings" → "My Data" → "Export data" and save the CSV file. '),Fl.bVm())}function Kq(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' In the Blur web vault, click your username at the top and go to "Settings" → "Export Data", then click "Export CSV" for your "Accounts". '),Fl.bVm())}function Xq(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the SaveInCloud desktop application, navigate to "File" → "Export" → "As XML" and save the XML file. '),Fl.bVm())}function qq(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the Padlock desktop application, click the hamburger icon in the top left corner and navigate to "Settings" → "Export" button and save the file "As CSV". '),Fl.bVm())}function Wq(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the KeePass 2 desktop application, navigate to "File" → "Export" and select the "KeePass XML (2.x)" option. '),Fl.bVm())}function Yq(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the Universal Password Manager desktop application, navigate to "Database" → "Export" and save the CSV file. '),Fl.bVm())}function Hq(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the SaferPass browser extension, click the hamburger icon in the top left corner and navigate to "Settings". Click the "Export accounts" button to save the CSV file. '),Fl.bVm())}function Jq(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the Meldium web vault, navigate to "Settings". Locate the "Export data" function and click "Show me my data" to save the CSV file. '),Fl.bVm())}function Zq(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Log into the Keeper web vault (keepersecurity.com/vault). Click on your "account email" (top right) and select "Settings". Go to "Export" and find the "Export to .csv File" option. Click "Export" to save the CSV file. '),Fl.bVm())}function Qq(e,t){1&e&&(Fl.j41(0,"span"),Fl.EFF(1," The process is exactly the same as importing from Google Chrome. "),Fl.k0s())}function eW(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,Qq,2,0,"span",10),Fl.j41(2,"p"),Fl.EFF(3," See detailed instructions on our help site at "),Fl.j41(4,"a",34),Fl.EFF(5," https://bitwarden.com/help/import-from-chrome/"),Fl.k0s()(),Fl.j41(6,"bit-radio-group",35),Fl.nI1(7,"async"),Fl.j41(8,"bit-radio-button",36)(9,"bit-label"),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s()(),Fl.j41(12,"bit-radio-button",37)(13,"bit-label"),Fl.EFF(14),Fl.nI1(15,"i18n"),Fl.k0s()()(),Fl.bVm()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("ngIf","chromecsv"!==e.format),Fl.R7$(5),Fl.Y8G("hidden",!Fl.bMT(7,4,e.browserImporterAvailable$)),Fl.R7$(4),Fl.JRh(Fl.bMT(11,6,"importDirectlyFromBrowser")),Fl.R7$(4),Fl.JRh(Fl.bMT(15,8,"importFromCSV"))}}function tW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1," See detailed instructions on our help site at "),Fl.j41(2,"a",38),Fl.EFF(3," https://bitwarden.com/help/import-from-firefox/"),Fl.k0s(),Fl.EFF(4,". "),Fl.bVm())}function iW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1," See detailed instructions on our help site at "),Fl.j41(2,"a",39),Fl.EFF(3," https://bitwarden.com/help/import-from-safari/"),Fl.k0s(),Fl.EFF(4,". "),Fl.bVm())}function nW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1," See detailed instructions on our help site at "),Fl.j41(2,"a",40),Fl.EFF(3," https://bitwarden.com/help/import-from-1password/"),Fl.k0s(),Fl.EFF(4,". "),Fl.bVm())}function rW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the Password Dragon desktop application, navigate to "File" → "Export" → "To XML". In the dialog that pops up select "All Rows" and check all fields. Click the "Export" button and save the XML file. '),Fl.bVm())}function sW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the Enpass desktop application, navigate to "File" → "Export" → "As CSV". Select "OK" to the warning alert and save the CSV file. Note that the importer only supports files exported while Enpass is set to the English language, so adjust your settings accordingly. '),Fl.bVm())}function oW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the Enpass 6 desktop application, click the menu button and navigate to "File" → "Export". Select the ".json" file format option and save the JSON file. '),Fl.bVm())}function aW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the Password Safe desktop application, navigate to "File" → "Export To" → "XML format..." and save the XML file. '),Fl.bVm())}function lW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Log in to Dashlane, click on "My Account" → "Settings" → "Export file" and select "Export as a CSV file". This will download a zip archive containing various CSV files. Unzip the archive and import each CSV file individually. '),Fl.bVm())}function cW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1," Dashlane no longer supports the JSON format. Only use this if you have an existing JSON for import. Use the CSV importer when creating new exports. "),Fl.bVm())}function uW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the mSecure desktop application, navigate to "File" → "Export" → "CSV File..." and save the CSV file. '),Fl.bVm())}function dW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the Sticky Password desktop application, navigate to "Menu" (top right) → "Export" → "Export all". Select the unencrypted format XML option and save the XML file. '),Fl.bVm())}function hW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the True Key desktop application, click the gear icon (top right) and then navigate to "App Settings". Click the "Export" button, enter your password and save the CSV file. '),Fl.bVm())}function pW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Log into the Clipperz web application (clipperz.is/app). Click the hamburger menu icon in the top right to expand the navigation bar. Navigate to "Data" → "Export". Click the "download HTML+JSON" button to save the HTML file. '),Fl.bVm())}function vW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the RoboForm Editor desktop application, navigate to "RoboForm" (top left) → "Options" → "Account & Data" and click the "Export" button. Select all of your data, change the "Format" to "CSV file" and then click the "Export" button to save the CSV file. Note: RoboForm only allows you to export Logins. Other items will not be exported. '),Fl.bVm())}function fW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Log into the Passbolt web vault and navigate to the "Passwords" listing. Select all of the passwords you would like to export and click the "Export" button at the top of the listing. Choose the "csv (lastpass)" export format and click the "Export" button. '),Fl.bVm())}function mW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the Ascendo DataVault desktop application, navigate to "Tools" → "Export". In the dialog that pops up, select the "All Items (DVX, CSV)" option. Click the "Ok" button to save the CSV file. '),Fl.bVm())}function gW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the Password Boss desktop application, navigate to "File" → "Export data" → "Password Boss JSON - not encrypted" and save the JSON file. '),Fl.bVm())}function yW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Log into the Zoho web vault (vault.zoho.com). Navigate to "Tools" → "Export Secrets". Select "All Secrets" and click the "Zoho Vault Format CSV" button. Highlight and copy the data from the textarea. Open a text editor like Notepad and paste the data. Save the data from the text editor as '),Fl.j41(2,"code"),Fl.EFF(3,"zoho_export.csv"),Fl.k0s(),Fl.EFF(4,". "),Fl.bVm())}function bW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the SplashID Safe desktop application, click on the SplashID blue lock logo in the top right corner. Navigate to "Export" → "Export as CSV" and save the CSV file. '),Fl.bVm())}function wW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the PassKeep mobile app, navigate to "Backup/Restore". Locate the "CSV Backup/Restore" section and click "Backup to CSV" to save the CSV file. '),Fl.bVm())}function SW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1," Make sure you have python-keyring and python-gnomekeyring installed. Save the "),Fl.j41(2,"a",41),Fl.EFF(3,"GNOME Keyring Import/Export"),Fl.k0s(),Fl.EFF(4," python script to your desktop as "),Fl.j41(5,"code"),Fl.EFF(6,"pw_helper.py"),Fl.k0s(),Fl.EFF(7,". Open terminal and run "),Fl.j41(8,"code"),Fl.EFF(9,"chmod +rx Desktop/pw_helper.py"),Fl.k0s(),Fl.EFF(10," and then "),Fl.j41(11,"code"),Fl.EFF(12,"python Desktop/pw_helper.py export Desktop/my_passwords.json"),Fl.k0s(),Fl.EFF(13,". Then upload the resulting "),Fl.j41(14,"code"),Fl.EFF(15,"my_passwords.json"),Fl.k0s(),Fl.EFF(16," file here to Bitwarden. "),Fl.bVm())}function kW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Using the Password Agent desktop application navigate to "File" → "Export", select the "Fields to export" button and check all of the fields, change the "Output format" to "CSV", and then click the "Start" button to save the CSV file. '),Fl.bVm())}function IW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Log into the Passpack website vault and navigate to "Settings" → "Export", then click the "Download" button to save the CSV file. '),Fl.bVm())}function CW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Open your Passman vault and click on "Settings" in the bottom left corner. In the "Settings" window switch to the "Export credentials" tab and choose "JSON" as the export type. Enter your vault\'s passphrase and click the "Export" button to save the JSON file. '),Fl.bVm())}function TW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Open the Avast Passwords desktop application and navigate to "Settings" → "Import/export data". Select the "Export" button for the "Export to CSV file" option to save the CSV file. '),Fl.bVm())}function PW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Open the Avast Passwords desktop application and navigate to "Settings" → "Import/export data". Select the "Export" button for the "Export to JSON file" option to save the JSON file. '),Fl.bVm())}function FW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Open the F-Secure KEY desktop application and navigate to "Settings" → "Export Passwords". Select the "Export" button, enter your master password, and save the FSK file. '),Fl.bVm())}function RW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Open the Kaspersky Password Manager desktop application and navigate to "Settings" → "Import/Export". Locate the "Export to text file" section and select the "Export" button to save the TXT file. '),Fl.bVm())}function xW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Open the RememBear desktop application and navigate to "Settings" → "Account" → "Export". Enter your master password and select the "Export Anyway" button to save the CSV file. '),Fl.bVm())}function AW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Open the PasswordWallet desktop application and navigate to "File" → "Export" → "Visible entries to text file". Enter your password and select the "Ok" button to save the TXT file. '),Fl.bVm())}function DW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Open the Myki desktop browser extension and navigate to "Advanced" → "Export Accounts" and then scan the QR code with your mobile device. Various CSV files will then be saved to your computer\'s downloads folder. '),Fl.bVm())}function EW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1," Export your SecureSafe password safe to a CSV file with a comma delimiter. "),Fl.bVm())}function $W(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Open the LogMeOnce browser extension, then navigate to "Open Menu" → "Export To" and select "CSV File" to save the CSV file. '),Fl.bVm())}function OW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Open the BlackBerry Password Keeper application, then navigate to "Settings" → "Import/Export". Select "Export Passwords" and follow the instructions on screen to save the unencrypted CSV file. '),Fl.bVm())}function UW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Open the Buttercup desktop application and unlock your vault. Right click on your vault\'s icon and select "Export" to save the CSV file. '),Fl.bVm())}function MW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Open the Codebook desktop application and log in. Navigate to "File" → "Export all", then click "Yes" on the dialog and save the CSV file. '),Fl.bVm())}function NW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1," Open the newest version of the Encryptr desktop application and allow all of your data to sync. Once syncing of your data is complete, the download icon in the top right corner will turn pink. Click the download icon and save the CSV file. "),Fl.bVm())}function VW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' From the Yoti browser extension, click on "Settings", then "Export Saved Logins" and save the CSV file. '),Fl.bVm())}function BW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Log in to the Psono web vault, click on the "Signed in as"-dropdown, select "Others". Go to the "Export"-tab and select the json type export and then click on Export. '),Fl.bVm())}function jW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1,' Log in to "https://vault.passky.org" → "Import & Export" → "Export" in the Passky section. ("Backup" is unsupported as it is encrypted). '),Fl.bVm())}function GW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1," In the ProtonPass browser extension, go to Settings > Export. Export without PGP encryption and save the zip file. "),Fl.bVm())}function LW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1," Select Database → Export to file... menu. → Within the export options, ensure Folder names and Column titles is checked. → Press Browse... button and choose the target file and set it's type to CSV file. "),Fl.bVm())}function zW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1," Open the FullClient, go to the Main Menu and select Export. Start the export passwords wizard and follow the instructions to export a CSV file. "),Fl.bVm())}function _W(e,t){1&e&&(Fl.qex(0),Fl.EFF(1," Log in to NordPass and open Settings → Scroll down to the Import and Export section and select Export items → Enter your Master Password and select Continue. → Save the CSV file on your device. "),Fl.bVm())}function KW(e,t){1&e&&(Fl.qex(0),Fl.EFF(1," On the desktop application, go to Tools → Export → Enter your master password → Select XML Format (*.xml) as Export format → Click on next → Choose which entries should be included in the export → Click on next to export into the location previously chosen. "),Fl.bVm())}function XW(e,t){if(1&e&&(Fl.j41(0,"bit-callout",18),Fl.DNE(1,jq,4,0,"ng-container",10)(2,Lq,7,4,"ng-container",10)(3,zq,2,0,"ng-container",10)(4,_q,2,0,"ng-container",10)(5,Kq,2,0,"ng-container",10)(6,Xq,2,0,"ng-container",10)(7,qq,2,0,"ng-container",10)(8,Wq,2,0,"ng-container",10)(9,Yq,2,0,"ng-container",10)(10,Hq,2,0,"ng-container",10)(11,Jq,2,0,"ng-container",10)(12,Zq,2,0,"ng-container",10)(13,eW,16,10,"ng-container",10),Fl.nI1(14,"async"),Fl.DNE(15,tW,5,0,"ng-container",10)(16,iW,5,0,"ng-container",10)(17,nW,5,0,"ng-container",10)(18,rW,2,0,"ng-container",10)(19,sW,2,0,"ng-container",10)(20,oW,2,0,"ng-container",10)(21,aW,2,0,"ng-container",10)(22,lW,2,0,"ng-container",10)(23,cW,2,0,"ng-container",10)(24,uW,2,0,"ng-container",10)(25,dW,2,0,"ng-container",10)(26,hW,2,0,"ng-container",10)(27,pW,2,0,"ng-container",10)(28,vW,2,0,"ng-container",10)(29,fW,2,0,"ng-container",10)(30,mW,2,0,"ng-container",10)(31,gW,2,0,"ng-container",10)(32,yW,5,0,"ng-container",10)(33,bW,2,0,"ng-container",10)(34,wW,2,0,"ng-container",10)(35,SW,17,0,"ng-container",10)(36,kW,2,0,"ng-container",10)(37,IW,2,0,"ng-container",10)(38,CW,2,0,"ng-container",10)(39,TW,2,0,"ng-container",10)(40,PW,2,0,"ng-container",10)(41,FW,2,0,"ng-container",10)(42,RW,2,0,"ng-container",10)(43,xW,2,0,"ng-container",10)(44,AW,2,0,"ng-container",10)(45,DW,2,0,"ng-container",10)(46,EW,2,0,"ng-container",10)(47,$W,2,0,"ng-container",10)(48,OW,2,0,"ng-container",10)(49,UW,2,0,"ng-container",10)(50,MW,2,0,"ng-container",10)(51,NW,2,0,"ng-container",10)(52,VW,2,0,"ng-container",10)(53,BW,2,0,"ng-container",10)(54,jW,2,0,"ng-container",10)(55,GW,2,0,"ng-container",10)(56,LW,2,0,"ng-container",10)(57,zW,2,0,"ng-container",10)(58,_W,2,0,"ng-container",10)(59,KW,2,0,"ng-container",10),Fl.k0s()),2&e){const e=Fl.XpG();Fl.Y8G("title",Fl.mNQ(e.getFormatInstructionTitle())),Fl.R7$(),Fl.Y8G("ngIf","bitwardencsv"===e.format||"bitwardenjson"===e.format),Fl.R7$(),Fl.Y8G("ngIf","lastpasscsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","keepassxcsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","aviracsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","blurcsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","safeincloudxml"===e.format),Fl.R7$(),Fl.Y8G("ngIf","padlockcsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","keepass2xml"===e.format),Fl.R7$(),Fl.Y8G("ngIf","upmcsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","saferpasscsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","meldiumcsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","keepercsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf",Fl.bMT(14,60,e.showChromiumInstructions$)),Fl.R7$(2),Fl.Y8G("ngIf","firefoxcsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","safaricsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","1password1pux"===e.format||"1password1pif"===e.format||"1passwordwincsv"===e.format||"1passwordmaccsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","passworddragonxml"===e.format),Fl.R7$(),Fl.Y8G("ngIf","enpasscsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","enpassjson"===e.format),Fl.R7$(),Fl.Y8G("ngIf","pwsafexml"===e.format),Fl.R7$(),Fl.Y8G("ngIf","dashlanecsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","dashlanejson"===e.format),Fl.R7$(),Fl.Y8G("ngIf","msecurecsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","stickypasswordxml"===e.format),Fl.R7$(),Fl.Y8G("ngIf","truekeycsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","clipperzhtml"===e.format),Fl.R7$(),Fl.Y8G("ngIf","roboformcsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","passboltcsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","ascendocsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","passwordbossjson"===e.format),Fl.R7$(),Fl.Y8G("ngIf","zohovaultcsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","splashidcsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","passkeepcsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","gnomejson"===e.format),Fl.R7$(),Fl.Y8G("ngIf","passwordagentcsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","passpackcsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","passmanjson"===e.format),Fl.R7$(),Fl.Y8G("ngIf","avastcsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","avastjson"===e.format),Fl.R7$(),Fl.Y8G("ngIf","fsecurefsk"===e.format),Fl.R7$(),Fl.Y8G("ngIf","kasperskytxt"===e.format),Fl.R7$(),Fl.Y8G("ngIf","remembearcsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","passwordwallettxt"===e.format),Fl.R7$(),Fl.Y8G("ngIf","mykicsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","securesafecsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","logmeoncecsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","blackberrycsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","buttercupcsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","codebookcsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","encryptrcsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","yoticsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","psonojson"===e.format),Fl.R7$(),Fl.Y8G("ngIf","passkyjson"===e.format),Fl.R7$(),Fl.Y8G("ngIf","protonpass"===e.format),Fl.R7$(),Fl.Y8G("ngIf","passwordxpcsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","netwrixpasswordsecure"===e.format),Fl.R7$(),Fl.Y8G("ngIf","nordpasscsv"===e.format),Fl.R7$(),Fl.Y8G("ngIf","passworddepot17xml"===e.format)}}function qW(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"import-lastpass",42),Fl.bIt("csvDataLoaded",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.formGroup.controls.fileContents.setValue(t))}),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.Y8G("formGroup",e.formGroup)}}function WW(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"import-chrome",43),Fl.bIt("csvDataLoaded",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.formGroup.controls.fileContents.setValue(t))}),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.Y8G("formGroup",e.formGroup)("onImportFromBrowser",e.onImportFromBrowser)("onLoadProfilesFromBrowser",e.onLoadProfilesFromBrowser)("format",e.format)}}function YW(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-form-field")(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"div",44)(5,"button",45),Fl.bIt("click",function(){a.eBV(e);const t=Fl.sdS(11);return a.Njj(t.click())}),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s(),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.j41(10,"input",46,0),Fl.bIt("change",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.setSelectedFile(t))}),Fl.k0s()(),Fl.j41(12,"bit-form-field",8)(13,"bit-label"),Fl.EFF(14),Fl.nI1(15,"i18n"),Fl.k0s(),Fl.nrm(16,"textarea",47),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.R7$(2),Fl.JRh(Fl.bMT(3,4,"selectImportFile")),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(7,6,"chooseFile")," "),Fl.R7$(2),Fl.SpI(" ",e.fileSelected?e.fileSelected.name:Fl.bMT(9,8,"noFileChosen")," "),Fl.R7$(6),Fl.JRh(Fl.bMT(15,10,"orCopyPasteFileContents"))}}class HW{get organizationId(){return this._organizationId}set organizationId(e){return bd.isNullOrEmpty(e)?(this._organizationId=void 0,void(this.organization=void 0)):S_(e)?(this._organizationId=e,void iv(this.accountService.activeAccount$).pipe((0,go.n)(t=>this.organizationService.organizations$(t).pipe(rR(e)))).pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{this._organizationId=null==e?void 0:e.id,this.organization=e})):(this._organizationId=void 0,void(this.organization=void 0))}ngAfterViewInit(){this.bitSubmit.loading$.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{this.formLoading.emit(e)}),this.bitSubmit.disabled$.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{this.formDisabled.emit(e)})}constructor(e,t,i,n,r,s,o,a,c,u,d,h,p,v,f,m,g){this.i18nService=e,this.importService=t,this.platformUtilsService=i,this.policyService=n,this.logService=r,this.syncService=s,this.dialogService=o,this.folderService=a,this.organizationService=c,this.collectionService=u,this.formBuilder=d,this.importCollectionService=h,this.toastService=p,this.accountService=v,this.restrictedItemTypesService=f,this.destroyRef=m,this.importMetadataService=g,this.DefaultCollectionType=yR,this.format=null,this.organization=void 0,this.destroy$=new Co.B,this.isCardTypeRestricted$=this.restrictedItemTypesService.restricted$.pipe((0,l.T)(e=>e.length>0)),this._importBlockedByPolicy=!1,this.isFromAC=!1,this.activeUserId$=this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)),this.formGroup=this.formBuilder.group({vaultSelector:["myVault",{nonNullable:!0,validators:[Il.k0.required]}],targetSelector:[null],format:[null,[Il.k0.required]],fileContents:[],file:[],lastPassType:["direct"],chromiumLoader:[EX.file]}),this.formLoading=new Fl.bkB,this.formDisabled=new Fl.bkB,this.onSuccessfulImport=new Fl.bkB,this.importer$=new Dd.t(void 0),this.showChromiumInstructions$=this.importer$.pipe((0,l.T)(e=>(null==e?void 0:e.instructions)===$X.chromium)),this.browserImporterAvailable$=this.importer$.pipe((0,l.T)(e=>{var t;return(null!==(t=null==e?void 0:e.loaders)&&void 0!==t?t:[]).includes(EX.chromium)})),this.showChromiumOptions$=this.formGroup.controls.chromiumLoader.valueChanges.pipe((0,l.T)(e=>e===EX.chromium)),this.submit=()=>xq(this,void 0,void 0,function*(){yield this.asyncValidatorsFinished(),this.formGroup.invalid?this.formGroup.markAllAsTouched():yield this.performImport()})}get importBlockedByPolicy(){return this._importBlockedByPolicy}get showLastPassToggle(){return"lastpasscsv"===this.format&&(this.platformUtilsService.getClientType()===Da.Desktop||this.platformUtilsService.getClientType()===Da.Browser)}get showLastPassOptions(){return this.showLastPassToggle&&"direct"===this.formGroup.controls.lastPassType.value}ngOnInit(){return xq(this,void 0,void 0,function*(){yield this.importMetadataService.init(),this.setImportOptions(),this.importMetadataService.metadata$(this.formGroup.controls.format.valueChanges).pipe((0,xl.pQ)(this.destroyRef)).subscribe({next:e=>{var t,i;this.importer$.next(e);const n=(null===(t=e.loaders)||void 0===t?void 0:t.includes(EX.chromium))?EX.chromium:null===(i=e.loaders)||void 0===i?void 0:i[0];this.formGroup.controls.chromiumLoader.setValue(null!=n?n:EX.file)},error:e=>this.logService.error("an error occurred",e)}),this.organizationId?yield this.handleOrganizationImportInit():yield this.handleImportInit(),this.formGroup.controls.format.valueChanges.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{this.format=e}),yield this.handlePolicies()})}handleOrganizationImportInit(){return xq(this,void 0,void 0,function*(){const e=yield(0,bo._)(iv(this.accountService.activeAccount$));this.organizations$=this.organizationService.memberOrganizations$(e).pipe((0,l.T)(e=>e.filter(e=>e.id==this.organizationId&&(e.canAccessImport||e.canCreateNewCollections)))),this.formGroup.controls.vaultSelector.patchValue(this.organizationId),this.formGroup.controls.vaultSelector.disable(),this.collections$=bd.asyncToObservable(()=>this.importCollectionService.getAllAdminCollections(this.organizationId,e).then(e=>e.sort(bd.getSortFunction(this.i18nService,"name")))),this.isFromAC=!0})}handleImportInit(){return xq(this,void 0,void 0,function*(){this.folders$=this.activeUserId$.pipe((0,go.n)(e=>this.folderService.folderViews$(e)),(0,l.T)(e=>e.filter(e=>!!e.id))),this.formGroup.controls.targetSelector.disable();const e=yield(0,bo._)(iv(this.accountService.activeAccount$));this.organizations$=this.organizationService.memberOrganizations$(e).pipe((0,Yp.v)(this.collectionService.decryptedCollections$(e)),(0,l.T)(([e,t])=>e.filter(e=>t.some(t=>t.organizationId===e.id&&t.manage)).sort(bd.getSortFunction(this.i18nService,"name")))),(0,jo.z)([this.formGroup.controls.vaultSelector.valueChanges,this.organizations$]).pipe((0,vm.Q)(this.destroy$)).subscribe(([t,i])=>{this.organizationId="myVault"!==t?t:void 0,this._importBlockedByPolicy||this.formGroup.controls.targetSelector.enable(),t&&(this.collections$=this.collectionService.decryptedCollections$(e).pipe((0,l.T)(e=>e.filter(e=>e.organizationId===t&&e.manage).sort(bd.getSortFunction(this.i18nService,"name")))))}),this.formGroup.controls.vaultSelector.setValue("myVault")})}handlePolicies(){return xq(this,void 0,void 0,function*(){(0,jo.z)([this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.policyService.policyAppliesToUser$(op.OrganizationDataOwnership,e))),this.organizations$]).pipe((0,vm.Q)(this.destroy$)).subscribe(([e,t])=>{this._importBlockedByPolicy=e,e&&0==t.length&&this.formGroup.disable(),e&&t.length>0&&this.formGroup.controls.vaultSelector.setValue(t[0].id)})})}asyncValidatorsFinished(){return xq(this,void 0,void 0,function*(){this.formGroup.pending&&(yield(0,bo._)(this.formGroup.statusChanges.pipe((0,Eo.p)(e=>"PENDING"!==e))))})}performImport(){return xq(this,void 0,void 0,function*(){var e;if(!(yield this.validateImport()))return;const t=this.importService.getImporter(this.format,()=>xq(this,void 0,void 0,function*(){return yield this.getFilePassword()}),this.organizationId);if(null===t)return void this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("selectFormat")});const i=yield this.setImportContents();if(null!=i&&""!==i)try{const n=yield this.importService.import(t,i,this.organizationId,this.formGroup.controls.targetSelector.value,(null===(e=this.organization)||void 0===e?void 0:e.canAccessImport)&&this.isFromAC);this.dialogService.open(Nz,{data:n}),this.syncService.fullSync(!0),this.onSuccessfulImport.emit(this._organizationId)}catch(e){this.dialogService.open(Oz,{data:e}),this.logService.error(e)}else this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("selectFile")})})}getFormatInstructionTitle(){if(null==this.format)return null;const e=this.featuredImportOptions.concat(this.importOptions).filter(e=>e.id===this.format);return e.length>0?this.i18nService.t("instructionsFor",e[0].name):null}setImportOptions(){this.featuredImportOptions=[...this.importService.featuredImportOptions],this.importOptions=[...this.importService.regularImportOptions].sort((e,t)=>null==e.name&&null!=t.name?-1:null!=e.name&&null==t.name?1:null==e.name&&null==t.name?0:this.i18nService.collator?this.i18nService.collator.compare(e.name,t.name):e.name.localeCompare(t.name))}setSelectedFile(e){const t=e.target;this.fileSelected=t.files.length>0?t.files[0]:null}getFileContents(e){return"1password1pux"===this.format&&e.name.endsWith(".1pux")?this.extractZipContent(e,"export.data"):"protonpass"!==this.format||"application/zip"!==e.type&&"application/x-zip-compressed"!=e.type&&!e.name.endsWith(".zip")?new Promise((t,i)=>{const n=new FileReader;n.readAsText(e,"utf-8"),n.onload=n=>{if("lastpasscsv"===this.format&&"text/html"===e.type){const e=(new DOMParser).parseFromString(n.target.result,"text/html").querySelector("pre");return null!=e?void t(e.textContent):void i()}t(n.target.result)},n.onerror=()=>{i()}}):this.extractZipContent(e,"Proton Pass/data.json")}extractZipContent(e,t){return(new B_).loadAsync(e).then(e=>e.file(t).async("string")).then(function(e){return e},function(e){return""})}getFilePassword(){return xq(this,void 0,void 0,function*(){const e=this.dialogService.open(Vz,{ariaModal:!0});return yield(0,xT.s)(e.closed)})}validateImport(){return xq(this,void 0,void 0,function*(){if(this.organization){if(!(yield this.dialogService.openSimpleDialog({title:{key:"warning"},content:{key:"importWarning",placeholders:[this.organization.name]},type:"warning"})))return!1}return!this.importBlockedByPolicy||null!=this.organizationId||(this.toastService.showToast({variant:"error",title:null,message:this.i18nService.t("personalOwnershipPolicyInEffectImports")}),!1)})}setImportContents(){return xq(this,void 0,void 0,function*(){const e=document.getElementById("import_input_file"),t=null==e?void 0:e.files;let i=this.formGroup.controls.fileContents.value;if(null!=t&&t.length>0)try{const e=yield this.getFileContents(t[0]);null!=e&&(i=e)}catch(e){this.logService.error(e)}return i})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}}HW.ɵfac=function(e){return new(e||HW)(Fl.rXU(Ul),Fl.rXU(_z),Fl.rXU(Hb),Fl.rXU(Jb),Fl.rXU(Za),Fl.rXU(qx),Fl.rXU(lh),Fl.rXU(UM),Fl.rXU(WF),Fl.rXU(uR),Fl.rXU(Il.ok),Fl.rXU(VX,8),Fl.rXU(qb),Fl.rXU(Zk),Fl.rXU(r$),Fl.rXU(a.abz),Fl.rXU(DX))},HW.ɵcmp=Fl.VBU({type:HW,selectors:[["tools-import"]],viewQuery:function(e,t){if(1&e&&Fl.GBs(Md,5),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.bitSubmit=e.first)}},inputs:{organizationId:"organizationId",onLoadProfilesFromBrowser:"onLoadProfilesFromBrowser",onImportFromBrowser:"onImportFromBrowser"},outputs:{formLoading:"formLoading",formDisabled:"formDisabled",onSuccessfulImport:"onSuccessfulImport"},features:[Fl.Jv_(jX)],decls:51,vars:48,consts:[["fileSelector",""],["type","info",3,"title",4,"ngIf"],["id","import_form_importForm",3,"formGroup","bitSubmit"],["bitTypography","h6",1,"tw-font-medium"],[3,"hidden"],["formControlName","vaultSelector"],["value","myVault","icon","bwi-user",3,"label",4,"ngIf"],["icon","bwi-business",3,"value","label",4,"ngFor","ngForOf"],["disableMargin",""],["formControlName","targetSelector"],[4,"ngIf"],[1,"@2xl:tw-w-1/2"],["formControlName","format"],["value","",3,"label"],["value","-","disabled","",1,"tw-font-medium","tw-text-muted","tw-text-xs",3,"label"],[3,"value","label",4,"ngFor","ngForOf"],[3,"formGroup"],[3,"formGroup","onImportFromBrowser","onLoadProfilesFromBrowser","format"],["type","info",3,"title"],["value","myVault","icon","bwi-user",3,"label"],["icon","bwi-business",3,"value","label"],[3,"value","label"],["icon","bwi-folder",3,"value","label",4,"ngFor","ngForOf"],["icon","bwi-folder",3,"value","label"],[3,"value","label","icon",4,"ngFor","ngForOf"],[3,"value","label","icon"],["value","-","label","--------------------------------------","disabled",""],["bitLink","","linkType","primary","target","_blank","rel","noreferrer","href","https://bitwarden.com/help/export-your-data/"],["bitTypography","body1"],["bitLink","","linkType","primary","target","_blank","rel","noreferrer","href","https://bitwarden.com/help/import-from-lastpass/"],["formControlName","lastPassType",4,"ngIf"],["formControlName","lastPassType"],["id","import_bit-radio-button_lp-direct","value","direct",1,"tw-block"],["id","import_bit-radio-button_lp-csv","value","csv",1,"tw-block"],["bitLink","","linkType","primary","target","_blank","rel","noreferrer","href","https://bitwarden.com/help/import-from-chrome/"],["formControlName","chromiumLoader",3,"hidden"],["id","import_bit-radio-button_chrome-browser","value","chromium",1,"tw-block"],["id","import_bit-radio-button_chrome-file","value","file",1,"tw-block"],["bitLink","","linkType","primary","target","_blank","rel","noreferrer","href","https://bitwarden.com/help/import-from-firefox/"],["bitLink","","linkType","primary","target","_blank","rel","noreferrer","href","https://bitwarden.com/help/import-from-safari/"],["bitLink","","linkType","primary","target","_blank","rel","noreferrer","href","https://bitwarden.com/help/import-from-1password/"],["bitLink","","linkType","primary","target","_blank","rel","noreferrer","href","https://github.com/spookylukey/gnome-keyring-import-export"],[3,"csvDataLoaded","formGroup"],[3,"csvDataLoaded","formGroup","onImportFromBrowser","onLoadProfilesFromBrowser","format"],[1,"file-selector","tw-pt-2","tw-pb-1","tw-break-words"],["bitButton","","type","button","buttonType","secondary",3,"click"],["bitInput","","type","file","id","import_input_file","formControlName","file","hidden","",1,"tw-hidden",3,"change"],["id","import_textarea_fileContents","bitInput","","formControlName","fileContents"]],template:function(e,t){1&e&&(Fl.DNE(0,Aq,4,6,"bit-callout",1),Fl.nI1(1,"async"),Fl.j41(2,"form",2)(3,"bit-section")(4,"bit-section-header")(5,"h2",3),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s()(),Fl.j41(8,"bit-card")(9,"bit-form-field",4)(10,"bit-label"),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s(),Fl.j41(13,"bit-select",5),Fl.DNE(14,Dq,2,3,"bit-option",6)(15,Eq,1,2,"bit-option",7),Fl.nI1(16,"async"),Fl.k0s()(),Fl.j41(17,"bit-form-field",8)(18,"bit-label"),Fl.EFF(19),Fl.nI1(20,"i18n"),Fl.nI1(21,"i18n"),Fl.k0s(),Fl.j41(22,"bit-select",9),Fl.DNE(23,Oq,5,8,"ng-container",10)(24,Mq,5,8,"ng-container",10),Fl.k0s(),Fl.j41(25,"bit-hint"),Fl.EFF(26),Fl.nI1(27,"i18n"),Fl.nI1(28,"i18n"),Fl.k0s()()()(),Fl.j41(29,"bit-section")(30,"bit-section-header")(31,"h2",3),Fl.EFF(32),Fl.nI1(33,"i18n"),Fl.k0s()(),Fl.j41(34,"bit-card")(35,"bit-form-field",11)(36,"bit-label"),Fl.EFF(37),Fl.nI1(38,"i18n"),Fl.k0s(),Fl.j41(39,"bit-select",12),Fl.nrm(40,"bit-option",13),Fl.nI1(41,"i18n"),Fl.nrm(42,"bit-option",14),Fl.nI1(43,"i18n"),Fl.DNE(44,Nq,1,2,"bit-option",15)(45,Bq,3,1,"ng-container",10),Fl.k0s()(),Fl.DNE(46,XW,60,62,"bit-callout",1),Fl.nVh(47,qW,1,1,"import-lastpass",16),Fl.nI1(48,"async"),Fl.vZN(49,WW,1,4,"import-chrome",17)(50,YW,17,12),Fl.k0s()()()),2&e&&(Fl.Y8G("ngIf",Fl.bMT(1,22,t.isCardTypeRestricted$)),Fl.R7$(2),Fl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),Fl.R7$(4),Fl.JRh(Fl.bMT(7,24,"destination")),Fl.R7$(3),Fl.Y8G("hidden",t.isFromAC),Fl.R7$(2),Fl.JRh(Fl.bMT(12,26,"vault")),Fl.R7$(3),Fl.Y8G("ngIf",!t.importBlockedByPolicy),Fl.R7$(),Fl.Y8G("ngForOf",Fl.bMT(16,28,t.organizations$)),Fl.R7$(4),Fl.JRh(t.organizationId?Fl.bMT(20,30,"collection"):Fl.bMT(21,32,"folder")),Fl.R7$(4),Fl.Y8G("ngIf",!t.organizationId),Fl.R7$(),Fl.Y8G("ngIf",t.organizationId),Fl.R7$(2),Fl.JRh(t.organizationId?Fl.bMT(27,34,"importTargetHintCollection"):Fl.bMT(28,36,"importTargetHintFolder")),Fl.R7$(6),Fl.JRh(Fl.bMT(33,38,"data")),Fl.R7$(5),Fl.JRh(Fl.bMT(38,40,"fileFormat")),Fl.R7$(3),Fl.Y8G("label",Fl.VkB("-- ",Fl.bMT(41,42,"select")," --")),Fl.R7$(2),Fl.Y8G("label",Fl.mNQ(Fl.bMT(43,44,"commonImportFormats"))),Fl.R7$(2),Fl.Y8G("ngForOf",t.featuredImportOptions),Fl.R7$(),Fl.Y8G("ngIf",t.importOptions&&t.importOptions.length),Fl.R7$(),Fl.Y8G("ngIf",t.format),Fl.R7$(),Fl.vxM(t.showLastPassOptions?47:Fl.bMT(48,46,t.showChromiumOptions$)?49:50))},dependencies:[kl.MD,kl.Sq,kl.bT,sf,Gu,Ac,hu,fu,ju,pc,Md,id,td,Ql,Wu,qu,zu,dd,ud,Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,zX,Rq,Xc,Kc,Lc,Ex,Nx,Ux,Hh,uw,kl.Jj,rf],encapsulation:2});var JW=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class ZW{constructor(e,t,i,n){this.dialogService=e,this.toastService=t,this.platformUtilsService=i,this.i18nService=n}importSshKeyFromClipboard(){return JW(this,void 0,void 0,function*(){const e=yield this.platformUtilsService.readFromClipboard();let t=!1,i=null;try{i=(0,nm.bnN)(e)}catch(e){const i=e;if("PasswordRequired"!==i.variant&&"WrongPassword"!==i.variant)return this.toastService.showToast({variant:"error",title:"",message:this.i18nService.t(this.sshImportErrorVariantToI18nKey(i.variant))}),null;t=!0}if(t)for(;;){const t=yield this.getSshKeyPassword();if(""===t||null==t)return null;try{i=(0,nm.bnN)(e,t);break}catch(e){const t=e;if("WrongPassword"!==t.variant)return this.toastService.showToast({variant:"error",title:"",message:this.i18nService.t(this.sshImportErrorVariantToI18nKey(t.variant))}),null}}return this.toastService.showToast({variant:"success",title:"",message:this.i18nService.t("sshKeyImported")}),new cN(new pA({privateKey:i.privateKey,publicKey:i.publicKey,keyFingerprint:i.fingerprint}))})}sshImportErrorVariantToI18nKey(e){switch(e){case"ParsingError":return"invalidSshKey";case"UnsupportedKeyType":return"sshKeyTypeUnsupported";case"PasswordRequired":case"WrongPassword":return"sshKeyWrongPassword";default:return"errorOccurred"}}getSshKeyPassword(){return JW(this,void 0,void 0,function*(){const e=this.dialogService.open(Bz,{ariaModal:!0});return yield(0,bo._)(e.closed)})}}ZW.ɵfac=function(e){return new(e||ZW)(a.KVO(lh),a.KVO(qb),a.KVO(Hb),a.KVO(Ul))},ZW.ɵprov=a.jDH({token:ZW,factory:ZW.ɵfac});class QW{}var eY=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class tY{constructor(e,t,i,n,r,s,o,a,l,c,u,d){this.cipherService=e,this.policyService=t,this.organizationService=i,this.collectionService=n,this.logService=r,this.i18nService=s,this.dialogService=o,this.toastService=a,this.eventCollectionService=l,this.configService=c,this.organizationUserApiService=u,this.syncService=d,this._transferInProgressSubject=new Dd.t(!1),this.transferInProgress$=this._transferInProgressSubject.asObservable(),this.enforcementInFlight=!1}enforcingOrganization$(e){return this.policyService.policiesByType$(op.OrganizationDataOwnership,e).pipe((0,l.T)(e=>{var t;return null===(t=e.sort((e,t)=>e.revisionDate.getTime()-t.revisionDate.getTime()))||void 0===t?void 0:t[0]}),(0,go.n)(t=>null==t?(0,Go.of)(void 0):this.organizationService.organizations$(e).pipe(rR(t.organizationId))))}personalCiphers$(e){return this.cipherService.cipherViews$(e).pipe(p$(),(0,l.T)(e=>e.filter(e=>null==e.organizationId)))}userMigrationInfo$(e){return this.enforcingOrganization$(e).pipe((0,go.n)(t=>null==t?(0,Go.of)({requiresMigration:!1}):(0,jo.z)([this.personalCiphers$(e),this.collectionService.defaultUserCollection$(e,t.id)]).pipe((0,l.T)(([e,i])=>({requiresMigration:e.length>0,enforcingOrganization:t,defaultCollectionId:null==i?void 0:i.id})))))}promptUserForTransfer(e){return eY(this,void 0,void 0,function*(){const t=Pz.open(this.dialogService,{data:{organizationName:e}});if((yield(0,bo._)(t.closed))===Tz.Accepted)return!0;const i=Rz.open(this.dialogService,{data:{organizationName:e}});return(yield(0,bo._)(i.closed))===Fz.Back&&this.promptUserForTransfer(e)})}enforceOrganizationDataOwnership(e){return eY(this,void 0,void 0,function*(){if(!(yield this.configService.getFeatureFlag(Wv.MigrateMyVaultToMyItems))||this.enforcementInFlight)return;const t=yield(0,bo._)(this.userMigrationInfo$(e));if(!t.requiresMigration)return;if(null==t.defaultCollectionId)return void this.logService.warning("Default collection is missing for user during organization data ownership enforcement");this.enforcementInFlight=!0;if(!(yield this.promptUserForTransfer(t.enforcingOrganization.name)))return yield this.organizationUserApiService.revokeSelf(t.enforcingOrganization.id),this.toastService.showToast({variant:"success",message:this.i18nService.t("leftOrganization")}),yield this.eventCollectionService.collect(Ua.Organization_ItemOrganization_Declined,void 0,void 0,t.enforcingOrganization.id),yield this.syncService.fullSync(!0),void(this.enforcementInFlight=!1);try{this._transferInProgressSubject.next(!0),yield this.transferPersonalItems(e,t.enforcingOrganization.id,t.defaultCollectionId),this._transferInProgressSubject.next(!1),this.toastService.showToast({variant:"success",message:this.i18nService.t("itemsTransferred")}),yield this.eventCollectionService.collect(Ua.Organization_ItemOrganization_Accepted,void 0,void 0,t.enforcingOrganization.id)}catch(e){this._transferInProgressSubject.next(!1),this.logService.error("Error transferring personal items to organization",e),this.toastService.showToast({variant:"error",message:this.i18nService.t("errorOccurred")})}finally{this.enforcementInFlight=!1}})}transferPersonalItems(e,t,i){return eY(this,void 0,void 0,function*(){let n=yield(0,bo._)(this.personalCiphers$(e));if(0===n.length)return;const r=n.filter(e=>e.hasOldAttachments);if(r.length>0){yield this.upgradeOldAttachments(r,e,t),n=yield(0,bo._)(this.personalCiphers$(e));const i=n.filter(e=>e.hasOldAttachments);if(i.length>0)throw new Error(`Failed to upgrade all old attachments. ${i.length} ciphers still have old attachments.`)}this.logService.info(`Starting transfer of ${n.length} personal ciphers to organization ${t} for user ${e}`),yield this.cipherService.shareManyWithServer(n,t,[i],e)})}upgradeOldAttachments(e,t,i){return eY(this,void 0,void 0,function*(){this.logService.info(`Found ${e.length} ciphers with old attachments needing upgrade during transfer to organization ${i} for user ${t}`);for(const n of e)try{if(!n.hasOldAttachments)continue;if((yield this.cipherService.upgradeOldCipherAttachments(n,t)).hasOldAttachments)throw this.logService.error(`Attachment upgrade did not complete successfully for cipher ${n.id} during transfer to organization ${i} for user ${t}`),new Error(`Failed to upgrade old attachments for cipher ${n.id}`)}catch(e){throw this.logService.error(`Failed to upgrade old attachments for cipher ${n.id} during transfer to organization ${i} for user ${t}: ${e}`),new Error(`Failed to upgrade old attachments for cipher ${n.id}`)}this.logService.info(`Successfully upgraded ${e.length} ciphers with old attachments during transfer to organization ${i} for user ${t}`)})}}tY.ɵfac=function(e){return new(e||tY)(a.KVO(_b),a.KVO(Jb),a.KVO(WF),a.KVO(uR),a.KVO(Za),a.KVO(Ul),a.KVO(lh),a.KVO(qb),a.KVO(I$),a.KVO(Kb),a.KVO(MR),a.KVO(qx))},tY.ɵprov=a.jDH({token:tY,factory:tY.ɵfac});class iY extends tS{constructor(e){super(e),this.uri=this.getResponseProperty("uri")}}var nY=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class rY{constructor(e,t,i){this.apiService=e,this.environmentService=t,this.domainSettingsService=i}getChangePasswordUrl(e){return nY(this,void 0,void 0,function*(){if(e.type!==nx.Login||null==e.login||!e.login.hasUris)return null;const t=e.login.uris.map(e=>bd.getUrl(e.uri)).filter(e=>null!=e&&("http:"===e.protocol||"https:"===e.protocol));if(0===t.length)return null;if(!(yield(0,bo._)(this.domainSettingsService.showFavicons$)))return t[0].href;for(const e of t){const t=yield this.fetchWellKnownChangePasswordUri(e.href);if(t)return t}return t[0].href})}fetchWellKnownChangePasswordUri(e){return nY(this,void 0,void 0,function*(){const t=yield this.buildChangePasswordUriRequest(e),i=yield this.apiService.fetch(t);if(!i.ok)return null;const n=yield i.json(),{uri:r}=new iY(n);return r})}buildChangePasswordUriRequest(e){return nY(this,void 0,void 0,function*(){const t=new URLSearchParams;t.set("uri",e);const i=(yield(0,bo._)(this.environmentService.environment$)).getIconsUrl(),n=new URL(`${i}/change-password-uri?${t.toString()}`);return new Request(n,{method:"GET"})})}}rY.ɵfac=function(e){return new(e||rY)(a.KVO(eI),a.KVO(mk),a.KVO(YE))},rY.ɵprov=a.jDH({token:rY,factory:rY.ɵfac});var sY=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class oY{constructor(e,t,i,n,r,s){this.cipherArchiveService=e,this.dialogService=t,this.passwordRepromptService=i,this.toastService=n,this.i18nService=r,this.accountService=s}archiveCipher(e){return sY(this,arguments,void 0,function*(e,t=!1){if(!t){if(!(yield this.passwordRepromptService.passwordRepromptCheck(e)))return}if(!(yield this.dialogService.openSimpleDialog({title:{key:"archiveItem"},content:{key:"archiveItemDialogContent"},acceptButtonText:{key:"archiveVerb"},type:"info"})))return;const i=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));try{const t=yield this.cipherArchiveService.archiveWithServer(e.id,i);return this.toastService.showToast({variant:"success",message:this.i18nService.t("itemArchiveToast")}),t}catch(e){return void this.toastService.showToast({variant:"error",message:this.i18nService.t("errorOccurred")})}})}unarchiveCipher(e){return sY(this,arguments,void 0,function*(e,t=!1){if(!t){if(!(yield this.passwordRepromptService.passwordRepromptCheck(e)))return}const i=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));try{const t=yield this.cipherArchiveService.unarchiveWithServer(e.id,i);return this.toastService.showToast({variant:"success",message:this.i18nService.t("itemUnarchivedToast")}),t}catch(e){return void this.toastService.showToast({variant:"error",message:this.i18nService.t("errorOccurred")})}})}}oY.ɵfac=function(e){return new(e||oY)(a.KVO($V),a.KVO(lh),a.KVO(k$),a.KVO(qb),a.KVO(Ul),a.KVO(Zk))},oY.ɵprov=a.jDH({token:oY,factory:oY.ɵfac,providedIn:"root"});class aY{get collectionBreadcrumbs(){if(!this.isCollectionSelected)return[];const e=[this.selectedCollectionNode];for(;null!=e[e.length-1].parent;)e.push(e[e.length-1].parent);return e.slice(1).reverse()}get isCollectionSelected(){return null!=this.selectedCollectionNode&&"AllCollections"!==this.selectedCollectionNode.node.id}get isUnassignedCollectionSelected(){return null!=this.selectedCollectionNode&&null===this.selectedCollectionNode.node.id}get isMyVaultSelected(){var e;return"MyVault"===(null===(e=this.selectedOrganizationNode)||void 0===e?void 0:e.node.id)}get isFavorites(){var e;return"favorites"===(null===(e=this.selectedCipherTypeNode)||void 0===e?void 0:e.node.type)}get isDeleted(){var e;return"trash"===(null===(e=this.selectedCipherTypeNode)||void 0===e?void 0:e.node.type)||null}get isArchived(){var e;return"archive"===(null===(e=this.selectedCipherTypeNode)||void 0===e?void 0:e.node.type)}get organizationId(){var e;return null===(e=this.selectedOrganizationNode)||void 0===e?void 0:e.node.id}get cipherType(){var e,t;return sx(null===(e=this.selectedCipherTypeNode)||void 0===e?void 0:e.node.type)?null===(t=this.selectedCipherTypeNode)||void 0===t?void 0:t.node.type:null}get cipherStatus(){var e;return null===(e=this.selectedCipherTypeNode)||void 0===e?void 0:e.node.type}get cipherTypeId(){var e;return null===(e=this.selectedCipherTypeNode)||void 0===e?void 0:e.node.id}get folderId(){var e;return null===(e=this.selectedFolderNode)||void 0===e?void 0:e.node.id}get collectionId(){var e;return null===(e=this.selectedCollectionNode)||void 0===e?void 0:e.node.id}constructor(e){Object.assign(this,e)}resetFilter(){this.selectedCipherTypeNode=null,this.selectedFolderNode=null,this.selectedCollectionNode=null}resetOrganization(){this.selectedOrganizationNode=null}buildFilter(){return e=>{let t=!0;return this.isFavorites&&t&&(t=e.favorite),this.isDeleted&&t&&(t=e.isDeleted),this.isArchived&&t&&(t=e.isArchived),this.cipherType&&t&&(t=e.type===this.cipherType),this.selectedFolderNode&&(null===this.folderId&&t&&(t=null==e.folderId||""===e.folderId),null!==this.folderId&&t&&(t=e.folderId===this.folderId)),this.selectedCollectionNode&&("AllCollections"===this.collectionId&&t&&(t=!1),null===this.collectionId&&t&&(t=null!=e.organizationId&&(null==e.collectionIds||0===e.collectionIds.length)),null!==this.collectionId&&"AllCollections"!==this.collectionId&&t&&(t=null!=e.collectionIds&&e.collectionIds.includes(this.collectionId))),this.selectedOrganizationNode&&("MyVault"===this.organizationId&&t?t=null===e.organizationId:null!==this.organizationId&&t&&(t=e.organizationId===this.organizationId)),t}}}const lY="all",cY=["favorites","login","card","identity","note","sshKey","archive","trash",lY];function uY(e){return cY.includes(e)}class dY{constructor(e,t,i){this.routedFilter=e,this.legacyFilter=t,this.bridgeService=i}get collectionBreadcrumbs(){return this.legacyFilter.collectionBreadcrumbs}get isCollectionSelected(){return this.legacyFilter.isCollectionSelected}get isUnassignedCollectionSelected(){return this.legacyFilter.isUnassignedCollectionSelected}get isMyVaultSelected(){return this.legacyFilter.isMyVaultSelected}get selectedOrganizationNode(){return this.legacyFilter.selectedOrganizationNode}set selectedOrganizationNode(e){this.bridgeService.navigate(Object.assign(Object.assign({},this.routedFilter),{organizationId:"MyVault"===(null==e?void 0:e.node.id)?IR:null==e?void 0:e.node.id,folderId:void 0,collectionId:void 0}))}get selectedCipherTypeNode(){return this.legacyFilter.selectedCipherTypeNode}set selectedCipherTypeNode(e){let t;"AllItems"===(null==e?void 0:e.node.id)&&"path"===this.routedFilter.organizationIdParamType?t=lY:"AllItems"===(null==e?void 0:e.node.id)&&"query"===this.routedFilter.organizationIdParamType?t=void 0:uY(null==e?void 0:e.node.id)&&(t=null==e?void 0:e.node.id),this.bridgeService.navigate(Object.assign(Object.assign({},this.routedFilter),{type:t,folderId:void 0,collectionId:void 0}))}get selectedFolderNode(){return this.legacyFilter.selectedFolderNode}set selectedFolderNode(e){const t=(null==e?void 0:e.node.id)?e.node.id:IR;this.bridgeService.navigate(Object.assign(Object.assign({},this.routedFilter),{folderId:t,type:void 0,collectionId:void 0}))}get selectedCollectionNode(){return this.legacyFilter.selectedCollectionNode}set selectedCollectionNode(e){let t;t=null!=e&&null===e.node.id?IR:"AllCollections"===(null==e?void 0:e.node.id)&&"path"===this.routedFilter.organizationIdParamType?void 0:"AllCollections"===(null==e?void 0:e.node.id)&&"query"===this.routedFilter.organizationIdParamType?lY:null==e?void 0:e.node.id,this.bridgeService.navigate(Object.assign(Object.assign({},this.routedFilter),{collectionId:t,type:void 0,folderId:void 0}))}get isFavorites(){return this.legacyFilter.isFavorites}get isDeleted(){return this.legacyFilter.isDeleted}get isArchived(){return this.legacyFilter.isArchived}get organizationId(){return this.legacyFilter.organizationId}get cipherType(){return this.legacyFilter.cipherType}get cipherStatus(){return this.legacyFilter.cipherStatus}get cipherTypeId(){return this.legacyFilter.cipherTypeId}get folderId(){return this.legacyFilter.folderId}get collectionId(){return this.legacyFilter.collectionId}resetFilter(){this.bridgeService.navigate(Object.assign(Object.assign({},this.routedFilter),{collectionId:void 0,folderId:void 0,organizationId:"path"===this.routedFilter.organizationIdParamType?this.routedFilter.organizationId:void 0,type:void 0}))}resetOrganization(){this.bridgeService.navigate(Object.assign(Object.assign({},this.routedFilter),{organizationId:void 0}))}buildFilter(){return this.legacyFilter.buildFilter()}}class hY{}const pY=k.array(Te,"collapsedGroupings",{deserializer:e=>e,clearOn:["logout","lock"]});class vY{hasId(e){return null!=this.fullList&&this.fullList.filter(t=>t.id===e).length>0}constructor(e){Object.assign(this,e)}}var fY=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class mY{collapsedGroupingsState(e){return this.stateProvider.getUser(e,pY)}constructor(e,t,i,n,r,s,o,a){this.organizationService=e,this.folderService=t,this.cipherService=i,this.collectionService=n,this.policyService=r,this.stateProvider=s,this.accountService=o,this.i18nService=a}storeCollapsedFilterNodes(e,t){return fY(this,void 0,void 0,function*(){yield this.collapsedGroupingsState(t).update(()=>Array.from(e))})}buildCollapsedFilterNodes(e){return fY(this,void 0,void 0,function*(){return yield(0,bo._)(this.collapsedGroupingsState(e).state$.pipe((0,l.T)(e=>new Set(e))))})}buildOrganizations(){return fY(this,void 0,void 0,function*(){const e=yield(0,bo._)(iv(this.accountService.activeAccount$));let t=yield(0,bo._)(this.organizationService.organizations$(e));return null!=t&&(t=t.filter(e=>e.isMember).sort((e,t)=>e.name.localeCompare(t.name))),t})}buildNestedFolders(e){const t=(t,i)=>fY(this,void 0,void 0,function*(){let n;if(null==e||"MyVault"==e)n=t;else{const r=(yield this.cipherService.getAllDecrypted(i)).filter(t=>t.organizationId==e);n=t.filter(e=>r.some(t=>t.folderId==e.id)||!e.id)}const r=yield this.getAllFoldersNested(n);return new vY({fullList:n,nestedList:r})});return this.accountService.activeAccount$.pipe((0,_o.s)(1),iv,(0,go.n)(e=>this.folderService.folderViews$(e).pipe((0,Xx.Z)(i=>(0,$d.H)(t(i,e))))))}buildCollections(e){return fY(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.collectionService.decryptedCollections$(e)))),i=yield this.buildOrganizations();let n=null==e?t:t.filter(t=>t.organizationId===e);n=gY(n,i,this.i18nService.collator);const r=yield this.collectionService.getAllNested(n);return new vY({fullList:n,nestedList:r})})}checkForSingleOrganizationPolicy(){return fY(this,void 0,void 0,function*(){return yield(0,bo._)(this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.policyService.policyAppliesToUser$(op.SingleOrg,e))))})}checkForOrganizationDataOwnershipPolicy(){return fY(this,void 0,void 0,function*(){return yield(0,bo._)(this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.policyService.policyAppliesToUser$(op.OrganizationDataOwnership,e))))})}getAllFoldersNested(e){return fY(this,void 0,void 0,function*(){const t=[];return e.forEach(e=>{const i=new SU;i.id=e.id,i.revisionDate=e.revisionDate;const n=null!=e.name?e.name.replace(/^\/+|\/+$/g,"").split("/"):[];ER.nestedTraverse(t,0,n,i,void 0,"/")}),t})}getFolderNested(e){return fY(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv)),i=yield this.getAllFoldersNested(yield(0,bo._)(this.folderService.folderViews$(t)));return ER.getTreeNodeObjectFromList(i,e)})}}function gY(e,t=[],i){const n=e.filter(e=>e.type===yR).sort((e,n)=>{var r,s,o,a;const l=null!==(s=null===(r=t.find(t=>t.id===e.organizationId))||void 0===r?void 0:r.name)&&void 0!==s?s:e.organizationId,c=null!==(a=null===(o=t.find(e=>e.id===n.organizationId))||void 0===o?void 0:o.name)&&void 0!==a?a:n.organizationId;if(!l||!c)throw new Error("Collection does not have an organizationId.");return i.compare(l,c)});return[...n,...e.filter(e=>e.type!==yR)]}function yY(e){let t;return t=e instanceof CR?Object.assign(new CR(Object.assign(Object.assign({},e),{name:e.name})),e):Object.assign(new SR(Object.assign(Object.assign({},e),{name:e.name})),e),t}mY.ɵfac=function(e){return new(e||mY)(a.KVO(WF),a.KVO(UM),a.KVO(_b),a.KVO(uR),a.KVO(Jb),a.KVO(u),a.KVO(Zk),a.KVO(Ul))},mY.ɵprov=a.jDH({token:mY,factory:mY.ɵfac});var bY=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const wY="/";class SY{collapsedGroupingsState(e){return this.stateProvider.getUser(e,pY)}constructor(e,t,i,n,r,s,o,a){this.organizationService=e,this.folderService=t,this.cipherService=i,this.policyService=n,this.i18nService=r,this.stateProvider=s,this.collectionService=o,this.accountService=a,this.activeUserId$=this.accountService.activeAccount$.pipe(iv),this.memberOrganizations$=this.activeUserId$.pipe((0,go.n)(e=>this.organizationService.memberOrganizations$(e))),this.collapsedFilterNodes$=this.activeUserId$.pipe((0,go.n)(e=>this.collapsedGroupingsState(e).state$),(0,l.T)(e=>new Set(e))),this.organizationTree$=(0,jo.z)([this.memberOrganizations$,this.activeUserId$.pipe((0,go.n)(e=>this.policyService.policyAppliesToUser$(op.SingleOrg,e))),this.activeUserId$.pipe((0,go.n)(e=>this.policyService.policyAppliesToUser$(op.OrganizationDataOwnership,e)))]).pipe((0,go.n)(([e,t,i])=>this.buildOrganizationTree(e,t,i))),this._organizationFilter=new Dd.t(null),this.filteredFolders$=this.activeUserId$.pipe((0,go.n)(e=>(0,jo.z)([this.folderService.folderViews$(e),this.cipherService.cipherListViews$(e),this._organizationFilter])),(0,Eo.p)(([e,t,i])=>!!t),(0,go.n)(([e,t,i])=>this.filterFolders(e,t,i))),this.folderTree$=this.filteredFolders$.pipe((0,l.T)(e=>this.buildFolderTree(e))),this.filteredCollections$=(0,jo.z)([this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.collectionService.decryptedCollections$(e))),this._organizationFilter]).pipe((0,go.n)(([e,t])=>this.filterCollections(e,t))),this.collectionTree$=(0,jo.z)([this.filteredCollections$,this.memberOrganizations$]).pipe((0,l.T)(([e,t])=>this.buildCollectionTree(e,t))),this.cipherTypeTree$=this.buildCipherTypeTree()}getCollectionNodeFromTree(e){return bY(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.collectionTree$);return ER.getTreeNodeObject(t,e)})}setCollapsedFilterNodes(e,t){return bY(this,void 0,void 0,function*(){yield this.collapsedGroupingsState(t).update(()=>Array.from(e))})}getCollapsedFilterNodes(){return bY(this,void 0,void 0,function*(){return yield(0,bo._)(this.collapsedFilterNodes$)})}getOrganizationFilter(){return this._organizationFilter}clearOrganizationFilter(){this._organizationFilter.next(null)}setOrganizationFilter(e){"AllVaults"!=(null==e?void 0:e.id)?this._organizationFilter.next(e):this._organizationFilter.next(null)}expandOrgFilter(e){return bY(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.collapsedFilterNodes$);t.has("AllVaults")&&(t.delete("AllVaults"),yield this.setCollapsedFilterNodes(t,e))})}buildOrganizationTree(e,t,i){return bY(this,void 0,void 0,function*(){const n=this.getOrganizationFilterHead();if(!i){const e=this.getOrganizationFilterMyVault();n.children.push(e)}if(t&&(e=e.slice(0,1)),e){const t=[];e.forEach(e=>{const i=e;(null==e?void 0:e.productTierType)===M$.Free||(null==e?void 0:e.productTierType)===M$.Families?i.icon="bwi-family":i.icon="bwi-business";const r=new DR(i,n,i.name);t.push(r)}),t.sort((e,t)=>e.node.name.localeCompare(t.node.name)),n.children.push(...t)}return n})}getOrganizationFilterHead(){const e=new wU;return e.enabled=!0,new DR(e,null,"allVaults","AllVaults")}getOrganizationFilterMyVault(){const e=new wU;return e.id="MyVault",e.icon="bwi-user",e.enabled=!0,e.hideOptions=!0,new DR(e,null,this.i18nService.t("myVault"))}buildTypeTree(e,t){const i=new DR(e,null);return null==t||t.forEach(e=>{const t=new DR(e,i,e.name);i.children.push(t)}),(0,Go.of)(i)}filterCollections(e,t){return bY(this,void 0,void 0,function*(){return null!=(null==t?void 0:t.id)?e.filter(e=>e.organizationId===t.id):e})}buildCollectionTree(e,t){const i=this.getCollectionFilterHead();if(!e)return i;const n=[];e=gY(e,t,this.i18nService.collator);const r=this.collectionService.groupByOrganization(e);for(const e of r.values()){const t=[];for(const i of e){const e=yY(new SR(Object.assign(Object.assign({},i),{name:i.name})));e.icon=i.type===yR?"bwi-user":"bwi-collection-shared";const n=i.name?i.name.replace(/^\/+|\/+$/g,"").split(wY):[];ER.nestedTraverse(t,0,n,e,void 0,wY)}n.push(...t)}return n.forEach(e=>{e.parent=i,i.children.push(e)}),i}getCollectionFilterHead(){const e=SR.vaultFilterHead();return new DR(e,null,"collections","AllCollections")}filterFolders(e,t,i){return bY(this,void 0,void 0,function*(){if(null==(null==i?void 0:i.id)||"MyVault"==(null==i?void 0:i.id))return e;const n=t.filter(e=>e.organizationId==(null==i?void 0:i.id));return e.filter(e=>n.some(t=>t.folderId==e.id)||!e.id)})}buildFolderTree(e){const t=this.getFolderFilterHead();if(!e)return t;const i=[];return e.forEach(e=>{const t=new SU;t.id=e.id,t.revisionDate=e.revisionDate,t.icon="bwi-folder",t.fullName=e.name;const n=null!=e.name?e.name.replace(/^\/+|\/+$/g,"").split(wY):[];ER.nestedTraverse(i,0,n,t,null,wY)}),i.forEach(e=>{e.parent=t,t.children.push(e)}),t}getFolderFilterHead(){const e=new SU;return new DR(e,null,"folders","AllFolders")}buildCipherTypeTree(){const e=[{id:"favorites",name:this.i18nService.t("favorites"),type:"favorites",icon:"bwi-star"},{id:"login",name:this.i18nService.t("typeLogin"),type:nx.Login,icon:"bwi-globe"},{id:"card",name:this.i18nService.t("typeCard"),type:nx.Card,icon:"bwi-credit-card"},{id:"identity",name:this.i18nService.t("typeIdentity"),type:nx.Identity,icon:"bwi-id-card"},{id:"note",name:this.i18nService.t("typeSecureNote"),type:nx.SecureNote,icon:"bwi-sticky-note"},{id:"sshKey",name:this.i18nService.t("typeSshKey"),type:nx.SshKey,icon:"bwi-key"}];return this.buildTypeTree({id:"AllItems",name:"allItems",type:"all",icon:""},e)}}SY.ɵfac=function(e){return new(e||SY)(a.KVO(WF),a.KVO(UM),a.KVO(_b),a.KVO(Jb),a.KVO(Ul),a.KVO(u),a.KVO(uR),a.KVO(Zk))},SY.ɵprov=a.jDH({token:SY,factory:SY.ɵfac});const kY=new vc("VaultFilterBaseRoute");class IY{constructor(e){var t;this.onDestroy=new Co.B,this.baseRoute=null!==(t=(0,a.WQX)(kY,{optional:!0}))&&void 0!==t?t:"",this.filter$=(0,jo.z)([e.paramMap,e.queryParamMap]).pipe((0,l.T)(([e,t])=>{var i,n,r,s;const o=t.get("type"),a=uY(o)?o:void 0;return{collectionId:null!==(i=t.get("collectionId"))&&void 0!==i?i:void 0,folderId:null!==(n=t.get("folderId"))&&void 0!==n?n:void 0,organizationId:null!==(s=null!==(r=e.get("organizationId"))&&void 0!==r?r:t.get("organizationId"))&&void 0!==s?s:void 0,organizationIdParamType:null!=e.get("organizationId")?"path":"query",type:a}}),(0,vm.Q)(this.onDestroy))}createRoute(e){var t,i,n,r;return[this.baseRoute?[this.baseRoute]:[],{queryParams:{collectionId:null!==(t=e.collectionId)&&void 0!==t?t:null,folderId:null!==(i=e.folderId)&&void 0!==i?i:null,organizationId:"path"===e.organizationIdParamType?null:null!==(n=e.organizationId)&&void 0!==n?n:null,type:null!==(r=e.type)&&void 0!==r?r:null},queryParamsHandling:"merge",state:{focusAfterNav:!1}}]}ngOnDestroy(){this.onDestroy.next(),this.onDestroy.complete()}}IY.ɵfac=function(e){return new(e||IY)(a.KVO(Fd.nX))},IY.ɵprov=a.jDH({token:IY,factory:IY.ɵfac});class CY{constructor(e,t,i){this.router=e,this.routedVaultFilterService=t,this.activeFilter$=(0,jo.z)([t.filter$,i.collectionTree$,i.folderTree$,i.organizationTree$,i.cipherTypeTree$]).pipe((0,l.T)(([e,t,i,n,r])=>{const s=function(e){return"path"===e.organizationIdParamType}(e)?function(e,t,i){const n=new aY;void 0===e.collectionId&&void 0===e.type?n.selectedCollectionNode=ER.getTreeNodeObject(t,"AllCollections"):void 0!==e.collectionId&&e.collectionId===IR?n.selectedCollectionNode=ER.getTreeNodeObject(t,null):void 0!==e.collectionId&&(n.selectedCollectionNode=ER.getTreeNodeObject(t,e.collectionId));void 0===e.collectionId&&e.type===lY?n.selectedCipherTypeNode=ER.getTreeNodeObject(i,"AllItems"):void 0!==e.type&&"trash"===e.type?n.selectedCipherTypeNode=new DR({id:"trash",name:"",type:"trash",icon:""},null):void 0!==e.type&&"trash"!==e.type&&(n.selectedCipherTypeNode=ER.getTreeNodeObject(i,e.type));return n}(e,t,r):function(e,t,i,n,r){const s=new aY;void 0!==e.collectionId&&e.collectionId===IR?s.selectedCollectionNode=ER.getTreeNodeObject(t,null):void 0!==e.collectionId&&e.collectionId===lY?s.selectedCollectionNode=ER.getTreeNodeObject(t,"AllCollections"):void 0!==e.collectionId&&(s.selectedCollectionNode=ER.getTreeNodeObject(t,e.collectionId));void 0===e.folderId||e.folderId!==IR&&""!==e.folderId?void 0!==e.folderId&&e.folderId!==IR&&(s.selectedFolderNode=ER.getTreeNodeObject(i,e.folderId)):s.selectedFolderNode=ER.getTreeNodeObject(i,null);void 0!==e.organizationId&&e.organizationId===IR?s.selectedOrganizationNode=ER.getTreeNodeObject(n,"MyVault"):void 0!==e.organizationId&&e.organizationId!==IR&&(s.selectedOrganizationNode=ER.getTreeNodeObject(n,e.organizationId));void 0===e.type?s.selectedCipherTypeNode=ER.getTreeNodeObject(r,"AllItems"):void 0!==e.type&&"trash"===e.type?s.selectedCipherTypeNode=new DR({id:"trash",name:"",type:"trash",icon:""},null):void 0!==e.type&&"archive"===e.type?s.selectedCipherTypeNode=new DR({id:"archive",name:"",type:"archive",icon:""},null):void 0!==e.type&&"trash"!==e.type&&(s.selectedCipherTypeNode=ER.getTreeNodeObject(r,e.type));return s}(e,t,i,n,r);return new dY(e,s,this)}))}navigate(e){const[t,i]=this.routedVaultFilterService.createRoute(e);this.router.navigate(t,i)}}CY.ɵfac=function(e){return new(e||CY)(a.KVO(Fd.Ix),a.KVO(IY),a.KVO(hY))},CY.ɵprov=a.jDH({token:CY,factory:CY.ɵfac});var TY=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class PY{constructor(){this._defaultBrowserAutofillDisabled$=new Dd.t(!1),this.defaultBrowserAutofillDisabled$=this._defaultBrowserAutofillDisabled$.asObservable()}isBrowserAutofillSettingOverridden(e){return TY(this,void 0,void 0,function*(){return e!==Fa&&(yield ul.browserAutofillSettingsOverridden())})}setDefaultBrowserAutofillDisabled(e){this._defaultBrowserAutofillDisabled$.next(e)}}PY.ɵfac=function(e){return new(e||PY)},PY.ɵprov=a.jDH({token:PY,factory:PY.ɵfac,providedIn:"root"});class FY{}var RY=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function xY(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"div",3)(1,"bit-spotlight",38),Fl.nI1(2,"i18n"),Fl.nI1(3,"i18n"),Fl.bIt("onDismiss",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.dismissSpotlight())})("onButtonClick",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.disableBrowserAutofillSettingsFromNudge(t))}),Fl.k0s()()}if(2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("title",Fl.bMT(2,4,"autofillSpotlightTitle"))("subtitle",Fl.bMT(3,6,"autofillSpotlightDesc"))("buttonText",e.spotlightButtonText)("buttonIcon",e.spotlightButtonIcon)}}function AY(e,t){1&e&&(Fl.j41(0,"bit-hint",27),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"showInlineMenuOnFormFieldsDescAlt")," "))}function DY(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-hint"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.j41(3,"a",39),Fl.bIt("click",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.openURI(t,i.disablePasswordManagerURI))}),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()()}if(2&e){const e=Fl.XpG();Fl.HbH(e.enableInlineMenu?"tw-text-sm":"tw-text-sm tw-mb-6"),Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,5,"turnOffBrowserBuiltInPasswordManagerSettings")," "),Fl.R7$(2),Fl.BMQ("href",e.disablePasswordManagerURI,Fl.B4B),Fl.R7$(),Fl.SpI(" ",Fl.bMT(5,7,"turnOffBrowserBuiltInPasswordManagerSettingsLink")," ")}}function EY(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-form-control",40)(1,"input",41),Fl.bIt("change",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.updateShowInlineMenuIdentities())}),Fl.mxI("ngModelChange",function(t){a.eBV(e);const i=Fl.XpG();return Fl.DH7(i.showInlineMenuIdentities,t)||(i.showInlineMenuIdentities=t),a.Njj(t)}),Fl.k0s(),Fl.j41(2,"bit-label",42),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()()}if(2&e){const e=Fl.XpG();Fl.R7$(),Fl.R50("ngModel",e.showInlineMenuIdentities),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(4,2,"showInlineMenuIdentitiesLabel")," ")}}function $Y(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-form-control",40)(1,"input",43),Fl.bIt("change",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.updateShowInlineMenuCards())}),Fl.mxI("ngModelChange",function(t){a.eBV(e);const i=Fl.XpG();return Fl.DH7(i.showInlineMenuCards,t)||(i.showInlineMenuCards=t),a.Njj(t)}),Fl.k0s(),Fl.j41(2,"bit-label",44),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()()}if(2&e){const e=Fl.XpG();Fl.R7$(),Fl.R50("ngModel",e.showInlineMenuCards),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(4,2,"showInlineMenuCardsLabel")," ")}}function OY(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-form-control",40)(1,"input",45),Fl.bIt("change",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.updateInlineMenuVisibility())}),Fl.mxI("ngModelChange",function(t){a.eBV(e);const i=Fl.XpG();return Fl.DH7(i.enableInlineMenuOnIconSelect,t)||(i.enableInlineMenuOnIconSelect=t),a.Njj(t)}),Fl.k0s(),Fl.j41(2,"bit-label",46),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()()}if(2&e){const e=Fl.XpG();Fl.R7$(),Fl.R50("ngModel",e.enableInlineMenuOnIconSelect),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(4,2,"showInlineMenuOnIconSelectionLabel")," ")}}function UY(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-form-control")(1,"input",47),Fl.bIt("change",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.updateDefaultBrowserAutofillDisabled())}),Fl.mxI("ngModelChange",function(t){a.eBV(e);const i=Fl.XpG();return Fl.DH7(i.defaultBrowserAutofillDisabled,t)||(i.defaultBrowserAutofillDisabled=t),a.Njj(t)}),Fl.k0s(),Fl.j41(2,"bit-label",48),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"bit-hint",27),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.j41(8,"a",39),Fl.bIt("click",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.openURI(t,i.disablePasswordManagerURI))}),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s()()()}if(2&e){const e=Fl.XpG();Fl.R7$(),Fl.R50("ngModel",e.defaultBrowserAutofillDisabled),Fl.R7$(2),Fl.JRh(Fl.bMT(4,5,"overrideDefaultBrowserAutoFillSettings")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(7,7,"turnOffBrowserBuiltInPasswordManagerSettings")," "),Fl.R7$(2),Fl.BMQ("href",e.disablePasswordManagerURI,Fl.B4B),Fl.R7$(),Fl.SpI(" ",Fl.bMT(10,9,"turnOffBrowserBuiltInPasswordManagerSettingsLink")," ")}}function MY(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-form-control")(1,"input",49),Fl.bIt("change",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.updateShowCardsCurrentTab())}),Fl.mxI("ngModelChange",function(t){a.eBV(e);const i=Fl.XpG();return Fl.DH7(i.showCardsCurrentTab,t)||(i.showCardsCurrentTab=t),a.Njj(t)}),Fl.k0s(),Fl.j41(2,"bit-label",50),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()()}if(2&e){const e=Fl.XpG();Fl.R7$(),Fl.R50("ngModel",e.showCardsCurrentTab),Fl.R7$(2),Fl.JRh(Fl.bMT(4,2,"showCardsInVaultViewV2"))}}function NY(e,t){1&e&&(Fl.j41(0,"bit-hint",27),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.JRh(Fl.bMT(2,1,"enterprisePolicyRequirementsApplied")))}function VY(e,t){if(1&e&&Fl.nrm(0,"bit-option",51),2&e){const e=t.$implicit;Fl.Y8G("label",e.name)("value",e.value)}}function BY(e,t){if(1&e&&Fl.nrm(0,"bit-option",51),2&e){const e=t.$implicit;Fl.Y8G("label",e.name)("value",e.value)}}function jY(e,t){if(1&e&&Fl.nrm(0,"bit-option",55),2&e){const e=t.$implicit;Fl.Y8G("label",e.name)("value",e.value)("disabled",e.disabled)}}function GY(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"b"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.bVm()),2&e){const e=Fl.XpG().ngIf;Fl.R7$(2),Fl.SpI("",Fl.bMT(3,2,"warningCapitalized"),":"),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(5,4,e[1])," ")}}function LY(e,t){if(1&e&&(Fl.j41(0,"bit-hint"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.DNE(3,GY,6,6,"ng-container",11),Fl.k0s()),2&e){const e=t.ngIf;Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,2,e[0])," "),Fl.R7$(2),Fl.Y8G("ngIf",e.length>1)}}function zY(e,t){if(1&e&&(Fl.j41(0,"bit-form-field",12)(1,"bit-label",52),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"bit-select",53),Fl.DNE(5,jY,1,3,"bit-option",54),Fl.k0s(),Fl.DNE(6,LY,4,4,"bit-hint",11),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.JRh(Fl.bMT(3,3,"defaultUriMatchDetection")),Fl.R7$(3),Fl.Y8G("ngForOf",e.uriMatchOptions),Fl.R7$(),Fl.Y8G("ngIf",e.getMatchHints())}}class _Y{constructor(e,t,i,n,r,s,o,a,c,u,d,h,p,v,f){this.i18nService=e,this.platformUtilsService=t,this.domainSettingsService=i,this.dialogService=n,this.autofillSettingsService=r,this.messagingService=s,this.vaultSettingsService=o,this.configService=a,this.formBuilder=c,this.destroyRef=u,this.nudgesService=d,this.accountService=h,this.autofillBrowserSettingsService=p,this.restrictedItemTypesService=v,this.policyService=f,this.canOverrideBrowserAutofillSetting=!1,this.defaultBrowserAutofillDisabled=!1,this.inlineMenuVisibility=ka,this.browserClientVendor=Fa,this.disablePasswordManagerURI=xa.Unknown,this.browserShortcutsURI=Ra.Unknown,this.autofillOnPageLoadFromPolicy$=this.autofillSettingsService.activateAutofillOnPageLoadFromPolicy$,this.showSpotlightNudge$=this.accountService.activeAccount$.pipe((0,Eo.p)(e=>null!==e),(0,go.n)(e=>this.nudgesService.showNudgeSpotlight$(Sx.AutofillNudge,e.id))),this.restrictedCardType$=this.restrictedItemTypesService.restricted$.pipe((0,l.T)(e=>e.some(e=>e.cipherType===nx.Card)),(0,Gp.t)({bufferSize:1,refCount:!0})),this.autofillOnPageLoadForm=new Il.gE({autofillOnPageLoad:new Il.MJ,defaultAutofill:new Il.MJ}),this.additionalOptionsForm=new Il.gE({enableContextMenuItem:new Il.MJ,enableAutoTotpCopy:new Il.MJ,clearClipboard:new Il.MJ,defaultUriMatch:new Il.MJ}),this.isDefaultUriMatchDisabledByPolicy=!1,this.enableAutofillOnPageLoad=!1,this.enableInlineMenu=!1,this.enableInlineMenuOnIconSelect=!1,this.showInlineMenuIdentities=!0,this.showInlineMenuCards=!0,this.autofillOnPageLoadDefault=!1,this.enableContextMenuItem=!1,this.enableAutoTotpCopy=!1,this.defaultUriMatch=GE.Domain,this.showCardsCurrentTab=!0,this.showIdentitiesCurrentTab=!0,this.accountSwitcherEnabled=!1,this.handleOverrideDialogAccept=()=>RY(this,void 0,void 0,function*(){this.defaultBrowserAutofillDisabled=!0,yield this.updateDefaultBrowserAutofillDisabled()}),this.autofillOnPageLoadOptions=[{name:this.i18nService.t("autoFillOnPageLoadYes"),value:!0},{name:this.i18nService.t("autoFillOnPageLoadNo"),value:!1}],this.clearClipboardOptions=[{name:e.t("never"),value:ua},{name:e.t("tenSeconds"),value:da},{name:e.t("twentySeconds"),value:ha},{name:e.t("thirtySeconds"),value:pa},{name:e.t("oneMinute"),value:va},{name:e.t("twoMinutes"),value:fa},{name:e.t("fiveMinutes"),value:ma}],this.uriMatchOptions=[{name:e.t("baseDomainOptionRecommended"),value:GE.Domain},{name:e.t("host"),value:GE.Host},{name:e.t("exact"),value:GE.Exact},{name:e.t("never"),value:GE.Never},{name:this.i18nService.t("uriAdvancedOption"),value:null,disabled:!0},{name:e.t("startsWith"),value:GE.StartsWith},{name:e.t("regEx"),value:GE.RegularExpression}],this.advancedOptionWarningMap={[GE.StartsWith]:"startsWithAdvancedOptionWarning",[GE.RegularExpression]:"regExAdvancedOptionWarning"},this.browserClientVendor=ul.getBrowserClientVendor(window),this.disablePasswordManagerURI=xa[this.browserClientVendor],this.browserShortcutsURI=Ra[this.browserClientVendor],this.browserClientIsUnknown=this.browserClientVendor===Fa}ngOnInit(){return RY(this,void 0,void 0,function*(){this.canOverrideBrowserAutofillSetting=!this.browserClientIsUnknown,this.defaultBrowserAutofillDisabled=yield this.autofillBrowserSettingsService.isBrowserAutofillSettingOverridden(this.browserClientVendor),this.inlineMenuVisibility=yield(0,bo._)(this.autofillSettingsService.inlineMenuVisibility$),this.showInlineMenuIdentities=yield(0,bo._)(this.autofillSettingsService.showInlineMenuIdentities$),this.showInlineMenuCards=yield(0,bo._)(this.autofillSettingsService.showInlineMenuCards$),this.enableInlineMenuOnIconSelect=this.inlineMenuVisibility===Sa,this.enableInlineMenu=this.inlineMenuVisibility===ka||this.enableInlineMenuOnIconSelect,this.autofillSettingsService.activateAutofillOnPageLoadFromPolicy$.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{e?this.autofillOnPageLoadForm.controls.autofillOnPageLoad.disable({emitEvent:!1}):this.autofillOnPageLoadForm.controls.autofillOnPageLoad.enable({emitEvent:!1})}),this.enableAutofillOnPageLoad=yield(0,bo._)(this.autofillSettingsService.autofillOnPageLoad$),this.autofillOnPageLoadForm.controls.autofillOnPageLoad.patchValue(this.enableAutofillOnPageLoad,{emitEvent:!1}),this.autofillOnPageLoadDefault=yield(0,bo._)(this.autofillSettingsService.autofillOnPageLoadDefault$),!1===this.enableAutofillOnPageLoad&&this.autofillOnPageLoadForm.controls.defaultAutofill.disable(),this.autofillOnPageLoadForm.controls.defaultAutofill.patchValue(this.autofillOnPageLoadDefault,{emitEvent:!1}),this.autofillOnPageLoadForm.controls.autofillOnPageLoad.valueChanges.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.autofillSettingsService.setAutofillOnPageLoad(e),this.enableDefaultAutofillControl(e)}),this.autofillOnPageLoadForm.controls.defaultAutofill.valueChanges.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.autofillSettingsService.setAutofillOnPageLoadDefault(e)}),this.enableContextMenuItem=yield(0,bo._)(this.autofillSettingsService.enableContextMenu$),this.additionalOptionsForm.controls.enableContextMenuItem.patchValue(this.enableContextMenuItem,{emitEvent:!1}),this.enableAutoTotpCopy=yield(0,bo._)(this.autofillSettingsService.autoCopyTotp$),this.additionalOptionsForm.controls.enableAutoTotpCopy.patchValue(this.enableAutoTotpCopy,{emitEvent:!1}),this.clearClipboard=yield(0,bo._)(this.autofillSettingsService.clearClipboardDelay$),this.additionalOptionsForm.controls.clearClipboard.patchValue(this.clearClipboard,{emitEvent:!1});const e=yield(0,bo._)(this.domainSettingsService.resolvedDefaultUriMatchStrategy$);this.defaultUriMatch=null==e?GE.Domain:e,this.additionalOptionsForm.controls.defaultUriMatch.patchValue(this.defaultUriMatch,{emitEvent:!1}),this.applyUriMatchPolicy(),this.additionalOptionsForm.controls.enableContextMenuItem.valueChanges.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.autofillSettingsService.setEnableContextMenu(e),this.messagingService.send("bgUpdateContextMenu")}),this.additionalOptionsForm.controls.enableAutoTotpCopy.valueChanges.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.autofillSettingsService.setAutoCopyTotp(e)}),this.additionalOptionsForm.controls.clearClipboard.valueChanges.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.autofillSettingsService.setClearClipboardDelay(e)}),this.additionalOptionsForm.controls.defaultUriMatch.valueChanges.pipe((0,kd.Z)(this.defaultUriMatch),(0,mm.J)(),(0,To.H)(([e,t])=>this.handleAdvancedMatch(e,t)),(0,xl.pQ)(this.destroyRef)).subscribe();const t=yield this.platformUtilsService.getAutofillKeyboardShortcut();yield this.setAutofillKeyboardHelperText(t),this.showCardsCurrentTab=yield(0,bo._)(this.vaultSettingsService.showCardsCurrentTab$),this.showIdentitiesCurrentTab=yield(0,bo._)(this.vaultSettingsService.showIdentitiesCurrentTab$)})}get spotlightButtonIcon(){return this.browserClientVendor===Fa?"bwi-external-link":null}get browserClientVendorExtended(){return this.browserClientVendor!==Fa?this.browserClientVendor:this.platformUtilsService.isFirefox()?"Firefox":this.platformUtilsService.isSafari()?"Safari":Fa}get spotlightButtonText(){return this.browserClientVendorExtended===Fa?this.i18nService.t("turnOffAutofill"):this.i18nService.t("turnOffBrowserAutofill",this.browserClientVendorExtended)}dismissSpotlight(){return RY(this,void 0,void 0,function*(){yield this.nudgesService.dismissNudge(Sx.AutofillNudge,yield(0,bo._)(this.accountService.activeAccount$.pipe(iv)))})}updateInlineMenuVisibility(){return RY(this,void 0,void 0,function*(){this.enableInlineMenu||(this.enableInlineMenuOnIconSelect=!1);const e=this.enableInlineMenuOnIconSelect?Sa:this.enableInlineMenu?ka:wa;yield this.autofillSettingsService.setInlineMenuVisibility(e),e!==wa&&(yield this.requestPrivacyPermission())})}getAutofillOnPageLoadFromPolicy(){return RY(this,void 0,void 0,function*(){yield(0,bo._)(this.autofillOnPageLoadFromPolicy$)})}enableDefaultAutofillControl(e=!0){e?this.autofillOnPageLoadForm.controls.defaultAutofill.enable():this.autofillOnPageLoadForm.controls.defaultAutofill.disable()}setAutofillKeyboardHelperText(e){return RY(this,void 0,void 0,function*(){this.autofillKeyboardHelperText=e?this.i18nService.t("autofillLoginShortcutText",e):this.i18nService.t("autofillLoginShortcutNotSet")})}openURI(e,t){return RY(this,void 0,void 0,function*(){e.preventDefault(),t!==xa[this.browserClientVendor]?t!==Ra[this.browserClientVendor]?yield ul.createNewTab(t):yield this.dialogService.openSimpleDialog(Object.assign(Object.assign({},this.browserClientIsUnknown?{content:{key:"confirmContinueToHelpCenterKeyboardShortcutsContent"},title:{key:"confirmContinueToHelpCenter"}}:{content:{key:"confirmContinueToBrowserKeyboardShortcutSettingsContent"},title:{key:"confirmContinueToBrowserSettingsTitle"}}),{acceptButtonText:{key:"continue"},acceptAction:()=>RY(this,void 0,void 0,function*(){yield ul.createNewTab(t)}),cancelButtonText:{key:"cancel"},type:"info"})):yield this.dialogService.openSimpleDialog(Object.assign(Object.assign({},this.browserClientIsUnknown?{content:{key:"confirmContinueToHelpCenterPasswordManagementContent"},title:{key:"confirmContinueToHelpCenter"}}:{content:{key:"confirmContinueToBrowserPasswordManagementSettingsContent"},title:{key:"confirmContinueToBrowserSettingsTitle"}}),{acceptButtonText:{key:"continue"},acceptAction:()=>RY(this,void 0,void 0,function*(){yield ul.createNewTab(t)}),cancelButtonText:{key:"cancel"},type:"info"}))})}requestPrivacyPermission(){return RY(this,void 0,void 0,function*(){this.inlineMenuVisibility!==wa&&this.canOverrideBrowserAutofillSetting&&!this.defaultBrowserAutofillDisabled&&(yield this.dialogService.openSimpleDialog({title:{key:"overrideDefaultBrowserAutofillTitle"},content:{key:"overrideDefaultBrowserAutofillDescription"},acceptButtonText:{key:"continue"},acceptAction:()=>RY(this,void 0,void 0,function*(){return yield this.handleOverrideDialogAccept()}),cancelButtonText:{key:"cancel"},type:"info"}))})}updateDefaultBrowserAutofillDisabled(){return RY(this,void 0,void 0,function*(){const e=yield this.privacyPermissionGranted();if(this.defaultBrowserAutofillDisabled||e){if(!e&&!(yield ul.requestPermission({permissions:["privacy"]})))return yield this.dialogService.openSimpleDialog({title:{key:"privacyPermissionAdditionNotGrantedTitle"},content:{key:"privacyPermissionAdditionNotGrantedDescription"},acceptButtonText:{key:"ok"},cancelButtonText:null,type:"warning"}),void(this.defaultBrowserAutofillDisabled=!1);yield ul.updateDefaultBrowserAutofillSettings(!this.defaultBrowserAutofillDisabled),this.autofillBrowserSettingsService.setDefaultBrowserAutofillDisabled(this.defaultBrowserAutofillDisabled)}})}applyUriMatchPolicy(){this.domainSettingsService.defaultUriMatchStrategyPolicy$.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{null!==e?(this.isDefaultUriMatchDisabledByPolicy=!0,this.additionalOptionsForm.controls.defaultUriMatch.disable({emitEvent:!1})):(this.isDefaultUriMatchDisabledByPolicy=!1,this.additionalOptionsForm.controls.defaultUriMatch.enable({emitEvent:!1}))})}handleAdvancedMatch(e,t){return RY(this,void 0,void 0,function*(){if(!(e!==t)||!(t===GE.StartsWith||t===GE.RegularExpression))return yield this.domainSettingsService.setDefaultUriMatchStrategy(t);WV.open(this.dialogService,{contentKey:this.advancedOptionWarningMap[t],onContinue:()=>RY(this,void 0,void 0,function*(){this.additionalOptionsForm.controls.defaultUriMatch.setValue(t),yield this.domainSettingsService.setDefaultUriMatchStrategy(t)}),onCancel:()=>RY(this,void 0,void 0,function*(){this.additionalOptionsForm.controls.defaultUriMatch.setValue(e),yield this.domainSettingsService.setDefaultUriMatchStrategy(e)})})})}privacyPermissionGranted(){return RY(this,void 0,void 0,function*(){return yield ul.permissionsGranted(["privacy"])})}updateShowCardsCurrentTab(){return RY(this,void 0,void 0,function*(){yield this.vaultSettingsService.setShowCardsCurrentTab(this.showCardsCurrentTab)})}updateShowIdentitiesCurrentTab(){return RY(this,void 0,void 0,function*(){yield this.vaultSettingsService.setShowIdentitiesCurrentTab(this.showIdentitiesCurrentTab)})}updateShowInlineMenuCards(){return RY(this,void 0,void 0,function*(){yield this.autofillSettingsService.setShowInlineMenuCards(this.showInlineMenuCards)})}updateShowInlineMenuIdentities(){return RY(this,void 0,void 0,function*(){yield this.autofillSettingsService.setShowInlineMenuIdentities(this.showInlineMenuIdentities)})}getMatchHints(){var e;const t=["uriMatchDefaultStrategyHint"],i=null===(e=this.additionalOptionsForm.get("defaultUriMatch"))||void 0===e?void 0:e.value;return i!==GE.StartsWith&&i!==GE.RegularExpression||t.push(this.advancedOptionWarningMap[i]),t}disableBrowserAutofillSettingsFromNudge(e){return RY(this,void 0,void 0,function*(){this.canOverrideBrowserAutofillSetting?(this.defaultBrowserAutofillDisabled=!0,yield this.updateDefaultBrowserAutofillDisabled(),yield this.nudgesService.dismissNudge(Sx.AutofillNudge,yield(0,bo._)(this.accountService.activeAccount$.pipe(iv)))):yield this.openURI(e,this.disablePasswordManagerURI)})}}_Y.ɵfac=function(e){return new(e||_Y)(Fl.rXU(Ul),Fl.rXU(Hb),Fl.rXU(YE),Fl.rXU(lh),Fl.rXU(BE),Fl.rXU(bk),Fl.rXU(FY),Fl.rXU(Kb),Fl.rXU(Il.ok),Fl.rXU(a.abz),Fl.rXU(Ix),Fl.rXU(Zk),Fl.rXU(PY),Fl.rXU(r$),Fl.rXU(Jb))},_Y.ɵcmp=Fl.VBU({type:_Y,selectors:[["ng-component"]],decls:116,vars:92,consts:[["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[1,"tw-bg-background-alt"],[1,"tw-mb-6"],["bitTypography","h6"],[3,"disableMargin"],["bitCheckbox","","id","show-inline-menu","type","checkbox",3,"change","ngModelChange","ngModel"],["for","show-inline-menu"],["class","tw-text-sm",4,"ngIf"],[3,"class",4,"ngIf"],["class","tw-ml-5",4,"ngIf"],[4,"ngIf"],["disableMargin",""],["bitCheckbox","","id","showIdentitiesSuggestions","type","checkbox",3,"change","ngModelChange","ngModel"],["for","showIdentitiesSuggestions",1,"tw-whitespace-normal"],["bit-item-content","","type","button",3,"click"],["bitTypography","body2"],["slot","secondary",1,"tw-text-sm","tw-whitespace-normal"],["aria-hidden","true","slot","end",1,"bwi","bwi-fw","bwi-external-link","bwi-lg","tw-text-muted",3,"appA11yTitle"],[3,"formGroup"],[1,"tw-mb-6","tw-text-sm"],["bitLink","","href","https://bitwarden.com/help/auto-fill-browser/","rel","noreferrer","target","_blank",1,"tw-no-underline"],["formControlName","autofillOnPageLoad","bitCheckbox","","id","autofillOnPageLoad","type","checkbox"],["for","autofillOnPageLoad"],["for","defaultAutofill"],["formControlName","defaultAutofill","bitInput","","id","defaultAutofill"],[3,"label","value",4,"ngFor","ngForOf"],[1,"tw-text-sm"],["formControlName","enableContextMenuItem","bitCheckbox","","id","context-menu","type","checkbox"],["for","context-menu"],["formControlName","enableAutoTotpCopy","bitCheckbox","","id","totp","type","checkbox"],["for","totp"],["for","clearClipboard"],["formControlName","clearClipboard","aria-describedby","clearClipboardHelp","bitInput","","id","clearClipboard"],["id","clearClipboardHelp",1,"tw-text-sm"],["disableMargin","",4,"ngIf"],["bit-item-content","","routerLink","/blocked-domains"],["slot","end","aria-hidden","true",1,"bwi","bwi-angle-right","bwi-lg"],[3,"onDismiss","onButtonClick","title","subtitle","buttonText","buttonIcon"],["bitLink","","rel","noreferrer","target","_blank",1,"tw-no-underline",3,"click"],[1,"tw-ml-5"],["bitCheckbox","","id","show-inline-menu-identities","type","checkbox",3,"change","ngModelChange","ngModel"],["for","show-inline-menu-identities"],["bitCheckbox","","id","show-inline-menu-cards","type","checkbox",3,"change","ngModelChange","ngModel"],["for","show-inline-menu-cards"],["bitCheckbox","","id","show-autofill-suggestions-on-icon","type","checkbox",3,"change","ngModelChange","ngModel"],["for","show-autofill-suggestions-on-icon"],["bitCheckbox","","id","overrideBrowserAutofill","type","checkbox",3,"change","ngModelChange","ngModel"],["for","overrideBrowserAutofill"],["bitCheckbox","","id","showCardsSuggestions","type","checkbox",3,"change","ngModelChange","ngModel"],["for","showCardsSuggestions"],[3,"label","value"],["for","defaultUriMatch"],["formControlName","defaultUriMatch","aria-describedby","defaultUriMatchHelp","bitInput","","id","defaultUriMatch"],[3,"label","value","disabled",4,"ngFor","ngForOf"],[3,"label","value","disabled"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page")(1,"popup-header",0),Fl.nI1(2,"i18n"),Fl.qex(3,1),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.j41(5,"div",2),Fl.nVh(6,xY,4,8,"div",3),Fl.nI1(7,"async"),Fl.j41(8,"bit-section")(9,"bit-section-header")(10,"h2",4),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s()(),Fl.j41(13,"bit-card")(14,"bit-form-control",5)(15,"input",6),Fl.bIt("change",function(){return t.updateInlineMenuVisibility()}),Fl.mxI("ngModelChange",function(e){return Fl.DH7(t.enableInlineMenu,e)||(t.enableInlineMenu=e),e}),Fl.k0s(),Fl.j41(16,"bit-label",7),Fl.EFF(17),Fl.nI1(18,"i18n"),Fl.k0s(),Fl.DNE(19,AY,3,3,"bit-hint",8)(20,DY,6,9,"bit-hint",9),Fl.k0s(),Fl.DNE(21,EY,5,4,"bit-form-control",10)(22,$Y,5,4,"bit-form-control",10),Fl.nI1(23,"async"),Fl.DNE(24,OY,5,4,"bit-form-control",10)(25,UY,11,11,"bit-form-control",11)(26,MY,5,4,"bit-form-control",11),Fl.nI1(27,"async"),Fl.j41(28,"bit-form-control",12)(29,"input",13),Fl.bIt("change",function(){return t.updateShowIdentitiesCurrentTab()}),Fl.mxI("ngModelChange",function(e){return Fl.DH7(t.showIdentitiesCurrentTab,e)||(t.showIdentitiesCurrentTab=e),e}),Fl.k0s(),Fl.j41(30,"bit-label",14),Fl.EFF(31),Fl.nI1(32,"i18n"),Fl.k0s()()()(),Fl.j41(33,"bit-section")(34,"bit-section-header")(35,"h2",4),Fl.EFF(36),Fl.nI1(37,"i18n"),Fl.k0s()(),Fl.j41(38,"bit-item")(39,"button",15),Fl.bIt("click",function(e){return t.openURI(e,t.browserShortcutsURI)}),Fl.j41(40,"h3",16),Fl.EFF(41),Fl.nI1(42,"i18n"),Fl.k0s(),Fl.j41(43,"bit-hint",17),Fl.EFF(44),Fl.k0s(),Fl.nrm(45,"i",18),Fl.nI1(46,"i18n"),Fl.k0s()()(),Fl.j41(47,"bit-section")(48,"form",19)(49,"bit-section-header")(50,"legend")(51,"h2",4),Fl.EFF(52),Fl.nI1(53,"i18n"),Fl.k0s()()(),Fl.j41(54,"bit-card")(55,"bit-hint",20),Fl.EFF(56),Fl.nI1(57,"i18n"),Fl.j41(58,"span")(59,"b"),Fl.EFF(60),Fl.nI1(61,"i18n"),Fl.k0s(),Fl.EFF(62),Fl.nI1(63,"i18n"),Fl.k0s(),Fl.j41(64,"a",21),Fl.EFF(65),Fl.nI1(66,"i18n"),Fl.k0s()(),Fl.j41(67,"bit-form-control"),Fl.nrm(68,"input",22),Fl.j41(69,"bit-label",23),Fl.EFF(70),Fl.nI1(71,"i18n"),Fl.k0s(),Fl.DNE(72,NY,3,3,"bit-hint",8),Fl.nI1(73,"async"),Fl.k0s(),Fl.j41(74,"bit-form-field",12)(75,"bit-label",24),Fl.EFF(76),Fl.nI1(77,"i18n"),Fl.k0s(),Fl.j41(78,"bit-select",25),Fl.DNE(79,VY,1,2,"bit-option",26),Fl.k0s(),Fl.j41(80,"bit-hint",27),Fl.EFF(81),Fl.nI1(82,"i18n"),Fl.k0s()()()()(),Fl.j41(83,"bit-section")(84,"form",19)(85,"bit-section-header")(86,"h2",4),Fl.EFF(87),Fl.nI1(88,"i18n"),Fl.k0s()(),Fl.j41(89,"bit-card")(90,"bit-form-control"),Fl.nrm(91,"input",28),Fl.j41(92,"bit-label",29),Fl.EFF(93),Fl.nI1(94,"i18n"),Fl.k0s()(),Fl.j41(95,"bit-form-control"),Fl.nrm(96,"input",30),Fl.j41(97,"bit-label",31),Fl.EFF(98),Fl.nI1(99,"i18n"),Fl.k0s()(),Fl.j41(100,"bit-form-field",5)(101,"bit-label",32),Fl.EFF(102),Fl.nI1(103,"i18n"),Fl.k0s(),Fl.j41(104,"bit-select",33),Fl.DNE(105,BY,1,2,"bit-option",26),Fl.k0s(),Fl.j41(106,"bit-hint",34),Fl.EFF(107),Fl.nI1(108,"i18n"),Fl.k0s()(),Fl.DNE(109,zY,7,5,"bit-form-field",35),Fl.k0s()()(),Fl.j41(110,"bit-section",12)(111,"bit-item")(112,"a",36),Fl.EFF(113),Fl.nI1(114,"i18n"),Fl.k0s(),Fl.nrm(115,"i",37),Fl.k0s()()()()),2&e&&(Fl.R7$(),Fl.Y8G("pageTitle",Fl.mNQ(Fl.bMT(2,42,"autofill"))),Fl.R7$(5),Fl.vxM(Fl.bMT(7,44,t.showSpotlightNudge$)?6:-1),Fl.R7$(5),Fl.JRh(Fl.bMT(12,46,"autofillSuggestionsSectionTitle")),Fl.R7$(3),Fl.Y8G("disableMargin",!t.enableInlineMenu&&!t.canOverrideBrowserAutofillSetting),Fl.R7$(),Fl.R50("ngModel",t.enableInlineMenu),Fl.R7$(2),Fl.JRh(Fl.bMT(18,48,"showInlineMenuLabel")),Fl.R7$(2),Fl.Y8G("ngIf",t.accountSwitcherEnabled&&t.canOverrideBrowserAutofillSetting),Fl.R7$(),Fl.Y8G("ngIf",!t.canOverrideBrowserAutofillSetting),Fl.R7$(),Fl.Y8G("ngIf",t.enableInlineMenu),Fl.R7$(),Fl.Y8G("ngIf",t.enableInlineMenu&&!Fl.bMT(23,50,t.restrictedCardType$)),Fl.R7$(2),Fl.Y8G("ngIf",t.enableInlineMenu),Fl.R7$(),Fl.Y8G("ngIf",t.canOverrideBrowserAutofillSetting),Fl.R7$(),Fl.Y8G("ngIf",!Fl.bMT(27,52,t.restrictedCardType$)),Fl.R7$(3),Fl.R50("ngModel",t.showIdentitiesCurrentTab),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(32,54,"showIdentitiesInVaultViewV2")," "),Fl.R7$(5),Fl.JRh(Fl.bMT(37,56,"autofillKeyboardShortcutSectionTitle")),Fl.R7$(5),Fl.JRh(Fl.bMT(42,58,"autofillKeyboardManagerShortcutsLabel")),Fl.R7$(3),Fl.SpI(" ",t.autofillKeyboardHelperText," "),Fl.R7$(),Fl.Y8G("appA11yTitle",Fl.mNQ(Fl.bMT(46,60,"opensInANewWindow"))),Fl.R7$(3),Fl.Y8G("formGroup",t.autofillOnPageLoadForm),Fl.R7$(4),Fl.JRh(Fl.bMT(53,62,"enableAutoFillOnPageLoadSectionTitle")),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(57,64,"enableAutoFillOnPageLoadDesc")," "),Fl.R7$(4),Fl.JRh(Fl.bMT(61,66,"warningCapitalized")),Fl.R7$(2),Fl.SpI(": ",Fl.bMT(63,68,"experimentalFeature")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(66,70,"learnMoreAboutAutofillOnPageLoadLinkText")," "),Fl.R7$(5),Fl.JRh(Fl.bMT(71,72,"enableAutoFillOnPageLoad")),Fl.R7$(2),Fl.Y8G("ngIf",Fl.bMT(73,74,t.autofillOnPageLoadFromPolicy$)),Fl.R7$(4),Fl.JRh(Fl.bMT(77,76,"defaultAutoFillOnPageLoad")),Fl.R7$(3),Fl.Y8G("ngForOf",t.autofillOnPageLoadOptions),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(82,78,"defaultAutoFillOnPageLoadDesc")," "),Fl.R7$(3),Fl.Y8G("formGroup",t.additionalOptionsForm),Fl.R7$(3),Fl.JRh(Fl.bMT(88,80,"additionalOptions")),Fl.R7$(6),Fl.JRh(Fl.bMT(94,82,"enableContextMenuItem")),Fl.R7$(5),Fl.JRh(Fl.bMT(99,84,"enableAutoTotpCopy")),Fl.R7$(2),Fl.Y8G("disableMargin",t.isDefaultUriMatchDisabledByPolicy),Fl.R7$(2),Fl.JRh(Fl.bMT(103,86,"clearClipboard")),Fl.R7$(3),Fl.Y8G("ngForOf",t.clearClipboardOptions),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(108,88,"clearClipboardDesc")," "),Fl.R7$(2),Fl.Y8G("ngIf",!t.isDefaultUriMatchDisabledByPolicy),Fl.R7$(4),Fl.JRh(Fl.bMT(114,90,"blockedDomains")))},dependencies:[Ex,hd,Qb,kl.MD,kl.Sq,kl.bT,Gu,Sc,Ac,hu,ju,Il.YN,Il.qT,Il.Zm,Il.BC,Il.cb,Il.vS,Ql,VP,GP,KP,sf,rw,Hh,uw,GD,aE,tE,Cw.iI,Cw.Wk,Ux,Nx,Wu,qu,zu,tc,rc,Il.X1,Il.j4,Il.JD,Ax,kl.Jj,rf],encapsulation:2});var KY=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const XY=new m(J,"enableAddedLoginPrompt",{deserializer:e=>null==e||e}),qY=new m(J,"enableChangedPasswordPrompt",{deserializer:e=>null==e||e});class WY{}var YY=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class HY{constructor(e,t){this.userNotificationSettingsService=e,this.vaultSettingsService=t,this.enableAddLoginNotification=!1,this.enableChangedPasswordNotification=!1,this.enablePasskeys=!0}ngOnInit(){return YY(this,void 0,void 0,function*(){this.enableAddLoginNotification=yield(0,bo._)(this.userNotificationSettingsService.enableAddedLoginPrompt$),this.enableChangedPasswordNotification=yield(0,bo._)(this.userNotificationSettingsService.enableChangedPasswordPrompt$),this.enablePasskeys=yield(0,bo._)(this.vaultSettingsService.enablePasskeys$)})}updateAddLoginNotification(){return YY(this,void 0,void 0,function*(){yield this.userNotificationSettingsService.setEnableAddedLoginPrompt(this.enableAddLoginNotification)})}updateChangedPasswordNotification(){return YY(this,void 0,void 0,function*(){yield this.userNotificationSettingsService.setEnableChangedPasswordPrompt(this.enableChangedPasswordNotification)})}updateEnablePasskeys(){return YY(this,void 0,void 0,function*(){yield this.vaultSettingsService.setEnablePasskeys(this.enablePasskeys)})}}function JY(e,t){if(1&e&&(Fl.rj2(0,"span"),Fl.EFF(1),Fl.eux()),2&e){const e=Fl.XpG();Fl.HbH(e.containerClasses()),Fl.R7$(),Fl.JRh(e.content())}}HY.ɵfac=function(e){return new(e||HY)(Fl.rXU(WY),Fl.rXU(FY))},HY.ɵcmp=Fl.VBU({type:HY,selectors:[["ng-component"]],decls:33,vars:22,consts:[["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[1,"tw-bg-background-alt"],["bitTypography","h6"],["bitCheckbox","","id","use-passkeys","type","checkbox",3,"change","ngModelChange","ngModel"],["for","use-passkeys"],["bitCheckbox","","id","addlogin-notification-bar","type","checkbox",3,"change","ngModelChange","ngModel"],["for","addlogin-notification-bar"],["disableMargin",""],["bitCheckbox","","id","changedpass-notification-bar","type","checkbox",3,"change","ngModelChange","ngModel"],["for","changedpass-notification-bar"],["bit-item-content","","routerLink","/excluded-domains"],["slot","end","aria-hidden","true",1,"bwi","bwi-angle-right"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page")(1,"popup-header",0),Fl.nI1(2,"i18n"),Fl.qex(3,1),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.j41(5,"div",2)(6,"bit-section")(7,"bit-section-header")(8,"h2",3),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s()(),Fl.j41(11,"bit-card")(12,"bit-form-control")(13,"input",4),Fl.bIt("change",function(){return t.updateEnablePasskeys()}),Fl.mxI("ngModelChange",function(e){return Fl.DH7(t.enablePasskeys,e)||(t.enablePasskeys=e),e}),Fl.k0s(),Fl.j41(14,"bit-label",5),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s()(),Fl.j41(17,"bit-form-control")(18,"input",6),Fl.bIt("change",function(){return t.updateAddLoginNotification()}),Fl.mxI("ngModelChange",function(e){return Fl.DH7(t.enableAddLoginNotification,e)||(t.enableAddLoginNotification=e),e}),Fl.k0s(),Fl.j41(19,"bit-label",7),Fl.EFF(20),Fl.nI1(21,"i18n"),Fl.k0s()(),Fl.j41(22,"bit-form-control",8)(23,"input",9),Fl.bIt("change",function(){return t.updateChangedPasswordNotification()}),Fl.mxI("ngModelChange",function(e){return Fl.DH7(t.enableChangedPasswordNotification,e)||(t.enableChangedPasswordNotification=e),e}),Fl.k0s(),Fl.j41(24,"bit-label",10),Fl.EFF(25),Fl.nI1(26,"i18n"),Fl.k0s()()()(),Fl.j41(27,"bit-section",8)(28,"bit-item")(29,"a",11),Fl.EFF(30),Fl.nI1(31,"i18n"),Fl.k0s(),Fl.nrm(32,"i",12),Fl.k0s()()()()),2&e&&(Fl.R7$(),Fl.Y8G("pageTitle",Fl.mNQ(Fl.bMT(2,10,"notifications"))),Fl.R7$(8),Fl.JRh(Fl.bMT(10,12,"vaultSaveOptionsTitle")),Fl.R7$(4),Fl.R50("ngModel",t.enablePasskeys),Fl.R7$(2),Fl.JRh(Fl.bMT(16,14,"enableUsePasskeys")),Fl.R7$(3),Fl.R50("ngModel",t.enableAddLoginNotification),Fl.R7$(2),Fl.JRh(Fl.bMT(21,16,"enableAddLoginNotification")),Fl.R7$(3),Fl.R50("ngModel",t.enableChangedPasswordNotification),Fl.R7$(2),Fl.JRh(Fl.bMT(26,18,"enableChangedPasswordNotification")),Fl.R7$(5),Fl.JRh(Fl.bMT(31,20,"excludedDomains")))},dependencies:[kl.MD,sf,Cw.iI,Cw.Wk,tE,aE,GD,VP,GP,KP,Ex,Ux,Nx,hd,Qb,tc,rc,Gu,Sc,Ac,Il.YN,Il.Zm,Il.BC,Il.vS,rf],encapsulation:2});class ZY{constructor(){this.variant=(0,o.hFB)("primary"),this.value=(0,o.hFB)(),this.type=(0,o.hFB)("count"),this.content=(0,Rl.EW)(()=>{const e=this.value();if("status"!==this.type()&&e&&!(e<0))return e>999?"999+":`${e}`}),this.textColor=(0,Rl.EW)(()=>"contrast"===this.variant()?"tw-text-fg-heading":"tw-text-fg-contrast"),this.padding=(0,Rl.EW)(()=>{var e,t;return(null!==(t=null===(e=this.value())||void 0===e?void 0:e.toString().length)&&void 0!==t?t:0)>2?"tw-px-1.5 tw-py-0.5":""}),this.containerClasses=(0,Rl.EW)(()=>["tw-inline-flex","tw-items-center","tw-justify-center","tw-align-middle","tw-text-xxs","tw-rounded-full",...{status:["tw-h-2","tw-w-2"],count:["tw-h-4","tw-min-w-4",this.padding()]}[this.type()],{primary:"tw-bg-bg-brand",subtle:"tw-bg-bg-contrast",success:"tw-bg-bg-success",warning:"tw-bg-bg-warning",danger:"tw-bg-bg-danger",accentPrimary:"tw-bg-fg-accent-primary-strong",contrast:"tw-bg-bg-primary"}[this.variant()],this.textColor()].join(" "))}}ZY.ɵfac=function(e){return new(e||ZY)},ZY.ɵcmp=Fl.VBU({type:ZY,selectors:[["bit-berry"]],inputs:{variant:[1,"variant"],value:[1,"value"],type:[1,"type"]},decls:1,vars:1,consts:[[3,"class"]],template:function(e,t){1&e&&Fl.nVh(0,JY,2,3,"span",0),2&e&&Fl.vxM("status"===t.type()||t.content()?0:-1)},encapsulation:2,changeDetection:0});function QY(e,t){1&e&&(Fl.j41(0,"div",11),Fl.nrm(1,"bit-berry",12),Fl.k0s())}function eH(e,t){if(1&e&&(Fl.j41(0,"li",6)(1,"button",7,0),Fl.nI1(3,"i18n"),Fl.nrm(4,"bit-svg",8),Fl.j41(5,"span",9),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s()(),Fl.DNE(8,QY,2,0,"div",10),Fl.k0s()),2&e){const e=t.$implicit,i=Fl.sdS(2),n=Fl.XpG();Fl.R7$(),Fl.Y8G("title",Fl.mNQ(Fl.bMT(3,8,e.label)))("ngClass",i.isActive?"tw-font-medium tw-text-primary-600":"tw-text-muted")("routerLink",e.page)("appA11yTitle",n.buttonTitle(e)),Fl.R7$(3),Fl.Y8G("content",i.isActive?e.iconActive:e.icon),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(7,10,e.label)," "),Fl.R7$(2),Fl.Y8G("ngIf",e.showBerry)}}class tH{constructor(e){this.i18nService=e,this.navButtons=[]}buttonTitle(e){const t=this.i18nService.t(e.label);return e.showBerry?this.i18nService.t("labelWithNotification",t):t}}tH.ɵfac=function(e){return new(e||tH)(Fl.rXU(Ul))},tH.ɵcmp=Fl.VBU({type:tH,selectors:[["popup-tab-navigation"]],hostAttrs:[1,"tw-block","tw-size-full","tw-flex","tw-flex-col"],inputs:{navButtons:"navButtons"},ngContentSelectors:["*"],decls:7,vars:1,consts:[["rla","routerLinkActive"],[1,"tw-h-full","tw-overflow-y-auto","[&>*]:tw-h-full","[&>*]:tw-overflow-y-auto"],[1,"tw-bg-background","tw-border-0","tw-border-t","tw-border-secondary-300","tw-border-solid"],[1,"tw-max-w-screen-sm","tw-mx-auto"],[1,"tw-flex","tw-flex-1","tw-mb-0","tw-p-0"],["class","tw-flex-1 tw-list-none tw-relative",4,"ngFor","ngForOf"],[1,"tw-flex-1","tw-list-none","tw-relative"],["routerLinkActive","","ariaCurrentWhenActive","page","type","button","role","link",1,"tw-w-full","tw-flex","tw-flex-col","tw-items-center","tw-px-0.5","tw-py-2","bit-compact:tw-py-1","tw-bg-transparent","tw-no-underline","hover:tw-no-underline","hover:tw-text-primary-600","tw-group/tab-nav-btn","hover:tw-bg-hover-default","tw-border-2","tw-border-solid","tw-border-transparent","focus-visible:tw-rounded-lg","focus-visible:tw-border-primary-600",3,"ngClass","title","routerLink","appA11yTitle"],["aria-hidden","true",1,"tw-leading-3",3,"content"],[1,"tw-text-sm","tw-truncate","tw-max-w-full"],["class","tw-absolute tw-top-0 tw-left-[calc(50%+5px)]",4,"ngIf"],[1,"tw-absolute","tw-top-0","tw-left-[calc(50%+5px)]"],["type","status","variant","danger"]],template:function(e,t){1&e&&(Fl.NAR(),Fl.j41(0,"div",1),Fl.SdG(1),Fl.k0s(),Fl.j41(2,"footer",2)(3,"div",3)(4,"nav")(5,"ul",4),Fl.DNE(6,eH,9,12,"li",5),Fl.k0s()()()()),2&e&&(Fl.R7$(6),Fl.Y8G("ngForOf",t.navButtons))},dependencies:[kl.MD,kl.YU,kl.Sq,kl.bT,Hh,Cw.iI,Cw.Wk,Cw.wQ,sf,rw,Yh,BC,ZY,rf],encapsulation:2});class iH{}iH.ɵfac=function(e){return new(e||iH)},iH.ɵcmp=Fl.VBU({type:iH,selectors:[["app-authentication-timeout"]],decls:6,vars:6,consts:[[1,"tw-text-center"],["routerLink","/login","bitButton","","block","","buttonType","primary"]],template:function(e,t){1&e&&(Fl.j41(0,"p",0),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s(),Fl.j41(3,"a",1),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,2,"authenticationSessionTimedOut")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(5,4,"logIn")," "))},dependencies:[kl.MD,sf,id,td,Cw.iI,Cw.Wk,rf],encapsulation:2});const nH=Object.freeze({SignUp:"signup",FinishSignUp:"finish-signup",Login:"login",LoginWithDevice:"login-with-device",AdminApprovalRequested:"admin-approval-requested",PasswordHint:"hint",LoginInitiated:"login-initiated",SetInitialPassword:"set-initial-password",ChangePassword:"change-password",Sso:"sso",TwoFactor:"2fa",AuthenticationTimeout:"authentication-timeout",NewDeviceVerification:"device-verification",LoginWithPasskey:"login-with-passkey"});var rH=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const sH=e=>({selectedRegion:e});function oH(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",4),Fl.bIt("click",function(){const t=a.eBV(e).$implicit,i=Fl.XpG(2);return a.Njj(i.toggle(t.key))}),Fl.nrm(1,"i",5),Fl.j41(2,"span"),Fl.EFF(3),Fl.k0s()()}if(2&e){const e=t.$implicit,i=Fl.XpG().ngIf;Fl.BMQ("aria-pressed",i.selectedRegion===e?"true":"false"),Fl.R7$(),Fl.xc7("visibility",i.selectedRegion===e?"visible":"hidden"),Fl.R7$(2),Fl.JRh(e.domain)}}function aH(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"div",2)(2,"bit-menu",null,0),Fl.DNE(4,oH,4,4,"button",3),Fl.j41(5,"button",4),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.toggle(t.ServerEnvironmentType.SelfHosted))}),Fl.nrm(6,"i",5),Fl.j41(7,"span"),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s()()(),Fl.j41(10,"div",6),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.j41(13,"button",7)(14,"b",8),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s(),Fl.nrm(17,"i",9),Fl.k0s()()(),Fl.bVm()}if(2&e){const e=t.ngIf,i=Fl.sdS(3),n=Fl.XpG();Fl.R7$(4),Fl.Y8G("ngForOf",n.availableRegions),Fl.R7$(),Fl.BMQ("aria-pressed",e.selectedRegion?"false":"true"),Fl.R7$(),Fl.xc7("visibility",e.selectedRegion?"hidden":"visible"),Fl.R7$(2),Fl.JRh(Fl.bMT(9,8,"selfHostedServer")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(12,10,"accessing"),": "),Fl.R7$(2),Fl.Y8G("bitMenuTriggerFor",i),Fl.R7$(2),Fl.JRh((null==e.selectedRegion?null:e.selectedRegion.domain)||Fl.bMT(16,12,"selfHostedServer"))}}class lH{constructor(e,t,i,n){this.environmentService=e,this.dialogService=t,this.toastService=i,this.i18nService=n,this.ServerEnvironmentType=hk,this.availableRegions=this.environmentService.availableRegions(),this.selectedRegion$=this.environmentService.environment$.pipe((0,l.T)(e=>e.getRegion()),(0,l.T)(e=>this.availableRegions.find(t=>t.key===e))),this.destroy$=new Co.B}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}toggle(e){return rH(this,void 0,void 0,function*(){if(null!==e){if(e===hk.SelfHosted){return void((yield nC.open(this.dialogService))&&this.toastService.showToast({variant:"success",title:"",message:this.i18nService.t("environmentSaved")}))}yield this.environmentService.setEnvironment(e)}})}}lH.ɵfac=function(e){return new(e||lH)(Fl.rXU(mk),Fl.rXU(lh),Fl.rXU(qb),Fl.rXU(Ul))},lH.ɵcmp=Fl.VBU({type:lH,selectors:[["environment-selector"]],decls:2,vars:5,consts:[["environmentOptions",""],[4,"ngIf"],[1,"tw-mb-1"],["bitMenuItem","","type","button",3,"click",4,"ngFor","ngForOf"],["bitMenuItem","","type","button",3,"click"],["aria-hidden","true",1,"bwi","bwi-fw","bwi-sm","bwi-check",2,"padding-bottom","1px"],["bitTypography","body2"],["bitLink","","type","button",3,"bitMenuTriggerFor"],[1,"tw-text-primary-600","tw-font-medium"],["aria-hidden","true",1,"bwi","bwi-fw","bwi-sm","bwi-angle-down"]],template:function(e,t){1&e&&(Fl.DNE(0,aH,18,14,"ng-container",1),Fl.nI1(1,"async")),2&e&&Fl.Y8G("ngIf",Fl.eq3(3,sH,Fl.bMT(1,1,t.selectedRegion$)))},dependencies:[kl.MD,kl.Sq,kl.bT,qh,pz,fz,D$,Hh,uw,tc,rc,kl.Jj,sc],encapsulation:2});var cH=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const uH=(e,t)=>cH(void 0,void 0,void 0,function*(){const e=(0,a.WQX)(Rd),i=(0,a.WQX)(Fd.Ix),n=(0,a.WQX)(bk),r=(0,a.WQX)(wT),s=(0,a.WQX)(Zk),o=(0,a.WQX)(Wb),l=yield e.getAuthStatus();if(l===Pd.LoggedOut)return n.send("authBlocked",{url:t.url}),!1;const c=(yield(0,bo._)(s.activeAccount$)).id,u=yield(0,bo._)(o.forceSetPasswordReason$(c));if(l===Pd.Locked&&u===aS.SsoNewJitProvisionedUser&&!t.url.includes("set-initial-password"))return i.createUrlTree(["/set-initial-password"]);if(l===Pd.Locked&&u===aS.TdeOffboardingUntrustedDevice&&!t.url.includes("set-initial-password"))return i.createUrlTree(["/set-initial-password"]);if(l===Pd.Locked&&u!==aS.SsoNewJitProvisionedUser&&u!==aS.TdeOffboardingUntrustedDevice)return null!=t&&n.send("lockedUrl",{url:t.url}),i.createUrlTree(["lock"],{queryParams:{promptBiometric:!0}});if((u===aS.TdeUserWithoutPasswordHasPasswordResetPermission||u===aS.TdeOffboarding)&&!t.url.includes("set-initial-password")){const e="/set-initial-password";return i.createUrlTree([e])}if((u===aS.AdminForcePasswordReset||u===aS.WeakMasterPassword)&&!t.url.includes("change-password")){const e="/change-password";return i.createUrlTree([e])}return!(u==aS.None&&!t.url.includes("remove-password")&&(yield(0,bo._)(r.convertAccountRequired$)))||i.createUrlTree(["/remove-password"])});var dH=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var hH=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var pH=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const vH={loggedIn:"/vault",loggedOut:"/login",locked:"/lock",notDecrypted:"/login-initiated"};var fH=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var mH=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const gH={homepage:()=>"/vault",locked:"/lock"};function yH(e={}){return t=>mH(this,void 0,void 0,function*(){return function(e,t){return mH(this,void 0,void 0,function*(){const e=(0,a.WQX)(Zk),i=(0,a.WQX)(Rd),n=(0,a.WQX)(Fd.Ix),r=(0,a.WQX)(Bp),s=(0,a.WQX)(tI),o=(0,a.WQX)(Za),l=yield(0,bo._)(e.activeAccount$);if(!l)return!0;const c=yield(0,bo._)(i.authStatusFor$(l.id));if(null==c||c===Pd.LoggedOut)return!0;if(c===Pd.Unlocked)return n.createUrlTree([t.homepage()]);const u=yield(0,bo._)(s.supportsDeviceTrustByUserId$(l.id)),d=yield(0,bo._)(r.everHadUserKey$(l.id));return c===Pd.Locked&&u&&!d?(o.info("Sending user to TDE decryption options. AuthStatus is %s. TDE support is %s. Ever had user key is %s.",Pd[c],u,d),n.createUrlTree(["/login-initiated"])):n.createUrlTree([t.locked])})}(0,Object.assign(Object.assign({},gH),e))})}var bH=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function wH(){return()=>bH(this,void 0,void 0,function*(){const e=(0,a.WQX)(Zk),t=(0,a.WQX)(Rd),i=(0,a.WQX)(Fd.Ix),n=yield(0,bo._)(e.activeAccount$);if(!n)return!0;return(yield(0,bo._)(t.authStatusFor$(n.id)))!==Pd.Unlocked||i.createUrlTree(["/vault"])})}const SH=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="4.72 12.85 92 80">
<path class="tw-fill-illustration-bg-primary" d="M16.722 18.846a6 6 0 0 1 6-6h68a6 6 0 0 1 6 6v48a6 6 0 0 1-6 6h-68a6 6 0 0 1-6-6v-48Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M90.722 14.846h-68a4 4 0 0 0-4 4v48a4 4 0 0 0 4 4h68a4 4 0 0 0 4-4v-48a4 4 0 0 0-4-4Zm-68-2a6 6 0 0 0-6 6v48a6 6 0 0 0 6 6h68a6 6 0 0 0 6-6v-48a6 6 0 0 0-6-6h-68Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" d="M54.732 34.216c1.353-2.327 4.713-2.327 6.066 0L72.24 53.898c1.36 2.34-.327 5.272-3.033 5.272H46.321c-2.705 0-4.392-2.933-3.032-5.272l11.443-19.682Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M70.512 54.904 59.07 35.22c-.582-1-2.026-1-2.608 0L45.018 54.904a1.508 1.508 0 0 0 1.303 2.266h22.887a1.508 1.508 0 0 0 1.304-2.266Zm-9.714-20.688c-1.353-2.327-4.713-2.327-6.066 0L43.288 53.898c-1.36 2.34.328 5.272 3.033 5.272h22.887c2.706 0 4.393-2.933 3.033-5.272L60.798 34.216Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" d="M59.168 53.557a1.403 1.403 0 1 1-2.806 0 1.403 1.403 0 0 1 2.806 0ZM55.702 41.315a.35.35 0 0 1 .348-.388h3.43a.35.35 0 0 1 .348.388l-.977 9.121a.35.35 0 0 1-.349.314h-1.474a.35.35 0 0 1-.35-.314l-.976-9.121Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M95.722 24.846h-78v-2h78v2Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" d="M92.722 18.846a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM86.722 18.846a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM80.722 18.846a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM9.722 31.846a2 2 0 0 1 2-2h15a2 2 0 0 1 2 2v15h-19v-15Z"/>
<path class="tw-fill-illustration-tertiary" d="M12.722 32.846h3v11h-3v-11ZM17.722 34.846h3v9h-3v-9ZM22.722 32.846h3v11h-3v-11Z"/>
<path class="tw-fill-illustration-bg-secondary" fill-rule="evenodd" d="M8.722 44.846a4 4 0 0 0-4 4v40a4 4 0 0 0 4 4h21a4 4 0 0 0 4-4v-40a4 4 0 0 0-4-4h-21Zm10.5 36a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M8.722 46.846a2 2 0 0 0-2 2v40a2 2 0 0 0 2 2h21a2 2 0 0 0 2-2v-40a2 2 0 0 0-2-2h-21Zm10.5 32a4.5 4.5 0 1 1 0 9 4.5 4.5 0 0 1 0-9Zm-14.5-30a4 4 0 0 1 4-4h21a4 4 0 0 1 4 4v40a4 4 0 0 1-4 4h-21a4 4 0 0 1-4-4v-40Zm17 34.5a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" fill-rule="evenodd" d="M19.222 72.846a7.5 7.5 0 1 0 0-15 7.5 7.5 0 0 0 0 15Zm0 2a9.5 9.5 0 1 0 0-19 9.5 9.5 0 0 0 0 19Z" clip-rule="evenodd"/>
</svg>
`;class kH{}var IH=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function CH(e,t){1&e&&(Fl.qex(0),Fl.j41(1,"p",4),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"button",5),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.bVm()),2&e&&(Fl.R7$(2),Fl.JRh(Fl.bMT(3,3,"readingPasskeyLoading")),Fl.R7$(2),Fl.Y8G("loading",!0),Fl.R7$(),Fl.SpI(" ",Fl.bMT(6,5,"loading")," "))}function TH(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"p",4),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"button",6),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.retry())}),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.bVm()}2&e&&(Fl.R7$(2),Fl.JRh(Fl.bMT(3,2,"passkeyAuthenticationFailed")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(6,4,"tryAgain")," "))}class PH{get successRoute(){const e=this.platformUtilsService.getClientType();return this.successRoutes[e]||"/vault"}constructor(e,t,i,n,r,s,o,a,l,c,u){this.webAuthnLoginService=e,this.router=t,this.route=i,this.logService=n,this.validationService=r,this.i18nService=s,this.loginSuccessHandlerService=o,this.keyService=a,this.platformUtilsService=l,this.anonLayoutWrapperDataService=c,this.messagingService=u,this.currentState="assert",this.shouldAutoClosePopout=!1,this.Icons={TwoFactorAuthSecurityKeyIcon:JT,TwoFactorAuthSecurityKeyFailedIcon:SH},this.successRoutes={[Da.Web]:"/vault",[Da.Browser]:"/tabs/vault",[Da.Desktop]:"/vault",[Da.Cli]:"/vault"}}ngOnInit(){this.shouldAutoClosePopout="true"===this.route.snapshot.queryParamMap.get("autoClosePopout"),this.authenticate()}retry(){this.currentState="assert",this.setDefaultIcon(),this.authenticate()}authenticate(){return IH(this,void 0,void 0,function*(){let e;try{const t=yield this.webAuthnLoginService.getCredentialAssertionOptions();e=yield this.webAuthnLoginService.assertCredential(t)}catch(e){return this.validationService.showError(e),this.currentState="assertFailed",void this.setFailureIcon()}try{const t=yield this.webAuthnLoginService.logIn(e);if(t.requiresTwoFactor)return this.validationService.showError(this.i18nService.t("twoFactorForPasskeysNotSupportedOnClientUpdateToLogIn")),this.currentState="assertFailed",void this.setFailureIcon();if((yield(0,bo._)(this.keyService.userKey$(t.userId)))&&(yield this.loginSuccessHandlerService.run(t.userId,null)),this.shouldAutoClosePopout&&this.platformUtilsService.getClientType()===Da.Browser)return this.messagingService.send("openPopup"),void window.close();yield this.router.navigate([this.successRoute])}catch(e){e instanceof iS&&this.validationService.showError(this.i18nService.t("invalidPasskeyPleaseTryAgain")),this.logService.error(e),this.currentState="assertFailed",this.setFailureIcon()}})}setDefaultIcon(){this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageIcon:this.Icons.TwoFactorAuthSecurityKeyIcon})}setFailureIcon(){this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageIcon:this.Icons.TwoFactorAuthSecurityKeyFailedIcon})}}PH.ɵfac=function(e){return new(e||PH)(Fl.rXU(kH),Fl.rXU(Fd.Ix),Fl.rXU(Fd.nX),Fl.rXU(Za),Fl.rXU(Ud),Fl.rXU(Ul),Fl.rXU(Mw),Fl.rXU(Bp),Fl.rXU(Hb),Fl.rXU(Ck),Fl.rXU(bk))},PH.ɵcmp=Fl.VBU({type:PH,selectors:[["app-login-via-webauthn"]],decls:10,vars:8,consts:[[1,"tw-flex","tw-flex-col","tw-items-center"],[4,"ngIf"],["bitTypography","body1",1,"tw-mb-0","tw-text-center"],["bitLink","","routerLink","/login"],["bitTypography","body1",1,"tw-text-center"],["type","button","bitButton","","block","","buttonType","primary",1,"tw-mb-4",3,"loading"],["type","button","bitButton","","block","","buttonType","primary",1,"tw-mb-4",3,"click"]],template:function(e,t){1&e&&(Fl.j41(0,"div",0),Fl.DNE(1,CH,7,7,"ng-container",1)(2,TH,7,6,"ng-container",1),Fl.j41(3,"p",2),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.nrm(6,"br"),Fl.j41(7,"a",3),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s()()()),2&e&&(Fl.R7$(),Fl.Y8G("ngIf","assert"===t.currentState),Fl.R7$(),Fl.Y8G("ngIf","assertFailed"===t.currentState),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(5,4,"troubleLoggingIn")),Fl.R7$(4),Fl.JRh(Fl.bMT(9,6,"useADifferentLogInMethod")))},dependencies:[kl.MD,kl.bT,Cw.iI,Cw.Wk,sf,id,td,Yh,Hh,uw,tc,rc,rf],encapsulation:2});const FH=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 80 73.33">
<path class="tw-fill-illustration-bg-primary" d="M11.667 31.666c0-5.523 3.805-10 8.5-10h39.666c4.695 0 8.5 4.477 8.5 10v31.667c0 5.523-3.805 10-8.5 10H20.167c-4.695 0-8.5-4.477-8.5-10V31.666Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M59.833 23.333H20.167c-3.912 0-7.084 3.73-7.084 8.333v31.667c0 4.602 3.172 8.333 7.084 8.333h39.666c3.912 0 7.084-3.73 7.084-8.333V31.666c0-4.602-3.172-8.333-7.084-8.333Zm-39.666-1.667c-4.695 0-8.5 4.477-8.5 10v31.667c0 5.523 3.805 10 8.5 10h39.666c4.695 0 8.5-4.477 8.5-10V31.666c0-5.523-3.805-10-8.5-10H20.167Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M55.833 22.5v-5.834C55.833 7.922 48.745.833 40 .833c-8.744 0-15.833 7.089-15.833 15.833V22.5h5v-5.834c0-5.983 4.85-10.833 10.833-10.833 5.983 0 10.833 4.85 10.833 10.833V22.5h5Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M23.333 16.667C23.333 7.462 30.795 0 40 0c9.205 0 16.667 7.462 16.667 16.667v6.666H50v-6.666c0-5.523-4.477-10-10-10s-10 4.477-10 10v6.666h-6.667v-6.666ZM40 1.667c-8.284 0-15 6.715-15 15v5h3.333v-5C28.333 10.223 33.557 5 40 5s11.667 5.223 11.667 11.667v5H55v-5c0-8.285-6.716-15-15-15Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" d="M13.333 55.833h53.334V62.5H13.333v-6.667Z"/>
<path class="tw-fill-illustration-bg-primary" d="M25 18.333h3.333v3.333H25v-3.333Zm26.667 0H55v3.333h-3.333v-3.333Z"/>
<path class="tw-fill-illustration-tertiary" d="M0 47.5c0-5.523 4.477-10 10-10h60c5.523 0 10 4.477 10 10s-4.477 10-10 10H10c-5.523 0-10-4.477-10-10Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M70 39.167H10a8.333 8.333 0 1 0 0 16.666h60a8.333 8.333 0 1 0 0-16.666ZM10 37.5c-5.523 0-10 4.477-10 10s4.477 10 10 10h60c5.523 0 10-4.477 10-10s-4.477-10-10-10H10Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M16.667 42.5c.46 0 .833.389.833.868v3.48l3.117-1.658c.424-.225.942-.078 1.158.328.216.407.048.919-.375 1.144l-3.365 1.789 2.69 2.885c.327.35.32.89-.017 1.203-.337.314-.875.284-1.202-.067l-2.84-3.045-2.839 3.045c-.327.351-.865.38-1.201.067-.337-.314-.345-.853-.018-1.203l2.69-2.885-3.364-1.79c-.423-.224-.591-.736-.375-1.143.216-.406.734-.553 1.157-.328l3.118 1.658v-3.48c0-.48.373-.868.833-.868ZM30 42.5c.46 0 .834.389.834.868v3.48l3.116-1.658c.424-.225.942-.078 1.158.328.216.407.048.919-.375 1.144l-3.365 1.789 2.69 2.885c.328.35.32.89-.017 1.203-.336.314-.874.284-1.201-.067L30 49.427l-2.84 3.045c-.326.351-.864.38-1.2.067-.338-.314-.345-.853-.018-1.203l2.69-2.885-3.365-1.79c-.423-.224-.591-.736-.375-1.143.216-.406.734-.553 1.158-.328l3.117 1.658v-3.48c0-.48.373-.868.833-.868Zm14.167.868c0-.48-.373-.868-.834-.868-.46 0-.833.389-.833.868v3.48l-3.117-1.658c-.423-.225-.942-.078-1.158.328-.216.407-.048.919.376 1.144l3.364 1.789-2.69 2.885c-.327.35-.32.89.017 1.203.337.314.875.284 1.202-.067l2.84-3.045 2.839 3.045c.327.351.865.38 1.202.067.336-.314.344-.853.017-1.203l-2.69-2.885 3.364-1.79c.424-.224.592-.736.376-1.143-.216-.406-.735-.553-1.158-.328l-3.117 1.657v-3.479Zm6.666 8.299c0-.46.374-.834.834-.834h6.666a.833.833 0 0 1 0 1.667h-6.666a.833.833 0 0 1-.834-.833Zm10.834-.834a.833.833 0 0 0 0 1.667h6.666a.833.833 0 0 0 0-1.667h-6.666Z" clip-rule="evenodd"/>
</svg>
`;class RH{}class xH{}var AH=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const DH=()=>({key:"changeMasterPassword"});function EH(e,t){1&e&&(Fl.nrm(0,"i",0),Fl.nI1(1,"i18n"),Fl.j41(2,"span",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()),2&e&&(Fl.Y8G("title",Fl.mNQ(Fl.bMT(1,3,"loading"))),Fl.R7$(3),Fl.JRh(Fl.bMT(4,5,"loading")))}function $H(e,t){1&e&&(Fl.j41(0,"bit-callout",4),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.JRh(Fl.bMT(2,1,"changePasswordWarning")))}function OH(e,t){if(1&e){const e=Fl.RV6();Fl.DNE(0,$H,3,3,"bit-callout",2),Fl.j41(1,"auth-input-password",3),Fl.bIt("onPasswordFormSubmit",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.handlePasswordFormSubmit(t))})("onSecondaryButtonClick",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.logOut())}),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.Y8G("ngIf",e.forceSetPasswordReason!==e.ForceSetPasswordReason.AdminForcePasswordReset),Fl.R7$(),Fl.Y8G("flow",e.inputPasswordFlow)("email",e.email)("userId",e.userId)("loading",e.submitting)("masterPasswordPolicyOptions",e.masterPasswordPolicyOptions)("inlineButtons",!0)("primaryButtonText",Fl.lJ4(9,DH))("secondaryButtonText",e.secondaryButtonText())}}class UH{constructor(e,t,i,n,r,s,o,a,l,c,u,d){this.accountService=e,this.changePasswordService=t,this.i18nService=i,this.masterPasswordService=n,this.anonLayoutWrapperDataService=r,this.organizationInviteService=s,this.messagingService=o,this.policyService=a,this.toastService=l,this.syncService=c,this.dialogService=u,this.logService=d,this.inputPasswordFlow=dw.ChangePassword,this.activeAccount=null,this.initializing=!0,this.submitting=!1,this.forceSetPasswordReason=aS.None,this.ForceSetPasswordReason=aS}ngOnInit(){return AH(this,void 0,void 0,function*(){if(this.activeAccount=yield(0,bo._)(this.accountService.activeAccount$),!this.activeAccount)throw new Error("No active active account found while trying to change passwords.");if(this.userId=this.activeAccount.id,this.email=this.activeAccount.email,!this.userId)throw new Error("userId not found");this.masterPasswordPolicyOptions=yield(0,bo._)(this.policyService.masterPasswordPolicyOptions$(this.userId)),this.forceSetPasswordReason=yield(0,bo._)(this.masterPasswordService.forceSetPasswordReason$(this.userId)),this.forceSetPasswordReason===aS.AdminForcePasswordReset?this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageIcon:FH,pageTitle:{key:"updateMasterPassword"},pageSubtitle:{key:"accountRecoveryUpdateMasterPasswordSubtitle"}}):this.forceSetPasswordReason===aS.WeakMasterPassword&&this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageIcon:FH,pageTitle:{key:"updateMasterPassword"},pageSubtitle:{key:"updateMasterPasswordSubtitle"},maxWidth:"lg"}),this.initializing=!1})}logOut(){return AH(this,void 0,void 0,function*(){(yield this.dialogService.openSimpleDialog({title:{key:"logOut"},content:{key:"logOutConfirmation"},acceptButtonText:{key:"logOut"},type:"warning"}))&&(yield this.organizationInviteService.clearOrganizationInvitation(),this.changePasswordService.clearDeeplinkState&&(yield this.changePasswordService.clearDeeplinkState()),this.messagingService.send("logout"))})}handlePasswordFormSubmit(e){return AH(this,void 0,void 0,function*(){var t,i;this.submitting=!0;try{if(e.rotateUserKey){if(null==this.activeAccount)throw new Error("activeAccount not found");if(null==e.currentPassword||null==e.newPasswordHint)throw new Error("currentPassword or newPasswordHint not found");yield this.syncService.fullSync(!0),yield this.changePasswordService.rotateUserKeyMasterPasswordAndEncryptedData(e.currentPassword,e.newPassword,this.activeAccount,e.newPasswordHint)}else{if(!this.userId)throw new Error("userId not found");this.forceSetPasswordReason===aS.AdminForcePasswordReset?yield this.changePasswordService.changePasswordForAccountRecovery(e,this.userId):yield this.changePasswordService.changePassword(e,this.userId),this.toastService.showToast({variant:"success",message:this.i18nService.t("masterPasswordChanged")}),this.messagingService.send("logout"),null===(i=(t=this.changePasswordService).closeBrowserExtensionPopout)||void 0===i||i.call(t)}}catch(e){this.logService.error(e),this.toastService.showToast({variant:"error",title:"",message:this.i18nService.t("errorOccurred")})}finally{this.submitting=!1}})}secondaryButtonText(){return this.forceSetPasswordReason===aS.AdminForcePasswordReset||this.forceSetPasswordReason===aS.WeakMasterPassword?{key:"logOut"}:void 0}}UH.ɵfac=function(e){return new(e||UH)(Fl.rXU(Zk),Fl.rXU(RH),Fl.rXU(Ul),Fl.rXU(Yb),Fl.rXU(Ck),Fl.rXU(xH),Fl.rXU(bk),Fl.rXU(Jb),Fl.rXU(qb),Fl.rXU(qx),Fl.rXU(lh),Fl.rXU(Za))},UH.ɵcmp=Fl.VBU({type:UH,selectors:[["auth-change-password"]],inputs:{inputPasswordFlow:"inputPasswordFlow"},decls:2,vars:1,consts:[["aria-hidden","true",1,"bwi","bwi-spinner","bwi-spin","bwi-2x","tw-text-muted",3,"title"],[1,"tw-sr-only"],["type","warning",4,"ngIf"],[3,"onPasswordFormSubmit","onSecondaryButtonClick","flow","email","userId","loading","masterPasswordPolicyOptions","inlineButtons","primaryButtonText","secondaryButtonText"],["type","warning"]],template:function(e,t){1&e&&Fl.nVh(0,EH,5,7)(1,OH,2,10),2&e&&Fl.vxM(t.initializing?0:1)},dependencies:[Iw,ud,kl.MD,kl.bT,sc],encapsulation:2});class MH extends bP{static newConstructor(e,t){const i=new MH;return i.newMasterPasswordHash=e.masterPasswordAuthenticationHash,i.key=t.masterKeyWrappedUserKey,i.authenticationData=e,i.unlockData=t,i}}class NH extends JR{}var VH=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class BH{constructor(e,t,i){this.keyService=e,this.masterPasswordApiService=t,this.masterPasswordService=i}rotateUserKeyMasterPasswordAndEncryptedData(e,t,i,n){return VH(this,void 0,void 0,function*(){throw new Error("rotateUserKeyMasterPasswordAndEncryptedData() is only implemented in Web")})}preparePasswordChange(e,t,i){return VH(this,void 0,void 0,function*(){if(!t)throw new Error("userId not found");if(!(e.currentMasterKey&&e.currentServerMasterKeyHash&&e.newMasterKey&&e.newServerMasterKeyHash&&null!=e.newPasswordHint))throw new Error("invalid PasswordInputResult credentials, could not change password");const n=yield this.masterPasswordService.decryptUserKeyWithMasterKey(e.currentMasterKey,t);if(null==n)throw new Error("Could not decrypt user key");const r=yield this.keyService.encryptUserKeyWithMasterKey(e.newMasterKey,n);return i instanceof MH?(i.masterPasswordHash=e.currentServerMasterKeyHash,i.newMasterPasswordHash=e.newServerMasterKeyHash,i.masterPasswordHint=e.newPasswordHint):i instanceof NH&&(i.newMasterPasswordHash=e.newServerMasterKeyHash,i.masterPasswordHint=e.newPasswordHint),r})}changePassword(e,t){return VH(this,void 0,void 0,function*(){const i=new MH,n=yield this.preparePasswordChange(e,t,i);i.key=n[1].encryptedString;try{yield this.masterPasswordApiService.postPassword(i)}catch(e){throw new Error("Could not change password")}})}changePasswordForAccountRecovery(e,t){return VH(this,void 0,void 0,function*(){const i=new NH,n=yield this.preparePasswordChange(e,t,i);i.key=n[1].encryptedString;try{yield this.masterPasswordApiService.putUpdateTempPassword(i)}catch(e){throw new Error("Could not change password")}})}}const jH=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="4 0.5 90.32 96">
<path class="tw-fill-illustration-bg-secondary" d="M54 8.5a8 8 0 0 1 8-8h8a8 8 0 0 1 8 8v4H54v-4Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M70 2.5h-8a6 6 0 0 0-6 6v2h20v-2a6 6 0 0 0-6-6Zm-8-2a8 8 0 0 0-8 8v4h24v-4a8 8 0 0 0-8-8h-8Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" d="M47 16.5a8 8 0 0 1 8-8h22a8 8 0 0 1 8 8v6H47v-6Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M77 10.5H55a6 6 0 0 0-6 6v4h34v-4a6 6 0 0 0-6-6Zm-22-2a8 8 0 0 0-8 8v6h38v-6a8 8 0 0 0-8-8H55Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" d="M40 26.5a8 8 0 0 1 8-8h36a8 8 0 0 1 8 8v66H40v-66Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M84 20.5H48a6 6 0 0 0-6 6v64h48v-64a6 6 0 0 0-6-6Zm-36-2a8 8 0 0 0-8 8v66h52v-66a8 8 0 0 0-8-8H48Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="M4 44.5a8 8 0 0 1 8-8h38a8 8 0 0 1 8 8v48H4v-48Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M50 38.5H12a6 6 0 0 0-6 6v46h50v-46a6 6 0 0 0-6-6Zm-38-2a8 8 0 0 0-8 8v48h54v-48a8 8 0 0 0-8-8H12Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" d="M68.677 60.935c1.928-3.316 6.718-3.316 8.645 0l16.31 28.052c1.938 3.334-.467 7.513-4.323 7.513H56.691c-3.856 0-6.26-4.18-4.323-7.513l16.31-28.052Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M91.903 89.993 75.593 61.94c-1.156-1.99-4.03-1.99-5.187 0L54.097 89.993c-1.163 2 .28 4.507 2.594 4.507h32.618c2.314 0 3.757-2.507 2.594-4.507Zm-14.58-29.058c-1.928-3.316-6.718-3.316-8.645 0l-16.31 28.052c-1.938 3.334.467 7.513 4.323 7.513h32.618c3.856 0 6.26-4.18 4.323-7.513l-16.31-28.052Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" d="M75 88.5a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM70.06 71.053a.5.5 0 0 1 .496-.553h4.887a.5.5 0 0 1 .498.553l-1.393 13a.5.5 0 0 1-.498.447h-2.1a.5.5 0 0 1-.498-.447l-1.393-13Z"/>
<path class="tw-fill-illustration-bg-secondary" d="M21 80.5a8 8 0 0 1 8-8h4a8 8 0 0 1 8 8v12H21v-12Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M33 74.5h-4a6 6 0 0 0-6 6v10h16v-10a6 6 0 0 0-6-6Zm-4-2a8 8 0 0 0-8 8v12h20v-12a8 8 0 0 0-8-8h-4Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M13 46.5a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1v-8Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M15 47.5v6h6v-6h-6Zm-1-2a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-8a1 1 0 0 0-1-1h-8Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M13 59.5a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1v-8Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M15 60.5v6h6v-6h-6Zm-1-2a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-8a1 1 0 0 0-1-1h-8Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M26 46.5a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1v-8Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M28 47.5v6h6v-6h-6Zm-1-2a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-8a1 1 0 0 0-1-1h-8Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M26 59.5a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1v-8Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M28 60.5v6h6v-6h-6Zm-1-2a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-8a1 1 0 0 0-1-1h-8Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M39 59.5a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1v-8Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M41 60.5v6h6v-6h-6Zm-1-2a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-8a1 1 0 0 0-1-1h-8Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M39 46.5a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1v-8Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M41 47.5v6h6v-6h-6Zm-1-2a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-8a1 1 0 0 0-1-1h-8ZM47 27.5a1 1 0 0 1 1-1h6a1 1 0 1 1 0 2h-6a1 1 0 0 1-1-1Zm11-1a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2h-6Zm9 1a1 1 0 0 1 1-1h6a1 1 0 1 1 0 2h-6a1 1 0 0 1-1-1Zm10 0a1 1 0 0 1 1-1h6a1 1 0 1 1 0 2h-6a1 1 0 0 1-1-1Zm0 6a1 1 0 0 1 1-1h6a1 1 0 1 1 0 2h-6a1 1 0 0 1-1-1Zm1 5a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2h-6Zm-1 7a1 1 0 0 1 1-1h6a1 1 0 1 1 0 2h-6a1 1 0 0 1-1-1Zm1 5a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2h-6Zm-10-18a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2h-6Zm-1 7a1 1 0 0 1 1-1h6a1 1 0 1 1 0 2h-6a1 1 0 0 1-1-1Zm1 5a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2h-6Zm-1 7a1 1 0 0 1 1-1h6a1 1 0 1 1 0 2h-6a1 1 0 0 1-1-1Zm-9-19a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2h-6Zm-11 1a1 1 0 0 1 1-1h6a1 1 0 1 1 0 2h-6a1 1 0 0 1-1-1Zm11 5a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2h-6Zm-1 7a1 1 0 0 1 1-1h6a1 1 0 1 1 0 2h-6a1 1 0 0 1-1-1Zm1 5a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2h-6Z" clip-rule="evenodd"/>
</svg>
`;function GH(e,t,i){if(!e||"number"==typeof e&&Number.isNaN(e))throw new Error(`${t} is falsy.${i?` ${i}`:""}`)}const LH=Object.freeze({JIT_PROVISIONED_MP_ORG_USER:"jit_provisioned_mp_org_user",TDE_ORG_USER_RESET_PASSWORD_PERMISSION_REQUIRES_MP:"tde_org_user_reset_password_permission_requires_mp",OFFBOARDED_TDE_ORG_USER:"offboarded_tde_org_user",OFFBOARDED_TDE_ORG_USER_UNTRUSTED_DEVICE:"offboarded_tde_org_user_untrusted_device"});class zH{}class _H{}var KH=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const XH=e=>({key:e}),qH=()=>({key:"logOut"});function WH(e,t){1&e&&(Fl.j41(0,"div",0),Fl.nrm(1,"i",1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.Y8G("title",Fl.mNQ(Fl.bMT(2,2,"loading"))))}function YH(e,t){if(1&e){const e=Fl.RV6();Fl.nrm(0,"div",2),Fl.j41(1,"bit-callout",3),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"button",4),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.logout())}),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,2,"loginOnTrustedDeviceOrAskAdminToAssignPassword")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(6,4,"logOut")," "))}function HH(e,t){1&e&&(Fl.j41(0,"bit-callout",7),Fl.nI1(1,"i18n"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()),2&e&&(Fl.Y8G("title",Fl.mNQ(Fl.bMT(1,3,"resetPasswordPolicyAutoEnroll"))),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,5,"resetPasswordAutoEnrollInviteWarning")," "))}function JH(e,t){if(1&e){const e=Fl.RV6();Fl.DNE(0,HH,4,7,"bit-callout",5),Fl.j41(1,"auth-input-password",6),Fl.bIt("onPasswordFormSubmit",function(t){a.eBV(e);const i=Fl.XpG(2);return a.Njj(i.handlePasswordFormSubmit(t))})("onSecondaryButtonClick",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.logout())}),Fl.k0s()}if(2&e){const e=Fl.XpG(2);Fl.Y8G("ngIf",e.resetPasswordAutoEnroll),Fl.R7$(),Fl.Y8G("flow",e.inputPasswordFlow)("email",e.email)("userId",e.userId)("loading",e.submitting)("masterPasswordPolicyOptions",e.masterPasswordPolicyOptions)("primaryButtonText",Fl.eq3(8,XH,e.userType===e.SetInitialPasswordUserType.OFFBOARDED_TDE_ORG_USER?"setPassword":"createAccount"))("secondaryButtonText",Fl.lJ4(10,qH))}}function ZH(e,t){if(1&e&&Fl.nVh(0,YH,7,6)(1,JH,2,11),2&e){const e=Fl.XpG();Fl.vxM(e.userType===e.SetInitialPasswordUserType.OFFBOARDED_TDE_ORG_USER_UNTRUSTED_DEVICE?0:1)}}class QH{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,v,f,m,g,y,b){this.accountService=e,this.activatedRoute=t,this.anonLayoutWrapperDataService=i,this.dialogService=n,this.i18nService=r,this.keyService=s,this.logoutService=o,this.logService=a,this.masterPasswordService=l,this.messagingService=c,this.organizationApiService=u,this.policyApiService=d,this.policyService=h,this.router=p,this.setInitialPasswordService=v,this.ssoLoginService=f,this.syncService=m,this.toastService=g,this.validationService=y,this.configService=b,this.inputPasswordFlow=dw.SetInitialPasswordAuthedUser,this.initializing=!0,this.masterPasswordPolicyOptions=null,this.submitting=!1,this.SetInitialPasswordUserType=LH}ngOnInit(){return KH(this,void 0,void 0,function*(){yield this.syncService.fullSync(!0);const e=yield(0,bo._)(this.accountService.activeAccount$);this.userId=null==e?void 0:e.id,this.email=null==e?void 0:e.email,yield this.establishUserType(),yield this.getOrgInfo(),this.initializing=!1})}handlePasswordFormSubmit(e){return KH(this,void 0,void 0,function*(){switch(this.submitting=!0,this.userType){case LH.JIT_PROVISIONED_MP_ORG_USER:if(yield this.configService.getFeatureFlag(Wv.EnableAccountEncryptionV2JitPasswordRegistration))return void(yield this.setInitialPasswordJitMPUserV2Encryption(e));if(e.newApisWithInputPasswordFlagEnabled){const t="Could not set initial password.";GH(e.newPassword,"newPassword",t),ak(e.kdfConfig,"kdfConfig",t),GH(this.email,"email",t);const i=yield this.keyService.makeMasterKey(e.newPassword,this.email.trim().toLowerCase(),e.kdfConfig),n=yield this.keyService.hashMasterKey(e.newPassword,i,mp.ServerAuthorization),r=yield this.keyService.hashMasterKey(e.newPassword,i,mp.LocalAuthorization);return e.newMasterKey=i,e.newServerMasterKeyHash=n,e.newLocalMasterKeyHash=r,void(yield this.setInitialPassword(e))}yield this.setInitialPassword(e);break;case LH.TDE_ORG_USER_RESET_PASSWORD_PERMISSION_REQUIRES_MP:if(e.newApisWithInputPasswordFlagEnabled)return void(yield this.setInitialPasswordTdeUserWithPermission(e));yield this.setInitialPassword(e);break;case LH.OFFBOARDED_TDE_ORG_USER:yield this.setInitialPasswordTdeOffboarding(e);break;default:this.logService.error(`Unexpected user type: ${this.userType}. Could not set initial password.`),this.validationService.showError("Unexpected user type. Could not set initial password.")}})}logout(){return KH(this,void 0,void 0,function*(){(yield this.dialogService.openSimpleDialog({title:{key:"logOut"},content:{key:"logOutConfirmation"},acceptButtonText:{key:"logOut"},type:"warning"}))&&this.messagingService.send("logout")})}establishUserType(){return KH(this,void 0,void 0,function*(){if(!this.userId)throw new Error("userId not found. Could not determine user type.");this.forceSetPasswordReason=yield(0,bo._)(this.masterPasswordService.forceSetPasswordReason$(this.userId)),this.forceSetPasswordReason===aS.TdeOffboardingUntrustedDevice&&(this.userType=LH.OFFBOARDED_TDE_ORG_USER_UNTRUSTED_DEVICE,this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageTitle:{key:"unableToCompleteLogin"},pageIcon:jH})),this.forceSetPasswordReason===aS.SsoNewJitProvisionedUser&&(this.userType=LH.JIT_PROVISIONED_MP_ORG_USER,this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageTitle:{key:"joinOrganization"},pageSubtitle:{key:"finishJoiningThisOrganizationBySettingAMasterPassword"}})),this.forceSetPasswordReason===aS.TdeUserWithoutPasswordHasPasswordResetPermission&&(this.userType=LH.TDE_ORG_USER_RESET_PASSWORD_PERMISSION_REQUIRES_MP,this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageTitle:{key:"setMasterPassword"},pageSubtitle:{key:"orgPermissionsUpdatedMustSetPassword"}})),this.forceSetPasswordReason===aS.TdeOffboarding&&(this.userType=LH.OFFBOARDED_TDE_ORG_USER,this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageTitle:{key:"setMasterPassword"},pageSubtitle:{key:"tdeDisabledMasterPasswordRequired"}})),this.forceSetPasswordReason===aS.None&&(yield this.router.navigate(["/"]))})}getOrgInfo(){return KH(this,void 0,void 0,function*(){var e,t;if(!this.userId)throw new Error("userId not found. Could not handle query params.");if(this.userType===LH.OFFBOARDED_TDE_ORG_USER)return void(this.masterPasswordPolicyOptions=null!==(e=yield(0,bo._)(this.policyService.masterPasswordPolicyOptions$(this.userId)))&&void 0!==e?e:null);const i=yield(0,bo._)(this.activatedRoute.queryParams);if(this.orgSsoIdentifier=null!==(t=i.identifier)&&void 0!==t?t:yield this.ssoLoginService.getActiveUserOrganizationSsoIdentifier(this.userId),null!=this.orgSsoIdentifier)try{const e=yield this.organizationApiService.getAutoEnrollStatus(this.orgSsoIdentifier);this.orgId=e.id,this.resetPasswordAutoEnroll=e.resetPasswordEnabled,this.masterPasswordPolicyOptions=yield this.policyApiService.getMasterPasswordPolicyOptsForOrgUser(this.orgId)}catch(e){this.toastService.showToast({variant:"error",title:"",message:this.i18nService.t("errorOccurred")})}})}setInitialPasswordJitMPUserV2Encryption(e){return KH(this,void 0,void 0,function*(){const t="Could not set initial password for SSO JIT master password encryption user.";GH(e.newPassword,"newPassword",t),GH(e.salt,"salt",t),GH(this.orgSsoIdentifier,"orgSsoIdentifier",t),GH(this.orgId,"orgId",t),GH(this.userId,"userId",t),ak(e.newPasswordHint,"newPasswordHint",t),ak(this.resetPasswordAutoEnroll,"resetPasswordAutoEnroll",t);try{const t={newPasswordHint:e.newPasswordHint,orgSsoIdentifier:this.orgSsoIdentifier,orgId:this.orgId,resetPasswordAutoEnroll:this.resetPasswordAutoEnroll,newPassword:e.newPassword,salt:e.salt};yield this.setInitialPasswordService.initializePasswordJitPasswordUserV2Encryption(t,this.userId),this.showSuccessToastByUserType(),this.submitting=!1,yield this.router.navigate(["vault"])}catch(e){this.logService.error("Error setting initial password",e),this.validationService.showError(e),this.submitting=!1}})}setInitialPassword(e){return KH(this,void 0,void 0,function*(){const t="Could not set initial password.";GH(e.newMasterKey,"newMasterKey",t),GH(e.newServerMasterKeyHash,"newServerMasterKeyHash",t),GH(e.newLocalMasterKeyHash,"newLocalMasterKeyHash",t),GH(e.kdfConfig,"kdfConfig",t),GH(e.newPassword,"newPassword",t),GH(e.salt,"salt",t),GH(this.orgSsoIdentifier,"orgSsoIdentifier",t),GH(this.orgId,"orgId",t),GH(this.userType,"userType",t),GH(this.userId,"userId",t),ak(e.newPasswordHint,"newPasswordHint",t),ak(this.resetPasswordAutoEnroll,"resetPasswordAutoEnroll",t);try{const t={newMasterKey:e.newMasterKey,newServerMasterKeyHash:e.newServerMasterKeyHash,newLocalMasterKeyHash:e.newLocalMasterKeyHash,newPasswordHint:e.newPasswordHint,kdfConfig:e.kdfConfig,orgSsoIdentifier:this.orgSsoIdentifier,orgId:this.orgId,resetPasswordAutoEnroll:this.resetPasswordAutoEnroll,newPassword:e.newPassword,salt:e.salt};yield this.setInitialPasswordService.setInitialPassword(t,this.userType,this.userId),this.showSuccessToastByUserType(),this.submitting=!1,yield this.router.navigate(["vault"])}catch(e){this.logService.error("Error setting initial password",e),this.validationService.showError(e),this.submitting=!1}})}setInitialPasswordTdeUserWithPermission(e){return KH(this,void 0,void 0,function*(){const t="Could not set initial password for TDE user with Manage Account Recovery permission.";GH(e.newPassword,"newPassword",t),GH(e.salt,"salt",t),ak(e.kdfConfig,"kdfConfig",t),ak(e.newPasswordHint,"newPasswordHint",t),GH(this.orgSsoIdentifier,"orgSsoIdentifier",t),GH(this.orgId,"orgId",t),ak(this.resetPasswordAutoEnroll,"resetPasswordAutoEnroll",t),GH(this.userId,"userId",t);try{const t={newPassword:e.newPassword,salt:e.salt,kdfConfig:e.kdfConfig,newPasswordHint:e.newPasswordHint,orgSsoIdentifier:this.orgSsoIdentifier,orgId:this.orgId,resetPasswordAutoEnroll:this.resetPasswordAutoEnroll};yield this.setInitialPasswordService.setInitialPasswordTdeUserWithPermission(t,this.userId),this.showSuccessToastByUserType(),this.submitting=!1,yield this.router.navigate(["vault"])}catch(e){this.logService.error("Error setting initial password",e),this.validationService.showError(e),this.submitting=!1}})}setInitialPasswordTdeOffboarding(e){return KH(this,void 0,void 0,function*(){const t="Could not set initial password.";GH(e.newMasterKey,"newMasterKey",t),GH(e.newServerMasterKeyHash,"newServerMasterKeyHash",t),GH(this.userId,"userId",t),ak(e.newPasswordHint,"newPasswordHint",t);try{const t={newMasterKey:e.newMasterKey,newServerMasterKeyHash:e.newServerMasterKeyHash,newPasswordHint:e.newPasswordHint};yield this.setInitialPasswordService.setInitialPasswordTdeOffboarding(t,this.userId),this.showSuccessToastByUserType(),yield this.logoutService.logout(this.userId),yield this.router.navigate(["/"])}catch(e){this.logService.error("Error setting initial password during TDE offboarding",e),this.validationService.showError(e)}finally{this.submitting=!1}})}showSuccessToastByUserType(){this.userType===LH.JIT_PROVISIONED_MP_ORG_USER?(this.toastService.showToast({variant:"success",title:"",message:this.i18nService.t("accountSuccessfullyCreated")}),this.toastService.showToast({variant:"success",title:"",message:this.i18nService.t("inviteAccepted")})):this.toastService.showToast({variant:"success",title:"",message:this.i18nService.t("masterPasswordSuccessfullySet")})}}QH.ɵfac=function(e){return new(e||QH)(Fl.rXU(Zk),Fl.rXU(Fd.nX),Fl.rXU(Ck),Fl.rXU(lh),Fl.rXU(Ul),Fl.rXU(Bp),Fl.rXU(Nw),Fl.rXU(Za),Fl.rXU(Yb),Fl.rXU(bk),Fl.rXU(nI),Fl.rXU(_H),Fl.rXU(Jb),Fl.rXU(Fd.Ix),Fl.rXU(zH),Fl.rXU(xk),Fl.rXU(qx),Fl.rXU(qb),Fl.rXU(Ud),Fl.rXU(Kb))},QH.ɵcmp=Fl.VBU({type:QH,selectors:[["ng-component"]],decls:2,vars:1,consts:[[1,"tw-flex","tw-items-center","tw-justify-center"],["aria-hidden","true",1,"bwi","bwi-spinner","bwi-spin","bwi-3x",3,"title"],[1,"tw-mt-4"],["type","warning"],["type","button","bitButton","","block","","buttonType","secondary",3,"click"],["type","warning",3,"title",4,"ngIf"],[3,"onPasswordFormSubmit","onSecondaryButtonClick","flow","email","userId","loading","masterPasswordPolicyOptions","primaryButtonText","secondaryButtonText"],["type","warning",3,"title"]],template:function(e,t){1&e&&Fl.nVh(0,WH,3,4,"div",0)(1,ZH,2,1),2&e&&Fl.vxM(t.initializing?0:1)},dependencies:[id,td,ud,kl.MD,kl.bT,Iw,sc],encapsulation:2});const eJ=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 10 80 60">
<path class="tw-fill-illustration-bg-primary" d="M7.5 15a5 5 0 0 1 5-5h55a5 5 0 0 1 5 5v35a5 5 0 0 1-5 5h-55a5 5 0 0 1-5-5V15Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M67.5 11.667h-55A3.333 3.333 0 0 0 9.167 15v35a3.333 3.333 0 0 0 3.333 3.333h55A3.333 3.333 0 0 0 70.833 50V15a3.333 3.333 0 0 0-3.333-3.333ZM12.5 10a5 5 0 0 0-5 5v35a5 5 0 0 0 5 5h55a5 5 0 0 0 5-5V15a5 5 0 0 0-5-5h-55Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" d="M7.5 15h65v35h-65V15Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M70.833 16.667H9.167v31.666h61.666V16.667ZM7.5 15v35h65V15h-65Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="M32.5 54.167h15v15h-15v-15Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M31.667 53.334h16.666v15H55a.833.833 0 0 1 0 1.667H25a.833.833 0 0 1 0-1.667h6.667v-15Zm1.666 15h13.334V55.001H33.333v13.333Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M0 40a3.333 3.333 0 0 1 3.333-3.333h15A3.333 3.333 0 0 1 21.667 40v26.667A3.333 3.333 0 0 1 18.333 70h-15A3.333 3.333 0 0 1 0 66.667V40Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M18.333 38.334h-15c-.92 0-1.666.746-1.666 1.666v26.667c0 .92.746 1.667 1.666 1.667h15c.92 0 1.667-.746 1.667-1.667V40c0-.92-.746-1.666-1.667-1.666Zm-15-1.667A3.333 3.333 0 0 0 0 40v26.667A3.333 3.333 0 0 0 3.333 70h15a3.333 3.333 0 0 0 3.334-3.333V40a3.333 3.333 0 0 0-3.334-3.333h-15Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M8.333 40.833c0-.46.373-.833.834-.833H12.5a.833.833 0 0 1 0 1.667H9.167a.833.833 0 0 1-.834-.834Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" fill-rule="evenodd" d="M40 45.834c7.364 0 13.333-5.97 13.333-13.334 0-7.363-5.97-13.333-13.333-13.333-7.364 0-13.333 5.97-13.333 13.333 0 7.364 5.97 13.334 13.333 13.334ZM34.167 27.5a2.5 2.5 0 0 0-2.5 2.5v8.334a2.5 2.5 0 0 0 2.5 2.5h11.666a2.5 2.5 0 0 0 2.5-2.5V30a2.5 2.5 0 0 0-2.5-2.5H34.167Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" d="M31.667 30a2.5 2.5 0 0 1 2.5-2.5h11.666a2.5 2.5 0 0 1 2.5 2.5v8.333a2.5 2.5 0 0 1-2.5 2.5H34.167a2.5 2.5 0 0 1-2.5-2.5V30Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M45.833 29.167H34.167a.833.833 0 0 0-.834.833v8.333c0 .46.373.834.834.834h11.666c.46 0 .834-.373.834-.834V30a.833.833 0 0 0-.834-.833ZM34.167 27.5a2.5 2.5 0 0 0-2.5 2.5v8.333a2.5 2.5 0 0 0 2.5 2.5h11.666a2.5 2.5 0 0 0 2.5-2.5V30a2.5 2.5 0 0 0-2.5-2.5H34.167Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" d="M39.167 32.5a.833.833 0 0 1 1.666 0v3.334a.833.833 0 0 1-1.666 0V32.5Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M35.833 26.667a4.167 4.167 0 0 1 8.334 0v.833H42.5v-.833a2.5 2.5 0 0 0-5 0v.833h-1.667v-.833Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M50 33.333A3.333 3.333 0 0 1 53.333 30h23.334A3.333 3.333 0 0 1 80 33.333v33.334A3.333 3.333 0 0 1 76.667 70H53.333A3.333 3.333 0 0 1 50 66.667V33.333Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M76.667 31.667H53.333c-.92 0-1.666.746-1.666 1.666v33.334c0 .92.746 1.666 1.666 1.666h23.334c.92 0 1.666-.746 1.666-1.666V33.333c0-.92-.746-1.666-1.666-1.666ZM53.333 30A3.333 3.333 0 0 0 50 33.333v33.334A3.333 3.333 0 0 0 53.333 70h23.334A3.333 3.333 0 0 0 80 66.667V33.333A3.333 3.333 0 0 0 76.667 30H53.333Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" d="M67.5 63.334a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M65 64.167a.833.833 0 1 0 0-1.666.833.833 0 0 0 0 1.666Zm0 1.667a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" d="M33.333 55h13.334v5H33.333v-5Z"/>
</svg>
`,tJ=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 10 80 60">
<path class="tw-fill-illustration-bg-primary" d="M0 15a5 5 0 0 1 5-5h45a5 5 0 0 1 5 5v31.667a5 5 0 0 1-5 5H5a5 5 0 0 1-5-5V15Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M50 11.667H5A3.333 3.333 0 0 0 1.667 15v31.667A3.333 3.333 0 0 0 5 50h45a3.333 3.333 0 0 0 3.333-3.333V15A3.333 3.333 0 0 0 50 11.667ZM5 10a5 5 0 0 0-5 5v31.667a5 5 0 0 0 5 5h45a5 5 0 0 0 5-5V15a5 5 0 0 0-5-5H5Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" d="M19.167 30a2.5 2.5 0 0 1 2.5-2.5h11.666a2.5 2.5 0 0 1 2.5 2.5v8.333a2.5 2.5 0 0 1-2.5 2.5H21.667a2.5 2.5 0 0 1-2.5-2.5V30Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M33.333 29.167H21.667a.833.833 0 0 0-.834.833v8.333c0 .46.373.834.834.834h11.666c.46 0 .834-.373.834-.834V30a.833.833 0 0 0-.834-.833ZM21.667 27.5a2.5 2.5 0 0 0-2.5 2.5v8.333a2.5 2.5 0 0 0 2.5 2.5h11.666a2.5 2.5 0 0 0 2.5-2.5V30a2.5 2.5 0 0 0-2.5-2.5H21.667Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" d="M26.667 32.5a.833.833 0 0 1 1.666 0v3.334a.833.833 0 0 1-1.666 0V32.5Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M23.334 26.667a4.167 4.167 0 0 1 8.333 0v.833H30v-.833a2.5 2.5 0 0 0-5 0v.833h-1.666v-.833ZM54.167 20H.833v-1.666h53.334v1.667Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" d="M51.667 15a1.667 1.667 0 1 1-3.333 0 1.667 1.667 0 0 1 3.333 0ZM46.667 15a1.667 1.667 0 1 1-3.333 0 1.667 1.667 0 0 1 3.333 0ZM41.667 15a1.667 1.667 0 1 1-3.333 0 1.667 1.667 0 0 1 3.333 0Z"/>
<path class="tw-fill-illustration-bg-tertiary" d="M68.333 35c0 6.444-5.223 11.667-11.666 11.667C50.223 46.667 45 41.444 45 35.001c0-6.444 5.223-11.667 11.667-11.667 6.443 0 11.666 5.223 11.666 11.667Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M56.667 45c5.523 0 10-4.477 10-10 0-5.522-4.477-10-10-10s-10 4.478-10 10c0 5.523 4.477 10 10 10Zm0 1.667c6.443 0 11.666-5.223 11.666-11.666 0-6.444-5.223-11.667-11.666-11.667C50.223 23.334 45 28.557 45 35.001c0 6.443 5.223 11.666 11.667 11.666Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M78.256 59.98A22.918 22.918 0 0 1 80 68.75c0 .691-.56 1.25-1.25 1.25H35.417c-.69 0-1.25-.559-1.25-1.25a22.916 22.916 0 0 1 44.089-8.77Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M78.33 68.334a21.25 21.25 0 0 0-42.492 0h42.491Zm1.67.417a22.918 22.918 0 0 0-31.686-21.173 22.917 22.917 0 0 0-14.147 21.173c0 .69.56 1.25 1.25 1.25H78.75c.69 0 1.25-.56 1.25-1.25Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" d="M9.167 50.834a6.667 6.667 0 0 1 6.666-6.667h22.5a6.667 6.667 0 0 1 0 13.333h-22.5a6.667 6.667 0 0 1-6.666-6.666Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M38.333 45.834h-22.5a5 5 0 1 0 0 10h22.5a5 5 0 0 0 0-10Zm-22.5-1.667a6.667 6.667 0 0 0 0 13.333h22.5a6.667 6.667 0 1 0 0-13.333h-22.5Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M16.67 47.977c.46 0 .834.374.834.834v1.166l1.093-.358a.833.833 0 1 1 .519 1.584l-1.108.363.694.972a.833.833 0 1 1-1.357.969l-.675-.945-.675.945a.833.833 0 0 1-1.356-.969l.694-.972-1.108-.363a.833.833 0 0 1 .518-1.584l1.094.359V48.81c0-.46.373-.834.833-.834Zm7.5 0c.46 0 .834.374.834.834v1.166l1.093-.358a.833.833 0 1 1 .519 1.584l-1.108.363.694.972a.833.833 0 1 1-1.357.969l-.675-.945-.675.945a.833.833 0 0 1-1.356-.969l.694-.972-1.108-.363a.833.833 0 0 1 .518-1.584l1.094.359V48.81c0-.46.373-.834.833-.834ZM29.167 52.5c0-.46.373-.833.833-.833h3.333a.833.833 0 1 1 0 1.667H30a.833.833 0 0 1-.833-.834ZM35.834 52.5c0-.46.373-.833.833-.833H40a.833.833 0 0 1 0 1.667h-3.333a.833.833 0 0 1-.834-.834Z" clip-rule="evenodd"/>
</svg>
`,iJ=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0.52 0.12 120 120">
<path class="tw-fill-illustration-bg-primary" d="M120.518 60.121c0 33.137-26.863 60-60 60s-60-26.863-60-60 26.863-60 60-60 60 26.863 60 60Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M60.518 117.621c31.756 0 57.5-25.743 57.5-57.5 0-31.756-25.744-57.5-57.5-57.5s-57.5 25.744-57.5 57.5 25.744 57.5 57.5 57.5Zm0 2.5c33.137 0 60-26.863 60-60s-26.863-60-60-60-60 26.863-60 60 26.863 60 60 60Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M51.088.858c12.675 9.633 22.026 23.414 26.03 39.32 16.502.649 31.563 6.91 43.326 16.93.049.998.074 2.003.074 3.014l-.001.38c-11.422-10.39-26.357-16.986-42.813-17.796a71.535 71.535 0 0 1 1.564 14.916c0 16.114-5.35 30.978-14.37 42.915a68.918 68.918 0 0 0 16.87 2.085 68.566 68.566 0 0 0 25.496-4.883 60.441 60.441 0 0 1-3.429 3.9 71.193 71.193 0 0 1-22.067 3.483 71.36 71.36 0 0 1-18.555-2.44A71.615 71.615 0 0 1 45.5 118.227a59.379 59.379 0 0 1-3.288-.949 69.075 69.075 0 0 0 18.38-15.355C43.27 96.538 28.78 84.721 19.918 69.265A68.568 68.568 0 0 0 8.75 90.475a59.868 59.868 0 0 1-1.636-2.974 71.13 71.13 0 0 1 11.496-20.618c-5.17-9.868-8.093-21.098-8.093-33.011 0-2.536.132-5.041.39-7.509a60.255 60.255 0 0 1 3.093-4.141 69.204 69.204 0 0 0-.983 11.65c0 11.122 2.641 21.627 7.33 30.923 13.065-15.111 32.376-24.673 53.92-24.673h.253C70.367 24.294 60.712 10.694 47.723 1.49a59.73 59.73 0 0 1 3.365-.63Zm25.68 56.764c0-5.15-.566-10.168-1.64-14.995a70.333 70.333 0 0 0-.86-.005c-21.139 0-40.05 9.54-52.661 24.55 8.663 15.617 23.23 27.506 40.687 32.653 9.071-11.65 14.474-26.295 14.474-42.203Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" d="M84.268 40.121a7.5 7.5 0 1 1-15 0 7.5 7.5 0 0 1 15 0Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M76.768 45.121a5 5 0 1 0 0-10 5 5 0 0 0 0 10Zm0 2.5a7.5 7.5 0 1 0 0-15 7.5 7.5 0 0 0 0 15Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M70.518 100.121a7.5 7.5 0 1 1-15 0 7.5 7.5 0 0 1 15 0Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M63.018 105.121a5 5 0 1 0 0-10 5 5 0 0 0 0 10Zm0 2.5a7.5 7.5 0 1 0 0-15 7.5 7.5 0 0 0 0 15Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" d="M28.018 65.121a7.5 7.5 0 1 1-15 0 7.5 7.5 0 0 1 15 0Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M20.518 70.121a5 5 0 1 0 0-10 5 5 0 0 0 0 10Zm0 2.5a7.5 7.5 0 1 0 0-15 7.5 7.5 0 0 0 0 15Z" clip-rule="evenodd"/>
</svg>
`;class nJ{constructor(e){this.dialogRef=e}static open(e){return e.open(nJ,{positionStrategy:new sh})}}nJ.ɵfac=function(e){return new(e||nJ)(Fl.rXU(pd.ce))},nJ.ɵcmp=Fl.VBU({type:nJ,selectors:[["ng-component"]],decls:27,vars:18,consts:[["dialogSize","small","hideIcon",""],["bitDialogTitle","",1,"tw-flex","tw-flex-col","tw-justify-start"],[1,"tw-flex","tw-justify-start","tw-pb-2"],["bitBadge","","variant","info"],[1,"tw-flex","tw-flex-col"],[1,"tw-text-start"],[1,"tw-overflow-y-auto","tw-text-start","tw-break-words","tw-hyphens-auto","tw-text-sm"],["bitDialogFooter",""],[1,"tw-flex","tw-flex-col","tw-justify-center"],["type","button","bitButton","","buttonType","primary",1,"tw-mb-2",3,"click"],["type","button","bitButton","","buttonType","secondary",1,"tw-mb-4",3,"click"],["bitLink","","href","https://bitwarden.com/help/automatic-confirmation/","target","_blank",1,"tw-text-sm","tw-text-center"],[1,"tw-pr-1"],[1,"bwi","bwi-external-link","bwi-fw"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-simple-dialog",0)(1,"div",1)(2,"div",2)(3,"span",3),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()(),Fl.j41(6,"div",4)(7,"h3",5)(8,"strong"),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s()(),Fl.j41(11,"span",6),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s()()(),Fl.qex(14,7),Fl.j41(15,"div",8)(16,"button",9),Fl.bIt("click",function(){return t.dialogRef.close(!0)}),Fl.EFF(17),Fl.nI1(18,"i18n"),Fl.k0s(),Fl.j41(19,"button",10),Fl.bIt("click",function(){return t.dialogRef.close(!1)}),Fl.EFF(20),Fl.nI1(21,"i18n"),Fl.k0s(),Fl.j41(22,"a",11)(23,"strong",12),Fl.EFF(24),Fl.nI1(25,"i18n"),Fl.k0s(),Fl.nrm(26,"i",13),Fl.k0s()(),Fl.bVm(),Fl.k0s()),2&e&&(Fl.R7$(4),Fl.SpI(" ",Fl.bMT(5,6,"availableNow")),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(10,8,"autoConfirmSetup")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(13,10,"autoConfirmSetupDesc")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(18,12,"turnOn")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(21,14,"close")," "),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(25,16,"autoConfirmSetupHint")," "))},dependencies:[id,td,Fh,Yd,kl.MD,sf,Qc,rf],encapsulation:2,changeDetection:0});class rJ{constructor(e){this.dialogRef=e}static open(e){return e.open(rJ,{positionStrategy:new sh})}}rJ.ɵfac=function(e){return new(e||rJ)(Fl.rXU(pd.ce))},rJ.ɵcmp=Fl.VBU({type:rJ,selectors:[["ng-component"]],decls:19,vars:15,consts:[["dialogSize","small"],["bitDialogTitle",""],["bitDialogContent",""],["bitLink","","href","https://bitwarden.com/help/automatic-confirmation/","target","_blank","rel","noopener noreferrer"],[1,"bwi","bwi-external-link","bwi-fw"],["bitDialogFooter",""],["type","button","bitButton","","buttonType","primary",3,"click"],["type","button","bitButton","","buttonType","secondary",3,"click"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-simple-dialog",0)(1,"span",1)(2,"strong"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"span",2),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.j41(8,"a",3),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.nrm(11,"i",4),Fl.k0s()(),Fl.qex(12,5),Fl.j41(13,"button",6),Fl.bIt("click",function(){return t.dialogRef.close(!0)}),Fl.EFF(14),Fl.nI1(15,"i18n"),Fl.k0s(),Fl.j41(16,"button",7),Fl.bIt("click",function(){return t.dialogRef.close(!1)}),Fl.EFF(17),Fl.nI1(18,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e&&(Fl.R7$(3),Fl.JRh(Fl.bMT(4,5,"warningCapitalized")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(7,7,"autoConfirmWarning")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(10,9,"autoConfirmWarningLink")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(15,11,"turnOn")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(18,13,"close")," "))},dependencies:[id,td,Fh,Yd,kl.MD,sc],encapsulation:2,changeDetection:0});const sJ=Fw`
<svg viewBox="0 0 290 45" xmlns="http://www.w3.org/2000/svg">
<title>Bitwarden</title>
<path class="tw-fill-marketing-logo" fill-rule="evenodd" clip-rule="evenodd" d="M69.799 10.713c3.325 0 5.911 1.248 7.811 3.848 1.9 2.549 2.85 6.033 2.85 10.453 0 4.576-.95 8.113-2.902 10.61-1.953 2.547-4.592 3.743-7.918 3.743-3.325 0-5.858-1.144-7.758-3.536h-.528l-1.003 2.444a.976.976 0 0 1-.897.572H55.23a.94.94 0 0 1-.95-.936V1.352a.94.94 0 0 1 .95-.936h5.7a.94.94 0 0 1 .95.936v8.009c0 1.144-.105 2.964-.316 5.46h.317c1.741-2.704 4.433-4.108 7.917-4.108Zm-2.428 6.084c-1.847 0-3.273.572-4.17 1.717-.844 1.144-1.32 3.068-1.32 5.668v.832c0 2.964.423 5.097 1.32 6.345.897 1.248 2.322 1.924 4.275 1.924 1.531 0 2.85-.728 3.748-2.184.897-1.404 1.372-3.537 1.372-6.189 0-2.704-.475-4.732-1.372-6.084-.95-1.352-2.27-2.029-3.853-2.029ZM93.022 38.9h-5.7a.94.94 0 0 1-.95-.936V12.221a.94.94 0 0 1 .95-.936h5.7a.94.94 0 0 1 .95.936v25.69c.053.468-.422.988-.95.988Zm20.849-5.564c1.108 0 2.428-.208 4.011-.624a.632.632 0 0 1 .792.624v4.316a.64.64 0 0 1-.37.572c-1.794.728-4.064 1.092-6.597 1.092-3.062 0-5.278-.728-6.651-2.288-1.372-1.508-2.111-3.796-2.111-6.812V16.953h-3.008c-.37 0-.634-.26-.634-.624v-2.444c0-.052.053-.104.053-.156l4.17-2.444 2.058-5.408c.106-.26.317-.417.581-.417h3.8c.369 0 .633.26.633.625v5.252h7.548c.158 0 .317.156.317.312v4.68c0 .364-.264.624-.634.624h-7.178v13.21c0 1.04.317 1.872.897 2.34.528.572 1.373.832 2.323.832Zm35.521 5.564c-.739 0-1.319-.468-1.636-1.144l-5.595-16.797c-.369-1.196-.844-3.016-1.478-5.357h-.158l-.528 1.873-1.108 3.536-5.753 16.797c-.211.676-.845 1.092-1.584 1.092a1.628 1.628 0 0 1-1.583-1.196l-7.02-24.182c-.211-.728.369-1.508 1.214-1.508h.158c.528 0 1.003.364 1.161.884l4.117 14.717c1.003 3.849 1.689 6.657 2.006 8.53h.158c.95-3.85 1.689-6.397 2.164-7.698l5.331-15.393c.211-.624.792-1.04 1.531-1.04.686 0 1.267.416 1.478 1.04l4.961 15.29c1.214 3.9 1.953 6.396 2.217 7.696h.158c.159-1.04.792-3.952 2.006-8.633l3.958-14.509c.159-.52.634-.884 1.162-.884.791 0 1.372.728 1.161 1.508l-6.651 24.182c-.211.728-.844 1.196-1.636 1.196h-.211Zm31.352 0a.962.962 0 0 1-.95-.832l-.475-3.432h-.264c-1.372 1.716-2.745 2.964-4.223 3.692-1.425.728-3.166 1.04-5.119 1.04-2.692 0-4.751-.676-6.228-2.028-1.32-1.196-2.059-2.808-2.164-4.836-.212-2.704.95-5.305 3.166-6.813 2.27-1.456 5.437-2.34 9.712-2.34l5.173-.156v-1.768c0-2.6-.528-4.473-1.637-5.773-1.108-1.3-2.744-1.924-5.067-1.924-2.216 0-4.433.52-6.756 1.612-.58.26-1.266 0-1.53-.572s0-1.248.58-1.456c2.639-1.04 5.226-1.612 7.865-1.612 3.008 0 5.225.78 6.756 2.34 1.478 1.508 2.216 3.953 2.216 7.125v16.901c-.052.312-.527.832-1.055.832Zm-10.926-1.768c2.956 0 5.226-.832 6.862-2.444 1.689-1.612 2.533-3.952 2.533-6.813v-2.6l-4.75.208c-3.853.156-6.545.78-8.234 1.768-1.636.988-2.481 2.6-2.481 4.68 0 1.665.528 3.017 1.531 3.953 1.161.78 2.639 1.248 4.539 1.248Zm31.246-25.638c.792 0 1.584.052 2.481.156a1.176 1.176 0 0 1 1.003 1.352c-.106.624-.739.988-1.372.884-.792-.104-1.584-.208-2.375-.208-2.323 0-4.223.988-5.701 2.912-1.478 1.925-2.217 4.42-2.217 7.333v13.625c0 .676-.527 1.196-1.214 1.196-.686 0-1.213-.52-1.213-1.196V13.105c0-.572.475-1.04 1.055-1.04.581 0 1.056.416 1.056.988l.211 3.848h.158c1.109-1.976 2.323-3.38 3.589-4.16 1.214-.832 2.745-1.248 4.539-1.248Zm18.579 0c1.953 0 3.695.364 5.12 1.04 1.478.676 2.745 1.924 3.853 3.64h.158a122.343 122.343 0 0 1-.158-6.084V1.612c0-.676.528-1.196 1.214-1.196.686 0 1.214.52 1.214 1.196v36.351c0 .468-.37.832-.845.832a.852.852 0 0 1-.844-.78l-.528-3.38h-.211c-2.058 3.068-5.067 4.576-8.92 4.576-3.8 0-6.598-1.144-8.656-3.484-1.953-2.34-3.008-5.668-3.008-10.089 0-4.628.95-8.165 2.955-10.66 2.006-2.237 4.856-3.485 8.656-3.485Zm0 2.236c-3.008 0-5.225 1.04-6.756 3.12-1.478 2.029-2.216 4.993-2.216 8.945 0 7.593 3.008 11.39 9.025 11.39 3.114 0 5.331-.885 6.756-2.653 1.478-1.768 2.164-4.68 2.164-8.737v-.416c0-4.16-.686-7.124-2.164-8.893-1.372-1.872-3.642-2.756-6.809-2.756Zm31.616 25.638c-3.959 0-7.02-1.196-9.289-3.64-2.217-2.392-3.326-5.772-3.326-10.089 0-4.316 1.056-7.748 3.22-10.297 2.164-2.6 5.014-3.9 8.656-3.9 3.167 0 5.753 1.092 7.548 3.276 1.9 2.184 2.797 5.2 2.797 8.997v1.976h-19.634c.052 3.692.897 6.5 2.639 8.477 1.741 1.976 4.169 2.86 7.389 2.86 1.531 0 2.956-.104 4.117-.312.844-.156 1.847-.416 3.061-.832.686-.26 1.425.26 1.425.988 0 .416-.264.832-.686.988-1.267.52-2.481.832-3.589 1.04-1.32.364-2.745.468-4.328.468Zm-.739-25.69c-2.639 0-4.75.832-6.334 2.548-1.583 1.665-2.48 4.16-2.797 7.333h16.89c0-3.068-.686-5.564-2.059-7.28-1.372-1.717-3.272-2.6-5.7-2.6ZM288.733 38.9c-.686 0-1.214-.52-1.214-1.196V21.426c0-2.704-.58-4.68-1.689-5.877-1.214-1.196-2.955-1.872-5.383-1.872-3.273 0-5.648.78-7.126 2.444-1.478 1.613-2.322 4.265-2.322 7.853V37.6c0 .676-.528 1.196-1.214 1.196-.686 0-1.214-.52-1.214-1.196V13.105c0-.624.475-1.092 1.108-1.092.581 0 1.003.416 1.109.936l.316 2.704h.159c1.794-2.808 4.908-4.212 9.448-4.212 6.175 0 9.289 3.276 9.289 9.829V37.6c-.053.727-.633 1.3-1.267 1.3ZM90.225 0c-2.48 0-4.486 1.872-4.486 4.212v.416c0 2.289 2.058 4.213 4.486 4.213s4.486-1.924 4.486-4.213v-.364C94.711 1.872 92.653 0 90.225 0Z" />
<path class="tw-fill-marketing-logo" d="M32.041 24.546V5.95H18.848v33.035c2.336-1.22 4.427-2.547 6.272-3.98 4.614-3.565 6.921-7.051 6.921-10.46Zm5.654-22.314v22.314c0 1.665-.329 3.317-.986 4.953-.658 1.637-1.473 3.09-2.445 4.359-.971 1.268-2.13 2.503-3.475 3.704-1.345 1.2-2.586 2.199-3.725 2.993a46.963 46.963 0 0 1-3.563 2.251c-1.237.707-2.116 1.187-2.636 1.439-.52.251-.938.445-1.252.58-.235.117-.49.175-.765.175s-.53-.058-.766-.174c-.314-.136-.731-.33-1.252-.581-.52-.252-1.398-.732-2.635-1.439a47.003 47.003 0 0 1-3.564-2.251c-1.138-.794-2.38-1.792-3.725-2.993-1.345-1.2-2.503-2.436-3.475-3.704-.972-1.27-1.787-2.722-2.444-4.359C.329 27.863 0 26.211 0 24.546V2.232c0-.504.187-.94.56-1.308A1.823 1.823 0 0 1 1.885.372H35.81c.511 0 .953.184 1.326.552.373.368.56.804.56 1.308Z" />
</svg>
`,oJ=()=>["/"];function aJ(e,t){if(1&e&&(Fl.j41(0,"a",1),Fl.nrm(1,"bit-svg",3),Fl.nI1(2,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG();Fl.Y8G("routerLink",Fl.lJ4(5,oJ)),Fl.R7$(),Fl.Y8G("content",e.logo)("ariaLabel",Fl.bMT(2,3,"appLogoLabel"))}}class lJ{constructor(){this.hideLogo=(0,o.hFB)(!1),this.logo=sJ}}lJ.ɵfac=function(e){return new(e||lJ)},lJ.ɵcmp=Fl.VBU({type:lJ,selectors:[["bit-landing-header"]],inputs:{hideLogo:[1,"hideLogo"]},ngContentSelectors:["*"],decls:4,vars:1,consts:[[1,"tw-flex","tw-w-full","tw-bg-background-alt","tw-px-5"],[1,"tw-w-32","tw-py-5","sm:tw-w-[200px]","tw-self-center","sm:tw-self-start","tw-block","[&>*]:tw-align-top",3,"routerLink"],[1,"[&:has(*)]:tw-ms-auto","[&:has(*)]:tw-py-5"],[3,"content","ariaLabel"]],template:function(e,t){1&e&&(Fl.NAR(),Fl.j41(0,"header",0),Fl.nVh(1,aJ,3,6,"a",1),Fl.j41(2,"div",2),Fl.SdG(3),Fl.k0s()()),2&e&&(Fl.R7$(),Fl.vxM(t.hideLogo()?-1:1))},dependencies:[Cw.iI,Cw.Wk,Yh,BC,ec,sc],encapsulation:2,changeDetection:0});class cJ{}cJ.ɵfac=function(e){return new(e||cJ)},cJ.ɵmod=Fl.$C({type:cJ}),cJ.ɵinj=a.G2t({imports:[lJ]});const uJ=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 501 226"><g clip-path="url(#left-bg-illustration-clip)"><path class="tw-fill-illustration-bg-primary" d="M-71.691 6.821a4 4 0 0 1 4-4h296.5a4 4 0 0 1 4 4v188a4 4 0 0 1-4 4h-296.5a4 4 0 0 1-4-4v-188Z"/><path class="tw-fill-illustration-bg-primary" d="M-48.941 25.821a2 2 0 0 1 2-2h127.5v154h-127.5a2 2 0 0 1-2-2v-150Z"/><path class="tw-fill-illustration-bg-tertiary" d="M80.559 25.82a2 2 0 0 1 2-2h125.5a2 2 0 0 1 2 2v150.001a2 2 0 0 1-2 2h-125.5a2 2 0 0 1-2-2v-150ZM45.871 89.854c0 17.155-13.96 31.062-31.182 31.062-17.221 0-31.182-13.907-31.182-31.062s13.96-31.062 31.182-31.062c17.221 0 31.182 13.907 31.182 31.062Z"/><path class="tw-fill-illustration-bg-tertiary" d="M72.396 153.443a57.243 57.243 0 0 1 4.663 22.604v1.222a2 2 0 0 1-2 2h-118.5a2 2 0 0 1-2-2v-1.222a57.243 57.243 0 0 1 4.662-22.604c3.078-7.167 7.59-13.678 13.277-19.163 5.688-5.485 12.44-9.836 19.871-12.805a63.228 63.228 0 0 1 23.44-4.496 63.227 63.227 0 0 1 23.439 4.496c7.431 2.969 14.183 7.32 19.87 12.805 5.688 5.485 10.2 11.996 13.278 19.163Z"/><path class="tw-fill-illustration-bg-secondary" d="M161.629 57.193c0 9.182-7.579 16.625-16.927 16.625-9.349 0-16.928-7.443-16.928-16.625 0-9.181 7.579-16.625 16.928-16.625 9.348 0 16.927 7.444 16.927 16.625Z"/><path class="tw-fill-illustration-bg-secondary" d="M176.028 89.071a29.33 29.33 0 0 1 2.531 11.894c0 .937-.759 1.696-1.696 1.696h-63.109a1.695 1.695 0 0 1-1.695-1.696c0-4.081.86-8.123 2.531-11.894 1.671-3.77 4.12-7.197 7.207-10.083 3.088-2.886 6.753-5.176 10.787-6.738a35.275 35.275 0 0 1 12.725-2.366c4.366 0 8.69.804 12.724 2.366 4.034 1.562 7.699 3.852 10.787 6.738 3.087 2.886 5.537 6.312 7.208 10.083ZM161.629 134.193c0 9.182-7.579 16.625-16.927 16.625-9.349 0-16.928-7.443-16.928-16.625s7.579-16.625 16.928-16.625c9.348 0 16.927 7.443 16.927 16.625Z"/><path class="tw-fill-illustration-bg-secondary" d="M176.028 165.953a28.993 28.993 0 0 1 2.531 11.821c0 .93-.755 1.684-1.685 1.684h-63.131c-.93 0-1.684-.754-1.684-1.684 0-4.057.86-8.074 2.531-11.821 1.671-3.748 4.12-7.153 7.207-10.021 3.088-2.869 6.753-5.144 10.787-6.696a35.456 35.456 0 0 1 12.725-2.352c4.366 0 8.69.799 12.724 2.352 4.034 1.552 7.699 3.827 10.787 6.696 3.087 2.868 5.537 6.273 7.208 10.021ZM-87.441 199.521h332.5v14.5c0 5.523-4.478 10-10 10h-312.5c-5.523 0-10-4.477-10-10v-14.5Z"/><path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M208.059 21.82a4 4 0 0 1 4 4v150.001a4 4 0 0 1-4 4l-255 .001a4 4 0 0 1-4-4v-150a4 4 0 0 1 4-4l255-.001Zm-255 154.002h1.5a57.23 57.23 0 0 1 4.378-21.706l.284-.673c2.982-6.943 7.31-13.27 12.748-18.646l.529-.517c5.688-5.485 12.44-9.836 19.871-12.805a62.937 62.937 0 0 1 10.036-3.065c-11.113-4.751-18.897-15.747-18.897-28.556 0-17.155 13.96-31.061 31.182-31.062 17.22 0 31.18 13.907 31.181 31.062 0 12.537-7.457 23.338-18.192 28.245a62.952 62.952 0 0 1 11.569 3.376c7.431 2.969 14.184 7.32 19.871 12.805 5.688 5.485 10.2 11.996 13.278 19.163a57.251 57.251 0 0 1 4.66 22.379h1.502v-150h-125.5v150Zm129.5-.001h29.568a29.02 29.02 0 0 1 2.159-9.161l.304-.706c1.671-3.748 4.12-7.154 7.207-10.022 2.894-2.689 6.297-4.857 10.035-6.396l.752-.299c.996-.383 2.01-.721 3.037-1.012-4.602-2.879-7.693-7.881-7.841-13.602l-.006-.429c0-9.182 7.579-16.625 16.928-16.625l.437.006c9.146.227 16.49 7.581 16.49 16.619l-.006.429c-.144 5.571-3.08 10.461-7.484 13.372 1.321.338 2.622.752 3.894 1.242 4.034 1.552 7.7 3.827 10.787 6.695 3.088 2.868 5.536 6.274 7.207 10.022a29.066 29.066 0 0 1 2.462 9.867h29.57v-73h-125.5v73Zm62.75-24.936c-3.881 0-7.718.71-11.288 2.084-3.571 1.374-6.797 3.382-9.501 5.894-2.704 2.511-4.831 5.478-6.277 8.72a25.125 25.125 0 0 0-2.074 7.876h58.279a25.125 25.125 0 0 0-2.074-7.876c-1.445-3.242-3.573-6.209-6.276-8.72-2.705-2.512-5.931-4.52-9.501-5.894a31.473 31.473 0 0 0-11.288-2.084Zm-129.5-29.906a59.215 59.215 0 0 0-21.955 4.211c-6.957 2.779-13.269 6.848-18.579 11.969-5.31 5.12-9.513 11.191-12.378 17.862a53.266 53.266 0 0 0-4.332 20.248H73.053a53.266 53.266 0 0 0-4.332-20.248c-2.866-6.671-7.07-12.742-12.38-17.862-5.31-5.121-11.621-9.19-18.577-11.969a59.215 59.215 0 0 0-21.955-4.211Zm128.893.59c-7.208 0-12.928 5.72-12.928 12.625.001 6.904 5.721 12.624 12.928 12.624 7.208 0 12.926-5.72 12.927-12.624 0-6.905-5.719-12.625-12.927-12.625ZM14.69 62.792c-15.027 0-27.182 12.13-27.182 27.062 0 14.931 12.155 27.062 27.181 27.063 15.027-.001 27.182-12.132 27.182-27.063S29.716 62.793 14.69 62.792Zm67.869 36.029h29.579c.229-3.094.952-6.141 2.148-9.04l.304-.71a30.936 30.936 0 0 1 6.636-9.536l.571-.547a33.416 33.416 0 0 1 10.035-6.437l.752-.3a34.78 34.78 0 0 1 3.047-1.021c-4.607-2.878-7.703-7.883-7.851-13.607l-.006-.43c0-9.18 7.579-16.624 16.928-16.624l.437.006c9.146.227 16.49 7.58 16.49 16.619l-.006.429c-.144 5.574-3.082 10.465-7.49 13.376 1.324.34 2.626.758 3.9 1.252 4.034 1.561 7.7 3.85 10.787 6.737 3.088 2.886 5.536 6.312 7.207 10.083a29.407 29.407 0 0 1 2.451 9.75h29.581v-73h-125.5v73Zm62.75-24.937c-3.878 0-7.712.714-11.281 2.096-3.568 1.382-6.795 3.401-9.5 5.93-2.704 2.528-4.833 5.515-6.281 8.782a25.432 25.432 0 0 0-2.08 7.969h58.283a25.432 25.432 0 0 0-2.08-7.97c-1.447-3.266-3.577-6.253-6.281-8.781-2.705-2.529-5.931-4.548-9.5-5.93a31.275 31.275 0 0 0-11.28-2.096Zm-.607-29.315c-7.208 0-12.928 5.72-12.928 12.625.001 6.904 5.721 12.624 12.928 12.624 7.208 0 12.926-5.72 12.927-12.624 0-6.905-5.719-12.625-12.927-12.625Z" clip-rule="evenodd"/><path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M228.809.822a6 6 0 0 1 6 6v188a5.97 5.97 0 0 1-.643 2.699h12.893v16.5c0 6.627-5.373 12-12 12h-312.5c-6.628 0-12-5.373-12-12v-16.5h16.391a5.966 5.966 0 0 1-.634-2.391l-.007-.308v-188a6 6 0 0 1 6-6h296.5ZM-85.441 214.02a8 8 0 0 0 8 8h312.5a8 8 0 0 0 8-8v-12.5h-328.5v12.5Zm17.75-209.2a2 2 0 0 0-2 2v188.001l.01.204a2 2 0 0 0 1.99 1.796h296.5a2.001 2.001 0 0 0 2-2v-188a2 2 0 0 0-2-2h-296.5Z" clip-rule="evenodd"/><path class="tw-fill-illustration-bg-primary" d="M378.821 114.003a1.997 1.997 0 0 0-.675 1.497v8.396c0 .583.254 1.136.697 1.515l11.455 9.825a2 2 0 0 1 .543 2.286l-4.203 10.056a1.998 1.998 0 0 1-1.936 1.224l-15.288-.717a1.997 1.997 0 0 0-1.501.579l-6.014 5.979a1.995 1.995 0 0 0-.583 1.569l1.145 14.942a1.997 1.997 0 0 1-1.22 1.995l-9.958 4.169a1.997 1.997 0 0 1-2.252-.503l-10.221-11.309a1.998 1.998 0 0 0-1.482-.658h-8.474c-.579 0-1.129.252-1.508.689l-9.889 11.4a1.998 1.998 0 0 1-2.28.534l-9.969-4.174a1.998 1.998 0 0 1-1.224-1.937l.721-15.182a2 2 0 0 0-.587-1.51l-6.014-5.98a1.996 1.996 0 0 0-1.559-.575l-15.049 1.14a1.997 1.997 0 0 1-1.993-1.221l-4.198-10.045a1.997 1.997 0 0 1 .512-2.258l11.363-10.155c.424-.379.666-.92.666-1.489v-8.403c0-.583-.254-1.136-.696-1.516l-11.456-9.824a1.997 1.997 0 0 1-.542-2.286L279.354 92a1.998 1.998 0 0 1 1.936-1.224l15.288.717a1.998 1.998 0 0 0 1.502-.579l6.007-5.974c.418-.415.631-.995.582-1.582l-1.292-15.419a1.995 1.995 0 0 1 1.218-2.008l9.942-4.163a1.996 1.996 0 0 1 2.258.51l10.552 11.786c.379.423.92.665 1.488.665h8.469c.579 0 1.129-.25 1.508-.688l9.889-11.4a1.996 1.996 0 0 1 2.279-.534l9.97 4.174a1.999 1.999 0 0 1 1.224 1.937l-.721 15.181a2 2 0 0 0 .587 1.51l6.014 5.98c.411.41.98.62 1.558.576l15.049-1.14a1.996 1.996 0 0 1 1.993 1.22l4.195 10.036c.33.79.12 1.702-.521 2.268l-11.507 10.154Z"/><path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M313.765 59.926a3.994 3.994 0 0 1 4.518 1.02l10.552 11.786h8.469l9.888-11.4a3.994 3.994 0 0 1 4.559-1.067l9.97 4.174a3.994 3.994 0 0 1 2.447 3.873l-.72 15.182 6.013 5.98 15.049-1.14a3.995 3.995 0 0 1 3.987 2.442l4.194 10.035a3.992 3.992 0 0 1-1.042 4.534L380.142 115.5v8.396l11.456 9.824a3.995 3.995 0 0 1 1.085 4.571l-4.203 10.056a3.993 3.993 0 0 1-3.872 2.449l-15.288-.717-6.013 5.98 1.145 14.943a3.994 3.994 0 0 1-2.44 3.988l-9.958 4.169a3.992 3.992 0 0 1-4.505-1.005l-10.221-11.309h-8.474l-9.889 11.4a3.993 3.993 0 0 1-4.559 1.067l-9.97-4.174a3.993 3.993 0 0 1-2.446-3.873l.72-15.181-6.014-5.98-15.049 1.14a3.993 3.993 0 0 1-3.986-2.442l-4.198-10.045a3.993 3.993 0 0 1 1.023-4.517l11.363-10.155v-8.403l-11.455-9.825a3.992 3.992 0 0 1-1.085-4.571l4.203-10.056a3.993 3.993 0 0 1 3.872-2.45l15.287.718 6.008-5.974-1.292-15.418a3.992 3.992 0 0 1 2.437-4.017l9.941-4.163Zm1.543 3.684-9.942 4.162 1.292 15.419a3.992 3.992 0 0 1-1.163 3.165l-6.008 5.974a3.994 3.994 0 0 1-3.003 1.157l-15.288-.717-4.202 10.056 11.455 9.824a3.993 3.993 0 0 1 1.394 3.032v8.403c0 1.137-.485 2.22-1.332 2.978l-11.364 10.154 4.198 10.045 15.049-1.14a3.994 3.994 0 0 1 3.118 1.15l6.014 5.98a3.996 3.996 0 0 1 1.173 3.021l-.72 15.181 9.969 4.175 9.889-11.401a3.994 3.994 0 0 1 3.017-1.377h8.474c1.129 0 2.206.478 2.963 1.316l10.221 11.309 9.958-4.169-1.145-14.943a3.996 3.996 0 0 1 1.166-3.137l6.013-5.979a3.997 3.997 0 0 1 3.003-1.158l15.288.717 4.203-10.056-11.456-9.824a3.995 3.995 0 0 1-1.393-3.031V115.5c0-1.146.492-2.236 1.351-2.994l11.506-10.155-4.194-10.035-15.049 1.14a3.991 3.991 0 0 1-3.117-1.15l-6.014-5.98a3.99 3.99 0 0 1-1.173-3.022l.72-15.181-9.97-4.174-9.889 11.4a3.992 3.992 0 0 1-3.016 1.377h-8.469a3.992 3.992 0 0 1-2.975-1.33L315.308 63.61Z" clip-rule="evenodd"/><path class="tw-fill-illustration-logo" d="M353.438 119.624c0 11.289-9.152 20.441-20.442 20.441-11.289 0-20.441-9.152-20.441-20.441 0-11.29 9.152-20.442 20.441-20.442 11.29 0 20.442 9.152 20.442 20.442Z"/><path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M332.996 101.179c-10.186 0-18.444 8.258-18.444 18.444 0 10.187 8.258 18.445 18.444 18.445 10.187 0 18.445-8.258 18.445-18.445 0-10.186-8.258-18.444-18.445-18.444Zm-22.438 18.444c0-12.392 10.046-22.438 22.438-22.438 12.393 0 22.439 10.046 22.439 22.438 0 12.393-10.046 22.439-22.439 22.439-12.392 0-22.438-10.046-22.438-22.439Z" clip-rule="evenodd"/><path class="tw-fill-illustration-bg-tertiary" d="m497.152 164.106-7.588-7.587a3.004 3.004 0 0 0-4.245-.003l-4.055 4.047 11.83 11.83 4.055-4.047a2.996 2.996 0 0 0 .003-4.24Z"/><path class="tw-fill-illustration-bg-secondary" d="M500.922 194.274c0 22.644-18.356 41-41 41s-41-18.356-41-41 18.356-41 41-41 41 18.356 41 41Z"/><path class="tw-fill-illustration-outline" d="M459.03 177.416a2 2 0 1 1 4 0v18.469c0 .613-.282 1.192-.763 1.571l-12.032 9.48a2.001 2.001 0 0 1-2.809-.333 2.002 2.002 0 0 1 .334-2.809l11.27-8.881v-17.497Z"/><path class="tw-fill-illustration-bg-tertiary" d="M450.936 144.041a2 2 0 0 1 2-2h13.972a2 2 0 0 1 2 2v3.863a2 2 0 0 1-2 2h-13.972a2 2 0 0 1-2-2v-3.863Z"/><path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M467.114 140.046a4 4 0 0 1 3.794 3.995v3.863a3.999 3.999 0 0 1-3.931 3.998v1.978a40.72 40.72 0 0 1 13.484 4.903l3.69-3.68a5.008 5.008 0 0 1 7.076.003l7.587 7.588.177.186a4.994 4.994 0 0 1-.181 6.881l-3.615 3.606a40.801 40.801 0 0 1 5.727 20.907c0 22.644-18.357 41-41 41-22.644 0-41-18.356-41-41 0-20.434 14.949-37.375 34.507-40.487v-1.883h-.493a4 4 0 0 1-4-4v-3.863a4 4 0 0 1 4-4h13.972l.206.005Zm-7.192 17.228c-20.435 0-37 16.566-37 37 0 20.435 16.565 37 37 37 20.434 0 37-16.565 37-37 0-20.434-16.566-37-37-37Zm28.473.658a1.002 1.002 0 0 0-1.416-.001l-2.638 2.633 9.001 9.002 2.639-2.633a1 1 0 0 0 .07-1.338l-.069-.075-7.587-7.588Zm-30.966-6.028v1.447a41.171 41.171 0 0 1 5.548.036v-1.483h-5.548Zm-4.493-4h13.972v-3.863h-13.972v3.863Z" clip-rule="evenodd"/></g><defs><clipPath id="left-bg-illustration-clip"><path class="tw-fill-illustration-bg-tertiary" d="M0 0h501v226H0z"/></clipPath></defs></svg>
`,dJ=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 506 297">
<g clip-path="url(#right-bg-illustration-clip)">
<path class="tw-fill-illustration-bg-primary" d="M45.673 294.742v-29.124l22.323 16.198-15.395 15.75a4.04 4.04 0 0 1-6.928-2.824Z"/>
<path class="tw-fill-illustration-bg-tertiary" d="m4.978 240.865 95.568-44.738c3.52-1.648 7.492 1.175 7.093 5.041l-9.608 93.173c-.395 3.823-4.774 5.79-7.893 3.547l-43.43-31.233-41.47-16.621c-4.06-1.627-4.221-7.315-.26-9.169Z"/>
<path class="tw-fill-illustration-outline" d="M99.698 194.315c4.929-2.306 10.489 1.645 9.931 7.058l-9.608 93.174c-.552 5.351-6.683 8.105-11.05 4.965l-20.832-14.983-14.107 14.435a6.04 6.04 0 0 1-10.359-4.222v-27.151l-39.178-15.7c-5.684-2.278-5.91-10.242-.364-12.838l95.567-44.738Zm5.953 6.648c.239-2.32-2.144-4.013-4.256-3.025L5.827 242.676c-2.376 1.112-2.28 4.525.156 5.502l40.159 16.093 26.703-30.327a2.001 2.001 0 0 1 3.002 2.644l-26.178 29.731 41.637 29.945c1.872 1.346 4.5.165 4.736-2.128l9.609-93.173Zm-57.978 93.779a2.04 2.04 0 0 0 3.498 1.426l13.684-14.001-17.182-12.357v24.932Z"/>
<circle cx="86.719" cy="86.719" r="84.719" class="tw-fill-illustration-bg-tertiary tw-stroke-illustration-outline" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" transform="scale(-1 1) rotate(45.035 -184.565 -565.488)"/>
<circle cx="69.752" cy="69.752" r="69.752" class="tw-fill-illustration-bg-secondary" transform="scale(-1 1) rotate(45.035 -213.255 -553.709)"/>
<path class="tw-fill-illustration-outline" d="m445.838 353.214 2.95-180.467 12.372-.007 3.078 180.465a4.64 4.64 0 0 1-4.637 4.72l-9.12.005a4.64 4.64 0 0 1-4.643-4.716ZM453.82 52.947a2 2 0 0 1 1.998-2.001l35.638-.023a2 2 0 0 1 2.001 2.015l-.268 35.637a2 2 0 1 1-4-.03l.252-33.62-33.62.02a1.999 1.999 0 0 1-2.001-1.998ZM415.689 86.49a2 2 0 0 1 4.001.03l-.254 33.62 33.622-.021a2 2 0 0 1 .003 4l-35.637.022a2 2 0 0 1-2.001-2.015l.266-35.636Zm25.457-19.997a2 2 0 0 1 3.461-2.006l23.124 39.885a2 2 0 0 1-3.461 2.006l-23.124-39.885Z"/>
<path class="tw-fill-illustration-bg-primary" d="M259.264 277.271c21.107-4.293 34.791-24.62 30.565-45.402-4.227-20.782-24.764-34.15-45.871-29.857-21.107 4.293-34.791 24.62-30.565 45.402 4.227 20.783 24.764 34.15 45.871 29.857ZM299.993 173.472c7.793-1.585 12.826-9.188 11.241-16.981-1.585-7.793-9.187-12.826-16.981-11.241-7.793 1.585-12.826 9.187-11.241 16.981 1.585 7.793 9.188 12.826 16.981 11.241Z"/>
<path class="tw-fill-illustration-bg-secondary" d="M329.869 242.094c7.793-1.585 12.826-9.187 11.241-16.981-1.585-7.793-9.188-12.826-16.981-11.241-7.794 1.585-12.827 9.188-11.241 16.981 1.585 7.794 9.187 12.827 16.981 11.241Z"/>
<path class="tw-fill-illustration-bg-tertiary" d="M330.088 309.401c7.794-1.585 12.826-9.188 11.241-16.981-1.585-7.794-9.187-12.827-16.981-11.242-7.793 1.585-12.826 9.188-11.241 16.981 1.585 7.794 9.188 12.827 16.981 11.242Z"/>
<path class="tw-fill-illustration-bg-primary" d="M234.598 327.597c7.793-1.585 12.826-9.187 11.241-16.981-1.585-7.793-9.187-12.826-16.981-11.241-7.793 1.585-12.826 9.188-11.241 16.981 1.585 7.794 9.188 12.826 16.981 11.241Z"/>
<path class="tw-fill-illustration-bg-secondary" d="M176.919 248.71c7.794-1.585 12.827-9.188 11.242-16.981-1.586-7.794-9.188-12.827-16.982-11.242-7.793 1.586-12.826 9.188-11.241 16.982 1.585 7.793 9.188 12.826 16.981 11.241Z"/>
<path class="tw-fill-illustration-bg-tertiary" d="M206.836 185.071c7.794-1.585 12.827-9.188 11.242-16.981-1.586-7.793-9.188-12.826-16.982-11.241-7.793 1.585-12.826 9.188-11.241 16.981 1.585 7.793 9.188 12.826 16.981 11.241Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M200.699 154.89c8.875-1.805 17.533 3.927 19.339 12.803 1.165 5.732-.814 11.372-4.752 15.135.131.223.29.502.489.845l14.805 21.386a41.483 41.483 0 0 1 12.979-5.007c9.276-1.886 18.455-.523 26.321 3.303.038-.221.111-.441.227-.648l17.035-30.333a16.337 16.337 0 0 1-6.09-9.744c-1.805-8.876 3.928-17.535 12.803-19.34 8.876-1.805 17.534 3.928 19.339 12.803 1.805 8.876-3.926 17.534-12.802 19.339-3.427.697-6.822.27-9.803-1.028l-16.994 30.262a1.98 1.98 0 0 1-.397.497c8.774 5.316 15.487 13.883 18.16 24.43l19.238-1.61c-.007-7.642 5.356-14.488 13.135-16.07 8.875-1.805 17.534 3.927 19.339 12.803 1.805 8.875-3.927 17.533-12.802 19.339-8.639 1.757-17.072-3.627-19.18-12.099l-18.935 1.585c1.474 9.839-.81 19.465-5.834 27.387l29.108 22.962a16.324 16.324 0 0 1 8.523-4.671c8.876-1.804 17.534 3.928 19.339 12.803 1.805 8.876-3.927 17.534-12.802 19.339-8.875 1.805-17.534-3.926-19.34-12.802a16.338 16.338 0 0 1 1.872-11.474l-29.007-22.882c-5.828 7.464-14.29 12.983-24.349 15.028a41.442 41.442 0 0 1-14.045.441l-6.224 19.317a16.365 16.365 0 0 1 8.405 11.229c1.805 8.876-3.927 17.534-12.802 19.339-8.876 1.805-17.535-3.926-19.34-12.802-1.805-8.875 3.927-17.534 12.803-19.34 2.461-.5 4.906-.42 7.192.145l6.007-18.641c-14.851-3.594-27.011-15.301-30.225-31.105a40.043 40.043 0 0 1-.808-8.184l-20.473-1.442c-.032-.002-.064-.008-.096-.011-1.37 6.114-6.201 11.162-12.739 12.492-8.875 1.805-17.534-3.926-19.339-12.802-1.805-8.875 3.927-17.534 12.802-19.34 8.876-1.804 17.534 3.928 19.339 12.803.196.962.302 1.921.327 2.869l20.401 1.436c1.206-11.333 7.247-21.627 16.399-28.363l-14.76-21.321a20.41 20.41 0 0 0-.435-.719 16.428 16.428 0 0 1-4.816 1.8c-8.876 1.805-17.535-3.927-19.34-12.802-1.805-8.876 3.927-17.535 12.803-19.34Zm124.048 128.249c-6.711 1.365-11.045 7.912-9.68 14.623 1.365 6.711 7.912 11.044 14.623 9.679 6.71-1.365 11.044-7.911 9.679-14.622-1.364-6.71-7.911-11.044-14.622-9.68Zm-95.49 18.196c-6.711 1.365-11.045 7.912-9.68 14.623 1.365 6.711 7.912 11.044 14.623 9.679 6.71-1.365 11.044-7.911 9.679-14.621-1.365-6.711-7.911-11.045-14.622-9.681Zm15.1-97.363c-20.054 4.079-33.004 23.373-29.004 43.044 4.001 19.672 23.459 32.374 43.513 28.296 9.593-1.951 17.558-7.386 22.822-14.676a1.986 1.986 0 0 1 .612-.873c5.306-7.813 7.58-17.606 5.569-27.495-4.001-19.671-23.459-32.374-43.512-28.296Zm80.171 11.861c-6.711 1.364-11.045 7.912-9.68 14.623 1.365 6.71 7.912 11.044 14.623 9.679 6.71-1.365 11.044-7.911 9.679-14.622-1.365-6.711-7.911-11.045-14.622-9.68Zm-152.949 6.614c-6.711 1.365-11.045 7.912-9.681 14.623 1.365 6.711 7.912 11.044 14.623 9.679 6.711-1.365 11.044-7.911 9.68-14.621-1.365-6.711-7.912-11.045-14.622-9.681Zm123.073-75.237c-6.71 1.365-11.044 7.912-9.68 14.623 1.365 6.711 7.912 11.044 14.623 9.679 6.711-1.365 11.044-7.911 9.68-14.622-1.365-6.71-7.912-11.045-14.623-9.68Zm-93.156 11.6c-6.711 1.364-11.045 7.912-9.68 14.623 1.365 6.71 7.912 11.044 14.622 9.679 6.711-1.365 11.044-7.912 9.68-14.622-1.365-6.711-7.911-11.045-14.622-9.68Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-logo" d="M272.266 232.544a1.998 1.998 0 0 0-.353 1.589l.554 2.725a2.002 2.002 0 0 0 1.002 1.357l4.786 2.611a2 2 0 0 1 1.003 2.15l-.667 3.313a1.998 1.998 0 0 1-1.647 1.58l-5.641.896a1.998 1.998 0 0 0-1.352.867l-1.524 2.291a2 2 0 0 0-.252 1.678l1.555 5.227a2 2 0 0 1-.794 2.224l-2.799 1.902a2 2 0 0 1-2.309-.043l-4.524-3.327a2 2 0 0 0-1.583-.348l-2.754.56a1.997 1.997 0 0 0-1.352.994l-2.638 4.785a2 2 0 0 1-2.14.996l-3.339-.661a2 2 0 0 1-1.587-1.649l-.886-5.597a2.003 2.003 0 0 0-.875-1.358l-2.298-1.514a2 2 0 0 0-1.669-.247l-5.272 1.563a2 2 0 0 1-2.22-.788l-1.897-2.774a2.001 2.001 0 0 1 .045-2.321l3.339-4.498a2.004 2.004 0 0 0 .354-1.591l-.557-2.736a2.001 2.001 0 0 0-.983-1.347l-4.848-2.715a2 2 0 0 1-.983-2.14l.669-3.329a2.001 2.001 0 0 1 1.648-1.581l5.641-.895a1.999 1.999 0 0 0 1.352-.868l1.526-2.293c.327-.493.42-1.105.253-1.673l-1.608-5.457a2 2 0 0 1 .794-2.22l2.793-1.897a2 2 0 0 1 2.322.053l4.676 3.5a1.999 1.999 0 0 0 1.597.359l2.744-.558a2.002 2.002 0 0 0 1.353-.995l2.637-4.784a1.997 1.997 0 0 1 2.14-.996l3.339.661a2 2 0 0 1 1.587 1.649l.886 5.597c.088.555.406 1.048.875 1.357l2.298 1.514a2.002 2.002 0 0 0 1.669.248l5.272-1.564a2 2 0 0 1 2.22.789l1.898 2.775a2 2 0 0 1-.044 2.319l-3.432 4.635Zm-24.977-.064c-4.049 2.702-5.078 8.076-2.395 11.991 2.705 4.028 8.1 5.044 12.035 2.365 3.936-2.678 5.078-8.076 2.395-11.991-2.592-4.051-7.986-5.067-12.035-2.365Z"/>
<path class="tw-fill-illustration-outline" d="m270.507 237.256-.554-2.724a4.004 4.004 0 0 1 .705-3.178l3.433-4.636-1.897-2.775-5.273 1.564a4 4 0 0 1-3.337-.494l-2.298-1.515a4 4 0 0 1-1.751-2.714l-.886-5.597-3.339-.661-2.637 4.784a4.001 4.001 0 0 1-2.706 1.989l-2.744.558a4 4 0 0 1-3.194-.718l-4.676-3.5-2.792 1.898 1.608 5.457a3.998 3.998 0 0 1-.507 3.345l-1.525 2.294c-.62.931-1.6 1.56-2.704 1.736l-5.642.895-.669 3.329 4.848 2.715a4 4 0 0 1 1.965 2.693l.557 2.737a3.999 3.999 0 0 1-.708 3.18l-3.338 4.499 1.897 2.774 5.272-1.563a3.998 3.998 0 0 1 3.338.494l2.298 1.514a4.001 4.001 0 0 1 1.75 2.715l.886 5.597 3.339.661 2.638-4.785a4 4 0 0 1 2.706-1.988l2.753-.56a4 4 0 0 1 3.166.697l4.524 3.327 2.8-1.902-1.555-5.227a4.002 4.002 0 0 1 .504-3.355l1.524-2.291a3.998 3.998 0 0 1 2.703-1.736l5.642-.895.667-3.313-4.787-2.611a4.004 4.004 0 0 1-2.004-2.714Zm-24.328-6.439c4.915-3.28 11.556-2.099 14.795 2.898h.001v.001l.034.051h-.001c3.294 4.868 1.835 11.464-2.953 14.723-4.855 3.304-11.499 2.043-14.821-2.903l.001-.001c-3.308-4.845-2.013-11.461 2.944-14.769Zm11.461 5.106c-1.959-3.06-6.075-3.891-9.24-1.779-3.036 2.026-3.85 5.957-2.039 8.913l.183.284.01.015c2.089 3.109 6.234 3.879 9.25 1.827 3.066-2.087 3.897-6.25 1.871-9.207a.97.97 0 0 1-.035-.053Zm16.787.536 4.787 2.611a4 4 0 0 1 2.005 4.3l-.666 3.313a4.001 4.001 0 0 1-3.295 3.161l-5.641.896-1.525 2.291 1.555 5.227a4.002 4.002 0 0 1-1.586 4.449l-2.8 1.901a4 4 0 0 1-4.618-.086l-4.523-3.326-2.753.56-2.638 4.784a4 4 0 0 1-4.279 1.993l-3.34-.661a4.002 4.002 0 0 1-3.174-3.298l-.886-5.598-2.298-1.514-5.273 1.564a3.999 3.999 0 0 1-4.438-1.577l-1.897-2.774a3.998 3.998 0 0 1 .09-4.641l3.338-4.499-.557-2.737-4.848-2.715a3.998 3.998 0 0 1-1.966-4.279l.669-3.329a4.002 4.002 0 0 1 3.294-3.162l5.642-.895 1.526-2.294-1.609-5.457a4.001 4.001 0 0 1 1.59-4.439l2.792-1.897a4 4 0 0 1 4.645.106l4.676 3.5 2.744-.558 2.636-4.785a4 4 0 0 1 4.281-1.992l3.339.661a4 4 0 0 1 3.174 3.298l.886 5.597 2.298 1.514 5.272-1.563a4 4 0 0 1 4.439 1.576l1.898 2.775a4.001 4.001 0 0 1-.087 4.639l-3.433 4.636.554 2.724Z"/>
</g>
<defs>
<clipPath id="right-bg-illustration-clip">
<path class="tw-fill-illustration-bg-tertiary" d="M0 0h506v297H0z"/>
</clipPath>
</defs>
</svg>
`,hJ=[[["bit-landing-header"]],"*",[["bit-landing-footer"]]],pJ=(e,t)=>({"tw-min-h-screen":e,"tw-min-h-full":t});function vJ(e,t){if(1&e&&(Fl.j41(0,"div",2),Fl.nrm(1,"bit-svg",3),Fl.k0s(),Fl.j41(2,"div",4),Fl.nrm(3,"bit-svg",3),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("content",e.leftIllustration),Fl.R7$(2),Fl.Y8G("content",e.rightIllustration)}}class fJ{constructor(){this.hideBackgroundIllustration=(0,o.hFB)(!1),this.leftIllustration=uJ,this.rightIllustration=dJ,this.platformUtilsService=(0,a.WQX)(Hb),this.clientType=this.platformUtilsService.getClientType()}}function mJ(e,t){if(1&e&&(Fl.j41(0,"div",1),Fl.nrm(1,"bit-svg",3),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("content",e.icon())}}function gJ(e,t){if(1&e&&(Fl.j41(0,"h1",4),Fl.EFF(1),Fl.k0s(),Fl.j41(2,"h1",5),Fl.EFF(3),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.SpI(" ",e.title()," "),Fl.R7$(2),Fl.SpI(" ",e.title()," ")}}function yJ(e,t){if(1&e&&(Fl.j41(0,"div",2),Fl.EFF(1),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.JRh(e.subtitle())}}function bJ(e,t){if(1&e&&(Fl.j41(0,"div",0),Fl.nVh(1,mJ,2,1,"div",1),Fl.nVh(2,gJ,4,2),Fl.nVh(3,yJ,2,1,"div",2),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.vxM(e.icon()?1:-1),Fl.R7$(),Fl.vxM(e.title()?2:-1),Fl.R7$(),Fl.vxM(e.subtitle()?3:-1)}}fJ.ɵfac=function(e){return new(e||fJ)},fJ.ɵcmp=Fl.VBU({type:fJ,selectors:[["bit-landing-layout"]],inputs:{hideBackgroundIllustration:[1,"hideBackgroundIllustration"]},ngContentSelectors:["bit-landing-header","*","bit-landing-footer"],decls:6,vars:6,consts:[[1,"tw-relative","tw-flex","tw-size-full","tw-mx-auto","tw-flex-col"],[1,"tw-relative","tw-flex","tw-flex-1","tw-size-full","tw-mx-auto","tw-flex-col"],[1,"tw-hidden","md:tw-block","[&_svg]:tw-absolute","tw-z-[1]","tw-opacity-[.11]","[&_svg]:tw-bottom-0","[&_svg]:tw-start-0","[&_svg]:tw-w-[35%]","[&_svg]:tw-max-w-[450px]"],[3,"content"],[1,"tw-hidden","md:tw-block","[&_svg]:tw-absolute","tw-z-[1]","tw-opacity-[.11]","[&_svg]:tw-bottom-0","[&_svg]:tw-end-0","[&_svg]:tw-w-[35%]","[&_svg]:tw-max-w-[450px]"]],template:function(e,t){1&e&&(Fl.NAR(hJ),Fl.j41(0,"div",0),Fl.SdG(1),Fl.j41(2,"main",1),Fl.SdG(3,1),Fl.k0s(),Fl.nVh(4,vJ,4,2),Fl.SdG(5,2),Fl.k0s()),2&e&&(Fl.HbH(Fl.l_i(3,pJ,"web"===t.clientType,"browser"===t.clientType||"desktop"===t.clientType)),Fl.R7$(4),Fl.vxM(t.hideBackgroundIllustration()?-1:4))},dependencies:[Yh,BC],encapsulation:2,changeDetection:0});class wJ{constructor(){this.icon=(0,o.hFB)(null),this.title=(0,o.hFB)(),this.subtitle=(0,o.hFB)()}}wJ.ɵfac=function(e){return new(e||wJ)},wJ.ɵcmp=Fl.VBU({type:wJ,selectors:[["bit-landing-hero"]],inputs:{icon:[1,"icon"],title:[1,"title"],subtitle:[1,"subtitle"]},decls:1,vars:1,consts:[[1,"tw-text-center","tw-mb-4","sm:tw-mb-6","tw-mx-auto"],[1,"tw-size-20","sm:tw-size-24","[&_svg]:tw-w-full","[&_svg]:tw-max-w-24","tw-mx-auto","tw-content-center"],[1,"tw-text-sm","sm:tw-text-base"],[3,"content"],["bitTypography","h2",1,"tw-mt-2","sm:tw-hidden"],["bitTypography","h1",1,"tw-mt-2","tw-hidden","sm:tw-block"]],template:function(e,t){1&e&&Fl.nVh(0,bJ,4,3,"div",0),2&e&&Fl.vxM(t.icon()||t.title()||t.subtitle()?0:-1)},dependencies:[Yh,BC,tc,rc],encapsulation:2,changeDetection:0});class SJ{}SJ.ɵfac=function(e){return new(e||SJ)},SJ.ɵcmp=Fl.VBU({type:SJ,selectors:[["bit-landing-footer"]],ngContentSelectors:["*"],decls:2,vars:0,consts:[[1,"tw-bg-background-alt","tw-text-center","tw-p-5","tw-pt-4","sm:tw-pt-6"]],template:function(e,t){1&e&&(Fl.NAR(),Fl.rj2(0,"footer",0),Fl.SdG(1),Fl.eux())},encapsulation:2,changeDetection:0});const kJ=[[["bit-landing-hero"]],"*"];class IJ{constructor(){this.maxWidth=(0,o.hFB)("md"),this.maxWidthClassMap={md:"tw-max-w-md",lg:"tw-max-w-lg",xl:"tw-max-w-xl","2xl":"tw-max-w-2xl","3xl":"tw-max-w-3xl","4xl":"tw-max-w-4xl"},this.maxWidthClasses=(0,Rl.EW)(()=>`tw-flex tw-flex-col tw-w-full ${this.maxWidthClassMap[this.maxWidth()]}`)}}IJ.ɵfac=function(e){return new(e||IJ)},IJ.ɵcmp=Fl.VBU({type:IJ,selectors:[["bit-landing-content"]],hostAttrs:[1,"tw-grow","tw-flex","tw-flex-col"],inputs:{maxWidth:[1,"maxWidth"]},ngContentSelectors:["bit-landing-hero","*"],decls:4,vars:2,consts:[[1,"tw-flex","tw-flex-col","tw-flex-1","tw-items-center","tw-bg-background-alt","tw-p-5","tw-pt-12","tw-text-main"]],template:function(e,t){1&e&&(Fl.NAR(kJ),Fl.rj2(0,"div",0)(1,"div"),Fl.SdG(2),Fl.SdG(3,1),Fl.eux()()),2&e&&(Fl.R7$(),Fl.HbH(t.maxWidthClasses()))},encapsulation:2,changeDetection:0});class CJ{}CJ.ɵfac=function(e){return new(e||CJ)},CJ.ɵcmp=Fl.VBU({type:CJ,selectors:[["bit-base-card"]],features:[Fl.nM4([Dx])],ngContentSelectors:["*"],decls:1,vars:0,template:function(e,t){1&e&&(Fl.NAR(),Fl.SdG(0))},encapsulation:2});class TJ{}TJ.ɵfac=function(e){return new(e||TJ)},TJ.ɵcmp=Fl.VBU({type:TJ,selectors:[["bit-landing-card"]],ngContentSelectors:["*"],decls:2,vars:0,consts:[[1,"tw-z-[2]","tw-relative","!tw-rounded-2xl","tw-mb-6","sm:tw-mb-10","tw-mx-auto","tw-w-full","tw-bg-transparent","tw-border-none","tw-shadow-none","sm:tw-bg-background","sm:tw-border","sm:tw-border-solid","sm:tw-border-secondary-100","sm:tw-shadow","sm:tw-p-8"]],template:function(e,t){1&e&&(Fl.NAR(),Fl.j41(0,"bit-base-card",0),Fl.SdG(1),Fl.k0s())},dependencies:[CJ],encapsulation:2,changeDetection:0});var PJ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const FJ=[[["","slot","header-actions"]],[["","slot","secondary"]],[["","slot","environment-selector"]],"*"];function RJ(e,t){1&e&&Fl.eu8(0)}function xJ(e,t){if(1&e&&(Fl.j41(0,"div",5),Fl.DNE(1,RJ,1,0,"ng-container",7),Fl.k0s()),2&e){Fl.XpG();const e=Fl.sdS(11);Fl.R7$(),Fl.Y8G("ngTemplateOutlet",e)}}function AJ(e,t){1&e&&Fl.eu8(0)}function DJ(e,t){if(1&e&&(Fl.j41(0,"bit-landing-card"),Fl.DNE(1,AJ,1,0,"ng-container",7),Fl.k0s()),2&e){Fl.XpG();const e=Fl.sdS(11);Fl.R7$(),Fl.Y8G("ngTemplateOutlet",e)}}function EJ(e,t){if(1&e&&(Fl.j41(0,"div",8),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Lme("",Fl.bMT(2,2,"accessing")," ",e.hostname)}}function $J(e,t){1&e&&Fl.SdG(0,2)}function OJ(e,t){if(1&e&&(Fl.j41(0,"div",8),Fl.EFF(1),Fl.k0s(),Fl.j41(2,"div",8),Fl.EFF(3),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.SpI("© ",e.year," Bitwarden Inc."),Fl.R7$(2),Fl.JRh(e.version)}}function UJ(e,t){if(1&e&&(Fl.j41(0,"bit-landing-footer"),Fl.nVh(1,EJ,3,4,"div",8)(2,$J,1,0),Fl.nVh(3,OJ,4,2),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.vxM(e.showReadonlyHostname()?1:2),Fl.R7$(2),Fl.vxM(e.hideYearAndVersion?-1:3)}}function MJ(e,t){1&e&&Fl.SdG(0,3)}class NJ{get classList(){return["tw-h-full"]}constructor(e,t){this.environmentService=e,this.platformUtilsService=t,this.title=(0,o.hFB)(),this.subtitle=(0,o.hFB)(),this.icon=o.geq.required(),this.showReadonlyHostname=(0,o.hFB)(!1),this.hideLogo=(0,o.hFB)(!1),this.hideFooter=(0,o.hFB)(!1),this.hideCardWrapper=(0,o.hFB)(!1),this.hideBackgroundIllustration=(0,o.hFB)(!1),this.maxWidth=(0,o.geq)("md"),this.logo=sJ,this.hideYearAndVersion=!1,this.year=(new Date).getFullYear().toString(),this.clientType=this.platformUtilsService.getClientType(),this.hideYearAndVersion=this.clientType!==Da.Web}ngOnInit(){return PJ(this,void 0,void 0,function*(){var e;this.maxWidth.set(null!==(e=this.maxWidth())&&void 0!==e?e:"md"),this.hostname=(yield(0,bo._)(this.environmentService.environment$)).getHostname(),this.version=yield this.platformUtilsService.getApplicationVersion()})}ngOnChanges(e){return PJ(this,void 0,void 0,function*(){var t;e.maxWidth&&this.maxWidth.set(null!==(t=e.maxWidth.currentValue)&&void 0!==t?t:"md")})}}NJ.ɵfac=function(e){return new(e||NJ)(Fl.rXU(mk),Fl.rXU(Hb))},NJ.ɵcmp=Fl.VBU({type:NJ,selectors:[["auth-anon-layout"]],hostVars:2,hostBindings:function(e,t){2&e&&Fl.HbH(t.classList)},inputs:{title:[1,"title"],subtitle:[1,"subtitle"],icon:[1,"icon"],showReadonlyHostname:[1,"showReadonlyHostname"],hideLogo:[1,"hideLogo"],hideFooter:[1,"hideFooter"],hideCardWrapper:[1,"hideCardWrapper"],hideBackgroundIllustration:[1,"hideBackgroundIllustration"],maxWidth:[1,"maxWidth"]},outputs:{icon:"iconChange",maxWidth:"maxWidthChange"},features:[Fl.OA$],ngContentSelectors:["[slot=header-actions]","[slot=secondary]","[slot=environment-selector]","*"],decls:12,vars:8,consts:[["defaultContent",""],[3,"hideBackgroundIllustration"],[3,"hideLogo"],[3,"maxWidth"],[3,"icon","title","subtitle"],[1,"tw-mb-6","sm:tw-mb-10"],[1,"tw-flex","tw-flex-col","tw-items-center"],[4,"ngTemplateOutlet"],["bitTypography","body2"]],template:function(e,t){1&e&&(Fl.NAR(FJ),Fl.j41(0,"bit-landing-layout",1)(1,"bit-landing-header",2),Fl.SdG(2),Fl.k0s(),Fl.j41(3,"bit-landing-content",3),Fl.nrm(4,"bit-landing-hero",4),Fl.nVh(5,xJ,2,1,"div",5)(6,DJ,2,1,"bit-landing-card"),Fl.j41(7,"div",6),Fl.SdG(8,1),Fl.k0s()(),Fl.nVh(9,UJ,4,2,"bit-landing-footer"),Fl.k0s(),Fl.DNE(10,MJ,1,0,"ng-template",null,0,Fl.C5r)),2&e&&(Fl.Y8G("hideBackgroundIllustration",t.hideBackgroundIllustration()),Fl.R7$(),Fl.Y8G("hideLogo",t.hideLogo()),Fl.R7$(2),Fl.Y8G("maxWidth",t.maxWidth()),Fl.R7$(),Fl.Y8G("icon",t.icon())("title",t.title())("subtitle",t.subtitle()),Fl.R7$(),Fl.vxM(t.hideCardWrapper()?5:6),Fl.R7$(4),Fl.vxM(t.hideFooter()?-1:9))},dependencies:[Yh,kl.MD,kl.T3,tc,rc,ec,Cw.iI,cJ,fJ,lJ,wJ,SJ,IJ,TJ,sc],encapsulation:2});class VJ{constructor(e,t,i,n,r){this.router=e,this.route=t,this.i18nService=i,this.anonLayoutWrapperDataService=n,this.changeDetectorRef=r,this.destroy$=new Co.B,this.pageIcon=null,this.destroyRef=(0,a.WQX)(a.abz)}ngOnInit(){var e;this.setAnonLayoutWrapperDataFromRouteData(null===(e=this.route.snapshot.firstChild)||void 0===e?void 0:e.data),this.listenForPageDataChanges(),this.listenForServiceDataChanges()}listenForPageDataChanges(){this.router.events.pipe((0,Eo.p)(e=>e instanceof Fd.wF),(0,Oo.M)(()=>this.resetPageData()),(0,go.n)(()=>{var e;return(null===(e=this.route.firstChild)||void 0===e?void 0:e.data)||(0,Go.of)(null)}),(0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.setAnonLayoutWrapperDataFromRouteData(e)})}setAnonLayoutWrapperDataFromRouteData(e){e&&(void 0!==e.pageTitle&&(this.pageTitle=this.handleStringOrTranslation(e.pageTitle)),void 0!==e.pageSubtitle&&(this.pageSubtitle=this.handleStringOrTranslation(e.pageSubtitle)),void 0!==e.pageIcon&&(this.pageIcon=e.pageIcon),this.showReadonlyHostname=Boolean(e.showReadonlyHostname),this.maxWidth=e.maxWidth,this.hideCardWrapper=Boolean(e.hideCardWrapper),this.hideBackgroundIllustration=Boolean(e.hideBackgroundIllustration))}listenForServiceDataChanges(){this.anonLayoutWrapperDataService.anonLayoutWrapperData$().pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.setAnonLayoutWrapperData(e)})}setAnonLayoutWrapperData(e){e&&(void 0!==e.pageTitle&&(this.pageTitle=null!==e.pageTitle?this.handleStringOrTranslation(e.pageTitle):null),void 0!==e.pageSubtitle&&(this.pageSubtitle=null!==e.pageSubtitle?this.handleStringOrTranslation(e.pageSubtitle):null),void 0!==e.pageIcon&&(this.pageIcon=null!==e.pageIcon?e.pageIcon:null),void 0!==e.showReadonlyHostname&&(this.showReadonlyHostname=e.showReadonlyHostname),void 0!==e.hideCardWrapper&&(this.hideCardWrapper=e.hideCardWrapper),void 0!==e.hideBackgroundIllustration&&(this.hideBackgroundIllustration=e.hideBackgroundIllustration),void 0!==e.maxWidth&&(this.maxWidth=e.maxWidth),this.changeDetectorRef.detectChanges())}handleStringOrTranslation(e){var t;return"string"==typeof e?e:this.i18nService.t(e.key,...null!==(t=e.placeholders)&&void 0!==t?t:[])}resetPageData(){this.pageTitle=null,this.pageSubtitle=null,this.pageIcon=null,this.showReadonlyHostname=null,this.maxWidth=null,this.hideCardWrapper=null,this.hideBackgroundIllustration=null}}VJ.ɵfac=function(e){return new(e||VJ)(Fl.rXU(Fd.Ix),Fl.rXU(Fd.nX),Fl.rXU(Ul),Fl.rXU(Ck),Fl.rXU(o.gRc))},VJ.ɵcmp=Fl.VBU({type:VJ,selectors:[["ng-component"]],decls:5,vars:7,consts:[[3,"title","subtitle","icon","showReadonlyHostname","maxWidth","hideCardWrapper","hideBackgroundIllustration"],["slot","header-actions","name","header-actions"],["slot","secondary","name","secondary"],["slot","environment-selector","name","environment-selector"]],template:function(e,t){1&e&&(Fl.j41(0,"auth-anon-layout",0),Fl.nrm(1,"router-outlet",1)(2,"router-outlet")(3,"router-outlet",2)(4,"router-outlet",3),Fl.k0s()),2&e&&Fl.Y8G("title",t.pageTitle)("subtitle",t.pageSubtitle)("icon",t.pageIcon)("showReadonlyHostname",t.showReadonlyHostname)("maxWidth",t.maxWidth)("hideCardWrapper",t.hideCardWrapper)("hideBackgroundIllustration",t.hideBackgroundIllustration)},dependencies:[NJ,Cw.iI,Fd.n3],encapsulation:2});var BJ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const jJ=e=>({"tw-mb-6":e});function GJ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"div",8),Fl.nI1(1,"async"),Fl.j41(2,"auth-account",9),Fl.bIt("loading",function(t){a.eBV(e);const i=Fl.XpG(3);return a.Njj(i.loading=t)}),Fl.k0s()()}if(2&e){const e=Fl.XpG().$implicit,t=Fl.XpG(2);Fl.Y8G("ngClass",Fl.eq3(4,jJ,Fl.bMT(1,2,t.enableAccountSwitching$))),Fl.R7$(2),Fl.Y8G("account",e)}}function LJ(e,t){1&e&&(Fl.j41(0,"bit-section-header")(1,"h2",10),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()()),2&e&&(Fl.R7$(2),Fl.JRh(Fl.bMT(3,1,"availableAccounts")))}function zJ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"div")(1,"auth-account",9),Fl.bIt("loading",function(t){a.eBV(e);const i=Fl.XpG(4);return a.Njj(i.loading=t)}),Fl.k0s()()}if(2&e){const e=Fl.XpG(2).$implicit;Fl.R7$(),Fl.Y8G("account",e)}}function _J(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,LJ,4,3,"bit-section-header",3)(2,zJ,2,1,"div",3),Fl.bVm()),2&e){const e=Fl.XpG(),t=e.$implicit,i=e.first;Fl.R7$(),Fl.Y8G("ngIf",i),Fl.R7$(),Fl.Y8G("ngIf",!t.isActive)}}function KJ(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,GJ,3,6,"div",7)(2,_J,3,2,"ng-container",3),Fl.nI1(3,"async"),Fl.bVm()),2&e){const e=t.$implicit,i=Fl.XpG(2);Fl.R7$(),Fl.Y8G("ngIf",e.isActive),Fl.R7$(),Fl.Y8G("ngIf",Fl.bMT(3,2,i.enableAccountSwitching$))}}function XJ(e,t){1&e&&(Fl.j41(0,"p",11),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"accountLimitReached")," "))}function qJ(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"bit-section",4),Fl.nI1(2,"async"),Fl.DNE(3,KJ,4,4,"ng-container",5)(4,XJ,3,3,"p",6),Fl.k0s(),Fl.bVm()),2&e){const e=t.ngIf,i=Fl.XpG();Fl.R7$(),Fl.Y8G("disableMargin",!Fl.bMT(2,3,i.enableAccountSwitching$)),Fl.R7$(2),Fl.Y8G("ngForOf",e),Fl.R7$(),Fl.Y8G("ngIf",e.length>=i.accountLimit&&e[e.length-1].id!==i.specialAddAccountId)}}function WJ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-item")(1,"button",14),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.lockAll())}),Fl.nrm(2,"i",13),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()()}2&e&&(Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,1,"lockAll")," "))}function YJ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"div")(1,"bit-section")(2,"bit-section-header")(3,"h2",10),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()(),Fl.j41(6,"bit-item")(7,"button",12),Fl.nI1(8,"i18n"),Fl.bIt("click",function(){const t=a.eBV(e).ngIf,i=Fl.XpG();return a.Njj(i.lock(t.id))}),Fl.nrm(9,"i",13),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s()(),Fl.j41(12,"bit-item")(13,"button",14),Fl.bIt("click",function(){const t=a.eBV(e).ngIf,i=Fl.XpG();return a.Njj(i.logOut(t.id))}),Fl.nrm(14,"i",15),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s()(),Fl.DNE(17,WJ,5,3,"bit-item",3),Fl.nI1(18,"async"),Fl.k0s()()}if(2&e){const e=t.ngIf,i=Fl.XpG();Fl.R7$(4),Fl.JRh(Fl.bMT(5,6,"options")),Fl.R7$(3),Fl.Y8G("disabled",e.status===i.lockedStatus||!i.activeUserCanLock)("title",i.activeUserCanLock?"":Fl.bMT(8,8,"unlockMethodNeeded")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(11,10,"lockNow")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(16,12,"logOut")," "),Fl.R7$(2),Fl.Y8G("ngIf",Fl.bMT(18,14,i.showLockAll$))}}class HJ{constructor(e,t,i,n,r,s,o,a,c,u){this.accountSwitcherService=e,this.accountService=t,this.vaultTimeoutService=i,this.dialogService=n,this.location=r,this.router=s,this.vaultTimeoutSettingsService=o,this.authService=a,this.lockService=c,this.logoutService=u,this.lockedStatus=Pd.Locked,this.destroy$=new Co.B,this.loading=!1,this.activeUserCanLock=!1,this.availableAccounts$=this.accountSwitcherService.availableAccounts$,this.currentAccount$=this.accountService.activeAccount$.pipe((0,go.n)(e=>null==e?(0,Go.of)(null):this.authService.activeAccountStatus$.pipe((0,l.T)(t=>Object.assign(Object.assign({},e),{status:t}))))),this.showLockAll$=this.availableAccounts$.pipe((0,kd.Z)([]),(0,l.T)(e=>e.filter(e=>!e.isActive)),(0,go.n)(e=>this.accountSwitcherService.accountSwitchingEnabled$().pipe((0,go.n)(t=>t?(0,Go.of)(e.length>1):(0,Go.of)(!1))))),this.enableAccountSwitching$=this.accountSwitcherService.accountSwitchingEnabled$()}get accountLimit(){return this.accountSwitcherService.ACCOUNT_LIMIT}get specialAddAccountId(){return this.accountSwitcherService.SPECIAL_ADD_ACCOUNT_ID}ngOnInit(){return BJ(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.vaultTimeoutSettingsService.availableVaultTimeoutActions$());this.activeUserCanLock=e.includes(pv.Lock)})}back(){this.location.back()}lock(e){return BJ(this,void 0,void 0,function*(){this.loading=!0,yield this.lockService.lock(e),yield this.router.navigate(["lock"])})}lockAll(){return BJ(this,void 0,void 0,function*(){this.loading=!0,yield this.lockService.lockAll(),yield this.router.navigate(["lock"])})}logOut(e){return BJ(this,void 0,void 0,function*(){this.loading=!0;(yield this.dialogService.openSimpleDialog({title:{key:"logOut"},content:{key:"logOutConfirmation"},type:"info"}))&&(yield this.logoutService.logout(e),yield this.router.navigate(["/"])),this.loading=!1})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}}HJ.ɵfac=function(e){return new(e||HJ)(Fl.rXU(EF),Fl.rXU(Zk),Fl.rXU(Fv),Fl.rXU(lh),Fl.rXU(IF.aZ),Fl.rXU(Fd.Ix),Fl.rXU(qp),Fl.rXU(Rd),Fl.rXU(ck),Fl.rXU(Nw))},HJ.ɵcmp=Fl.VBU({type:HJ,selectors:[["ng-component"]],decls:10,vars:11,consts:[[3,"loading"],["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[4,"ngIf"],[3,"disableMargin"],[4,"ngFor","ngForOf"],["class","tw-text-sm tw-text-muted",4,"ngIf"],[3,"ngClass",4,"ngIf"],[3,"ngClass"],[3,"loading","account"],["bitTypography","h6"],[1,"tw-text-sm","tw-text-muted"],["type","button","bit-item-content","",3,"click","disabled","title"],["slot","start","aria-hidden","true",1,"bwi","bwi-lock","tw-text-lg","tw-text-main"],["type","button","bit-item-content","",3,"click"],["slot","start","aria-hidden","true",1,"bwi","bwi-sign-out","tw-text-lg","tw-text-main"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page",0)(1,"popup-header",1),Fl.nI1(2,"i18n"),Fl.qex(3,2),Fl.nrm(4,"app-pop-out")(5,"app-current-account"),Fl.bVm(),Fl.k0s(),Fl.DNE(6,qJ,5,5,"ng-container",3),Fl.nI1(7,"async"),Fl.DNE(8,YJ,19,16,"div",3),Fl.nI1(9,"async"),Fl.k0s()),2&e&&(Fl.Y8G("loading",t.loading),Fl.R7$(),Fl.Y8G("pageTitle",Fl.mNQ(Fl.bMT(2,5,"accountActions"))),Fl.R7$(5),Fl.Y8G("ngIf",Fl.bMT(7,7,t.availableAccounts$)),Fl.R7$(2),Fl.Y8G("ngIf",Fl.bMT(9,9,t.currentAccount$)))},dependencies:[kl.MD,kl.YU,kl.Sq,kl.bT,sf,id,VP,GP,KP,RF,tE,aE,GD,_F,jF,Ux,Nx,tc,rc,kl.Jj,rf],encapsulation:2});const JJ=Object.freeze({AccountSecurity:"account-security",DeviceManagement:"device-management",AccountSwitcher:"account-switcher"});class ZJ{constructor(e){this.previousUrl=void 0,e.events.pipe((0,Eo.p)(e=>e instanceof Fd.wF)).subscribe(t=>{var i;let n=e.routerState.snapshot.root.firstChild;for(;n.firstChild;)n=n.firstChild;!(null===(i=null==n?void 0:n.data)||void 0===i?void 0:i.doNotSaveUrl)&&this.setPreviousUrl(t.url)})}getPreviousUrl(){return this.previousUrl}setPreviousUrl(e){this.previousUrl=e}}ZJ.ɵfac=function(e){return new(e||ZJ)(a.KVO(Fd.Ix))},ZJ.ɵprov=a.jDH({token:ZJ,factory:ZJ.ɵfac,providedIn:"root"});var QJ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var eZ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var tZ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const iZ=m.array(E,"pendingAuthRequests",{deserializer:e=>e});class nZ{constructor(e){this.stateProvider=e,this.state=this.stateProvider.getGlobal(iZ)}getAll$(){return this.state.state$}add(e){return tZ(this,void 0,void 0,function*(){const t=Date.now();yield this.stateProvider.getGlobal(iZ).update(i=>[...(null!=i?i:[]).filter(t=>t.userId!==e),{userId:e,receivedAtMs:t}])})}pruneOlderThan(e){return tZ(this,void 0,void 0,function*(){const t=Date.now()-e;yield this.stateProvider.getGlobal(iZ).update(e=>(null!=e?e:[]).filter(e=>e.receivedAtMs>=t))})}clear(e){return tZ(this,void 0,void 0,function*(){yield this.stateProvider.getGlobal(iZ).update(t=>(null!=t?t:[]).filter(t=>t.userId!==e))})}}class rZ{}var sZ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function oZ(e,t){1&e&&(Fl.j41(0,"div",7),Fl.nrm(1,"i",8),Fl.k0s())}function aZ(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,oZ,2,0,"div",6),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("ngIf",e.loading)}}function lZ(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"p"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"div")(5,"span",9),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s(),Fl.j41(8,"p",10),Fl.EFF(9),Fl.k0s()(),Fl.j41(10,"div")(11,"span",9),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s(),Fl.j41(14,"p"),Fl.EFF(15),Fl.k0s()(),Fl.j41(16,"div")(17,"span",9),Fl.EFF(18),Fl.nI1(19,"i18n"),Fl.k0s(),Fl.j41(20,"p")(21,"span",11),Fl.EFF(22),Fl.k0s(),Fl.EFF(23),Fl.k0s()(),Fl.j41(24,"div")(25,"span",9),Fl.EFF(26),Fl.nI1(27,"i18n"),Fl.k0s(),Fl.j41(28,"p"),Fl.EFF(29),Fl.k0s()(),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.JRh(Fl.i5U(3,10,"accessAttemptBy",e.email)),Fl.R7$(4),Fl.JRh(Fl.bMT(7,13,"fingerprintPhraseHeader")),Fl.R7$(3),Fl.JRh(e.fingerprintPhrase),Fl.R7$(3),Fl.JRh(Fl.bMT(13,15,"deviceType")),Fl.R7$(3),Fl.JRh(e.readableDeviceTypeName),Fl.R7$(3),Fl.JRh(Fl.bMT(19,17,"location")),Fl.R7$(4),Fl.SpI("",null==e.authRequestResponse?null:e.authRequestResponse.requestCountryName," "),Fl.R7$(),Fl.SpI(" (",null==e.authRequestResponse?null:e.authRequestResponse.requestIpAddress,") "),Fl.R7$(3),Fl.JRh(Fl.bMT(27,19,"time")),Fl.R7$(3),Fl.JRh(e.requestTimeText)}}const cZ=3e5;class uZ{constructor(e,t,i,n,r,s,o,a,l,c){this.params=e,this.accountService=t,this.apiService=i,this.authRequestService=n,this.devicesService=r,this.dialogRef=s,this.i18nService=o,this.logService=a,this.toastService=l,this.validationService=c,this.loading=!0,this.denyLogin=()=>sZ(this,void 0,void 0,function*(){yield this.retrieveAuthRequestAndRespond(!1)}),this.approveLogin=()=>sZ(this,void 0,void 0,function*(){yield this.retrieveAuthRequestAndRespond(!0)}),this.authRequestId=e.notificationId}ngOnDestroy(){return sZ(this,void 0,void 0,function*(){clearInterval(this.interval)})}ngOnInit(){return sZ(this,void 0,void 0,function*(){if(null==this.authRequestId)return void this.logService.error("LoginApprovalDialogComponent: authRequestId is null");try{this.authRequestResponse=yield this.apiService.getAuthRequest(this.authRequestId)}catch(e){this.validationService.showError(e),this.logService.error("LoginApprovalDialogComponent: getAuthRequest error",e)}if(null==this.authRequestResponse)return void this.logService.error("LoginApprovalDialogComponent: authRequestResponse not found");const e=bd.fromB64ToArray(this.authRequestResponse.publicKey);this.email=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.email))),this.email?(this.fingerprintPhrase=yield this.authRequestService.getFingerprintPhrase(this.email,e),this.readableDeviceTypeName=this.devicesService.getReadableDeviceTypeName(this.authRequestResponse.requestDeviceTypeValue),this.updateTimeText(),this.interval=setInterval(()=>{this.updateTimeText()},cZ),this.loading=!1):this.logService.error("LoginApprovalDialogComponent: email not found")})}static open(e,t){return e.open(uZ,{data:t})}retrieveAuthRequestAndRespond(e){return sZ(this,void 0,void 0,function*(){if(this.authRequestResponse=yield this.apiService.getAuthRequest(this.authRequestId),this.authRequestResponse.requestApproved||null!=this.authRequestResponse.responseDate)this.toastService.showToast({variant:"info",message:this.i18nService.t("thisRequestIsNoLongerValid")});else{const t=yield this.authRequestService.approveOrDenyAuthRequest(e,this.authRequestResponse);this.showResultToast(t)}this.dialogRef.close(e)})}showResultToast(e){e.requestApproved?this.toastService.showToast({variant:"success",message:this.i18nService.t("loginRequestApprovedForEmailOnDevice",this.email,this.devicesService.getReadableDeviceTypeName(e.requestDeviceTypeValue))}):this.toastService.showToast({variant:"info",message:this.i18nService.t("youDeniedLoginAttemptFromAnotherDevice")})}updateTimeText(){if(null==this.authRequestResponse)return void this.logService.error("LoginApprovalDialogComponent: authRequestResponse not found");const e=new Date(this.authRequestResponse.creationDate),t=Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),i=new Date(Date.now()),n=Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),i.getDate(),i.getUTCHours(),i.getUTCMinutes(),i.getUTCSeconds(),i.getUTCMilliseconds())-t;n<=cZ?this.requestTimeText=this.i18nService.t("justNow"):n<9e5?this.requestTimeText=this.i18nService.t("requestedXMinutesAgo",(n/6e4).toFixed()):(clearInterval(this.interval),this.dialogRef.close(),this.toastService.showToast({variant:"info",message:this.i18nService.t("loginRequestHasAlreadyExpired")}))}}function dZ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",3),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG().$implicit,i=Fl.XpG();return a.Njj(i.answerAuthRequest(t.pendingAuthRequest))}),Fl.j41(1,"span",4),Fl.EFF(2),Fl.k0s(),Fl.j41(3,"span",5)(4,"span",6),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s()(),Fl.j41(7,"span",7),Fl.nrm(8,"br"),Fl.j41(9,"div")(10,"span",8),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s(),Fl.j41(13,"span"),Fl.EFF(14),Fl.nI1(15,"date"),Fl.k0s()()()()}if(2&e){const e=Fl.XpG().$implicit;Fl.BMQ("tabindex",null!=e.pendingAuthRequest?0:null),Fl.R7$(2),Fl.JRh(e.displayName),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(6,5,"requestPending")," "),Fl.R7$(6),Fl.SpI(" ",Fl.bMT(12,7,"firstLogin"),": "),Fl.R7$(3),Fl.JRh(Fl.i5U(15,9,e.firstLogin,"medium"))}}function hZ(e,t){1&e&&(Fl.j41(0,"div",5)(1,"span",10),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()()),2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"currentSession")," "))}function pZ(e,t){1&e&&(Fl.j41(0,"span"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.JRh(Fl.bMT(2,1,"trusted")))}function vZ(e,t){1&e&&Fl.nrm(0,"br")}function fZ(e,t){if(1&e&&(Fl.j41(0,"bit-item-content",2)(1,"span",4),Fl.EFF(2),Fl.k0s(),Fl.DNE(3,hZ,4,3,"div",9),Fl.j41(4,"div",7),Fl.nVh(5,pZ,3,3,"span")(6,vZ,1,0,"br"),Fl.j41(7,"div")(8,"span",8),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s(),Fl.j41(11,"span"),Fl.EFF(12),Fl.nI1(13,"date"),Fl.k0s()()()()),2&e){const e=Fl.XpG().$implicit;Fl.R7$(2),Fl.JRh(e.displayName),Fl.R7$(),Fl.Y8G("ngIf",e.isCurrentDevice),Fl.R7$(2),Fl.vxM(e.isTrusted?5:6),Fl.R7$(4),Fl.SpI("",Fl.bMT(10,5,"firstLogin"),": "),Fl.R7$(3),Fl.JRh(Fl.i5U(13,7,e.firstLogin,"medium"))}}function mZ(e,t){if(1&e&&(Fl.j41(0,"bit-item"),Fl.nVh(1,dZ,16,12,"button",1)(2,fZ,14,10,"bit-item-content",2),Fl.k0s()),2&e){const e=t.$implicit;Fl.R7$(),Fl.vxM(e.pendingAuthRequest?1:2)}}uZ.ɵfac=function(e){return new(e||uZ)(Fl.rXU(pd.Qs),Fl.rXU(Zk),Fl.rXU(eI),Fl.rXU(Uw),Fl.rXU(rZ),Fl.rXU(nh),Fl.rXU(Ul),Fl.rXU(Za),Fl.rXU(qb),Fl.rXU(Ud))},uZ.ɵcmp=Fl.VBU({type:uZ,selectors:[["ng-component"]],decls:14,vars:15,consts:[["bitDialogTitle",""],["bitDialogContent",""],[4,"ngIf"],["bitDialogFooter",""],["bitButton","","type","button","buttonType","primary",3,"bitAction","disabled"],["bitButton","","type","button","buttonType","secondary",3,"bitAction","disabled"],["class","tw-flex tw-items-center tw-justify-center",4,"ngIf"],[1,"tw-flex","tw-items-center","tw-justify-center"],["aria-hidden","true",1,"bwi","bwi-spinner","bwi-spin","bwi-3x"],[1,"tw-font-medium"],[1,"tw-text-code"],[1,"tw-capitalize"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-dialog")(1,"span",0),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.qex(4,1),Fl.DNE(5,aZ,2,1,"ng-container",2)(6,lZ,30,21,"ng-container",2),Fl.bVm(),Fl.qex(7,3),Fl.j41(8,"button",4),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s(),Fl.j41(11,"button",5),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e&&(Fl.R7$(2),Fl.JRh(Fl.bMT(3,9,"loginRequest")),Fl.R7$(3),Fl.Y8G("ngIf",t.loading),Fl.R7$(),Fl.Y8G("ngIf",!t.loading),Fl.R7$(2),Fl.Y8G("bitAction",t.approveLogin)("disabled",t.loading),Fl.R7$(),Fl.SpI(" ",Fl.bMT(10,11,"confirmAccess")," "),Fl.R7$(2),Fl.Y8G("bitAction",t.denyLogin)("disabled",t.loading),Fl.R7$(),Fl.SpI(" ",Fl.bMT(13,13,"denyAccess")," "))},dependencies:[pc,Bd,id,td,kl.MD,kl.bT,Fh,Ph,sf,rf],encapsulation:2});class gZ{constructor(){this.devices=[],this.onAuthRequestAnswered=new Fl.bkB}answerAuthRequest(e){null!=e&&this.onAuthRequestAnswered.emit(e)}}gZ.ɵfac=function(e){return new(e||gZ)},gZ.ɵcmp=Fl.VBU({type:gZ,selectors:[["auth-device-management-item-group"]],inputs:{devices:"devices"},outputs:{onAuthRequestAnswered:"onAuthRequestAnswered"},decls:2,vars:1,consts:[[4,"ngFor","ngForOf"],["bit-item-content","","type","button",1,"tw-relative"],["ngClass","tw-relative"],["bit-item-content","","type","button",1,"tw-relative",3,"click"],[1,"tw-text-base"],["slot","default-trailing",1,"tw-absolute","tw-top-[6px]","tw-right-3"],["bitBadge","","variant","warning"],["slot","secondary",1,"tw-text-sm"],[1,"tw-font-medium"],["class","tw-absolute tw-top-[6px] tw-right-3","slot","default-trailing",4,"ngIf"],["bitBadge","","variant","primary"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-item-group"),Fl.DNE(1,mZ,3,1,"bit-item",0),Fl.k0s()),2&e&&(Fl.R7$(),Fl.Y8G("ngForOf",t.devices))},dependencies:[eu,Qc,kl.MD,kl.YU,kl.Sq,kl.bT,VP,GP,KP,XP,kl.vh,sc],encapsulation:2});class yZ{constructor(e){this.table=e,this.bitSortable=o.hFB.required(),this.default=(0,o.hFB)(!1,{transform:e=>"desc"===e||"asc"===e?e:!!(0,$x.he)(e)&&"asc"}),this.fn=(0,o.hFB)()}ngOnInit(){this.default()&&!this.isActive&&this.setActive()}get ariaSort(){var e;if(this.isActive)return"asc"===(null===(e=this.sort)||void 0===e?void 0:e.direction)?"ascending":"descending"}setActive(){const e=this.table.dataSource();if(e){const t="desc"===this.default()?"desc":"asc",i=this.isActive?"asc"===this.direction?"desc":"asc":t;e.sort={column:this.bitSortable(),direction:i,fn:this.fn()}}}get sort(){var e;return null===(e=this.table.dataSource())||void 0===e?void 0:e.sort}get isActive(){var e;return(null===(e=this.sort)||void 0===e?void 0:e.column)===this.bitSortable()}get direction(){var e;return null===(e=this.sort)||void 0===e?void 0:e.direction}get icon(){return this.isActive?"asc"===this.direction?"bwi-up-solid":"bwi-down-solid":"bwi-up-down-btn"}get classList(){return["tw-min-w-max","tw-font-medium","tw-border","tw-border-solid","tw-rounded","tw-transition","hover:tw-no-underline","focus:tw-outline-none","tw-bg-transparent","!tw-text-muted","tw-border-transparent","hover:tw-bg-transparent-hover","hover:tw-border-primary-700","focus-visible:before:tw-ring-primary-700","disabled:tw-opacity-60","disabled:hover:tw-border-transparent","disabled:hover:tw-bg-transparent","tw-relative","before:tw-content-['']","before:tw-block","before:tw-absolute","before:-tw-inset-[3px]","before:tw-rounded-md","before:tw-transition","before:tw-ring","before:tw-ring-transparent","focus-visible:tw-z-10"]}}function bZ(e,t){if(1&e&&(Fl.j41(0,"th",4),Fl.EFF(1),Fl.k0s()),2&e){const e=t.$implicit;Fl.HbH(e.headerClass),Fl.Y8G("bitSortable",e.sortable?e.name:""),Fl.R7$(),Fl.SpI(" ",e.title," ")}}function wZ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"a",12),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG().$implicit,i=Fl.XpG();return a.Njj(i.answerAuthRequest(t.pendingAuthRequest))}),Fl.EFF(1),Fl.k0s(),Fl.nrm(2,"br")}if(2&e){const e=Fl.XpG().$implicit;Fl.R7$(),Fl.SpI(" ",e.displayName," ")}}function SZ(e,t){1&e&&(Fl.j41(0,"div",14),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"trusted")," "))}function kZ(e,t){if(1&e&&(Fl.j41(0,"span"),Fl.EFF(1),Fl.k0s(),Fl.DNE(2,SZ,3,3,"div",13)),2&e){const e=Fl.XpG().$implicit;Fl.R7$(),Fl.JRh(e.displayName),Fl.R7$(),Fl.Y8G("ngIf",e.isTrusted)}}function IZ(e,t){1&e&&(Fl.j41(0,"span",15),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"currentSession")," "))}function CZ(e,t){1&e&&(Fl.j41(0,"span",16),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"requestPending")," "))}function TZ(e,t){if(1&e&&(Fl.j41(0,"td",5)(1,"div",6),Fl.nrm(2,"i",7),Fl.k0s(),Fl.j41(3,"div"),Fl.nVh(4,wZ,3,1)(5,kZ,3,2),Fl.k0s()(),Fl.j41(6,"td",8)(7,"div",9),Fl.DNE(8,IZ,3,3,"span",10)(9,CZ,3,3,"span",11),Fl.k0s()(),Fl.j41(10,"td",8),Fl.EFF(11),Fl.nI1(12,"date"),Fl.k0s()),2&e){const e=t.$implicit;Fl.R7$(2),Fl.HbH(e.icon),Fl.R7$(2),Fl.vxM(e.pendingAuthRequest?4:5),Fl.R7$(4),Fl.Y8G("ngIf",e.isCurrentDevice),Fl.R7$(),Fl.Y8G("ngIf",e.pendingAuthRequest),Fl.R7$(2),Fl.JRh(Fl.i5U(12,6,e.firstLogin,"medium"))}}yZ.ɵfac=function(e){return new(e||yZ)(Fl.rXU(Vh))},yZ.ɵcmp=Fl.VBU({type:yZ,selectors:[["th","bitSortable",""]],hostVars:1,hostBindings:function(e,t){2&e&&Fl.BMQ("aria-sort",t.ariaSort)},inputs:{bitSortable:[1,"bitSortable"],default:[1,"default"],fn:[1,"fn"]},attrs:["bitSortable",""],ngContentSelectors:["*"],decls:3,vars:3,consts:[["type","button",3,"click","ngClass"],[1,"bwi","tw-ms-2",3,"ngClass"]],template:function(e,t){1&e&&(Fl.NAR(),Fl.j41(0,"button",0),Fl.bIt("click",function(){return t.setActive()}),Fl.SdG(1),Fl.nrm(2,"i",1),Fl.k0s()),2&e&&(Fl.Y8G("ngClass",t.classList),Fl.BMQ("aria-pressed",t.isActive),Fl.R7$(2),Fl.Y8G("ngClass",t.icon))},dependencies:[kl.YU],encapsulation:2});class PZ{constructor(e){this.i18nService=e,this.devices=[],this.onAuthRequestAnswered=new Fl.bkB,this.tableDataSource=new Az,this.columnConfig=[{name:"displayName",title:this.i18nService.t("device"),headerClass:"tw-w-1/3",sortable:!0},{name:"loginStatus",title:this.i18nService.t("loginStatus"),headerClass:"tw-w-1/3",sortable:!0},{name:"firstLogin",title:this.i18nService.t("firstLogin"),headerClass:"tw-w-1/3",sortable:!0}]}ngOnChanges(e){e.devices&&(this.tableDataSource.data=this.devices)}answerAuthRequest(e){null!=e&&this.onAuthRequestAnswered.emit(e)}}function FZ(e,t){return e.pendingAuthRequest?-1:t.pendingAuthRequest?1:e.isCurrentDevice?-1:t.isCurrentDevice?1:e.creationDate>t.creationDate?-1:e.creationDate<t.creationDate?1:0}PZ.ɵfac=function(e){return new(e||PZ)(Fl.rXU(Ul))},PZ.ɵcmp=Fl.VBU({type:PZ,selectors:[["auth-device-management-table"]],inputs:{devices:"devices"},outputs:{onAuthRequestAnswered:"onAuthRequestAnswered"},features:[Fl.OA$],decls:4,vars:3,consts:[[3,"dataSource","rowSize"],["header",""],["bitCell","","scope","col","role","columnheader",3,"class","bitSortable",4,"ngFor","ngForOf"],["bitRowDef",""],["bitCell","","scope","col","role","columnheader",3,"bitSortable"],["bitCell","",1,"tw-flex","tw-gap-2","tw-items-center","tw-h-16"],[1,"tw-flex","tw-items-center","tw-justify-center","tw-w-10"],["aria-hidden","true",1,"bwi-lg"],["bitCell",""],[1,"tw-flex","tw-gap-1"],["bitBadge","","variant","primary",4,"ngIf"],["bitBadge","","variant","warning",4,"ngIf"],["bitLink","","href","#","appStopClick","",3,"click"],["class","tw-text-sm tw-text-muted",4,"ngIf"],[1,"tw-text-sm","tw-text-muted"],["bitBadge","","variant","primary"],["bitBadge","","variant","warning"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-table-scroll",0),Fl.qex(1,1),Fl.DNE(2,bZ,2,4,"th",2),Fl.bVm(),Fl.DNE(3,TZ,13,9,"ng-template",3),Fl.k0s()),2&e&&(Fl.Y8G("dataSource",t.tableDataSource)("rowSize",64),Fl.R7$(2),Fl.Y8G("ngForOf",t.columnConfig))},dependencies:[eu,Qc,id,kl.MD,kl.Sq,kl.bT,sf,IP,Hh,uw,Xh,_h,Dz,yZ,Kh,kl.vh,rf],encapsulation:2});class RZ{}var xZ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function AZ(e,t){if(1&e&&(Fl.j41(0,"div",3)(1,"div",4)(2,"h1",5),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"button",6),Fl.nrm(6,"i",7),Fl.k0s(),Fl.j41(7,"bit-popover",8,0),Fl.nI1(9,"i18n"),Fl.j41(10,"p",9),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s()()(),Fl.j41(13,"p"),Fl.EFF(14),Fl.nI1(15,"i18n"),Fl.k0s()()),2&e){const e=Fl.sdS(8);Fl.R7$(3),Fl.JRh(Fl.bMT(4,5,"devices")),Fl.R7$(2),Fl.Y8G("bitPopoverTriggerFor",e),Fl.R7$(2),Fl.Y8G("title",Fl.bMT(9,7,"whatIsADevice")),Fl.R7$(4),Fl.JRh(Fl.bMT(12,9,"aDeviceIs")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(15,11,"deviceListDescriptionTemp")," ")}}function DZ(e,t){1&e&&(Fl.j41(0,"div",2),Fl.nrm(1,"i",10),Fl.k0s())}function EZ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"auth-device-management-table",11),Fl.bIt("onAuthRequestAnswered",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.handleAuthRequestAnswered(t))}),Fl.k0s(),Fl.j41(1,"auth-device-management-item-group",12),Fl.bIt("onAuthRequestAnswered",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.handleAuthRequestAnswered(t))}),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.Y8G("devices",e.devices),Fl.R7$(),Fl.Y8G("devices",e.devices)}}class $Z{constructor(e,t,i,n,r,s,o,a,l,c){this.accountService=e,this.authRequestApiService=t,this.destroyRef=i,this.deviceManagementComponentService=n,this.devicesService=r,this.dialogService=s,this.i18nService=o,this.messageListener=a,this.pendingAuthRequestStateService=l,this.validationService=c,this.devices=[],this.initializing=!0,this.showHeaderInfo=!1,this.showHeaderInfo=this.deviceManagementComponentService.showHeaderInformation()}ngOnInit(){return xZ(this,void 0,void 0,function*(){yield this.loadDevices(),this.messageListener.allMessages$.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{"openLoginApproval"===e.command&&e.notificationId&&"string"==typeof e.notificationId&&this.upsertDeviceWithPendingAuthRequest(e.notificationId)})})}loadDevices(){return xZ(this,void 0,void 0,function*(){try{const e=yield(0,bo._)(this.devicesService.getDevices$()),t=yield(0,bo._)(this.devicesService.getCurrentDevice$());if(!e||!t)return;this.devices=this.mapDevicesToDisplayData(e,t)}catch(e){this.validationService.showError(e)}finally{this.initializing=!1}})}mapDevicesToDisplayData(e,t){return e.map(e=>{var i,n,r,s,o;return e.id?null==e.type?(this.validationService.showError(new Error(this.i18nService.t("deviceTypeMissing"))),null):e.creationDate?{creationDate:e.creationDate,displayName:this.devicesService.getReadableDeviceTypeName(e.type),firstLogin:e.creationDate?new Date(e.creationDate):new Date,icon:this.getDeviceIcon(e.type),id:e.id||"",identifier:null!==(i=e.identifier)&&void 0!==i?i:"",isCurrentDevice:this.isCurrentDevice(e,t),isTrusted:null!==(r=null===(n=e.response)||void 0===n?void 0:n.isTrusted)&&void 0!==r&&r,loginStatus:this.getLoginStatus(e,t),pendingAuthRequest:null!==(o=null===(s=e.response)||void 0===s?void 0:s.devicePendingAuthRequest)&&void 0!==o?o:null}:(this.validationService.showError(new Error(this.i18nService.t("deviceCreationDateMissing"))),null):(this.validationService.showError(new Error(this.i18nService.t("deviceIdMissing"))),null)}).filter(e=>null!==e).sort(FZ)}upsertDeviceWithPendingAuthRequest(e){return xZ(this,void 0,void 0,function*(){const t=yield this.authRequestApiService.getAuthRequest(e);if(!t)return;const i={creationDate:"",displayName:this.devicesService.getReadableDeviceTypeName(t.requestDeviceTypeValue),firstLogin:new Date(t.creationDate),icon:this.getDeviceIcon(t.requestDeviceTypeValue),id:"",identifier:t.requestDeviceIdentifier,isCurrentDevice:!1,isTrusted:!1,loginStatus:this.i18nService.t("requestPending"),pendingAuthRequest:{id:t.id,creationDate:t.creationDate}};if(t.requestDeviceIdentifier){const e=yield(0,bo._)(this.devicesService.getDeviceByIdentifier$(t.requestDeviceIdentifier));(null==e?void 0:e.id)&&e.creationDate&&(i.creationDate=e.creationDate,i.firstLogin=new Date(e.creationDate),i.id=e.id)}const n=this.devices.findIndex(e=>e.identifier===i.identifier);n>=0?(this.devices[n]=i,this.devices=[...this.devices].sort(FZ)):this.devices=[i,...this.devices].sort(FZ)})}getLoginStatus(e,t){return this.isCurrentDevice(e,t)?this.i18nService.t("currentSession"):this.hasPendingAuthRequest(e)?this.i18nService.t("requestPending"):""}isCurrentDevice(e,t){return e.id===t.id}hasPendingAuthRequest(e){var t;return null!=(null===(t=e.response)||void 0===t?void 0:t.devicePendingAuthRequest)}getDeviceIcon(e){var t;const i="bwi bwi-desktop",n=$a[e];return n&&null!==(t={webApp:"bwi bwi-browser",desktop:"bwi bwi-desktop",mobile:"bwi bwi-mobile",cli:"bwi bwi-cli",extension:"bwi bwi-puzzle",sdk:"bwi bwi-desktop"}[n.category])&&void 0!==t?t:i}handleAuthRequestAnswered(e){return xZ(this,void 0,void 0,function*(){const t=uZ.open(this.dialogService,{notificationId:e.id}),i=yield(0,bo._)(t.closed);void 0!==i&&"boolean"==typeof i&&(this.devices=function(e,t){return e.map(e=>{var i;return(null===(i=e.pendingAuthRequest)||void 0===i?void 0:i.id)===t.id&&(e.pendingAuthRequest=null,e.loginStatus=""),e}).sort(FZ)}(this.devices,e),yield this.pendingAuthRequestStateService.clear(yield(0,bo._)(this.accountService.activeAccount$.pipe(iv))))})}}$Z.ɵfac=function(e){return new(e||$Z)(Fl.rXU(Zk),Fl.rXU(Aw),Fl.rXU(a.abz),Fl.rXU(RZ),Fl.rXU(rZ),Fl.rXU(lh),Fl.rXU(Ul),Fl.rXU(gk),Fl.rXU(nZ),Fl.rXU(Ud))},$Z.ɵcmp=Fl.VBU({type:$Z,selectors:[["auth-device-management"]],decls:3,vars:2,consts:[["infoPopover",""],["class","tw-mt-6 tw-mb-2 tw-pb-2.5",4,"ngIf"],[1,"tw-flex","tw-justify-center","tw-items-center","tw-p-4"],[1,"tw-mt-6","tw-mb-2","tw-pb-2.5"],[1,"tw-flex","tw-items-center","tw-gap-2","tw-mb-5"],[1,"tw-m-0"],["type","button","position","right-start",1,"tw-border-none","tw-bg-transparent","tw-text-primary-600","tw-flex","tw-items-center","tw-size-4",3,"bitPopoverTriggerFor"],["aria-hidden","true",1,"bwi","bwi-question-circle"],[3,"title"],[1,"tw-mb-0"],["aria-hidden","true",1,"bwi","bwi-spinner","bwi-spin","tw-text-2xl"],["ngClass","tw-hidden md:tw-block",3,"onAuthRequestAnswered","devices"],["ngClass","md:tw-hidden",3,"onAuthRequestAnswered","devices"]],template:function(e,t){1&e&&(Fl.DNE(0,AZ,16,13,"div",1),Fl.nVh(1,DZ,2,0,"div",2)(2,EZ,2,2)),2&e&&(Fl.Y8G("ngIf",t.showHeaderInfo),Fl.R7$(),Fl.vxM(t.initializing?1:2))},dependencies:[id,kl.MD,kl.YU,kl.bT,gZ,PZ,qV,XV,fB,sc],encapsulation:2});class OZ{}function UZ(e){return t=>new aa.c(i=>{const n=t.subscribe({next(t){e.run(()=>i.next(t))},error(t){e.run(()=>i.error(t))},complete(){e.run(()=>i.complete())}});return()=>n.unsubscribe()})}OZ.ɵfac=function(e){return new(e||OZ)},OZ.ɵcmp=Fl.VBU({type:OZ,selectors:[["extension-device-management"]],decls:7,vars:4,consts:[["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[1,"tw-bg-background-alt"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page")(1,"popup-header",0),Fl.nI1(2,"i18n"),Fl.qex(3,1),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.j41(5,"div",2),Fl.nrm(6,"auth-device-management"),Fl.k0s()()),2&e&&(Fl.R7$(),Fl.Y8G("pageTitle",Fl.mNQ(Fl.bMT(2,2,"devices"))))},dependencies:[$Z,GD,aE,tE,sc],encapsulation:2});class MZ{constructor(e){this.ngZone=e}messageListener(e,t){ul.messageListener(e,(e,i,n)=>this.ngZone.run(()=>t(e,i,n)))}messageListener$(){return ul.messageListener$().pipe(UZ(this.ngZone))}}MZ.ɵfac=function(e){return new(e||MZ)(a.KVO(Fl.SKi))},MZ.ɵprov=a.jDH({token:MZ,factory:MZ.ɵfac,providedIn:"root"});var NZ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const VZ="vault_viewVaultItem",BZ="vault_AddEditVaultItem",jZ="vault_Fido2Popout";function GZ(e){return NZ(this,arguments,void 0,function*(e,t=0){yield pl.closeSingleActionPopout(e,t)})}function LZ(e,t){return NZ(this,void 0,void 0,function*(){yield function(e,t){return NZ(this,void 0,void 0,function*(){const{cipherId:i,action:n,forceCloseExistingWindows:r}=t;let s="popup/index.html#/view-cipher",o="?";const a=(e,t)=>{const i=`${o}${e}=${t}`;return o="&",i};i&&(s+=a("cipherId",i)),e.id&&(s+=a("senderTabId",String(e.id))),n&&(s+=a("action",n)),yield pl.openPopout(s,{singleActionKey:`${VZ}_${i}`,senderWindowId:e.windowId,forceCloseExistingWindows:r})})}(e,Object.assign({forceCloseExistingWindows:!0},t)),yield ul.tabSendMessageData(e,"bgVaultItemRepromptPopoutOpened")})}var zZ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class _Z{constructor(e,t,i,n){this.passwordRepromptService=e,this.userDecryptionOptionsService=t,this.dialogService=i,this.accountService=n}handleUserVerification(e,t,i){return zZ(this,void 0,void 0,function*(){const n=t&&0!==t.reprompt;return i?n?yield this.handleMasterPasswordReprompt():e:n?yield this.handleMasterPasswordReprompt():e?yield this.showUserVerificationDialog():e})}showMasterPasswordReprompt(){return zZ(this,void 0,void 0,function*(){return yield this.passwordRepromptService.showPasswordPrompt()})}showUserVerificationDialog(){return zZ(this,void 0,void 0,function*(){const e=yield gT.open(this.dialogService,{verificationType:"client"});if("cancel"!==e.userAction)return e.verificationSuccess?e.verificationSuccess:e.noAvailableClientVerificationMethods?yield this.promptUserToSetPin():void 0})}handleMasterPasswordReprompt(){return zZ(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.accountService.activeAccount$);if(!(null==e?void 0:e.id))return!1;return(yield(0,bo._)(this.userDecryptionOptionsService.hasMasterPasswordById$(e.id)))?yield this.showMasterPasswordReprompt():yield this.showUserVerificationDialog()})}promptUserToSetPin(){return zZ(this,void 0,void 0,function*(){const e=dE.open(this.dialogService);if(!e)return;return(yield(0,bo._)(e.closed))?yield this.showUserVerificationDialog():void 0})}}var KZ=i(88804);Error;var XZ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const qZ={ConnectResponse:"ConnectResponse",NewSessionCreatedRequest:"NewSessionCreatedRequest",PickCredentialRequest:"PickCredentialRequest",PickCredentialResponse:"PickCredentialResponse",ConfirmNewCredentialRequest:"ConfirmNewCredentialRequest",ConfirmNewCredentialResponse:"ConfirmNewCredentialResponse",InformExcludedCredentialRequest:"InformExcludedCredentialRequest",InformCredentialNotFoundRequest:"InformCredentialNotFoundRequest",AbortRequest:"AbortRequest",AbortResponse:"AbortResponse"};class WZ extends Error{constructor(){super("Fido2UserInterfaceSession was closed")}}class YZ{static create(e,t,i,n){return XZ(this,void 0,void 0,function*(){return new YZ(e,t,i,n)})}static sendMessage(e){ul.sendMessage("BrowserFido2UserInterfaceServiceMessage",e)}static abortPopout(e,t=!1){this.sendMessage({sessionId:e,type:qZ.AbortResponse,fallbackRequested:t})}static confirmNewCredentialResponse(e,t,i){this.sendMessage({sessionId:e,type:qZ.ConfirmNewCredentialResponse,cipherId:t,userVerified:i})}constructor(e,t,i,n=new AbortController,r=bd.newGuid()){this.authService=e,this.fallbackSupported=t,this.tab=i,this.abortController=n,this.sessionId=r,this.closed=!1,this.messages$=ul.messageListener$().pipe((0,Eo.p)(e=>e.sessionId===this.sessionId)),this.connected$=new Dd.t(!1),this.destroy$=new Co.B,this.messages$.pipe((0,Eo.p)(e=>e.type===qZ.ConnectResponse),(0,_o.s)(1),(0,vm.Q)(this.destroy$)).subscribe(()=>{this.connected$.next(!0)}),(0,Rh.R)(n.signal,"abort").pipe((0,vm.Q)(this.destroy$)).subscribe(()=>{this.close(),YZ.sendMessage({type:qZ.AbortRequest,sessionId:this.sessionId})}),this.messages$.pipe((0,Eo.p)(e=>e.type===qZ.AbortResponse),(0,_o.s)(1),(0,vm.Q)(this.destroy$)).subscribe(e=>{e.type===qZ.AbortResponse&&(this.close(),this.abort(e.fallbackRequested))}),this.windowClosed$=xF(chrome.windows.onRemoved).pipe((0,l.T)(([e])=>e)),YZ.sendMessage({type:qZ.NewSessionCreatedRequest,sessionId:r})}pickCredential(e){return XZ(this,arguments,void 0,function*({cipherIds:e,userVerification:t,assumeUserPresence:i,masterPasswordRepromptRequired:n}){if(i&&1===e.length&&!n)return{cipherId:e[0],userVerified:t};const r={type:qZ.PickCredentialRequest,cipherIds:e,sessionId:this.sessionId,userVerification:t,fallbackSupported:this.fallbackSupported};yield this.send(r);const s=yield this.receive(qZ.PickCredentialResponse);return{cipherId:s.cipherId,userVerified:s.userVerified}})}confirmNewCredential(e){return XZ(this,arguments,void 0,function*({credentialName:e,userName:t,userHandle:i,userVerification:n,rpId:r}){const s={type:qZ.ConfirmNewCredentialRequest,sessionId:this.sessionId,credentialName:e,userName:t,userHandle:i,userVerification:n,fallbackSupported:this.fallbackSupported,rpId:r};yield this.send(s);const o=yield this.receive(qZ.ConfirmNewCredentialResponse);return{cipherId:o.cipherId,userVerified:o.userVerified}})}informExcludedCredential(e){return XZ(this,void 0,void 0,function*(){const t={type:qZ.InformExcludedCredentialRequest,sessionId:this.sessionId,existingCipherIds:e,fallbackSupported:this.fallbackSupported};yield this.send(t),yield this.receive(qZ.AbortResponse)})}ensureUnlockedVault(){return XZ(this,void 0,void 0,function*(){(yield this.authService.getAuthStatus())!==Pd.Unlocked&&(yield this.connect())})}informCredentialNotFound(){return XZ(this,void 0,void 0,function*(){const e={type:qZ.InformCredentialNotFoundRequest,sessionId:this.sessionId,fallbackSupported:this.fallbackSupported};yield this.send(e),yield this.receive(qZ.AbortResponse)})}close(){return XZ(this,void 0,void 0,function*(){yield function(e){return NZ(this,void 0,void 0,function*(){yield pl.closeSingleActionPopout(`${jZ}_${e}`)})}(this.sessionId),this.closed=!0,this.destroy$.next(),this.destroy$.complete()})}abort(){return XZ(this,arguments,void 0,function*(e=!1){this.abortController.abort(e?"UserRequestedFallback":void 0)})}send(e){return XZ(this,void 0,void 0,function*(){this.connected$.value||(yield this.connect()),YZ.sendMessage(e)})}receive(e){return XZ(this,void 0,void 0,function*(){try{return yield(0,bo._)(this.messages$.pipe((0,Eo.p)(t=>t.sessionId===this.sessionId&&t.type===e),(0,vm.Q)(this.destroy$)))}catch(e){if(e instanceof KZ.G)throw new WZ;throw e}})}connect(){return XZ(this,void 0,void 0,function*(){if(this.closed)throw new Error("Cannot re-open closed session");const e=(0,bo._)((0,Po.h)(this.connected$.pipe((0,Eo.p)(e=>!0===e)),(0,Rh.R)(this.abortController.signal,"abort").pipe((0,go.n)(()=>(0,So.$)(()=>new WZ)))));yield ul.tabSendMessageData(this.tab,"closeNotificationBar");const t=yield function(e,t){return NZ(this,void 0,void 0,function*(){const{sessionId:i,fallbackSupported:n}=t,r=`popup/index.html#/fido2?sessionId=${i}&fallbackSupported=${n}&senderTabId=${e.id}&senderUrl=${encodeURIComponent(e.url)}`;return(yield pl.openPopout(r,{singleActionKey:`${jZ}_${i}`,senderWindowId:e.windowId,forceCloseExistingWindows:!0,windowOptions:{height:570}})).id})}(this.tab,{sessionId:this.sessionId,fallbackSupported:this.fallbackSupported});this.windowClosed$.pipe((0,Eo.p)(e=>t===e),(0,vm.Q)(this.destroy$)).subscribe(()=>{this.close(),this.abort(!0)}),yield e})}}function HZ(e,t){1&e&&(Fl.nrm(0,"i",3),Fl.nI1(1,"i18n")),2&e&&Fl.Y8G("appA11yTitle",Fl.bMT(1,1,"shared"))}function JZ(e,t){if(1&e&&(Fl.j41(0,"div"),Fl.EFF(1),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.JRh(e.getSubName(e.cipher))}}function ZZ(e,t){if(1&e&&(Fl.j41(0,"div"),Fl.EFF(1),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.JRh(e.cipher.subTitle)}}class QZ{constructor(){this.onSelected=new Fl.bkB}selectCipher(e){this.onSelected.emit(e)}getSubName(e){var t;const i=null===(t=e.login)||void 0===t?void 0:t.fido2Credentials;if(!i||0===i.length)return null;const[n]=i;return e.name!==n.rpId?n.rpId:null}}function eQ(){return(0,a.WQX)(Fd.nX).queryParams.pipe((0,l.T)(e=>({isFido2Session:null!=e.sessionId,sessionId:e.sessionId,fallbackSupported:"true"===e.fallbackSupported,userVerification:"true"===e.userVerification,senderUrl:e.senderUrl,fromLock:"true"===e.fromLock})))}QZ.ɵfac=function(e){return new(e||QZ)},QZ.ɵcmp=Fl.VBU({type:QZ,selectors:[["app-fido2-cipher-row"]],inputs:{cipher:"cipher",title:"title"},outputs:{onSelected:"onSelected"},decls:9,vars:8,consts:[["bit-item-content","","tabindex","0","type","button",3,"click","appA11yTitle"],["slot","start",3,"cipher"],["data-testid","item-name"],[1,"bwi","bwi-collection-shared","tw-text-muted",3,"appA11yTitle"],["slot","secondary"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-item")(1,"button",0),Fl.bIt("click",function(){return t.selectCipher(t.cipher)}),Fl.nrm(2,"app-vault-icon",1),Fl.j41(3,"span",2),Fl.EFF(4),Fl.nVh(5,HZ,2,3,"i",3),Fl.k0s(),Fl.qex(6,4),Fl.nVh(7,JZ,2,1,"div"),Fl.nVh(8,ZZ,2,1,"div"),Fl.bVm(),Fl.k0s()()),2&e&&(Fl.R7$(),Fl.Y8G("appA11yTitle",Fl.ai1("",t.title," - ",t.cipher.name)),Fl.R7$(),Fl.Y8G("cipher",t.cipher),Fl.R7$(2),Fl.SpI(" ",t.cipher.name," "),Fl.R7$(),Fl.vxM(t.cipher.organizationId?5:-1),Fl.R7$(2),Fl.vxM(t.getSubName(t.cipher)?7:-1),Fl.R7$(),Fl.vxM(t.cipher.subTitle?8:-1))},dependencies:[eu,id,kl.MD,Ql,VP,GP,KP,sf,rw,RU,tc,rf],encapsulation:2,changeDetection:0});var tQ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function iQ(e,t){1&e&&Fl.nrm(0,"div",6)}function nQ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"div",1)(1,"button",2)(2,"span",3),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.nrm(5,"i",4),Fl.k0s(),Fl.j41(6,"bit-menu",null,0)(8,"button",5),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.abort(!1))}),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s(),Fl.j41(11,"button",5),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.abort())}),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s()()(),Fl.nVh(14,iQ,1,0,"div",6)}if(2&e){const e=Fl.sdS(7),t=Fl.XpG();Fl.R7$(),Fl.Y8G("bitMenuTriggerFor",e),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(4,5,"useDeviceOrHardwareKey")," "),Fl.R7$(6),Fl.SpI(" ",Fl.bMT(10,7,"justOnce")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(13,9,"alwaysForThisSite")," "),Fl.R7$(2),Fl.vxM(t.showOverlay?14:-1)}}class rQ{constructor(e,t,i){this.domainSettingsService=e,this.platformUtilsService=t,this.i18nService=i,this.showOverlay=!1,this.fido2PopoutSessionData$=eQ()}abort(){return tQ(this,arguments,void 0,function*(e=!0){const t=yield(0,bo._)(this.fido2PopoutSessionData$);e?(this.showOverlay=!0,yield this.handleDomainExclusion(t.senderUrl),yield bd.delay(2e3),this.abortSession(t.sessionId)):this.abortSession(t.sessionId)})}handleDomainExclusion(e){return tQ(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.domainSettingsService.neverDomains$),i=bd.getHostname(e),n=Object.assign({},t);n[i]=null,yield this.domainSettingsService.setNeverDomains(n),this.platformUtilsService.showToast("success","",this.i18nService.t("domainAddedToExcludedDomains",i))})}abortSession(e){YZ.abortPopout(e,!0)}}rQ.ɵfac=function(e){return new(e||rQ)(Fl.rXU(YE),Fl.rXU(Hb),Fl.rXU(Ul))},rQ.ɵcmp=Fl.VBU({type:rQ,selectors:[["app-fido2-use-browser-link"]],decls:2,vars:3,consts:[["deviceMenu",""],[1,"tw-flex","tw-items-center","tw-justify-center","tw-p-2"],["type","button",3,"bitMenuTriggerFor"],["bitTypography","body2"],["aria-hidden","true",1,"bwi","bwi-fw","bwi-sm","bwi-angle-down"],["type","button","bitMenuItem","",3,"click"],[1,"tw-absolute","tw-size-full","tw-bg-background-alt","tw-inset-0","tw-bg-opacity-80","tw-z-50"]],template:function(e,t){1&e&&(Fl.nVh(0,nQ,15,11),Fl.nI1(1,"async")),2&e&&Fl.vxM(Fl.bMT(1,1,t.fido2PopoutSessionData$).fallbackSupported?0:-1)},dependencies:[kl.MD,sf,qh,pz,fz,D$,kl.Jj,rf],encapsulation:2});class sQ{}var oQ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const aQ=(e,t)=>t.id;function lQ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",3),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.addCipher())}),Fl.nrm(1,"i",4),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"new")," "))}function cQ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-section")(1,"bit-search",5),Fl.nI1(2,"i18n"),Fl.bIt("ngModelChange",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.search())}),Fl.mxI("ngModelChange",function(t){a.eBV(e);const i=Fl.XpG(2);return Fl.DH7(i.searchText,t)||(i.searchText=t),a.Njj(t)}),Fl.k0s()()}if(2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("placeholder",Fl.mNQ(Fl.bMT(2,3,"searchVault"))),Fl.R50("ngModel",e.searchText)}}function uQ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"app-fido2-cipher-row",9),Fl.nI1(1,"i18n"),Fl.bIt("onSelected",function(t){a.eBV(e);const i=Fl.XpG(4);return a.Njj(i.handleCipherItemSelect(t))}),Fl.k0s()}if(2&e){const e=t.$implicit;Fl.Y8G("title",Fl.mNQ(Fl.bMT(1,3,"passkeyItem")))("cipher",e)}}function dQ(e,t){if(1&e&&(Fl.j41(0,"bit-section-header")(1,"h2",7),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()(),Fl.Z7z(4,uQ,2,5,"app-fido2-cipher-row",8,aQ)),2&e){const e=Fl.XpG(3);Fl.R7$(2),Fl.JRh(Fl.bMT(3,1,"chooseCipherForPasskeySave")),Fl.R7$(2),Fl.Dyx(e.displayedCiphers)}}function hQ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-no-items",6),Fl.qex(1,10),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.bVm(),Fl.qex(4,11),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.bVm(),Fl.j41(7,"button",12),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(3);return a.Njj(t.hasSearched?t.clearSearch():t.saveNewLogin())}),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s()()}if(2&e){const e=Fl.XpG(3);Fl.Y8G("icon",e.noResultsIcon),Fl.R7$(2),Fl.JRh(Fl.bMT(3,5,e.hasSearched?"noItemsMatchSearch":"noMatchingLoginsForSite")),Fl.R7$(3),Fl.JRh(Fl.bMT(6,7,e.hasSearched?"searchSavePasskeyNewLogin":"clearFiltersOrTryAnother")),Fl.R7$(2),Fl.Y8G("loading",e.loading),Fl.R7$(),Fl.SpI(" ",Fl.bMT(9,9,e.hasSearched?"multiSelectClearAll":"savePasskeyNewLogin")," ")}}function pQ(e,t){if(1&e&&(Fl.j41(0,"bit-section"),Fl.nVh(1,dQ,6,3),Fl.nVh(2,hQ,10,11,"bit-no-items",6),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.vxM(e.displayedCiphers.length>0?1:-1),Fl.R7$(),Fl.vxM(e.displayedCiphers.length?-1:2)}}function vQ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"app-fido2-cipher-row",9),Fl.nI1(1,"i18n"),Fl.bIt("onSelected",function(t){a.eBV(e);const i=Fl.XpG(3);return a.Njj(i.handleCipherItemSelect(t))}),Fl.k0s()}if(2&e){const e=t.$implicit;Fl.Y8G("title",Fl.mNQ(Fl.bMT(1,3,"passkeyItem")))("cipher",e)}}function fQ(e,t){if(1&e&&(Fl.j41(0,"bit-section")(1,"div",13)(2,"p"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"div",14),Fl.Z7z(6,vQ,2,5,"app-fido2-cipher-row",8,aQ),Fl.k0s()()()),2&e){const e=Fl.XpG(2);Fl.R7$(3),Fl.JRh(Fl.bMT(4,1,"passkeyAlreadyExists")),Fl.R7$(3),Fl.Dyx(e.displayedCiphers)}}function mQ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"app-fido2-cipher-row",9),Fl.nI1(1,"i18n"),Fl.bIt("onSelected",function(t){a.eBV(e);const i=Fl.XpG(4);return a.Njj(i.handleCipherItemSelect(t))}),Fl.k0s()}if(2&e){const e=t.$implicit;Fl.Y8G("title",Fl.mNQ(Fl.bMT(1,3,"passkeyItem")))("cipher",e)}}function gQ(e,t){if(1&e&&(Fl.qex(0,10),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.bVm(),Fl.Z7z(3,mQ,2,5,"app-fido2-cipher-row",8,aQ)),2&e){const e=Fl.XpG(3);Fl.R7$(),Fl.JRh(Fl.bMT(2,1,"chooseCipherForPasskeyAuth")),Fl.R7$(2),Fl.Dyx(e.displayedCiphers)}}function yQ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-no-items",6),Fl.qex(1,10),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.bVm(),Fl.qex(4,11),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.bVm(),Fl.j41(7,"button",12),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(3);return a.Njj(t.hasSearched?t.clearSearch():t.saveNewLogin())}),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s()()}if(2&e){const e=Fl.XpG(3);Fl.Y8G("icon",e.noResultsIcon),Fl.R7$(2),Fl.JRh(Fl.bMT(3,5,e.hasSearched?"noItemsMatchSearch":"noMatchingLoginsForSite")),Fl.R7$(3),Fl.JRh(Fl.bMT(6,7,e.hasSearched?"searchSavePasskeyNewLogin":"clearFiltersOrTryAnother")),Fl.R7$(2),Fl.Y8G("loading",e.loading),Fl.R7$(),Fl.SpI(" ",Fl.bMT(9,9,e.hasSearched?"multiSelectClearAll":"savePasskeyNewLogin")," ")}}function bQ(e,t){if(1&e&&(Fl.j41(0,"bit-section"),Fl.nVh(1,gQ,5,3)(2,yQ,10,11,"bit-no-items",6),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.vxM(e.displayedCiphers.length>0?1:2)}}function wQ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-section")(1,"div",13)(2,"p"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"button",15),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.abort(!1))}),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s()()}if(2&e){const e=Fl.XpG(2);Fl.R7$(3),Fl.JRh(Fl.bMT(4,3,"noPasskeysFoundForThisApplication")),Fl.R7$(2),Fl.Y8G("loading",e.loading),Fl.R7$(),Fl.SpI(" ",Fl.bMT(7,5,"close")," ")}}function SQ(e,t){if(1&e&&(Fl.j41(0,"popup-page")(1,"popup-header",0),Fl.nI1(2,"i18n"),Fl.nVh(3,lQ,4,3,"button",1),Fl.k0s(),Fl.j41(4,"div",2),Fl.nVh(5,cQ,3,5,"bit-section"),Fl.nVh(6,pQ,3,2,"bit-section")(7,fQ,8,3,"bit-section")(8,bQ,3,1,"bit-section")(9,wQ,8,7,"bit-section"),Fl.nrm(10,"app-fido2-use-browser-link"),Fl.k0s()()),2&e){let e;const i=Fl.XpG();Fl.R7$(),Fl.Y8G("pageTitle",Fl.mNQ(Fl.bMT(2,5,i.passkeyAction===i.PasskeyActions.Register?"savePasskey":"logInWithPasskeyQuestion"))),Fl.R7$(2),Fl.vxM(i.showNewPasskeyButton?3:-1),Fl.R7$(2),Fl.vxM(i.passkeyAction===i.PasskeyActions.Register?5:-1),Fl.R7$(),Fl.vxM((e=t.message.type)===i.BrowserFido2MessageTypes.ConfirmNewCredentialRequest?6:e===i.BrowserFido2MessageTypes.InformExcludedCredentialRequest?7:e===i.BrowserFido2MessageTypes.PickCredentialRequest?8:e===i.BrowserFido2MessageTypes.InformCredentialNotFoundRequest?9:-1)}}const kQ={Register:"register",Authenticate:"authenticate"};class IQ{constructor(e,t,i,n,r,s,o,a,l,c,u,d){this.router=e,this.activatedRoute=t,this.cipherService=i,this.platformUtilsService=n,this.domainSettingsService=r,this.searchService=s,this.logService=o,this.dialogService=a,this.browserMessagingApi=l,this.passwordRepromptService=c,this.accountService=u,this.fido2UserVerificationService=d,this.destroy$=new Co.B,this.message$=new Dd.t(null),this.BrowserFido2MessageTypes=qZ,this.ciphers=[],this.displayedCiphers=[],this.loading=!1,this.noResultsIcon=aG,this.passkeyAction=kQ.Register,this.PasskeyActions=kQ,this.hasSearched=!1,this.searchTypeSearch=!1,this.showNewPasskeyButton=!1}ngOnInit(){this.searchTypeSearch=!this.platformUtilsService.isSafari();const e=this.activatedRoute.queryParamMap.pipe((0,_o.s)(1),(0,l.T)(e=>({sessionId:e.get("sessionId"),senderTabId:e.get("senderTabId"),senderUrl:e.get("senderUrl")})));(0,jo.z)([e,this.browserMessagingApi.messageListener$()]).pipe((0,To.H)(e=>oQ(this,[e],void 0,function*([e,t]){if(this.sessionId=e.sessionId,this.senderTabId=e.senderTabId,this.url=e.senderUrl,t.type!==qZ.NewSessionCreatedRequest||t.sessionId===e.sessionId){if(t.sessionId===e.sessionId){if(t.type!==qZ.AbortRequest)return t;this.abort(!1)}}else this.abort(!1)})),(0,Eo.p)(e=>!!e),(0,vm.Q)(this.destroy$)).subscribe(e=>{this.message$.next(e)}),this.data$=this.message$.pipe((0,Eo.p)(e=>null!=e),(0,To.H)(e=>oQ(this,void 0,void 0,function*(){switch(e.type){case qZ.ConfirmNewCredentialRequest:{const t=yield(0,bo._)(this.domainSettingsService.getUrlEquivalentDomains(this.url)),i=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));this.ciphers=(yield this.cipherService.getAllDecrypted(i)).filter(e=>e.type===nx.Login&&!e.isDeleted),this.displayedCiphers=this.ciphers.filter(i=>i.login.matchesUri(this.url,t)&&qA.cipherHasNoOtherPasskeys(i,e.userHandle)),this.passkeyAction=kQ.Register,this.showNewPasskeyButton=!0;break}case qZ.PickCredentialRequest:{const t=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)));this.ciphers=yield Promise.all(e.cipherIds.map(e=>oQ(this,void 0,void 0,function*(){const i=yield this.cipherService.get(e,t);return this.cipherService.decrypt(i,t)}))),this.displayedCiphers=[...this.ciphers],this.passkeyAction=kQ.Authenticate;break}case qZ.InformExcludedCredentialRequest:{const t=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)));this.ciphers=yield Promise.all(e.existingCipherIds.map(e=>oQ(this,void 0,void 0,function*(){const i=yield this.cipherService.get(e,t);return this.cipherService.decrypt(i,t)}))),this.displayedCiphers=[...this.ciphers],this.passkeyAction=kQ.Register;break}case qZ.InformCredentialNotFoundRequest:this.passkeyAction=kQ.Authenticate}return{message:e,fallbackSupported:"fallbackSupported"in e&&e.fallbackSupported}})),(0,vm.Q)(this.destroy$)),e.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{this.send({sessionId:e.sessionId,type:qZ.ConnectResponse})})}submit(){return oQ(this,void 0,void 0,function*(){const e=this.message$.value;if((null==e?void 0:e.type)===qZ.PickCredentialRequest){const t=yield this.handleUserVerification(e.userVerification,this.cipher);this.send({sessionId:this.sessionId,cipherId:this.cipher.id,type:qZ.PickCredentialResponse,userVerified:t})}else if((null==e?void 0:e.type)===qZ.ConfirmNewCredentialRequest){if(this.cipher.login.hasFido2Credentials){if(!(yield this.dialogService.openSimpleDialog({title:{key:"overwritePasskey"},content:{key:"overwritePasskeyAlert"},type:"warning"})))return!1}const t=yield this.handleUserVerification(e.userVerification,this.cipher);this.send({sessionId:this.sessionId,cipherId:this.cipher.id,type:qZ.ConfirmNewCredentialResponse,userVerified:t})}this.loading=!0})}saveNewLogin(){return oQ(this,void 0,void 0,function*(){var e;const t=this.message$.value;if((null==t?void 0:t.type)===qZ.ConfirmNewCredentialRequest){const i=t.credentialName||t.rpId;yield this.createNewCipher(i,t.userName),this.send({sessionId:this.sessionId,cipherId:null===(e=this.cipher)||void 0===e?void 0:e.id,type:qZ.ConfirmNewCredentialResponse,userVerified:t.userVerification})}this.loading=!0})}handleCipherItemSelect(e){return oQ(this,void 0,void 0,function*(){this.cipher=e,yield this.submit()})}addCipher(){return oQ(this,void 0,void 0,function*(){const e=this.message$.value;(null==e?void 0:e.type)===qZ.ConfirmNewCredentialRequest&&(yield this.router.navigate(["/add-cipher"],{queryParams:{type:nx.Login.toString(),name:e.credentialName||e.rpId,uri:this.url,uilocation:"popout",username:e.userName,senderTabId:this.senderTabId,sessionId:this.sessionId,userVerification:e.userVerification,singleActionPopout:`${jZ}_${this.sessionId}`}}))})}getEquivalentDomains(){return oQ(this,void 0,void 0,function*(){return this.equivalentDomainsURL!==this.url&&(this.equivalentDomainsURL=this.url,this.equivalentDomains=yield(0,bo._)(this.domainSettingsService.getUrlEquivalentDomains(this.url))),this.equivalentDomains})}clearSearch(){return oQ(this,void 0,void 0,function*(){this.searchText="",yield this.setDisplayedCiphersToAllDomainMatch()})}setDisplayedCiphersToAllDomainMatch(){return oQ(this,void 0,void 0,function*(){const e=yield this.getEquivalentDomains();this.displayedCiphers=this.ciphers.filter(t=>t.login.matchesUri(this.url,e))})}search(){return oQ(this,void 0,void 0,function*(){const e=yield(0,bo._)(iv(this.accountService.activeAccount$));this.hasSearched=!0;(yield this.searchService.isSearchable(e,this.searchText))?this.displayedCiphers=yield this.searchService.searchCiphers(e,this.searchText,null,this.ciphers):yield this.setDisplayedCiphersToAllDomainMatch()})}abort(e){this.unload(e),window.close()}unload(e=!1){this.send({sessionId:this.sessionId,type:qZ.AbortResponse,fallbackRequested:e})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}buildCipher(e,t){this.cipher=new RO,this.cipher.name=e,this.cipher.type=nx.Login,this.cipher.login=new CO,this.cipher.login.username=t,this.cipher.login.uris=[new QE],this.cipher.login.uris[0].uri=this.url,this.cipher.card=new mO,this.cipher.identity=new wO,this.cipher.secureNote=new PO,this.cipher.secureNote.type=hx,this.cipher.reprompt=tx.None}createNewCipher(e,t){return oQ(this,void 0,void 0,function*(){const i=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)));this.buildCipher(e,t);try{const e=yield this.cipherService.createWithServer(this.cipher,i);this.cipher.id=e.id}catch(e){this.logService.error(e)}})}handleUserVerification(e,t){return oQ(this,void 0,void 0,function*(){return t&&0!==t.reprompt?yield this.passwordRepromptService.showPasswordPrompt():e})}send(e){YZ.sendMessage(Object.assign({sessionId:this.sessionId},e))}}IQ.ɵfac=function(e){return new(e||IQ)(Fl.rXU(Fd.Ix),Fl.rXU(Fd.nX),Fl.rXU(_b),Fl.rXU(Hb),Fl.rXU(YE),Fl.rXU(sQ),Fl.rXU(Za),Fl.rXU(lh),Fl.rXU(MZ),Fl.rXU(k$),Fl.rXU(Zk),Fl.rXU(_Z))},IQ.ɵcmp=Fl.VBU({type:IQ,selectors:[["app-fido2"]],decls:2,vars:3,consts:[["slot","header",3,"pageTitle"],["bitButton","","buttonType","primary","type","button","slot","end"],[1,"tw-p-2"],["bitButton","","buttonType","primary","type","button","slot","end",3,"click"],["aria-hidden","true",1,"bwi","bwi-plus"],["appAutofocus","","autocomplete","off","id","search",3,"ngModelChange","placeholder","ngModel"],[3,"icon"],["bitTypography","h6"],[3,"cipher","title"],[3,"onSelected","cipher","title"],["slot","title"],["slot","description"],["bitButton","","buttonType","primary","slot","button","type","button",3,"click","loading"],[1,"tw-space-y-4"],[1,"tw-divide-y","tw-divide-secondary-300"],["bitButton","","block","","buttonType","primary","type","button",3,"click","loading"]],template:function(e,t){if(1&e&&(Fl.nVh(0,SQ,11,7,"popup-page"),Fl.nI1(1,"async")),2&e){let e;Fl.vxM((e=Fl.bMT(1,1,t.data$))?0:-1,e)}},dependencies:[id,td,kl.MD,QZ,rQ,Il.YN,Il.BC,Il.vS,VP,sf,wd,Wh,cG,aE,tE,iO,tO,Ux,Nx,kl.Jj,rf],encapsulation:2});const CQ=["*",[["","slot","end"]]];class TQ{}TQ.ɵfac=function(e){return new(e||TQ)},TQ.ɵcmp=Fl.VBU({type:TQ,selectors:[["popup-footer"]],ngContentSelectors:["*","[slot=end]"],decls:6,vars:0,consts:[[1,"tw-p-3","bit-compact:tw-p-2","tw-border-0","tw-border-solid","tw-border-t","tw-border-secondary-300","tw-bg-background"],[1,"tw-max-w-screen-sm","tw-mx-auto","tw-flex","tw-justify-between","tw-w-full","tw-items-center"],[1,"tw-flex","tw-justify-start","tw-gap-2"],[1,"tw-inline-flex","tw-items-center","tw-gap-2","tw-h-9"]],template:function(e,t){1&e&&(Fl.NAR(CQ),Fl.rj2(0,"footer",0)(1,"div",1)(2,"div",2),Fl.SdG(3),Fl.eux(),Fl.rj2(4,"div",3),Fl.SdG(5,1),Fl.eux()()())},encapsulation:2});var PQ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const FQ=["uriInput"];function RQ(e,t){if(1&e&&(Fl.j41(0,"bit-item-content")(1,"div",18),Fl.EFF(2),Fl.k0s()()),2&e){const e=Fl.XpG(),t=e.$implicit,i=e.index;Fl.R7$(),Fl.Y8G("id",Fl.VkB("blockedDomain",i)),Fl.R7$(),Fl.JRh(t)}}function xQ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",19),Fl.nI1(1,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG().index,i=Fl.XpG(2);return a.Njj(i.removeDomain(t))}),Fl.k0s()}2&e&&Fl.Y8G("label",Fl.mNQ(Fl.bMT(1,2,"remove")))}function AQ(e,t){if(1&e&&(Fl.j41(0,"bit-item"),Fl.DNE(1,RQ,3,3,"bit-item-content",6)(2,xQ,2,4,"button",17),Fl.k0s()),2&e){const e=t.index,i=Fl.XpG(2);Fl.R7$(),Fl.Y8G("ngIf",e<i.fieldsEditThreshold),Fl.R7$(),Fl.Y8G("ngIf",e<i.fieldsEditThreshold)}}function DQ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-card",20)(1,"bit-form-field",21)(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"input",22,0),Fl.bIt("change",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.fieldChange())}),Fl.k0s()()()}if(2&e){const e=t.index,i=Fl.XpG(2);Fl.R7$(3),Fl.JRh(Fl.i5U(4,7,"websiteItemLabel",e+i.fieldsEditThreshold+1)),Fl.R7$(2),Fl.Y8G("id",Fl.VkB("blockedDomain",e+i.fieldsEditThreshold))("name",Fl.VkB("blockedDomain",e+i.fieldsEditThreshold))("formControlName",Fl.mNQ(e))}}function EQ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-section")(1,"bit-section-header")(2,"h2",10),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"span",11),Fl.EFF(6),Fl.k0s()(),Fl.DNE(7,AQ,3,2,"bit-item",12),Fl.j41(8,"form",13),Fl.DNE(9,DQ,7,10,"bit-card",14),Fl.j41(10,"button",15),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.addNewDomain())}),Fl.nrm(11,"i",16),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s()()()}if(2&e){const e=Fl.XpG();Fl.R7$(3),Fl.JRh(Fl.bMT(4,7,"domainsTitle")),Fl.R7$(3),Fl.JRh(e.blockedDomainsState.length+e.domainForms.value.length),Fl.R7$(),Fl.Y8G("ngForOf",e.blockedDomainsState)("ngForTrackBy",e.trackByFunction),Fl.R7$(),Fl.Y8G("formGroup",e.domainListForm),Fl.R7$(),Fl.Y8G("ngForOf",e.domainForms.controls),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(13,9,"addDomain")," ")}}class $Q{constructor(e,t,i,n,r){this.domainSettingsService=e,this.i18nService=t,this.toastService=i,this.formBuilder=n,this.popupRouterCacheService=r,this.uriInputElements=new Fl.rOR,this.dataIsPristine=!0,this.isLoading=!1,this.blockedDomainsState=[],this.storedBlockedDomains=[],this.domainListForm=new Il.gE({domains:this.formBuilder.array([])}),this.fieldsEditThreshold=0,this.destroy$=new Co.B}get domainForms(){return this.domainListForm.get("domains")}ngAfterViewInit(){return PQ(this,void 0,void 0,function*(){this.domainSettingsService.blockedInteractionsUris$.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>this.handleStateUpdate(e)),this.uriInputElements.changes.pipe((0,vm.Q)(this.destroy$)).subscribe(({last:e})=>{this.focusNewUriInput(e)})})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}handleStateUpdate(e){e&&(this.storedBlockedDomains=Object.keys(e)),this.blockedDomainsState=[...this.storedBlockedDomains],this.fieldsEditThreshold=this.storedBlockedDomains.length,this.dataIsPristine=!0,this.isLoading=!1}focusNewUriInput(e){(null==e?void 0:e.nativeElement)&&e.nativeElement.focus()}addNewDomain(){return PQ(this,void 0,void 0,function*(){this.domainForms.push(this.formBuilder.control(null)),yield this.fieldChange()})}removeDomain(e){return PQ(this,void 0,void 0,function*(){this.blockedDomainsState.splice(e,1),e<this.fieldsEditThreshold&&this.fieldsEditThreshold--,yield this.fieldChange()})}fieldChange(){return PQ(this,void 0,void 0,function*(){this.dataIsPristine&&(this.dataIsPristine=!1)})}saveChanges(){return PQ(this,void 0,void 0,function*(){if(this.dataIsPristine)return;this.isLoading=!0;const e={},t=new Set([...this.blockedDomainsState,...this.domainForms.value]);for(const i of t)if(i&&""!==i){const t=bd.getHostname(i);if(!t)return this.toastService.showToast({message:this.i18nService.t("blockedDomainsInvalidDomain",i),title:"",variant:"error"}),void(this.isLoading=!1);e[t]=null}try{const t=new Set(this.storedBlockedDomains),i=new Set(Object.keys(e));if(t.size===i.size&&new Set([...t,...i]).size===t.size){const e=this.storedBlockedDomains.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:null}),{});this.handleStateUpdate(e)}else yield this.domainSettingsService.setBlockedInteractionsUris(e);this.toastService.showToast({message:this.i18nService.t("blockedDomainsSavedSuccess"),title:"",variant:"success"}),this.domainForms.clear()}catch(e){this.toastService.showToast({message:this.i18nService.t("unexpectedError"),title:"",variant:"error"}),this.isLoading=!1}})}goBack(){return PQ(this,void 0,void 0,function*(){yield this.popupRouterCacheService.back()})}trackByFunction(e,t){return e}}$Q.ɵfac=function(e){return new(e||$Q)(Fl.rXU(YE),Fl.rXU(Ul),Fl.rXU(qb),Fl.rXU(Il.ok),Fl.rXU(WD))},$Q.ɵcmp=Fl.VBU({type:$Q,selectors:[["app-blocked-domains"]],viewQuery:function(e,t){if(1&e&&Fl.GBs(FQ,5),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.uriInputElements=e)}},decls:21,vars:18,consts:[["uriInput",""],["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[1,"tw-bg-background-alt"],[1,"tw-m-0"],["bitLink","","linkType","primary","rel","noreferrer","target","_blank","href","https://bitwarden.com/help/blocking-uris/"],[4,"ngIf"],["slot","footer"],["bitButton","","buttonType","primary","type","submit",3,"click","disabled"],["bitButton","","type","button","buttonType","secondary",3,"click"],["bitTypography","h6"],["bitTypography","body2","slot","end"],[4,"ngFor","ngForOf","ngForTrackBy"],[3,"formGroup"],["formArrayName","domains",4,"ngFor","ngForOf"],["bitLink","","type","button","linkType","primary",1,"tw-pt-2",3,"click"],["aria-hidden","true",1,"bwi","bwi-plus-circle","bwi-fw"],["bitIconButton","bwi-minus-circle","buttonType","danger","size","small","slot","end","type","button",3,"label","click",4,"ngIf"],[3,"id"],["bitIconButton","bwi-minus-circle","buttonType","danger","size","small","slot","end","type","button",3,"click","label"],["formArrayName","domains"],["disableMargin",""],["bitInput","","appInputVerbatim","","bitInput","","inputmode","url","type","text",3,"change","id","name","formControlName"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page")(1,"popup-header",1),Fl.nI1(2,"i18n"),Fl.qex(3,2),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.j41(5,"div",3)(6,"bit-section")(7,"p",4),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.j41(10,"a",5),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s()(),Fl.DNE(13,EQ,14,11,"bit-section",6),Fl.k0s(),Fl.j41(14,"popup-footer",7)(15,"button",8),Fl.bIt("click",function(){return t.saveChanges()}),Fl.EFF(16),Fl.nI1(17,"i18n"),Fl.k0s(),Fl.j41(18,"button",9),Fl.bIt("click",function(){return t.goBack()}),Fl.EFF(19),Fl.nI1(20,"i18n"),Fl.k0s()()()),2&e&&(Fl.R7$(),Fl.Y8G("pageTitle",Fl.mNQ(Fl.bMT(2,8,"blockedDomains"))),Fl.R7$(7),Fl.JRh(Fl.bMT(9,10,"blockedDomainsDesc")),Fl.R7$(3),Fl.JRh(Fl.bMT(12,12,"learnMoreAboutBlockedDomains")),Fl.R7$(2),Fl.Y8G("ngIf",!t.isLoading),Fl.R7$(2),Fl.Y8G("disabled",t.dataIsPristine),Fl.R7$(),Fl.SpI(" ",Fl.bMT(17,14,"save")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(20,16,"cancel")," "))},dependencies:[id,td,Ex,kl.MD,kl.Sq,kl.bT,Gu,Ac,fu,ju,Il.YN,Il.qT,Il.me,Il.BC,Il.cb,Il.X1,Il.j4,Il.JD,Il.v8,Ql,Zl,VP,GP,KP,sf,GI,Hh,uw,GD,TQ,aE,tE,Cw.iI,Ux,Nx,tc,rc,rf],encapsulation:2});var OQ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const UQ=["uriInput"];function MQ(e,t){if(1&e&&(Fl.j41(0,"bit-item-content")(1,"div",16),Fl.EFF(2),Fl.k0s()()),2&e){const e=Fl.XpG(),t=e.$implicit,i=e.index;Fl.R7$(),Fl.Y8G("id",Fl.VkB("excludedDomain",i)),Fl.R7$(),Fl.JRh(t)}}function NQ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",17),Fl.nI1(1,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG().index,i=Fl.XpG(2);return a.Njj(i.removeDomain(t))}),Fl.k0s()}2&e&&Fl.Y8G("label",Fl.mNQ(Fl.bMT(1,2,"remove")))}function VQ(e,t){if(1&e&&(Fl.j41(0,"bit-item"),Fl.DNE(1,MQ,3,3,"bit-item-content",4)(2,NQ,2,4,"button",15),Fl.k0s()),2&e){const e=t.index,i=Fl.XpG(2);Fl.R7$(),Fl.Y8G("ngIf",e<i.fieldsEditThreshold),Fl.R7$(),Fl.Y8G("ngIf",e<i.fieldsEditThreshold)}}function BQ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-card",18)(1,"bit-form-field",19)(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"input",20,0),Fl.bIt("change",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.fieldChange())}),Fl.k0s()()()}if(2&e){const e=t.index,i=Fl.XpG(2);Fl.R7$(3),Fl.JRh(Fl.i5U(4,7,"websiteItemLabel",e+i.fieldsEditThreshold+1)),Fl.R7$(2),Fl.Y8G("id",Fl.VkB("excludedDomain",e+i.fieldsEditThreshold))("name",Fl.VkB("excludedDomain",e+i.fieldsEditThreshold))("formControlName",Fl.mNQ(e))}}function jQ(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-section")(1,"bit-section-header")(2,"h2",8),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"span",9),Fl.EFF(6),Fl.k0s()(),Fl.DNE(7,VQ,3,2,"bit-item",10),Fl.j41(8,"form",11),Fl.DNE(9,BQ,7,10,"bit-card",12),Fl.j41(10,"button",13),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.addNewDomain())}),Fl.nrm(11,"i",14),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s()()()}if(2&e){const e=Fl.XpG();Fl.R7$(3),Fl.JRh(Fl.bMT(4,7,"domainsTitle")),Fl.R7$(3),Fl.JRh(e.excludedDomainsState.length+e.domainForms.value.length),Fl.R7$(),Fl.Y8G("ngForOf",e.excludedDomainsState)("ngForTrackBy",e.trackByFunction),Fl.R7$(),Fl.Y8G("formGroup",e.domainListForm),Fl.R7$(),Fl.Y8G("ngForOf",e.domainForms.controls),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(13,9,"addDomain")," ")}}class GQ{constructor(e,t,i,n,r){this.domainSettingsService=e,this.i18nService=t,this.toastService=i,this.formBuilder=n,this.popupRouterCacheService=r,this.uriInputElements=new Fl.rOR,this.dataIsPristine=!0,this.isLoading=!1,this.excludedDomainsState=[],this.storedExcludedDomains=[],this.domainListForm=new Il.gE({domains:this.formBuilder.array([])}),this.fieldsEditThreshold=0,this.destroy$=new Co.B}get domainForms(){return this.domainListForm.get("domains")}ngAfterViewInit(){return OQ(this,void 0,void 0,function*(){this.domainSettingsService.neverDomains$.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>this.handleStateUpdate(e)),this.uriInputElements.changes.pipe((0,vm.Q)(this.destroy$)).subscribe(({last:e})=>{this.focusNewUriInput(e)})})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}handleStateUpdate(e){e&&(this.storedExcludedDomains=Object.keys(e)),this.excludedDomainsState=[...this.storedExcludedDomains],this.fieldsEditThreshold=this.storedExcludedDomains.length,this.dataIsPristine=!0,this.isLoading=!1}focusNewUriInput(e){(null==e?void 0:e.nativeElement)&&e.nativeElement.focus()}addNewDomain(){return OQ(this,void 0,void 0,function*(){this.domainForms.push(this.formBuilder.control(null)),yield this.fieldChange()})}removeDomain(e){return OQ(this,void 0,void 0,function*(){this.excludedDomainsState.splice(e,1),e<this.fieldsEditThreshold&&this.fieldsEditThreshold--,yield this.fieldChange()})}goBack(){return OQ(this,void 0,void 0,function*(){yield this.popupRouterCacheService.back()})}fieldChange(){return OQ(this,void 0,void 0,function*(){this.dataIsPristine&&(this.dataIsPristine=!1)})}saveChanges(){return OQ(this,void 0,void 0,function*(){if(this.dataIsPristine)return;this.isLoading=!0;const e={},t=new Set([...this.excludedDomainsState,...this.domainForms.value]);for(const i of t)if(i&&""!==i){const t=bd.getHostname(i);if(!t)return this.toastService.showToast({message:this.i18nService.t("excludedDomainsInvalidDomain",i),title:"",variant:"error"}),void(this.isLoading=!1);e[t]=null}try{const t=new Set(this.storedExcludedDomains),i=new Set(Object.keys(e));if(t.size===i.size&&new Set([...t,...i]).size===t.size){const e=this.storedExcludedDomains.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:null}),{});this.handleStateUpdate(e)}else yield this.domainSettingsService.setNeverDomains(e);this.toastService.showToast({message:this.i18nService.t("excludedDomainsSavedSuccess"),title:"",variant:"success"}),this.domainForms.clear()}catch(e){this.toastService.showToast({message:this.i18nService.t("unexpectedError"),title:"",variant:"error"}),this.isLoading=!1}})}trackByFunction(e,t){return e}}GQ.ɵfac=function(e){return new(e||GQ)(Fl.rXU(YE),Fl.rXU(Ul),Fl.rXU(qb),Fl.rXU(Il.ok),Fl.rXU(WD))},GQ.ɵcmp=Fl.VBU({type:GQ,selectors:[["app-excluded-domains"]],viewQuery:function(e,t){if(1&e&&Fl.GBs(UQ,5),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.uriInputElements=e)}},decls:17,vars:15,consts:[["uriInput",""],["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[1,"tw-bg-background-alt"],[4,"ngIf"],["slot","footer"],["bitButton","","buttonType","primary","type","submit",3,"click","disabled"],["bitButton","","type","button","buttonType","secondary",3,"click"],["bitTypography","h6"],["bitTypography","body2","slot","end"],[4,"ngFor","ngForOf","ngForTrackBy"],[3,"formGroup"],["formArrayName","domains",4,"ngFor","ngForOf"],["bitLink","","type","button","linkType","primary",1,"tw-pt-2",3,"click"],["aria-hidden","true",1,"bwi","bwi-plus-circle","bwi-fw"],["bitIconButton","bwi-minus-circle","buttonType","danger","size","small","slot","end","type","button",3,"label","click",4,"ngIf"],[3,"id"],["bitIconButton","bwi-minus-circle","buttonType","danger","size","small","slot","end","type","button",3,"click","label"],["formArrayName","domains"],["disableMargin",""],["bitInput","","appInputVerbatim","","bitInput","","inputmode","url","type","text",3,"change","id","name","formControlName"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page")(1,"popup-header",1),Fl.nI1(2,"i18n"),Fl.qex(3,2),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.j41(5,"div",3)(6,"p"),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.DNE(9,jQ,14,11,"bit-section",4),Fl.k0s(),Fl.j41(10,"popup-footer",5)(11,"button",6),Fl.bIt("click",function(){return t.saveChanges()}),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s(),Fl.j41(14,"button",7),Fl.bIt("click",function(){return t.goBack()}),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s()()()),2&e&&(Fl.R7$(),Fl.Y8G("pageTitle",Fl.mNQ(Fl.bMT(2,7,"excludedDomains"))),Fl.R7$(6),Fl.SpI(" ",Fl.bMT(8,9,"excludedDomainsDesc")," "),Fl.R7$(2),Fl.Y8G("ngIf",!t.isLoading),Fl.R7$(2),Fl.Y8G("disabled",t.dataIsPristine),Fl.R7$(),Fl.SpI(" ",Fl.bMT(13,11,"save")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(16,13,"cancel")," "))},dependencies:[id,td,Ex,kl.MD,kl.Sq,kl.bT,Gu,Ac,fu,ju,Il.YN,Il.qT,Il.me,Il.BC,Il.cb,Il.X1,Il.j4,Il.JD,Il.v8,Ql,Zl,VP,GP,KP,sf,GI,Hh,uw,GD,TQ,aE,tE,Cw.iI,Ux,Nx,tc,rc,rf],encapsulation:2});class LQ{}var zQ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class _Q{constructor(e,t,i,n,r,s,o,a,l,c){this.i18nService=e,this.platformUtilsService=t,this.apiService=i,this.logService=n,this.dialogService=r,this.environmentService=s,this.toastService=a,this.billingApiService=c,this.price=10,this.storageProvidedGb=0,this.isPremium$=l.activeAccount$.pipe((0,go.n)(e=>o.hasPremiumFromAnySource$(e.id)))}ngOnInit(){return zQ(this,void 0,void 0,function*(){this.cloudWebVaultUrl=yield(0,bo._)(this.environmentService.cloudWebVaultUrl$);const e=yield this.billingApiService.getPremiumPlan();this.storageProvidedGb=e.storage.provided,this.price=e.seat.price})}refresh(){return zQ(this,void 0,void 0,function*(){try{this.refreshPromise=this.apiService.refreshIdentityToken(),yield this.refreshPromise,this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("refreshComplete")})}catch(e){this.logService.error(e)}})}purchase(){return zQ(this,void 0,void 0,function*(){const e={title:{key:"continueToBitwardenDotCom"},content:{key:"premiumPurchaseAlertV2"},type:"info",acceptButtonText:{key:"continue"},cancelButtonText:{key:"close"}};(yield this.dialogService.openSimpleDialog(e))&&this.platformUtilsService.launchUri(`${this.cloudWebVaultUrl}/#/settings/subscription/premium`)})}manage(){return zQ(this,void 0,void 0,function*(){(yield this.dialogService.openSimpleDialog({title:{key:"premiumManage"},content:{key:"premiumManageAlert"},type:"info"}))&&this.platformUtilsService.launchUri(`${this.cloudWebVaultUrl}/#/settings/subscription/premium`)})}}_Q.ɵfac=function(e){return new(e||_Q)(Fl.rXU(Ul),Fl.rXU(Hb),Fl.rXU(eI),Fl.rXU(Za),Fl.rXU(lh),Fl.rXU(mk),Fl.rXU(T$),Fl.rXU(qb),Fl.rXU(Zk),Fl.rXU(LQ))},_Q.ɵdir=Fl.FsC({type:_Q});class KQ{constructor(e,t,i){this.el=e,this.validationService=t,this.logService=i}ngOnChanges(e){null!=this.appApiAction&&null!=this.appApiAction.then&&(this.el.nativeElement.loading=!0,this.appApiAction.then(e=>{this.el.nativeElement.loading=!1},e=>{var t;this.el.nativeElement.loading=!1,null===(t=this.logService)||void 0===t||t.error("Received API exception:",e),this.validationService.showError(e)}))}}KQ.ɵfac=function(e){return new(e||KQ)(Fl.rXU(Fl.aKT),Fl.rXU(Ud),Fl.rXU(Za))},KQ.ɵdir=Fl.FsC({type:KQ,selectors:[["","appApiAction",""]],inputs:{appApiAction:"appApiAction"},standalone:!1,features:[Fl.OA$]});var XQ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class qQ extends _Q{constructor(e,t,i,n,r,s,o,a,l,c,u,d){super(e,t,i,n,o,a,l,c,u,d),this.location=r,this.currencyPipe=s}ngOnInit(){const e=Object.create(null,{ngOnInit:{get:()=>super.ngOnInit}});return XQ(this,void 0,void 0,function*(){yield e.ngOnInit.call(this);const t=this.currencyPipe.transform(this.price,"$"),i=this.platformUtilsService.isSafari()?t.replace("$","$$$"):t;this.priceString=this.i18nService.t("premiumPriceV2",i),this.priceString.indexOf("%price%")>-1&&(this.priceString=this.priceString.replace("%price%",t))})}goBack(){this.location.back()}}qQ.ɵfac=function(e){return new(e||qQ)(Fl.rXU(Ul),Fl.rXU(Hb),Fl.rXU(eI),Fl.rXU(Za),Fl.rXU(IF.aZ),Fl.rXU(kl.oe),Fl.rXU(lh),Fl.rXU(mk),Fl.rXU(T$),Fl.rXU(qb),Fl.rXU(Zk),Fl.rXU(LQ))},qQ.ɵcmp=Fl.VBU({type:qQ,selectors:[["app-premium"]],features:[Fl.Vt3],decls:47,vars:40,consts:[["refreshBtn",""],["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[1,"tw-flex","tw-flex-col","tw-p-2"],[1,"tw-font-medium"],[1,"tw-list-disc","tw-pl-5","tw-space-y-2","tw-break-words","tw-mb-0"],[1,"tw-mt-5","tw-mb-0"],["bitButton","","type","submit","buttonType","primary",1,"tw-mb-3",3,"click"],["aria-hidden","true",1,"bwi","bwi-external-link"],["type","button","bitButton","",3,"click","disabled","appApiAction"],[3,"hidden"],["aria-hidden","true",1,"bwi","bwi-spinner","bwi-spin","bwi-lg","bwi-fw",3,"hidden"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"popup-page")(1,"popup-header",1),Fl.nI1(2,"i18n"),Fl.qex(3,2),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.j41(5,"div",3)(6,"h2",4),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.j41(9,"bit-section")(10,"bit-card")(11,"div",3)(12,"ul",5)(13,"li"),Fl.EFF(14),Fl.nI1(15,"i18n"),Fl.k0s(),Fl.j41(16,"li"),Fl.EFF(17),Fl.nI1(18,"i18n"),Fl.k0s(),Fl.j41(19,"li"),Fl.EFF(20),Fl.nI1(21,"i18n"),Fl.k0s(),Fl.j41(22,"li"),Fl.EFF(23),Fl.nI1(24,"i18n"),Fl.k0s(),Fl.j41(25,"li"),Fl.EFF(26),Fl.nI1(27,"i18n"),Fl.k0s(),Fl.j41(28,"li"),Fl.EFF(29),Fl.nI1(30,"i18n"),Fl.k0s(),Fl.j41(31,"li"),Fl.EFF(32),Fl.nI1(33,"i18n"),Fl.k0s()()(),Fl.j41(34,"p",6),Fl.EFF(35),Fl.k0s()()(),Fl.j41(36,"button",7),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.purchase())}),Fl.j41(37,"b"),Fl.EFF(38),Fl.nI1(39,"i18n"),Fl.k0s(),Fl.nrm(40,"i",8),Fl.k0s(),Fl.j41(41,"button",9,0),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.refresh())}),Fl.j41(43,"span",10),Fl.EFF(44),Fl.nI1(45,"i18n"),Fl.k0s(),Fl.nrm(46,"i",11),Fl.k0s()()()}if(2&e){const e=Fl.sdS(42);Fl.R7$(),Fl.Y8G("pageTitle",Fl.mNQ(Fl.bMT(2,17,"premiumMembership"))),Fl.R7$(6),Fl.JRh(Fl.bMT(8,19,"premiumFeatures")),Fl.R7$(7),Fl.SpI(" ",Fl.i5U(15,21,"premiumSignUpStorageV2",`${t.storageProvidedGb} GB`)," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(18,24,"premiumSignUpTwoStepOptions")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(21,26,"premiumSignUpEmergency")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(24,28,"ppremiumSignUpReports")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(27,30,"ppremiumSignUpTotp")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(30,32,"ppremiumSignUpSupport")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(33,34,"ppremiumSignUpFuture")," "),Fl.R7$(3),Fl.JRh(t.priceString),Fl.R7$(3),Fl.JRh(Fl.bMT(39,36,"premiumPurchase")),Fl.R7$(3),Fl.Y8G("disabled",e.loading())("appApiAction",t.refreshPromise),Fl.R7$(2),Fl.Y8G("hidden",e.loading()),Fl.R7$(),Fl.JRh(Fl.bMT(45,38,"premiumRefresh")),Fl.R7$(2),Fl.Y8G("hidden",!e.loading())}},dependencies:[id,td,Ex,kl.MD,VP,sf,KQ,tE,aE,GD,Cw.iI,Ux,rf],encapsulation:2});const WQ={primary:["tw-bg-primary-100","tw-text-primary-700"],success:["tw-bg-success-100","tw-text-success-700"],warning:["tw-bg-warning-100","tw-text-warning-700"],danger:["tw-bg-danger-100","tw-text-danger-700"],muted:["tw-bg-secondary-100","tw-text-secondary-700"]},YQ={small:{container:["tw-w-6","tw-h-6"],icon:["tw-text-sm"]},default:{container:["tw-w-8","tw-h-8"],icon:["tw-text-base"]},large:{container:["tw-w-10","tw-h-10"],icon:["tw-text-lg"]}},HQ={square:{small:["tw-rounded"],default:["tw-rounded-md"],large:["tw-rounded-lg"]},circle:{small:["tw-rounded-full"],default:["tw-rounded-full"],large:["tw-rounded-full"]}};class JQ{constructor(){this.icon=o.hFB.required(),this.variant=(0,o.hFB)("primary"),this.size=(0,o.hFB)("default"),this.shape=(0,o.hFB)("square"),this.ariaLabel=(0,o.hFB)(),this.containerClasses=(0,Rl.EW)(()=>{const e=this.variant(),t=this.size(),i=this.shape();return["tw-inline-flex","tw-items-center","tw-justify-center","tw-flex-shrink-0",...WQ[e],...YQ[t].container,...HQ[i][t]]}),this.iconClasses=(0,Rl.EW)(()=>{const e=this.size();return["bwi",this.icon(),...YQ[e].icon]})}}JQ.ɵfac=function(e){return new(e||JQ)},JQ.ɵcmp=Fl.VBU({type:JQ,selectors:[["bit-icon-tile"]],inputs:{icon:[1,"icon"],variant:[1,"variant"],size:[1,"size"],shape:[1,"shape"],ariaLabel:[1,"ariaLabel"]},decls:2,vars:4,consts:[[3,"ngClass"],["aria-hidden","true",3,"ngClass"]],template:function(e,t){1&e&&(Fl.j41(0,"div",0),Fl.nrm(1,"i",1),Fl.k0s()),2&e&&(Fl.Y8G("ngClass",t.containerClasses()),Fl.BMQ("aria-label",t.ariaLabel())("role",t.ariaLabel()?"img":null),Fl.R7$(),Fl.Y8G("ngClass",t.iconClasses()))},dependencies:[kl.YU],encapsulation:2});var ZQ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const QQ=new wk("phishing-detection-continue"),e0=new wk("phishing-detection-cancel");class t0{static initialize(e,t,i,n){if(this._didInit)return void e.debug("[PhishingDetectionService] Initialize already called. Aborting.");e.debug("[PhishingDetectionService] Initialize called. Checking prerequisites..."),ul.addListener(chrome.tabs.onUpdated,this._handleTabUpdated.bind(this));const r=n.messages$(QQ).pipe((0,Oo.M)(t=>e.debug(`[PhishingDetectionService] user selected continue for ${t.url}`)),(0,go.n)(e=>ZQ(this,void 0,void 0,function*(){const t=new URL(e.url);this._ignoredHostnames.add(t.hostname),yield ul.navigateTabToUrl(e.tabId,t)}))),s=this._tabUpdated$.pipe((0,Eo.p)(e=>"complete"===e.changeInfo.status&&!!e.tab.url&&!this._isExtensionPage(e.tab.url)),(0,l.T)(({tab:e,tabId:t})=>{const i=new URL(e.url);return{tabId:t,url:i,ignored:this._ignoredHostnames.has(i.hostname)}}),(0,mo.F)((e,t)=>e.url.toString()===t.url.toString()&&e.tabId===t.tabId&&e.ignored===t.ignored),(0,Oo.M)(t=>e.debug("[PhishingDetectionService] processing event:",t)),(0,go.n)(e=>ZQ(this,[e],void 0,function*({tabId:e,url:i,ignored:n}){if(n)return void this._ignoredHostnames.delete(i.hostname);if(!(yield t.isPhishingWebAddress(i)))return;const r=new URL(ul.getRuntimeURL("popup/index.html#/security/phishing-warning")+`?phishingUrl=${i.toString()}`);yield ul.navigateTabToUrl(e,r)}))),o=n.messages$(e0).pipe((0,go.n)(e=>ul.closeTab(e.tabId))),a=i.on$.pipe((0,mo.F)(),(0,go.n)(i=>i?(e.debug("[PhishingDetectionService] Enabling phishing detection service"),(0,Po.h)(t.update$,r,s,o)):(e.debug("[PhishingDetectionService] User does not have access to phishing detection service."),Wp.w))).subscribe();return this._didInit=!0,()=>{t.dispose(),a.unsubscribe(),this._didInit=!1,ul.removeListener(chrome.tabs.onUpdated,t0._handleTabUpdated)}}static _handleTabUpdated(e,t,i){return this._tabUpdated$.next({tabId:e,changeInfo:t,tab:i}),!0}static _isExtensionPage(e){return e.startsWith("chrome-extension://")||e.startsWith("moz-extension://")||e.startsWith("safari-extension://")||e.startsWith("safari-web-extension://")}}t0._tabUpdated$=new Co.B,t0._ignoredHostnames=new Set,t0._didInit=!1;var i0=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class n0{constructor(){this.activatedRoute=(0,a.WQX)(Fd.nX),this.messageSender=(0,a.WQX)(bk),this.phishingUrl$=this.activatedRoute.queryParamMap.pipe((0,l.T)(e=>e.get("phishingUrl")||"")),this.phishingHostname$=this.phishingUrl$.pipe((0,l.T)(e=>new URL(e).hostname))}closeTab(){return i0(this,void 0,void 0,function*(){const e=yield this.getTabId();this.messageSender.send(e0,{tabId:e})})}continueAnyway(){return i0(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.phishingUrl$),t=yield this.getTabId();this.messageSender.send(QQ,{tabId:t,url:e})})}getTabId(){return i0(this,void 0,void 0,function*(){var e;return null===(e=ul.getCurrentTab())||void 0===e?void 0:e.then(e=>e.id)})}}n0.ɵfac=function(e){return new(e||n0)},n0.ɵcmp=Fl.VBU({type:n0,selectors:[["dirt-phishing-warning"]],decls:33,vars:27,consts:[[1,"tw-flex","tw-flex-col"],[1,"tw-flex","tw-gap-4","tw-items-baseline"],["size","large","icon","bwi-exclamation-triangle","variant","danger"],["bitTypography","h2","noMargin","",1,"!tw-mb-0"],[1,"!tw-mt-6","!tw-mb-4","!tw-border-secondary-100"],["bitTypography","body1"],["type","danger","icon","bwi-globe",1,"tw-mb-0",3,"title"],[1,"tw-font-mono","tw-break-all"],["type","default",1,"tw-mt-2",3,"icon"],["bitTypography","body2"],["bitLink","","linkType","primary","rel","noreferrer","target","_blank","href","https://bitwarden.com/help/phishing-blocked/"],["aria-hidden","true",1,"bwi","bwi-angle-right"],[1,"tw-flex","tw-flex-col","tw-gap-4","tw-items-center","tw-mt-2"],["type","button","bitButton","","buttonType","primary",3,"click","block"],["type","button","bitLink","","linkType","secondary",1,"tw-text-sm",3,"click"]],template:function(e,t){1&e&&(Fl.j41(0,"div",0)(1,"div",1),Fl.nrm(2,"bit-icon-tile",2),Fl.j41(3,"h1",3),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()(),Fl.nrm(6,"hr",4),Fl.j41(7,"p",5),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.j41(10,"bit-callout",6)(11,"span",7),Fl.EFF(12),Fl.nI1(13,"async"),Fl.k0s()(),Fl.j41(14,"bit-callout",8)(15,"p",9),Fl.EFF(16),Fl.nI1(17,"i18n"),Fl.j41(18,"b"),Fl.EFF(19,"Phishing.Database"),Fl.k0s(),Fl.EFF(20),Fl.nI1(21,"i18n"),Fl.k0s(),Fl.j41(22,"a",10),Fl.EFF(23),Fl.nI1(24,"i18n"),Fl.nrm(25,"i",11),Fl.k0s()(),Fl.j41(26,"div",12)(27,"button",13),Fl.bIt("click",function(){return t.closeTab()}),Fl.EFF(28),Fl.nI1(29,"i18n"),Fl.k0s(),Fl.j41(30,"button",14),Fl.bIt("click",function(){return t.continueAnyway()}),Fl.EFF(31),Fl.nI1(32,"i18n"),Fl.k0s()()()),2&e&&(Fl.R7$(4),Fl.JRh(Fl.bMT(5,11,"phishingPageTitleV2")),Fl.R7$(4),Fl.JRh(Fl.bMT(9,13,"phishingPageSummary")),Fl.R7$(2),Fl.Y8G("title",null),Fl.R7$(2),Fl.JRh(Fl.bMT(13,15,t.phishingHostname$)),Fl.R7$(2),Fl.Y8G("icon",null),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(17,17,"phishingPageExplanation1")),Fl.R7$(4),Fl.SpI("",Fl.bMT(21,19,"phishingPageExplanation2")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(24,21,"phishingPageLearnMore")),Fl.R7$(4),Fl.Y8G("block",!0),Fl.R7$(),Fl.SpI(" ",Fl.bMT(29,23,"phishingPageCloseTabV2")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(32,25,"phishingPageContinueV2")," "))},dependencies:[kl.MD,Yh,sf,Hh,uw,Gu,pc,hd,id,td,Cw.iI,JQ,ud,tc,rc,kl.Jj,rf],encapsulation:2});class r0{}r0.ɵfac=function(e){return new(e||r0)},r0.ɵcmp=Fl.VBU({type:r0,selectors:[["dirt-phishing-protected-by"]],decls:3,vars:4,consts:[[1,"tw-text-muted"]],template:function(e,t){1&e&&(Fl.rj2(0,"span",0),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.eux()),2&e&&(Fl.R7$(),Fl.JRh(Fl.i5U(2,1,"protectedBy","Bitwarden phishing blocker")))},dependencies:[kl.MD,sf,id,Hh,rf],encapsulation:2});var s0=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function o0(e,t){1&e&&Fl.nrm(0,"bit-empty-credential-history",6)}function a0(e,t){if(1&e&&(Fl.nrm(0,"bit-credential-generator-history",7),Fl.nI1(1,"async")),2&e){const e=Fl.XpG();Fl.Y8G("account",Fl.bMT(1,1,e.account$))}}class l0{constructor(e,t,i,n){this.accountService=e,this.history=t,this.dialogService=i,this.logService=n,this.destroyed=new Co.B,this.hasHistory$=new Ro.m(1),this.account$=new Ro.m(1),this.debug=!1,this.log=rj(),this.clear=()=>s0(this,void 0,void 0,function*(){(yield this.dialogService.openSimpleDialog({title:{key:"clearGeneratorHistoryTitle"},content:{key:"cleargGeneratorHistoryDescription"},type:"warning",acceptButtonText:{key:"clearHistory"},cancelButtonText:{key:"cancel"}}))&&(yield this.history.clear((yield(0,bo._)(this.account$)).id))})}ngOnChanges(e){return s0(this,void 0,void 0,function*(){var t,i,n,r,s;const o=null==e?void 0:e.account;(null===(t=null==o?void 0:o.previousValue)||void 0===t?void 0:t.id)!==(null===(i=null==o?void 0:o.currentValue)||void 0===i?void 0:i.id)&&(this.log.debug({previousUserId:null===(n=null==o?void 0:o.previousValue)||void 0===n?void 0:n.id,currentUserId:null===(r=null==o?void 0:o.currentValue)||void 0===r?void 0:r.id},"account input change detected"),this.account$.next(null!==(s=o.currentValue)&&void 0!==s?s:this.account))})}ngOnInit(){return s0(this,void 0,void 0,function*(){this.log=oj(this.debug,this.logService,{type:"CredentialGeneratorComponent"}),this.account||(this.account=yield(0,bo._)(this.accountService.activeAccount$),this.log.info({userId:this.account.id},"account not specified; using active account settings"),this.account$.next(this.account)),this.account$.pipe((0,go.n)(e=>e.id&&this.history.credentials$(e.id)),(0,l.T)(e=>e.length>0),(0,vm.Q)(this.destroyed)).subscribe(this.hasHistory$)})}ngOnDestroy(){this.destroyed.next(),this.destroyed.complete(),this.log.debug("component destroyed")}}l0.ɵfac=function(e){return new(e||l0)(Fl.rXU(Zk),Fl.rXU(Xy),Fl.rXU(lh),Fl.rXU(Za))},l0.ɵcmp=Fl.VBU({type:l0,selectors:[["app-credential-generator-history"]],inputs:{account:"account",debug:"debug"},features:[Fl.OA$],decls:14,vars:15,consts:[["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],["style","display: contents",4,"ngIf"],[3,"account",4,"ngIf"],["slot","footer"],["bitButton","","type","submit","buttonType","primary",3,"click","disabled"],[2,"display","contents"],[3,"account"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page")(1,"popup-header",0),Fl.nI1(2,"i18n"),Fl.qex(3,1),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.DNE(5,o0,1,0,"bit-empty-credential-history",2),Fl.nI1(6,"async"),Fl.DNE(7,a0,2,3,"bit-credential-generator-history",3),Fl.nI1(8,"async"),Fl.j41(9,"popup-footer",4)(10,"button",5),Fl.nI1(11,"async"),Fl.bIt("click",function(){return t.clear()}),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s()()()),2&e&&(Fl.R7$(),Fl.Y8G("pageTitle",Fl.bMT(2,5,"generatorHistory")),Fl.R7$(4),Fl.Y8G("ngIf",!Fl.bMT(6,7,t.hasHistory$)),Fl.R7$(2),Fl.Y8G("ngIf",Fl.bMT(8,9,t.hasHistory$)),Fl.R7$(3),Fl.Y8G("disabled",!Fl.bMT(11,11,t.hasHistory$)),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(13,13,"clearHistory")," "))},dependencies:[id,td,kl.MD,kl.bT,sf,GD,aE,tE,sG,uG,TQ,kl.Jj,rf],encapsulation:2});class c0{}c0.ɵfac=function(e){return new(e||c0)},c0.ɵcmp=Fl.VBU({type:c0,selectors:[["credential-generator"]],decls:12,vars:6,consts:[["slot","header",3,"pageTitle"],["slot","end"],["type","button","bit-item-content","","routerLink","/generator-history"],["slot","end","aria-hidden","true",1,"bwi","bwi-angle-right"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page")(1,"popup-header",0),Fl.nI1(2,"i18n"),Fl.qex(3,1),Fl.nrm(4,"app-pop-out")(5,"app-current-account"),Fl.bVm(),Fl.k0s(),Fl.nrm(6,"tools-credential-generator"),Fl.j41(7,"bit-item")(8,"a",2),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.nrm(11,"i",3),Fl.k0s()()()),2&e&&(Fl.R7$(),Fl.Y8G("pageTitle",Fl.bMT(2,2,"generator")),Fl.R7$(8),Fl.SpI(" ",Fl.bMT(10,4,"generatorHistory")," "))},dependencies:[EG,iG,_F,sf,GD,aE,tE,Cw.iI,Cw.Wk,VP,GP,KP,rf],encapsulation:2});const u0=Object.freeze({Text:0,File:1});var d0=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function h0(){return(e,t)=>d0(this,void 0,void 0,function*(){var e,i,n,r;if(function(e){if(!e.includes("/add-send")&&!e.includes("/edit-send"))return!1;const t=e.indexOf("?");if(-1===t)return!1;const i=e.substring(t+1),n=new URLSearchParams(i);return n.get("type")===String(u0.Text)}(t.url))return!0;const s=sl.getDevice(window),o=pl.inPopout(window),a=pl.inSidebar(window);let l=!1;s!==Ea.FirefoxExtension||o||a||(l=!0),s!==Ea.SafariExtension||o||(l=!0);const c=[Ea.ChromeExtension,Ea.EdgeExtension,Ea.OperaExtension,Ea.VivaldiExtension].includes(s),u=null===(i=null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.userAgent)||void 0===i?void 0:i.includes("Linux"),d=null===(r=null===(n=null===window||void 0===window?void 0:window.navigator)||void 0===n?void 0:n.userAgent)||void 0===r?void 0:r.includes("Mac OS X");return!c||!u&&!d||o||a||(l=!0),!l||(yield pl.openPopout(`popup/index.html#${t.url}`),ul.closePopup(window),!1)})}class p0{}class v0{constructor(e){this.id=null,this.size=null,this.sizeName=null,this.fileName=null,e&&(this.id=e.id,this.size=e.size,this.sizeName=e.sizeName)}get fileSize(){try{if(null!=this.size)return parseInt(this.size,null)}catch(e){}return 0}static fromJSON(e){return null==e?null:Object.assign(new v0,e)}}class f0{constructor(e){this.text=null,e&&(this.hidden=e.hidden)}get maskedText(){return null!=this.text?"••••••••":null}static fromJSON(e){return null==e?null:Object.assign(new f0,e)}}class m0{constructor(e){this.id=null,this.accessId=null,this.name=null,this.notes=null,this.type=null,this.text=new f0,this.file=new v0,this.maxAccessCount=null,this.accessCount=0,this.revisionDate=null,this.deletionDate=null,this.expirationDate=null,this.password=null,this.emails=[],this.disabled=!1,this.hideEmail=!1,this.authType=null,e&&(this.id=e.id,this.accessId=e.accessId,this.type=e.type,this.authType=e.authType,this.maxAccessCount=e.maxAccessCount,this.accessCount=e.accessCount,this.revisionDate=e.revisionDate,this.deletionDate=e.deletionDate,this.expirationDate=e.expirationDate,this.disabled=e.disabled,this.password=e.password,this.hideEmail=e.hideEmail,this.authType=e.authType)}get urlB64Key(){return bd.fromBufferToUrlB64(this.key)}get maxAccessCountReached(){return null!=this.maxAccessCount&&this.accessCount>=this.maxAccessCount}get expired(){return null!=this.expirationDate&&this.expirationDate<=new Date}get pendingDelete(){return this.deletionDate<=new Date}toJSON(){return bd.merge(Object.assign({},this),{key:bd.fromBufferToB64(this.key)})}static fromJSON(e){return null==e?null:Object.assign(new m0,e,{key:bd.fromB64ToArray(e.key),cryptoKey:Dv.fromJSON(e.cryptoKey),text:f0.fromJSON(e.text),file:v0.fromJSON(e.file),revisionDate:null==e.revisionDate?null:new Date(e.revisionDate),deletionDate:null==e.deletionDate?null:new Date(e.deletionDate),expirationDate:null==e.expirationDate?null:new Date(e.expirationDate)})}}class g0{}const y0=Object.freeze({Email:0,Password:1,None:2});function b0(e,t){if(1&e&&(Fl.j41(0,"bit-hint"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.SpI(" ",Fl.i5U(2,1,"limitSendViewsCount",e.viewsLeft))}}function w0(e,t){if(1&e&&(Fl.j41(0,"bit-form-control"),Fl.nrm(1,"input",5),Fl.j41(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("disabled",e.disableHideEmail&&!e.sendOptionsForm.get("hideEmail").value),Fl.R7$(2),Fl.JRh(Fl.bMT(4,2,"hideYourEmail"))}}class S0{get shouldShowCount(){return"edit"===this.config.mode&&null!==this.sendOptionsForm.value.maxAccessCount}get viewsLeft(){return String(this.sendOptionsForm.value.maxAccessCount?this.sendOptionsForm.value.maxAccessCount-this.sendOptionsForm.value.accessCount:0)}constructor(e,t,i,n){this.sendFormContainer=e,this.formBuilder=t,this.policyService=i,this.accountService=n,this.disableHideEmail=!1,this.sendOptionsForm=this.formBuilder.group({maxAccessCount:[null],accessCount:[null],notes:[null],hideEmail:[!1]}),this.sendFormContainer.registerChildForm("sendOptionsForm",this.sendOptionsForm),this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.policyService.policiesByType$(op.SendOptions,e)),(0,l.T)(e=>null==e?void 0:e.some(e=>e.data.disableHideEmail)),(0,xl.pQ)()).subscribe(e=>{this.disableHideEmail=e}),this.sendOptionsForm.valueChanges.pipe((0,xl.pQ)()).subscribe(e=>{this.sendFormContainer.patchSend(t=>(Object.assign(t,{maxAccessCount:e.maxAccessCount,accessCount:e.accessCount,hideEmail:e.hideEmail,notes:e.notes}),t))})}ngOnInit(){this.sendFormContainer.originalSendView&&this.sendOptionsForm.patchValue({maxAccessCount:this.sendFormContainer.originalSendView.maxAccessCount,accessCount:this.sendFormContainer.originalSendView.accessCount,hideEmail:this.sendFormContainer.originalSendView.hideEmail,notes:this.sendFormContainer.originalSendView.notes}),this.config.areSendsAllowed||this.sendOptionsForm.disable()}}function k0(e,t){if(1&e&&(Fl.j41(0,"div")(1,"div",3),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"div",4),Fl.EFF(5),Fl.k0s(),Fl.j41(6,"div",5),Fl.EFF(7),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.JRh(Fl.bMT(3,3,"file")),Fl.R7$(3),Fl.SpI(" ",e.originalSendView().file.fileName," "),Fl.R7$(2),Fl.JRh(e.originalSendView().file.sizeName)}}function I0(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-form-field")(1,"bit-label",6),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"div",7)(5,"button",8),Fl.bIt("click",function(){a.eBV(e);const t=Fl.sdS(12);return a.Njj(t.click())}),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s(),Fl.j41(8,"span",9),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s()(),Fl.j41(11,"input",10,0),Fl.bIt("change",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.onFileSelected(t))}),Fl.k0s(),Fl.j41(13,"bit-hint"),Fl.EFF(14),Fl.nI1(15,"i18n"),Fl.k0s()()}if(2&e){const e=Fl.XpG();Fl.R7$(2),Fl.JRh(Fl.bMT(3,5,"fileToShare")),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(7,7,"chooseFile")," "),Fl.R7$(2),Fl.Y8G("ngClass",e.fileName?"tw-text-main":"tw-text-muted"),Fl.R7$(),Fl.SpI(" ",e.fileName||Fl.bMT(10,9,"noFileChosen")),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(15,11,"maxFileSize")," ")}}S0.ɵfac=function(e){return new(e||S0)(Fl.rXU(g0),Fl.rXU(Il.ok),Fl.rXU(Jb),Fl.rXU(Zk))},S0.ɵcmp=Fl.VBU({type:S0,selectors:[["tools-send-options"]],inputs:{config:"config",originalSendView:"originalSendView"},decls:21,vars:15,consts:[["disableMargin","",3,"formGroup"],["bitTypography","h6",1,"tw-mt-4"],["bitInput","","type","number","formControlName","maxAccessCount","min","1"],["disableMargin",""],["bitInput","","rows","3","formControlName","notes"],["bitCheckbox","","type","checkbox","formControlName","hideEmail",3,"disabled"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-section",0)(1,"bit-section-header")(2,"h2",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"bit-card")(6,"bit-form-field")(7,"bit-label"),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.nrm(10,"input",2),Fl.j41(11,"bit-hint"),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s(),Fl.nVh(14,b0,3,4,"bit-hint"),Fl.k0s(),Fl.nVh(15,w0,5,4,"bit-form-control"),Fl.j41(16,"bit-form-field",3)(17,"bit-label"),Fl.EFF(18),Fl.nI1(19,"i18n"),Fl.k0s(),Fl.nrm(20,"textarea",4),Fl.k0s()()()),2&e&&(Fl.Y8G("formGroup",t.sendOptionsForm),Fl.R7$(3),Fl.JRh(Fl.bMT(4,7,"additionalOptions")),Fl.R7$(5),Fl.JRh(Fl.bMT(9,9,"limitSendViews")),Fl.R7$(4),Fl.JRh(Fl.bMT(13,11,"limitSendViewsHint")),Fl.R7$(2),Fl.vxM(t.shouldShowCount?14:-1),Fl.R7$(),Fl.vxM(!t.disableHideEmail||null!=t.originalSendView&&t.originalSendView.hideEmail?15:-1),Fl.R7$(3),Fl.JRh(Fl.bMT(19,13,"privateNote")))},dependencies:[pc,id,Ex,hd,Qb,kl.MD,Gu,Sc,Ac,hu,fu,ju,Ql,sf,Il.X1,Il.me,Il.Q0,Il.Zm,Il.BC,Il.cb,Il.VZ,Il.j4,Il.JD,Ux,Nx,Wu,tc,rc,rf],encapsulation:2});class C0{constructor(e,t){this.formBuilder=e,this.sendFormContainer=t,this.config=o.hFB.required(),this.originalSendView=(0,o.hFB)(),this.sendFileDetailsForm=this.formBuilder.group({file:this.formBuilder.control(null,Il.k0.required)}),this.FileSendType=u0.File,this.fileName="",this.onFileSelected=e=>{var t;const i=null===(t=e.target.files)||void 0===t?void 0:t[0];i&&(this.fileName=i.name,this.sendFormContainer.onFileSelected(i))},this.sendFormContainer.registerChildForm("sendFileDetailsForm",this.sendFileDetailsForm),this.sendFileDetailsForm.valueChanges.pipe((0,xl.pQ)()).subscribe(e=>{this.sendFormContainer.patchSend(t=>Object.assign(t,{file:e.file}))})}ngOnInit(){var e;this.originalSendView()&&this.sendFileDetailsForm.patchValue({file:null===(e=this.originalSendView())||void 0===e?void 0:e.file}),this.config().areSendsAllowed||this.sendFileDetailsForm.disable()}}C0.ɵfac=function(e){return new(e||C0)(Fl.rXU(Il.ok),Fl.rXU(g0))},C0.ɵcmp=Fl.VBU({type:C0,selectors:[["tools-send-file-details"]],inputs:{config:[1,"config"],originalSendView:[1,"originalSendView"]},decls:3,vars:3,consts:[["fileSelector",""],[3,"formGroup"],[4,"ngIf"],["bitTypography","body2",1,"tw-text-muted"],["data-testid","file-name",1,"tw-text-wrap","tw-break-all"],["data-testid","file-size",1,"tw-text-muted"],["for","file"],[1,"tw-flex","tw-mt-2","tw-mb-1"],["bitButton","","type","button","buttonType","secondary",3,"click"],[1,"tw-flex","tw-items-center","tw-pl-3",3,"ngClass"],["bitInput","","type","file","formControlName","file","hidden","",3,"change"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-section",1),Fl.DNE(1,k0,8,5,"div",2)(2,I0,16,13,"bit-form-field",2),Fl.k0s()),2&e&&(Fl.Y8G("formGroup",t.sendFileDetailsForm),Fl.R7$(),Fl.Y8G("ngIf","edit"===t.config().mode),Fl.R7$(),Fl.Y8G("ngIf","edit"!==t.config().mode))},dependencies:[id,td,kl.MD,kl.YU,kl.bT,sf,Il.X1,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,Gu,Ac,hu,fu,ju,Ux,Il.YN,tc,rc,rf],encapsulation:2});var T0=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class P0{constructor(e,t){this.formBuilder=e,this.sendFormContainer=t,this.config=o.hFB.required(),this.originalSendView=(0,o.hFB)(),this.sendTextDetailsForm=this.formBuilder.group({text:new Il.MJ("",Il.k0.required),hidden:new Il.MJ(!1)}),this.sendFormContainer.registerChildForm("sendTextDetailsForm",this.sendTextDetailsForm),this.sendTextDetailsForm.valueChanges.pipe((0,xl.pQ)()).subscribe(e=>{this.sendFormContainer.patchSend(t=>Object.assign(t,{text:{text:e.text,hidden:e.hidden}}))})}ngOnInit(){return T0(this,void 0,void 0,function*(){var e,t,i,n;this.sendTextDetailsForm.patchValue({text:(null===(t=null===(e=this.originalSendView())||void 0===e?void 0:e.text)||void 0===t?void 0:t.text)||"",hidden:(null===(n=null===(i=this.originalSendView())||void 0===i?void 0:i.text)||void 0===n?void 0:n.hidden)||!1}),this.config().areSendsAllowed||this.sendTextDetailsForm.disable()})}}P0.ɵfac=function(e){return new(e||P0)(Fl.rXU(Il.ok),Fl.rXU(g0))},P0.ɵcmp=Fl.VBU({type:P0,selectors:[["tools-send-text-details"]],inputs:{config:[1,"config"],originalSendView:[1,"originalSendView"]},decls:11,vars:7,consts:[["disableMargin","",3,"formGroup"],["bitInput","","id","text","rows","3","formControlName","text"],["bitCheckbox","","type","checkbox","formControlName","hidden"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-section",0)(1,"bit-form-field")(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.nrm(5,"textarea",1),Fl.k0s(),Fl.j41(6,"bit-form-control"),Fl.nrm(7,"input",2),Fl.j41(8,"bit-label"),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s()()()),2&e&&(Fl.Y8G("formGroup",t.sendTextDetailsForm),Fl.R7$(3),Fl.JRh(Fl.bMT(4,3,"sendTypeTextToShare")),Fl.R7$(6),Fl.JRh(Fl.bMT(10,5,"hideTextByDefault")))},dependencies:[hd,Qb,kl.MD,sf,Il.X1,Il.me,Il.Zm,Il.BC,Il.cb,Il.j4,Il.JD,Gu,Sc,Ac,fu,ju,Ux,rf],encapsulation:2});class F0{}var R0=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const x0=(e,t)=>t.value;function A0(e,t){if(1&e&&Fl.nrm(0,"tools-send-text-details",13),2&e){const e=Fl.XpG();Fl.Y8G("config",e.config)("originalSendView",e.originalSendView)}}function D0(e,t){if(1&e&&Fl.nrm(0,"tools-send-file-details",13),2&e){const e=Fl.XpG();Fl.Y8G("config",e.config)("originalSendView",e.originalSendView)}}function E0(e,t){if(1&e&&Fl.nrm(0,"bit-option",9),2&e){const e=t.$implicit;Fl.Y8G("value",e.value)("label",e.name)}}function $0(e,t){if(1&e&&Fl.nrm(0,"bit-option",9),2&e){const e=t.$implicit;Fl.Y8G("value",e.value)("label",e.name)}}function O0(e,t){1&e&&(Fl.j41(0,"bit-hint",1),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.JRh(Fl.bMT(2,1,"emailVerificationDesc")))}function U0(e,t){1&e&&(Fl.j41(0,"bit-hint",1),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.JRh(Fl.bMT(2,1,"sendPasswordHelperText")))}function M0(e,t){if(1&e){const e=Fl.RV6();Fl.nrm(0,"button",17),Fl.j41(1,"button",18),Fl.nI1(2,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.generatePassword())}),Fl.k0s(),Fl.nrm(3,"button",19),Fl.nI1(4,"i18n"),Fl.nI1(5,"i18n")}if(2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("label",Fl.bMT(2,6,"generatePassword"))("disabled",!e.config.areSendsAllowed),Fl.R7$(2),Fl.Y8G("label",Fl.bMT(4,8,"copyPassword"))("disabled",!e.config.areSendsAllowed||!e.sendDetailsForm.get("password").value)("valueLabel",Fl.bMT(5,10,"password"))("appCopyClick",e.sendDetailsForm.get("password").value)}}function N0(e,t){if(1&e&&(Fl.nrm(0,"button",16),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG(2);Fl.Y8G("label",Fl.bMT(1,2,"removePassword"))("bitAction",e.removePassword)}}function V0(e,t){if(1&e&&(Fl.j41(0,"bit-form-field",10)(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",14),Fl.j41(5,"div",15),Fl.nVh(6,M0,6,12)(7,N0,2,4,"button",16),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.JRh(Fl.bMT(3,2,e.passwordRemoved?"newPassword":"password")),Fl.R7$(4),Fl.vxM(e.hasPassword?7:6)}}function B0(e,t){1&e&&(Fl.j41(0,"bit-form-field",11)(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"textarea",20),Fl.nI1(5,"i18n"),Fl.j41(6,"bit-hint"),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s()()),2&e&&(Fl.R7$(2),Fl.JRh(Fl.bMT(3,3,"emails")),Fl.R7$(2),Fl.Y8G("placeholder",Fl.bMT(5,5,"emailPlaceholder")),Fl.R7$(3),Fl.JRh(Fl.bMT(8,7,"enterMultipleEmailsSeparatedByComma")))}function j0(e,t){if(1&e&&(Fl.j41(0,"bit-form-field",21)(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.nrm(4,"input",22)(5,"button",23),Fl.nI1(6,"i18n"),Fl.nI1(7,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.JRh(Fl.bMT(3,5,"sendLink")),Fl.R7$(2),Fl.Y8G("value",e.sendLink),Fl.R7$(),Fl.Y8G("appCopyClick",e.sendLink)("valueLabel",Fl.bMT(6,7,"sendLink"))("label",Fl.bMT(7,9,"copySendLink"))}}const G0=Object.freeze({OneHour:1,OneDay:24,TwoDays:48,ThreeDays:72,SevenDays:168,FourteenDays:336,ThirtyDays:720}),L0=new Map(Object.entries(G0).map(([e,t])=>[t,e]));function z0(e){return L0.has(e)}class _0{get hasPassword(){var e;return null!=(null===(e=this.originalSendView)||void 0===e?void 0:e.password)}constructor(e,t,i,n,r,s,o,a,c,u,d,h){this.sendFormContainer=e,this.formBuilder=t,this.i18nService=i,this.datePipe=n,this.environmentService=r,this.configService=s,this.accountService=o,this.billingAccountProfileStateService=a,this.generatorService=c,this.sendApiService=u,this.dialogService=d,this.toastService=h,this.FileSendType=u0.File,this.TextSendType=u0.Text,this.AuthType=y0,this.sendLink=null,this.customDeletionDateOption=null,this.datePresetOptions=[],this.passwordRemoved=!1,this.emailVerificationFeatureFlag$=this.configService.getFeatureFlag$(Wv.SendEmailOTP),this.hasPremium$=this.accountService.activeAccount$.pipe((0,go.n)(e=>this.billingAccountProfileStateService.hasPremiumFromAnySource$(e.id))),this.authTypes=[{name:this.i18nService.t("noAuth"),value:y0.None},{name:this.i18nService.t("specificPeople"),value:y0.Email},{name:this.i18nService.t("anyOneWithPassword"),value:y0.Password}],this.availableAuthTypes$=(0,jo.z)([this.emailVerificationFeatureFlag$,this.hasPremium$]).pipe((0,l.T)(([e,t])=>e&&t?this.authTypes:this.authTypes.filter(e=>e.value!==y0.Email))),this.sendDetailsForm=this.formBuilder.group({name:new Il.MJ("",Il.k0.required),selectedDeletionDatePreset:new Il.MJ(G0.SevenDays||"",Il.k0.required),authType:[y0.None],password:[null],emails:[null]}),this.generatePassword=()=>R0(this,void 0,void 0,function*(){const e=new Dd.t({source:"send",type:Mm.password}),t=this.accountService.activeAccount$.pipe(Em({name:()=>"send-details.component",distinct:(e,t)=>e.id===t.id})),i=yield(0,bo._)(this.generatorService.generate$({on$:e,account$:t}));this.sendDetailsForm.patchValue({password:i.credential})}),this.removePassword=()=>R0(this,void 0,void 0,function*(){var e,t;if(!(null===(e=this.originalSendView)||void 0===e?void 0:e.password))return;if(!(yield this.dialogService.openSimpleDialog({title:{key:"removePassword"},content:{key:"removePasswordConfirmation"},type:"warning"})))return!1;this.passwordRemoved=!0,yield this.sendApiService.removePassword(this.originalSendView.id),this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("removedPassword")}),this.originalSendView.password=null,this.sendDetailsForm.patchValue({password:null}),null===(t=this.sendDetailsForm.get("password"))||void 0===t||t.enable()}),this.sendDetailsForm.valueChanges.pipe((0,Oo.M)(e=>{bd.isNullOrWhitespace(e.password)&&(e.password=null)}),(0,xl.pQ)()).subscribe(e=>{this.sendFormContainer.patchSend(t=>Object.assign(t,{name:e.name,deletionDate:new Date(this.formattedDeletionDate),expirationDate:new Date(this.formattedDeletionDate),password:e.password,authType:e.authType,emails:e.emails?e.emails.split(",").map(e=>e.trim()).filter(e=>e.length>0):null}))}),this.sendDetailsForm.get("authType").valueChanges.pipe((0,xl.pQ)()).subscribe(e=>{const t=this.sendDetailsForm.get("emails"),i=this.sendDetailsForm.get("password");e===y0.Password?(t.setValue(null),t.clearValidators(),i.setValidators([Il.k0.required])):e===y0.Email?(i.setValue(null),i.clearValidators(),t.setValidators([this.emailsRequiredForEmailAuthValidator(),this.emailListValidator()])):(t.setValue(null),t.clearValidators(),i.setValue(null),i.clearValidators()),t.updateValueAndValidity(),i.updateValueAndValidity()}),this.sendFormContainer.registerChildForm("sendDetailsForm",this.sendDetailsForm)}ngOnInit(){return R0(this,void 0,void 0,function*(){var e,t,i;if(this.setupDeletionDatePresets(),this.originalSendView){this.sendDetailsForm.patchValue({name:this.originalSendView.name,selectedDeletionDatePreset:this.originalSendView.deletionDate.toString(),password:this.hasPassword?"************":null,authType:this.originalSendView.authType,emails:null!==(t=null===(e=this.originalSendView.emails)||void 0===e?void 0:e.join(", "))&&void 0!==t?t:null}),this.hasPassword&&(null===(i=this.sendDetailsForm.get("password"))||void 0===i||i.disable()),this.originalSendView.deletionDate&&(this.customDeletionDateOption={name:this.datePipe.transform(this.originalSendView.deletionDate,"short"),value:this.originalSendView.deletionDate.toString()},this.datePresetOptions.unshift(this.customDeletionDateOption));const n=yield(0,bo._)(this.environmentService.environment$);this.sendLink=n.getSendUrl()+this.originalSendView.accessId+"/"+this.originalSendView.urlB64Key}this.config.areSendsAllowed||this.sendDetailsForm.disable()})}setupDeletionDatePresets(){const e=[{name:this.i18nService.t("oneHour"),value:G0.OneHour},{name:this.i18nService.t("oneDay"),value:G0.OneDay},{name:this.i18nService.t("days","2"),value:G0.TwoDays},{name:this.i18nService.t("days","3"),value:G0.ThreeDays},{name:this.i18nService.t("days","7"),value:G0.SevenDays},{name:this.i18nService.t("days","14"),value:G0.FourteenDays},{name:this.i18nService.t("days","30"),value:G0.ThirtyDays}];this.datePresetOptions=e}get formattedDeletionDate(){const e=new Date,t=this.sendDetailsForm.controls.selectedDeletionDatePreset.value;if("string"==typeof t)return t;const i=z0(n=t)?n:void 0;var n;if(!z0(i))return new Date(e).toString();const r=e.setTime(e.getTime()+60*i*60*1e3);return new Date(r).toString()}emailListValidator(){return e=>{if(!e.value)return null;const t=e.value.split(",").map(e=>e.trim()),i=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return t.filter(e=>e.length>0&&!i.test(e)).length>0?{multipleEmails:!0}:null}}emailsRequiredForEmailAuthValidator(){return e=>{var t,i;const n=null===(i=null===(t=this.sendDetailsForm)||void 0===t?void 0:t.get("authType"))||void 0===i?void 0:i.value,r=e.value;return n!==y0.Email||r&&""!==r.trim()?null:{emailsRequiredForEmailAuth:{message:this.i18nService.t("emailsRequiredChangeAccessType")}}}}}_0.ɵfac=function(e){return new(e||_0)(Fl.rXU(g0),Fl.rXU(Il.ok),Fl.rXU(Ul),Fl.rXU(kl.vh),Fl.rXU(mk),Fl.rXU(Kb),Fl.rXU(Zk),Fl.rXU(T$),Fl.rXU(yf),Fl.rXU(F0),Fl.rXU(lh),Fl.rXU(qb))},_0.ɵcmp=Fl.VBU({type:_0,selectors:[["tools-send-details"]],inputs:{config:"config",originalSendView:"originalSendView"},decls:36,vars:29,consts:[["disableMargin","",3,"formGroup"],[1,"tw-mt-2"],["bitTypography","h6"],["bitInput","","type","text","formControlName","name"],[3,"config","originalSendView",4,"ngIf"],["id","deletionDate","name","SelectedDeletionDatePreset","formControlName","selectedDeletionDatePreset"],[3,"value","label",4,"ngFor","ngForOf"],[3,"disableMargin"],["formControlName","authType"],[3,"value","label"],["disableMargin",""],["disableMargin","",1,"tw-mt-4"],["class","tw-mt-4",4,"ngIf"],[3,"config","originalSendView"],["bitInput","","type","password","formControlName","password"],["bitSuffix","","ngProjectAs","[bitSuffix]",5,["","bitSuffix",""],1,"tw-flex","tw-items-center"],["type","button","buttonType","danger","bitIconButton","bwi-minus-circle","size","small","showToast","",1,"tw-border-l-0","last:tw-rounded-r","focus-visible:tw-border-l","focus-visible:tw-ml-[-1px]",3,"label","bitAction"],["data-testid","toggle-visibility-for-password","type","button","bitIconButton","","size","small","bitPasswordInputToggle",""],["type","button","bitIconButton","bwi-generate","size","small","data-testid","generate-password",3,"click","label","disabled"],["type","button","bitIconButton","bwi-clone","size","small","showToast","",3,"label","disabled","valueLabel","appCopyClick"],["bitInput","","formControlName","emails","rows","3",3,"placeholder"],[1,"tw-mt-4"],["data-testid","send-link","bitInput","","type","text","disabled","",3,"value"],["type","button","bitSuffix","","showToast","","bitIconButton","bwi-clone",3,"appCopyClick","valueLabel","label"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-section",0)(1,"bit-section-header",1)(2,"h2",2),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()(),Fl.j41(5,"bit-card")(6,"bit-form-field")(7,"bit-label"),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.nrm(10,"input",3),Fl.k0s(),Fl.DNE(11,A0,1,2,"tools-send-text-details",4)(12,D0,1,2,"tools-send-file-details",4),Fl.j41(13,"bit-form-field")(14,"bit-label"),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s(),Fl.j41(17,"bit-select",5),Fl.DNE(18,E0,1,2,"bit-option",6),Fl.k0s(),Fl.j41(19,"bit-hint"),Fl.EFF(20),Fl.nI1(21,"i18n"),Fl.k0s()(),Fl.j41(22,"bit-form-field",7)(23,"bit-label"),Fl.EFF(24),Fl.nI1(25,"i18n"),Fl.k0s(),Fl.j41(26,"bit-select",8),Fl.Z7z(27,$0,1,2,"bit-option",9,x0),Fl.nI1(29,"async"),Fl.k0s(),Fl.nVh(30,O0,3,3,"bit-hint",1),Fl.nVh(31,U0,3,3,"bit-hint",1),Fl.k0s(),Fl.nVh(32,V0,8,4,"bit-form-field",10),Fl.nVh(33,B0,9,9,"bit-form-field",11),Fl.DNE(34,j0,8,11,"bit-form-field",12),Fl.k0s(),Fl.nrm(35,"tools-send-options",13),Fl.k0s()),2&e&&(Fl.Y8G("formGroup",t.sendDetailsForm),Fl.R7$(3),Fl.JRh(Fl.bMT(4,17,"sendDetails")),Fl.R7$(5),Fl.JRh(Fl.bMT(9,19,"name")),Fl.R7$(3),Fl.Y8G("ngIf",t.config.sendType===t.TextSendType),Fl.R7$(),Fl.Y8G("ngIf",t.config.sendType===t.FileSendType),Fl.R7$(3),Fl.JRh(Fl.bMT(16,21,"deletionDate")),Fl.R7$(3),Fl.Y8G("ngForOf",t.datePresetOptions),Fl.R7$(2),Fl.JRh(Fl.bMT(21,23,"deletionDateDescV2")),Fl.R7$(2),Fl.Y8G("disableMargin",!t.sendDetailsForm.get("authType").value),Fl.R7$(2),Fl.JRh(Fl.bMT(25,25,"whoCanView")),Fl.R7$(3),Fl.Dyx(Fl.bMT(29,27,t.availableAuthTypes$)),Fl.R7$(3),Fl.vxM(t.sendDetailsForm.get("authType").value===t.AuthType.Email?30:-1),Fl.R7$(),Fl.vxM(t.sendDetailsForm.get("authType").value===t.AuthType.Password?31:-1),Fl.R7$(),Fl.vxM(t.sendDetailsForm.get("authType").value===t.AuthType.Password?32:-1),Fl.R7$(),Fl.vxM(t.sendDetailsForm.get("authType").value===t.AuthType.Email?33:-1),Fl.R7$(),Fl.Y8G("ngIf",t.sendLink),Fl.R7$(),Fl.Y8G("config",t.config)("originalSendView",t.originalSendView))},dependencies:[Ux,Nx,tc,rc,sf,rO,Ex,Gu,Ac,hu,fu,ju,iw,nw,Il.X1,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,P0,C0,S0,Ql,Zl,hd,kl.MD,kl.Sq,kl.bT,Wu,qu,zu,pc,Bd,id,rf,kl.Jj],encapsulation:2});var K0=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function X0(e,t){if(1&e&&(Fl.qex(0),Fl.nrm(1,"tools-send-details",2),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("config",e.config)("originalSendView",e.originalSendView)}}class q0{ngAfterViewInit(){this.submitBtn&&(this.bitSubmit.loading$.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.submitBtn.loading.set(e)}),this.bitSubmit.disabled$.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.submitBtn.disabled.set(e)}))}registerChildForm(e,t){this.sendForm.setControl(e,t)}patchSend(e){this.updatedSendView=e(this.updatedSendView)}ngOnChanges(){return K0(this,void 0,void 0,function*(){this._firstInitialized&&(yield this.init())})}ngOnInit(){return K0(this,void 0,void 0,function*(){yield this.init(),this._firstInitialized=!0})}init(){return K0(this,void 0,void 0,function*(){if(this.loading=!0,this.updatedSendView=new m0,this.originalSendView=null,this.sendForm.reset(),null!=this.config){if("add"!==this.config.mode){if(null==this.config.originalSend)throw new Error("Original send is required for edit or clone mode");this.originalSendView=yield this.addEditFormService.decryptSend(this.config.originalSend),this.updatedSendView=Object.assign(this.updatedSendView,this.originalSendView)}else this.updatedSendView.type=this.config.sendType;this.loading=!1}})}constructor(e,t,i,n){this.formBuilder=e,this.addEditFormService=t,this.toastService=i,this.i18nService=n,this.destroyRef=(0,a.WQX)(a.abz),this._firstInitialized=!1,this.file=null,this.onSendCreated=new Fl.bkB,this.onSendUpdated=new Fl.bkB,this.sendForm=this.formBuilder.group({}),this.loading=!0,this.SendType=u0,this.submit=()=>K0(this,void 0,void 0,function*(){if(this.sendForm.invalid)return void this.sendForm.markAllAsTouched();const e=yield this.addEditFormService.saveSend(this.updatedSendView,this.file,this.config);"add"!==this.config.mode?(this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("editedItem")}),this.onSendUpdated.emit(this.updatedSendView)):this.onSendCreated.emit(e)})}onFileSelected(e){this.file=e}}q0.ɵfac=function(e){return new(e||q0)(Fl.rXU(Il.ok),Fl.rXU(p0),Fl.rXU(qb),Fl.rXU(Ul))},q0.ɵcmp=Fl.VBU({type:q0,selectors:[["tools-send-form"]],viewQuery:function(e,t){if(1&e&&Fl.GBs(Md,5),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.bitSubmit=e.first)}},inputs:{formId:"formId",config:"config",submitBtn:"submitBtn"},outputs:{onSendCreated:"onSendCreated",onSendUpdated:"onSendUpdated"},features:[Fl.Jv_([{provide:g0,useExisting:(0,a.Rfq)(()=>q0)}]),Fl.OA$],decls:2,vars:4,consts:[[3,"id","formGroup","bitSubmit"],[4,"ngIf"],[3,"config","originalSendView"]],template:function(e,t){1&e&&(Fl.j41(0,"form",0),Fl.DNE(1,X0,2,2,"ng-container",1),Fl.k0s()),2&e&&(Fl.Y8G("id",t.formId)("formGroup",t.sendForm)("bitSubmit",t.submit),Fl.R7$(),Fl.Y8G("ngIf",!t.loading))},dependencies:[pc,Md,tc,VP,Gu,Il.X1,Il.qT,Il.cb,Il.j4,Wu,kl.bT,_0],encapsulation:2});class W0{}class Y0 extends W0{}var H0=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class J0{constructor(){this.accountService=(0,a.WQX)(Zk),this.sendApiService=(0,a.WQX)(F0),this.sendService=(0,a.WQX)(W0)}decryptSend(e){return H0(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));return yield e.decrypt(t)})}saveSend(e,t,i){return H0(this,void 0,void 0,function*(){const i=yield this.sendService.encrypt(e,t,e.password,null),n=yield this.sendApiService.save(i);return yield this.decryptSend(n)})}}J0.ɵfac=function(e){return new(e||J0)},J0.ɵprov=a.jDH({token:J0,factory:J0.ɵfac});class Z0{}Z0.ɵfac=function(e){return new(e||Z0)},Z0.ɵmod=Fl.$C({type:Z0}),Z0.ɵinj=a.G2t({providers:[{provide:p0,useClass:J0}],imports:[q0,yL]});class Q0{}var e1=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class t1{constructor(){this.policyService=(0,a.WQX)(Jb),this.sendService=(0,a.WQX)(W0),this.accountService=(0,a.WQX)(Zk),this.areSendsEnabled$=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.policyService.policyAppliesToUser$(op.DisableSend,e)),(0,l.T)(e=>!e))}buildConfig(e,t,i){return e1(this,void 0,void 0,function*(){var n,r;const[s,o]=yield(0,bo._)((0,jo.z)([this.areSendsEnabled$,this.getSend(t)]));return{mode:e,sendType:null!==(r=null!==(n=null==o?void 0:o.type)&&void 0!==n?n:i)&&void 0!==r?r:u0.Text,areSendsAllowed:s,originalSend:o}})}getSend(e){return null==e?Promise.resolve(null):this.sendService.get$(e)}}t1.ɵfac=function(e){return new(e||t1)},t1.ɵprov=a.jDH({token:t1,factory:t1.ɵfac});var i1=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function n1(e,t){1&e&&Fl.nrm(0,"i",10)}class r1{constructor(e,t,i,n){this.billingAccountProfileStateService=e,this.accountService=t,this.router=i,this.premiumUpgradePromptService=n,this.hideIcon=!1,this.buttonType="primary",this.sendType=u0,this.hasNoPremium=!1}ngOnInit(){return i1(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.accountService.activeAccount$);this.hasNoPremium=!e||!(yield(0,bo._)(this.billingAccountProfileStateService.hasPremiumFromAnySource$(e.id)))})}buildRouterLink(){return"/add-send"}buildQueryParams(e){return{type:e,isNew:!0}}sendFileClick(){return i1(this,void 0,void 0,function*(){this.hasNoPremium?yield this.premiumUpgradePromptService.promptForPremium():yield this.router.navigate([this.buildRouterLink()],{queryParams:this.buildQueryParams(u0.File)})})}}r1.ɵfac=function(e){return new(e||r1)(Fl.rXU(T$),Fl.rXU(Zk),Fl.rXU(Fd.Ix),Fl.rXU(qU))},r1.ɵcmp=Fl.VBU({type:r1,selectors:[["tools-new-send-dropdown"]],inputs:{hideIcon:"hideIcon",buttonType:"buttonType"},decls:21,vars:20,consts:[["itemOptions",""],["bitButton","","type","button",3,"bitMenuTriggerFor","buttonType"],["class","bwi bwi-plus tw-me-2","aria-hidden","true",4,"ngIf"],["bitMenuItem","",3,"routerLink","queryParams"],["slot","start","aria-hidden","true",1,"bwi","bwi-file-text"],["bitMenuItem","",3,"click","title"],[1,"tw-flex","tw-items-center","tw-gap-2"],["slot","start","aria-hidden","true",1,"bwi","bwi-file"],[1,"tw-sr-only"],["slot","end","aria-hidden","true",1,"bwi","bwi-popout","tw-text-muted"],["aria-hidden","true",1,"bwi","bwi-plus","tw-me-2"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",1),Fl.DNE(1,n1,1,0,"i",2),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"bit-menu",null,0)(6,"a",3),Fl.nrm(7,"i",4),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.j41(10,"a",5),Fl.nI1(11,"i18n"),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.sendFileClick())}),Fl.j41(12,"div",6),Fl.nrm(13,"i",7),Fl.EFF(14),Fl.nI1(15,"i18n"),Fl.nrm(16,"app-premium-badge"),Fl.k0s(),Fl.j41(17,"span",8),Fl.EFF(18),Fl.nI1(19,"i18n"),Fl.k0s(),Fl.nrm(20,"i",9),Fl.k0s()()}if(2&e){const e=Fl.sdS(5);Fl.Y8G("bitMenuTriggerFor",e)("buttonType",t.buttonType),Fl.R7$(),Fl.Y8G("ngIf",!t.hideIcon),Fl.R7$(),Fl.SpI(" ",Fl.bMT(3,10,t.hideIcon?"createSend":"new"),"\n"),Fl.R7$(4),Fl.Y8G("routerLink",t.buildRouterLink())("queryParams",t.buildQueryParams(t.sendType.Text)),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(9,12,"sendTypeText")," "),Fl.R7$(2),Fl.Y8G("title",Fl.bMT(11,14,"popOutNewWindow")),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(15,16,"sendTypeFile")," "),Fl.R7$(4),Fl.JRh(Fl.bMT(19,18,"popOutNewWindow"))}},dependencies:[sf,kl.MD,kl.bT,id,td,Cw.Wk,qh,pz,fz,D$,ZU,rf],encapsulation:2});var s1=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function o1(e,t){1&e&&Fl.nrm(0,"i",2)}class a1{constructor(){this.hideIcon=(0,o.hFB)(!1),this.buttonType=(0,o.hFB)("primary"),this.addSend=(0,o.CGW)(),this.sendType=u0,this.billingAccountProfileStateService=(0,a.WQX)(T$),this.accountService=(0,a.WQX)(Zk),this.premiumUpgradePromptService=(0,a.WQX)(qU),this.hasNoPremium=(0,xl.ot)(this.accountService.activeAccount$.pipe((0,go.n)(e=>e?this.billingAccountProfileStateService.hasPremiumFromAnySource$(e.id).pipe((0,l.T)(e=>!e)):(0,Go.of)(!0))),{initialValue:!0})}onTextSendClick(){this.addSend.emit(u0.Text)}onFileSendClick(){return s1(this,void 0,void 0,function*(){this.hasNoPremium()?yield this.premiumUpgradePromptService.promptForPremium():this.addSend.emit(u0.File)})}}a1.ɵfac=function(e){return new(e||a1)},a1.ɵcmp=Fl.VBU({type:a1,selectors:[["tools-new-send-dropdown-v2"]],inputs:{hideIcon:[1,"hideIcon"],buttonType:[1,"buttonType"]},outputs:{addSend:"addSend"},decls:16,vars:12,consts:[["itemOptions",""],["bitButton","","type","button",3,"bitMenuTriggerFor","buttonType"],["aria-hidden","true",1,"bwi","bwi-plus","tw-me-2"],["bitMenuItem","","type","button",3,"click"],["slot","start","aria-hidden","true",1,"bwi","bwi-file-text"],[1,"tw-flex","tw-items-center","tw-gap-2"],["slot","start","aria-hidden","true",1,"bwi","bwi-file"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",1),Fl.nVh(1,o1,1,0,"i",2),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"bit-menu",null,0)(6,"button",3),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.onTextSendClick())}),Fl.nrm(7,"i",4),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.j41(10,"button",3),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.onFileSendClick())}),Fl.j41(11,"div",5),Fl.nrm(12,"i",6),Fl.EFF(13),Fl.nI1(14,"i18n"),Fl.nrm(15,"app-premium-badge"),Fl.k0s()()()}if(2&e){const e=Fl.sdS(5);Fl.Y8G("bitMenuTriggerFor",e)("buttonType",t.buttonType()),Fl.R7$(),Fl.vxM(t.hideIcon()?-1:1),Fl.R7$(),Fl.SpI(" ",Fl.bMT(3,6,t.hideIcon()?"createSend":"new"),"\n"),Fl.R7$(6),Fl.SpI(" ",Fl.bMT(9,8,"sendTypeText")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(14,10,"sendTypeFile")," ")}},dependencies:[sf,id,td,qh,pz,fz,D$,ZU,rf],encapsulation:2,changeDetection:0});var l1=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function c1(e,t){if(1&e&&(Fl.nrm(0,"button",11),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG();Fl.Y8G("label",Fl.mNQ(Fl.bMT(1,3,"delete")))("bitAction",e.deleteSend)}}const u1=Object.freeze({Saved:"saved",Deleted:"deleted"});class d1{constructor(e,t,i,n,r,s){this.params=e,this.dialogRef=t,this.i18nService=i,this.sendApiService=n,this.toastService=r,this.dialogService=s,this.deleteSend=()=>l1(this,void 0,void 0,function*(){var e;if(yield this.dialogService.openSimpleDialog({title:{key:"deleteSend"},content:{key:"deleteSendPermanentConfirmation"},type:"warning"})){try{yield this.sendApiService.delete(null===(e=this.config.originalSend)||void 0===e?void 0:e.id)}catch(e){return void this.toastService.showToast({variant:"error",title:null,message:e.message})}yield this.onSendDeleted()}}),this.config=e.formConfig,this.headerText=this.getHeaderText(this.config.mode,this.config.sendType)}onSendCreated(e){return l1(this,void 0,void 0,function*(){this.dialogRef.close({result:u1.Saved,send:e})})}onSendUpdated(e){return l1(this,void 0,void 0,function*(){this.dialogRef.close({result:u1.Saved})})}onSendDeleted(){return l1(this,void 0,void 0,function*(){this.dialogRef.close({result:u1.Deleted}),this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("deletedSend")})})}getHeaderText(e,t){const i="edit"===e||"partial-edit"===e,n={[u0.Text]:i?"editItemHeaderTextSend":"newItemHeaderTextSend",[u0.File]:i?"editItemHeaderFileSend":"newItemHeaderFileSend"};return this.i18nService.t(n[t])}static open(e,t){return e.open(d1,{data:t})}static openDrawer(e,t){return e.openDrawer(d1,{data:t})}}d1.ɵfac=function(e){return new(e||d1)(Fl.rXU(pd.Qs),Fl.rXU(nh),Fl.rXU(Ul),Fl.rXU(F0),Fl.rXU(qb),Fl.rXU(lh))},d1.ɵcmp=Fl.VBU({type:d1,selectors:[["ng-component"]],decls:16,vars:10,consts:[["dialog",""],["submitBtn",""],["dialogSize","large","background","alt"],["bitDialogTitle",""],["bitDialogContent",""],["formId","sendForm",3,"onSendCreated","onSendUpdated","config","submitBtn"],["bitDialogFooter",""],["bitButton","","type","submit","form","sendForm","buttonType","primary"],["bitButton","","type","button","buttonType","secondary","bitDialogClose",""],[1,"tw-ml-auto"],["type","button","buttonType","danger","slot","end","bitIconButton","bwi-trash",3,"bitAction","label",4,"ngIf"],["type","button","buttonType","danger","slot","end","bitIconButton","bwi-trash",3,"bitAction","label"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-dialog",2,0)(2,"span",3),Fl.EFF(3),Fl.k0s(),Fl.j41(4,"span",4)(5,"tools-send-form",5),Fl.bIt("onSendCreated",function(i){return a.eBV(e),a.Njj(t.onSendCreated(i))})("onSendUpdated",function(i){return a.eBV(e),a.Njj(t.onSendUpdated(i))}),Fl.k0s()(),Fl.qex(6,6),Fl.j41(7,"button",7,1),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s(),Fl.j41(11,"button",8),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s(),Fl.j41(14,"div",9),Fl.DNE(15,c1,2,5,"button",10),Fl.k0s(),Fl.bVm(),Fl.k0s()}if(2&e){const e=Fl.sdS(8);Fl.R7$(3),Fl.SpI(" ",t.headerText," "),Fl.R7$(2),Fl.Y8G("config",t.config)("submitBtn",e),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(10,6,"save")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(13,8,"cancel")," "),Fl.R7$(3),Fl.Y8G("ngIf","add"!==(null==t.config?null:t.config.mode))}},dependencies:[kl.MD,kl.bT,iO,sf,Il.YN,id,td,Ql,Zl,Z0,q0,pc,Bd,Fh,ch,Ph,rf],encapsulation:2});var h1=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const p1=(e,t)=>({sendId:e,type:t});function v1(e,t){1&e&&Fl.nrm(0,"i",14)}function f1(e,t){1&e&&Fl.nrm(0,"i",15)}function m1(e,t){if(1&e&&(Fl.nrm(0,"i",16),Fl.nI1(1,"i18n"),Fl.j41(2,"span",17),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG().$implicit.authType===Fl.XpG(2).authType.Email?"emailProtected":"passwordProtected";Fl.Y8G("appA11yTitle",Fl.mNQ(Fl.bMT(1,3,e))),Fl.R7$(3),Fl.JRh(Fl.bMT(4,5,e))}}function g1(e,t){1&e&&(Fl.nrm(0,"i",18),Fl.nI1(1,"i18n"),Fl.j41(2,"span",17),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()),2&e&&(Fl.Y8G("appA11yTitle",Fl.mNQ(Fl.bMT(1,3,"maxAccessCountReached"))),Fl.R7$(3),Fl.JRh(Fl.bMT(4,5,"maxAccessCountReached")))}function y1(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-item")(1,"button",5),Fl.nI1(2,"i18n"),Fl.j41(3,"div",6),Fl.DNE(4,v1,1,0,"i",7)(5,f1,1,0,"i",8),Fl.k0s(),Fl.EFF(6),Fl.j41(7,"div",9),Fl.nVh(8,m1,5,7),Fl.nVh(9,g1,5,7),Fl.k0s(),Fl.j41(10,"span",10),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.nI1(13,"date"),Fl.k0s()(),Fl.qex(14,11),Fl.j41(15,"bit-item-action")(16,"button",12),Fl.nI1(17,"i18n"),Fl.bIt("click",function(){const t=a.eBV(e).$implicit,i=Fl.XpG(2);return a.Njj(i.copySendLink(t))}),Fl.k0s()(),Fl.j41(18,"bit-item-action")(19,"button",13),Fl.nI1(20,"i18n"),Fl.bIt("click",function(){const t=a.eBV(e).$implicit,i=Fl.XpG(2);return a.Njj(i.deleteSend(t))}),Fl.k0s()(),Fl.bVm(),Fl.k0s()}if(2&e){const e=t.$implicit,i=Fl.XpG(2);Fl.R7$(),Fl.Y8G("appA11yTitle",Fl.ai1("",Fl.bMT(2,17,"edit")," - ",e.name))("queryParams",Fl.l_i(28,p1,e.id,e.type)),Fl.R7$(3),Fl.Y8G("ngIf",e.type===i.sendType.Text),Fl.R7$(),Fl.Y8G("ngIf",e.type===i.sendType.File),Fl.R7$(),Fl.SpI(" ",e.name," "),Fl.R7$(2),Fl.vxM(e.authType!==i.authType.None?8:-1),Fl.R7$(),Fl.vxM(e.maxAccessCountReached?9:-1),Fl.R7$(2),Fl.Lme(" ",Fl.bMT(12,19,"deletionDate"),": ",Fl.i5U(13,21,e.deletionDate,"mediumDate")," "),Fl.R7$(5),Fl.Y8G("label",Fl.ai1("",Fl.bMT(17,24,"copyLink")," - ",e.name)),Fl.R7$(3),Fl.Y8G("label",Fl.ai1("",Fl.bMT(20,26,"delete")," - ",e.name))}}function b1(e,t){if(1&e&&(Fl.j41(0,"bit-section",1)(1,"bit-section-header")(2,"h2",2),Fl.EFF(3),Fl.k0s(),Fl.j41(4,"span",3),Fl.EFF(5),Fl.k0s()(),Fl.j41(6,"bit-item-group"),Fl.DNE(7,y1,21,31,"bit-item",4),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(3),Fl.SpI(" ",e.headerText," "),Fl.R7$(2),Fl.JRh(e.sends.length),Fl.R7$(2),Fl.Y8G("ngForOf",e.sends)}}class w1{constructor(e,t,i,n,r,s,o){this.dialogService=e,this.environmentService=t,this.i18nService=i,this.logService=n,this.platformUtilsService=r,this.sendApiService=s,this.toastService=o,this.sendType=u0,this.authType=y0,this.sends=[]}deleteSend(e){return h1(this,void 0,void 0,function*(){if(!(yield this.dialogService.openSimpleDialog({title:{key:"deleteSend"},content:{key:"deleteSendPermanentConfirmation"},type:"warning"})))return!1;yield this.sendApiService.delete(e.id);try{this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("deletedSend")})}catch(e){this.logService.error(e)}})}copySendLink(e){return h1(this,void 0,void 0,function*(){const t=(yield(0,bo._)(this.environmentService.environment$)).getSendUrl()+e.accessId+"/"+e.urlB64Key;this.platformUtilsService.copyToClipboard(t),this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("valueCopied",this.i18nService.t("sendLink"))})})}}w1.ɵfac=function(e){return new(e||w1)(Fl.rXU(lh),Fl.rXU(mk),Fl.rXU(Ul),Fl.rXU(Za),Fl.rXU(Hb),Fl.rXU(F0),Fl.rXU(qb))},w1.ɵcmp=Fl.VBU({type:w1,selectors:[["app-send-list-items-container"]],inputs:{sends:"sends",headerText:"headerText"},decls:1,vars:1,consts:[["disableMargin","",4,"ngIf"],["disableMargin",""],["bitTypography","h6",1,"tw-font-medium"],["bitTypography","body1","slot","end"],[4,"ngFor","ngForOf"],["bit-item-content","","routerLink","/edit-send","appStopClick","","type","button",3,"appA11yTitle","queryParams"],["slot","start",1,"tw-justify-start"],["class","bwi bwi-lg bwi-file-text tw-text-muted tw-w-6",4,"ngIf"],["class","bwi bwi-lg bwi-file tw-text-muted tw-w-6",4,"ngIf"],["slot","default-trailing",1,"tw-flex","tw-gap-2","tw-relative","tw-z-10"],["slot","secondary"],["slot","end"],["bitIconButton","bwi-clone","size","small","type","button",1,"tw-p-1",3,"click","label"],["bitIconButton","bwi-trash","size","small","type","button",3,"click","label"],[1,"bwi","bwi-lg","bwi-file-text","tw-text-muted","tw-w-6"],[1,"bwi","bwi-lg","bwi-file","tw-text-muted","tw-w-6"],["aria-hidden","true",1,"bwi","bwi-lock",3,"appA11yTitle"],[1,"tw-sr-only"],["aria-hidden","true",1,"bwi","bwi-exclamation-triangle",3,"appA11yTitle"]],template:function(e,t){1&e&&Fl.DNE(0,b1,8,3,"bit-section",0),2&e&&Fl.Y8G("ngIf",(null==t.sends?null:t.sends.length)>0)},dependencies:[kl.MD,kl.Sq,kl.bT,VP,GP,KP,BP,XP,id,eu,Ql,Zl,Ux,tc,rc,sf,rw,IP,Nx,Cw.Wk,kl.vh,rf],encapsulation:2});const S1={sendType:null};class k1{constructor(e,t){this.i18nService=e,this.formBuilder=t,this.filterForm=this.formBuilder.group(S1),this.filters$=this.filterForm.valueChanges.pipe((0,kd.Z)(S1)),this.filterFunction$=this.filters$.pipe((0,l.T)(e=>t=>t.filter(t=>null===e.sendType||t.type===e.sendType))),this.sendTypes=[{value:u0.File,label:this.i18nService.t("sendTypeFile"),icon:"bwi-file"},{value:u0.Text,label:this.i18nService.t("sendTypeText"),icon:"bwi-file-text"}]}resetFilterForm(){this.filterForm.reset(S1)}convertToChipSelectOption(e,t){return{value:e.node,label:e.node.name,icon:t,children:e.children?e.children.map(e=>this.convertToChipSelectOption(e,t)):void 0}}}k1.ɵfac=function(e){return new(e||k1)(a.KVO(Ul),a.KVO(Il.ok))},k1.ɵprov=a.jDH({token:k1,factory:k1.ɵfac,providedIn:"root"});class I1{constructor(e,t,i,n){this.sendService=e,this.sendListFiltersService=t,this.searchService=i,this.accountService=n,this._searchText$=new Dd.t(""),this._sendsLoading$=new Co.B,this.latestSearchText$=this._searchText$.asObservable(),this._sendList$=this.sendService.sendViews$,this.filteredAndSortedSends$=(0,jo.z)([this._sendList$,this._searchText$,this.sendListFiltersService.filterFunction$]).pipe((0,Oo.M)(()=>{this._sendsLoading$.next()}),(0,l.T)(([e,t,i])=>[i(e),t]),(0,l.T)(([e,t])=>this.searchService.searchSends(e,t)),(0,l.T)(e=>e.sort((e,t)=>e.name.localeCompare(t.name))),(0,Gp.t)({refCount:!0,bufferSize:1})),this.loading$=(0,Po.h)(this._sendsLoading$.pipe((0,l.T)(()=>!0)),this.filteredAndSortedSends$.pipe((0,l.T)(()=>!1))).pipe((0,kd.Z)(!0),(0,mo.F)(),(0,Gp.t)({refCount:!1,bufferSize:1})),this.hasFilterApplied$=(0,jo.z)([this._searchText$,this.sendListFiltersService.filters$,iv(this.accountService.activeAccount$)]).pipe((0,go.n)(([e,t,i])=>(0,$d.H)(this.searchService.isSearchable(i,e)).pipe((0,l.T)(e=>e||Object.values(t).some(e=>null!==e))))),this.emptyList$=this._sendList$.pipe((0,l.T)(e=>!e.length)),this.noFilteredResults$=this.filteredAndSortedSends$.pipe((0,l.T)(e=>!e.length))}applyFilter(e){this._searchText$.next(e)}}I1.ɵfac=function(e){return new(e||I1)(a.KVO(W0),a.KVO(k1),a.KVO(sQ),a.KVO(Zk))},I1.ɵprov=a.jDH({token:I1,factory:I1.ɵfac,providedIn:"root"});var C1=i(36006);class T1{constructor(){this.sendListItemService=(0,a.WQX)(I1),this.searchText=(0,o.geq)(""),this.subscribeToLatestSearchText(),this.subscribeToApplyFilter()}subscribeToLatestSearchText(){this.sendListItemService.latestSearchText$.pipe((0,xl.pQ)(),(0,Eo.p)(e=>!!e)).subscribe(e=>{this.searchText.set(e)})}subscribeToApplyFilter(){(0,xl.br)(this.searchText).pipe((0,C1.B)(200),(0,xl.pQ)()).subscribe(e=>{this.sendListItemService.applyFilter(e)})}}function P1(e,t){return null==e&&null==t||(!e||null!=t)&&((null!=e||!t)&&("object"!=typeof e||"object"!=typeof t?e===t:JSON.stringify(e)===JSON.stringify(t)))}T1.ɵfac=function(e){return new(e||T1)},T1.ɵcmp=Fl.VBU({type:T1,selectors:[["tools-send-search"]],inputs:{searchText:[1,"searchText"]},outputs:{searchText:"searchTextChange"},decls:2,vars:4,consts:[["appAutofocus","",3,"ngModelChange","placeholder","ngModel"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-search",0),Fl.nI1(1,"i18n"),Fl.mxI("ngModelChange",function(e){return Fl.DH7(t.searchText,e)||(t.searchText=e),e}),Fl.k0s()),2&e&&(Fl.Y8G("placeholder",Fl.bMT(1,2,"search")),Fl.R50("ngModel",t.searchText))},dependencies:[Il.YN,Il.BC,Il.vS,iO,tO,sc],encapsulation:2,changeDetection:0});const F1=["chipSelectButton"],R1=(e,t,i,n,r)=>({"tw-bg-text-muted hover:tw-bg-secondary-700 tw-text-contrast hover:!tw-border-secondary-700":e,"tw-bg-transparent hover:tw-border-secondary-700 !tw-text-muted hover:tw-bg-secondary-100":t,"tw-bg-secondary-300 tw-text-muted tw-border-transparent":i,"tw-border-text-muted":n,"tw-ring-2 tw-ring-primary-600 tw-ring-offset-1":r}),x1=(e,t)=>({"tw-cursor-not-allowed":e,"group-hover/chip-select:tw-text-secondary-700":t}),A1=e=>({"tw-cursor-not-allowed":e}),D1=e=>({width:e});function E1(e,t){if(1&e&&Fl.nrm(0,"i",7),2&e){Fl.XpG();const e=Fl.sdS(2);Fl.Y8G("ngClass",e.isOpen?"bwi-angle-up":"bwi-angle-down")}}function $1(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",11),Fl.nI1(1,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.clear())}),Fl.nrm(2,"i",12),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.Y8G("disabled",e.disabled())("ngClass",Fl.eq3(6,A1,e.disabled())),Fl.BMQ("aria-label",Fl.i5U(1,3,"removeItem",e.label))}}function O1(e,t){var i,n;if(1&e){const e=Fl.RV6();Fl.j41(0,"button",14),Fl.nI1(1,"i18n"),Fl.bIt("click",function(t){const i=a.eBV(e),n=Fl.XpG(2);return a.Njj(n.viewOption(i,t))}),Fl.nrm(2,"i",15),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"button",14),Fl.nI1(6,"i18n"),Fl.bIt("click",function(t){a.eBV(e);const i=Fl.XpG(2);return a.Njj(i.selectOption(i.renderedOptions,t))}),Fl.nrm(7,"i",16),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s()}if(2&e){const e=t,r=Fl.XpG(2);Fl.Y8G("title",Fl.i5U(1,4,"backTo",null!==(i=e.label)&&void 0!==i?i:r.placeholderText())),Fl.R7$(3),Fl.SpI(" ",Fl.i5U(4,7,"backTo",null!==(n=e.label)&&void 0!==n?n:r.placeholderText())," "),Fl.R7$(2),Fl.Y8G("title",Fl.i5U(6,10,"viewItemsIn",r.renderedOptions.label)),Fl.R7$(3),Fl.SpI(" ",Fl.i5U(9,13,"viewItemsIn",r.renderedOptions.label)," ")}}function U1(e,t){if(1&e&&Fl.nrm(0,"i",18),2&e){const e=Fl.XpG().$implicit;Fl.Y8G("ngClass",e.icon)}}function M1(e,t){1&e&&Fl.nrm(0,"i",19)}function N1(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",17),Fl.bIt("click",function(t){const i=a.eBV(e).$implicit,n=Fl.XpG(2);return a.Njj(null!=i.children&&i.children.length?n.viewOption(i,t):n.selectOption(i,t))}),Fl.nVh(1,U1,1,1,"i",18),Fl.EFF(2),Fl.nVh(3,M1,1,0,"i",19),Fl.k0s()}if(2&e){const e=t.$implicit;Fl.Y8G("disabled",e.disabled)("title",e.label),Fl.BMQ("aria-haspopup",null!=e.children&&e.children.length?"menu":null),Fl.R7$(),Fl.vxM(e.icon?1:-1),Fl.R7$(),Fl.SpI(" ",e.label," "),Fl.R7$(),Fl.vxM(null!=e.children&&e.children.length?3:-1)}}function V1(e,t){if(1&e&&(Fl.j41(0,"div",10),Fl.nVh(1,O1,10,16),Fl.Z7z(2,N1,4,6,"button",13,Fl.fX1),Fl.k0s()),2&e){let e;const t=Fl.XpG();Fl.Y8G("ngStyle",t.menuWidth&&Fl.eq3(2,D1,t.menuWidth+"px")),Fl.R7$(),Fl.vxM((e=t.getParent(t.renderedOptions))?1:-1,e),Fl.R7$(),Fl.Dyx(t.renderedOptions.children)}}class B1{onFocusIn(e){this.focusVisibleWithin.set(e.matches("[data-fvw-target]:focus-visible"))}onFocusOut(){this.focusVisibleWithin.set(!1)}get classList(){return["tw-inline-block",this.fullWidth()?"tw-w-full":"tw-max-w-52"]}constructor(){this.cdr=(0,a.WQX)(o.gRc),this.menu=(0,o.ebz)(pz),this.menuItems=(0,o.dtW)(D$),this.chipSelectButton=(0,o.ebz)("chipSelectButton"),this.menuTrigger=(0,o.ebz)(fz),this.placeholderText=o.hFB.required(),this.placeholderIcon=(0,o.hFB)(),this.options=o.hFB.required(),this.disabledInput=(0,o.hFB)(!1,{alias:"disabled",transform:o.L39}),this.disabledState=(0,a.vPA)(!1),this.disabled=(0,Rl.EW)(()=>this.disabledInput()||this.disabledState()),this.fullWidth=(0,o.hFB)(void 0,{transform:o.L39}),this.focusVisibleWithin=(0,a.vPA)(!1),this.menuWidth=null,this.childParentMap=new Map,(0,Rl.QZ)(()=>{const e=this.selectedOption;this.childParentMap.clear(),this.initializeRootTree(this.options()),null!=(null==e?void 0:e.value)&&(this.selectedOption=this.findOption(this.rootTree,e.value)),void 0!==this.pendingValue&&(this.selectedOption=this.findOption(this.rootTree,this.pendingValue),this.setOrResetRenderedOptions(),this.pendingValue=void 0,this.cdr.markForCheck())}),(0,Rl.QZ)(()=>{var e;const t=this.menuItems(),i=this.menu(),n=this.menuTrigger();t.length>0&&(null==n?void 0:n.isOpen)&&(null===(e=null==i?void 0:i.keyManager)||void 0===e||e.setFirstItemActive())})}get label(){var e;return(null===(e=this.selectedOption)||void 0===e?void 0:e.label)||this.placeholderText()}get icon(){var e;return(null===(e=this.selectedOption)||void 0===e?void 0:e.icon)||this.placeholderIcon()}setOrResetRenderedOptions(){var e,t;this.renderedOptions=this.selectedOption?(null!==(t=null===(e=this.selectedOption.children)||void 0===e?void 0:e.length)&&void 0!==t?t:0)>0?this.selectedOption:this.getParent(this.selectedOption):this.rootTree}handleMenuClosed(){this.setOrResetRenderedOptions(),this.menuWidth=null}selectOption(e,t){this.selectedOption=e,this.onChange(e)}viewOption(e,t){this.renderedOptions=e,t.preventDefault(),t.stopImmediatePropagation()}clear(){this.renderedOptions=this.rootTree,this.selectedOption=null,this.onChange(null)}findOption(e,t){if(!e)return null;let i=null;return null!==e.value&&P1(e.value,t)?e:(Array.isArray(e.children)&&e.children.length>0&&e.children.some(e=>(i=this.findOption(e,t),i)),i)}markParents(e){var t;null===(t=e.children)||void 0===t||t.forEach(t=>{this.childParentMap.set(t,e),this.markParents(t)})}getParent(e){return this.childParentMap.get(e)}initializeRootTree(e){const t={children:e,value:null};this.markParents(t),this.rootTree=t,this.renderedOptions=this.rootTree}setMenuWidth(){var e,t,i,n,r;const s=null!==(t=null===(e=this.chipSelectButton())||void 0===e?void 0:e.nativeElement.getBoundingClientRect().width)&&void 0!==t?t:0,o=null!==(r=null===(n=null===(i=this.menu())||void 0===i?void 0:i.menuItems().at(0))||void 0===n?void 0:n.elementRef.nativeElement.getBoundingClientRect().width)&&void 0!==r?r:0;this.menuWidth=Math.max(s,o)}writeValue(e){this.rootTree?(this.selectedOption=this.findOption(this.rootTree,e),this.setOrResetRenderedOptions(),this.cdr.markForCheck()):this.pendingValue=e}registerOnChange(e){this.notifyOnChange=e}registerOnTouched(e){this.notifyOnTouched=e}setDisabledState(e){this.disabledState.set(e)}onChange(e){var t;this.notifyOnChange&&this.notifyOnChange(null!==(t=null==e?void 0:e.value)&&void 0!==t?t:null)}onBlur(){this.notifyOnTouched&&this.notifyOnTouched()}}function j1(e,t){if(1&e&&(Fl.j41(0,"div",1),Fl.nI1(1,"i18n"),Fl.j41(2,"form",2),Fl.nrm(3,"bit-chip-select",3),Fl.nI1(4,"i18n"),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.BMQ("aria-label",Fl.bMT(1,4,"filters")),Fl.R7$(2),Fl.Y8G("formGroup",e.filterForm),Fl.R7$(),Fl.Y8G("placeholderText",Fl.bMT(4,6,"type"))("options",e.sendTypes)}}B1.ɵfac=function(e){return new(e||B1)},B1.ɵcmp=Fl.VBU({type:B1,selectors:[["bit-chip-select"]],viewQuery:function(e,t){1&e&&(Fl.wEZ(t.menu,pz,5),Fl.wEZ(t.menuItems,D$,5),Fl.wEZ(t.chipSelectButton,F1,5),Fl.wEZ(t.menuTrigger,fz,5)),2&e&&Fl.NyB(4)},hostVars:2,hostBindings:function(e,t){1&e&&Fl.bIt("focusin",function(e){return t.onFocusIn(e.target)})("focusout",function(){return t.onFocusOut()}),2&e&&Fl.HbH(t.classList)},inputs:{placeholderText:[1,"placeholderText"],placeholderIcon:[1,"placeholderIcon"],options:[1,"options"],disabledInput:[1,"disabled","disabledInput"],fullWidth:[1,"fullWidth"]},features:[Fl.Jv_([{provide:Il.kq,useExisting:B1,multi:!0}])],decls:13,vars:19,consts:[["menuTrigger","menuTrigger","chipSelectButton",""],["menu",""],["bitTypography","body2",1,"tw-inline-flex","tw-items-center","tw-rounded-full","tw-w-full","tw-border-solid","tw-border","tw-gap-1.5","tw-group/chip-select",3,"ngClass"],["type","button","data-fvw-target","",1,"tw-inline-flex","tw-gap-1.5","tw-items-center","tw-justify-between","tw-bg-transparent","hover:tw-bg-transparent","tw-border-none","tw-outline-none","tw-w-full","tw-py-1","tw-ps-3","last:tw-pe-3","[&:not(:last-child)]:tw-pe-0","tw-truncate","tw-text-[color:inherit]","tw-text-[length:inherit]",3,"click","ngClass","bitMenuTriggerFor","disabled","title"],[1,"tw-inline-flex","tw-items-center","tw-gap-1.5","tw-truncate"],["aria-hidden","true",1,"bwi","!tw-text-[inherit]",3,"ngClass"],[1,"tw-truncate"],["aria-hidden","true",1,"bwi","tw-mt-0.5",3,"ngClass"],["type","button",1,"tw-bg-transparent","hover:tw-bg-hover-contrast","tw-outline-none","tw-rounded-full","tw-py-0.5","tw-px-1","tw-me-1","tw-text-[color:inherit]","tw-text-[length:inherit]","tw-border-solid","tw-border","tw-border-transparent","tw-flex","tw-items-center","tw-justify-center","focus-visible:tw-ring-2","tw-ring-text-contrast","hover:disabled:tw-bg-transparent",3,"disabled","ngClass"],[3,"closed"],[1,"tw-max-h-80","tw-min-w-32","tw-max-w-80","tw-text-sm",3,"ngStyle"],["type","button",1,"tw-bg-transparent","hover:tw-bg-hover-contrast","tw-outline-none","tw-rounded-full","tw-py-0.5","tw-px-1","tw-me-1","tw-text-[color:inherit]","tw-text-[length:inherit]","tw-border-solid","tw-border","tw-border-transparent","tw-flex","tw-items-center","tw-justify-center","focus-visible:tw-ring-2","tw-ring-text-contrast","hover:disabled:tw-bg-transparent",3,"click","disabled","ngClass"],["aria-hidden","true",1,"bwi","bwi-close","tw-text-xs"],["type","button","bitMenuItem","",1,"tw-text-[length:inherit]",3,"disabled","title"],["type","button","bitMenuItem","",1,"tw-text-[length:inherit]",3,"click","title"],["slot","start","aria-hidden","true",1,"bwi","bwi-angle-left"],["slot","start","aria-hidden","true",1,"bwi","bwi-list"],["type","button","bitMenuItem","",1,"tw-text-[length:inherit]",3,"click","disabled","title"],["slot","start","aria-hidden","true",1,"bwi",3,"ngClass"],["slot","end","aria-hidden","true",1,"bwi","bwi-angle-right"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"div",2)(1,"button",3,0),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.setMenuWidth())}),Fl.j41(4,"span",4),Fl.nrm(5,"i",5),Fl.j41(6,"span",6),Fl.EFF(7),Fl.k0s()(),Fl.nVh(8,E1,1,1,"i",7),Fl.k0s(),Fl.nVh(9,$1,3,8,"button",8),Fl.k0s(),Fl.j41(10,"bit-menu",9,1),Fl.bIt("closed",function(){return a.eBV(e),a.Njj(t.handleMenuClosed())}),Fl.nVh(12,V1,4,4,"div",10),Fl.k0s()}if(2&e){const e=Fl.sdS(11);Fl.Y8G("ngClass",Fl.s1E(10,R1,t.selectedOption&&!t.disabled(),!t.selectedOption&&!t.disabled(),t.disabled(),!t.disabled(),t.focusVisibleWithin())),Fl.R7$(),Fl.Y8G("ngClass",Fl.l_i(16,x1,t.disabled(),!t.selectedOption&&!t.disabled()))("bitMenuTriggerFor",e)("disabled",t.disabled())("title",t.label),Fl.R7$(4),Fl.Y8G("ngClass",t.icon),Fl.R7$(2),Fl.JRh(t.label),Fl.R7$(),Fl.vxM(t.selectedOption?-1:8),Fl.R7$(),Fl.vxM(t.selectedOption?9:-1),Fl.R7$(3),Fl.vxM(t.renderedOptions?12:-1)}},dependencies:[ec,kl.YU,kl.B3,id,Ql,qh,pz,fz,D$,tc,rc,sc],encapsulation:2,changeDetection:0});class G1{constructor(e,t,i){this.sendListFiltersService=e,this.filterForm=this.sendListFiltersService.filterForm,this.sendTypes=this.sendListFiltersService.sendTypes,this.canAccessPremium$=i.activeAccount$.pipe((0,go.n)(e=>e?t.hasPremiumFromAnySource$(e.id):(0,Go.of)(!1)))}ngOnDestroy(){this.sendListFiltersService.resetFilterForm()}}G1.ɵfac=function(e){return new(e||G1)(Fl.rXU(k1),Fl.rXU(T$),Fl.rXU(Zk))},G1.ɵcmp=Fl.VBU({type:G1,selectors:[["app-send-list-filters"]],decls:2,vars:3,consts:[["role","toolbar",4,"ngIf"],["role","toolbar"],[1,"tw-flex","tw-flex-wrap","tw-gap-2","tw-mt-2",3,"formGroup"],["formControlName","sendType","placeholderIcon","bwi-list",3,"placeholderText","options"]],template:function(e,t){1&e&&(Fl.DNE(0,j1,5,8,"div",0),Fl.nI1(1,"async")),2&e&&Fl.Y8G("ngIf",Fl.bMT(1,1,t.canAccessPremium$))},dependencies:[kl.MD,kl.bT,sf,B1,Il.X1,Il.qT,Il.BC,Il.cb,Il.j4,Il.JD,kl.Jj,rf],encapsulation:2});class L1{onClick(e){e.stopPropagation()}}function z1(e,t){1&e&&Fl.nrm(0,"i",13)}function _1(e,t){1&e&&Fl.nrm(0,"i",14)}function K1(e,t){1&e&&(Fl.nrm(0,"i",16),Fl.nI1(1,"i18n"),Fl.nI1(2,"i18n")),2&e&&(Fl.Y8G("title",Fl.mNQ(Fl.bMT(1,4,"disabled"))),Fl.jOp("aria-label",Fl.mNQ(Fl.bMT(2,6,"disabled"))))}function X1(e,t){if(1&e&&(Fl.nrm(0,"i",17),Fl.nI1(1,"i18n"),Fl.nI1(2,"i18n")),2&e){const e=Fl.XpG().$implicit.authType===Fl.XpG(2).authType.Email?"emailProtected":"passwordProtected";Fl.Y8G("title",Fl.mNQ(Fl.bMT(1,4,e))),Fl.jOp("aria-label",Fl.mNQ(Fl.bMT(2,6,e)))}}function q1(e,t){1&e&&(Fl.nrm(0,"i",16),Fl.nI1(1,"i18n"),Fl.nI1(2,"i18n")),2&e&&(Fl.Y8G("title",Fl.mNQ(Fl.bMT(1,4,"maxAccessCountReached"))),Fl.jOp("aria-label",Fl.mNQ(Fl.bMT(2,6,"maxAccessCountReached"))))}function W1(e,t){1&e&&(Fl.nrm(0,"i",18),Fl.nI1(1,"i18n"),Fl.nI1(2,"i18n")),2&e&&(Fl.Y8G("title",Fl.mNQ(Fl.bMT(1,4,"expired"))),Fl.jOp("aria-label",Fl.mNQ(Fl.bMT(2,6,"expired"))))}function Y1(e,t){1&e&&(Fl.nrm(0,"i",19),Fl.nI1(1,"i18n"),Fl.nI1(2,"i18n")),2&e&&(Fl.Y8G("title",Fl.mNQ(Fl.bMT(1,4,"pendingDeletion"))),Fl.jOp("aria-label",Fl.mNQ(Fl.bMT(2,6,"pendingDeletion"))))}function H1(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",24),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG().$implicit,i=Fl.XpG(2);return a.Njj(i.onRemovePassword(t))}),Fl.nrm(1,"i",29),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"removePassword")," "))}function J1(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"tr",9)(1,"td",10),Fl.bIt("click",function(){const t=a.eBV(e).$implicit,i=Fl.XpG(2);return a.Njj(i.onEditSend(t))}),Fl.j41(2,"div",11)(3,"span",12),Fl.nVh(4,z1,1,0,"i",13),Fl.nVh(5,_1,1,0,"i",14),Fl.k0s(),Fl.j41(6,"button",15),Fl.EFF(7),Fl.k0s(),Fl.nVh(8,K1,3,8,"i",16),Fl.nVh(9,X1,3,8,"i",17),Fl.nVh(10,q1,3,8,"i",16),Fl.nVh(11,W1,3,8,"i",18),Fl.nVh(12,Y1,3,8,"i",19),Fl.k0s()(),Fl.j41(13,"td",20),Fl.bIt("click",function(){const t=a.eBV(e).$implicit,i=Fl.XpG(2);return a.Njj(i.onEditSend(t))}),Fl.j41(14,"small",21),Fl.EFF(15),Fl.nI1(16,"date"),Fl.k0s()(),Fl.j41(17,"td",22),Fl.nrm(18,"button",23),Fl.nI1(19,"i18n"),Fl.j41(20,"bit-menu",null,0)(22,"button",24),Fl.bIt("click",function(){const t=a.eBV(e).$implicit,i=Fl.XpG(2);return a.Njj(i.onCopy(t))}),Fl.nrm(23,"i",25),Fl.EFF(24),Fl.nI1(25,"i18n"),Fl.k0s(),Fl.nVh(26,H1,4,3,"button",26),Fl.j41(27,"button",24),Fl.bIt("click",function(){const t=a.eBV(e).$implicit,i=Fl.XpG(2);return a.Njj(i.onDelete(t))}),Fl.j41(28,"span",27),Fl.nrm(29,"i",28),Fl.EFF(30),Fl.nI1(31,"i18n"),Fl.k0s()()()()()}if(2&e){const e=t.$implicit,i=Fl.sdS(21),n=Fl.XpG(2);Fl.R7$(4),Fl.vxM(e.type==n.sendType.File?4:-1),Fl.R7$(),Fl.vxM(e.type==n.sendType.Text?5:-1),Fl.R7$(2),Fl.SpI(" ",e.name," "),Fl.R7$(),Fl.vxM(e.disabled?8:-1),Fl.R7$(),Fl.vxM(e.authType!==n.authType.None?9:-1),Fl.R7$(),Fl.vxM(e.maxAccessCountReached?10:-1),Fl.R7$(),Fl.vxM(e.expired?11:-1),Fl.R7$(),Fl.vxM(e.pendingDelete?12:-1),Fl.R7$(3),Fl.SpI(" ",Fl.i5U(16,15,e.deletionDate,"medium")," "),Fl.R7$(3),Fl.Y8G("label",Fl.mNQ(Fl.bMT(19,18,"options")))("bitMenuTriggerFor",i),Fl.R7$(6),Fl.SpI(" ",Fl.bMT(25,20,"copySendLink")," "),Fl.R7$(2),Fl.vxM(e.password&&!n.disableSend()?26:-1),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(31,22,"delete")," ")}}function Z1(e,t){if(1&e&&(Fl.DNE(0,J1,32,24,"tr",8),Fl.nI1(1,"async")),2&e){const e=t.$implicit;Fl.Y8G("ngForOf",Fl.bMT(1,1,e))}}L1.ɵfac=function(e){return new(e||L1)},L1.ɵdir=Fl.FsC({type:L1,selectors:[["","appStopProp",""]],hostBindings:function(e,t){1&e&&Fl.bIt("click",function(e){return t.onClick(e)})},standalone:!1});class Q1{constructor(){this.sendType=u0,this.authType=y0,this.dataSource=(0,o.hFB)(),this.disableSend=(0,o.hFB)(!1),this.editSend=(0,o.CGW)(),this.copySend=(0,o.CGW)(),this.removePassword=(0,o.CGW)(),this.deleteSend=(0,o.CGW)()}onEditSend(e){this.editSend.emit(e)}onCopy(e){this.copySend.emit(e)}onRemovePassword(e){this.removePassword.emit(e)}onDelete(e){this.deleteSend.emit(e)}}Q1.ɵfac=function(e){return new(e||Q1)},Q1.ɵcmp=Fl.VBU({type:Q1,selectors:[["tools-send-table"]],inputs:{dataSource:[1,"dataSource"],disableSend:[1,"disableSend"]},outputs:{editSend:"editSend",copySend:"copySend",removePassword:"removePassword",deleteSend:"deleteSend"},decls:14,vars:10,consts:[["sendOptions",""],[1,"tw-@container/send-table"],[3,"dataSource"],["header",""],["bitCell","","bitSortable","name","default",""],["bitCell","","bitSortable","deletionDate",1,"@lg/send-table:tw-table-cell","tw-hidden"],["bitCell",""],["body",""],["bitRow","",4,"ngFor","ngForOf"],["bitRow",""],["bitCell","",1,"tw-cursor-pointer",3,"click"],[1,"tw-flex","tw-gap-2","tw-items-center"],["aria-hidden","true"],[1,"bwi","bwi-fw","bwi-lg","bwi-file","tw-text-muted"],[1,"bwi","bwi-fw","bwi-lg","bwi-file-text","tw-text-muted"],["type","button","bitLink",""],["appStopProp","","tabindex","0",1,"bwi","bwi-exclamation-triangle",3,"title","aria-label"],["appStopProp","","tabindex","0",1,"bwi","bwi-lock",3,"title","aria-label"],["appStopProp","","tabindex","0",1,"bwi","bwi-clock",3,"title","aria-label"],["appStopProp","","tabindex","0",1,"bwi","bwi-trash",3,"title","aria-label"],["bitCell","",1,"tw-text-muted","tw-cursor-pointer","@lg/send-table:tw-table-cell","tw-hidden",3,"click"],["bitTypography","body2","appStopProp",""],["bitCell","",1,"tw-w-0","tw-text-right"],["type","button","size","small","bitIconButton","bwi-ellipsis-v",3,"bitMenuTriggerFor","label"],["type","button","bitMenuItem","",3,"click"],["aria-hidden","true",1,"bwi","bwi-fw","bwi-clone"],["type","button","bitMenuItem",""],[1,"tw-text-danger"],["aria-hidden","true",1,"bwi","bwi-fw","bwi-trash"],["aria-hidden","true",1,"bwi","bwi-fw","bwi-close"]],template:function(e,t){1&e&&(Fl.j41(0,"div",1)(1,"bit-table",2),Fl.qex(2,3),Fl.j41(3,"tr")(4,"th",4),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.j41(7,"th",5),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.j41(10,"th",6),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s()(),Fl.bVm(),Fl.DNE(13,Z1,2,3,"ng-template",7),Fl.k0s()()),2&e&&(Fl.R7$(),Fl.Y8G("dataSource",t.dataSource()),Fl.R7$(4),Fl.JRh(Fl.bMT(6,4,"name")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(9,6,"deletionDate")," "),Fl.R7$(3),Fl.JRh(Fl.bMT(12,8,"options")))},dependencies:[kl.MD,kl.Sq,sf,L1,Xh,Dz,Eh,yZ,Nh,Vh,id,Hh,uw,Ql,Zl,qh,pz,fz,D$,eu,tc,rc,kl.Jj,kl.vh,rf],encapsulation:2,changeDetection:0});const e2=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="9 4 83.89 91">
<path class="tw-fill-illustration-bg-secondary" d="M67 12a2 2 0 0 1 2 2v76a2 2 0 0 1-2 2H11a2 2 0 0 1-2-2V14a2 2 0 0 1 2-2h56Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M67 90V14H11v76h56Zm2-76a2 2 0 0 0-2-2H11a2 2 0 0 0-2 2v76a2 2 0 0 0 2 2h56a2 2 0 0 0 2-2V14Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="M77 82V6a2 2 0 0 0-2-2H32.328c-.53 0-1.034.206-1.41.581L17.585 17.916A1.993 1.993 0 0 0 17 19.328V82a2 2 0 0 0 2 2h56a2 2 0 0 0 2-2Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M75 82V6H32.328L19 19.328V82h56ZM32.333 5.995ZM77 6v76a2 2 0 0 1-2 2H19a2 2 0 0 1-2-2V19.328c0-.53.209-1.037.584-1.412L30.919 4.581c.375-.375.879-.581 1.41-.581H75a2 2 0 0 1 2 2Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M33 5a1 1 0 0 1 1 1v15H19a1 1 0 1 1 0-2h13V6a1 1 0 0 1 1-1Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" d="M37 35a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H40a3 3 0 0 1-3-3V35Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M54 34H40a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V35a1 1 0 0 0-1-1Zm-14-2a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3V35a3 3 0 0 0-3-3H40Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" d="M46 38a1 1 0 1 1 2 0v4a1 1 0 1 1-2 0v-4Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M42 31a5 5 0 0 1 10 0v1h-2v-1a3 3 0 1 0-6 0v1h-2v-1Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="M62 92.058V78l12 6.4-8.658 9.004A1.942 1.942 0 0 1 62 92.058Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="m61 76.333 14.637 7.807-9.574 9.957A2.942 2.942 0 0 1 61 92.057V76.333Zm2 3.333v12.391a.942.942 0 0 0 1.621.653l7.742-8.05L63 79.666Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M42.55 65.971 88.334 44.54c1.76-.824 3.746.587 3.546 2.52l-4.604 44.648c-.197 1.91-2.386 2.895-3.946 1.773L62.5 78.5l-19.82-7.944c-2.03-.813-2.11-3.657-.13-4.585Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M90.886 46.957a1.5 1.5 0 0 0-2.128-1.512L42.974 66.878c-1.188.556-1.14 2.262.078 2.75l19.164 7.681 12.867-14.613a1 1 0 1 1 1.501 1.321L63.98 78.333l19.934 14.336a1.5 1.5 0 0 0 2.367-1.064l4.605-44.648ZM62.015 79.383l-19.707-7.898c-2.842-1.139-2.955-5.12-.182-6.419L87.91 43.634c2.464-1.154 5.244.822 4.965 3.529L88.271 91.81c-.276 2.675-3.341 4.053-5.525 2.482L62.015 79.383Z" clip-rule="evenodd"/>
</svg>
`,t2=[[["","slot","empty-button"]]];function i2(e,t){1&e&&Fl.nrm(0,"bit-spinner")}function n2(e,t){1&e&&Fl.nrm(0,"tools-send-search")}function r2(e,t){if(1&e&&(Fl.j41(0,"bit-no-items",1),Fl.qex(1,2),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.bVm(),Fl.qex(4,3),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.bVm(),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.Y8G("icon",e.noItemIcon),Fl.R7$(2),Fl.JRh(Fl.bMT(3,3,"sendsTitleNoSearchResults")),Fl.R7$(3),Fl.JRh(Fl.bMT(6,5,"sendsBodyNoSearchResults"))}}function s2(e,t){if(1&e&&(Fl.j41(0,"bit-no-items",1),Fl.qex(1,2),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.bVm(),Fl.qex(4,3),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.bVm(),Fl.SdG(7,0,["slot","button"]),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.Y8G("icon",e.noItemIcon),Fl.R7$(2),Fl.JRh(Fl.bMT(3,3,"sendsTitleNoItems")),Fl.R7$(3),Fl.JRh(Fl.bMT(6,5,"sendsBodyNoItems"))}}function o2(e,t){if(1&e){const e=Fl.RV6();Fl.nVh(0,n2,1,0,"tools-send-search"),Fl.j41(1,"tools-send-table",0),Fl.bIt("editSend",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.onEditSend(t))})("copySend",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.onCopySend(t))})("removePassword",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.onRemovePassword(t))})("deleteSend",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.onDeleteSend(t))}),Fl.k0s(),Fl.nVh(2,r2,7,7,"bit-no-items",1)(3,s2,8,7,"bit-no-items",1)}if(2&e){const e=Fl.XpG();Fl.vxM(e.showSearchBar()?0:-1),Fl.R7$(),Fl.Y8G("dataSource",e.dataSource)("disableSend",e.disableSend()),Fl.R7$(),Fl.vxM(e.noSearchResults()?2:e.listState()===e.sendListState.NoResults||e.listState()===e.sendListState.Empty?3:-1)}}const a2=Object.freeze({Empty:"Empty",NoResults:"NoResults"});class l2{constructor(){this.noItemIcon=e2,this.noResultsIcon=aG,this.sendListState=a2,this.sends=o.hFB.required(),this.loading=(0,o.hFB)(!1),this.disableSend=(0,o.hFB)(!1),this.listState=(0,o.hFB)(null),this.searchText=(0,o.hFB)(""),this.showSearchBar=(0,Rl.EW)(()=>this.sends().length>0||this.searchText().length>0),this.noSearchResults=(0,Rl.EW)(()=>this.showSearchBar()&&0===this.sends().length),this.dataSource=new Az,this.editSend=(0,o.CGW)(),this.copySend=(0,o.CGW)(),this.removePassword=(0,o.CGW)(),this.deleteSend=(0,o.CGW)(),(0,Rl.QZ)(()=>{this.dataSource.data=this.sends()})}onEditSend(e){this.editSend.emit(e)}onCopySend(e){this.copySend.emit(e)}onRemovePassword(e){this.removePassword.emit(e)}onDeleteSend(e){this.deleteSend.emit(e)}}l2.ɵfac=function(e){return new(e||l2)},l2.ɵcmp=Fl.VBU({type:l2,selectors:[["tools-send-list"]],inputs:{sends:[1,"sends"],loading:[1,"loading"],disableSend:[1,"disableSend"],listState:[1,"listState"],searchText:[1,"searchText"]},outputs:{editSend:"editSend",copySend:"copySend",removePassword:"removePassword",deleteSend:"deleteSend"},ngContentSelectors:["[slot='empty-button']"],decls:2,vars:1,consts:[[3,"editSend","copySend","removePassword","deleteSend","dataSource","disableSend"],[3,"icon"],["slot","title"],["slot","description"]],template:function(e,t){1&e&&(Fl.NAR(t2),Fl.nVh(0,i2,1,0,"bit-spinner")(1,o2,4,4)),2&e&&Fl.vxM(t.loading()?0:1)},dependencies:[kl.MD,sf,id,Wh,cG,Nl,T1,Q1,rf],encapsulation:2,changeDetection:0});class c2 extends Bd{constructor(){super(...arguments),this.routerCacheService=(0,a.WQX)(WD),this.handler=(0,o.geq)(()=>this.routerCacheService.back(),{alias:"popupBackAction"})}}c2.ɵfac=(()=>{let e;return function(t){return(e||(e=Fl.xGo(c2)))(t||c2)}})(),c2.ɵdir=Fl.FsC({type:c2,selectors:[["","popupBackAction",""]],inputs:{handler:[1,"popupBackAction","handler"]},outputs:{handler:"popupBackActionChange"},features:[Fl.Vt3]});var u2=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function d2(e,t){if(1&e&&(Fl.nrm(0,"button",7),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG();Fl.Y8G("label",Fl.mNQ(Fl.bMT(1,3,"delete")))("bitAction",e.deleteSend)}}class h2{constructor(e){this.sendId=e.sendId;const t=parseInt(e.type,10);if(t!==u0.Text&&t!==u0.File)throw new Error(`Invalid SendType: ${e.type}`);this.type=t}}class p2{constructor(e,t,i,n,r,s,o,a){this.route=e,this.location=t,this.i18nService=i,this.addEditFormConfigService=n,this.sendApiService=r,this.toastService=s,this.dialogService=o,this.router=a,this.deleteSend=()=>u2(this,void 0,void 0,function*(){var e;if(yield this.dialogService.openSimpleDialog({title:{key:"deleteSend"},content:{key:"deleteSendPermanentConfirmation"},type:"warning"})){try{yield this.sendApiService.delete(null===(e=this.config.originalSend)||void 0===e?void 0:e.id)}catch(e){return void this.toastService.showToast({variant:"error",title:null,message:e.message})}this.location.back(),this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("deletedSend")})}}),this.subscribeToParams()}onSendCreated(e){return u2(this,void 0,void 0,function*(){yield this.router.navigate(["/send-created"],{queryParams:{sendId:e.id}})})}onSendUpdated(e){return u2(this,void 0,void 0,function*(){yield this.router.navigate(["/tabs/send"])})}subscribeToParams(){this.route.queryParams.pipe((0,xl.pQ)(),(0,l.T)(e=>new h2(e)),(0,go.n)(e=>u2(this,void 0,void 0,function*(){let t;t=null==e.sendId?"add":"edit";return yield this.addEditFormConfigService.buildConfig(t,e.sendId,e.type)}))).subscribe(e=>{this.config=e,this.headerText=this.getHeaderText(e.mode,e.sendType)})}getHeaderText(e,t){const i="edit"===e||"partial-edit"===e,n={[u0.Text]:i?"editItemHeaderTextSend":"newItemHeaderTextSend",[u0.File]:i?"editItemHeaderFileSend":"newItemHeaderFileSend"};return this.i18nService.t(n[t])}}p2.ɵfac=function(e){return new(e||p2)(Fl.rXU(Fd.nX),Fl.rXU(IF.aZ),Fl.rXU(Ul),Fl.rXU(Q0),Fl.rXU(F0),Fl.rXU(qb),Fl.rXU(lh),Fl.rXU(Fd.Ix))},p2.ɵcmp=Fl.VBU({type:p2,selectors:[["tools-send-add-edit"]],features:[Fl.Jv_([{provide:Q0,useClass:t1}])],decls:12,vars:10,consts:[["submitBtn",""],["slot","header","showBackButton","",3,"pageTitle"],["formId","sendForm",3,"onSendCreated","onSendUpdated","config","submitBtn"],["slot","footer"],["bitButton","","type","submit","form","sendForm","buttonType","primary"],["bitButton","","type","button","buttonType","secondary",3,"popupBackAction"],["type","button","buttonType","danger","slot","end","bitIconButton","bwi-trash",3,"bitAction","label",4,"ngIf"],["type","button","buttonType","danger","slot","end","bitIconButton","bwi-trash",3,"bitAction","label"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"popup-page"),Fl.nrm(1,"popup-header",1),Fl.j41(2,"tools-send-form",2),Fl.bIt("onSendCreated",function(i){return a.eBV(e),a.Njj(t.onSendCreated(i))})("onSendUpdated",function(i){return a.eBV(e),a.Njj(t.onSendUpdated(i))}),Fl.k0s(),Fl.j41(3,"popup-footer",3)(4,"button",4,0),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s(),Fl.j41(8,"button",5),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s(),Fl.DNE(11,d2,2,5,"button",6),Fl.k0s()()}if(2&e){const e=Fl.sdS(5);Fl.R7$(),Fl.Y8G("pageTitle",t.headerText),Fl.R7$(),Fl.Y8G("config",t.config)("submitBtn",e),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(7,6,"save")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(10,8,"cancel")," "),Fl.R7$(2),Fl.Y8G("ngIf","add"!==(null==t.config?null:t.config.mode))}},dependencies:[kl.MD,kl.bT,iO,sf,Il.YN,id,td,Ql,Zl,tE,aE,TQ,Z0,q0,pc,Bd,c2,rf],encapsulation:2});const v2=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="5 4 87 87">
<path class="tw-fill-illustration-bg-primary" d="M90 48c0 23.196-18.804 42-42 42S6 71.196 6 48 24.804 6 48 6s42 18.804 42 42Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M48 7C25.356 7 7 25.356 7 48s18.356 41 41 41 41-18.356 41-41S70.644 7 48 7ZM5 48C5 24.252 24.252 5 48 5s43 19.252 43 43-19.252 43-43 43S5 71.748 5 48Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" d="M11 72a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H14a3 3 0 0 1-3-3V72Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M28 71H14a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V72a1 1 0 0 0-1-1Zm-14-2a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3V72a3 3 0 0 0-3-3H14Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" d="M20 75a1 1 0 1 1 2 0v4a1 1 0 1 1-2 0v-4Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M16 68a5 5 0 0 1 10 0v1h-2v-1a3 3 0 1 0-6 0v1h-2v-1Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" d="M92 16c0 6.627-5.373 12-12 12s-12-5.373-12-12S73.373 4 80 4s12 5.373 12 12Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M80 26c5.523 0 10-4.477 10-10S85.523 6 80 6s-10 4.477-10 10 4.477 10 10 10Zm0 2c6.627 0 12-5.373 12-12S86.627 4 80 4 68 9.373 68 16s5.373 12 12 12Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M85.707 12.293a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414 0l-3-3a1 1 0 0 1 1.414-1.414L78 18.586l6.293-6.293a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" d="M43 60.883V52l7 4-5.052 5.63A1.117 1.117 0 0 1 43 60.882Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="m42 50.276 9.571 5.47-5.878 6.55A2.117 2.117 0 0 1 42 60.884V50.276Zm2 3.447v7.16a.117.117 0 0 0 .204.078l4.225-4.708L44 53.723Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M31.186 44.957 58.6 32.123a1.5 1.5 0 0 1 2.128 1.513l-2.763 26.793a1.5 1.5 0 0 1-2.366 1.066L42.3 51.965l-11.018-4.25c-1.233-.476-1.293-2.198-.096-2.758Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M59.733 33.533a.5.5 0 0 0-.709-.504L31.61 45.862a.5.5 0 0 0 .032.92l10.42 4.02 8.341-8.106a1 1 0 1 1 1.394 1.434l-7.942 7.719 12.327 8.833a.5.5 0 0 0 .788-.356l2.764-26.793Zm-17.912 19.32-10.899-4.206c-2.054-.793-2.154-3.663-.16-4.596l27.414-12.834c1.76-.824 3.746.588 3.547 2.521L58.96 60.532c-.197 1.909-2.383 2.893-3.943 1.775l-13.196-9.455Z" clip-rule="evenodd"/>
</svg>
`;var f2=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class m2{constructor(e,t,i,n,r,s,o){this.i18nService=e,this.platformUtilsService=t,this.sendService=i,this.route=n,this.toastService=r,this.router=s,this.environmentService=o,this.AuthType=y0,this.sendCreatedIcon=v2,this.daysAvailable=0,this.hoursAvailable=0;const a=this.route.snapshot.queryParamMap.get("sendId");this.sendService.sendViews$.pipe((0,xl.pQ)()).subscribe(e=>{this.send=e.find(e=>e.id===a),this.send&&(this.hoursAvailable=this.getHoursAvailable(this.send),this.daysAvailable=Math.ceil(this.hoursAvailable/24))})}get formattedExpirationTime(){var e;return(null===(e=this.send)||void 0===e?void 0:e.deletionDate)?this.hoursAvailable<24?1===this.hoursAvailable?this.i18nService.t("oneHour").toLowerCase():this.i18nService.t("durationTimeHours",String(this.hoursAvailable)).toLowerCase():1===this.daysAvailable?this.i18nService.t("oneDay").toLowerCase():this.i18nService.t("days",String(this.daysAvailable)).toLowerCase():""}getHoursAvailable(e){const t=(new Date).getTime();return Math.max(0,Math.ceil((e.deletionDate.getTime()-t)/36e5))}goToEditSend(){return f2(this,void 0,void 0,function*(){yield this.router.navigate(["/edit-send"],{queryParams:{sendId:this.send.id,type:this.send.type}})})}goBack(){return f2(this,void 0,void 0,function*(){yield this.router.navigate(["/tabs/send"])})}copyLink(){return f2(this,void 0,void 0,function*(){if(!this.send||!this.send.accessId||!this.send.urlB64Key)return;const e=(yield(0,bo._)(this.environmentService.environment$)).getSendUrl()+this.send.accessId+"/"+this.send.urlB64Key;this.platformUtilsService.copyToClipboard(e),this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("sendLinkCopied")})})}}m2.ɵfac=function(e){return new(e||m2)(Fl.rXU(Ul),Fl.rXU(Hb),Fl.rXU(W0),Fl.rXU(Fd.nX),Fl.rXU(qb),Fl.rXU(Fd.Ix),Fl.rXU(mk))},m2.ɵcmp=Fl.VBU({type:m2,selectors:[["app-send-created"]],decls:26,vars:21,consts:[["slot","header","showBackButton","",3,"pageTitle","backAction"],["slot","end"],[1,"tw-flex","tw-bg-background-alt","tw-flex-col","tw-justify-center","tw-items-center","tw-gap-2","tw-h-full","tw-px-5"],[1,"tw-size-[95px]","tw-content-center"],[3,"content"],["tabindex","0","appAutofocus","",1,"tw-font-medium"],[1,"tw-text-center"],["bitButton","","type","button","buttonType","primary",3,"click"],["slot","footer"],["bitButton","","type","button","buttonType","secondary",3,"click"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"popup-page")(1,"popup-header",0),Fl.nI1(2,"i18n"),Fl.qex(3,1),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.j41(5,"div",2)(6,"div",3),Fl.nrm(7,"bit-svg",4),Fl.k0s(),Fl.j41(8,"h3",5),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s(),Fl.j41(11,"p",6),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s(),Fl.j41(14,"button",7),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.copyLink())}),Fl.j41(15,"b"),Fl.EFF(16),Fl.nI1(17,"i18n"),Fl.k0s()()(),Fl.j41(18,"popup-footer",8)(19,"button",7),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.copyLink())}),Fl.j41(20,"b"),Fl.EFF(21),Fl.nI1(22,"i18n"),Fl.k0s()(),Fl.j41(23,"button",9),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.goBack())}),Fl.EFF(24),Fl.nI1(25,"i18n"),Fl.k0s()()()}if(2&e){Fl.R7$(),Fl.Y8G("pageTitle",Fl.bMT(2,8,"createdSend"))("backAction",t.goToEditSend.bind(t)),Fl.R7$(6),Fl.Y8G("content",t.sendCreatedIcon),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(10,10,"createdSendSuccessfully")," ");const e=t.send.authType===t.AuthType.Email?"sendCreatedDescriptionEmail":t.send.authType===t.AuthType.Password?"sendCreatedDescriptionPassword":"sendCreatedDescriptionV2";Fl.R7$(3),Fl.SpI(" ",Fl.i5U(13,12,e,t.formattedExpirationTime)," "),Fl.R7$(4),Fl.JRh(Fl.bMT(17,15,"copyLink")),Fl.R7$(5),Fl.JRh(Fl.bMT(22,17,"copyLink")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(25,19,"close")," ")}},dependencies:[id,td,kl.MD,sf,wd,GD,aE,tE,Cw.iI,TQ,Yh,BC,rf],encapsulation:2});const g2=[[["","slot","start"]],"*",[["","slot","end"]]];class y2{}y2.ɵfac=function(e){return new(e||y2)},y2.ɵcmp=Fl.VBU({type:y2,selectors:[["bit-skeleton-group"]],hostAttrs:[1,"tw-block"],ngContentSelectors:["[slot=start]","*","[slot=end]"],decls:5,vars:0,consts:[[1,"tw-flex","tw-flex-row","tw-justify-between","tw-gap-2"],[1,"tw-flex","tw-gap-2","tw-w-full"]],template:function(e,t){1&e&&(Fl.NAR(g2),Fl.rj2(0,"div",0)(1,"div",1),Fl.SdG(2),Fl.SdG(3,1),Fl.eux(),Fl.SdG(4,2),Fl.eux())},dependencies:[kl.MD],encapsulation:2});const b2=(e,t)=>({"tw-rounded":e,"tw-rounded-full":t});class w2{constructor(){this.edgeShape=(0,o.hFB)("box")}}w2.ɵfac=function(e){return new(e||w2)},w2.ɵcmp=Fl.VBU({type:w2,selectors:[["bit-skeleton"]],hostAttrs:[1,"tw-block"],inputs:{edgeShape:[1,"edgeShape"]},decls:1,vars:4,consts:[["aria-hidden","true",1,"tw-size-full","tw-bg-secondary-100","tw-animate-pulse",3,"ngClass"]],template:function(e,t){1&e&&Fl.nrm(0,"div",0),2&e&&Fl.Y8G("ngClass",Fl.l_i(1,b2,"box"===t.edgeShape(),"circle"===t.edgeShape()))},dependencies:[kl.MD,kl.YU],encapsulation:2});const S2=(e,t)=>({"tw-w-full":e,"tw-w-1/3":t});function k2(e,t){if(1&e&&Fl.nrm(0,"bit-skeleton",1),2&e){const e=t.$index,i=t.$count;Fl.Y8G("ngClass",Fl.l_i(1,S2,0===e||!(e===i-1),!(0===e)&&e===i-1))}}class I2{constructor(){this.lines=(0,o.hFB)(1),this.linesArray=(0,Rl.EW)(()=>[...Array(this.lines()).keys()])}}function C2(e,t){1&e&&(Fl.j41(0,"bit-skeleton-group",3),Fl.nrm(1,"bit-skeleton",4),Fl.j41(2,"div",5),Fl.nrm(3,"bit-skeleton",6)(4,"bit-skeleton",7),Fl.k0s()(),Fl.nrm(5,"hr",8))}I2.ɵfac=function(e){return new(e||I2)},I2.ɵcmp=Fl.VBU({type:I2,selectors:[["bit-skeleton-text"]],hostAttrs:[1,"tw-block"],inputs:{lines:[1,"lines"]},decls:3,vars:0,consts:[[1,"tw-w-full","tw-flex","tw-flex-col","tw-gap-2"],[1,"tw-h-3",3,"ngClass"]],template:function(e,t){1&e&&(Fl.j41(0,"div",0),Fl.Z7z(1,k2,1,4,"bit-skeleton",1,Fl.Vm6),Fl.k0s()),2&e&&(Fl.R7$(),Fl.Dyx(t.linesArray()))},dependencies:[kl.MD,kl.YU,w2],encapsulation:2});class T2{constructor(){this.numberOfItems=new Array(15).fill(null)}}T2.ɵfac=function(e){return new(e||T2)},T2.ɵcmp=Fl.VBU({type:T2,selectors:[["vault-loading-skeleton"]],decls:5,vars:0,consts:[["aria-hidden","true"],[1,"tw-mt-1.5","tw-flex","tw-flex-col","tw-gap-4"],[1,"tw-w-[8.625rem]","tw-max-w-full","tw-mb-2.5"],[1,"tw-mx-2"],["slot","start",1,"tw-size-6"],[1,"tw-flex","tw-flex-col","tw-gap-1"],[1,"tw-w-40","tw-h-2.5","tw-max-w-full"],[1,"tw-w-24","tw-h-2.5","tw-max-w-full"],[1,"tw-h-[1px]","-tw-mr-3","tw-bg-secondary-100","tw-border-none"]],template:function(e,t){1&e&&(Fl.j41(0,"section",0)(1,"div",1),Fl.nrm(2,"bit-skeleton-text",2),Fl.Z7z(3,C2,6,0,null,null,Fl.Vm6),Fl.k0s()()),2&e&&(Fl.R7$(3),Fl.Dyx(t.numberOfItems))},dependencies:[y2,w2,I2],encapsulation:2,changeDetection:0});const P2="premium",F2="families",R2="free",x2="teams",A2="enterprise",D2="custom",E2="annually",$2="monthly";class O2{}var U2=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function M2(e,t){if(1&e&&(Fl.j41(0,"div",9)(1,"div",15)(2,"span",16),Fl.EFF(3),Fl.nI1(4,"currency"),Fl.k0s(),Fl.j41(5,"span",17),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s()()()),2&e){const e=Fl.XpG();Fl.R7$(3),Fl.JRh(Fl.i5U(4,2,e.price.amount,"$")),Fl.R7$(3),Fl.SpI(" / ",Fl.bMT(7,5,e.price.cadence)," ")}}function N2(e,t){if(1&e&&Fl.nrm(0,"i",18),2&e){const e=Fl.XpG();Fl.HbH(Fl.VkB("bwi ",e.button.icon.type," tw-me-2"))}}function V2(e,t){if(1&e&&Fl.nrm(0,"i",18),2&e){const e=Fl.XpG();Fl.HbH(Fl.VkB("bwi ",e.button.icon.type," tw-ms-2"))}}function B2(e,t){if(1&e&&(Fl.j41(0,"li",19),Fl.nrm(1,"i",20),Fl.j41(2,"span",21),Fl.EFF(3),Fl.k0s()()),2&e){const e=t.$implicit;Fl.R7$(3),Fl.JRh(e)}}function j2(e,t){if(1&e&&(Fl.j41(0,"ul",14),Fl.Z7z(1,B2,4,1,"li",19,Fl.fX1),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Dyx(e.features)}}function G2(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"section",0)(1,"header",1)(2,"button",2),Fl.nI1(3,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.close())}),Fl.k0s()(),Fl.j41(4,"div",3)(5,"div",4)(6,"div",5)(7,"h3",6),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s()(),Fl.j41(10,"div",7)(11,"p",8),Fl.EFF(12),Fl.k0s()(),Fl.nVh(13,M2,8,7,"div",9),Fl.j41(14,"div",10)(15,"button",11),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.upgrade())}),Fl.nVh(16,N2,1,3,"i",12),Fl.EFF(17),Fl.nVh(18,V2,1,3,"i",12),Fl.k0s()(),Fl.j41(19,"div",13),Fl.nVh(20,j2,3,0,"ul",14),Fl.k0s()()()()}if(2&e){const e=t;Fl.R7$(2),Fl.Y8G("label",Fl.bMT(3,10,"close")),Fl.R7$(6),Fl.SpI(" ",Fl.bMT(9,12,"upgradeToPremium")," "),Fl.R7$(4),Fl.SpI(" ",e.tagline," "),Fl.R7$(),Fl.vxM(e.price?13:-1),Fl.R7$(2),Fl.Y8G("buttonType",e.button.type)("block",!0),Fl.R7$(),Fl.vxM("before"===(null==e.button.icon?null:e.button.icon.position)?16:-1),Fl.R7$(),Fl.SpI(" ",e.button.text," "),Fl.R7$(),Fl.vxM(!e.button.icon||"after"!==e.button.icon.position&&e.button.icon.position?-1:18),Fl.R7$(2),Fl.vxM(e.features.length>0?20:-1)}}function L2(e,t){1&e&&(Fl.nrm(0,"i",22),Fl.nI1(1,"i18n"),Fl.j41(2,"span",23),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()),2&e&&(Fl.Y8G("title",Fl.mNQ(Fl.bMT(1,3,"loading"))),Fl.R7$(3),Fl.JRh(Fl.bMT(4,5,"loading")))}class z2{constructor(e,t,i,n,r,s,o){this.dialogRef=e,this.subscriptionPricingService=t,this.i18nService=i,this.toastService=n,this.environmentService=r,this.platformUtilsService=s,this.logService=o,this.cardDetails$=this.subscriptionPricingService.getPersonalSubscriptionPricingTiers$().pipe((0,l.T)(e=>e.find(e=>e.id===P2)),(0,l.T)(e=>this.mapPremiumTierToCardDetails(e)),(0,Ed.W)(e=>(this.toastService.showToast({variant:"error",title:this.i18nService.t("error"),message:this.i18nService.t("unexpectedError")}),this.logService.error("Error fetching and mapping pricing tiers",e),this.dialogRef.close(),Wp.w)))}upgrade(){return U2(this,void 0,void 0,function*(){const e=(yield(0,bo._)(this.environmentService.environment$)).getWebVaultUrl()+"/#/settings/subscription/premium?callToAction=upgradeToPremium";this.platformUtilsService.launchUri(e),this.dialogRef.close()})}close(){this.dialogRef.close()}mapPremiumTierToCardDetails(e){return{title:e.name,tagline:e.description,price:e.passwordManager.annualPrice?{amount:e.passwordManager.annualPrice/12,cadence:$2}:void 0,button:{text:this.i18nService.t("upgradeNow"),type:"primary",icon:{type:"bwi-external-link",position:"after"}},features:e.passwordManager.features.map(e=>e.value)}}static open(e){return e.open(z2,{positionStrategy:new sh})}}z2.ɵfac=function(e){return new(e||z2)(Fl.rXU(nh),Fl.rXU(O2),Fl.rXU(Ul),Fl.rXU(qb),Fl.rXU(mk),Fl.rXU(Hb),Fl.rXU(Za))},z2.ɵcmp=Fl.VBU({type:z2,selectors:[["billing-premium-upgrade-dialog"]],decls:3,vars:3,consts:[["cdkTrapFocus","","cdkTrapFocusAutoCapture","",1,"tw-min-w-[332px]","md:tw-max-w-sm","tw-overflow-y-auto","tw-self-center","tw-bg-background","tw-rounded-xl","tw-shadow-lg","tw-border-secondary-100","tw-border-solid","tw-border"],[1,"tw-flex","tw-items-center","tw-justify-end","tw-pl-6","tw-pt-3","tw-pr-2","!tw-bg-background","!tw-border-none"],["type","button","bitIconButton","bwi-close","buttonType","main","size","default",3,"click","label"],[1,"tw-flex","tw-justify-center","tw-mb-6"],[1,"tw-box-border","tw-bg-background","tw-text-main","tw-size-full","tw-flex","tw-flex-col","tw-px-8","tw-pb-2","tw-w-full","tw-max-w-md"],[1,"tw-flex","tw-items-center","tw-justify-between"],["slot","title","bitTypography","h3",1,"tw-m-0"],[1,"tw-h-6"],["bitTypography","helper",1,"tw-text-muted","tw-m-0","tw-leading-relaxed","tw-line-clamp-2"],[1,"tw-mt-5"],[1,"tw-my-5","tw-h-12"],["cdkFocusInitial","","bitButton","","type","button",3,"click","buttonType","block"],["aria-hidden","true",3,"class"],[1,"tw-flex-grow"],[1,"tw-list-none","tw-p-0","tw-m-0"],[1,"tw-flex","tw-items-baseline","tw-gap-1","tw-flex-wrap"],[1,"tw-text-3xl","tw-font-medium","tw-leading-none","tw-m-0"],["bitTypography","helper",1,"tw-text-muted"],["aria-hidden","true"],[1,"tw-flex","tw-items-start","tw-gap-2","tw-mb-2","last:tw-mb-0"],["aria-hidden","true",1,"bwi","bwi-check","tw-text-primary-600","tw-mt-0.5","tw-flex-shrink-0"],["bitTypography","helper",1,"tw-text-muted","tw-leading-relaxed"],["aria-hidden","true",1,"bwi","bwi-spinner","bwi-spin","tw-text-muted",3,"title"],[1,"tw-sr-only"]],template:function(e,t){if(1&e&&(Fl.nVh(0,G2,21,14,"section",0),Fl.nI1(1,"async"),Fl.vZN(2,L2,5,7)),2&e){let e;Fl.vxM((e=Fl.bMT(1,1,t.cardDetails$))?0:2,e)}},dependencies:[kl.MD,Fh,id,td,Ql,Zl,tc,rc,gl.kB,sf,kl.Jj,kl.oe,rf],encapsulation:2,changeDetection:0});var _2=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class K2{constructor(){this.router=(0,a.WQX)(Fd.Ix),this.configService=(0,a.WQX)(Kb),this.dialogService=(0,a.WQX)(lh)}promptForPremium(){return _2(this,void 0,void 0,function*(){(yield this.configService.getFeatureFlag(Wv.PM23713_PremiumBadgeOpensNewPremiumUpgradeDialog))?z2.open(this.dialogService):yield this.router.navigate(["/premium"])})}}function X2(e=1e3,t=1e3){return i=>(0,$o.v)(()=>{let n=null;return i.pipe((0,go.n)(i=>{if(i)return null!==n?(0,Go.of)(!0):(0,xo.O)(e).pipe((0,Oo.M)(()=>{n=Date.now()}),(0,l.T)(()=>!0));{if(null===n)return(0,Go.of)(!1);const e=Date.now()-n,i=Math.max(0,t-e);return(0,xo.O)(i).pipe((0,Oo.M)(()=>{n=null}),(0,l.T)(()=>!1))}}))})}class q2{constructor(){this.fadeInOut=!0}}function W2(e,t){1&e&&Fl.nrm(0,"tools-new-send-dropdown")}function Y2(e,t){1&e&&(Fl.j41(0,"bit-callout",7),Fl.nI1(1,"i18n"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()),2&e&&(Fl.Y8G("title",Fl.bMT(1,2,"sendDisabled")),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,4,"sendDisabledWarning")," "))}function H2(e,t){1&e&&(Fl.qex(0),Fl.nrm(1,"tools-send-search")(2,"app-send-list-filters"),Fl.bVm())}function J2(e,t){1&e&&Fl.nrm(0,"tools-new-send-dropdown",14),2&e&&Fl.Y8G("hideIcon",!0)("buttonType","secondary")}function Z2(e,t){if(1&e&&(Fl.j41(0,"div",8)(1,"bit-no-items",9),Fl.qex(2,10),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.bVm(),Fl.qex(5,11),Fl.j41(6,"p",12),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.bVm(),Fl.DNE(9,J2,1,2,"tools-new-send-dropdown",13),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("icon",e.noItemIcon),Fl.R7$(2),Fl.JRh(Fl.bMT(4,4,"sendsTitleNoItems")),Fl.R7$(4),Fl.JRh(Fl.bMT(8,6,"sendsBodyNoItems")),Fl.R7$(2),Fl.Y8G("ngIf",!e.sendsDisabled)}}function Q2(e,t){if(1&e&&(Fl.j41(0,"div",17)(1,"bit-no-items",18),Fl.qex(2,10),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.bVm(),Fl.qex(5,11),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.bVm(),Fl.k0s()()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("icon",e.noResultsIcon),Fl.R7$(2),Fl.JRh(Fl.bMT(4,3,"noItemsMatchSearch")),Fl.R7$(3),Fl.JRh(Fl.bMT(7,5,"clearFiltersOrTryAnother"))}}function e3(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,Q2,8,7,"div",15),Fl.nrm(2,"app-send-list-items-container",16),Fl.nI1(3,"i18n"),Fl.nI1(4,"async"),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("ngIf",e.listState===e.sendState.NoResults),Fl.R7$(),Fl.Y8G("headerText",Fl.bMT(3,3,e.title))("sends",Fl.bMT(4,5,e.sends$))}}function t3(e,t){1&e&&(Fl.j41(0,"vault-fade-in-out-skeleton"),Fl.nrm(1,"vault-loading-skeleton"),Fl.k0s())}q2.ɵfac=function(e){return new(e||q2)},q2.ɵcmp=Fl.VBU({type:q2,selectors:[["vault-fade-in-out-skeleton"]],hostVars:1,hostBindings:function(e,t){2&e&&Fl.zvX("@fadeInOut",t.fadeInOut)},ngContentSelectors:["*"],decls:2,vars:0,consts:[[1,"tw-absolute","tw-left-0","tw-top-0","tw-size-full","tw-p-3","tw-overflow-hidden","tw-bg-background-alt"]],template:function(e,t){1&e&&(Fl.NAR(),Fl.rj2(0,"div",0),Fl.SdG(1),Fl.eux())},encapsulation:2,data:{animation:[(0,Pl.hZ)("fadeInOut",[(0,Pl.kY)(":enter",[(0,Pl.iF)({opacity:0}),(0,Pl.i0)("100ms ease-in",(0,Pl.iF)({opacity:1}))]),(0,Pl.kY)(":leave",[(0,Pl.i0)("300ms ease-out",(0,Pl.iF)({opacity:0}))])])]},changeDetection:0});const i3=Object.freeze({Empty:"Empty",NoResults:"NoResults"});class n3{constructor(e,t,i,n,r){this.sendItemsService=e,this.sendListFiltersService=t,this.policyService=i,this.accountService=n,this.searchService=r,this.sendType=u0,this.sendState=i3,this.listState=null,this.sends$=this.sendItemsService.filteredAndSortedSends$,this.sendsLoading$=this.sendItemsService.loading$.pipe((0,mo.F)(),(0,Gp.t)({bufferSize:1,refCount:!0})),this.showSkeletonsLoaders$=(0,jo.z)([this.sendsLoading$,this.searchService.isSendSearching$]).pipe((0,l.T)(([e,t])=>e||t),(0,mo.F)(),X2()),this.title="allSends",this.noItemIcon=e2,this.noResultsIcon=aG,this.sendsDisabled=!1,this.sendTypeTitles={[u0.File]:"fileSends",[u0.Text]:"textSends"},(0,jo.z)([this.sendItemsService.emptyList$,this.sendItemsService.noFilteredResults$,this.sendListFiltersService.filters$]).pipe((0,xl.pQ)()).subscribe(([e,t,i])=>{var n;null!==(null==i?void 0:i.sendType)?this.title=null!==(n=this.sendTypeTitles[i.sendType])&&void 0!==n?n:"allSends":this.title="allSends",this.listState=e?i3.Empty:t?i3.NoResults:null}),this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.policyService.policyAppliesToUser$(op.DisableSend,e)),(0,xl.pQ)()).subscribe(e=>{this.sendsDisabled=e})}ngOnDestroy(){}}n3.ɵfac=function(e){return new(e||n3)(Fl.rXU(I1),Fl.rXU(k1),Fl.rXU(Jb),Fl.rXU(Zk),Fl.rXU(sQ))},n3.ɵcmp=Fl.VBU({type:n3,selectors:[["ng-component"]],features:[Fl.Jv_([{provide:qU,useClass:K2}])],decls:16,vars:16,consts:[[3,"hideOverflow"],["slot","header",3,"pageTitle"],["slot","end"],[4,"ngIf"],["slot","above-scroll-area"],[3,"title",4,"ngIf"],["class","tw-flex tw-flex-col tw-h-full tw-justify-center",4,"ngIf"],[3,"title"],[1,"tw-flex","tw-flex-col","tw-h-full","tw-justify-center"],[1,"tw-text-main",3,"icon"],["slot","title"],["slot","description"],["bitTypography","body2",1,"tw-mx-6","tw-mt-2"],["slot","button",3,"hideIcon","buttonType",4,"ngIf"],["slot","button",3,"hideIcon","buttonType"],["class","tw-flex tw-flex-col tw-justify-center tw-h-auto tw-pt-12",4,"ngIf"],[3,"headerText","sends"],[1,"tw-flex","tw-flex-col","tw-justify-center","tw-h-auto","tw-pt-12"],[3,"icon"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page",0),Fl.nI1(1,"async"),Fl.j41(2,"popup-header",1),Fl.nI1(3,"i18n"),Fl.qex(4,2),Fl.DNE(5,W2,1,0,"tools-new-send-dropdown",3),Fl.nrm(6,"app-pop-out")(7,"app-current-account"),Fl.bVm(),Fl.k0s(),Fl.qex(8,4),Fl.DNE(9,Y2,4,6,"bit-callout",5)(10,H2,3,0,"ng-container",3),Fl.bVm(),Fl.DNE(11,Z2,10,8,"div",6)(12,e3,5,7,"ng-container",3),Fl.nI1(13,"async"),Fl.nVh(14,t3,2,0,"vault-fade-in-out-skeleton"),Fl.nI1(15,"async"),Fl.k0s()),2&e&&(Fl.Y8G("hideOverflow",Fl.bMT(1,8,t.showSkeletonsLoaders$)),Fl.R7$(2),Fl.Y8G("pageTitle",Fl.bMT(3,10,"send")),Fl.R7$(3),Fl.Y8G("ngIf",!t.sendsDisabled),Fl.R7$(4),Fl.Y8G("ngIf",t.sendsDisabled),Fl.R7$(),Fl.Y8G("ngIf",t.listState!==t.sendState.Empty),Fl.R7$(),Fl.Y8G("ngIf",t.listState===t.sendState.Empty),Fl.R7$(),Fl.Y8G("ngIf",t.listState!==t.sendState.Empty&&!Fl.bMT(13,12,t.showSkeletonsLoaders$)),Fl.R7$(2),Fl.vxM(Fl.bMT(15,14,t.showSkeletonsLoaders$)?14:-1))},dependencies:[dd,ud,tE,aE,GD,_F,Wh,cG,sf,kl.MD,kl.bT,id,r1,w1,G1,T1,tc,rc,q2,T2,rf,kl.Jj],encapsulation:2});const r3=["version"];function s3(e,t){if(1&e&&(Fl.j41(0,"span"),Fl.EFF(1),Fl.nI1(2,"date"),Fl.nI1(3,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(2).ngIf;Fl.R7$(),Fl.SpI(" (",Fl.i5U(3,4,"lastSeenOn",Fl.i5U(2,1,e.serverConfig.utcDate,"mediumDate")),") ")}}function o3(e,t){if(1&e&&(Fl.j41(0,"p"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.DNE(3,s3,4,7,"span",5),Fl.k0s()),2&e){const e=Fl.XpG().ngIf;Fl.R7$(),Fl.Lme(" ",Fl.bMT(2,3,"serverVersion"),": ",null==e.serverConfig?null:e.serverConfig.version," "),Fl.R7$(2),Fl.Y8G("ngIf",!e.serverConfig.isValid())}}function a3(e,t){if(1&e&&(Fl.j41(0,"span"),Fl.EFF(1),Fl.nI1(2,"date"),Fl.nI1(3,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(3).ngIf;Fl.R7$(),Fl.SpI(" (",Fl.i5U(3,4,"lastSeenOn",Fl.i5U(2,1,e.serverConfig.utcDate,"mediumDate")),") ")}}function l3(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"p"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.j41(4,"small"),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.EFF(7),Fl.DNE(8,a3,4,7,"span",5),Fl.k0s(),Fl.j41(9,"div")(10,"small"),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s()(),Fl.bVm()),2&e){const e=Fl.XpG(2).ngIf;Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,5,"serverVersion")," "),Fl.R7$(3),Fl.SpI("(",Fl.bMT(6,7,"thirdParty"),")"),Fl.R7$(2),Fl.SpI(": ",null==e.serverConfig?null:e.serverConfig.version," "),Fl.R7$(),Fl.Y8G("ngIf",!e.serverConfig.isValid()),Fl.R7$(3),Fl.JRh(Fl.i5U(12,9,"thirdPartyServerMessage",null==e.serverConfig.server?null:e.serverConfig.server.name))}}function c3(e,t){if(1&e&&(Fl.j41(0,"span"),Fl.EFF(1),Fl.nI1(2,"date"),Fl.nI1(3,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(3).ngIf;Fl.R7$(),Fl.SpI(" (",Fl.i5U(3,4,"lastSeenOn",Fl.i5U(2,1,e.serverConfig.utcDate,"mediumDate")),") ")}}function u3(e,t){if(1&e&&(Fl.j41(0,"p"),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.j41(3,"small"),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s(),Fl.EFF(6),Fl.DNE(7,c3,4,7,"span",5),Fl.k0s()),2&e){const e=Fl.XpG(2).ngIf;Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,4,"serverVersion")," "),Fl.R7$(3),Fl.SpI("(",Fl.bMT(5,6,"selfHostedServer"),")"),Fl.R7$(2),Fl.SpI(": ",null==e.serverConfig?null:e.serverConfig.version," "),Fl.R7$(),Fl.Y8G("ngIf",!e.serverConfig.isValid())}}function d3(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,l3,13,12,"ng-container",5)(2,u3,8,8,"p",5),Fl.bVm()),2&e){const e=Fl.XpG().ngIf;Fl.R7$(),Fl.Y8G("ngIf",e.serverConfig.server),Fl.R7$(),Fl.Y8G("ngIf",!e.serverConfig.server)}}function h3(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,o3,4,5,"p",5)(2,d3,3,2,"ng-container",5),Fl.bVm()),2&e){const e=t.ngIf;Fl.R7$(),Fl.Y8G("ngIf",e.isCloud),Fl.R7$(),Fl.Y8G("ngIf",!e.isCloud)}}class p3{constructor(e,t,i,n,r,s,o){this.dialogRef=e,this.configService=t,this.environmentService=i,this.platformUtilsService=n,this.toastService=r,this.i18nService=s,this.sdkService=o,this.year=(new Date).getFullYear(),this.data$=(0,jo.z)([this.configService.serverConfig$,this.environmentService.environment$.pipe((0,l.T)(e=>e.isCloud()))]).pipe((0,l.T)(([e,t])=>({serverConfig:e,isCloud:t}))),this.sdkVersion$=this.sdkService.version$,this.version$=(0,$o.v)(()=>this.platformUtilsService.getApplicationVersion())}copyVersion(){this.platformUtilsService.copyToClipboard(this.version.nativeElement.innerText),this.toastService.showToast({message:this.i18nService.t("copySuccessful"),variant:"success"}),this.dialogRef.close()}}p3.ɵfac=function(e){return new(e||p3)(Fl.rXU(nh),Fl.rXU(Kb),Fl.rXU(mk),Fl.rXU(Hb),Fl.rXU(qb),Fl.rXU(Ul),Fl.rXU(Jk))},p3.ɵcmp=Fl.VBU({type:p3,selectors:[["ng-component"]],viewQuery:function(e,t){if(1&e&&Fl.GBs(r3,5),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.version=e.first)}},decls:26,vars:19,consts:[["version",""],["bitDialogIcon",""],["aria-hidden","true",1,"bwi","bwi-shield","bwi-3x"],["bitDialogTitle",""],["bitDialogContent",""],[4,"ngIf"],["bitDialogFooter",""],["bitButton","","bitDialogClose","","buttonType","primary","type","button"],["bitButton","","type","button",3,"click"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-simple-dialog")(1,"div",1),Fl.nrm(2,"i",2),Fl.k0s(),Fl.j41(3,"div",3),Fl.EFF(4,"Bitwarden"),Fl.k0s(),Fl.j41(5,"div",4)(6,"p"),Fl.EFF(7),Fl.k0s(),Fl.j41(8,"div",null,0)(10,"p"),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.nI1(13,"async"),Fl.k0s(),Fl.j41(14,"p"),Fl.EFF(15),Fl.nI1(16,"async"),Fl.k0s(),Fl.DNE(17,h3,3,2,"ng-container",5),Fl.nI1(18,"async"),Fl.k0s()(),Fl.qex(19,6),Fl.j41(20,"button",7),Fl.EFF(21),Fl.nI1(22,"i18n"),Fl.k0s(),Fl.j41(23,"button",8),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.copyVersion())}),Fl.EFF(24),Fl.nI1(25,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()}2&e&&(Fl.R7$(7),Fl.SpI("© Bitwarden Inc. 2015-",t.year),Fl.R7$(4),Fl.Lme("",Fl.bMT(12,7,"version"),": ",Fl.bMT(13,9,t.version$)),Fl.R7$(4),Fl.SpI("SDK: ",Fl.bMT(16,11,t.sdkVersion$)),Fl.R7$(2),Fl.Y8G("ngIf",Fl.bMT(18,13,t.data$)),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(22,15,"close")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(25,17,"copy")," "))},dependencies:[kl.MD,kl.bT,sf,Fh,ch,Wd,Yd,id,td,tc,kl.Jj,kl.vh,rf],encapsulation:2});var v3=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const f3={[Ea.ChromeExtension]:"https://chromewebstore.google.com/detail/bitwarden-free-password-m/nngceckbapebfimnlniiiahkandclblb/reviews",[Ea.FirefoxExtension]:"https://addons.mozilla.org/en-US/firefox/addon/bitwarden-password-manager/#reviews",[Ea.OperaExtension]:"https://addons.opera.com/en/extensions/details/bitwarden-free-password-manager/#feedback-container",[Ea.EdgeExtension]:"https://microsoftedge.microsoft.com/addons/detail/jbkfoedolllekgbhcbcoahefnbanhhlh",[Ea.VivaldiExtension]:"https://chromewebstore.google.com/detail/bitwarden-free-password-m/nngceckbapebfimnlniiiahkandclblb/reviews",[Ea.SafariExtension]:"https://apps.apple.com/app/bitwarden/id1352778147"};class m3{constructor(e,t,i){this.dialogService=e,this.environmentService=t,this.platformUtilsService=i}about(){this.dialogService.open(p3,{positionStrategy:new sh})}launchHelp(){return v3(this,void 0,void 0,function*(){(yield this.dialogService.openSimpleDialog({title:{key:"continueToHelpCenter"},content:{key:"continueToHelpCenterDesc"},type:"info",acceptButtonText:{key:"continue"}}))&&(yield ul.createNewTab("https://bitwarden.com/help/"))})}openWebVault(){return v3(this,void 0,void 0,function*(){if(yield this.dialogService.openSimpleDialog({title:{key:"continueToWebApp"},content:{key:"continueToWebAppDesc"},type:"info",acceptButtonText:{key:"continue"}})){const e=(yield(0,bo._)(this.environmentService.environment$)).getWebVaultUrl();yield ul.createNewTab(e)}})}rate(){return v3(this,void 0,void 0,function*(){if(yield this.dialogService.openSimpleDialog({title:{key:"continueToBrowserExtensionStore"},content:{key:"continueToBrowserExtensionStoreDesc"},type:"info",acceptButtonText:{key:"continue"}})){const e=this.platformUtilsService.getDevice();yield ul.createNewTab(f3[e])}})}}m3.ɵfac=function(e){return new(e||m3)(Fl.rXU(lh),Fl.rXU(mk),Fl.rXU(Hb))},m3.ɵcmp=Fl.VBU({type:m3,selectors:[["ng-component"]],decls:25,vars:16,consts:[["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],["type","button","bit-item-content","",3,"click"],["slot","end","aria-hidden","true",1,"bwi","bwi-external-link"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page")(1,"popup-header",0),Fl.nI1(2,"i18n"),Fl.qex(3,1),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.j41(5,"bit-item-group")(6,"bit-item")(7,"button",2),Fl.bIt("click",function(){return t.about()}),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s()(),Fl.j41(10,"bit-item")(11,"button",2),Fl.bIt("click",function(){return t.launchHelp()}),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.nrm(14,"i",3),Fl.k0s()(),Fl.j41(15,"bit-item")(16,"button",2),Fl.bIt("click",function(){return t.openWebVault()}),Fl.EFF(17),Fl.nI1(18,"i18n"),Fl.nrm(19,"i",3),Fl.k0s()(),Fl.j41(20,"bit-item")(21,"button",2),Fl.bIt("click",function(){return t.rate()}),Fl.EFF(22),Fl.nI1(23,"i18n"),Fl.nrm(24,"i",3),Fl.k0s()()()()),2&e&&(Fl.R7$(),Fl.Y8G("pageTitle",Fl.mNQ(Fl.bMT(2,6,"about"))),Fl.R7$(7),Fl.SpI(" ",Fl.bMT(9,8,"aboutBitwarden")," "),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(13,10,"helpCenter")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(18,12,"bitWebVaultApp")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(23,14,"rateExtension")," "))},dependencies:[kl.MD,sf,Cw.iI,tE,aE,GD,VP,GP,KP,XP,rf],encapsulation:2});const g3=Object.freeze({AccountEncrypted:0,FileEncrypted:1});var y3=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function b3(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"bit-callout",1),Fl.nI1(2,"i18n"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("title",Fl.mNQ(Fl.bMT(2,3,e.scopeConfig.title))),Fl.R7$(2),Fl.SpI(" ",Fl.i5U(4,5,e.scopeConfig.description,e.scopeConfig.scopeIdentifier)," ")}}class w3{constructor(e,t){this.organizationService=e,this.accountService=t,this.show=!1,this.organizationId=(0,o.hFB)(),this.exportFormat=(0,o.hFB)(),this.orgExportDescription=(0,o.hFB)(),(0,Rl.QZ)(()=>y3(this,void 0,void 0,function*(){this.show=!1,yield this.getScopeMessage(this.organizationId(),this.exportFormat(),this.orgExportDescription()),this.show=!0}))}getScopeMessage(e,t,i){return y3(this,void 0,void 0,function*(){var n,r;const s=yield(0,bo._)(iv(this.accountService.activeAccount$));if(e){const t=yield(0,bo._)(this.organizationService.organizations$(s).pipe(rR(e)));return void(this.scopeConfig={title:"exportingOrganizationVaultTitle",description:i,scopeIdentifier:null!==(n=null==t?void 0:t.name)&&void 0!==n?n:""})}this.scopeConfig={title:"exportingPersonalVaultTitle",description:"zip"===t?"exportingIndividualVaultWithAttachmentsDescription":"exportingIndividualVaultDescription",scopeIdentifier:null!==(r=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.email))))&&void 0!==r?r:""}})}}w3.ɵfac=function(e){return new(e||w3)(Fl.rXU(WF),Fl.rXU(Zk))},w3.ɵcmp=Fl.VBU({type:w3,selectors:[["tools-export-scope-callout"]],inputs:{organizationId:[1,"organizationId"],exportFormat:[1,"exportFormat"],orgExportDescription:[1,"orgExportDescription"]},decls:1,vars:1,consts:[[4,"ngIf"],["type","info",3,"title"]],template:function(e,t){1&e&&Fl.DNE(0,b3,5,8,"ng-container",0),2&e&&Fl.Y8G("ngIf",t.show)},dependencies:[kl.MD,kl.bT,sf,dd,ud,rf],encapsulation:2});var S3=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const k3=(e,t)=>t.format;function I3(e,t){1&e&&(Fl.j41(0,"bit-callout",6),Fl.nI1(1,"i18n"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()),2&e&&(Fl.Y8G("title",Fl.mNQ(Fl.bMT(1,3,"vaultExportDisabled"))),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,5,"personalVaultExportPolicyInEffect"),"\n"))}function C3(e,t){1&e&&(Fl.nrm(0,"bit-option",10),Fl.nI1(1,"i18n")),2&e&&Fl.Y8G("label",Fl.bMT(1,1,"myVault"))}function T3(e,t){if(1&e&&Fl.nrm(0,"bit-option",11),2&e){const e=t.$implicit;Fl.Y8G("value",e.id)("label",e.name)}}function P3(e,t){if(1&e&&(Fl.j41(0,"bit-form-field")(1,"bit-label"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"bit-select",7),Fl.DNE(5,C3,2,3,"bit-option",8),Fl.nI1(6,"async"),Fl.DNE(7,T3,1,2,"bit-option",9),Fl.k0s()()),2&e){const e=Fl.XpG().ngIf,t=Fl.XpG();Fl.R7$(2),Fl.JRh(Fl.bMT(3,3,"exportFrom")),Fl.R7$(3),Fl.Y8G("ngIf",!Fl.bMT(6,5,t.organizationDataOwnershipPolicyAppliesToUser$)),Fl.R7$(2),Fl.Y8G("ngForOf",e)}}function F3(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,P3,8,7,"bit-form-field",3),Fl.bVm()),2&e){const e=t.ngIf;Fl.R7$(),Fl.Y8G("ngIf",e.length>0)}}function R3(e,t){if(1&e&&(Fl.j41(0,"option",5),Fl.EFF(1),Fl.k0s()),2&e){const e=t.$implicit;Fl.Y8G("value",e.format),Fl.R7$(),Fl.JRh(e.name)}}function x3(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"div",15)(2,"bit-form-field")(3,"bit-label"),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s(),Fl.nrm(6,"input",16),Fl.j41(7,"button",17),Fl.mxI("toggledChange",function(t){a.eBV(e);const i=Fl.XpG(2);return Fl.DH7(i.showFilePassword,t)||(i.showFilePassword=t),a.Njj(t)}),Fl.k0s(),Fl.j41(8,"button",18),Fl.nI1(9,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.generatePassword())}),Fl.k0s(),Fl.nrm(10,"button",19),Fl.nI1(11,"i18n"),Fl.nI1(12,"i18n"),Fl.j41(13,"bit-hint"),Fl.EFF(14),Fl.nI1(15,"i18n"),Fl.k0s()(),Fl.nrm(16,"tools-password-strength",20),Fl.k0s(),Fl.j41(17,"bit-form-field")(18,"bit-label"),Fl.EFF(19),Fl.nI1(20,"i18n"),Fl.k0s(),Fl.nrm(21,"input",21),Fl.j41(22,"button",17),Fl.mxI("toggledChange",function(t){a.eBV(e);const i=Fl.XpG(2);return Fl.DH7(i.showFilePassword,t)||(i.showFilePassword=t),a.Njj(t)}),Fl.k0s()(),Fl.bVm()}if(2&e){const e=Fl.XpG(2);Fl.R7$(4),Fl.JRh(Fl.bMT(5,12,"filePassword")),Fl.R7$(3),Fl.R50("toggled",e.showFilePassword),Fl.R7$(),Fl.Y8G("label",Fl.bMT(9,14,"generatePassword")),Fl.R7$(2),Fl.Y8G("disabled",!e.filePassword)("appCopyClick",e.filePassword)("valueLabel",Fl.bMT(11,16,"password"))("label",Fl.bMT(12,18,"password")),Fl.R7$(4),Fl.JRh(Fl.bMT(15,20,"exportPasswordDescription")),Fl.R7$(2),Fl.Y8G("password",e.filePassword)("showText",!0),Fl.R7$(3),Fl.JRh(Fl.bMT(20,22,"confirmFilePassword")),Fl.R7$(3),Fl.R50("toggled",e.showFilePassword)}}function A3(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"bit-radio-group",12)(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"bit-radio-button",13)(6,"bit-label"),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.j41(9,"bit-hint"),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s()(),Fl.j41(12,"bit-radio-button",14)(13,"bit-label"),Fl.EFF(14),Fl.nI1(15,"i18n"),Fl.k0s(),Fl.j41(16,"bit-hint"),Fl.EFF(17),Fl.nI1(18,"i18n"),Fl.k0s()()(),Fl.DNE(19,x3,23,24,"ng-container",3),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(3),Fl.JRh(Fl.bMT(4,8,"exportTypeHeading")),Fl.R7$(2),Fl.Y8G("value",e.encryptedExportType.AccountEncrypted),Fl.R7$(2),Fl.JRh(Fl.bMT(8,10,"accountRestricted")),Fl.R7$(3),Fl.JRh(Fl.bMT(11,12,"accountRestrictedOptionDescription")),Fl.R7$(2),Fl.Y8G("value",e.encryptedExportType.FileEncrypted),Fl.R7$(2),Fl.JRh(Fl.bMT(15,14,"passwordProtected")),Fl.R7$(3),Fl.JRh(Fl.bMT(18,16,"passwordProtectedOptionDescription")),Fl.R7$(2),Fl.Y8G("ngIf",e.fileEncryptionType==e.encryptedExportType.FileEncrypted)}}class D3{set organizationId(e){bd.isNullOrEmpty(e)?this._organizationId$.next(void 0):S_(e)?(this._organizationId$.next(e),iv(this.accountService.activeAccount$).pipe((0,go.n)(t=>this.organizationService.organizations$(t).pipe(rR(e)))).pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{this._organizationId$.next(null==e?void 0:e.id)})):this._organizationId$.next(void 0)}get organizationId(){return this._organizationId$.value}get showExcludeMyItems(){return this._showExcludeMyItems}get orgExportDescription(){return this._showExcludeMyItems?this.isAdminConsoleContext?"exportingOrganizationVaultFromAdminConsoleWithDataOwnershipDesc":"exportingOrganizationVaultFromPasswordManagerWithDataOwnershipDesc":"exportingOrganizationVaultDesc"}get isAdminConsoleContext(){var e,t,i;if(!((null===(t=(e=this.platformUtilsService).getClientType)||void 0===t?void 0:t.call(e))===Da.Web)||!this.router)return!1;try{return(null!==(i=this.router.url)&&void 0!==i?i:"").includes("/organizations/")}catch(e){return!1}}get disabledByPolicy(){return this._disabledByPolicy}constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,v){this.i18nService=e,this.toastService=t,this.exportService=i,this.eventCollectionService=n,this.generatorService=r,this.policyService=s,this.logService=o,this.formBuilder=a,this.fileDownloadService=l,this.dialogService=c,this.organizationService=u,this.accountService=d,this.collectionService=h,this.platformUtilsService=p,this.router=v,this._organizationId$=new Dd.t(void 0),this._showExcludeMyItems=!1,this.formLoading=new Fl.bkB,this.formDisabled=new Fl.bkB,this.onSuccessfulExport=new Fl.bkB,this.encryptedExportType=g3,this._disabledByPolicy=!1,this.exportForm=this.formBuilder.group({vaultSelector:["myVault",{nonNullable:!0,validators:[Il.k0.required]}],format:["json",Il.k0.required],secret:[""],filePassword:["",Il.k0.required],confirmFilePassword:["",Il.k0.required],fileEncryptionType:[g3.AccountEncrypted]}),this.destroy$=new Co.B,this.onlyManagedCollections=!0,this.onGenerate$=new Co.B,this.generatePassword=()=>S3(this,void 0,void 0,function*(){this.onGenerate$.next({source:"export",type:Mm.password})}),this.submit=()=>S3(this,void 0,void 0,function*(){if(this.isFileEncryptedExport&&this.filePassword!=this.confirmFilePassword)return void this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("filePasswordAndConfirmFilePasswordDoNotMatch")});if(this.exportForm.markAllAsTouched(),this.exportForm.invalid)return;if(this.disabledByPolicy)return void this.toastService.showToast({variant:"error",title:null,message:this.i18nService.t("personalVaultExportPolicyInEffect")});(yield this.verifyUser())&&(yield this.doExport())})}ngOnInit(){return S3(this,void 0,void 0,function*(){this.observeFormState(),this.observePolicyStatus(),this.observeFormSelections(),this.observeMyItemsExclusionCriteria(),this.observeValidatorAdjustments(),this.setupPasswordGeneration(),this.organizationId?this.initOrganizationOnly():(this.initIndividual(),this.setupPolicyBasedFormState())})}observeFormState(){this.exportForm.statusChanges.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{this.formDisabled.emit("DISABLED"===e)})}observePolicyStatus(){this.disablePersonalVaultExportPolicy$=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.policyService.policyAppliesToUser$(op.DisablePersonalVaultExport,e))),this.organizationDataOwnershipPolicyAppliesToUser$=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.policyService.policyAppliesToUser$(op.OrganizationDataOwnership,e))),this.organizationDataOwnershipPolicyEnabledForOrg$=(0,jo.z)([this.accountService.activeAccount$.pipe(iv),this._organizationId$]).pipe((0,go.n)(([e,t])=>t&&e?this.policyService.policies$(e).pipe((0,l.T)(e=>{var i;const n=null==e?void 0:e.find(e=>e.type===op.OrganizationDataOwnership&&e.organizationId===t);return null!==(i=null==n?void 0:n.enabled)&&void 0!==i&&i})):(0,Go.of)(!1)))}observeFormSelections(){this.exportForm.controls.vaultSelector.valueChanges.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{if(!this.isAdminConsoleContext){const t="myVault"===e;this.organizationId=t?void 0:e}}),this.formatOptions$=this._organizationId$.pipe((0,l.T)(e=>({isMyVault:!e})),(0,go.n)(e=>this.exportService.formats$(e)),(0,Oo.M)(e=>{const t=this.exportForm.get("format").value;e.some(e=>e.format===t)||this.exportForm.get("format").setValue("json")}),(0,Gp.t)({bufferSize:1,refCount:!0}))}observeMyItemsExclusionCriteria(){(0,jo.z)({organizationDataOwnershipPolicyEnabledForOrg:this.organizationDataOwnershipPolicyEnabledForOrg$,organizationId:this._organizationId$}).pipe((0,vm.Q)(this.destroy$)).subscribe(({organizationDataOwnershipPolicyEnabledForOrg:e,organizationId:t})=>{this._showExcludeMyItems=!!t&&e})}observeValidatorAdjustments(){(0,Po.h)(this.exportForm.get("format").valueChanges,this.exportForm.get("fileEncryptionType").valueChanges).pipe((0,kd.Z)(0),(0,vm.Q)(this.destroy$)).subscribe(()=>this.adjustValidators())}setupPasswordGeneration(){const e=this.accountService.activeAccount$.pipe(Em({name(){return"active export account"},distinct(e,t){return e.id===t.id}}));this.generatorService.generate$({on$:this.onGenerate$,account$:e}).pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{this.exportForm.patchValue({filePassword:e.credential,confirmFilePassword:e.credential})})}initOrganizationOnly(){this.organizations$=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.organizationService.memberOrganizations$(e).pipe((0,l.T)(e=>e.filter(e=>e.id==this.organizationId))))),this.exportForm.controls.vaultSelector.patchValue(this.organizationId),this.exportForm.controls.vaultSelector.disable(),this.onlyManagedCollections=!1}initIndividual(){this.organizations$=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>(0,jo.z)({collections:this.collectionService.decryptedCollections$(e),memberOrganizations:this.organizationService.memberOrganizations$(e)}))).pipe((0,l.T)(({collections:e,memberOrganizations:t})=>{const i=new Set(e.filter(e=>e.manage).map(e=>e.organizationId));return t.filter(e=>i.has(e.id)).sort(bd.getSortFunction(this.i18nService,"name"))}))}setupPolicyBasedFormState(){(0,jo.z)([this.disablePersonalVaultExportPolicy$,this.organizationDataOwnershipPolicyAppliesToUser$,this.organizations$]).pipe((0,Oo.M)(([e,t,i])=>{this._disabledByPolicy=e,t&&i.length>0&&(this.exportForm.enable(),this.exportForm.controls.vaultSelector.setValue(i[0].id)),t&&0===i.length&&this.exportForm.disable(),e&&this.exportForm.disable(),e||t||this.exportForm.controls.vaultSelector.setValue("myVault")}),(0,vm.Q)(this.destroy$)).subscribe()}ngAfterViewInit(){this.bitSubmit.loading$.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{this.formLoading.emit(e)})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}get encryptedFormat(){return"encrypted_json"===this.format}get isFileEncryptedExport(){return"encrypted_json"===this.format&&this.fileEncryptionType===g3.FileEncrypted}get isAccountEncryptedExport(){return"encrypted_json"===this.format&&this.fileEncryptionType===g3.AccountEncrypted}doExport(){return S3(this,void 0,void 0,function*(){try{const e=yield this.getExportData();this.downloadFile(e),this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("exportSuccess")}),this.onSuccessfulExport.emit(this.organizationId),yield this.collectEvent(),this.exportForm.get("secret").setValue(""),this.exportForm.clearValidators()}catch(e){this.logService.error(e)}})}verifyUser(){return S3(this,void 0,void 0,function*(){let e="exportWarningDesc";this.isFileEncryptedExport?e="fileEncryptedExportWarningDesc":this.isAccountEncryptedExport&&(e="encExportKeyWarningDesc");const t=yield gT.open(this.dialogService,{title:"confirmVaultExport",bodyText:e,confirmButtonOptions:{text:"continue",type:"primary"}});return"cancel"!==t.userAction&&(!!t.verificationSuccess||(t.noAvailableClientVerificationMethods,!1))})}getExportData(){return S3(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));return bd.isNullOrWhitespace(this.organizationId)?this.exportService.getExport(e,this.format,this.filePassword):this.exportService.getOrganizationExport(e,this.organizationId,this.format,this.filePassword,this.onlyManagedCollections)})}collectEvent(){return S3(this,void 0,void 0,function*(){return this.organizationId?yield this.eventCollectionService.collect(Ua.Organization_ClientExportedVault,null,!1,this.organizationId):yield this.eventCollectionService.collect(Ua.User_ClientExportedVault)})}get format(){return this.exportForm.get("format").value}get filePassword(){return this.exportForm.get("filePassword").value}get confirmFilePassword(){return this.exportForm.get("confirmFilePassword").value}get fileEncryptionType(){return this.exportForm.get("fileEncryptionType").value}adjustValidators(){this.exportForm.get("confirmFilePassword").reset(),this.exportForm.get("filePassword").reset(),this.encryptedFormat&&this.fileEncryptionType==g3.FileEncrypted?(this.exportForm.controls.filePassword.enable(),this.exportForm.controls.confirmFilePassword.enable()):(this.exportForm.controls.filePassword.disable(),this.exportForm.controls.confirmFilePassword.disable())}downloadFile(e){this.fileDownloadService.download({fileName:e.fileName,blobData:e.data,blobOptions:{type:e.type}})}}D3.ɵfac=function(e){return new(e||D3)(Fl.rXU(Ul),Fl.rXU(qb),Fl.rXU(D_),Fl.rXU(I$),Fl.rXU(yf),Fl.rXU(Jb),Fl.rXU(Za),Fl.rXU(Il.ze),Fl.rXU(xO),Fl.rXU(lh),Fl.rXU(WF),Fl.rXU(Zk),Fl.rXU(uR),Fl.rXU(Hb),Fl.rXU(Fd.Ix,8))},D3.ɵcmp=Fl.VBU({type:D3,selectors:[["tools-export"]],viewQuery:function(e,t){if(1&e&&(Fl.GBs(Md,5),Fl.GBs(mf,5)),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.bitSubmit=e.first),Fl.mGM(e=Fl.lsd())&&(t.passwordStrengthComponent=e.first)}},inputs:{organizationId:"organizationId"},outputs:{formLoading:"formLoading",formDisabled:"formDisabled",onSuccessfulExport:"onSuccessfulExport"},decls:15,vars:17,consts:[["type","danger",3,"title",4,"ngIf"],[3,"organizationId","exportFormat","orgExportDescription"],["id","export_form_exportForm",3,"formGroup","bitSubmit"],[4,"ngIf"],["bitInput","","formControlName","format"],[3,"value"],["type","danger",3,"title"],["formControlName","vaultSelector"],["value","myVault","icon","bwi-user",3,"label",4,"ngIf"],["icon","bwi-business",3,"value","label",4,"ngFor","ngForOf"],["value","myVault","icon","bwi-user",3,"label"],["icon","bwi-business",3,"value","label"],["formControlName","fileEncryptionType","aria-label","exportTypeHeading"],["id","AccountEncrypted","name","fileEncryptionType","checked","fileEncryptionType === encryptedExportType.AccountEncrypted",1,"tw-block",3,"value"],["id","FileEncrypted","name","fileEncryptionType","checked","fileEncryptionType === encryptedExportType.FileEncrypted",1,"tw-block",3,"value"],[1,"tw-mb-3"],["bitInput","","type","password","id","filePassword","formControlName","filePassword","name","password"],["type","button","bitSuffix","","bitIconButton","","bitPasswordInputToggle","",3,"toggledChange","toggled"],["type","button","bitIconButton","bwi-generate","appStopClick","","bitSuffix","",3,"click","label"],["type","button","bitIconButton","bwi-clone","appStopClick","","bitSuffix","","showToast","",3,"disabled","appCopyClick","valueLabel","label"],[3,"password","showText"],["bitInput","","type","password","id","confirmFilePassword","formControlName","confirmFilePassword","name","confirmFilePassword"]],template:function(e,t){1&e&&(Fl.DNE(0,I3,4,7,"bit-callout",0),Fl.nI1(1,"async"),Fl.nrm(2,"tools-export-scope-callout",1),Fl.j41(3,"form",2),Fl.DNE(4,F3,2,1,"ng-container",3),Fl.nI1(5,"async"),Fl.j41(6,"bit-form-field")(7,"bit-label"),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.j41(10,"select",4),Fl.Z7z(11,R3,2,2,"option",5,k3),Fl.nI1(13,"async"),Fl.k0s()(),Fl.DNE(14,A3,20,18,"ng-container",3),Fl.k0s()),2&e&&(Fl.Y8G("ngIf",Fl.bMT(1,9,t.disablePersonalVaultExportPolicy$)),Fl.R7$(2),Fl.Y8G("organizationId",t.organizationId)("exportFormat",t.format)("orgExportDescription",t.orgExportDescription),Fl.R7$(),Fl.Y8G("formGroup",t.exportForm)("bitSubmit",t.submit),Fl.R7$(),Fl.Y8G("ngIf",Fl.bMT(5,11,t.organizations$)),Fl.R7$(4),Fl.JRh(Fl.bMT(9,13,"fileFormat")),Fl.R7$(3),Fl.Dyx(Fl.bMT(13,15,t.formatOptions$)),Fl.R7$(3),Fl.Y8G("ngIf","encrypted_json"===t.format))},dependencies:[kl.MD,kl.Sq,kl.bT,Il.X1,Il.qT,Il.xH,Il.y7,Il.me,Il.wz,Il.BC,Il.cb,Il.j4,Il.JD,sf,IP,rO,Gu,Ac,hu,fu,ju,iw,nw,pc,Md,id,Ql,Zl,Wu,qu,zu,dd,ud,Xc,Kc,Lc,w3,mf,yL,kl.Jj,rf],encapsulation:2});var E3=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class $3{constructor(e){this.router=e,this.disabled=!1,this.loading=!1}onSuccessfulExport(e){return E3(this,void 0,void 0,function*(){yield this.router.navigate(["/tabs/settings"])})}}$3.ɵfac=function(e){return new(e||$3)(Fl.rXU(Fd.Ix))},$3.ɵcmp=Fl.VBU({type:$3,selectors:[["ng-component"]],decls:13,vars:11,consts:[["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[3,"formDisabled","formLoading","onSuccessfulExport"],["slot","footer"],["form","export_form_exportForm","bitButton","","type","submit","bitFormButton","","buttonType","primary",3,"disabled","loading"],["bitButton","","type","button","buttonType","secondary",3,"popupBackAction"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page")(1,"popup-header",0),Fl.nI1(2,"i18n"),Fl.qex(3,1),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.j41(5,"tools-export",2),Fl.bIt("formDisabled",function(e){return t.disabled=e})("formLoading",function(e){return t.loading=e})("onSuccessfulExport",function(e){return t.onSuccessfulExport(e)}),Fl.k0s(),Fl.j41(6,"popup-footer",3)(7,"button",4),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.j41(10,"button",5),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s()()()),2&e&&(Fl.R7$(),Fl.Y8G("pageTitle",Fl.bMT(2,5,"exportNoun")),Fl.R7$(6),Fl.Y8G("disabled",t.disabled)("loading",t.loading),Fl.R7$(),Fl.SpI(" ",Fl.bMT(9,7,"exportVerb")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(12,9,"cancel")," "))},dependencies:[kl.MD,sf,Fh,pc,jd,id,td,D3,tE,TQ,aE,GD,c2,rf],encapsulation:2});var O3=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class U3{constructor(e){this.router=e,this.disabled=!1,this.loading=!1}onSuccessfulImport(e){return O3(this,void 0,void 0,function*(){yield this.router.navigate(["/vault-settings"])})}}U3.ɵfac=function(e){return new(e||U3)(Fl.rXU(Fd.Ix))},U3.ɵcmp=Fl.VBU({type:U3,selectors:[["ng-component"]],features:[Fl.Jv_([...jX,{provide:DX,useClass:class{constructor(e){this.system=e,this.importers=MX,this.logger=e.log({type:"ImportMetadataService"})}init(){return NX(this,void 0,void 0,function*(){})}metadata$(e){const t=this.system.environment.getClientType(),i=e.pipe((0,l.T)(e=>{var i;if(!this.importers)return{type:e,loaders:[]};const n=function(e,t,i){var n,r;if(!e)return;if(!(t in e))return;return(null!==(r=null===(n=e[t])||void 0===n?void 0:n.loaders)&&void 0!==r?r:[]).filter(e=>OX[e].includes(i))}(this.importers,e,t);if(!n||0===n.length)return{type:e,loaders:[]};const r={type:e,loaders:n};return e in this.importers&&(r.instructions=null===(i=this.importers[e])||void 0===i?void 0:i.instructions),this.logger.debug({importType:e,capabilities:r},"capabilities updated"),r}));return i}},deps:[BX]}])],decls:10,vars:8,consts:[["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[3,"formDisabled","formLoading","onSuccessfulImport"],["slot","footer"],["form","import_form_importForm","bitButton","","type","submit","bitFormButton","","buttonType","primary",3,"disabled","loading"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page")(1,"popup-header",0),Fl.nI1(2,"i18n"),Fl.qex(3,1),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.j41(5,"tools-import",2),Fl.bIt("formDisabled",function(e){return t.disabled=e})("formLoading",function(e){return t.loading=e})("onSuccessfulImport",function(e){return t.onSuccessfulImport(e)}),Fl.k0s(),Fl.j41(6,"popup-footer",3)(7,"button",4),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s()()()),2&e&&(Fl.R7$(),Fl.Y8G("pageTitle",Fl.bMT(2,4,"importNoun")),Fl.R7$(6),Fl.Y8G("disabled",t.disabled)("loading",t.loading),Fl.R7$(),Fl.SpI(" ",Fl.bMT(9,6,"importVerb")," "))},dependencies:[kl.MD,sf,Fh,pc,jd,id,td,HW,tE,TQ,aE,GD,rf],encapsulation:2});var M3=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function N3(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-spotlight",0)(1,"span",24),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.j41(4,"button",25),Fl.nI1(5,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.openUpgradeDialog())}),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s()()()}2&e&&(Fl.R7$(2),Fl.SpI("",Fl.bMT(3,3,"unlockFeaturesWithPremium")," "),Fl.R7$(2),Fl.Y8G("title",Fl.bMT(5,5,"upgradeNow")),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(7,7,"upgradeNow")," "))}function V3(e,t){1&e&&(Fl.j41(0,"span",10),Fl.nI1(1,"i18n"),Fl.EFF(2,"1"),Fl.k0s()),2&e&&Fl.BMQ("aria-label",Fl.bMT(1,1,"nudgeBadgeAria"))}function B3(e,t){1&e&&(Fl.j41(0,"span",10),Fl.nI1(1,"i18n"),Fl.EFF(2,"1"),Fl.k0s()),2&e&&Fl.BMQ("aria-label",Fl.bMT(1,1,"nudgeBadgeAria"))}function j3(e,t){1&e&&(Fl.j41(0,"span",10),Fl.nI1(1,"i18n"),Fl.EFF(2,"1"),Fl.k0s()),2&e&&Fl.BMQ("aria-label",Fl.bMT(1,1,"nudgeBadgeAria"))}function G3(e,t){if(1&e&&(Fl.j41(0,"bit-item")(1,"a",26),Fl.nrm(2,"i",27),Fl.j41(3,"div",8)(4,"p",9),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.nVh(7,j3,3,3,"span",10),Fl.nI1(8,"async"),Fl.k0s(),Fl.nrm(9,"i",5),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("truncate",!1),Fl.R7$(4),Fl.JRh(Fl.bMT(6,3,"admin")),Fl.R7$(2),Fl.vxM(Fl.bMT(8,5,e.showAdminBadge$)?7:-1)}}function L3(e,t){1&e&&(Fl.j41(0,"span",10),Fl.nI1(1,"i18n"),Fl.EFF(2,"1 "),Fl.k0s()),2&e&&Fl.BMQ("aria-label",Fl.bMT(1,1,"nudgeBadgeAria"))}class z3{constructor(e,t,i,n,r){this.nudgesService=e,this.accountService=t,this.autoConfirmService=i,this.accountProfileStateService=n,this.dialogService=r,this.NudgeType=Sx,this.authenticatedAccount$=this.accountService.activeAccount$.pipe((0,Eo.p)(e=>null!==e),(0,Gp.t)({bufferSize:1,refCount:!0})),this.hasPremium$=this.authenticatedAccount$.pipe((0,go.n)(e=>this.accountProfileStateService.hasPremiumFromAnySource$(e.id))),this.showDownloadBitwardenNudge$=this.authenticatedAccount$.pipe((0,go.n)(e=>this.nudgesService.showNudgeBadge$(Sx.DownloadBitwarden,e.id))),this.showVaultBadge$=this.authenticatedAccount$.pipe((0,go.n)(e=>this.nudgesService.showNudgeBadge$(Sx.EmptyVaultNudge,e.id))),this.showAdminBadge$=this.authenticatedAccount$.pipe((0,go.n)(e=>this.nudgesService.showNudgeBadge$(Sx.AutoConfirmNudge,e.id))),this.showAutofillBadge$=this.authenticatedAccount$.pipe((0,go.n)(e=>this.nudgesService.showNudgeBadge$(Sx.AutofillNudge,e.id))),this.showAdminSettingsLink$=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.autoConfirmService.canManageAutoConfirm$(e)))}openUpgradeDialog(){z2.open(this.dialogService)}dismissBadge(e){return M3(this,void 0,void 0,function*(){if(yield(0,bo._)(this.showVaultBadge$)){const t=yield(0,bo._)(this.authenticatedAccount$);yield this.nudgesService.dismissNudge(e,t.id,!0)}})}}z3.ɵfac=function(e){return new(e||z3)(Fl.rXU(Ix),Fl.rXU(Zk),Fl.rXU(tR),Fl.rXU(T$),Fl.rXU(lh))},z3.ɵcmp=Fl.VBU({type:z3,selectors:[["ng-component"]],decls:71,vars:51,consts:[["persistent",""],["slot","header",3,"pageTitle"],["slot","end"],["bit-item-content","","routerLink","/account-security",3,"truncate"],["slot","start","aria-hidden","true",1,"bwi","bwi-lock"],["slot","end","aria-hidden","true",1,"bwi","bwi-angle-right"],["bit-item-content","","routerLink","/autofill",3,"truncate"],["slot","start","aria-hidden","true",1,"bwi","bwi-check-circle"],[1,"tw-flex","tw-items-center","tw-justify-center"],[1,"tw-pr-2"],["bitBadge","","variant","notification"],["bit-item-content","","routerLink","/notifications",3,"truncate"],["slot","start","aria-hidden","true",1,"bwi","bwi-file-text"],["bit-item-content","","routerLink","/vault-settings",3,"click","truncate"],["slot","start","aria-hidden","true",1,"bwi","bwi-vault"],["bit-item-content","","routerLink","/appearance",3,"truncate"],["slot","start","aria-hidden","true",1,"bwi","bwi-brush"],["bit-item-content","","routerLink","/about",3,"truncate"],["slot","start","aria-hidden","true",1,"bwi","bwi-info-circle"],["bit-item-content","","routerLink","/download-bitwarden",3,"truncate"],["slot","start","aria-hidden","true",1,"bwi","bwi-mobile"],[1,"tw-flex","tw-items-center"],["bit-item-content","","routerLink","/more-from-bitwarden",3,"truncate"],["slot","start","aria-hidden","true",1,"bwi","bwi-filter"],[1,"tw-text-xs"],["bitLink","","buttonType","primary","type","button",1,"tw-text-xs",3,"click","title"],["bit-item-content","","routerLink","/admin",3,"truncate"],["slot","start","aria-hidden","true",1,"bwi","bwi-business"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page"),Fl.nVh(1,N3,8,9,"bit-spotlight",0),Fl.nI1(2,"async"),Fl.j41(3,"popup-header",1),Fl.nI1(4,"i18n"),Fl.qex(5,2),Fl.nrm(6,"app-pop-out")(7,"app-current-account"),Fl.bVm(),Fl.k0s(),Fl.j41(8,"bit-item-group")(9,"bit-item")(10,"a",3),Fl.nrm(11,"i",4),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.nrm(14,"i",5),Fl.k0s()(),Fl.j41(15,"bit-item")(16,"a",6),Fl.nrm(17,"i",7),Fl.j41(18,"div",8)(19,"p",9),Fl.EFF(20),Fl.nI1(21,"i18n"),Fl.k0s(),Fl.nVh(22,V3,3,3,"span",10),Fl.nI1(23,"async"),Fl.k0s(),Fl.nrm(24,"i",5),Fl.k0s()(),Fl.j41(25,"bit-item")(26,"a",11),Fl.nrm(27,"i",12),Fl.EFF(28),Fl.nI1(29,"i18n"),Fl.nrm(30,"i",5),Fl.k0s()(),Fl.j41(31,"bit-item")(32,"a",13),Fl.bIt("click",function(){return t.dismissBadge(t.NudgeType.EmptyVaultNudge)}),Fl.nrm(33,"i",14),Fl.j41(34,"div",8)(35,"p",9),Fl.EFF(36),Fl.nI1(37,"i18n"),Fl.k0s(),Fl.nVh(38,B3,3,3,"span",10),Fl.nI1(39,"async"),Fl.k0s(),Fl.nrm(40,"i",5),Fl.k0s()(),Fl.j41(41,"bit-item")(42,"a",15),Fl.nrm(43,"i",16),Fl.EFF(44),Fl.nI1(45,"i18n"),Fl.nrm(46,"i",5),Fl.k0s()(),Fl.nVh(47,G3,10,7,"bit-item"),Fl.nI1(48,"async"),Fl.j41(49,"bit-item")(50,"a",17),Fl.nrm(51,"i",18),Fl.EFF(52),Fl.nI1(53,"i18n"),Fl.nrm(54,"i",5),Fl.k0s()(),Fl.j41(55,"bit-item")(56,"a",19),Fl.nrm(57,"i",20),Fl.j41(58,"div",21)(59,"p",9),Fl.EFF(60),Fl.nI1(61,"i18n"),Fl.k0s(),Fl.nVh(62,L3,3,3,"span",10),Fl.nI1(63,"async"),Fl.k0s(),Fl.nrm(64,"i",5),Fl.k0s()(),Fl.j41(65,"bit-item")(66,"a",22),Fl.nrm(67,"i",23),Fl.EFF(68),Fl.nI1(69,"i18n"),Fl.nrm(70,"i",5),Fl.k0s()()()()),2&e&&(Fl.R7$(),Fl.vxM(Fl.bMT(2,23,t.hasPremium$)?-1:1),Fl.R7$(2),Fl.Y8G("pageTitle",Fl.mNQ(Fl.bMT(4,25,"settings"))),Fl.R7$(7),Fl.Y8G("truncate",!1),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(13,27,"accountSecurity")," "),Fl.R7$(4),Fl.Y8G("truncate",!1),Fl.R7$(4),Fl.JRh(Fl.bMT(21,29,"autofill")),Fl.R7$(2),Fl.vxM(Fl.bMT(23,31,t.showAutofillBadge$)?22:-1),Fl.R7$(4),Fl.Y8G("truncate",!1),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(29,33,"notifications")," "),Fl.R7$(4),Fl.Y8G("truncate",!1),Fl.R7$(4),Fl.JRh(Fl.bMT(37,35,"settingsVaultOptions")),Fl.R7$(2),Fl.vxM(Fl.bMT(39,37,t.showVaultBadge$)?38:-1),Fl.R7$(4),Fl.Y8G("truncate",!1),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(45,39,"appearance")," "),Fl.R7$(3),Fl.vxM(Fl.bMT(48,41,t.showAdminSettingsLink$)?47:-1),Fl.R7$(3),Fl.Y8G("truncate",!1),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(53,43,"about")," "),Fl.R7$(4),Fl.Y8G("truncate",!1),Fl.R7$(4),Fl.JRh(Fl.bMT(61,45,"downloadBitwardenApps")),Fl.R7$(2),Fl.vxM(Fl.bMT(63,47,t.showDownloadBitwardenNudge$)?62:-1),Fl.R7$(4),Fl.Y8G("truncate",!1),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(69,49,"moreFromBitwarden")," "))},dependencies:[kl.MD,sf,Cw.iI,Cw.Wk,tE,aE,GD,VP,GP,KP,XP,_F,Qc,Ax,tc,Hh,uw,kl.Jj,rf],encapsulation:2,changeDetection:0});class _3{}class K3{constructor(e){this.id=e.id,this.priority=e.priority,this.title=e.title,this.body=e.body,this.date=e.date,this.taskId=e.taskId,this.readDate=e.readDate,this.deletedDate=e.deletedDate}}class X3{constructor(e){this.id=e.id,this.priority=e.priority,this.title=e.title,this.body=e.body,this.date=e.date,this.taskId=e.taskId,this.readDate=e.readDate,this.deletedDate=e.deletedDate}static fromJSON(e){return Object.assign(new X3({}),e,{id:e.id,priority:e.priority,title:e.title,body:e.body,date:new Date(e.date),taskId:e.taskId,readDate:e.readDate?new Date(e.readDate):null,deletedDate:e.deletedDate?new Date(e.deletedDate):null})}}class q3 extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.priority=this.getResponseProperty("Priority"),this.title=this.getResponseProperty("Title"),this.body=this.getResponseProperty("Body"),this.date=this.getResponseProperty("Date"),this.taskId=this.getResponseProperty("TaskId"),this.readDate=this.getResponseProperty("ReadDate"),this.deletedDate=this.getResponseProperty("DeletedDate")}}const W3=k.array(Oe,"notifications",{deserializer:e=>X3.fromJSON(e),clearOn:["logout","lock"]});var Y3=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const H3=(0,l.T)(e=>Object.entries(null!=e?e:{}).filter(([,e])=>e>=Pd.Locked).map(([e])=>e));var J3=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Z3="dismissed";class Q3{constructor(){this.dialogRef=(0,a.WQX)(nh),this.dismissBtnEnabled=(0,a.vPA)(!1)}dismiss(){return J3(this,void 0,void 0,function*(){this.dialogRef.close(Z3)})}onSlideChange(e){2===e&&this.dismissBtnEnabled.set(!0)}static open(e){return e.open(Q3,{disableClose:!0,positionStrategy:new sh})}}Q3.ɵfac=function(e){return new(e||Q3)},Q3.ɵcmp=Fl.VBU({type:Q3,selectors:[["vault-at-risk-carousel-dialog"]],decls:37,vars:40,consts:[["hideIcon",""],["bitDialogContent",""],["label","Placeholder",3,"slideChange"],[3,"label"],["src","../../../../images/at-risk-password-carousel/review_at-risk_logins.light.png","appDarkImgSrc","../../../../images/at-risk-password-carousel/review_at-risk_logins.dark.png",1,"tw-max-w-full","tw-max-h-40",3,"alt"],["bitTypography","h2",1,"tw-mt-8"],["bitTypography","body1"],["src","../../../../images/at-risk-password-carousel/generate_password.light.png","appDarkImgSrc","../../../../images/at-risk-password-carousel/generate_password.dark.png",1,"tw-max-w-full","tw-max-h-40",3,"alt"],["src","../../../../images/at-risk-password-carousel/update_login.light.png","appDarkImgSrc","../../../../images/at-risk-password-carousel/update_login.dark.png",1,"tw-max-w-full","tw-max-h-40",3,"alt"],["bitDialogFooter",""],["type","button","bitButton","","buttonType","primary","block","","data-testid","confirm-carousel-button",3,"click","disabled"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-simple-dialog",0)(1,"div",1)(2,"vault-carousel",2),Fl.bIt("slideChange",function(e){return t.onSlideChange(e)}),Fl.j41(3,"vault-carousel-slide",3),Fl.nI1(4,"i18n"),Fl.nrm(5,"img",4),Fl.nI1(6,"i18n"),Fl.j41(7,"h2",5),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.j41(10,"p",6),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s()(),Fl.j41(13,"vault-carousel-slide",3),Fl.nI1(14,"i18n"),Fl.nrm(15,"img",7),Fl.nI1(16,"i18n"),Fl.j41(17,"h2",5),Fl.EFF(18),Fl.nI1(19,"i18n"),Fl.k0s(),Fl.j41(20,"p",6),Fl.EFF(21),Fl.nI1(22,"i18n"),Fl.k0s()(),Fl.j41(23,"vault-carousel-slide",3),Fl.nI1(24,"i18n"),Fl.nrm(25,"img",8),Fl.nI1(26,"i18n"),Fl.j41(27,"h2",5),Fl.EFF(28),Fl.nI1(29,"i18n"),Fl.k0s(),Fl.j41(30,"p",6),Fl.EFF(31),Fl.nI1(32,"i18n"),Fl.k0s()()()(),Fl.qex(33,9),Fl.j41(34,"button",10),Fl.bIt("click",function(){return t.dismiss()}),Fl.EFF(35),Fl.nI1(36,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e&&(Fl.R7$(3),Fl.Y8G("label",Fl.bMT(4,14,"reviewAtRiskLogins")),Fl.R7$(2),Fl.Y8G("alt",Fl.bMT(6,16,"reviewAtRiskLoginSlideImgAltPeriod")),Fl.R7$(3),Fl.JRh(Fl.bMT(9,18,"reviewAtRiskLogins")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(12,20,"reviewAtRiskLoginsSlideDesc")," "),Fl.R7$(2),Fl.Y8G("label",Fl.bMT(14,22,"generatePassword")),Fl.R7$(2),Fl.Y8G("alt",Fl.bMT(16,24,"generatePasswordSlideImgAltPeriod")),Fl.R7$(3),Fl.JRh(Fl.bMT(19,26,"generatePassword")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(22,28,"generatePasswordSlideDesc")," "),Fl.R7$(2),Fl.Y8G("label",Fl.bMT(24,30,"updateInBitwarden")),Fl.R7$(2),Fl.Y8G("alt",Fl.bMT(26,32,"updateInBitwardenSlideImgAltPeriod")),Fl.R7$(3),Fl.JRh(Fl.bMT(29,34,"updateInBitwarden")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(32,36,"updateInBitwardenSlideDesc")," "),Fl.R7$(3),Fl.Y8G("disabled",!t.dismissBtnEnabled()),Fl.R7$(),Fl.SpI(" ",Fl.bMT(36,38,"reviewAtRiskPasswords")," "))},dependencies:[Fh,Yd,uz,cz,WL,tc,rc,id,td,q$,sc],encapsulation:2});var e4=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const t4=new k($e,"autofillCalloutDismissed",{deserializer:e=>e,clearOn:[]}),i4=new k($e,"gettingStartedCarouselDismissed",{deserializer:e=>e,clearOn:[]});class n4{constructor(){this.stateProvider=(0,a.WQX)(u)}isCalloutDismissed(e){return this.stateProvider.getUser(e,t4).state$.pipe((0,l.T)(e=>!!e))}dismissCallout(e){return e4(this,void 0,void 0,function*(){yield this.stateProvider.getUser(e,t4).update(()=>!0)})}isGettingStartedDismissed(e){return this.stateProvider.getUser(e,i4).state$.pipe((0,l.T)(e=>!!e))}dismissGettingStarted(e){return e4(this,void 0,void 0,function*(){yield this.stateProvider.getUser(e,i4).update(()=>!0)})}}n4.ɵfac=function(e){return new(e||n4)},n4.ɵprov=a.jDH({token:n4,factory:n4.ɵfac});var r4=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function s4(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-callout",5),Fl.nI1(1,"i18n"),Fl.j41(2,"p",6),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"button",7),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.activateInlineAutofillMenuVisibility())}),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s(),Fl.j41(8,"button",8),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.dismissCallout())}),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s()()}2&e&&(Fl.Y8G("appA11yTitle",Fl.bMT(1,4,"changeAtRiskPasswordsFaster")),Fl.R7$(3),Fl.JRh(Fl.bMT(4,6,"changeAtRiskPasswordsFasterDesc")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(7,8,"turnOnAutofill")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(10,10,"dismiss")," "))}function o4(e,t){1&e&&(Fl.nrm(0,"i",19),Fl.nI1(1,"i18n")),2&e&&Fl.Y8G("appA11yTitle",Fl.bMT(1,1,"attachments"))}function a4(e,t){1&e&&(Fl.qex(0),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.bVm()),2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"change")," "))}function l4(e,t){1&e&&Fl.nrm(0,"i",22)}function c4(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",20),Fl.nI1(1,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG().$implicit,i=Fl.XpG(2);return a.Njj(i.launchChangePassword(t))}),Fl.DNE(2,a4,3,3,"ng-container",4)(3,l4,1,0,"i",21),Fl.k0s()}if(2&e){const e=Fl.XpG().$implicit,t=Fl.XpG(2);Fl.Y8G("appA11yTitle",Fl.i5U(1,4,"changeButtonTitle",e.name))("disabled",t.launchingCipher()==e),Fl.R7$(2),Fl.Y8G("ngIf",t.launchingCipher()!=e),Fl.R7$(),Fl.Y8G("ngIf",t.launchingCipher()==e)}}function u4(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",23),Fl.nI1(1,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG().$implicit,i=Fl.XpG(2);return a.Njj(i.viewCipher(t))}),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()}if(2&e){const e=Fl.XpG().$implicit;Fl.Y8G("appA11yTitle",Fl.i5U(1,2,"viewItemTitle",e.name)),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,5,"viewLogin")," ")}}function d4(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-item")(1,"button",10),Fl.nI1(2,"i18n"),Fl.bIt("click",function(){const t=a.eBV(e).$implicit,i=Fl.XpG(2);return a.Njj(i.viewCipher(t))}),Fl.j41(3,"div",11),Fl.nrm(4,"app-vault-icon",12),Fl.k0s(),Fl.j41(5,"span",13),Fl.EFF(6),Fl.k0s(),Fl.j41(7,"span",14),Fl.EFF(8),Fl.k0s(),Fl.j41(9,"div",15),Fl.DNE(10,o4,2,3,"i",16),Fl.k0s()(),Fl.j41(11,"bit-item-action",2),Fl.DNE(12,c4,4,7,"button",17)(13,u4,4,7,"button",18),Fl.k0s()()}if(2&e){const e=t.$implicit,i=Fl.XpG(2);Fl.R7$(),Fl.Y8G("appA11yTitle",Fl.i5U(2,7,"viewItemTitle",e.name)),Fl.R7$(3),Fl.Y8G("cipher",e),Fl.R7$(2),Fl.JRh(e.name),Fl.R7$(2),Fl.JRh(e.subTitle),Fl.R7$(2),Fl.Y8G("ngIf",e.hasAttachments),Fl.R7$(2),Fl.Y8G("ngIf",i.hasLoginUri(e)),Fl.R7$(),Fl.Y8G("ngIf",!i.hasLoginUri(e))}}function h4(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"p",6),Fl.EFF(2),Fl.nI1(3,"async"),Fl.k0s(),Fl.j41(4,"bit-item-group"),Fl.DNE(5,d4,14,10,"bit-item",9),Fl.k0s(),Fl.bVm()),2&e){const e=t.ngIf,i=Fl.XpG();Fl.R7$(2),Fl.JRh(Fl.bMT(3,2,i.pageDescription$)),Fl.R7$(3),Fl.Y8G("ngForOf",e)}}class p4{constructor(){this.taskService=(0,a.WQX)(d$),this.organizationService=(0,a.WQX)(WF),this.cipherService=(0,a.WQX)(_b),this.i18nService=(0,a.WQX)(Ul),this.accountService=(0,a.WQX)(Zk),this.passwordRepromptService=(0,a.WQX)(k$),this.router=(0,a.WQX)(Fd.Ix),this.autofillSettingsService=(0,a.WQX)(BE),this.toastService=(0,a.WQX)(qb),this.atRiskPasswordPageService=(0,a.WQX)(n4),this.changeLoginPasswordService=(0,a.WQX)(NM),this.platformUtilsService=(0,a.WQX)(Hb),this.dialogService=(0,a.WQX)(lh),this.endUserNotificationService=(0,a.WQX)(_3),this.destroyRef=(0,a.WQX)(a.abz),this.atRiskPasswordCalloutService=(0,a.WQX)(y$),this.launchingCipher=(0,a.vPA)(null),this.activeUserData$=this.accountService.activeAccount$.pipe(p$(),(0,go.n)(e=>(0,jo.z)([this.taskService.pendingTasks$(e.id),this.cipherService.cipherViews$(e.id).pipe(p$(),(0,l.T)(e=>Object.fromEntries(e.map(e=>[e.id,e])))),(0,Go.of)(e)])),(0,l.T)(([e,t,i])=>({tasks:e,ciphers:t,userId:i.id})),(0,Gp.t)({bufferSize:1,refCount:!0})),this.loading$=this.activeUserData$.pipe((0,l.T)(()=>!1),(0,kd.Z)(!0)),this.calloutDismissed$=this.activeUserData$.pipe((0,go.n)(({userId:e})=>this.atRiskPasswordPageService.isCalloutDismissed(e))),this.inlineAutofillSettingEnabled$=this.autofillSettingsService.inlineMenuVisibility$.pipe((0,l.T)(e=>e!==wa)),this.showAutofillCallout$=(0,jo.z)([this.calloutDismissed$,this.inlineAutofillSettingEnabled$]).pipe((0,l.T)(([e,t])=>!e&&!t),(0,kd.Z)(!1)),this.atRiskItems$=this.activeUserData$.pipe((0,l.T)(({tasks:e,ciphers:t})=>e.filter(e=>e.type===a$&&null!=e.cipherId&&null!=t[e.cipherId]&&t[e.cipherId].edit&&t[e.cipherId].viewPassword&&!t[e.cipherId].isDeleted).map(e=>t[e.cipherId]))),this.pageDescription$=(0,jo.z)([this.activeUserData$,this.atRiskItems$]).pipe((0,go.n)(([{userId:e},t])=>{const i=new Set(t.filter(e=>e.organizationId).map(e=>e.organizationId));if(1===i.size){const[n]=i;return this.organizationService.organizations$(e).pipe(qF(n),(0,l.T)(e=>this.i18nService.t(1===t.length?"atRiskPasswordDescSingleOrg":"atRiskPasswordsDescSingleOrgPlural",null==e?void 0:e.name,t.length)))}return(0,Go.of)(this.i18nService.t("atRiskPasswordsDescMultiOrgPlural",t.length))})),this.launchChangePassword=e=>r4(this,void 0,void 0,function*(){try{this.launchingCipher.set(e);const t=yield this.changeLoginPasswordService.getChangePasswordUrl(e);if(null==t)return;this.platformUtilsService.launchUri(t)}finally{this.launchingCipher.set(null)}}),this.navigateToVault=()=>r4(this,void 0,void 0,function*(){yield this.router.navigate(["/tabs/vault"])})}ngOnInit(){return r4(this,void 0,void 0,function*(){const{userId:e}=yield(0,bo._)(this.activeUserData$);if(!(yield(0,bo._)(this.atRiskPasswordPageService.isGettingStartedDismissed(e)))){const t=Q3.open(this.dialogService);(yield(0,bo._)(t.closed))===Z3&&(yield this.atRiskPasswordPageService.dismissGettingStarted(e))}this.markTaskNotificationsAsRead(),this.atRiskPasswordCalloutService.updateAtRiskPasswordState(e,{hasInteractedWithTasks:!0,tasksBannerDismissed:!1})})}markTaskNotificationsAsRead(){this.activeUserData$.pipe((0,go.n)(({tasks:e,userId:t})=>this.endUserNotificationService.unreadNotifications$(t).pipe((0,_o.s)(1),(0,l.T)(t=>t.filter(t=>e.some(e=>e.id===t.taskId))),(0,To.H)(e=>(0,Sm.x)(...e.map(e=>this.endUserNotificationService.markAsRead(e.id,t)))))),(0,xl.pQ)(this.destroyRef)).subscribe()}viewCipher(e){return r4(this,void 0,void 0,function*(){(yield this.passwordRepromptService.passwordRepromptCheck(e))&&(yield this.router.navigate(["/view-cipher"],{queryParams:{cipherId:e.id,type:e.type}}))})}activateInlineAutofillMenuVisibility(){return r4(this,void 0,void 0,function*(){yield this.autofillSettingsService.setInlineMenuVisibility(Sa),this.toastService.showToast({variant:"success",message:this.i18nService.t("turnedOnAutofill"),title:""})})}dismissCallout(){return r4(this,void 0,void 0,function*(){const{userId:e}=yield(0,bo._)(this.activeUserData$);yield this.atRiskPasswordPageService.dismissCallout(e)})}hasLoginUri(e){var t;return null===(t=e.login)||void 0===t?void 0:t.hasUris}}p4.ɵfac=function(e){return new(e||p4)},p4.ɵcmp=Fl.VBU({type:p4,selectors:[["vault-at-risk-passwords"]],features:[Fl.Jv_([n4,{provide:NM,useClass:rY},y$])],decls:10,vars:13,consts:[[3,"loading"],["slot","header","showBackButton","",3,"pageTitle","backAction"],["slot","end"],["type","info","data-testid","autofill-callout",3,"appA11yTitle",4,"ngIf"],[4,"ngIf"],["type","info","data-testid","autofill-callout",3,"appA11yTitle"],["bitTypography","body2"],["type","button","bitButton","","buttonType","primary","data-testid","turn-on-autofill-button",1,"tw-mr-2",3,"click"],["type","button","bitButton","","buttonType","secondary","data-testid","dismiss-callout-button",3,"click"],[4,"ngFor","ngForOf"],["bit-item-content","","type","button",3,"click","appA11yTitle"],["slot","start",1,"tw-justify-start","tw-w-7","tw-flex"],[3,"cipher"],["data-testid","item-name"],["slot","secondary"],["slot","default-trailing"],["class","bwi bwi-paperclip bwi-sm",3,"appA11yTitle",4,"ngIf"],["type","button","bitBadge","","variant","primary","appStopProp","",3,"appA11yTitle","disabled","click",4,"ngIf"],["type","button","bitBadge","","variant","primary",3,"appA11yTitle","click",4,"ngIf"],[1,"bwi","bwi-paperclip","bwi-sm",3,"appA11yTitle"],["type","button","bitBadge","","variant","primary","appStopProp","",3,"click","appA11yTitle","disabled"],["class","bwi bwi-spinner bwi-spin","aria-hidden","true",4,"ngIf"],["aria-hidden","true",1,"bwi","bwi-spinner","bwi-spin"],["type","button","bitBadge","","variant","primary",3,"click","appA11yTitle"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page",0),Fl.nI1(1,"async"),Fl.j41(2,"popup-header",1),Fl.nI1(3,"i18n"),Fl.qex(4,2),Fl.nrm(5,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.DNE(6,s4,11,12,"bit-callout",3),Fl.nI1(7,"async"),Fl.DNE(8,h4,6,4,"ng-container",4),Fl.nI1(9,"async"),Fl.k0s()),2&e&&(Fl.Y8G("loading",Fl.bMT(1,5,t.loading$)),Fl.R7$(2),Fl.Y8G("pageTitle",Fl.bMT(3,7,"atRiskPasswords"))("backAction",t.navigateToVault),Fl.R7$(4),Fl.Y8G("ngIf",Fl.bMT(7,9,t.showAutofillCallout$)),Fl.R7$(2),Fl.Y8G("ngIf",Fl.bMT(9,11,t.atRiskItems$)))},dependencies:[tE,aE,GD,VP,GP,KP,BP,XP,kl.MD,kl.Sq,kl.bT,sf,rw,RU,L1,tc,rc,dd,ud,id,td,eu,Qc,Fh,uz,kl.Jj,rf],encapsulation:2,changeDetection:0});class v4{enable(){this.disable(),this.unloadSubscription=(0,Rh.R)(window,"beforeunload").subscribe(e=>{e.preventDefault();return e.returnValue="",""})}disable(){var e;null===(e=this.unloadSubscription)||void 0===e||e.unsubscribe()}}v4.ɵfac=function(e){return new(e||v4)},v4.ɵprov=a.jDH({token:v4,factory:v4.ɵfac});const f4="selected",m4="canceled";class g4{get isPassword(){return"password"===this.params.type}constructor(e,t,i){this.params=e,this.dialogRef=t,this.i18nService=i,this.titleKey=this.isPassword?"passwordGenerator":"usernameGenerator",this.generatedValue="",this.close=()=>{this.dialogRef.close({action:m4})},this.selectValue=()=>{this.dialogRef.close({action:f4,generatedValue:this.generatedValue})},this.onAlgorithmSelected=e=>{this.selectButtonText=e?e.useGeneratedValue:this.i18nService.t("useThisEmail"),this.generatedValue=void 0},this.uri=e.uri}onValueGenerated(e){this.generatedValue=e}static open(e,t,i){const n=t.position().global();return e.open(g4,Object.assign(Object.assign({},i),{positionStrategy:n,height:"100vh",width:"100vw"}))}}g4.ɵfac=function(e){return new(e||g4)(Fl.rXU(pd.Qs),Fl.rXU(nh),Fl.rXU(Ul))},g4.ɵcmp=Fl.VBU({type:g4,selectors:[["app-vault-generator-dialog"]],decls:7,vars:8,consts:[["slot","header","showBackButton","",3,"backAction","pageTitle"],[3,"valueGenerated","algorithmSelected","type","uri"],["slot","footer"],["type","button","bitButton","","buttonType","primary","data-testid","select-button",3,"click","disabled"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page"),Fl.nrm(1,"popup-header",0),Fl.nI1(2,"i18n"),Fl.j41(3,"vault-cipher-form-generator",1),Fl.bIt("valueGenerated",function(e){return t.onValueGenerated(e)})("algorithmSelected",function(e){return t.onAlgorithmSelected(e)}),Fl.k0s(),Fl.j41(4,"popup-footer",2)(5,"button",3),Fl.bIt("click",function(){return t.selectValue()}),Fl.EFF(6),Fl.k0s()()()),2&e&&(Fl.R7$(),Fl.Y8G("backAction",t.close)("pageTitle",Fl.bMT(2,6,t.titleKey)),Fl.R7$(2),Fl.Y8G("type",t.params.type)("uri",t.uri),Fl.R7$(2),Fl.Y8G("disabled",!(t.selectButtonText&&t.generatedValue)),Fl.R7$(),Fl.SpI(" ",t.selectButtonText," "))},dependencies:[tE,aE,TQ,kl.MD,SL,id,td,sc],encapsulation:2});var y4=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class b4{constructor(){this.dialogService=(0,a.WQX)(lh),this.overlay=(0,a.WQX)(wl.hJ)}generatePassword(){return y4(this,void 0,void 0,function*(){const e=g4.open(this.dialogService,this.overlay,{data:{type:"password"}}),t=yield(0,bo._)(e.closed);return null==t||"canceled"===t.action?null:t.generatedValue})}generateUsername(e){return y4(this,void 0,void 0,function*(){const t=g4.open(this.dialogService,this.overlay,{data:{type:"username",uri:e}}),i=yield(0,bo._)(t.closed);return null==i||"canceled"===i.action?null:i.generatedValue})}}b4.ɵfac=function(e){return new(e||b4)},b4.ɵprov=a.jDH({token:b4,factory:b4.ɵfac});var w4=i(60545),S4=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class k4{captureTotpSecret(){return S4(this,void 0,void 0,function*(){const e=yield ul.captureVisibleTab(),t=yield(0,w4.A)(e),i=new URL(t.toString());return"otpauth:"===i.protocol&&i.searchParams.has("secret")?t.toString():null})}canCaptureTotp(e){return!pl.inPopout(e)}}k4.ɵfac=function(e){return new(e||k4)},k4.ɵprov=a.jDH({token:k4,factory:k4.ɵfac});var I4=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class C4{constructor(e,t,i,n,r,s,o,a,l){this.router=e,this.billingAccountProfileStateService=t,this.cipherService=i,this.organizationService=n,this.toastService=r,this.i18nService=s,this.accountService=o,this.cipherFormContainer=a,this.premiumUpgradeService=l,this.accountService.activeAccount$.pipe((0,go.n)(e=>this.billingAccountProfileStateService.hasPremiumFromAnySource$(e.id)),(0,xl.pQ)()).subscribe(e=>{this.canAccessAttachments=e}),this.cipherFormContainer.formStatusChange$.pipe((0,xl.pQ)()).subscribe(e=>{this.parentFormDisabled="disabled"===e})}ngOnInit(){return I4(this,void 0,void 0,function*(){if(!this.cipherId)return;const e=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id))),t=yield this.cipherService.get(this.cipherId,e),i=yield this.cipherService.decrypt(t,e);if(!i.organizationId)return void(this.cipherIsAPartOfFreeOrg=!1);const n=yield(0,bo._)(iv(this.accountService.activeAccount$)),r=yield(0,bo._)(this.organizationService.organizations$(n).pipe(qF(i.organizationId)));this.cipherIsAPartOfFreeOrg=r.productTierType===M$.Free})}openAttachments(){return I4(this,void 0,void 0,function*(){this.canAccessAttachments?this.cipherIsAPartOfFreeOrg?this.toastService.showToast({variant:"error",title:null,message:this.i18nService.t("freeOrgsCannotUseAttachments")}):yield this.router.navigate(["/attachments"],{queryParams:{cipherId:this.cipherId}}):yield this.premiumUpgradeService.promptForPremium()})}}C4.ɵfac=function(e){return new(e||C4)(Fl.rXU(Fd.Ix),Fl.rXU(T$),Fl.rXU(_b),Fl.rXU(WF),Fl.rXU(qb),Fl.rXU(Ul),Fl.rXU(Zk),Fl.rXU(eV),Fl.rXU(qU))},C4.ɵcmp=Fl.VBU({type:C4,selectors:[["app-open-attachments"]],inputs:{cipherId:"cipherId"},decls:12,vars:10,consts:[["bit-item-content","","type","button",3,"click","disabled","title"],[1,"tw-flex","tw-items-center","tw-gap-2"],["slot","end"],[1,"tw-sr-only"],["aria-hidden","true",1,"bwi","bwi-popout","tw-text-muted"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-item")(1,"button",0),Fl.nI1(2,"i18n"),Fl.bIt("click",function(){return t.openAttachments()}),Fl.j41(3,"div",1),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.nrm(6,"app-premium-badge"),Fl.k0s(),Fl.qex(7,2),Fl.j41(8,"span",3),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s(),Fl.nrm(11,"i",4),Fl.bVm(),Fl.k0s()()),2&e&&(Fl.R7$(),Fl.Y8G("disabled",t.parentFormDisabled)("title",Fl.bMT(2,4,"popOutNewWindow")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(5,6,"attachments")," "),Fl.R7$(5),Fl.JRh(Fl.bMT(10,8,"popOutNewWindow")))},dependencies:[eu,kl.MD,VP,GP,KP,sf,tc,ZU,rf],encapsulation:2});var T4=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function P4(e,t){1&e&&(Fl.qex(0,2),Fl.j41(1,"span",8),Fl.nI1(2,"i18n"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.bVm()),2&e&&(Fl.R7$(),Fl.Y8G("appA11yTitle",Fl.bMT(2,2,"archived")),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(4,4,"archived")," "))}function F4(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"vault-cipher-form",9),Fl.bIt("cipherSaved",function(t){a.eBV(e);const i=Fl.XpG();return a.Njj(i.onCipherSaved(t))}),Fl.nrm(1,"app-open-attachments",10),Fl.k0s()}if(2&e){const e=Fl.XpG(),t=Fl.sdS(10);Fl.Y8G("config",e.config)("beforeSubmit",e.checkFido2UserVerification)("submitBtn",t),Fl.R7$(),Fl.Y8G("cipherId",e.originalCipherId)}}function R4(e,t){if(1&e&&(Fl.nrm(0,"button",7),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG();Fl.Y8G("bitAction",e.delete)("label",Fl.bMT(1,2,"delete"))}}const x4=Object.freeze({tabsVault:"/tabs/vault",archive:"/archive"});class A4{constructor(e){var t;this.cipherId=e.cipherId,this.type=(e=>{if(sx(e))return e;if("string"==typeof e){const t=parseInt(e,10);if(sx(t))return t}})(e.type),this.clone="true"===e.clone,this.folderId=e.folderId,this.organizationId=e.organizationId,this.collectionId=e.collectionId,this.uri=e.uri,this.username=e.username,this.name=e.name,this.prefillNameAndURIFromTab=e.prefillNameAndURIFromTab,this.routeAfterDeletion=null!==(t=e.routeAfterDeletion)&&void 0!==t?t:x4.tabsVault}}class D4{get loading(){return null==this.config}get originalCipherId(){var e,t;return null===(t=null===(e=this.config)||void 0===e?void 0:e.originalCipher)||void 0===t?void 0:t.id}get cipher(){var e;return new RO(null===(e=this.config)||void 0===e?void 0:e.originalCipher)}get inFido2PopoutWindow(){return pl.inPopout(window)&&this.fido2PopoutSessionData.isFido2Session}get inSingleActionPopout(){return pl.inSingleActionPopout(window,BZ)}constructor(e,t,i,n,r,s,a,l,c,u,d,h,p,v,f,m){this.route=e,this.i18nService=t,this.addEditFormConfigService=i,this.popupCloseWarningService=n,this.popupRouterCacheService=r,this.router=s,this.cipherService=a,this.eventCollectionService=l,this.logService=c,this.toastService=u,this.dialogService=d,this.cipherAuthorizationService=h,this.accountService=p,this.location=v,this.archiveService=f,this.archiveCipherUtilsService=m,this.cipherFormComponent=(0,o.ebz)(KB),this.routeAfterDeletion="/tabs/vault",this.fido2PopoutSessionData$=eQ(),this.userId$=this.accountService.activeAccount$.pipe(iv),this.userCanArchive$=this.userId$.pipe((0,go.n)(e=>this.archiveService.userCanArchive$(e))),this.archiveFlagEnabled$=this.archiveService.hasArchiveFlagEnabled$,this.checkFido2UserVerification=()=>T4(this,void 0,void 0,function*(){return this.inFido2PopoutWindow,!0}),this.handleBackButton=()=>T4(this,void 0,void 0,function*(){if(this.inFido2PopoutWindow)return this.popupCloseWarningService.disable(),void YZ.abortPopout(this.fido2PopoutSessionData.sessionId);this.inSingleActionPopout?yield pl.closeSingleActionPopout(BZ):yield this.popupRouterCacheService.back()}),this.delete=()=>T4(this,void 0,void 0,function*(){if(!(yield this.dialogService.openSimpleDialog({title:{key:"deleteItem"},content:{key:"deleteItemConfirmation"},type:"warning"})))return!1;try{const e=yield(0,bo._)(this.userId$);yield this.deleteCipher(e)}catch(e){return this.logService.error(e),!1}if(this.routeAfterDeletion!==x4.tabsVault){const e=yield(0,bo._)(this.popupRouterCacheService.history$()),t=e.map(e=>e.url).lastIndexOf(this.routeAfterDeletion);if(-1!==t){const i=t-(e.length-1);yield this.location.historyGo(i)}else yield this.router.navigate([this.routeAfterDeletion])}else yield this.router.navigate([this.routeAfterDeletion]);return this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("deletedItem")}),!0}),this.subscribeToParams()}ngOnInit(){return T4(this,void 0,void 0,function*(){this.fido2PopoutSessionData=yield(0,bo._)(this.fido2PopoutSessionData$),pl.inPopout(window)&&this.popupCloseWarningService.enable(),this.messageListener=e=>T4(this,void 0,void 0,function*(){if("reloadAddEditCipherData"===(null==e?void 0:e.command))try{yield this.reloadCipherData()}catch(e){this.logService.error("Failed to reload cipher data",e)}}),ul.addListener(chrome.runtime.onMessage,this.messageListener)})}ngOnDestroy(){this.messageListener&&ul.removeListener(chrome.runtime.onMessage,this.messageListener)}reloadCipherData(){return T4(this,void 0,void 0,function*(){if(!this.config)return;const e=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv)),t=yield(0,bo._)(this.cipherService.addEditCipherInfo$(e));null!=t&&(this.config=Object.assign(Object.assign({},this.config),{initialValues:E4(t)}),yield this.cipherService.setAddEditCipherInfo(null,e))})}onCipherSaved(e){return T4(this,void 0,void 0,function*(){pl.inPopout(window)&&this.popupCloseWarningService.disable(),this.inFido2PopoutWindow?YZ.confirmNewCredentialResponse(this.fido2PopoutSessionData.sessionId,e.id,this.fido2PopoutSessionData.userVerification):this.inSingleActionPopout?yield pl.closeSingleActionPopout(BZ,1e3):("edit"===this.config.mode||"partial-edit"===this.config.mode?yield this.popupRouterCacheService.back():(yield this.router.navigate(["/view-cipher"],{replaceUrl:!0,queryParams:{cipherId:e.id}}),yield this.popupRouterCacheService.setHistory([])),yield ul.sendMessage("addEditCipherSubmitted"))})}subscribeToParams(){this.route.queryParams.pipe((0,xl.pQ)(),(0,l.T)(e=>new A4(e)),(0,go.n)(e=>T4(this,void 0,void 0,function*(){var t;let i;i=null==e.cipherId?"add":e.clone?"clone":"edit";const n=yield this.addEditFormConfigService.buildConfig(i,e.cipherId,e.type);"edit"!==n.mode||n.originalCipher.edit||(n.mode="partial-edit"),n.initialValues=yield this.setInitialValuesFromParams(e);const r=yield(0,bo._)(this.userId$),s=yield(0,bo._)(this.cipherService.addEditCipherInfo$(r));return null!=s&&(n.initialValues=Object.assign(Object.assign({},n.initialValues),E4(s)),yield this.cipherService.setAddEditCipherInfo(null,r)),["edit","partial-edit"].includes(n.mode)&&(null===(t=n.originalCipher)||void 0===t?void 0:t.id)&&(this.canDeleteCipher$=this.cipherAuthorizationService.canDeleteCipher$(n.originalCipher),yield this.eventCollectionService.collect(Ua.Cipher_ClientViewed,n.originalCipher.id,!1,n.originalCipher.organizationId)),e.routeAfterDeletion&&Object.values(x4).includes(e.routeAfterDeletion)&&(this.routeAfterDeletion=e.routeAfterDeletion),n}))).subscribe(e=>{this.config=e,this.headerText=this.setHeader(e.mode,e.cipherType)})}setInitialValuesFromParams(e){return T4(this,void 0,void 0,function*(){const t={};if(e.folderId&&(t.folderId=e.folderId),e.organizationId&&(t.organizationId=e.organizationId),e.collectionId&&(t.collectionIds=[e.collectionId]),e.uri&&(t.loginUri=e.uri),e.username&&(t.username=e.username),e.name&&(t.name=e.name),e.prefillNameAndURIFromTab){const e=yield ul.getTabFromCurrentWindow();t.loginUri=e.url,t.name=bd.getHostname(e.url)}return t})}setHeader(e,t){const i="edit"===e||"partial-edit"===e,n={[nx.Login]:i?"editItemHeaderLogin":"newItemHeaderLogin",[nx.Card]:i?"editItemHeaderCard":"newItemHeaderCard",[nx.Identity]:i?"editItemHeaderIdentity":"newItemHeaderIdentity",[nx.SecureNote]:i?"editItemHeaderNote":"newItemHeaderNote",[nx.SshKey]:i?"editItemHeaderSshKey":"newItemHeaderSshKey"};return this.i18nService.t(n[t])}deleteCipher(e){return this.config.originalCipher.deletedDate?this.cipherService.deleteWithServer(this.config.originalCipher.id,e):this.cipherService.softDeleteWithServer(this.config.originalCipher.id,e)}}D4.ɵfac=function(e){return new(e||D4)(Fl.rXU(Fd.nX),Fl.rXU(Ul),Fl.rXU(JB),Fl.rXU(v4),Fl.rXU(WD),Fl.rXU(Fd.Ix),Fl.rXU(_b),Fl.rXU(I$),Fl.rXU(Za),Fl.rXU(qb),Fl.rXU(lh),Fl.rXU(L$),Fl.rXU(Zk),Fl.rXU(IF.aZ),Fl.rXU($V),Fl.rXU(oY))},D4.ɵcmp=Fl.VBU({type:D4,selectors:[["app-add-edit"]],viewQuery:function(e,t){1&e&&Fl.wEZ(t.cipherFormComponent,KB,5),2&e&&Fl.NyB()},features:[Fl.Jv_([{provide:JB,useClass:QB},{provide:uB,useClass:k4},{provide:ZN,useClass:b4},{provide:qU,useClass:K2}])],decls:19,vars:17,consts:[["submitBtn",""],["slot","header","showBackButton","",3,"pageTitle","backAction"],["slot","end"],["formId","cipherForm",3,"config","beforeSubmit","submitBtn","cipherSaved",4,"ngIf"],["slot","footer"],["bitButton","","type","submit","form","cipherForm","buttonType","primary"],["bitButton","","type","button","buttonType","secondary",3,"click"],["type","button","buttonType","danger","bitIconButton","bwi-trash",3,"bitAction","label"],["bitBadge","","variant","secondary",3,"appA11yTitle"],["formId","cipherForm",3,"cipherSaved","config","beforeSubmit","submitBtn"],["slot","attachment-button",3,"cipherId"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.SS7(0),Fl.nI1(1,"async"),Fl.j41(2,"popup-page")(3,"popup-header",1),Fl.nVh(4,P4,5,6,"ng-container",2),Fl.nI1(5,"async"),Fl.nrm(6,"app-pop-out",2),Fl.k0s(),Fl.DNE(7,F4,2,4,"vault-cipher-form",3),Fl.j41(8,"popup-footer",4)(9,"button",5,0),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s(),Fl.j41(13,"button",6),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.handleBackButton())}),Fl.EFF(14),Fl.nI1(15,"i18n"),Fl.k0s(),Fl.qex(16,2),Fl.nVh(17,R4,2,4,"button",7),Fl.nI1(18,"async"),Fl.bVm(),Fl.k0s()()}if(2&e){const e=!Fl.bMT(1,7,t.userCanArchive$)&&(null==t.config||null==t.config.originalCipher?null:t.config.originalCipher.archivedDate);Fl.R7$(3),Fl.Y8G("pageTitle",t.headerText)("backAction",t.handleBackButton),Fl.R7$(),Fl.vxM(null!=t.config&&(null!=t.config.originalCipher&&t.config.originalCipher.archivedDate)&&Fl.bMT(5,9,t.archiveFlagEnabled$)?4:-1),Fl.R7$(3),Fl.Y8G("ngIf",!t.loading),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(12,11,e?"unarchiveAndSave":"save")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(15,13,"cancel")," "),Fl.R7$(3),Fl.vxM(Fl.bMT(18,15,t.canDeleteCipher$)?17:-1)}},dependencies:[kl.MD,kl.bT,iO,sf,rw,Il.YN,id,td,C4,tE,aE,TQ,HB,KB,pc,Bd,GD,Ql,Zl,eu,Qc,kl.Jj,rf],encapsulation:2});const E4=e=>{var t;const i={};if(null==e)return i;if(null!=e.collectionIds&&(i.collectionIds=e.collectionIds),null==e.cipher)return i;const n=e.cipher;if(null!=n.folderId&&(i.folderId=n.folderId),null!=n.organizationId&&(i.organizationId=n.organizationId),null!=n.name&&(i.name=n.name),n.type===nx.Card){const e=n.card;null!=e&&(null!=e.cardholderName&&(i.cardholderName=e.cardholderName),null!=e.number&&(i.number=e.number),null!=e.expMonth&&(i.expMonth=e.expMonth),null!=e.expYear&&(i.expYear=e.expYear),null!=e.code&&(i.code=e.code))}if(n.type===nx.Login){const e=n.login;null!=e&&(null!=e.uris&&e.uris.length>0&&(i.loginUri=e.uris[0].uri),null!=e.username&&(i.username=e.username),null!=e.password&&(i.password=e.password))}if(n.type===nx.Identity&&null!=(null===(t=n.identity)||void 0===t?void 0:t.username)&&(i.username=n.identity.username),n.type==nx.Identity){const e=n.identity;null!=e&&(null!=e.title&&(i.title=e.title),null!=e.firstName&&(i.firstName=e.firstName),null!=e.middleName&&(i.middleName=e.middleName),null!=e.lastName&&(i.lastName=e.lastName),null!=e.company&&(i.company=e.company),null!=e.ssn&&(i.ssn=e.ssn),null!=e.passportNumber&&(i.passportNumber=e.passportNumber),null!=e.licenseNumber&&(i.licenseNumber=e.licenseNumber),null!=e.email&&(i.email=e.email),null!=e.phone&&(i.phone=e.phone),null!=e.address1&&(i.address1=e.address1),null!=e.address2&&(i.address2=e.address2),null!=e.address3&&(i.address3=e.address3),null!=e.city&&(i.city=e.city),null!=e.state&&(i.state=e.state),null!=e.postalCode&&(i.postalCode=e.postalCode),null!=e.country&&(i.country=e.country))}return i};var $4=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function O4(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"assign-collections",7),Fl.bIt("onCollectionAssign",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.navigateBack())}),Fl.k0s()}if(2&e){const e=Fl.XpG(),t=Fl.sdS(9);Fl.Y8G("params",e.params)("submitBtn",t)}}class U4{constructor(e,t,i,n,r){this.location=e,this.collectionService=t,this.cipherService=i,this.accountService=n;const s=this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id),(0,Eo.p)(e=>null!=e),(0,go.n)(e=>r.queryParams.pipe((0,go.n)(t=>$4(this,[t],void 0,function*({cipherId:t}){const i=yield this.cipherService.get(t,e);return yield this.cipherService.decrypt(i,e)}))))),o=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.collectionService.decryptedCollections$(e)));(0,jo.z)([s,o]).pipe((0,xl.pQ)(),(0,dm.$)()).subscribe(([e,t])=>{var i;let n=t;const r=null!==(i=null==e?void 0:e.organizationId)&&void 0!==i?i:null;r&&(n=n.filter(e=>e.organizationId===r)),this.params={ciphers:[e],organizationId:r,availableCollections:n}})}navigateBack(){this.location.back()}}U4.ɵfac=function(e){return new(e||U4)(Fl.rXU(IF.aZ),Fl.rXU(uR),Fl.rXU(_b),Fl.rXU(Zk),Fl.rXU(Fd.nX))},U4.ɵcmp=Fl.VBU({type:U4,selectors:[["app-assign-collections"]],decls:15,vars:10,consts:[["assignSubmitButton",""],["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[3,"params","submitBtn","onCollectionAssign",4,"ngIf"],["slot","footer"],["bitButton","","form","assign_collections_form","buttonType","primary","type","submit"],["bitButton","","buttonType","secondary",3,"click"],[3,"onCollectionAssign","params","submitBtn"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"popup-page")(1,"popup-header",1),Fl.nI1(2,"i18n"),Fl.qex(3,2),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.j41(5,"bit-card"),Fl.DNE(6,O4,1,2,"assign-collections",3),Fl.k0s(),Fl.j41(7,"popup-footer",4)(8,"button",5,0),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s(),Fl.j41(12,"a",6),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.navigateBack())}),Fl.EFF(13),Fl.nI1(14,"i18n"),Fl.k0s()()()}2&e&&(Fl.R7$(),Fl.Y8G("pageTitle",Fl.bMT(2,4,"assignToCollections")),Fl.R7$(5),Fl.Y8G("ngIf",t.params),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(11,6,"assign")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(14,8,"cancel")," "))},dependencies:[pc,id,td,kl.MD,kl.bT,sf,Wu,Gu,DL,Ex,Il.X1,tE,aE,TQ,GD,rf],encapsulation:2});var M4=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function N4(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"app-cipher-attachments",7),Fl.bIt("onUploadSuccess",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.navigateBack())}),Fl.k0s()}if(2&e){const e=Fl.XpG(),t=Fl.sdS(7);Fl.Y8G("cipherId",e.cipherId)("submitBtn",t)}}class V4{constructor(e,t){this.popupRouterCacheService=e,this.attachmentFormId=XN.attachmentFormID,t.queryParams.pipe((0,xl.pQ)(),(0,dm.$)()).subscribe(({cipherId:e})=>{this.cipherId=e})}navigateBack(){return M4(this,void 0,void 0,function*(){yield this.popupRouterCacheService.back(!0)})}}V4.ɵfac=function(e){return new(e||V4)(Fl.rXU(WD),Fl.rXU(Fd.nX))},V4.ɵcmp=Fl.VBU({type:V4,selectors:[["app-attachments"]],decls:13,vars:11,consts:[["submitButton",""],["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[3,"cipherId","submitBtn","onUploadSuccess",4,"ngIf"],["slot","footer"],["bitButton","","type","submit","buttonType","primary"],["bitButton","","type","button","buttonType","secondary",3,"click"],[3,"onUploadSuccess","cipherId","submitBtn"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"popup-page")(1,"popup-header",1),Fl.nI1(2,"i18n"),Fl.nrm(3,"app-pop-out",2),Fl.k0s(),Fl.DNE(4,N4,1,2,"app-cipher-attachments",3),Fl.j41(5,"popup-footer",4)(6,"button",5,0),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.j41(10,"button",6),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.navigateBack())}),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s()()()}2&e&&(Fl.R7$(),Fl.Y8G("pageTitle",Fl.bMT(2,5,"attachments")),Fl.R7$(3),Fl.Y8G("ngIf",t.cipherId),Fl.R7$(2),Fl.BMQ("form",t.attachmentFormId),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(9,7,"upload")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(12,9,"cancel")," "))},dependencies:[kl.MD,kl.bT,id,td,sf,XN,tE,aE,TQ,GD,rf],encapsulation:2});const B4=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 18.75 150 112.5">
<path class="tw-fill-illustration-bg-secondary" d="M0 28.125a9.375 9.375 0 0 1 9.375-9.375h50a9.375 9.375 0 0 1 9.375 9.375v31.25a9.375 9.375 0 0 1-9.375 9.375h-50A9.375 9.375 0 0 1 0 59.375v-31.25Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M59.375 21.875h-50a6.25 6.25 0 0 0-6.25 6.25v31.25a6.25 6.25 0 0 0 6.25 6.25h50a6.25 6.25 0 0 0 6.25-6.25v-31.25a6.25 6.25 0 0 0-6.25-6.25Zm-50-3.125A9.375 9.375 0 0 0 0 28.125v31.25a9.375 9.375 0 0 0 9.375 9.375h50a9.375 9.375 0 0 0 9.375-9.375v-31.25a9.375 9.375 0 0 0-9.375-9.375h-50Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="M0 90.625a9.375 9.375 0 0 1 9.375-9.375h50a9.375 9.375 0 0 1 9.375 9.375v31.25a9.375 9.375 0 0 1-9.375 9.375h-50A9.375 9.375 0 0 1 0 121.875v-31.25Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M59.375 84.375h-50a6.25 6.25 0 0 0-6.25 6.25v31.25a6.25 6.25 0 0 0 6.25 6.25h50a6.25 6.25 0 0 0 6.25-6.25v-31.25a6.25 6.25 0 0 0-6.25-6.25Zm-50-3.125A9.375 9.375 0 0 0 0 90.625v31.25a9.375 9.375 0 0 0 9.375 9.375h50a9.375 9.375 0 0 0 9.375-9.375v-31.25a9.375 9.375 0 0 0-9.375-9.375h-50Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="M81.25 28.125a9.375 9.375 0 0 1 9.375-9.375h50A9.375 9.375 0 0 1 150 28.125v31.25a9.375 9.375 0 0 1-9.375 9.375h-50a9.375 9.375 0 0 1-9.375-9.375v-31.25Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M140.625 21.875h-50a6.25 6.25 0 0 0-6.25 6.25v31.25a6.25 6.25 0 0 0 6.25 6.25h50a6.25 6.25 0 0 0 6.25-6.25v-31.25a6.25 6.25 0 0 0-6.25-6.25Zm-50-3.125a9.375 9.375 0 0 0-9.375 9.375v31.25a9.375 9.375 0 0 0 9.375 9.375h50A9.375 9.375 0 0 0 150 59.375v-31.25a9.375 9.375 0 0 0-9.375-9.375h-50Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" d="M81.25 90.625a9.375 9.375 0 0 1 9.375-9.375h50A9.375 9.375 0 0 1 150 90.625v31.25a9.375 9.375 0 0 1-9.375 9.375h-50a9.375 9.375 0 0 1-9.375-9.375v-31.25Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M140.625 84.375h-50a6.25 6.25 0 0 0-6.25 6.25v31.25a6.25 6.25 0 0 0 6.25 6.25h50a6.25 6.25 0 0 0 6.25-6.25v-31.25a6.25 6.25 0 0 0-6.25-6.25Zm-50-3.125a9.375 9.375 0 0 0-9.375 9.375v31.25a9.375 9.375 0 0 0 9.375 9.375h50a9.375 9.375 0 0 0 9.375-9.375v-31.25a9.375 9.375 0 0 0-9.375-9.375h-50Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" d="M84.375 31.25h62.5v6.25h-62.5v-6.25ZM90.625 54.688c0-.863.7-1.563 1.563-1.563h9.374a1.563 1.563 0 1 1 0 3.125h-9.374c-.863 0-1.563-.7-1.563-1.563Z"/>
<path class="tw-fill-illustration-outline" d="M92.188 95.313c0-.863.7-1.563 1.562-1.563h43.75a1.562 1.562 0 0 1 0 3.125H93.75c-.863 0-1.563-.7-1.563-1.563ZM92.188 106.25c0-.863.7-1.562 1.562-1.562h43.75a1.562 1.562 0 1 1 0 3.124H93.75a1.562 1.562 0 0 1-1.563-1.562ZM92.188 117.188c0-.863.7-1.563 1.562-1.563h20.312a1.563 1.563 0 0 1 0 3.125H93.75c-.863 0-1.563-.7-1.563-1.562ZM39.063 95.313c0-.863.7-1.563 1.562-1.563h18.75a1.563 1.563 0 0 1 0 3.125h-18.75c-.863 0-1.563-.7-1.563-1.563ZM39.063 101.562c0-.862.7-1.562 1.562-1.562h7.813a1.563 1.563 0 0 1 0 3.125h-7.813c-.863 0-1.563-.7-1.563-1.563Z"/>
<path class="tw-fill-illustration-bg-secondary" d="M107.812 54.688c0-.863.7-1.563 1.563-1.563h14.063a1.563 1.563 0 0 1 0 3.125h-14.063c-.863 0-1.563-.7-1.563-1.563Z"/>
<path class="tw-fill-illustration-bg-tertiary" d="M32.813 97.656a8.594 8.594 0 1 1-17.189 0 8.594 8.594 0 0 1 17.188 0Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M24.219 103.125a5.468 5.468 0 1 0 0-10.937 5.468 5.468 0 0 0 0 10.937Zm0 3.125a8.594 8.594 0 1 0 0-17.188 8.594 8.594 0 0 0 0 17.188Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M40.82 115.663c.903 2.158 1.367 3.877 1.367 6.212 0 .863-.7 1.563-1.562 1.563H7.812c-.862 0-1.562-.7-1.562-1.563 0-2.335.465-4.054 1.368-6.212a17.77 17.77 0 0 1 3.895-5.768 17.974 17.974 0 0 1 5.83-3.854 18.125 18.125 0 0 1 6.876-1.353c2.36 0 4.696.459 6.876 1.353 2.18.893 4.161 2.203 5.83 3.854a17.77 17.77 0 0 1 3.895 5.768Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M38.964 120.312c-.15-1.105-.478-2.131-1.027-3.442a14.634 14.634 0 0 0-3.21-4.753 14.865 14.865 0 0 0-4.817-3.185 15.012 15.012 0 0 0-11.382 0 14.865 14.865 0 0 0-4.817 3.185 14.634 14.634 0 0 0-3.21 4.753c-.55 1.311-.877 2.337-1.027 3.442h29.49Zm3.224 1.563c0-2.335-.465-4.054-1.368-6.212a17.77 17.77 0 0 0-3.895-5.768 17.974 17.974 0 0 0-5.83-3.854 18.125 18.125 0 0 0-6.876-1.353c-2.36 0-4.697.459-6.877 1.353a17.974 17.974 0 0 0-5.83 3.854 17.77 17.77 0 0 0-3.894 5.768c-.903 2.158-1.368 3.877-1.368 6.212 0 .863.7 1.563 1.563 1.563h32.812c.863 0 1.563-.7 1.563-1.563Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" fill-rule="evenodd" d="M21.875 59.375c5.784 0 10.833-3.142 13.535-7.813h2.358c.829 0 1.624-.329 2.21-.915l2.21-2.21 2.93 2.345c.57.456 1.381.456 1.952 0L50 48.438l2.21 2.21c.586.585 1.38.914 2.21.914h1.89c.95 0 1.848-.431 2.44-1.172l4.532-5.664a1.562 1.562 0 0 0 0-1.952L58.75 37.11a3.125 3.125 0 0 0-2.44-1.172H35.41c-2.702-4.67-7.751-7.813-13.535-7.813-8.63 0-15.625 6.996-15.625 15.625 0 8.63 6.996 15.625 15.625 15.625Zm-3.125-12.5a3.125 3.125 0 1 0 0-6.25 3.125 3.125 0 0 0 0 6.25Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M33.607 48.438h4.161l4.188-4.188 4.138 3.31 4.138-3.31 4.187 4.188h1.892l3.75-4.688-3.75-4.688H33.606l-.902-1.56a12.494 12.494 0 0 0-10.83-6.252c-6.904 0-12.5 5.596-12.5 12.5s5.596 12.5 12.5 12.5c4.623 0 8.664-2.508 10.83-6.252l.902-1.56Zm27.234-5.664-.001.002.001-.002ZM25 43.75a6.25 6.25 0 1 1-12.5 0 6.25 6.25 0 0 1 12.5 0Zm10.41 7.813c-2.702 4.67-7.751 7.812-13.535 7.812-8.63 0-15.625-6.996-15.625-15.625 0-8.63 6.996-15.625 15.625-15.625 5.784 0 10.833 3.142 13.535 7.813h20.9c.95 0 1.848.431 2.44 1.172l4.532 5.664c.456.57.456 1.381 0 1.952L58.75 50.39a3.125 3.125 0 0 1-2.44 1.172h-1.892c-.828 0-1.623-.329-2.21-.915L50 48.437l-2.93 2.345a1.562 1.562 0 0 1-1.952 0l-2.93-2.344-2.21 2.21a3.125 3.125 0 0 1-2.21.914H35.41ZM21.875 43.75a3.125 3.125 0 1 1-6.25 0 3.125 3.125 0 0 1 6.25 0Z" clip-rule="evenodd"/>
</svg>
`,j4=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="6.25 6.25 137.5 137.5">
<path class="tw-fill-illustration-bg-secondary" d="M18.75 53.125a9.375 9.375 0 0 1 9.375-9.375h106.25a9.375 9.375 0 0 1 9.375 9.375v81.25a9.375 9.375 0 0 1-9.375 9.375H28.125a9.375 9.375 0 0 1-9.375-9.375v-81.25Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M134.375 46.875H28.125a6.25 6.25 0 0 0-6.25 6.25v81.25a6.25 6.25 0 0 0 6.25 6.25h106.25a6.25 6.25 0 0 0 6.25-6.25v-81.25a6.25 6.25 0 0 0-6.25-6.25ZM28.125 43.75a9.375 9.375 0 0 0-9.375 9.375v81.25a9.375 9.375 0 0 0 9.375 9.375h106.25a9.375 9.375 0 0 0 9.375-9.375v-81.25a9.375 9.375 0 0 0-9.375-9.375H28.125Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="M6.25 15.625a9.375 9.375 0 0 1 9.375-9.375H112.5a9.375 9.375 0 0 1 9.375 9.375v89.063a9.374 9.374 0 0 1-9.375 9.374H15.625c-5.178 0-9.375-4.197-9.375-9.374V15.625Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M112.5 9.375H15.625a6.25 6.25 0 0 0-6.25 6.25v89.063a6.25 6.25 0 0 0 6.25 6.25H112.5a6.25 6.25 0 0 0 6.25-6.25V15.625a6.25 6.25 0 0 0-6.25-6.25ZM15.625 6.25a9.375 9.375 0 0 0-9.375 9.375v89.063c0 5.177 4.197 9.374 9.375 9.374H112.5a9.374 9.374 0 0 0 9.375-9.374V15.625A9.375 9.375 0 0 0 112.5 6.25H15.625Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" d="M14.063 60.938c0-1.726 1.399-3.126 3.124-3.126h93.751c1.725 0 3.124 1.4 3.124 3.126v15.624a3.125 3.125 0 0 1-3.124 3.126h-93.75a3.125 3.125 0 0 1-3.125-3.126V60.938Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M110.938 60.938h-93.75v15.624h93.75V60.938Zm-93.75-3.126a3.125 3.125 0 0 0-3.125 3.126v15.624c0 1.726 1.399 3.126 3.124 3.126h93.751c1.725 0 3.124-1.4 3.124-3.126V60.938a3.125 3.125 0 0 0-3.124-3.126h-93.75Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" d="M14.063 87.5c0-1.726 1.399-3.125 3.124-3.125h93.751c1.725 0 3.124 1.4 3.124 3.125v15.625a3.125 3.125 0 0 1-3.124 3.125h-93.75a3.125 3.125 0 0 1-3.125-3.125V87.5Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M110.938 87.5h-93.75v15.625h93.75V87.5Zm-93.75-3.125a3.125 3.125 0 0 0-3.125 3.125v15.625c0 1.726 1.399 3.125 3.124 3.125h93.751a3.125 3.125 0 0 0 3.124-3.125V87.5a3.125 3.125 0 0 0-3.124-3.125h-93.75ZM142.187 60.938h-21.875v-3.126h21.876l-.001 3.126Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M26.57 89.957c.862 0 1.562.7 1.562 1.563v2.187l2.05-.671a1.562 1.562 0 0 1 .973 2.97l-2.078.68 1.301 1.822a1.562 1.562 0 0 1-2.543 1.817l-1.265-1.773-1.266 1.772a1.561 1.561 0 1 1-2.543-1.815l1.301-1.823-2.078-.68a1.562 1.562 0 1 1 .972-2.97l2.05.671V91.52c0-.862.7-1.562 1.563-1.562Zm14.062 0c.863 0 1.562.7 1.562 1.563v2.187l2.05-.671a1.562 1.562 0 0 1 .973 2.97l-2.078.68 1.302 1.822a1.562 1.562 0 0 1-2.543 1.817l-1.266-1.773-1.266 1.772a1.561 1.561 0 1 1-2.543-1.815l1.301-1.823-2.078-.68a1.562 1.562 0 1 1 .973-2.97l2.05.671V91.52c0-.862.7-1.562 1.563-1.562Zm14.062 0c.863 0 1.563.7 1.563 1.563v2.187l2.05-.671a1.562 1.562 0 0 1 .973 2.97l-2.078.68 1.302 1.822a1.562 1.562 0 0 1-2.544 1.817l-1.266-1.773-1.265 1.772a1.561 1.561 0 1 1-2.543-1.815l1.301-1.823-2.078-.68a1.562 1.562 0 1 1 .972-2.97l2.05.671V91.52c0-.862.7-1.562 1.563-1.562Zm14.063 0c.863 0 1.562.7 1.562 1.563v2.187l2.05-.671a1.562 1.562 0 0 1 .973 2.97l-2.078.68 1.302 1.822a1.562 1.562 0 0 1-2.543 1.817l-1.266-1.773-1.266 1.772a1.561 1.561 0 1 1-2.543-1.815l1.302-1.823-2.079-.68a1.562 1.562 0 1 1 .973-2.97l2.05.671V91.52c0-.862.7-1.562 1.563-1.562Zm14.062 0c.863 0 1.563.7 1.563 1.563v2.187l2.05-.671a1.562 1.562 0 0 1 .973 2.97l-2.078.68 1.302 1.822a1.562 1.562 0 0 1-2.544 1.817l-1.265-1.773-1.266 1.772a1.561 1.561 0 1 1-2.543-1.815l1.301-1.823-2.078-.68a1.562 1.562 0 1 1 .973-2.97l2.05.671V91.52c0-.862.7-1.562 1.562-1.562Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" d="M84.375 32.813c0 11.218-9.094 20.312-20.313 20.312-11.218 0-20.312-9.094-20.312-20.313 0-11.218 9.094-20.312 20.313-20.312 11.218 0 20.312 9.094 20.312 20.313Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M64.063 50c9.492 0 17.187-7.695 17.187-17.188 0-9.492-7.695-17.187-17.188-17.187-9.492 0-17.187 7.695-17.187 17.188C46.875 42.305 54.57 50 64.063 50Zm0 3.125c11.218 0 20.312-9.094 20.312-20.313 0-11.218-9.094-20.312-20.313-20.312-11.218 0-20.312 9.094-20.312 20.313 0 11.218 9.094 20.312 20.313 20.312Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M73.438 31.25a9.375 9.375 0 1 1-18.75 0 9.375 9.375 0 1 1 18.75 0Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M64.063 37.5a6.25 6.25 0 1 0 0-12.5 6.25 6.25 0 0 0 0 12.5Zm0 3.125a9.375 9.375 0 1 0 0-18.75 9.375 9.375 0 1 0 0 18.75Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" fill-rule="evenodd" d="M49.076 46.524c.275-.325.559-.643.852-.952a21.056 21.056 0 0 1 6.844-4.818 20.165 20.165 0 0 1 8.072-1.691c2.77 0 5.513.574 8.072 1.691a21.055 21.055 0 0 1 6.843 4.818l.059.062c-3.725 4.571-9.4 7.491-15.755 7.491a20.26 20.26 0 0 1-14.987-6.6Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M49.076 46.524a20.26 20.26 0 0 0 14.986 6.601c6.357 0 12.031-2.92 15.756-7.49l-.059-.063a21.055 21.055 0 0 0-6.843-4.818 20.165 20.165 0 0 0-8.072-1.691c-2.77 0-5.513.574-8.072 1.691a21.056 21.056 0 0 0-6.844 4.818c-.293.309-.577.627-.852.952Zm26.262-.739a17.701 17.701 0 0 0-3.672-2.167 17.04 17.04 0 0 0-6.822-1.43 17.04 17.04 0 0 0-6.822 1.43 17.774 17.774 0 0 0-4.459 2.804A17.104 17.104 0 0 0 64.063 50c4.313 0 8.255-1.587 11.275-4.215ZM21.875 68.75c0-.863.7-1.563 1.563-1.563h43.75a1.563 1.563 0 0 1 0 3.126h-43.75c-.863 0-1.563-.7-1.563-1.563Z" clip-rule="evenodd"/>
</svg>
`;var G4=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const L4=new m(Me,"introCarouselDismissed",{deserializer:e=>e});class z4{constructor(e){this.stateProvider=e,this.introCarouselState=this.stateProvider.getGlobal(L4),this.introCarouselState$=this.introCarouselState.state$.pipe((0,l.T)(e=>null!=e&&e))}setIntroCarouselDismissed(){return G4(this,void 0,void 0,function*(){yield this.introCarouselState.update(()=>!0)})}}z4.ɵfac=function(e){return new(e||z4)(a.KVO(u))},z4.ɵprov=a.jDH({token:z4,factory:z4.ɵfac,providedIn:"root"});var _4=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class K4{constructor(e,t){this.router=e,this.introCarouselService=t,this.itemTypes=B4,this.loginCards=j4,this.noCredentials=oG,this.secureDevices=eJ}navigateToSignup(){return _4(this,void 0,void 0,function*(){yield this.introCarouselService.setIntroCarouselDismissed(),yield this.router.navigate(["/signup"])})}navigateToLogin(){return _4(this,void 0,void 0,function*(){yield this.introCarouselService.setIntroCarouselDismissed(),yield this.router.navigate(["/login"])})}}K4.ɵfac=function(e){return new(e||K4)(Fl.rXU(Fd.Ix),Fl.rXU(z4))},K4.ɵcmp=Fl.VBU({type:K4,selectors:[["app-intro-carousel"]],decls:52,vars:53,consts:[[3,"label"],[3,"label","disablePadding"],[1,"tw-flex","tw-flex-col","tw-items-center","tw-justify-around"],[1,"tw-size-32","tw-content-center","tw-my-4"],[3,"content"],["bitTypography","h2",1,"tw-text-center"],["bitTypography","body1",1,"tw-text-center"],["type","button","bitButton","","buttonType","primary",1,"tw-w-full","tw-mt-4",3,"click"],["type","button","bitButton","","buttonType","secondary",1,"tw-w-full","tw-mt-2",3,"click"]],template:function(e,t){1&e&&(Fl.j41(0,"vault-carousel",0),Fl.nI1(1,"i18n"),Fl.j41(2,"vault-carousel-slide",1),Fl.nI1(3,"i18n"),Fl.j41(4,"div",2)(5,"div",3),Fl.nrm(6,"bit-svg",4),Fl.k0s(),Fl.j41(7,"h2",5),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.j41(10,"p",6),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s()()(),Fl.j41(13,"vault-carousel-slide",1),Fl.nI1(14,"i18n"),Fl.j41(15,"div",2)(16,"div",3),Fl.nrm(17,"bit-svg",4),Fl.k0s(),Fl.j41(18,"h2",5),Fl.EFF(19),Fl.nI1(20,"i18n"),Fl.k0s(),Fl.j41(21,"p",6),Fl.EFF(22),Fl.nI1(23,"i18n"),Fl.k0s()()(),Fl.j41(24,"vault-carousel-slide",1),Fl.nI1(25,"i18n"),Fl.j41(26,"div",2)(27,"div",3),Fl.nrm(28,"bit-svg",4),Fl.k0s(),Fl.j41(29,"h2",5),Fl.EFF(30),Fl.nI1(31,"i18n"),Fl.k0s(),Fl.j41(32,"p",6),Fl.EFF(33),Fl.nI1(34,"i18n"),Fl.k0s()()(),Fl.j41(35,"vault-carousel-slide",1),Fl.nI1(36,"i18n"),Fl.j41(37,"div",2)(38,"div",3),Fl.nrm(39,"bit-svg",4),Fl.k0s(),Fl.j41(40,"h2",5),Fl.EFF(41),Fl.nI1(42,"i18n"),Fl.k0s(),Fl.j41(43,"p",6),Fl.EFF(44),Fl.nI1(45,"i18n"),Fl.k0s()()()(),Fl.j41(46,"button",7),Fl.bIt("click",function(){return t.navigateToSignup()}),Fl.EFF(47),Fl.nI1(48,"i18n"),Fl.k0s(),Fl.j41(49,"button",8),Fl.bIt("click",function(){return t.navigateToLogin()}),Fl.EFF(50),Fl.nI1(51,"i18n"),Fl.k0s()),2&e&&(Fl.Y8G("label",Fl.bMT(1,23,"introCarouselLabel")),Fl.R7$(2),Fl.Y8G("label",Fl.bMT(3,25,"securityPrioritized"))("disablePadding",!0),Fl.R7$(4),Fl.Y8G("content",t.itemTypes),Fl.R7$(2),Fl.JRh(Fl.bMT(9,27,"securityPrioritized")),Fl.R7$(3),Fl.JRh(Fl.bMT(12,29,"securityPrioritizedBody")),Fl.R7$(2),Fl.Y8G("label",Fl.bMT(14,31,"quickLogin"))("disablePadding",!0),Fl.R7$(4),Fl.Y8G("content",t.loginCards),Fl.R7$(2),Fl.JRh(Fl.bMT(20,33,"quickLogin")),Fl.R7$(3),Fl.JRh(Fl.bMT(23,35,"quickLoginBody")),Fl.R7$(2),Fl.Y8G("label",Fl.bMT(25,37,"secureUser"))("disablePadding",!0),Fl.R7$(4),Fl.Y8G("content",t.noCredentials),Fl.R7$(2),Fl.JRh(Fl.bMT(31,39,"secureUser")),Fl.R7$(3),Fl.JRh(Fl.bMT(34,41,"secureUserBody")),Fl.R7$(2),Fl.Y8G("label",Fl.bMT(36,43,"secureDevices"))("disablePadding",!0),Fl.R7$(4),Fl.Y8G("content",t.secureDevices),Fl.R7$(2),Fl.JRh(Fl.bMT(42,45,"secureDevices")),Fl.R7$(3),Fl.JRh(Fl.bMT(45,47,"secureDevicesBody")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(48,49,"createAccount"),"\n"),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(51,51,"logIn"),"\n"))},dependencies:[uz,cz,WL,id,td,Yh,BC,Fh,tc,rc,sf,sc],encapsulation:2});var X4=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function q4(e,t){if(1&e&&Fl.nrm(0,"vault-password-history-view",4),2&e){const e=Fl.XpG();Fl.Y8G("cipher",e.cipher)}}class W4{constructor(e,t,i,n){this.browserRouterHistory=e,this.route=t,this.cipherService=i,this.accountService=n}ngOnInit(){this.route.queryParams.pipe((0,dm.$)()).subscribe(e=>{e.cipherId?this.loadCipher(e.cipherId):this.close()})}close(){this.browserRouterHistory.back()}loadCipher(e){return X4(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>e)));if(!(null==t?void 0:t.id))throw new Error("Active account is not available.");const i=t.id,n=yield this.cipherService.get(e,i);this.cipher=yield this.cipherService.decrypt(n,i)})}}W4.ɵfac=function(e){return new(e||W4)(Fl.rXU(WD),Fl.rXU(Fd.nX),Fl.rXU(_b),Fl.rXU(Zk))},W4.ɵcmp=Fl.VBU({type:W4,selectors:[["vault-password-history"]],decls:6,vars:6,consts:[[3,"loading"],["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[3,"cipher",4,"ngIf"],[3,"cipher"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page",0)(1,"popup-header",1),Fl.nI1(2,"i18n"),Fl.qex(3,2),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.DNE(5,q4,1,1,"vault-password-history-view",3),Fl.k0s()),2&e&&(Fl.Y8G("loading",!t.cipher),Fl.R7$(),Fl.Y8G("pageTitle",Fl.mNQ(Fl.bMT(2,4,"passwordHistory"))),Fl.R7$(4),Fl.Y8G("ngIf",t.cipher))},dependencies:[sf,tE,GD,aE,UL,kl.bT,rf],encapsulation:2});const Y4=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 10 96 80">
<path class="tw-fill-illustration-bg-primary" d="M10 80h14l-2 10H12l-2-10Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="m10 80 2 10h10l2-10H10Zm2.44 2 1.2 6h6.72l1.2-6h-9.12Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="M72 80h14l-2 10H74l-2-10Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="m72 80 2 10h10l2-10H72Zm2.44 2 1.2 6h6.72l1.2-6h-9.12Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" fill-rule="evenodd" d="m12.5 82 .5 3h8l.5-3h-9ZM74.5 82l.5 3h8l.5-3h-9Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="M0 18a8 8 0 0 1 8-8h80a8 8 0 0 1 8 8v56a8 8 0 0 1-8 8H8a8 8 0 0 1-8-8V18Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M88 12H8a6 6 0 0 0-6 6v56a6 6 0 0 0 6 6h80a6 6 0 0 0 6-6V18a6 6 0 0 0-6-6ZM8 10a8 8 0 0 0-8 8v56a8 8 0 0 0 8 8h80a8 8 0 0 0 8-8V18a8 8 0 0 0-8-8H8Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" d="M8 22a4 4 0 0 1 4-4h72a4 4 0 0 1 4 4v48a4 4 0 0 1-4 4H12a4 4 0 0 1-4-4V22Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M84 20H12a2 2 0 0 0-2 2v48a2 2 0 0 0 2 2h72a2 2 0 0 0 2-2V22a2 2 0 0 0-2-2Zm-72-2a4 4 0 0 0-4 4v48a4 4 0 0 0 4 4h72a4 4 0 0 0 4-4V22a4 4 0 0 0-4-4H12Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="M84 26a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V26Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M90 26h-4v10h4V26Zm-4-2a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2V26a2 2 0 0 0-2-2h-4Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="M84 56a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V56Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M90 56h-4v10h4V56Zm-4-2a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2V56a2 2 0 0 0-2-2h-4Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-secondary" fill-rule="evenodd" d="M86 62v4h4v-4h-4ZM86 32v4h4v-4h-4Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" d="M64 46c0 8.837-7.163 16-16 16s-16-7.163-16-16 7.163-16 16-16 16 7.163 16 16Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M48 60c7.732 0 14-6.268 14-14s-6.268-14-14-14-14 6.268-14 14 6.268 14 14 14Zm0 2c8.837 0 16-7.163 16-16s-7.163-16-16-16-16 7.163-16 16 7.163 16 16 16Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M48 55a1 1 0 0 1-1-1V40.414l-5.293 5.293a1 1 0 0 1-1.414-1.414l7-7a1 1 0 0 1 1.414 0l7 7a1 1 0 0 1-1.414 1.414L49 40.414V54a1 1 0 0 1-1 1Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M76 22a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v48a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V22Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M84 20h-4a2 2 0 0 0-2 2v48a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2V22a2 2 0 0 0-2-2Zm-4-2a4 4 0 0 0-4 4v48a4 4 0 0 0 4 4h4a4 4 0 0 0 4-4V22a4 4 0 0 0-4-4h-4Z" clip-rule="evenodd"/>
</svg>
`;var H4=i(44111),J4=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Z4{constructor(){this.globalStateProvider=(0,a.WQX)(d),this.messageSender=(0,a.WQX)(bk),this.router=(0,a.WQX)(Fd.Ix)}get cache(){if(!this._cache)throw new Error("Dirty View Cache not initialized");return this._cache}init(){return J4(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.globalStateProvider.get(zD).state$);this._cache=Object.freeze(null!=e?e:{}),this.router.events.pipe((0,Eo.p)(e=>e instanceof Fd.wF),(0,ny.i)(1)).subscribe(()=>this.clearState(!0))})}signal(e){var t;const{deserializer:i=e=>e,key:n,injector:r=(0,a.WQX)(a.zZn),initialValue:s,persistNavigation:o,clearOnTabChange:l}=e,c=(null===(t=this.cache[n])||void 0===t?void 0:t.value)?i(JSON.parse(this.cache[n].value)):s,u=(0,a.vPA)(c),d=Object.assign(Object.assign({},o&&{persistNavigation:o}),l&&{clearOnTabChange:l});return(0,Rl.QZ)(()=>{this.updateState(n,JSON.stringify(u()),d)},{injector:r}),u}formGroup(e){const{control:t,injector:i}=e,n=this.signal(Object.assign(Object.assign({},e),{initialValue:t.getRawValue()})),r=n();return void 0!==r&&JSON.stringify(r)!==JSON.stringify(t.getRawValue())&&(t.setValue(r),t.markAsDirty()),t.valueChanges.pipe((0,xl.pQ)(null==i?void 0:i.get(a.abz))).subscribe(()=>{n.set(t.getRawValue())}),t}updateState(e,t,i){this.messageSender.send(KD,{key:e,value:t,options:i})}clearState(e=!1){this._cache=e?Object.fromEntries(Object.entries(this._cache).filter(([,{options:e}])=>null==e?void 0:e.persistNavigation)):{},this.messageSender.send(XD,{routeChange:e})}}Z4.ɵfac=function(e){return new(e||Z4)},Z4.ɵprov=a.jDH({token:Z4,factory:Z4.ɵfac,providedIn:"root"});var Q4=i(38382),e8=i(50203);const t8="collectPageDetails",i8="collectPageDetailsFromTabObservable",n8=new wk("collectPageDetailsResponse");class r8{}const s8="autofill-injected-script-port";var o8=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function a8(e){return o8(this,arguments,void 0,function*(e,t={}){return"undefined"!=typeof browser&&void 0!==browser.runtime&&void 0!==browser.runtime.sendMessage?browser.runtime.sendMessage(Object.assign({command:e},t)):new Promise(i=>chrome.runtime.sendMessage(Object.assign({command:e},t),e=>{chrome.runtime.lastError&&i(null),i(e)}))})}class l8{}l8.EmailFieldNames=["email","email address","e-mail","e-mail address","email adresse","e-mail adresse"],l8.UsernameFieldNames=["username","user name","userid","user id","customer id","login id","login","benutzername","benutzer name","benutzerid","benutzer id",...l8.EmailFieldNames],l8.TotpFieldNames=["totp","totpcode","2facode","approvals_code","mfacode","otc-code","onetimecode","otp-code","otpcode","onetimepassword","security_code","second-factor","twofactor","twofa","twofactorcode","verificationcode","verification code"],l8.RecoveryCodeFieldNames=["backup","recovery"],l8.AmbiguousTotpFieldNames=["code","pin","otc","otp","2fa","mfa"],l8.SearchFieldNames=["search","query","find","go"],l8.NewEmailFieldKeywords=["new-email","newemail","new email","neue e-mail"],l8.RegistrationKeywords=["register","signup","sign-up","join","create"],l8.NewsletterFormNames=["newsletter"],l8.FieldIgnoreList=["captcha","findanything","forgot"],l8.PasswordFieldExcludeList=["hint",...l8.FieldIgnoreList,...l8.TotpFieldNames],l8.ExcludedAutofillLoginTypes=["hidden","file","button","image","reset","search"],l8.ExcludedAutofillTypes=["radio","checkbox",...l8.ExcludedAutofillLoginTypes],l8.ExcludedInlineMenuTypes=["textarea",...l8.ExcludedAutofillTypes],l8.ExcludedIdentityAutocompleteTypes=new Set(["current-password","new-password"]);class c8{}c8.CardAttributes=["autoCompleteType","data-stripe","htmlName","htmlID","title","label-tag","placeholder","label-left","label-top","data-recurly"],c8.CardAttributesExtended=[...c8.CardAttributes,"label-right"],c8.CardHolderFieldNames=["accountholdername","cc-name","card-name","cardholder-name","cardholder","name","nom"],c8.CardHolderFieldNameValues=["accountholdername","cc-name","card-name","cardholder-name","cardholder","tbName"],c8.CardNumberFieldNames=["cc-number","cc-num","card-number","card-num","number","cc","cc-no","card-no","credit-card","numero-carte","carte","carte-credit","num-carte","cb-num","card-pan"],c8.CardNumberFieldNameValues=["cc-number","cc-num","card-number","card-num","cc-no","card-no","numero-carte","num-carte","cb-num"],c8.CardExpiryFieldNames=["cc-exp","card-exp","cc-expiration","card-expiration","cc-ex","card-ex","card-expire","card-expiry","validite","expiration","expiry","mm-yy","mm-yyyy","yy-mm","yyyy-mm","expiration-date","payment-card-expiration","payment-cc-date"],c8.CardExpiryFieldNameValues=["mm-yy","mm-yyyy","yy-mm","yyyy-mm","expiration-date","payment-card-expiration"],c8.ExpiryMonthFieldNames=["exp-month","cc-exp-month","cc-month","card-month","cc-mo","card-mo","exp-mo","card-exp-mo","cc-exp-mo","card-expiration-month","expiration-month","cc-mm","cc-m","card-mm","card-m","card-exp-mm","cc-exp-mm","exp-mm","exp-m","expire-month","expire-mo","expiry-month","expiry-mo","card-expire-month","card-expire-mo","card-expiry-month","card-expiry-mo","mois-validite","mois-expiration","m-validite","m-expiration","expiry-date-field-month","expiration-date-month","expiration-date-mm","exp-mon","validity-mo","exp-date-mo","cb-date-mois","date-m"],c8.ExpiryYearFieldNames=["exp-year","cc-exp-year","cc-year","card-year","cc-yr","card-yr","exp-yr","card-exp-yr","cc-exp-yr","card-expiration-year","expiration-year","cc-yy","cc-y","card-yy","card-y","card-exp-yy","cc-exp-yy","exp-yy","exp-y","cc-yyyy","card-yyyy","card-exp-yyyy","cc-exp-yyyy","expire-year","expire-yr","expiry-year","expiry-yr","card-expire-year","card-expire-yr","card-expiry-year","card-expiry-yr","an-validite","an-expiration","annee-validite","annee-expiration","expiry-date-field-year","expiration-date-year","cb-date-ann","expiration-date-yy","expiration-date-yyyy","validity-year","exp-date-year","date-y"],c8.CVVFieldNames=["cvv","cvc","cvv2","cc-csc","cc-cvv","card-csc","card-cvv","cvd","cid","cvc2","cnv","cvn2","cc-code","card-code","code-securite","security-code","crypto","card-verif","verification-code","csc","ccv"],c8.CardBrandFieldNames=["cc-type","card-type","card-brand","cc-brand","cb-type"],c8.CardExpiryDateFormats=[{Month:"mm",MonthShort:"m",Year:"yyyy",YearShort:"yy"},{Month:"mm",MonthShort:"m",Year:"åååå",YearShort:"åå"},{Month:"mm",MonthShort:"m",Year:"jjjj",YearShort:"jj"},{Month:"mm",MonthShort:"m",Year:"aa",YearShort:"aa"},{Month:"мм",MonthShort:"м",Year:"гггг",YearShort:"гг"},{Month:"mm",MonthShort:"m",Year:"rrrr",YearShort:"rr"}],c8.MonthAbbr=["mm","mm","mm","mm","мм","mm"],c8.YearAbbrShort=["yy","åå","jj","aa","гг","rr"],c8.YearAbbrLong=["yyyy","åååå","jjjj","aa","гггг","rrrr"];class u8{}u8.IdentityAttributes=["autoCompleteType","data-stripe","htmlName","htmlID","label-tag","placeholder","label-left","label-top","data-recurly","accountCreationFieldType"],u8.FullNameFieldNames=["name","full-name","your-name"],u8.FullNameFieldNameValues=["full-name","your-name"],u8.TitleFieldNames=["honorific-prefix","prefix","title","anrede"],u8.FirstnameFieldNames=["f-name","first-name","given-name","first-n","vorname"],u8.MiddlenameFieldNames=["m-name","middle-name","additional-name","middle-initial","middle-n","middle-i"],u8.LastnameFieldNames=["l-name","last-name","s-name","surname","family-name","family-n","last-n","nachname","familienname"],u8.EmailFieldNames=["e-mail","email-address"],u8.AddressFieldNames=["address","street-address","addr","street","mailing-addr","billing-addr","mail-addr","bill-addr","strasse","adresse"],u8.AddressFieldNameValues=["mailing-addr","billing-addr","mail-addr","bill-addr"],u8.Address1FieldNames=["address-1","address-line-1","addr-1","street-1"],u8.Address2FieldNames=["address-2","address-line-2","addr-2","street-2","address-ext"],u8.Address3FieldNames=["address-3","address-line-3","addr-3","street-3"],u8.PostalCodeFieldNames=["postal","zip","zip2","zip-code","postal-code","post-code","postcode","address-zip","address-postal","address-code","address-postal-code","address-zip-code","plz","postleitzahl"],u8.CityFieldNames=["city","town","address-level-2","address-city","address-town","ort","stadt","wohnort"],u8.StateFieldNames=["state","province","provence","address-level-1","address-state","address-province","bundesland"],u8.CountryFieldNames=["country","country-code","country-name","address-country","address-country-name","address-country-code","land"],u8.PhoneFieldNames=["phone","mobile","mobile-phone","tel","telephone","phone-number","telefon","telefonnummer","mobil","handy"],u8.UserNameFieldNames=["user-name","user-id","screen-name"],u8.CompanyFieldNames=["company","company-name","organization","organization-name","firma"],u8.IsoCountries={afghanistan:"AF","aland islands":"AX",albania:"AL",algeria:"DZ","american samoa":"AS",andorra:"AD",angola:"AO",anguilla:"AI",antarctica:"AQ","antigua and barbuda":"AG",argentina:"AR",armenia:"AM",aruba:"AW",australia:"AU",austria:"AT",azerbaijan:"AZ",bahamas:"BS",bahrain:"BH",bangladesh:"BD",barbados:"BB",belarus:"BY",belgium:"BE",belize:"BZ",benin:"BJ",bermuda:"BM",bhutan:"BT",bolivia:"BO","bosnia and herzegovina":"BA",botswana:"BW","bouvet island":"BV",brazil:"BR","british indian ocean territory":"IO","brunei darussalam":"BN",bulgaria:"BG","burkina faso":"BF",burundi:"BI",cambodia:"KH",cameroon:"CM",canada:"CA","cape verde":"CV","cayman islands":"KY","central african republic":"CF",chad:"TD",chile:"CL",china:"CN","christmas island":"CX","cocos (keeling) islands":"CC",colombia:"CO",comoros:"KM",congo:"CG","congo, democratic republic":"CD","cook islands":"CK","costa rica":"CR","cote d'ivoire":"CI",croatia:"HR",cuba:"CU",cyprus:"CY","czech republic":"CZ",denmark:"DK",djibouti:"DJ",dominica:"DM","dominican republic":"DO",ecuador:"EC",egypt:"EG","el salvador":"SV","equatorial guinea":"GQ",eritrea:"ER",estonia:"EE",ethiopia:"ET","falkland islands":"FK","faroe islands":"FO",fiji:"FJ",finland:"FI",france:"FR","french guiana":"GF","french polynesia":"PF","french southern territories":"TF",gabon:"GA",gambia:"GM",georgia:"GE",germany:"DE",ghana:"GH",gibraltar:"GI",greece:"GR",greenland:"GL",grenada:"GD",guadeloupe:"GP",guam:"GU",guatemala:"GT",guernsey:"GG",guinea:"GN","guinea-bissau":"GW",guyana:"GY",haiti:"HT","heard island & mcdonald islands":"HM","holy see (vatican city state)":"VA",honduras:"HN","hong kong":"HK",hungary:"HU",iceland:"IS",india:"IN",indonesia:"ID","iran, islamic republic of":"IR",iraq:"IQ",ireland:"IE","isle of man":"IM",israel:"IL",italy:"IT",jamaica:"JM",japan:"JP",jersey:"JE",jordan:"JO",kazakhstan:"KZ",kenya:"KE",kiribati:"KI","republic of korea":"KR","south korea":"KR","democratic people's republic of korea":"KP","north korea":"KP",kuwait:"KW",kyrgyzstan:"KG","lao people's democratic republic":"LA",latvia:"LV",lebanon:"LB",lesotho:"LS",liberia:"LR","libyan arab jamahiriya":"LY",liechtenstein:"LI",lithuania:"LT",luxembourg:"LU",macao:"MO",macedonia:"MK",madagascar:"MG",malawi:"MW",malaysia:"MY",maldives:"MV",mali:"ML",malta:"MT","marshall islands":"MH",martinique:"MQ",mauritania:"MR",mauritius:"MU",mayotte:"YT",mexico:"MX","micronesia, federated states of":"FM",moldova:"MD",monaco:"MC",mongolia:"MN",montenegro:"ME",montserrat:"MS",morocco:"MA",mozambique:"MZ",myanmar:"MM",namibia:"NA",nauru:"NR",nepal:"NP",netherlands:"NL","netherlands antilles":"AN","new caledonia":"NC","new zealand":"NZ",nicaragua:"NI",niger:"NE",nigeria:"NG",niue:"NU","norfolk island":"NF","northern mariana islands":"MP",norway:"NO",oman:"OM",pakistan:"PK",palau:"PW","palestinian territory, occupied":"PS",panama:"PA","papua new guinea":"PG",paraguay:"PY",peru:"PE",philippines:"PH",pitcairn:"PN",poland:"PL",portugal:"PT","puerto rico":"PR",qatar:"QA",reunion:"RE",romania:"RO","russian federation":"RU",rwanda:"RW","saint barthelemy":"BL","saint helena":"SH","saint kitts and nevis":"KN","saint lucia":"LC","saint martin":"MF","saint pierre and miquelon":"PM","saint vincent and grenadines":"VC",samoa:"WS","san marino":"SM","sao tome and principe":"ST","saudi arabia":"SA",senegal:"SN",serbia:"RS",seychelles:"SC","sierra leone":"SL",singapore:"SG",slovakia:"SK",slovenia:"SI","solomon islands":"SB",somalia:"SO","south africa":"ZA","south georgia and sandwich isl.":"GS",spain:"ES","sri lanka":"LK",sudan:"SD",suriname:"SR","svalbard and jan mayen":"SJ",swaziland:"SZ",sweden:"SE",switzerland:"CH","syrian arab republic":"SY",taiwan:"TW",tajikistan:"TJ",tanzania:"TZ",thailand:"TH","timor-leste":"TL",togo:"TG",tokelau:"TK",tonga:"TO","trinidad and tobago":"TT",tunisia:"TN",turkey:"TR",turkmenistan:"TM","turks and caicos islands":"TC",tuvalu:"TV",uganda:"UG",ukraine:"UA","united arab emirates":"AE","united kingdom":"GB","united states":"US","united states outlying islands":"UM",uruguay:"UY",uzbekistan:"UZ",vanuatu:"VU",venezuela:"VE",vietnam:"VN","virgin islands, british":"VG","virgin islands, u.s.":"VI","wallis and futuna":"WF","western sahara":"EH",yemen:"YE",zambia:"ZM",zimbabwe:"ZW"},u8.IsoStates={alabama:"AL",alaska:"AK","american samoa":"AS",arizona:"AZ",arkansas:"AR",california:"CA",colorado:"CO",connecticut:"CT",delaware:"DE","district of columbia":"DC","federated states of micronesia":"FM",florida:"FL",georgia:"GA",guam:"GU",hawaii:"HI",idaho:"ID",illinois:"IL",indiana:"IN",iowa:"IA",kansas:"KS",kentucky:"KY",louisiana:"LA",maine:"ME","marshall islands":"MH",maryland:"MD",massachusetts:"MA",michigan:"MI",minnesota:"MN",mississippi:"MS",missouri:"MO",montana:"MT",nebraska:"NE",nevada:"NV","new hampshire":"NH","new jersey":"NJ","new mexico":"NM","new york":"NY","north carolina":"NC","north dakota":"ND","northern mariana islands":"MP",ohio:"OH",oklahoma:"OK",oregon:"OR",palau:"PW",pennsylvania:"PA","puerto rico":"PR","rhode island":"RI","south carolina":"SC","south dakota":"SD",tennessee:"TN",texas:"TX",utah:"UT",vermont:"VT","virgin islands":"VI",virginia:"VA",washington:"WA","west virginia":"WV",wisconsin:"WI",wyoming:"WY"},u8.IsoProvinces={alberta:"AB","british columbia":"BC",manitoba:"MB","new brunswick":"NB","newfoundland and labrador":"NL","nova scotia":"NS",ontario:"ON","prince edward island":"PE",quebec:"QC",saskatchewan:"SK"};const d8=["login","signin","submit","continue","next","verify"],h8=["change","save","savepassword","updatepassword","changepassword","resetpassword"],p8=6,v8=7;class f8{constructor(){this.script=[],this.properties={}}}var m8=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class g8{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p){this.cipherService=e,this.autofillSettingsService=t,this.totpService=i,this.eventCollectionService=n,this.logService=r,this.domainSettingsService=s,this.userVerificationService=o,this.billingAccountProfileStateService=a,this.scriptInjectorService=l,this.accountService=c,this.authService=u,this.configService=d,this.userNotificationSettingsService=h,this.messageListener=p,this.openVaultItemPasswordRepromptPopout=LZ,this.currentlyOpeningPasswordRepromptPopout=!1,this.autofillScriptPortsSet=new Set,this.handleInjectedScriptPortConnection=e=>{e.name===s8&&(this.autofillScriptPortsSet.add(e),e.onDisconnect.addListener(this.handleInjectScriptPortOnDisconnect))},this.handleInjectScriptPortOnDisconnect=e=>{e.name===s8&&this.autofillScriptPortsSet.delete(e)}}collectPageDetailsFromTab$(e){const t=new Ro.m(1),i=this.messageListener.messages$(n8).pipe((0,Eo.p)(t=>t.tab.id===e.id&&t.sender===i8),(0,Im.S)((e,t)=>[...e,{frameId:t.webExtSender.frameId,tab:t.tab,details:t.details}],[]));ul.tabSendMessage(e,{tab:e,command:t8,sender:i8},null,!0).catch(()=>{t.next([])});const n=["moz-extension://","chrome-extension://","safari-web-extension://"].some(t=>e.url.startsWith(t));e.url&&!n||t.next([]);const r=i.pipe((0,Fo.u)()),s=(0,xo.O)(1e3).pipe((0,l.T)(()=>[]),(0,vm.Q)(r));return(0,Po.h)(r,t,s)}loadAutofillScriptsOnInstall(){return m8(this,void 0,void 0,function*(){ul.addListener(chrome.runtime.onConnect,this.handleInjectedScriptPortConnection),this.injectAutofillScriptsInAllTabs(),this.autofillSettingsService.inlineMenuVisibility$.pipe((0,kd.Z)(void 0),(0,mm.J)()).subscribe(([e,t])=>this.handleInlineMenuVisibilitySettingsChange(e,t)),this.autofillSettingsService.showInlineMenuCards$.pipe((0,kd.Z)(void 0),(0,mm.J)()).subscribe(([e,t])=>this.handleInlineMenuVisibilitySettingsChange(e,t)),this.autofillSettingsService.showInlineMenuIdentities$.pipe((0,kd.Z)(void 0),(0,mm.J)()).subscribe(([e,t])=>this.handleInlineMenuVisibilitySettingsChange(e,t))})}reloadAutofillScripts(){return m8(this,void 0,void 0,function*(){this.autofillScriptPortsSet.forEach(e=>{e.disconnect(),this.autofillScriptPortsSet.delete(e)}),this.injectAutofillScriptsInAllTabs()})}injectAutofillScripts(e){return m8(this,arguments,void 0,function*(e,t=0,i=!0){const n=yield(0,bo._)(this.accountService.activeAccount$),r=(yield(0,bo._)(this.authService.activeAccountStatus$))===Pd.Unlocked;let s=!1;const o=[yield this.getBootstrapAutofillContentScript(n)];n&&r&&(s=yield this.getAutofillOnPageLoad()),i&&s&&o.push("autofiller.js"),i||(yield this.scriptInjectorService.inject({tabId:e.id,injectDetails:{file:"content/content-message-handler.js",runAt:"document_start"}})),o.push("contextMenuHandler.js");for(const i of o)yield this.scriptInjectorService.inject({tabId:e.id,injectDetails:{file:`content/${i}`,runAt:"document_start",frame:t}})})}getBootstrapAutofillContentScript(e){return m8(this,void 0,void 0,function*(){let t=wa;e&&(t=yield this.getInlineMenuVisibility());const i=yield(0,bo._)(this.userNotificationSettingsService.enableChangedPasswordPrompt$),n=yield(0,bo._)(this.userNotificationSettingsService.enableAddedLoginPrompt$),r=i||n;return t||r?!t&&r?"bootstrap-autofill-overlay-notifications.js":t&&!r?"bootstrap-autofill-overlay-menu.js":"bootstrap-autofill-overlay.js":"bootstrap-autofill.js"})}getFormsWithPasswordFields(e){const t=[],i=g8.loadPasswordFields(e,!0,!0,!1,!0);if(0===i.length)return t;const n=i.filter(e=>void 0===e.form),r=Object.keys(e.forms),s=r.length;if(3===i.length&&1==s&&n.length>0){const e=r[0];i.filter(t=>null!==t.form&&t.form===e).length>0&&n.forEach(t=>{t.form=e})}for(const n in e.forms){if(!e.forms.hasOwnProperty(n))continue;const r=i.filter(e=>n===e.form);if(r.length>0){let i=this.findUsernameField(e,r[0],!1,!1,!1);null==i&&(i=this.findUsernameField(e,r[0],!0,!0,!1)),t.push({form:e.forms[n],password:r[0],username:i,passwords:r})}}return t}getInlineMenuVisibility(){return m8(this,void 0,void 0,function*(){return yield(0,bo._)(this.autofillSettingsService.inlineMenuVisibility$)})}getShouldAutoCopyTotp(){return m8(this,void 0,void 0,function*(){return yield(0,bo._)(this.autofillSettingsService.autoCopyTotp$)})}getAutofillOnPageLoad(){return m8(this,void 0,void 0,function*(){return yield(0,bo._)(this.autofillSettingsService.autofillOnPageLoad$)})}getDefaultUriMatchStrategy(){return m8(this,void 0,void 0,function*(){return yield(0,bo._)(this.domainSettingsService.resolvedDefaultUriMatchStrategy$)})}doAutoFill(e){return m8(this,void 0,void 0,function*(){const t=e.tab;if(!(t&&e.cipher&&e.pageDetails&&e.pageDetails.length))throw new Error("Nothing to autofill.");let i=null;const n=yield(0,bo._)(this.accountService.activeAccount$),r=yield(0,bo._)(this.billingAccountProfileStateService.hasPremiumFromAnySource$(n.id)),s=yield this.getDefaultUriMatchStrategy();r||(e.cipher.login.totp=null);let o=!1;if(yield Promise.all(e.pageDetails.map(a=>m8(this,void 0,void 0,function*(){if(a.tab.id!==t.id||a.tab.url!==t.url)return;const l=e.focusedFieldForm?Object.assign(Object.assign({},a.details),{fields:a.details.fields.filter(t=>t.form===e.focusedFieldForm)}):a.details,c=yield this.generateFillScript(l,{skipUsernameOnlyFill:e.skipUsernameOnlyFill||!1,onlyEmptyFields:e.onlyEmptyFields||!1,fillNewPassword:e.fillNewPassword||!1,allowTotpAutofill:e.allowTotpAutofill||!1,autoSubmitLogin:e.autoSubmitLogin||!1,cipher:e.cipher,tabUrl:t.url,defaultUriMatch:s,focusedFieldOpid:e.focusedFieldOpid,inlineMenuFillType:e.inlineMenuFillType});if(!c||!c.script||!c.script.length)return;if(c.untrustedIframe&&null!=e.allowUntrustedIframe&&!e.allowUntrustedIframe)return void this.logService.info("Autofill on page load was blocked due to an untrusted iframe.");if(c.properties.delay_between_operations=20,o=!0,e.skipLastUsed||(yield this.cipherService.updateLastUsedDate(e.cipher.id,n.id)),ul.tabSendMessage(t,{command:e.autoSubmitLogin?"triggerAutoSubmitLogin":"fillForm",fillScript:c,url:t.url,pageDetailsUrl:a.details.url},{frameId:a.frameId}),e.cipher.type!==nx.Login||null!==i||!e.cipher.login.totp||!r&&!e.cipher.organizationUseTotp)return;const u=yield this.getShouldAutoCopyTotp();i=u?(yield(0,bo._)(this.totpService.getCode$(e.cipher.login.totp))).code:null}))),o)return yield this.eventCollectionService.collect(Ua.Cipher_ClientAutofilled,e.cipher.id),null!==i?i:null;throw new Error("Did not autofill.")})}doAutoFillOnTab(e,t,i){return m8(this,arguments,void 0,function*(e,t,i,n=!1){var r,s;let o;const a=yield(0,bo._)(this.accountService.activeAccount$.pipe(nv));if(null==a)return null;if(i)o=yield this.cipherService.getNextCipherForUrl(t.url,a);else{const e=yield this.cipherService.getLastLaunchedForUrl(t.url,a,!0);o=e&&Date.now().valueOf()-(null===(s=null===(r=e.localData)||void 0===r?void 0:r.lastLaunched)||void 0===s?void 0:s.valueOf())<3e4?e:yield this.cipherService.getLastUsedForUrl(t.url,a,!0)}if(null==o||o.reprompt===tx.Password&&!i)return null;if(yield this.isPasswordRepromptRequired(o,t))return i&&this.cipherService.updateLastUsedIndexForUrl(t.url),null;const l=yield this.doAutoFill({tab:t,cipher:o,pageDetails:e,skipLastUsed:!i,skipUsernameOnlyFill:!i,onlyEmptyFields:!i,fillNewPassword:i,allowUntrustedIframe:i,allowTotpAutofill:i,autoSubmitLogin:n});return i&&this.cipherService.updateLastUsedIndexForUrl(t.url),l})}isPasswordRepromptRequired(e,t,i){return m8(this,void 0,void 0,function*(){const n=yield this.userVerificationService.hasMasterPasswordAndMasterKeyHash();return!(e.reprompt!==tx.Password||!n)&&(this.isDebouncingPasswordRepromptPopout()||(yield this.openVaultItemPasswordRepromptPopout(t,{cipherId:e.id,action:null!=i?i:"autofill"})),!0)})}doAutoFillActiveTab(e,t,i){return m8(this,void 0,void 0,function*(){var n,r,s;if(!(null===(s=null===(r=null===(n=e[0])||void 0===n?void 0:n.details)||void 0===r?void 0:r.fields)||void 0===s?void 0:s.length))return null;const o=yield this.getActiveTab();if(!o||!o.url)return null;if(!i||i===nx.Login)return yield this.doAutoFillOnTab(e,o,t);let a,l="";const c=yield(0,bo._)(this.accountService.activeAccount$.pipe(nv));if(null==c)return null;if(i===nx.Card?(l="cardCiphers",a=yield this.cipherService.getNextCardCipher(c)):(l="identityCiphers",a=yield this.cipherService.getNextIdentityCipher(c)),!a||!l||a.reprompt===tx.Password&&!t)return null;if(yield this.isPasswordRepromptRequired(a,o))return t&&this.cipherService.updateLastUsedIndexForUrl(l),null;const u=yield this.doAutoFill({tab:o,cipher:a,pageDetails:e,skipLastUsed:!t,skipUsernameOnlyFill:!t,onlyEmptyFields:!t,fillNewPassword:!1,allowUntrustedIframe:t,allowTotpAutofill:!1});return t&&this.cipherService.updateLastUsedIndexForUrl(l),u})}setAutoFillOnPageLoadOrgPolicy(){return m8(this,void 0,void 0,function*(){(yield(0,bo._)(this.autofillSettingsService.activateAutofillOnPageLoadFromPolicy$))&&(yield this.autofillSettingsService.setAutofillOnPageLoad(!0))})}getActiveTab(){return m8(this,void 0,void 0,function*(){const e=yield ul.getTabFromCurrentWindow();if(!e)throw new Error("No tab found.");return e})}generateFillScript(e,t){return m8(this,void 0,void 0,function*(){if(!e||!t.cipher)return null;let i=new f8;const n={},r=t.cipher.fields;if(r&&r.length){const s=[];r.forEach(e=>{g8.hasValue(e.name)&&s.push(e.name.toLowerCase())}),e.fields.forEach(e=>{if(n.hasOwnProperty(e.opid))return;if(!e.viewable&&"span"!==e.tagName)return;if(g8.isSearchField(e))return;const o=this.findMatchingFieldIndex(e,s);if(o>-1){const s=r[o];let a;s.type===ox.Linked?a=t.cipher.linkedFieldValue(s.linkedId):(a=s.value,null==a&&s.type===ox.Boolean&&(a="false")),n[e.opid]=e,g8.fillByOpid(i,e,a)}})}switch(t.cipher.type){case nx.Login:i=yield this.generateLoginFillScript(i,e,n,t);break;case nx.Card:i=yield this.generateCardFillScript(i,e,n,t);break;case nx.Identity:i=yield this.generateIdentityFillScript(i,e,n,t);break;default:return null}return i})}generateLoginFillScript(e,t,i,n){return m8(this,void 0,void 0,function*(){var r,s;if(!n.cipher.login)return null;const o=[],a=new Map,l=[];let c=null,u=null,d=null;const h=n.cipher.login;e.savedUrls=null!==(s=null===(r=null==h?void 0:h.uris)||void 0===r?void 0:r.filter(e=>e.match!=GE.Never).map(e=>e.uri))&&void 0!==s?s:[],e.untrustedIframe=yield this.inUntrustedIframe(t.url,n);const p=g8.loadPasswordFields(t,!1,!1,n.onlyEmptyFields,n.fillNewPassword),v=[],f=[];p.forEach(e=>{this.isRegistrationPasswordField(t,e)?f.push(e):v.push(e)});const m=v.length>0?v:f,g=n.focusedFieldOpid&&t.fields.find(e=>e.opid===n.focusedFieldOpid),y=null==g?void 0:g.form,b=g&&n.allowTotpAutofill&&("text"===g.type||"number"===g.type||"tel"===g.type)&&(g8.fieldIsFuzzyMatch(g,[...l8.TotpFieldNames,...l8.AmbiguousTotpFieldNames])||"one-time-code"===g.autoCompleteType)&&!g8.fieldIsFuzzyMatch(g,[...l8.RecoveryCodeFieldNames]),w=g&&!b&&h.username&&("text"===g.type||"email"===g.type||"tel"===g.type)&&g,S=e=>{var i;return!g||(null!=y?e.form===y:w&&null==e.form&&(null===(i=this.findUsernameField(t,e,!1,!1,!0))||void 0===i?void 0:i.opid)===w.opid)},k=(e,i)=>w&&S(e)?w:this.findUsernameField(t,e,!1,!1,i);if(w&&!m.some(S)&&!Object.prototype.hasOwnProperty.call(i,w.opid))return i[w.opid]=w,g8.fillByOpid(e,w,h.username),n.autoSubmitLogin&&w.form&&(e.autosubmit=[w.form]),g8.setFillScriptForFocus({[w.opid]:w},e);for(const e in t.forms)t.forms.hasOwnProperty(e)&&m.forEach(e=>{g&&!S(e)||(c=e,o.push(c),h.username&&(u=k(c,!1),u&&a.set(u.opid,u)),n.allowTotpAutofill&&h.totp&&(d=b&&S(e)?g:this.findTotpField(t,c,!1,!1,!1),d&&l.push(d)))});if(p.length&&!o.length){const e=n.inlineMenuFillType===p8,i=n.inlineMenuFillType===v8;if((e||i)&&g){const e=g.form;[...v,...f].forEach(t=>{t.form===e&&o.push(t)})}if(!o.length){const e=g&&m.find(S)||m[0];e&&o.push(e)}const r=o[0];r&&(h.username&&r.elementNumber>0&&(u=k(r,!0),u&&a.set(u.opid,u)),n.allowTotpAutofill&&h.totp&&r.elementNumber>0&&(d=b&&S(r)?g:this.findTotpField(t,r,!1,!1,!0),d&&l.push(d)))}p.length||t.fields.forEach(e=>{if(!e.viewable)return;const t=n.allowTotpAutofill&&["number","tel","text"].some(t=>t===e.type)&&(g8.fieldIsFuzzyMatch(e,[...l8.TotpFieldNames,...l8.AmbiguousTotpFieldNames])||"one-time-code"===e.autoCompleteType)&&!g8.fieldIsFuzzyMatch(e,[...l8.RecoveryCodeFieldNames]),i=!n.skipUsernameOnlyFill&&["email","tel","text"].some(t=>t===e.type)&&g8.fieldIsFuzzyMatch(e,l8.UsernameFieldNames);switch(!0){case t:return void l.push(e);case i:return void a.set(e.opid,e);default:return}});const I=new Set;return(w?[w]:[...a.values()]).forEach(t=>{Object.prototype.hasOwnProperty.call(i,t.opid)||(i[t.opid]=t,g8.fillByOpid(e,t,h.username),I.add(t.form))}),o.forEach(t=>{i.hasOwnProperty(t.opid)||(i[t.opid]=t,g8.fillByOpid(e,t,h.password),I.add(t.form))}),n.autoSubmitLogin&&I.size&&(e.autosubmit=Array.from(I)),n.allowTotpAutofill&&(null==h?void 0:h.totp)&&(yield Promise.all(l.map((t,n)=>m8(this,void 0,void 0,function*(){if(Object.prototype.hasOwnProperty.call(i,t.opid))return;i[t.opid]=t;let r=(yield(0,bo._)(this.totpService.getCode$(h.totp))).code;r.length==l.length&&(r=r.charAt(n)),g8.fillByOpid(e,t,r)})))),e=g8.setFillScriptForFocus(i,e)})}generateCardFillScript(e,t,i,n){return m8(this,void 0,void 0,function*(){if(!n.cipher.card)return null;const r={};t.fields.forEach(e=>{if(!g8.isExcludedFieldType(e,l8.ExcludedAutofillTypes))for(let t=0;t<c8.CardAttributes.length;t++){const i=c8.CardAttributes[t];if(e.hasOwnProperty(i)&&e[i]&&e.viewable){if(!r.cardholderName&&g8.isFieldMatch(e[i],c8.CardHolderFieldNames,c8.CardHolderFieldNameValues)){r.cardholderName=e;break}if(!r.number&&g8.isFieldMatch(e[i],c8.CardNumberFieldNames,c8.CardNumberFieldNameValues)){r.number=e;break}if(!r.exp&&g8.isFieldMatch(e[i],c8.CardExpiryFieldNames,c8.CardExpiryFieldNameValues)){r.exp=e;break}if(!r.expMonth&&g8.isFieldMatch(e[i],c8.ExpiryMonthFieldNames)){r.expMonth=e;break}if(!r.expYear&&g8.isFieldMatch(e[i],c8.ExpiryYearFieldNames)){r.expYear=e;break}if(!r.code&&g8.isFieldMatch(e[i],c8.CVVFieldNames)){r.code=e;break}if(!r.brand&&g8.isFieldMatch(e[i],c8.CardBrandFieldNames)){r.brand=e;break}}}});const s=n.cipher.card;if(this.makeScriptAction(e,s,r,i,"cardholderName"),this.makeScriptAction(e,s,r,i,"number"),this.makeScriptAction(e,s,r,i,"code"),this.makeScriptAction(e,s,r,i,"brand"),r.expMonth&&g8.hasValue(s.expMonth)){let t=s.expMonth;if(r.expMonth.selectInfo&&r.expMonth.selectInfo.options){let e=null;const i=r.expMonth.selectInfo.options;if(12===i.length?e=parseInt(s.expMonth,null)-1:13===i.length&&(e=null==i[0][0]||""===i[0][0]||null!=i[12][0]&&""!==i[12][0]?parseInt(s.expMonth,null):parseInt(s.expMonth,null)-1),null!=e){const n=i[e];n.length>1&&(t=n[1])}}else!this.fieldAttrsContain(r.expMonth,"mm")&&2!==r.expMonth.maxLength||1!==t.length||(t="0"+t);i[r.expMonth.opid]=r.expMonth,g8.fillByOpid(e,r.expMonth,t)}if(r.expYear&&g8.hasValue(s.expYear)){let t=s.expYear;if(r.expYear.selectInfo&&r.expYear.selectInfo.options)for(let e=0;e<r.expYear.selectInfo.options.length;e++){const i=r.expYear.selectInfo.options[e];if(i[0]===s.expYear||i[1]===s.expYear){t=i[1];break}if(2===i[1].length&&4===s.expYear.length&&i[1]===s.expYear.substring(2)){t=i[1];break}const n=i[1].indexOf(":");if(n>-1&&i[1].length>n+1){const e=i[1].substring(n+2);if(null!=e&&""!==e.trim()&&e===s.expYear){t=i[1];break}}}else this.fieldAttrsContain(r.expYear,"yyyy")||4===r.expYear.maxLength?2===t.length&&(t=W$(t)):(this.fieldAttrsContain(r.expYear,"yy")||2===r.expYear.maxLength)&&4===t.length&&(t=t.substr(2));i[r.expYear.opid]=r.expYear,g8.fillByOpid(e,r.expYear,t)}if(r.exp&&g8.hasValue(s.expMonth)&&g8.hasValue(s.expYear)){const t=this.generateCombinedExpiryValue(s,r.exp);this.makeScriptActionWithValue(e,t,r.exp,i)}return e})}inUntrustedIframe(e,t){return m8(this,void 0,void 0,function*(){if(e===t.tabUrl)return!1;const i=yield(0,bo._)(this.domainSettingsService.getUrlEquivalentDomains(e));return!t.cipher.login.matchesUri(e,i,t.defaultUriMatch)})}fieldAttrsContain(e,t){if(!e)return!1;let i=!1;return c8.CardAttributesExtended.forEach(n=>{if(i||!e[n])return;let r=e[n];r=r.replace(/ /g,"").toLowerCase(),i=r.indexOf(t)>-1}),i}generateCombinedExpiryValue(e,t){var i;let n=!0,r=!1,s="/",o=!1;const a=`${(new Date).getFullYear()}`.slice(0,2),[l,c]=this.getExpectedExpiryDateFormat(t);if(l){const{Month:e,MonthShort:t,Year:a}=c,u="\\"+la.join("\\");if(s=(null===(i=l.match(new RegExp(`[${u}]`,"g")))||void 0===i?void 0:i[0])||"",0===l.indexOf(e+s))n=!0,o=!1;else if(0===l.indexOf(t+s))n=!1,o=!1;else{o=!0;n=new RegExp(`${e}`,"i").test(l)}r=new RegExp(`${a}`,"i").test(l)}const u=n?("0"+e.expMonth).slice(-2):e.expMonth.replaceAll("0",""),d=(a+e.expYear).slice(r?-4:-2);return(o?[d,u]:[u,d]).join(s)}getExpectedExpiryDateFormat(e){let t=null,i=null;const n="\\"+la.join("\\");return c8.CardExpiryDateFormats.find(r=>{i=r;const{Month:s,MonthShort:o,YearShort:a,Year:l}=r,c=new RegExp(`((${s}|${o})[${n}]{0,1}(${l}|${a}))|((${l}|${a})[${n}]{0,1}(${s}|${o}))`,"gi");return c8.CardAttributesExtended.find(i=>{var r;const s=null===(r=e[i])||void 0===r?void 0:r.toLocaleLowerCase(),o=null==s?void 0:s.match(c);if(null==o?void 0:o.length){t=o[0];const e=new RegExp(`[^\\w${n}]|[\\d]`,"gi");return t.replaceAll(e,""),!0}return!1})}),[t,i]}generateIdentityFillScript(e,t,i,n){const r=n.cipher.identity;if(!r)return null;for(let n=0;n<t.fields.length;n++){const s=t.fields[n];if(this.excludeFieldFromIdentityFill(s))continue;const o=this.getIdentityAutofillFieldKeywords(s),a=o.join(",");this.shouldMakeIdentityTitleFillScript(i,a)?this.makeScriptActionWithValue(e,r.title,s,i):this.shouldMakeIdentityNameFillScript(i,o)?this.makeIdentityNameFillScript(e,i,s,r):this.shouldMakeIdentityFirstNameFillScript(i,a)?this.makeScriptActionWithValue(e,r.firstName,s,i):this.shouldMakeIdentityMiddleNameFillScript(i,a)?this.makeScriptActionWithValue(e,r.middleName,s,i):this.shouldMakeIdentityLastNameFillScript(i,a)?this.makeScriptActionWithValue(e,r.lastName,s,i):this.shouldMakeIdentityEmailFillScript(i,a)?this.makeScriptActionWithValue(e,r.email,s,i):this.shouldMakeIdentityAddress1FillScript(i,a)?this.makeScriptActionWithValue(e,r.address1,s,i):this.shouldMakeIdentityAddress2FillScript(i,a)?this.makeScriptActionWithValue(e,r.address2,s,i):this.shouldMakeIdentityAddress3FillScript(i,a)?this.makeScriptActionWithValue(e,r.address3,s,i):this.shouldMakeIdentityAddressFillScript(i,o)?this.makeIdentityAddressFillScript(e,i,s,r):this.shouldMakeIdentityPostalCodeFillScript(i,a)?this.makeScriptActionWithValue(e,r.postalCode,s,i):this.shouldMakeIdentityCityFillScript(i,a)?this.makeScriptActionWithValue(e,r.city,s,i):this.shouldMakeIdentityStateFillScript(i,a)?this.makeIdentityStateFillScript(e,i,s,r):this.shouldMakeIdentityCountryFillScript(i,a)?this.makeIdentityCountryFillScript(e,i,s,r):this.shouldMakeIdentityPhoneFillScript(i,a)?this.makeScriptActionWithValue(e,r.phone,s,i):this.shouldMakeIdentityUserNameFillScript(i,a)?this.makeScriptActionWithValue(e,r.username,s,i):this.shouldMakeIdentityCompanyFillScript(i,a)&&this.makeScriptActionWithValue(e,r.company,s,i)}return e}excludeFieldFromIdentityFill(e){return g8.isExcludedFieldType(e,["password",...l8.ExcludedAutofillTypes])||l8.ExcludedIdentityAutocompleteTypes.has(e.autoCompleteType)||!e.viewable}getIdentityAutofillFieldKeywords(e){const t=new Set;for(let i=0;i<u8.IdentityAttributes.length;i++){const n=u8.IdentityAttributes[i];e[n]&&t.add(e[n].trim().toLowerCase().replace(/[^a-zA-Z0-9]+/g,""))}return Array.from(t)}shouldMakeIdentityTitleFillScript(e,t){return!e.title&&g8.isFieldMatch(t,u8.TitleFieldNames)}shouldMakeIdentityNameFillScript(e,t){return!e.name&&t.some(e=>g8.isFieldMatch(e,u8.FullNameFieldNames,u8.FullNameFieldNameValues))}shouldMakeIdentityFirstNameFillScript(e,t){return!e.firstName&&g8.isFieldMatch(t,u8.FirstnameFieldNames)}shouldMakeIdentityMiddleNameFillScript(e,t){return!e.middleName&&g8.isFieldMatch(t,u8.MiddlenameFieldNames)}shouldMakeIdentityLastNameFillScript(e,t){return!e.lastName&&g8.isFieldMatch(t,u8.LastnameFieldNames)}shouldMakeIdentityEmailFillScript(e,t){return!e.email&&g8.isFieldMatch(t,u8.EmailFieldNames)}shouldMakeIdentityAddressFillScript(e,t){return!e.address&&t.some(e=>g8.isFieldMatch(e,u8.AddressFieldNames,u8.AddressFieldNameValues))}shouldMakeIdentityAddress1FillScript(e,t){return!e.address1&&g8.isFieldMatch(t,u8.Address1FieldNames)}shouldMakeIdentityAddress2FillScript(e,t){return!e.address2&&g8.isFieldMatch(t,u8.Address2FieldNames)}shouldMakeIdentityAddress3FillScript(e,t){return!e.address3&&g8.isFieldMatch(t,u8.Address3FieldNames)}shouldMakeIdentityPostalCodeFillScript(e,t){return!e.postalCode&&g8.isFieldMatch(t,u8.PostalCodeFieldNames)}shouldMakeIdentityCityFillScript(e,t){return!e.city&&g8.isFieldMatch(t,u8.CityFieldNames)}shouldMakeIdentityStateFillScript(e,t){return!e.state&&g8.isFieldMatch(t,u8.StateFieldNames)}shouldMakeIdentityCountryFillScript(e,t){return!e.country&&g8.isFieldMatch(t,u8.CountryFieldNames)}shouldMakeIdentityPhoneFillScript(e,t){return!e.phone&&g8.isFieldMatch(t,u8.PhoneFieldNames)}shouldMakeIdentityUserNameFillScript(e,t){return!e.username&&g8.isFieldMatch(t,u8.UserNameFieldNames)}shouldMakeIdentityCompanyFillScript(e,t){return!e.company&&g8.isFieldMatch(t,u8.CompanyFieldNames)}makeIdentityNameFillScript(e,t,i,n){let r="";n.firstName&&(r+=n.firstName),n.middleName&&(r+=r?` ${n.middleName}`:n.middleName),n.lastName&&(r+=r?` ${n.lastName}`:n.lastName),this.makeScriptActionWithValue(e,r,i,t)}makeIdentityAddressFillScript(e,t,i,n){if(!n.address1)return;let r=n.address1;n.address2&&(r+=`, ${n.address2}`),n.address3&&(r+=`, ${n.address3}`),this.makeScriptActionWithValue(e,r,i,t)}makeIdentityStateFillScript(e,t,i,n){if(!n.state)return;if(n.state.length<=2)return void this.makeScriptActionWithValue(e,n.state,i,t);const r=n.state.toLowerCase(),s=u8.IsoStates[r]||u8.IsoProvinces[r];s&&this.makeScriptActionWithValue(e,s,i,t)}makeIdentityCountryFillScript(e,t,i,n){if(!n.country)return;if(n.country.length<=2)return void this.makeScriptActionWithValue(e,n.country,i,t);const r=n.country.toLowerCase(),s=u8.IsoCountries[r];s&&this.makeScriptActionWithValue(e,s,i,t)}static isExcludedType(e,t){return t.indexOf(e)>-1}static isSearchField(e){const t=[e.type,e.htmlName,e.htmlID,e.placeholder];for(let e=0;e<t.length;e++){if(!t[e])continue;const i=t[e].replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z]/gi);for(let e=0;e<i.length;e++)if(g8.searchFieldNamesSet.has(i[e]))return!0}return!1}static isExcludedFieldType(e,t){return!!g8.forCustomFieldsOnly(e)||(!!this.isExcludedType(e.type,t)||this.isSearchField(e))}static isFieldMatch(e,t,i){e=e.trim().toLowerCase().replace(/[^a-zA-Z0-9]+/g,"");for(let n=0;n<t.length;n++){let r=t[n];const s=null==i||i.indexOf(r)>-1;if(r=r.toLowerCase().replace(/-/g,""),e===r||s&&e.indexOf(r)>-1)return!0}return!1}makeScriptAction(e,t,i,n,r,s){s=s||r,this.makeScriptActionWithValue(e,t[r],i[s],n)}makeScriptActionWithValue(e,t,i,n){let r=!1;if(g8.hasValue(t)&&i)if("select-one"===i.type&&i.selectInfo&&i.selectInfo.options)for(let e=0;e<i.selectInfo.options.length;e++){const n=i.selectInfo.options[e];for(let e=0;e<n.length;e++)if(g8.hasValue(n[e])&&n[e].toLowerCase()===t.toLowerCase()){r=!0,n.length>1&&(t=n[1]);break}if(r)break}else r=!0;r&&(n[i.opid]=i,g8.fillByOpid(e,i,t))}static valueIsLikePassword(e){if(null==e)return!1;const t=e.toLowerCase().replace(/[\s_-]/g,"");return!(t.indexOf("password")<0)&&!l8.PasswordFieldExcludeList.some(e=>t.indexOf(e)>-1)}static fieldHasDisqualifyingAttributeValue(e){const t=[e.htmlID,e.htmlName,e.placeholder];let i=!1;for(let e=0;e<t.length;e++){const n=t[e],r=null==n?void 0:n.toLowerCase().replace(/[\s_-]/g,"");if(i=Boolean(r&&l8.FieldIgnoreList.some(e=>r.indexOf(e)>-1)),i)break}return i}static loadPasswordFields(e,t,i,n,r){const s=[];return e.fields.forEach(e=>{const o="password"===e.type;if(!o&&g8.isExcludedFieldType(e,l8.ExcludedAutofillLoginTypes))return;if(g8.fieldHasDisqualifyingAttributeValue(e))return;if(g8.fieldIsFuzzyMatch(e,l8.TotpFieldNames))return;e.disabled||!i&&e.readonly||!o&&!(()=>{if("text"!==e.type)return!1;const t=[e.htmlID,e.htmlName,e.placeholder];for(let e=0;e<t.length;e++)if(g8.valueIsLikePassword(t[e]))return!0;return!1})()||!t&&!e.viewable||n&&null!=e.value&&""!==e.value.trim()||!r&&"new-password"===e.autoCompleteType||s.push(e)}),s}isRegistrationPasswordField(e,t){var i,n,r,s,o,a,l,c;if(!t.form||!e.forms)return!1;const u=e.forms[t.form];if(!u)return!1;return[null===(n=null===(i=u.htmlID)||void 0===i?void 0:i.toLowerCase)||void 0===n?void 0:n.call(i),null===(s=null===(r=u.htmlName)||void 0===r?void 0:r.toLowerCase)||void 0===s?void 0:s.call(r),null===(a=null===(o=null==t?void 0:t.htmlID)||void 0===o?void 0:o.toLowerCase)||void 0===a?void 0:a.call(o),null===(c=null===(l=null==t?void 0:t.htmlName)||void 0===l?void 0:l.toLowerCase)||void 0===c?void 0:c.call(l)].filter(Boolean).some(e=>l8.RegistrationKeywords.some(t=>e.includes(t)))}findUsernameField(e,t,i,n,r){let s=null,o=null;for(let a=0;a<e.fields.length;a++){const l=e.fields[a];if(g8.forCustomFieldsOnly(l))continue;if(l.elementNumber>=t.elementNumber)break;const c=this.findMatchingFieldIndex(l,l8.UsernameFieldNames)>-1,u=null!=l.form&&null!=t.form&&l.form===t.form,d=u&&("email"===l.type||"tel"===l.type);if(!l.disabled&&(n||!l.readonly)&&(r||u||c)&&(i||l.viewable||d)&&("text"===l.type||"email"===l.type||"tel"===l.type))if(u){if(o=l,c)return l}else s=l}return o||s}findTotpField(e,t,i,n,r){let s=null;for(let o=0;o<e.fields.length;o++){const a=e.fields[o];if(g8.forCustomFieldsOnly(a))continue;if(!g8.fieldHasDisqualifyingAttributeValue(a)&&!a.disabled&&(n||!a.readonly)&&(r||a.form===t.form)&&(i||a.viewable)&&("text"===a.type||"number"===a.type||"tel"===a.type)&&g8.fieldIsFuzzyMatch(a,[...l8.TotpFieldNames,...l8.AmbiguousTotpFieldNames])&&!g8.fieldIsFuzzyMatch(a,[...l8.RecoveryCodeFieldNames])&&(s=a,this.findMatchingFieldIndex(a,[...l8.TotpFieldNames,...l8.AmbiguousTotpFieldNames])>-1||"one-time-code"===a.autoCompleteType))break}return s}findMatchingFieldIndex(e,t){for(let i=0;i<t.length;i++){if(t[i].indexOf("=")>-1){if(this.fieldPropertyIsPrefixMatch(e,"htmlID",t[i],"id"))return i;if(this.fieldPropertyIsPrefixMatch(e,"htmlName",t[i],"name"))return i;if(this.fieldPropertyIsPrefixMatch(e,"label-left",t[i],"label"))return i;if(this.fieldPropertyIsPrefixMatch(e,"label-right",t[i],"label"))return i;if(this.fieldPropertyIsPrefixMatch(e,"label-tag",t[i],"label"))return i;if(this.fieldPropertyIsPrefixMatch(e,"label-aria",t[i],"label"))return i;if(this.fieldPropertyIsPrefixMatch(e,"placeholder",t[i],"placeholder"))return i}if(this.fieldPropertyIsMatch(e,"htmlID",t[i]))return i;if(this.fieldPropertyIsMatch(e,"htmlName",t[i]))return i;if(this.fieldPropertyIsMatch(e,"label-left",t[i]))return i;if(this.fieldPropertyIsMatch(e,"label-right",t[i]))return i;if(this.fieldPropertyIsMatch(e,"label-tag",t[i]))return i;if(this.fieldPropertyIsMatch(e,"label-aria",t[i]))return i;if(this.fieldPropertyIsMatch(e,"placeholder",t[i]))return i}return-1}fieldPropertyIsPrefixMatch(e,t,i,n,r="="){if(0===i.indexOf(n+r)){const n=i.indexOf(r),s=i.substring(n+1);return null!=s&&this.fieldPropertyIsMatch(e,t,s)}return!1}fieldPropertyIsMatch(e,t,i){let n=e[t];if(!g8.hasValue(n))return!1;if(n=n.trim().replace(/(?:\r\n|\r|\n)/g,""),i.startsWith("regex="))try{const e=i.split("=",2);if(2===e.length){return new RegExp(e[1],"i").test(n)}}catch(e){this.logService.error(e)}else if(i.startsWith("csv=")){const e=i.split("=",2);if(2===e.length){const t=e[1].split(",");for(let e=0;e<t.length;e++){const i=t[e];if(null!=i&&i.trim().toLowerCase()===n.toLowerCase())return!0}return!1}}return n.toLowerCase()===i}static fieldIsFuzzyMatch(e,t,i=!1){const n=["htmlID","htmlName","label-tag","placeholder","label-left","label-right","label-top","label-aria","dataSetValues"];for(const r of n){const n=e[r];if(g8.hasValue(n)&&g8.fuzzyMatch(t,n))return!i||[!0,{attr:r,value:n}]}return!!i&&[!1]}static fuzzyMatch(e,t){if(null==e||0===e.length||null==t||"string"!=typeof t||t.length<1)return!1;t=t.replace(/(?:\r\n|\r|\n)/g,"").trim().toLowerCase();for(let i=0;i<e.length;i++)if(t.indexOf(e[i])>-1)return!0;return!1}static hasValue(e){return Boolean(e&&""!==e)}static setFillScriptForFocus(e,t){let i=null,n=null;for(const t in e)e.hasOwnProperty(t)&&e[t].viewable&&(i=e[t],"password"===e[t].type&&(n=e[t]));return n?t.script.push(["focus_by_opid",n.opid]):i&&t.script.push(["focus_by_opid",i.opid]),t}static fillByOpid(e,t,i){t.maxLength&&i&&i.length>t.maxLength&&(i=i.substr(0,i.length)),"span"!==t.tagName&&(e.script.push(["click_on_opid",t.opid]),e.script.push(["focus_by_opid",t.opid])),e.script.push(["fill_by_opid",t.opid,i])}static forCustomFieldsOnly(e){return"span"===e.tagName}isDebouncingPasswordRepromptPopout(){return!!this.currentlyOpeningPasswordRepromptPopout||(this.currentlyOpeningPasswordRepromptPopout=!0,clearTimeout(this.openPasswordRepromptPopoutDebounce),this.openPasswordRepromptPopoutDebounce=setTimeout(()=>{this.currentlyOpeningPasswordRepromptPopout=!1},100),!1)}injectAutofillScriptsInAllTabs(){return m8(this,void 0,void 0,function*(){var e;const t=yield ul.tabsQuery({});for(let i=0;i<t.length;i++){const n=t[i];if((null==n?void 0:n.id)&&(null===(e=n.url)||void 0===e?void 0:e.startsWith("http"))){const e=yield ul.getAllFrameDetails(n.id);e&&e.forEach(e=>this.injectAutofillScripts(n,e.frameId,!1))}}})}handleInlineMenuVisibilitySettingsChange(e,t){return m8(this,void 0,void 0,function*(){if(null==e||e===t)return;("boolean"==typeof e||"boolean"==typeof t||e===wa||t===wa)&&(yield this.reloadAutofillScripts())})}}g8.searchFieldNamesSet=new Set(l8.SearchFieldNames);var y8=g8;class b8{isExplicitIdentityEmailField(e){const t=[e.type,e.htmlName,e.htmlID,e.placeholder];for(let e=0;e<t.length;e++){const i=t[e];if(i)for(let e=0;e<t.length;e++)if(this.newEmailFieldKeywords.has(i))return!0}return!1}isNewsletterForm(e){if(!e)return!1;const t=[e.type,e.htmlName,e.htmlID,e.placeholder];for(let e=0;e<t.length;e++){const i=t[e];if(!i||"string"!=typeof i)continue;const n=i.toLowerCase();for(const e of this.newsletterFormKeywords)if(n.includes(e.toLowerCase()))return!0}return!1}constructor(){this.searchFieldNamesSet=new Set(l8.SearchFieldNames),this.excludedAutofillFieldTypesSet=new Set(l8.ExcludedAutofillLoginTypes),this.usernameFieldTypes=new Set(["text","email","number","tel"]),this.usernameAutocompleteValue="username",this.emailAutocompleteValue="email",this.webAuthnAutocompleteValue="webauthn",this.loginUsernameAutocompleteValues=new Set([this.usernameAutocompleteValue,this.emailAutocompleteValue,this.webAuthnAutocompleteValue]),this.fieldIgnoreListString=l8.FieldIgnoreList.join(","),this.currentPasswordAutocompleteValue="current-password",this.newPasswordAutoCompleteValue="new-password",this.autofillFieldKeywordsMap=new WeakMap,this.submitButtonKeywordsMap=new WeakMap,this.accountCreationFieldKeywords=["register","registration","create password","create a password","create an account","create account password","create user password","confirm password","confirm account password","confirm user password","new user","new email","new e-mail","new password","new-password","neuer benutzer","neues passwort","neue e-mail","pwdcheck"],this.newEmailFieldKeywords=new Set(l8.NewEmailFieldKeywords),this.newsletterFormKeywords=new Set(l8.NewsletterFormNames),this.updatePasswordFieldKeywords=["update password","change password","current password","kennwort ändern"],this.creditCardFieldKeywords=[...new Set([...c8.CardHolderFieldNames,...c8.CardNumberFieldNames,...c8.CardExpiryFieldNames,...c8.ExpiryMonthFieldNames,...c8.ExpiryYearFieldNames,...c8.CVVFieldNames,...c8.CardBrandFieldNames])],this.creditCardNameAutocompleteValues=new Set(["cc-name","cc-given-name,","cc-additional-name","cc-family-name"]),this.creditCardExpirationDateAutocompleteValue="cc-exp",this.creditCardExpirationMonthAutocompleteValue="cc-exp-month",this.creditCardExpirationYearAutocompleteValue="cc-exp-year",this.creditCardCvvAutocompleteValue="cc-csc",this.creditCardNumberAutocompleteValue="cc-number",this.creditCardTypeAutocompleteValue="cc-type",this.creditCardAutocompleteValues=new Set([...this.creditCardNameAutocompleteValues,this.creditCardExpirationDateAutocompleteValue,this.creditCardExpirationMonthAutocompleteValue,this.creditCardExpirationYearAutocompleteValue,this.creditCardNumberAutocompleteValue,this.creditCardCvvAutocompleteValue,this.creditCardTypeAutocompleteValue]),this.identityHonorificPrefixAutocompleteValue="honorific-prefix",this.identityFullNameAutocompleteValue="name",this.identityFirstNameAutocompleteValue="given-name",this.identityMiddleNameAutocompleteValue="additional-name",this.identityLastNameAutocompleteValue="family-name",this.identityNameAutocompleteValues=new Set([this.identityFullNameAutocompleteValue,this.identityHonorificPrefixAutocompleteValue,this.identityFirstNameAutocompleteValue,this.identityMiddleNameAutocompleteValue,this.identityLastNameAutocompleteValue,"honorific-suffix","nickname"]),this.identityCompanyAutocompleteValue="organization",this.identityStreetAddressAutocompleteValue="street-address",this.identityAddressLine1AutocompleteValue="address-line1",this.identityAddressLine2AutocompleteValue="address-line2",this.identityAddressLine3AutocompleteValue="address-line3",this.identityAddressCityAutocompleteValue="address-level2",this.identityAddressStateAutocompleteValue="address-level1",this.identityAddressAutoCompleteValues=new Set([this.identityStreetAddressAutocompleteValue,this.identityAddressLine1AutocompleteValue,this.identityAddressLine2AutocompleteValue,this.identityAddressLine3AutocompleteValue,this.identityAddressCityAutocompleteValue,this.identityAddressStateAutocompleteValue,"shipping","billing","address-level4","address-level3"]),this.identityCountryAutocompleteValues=new Set(["country","country-name"]),this.identityPostalCodeAutocompleteValue="postal-code",this.identityPhoneAutocompleteValue="tel",this.identityPhoneNumberAutocompleteValues=new Set([this.identityPhoneAutocompleteValue,"tel-country-code","tel-area-code","tel-local","tel-extension"]),this.identityAutocompleteValues=new Set([...this.identityNameAutocompleteValues,...this.loginUsernameAutocompleteValues,...this.identityCompanyAutocompleteValue,...this.identityAddressAutoCompleteValues,...this.identityCountryAutocompleteValues,...this.identityPhoneNumberAutocompleteValues,this.identityCompanyAutocompleteValue,this.identityPostalCodeAutocompleteValue]),this.totpFieldAutocompleteValue="one-time-code",this.premiumEnabled=!1,this.isFieldForCardholderName=e=>!!this.fieldContainsAutocompleteValues(e,this.creditCardNameAutocompleteValues)||this.keywordsFoundInFieldData(e,c8.CardHolderFieldNames,!1),this.isFieldForCardNumber=e=>!!this.fieldContainsAutocompleteValues(e,this.creditCardNumberAutocompleteValue)||this.keywordsFoundInFieldData(e,c8.CardNumberFieldNames,!1),this.isFieldForCardExpirationDate=e=>!!this.fieldContainsAutocompleteValues(e,this.creditCardExpirationDateAutocompleteValue)||this.keywordsFoundInFieldData(e,c8.CardExpiryFieldNames,!1),this.isFieldForCardExpirationMonth=e=>!!this.fieldContainsAutocompleteValues(e,this.creditCardExpirationMonthAutocompleteValue)||this.keywordsFoundInFieldData(e,c8.ExpiryMonthFieldNames,!1),this.isFieldForCardExpirationYear=e=>!!this.fieldContainsAutocompleteValues(e,this.creditCardExpirationYearAutocompleteValue)||this.keywordsFoundInFieldData(e,c8.ExpiryYearFieldNames,!1),this.isFieldForCardCvv=e=>!!this.fieldContainsAutocompleteValues(e,this.creditCardCvvAutocompleteValue)||this.keywordsFoundInFieldData(e,c8.CVVFieldNames,!1),this.isFieldForIdentityTitle=e=>!!this.fieldContainsAutocompleteValues(e,this.identityHonorificPrefixAutocompleteValue)||this.keywordsFoundInFieldData(e,u8.TitleFieldNames,!1),this.isFieldForIdentityFirstName=e=>!!this.fieldContainsAutocompleteValues(e,this.identityFirstNameAutocompleteValue)||this.keywordsFoundInFieldData(e,u8.FirstnameFieldNames,!1),this.isFieldForIdentityMiddleName=e=>!!this.fieldContainsAutocompleteValues(e,this.identityMiddleNameAutocompleteValue)||this.keywordsFoundInFieldData(e,u8.MiddlenameFieldNames,!1),this.isFieldForIdentityLastName=e=>!!this.fieldContainsAutocompleteValues(e,this.identityLastNameAutocompleteValue)||this.keywordsFoundInFieldData(e,u8.LastnameFieldNames,!1),this.isFieldForIdentityFullName=e=>!!this.fieldContainsAutocompleteValues(e,this.identityFullNameAutocompleteValue)||this.keywordsFoundInFieldData(e,u8.FullNameFieldNames,!1),this.isFieldForIdentityAddress1=e=>!!this.fieldContainsAutocompleteValues(e,this.identityAddressLine1AutocompleteValue)||this.keywordsFoundInFieldData(e,[...u8.AddressFieldNames,...u8.Address1FieldNames],!1),this.isFieldForIdentityAddress2=e=>!!this.fieldContainsAutocompleteValues(e,this.identityAddressLine2AutocompleteValue)||this.keywordsFoundInFieldData(e,u8.Address2FieldNames,!1),this.isFieldForIdentityAddress3=e=>!!this.fieldContainsAutocompleteValues(e,this.identityAddressLine3AutocompleteValue)||this.keywordsFoundInFieldData(e,u8.Address3FieldNames,!1),this.isFieldForIdentityCity=e=>!!this.fieldContainsAutocompleteValues(e,this.identityAddressCityAutocompleteValue)||this.keywordsFoundInFieldData(e,u8.CityFieldNames,!1),this.isFieldForIdentityState=e=>!!this.fieldContainsAutocompleteValues(e,this.identityAddressStateAutocompleteValue)||this.keywordsFoundInFieldData(e,u8.StateFieldNames,!1),this.isFieldForIdentityPostalCode=e=>!!this.fieldContainsAutocompleteValues(e,this.identityPostalCodeAutocompleteValue)||this.keywordsFoundInFieldData(e,u8.PostalCodeFieldNames,!1),this.isFieldForIdentityCountry=e=>!!this.fieldContainsAutocompleteValues(e,this.identityCountryAutocompleteValues)||this.keywordsFoundInFieldData(e,u8.CountryFieldNames,!1),this.isFieldForIdentityCompany=e=>!!this.fieldContainsAutocompleteValues(e,this.identityCompanyAutocompleteValue)||this.keywordsFoundInFieldData(e,u8.CompanyFieldNames,!1),this.isFieldForIdentityPhone=e=>!!this.fieldContainsAutocompleteValues(e,this.identityPhoneAutocompleteValue)||this.keywordsFoundInFieldData(e,u8.PhoneFieldNames,!1),this.isFieldForIdentityEmail=e=>!!this.isExplicitIdentityEmailField(e)||(!(!this.fieldContainsAutocompleteValues(e,this.emailAutocompleteValue)&&"email"!==e.type&&"email"!==e.htmlName)||this.keywordsFoundInFieldData(e,u8.EmailFieldNames,!1)),this.isFieldForIdentityUsername=e=>!!this.fieldContainsAutocompleteValues(e,this.usernameAutocompleteValue)||this.keywordsFoundInFieldData(e,u8.UserNameFieldNames,!1),this.isUsernameField=e=>{const t=e.type;return!(!t||!this.usernameFieldTypes.has(t)||this.isExcludedFieldType(e,this.excludedAutofillFieldTypesSet)||this.fieldHasDisqualifyingAttributeValue(e)||this.isTotpField(e))&&this.keywordsFoundInFieldData(e,l8.UsernameFieldNames)},this.isEmailField=e=>"email"===e.type||!this.isExcludedFieldType(e,this.excludedAutofillFieldTypesSet)&&this.keywordsFoundInFieldData(e,l8.EmailFieldNames),this.isCurrentPasswordField=e=>!this.fieldContainsAutocompleteValues(e,this.newPasswordAutoCompleteValue)&&!this.keywordsFoundInFieldData(e,this.accountCreationFieldKeywords)&&this.isPasswordField(e),this.isUpdateCurrentPasswordField=e=>!this.fieldContainsAutocompleteValues(e,this.newPasswordAutoCompleteValue)&&(this.isPasswordField(e)&&this.keywordsFoundInFieldData(e,this.updatePasswordFieldKeywords)),this.isNewPasswordField=e=>!this.fieldContainsAutocompleteValues(e,this.currentPasswordAutocompleteValue)&&(this.isPasswordField(e)&&this.keywordsFoundInFieldData(e,this.accountCreationFieldKeywords)),this.isPasswordField=e=>{const t="password"===e.type;return!(!t&&this.isExcludedFieldType(e,this.excludedAutofillFieldTypesSet)||this.fieldHasDisqualifyingAttributeValue(e)||this.isTotpField(e))&&(t||this.isLikePasswordField(e))},this.isTotpField=e=>!y8.fieldIsFuzzyMatch(e,[...l8.RecoveryCodeFieldNames])&&(!!this.fieldContainsAutocompleteValues(e,this.totpFieldAutocompleteValue)||!this.isExcludedFieldType(e,this.excludedAutofillFieldTypesSet)&&this.keywordsFoundInFieldData(e,l8.TotpFieldNames)),this.isElementLoginSubmitButton=e=>{const t=this.getSubmitButtonKeywords(e);return d8.some(e=>t.indexOf(e)>-1)},this.isElementChangePasswordSubmitButton=e=>{const t=this.getSubmitButtonKeywords(e);return h8.some(e=>t.indexOf(e)>-1)},a8("getUserPremiumStatus").then(e=>{this.premiumEnabled=!!(null==e?void 0:e.result)})}isFieldForLoginForm(e,t){if(this.premiumEnabled){const t=this.isTotpField(e),i="password"===e.type;if(t&&!i)return!0}if(this.isCurrentPasswordField(e))return this.isPasswordFieldForLoginForm(e,t);return!!this.isUsernameField(e)&&this.isUsernameFieldForLoginForm(e,t)}isFieldForCreditCardForm(e,t){if(this.fieldContainsAutocompleteValues(e,this.creditCardAutocompleteValues))return!0;let i;const n=e.form;if(n&&(i=t.forms[n]),!i){if(1!==t.fields.filter(this.isFieldForCardNumber).length)return!1;return 1===t.fields.filter(this.isFieldForCardCvv).length&&this.keywordsFoundInFieldData(e,this.creditCardFieldKeywords)}const r=t.fields.filter(t=>t.form===e.form);if(1!==r.filter(this.isFieldForCardNumber).length)return!1;return 1===r.filter(this.isFieldForCardCvv).length&&this.keywordsFoundInFieldData(e,[...this.creditCardFieldKeywords])}isFieldForAccountCreationForm(e,t){if(this.isExcludedFieldType(e,this.excludedAutofillFieldTypesSet)||this.isTotpField(e))return!1;if(!this.isUsernameField(e)&&!this.isPasswordField(e))return!1;let i;const n=e.form;if(n&&(i=t.forms[n]),!i){return t.fields.filter(this.isNewPasswordField).length>=1||this.keywordsFoundInFieldData(e,this.accountCreationFieldKeywords)}return t.fields.filter(t=>t.form===e.form).filter(this.isNewPasswordField).length>=1||this.keywordsFoundInFieldData(e,this.accountCreationFieldKeywords)}isFieldForIdentityForm(e,t){return!this.isExcludedFieldType(e,this.excludedAutofillFieldTypesSet)&&(this.isFieldForIdentityEmail(e)||this.fieldContainsAutocompleteValues(e,this.identityAutocompleteValues))}isPasswordFieldForLoginForm(e,t){let i;const n=e.form;if(n&&(i=t.forms[n]),this.fieldContainsAutocompleteValues(e,this.currentPasswordAutocompleteValue))return i?0===t.fields.filter(this.isNewPasswordField).filter(t=>t.viewable&&t.form===e.form).length:0===t.fields.filter(this.isNewPasswordField).filter(e=>e.viewable).length;const r=t.fields.filter(this.isUsernameField),s=t.fields.filter(this.isCurrentPasswordField);if(1===r.length&&1===s.length)return!0;if(!i){if(s.length>1)return!1;return!(r.filter(e=>e.viewable).length>1)}if(s.filter(t=>t.form===e.form&&t.viewable).length>1)return!1;return r.filter(t=>t.form===e.form&&t.viewable).length,!0}isUsernameFieldForLoginForm(e,t){if(this.isExplicitIdentityEmailField(e))return!1;if(this.fieldContainsAutocompleteValues(e,this.loginUsernameAutocompleteValues)){const e=t.fields.filter(e=>e.viewable&&this.isNewPasswordField(e));return 0===e.length}if(this.keywordsFoundInFieldData(e,this.accountCreationFieldKeywords))return!1;let i;const n=e.form;n&&(i=t.forms[n]);const r=t.fields.filter(this.isCurrentPasswordField);if(this.isNewsletterForm(i))return!1;if(!i){const e=r.filter(e=>e.viewable);return 1===e.length||!(e.length>1)&&(r.length,!0)}if(0===r.length){const i=t.fields.filter(t=>t.form===e.form);return 1===i.length||1===i.filter(e=>e.viewable).length}const s=r.filter(t=>t.form===e.form&&t.viewable);return 1===s.length||!(s.length>1)&&(r.length,!0)}isLikePasswordField(e){if("text"!==e.type)return!1;const t=[e.htmlID,e.htmlName,e.placeholder];for(let e=0;e<t.length;e++){const i=t[e];if(i&&this.valueIsLikePassword(i))return!0}return!1}valueIsLikePassword(e){if(null==e)return!1;const t=e.toLowerCase().replace(/[\s_-]/g,"");return!(t.indexOf("password")<0)&&!l8.PasswordFieldExcludeList.some(e=>t.indexOf(e)>-1)}fieldHasDisqualifyingAttributeValue(e){const t=[e.htmlID,e.htmlName,e.placeholder];for(let e=0;e<t.length;e++){const i=t[e],n=null==i?void 0:i.toLowerCase().replace(/[\s_-]/g,"");if(n&&this.fieldIgnoreListString.indexOf(n)>-1)return!0}return!1}isExcludedFieldType(e,t){const i=e.type;return!(!i||!t.has(i))||this.isSearchField(e)}isSearchField(e){const t=[e.type,e.htmlName,e.htmlID,e.placeholder];for(let e=0;e<t.length;e++){const i=t[e];if(!i)continue;const n=i.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z]/gi);for(let e=0;e<n.length;e++)if(this.searchFieldNamesSet.has(n[e]))return!0}return!1}getSubmitButtonKeywords(e){if(!this.submitButtonKeywordsMap.has(e)){const t=function(e){const t=[e.textContent,e.getAttribute("type"),e.getAttribute("value"),e.getAttribute("aria-label"),e.getAttribute("aria-labelledby"),e.getAttribute("aria-describedby"),e.getAttribute("title"),e.getAttribute("id"),e.getAttribute("name"),e.getAttribute("class")],i=new Set;for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&n.toLowerCase().replace(/[-\s]/g,"").split(/[^\p{L}]+/gu).forEach(e=>{e&&i.add(e)})}return i}(e);this.submitButtonKeywordsMap.set(e,Array.from(t).join(","))}return this.submitButtonKeywordsMap.get(e)||""}keywordsFoundInFieldData(e,t,i=!0){const n=this.getAutofillFieldDataKeywords(e,i),r=t.map(e=>e.replace(/-/g,""));return"string"==typeof n?r.some(e=>n.indexOf(e)>-1):r.some(e=>n.has(e))}getAutofillFieldDataKeywords(e,t){if(!this.autofillFieldKeywordsMap.has(e)){const t=[e.htmlID,e.htmlName,e.htmlClass,e.type,e.title,e.placeholder,e.autoCompleteType,e.dataSetValues,e["label-data"],e["label-aria"],e["label-left"],e["label-right"],e["label-tag"],e["label-top"]],i=new Set;for(let e=0;e<t.length;e++){const n=t[e];if(n&&"string"==typeof n){let e=n.toLowerCase();i.add(e),e=e.replace(/-/g,""),e.split(/[^\p{L}\d]+/gu).forEach(e=>{e&&i.add(e)}),e.replace(/\s/g,"").split(/[^\p{L}\d]+/gu).forEach(e=>{e&&i.add(e)})}}const n=Array.from(i).join(",");this.autofillFieldKeywordsMap.set(e,{keywordsSet:i,stringValue:n})}const i=this.autofillFieldKeywordsMap.get(e);return i?t?i.stringValue:i.keywordsSet:""}fieldContainsAutocompleteValues(e,t){const i=e.autoCompleteType;if(!i||"string"!=typeof i)return!1;const n=i.split(" ");if("string"==typeof t)return n.indexOf(t)>-1;for(let e=0;e<n.length;e++)if(t.has(n[e]))return!0;return!1}}var w8=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class S8{dismissCurrentTabIsBlockedBanner(){return w8(this,void 0,void 0,function*(){var e;try{const t=yield(0,bo._)(this.currentAutofillTab$),i=(null==t?void 0:t.url.length)&&bd.getHostname(t.url);if(!i)return;const n=yield(0,bo._)(this.domainSettingsService.blockedInteractionsUris$);let r=!1;n&&(null===(e=null==t?void 0:t.url)||void 0===e?void 0:e.length)&&(r=Y$(t.url,n)),r&&this.domainSettingsService.setBlockedInteractionsUris(Object.assign(Object.assign({},n),{[i]:{bannerIsDismissed:!0}}))}catch(e){throw new Error("There was a problem dismissing the blocked interaction URL notification banner")}})}constructor(e,t,i,n,r,s,o,a,c,u,d,h){this.autofillService=e,this.domainSettingsService=t,this.i18nService=i,this.toastService=n,this.platformUtilService=r,this.passwordRepromptService=s,this.cipherService=o,this.messagingService=a,this.route=c,this.accountService=u,this.logService=d,this.inlineMenuFieldQualificationService=h,this._refreshCurrentTab$=new Co.B,this.senderTabId$=this.route.queryParams.pipe((0,l.T)(e=>(null==e?void 0:e.senderTabId)?parseInt(e.senderTabId,10):void 0)),this.currentAutofillTab$=(0,jo.z)([this.senderTabId$,this._refreshCurrentTab$.pipe((0,kd.Z)(null))]).pipe((0,go.n)(e=>w8(this,[e],void 0,function*([e]){return e?yield ul.getTab(e):pl.inPopout(window)?null:yield ul.getTabFromCurrentWindow()})),(0,Gp.t)({refCount:!1,bufferSize:1})),this.currentTabIsOnBlocklist$=(0,jo.z)([this.domainSettingsService.blockedInteractionsUris$,this.currentAutofillTab$]).pipe((0,l.T)(([e,t])=>!(!e||!t)&&Y$(null==t?void 0:t.url,e)),(0,Gp.t)({refCount:!1,bufferSize:1})),this.showCurrentTabIsBlockedBanner$=(0,jo.z)([this.domainSettingsService.blockedInteractionsUris$,this.currentAutofillTab$]).pipe((0,l.T)(([e,t])=>{var i,n;if(e&&(null===(i=null==t?void 0:t.url)||void 0===i?void 0:i.length)){const i=bd.getHostname(t.url);if(!i)return!1;return Y$(t.url,e)&&!(null===(n=e[i])||void 0===n?void 0:n.bannerIsDismissed)}return!1}),(0,Gp.t)({refCount:!1,bufferSize:1})),this.autofillAllowed$=this.currentAutofillTab$.pipe((0,l.T)(e=>!!e)),this._currentPageDetails$=this.currentAutofillTab$.pipe((0,go.n)(e=>e?this.domainSettingsService.blockedInteractionsUris$.pipe((0,go.n)(t=>{var i;if(t&&(null===(i=null==e?void 0:e.url)||void 0===i?void 0:i.length)){if(Y$(e.url,t))return(0,Go.of)([])}return this.autofillService.collectPageDetailsFromTab$(e)})):(0,Go.of)([])),(0,C1.B)(50),(0,Gp.t)({refCount:!1,bufferSize:1})),this.nonLoginCipherTypesOnPage$=this._currentPageDetails$.pipe((0,l.T)(e=>{let t=!1,i=!1;try{if(!e)throw Error("No page details were provided");for(const n of e)for(const e of n.details.fields)t||(t=this.inlineMenuFieldQualificationService.isFieldForCreditCardForm(e,n.details)),i||(i=this.inlineMenuFieldQualificationService.isFieldForIdentityForm(e,n.details))}catch(e){this.logService.warning(e.message)}return{[nx.Card]:t,[nx.Identity]:i}})),this._currentPageDetails$.subscribe()}_internalDoAutofill(e,t,i){return w8(this,arguments,void 0,function*(e,t,i,n=!1){if(!n&&e.reprompt!==tx.None&&!(yield this.passwordRepromptService.showPasswordPrompt()))return!1;if(null==t||0===i.length)return this.toastService.showToast({variant:"error",title:null,message:this.i18nService.t("autofillError")}),!1;try{const n=yield this.autofillService.doAutoFill({tab:t,cipher:e,pageDetails:i,doc:window.document,fillNewPassword:!0,allowTotpAutofill:!0});null!=n&&this.platformUtilService.copyToClipboard(n,{window:window})}catch(e){return this.toastService.showToast({variant:"error",title:null,message:this.i18nService.t("autofillError")}),!1}return yield this.handleAutofillSuggestionUsed({cipherId:e.id}),!0})}_closePopup(e,t){return w8(this,void 0,void 0,function*(){if(pl.inSingleActionPopout(window,VZ)&&t.id)return this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("autoFillSuccess")}),void setTimeout(()=>w8(this,void 0,void 0,function*(){yield ul.focusTab(t.id),yield GZ(`${VZ}_${e.id}`)}),1e3);pl.inPopup(window)&&(this.platformUtilService.isFirefox()||this.platformUtilService.isSafari()?ul.closePopup(window):setTimeout(()=>ul.closePopup(window),50))})}refreshCurrentTab(){this._refreshCurrentTab$.next(null)}doAutofill(e){return w8(this,arguments,void 0,function*(e,t=!0,i=!1){const n=yield(0,bo._)(this.currentAutofillTab$),r=yield(0,bo._)(this._currentPageDetails$),s=yield this._internalDoAutofill(e,n,r,i);return s&&t&&(yield this._closePopup(e,n)),s})}handleAutofillSuggestionUsed(e){return w8(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.accountService.activeAccount$.pipe(nv));t&&(yield this.cipherService.updateLastUsedDate(e.cipherId,t))})}doAutofillAndSave(e){return w8(this,arguments,void 0,function*(e,t=!0,i=!1){if(e.type!==nx.Login)return!1;const n=yield(0,bo._)(this._currentPageDetails$),r=yield(0,bo._)(this.currentAutofillTab$);if(!(yield this._internalDoAutofill(e,r,n,i)))return!1;return!!(yield this._saveNewUri(e,r))&&(t?yield this._closePopup(e,r):this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("autoFillSuccessAndSavedUri")}),!0)})}_saveNewUri(e,t){return w8(this,void 0,void 0,function*(){var i,n;if(null!==(i=(n=e.login).uris)&&void 0!==i||(n.uris=[]),e.login.uris.some(e=>e.uri===t.url))return!0;const r=new QE;r.uri=t.url,e.login.uris.push(r);try{const t=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)));return yield this.cipherService.updateWithServer(e,t),this.messagingService.send("editedCipher"),!0}catch(e){return this.toastService.showToast({variant:"error",title:null,message:this.i18nService.t("unexpectedError")}),!1}})}}S8.ɵfac=function(e){return new(e||S8)(a.KVO(r8),a.KVO(YE),a.KVO(Ul),a.KVO(qb),a.KVO(Hb),a.KVO(k$),a.KVO(_b),a.KVO(bk),a.KVO(Fd.nX),a.KVO(Zk),a.KVO(Za),a.KVO(b8))},S8.ɵprov=a.jDH({token:S8,factory:S8.ɵfac,providedIn:"root"});var k8=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const I8=new m(Pe,"filterVisibility",{deserializer:e=>e}),C8="MyVault",T8={organization:null,collection:null,folder:null,cipherType:null};class P8{serializeFilters(){var e,t,i;return{organizationId:null===(e=this.filterForm.value.organization)||void 0===e?void 0:e.id,collectionId:null===(t=this.filterForm.value.collection)||void 0===t?void 0:t.id,folderId:null===(i=this.filterForm.value.folder)||void 0===i?void 0:i.id,cipherType:this.filterForm.value.cipherType}}deserializeFilters(e){(0,jo.z)([this.organizations$,this.collections$,this.folders$]).pipe((0,_o.s)(1)).subscribe(([t,i,n])=>{var r,s;const o={organization:null,collection:null,folder:null,cipherType:null};if(e.organizationId)if(e.organizationId===C8)o.organization={id:C8};else{const i=t.find(t=>{var i;return(null===(i=t.value)||void 0===i?void 0:i.id)===e.organizationId});o.organization=(null==i?void 0:i.value)||null}if(e.collectionId){const t=null===(r=i.flatMap(e=>this.flattenOptions(e)).find(t=>{var i;return(null===(i=t.value)||void 0===i?void 0:i.id)===e.collectionId}))||void 0===r?void 0:r.value;o.collection=t||null}if(e.folderId){const t=null===(s=n.flatMap(e=>this.flattenOptions(e)).find(t=>{var i;return(null===(i=t.value)||void 0===i?void 0:i.id)===e.folderId}))||void 0===s?void 0:s.value;o.folder=t||null}e.cipherType&&(o.cipherType=e.cipherType),this.filterForm.patchValue(o)})}flattenOptions(e){var t;return[e,...(null===(t=e.children)||void 0===t?void 0:t.flatMap(e=>this.flattenOptions(e)))||[]]}constructor(e,t,i,n,r,s,o,a,c,u,d){this.folderService=e,this.cipherService=t,this.organizationService=i,this.i18nService=n,this.collectionService=r,this.formBuilder=s,this.policyService=o,this.stateProvider=a,this.accountService=c,this.viewCacheService=u,this.restrictedItemTypesService=d,this.filterForm=this.formBuilder.group(T8),this.filters$=this.filterForm.valueChanges.pipe((0,kd.Z)(this.filterForm.value),(0,Gp.t)({bufferSize:1,refCount:!0})),this.numberOfAppliedFilters$=this.filters$.pipe((0,l.T)(e=>Object.values(e).filter(e=>Boolean(e)).length),(0,Gp.t)({refCount:!0,bufferSize:1})),this.filterVisibilityState=this.stateProvider.getGlobal(I8),this.cipherViews=[],this.activeUserId$=this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id),(0,Eo.p)(e=>null!==e)),this.filterVisibilityState$=this.filterVisibilityState.state$,this.filterFunction$=this.filters$.pipe((0,l.T)(e=>t=>t.filter(t=>{var i,n;if(t$.isDeleted(t))return!1;if(null!==e.cipherType&&t$.getType(t)!==e.cipherType)return!1;if(e.collection&&!(null===(i=t.collectionIds)||void 0===i?void 0:i.includes(Yk(e.collection.id))))return!1;if(e.folder&&t.folderId!==e.folder.id)return!1;if((null===(n=e.organization)||void 0===n?void 0:n.id)===C8){if(null!=t.organizationId)return!1}else if(e.organization&&t.organizationId!==e.organization.id)return!1;return!0}))),this.cipherTypes$=this.restrictedItemTypesService.restricted$.pipe((0,l.T)(e=>dz.filter(t=>{const i=e.find(e=>e.cipherType===t.type);return!i||i.allowViewOrgIds.length>0}).map(e=>({value:e.type,label:this.i18nService.t(e.labelKey),icon:e.icon})))),this.organizations$=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>(0,jo.z)([this.organizationService.memberOrganizations$(e),this.policyService.policyAppliesToUser$(op.OrganizationDataOwnership,e)])),(0,l.T)(([e,t])=>[e.sort(bd.getSortFunction(this.i18nService,"name")),t]),(0,l.T)(([e,t])=>{if(!e.length)return[];if(1===e.length&&t)return[];const i=[];return t||i.push({value:{id:C8},label:this.i18nService.t("myVault"),icon:"bwi-user"}),[...i,...e.map(e=>{let t="bwi-business";return e.enabled?e.productTierType!==M$.Families&&e.productTierType!==M$.Free||(t="bwi-family"):t="bwi-exclamation-triangle tw-text-danger",{value:e,label:e.name,icon:t}})]}),(0,Gp.t)({refCount:!0,bufferSize:1})),this.folders$=this.activeUserId$.pipe((0,go.n)(e=>{const t=this.cipherService.cipherListViews$(e).pipe((0,l.T)(e=>(this.cipherViews=e?Object.values(e):[],this.cipherViews)));return(0,jo.z)([this.filters$.pipe((0,mo.F)((e,t)=>{var i,n;return(null===(i=e.organization)||void 0===i?void 0:i.id)===(null===(n=t.organization)||void 0===n?void 0:n.id)})),this.folderService.folderViews$(e),t]).pipe((0,l.T)(([e,t,i])=>{if(1===t.length&&!t[0].id)return[e,[],i];t.sort(bd.getSortFunction(this.i18nService,"name"));let n=t;const r=t.find(e=>!e.id);if(r){const e=Object.assign(Object.assign({},r),{name:this.i18nService.t("itemsWithNoFolder")});n=[...t.filter(e=>e.id),e]}return[e,n,i]}),(0,l.T)(([e,t,i])=>{var n,r;const s=null!==(r=null===(n=e.organization)||void 0===n?void 0:n.id)&&void 0!==r?r:null;if(null===s||s===C8)return t;const o=i.filter(e=>e.organizationId===s);return t.filter(e=>o.some(t=>t.folderId===e.id))}),(0,l.T)(e=>{const t=this.getAllFoldersNested(e);return new vY({fullList:e,nestedList:t})}),(0,l.T)(e=>e.nestedList.map(e=>this.convertToChipSelectOption(e,"bwi-folder"))))}),(0,Gp.t)({refCount:!0,bufferSize:1})),this.collections$=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>(0,jo.z)([this.filters$.pipe((0,mo.F)((e,t)=>{var i,n;return(null===(i=e.organization)||void 0===i?void 0:i.id)===(null===(n=t.organization)||void 0===n?void 0:n.id)})),this.collectionService.decryptedCollections$(e),this.organizationService.memberOrganizations$(e)])),(0,l.T)(([e,t,i])=>{var n,r;const s=null!==(r=null===(n=e.organization)||void 0===n?void 0:n.id)&&void 0!==r?r:null;return gY(s?t.filter(e=>e.organizationId===s):t,i,this.i18nService.collator)}),(0,l.T)(e=>new vY({fullList:e,nestedList:this.collectionService.getAllNested(e)})),(0,l.T)(e=>e.nestedList.map(e=>this.convertToChipSelectOption(e,e.node.type===yR?"bwi-user":"bwi-collection-shared"))),(0,Gp.t)({bufferSize:1,refCount:!0})),this.allFilters$=(0,jo.z)([this.organizations$,this.collections$,this.folders$]),this.filterForm.controls.organization.valueChanges.pipe((0,xl.pQ)()).subscribe(this.validateOrganizationChange.bind(this));const h=this.viewCacheService.signal({key:"vault-filters",initialValue:{},deserializer:e=>e,persistNavigation:!0});this.deserializeFilters(h()),this.filterForm.valueChanges.pipe((0,C1.B)(300),(0,l.T)(()=>this.serializeFilters()),(0,mo.F)((e,t)=>JSON.stringify(e)===JSON.stringify(t))).subscribe(e=>{h.set(e)})}resetFilterForm(){this.filterForm.reset(T8)}updateFilterVisibility(e){return k8(this,void 0,void 0,function*(){yield this.filterVisibilityState.update(()=>e)})}convertToChipSelectOption(e,t){return{value:e.node,label:e.node.name,icon:t,children:e.children?e.children.map(e=>this.convertToChipSelectOption(e,t)):void 0}}getAllFoldersNested(e){const t=[];return e.forEach(e=>{const i=new SU;i.id=e.id,i.revisionDate=e.revisionDate;const n=null!=e.name?e.name.replace(/^\/+|\/+$/g,"").split("/"):[];ER.nestedTraverse(t,0,n,i,void 0,"/")}),t}validateOrganizationChange(e){var t,i;if(!e)return;const n=this.filterForm.getRawValue();if(n.collection&&n.collection.organizationId!==e.id&&(null===(t=this.filterForm.get("collection"))||void 0===t||t.setValue(null)),n.folder&&n.folder.id&&e.id!==C8){const t=this.cipherViews.filter(t=>t.organizationId===e.id).some(e=>{var t;return e.folderId===(null===(t=null==n?void 0:n.folder)||void 0===t?void 0:t.id)});t||null===(i=this.filterForm.get("folder"))||void 0===i||i.setValue(null)}}}P8.ɵfac=function(e){return new(e||P8)(a.KVO(UM),a.KVO(_b),a.KVO(WF),a.KVO(Ul),a.KVO(uR),a.KVO(Il.ok),a.KVO(Jb),a.KVO(u),a.KVO(Zk),a.KVO(II),a.KVO(r$))},P8.ɵprov=a.jDH({token:P8,factory:P8.ɵfac,providedIn:"root"});class F8{constructor(e,t,i,n,r,s,o,c,u,d,h,p,v){this.cipherService=e,this.vaultSettingsService=t,this.vaultPopupListFiltersService=i,this.organizationService=n,this.searchService=r,this.collectionService=s,this.vaultPopupAutofillService=o,this.syncService=c,this.accountService=u,this.ngZone=d,this.restrictedItemTypesService=h,this.configService=p,this.cipherArchiveService=v,this.cachedSearchText=(0,a.WQX)(Z4).signal({key:"vault-search-text",initialValue:"",persistNavigation:!0}),this.searchText$=(0,xl.br)(this.cachedSearchText),this._ciphersLoading$=new Co.B,this.activeUserId$=this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id),(0,Eo.p)(e=>null!==e)),this.organizations$=this.activeUserId$.pipe((0,go.n)(e=>this.organizationService.organizations$(e))),this.decryptedCollections$=this.activeUserId$.pipe((0,go.n)(e=>this.collectionService.decryptedCollections$(e))),this._otherAutoFillTypes$=(0,jo.z)([this.vaultSettingsService.showCardsCurrentTab$,this.vaultSettingsService.showIdentitiesCurrentTab$,this.vaultPopupAutofillService.nonLoginCipherTypesOnPage$]).pipe((0,l.T)(([e,t,i])=>{const n=e||i[nx.Card],r=t||i[nx.Identity];return[...n?[nx.Card]:[],...r?[nx.Identity]:[]]})),this._allDecryptedCiphers$=this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id),(0,Eo.p)(e=>null!=e),(0,go.n)(e=>(0,Po.h)(this.cipherService.ciphers$(e),this.cipherService.localData$(e)).pipe(UZ(this.ngZone),(0,Oo.M)(()=>this._ciphersLoading$.next()),R8(this.syncService),(0,go.n)(()=>(0,jo.z)([this.cipherService.cipherListViews$(e).pipe((0,Eo.p)(e=>null!=e)),this.cipherService.failedToDecryptCiphers$(e).pipe((0,kd.Z)([])),this.restrictedItemTypesService.restricted$])),(0,l.T)(([e,t,i])=>[...t||[],...e].filter(e=>!this.restrictedItemTypesService.isCipherRestricted(e,i))))),(0,Gp.t)({refCount:!0,bufferSize:1})),this._activeCipherList$=this._allDecryptedCiphers$.pipe((0,go.n)(e=>(0,jo.z)([this.organizations$,this.decryptedCollections$,this.cipherArchiveService.hasArchiveFlagEnabled$]).pipe((0,l.T)(([t,i,n])=>{const r=Object.fromEntries(t.map(e=>[e.id,e])),s=Object.fromEntries(i.map(e=>[e.id,e]));return e.filter(e=>!(t$.isDeleted(e)||n&&t$.isArchived(e))).map(e=>{var t;return e.collections=null===(t=e.collectionIds)||void 0===t?void 0:t.map(e=>s[e]),e.organization=r[e.organizationId],e})})))),this._hasSearchText=(0,jo.z)([this.searchText$,iv(this.accountService.activeAccount$)]).pipe((0,go.n)(([e,t])=>this.searchService.isSearchable(t,e))),this._filteredCipherList$=(0,jo.z)([this._activeCipherList$,this.searchText$,this.vaultPopupListFiltersService.filterFunction$,iv(this.accountService.activeAccount$)]).pipe((0,l.T)(([e,t,i,n])=>[i(e),t,n]),(0,go.n)(([e,t,i])=>this.searchService.searchCiphers(i,t,void 0,e)),(0,Gp.t)({refCount:!0,bufferSize:1})),this.filteredCiphers$=this._filteredCipherList$.pipe((0,Gp.t)({refCount:!1,bufferSize:1})),this.autoFillCiphers$=(0,jo.z)([this._filteredCipherList$,this._otherAutoFillTypes$,this.vaultPopupAutofillService.currentAutofillTab$]).pipe((0,go.n)(([e,t,i])=>i&&i.url?this.cipherService.filterCiphersForUrl(e,i.url,t):(0,Go.of)([])),(0,l.T)(e=>e.sort(this.sortCiphersForAutofill.bind(this))),(0,Gp.t)({refCount:!1,bufferSize:1})),this.favoriteCiphers$=this.autoFillCiphers$.pipe((0,km.E)(this._filteredCipherList$),(0,l.T)(([e,t])=>t.filter(t=>t.favorite&&!e.includes(t))),(0,Gp.t)({refCount:!1,bufferSize:1})),this.loading$=(0,Po.h)(this._ciphersLoading$.pipe((0,l.T)(()=>!0)),this.favoriteCiphers$.pipe((0,l.T)(()=>!1))).pipe((0,kd.Z)(!0),(0,mo.F)(),(0,Gp.t)({refCount:!1,bufferSize:1})),this.hasSearchText$=this._hasSearchText.pipe((0,mo.F)(),(0,Gp.t)({bufferSize:1,refCount:!0})),this.hasFilterApplied$=(0,jo.z)([this._hasSearchText,this.vaultPopupListFiltersService.filters$]).pipe((0,l.T)(([e,t])=>e||Object.values(t).some(e=>null!==e)),(0,Gp.t)({bufferSize:1,refCount:!0})),this.emptyVault$=this._activeCipherList$.pipe((0,l.T)(e=>!e.length)),this.cipherCount$=this._activeCipherList$.pipe((0,l.T)(e=>e.length)),this.noFilteredResults$=this._filteredCipherList$.pipe((0,l.T)(e=>!e.length)),this.showDeactivatedOrg$=(0,jo.z)([this.vaultPopupListFiltersService.filters$.pipe((0,H4.w)("organization")),this.organizations$]).pipe((0,l.T)(([e,t])=>{if(!e.organization||e.organization.id===C8)return!1;const i=t.find(t=>{var i;return t.id===(null===(i=null==e?void 0:e.organization)||void 0===i?void 0:i.id)});return!!i&&!i.enabled})),this.deletedCiphers$=this._allDecryptedCiphers$.pipe((0,go.n)(e=>(0,jo.z)([this.organizations$,this.decryptedCollections$]).pipe((0,l.T)(([t,i])=>{const n=Object.fromEntries(t.map(e=>[e.id,e])),r=Object.fromEntries(i.map(e=>[e.id,e]));return e.filter(e=>t$.isDeleted(e)).map(e=>{var t;return Object.assign(Object.assign({},e),{collections:null===(t=e.collectionIds)||void 0===t?void 0:t.map(e=>r[e]),organization:n[e.organizationId]})})}))),(0,Gp.t)({refCount:!1,bufferSize:1}))}applyFilter(e){this.cachedSearchText.set(e)}sortCiphersForAutofill(e,t){const i={[nx.Login]:1,[nx.Card]:2,[nx.Identity]:3,[nx.SecureNote]:4,[nx.SshKey]:5},n=t$.getType(e),r=t$.getType(t);return i[n]<i[r]?-1:i[n]>i[r]?1:this.cipherService.sortCiphersByLastUsedThenName(e,t)}}F8.ɵfac=function(e){return new(e||F8)(a.KVO(_b),a.KVO(FY),a.KVO(P8),a.KVO(WF),a.KVO(sQ),a.KVO(uR),a.KVO(S8),a.KVO(qx),a.KVO(Zk),a.KVO(Fl.SKi),a.KVO(r$),a.KVO(Kb),a.KVO($V))},F8.ɵprov=a.jDH({token:F8,factory:F8.ɵfac,providedIn:"root"});const R8=e=>{return t=e.activeUserLastSync$().pipe((0,Eo.p)(e=>null!=e)),e=>{const i=e.pipe((0,Fo.u)());return(0,Po.h)(i.pipe((0,Q4.X)(t),(0,_o.s)(1)),i.pipe((0,e8.U)(t)))};var t};var x8=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const A8=new m(De,"copyButtons",{deserializer:e=>e});class D8{constructor(){this.DEFAULT_DISPLAY_MODE="combined",this.state=(0,a.WQX)(d).get(A8),this.displayMode$=this.state.state$.pipe((0,l.T)(e=>null!=e?e:this.DEFAULT_DISPLAY_MODE)),this.showQuickCopyActions$=this.displayMode$.pipe((0,l.T)(e=>"quick"===e),(0,Gp.t)({bufferSize:1,refCount:!0}))}setDisplayMode(e){return x8(this,void 0,void 0,function*(){yield this.state.update(()=>e)})}setShowQuickCopyActions(e){return x8(this,void 0,void 0,function*(){yield this.setDisplayMode(e?"quick":"combined")})}}D8.ɵfac=function(e){return new(e||D8)},D8.ɵprov=a.jDH({token:D8,factory:D8.ɵfac,providedIn:"root"});class E8{constructor(){this.vaultPopupItemsService=(0,a.WQX)(F8),this.vaultPopupListFiltersService=(0,a.WQX)(P8),this.vaultCopyButtonsService=(0,a.WQX)(D8),this.loading$=(0,jo.z)([this.vaultPopupItemsService.loading$,this.vaultPopupListFiltersService.allFilters$,this.vaultCopyButtonsService.showQuickCopyActions$]).pipe((0,l.T)(([e,t])=>e||!t),(0,Gp.t)({bufferSize:1,refCount:!0}),(0,kd.Z)(!0))}}E8.ɵfac=function(e){return new(e||E8)},E8.ɵprov=a.jDH({token:E8,factory:E8.ɵfac,providedIn:"root"});class $8{constructor(){this.router=(0,a.WQX)(Fd.Ix),this.vaultPath="/tabs/vault",this.scrollPosition=null,this.scrollSubscription=null,this.router.events.pipe((0,xl.pQ)(),(0,Eo.p)(e=>e instanceof Fd.wF)).subscribe(e=>{this.resetListenerForNavigation(e)})}start(e){var t;this.hasScrollPosition()&&setTimeout(()=>{e.scrollTo({top:this.scrollPosition,behavior:"instant"})}),null===(t=this.scrollSubscription)||void 0===t||t.unsubscribe();let i=!1;this.scrollSubscription=(0,Rh.R)(e,"scroll").subscribe(()=>{i?this.scrollPosition=e.scrollTop:i=!0})}stop(e){var t;null===(t=this.scrollSubscription)||void 0===t||t.unsubscribe(),this.scrollSubscription=null,e&&(this.scrollPosition=null)}hasScrollPosition(){return null!==this.scrollPosition}resetListenerForNavigation(e){e.url!==this.vaultPath&&e.url.startsWith("/tabs/")&&this.stop(!0)}}$8.ɵfac=function(e){return new(e||$8)},$8.ɵprov=a.jDH({token:$8,factory:$8.ɵfac,providedIn:"root"});function O8(e,t){1&e&&Fl.nrm(0,"i",4),2&e&&Fl.HbH(t)}function U8(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",5),Fl.nI1(1,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.onClose.emit())}),Fl.k0s()}2&e&&Fl.Y8G("label",Fl.bMT(1,1,"close"))}const M8={premium:"bwi-star",info:"bwi-info-circle",warning:"bwi-exclamation-triangle",danger:"bwi-error"};class N8{constructor(){this.bannerType=(0,o.hFB)("info"),this.icon=(0,o.hFB)(),this.useAlertRole=(0,o.hFB)(!0),this.showClose=(0,o.hFB)(!0),this.onClose=(0,o.CGW)(),this.displayIcon=(0,Rl.EW)(()=>{var e;return null===this.icon()?null:null!==(e=this.icon())&&void 0!==e?e:M8[this.bannerType()]}),this.bannerClass=(0,Rl.EW)(()=>{switch(this.bannerType()){case"danger":return"tw-bg-danger-100 tw-border-b-danger-700";case"info":return"tw-bg-info-100 tw-border-b-info-700";case"premium":return"tw-bg-success-100 tw-border-b-success-700";case"warning":return"tw-bg-warning-100 tw-border-b-warning-700"}})}}N8.ɵfac=function(e){return new(e||N8)},N8.ɵcmp=Fl.VBU({type:N8,selectors:[["bit-banner"]],hostAttrs:[1,"tw-flex","tw-flex-col","[bit-layout_&]:-tw-mx-8","[bit-layout_&]:-tw-my-6","[bit-layout_&]:tw-pb-6"],inputs:{bannerType:[1,"bannerType"],icon:[1,"icon"],useAlertRole:[1,"useAlertRole"],showClose:[1,"showClose"]},outputs:{onClose:"onClose"},ngContentSelectors:["*"],decls:5,vars:6,consts:[[1,"tw-flex","tw-items-center","tw-gap-4","tw-p-2","tw-ps-4","tw-text-main","tw-border-transparent","tw-bg-clip-padding","tw-border-solid","tw-border-b","tw-border-0"],["aria-hidden","true",1,"bwi","tw-align-middle","tw-text-base",3,"class"],[1,"tw-grow","tw-text-base","[&>button[bitlink]:focus-visible:before]:!tw-ring-text-main"],["type","button","bitIconButton","bwi-close","buttonType","main","size","small",3,"label"],["aria-hidden","true",1,"bwi","tw-align-middle","tw-text-base"],["type","button","bitIconButton","bwi-close","buttonType","main","size","small",3,"click","label"]],template:function(e,t){if(1&e&&(Fl.NAR(),Fl.j41(0,"div",0),Fl.nVh(1,O8,1,2,"i",1),Fl.j41(2,"span",2),Fl.SdG(3),Fl.k0s(),Fl.nVh(4,U8,2,3,"button",3),Fl.k0s()),2&e){let e;Fl.HbH(t.bannerClass()),Fl.BMQ("role",t.useAlertRole()?"status":null)("aria-live",t.useAlertRole()?"polite":null),Fl.R7$(),Fl.vxM((e=t.displayIcon())?1:-1,e),Fl.R7$(3),Fl.vxM(t.showClose()?4:-1)}},dependencies:[Ql,Zl,sc],encapsulation:2,changeDetection:0});class V8{}V8.ɵfac=function(e){return new(e||V8)},V8.ɵmod=Fl.$C({type:V8}),V8.ɵinj=a.G2t({imports:[N8]});var B8=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function j8(e,t){if(1&e&&(Fl.j41(0,"bit-banner",0)(1,"a",2),Fl.EFF(2),Fl.nI1(3,"async"),Fl.nI1(4,"async"),Fl.nI1(5,"i18n"),Fl.k0s()()),2&e){let e;const t=Fl.XpG();Fl.Y8G("showClose",!1),Fl.R7$(),Fl.Y8G("routerLink","/at-risk-passwords"),Fl.R7$(),Fl.SpI(" ",Fl.i5U(5,7,1===(null==(e=Fl.bMT(3,3,t.currentPendingTasks$))?null:e.length)?"reviewAndChangeAtRiskPassword":"reviewAndChangeAtRiskPasswordsPlural",null==(e=Fl.bMT(4,5,t.currentPendingTasks$))?null:e.length.toString())," ")}}function G8(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-banner",3),Fl.bIt("onClose",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.successBannerDismissed())}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.Y8G("icon",null)("showClose",!0),Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,3,"atRiskLoginsSecured")," "))}class L8{constructor(){this.activeAccount$=(0,a.WQX)(Zk).activeAccount$.pipe(iv),this.atRiskPasswordCalloutService=(0,a.WQX)(y$),this.showCompletedTasksBanner$=this.activeAccount$.pipe((0,go.n)(e=>this.atRiskPasswordCalloutService.showCompletedTasksBanner$(e))),this.currentPendingTasks$=this.activeAccount$.pipe((0,go.n)(e=>this.atRiskPasswordCalloutService.pendingTasks$(e)))}successBannerDismissed(){return B8(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.activeAccount$);this.atRiskPasswordCalloutService.updateAtRiskPasswordState(e,{hasInteractedWithTasks:!0,tasksBannerDismissed:!0})})}}L8.ɵfac=function(e){return new(e||L8)},L8.ɵcmp=Fl.VBU({type:L8,selectors:[["vault-at-risk-password-callout"]],features:[Fl.Jv_([y$])],decls:4,vars:6,consts:[["bannerType","warning",1,"-tw-m-5","tw-flex","tw-flex-col","tw-pt-2","tw-px-2","tw-mb-3",3,"showClose"],["bannerType","info",1,"-tw-m-5","tw-flex","tw-flex-col","tw-pt-2","tw-px-2","tw-mb-3",3,"icon","showClose"],["bitLink","","linkType","secondary",3,"routerLink"],["bannerType","info",1,"-tw-m-5","tw-flex","tw-flex-col","tw-pt-2","tw-px-2","tw-mb-3",3,"onClose","icon","showClose"]],template:function(e,t){if(1&e&&(Fl.nVh(0,j8,6,10,"bit-banner",0),Fl.nI1(1,"async"),Fl.nVh(2,G8,3,5,"bit-banner",1),Fl.nI1(3,"async")),2&e){let e;Fl.vxM((null==(e=Fl.bMT(1,2,t.currentPendingTasks$))?null:e.length)>0?0:-1),Fl.R7$(2),Fl.vxM(Fl.bMT(3,4,t.showCompletedTasksBanner$)?2:-1)}},dependencies:[uw,kl.MD,Cw.iI,Cw.Wk,dd,V8,N8,sf,kl.Jj,rf],encapsulation:2});class z8{constructor(){this.fadeInOut=!0}}z8.ɵfac=function(e){return new(e||z8)},z8.ɵcmp=Fl.VBU({type:z8,selectors:[["vault-fade-in-out"]],hostVars:1,hostBindings:function(e,t){2&e&&Fl.zvX("@fadeInOut",t.fadeInOut)},ngContentSelectors:["*"],decls:1,vars:0,template:function(e,t){1&e&&(Fl.NAR(),Fl.SdG(0))},encapsulation:2,data:{animation:[(0,Pl.hZ)("fadeInOut",[(0,Pl.kY)(":enter",[(0,Pl.iF)({opacity:0}),(0,Pl.i0)("100ms ease-in",(0,Pl.iF)({opacity:1}))]),(0,Pl.kY)(":leave",[(0,Pl.i0)("300ms ease-out",(0,Pl.iF)({opacity:0}))])])]},changeDetection:0});var _8=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function K8(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-banner",1),Fl.bIt("onClose",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.handleCurrentTabIsBlockedBannerDismiss())}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.j41(3,"a",2),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()()}if(2&e){const e=Fl.XpG();Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,3,"autofillBlockedNoticeV2")," "),Fl.R7$(2),Fl.Y8G("routerLink",e.blockedURISettingsRoute),Fl.R7$(),Fl.SpI(" ",Fl.bMT(5,5,"autofillBlockedNoticeGuidance")," ")}}class X8{constructor(e){this.vaultPopupAutofillService=e,this.showCurrentTabIsBlockedBanner$=this.vaultPopupAutofillService.showCurrentTabIsBlockedBanner$,this.blockedURISettingsRoute="/blocked-domains"}ngOnInit(){return _8(this,void 0,void 0,function*(){})}handleCurrentTabIsBlockedBannerDismiss(){return _8(this,void 0,void 0,function*(){yield this.vaultPopupAutofillService.dismissCurrentTabIsBlockedBanner()})}}X8.ɵfac=function(e){return new(e||X8)(Fl.rXU(S8))},X8.ɵcmp=Fl.VBU({type:X8,selectors:[["blocked-injection-banner"]],decls:2,vars:3,consts:[["bannerType","info",3,"onClose",4,"ngIf"],["bannerType","info",3,"onClose"],["bitLink","","linkType","secondary",3,"routerLink"]],template:function(e,t){1&e&&(Fl.DNE(0,K8,6,7,"bit-banner",0),Fl.nI1(1,"async")),2&e&&Fl.Y8G("ngIf",Fl.bMT(1,1,t.showCurrentTabIsBlockedBanner$))},dependencies:[V8,N8,kl.MD,kl.bT,Ql,sf,Hh,uw,Cw.iI,Cw.Wk,tc,kl.Jj,rf],encapsulation:2});var q8=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const W8=()=>["/add-cipher"],Y8=(e,t)=>t.type;function H8(e,t){if(1&e&&(Fl.j41(0,"a",3),Fl.nrm(1,"i",6),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()),2&e){const e=t.$implicit,i=Fl.XpG();Fl.Y8G("routerLink",Fl.lJ4(7,W8))("queryParams",i.buildQueryParams(e.type)),Fl.R7$(),Fl.HbH(`bwi ${e.icon}`),Fl.R7$(),Fl.SpI(" ",Fl.bMT(3,5,e.labelKey)," ")}}class J8{constructor(e,t){this.dialogService=e,this.restrictedItemTypeService=t,this.cipherType=nx,this.cipherMenuItems$=this.restrictedItemTypeService.restricted$.pipe((0,l.T)(e=>{const t=e.map(e=>e.cipherType);return dz.filter(e=>!t.includes(e.type))}))}ngOnInit(){return q8(this,void 0,void 0,function*(){this.tab=yield ul.getTabFromCurrentWindow()})}buildQueryParams(e){var t,i,n;const r={};return!pl.inPopout(window)&&e===nx.Login&&this.tab&&(r.prefillNameAndURIFromTab="true"),Object.assign({type:e.toString(),collectionId:null===(t=this.initialValues)||void 0===t?void 0:t.collectionId,organizationId:null===(i=this.initialValues)||void 0===i?void 0:i.organizationId,folderId:null===(n=this.initialValues)||void 0===n?void 0:n.folderId},r)}openFolderDialog(){KL.open(this.dialogService)}}J8.ɵfac=function(e){return new(e||J8)(Fl.rXU(lh),Fl.rXU(r$))},J8.ɵcmp=Fl.VBU({type:J8,selectors:[["app-new-item-dropdown"]],inputs:{initialValues:"initialValues"},decls:14,vars:9,consts:[["itemOptions",""],["bitButton","","buttonType","primary","type","button",3,"bitMenuTriggerFor"],["aria-hidden","true",1,"bwi","bwi-plus","tw-me-2"],["bitMenuItem","",3,"routerLink","queryParams"],["type","button","bitMenuItem","",3,"click"],["slot","start","aria-hidden","true",1,"bwi","bwi-folder"],["slot","start","aria-hidden","true"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",1),Fl.nrm(1,"i",2),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"bit-menu",null,0),Fl.Z7z(6,H8,4,8,"a",3,Y8),Fl.nI1(8,"async"),Fl.nrm(9,"bit-menu-divider"),Fl.j41(10,"button",4),Fl.bIt("click",function(){return a.eBV(e),a.Njj(t.openFolderDialog())}),Fl.nrm(11,"i",5),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.k0s()()}if(2&e){const e=Fl.sdS(5);Fl.Y8G("bitMenuTriggerFor",e),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,3,"new"),"\n"),Fl.R7$(4),Fl.Dyx(Fl.bMT(8,5,t.cipherMenuItems$)),Fl.R7$(6),Fl.SpI(" ",Fl.bMT(13,7,"folder")," ")}},dependencies:[Wh,sf,kl.MD,id,td,Cw.Wk,qh,pz,fz,D$,mz,rf,kl.Jj],encapsulation:2});let Z8=0;class Q8{constructor(){this.open=(0,o.geq)(!1),this.id="bit-disclosure-"+Z8++,this.classList=(0,Rl.EW)(()=>this.open()?"":"tw-hidden")}}Q8.ɵfac=function(e){return new(e||Q8)},Q8.ɵcmp=Fl.VBU({type:Q8,selectors:[["bit-disclosure"]],hostVars:3,hostBindings:function(e,t){2&e&&(Fl.Avn("id",t.id),Fl.HbH(t.classList()))},inputs:{open:[1,"open"]},outputs:{open:"openChange"},ngContentSelectors:["*"],decls:1,vars:0,template:function(e,t){1&e&&(Fl.NAR(),Fl.SdG(0))},encapsulation:2,changeDetection:0});class e6{constructor(){this.disclosure=o.hFB.required({alias:"bitDisclosureTriggerFor"}),this.ariaExpanded=(0,Rl.EW)(()=>this.disclosure().open()),this.ariaControls=(0,Rl.EW)(()=>this.disclosure().id)}toggle(){this.disclosure().open.update(e=>!e)}}function t6(e,t){if(1&e&&(Fl.nrm(0,"bit-chip-select",6),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG().ngIf;Fl.Y8G("placeholderText",Fl.bMT(1,2,"vault"))("options",e)}}function i6(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,t6,2,4,"bit-chip-select",5),Fl.bVm()),2&e){const e=t.ngIf;Fl.R7$(),Fl.Y8G("ngIf",e.length)}}function n6(e,t){if(1&e&&(Fl.nrm(0,"bit-chip-select",8),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG().ngIf;Fl.Y8G("placeholderText",Fl.bMT(1,2,"collection"))("options",e)}}function r6(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,n6,2,4,"bit-chip-select",7),Fl.bVm()),2&e){const e=t.ngIf;Fl.R7$(),Fl.Y8G("ngIf",e.length)}}function s6(e,t){if(1&e&&(Fl.nrm(0,"bit-chip-select",10),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG().ngIf;Fl.Y8G("placeholderText",Fl.bMT(1,2,"folder"))("options",e)}}function o6(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,s6,2,4,"bit-chip-select",9),Fl.bVm()),2&e){const e=t.ngIf;Fl.R7$(),Fl.Y8G("ngIf",e.length)}}function a6(e,t){if(1&e&&(Fl.j41(0,"form",2),Fl.DNE(1,i6,2,1,"ng-container",3)(2,r6,2,1,"ng-container",3)(3,o6,2,1,"ng-container",3),Fl.nrm(4,"bit-chip-select",4),Fl.nI1(5,"i18n"),Fl.nI1(6,"async"),Fl.k0s()),2&e){const e=t.ngIf,i=Fl.XpG();Fl.Y8G("formGroup",i.filterForm),Fl.R7$(),Fl.Y8G("ngIf",e.organizations),Fl.R7$(),Fl.Y8G("ngIf",e.collections),Fl.R7$(),Fl.Y8G("ngIf",e.folders),Fl.R7$(),Fl.Y8G("placeholderText",Fl.bMT(5,6,"type"))("options",Fl.bMT(6,8,i.cipherTypes$))}}e6.ɵfac=function(e){return new(e||e6)},e6.ɵdir=Fl.FsC({type:e6,selectors:[["","bitDisclosureTriggerFor",""]],hostVars:2,hostBindings:function(e,t){1&e&&Fl.bIt("click",function(){return t.toggle()}),2&e&&Fl.BMQ("aria-expanded",t.ariaExpanded())("aria-controls",t.ariaControls())},inputs:{disclosure:[1,"bitDisclosureTriggerFor","disclosure"]},exportAs:["disclosureTriggerFor"]});class l6{constructor(e){this.vaultPopupListFiltersService=e,this.filterForm=this.vaultPopupListFiltersService.filterForm,this.organizations$=this.vaultPopupListFiltersService.organizations$,this.collections$=this.vaultPopupListFiltersService.collections$,this.folders$=this.vaultPopupListFiltersService.folders$,this.cipherTypes$=this.vaultPopupListFiltersService.cipherTypes$,this.allFilters$=(0,jo.z)([this.organizations$,this.collections$,this.folders$]).pipe((0,l.T)(([e,t,i])=>({organizations:e,collections:t,folders:i})),(0,Gp.t)({bufferSize:1,refCount:!1}))}}l6.ɵfac=function(e){return new(e||l6)(Fl.rXU(P8))},l6.ɵcmp=Fl.VBU({type:l6,selectors:[["app-vault-list-filters"]],decls:4,vars:6,consts:[["role","toolbar"],["class","tw-gap-2 tw-mt-2 tw-grid tw-grid-cols-2 sm:tw-grid-cols-3 lg:tw-grid-cols-4",3,"formGroup",4,"ngIf"],[1,"tw-gap-2","tw-mt-2","tw-grid","tw-grid-cols-2","sm:tw-grid-cols-3","lg:tw-grid-cols-4",3,"formGroup"],[4,"ngIf"],["formControlName","cipherType","fullWidth","","placeholderIcon","bwi-list",3,"placeholderText","options"],["fullWidth","","formControlName","organization","placeholderIcon","bwi-vault",3,"placeholderText","options",4,"ngIf"],["fullWidth","","formControlName","organization","placeholderIcon","bwi-vault",3,"placeholderText","options"],["fullWidth","","formControlName","collection","placeholderIcon","bwi-collection-shared",3,"placeholderText","options",4,"ngIf"],["fullWidth","","formControlName","collection","placeholderIcon","bwi-collection-shared",3,"placeholderText","options"],["fullWidth","","placeholderIcon","bwi-folder","formControlName","folder",3,"placeholderText","options",4,"ngIf"],["fullWidth","","placeholderIcon","bwi-folder","formControlName","folder",3,"placeholderText","options"]],template:function(e,t){1&e&&(Fl.j41(0,"div",0),Fl.nI1(1,"i18n"),Fl.DNE(2,a6,7,10,"form",1),Fl.nI1(3,"async"),Fl.k0s()),2&e&&(Fl.BMQ("aria-label",Fl.bMT(1,2,"filters")),Fl.R7$(2),Fl.Y8G("ngIf",Fl.bMT(3,4,t.allFilters$)))},dependencies:[kl.MD,kl.bT,sf,B1,Il.X1,Il.qT,Il.BC,Il.cb,Il.j4,Il.JD,kl.Jj,rf],encapsulation:2});var c6=i(38871),u6=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const d6=new k(Fe,"searchIndex",{deserializer:e=>e,clearOn:["lock","logout"]}),h6=new k(Fe,"searchIndexedEntityId",{deserializer:e=>e,clearOn:["lock","logout"]}),p6=new k(Fe,"isIndexing",{deserializer:e=>e,clearOn:["lock","logout"]});class v6{constructor(e,t,i){this.logService=e,this.i18nService=t,this.stateProvider=i,this.immediateSearchLocales=["zh-CN","zh-TW","ja","ko","vi"],this.defaultSearchableMinLength=2,this.searchableMinLength=this.defaultSearchableMinLength,this._isCipherSearching$=new Dd.t(!1),this.isCipherSearching$=this._isCipherSearching$.asObservable(),this._isSendSearching$=new Dd.t(!1),this.isSendSearching$=this._isSendSearching$.asObservable(),this.index$=h$(e=>this.searchIndexState(e).state$.pipe((0,l.T)(e=>{let t=null;if(e){const i=performance.now();t=c6.Index.load(e),this.logService.measure(i,"Vault","SearchService","index load")}return t}))),this.i18nService.locale$.subscribe(e=>{-1!==this.immediateSearchLocales.indexOf(e)?this.searchableMinLength=1:this.searchableMinLength=this.defaultSearchableMinLength}),v6.registeredPipeline||(v6.registeredPipeline=!0,c6.Pipeline.registerFunction(this.normalizeAccentsPipelineFunction,"normalizeAccents"))}searchIndexState(e){return this.stateProvider.getUser(e,d6)}searchIndexEntityIdState(e){return this.stateProvider.getUser(e,h6)}indexedEntityId$(e){return this.searchIndexEntityIdState(e).state$.pipe((0,l.T)(e=>e))}searchIsIndexingState(e){return this.stateProvider.getUser(e,p6)}searchIsIndexing$(e){return this.searchIsIndexingState(e).state$.pipe((0,l.T)(e=>null!=e&&e))}clearIndex(e){return u6(this,void 0,void 0,function*(){yield this.searchIndexEntityIdState(e).update(()=>null),yield this.searchIndexState(e).update(()=>null),yield this.searchIsIndexingState(e).update(()=>null)})}isSearchable(e,t){return u6(this,void 0,void 0,function*(){if(null==(t=v6.normalizeSearchQuery(t))||""===t)return!1;return 0===t.indexOf(">")?null!=(yield this.getIndexForSearch(e)):t.length>=this.searchableMinLength})}indexCiphers(e,t,i){return u6(this,void 0,void 0,function*(){if(yield this.getIsIndexing(e))return;const n=performance.now();yield this.setIsIndexing(e,!0),yield this.setIndexedEntityIdForSearch(e,i);const r=new c6.Builder;r.pipeline.add(this.normalizeAccentsPipelineFunction),r.ref("id"),r.field("shortid",{boost:100,extractor:e=>e.id.substr(0,8)}),r.field("name",{boost:10}),r.field("subtitle",{boost:5,extractor:e=>{const t=t$.subtitle(e);return null!=t&&t$.getType(e)===nx.Card?t.replace(/\*/g,""):t}}),r.field("notes",{extractor:e=>t$.getNotes(e)}),r.field("login.username",{extractor:e=>{var t;const i=t$.getLogin(e);return null!==(t=null==i?void 0:i.username)&&void 0!==t?t:null}}),r.field("login.uris",{boost:2,extractor:e=>this.uriExtractor(e)}),r.field("fields",{extractor:e=>this.fieldExtractor(e,!1)}),r.field("fields_joined",{extractor:e=>this.fieldExtractor(e,!0)}),r.field("attachments",{extractor:e=>this.attachmentExtractor(e,!1)}),r.field("attachments_joined",{extractor:e=>this.attachmentExtractor(e,!0)}),r.field("organizationid",{extractor:e=>e.organizationId}),(t=t||[]).forEach(e=>r.add(e));const s=r.build();yield this.setIndexForSearch(e,s.toJSON()),yield this.setIsIndexing(e,!1),this.logService.measure(n,"Vault","SearchService","index complete",[["Items",t.length]])})}searchCiphers(e,t){return u6(this,arguments,void 0,function*(e,t,i=null,n){this._isCipherSearching$.next(!0);const r=[],s=performance.now();if(null!=t&&(t=v6.normalizeSearchQuery(t.trim().toLowerCase())),""===t&&(t=null),null==n&&(n=[]),null!=i&&Array.isArray(i)&&i.length>0?n=n.filter(e=>i.every(t=>null==t||t(e))):null!=i&&(n=n.filter(i)),!(yield this.isSearchable(e,t)))return this._isCipherSearching$.next(!1),n;(yield this.getIsIndexing(e))&&(yield new Promise(e=>setTimeout(e,250)),(yield this.getIsIndexing(e))&&(yield new Promise(e=>setTimeout(e,500))));const o=yield this.getIndexForSearch(e);if(null==o){const e=this.searchCiphersBasic(n,t);return this.logService.measure(s,"Vault","SearchService","basic search complete"),this._isCipherSearching$.next(!1),e}const a=new Map;n.forEach(e=>a.set(e.id,e));let l=null;if(null!=t&&t.length>1&&0===t.indexOf(">"))try{l=o.search(t.substr(1).trim())}catch(e){this.logService.error(e)}else{const e=c6.Query.wildcard.LEADING|c6.Query.wildcard.TRAILING;l=o.query(i=>{c6.tokenizer(t).forEach(t=>{const n=t.toString();i.term(n,{fields:["name"],wildcard:e}),i.term(n,{fields:["subtitle"],wildcard:e}),i.term(n,{fields:["login.uris"],wildcard:e}),i.term(n,{})})})}return null!=l&&l.forEach(e=>{a.has(e.ref)&&r.push(a.get(e.ref))}),this.logService.measure(s,"Vault","SearchService","search complete"),this._isCipherSearching$.next(!1),r})}searchCiphersBasic(e,t,i=!1,n=!1){return t=v6.normalizeSearchQuery(t.trim().toLowerCase()),e.filter(e=>{var r,s;if(i!==t$.isDeleted(e))return!1;if(n!==t$.isArchived(e))return!1;if(null!=e.name&&e.name.toLowerCase().indexOf(t)>-1)return!0;if(t.length>=8&&e.id.startsWith(t))return!0;const o=t$.subtitle(e);if(null!=o&&o.toLowerCase().indexOf(t)>-1)return!0;const a=t$.getLogin(e);return!!(a&&(null===(r=a.uris)||void 0===r?void 0:r.length)&&(null===(s=a.uris)||void 0===s?void 0:s.some(e=>(null==e?void 0:e.uri)&&e.uri.toLowerCase().indexOf(t)>-1)))})}searchSends(e,t){if(this._isSendSearching$.next(!0),null===(t=v6.normalizeSearchQuery(t.trim().toLocaleLowerCase())))return this._isSendSearching$.next(!1),e;const i=[],n=[];return e.forEach(e=>{var r,s,o;null!=e.name&&e.name.toLowerCase().indexOf(t)>-1?i.push(e):(t.length>=8&&(e.id.startsWith(t)||e.accessId.toLocaleLowerCase().startsWith(t)||null!=(null===(r=e.file)||void 0===r?void 0:r.id)&&e.file.id.startsWith(t))||null!=e.notes&&e.notes.toLowerCase().indexOf(t)>-1||null!=(null===(s=e.text)||void 0===s?void 0:s.text)&&e.text.text.toLowerCase().indexOf(t)>-1||null!=(null===(o=e.file)||void 0===o?void 0:o.fileName)&&e.file.fileName.toLowerCase().indexOf(t)>-1)&&n.push(e)}),this._isSendSearching$.next(!1),i.concat(n)}getIndexForSearch(e){return u6(this,void 0,void 0,function*(){return yield(0,bo._)(this.index$(e))})}setIndexForSearch(e,t){return u6(this,void 0,void 0,function*(){yield this.searchIndexState(e).update(()=>t)})}setIndexedEntityIdForSearch(e,t){return u6(this,void 0,void 0,function*(){yield this.searchIndexEntityIdState(e).update(()=>t)})}setIsIndexing(e,t){return u6(this,void 0,void 0,function*(){yield this.searchIsIndexingState(e).update(()=>t)})}getIsIndexing(e){return u6(this,void 0,void 0,function*(){return yield(0,bo._)(this.searchIsIndexing$(e))})}fieldExtractor(e,t){const i=t$.getFields(e);if(!i||0===i.length)return null;let n=[];return i.forEach(e=>{if(null!=e.name&&n.push(e.name),null!=e.value){const t=e.type;void 0!==t&&t!==ox.Text||n.push(e.value)}}),n=n.filter(e=>""!==e.trim()),0===n.length?null:t?n.join(" "):n}attachmentExtractor(e,t){const i=t$.getAttachmentNames(e);if(!i||0===i.length)return null;let n=[];return i.forEach(e=>{null!=e&&(t&&e.indexOf(".")>-1?n.push(e.substring(0,e.lastIndexOf("."))):n.push(e))}),n=n.filter(e=>""!==e.trim()),0===n.length?null:t?n.join(" "):n}uriExtractor(e){var t;if(t$.getType(e)!==nx.Login)return null;const i=t$.getLogin(e);if(!(null===(t=null==i?void 0:i.uris)||void 0===t?void 0:t.length))return null;const n=[];return i.uris.forEach(e=>{if(null==e.uri||""===e.uri)return;const t=e.uri.match(/:(\d+)(?:[/?#]|$)/),i=null==t?void 0:t[1],r=t$.getUriHostname(e);void 0!==r&&(n.push(r),i&&(n.push(`${r}:${i}`),n.push(i)));let s=e.uri;if(e.match!==GE.RegularExpression){const e=s.indexOf("://");e>-1&&(s=s.substring(e+3));const t=s.search(/\?|&|#/);t>-1&&(s=s.substring(0,t))}n.push(s)}),n.length>0?n:null}normalizeAccentsPipelineFunction(e){const t=["name","login.username","subtitle","notes"];return e.metadata.fields.every(e=>t.includes(e))?v6.normalizeSearchQuery(e.toString()):e}static normalizeSearchQuery(e){return null==e?void 0:e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}}v6.registeredPipeline=!1;class f6{constructor(e,t,i){this.vaultPopupItemsService=e,this.vaultPopupLoadingService=t,this.ngZone=i,this.searchText="",this.searchText$=new Co.B,this.loading$=this.vaultPopupLoadingService.loading$,this.subscribeToLatestSearchText(),this.subscribeToApplyFilter()}onSearchTextChanged(){this.searchText$.next(this.searchText)}subscribeToLatestSearchText(){return this.vaultPopupItemsService.searchText$.pipe((0,xl.pQ)(),(0,Eo.p)(e=>!!e)).subscribe(e=>{this.searchText=e})}subscribeToApplyFilter(){(0,jo.z)([this.searchText$,this.loading$]).pipe((0,Al.s)(([e,t])=>{const i=t?0:200;return(0,xo.O)(i)}),(0,mo.F)(([e,t],[i,n])=>e===i&&t===n),(0,l.T)(([e,t])=>e),(0,xl.pQ)()).subscribe(e=>{this.ngZone.runOutsideAngular(()=>{this.ngZone.run(()=>{this.vaultPopupItemsService.applyFilter(e)})})})}}f6.ɵfac=function(e){return new(e||f6)(Fl.rXU(F8),Fl.rXU(E8),Fl.rXU(Fl.SKi))},f6.ɵcmp=Fl.VBU({type:f6,selectors:[["app-vault-search"]],decls:2,vars:4,consts:[["autocomplete","off","appAutofocus","",3,"ngModelChange","placeholder","ngModel"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-search",0),Fl.nI1(1,"i18n"),Fl.mxI("ngModelChange",function(e){return Fl.DH7(t.searchText,e)||(t.searchText=e),e}),Fl.bIt("ngModelChange",function(){return t.onSearchTextChanged()}),Fl.k0s()),2&e&&(Fl.Y8G("placeholder",Fl.bMT(1,2,"search")),Fl.R50("ngModel",t.searchText))},dependencies:[kl.MD,iO,tO,sf,wd,Il.YN,Il.BC,Il.vS,rf],encapsulation:2});var m6=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function g6(e,t){if(1&e&&(Fl.j41(0,"p",8),Fl.EFF(1),Fl.k0s()),2&e){const e=t.ngIf;Fl.R7$(),Fl.SpI(" ",e," ")}}function y6(e,t){if(1&e&&(Fl.j41(0,"div",9),Fl.EFF(1),Fl.nI1(2,"async"),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,e.numberOfAppliedFilters$)," ")}}class b6{constructor(e,t){this.vaultPopupListFiltersService=e,this.i18nService=t,this.isDisclosureShown$=this.vaultPopupListFiltersService.filterVisibilityState$.pipe(UZ((0,a.WQX)(Fl.SKi)),(0,l.T)(e=>null==e||e)),this.initialDisclosureVisibility$=this.isDisclosureShown$.pipe((0,_o.s)(1)),this.numberOfAppliedFilters$=this.vaultPopupListFiltersService.numberOfAppliedFilters$,this.showBadge$=(0,jo.z)([this.numberOfAppliedFilters$,this.isDisclosureShown$]).pipe((0,l.T)(([e,t])=>0!==e&&!t)),this.buttonSupportingText$=this.numberOfAppliedFilters$.pipe((0,l.T)(e=>0===e?null:1===e?this.i18nService.t("filterApplied"):this.i18nService.t("filterAppliedPlural",e)))}toggleFilters(e){return m6(this,void 0,void 0,function*(){yield this.vaultPopupListFiltersService.updateFilterVisibility(e)})}}b6.ɵfac=function(e){return new(e||b6)(Fl.rXU(P8),Fl.rXU(Ul))},b6.ɵcmp=Fl.VBU({type:b6,selectors:[["app-vault-header"]],viewQuery:function(e,t){if(1&e&&Fl.GBs(Q8,5),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.disclosure=e.first)}},decls:14,vars:14,consts:[["disclosureRef",""],[1,"tw-flex","tw-gap-1","tw-items-center"],[1,"tw-flex-1"],[1,"tw-relative"],["type","button","bitIconButton","bwi-sliders","aria-describedby","filters-applied",3,"buttonType","bitDisclosureTriggerFor","label"],["class","tw-sr-only","id","filters-applied",4,"ngIf"],["class","tw-flex tw-items-center tw-justify-center tw-z-10 tw-absolute tw-rounded-full tw-size-[15px] tw-top-[1px] tw-right-[1px] tw-text-notification-600 tw-text-[8px] tw-border-notification-600 tw-border-[0.5px] tw-border-solid tw-bg-notification-100 tw-leading-normal","data-testid","filter-badge",4,"ngIf"],[3,"openChange","open"],["id","filters-applied",1,"tw-sr-only"],["data-testid","filter-badge",1,"tw-flex","tw-items-center","tw-justify-center","tw-z-10","tw-absolute","tw-rounded-full","tw-size-[15px]","tw-top-[1px]","tw-right-[1px]","tw-text-notification-600","tw-text-[8px]","tw-border-notification-600","tw-border-[0.5px]","tw-border-solid","tw-bg-notification-100","tw-leading-normal"]],template:function(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"div",1)(1,"div",2),Fl.nrm(2,"app-vault-search"),Fl.k0s(),Fl.j41(3,"div",3),Fl.nrm(4,"button",4),Fl.nI1(5,"i18n"),Fl.DNE(6,g6,2,1,"p",5),Fl.nI1(7,"async"),Fl.DNE(8,y6,3,3,"div",6),Fl.nI1(9,"async"),Fl.k0s()(),Fl.j41(10,"bit-disclosure",7,0),Fl.nI1(12,"async"),Fl.bIt("openChange",function(i){return a.eBV(e),a.Njj(t.toggleFilters(i))}),Fl.nrm(13,"app-vault-list-filters"),Fl.k0s()}if(2&e){const e=Fl.sdS(11);Fl.R7$(4),Fl.Y8G("buttonType","muted")("bitDisclosureTriggerFor",e)("label",Fl.bMT(5,6,"filterVault")),Fl.R7$(2),Fl.Y8G("ngIf",Fl.bMT(7,8,t.buttonSupportingText$)),Fl.R7$(2),Fl.Y8G("ngIf",Fl.bMT(9,10,t.showBadge$)),Fl.R7$(2),Fl.Y8G("open",Fl.bMT(12,12,t.initialDisclosureVisibility$))}},dependencies:[f6,l6,Q8,Ql,Zl,e6,kl.MD,kl.bT,sf,kl.Jj,rf],encapsulation:2});class w6{}var S6=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const k6=new m(Pe,"sectionOpen",{deserializer:e=>e}),I6={favorites:!0,allItems:!0};class C6{constructor(){this.vaultPopupItemsService=(0,a.WQX)(F8),this.stateProvider=(0,a.WQX)(u),this.hasFilterOrSearchApplied=(0,xl.ot)(this.vaultPopupItemsService.hasFilterApplied$.pipe((0,l.T)(e=>e))),this.temporaryStateOverride=(0,a.vPA)(null),this.sectionOpenStateProvider=this.stateProvider.getGlobal(k6),this.sectionOpenStoredState=(0,xl.ot)(this.sectionOpenStateProvider.state$.pipe((0,l.T)(e=>null!=e?e:I6)),{initialValue:null}),this.sectionOpenDisplayState=(0,Rl.EW)(()=>Object.assign(Object.assign({},this.sectionOpenStoredState()),this.temporaryStateOverride())),(0,Rl.QZ)(()=>{this.hasFilterOrSearchApplied()?this.temporaryStateOverride.set(I6):this.temporaryStateOverride.set(null)},{allowSignalWrites:!0})}getOpenDisplayStateForSection(e){return(0,Rl.EW)(()=>{var t;return null===(t=this.sectionOpenDisplayState())||void 0===t?void 0:t[e]})}updateSectionOpenStoredState(e,t){return S6(this,void 0,void 0,function*(){yield this.sectionOpenStateProvider.update(i=>Object.assign(Object.assign({},null!=i?i:I6),{[e]:t})),this.temporaryStateOverride.update(i=>null!==i?Object.assign(Object.assign({},i),{[e]:t}):i)})}}function T6(e,t){if(1&e&&(Fl.nrm(0,"button",11),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG(3);Fl.Y8G("cipher",e.cipher)("label",Fl.bMT(1,2,"copyPassword"))}}function P6(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"bit-item-action"),Fl.nrm(2,"button",8),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"bit-item-action"),Fl.DNE(5,T6,2,4,"button",9),Fl.k0s(),Fl.j41(6,"bit-item-action"),Fl.nrm(7,"button",10),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.bVm()),2&e){const e=Fl.XpG(2);Fl.R7$(2),Fl.Y8G("cipher",e.cipher)("label",Fl.bMT(3,5,"copyUsername")),Fl.R7$(3),Fl.Y8G("ngIf",e.cipher.viewPassword),Fl.R7$(2),Fl.Y8G("cipher",e.cipher)("label",Fl.bMT(8,7,"copyVerificationCode"))}}function F6(e,t){if(1&e&&(Fl.nrm(0,"button",13),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG(3);Fl.Y8G("label",Fl.brH(1,3,"copyFieldCipherName",e.singleCopyableLogin.key,e.cipher.name))("appCopyField",e.singleCopyableLogin.field)("cipher",e.cipher)}}function R6(e,t){if(1&e&&(Fl.j41(0,"button",18),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(4);Fl.Y8G("cipher",e.cipher),Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,2,"copyPassword")," ")}}function x6(e,t){if(1&e&&(Fl.qex(0),Fl.nrm(1,"button",14),Fl.nI1(2,"i18n"),Fl.nI1(3,"i18n"),Fl.j41(4,"bit-menu",null,1)(6,"button",15),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.DNE(9,R6,3,4,"button",16),Fl.j41(10,"button",17),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s()(),Fl.bVm()),2&e){const e=Fl.sdS(5),t=Fl.XpG(3);Fl.R7$(),Fl.Y8G("label",t.hasLoginValues?Fl.i5U(2,8,"copyInfoTitle",t.cipher.name):Fl.bMT(3,11,"noValuesToCopy"))("disabled",!t.hasLoginValues)("bitMenuTriggerFor",e),Fl.R7$(5),Fl.Y8G("cipher",t.cipher),Fl.R7$(),Fl.SpI(" ",Fl.bMT(8,13,"copyUsername")," "),Fl.R7$(2),Fl.Y8G("ngIf",t.cipher.viewPassword),Fl.R7$(),Fl.Y8G("cipher",t.cipher),Fl.R7$(),Fl.SpI(" ",Fl.bMT(12,15,"copyVerificationCode")," ")}}function A6(e,t){if(1&e&&(Fl.j41(0,"bit-item-action"),Fl.DNE(1,F6,2,7,"button",12)(2,x6,13,17,"ng-container",6),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("ngIf",e.singleCopyableLogin),Fl.R7$(),Fl.Y8G("ngIf",!e.singleCopyableLogin)}}function D6(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,P6,9,9,"ng-container",7),Fl.nI1(2,"async"),Fl.DNE(3,A6,3,2,"ng-template",null,0,Fl.C5r),Fl.bVm()),2&e){const e=Fl.sdS(4),t=Fl.XpG();Fl.R7$(),Fl.Y8G("ngIf",Fl.bMT(2,2,t.showQuickCopyActions$))("ngIfElse",e)}}function E6(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"bit-item-action"),Fl.nrm(2,"button",19),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"bit-item-action"),Fl.nrm(5,"button",20),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.bVm()),2&e){const e=Fl.XpG(2);Fl.R7$(2),Fl.Y8G("cipher",e.cipher)("label",Fl.bMT(3,4,"copyNumber")),Fl.R7$(3),Fl.Y8G("cipher",e.cipher)("label",Fl.bMT(6,6,"copySecurityCode"))}}function $6(e,t){if(1&e&&(Fl.nrm(0,"button",22),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG(3);Fl.Y8G("label",Fl.brH(1,3,"copyFieldCipherName",e.singleCopyableCard.key,e.cipher.name))("appCopyField",e.singleCopyableCard.field)("cipher",e.cipher)}}function O6(e,t){if(1&e&&(Fl.qex(0),Fl.nrm(1,"button",14),Fl.nI1(2,"i18n"),Fl.nI1(3,"i18n"),Fl.j41(4,"bit-menu",null,3)(6,"button",23),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.j41(9,"button",24),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s()(),Fl.bVm()),2&e){const e=Fl.sdS(5),t=Fl.XpG(3);Fl.R7$(),Fl.Y8G("label",t.hasCardValues?Fl.i5U(2,7,"copyInfoTitle",t.cipher.name):Fl.bMT(3,10,"noValuesToCopy"))("disabled",!t.hasCardValues)("bitMenuTriggerFor",e),Fl.R7$(5),Fl.Y8G("cipher",t.cipher),Fl.R7$(),Fl.SpI(" ",Fl.bMT(8,12,"copyNumber")," "),Fl.R7$(2),Fl.Y8G("cipher",t.cipher),Fl.R7$(),Fl.SpI(" ",Fl.bMT(11,14,"copySecurityCode")," ")}}function U6(e,t){if(1&e&&(Fl.j41(0,"bit-item-action"),Fl.DNE(1,$6,2,7,"button",21)(2,O6,12,16,"ng-container",6),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("ngIf",e.singleCopyableCard),Fl.R7$(),Fl.Y8G("ngIf",!e.singleCopyableCard)}}function M6(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,E6,7,8,"ng-container",7),Fl.nI1(2,"async"),Fl.DNE(3,U6,3,2,"ng-template",null,2,Fl.C5r),Fl.bVm()),2&e){const e=Fl.sdS(4),t=Fl.XpG();Fl.R7$(),Fl.Y8G("ngIf",Fl.bMT(2,2,t.showQuickCopyActions$))("ngIfElse",e)}}function N6(e,t){if(1&e&&(Fl.nrm(0,"button",22),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG(2);Fl.Y8G("label",Fl.brH(1,3,"copyFieldCipherName",e.singleCopyableIdentity.key,e.cipher.name))("appCopyField",e.singleCopyableIdentity.field)("cipher",e.cipher)}}function V6(e,t){if(1&e&&(Fl.qex(0),Fl.nrm(1,"button",14),Fl.nI1(2,"i18n"),Fl.nI1(3,"i18n"),Fl.j41(4,"bit-menu",null,4)(6,"button",15),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.j41(9,"button",25),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s(),Fl.j41(12,"button",26),Fl.EFF(13),Fl.nI1(14,"i18n"),Fl.k0s(),Fl.j41(15,"button",27),Fl.EFF(16),Fl.nI1(17,"i18n"),Fl.k0s()(),Fl.bVm()),2&e){const e=Fl.sdS(5),t=Fl.XpG(2);Fl.R7$(),Fl.Y8G("label",t.hasIdentityValues?Fl.i5U(2,11,"copyInfoTitle",t.cipher.name):Fl.bMT(3,14,"noValuesToCopy"))("disabled",!t.hasIdentityValues)("bitMenuTriggerFor",e),Fl.R7$(5),Fl.Y8G("cipher",t.cipher),Fl.R7$(),Fl.SpI(" ",Fl.bMT(8,16,"copyUsername")," "),Fl.R7$(2),Fl.Y8G("cipher",t.cipher),Fl.R7$(),Fl.SpI(" ",Fl.bMT(11,18,"copyEmail")," "),Fl.R7$(2),Fl.Y8G("cipher",t.cipher),Fl.R7$(),Fl.SpI(" ",Fl.bMT(14,20,"copyPhone")," "),Fl.R7$(2),Fl.Y8G("cipher",t.cipher),Fl.R7$(),Fl.SpI(" ",Fl.bMT(17,22,"copyAddress")," ")}}function B6(e,t){if(1&e&&(Fl.j41(0,"bit-item-action"),Fl.DNE(1,N6,2,7,"button",21)(2,V6,18,24,"ng-container",6),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("ngIf",e.singleCopyableIdentity),Fl.R7$(),Fl.Y8G("ngIf",!e.singleCopyableIdentity)}}function j6(e,t){if(1&e&&(Fl.j41(0,"bit-item-action"),Fl.nrm(1,"button",28),Fl.nI1(2,"i18n"),Fl.nI1(3,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("label",e.hasSecureNoteValue?Fl.i5U(2,2,"copyNoteTitle",e.cipher.name):Fl.bMT(3,5,"noValuesToCopy"))("cipher",e.cipher)}}function G6(e,t){if(1&e&&(Fl.j41(0,"bit-item-action"),Fl.nrm(1,"button",14),Fl.nI1(2,"i18n"),Fl.nI1(3,"i18n"),Fl.j41(4,"bit-menu",null,5)(6,"button",29),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.j41(9,"button",30),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s(),Fl.j41(12,"button",31),Fl.EFF(13),Fl.nI1(14,"i18n"),Fl.k0s()()()),2&e){const e=Fl.sdS(5),t=Fl.XpG();Fl.R7$(),Fl.Y8G("label",t.hasSshKeyValues?Fl.i5U(2,9,"copyInfoTitle",t.cipher.name):Fl.bMT(3,12,"noValuesToCopy"))("disabled",!t.hasSshKeyValues)("bitMenuTriggerFor",e),Fl.R7$(5),Fl.Y8G("cipher",t.cipher),Fl.R7$(),Fl.SpI(" ",Fl.bMT(8,14,"copyPrivateKey")," "),Fl.R7$(2),Fl.Y8G("cipher",t.cipher),Fl.R7$(),Fl.SpI(" ",Fl.bMT(11,16,"copyPublicKey")," "),Fl.R7$(2),Fl.Y8G("cipher",t.cipher),Fl.R7$(),Fl.SpI(" ",Fl.bMT(14,18,"copyFingerprint")," ")}}C6.ɵfac=function(e){return new(e||C6)},C6.ɵprov=a.jDH({token:C6,factory:C6.ɵfac,providedIn:"root"});class L6{get singleCopyableLogin(){return!this.cipher.viewPassword&&t$.hasCopyableValue(this.cipher,"username")&&t$.hasCopyableValue(this.cipher,"password")&&!t$.hasCopyableValue(this.cipher,"totp")?{key:this.i18nService.t("copyUsername"),field:"username"}:this.findSingleCopyableItem([{key:"copyUsername",field:"username"},{key:"copyPassword",field:"password"},{key:"copyVerificationCode",field:"totp"}])}get singleCopyableCard(){return this.findSingleCopyableItem([{key:"securityCode",field:"securityCode"},{key:"cardNumber",field:"cardNumber"}])}get singleCopyableIdentity(){return this.findSingleCopyableItem([{key:"address",field:"address"},{key:"email",field:"email"},{key:"username",field:"username"},{key:"phone",field:"phone"}])}findSingleCopyableItem(e){const t=e.filter(({field:e})=>t$.hasCopyableValue(this.cipher,e));return 1===t.length?Object.assign(Object.assign({},t[0]),{key:this.i18nService.t(t[0].key)}):null}get hasLoginValues(){return this.getNumberOfLoginValues()>0}get hasCardValues(){return this.getNumberOfCardValues()>0}get hasIdentityValues(){return this.getNumberOfIdentityValues()>0}get hasSecureNoteValue(){return this.getNumberOfSecureNoteValues()>0}get hasSshKeyValues(){return this.getNumberOfSshKeyValues()>0}constructor(e){this.i18nService=e,this.showQuickCopyActions$=(0,a.WQX)(D8).showQuickCopyActions$,this.CipherViewLikeUtils=t$,this.CipherType=nx}getNumberOfLoginValues(){if(t$.isCipherListView(this.cipher)){const e=["LoginUsername","LoginPassword","LoginTotp"];return this.cipher.copyableFields.filter(t=>e.includes(t)).length}return[this.cipher.login.username,this.cipher.login.password,this.cipher.login.totp].filter(Boolean).length}getNumberOfCardValues(){if(t$.isCipherListView(this.cipher)){const e=["CardSecurityCode","CardNumber"];return this.cipher.copyableFields.filter(t=>e.includes(t)).length}return[this.cipher.card.code,this.cipher.card.number].filter(Boolean).length}getNumberOfIdentityValues(){if(t$.isCipherListView(this.cipher)){const e=["IdentityAddress","IdentityEmail","IdentityUsername","IdentityPhone"];return this.cipher.copyableFields.filter(t=>e.includes(t)).length}return[this.cipher.identity.fullAddressForCopy,this.cipher.identity.email,this.cipher.identity.username,this.cipher.identity.phone].filter(Boolean).length}getNumberOfSecureNoteValues(){return t$.isCipherListView(this.cipher)?this.cipher.copyableFields.includes("SecureNotes")?1:0:this.cipher.notes?1:0}getNumberOfSshKeyValues(){return t$.isCipherListView(this.cipher)?this.cipher.copyableFields.includes("SshKey")?1:0:[this.cipher.sshKey.privateKey,this.cipher.sshKey.publicKey,this.cipher.sshKey.keyFingerprint].filter(Boolean).length}}function z6(e,t){if(1&e&&(Fl.j41(0,"p",10),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s(),Fl.j41(3,"bit-callout",11)(4,"div",5),Fl.EFF(5),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,4,"savedWebsite")," "),Fl.R7$(2),Fl.Y8G("title",null),Fl.R7$(),Fl.Y8G("appA11yTitle",e.savedUrls()[0]),Fl.R7$(),Fl.SpI(" ",e.savedUrls()[0]," ")}}function _6(e,t){if(1&e&&(Fl.j41(0,"div",16)(1,"bit-callout",11)(2,"div",5),Fl.EFF(3),Fl.k0s()()()),2&e){const e=t.$implicit;Fl.R7$(),Fl.Y8G("title",null),Fl.R7$(),Fl.Y8G("appA11yTitle",e),Fl.R7$(),Fl.SpI(" ",e," ")}}function K6(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"div",12)(1,"p",13),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"button",14),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.toggleSavedUrlExpandedState())}),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s()(),Fl.j41(7,"div",15),Fl.Z7z(8,_6,4,3,"div",16,Fl.fX1),Fl.k0s()}if(2&e){const e=Fl.XpG();Fl.R7$(2),Fl.SpI(" ",Fl.i5U(3,3,"savedWebsites",e.savedUrls().length.toString())," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(6,6,e.savedUrlsExpanded()?"showLess":"showAll")," "),Fl.R7$(2),Fl.Y8G("ngClass",e.savedUrlsListClass()),Fl.R7$(),Fl.Dyx(e.savedUrls())}}function X6(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",17),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.autofillAndAddUrl())}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"autofillAndAddWebsite")," "))}L6.ɵfac=function(e){return new(e||L6)(Fl.rXU(Ul))},L6.ɵcmp=Fl.VBU({type:L6,selectors:[["app-item-copy-actions"]],inputs:{cipher:"cipher"},decls:5,vars:5,consts:[["loginCopyMenu",""],["loginOptions",""],["cardCopyMenu",""],["cardOptions",""],["identityOptions",""],["sshKeyOptions",""],[4,"ngIf"],[4,"ngIf","ngIfElse"],["type","button","bitIconButton","bwi-user","size","small","appCopyField","username",3,"cipher","label"],["type","button","bitIconButton","bwi-key","size","small","appCopyField","password",3,"cipher","label",4,"ngIf"],["type","button","bitIconButton","bwi-clock","size","small","appCopyField","totp",3,"cipher","label"],["type","button","bitIconButton","bwi-key","size","small","appCopyField","password",3,"cipher","label"],["type","button","bitIconButton","bwi-clone","size","small",3,"label","appCopyField","cipher",4,"ngIf"],["type","button","bitIconButton","bwi-clone","size","small",3,"label","appCopyField","cipher"],["type","button","bitIconButton","bwi-clone","size","small",3,"label","disabled","bitMenuTriggerFor"],["type","button","bitMenuItem","","appCopyField","username",3,"cipher"],["type","button","bitMenuItem","","appCopyField","password",3,"cipher",4,"ngIf"],["type","button","bitMenuItem","","appCopyField","totp",3,"cipher"],["type","button","bitMenuItem","","appCopyField","password",3,"cipher"],["type","button","bitIconButton","bwi-hashtag","size","small","appCopyField","cardNumber",3,"cipher","label"],["type","button","bitIconButton","bwi-key","size","small","appCopyField","securityCode",3,"cipher","label"],["type","button","bitIconButton","bwi-clone","size","small","showToast","",3,"label","appCopyField","cipher",4,"ngIf"],["type","button","bitIconButton","bwi-clone","size","small","showToast","",3,"label","appCopyField","cipher"],["type","button","bitMenuItem","","appCopyField","cardNumber",3,"cipher"],["type","button","bitMenuItem","","appCopyField","securityCode",3,"cipher"],["type","button","bitMenuItem","","appCopyField","email",3,"cipher"],["type","button","bitMenuItem","","appCopyField","phone",3,"cipher"],["type","button","bitMenuItem","","appCopyField","address",3,"cipher"],["type","button","bitIconButton","bwi-clone","size","small","appCopyField","secureNote",3,"label","cipher"],["type","button","bitMenuItem","","appCopyField","privateKey",3,"cipher"],["type","button","bitMenuItem","","appCopyField","publicKey",3,"cipher"],["type","button","bitMenuItem","","appCopyField","keyFingerprint",3,"cipher"]],template:function(e,t){1&e&&Fl.DNE(0,D6,5,4,"ng-container",6)(1,M6,5,4,"ng-container",6)(2,B6,3,2,"bit-item-action",6)(3,j6,4,7,"bit-item-action",6)(4,G6,15,20,"bit-item-action",6),2&e&&(Fl.Y8G("ngIf",t.CipherViewLikeUtils.getType(t.cipher)===t.CipherType.Login),Fl.R7$(),Fl.Y8G("ngIf",t.CipherViewLikeUtils.getType(t.cipher)===t.CipherType.Card),Fl.R7$(),Fl.Y8G("ngIf",t.CipherViewLikeUtils.getType(t.cipher)===t.CipherType.Identity),Fl.R7$(),Fl.Y8G("ngIf",t.CipherViewLikeUtils.getType(t.cipher)===t.CipherType.SecureNote),Fl.R7$(),Fl.Y8G("ngIf",t.CipherViewLikeUtils.getType(t.cipher)===t.CipherType.SshKey))},dependencies:[VP,BP,Ql,Zl,sf,qh,pz,fz,D$,kl.MD,kl.bT,j$,rf,kl.Jj],encapsulation:2});const q6=Object.freeze({AutofillAndUrlAdded:"added",AutofilledOnly:"autofilled",Canceled:"canceled"});class W6{constructor(){var e,t;this.params=(0,a.WQX)(pd.Qs),this.dialogRef=(0,a.WQX)(nh),this.currentUrl=(0,a.vPA)(bd.getHostname(this.params.currentUrl)),this.savedUrls=(0,a.vPA)((null!==(e=this.params.savedUrls)&&void 0!==e?e:[]).map(e=>{var t;return null!==(t=bd.getHostname(e))&&void 0!==t?t:""}).filter(Boolean)),this.viewOnly=(0,a.vPA)(null!==(t=this.params.viewOnly)&&void 0!==t&&t),this.savedUrlsExpanded=(0,a.vPA)(!1),this.savedUrlsListClass=(0,Rl.EW)(()=>this.savedUrlsExpanded()?"":"tw-relative tw-max-h-24 tw-overflow-hidden after:tw-pointer-events-none\n after:tw-content-[''] after:tw-absolute after:tw-inset-x-0 after:tw-bottom-0\n after:tw-h-8 after:tw-bg-gradient-to-t after:tw-from-background after:tw-to-transparent")}toggleSavedUrlExpandedState(){this.savedUrlsExpanded.update(e=>!e)}close(){this.dialogRef.close(q6.Canceled)}autofillAndAddUrl(){this.dialogRef.close(q6.AutofillAndUrlAdded)}autofillOnly(){this.dialogRef.close(q6.AutofilledOnly)}static open(e,t){return e.open(W6,Object.assign({},t))}}W6.ɵfac=function(e){return new(e||W6)},W6.ɵcmp=Fl.VBU({type:W6,selectors:[["ng-component"]],decls:22,vars:21,consts:[[3,"title"],["bitDialogContent",""],["bitTypography","body2"],[1,"tw-text-muted","tw-text-xs","tw-uppercase","tw-mt-5","tw-font-medium"],["type","warning","icon","bwi-globe",3,"title"],[1,"tw-font-mono","tw-line-clamp-1","tw-break-all",3,"appA11yTitle"],[1,"tw-flex","tw-justify-center","tw-flex-col","tw-gap-3","tw-mt-6"],["type","button","bitButton","","buttonType","primary"],["type","button","bitButton","","buttonType","secondary",3,"click"],["type","button","bitLink","","linkType","secondary",1,"tw-mt-2","tw-font-medium","tw-text-sm","tw-justify-center","tw-text-center",3,"click"],[1,"tw-text-muted","tw-text-xs","tw-uppercase","tw-mt-4","tw-font-medium"],["type","success","icon","bwi-globe",3,"title"],[1,"tw-flex","tw-justify-between","tw-items-center","tw-mt-4","tw-mb-1","tw-pt-2"],[1,"tw-text-muted","tw-text-xs","tw-uppercase","tw-font-medium","tw-mb-0"],["type","button","bitLink","",1,"tw-text-sm","tw-font-medium","tw-cursor-pointer",3,"click"],[1,"tw-pt-2",3,"ngClass"],[1,"-tw-mt-2"],["type","button","bitButton","","buttonType","primary",3,"click"]],template:function(e,t){1&e&&(Fl.j41(0,"bit-dialog",0),Fl.nI1(1,"i18n"),Fl.j41(2,"div",1)(3,"p",2),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s(),Fl.nVh(6,z6,6,6),Fl.nVh(7,K6,10,8),Fl.j41(8,"p",3),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s(),Fl.j41(11,"bit-callout",4)(12,"div",5),Fl.EFF(13),Fl.k0s()(),Fl.j41(14,"div",6),Fl.nVh(15,X6,3,3,"button",7),Fl.j41(16,"button",8),Fl.bIt("click",function(){return t.autofillOnly()}),Fl.EFF(17),Fl.nI1(18,"i18n"),Fl.k0s(),Fl.j41(19,"button",9),Fl.bIt("click",function(){return t.close()}),Fl.EFF(20),Fl.nI1(21,"i18n"),Fl.k0s()()()()),2&e&&(Fl.Y8G("title",Fl.bMT(1,11,"confirmAutofill")),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(5,13,"confirmAutofillDesc")," "),Fl.R7$(2),Fl.vxM(1===t.savedUrls().length?6:-1),Fl.R7$(),Fl.vxM(t.savedUrls().length>1?7:-1),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(10,15,"currentWebsite")," "),Fl.R7$(2),Fl.Y8G("title",null),Fl.R7$(),Fl.Y8G("appA11yTitle",t.currentUrl()),Fl.R7$(),Fl.SpI(" ",t.currentUrl()," "),Fl.R7$(2),Fl.vxM(t.viewOnly()?-1:15),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(18,17,t.viewOnly()?"autofill":"autofillWithoutAdding")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(21,19,"doNotAutofill")," "))},dependencies:[id,td,ud,kl.MD,kl.YU,Fh,Ph,Hh,uw,tc,rc,sf,rw,rf],encapsulation:2,changeDetection:0});var Y6=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function H6(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"button",4),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(3);return a.Njj(t.doAutofill())}),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.bVm()}2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"autofill")," "))}function J6(e,t){if(1&e&&(Fl.DNE(0,H6,4,3,"ng-container",5),Fl.nI1(1,"async")),2&e){const e=Fl.XpG(2);Fl.Y8G("ngIf",Fl.bMT(1,1,e.autofillAllowed$))}}function Z6(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",4),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.onView())}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"view")," "))}function Q6(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",4),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.edit())}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"edit")," "))}function e7(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"a",7),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(3);return a.Njj(t.clone())}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"clone")," "))}function t7(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"a",7),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(3);return a.Njj(t.conditionallyNavigateToAssignCollections())}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"assignToCollections")," "))}function i7(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,e7,3,3,"a",6),Fl.nI1(2,"async"),Fl.DNE(3,t7,3,3,"a",6),Fl.nI1(4,"async"),Fl.bVm()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("ngIf",Fl.bMT(2,2,e.canClone$)),Fl.R7$(2),Fl.Y8G("ngIf",Fl.bMT(4,4,e.canAssignCollections$))}}function n7(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",4),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(3);return a.Njj(t.archive())}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"archiveVerb")," "))}function r7(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",4),Fl.nI1(1,"i18n"),Fl.bIt("click",function(t){a.eBV(e);const i=Fl.sdS(7);return a.Njj(i.promptForPremium(t))}),Fl.j41(2,"div",8),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.j41(5,"div",9),Fl.nrm(6,"app-premium-badge",null,1),Fl.k0s()()()}2&e&&(Fl.BMQ("aria-label",Fl.bMT(1,2,"upgradeToUseArchive")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,4,"archiveVerb")," "))}function s7(e,t){if(1&e&&(Fl.nVh(0,n7,3,3,"button",3),Fl.nI1(1,"async"),Fl.vZN(2,r7,8,6,"button",3)),2&e){const e=Fl.XpG(2);Fl.vxM(Fl.bMT(1,1,e.canArchive$)?0:2)}}function o7(e,t){if(1&e){const e=Fl.RV6();Fl.nVh(0,J6,2,3,"ng-container"),Fl.nVh(1,Z6,3,3,"button",3),Fl.j41(2,"button",4),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.toggleFavorite())}),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.nVh(5,Q6,3,3,"button",3),Fl.DNE(6,i7,5,6,"ng-container",5),Fl.nVh(7,s7,3,3),Fl.nI1(8,"async")}if(2&e){const e=Fl.XpG();Fl.vxM(e.canAutofill&&e.showAutofill()?0:-1),Fl.R7$(),Fl.vxM(e.showViewOption()?1:-1),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(4,6,e.favoriteText)," "),Fl.R7$(2),Fl.vxM(e.canEdit?5:-1),Fl.R7$(),Fl.Y8G("ngIf",e.canEdit&&e.canViewPassword),Fl.R7$(),Fl.vxM(Fl.bMT(8,8,e.showArchive$)?7:-1)}}function a7(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",4),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.delete())}),Fl.j41(1,"span",10),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()()}2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"delete")," "))}class l7{set cipher(e){this._cipher$.next(e)}get cipher(){return this._cipher$.value}constructor(e,t,i,n,r,s,a,c,u,d,h,p,v,f){this.cipherService=e,this.passwordRepromptService=t,this.toastService=i,this.dialogService=n,this.router=r,this.i18nService=s,this.vaultPopupAutofillService=a,this.accountService=c,this.organizationService=u,this.cipherAuthorizationService=d,this.collectionService=h,this.restrictedItemTypesService=p,this.cipherArchiveService=v,this.domainSettingsService=f,this._cipher$=new Dd.t({}),this.showAutofill=(0,o.hFB)(!1,{transform:o.L39}),this.showViewOption=(0,o.hFB)(!1,{transform:o.L39}),this.autofillAllowed$=this.vaultPopupAutofillService.autofillAllowed$,this.uriMatchStrategy$=this.domainSettingsService.resolvedDefaultUriMatchStrategy$,this.canClone$=(0,jo.z)([this._cipher$,this.restrictedItemTypesService.restricted$]).pipe((0,Eo.p)(([e])=>null!=e),(0,go.n)(([e,t])=>t.some(t=>t.cipherType===t$.getType(e))?new Dd.t(!1):this.cipherAuthorizationService.canCloneCipher$(e))),this.canAssignCollections$=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>(0,jo.z)([this.organizationService.hasOrganizations(e),this.collectionService.decryptedCollections$(e)]).pipe((0,l.T)(([e,t])=>{const i=t.some(e=>!e.readOnly);return e&&i})))),this.showArchive$=this.cipherArchiveService.hasArchiveFlagEnabled$,this.canArchive$=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.cipherArchiveService.userCanArchive$(e))),this.canDelete$=this._cipher$.pipe((0,go.n)(e=>this.cipherAuthorizationService.canDeleteCipher$(e)))}get canEdit(){return this.cipher.edit}get canViewPassword(){return this.cipher.viewPassword}get decryptionFailure(){return t$.decryptionFailure(this.cipher)}get canAutofill(){return[nx.Login,nx.Card,nx.Identity].includes(t$.getType(this.cipher))}get isLogin(){return t$.getType(this.cipher)===nx.Login}get favoriteText(){return this.cipher.favorite?"unfavorite":"favorite"}doAutofillAndSave(){return Y6(this,void 0,void 0,function*(){const e=yield this.cipherService.getFullCipherView(this.cipher);yield this.vaultPopupAutofillService.doAutofillAndSave(e)})}doAutofill(){return Y6(this,void 0,void 0,function*(){var e,t,i,n,r;const s=yield this.cipherService.getFullCipherView(this.cipher);if(!(yield this.passwordRepromptService.passwordRepromptCheck(this.cipher)))return;const o=null!==(t=null===(e=s.login)||void 0===e?void 0:e.uris)&&void 0!==t?t:[],a=yield(0,bo._)(this.uriMatchStrategy$),l=0===o.length?a===GE.Exact:o.every(e=>{var t;return(null!==(t=e.match)&&void 0!==t?t:a)===GE.Exact});if(l)return void(yield this.dialogService.openSimpleDialog({title:{key:"cannotAutofill"},content:{key:"cannotAutofillExactMatch"},type:"info",acceptButtonText:{key:"okay"},cancelButtonText:null}));const c=yield(0,bo._)(this.vaultPopupAutofillService.currentAutofillTab$);if(!(null==c?void 0:c.url))return void(yield this.dialogService.openSimpleDialog({title:{key:"error"},content:{key:"errorGettingAutoFillData"},type:"danger"}));const u=W6.open(this.dialogService,{data:{currentUrl:(null==c?void 0:c.url)||"",savedUrls:null!==(r=null===(n=null===(i=s.login)||void 0===i?void 0:i.uris)||void 0===n?void 0:n.filter(e=>e.uri).map(e=>e.uri))&&void 0!==r?r:[],viewOnly:!this.cipher.edit}});switch(yield(0,bo._)(u.closed)){case q6.Canceled:return;case q6.AutofilledOnly:return void(yield this.vaultPopupAutofillService.doAutofill(s,!0,!0));case q6.AutofillAndUrlAdded:return void(yield this.vaultPopupAutofillService.doAutofillAndSave(s,!1,!0))}})}onView(){return Y6(this,void 0,void 0,function*(){(yield this.passwordRepromptService.passwordRepromptCheck(this.cipher))&&(yield this.router.navigate(["/view-cipher"],{queryParams:{cipherId:this.cipher.id,type:t$.getType(this.cipher)}}))})}toggleFavorite(){return Y6(this,void 0,void 0,function*(){const e=yield this.cipherService.getFullCipherView(this.cipher);e.favorite=!e.favorite;const t=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)));yield this.cipherService.updateWithServer(e,t),this.toastService.showToast({variant:"success",message:this.i18nService.t(e.favorite?"itemAddedToFavorites":"itemRemovedFromFavorites")})})}clone(){return Y6(this,void 0,void 0,function*(){if(this.cipher.reprompt!==tx.Password||(yield this.passwordRepromptService.showPasswordPrompt())){if(t$.hasFido2Credentials(this.cipher)){if(!(yield this.dialogService.openSimpleDialog({title:{key:"passkeyNotCopied"},content:{key:"passkeyNotCopiedAlert"},type:"info"})))return}yield this.router.navigate(["/clone-cipher"],{queryParams:{clone:(!0).toString(),cipherId:this.cipher.id,type:t$.getType(this.cipher).toString()}})}})}conditionallyNavigateToAssignCollections(){return Y6(this,void 0,void 0,function*(){this.cipher.reprompt&&!(yield this.passwordRepromptService.showPasswordPrompt())||(yield this.router.navigate(["/assign-collections"],{queryParams:{cipherId:this.cipher.id}}))})}edit(){return Y6(this,void 0,void 0,function*(){this.cipher.reprompt&&!(yield this.passwordRepromptService.showPasswordPrompt())||(yield this.router.navigate(["/edit-cipher"],{queryParams:{cipherId:this.cipher.id,type:t$.getType(this.cipher)}}))})}delete(){return Y6(this,void 0,void 0,function*(){if(!(yield this.passwordRepromptService.passwordRepromptCheck(this.cipher)))return;if(!(yield this.dialogService.openSimpleDialog({title:{key:"deleteItem"},content:{key:"deleteItemConfirmation"},type:"warning"})))return;const e=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));yield this.cipherService.softDeleteWithServer(this.cipher.id,e),this.toastService.showToast({variant:"success",message:this.i18nService.t("deletedItem")})})}archive(){return Y6(this,void 0,void 0,function*(){if(!(yield this.passwordRepromptService.passwordRepromptCheck(this.cipher)))return;if(!(yield this.dialogService.openSimpleDialog({title:{key:"archiveItem"},content:{key:"archiveItemDialogContent"},acceptButtonText:{key:"archiveVerb"},type:"info"})))return;const e=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));yield this.cipherArchiveService.archiveWithServer(this.cipher.id,e),this.toastService.showToast({variant:"success",message:this.i18nService.t("itemArchiveToast")})})}}l7.ɵfac=function(e){return new(e||l7)(Fl.rXU(_b),Fl.rXU(k$),Fl.rXU(qb),Fl.rXU(lh),Fl.rXU(Fd.Ix),Fl.rXU(Ul),Fl.rXU(S8),Fl.rXU(Zk),Fl.rXU(WF),Fl.rXU(L$),Fl.rXU(uR),Fl.rXU(r$),Fl.rXU($V),Fl.rXU(YE))},l7.ɵcmp=Fl.VBU({type:l7,selectors:[["app-item-more-options"]],inputs:{cipher:"cipher",showAutofill:[1,"showAutofill"],showViewOption:[1,"showViewOption"]},features:[Fl.Jv_([{provide:qU,useClass:K2}])],decls:8,vars:8,consts:[["moreOptions",""],["badge",""],["type","button","bitIconButton","bwi-ellipsis-v","size","small",3,"label","bitMenuTriggerFor"],["type","button","bitMenuItem",""],["type","button","bitMenuItem","",3,"click"],[4,"ngIf"],["bitMenuItem","",3,"click",4,"ngIf"],["bitMenuItem","",3,"click"],[1,"tw-flex","tw-flex-nowrap","tw-items-center","tw-gap-2"],["aria-hidden",""],[1,"tw-text-danger"]],template:function(e,t){if(1&e&&(Fl.j41(0,"bit-item-action"),Fl.nrm(1,"button",2),Fl.nI1(2,"i18n"),Fl.j41(3,"bit-menu",null,0),Fl.nVh(5,o7,9,10),Fl.nVh(6,a7,4,3,"button",3),Fl.nI1(7,"async"),Fl.k0s()()),2&e){const e=Fl.sdS(4);Fl.R7$(),Fl.Y8G("label",Fl.bMT(2,4,"moreOptionsLabelNoPlaceholder"))("bitMenuTriggerFor",e),Fl.R7$(4),Fl.vxM(t.decryptionFailure?-1:5),Fl.R7$(),Fl.vxM(Fl.bMT(7,6,t.canDelete$)?6:-1)}},dependencies:[VP,BP,Ql,Zl,qh,pz,fz,D$,kl.MD,kl.bT,sf,Cw.iI,ZU,kl.Jj,rf],encapsulation:2});var c7=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const u7=(e,t)=>({"tw-border-b-secondary-300 tw-rounded-b-none [&:is(:hover,:focus-visible)]:tw-border-b-transparent [&:is(:hover,:focus-visible)]:tw-rounded-b-md":e,"tw-border-b-transparent":t}),d7=(e,t)=>({"group-hover/vault-section-header:tw-hidden group-focus-visible/vault-section-header:tw-hidden":e,"tw-hidden":t}),h7=(e,t)=>({"bwi-angle-down tw-inline-block":e,"bwi-angle-up tw-hidden group-hover/vault-section-header:tw-inline-block group-focus-visible/vault-section-header:tw-inline-block":t}),p7=e=>({"!tw-mb-0":e}),v7=e=>({"hover:tw-bg-hover-default hover:tw-cursor-pointer":e});function f7(e,t){1&e&&Fl.eu8(0)}function m7(e,t){1&e&&Fl.eu8(0)}function g7(e,t){1&e&&Fl.eu8(0)}function y7(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"button",7),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.toggleSectionOpen())}),Fl.DNE(2,f7,1,0,"ng-container",8),Fl.k0s(),Fl.DNE(3,m7,1,0,"ng-container",8),Fl.j41(4,"bit-disclosure",9,3),Fl.bIt("openChange",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.rerenderViewport())}),Fl.DNE(6,g7,1,0,"ng-container",8),Fl.k0s(),Fl.bVm()}if(2&e){const e=Fl.sdS(5),t=Fl.XpG(2),i=Fl.sdS(2),n=Fl.sdS(4),r=Fl.sdS(6);Fl.R7$(),Fl.Y8G("ngClass",Fl.l_i(6,u7,!t.sectionOpenState(),t.sectionOpenState()))("bitDisclosureTriggerFor",e),Fl.R7$(),Fl.Y8G("ngTemplateOutlet",i),Fl.R7$(),Fl.Y8G("ngTemplateOutlet",n),Fl.R7$(),Fl.Y8G("open",t.sectionOpenState()),Fl.R7$(2),Fl.Y8G("ngTemplateOutlet",r)}}function b7(e,t){1&e&&Fl.eu8(0)}function w7(e,t){1&e&&Fl.eu8(0)}function S7(e,t){1&e&&Fl.eu8(0)}function k7(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"div",10),Fl.DNE(2,b7,1,0,"ng-container",8),Fl.k0s(),Fl.DNE(3,w7,1,0,"ng-container",8)(4,S7,1,0,"ng-container",8),Fl.bVm()),2&e){Fl.XpG(2);const e=Fl.sdS(2),t=Fl.sdS(4),i=Fl.sdS(6);Fl.R7$(2),Fl.Y8G("ngTemplateOutlet",e),Fl.R7$(),Fl.Y8G("ngTemplateOutlet",t),Fl.R7$(),Fl.Y8G("ngTemplateOutlet",i)}}function I7(e,t){if(1&e&&(Fl.j41(0,"bit-section",5),Fl.DNE(1,y7,7,9,"ng-container",6)(2,k7,5,3,"ng-container",6),Fl.k0s()),2&e){const e=Fl.XpG();Fl.Y8G("disableMargin",e.disableSectionMargin()),Fl.R7$(),Fl.Y8G("ngIf",e.collapsibleKey()),Fl.R7$(),Fl.Y8G("ngIf",!e.collapsibleKey())}}function C7(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",17),Fl.nI1(1,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.onRefresh.emit())}),Fl.k0s()}2&e&&Fl.Y8G("label",Fl.bMT(1,1,"refresh"))}function T7(e,t){if(1&e&&(Fl.j41(0,"span",18),Fl.nrm(1,"i",19),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("ngClass",Fl.l_i(1,h7,!e.sectionOpenState(),e.sectionOpenState()))}}function P7(e,t){if(1&e&&(Fl.j41(0,"bit-section-header",11)(1,"h2",12),Fl.EFF(2),Fl.k0s(),Fl.DNE(3,C7,2,3,"button",13),Fl.j41(4,"span",14)(5,"span",15),Fl.EFF(6),Fl.k0s(),Fl.DNE(7,T7,2,4,"span",16),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.SpI(" ",e.title()," "),Fl.R7$(),Fl.Y8G("ngIf",e.showRefresh()),Fl.R7$(2),Fl.Y8G("ngClass",Fl.l_i(5,d7,e.collapsibleKey()&&e.sectionOpenState(),e.collapsibleKey()&&!e.sectionOpenState())),Fl.R7$(),Fl.SpI(" ",e.ciphers().length," "),Fl.R7$(),Fl.Y8G("ngIf",e.collapsibleKey())}}function F7(e,t){if(1&e&&(Fl.j41(0,"div",21),Fl.EFF(1),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.Y8G("ngClass",Fl.eq3(2,p7,e.disableDescriptionMargin())),Fl.R7$(),Fl.SpI(" ",e.description()," ")}}function R7(e,t){if(1&e&&Fl.DNE(0,F7,2,4,"div",20),2&e){const e=Fl.XpG();Fl.Y8G("ngIf",e.description())}}function x7(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"h3",25),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.bVm()),2&e){const e=Fl.XpG().$implicit;Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,e.subHeaderKey)," ")}}function A7(e,t){if(1&e&&Fl.nrm(0,"i",37),2&e){const e=Fl.XpG().$implicit,t=Fl.XpG(3);Fl.Y8G("tierType",e.organization.productTierType)("size","small")("appA11yTitle",t.orgIconTooltip(e))}}function D7(e,t){1&e&&(Fl.nrm(0,"i",38),Fl.nI1(1,"i18n")),2&e&&Fl.Y8G("appA11yTitle",Fl.bMT(1,1,"attachments"))}function E7(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-item-action")(1,"button",39),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG().$implicit,i=Fl.XpG(3);return a.Njj(i.doAutofill(t))}),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()()}2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"fill")," "))}function $7(e,t){var i;if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-item-action")(1,"button",40),Fl.nI1(2,"i18n"),Fl.nI1(3,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG().$implicit,i=Fl.XpG(3);return a.Njj(i.doAutofill(t))}),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()()}if(2&e){const e=Fl.XpG().$implicit,t=Fl.XpG(3);Fl.R7$(),Fl.Y8G("title",null!==(i=t.autofillShortcutTooltip())&&void 0!==i?i:Fl.i5U(2,3,"autofillTitle",e.name)),Fl.BMQ("aria-label",Fl.i5U(3,6,"autofillTitle",e.name)),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(5,9,"fill")," ")}}function O7(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-item-action")(1,"button",41),Fl.nI1(2,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG().$implicit,i=Fl.XpG(3);return a.Njj(i.launchCipher(t))}),Fl.k0s()()}if(2&e){const e=Fl.XpG().$implicit;Fl.R7$(),Fl.Y8G("label",Fl.i5U(2,1,"launchWebsiteName",e.name))}}function U7(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-item",26)(1,"button",27),Fl.nI1(2,"i18n"),Fl.bIt("click",function(){const t=a.eBV(e).$implicit,i=Fl.XpG(3);return a.Njj(i.onCipherSelect(t))})("dblclick",function(){const t=a.eBV(e).$implicit,i=Fl.XpG(3);return a.Njj(i.launchCipher(t))}),Fl.j41(3,"div",28),Fl.nrm(4,"app-vault-icon",29),Fl.k0s(),Fl.j41(5,"span",30),Fl.EFF(6),Fl.k0s(),Fl.j41(7,"div",31),Fl.DNE(8,A7,1,3,"i",32)(9,D7,2,3,"i",33),Fl.k0s(),Fl.j41(10,"span",34),Fl.EFF(11),Fl.k0s()(),Fl.qex(12,35),Fl.nVh(13,E7,4,3,"bit-item-action"),Fl.nVh(14,$7,6,11,"bit-item-action"),Fl.nVh(15,O7,3,4,"bit-item-action"),Fl.nrm(16,"app-item-copy-actions",29)(17,"app-item-more-options",36),Fl.bVm(),Fl.k0s()}if(2&e){let e;const i=t.$implicit,n=Fl.XpG(3);Fl.Y8G("ngClass",Fl.eq3(20,v7,n.showFillTextOnHover())),Fl.R7$(),Fl.HbH(n.itemHeightClass),Fl.Y8G("appA11yTitle",Fl.brH(2,16,n.cipherItemTitleKey()(i),i.name,null==(e=n.CipherViewLikeUtils.getLogin(i))?null:e.username)),Fl.R7$(3),Fl.Y8G("cipher",i),Fl.R7$(2),Fl.JRh(i.name),Fl.R7$(2),Fl.Y8G("ngIf",i.organizationId),Fl.R7$(),Fl.Y8G("ngIf",n.CipherViewLikeUtils.hasAttachments(i)),Fl.R7$(2),Fl.JRh(n.CipherViewLikeUtils.subtitle(i)),Fl.R7$(2),Fl.vxM(n.showFillTextOnHover()?13:-1),Fl.R7$(),Fl.vxM(n.showAutofillBadge()?14:-1),Fl.R7$(),Fl.vxM(n.showLaunchButton()&&n.CipherViewLikeUtils.canLaunch(i)?15:-1),Fl.R7$(),Fl.Y8G("cipher",i),Fl.R7$(),Fl.Y8G("cipher",i)("showAutofill",n.showAutofillInMenu())("showViewOption",n.showViewInMenu())}}function M7(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,x7,4,3,"ng-container",6),Fl.j41(2,"cdk-virtual-scroll-viewport",23),Fl.nI1(3,"async"),Fl.DNE(4,U7,18,22,"bit-item",24),Fl.k0s(),Fl.bVm()),2&e){const e=t.$implicit,i=Fl.XpG(2);Fl.R7$(),Fl.Y8G("ngIf",e.subHeaderKey),Fl.R7$(),Fl.Y8G("itemSize",Fl.bMT(3,3,i.itemHeight$)),Fl.R7$(2),Fl.Y8G("cdkVirtualForOf",e.ciphers)}}function N7(e,t){if(1&e&&(Fl.j41(0,"bit-item-group"),Fl.DNE(1,M7,5,5,"ng-container",22),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("ngForOf",e.cipherGroups())}}class V7{orgIconTooltip({collectionIds:e,collections:t}){var i;return e.length>1||!t?this.i18nService.t("nCollections",e.length):null===(i=t[0])||void 0===i?void 0:i.name}constructor(e,t,i,n,r,s,c,u){this.i18nService=e,this.vaultPopupAutofillService=t,this.passwordRepromptService=i,this.cipherService=n,this.router=r,this.platformUtilsService=s,this.dialogService=c,this.accountService=u,this.compactModeService=(0,a.WQX)(w6),this.vaultPopupSectionService=(0,a.WQX)(C6),this.configService=(0,a.WQX)(Kb),this.CipherViewLikeUtils=t$,this.simplifiedItemActionEnabled=(0,xl.ot)(this.configService.getFeatureFlag$(Wv.PM31039ItemActionInExtension),{initialValue:!1}),this.sectionOpenState=(0,Rl.EW)(()=>{var e;return!this.collapsibleKey()||(null===(e=this.vaultPopupSectionService.getOpenDisplayStateForSection(this.collapsibleKey())())||void 0===e||e)}),this.itemHeightClass="tw-h-[52px]",this.itemHeight$=this.compactModeService.enabled$.pipe((0,l.T)(e=>e?53:59)),this.ciphers=(0,o.hFB)([]),this.groupByType=(0,o.hFB)(!1),this.cipherGroups=(0,Rl.EW)(()=>{const e=this.ciphers();if(!this.groupByType()&&e.length>0)return[{ciphers:e}];const t={};return e.forEach(e=>{let i="all";switch(t$.getType(e)){case nx.Card:i="cards";break;case nx.Identity:i="identities"}t[i]||(t[i]=[]),t[i].push(e)}),Object.entries(t).map(([e,t])=>({subHeaderKey:"all"!=e?e:void 0,ciphers:t}))}),this.title=(0,o.hFB)(void 0),this.collapsibleKey=(0,o.hFB)(void 0),this.description=(0,o.hFB)(void 0),this.showRefresh=(0,o.hFB)(!1,{transform:o.L39}),this.onRefresh=new Fl.bkB,this.currentUriIsBlocked=(0,xl.ot)(this.vaultPopupAutofillService.currentTabIsOnBlocklist$),this.cipherItemTitleKey=(0,Rl.EW)(()=>e=>{const t=t$.getLogin(e),i=null!=(null==t?void 0:t.username),n=this.canAutofill()?"autofillTitle":"viewItemTitle";return i?`${n}WithField`:n}),this.showAutofillButton=(0,o.hFB)(!1,{transform:o.L39}),this.showAutofillBadge=(0,Rl.EW)(()=>!this.simplifiedItemActionEnabled()&&!this.hideAutofillButton()),this.hideAutofillMenuOptions=(0,Rl.EW)(()=>this.currentUriIsBlocked()||this.showAutofillButton()),this.primaryActionAutofill=(0,o.hFB)(!1,{transform:o.L39}),this.hideAutofillButton=(0,Rl.EW)(()=>!this.showAutofillButton()||this.currentUriIsBlocked()||this.primaryActionAutofill()),this.isAutofillList=(0,o.hFB)(!1,{transform:o.L39}),this.canAutofill=(0,Rl.EW)(()=>!this.currentUriIsBlocked()&&(this.simplifiedItemActionEnabled()?this.isAutofillList():this.primaryActionAutofill())),this.showFillTextOnHover=(0,Rl.EW)(()=>this.simplifiedItemActionEnabled()&&this.canAutofill()),this.showLaunchButton=(0,Rl.EW)(()=>this.simplifiedItemActionEnabled()?!this.isAutofillList():!this.showAutofillButton()),this.showAutofillInMenu=(0,Rl.EW)(()=>this.simplifiedItemActionEnabled()?!this.canAutofill():!this.hideAutofillMenuOptions()),this.showViewInMenu=(0,Rl.EW)(()=>this.simplifiedItemActionEnabled()?this.isAutofillList():this.primaryActionAutofill()),this.disableSectionMargin=(0,o.hFB)(!1,{transform:o.L39}),this.disableDescriptionMargin=(0,o.hFB)(!1,{transform:o.L39}),this.autofillShortcutTooltip=(0,a.vPA)(void 0)}ngAfterViewInit(){return c7(this,void 0,void 0,function*(){const e=yield this.platformUtilsService.getAutofillKeyboardShortcut();if(""===e)this.autofillShortcutTooltip.set(void 0);else{const t=this.i18nService.t("autoFill");this.autofillShortcutTooltip.set(`${t} ${e}`)}})}onCipherSelect(e){return this.canAutofill()?this.doAutofill(e):this.onViewCipher(e)}launchCipher(e){return c7(this,void 0,void 0,function*(){const t=t$.getLaunchUri(e);if(!t$.canLaunch(e)||!t)return;null!=this.viewCipherTimeout&&(window.clearTimeout(this.viewCipherTimeout),this.viewCipherTimeout=void 0);const i=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));yield this.cipherService.updateLastLaunchedDate(e.id,i),yield ul.createNewTab(t),pl.inPopup(window)&&ul.closePopup(window)})}doAutofill(e){return c7(this,void 0,void 0,function*(){if(!t$.isCipherListView(e))return void(yield this.vaultPopupAutofillService.doAutofill(e));const t=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv)),i=yield this.cipherService.get(e.id,t),n=yield this.cipherService.decrypt(i,t);yield this.vaultPopupAutofillService.doAutofill(n)})}onViewCipher(e){return c7(this,void 0,void 0,function*(){null==this.viewCipherTimeout&&(this.viewCipherTimeout=window.setTimeout(()=>c7(this,void 0,void 0,function*(){try{if(t$.decryptionFailure(e))return void NL.open(this.dialogService,{cipherIds:[e.id]});if(!(yield this.passwordRepromptService.passwordRepromptCheck(e)))return;yield this.router.navigate(["/view-cipher"],{queryParams:{cipherId:e.id,type:e.type}})}finally{this.viewCipherTimeout=void 0}}),t$.canLaunch(e)?200:0))})}toggleSectionOpen(){return c7(this,void 0,void 0,function*(){this.collapsibleKey()&&(yield this.vaultPopupSectionService.updateSectionOpenStoredState(this.collapsibleKey(),this.disclosure.open()))})}rerenderViewport(){setTimeout(()=>{this.viewPort.checkViewportSize()})}}function B7(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"app-vault-list-items-container",1),Fl.nI1(1,"async"),Fl.nI1(2,"i18n"),Fl.nI1(3,"async"),Fl.nI1(4,"i18n"),Fl.nI1(5,"async"),Fl.nI1(6,"async"),Fl.bIt("onRefresh",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.refreshCurrentTab())}),Fl.k0s()}if(2&e){const e=t.ngIf,i=Fl.XpG();Fl.Y8G("ciphers",e)("title",Fl.bMT(2,9,Fl.bMT(1,7,i.currentURIIsBlocked$)?"itemSuggestions":"autofillSuggestions"))("showRefresh",i.showRefresh)("description",Fl.bMT(3,11,i.showEmptyAutofillTip$)?Fl.bMT(4,13,"autofillSuggestionsTip"):void 0)("disableDescriptionMargin",Fl.bMT(5,15,i.showEmptyAutofillTip$))("groupByType",i.groupByType())("primaryActionAutofill",Fl.bMT(6,17,i.clickItemsToAutofillVaultView$))}}V7.ɵfac=function(e){return new(e||V7)(Fl.rXU(Ul),Fl.rXU(S8),Fl.rXU(k$),Fl.rXU(_b),Fl.rXU(Fd.Ix),Fl.rXU(Hb),Fl.rXU(lh),Fl.rXU(Zk))},V7.ɵcmp=Fl.VBU({type:V7,selectors:[["app-vault-list-items-container"]],viewQuery:function(e,t){if(1&e&&(Fl.GBs(Sl.d6,5),Fl.GBs(Q8,5)),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.viewPort=e.first),Fl.mGM(e=Fl.lsd())&&(t.disclosure=e.first)}},inputs:{ciphers:[1,"ciphers"],groupByType:[1,"groupByType"],title:[1,"title"],collapsibleKey:[1,"collapsibleKey"],description:[1,"description"],showRefresh:[1,"showRefresh"],showAutofillButton:[1,"showAutofillButton"],primaryActionAutofill:[1,"primaryActionAutofill"],isAutofillList:[1,"isAutofillList"],disableSectionMargin:[1,"disableSectionMargin"],disableDescriptionMargin:[1,"disableDescriptionMargin"]},outputs:{onRefresh:"onRefresh"},decls:7,vars:1,consts:[["sectionHeader",""],["descriptionText",""],["itemGroup",""],["disclosureRef",""],[3,"disableMargin",4,"ngIf"],[3,"disableMargin"],[4,"ngIf"],["type","button",1,"tw-group/vault-section-header","hover:tw-bg-primary-100","tw-rounded-md","tw-pl-1","tw-w-full","tw-border-x-0","tw-border-t-0","tw-border-b","tw-border-solid","focus-visible:tw-outline-none","focus-visible:tw-ring-inset","focus-visible:tw-ring-2","focus-visible:tw-ring-primary-600",3,"click","ngClass","bitDisclosureTriggerFor"],[4,"ngTemplateOutlet"],[3,"openChange","open"],[1,"tw-pl-1"],[1,"tw-p-0.5","-tw-mx-0.5"],["bitTypography","h6"],["bitIconButton","bwi-refresh","type","button","size","small",3,"label","click",4,"ngIf"],["bitTypography","body2","slot","end"],[3,"ngClass"],["class","tw-pr-1",4,"ngIf"],["bitIconButton","bwi-refresh","type","button","size","small",3,"click","label"],[1,"tw-pr-1"],["aria-hidden","true",1,"bwi","tw-text-main",3,"ngClass"],["class","tw-text-muted tw-px-1 tw-mb-2","bitTypography","body2",3,"ngClass",4,"ngIf"],["bitTypography","body2",1,"tw-text-muted","tw-px-1","tw-mb-2",3,"ngClass"],[4,"ngFor","ngForOf"],["bitScrollLayout","",3,"itemSize"],["class","tw-group/vault-item",3,"ngClass",4,"cdkVirtualFor","cdkVirtualForOf"],[1,"tw-text-muted","tw-text-xs","tw-font-medium","tw-pl-1","tw-mb-1","bit-compact:tw-m-0"],[1,"tw-group/vault-item",3,"ngClass"],["bit-item-content","","type","button",3,"click","dblclick","appA11yTitle"],["slot","start",1,"tw-justify-start","tw-w-7","tw-flex"],[3,"cipher"],["data-testid","item-name"],["slot","default-trailing",1,"tw-flex","tw-gap-1.5"],["slot","default-trailing","appOrgIcon","",3,"tierType","size","appA11yTitle",4,"ngIf"],["class","bwi bwi-paperclip bwi-sm",3,"appA11yTitle",4,"ngIf"],["slot","secondary"],["slot","end"],[3,"cipher","showAutofill","showViewOption"],["slot","default-trailing","appOrgIcon","",3,"tierType","size","appA11yTitle"],[1,"bwi","bwi-paperclip","bwi-sm",3,"appA11yTitle"],["type","button",1,"tw-opacity-0","tw-text-primary-600","tw-px-2","tw-bg-transparent","tw-border-0","group-hover/vault-item:tw-opacity-100","group-focus-within/vault-item:tw-opacity-100",3,"click"],["type","button","bitBadge","","variant","primary",3,"click","title"],["type","button","bitIconButton","bwi-external-link","size","small",3,"click","label"]],template:function(e,t){1&e&&Fl.DNE(0,I7,3,3,"bit-section",4)(1,P7,8,8,"ng-template",null,0,Fl.C5r)(3,R7,1,1,"ng-template",null,1,Fl.C5r)(5,N7,2,1,"ng-template",null,2,Fl.C5r),2&e&&Fl.Y8G("ngIf",t.cipherGroups().length>0||t.description())},dependencies:[kl.MD,kl.YU,kl.Sq,kl.bT,kl.T3,VP,GP,KP,BP,XP,id,eu,Qc,Ql,Zl,Ux,tc,rc,sf,rw,RU,Nx,L6,l7,G$,Sl.E9,Sl.yg,Sl.E$,Sl.d6,Q8,e6,Dh,kl.Jj,rf],encapsulation:2,changeDetection:0});class j7{constructor(e,t,i){this.vaultPopupItemsService=e,this.vaultPopupAutofillService=t,this.vaultSettingsService=i,this.autofillCiphers$=this.vaultPopupItemsService.autoFillCiphers$,this.showRefresh=pl.inSidebar(window),this.clickItemsToAutofillVaultView$=this.vaultSettingsService.clickItemsToAutofillVaultView$.pipe((0,kd.Z)(!0)),this.groupByType=(0,xl.ot)(this.vaultPopupItemsService.hasFilterApplied$.pipe((0,l.T)(e=>!e))),this.showEmptyAutofillTip$=(0,jo.z)([this.vaultPopupItemsService.hasFilterApplied$,this.autofillCiphers$,this.vaultPopupAutofillService.autofillAllowed$]).pipe((0,l.T)(([e,t,i])=>!e&&i&&0===t.filter(e=>t$.getType(e)==nx.Login).length)),this.currentURIIsBlocked$=this.vaultPopupAutofillService.currentTabIsOnBlocklist$}refreshCurrentTab(){this.vaultPopupAutofillService.refreshCurrentTab()}}j7.ɵfac=function(e){return new(e||j7)(Fl.rXU(F8),Fl.rXU(S8),Fl.rXU(FY))},j7.ɵcmp=Fl.VBU({type:j7,selectors:[["app-autofill-vault-list-items"]],decls:2,vars:3,consts:[["isAutofillList","","showAutofillButton","",3,"ciphers","title","showRefresh","description","disableDescriptionMargin","groupByType","primaryActionAutofill","onRefresh",4,"ngIf"],["isAutofillList","","showAutofillButton","",3,"onRefresh","ciphers","title","showRefresh","description","disableDescriptionMargin","groupByType","primaryActionAutofill"]],template:function(e,t){1&e&&(Fl.DNE(0,B7,7,19,"app-vault-list-items-container",0),Fl.nI1(1,"async")),2&e&&Fl.Y8G("ngIf",Fl.bMT(1,1,t.autofillCiphers$))},dependencies:[kl.MD,kl.bT,tc,V7,sf,Ql,kl.Jj,rf],encapsulation:2});var G7=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const L7=()=>["/add-cipher"],z7=()=>({prefillNameAndURIFromTab:!0}),_7=()=>[];function K7(e,t){if(1&e&&(Fl.j41(0,"vault-fade-in-out")(1,"div",7)(2,"bit-no-items",8),Fl.qex(3,9),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.bVm(),Fl.qex(6,10),Fl.j41(7,"p",11),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.bVm(),Fl.j41(10,"a",12),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s()()()()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.Y8G("icon",e.vaultIcon),Fl.R7$(2),Fl.JRh(Fl.bMT(5,6,"yourVaultIsEmpty")),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(9,8,"emptyVaultDescription")," "),Fl.R7$(2),Fl.Y8G("routerLink",Fl.lJ4(12,L7))("queryParams",Fl.lJ4(13,z7)),Fl.R7$(),Fl.SpI(" ",Fl.bMT(12,10,"newLogin")," ")}}function X7(e,t){1&e&&Fl.nrm(0,"blocked-injection-banner",13)}function q7(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"bit-spotlight",14),Fl.nI1(2,"i18n"),Fl.nI1(3,"i18n"),Fl.nI1(4,"i18n"),Fl.bIt("onButtonClick",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.showPremiumDialog())})("onDismiss",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.dismissVaultNudgeSpotlight(t.NudgeType.PremiumUpgrade))}),Fl.k0s(),Fl.bVm()}2&e&&(Fl.R7$(),Fl.Y8G("title",Fl.bMT(2,3,"unlockAdvancedSecurity"))("subtitle",Fl.bMT(3,5,"unlockAdvancedSecurityDesc"))("buttonText",Fl.bMT(4,7,"explorePremium")))}function W7(e,t){if(1&e){const e=Fl.RV6();Fl.qex(0),Fl.j41(1,"bit-spotlight",14),Fl.nI1(2,"i18n"),Fl.nI1(3,"i18n"),Fl.nI1(4,"i18n"),Fl.bIt("onButtonClick",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.navigateToImport())})("onDismiss",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.dismissVaultNudgeSpotlight(t.NudgeType.EmptyVaultNudge))}),Fl.k0s(),Fl.bVm()}2&e&&(Fl.R7$(),Fl.Y8G("title",Fl.bMT(2,3,"emptyVaultNudgeTitle"))("subtitle",Fl.bMT(3,5,"emptyVaultNudgeBody"))("buttonText",Fl.bMT(4,7,"emptyVaultNudgeButton")))}function Y7(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"div",16)(1,"bit-spotlight",17),Fl.nI1(2,"i18n"),Fl.bIt("onDismiss",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.dismissVaultNudgeSpotlight(t.NudgeType.HasVaultItems))}),Fl.j41(3,"ul",18)(4,"li"),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s(),Fl.j41(7,"li"),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.k0s(),Fl.j41(10,"li"),Fl.EFF(11),Fl.nI1(12,"i18n"),Fl.k0s()()()()}2&e&&(Fl.R7$(),Fl.Y8G("title",Fl.bMT(2,4,"hasItemsVaultNudgeTitle")),Fl.R7$(4),Fl.JRh(Fl.bMT(6,6,"hasItemsVaultNudgeBodyOne")),Fl.R7$(3),Fl.JRh(Fl.bMT(9,8,"hasItemsVaultNudgeBodyTwo")),Fl.R7$(3),Fl.JRh(Fl.bMT(12,10,"hasItemsVaultNudgeBodyThree")))}function H7(e,t){if(1&e&&(Fl.qex(0),Fl.nrm(1,"vault-at-risk-password-callout"),Fl.DNE(2,Y7,13,12,"div",15),Fl.nI1(3,"async"),Fl.nrm(4,"app-vault-header"),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(2),Fl.Y8G("ngIf",Fl.bMT(3,1,e.showHasItemsVaultSpotlight$))}}function J7(e,t){if(1&e&&(Fl.j41(0,"div",21)(1,"bit-no-items",8),Fl.qex(2,9),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.bVm(),Fl.qex(5,10),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.bVm(),Fl.k0s()()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("icon",e.noResultsIcon),Fl.R7$(2),Fl.JRh(Fl.bMT(4,3,"noItemsMatchSearch")),Fl.R7$(3),Fl.JRh(Fl.bMT(7,5,"clearFiltersOrTryAnother"))}}function Z7(e,t){if(1&e&&(Fl.j41(0,"div",21)(1,"bit-no-items",8),Fl.qex(2,9),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.bVm(),Fl.qex(5,10),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.bVm(),Fl.k0s()()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.Y8G("icon",e.deactivatedIcon),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(4,3,"organizationIsDeactivated")," "),Fl.R7$(3),Fl.JRh(Fl.bMT(7,5,"contactYourOrgAdmin"))}}function Q7(e,t){if(1&e&&(Fl.nrm(0,"app-vault-list-items-container",22),Fl.nI1(1,"i18n"),Fl.nI1(2,"async")),2&e){const e=Fl.XpG(4);Fl.Y8G("title",Fl.bMT(1,2,"searchResults"))("ciphers",Fl.bMT(2,4,e.filteredCiphers$)||Fl.lJ4(6,_7))}}function e5(e,t){if(1&e&&(Fl.nrm(0,"app-autofill-vault-list-items")(1,"app-vault-list-items-container",23),Fl.nI1(2,"i18n"),Fl.nI1(3,"async"),Fl.nrm(4,"app-vault-list-items-container",22),Fl.nI1(5,"async"),Fl.nI1(6,"i18n"),Fl.nI1(7,"async")),2&e){const e=Fl.XpG(4);Fl.R7$(),Fl.Y8G("title",Fl.bMT(2,4,"favorites"))("ciphers",Fl.bMT(3,6,e.favoriteCiphers$)||Fl.lJ4(14,_7)),Fl.R7$(3),Fl.Y8G("title",Fl.bMT(6,10,0===Fl.bMT(5,8,e.numberOfAppliedFilters$)?"allItems":"items"))("ciphers",Fl.bMT(7,12,e.filteredCiphers$)||Fl.lJ4(15,_7))}}function t5(e,t){if(1&e&&(Fl.nVh(0,Q7,3,7,"app-vault-list-items-container",22),Fl.nI1(1,"async"),Fl.vZN(2,e5,8,16)),2&e){const e=Fl.XpG(3);Fl.vxM(Fl.bMT(1,1,e.hasSearchText$)?0:2)}}function i5(e,t){if(1&e&&(Fl.j41(0,"vault-fade-in-out"),Fl.nVh(1,t5,3,3),Fl.nI1(2,"async"),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.R7$(),Fl.vxM(Fl.bMT(2,1,e.loading$)?-1:1)}}function n5(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,J7,8,7,"div",19),Fl.j41(2,"div",20),Fl.DNE(3,Z7,8,7,"div",19),Fl.k0s(),Fl.nVh(4,i5,3,3,"vault-fade-in-out"),Fl.bVm()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.Y8G("ngIf",e.vaultState===e.VaultStateEnum.NoResults),Fl.R7$(2),Fl.Y8G("ngIf",e.vaultState===e.VaultStateEnum.DeactivatedOrg),Fl.R7$(),Fl.vxM(null===e.vaultState?4:-1)}}function r5(e,t){1&e&&(Fl.j41(0,"vault-fade-in-out-skeleton"),Fl.nrm(1,"vault-loading-skeleton"),Fl.k0s())}const s5={Empty:0,NoResults:1,DeactivatedOrg:2};class o5{showPremiumDialog(){z2.open(this.dialogService)}constructor(e,t,i,n,r,s,o,c,u,d,h,p,v,f,m,g,y,b,w){this.vaultPopupItemsService=e,this.vaultPopupListFiltersService=t,this.vaultScrollPositionService=i,this.vaultPopupLoadingService=n,this.accountService=r,this.destroyRef=s,this.cipherService=o,this.dialogService=c,this.introCarouselService=u,this.nudgesService=d,this.router=h,this.autoConfirmService=p,this.toastService=v,this.billingAccountService=f,this.liveAnnouncer=m,this.i18nService=g,this.configService=y,this.searchService=b,this.vaultItemsTransferService=w,this.NudgeType=Sx,this.cipherType=nx,this.activeUserId$=this.accountService.activeAccount$.pipe(iv),this.showEmptyVaultSpotlight$=this.activeUserId$.pipe((0,go.n)(e=>this.nudgesService.showNudgeSpotlight$(Sx.EmptyVaultNudge,e))),this.showHasItemsVaultSpotlight$=this.activeUserId$.pipe((0,go.n)(e=>this.nudgesService.showNudgeSpotlight$(Sx.HasVaultItems,e))),this.activeUserId=null,this.readySubject=new Dd.t(!1),this.loading$=(0,jo.z)([this.vaultPopupLoadingService.loading$,this.readySubject.asObservable()]).pipe((0,l.T)(([e,t])=>e||!t),(0,mo.F)(),(0,Oo.M)(e=>{const t=e?"loadingVault":"vaultLoaded";this.liveAnnouncer.announce(this.i18nService.translate(t),"polite")})),this.premiumSpotlightFeatureFlag$=this.configService.getFeatureFlag$(Wv.BrowserPremiumSpotlight),this.hasSearchText$=this.vaultPopupItemsService.hasSearchText$,this.numberOfAppliedFilters$=this.vaultPopupListFiltersService.numberOfAppliedFilters$,this.filteredCiphers$=this.vaultPopupItemsService.filteredCiphers$,this.favoriteCiphers$=this.vaultPopupItemsService.favoriteCiphers$,this.allFilters$=this.vaultPopupListFiltersService.allFilters$,this.cipherCount$=this.vaultPopupItemsService.cipherCount$,this.hasPremium$=this.activeUserId$.pipe((0,go.n)(e=>this.billingAccountService.hasPremiumFromAnySource$(e))),this.accountAgeInDays$=this.accountService.activeAccount$.pipe((0,l.T)(e=>{if(!e||!e.creationDate)return 0;const t=e.creationDate,i=Date.now()-t.getTime();return Math.floor(i/864e5)})),this.showPremiumSpotlight$=(0,jo.z)([this.premiumSpotlightFeatureFlag$,this.activeUserId$.pipe((0,go.n)(e=>this.nudgesService.showNudgeSpotlight$(Sx.PremiumUpgrade,e))),this.showHasItemsVaultSpotlight$,this.hasPremium$,this.cipherCount$,this.accountAgeInDays$]).pipe((0,l.T)(([e,t,i,n,r,s])=>e&&t&&!i&&!n&&r>=5&&s>=7),(0,Gp.t)({bufferSize:1,refCount:!0})),this.showSkeletonsLoaders$=(0,jo.z)([this.loading$,this.searchService.isCipherSearching$,this.vaultItemsTransferService.transferInProgress$]).pipe((0,l.T)(([e,t,i])=>e||t||i),(0,mo.F)(),X2(),(0,Gp.t)({bufferSize:1,refCount:!0})),this.newItemItemValues$=this.vaultPopupListFiltersService.filters$.pipe((0,go.n)(e=>G7(this,void 0,void 0,function*(){var t,i,n,r;return{organizationId:(null===(t=e.organization)||void 0===t?void 0:t.id)||(null===(i=e.collection)||void 0===i?void 0:i.organizationId),collectionId:null===(n=e.collection)||void 0===n?void 0:n.id,folderId:null===(r=e.folder)||void 0===r?void 0:r.id}})),(0,Gp.t)({refCount:!0,bufferSize:1})),this.vaultState=null,this.vaultIcon=Y4,this.deactivatedIcon=jH,this.noResultsIcon=aG,this.VaultStateEnum=s5,this.scrollLayout=(0,a.WQX)(xh),this._scrollPositionEffect=(0,Rl.QZ)(e=>{const t=(0,jo.z)([this.scrollLayout.scrollableRef$,this.allFilters$,this.loading$]).pipe((0,Eo.p)(([e,t,i])=>!!e&&!i),(0,_o.s)(1),(0,xl.pQ)(this.destroyRef)).subscribe(([e])=>{this.vaultScrollPositionService.start(e.nativeElement)});e(()=>t.unsubscribe())}),this.FeatureFlag=Wv,(0,jo.z)([this.vaultPopupItemsService.emptyVault$,this.vaultPopupItemsService.noFilteredResults$,this.vaultPopupItemsService.showDeactivatedOrg$]).pipe((0,xl.pQ)()).subscribe(([e,t,i])=>{switch(!0){case e:this.vaultState=s5.Empty;break;case i:this.vaultState=s5.DeactivatedOrg;break;case t:this.vaultState=s5.NoResults;break;default:this.vaultState=null}})}ngOnInit(){return G7(this,void 0,void 0,function*(){this.activeUserId=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv)),yield this.introCarouselService.setIntroCarouselDismissed(),this.cipherService.failedToDecryptCiphers$(this.activeUserId).pipe((0,l.T)(e=>e?e.filter(e=>!e.isDeleted):[]),(0,Eo.p)(e=>e.length>0),(0,_o.s)(1),(0,xl.pQ)(this.destroyRef)).subscribe(e=>{NL.open(this.dialogService,{cipherIds:e.map(e=>e.id)})});const e=this.autoConfirmService.configuration$(this.activeUserId);(0,jo.z)([this.autoConfirmService.canManageAutoConfirm$(this.activeUserId),e]).pipe((0,Eo.p)(([e,t])=>e&&void 0===t.showBrowserNotification),(0,_o.s)(1),(0,go.n)(()=>nJ.open(this.dialogService).closed),(0,km.E)(e,this.accountService.activeAccount$.pipe(iv)),(0,go.n)(([e,t,i])=>{const n=Object.assign(Object.assign({},t),{enabled:null!=e&&e,showBrowserNotification:!e});return e&&this.toastService.showToast({message:this.i18nService.t("autoConfirmEnabled"),variant:"success"}),this.autoConfirmService.upsert(i,n)}),(0,xl.pQ)(this.destroyRef)).subscribe(),yield this.vaultItemsTransferService.enforceOrganizationDataOwnership(this.activeUserId),this.readySubject.next(!0)})}ngOnDestroy(){this.vaultScrollPositionService.stop()}navigateToImport(){return G7(this,void 0,void 0,function*(){yield this.router.navigate(["/import"])})}dismissVaultNudgeSpotlight(e){return G7(this,void 0,void 0,function*(){yield this.nudgesService.dismissNudge(e,this.activeUserId)})}}o5.ɵfac=function(e){return new(e||o5)(Fl.rXU(F8),Fl.rXU(P8),Fl.rXU($8),Fl.rXU(E8),Fl.rXU(Zk),Fl.rXU(a.abz),Fl.rXU(_b),Fl.rXU(lh),Fl.rXU(z4),Fl.rXU(Ix),Fl.rXU(Fd.Ix),Fl.rXU(tR),Fl.rXU(qb),Fl.rXU(T$),Fl.rXU(gl.Ai),Fl.rXU(Ul),Fl.rXU(Kb),Fl.rXU(sQ),Fl.rXU(QW))},o5.ɵcmp=Fl.VBU({type:o5,selectors:[["app-vault"]],features:[Fl.Jv_([{provide:QW,useClass:tY}])],decls:20,vars:22,consts:[[3,"hideOverflow"],["slot","header",3,"pageTitle"],["slot","end"],[3,"initialValues"],["slot","full-width-notice",4,"ngIf"],["slot","above-scroll-area"],[4,"ngIf"],[1,"tw-flex","tw-flex-col","tw-h-full","tw-justify-center"],[3,"icon"],["slot","title"],["slot","description"],["bitTypography","body2",1,"tw-mx-6","tw-mt-2"],["slot","button","bitButton","","buttonType","secondary",3,"routerLink","queryParams"],["slot","full-width-notice"],[3,"onButtonClick","onDismiss","title","subtitle","buttonText"],["class","tw-mb-4",4,"ngIf"],[1,"tw-mb-4"],[3,"onDismiss","title"],["bitTypography","body2",1,"tw-pl-4","tw-text-main","tw-mb-0"],["class","tw-flex tw-flex-col tw-justify-center tw-h-auto tw-pt-12",4,"ngIf"],["role","status","aria-live","polite"],[1,"tw-flex","tw-flex-col","tw-justify-center","tw-h-auto","tw-pt-12"],["id","allItems","disableSectionMargin","","collapsibleKey","allItems",3,"title","ciphers"],["id","favorites","collapsibleKey","favorites",3,"title","ciphers"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page",0),Fl.nI1(1,"async"),Fl.j41(2,"popup-header",1),Fl.nI1(3,"i18n"),Fl.qex(4,2),Fl.nrm(5,"app-new-item-dropdown",3),Fl.nI1(6,"async"),Fl.nrm(7,"app-pop-out")(8,"app-current-account"),Fl.bVm(),Fl.k0s(),Fl.nVh(9,K7,13,14,"vault-fade-in-out"),Fl.DNE(10,X7,1,0,"blocked-injection-banner",4),Fl.qex(11,5),Fl.DNE(12,q7,5,9,"ng-container",6),Fl.nI1(13,"async"),Fl.DNE(14,W7,5,9,"ng-container",6),Fl.nI1(15,"async"),Fl.DNE(16,H7,5,3,"ng-container",6),Fl.bVm(),Fl.DNE(17,n5,5,3,"ng-container",6),Fl.nVh(18,r5,2,0,"vault-fade-in-out-skeleton"),Fl.nI1(19,"async"),Fl.k0s()),2&e&&(Fl.Y8G("hideOverflow",Fl.bMT(1,10,t.showSkeletonsLoaders$)),Fl.R7$(2),Fl.Y8G("pageTitle",Fl.bMT(3,12,"vault")),Fl.R7$(3),Fl.Y8G("initialValues",Fl.bMT(6,14,t.newItemItemValues$)),Fl.R7$(4),Fl.vxM(t.vaultState===t.VaultStateEnum.Empty?9:-1),Fl.R7$(),Fl.Y8G("ngIf",t.vaultState!==t.VaultStateEnum.Empty),Fl.R7$(2),Fl.Y8G("ngIf",Fl.bMT(13,16,t.showPremiumSpotlight$)),Fl.R7$(2),Fl.Y8G("ngIf",Fl.bMT(15,18,t.vaultState===t.VaultStateEnum.Empty&&t.showEmptyVaultSpotlight$)),Fl.R7$(2),Fl.Y8G("ngIf",t.vaultState!==t.VaultStateEnum.Empty),Fl.R7$(),Fl.Y8G("ngIf",t.vaultState!==t.VaultStateEnum.Empty),Fl.R7$(),Fl.vxM(Fl.bMT(19,20,t.showSkeletonsLoaders$)?18:-1))},dependencies:[X8,tE,aE,GD,_F,Wh,cG,sf,kl.MD,kl.bT,j7,V7,id,td,J8,Sl.E9,b6,L8,Ax,Cw.iI,Cw.Wk,tc,rc,T2,q2,z8,rf,kl.Jj],encapsulation:2});var a5=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var l5=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function c5(e,t){1&e&&(Fl.j41(0,"span",2),Fl.nI1(1,"i18n"),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()),2&e&&(Fl.Y8G("appA11yTitle",Fl.bMT(1,2,"archived")),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,4,"archived")," "))}function u5(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",6),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.doAutofill())}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"autofill")," "))}function d5(e,t){if(1&e&&(Fl.j41(0,"app-cipher-view",3),Fl.nVh(1,u5,3,3,"button",5),Fl.k0s()),2&e){const e=Fl.XpG();Fl.Y8G("cipher",e.cipher),Fl.R7$(),Fl.vxM(e.showAutofillButton()?1:-1)}}function h5(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",13),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.editCipher())}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"edit")," "))}function p5(e,t){if(1&e&&(Fl.j41(0,"button",9),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.Y8G("bitAction",e.restore),Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,2,"restore")," ")}}function v5(e,t){if(1&e&&(Fl.nrm(0,"button",10),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG(2);Fl.Y8G("bitAction",e.unarchive)("label",Fl.bMT(1,2,"unarchive"))}}function f5(e,t){if(1&e&&(Fl.nrm(0,"button",11),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG(2);Fl.Y8G("bitAction",e.archive)("label",Fl.bMT(1,2,"archiveVerb"))}}function m5(e,t){if(1&e&&(Fl.nrm(0,"button",12),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG(2);Fl.Y8G("bitAction",e.delete)("label",Fl.bMT(1,2,e.cipher.isDeleted?"deleteForever":"delete"))}}function g5(e,t){if(1&e&&(Fl.j41(0,"popup-footer",7),Fl.nVh(1,h5,3,3,"button",8),Fl.nVh(2,p5,3,4,"button",9),Fl.qex(3,1),Fl.nVh(4,v5,2,4,"button",10),Fl.nI1(5,"async"),Fl.nVh(6,f5,2,4,"button",11),Fl.nI1(7,"async"),Fl.nVh(8,m5,2,4,"button",12),Fl.nI1(9,"async"),Fl.bVm(),Fl.k0s()),2&e){const e=Fl.XpG();Fl.R7$(),Fl.vxM(e.cipher.isDeleted?-1:1),Fl.R7$(),Fl.vxM(e.cipher.isDeleted&&e.cipher.permissions.restore?2:-1),Fl.R7$(2),Fl.vxM(Fl.bMT(5,5,e.archiveFlagEnabled$)&&e.cipher.isArchived&&!e.cipher.isDeleted?4:-1),Fl.R7$(2),Fl.vxM(Fl.bMT(7,7,e.userCanArchive$)&&e.cipher.canBeArchived?6:-1),Fl.R7$(2),Fl.vxM(Fl.bMT(9,9,e.canDeleteCipher$)?8:-1)}}class y5{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,v,f,m,g,y){this.passwordRepromptService=e,this.route=t,this.router=i,this.i18nService=n,this.cipherService=r,this.dialogService=s,this.logService=o,this.toastService=a,this.vaultPopupAutofillService=l,this.accountService=c,this.eventCollectionService=u,this.popupRouterCacheService=d,this.cipherAuthorizationService=h,this.copyCipherFieldService=p,this.popupScrollPositionService=v,this.archiveService=f,this.archiveCipherUtilsService=m,this.domainSettingsService=g,this.configService=y,this.pm30521FeatureFlag=(0,xl.ot)(this.configService.getFeatureFlag$(Wv.PM30521_AutofillButtonViewLoginScreen)),this.autofillAllowed=(0,xl.ot)(this.vaultPopupAutofillService.autofillAllowed$),this.uriMatchStrategy$=this.domainSettingsService.resolvedDefaultUriMatchStrategy$,this.userCanArchive$=this.accountService.activeAccount$.pipe(iv).pipe((0,go.n)(e=>this.archiveService.userCanArchive$(e))),this.archiveFlagEnabled$=this.archiveService.hasArchiveFlagEnabled$,this.delete=()=>l5(this,void 0,void 0,function*(){if(!(yield this.dialogService.openSimpleDialog({title:{key:"deleteItem"},content:{key:this.cipher.isDeleted?"permanentlyDeleteItemConfirmation":"deleteItemConfirmation"},type:"warning"})))return!1;try{yield this.deleteCipher()}catch(e){return this.logService.error(e),!1}return this.popupScrollPositionService.stop(!0),yield this.popupRouterCacheService.back(),this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t(this.cipher.isDeleted?"permanentlyDeletedItem":"deletedItem")}),!0}),this.restore=()=>l5(this,void 0,void 0,function*(){let e;try{yield this.cipherService.restoreWithServer(this.cipher.id,this.activeUserId)}catch(e){this.logService.error(e)}e=this.cipher.archivedDate?this.i18nService.t("archivedItemRestored"):this.i18nService.t("restoredItem"),yield this.popupRouterCacheService.back(),this.toastService.showToast({variant:"success",title:null,message:e})}),this.archive=()=>l5(this,void 0,void 0,function*(){const e=yield this.archiveCipherUtilsService.archiveCipher(this.cipher,!0);e&&(this.cipher.archivedDate=new Date(e.archivedDate))}),this.unarchive=()=>l5(this,void 0,void 0,function*(){(yield this.archiveCipherUtilsService.unarchiveCipher(this.cipher))&&(this.cipher.archivedDate=null)}),this.subscribeToParams()}subscribeToParams(){this.route.queryParams.pipe((0,go.n)(e=>l5(this,void 0,void 0,function*(){this.loadAction=e.action,this.senderTabId=e.senderTabId?parseInt(e.senderTabId,10):void 0,this.routeAfterDeletion=e.routeAfterDeletion?e.routeAfterDeletion:void 0,this.activeUserId=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));const t=yield this.getCipherData(e.cipherId,this.activeUserId);if(this.headerText=this.setHeader(t.type),this.loadAction){const e=yield this._handleLoadAction(this.loadAction,t,this.senderTabId);if([ga,ya,ba].includes(this.loadAction)&&!1===e&&t.reprompt!==tx.None)return null}return t})),p$(),(0,go.n)(e=>l5(this,void 0,void 0,function*(){this.cipher=e,this.canDeleteCipher$=this.cipherAuthorizationService.canDeleteCipher$(e),this.showFooter$=(0,Go.of)(e&&(!e.isDeleted||e.isDeleted&&(e.permissions.restore||e.permissions.delete))),yield this.eventCollectionService.collect(Ua.Cipher_ClientViewed,e.id,!1,e.organizationId)})),(0,xl.pQ)()).subscribe()}setHeader(e){const t={[nx.Login]:"viewItemHeaderLogin",[nx.Card]:"viewItemHeaderCard",[nx.Identity]:"viewItemHeaderIdentity",[nx.SecureNote]:"viewItemHeaderNote",[nx.SshKey]:"viewItemHeaderSshKey"};return this.i18nService.t(t[e])}getCipherData(e,t){return l5(this,void 0,void 0,function*(){return yield(0,bo._)(this.cipherService.cipherViews$(t).pipe(p$(),(0,l.T)(t=>t.find(t=>t.id===e))))})}editCipher(){return l5(this,void 0,void 0,function*(){return!this.cipher.isDeleted&&(this.router.navigate(["/edit-cipher"],{queryParams:{cipherId:this.cipher.id,type:this.cipher.type,isNew:!1,routeAfterDeletion:this.routeAfterDeletion}}),!0)})}deleteCipher(){return this.cipher.isDeleted?this.cipherService.deleteWithServer(this.cipher.id,this.activeUserId):this.cipherService.softDeleteWithServer(this.cipher.id,this.activeUserId)}showAutofillButton(){if(!this.pm30521FeatureFlag())return!1;if(!this.autofillAllowed())return!1;return[nx.Login,nx.Card,nx.Identity].includes(t$.getType(this.cipher))&&!(this.cipher.isArchived||this.cipher.isDeleted)}doAutofill(){return l5(this,void 0,void 0,function*(){var e,t,i,n,r;if(!(yield this.configService.getFeatureFlag(Wv.PM30521_AutofillButtonViewLoginScreen)))return;if(t$.getType(this.cipher)!==nx.Login)return void(yield this.vaultPopupAutofillService.doAutofill(this.cipher,!0,!0));const s=null!==(t=null===(e=this.cipher.login)||void 0===e?void 0:e.uris)&&void 0!==t?t:[],o=yield(0,bo._)(this.uriMatchStrategy$),a=0===s.length?o===GE.Exact:s.every(e=>{var t;return(null!==(t=e.match)&&void 0!==t?t:o)===GE.Exact});if(a)return void(yield this.dialogService.openSimpleDialog({title:{key:"cannotAutofill"},content:{key:"cannotAutofillExactMatch"},type:"info",acceptButtonText:{key:"okay"},cancelButtonText:null}));const l=yield(0,bo._)(this.vaultPopupAutofillService.currentAutofillTab$);if(!(null==l?void 0:l.url))return void(yield this.dialogService.openSimpleDialog({title:{key:"error"},content:{key:"errorGettingAutoFillData"},type:"danger"}));if(yield this._domainMatched(l))return void(yield this.vaultPopupAutofillService.doAutofill(this.cipher,!0,!0));const c=W6.open(this.dialogService,{data:{currentUrl:(null==l?void 0:l.url)||"",savedUrls:null!==(r=null===(n=null===(i=this.cipher.login)||void 0===i?void 0:i.uris)||void 0===n?void 0:n.filter(e=>e.uri).map(e=>e.uri))&&void 0!==r?r:[],viewOnly:!this.cipher.edit}});switch(yield(0,bo._)(c.closed)){case q6.Canceled:return;case q6.AutofilledOnly:return void(yield this.vaultPopupAutofillService.doAutofill(this.cipher,!0,!0));case q6.AutofillAndUrlAdded:return void(yield this.vaultPopupAutofillService.doAutofillAndSave(this.cipher,!0,!0))}})}_domainMatched(e){return l5(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.domainSettingsService.getUrlEquivalentDomains(null==e?void 0:e.url)),i=yield(0,bo._)(this.domainSettingsService.resolvedDefaultUriMatchStrategy$);return t$.matchesUri(this.cipher,null==e?void 0:e.url,t,i)})}_handleLoadAction(e,t,i){return l5(this,void 0,void 0,function*(){let n=!1;switch(e){case"show-autofill-button":return void(t.reprompt===tx.None||(yield this.passwordRepromptService.showPasswordPrompt())||(yield GZ(`${VZ}_${t.id}`)));case ga:n=yield this.vaultPopupAutofillService.doAutofill(t,!1);break;case"copy-username":n=yield this.copyCipherFieldService.copy(t.login.username,"username",t);break;case ya:n=yield this.copyCipherFieldService.copy(t.login.password,"password",t);break;case ba:n=yield this.copyCipherFieldService.copy(t.login.totp,"totp",t);break;case"update-password":{const e=yield this.passwordRepromptService.showPasswordPrompt(),n=yield ul.getTab(i);yield a8("bgHandleReprompt",{tab:n,cipherId:t.id,success:e}),yield GZ(`${VZ}_${t.id}`);break}}return pl.inPopout(window)&&setTimeout(()=>l5(this,void 0,void 0,function*(){pl.inSingleActionPopout(window,VZ)&&i?(yield ul.focusTab(i),yield GZ(`${VZ}_${t.id}`)):yield this.popupRouterCacheService.back()}),n?1e3:0),n})}}y5.ɵfac=function(e){return new(e||y5)(Fl.rXU(k$),Fl.rXU(Fd.nX),Fl.rXU(Fd.Ix),Fl.rXU(Ul),Fl.rXU(_b),Fl.rXU(lh),Fl.rXU(Za),Fl.rXU(qb),Fl.rXU(S8),Fl.rXU(Zk),Fl.rXU(I$),Fl.rXU(WD),Fl.rXU(L$),Fl.rXU(R$),Fl.rXU($8),Fl.rXU($V),Fl.rXU(oY),Fl.rXU(YE),Fl.rXU(Kb))},y5.ɵcmp=Fl.VBU({type:y5,selectors:[["app-view"]],features:[Fl.Jv_([{provide:jU,useClass:class{constructor(){this.router=(0,a.WQX)(Fd.Ix)}viewPasswordHistory(e){return a5(this,void 0,void 0,function*(){yield this.router.navigate(["/cipher-password-history"],{queryParams:{cipherId:e.id}})})}}},{provide:qU,useClass:K2},{provide:NM,useClass:rY}])],decls:9,vars:8,consts:[["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],["bitBadge","","variant","secondary",3,"appA11yTitle"],[3,"cipher"],["slot","footer",4,"ngIf"],["type","button","slot","button","bitButton","","buttonType","primary","block","",1,"tw-mt-4"],["type","button","slot","button","bitButton","","buttonType","primary","block","",1,"tw-mt-4",3,"click"],["slot","footer"],["buttonType","primary","type","button","bitButton",""],["buttonType","primary","type","button","bitButton","",3,"bitAction"],["type","button","bitIconButton","bwi-unarchive",3,"bitAction","label"],["type","button","bitIconButton","bwi-archive",3,"bitAction","label"],["type","button","buttonType","danger","bitIconButton","bwi-trash",3,"bitAction","label"],["buttonType","primary","type","button","bitButton","",3,"click"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page")(1,"popup-header",0),Fl.qex(2,1),Fl.nVh(3,c5,4,6,"span",2),Fl.nI1(4,"async"),Fl.nrm(5,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.nVh(6,d5,2,2,"app-cipher-view",3),Fl.DNE(7,g5,10,11,"popup-footer",4),Fl.nI1(8,"async"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.Y8G("pageTitle",t.headerText),Fl.R7$(2),Fl.vxM(null!=t.cipher&&t.cipher.isArchived&&Fl.bMT(4,4,t.archiveFlagEnabled$)?3:-1),Fl.R7$(3),Fl.vxM(t.cipher?6:-1),Fl.R7$(),Fl.Y8G("ngIf",Fl.bMT(8,6,t.showFooter$)))},dependencies:[kl.MD,kl.bT,iO,sf,rw,Il.YN,id,td,tE,aE,TQ,Ql,Zl,QM,pc,Bd,GD,dd,eu,Qc,kl.Jj,rf],encapsulation:2});var b5=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const w5=e=>e.includes("view-cipher")||e.includes("assign-collections")||e.includes("edit-cipher")||e.includes("clone-cipher");var S5=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var k5=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function I5(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-spotlight",4)(1,"div",9)(2,"span",7),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"button",10),Fl.nI1(6,"i18n"),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.dismissSpotlight())}),Fl.k0s()()()}2&e&&(Fl.Y8G("persistent",!0),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,3,"autoConfirmOnboardingCallout")," "),Fl.R7$(2),Fl.Y8G("label",Fl.bMT(6,5,"close")))}class C5{constructor(e,t,i,n,r,s,o,l){this.formBuilder=e,this.accountService=t,this.autoConfirmService=i,this.destroyRef=n,this.dialogService=r,this.nudgesService=s,this.eventCollectionService=o,this.organizationService=l,this.userId$=this.accountService.activeAccount$.pipe(iv),this.formLoading=(0,a.vPA)(!0),this.adminForm=this.formBuilder.group({autoConfirm:!1}),this.showAutoConfirmSpotlight$=this.userId$.pipe((0,go.n)(e=>this.nudgesService.showNudgeSpotlight$(Sx.AutoConfirmNudge,e)))}ngOnInit(){return k5(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.userId$),t=(yield(0,bo._)(this.autoConfirmService.configuration$(e))).enabled;this.adminForm.setValue({autoConfirm:t}),this.formLoading.set(!1),this.adminForm.controls.autoConfirm.valueChanges.pipe((0,go.n)(e=>e?this.confirm():(0,Go.of)(!1)),(0,km.E)(this.autoConfirmService.configuration$(e),this.organizationService.organizations$(e)),(0,go.n)(t=>k5(this,[t],void 0,function*([t,i,n]){yield this.autoConfirmService.upsert(e,Object.assign(Object.assign({},i),{enabled:t,showBrowserNotification:!1}));const r=n[0];if(null==r?void 0:r.id){const e=t?Ua.Organization_AutoConfirmEnabled_Admin:Ua.Organization_AutoConfirmDisabled_Admin;yield this.eventCollectionService.collect(e,void 0,!0,r.id)}})),(0,xl.pQ)(this.destroyRef)).subscribe()})}confirm(){return rJ.open(this.dialogService).closed.pipe((0,l.T)(e=>null!=e&&e),(0,Oo.M)(e=>{e||this.adminForm.setValue({autoConfirm:!1},{emitEvent:!1})}))}dismissSpotlight(){return k5(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.userId$),t=yield(0,bo._)(this.autoConfirmService.configuration$(e));yield this.autoConfirmService.upsert(e,Object.assign(Object.assign({},t),{showBrowserNotification:!1}))})}}C5.ɵfac=function(e){return new(e||C5)(Fl.rXU(Il.ok),Fl.rXU(Zk),Fl.rXU(tR),Fl.rXU(a.abz),Fl.rXU(lh),Fl.rXU(Ix),Fl.rXU(I$),Fl.rXU(YF))},C5.ɵcmp=Fl.VBU({type:C5,selectors:[["ng-component"]],decls:18,vars:14,consts:[[3,"loading"],["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[1,"tw-px-1","tw-pt-1"],[3,"persistent"],[3,"formGroup"],["formControlName","autoConfirm"],[1,"tw-text-sm"],[1,"tw-max-w-[18rem]"],[1,"tw-flex","tw-flex-row","tw-items-center","tw-justify-between"],["type","button","bitIconButton","bwi-close","size","small",1,"tw-ml-1","tw-mt-[2px]",3,"click","label"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page",0)(1,"popup-header",1),Fl.nI1(2,"i18n"),Fl.qex(3,2),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.j41(5,"div",3),Fl.nVh(6,I5,7,7,"bit-spotlight",4),Fl.nI1(7,"async"),Fl.j41(8,"form",5)(9,"bit-card")(10,"bit-switch",6)(11,"bit-label")(12,"span",7),Fl.EFF(13),Fl.nI1(14,"i18n"),Fl.k0s()(),Fl.j41(15,"bit-hint",8),Fl.EFF(16),Fl.nI1(17,"i18n"),Fl.k0s()()()()()()),2&e&&(Fl.Y8G("loading",t.formLoading()),Fl.R7$(),Fl.Y8G("pageTitle",Fl.bMT(2,6,"admin")),Fl.R7$(5),Fl.vxM(Fl.bMT(7,8,t.showAutoConfirmSpotlight$)?6:-1),Fl.R7$(2),Fl.Y8G("formGroup",t.adminForm),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(14,10,"automaticUserConfirmation")," "),Fl.R7$(3),Fl.JRh(Fl.bMT(17,12,"automaticUserConfirmationHint")))},dependencies:[kl.MD,tE,aE,GD,Gu,Ac,hu,Il.X1,Il.qT,Il.BC,Il.cb,Il.j4,Il.JD,Kx,Ex,Ax,Zl,kl.Jj,sc],encapsulation:2,changeDetection:0});var T5=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const P5=new k(H,"enableBadgeCounter",{deserializer:e=>null==e||e,clearOn:[]});class F5{}var R5=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class x5{}const A5=new m(de,"routing",{deserializer:e=>e});var D5=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const E5=new m(ce,"compactMode",{deserializer:e=>e});class $5{constructor(){this.state=(0,a.WQX)(d).get(E5),this.enabled$=this.state.state$.pipe((0,l.T)(e=>null!=e&&e))}init(){this.enabled$.subscribe(e=>{e?document.body.classList.add("tw-bit-compact"):document.body.classList.remove("tw-bit-compact")})}setEnabled(e){return D5(this,void 0,void 0,function*(){yield this.state.update(()=>e)})}}$5.ɵfac=function(e){return new(e||$5)},$5.ɵprov=a.jDH({token:$5,factory:$5.ɵfac,providedIn:"root"});var O5=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function U5(e,t){if(1&e&&Fl.nrm(0,"bit-option",16),2&e){const e=t.$implicit;Fl.Y8G("value",e.value)("label",e.name)}}function M5(e,t){1&e&&(Fl.j41(0,"bit-form-control",10),Fl.nrm(1,"input",17),Fl.j41(2,"bit-label"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()()),2&e&&(Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,1,"clickToAutofill")," "))}class N5{constructor(e,t,i,n,r,s,o,l,c){this.messagingService=e,this.domainSettingsService=t,this.badgeSettingsService=i,this.themeStateService=n,this.formBuilder=r,this.destroyRef=s,this.animationControlService=o,this.vaultSettingsService=c,this.compactModeService=(0,a.WQX)($5),this.copyButtonsService=(0,a.WQX)(D8),this.popupSizeService=(0,a.WQX)(ml),this.i18nService=(0,a.WQX)(Ul),this.configService=(0,a.WQX)(Kb),this.simplifiedItemActionEnabled=(0,xl.ot)(this.configService.getFeatureFlag$(Wv.PM31039ItemActionInExtension),{initialValue:!1}),this.appearanceForm=this.formBuilder.group({enableFavicon:!1,enableBadgeCounter:!0,theme:Ip.System,enableAnimations:!0,enableCompactMode:!1,showQuickCopyActions:!1,width:"default",clickItemsToAutofillVaultView:!1}),this.formLoading=!0,this.widthOptions=[{label:this.i18nService.t("default"),value:"default"},{label:this.i18nService.t("wide"),value:"wide"},{label:this.i18nService.t("narrow"),value:"narrow"}],this.themeOptions=[{name:l.t("systemDefault"),value:Ip.System},{name:l.t("light"),value:Ip.Light},{name:l.t("dark"),value:Ip.Dark}]}ngOnInit(){return O5(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.domainSettingsService.showFavicons$),t=yield(0,bo._)(this.badgeSettingsService.enableBadgeCounter$),i=yield(0,bo._)(this.themeStateService.selectedTheme$),n=yield(0,bo._)(this.animationControlService.enableRoutingAnimation$),r=yield(0,bo._)(this.compactModeService.enabled$),s=yield(0,bo._)(this.copyButtonsService.showQuickCopyActions$),o=yield(0,bo._)(this.popupSizeService.width$),a=yield(0,bo._)(this.vaultSettingsService.clickItemsToAutofillVaultView$);this.appearanceForm.setValue({enableFavicon:e,enableBadgeCounter:t,theme:i,enableAnimations:n,enableCompactMode:r,showQuickCopyActions:s,width:o,clickItemsToAutofillVaultView:a}),this.formLoading=!1,this.appearanceForm.controls.theme.valueChanges.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.saveTheme(e)}),this.appearanceForm.controls.enableFavicon.valueChanges.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.updateFavicon(e)}),this.appearanceForm.controls.enableBadgeCounter.valueChanges.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.updateBadgeCounter(e)}),this.appearanceForm.controls.enableAnimations.valueChanges.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.updateAnimations(e)}),this.appearanceForm.controls.enableCompactMode.valueChanges.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.updateCompactMode(e)}),this.appearanceForm.controls.showQuickCopyActions.valueChanges.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.updateQuickCopyActions(e)}),this.appearanceForm.controls.width.valueChanges.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.updateWidth(e)}),this.appearanceForm.controls.clickItemsToAutofillVaultView.valueChanges.pipe((0,xl.pQ)(this.destroyRef)).subscribe(e=>{this.updateClickItemsToAutofillVaultView(e)})})}updateClickItemsToAutofillVaultView(e){return O5(this,void 0,void 0,function*(){yield this.vaultSettingsService.setClickItemsToAutofillVaultView(e)})}updateFavicon(e){return O5(this,void 0,void 0,function*(){yield this.domainSettingsService.setShowFavicons(e)})}updateBadgeCounter(e){return O5(this,void 0,void 0,function*(){yield this.badgeSettingsService.setEnableBadgeCounter(e),this.messagingService.send("bgUpdateContextMenu")})}saveTheme(e){return O5(this,void 0,void 0,function*(){yield this.themeStateService.setSelectedTheme(e)})}updateAnimations(e){return O5(this,void 0,void 0,function*(){yield this.animationControlService.setEnableRoutingAnimation(e)})}updateCompactMode(e){return O5(this,void 0,void 0,function*(){yield this.compactModeService.setEnabled(e)})}updateQuickCopyActions(e){return O5(this,void 0,void 0,function*(){yield this.copyButtonsService.setShowQuickCopyActions(e)})}updateWidth(e){return O5(this,void 0,void 0,function*(){yield this.popupSizeService.setWidth(e)})}}N5.ɵfac=function(e){return new(e||N5)(Fl.rXU(bk),Fl.rXU(YE),Fl.rXU(F5),Fl.rXU(K$),Fl.rXU(Il.ok),Fl.rXU(a.abz),Fl.rXU(x5),Fl.rXU(Ul),Fl.rXU(FY))},N5.ɵcmp=Fl.VBU({type:N5,selectors:[["ng-component"]],decls:52,vars:36,consts:[[3,"loading"],["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[3,"formGroup"],["formControlName","theme"],[3,"value","label",4,"ngFor","ngForOf"],["formControlName","width",3,"items"],["bitCheckbox","","formControlName","enableCompactMode","type","checkbox"],["bitBadge","","variant","warning"],["bitCheckbox","","formControlName","enableBadgeCounter","type","checkbox"],["disableMargin",""],["bitCheckbox","","formControlName","enableAnimations","type","checkbox"],["bitTypography","h6",1,"tw-font-medium","tw-mt-4"],["bitCheckbox","","formControlName","enableFavicon","type","checkbox"],[3,"disableMargin"],["bitCheckbox","","formControlName","showQuickCopyActions","type","checkbox"],[3,"value","label"],["bitCheckbox","","formControlName","clickItemsToAutofillVaultView","type","checkbox"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page",0)(1,"popup-header",1),Fl.nI1(2,"i18n"),Fl.qex(3,2),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.j41(5,"form",3)(6,"bit-card")(7,"bit-form-field")(8,"bit-label"),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s(),Fl.j41(11,"bit-select",4),Fl.DNE(12,U5,1,2,"bit-option",5),Fl.k0s()(),Fl.j41(13,"bit-form-field")(14,"bit-label"),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s(),Fl.nrm(17,"bit-select",6),Fl.k0s(),Fl.j41(18,"bit-form-control"),Fl.nrm(19,"input",7),Fl.j41(20,"bit-label"),Fl.EFF(21),Fl.nI1(22,"i18n"),Fl.j41(23,"span",8),Fl.EFF(24),Fl.nI1(25,"i18n"),Fl.k0s()()(),Fl.j41(26,"bit-form-control"),Fl.nrm(27,"input",9),Fl.j41(28,"bit-label"),Fl.EFF(29),Fl.nI1(30,"i18n"),Fl.k0s()(),Fl.j41(31,"bit-form-control",10),Fl.nrm(32,"input",11),Fl.j41(33,"bit-label"),Fl.EFF(34),Fl.nI1(35,"i18n"),Fl.k0s()()(),Fl.j41(36,"h2",12),Fl.EFF(37),Fl.nI1(38,"i18n"),Fl.k0s(),Fl.j41(39,"bit-card")(40,"bit-form-control"),Fl.nrm(41,"input",13),Fl.j41(42,"bit-label"),Fl.EFF(43),Fl.nI1(44,"i18n"),Fl.nrm(45,"vault-permit-cipher-details-popover"),Fl.k0s()(),Fl.j41(46,"bit-form-control",14),Fl.nrm(47,"input",15),Fl.j41(48,"bit-label"),Fl.EFF(49),Fl.nI1(50,"i18n"),Fl.k0s()(),Fl.nVh(51,M5,5,3,"bit-form-control",10),Fl.k0s()()()),2&e&&(Fl.Y8G("loading",t.formLoading),Fl.R7$(),Fl.Y8G("pageTitle",Fl.bMT(2,16,"appearance")),Fl.R7$(4),Fl.Y8G("formGroup",t.appearanceForm),Fl.R7$(4),Fl.JRh(Fl.bMT(10,18,"theme")),Fl.R7$(3),Fl.Y8G("ngForOf",t.themeOptions),Fl.R7$(3),Fl.JRh(Fl.bMT(16,20,"extensionWidth")),Fl.R7$(2),Fl.Y8G("items",t.widthOptions),Fl.R7$(4),Fl.SpI("",Fl.bMT(22,22,"compactMode")," "),Fl.R7$(3),Fl.JRh(Fl.bMT(25,24,"beta")),Fl.R7$(5),Fl.JRh(Fl.bMT(30,26,"showNumberOfAutofillSuggestions")),Fl.R7$(5),Fl.JRh(Fl.bMT(35,28,"showAnimations")),Fl.R7$(3),Fl.JRh(Fl.bMT(38,30,"vaultCustomization")),Fl.R7$(6),Fl.SpI(" ",Fl.bMT(44,32,"showIconsChangePasswordUrls")," "),Fl.R7$(3),Fl.Y8G("disableMargin",t.simplifiedItemActionEnabled()),Fl.R7$(3),Fl.JRh(Fl.bMT(50,34,"showQuickCopyActions")),Fl.R7$(2),Fl.vxM(t.simplifiedItemActionEnabled()?-1:51))},dependencies:[kl.MD,kl.Sq,sf,tE,aE,GD,Ex,Gu,Sc,Ac,ju,Wu,qu,zu,Il.X1,Il.qT,Il.Zm,Il.BC,Il.cb,Il.j4,Il.JD,hd,Qb,eu,Qc,Cz,rf],encapsulation:2});var V5=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const B5=(e,t)=>t.id;function j5(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-card",4)(1,"div",5),Fl.nrm(2,"i",6),Fl.j41(3,"h3",7),Fl.EFF(4),Fl.nI1(5,"i18n"),Fl.k0s()(),Fl.j41(6,"p",8),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.k0s(),Fl.j41(9,"button",9),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.navigateToPremium())}),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s()()}2&e&&(Fl.R7$(4),Fl.JRh(Fl.bMT(5,3,"premiumSubscriptionEnded")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(8,5,"archivePremiumRestart")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(11,7,"restartPremium")," "))}function G5(e,t){if(1&e&&Fl.nrm(0,"i",18),2&e){const e=Fl.XpG().$implicit,t=Fl.XpG(3);Fl.Y8G("tierType",t.orgTierType(e))("size","small")("appA11yTitle",t.orgIconTooltip(e))}}function L5(e,t){1&e&&(Fl.nrm(0,"i",19),Fl.nI1(1,"i18n")),2&e&&Fl.Y8G("appA11yTitle",Fl.bMT(1,1,"attachments"))}function z5(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",22),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG().$implicit,i=Fl.XpG(3);return a.Njj(i.clone(t))}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"clone")," "))}function _5(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",22),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG().$implicit,i=Fl.XpG(3);return a.Njj(i.conditionallyNavigateToAssignCollections(t))}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"assignToCollections")," "))}function K5(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",22),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG().$implicit,i=Fl.XpG(3);return a.Njj(i.delete(t))}),Fl.j41(1,"span",25),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s()()}2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"delete")," "))}function X5(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-item")(1,"button",13),Fl.nI1(2,"i18n"),Fl.bIt("click",function(){const t=a.eBV(e).$implicit,i=Fl.XpG(3);return a.Njj(i.view(t))}),Fl.j41(3,"div",14),Fl.nrm(4,"app-vault-icon",15),Fl.k0s(),Fl.j41(5,"span",16),Fl.EFF(6),Fl.k0s(),Fl.j41(7,"div",17),Fl.nVh(8,G5,1,3,"i",18),Fl.nVh(9,L5,2,3,"i",19),Fl.k0s(),Fl.j41(10,"span",20),Fl.EFF(11),Fl.k0s()(),Fl.j41(12,"bit-item-action",3),Fl.nrm(13,"button",21),Fl.nI1(14,"i18n"),Fl.nI1(15,"i18n"),Fl.j41(16,"bit-menu",null,0)(18,"button",22),Fl.bIt("click",function(){const t=a.eBV(e).$implicit,i=Fl.XpG(3);return a.Njj(i.edit(t))}),Fl.EFF(19),Fl.nI1(20,"i18n"),Fl.k0s(),Fl.nVh(21,z5,3,3,"button",23),Fl.nI1(22,"async"),Fl.nVh(23,_5,3,3,"button",23),Fl.nI1(24,"async"),Fl.j41(25,"button",22),Fl.bIt("click",function(){const t=a.eBV(e).$implicit,i=Fl.XpG(3);return a.Njj(i.unarchive(t))}),Fl.EFF(26),Fl.nI1(27,"i18n"),Fl.k0s(),Fl.DNE(28,K5,4,3,"button",24),Fl.k0s()()()}if(2&e){const e=t.$implicit,i=Fl.sdS(17),n=Fl.XpG(3);Fl.R7$(),Fl.Y8G("appA11yTitle",Fl.i5U(2,15,"viewItemTitle",e.name)),Fl.R7$(3),Fl.Y8G("cipher",e),Fl.R7$(2),Fl.JRh(e.name),Fl.R7$(2),Fl.vxM(e.organizationId?8:-1),Fl.R7$(),Fl.vxM(n.CipherViewLikeUtils.hasAttachments(e)?9:-1),Fl.R7$(2),Fl.JRh(n.CipherViewLikeUtils.subtitle(e)),Fl.R7$(2),Fl.Y8G("label",Fl.mNQ(Fl.bMT(14,18,"options")))("appA11yTitle",Fl.i5U(15,20,"moreOptionsTitle",e.name))("bitMenuTriggerFor",i),Fl.R7$(6),Fl.SpI(" ",Fl.bMT(20,23,"edit")," "),Fl.R7$(2),Fl.vxM(Fl.bMT(22,25,n.userHasPremium$)?21:-1),Fl.R7$(2),Fl.vxM(Fl.bMT(24,27,n.canAssignCollections$)?23:-1),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(27,29,"unArchive")," "),Fl.R7$(2),Fl.Y8G("appCanDeleteCipher",e)}}function q5(e,t){if(1&e&&(Fl.j41(0,"bit-section")(1,"bit-section-header")(2,"h2",11),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"span",12),Fl.EFF(6),Fl.k0s()(),Fl.j41(7,"bit-item-group"),Fl.Z7z(8,X5,29,31,"bit-item",null,B5),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,2,"itemsInArchive")," "),Fl.R7$(3),Fl.JRh(e.length),Fl.R7$(2),Fl.Dyx(e)}}function W5(e,t){1&e&&(Fl.j41(0,"bit-no-items",10),Fl.qex(1,26),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.bVm(),Fl.qex(4,27),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.bVm(),Fl.k0s()),2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,2,"noItemsInArchive")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(6,4,"noItemsInArchiveDesc")," "))}function Y5(e,t){1&e&&Fl.nVh(0,q5,10,4,"bit-section")(1,W5,7,6,"bit-no-items",10),2&e&&Fl.vxM(t.length?0:1)}class H5{constructor(){this.dialogService=(0,a.WQX)(lh),this.router=(0,a.WQX)(Fd.Ix),this.cipherService=(0,a.WQX)(_b),this.accountService=(0,a.WQX)(Zk),this.logService=(0,a.WQX)(Za),this.toastService=(0,a.WQX)(qb),this.i18nService=(0,a.WQX)(Ul),this.cipherArchiveService=(0,a.WQX)($V),this.passwordRepromptService=(0,a.WQX)(k$),this.organizationService=(0,a.WQX)(WF),this.collectionService=(0,a.WQX)(uR),this.userId$=this.accountService.activeAccount$.pipe(iv),this.orgMap=(0,xl.ot)(this.userId$.pipe((0,go.n)(e=>this.organizationService.organizations$(e).pipe((0,l.T)(e=>{const t=new Map;for(const i of e)t.set(i.id,i);return t}))))),this.collections=(0,xl.ot)(this.userId$.pipe((0,go.n)(e=>this.collectionService.decryptedCollections$(e)))),this.archivedCiphers$=this.userId$.pipe((0,go.n)(e=>this.cipherArchiveService.archivedCiphers$(e))),this.userCanArchive$=this.userId$.pipe((0,go.n)(e=>this.cipherArchiveService.userCanArchive$(e))),this.CipherViewLikeUtils=t$,this.loading$=this.archivedCiphers$.pipe((0,l.T)(()=>!1),(0,kd.Z)(!0)),this.canAssignCollections$=this.userId$.pipe((0,go.n)(e=>(0,jo.z)([this.organizationService.hasOrganizations(e),this.collectionService.decryptedCollections$(e)]).pipe((0,l.T)(([e,t])=>{const i=t.some(e=>!e.readOnly);return e&&i})))),this.showSubscriptionEndedMessaging$=this.userId$.pipe((0,go.n)(e=>this.cipherArchiveService.showSubscriptionEndedMessaging$(e))),this.userHasPremium$=this.userId$.pipe((0,go.n)(e=>this.cipherArchiveService.userHasPremium$(e)))}navigateToPremium(){return V5(this,void 0,void 0,function*(){yield this.router.navigate(["/premium"])})}view(e){return V5(this,void 0,void 0,function*(){(yield this.canInteract(e))&&(yield this.router.navigate(["/view-cipher"],{queryParams:{cipherId:e.id,type:e.type,routeAfterDeletion:x4.archive}}))})}edit(e){return V5(this,void 0,void 0,function*(){(yield this.canInteract(e))&&(yield this.router.navigate(["/edit-cipher"],{queryParams:{cipherId:e.id,type:e.type,routeAfterDeletion:x4.archive}}))})}delete(e){return V5(this,void 0,void 0,function*(){if(!(yield this.canInteract(e)))return;if(!(yield this.dialogService.openSimpleDialog({title:{key:"deleteItem"},content:{key:"deleteItemConfirmation"},type:"warning"})))return;const t=yield(0,bo._)(this.userId$);try{yield this.cipherService.softDeleteWithServer(e.id,t)}catch(e){return void this.logService.error(e)}this.toastService.showToast({variant:"success",message:this.i18nService.t("deletedItem")})})}unarchive(e){return V5(this,void 0,void 0,function*(){if(!(yield this.canInteract(e)))return;const t=yield(0,bo._)(this.userId$);yield this.cipherArchiveService.unarchiveWithServer(e.id,t),this.toastService.showToast({variant:"success",message:this.i18nService.t("itemUnarchivedToast")})})}clone(e){return V5(this,void 0,void 0,function*(){if(yield this.canInteract(e)){if(t$.hasFido2Credentials(e)){if(!(yield this.dialogService.openSimpleDialog({title:{key:"passkeyNotCopied"},content:{key:"passkeyNotCopiedAlert"},type:"info"})))return}yield this.router.navigate(["/clone-cipher"],{queryParams:{clone:(!0).toString(),cipherId:e.id,type:e.type}})}})}conditionallyNavigateToAssignCollections(e){return V5(this,void 0,void 0,function*(){e.reprompt&&!(yield this.passwordRepromptService.showPasswordPrompt())||(yield this.router.navigate(["/assign-collections"],{queryParams:{cipherId:e.id}}))})}canInteract(e){return t$.decryptionFailure(e)?(NL.open(this.dialogService,{cipherIds:[e.id]}),!1):this.passwordRepromptService.passwordRepromptCheck(e)}orgTierType({organizationId:e}){var t,i;return null===(i=null===(t=this.orgMap())||void 0===t?void 0:t.get(e))||void 0===i?void 0:i.productTierType}orgIconTooltip({collectionIds:e}){var t,i;return 1!==e.length?this.i18nService.t("nCollections",e.length):null===(i=null===(t=this.collections())||void 0===t?void 0:t.find(t=>t.id===e[0]))||void 0===i?void 0:i.name}}H5.ɵfac=function(e){return new(e||H5)},H5.ɵcmp=Fl.VBU({type:H5,selectors:[["ng-component"]],decls:10,vars:12,consts:[["moreOptions",""],[3,"loading"],["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[1,"tw-mb-4"],[1,"tw-flex","tw-gap-2","tw-items-baseline"],["aria-hidden","true",1,"bwi","bwi-info-circle"],["bitTypography","h5",1,"tw-font-[500]"],["bitTypography","body2",1,"tw-mb-3"],["type","button","bitButton","","buttonType","primary",3,"click"],[1,"tw-flex","tw-h-full","tw-items-center","tw-justify-center"],["bitTypography","h6"],["bitTypography","body1","slot","end"],["bit-item-content","","type","button",3,"click","appA11yTitle"],["slot","start",1,"tw-justify-start","tw-w-7","tw-flex"],[3,"cipher"],["data-testid","item-name"],["slot","default-trailing",1,"tw-flex","tw-gap-1.5"],["appOrgIcon","",3,"tierType","size","appA11yTitle"],["slot","default-trailing",1,"bwi","bwi-paperclip","bwi-sm",3,"appA11yTitle"],["slot","secondary"],["type","button","bitIconButton","bwi-ellipsis-v","size","small",3,"label","appA11yTitle","bitMenuTriggerFor"],["type","button","bitMenuItem","",3,"click"],["type","button","bitMenuItem",""],["type","button","bitMenuItem","",3,"click",4,"appCanDeleteCipher"],[1,"tw-text-danger"],["slot","title"],["slot","description"]],template:function(e,t){if(1&e&&(Fl.j41(0,"popup-page",1),Fl.nI1(1,"async"),Fl.j41(2,"popup-header",2),Fl.nI1(3,"i18n"),Fl.qex(4,3),Fl.nrm(5,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.nVh(6,j5,12,9,"bit-card",4),Fl.nI1(7,"async"),Fl.nVh(8,Y5,2,1),Fl.nI1(9,"async"),Fl.k0s()),2&e){let e;Fl.Y8G("loading",Fl.bMT(1,4,t.loading$)),Fl.R7$(2),Fl.Y8G("pageTitle",Fl.bMT(3,6,"archiveNoun")),Fl.R7$(4),Fl.vxM(Fl.bMT(7,8,t.showSubscriptionEndedMessaging$)?6:-1),Fl.R7$(2),Fl.vxM((e=Fl.bMT(9,10,t.archivedCiphers$))?8:-1,e)}},dependencies:[kl.MD,sf,rw,RU,tE,aE,GD,Wh,cG,VP,GP,KP,BP,XP,qh,pz,fz,D$,Ql,Zl,z$,Ux,Nx,tc,rc,G$,Ex,td,kl.Jj,rf],encapsulation:2});var J5=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Z5{constructor(e,t){this.nudgesService=e,this.accountService=t}ngOnInit(){return J5(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));yield this.nudgesService.dismissNudge(Sx.DownloadBitwarden,e)})}}Z5.ɵfac=function(e){return new(e||Z5)(Fl.rXU(Ix),Fl.rXU(Zk))},Z5.ɵcmp=Fl.VBU({type:Z5,selectors:[["ng-component"]],decls:32,vars:27,consts:[["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],["bitTypography","h6"],["bitTypography","body2"],[1,"tw-flex","tw-items-center","tw-justify-center","tw-my-4"],["src","../../../images/download-qr.png","alt","",1,"tw-w-[43%]","tw-border-solid","tw-border","tw-border-secondary-300","tw-rounded-lg"],[1,"tw-flex","tw-justify-center","tw-gap-4"],["target","_blank","href","https://apps.apple.com/app/bitwarden-password-manager/id1137397744","bitLink","",1,"tw-w-[43%]","!tw-py-0"],["src","../../../images/app-store.png",1,"tw-w-full",3,"alt"],["target","_blank","href","https://play.google.com/store/apps/details?id=com.x8bit.bitwarden","bitLink","",1,"tw-w-[43%]","!tw-py-0"],["src","../../../images/google-play.png",1,"tw-w-full",3,"alt"],["bitTypography","h6",1,"tw-mt-6"],["href","https://bitwarden.com/download/#downloads-desktop","bitLink","","target","_blank",1,"tw-text-primary-600","tw-mt-4","tw-flex","tw-no-underline","tw-gap-2","tw-items-center"],["slot","end","aria-hidden","true",1,"bwi","bwi-external-link"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page")(1,"popup-header",0),Fl.nI1(2,"i18n"),Fl.qex(3,1),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.j41(5,"h2",2),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s(),Fl.j41(8,"bit-card")(9,"span",3),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.k0s(),Fl.j41(12,"div",4),Fl.nrm(13,"img",5),Fl.k0s(),Fl.j41(14,"div",6)(15,"a",7),Fl.nrm(16,"img",8),Fl.nI1(17,"i18n"),Fl.k0s(),Fl.j41(18,"a",9),Fl.nrm(19,"img",10),Fl.nI1(20,"i18n"),Fl.k0s()()(),Fl.j41(21,"h2",11),Fl.EFF(22),Fl.nI1(23,"i18n"),Fl.k0s(),Fl.j41(24,"bit-card")(25,"span",3),Fl.EFF(26),Fl.nI1(27,"i18n"),Fl.k0s(),Fl.j41(28,"a",12),Fl.EFF(29),Fl.nI1(30,"i18n"),Fl.nrm(31,"i",13),Fl.k0s()()()),2&e&&(Fl.R7$(),Fl.Y8G("pageTitle",Fl.mNQ(Fl.bMT(2,11,"downloadBitwarden"))),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(7,13,"getTheMobileApp")," "),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(11,15,"getTheMobileAppDesc")," "),Fl.R7$(6),Fl.Y8G("alt",Fl.mNQ(Fl.bMT(17,17,"downloadOnTheAppStore"))),Fl.R7$(3),Fl.Y8G("alt",Fl.mNQ(Fl.bMT(20,19,"getItOnGooglePlay"))),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(23,21,"getTheDesktopApp")," "),Fl.R7$(4),Fl.JRh(Fl.bMT(27,23,"getTheDesktopAppDesc")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(30,25,"downloadFromBitwardenNow")," "))},dependencies:[kl.MD,sf,Cw.iI,tE,aE,GD,Ex,tc,rc,Hh,uw,rf],encapsulation:2});const Q5=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="2 12.5 93.63 72">
<path class="tw-fill-illustration-bg-secondary" d="M2 21.5a6 6 0 0 1 6-6h17.24a6 6 0 0 1 4.556 2.095L34 22.5h52a4 4 0 0 1 4 4v36c0 12.15-9.85 22-22 22H7a5 5 0 0 1-5-5v-58Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="m33.08 24.5-4.803-5.603A4 4 0 0 0 25.24 17.5H8a4 4 0 0 0-4 4v58a3 3 0 0 0 3 3h61c11.046 0 20-8.954 20-20v-36a2 2 0 0 0-2-2H33.08Zm.92-2-4.204-4.905A6 6 0 0 0 25.24 15.5H8a6 6 0 0 0-6 6v58a5 5 0 0 0 5 5h61c12.15 0 22-9.85 22-22v-36a4 4 0 0 0-4-4H34Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="M11.02 40.3a6 6 0 0 1 5.88-4.8H91.1a4 4 0 0 1 3.92 4.8L86.98 79.7a6 6 0 0 1-5.88 4.8H6.9a4 4 0 0 1-3.92-4.8l8.042-39.4Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M91.101 37.5H16.9a4 4 0 0 0-3.919 3.2L4.94 80.1a2 2 0 0 0 1.959 2.4H81.1a4 4 0 0 0 3.92-3.2l8.04-39.4a2 2 0 0 0-1.96-2.4Zm-74.202-2a6 6 0 0 0-5.879 4.8L2.98 79.7a4 4 0 0 0 3.919 4.8H81.1a6 6 0 0 0 5.879-4.8l8.04-39.4a4 4 0 0 0-3.919-4.8H16.9Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-tertiary" d="M84 32.5c0 11.046-8.954 20-20 20s-20-8.954-20-20 8.954-20 20-20 20 8.954 20 20Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M64 50.5c9.941 0 18-8.059 18-18s-8.059-18-18-18-18 8.059-18 18 8.059 18 18 18Zm0 2c11.046 0 20-8.954 20-20s-8.954-20-20-20-20 8.954-20 20 8.954 20 20 20Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" d="M79 32.5c0 8.284-6.716 15-15 15-8.284 0-15-6.716-15-15 0-8.284 6.716-15 15-15 8.284 0 15 6.716 15 15Z"/>
<path class="tw-fill-illustration-outline" d="M95.004 61.587 78.5 46l-2 2 15.587 16.504a2 2 0 0 0 2.868.04l.09-.089a2 2 0 0 0-.041-2.868Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M61.573 34.578a.948.948 0 0 0 .948.922h.53a.948.948 0 0 0 .949-.948V33.5c2.817-.04 5-1.603 5-4.5 0-3.072-2.037-4.5-5-4.5-2.59 0-4.918 1.71-5.04 4.18-.023.47.39.82.862.82h.23c.523 0 .93-.435 1.086-.935.404-1.3 1.633-2.065 2.862-2.065 1.5 0 2.75.888 2.75 2.5 0 2.387-2.564 2.82-4.52 2.888a.73.73 0 0 0-.71.742l.053 1.948ZM62.75 40c1.104 0 2-.672 2-1.5s-.896-1.5-2-1.5c-1.105 0-2 .672-2 1.5s.895 1.5 2 1.5Z" clip-rule="evenodd"/>
</svg>
`;function e9(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-item")(1,"bit-item-content"),Fl.EFF(2),Fl.j41(3,"button",8),Fl.nI1(4,"i18n"),Fl.bIt("click",function(){const t=a.eBV(e).$implicit,i=Fl.XpG(3);return a.Njj(i.openAddEditFolderDialog(t))}),Fl.k0s()()()}if(2&e){const e=t.$implicit;Fl.R7$(2),Fl.SpI(" ",e.name," "),Fl.R7$(),Fl.Y8G("label",Fl.i5U(4,2,"editFolderWithName",e.name))}}function t9(e,t){if(1&e&&(Fl.qex(0),Fl.j41(1,"bit-item-group"),Fl.DNE(2,e9,5,5,"bit-item",7),Fl.k0s(),Fl.bVm()),2&e){const e=Fl.XpG().ngIf;Fl.R7$(2),Fl.Y8G("ngForOf",e)}}function i9(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-no-items",9),Fl.qex(1,10),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.bVm(),Fl.qex(4,11),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.bVm(),Fl.j41(7,"button",12),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2);return a.Njj(t.openAddEditFolderDialog())}),Fl.nrm(8,"i",4),Fl.EFF(9),Fl.nI1(10,"i18n"),Fl.k0s()()}if(2&e){const e=Fl.XpG(2);Fl.Y8G("icon",e.NoFoldersIcon),Fl.R7$(2),Fl.JRh(Fl.bMT(3,4,"noFoldersAdded")),Fl.R7$(3),Fl.JRh(Fl.bMT(6,6,"createFoldersToOrganize")),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(10,8,"newFolder")," ")}}function n9(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,t9,3,1,"ng-container",6)(2,i9,11,10,"ng-template",null,0,Fl.C5r),Fl.bVm()),2&e){const e=t.ngIf,i=Fl.sdS(3);Fl.R7$(),Fl.Y8G("ngIf",e.length)("ngIfElse",i)}}class r9{constructor(e,t,i){this.folderService=e,this.dialogService=t,this.accountService=i,this.NoFoldersIcon=Q5,this.activeUserId$=this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)),this.folders$=this.activeUserId$.pipe((0,Eo.p)(e=>null!==e),(0,go.n)(e=>this.folderService.folderViews$(e)))}openAddEditFolderDialog(e){const t=e?{folder:e}:void 0;KL.open(this.dialogService,{editFolderConfig:t})}}r9.ɵfac=function(e){return new(e||r9)(Fl.rXU(UM),Fl.rXU(lh),Fl.rXU(Zk))},r9.ɵcmp=Fl.VBU({type:r9,selectors:[["ng-component"]],decls:11,vars:9,consts:[["noFolders",""],["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],["bitButton","","size","small","buttonType","primary","type","button",3,"click"],["aria-hidden","true",1,"bwi","bwi-plus"],[4,"ngIf"],[4,"ngIf","ngIfElse"],[4,"ngFor","ngForOf"],["slot","end","type","button","bitIconButton","bwi-pencil-square","data-testid","edit-folder-button",1,"tw-self-end",3,"click","label"],[1,"tw-h-full","tw-flex","tw-items-center",3,"icon"],["slot","title"],["slot","description"],["bitButton","","buttonType","primary","type","button","slot","button","data-testid","empty-new-folder-button",3,"click"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page")(1,"popup-header",1),Fl.nI1(2,"i18n"),Fl.qex(3,2),Fl.j41(4,"button",3),Fl.bIt("click",function(){return t.openAddEditFolderDialog()}),Fl.nrm(5,"i",4),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s(),Fl.nrm(8,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.DNE(9,n9,4,2,"ng-container",5),Fl.nI1(10,"async"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.Y8G("pageTitle",Fl.bMT(2,3,"folders")),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(7,5,"new")," "),Fl.R7$(3),Fl.Y8G("ngIf",Fl.bMT(10,7,t.folders$)))},dependencies:[kl.MD,kl.Sq,kl.bT,sf,GD,tE,aE,VP,GP,KP,XP,Wh,cG,Ql,Zl,id,td,pc,kl.Jj,rf],encapsulation:2});class s9{constructor(e,t,i){this.policyService=e,this.organizationService=t,this.accountService=i}hasSingleEnterpriseOrg$(){return iv(this.accountService.activeAccount$).pipe((0,go.n)(e=>this.organizationService.organizations$(e).pipe((0,l.T)(e=>1===e.filter(e=>e.canManageSponsorships).length))))}isFreeFamilyPolicyEnabled$(){return this.hasSingleEnterpriseOrg$().pipe((0,go.n)(e=>e?iv(this.accountService.activeAccount$).pipe((0,go.n)(e=>this.organizationService.organizations$(e).pipe((0,l.T)(e=>{var t;return null===(t=e.find(e=>e.canManageSponsorships))||void 0===t?void 0:t.id}),(0,go.n)(t=>this.policyService.policiesByType$(op.FreeFamiliesSponsorshipPolicy,e).pipe((0,l.T)(e=>{var i,n;return null!==(n=null===(i=e.find(e=>e.organizationId===t))||void 0===i?void 0:i.enabled)&&void 0!==n&&n})))))):(0,Go.of)(!1)))}}s9.ɵfac=function(e){return new(e||s9)(a.KVO(Jb),a.KVO(WF),a.KVO(Zk))},s9.ɵprov=a.jDH({token:s9,factory:s9.ɵfac,providedIn:"root"});var o9=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function a9(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-item")(1,"button",3),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG();return a.Njj(t.openFreeBitwardenFamiliesPage())}),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.nrm(4,"i",4),Fl.k0s()()}2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"freeBitwardenFamilies")," "))}class l9{constructor(e,t,i,n,r){this.dialogService=e,this.environmentService=t,this.organizationService=i,this.familiesPolicyService=n,this.accountService=r,this.familySponsorshipAvailable$=iv(this.accountService.activeAccount$).pipe((0,go.n)(e=>this.organizationService.familySponsorshipAvailable$(e))),this.hasSingleEnterpriseOrg$=this.familiesPolicyService.hasSingleEnterpriseOrg$(),this.isFreeFamilyPolicyEnabled$=this.familiesPolicyService.isFreeFamilyPolicyEnabled$()}openFreeBitwardenFamiliesPage(){return o9(this,void 0,void 0,function*(){if(yield this.dialogService.openSimpleDialog({title:{key:"continueToWebApp"},content:{key:"freeBitwardenFamiliesPageDesc"},type:"info",acceptButtonText:{key:"continue"}})){const e=(yield(0,bo._)(this.environmentService.environment$)).getWebVaultUrl();yield ul.createNewTab(e+"/#/settings/sponsored-families")}})}openBitwardenForBusinessPage(){return o9(this,void 0,void 0,function*(){(yield this.dialogService.openSimpleDialog({title:{key:"continueToBitwardenDotCom"},content:{key:"bitwardenForBusinessPageDesc"},type:"info",acceptButtonText:{key:"continue"}}))&&(yield ul.createNewTab("https://bitwarden.com/products/business/"))})}openAuthenticatorPage(){return o9(this,void 0,void 0,function*(){(yield this.dialogService.openSimpleDialog({title:{key:"continueToBitwardenDotCom"},content:{key:"continueToAuthenticatorPageDesc"},type:"info",acceptButtonText:{key:"continue"}}))&&(yield ul.createNewTab("https://bitwarden.com/products/authenticator"))})}openSecretsManagerPage(){return o9(this,void 0,void 0,function*(){(yield this.dialogService.openSimpleDialog({title:{key:"continueToBitwardenDotCom"},content:{key:"continueToSecretsManagerPageDesc"},type:"info",acceptButtonText:{key:"continue"}}))&&(yield ul.createNewTab("https://bitwarden.com/products/secrets-manager"))})}openPasswordlessDotDevPage(){return o9(this,void 0,void 0,function*(){(yield this.dialogService.openSimpleDialog({title:{key:"continueToBitwardenDotCom"},content:{key:"continueToPasswordlessDotDevPageDesc"},type:"info",acceptButtonText:{key:"continue"}}))&&(yield ul.createNewTab("https://bitwarden.com/products/passwordless"))})}}l9.ɵfac=function(e){return new(e||l9)(Fl.rXU(lh),Fl.rXU(mk),Fl.rXU(WF),Fl.rXU(s9),Fl.rXU(Zk))},l9.ɵcmp=Fl.VBU({type:l9,selectors:[["ng-component"]],decls:30,vars:23,consts:[["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[4,"ngIf"],["type","button","bit-item-content","",3,"click"],["slot","end","aria-hidden","true",1,"bwi","bwi-external-link"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page")(1,"popup-header",0),Fl.nI1(2,"i18n"),Fl.qex(3,1),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.j41(5,"bit-item-group"),Fl.DNE(6,a9,5,3,"bit-item",2),Fl.nI1(7,"async"),Fl.nI1(8,"async"),Fl.nI1(9,"async"),Fl.j41(10,"bit-item")(11,"button",3),Fl.bIt("click",function(){return t.openBitwardenForBusinessPage()}),Fl.EFF(12),Fl.nI1(13,"i18n"),Fl.nrm(14,"i",4),Fl.k0s()(),Fl.j41(15,"bit-item")(16,"button",3),Fl.bIt("click",function(){return t.openAuthenticatorPage()}),Fl.EFF(17),Fl.nI1(18,"i18n"),Fl.nrm(19,"i",4),Fl.k0s()(),Fl.j41(20,"bit-item")(21,"button",3),Fl.bIt("click",function(){return t.openSecretsManagerPage()}),Fl.EFF(22),Fl.nI1(23,"i18n"),Fl.nrm(24,"i",4),Fl.k0s()(),Fl.j41(25,"bit-item")(26,"button",3),Fl.bIt("click",function(){return t.openPasswordlessDotDevPage()}),Fl.EFF(27),Fl.nI1(28,"i18n"),Fl.nrm(29,"i",4),Fl.k0s()()()()),2&e&&(Fl.R7$(),Fl.Y8G("pageTitle",Fl.mNQ(Fl.bMT(2,7,"moreFromBitwarden"))),Fl.R7$(5),Fl.Y8G("ngIf",Fl.bMT(7,9,t.familySponsorshipAvailable$)&&!(Fl.bMT(8,11,t.isFreeFamilyPolicyEnabled$)&&Fl.bMT(9,13,t.hasSingleEnterpriseOrg$))),Fl.R7$(6),Fl.SpI(" ",Fl.bMT(13,15,"bitwardenForBusiness")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(18,17,"bitwardenAuthenticator")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(23,19,"bitwardenSecretsManager")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(28,21,"passwordlessDotDev")," "))},dependencies:[kl.MD,kl.bT,sf,Cw.iI,tE,aE,GD,VP,GP,KP,XP,kl.Jj,rf],encapsulation:2});const c9=Fw`
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0.22 7 95.71 88">
<path class="tw-fill-illustration-bg-primary" d="M.232 9.21A2 2 0 0 1 2.222 7h67.556a2 2 0 0 1 1.99 2.21l-7.014 66.627A8 8 0 0 1 56.798 83H15.202a8 8 0 0 1-7.956-7.162L.232 9.209Z"/>
<path class="tw-fill-illustration-bg-secondary" d="M60.283 80.99C63.59 80.76 61.313 77 58 77H14c-3.314 0-5.59 3.759-2.284 3.99.094.007.189.01.284.01h48c.095 0 .19-.003.283-.01Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M69.778 9H2.221l7.014 66.628A6 6 0 0 0 15.202 81h41.596a6 6 0 0 0 5.967-5.372L69.778 9ZM2.221 7A2 2 0 0 0 .232 9.21l7.014 66.627A8 8 0 0 0 15.202 83h41.596a8 8 0 0 0 7.956-7.162l7.013-66.629A2 2 0 0 0 69.778 7H2.221Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M36 25a1 1 0 0 1 1 1v38a1 1 0 1 1-2 0V26a1 1 0 0 1 1-1ZM27.079 64.997a1 1 0 0 1-1.076-.918l-3-38a1 1 0 1 1 1.994-.158l3 38a1 1 0 0 1-.918 1.076ZM44.921 64.997a1 1 0 0 0 1.076-.918l3-38a1 1 0 1 0-1.994-.158l-3 38a1 1 0 0 0 .918 1.076ZM80.91 29.443a1 1 0 0 0 .688 1.236l5.522 1.573a3 3 0 0 1 2.09 2.168l4.63 18.795a3 3 0 0 1-.844 2.891l-4.159 3.958a1 1 0 1 0 1.379 1.449l4.158-3.958a5 5 0 0 0 1.408-4.818l-4.63-18.795a5 5 0 0 0-3.484-3.613l-5.522-1.573a1 1 0 0 0-1.235.687Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-bg-primary" d="M73.248 10.117c-1.526-.79-3.272.586-2.861 2.254l17.026 69.12c.411 1.668 2.596 2.075 3.581.667l1.486-2.124a8 8 0 0 0 1.213-6.5L79.643 16.5a8 8 0 0 0-4.093-5.192l-2.302-1.191Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M89.355 81.012 72.33 11.893l2.303 1.191a6 6 0 0 1 3.07 3.894L91.75 74.013a6 6 0 0 1-.91 4.875l-1.486 2.124Zm-18.968-68.64c-.411-1.669 1.335-3.045 2.86-2.255l2.303 1.19a8 8 0 0 1 4.093 5.193l14.05 57.035a8 8 0 0 1-1.213 6.5l-1.486 2.123c-.985 1.408-3.17 1-3.58-.668L70.386 12.372Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-tertiary" d="M48 83c0 6.627-5.373 12-12 12s-12-5.373-12-12 5.373-12 12-12 12 5.373 12 12Z"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M36 93c5.523 0 10-4.477 10-10s-4.477-10-10-10-10 4.477-10 10 4.477 10 10 10Zm0 2c6.627 0 12-5.373 12-12s-5.373-12-12-12-12 5.373-12 12 5.373 12 12 12Z" clip-rule="evenodd"/>
<path class="tw-fill-illustration-outline" fill-rule="evenodd" d="M41.707 79.293a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414 0l-3-3a1 1 0 0 1 1.414-1.414L34 85.586l6.293-6.293a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"/>
</svg>
`;var u9=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function d9(e,t){if(1&e&&Fl.nrm(0,"i",13),2&e){const e=Fl.XpG().$implicit,t=Fl.XpG(2);Fl.Y8G("tierType",e.organization.productTierType)("size","small")("appA11yTitle",t.orgIconTooltip(e))}}function h9(e,t){1&e&&(Fl.nrm(0,"i",14),Fl.nI1(1,"i18n")),2&e&&Fl.Y8G("appA11yTitle",Fl.bMT(1,1,"attachments"))}function p9(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",19),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2).$implicit,i=Fl.XpG(2);return a.Njj(i.restore(t))}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"restore")," "))}function v9(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"button",19),Fl.bIt("click",function(){a.eBV(e);const t=Fl.XpG(2).$implicit,i=Fl.XpG(2);return a.Njj(i.delete(t))}),Fl.EFF(1),Fl.nI1(2,"i18n"),Fl.k0s()}2&e&&(Fl.R7$(),Fl.SpI(" ",Fl.bMT(2,1,"deleteForever")," "))}function f9(e,t){if(1&e&&(Fl.qex(0,15),Fl.j41(1,"bit-item-action"),Fl.nrm(2,"button",16),Fl.nI1(3,"i18n"),Fl.j41(4,"bit-menu",null,0),Fl.DNE(6,p9,3,3,"button",17)(7,v9,3,3,"button",18),Fl.k0s()(),Fl.bVm()),2&e){const e=Fl.sdS(5),t=Fl.XpG().$implicit,i=Fl.XpG(2);Fl.R7$(2),Fl.Y8G("label",Fl.i5U(3,4,"moreOptionsLabel",t.name))("bitMenuTriggerFor",e),Fl.R7$(4),Fl.Y8G("ngIf",!i.hasDecryptionFailure(t)),Fl.R7$(),Fl.Y8G("appCanDeleteCipher",t)}}function m9(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-item")(1,"button",5),Fl.nI1(2,"i18n"),Fl.bIt("click",function(){const t=a.eBV(e).$implicit,i=Fl.XpG(2);return a.Njj(i.onViewCipher(t))}),Fl.j41(3,"div",6),Fl.nrm(4,"app-vault-icon",7),Fl.k0s(),Fl.j41(5,"span",8),Fl.EFF(6),Fl.k0s(),Fl.DNE(7,d9,1,3,"i",9)(8,h9,2,3,"i",10),Fl.j41(9,"span",11),Fl.EFF(10),Fl.k0s()(),Fl.DNE(11,f9,8,7,"ng-container",12),Fl.k0s()}if(2&e){const e=t.$implicit,i=Fl.XpG(2);Fl.R7$(),Fl.Y8G("appA11yTitle",Fl.i5U(2,7,"viewItemTitle",e.name)),Fl.R7$(3),Fl.Y8G("cipher",e),Fl.R7$(2),Fl.JRh(e.name),Fl.R7$(),Fl.Y8G("ngIf",e.organizationId),Fl.R7$(),Fl.Y8G("ngIf",i.hasAttachments(e)),Fl.R7$(2),Fl.JRh(i.getSubtitle(e)),Fl.R7$(),Fl.Y8G("ngIf",e.permissions.restore)}}function g9(e,t){if(1&e&&(Fl.j41(0,"bit-section")(1,"bit-section-header")(2,"h2",2),Fl.EFF(3),Fl.k0s(),Fl.j41(4,"span",3),Fl.EFF(5),Fl.k0s()(),Fl.j41(6,"bit-item-group"),Fl.DNE(7,m9,12,10,"bit-item",4),Fl.k0s()()),2&e){const e=Fl.XpG();Fl.R7$(3),Fl.SpI(" ",e.headerText," "),Fl.R7$(2),Fl.JRh(e.ciphers.length),Fl.R7$(2),Fl.Y8G("ngForOf",e.ciphers)}}class y9{constructor(e,t,i,n,r,s,o,a){this.cipherService=e,this.logService=t,this.toastService=i,this.i18nService=n,this.dialogService=r,this.passwordRepromptService=s,this.accountService=o,this.router=a,this.ciphers=[]}orgIconTooltip({collections:e,collectionIds:t}){var i;return t.length>1?this.i18nService.t("nCollections",t.length):null===(i=e[0])||void 0===i?void 0:i.name}hasAttachments(e){return"hasAttachments"in e?e.hasAttachments:e.attachments>0}getSubtitle(e){return"subTitle"in e?e.subTitle:e.subtitle}hasDecryptionFailure(e){return"decryptionFailure"in e&&e.decryptionFailure}restore(e){return u9(this,void 0,void 0,function*(){let t;try{const i=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));yield this.cipherService.restoreWithServer(e.id,i),t=e.archivedDate?this.i18nService.t("archivedItemRestored"):this.i18nService.t("restoredItem"),yield this.router.navigate(["/trash"]),this.toastService.showToast({variant:"success",title:null,message:t})}catch(e){this.logService.error(e)}})}delete(e){return u9(this,void 0,void 0,function*(){if(!(yield this.passwordRepromptService.passwordRepromptCheck(e)))return;if(yield this.dialogService.openSimpleDialog({title:{key:"deleteItem"},content:{key:"permanentlyDeleteItemConfirmation"},type:"warning"}))try{const t=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));yield this.cipherService.deleteWithServer(e.id,t),yield this.router.navigate(["/trash"]),this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("permanentlyDeletedItem")})}catch(e){this.logService.error(e)}})}onViewCipher(e){return u9(this,void 0,void 0,function*(){if("decryptionFailure"in e&&e.decryptionFailure)return void NL.open(this.dialogService,{cipherIds:[e.id]});(yield this.passwordRepromptService.passwordRepromptCheck(e))&&(yield this.router.navigate(["/view-cipher"],{queryParams:{cipherId:e.id,type:e.type}}))})}}function b9(e,t){1&e&&(Fl.j41(0,"bit-callout",6),Fl.nI1(1,"i18n"),Fl.nI1(2,"titlecase"),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s()),2&e&&(Fl.Y8G("title",Fl.mNQ(Fl.bMT(2,5,Fl.bMT(1,3,"warning")))),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,7,"trashWarning")," "))}function w9(e,t){if(1&e&&(Fl.qex(0),Fl.nrm(1,"app-trash-list-items-container",7),Fl.nI1(2,"i18n"),Fl.bVm()),2&e){const e=Fl.XpG().ngIf;Fl.R7$(),Fl.Y8G("headerText",Fl.bMT(2,2,"itemsInTrash"))("ciphers",e)}}function S9(e,t){if(1&e&&(Fl.j41(0,"bit-no-items",8),Fl.qex(1,9),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.bVm(),Fl.qex(4,10),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.bVm(),Fl.k0s()),2&e){const e=Fl.XpG(2);Fl.Y8G("icon",e.emptyTrashIcon),Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,3,"noItemsInTrash")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(6,5,"noItemsInTrashDesc")," ")}}function k9(e,t){if(1&e&&(Fl.qex(0),Fl.DNE(1,b9,5,9,"bit-callout",4)(2,w9,3,4,"ng-container",5)(3,S9,7,7,"ng-template",null,0,Fl.C5r),Fl.bVm()),2&e){const e=t.ngIf,i=Fl.sdS(4);Fl.R7$(),Fl.Y8G("ngIf",e.length),Fl.R7$(),Fl.Y8G("ngIf",e.length)("ngIfElse",i)}}y9.ɵfac=function(e){return new(e||y9)(Fl.rXU(_b),Fl.rXU(Za),Fl.rXU(qb),Fl.rXU(Ul),Fl.rXU(lh),Fl.rXU(k$),Fl.rXU(Zk),Fl.rXU(Fd.Ix))},y9.ɵcmp=Fl.VBU({type:y9,selectors:[["app-trash-list-items-container"]],inputs:{ciphers:"ciphers",headerText:"headerText"},decls:1,vars:1,consts:[["moreOptions",""],[4,"ngIf"],["bitTypography","h6"],["bitTypography","body1","slot","end"],[4,"ngFor","ngForOf"],["bit-item-content","","type","button",3,"click","appA11yTitle"],["slot","start",1,"tw-justify-start","tw-w-7","tw-flex"],[3,"cipher"],["data-testid","item-name"],["appOrgIcon","",3,"tierType","size","appA11yTitle",4,"ngIf"],["class","bwi bwi-paperclip bwi-sm",3,"appA11yTitle",4,"ngIf"],["slot","secondary"],["slot","end",4,"ngIf"],["appOrgIcon","",3,"tierType","size","appA11yTitle"],[1,"bwi","bwi-paperclip","bwi-sm",3,"appA11yTitle"],["slot","end"],["type","button","bitIconButton","bwi-ellipsis-v","size","small",3,"label","bitMenuTriggerFor"],["type","button","bitMenuItem","",3,"click",4,"ngIf"],["type","button","bitMenuItem","",3,"click",4,"appCanDeleteCipher"],["type","button","bitMenuItem","",3,"click"]],template:function(e,t){1&e&&Fl.DNE(0,g9,8,3,"bit-section",1),2&e&&Fl.Y8G("ngIf",null==t.ciphers?null:t.ciphers.length)},dependencies:[kl.MD,kl.Sq,kl.bT,VP,GP,KP,BP,XP,sf,rw,RU,Ux,Nx,z$,qh,pz,fz,D$,Ql,Zl,G$,tc,rc,rf],encapsulation:2,changeDetection:0});class I9{constructor(e){this.vaultPopupItemsService=e,this.deletedCiphers$=this.vaultPopupItemsService.deletedCiphers$,this.emptyTrashIcon=c9}}I9.ɵfac=function(e){return new(e||I9)(Fl.rXU(F8))},I9.ɵcmp=Fl.VBU({type:I9,selectors:[["ng-component"]],decls:7,vars:6,consts:[["noDeletedItems",""],["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[4,"ngIf"],["type","warning",3,"title",4,"ngIf"],[4,"ngIf","ngIfElse"],["type","warning",3,"title"],[3,"headerText","ciphers"],[1,"tw-flex","tw-h-full","tw-items-center","tw-justify-center",3,"icon"],["slot","title"],["slot","description"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page")(1,"popup-header",1),Fl.nI1(2,"i18n"),Fl.qex(3,2),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.DNE(5,k9,5,3,"ng-container",3),Fl.nI1(6,"async"),Fl.k0s()),2&e&&(Fl.R7$(),Fl.Y8G("pageTitle",Fl.bMT(2,2,"trash")),Fl.R7$(4),Fl.Y8G("ngIf",Fl.bMT(6,4,t.deletedCiphers$)))},dependencies:[kl.MD,kl.bT,sf,tE,aE,GD,y9,dd,ud,Wh,cG,kl.Jj,kl.PV,rf],encapsulation:2,changeDetection:0});var C9=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function T9(e,t){1&e&&(Fl.j41(0,"span",14),Fl.nI1(1,"i18n"),Fl.EFF(2," 1 "),Fl.k0s()),2&e&&Fl.BMQ("aria-label",Fl.bMT(1,1,"nudgeBadgeAria"))}function P9(e,t){1&e&&(Fl.j41(0,"bit-item")(1,"a",15),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.nrm(4,"i",3),Fl.k0s()()),2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,1,"archiveNoun")," "))}function F9(e,t){if(1&e){const e=Fl.RV6();Fl.j41(0,"bit-item")(1,"a",16),Fl.bIt("click",function(t){a.eBV(e);const i=Fl.XpG(2);return a.Njj(i.conditionallyRouteToArchive(t))}),Fl.j41(2,"span",17),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.nrm(5,"app-premium-badge"),Fl.k0s(),Fl.nrm(6,"i",3),Fl.k0s()()}2&e&&(Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,1,"archiveNoun")," "))}function R9(e,t){if(1&e&&Fl.nVh(0,P9,5,3,"bit-item")(1,F9,7,3,"bit-item"),2&e){const e=Fl.XpG();Fl.vxM(e.userCanArchive()?0:1)}}class x9{constructor(e,t,i,n,r,s,a){this.router=e,this.syncService=t,this.toastService=i,this.i18nService=n,this.nudgeService=r,this.accountService=s,this.cipherArchiveService=a,this.premiumBadgeComponent=(0,o.ebz)(ZU),this.lastSync="--",this.userId$=this.accountService.activeAccount$.pipe(iv),this.userCanArchive=(0,xl.ot)(this.userId$.pipe((0,go.n)(e=>this.cipherArchiveService.userCanArchive$(e)))),this.showArchiveItem=(0,xl.ot)(this.cipherArchiveService.hasArchiveFlagEnabled$),this.userHasArchivedItems=(0,xl.ot)(this.userId$.pipe((0,go.n)(e=>this.cipherArchiveService.archivedCiphers$(e).pipe((0,l.T)(e=>e.length>0))))),this.emptyVaultImportBadge$=this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.nudgeService.showNudgeBadge$(Sx.VaultSettingsImportNudge,e)))}ngOnInit(){return C9(this,void 0,void 0,function*(){yield this.setLastSync()})}ngOnDestroy(){return C9(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));yield this.nudgeService.dismissNudge(Sx.VaultSettingsImportNudge,e)})}import(){return C9(this,void 0,void 0,function*(){yield this.router.navigate(["/import"])})}sync(){return C9(this,void 0,void 0,function*(){let e;(yield this.syncService.fullSync(!0))?(yield this.setLastSync(),e={variant:"success",title:"",message:this.i18nService.t("syncingComplete")}):e={variant:"error",title:"",message:this.i18nService.t("syncingFailed")},this.toastService.showToast(e)})}setLastSync(){return C9(this,void 0,void 0,function*(){const e=yield this.syncService.getLastSync();this.lastSync=null!=e?e.toLocaleDateString()+" "+e.toLocaleTimeString():this.i18nService.t("never")})}conditionallyRouteToArchive(e){return C9(this,void 0,void 0,function*(){e.preventDefault();const t=this.premiumBadgeComponent();this.userCanArchive()||this.userHasArchivedItems()?yield this.router.navigate(["/archive"]):t&&(yield t.promptForPremium(e))})}}x9.ɵfac=function(e){return new(e||x9)(Fl.rXU(Fd.Ix),Fl.rXU(qx),Fl.rXU(qb),Fl.rXU(Ul),Fl.rXU(Ix),Fl.rXU(Zk),Fl.rXU($V))},x9.ɵcmp=Fl.VBU({type:x9,selectors:[["ng-component"]],viewQuery:function(e,t){1&e&&Fl.wEZ(t.premiumBadgeComponent,ZU,5),2&e&&Fl.NyB()},features:[Fl.Jv_([{provide:qU,useClass:K2}])],decls:43,vars:29,consts:[["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],["bit-item-content","","routerLink","/folders"],["slot","end","aria-hidden","true",1,"bwi","bwi-angle-right"],["type","button","bit-item-content","",3,"click","title"],[1,"tw-flex","tw-items-center","tw-justify-center","tw-gap-2"],["bitBadge","","variant","notification",4,"ngIf"],[1,"tw-sr-only"],["aria-hidden","true",1,"bwi","bwi-popout","tw-text-muted"],["bit-item-content","","routerLink","/export"],["bit-item-content","","routerLink","/trash"],["type","button","bit-item-content","",3,"click"],["slot","secondary"],["slot","end","aria-hidden","true",1,"bwi","bwi-refresh"],["bitBadge","","variant","notification"],["data-test-id","archive-link","bit-item-content","","routerLink","/archive"],["data-test-id","premium-archive-link","bit-item-content","","href","#",3,"click"],[1,"tw-flex","tw-items-center","tw-gap-2"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page")(1,"popup-header",0),Fl.nI1(2,"i18n"),Fl.qex(3,1),Fl.nrm(4,"app-pop-out"),Fl.bVm(),Fl.k0s(),Fl.j41(5,"bit-item-group")(6,"bit-item")(7,"a",2),Fl.EFF(8),Fl.nI1(9,"i18n"),Fl.nrm(10,"i",3),Fl.k0s()(),Fl.j41(11,"bit-item")(12,"button",4),Fl.nI1(13,"i18n"),Fl.bIt("click",function(){return t.import()}),Fl.j41(14,"div",5)(15,"p"),Fl.EFF(16),Fl.nI1(17,"i18n"),Fl.k0s(),Fl.DNE(18,T9,3,3,"span",6),Fl.nI1(19,"async"),Fl.k0s(),Fl.qex(20,1),Fl.j41(21,"span",7),Fl.EFF(22),Fl.nI1(23,"i18n"),Fl.k0s(),Fl.nrm(24,"i",8),Fl.bVm(),Fl.k0s()(),Fl.j41(25,"bit-item")(26,"a",9),Fl.EFF(27),Fl.nI1(28,"i18n"),Fl.nrm(29,"i",3),Fl.k0s()(),Fl.nVh(30,R9,2,1),Fl.j41(31,"bit-item")(32,"a",10),Fl.EFF(33),Fl.nI1(34,"i18n"),Fl.nrm(35,"i",3),Fl.k0s()(),Fl.j41(36,"bit-item")(37,"button",11),Fl.bIt("click",function(){return t.sync()}),Fl.EFF(38),Fl.nI1(39,"i18n"),Fl.j41(40,"span",12),Fl.EFF(41),Fl.k0s(),Fl.nrm(42,"i",13),Fl.k0s()()()()),2&e&&(Fl.R7$(),Fl.Y8G("pageTitle",Fl.bMT(2,11,"settingsVaultOptions")),Fl.R7$(7),Fl.SpI(" ",Fl.bMT(9,13,"folders")," "),Fl.R7$(4),Fl.Y8G("title",Fl.bMT(13,15,"popOutNewWindow")),Fl.R7$(4),Fl.JRh(Fl.bMT(17,17,"importNoun")),Fl.R7$(2),Fl.Y8G("ngIf",Fl.bMT(19,19,t.emptyVaultImportBadge$)),Fl.R7$(4),Fl.JRh(Fl.bMT(23,21,"popOutNewWindow")),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(28,23,"exportNoun")," "),Fl.R7$(3),Fl.vxM(t.showArchiveItem()?30:-1),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(34,25,"trash")," "),Fl.R7$(5),Fl.SpI(" ",Fl.bMT(39,27,"syncNow")," "),Fl.R7$(3),Fl.JRh(t.lastSync))},dependencies:[kl.MD,kl.bT,sf,Cw.iI,Cw.Wk,tE,aE,GD,VP,GP,KP,XP,Qc,ZU,kl.Jj,rf],encapsulation:2});var A9=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function D9(e,t){if(1&e&&(Fl.nrm(0,"bit-svg",9),Fl.nI1(1,"i18n")),2&e){const e=Fl.XpG();Fl.Y8G("content",e.logo)("ariaLabel",Fl.bMT(1,2,"appLogoLabel"))}}function E9(e,t){1&e&&Fl.nrm(0,"app-current-account")}class $9{constructor(e,t,i,n,r){this.router=e,this.route=t,this.i18nService=i,this.extensionAnonLayoutWrapperDataService=n,this.accountSwitcherService=r,this.destroy$=new Co.B,this.showLogo=!0,this.hasLoggedInAccount=!1,this.hideCardWrapper=!1,this.logo=sJ}ngOnInit(){return A9(this,void 0,void 0,function*(){var e;this.setAnonLayoutWrapperDataFromRouteData(null===(e=this.route.snapshot.firstChild)||void 0===e?void 0:e.data),this.listenForPageDataChanges(),this.listenForServiceDataChanges(),this.accountSwitcherService.availableAccounts$.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{this.hasLoggedInAccount=e.some(e=>"addAccount"!==e.id)})})}listenForPageDataChanges(){this.router.events.pipe((0,Eo.p)(e=>e instanceof Fd.wF),(0,Oo.M)(()=>this.resetPageData()),(0,go.n)(()=>{var e;return(null===(e=this.route.firstChild)||void 0===e?void 0:e.data)||null}),(0,vm.Q)(this.destroy$)).subscribe(e=>{this.setAnonLayoutWrapperDataFromRouteData(e)})}setAnonLayoutWrapperDataFromRouteData(e){e&&(void 0!==e.pageTitle&&(this.pageTitle=this.handleStringOrTranslation(e.pageTitle)),void 0!==e.pageSubtitle&&(this.pageSubtitle=this.handleStringOrTranslation(e.pageSubtitle)),void 0!==e.pageIcon&&(this.pageIcon=e.pageIcon),this.hideFooter=Boolean(e.hideFooter),this.showReadonlyHostname=Boolean(e.showReadonlyHostname),this.maxWidth=e.maxWidth,void 0!==e.showAcctSwitcher&&(this.showAcctSwitcher=Boolean(e.showAcctSwitcher)),void 0!==e.showBackButton&&(this.showBackButton=Boolean(e.showBackButton)),void 0!==e.showLogo&&(this.showLogo=Boolean(e.showLogo)),void 0!==e.hideCardWrapper&&(this.hideCardWrapper=Boolean(e.hideCardWrapper)))}listenForServiceDataChanges(){this.extensionAnonLayoutWrapperDataService.anonLayoutWrapperData$().pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{this.setAnonLayoutWrapperData(e)})}setAnonLayoutWrapperData(e){e&&(void 0!==e.pageTitle&&(this.pageTitle=null!==e.pageTitle?this.handleStringOrTranslation(e.pageTitle):null),void 0!==e.pageSubtitle&&(this.pageSubtitle=null!==e.pageSubtitle?this.handleStringOrTranslation(e.pageSubtitle):null),void 0!==e.pageIcon&&(this.pageIcon=null!==e.pageIcon?e.pageIcon:null),void 0!==e.hideFooter&&(this.hideFooter=null!==e.hideFooter?e.hideFooter:null),void 0!==e.showReadonlyHostname&&(this.showReadonlyHostname=e.showReadonlyHostname),void 0!==e.hideCardWrapper&&(this.hideCardWrapper=e.hideCardWrapper),void 0!==e.showAcctSwitcher&&(this.showAcctSwitcher=e.showAcctSwitcher),void 0!==e.showBackButton&&(this.showBackButton=e.showBackButton),void 0!==e.showLogo&&(this.showLogo=e.showLogo))}handleStringOrTranslation(e){var t;return"string"==typeof e?e:this.i18nService.t(e.key,...null!==(t=e.placeholders)&&void 0!==t?t:[])}resetPageData(){this.pageTitle=null,this.pageSubtitle=null,this.pageIcon=null,this.showReadonlyHostname=null,this.showAcctSwitcher=null,this.showBackButton=null,this.showLogo=null,this.maxWidth=null,this.hideFooter=null,this.hideCardWrapper=null}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}}$9.ɵfac=function(e){return new(e||$9)(Fl.rXU(Fd.Ix),Fl.rXU(Fd.nX),Fl.rXU(Ul),Fl.rXU(Ck),Fl.rXU(EF))},$9.ɵcmp=Fl.VBU({type:$9,selectors:[["ng-component"]],decls:11,vars:14,consts:[[3,"disablePadding"],["slot","header",3,"background","showBackButton","pageTitle"],[1,"tw-w-32"],[3,"content","ariaLabel",4,"ngIf"],["slot","end"],[4,"ngIf"],[3,"title","subtitle","icon","showReadonlyHostname","hideLogo","maxWidth","hideFooter","hideCardWrapper"],["slot","secondary","name","secondary"],["slot","environment-selector","name","environment-selector"],[3,"content","ariaLabel"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-page",0)(1,"popup-header",1)(2,"div",2),Fl.DNE(3,D9,2,4,"bit-svg",3),Fl.k0s(),Fl.qex(4,4),Fl.nrm(5,"app-pop-out"),Fl.DNE(6,E9,1,0,"app-current-account",5),Fl.bVm(),Fl.k0s(),Fl.j41(7,"auth-anon-layout",6),Fl.nrm(8,"router-outlet")(9,"router-outlet",7)(10,"router-outlet",8),Fl.k0s()()),2&e&&(Fl.Y8G("disablePadding",!0),Fl.R7$(),Fl.Y8G("background","alt")("showBackButton",t.showBackButton)("pageTitle",""),Fl.R7$(2),Fl.Y8G("ngIf",t.showLogo),Fl.R7$(3),Fl.Y8G("ngIf",t.showAcctSwitcher&&t.hasLoggedInAccount),Fl.R7$(),Fl.Y8G("title",t.pageTitle)("subtitle",t.pageSubtitle)("icon",t.pageIcon)("showReadonlyHostname",t.showReadonlyHostname)("hideLogo",!0)("maxWidth",t.maxWidth)("hideFooter",t.hideFooter)("hideCardWrapper",t.hideCardWrapper))},dependencies:[NJ,kl.MD,kl.bT,_F,Yh,BC,GD,tE,aE,Cw.iI,Fd.n3,sc],encapsulation:2});var O9=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function U9(){return()=>O9(this,void 0,void 0,function*(){return(0,a.WQX)(M9).canActivate()})}class M9{constructor(e){this.router=e,this.navigationStartSub=this.router.events.pipe((0,Eo.p)(e=>e instanceof Fd.Z),(0,mm.J)()).subscribe(e=>[this.lastNavigation,this.thisNavigation]=e),this.navigationSuccessSub=this.router.events.pipe((0,Eo.p)(e=>e instanceof Fd.wF)).subscribe(e=>this.lastNavigationSuccessId=e.id)}canActivate(){return O9(this,void 0,void 0,function*(){var e,t;return!("hashchange"===(null===(e=this.thisNavigation)||void 0===e?void 0:e.navigationTrigger)&&"popstate"===this.lastNavigation.navigationTrigger&&this.lastNavigationSuccessId===this.lastNavigation.id&&this.lastNavigation.url===(null===(t=this.thisNavigation)||void 0===t?void 0:t.url))})}ngOnDestroy(){null!=this.navigationStartSub&&this.navigationStartSub.unsubscribe(),null!=this.navigationSuccessSub&&this.navigationSuccessSub.unsubscribe()}}M9.ɵfac=function(e){return new(e||M9)(a.KVO(Fd.Ix))},M9.ɵprov=a.jDH({token:M9,factory:M9.ɵfac});const N9=Fw`
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.16151 14.7066C7.57847 15.1817 8.12811 15.5302 8.75 15.6897V16.5488C8.75 16.963 9.08579 17.2988 9.5 17.2988C9.91421 17.2988 10.25 16.963 10.25 16.5488V15.6993C10.881 15.5462 11.4395 15.199 11.8635 14.7222L12.6407 15.1704C12.9995 15.3773 13.4584 15.2544 13.6657 14.8957C13.873 14.5371 13.7501 14.0786 13.3913 13.8717L12.5794 13.4035C12.6587 13.1163 12.7012 12.8131 12.7012 12.4997C12.7012 12.1815 12.6574 11.874 12.5758 11.583L13.3929 11.1118C13.7517 10.9048 13.8745 10.4464 13.6673 10.0877C13.46 9.72912 13.0011 9.60616 12.6423 9.8131L11.8547 10.2673C11.4318 9.79552 10.8766 9.45211 10.25 9.30002V8.43391C10.25 8.0197 9.91421 7.68391 9.5 7.68391C9.08579 7.68391 8.75 8.0197 8.75 8.43391V9.30968C8.13244 9.46809 7.58613 9.81284 7.17024 10.2828L6.35577 9.8131C5.99696 9.60616 5.53805 9.72912 5.33077 10.0877C5.1235 10.4464 5.24635 10.9048 5.60516 11.1118L6.45732 11.6032C6.37929 11.8882 6.33754 12.1889 6.33754 12.4997C6.33754 12.8058 6.37804 13.1021 6.45381 13.3832L5.60676 13.8717C5.24794 14.0786 5.12509 14.5371 5.33237 14.8957C5.53964 15.2544 5.99855 15.3773 6.35737 15.1704L7.16151 14.7066ZM7.83754 12.4997C7.83754 13.5327 8.636 14.2864 9.51935 14.2864C10.4027 14.2864 11.2012 13.5327 11.2012 12.4997C11.2012 11.4667 10.4027 10.713 9.51935 10.713C8.636 10.713 7.83754 11.4667 7.83754 12.4997Z" class="tw-fill-secondary-600 group-hover/tab-nav-btn:tw-fill-primary-600" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.7 5C21.418 5 22 5.58203 22 6.3V18.6838C22 19.4018 21.418 19.9838 20.7 19.9838H19.3105V20.2957C19.3105 20.7099 18.9748 21.0457 18.5605 21.0457C18.1463 21.0457 17.8105 20.7099 17.8105 20.2957V19.9838H6.18555V20.2957C6.18555 20.7099 5.84976 21.0457 5.43555 21.0457C5.02133 21.0457 4.68555 20.7099 4.68555 20.2957V19.9838H3.3C2.58203 19.9838 2 19.4018 2 18.6838V6.3C2 5.58203 2.58203 5 3.3 5H20.7ZM20.5 16.0509V18.4838H3.5V6.5H20.5V8.93202H19.1875C18.7733 8.93202 18.4375 9.26781 18.4375 9.68202C18.4375 10.0962 18.7733 10.432 19.1875 10.432H20.5V14.5509H19.1875C18.7733 14.5509 18.4375 14.8867 18.4375 15.3009C18.4375 15.7152 18.7733 16.0509 19.1875 16.0509H20.5Z" class="tw-fill-secondary-600 group-hover/tab-nav-btn:tw-fill-primary-600" />
</svg>
`,V9=Fw`
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M20.5034 18.4716H3.50201L9.67797 14.294C10.3648 14.1965 10.7743 13.8378 10.9689 13.4272L20.5034 6.47314V18.4716Z" class="tw-fill-primary-100" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.16151 14.7066C7.57847 15.1817 8.12811 15.5302 8.75 15.6897V16.5488C8.75 16.963 9.08579 17.2988 9.5 17.2988C9.91421 17.2988 10.25 16.963 10.25 16.5488V15.6993C10.881 15.5462 11.4395 15.199 11.8635 14.7222L12.6407 15.1704C12.9995 15.3773 13.4584 15.2544 13.6657 14.8957C13.873 14.5371 13.7501 14.0786 13.3913 13.8717L12.5794 13.4035C12.6587 13.1163 12.7012 12.8131 12.7012 12.4997C12.7012 12.1815 12.6574 11.874 12.5758 11.583L13.3929 11.1118C13.7517 10.9048 13.8745 10.4464 13.6673 10.0877C13.46 9.72912 13.0011 9.60616 12.6423 9.8131L11.8547 10.2673C11.4318 9.79552 10.8766 9.45211 10.25 9.30002V8.43391C10.25 8.0197 9.91421 7.68391 9.5 7.68391C9.08579 7.68391 8.75 8.0197 8.75 8.43391V9.30968C8.13244 9.46809 7.58613 9.81284 7.17024 10.2828L6.35577 9.8131C5.99696 9.60616 5.53805 9.72912 5.33077 10.0877C5.1235 10.4464 5.24635 10.9048 5.60516 11.1118L6.45732 11.6032C6.37929 11.8882 6.33754 12.1889 6.33754 12.4997C6.33754 12.8058 6.37804 13.1021 6.45381 13.3832L5.60676 13.8717C5.24794 14.0786 5.12509 14.5371 5.33237 14.8957C5.53964 15.2544 5.99855 15.3773 6.35737 15.1704L7.16151 14.7066ZM7.83754 12.4997C7.83754 13.5327 8.636 14.2864 9.51935 14.2864C10.4027 14.2864 11.2012 13.5327 11.2012 12.4997C11.2012 11.4667 10.4027 10.713 9.51935 10.713C8.636 10.713 7.83754 11.4667 7.83754 12.4997Z" class="tw-fill-primary-600" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.7 5C21.418 5 22 5.58203 22 6.3V18.6838C22 19.4018 21.418 19.9838 20.7 19.9838H19.3105V20.2957C19.3105 20.7099 18.9748 21.0457 18.5605 21.0457C18.1463 21.0457 17.8105 20.7099 17.8105 20.2957V19.9838H6.18555V20.2957C6.18555 20.7099 5.84976 21.0457 5.43555 21.0457C5.02133 21.0457 4.68555 20.7099 4.68555 20.2957V19.9838H3.3C2.58203 19.9838 2 19.4018 2 18.6838V6.3C2 5.58203 2.58203 5 3.3 5H20.7ZM20.5 16.0509V18.4838H3.5V6.5H20.5V8.93202H19.1875C18.7733 8.93202 18.4375 9.26781 18.4375 9.68202C18.4375 10.0962 18.7733 10.432 19.1875 10.432H20.5V14.5509H19.1875C18.7733 14.5509 18.4375 14.8867 18.4375 15.3009C18.4375 15.7152 18.7733 16.0509 19.1875 16.0509H20.5Z" class="tw-fill-primary-600" />
</svg>
`,B9=Fw`
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.05169 10.7766C3.00697 11.1884 3.30455 11.5585 3.71634 11.6032C4.12814 11.6479 4.49821 11.3503 4.54292 10.9386C4.93486 7.32891 8.05586 4.49609 11.8708 4.49609C14.608 4.49609 16.9911 5.95574 18.2619 8.11589H16.2676C15.8534 8.11589 15.5176 8.45168 15.5176 8.86589C15.5176 9.2801 15.8534 9.61589 16.2676 9.61589H20.2491C20.6634 9.61589 20.9991 9.2801 20.9991 8.86589V4.88347C20.9991 4.46926 20.6634 4.13347 20.2491 4.13347C19.8349 4.13347 19.4991 4.46926 19.4991 4.88347V7.26212C17.9511 4.70467 15.1112 2.99609 11.8708 2.99609C7.30492 2.99609 3.52788 6.39108 3.05169 10.7766ZM20.9425 13.2164C20.9872 12.8046 20.6896 12.4345 20.2778 12.3898C19.866 12.3451 19.4959 12.6427 19.4512 13.0545C19.0593 16.6641 15.9383 19.4969 12.1233 19.4969C9.38639 19.4969 7.0034 18.0375 5.73253 15.8776H7.72852C8.14273 15.8776 8.47852 15.5418 8.47852 15.1276C8.47852 14.7134 8.14273 14.3776 7.72852 14.3776H3.74695C3.33273 14.3776 2.99695 14.7134 2.99695 15.1276V19.11C2.99695 19.5242 3.33273 19.86 3.74695 19.86C4.16116 19.86 4.49695 19.5242 4.49695 19.11V16.7341C6.04539 19.2898 8.88426 20.9969 12.1233 20.9969C16.6892 20.9969 20.4663 17.6019 20.9425 13.2164ZM12.7514 9.43718C12.7514 9.02297 12.4156 8.68718 12.0014 8.68718C11.5872 8.68718 11.2514 9.02297 11.2514 9.43718V11.0305L9.75498 10.5402C9.36135 10.4113 8.93772 10.6258 8.80876 11.0195C8.6798 11.4131 8.89436 11.8367 9.28799 11.9657L10.798 12.4604L9.85608 13.7799C9.61543 14.117 9.69364 14.5854 10.0308 14.826C10.3679 15.0667 10.8363 14.9885 11.0769 14.6514L12.0014 13.3562L12.9261 14.6514C13.1667 14.9885 13.6351 15.0667 13.9723 14.826C14.3094 14.5853 14.3876 14.1169 14.1469 13.7798L13.2049 12.4603L14.7146 11.9657C15.1083 11.8367 15.3228 11.4131 15.1939 11.0195C15.0649 10.6258 14.6412 10.4113 14.2476 10.5402L12.7514 11.0305V9.43718Z" class="tw-fill-secondary-600 group-hover/tab-nav-btn:tw-fill-primary-600" />
</svg>
`,j9=Fw`
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18 12C18 15.3137 15.3137 18 12 18C8.68629 18 6 15.3137 6 12C6 8.68629 8.68629 6 12 6C15.3137 6 18 8.68629 18 12Z" class="tw-fill-primary-100" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.05169 10.7766C3.00697 11.1884 3.30455 11.5585 3.71634 11.6032C4.12814 11.6479 4.49821 11.3503 4.54292 10.9386C4.93486 7.32891 8.05586 4.49609 11.8708 4.49609C14.608 4.49609 16.9911 5.95574 18.2619 8.11589H16.2676C15.8534 8.11589 15.5176 8.45168 15.5176 8.86589C15.5176 9.2801 15.8534 9.61589 16.2676 9.61589H20.2491C20.6634 9.61589 20.9991 9.2801 20.9991 8.86589V4.88347C20.9991 4.46926 20.6634 4.13347 20.2491 4.13347C19.8349 4.13347 19.4991 4.46926 19.4991 4.88347V7.26212C17.9511 4.70467 15.1112 2.99609 11.8708 2.99609C7.30492 2.99609 3.52788 6.39108 3.05169 10.7766ZM20.9425 13.2164C20.9872 12.8046 20.6896 12.4345 20.2778 12.3898C19.866 12.3451 19.4959 12.6427 19.4512 13.0545C19.0593 16.6641 15.9383 19.4969 12.1233 19.4969C9.38639 19.4969 7.0034 18.0375 5.73253 15.8776H7.72852C8.14273 15.8776 8.47852 15.5418 8.47852 15.1276C8.47852 14.7134 8.14273 14.3776 7.72852 14.3776H3.74695C3.33273 14.3776 2.99695 14.7134 2.99695 15.1276V19.11C2.99695 19.5242 3.33273 19.86 3.74695 19.86C4.16116 19.86 4.49695 19.5242 4.49695 19.11V16.7341C6.04539 19.2898 8.88426 20.9969 12.1233 20.9969C16.6892 20.9969 20.4663 17.6019 20.9425 13.2164ZM12.7514 9.43718C12.7514 9.02297 12.4156 8.68718 12.0014 8.68718C11.5872 8.68718 11.2514 9.02297 11.2514 9.43718V11.0305L9.75498 10.5402C9.36135 10.4113 8.93772 10.6258 8.80876 11.0195C8.6798 11.4131 8.89436 11.8367 9.28799 11.9657L10.798 12.4604L9.85608 13.7799C9.61543 14.117 9.69364 14.5854 10.0308 14.826C10.3679 15.0667 10.8363 14.9885 11.0769 14.6514L12.0014 13.3562L12.9261 14.6514C13.1667 14.9885 13.6351 15.0667 13.9723 14.826C14.3094 14.5853 14.3876 14.1169 14.1469 13.7798L13.2049 12.4603L14.7146 11.9657C15.1083 11.8367 15.3228 11.4131 15.1939 11.0195C15.0649 10.6258 14.6412 10.4113 14.2476 10.5402L12.7514 11.0305V9.43718Z" class="tw-fill-primary-600" />
</svg>
`,G9=Fw`
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.26134 15.8194L3.32764 13.1612C2.24617 12.6767 2.2182 11.1515 3.28118 10.6277L19.4762 2.6472C20.5111 2.13723 21.6841 3.02766 21.471 4.16154L18.5696 19.6026C18.3851 20.5849 17.2603 21.0629 16.4249 20.5141L14.1152 18.9965L11.7106 21.1294C11.4413 21.3683 11.0937 21.5003 10.7337 21.5003C9.92052 21.5003 9.26134 20.8411 9.26134 20.0279V15.8194ZM4.13499 11.8792L19.9599 4.08112L17.1231 19.178L10.8804 15.0764L15.5129 10.6535C15.8125 10.3675 15.8235 9.89271 15.5374 9.59312C15.2514 9.29353 14.7767 9.28254 14.4771 9.56857L9.52695 14.2947L4.13499 11.8792ZM12.8167 18.1433L10.7613 16.7929V19.9664L12.8167 18.1433Z" class="tw-fill-secondary-600 group-hover/tab-nav-btn:tw-fill-primary-600" />
</svg>
`,L9=Fw`
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.0621 20.2221V14.7319L15.4504 9.56824L20.2795 3.68408L17.32 19.6084L13.9377 17.5259L10.9361 20.2221H10.0621Z" class="tw-fill-primary-100" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.26134 15.8194L3.32764 13.1612C2.24617 12.6767 2.2182 11.1515 3.28118 10.6277L19.4762 2.6472C20.5111 2.13723 21.6841 3.02766 21.471 4.16154L18.5696 19.6026C18.3851 20.5849 17.2603 21.0629 16.4249 20.5141L14.1152 18.9965L11.7106 21.1294C11.4413 21.3683 11.0937 21.5003 10.7337 21.5003C9.92052 21.5003 9.26134 20.8411 9.26134 20.0279V15.8194ZM4.13499 11.8792L19.9599 4.08112L17.1231 19.178L10.8804 15.0764L15.5129 10.6535C15.8125 10.3675 15.8235 9.89271 15.5374 9.59312C15.2514 9.29353 14.7767 9.28254 14.4771 9.56857L9.52695 14.2947L4.13499 11.8792ZM12.8167 18.1433L10.7613 16.7929V19.9664L12.8167 18.1433Z" class="tw-fill-primary-600" />
</svg>
`,z9=Fw`
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M16 12C16 14.2091 14.2091 16 12 16C9.79086 16 8 14.2091 8 12C8 9.79086 9.79086 8 12 8C14.2091 8 16 9.79086 16 12ZM14.5 12C14.5 13.3807 13.3807 14.5 12 14.5C10.6193 14.5 9.5 13.3807 9.5 12C9.5 10.6193 10.6193 9.5 12 9.5C13.3807 9.5 14.5 10.6193 14.5 12Z" class="tw-fill-secondary-600 group-hover/tab-nav-btn:tw-fill-primary-600" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.8618 4.17107L14.6161 2.69633C14.5491 2.29451 14.2014 2 13.7941 2H10.2059C9.79857 2 9.45091 2.29451 9.38394 2.69633L9.13815 4.17107C8.22425 4.50524 7.38523 4.99487 6.6531 5.60794L5.25079 5.08259C4.86931 4.93967 4.44043 5.0935 4.23675 5.44629L2.44269 8.55369C2.239 8.90648 2.32023 9.35482 2.63473 9.61373L3.78982 10.5646C3.70886 11.0309 3.66666 11.5105 3.66666 12C3.66666 12.4895 3.70886 12.969 3.78981 13.4354L2.63473 14.3863C2.32023 14.6452 2.239 15.0935 2.44269 15.4463L4.23675 18.5537C4.44043 18.9065 4.86931 19.0603 5.25079 18.9174L6.65308 18.392C7.38521 19.0051 8.22424 19.4948 9.13815 19.8289L9.38394 21.3037C9.45091 21.7055 9.79857 22 10.2059 22H13.7941C14.2014 22 14.5491 21.7055 14.6161 21.3037L14.8618 19.8289C15.7757 19.4948 16.6148 19.0051 17.3469 18.3921L18.7492 18.9174C19.1306 19.0603 19.5595 18.9065 19.7632 18.5537L21.5573 15.4463C21.7609 15.0935 21.6797 14.6452 21.3652 14.3863L20.2102 13.4354C20.2911 12.9691 20.3333 12.4895 20.3333 12C20.3333 11.5105 20.2911 11.0309 20.2102 10.5646L21.3652 9.61373C21.6797 9.35482 21.7609 8.90648 21.5573 8.55369L19.7632 5.44629C19.5595 5.0935 19.1306 4.93967 18.7492 5.08259L17.3469 5.60793C16.6148 4.99486 15.7757 4.50524 14.8618 4.17107ZM14.3467 5.57985L13.5259 5.27973L13.2293 3.5H10.7707L10.4741 5.27973L9.65327 5.57985C8.90522 5.85338 8.21727 6.25458 7.61612 6.75798L6.94571 7.31937L5.25341 6.68538L4.0241 8.8146L5.417 9.96128L5.26771 10.8212C5.2014 11.2031 5.16666 11.5969 5.16666 12C5.16666 12.4031 5.2014 12.7968 5.26771 13.1788L5.417 14.0387L4.0241 15.1854L5.25341 17.3146L6.94569 16.6806L7.6161 17.242C8.21726 17.7454 8.90521 18.1466 9.65327 18.4201L10.4741 18.7203L10.7707 20.5H13.2293L13.5259 18.7203L14.3467 18.4201C15.0948 18.1466 15.7827 17.7454 16.3839 17.242L17.0543 16.6806L18.7465 17.3146L19.9758 15.1854L18.583 14.0387L18.7323 13.1788C18.7986 12.7969 18.8333 12.4031 18.8333 12C18.8333 11.5969 18.7986 11.2031 18.7323 10.8212L18.583 9.96125L19.9758 8.8146L18.7465 6.68538L17.0543 7.31936L16.3839 6.75797C15.7827 6.25458 15.0948 5.85337 14.3467 5.57985ZM20.2582 14.6963L20.2577 14.6973L20.2582 14.6963ZM13.1365 2.94293C13.1364 2.94267 13.1365 2.9432 13.1365 2.94293V2.94293Z" class="tw-fill-secondary-600 group-hover/tab-nav-btn:tw-fill-primary-600" />
</svg>
`,_9=Fw`
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.9672 5.03286C19.2837 5.00445 19.5977 5.15974 19.7632 5.44632L21.5573 8.55372C21.7609 8.90651 21.6797 9.35485 21.3652 9.61376L20.2102 10.5646C20.2911 11.0309 20.3333 11.5106 20.3333 12C20.3333 12.4895 20.2911 12.9691 20.2102 13.4354L21.3652 14.3863C21.6797 14.6452 21.7609 15.0935 21.5573 15.4463L19.7632 18.5537C19.5595 18.9065 19.1306 19.0603 18.7492 18.9174L17.3469 18.3921C16.6148 19.0052 15.7757 19.4948 14.8618 19.829L14.6161 21.3037C14.5491 21.7055 14.2014 22 13.7941 22H10.2059C9.79857 22 9.45091 21.7055 9.38394 21.3037L9.13815 19.829C8.22424 19.4948 7.38521 19.0052 6.65308 18.3921L5.25079 18.9174C5.17921 18.9442 5.10596 18.9606 5.03284 18.9672L10.2322 13.7678C10.6846 14.2202 11.3096 14.5 12 14.5C13.3807 14.5 14.5 13.3807 14.5 12C14.5 11.3097 14.2202 10.6847 13.7678 10.2323L18.9672 5.03286Z" class="tw-fill-primary-100" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M16 12C16 14.2091 14.2091 16 12 16C9.79086 16 8 14.2091 8 12C8 9.79086 9.79086 8 12 8C14.2091 8 16 9.79086 16 12ZM14.5 12C14.5 13.3807 13.3807 14.5 12 14.5C10.6193 14.5 9.5 13.3807 9.5 12C9.5 10.6193 10.6193 9.5 12 9.5C13.3807 9.5 14.5 10.6193 14.5 12Z" class="tw-fill-primary-600" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.8618 4.17107L14.6161 2.69633C14.5491 2.29451 14.2014 2 13.7941 2H10.2059C9.79857 2 9.45091 2.29451 9.38394 2.69633L9.13815 4.17107C8.22425 4.50524 7.38523 4.99487 6.6531 5.60794L5.25079 5.08259C4.86931 4.93967 4.44043 5.0935 4.23675 5.44629L2.44269 8.55369C2.239 8.90648 2.32023 9.35482 2.63473 9.61373L3.78982 10.5646C3.70886 11.0309 3.66666 11.5105 3.66666 12C3.66666 12.4895 3.70886 12.969 3.78981 13.4354L2.63473 14.3863C2.32023 14.6452 2.239 15.0935 2.44269 15.4463L4.23675 18.5537C4.44043 18.9065 4.86931 19.0603 5.25079 18.9174L6.65308 18.392C7.38521 19.0051 8.22424 19.4948 9.13815 19.8289L9.38394 21.3037C9.45091 21.7055 9.79857 22 10.2059 22H13.7941C14.2014 22 14.5491 21.7055 14.6161 21.3037L14.8618 19.8289C15.7757 19.4948 16.6148 19.0051 17.3469 18.3921L18.7492 18.9174C19.1306 19.0603 19.5595 18.9065 19.7632 18.5537L21.5573 15.4463C21.7609 15.0935 21.6797 14.6452 21.3652 14.3863L20.2102 13.4354C20.2911 12.9691 20.3333 12.4895 20.3333 12C20.3333 11.5105 20.2911 11.0309 20.2102 10.5646L21.3652 9.61373C21.6797 9.35482 21.7609 8.90648 21.5573 8.55369L19.7632 5.44629C19.5595 5.0935 19.1306 4.93967 18.7492 5.08259L17.3469 5.60793C16.6148 4.99486 15.7757 4.50524 14.8618 4.17107ZM14.3467 5.57985L13.5259 5.27973L13.2293 3.5H10.7707L10.4741 5.27973L9.65327 5.57985C8.90522 5.85338 8.21727 6.25458 7.61612 6.75798L6.94571 7.31937L5.25341 6.68538L4.0241 8.8146L5.417 9.96128L5.26771 10.8212C5.2014 11.2031 5.16666 11.5969 5.16666 12C5.16666 12.4031 5.2014 12.7968 5.26771 13.1788L5.417 14.0387L4.0241 15.1854L5.25341 17.3146L6.94569 16.6806L7.6161 17.242C8.21726 17.7454 8.90521 18.1466 9.65327 18.4201L10.4741 18.7203L10.7707 20.5H13.2293L13.5259 18.7203L14.3467 18.4201C15.0948 18.1466 15.7827 17.7454 16.3839 17.242L17.0543 16.6806L18.7465 17.3146L19.9758 15.1854L18.583 14.0387L18.7323 13.1788C18.7986 12.7969 18.8333 12.4031 18.8333 12C18.8333 11.5969 18.7986 11.2031 18.7323 10.8212L18.583 9.96125L19.9758 8.8146L18.7465 6.68538L17.0543 7.31936L16.3839 6.75797C15.7827 6.25458 15.0948 5.85337 14.3467 5.57985ZM20.2582 14.6963L20.2577 14.6973L20.2582 14.6963ZM13.1365 2.94293C13.1364 2.94267 13.1365 2.9432 13.1365 2.94293V2.94293Z" class="tw-fill-primary-600" />
</svg>
`;class K9{constructor(e,t){this.nudgesService=e,this.accountService=t,this.hasActiveBadges$=this.accountService.activeAccount$.pipe(iv).pipe((0,go.n)(e=>this.nudgesService.hasActiveBadges$(e))),this.navButtons$=this.hasActiveBadges$.pipe((0,kd.Z)(!1),(0,l.T)(e=>[{label:"vault",page:"/tabs/vault",icon:N9,iconActive:V9},{label:"generator",page:"/tabs/generator",icon:B9,iconActive:j9},{label:"send",page:"/tabs/send",icon:G9,iconActive:L9},{label:"settings",page:"/tabs/settings",icon:z9,iconActive:_9,showBerry:e}]))}}K9.ɵfac=function(e){return new(e||K9)(Fl.rXU(Ix),Fl.rXU(Zk))},K9.ɵcmp=Fl.VBU({type:K9,selectors:[["app-tabs-v2"]],standalone:!1,decls:3,vars:3,consts:[[3,"navButtons"]],template:function(e,t){1&e&&(Fl.j41(0,"popup-tab-navigation",0),Fl.nI1(1,"async"),Fl.nrm(2,"router-outlet"),Fl.k0s()),2&e&&Fl.Y8G("navButtons",Fl.bMT(1,1,t.navButtons$))},dependencies:[Fd.n3,tH,kl.Jj],encapsulation:2});const X9={homepage:()=>pl.inPopout(window)?"/tabs/vault":"/tabs/current"},q9=[{path:"",pathMatch:"full",children:[],canActivate:[()=>{const e=(0,a.WQX)(WD),t=(0,a.WQX)(Fd.Sd);return e.hasRestoredCache?(0,Go.of)(!0):e.last$().pipe((0,l.T)(i=>!i||(e.markCacheRestored(),t.parse(i.url))))},function(e={}){const t=Object.assign(Object.assign({},vH),e);return e=>pH(this,void 0,void 0,function*(){const i=(0,a.WQX)(Rd),n=(0,a.WQX)(Bp),r=(0,a.WQX)(tI),s=(0,a.WQX)(Zk),o=(0,a.WQX)(Za),l=(0,a.WQX)(Fd.Ix),c=yield i.getAuthStatus();if(c===Pd.LoggedOut)return l.createUrlTree([t.loggedOut],{queryParams:e.queryParams});if(c===Pd.Unlocked)return l.createUrlTree([t.loggedIn],{queryParams:e.queryParams});const u=yield(0,bo._)(r.supportsDeviceTrust$),d=yield(0,bo._)(s.activeAccount$.pipe(iv)),h=yield(0,bo._)(n.everHadUserKey$(d));return c===Pd.Locked&&u&&!h?(o.info("Sending user to TDE decryption options. AuthStatus is %s. TDE support is %s. Ever had user key is %s.",Pd[c],u,h),l.createUrlTree([t.notDecrypted],{queryParams:e.queryParams})):c===Pd.Locked?l.createUrlTree([t.locked],{queryParams:e.queryParams}):l.createUrlTree(["/"])})}({loggedIn:"/tabs/current",loggedOut:"/login",locked:"/lock"})]},{path:"home",redirectTo:"login",pathMatch:"full"},{path:"vault",redirectTo:"/tabs/vault",pathMatch:"full"},{path:"fido2",component:IQ,canActivate:[(e,t)=>QJ(void 0,void 0,void 0,function*(){const i=(0,a.WQX)(ZJ),n=(0,a.WQX)(Rd),r=(0,a.WQX)(Fd.Ix);return(yield n.getAuthStatus())!==Pd.Locked||(i.setPreviousUrl(t.url),r.createUrlTree(["/lock"],{queryParams:e.queryParams}))})],data:{elevation:1}},{path:"",component:$9,children:[{path:nH.AuthenticationTimeout,canActivate:[yH(X9)],children:[{path:"",component:iH}],data:{pageTitle:{key:"authenticationTimeout"},pageIcon:FC,elevation:1}}]},{path:nH.NewDeviceVerification,component:$9,canActivate:[yH(),function(){return()=>dH(this,void 0,void 0,function*(){const e=(0,a.WQX)(Ew),t=(0,a.WQX)(Za),i=(0,a.WQX)(Fd.Ix);return null!==(yield(0,bo._)(e.currentAuthType$))||(t.error("No active login session found."),i.createUrlTree(["/login"]))})}()],children:[{path:"",component:PF}],data:{pageIcon:YT,pageTitle:{key:"verifyYourIdentity"},pageSubtitle:{key:"weDontRecognizeThisDevice"},showBackButton:!0,elevation:1}},{path:"remove-password",component:$9,canActivate:[uH],data:{elevation:1},children:[{path:"",component:oD,data:{pageTitle:{key:"verifyYourOrganization"},showBackButton:!1,pageIcon:FH}}]},{path:"view-cipher",component:y5,canActivate:[uH],data:{elevation:3}},{path:"cipher-password-history",component:W4,canActivate:[uH],data:{elevation:4}},{path:"add-cipher",component:D4,canActivate:[uH,U9()],data:{elevation:1,resetRouterCacheOnTabChange:!0},runGuardsAndResolvers:"always"},{path:"edit-cipher",component:D4,canActivate:[uH,U9()],data:{elevation:3,resetRouterCacheOnTabChange:!0},runGuardsAndResolvers:"always"},{path:"attachments",component:V4,canActivate:[uH,h0()],data:{elevation:4}},{path:"generator",component:c0,canActivate:[uH],data:{elevation:0}},{path:"generator-history",component:l0,canActivate:[uH],data:{elevation:1}},{path:"import",component:U3,canActivate:[uH,h0()],data:{elevation:1}},{path:"export",component:$3,canActivate:[uH],data:{elevation:2}},{path:"autofill",component:_Y,canActivate:[uH],data:{elevation:1}},{path:JJ.AccountSecurity,component:FE,canActivate:[uH],data:{elevation:1}},{path:JJ.DeviceManagement,component:OZ,canActivate:[uH],data:{elevation:1}},{path:"notifications",component:HY,canActivate:[uH],data:{elevation:1}},{path:"vault-settings",component:x9,canActivate:[uH],data:{elevation:1}},{path:"folders",component:r9,canActivate:[uH],data:{elevation:2}},{path:"blocked-domains",component:$Q,canActivate:[uH],data:{elevation:2}},{path:"excluded-domains",component:GQ,canActivate:[uH],data:{elevation:2}},{path:"premium",component:qQ,canActivate:[uH],data:{elevation:3}},{path:"appearance",component:N5,canActivate:[uH],data:{elevation:1}},{path:"admin",component:C5,canActivate:[uH,()=>{const e=(0,a.WQX)(Zk),t=(0,a.WQX)(tR),i=(0,a.WQX)(qb),n=(0,a.WQX)(Ul),r=(0,a.WQX)(Fd.Ix);return e.activeAccount$.pipe(p$(),(0,go.n)(e=>t.canManageAutoConfirm$(e.id)),(0,l.T)(e=>!!e||(i.showToast({variant:"error",title:"",message:n.t("noPermissionsViewPage")}),r.createUrlTree(["/tabs/vault"]))))}],data:{elevation:1}},{path:"clone-cipher",component:D4,canActivate:[uH],data:{elevation:1}},{path:"add-send",component:p2,canActivate:[uH,h0()],data:{elevation:1}},{path:"edit-send",component:p2,canActivate:[uH,h0()],data:{elevation:1}},{path:"send-created",component:m2,canActivate:[uH],data:{elevation:1}},{path:"",component:$9,children:[{path:nH.SignUp,canActivate:[yH()],data:{elevation:1,pageIcon:HI,pageTitle:{key:"createAccount"},showBackButton:!0},children:[{path:"",component:gC},{path:"",component:DC,outlet:"secondary",data:{loginRoute:`/${nH.Login}`}}]},{path:nH.FinishSignUp,canActivate:[yH()],data:{pageIcon:FH,elevation:1,showBackButton:!0},children:[{path:"",component:PC}]},{path:nH.SetInitialPassword,canActivate:[uH],component:QH,data:{elevation:1}},{path:nH.Login,canActivate:[yH(X9),()=>S5(void 0,void 0,void 0,function*(){const e=(0,a.WQX)(Fd.Ix),t=(0,a.WQX)(z4);return!!(yield(0,bo._)(t.introCarouselState$))||e.createUrlTree(["/intro-carousel"])})],data:{pageIcon:xw,pageTitle:{key:"logInToBitwarden"},elevation:1,showAcctSwitcher:!0},children:[{path:"",component:Vk},{path:"",component:Gk,outlet:"secondary"},{path:"",component:lH,outlet:"environment-selector"}]},{path:nH.LoginWithPasskey,canActivate:[yH(X9),function(e,t=!1){return(i,n)=>eZ(this,void 0,void 0,function*(){const i=yield ul.getPlatformInfo(),r=e.includes(i.os),s=pl.inPopout(window),o=pl.inSidebar(window);if((r||t)&&!s&&!o){const[e,t]=n.url.split("?"),i=new URLSearchParams(t||"");i.set("autoClosePopout","true");const r=`${e}?${i.toString()}`;return yield pl.openPopout(`popup/index.html#${r}`),ul.closePopup(window),!1}return!0})}(["linux"])],data:{pageIcon:JT,pageTitle:{key:"logInWithPasskey"},pageSubtitle:{key:"readingPasskeyLoadingInfo"},elevation:1,showBackButton:!0},children:[{path:"",component:PH},{path:"",component:lH,outlet:"environment-selector"}]},{path:nH.Sso,canActivate:[yH(X9)],data:{pageIcon:xw,pageTitle:{key:"enterpriseSingleSignOn"},pageSubtitle:{key:"singleSignOnEnterOrgIdentifierText"},elevation:1},children:[{path:"",component:TT},{path:"",component:lH,outlet:"environment-selector"}]},{path:nH.LoginWithDevice,canActivate:[wH()],data:{pageIcon:eJ,pageTitle:{key:"logInRequestSent"},pageSubtitle:{key:"aNotificationWasSentToYourDevice"},showBackButton:!0,elevation:1},children:[{path:"",component:BI},{path:"",component:lH,outlet:"environment-selector"}]},{path:nH.PasswordHint,canActivate:[yH(X9)],data:{pageTitle:{key:"requestPasswordHint"},pageSubtitle:{key:"enterYourAccountEmailAddressAndYourPasswordHintWillBeSentToYou"},pageIcon:tJ,showBackButton:!0,elevation:1},children:[{path:"",component:WI},{path:"",component:lH,outlet:"environment-selector"}]},{path:nH.AdminApprovalRequested,canActivate:[wH()],data:{pageIcon:eJ,pageTitle:{key:"adminApprovalRequested"},pageSubtitle:{key:"adminApprovalRequestSentToAdmins"},showLogo:!1,showBackButton:!0,elevation:1},children:[{path:"",component:BI}]},{path:nH.LoginInitiated,canActivate:[function(){return(e,t)=>fH(this,void 0,void 0,function*(){const e=(0,a.WQX)(Rd),t=(0,a.WQX)(Bp),i=(0,a.WQX)(tI),n=(0,a.WQX)(Zk),r=(0,a.WQX)(Za),s=(0,a.WQX)(Fd.Ix),o=yield(0,bo._)(n.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)));if(null==o)return s.createUrlTree(["/"]);const c=yield e.getAuthStatus(),u=yield(0,bo._)(i.supportsDeviceTrust$),d=yield(0,bo._)(t.everHadUserKey$(o));return c!==Pd.Locked||!u||d?s.createUrlTree(["/"]):(r.info("Sending user to TDE decryption options. AuthStatus is %s. TDE support is %s. Ever had user key is %s.",Pd[c],u,d),!0)})}()],data:{pageIcon:eJ,showAcctSwitcher:!0},children:[{path:"",component:bI}]},{path:"lock",canActivate:[function(){return(e,t)=>hH(this,void 0,void 0,function*(){const t=(0,a.WQX)(Rd),i=(0,a.WQX)(Bp),n=(0,a.WQX)(tI),r=(0,a.WQX)(Fd.Ix),s=(0,a.WQX)(NC),o=(0,a.WQX)(qp),l=(0,a.WQX)(Zk),c=(0,a.WQX)(wT),u=yield(0,bo._)(l.activeAccount$);if(!u)return r.createUrlTree(["/"]);if((yield(0,bo._)(t.authStatusFor$(u.id)))!==Pd.Locked)return r.createUrlTree(["/"]);if(null!=(yield(0,bo._)(c.requiresDomainConfirmation$(u.id))))return r.createUrlTree(["confirm-key-connector-domain"]);if(!(yield o.canLock(u.id)))return!1;const d=yield(0,bo._)(n.supportsDeviceTrust$);if("login-initiated"===e.queryParams.from&&d&&(yield s.hasMasterPassword()))return!0;const h=yield(0,bo._)(i.everHadUserKey$(u.id));return!(d&&!h)})}()],data:{pageIcon:FH,pageTitle:{key:"yourVaultIsLockedV2"},showReadonlyHostname:!0,showAcctSwitcher:!0,elevation:1,doNotSaveUrl:!0},children:[{path:"",component:XA}]},{path:nH.TwoFactor,canActivate:[yH(X9),(e,t)=>wF(void 0,void 0,void 0,function*(){const e=(0,a.WQX)(Ew),t=(0,a.WQX)(nP),i=(0,a.WQX)(Fd.Ix),n=null!==(yield(0,bo._)(e.currentAuthType$)),r=yield t.getProviders();return!(!n||null==r)||i.createUrlTree(["/login"])})],children:[{path:"",component:bF}],data:{elevation:1,pageTitle:{key:"verifyYourIdentity"},showBackButton:!0,pageIcon:null}},{path:nH.ChangePassword,data:{elevation:1,hideFooter:!0,pageIcon:FH},children:[{path:"",component:UH}],canActivate:[uH]}]},{path:"assign-collections",component:U4,canActivate:[uH],data:{elevation:1}},{path:"about",component:m3,canActivate:[uH],data:{elevation:1}},{path:"more-from-bitwarden",component:l9,canActivate:[uH],data:{elevation:2}},{path:"download-bitwarden",component:Z5,canActivate:[uH],data:{elevation:2}},{path:"intro-carousel",component:$9,canActivate:[],data:{elevation:0,doNotSaveUrl:!0},children:[{path:"",component:K4,data:{pageIcon:null,hideFooter:!0}}]},{path:"confirm-key-connector-domain",component:$9,canActivate:[],data:{elevation:1},children:[{path:"",component:pD,data:{pageTitle:{key:"verifyYourOrganization"},showBackButton:!0,pageIcon:iJ}}]},{path:"tabs",component:K9,data:{elevation:0},children:[{path:"",redirectTo:"/tabs/vault",pathMatch:"full"},{path:"current",redirectTo:"/tabs/vault"},{path:"vault",component:o5,canActivate:[uH],canDeactivate:[(e,t,i,n)=>{const r=(0,a.WQX)(F8),s=(0,a.WQX)(P8);return n&&!w5(n.url)&&(r.applyFilter(""),s.resetFilterForm()),!0}],data:{elevation:0}},{path:"generator",component:c0,canActivate:[uH],data:{elevation:0}},{path:"settings",component:z3,canActivate:[uH],data:{elevation:0}},{path:"send",component:n3,canActivate:[uH],data:{elevation:0}}]},{path:"at-risk-passwords",component:p4,canActivate:[(e,t)=>b5(void 0,void 0,void 0,function*(){const e=(0,a.WQX)(Fd.Ix),i=yield uH(0,t);return!0===i?i:e.createUrlTree(["/login"])}),()=>{const e=(0,a.WQX)(Zk),t=(0,a.WQX)(d$),i=(0,a.WQX)(qb),n=(0,a.WQX)(Ul),r=(0,a.WQX)(Fd.Ix);return e.activeAccount$.pipe(p$(),(0,go.n)(e=>t.tasksEnabled$(e.id)),(0,l.T)(e=>!!e||(i.showToast({variant:"error",title:"",message:n.t("noPermissionsViewPage")}),r.createUrlTree(["/tabs/vault"]))))},()=>{const e=(0,a.WQX)(Zk),t=(0,a.WQX)(d$),i=(0,a.WQX)(_b),n=(0,a.WQX)(Fd.Ix);return e.activeAccount$.pipe(p$(),(0,go.n)(e=>(0,jo.z)([t.pendingTasks$(e.id),i.cipherViews$(e.id).pipe(p$(),(0,l.T)(e=>Object.fromEntries(e.map(e=>[e.id,e]))))]).pipe((0,l.T)(([e,t])=>!!e.some(e=>e.type===a$&&null!=e.cipherId&&null!=t[e.cipherId]&&!t[e.cipherId].isDeleted)||n.createUrlTree(["/tabs/vault"])))))}]},{path:JJ.AccountSwitcher,component:HJ,data:{elevation:4,doNotSaveUrl:!0}},{path:"trash",component:I9,canActivate:[uH],data:{elevation:2}},{path:"archive",component:H5,canActivate:[uH],data:{elevation:2}},{path:"security",component:VJ,children:[{path:"phishing-warning",children:[{path:"",component:n0},{path:"",component:r0,outlet:"secondary"}],data:{pageIcon:null,hideBackgroundIllustration:!0,showReadonlyHostname:!0}}]}];class W9{shouldDetach(e){return!1}store(e,t){}shouldAttach(e){return!1}retrieve(e){return null}shouldReuseRoute(e,t){return!1}}W9.ɵfac=function(e){return new(e||W9)},W9.ɵprov=a.jDH({token:W9,factory:W9.ɵfac});class Y9{}Y9.ɵfac=function(e){return new(e||Y9)},Y9.ɵmod=Fl.$C({type:Y9}),Y9.ɵinj=a.G2t({providers:[{provide:Fd.b,useClass:W9}],imports:[Cw.iI.forRoot(q9,{useHash:!0,onSameUrlNavigation:"reload"}),Cw.iI]});const H9=(0,Pl.P)(":enter, :leave",[(0,Pl.iF)({position:"fixed",width:"100%",height:"100%"})],{optional:!0}),J9=(0,Pl.P)("router-outlet ~ *",[(0,Pl.iF)({}),(0,Pl.i0)(1,(0,Pl.iF)({}))],{optional:!0});function Z9(e,t,i,n,r=1e3){return(0,Pl.P)(":"+e,[(0,Pl.iF)({transform:"translate"+t+"("+i+"%)",zIndex:r,boxShadow:"0 3px 2px -2px gray"}),(0,Pl.i0)(("X"===t?"0.225s":"0.3s")+" ease-in-out",(0,Pl.iF)({transform:"translate"+t+"("+n+"%)"}))],{optional:!0})}const Q9={slideInFromRight:[H9,(0,Pl.Os)([Z9("enter","X",100,0,1010),Z9("leave","X",0,0),J9])],slideOutToRight:[H9,(0,Pl.Os)([Z9("enter","X",0,0),Z9("leave","X",0,100,1010)])]},eee=(0,Pl.hZ)("routerTransition",[(0,Pl.kY)("0 => 1",Q9.slideInFromRight),(0,Pl.kY)("0 => 2",Q9.slideInFromRight),(0,Pl.kY)("0 => 3",Q9.slideInFromRight),(0,Pl.kY)("0 => 4",Q9.slideInFromRight),(0,Pl.kY)("1 => 2",Q9.slideInFromRight),(0,Pl.kY)("1 => 3",Q9.slideInFromRight),(0,Pl.kY)("1 => 4",Q9.slideInFromRight),(0,Pl.kY)("2 => 3",Q9.slideInFromRight),(0,Pl.kY)("2 => 4",Q9.slideInFromRight),(0,Pl.kY)("3 => 4",Q9.slideInFromRight),(0,Pl.kY)("1 => 0",Q9.slideOutToRight),(0,Pl.kY)("2 => 0",Q9.slideOutToRight),(0,Pl.kY)("2 => 1",Q9.slideOutToRight),(0,Pl.kY)("3 => 0",Q9.slideOutToRight),(0,Pl.kY)("3 => 1",Q9.slideOutToRight),(0,Pl.kY)("3 => 2",Q9.slideOutToRight),(0,Pl.kY)("4 => 0",Q9.slideOutToRight),(0,Pl.kY)("4 => 1",Q9.slideOutToRight),(0,Pl.kY)("4 => 2",Q9.slideOutToRight),(0,Pl.kY)("4 => 3",Q9.slideOutToRight)]);class tee{constructor(e,t,i){this.params=e,this.dialogRef=t,this.messageListener=i,this.destroy$=new Co.B}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngOnInit(){this.messageListener.allMessages$.pipe((0,Eo.p)(e=>"hideNativeMessagingFingerprintDialog"===e.command),(0,vm.Q)(this.destroy$)).subscribe(()=>{this.dialogRef.close()})}static open(e,t){return e.open(tee,{data:t,positionStrategy:new sh})}}tee.ɵfac=function(e){return new(e||tee)(Fl.rXU(pd.Qs),Fl.rXU(nh),Fl.rXU(gk))},tee.ɵcmp=Fl.VBU({type:tee,selectors:[["ng-component"]],decls:15,vars:10,consts:[["bitDialogTitle",""],["bitDialogContent",""],["bitDialogFooter",""],["bitButton","","type","button","buttonType","primary","bitDialogClose",""]],template:function(e,t){1&e&&(Fl.j41(0,"bit-simple-dialog")(1,"span",0),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.k0s(),Fl.j41(4,"span",1)(5,"p"),Fl.EFF(6),Fl.nI1(7,"i18n"),Fl.k0s(),Fl.j41(8,"p")(9,"strong"),Fl.EFF(10),Fl.k0s()()(),Fl.qex(11,2),Fl.j41(12,"button",3),Fl.EFF(13),Fl.nI1(14,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()),2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,4,"desktopSyncVerificationTitle")," "),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(7,6,"desktopIntegrationVerificationText")," "),Fl.R7$(4),Fl.JRh(t.params.fingerprint.join("-")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(14,8,"ok")," "))},dependencies:[sf,id,td,Fh,ch,Yd,rf],encapsulation:2});class iee{}class nee{}class ree{constructor(e,t){this.document=e,this.i18nService=t}start(){return this.i18nService.locale$.subscribe(e=>{this.document.documentElement.lang=e})}}class see{}class oee{constructor(e){this.toastrService=e,this.toastContainer=(0,o.ebz)(Tl.kZ)}ngOnInit(){this.toastrService.overlayContainer=this.toastContainer()}}oee.ɵfac=function(e){return new(e||oee)(Fl.rXU(Tl.tw))},oee.ɵcmp=Fl.VBU({type:oee,selectors:[["bit-toast-container"]],viewQuery:function(e,t){1&e&&Fl.wEZ(t.toastContainer,Tl.kZ,5),2&e&&Fl.NyB()},decls:1,vars:0,consts:[["role","status","aria-live","polite","aria-atomic","true","toastContainer",""]],template:function(e,t){1&e&&Fl.nrm(0,"div",0)},dependencies:[Tl.kZ],encapsulation:2});var aee=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function lee(e,t){1&e&&(Fl.j41(0,"div",1)(1,"bit-callout",3),Fl.EFF(2),Fl.nI1(3,"i18n"),Fl.j41(4,"a",4),Fl.EFF(5),Fl.nI1(6,"i18n"),Fl.k0s()()()),2&e&&(Fl.R7$(2),Fl.SpI(" ",Fl.bMT(3,2,"wasmNotSupported")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(6,4,"learnMore")," "))}function cee(e,t){if(1&e&&(Fl.j41(0,"div",2)(1,"div",5),Fl.nrm(2,"router-outlet",null,0),Fl.k0s(),Fl.nrm(4,"bit-toast-container"),Fl.k0s()),2&e){const e=Fl.sdS(3),t=Fl.XpG();Fl.R7$(),Fl.Y8G("@routerTransition",t.getRouteElevation(e))}}class uee{constructor(e,t,i,n,r,s,o,c,u,d,h,p,v,f,m,g,y,b,w,S,k,I,C,T,P){this.authService=e,this.i18nService=t,this.router=i,this.tokenService=n,this.cipherService=r,this.changeDetectorRef=s,this.ngZone=o,this.platformUtilsService=c,this.dialogService=u,this.messageListener=d,this.toastService=h,this.accountService=p,this.animationControlService=v,this.biometricStateService=f,this.biometricsService=m,this.deviceTrustToastService=g,this.userDecryptionOptionsService=y,this.keyService=b,this.destoryRef=w,this.documentLangSetter=S,this.popupSizeService=k,this.logService=I,this.authRequestService=C,this.pendingAuthRequestsState=T,this.authRequestAnsweringService=P,this.compactModeService=(0,a.WQX)($5),this.sdkService=(0,a.WQX)(Jk),this.routerAnimations=!1,this.processingPendingAuthRequests=!1,this.shouldRerunAuthRequestProcessing=!1,this.destroy$=new Co.B,this.showSdkWarning=this.sdkService.client$.pipe((0,l.T)(()=>!1),(0,Ed.W)(()=>(0,Go.of)(!0))),this.deviceTrustToastService.setupListeners$.pipe((0,xl.pQ)()).subscribe();const F=this.documentLangSetter.start();this.destoryRef.onDestroy(()=>F.unsubscribe())}ngOnInit(){return aee(this,void 0,void 0,function*(){chrome.runtime.connect({name:LD}),this.compactModeService.init(),yield this.popupSizeService.setHeight(),this.accountService.activeAccount$.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{this.activeUserId=null==e?void 0:e.id}),this.authRequestAnsweringService.setupUnlockListenersForProcessingAuthRequests(this.destroy$),this.authService.activeAccountStatus$.pipe((0,Eo.p)(e=>e===Pd.Unlocked),(0,To.H)(()=>aee(this,void 0,void 0,function*(){yield this.recordActivity()})),(0,vm.Q)(this.destroy$)).subscribe(),this.ngZone.runOutsideAngular(()=>{window.onmousedown=()=>this.recordActivity(),window.ontouchstart=()=>this.recordActivity(),window.onclick=()=>this.recordActivity(),window.onscroll=()=>this.recordActivity(),window.onkeypress=()=>this.recordActivity()}),this.messageListener.allMessages$.pipe((0,Oo.M)(e=>aee(this,void 0,void 0,function*(){if("doneLoggingOut"===e.command)this.authService.logOut(()=>aee(this,void 0,void 0,function*(){e.logoutReason&&(yield this.displayLogoutReason(e.logoutReason))})),this.changeDetectorRef.detectChanges();else if("authBlocked"===e.command||"goHome"===e.command)yield this.router.navigate(["login"]);else if("locked"===e.command){if(null==e.userId)return void this.logService.error("'locked' message received without userId.");if(e.userId!==this.activeUserId)return void this.logService.error(`'locked' message received with userId ${e.userId} but active userId is ${this.activeUserId}.`);yield this.biometricsService.setShouldAutopromptNow(!1);const t=yield(0,bo._)(this.userDecryptionOptionsService.userDecryptionOptionsById$(e.userId).pipe((0,l.T)(e=>null!=(null==e?void 0:e.trustedDeviceOption)))),i=yield(0,bo._)(this.keyService.everHadUserKey$(e.userId));if(t&&!i)return void(yield this.router.navigate(["login-initiated"]));yield this.router.navigate(["lock"])}else if("openLoginApproval"===e.command){if(this.processingPendingAuthRequests)return void(this.shouldRerunAuthRequestProcessing=!0);do{this.shouldRerunAuthRequestProcessing=!1;try{yield this.processPendingAuthRequests()}catch(e){this.logService.error(`Error processing pending auth requests: ${e}`),this.shouldRerunAuthRequestProcessing=!1}}while(this.shouldRerunAuthRequestProcessing)}else"showDialog"===e.command?this.showDialog(e):"showNativeMessagingFingerprintDialog"===e.command?this.showNativeMessagingFingerprintDialog(e):"showUpdateDesktopAppOrDisableFingerprintDialog"===e.command?yield this.showDialog({title:this.i18nService.t("updateDesktopAppOrDisableFingerprintDialogTitle"),content:this.i18nService.t("updateDesktopAppOrDisableFingerprintDialogMessage"),type:"warning"}):"showToast"===e.command?this.toastService._showToast(e):"reloadProcess"===e.command?this.platformUtilsService.isSafari()?window.setTimeout(()=>aee(this,void 0,void 0,function*(){yield this.biometricStateService.updateLastProcessReload(),window.location.reload()}),2e3):pl.inPopup(window)&&ul.closePopup(window):"reloadPopup"===e.command?this.router.navigate(["/"]):"convertAccountToKeyConnector"===e.command&&this.router.navigate(["/remove-password"])})),(0,vm.Q)(this.destroy$)).subscribe(),this.router.events.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>aee(this,void 0,void 0,function*(){if(e instanceof Fd.wF){const t=e.urlAfterRedirects||e.url||"";t.startsWith("/tabs/")&&(yield this.cipherService.setAddEditCipherInfo(null,this.activeUserId)),window.previousPopupUrl=t,null!=window.routeDirection&&window.setTimeout(()=>{window.routeDirection=null},400)}})),this.animationControlService.enableRoutingAnimation$.pipe((0,vm.Q)(this.destroy$)).subscribe(e=>{this.routerAnimations=e})})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}getRouteElevation(e){if(this.routerAnimations)return e.activatedRouteData.elevation}recordActivity(){return aee(this,void 0,void 0,function*(){if(null==this.activeUserId)return;const e=new Date;null!=this.lastActivity&&e.getTime()-this.lastActivity.getTime()<250||(this.lastActivity=e,yield this.accountService.setAccountActivity(this.activeUserId,e))})}showToast(e){this.platformUtilsService.showToast(e.type,e.title,e.text,e.options)}showDialog(e){return aee(this,void 0,void 0,function*(){yield this.dialogService.openSimpleDialog(e)})}showNativeMessagingFingerprintDialog(e){return aee(this,void 0,void 0,function*(){const t=tee.open(this.dialogService,{fingerprint:e.fingerprint});return(0,bo._)(t.closed)})}displayLogoutReason(e){return aee(this,void 0,void 0,function*(){let t=null;switch(e){case"invalidSecurityStamp":case"sessionExpired":t={variant:"warning",title:this.i18nService.t("loggedOut"),message:this.i18nService.t("loginExpired")}}null!=t&&this.toastService.showToast(t)})}processPendingAuthRequests(){return aee(this,void 0,void 0,function*(){this.processingPendingAuthRequests=!0;try{const e=yield(0,bo._)(this.authRequestService.getPendingAuthRequests$());if(Array.isArray(e)&&e.length>0){const t=new Set;for(const i of e){if(null==(null==i?void 0:i.id))continue;const n=uZ.open(this.dialogService,{notificationId:i.id}),r=yield(0,bo._)(n.closed);void 0!==r&&"boolean"==typeof r&&(t.add(i.id),t.size===e.length&&null!=this.activeUserId&&(yield this.pendingAuthRequestsState.clear(this.activeUserId)))}}}finally{this.processingPendingAuthRequests=!1}})}}uee.ɵfac=function(e){return new(e||uee)(Fl.rXU(Rd),Fl.rXU(Ul),Fl.rXU(Fd.Ix),Fl.rXU(iee),Fl.rXU(_b),Fl.rXU(o.gRc),Fl.rXU(Fl.SKi),Fl.rXU(Hb),Fl.rXU(lh),Fl.rXU(gk),Fl.rXU(qb),Fl.rXU(Zk),Fl.rXU(x5),Fl.rXU(Mp),Fl.rXU(Vp),Fl.rXU(nee),Fl.rXU($w),Fl.rXU(Bp),Fl.rXU(a.abz),Fl.rXU(ree),Fl.rXU(ml),Fl.rXU(Za),Fl.rXU(Uw),Fl.rXU(nZ),Fl.rXU(see))},uee.ɵcmp=Fl.VBU({type:uee,selectors:[["app-root"]],standalone:!1,decls:3,vars:3,consts:[["outlet","outlet"],[1,"tw-h-screen","tw-flex","tw-justify-center","tw-items-center","tw-p-4"],[1,"tw-h-screen","tw-w-screen"],["type","danger"],["bitLink","","href","https://bitwarden.com/help/wasm-not-supported/","target","_blank","rel","noreferrer"],[1,"tw-size-full"]],template:function(e,t){1&e&&(Fl.nVh(0,lee,7,6,"div",1),Fl.nI1(1,"async"),Fl.vZN(2,cee,5,1,"div",2)),2&e&&Fl.vxM(Fl.bMT(1,1,t.showSdkWarning)?0:2)},dependencies:[Fd.n3,oee,ud,uw,kl.Jj,rf],encapsulation:2,data:{animation:[eee]}});class dee{static createSystemThemeFromWindow(e){return(0,Po.h)((0,Go.of)(dee.getSystemThemeFromWindow(e)),(0,Rh.R)(e.matchMedia("(prefers-color-scheme: dark)"),"change").pipe((0,l.T)(e=>e.matches?Ip.Dark:Ip.Light)))}static getSystemThemeFromWindow(e){return e.matchMedia("(prefers-color-scheme: dark)").matches?Ip.Dark:Ip.Light}constructor(e,t){this.themeStateService=e,this.systemTheme$=t,this.theme$=this.themeStateService.selectedTheme$.pipe((0,go.n)(e=>e===Ip.System?this.systemTheme$:(0,Go.of)(e)))}applyThemeChangesTo(e){return this.theme$.subscribe(t=>{e.documentElement.classList.remove("theme_"+Ip.Light,"theme_"+Ip.Dark),e.documentElement.classList.add("theme_"+t)})}}dee.ɵfac=function(e){return new(e||dee)(a.KVO(K$),a.KVO(GT))},dee.ɵprov=a.jDH({token:dee,factory:dee.ɵfac});class hee{}class pee{}class vee extends pee{}class fee{constructor(e,t){this.state$=e,this.set=t}}class mee{}class gee{constructor(e,t){var i;null!=e&&(this.id=e.id,this.name=e.name,this.status=e.status,this.type=e.type,this.enabled=e.enabled,this.usePolicies=e.usePolicies,this.useGroups=e.useGroups,this.useDirectory=e.useDirectory,this.useEvents=e.useEvents,this.useTotp=e.useTotp,this.use2fa=e.use2fa,this.useApi=e.useApi,this.useSso=e.useSso,this.useOrganizationDomains=e.useOrganizationDomains,this.useKeyConnector=e.useKeyConnector,this.useScim=e.useScim,this.useCustomPermissions=e.useCustomPermissions,this.useResetPassword=e.useResetPassword,this.useSecretsManager=e.useSecretsManager,this.usePasswordManager=e.usePasswordManager,this.useActivateAutofillPolicy=e.useActivateAutofillPolicy,this.useAutomaticUserConfirmation=e.useAutomaticUserConfirmation,this.selfHost=e.selfHost,this.usersGetPremium=e.usersGetPremium,this.seats=e.seats,this.maxCollections=e.maxCollections,this.maxStorageGb=e.maxStorageGb,this.ssoBound=e.ssoBound,this.identifier=e.identifier,this.permissions=e.permissions,this.resetPasswordEnrolled=e.resetPasswordEnrolled,this.userId=e.userId,this.organizationUserId=e.organizationUserId,this.hasPublicAndPrivateKeys=e.hasPublicAndPrivateKeys,this.providerId=e.providerId,this.providerName=e.providerName,this.providerType=e.providerType,this.familySponsorshipFriendlyName=e.familySponsorshipFriendlyName,this.familySponsorshipAvailable=e.familySponsorshipAvailable,this.productTierType=e.productTierType,this.keyConnectorEnabled=e.keyConnectorEnabled,this.keyConnectorUrl=e.keyConnectorUrl,this.familySponsorshipLastSyncDate=e.familySponsorshipLastSyncDate,this.familySponsorshipValidUntil=e.familySponsorshipValidUntil,this.familySponsorshipToDelete=e.familySponsorshipToDelete,this.accessSecretsManager=e.accessSecretsManager,this.limitCollectionCreation=e.limitCollectionCreation,this.limitCollectionDeletion=e.limitCollectionDeletion,this.limitItemDeletion=e.limitItemDeletion,this.allowAdminAccessToAllCollectionItems=e.allowAdminAccessToAllCollectionItems,this.userIsManagedByOrganization=e.userIsManagedByOrganization,this.useAccessIntelligence=e.useAccessIntelligence,this.useAdminSponsoredFamilies=e.useAdminSponsoredFamilies,this.useDisableSMAdsForUsers=null!==(i=e.useDisableSMAdsForUsers)&&void 0!==i&&i,this.isAdminInitiated=e.isAdminInitiated,this.ssoEnabled=e.ssoEnabled,this.ssoMemberDecryptionType=e.ssoMemberDecryptionType,this.usePhishingBlocker=e.usePhishingBlocker,this.isMember=t.isMember,this.isProviderUser=t.isProviderUser)}static fromJSON(e){return Object.assign(new gee,e,{familySponsorshipLastSyncDate:null!=e.familySponsorshipLastSyncDate?new Date(e.familySponsorshipLastSyncDate):e.familySponsorshipLastSyncDate,familySponsorshipValidUntil:null!=e.familySponsorshipValidUntil?new Date(e.familySponsorshipValidUntil):e.familySponsorshipValidUntil})}}const yee=k.record(T,"organizations",{deserializer:e=>gee.fromJSON(e),clearOn:["logout"]});var bee=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function wee(){return(0,l.T)(e=>e.length>0)}class See extends tS{constructor(e){super(e),this.apiKey=this.getResponseProperty("ApiKey"),this.revisionDate=new Date(this.getResponseProperty("RevisionDate"))}}class kee extends tS{static fromView(e,t=new kee){return t.configType=e.configType,t.memberDecryptionType=e.memberDecryptionType,t.keyConnectorUrl=e.keyConnectorUrl,t.configType===vU.OpenIdConnect?(t.authority=e.openId.authority,t.clientId=e.openId.clientId,t.clientSecret=e.openId.clientSecret,t.metadataAddress=e.openId.metadataAddress,t.redirectBehavior=e.openId.redirectBehavior,t.getClaimsFromUserInfoEndpoint=e.openId.getClaimsFromUserInfoEndpoint,t.additionalScopes=e.openId.additionalScopes,t.additionalUserIdClaimTypes=e.openId.additionalUserIdClaimTypes,t.additionalEmailClaimTypes=e.openId.additionalEmailClaimTypes,t.additionalNameClaimTypes=e.openId.additionalNameClaimTypes,t.acrValues=e.openId.acrValues,t.expectedReturnAcrValue=e.openId.expectedReturnAcrValue):t.configType===vU.Saml2&&(t.spUniqueEntityId=e.saml.spUniqueEntityId,t.spNameIdFormat=e.saml.spNameIdFormat,t.spOutboundSigningAlgorithm=e.saml.spOutboundSigningAlgorithm,t.spSigningBehavior=e.saml.spSigningBehavior,t.spMinIncomingSigningAlgorithm=e.saml.spMinIncomingSigningAlgorithm,t.spWantAssertionsSigned=e.saml.spWantAssertionsSigned,t.spValidateCertificates=e.saml.spValidateCertificates,t.idpEntityId=e.saml.idpEntityId,t.idpBindingType=e.saml.idpBindingType,t.idpSingleSignOnServiceUrl=e.saml.idpSingleSignOnServiceUrl,t.idpSingleLogoutServiceUrl=e.saml.idpSingleLogoutServiceUrl,t.idpX509PublicCert=e.saml.idpX509PublicCert,t.idpOutboundSigningAlgorithm=e.saml.idpOutboundSigningAlgorithm,t.idpAllowUnsolicitedAuthnResponse=e.saml.idpAllowUnsolicitedAuthnResponse,t.idpWantAuthnRequestsSigned=e.saml.idpWantAuthnRequestsSigned,t.idpDisableOutboundLogoutRequests=!e.saml.idpAllowOutboundLogoutRequests),t}constructor(e=null){super(e),null!=e&&(this.configType=this.getResponseProperty("ConfigType"),this.memberDecryptionType=this.getResponseProperty("MemberDecryptionType"),this.keyConnectorUrl=this.getResponseProperty("KeyConnectorUrl"),this.authority=this.getResponseProperty("Authority"),this.clientId=this.getResponseProperty("ClientId"),this.clientSecret=this.getResponseProperty("ClientSecret"),this.metadataAddress=this.getResponseProperty("MetadataAddress"),this.redirectBehavior=this.getResponseProperty("RedirectBehavior"),this.getClaimsFromUserInfoEndpoint=this.getResponseProperty("GetClaimsFromUserInfoEndpoint"),this.additionalScopes=this.getResponseProperty("AdditionalScopes"),this.additionalUserIdClaimTypes=this.getResponseProperty("AdditionalUserIdClaimTypes"),this.additionalEmailClaimTypes=this.getResponseProperty("AdditionalEmailClaimTypes"),this.additionalNameClaimTypes=this.getResponseProperty("AdditionalNameClaimTypes"),this.acrValues=this.getResponseProperty("AcrValues"),this.expectedReturnAcrValue=this.getResponseProperty("ExpectedReturnAcrValue"),this.spUniqueEntityId=this.getResponseProperty("SpUniqueEntityId"),this.spNameIdFormat=this.getResponseProperty("SpNameIdFormat"),this.spOutboundSigningAlgorithm=this.getResponseProperty("SpOutboundSigningAlgorithm"),this.spSigningBehavior=this.getResponseProperty("SpSigningBehavior"),this.spMinIncomingSigningAlgorithm=this.getResponseProperty("SpMinIncomingSigningAlgorithm"),this.spWantAssertionsSigned=this.getResponseProperty("SpWantAssertionsSigned"),this.spValidateCertificates=this.getResponseProperty("SpValidateCertificates"),this.idpEntityId=this.getResponseProperty("IdpEntityId"),this.idpBindingType=this.getResponseProperty("IdpBindingType"),this.idpSingleSignOnServiceUrl=this.getResponseProperty("IdpSingleSignOnServiceUrl"),this.idpSingleLogoutServiceUrl=this.getResponseProperty("IdpSingleLogoutServiceUrl"),this.idpX509PublicCert=this.getResponseProperty("IdpX509PublicCert"),this.idpOutboundSigningAlgorithm=this.getResponseProperty("IdpOutboundSigningAlgorithm"),this.idpAllowUnsolicitedAuthnResponse=this.getResponseProperty("IdpAllowUnsolicitedAuthnResponse"),this.idpDisableOutboundLogoutRequests=this.getResponseProperty("IdpDisableOutboundLogoutRequests"),this.idpWantAuthnRequestsSigned=this.getResponseProperty("IdpWantAuthnRequestsSigned"))}}class Iee extends tS{constructor(e){super(e),this.enabled=this.getResponseProperty("Enabled"),this.identifier=this.getResponseProperty("Identifier"),this.data=null!=this.getResponseProperty("Data")?new kee(this.getResponseProperty("Data")):null,this.urls=new Cee(this.getResponseProperty("Urls"))}}class Cee extends tS{constructor(e){super(e),this.callbackPath=this.getResponseProperty("CallbackPath"),this.signedOutCallbackPath=this.getResponseProperty("SignedOutCallbackPath"),this.spEntityId=this.getResponseProperty("SpEntityId"),this.spEntityIdStatic=this.getResponseProperty("SpEntityIdStatic"),this.spMetadataUrl=this.getResponseProperty("SpMetadataUrl"),this.spAcsUrl=this.getResponseProperty("SpAcsUrl")}}class Tee extends tS{constructor(e){super(e),this.balance=this.getResponseProperty("Balance");const t=this.getResponseProperty("PaymentSource");this.paymentSource=null==t?null:new Pee(t)}}class Pee extends tS{constructor(e){super(e),this.type=this.getResponseProperty("Type"),this.cardBrand=this.getResponseProperty("CardBrand"),this.description=this.getResponseProperty("Description"),this.needsVerification=this.getResponseProperty("NeedsVerification")}}class Fee extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.url=this.getResponseProperty("Url"),this.pdfUrl=this.getResponseProperty("PdfUrl"),this.number=this.getResponseProperty("Number"),this.paid=this.getResponseProperty("Paid"),this.date=this.getResponseProperty("Date"),this.amount=this.getResponseProperty("Amount")}}class Ree extends tS{constructor(e){super(e),this.createdDate=this.getResponseProperty("CreatedDate"),this.amount=this.getResponseProperty("Amount"),this.refunded=this.getResponseProperty("Refunded"),this.partiallyRefunded=this.getResponseProperty("PartiallyRefunded"),this.refundedAmount=this.getResponseProperty("RefundedAmount"),this.type=this.getResponseProperty("Type"),this.paymentMethodType=this.getResponseProperty("PaymentMethodType"),this.details=this.getResponseProperty("Details")}}class xee extends tS{constructor(e){super(e),this.invoices=[],this.transactions=[];const t=this.getResponseProperty("Transactions"),i=this.getResponseProperty("Invoices");null!=t&&(this.transactions=t.map(e=>new Ree(e))),null!=i&&(this.invoices=i.map(e=>new Fee(e)))}get hasNoHistory(){return 0==this.invoices.length&&0==this.transactions.length}}class Aee extends tS{constructor(e){super(e),this.type=this.getResponseProperty("Type"),this.productTier=this.getResponseProperty("ProductTier"),this.name=this.getResponseProperty("Name"),this.isAnnual=this.getResponseProperty("IsAnnual"),this.nameLocalizationKey=this.getResponseProperty("NameLocalizationKey"),this.descriptionLocalizationKey=this.getResponseProperty("DescriptionLocalizationKey"),this.canBeUsedByBusiness=this.getResponseProperty("CanBeUsedByBusiness"),this.trialPeriodDays=this.getResponseProperty("TrialPeriodDays"),this.hasSelfHost=this.getResponseProperty("HasSelfHost"),this.hasPolicies=this.getResponseProperty("HasPolicies"),this.hasGroups=this.getResponseProperty("HasGroups"),this.hasDirectory=this.getResponseProperty("HasDirectory"),this.hasEvents=this.getResponseProperty("HasEvents"),this.hasTotp=this.getResponseProperty("HasTotp"),this.has2fa=this.getResponseProperty("Has2fa"),this.hasApi=this.getResponseProperty("HasApi"),this.hasSso=this.getResponseProperty("HasSso"),this.hasResetPassword=this.getResponseProperty("HasResetPassword"),this.usersGetPremium=this.getResponseProperty("UsersGetPremium"),this.upgradeSortOrder=this.getResponseProperty("UpgradeSortOrder"),this.displaySortOrder=this.getResponseProperty("DisplaySortOrder"),this.legacyYear=this.getResponseProperty("LegacyYear"),this.disabled=this.getResponseProperty("Disabled");const t=this.getResponseProperty("PasswordManager"),i=this.getResponseProperty("SecretsManager");this.PasswordManager=null==t?null:new Eee(t),this.SecretsManager=null==i?null:new Dee(i)}}class Dee extends tS{constructor(e){super(e),this.stripeSeatPlanId=this.getResponseProperty("StripeSeatPlanId"),this.baseSeats=this.getResponseProperty("BaseSeats"),this.basePrice=this.getResponseProperty("BasePrice"),this.seatPrice=this.getResponseProperty("SeatPrice"),this.hasAdditionalSeatsOption=this.getResponseProperty("HasAdditionalSeatsOption"),this.maxAdditionalSeats=this.getResponseProperty("MaxAdditionalSeats"),this.maxSeats=this.getResponseProperty("MaxSeats"),this.stripeServiceAccountPlanId=this.getResponseProperty("StripeServiceAccountPlanId"),this.additionalPricePerServiceAccount=this.getResponseProperty("AdditionalPricePerServiceAccount"),this.baseServiceAccount=this.getResponseProperty("BaseServiceAccount"),this.maxServiceAccount=this.getResponseProperty("MaxServiceAccount"),this.hasAdditionalServiceAccountOption=this.getResponseProperty("HasAdditionalServiceAccountOption"),this.maxAdditionalServiceAccounts=this.getResponseProperty("MaxAdditionalServiceAccounts"),this.maxProjects=this.getResponseProperty("MaxProjects")}}class Eee extends tS{constructor(e){super(e),this.stripePlanId=this.getResponseProperty("StripePlanId"),this.stripeSeatPlanId=this.getResponseProperty("StripeSeatPlanId"),this.stripeProviderPortalSeatPlanId=this.getResponseProperty("StripeProviderPortalSeatPlanId"),this.stripeStoragePlanId=this.getResponseProperty("StripeStoragePlanId"),this.stripePremiumAccessPlanId=this.getResponseProperty("StripePremiumAccessPlanId"),this.basePrice=this.getResponseProperty("BasePrice"),this.seatPrice=this.getResponseProperty("SeatPrice"),this.providerPortalSeatPrice=this.getResponseProperty("ProviderPortalSeatPrice"),this.baseSeats=this.getResponseProperty("BaseSeats"),this.maxAdditionalSeats=this.getResponseProperty("MaxAdditionalSeats"),this.premiumAccessOptionPrice=this.getResponseProperty("PremiumAccessOptionPrice"),this.maxSeats=this.getResponseProperty("MaxSeats"),this.additionalStoragePricePerGb=this.getResponseProperty("AdditionalStoragePricePerGb"),this.hasAdditionalSeatsOption=this.getResponseProperty("HasAdditionalSeatsOption"),this.baseStorageGb=this.getResponseProperty("BaseStorageGb"),this.maxCollections=this.getResponseProperty("MaxCollections"),this.hasAdditionalStorageOption=this.getResponseProperty("HasAdditionalStorageOption"),this.maxAdditionalStorage=this.getResponseProperty("MaxAdditionalStorage"),this.hasPremiumAccessOption=this.getResponseProperty("HasPremiumAccessOption")}}class $ee extends tS{constructor(e){var t,i;super(e),this.id=this.getResponseProperty("Id"),this.name=this.getResponseProperty("Name"),this.businessName=this.getResponseProperty("BusinessName"),this.businessAddress1=this.getResponseProperty("BusinessAddress1"),this.businessAddress2=this.getResponseProperty("BusinessAddress2"),this.businessAddress3=this.getResponseProperty("BusinessAddress3"),this.businessCountry=this.getResponseProperty("BusinessCountry"),this.businessTaxNumber=this.getResponseProperty("BusinessTaxNumber"),this.billingEmail=this.getResponseProperty("BillingEmail");const n=this.getResponseProperty("Plan");this.plan=null==n?null:new Aee(n),this.planType=this.getResponseProperty("PlanType"),this.seats=this.getResponseProperty("Seats"),this.maxAutoscaleSeats=this.getResponseProperty("MaxAutoscaleSeats"),this.maxCollections=this.getResponseProperty("MaxCollections"),this.maxStorageGb=this.getResponseProperty("MaxStorageGb"),this.useGroups=this.getResponseProperty("UseGroups"),this.useDirectory=this.getResponseProperty("UseDirectory"),this.useEvents=this.getResponseProperty("UseEvents"),this.useTotp=this.getResponseProperty("UseTotp"),this.use2fa=this.getResponseProperty("Use2fa"),this.useApi=this.getResponseProperty("UseApi"),this.useResetPassword=this.getResponseProperty("UseResetPassword"),this.useSecretsManager=this.getResponseProperty("UseSecretsManager"),this.hasPublicAndPrivateKeys=this.getResponseProperty("HasPublicAndPrivateKeys"),this.usePasswordManager=this.getResponseProperty("UsePasswordManager"),this.smSeats=this.getResponseProperty("SmSeats"),this.smServiceAccounts=this.getResponseProperty("SmServiceAccounts"),this.maxAutoscaleSmSeats=this.getResponseProperty("MaxAutoscaleSmSeats"),this.maxAutoscaleSmServiceAccounts=this.getResponseProperty("MaxAutoscaleSmServiceAccounts"),this.limitCollectionCreation=this.getResponseProperty("LimitCollectionCreation"),this.limitCollectionDeletion=this.getResponseProperty("LimitCollectionDeletion"),this.limitItemDeletion=this.getResponseProperty("LimitItemDeletion"),this.allowAdminAccessToAllCollectionItems=this.getResponseProperty("AllowAdminAccessToAllCollectionItems"),this.useDisableSMAdsForUsers=null!==(t=this.getResponseProperty("UseDisableSMAdsForUsers"))&&void 0!==t&&t,this.useAccessIntelligence=this.getResponseProperty("UseRiskInsights"),this.usePhishingBlocker=null!==(i=this.getResponseProperty("UsePhishingBlocker"))&&void 0!==i&&i}}class Oee extends tS{constructor(e){super(e),this.storageName=this.getResponseProperty("StorageName"),this.storageGb=this.getResponseProperty("StorageGb"),this.maxStorageGb=this.getResponseProperty("MaxStorageGb"),this.license=this.getResponseProperty("License"),this.expiration=this.getResponseProperty("Expiration");const t=this.getResponseProperty("Subscription"),i=this.getResponseProperty("UpcomingInvoice"),n=this.getResponseProperty("CustomerDiscount");this.subscription=null==t?null:new Uee(t),this.upcomingInvoice=null==i?null:new Nee(i),this.customerDiscount=null==n?null:new Bee(n)}}class Uee extends tS{constructor(e){super(e),this.items=[],this.trialStartDate=this.getResponseProperty("TrialStartDate"),this.trialEndDate=this.getResponseProperty("TrialEndDate"),this.periodStartDate=this.getResponseProperty("PeriodStartDate"),this.periodEndDate=this.getResponseProperty("PeriodEndDate"),this.cancelledDate=this.getResponseProperty("CancelledDate"),this.cancelAtEndDate=this.getResponseProperty("CancelAtEndDate"),this.status=this.getResponseProperty("Status"),this.cancelled=this.getResponseProperty("Cancelled");const t=this.getResponseProperty("Items");null!=t&&(this.items=t.map(e=>new Mee(e))),this.collectionMethod=this.getResponseProperty("CollectionMethod"),this.suspensionDate=this.getResponseProperty("SuspensionDate"),this.unpaidPeriodEndDate=this.getResponseProperty("unpaidPeriodEndDate"),this.gracePeriod=this.getResponseProperty("GracePeriod")}}class Mee extends tS{constructor(e){super(e),this.productId=this.getResponseProperty("ProductId"),this.name=this.getResponseProperty("Name"),this.amount=this.getResponseProperty("Amount"),this.quantity=this.getResponseProperty("Quantity"),this.interval=this.getResponseProperty("Interval"),this.sponsoredSubscriptionItem=this.getResponseProperty("SponsoredSubscriptionItem"),this.addonSubscriptionItem=this.getResponseProperty("AddonSubscriptionItem")}}class Nee extends tS{constructor(e){super(e),this.date=this.getResponseProperty("Date"),this.amount=this.getResponseProperty("Amount")}}class Vee extends $ee{constructor(e){super(e),this.storageName=this.getResponseProperty("StorageName"),this.storageGb=this.getResponseProperty("StorageGb");const t=this.getResponseProperty("Subscription");this.subscription=null==t?null:new Uee(t);const i=this.getResponseProperty("UpcomingInvoice");this.upcomingInvoice=null==i?null:new Nee(i);const n=this.getResponseProperty("CustomerDiscount");this.customerDiscount=null==n?null:new Bee(n),this.expiration=this.getResponseProperty("Expiration"),this.expirationWithoutGracePeriod=this.getResponseProperty("ExpirationWithoutGracePeriod")}}class Bee extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.active=this.getResponseProperty("Active"),this.percentOff=this.getResponseProperty("PercentOff"),this.amountOff=this.getResponseProperty("AmountOff"),this.appliesTo=this.getResponseProperty("AppliesTo")||[]}}class jee extends tS{constructor(e){super(e);const t=this.getResponseProperty("UserProfile");null!=t&&(this.userProfile=new tA(t)),this.paymentIntentClientSecret=this.getResponseProperty("PaymentIntentClientSecret"),this.success=this.getResponseProperty("Success")}}class Gee extends tS{constructor(e){super(e),this.keyType=this.getResponseProperty("KeyType")}}class Lee extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.resetPasswordEnabled=this.getResponseProperty("ResetPasswordEnabled")}}class zee extends tS{constructor(e){super(e),this.privateKey=this.getResponseProperty("PrivateKey"),this.publicKey=this.getResponseProperty("PublicKey")}}class _ee extends zee{constructor(e){super(e)}}var Kee=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Xee extends tS{constructor(e){super(e),this.id=this.getResponseProperty("id"),this.organizationIdentifier=this.getResponseProperty("organizationIdentifier"),this.ssoAvailable=this.getResponseProperty("ssoAvailable"),this.domainName=this.getResponseProperty("domainName"),this.verifiedDate=this.getResponseProperty("verifiedDate")}}class qee extends tS{constructor(e){super(e),this.id=this.getResponseProperty("id"),this.organizationId=this.getResponseProperty("organizationId"),this.txt=this.getResponseProperty("txt"),this.domainName=this.getResponseProperty("domainName"),this.creationDate=this.getResponseProperty("creationDate"),this.nextRunDate=this.getResponseProperty("nextRunDate"),this.jobRunCount=this.getResponseProperty("jobRunCount"),this.verifiedDate=this.getResponseProperty("verifiedDate"),this.lastCheckedDate=this.getResponseProperty("lastCheckedDate")}}class Wee extends tS{constructor(e){super(e),this.organizationName=this.getResponseProperty("organizationName"),this.organizationIdentifier=this.getResponseProperty("organizationIdentifier"),this.domainName=this.getResponseProperty("domainName")}}class Yee{constructor(e){this.email=e}}var Hee=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Jee=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Zee=new k(R,"autoConfirmFingerPrints",{deserializer:e=>e,clearOn:["logout"]});var Qee=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class ete extends tS{constructor(e){super(e),this.id=this.getResponseProperty("id"),this.plan=this.getResponseProperty("plan"),this.name=this.getResponseProperty("name"),this.seats=this.getResponseProperty("seats"),this.disabled=this.getResponseProperty("disabled")}}class tte extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.providerId=this.getResponseProperty("ProviderId"),this.organizationId=this.getResponseProperty("OrganizationId"),this.key=this.getResponseProperty("Key"),this.settings=this.getResponseProperty("Settings"),this.creationDate=this.getResponseProperty("CreationDate"),this.revisionDate=this.getResponseProperty("RevisionDate"),this.userCount=this.getResponseProperty("UserCount"),this.seats=this.getResponseProperty("Seats"),this.occupiedSeats=this.getResponseProperty("OccupiedSeats"),this.remainingSeats=this.getResponseProperty("RemainingSeats"),this.plan=this.getResponseProperty("Plan")}}class ite extends tte{constructor(e){super(e),this.organizationName=this.getResponseProperty("OrganizationName")}}class nte extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.name=this.getResponseProperty("Name"),this.businessName=this.getResponseProperty("BusinessName"),this.billingEmail=this.getResponseProperty("BillingEmail"),this.creationDate=this.getResponseProperty("CreationDate"),this.type=this.getResponseProperty("Type")}}var rte=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class ste{constructor(e){null!=e&&(this.id=e.id,this.name=e.name,this.status=e.status,this.type=e.type,this.enabled=e.enabled,this.userId=e.userId,this.useEvents=e.useEvents,this.providerStatus=e.providerStatus,this.providerType=e.providerType)}get canAccess(){return!!this.isProviderAdmin||this.enabled&&this.status===lp.Confirmed}get canCreateOrganizations(){return this.enabled&&this.isProviderAdmin}get canManageUsers(){return this.isProviderAdmin}get canAccessEventLogs(){return this.isProviderAdmin}get isProviderAdmin(){return this.type===cp.ProviderAdmin}}var ote=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const ate=k.record(F,"providers",{deserializer:e=>e,clearOn:["logout"]});class lte{}class cte{}class ute{}class dte{}class hte{constructor(e,t){this.token=e,this.expiresAt=t}isExpired(e=5e3){return Date.now()>=this.expiresAt-e}timeUntilExpirySeconds(){return Math.max(0,Math.floor((this.expiresAt-Date.now())/1e3))}static fromJson(e){return new hte(e.token,e.expiresAt)}static fromSendAccessTokenResponse(e){return new hte(e.token,e.expiresAt)}}const pte=m.record(X,"accessTokenDict",{deserializer:e=>hte.fromJson(e)});var vte=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})},fte=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(i[n[r]]=e[n[r]])}return i};var mte=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var gte=i(6367),yte=i(28621),bte=i(54124);class wte extends tS{constructor(e){super(e),this.contextId=this.getResponseProperty("ContextId"),this.type=this.getResponseProperty("Type");let t=this.getResponseProperty("Payload");if("string"==typeof t)try{t=JSON.parse(t)}catch(e){}switch(this.type){case Ba.SyncCipherCreate:case Ba.SyncCipherDelete:case Ba.SyncCipherUpdate:case Ba.SyncLoginDelete:this.payload=new Ste(t);break;case Ba.SyncFolderCreate:case Ba.SyncFolderDelete:case Ba.SyncFolderUpdate:this.payload=new kte(t);break;case Ba.SyncVault:case Ba.SyncCiphers:case Ba.SyncOrganizations:case Ba.SyncOrgKeys:case Ba.SyncSettings:this.payload=new Ite(t);break;case Ba.LogOut:this.payload=new Dte(t);break;case Ba.SyncSendCreate:case Ba.SyncSendUpdate:case Ba.SyncSendDelete:this.payload=new Cte(t);break;case Ba.AuthRequest:case Ba.AuthRequestResponse:this.payload=new Tte(t);break;case Ba.SyncOrganizationStatusChanged:this.payload=new Pte(t);break;case Ba.SyncOrganizationCollectionSettingChanged:this.payload=new Fte(t);break;case Ba.Notification:case Ba.NotificationStatus:this.payload=new q3(t);break;case Ba.OrganizationBankAccountVerified:this.payload=new Rte(t);break;case Ba.ProviderBankAccountVerified:this.payload=new xte(t);break;case Ba.SyncPolicy:this.payload=new Ate(t);break;case Ba.AutoConfirmMember:this.payload=new Ete(t)}}}class Ste extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.userId=this.getResponseProperty("UserId"),this.organizationId=this.getResponseProperty("OrganizationId"),this.collectionIds=this.getResponseProperty("CollectionIds"),this.revisionDate=new Date(this.getResponseProperty("RevisionDate"))}}class kte extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.userId=this.getResponseProperty("UserId"),this.revisionDate=new Date(this.getResponseProperty("RevisionDate"))}}class Ite extends tS{constructor(e){super(e),this.userId=this.getResponseProperty("UserId"),this.date=new Date(this.getResponseProperty("Date"))}}class Cte extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.userId=this.getResponseProperty("UserId"),this.revisionDate=new Date(this.getResponseProperty("RevisionDate"))}}class Tte extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.userId=this.getResponseProperty("UserId")}}class Pte extends tS{constructor(e){super(e),this.organizationId=this.getResponseProperty("OrganizationId"),this.enabled=this.getResponseProperty("Enabled")}}class Fte extends tS{constructor(e){super(e),this.organizationId=this.getResponseProperty("OrganizationId"),this.limitCollectionCreation=this.getResponseProperty("LimitCollectionCreation"),this.limitCollectionDeletion=this.getResponseProperty("LimitCollectionDeletion")}}class Rte extends tS{constructor(e){super(e),this.organizationId=this.getResponseProperty("OrganizationId")}}class xte extends tS{constructor(e){super(e),this.providerId=this.getResponseProperty("ProviderId"),this.adminId=this.getResponseProperty("AdminId")}}class Ate extends tS{constructor(e){super(e),this.policy=this.getResponseProperty("Policy")}}class Dte extends tS{constructor(e){super(e),this.userId=this.getResponseProperty("UserId"),this.reason=this.getResponseProperty("Reason")}}class Ete extends tS{constructor(e){super(e),this.targetUserId=this.getResponseProperty("TargetUserId"),this.userId=this.getResponseProperty("UserId"),this.organizationId=this.getResponseProperty("OrganizationId")}}class $te extends Error{constructor(e){super(void 0===e?"Insecure URL not allowed. All URLs must use HTTPS.":`Insecure URL not allowed: ${e}. All URLs must use HTTPS.`)}}var Ote=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Ute=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Mte{constructor(e,t,i,n,r){this.accountService=e,this.authService=t,this.masterPasswordService=i,this.messagingService=n,this.pendingAuthRequestsState=r}activeUserMeetsConditionsToShowApprovalDialog(e){return Ute(this,void 0,void 0,function*(){if((yield(0,bo._)(this.accountService.activeAccount$.pipe(nv)))!==e)return!1;if((yield(0,bo._)(this.authService.activeAccountStatus$))!==Pd.Unlocked)return!1;return(yield(0,bo._)(this.masterPasswordService.forceSetPasswordReason$(e)))===aS.None})}setupUnlockListenersForProcessingAuthRequests(e){this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id),(0,mo.F)(),(0,Eo.p)(e=>null!=e),(0,go.n)(e=>this.authService.authStatusFor$(e).pipe((0,_o.s)(1))),(0,Eo.p)(e=>e===Pd.Unlocked),(0,Oo.M)(()=>{this.processPendingAuthRequests()}),(0,vm.Q)(e)).subscribe(),this.authService.activeAccountStatus$.pipe((0,kd.Z)(null),(0,mm.J)(),(0,Eo.p)(([e,t])=>e!==Pd.Unlocked&&t===Pd.Unlocked),(0,vm.Q)(e)).subscribe(()=>{this.processPendingAuthRequests()})}processPendingAuthRequests(){return Ute(this,void 0,void 0,function*(){var e;const t=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));if((yield(0,bo._)(this.masterPasswordService.forceSetPasswordReason$(t)))!==aS.None)return;yield this.pendingAuthRequestsState.pruneOlderThan(9e5);const i=null!==(e=yield(0,bo._)(this.pendingAuthRequestsState.getAll$()))&&void 0!==e?e:[];if(i.length>0){i.some(e=>e.userId===t)&&this.messagingService.send("openLoginApproval")}})}handleAuthRequestNotificationClicked(e){return Ute(this,void 0,void 0,function*(){throw new Error("handleAuthRequestNotificationClicked() not implemented for this client")})}}var Nte=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Vte{constructor(e){this.avatarColor=e}}var Bte=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const jte=new k($,"avatarColor",{deserializer:e=>e,clearOn:[]});class Gte{constructor(e){Object.assign(this,e),this.response=e}}var Lte=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class zte extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.userId=this.getResponseProperty("UserId"),this.name=this.getResponseProperty("Name"),this.identifier=this.getResponseProperty("Identifier"),this.type=this.getResponseProperty("Type"),this.creationDate=this.getResponseProperty("CreationDate"),this.revisionDate=this.getResponseProperty("RevisionDate"),this.isTrusted=this.getResponseProperty("IsTrusted"),this.encryptedUserKey=this.getResponseProperty("EncryptedUserKey"),this.encryptedPublicKey=this.getResponseProperty("EncryptedPublicKey"),this.devicePendingAuthRequest=this.getResponseProperty("DevicePendingAuthRequest")}}class _te{constructor(e){this.devices=e}}class Kte{constructor(e,t,i){this.encapsulatedDownstreamKey=e,this.encryptedPublicKey=t,this.encryptedPrivateKey=i}}class Xte extends tS{constructor(e){super(e),this.id=this.getResponseProperty("id"),this.name=this.getResponseProperty("name"),this.identifier=this.getResponseProperty("identifier"),this.type=this.getResponseProperty("type"),this.creationDate=new Date(this.getResponseProperty("creationDate")),e.encryptedUserKey&&(this.encryptedUserKey=new Pp(this.getResponseProperty("encryptedUserKey"))),e.encryptedPublicKey&&(this.encryptedPublicKey=new Pp(this.getResponseProperty("encryptedPublicKey")))}getRotateableKeyset(){return new Kte(this.encryptedUserKey,this.encryptedPublicKey)}isTrusted(){return null!=this.encryptedUserKey&&null!=this.encryptedPublicKey}}class qte{constructor(e,t,i){this.encryptedUserKey=e,this.encryptedPublicKey=t,this.encryptedPrivateKey=i}}var Wte=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Yte=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Hte=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Jte=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Zte=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Qte=new m(G,"ssoCodeVerifier",{deserializer:e=>e}),eie=new m(G,"ssoState",{deserializer:e=>e}),tie=new k(G,"organizationSsoIdentifier",{deserializer:e=>e,clearOn:["logout"]}),iie=new m(G,"organizationSsoIdentifier",{deserializer:e=>e}),nie=new m(G,"ssoEmail",{deserializer:e=>e}),rie=new m(L,"ssoRequiredCache",{deserializer:e=>e});class sie{constructor(e,t,i){this.accessToken=e,this.refreshToken=t,this.clientIdSecretPair=i}}const oie=new k(z,"accessToken",{deserializer:e=>e,clearOn:[]}),aie=new k(K,"accessToken",{deserializer:e=>e,clearOn:[]}),lie=new k(z,"refreshToken",{deserializer:e=>e,clearOn:[]}),cie=new k(K,"refreshToken",{deserializer:e=>e,clearOn:[]}),uie=m.record(_,"emailTwoFactorTokenRecord",{deserializer:e=>e}),die=new k(z,"apiKeyClientId",{deserializer:e=>e,clearOn:[]}),hie=new k(K,"apiKeyClientId",{deserializer:e=>e,clearOn:[]}),pie=new k(z,"apiKeyClientSecret",{deserializer:e=>e,clearOn:[]}),vie=new k(K,"apiKeyClientSecret",{deserializer:e=>e,clearOn:[]}),fie=new k(K,"securityStamp",{deserializer:e=>e,clearOn:["logout"]});var mie,gie=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};!function(e){e.Disk="disk",e.SecureStorage="secureStorage",e.Memory="memory"}(mie||(mie={}));var yie=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class bie{constructor(e){this.OTP=e}}var wie=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Sie extends tS{constructor(e){var t;super(e),this.allowCredentials=null===(t=this.getResponseProperty("allowCredentials"))||void 0===t?void 0:t.map(e=>Object.assign(Object.assign({},e),{id:bd.fromUrlB64ToArray(e.id).buffer})),this.challenge=bd.fromUrlB64ToArray(this.getResponseProperty("challenge")),this.extensions=this.getResponseProperty("extensions"),this.rpId=this.getResponseProperty("rpId"),this.timeout=this.getResponseProperty("timeout"),this.userVerification=this.getResponseProperty("userVerification")}}class kie extends tS{constructor(e){super(e),this.options=new Sie(this.getResponseProperty("options")),this.token=this.getResponseProperty("token")}}var Iie=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Cie=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Tie{constructor(e,t){this.options=e,this.token=t}}class Pie{constructor(e,t,i){this.token=e,this.deviceResponse=t,this.prfKey=i}}var Fie=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Rie=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var xie=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Aie=new k(A,"accountProfile",{deserializer:e=>e,clearOn:["logout"]});class Die extends tS{constructor(e){super(e);const t=this.getResponseProperty("Seat");if(!t||"object"!=typeof t)throw new Error("PremiumPlanResponse: Missing or invalid 'Seat' property");this.seat=new Eie(t);const i=this.getResponseProperty("Storage");if(!i||"object"!=typeof i)throw new Error("PremiumPlanResponse: Missing or invalid 'Storage' property");this.storage=new Eie(i)}}class Eie extends tS{constructor(e){if(super(e),this.stripePriceId=this.getResponseProperty("StripePriceId"),!this.stripePriceId||"string"!=typeof this.stripePriceId)throw new Error("PurchasableResponse: Missing or invalid 'StripePriceId' property");if(this.price=this.getResponseProperty("Price"),"number"!=typeof this.price||isNaN(this.price))throw new Error("PurchasableResponse: Missing or invalid 'Price' property");if(this.provided=this.getResponseProperty("Provided"),"number"!=typeof this.provided||isNaN(this.provided))throw new Error("PurchasableResponse: Missing or invalid 'Provided' property")}}class $ie extends tS{constructor(e){super(e),this.invoices=[];const t=this.getResponseProperty("Invoices");t&&t.length&&(this.invoices=t.map(e=>new Oie(e)))}}class Oie extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.date=this.getResponseProperty("Date"),this.number=this.getResponseProperty("Number"),this.total=this.getResponseProperty("Total"),this.status=this.getResponseProperty("Status"),this.dueDate=this.getResponseProperty("DueDate"),this.url=this.getResponseProperty("Url")}}class Uie extends tS{constructor(e){super(e),this.isOnSecretsManagerStandalone=this.getResponseProperty("IsOnSecretsManagerStandalone"),this.organizationOccupiedSeats=this.getResponseProperty("OrganizationOccupiedSeats")}}class Mie extends tS{constructor(e){super(e),this.type=this.getResponseProperty("Type"),this.description=this.getResponseProperty("Description"),this.needsVerification=this.getResponseProperty("NeedsVerification")}}class Nie extends tS{constructor(e){super(e),this.suspensionDate=this.getResponseProperty("suspensionDate"),this.unpaidPeriodEndDate=this.getResponseProperty("unpaidPeriodEndDate"),this.gracePeriod=this.getResponseProperty("gracePeriod")}}class Vie extends tS{constructor(e){super(e),this.taxId=this.getResponseProperty("TaxIdNumber"),this.taxId||(this.taxId=this.getResponseProperty("TaxId")),this.taxIdType=this.getResponseProperty("TaxIdType"),this.line1=this.getResponseProperty("Line1"),this.line2=this.getResponseProperty("Line2"),this.city=this.getResponseProperty("City"),this.state=this.getResponseProperty("State"),this.postalCode=this.getResponseProperty("PostalCode"),this.country=this.getResponseProperty("Country")}}class Bie extends tS{constructor(e){super(e),this.plans=[],this.status=this.getResponseProperty("status"),this.currentPeriodEndDate=this.getResponseProperty("currentPeriodEndDate"),this.discountPercentage=this.getResponseProperty("discountPercentage"),this.collectionMethod=this.getResponseProperty("collectionMethod");const t=this.getResponseProperty("plans");null!=t&&(this.plans=t.map(e=>new jie(e))),this.accountCredit=this.getResponseProperty("accountCredit");const i=this.getResponseProperty("taxInformation");null!=i&&(this.taxInformation=new Vie(i)),this.cancelAt=this.getResponseProperty("cancelAt");const n=this.getResponseProperty("suspension");null!=n&&(this.suspension=new Nie(n)),this.providerType=this.getResponseProperty("providerType");const r=this.getResponseProperty("paymentSource");null!=r&&(this.paymentSource=new Mie(r))}}class jie extends tS{constructor(e){super(e),this.planName=this.getResponseProperty("PlanName"),this.seatMinimum=this.getResponseProperty("SeatMinimum"),this.assignedSeats=this.getResponseProperty("AssignedSeats"),this.purchasedSeats=this.getResponseProperty("PurchasedSeats"),this.cost=this.getResponseProperty("Cost"),this.cadence=this.getResponseProperty("Cadence"),this.type=this.getResponseProperty("Type"),this.productTier=this.getResponseProperty("ProductTier")}}var Gie=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Lie=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var zie=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class _ie extends tS{constructor(e){var t;super(e),this.toDelete=!1,this.sponsoringOrganizationUserId=this.getResponseProperty("SponsoringOrganizationUserId"),this.friendlyName=this.getResponseProperty("FriendlyName"),this.offeredToEmail=this.getResponseProperty("OfferedToEmail"),this.planSponsorshipType=this.getResponseProperty("PlanSponsorshipType"),this.lastSyncDate=this.getResponseProperty("LastSyncDate"),this.validUntil=this.getResponseProperty("ValidUntil"),this.toDelete=null!==(t=this.getResponseProperty("ToDelete"))&&void 0!==t&&t,this.isAdminInitiated=this.getResponseProperty("IsAdminInitiated"),this.notes=this.getResponseProperty("Notes"),this.statusMessage=this.getResponseProperty("StatusMessage"),this.statusClass=this.getResponseProperty("StatusClass")}}var Kie=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Xie{}class qie extends Xie{}class Wie extends _k{constructor(e,t){super(e,t)}}var Yie=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Hie extends tS{constructor(e){super(e),this.addedDate=this.getResponseProperty("AddedDate"),this.breachDate=this.getResponseProperty("BreachDate"),this.dataClasses=this.getResponseProperty("DataClasses"),this.description=this.getResponseProperty("Description"),this.domain=this.getResponseProperty("Domain"),this.isActive=this.getResponseProperty("IsActive"),this.isVerified=this.getResponseProperty("IsVerified"),this.logoPath=this.getResponseProperty("LogoPath"),this.modifiedDate=this.getResponseProperty("ModifiedDate"),this.name=this.getResponseProperty("Name"),this.pwnCount=this.getResponseProperty("PwnCount"),this.title=this.getResponseProperty("Title")}}var Jie=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Zie{constructor(e){this.apiService=e}getHibpBreach(e){return Jie(this,void 0,void 0,function*(){const t=encodeURIComponent(e);return(yield this.apiService.send("GET","/hibp/breach?username="+t,null,!0,!0)).map(e=>new Hie(e))})}}var Qie=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const ene=new k(Le,"accountCryptographicState",{deserializer:e=>e,clearOn:["logout"]});var tne=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const ine=16;class nne{constructor(e){this.buffer=e,this.encryptionType=null,this.dataBytes=null,this.ivBytes=null,this.macBytes=null;const t=e,i=t[0];switch(i){case hp.AesCbc256_HmacSha256_B64:{const e=50;t.length<e&&this.throwDecryptionError(),this.ivBytes=t.slice(1,17),this.macBytes=t.slice(17,49),this.dataBytes=t.slice(49);break}case hp.AesCbc256_B64:{const e=18;t.length<e&&this.throwDecryptionError(),this.ivBytes=t.slice(1,17),this.dataBytes=t.slice(17);break}default:this.throwDecryptionError()}this.encryptionType=i}throwDecryptionError(){throw new Error("Error parsing encrypted ArrayBuffer: data is corrupted or has an invalid format.")}static fromParts(e,t,i,n){if(null==e||null==t||null==i)throw new Error("encryptionType, iv, and data must be provided");switch(e){case hp.AesCbc256_B64:case hp.AesCbc256_HmacSha256_B64:nne.validateIvLength(t),nne.validateMacLength(e,n);break;default:throw new Error(`Unknown EncryptionType ${e} for EncArrayBuffer.fromParts`)}let r=0;null!=n&&(r=n.length);const s=new Uint8Array(1+t.byteLength+r+i.byteLength);return s.set([e],0),s.set(t,1),null!=n&&s.set(n,1+t.byteLength),s.set(i,1+t.byteLength+r),new nne(s)}static fromResponse(e){return tne(this,void 0,void 0,function*(){const t=yield e.arrayBuffer();if(null==t)throw new Error("Cannot create EncArrayBuffer from Response - Response is empty");return new nne(new Uint8Array(t))})}static fromB64(e){const t=bd.fromB64ToArray(e);return new nne(t)}static validateIvLength(e){if(null==e||e.length!==ine)throw new Error("Invalid IV length")}static validateMacLength(e,t){switch(e){case hp.AesCbc256_B64:if(null!=t)throw new Error("mac must not be provided for AesCbc256_B64");break;case hp.AesCbc256_HmacSha256_B64:if(null==t||32!==t.length)throw new Error("Invalid MAC length");break;default:throw new Error("Invalid encryption type and mac combination")}}}var rne=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var sne=i(55367),one=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class ane{constructor(e){var t;if(null==(null===(t=null==e?void 0:e.crypto)||void 0===t?void 0:t.subtle))throw new Error("Could not instantiate WebCryptoFunctionService. Could not locate Subtle crypto.");this.crypto=e.crypto,this.subtle=this.crypto.subtle}pbkdf2(e,t,i,n){return one(this,void 0,void 0,function*(){const r="sha256"===i?256:512,s=this.toBuf(e),o={name:"PBKDF2",salt:this.toBuf(t),iterations:n,hash:{name:this.toWebCryptoAlgorithm(i)}},a=yield this.subtle.importKey("raw",s,{name:"PBKDF2"},!1,["deriveBits"]),l=yield this.subtle.deriveBits(o,a,r);return new Uint8Array(l)})}hkdf(e,t,i,n,r){return one(this,void 0,void 0,function*(){const s={name:"HKDF",salt:this.toBuf(t),info:this.toBuf(i),hash:{name:this.toWebCryptoAlgorithm(r)}},o=yield this.subtle.importKey("raw",e,{name:"HKDF"},!1,["deriveBits"]),a=yield this.subtle.deriveBits(s,o,8*n);return new Uint8Array(a)})}hkdfExpand(e,t,i,n){return one(this,void 0,void 0,function*(){const r="sha256"===n?32:64;if(i>255*r)throw new Error("outputByteSize is too large.");if(new Uint8Array(e).length<r)throw new Error("prk is too small.");const s=this.toBuf(t),o=new Uint8Array(s);let a=0,l=new Uint8Array(0);const c=Math.ceil(i/r),u=new Uint8Array(c*r);for(let t=0;t<c;t++){const r=new Uint8Array(l.length+o.length+1);if(r.set(l),r.set(o,l.length),r.set([t+1],r.length-1),l=new Uint8Array(yield this.hmac(r,e,n)),u.set(l,a),a+=l.length,a>=i)break}return u.slice(0,i)})}hash(e,t){return one(this,void 0,void 0,function*(){if("md5"===t){const t=sne.md.md5.create(),i=this.toByteString(e);return t.update(i,"raw"),bd.fromByteStringToArray(t.digest().data)}const i=this.toBuf(e),n=yield this.subtle.digest({name:this.toWebCryptoAlgorithm(t)},i);return new Uint8Array(n)})}hmac(e,t,i){return one(this,void 0,void 0,function*(){const n={name:"HMAC",hash:{name:this.toWebCryptoAlgorithm(i)}},r=yield this.subtle.importKey("raw",t,n,!1,["sign"]),s=yield this.subtle.sign(n,r,e);return new Uint8Array(s)})}hmacFast(e,t,i){const n=sne.hmac.create();n.start(i,t),n.update(e);const r=n.digest().getBytes();return Promise.resolve(r)}compareFast(e,t){return one(this,void 0,void 0,function*(){const i=yield this.randomBytes(32),n=new Uint32Array(i),r=sne.util.createBuffer();for(let e=0;e<n.length;e++)r.putInt32(n[e]);const s=r.getBytes(),o=sne.hmac.create();o.start("sha256",s),o.update(e);const a=o.digest().getBytes();o.start("sha256",null),o.update(t);return a===o.digest().getBytes()})}aesDecryptFastParameters(e,t,i,n){const r=n.inner();if(r.type===hp.AesCbc256_B64)return{iv:sne.util.decode64(t),data:sne.util.decode64(e),encKey:sne.util.createBuffer(r.encryptionKey).getBytes()};if(r.type===hp.AesCbc256_HmacSha256_B64){const n=sne.util.decode64(t)+sne.util.decode64(e);return{iv:sne.util.decode64(t),data:sne.util.decode64(e),encKey:sne.util.createBuffer(r.encryptionKey).getBytes(),macKey:sne.util.createBuffer(r.authenticationKey).getBytes(),mac:sne.util.decode64(i),macData:n}}throw new Error("Unsupported encryption type.")}aesDecryptFast({mode:e,parameters:t}){const i=sne.cipher.createDecipher(this.toWebCryptoAesMode(e),t.encKey),n={};"cbc"===e&&(n.iv=t.iv);const r=sne.util.createBuffer(t.data);i.start(n),i.update(r),i.finish();const s=i.output.toString();return Promise.resolve(s)}aesDecrypt(e,t,i,n){return one(this,void 0,void 0,function*(){if("ecb"===n){const t={data:this.toByteString(e),encKey:this.toByteString(i)},n=yield this.aesDecryptFast({mode:"ecb",parameters:t});return bd.fromByteStringToArray(n)}const r=yield this.subtle.importKey("raw",i,{name:"AES-CBC"},!1,["decrypt"]);if(null==t)throw new Error("IV is required for CBC mode.");const s=yield this.subtle.decrypt({name:"AES-CBC",iv:t},r,e);return new Uint8Array(s)})}rsaEncrypt(e,t,i){return one(this,void 0,void 0,function*(){return yield om.Ready,nm.IEs.rsa_encrypt_data(e,t)})}rsaDecrypt(e,t,i){return one(this,void 0,void 0,function*(){return yield om.Ready,nm.IEs.rsa_decrypt_data(e,t)})}rsaExtractPublicKey(e){return one(this,void 0,void 0,function*(){return yield om.Ready,nm.IEs.rsa_extract_public_key(e)})}rsaGenerateKeyPair(e){return one(this,void 0,void 0,function*(){yield om.Ready;const e=nm.IEs.rsa_generate_keypair();return[yield this.rsaExtractPublicKey(e),e]})}aesGenerateKey(){return one(this,arguments,void 0,function*(e=960){if(512===e){const e=yield this.aesGenerateKey(256),t=yield this.aesGenerateKey(256);return new Uint8Array([...e,...t])}const t={name:"AES-CBC",length:e},i=yield this.subtle.generateKey(t,!0,["encrypt","decrypt"]),n=yield this.subtle.exportKey("raw",i);return new Uint8Array(n)})}randomBytes(e){const t=new Uint8Array(e);return this.crypto.getRandomValues(t),Promise.resolve(t)}toBuf(e){let t;return t="string"==typeof e?bd.fromUtf8ToArray(e):e,t}toByteString(e){let t;return t="string"==typeof e?sne.util.encodeUtf8(e):bd.fromBufferToByteString(e),t}toWebCryptoAlgorithm(e){if("md5"===e)throw new Error("MD5 is not supported in WebCrypto.");return"sha1"===e?"SHA-1":"sha256"===e?"SHA-256":"SHA-512"}toWebCryptoAesMode(e){return"cbc"===e?"AES-CBC":"AES-ECB"}}class lne extends bP{}class cne{}class une extends cne{}var dne=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const hne=new k(O,"deviceKey",{deserializer:e=>e?Dv.fromJSON(e):null,clearOn:[],cleanupDelayMs:0,debug:{enableRetrievalLogging:!0,enableUpdateLogging:!0}}),pne=new k(O,"shouldTrustDevice",{deserializer:e=>e,clearOn:[]});var vne=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class fne{constructor(e,t,i,n,r){this.kdfConfigService=e,this.changeKdfService=t,this.logService=i,this.configService=n,this.masterPasswordService=r}runMigrations(e,t){return vne(this,void 0,void 0,function*(){ak(e,"userId"),ak(t,"masterPassword"),this.logService.info(`[MinimumKdfMigration] Updating user ${e} to minimum PBKDF2 iteration count ${jv.ITERATIONS.defaultValue}`),yield this.changeKdfService.updateUserKdfParams(t,new jv(jv.ITERATIONS.defaultValue),e),yield this.kdfConfigService.setKdfConfig(e,new jv(jv.ITERATIONS.defaultValue))})}needsMigration(e){return vne(this,void 0,void 0,function*(){if(ak(e,"userId"),!(yield this.masterPasswordService.userHasMasterPassword(e)))return"noMigrationNeeded";const t=yield this.kdfConfigService.getKdfConfig(e);return t.kdfType!==Mv.PBKDF2_SHA256||t.iterations>=jv.ITERATIONS.min?"noMigrationNeeded":(yield this.configService.getFeatureFlag(Wv.ForceUpdateKDFSettings))?"needsMigrationWithMasterPassword":"noMigrationNeeded"})}}var mne=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var gne=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class yne{}class bne extends MH{constructor(e,t){super(),this.newMasterPasswordHash=e.masterPasswordAuthenticationHash,this.key=t.masterKeyWrappedUserKey,this.authenticationData=e,this.unlockData=t}}var wne=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})},Sne=function(e,t,i){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var n,r;if(i){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],i&&(r=n)}if("function"!=typeof n)throw new TypeError("Object not disposable.");r&&(n=function(){try{r.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:n,async:i})}else i&&e.stack.push({async:!0});return t},kne=function(e){return function(t){function i(i){t.error=t.hasError?new e(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var n,r=0;return function e(){for(;n=t.stack.pop();)try{if(!n.async&&1===r)return r=0,t.stack.push(n),Promise.resolve().then(e);if(n.dispose){var s=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(s).then(e,function(t){return i(t),e()})}else r|=1}catch(e){i(e)}if(1===r)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,i){var n=new Error(i);return n.name="SuppressedError",n.error=e,n.suppressed=t,n});class Ine{constructor(e,t,i,n){this.changeKdfApiService=e,this.sdkService=t,this.keyService=i,this.masterPasswordService=n}updateUserKdfParams(e,t,i){return wne(this,void 0,void 0,function*(){ak(e,"masterPassword"),ak(t,"kdf"),ak(i,"userId");const n=yield(0,bo._)(this.sdkService.userClient$(i).pipe((0,l.T)(i=>{const n={stack:[],error:void 0,hasError:!1};try{if(!i)throw new Error("SDK not available");const r=Sne(n,i.take(),!1);return r.value.crypto().make_update_kdf(e,t.toSdkConfig())}catch(e){n.error=e,n.hasError=!0}finally{kne(n)}}))),r=yS(n.masterPasswordAuthenticationData),s=gS.fromSdk(n.masterPasswordUnlockData),o=yS(n.oldMasterPasswordAuthenticationData),a=new bne(r,s);a.authenticateWith(o),yield this.changeKdfApiService.updateUserKdfParams(a);const c=yield this.keyService.makeMasterKey(e,s.salt,s.kdf),u=yield this.keyService.hashMasterKey(e,c,mp.LocalAuthorization);yield this.masterPasswordService.setMasterKeyHash(u,i),yield this.masterPasswordService.setMasterKey(c,i)})}}class Cne{}class Tne extends tS{constructor(e){super(e),this.organizationName=this.getResponseProperty("OrganizationName")}}var Pne=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Fne{constructor(e){this.key=e}}class Rne{constructor(e,t,i,n){this.key=e,this.kdf=t.kdfType,this.kdfIterations=t.iterations,t.kdfType===Mv.Argon2id&&(this.kdfMemory=t.memory,this.kdfParallelism=t.parallelism),this.orgIdentifier=i,this.keys=n}}var xne=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})},Ane=function(e,t,i){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var n,r;if(i){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],i&&(r=n)}if("function"!=typeof n)throw new TypeError("Object not disposable.");r&&(n=function(){try{r.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:n,async:i})}else i&&e.stack.push({async:!0});return t},Dne=function(e){return function(t){function i(i){t.error=t.hasError?new e(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var n,r=0;return function e(){for(;n=t.stack.pop();)try{if(!n.async&&1===r)return r=0,t.stack.push(n),Promise.resolve().then(e);if(n.dispose){var s=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(s).then(e,function(t){return i(t),e()})}else r|=1}catch(e){i(e)}if(1===r)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,i){var n=new Error(i);return n.name="SuppressedError",n.error=e,n.suppressed=t,n});const Ene=new k(Ke,"usesKeyConnector",{deserializer:e=>e,clearOn:["logout"],cleanupDelayMs:0}),$ne=new k(Ke,"newSsoUserKeyConnectorConversion",{deserializer:e=>null==e?null:{kdfConfig:e.kdfConfig.kdfType===Mv.PBKDF2_SHA256?jv.fromJSON(e.kdfConfig):Gv.fromJSON(e.kdfConfig),keyConnectorUrl:e.keyConnectorUrl,organizationId:e.organizationId},clearOn:["logout"],cleanupDelayMs:0});class One{constructor(e){if("object"!=typeof e||null==e)throw new TypeError("Response must be an object");if(!("publicKey"in e&&e.publicKey instanceof Uint8Array))throw new TypeError("Response must contain a valid publicKey");if(this.publicKey=e.publicKey,"verifyingKey"in e&&"string"==typeof e.verifyingKey?this.verifyingKey=e.verifyingKey:this.verifyingKey=null,"signedPublicKey"in e&&"string"==typeof e.signedPublicKey?this.signedPublicKey=e.signedPublicKey:this.signedPublicKey=null,null!==this.signedPublicKey&&null===this.verifyingKey||null===this.signedPublicKey&&null!==this.verifyingKey)throw new TypeError("Both signedPublicKey and verifyingKey must be present or absent together")}}var Une=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Mne=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Nne=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Vne,Bne=i(64336),jne=i(62329);!function(e){e[e.SignalR=0]="SignalR",e[e.WebPush=1]="WebPush"}(Vne||(Vne={}));class Gne{constructor(e){var t,i;this.featureStates={},this.version=e.version,this.gitHash=e.gitHash,this.server=e.server,this.utcDate=new Date(e.utcDate),this.environment=e.environment,this.featureStates=e.featureStates,this.push=null==e.push?{pushTechnology:Vne.SignalR}:{pushTechnology:e.push.pushTechnology,vapidPublicKey:e.push.vapidPublicKey},this.settings=e.settings,null==(null===(t=this.server)||void 0===t?void 0:t.name)&&null==(null===(i=this.server)||void 0===i?void 0:i.url)&&(this.server=null)}getAgeInMilliseconds(){var e;return(new Date).getTime()-(null===(e=this.utcDate)||void 0===e?void 0:e.getTime())}isValid(){return this.getAgeInMilliseconds()<=864e5}static fromJSON(e){return null==e?null:new Gne(e)}}function Lne(e){return"string"==typeof e?JSON.parse(e):e}function zne(e){var t;const i=null!==(t=Lne({sdk:!0}))&&void 0!==t?t:{};return null==i[e]||!!i[e]}class _ne{constructor(e){var t;this.disableUserRegistration=null!==(t=null==e?void 0:e.disableUserRegistration)&&void 0!==t&&t}}class Kne{constructor(e){this.featureStates={},this.version=null==e?void 0:e.version,this.gitHash=null==e?void 0:e.gitHash,this.server=(null==e?void 0:e.server)?new qne(e.server):null,this.utcDate=(new Date).toISOString(),this.environment=(null==e?void 0:e.environment)?new Wne(e.environment):null,this.featureStates=null==e?void 0:e.featureStates,this.settings=new _ne(e.settings),this.push=(null==e?void 0:e.push)?new Xne(e.push):null}static fromJSON(e){return Object.assign(new Kne({}),e,{server:(null==e?void 0:e.server)?qne.fromJSON(e.server):null,environment:(null==e?void 0:e.environment)?Wne.fromJSON(e.environment):null})}}class Xne{constructor(e){this.pushTechnology=e.pushTechnology,this.vapidPublicKey=e.vapidPublicKey}static fromJSON(e){return Object.assign(new Xne({}),e)}}class qne{constructor(e){this.name=e.name,this.url=e.url}static fromJSON(e){return Object.assign(new qne({}),e)}}class Wne{constructor(e){this.cloudRegion=e.cloudRegion,this.vault=e.vault,this.api=e.api,this.identity=e.identity,this.notifications=e.notifications,this.sso=e.sso}static fromJSON(e){return Object.assign(new Wne({}),e)}}var Yne=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Hne=new k(ne,"serverConfig",{deserializer:e=>null==e?null:Gne.fromJSON(e),clearOn:["logout"]}),Jne=m.record(ne,"byServer",{deserializer:e=>null==e?null:Gne.fromJSON(e)}),Zne=(e,t)=>e.getApiUrl()===t.getApiUrl();class Qne{constructor(e,t,i,n,r){this.configApiService=e,this.environmentService=t,this.logService=i,this.stateProvider=n,this.authService=r,this.failedFetchFallbackSubject=new Co.B;const s=this.environmentService.globalEnvironment$.pipe((0,mo.F)(Zne),(0,go.n)(e=>this.globalConfigFor$(e.getApiUrl()).pipe((0,l.T)(t=>[t,null,e,t]))));this.serverConfig$=this.stateProvider.activeUserId$.pipe((0,mo.F)(),(0,go.n)(e=>null==e?s:this.authService.authStatusFor$(e).pipe((0,l.T)(e=>e===Pd.Unlocked),(0,mo.F)(),(0,go.n)(t=>t?(0,jo.z)([this.environmentService.getEnvironment$(e).pipe((0,mo.F)(Zne)),this.userConfigFor$(e)]).pipe((0,go.n)(([t,i])=>null==i?this.globalConfigFor$(t.getApiUrl()).pipe((0,l.T)(i=>[null,e,t,i])):(0,Go.of)([i,e,t,i]))):s))),(0,Oo.M)(e=>Yne(this,void 0,void 0,function*(){const[t,i,n,r]=e;t&&!this.olderThanRetrievalInterval(t.utcDate)||(yield this.renewConfig(t,i,n,r))})),(0,go.n)(([e])=>!e||this.olderThanRetrievalInterval(e.utcDate)?yo.t:(0,Go.of)(e)),(0,dB.X)(this.failedFetchFallbackSubject),(0,Fo.u)({connector:()=>new Ro.m(1),resetOnRefCountZero:()=>(0,xo.O)(1e3)})),this.cloudRegion$=this.serverConfig$.pipe((0,l.T)(e=>{var t,i;return null!==(i=null===(t=null==e?void 0:e.environment)||void 0===t?void 0:t.cloudRegion)&&void 0!==i?i:hk.US})),this.serverSettings$=this.serverConfig$.pipe((0,l.T)(e=>{var t;return null!==(t=null==e?void 0:e.settings)&&void 0!==t?t:new _ne}))}getFeatureFlag$(e){return this.serverConfig$.pipe((0,l.T)(t=>Jv(t,e)))}userCachedFeatureFlag$(e,t){return this.stateProvider.getUser(t,Hne).state$.pipe((0,l.T)(t=>Jv(t,e)))}getFeatureFlag(e){return Yne(this,void 0,void 0,function*(){return yield(0,bo._)(this.getFeatureFlag$(e))})}checkServerMeetsVersionRequirement$(e){return this.serverConfig$.pipe((0,l.T)(t=>{if(null==t)return!1;return new jne.SemVer(t.version).compare(e)>=0}))}ensureConfigFetched(){return Yne(this,void 0,void 0,function*(){yield(0,bo._)(this.serverConfig$)})}olderThanRetrievalInterval(e){return(new Date).getTime()-e.getTime()>36e5}renewConfig(e,t,i,n){return Yne(this,void 0,void 0,function*(){var r,s,o;try{const a=setTimeout(()=>{this.logService.info("Environment did not respond in time, emitting previous config."),this.failedFetchFallbackSubject.next(n)},800),l=yield this.configApiService.get(t);clearTimeout(a);const c=new Gne(new Kne(l));null!=(null===(r=null==c?void 0:c.environment)||void 0===r?void 0:r.cloudRegion)&&(null===(s=null==e?void 0:e.environment)||void 0===s?void 0:s.cloudRegion)!=c.environment.cloudRegion&&(yield this.environmentService.setCloudRegion(t,null===(o=null==c?void 0:c.environment)||void 0===o?void 0:o.cloudRegion)),null==t?yield this.stateProvider.getGlobal(Jne).update(e=>Object.assign(Object.assign({},e),{[i.getApiUrl()]:c})):yield this.stateProvider.setUserState(Hne,c,t)}catch(e){this.logService.error(`Unable to fetch ServerConfig from ${i.getApiUrl()}`,e),this.failedFetchFallbackSubject.next(n)}})}globalConfigFor$(e){return this.stateProvider.getGlobal(Jne).state$.pipe((0,l.T)(t=>{var i;return null!==(i=null==t?void 0:t[e])&&void 0!==i?i:null}))}userConfigFor$(e){return this.stateProvider.getUser(e,Hne).state$}}var ere=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const tre=new k(B,"masterKey",{deserializer:e=>Dv.fromJSON(e),clearOn:["lock","logout"]}),ire=new k(V,"masterKeyHash",{deserializer:e=>e,clearOn:["logout"]}),nre=new k(V,"masterKeyEncryptedUserKey",{deserializer:e=>e,clearOn:["logout"]}),rre=new k(V,"forceSetPasswordReason",{deserializer:e=>e,clearOn:["logout"]}),sre=new k(j,"masterPasswordUnlockKey",{deserializer:e=>gS.fromJSON(e),clearOn:["logout"]});class ore{}const are=new k(je,"pinProtectedUserKeyEnvelopePersistent",{deserializer:e=>e,clearOn:["logout"]}),lre=new k(Ge,"pinProtectedUserKeyEnvelopeEphemeral",{deserializer:e=>e,clearOn:["logout"]}),cre=new k(je,"userKeyEncryptedPin",{deserializer:e=>e,clearOn:["logout"]});var ure=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var dre=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function hre(e,t){return dre(this,void 0,void 0,function*(){const i=yield(0,bo._)(e);if(null==i)throw new Error(`Failed to get ${t}`);return i})}var pre=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})},vre=function(e,t,i){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var n,r;if(i){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],i&&(r=n)}if("function"!=typeof n)throw new TypeError("Object not disposable.");r&&(n=function(){try{r.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:n,async:i})}else i&&e.stack.push({async:!0});return t},fre=function(e){return function(t){function i(i){t.error=t.hasError?new e(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var n,r=0;return function e(){for(;n=t.stack.pop();)try{if(!n.async&&1===r)return r=0,t.stack.push(n),Promise.resolve().then(e);if(n.dispose){var s=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(s).then(e,function(t){return i(t),e()})}else r|=1}catch(e){i(e)}if(1===r)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,i){var n=new Error(i);return n.name="SuppressedError",n.error=e,n.suppressed=t,n});class mre{}const gre=1e5;var yre=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class bre{}class wre{}class Sre{}class kre{}class Ire{openPopup(){throw new Error("Open Popup unsupported.")}}var Cre=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Tre=m.record(oe,"ipcSessions",{deserializer:e=>e});class Pre{constructor(e){this.stateProvider=e,this.states=this.stateProvider.getGlobal(Tre)}get(e){return(0,bo._)(this.states.state$.pipe((0,l.T)(t=>null==t?void 0:t[Fre(e)])))}save(e,t){return Cre(this,void 0,void 0,function*(){yield this.states.update(i=>Object.assign(Object.assign({},i),{[Fre(e)]:t}))})}remove(e){return Cre(this,void 0,void 0,function*(){yield this.states.update(t=>{const i=Object.assign({},t);return delete i[Fre(e)],i})})}}function Fre(e){return"object"==typeof e&&"Web"in e?`Web(${e.Web.id})`:e}class Rre{}new m(pe,"subUsers",{deserializer:e=>{if(null==e)return{};const t={};for(const[i,n]of Object.entries(e))t[i]=Array.isArray(n)?n:[];return t}});var xre=i(91566),Are=i(63108);const Dre=12e4;class Ere{constructor(e){this.logService=e}redactMessage(e){const t="access_token=",i=e.indexOf(t);return-1!==i?e.substring(0,i+13)+"[REDACTED]":e}log(e,t){const i=`[SignalR] ${this.redactMessage(t)}`;switch(e){case xre.$.Critical:case xre.$.Error:this.logService.error(i);break;case xre.$.Warning:this.logService.warning(i);break;case xre.$.Information:this.logService.info(i);break;case xre.$.Debug:this.logService.debug(i)}}}class $re{constructor(e,t,i,n=()=>new gte.$,r=globalThis){this.apiService=e,this.logService=t,this.platformUtilsService=i,this.hubConnectionBuilderFactory=n,this.timeoutManager=r}connect$(e,t){if(!t.startsWith("https://")&&!this.platformUtilsService.isDev())throw new $te;return new aa.c(i=>{const n=this.hubConnectionBuilderFactory().withUrl(t+"/hub",{accessTokenFactory:()=>this.apiService.getActiveBearerToken(e),skipNegotiation:!0,transport:yte.w.WebSockets}).withHubProtocol(new bte.E).configureLogging(new Ere(this.logService)).build();n.on("ReceiveMessage",e=>{i.next({type:"ReceiveMessage",message:new wte(e)})}),n.on("Heartbeat",()=>{i.next({type:"Heartbeat"})});let r=null;const s=()=>{if(null==n||n.state!==Are.j.Disconnected||null!=r&&!r.closed)return;if(i.closed)return;const e=this.randomReconnectTime(),t=this.timeoutManager.setTimeout(()=>{n.start().then(()=>{r=null}).catch(()=>{s()})},e);r=new za.yU(()=>this.timeoutManager.clearTimeout(t))};return n.onclose(e=>{s()}),n.start().catch(()=>{s()}),()=>{null==r||r.unsubscribe(),null==n||n.stop().catch(e=>{this.logService.error("Error while stopping SignalR connection",e)})}})}randomReconnectTime(){return Math.floor(180001*Math.random())+Dre}}var Ore=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Ure=new Set([Ba.AuthRequest,Ba.AutoConfirmMember]);class Mre{}class Nre{static from(e){var t,i;const n=new Nre;return n.endpoint=e.endpoint,n.p256dh=null===(t=e.keys)||void 0===t?void 0:t.p256dh,n.auth=null===(i=e.keys)||void 0===i?void 0:i.auth,n}}var Vre=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Bre{constructor(e,t){this.apiService=e,this.appIdService=t}putSubscription(e,t){return Vre(this,void 0,void 0,function*(){const i=Nre.from(e);yield this.apiService.send("POST",`/devices/identifier/${yield this.appIdService.getAppId()}/web-push-auth`,i,t,!1)})}}var jre=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Gre extends tS{constructor(e){super(e),this.featureStates={},null!=e&&(this.version=this.getResponseProperty("Version"),this.gitHash=this.getResponseProperty("GitHash"),this.server=new _re(this.getResponseProperty("Server")),this.environment=new zre(this.getResponseProperty("Environment")),this.featureStates=this.getResponseProperty("FeatureStates"),this.push=new Lre(this.getResponseProperty("Push")),this.settings=new _ne(this.getResponseProperty("Settings")))}}class Lre extends tS{constructor(e=null){super(e),null!=e&&(this.pushTechnology=this.getResponseProperty("PushTechnology"),this.vapidPublicKey=this.getResponseProperty("VapidPublicKey"))}}class zre extends tS{constructor(e=null){super(e),null!=e&&(this.cloudRegion=this.getResponseProperty("CloudRegion"),this.vault=this.getResponseProperty("Vault"),this.api=this.getResponseProperty("Api"),this.identity=this.getResponseProperty("Identity"),this.notifications=this.getResponseProperty("Notifications"),this.sso=this.getResponseProperty("Sso"))}}class _re extends tS{constructor(e=null){super(e),null!=e&&(this.name=this.getResponseProperty("Name"),this.url=this.getResponseProperty("Url"))}}var Kre=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Xre=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class qre{static fromJSON(e){return Object.assign(new qre,e)}}const Wre=new m(re,"environment",{deserializer:qre.fromJSON}),Yre=new k(re,"environment",{deserializer:qre.fromJSON,clearOn:["logout"]}),Hre=new m(se,"cloudRegion",{deserializer:e=>e}),Jre=new k(se,"cloudRegion",{deserializer:e=>e,clearOn:["logout"]}),Zre=[{key:hk.US,domain:"bitwarden.com",urls:{base:null,api:"https://api.bitwarden.com",identity:"https://identity.bitwarden.com",icons:"https://icons.bitwarden.net",webVault:"https://vault.bitwarden.com",notifications:"https://notifications.bitwarden.com",events:"https://events.bitwarden.com",scim:"https://scim.bitwarden.com"}},{key:hk.EU,domain:"bitwarden.eu",urls:{base:null,api:"https://api.bitwarden.eu",identity:"https://identity.bitwarden.eu",icons:"https://icons.bitwarden.eu",webVault:"https://vault.bitwarden.eu",notifications:"https://notifications.bitwarden.eu",events:"https://events.bitwarden.eu",scim:"https://scim.bitwarden.eu"}}],Qre=hk.US,ese=Zre.find(e=>e.key===Qre);class tse{constructor(e,t,i=[]){this.stateProvider=e,this.accountService=t,this.additionalRegionConfigs=i,this.activeAccountId$=this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)),this.globalState=this.stateProvider.getGlobal(Wre),this.globalCloudRegionState=this.stateProvider.getGlobal(Hre);const n=this.activeAccountId$.pipe((0,mo.F)((e,t)=>e==t));this.globalEnvironment$=this.stateProvider.getGlobal(Wre).state$.pipe((0,l.T)(e=>this.buildEnvironment(null==e?void 0:e.region,null==e?void 0:e.urls))),this.environment$=n.pipe((0,go.n)(e=>e?this.stateProvider.getUser(e,Yre).state$:this.stateProvider.getGlobal(Wre).state$),(0,l.T)(e=>this.buildEnvironment(null==e?void 0:e.region,null==e?void 0:e.urls))),this.cloudWebVaultUrl$=n.pipe((0,go.n)(e=>e?this.stateProvider.getUser(e,Jre).state$:this.stateProvider.getGlobal(Hre).state$),(0,l.T)(e=>{if(null!=e){const t=this.getRegionConfig(e);if(null!=t)return t.urls.webVault}return ese.urls.webVault}))}availableRegions(){return Zre.concat(this.additionalRegionConfigs)}getRegionConfig(e){return this.availableRegions().find(t=>t.key===e)}setEnvironment(e,t){return Xre(this,void 0,void 0,function*(){return null==this.getRegionConfig(e)&&(e=hk.SelfHosted),e==hk.SelfHosted&&nse(t)&&(e=Qre),e!=hk.SelfHosted?(yield this.globalState.update(()=>({region:e,urls:null})),null):(t.base=ise(t.base),t.webVault=ise(t.webVault),t.api=ise(t.api),t.identity=ise(t.identity),t.icons=ise(t.icons),t.notifications=ise(t.notifications),t.events=ise(t.events),t.keyConnector=ise(t.keyConnector),t.scim=null,yield this.globalState.update(()=>({region:e,urls:{base:t.base,api:t.api,identity:t.identity,webVault:t.webVault,icons:t.icons,notifications:t.notifications,events:t.events,keyConnector:t.keyConnector}})),t)})}buildEnvironment(e,t){if(null==this.getRegionConfig(e)&&(e=hk.SelfHosted),e==hk.SelfHosted&&nse(t)&&(e=Qre),e!=hk.SelfHosted){const t=this.getRegionConfig(e);if(null!=t)return new sse(t)}return new ose(t)}setCloudRegion(e,t){return Xre(this,void 0,void 0,function*(){null==e?yield this.globalCloudRegionState.update(()=>t):yield this.stateProvider.getUser(e,Jre).update(()=>t)})}getEnvironment$(e){return this.stateProvider.getUser(e,Yre).state$.pipe((0,l.T)(e=>this.buildEnvironment(null==e?void 0:e.region,null==e?void 0:e.urls)))}getEnvironment(e){return Xre(this,void 0,void 0,function*(){const t=null!=e?e:yield(0,bo._)(this.activeAccountId$);return(0,bo._)(this.getEnvironment$(t))})}seedUserEnvironment(e){return Xre(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.globalState.state$);yield this.stateProvider.getUser(e,Yre).update(()=>t)})}}function ise(e){return null==e||""===e?null:((e=e.replace(/\/+$/g,"")).startsWith("http://")||e.startsWith("https://")||(e="https://"+e),e.trim())}function nse(e){return null==e||null==e.base&&null==e.webVault&&null==e.api&&null==e.identity&&null==e.icons&&null==e.notifications&&null==e.events}class rse{constructor(e,t){this.region=e,this.urls=t,e==hk.SelfHosted&&(this.urls.scim=null)}getRegion(){return this.region}getUrls(){return{base:this.urls.base,webVault:this.urls.webVault,api:this.urls.api,identity:this.urls.identity,icons:this.urls.icons,notifications:this.urls.notifications,events:this.urls.events,keyConnector:this.urls.keyConnector,scim:this.urls.scim}}hasBaseUrl(){return null!=this.urls.base}getWebVaultUrl(){return this.getUrl("webVault","")}getApiUrl(){return this.getUrl("api","/api")}getEventsUrl(){return this.getUrl("events","/events")}getIconsUrl(){return this.getUrl("icons","/icons")}getIdentityUrl(){return this.getUrl("identity","/identity")}getKeyConnectorUrl(){return this.urls.keyConnector}getNotificationsUrl(){return this.getUrl("notifications","/notifications")}getScimUrl(){return null!=this.urls.scim?this.urls.scim+"/v2":"https://vault.bitwarden.com"===this.getWebVaultUrl()?"https://scim.bitwarden.com/v2":this.getWebVaultUrl()+"/scim/v2"}getSendUrl(){return"https://vault.bitwarden.com"===this.getWebVaultUrl()?"https://send.bitwarden.com/#":this.getWebVaultUrl()+"/#/send/"}isCloud(){return this.region!==hk.SelfHosted}getUrl(e,t){return null!=this.urls[e]?this.urls[e]:this.urls.base?this.urls.base+t:ese.urls[e]}}class sse extends rse{constructor(e){super(e.key,e.urls),this.config=e}getHostname(){return this.config.domain}}class ose extends rse{constructor(e){super(hk.SelfHosted,e)}getHostname(){return bd.getHost(this.getWebVaultUrl())}}var ase=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class lse{constructor(e,t){this.logService=e,this.apiService=t}upload(e,t,i){return ase(this,void 0,void 0,function*(){return t.buffer.byteLength<=268435456?yield this.azureUploadBlob(e,t):yield this.azureUploadBlocks(e,t,i)})}azureUploadBlob(e,t){return ase(this,void 0,void 0,function*(){const i=bd.getUrl(e),n=new Headers({"x-ms-date":(new Date).toUTCString(),"x-ms-version":i.searchParams.get("sv"),"Content-Length":t.buffer.byteLength.toString(),"x-ms-blob-type":"BlockBlob"}),r=new Request(e,{body:t.buffer,cache:"no-store",method:"PUT",headers:n}),s=yield this.apiService.nativeFetch(r);if(201!==s.status)throw new Error(`Failed to create Azure blob: ${s.status}`)})}azureUploadBlocks(e,t,i){return ase(this,void 0,void 0,function*(){const n=bd.getUrl(e),r=this.getMaxBlockSize(n.searchParams.get("sv"));let s=0;const o=Math.ceil(t.buffer.byteLength/r),a=[];if(o>5e4)throw new Error("Cannot upload file, exceeds maximum size of "+5e4*r);try{for(;s<o;){e=yield this.renewUrlIfNecessary(e,i);const n=bd.getUrl(e),o=this.encodedBlockId(s);n.searchParams.append("comp","block"),n.searchParams.append("blockid",o);const l=s*r,c=t.buffer.slice(l,l+r),u=new Headers({"x-ms-date":(new Date).toUTCString(),"x-ms-version":n.searchParams.get("sv"),"Content-Length":c.byteLength.toString()}),d=new Request(n.toString(),{body:c,cache:"no-store",method:"PUT",headers:u}),h=yield this.apiService.nativeFetch(d);if(201!==h.status){const e=`Unsuccessful block PUT. Received status ${h.status}`;throw this.logService.error(e+"\n"+(yield h.json())),new Error(e)}a.push(o),s++}e=yield this.renewUrlIfNecessary(e,i);const n=bd.getUrl(e),l=this.blockListXml(a);n.searchParams.append("comp","blocklist");const c=new Headers({"x-ms-date":(new Date).toUTCString(),"x-ms-version":n.searchParams.get("sv"),"Content-Length":l.length.toString()}),u=new Request(n.toString(),{body:l,cache:"no-store",method:"PUT",headers:c}),d=yield this.apiService.nativeFetch(u);if(201!==d.status){const e=`Unsuccessful block list PUT. Received status ${d.status}`;throw this.logService.error(e+"\n"+(yield d.json())),new Error(e)}}catch(e){throw e}})}renewUrlIfNecessary(e,t){return ase(this,void 0,void 0,function*(){var i;const n=bd.getUrl(e),r=new Date(null!==(i=n.searchParams.get("se"))&&void 0!==i?i:"");return isNaN(r.getTime())&&r.setTime(Date.now()+36e5),r.getTime()<Date.now()+1e3?yield t():e})}encodedBlockId(e){const t=("000000000000000000000000000000000000000000000000"+e.toString()).slice(-48);return bd.fromUtf8ToB64(t)}blockListXml(e){let t='<?xml version="1.0" encoding="utf-8"?><BlockList>';return e.forEach(e=>{t+=`<Latest>${e}</Latest>`}),t+="</BlockList>",t}getMaxBlockSize(e){return cse.compare(e,"2019-12-12")>=0?4194304e3:cse.compare(e,"2016-05-31")>=0?104857600:4194304}}class cse{static compare(e,t){return"string"==typeof e&&(e=new cse(e)),"string"==typeof t&&(t=new cse(t)),e.year!==t.year?e.year-t.year:e.month!==t.month?e.month-t.month:e.day!==t.day?e.day-t.day:0}constructor(e){this.year=0,this.month=0,this.day=0;try{const t=e.split("-").map(e=>Number.parseInt(e,10));this.year=t[0],this.month=t[1],this.day=t[2]}catch(e){}}compare(e){return cse.compare(this,e)}}var use=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class dse{upload(e,t,i){return use(this,void 0,void 0,function*(){const n=new FormData;if(bd.isBrowser){const i=new Blob([t.buffer],{type:"application/octet-stream"});n.append("data",i,e)}else{if(!bd.isNode)throw new Error("Unsupported environment");n.append("data",Buffer.from(t.buffer),{filename:e,contentType:"application/octet-stream"})}yield i(n)})}}var hse=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class pse{build(){var e;return null!==(e=this.migrationBuilderCache)&&void 0!==e?e:this.migrationBuilderCache=We.create().with(ao).with(Wi,3,4).with(Ln,4,5).with(Fr,5,6).with(As,6,7).with(no,7,8).with(so,8,9).with(et,9,10).with(nt,10,11).with(lt,11,12).with(dt,12,13).with(vt,13,14).with(gt,14,15).with(wt,15,16).with(It,16,17).with(Pt,17,18).with(xt,18,19).with(Et,19,20).with(Ut,20,21).with(Vt,21,22).with(Lt,22,23).with(Kt,23,24).with(Wt,24,25).with(Jt,25,26).with(ei,26,27).with(ni,27,28).with(si,28,29).with(ci,29,30).with(hi,30,31).with(fi,31,32).with(Si,32,33).with(Pi,33,34).with(xi,34,35).with(Ei,35,36).with(Ui,36,37).with(zi,37,38).with(Xi,38,39).with(tn,39,40).with(sn,40,41).with(ln,41,42).with(dn,42,43).with(vn,43,44).with(wn,44,45).with(In,45,46).with(On,46,47).with(Nn,47,48).with(jn,48,49).with(Xn,49,50).with(Yn,50,51).with(Jn,51,52).with(tr,52,53).with(sr,53,54).with(ur,54,55).with(vr,55,56).with(yr,56,57).with(Sr,57,58).with(Tr,58,59).with(Er,59,60).with(Vr,60,61).with(Xr,61,62).with(Jr,62,63).with(es,63,64).with(hs,64,65).with(ys,65,66).with(Ss,66,67).with(Cs,67,68).with(Rs,68,69).with($s,69,70).with(Ms,70,71).with(Bs,71,72).with(Ks,72,73).with(Ws,73,74).with(to,74,75)}}var vse=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class fse{constructor(e,t,i,n){this.diskStorage=e,this.logService=t,this.migrationBuilderService=i,this.clientType=n}run(){return vse(this,void 0,void 0,function*(){const e=new po(yield uo(this.diskStorage,this.logService),this.diskStorage,this.logService,"general",this.clientType);if(e.currentVersion<0)return void(yield this.diskStorage.save("stateVersion",75));const t=this.migrationBuilderService.build();yield t.migrate(e)})}waitForCompletion(){return vse(this,void 0,void 0,function*(){yield function(e,t){return lo(this,void 0,void 0,function*(){const i=()=>lo(this,void 0,void 0,function*(){return(yield uo(e,t))>=75}),n=e=>lo(this,void 0,void 0,function*(){const r=2*e;if(!(r>8192))return new Promise(s=>{setTimeout(()=>lo(this,void 0,void 0,function*(){(yield i())||(t.info(`Waiting for migrations to finish, waiting for ${r}ms`),yield n(r)),s()}),e)})});(yield i())||(yield n(2))})}(this.diskStorage,this.logService)})}}var mse=i(50572);class gse{constructor(e){this.markedForDisposal=!1,this.refCount=0,this.value=e}take(){if(this.markedForDisposal)throw new Error("Cannot take a reference to a value marked for disposal");return this.refCount++,new yse(()=>this.release(),this.value)}markForDisposal(){this.markedForDisposal=!0,this.freeIfPossible()}release(){this.refCount--,this.freeIfPossible()}freeIfPossible(){0===this.refCount&&this.markedForDisposal&&this.value.free()}}class yse{constructor(e,t){this.release=e,this.value=t}[Symbol.dispose](){this.release()}}const bse=k.record(Re,"ciphers",{deserializer:e=>uN.fromJSON(e),clearOn:["logout"]}),wse=k.record(Ae,"decryptedCiphers",{deserializer:e=>RO.fromJSON(e),clearOn:["logout","lock"]}),Sse=k.array(Ae,"failedDecryptedCiphers",{deserializer:e=>RO.fromJSON(e),clearOn:["logout","lock"]}),kse=new k(xe,"localData",{deserializer:e=>e,clearOn:["logout"]}),Ise=new k(Ae,"addEditCipherInfo",{deserializer:e=>{if(null==e)return null;return{cipher:null!=(null==e?void 0:e.cipher.toJSON)?e.cipher:RO.fromJSON(null==e?void 0:e.cipher),collectionIds:e.collectionIds}},clearOn:["logout","lock"]});class Cse{userKeyDefinition(){return bse}toSdk(e){return new AN(e).toSdkCipher()}fromSdk(e){return AN.fromSdkCipher(e).toCipherData()}}var Tse=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};function Pse(e,t,i){return Tse(this,void 0,void 0,function*(){yield t.register_cipher_repository(new Fse(e,i,new Cse))})}class Fse{constructor(e,t,i){this.userId=e,this.stateProvider=t,this.mapper=i}get(e){return Tse(this,void 0,void 0,function*(){const t=this.stateProvider.getUser(this.userId,this.mapper.userKeyDefinition()),i=(yield(0,bo._)(t.state$.pipe((0,l.T)(e=>null!=e?e:{}))))[e];return i?this.mapper.toSdk(i):null})}list(){return Tse(this,void 0,void 0,function*(){const e=this.stateProvider.getUser(this.userId,this.mapper.userKeyDefinition()),t=yield(0,bo._)(e.state$.pipe((0,l.T)(e=>null!=e?e:{})));return Object.values(t).map(e=>this.mapper.toSdk(e))})}set(e,t){return Tse(this,void 0,void 0,function*(){const i=this.stateProvider.getUser(this.userId,this.mapper.userKeyDefinition()),n=yield(0,bo._)(i.state$.pipe((0,l.T)(e=>null!=e?e:{})));n[e]=this.mapper.fromSdk(t),yield i.update(()=>n)})}remove(e){return Tse(this,void 0,void 0,function*(){const t=this.stateProvider.getUser(this.userId,this.mapper.userKeyDefinition()),i=yield(0,bo._)(t.state$.pipe((0,l.T)(e=>null!=e?e:{})));i[e]&&(delete i[e],yield t.update(()=>i))})}}var Rse=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const xse=Symbol("UnsetClient");class Ase{constructor(e,t){this.apiService=e,this.userId=t}get_access_token(){return Rse(this,void 0,void 0,function*(){if(null!=this.userId)return yield this.apiService.getActiveBearerToken(this.userId)})}}var Dse=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Ese=Symbol("UnsetClient");class $se{constructor(e,t){this.apiService=e,this.userId=t}get_access_token(){return Dse(this,void 0,void 0,function*(){if(null!=this.userId)return yield this.apiService.getActiveBearerToken(this.userId)})}}var Ose=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Use{constructor(e){this.keyService=e}setUserKeyInMemoryIfAutoUserKeySet(e){return Ose(this,void 0,void 0,function*(){if(null==e)return!1;const t=yield this.keyService.getUserKeyFromStorage(wp.Auto,e);return null!=t&&(yield this.keyService.setUserKey(t,e),!0)})}}class Mse{constructor(e){this.id=e.id,this.name=e.name,this.status=e.status,this.type=e.type,this.enabled=e.enabled,this.userId=e.userId,this.useEvents=e.useEvents,this.providerStatus=e.providerStatus,this.providerType=e.providerType}}class Nse{constructor(e){null!=e&&(this.id=e.id,this.fileName=e.fileName,this.size=e.size,this.sizeName=e.sizeName)}}class Vse{constructor(e){null!=e&&(this.text=e.text,this.hidden=e.hidden)}}class Bse{constructor(e){if(null!=e)switch(this.id=e.id,this.accessId=e.accessId,this.type=e.type,this.authType=e.authType,this.name=e.name,this.notes=e.notes,this.key=e.key,this.maxAccessCount=e.maxAccessCount,this.accessCount=e.accessCount,this.revisionDate=e.revisionDate,this.expirationDate=e.expirationDate,this.deletionDate=e.deletionDate,this.password=e.password,this.emails=e.emails,this.disabled=e.disable,this.hideEmail=e.hideEmail,this.authType=e.authType,this.type){case u0.Text:this.text=new Vse(e.text);break;case u0.File:this.file=new Nse(e.file)}}}class jse{constructor(e){var t,i,n;this.name=null!==(t=e.name)&&void 0!==t?t:"",this.id=null!==(i=e.id)&&void 0!==i?i:"",this.revisionDate=null!==(n=e.revisionDate)&&void 0!==n?n:(new Date).toISOString()}static fromJSON(e){return null==e?null:new jse({id:e.id,name:e.name,revisionDate:e.revisionDate})}}var Gse=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Lse=new k(le,"lastSync",{deserializer:e=>null!=e?new Date(e):null,clearOn:["logout"]});class zse{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h){this.tokenService=e,this.folderService=t,this.folderApiService=i,this.messageSender=n,this.logService=r,this.cipherService=s,this.collectionService=o,this.apiService=a,this.accountService=l,this.authService=c,this.sendService=u,this.sendApiService=d,this.stateProvider=h,this.syncInProgress=!1}getLastSync(){return Gse(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)));return null==e?null:yield(0,bo._)(this.lastSync$(e))})}lastSync$(e){return this.stateProvider.getUser(e,Lse).state$}activeUserLastSync$(){return this.accountService.activeAccount$.pipe((0,go.n)(e=>null==e?(0,Go.of)(null):this.lastSync$(e.id)))}setLastSync(e,t){return Gse(this,void 0,void 0,function*(){yield this.stateProvider.getUser(t,Lse).update(()=>e)})}syncUpsertFolder(e,t,i){return Gse(this,void 0,void 0,function*(){this.syncStarted();if((yield(0,bo._)(this.authService.authStatusFor$(i)))>=Pd.Locked)try{const n=yield this.folderService.get(e.id,i);if(!t&&null==n||t&&null!=n&&n.revisionDate<e.revisionDate){const t=yield this.folderApiService.get(e.id);if(null!=t)return yield this.folderService.upsert(new jse(t),i),this.messageSender.send("syncedUpsertedFolder",{folderId:e.id}),this.syncCompleted(!0,i)}}catch(e){this.logService.error(e)}return this.syncCompleted(!1,i)})}syncDeleteFolder(e,t){return Gse(this,void 0,void 0,function*(){this.syncStarted();return(yield(0,bo._)(this.authService.authStatusFor$(t)))>=Pd.Locked?(yield this.folderService.delete(e.id,t),this.messageSender.send("syncedDeletedFolder",{folderId:e.id}),this.syncCompleted(!0,t),!0):this.syncCompleted(!1,t)})}syncUpsertCipher(e,t,i){return Gse(this,void 0,void 0,function*(){this.syncStarted();if((yield(0,bo._)(this.authService.authStatusFor$(i)))>=Pd.Locked)try{let n=!0;const r=yield this.cipherService.get(e.id,i);null!=r&&r.revisionDate>=e.revisionDate&&(n=!1);let s=!1;if(n&&(t?(n=null!=r,s=!0):null==e.collectionIds||null==e.organizationId?n=null==r:(n=!1,s=!0)),!n&&s&&null!=e.organizationId&&null!=e.collectionIds&&e.collectionIds.length>0){const t=yield(0,bo._)(this.collectionService.encryptedCollections$(i).pipe((0,l.T)(e=>null!=e?e:[])));if(null!=t)for(let i=0;i<t.length;i++)if(e.collectionIds.indexOf(t[i].id)>-1){n=!0;break}}if(n){const t=yield this.apiService.getFullCipherDetails(e.id);if(null!=t)return yield this.cipherService.upsert(new uN(t)),this.messageSender.send("syncedUpsertedCipher",{cipherId:e.id}),this.syncCompleted(!0,i)}}catch(n){if(null!=n&&404===n.statusCode&&t)return yield this.cipherService.delete(e.id,i),this.messageSender.send("syncedDeletedCipher",{cipherId:e.id}),this.syncCompleted(!0,i)}return this.syncCompleted(!1,i)})}syncDeleteCipher(e,t){return Gse(this,void 0,void 0,function*(){this.syncStarted();return(yield(0,bo._)(this.authService.authStatusFor$(t)))>=Pd.Locked?(yield this.cipherService.delete(e.id,t),this.messageSender.send("syncedDeletedCipher",{cipherId:e.id}),this.syncCompleted(!0,t)):this.syncCompleted(!1,t)})}syncUpsertSend(e,t){return Gse(this,void 0,void 0,function*(){this.syncStarted();const[i,n]=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,go.n)(e=>(null==e&&(0,Go.of)([null,Pd.LoggedOut]),this.authService.authStatusFor$(e.id).pipe((0,l.T)(t=>[e.id,t]))))));if(i===e.userId&&n!==Pd.LoggedOut)try{const n=yield(0,bo._)(this.sendService.get$(e.id));if(!t&&null==n||t&&null!=n&&n.revisionDate<e.revisionDate){const t=yield this.sendApiService.getSend(e.id);if(null!=t)return yield this.sendService.upsert(new Bse(t)),this.messageSender.send("syncedUpsertedSend",{sendId:e.id}),this.syncCompleted(!0,i)}}catch(e){this.logService.error(e)}return this.syncCompleted(!1,void 0)})}syncDeleteSend(e){return Gse(this,void 0,void 0,function*(){this.syncStarted();const t=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)));return null!=t&&(yield(0,bo._)(this.tokenService.hasAccessToken$(t)))?(yield this.sendService.delete(e.id),this.messageSender.send("syncedDeletedSend",{sendId:e.id}),this.syncCompleted(!0,void 0),!0):this.syncCompleted(!1,void 0)})}syncStarted(){this.syncInProgress=!0,this.messageSender.send("syncStarted")}syncCompleted(e,t){return this.syncInProgress=!1,this.messageSender.send("syncCompleted",{successfully:e,userId:t}),e}}var _se=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Kse=Object.freeze({FirstOptionalButton:0,SecondOptionalButton:1,NotificationButton:2});class Xse{}var qse=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Wse{constructor(){this.notificationClicked$=(0,So.$)(()=>new Error("Notification clicked is not supported."))}create(e){return qse(this,void 0,void 0,function*(){throw new Error("Create OS Notification unsupported.")})}clear(e){throw new Error("Clear OS Notification unsupported.")}isSupported(){return!1}}class Yse{constructor(e){this.ids=null==e?[]:e}}class Hse extends tS{constructor(e,t){super(e),this.id=this.getResponseProperty("Id"),this.type=this.getResponseProperty("Type"),this.organizationId=this.getResponseProperty("OrganizationId"),this.enabled=this.getResponseProperty("Enabled");const i=this.getResponseProperty("Config");this.config=null==i?null:new t(i)}}class Jse extends tS{constructor(e){super(e);const t=this.getResponseProperty("LastSyncDate");t&&(this.lastSyncDate=new Date(t))}}class Zse extends tS{constructor(e){super(e),this.isTokenValid=this.getResponseProperty("IsTokenValid"),this.isFreeFamilyPolicyEnabled=this.getResponseProperty("IsFreeFamilyPolicyEnabled")}}class Qse extends KR{}class eoe extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.error=this.getResponseProperty("Error")}}class toe extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.userId=this.getResponseProperty("UserId"),this.type=this.getResponseProperty("Type"),this.status=this.getResponseProperty("Status"),this.permissions=new BR(this.getResponseProperty("Permissions"))}}class ioe extends toe{constructor(e){super(e),this.name=this.getResponseProperty("Name"),this.email=this.getResponseProperty("Email")}}class noe extends tS{constructor(e){super(e),this.key=this.getResponseProperty("Key")}}class roe extends tS{constructor(e){super(e),this.kdf=this.getResponseProperty("Kdf"),this.kdfIterations=this.getResponseProperty("KdfIterations"),this.kdfMemory=this.getResponseProperty("KdfMemory"),this.kdfParallelism=this.getResponseProperty("KdfParallelism")}}class soe extends tS{constructor(e){super(e),this.token=this.getResponseProperty("Token")}}class ooe extends tS{constructor(e){super(e),this.type=this.getResponseProperty("Type"),this.userId=this.getResponseProperty("UserId"),this.organizationId=this.getResponseProperty("OrganizationId"),this.providerId=this.getResponseProperty("ProviderId"),this.cipherId=this.getResponseProperty("CipherId"),this.collectionId=this.getResponseProperty("CollectionId"),this.groupId=this.getResponseProperty("GroupId"),this.policyId=this.getResponseProperty("PolicyId"),this.organizationUserId=this.getResponseProperty("OrganizationUserId"),this.providerUserId=this.getResponseProperty("ProviderUserId"),this.providerOrganizationId=this.getResponseProperty("ProviderOrganizationId"),this.actingUserId=this.getResponseProperty("ActingUserId"),this.date=this.getResponseProperty("Date"),this.deviceType=this.getResponseProperty("DeviceType"),this.ipAddress=this.getResponseProperty("IpAddress"),this.installationId=this.getResponseProperty("InstallationId"),this.systemUser=this.getResponseProperty("SystemUser"),this.domainName=this.getResponseProperty("DomainName"),this.secretId=this.getResponseProperty("SecretId"),this.projectId=this.getResponseProperty("ProjectId"),this.serviceAccountId=this.getResponseProperty("ServiceAccountId"),this.grantedServiceAccountId=this.getResponseProperty("GrantedServiceAccountId")}}class aoe extends tS{constructor(e){super(e),this.userId=this.getResponseProperty("UserId"),this.publicKey=this.getResponseProperty("PublicKey")}}class loe extends tS{constructor(e){super(e),this.url=null,this.attachmentId=this.getResponseProperty("AttachmentId"),this.fileUploadType=this.getResponseProperty("FileUploadType");const t=this.getResponseProperty("CipherResponse"),i=this.getResponseProperty("CipherMiniResponse");this.cipherResponse=null==t?null:new mA(t),this.cipherMiniResponse=null==i?null:new mA(i),this.url=this.getResponseProperty("Url")}}class coe extends tS{constructor(e){super(e),this.cipher=new mA(this.getResponseProperty("Cipher"))}}class uoe extends tS{constructor(e){super(e),this.unavailable=this.getResponseProperty("Unavailable"),this.cipher=new mA(this.getResponseProperty("Cipher"))}}var doe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class hoe{constructor(e,t,i,n,r,s,o,a,l,c,u=null){this.tokenService=e,this.platformUtilsService=t,this.environmentService=i,this.appIdService=n,this.refreshAccessTokenErrorCallback=r,this.logService=s,this.logoutCallback=o,this.vaultTimeoutSettingsService=a,this.accountService=l,this.httpOperations=c,this.customUserAgent=u,this.refreshTokenPromise={},this.device=t.getDevice(),this.deviceType=this.device.toString()}postIdentityToken(e){return doe(this,void 0,void 0,function*(){var t;const i=new Headers({"Content-Type":"application/x-www-form-urlencoded; charset=utf-8",Accept:"application/json","Device-Type":this.deviceType});null!=this.customUserAgent&&i.set("User-Agent",this.customUserAgent);const n=e instanceof VS?e.toIdentityToken():e.toIdentityToken(this.platformUtilsService.getClientType()),r=yield(0,bo._)(this.environmentService.environment$),s=yield this.fetch(this.httpOperations.createRequest(r.getIdentityUrl()+"/connect/token",{body:this.qsStringify(n),credentials:yield this.getCredentials(r),cache:"no-store",headers:i,method:"POST"}));let o=null;if(this.isJsonResponse(s)&&(o=yield s.json()),null!=o){if(200===s.status)return new CS(o);if(400===s.status&&o.TwoFactorProviders2&&Object.keys(o.TwoFactorProviders2).length)return new TS(o);if(400===s.status&&(null===(t=null==o?void 0:o.ErrorModel)||void 0===t?void 0:t.Message)===hoe.NEW_DEVICE_VERIFICATION_REQUIRED_MESSAGE)return new cS(o);if(400===s.status&&(null==o?void 0:o.SsoOrganizationIdentifier))return new uS(o)}return Promise.reject(new iS(o,s.status,!0))})}refreshIdentityToken(){return doe(this,arguments,void 0,function*(e=null){const t=null!=e?e:e=yield this.getActiveUser();if(null==t)throw new Error("No user provided and no active user, cannot refresh the identity token.");try{yield this.refreshToken(t)}catch(e){throw this.logService.error("Error refreshing access token: ",e),e}})}getAuthRequest(e){return doe(this,void 0,void 0,function*(){const t=`/auth-requests/${e}`,i=yield this.send("GET",t,null,!0,!0);return new ik(i)})}putAuthRequest(e,t){return doe(this,void 0,void 0,function*(){const i=`/auth-requests/${e}`,n=yield this.send("PUT",i,t,!0,!0);return new ik(n)})}getAuthRequests(){return doe(this,void 0,void 0,function*(){const e=yield this.send("GET","/auth-requests/",null,!0,!0);return new sk(e,ik)})}getLastAuthRequest(){return doe(this,void 0,void 0,function*(){const e=(yield this.getAuthRequests()).data.filter(e=>!e.isAnswered&&!e.isExpired);return e.sort((e,t)=>e.creationDate.localeCompare(t.creationDate))[e.length-1]})}getProfile(){return doe(this,void 0,void 0,function*(){const e=yield this.send("GET","/accounts/profile",null,!0,!0);return new tA(e)})}getUserSubscription(){return doe(this,void 0,void 0,function*(){const e=yield this.send("GET","/accounts/subscription",null,!0,!0);return new Oee(e)})}putProfile(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("PUT","/accounts/profile",e,!0,!0);return new tA(t)})}putAvatar(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("PUT","/accounts/avatar",e,!0,!0);return new tA(t)})}postPrelogin(e){return doe(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.environmentService.environment$),i=yield this.send("POST","/accounts/prelogin",e,!1,!0,t.getIdentityUrl());return new roe(i)})}postEmailToken(e){return this.send("POST","/accounts/email-token",e,!0,!1)}postEmail(e){return this.send("POST","/accounts/email",e,!0,!1)}postSetKeyConnectorKey(e){return this.send("POST","/accounts/set-key-connector-key",e,!0,!1)}postSecurityStamp(e){return this.send("POST","/accounts/security-stamp",e,!0,!1)}getAccountRevisionDate(){return doe(this,void 0,void 0,function*(){return yield this.send("GET","/accounts/revision-date",null,!0,!0)})}postPasswordHint(e){return this.send("POST","/accounts/password-hint",e,!1,!1)}postPremium(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("POST","/accounts/premium",e,!0,!0);return new jee(t)})}postReinstatePremium(){return this.send("POST","/accounts/reinstate-premium",null,!0,!1)}postAccountStorage(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("POST","/accounts/storage",e,!0,!0);return new jee(t)})}postAccountLicense(e){return this.send("POST","/accounts/license",e,!0,!1)}postAccountKeys(e){return this.send("POST","/accounts/keys",e,!0,!1)}postAccountVerifyEmail(){return this.send("POST","/accounts/verify-email",null,!0,!1)}postAccountVerifyEmailToken(e){return this.send("POST","/accounts/verify-email-token",e,!1,!1)}postAccountRecoverDelete(e){return this.send("POST","/accounts/delete-recover",e,!1,!1)}postAccountRecoverDeleteToken(e){return this.send("POST","/accounts/delete-recover-token",e,!1,!1)}postAccountKdf(e){return this.send("POST","/accounts/kdf",e,!0,!1)}deleteSsoUser(e){return doe(this,void 0,void 0,function*(){return this.send("DELETE","/accounts/sso/"+e,null,!0,!1)})}getSsoUserIdentifier(){return doe(this,void 0,void 0,function*(){return this.send("GET","/accounts/sso/user-identifier",null,!0,!0)})}postUserApiKey(e,t){return doe(this,void 0,void 0,function*(){const e=yield this.send("POST","/accounts/api-key",t,!0,!0);return new See(e)})}postUserRotateApiKey(e,t){return doe(this,void 0,void 0,function*(){const e=yield this.send("POST","/accounts/rotate-api-key",t,!0,!0);return new See(e)})}postConvertToKeyConnector(){return this.send("POST","/accounts/convert-to-key-connector",null,!0,!1)}getUserBillingHistory(){return doe(this,void 0,void 0,function*(){const e=yield this.send("GET","/accounts/billing/history",null,!0,!0);return new xee(e)})}getCipher(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("GET","/ciphers/"+e,null,!0,!0);return new mA(t)})}getFullCipherDetails(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("GET","/ciphers/"+e+"/details",null,!0,!0);return new mA(t)})}getCipherAdmin(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("GET","/ciphers/"+e+"/admin",null,!0,!0);return new mA(t)})}getCiphersOrganization(e,t){return doe(this,void 0,void 0,function*(){let i="/ciphers/organization-details?organizationId="+e;t&&(i+=`&includeMemberItems=${t}`);const n=yield this.send("GET",i,null,!0,!0);return new sk(n,mA)})}postCipher(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("POST","/ciphers",e,!0,!0);return new mA(t)})}postCipherCreate(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("POST","/ciphers/create",e,!0,!0);return new mA(t)})}postCipherAdmin(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("POST","/ciphers/admin",e,!0,!0);return new mA(t)})}putCipher(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.send("PUT","/ciphers/"+e,t,!0,!0);return new mA(i)})}putPartialCipher(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.send("PUT","/ciphers/"+e+"/partial",t,!0,!0);return new mA(i)})}putCipherAdmin(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.send("PUT","/ciphers/"+e+"/admin",t,!0,!0);return new mA(i)})}deleteCipher(e){return this.send("DELETE","/ciphers/"+e,null,!0,!1)}deleteCipherAdmin(e){return this.send("DELETE","/ciphers/"+e+"/admin",null,!0,!1)}deleteManyCiphers(e){return this.send("DELETE","/ciphers",e,!0,!1)}deleteManyCiphersAdmin(e){return this.send("DELETE","/ciphers/admin",e,!0,!1)}putMoveCiphers(e){return this.send("PUT","/ciphers/move",e,!0,!1)}putShareCipher(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.send("PUT","/ciphers/"+e+"/share",t,!0,!0);return new mA(i)})}putShareCiphers(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("PUT","/ciphers/share",e,!0,!0);return new sk(t,mA)})}putCipherCollections(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.send("PUT","/ciphers/"+e+"/collections_v2",t,!0,!0);return new uoe(i)})}putCipherCollectionsAdmin(e,t){return this.send("PUT","/ciphers/"+e+"/collections-admin",t,!0,!0)}postPurgeCiphers(e,t=null){let i="/ciphers/purge";return null!=t&&(i+="?organizationId="+t),this.send("POST",i,e,!0,!1)}putDeleteCipher(e){return this.send("PUT","/ciphers/"+e+"/delete",null,!0,!1)}putDeleteCipherAdmin(e){return this.send("PUT","/ciphers/"+e+"/delete-admin",null,!0,!1)}putDeleteManyCiphers(e){return this.send("PUT","/ciphers/delete",e,!0,!1)}putDeleteManyCiphersAdmin(e){return this.send("PUT","/ciphers/delete-admin",e,!0,!1)}putRestoreCipher(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("PUT","/ciphers/"+e+"/restore",null,!0,!0);return new mA(t)})}putRestoreCipherAdmin(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("PUT","/ciphers/"+e+"/restore-admin",null,!0,!0);return new mA(t)})}putRestoreManyCiphers(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("PUT","/ciphers/restore",e,!0,!0);return new sk(t,mA)})}putRestoreManyCiphersAdmin(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("PUT","/ciphers/restore-admin",e,!0,!0);return new sk(t,mA)})}getAttachmentData(e,t,i){return doe(this,void 0,void 0,function*(){const n=(null!=i?"/emergency-access/"+i+"/":"/ciphers/")+e+"/attachment/"+t,r=yield this.send("GET",n,null,!0,!0);return new vA(r)})}getAttachmentDataAdmin(e,t){return doe(this,void 0,void 0,function*(){const i="/ciphers/"+e+"/attachment/"+t+"/admin",n=yield this.send("GET",i,null,!0,!0);return new vA(n)})}postCipherAttachment(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.send("POST","/ciphers/"+e+"/attachment/v2",t,!0,!0);return new loe(i)})}deleteCipherAttachment(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.send("DELETE","/ciphers/"+e+"/attachment/"+t,null,!0,!0);return new coe(i)})}deleteCipherAttachmentAdmin(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.send("DELETE","/ciphers/"+e+"/attachment/"+t+"/admin",null,!0,!0);return new coe(i)})}postShareCipherAttachment(e,t,i,n){return this.send("POST","/ciphers/"+e+"/attachment/"+t+"/share?organizationId="+n,i,!0,!1)}renewAttachmentUploadUrl(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.send("GET","/ciphers/"+e+"/attachment/"+t+"/renew",null,!0,!0);return new loe(i)})}postAttachmentFile(e,t,i){return this.send("POST","/ciphers/"+e+"/attachment/"+t,i,!0,!1)}getCollectionAccessDetails(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.send("GET","/organizations/"+e+"/collections/"+t+"/details",null,!0,!0);return new RR(i)})}getUserCollections(){return doe(this,void 0,void 0,function*(){const e=yield this.send("GET","/collections",null,!0,!0);return new sk(e,PR)})}getCollections(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("GET","/organizations/"+e+"/collections",null,!0,!0);return new sk(t,PR)})}getManyCollectionsWithAccessDetails(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("GET","/organizations/"+e+"/collections/details",null,!0,!0);return new sk(t,RR)})}getCollectionUsers(e,t){return doe(this,void 0,void 0,function*(){return(yield this.send("GET","/organizations/"+e+"/collections/"+t+"/users",null,!0,!0)).map(e=>new TR(e))})}postCollection(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.send("POST","/organizations/"+e+"/collections",t,!0,!0);return new RR(i)})}putCollection(e,t,i){return doe(this,void 0,void 0,function*(){const n=yield this.send("PUT","/organizations/"+e+"/collections/"+t,i,!0,!0);return new RR(n)})}deleteCollection(e,t){return this.send("DELETE","/organizations/"+e+"/collections/"+t,null,!0,!1)}deleteManyCollections(e,t){return this.send("DELETE","/organizations/"+e+"/collections",new Yse(t),!0,!1)}getGroupUsers(e,t){return doe(this,void 0,void 0,function*(){return yield this.send("GET","/organizations/"+e+"/groups/"+t+"/users",null,!0,!0)})}deleteGroupUser(e,t,i){return this.send("DELETE","/organizations/"+e+"/groups/"+t+"/user/"+i,null,!0,!1)}getPlans(){return doe(this,void 0,void 0,function*(){const e=yield this.send("GET","/plans",null,!1,!0);return new sk(e,Aee)})}getSettingsDomains(){return doe(this,void 0,void 0,function*(){const e=yield this.send("GET","/settings/domains",null,!0,!0);return new Jx(e)})}putSettingsDomains(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("PUT","/settings/domains",e,!0,!0);return new Jx(t)})}getSync(){return doe(this,void 0,void 0,function*(){const e=this.platformUtilsService.supportsAutofill()?"/sync":"/sync?excludeDomains=true",t=yield this.send("GET",e,null,!0,!0);return new yA(t)})}getCloudCommunicationsEnabled(){return doe(this,void 0,void 0,function*(){return yield this.send("GET","/organizations/connections/enabled",null,!0,!0)})}getOrganizationConnection(e,t,i){return doe(this,void 0,void 0,function*(){const n=yield this.send("GET",`/organizations/connections/${e}/${t}`,null,!0,!0);return new Hse(n,i)})}createOrganizationConnection(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.send("POST","/organizations/connections/",e,!0,!0);return new Hse(i,t)})}updateOrganizationConnection(e,t,i){return doe(this,void 0,void 0,function*(){const n=yield this.send("PUT","/organizations/connections/"+i,e,!0,!0);return new Hse(n,t)})}deleteOrganizationConnection(e){return doe(this,void 0,void 0,function*(){return this.send("DELETE","/organizations/connections/"+e,null,!0,!1)})}getProviderUsers(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("GET","/providers/"+e+"/users",null,!0,!0);return new sk(t,ioe)})}getProviderUser(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.send("GET","/providers/"+e+"/users/"+t,null,!0,!0);return new toe(i)})}postProviderUserInvite(e,t){return this.send("POST","/providers/"+e+"/users/invite",t,!0,!1)}postProviderUserReinvite(e,t){return this.send("POST","/providers/"+e+"/users/"+t+"/reinvite",null,!0,!1)}postManyProviderUserReinvite(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.send("POST","/providers/"+e+"/users/reinvite",t,!0,!0);return new sk(i,eoe)})}postProviderUserBulkConfirm(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.send("POST","/providers/"+e+"/users/confirm",t,!0,!0);return new sk(i,eoe)})}deleteManyProviderUsers(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.send("DELETE","/providers/"+e+"/users",t,!0,!0);return new sk(i,eoe)})}postProviderUserAccept(e,t,i){return this.send("POST","/providers/"+e+"/users/"+t+"/accept",i,!0,!1)}postProviderUserConfirm(e,t,i){return this.send("POST","/providers/"+e+"/users/"+t+"/confirm",i,!0,!1)}postProviderUsersPublicKey(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.send("POST","/providers/"+e+"/users/public-keys",t,!0,!0);return new sk(i,Qse)})}putProviderUser(e,t,i){return this.send("PUT","/providers/"+e+"/users/"+t,i,!0,!1)}deleteProviderUser(e,t){return this.send("DELETE","/providers/"+e+"/users/"+t,null,!0,!1)}getProviderClients(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("GET","/providers/"+e+"/organizations",null,!0,!0);return new sk(t,ite)})}postProviderAddOrganization(e,t){return this.send("POST","/providers/"+e+"/organizations/add",t,!0,!1)}postProviderCreateOrganization(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.send("POST","/providers/"+e+"/organizations",t,!0,!0);return new tte(i)})}deleteProviderOrganization(e,t){return this.send("DELETE","/providers/"+e+"/organizations/"+t,null,!0,!1)}getEvents(e,t,i){return doe(this,void 0,void 0,function*(){const n=yield this.send("GET",this.addEventParameters("/events",e,t,i),null,!0,!0);return new sk(n,ooe)})}getEventsCipher(e,t,i,n){return doe(this,void 0,void 0,function*(){const r=yield this.send("GET",this.addEventParameters("/ciphers/"+e+"/events",t,i,n),null,!0,!0);return new sk(r,ooe)})}getEventsSecret(e,t,i,n,r){return doe(this,void 0,void 0,function*(){const s=yield this.send("GET",this.addEventParameters("/organization/"+e+"/secrets/"+t+"/events",i,n,r),null,!0,!0);return new sk(s,ooe)})}getEventsServiceAccount(e,t,i,n,r){return doe(this,void 0,void 0,function*(){const s=yield this.send("GET",this.addEventParameters("/organization/"+e+"/service-account/"+t+"/events",i,n,r),null,!0,!0);return new sk(s,ooe)})}getEventsProject(e,t,i,n,r){return doe(this,void 0,void 0,function*(){const s=yield this.send("GET",this.addEventParameters("/organization/"+e+"/projects/"+t+"/events",i,n,r),null,!0,!0);return new sk(s,ooe)})}getEventsOrganization(e,t,i,n){return doe(this,void 0,void 0,function*(){const r=yield this.send("GET",this.addEventParameters("/organizations/"+e+"/events",t,i,n),null,!0,!0);return new sk(r,ooe)})}getEventsOrganizationUser(e,t,i,n,r){return doe(this,void 0,void 0,function*(){const s=yield this.send("GET",this.addEventParameters("/organizations/"+e+"/users/"+t+"/events",i,n,r),null,!0,!0);return new sk(s,ooe)})}getEventsProvider(e,t,i,n){return doe(this,void 0,void 0,function*(){const r=yield this.send("GET",this.addEventParameters("/providers/"+e+"/events",t,i,n),null,!0,!0);return new sk(r,ooe)})}getEventsProviderUser(e,t,i,n,r){return doe(this,void 0,void 0,function*(){const s=yield this.send("GET",this.addEventParameters("/providers/"+e+"/users/"+t+"/events",i,n,r),null,!0,!0);return new sk(s,ooe)})}postEventsCollect(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.tokenService.getAccessToken(t),n=new Headers({"Device-Type":this.deviceType,Authorization:"Bearer "+i,"Content-Type":"application/json; charset=utf-8"});null!=this.customUserAgent&&n.set("User-Agent",this.customUserAgent);const r=yield(0,bo._)(null==t?this.environmentService.environment$:this.environmentService.getEnvironment$(t));if(200!==(yield this.fetch(this.httpOperations.createRequest(r.getEventsUrl()+"/collect",{cache:"no-store",credentials:yield this.getCredentials(r),method:"POST",body:JSON.stringify(e),headers:n}))).status)return Promise.reject("Event post failed.")})}getUserPublicKey(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("GET","/users/"+e+"/public-key",null,!0,!0);return new aoe(t)})}postBitPayInvoice(e){return doe(this,void 0,void 0,function*(){return yield this.send("POST","/bitpay-invoice",e,!0,!0)})}postSetupPayment(){return doe(this,void 0,void 0,function*(){return yield this.send("POST","/setup-payment",null,!0,!0)})}getMasterKeyFromKeyConnector(e){return doe(this,void 0,void 0,function*(){const t=yield this.getActiveUser();if(null==t)throw new Error("No active user, cannot get master key from key connector.");const i=yield this.getActiveBearerToken(t),n=yield this.fetch(this.httpOperations.createRequest(e+"/user-keys",{cache:"no-store",method:"GET",headers:new Headers({Accept:"application/json",Authorization:"Bearer "+i})}));if(n.status!==Ma.Ok){const e=yield this.handleApiRequestError(n,!0);return Promise.reject(e)}return new noe(yield n.json())})}postUserKeyToKeyConnector(e,t){return doe(this,void 0,void 0,function*(){const i=yield this.getActiveUser();if(null==i)throw new Error("No active user, cannot post key to key connector.");const n=yield this.getActiveBearerToken(i),r=yield this.fetch(this.httpOperations.createRequest(e+"/user-keys",{cache:"no-store",method:"POST",headers:new Headers({Accept:"application/json",Authorization:"Bearer "+n,"Content-Type":"application/json; charset=utf-8"}),body:JSON.stringify(t)}));if(r.status!==Ma.Ok){const e=yield this.handleApiRequestError(r,!0);return Promise.reject(e)}})}getKeyConnectorAlive(e){return doe(this,void 0,void 0,function*(){const t=yield this.fetch(this.httpOperations.createRequest(e+"/alive",{cache:"no-store",method:"GET",headers:new Headers({Accept:"application/json","Content-Type":"application/json; charset=utf-8"})}));if(t.status!==Ma.Ok){const e=yield this.handleApiRequestError(t,!0);return Promise.reject(e)}})}getActiveBearerToken(e){return doe(this,void 0,void 0,function*(){let t=yield this.tokenService.getAccessToken(e);return(yield this.tokenService.tokenNeedsRefresh(e))&&(t=yield this.refreshToken(e)),t})}fetch(e){return doe(this,void 0,void 0,function*(){if(!e.url.startsWith("https://")&&!this.platformUtilsService.isDev())throw new $te;"GET"===e.method&&(e.headers.set("Cache-Control","no-store"),e.headers.set("Pragma","no-cache")),e.headers.set("Bitwarden-Client-Name",this.platformUtilsService.getClientType()),e.headers.set("Bitwarden-Client-Version",yield this.platformUtilsService.getApplicationVersionNumber());const t=yield this.platformUtilsService.packageType();return null!=t&&e.headers.set("Bitwarden-Package-Type",t),this.nativeFetch(e)})}nativeFetch(e){return fetch(e)}preValidateSso(e){return doe(this,void 0,void 0,function*(){if(null==e||""===e)throw new Error("Organization Identifier was not provided.");const t=new Headers({Accept:"application/json","Device-Type":this.deviceType});null!=this.customUserAgent&&t.set("User-Agent",this.customUserAgent);const i=yield(0,bo._)(this.environmentService.environment$),n=`/sso/prevalidate?domainHint=${encodeURIComponent(e)}`,r=yield this.fetch(this.httpOperations.createRequest(i.getIdentityUrl()+n,{cache:"no-store",credentials:yield this.getCredentials(i),headers:t,method:"GET"}));if(200===r.status){const e=yield r.json();return new soe(e)}{const e=yield this.handleApiRequestError(r,!1);return Promise.reject(e)}})}postCreateSponsorship(e,t){return doe(this,void 0,void 0,function*(){return yield this.send("POST","/organization/sponsorship/"+(this.platformUtilsService.isSelfHost()?"self-hosted/":"")+e+"/families-for-enterprise",t,!0,!1)})}getSponsorshipSyncStatus(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("GET","/organization/sponsorship/"+e+"/sync-status",null,!0,!0);return new Jse(t)})}deleteRemoveSponsorship(e){return doe(this,void 0,void 0,function*(){return yield this.send("DELETE","/organization/sponsorship/sponsored/"+e,null,!0,!1)})}postPreValidateSponsorshipToken(e){return doe(this,void 0,void 0,function*(){const t=yield this.send("POST","/organization/sponsorship/validate-token?sponsorshipToken="+encodeURIComponent(e),null,!0,!0);return new Zse(t)})}postRedeemSponsorship(e,t){return doe(this,void 0,void 0,function*(){return yield this.send("POST","/organization/sponsorship/redeem?sponsorshipToken="+encodeURIComponent(e),t,!0,!1)})}refreshToken(e){return void 0===this.refreshTokenPromise[e]&&(this.refreshTokenPromise[e]=this.internalRefreshToken(e),this.refreshTokenPromise[e].finally(()=>{delete this.refreshTokenPromise[e]})),this.refreshTokenPromise[e]}internalRefreshToken(e){return doe(this,void 0,void 0,function*(){const t=yield this.tokenService.getRefreshToken(e);if(null!=t&&""!==t)return yield this.refreshAccessToken(e);const i=yield this.tokenService.getClientId(e),n=yield this.tokenService.getClientSecret(e);if(!bd.isNullOrWhitespace(i)&&!bd.isNullOrWhitespace(n))return yield this.refreshApiToken(e);throw this.refreshAccessTokenErrorCallback(),new Error("Cannot refresh access token, no refresh token or api keys are stored.")})}refreshAccessToken(e){return doe(this,void 0,void 0,function*(){const t=yield this.tokenService.getRefreshToken(e);if(null==t||""===t)throw new Error;const i=new Headers({"Content-Type":"application/x-www-form-urlencoded; charset=utf-8",Accept:"application/json","Device-Type":this.deviceType});null!=this.customUserAgent&&i.set("User-Agent",this.customUserAgent);const n=yield(0,bo._)(this.environmentService.getEnvironment$(e)),r=yield this.tokenService.decodeAccessToken(e),s=yield this.fetch(this.httpOperations.createRequest(n.getIdentityUrl()+"/connect/token",{body:this.qsStringify({grant_type:"refresh_token",client_id:r.client_id,refresh_token:t}),cache:"no-store",credentials:yield this.getCredentials(n),headers:i,method:"POST"}));if(200===s.status){const e=yield s.json(),t=new CS(e),i=(yield this.tokenService.decodeAccessToken(t.accessToken)).sub,n=yield(0,bo._)(this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(i)),r=yield(0,bo._)(this.vaultTimeoutSettingsService.getVaultTimeoutByUserId$(i));return(yield this.tokenService.setTokens(t.accessToken,n,r,t.refreshToken)).accessToken}{const e=yield this.handleTokenRefreshRequestError(s);return Promise.reject(e)}})}refreshApiToken(e){return doe(this,void 0,void 0,function*(){const t=yield this.tokenService.getClientId(e),i=yield this.tokenService.getClientSecret(e),n=yield this.appIdService.getAppId(),r=new nS(n,this.platformUtilsService),s=new VS(t,i,new Bw,r),o=yield this.postIdentityToken(s);if(!(o instanceof CS))throw new Error("Invalid response received when refreshing api token");const a=yield this.tokenService.decodeAccessToken(o.accessToken);if(a.sub!==e)throw new Error(`Token was supposed to be refreshed for ${e} but the token we got back was for ${a.sub}`);const l=yield(0,bo._)(this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(e)),c=yield(0,bo._)(this.vaultTimeoutSettingsService.getVaultTimeoutByUserId$(e));return yield this.tokenService.setAccessToken(o.accessToken,l,c)})}send(e,t,i,n,r,s,o){return doe(this,void 0,void 0,function*(){const a=yield this.getUserIdMakingRequest(n),l=yield(0,bo._)(null==a?this.environmentService.environment$:this.environmentService.getEnvironment$(a));s=bd.isNullOrWhitespace(s)?l.getApiUrl():s;const c=yield this.buildSafeApiRequestUrl(s,t);let u=yield this.buildRequest(e,a,l,r,i,o),d=yield this.fetch(this.httpOperations.createRequest(c,u));r&&null!=a&&d.status===Ma.Unauthorized&&(this.logService.warning("Unauthorized response received for request to "+t+". Attempting request again."),u=yield this.buildRequest(e,a,l,r,i,o),d=yield this.fetch(this.httpOperations.createRequest(c,u)));const h=d.headers.get("content-type"),p=null!=h&&-1!==h.indexOf("application/json"),v=null!=h&&-1!==h.indexOf("text/csv");if(r&&d.status===Ma.Ok&&p){return yield d.json()}if(r&&d.status===Ma.Ok&&v)return yield d.text();if(d.status!==Ma.Ok&&d.status!==Ma.NoContent){const e=yield this.handleApiRequestError(d,null!=a);return Promise.reject(e)}})}buildSafeApiRequestUrl(e,t){const i=t.split("?"),n=e+i[0]+(i.length>1?`?${i[1]}`:"");if(bd.invalidUrlPatterns(n))throw new Error("The request URL contains dangerous patterns.");return e+bd.normalizePath(i[0])+(i.length>1?`?${i[1]}`:"")}getUserIdMakingRequest(e){return doe(this,void 0,void 0,function*(){if(null==e)throw new Error("A user id was given but it was null, cannot complete API request.");let t=null;return"boolean"==typeof e&&e?t=yield this.getActiveUser():"string"==typeof e&&(t=e),t})}buildRequest(e,t,i,n,r,s){return doe(this,void 0,void 0,function*(){const[o,a]=yield this.buildHeadersAndBody(t,n,r,s),l={cache:"no-store",credentials:yield this.getCredentials(i),method:e};return l.headers=o,l.body=a,l})}buildHeadersAndBody(e,t,i,n){return doe(this,void 0,void 0,function*(){let r=null;const s=new Headers({"Device-Type":this.deviceType});if(zne("prereleaseBuild")&&s.set("Is-Prerelease","1"),null!=this.customUserAgent&&s.set("User-Agent",this.customUserAgent),t&&s.set("Accept","application/json"),null!=n&&n(s),null!=e){const t=yield this.getActiveBearerToken(e);s.set("Authorization","Bearer "+t)}else{const e=yield this.appIdService.getAppId();s.set("Device-Identifier",e)}return null!=i&&("string"==typeof i?(r=i,s.set("Content-Type","application/x-www-form-urlencoded; charset=utf-8")):"object"==typeof i&&(i instanceof FormData?r=i:(s.set("Content-Type","application/json; charset=utf-8"),r=JSON.stringify(i)))),[s,r]})}handleApiRequestError(e,t){return doe(this,void 0,void 0,function*(){!t||e.status!==Ma.Unauthorized&&e.status!==Ma.Forbidden||(yield this.logoutCallback("invalidAccessToken"));const i=yield this.getJsonResponse(e);return new iS(i,e.status)})}handleTokenRefreshRequestError(e){return doe(this,void 0,void 0,function*(){const t=yield this.getJsonResponse(e);return e.status===Ma.BadRequest&&"invalid_grant"===(null==t?void 0:t.error)&&(yield this.logoutCallback("sessionExpired")),new iS(t,e.status,!0)})}getJsonResponse(e){return doe(this,void 0,void 0,function*(){let t=null;return this.isJsonResponse(e)?t=yield e.json():this.isTextPlainResponse(e)&&(t={Message:yield e.text()}),t})}qsStringify(e){return Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&")}getActiveUser(){return doe(this,void 0,void 0,function*(){return yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)))})}getCredentials(e){return doe(this,void 0,void 0,function*(){if(this.platformUtilsService.getClientType()!==Da.Web||e.hasBaseUrl())return"include"})}addEventParameters(e,t,i,n){return null!=t&&(e+="?start="+t),null!=i&&(e+=e.indexOf("?")>-1?"&":"?",e+="end="+i),null!=n&&(e+=e.indexOf("?")>-1?"&":"?",e+="continuationToken="+n),e}isJsonResponse(e){const t=e.headers.get("content-type");return null!=t&&t.indexOf("application/json")>-1}isTextPlainResponse(e){const t=e.headers.get("content-type");return null!=t&&t.indexOf("text/plain")>-1}}hoe.NEW_DEVICE_VERIFICATION_REQUIRED_MESSAGE="new device verification required";var poe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class voe{static fromJSON(e){return Object.assign(new voe,e)}}const foe=k.array(ye,"events",{deserializer:e=>voe.fromJSON(e),clearOn:["logout"]});var moe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class goe{}var yoe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var boe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class woe extends sv{constructor(e){super(),null!=e&&(this.size=e.size,this.buildDomainModel(this,e,{id:null,sizeName:null,fileName:null},["id","sizeName"]))}decrypt(e){return boe(this,void 0,void 0,function*(){return yield this.decryptObj(this,new v0(this),["fileName"],e)})}static fromJSON(e){return null==e?null:Object.assign(new woe,e,{fileName:Pp.fromJSON(e.fileName)})}}class Soe extends sv{constructor(e){super(),null!=e&&(this.hidden=e.hidden,this.buildDomainModel(this,e,{text:null},[]))}decrypt(e){return this.decryptObj(this,new f0(this),["text"],e)}static fromJSON(e){return null==e?null:Object.assign(new Soe,e,{text:Pp.fromJSON(e.text)})}}var koe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Ioe extends sv{constructor(e){if(super(),null!=e)switch(this.buildDomainModel(this,e,{id:null,accessId:null,name:null,notes:null,key:null},["id","accessId"]),this.type=e.type,this.authType=e.authType,this.maxAccessCount=e.maxAccessCount,this.accessCount=e.accessCount,this.password=e.password,this.disabled=e.disabled,this.revisionDate=null!=e.revisionDate?new Date(e.revisionDate):null,this.deletionDate=null!=e.deletionDate?new Date(e.deletionDate):null,this.expirationDate=null!=e.expirationDate?new Date(e.expirationDate):null,this.hideEmail=e.hideEmail,this.authType=e.authType,this.emails=e.emails,this.type){case u0.Text:this.text=new Soe(e.text);break;case u0.File:this.file=new woe(e.file)}}decrypt(e){return koe(this,void 0,void 0,function*(){if(!e)throw new Error("User ID must not be null or undefined");const t=new m0(this),i=bd.getContainerService().getKeyService(),n=bd.getContainerService().getEncryptService(),r=yield(0,bo._)(i.userKey$(e));switch(t.key=yield n.decryptBytes(this.key,r),t.cryptoKey=yield i.makeSendKey(t.key),t.name=null!=this.name?yield n.decryptString(this.name,t.cryptoKey):null,t.notes=null!=this.notes?yield n.decryptString(this.notes,t.cryptoKey):null,null!=this.emails?t.emails=this.emails?this.emails.split(",").map(e=>e.trim()):[]:t.emails=[],this.type){case u0.File:t.file=yield this.file.decrypt(t.cryptoKey);break;case u0.Text:t.text=yield this.text.decrypt(t.cryptoKey)}return t})}static fromJSON(e){if(null==e)return null;const t=null==e.revisionDate?null:new Date(e.revisionDate),i=null==e.expirationDate?null:new Date(e.expirationDate),n=null==e.deletionDate?null:new Date(e.deletionDate);return Object.assign(new Ioe,e,{key:Pp.fromJSON(e.key),name:Pp.fromJSON(e.name),notes:Pp.fromJSON(e.notes),emails:e.emails,text:Soe.fromJSON(e.text),file:woe.fromJSON(e.file),revisionDate:t,expirationDate:i,deletionDate:n})}}class Coe{constructor(e,t){switch(this.type=e.type,this.fileLength=t,this.name=e.name?e.name.encryptedString:null,this.notes=e.notes?e.notes.encryptedString:null,this.maxAccessCount=e.maxAccessCount,this.expirationDate=null!=e.expirationDate?e.expirationDate.toISOString():null,this.deletionDate=null!=e.deletionDate?e.deletionDate.toISOString():null,this.key=null!=e.key?e.key.encryptedString:null,this.password=e.password,this.emails=e.emails,this.disabled=e.disabled,this.hideEmail=e.hideEmail,this.type){case u0.Text:this.text=new nA,this.text.text=null!=e.text.text?e.text.text.encryptedString:null,this.text.hidden=e.text.hidden;break;case u0.File:this.file=new iA,this.file.fileName=null!=e.file.fileName?e.file.fileName.encryptedString:null}}}class Toe extends tS{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.type=this.getResponseProperty("Type"),this.name=this.getResponseProperty("Name");const t=this.getResponseProperty("Text");null!=t&&(this.text=new nA(t));const i=this.getResponseProperty("File");null!=i&&(this.file=new iA(i)),this.expirationDate=this.getResponseProperty("ExpirationDate"),this.creatorIdentifier=this.getResponseProperty("CreatorIdentifier")}}class Poe extends tS{constructor(e){super(e),this.id=null,this.url=null,this.id=this.getResponseProperty("Id"),this.url=this.getResponseProperty("Url")}}class Foe extends tS{constructor(e){super(e),this.url=null,this.fileUploadType=this.getResponseProperty("FileUploadType");const t=this.getResponseProperty("SendResponse");this.sendResponse=null==t?null:new rA(t),this.url=this.getResponseProperty("Url")}}var Roe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const xoe=k.record(be,"sendUserEncrypted",{deserializer:e=>e,clearOn:["logout"]}),Aoe=new k(we,"sendUserDecrypted",{deserializer:e=>e,clearOn:["lock"]});var Doe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Eoe{}class $oe extends Coe{constructor(e){super(e),this.id=e.id}}var Ooe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Uoe{}class Moe{}class Noe{}var Voe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})},Boe=function(e,t,i){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var n,r;if(i){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],i&&(r=n)}if("function"!=typeof n)throw new TypeError("Object not disposable.");r&&(n=function(){try{r.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:n,async:i})}else i&&e.stack.push({async:!0});return t},joe=function(e){return function(t){function i(i){t.error=t.hasError?new e(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var n,r=0;return function e(){for(;n=t.stack.pop();)try{if(!n.async&&1===r)return r=0,t.stack.push(n),Promise.resolve().then(e);if(n.dispose){var s=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(s).then(e,function(t){return i(t),e()})}else r|=1}catch(e){i(e)}if(1===r)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,i){var n=new Error(i);return n.name="SuppressedError",n.error=e,n.suppressed=t,n});class Goe{constructor(e){this.comparator=e,this.sortedCiphersByUrl=new Map,this.timeouts=new Map}isCached(e){return this.sortedCiphersByUrl.has(e)}addCiphers(e,t){t.sort(this.comparator),this.sortedCiphersByUrl.set(e,new Loe(t)),this.resetTimer(e)}getLastUsed(e){return this.resetTimer(e),this.isCached(e)?this.sortedCiphersByUrl.get(e).getLastUsed():null}getLastLaunched(e){return this.isCached(e)?this.sortedCiphersByUrl.get(e).getLastLaunched():null}getNext(e){return this.resetTimer(e),this.isCached(e)?this.sortedCiphersByUrl.get(e).getNext():null}updateLastUsedIndex(e){this.isCached(e)&&this.sortedCiphersByUrl.get(e).updateLastUsedIndex()}clear(){this.sortedCiphersByUrl.clear(),this.timeouts.clear()}resetTimer(e){clearTimeout(this.timeouts.get(e)),this.timeouts.set(e,setTimeout(()=>{this.sortedCiphersByUrl.delete(e),this.timeouts.delete(e)},3e3))}}class Loe{constructor(e){this.ciphers=e,this.lastUsedIndex=-1}getLastUsed(){return this.lastUsedIndex=Math.max(this.lastUsedIndex,0),this.ciphers[this.lastUsedIndex]}getLastLaunched(){const e=this.ciphers.filter(e=>{var t;return null===(t=e.localData)||void 0===t?void 0:t.lastLaunched});return e.sort((e,t)=>t.localData.lastLaunched.valueOf()-e.localData.lastLaunched.valueOf())[0]}getNextIndex(){return(this.lastUsedIndex+1)%this.ciphers.length}getNext(){return this.ciphers[this.getNextIndex()]}updateLastUsedIndex(){this.lastUsedIndex=this.getNextIndex()}}class zoe{constructor(e,t){this.ids=null==e?[]:e,this.organizationId=t}}class _oe{constructor(e,t){this.ids=null==e?[]:e,this.folderId=t}}class Koe{constructor(e,t){this.ids=null==e?[]:e,this.organizationId=t}}class Xoe extends Yz{constructor({cipher:e,encryptedFor:t}){super({cipher:e,encryptedFor:t}),this.id=e.id}}class qoe{constructor(e,t,i){this.encryptedFor=i,null!=e&&(this.ciphers=[],e.forEach(e=>{this.ciphers.push(new Xoe({cipher:e,encryptedFor:i}))})),this.collectionIds=t}}class Woe{constructor(e,t,i,n=!1){this.organizationId=e,this.cipherIds=t,this.collectionIds=i,this.removeCollections=n}}class Yoe{constructor(e){this.collectionIds=null==e?[]:e}}class Hoe{constructor({cipher:e,encryptedFor:t}){this.cipher=new Yz({cipher:e,encryptedFor:t}),this.collectionIds=e.collectionIds}}class Joe{constructor(e){this.folderId=e.folderId,this.favorite=e.favorite}}class Zoe{constructor({cipher:e,encryptedFor:t}){this.cipher=new Yz({cipher:e,encryptedFor:t}),this.collectionIds=e.collectionIds}}var Qoe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const eae=new jne.SemVer("2024.2.0");class tae{constructor(e,t,i,n,r,s,o,a,c,u,d,h,p,v,f){this.keyService=e,this.domainSettingsService=t,this.apiService=i,this.i18nService=n,this.searchService=r,this.autofillSettingsService=s,this.encryptService=o,this.cipherFileUploadService=a,this.configService=c,this.stateProvider=u,this.accountService=d,this.logService=h,this.cipherEncryptionService=p,this.messageSender=v,this.cipherSdkService=f,this.sortedCiphersCache=new Goe(this.sortCiphersByLastUsed),this.clearCipherViewsForUser$=new Co.B,this.sdkCipherCrudEnabled$=this.configService.getFeatureFlag$(Wv.PM27632_SdkCipherCrudOperations),this.cipherListViews$=h$(e=>{let t;return this.configService.getFeatureFlag$(Wv.PM22134SdkCipherListView).pipe((0,go.n)(i=>i?(0,jo.z)([this.encryptedCiphersState(e).state$,this.localData$(e),this.keyService.cipherDecryptionKeys$(e,!0)]).pipe((0,Eo.p)(([e,t,i])=>null!=e&&null!=i),(0,l.T)(([e,t])=>Object.values(e).map(e=>new AN(e,null==t?void 0:t[e.id]))),(0,Oo.M)(()=>{t=performance.now()}),(0,go.n)(t=>Qoe(this,void 0,void 0,function*(){return yield this.decryptCiphersWithSdk(t,e,!1)})),(0,Oo.M)(([i,n])=>{Promise.all([this.setFailedDecryptedCiphers(n,e),this.searchService.indexCiphers(e,i)]),this.logService.measure(t,"Vault","CipherService","listView decrypt complete",[["Items",i.length]])}),(0,l.T)(([e])=>e)):this.cipherViews$(e)))},this.clearCipherViewsForUser$),this.cipherViews$=h$(e=>(0,jo.z)([this.encryptedCiphersState(e).state$,this.localData$(e),this.keyService.cipherDecryptionKeys$(e)]).pipe((0,Eo.p)(([e,t,i])=>null!=e&&null!=i),(0,go.n)(()=>this.getAllDecrypted(e)),(0,Oo.M)(()=>{this.messageSender.send("updateOverlayCiphers")})),this.clearCipherViewsForUser$),this.failedToDecryptCiphers$=h$(e=>this.failedToDecryptCiphersState(e).state$.pipe((0,Eo.p)(e=>null!=e)),this.clearCipherViewsForUser$)}localData$(e){return this.localDataState(e).state$.pipe((0,l.T)(e=>null!=e?e:{}))}ciphers$(e){return this.encryptedCiphersState(e).state$.pipe((0,l.T)(e=>null!=e?e:{}))}addEditCipherInfo$(e){return this.addEditCipherInfoState(e).state$}setDecryptedCipherCache(e,t){return Qoe(this,void 0,void 0,function*(){null!=e&&0===e.length||(yield this.setDecryptedCiphers(e,t)),null!=this.searchService&&(null==e?yield this.searchService.clearIndex(t):this.searchService.indexCiphers(t,e))})}setFailedDecryptedCiphers(e,t){return Qoe(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(Sse,e,t)})}setDecryptedCiphers(e,t){return Qoe(this,void 0,void 0,function*(){const i={};null==e||e.forEach(e=>{i[e.id]=e}),yield this.stateProvider.setUserState(wse,i,t)})}clearCache(e){return Qoe(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.stateProvider.activeUserId$);null!=e||(e=t),yield this.clearDecryptedCiphersState(e),this.clearCipherViewsForUser$.next(e)})}adjustCipherHistory(e,t,i){return Qoe(this,void 0,void 0,function*(){null!=e.id&&(null==i&&(i=yield this.get(e.id,t)),null!=i&&(yield this.updateModelfromExistingCipher(e,i,t)),this.adjustPasswordHistoryLength(e))})}encrypt(e,t,i,n){return Qoe(this,arguments,void 0,function*(e,t,i,n,r=null){var s;yield this.adjustCipherHistory(e,t,r);if((yield this.configService.getFeatureFlag(Wv.PM22136_SdkCipherEncryption))&&null==i&&null==n)return yield this.cipherEncryptionService.encrypt(e,t);const o=new AN;if(o.id=e.id,o.folderId=e.folderId,o.favorite=e.favorite,o.organizationId=e.organizationId,o.type=e.type,o.collectionIds=e.collectionIds,o.creationDate=e.creationDate,o.revisionDate=e.revisionDate,o.archivedDate=e.archivedDate,o.reprompt=e.reprompt,o.edit=e.edit,(e.viewPassword||(null==r?void 0:r.key))&&(yield this.getCipherKeyEncryptionEnabled())){o.key=null!==(s=null==r?void 0:r.key)&&void 0!==s?s:null;const a=yield this.getKeyForCipherKeyDecryption(o,t);return i||(i=a),n||(n=a),{cipher:yield this.encryptCipherWithCipherKey(e,o,i,n),encryptedFor:t}}return i||(i=yield this.getKeyForCipherKeyDecryption(o,t)),o.key=null,{cipher:yield this.encryptCipher(e,o,i),encryptedFor:t}})}encryptMany(e,t){return Qoe(this,void 0,void 0,function*(){if(yield this.configService.getFeatureFlag(Wv.PM22136_SdkCipherEncryption))return yield this.cipherEncryptionService.encryptMany(e,t);const i=[];for(const n of e){const e=yield this.encrypt(n,t);i.push(e)}return i})}encryptAttachments(e,t){return Qoe(this,void 0,void 0,function*(){if(null==e||0===e.length)return null;const i=[],n=[];return e.forEach(e=>Qoe(this,void 0,void 0,function*(){const r=new vN;r.id=e.id,r.size=e.size,r.sizeName=e.sizeName,r.url=e.url;const s=this.encryptObjProperty(e,r,{fileName:null},t).then(()=>Qoe(this,void 0,void 0,function*(){null!=e.key&&(r.key=yield this.encryptService.wrapSymmetricKey(e.key,t)),n.push(r)}));i.push(s)})),yield Promise.all(i),n})}encryptFields(e,t){return Qoe(this,void 0,void 0,function*(){if(!e||!e.length)return null;const i=this,n=[];return yield e.reduce((e,r)=>Qoe(this,void 0,void 0,function*(){yield e;const s=yield i.encryptField(r,t);n.push(s)}),Promise.resolve()),n})}encryptField(e,t){return Qoe(this,void 0,void 0,function*(){const i=new gN;return i.type=e.type,i.linkedId=e.linkedId,e.type===ox.Boolean&&"true"!==e.value&&(e.value="false"),yield this.encryptObjProperty(e,i,{name:null,value:null},t),i})}encryptPasswordHistories(e,t){return Qoe(this,void 0,void 0,function*(){if(!e||!e.length)return null;const i=this,n=[];return yield e.reduce((e,r)=>Qoe(this,void 0,void 0,function*(){yield e;const s=yield i.encryptPasswordHistory(r,t);n.push(s)}),Promise.resolve()),n})}encryptPasswordHistory(e,t){return Qoe(this,void 0,void 0,function*(){const i=new TN;return i.lastUsedDate=e.lastUsedDate,yield this.encryptObjProperty(e,i,{password:null},t),i})}get(e,t){return Qoe(this,void 0,void 0,function*(){const i=yield(0,bo._)(this.ciphers$(t));if(null==i||!i.hasOwnProperty(e))return null;const n=yield(0,bo._)(this.localData$(t)),r=e;return new AN(i[r],n?n[r]:null)})}getAll(e){return Qoe(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.localData$(e)),i=yield(0,bo._)(this.ciphers$(e)),n=[];for(const e in i)if(i.hasOwnProperty(e)){const r=e;n.push(new AN(i[r],t?t[r]:null))}return n})}getAllDecrypted(e){return Qoe(this,void 0,void 0,function*(){const t=yield this.getDecryptedCiphers(e);if(null!=t&&0!==t.length)return yield this.reindexCiphers(e),t;const i=yield this.decryptCiphers(yield this.getAll(e),e);if(null==i)return[];const[n,r]=i;return yield this.setDecryptedCipherCache(n,e),yield this.setFailedDecryptedCiphers(r,e),n})}getDecryptedCiphers(e){return Qoe(this,void 0,void 0,function*(){return Object.values(yield(0,bo._)(this.decryptedCiphersState(e).state$.pipe((0,l.T)(e=>null!=e?e:{}))))})}decryptCiphers(e,t){return Qoe(this,void 0,void 0,function*(){if(0===e.length)return[[],[]];if(yield this.configService.getFeatureFlag(Wv.PM19941MigrateCipherDomainToSdk)){const i=performance.now(),n=yield this.decryptCiphersWithSdk(e,t,!0);return this.logService.measure(i,"Vault","CipherService","decrypt complete",[["Items",e.length]]),n}const i=yield(0,bo._)(this.keyService.cipherDecryptionKeys$(t));if(null==i||null==i.userKey&&0===Object.keys(i.orgKeys).length)return null;const n=e.reduce((e,t)=>{var i,n;return null!==(i=e[n=t.organizationId])&&void 0!==i||(e[n]=[]),e[t.organizationId].push(t),e},{}),r=performance.now(),s=(yield Promise.all(Object.entries(n).map(e=>Qoe(this,[e],void 0,function*([e,t]){var n;const r=null!==(n=i.orgKeys[e])&&void 0!==n?n:i.userKey;return yield Promise.all(t.map(e=>Qoe(this,void 0,void 0,function*(){return yield e.decrypt(r)})))})))).flat().sort(this.getLocaleSortingFunction());return this.logService.measure(r,"Vault","CipherService","decrypt complete",[["Items",e.length]]),s.reduce((e,t)=>(t.decryptionFailure?e[1].push(t):e[0].push(t),e),[[],[]])})}decrypt(e,t){return Qoe(this,void 0,void 0,function*(){if(yield this.configService.getFeatureFlag(Wv.PM19941MigrateCipherDomainToSdk))return yield this.cipherEncryptionService.decrypt(e,t);{const i=yield this.getKeyForCipherKeyDecryption(e,t);return yield e.decrypt(i)}})}reindexCiphers(e){return Qoe(this,void 0,void 0,function*(){var t;null!=this.searchService&&(null!==(t=yield(0,bo._)(this.searchService.indexedEntityId$(e)))&&void 0!==t?t:e)!==e&&(yield this.searchService.indexCiphers(e,yield this.getDecryptedCiphers(e),e))})}getAllDecryptedForGrouping(e,t){return Qoe(this,arguments,void 0,function*(e,t,i=!0){return(yield this.getAllDecrypted(t)).filter(t=>!t.isDeleted&&(!(!i||t.folderId!==e)||!i&&null!=t.collectionIds&&t.collectionIds.indexOf(e)>-1))})}getAllDecryptedForUrl(e,t,i){return Qoe(this,arguments,void 0,function*(e,t,i,n=null,r){return yield(0,bo._)(this.cipherViews$(t).pipe((0,Eo.p)(e=>null!=e),(0,go.n)(t=>Qoe(this,void 0,void 0,function*(){return yield this.filterCiphersForUrl(t,e,i,n,r)}))))})}getAllDecryptedForIds(e,t){return Qoe(this,void 0,void 0,function*(){return(0,bo._)(this.cipherViews$(e).pipe((0,Eo.p)(e=>null!=e),(0,l.T)(e=>e.filter(e=>t.includes(e.id)))))})}filterCiphersForUrl(e,t,i){return Qoe(this,arguments,void 0,function*(e,t,i,n=null,r){if(null==t&&null==i)return[];const s=yield(0,bo._)(this.domainSettingsService.getUrlEquivalentDomains(t));null!=n||(n=yield(0,bo._)(this.domainSettingsService.resolvedDefaultUriMatchStrategy$));const o=yield this.configService.getFeatureFlag(Wv.PM19148_InnovationArchive);return e.filter(e=>{const a=t$.getType(e),l=null!==t$.getLogin(e);return!t$.isDeleted(e)&&((!o||!t$.isArchived(e))&&(!(!Array.isArray(i)||!i.includes(a)||l)||!!l&&t$.matchesUri(e,t,s,n,r)))})})}getAllDecryptedCiphersOfType(e,t){return Qoe(this,void 0,void 0,function*(){const i=yield this.getAllDecrypted(t),n=yield this.configService.getFeatureFlag(Wv.PM19148_InnovationArchive);return i.filter(t=>null==t.deletedDate&&(!n||!t.isArchived)&&e.includes(t.type)).sort((e,t)=>this.sortCiphersByLastUsedThenName(e,t))})}getAllFromApiForOrganization(e,t){return Qoe(this,void 0,void 0,function*(){const i=yield this.apiService.getCiphersOrganization(e,t);return yield this.decryptOrganizationCiphersResponse(i,e)})}getManyFromApiForOrganization(e){return Qoe(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/ciphers/organization-details/assigned?organizationId="+e,null,!0,!0),i=new sk(t,mA);return this.decryptOrganizationCiphersResponse(i,e)})}decryptOrganizationCiphersResponse(e,t){return Qoe(this,void 0,void 0,function*(){if(null==(null==e?void 0:e.data)||e.data.length<1)return[];const i=e.data.map(e=>new AN(new uN(e))),n=yield this.keyService.getOrgKey(t),r=yield Promise.all(i.map(e=>Qoe(this,void 0,void 0,function*(){return yield e.decrypt(n)})));return r.sort(this.getLocaleSortingFunction()),r})}getLastUsedForUrl(e,t){return Qoe(this,arguments,void 0,function*(e,t,i=!1){return this.getCipherForUrl(e,t,!0,!1,i)})}getLastLaunchedForUrl(e,t){return Qoe(this,arguments,void 0,function*(e,t,i=!1){return this.getCipherForUrl(e,t,!1,!0,i)})}getNextCipherForUrl(e,t){return Qoe(this,void 0,void 0,function*(){return this.getCipherForUrl(e,t,!1,!1,!1)})}getNextCardCipher(e){return Qoe(this,void 0,void 0,function*(){const t="cardCiphers";if(!this.sortedCiphersCache.isCached(t)){const i=yield this.getAllDecryptedCiphersOfType([nx.Card],e);if(!(null==i?void 0:i.length))return null;this.sortedCiphersCache.addCiphers(t,i)}return this.sortedCiphersCache.getNext(t)})}getNextIdentityCipher(e){return Qoe(this,void 0,void 0,function*(){const t="identityCiphers";if(!this.sortedCiphersCache.isCached(t)){const i=yield this.getAllDecryptedCiphersOfType([nx.Identity],e);if(!(null==i?void 0:i.length))return null;this.sortedCiphersCache.addCiphers(t,i)}return this.sortedCiphersCache.getNext(t)})}updateLastUsedIndexForUrl(e){this.sortedCiphersCache.updateLastUsedIndex(e)}updateLastUsedDate(e,t){return Qoe(this,void 0,void 0,function*(){let i=yield(0,bo._)(this.localData$(t));i||(i={});const n=e;i[n]?i[n].lastUsedDate=(new Date).getTime():i[n]={lastUsedDate:(new Date).getTime()},yield this.localDataState(t).update(()=>i);const r=yield this.getDecryptedCiphers(t);if(r){for(let t=0;t<r.length;t++){const n=r[t];if(n.id===e){n.localData=i[e];break}}yield this.setDecryptedCiphers(r,t)}})}updateLastLaunchedDate(e,t){return Qoe(this,void 0,void 0,function*(){let i=yield(0,bo._)(this.localData$(t));i||(i={});const n=(new Date).getTime();i[e]={lastLaunched:n,lastUsedDate:n},yield this.localDataState(t).update(()=>i);const r=yield this.getDecryptedCiphers(t);if(r){for(let t=0;t<r.length;t++){const n=r[t];if(n.id===e){n.localData=i[e];break}}yield this.setDecryptedCiphers(r,t)}})}saveNeverDomain(e){return Qoe(this,void 0,void 0,function*(){if(null==e)return;let t=yield(0,bo._)(this.domainSettingsService.neverDomains$);t||(t={}),t[e]=null,yield this.domainSettingsService.setNeverDomains(t)})}createWithServer(e,t,i){return Qoe(this,void 0,void 0,function*(){if(yield(0,bo._)(this.sdkCipherCrudEnabled$))return(yield this.createWithServerUsingSdk(e,t,i))||new RO;const n=yield this.encrypt(e,t),r=yield this.createWithServer_legacy(n,i);return yield this.decrypt(r,t)})}createWithServerUsingSdk(e,t,i){return Qoe(this,void 0,void 0,function*(){yield this.clearCache(t);return yield this.cipherSdkService.createWithServer(e,t,i)})}createWithServer_legacy(e,t){return Qoe(this,arguments,void 0,function*({cipher:e,encryptedFor:t},i){let n;if(i&&null!=e.organizationId){const i=new Hoe({cipher:e,encryptedFor:t});n=yield this.apiService.postCipherAdmin(i);const r=new uN(n,e.collectionIds);return new AN(r)}if(null!=e.collectionIds&&e.collectionIds.length>0){const i=new Hoe({cipher:e,encryptedFor:t});n=yield this.apiService.postCipherCreate(i)}else{const i=new Yz({cipher:e,encryptedFor:t});n=yield this.apiService.postCipher(i)}e.id=n.id;const r=new uN(n,e.collectionIds),s=yield this.upsert(r);return new AN(s[e.id])})}updateWithServer(e,t,i,n){return Qoe(this,void 0,void 0,function*(){if(yield(0,bo._)(this.sdkCipherCrudEnabled$))return yield this.updateWithServerUsingSdk(e,t,i,n);const r=yield this.encrypt(e,t),s=yield this.updateWithServer_legacy(r,n);return yield this.decrypt(s,t)})}updateWithServerUsingSdk(e,t,i,n){return Qoe(this,void 0,void 0,function*(){yield this.clearCache(t);return yield this.cipherSdkService.updateWithServer(e,t,i,n)})}updateWithServer_legacy(e,t){return Qoe(this,arguments,void 0,function*({cipher:e,encryptedFor:t},i){let n;if(i){const i=new Yz({cipher:e,encryptedFor:t});n=yield this.apiService.putCipherAdmin(e.id,i);const r=new uN(n,e.collectionIds);return new AN(r,e.localData)}if(e.edit){const i=new Yz({cipher:e,encryptedFor:t});n=yield this.apiService.putCipher(e.id,i)}else{const t=new Joe(e);n=yield this.apiService.putPartialCipher(e.id,t)}const r=new uN(n,e.collectionIds),s=yield this.upsert(r);return new AN(s[e.id],e.localData)})}shareWithServer(e,t,i,n,r){return Qoe(this,void 0,void 0,function*(){const s=yield this.configService.getFeatureFlag(Wv.PM22136_SdkCipherEncryption);let o;if(yield this.adjustCipherHistory(e,n,r),s){if(null!=e.organizationId)throw new Error("Cipher is already associated with an organization.");o=yield this.cipherEncryptionService.moveToOrganization(e,t,n),o.cipher.collectionIds=i}else{const r=[];null!=e.attachments&&e.attachments.forEach(i=>{null==i.key&&r.push(this.shareAttachmentWithServer(i,e.id,t,e.revisionDate))}),yield Promise.all(r),e.organizationId=t,e.collectionIds=i,o=yield this.encryptSharedCipher(e,n)}const a=new Zoe(o),l=yield this.apiService.putShareCipher(e.id,a),c=new uN(l,i);return yield this.upsert(c),new AN(c,e.localData)})}shareManyWithServer(e,t,i,n){return Qoe(this,void 0,void 0,function*(){const r=yield this.configService.getFeatureFlag(Wv.PM22136_SdkCipherEncryption),s=[],o=[];for(const a of e)if(r){if(null!=a.organizationId)throw new Error("Cipher is already associated with an organization.");s.push(this.cipherEncryptionService.moveToOrganization(a,t,n).then(e=>{e.cipher.collectionIds=i,o.push(e.cipher)}))}else a.organizationId=t,a.collectionIds=i,s.push(this.encryptSharedCipher(a,n).then(e=>{o.push(e.cipher)}));yield Promise.all(s);const a=new qoe(o,i,n);try{const e=yield this.apiService.putShareCiphers(a),t=new Map(e.data.map(e=>[e.id,e]));o.forEach(e=>{const i=t.get(e.id);i&&(e.revisionDate=new Date(i.revisionDate))}),yield this.upsert(o.map(e=>e.toCipherData()))}catch(t){for(const t of e)t.organizationId=null,t.collectionIds=null;throw t}})}saveAttachmentWithServer(e,t,i,n=!1){return new Promise((r,s)=>{const o=new FileReader;o.readAsArrayBuffer(t),o.onload=o=>Qoe(this,void 0,void 0,function*(){try{const s=yield this.saveAttachmentRawWithServer(e,t.name,o.target.result,i,n);r(s)}catch(e){s(e)}}),o.onerror=()=>{s("Error reading file.")}})}saveAttachmentRawWithServer(e,t,i,n){return Qoe(this,arguments,void 0,function*(e,t,i,n,r=!1){const s=yield this.getKeyForCipherKeyDecryption(e,n),o=null!=e.key?yield this.encryptService.unwrapSymmetricKey(e.key,s):s,a=yield this.encryptService.encryptString(t,o),l=yield this.keyService.makeDataEncKey(o),c=yield this.encryptService.encryptFileData(new Uint8Array(i),l[0]),u=yield this.cipherFileUploadService.upload(e,a,c,r,l),d=new uN(u,e.collectionIds);return r||(yield this.upsert(d)),new AN(d)})}saveCollectionsWithServer(e,t){return Qoe(this,void 0,void 0,function*(){const i=new Yoe(e.collectionIds),n=yield this.apiService.putCipherCollections(e.id,i);if(n.unavailable)return void(yield this.delete(e.id,t));const r=new uN(n.cipher),s=yield this.upsert(r);return new AN(s[e.id],e.localData)})}saveCollectionsWithServerAdmin(e){return Qoe(this,void 0,void 0,function*(){const t=new Yoe(e.collectionIds),i=yield this.apiService.putCipherCollectionsAdmin(e.id,t),n=new mA(i);n.edit=!0,n.viewPassword=!0,n.favorite=!1;const r=new uN(n);return new AN(r)})}bulkUpdateCollectionsWithServer(e,t,i,n){return Qoe(this,arguments,void 0,function*(e,t,i,n,r=!1){var s,o;const a=new Woe(e,i,n,r);yield this.apiService.send("POST","/ciphers/bulk-collections",a,!0,!1);const l=yield(0,bo._)(this.ciphers$(t));for(const e of i){const t=l[e];t&&(t.collectionIds=r?null===(s=t.collectionIds)||void 0===s?void 0:s.filter(e=>!n.includes(e)):[...new Set([...null!==(o=t.collectionIds)&&void 0!==o?o:[],...n])])}yield this.clearCache(),yield this.encryptedCiphersState(t).update(()=>l)})}upsert(e,t){return Qoe(this,void 0,void 0,function*(){const i=e instanceof uN?[e]:e,n=yield this.updateEncryptedCipherState(e=>(i.forEach(t=>e[t.id]=t),e),t);return yield new Promise(e=>setTimeout(e,0)),n})}replace(e,t){return Qoe(this,void 0,void 0,function*(){var i;const n=null!==(i=yield(0,bo._)(this.encryptedCiphersState(t).state$))&&void 0!==i?i:{};Object.keys(n).length>0&&JSON.stringify(n)===JSON.stringify(e)||(yield this.updateEncryptedCipherState(()=>e,t))})}updateEncryptedCipherState(e){return Qoe(this,arguments,void 0,function*(e,t=null){t||(t=yield(0,bo._)(this.stateProvider.activeUserId$)),yield this.clearCache(t);const i=yield this.stateProvider.getUser(t,bse).update(t=>e(null!=t?t:{}));return yield new Promise(e=>setTimeout(e,0)),i})}clear(e){return Qoe(this,void 0,void 0,function*(){null!=e||(e=yield(0,bo._)(this.stateProvider.activeUserId$)),yield this.clearEncryptedCiphersState(e),yield this.clearCache(e)})}moveManyWithServer(e,t,i){return Qoe(this,void 0,void 0,function*(){yield this.apiService.putMoveCiphers(new _oe(e,t));let n=yield(0,bo._)(this.ciphers$(i));null==n&&(n={}),e.forEach(e=>{n.hasOwnProperty(e)&&(n[e].folderId=t)}),yield this.clearCache(),yield this.encryptedCiphersState(i).update(()=>n)})}delete(e,t){return Qoe(this,void 0,void 0,function*(){const i=yield(0,bo._)(this.ciphers$(t));if(null!=i){if("string"==typeof e){const t=e;if(null==i[t])return;delete i[t]}else e.forEach(e=>{delete i[e]});yield this.clearCache(),yield this.encryptedCiphersState(t).update(()=>i)}})}deleteWithServer(e,t){return Qoe(this,arguments,void 0,function*(e,t,i=!1){if(yield(0,bo._)(this.sdkCipherCrudEnabled$))return yield this.cipherSdkService.deleteWithServer(e,t,i),void(yield this.clearCache(t));i?yield this.apiService.deleteCipherAdmin(e):yield this.apiService.deleteCipher(e),yield this.delete(e,t)})}deleteManyWithServer(e,t){return Qoe(this,arguments,void 0,function*(e,t,i=!1,n){if(yield(0,bo._)(this.sdkCipherCrudEnabled$))return yield this.cipherSdkService.deleteManyWithServer(e,t,i,n),void(yield this.clearCache(t));const r=new zoe(e,n);i?yield this.apiService.deleteManyCiphersAdmin(r):yield this.apiService.deleteManyCiphers(r),yield this.delete(e,t)})}deleteAttachment(e,t,i,n){return Qoe(this,void 0,void 0,function*(){let r=yield(0,bo._)(this.ciphers$(n));const s=e;if(null!=r&&r.hasOwnProperty(e)&&null!=r[s].attachments){for(let e=0;e<r[s].attachments.length;e++)r[s].attachments[e].id===i&&r[s].attachments.splice(e,1);return r[s].revisionDate=t,yield this.clearCache(),yield this.encryptedCiphersState(n).update(()=>(null==r&&(r={}),r)),r[s]}})}deleteAttachmentWithServer(e,t,i){return Qoe(this,arguments,void 0,function*(e,t,i,n=!1){let r;try{r=n?yield this.apiService.deleteCipherAttachmentAdmin(e,t):yield this.apiService.deleteCipherAttachment(e,t)}catch(e){return Promise.reject(e.getSingleMessage())}const s=new uN(r.cipher);return yield this.deleteAttachment(e,s.revisionDate,t,i)})}sortCiphersByLastUsed(e,t){const i=e.localData&&e.localData.lastUsedDate?e.localData.lastUsedDate:null,n=t.localData&&t.localData.lastUsedDate?t.localData.lastUsedDate:null,r=null!=i&&null!=n;return r&&i<n?1:null!=i&&null==n||r&&i>n?-1:null!=n&&null==i?1:0}sortCiphersByLastUsedThenName(e,t){const i=this.sortCiphersByLastUsed(e,t);return 0!==i?i:this.getLocaleSortingFunction()(e,t)}getLocaleSortingFunction(){return(e,t)=>{let i=e.name,n=t.name;if(null==i&&null!=n)return-1;if(null!=i&&null==n)return 1;if(null==i&&null==n)return 0;const r=this.i18nService.collator?this.i18nService.collator.compare(i,n):i.localeCompare(n),s=t$.getType(e),o=t$.getType(t);if(0!==r||s!==nx.Login||o!==nx.Login)return r;const a=t$.getLogin(e),l=t$.getLogin(t);return null!=a.username&&(i+=a.username),null!=l.username&&(n+=l.username),this.i18nService.collator?this.i18nService.collator.compare(i,n):i.localeCompare(n)}}softDelete(e,t){return Qoe(this,void 0,void 0,function*(){let i=yield(0,bo._)(this.ciphers$(t));if(null==i)return;const n=e=>{null!=i[e]&&(i[e].deletedDate=(new Date).toISOString())};"string"==typeof e?n(e):e.forEach(n),yield this.clearCache(),yield this.encryptedCiphersState(t).update(()=>(null==i&&(i={}),i))})}softDeleteWithServer(e,t){return Qoe(this,arguments,void 0,function*(e,t,i=!1){if(yield(0,bo._)(this.sdkCipherCrudEnabled$))return yield this.cipherSdkService.softDeleteWithServer(e,t,i),void(yield this.clearCache(t));i?yield this.apiService.putDeleteCipherAdmin(e):yield this.apiService.putDeleteCipher(e),yield this.softDelete(e,t)})}softDeleteManyWithServer(e,t){return Qoe(this,arguments,void 0,function*(e,t,i=!1,n){if(yield(0,bo._)(this.sdkCipherCrudEnabled$))return yield this.cipherSdkService.softDeleteManyWithServer(e,t,i,n),void(yield this.clearCache(t));const r=new zoe(e,n);i?yield this.apiService.putDeleteManyCiphersAdmin(r):yield this.apiService.putDeleteManyCiphers(r),yield this.softDelete(e,t)})}restore(e,t){return Qoe(this,void 0,void 0,function*(){let i=yield(0,bo._)(this.ciphers$(t));if(null==i)return;const n=e=>{const t=e.id;null!=i[t]&&(i[t].deletedDate=null,i[t].revisionDate=e.revisionDate)};e.constructor.name===Array.name?e.forEach(n):n(e),yield this.clearCache(),yield this.encryptedCiphersState(t).update(()=>(null==i&&(i={}),i))})}restoreWithServer(e,t){return Qoe(this,arguments,void 0,function*(e,t,i=!1){if(yield(0,bo._)(this.sdkCipherCrudEnabled$))return yield this.cipherSdkService.restoreWithServer(e,t,i),void(yield this.clearCache(t));let n;n=i?yield this.apiService.putRestoreCipherAdmin(e):yield this.apiService.putRestoreCipher(e),yield this.restore({id:e,revisionDate:n.revisionDate},t)})}restoreManyWithServer(e,t,i){return Qoe(this,void 0,void 0,function*(){if(yield(0,bo._)(this.sdkCipherCrudEnabled$))return yield this.cipherSdkService.restoreManyWithServer(e,t,i),void(yield this.clearCache(t));let n;if(i){const t=new Koe(e,i);n=yield this.apiService.putRestoreManyCiphersAdmin(t)}else{const t=new Koe(e);n=yield this.apiService.putRestoreManyCiphers(t)}const r=[];for(const e of n.data)r.push({id:e.id,revisionDate:e.revisionDate});yield this.restore(r,t)})}getKeyForCipherKeyDecryption(e,t){return Qoe(this,void 0,void 0,function*(){return null==e.organizationId?yield(0,bo._)(this.keyService.userKey$(t)):yield(0,bo._)(this.keyService.orgKeys$(t).pipe((0,l.T)(t=>t[e.organizationId])))})}setAddEditCipherInfo(e,t){return Qoe(this,void 0,void 0,function*(){yield this.addEditCipherInfoState(t).update(()=>e,{shouldUpdate:t=>!(null==t&&null==e)})})}getRotatedData(e,t,i){return Qoe(this,void 0,void 0,function*(){if(null==e)throw new Error("Original user key is required to rotate ciphers");if(null==t)throw new Error("New user key is required to rotate ciphers");let n=[];const r=yield(0,bo._)(this.cipherViews$(i)),s=yield(0,bo._)(this.failedToDecryptCiphers$(i));if(!r)return n;if(s.length>0)throw new Error("Cannot rotate ciphers when decryption failures are present");const o=r.filter(e=>null==e.organizationId);if(0===o.length)return n;const a=yield this.configService.getFeatureFlag(Wv.PM22136_SdkCipherEncryption);return n=yield Promise.all(o.map(n=>Qoe(this,void 0,void 0,function*(){const r=a?yield this.cipherEncryptionService.encryptCipherForRotation(n,i,t):yield this.encrypt(n,i,t,e);return new Xoe(r)}))),n})}getDecryptedAttachmentBuffer(e,t,i,n,r){return Qoe(this,void 0,void 0,function*(){const s=yield this.configService.getFeatureFlag(Wv.PM19941MigrateCipherDomainToSdk),o=yield(0,bo._)(this.ciphers$(n).pipe((0,l.T)(t=>new AN(t[e]))));if(s&&!r){const e=yield i.arrayBuffer();return this.cipherEncryptionService.decryptAttachmentContent(o,t,new Uint8Array(e),n)}const a=yield nne.fromResponse(i),c=null!=t.key?t.key:o.organizationId?yield(0,bo._)(this.keyService.orgKeys$(n).pipe(p$(),(0,l.T)(e=>e[o.organizationId]))):yield(0,bo._)(this.keyService.userKey$(n).pipe(p$()));return yield this.encryptService.decryptFileData(a,c)})}localDataState(e){return this.stateProvider.getUser(e,kse)}encryptedCiphersState(e){return this.stateProvider.getUser(e,bse)}decryptedCiphersState(e){return this.stateProvider.getUser(e,wse)}addEditCipherInfoState(e){return this.stateProvider.getUser(e,Ise)}failedToDecryptCiphersState(e){return this.stateProvider.getUser(e,Sse)}encryptSharedCipher(e,t){return Qoe(this,void 0,void 0,function*(){const i=yield this.keyService.getUserKey(t);return yield this.encrypt(e,t,null,i)})}updateModelfromExistingCipher(e,t,i){return Qoe(this,void 0,void 0,function*(){const n=yield this.decrypt(t,i);if(e.passwordHistory=n.passwordHistory||[],e.type===nx.Login&&n.type===nx.Login)if(null!=n.login.password&&""!==n.login.password&&n.login.password!==e.login.password){const t=new TO;t.password=n.login.password,t.lastUsedDate=e.login.passwordRevisionDate=new Date,e.passwordHistory.splice(0,0,t)}else e.login.passwordRevisionDate=n.login.passwordRevisionDate;if(n.hasFields){const t=n.fields.filter(e=>e.type===ox.Hidden&&null!=e.name&&""!==e.name&&null!=e.value&&""!==e.value),i=null==e.fields?[]:e.fields.filter(e=>e.type===ox.Hidden&&null!=e.name&&""!==e.name);t.forEach(t=>{const n=i.find(e=>e.name===t.name);if(null==n||n.value!==t.value){const i=new TO;i.password=t.name+": "+t.value,i.lastUsedDate=new Date,e.passwordHistory.splice(0,0,i)}})}})}adjustPasswordHistoryLength(e){null!=e.passwordHistory&&0===e.passwordHistory.length?e.passwordHistory=null:null!=e.passwordHistory&&e.passwordHistory.length>5&&(e.passwordHistory=e.passwordHistory.slice(0,5))}shareAttachmentWithServer(e,t,i,n){return Qoe(this,void 0,void 0,function*(){const r=yield(0,bo._)(this.accountService.activeAccount$),s=yield this.apiService.nativeFetch(new Request(e.url,{cache:"no-store"}));if(200!==s.status)throw Error("Failed to download attachment: "+s.status.toString());const o=yield nne.fromResponse(s),a=yield this.keyService.getUserKey(r.id),l=yield this.encryptService.decryptFileData(o,a);let c;c=yield this.keyService.getOrgKey(i),c||(c=yield this.keyService.getUserKey());const u=yield this.keyService.makeDataEncKey(c),d=yield this.encryptService.encryptString(e.fileName,c),h=yield this.encryptService.encryptFileData(new Uint8Array(l),u[0]),p=new FormData;try{const e=new Blob([h.buffer],{type:"application/octet-stream"});p.append("key",u[1].encryptedString),p.append("data",e,d.encryptedString),p.append("lastKnownRevisionDate",n.toISOString())}catch(e){if(!bd.isNode||bd.isBrowser)throw e;p.append("key",u[1].encryptedString),p.append("lastKnownRevisionDate",n.toISOString()),p.append("data",Buffer.from(h.buffer),{filepath:d.encryptedString,contentType:"application/octet-stream"})}try{yield this.apiService.postShareCipherAttachment(t,e.id,p,i)}catch(e){throw new Error(e.getSingleMessage())}})}upgradeOldCipherAttachments(e,t,i){return Qoe(this,void 0,void 0,function*(){if(!e.hasOldAttachments)return e;let n=yield this.get(e.id,t);for(const r of e.attachments)if(null==r.key&&(null==i||r.id===i))try{const i=yield this.getAttachmentDownloadUrl(e.id,r),s=yield this.apiService.nativeFetch(new Request(i,{cache:"no-store"}));if(200!==s.status)throw new Error(`Failed to download attachment. Status: ${s.status}`);const o=yield this.getDecryptedAttachmentBuffer(e.id,r,s,t);n=yield this.saveAttachmentRawWithServer(n,r.fileName,o,t);const a=yield this.deleteAttachmentWithServer(e.id,r.id,t);n=new AN(a)}catch(e){throw this.logService.error(`Failed to upgrade attachment ${r.id}`,e),e}return yield this.decrypt(n,t)})}getAttachmentDownloadUrl(e,t){return Qoe(this,void 0,void 0,function*(){try{return(yield this.apiService.getAttachmentData(e,t.id)).url}catch(e){if(e instanceof iS&&404===e.statusCode&&t.url)return t.url;throw new Error(`Failed to get download URL for attachment ${t.id}`)}})}encryptObjProperty(e,t,i,n){return Qoe(this,void 0,void 0,function*(){const r=[],s=this;for(const o in i)i.hasOwnProperty(o)&&function(t,o){const a=Promise.resolve().then(()=>{const r=e[i[t]||t];return r&&""!==r?s.encryptService.encryptString(r,n):null}).then(e=>{o[t]=e});r.push(a)}(o,t);yield Promise.all(r)})}encryptCipherData(e,t,i){return Qoe(this,void 0,void 0,function*(){switch(e.type){case nx.Login:if(e.login=new CN,e.login.passwordRevisionDate=t.login.passwordRevisionDate,e.login.autofillOnPageLoad=t.login.autofillOnPageLoad,yield this.encryptObjProperty(t.login,e.login,{username:null,password:null,totp:null},i),null!=t.login.uris){e.login.uris=[],t.login.uris=t.login.uris.filter(e=>null!=e.uri&&""!==e.uri);for(let n=0;n<t.login.uris.length;n++){const r=new kN;r.match=t.login.uris[n].match,yield this.encryptObjProperty(t.login.uris[n],r,{uri:null},i);const s=yield this.encryptService.hash(t.login.uris[n].uri,"sha256");r.uriChecksum=yield this.encryptService.encryptString(s,i),e.login.uris.push(r)}}return void(null!=t.login.fido2Credentials&&(e.login.fido2Credentials=yield Promise.all(t.login.fido2Credentials.map(e=>Qoe(this,void 0,void 0,function*(){const t=new wN;return yield this.encryptObjProperty(e,t,{credentialId:null,keyType:null,keyAlgorithm:null,keyCurve:null,keyValue:null,rpId:null,rpName:null,userHandle:null,userName:null,userDisplayName:null,origin:null},i),t.counter=yield this.encryptService.encryptString(String(e.counter),i),t.discoverable=yield this.encryptService.encryptString(String(e.discoverable),i),t.creationDate=e.creationDate,t})))));case nx.SecureNote:return e.secureNote=new FN,void(e.secureNote.type=t.secureNote.type);case nx.Card:return e.card=new mN,void(yield this.encryptObjProperty(t.card,e.card,{cardholderName:null,brand:null,number:null,expMonth:null,expYear:null,code:null},i));case nx.Identity:return e.identity=new yN,void(yield this.encryptObjProperty(t.identity,e.identity,{title:null,firstName:null,middleName:null,lastName:null,address1:null,address2:null,address3:null,city:null,state:null,postalCode:null,country:null,company:null,email:null,phone:null,ssn:null,username:null,passportNumber:null,licenseNumber:null},i));case nx.SshKey:return e.sshKey=new RN,void(yield this.encryptObjProperty(t.sshKey,e.sshKey,{privateKey:null,publicKey:null,keyFingerprint:null},i));default:throw new Error("Unknown cipher type.")}})}getAutofillOnPageLoadDefault(){return Qoe(this,void 0,void 0,function*(){return yield(0,bo._)(this.autofillSettingsService.autofillOnPageLoadDefault$)})}getCipherForUrl(e,t,i,n,r){return Qoe(this,void 0,void 0,function*(){const s=r?"autofillOnPageLoad-"+e:e;if(!this.sortedCiphersCache.isCached(s)){let i=yield this.getAllDecryptedForUrl(e,t);if(!(null==i?void 0:i.length))return null;const n=yield(0,bo._)(this.localData$(t));if(n)for(const e of i){const t=n[e.id];t&&(e.localData=t)}if(r){const e=yield this.getAutofillOnPageLoadDefault();if(i=i.filter(t=>t.login.autofillOnPageLoad||null==t.login.autofillOnPageLoad&&!1!==e),0===i.length)return null}this.sortedCiphersCache.addCiphers(s,i)}return n?this.sortedCiphersCache.getLastLaunched(s):i?this.sortedCiphersCache.getLastUsed(s):this.sortedCiphersCache.getNext(s)})}clearEncryptedCiphersState(e){return Qoe(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(bse,{},e)})}clearDecryptedCiphersState(e){return Qoe(this,void 0,void 0,function*(){yield this.setDecryptedCiphers(null,e),yield this.setFailedDecryptedCiphers(null,e),this.clearSortedCiphers()})}clearSortedCiphers(){this.sortedCiphersCache.clear()}encryptCipher(e,t,i){return Qoe(this,void 0,void 0,function*(){if(null==i)throw new Error("Key to encrypt cipher must not be null. Use the org key, user key or cipher key.");return yield Promise.all([this.encryptObjProperty(e,t,{name:null,notes:null},i),this.encryptCipherData(t,e,i),this.encryptFields(e.fields,i).then(e=>{t.fields=e}),this.encryptPasswordHistories(e.passwordHistory,i).then(e=>{t.passwordHistory=e}),this.encryptAttachments(e.attachments,i).then(e=>{t.attachments=e})]),t})}encryptCipherWithCipherKey(e,t,i,n){return Qoe(this,void 0,void 0,function*(){let r;return r=null==t.key?yield this.keyService.makeCipherKey():yield this.encryptService.unwrapSymmetricKey(t.key,n),t.key=yield this.encryptService.wrapSymmetricKey(r,i),this.encryptCipher(e,t,r)})}getCipherKeyEncryptionEnabled(){return Qoe(this,void 0,void 0,function*(){const e=yield this.configService.getFeatureFlag(Wv.CipherKeyEncryption),t=yield(0,bo._)(this.configService.checkServerMeetsVersionRequirement$(eae));return e&&t})}decryptCiphersWithSdk(e,t){return Qoe(this,arguments,void 0,function*(e,t,i=!0){if(0===e.length)return[[],[]];if(i){const[i,n]=yield this.cipherEncryptionService.decryptManyLegacy(e,t);return[i.sort(this.getLocaleSortingFunction()),n]}const[n,r]=yield this.cipherEncryptionService.decryptManyWithFailures(e,t),s=r.map(e=>{const t=new RO(e);return t.name="[error: cannot decrypt]",t.decryptionFailure=!0,t});return[n.sort(this.getLocaleSortingFunction()),s]})}getFullCipherView(e){return Qoe(this,void 0,void 0,function*(){if(t$.isCipherListView(e)){const t=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id))),i=yield this.get(e.id,t);return this.decrypt(i,t)}return Promise.resolve(e)})}}class iae{constructor(e){this.ids=null==e?[]:e}}class nae{constructor(e){this.ids=null==e?[]:e}}var rae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class sae{constructor(e,t,i,n){this.cipherService=e,this.apiService=t,this.billingAccountProfileStateService=i,this.configService=n,this.hasArchiveFlagEnabled$=this.configService.getFeatureFlag$(Wv.PM19148_InnovationArchive).pipe((0,Gp.t)({refCount:!0,bufferSize:1}))}archivedCiphers$(e){return this.cipherService.cipherListViews$(e).pipe((0,Eo.p)(e=>null!=e),(0,l.T)(e=>e.filter(e=>t$.isArchived(e)&&!t$.isDeleted(e))))}userCanArchive$(e){return(0,jo.z)([this.billingAccountProfileStateService.hasPremiumFromAnySource$(e),this.configService.getFeatureFlag$(Wv.PM19148_InnovationArchive)]).pipe((0,l.T)(([e,t])=>e&&t),(0,Gp.t)({refCount:!0,bufferSize:1}))}userHasPremium$(e){return this.billingAccountProfileStateService.hasPremiumFromAnySource$(e).pipe((0,Gp.t)({refCount:!0,bufferSize:1}))}showSubscriptionEndedMessaging$(e){return(0,jo.z)([this.archivedCiphers$(e),this.userHasPremium$(e),this.hasArchiveFlagEnabled$]).pipe((0,l.T)(([e,t,i])=>i&&e.length>0&&!t),(0,Gp.t)({refCount:!0,bufferSize:1}))}archiveWithServer(e,t){return rae(this,void 0,void 0,function*(){const i=new iae(Array.isArray(e)?e:[e]),n=yield this.apiService.send("PUT","/ciphers/archive",i,!0,!0),r=new sk(n,mA),s=yield(0,bo._)(this.cipherService.ciphers$(t)),o=r.data.map(e=>{var t;return new uN(e,null===(t=s[e.id])||void 0===t?void 0:t.collectionIds)});return yield this.cipherService.upsert(o,t),r.data[0]})}unarchiveWithServer(e,t){return rae(this,void 0,void 0,function*(){const i=new nae(Array.isArray(e)?e:[e]),n=yield this.apiService.send("PUT","/ciphers/unarchive",i,!0,!0),r=new sk(n,mA),s=yield(0,bo._)(this.cipherService.ciphers$(t)),o=r.data.map(e=>{var t;return new uN(e,null===(t=s[e.id])||void 0===t?void 0:t.collectionIds)});return yield this.cipherService.upsert(o,t),r.data[0]})}}var oae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})},aae=function(e,t,i){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var n,r;if(i){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],i&&(r=n)}if("function"!=typeof n)throw new TypeError("Object not disposable.");r&&(n=function(){try{r.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:n,async:i})}else i&&e.stack.push({async:!0});return t},lae=function(e){return function(t){function i(i){t.error=t.hasError?new e(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var n,r=0;return function e(){for(;n=t.stack.pop();)try{if(!n.async&&1===r)return r=0,t.stack.push(n),Promise.resolve().then(e);if(n.dispose){var s=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(s).then(e,function(t){return i(t),e()})}else r|=1}catch(e){i(e)}if(1===r)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,i){var n=new Error(i);return n.name="SuppressedError",n.error=e,n.suppressed=t,n});var cae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})},uae=function(e,t,i){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var n,r;if(i){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],i&&(r=n)}if("function"!=typeof n)throw new TypeError("Object not disposable.");r&&(n=function(){try{r.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:n,async:i})}else i&&e.stack.push({async:!0});return t},dae=function(e){return function(t){function i(i){t.error=t.hasError?new e(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var n,r=0;return function e(){for(;n=t.stack.pop();)try{if(!n.async&&1===r)return r=0,t.stack.push(n),Promise.resolve().then(e);if(n.dispose){var s=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(s).then(e,function(t){return i(t),e()})}else r|=1}catch(e){i(e)}if(1===r)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,i){var n=new Error(i);return n.name="SuppressedError",n.error=e,n.suppressed=t,n});var hae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var pae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const vae=k.record(Ie,"folders",{deserializer:e=>jse.fromJSON(e),clearOn:["logout"]}),fae=new k(Ce,"decryptedFolders",{deserializer:e=>{var t;return null!==(t=null==e?void 0:e.map(e=>SU.fromJSON(e)))&&void 0!==t?t:[]},clearOn:["logout","lock"]});var mae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class gae{constructor(e){this.sdkService=e}getCode$(e){return(0,xo.O)(0,1e3).pipe((0,go.n)(()=>this.sdkService.client$.pipe((0,l.T)(t=>t.vault().totp().generate_totp(e)))),(0,Gp.t)({refCount:!0,bufferSize:1}))}}const yae=new m(Pe,"enablePasskeys",{deserializer:e=>e}),bae=new k(Pe,"showCardsCurrentTab",{deserializer:e=>e,clearOn:[]}),wae=new k(Pe,"showIdentitiesCurrentTab",{deserializer:e=>e,clearOn:[]}),Sae=new k(Pe,"clickItemsToAutofillOnVaultView",{deserializer:e=>e,clearOn:[]});var kae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Iae{constructor(){this.anonLayoutWrapperDataSubject=new Co.B}setAnonLayoutWrapperData(e){this.anonLayoutWrapperDataSubject.next(e)}anonLayoutWrapperData$(){return this.anonLayoutWrapperDataSubject.asObservable()}}class Cae{constructor(e,t,i,n,r,s){if(this.masterPasswordHash=e,this.key=t,this.masterPasswordHint=i,this.orgIdentifier=n,this.keys=r,s.kdfType===Mv.PBKDF2_SHA256)this.kdf=Mv.PBKDF2_SHA256,this.kdfIterations=s.iterations;else{if(s.kdfType!==Mv.Argon2id)throw new Error(`Unsupported KDF type: ${s}`);this.kdf=Mv.Argon2id,this.kdfIterations=s.iterations,this.kdfMemory=s.memory,this.kdfParallelism=s.parallelism}}static newConstructor(e,t,i,n,r){return new Cae(e.masterPasswordAuthenticationHash,t.masterKeyWrappedUserKey,i,n,r,t.kdf)}}class Tae extends JR{}var Pae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})},Fae=function(e,t,i){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var n,r;if(i){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],i&&(r=n)}if("function"!=typeof n)throw new TypeError("Object not disposable.");r&&(n=function(){try{r.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:n,async:i})}else i&&e.stack.push({async:!0});return t},Rae=function(e){return function(t){function i(i){t.error=t.hasError?new e(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var n,r=0;return function e(){for(;n=t.stack.pop();)try{if(!n.async&&1===r)return r=0,t.stack.push(n),Promise.resolve().then(e);if(n.dispose){var s=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(s).then(e,function(t){return i(t),e()})}else r|=1}catch(e){i(e)}if(1===r)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,i){var n=new Error(i);return n.name="SuppressedError",n.error=e,n.suppressed=t,n});var xae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Aae{getPremiumInterest(e){return xae(this,void 0,void 0,function*(){return null})}setPremiumInterest(e,t){return xae(this,void 0,void 0,function*(){})}clearPremiumInterest(e){return xae(this,void 0,void 0,function*(){})}}Aae.ɵfac=function(e){return new(e||Aae)},Aae.ɵprov=a.jDH({token:Aae,factory:Aae.ɵfac});var Dae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Eae{constructor(){this.dialogRef=(0,a.WQX)(nh),this.formBuilder=(0,a.WQX)(Il.ok),this.masterPasswordUnlockService=(0,a.WQX)(SA),this.accountService=(0,a.WQX)(Zk),this.toastService=(0,a.WQX)(qb),this.i18nService=(0,a.WQX)(Ul),this.migrationPasswordForm=this.formBuilder.group({masterPassword:["",[Il.k0.required]]}),this.submit=()=>Dae(this,void 0,void 0,function*(){const e=this.migrationPasswordForm.controls.masterPassword;if(!e.value||e.invalid)return;const{userId:t}=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,Eo.p)(e=>null!=e),(0,l.T)(e=>({userId:e.id}))));(yield this.masterPasswordUnlockService.proofOfDecryption(e.value,t))?this.dialogRef.close(e.value):this.toastService.showToast({variant:"error",message:this.i18nService.t("incorrectPassword")})})}static open(e){return e.open(Eae)}}Eae.ɵfac=function(e){return new(e||Eae)},Eae.ɵcmp=Fl.VBU({type:Eae,selectors:[["ng-component"]],decls:33,vars:33,consts:[[3,"bitSubmit","formGroup"],["bitDialogTitle","",1,"tw-font-semibold"],["bitDialogContent",""],["bitLink","","href","https://bitwarden.com/help/kdf-algorithms/","target","_blank","rel","noreferrer","aria-label","external link"],["aria-hidden","true",1,"bwi","bwi-external-link"],["bitInput","","type","password","formControlName","masterPassword",1,"tw-font-mono"],["type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle",""],["bitDialogFooter",""],["type","submit","bitButton","","bitFormButton","","buttonType","primary",3,"disabled"],["type","button","bitButton","","bitFormButton","","buttonType","secondary","bitDialogClose",""]],template:function(e,t){1&e&&(Fl.j41(0,"form",0)(1,"bit-dialog")(2,"div",1),Fl.EFF(3),Fl.nI1(4,"i18n"),Fl.k0s(),Fl.j41(5,"div",2)(6,"p"),Fl.EFF(7),Fl.nI1(8,"i18n"),Fl.j41(9,"a",3),Fl.EFF(10),Fl.nI1(11,"i18n"),Fl.nrm(12,"i",4),Fl.k0s()(),Fl.j41(13,"bit-form-field")(14,"bit-label"),Fl.EFF(15),Fl.nI1(16,"i18n"),Fl.k0s(),Fl.j41(17,"bit-hint"),Fl.EFF(18),Fl.nI1(19,"i18n"),Fl.k0s(),Fl.nrm(20,"input",5),Fl.nI1(21,"i18n"),Fl.nrm(22,"button",6),Fl.nI1(23,"i18n"),Fl.nI1(24,"i18n"),Fl.k0s()(),Fl.qex(25,7),Fl.j41(26,"button",8)(27,"span"),Fl.EFF(28),Fl.nI1(29,"i18n"),Fl.k0s()(),Fl.j41(30,"button",9),Fl.EFF(31),Fl.nI1(32,"i18n"),Fl.k0s(),Fl.bVm(),Fl.k0s()()),2&e&&(Fl.Y8G("bitSubmit",t.submit)("formGroup",t.migrationPasswordForm),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(4,13,"updateEncryptionSettingsTitle")," "),Fl.R7$(4),Fl.SpI(" ",Fl.bMT(8,15,"updateEncryptionSettingsDesc")," "),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(11,17,"learnMore")," "),Fl.R7$(5),Fl.JRh(Fl.bMT(16,19,"masterPass")),Fl.R7$(3),Fl.JRh(Fl.bMT(19,21,"confirmIdentityToContinue")),Fl.R7$(2),Fl.BMQ("title",Fl.bMT(21,23,"masterPass")),Fl.R7$(2),Fl.BMQ("title",Fl.bMT(23,25,"toggleVisibility"))("aria-label",Fl.bMT(24,27,"toggleVisibility")),Fl.R7$(4),Fl.Y8G("disabled",t.migrationPasswordForm.invalid),Fl.R7$(2),Fl.JRh(Fl.bMT(29,29,"updateSettings")),Fl.R7$(3),Fl.SpI(" ",Fl.bMT(32,31,"later")," "))},dependencies:[Fh,ch,Ph,Hh,uw,kl.MD,sf,id,td,Ql,Zl,Il.X1,Il.qT,Il.me,Il.BC,Il.cb,Il.j4,Il.JD,pc,jd,Md,Gu,Ac,hu,fu,ju,iw,nw,rf],encapsulation:2,changeDetection:0});var $ae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Oae=new k(Be,"encryptedMigrationDismissed",{deserializer:e=>null!=e?new Date(e):null,clearOn:[]}),Uae=["/vault","/tabs/vault","/tabs/current"];class Mae{}class Nae extends a.zcH{constructor(){super(...arguments),this.injector=(0,a.WQX)(a.zZn)}handleError(e){try{this.injector.get(Za,null).error("Unhandled error in angular",e)}catch(t){super.handleError(e)}}}Nae.ɵfac=(()=>{let e;return function(t){return(e||(e=Fl.xGo(Nae)))(t||Nae)}})(),Nae.ɵprov=a.jDH({token:Nae,factory:Nae.ɵfac});class Vae{}class Bae{signal(e){return(0,a.vPA)(e.initialValue)}formGroup(e){return e.control}}Bae.ɵfac=function(e){return new(e||Bae)},Bae.ɵprov=a.jDH({token:Bae,factory:Bae.ɵfac,providedIn:"root"});var jae=i(63609);class Gae{constructor(){this._onCreated=new Co.B,this._onClose=new Co.B,this._onClosed=new Co.B,this._onShow=new Co.B,this._onShown=new Co.B,this.onCreated=this._onCreated.asObservable(),this.onClose=this._onClose.asObservable(),this.onClosed=this._onClosed.asObservable(),this.onShow=this._onShow.asObservable(),this.onShown=this._onShow.asObservable()}show(){this._onShow.next()}shown(){this._onShown.next()}close(e){this.lastResult=e,this._onClose.next(e)}closed(){this._onClosed.next(this.lastResult)}created(e){this._onCreated.next(e)}onClosedPromise(){return this.onClosed.pipe((0,dm.$)()).toPromise()}}const Lae=["modalContent"];function zae(e,t){}class _ae{constructor(e,t,i,n){this.cd=e,this.el=t,this.focusTrapFactory=i,this.modalRef=n}ngAfterViewInit(){this.loadChildComponent(this.childComponentType),null!=this.setComponentParameters&&this.setComponentParameters(this.componentRef.instance),this.cd.detectChanges(),this.modalRef.created(this.el.nativeElement),this.focusTrap=this.focusTrapFactory.create(this.el.nativeElement.querySelector(".modal-dialog")),null==this.el.nativeElement.querySelector("[appAutoFocus]")&&this.focusTrap.focusFirstTabbableElementWhenReady()}loadChildComponent(e){this.modalContentRef.clear(),this.componentRef=this.modalContentRef.createComponent(e)}ngOnDestroy(){this.componentRef&&this.componentRef.destroy(),this.focusTrap.destroy()}close(){this.modalRef.close()}getFocus(){const e=this.el.nativeElement.querySelector("[appAutoFocus]");null==e||e.focus()}}_ae.ɵfac=function(e){return new(e||_ae)(Fl.rXU(o.gRc),Fl.rXU(Fl.aKT),Fl.rXU(jae.Fp),Fl.rXU(Gae))},_ae.ɵcmp=Fl.VBU({type:_ae,selectors:[["app-modal"]],viewQuery:function(e,t){if(1&e&&Fl.GBs(Lae,7,Fl.c1b),2&e){let e;Fl.mGM(e=Fl.lsd())&&(t.modalContentRef=e.first)}},standalone:!1,decls:2,vars:0,consts:[["modalContent",""]],template:function(e,t){1&e&&Fl.DNE(0,zae,0,0,"ng-template",null,0,Fl.C5r)},encapsulation:2});class Kae{constructor(e,t){this._parentInjector=e,this._additionalTokens=t}get(e,t,i){var n;return null!==(n=this._additionalTokens.get(e))&&void 0!==n?n:this._parentInjector.get(e,t)}}var Xae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class qae{constructor(e){this.injector=e,this.modalList=[],document.addEventListener("keyup",e=>{"Escape"===e.key&&this.modalCount>0&&this.topModal.instance.close()})}get modalCount(){return this.modalList.length}get topModal(){return this.modalList[this.modalCount-1]}openViewRef(e,t){return Xae(this,arguments,void 0,function*(e,t,i=null){const[n,r]=this.openInternal(t,e);return r.instance.setComponentParameters=i,t.insert(r.hostView),yield n.onCreated.pipe((0,dm.$)()).toPromise(),[n,r.instance.componentRef.instance]})}closeAll(){this.modalList.forEach(e=>e.instance.close())}openInternal(e,t){const[i,n]=this.createModalComponent(e);return n.instance.childComponentType=t,i.onClosed.pipe((0,dm.$)()).subscribe(()=>{n.destroy(),this.modalList.pop(),this.modalCount>0&&this.topModal.instance.getFocus()}),this.setupHandlers(i),this.modalList.push(n),[i,n]}setupHandlers(e){let t=null;e.onCreated.pipe((0,dm.$)()).subscribe(i=>{document.body.classList.add("modal-open");const n=i.querySelector(".modal"),r=n.querySelector(".modal-dialog");t=document.createElement("div"),t.className="modal-backdrop fade",t.style.zIndex=`${this.modalCount}040`,n.prepend(t),r.addEventListener("click",e=>{e.stopPropagation()}),r.style.zIndex=`${this.modalCount}050`;const s=Array.from(i.querySelectorAll('.modal-backdrop, .modal *[data-dismiss="modal"]'));for(const t of s)t.addEventListener("click",()=>{e.close()})}),e.onClose.pipe((0,dm.$)()).subscribe(()=>{e.closed(),0===this.modalCount&&document.body.classList.remove("modal-open")})}createModalComponent(e){const t=new Gae,i=new WeakMap;i.set(Gae,t);const n=new Kae(this.injector,i);return[t,e.createComponent(_ae,{injector:n})]}}qae.ɵfac=function(e){return new(e||qae)(a.KVO(a.zZn))},qae.ɵprov=a.jDH({token:qae,factory:qae.ɵfac});var Wae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Yae=[qae,k$,{provide:AT,useValue:window},{provide:DT,useValue:document},{provide:Fl.xe9,useFactory:e=>e.translationLocale,deps:[Ul]},{provide:NT,useFactory:e=>e.supportsSecureStorage(),deps:[Hb]},{provide:VT,useValue:"./locales"},{provide:BT,useFactory:e=>e.navigator.language,deps:[AT]},{provide:MT,useFactory:e=>(t,i)=>Wae(void 0,void 0,void 0,function*(){return Promise.resolve(e.send("logout",{logoutReason:t,userId:i}))}),deps:[bk]},{provide:jT,useValue:!0},{provide:GT,useFactory:e=>dee.createSystemThemeFromWindow(e),deps:[AT]},{provide:K$,useClass:class{constructor(e,t=Ip.System){this.globalStateProvider=e,this.defaultTheme=t,this.selectedThemeState=this.globalStateProvider.get(X$),this.selectedTheme$=this.selectedThemeState.state$.pipe((0,l.T)(e=>null==e||Object.values(Ip).includes(e)?e:null),(0,l.T)(e=>null!=e?e:this.defaultTheme))}setSelectedTheme(e){return _$(this,void 0,void 0,function*(){yield this.selectedThemeState.update(()=>e,{shouldUpdate:t=>t!==e})})}},deps:[d]},{provide:Vae,useClass:dee,deps:[K$,GT]},{provide:Tk,useClass:class{constructor(e,t){this.storageService=e,this.logService=t}getAppId(){return jre(this,void 0,void 0,function*(){return this.logService.info("Retrieving application id"),yield this.getEnsuredValue("global_applicationId_appId")})}getAnonymousAppId(){return jre(this,void 0,void 0,function*(){return yield this.getEnsuredValue("global_applicationId_appId")})}getEnsuredValue(e){return jre(this,void 0,void 0,function*(){let t=yield this.storageService.get(e);return null==t&&(t=bd.newGuid(),yield this.storageService.save(e,t)),t})}},deps:[$T,Za]},{provide:zb,useClass:class{constructor(e,t,i,n=100){this.cryptoFunctionService=e,this.apiService=t,this.hibpApiService=i,this.maxConcurrent=n,this.passwordLeakedSubject=new Co.B,this.maxConcurrent=n,this.passwordLeakedSubject.pipe((0,Xx.Z)(e=>poe(this,void 0,void 0,function*(){try{const t=yield this.fetchLeakedPasswordCount(e.password);e.resolve(t)}catch(t){e.reject(t)}}),this.maxConcurrent)).subscribe()}passwordLeaked(e){return poe(this,void 0,void 0,function*(){return new Promise((t,i)=>{this.passwordLeakedSubject.next({password:e,resolve:t,reject:i})})})}fetchLeakedPasswordCount(e){return poe(this,void 0,void 0,function*(){const t=yield this.cryptoFunctionService.hash(e,"sha1"),i=bd.fromBufferToHex(t).toUpperCase(),n=i.substr(0,5),r=i.substr(5),s=yield this.apiService.nativeFetch(new Request("https://api.pwnedpasswords.com/range/"+n)),o=(yield s.text()).split(/\r?\n/).find(e=>e.split(":")[0]===r);return null!=o?parseInt(o.split(":")[1],10):0})}breachedAccounts(e){return poe(this,void 0,void 0,function*(){return this.hibpApiService.getHibpBreach(e)})}},deps:[FI,eI,Zie]},{provide:Zie,useClass:Zie,deps:[eI]},{provide:Rd,useClass:class{constructor(e,t,i,n,r,s){this.accountService=e,this.messageSender=t,this.keyService=i,this.apiService=n,this.stateService=r,this.tokenService=s,this.activeAccountStatus$=this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id),(0,go.n)(e=>this.authStatusFor$(e))),this.authStatuses$=this.accountService.accounts$.pipe((0,l.T)(e=>Object.keys(e)),(0,go.n)(e=>0===e.length?(0,Go.of)([]):(0,jo.z)(e.map(e=>this.authStatusFor$(e).pipe((0,l.T)(t=>({userId:e,status:t})))))),(0,l.T)(e=>e.reduce((e,{userId:t,status:i})=>(e[t]=i,e),{})))}authStatusFor$(e){return bd.isGuid(e)?(0,jo.z)([this.keyService.getInMemoryUserKeyFor$(e),this.tokenService.hasAccessToken$(e)]).pipe((0,l.T)(([e,t])=>t?e?Pd.Unlocked:Pd.Locked:Pd.LoggedOut),(0,mo.F)(),(0,Gp.t)({bufferSize:1,refCount:!1})):(0,Go.of)(Pd.LoggedOut)}getAuthStatus(e){return Nte(this,void 0,void 0,function*(){return null!=e||(e=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)))),yield(0,bo._)(this.authStatusFor$(e))})}logOut(e,t){e(),this.messageSender.send("loggedOut",{userId:t})}},deps:[Zk,bk,Bp,eI,fo,iee]},{provide:Cne,useClass:Ine,deps:[yne,Jk,Bp,Yb]},{provide:EA,useClass:class{constructor(e,t,i,n,r,s){this.kdfConfigService=e,this.changeKdfService=t,this.logService=i,this.configService=n,this.masterPasswordService=r,this.syncService=s,this.migrations=[],this.isRunningMigration=!1,this.migrations.push({name:"Minimum PBKDF2 Iteration Count Migration",migration:new fne(e,t,i,n,r)})}runMigrations(e,t){return mne(this,void 0,void 0,function*(){ak(e,"userId");const i=yield this.needsMigrations(e);if("noMigrationNeeded"!==i&&("needsMigrationWithMasterPassword"!==i||null!=t))try{if(this.isRunningMigration)return;this.isRunningMigration=!0,this.logService.mark("[Encrypted Migrator] Start"),this.logService.info(`[Encrypted Migrator] Starting migrations for user: ${e}`);let i=!1;for(const{name:n,migration:r}of this.migrations)if("noMigrationNeeded"!==(yield r.needsMigration(e))){this.logService.info(`[Encrypted Migrator] Running migration: ${n}`);const s=performance.now();yield r.runMigrations(e,t),this.logService.measure(s,"[Encrypted Migrator]",n,"ExecutionTime"),i=!0}this.logService.mark("[Encrypted Migrator] Finish"),this.logService.info(`[Encrypted Migrator] Completed migrations for user: ${e}`),i&&(yield this.syncService.fullSync(!0))}catch(t){throw this.logService.error(`[Encrypted Migrator] Error running migrations for user: ${e}`,t),t}finally{this.isRunningMigration=!1}})}needsMigrations(e){return mne(this,void 0,void 0,function*(){ak(e,"userId");const t=yield Promise.all(this.migrations.map(t=>mne(this,[t],void 0,function*({migration:t}){return t.needsMigration(e)})));return t.includes("needsMigrationWithMasterPassword")?"needsMigrationWithMasterPassword":t.includes("needsMigration")?"needsMigration":"noMigrationNeeded"})}isRunningMigrations(){return this.isRunningMigration}},deps:[_v,Cne,Za,Kb,Wb,qx]},{provide:Ew,useClass:class{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,v,f,m,g,y,b,w,S,k,I,C,T,P){this.accountService=e,this.masterPasswordService=t,this.keyService=i,this.apiService=n,this.tokenService=r,this.appIdService=s,this.platformUtilsService=o,this.messagingService=a,this.logService=l,this.keyConnectorService=c,this.environmentService=u,this.stateService=d,this.twoFactorService=h,this.i18nService=p,this.encryptService=v,this.passwordStrengthService=f,this.policyService=m,this.deviceTrustService=g,this.authRequestService=y,this.userDecryptionOptionsService=b,this.stateProvider=w,this.billingAccountProfileStateService=S,this.vaultTimeoutSettingsService=k,this.kdfConfigService=I,this.taskSchedulerService=C,this.configService=T,this.accountCryptographicStateService=P,this.authenticationTimeoutSubject=new Dd.t(!1),this.passwordPrelogin={email:null,kdfConfig:null,promise:null,version:0},this.authenticationSessionTimeout$=this.authenticationTimeoutSubject.asObservable(),this.currentAuthnTypeState=this.stateProvider.get(XS),this.loginStrategyCacheState=this.stateProvider.get(YS),this.loginStrategyCacheExpirationState=this.stateProvider.get(qS),this.authRequestPushNotificationState=this.stateProvider.get(WS),this.taskSchedulerService.registerTaskHandler(Xa,()=>HS(this,void 0,void 0,function*(){this.authenticationTimeoutSubject.next(!0);try{yield this.clearCache()}catch(e){this.logService.error("Failed to clear cache during session timeout",e)}})),this.currentAuthType$=this.currentAuthnTypeState.state$,this.loginStrategy$=this.currentAuthnTypeState.state$.pipe((0,mo.F)(),(0,Yp.v)(this.loginStrategyCacheState.state$),this.initializeLoginStrategy.bind(this),(0,Gp.t)({refCount:!0,bufferSize:1}))}getEmail(){return HS(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.loginStrategy$);return e&&"email$"in e?yield(0,bo._)(e.email$):null})}getMasterPasswordHash(){return HS(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.loginStrategy$);return e&&"serverMasterKeyHash$"in e?yield(0,bo._)(e.serverMasterKeyHash$):null})}getSsoEmail2FaSessionToken(){return HS(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.loginStrategy$);return e&&"ssoEmail2FaSessionToken$"in e?yield(0,bo._)(e.ssoEmail2FaSessionToken$):null})}getAccessCode(){return HS(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.loginStrategy$);return e&&"accessCode$"in e?yield(0,bo._)(e.accessCode$):null})}getAuthRequestId(){return HS(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.loginStrategy$);return e&&"authRequestId$"in e?yield(0,bo._)(e.authRequestId$):null})}logIn(e){return HS(this,void 0,void 0,function*(){yield this.clearCache(),this.authenticationTimeoutSubject.next(!1),yield this.currentAuthnTypeState.update(t=>e.type);const t=yield(0,bo._)(this.loginStrategy$),i=Object.assign({},e),n=yield null==t?void 0:t.logIn(i);if(null==n||n.requiresTwoFactor||n.requiresDeviceVerification?(yield this.loginStrategyCacheState.update(e=>{var i;return null!==(i=null==t?void 0:t.exportCache())&&void 0!==i?i:null}),yield this.startSessionTimeout()):yield this.clearCache(),!n)throw new Error("No auth result returned");return n})}logInTwoFactor(e){return HS(this,void 0,void 0,function*(){if(!(yield this.isSessionValid()))throw new Error(this.i18nService.t("sessionTimeout"));const t=yield(0,bo._)(this.loginStrategy$);if(null==t)throw new Error("No login strategy found.");try{const i=yield t.logInTwoFactor(e);return null==i||i.requiresTwoFactor||(yield this.clearCache()),i}catch(e){throw e instanceof iS||(yield this.clearCache()),e}})}logInNewDeviceVerification(e){return HS(this,void 0,void 0,function*(){if(!(yield this.isSessionValid()))throw new Error(this.i18nService.t("sessionTimeout"));const t=yield(0,bo._)(this.loginStrategy$);if(null==t)throw new Error("No login strategy found.");if(!("logInNewDeviceVerification"in t))throw new Error("Current login strategy does not support device verification.");try{const i=yield t.logInNewDeviceVerification(e);return null===i||i.requiresDeviceVerification||(yield this.clearCache()),i}catch(e){throw e instanceof iS||(yield this.clearCache()),e}})}makePasswordPreLoginMasterKey(e,t){return HS(this,void 0,void 0,function*(){var i;if(t=t.trim().toLowerCase(),yield this.configService.getFeatureFlag(Wv.PM23801_PrefetchPasswordPrelogin)){let i=null;if(this.passwordPrelogin.email===t)if(this.passwordPrelogin.kdfConfig)i=this.passwordPrelogin.kdfConfig;else if(null!=this.passwordPrelogin.promise){try{yield this.passwordPrelogin.promise}catch(e){this.logService.error("Failed to prefetch prelogin data, falling back to fetching now.",e)}i=this.passwordPrelogin.kdfConfig}if(!i)try{const e=yield this.apiService.postPrelogin(new eS(t));i=this.buildKdfConfigFromPrelogin(e)}catch(e){if(null==e||404!==e.statusCode)throw e}if(!i)throw new Error("KDF config is required");return i.validateKdfConfigForPrelogin(),yield this.keyService.makeMasterKey(e,t,i)}let n;try{const e=yield this.apiService.postPrelogin(new eS(t));n=null!==(i=this.buildKdfConfigFromPrelogin(e))&&void 0!==i?i:void 0}catch(e){if(null==e||404!==e.statusCode)throw e}if(!n)throw new Error("KDF config is required");return n.validateKdfConfigForPrelogin(),yield this.keyService.makeMasterKey(e,t,n)})}getPasswordPrelogin(e){return HS(this,void 0,void 0,function*(){const t=e.trim().toLowerCase(),i=++this.passwordPrelogin.version;this.passwordPrelogin.email=t,this.passwordPrelogin.kdfConfig=null;const n=(()=>HS(this,void 0,void 0,function*(){try{const e=yield this.apiService.postPrelogin(new eS(t));return this.buildKdfConfigFromPrelogin(e)}catch(e){if(null==e||404!==e.statusCode)throw e;return null}}))();this.passwordPrelogin.promise=n,n.then(e=>{this.passwordPrelogin.email===t&&this.passwordPrelogin.version===i&&e&&(this.passwordPrelogin.kdfConfig=e)}).catch(()=>{}).finally(()=>{this.passwordPrelogin.email===t&&this.passwordPrelogin.version===i&&(this.passwordPrelogin.promise=null)})})}clearCache(){return HS(this,void 0,void 0,function*(){yield this.currentAuthnTypeState.update(e=>null),yield this.loginStrategyCacheState.update(e=>null),this.authenticationTimeoutSubject.next(!1),yield this.clearSessionTimeout(),this.passwordPrelogin.version++,this.passwordPrelogin.email=null,this.passwordPrelogin.kdfConfig=null,this.passwordPrelogin.promise=null})}startSessionTimeout(){return HS(this,void 0,void 0,function*(){yield this.clearSessionTimeout(),yield this.loginStrategyCacheExpirationState.update(e=>new Date(Date.now()+JS)),this.sessionTimeoutSubscription=this.taskSchedulerService.setTimeout(Xa,JS)})}clearSessionTimeout(){return HS(this,void 0,void 0,function*(){var e;yield this.loginStrategyCacheExpirationState.update(e=>null),null===(e=this.sessionTimeoutSubscription)||void 0===e||e.unsubscribe()})}isSessionValid(){return HS(this,void 0,void 0,function*(){if(null==(yield(0,bo._)(this.loginStrategyCacheState.state$)))return!1;const e=yield(0,bo._)(this.loginStrategyCacheExpirationState.state$);return!(null!=e&&e<new Date)||(yield this.clearCache(),!1)})}initializeLoginStrategy(e){const t=[this.accountService,this.masterPasswordService,this.keyService,this.encryptService,this.apiService,this.tokenService,this.appIdService,this.platformUtilsService,this.messagingService,this.logService,this.stateService,this.twoFactorService,this.userDecryptionOptionsService,this.billingAccountProfileStateService,this.vaultTimeoutSettingsService,this.kdfConfigService,this.environmentService,this.configService,this.accountCryptographicStateService];return e.pipe((0,l.T)(([e,i])=>{var n,r,s,o,a;if(null==e)return null;switch(e){case Vw.Password:return new $S(null!==(n=null==i?void 0:i.password)&&void 0!==n?n:new ES,this.passwordStrengthService,this.policyService,this,...t);case Vw.Sso:return new NS(null!==(r=null==i?void 0:i.sso)&&void 0!==r?r:new MS,this.keyConnectorService,this.deviceTrustService,this.authRequestService,this.i18nService,...t);case Vw.UserApiKey:return new GS(null!==(s=null==i?void 0:i.userApiKey)&&void 0!==s?s:new jS,this.keyConnectorService,...t);case Vw.AuthRequest:return new AS(null!==(o=null==i?void 0:i.authRequest)&&void 0!==o?o:new xS,this.deviceTrustService,...t);case Vw.WebAuthn:return new KS(null!==(a=null==i?void 0:i.webAuthn)&&void 0!==a?a:new _S,...t)}}))}buildKdfConfigFromPrelogin(e){return null==e?null:e.kdf===Mv.PBKDF2_SHA256?new jv(e.kdfIterations):new Gv(e.kdfIterations,e.kdfMemory,e.kdfParallelism)}},deps:[Zk,Yb,Bp,eI,iee,Tk,Hb,bk,Za,wT,mk,fo,nP,Ul,$G,af,Jb,tI,Uw,Ow,d,T$,qp,_v,La,Kb,oI]},{provide:wre,useClass:class{constructor(e,t){this.logService=e,this.azureFileUploadService=new lse(e,t),this.bitwardenFileUploadService=new dse}upload(e,t,i,n){return hse(this,void 0,void 0,function*(){try{switch(e.fileUploadType){case fp.Direct:yield this.bitwardenFileUploadService.upload(t.encryptedString,i,e=>n.postDirect(e));break;case fp.Azure:yield this.azureFileUploadService.upload(e.url,i,n.renewFileUploadUrl);break;default:throw new Error("Unknown file upload type")}}catch(e){throw yield n.rollback(),e}})}},deps:[Za,eI]},{provide:Noe,useClass:class{constructor(e,t){this.apiService=e,this.fileUploadService=t}upload(e,t,i,n,r){return hae(this,void 0,void 0,function*(){const s={key:r[1].encryptedString,fileName:t.encryptedString,fileSize:i.buffer.byteLength,adminRequest:n,lastKnownRevisionDate:e.revisionDate};let o;try{const r=yield this.apiService.postCipherAttachment(e.id,s);o=n?r.cipherMiniResponse:r.cipherResponse,yield this.fileUploadService.upload(r,t,i,this.generateMethods(r,o,s.adminRequest))}catch(e){throw e instanceof iS?new Error(e.getSingleMessage()):e}return o})}generateMethods(e,t,i){return{postDirect:this.generatePostDirectCallback(e,i),renewFileUploadUrl:this.generateRenewFileUploadUrlCallback(e,t,i),rollback:this.generateRollbackCallback(t,e,i)}}generatePostDirectCallback(e,t){return i=>{const n=t?e.cipherMiniResponse:e.cipherResponse;return this.apiService.postAttachmentFile(n.id,e.attachmentId,i)}}generateRenewFileUploadUrlCallback(e,t,i){return()=>hae(this,void 0,void 0,function*(){const i=yield this.apiService.renewAttachmentUploadUrl(t.id,e.attachmentId);return null==i?void 0:i.url})}generateRollbackCallback(e,t,i){return()=>hae(this,void 0,void 0,function*(){i?yield this.apiService.deleteCipherAttachmentAdmin(e.id,t.attachmentId):yield this.apiService.deleteCipherAttachment(e.id,t.attachmentId)})}},deps:[eI,wre]},{provide:YE,useClass:HE,deps:[u,Jb,Zk]},{provide:Moe,useClass:class{constructor(e,t){this.sdkService=e,this.logService=t}createWithServer(e,t,i){return Voe(this,void 0,void 0,function*(){return yield(0,bo._)(this.sdkService.userClient$(t).pipe((0,go.n)(t=>Voe(this,void 0,void 0,function*(){const n={stack:[],error:void 0,hasError:!1};try{if(!t)throw new Error("SDK not available");const r=Boe(n,t.take(),!1),s=e.toSdkCreateCipherRequest();let o;return o=i?yield r.value.vault().ciphers().admin().create(s):yield r.value.vault().ciphers().create(s),RO.fromSdkCipherView(o)}catch(e){n.error=e,n.hasError=!0}finally{joe(n)}})),(0,Ed.W)(e=>{throw this.logService.error(`Failed to create cipher: ${e}`),e})))})}updateWithServer(e,t,i,n){return Voe(this,void 0,void 0,function*(){return yield(0,bo._)(this.sdkService.userClient$(t).pipe((0,go.n)(t=>Voe(this,void 0,void 0,function*(){const r={stack:[],error:void 0,hasError:!1};try{if(!t)throw new Error("SDK not available");const s=Boe(r,t.take(),!1),o=e.toSdkUpdateCipherRequest();let a;return a=n?yield s.value.vault().ciphers().admin().edit(o,(null==i?void 0:i.toSdkCipherView())||(new RO).toSdkCipherView()):yield s.value.vault().ciphers().edit(o),RO.fromSdkCipherView(a)}catch(e){r.error=e,r.hasError=!0}finally{joe(r)}})),(0,Ed.W)(e=>{throw this.logService.error(`Failed to update cipher: ${e}`),e})))})}deleteWithServer(e,t){return Voe(this,arguments,void 0,function*(e,t,i=!1){return yield(0,bo._)(this.sdkService.userClient$(t).pipe((0,go.n)(t=>Voe(this,void 0,void 0,function*(){const n={stack:[],error:void 0,hasError:!1};try{if(!t)throw new Error("SDK not available");const r=Boe(n,t.take(),!1);i?yield r.value.vault().ciphers().admin().delete(Yk(e)):yield r.value.vault().ciphers().delete(Yk(e))}catch(e){n.error=e,n.hasError=!0}finally{joe(n)}})),(0,Ed.W)(e=>{throw this.logService.error(`Failed to delete cipher: ${e}`),e})))})}deleteManyWithServer(e,t){return Voe(this,arguments,void 0,function*(e,t,i=!1,n){return yield(0,bo._)(this.sdkService.userClient$(t).pipe((0,go.n)(t=>Voe(this,void 0,void 0,function*(){const r={stack:[],error:void 0,hasError:!1};try{if(!t)throw new Error("SDK not available");const s=Boe(r,t.take(),!1);if(i){if(null==n)throw new Error("Organization ID is required for admin delete.");yield s.value.vault().ciphers().admin().delete_many(e.map(e=>Yk(e)),Yk(n))}else yield s.value.vault().ciphers().delete_many(e.map(e=>Yk(e)))}catch(e){r.error=e,r.hasError=!0}finally{joe(r)}})),(0,Ed.W)(e=>{throw this.logService.error(`Failed to delete multiple ciphers: ${e}`),e})))})}softDeleteWithServer(e,t){return Voe(this,arguments,void 0,function*(e,t,i=!1){return yield(0,bo._)(this.sdkService.userClient$(t).pipe((0,go.n)(t=>Voe(this,void 0,void 0,function*(){const n={stack:[],error:void 0,hasError:!1};try{if(!t)throw new Error("SDK not available");const r=Boe(n,t.take(),!1);i?yield r.value.vault().ciphers().admin().soft_delete(Yk(e)):yield r.value.vault().ciphers().soft_delete(Yk(e))}catch(e){n.error=e,n.hasError=!0}finally{joe(n)}})),(0,Ed.W)(e=>{throw this.logService.error(`Failed to soft delete cipher: ${e}`),e})))})}softDeleteManyWithServer(e,t){return Voe(this,arguments,void 0,function*(e,t,i=!1,n){return yield(0,bo._)(this.sdkService.userClient$(t).pipe((0,go.n)(t=>Voe(this,void 0,void 0,function*(){const r={stack:[],error:void 0,hasError:!1};try{if(!t)throw new Error("SDK not available");const s=Boe(r,t.take(),!1);if(i){if(null==n)throw new Error("Organization ID is required for admin soft delete.");yield s.value.vault().ciphers().admin().soft_delete_many(e.map(e=>Yk(e)),Yk(n))}else yield s.value.vault().ciphers().soft_delete_many(e.map(e=>Yk(e)))}catch(e){r.error=e,r.hasError=!0}finally{joe(r)}})),(0,Ed.W)(e=>{throw this.logService.error(`Failed to soft delete multiple ciphers: ${e}`),e})))})}restoreWithServer(e,t){return Voe(this,arguments,void 0,function*(e,t,i=!1){return yield(0,bo._)(this.sdkService.userClient$(t).pipe((0,go.n)(t=>Voe(this,void 0,void 0,function*(){const n={stack:[],error:void 0,hasError:!1};try{if(!t)throw new Error("SDK not available");const r=Boe(n,t.take(),!1);i?yield r.value.vault().ciphers().admin().restore(Yk(e)):yield r.value.vault().ciphers().restore(Yk(e))}catch(e){n.error=e,n.hasError=!0}finally{joe(n)}})),(0,Ed.W)(e=>{throw this.logService.error(`Failed to restore cipher: ${e}`),e})))})}restoreManyWithServer(e,t,i){return Voe(this,void 0,void 0,function*(){return yield(0,bo._)(this.sdkService.userClient$(t).pipe((0,go.n)(t=>Voe(this,void 0,void 0,function*(){const n={stack:[],error:void 0,hasError:!1};try{if(!t)throw new Error("SDK not available");const r=Boe(n,t.take(),!1);i?yield r.value.vault().ciphers().admin().restore_many(e.map(e=>Yk(e)),Yk(i)):yield r.value.vault().ciphers().restore_many(e.map(e=>Yk(e)))}catch(e){n.error=e,n.hasError=!0}finally{joe(n)}})),(0,Ed.W)(e=>{throw this.logService.error(`Failed to restore multiple ciphers: ${e}`),e})))})}},deps:[Jk,Za]},{provide:_b,useFactory:(e,t,i,n,r,s,o,a,l,c,u,d,h,p,v)=>new tae(e,t,i,n,r,s,o,a,l,c,u,d,h,p,v),deps:[Bp,YE,eI,Ul,sQ,BE,$G,Noe,Kb,u,Zk,Za,Uoe,bk,Moe]},{provide:H$,useClass:class{constructor(e,t){this.sdkService=e,this.cipherService=t}computeRiskForCiphers(e,t,i){return cae(this,void 0,void 0,function*(){const n=this.mapToLoginDetails(e);return 0===n.length?[]:yield(0,bo._)(this.sdkService.userClient$(t).pipe((0,go.n)(e=>cae(this,void 0,void 0,function*(){const t={stack:[],error:void 0,hasError:!1};try{const r=uae(t,e.take(),!1).value.vault().cipher_risk();return yield r.compute_risk(n,null!=i?i:{checkExposed:!1})}catch(e){t.error=e,t.hasError=!0}finally{dae(t)}}))))})}computeCipherRiskForUser(e,t){return cae(this,arguments,void 0,function*(e,t,i=!0){const n=yield(0,bo._)(this.cipherService.cipherViews$(t).pipe(p$())),r=null==n?void 0:n.find(t=>Yk(t.id)===e);if(!r)throw new Error(`Cipher with id ${e} not found`);const s=yield this.buildPasswordReuseMap(n,t);return(yield this.computeRiskForCiphers([r],t,{passwordMap:s,checkExposed:i}))[0]})}buildPasswordReuseMap(e,t){return cae(this,void 0,void 0,function*(){const i=this.mapToLoginDetails(e);return 0===i.length?{}:yield(0,bo._)(this.sdkService.userClient$(t).pipe((0,go.n)(e=>cae(this,void 0,void 0,function*(){const t={stack:[],error:void 0,hasError:!1};try{const n=uae(t,e.take(),!1);return n.value.vault().cipher_risk().password_reuse_map(i)}catch(e){t.error=e,t.hasError=!0}finally{dae(t)}}))))})}mapToLoginDetails(e){return e.filter(e=>{var t;return e.type===nx.Login&&null!=(null===(t=e.login)||void 0===t?void 0:t.password)&&""!==e.login.password&&!e.isDeleted}).map(e=>({id:Yk(e.id),password:e.login.password,username:e.login.username}))}},deps:[Jk,_b]},{provide:MM,useClass:class{constructor(e,t,i,n,r){this.keyService=e,this.encryptService=t,this.i18nService=i,this.cipherService=n,this.stateProvider=r,this.folderViewCache=new Map,this.forceFolderViews={}}folders$(e){return this.encryptedFoldersState(e).state$.pipe((0,l.T)(e=>null==e?[]:Object.values(e).map(e=>new T_(e))))}folderViews$(e){if(!this.folderViewCache.has(e)){this.forceFolderViews[e]||(this.forceFolderViews[e]=new Co.B);const t=(0,Po.h)(this.forceFolderViews[e],(0,jo.z)([this.encryptedFoldersState(e).state$,this.keyService.userKey$(e)]).pipe((0,Eo.p)(([e,t])=>null!=e&&null!=t),(0,go.n)(([t,i])=>this.decryptFolders(e,t)))).pipe((0,Gp.t)({refCount:!1,bufferSize:1}));this.folderViewCache.set(e,t)}return this.folderViewCache.get(e)}encrypt(e,t){return mae(this,void 0,void 0,function*(){const i=new T_;return i.id=e.id,i.name=yield this.encryptService.encryptString(e.name,t),i})}get(e,t){return mae(this,void 0,void 0,function*(){return(yield(0,bo._)(this.folders$(t))).find(t=>t.id===e)})}getDecrypted$(e,t){return this.folderViews$(t).pipe((0,l.T)(t=>t.find(t=>t.id===e)),(0,Gp.t)({refCount:!0,bufferSize:1}))}getAllFromState(e){return mae(this,void 0,void 0,function*(){return yield(0,bo._)(this.folders$(e))})}getFromState(e,t){return mae(this,void 0,void 0,function*(){const i=yield this.get(e,t);return i||null})}getAllDecryptedFromState(e){return mae(this,void 0,void 0,function*(){return yield(0,bo._)(this.folderViews$(e))})}upsert(e,t){return mae(this,void 0,void 0,function*(){yield this.clearDecryptedFolderState(t),yield this.encryptedFoldersState(t).update(t=>{if(null==t&&(t={}),e instanceof jse){const i=e;t[i.id]=i}else e.forEach(e=>{t[e.id]=e});return t})})}replace(e,t){return mae(this,void 0,void 0,function*(){e&&(yield this.clearDecryptedFolderState(t),yield this.stateProvider.getUser(t,vae).update(()=>Object.assign({},e)))})}clearDecryptedFolderState(e){return mae(this,void 0,void 0,function*(){if(null==e)throw new Error("User ID is required.");yield this.setDecryptedFolders([],e)})}clear(e){return mae(this,void 0,void 0,function*(){var t;null===(t=this.forceFolderViews[e])||void 0===t||t.next([]),yield this.encryptedFoldersState(e).update(()=>({})),yield this.clearDecryptedFolderState(e)})}delete(e,t){return mae(this,void 0,void 0,function*(){yield this.clearDecryptedFolderState(t),yield this.encryptedFoldersState(t).update(t=>{if(null==t)return;return(Array.isArray(e)?e:[e]).forEach(e=>{null!=t[e]&&delete t[e]}),t});const i=yield this.cipherService.getAll(t);if(null!=i){const t=[];for(const n in i)i[n].folderId===e&&(i[n].folderId=null,t.push(i[n]));t.length>0&&(yield this.cipherService.upsert(t.map(e=>e.toCipherData())))}})}getRotatedData(e,t,i){return mae(this,void 0,void 0,function*(){if(null==t)throw new Error("New user key is required for rotation.");let e=[];const n=yield(0,bo._)(this.folderViews$(i));return n?(e=yield Promise.all(n.map(e=>mae(this,void 0,void 0,function*(){const i=yield this.encrypt(e,t);return new Jz(i)}))),e):e})}decryptFolders(e,t){return mae(this,void 0,void 0,function*(){const i=yield(0,bo._)(this.stateProvider.getUser(e,fae).state$);if(null==i?void 0:i.length)return i;if(null==t)return[];const n=Object.values(t).map(e=>new T_(e)),r=yield(0,bo._)(this.keyService.userKey$(e));if(!r)return[];const s=n.map(e=>mae(this,void 0,void 0,function*(){try{return yield e.decryptWithKey(r,this.encryptService)}catch(e){return null}})),o=(yield Promise.all(s)).filter(e=>null!==e).sort(bd.getSortFunction(this.i18nService,"name")),a=new SU;return a.name=this.i18nService.t("noneFolder"),o.push(a),yield this.setDecryptedFolders(o,e),o})}encryptedFoldersState(e){return this.stateProvider.getUser(e,vae)}setDecryptedFolders(e,t){return mae(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(fae,e,t)})}},deps:[Bp,$G,Ul,_b,u]},{provide:UM,useExisting:MM},{provide:BL,useClass:class{constructor(e,t){this.folderService=e,this.apiService=t}save(e,t){return pae(this,void 0,void 0,function*(){const i=new Hz(e);let n;e.id?n=yield this.putFolder(e.id,i):(n=yield this.postFolder(i),e.id=n.id);const r=new jse(n);return yield this.folderService.upsert(r,t),r})}delete(e,t){return pae(this,void 0,void 0,function*(){yield this.deleteFolder(e),yield this.folderService.delete(e,t)})}deleteAll(e){return pae(this,void 0,void 0,function*(){yield this.apiService.send("DELETE","/folders/all",null,!0,!1),yield this.folderService.clear(e)})}get(e){return pae(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/folders/"+e,null,!0,!0);return new gA(t)})}postFolder(e){return pae(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/folders",e,!0,!0);return new gA(t)})}putFolder(e,t){return pae(this,void 0,void 0,function*(){const i=yield this.apiService.send("PUT","/folders/"+e,t,!0,!0);return new gA(i)})}deleteFolder(e){return this.apiService.send("DELETE","/folders/"+e,null,!0,!1)}},deps:[MM,eI]},{provide:cC,useClass:class{constructor(e,t,i,n,r){this.apiService=e,this.userVerificationService=t,this.logService=i,this.accountService=n,this.environmentService=r}deleteAccount(e){return mte(this,void 0,void 0,function*(){try{const t=yield this.userVerificationService.buildRequest(e);yield this.apiService.send("DELETE","/accounts",t,!0,!1),this.accountService.delete()}catch(e){throw this.logService.error(e),e}})}registerSendVerificationEmail(e){return mte(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.environmentService.environment$);try{return yield this.apiService.send("POST","/accounts/register/send-verification-email",e,!1,!0,t.getIdentityUrl())}catch(e){if(e instanceof iS&&204===e.statusCode)return null;throw this.logService.error(e),e}})}registerVerificationEmailClicked(e){return mte(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.environmentService.environment$);try{return yield this.apiService.send("POST","/accounts/register/verification-email-clicked",e,!1,!1,t.getIdentityUrl())}catch(e){throw this.logService.error(e),e}})}registerFinish(e){return mte(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.environmentService.environment$);try{return yield this.apiService.send("POST","/accounts/register/finish",e,!1,!0,t.getIdentityUrl())}catch(e){throw this.logService.error(e),e}})}setVerifyDevices(e){return mte(this,void 0,void 0,function*(){try{return yield this.apiService.send("POST","/accounts/verify-devices",e,!0,!0)}catch(e){throw this.logService.error(e),e}})}},deps:[eI,NC,Za,Qk,mk]},{provide:Qk,useClass:class{constructor(e,t,i,n){this.messagingService=e,this.logService=t,this.globalStateProvider=i,this.singleUserStateProvider=n,this._showHeader$=new Dd.t(!0),this.showHeader$=this._showHeader$.asObservable(),this.accountsState=this.globalStateProvider.get(Jp),this.activeAccountIdState=this.globalStateProvider.get(Zp),this.accounts$=this.accountsState.state$.pipe((0,l.T)(e=>null==e?{}:e)),this.activeAccount$=this.activeAccountIdState.state$.pipe((0,Yp.v)(this.accounts$),(0,l.T)(([e,t])=>e?Object.assign({id:e},t[e]):null),(0,mo.F)((e,t)=>(null==e?void 0:e.id)===(null==t?void 0:t.id)&&this.accountInfoEqual(e,t)),(0,Gp.t)({bufferSize:1,refCount:!1})),this.accountActivity$=this.globalStateProvider.get(Qp).state$.pipe((0,l.T)(e=>null!=e?e:{})),this.sortedUserIds$=this.accountActivity$.pipe((0,l.T)(e=>Object.entries(e).map(([e,t])=>({userId:e,lastActive:t})).sort((e,t)=>t.lastActive.getTime()-e.lastActive.getTime()).map(e=>e.userId))),this.nextUpAccount$=(0,jo.z)([this.accounts$,this.activeAccount$,this.sortedUserIds$]).pipe((0,l.T)(([e,t,i])=>{const n=i.find(i=>i!==(null==t?void 0:t.id)&&null!=e[i]);return n?Object.assign({id:n},e[n]):null})),this.accountVerifyNewDeviceLogin$=this.activeAccountIdState.state$.pipe((0,go.n)(e=>this.singleUserStateProvider.get(e,ev).state$))}addAccount(e,t){return Hp(this,void 0,void 0,function*(){if(!bd.isGuid(e))throw new Error("userId is required");yield this.accountsState.update(i=>(i||(i={}),i[e]=t,i)),yield this.setAccountActivity(e,new Date)})}setAccountName(e,t){return Hp(this,void 0,void 0,function*(){yield this.setAccountInfo(e,{name:t})})}setAccountEmail(e,t){return Hp(this,void 0,void 0,function*(){yield this.setAccountInfo(e,{email:t})})}setAccountEmailVerified(e,t){return Hp(this,void 0,void 0,function*(){yield this.setAccountInfo(e,{emailVerified:t})})}setAccountCreationDate(e,t){return Hp(this,void 0,void 0,function*(){yield this.setAccountInfo(e,{creationDate:t})})}clean(e){return Hp(this,void 0,void 0,function*(){yield this.setAccountInfo(e,tv),yield this.removeAccountActivity(e)})}switchAccount(e){return Hp(this,void 0,void 0,function*(){let t=!1;yield this.activeAccountIdState.update((i,n)=>(t=!0,e),{combineLatestWith:this.accountsState.state$.pipe((0,Eo.p)(t=>null==e||null!=(null==t?void 0:t[e])),(0,wo.w)({first:1e3,with:()=>(0,Go.of)({})})),shouldUpdate:(t,i)=>{if(null!=e&&null==(null==i?void 0:i[e]))throw new Error("Account does not exist");return t!==e}}),t&&(yield this.setAccountActivity(e,new Date))})}setAccountActivity(e,t){return Hp(this,void 0,void 0,function*(){bd.isGuid(e)&&(yield this.globalStateProvider.get(Qp).update(i=>(i||(i={}),i[e]=t,i),{shouldUpdate:i=>{var n;return(null===(n=null==i?void 0:i[e])||void 0===n?void 0:n.getTime())!==(null==t?void 0:t.getTime())}}))})}setAccountVerifyNewDeviceLogin(e,t){return Hp(this,void 0,void 0,function*(){bd.isGuid(e)&&(yield this.singleUserStateProvider.get(e,ev).update(()=>t,{shouldUpdate:e=>e!==t}))})}removeAccountActivity(e){return Hp(this,void 0,void 0,function*(){yield this.globalStateProvider.get(Qp).update(t=>(null==t||delete t[e],t),{shouldUpdate:t=>null!=(null==t?void 0:t[e])})})}delete(){return Hp(this,void 0,void 0,function*(){var e;try{null===(e=this.messagingService)||void 0===e||e.send("logout")}catch(e){throw this.logService.error(e),e}})}setShowHeader(e){return Hp(this,void 0,void 0,function*(){this._showHeader$.next(e)})}accountInfoEqual(e,t){var i,n;return null==e&&null==t||null!=e&&null!=t&&(e.email===t.email&&e.emailVerified===t.emailVerified&&e.name===t.name&&(null===(i=e.creationDate)||void 0===i?void 0:i.getTime())===(null===(n=t.creationDate)||void 0===n?void 0:n.getTime()))}setAccountInfo(e,t){return Hp(this,void 0,void 0,function*(){function i(e){return Object.assign(Object.assign({},e),t)}yield this.accountsState.update(t=>(t[e]=i(t[e]),t),{shouldUpdate:t=>{if(null==(null==t?void 0:t[e]))throw new Error("Account does not exist");return!this.accountInfoEqual(t[e],i(t[e]))}})})}},deps:[bk,Za,d,h]},{provide:Zk,useExisting:Qk},{provide:AF,useClass:class{constructor(e,t){this.apiService=e,this.stateProvider=t,this.avatarColor$=this.stateProvider.getActive(jte).state$}setAvatarColor(e){return Bte(this,void 0,void 0,function*(){const{avatarColor:t}=yield this.apiService.putAvatar(new Vte(e));yield this.stateProvider.setUserState(jte,t)})}setSyncAvatarColor(e,t){return Bte(this,void 0,void 0,function*(){yield this.stateProvider.getUser(e,jte).update(()=>t)})}getUserAvatarColor$(e){return this.stateProvider.getUser(e,jte).state$}},deps:[eI,u]},{provide:Za,useFactory:()=>new el(!1),deps:[]},{provide:uR,useClass:class{constructor(e,t,i,n){this.keyService=e,this.encryptService=t,this.i18nService=i,this.stateProvider=n,this.collectionViewCache=new Map}encryptedState(e){return this.stateProvider.getUser(e,$R)}decryptedState(e){return this.stateProvider.getUser(e,OR)}encryptedCollections$(e){return this.encryptedState(e).state$.pipe((0,l.T)(e=>null==e?null:Object.values(e).map(e=>bR.fromCollectionData(e))))}decryptedCollections$(e){const t=this.collectionViewCache.get(e);if(t)return t;const i=this.decryptedState(e).state$.pipe((0,go.n)(t=>null!==t?(0,Go.of)(null!=t?t:[]):this.initializeDecryptedState(e).pipe((0,go.n)(()=>yo.t))),(0,Gp.t)({bufferSize:1,refCount:!0}));return this.collectionViewCache.set(e,i),i}defaultUserCollection$(e,t){return this.decryptedCollections$(e).pipe((0,l.T)(e=>e.find(e=>e.isDefaultCollection&&e.organizationId===t)))}initializeDecryptedState(e){return(0,jo.z)([this.encryptedCollections$(e),this.keyService.orgKeys$(e).pipe((0,Eo.p)(e=>!!e))]).pipe((0,go.n)(([t,i])=>this.decryptMany$(t,i).pipe((0,AR.o)(t=>this.setDecryptedCollections(t,e)))))}upsert(e,t){return UR(this,void 0,void 0,function*(){if(null==e)return;yield this.encryptedState(t).update(t=>(null==t&&(t={}),t[e.id]=e,t));const i=yield(0,bo._)(this.keyService.orgKeys$(t).pipe((0,go.n)(t=>{if(!t)throw new Error("No key for this collection's organization.");return this.decryptMany$([bR.fromCollectionData(e)],t)})));yield this.decryptedState(t).update(t=>{if(null==t&&(t=[]),!(null==i?void 0:i.length))return t;const n=i[0],r=t.findIndex(t=>t.id==e.id);return r>=0?t[r]=n:t.push(n),t})})}replace(e,t){return UR(this,void 0,void 0,function*(){yield this.encryptedState(t).update(()=>e),yield this.decryptedState(t).update(()=>null)})}delete(e,t){return UR(this,void 0,void 0,function*(){yield this.encryptedState(t).update(t=>(null==t&&(t={}),e.forEach(e=>{delete t[e]}),t)),yield this.decryptedState(t).update(t=>(null==t&&(t=[]),e.forEach(e=>{var i;(null==t?void 0:t.length)&&(t=null!==(i=t.filter(t=>t.id!=e))&&void 0!==i?i:[])}),t))})}encrypt(e,t){return UR(this,void 0,void 0,function*(){const i=yield(0,bo._)(this.keyService.orgKeys$(t).pipe((0,Eo.p)(e=>!!e),(0,l.T)(t=>t[e.organizationId])));return yield e.encrypt(i,this.encryptService)})}decryptMany$(e,t){if(null===e||0==e.length||null===t)return(0,Go.of)([]);const i=[];return e.forEach(e=>{i.push((0,$d.H)(e.decrypt(t[e.organizationId],this.encryptService)))}),(0,jo.z)(i).pipe((0,l.T)(e=>e.sort(bd.getSortFunction(this.i18nService,"name"))))}getAllNested(e){const t=this.groupByOrganization(e),i=[];for(const e of t.values()){const t=[];for(const i of e){const e=Object.assign(new SR(Object.assign(Object.assign({},i),{name:i.name})),i),n=i.name?i.name.replace(/^\/+|\/+$/g,"").split("/"):[];ER.nestedTraverse(t,0,n,e,void 0,"/")}i.push(...t)}return i}groupByOrganization(e){const t=new Map;return e.map(e=>{var i;const n=e.organizationId;(null!==(i=t.get(n))&&void 0!==i?i:t.set(n,[]).get(n)).push(e)}),t}getNested(e,t){const i=this.getAllNested(e);return ER.getTreeNodeObjectFromList(i,t)}setDecryptedCollections(e,t){return UR(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(OR,e,t)})}},deps:[Bp,$G,Ul,u]},{provide:XT,useValue:{ENV:"production"}.ADDITIONAL_REGIONS},{provide:mk,useClass:tse,deps:[u,Zk,XT]},{provide:Ow,useClass:class{constructor(e){this.singleUserStateProvider=e}userDecryptionOptionsById$(e){return this.singleUserStateProvider.get(e,QS).state$.pipe((0,Eo.p)(e=>null!=e))}hasMasterPasswordById$(e){return this.userDecryptionOptionsById$(e).pipe((0,l.T)(e=>{var t;return null!==(t=e.hasMasterPassword)&&void 0!==t&&t}))}setUserDecryptionOptionsById(e,t){return ZS(this,void 0,void 0,function*(){yield this.singleUserStateProvider.get(e,QS).update(e=>t)})}},deps:[h]},{provide:$w,useExisting:Ow},{provide:C$,useClass:gae,deps:[Jk]},{provide:iee,useClass:class{constructor(e,t,i,n,r,s,o,a){this.singleUserStateProvider=e,this.globalStateProvider=t,this.platformSupportsSecureStorage=i,this.secureStorageService=n,this.keyGenerationService=r,this.encryptService=s,this.logService=o,this.logoutCallback=a,this.accessTokenKeySecureStorageKey="_accessTokenKey",this.refreshTokenSecureStorageKey="_refreshToken",this.initializeState()}hasAccessToken$(e){return(0,jo.z)([this.singleUserStateProvider.get(e,oie).state$,this.singleUserStateProvider.get(e,aie).state$]).pipe((0,l.T)(([e,t])=>Boolean(e||t)))}initializeState(){this.emailTwoFactorTokenRecordGlobalState=this.globalStateProvider.get(uie),this.activeUserIdGlobalState=this.globalStateProvider.get(Zp)}setTokens(e,t,i,n,r){return gie(this,void 0,void 0,function*(){if(!e)throw new Error("Access token is required.");if(null==i)throw new Error("Vault Timeout is required.");if(null==t)throw new Error("Vault Timeout Action is required.");const s=yield this.getUserIdFromAccessToken(e);if(!s)throw new Error("User id not found. Cannot set tokens.");const o=yield this._setAccessToken(e,t,i,s),a=new sie(o);if(n&&(a.refreshToken=yield this.setRefreshToken(n,t,i,s)),null!=r){const e=yield this.setClientId(r[0],t,i,s),n=yield this.setClientSecret(r[1],t,i,s);a.clientIdSecretPair=[e,n]}return a})}getAccessTokenKey(e){return gie(this,void 0,void 0,function*(){const t=yield this.secureStorageService.get(`${e}${this.accessTokenKeySecureStorageKey}`,this.getSecureStorageOptions(e));if(!t)return null;return Dv.fromJSON(t)})}createAndSaveAccessTokenKey(e){return gie(this,void 0,void 0,function*(){const t=yield this.keyGenerationService.createKey(512);yield this.secureStorageService.save(`${e}${this.accessTokenKeySecureStorageKey}`,t,this.getSecureStorageOptions(e));if(!(yield this.getAccessTokenKey(e)))throw new Error("New Access token key unable to be retrieved from secure storage.");return t})}clearAccessTokenKey(e){return gie(this,void 0,void 0,function*(){yield this.secureStorageService.remove(`${e}${this.accessTokenKeySecureStorageKey}`,this.getSecureStorageOptions(e))})}getOrCreateAccessTokenKey(e){return gie(this,void 0,void 0,function*(){if(!this.platformSupportsSecureStorage)throw new Error("Platform does not support secure storage. Cannot obtain access token key.");if(!e)throw new Error("User id not found. Cannot obtain access token key.");let t=yield this.getAccessTokenKey(e);return t||(t=yield this.createAndSaveAccessTokenKey(e)),t})}encryptAccessToken(e,t){return gie(this,void 0,void 0,function*(){const i=yield this.getOrCreateAccessTokenKey(t);return yield this.encryptService.encryptString(e,i)})}decryptAccessToken(e,t){return gie(this,void 0,void 0,function*(){if(!e)throw new Error("decryptAccessToken: Access token key required. Cannot decrypt access token.");try{return yield this.encryptService.decryptString(t,e)}catch(e){throw this.logService.error("[TokenService] Error decrypting access token",e),e}})}_setAccessToken(e,t,i,n){return gie(this,void 0,void 0,function*(){switch(yield this.determineStorageLocation(t,i,!0)){case mie.SecureStorage:{let t=null;try{const i=yield this.encryptAccessToken(e,n);yield this.singleUserStateProvider.get(n,oie).update(e=>i.encryptedString,{shouldUpdate:e=>e!==i.encryptedString}),t=e,yield this.singleUserStateProvider.get(n,aie).update(e=>null)}catch(i){this.logService.error("SetAccessToken: storing encrypted access token in secure storage failed. Falling back to disk storage.",i),t=yield this.singleUserStateProvider.get(n,oie).update(t=>e,{shouldUpdate:t=>t!==e})}return t}case mie.Disk:return yield this.singleUserStateProvider.get(n,oie).update(t=>e,{shouldUpdate:t=>t!==e});case mie.Memory:return yield this.singleUserStateProvider.get(n,aie).update(t=>e)}})}setAccessToken(e,t,i){return gie(this,void 0,void 0,function*(){if(!e)throw new Error("Access token is required.");const n=yield this.getUserIdFromAccessToken(e);if(!n)throw new Error("User id not found. Cannot save access token.");if(null==i)throw new Error("Vault Timeout is required.");if(null==t)throw new Error("Vault Timeout Action is required.");return yield this._setAccessToken(e,t,i,n)})}clearAccessToken(e){return gie(this,void 0,void 0,function*(){if(null!=e||(e=yield(0,bo._)(this.activeUserIdGlobalState.state$)),!e)throw new Error("User id not found. Cannot clear access token.");this.platformSupportsSecureStorage&&(yield this.clearAccessTokenKey(e)),yield this.singleUserStateProvider.get(e,oie).update(e=>null,{shouldUpdate:e=>null!==e}),yield this.singleUserStateProvider.get(e,aie).update(e=>null)})}getAccessToken(e){return gie(this,void 0,void 0,function*(){if(!e)return null;const t=yield this.getStateValueByUserIdAndKeyDef(e,aie);if(null!=t)return t;const i=yield this.getStateValueByUserIdAndKeyDef(e,oie);if(!i)return null;if(this.platformSupportsSecureStorage){let t;try{t=yield this.getAccessTokenKey(e)}catch(t){return Pp.isSerializedEncString(i)?(this.logService.error("Access token key retrieval failed. Unable to decrypt encrypted access token. Logging user out.",t),yield this.logoutCallback("accessTokenUnableToBeDecrypted",e),null):i}if(!t)return Pp.isSerializedEncString(i)?(this.logService.error("Access token key not found to decrypt encrypted access token. Logging user out."),yield this.logoutCallback("accessTokenUnableToBeDecrypted",e),null):i;try{const e=new Pp(i);return yield this.decryptAccessToken(t,e)}catch(t){return this.logService.error("Failed to decrypt access token",t),yield this.logoutCallback("accessTokenUnableToBeDecrypted",e),null}}return i})}setRefreshToken(e,t,i,n){return gie(this,void 0,void 0,function*(){if(!n)throw new Error("User id not found. Cannot save refresh token.");if(null==i)throw new Error("Vault Timeout is required.");if(null==t)throw new Error("Vault Timeout Action is required.");switch(yield this.determineStorageLocation(t,i,!0)){case mie.SecureStorage:{let t=null;try{yield this.saveStringToSecureStorage(n,this.refreshTokenSecureStorageKey,e);const i=yield this.getStringFromSecureStorage(n,this.refreshTokenSecureStorageKey);if(null!==e&&!i)throw new Error("Refresh token failed to save to secure storage.");t=e,yield this.singleUserStateProvider.get(n,lie).update(e=>null,{shouldUpdate:e=>null!==e}),yield this.singleUserStateProvider.get(n,cie).update(e=>null)}catch(i){this.logService.error("SetRefreshToken: storing refresh token in secure storage failed. Falling back to disk storage.",i),t=yield this.singleUserStateProvider.get(n,lie).update(t=>e,{shouldUpdate:t=>t!==e})}return t}case mie.Disk:return yield this.singleUserStateProvider.get(n,lie).update(t=>e,{shouldUpdate:t=>t!==e});case mie.Memory:return yield this.singleUserStateProvider.get(n,cie).update(t=>e)}})}getRefreshToken(e){return gie(this,void 0,void 0,function*(){if(!e)return null;const t=yield this.getStateValueByUserIdAndKeyDef(e,cie);if(null!=t)return t;const i=yield this.getStateValueByUserIdAndKeyDef(e,lie);if(null!=i)return i;if(this.platformSupportsSecureStorage)try{const t=yield this.getStringFromSecureStorage(e,this.refreshTokenSecureStorageKey);if(null!=t)return t;this.logService.error("Refresh token not found in secure storage. Access token will fail to refresh upon expiration or manual refresh.")}catch(t){this.logService.error("Failed to retrieve refresh token from secure storage",t),yield this.logoutCallback("refreshTokenSecureStorageRetrievalFailure",e)}return null})}clearRefreshToken(e){return gie(this,void 0,void 0,function*(){if(!e)throw new Error("User id not found. Cannot clear refresh token.");this.platformSupportsSecureStorage&&(yield this.secureStorageService.remove(`${e}${this.refreshTokenSecureStorageKey}`,this.getSecureStorageOptions(e))),yield this.singleUserStateProvider.get(e,cie).update(e=>null),yield this.singleUserStateProvider.get(e,lie).update(e=>null,{shouldUpdate:e=>null!==e})})}setClientId(e,t,i,n){return gie(this,void 0,void 0,function*(){if(null!=n||(n=yield(0,bo._)(this.activeUserIdGlobalState.state$)),!n)throw new Error("User id not found. Cannot save client id.");if(null==i)throw new Error("Vault Timeout is required.");if(null==t)throw new Error("Vault Timeout Action is required.");const r=yield this.determineStorageLocation(t,i,!1);return r===mie.Disk?yield this.singleUserStateProvider.get(n,die).update(t=>e):r===mie.Memory?yield this.singleUserStateProvider.get(n,hie).update(t=>e):void 0})}getClientId(e){return gie(this,void 0,void 0,function*(){if(!e)return;const t=yield this.getStateValueByUserIdAndKeyDef(e,hie);return null!=t?t:yield this.getStateValueByUserIdAndKeyDef(e,die)})}clearClientId(e){return gie(this,void 0,void 0,function*(){if(null!=e||(e=yield(0,bo._)(this.activeUserIdGlobalState.state$)),!e)throw new Error("User id not found. Cannot clear client id.");yield this.singleUserStateProvider.get(e,hie).update(e=>null),yield this.singleUserStateProvider.get(e,die).update(e=>null)})}setClientSecret(e,t,i,n){return gie(this,void 0,void 0,function*(){if(null!=n||(n=yield(0,bo._)(this.activeUserIdGlobalState.state$)),!n)throw new Error("User id not found. Cannot save client secret.");if(null==i)throw new Error("Vault Timeout is required.");if(null==t)throw new Error("Vault Timeout Action is required.");const r=yield this.determineStorageLocation(t,i,!1);return r===mie.Disk?yield this.singleUserStateProvider.get(n,pie).update(t=>e):r===mie.Memory?yield this.singleUserStateProvider.get(n,vie).update(t=>e):void 0})}getClientSecret(e){return gie(this,void 0,void 0,function*(){if(!e)return;const t=yield this.getStateValueByUserIdAndKeyDef(e,vie);return null!=t?t:yield this.getStateValueByUserIdAndKeyDef(e,pie)})}clearClientSecret(e){return gie(this,void 0,void 0,function*(){if(null!=e||(e=yield(0,bo._)(this.activeUserIdGlobalState.state$)),!e)throw new Error("User id not found. Cannot clear client secret.");yield this.singleUserStateProvider.get(e,vie).update(e=>null),yield this.singleUserStateProvider.get(e,pie).update(e=>null)})}setTwoFactorToken(e,t){return gie(this,void 0,void 0,function*(){yield this.emailTwoFactorTokenRecordGlobalState.update(i=>(null!=i||(i={}),i[e]=t,i))})}getTwoFactorToken(e){return gie(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.emailTwoFactorTokenRecordGlobalState.state$);return t?t[e]:null})}clearTwoFactorToken(e){return gie(this,void 0,void 0,function*(){yield this.emailTwoFactorTokenRecordGlobalState.update(t=>(null!=t||(t={}),delete t[e],t))})}clearTokens(e){return gie(this,void 0,void 0,function*(){if(null!=e||(e=yield(0,bo._)(this.activeUserIdGlobalState.state$)),!e)throw new Error("User id not found. Cannot clear tokens.");yield Promise.all([this.clearAccessToken(e),this.clearRefreshToken(e),this.clearClientId(e),this.clearClientSecret(e)])})}decodeAccessToken(e){return gie(this,void 0,void 0,function*(){let t=e;if(bd.isGuid(e)?t=yield this.getAccessToken(e):null!=t||(t=yield this.getAccessToken(yield(0,bo._)(this.activeUserIdGlobalState.state$))),null==t)throw new Error("Access token not found.");return fk(t)})}getTokenExpirationDate(e){return gie(this,void 0,void 0,function*(){let t;try{t=yield this.decodeAccessToken(e)}catch(e){throw new Error("Failed to decode access token: "+e.message)}if(!t||"number"!=typeof t.exp)return null;const i=new Date(0);return i.setUTCSeconds(t.exp),i})}tokenSecondsRemaining(e){return gie(this,arguments,void 0,function*(e,t=0){const i=yield this.getTokenExpirationDate(e);if(null==i)return 0;const n=i.valueOf()-((new Date).valueOf()+1e3*t);return Math.round(n/1e3)})}tokenNeedsRefresh(e){return gie(this,arguments,void 0,function*(e,t=5){return(yield this.tokenSecondsRemaining(e))<60*t})}getUserId(){return gie(this,void 0,void 0,function*(){let e;try{e=yield this.decodeAccessToken()}catch(e){throw new Error("Failed to decode access token: "+e.message)}if(!e||"string"!=typeof e.sub)throw new Error("No user id found");return e.sub})}getUserIdFromAccessToken(e){return gie(this,void 0,void 0,function*(){let t;try{t=yield this.decodeAccessToken(e)}catch(e){throw new Error("Failed to decode access token: "+e.message)}if(!t||"string"!=typeof t.sub)throw new Error("No user id found");return t.sub})}getEmail(){return gie(this,void 0,void 0,function*(){let e;try{e=yield this.decodeAccessToken()}catch(e){throw new Error("Failed to decode access token: "+e.message)}if(!e||"string"!=typeof e.email)throw new Error("No email found");return e.email})}getEmailVerified(){return gie(this,void 0,void 0,function*(){let e;try{e=yield this.decodeAccessToken()}catch(e){throw new Error("Failed to decode access token: "+e.message)}if(!e||"boolean"!=typeof e.email_verified)throw new Error("No email verification found");return e.email_verified})}getName(){return gie(this,void 0,void 0,function*(){let e;try{e=yield this.decodeAccessToken()}catch(e){throw new Error("Failed to decode access token: "+e.message)}return e&&"string"==typeof e.name?e.name:null})}getIssuer(){return gie(this,void 0,void 0,function*(){let e;try{e=yield this.decodeAccessToken()}catch(e){throw new Error("Failed to decode access token: "+e.message)}if(!e||"string"!=typeof e.iss)throw new Error("No issuer found");return e.iss})}getIsExternal(e){return gie(this,void 0,void 0,function*(){let t;try{t=yield this.decodeAccessToken(e)}catch(e){throw new Error("Failed to decode access token: "+e.message)}return Array.isArray(t.amr)&&t.amr.includes("external")})}getSecurityStamp(e){return gie(this,void 0,void 0,function*(){if(null!=e||(e=yield(0,bo._)(this.activeUserIdGlobalState.state$)),!e)throw new Error("User id not found. Cannot get security stamp.");return yield this.getStateValueByUserIdAndKeyDef(e,fie)})}setSecurityStamp(e,t){return gie(this,void 0,void 0,function*(){if(null!=t||(t=yield(0,bo._)(this.activeUserIdGlobalState.state$)),!t)throw new Error("User id not found. Cannot set security stamp.");yield this.singleUserStateProvider.get(t,fie).update(t=>e)})}getStateValueByUserIdAndKeyDef(e,t){return gie(this,void 0,void 0,function*(){return yield(0,bo._)(this.singleUserStateProvider.get(e,t).state$)})}determineStorageLocation(e,t,i){return gie(this,void 0,void 0,function*(){if(null==e)throw new Error("TokenService - determineStorageLocation: We expect the vault timeout action to always exist at this point.");if(null==t)throw new Error("TokenService - determineStorageLocation: We expect the vault timeout to always exist at this point.");return e===pv.LogOut&&t!==vv?mie.Memory:i&&this.platformSupportsSecureStorage?mie.SecureStorage:mie.Disk})}saveStringToSecureStorage(e,t,i){return gie(this,void 0,void 0,function*(){yield this.secureStorageService.save(`${e}${t}`,i,this.getSecureStorageOptions(e))})}getStringFromSecureStorage(e,t){return gie(this,void 0,void 0,function*(){return yield this.secureStorageService.get(`${e}${t}`,this.getSecureStorageOptions(e))})}getSecureStorageOptions(e){return{storageLocation:bp.Disk,useSecureStorage:!0,userId:e}}},deps:[h,d,NT,UT,jz,$G,Za,MT]},{provide:jz,useClass:class{constructor(e){this.cryptoFunctionService=e}createKey(e){return Gz(this,void 0,void 0,function*(){const t=yield this.cryptoFunctionService.aesGenerateKey(e);return new Dv(t)})}createKeyWithPurpose(e,t,i){return Gz(this,void 0,void 0,function*(){if(null==i){const e=yield this.cryptoFunctionService.randomBytes(32);i=bd.fromBufferToUtf8(e.buffer)}const n=yield this.cryptoFunctionService.aesGenerateKey(e),r=yield this.cryptoFunctionService.hkdf(n,i,t,64,"sha256");return{salt:i,material:n,derivedKey:new Dv(r)}})}deriveKeyFromMaterial(e,t,i){return Gz(this,void 0,void 0,function*(){const n=yield this.cryptoFunctionService.hkdf(e,t,i,64,"sha256");return new Dv(n)})}deriveKeyFromPassword(e,t,i){return Gz(this,void 0,void 0,function*(){return"string"==typeof e&&(e=(new TextEncoder).encode(e)),"string"==typeof t&&(t=(new TextEncoder).encode(t)),yield om.Ready,new Dv(nm.IEs.derive_kdf_material(e,t,i.toSdkConfig()))})}stretchKey(e){return Gz(this,void 0,void 0,function*(){if(e.inner().type!=hp.AesCbc256_B64)throw new Error("Key passed into stretchKey is not a 256-bit key.");const t=new Uint8Array(64),i=yield this.cryptoFunctionService.hkdfExpand(e.inner().encryptionKey,"enc",32,"sha256"),n=yield this.cryptoFunctionService.hkdfExpand(e.inner().encryptionKey,"mac",32,"sha256");return t.set(new Uint8Array(i)),t.set(new Uint8Array(n),32),new Dv(t)})}deriveVaultExportKey(e,t,i){return Gz(this,void 0,void 0,function*(){return yield this.stretchKey(yield this.deriveKeyFromPassword(e,t,i))})}},deps:[FI]},{provide:Bp,useClass:Vv,deps:[Yb,jz,FI,$G,Hb,Za,fo,Zk,u,_v,oI]},{provide:sI,useClass:class{constructor(e){this.accountCryptographicStateService=e}accountSecurityState$(e){return this.accountCryptographicStateService.accountCryptographicState$(e).pipe((0,l.T)(e=>null==e?null:"V2"in e?e.V2.security_state:null))}},deps:[oI]},{provide:r$,useClass:r$,deps:[Zk,WF,Jb]},{provide:af,useClass:class{getPasswordStrength(e,t=null,i=null){if(null==e||0===e.length)return null;const n=["bitwarden","bit","warden",...null!=i?i:[],...this.emailToUserInputs(t)],r=Array.from(new Set(n));return cf()(e,r)}emailToUserInputs(e){if(null==e||0===e.length)return[];const t=e.indexOf("@");return t<0?[]:e.substring(0,t).trim().toLowerCase().split(/[^A-Za-z0-9]/)}},deps:[]},{provide:gf,useFactory:function(e,t,i,n,r){const s=new fb,o=new mb(s,Date.now),a=new gb(new vb(o,r),i),l=new gb(new pb(o,r),i),c=new lb(r,i),u=new tb(e,t,r);return new db(n,c,a,l,u)},deps:[$G,Bp,Jb,Zk,u]},{provide:Xy,useClass:tb,deps:[$G,Bp,u]},{provide:yb,useFactory:function(e,t,i,n,r,s,o){const a=new Cb,l=new wb(e,t),c=new Tb(a),u=new Pb(a),d=new Fb,h=new Rb(new Db(c,o),r),p=new Rb(new Ab(d,u,o),r),v=new Rb(new xb(d,u,o),r),f=new Rb(new Eb(tm.AddyIo,l,t,n,i,o),r),m=new Rb(new Eb(tm.DuckDuckGo,l,t,n,i,o),r),g=new Rb(new Eb(tm.Fastmail,l,t,n,i,o),r),y=new Rb(new Eb(tm.FirefoxRelay,l,t,n,i,o),r),b=new Rb(new Eb(tm.ForwardEmail,l,t,n,i,o),r),w=new Rb(new Eb(tm.SimpleLogin,l,t,n,i,o),r),S=new lb(o,r);return new Ib(s,S,v,h,p,f,m,g,y,b,w)},deps:[eI,Ul,Bp,$G,Jb,Zk,u]},{provide:KT,useFactory:(e,t)=>()=>{e.showToast({variant:"error",title:t.t("errorRefreshingAccessToken"),message:t.t("errorRefreshingAccessTokenDesc")})},deps:[qb,Ul]},{provide:qT,useValue:{createRequest:(e,t)=>new Request(e,t)}},{provide:eI,useClass:hoe,deps:[iee,Hb,mk,Tk,KT,Za,MT,qp,Zk,qT]},{provide:W0,useExisting:Y0},{provide:Y0,useClass:class{constructor(e,t,i,n,r,s,o){this.accountService=e,this.keyService=t,this.i18nService=i,this.keyGenerationService=n,this.stateProvider=r,this.encryptService=s,this.configService=o,this.sendKeySalt="bitwarden-send",this.sendKeyPurpose="send",this.sends$=this.stateProvider.encryptedState$.pipe((0,l.T)(([,e])=>Object.values(e||{}).map(e=>new Ioe(e)))),this.sendViews$=this.stateProvider.encryptedState$.pipe((0,To.H)(([e,t])=>this.decryptSends(Object.values(t||{}).map(e=>new Ioe(e)),e)))}encrypt(e,t,i,n){return Ooe(this,void 0,void 0,function*(){var r,s;let o=null;const a=new Ioe;if(a.id=e.id,a.type=e.type,a.disabled=e.disabled,a.hideEmail=e.hideEmail,a.maxAccessCount=e.maxAccessCount,a.deletionDate=e.deletionDate,a.expirationDate=e.expirationDate,null==e.key){const t=yield this.keyGenerationService.createKeyWithPurpose(128,this.sendKeyPurpose,this.sendKeySalt);e.key=t.material,e.cryptoKey=t.derivedKey}const l=yield this.configService.getFeatureFlag(Wv.SendEmailOTP),c=(null!==(s=null===(r=e.emails)||void 0===r?void 0:r.length)&&void 0!==s?s:0)>0;if(l&&c)a.emails=e.emails.map(e=>e.trim()).join(",").toLocaleLowerCase(),a.password=null;else if(a.emails=null,null!=i){const t=yield this.keyGenerationService.deriveKeyFromPassword(i,e.key,new jv(gre));a.password=t.keyB64}const u=(yield(0,bo._)(this.accountService.activeAccount$)).id;if(null==n&&(n=yield(0,bo._)(this.keyService.userKey$(u))),a.key=yield this.encryptService.encryptBytes(e.key,n),a.name=null!=e.name?yield this.encryptService.encryptString(e.name,e.cryptoKey):null,a.notes=null!=e.notes?yield this.encryptService.encryptString(e.notes,e.cryptoKey):null,a.type===u0.Text)a.text=new Soe,a.text.text=yield this.encryptService.encryptString(e.text.text,e.cryptoKey),a.text.hidden=e.text.hidden;else if(a.type===u0.File&&(a.file=new woe,null!=t))if(t instanceof ArrayBuffer){const[i,n]=yield this.encryptFileData(e.file.fileName,t,e.cryptoKey,u);a.file.fileName=i,o=n}else o=yield this.parseFile(a,t,e.cryptoKey,u);return a.authType=e.authType,[a,o]})}get$(e){return this.sends$.pipe((0,mo.F)((t,i)=>{const n=t.find(t=>t.id===e),r=i.find(t=>t.id===e);if(!n||!r)return!1;const s=Object.keys(r).every(e=>{if(null!=n[e]&&null===r[e]||null===n[e]&&null!=r[e])return!1;switch(e){case"name":case"notes":case"key":return null===n[e]&&null===r[e]||n[e].encryptedString===r[e].encryptedString;case"text":return null==n[e].text&&null==r[e].text||!(null!=n[e].text&&null==r[e].text||null==n[e].text&&null!=r[e].text)&&n[e].text.encryptedString===r[e].text.encryptedString;case"file":return!0;case"revisionDate":case"expirationDate":case"deletionDate":return null===n[e]&&null===r[e]||n[e].getTime()===r[e].getTime();default:return n[e]===r[e]}});return s}),(0,l.T)(t=>t.find(t=>t.id===e)))}getFromState(e){return Ooe(this,void 0,void 0,function*(){const[,t]=yield this.stateProvider.getEncryptedSends();return null!=t&&t.hasOwnProperty(e)?new Ioe(t[e]):null})}getAll(){return Ooe(this,void 0,void 0,function*(){const[,e]=yield this.stateProvider.getEncryptedSends(),t=[];for(const i in e)e.hasOwnProperty(i)&&t.push(new Ioe(e[i]));return t})}getAllDecryptedFromState(e){return Ooe(this,void 0,void 0,function*(){if(!e)throw new Error("User ID must not be null or undefined");let t=yield this.stateProvider.getDecryptedSends();if(null!=t)return t;t=[];if(!(yield this.keyService.hasUserKey(e)))throw new Error("No user key found.");const i=[];return(yield this.getAll()).forEach(n=>{i.push(n.decrypt(e).then(e=>t.push(e)))}),yield Promise.all(i),t.sort(bd.getSortFunction(this.i18nService,"name")),yield this.stateProvider.setDecryptedSends(t),t})}upsert(e){return Ooe(this,void 0,void 0,function*(){const[t,i]=yield this.stateProvider.getEncryptedSends();let n=i;if(null==n&&(n={}),e instanceof Bse){const t=e;n[t.id]=t}else e.forEach(e=>{n[e.id]=e});yield this.replace(n,t)})}delete(e){return Ooe(this,void 0,void 0,function*(){const[t,i]=yield this.stateProvider.getEncryptedSends();if(null!=i){if("string"==typeof e){if(null==i[e])return;delete i[e]}else e.forEach(e=>{delete i[e]});yield this.replace(i,t)}})}replace(e,t){return Ooe(this,void 0,void 0,function*(){yield this.stateProvider.setEncryptedSends(e,t)})}getRotatedData(e,t,i){return Ooe(this,void 0,void 0,function*(){if(null==t)throw new Error("New user key is required for rotation.");if(null==e)throw new Error("Original user key is required for rotation.");return yield(0,bo._)(this.sends$.pipe((0,To.H)(i=>Ooe(this,void 0,void 0,function*(){return this.toRotatedKeyRequestMap(i,e,t)}))))})}toRotatedKeyRequestMap(e,t,i){return Ooe(this,void 0,void 0,function*(){return yield Promise.all(e.map(e=>Ooe(this,void 0,void 0,function*(){const n=yield this.encryptService.decryptBytes(e.key,t);return e.key=yield this.encryptService.encryptBytes(n,i),new $oe(e)})))})}parseFile(e,t,i,n){return new Promise((r,s)=>{const o=new FileReader;o.readAsArrayBuffer(t),o.onload=o=>Ooe(this,void 0,void 0,function*(){try{const[s,a]=yield this.encryptFileData(t.name,o.target.result,i,n);e.file.fileName=s,r(a)}catch(e){s(e)}}),o.onerror=()=>{s("Error reading file.")}})}encryptFileData(e,t,i,n){return Ooe(this,void 0,void 0,function*(){null==i&&(i=yield(0,bo._)(this.keyService.userKey$(n)));return[yield this.encryptService.encryptString(e,i),yield this.encryptService.encryptFileData(new Uint8Array(t),i)]})}decryptSends(e,t){return Ooe(this,void 0,void 0,function*(){const i=e.map(e=>e.decrypt(t)),n=yield Promise.all(i);return n.sort(bd.getSortFunction(this.i18nService,"name")),n})}},deps:[Zk,Bp,Ul,jz,Eoe,$G,Kb]},{provide:Eoe,useClass:class{constructor(e){this.stateProvider=e,this.activeUserEncryptedState=this.stateProvider.getActive(xoe),this.encryptedState$=this.activeUserEncryptedState.combinedState$,this.activeUserDecryptedState=this.stateProvider.getActive(Aoe),this.decryptedState$=this.activeUserDecryptedState.state$}getEncryptedSends(){return Doe(this,void 0,void 0,function*(){return yield(0,bo._)(this.encryptedState$)})}setEncryptedSends(e,t){return Doe(this,void 0,void 0,function*(){yield this.stateProvider.getUser(t,xoe).update(()=>e)})}getDecryptedSends(){return Doe(this,void 0,void 0,function*(){return yield(0,bo._)(this.decryptedState$)})}setDecryptedSends(e){return Doe(this,void 0,void 0,function*(){yield this.activeUserDecryptedState.update(()=>e)})}},deps:[u]},{provide:F0,useClass:class{constructor(e,t,i){this.apiService=e,this.fileUploadService=t,this.sendService=i}getSend(e){return Roe(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/sends/"+e,null,!0,!0);return new rA(t)})}postSendAccess(e,t,i){return Roe(this,void 0,void 0,function*(){const n=yield this.apiService.send("POST","/sends/access/"+e,t,!1,!0,i,t=>{t.set("Send-Id",e)});return new Toe(n)})}postSendAccessV2(e,t){return Roe(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/sends/access",null,!1,!0,t,t=>{t.set("Authorization","Bearer "+e.token)});return new Toe(i)})}getSendFileDownloadData(e,t,i){return Roe(this,void 0,void 0,function*(){const n=yield this.apiService.send("POST","/sends/"+e.id+"/access/file/"+e.file.id,t,!1,!0,i,t=>{t.set("Send-Id",e.id)});return new Poe(n)})}getSendFileDownloadDataV2(e,t,i){return Roe(this,void 0,void 0,function*(){const n=yield this.apiService.send("POST","/sends/access/file/"+e.file.id,null,!1,!0,i,e=>{e.set("Authorization","Bearer "+t.token)});return new Poe(n)})}getSends(){return Roe(this,void 0,void 0,function*(){const e=yield this.apiService.send("GET","/sends",null,!0,!0);return new sk(e,rA)})}postSend(e){return Roe(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/sends",e,!0,!0);return new rA(t)})}postFileTypeSend(e){return Roe(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/sends/file/v2",e,!0,!0);return new Foe(t)})}renewSendFileUploadUrl(e,t){return Roe(this,void 0,void 0,function*(){const i=yield this.apiService.send("GET","/sends/"+e+"/file/"+t,null,!0,!0);return new Foe(i)})}postSendFile(e,t,i){return this.apiService.send("POST","/sends/"+e+"/file/"+t,i,!0,!1)}putSend(e,t){return Roe(this,void 0,void 0,function*(){const i=yield this.apiService.send("PUT","/sends/"+e,t,!0,!0);return new rA(i)})}putSendRemovePassword(e){return Roe(this,void 0,void 0,function*(){const t=yield this.apiService.send("PUT","/sends/"+e+"/remove-password",null,!0,!0);return new rA(t)})}deleteSend(e){return this.apiService.send("DELETE","/sends/"+e,null,!0,!1)}save(e){return Roe(this,void 0,void 0,function*(){const t=yield this.upload(e),i=new Bse(t);return yield this.sendService.upsert(i),new Ioe(i)})}delete(e){return Roe(this,void 0,void 0,function*(){yield this.deleteSend(e),yield this.sendService.delete(e)})}removePassword(e){return Roe(this,void 0,void 0,function*(){const t=yield this.putSendRemovePassword(e),i=new Bse(t);yield this.sendService.upsert(i)})}upload(e){return Roe(this,void 0,void 0,function*(){var t;const i=new Coe(e[0],null===(t=e[1])||void 0===t?void 0:t.buffer.byteLength);let n;if(null==e[0].id){if(e[0].type===u0.Text)n=yield this.postSend(i);else try{const t=yield this.postFileTypeSend(i);n=t.sendResponse,yield this.fileUploadService.upload(t,e[0].file.fileName,e[1],this.generateMethods(t,n))}catch(e){throw e instanceof iS?new Error(e.getSingleMessage()):e}e[0].id=n.id,e[0].accessId=n.accessId}else n=yield this.putSend(e[0].id,i);return n})}generateMethods(e,t){return{postDirect:this.generatePostDirectCallback(t),renewFileUploadUrl:this.generateRenewFileUploadUrlCallback(t.id,t.file.id),rollback:this.generateRollbackCallback(t.id)}}generatePostDirectCallback(e){return t=>this.postSendFile(e.id,e.file.id,t)}generateRenewFileUploadUrlCallback(e,t){return()=>Roe(this,void 0,void 0,function*(){const i=yield this.renewSendFileUploadUrl(e,t);return null==i?void 0:i.url})}generateRollbackCallback(e){return()=>this.deleteSend(e)}},deps:[eI,wre,Y0]},{provide:class{},useClass:class{constructor(e){this.apiService=e}getUserPublicKeys(e){return Une(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/users/"+e+"/keys",null,!0,!0);return new One(t)})}},deps:[eI]},{provide:qx,useClass:class extends zse{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,v,f,m,g,y,b,w,S,k,I,C,T,P){super(S,r,v,l,d,s,a,i,t,k,u,m,I),this.masterPasswordService=e,this.domainSettingsService=n,this.keyService=o,this.policyService=c,this.keyConnectorService=h,this.providerService=p,this.organizationService=f,this.userDecryptionOptionsService=g,this.avatarService=y,this.logoutCallback=b,this.billingAccountProfileStateService=w,this.securityStateService=C,this.kdfConfigService=T,this.accountCryptographicStateService=P,this.syncInProgress=!1,this.inFlightApiCalls={refreshToken:null,sync:null}}fullSync(e,t){return _se(this,void 0,void 0,function*(){const{allowThrowOnError:i=!1,skipTokenRefresh:n=!1}="boolean"==typeof t?{allowThrowOnError:t}:null!=t?t:{},r=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)));this.syncStarted();if((yield(0,bo._)(this.authService.authStatusFor$(r)))===Pd.LoggedOut)return this.syncCompleted(!1,r);const s=new Date;let o=!1,a=!0;try{o=yield this.needsSyncing(e)}catch(e){if(a=!1,i)throw this.syncCompleted(!1,r),e}if(!o)return a&&(yield this.setLastSync(s,r)),this.syncCompleted(!1,r);try{n||(null===this.inFlightApiCalls.refreshToken&&(this.inFlightApiCalls.refreshToken=this.apiService.refreshIdentityToken()),yield this.inFlightApiCalls.refreshToken),null===this.inFlightApiCalls.sync?this.inFlightApiCalls.sync=this.apiService.getSync():this.logService.debug("Sync: Sync network call already in progress, returning existing promise");const e=yield this.inFlightApiCalls.sync;return yield this.cipherService.clear(e.profile.id),yield this.syncUserDecryption(e.profile.id,e.userDecryption),yield this.syncProfile(e.profile),yield this.syncFolders(e.folders,e.profile.id),yield this.syncCollections(e.collections,e.profile.id),yield this.syncCiphers(e.ciphers,e.profile.id),yield this.syncSends(e.sends,e.profile.id),yield this.syncSettings(e.domains,e.profile.id),yield this.syncPolicies(e.policies,e.profile.id),yield this.setLastSync(s,r),this.syncCompleted(!0,r)}catch(e){if(i)throw this.syncCompleted(!1,r),e;return this.syncCompleted(!1,r)}finally{this.inFlightApiCalls.refreshToken=null,this.inFlightApiCalls.sync=null}})}needsSyncing(e){return _se(this,void 0,void 0,function*(){if(e)return!0;const t=yield this.getLastSync();if(null==t||0===t.getTime())return!0;const i=yield this.apiService.getAccountRevisionDate();return i<0&&this.logoutCallback&&(yield this.logoutCallback("accountDeleted")),!(new Date(i)<=t)})}syncProfile(e){return _se(this,void 0,void 0,function*(){const t=yield this.tokenService.getSecurityStamp(e.id);if(null!=t&&t!==e.securityStamp)throw null!=this.logoutCallback&&(yield this.logoutCallback("invalidSecurityStamp")),new Error("Stamp has changed");(null==e?void 0:e.key)&&(yield this.masterPasswordService.setMasterKeyEncryptedUserKey(e.key,e.id)),null!=e.accountKeys?yield this.accountCryptographicStateService.setAccountCryptographicState(e.accountKeys.toWrappedAccountCryptographicState(),e.id):yield this.accountCryptographicStateService.setAccountCryptographicState({V1:{private_key:e.privateKey}},e.id),yield this.keyService.setProviderKeys(e.providers,e.id),yield this.keyService.setOrgKeys(e.organizations,e.providerOrganizations,e.id),yield this.avatarService.setSyncAvatarColor(e.id,e.avatarColor),yield this.tokenService.setSecurityStamp(e.securityStamp,e.id),yield this.accountService.setAccountEmailVerified(e.id,e.emailVerified),yield this.accountService.setAccountCreationDate(e.id,new Date(e.creationDate)),yield this.accountService.setAccountVerifyNewDeviceLogin(e.id,e.verifyDevices),yield this.billingAccountProfileStateService.setHasPremium(e.premiumPersonally,e.premiumFromOrganization,e.id),yield this.keyConnectorService.setUsesKeyConnector(e.usesKeyConnector,e.id),yield this.setForceSetPasswordReasonIfNeeded(e);const i={};e.providers.forEach(e=>{i[e.id]=new Mse(e)}),yield this.providerService.save(i,e.id),yield this.syncProfileOrganizations(e,e.id),(yield(0,bo._)(this.keyConnectorService.convertAccountRequired$))&&this.messageSender.send("convertAccountToKeyConnector")})}setForceSetPasswordReasonIfNeeded(e){return _se(this,void 0,void 0,function*(){var t;e.forcePasswordReset&&(yield this.masterPasswordService.setForceSetPasswordReason(aS.AdminForcePasswordReset,e.id));const i=yield(0,bo._)(this.userDecryptionOptionsService.userDecryptionOptionsById$(e.id));null==i&&this.logService.error("Sync: Account decryption options are null or undefined.");let n=!1;for(const t of e.organizations){const e=t.type===sp.Admin,i=t.type===sp.Owner;if(e||i||t.permissions&&t.permissions.manageResetPassword){n=!0;break}}if(void 0!==i.trustedDeviceOption&&!i.hasMasterPassword&&n){const e=null===(t=yield(0,bo._)(this.accountService.activeAccount$))||void 0===t?void 0:t.id;yield this.masterPasswordService.setForceSetPasswordReason(aS.TdeUserWithoutPasswordHasPasswordResetPermission,e)}})}syncProfileOrganizations(e,t){return _se(this,void 0,void 0,function*(){const i={};e.organizations.forEach(e=>{i[e.id]=new gee(e,{isMember:!0,isProviderUser:!1})}),e.providerOrganizations.forEach(e=>{null==i[e.id]?i[e.id]=new gee(e,{isMember:!1,isProviderUser:!0}):i[e.id].isProviderUser=!0}),yield this.organizationService.replace(i,t)})}syncFolders(e,t){return _se(this,void 0,void 0,function*(){const i={};return e.forEach(e=>{i[e.id]=new jse(e)}),yield this.folderService.replace(i,t)})}syncCollections(e,t){return _se(this,void 0,void 0,function*(){const i={};return e.forEach(e=>{i[e.id]=new xR(e)}),yield this.collectionService.replace(i,t)})}syncCiphers(e,t){return _se(this,void 0,void 0,function*(){const i={};return e.forEach(e=>{i[e.id]=new uN(e)}),yield this.cipherService.replace(i,t)})}syncSends(e,t){return _se(this,void 0,void 0,function*(){const i={};return e.forEach(e=>{i[e.id]=new Bse(e)}),yield this.sendService.replace(i,t)})}syncSettings(e,t){return _se(this,void 0,void 0,function*(){let i=[];return null!=e&&null!=e.equivalentDomains&&(i=i.concat(e.equivalentDomains)),null!=e&&null!=e.globalEquivalentDomains&&e.globalEquivalentDomains.forEach(e=>{e.domains.length>0&&i.push(e.domains)}),this.domainSettingsService.setEquivalentDomains(i,t)})}syncPolicies(e,t){return _se(this,void 0,void 0,function*(){const i={};return null!=e&&e.forEach(e=>{i[e.id]=new av(e)}),yield this.policyService.replace(i,t)})}syncUserDecryption(e,t){return _se(this,void 0,void 0,function*(){if(null!=t){if(null!=t.masterPasswordUnlock){const i=t.masterPasswordUnlock.toMasterPasswordUnlockData();yield this.masterPasswordService.setMasterPasswordUnlockData(i,e),yield this.kdfConfigService.setKdfConfig(e,i.kdf)}if(null!=t.webAuthnPrfOptions&&t.webAuthnPrfOptions.length>0)try{const i=yield(0,bo._)(this.accountService.activeAccount$);if((null==i?void 0:i.id)!==e)return;const n=yield(0,bo._)(this.userDecryptionOptionsService.userDecryptionOptionsById$(e)).catch(()=>null);if(null!=n){const e=Object.assign(new Yw,n);e.webAuthnPrfOptions=t.webAuthnPrfOptions.map(e=>qw.fromResponse(e)).filter(e=>void 0!==e),yield this.userDecryptionOptionsService.setUserDecryptionOptionsById(i.id,e)}}catch(e){this.logService.error("[Sync] Failed to update WebAuthn PRF options:",e)}}})}},deps:[Yb,Zk,eI,YE,MM,_b,Bp,uR,bk,Zb,Y0,Za,wT,mee,BL,YF,F0,Ow,AF,MT,T$,iee,Rd,u,sI,_v,oI]},{provide:oI,useClass:class{constructor(e){this.stateProvider=e}accountCryptographicState$(e){return this.stateProvider.getUserState$(ene,e)}setAccountCryptographicState(e,t){return Qie(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(ene,e,t)})}clearAccountCryptographicState(e){return Qie(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(ene,null,e)})}},deps:[u]},{provide:Pk,useClass:class{constructor(e){this.messageListener=e,this.subscriptions=new Map}subscribe(e,t){this.subscriptions.set(e,this.messageListener.allMessages$.subscribe(e=>{t(e)}))}unsubscribe(e){const t=this.subscriptions.get(e);null==t||t.unsubscribe(),this.subscriptions.delete(e)}},deps:[gk]},{provide:qp,useClass:class{constructor(e,t,i,n,r,s,o,a,l,c,u){this.accountService=e,this.pinStateService=t,this.userDecryptionOptionsService=i,this.keyService=n,this.tokenService=r,this.policyService=s,this.biometricStateService=o,this.stateProvider=a,this.logService=l,this.defaultVaultTimeout=c,this.sessionTimeoutTypeService=u}setVaultTimeoutOptions(e,t,i){return Pv(this,void 0,void 0,function*(){if(!e)throw new Error("User id required. Cannot set vault timeout settings.");if(null==t)throw new Error("Vault Timeout cannot be null.");if(null==i)throw new Error("Vault Timeout Action cannot be null.");const n=yield this.tokenService.getAccessToken(e),r=yield this.tokenService.getRefreshToken(e),s=yield this.tokenService.getClientId(e),o=yield this.tokenService.getClientSecret(e);yield this.setVaultTimeout(e,t),t!=vv&&i===pv.LogOut&&(yield this.tokenService.clearTokens(e)),yield this.setVaultTimeoutAction(e,i),yield this.tokenService.setTokens(n,i,t,r,[s,o]),yield this.keyService.refreshAdditionalKeys(e)})}availableVaultTimeoutActions$(e){return(null!=e?(0,Go.of)(e):iv(this.accountService.activeAccount$)).pipe((0,go.n)(e=>(0,jo.z)([this.userDecryptionOptionsService.hasMasterPasswordById$(e),this.biometricStateService.biometricUnlockEnabled$(e),this.pinStateService.pinSet$(e)])),(0,l.T)(([e,t,i])=>e||t||i?[pv.LogOut,pv.Lock]:[pv.LogOut]))}canLock(e){return Pv(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.availableVaultTimeoutActions$(e));return(null==t?void 0:t.includes(pv.Lock))||!1})}isBiometricLockSet(e){return Pv(this,void 0,void 0,function*(){return yield(0,bo._)(this.biometricStateService.biometricUnlockEnabled$(e))})}setVaultTimeout(e,t){return Pv(this,void 0,void 0,function*(){if(!e)throw new Error("User id required. Cannot set vault timeout.");if(null==t)throw new Error("Vault Timeout cannot be null.");yield this.stateProvider.setUserState(Tv,t,e)})}getVaultTimeoutByUserId$(e){if(!e)throw new Error("User id required. Cannot get vault timeout.");return(0,jo.z)([this.stateProvider.getUserState$(Tv,e),this.getMaxSessionTimeoutPolicyDataByUserId$(e)]).pipe((0,go.n)(([t,i])=>(this.logService.debug("[VaultTimeoutSettingsService] Current vault timeout is %o for user id %s, max session policy %o",t,e,i),(0,$d.H)(this.determineVaultTimeout(t,i)).pipe((0,To.H)(i=>Pv(this,void 0,void 0,function*(){return this.logService.debug("[VaultTimeoutSettingsService] Determined vault timeout is %o for user id %s",i,e),i!==t&&(yield this.stateProvider.setUserState(Tv,i,e)),i})),(0,Ed.W)(e=>(this.logService.error(`Error getting vault timeout: ${e}`),Wp.w))))),(0,mo.F)(),(0,Gp.t)({refCount:!0,bufferSize:1}))}determineVaultTimeout(e,t){return Pv(this,void 0,void 0,function*(){const i=yield this.determineVaultTimeoutInternal(e,t);return yield this.sessionTimeoutTypeService.getOrPromoteToAvailable(i)})}determineVaultTimeoutInternal(e,t){return Pv(this,void 0,void 0,function*(){if(e=null!=e?e:this.defaultVaultTimeout,null==t)return e;switch(t.type){case"immediately":return wv;case"custom":case null:case void 0:return e===wv?e:Iv(e)?Math.min(e,t.minutes):t.minutes;case"onSystemLock":if(e===vv||e===fv||e===mv||e===yv||e===gv)return mv;break;case"onAppRestart":if(e===vv||e===mv||e===yv||e===gv)return fv}return e})}setVaultTimeoutAction(e,t){return Pv(this,void 0,void 0,function*(){if(!e)throw new Error("User id required. Cannot set vault timeout action.");if(!t)throw new Error("Vault Timeout Action cannot be null");yield this.stateProvider.setUserState(Cv,t,e)})}getVaultTimeoutActionByUserId$(e){if(!e)throw new Error("User id required. Cannot get vault timeout action.");return(0,jo.z)([this.stateProvider.getUserState$(Cv,e),this.getMaxSessionTimeoutPolicyDataByUserId$(e),this.availableVaultTimeoutActions$(e)]).pipe((0,To.H)(t=>Pv(this,[t],void 0,function*([t,i,n]){const r=this.determineVaultTimeoutAction(n,t,i);return r!==t&&(yield this.stateProvider.setUserState(Cv,r,e)),r})),(0,Ed.W)(e=>(this.logService.error(`Error getting vault timeout: ${e}`),Wp.w)),(0,mo.F)(),(0,Gp.t)({refCount:!0,bufferSize:1}))}determineVaultTimeoutAction(e,t,i){return 1===e.length?e[0]:(null==i?void 0:i.action)&&e.includes(i.action)?i.action:null==t&&e.includes(pv.Lock)?pv.Lock:t}getMaxSessionTimeoutPolicyDataByUserId$(e){if(!e)throw new Error("User id required. Cannot get max session timeout policy.");return this.policyService.policiesByType$(op.MaximumVaultTimeout,e).pipe(hv,(0,l.T)(e=>{var t;return null!==(t=null==e?void 0:e.data)&&void 0!==t?t:null}))}},deps:[Zk,ore,$w,Bp,iee,Jb,Mp,u,Za,LT,mD]},{provide:xv,useClass:xv,deps:[Zk,Hb,Rd,qp,La,Za,ck,Nw]},{provide:Fv,useExisting:xv},{provide:xk,useClass:class{constructor(e,t,i){this.stateProvider=e,this.logService=t,this.policyService=i,this.codeVerifierState=this.stateProvider.getGlobal(Qte),this.ssoState=this.stateProvider.getGlobal(eie),this.orgSsoIdentifierState=this.stateProvider.getGlobal(iie),this.ssoEmailState=this.stateProvider.getGlobal(nie),this.ssoRequiredCacheState=this.stateProvider.getGlobal(rie),this.ssoRequiredCache$=this.ssoRequiredCacheState.state$.pipe((0,l.T)(e=>new Set(e)))}getCodeVerifier(){return(0,bo._)(this.codeVerifierState.state$)}setCodeVerifier(e){return Zte(this,void 0,void 0,function*(){yield this.codeVerifierState.update(t=>e)})}getSsoState(){return(0,bo._)(this.ssoState.state$)}setSsoState(e){return Zte(this,void 0,void 0,function*(){yield this.ssoState.update(t=>e)})}getOrganizationSsoIdentifier(){return(0,bo._)(this.orgSsoIdentifierState.state$)}setOrganizationSsoIdentifier(e){return Zte(this,void 0,void 0,function*(){yield this.orgSsoIdentifierState.update(t=>e)})}getSsoEmail(){return(0,bo._)(this.ssoEmailState.state$)}setSsoEmail(e){return Zte(this,void 0,void 0,function*(){yield this.ssoEmailState.update(t=>e)})}clearSsoEmail(){return Zte(this,void 0,void 0,function*(){yield this.ssoEmailState.update(e=>null)})}getActiveUserOrganizationSsoIdentifier(e){return(0,bo._)(this.userOrgSsoIdentifierState(e).state$)}setActiveUserOrganizationSsoIdentifier(e,t){return Zte(this,void 0,void 0,function*(){void 0!==t?yield this.userOrgSsoIdentifierState(t).update(t=>e):this.logService.error("Tried to set a user organization sso identifier with an undefined user id.")})}userOrgSsoIdentifierState(e){return this.stateProvider.getUser(e,tie)}addToSsoRequiredCache(e){return Zte(this,void 0,void 0,function*(){yield this.ssoRequiredCacheState.update(t=>null==t?[e]:[...t,e],{shouldUpdate:t=>null==t||!t.includes(e)})})}removeFromSsoRequiredCacheIfPresent(e){return Zte(this,void 0,void 0,function*(){yield this.ssoRequiredCacheState.update(t=>{var i;return null!==(i=null==t?void 0:t.filter(t=>t!==e))&&void 0!==i?i:t},{shouldUpdate:t=>null!=t&&t.includes(e)})})}updateSsoRequiredCache(e,t){return Zte(this,void 0,void 0,function*(){(yield(0,bo._)(this.policyService.policyAppliesToUser$(op.RequireSso,t)))?yield this.addToSsoRequiredCache(e.toLowerCase()):yield this.removeFromSsoRequiredCacheIfPresent(e.toLowerCase())})}},deps:[u,Za,Jb]},{provide:fo,useClass:class{constructor(e,t,i){this.storageService=e,this.secureStorageService=t,this.activeUserAccessor=i}clean(e){return Ho(this,void 0,void 0,function*(){yield this.setUserKeyAutoUnlock(null,e),yield this.clearUserKeyBiometric(e.userId)})}getUserKeyAutoUnlock(e){return Ho(this,void 0,void 0,function*(){return null==e.userId?null:yield this.secureStorageService.get(`${e.userId}${Zo}`,{userId:e.userId,keySuffix:"auto"})})}setUserKeyAutoUnlock(e,t){return Ho(this,void 0,void 0,function*(){null!=t.userId&&(yield this.saveSecureStorageKey(Zo,e,t.userId,"auto"))})}clearUserKeyBiometric(e){return Ho(this,void 0,void 0,function*(){null!=e&&(yield this.saveSecureStorageKey(Qo,null,e,"biometric"))})}getDuckDuckGoSharedKey(){return Ho(this,void 0,void 0,function*(){return null==(yield this.getActiveUserIdFromStorage())?null:yield this.secureStorageService.get(ea)})}setDuckDuckGoSharedKey(e){return Ho(this,void 0,void 0,function*(){null!=(yield this.getActiveUserIdFromStorage())&&(null==e?yield this.secureStorageService.remove(ea):yield this.secureStorageService.save(ea,e))})}setEnableDuckDuckGoBrowserIntegration(e){return Ho(this,void 0,void 0,function*(){var t;const i=null!==(t=yield this.storageService.get(Jo))&&void 0!==t?t:new Yo;i.enableDuckDuckGoBrowserIntegration=e,yield this.storageService.save(Jo,i)})}getActiveUserIdFromStorage(){return Ho(this,void 0,void 0,function*(){return yield(0,bo._)(this.activeUserAccessor.activeUserId$)})}saveSecureStorageKey(e,t,i,n){return Ho(this,void 0,void 0,function*(){return null==t?yield this.secureStorageService.remove(`${i}${e}`,{keySuffix:n}):yield this.secureStorageService.save(`${i}${e}`,t,{keySuffix:n})})}},deps:[yp,UT,Wo]},{provide:V_,useClass:class extends U_{constructor(e,t,i,n,r,s,o,a,l){super(i,r,s,o),this.folderService=e,this.cipherService=t,this.keyService=n,this.apiService=a,this.restrictedItemTypesService=l}getExport(e){return j_(this,arguments,void 0,function*(e,t="csv"){return"encrypted_json"===t?this.getEncryptedExport(e):"zip"===t?this.getDecryptedExportZip(e):this.getDecryptedExport(e,t)})}getPasswordProtectedExport(e,t){return j_(this,void 0,void 0,function*(){const i=yield this.getExport(e,"json");if("text/plain"!==i.type)throw new Error("Unexpected export type");return{type:"text/plain",data:yield this.buildPasswordExport(e,i.data,t),fileName:M_.getFileName("","encrypted_json")}})}getDecryptedExportZip(e){return j_(this,void 0,void 0,function*(){const t=new B_,i=yield this.getDecryptedExport(e,"json");t.file("data.json",i.data);const n=t.folder("attachments");if(null==n)throw new Error("Error creating attachments folder");for(const t of yield this.cipherService.getAllDecrypted(e)){if(!t.attachments||0===t.attachments.length||null!=t.deletedDate||null!=t.organizationId)continue;const i=n.folder(t.id);for(const n of t.attachments){const r=yield this.downloadAttachment(t.id,n.id);try{const s=yield this.cipherService.getDecryptedAttachmentBuffer(t.id,n,r,e);i.file(n.fileName,s)}catch(e){throw new Error("Error decrypting attachment")}}}return{type:"application/zip",data:yield t.generateAsync({type:"blob"}),fileName:M_.getFileName("","zip")}})}downloadAttachment(e,t){return j_(this,void 0,void 0,function*(){const i=(yield this.apiService.getAttachmentData(e,t)).url,n=yield fetch(new Request(i,{cache:"no-store"}));if(200!==n.status)throw new Error("Error downloading attachment");return n})}getDecryptedExport(e,t){return j_(this,void 0,void 0,function*(){let i=[],n=[];const r=[];r.push((0,bo._)(this.folderService.folderViews$(e)).then(e=>{i=e}));const s=yield(0,bo._)(this.restrictedItemTypesService.restricted$);return r.push(this.cipherService.getAllDecrypted(e).then(e=>{n=e.filter(e=>null==e.deletedDate&&!this.restrictedItemTypesService.isCipherRestricted(e,s))})),yield Promise.all(r),"csv"===t?{type:"text/plain",data:this.buildCsvExport(i,n),fileName:M_.getFileName("","csv")}:{type:"text/plain",data:this.buildJsonExport(i,n),fileName:M_.getFileName("","json")}})}getEncryptedExport(e){return j_(this,void 0,void 0,function*(){if(!e)throw new Error("User ID must not be null or undefined");let t=[],i=[];const n=[];n.push((0,bo._)(this.folderService.folders$(e)).then(e=>{t=e}));const r=yield(0,bo._)(this.restrictedItemTypesService.restricted$);n.push(this.cipherService.getAll(e).then(e=>{i=e.filter(e=>null==e.deletedDate&&!this.restrictedItemTypesService.isCipherRestricted(e,r))})),yield Promise.all(n);const s=yield(0,bo._)(this.keyService.userKey$(e)),o={encrypted:!0,encKeyValidation_DO_NOT_EDIT:(yield this.encryptService.encryptString(bd.newGuid(),s)).encryptedString,folders:[],items:[]};return t.forEach(e=>{if(!e.id)return;const t=new F_;t.build(e),o.folders.push(t)}),i.forEach(e=>{if(null!=e.organizationId)return;const t=new w_;t.build(e),t.collectionIds=null,o.items.push(t)}),{type:"text/plain",data:JSON.stringify(o,null," "),fileName:M_.getFileName("","encrypted_json")}})}buildCsvExport(e,t){const i=new Map;e.forEach(e=>{e.id&&i.set(e.id,e)});const n=[];return t.forEach(e=>{if(e.type!==nx.Login&&e.type!==nx.SecureNote)return;if(null!=e.organizationId)return;const t={};t.folder=null!=e.folderId&&i.has(e.folderId)?i.get(e.folderId).name:null,t.favorite=e.favorite?1:null,this.buildCommonCipher(t,e),n.push(t)}),Qz.unparse(n)}buildJsonExport(e,t){const i={encrypted:!1,folders:[],items:[]};return e.forEach(e=>{if(!e.id)return;const t=new F_;t.build(e),i.folders.push(t)}),t.forEach(e=>{if(null!=e.organizationId)return;const t=new w_;t.build(e),t.collectionIds=null,delete t.key,i.items.push(t)}),JSON.stringify(i,null," ")}},deps:[UM,_b,jz,Bp,$G,FI,_v,eI,r$]},{provide:G_,useClass:class{constructor(e){this.apiService=e}getOrganizationExport(e){return z_(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/export",void 0,!0,!0);return new L_(t)})}},deps:[eI]},{provide:$_,useClass:class extends U_{constructor(e,t,i,n,r,s,o,a,l){super(i,r,s,a),this.cipherService=e,this.vaultExportApiService=t,this.keyService=n,this.collectionService=o,this.restrictedItemTypesService=l}getPasswordProtectedExport(e,t,i,n){return N_(this,void 0,void 0,function*(){const r=yield this.getOrganizationExport(e,t,"json",n);return{type:"text/plain",data:yield this.buildPasswordExport(e,r.data,i),fileName:M_.getFileName("org","encrypted_json")}})}getOrganizationExport(e,t){return N_(this,arguments,void 0,function*(e,t,i="csv",n){if(bd.isNullOrWhitespace(t))throw new Error("OrganizationId must be set");if("zip"===i)throw new Error("Zip export not supported for organization");return"encrypted_json"===i?{type:"text/plain",data:n?yield this.getEncryptedManagedExport(e,t):yield this.getOrganizationEncryptedExport(e,t),fileName:M_.getFileName("org","encrypted_json")}:{type:"text/plain",data:n?yield this.getDecryptedManagedExport(e,t,i):yield this.getOrganizationDecryptedExport(e,t,i),fileName:M_.getFileName("org",i)}})}getOrganizationDecryptedExport(e,t,i){return N_(this,void 0,void 0,function*(){const n=[],r=[],s=[],o=yield(0,bo._)(this.keyService.orgKeys$(e).pipe((0,Eo.p)(e=>null!=e))),a=yield(0,bo._)(this.restrictedItemTypesService.restricted$);return s.push(this.vaultExportApiService.getOrganizationExport(t).then(i=>{const s=[];return null!=i&&(null!=i.collections&&i.collections.length>0&&i.collections.forEach(e=>{const i=bR.fromCollectionData(new xR(e)),r=o[t];s.push(i.decrypt(r,this.encryptService).then(e=>{n.push(e)}))}),null!=i.ciphers&&i.ciphers.length>0&&i.ciphers.filter(e=>null===e.deletedDate).forEach(t=>N_(this,void 0,void 0,function*(){const i=new AN(new uN(t));s.push(this.cipherService.decrypt(i,e).then(e=>{this.restrictedItemTypesService.isCipherRestricted(e,a)||r.push(e)}))}))),Promise.all(s)})),yield Promise.all(s),"csv"===i?this.buildCsvExport(n,r):this.buildJsonExport(n,r)})}getOrganizationEncryptedExport(e,t){return N_(this,void 0,void 0,function*(){const i=[],n=[],r=yield(0,bo._)(this.restrictedItemTypesService.restricted$),s=yield this.vaultExportApiService.getOrganizationExport(t);if(null!=s)return null!=s.collections&&s.collections.length>0&&s.collections.forEach(e=>{const t=bR.fromCollectionData(new xR(e));i.push(t)}),null!=s.ciphers&&s.ciphers.length>0&&s.ciphers.filter(e=>null===e.deletedDate).forEach(e=>{const t=new AN(new uN(e));this.restrictedItemTypesService.isCipherRestricted(t,r)||n.push(t)}),this.BuildEncryptedExport(e,t,i,n)})}getDecryptedManagedExport(e,t,i){return N_(this,void 0,void 0,function*(){let n=[],r=[];const s=[];s.push(this.cipherService.getAllDecrypted(e).then(e=>{r=e})),yield Promise.all(s);const o=yield(0,bo._)(this.collectionService.decryptedCollections$(e).pipe((0,l.T)(e=>e.filter(e=>e.organizationId==t&&e.manage)))),a=yield(0,bo._)(this.restrictedItemTypesService.restricted$);return n=r.filter(e=>null==e.deletedDate&&e.organizationId==t&&o.some(t=>e.collectionIds.some(e=>t.id===e))&&!this.restrictedItemTypesService.isCipherRestricted(e,a)),"csv"===i?this.buildCsvExport(o,n):this.buildJsonExport(o,n)})}getEncryptedManagedExport(e,t){return N_(this,void 0,void 0,function*(){let i=[],n=[];const r=[];r.push(this.cipherService.getAll(e).then(e=>{n=e})),yield Promise.all(r);const s=yield(0,bo._)(this.collectionService.encryptedCollections$(e).pipe((0,l.T)(e=>null!=e?e:[]),(0,l.T)(e=>e.filter(e=>e.organizationId==t&&e.manage)))),o=yield(0,bo._)(this.restrictedItemTypesService.restricted$);return i=n.filter(e=>null==e.deletedDate&&e.organizationId==t&&s.some(t=>e.collectionIds.some(e=>t.id===e))&&!this.restrictedItemTypesService.isCipherRestricted(e,o)),this.BuildEncryptedExport(e,t,s,i)})}BuildEncryptedExport(e,t,i,n){return N_(this,void 0,void 0,function*(){const r=yield(0,bo._)(this.keyService.orgKeys$(e)),s=null==r?void 0:r[t];if(null==s)throw new Error("No encryption key found for organization");const o={encrypted:!0,encKeyValidation_DO_NOT_EDIT:(yield this.encryptService.encryptString(y(),s)).encryptedString,collections:[],items:[]};return i.forEach(e=>{const t=new I_;t.build(e),o.collections.push(t)}),n.forEach(e=>{const t=new w_;t.build(e),o.items.push(t)}),JSON.stringify(o,null," ")})}buildCsvExport(e,t){const i=new Map;e.forEach(e=>{i.set(e.id,e)});const n=[];return t.forEach(e=>{if(e.type!==nx.Login&&e.type!==nx.SecureNote)return;const t={collections:[]};null!=e.collectionIds&&(t.collections=e.collectionIds.filter(e=>i.has(e)).map(e=>i.get(e).name)),this.buildCommonCipher(t,e),n.push(t)}),Qz.unparse(n)}buildJsonExport(e,t){const i={encrypted:!1,collections:[],items:[]};return e.forEach(e=>{const t=new I_;t.build(e),i.collections.push(t)}),t.forEach(e=>{const t=new w_;t.build(e),delete t.key,i.items.push(t)}),JSON.stringify(i,null," ")}},deps:[_b,G_,jz,Bp,$G,FI,uR,_v,r$]},{provide:D_,useClass:class{constructor(e,t,i){this.individualVaultExportService=e,this.organizationVaultExportService=t,this.accountService=i}getExport(e){return E_(this,arguments,void 0,function*(e,t="csv",i=""){if(yield this.checkForImpersonation(e),!bd.isNullOrWhitespace(i)){if("csv"==t)throw new Error("CSV does not support password protected export");return this.individualVaultExportService.getPasswordProtectedExport(e,i)}return this.individualVaultExportService.getExport(e,t)})}getOrganizationExport(e,t,i,n){return E_(this,arguments,void 0,function*(e,t,i,n,r=!1){if(yield this.checkForImpersonation(e),!bd.isNullOrWhitespace(n)){if("csv"==i)throw new Error("CSV does not support password protected export");return this.organizationVaultExportService.getPasswordProtectedExport(e,t,n,r)}return this.organizationVaultExportService.getOrganizationExport(e,t,i,r)})}formats$(e){const t=[{name:".json",format:"json"},{name:".csv",format:"csv"},{name:".json (Encrypted)",format:"encrypted_json"}];return e.isMyVault?(0,Go.of)([...t,{name:".zip (with attachments)",format:"zip"}]):(0,Go.of)(t)}checkForImpersonation(e){return E_(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));if(e!==t)throw new Error("UserId does not match the currently authenticated user")})}},deps:[V_,$_,Zk]},{provide:sQ,useClass:v6,deps:[Za,Ul,u]},{provide:Bre,useClass:Bre,deps:[eI,Tk]},{provide:$re,useClass:$re,deps:[eI,Za,Hb]},{provide:Mre,useClass:class{supportStatus$(e){return(0,Go.of)({type:"not-supported",reason:"client-not-supported"})}},deps:[]},{provide:kre,useClass:Ire,deps:[]},{provide:kre,useClass:Ire,deps:[]},{provide:Xse,useClass:Wse,deps:[]},{provide:nZ,useClass:nZ,deps:[u]},{provide:see,useClass:Mte,deps:[Zk,Rd,Wb,bk,nZ]},{provide:tR,useClass:class{constructor(e,t,i,n,r,s,o){this.configService=e,this.apiService=t,this.organizationUserService=i,this.stateProvider=n,this.organizationService=r,this.organizationUserApiService=s,this.policyService=o}autoConfirmState(e){return this.stateProvider.getUser(e,nR)}configuration$(e){return this.autoConfirmState(e).state$.pipe((0,l.T)(t=>{var i;return null!==(i=null==t?void 0:t[e])&&void 0!==i?i:new iR}))}upsert(e,t){return oR(this,void 0,void 0,function*(){yield this.autoConfirmState(e).update(i=>Object.assign(Object.assign({},i),{[e]:t}))})}canManageAutoConfirm$(e){return(0,jo.z)([this.configService.getFeatureFlag$(Wv.AutoConfirm),this.organizationService.organizations$(e).pipe((0,l.T)(e=>e[0])),this.policyService.policyAppliesToUser$(op.AutoConfirm,e)]).pipe((0,l.T)(([e,t,i])=>{var n;return e&&i&&null!==(n=null==t?void 0:t.canManageAutoConfirm)&&void 0!==n&&n}))}autoConfirmUser(e,t,i){return oR(this,void 0,void 0,function*(){if(!(yield(0,bo._)(this.canManageAutoConfirm$(e))))return;if(!(yield(0,bo._)(this.configuration$(e).pipe((0,l.T)(e=>e.enabled)))))return;const n=this.organizationService.organizations$(e).pipe(rR(i),(0,l.T)(e=>{if(null==e)throw new Error("Organization not found");return e})),r=yield this.apiService.getUserPublicKey(e),s=bd.fromB64ToArray(r.publicKey);yield(0,bo._)(n.pipe((0,go.n)(e=>this.organizationUserService.buildConfirmRequest(e,s)),(0,go.n)(e=>this.organizationUserApiService.postOrganizationUserAutoConfirm(i,t,e))))})}},deps:[Kb,eI,NR,u,YF,MR,Zb]},{provide:Rre,useClass:class{constructor(e,t,i,n,r,s,o,a,c,u,d,h,p,v){var f;this.logService=e,this.syncService=t,this.appIdService=i,this.environmentService=n,this.logoutCallback=r,this.messagingService=s,this.accountService=o,this.signalRConnectionService=a,this.authService=c,this.webPushConnectionService=u,this.authRequestAnsweringService=d,this.configService=h,this.policyService=p,this.autoConfirmService=v,this.activitySubject=new Dd.t("active"),this.notifications$=this.accountService.accounts$.pipe((0,l.T)(e=>{const t=Object.entries(e).filter(([e,t])=>""!==t.email||t.emailVerified).map(([e,t])=>e);return new Set(t)}),(f=e=>this.userNotifications$(e).pipe((0,l.T)(t=>[t,e])),e=>{const t=new Map,i=()=>{for(const[,e]of t.entries())e.unsubscribe();t.clear()};return new aa.c(n=>{const r=e.subscribe({next:e=>{var i;for(const n of t.keys())e.has(n)?e.delete(n):(null===(i=t.get(n))||void 0===i||i.unsubscribe(),t.delete(n));for(const i of e.keys())t.set(i,f(i).subscribe({next:e=>{n.next(e)},error:e=>{n.error(e)},complete:()=>{t.delete(i)}}))},error:e=>{n.error(e)},complete:()=>{i(),n.complete()}});return()=>{i(),r.unsubscribe()}})}),(0,Fo.u)())}userNotifications$(e){return this.environmentService.getEnvironment$(e).pipe((0,l.T)(e=>e.getNotificationsUrl()),(0,mo.F)(),(0,go.n)(t=>"http://-"===t?Wp.w:this.userNotificationsHelper$(e,t)))}userNotificationsHelper$(e,t){return this.hasAccessToken$(e).pipe((0,go.n)(e=>e?this.activitySubject:Wp.w),(0,go.n)(t=>"inactive"===t?Wp.w:this.webPushConnectionService.supportStatus$(e)),(i={supported:i=>(this.logService.info("Using WebPush for server notifications"),i.notifications$.pipe((0,Ed.W)(i=>(this.logService.warning("Issue with web push, falling back to SignalR",i),this.connectSignalR$(e,t))))),notSupported:()=>(this.logService.info("Using SignalR for server notifications"),this.connectSignalR$(e,t))},(0,go.n)((e,t)=>"supported"===e.type?i.supported(e.service,t):i.notSupported(e.reason,t))));var i}connectSignalR$(e,t){return this.signalRConnectionService.connect$(e,t).pipe((0,Eo.p)(e=>"ReceiveMessage"===e.type),(0,l.T)(e=>e.message))}hasAccessToken$(e){return this.authService.authStatusFor$(e).pipe((0,l.T)(e=>e===Pd.Locked||e===Pd.Unlocked),(0,mo.F)())}processNotification(e,t){return Ore(this,void 0,void 0,function*(){var i,n;const r=yield this.appIdService.getAppId();if(null==e||e.contextId===r)return;const s=(null===(i=e.payload)||void 0===i?void 0:i.userId)||(null===(n=e.payload)||void 0===n?void 0:n.UserId);if(null!=s&&s!==t)return;if((yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id))))===t||Ure.has(e.type))switch(e.type){case Ba.SyncCipherCreate:case Ba.SyncCipherUpdate:yield this.syncService.syncUpsertCipher(e.payload,e.type===Ba.SyncCipherUpdate,t);break;case Ba.SyncCipherDelete:case Ba.SyncLoginDelete:yield this.syncService.syncDeleteCipher(e.payload,t);break;case Ba.SyncFolderCreate:case Ba.SyncFolderUpdate:yield this.syncService.syncUpsertFolder(e.payload,e.type===Ba.SyncFolderUpdate,t);break;case Ba.SyncFolderDelete:yield this.syncService.syncDeleteFolder(e.payload,t);break;case Ba.SyncVault:case Ba.SyncCiphers:case Ba.SyncSettings:yield this.syncService.fullSync(!1);break;case Ba.SyncOrganizations:yield this.syncService.fullSync(!0);break;case Ba.SyncOrgKeys:yield this.syncService.fullSync(!0),this.activitySubject.next("inactive"),this.activitySubject.next("active");break;case Ba.LogOut:{this.logService.info("[Notifications Service] Received logout notification");const i=e.payload;(yield(0,bo._)(this.configService.getFeatureFlag$(Wv.NoLogoutOnKdfChange)))&&i.reason===ja.KdfChange?this.logService.info("[Notifications Service] Skipping logout due to no logout KDF change"):yield this.logoutCallback("logoutNotification",t);break}case Ba.SyncSendCreate:case Ba.SyncSendUpdate:yield this.syncService.syncUpsertSend(e.payload,e.type===Ba.SyncSendUpdate);break;case Ba.SyncSendDelete:yield this.syncService.syncDeleteSend(e.payload);break;case Ba.AuthRequest:if(this.authRequestAnsweringService.receivedPendingAuthRequest)try{yield this.authRequestAnsweringService.receivedPendingAuthRequest(e.payload.userId,e.payload.id)}catch(e){this.logService.error(`Failed to process auth request notification: ${e}`)}else this.messagingService.send("openLoginApproval",{notificationId:e.payload.id});break;case Ba.SyncOrganizationStatusChanged:case Ba.SyncOrganizationCollectionSettingChanged:yield this.syncService.fullSync(!0);break;case Ba.OrganizationBankAccountVerified:this.messagingService.send("organizationBankAccountVerified",{organizationId:e.payload.organizationId});break;case Ba.ProviderBankAccountVerified:this.messagingService.send("providerBankAccountVerified",{providerId:e.payload.providerId,adminId:e.payload.adminId});break;case Ba.SyncPolicy:yield this.policyService.syncPolicy(av.fromPolicy(e.payload.policy));break;case Ba.AutoConfirmMember:yield this.autoConfirmService.autoConfirmUser(e.payload.userId,e.payload.targetUserId,e.payload.organizationId)}})}startListening(){return this.notifications$.pipe((0,Xx.Z)(e=>Ore(this,[e],void 0,function*([e,t]){try{yield this.processNotification(e,t)}catch(t){this.logService.error(`Problem processing notification of type ${e.type}`,t)}}))).subscribe({error:e=>this.logService.error("Fatal error in server notifications$ observable, notifications won't be recieved anymore.",e)})}reconnectFromActivity(){this.activitySubject.next("active")}disconnectFromInactivity(){this.activitySubject.next("inactive")}},deps:[Za,qx,Tk,mk,MT,bk,Zk,$re,Rd,Mre,see,Kb,Zb,tR]},{provide:FI,useClass:ane,deps:[AT]},{provide:$G,useClass:class{constructor(e,t,i){this.cryptoFunctionService=e,this.logService=t,this.logMacFailures=i}encryptString(e,t){return rne(this,void 0,void 0,function*(){return null==e?(this.logService.warning("[EncryptService] WARNING: encryptString called with null value. Returning null, but this behavior is deprecated and will be removed."),null):(yield om.Ready,new Pp(nm.IEs.symmetric_encrypt_string(e,t.toEncoded())))})}encryptBytes(e,t){return rne(this,void 0,void 0,function*(){return yield om.Ready,new Pp(nm.IEs.symmetric_encrypt_bytes(e,t.toEncoded()))})}encryptFileData(e,t){return rne(this,void 0,void 0,function*(){return yield om.Ready,new nne(nm.IEs.symmetric_encrypt_filedata(e,t.toEncoded()))})}decryptString(e,t){return rne(this,void 0,void 0,function*(){if(e.encryptionType===hp.AesCbc256_B64)throw new Error("Decryption of AesCbc256_B64 encrypted data is disabled.");return yield om.Ready,nm.IEs.symmetric_decrypt_string(e.encryptedString,t.toEncoded())})}decryptBytes(e,t){return rne(this,void 0,void 0,function*(){if(e.encryptionType===hp.AesCbc256_B64)throw new Error("Decryption of AesCbc256_B64 encrypted data is disabled.");return yield om.Ready,nm.IEs.symmetric_decrypt_bytes(e.encryptedString,t.toEncoded())})}decryptFileData(e,t){return rne(this,void 0,void 0,function*(){if(e.encryptionType===hp.AesCbc256_B64)throw new Error("Decryption of AesCbc256_B64 encrypted data is disabled.");return yield om.Ready,nm.IEs.symmetric_decrypt_filedata(e.buffer,t.toEncoded())})}wrapDecapsulationKey(e,t){return rne(this,void 0,void 0,function*(){if(null==e)throw new Error("No decapsulation key provided for wrapping.");if(null==t)throw new Error("No wrappingKey provided for wrapping.");return yield om.Ready,new Pp(nm.IEs.wrap_decapsulation_key(e,t.toEncoded()))})}wrapEncapsulationKey(e,t){return rne(this,void 0,void 0,function*(){if(null==e)throw new Error("No encapsulation key provided for wrapping.");if(null==t)throw new Error("No wrappingKey provided for wrapping.");return yield om.Ready,new Pp(nm.IEs.wrap_encapsulation_key(e,t.toEncoded()))})}wrapSymmetricKey(e,t){return rne(this,void 0,void 0,function*(){if(null==e)throw new Error("No keyToBeWrapped provided for wrapping.");if(null==t)throw new Error("No wrappingKey provided for wrapping.");return yield om.Ready,new Pp(nm.IEs.wrap_symmetric_key(e.toEncoded(),t.toEncoded()))})}unwrapDecapsulationKey(e,t){return rne(this,void 0,void 0,function*(){if(null==e)throw new Error("No wrappedDecapsulationKey provided for unwrapping.");if(null==t)throw new Error("No wrappingKey provided for unwrapping.");if(e.encryptionType===hp.AesCbc256_B64)throw new Error("Decryption of AesCbc256_B64 encrypted data is disabled.");return yield om.Ready,nm.IEs.unwrap_decapsulation_key(e.encryptedString,t.toEncoded())})}unwrapEncapsulationKey(e,t){return rne(this,void 0,void 0,function*(){if(null==e)throw new Error("No wrappedEncapsulationKey provided for unwrapping.");if(null==t)throw new Error("No wrappingKey provided for unwrapping.");if(e.encryptionType===hp.AesCbc256_B64)throw new Error("Decryption of AesCbc256_B64 encrypted data is disabled.");return yield om.Ready,nm.IEs.unwrap_encapsulation_key(e.encryptedString,t.toEncoded())})}unwrapSymmetricKey(e,t){return rne(this,void 0,void 0,function*(){if(null==e)throw new Error("No keyToBeUnwrapped provided for unwrapping.");if(null==t)throw new Error("No wrappingKey provided for unwrapping.");if(e.encryptionType===hp.AesCbc256_B64)throw new Error("Decryption of AesCbc256_B64 encrypted data is disabled.");return yield om.Ready,new Dv(nm.IEs.unwrap_symmetric_key(e.encryptedString,t.toEncoded()))})}hash(e,t){return rne(this,void 0,void 0,function*(){const i=yield this.cryptoFunctionService.hash(e,t);return bd.fromBufferToB64(i)})}encapsulateKeyUnsigned(e,t){return rne(this,void 0,void 0,function*(){if(null==e)throw new Error("No sharedKey provided for encapsulation");if(null==t)throw new Error("No encapsulationKey provided for encapsulation");return yield om.Ready,new Pp(nm.IEs.encapsulate_key_unsigned(e.toEncoded(),t))})}decapsulateKeyUnsigned(e,t){return rne(this,void 0,void 0,function*(){if(null==e)throw new Error("No encryptedSharedKey provided for decapsulation");if(null==t)throw new Error("No decapsulationKey provided for decapsulation");yield om.Ready;const i=nm.IEs.decapsulate_key_unsigned(e.encryptedString,t);return new Dv(i)})}},deps:[FI,Za,jT]},{provide:hee,useClass:class{constructor(e,t,i,n,r){this.apiService=e,this.stateProvider=t,this.logService=i,this.authService=n,this.taskSchedulerService=r,this.inited=!1,this.taskSchedulerService.registerTaskHandler(qa,()=>this.uploadEvents())}init(e){this.inited||(this.inited=!0,e&&(this.uploadEvents(),this.taskSchedulerService.setInterval(qa,6e4)))}uploadEvents(e){return yoe(this,void 0,void 0,function*(){if(e||(e=yield(0,bo._)(this.stateProvider.activeUserId$)),!e)return;if(!(yield(0,bo._)(this.authService.authStatusFor$(e).pipe((0,l.T)(e=>e===Pd.Unlocked)))))return;const t=yield this.takeEvents(e);if(null==t||0===t.length)return;const i=t.map(e=>{const t=new goe;return t.type=e.type,t.cipherId=e.cipherId,t.date=e.date,t.organizationId=e.organizationId,t});try{yield this.apiService.postEventsCollect(i,e)}catch(i){this.logService.error(i),yield this.stateProvider.setUserState(foe,t,e)}})}takeEvents(e){return yoe(this,void 0,void 0,function*(){let t=null;return yield this.stateProvider.getUser(e,foe).update(e=>(t=null!=e?e:[],[])),t})}},deps:[eI,u,Za,Rd,La]},{provide:I$,useClass:class{constructor(e,t,i,n,r,s){this.cipherService=e,this.stateProvider=t,this.organizationService=i,this.eventUploadService=n,this.authService=r,this.accountService=s,this.getOrgIds=e=>{var t,i;return null!==(i=null===(t=null==e?void 0:e.filter(e=>e.useEvents))||void 0===t?void 0:t.map(e=>e.id))&&void 0!==i?i:[]}}collectMany(e,t){return moe(this,arguments,void 0,function*(e,t,i=!1){const n=yield(0,bo._)(iv(this.accountService.activeAccount$)),r=this.stateProvider.getUser(n,foe);if(!(yield this.shouldUpdate(n,null,e,t)))return;const s=this.organizationService.organizations$(n).pipe((0,l.T)(e=>this.getOrgIds(e)),(0,l.T)(i=>t.filter(e=>i.includes(e.organizationId)).map(t=>({type:e,cipherId:t.id,date:(new Date).toISOString(),organizationId:t.organizationId}))));yield r.update((e,t)=>[...null!=e?e:[],...t],{combineLatestWith:s}),i&&(yield this.eventUploadService.uploadEvents())})}collect(e){return moe(this,arguments,void 0,function*(e,t=null,i=!1,n=null){const r=yield(0,bo._)(iv(this.accountService.activeAccount$)),s=this.stateProvider.getUser(r,foe);if(!(yield this.shouldUpdate(r,n,e,void 0,t)))return;const o=new voe;o.type=e,o.cipherId=t,o.date=(new Date).toISOString(),o.organizationId=n,yield s.update(e=>((e=null!=e?e:[]).push(o),e)),i&&(yield this.eventUploadService.uploadEvents())})}shouldUpdate(e){return moe(this,arguments,void 0,function*(e,t=null,i=null,n=[],r){const s=(0,$d.H)(this.cipherService.get(r,e)),o=this.organizationService.organizations$(e).pipe((0,l.T)(e=>this.getOrgIds(e))),[a,c,u]=yield(0,bo._)((0,hm.y)(this.authService.activeAccountStatus$,o,s));if(a!=Pd.Unlocked)return!1;if(null==c||0==c.length)return!1;if(i==Ua.User_ClientExportedVault)return!0;if(null!=u&&n.push(new RO(u)),(null==n||0==n.length)&&null==t)return!1;if(null!=n&&n.length>0){return n.filter(e=>c.includes(e.organizationId)).length>0}return!(null!=t&&!c.includes(t))})}},deps:[_b,u,WF,hee,Rd,Zk]},{provide:Zb,useClass:class{constructor(e,t,i){this.stateProvider=e,this.organizationService=t,this.accountService=i}policyState(e){return this.stateProvider.getUser(e,uv)}policyData$(e){return this.policyState(e).state$.pipe((0,l.T)(e=>null!=e?e:{}))}policies$(e){return this.policyData$(e).pipe((0,l.T)(e=>{return t=e,Object.values(t||{}).map(e=>new lv(e));var t}))}policiesByType$(e,t){if(!t)throw new Error("No userId provided");const i=this.policies$(t),n=this.organizationService.organizations$(t);return(0,jo.z)([i,n]).pipe((0,l.T)(([e,t])=>this.enforcedPolicyFilter(e,t)),(0,l.T)(t=>t.filter(t=>t.type===e)))}policyAppliesToUser$(e,t){return this.policiesByType$(e,t).pipe(hv,(0,l.T)(e=>!!e))}enforcedPolicyFilter(e,t){const i=Object.fromEntries(t.map(e=>[e.id,e]));return e.filter(t=>{const n=i[t.organizationId];return!n||t.enabled&&n.status>=rp.Accepted&&n.usePolicies&&!this.isExemptFromPolicy(t.type,n,e)})}masterPasswordPolicyOptions$(e,t){return(t?(0,Go.of)(t):this.policies$(e)).pipe((0,l.T)(e=>{var t;let i;const n=null!==(t=e.filter(e=>e.type===op.MasterPassword))&&void 0!==t?t:[];if(0!==n.length)return n.forEach(e=>{e.enabled&&e.data&&(i||(i=new ov),null!=e.data.minComplexity&&e.data.minComplexity>i.minComplexity&&(i.minComplexity=e.data.minComplexity),null!=e.data.minLength&&e.data.minLength>i.minLength&&(i.minLength=e.data.minLength),e.data.requireUpper&&(i.requireUpper=!0),e.data.requireLower&&(i.requireLower=!0),e.data.requireNumbers&&(i.requireNumbers=!0),e.data.requireSpecial&&(i.requireSpecial=!0),e.data.enforceOnLogin&&(i.enforceOnLogin=!0))}),i}))}combinePoliciesIntoMasterPasswordPolicyOptions(e){var t;let i;const n=null!==(t=e.filter(e=>e.type===op.MasterPassword))&&void 0!==t?t:[];if(0!==n.length)return n.forEach(e=>{e.enabled&&e.data&&(i||(i=new ov),this.mergeMasterPasswordPolicyOptions(i,e.data))}),i}combineMasterPasswordPolicyOptions(...e){let t;return e.forEach(e=>{t||(t=new ov),this.mergeMasterPasswordPolicyOptions(t,e)}),t}evaluateMasterPassword(e,t,i){return!i||!(i.minComplexity>0&&i.minComplexity>e)&&(!(i.minLength>0&&i.minLength>t.length)&&((!i.requireUpper||t.toLocaleLowerCase()!==t)&&((!i.requireLower||t.toLocaleUpperCase()!==t)&&(!(i.requireNumbers&&!/[0-9]/.test(t))&&!(i.requireSpecial&&!/[!@#$%\^&*]/g.test(t))))))}getResetPasswordPolicyOptions(e,t){var i,n,r;const s=new cv;if(!e||!t)return[s,!1];const o=e.find(e=>e.organizationId===t&&e.type===op.ResetPassword&&e.enabled);return s.autoEnrollEnabled=null!==(n=null===(i=null==o?void 0:o.data)||void 0===i?void 0:i.autoEnrollEnabled)&&void 0!==n&&n,[s,null!==(r=null==o?void 0:o.enabled)&&void 0!==r&&r]}upsert(e,t){return dv(this,void 0,void 0,function*(){yield this.policyState(t).update(t=>(null!=t||(t={}),t[e.id]=e,t))})}replace(e,t){return dv(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(uv,e,t)})}isExemptFromPolicy(e,t,i){switch(e){case op.MaximumVaultTimeout:return t.isOwner;case op.PasswordGenerator:case op.FreeFamiliesSponsorshipPolicy:case op.RestrictedItemTypes:case op.RemoveUnlockWithPin:case op.AutoConfirm:return!1;case op.OrganizationDataOwnership:return t.isAdmin;case op.SingleOrg:return!i.find(e=>e.organizationId===t.id&&e.type===op.AutoConfirm&&e.enabled)&&t.canManagePolicies;default:return t.canManagePolicies}}mergeMasterPasswordPolicyOptions(e,t){var i,n;e||(e=new ov),t&&(e.minComplexity=Math.max(e.minComplexity,null!==(i=t.minComplexity)&&void 0!==i?i:e.minComplexity),e.minLength=Math.max(e.minLength,null!==(n=t.minLength)&&void 0!==n?n:e.minLength),e.requireUpper=Boolean(e.requireUpper||t.requireUpper),e.requireLower=Boolean(e.requireLower||t.requireLower),e.requireNumbers=Boolean(e.requireNumbers||t.requireNumbers),e.requireSpecial=Boolean(e.requireSpecial||t.requireSpecial),e.enforceOnLogin=Boolean(e.enforceOnLogin||t.enforceOnLogin))}syncPolicy(e){return dv(this,void 0,void 0,function*(){yield(0,bo._)(this.accountService.activeAccount$.pipe(iv,(0,go.n)(t=>this.upsert(e,t))))})}},deps:[u,WF,Zk]},{provide:Jb,useExisting:Zb},{provide:_H,useClass:class{constructor(e,t,i){this.policyService=e,this.apiService=t,this.accountService=i}getPolicy(e,t){return Qee(this,void 0,void 0,function*(){const i=yield this.apiService.send("GET","/organizations/"+e+"/policies/"+t,null,!0,!0);return new Wx(i)})}getPolicies(e){return Qee(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/policies",null,!0,!0);return new sk(t,Wx)})}getPoliciesByToken(e,t,i,n){return Qee(this,void 0,void 0,function*(){const r=yield this.apiService.send("GET","/organizations/"+e+"/policies/token?token="+encodeURIComponent(t)+"&email="+bd.encodeRFC3986URIComponent(i)+"&organizationUserId="+n,null,!1,!0);return lv.fromListResponse(new sk(r,Wx))})}getMasterPasswordPolicyResponseForOrgUser(e){return Qee(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/policies/master-password",null,!0,!0);return new Wx(t)})}getMasterPasswordPolicyOptsForOrgUser(e){return Qee(this,void 0,void 0,function*(){try{const t=yield this.getMasterPasswordPolicyResponseForOrgUser(e),i=lv.fromResponse(t);return i?(0,bo._)(this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.policyService.masterPasswordPolicyOptions$(e,[i])),(0,l.T)(e=>null!=e?e:null))):null}catch(e){if(e instanceof iS&&e.statusCode===Ma.NotFound)return null;throw e}})}putPolicy(e,t,i){return Qee(this,void 0,void 0,function*(){const n=yield this.apiService.send("PUT","/organizations/"+e+"/policies/"+t,i,!0,!0);yield this.handleResponse(n)})}putPolicyVNext(e,t,i){return Qee(this,void 0,void 0,function*(){const n=yield this.apiService.send("PUT",`/organizations/${e}/policies/${t}/vnext`,i,!0,!0);yield this.handleResponse(n)})}handleResponse(e){return Qee(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv)),i=new Wx(e),n=new av(i);yield this.policyService.upsert(n,t)})}},deps:[Zb,eI,Zk]},{provide:Yb,useClass:class{constructor(e,t,i,n,r){this.stateProvider=e,this.keyGenerationService=t,this.logService=i,this.cryptoFunctionService=n,this.accountService=r}userHasMasterPassword(e){return ere(this,void 0,void 0,function*(){ak(e,"userId");const t=yield(0,bo._)(this.stateProvider.getUser(e,Ene).state$);return(yield(0,bo._)(this.stateProvider.getUser(e,nre).state$))&&!t})}saltForUser$(e){return ak(e,"userId"),this.stateProvider.getUser(e,Hne).state$.pipe((0,l.T)(e=>Jv(e,Wv.PM31088_MasterPasswordServiceEmitSalt)),(0,go.n)(t=>(0,Bne.T)(()=>t,this.masterPasswordUnlockData$(e).pipe((0,l.T)(e=>{if(null==e)throw new Error("Master password unlock data not found for user.");return e.salt})),this.accountService.accounts$.pipe((0,l.T)(t=>t[e].email),(0,l.T)(e=>this.emailToSalt(e))))))}masterKey$(e){if(null==e)throw new Error("User ID is required.");return this.stateProvider.getUser(e,tre).state$}masterKeyHash$(e){if(null==e)throw new Error("User ID is required.");return this.stateProvider.getUser(e,ire).state$}forceSetPasswordReason$(e){if(null==e)throw new Error("User ID is required.");return this.stateProvider.getUser(e,rre).state$.pipe((0,l.T)(e=>null!=e?e:aS.None))}getMasterKeyEncryptedUserKey(e){return ere(this,void 0,void 0,function*(){if(null==e)throw new Error("User ID is required.");const t=yield(0,bo._)(this.stateProvider.getUser(e,nre).state$);return Pp.fromJSON(t)})}emailToSalt(e){return e.toLowerCase().trim()}setMasterKey(e,t){return ere(this,void 0,void 0,function*(){if(null==e)throw new Error("Master key is required.");if(null==t)throw new Error("User ID is required.");yield this.stateProvider.getUser(t,tre).update(t=>e)})}clearMasterKey(e){return ere(this,void 0,void 0,function*(){if(null==e)throw new Error("User ID is required.");yield this.stateProvider.getUser(e,tre).update(e=>null)})}setMasterKeyHash(e,t){return ere(this,void 0,void 0,function*(){if(null==e)throw new Error("Master key hash is required.");if(null==t)throw new Error("User ID is required.");yield this.stateProvider.getUser(t,ire).update(t=>e,{shouldUpdate:t=>t!==e})})}clearMasterKeyHash(e){return ere(this,void 0,void 0,function*(){if(null==e)throw new Error("User ID is required.");yield this.stateProvider.getUser(e,ire).update(e=>null,{shouldUpdate:e=>null!==e})})}setMasterKeyEncryptedUserKey(e,t){return ere(this,void 0,void 0,function*(){if(null==e||null==e.encryptedString)throw new Error("Encrypted Key is required.");if(null==t)throw new Error("User ID is required.");yield this.stateProvider.getUser(t,nre).update(t=>e.toJSON())})}setForceSetPasswordReason(e,t){return ere(this,void 0,void 0,function*(){if(null==e)throw new Error("Reason is required.");if(null==t)throw new Error("User ID is required.");(yield(0,bo._)(this.forceSetPasswordReason$(t)))===aS.AdminForcePasswordReset&&e!==aS.None||(yield this.stateProvider.getUser(t,rre).update(t=>e))})}decryptUserKeyWithMasterKey(e,t,i){return ere(this,void 0,void 0,function*(){if(null!=i||(i=yield this.getMasterKeyEncryptedUserKey(t)),null!=e||(e=yield(0,bo._)(this.masterKey$(t))),null==e)throw new Error("No master key found.");yield om.Ready;try{return new Dv(nm.IEs.decrypt_user_key_with_master_key(i.toSdk(),e.toEncoded()))}catch(e){return this.logService.warning("Failed to decrypt user key with master key."),null}})}makeMasterPasswordAuthenticationData(e,t,i){return ere(this,void 0,void 0,function*(){if(ak(e,"password"),ak(t,"kdf"),ak(i,"salt"),""===e)throw new Error("Master password cannot be empty.");i=i.toLowerCase().trim();const n=yield this.keyGenerationService.deriveKeyFromPassword(e,i,t),r=bd.fromBufferToB64(yield this.cryptoFunctionService.pbkdf2(n.toEncoded(),e,"sha256",1));return{salt:i,kdf:t,masterPasswordAuthenticationHash:r}})}makeMasterPasswordUnlockData(e,t,i,n){return ere(this,void 0,void 0,function*(){if(ak(e,"password"),ak(t,"kdf"),ak(i,"salt"),ak(n,"userKey"),""===e)throw new Error("Master password cannot be empty.");i=i.toLowerCase().trim(),yield om.Ready;const r=nm.IEs.encrypt_user_key_with_master_password(n.toEncoded(),e,i,t.toSdkConfig());return new gS(i,t,r)})}unwrapUserKeyFromMasterPasswordUnlockData(e,t){return ere(this,void 0,void 0,function*(){ak(e,"password"),ak(t,"masterPasswordUnlockData"),yield om.Ready;return new Dv(nm.IEs.decrypt_user_key_with_master_password(t.masterKeyWrappedUserKey,e,t.salt,t.kdf.toSdkConfig()))})}setMasterPasswordUnlockData(e,t){return ere(this,void 0,void 0,function*(){ak(e,"masterPasswordUnlockData"),ak(t,"userId"),yield this.stateProvider.getUser(t,sre).update(()=>e.toJSON())})}masterPasswordUnlockData$(e){return ak(e,"userId"),this.stateProvider.getUser(e,sre).state$}setLegacyMasterKeyFromUnlockData(e,t,i){return ere(this,void 0,void 0,function*(){ak(e,"password"),ak(t,"masterPasswordUnlockData"),ak(i,"userId");const n=yield this.keyGenerationService.deriveKeyFromPassword(e,t.salt,t.kdf),r=yield this.hashMasterKey(e,n,mp.LocalAuthorization);yield this.setMasterKey(n,i),yield this.setMasterKeyHash(r,i)})}hashMasterKey(e,t,i){return ere(this,void 0,void 0,function*(){if(null==e)throw new Error("password is required.");if(null==t)throw new Error("key is required.");const n=i===mp.LocalAuthorization?2:1,r=yield this.cryptoFunctionService.pbkdf2(t.inner().encryptionKey,e,"sha256",n);return bd.fromBufferToB64(r)})}},deps:[u,jz,Za,FI,Zk]},{provide:Wb,useExisting:Yb},{provide:SA,useClass:class{constructor(e,t,i){this.masterPasswordService=e,this.keyService=t,this.logService=i}unlockWithMasterPassword(e,t){return Nne(this,void 0,void 0,function*(){this.validateInput(e,t);const i=yield(0,bo._)(this.masterPasswordService.masterPasswordUnlockData$(t));if(null==i)throw new Error("Master password unlock data was not found for the user "+t);const n=yield this.masterPasswordService.unwrapUserKeyFromMasterPasswordUnlockData(e,i);return yield this.setLegacyState(e,i,t),n})}proofOfDecryption(e,t){return Nne(this,void 0,void 0,function*(){this.validateInput(e,t);try{const i=yield(0,bo._)(this.masterPasswordService.masterPasswordUnlockData$(t));if(null==i)return this.logService.warning(`[DefaultMasterPasswordUnlockService] No master password unlock data found for user ${t} returning false.`),!1;return null!=(yield this.masterPasswordService.unwrapUserKeyFromMasterPasswordUnlockData(e,i))}catch(e){return(0,nm.gkX)(e)&&"InvalidKey"===e.variant?this.logService.debug(`[DefaultMasterPasswordUnlockService] Error during proof of decryption for user ${t} returning false: ${e}`):this.logService.error(`[DefaultMasterPasswordUnlockService] Unexpected error during proof of decryption for user ${t} returning false: ${e}`),!1}})}validateInput(e,t){if(null==e||""===e)throw new Error("Master password is required");if(null==t)throw new Error("User ID is required")}setLegacyState(e,t,i){return Nne(this,void 0,void 0,function*(){const n=yield this.keyService.makeMasterKey(e,t.salt,t.kdf);if(!n)throw new Error("Master key could not be created to set legacy master password state.");const r=yield this.keyService.hashMasterKey(e,n,mp.LocalAuthorization);yield this.masterPasswordService.setMasterKeyHash(r,i),yield this.masterPasswordService.setMasterKey(n,i)})}},deps:[Yb,Bp,Za]},{provide:wT,useClass:class{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p){this.masterPasswordService=t,this.keyService=i,this.apiService=n,this.tokenService=r,this.logService=s,this.organizationService=o,this.keyGenerationService=a,this.logoutCallback=l,this.stateProvider=c,this.configService=u,this.registerSdkService=d,this.securityStateService=h,this.accountCryptographicStateService=p,this.convertAccountRequired$=e.activeAccount$.pipe((0,Eo.p)(e=>null!=e),(0,go.n)(e=>(0,jo.z)([(0,Go.of)(e.id),this.organizationService.organizations$(e.id).pipe((0,Eo.p)(e=>null!=e)),this.stateProvider.getUserState$(Ene,e.id).pipe((0,Eo.p)(e=>null!=e)),r.hasAccessToken$(e.id).pipe((0,Eo.p)(e=>e))])),(0,go.n)(e=>xne(this,[e],void 0,function*([e,t,i]){const n=yield this.tokenService.getIsExternal(e),r=null!=this.findManagingOrganization(t);return n&&r&&!i})))}setUsesKeyConnector(e,t){return xne(this,void 0,void 0,function*(){yield this.stateProvider.getUser(t,Ene).update(()=>e)})}getUsesKeyConnector(e){return xne(this,void 0,void 0,function*(){var t;return null!==(t=yield(0,bo._)(this.stateProvider.getUserState$(Ene,e)))&&void 0!==t&&t})}migrateUser(e,t){return xne(this,void 0,void 0,function*(){const i=yield(0,bo._)(this.masterPasswordService.masterKey$(t)),n=new Fne(bd.fromBufferToB64(i.inner().encryptionKey));try{yield this.apiService.postUserKeyToKeyConnector(e,n)}catch(e){this.handleKeyConnectorError(e)}yield this.apiService.postConvertToKeyConnector(),yield this.setUsesKeyConnector(!0,t)})}setMasterKeyFromUrl(e,t){return xne(this,void 0,void 0,function*(){try{const i=yield this.apiService.getMasterKeyFromKeyConnector(e),n=bd.fromB64ToArray(i.key),r=new Dv(n);yield this.masterPasswordService.setMasterKey(r,t)}catch(e){this.handleKeyConnectorError(e)}})}getManagingOrganization(e){return xne(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.organizationService.organizations$(e));return this.findManagingOrganization(t)})}convertNewSsoUserToKeyConnector(e){return xne(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.stateProvider.getUserState$($ne,e));if(null==t)throw new Error("Key Connector conversion not found");const{kdfConfig:i,keyConnectorUrl:n,organizationId:r}=t;(yield(0,bo._)(this.configService.getFeatureFlag$(Wv.EnableAccountEncryptionV2KeyConnectorRegistration)))?yield this.convertNewSsoUserToKeyConnectorV2(e,n,r):yield this.convertNewSsoUserToKeyConnectorV1(e,i,n,r),yield this.stateProvider.getUser(e,$ne).update(()=>null)})}convertNewSsoUserToKeyConnectorV2(e,t,i){return xne(this,void 0,void 0,function*(){const n=yield(0,bo._)(this.registerSdkService.registerClient$(e).pipe((0,l.T)(n=>{const r={stack:[],error:void 0,hasError:!1};try{if(!n)throw new Error("SDK not available");return Ane(r,n.take(),!1).value.auth().registration().post_keys_for_key_connector_registration(t,i,Yk(e))}catch(e){r.error=e,r.hasError=!0}finally{Dne(r)}})));if(!("V2"in n.account_cryptographic_state)){const e=Object.keys(n.account_cryptographic_state);throw new Error(`Unexpected account cryptographic state version ${e}`)}yield this.masterPasswordService.setMasterKey(Dv.fromString(n.key_connector_key),e),yield this.keyService.setUserKey(Dv.fromString(n.user_key),e),yield this.masterPasswordService.setMasterKeyEncryptedUserKey(new Pp(n.key_connector_key_wrapped_user_key),e),yield this.accountCryptographicStateService.setAccountCryptographicState(n.account_cryptographic_state,e)})}convertNewSsoUserToKeyConnectorV1(e,t,i,n){return xne(this,void 0,void 0,function*(){const r=yield this.keyGenerationService.createKey(512),s=yield this.keyService.makeMasterKey(r.keyB64,yield this.tokenService.getEmail(),t),o=new Fne(bd.fromBufferToB64(s.inner().encryptionKey));yield this.masterPasswordService.setMasterKey(s,e);const a=yield this.keyService.makeUserKey(s);yield this.keyService.setUserKey(a[0],e),yield this.masterPasswordService.setMasterKeyEncryptedUserKey(a[1],e);const[l,c]=yield this.keyService.makeKeyPair(a[0]);try{yield this.apiService.postUserKeyToKeyConnector(i,o)}catch(e){this.handleKeyConnectorError(e)}const u=new _k(l,c.encryptedString),d=new Rne(a[1].encryptedString,t,n,u);yield this.apiService.postSetKeyConnectorKey(d)})}setNewSsoUserKeyConnectorConversionData(e,t){return xne(this,void 0,void 0,function*(){yield this.stateProvider.getUser(t,$ne).update(()=>e)})}requiresDomainConfirmation$(e){return this.stateProvider.getUserState$($ne,e).pipe((0,l.T)(e=>null!=e?{keyConnectorUrl:e.keyConnectorUrl,organizationSsoIdentifier:e.organizationId}:null))}handleKeyConnectorError(e){throw this.logService.error(e),null!=this.logoutCallback&&this.logoutCallback("keyConnectorError"),new Error("Key Connector error")}findManagingOrganization(e){return e.find(e=>e.keyConnectorEnabled&&e.type!==sp.Admin&&e.type!==sp.Owner&&!e.isProviderUser)}},deps:[Zk,Yb,Bp,eI,iee,Za,WF,jz,MT,u,Kb,Kk,sI,oI]},{provide:NC,useClass:class{constructor(e,t,i,n,r,s,o,a,l){this.keyService=e,this.accountService=t,this.masterPasswordService=i,this.i18nService=n,this.userVerificationApiService=r,this.userDecryptionOptionsService=s,this.pinService=o,this.kdfConfigService=a,this.biometricsService=l}getAvailableVerificationOptions(e){return wie(this,void 0,void 0,function*(){var t;const i=null===(t=yield(0,bo._)(this.accountService.activeAccount$))||void 0===t?void 0:t.id;if("client"===e){const[e,t,n]=yield Promise.all([this.hasMasterPasswordAndMasterKeyHash(i),this.pinService.isPinDecryptionAvailable(i),this.biometricsService.getBiometricsStatus()]);return{client:{masterPassword:e,pin:t,biometrics:n===$p.Available},server:{masterPassword:!1,otp:!1}}}{const e=yield this.hasMasterPassword(i);return{client:{masterPassword:!1,pin:!1,biometrics:!1},server:{masterPassword:e,otp:!e}}}})}buildRequest(e,t){return wie(this,void 0,void 0,function*(){this.validateSecretInput(e);const i=null!=t?new t:new bP;if(e.type===MC.OTP)i.otp=e.secret;else{const t=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv)),n=yield this.kdfConfigService.getKdfConfig(t),r=yield(0,bo._)(this.masterPasswordService.saltForUser$(t)),s=yield this.masterPasswordService.makeMasterPasswordAuthenticationData(e.secret,n,r);i.authenticateWith(s)}return i})}verifyUser(e){return wie(this,void 0,void 0,function*(){if(null==e)throw new Error("Verification is required.");const[t,i]=yield(0,bo._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>[null==e?void 0:e.id,null==e?void 0:e.email])));switch(function(e){return"secret"in e}(e)&&this.validateSecretInput(e),e.type){case MC.OTP:return this.verifyUserByOTP(e);case MC.MasterPassword:return yield this.verifyUserByMasterPassword(e,t,i),!0;case MC.PIN:return this.verifyUserByPIN(e,t);case MC.Biometrics:return this.verifyUserByBiometrics();default:return e}})}verifyUserByOTP(e){return wie(this,void 0,void 0,function*(){const t=new bie(e.secret);try{yield this.userVerificationApiService.postAccountVerifyOTP(t)}catch(e){throw new Error(this.i18nService.t("invalidVerificationCode"))}return!0})}verifyUserByMasterPassword(e,t,i){return wie(this,void 0,void 0,function*(){if(!e.secret)throw new Error("Master Password is required. Cannot verify user without a master password.");if(!t)throw new Error("User ID is required. Cannot verify user by master password.");if(!i)throw new Error("Email is required. Cannot verify user by master password.");const n=yield this.kdfConfigService.getKdfConfig(t);if(!n)throw new Error("KDF config is required. Cannot verify user by master password.");let r,s=yield(0,bo._)(this.masterPasswordService.masterKey$(t));if(s||(s=yield this.keyService.makeMasterKey(e.secret,i,n)),!s)throw new Error("Master key could not be created to verify the master password.");if(yield this.hasMasterPasswordAndMasterKeyHash(t)){if(!(yield this.keyService.compareKeyHash(e.secret,s,t)))throw new Error(this.i18nService.t("invalidMasterPassword"));r=null}else{const t=new bP,i=yield this.keyService.hashMasterKey(e.secret,s,mp.ServerAuthorization);t.masterPasswordHash=i;try{r=yield this.userVerificationApiService.postAccountVerifyPassword(t)}catch(e){throw new Error(this.i18nService.t("invalidMasterPassword"))}}const o=yield this.keyService.hashMasterKey(e.secret,s,mp.LocalAuthorization);return yield this.masterPasswordService.setMasterKeyHash(o,t),yield this.masterPasswordService.setMasterKey(s,t),{policyOptions:r,masterKey:s,email:i}})}verifyUserByPIN(e,t){return wie(this,void 0,void 0,function*(){if(!t)throw new Error("User ID is required. Cannot verify user by PIN.");return null!=(yield this.pinService.decryptUserKeyWithPin(e.secret,t))})}verifyUserByBiometrics(){return wie(this,void 0,void 0,function*(){return this.biometricsService.authenticateWithBiometrics()})}requestOTP(){return wie(this,void 0,void 0,function*(){yield this.userVerificationApiService.postAccountRequestOTP()})}hasMasterPassword(e){return wie(this,void 0,void 0,function*(){var t;const i=null!=e?e:null===(t=yield(0,bo._)(this.accountService.activeAccount$))||void 0===t?void 0:t.id;return!!i&&(yield(0,bo._)(this.userDecryptionOptionsService.hasMasterPasswordById$(i)))})}hasMasterPasswordAndMasterKeyHash(e){return wie(this,void 0,void 0,function*(){var t;return null!=e||(e=null===(t=yield(0,bo._)(this.accountService.activeAccount$))||void 0===t?void 0:t.id),(yield this.hasMasterPassword(e))&&null!=(yield(0,bo._)(this.masterPasswordService.masterKeyHash$(e)))})}validateSecretInput(e){if(null==(null==e?void 0:e.secret)||""===e.secret)switch(e.type){case MC.OTP:throw new Error(this.i18nService.t("verificationCodeRequired"));case MC.MasterPassword:throw new Error(this.i18nService.t("masterPasswordRequired"));case MC.PIN:throw new Error(this.i18nService.t("pinRequired"))}}},deps:[Bp,Zk,Yb,Ul,cte,$w,HF,_v,Vp]},{provide:YF,useClass:class{memberOrganizations$(e){return this.organizations$(e).pipe((0,l.T)(e=>e.filter(e=>e.isMember)))}constructor(e){this.stateProvider=e}canManageSponsorships$(e){return this.organizations$(e).pipe((0,l.T)(e=>e.filter(e=>e.canManageSponsorships)),wee())}familySponsorshipAvailable$(e){return this.organizations$(e).pipe((0,l.T)(e=>e.some(e=>e.familySponsorshipAvailable)))}hasOrganizations(e){return this.organizations$(e).pipe(wee())}upsert(e,t){return bee(this,void 0,void 0,function*(){yield this.organizationState(t).update(t=>{const i=null!=t?t:{};return i[e.id]=e,i})})}replace(e,t){return bee(this,void 0,void 0,function*(){yield this.organizationState(t).update(()=>e)})}organizations$(e){return this.organizationState(e).state$.pipe(this.mapOrganizationRecordToArray())}organizationState(e){return this.stateProvider.getUser(e,yee)}mapOrganizationRecordToArray(){return(0,l.T)(e=>{var t;return null===(t=Object.values(null!=e?e:{}))||void 0===t?void 0:t.map(e=>new wU(e))})}},deps:[u]},{provide:NR,useClass:class{constructor(e,t,i,n,r){this.keyService=e,this.encryptService=t,this.organizationUserApiService=i,this.accountService=n,this.i18nService=r}orgKey$(e){return this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.keyService.orgKeys$(e)),(0,Eo.p)(e=>!!e),(0,l.T)(t=>t[e.id]))}buildConfirmRequest(e,t){const i=this.getEncryptedDefaultCollectionName$(e),n=this.orgKey$(e).pipe((0,go.n)(e=>this.encryptService.encapsulateKeyUnsigned(e,t)));return(0,jo.z)([n,i]).pipe((0,l.T)(([e,t])=>({key:e.encryptedString,defaultUserCollectionName:t.encryptedString})))}confirmUser(e,t,i){return this.buildConfirmRequest(e,i).pipe((0,go.n)(i=>this.organizationUserApiService.postOrganizationUserConfirm(e.id,t,i)))}bulkConfirmUsers(e,t){return this.getEncryptedDefaultCollectionName$(e).pipe((0,go.n)(i=>{const n=new HR(t,i.encryptedString);return this.organizationUserApiService.postOrganizationUserBulkConfirm(e.id,n)}))}buildRestoreUserRequest(e){return this.getEncryptedDefaultCollectionName$(e).pipe((0,l.T)(e=>new YR(e.encryptedString)))}restoreUser(e,t){return this.buildRestoreUserRequest(e).pipe((0,go.n)(i=>this.organizationUserApiService.restoreOrganizationUser_vNext(e.id,t,i)))}bulkRestoreUsers(e,t){return this.getEncryptedDefaultCollectionName$(e).pipe((0,go.n)(i=>{const n=new WR(t,i.encryptedString);return this.organizationUserApiService.restoreManyOrganizationUsers_vNext(e.id,n)}))}getEncryptedDefaultCollectionName$(e){return this.orgKey$(e).pipe((0,go.n)(e=>this.encryptService.encryptString(this.i18nService.t("myItems"),e)))}},deps:[Bp,$G,MR,Zk,Ul]},{provide:WF,useExisting:YF},{provide:MR,useClass:class{constructor(e){this.apiService=e}getOrganizationUser(e,t,i){return qR(this,void 0,void 0,function*(){const n=new URLSearchParams;(null==i?void 0:i.includeGroups)&&n.set("includeGroups","true");const r=yield this.apiService.send("GET",`/organizations/${e}/users/${t}?${n.toString()}`,null,!0,!0);return new LR(r)})}getAllUsers(e,t){return qR(this,void 0,void 0,function*(){const i=new URLSearchParams;(null==t?void 0:t.includeCollections)&&i.set("includeCollections","true"),(null==t?void 0:t.includeGroups)&&i.set("includeGroups","true");const n=yield this.apiService.send("GET",`/organizations/${e}/users?${i.toString()}`,null,!0,!0);return new sk(n,GR)})}getAllMiniUserDetails(e){return qR(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET",`/organizations/${e}/users/mini-details`,null,!0,!0);return new sk(t,XR)})}getOrganizationUserResetPasswordDetails(e,t){return qR(this,void 0,void 0,function*(){const i=yield this.apiService.send("GET","/organizations/"+e+"/users/"+t+"/reset-password-details",null,!0,!0);return new zR(i)})}getManyOrganizationUserAccountRecoveryDetails(e,t){return qR(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/users/account-recovery-details",new VR(t),!0,!0);return new sk(i,zR)})}postOrganizationUserInvite(e,t){return this.apiService.send("POST","/organizations/"+e+"/users/invite",t,!0,!1)}postOrganizationUserReinvite(e,t){return this.apiService.send("POST","/organizations/"+e+"/users/"+t+"/reinvite",null,!0,!1)}postManyOrganizationUserReinvite(e,t){return qR(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/users/reinvite",new VR(t),!0,!0);return new sk(i,_R)})}postOrganizationUserAcceptInit(e,t,i){return this.apiService.send("POST","/organizations/"+e+"/users/"+t+"/accept-init",i,!0,!1)}postOrganizationUserAccept(e,t,i){return this.apiService.send("POST","/organizations/"+e+"/users/"+t+"/accept",i,!0,!1)}postOrganizationUserConfirm(e,t,i){return this.apiService.send("POST","/organizations/"+e+"/users/"+t+"/confirm",i,!0,!1)}postOrganizationUserAutoConfirm(e,t,i){return this.apiService.send("POST","/organizations/"+e+"/users/"+t+"/auto-confirm",i,!0,!1)}postOrganizationUsersPublicKey(e,t){return qR(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/users/public-keys",new VR(t),!0,!0);return new sk(i,KR)})}postOrganizationUserBulkConfirm(e,t){return qR(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/users/confirm",t,!0,!0);return new sk(i,_R)})}putOrganizationUserBulkEnableSecretsManager(e,t){return qR(this,void 0,void 0,function*(){yield this.apiService.send("PUT","/organizations/"+e+"/users/enable-secrets-manager",new VR(t),!0,!1)})}putOrganizationUser(e,t,i){return this.apiService.send("PUT","/organizations/"+e+"/users/"+t,i,!0,!1)}putOrganizationUserResetPasswordEnrollment(e,t,i){return this.apiService.send("PUT","/organizations/"+e+"/users/"+t+"/reset-password-enrollment",i,!0,!1)}putOrganizationUserResetPassword(e,t,i){return this.apiService.send("PUT","/organizations/"+e+"/users/"+t+"/reset-password",i,!0,!1)}removeOrganizationUser(e,t){return this.apiService.send("DELETE","/organizations/"+e+"/users/"+t,null,!0,!1)}removeManyOrganizationUsers(e,t){return qR(this,void 0,void 0,function*(){const i=yield this.apiService.send("DELETE","/organizations/"+e+"/users",new VR(t),!0,!0);return new sk(i,_R)})}revokeOrganizationUser(e,t){return this.apiService.send("PUT","/organizations/"+e+"/users/"+t+"/revoke",null,!0,!1)}revokeManyOrganizationUsers(e,t){return qR(this,void 0,void 0,function*(){const i=yield this.apiService.send("PUT","/organizations/"+e+"/users/revoke",new VR(t),!0,!0);return new sk(i,_R)})}revokeSelf(e){return this.apiService.send("PUT","/organizations/"+e+"/users/revoke-self",null,!0,!1)}restoreOrganizationUser(e,t){return this.apiService.send("PUT","/organizations/"+e+"/users/"+t+"/restore",null,!0,!1)}restoreOrganizationUser_vNext(e,t,i){return this.apiService.send("PUT","/organizations/"+e+"/users/"+t+"/restore/vnext",i,!0,!1)}restoreManyOrganizationUsers(e,t){return qR(this,void 0,void 0,function*(){const i=yield this.apiService.send("PUT","/organizations/"+e+"/users/restore",new VR(t),!0,!0);return new sk(i,_R)})}restoreManyOrganizationUsers_vNext(e,t){return qR(this,void 0,void 0,function*(){const i=yield this.apiService.send("PUT","/organizations/"+e+"/users/restore",t,!0,!0);return new sk(i,_R)})}deleteOrganizationUser(e,t){return this.apiService.send("DELETE","/organizations/"+e+"/users/"+t+"/delete-account",null,!0,!1)}deleteManyOrganizationUsers(e,t){return qR(this,void 0,void 0,function*(){const i=yield this.apiService.send("DELETE","/organizations/"+e+"/users/delete-account",new VR(t),!0,!0);return new sk(i,_R)})}},deps:[eI]},{provide:rI,useClass:class{constructor(e,t,i,n,r,s){this.organizationApiService=e,this.accountService=t,this.keyService=i,this.encryptService=n,this.organizationUserApiService=r,this.i18nService=s}enrollIfRequired(e){return Jte(this,void 0,void 0,function*(){const t=yield this.organizationApiService.getAutoEnrollStatus(e);t.resetPasswordEnabled||(yield this.enroll(t.id,null,null))})}enroll(e,t,i){return Jte(this,void 0,void 0,function*(){const n=yield this.organizationApiService.getKeys(e);if(null==n)throw new Error(this.i18nService.t("resetPasswordOrgKeysError"));const r=bd.fromB64ToArray(n.publicKey);if(null==(t=null!=t?t:yield(0,bo._)(this.accountService.activeAccount$.pipe(iv))))throw new Error("User ID is required");i=null!=i?i:yield(0,bo._)(this.keyService.userKey$(t));const s=yield this.encryptService.encapsulateKeyUnsigned(i,r),o=new ZR;o.resetPasswordKey=s.encryptedString,yield this.organizationUserApiService.putOrganizationUserResetPasswordEnrollment(e,t,o)})}},deps:[nI,Zk,Bp,$G,MR,Ul]},{provide:mee,useClass:class{constructor(e){this.stateProvider=e}providers$(e){return this.stateProvider.getUser(e,ate).state$.pipe(this.mapProviderRecordToArray())}mapProviderRecordToArray(){return(0,l.T)(e=>Object.values(null!=e?e:{}).map(e=>new ste(e)))}get$(e,t){return this.providers$(t).pipe(rR(e))}save(e,t){return ote(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(ate,e,t)})}},deps:[u]},{provide:nP,useClass:class{constructor(e,t,i,n){this.i18nService=e,this.platformUtilsService=t,this.globalStateProvider=i,this.twoFactorApiService=n,this.providersState=this.globalStateProvider.get(tP),this.selectedState=this.globalStateProvider.get(iP),this.providers$=this.providersState.state$.pipe((0,l.T)(e=>bd.recordToMap(e))),this.selected$=this.selectedState.state$}init(){eP[oS.Email].name=this.i18nService.t("emailTitle"),eP[oS.Email].description=this.i18nService.t("emailDescV2"),eP[oS.Authenticator].name=this.i18nService.t("authenticatorAppTitle"),eP[oS.Authenticator].description=this.i18nService.t("authenticatorAppDescV2"),eP[oS.Duo].description=this.i18nService.t("duoDescV2"),eP[oS.OrganizationDuo].name="Duo ("+this.i18nService.t("organization")+")",eP[oS.OrganizationDuo].description=this.i18nService.t("duoOrganizationDesc"),eP[oS.WebAuthn].name=this.i18nService.t("webAuthnTitle"),eP[oS.WebAuthn].description=this.i18nService.t("webAuthnDesc"),eP[oS.Yubikey].name=this.i18nService.t("yubiKeyTitleV2"),eP[oS.Yubikey].description=this.i18nService.t("yubiKeyDesc")}getSupportedProviders(e){return vP(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.providers$),i=[];return null==t||(t.has(oS.OrganizationDuo)&&this.platformUtilsService.supportsDuo()&&i.push(eP[oS.OrganizationDuo]),t.has(oS.Authenticator)&&i.push(eP[oS.Authenticator]),t.has(oS.Yubikey)&&i.push(eP[oS.Yubikey]),t.has(oS.Duo)&&this.platformUtilsService.supportsDuo()&&i.push(eP[oS.Duo]),t.has(oS.WebAuthn)&&this.platformUtilsService.supportsWebAuthn(e)&&i.push(eP[oS.WebAuthn]),t.has(oS.Email)&&i.push(eP[oS.Email])),i})}getDefaultProvider(e){return vP(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.providers$),i=yield(0,bo._)(this.selected$);if(null==t)return null;if(null!=i&&t.has(i))return i;let n=null,r=-1;return t.forEach((t,i)=>{const s=eP[i];if(null!=s&&s.priority>r){if(i===oS.WebAuthn&&!e)return;n=i,r=s.priority}}),n})}setSelectedProvider(e){return vP(this,void 0,void 0,function*(){yield this.selectedState.update(()=>e)})}clearSelectedProvider(){return vP(this,void 0,void 0,function*(){yield this.selectedState.update(()=>null)})}setProviders(e){return vP(this,void 0,void 0,function*(){yield this.providersState.update(()=>e.twoFactorProviders2)})}clearProviders(){return vP(this,void 0,void 0,function*(){yield this.providersState.update(()=>null)})}getProviders(){return(0,bo._)(this.providers$)}getEnabledTwoFactorProviders(){return this.twoFactorApiService.getTwoFactorProviders()}getTwoFactorOrganizationProviders(e){return this.twoFactorApiService.getTwoFactorOrganizationProviders(e)}getTwoFactorAuthenticator(e){return this.twoFactorApiService.getTwoFactorAuthenticator(e)}getTwoFactorEmail(e){return this.twoFactorApiService.getTwoFactorEmail(e)}getTwoFactorDuo(e){return this.twoFactorApiService.getTwoFactorDuo(e)}getTwoFactorOrganizationDuo(e,t){return this.twoFactorApiService.getTwoFactorOrganizationDuo(e,t)}getTwoFactorYubiKey(e){return this.twoFactorApiService.getTwoFactorYubiKey(e)}getTwoFactorWebAuthn(e){return this.twoFactorApiService.getTwoFactorWebAuthn(e)}getTwoFactorWebAuthnChallenge(e){return this.twoFactorApiService.getTwoFactorWebAuthnChallenge(e)}getTwoFactorRecover(e){return this.twoFactorApiService.getTwoFactorRecover(e)}putTwoFactorAuthenticator(e){return this.twoFactorApiService.putTwoFactorAuthenticator(e)}deleteTwoFactorAuthenticator(e){return this.twoFactorApiService.deleteTwoFactorAuthenticator(e)}putTwoFactorEmail(e){return this.twoFactorApiService.putTwoFactorEmail(e)}putTwoFactorDuo(e){return this.twoFactorApiService.putTwoFactorDuo(e)}putTwoFactorOrganizationDuo(e,t){return this.twoFactorApiService.putTwoFactorOrganizationDuo(e,t)}putTwoFactorYubiKey(e){return this.twoFactorApiService.putTwoFactorYubiKey(e)}putTwoFactorWebAuthn(e){return this.twoFactorApiService.putTwoFactorWebAuthn(e)}deleteTwoFactorWebAuthn(e){return this.twoFactorApiService.deleteTwoFactorWebAuthn(e)}putTwoFactorDisable(e){return this.twoFactorApiService.putTwoFactorDisable(e)}putTwoFactorOrganizationDisable(e,t){return this.twoFactorApiService.putTwoFactorOrganizationDisable(e,t)}postTwoFactorEmailSetup(e){return this.twoFactorApiService.postTwoFactorEmailSetup(e)}postTwoFactorEmail(e){return this.twoFactorApiService.postTwoFactorEmail(e)}},deps:[Ul,Hb,d,QT]},{provide:class{},useClass:class{getFormValidationErrors(e){let t=[];return Object.keys(e).forEach(i=>{const n=e[i];n instanceof Il.J3&&(t=t.concat(this.getFormValidationErrors(n.controls)));const r=e[i].errors;null!==r&&Object.keys(r).forEach(e=>{t.push({controlName:i,errorName:e})})}),t}},deps:[]},{provide:cte,useClass:class{constructor(e){this.apiService=e}postAccountVerifyOTP(e){return this.apiService.send("POST","/accounts/verify-otp",e,!0,!1)}postAccountRequestOTP(){return yie(this,void 0,void 0,function*(){return this.apiService.send("POST","/accounts/request-otp",null,!0,!1)})}postAccountVerifyPassword(e){return this.apiService.send("POST","/accounts/verify-password",e,!0,!0)}},deps:[eI]},{provide:nI,useClass:class{constructor(e,t){this.apiService=e,this.syncService=t}get(e){return Kee(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e,null,!0,!0);return new $ee(t)})}getBilling(e){return Kee(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/billing",null,!0,!0);return new Tee(t)})}getBillingHistory(e){return Kee(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/billing/history",null,!0,!0);return new xee(t)})}getSubscription(e){return Kee(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/subscription",null,!0,!0);return new Vee(t)})}getLicense(e,t){return Kee(this,void 0,void 0,function*(){return this.apiService.send("GET","/organizations/"+e+"/license?installationId="+t,null,!0,!0)})}getAutoEnrollStatus(e){return Kee(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/auto-enroll-status",null,!0,!0);return new Lee(t)})}create(e){return Kee(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/organizations",e,!0,!0);return yield this.syncService.fullSync(!0),new $ee(t)})}createWithoutPayment(e){return Kee(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/organizations/create-without-payment",e,!0,!0);return yield this.syncService.fullSync(!0),new $ee(t)})}createLicense(e){return Kee(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/organizations/licenses/self-hosted",e,!0,!0);return new $ee(t)})}save(e,t){return Kee(this,void 0,void 0,function*(){const i=yield this.apiService.send("PUT","/organizations/"+e,t,!0,!0),n=new $ee(i);return yield this.syncService.fullSync(!0),n})}upgrade(e,t){return Kee(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/upgrade",t,!0,!0);return new jee(i)})}updatePasswordManagerSeats(e,t){return Kee(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/subscription",t,!0,!0);return new Zx(i)})}updateSecretsManagerSubscription(e,t){return Kee(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/sm-subscription",t,!0,!0);return new Zx(i)})}updateSeats(e,t){return Kee(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/seat",t,!0,!0);return new jee(i)})}updateStorage(e,t){return Kee(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/storage",t,!0,!0);return new jee(i)})}reinstate(e){return Kee(this,void 0,void 0,function*(){return this.apiService.send("POST","/organizations/"+e+"/reinstate",null,!0,!1)})}leave(e){return Kee(this,void 0,void 0,function*(){yield this.apiService.send("POST","/organizations/"+e+"/leave",null,!0,!1),yield this.syncService.fullSync(!0)})}delete(e,t){return Kee(this,void 0,void 0,function*(){yield this.apiService.send("DELETE","/organizations/"+e,t,!0,!1),yield this.syncService.fullSync(!0)})}deleteUsingToken(e,t){return this.apiService.send("POST","/organizations/"+e+"/delete-recover-token",t,!1,!1)}updateLicense(e,t){return Kee(this,void 0,void 0,function*(){yield this.apiService.send("POST","/organizations/licenses/self-hosted/"+e,t,!0,!1)})}importDirectory(e,t){return Kee(this,void 0,void 0,function*(){return this.apiService.send("POST","/organizations/"+e+"/import",t,!0,!1)})}getOrCreateApiKey(e,t){return Kee(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/api-key",t,!0,!0);return new See(i)})}getApiKeyInformation(e){return Kee(this,arguments,void 0,function*(e,t=null){const i=null===t?"/organizations/"+e+"/api-key-information":"/organizations/"+e+"/api-key-information/"+t,n=yield this.apiService.send("GET",i,null,!0,!0);return new sk(n,Gee)})}rotateApiKey(e,t){return Kee(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/rotate-api-key",t,!0,!0);return new See(i)})}getKeys(e){return Kee(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/keys",null,!0,!0);return new _ee(t)})}updateKeys(e,t){return Kee(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/keys",t,!0,!0);return new _ee(i)})}getSso(e){return Kee(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/sso",null,!0,!0);return new Iee(t)})}updateSso(e,t){return Kee(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/sso",t,!0,!0);return new Iee(i)})}selfHostedSyncLicense(e){return Kee(this,void 0,void 0,function*(){yield this.apiService.send("POST","/organizations/licenses/self-hosted/"+e+"/sync/",null,!0,!1)})}subscribeToSecretsManager(e,t){return Kee(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/subscribe-secrets-manager",t,!0,!0);return new Zx(i)})}updateCollectionManagement(e,t){return Kee(this,void 0,void 0,function*(){const i=yield this.apiService.send("PUT","/organizations/"+e+"/collection-management",t,!0,!0),n=new $ee(i);return yield this.syncService.fullSync(!0),n})}},deps:[eI,qx]},{provide:class{},useClass:class{constructor(e,t){this.apiService=e,this.platformUtilsService=t}getOrganizationSponsorship(e){return Kie(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organization/sponsorship/"+(this.platformUtilsService.isSelfHost()?"self-hosted/":"")+e+"/sponsored",null,!0,!0);return new sk(t,_ie)})}postResendSponsorshipOffer(e,t){return Kie(this,void 0,void 0,function*(){let i="/organization/sponsorship/"+e+"/families-for-enterprise/resend";return t&&(i+=`?sponsoredFriendlyName=${encodeURIComponent(t)}`),yield this.apiService.send("POST",i,null,!0,!1)})}deleteRevokeSponsorship(e){return Kie(this,arguments,void 0,function*(e,t=!1){const i=this.platformUtilsService.isSelfHost()?"self-hosted/":"";return yield this.apiService.send("DELETE","/organization/sponsorship/"+i+e,null,!0,!1)})}deleteAdminInitiatedRevokeSponsorship(e,t){return Kie(this,void 0,void 0,function*(){const i=this.platformUtilsService.isSelfHost()?"self-hosted/":"";return yield this.apiService.send("DELETE","/organization/sponsorship/"+i+e+"/"+encodeURIComponent(t)+"/revoke",null,!0,!1)})}},deps:[eI,Hb]},{provide:class{},useClass:class{constructor(e){this.apiService=e}getBillingInvoices(e,t,i){return Lie(this,void 0,void 0,function*(){const n=new URLSearchParams;t&&n.append("status",t),i&&n.append("startAfter",i);const r=`?${n.toString()}`,s=yield this.apiService.send("GET",`/organizations/${e}/billing/invoices${r}`,null,!0,!0);return(null==s?void 0:s.map(e=>new Fee(e)))||[]})}getBillingTransactions(e,t){return Lie(this,void 0,void 0,function*(){const i=t?`?startAfter=${t}`:"",n=yield this.apiService.send("GET",`/organizations/${e}/billing/transactions${i}`,null,!0,!0);return(null==n?void 0:n.map(e=>new Ree(e)))||[]})}setupBusinessUnit(e,t){return Lie(this,void 0,void 0,function*(){return yield this.apiService.send("POST",`/organizations/${e}/billing/setup-business-unit`,t,!0,!0)})}changeSubscriptionFrequency(e,t){return Lie(this,void 0,void 0,function*(){return yield this.apiService.send("POST","/organizations/"+e+"/billing/change-frequency",t,!0,!1)})}},deps:[eI]},{provide:class{},useClass:class{constructor(e){this.apiService=e}getBillingInvoices(e,t){return Rie(this,void 0,void 0,function*(){const i=new URLSearchParams;e&&i.append("status",e),t&&i.append("startAfter",t);const n=`?${i.toString()}`,r=yield this.apiService.send("GET",`/accounts/billing/invoices${n}`,null,!0,!0);return(null==r?void 0:r.map(e=>new Fee(e)))||[]})}getBillingTransactions(e){return Rie(this,void 0,void 0,function*(){const t=e?`?startAfter=${e}`:"",i=yield this.apiService.send("GET",`/accounts/billing/transactions${t}`,null,!0,!0);return(null==i?void 0:i.map(e=>new Ree(e)))||[]})}},deps:[eI]},{provide:Qne,useClass:Qne,deps:[bre,mk,Za,u,Rd]},{provide:Kb,useExisting:Qne},{provide:bre,useClass:class{constructor(e){this.apiService=e}get(e){return Kre(this,void 0,void 0,function*(){let t;return t=null==e?yield this.apiService.send("GET","/config",null,!1,!0):yield this.apiService.send("GET","/config",null,e,!0),new Gre(t)})}},deps:[eI]},{provide:PI,useClass:class{constructor(e,t,i){this.environmentService=e,this.authRequestService=t,this.platformUtilsService=i}createHubConnection(e){return Ote(this,void 0,void 0,function*(){if(this.url=(yield(0,bo._)(this.environmentService.environment$)).getNotificationsUrl(),!this.url.startsWith("https://")&&!this.platformUtilsService.isDev())throw new $te;this.anonHubConnection=(new gte.$).withUrl(this.url+"/anonymous-hub?Token="+e,{skipNegotiation:!0,transport:yte.w.WebSockets}).withHubProtocol(new bte.E).build(),yield this.anonHubConnection.start(),this.anonHubConnection.on("AuthRequestResponseRecieved",e=>{this.ProcessNotification(new wte(e))})})}stopHubConnection(){return Ote(this,void 0,void 0,function*(){this.anonHubConnection&&(yield this.anonHubConnection.stop())})}ProcessNotification(e){if(e.type===Ba.AuthRequestResponse)this.authRequestService.sendAuthRequestPushNotification(e.payload)}},deps:[mk,Uw,Hb]},{provide:Ud,useClass:class{constructor(e,t){this.i18nService=e,this.platformUtilsService=t}showError(e){const t=this.i18nService.t("unexpectedError");let i=[];return null!=e&&"string"==typeof e?i.push(e):null==e||"object"!=typeof e?i.push(t):null!=e.validationErrors?i=i.concat(e.getAllMessages()):i.push(e.message?e.message:t),1===i.length?this.platformUtilsService.showToast("error",this.i18nService.t("errorOccurred"),i[0]):i.length>1&&this.platformUtilsService.showToast("error",this.i18nService.t("errorOccurred"),i,{timeout:5e3*i.length}),i}},deps:[Ul,Hb]},{provide:Dw,useClass:Qw,deps:[Zk,Rd,u]},{provide:vee,useClass:class{constructor(e,t){this.platformUtilsService=e,this.i18nService=t,this._orgDomains$=new Dd.t([]),this.orgDomains$=this._orgDomains$.asObservable()}get(e){return this._orgDomains$.getValue().find(t=>t.id===e)}copyDnsTxt(e){this.platformUtilsService.copyToClipboard(e)}upsert(e){const t=this._orgDomains$.getValue();e.forEach(e=>{const i=t.findIndex(t=>t.id===e.id);-1!==i?t[i]=e:t.push(e)}),this._orgDomains$.next(t)}replace(e){this._orgDomains$.next(e)}clearCache(){this._orgDomains$.next([])}delete(e){const t=this._orgDomains$.getValue();e.forEach(e=>{const i=t.findIndex(t=>t.id===e);-1!==i&&t.splice(i,1)}),this._orgDomains$.next(t)}},deps:[Hb,Ul]},{provide:pee,useExisting:vee},{provide:yT,useClass:class{constructor(e,t){this.orgDomainService=e,this.apiService=t}getAllByOrgId(e){return Hee(this,void 0,void 0,function*(){const t=(yield this.apiService.send("GET",`/organizations/${e}/domain`,null,!0,!0)).data.map(e=>new qee(e));return this.orgDomainService.replace(t),t})}getByOrgIdAndOrgDomainId(e,t){return Hee(this,void 0,void 0,function*(){const i=yield this.apiService.send("GET",`/organizations/${e}/domain/${t}`,null,!0,!0),n=new qee(i);return this.orgDomainService.upsert([n]),n})}post(e,t){return Hee(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST",`/organizations/${e}/domain`,t,!0,!0),n=new qee(i);return this.orgDomainService.upsert([n]),n})}verify(e,t){return Hee(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST",`/organizations/${e}/domain/${t}/verify`,null,!0,!0),n=new qee(i);return this.orgDomainService.upsert([n]),n})}delete(e,t){return Hee(this,void 0,void 0,function*(){yield this.apiService.send("DELETE",`/organizations/${e}/domain/${t}`,null,!0,!1),this.orgDomainService.delete([t])})}getClaimedOrgDomainByEmail(e){return Hee(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/organizations/domain/sso/details",new Yee(e),!1,!0);return new Xee(t)})}getVerifiedOrgDomainsByEmail(e){return Hee(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/organizations/domain/sso/verified",new Yee(e),!1,!0);return new sk(t,Wee)})}},deps:[vee,eI]},{provide:Fk,useClass:class{constructor(e){this.apiService=e}getKnownDevice(e,t){return Wte(this,void 0,void 0,function*(){return yield this.apiService.send("GET","/devices/knowndevice",null,!1,!0,null,i=>{i.set("X-Device-Identifier",t),i.set("X-Request-Email",bd.fromUtf8ToUrlB64(e))})})}getDeviceByIdentifier(e){return Wte(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET",`/devices/identifier/${e}`,null,!0,!0);return new zte(t)})}getDevices(){return Wte(this,void 0,void 0,function*(){const e=yield this.apiService.send("GET","/devices",null,!0,!0,null);return new sk(e,zte)})}updateTrustedDeviceKeys(e,t,i,n){return Wte(this,void 0,void 0,function*(){const r=new qte(t,i,n),s=yield this.apiService.send("PUT",`/devices/${e}/keys`,r,!0,!0);return new zte(s)})}updateTrust(e,t){return Wte(this,void 0,void 0,function*(){yield this.apiService.send("POST","/devices/update-trust",e,!0,!1,null,e=>{e.set("Device-Identifier",t)})})}getDeviceKeys(e){return Wte(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST",`/devices/${e}/retrieve-keys`,null,!0,!0);return new Xte(t)})}postDeviceTrustLoss(e){return Wte(this,void 0,void 0,function*(){yield this.apiService.send("POST","/devices/lost-trust",null,!0,!1,null,t=>{t.set("Device-Identifier",e)})})}deactivateDevice(e){return Wte(this,void 0,void 0,function*(){yield this.apiService.send("POST",`/devices/${e}/deactivate`,null,!0,!1)})}untrustDevices(e){return Wte(this,void 0,void 0,function*(){yield this.apiService.send("POST","/devices/untrust",new _te(e),!0,!1)})}},deps:[eI]},{provide:rZ,useClass:class{constructor(e,t,i){this.appIdService=e,this.devicesApiService=t,this.i18nService=i}getDevices$(){return(0,$o.v)(()=>this.devicesApiService.getDevices()).pipe((0,l.T)(e=>e.data.map(e=>new Gte(e))))}getDeviceByIdentifier$(e){return(0,$o.v)(()=>this.devicesApiService.getDeviceByIdentifier(e)).pipe((0,l.T)(e=>new Gte(e)))}isDeviceKnownForUser$(e,t){return(0,$o.v)(()=>this.devicesApiService.getKnownDevice(e,t))}updateTrustedDeviceKeys$(e,t,i,n){return(0,$o.v)(()=>this.devicesApiService.updateTrustedDeviceKeys(e,t,i,n)).pipe((0,l.T)(e=>new Gte(e)))}deactivateDevice$(e){return(0,$o.v)(()=>this.devicesApiService.deactivateDevice(e))}getCurrentDevice$(){return(0,$o.v)(()=>Lte(this,void 0,void 0,function*(){const e=yield this.appIdService.getAppId();return this.devicesApiService.getDeviceByIdentifier(e)}))}getReadableDeviceTypeName(e){if(void 0===e)return this.i18nService.t("unknownDevice");const t=$a[e];if(!t)return this.i18nService.t("unknownDevice");const i="Unknown"===t.platform?this.i18nService.t("unknown"):t.platform,n=this.i18nService.t(t.category);return i?`${n} - ${i}`:n}},deps:[Tk,Fk,Ul]},{provide:Aw,useClass:class{constructor(e,t){this.apiService=e,this.logService=t}getPendingAuthRequests(){return ok(this,void 0,void 0,function*(){const e=yield this.apiService.send("GET","/auth-requests/pending",null,!0,!0);return new sk(e,ik)})}getAuthRequest(e){return ok(this,void 0,void 0,function*(){try{const t=`/auth-requests/${e}`,i=yield this.apiService.send("GET",t,null,!0,!0);return new ik(i)}catch(e){throw this.logService.error(e),e}})}getAuthResponse(e,t){return ok(this,void 0,void 0,function*(){try{const i=`/auth-requests/${e}/response?code=${t}`,n=yield this.apiService.send("GET",i,null,!1,!0);return new ik(n)}catch(e){throw this.logService.error(e),e}})}postAdminAuthRequest(e){return ok(this,void 0,void 0,function*(){try{const t=yield this.apiService.send("POST","/auth-requests/admin-request",e,!0,!0);return new ik(t)}catch(e){throw this.logService.error(e),e}})}postAuthRequest(e){return ok(this,void 0,void 0,function*(){try{const t=yield this.apiService.send("POST","/auth-requests/",e,!1,!0,null,t=>{t.set("Device-Identifier",e.deviceIdentifier)});return new ik(t)}catch(e){throw this.logService.error(e),e}})}},deps:[eI,Za]},{provide:tI,useClass:class{constructor(e,t,i,n,r,s,o,a,c,u,d,h,p,v){this.keyGenerationService=e,this.cryptoFunctionService=t,this.keyService=i,this.encryptService=n,this.appIdService=r,this.devicesApiService=s,this.i18nService=o,this.platformUtilsService=a,this.stateProvider=c,this.secureStorageService=u,this.userDecryptionOptionsService=d,this.logService=h,this.configService=p,this.accountService=v,this.platformSupportsSecureStorage=this.platformUtilsService.supportsSecureStorage(),this.deviceKeySecureStorageKey="_deviceKey",this.deviceTrustedSubject=new Co.B,this.deviceTrusted$=this.deviceTrustedSubject.asObservable(),this.supportsDeviceTrust$=this.accountService.activeAccount$.pipe((0,go.n)(e=>null==e?[!1]:this.userDecryptionOptionsService.userDecryptionOptionsById$(e.id).pipe((0,l.T)(e=>null!=(null==e?void 0:e.trustedDeviceOption)))))}supportsDeviceTrustByUserId$(e){return this.userDecryptionOptionsService.userDecryptionOptionsById$(e).pipe((0,l.T)(e=>null!=(null==e?void 0:e.trustedDeviceOption)))}getShouldTrustDevice(e){return dne(this,void 0,void 0,function*(){if(!e)throw new Error("UserId is required. Cannot get should trust device.");return yield(0,bo._)(this.stateProvider.getUserState$(pne,e))})}setShouldTrustDevice(e,t){return dne(this,void 0,void 0,function*(){if(!e)throw new Error("UserId is required. Cannot set should trust device.");yield this.stateProvider.setUserState(pne,t,e)})}trustDeviceIfRequired(e){return dne(this,void 0,void 0,function*(){if(!e)throw new Error("UserId is required. Cannot trust device if required.");(yield this.getShouldTrustDevice(e))&&(yield this.trustDevice(e),yield this.setShouldTrustDevice(e,null))})}trustDevice(e){return dne(this,void 0,void 0,function*(){if(!e)throw new Error("UserId is required. Cannot trust device.");const t=yield(0,bo._)(this.keyService.userKey$(e));if(!t)throw new Error("User symmetric key not found");const i=yield this.makeDeviceKey(),[n,r]=yield this.cryptoFunctionService.rsaGenerateKeyPair(2048),[s,o,a]=yield Promise.all([this.encryptService.encapsulateKeyUnsigned(t,n),this.encryptService.wrapEncapsulationKey(n,t),this.encryptService.wrapDecapsulationKey(r,i)]),l=yield this.appIdService.getAppId(),c=yield this.devicesApiService.updateTrustedDeviceKeys(l,s.encryptedString,o.encryptedString,a.encryptedString);return yield this.setDeviceKey(e,i),this.deviceTrustedSubject.next(),c})}getRotatedData(e,t,i){return dne(this,void 0,void 0,function*(){if(!i)throw new Error("UserId is required. Cannot get rotated data.");if(!e)throw new Error("Old user key is required. Cannot get rotated data.");if(!t)throw new Error("New user key is required. Cannot get rotated data.");const n=yield this.devicesApiService.getDevices(),r=[],s=yield Promise.all(n.data.filter(e=>e.isTrusted).map(i=>dne(this,void 0,void 0,function*(){const n=yield this.encryptService.unwrapEncapsulationKey(new Pp(i.encryptedPublicKey),e);if(!n)return r.push(i.id),null;const s=yield this.encryptService.wrapEncapsulationKey(n,t),o=yield this.encryptService.encapsulateKeyUnsigned(t,n),a=new Kte(o,s),l=new une;return l.encryptedPublicKey=a.encryptedPublicKey.encryptedString,l.encryptedUserKey=a.encapsulatedDownstreamKey.encryptedString,l.deviceId=i.id,l})).filter(e=>null!=e));return s.length>0&&(this.logService.info("[Device trust rotation] Distrusting devices that failed to decrypt."),yield this.devicesApiService.untrustDevices(r)),s})}rotateDevicesTrust(e,t,i){return dne(this,void 0,void 0,function*(){if(this.logService.info("[Device trust rotation] Rotating device trust..."),!e)throw new Error("UserId is required. Cannot rotate device's trust.");if(null==(yield this.getDeviceKey(e)))return void this.logService.info("[Device trust rotation] No device key available to rotate trust!");const n=yield(0,bo._)(this.keyService.userKey$(e));n==t&&this.logService.info("[Device trust rotation] Old user key is the same as the new user key.");const r=yield this.appIdService.getAppId();(new bP).masterPasswordHash=i;const s=yield this.devicesApiService.getDeviceKeys(r),o=yield this.encryptService.unwrapEncapsulationKey(s.encryptedPublicKey,n),a=yield this.encryptService.encapsulateKeyUnsigned(t,o),l=yield this.encryptService.wrapEncapsulationKey(o,t),c=new cne;c.encryptedUserKey=a.encryptedString,c.encryptedPublicKey=l.encryptedString;const u=new lne;u.masterPasswordHash=i,u.currentDevice=c,u.otherDevices=[],this.logService.info("[Device trust rotation] Posting device trust update with current device:",r),yield this.devicesApiService.updateTrust(u,r),this.logService.info("[Device trust rotation] Device trust update posted successfully.")})}getDeviceKey(e){return dne(this,void 0,void 0,function*(){if(!e)throw new Error("UserId is required. Cannot get device key.");try{if(this.platformSupportsSecureStorage){const t=yield this.secureStorageService.get(`${e}${this.deviceKeySecureStorageKey}`,this.getSecureStorageOptions(e));return Dv.fromJSON(t)}return yield(0,bo._)(this.stateProvider.getUserState$(hne,e))}catch(e){this.logService.error("Failed to get device key",e)}})}setDeviceKey(e,t){return dne(this,void 0,void 0,function*(){if(!e)throw new Error("UserId is required. Cannot set device key.");try{if(this.platformSupportsSecureStorage)return void(yield this.secureStorageService.save(`${e}${this.deviceKeySecureStorageKey}`,t,this.getSecureStorageOptions(e)));yield this.stateProvider.setUserState(hne,null==t?void 0:t.toJSON(),e)}catch(e){this.logService.error("Failed to set device key",e)}})}makeDeviceKey(){return dne(this,void 0,void 0,function*(){return yield this.keyGenerationService.createKey(512)})}decryptUserKeyWithDeviceKey(e,t,i,n){return dne(this,void 0,void 0,function*(){if(!e)throw new Error("UserId is required. Cannot decrypt user key with device key.");if(!t)throw new Error("Encrypted device private key is required. Cannot decrypt user key with device key.");if(!i)throw new Error("Encrypted user key is required. Cannot decrypt user key with device key.");if(!n)return null;try{const e=yield this.encryptService.unwrapDecapsulationKey(t,n);return yield this.encryptService.decapsulateKeyUnsigned(new Pp(i.encryptedString),e)}catch(t){return this.logService.error("Failed to decrypt using device key. Removing device key."),yield this.setDeviceKey(e,null),null}})}recordDeviceTrustLoss(){return dne(this,void 0,void 0,function*(){const e=yield this.appIdService.getAppId();yield this.devicesApiService.postDeviceTrustLoss(e)})}getSecureStorageOptions(e){return{storageLocation:bp.Disk,useSecureStorage:!0,userId:e}}},deps:[jz,FI,Bp,$G,Tk,Fk,Ul,Hb,u,UT,$w,Za,Kb,Zk]},{provide:yne,useClass:class{constructor(e){this.apiService=e}updateUserKdfParams(e){return gne(this,void 0,void 0,function*(){return this.apiService.send("POST","/accounts/kdf",e,!0,!1)})}},deps:[eI]},{provide:Cne,useClass:Ine,deps:[yne,Jk,Bp,Yb]},{provide:Uw,useClass:class{constructor(e,t,i,n,r,s,o,a){this.appIdService=e,this.masterPasswordService=t,this.keyService=i,this.encryptService=n,this.apiService=r,this.stateProvider=s,this.authRequestApiService=o,this.accountService=a,this.authRequestPushNotificationSubject=new Co.B,this.adminLoginApprovedSubject=new Co.B,this.authRequestPushNotification$=this.authRequestPushNotificationSubject.asObservable(),this.adminLoginApproved$=this.adminLoginApprovedSubject.asObservable()}getAdminAuthRequest(e){return nk(this,void 0,void 0,function*(){if(null==e)throw new Error("User ID is required");const t=yield(0,bo._)(this.stateProvider.getUser(e,rk).state$);return ek.fromJSON(t)})}setAdminAuthRequest(e,t){return nk(this,void 0,void 0,function*(){if(null==t)throw new Error("User ID is required");if(null==e)throw new Error("Auth request is required");yield this.stateProvider.setUserState(rk,e.toJSON(),t)})}clearAdminAuthRequest(e){return nk(this,void 0,void 0,function*(){if(null==e)throw new Error("User ID is required");yield this.stateProvider.setUserState(rk,null,e)})}getPendingAuthRequests$(){return(0,$o.v)(()=>this.authRequestApiService.getPendingAuthRequests()).pipe((0,l.T)(e=>e.data.map(e=>new ik(e))))}getLatestPendingAuthRequest$(){return this.getPendingAuthRequests$().pipe((0,l.T)(e=>0===e.length?null:e.sort((e,t)=>{const i=new Date(e.creationDate).getTime();return new Date(t.creationDate).getTime()-i})[0]))}approveOrDenyAuthRequest(e,t){return nk(this,void 0,void 0,function*(){const i=yield(0,bo._)(this.accountService.activeAccount$.pipe(iv));if(!t.id)throw new Error("Auth request has no id");if(!t.publicKey)throw new Error("Auth request has no public key");if(null==i)throw new Error("User ID is required");const n=bd.fromB64ToArray(t.publicKey),r=yield(0,bo._)(this.keyService.userKey$(i)),s=yield this.encryptService.encapsulateKeyUnsigned(r,n),o=new tk(s.encryptedString,void 0,yield this.appIdService.getAppId(),e);return yield this.apiService.putAuthRequest(t.id,o)})}setUserKeyAfterDecryptingSharedUserKey(e,t,i){return nk(this,void 0,void 0,function*(){const n=yield this.decryptPubKeyEncryptedUserKey(e.key,t);yield this.keyService.setUserKey(n,i)})}decryptPubKeyEncryptedUserKey(e,t){return nk(this,void 0,void 0,function*(){return yield this.encryptService.decapsulateKeyUnsigned(new Pp(e),t)})}sendAuthRequestPushNotification(e){null!=e.id&&this.authRequestPushNotificationSubject.next(e.id)}getFingerprintPhrase(e,t){return nk(this,void 0,void 0,function*(){return(yield this.keyService.getFingerprint(e.toLowerCase(),t)).join("-")})}emitAdminLoginApproved(){this.adminLoginApprovedSubject.next()}},deps:[Tk,Yb,Bp,$G,eI,u,Aw,Zk]},{provide:ore,useClass:class{constructor(e){this.stateProvider=e}userKeyEncryptedPin$(e){return ak(e,"userId"),this.stateProvider.getUserState$(cre,e).pipe((0,l.T)(e=>e?new Pp(e):null))}pinSet$(e){return ak(e,"userId"),this.pinLockType$(e).pipe((0,l.T)(e=>"DISABLED"!==e))}pinLockType$(e){return ak(e,"userId"),(0,jo.z)([this.pinProtectedUserKeyEnvelope$(e,"PERSISTENT").pipe((0,l.T)(e=>null!=e)),this.stateProvider.getUserState$(cre,e).pipe((0,l.T)(e=>null!=e))]).pipe((0,l.T)(([e,t])=>e?"PERSISTENT":t?"EPHEMERAL":"DISABLED"))}getPinLockType(e){return ure(this,void 0,void 0,function*(){return ak(e,"userId"),yield(0,bo._)(this.pinLockType$(e))})}getPinProtectedUserKeyEnvelope(e,t){return ure(this,void 0,void 0,function*(){return ak(e,"userId"),yield(0,bo._)(this.pinProtectedUserKeyEnvelope$(e,t))})}setPinState(e,t,i,n){return ure(this,void 0,void 0,function*(){if(ak(e,"userId"),ak(t,"pinProtectedUserKeyEnvelope"),ak(n,"pinLockType"),"EPHEMERAL"===n)yield this.stateProvider.setUserState(lre,t,e);else{if("PERSISTENT"!==n)throw new Error(`Cannot set up PIN with pin lock type ${n}`);yield this.stateProvider.setUserState(are,t,e)}yield this.stateProvider.setUserState(cre,i,e)})}clearPinState(e){return ure(this,void 0,void 0,function*(){ak(e,"userId"),yield this.stateProvider.setUserState(cre,null,e),yield this.stateProvider.setUserState(lre,null,e),yield this.stateProvider.setUserState(are,null,e)})}clearEphemeralPinState(e){return ure(this,void 0,void 0,function*(){ak(e,"userId"),yield this.stateProvider.setUserState(lre,null,e)})}pinProtectedUserKeyEnvelope$(e,t){if(ak(e,"userId"),"EPHEMERAL"===t)return this.stateProvider.getUserState$(lre,e);if("PERSISTENT"===t)return this.stateProvider.getUserState$(are,e);throw new Error(`Unsupported PinLockType: ${t}`)}},deps:[u]},{provide:HF,useClass:class{constructor(e,t,i,n,r){this.encryptService=e,this.logService=t,this.keyService=i,this.sdkService=n,this.pinStateService=r}getPinLockType(e){return ak(e,"userId"),this.pinStateService.getPinLockType(e)}isPinSet(e){return pre(this,void 0,void 0,function*(){return ak(e,"userId"),"DISABLED"!==(yield this.pinStateService.getPinLockType(e))})}logout(e){return pre(this,void 0,void 0,function*(){ak(e,"userId"),yield this.pinStateService.clearPinState(e)})}userUnlocked(e){return pre(this,void 0,void 0,function*(){if("EPHEMERAL"===(yield this.pinStateService.getPinLockType(e))&&!(yield this.isPinDecryptionAvailable(e))){this.logService.info("[Pin Service] On first unlock: Setting up ephemeral PIN");const t=yield this.getPin(e);yield this.setPin(t,"EPHEMERAL",e)}})}getPin(e){return pre(this,void 0,void 0,function*(){ak(e,"userId");const t=yield hre(this.keyService.userKey$(e),"userKey"),i=yield hre(this.pinStateService.userKeyEncryptedPin$(e),"userKeyEncryptedPin");return this.encryptService.decryptString(i,t)})}setPin(e,t,i){return pre(this,void 0,void 0,function*(){ak(e,"pin"),ak(t,"pinLockType"),ak(i,"userId");const{pinProtectedUserKeyEnvelope:n,userKeyEncryptedPin:r}=yield(0,bo._)(this.sdkService.userClient$(i).pipe((0,l.T)(t=>{const i={stack:[],error:void 0,hasError:!1};try{return vre(i,t.take(),!1).value.crypto().enroll_pin(e)}catch(e){i.error=e,i.hasError=!0}finally{fre(i)}})));yield this.pinStateService.setPinState(i,n,r,t)})}unsetPin(e){return pre(this,void 0,void 0,function*(){ak(e,"userId"),yield this.pinStateService.clearPinState(e)})}isPinDecryptionAvailable(e){return pre(this,void 0,void 0,function*(){ak(e,"userId");const t=yield this.pinStateService.getPinLockType(e);switch(t){case"DISABLED":return!1;case"PERSISTENT":return!0;case"EPHEMERAL":return null!=(yield this.pinStateService.getPinProtectedUserKeyEnvelope(e,"EPHEMERAL"));default:throw new Error(`Unexpected pinLockType: ${t}`)}})}decryptUserKeyWithPin(e,t){return pre(this,void 0,void 0,function*(){ak(e,"pin"),ak(t,"userId"),this.logService.info("[Pin Service] Pin-unlock via PinProtectedUserKeyEnvelope");const i=yield this.pinStateService.getPinLockType(t),n=yield this.pinStateService.getPinProtectedUserKeyEnvelope(t,i);try{const t=performance.now(),i=yield(0,bo._)(this.sdkService.client$.pipe((0,l.T)(t=>{if(!t)throw new Error("SDK not available");return t.crypto().unseal_password_protected_key_envelope(e,n)})));return this.logService.measure(t,"Crypto","PinService","UnsealPinEnvelope"),new Dv(i)}catch(e){return this.logService.error(`Failed to unseal pin: ${e}`),null}})}},deps:[$G,Za,Bp,Jk,ore]},{provide:dte,useClass:class{constructor(e){this.cryptoFunctionService=e}getLoginWithPrfSalt(){return Cie(this,void 0,void 0,function*(){return yield this.cryptoFunctionService.hash("passwordless-login","sha256")})}createSymmetricKeyFromPrf(e){return Cie(this,void 0,void 0,function*(){return yield this.stretchKey(new Uint8Array(e))})}stretchKey(e){return Cie(this,void 0,void 0,function*(){const t=new Uint8Array(64),i=yield this.cryptoFunctionService.hkdfExpand(e,"enc",32,"sha256"),n=yield this.cryptoFunctionService.hkdfExpand(e,"mac",32,"sha256");return t.set(new Uint8Array(i)),t.set(new Uint8Array(n),32),new Dv(t)})}},deps:[FI]},{provide:ute,useClass:class{constructor(e,t){this.apiService=e,this.environmentService=t}getCredentialAssertionOptions(){return Iie(this,void 0,void 0,function*(){const e=yield(0,bo._)(this.environmentService.environment$),t=yield this.apiService.send("GET","/accounts/webauthn/assertion-options",null,!1,!0,e.getIdentityUrl());return new kie(t)})}},deps:[eI,mk]},{provide:kH,useClass:class{constructor(e,t,i,n,r){this.webAuthnLoginApiService=e,this.loginStrategyService=t,this.webAuthnLoginPrfKeyService=i,this.window=n,this.logService=r,this.navigatorCredentials=this.window.navigator.credentials}getCredentialAssertionOptions(){return Fie(this,void 0,void 0,function*(){const e=yield this.webAuthnLoginApiService.getCredentialAssertionOptions();return new Tie(e.options,e.token)})}assertCredential(e){return Fie(this,void 0,void 0,function*(){var t,i,n;const r={publicKey:e.options};r.publicKey.extensions={prf:{eval:{first:yield this.webAuthnLoginPrfKeyService.getLoginWithPrfSalt()}}};try{const n=yield this.navigatorCredentials.get(r);if(!(n instanceof PublicKeyCredential))return;const s=null===(i=null===(t=n.getClientExtensionResults().prf)||void 0===t?void 0:t.results)||void 0===i?void 0:i.first;let o;null!=s&&(o=yield this.webAuthnLoginPrfKeyService.createSymmetricKeyFromPrf(s));const a=new Gw(n);if("prf"in a.extensions)throw new Error("PRF information is not allowed to be sent to the server.");return new Pie(e.token,a,o)}catch(e){return void(null===(n=this.logService)||void 0===n||n.error(e))}})}logIn(e){return Fie(this,void 0,void 0,function*(){const t=new Kw(e.token,e.deviceResponse,e.prfKey);return yield this.loginStrategyService.logIn(t)})}},deps:[ute,Ew,dte,AT,Za]},{provide:kp,useClass:kp,deps:[$T,ET]},{provide:Xe,useClass:class{constructor(e,t){this.storageServiceProvider=t,this.stateEventStateMap={lock:e.get(ia),logout:e.get(na)}}registerEvents(e){return ta(this,void 0,void 0,function*(){for(const t of e.clearOn){const i=this.stateEventStateMap[t],[n]=this.storageServiceProvider.get(e.stateDefinition.defaultStorageLocation,e.stateDefinition.storageLocationOverrides),r={state:e.stateDefinition.name,key:e.key,location:n};yield i.update(e=>(null!=e||(e=[]),e.push(r),e),{shouldUpdate:e=>null==e||-1===e.findIndex(e=>e.state===r.state&&e.key===r.key&&e.location===r.location)})}})}},deps:[d,kp]},{provide:I,useClass:class{constructor(e,t){this.storageServiceProvider=t,this.stateEventMap={lock:e.get(ia),logout:e.get(na)}}handleEvent(e,t){return ra(this,void 0,void 0,function*(){let i=yield(0,bo._)(this.stateEventMap[e].state$);null!=i||(i=[]);const n=[];for(const e of i)try{const[,i]=this.storageServiceProvider.get(e.location,{}),n=this.storageKeyFor(t,e);null!=(yield i.get(n))&&(yield i.remove(n))}catch(t){let i="Unknown Error";null!=t&&"object"==typeof t&&"message"in t&&"string"==typeof t.message&&(i=t.message),n.push(`${i} in ${e.state} > ${e.key} located ${e.location}`)}if(n.length>0)throw new Error(`One or more errors occurred while handling event '${e}' for user ${t}.\n${n.join("\n")}`)})}storageKeyFor(e,t){return new k(new C(t.state,t.location),t.key,{deserializer:e=>e,clearOn:[]}).buildKey(e)}},deps:[d,kp]},{provide:d,useClass:class{constructor(e,t){this.storageServiceProvider=e,this.logService=t,this.globalStateCache={}}get(e){const[t,i]=this.storageServiceProvider.get(e.stateDefinition.defaultStorageLocation,e.stateDefinition.storageLocationOverrides),n=this.buildCacheKey(t,e),r=this.globalStateCache[n];if(null!=r)return r;const s=new Bo(e,i,this.logService);return this.globalStateCache[n]=s,s}buildCacheKey(e,t){return`${e}_${t.fullName}`}},deps:[kp,Za]},{provide:Wo,useClass:class{constructor(e){this.accountService=e,this.activeUserId$=this.accountService.activeAccount$.pipe((0,l.T)(e=>null!=e?e.id:null))}},deps:[Zk]},{provide:p,useClass:class{constructor(e,t){this.activeAccountAccessor=e,this.singleUserStateProvider=t,this.activeUserId$=this.activeAccountAccessor.activeUserId$.pipe((0,mo.F)((e,t)=>null==e||null==t?e==t:e===t))}get(e){return new Io(e,this.activeUserId$,this.singleUserStateProvider)}},deps:[Wo,h]},{provide:h,useClass:class{constructor(e,t,i){this.storageServiceProvider=e,this.stateEventRegistrarService=t,this.logService=i,this.cache={}}get(e,t){const[i,n]=this.storageServiceProvider.get(t.stateDefinition.defaultStorageLocation,t.stateDefinition.storageLocationOverrides),r=this.buildCacheKey(i,e,t),s=this.cache[r];if(null!=s)return s;const o=new zo(e,t,n,this.stateEventRegistrarService,this.logService);return this.cache[r]=o,o}buildCacheKey(e,t,i){return`${e}_${i.fullName}_${t}`}},deps:[kp,Xe,Za]},{provide:c,useClass:class{constructor(){this.cache=new WeakMap}get(e,t,i){let n=this.cache.get(e);n||(n={},this.cache.set(e,n));const r=t.buildCacheKey(),s=n[r];if(null!=s)return s;const o=this.buildDerivedState(e,t,i);return n[r]=o,o}buildDerivedState(e,t,i){return new Do(e,t,i)}},deps:[]},{provide:u,useClass:class{constructor(e,t,i,n){this.activeUserStateProvider=e,this.singleUserStateProvider=t,this.globalStateProvider=i,this.derivedStateProvider=n,this.getActive=this.activeUserStateProvider.get.bind(this.activeUserStateProvider),this.getUser=this.singleUserStateProvider.get.bind(this.singleUserStateProvider),this.getGlobal=this.globalStateProvider.get.bind(this.globalStateProvider),this.getDerived=this.derivedStateProvider.get.bind(this.derivedStateProvider),this.activeUserId$=this.activeUserStateProvider.activeUserId$}getUserState$(e,t){return t?this.getUser(t,e).state$:this.activeUserId$.pipe((0,Eo.p)(e=>null!=e),(0,_o.s)(1),(0,go.n)(t=>this.getUser(t,e).state$))}getUserStateOrDefault$(e,t){const{userId:i,defaultValue:n=null}=t;return i?this.getUser(i,e).state$:this.activeUserId$.pipe((0,_o.s)(1),(0,go.n)(t=>null!=t?this.getUser(t,e).state$:(0,Go.of)(n)))}setUserState(e,t,i){return Ko(this,void 0,void 0,function*(){return i?[i,yield this.getUser(i,e).update(()=>t)]:yield this.getActive(e).update(()=>t)})}},deps:[p,h,d,c]},{provide:class{},useClass:class{constructor(e,t,i,n,r,s,o){this.apiService=e,this.billingApiService=t,this.keyService=i,this.encryptService=n,this.i18nService=r,this.organizationApiService=s,this.syncService=o}purchaseSubscription(e,t){return Yie(this,void 0,void 0,function*(){const i=new qie,n=yield this.makeOrganizationKeys(t);this.setOrganizationKeys(i,n),this.setOrganizationInformation(i,e.organization),this.setPlanInformation(i,e.plan),this.setPaymentInformation(i,e.payment);const r=yield this.organizationApiService.create(i);return yield this.apiService.refreshIdentityToken(),yield this.syncService.fullSync(!0),r})}purchaseSubscriptionNoPaymentMethod(e,t){return Yie(this,void 0,void 0,function*(){const i=new Xie,n=yield this.makeOrganizationKeys(t);this.setOrganizationKeys(i,n),this.setOrganizationInformation(i,e.organization),this.setPlanInformation(i,e.plan);const r=yield this.organizationApiService.createWithoutPayment(i);return yield this.apiService.refreshIdentityToken(),yield this.syncService.fullSync(!0),r})}startFree(e,t){return Yie(this,void 0,void 0,function*(){const i=new qie,n=yield this.makeOrganizationKeys(t);this.setOrganizationKeys(i,n),this.setOrganizationInformation(i,e.organization),this.setPlanInformation(i,e.plan);const r=yield this.organizationApiService.create(i);return yield this.apiService.refreshIdentityToken(),yield this.syncService.fullSync(!0),r})}makeOrganizationKeys(e){return Yie(this,void 0,void 0,function*(){const[t,i]=yield this.keyService.makeOrgKey(e),[n,r]=yield this.keyService.makeKeyPair(i);return{encryptedKey:t,publicKey:n,encryptedPrivateKey:r,encryptedCollectionName:yield this.encryptService.encryptString(this.i18nService.t("defaultCollection"),i)}})}prohibitsAdditionalSeats(e){switch(e){case O$.Free:case O$.FamiliesAnnually:case O$.FamiliesAnnually2019:case O$.FamiliesAnnually2025:case O$.TeamsStarter2023:case O$.TeamsStarter:return!0;default:return!1}}setOrganizationInformation(e,t){e.name=t.name,e.businessName=t.businessName,e.billingEmail=t.billingEmail,e.initiationPath=t.initiationPath}setOrganizationKeys(e,t){e.key=t.encryptedKey.encryptedString,e.keys=new Wie(t.publicKey,t.encryptedPrivateKey.encryptedString),e.collectionName=t.encryptedCollectionName.encryptedString}setPaymentInformation(e,t){const[i,n]=t.paymentMethod;e.paymentToken=i,e.paymentMethodType=n,e.skipTrial=t.skipTrial;const r=t.billing;e.billingAddressPostalCode=r.postalCode,e.billingAddressCountry=r.country,r.taxId&&(e.taxIdNumber=r.taxId,e.billingAddressLine1=r.addressLine1,e.billingAddressLine2=r.addressLine2,e.billingAddressCity=r.city,e.billingAddressState=r.state)}setPlanInformation(e,t){if(e.planType=t.type,this.prohibitsAdditionalSeats(e.planType))return e.useSecretsManager=t.subscribeToSecretsManager,void(e.isFromSecretsManagerTrial=t.isFromSecretsManagerTrial);e.additionalSeats=t.passwordManagerSeats,t.subscribeToSecretsManager&&(e.useSecretsManager=!0,e.isFromSecretsManagerTrial=t.isFromSecretsManagerTrial,e.additionalSmSeats=t.secretsManagerSeats,e.additionalServiceAccounts=t.secretsManagerServiceAccounts),t.storage&&(e.additionalStorageGb=t.storage)}restartSubscription(e,t,i){return Yie(this,void 0,void 0,function*(){const n=new qie,r=yield this.makeOrganizationKeys(i);this.setOrganizationKeys(n,r),this.setOrganizationInformation(n,t.organization),this.setPlanInformation(n,t.plan),this.setPaymentInformation(n,t.payment),yield this.billingApiService.restartSubscription(e,n)})}},deps:[eI,LQ,Bp,$G,Ul,nI,qx]},{provide:BE,useClass:jE,deps:[u,Jb,Zk,r$]},{provide:F5,useClass:class{constructor(e){this.stateProvider=e,this.enableBadgeCounterState=this.stateProvider.getActive(P5),this.enableBadgeCounter$=this.enableBadgeCounterState.state$.pipe((0,l.T)(e=>null==e||e))}setEnableBadgeCounter(e){return T5(this,void 0,void 0,function*(){yield this.enableBadgeCounterState.update(()=>e)})}},deps:[u]},{provide:Mp,useClass:class{constructor(e){this.stateProvider=e,this.biometricUnlockEnabledState=this.stateProvider.getActive(Fp),this.encryptedClientKeyHalfState=this.stateProvider.getActive(Rp),this.encryptedClientKeyHalf$=this.encryptedClientKeyHalfState.state$.pipe((0,l.T)(Np)),this.promptCancelledState=this.stateProvider.getGlobal(xp),this.promptCancelled$=(0,jo.z)([this.stateProvider.activeUserId$,this.promptCancelledState.state$]).pipe((0,l.T)(([e,t])=>{var i;return null!=e&&(null!==(i=null==t?void 0:t[e])&&void 0!==i&&i)})),this.promptAutomaticallyState=this.stateProvider.getActive(Ap),this.promptAutomatically$=this.promptAutomaticallyState.state$.pipe((0,l.T)(Boolean)),this.fingerprintValidatedState=this.stateProvider.getGlobal(Dp),this.fingerprintValidated$=this.fingerprintValidatedState.state$.pipe((0,l.T)(Boolean)),this.lastProcessReloadState=this.stateProvider.getGlobal(Ep),this.lastProcessReload$=this.lastProcessReloadState.state$}setBiometricUnlockEnabled(e){return Up(this,void 0,void 0,function*(){yield this.biometricUnlockEnabledState.update(()=>e)})}biometricUnlockEnabled$(e){return null!=e?this.stateProvider.getUser(e,Fp).state$.pipe((0,l.T)(Boolean)):this.biometricUnlockEnabledState.state$.pipe((0,l.T)(Boolean))}getBiometricUnlockEnabled(e){return Up(this,void 0,void 0,function*(){return yield(0,bo._)(this.stateProvider.getUser(e,Fp).state$.pipe((0,l.T)(Boolean)))})}setEncryptedClientKeyHalf(e,t){return Up(this,void 0,void 0,function*(){var i;const n=null!==(i=null==e?void 0:e.encryptedString)&&void 0!==i?i:null;t?yield this.stateProvider.getUser(t,Rp).update(()=>n):yield this.encryptedClientKeyHalfState.update(()=>n)})}getEncryptedClientKeyHalf(e){return Up(this,void 0,void 0,function*(){return yield(0,bo._)(this.stateProvider.getUser(e,Rp).state$.pipe((0,l.T)(Np)))})}logout(e){return Up(this,void 0,void 0,function*(){yield this.stateProvider.getUser(e,Rp).update(()=>null),yield this.resetUserPromptCancelled(e)})}resetUserPromptCancelled(e){return Up(this,void 0,void 0,function*(){yield this.stateProvider.getGlobal(xp).update((t,i)=>(null!=t&&delete t[null!=e?e:i],t),{combineLatestWith:this.stateProvider.activeUserId$,shouldUpdate:(t,i)=>null!=(null==t?void 0:t[null!=e?e:i])})})}setUserPromptCancelled(){return Up(this,void 0,void 0,function*(){yield this.promptCancelledState.update((e,t)=>(null!=t&&(null!=e||(e={}),e[t]=!0),e),{combineLatestWith:this.stateProvider.activeUserId$,shouldUpdate:(e,t)=>{if(null==t)throw new Error("Cannot update biometric prompt cancelled state without an active user");return!0}})})}resetAllPromptCancelled(){return Up(this,void 0,void 0,function*(){yield this.promptCancelledState.update(()=>null)})}setPromptAutomatically(e){return Up(this,void 0,void 0,function*(){yield this.promptAutomaticallyState.update(()=>e)})}setFingerprintValidated(e){return Up(this,void 0,void 0,function*(){yield this.fingerprintValidatedState.update(()=>e)})}updateLastProcessReload(){return Up(this,void 0,void 0,function*(){yield this.lastProcessReloadState.update(()=>new Date)})}getLastProcessReload(){return Up(this,void 0,void 0,function*(){return yield(0,bo._)(this.lastProcessReload$)})}},deps:[u]},{provide:FY,useClass:class{constructor(e,t){this.stateProvider=e,this.restrictedItemTypesService=t,this.enablePasskeysState=this.stateProvider.getGlobal(yae),this.enablePasskeys$=this.enablePasskeysState.state$.pipe((0,l.T)(e=>null==e||e)),this.showCardsCurrentTabState=this.stateProvider.getActive(bae),this.showCardsCurrentTab$=(0,jo.z)([this.showCardsCurrentTabState.state$.pipe((0,l.T)(e=>null==e||e)),this.restrictedItemTypesService.restricted$]).pipe((0,l.T)(([e,t])=>e&&!t.some(e=>e.cipherType===nx.Card))),this.showIdentitiesCurrentTabState=this.stateProvider.getActive(wae),this.showIdentitiesCurrentTab$=this.showIdentitiesCurrentTabState.state$.pipe((0,l.T)(e=>null==e||e)),this.clickItemsToAutofillVaultViewState=this.stateProvider.getActive(Sae),this.clickItemsToAutofillVaultView$=this.clickItemsToAutofillVaultViewState.state$.pipe((0,l.T)(e=>null!=e&&e),(0,Gp.t)({bufferSize:1,refCount:!1}))}setShowCardsCurrentTab(e){return kae(this,void 0,void 0,function*(){yield this.showCardsCurrentTabState.update(()=>e)})}setShowIdentitiesCurrentTab(e){return kae(this,void 0,void 0,function*(){yield this.showIdentitiesCurrentTabState.update(()=>e)})}setClickItemsToAutofillVaultView(e){return kae(this,void 0,void 0,function*(){yield this.clickItemsToAutofillVaultViewState.update(()=>e)})}setEnablePasskeys(e){return kae(this,void 0,void 0,function*(){yield this.enablePasskeysState.update(()=>e)})}},deps:[u,r$]},{provide:fse,useClass:fse,deps:[yp,Za,pse,_T]},{provide:pse,useClass:pse,deps:[]},{provide:LQ,useClass:class{constructor(e){this.apiService=e}cancelOrganizationSubscription(e,t){return this.apiService.send("POST","/organizations/"+e+"/cancel",t,!0,!1)}cancelPremiumUserSubscription(e){return this.apiService.send("POST","/accounts/cancel",e,!0,!1)}getOrganizationBillingMetadata(e){return Gie(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/billing/vnext/metadata",null,!0,!0);return new Uie(t)})}getOrganizationBillingMetadataSelfHost(e){return Gie(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/billing/vnext/self-host/metadata",null,!0,!0);return new Uie(t)})}getPlans(){return Gie(this,void 0,void 0,function*(){const e=yield this.apiService.send("GET","/plans",null,!0,!0);return new sk(e,Aee)})}getPremiumPlan(){return Gie(this,void 0,void 0,function*(){const e=yield this.apiService.send("GET","/plans/premium",null,!0,!0);return new Die(e)})}getProviderClientInvoiceReport(e,t){return Gie(this,void 0,void 0,function*(){return yield this.apiService.send("GET","/providers/"+e+"/billing/invoices/"+t,null,!0,!0)})}getProviderInvoices(e){return Gie(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/providers/"+e+"/billing/invoices",null,!0,!0);return new $ie(t)})}getProviderSubscription(e){return Gie(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/providers/"+e+"/billing/subscription",null,!0,!0);return new Bie(t)})}restartSubscription(e,t){return Gie(this,void 0,void 0,function*(){return yield this.apiService.send("POST","/organizations/"+e+"/billing/restart-subscription",t,!0,!1)})}},deps:[eI]},{provide:class{},useClass:class{constructor(e,t){this.billingApiService=e,this.platformUtilsService=t,this.metadataCache=new Map,this.refreshMetadataTrigger=new Dd.t(void 0),this.refreshMetadataCache=()=>{this.metadataCache.clear(),this.refreshMetadataTrigger.next()}}getOrganizationMetadata$(e){return this.refreshMetadataTrigger.pipe((0,go.n)(()=>{const t=this.metadataCache.get(e);if(t)return t;const i=(0,$d.H)(this.fetchMetadata(e)).pipe((0,Gp.t)({bufferSize:1,refCount:!1}));return this.metadataCache.set(e,i),i}))}fetchMetadata(e){return zie(this,void 0,void 0,function*(){return this.platformUtilsService.isSelfHost()?yield this.billingApiService.getOrganizationBillingMetadataSelfHost(e):yield this.billingApiService.getOrganizationBillingMetadata(e)})}},deps:[LQ,Hb]},{provide:T$,useClass:class{constructor(e){this.stateProvider=e}hasPremiumFromAnyOrganization$(e){return this.stateProvider.getUser(e,Aie).state$.pipe((0,l.T)(e=>!!(null==e?void 0:e.hasPremiumFromAnyOrganization)))}hasPremiumPersonally$(e){return this.stateProvider.getUser(e,Aie).state$.pipe((0,l.T)(e=>!!(null==e?void 0:e.hasPremiumPersonally)))}hasPremiumFromAnySource$(e){return this.stateProvider.getUser(e,Aie).state$.pipe((0,l.T)(e=>!0===(null==e?void 0:e.hasPremiumFromAnyOrganization)||!0===(null==e?void 0:e.hasPremiumPersonally)))}setHasPremium(e,t,i){return xie(this,void 0,void 0,function*(){yield this.stateProvider.getUser(i,Aie).update(i=>({hasPremiumPersonally:e,hasPremiumFromAnyOrganization:t}),{shouldUpdate:i=>null==i||i.hasPremiumFromAnyOrganization!==t||i.hasPremiumPersonally!==e})})}},deps:[u]},{provide:O2,useClass:class{constructor(e,t,i,n,r){this.billingApiService=e,this.configService=t,this.i18nService=i,this.logService=n,this.environmentService=r,this.getPersonalSubscriptionPricingTiers$=()=>(0,jo.z)([this.premium$,this.families$]).pipe((0,Ed.W)(e=>(this.logService.error("Failed to load personal subscription pricing tiers",e),(0,So.$)(()=>e)))),this.getBusinessSubscriptionPricingTiers$=()=>(0,jo.z)([this.teams$,this.enterprise$,this.custom$]).pipe((0,Ed.W)(e=>(this.logService.error("Failed to load business subscription pricing tiers",e),(0,So.$)(()=>e)))),this.getDeveloperSubscriptionPricingTiers$=()=>(0,jo.z)([this.free$,this.teams$,this.enterprise$]).pipe((0,Ed.W)(e=>(this.logService.error("Failed to load developer subscription pricing tiers",e),(0,So.$)(()=>e)))),this.organizationPlansResponse$=this.environmentService.environment$.pipe((0,_o.s)(1),(0,go.n)(e=>e.isCloud()?(0,$d.H)(this.billingApiService.getPlans()):(0,Go.of)({data:[]})),(0,Gp.t)({bufferSize:1,refCount:!1})),this.premiumPlanResponse$=this.environmentService.environment$.pipe((0,_o.s)(1),(0,go.n)(e=>e.isCloud()?(0,$d.H)(this.billingApiService.getPremiumPlan()).pipe((0,Ed.W)(e=>(this.logService.error("Failed to fetch premium plan from API",e),(0,So.$)(()=>e)))):(0,Go.of)({seat:void 0,storage:void 0})),(0,Gp.t)({bufferSize:1,refCount:!1})),this.premium$=this.premiumPlanResponse$.pipe((0,l.T)(e=>{var t,i,n;return{id:P2,name:this.i18nService.t("premium"),description:this.i18nService.t("advancedOnlineSecurity"),availableCadences:[E2],passwordManager:{type:"standalone",annualPrice:null===(t=e.seat)||void 0===t?void 0:t.price,annualPricePerAdditionalStorageGB:null===(i=e.storage)||void 0===i?void 0:i.price,providedStorageGB:null===(n=e.storage)||void 0===n?void 0:n.provided,features:[this.featureTranslations.builtInAuthenticator(),this.featureTranslations.secureFileStorage(),this.featureTranslations.emergencyAccess(),this.featureTranslations.breachMonitoring(),this.featureTranslations.andMoreFeatures()]}}})),this.families$=this.organizationPlansResponse$.pipe((0,Yp.v)(this.configService.getFeatureFlag$(Wv.PM26462_Milestone_3)),(0,l.T)(([e,t])=>{var i,n,r,s;const o=e.data.find(e=>e.type===(t?O$.FamiliesAnnually:O$.FamiliesAnnually2025));return{id:F2,name:this.i18nService.t("planNameFamilies"),description:this.i18nService.t("planDescFamiliesV2"),availableCadences:[E2],passwordManager:{type:"packaged",users:null===(i=null==o?void 0:o.PasswordManager)||void 0===i?void 0:i.baseSeats,annualPrice:null===(n=null==o?void 0:o.PasswordManager)||void 0===n?void 0:n.basePrice,annualPricePerAdditionalStorageGB:null===(r=null==o?void 0:o.PasswordManager)||void 0===r?void 0:r.additionalStoragePricePerGb,providedStorageGB:null===(s=null==o?void 0:o.PasswordManager)||void 0===s?void 0:s.baseStorageGb,features:[this.featureTranslations.premiumAccounts(),this.featureTranslations.familiesUnlimitedSharing(),this.featureTranslations.familiesUnlimitedCollections(),this.featureTranslations.familiesSharedStorage()]}}})),this.free$=this.organizationPlansResponse$.pipe((0,l.T)(e=>{var t,i,n;const r=e.data.find(e=>e.type===O$.Free);return{id:R2,name:this.i18nService.t("planNameFree"),description:this.i18nService.t("planDescFreeV2","1"),availableCadences:[],passwordManager:{type:"free",features:[this.featureTranslations.limitedUsersV2(null===(t=null==r?void 0:r.PasswordManager)||void 0===t?void 0:t.maxSeats),this.featureTranslations.limitedCollectionsV2(null===(i=null==r?void 0:r.PasswordManager)||void 0===i?void 0:i.maxCollections),this.featureTranslations.alwaysFree()]},secretsManager:{type:"free",features:[this.featureTranslations.twoSecretsIncluded(),this.featureTranslations.projectsIncludedV2(null===(n=null==r?void 0:r.SecretsManager)||void 0===n?void 0:n.maxProjects)]}}})),this.teams$=this.organizationPlansResponse$.pipe((0,l.T)(e=>{var t,i,n,r,s,o;const a=e.data.find(e=>e.type===O$.TeamsAnnually);return{id:x2,name:this.i18nService.t("planNameTeams"),description:this.i18nService.t("teamsPlanUpgradeMessage"),availableCadences:[E2,$2],passwordManager:{type:"scalable",annualPricePerUser:null===(t=null==a?void 0:a.PasswordManager)||void 0===t?void 0:t.seatPrice,annualPricePerAdditionalStorageGB:null===(i=null==a?void 0:a.PasswordManager)||void 0===i?void 0:i.additionalStoragePricePerGb,providedStorageGB:null===(n=null==a?void 0:a.PasswordManager)||void 0===n?void 0:n.baseStorageGb,features:[this.featureTranslations.secureItemSharing(),this.featureTranslations.eventLogMonitoring(),this.featureTranslations.directoryIntegration(),this.featureTranslations.scimSupport()]},secretsManager:{type:"scalable",annualPricePerUser:null===(r=null==a?void 0:a.SecretsManager)||void 0===r?void 0:r.seatPrice,annualPricePerAdditionalServiceAccount:null===(s=null==a?void 0:a.SecretsManager)||void 0===s?void 0:s.additionalPricePerServiceAccount,features:[this.featureTranslations.unlimitedSecretsAndProjects(),this.featureTranslations.includedMachineAccountsV2(null===(o=null==a?void 0:a.SecretsManager)||void 0===o?void 0:o.baseServiceAccount)]}}})),this.enterprise$=this.organizationPlansResponse$.pipe((0,l.T)(e=>{var t,i,n,r,s,o;const a=e.data.find(e=>e.type===O$.EnterpriseAnnually);return{id:A2,name:this.i18nService.t("planNameEnterprise"),description:this.i18nService.t("planDescEnterpriseV2"),availableCadences:[E2,$2],passwordManager:{type:"scalable",annualPricePerUser:null===(t=null==a?void 0:a.PasswordManager)||void 0===t?void 0:t.seatPrice,annualPricePerAdditionalStorageGB:null===(i=null==a?void 0:a.PasswordManager)||void 0===i?void 0:i.additionalStoragePricePerGb,providedStorageGB:null===(n=null==a?void 0:a.PasswordManager)||void 0===n?void 0:n.baseStorageGb,features:[this.featureTranslations.enterpriseSecurityPolicies(),this.featureTranslations.passwordLessSso(),this.featureTranslations.accountRecovery(),this.featureTranslations.selfHostOption(),this.featureTranslations.complimentaryFamiliesPlan()]},secretsManager:{type:"scalable",annualPricePerUser:null===(r=null==a?void 0:a.SecretsManager)||void 0===r?void 0:r.seatPrice,annualPricePerAdditionalServiceAccount:null===(s=null==a?void 0:a.SecretsManager)||void 0===s?void 0:s.additionalPricePerServiceAccount,features:[this.featureTranslations.unlimitedUsers(),this.featureTranslations.includedMachineAccountsV2(null===(o=null==a?void 0:a.SecretsManager)||void 0===o?void 0:o.baseServiceAccount)]}}})),this.custom$=this.organizationPlansResponse$.pipe((0,l.T)(()=>({id:D2,name:this.i18nService.t("planNameCustom"),description:this.i18nService.t("planDescCustom"),availableCadences:[],passwordManager:{type:"custom",features:[this.featureTranslations.strengthenCybersecurity(),this.featureTranslations.boostProductivity(),this.featureTranslations.seamlessIntegration()]}}))),this.featureTranslations={builtInAuthenticator:()=>({key:"builtInAuthenticator",value:this.i18nService.t("builtInAuthenticator")}),emergencyAccess:()=>({key:"emergencyAccess",value:this.i18nService.t("emergencyAccess")}),breachMonitoring:()=>({key:"breachMonitoring",value:this.i18nService.t("breachMonitoring")}),andMoreFeatures:()=>({key:"andMoreFeatures",value:this.i18nService.t("andMoreFeatures")}),premiumAccounts:()=>({key:"premiumAccounts",value:this.i18nService.t("premiumAccounts")}),secureFileStorage:()=>({key:"secureFileStorage",value:this.i18nService.t("secureFileStorage")}),familiesUnlimitedSharing:()=>({key:"familiesUnlimitedSharing",value:this.i18nService.t("familiesUnlimitedSharing")}),familiesUnlimitedCollections:()=>({key:"familiesUnlimitedCollections",value:this.i18nService.t("familiesUnlimitedCollections")}),familiesSharedStorage:()=>({key:"familiesSharedStorage",value:this.i18nService.t("familiesSharedStorage")}),limitedUsersV2:e=>({key:"limitedUsersV2",value:this.i18nService.t("limitedUsersV2",e)}),limitedCollectionsV2:e=>({key:"limitedCollectionsV2",value:this.i18nService.t("limitedCollectionsV2",e)}),alwaysFree:()=>({key:"alwaysFree",value:this.i18nService.t("alwaysFree")}),twoSecretsIncluded:()=>({key:"twoSecretsIncluded",value:this.i18nService.t("twoSecretsIncluded")}),projectsIncludedV2:e=>({key:"projectsIncludedV2",value:this.i18nService.t("projectsIncludedV2",e)}),secureItemSharing:()=>({key:"secureItemSharing",value:this.i18nService.t("secureItemSharing")}),eventLogMonitoring:()=>({key:"eventLogMonitoring",value:this.i18nService.t("eventLogMonitoring")}),directoryIntegration:()=>({key:"directoryIntegration",value:this.i18nService.t("directoryIntegration")}),scimSupport:()=>({key:"scimSupport",value:this.i18nService.t("scimSupport")}),unlimitedSecretsAndProjects:()=>({key:"unlimitedSecretsAndProjects",value:this.i18nService.t("unlimitedSecretsAndProjects")}),includedMachineAccountsV2:e=>({key:"includedMachineAccountsV2",value:this.i18nService.t("includedMachineAccountsV2",e)}),enterpriseSecurityPolicies:()=>({key:"enterpriseSecurityPolicies",value:this.i18nService.t("enterpriseSecurityPolicies")}),passwordLessSso:()=>({key:"passwordLessSso",value:this.i18nService.t("passwordLessSso")}),accountRecovery:()=>({key:"accountRecovery",value:this.i18nService.t("accountRecovery")}),selfHostOption:()=>({key:"selfHostOption",value:this.i18nService.t("selfHostOption")}),complimentaryFamiliesPlan:()=>({key:"complimentaryFamiliesPlan",value:this.i18nService.t("complimentaryFamiliesPlan")}),unlimitedUsers:()=>({key:"unlimitedUsers",value:this.i18nService.t("unlimitedUsers")}),strengthenCybersecurity:()=>({key:"strengthenCybersecurity",value:this.i18nService.t("strengthenCybersecurity")}),boostProductivity:()=>({key:"boostProductivity",value:this.i18nService.t("boostProductivity")}),seamlessIntegration:()=>({key:"seamlessIntegration",value:this.i18nService.t("seamlessIntegration")})}}},deps:[LQ,Kb,Ul,Za,mk]},{provide:class{},useClass:class{constructor(e){this.stateProvider=e,this.autoConfirmFingerPrints=this.buildOrganizationManagementPreference(Zee,!1)}buildOrganizationManagementPreference(e,t){return new fee(this.getKeyFromState(e).state$.pipe((0,l.T)(e=>null!=e?e:t)),this.setKeyInStateFn(e))}getKeyFromState(e){return this.stateProvider.getActive(e)}setKeyInStateFn(e){return t=>Jee(this,void 0,void 0,function*(){yield this.getKeyFromState(e).update(()=>t)})}},deps:[u]},{provide:Use,useClass:Use,deps:[Bp]},{provide:a.zcH,useClass:Nae,deps:[]},{provide:zT,useFactory:()=>new Co.B,deps:[]},{provide:gk,useFactory:e=>new gk(e.asObservable()),deps:[zT]},{provide:bk,useFactory:e=>new Ik(e),deps:[zT]},{provide:La,useClass:Ka,deps:[Za]},{provide:class{},useClass:class{constructor(e){this.apiService=e}postProviderSetup(e,t){return rte(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/providers/"+e+"/setup",t,!0,!0);return new nte(i)})}getProvider(e){return rte(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/providers/"+e,null,!0,!0);return new nte(t)})}putProvider(e,t){return rte(this,void 0,void 0,function*(){const i=yield this.apiService.send("PUT","/providers/"+e,t,!0,!0);return new nte(i)})}providerRecoverDeleteToken(e,t){return this.apiService.send("POST","/providers/"+e+"/delete-recover-token",t,!1,!1)}deleteProvider(e){return rte(this,void 0,void 0,function*(){yield this.apiService.send("DELETE","/providers/"+e,null,!0,!1)})}getProviderOrganizations(e){return rte(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/providers/"+e+"/organizations",null,!0,!0);return new sk(t,ite)})}getProviderAddableOrganizations(e){return rte(this,void 0,void 0,function*(){return(yield this.apiService.send("GET","/providers/"+e+"/clients/addable",null,!0,!0)).map(e=>new ete(e))})}addOrganizationToProvider(e,t){return this.apiService.send("POST","/providers/"+e+"/clients/existing",t,!0,!1)}updateProviderOrganization(e,t,i){return rte(this,void 0,void 0,function*(){return yield this.apiService.send("PUT","/providers/"+e+"/clients/"+t,i,!0,!1)})}createProviderOrganization(e,t){return this.apiService.send("POST","/providers/"+e+"/clients",t,!0,!1)}},deps:[eI]},{provide:_v,useClass:class{constructor(e){this.stateProvider=e}setKdfConfig(e,t){return Kv(this,void 0,void 0,function*(){if(null==e)throw new Error("userId cannot be null");if(null==t)throw new Error("kdfConfig cannot be null");yield this.stateProvider.setUserState(Xv,t,e)})}getKdfConfig(e){return Kv(this,void 0,void 0,function*(){if(null==e)throw new Error("userId cannot be null");const t=yield(0,bo._)(this.stateProvider.getUser(e,Xv).state$);if(null==t)throw new Error("KdfConfig for user "+e+" is null");return t})}getKdfConfig$(e){if(null==e)throw new Error("userId cannot be null");return this.stateProvider.getUser(e,Xv).state$}},deps:[u]},{provide:xH,useClass:class{getOrganizationInvite(){return Hte(this,void 0,void 0,function*(){return null})}setOrganizationInvitation(e){return Hte(this,void 0,void 0,function*(){})}clearOrganizationInvitation(){return Hte(this,void 0,void 0,function*(){})}},deps:[]},{provide:zH,useClass:class{constructor(e,t,i,n,r,s,o,a,l,c,u,d){this.apiService=e,this.encryptService=t,this.i18nService=i,this.kdfConfigService=n,this.keyService=r,this.masterPasswordApiService=s,this.masterPasswordService=o,this.organizationApiService=a,this.organizationUserApiService=l,this.userDecryptionOptionsService=c,this.accountCryptographicStateService=u,this.registerSdkService=d}setInitialPassword(e,t,i){return Pae(this,void 0,void 0,function*(){const{newMasterKey:n,newServerMasterKeyHash:r,newLocalMasterKeyHash:s,newPasswordHint:o,kdfConfig:a,orgSsoIdentifier:l,orgId:c,resetPasswordAutoEnroll:u,newPassword:d,salt:h}=e;for(const[t,i]of Object.entries(e))if(null==i)throw new Error(`${t} not found. Could not set password.`);if(null==i)throw new Error("userId not found. Could not set password.");if(null==t)throw new Error("userType not found. Could not set password.");const p=yield this.makeMasterKeyEncryptedUserKey(n,i);if(null==p||!p[1].encryptedString)throw new Error("masterKeyEncryptedUserKey not found. Could not set password.");let v=null,f=null;if(t===LH.JIT_PROVISIONED_MP_ORG_USER){const e=yield(0,bo._)(this.keyService.userPrivateKey$(i)),t=yield(0,bo._)(this.keyService.userPublicKey$(i));if(null!=e&&null!=t){v=[bd.fromBufferToB64(t),yield this.encryptService.wrapDecapsulationKey(e,p[0])]}else v=yield this.keyService.makeKeyPair(p[0]);if(null==v)throw new Error("keyPair not found. Could not set password.");if(!v[1].encryptedString)throw new Error("encrypted private key not found. Could not set password.");f=new _k(v[0],v[1].encryptedString)}const m=new Cae(r,p[1].encryptedString,o,l,f,a);if(yield this.masterPasswordApiService.setPassword(m),yield this.masterPasswordService.setForceSetPasswordReason(aS.None,i),yield this.updateAccountDecryptionProperties(n,a,p,i),yield this.setMasterPasswordUnlockData(d,h,a,p[0],i),null!=v&&t===LH.JIT_PROVISIONED_MP_ORG_USER){if(!v[1].encryptedString)throw new Error("encrypted private key not found. Could not set private key in state.");yield this.accountCryptographicStateService.setAccountCryptographicState({V1:{private_key:v[1].encryptedString}},i)}yield this.masterPasswordService.setMasterKeyHash(s,i),u&&(yield this.handleResetPasswordAutoEnrollOld(r,c,i))})}setInitialPasswordTdeOffboarding(e,t){return Pae(this,void 0,void 0,function*(){const{newMasterKey:i,newServerMasterKeyHash:n,newPasswordHint:r}=e;for(const[t,i]of Object.entries(e))if(null==i)throw new Error(`${t} not found. Could not set password.`);if(null==t)throw new Error("userId not found. Could not set password.");const s=yield(0,bo._)(this.keyService.userKey$(t));if(null==s)throw new Error("userKey not found. Could not set password.");const o=yield this.keyService.encryptUserKeyWithMasterKey(i,s);if(!o[1].encryptedString)throw new Error("newMasterKeyEncryptedUserKey not found. Could not set password.");const a=new Tae;a.key=o[1].encryptedString,a.newMasterPasswordHash=n,a.masterPasswordHint=r,yield this.masterPasswordApiService.putUpdateTdeOffboardingPassword(a),yield this.masterPasswordService.setForceSetPasswordReason(aS.None,t)})}initializePasswordJitPasswordUserV2Encryption(e,t){return Pae(this,void 0,void 0,function*(){if(null==t)throw new Error("User ID is required.");for(const[t,i]of Object.entries(e))if(null==i)throw new Error(`${t} is required.`);const{newPasswordHint:i,orgSsoIdentifier:n,orgId:r,resetPasswordAutoEnroll:s,newPassword:o,salt:a}=e,l=yield this.organizationApiService.getKeys(r);if(null==l)throw new Error("Organization keys response is null.");const c=yield(0,bo._)(this.registerSdkService.registerClient$(t).pipe((0,To.H)(e=>Pae(this,void 0,void 0,function*(){const c={stack:[],error:void 0,hasError:!1};try{if(!e)throw new Error("SDK not available");const u=Fae(c,e.take(),!1);return yield u.value.auth().registration().post_keys_for_jit_password_registration({org_id:Yk(r),org_public_key:l.publicKey,master_password:o,master_password_hint:i,salt:a,organization_sso_identifier:n,user_id:Yk(t),reset_password_enroll:s})}catch(e){c.error=e,c.hasError=!0}finally{Rae(c)}}))));if(!("V2"in c.account_cryptographic_state))throw new Error("Unexpected V2 account cryptographic state");yield this.accountCryptographicStateService.setAccountCryptographicState(c.account_cryptographic_state,t),yield this.masterPasswordService.setForceSetPasswordReason(aS.None,t);const u=gS.fromSdk(c.master_password_unlock);yield this.masterPasswordService.setMasterPasswordUnlockData(u,t),yield this.keyService.setUserKey(Dv.fromString(c.user_key),t),yield this.updateLegacyState(o,Lv(c.master_password_unlock.kdf),new Pp(c.master_password_unlock.masterKeyWrappedUserKey),t,u)})}setInitialPasswordTdeUserWithPermission(e,t){return Pae(this,void 0,void 0,function*(){const i="Could not set initial password for TDE user with Manage Account Recovery permission.";GH(e.newPassword,"newPassword",i),GH(e.salt,"salt",i),ak(e.kdfConfig,"kdfConfig",i),ak(e.newPasswordHint,"newPasswordHint",i),GH(e.orgSsoIdentifier,"orgSsoIdentifier",i),GH(e.orgId,"orgId",i),ak(e.resetPasswordAutoEnroll,"resetPasswordAutoEnroll",i),GH(t,"userId",i);const{newPassword:n,salt:r,kdfConfig:s,newPasswordHint:o,orgSsoIdentifier:a,orgId:l,resetPasswordAutoEnroll:c}=e,u=yield(0,bo._)(this.keyService.userKey$(t));if(!u)throw new Error("userKey not found.");const d=yield this.masterPasswordService.makeMasterPasswordAuthenticationData(n,s,r),h=yield this.masterPasswordService.makeMasterPasswordUnlockData(n,s,r,u),p=Cae.newConstructor(d,h,o,a,null);yield this.masterPasswordApiService.setPassword(p),yield this.masterPasswordService.setForceSetPasswordReason(aS.None,t),yield this.masterPasswordService.setMasterPasswordUnlockData(h,t),yield this.updateLegacyState(n,h.kdf,new Pp(h.masterKeyWrappedUserKey),t,h),c&&(yield this.handleResetPasswordAutoEnroll(d.masterPasswordAuthenticationHash,l,t,u))})}makeMasterKeyEncryptedUserKey(e,t){return Pae(this,void 0,void 0,function*(){let i=null;const n=yield(0,bo._)(this.keyService.userKey$(t));return i=null==n?yield this.keyService.makeUserKey(e):yield this.keyService.encryptUserKeyWithMasterKey(e,n),i})}updateAccountDecryptionProperties(e,t,i,n){return Pae(this,void 0,void 0,function*(){const r=yield(0,bo._)(this.userDecryptionOptionsService.userDecryptionOptionsById$(n));r.hasMasterPassword=!0,yield this.userDecryptionOptionsService.setUserDecryptionOptionsById(n,r),yield this.kdfConfigService.setKdfConfig(n,t),yield this.masterPasswordService.setMasterKey(e,n),yield this.masterPasswordService.setMasterKeyEncryptedUserKey(i[1],n),yield this.keyService.setUserKey(i[0],n)})}updateLegacyState(e,t,i,n,r){return Pae(this,void 0,void 0,function*(){const s=yield(0,bo._)(this.userDecryptionOptionsService.userDecryptionOptionsById$(n));s.hasMasterPassword=!0,yield this.userDecryptionOptionsService.setUserDecryptionOptionsById(n,s),yield this.kdfConfigService.setKdfConfig(n,t),yield this.masterPasswordService.setMasterKeyEncryptedUserKey(i,n),yield this.masterPasswordService.setLegacyMasterKeyFromUnlockData(e,r,n)})}setMasterPasswordUnlockData(e,t,i,n,r){return Pae(this,void 0,void 0,function*(){const s=yield this.masterPasswordService.makeMasterPasswordUnlockData(e,i,t,n);yield this.masterPasswordService.setMasterPasswordUnlockData(s,r)})}handleResetPasswordAutoEnrollOld(e,t,i){return Pae(this,void 0,void 0,function*(){const n=yield this.organizationApiService.getKeys(t);if(null==n)throw new Error("Organization keys response is null. Could not handle reset password auto enroll.");const r=bd.fromB64ToArray(n.publicKey),s=yield(0,bo._)(this.keyService.userKey$(i));if(null==s)throw new Error("userKey not found. Could not handle reset password auto enroll.");const o=yield this.encryptService.encapsulateKeyUnsigned(s,r);if(null==o||!o.encryptedString)throw new Error("orgPublicKeyEncryptedUserKey not found. Could not handle reset password auto enroll.");const a=new ZR;a.masterPasswordHash=e,a.resetPasswordKey=o.encryptedString,yield this.organizationUserApiService.putOrganizationUserResetPasswordEnrollment(t,i,a)})}handleResetPasswordAutoEnroll(e,t,i,n){return Pae(this,void 0,void 0,function*(){const r=yield this.organizationApiService.getKeys(t);if(null==r)throw new Error("Organization keys response is null. Could not handle reset password auto enroll.");const s=bd.fromB64ToArray(r.publicKey),o=yield this.encryptService.encapsulateKeyUnsigned(n,s);if(null==o||!o.encryptedString)throw new Error("orgPublicKeyEncryptedUserKey not found. Could not handle reset password auto enroll.");const a=new ZR;a.masterPasswordHash=e,a.resetPasswordKey=o.encryptedString,yield this.organizationUserApiService.putOrganizationUserResetPasswordEnrollment(t,i,a)})}},deps:[eI,$G,Ul,_v,Bp,lte,Yb,nI,MR,Ow,oI,Kk]},{provide:Bk,useClass:Bk,deps:[Kb]},{provide:Ck,useClass:Iae,deps:[]},{provide:bC,useClass:class{constructor(e,t){this.keyService=e,this.accountApiService=t}getOrgNameFromOrgInvite(){return null}getMasterPasswordPolicyOptsFromOrgInvite(){return null}finishRegistration(e,t,i,n,r,s,o,a){return OC(this,void 0,void 0,function*(){const[l,c]=yield this.keyService.makeUserKey(t.newMasterKey);if(!l||!c)throw new Error("User key could not be created");const u=yield this.keyService.makeKeyPair(l),d=yield this.buildRegisterRequest(e,t,c.encryptedString,u,i,n,r,s,o,a);return yield this.accountApiService.registerFinish(d)})}buildRegisterRequest(e,t,i,n,r,s,o,a,l,c){return OC(this,void 0,void 0,function*(){const s=new _k(n[0],n[1].encryptedString),o=new EC(e,t.newServerMasterKeyHash,t.newPasswordHint,i,s,t.kdfConfig.kdfType,t.kdfConfig.iterations);return r&&(o.emailVerificationToken=r),o})}},deps:[Bp,cC]},{provide:FT,useClass:RT,deps:[]},{provide:FP,useClass:SF,deps:[]},{provide:QT,useClass:class{constructor(e){this.apiService=e}getTwoFactorProviders(){return pP(this,void 0,void 0,function*(){const e=yield this.apiService.send("GET","/two-factor",null,!0,!0);return new sk(e,aP)})}getTwoFactorOrganizationProviders(e){return pP(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET",`/organizations/${e}/two-factor`,null,!0,!0);return new sk(t,aP)})}getTwoFactorAuthenticator(e){return pP(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/two-factor/get-authenticator",e,!0,!0);return new rP(t)})}putTwoFactorAuthenticator(e){return pP(this,void 0,void 0,function*(){const t=yield this.apiService.send("PUT","/two-factor/authenticator",e,!0,!0);return new rP(t)})}deleteTwoFactorAuthenticator(e){return pP(this,void 0,void 0,function*(){const t=yield this.apiService.send("DELETE","/two-factor/authenticator",e,!0,!0);return new aP(t)})}getTwoFactorEmail(e){return pP(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/two-factor/get-email",e,!0,!0);return new oP(t)})}postTwoFactorEmailSetup(e){return pP(this,void 0,void 0,function*(){return this.apiService.send("POST","/two-factor/send-email",e,!0,!1)})}postTwoFactorEmail(e){return pP(this,void 0,void 0,function*(){return this.apiService.send("POST","/two-factor/send-email-login",e,!1,!1)})}putTwoFactorEmail(e){return pP(this,void 0,void 0,function*(){const t=yield this.apiService.send("PUT","/two-factor/email",e,!0,!0);return new oP(t)})}getTwoFactorDuo(e){return pP(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/two-factor/get-duo",e,!0,!0);return new sP(t)})}getTwoFactorOrganizationDuo(e,t){return pP(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST",`/organizations/${e}/two-factor/get-duo`,t,!0,!0);return new sP(i)})}putTwoFactorDuo(e){return pP(this,void 0,void 0,function*(){const t=yield this.apiService.send("PUT","/two-factor/duo",e,!0,!0);return new sP(t)})}putTwoFactorOrganizationDuo(e,t){return pP(this,void 0,void 0,function*(){const i=yield this.apiService.send("PUT",`/organizations/${e}/two-factor/duo`,t,!0,!0);return new sP(i)})}getTwoFactorYubiKey(e){return pP(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/two-factor/get-yubikey",e,!0,!0);return new hP(t)})}putTwoFactorYubiKey(e){return pP(this,void 0,void 0,function*(){const t=yield this.apiService.send("PUT","/two-factor/yubikey",e,!0,!0);return new hP(t)})}getTwoFactorWebAuthn(e){return pP(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/two-factor/get-webauthn",e,!0,!0);return new cP(t)})}getTwoFactorWebAuthnChallenge(e){return pP(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/two-factor/get-webauthn-challenge",e,!0,!0);return new dP(t)})}putTwoFactorWebAuthn(e){return pP(this,void 0,void 0,function*(){const t=e.deviceResponse.response,i=Object.assign({},e);i.deviceResponse={id:e.deviceResponse.id,rawId:btoa(e.deviceResponse.id),type:e.deviceResponse.type,extensions:e.deviceResponse.getClientExtensionResults(),response:{AttestationObject:bd.fromBufferToB64(t.attestationObject),clientDataJson:bd.fromBufferToB64(t.clientDataJSON)}};const n=yield this.apiService.send("PUT","/two-factor/webauthn",i,!0,!0);return new cP(n)})}deleteTwoFactorWebAuthn(e){return pP(this,void 0,void 0,function*(){const t=yield this.apiService.send("DELETE","/two-factor/webauthn",e,!0,!0);return new cP(t)})}getTwoFactorRecover(e){return pP(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/two-factor/get-recover",e,!0,!0);return new lP(t)})}putTwoFactorDisable(e){return pP(this,void 0,void 0,function*(){const t=yield this.apiService.send("PUT","/two-factor/disable",e,!0,!0);return new aP(t)})}putTwoFactorOrganizationDisable(e,t){return pP(this,void 0,void 0,function*(){const i=yield this.apiService.send("PUT",`/organizations/${e}/two-factor/disable`,t,!0,!0);return new aP(i)})}},deps:[eI]},{provide:II,useExisting:Bae,deps:[]},{provide:Rk,useClass:zk,deps:[FI,mk,gf,Hb,xk]},{provide:Kk,useClass:class{constructor(e,t,i,n,r,s,o,a=null){this.sdkClientFactory=e,this.environmentService=t,this.platformUtilsService=i,this.accountService=n,this.apiService=r,this.stateProvider=s,this.configService=o,this.userAgent=a,this.sdkClientOverrides=new Dd.t({}),this.sdkClientCache=new Map,this.client$=this.environmentService.environment$.pipe((0,To.H)(e=>Dse(this,void 0,void 0,function*(){yield om.Ready;const t=yield this.toSettings(e),i=yield this.sdkClientFactory.createSdkClient(new $se(this.apiService),t);return yield this.loadFeatureFlags(i),i})),(0,Gp.t)({refCount:!0,bufferSize:1}))}registerClient$(e){return this.sdkClientOverrides.pipe((0,oa.v)(t=>t[e]!==Ese,!1),(0,l.T)(t=>{if(t[e]===Ese)throw new Error("Encountered UnsetClient even though it should have been filtered out");return t[e]}),(0,mo.F)(),(0,go.n)(t=>t?(0,Go.of)(t):this.internalClient$(e)),(0,oa.v)(e=>void 0!==e,!1),(0,mse.v)(()=>new Xk(e)))}internalClient$(e){const t=this.sdkClientCache.get(e);if(void 0!==t)return t;const i=this.accountService.accounts$.pipe((0,l.T)(t=>t[e]),(0,mo.F)()),n=(0,jo.z)([this.environmentService.getEnvironment$(e),i,om.Ready]).pipe((0,go.n)(([t,i])=>new aa.c(n=>{let r;return(()=>Dse(this,void 0,void 0,function*(){if(null==t||null==i)return;const n=yield this.toSettings(t),r=yield this.sdkClientFactory.createSdkClient(new $se(this.apiService,e),n);return yield Pse(e,r.platform().state(),this.stateProvider),yield this.loadFeatureFlags(r),r}))().then(e=>{r=void 0===e?void 0:new gse(e),n.next(r)}).catch(e=>{n.error(e)}),()=>null==r?void 0:r.markForDisposal()})),(0,Oo.M)({finalize:()=>this.sdkClientCache.delete(e)}),(0,Gp.t)({refCount:!0,bufferSize:1}));return this.sdkClientCache.set(e,n),n}loadFeatureFlags(e){return Dse(this,void 0,void 0,function*(){var t;const i=yield(0,bo._)(this.configService.serverConfig$),n=new Map(Object.entries(null!==(t=null==i?void 0:i.featureStates)&&void 0!==t?t:{}).filter(([,e])=>"boolean"==typeof e).map(([e,t])=>[e,t]));e.platform().load_flags(n)})}toSettings(e){return Dse(this,void 0,void 0,function*(){var t;return{apiUrl:e.getApiUrl(),identityUrl:e.getIdentityUrl(),deviceType:Wk(this.platformUtilsService.getDevice()),userAgent:null!==(t=this.userAgent)&&void 0!==t?t:navigator.userAgent,bitwardenClientVersion:yield this.platformUtilsService.getApplicationVersionNumber()}})}},deps:[Sre,mk,Hb,Zk,eI,u,Kb]},{provide:Jk,useClass:class{constructor(e,t,i,n,r,s,o,a,c,u,d=null){this.sdkClientFactory=e,this.environmentService=t,this.platformUtilsService=i,this.accountService=n,this.kdfConfigService=r,this.keyService=s,this.securityStateService=o,this.apiService=a,this.stateProvider=c,this.configService=u,this.userAgent=d,this.sdkClientOverrides=new Dd.t({}),this.sdkClientCache=new Map,this.client$=this.environmentService.environment$.pipe((0,To.H)(e=>Rse(this,void 0,void 0,function*(){yield om.Ready;const t=yield this.toSettings(e),i=yield this.sdkClientFactory.createSdkClient(new Ase(this.apiService),t);return yield this.loadFeatureFlags(i),i})),(0,Gp.t)({refCount:!0,bufferSize:1})),this.version$=this.client$.pipe((0,l.T)(e=>e.version()),(0,Ed.W)(()=>"Unsupported"))}userClient$(e){return this.sdkClientOverrides.pipe((0,oa.v)(t=>t[e]!==xse,!1),(0,l.T)(t=>{if(t[e]===xse)throw new Error("Encountered UnsetClient even though it should have been filtered out");return t[e]}),(0,mo.F)(),(0,go.n)(t=>t?(0,Go.of)(t):this.internalClient$(e)),(0,oa.v)(e=>void 0!==e,!1),(0,mse.v)(()=>new Xk(e)))}setClient(e,t){const i=this.sdkClientOverrides.value[e];this.sdkClientOverrides.next(Object.assign(Object.assign({},this.sdkClientOverrides.value),{[e]:t?new gse(t):xse})),i!==xse&&void 0!==i&&i.markForDisposal()}internalClient$(e){const t=this.sdkClientCache.get(e);if(void 0!==t)return t;const i=this.accountService.accounts$.pipe((0,l.T)(t=>t[e]),(0,mo.F)()),n=this.kdfConfigService.getKdfConfig$(e).pipe((0,mo.F)()),r=this.keyService.userEncryptedPrivateKey$(e).pipe((0,mo.F)()),s=this.keyService.userSigningKey$(e).pipe((0,mo.F)()),o=this.keyService.userKey$(e).pipe((0,mo.F)()),a=this.keyService.encryptedOrgKeys$(e).pipe((0,mo.F)(P1)),c=this.securityStateService.accountSecurityState$(e).pipe((0,mo.F)(P1)),u=this.keyService.userSignedPublicKey$(e).pipe((0,mo.F)(P1)),d=(0,jo.z)([this.environmentService.getEnvironment$(e),i,n,r,o,s,a,c,u,om.Ready]).pipe((0,go.n)(([t,i,n,r,s,o,a,l,c])=>new aa.c(u=>{let d;return(()=>Rse(this,void 0,void 0,function*(){if(null==t||null==n||null==r||null==s)return;const u=yield this.toSettings(t),d=yield this.sdkClientFactory.createSdkClient(new Ase(this.apiService,e),u);let h;return h=null!=o&&null!=l&&null!=c?{V2:{private_key:r,signing_key:o,security_state:l,signed_public_key:c}}:{V1:{private_key:r}},yield this.initializeClient(e,d,i,n,s,h,a),d}))().then(e=>{d=void 0===e?void 0:new gse(e),u.next(d)}).catch(e=>{u.error(e)}),()=>null==d?void 0:d.markForDisposal()})),(0,Oo.M)({finalize:()=>this.sdkClientCache.delete(e)}),(0,Fo.u)({connector:()=>new Ro.m(1),resetOnRefCountZero:()=>(0,xo.O)(1e3)}));return this.sdkClientCache.set(e,d),d}initializeClient(e,t,i,n,r,s,o){return Rse(this,void 0,void 0,function*(){yield t.crypto().initialize_user_crypto({userId:Yk(e),email:i.email,method:{decryptedKey:{decrypted_user_key:r.keyB64}},kdfParams:n.kdfType===Mv.PBKDF2_SHA256?{pBKDF2:{iterations:n.iterations}}:{argon2id:{iterations:n.iterations,memory:n.memory,parallelism:n.parallelism}},accountCryptographicState:s}),yield t.crypto().initialize_org_crypto({organizationKeys:new Map(Object.entries(o).map(([e,t])=>[Yk(e),t.toJSON()]))}),yield Pse(e,t.platform().state(),this.stateProvider),yield this.loadFeatureFlags(t)})}loadFeatureFlags(e){return Rse(this,void 0,void 0,function*(){var t;const i=yield(0,bo._)(this.configService.serverConfig$),n=new Map(Object.entries(null!==(t=null==i?void 0:i.featureStates)&&void 0!==t?t:{}).filter(([,e])=>"boolean"==typeof e).map(([e,t])=>[e,t]));e.platform().load_flags(n)})}toSettings(e){return Rse(this,void 0,void 0,function*(){var t;return{apiUrl:e.getApiUrl(),identityUrl:e.getIdentityUrl(),deviceType:Wk(this.platformUtilsService.getDevice()),bitwardenClientVersion:yield this.platformUtilsService.getApplicationVersionNumber(),userAgent:null!==(t=this.userAgent)&&void 0!==t?t:navigator.userAgent}})}},deps:[Sre,mk,Hb,Zk,_v,Bp,sI,eI,u,Kb]},{provide:L$,useClass:class{constructor(e,t,i){this.collectionService=e,this.organizationService=t,this.accountService=i,this.organization$=e=>this.accountService.activeAccount$.pipe(iv,(0,go.n)(e=>this.organizationService.organizations$(e)),(0,l.T)(t=>t.find(t=>t.id===e.organizationId)))}canDeleteCipher$(e,t){return this.organization$(e).pipe((0,l.T)(i=>{var n;if(t){if(!e.collectionIds||0===e.collectionIds.length)return!0===(null==i?void 0:i.canEditUnassignedCiphers);if(null==i?void 0:i.canEditAllCiphers)return!0}return!!(null===(n=e.permissions)||void 0===n?void 0:n.delete)}))}canRestoreCipher$(e,t){return this.organization$(e).pipe((0,l.T)(i=>{var n;if(t){if(!e.collectionIds||0===e.collectionIds.length)return!0===(null==i?void 0:i.canEditUnassignedCiphers);if(null==i?void 0:i.canEditAllCiphers)return!0}return!!(null===(n=e.permissions)||void 0===n?void 0:n.restore)}))}canEditCipher$(e,t=!1){return this.organization$(e).pipe((0,l.T)(i=>{if(t){if(!e.collectionIds||0===e.collectionIds.length)return!0===(null==i?void 0:i.canEditUnassignedCiphers);if(null==i?void 0:i.canEditAllCiphers)return!0}return!!e.edit}))}canCloneCipher$(e,t){return null==e.organizationId?(0,Go.of)(!0):(0,jo.z)([this.organization$(e),this.accountService.activeAccount$.pipe(iv)]).pipe((0,go.n)(([i,n])=>{var r;return t&&i&&(i.isAdmin||(null===(r=i.permissions)||void 0===r?void 0:r.editAnyCollection))?(0,Go.of)(!0):this.collectionService.decryptedCollections$(n).pipe(sR(e.collectionIds.map(Hk)),(0,l.T)(e=>e.some(e=>e.manage)))}),(0,Gp.t)({bufferSize:1,refCount:!1}))}},deps:[uR,WF,Zk]},{provide:mre,useClass:class{constructor(e){this.cryptoFunctionService=e}hashPassword(e,t){return yre(this,void 0,void 0,function*(){if(!e||!t)throw new Error("Password and key material are required.");return yield this.cryptoFunctionService.pbkdf2(e,t,"sha256",gre)})}},deps:[FI]},{provide:iI,useClass:class{constructor(e){this.messagingService=e}handleCreateUserSuccess(){return null}logOut(){return SI(this,void 0,void 0,function*(){this.messagingService.send("logout")})}},deps:[bk]},{provide:Qv,useClass:class{constructor(e){this.apiService=e}regenerateUserAsymmetricKeys(e,t){return ef(this,void 0,void 0,function*(){const i={userPublicKey:e,userKeyEncryptedUserPrivateKey:t};yield this.apiService.send("POST","/accounts/key-management/regenerate-keys",i,!0,!0)})}},deps:[eI]},{provide:qv,useClass:class{constructor(e,t,i,n,r,s,o,a){this.keyService=e,this.cipherService=t,this.userAsymmetricKeysRegenerationApiService=i,this.logService=n,this.sdkService=r,this.apiService=s,this.configService=o,this.accountCryptographyStateService=a}regenerateIfNeeded(e){return Zv(this,void 0,void 0,function*(){try{if(yield this.configService.getFeatureFlag(Wv.PrivateKeyRegeneration)){(yield this.shouldRegenerate(e))&&(yield this.regenerateUserPublicKeyEncryptionKeyPair(e))}}catch(e){this.logService.error("[UserAsymmetricKeyRegeneration] An error occurred: "+e+" Skipping regeneration for the user.")}})}shouldRegenerate(e){return Zv(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.keyService.userKey$(e));if(!t)return this.logService.info("[UserAsymmetricKeyRegeneration] User symmetric key unavailable, skipping regeneration for the user."),!1;if(t.inner().type===hp.CoseEncrypt0)return this.logService.error("[UserAsymmetricKeyRegeneration] Cannot regenerate asymmetric keys for accounts on V2 encryption."),!1;const[i,n]=yield(0,bo._)((0,jo.z)([this.keyService.userEncryptedPrivateKey$(e),this.apiService.getUserPublicKey(e)]));if(!i||!n)return this.logService.warning("[UserAsymmetricKeyRegeneration] User's asymmetric key initialization data is unavailable, skipping regeneration."),!1;const r=yield(0,bo._)(this.sdkService.client$.pipe((0,l.T)(e=>{if(void 0===e)throw new Error("SDK is undefined");return e.crypto().verify_asymmetric_keys({userKey:t.keyB64,userPublicKey:n.publicKey,userKeyEncryptedPrivateKey:i})})));if(r.privateKeyDecryptable)return!r.validPrivateKey&&(this.logService.info("[UserAsymmetricKeyRegeneration] User's private key is decryptable but not a valid key, attempting regeneration."),!0);return(yield this.userKeyCanDecrypt(t,e))?(this.logService.info("[UserAsymmetricKeyRegeneration] User Asymmetric Key decryption failure detected, attempting regeneration."),!0):(this.logService.warning("[UserAsymmetricKeyRegeneration] User Asymmetric Key decryption failure detected, but unable to determine User Symmetric Key validity, skipping regeneration."),!1)})}regenerateUserPublicKeyEncryptionKeyPair(e){return Zv(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.keyService.userKey$(e));if(null==t)throw new Error("User key not found");if(t.inner().type!==hp.AesCbc256_HmacSha256_B64)throw new Error("User key is not V1 encryption type");const i=yield(0,bo._)(this.sdkService.client$.pipe((0,l.T)(e=>{if(void 0===e)throw new Error("SDK is undefined");return e.crypto().make_key_pair(t.keyB64)})));try{yield this.userAsymmetricKeysRegenerationApiService.regenerateUserAsymmetricKeys(i.userPublicKey,new Pp(i.userKeyEncryptedPrivateKey))}catch(e){return"Key regeneration not supported for this user."===(null==e?void 0:e.message)?(this.logService.info("[UserAsymmetricKeyRegeneration] Regeneration not supported for this user at this time."),!1):(this.logService.error("[UserAsymmetricKeyRegeneration] Regeneration error when submitting the request to the server: "+e),!1)}return yield this.accountCryptographyStateService.setAccountCryptographicState({V1:{private_key:i.userKeyEncryptedPrivateKey}},e),this.logService.info("[UserAsymmetricKeyRegeneration] User's asymmetric keys successfully regenerated."),!0})}userKeyCanDecrypt(e,t){return Zv(this,void 0,void 0,function*(){const i=(yield this.cipherService.getAll(t)).find(e=>null==e.organizationId);if(!i)return!1;try{return!(yield i.decrypt(e)).decryptionFailure||(this.logService.error("[UserAsymmetricKeyRegeneration] User Symmetric Key validation error: Cipher decryption failed"),!1)}catch(e){return this.logService.error("[UserAsymmetricKeyRegeneration] User Symmetric Key validation error: "+e),!1}})}},deps:[Bp,_b,Qv,Za,Jk,eI,Kb,oI]},{provide:Mw,useClass:class{constructor(e,t,i,n,r,s,o){this.configService=e,this.loginEmailService=t,this.ssoLoginService=i,this.syncService=n,this.userAsymmetricKeysRegenerationService=r,this.encryptedMigrator=s,this.logService=o}run(e,t){return uk(this,void 0,void 0,function*(){yield this.syncService.fullSync(!0,{skipTokenRefresh:!0}),yield this.userAsymmetricKeysRegenerationService.regenerateIfNeeded(e),yield this.loginEmailService.clearLoginEmail();try{yield this.encryptedMigrator.runMigrations(e,t)}catch(e){}const i=yield this.ssoLoginService.getSsoEmail();i?(yield this.ssoLoginService.updateSsoRequiredCache(i,e),yield this.ssoLoginService.clearSsoEmail()):this.logService.debug("SSO login email not found.")})}},deps:[Kb,Qw,xk,qx,qv,EA,Za]},{provide:d$,useClass:class{constructor(e,t,i,n,r,s){this.stateProvider=e,this.apiService=t,this.organizationService=i,this.authService=n,this.notificationService=r,this.messageListener=s,this.tasksEnabled$=h$(e=>this.organizationService.organizations$(e).pipe((0,l.T)(e=>e.some(e=>e.canUseAccessIntelligence)),(0,mo.F)())),this.tasks$=h$(e=>this.tasksEnabled$(e).pipe((0,go.n)(t=>t?this.taskState(e).state$.pipe((0,go.n)(t=>f$(this,void 0,void 0,function*(){return null==t?(yield this.fetchTasksFromApi(e),null):t})),p$(),(0,l.T)(e=>e.map(e=>new l$(e)))):(0,Go.of)([])))),this.pendingTasks$=h$(e=>this.tasks$(e).pipe((0,l.T)(e=>e.filter(e=>e.status===s$)))),this.completedTasks$=h$(e=>this.tasks$(e).pipe((0,l.T)(e=>e.filter(e=>e.status===o$)))),this.getOnlyTaskEnabledUsers=(0,go.n)(e=>0===e.length?(0,Go.of)([]):(0,jo.z)(e.map(e=>this.tasksEnabled$(e).pipe((0,l.T)(t=>t?e:null)))).pipe((0,l.T)(e=>e.filter(e=>null!==e))))}refreshTasks(e){return f$(this,void 0,void 0,function*(){yield this.fetchTasksFromApi(e)})}clear(e){return f$(this,void 0,void 0,function*(){yield this.updateTaskState(e,[])})}markAsComplete(e,t){return f$(this,void 0,void 0,function*(){yield this.apiService.send("PATCH",`/tasks/${e}/complete`,null,!0,!1),yield this.refreshTasks(t)})}fetchTasksFromApi(e){return f$(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/tasks",null,!0,!0),i=new sk(t,u$).data.map(e=>new c$(e));yield this.updateTaskState(e,i)})}taskState(e){return this.stateProvider.getUser(e,v$)}updateTaskState(e,t){return this.taskState(e).update(()=>t)}securityTaskNotifications$(e){return this.notificationService.notifications$.pipe((0,Eo.p)(([t,i])=>t.type===Ba.RefreshSecurityTasks&&e.includes(i)),(0,l.T)(([,e])=>e))}syncCompletedMessage$(e){return this.messageListener.allMessages$.pipe((0,Eo.p)(e=>"syncCompleted"===e.command&&!!e.successfully&&!!e.userId),(0,l.T)(e=>e.userId),(0,Eo.p)(t=>e.includes(t)))}listenForTaskNotifications(){return this.authService.authStatuses$.pipe(m$,this.getOnlyTaskEnabledUsers,(0,Eo.p)(e=>e.length>0),(0,go.n)(e=>(0,Po.h)(this.securityTaskNotifications$(e),this.syncCompletedMessage$(e))),(0,go.n)(e=>this.refreshTasks(e))).subscribe()}},deps:[u,eI,WF,Rd,Rre,gk]},{provide:class{},useClass:class{constructor(e,t,i){this.globalStateProvider=e,this.sdkService=t,this.sendPasswordService=i,this.initializeState()}initializeState(){this.sendAccessTokenDictGlobalState=this.globalStateProvider.get(pte)}tryGetSendAccessToken$(e){return(0,$o.v)(()=>(0,$d.H)(this._tryGetSendAccessToken(e)))}_tryGetSendAccessToken(e){return vte(this,void 0,void 0,function*(){this.validateSendId(e);const t=yield this.getSendAccessTokenFromStorage(e);if(null!=t)return t.isExpired()?(yield this.clearSendAccessTokenFromStorage(e),{kind:"expired"}):t;const i={sendId:e},n=yield(0,bo._)(this.sdkService.client$);try{const t=yield n.auth().send_access().request_send_access_token(i),r=hte.fromSendAccessTokenResponse(t);return yield this.setSendAccessTokenInStorage(e,r),r}catch(e){return this.normalizeSendAccessTokenError(e)}})}getSendAccessToken$(e,t){return(0,$o.v)(()=>(0,$d.H)(this._getSendAccessToken(e,t)))}_getSendAccessToken(e,t){return vte(this,void 0,void 0,function*(){this.validateCredentialsRequest(e,t);const i={sendId:e,sendAccessCredentials:this.convertDomainCredentialsToSdkCredentials(t)},n=yield(0,bo._)(this.sdkService.client$);try{const t=yield n.auth().send_access().request_send_access_token(i),r=hte.fromSendAccessTokenResponse(t);return yield this.setSendAccessTokenInStorage(e,r),r}catch(e){return this.normalizeSendAccessTokenError(e)}})}invalidateSendAccessToken(e){return vte(this,void 0,void 0,function*(){yield this.clearSendAccessTokenFromStorage(e)})}hashSendPassword(e,t){return vte(this,void 0,void 0,function*(){if(null==e||""===e.trim())throw new Error("Password must be provided.");if(null==t||""===t.trim())throw new Error("KeyMaterialUrlB64 must be provided.");const i=bd.fromUrlB64ToArray(t),n=yield this.sendPasswordService.hashPassword(e,i);return bd.fromBufferToB64(n)})}getSendAccessTokenFromStorage(e){return vte(this,void 0,void 0,function*(){if(null!=this.sendAccessTokenDictGlobalState){const t=yield(0,bo._)(this.sendAccessTokenDictGlobalState.state$);return null==t?void 0:t[e]}})}setSendAccessTokenInStorage(e,t){return vte(this,void 0,void 0,function*(){null!=this.sendAccessTokenDictGlobalState&&(yield this.sendAccessTokenDictGlobalState.update(i=>(null!=i||(i={}),i[e]=t,i),{shouldUpdate:i=>{const n=null==i?void 0:i[e];return(null==n?void 0:n.token)!==t.token||(null==n?void 0:n.expiresAt)!==t.expiresAt}}))})}clearSendAccessTokenFromStorage(e){return vte(this,void 0,void 0,function*(){null!=this.sendAccessTokenDictGlobalState&&(yield this.sendAccessTokenDictGlobalState.update(t=>{if(!t)return t;if(null==t[e])return t;const i=t,n=e;i[n];return fte(i,["symbol"==typeof n?n:n+""])},{shouldUpdate:t=>null!=(null==t?void 0:t[e])}))})}normalizeSendAccessTokenError(e){if(this.isSendAccessTokenError(e))return"unexpected"===e.kind?{kind:"unexpected_server",error:e.data}:{kind:"expected_server",error:e.data};if(e instanceof Error)return{kind:"unknown",error:e.message};try{return{kind:"unknown",error:JSON.stringify(e)}}catch(e){return{kind:"unknown",error:"error cannot be stringified"}}}isSendAccessTokenError(e){return"object"==typeof e&&null!==e&&"kind"in e&&("expected"===e.kind||"unexpected"===e.kind)}validateSendId(e){if(null==e||""===e.trim())throw new Error("sendId must be provided.")}validateCredentialsRequest(e,t){if(this.validateSendId(e),null==t)throw new Error("sendAccessCredentials must be provided.");if("password"===t.kind&&!t.passwordHashB64)throw new Error("passwordHashB64 must be provided for password credentials.");if("email"===t.kind&&!t.email)throw new Error("email must be provided for email credentials.");if(!("email_otp"!==t.kind||t.email&&t.otp))throw new Error("email and otp must be provided for email_otp credentials.")}convertDomainCredentialsToSdkCredentials(e){switch(e.kind){case"password":return{passwordHashB64:e.passwordHashB64};case"email":return{email:e.email};case"email_otp":return{email:e.email,otp:e.otp}}}},deps:[d,Jk,mre]},{provide:_3,useClass:class{constructor(e,t,i,n,r){this.stateProvider=e,this.apiService=t,this.notificationService=i,this.authService=n,this.logService=r,this.notifications$=h$(e=>this.notificationState(e).state$.pipe((0,go.n)(t=>Y3(this,void 0,void 0,function*(){return null==t?(yield this.fetchNotificationsFromApi(e),null):t})),p$(),(0,l.T)(e=>e.map(e=>new K3(e))))),this.unreadNotifications$=h$(e=>this.notifications$(e).pipe((0,l.T)(e=>e.filter(e=>null==e.readDate))))}markAsRead(e,t){return Y3(this,void 0,void 0,function*(){yield this.apiService.send("PATCH",`/notifications/${e}/read`,null,!0,!1),yield this.notificationState(t).update(t=>{const i=null==t?void 0:t.find(t=>t.id===e);return i&&(i.readDate=new Date),t})})}markAsDeleted(e,t){return Y3(this,void 0,void 0,function*(){yield this.apiService.send("DELETE",`/notifications/${e}/delete`,null,!0,!1),yield this.notificationState(t).update(t=>{const i=null==t?void 0:t.find(t=>t.id===e);return i&&(i.deletedDate=new Date),t})})}clearState(e){return Y3(this,void 0,void 0,function*(){yield this.replaceNotificationState(e,[])})}refreshNotifications(e){return Y3(this,void 0,void 0,function*(){yield this.fetchNotificationsFromApi(e)})}filteredEndUserNotifications$(e){return 0==e.length?Wp.w:this.notificationService.notifications$.pipe((0,Eo.p)(([{type:t},i])=>(t===Ba.Notification||t===Ba.NotificationStatus)&&e.includes(i)))}listenForEndUserNotifications(){return this.authService.authStatuses$.pipe(H3,(0,go.n)(e=>this.filteredEndUserNotifications$(e)),(0,To.H)(([e,t])=>this.upsertNotification(t,new X3(e.payload)))).subscribe()}fetchNotificationsFromApi(e){return Y3(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/notifications?pageSize=50",null,!0,!0),i=new sk(t,q3);null!=i.continuationToken&&this.logService.warning("More notifications available, but not fetched. Consider increasing the page size from 50");const n=i.data.map(e=>new X3(e));yield this.replaceNotificationState(e,n)})}replaceNotificationState(e,t){return this.notificationState(e).update(()=>t)}upsertNotification(e,t){return Y3(this,void 0,void 0,function*(){return this.notificationState(e).update(e=>{null!=e||(e=[]);const i=e.findIndex(e=>e.id===t.id);return-1===i?e.push(t):e[i]=t,e})})}notificationState(e){return this.stateProvider.getUser(e,W3)}},deps:[u,eI,Rre,Rd,Za]},{provide:nee,useClass:class{constructor(e,t,i,n){this.authRequestService=e,this.deviceTrustService=t,this.i18nService=i,this.toastService=n,this.adminLoginApproved$=this.authRequestService.adminLoginApproved$.pipe((0,Oo.M)(()=>{this.toastService.showToast({variant:"success",title:"",message:this.i18nService.t("loginApproved")})})),this.deviceTrusted$=this.deviceTrustService.deviceTrusted$.pipe((0,Oo.M)(()=>{this.toastService.showToast({variant:"success",title:"",message:this.i18nService.t("deviceTrusted")})})),this.setupListeners$=(0,Po.h)(this.adminLoginApproved$,this.deviceTrusted$)}},deps:[Uw,tI,Ul,qb]},{provide:lte,useClass:class{constructor(e,t){this.apiService=e,this.logService=t}setPassword(e){return Yte(this,void 0,void 0,function*(){try{return yield this.apiService.send("POST","/accounts/set-password",e,!0,!1)}catch(e){throw this.logService.error(e),e}})}postPassword(e){return Yte(this,void 0,void 0,function*(){try{return yield this.apiService.send("POST","/accounts/password",e,!0,!1)}catch(e){throw this.logService.error(e),e}})}putUpdateTempPassword(e){return Yte(this,void 0,void 0,function*(){try{return yield this.apiService.send("PUT","/accounts/update-temp-password",e,!0,!1)}catch(e){throw this.logService.error(e),e}})}putUpdateTdeOffboardingPassword(e){return Yte(this,void 0,void 0,function*(){try{return yield this.apiService.send("PUT","/accounts/update-tde-offboarding-password",e,!0,!1)}catch(e){throw this.logService.error(e),e}})}},deps:[eI,Za]},{provide:Nw,useClass:vk,deps:[bk]},{provide:ree,useClass:ree,deps:[DT,Ul]},{provide:Uoe,useClass:class{constructor(e,t){this.sdkService=e,this.logService=t}encrypt(e,t){return oae(this,void 0,void 0,function*(){return(0,bo._)(this.sdkService.userClient$(t).pipe((0,l.T)(t=>{const i={stack:[],error:void 0,hasError:!1};try{if(!t)throw new Error("SDK not available");const n=aae(i,t.take(),!1),r=this.toSdkCipherView(e,n.value),s=n.value.vault().ciphers().encrypt(r);return{cipher:AN.fromSdkCipher(s.cipher),encryptedFor:s.encryptedFor}}catch(e){i.error=e,i.hasError=!0}finally{lae(i)}}),(0,Ed.W)(e=>(this.logService.error(`Failed to encrypt cipher: ${e}`),Wp.w))))})}encryptMany(e,t){return oae(this,void 0,void 0,function*(){return e&&0!==e.length?(0,bo._)(this.sdkService.userClient$(t).pipe((0,l.T)(t=>{const i={stack:[],error:void 0,hasError:!1};try{if(!t)throw new Error("SDK not available");const n=aae(i,t.take(),!1);return n.value.vault().ciphers().encrypt_list(e.map(e=>this.toSdkCipherView(e,n.value))).map(e=>({cipher:AN.fromSdkCipher(e.cipher),encryptedFor:e.encryptedFor}))}catch(e){i.error=e,i.hasError=!0}finally{lae(i)}}),(0,Ed.W)(e=>(this.logService.error(`Failed to encrypt ciphers in batch: ${e}`),Wp.w)))):[]})}moveToOrganization(e,t,i){return oae(this,void 0,void 0,function*(){return(0,bo._)(this.sdkService.userClient$(i).pipe((0,l.T)(i=>{const n={stack:[],error:void 0,hasError:!1};try{if(!i)throw new Error("SDK not available");const r=aae(n,i.take(),!1),s=this.toSdkCipherView(e,r.value),o=r.value.vault().ciphers().move_to_organization(s,Yk(t)),a=r.value.vault().ciphers().encrypt(o);return{cipher:AN.fromSdkCipher(a.cipher),encryptedFor:a.encryptedFor}}catch(e){n.error=e,n.hasError=!0}finally{lae(n)}}),(0,Ed.W)(e=>(this.logService.error(`Failed to move cipher to organization: ${e}`),Wp.w))))})}encryptCipherForRotation(e,t,i){return oae(this,void 0,void 0,function*(){return(0,bo._)(this.sdkService.userClient$(t).pipe((0,l.T)(t=>{const n={stack:[],error:void 0,hasError:!1};try{if(!t)throw new Error("SDK not available");const r=aae(n,t.take(),!1),s=this.toSdkCipherView(e,r.value),o=r.value.vault().ciphers().encrypt_cipher_for_rotation(s,i.toBase64());return{cipher:AN.fromSdkCipher(o.cipher),encryptedFor:o.encryptedFor}}catch(e){n.error=e,n.hasError=!0}finally{lae(n)}}),(0,Ed.W)(e=>(this.logService.error(`Failed to rotate cipher data: ${e}`),Wp.w))))})}decrypt(e,t){return oae(this,void 0,void 0,function*(){return(0,bo._)(this.sdkService.userClient$(t).pipe((0,l.T)(t=>{var i,n;const r={stack:[],error:void 0,hasError:!1};try{if(!t)throw new Error("SDK not available");const s=aae(r,t.take(),!1),o=s.value.vault().ciphers().decrypt(e.toSdkCipher()),a=RO.fromSdkCipherView(o);if(a.type===nx.Login&&(null===(n=null===(i=o.login)||void 0===i?void 0:i.fido2Credentials)||void 0===n?void 0:n.length)){const e=s.value.vault().ciphers().decrypt_fido2_credentials(o),t=s.value.vault().ciphers().decrypt_fido2_private_key(o);a.login.fido2Credentials=e.map(e=>{const i=SO.fromSdkFido2CredentialView(e);return i.keyValue=t,i}).filter(e=>void 0!==e)}return a}catch(e){r.error=e,r.hasError=!0}finally{lae(r)}}),(0,Ed.W)(e=>(this.logService.error(`Failed to decrypt cipher ${e}`),Wp.w))))})}decryptManyLegacy(e,t){return(0,bo._)(this.sdkService.userClient$(t).pipe((0,l.T)(t=>{const i={stack:[],error:void 0,hasError:!1};try{if(!t)throw new Error("SDK not available");const n=aae(i,t.take(),!1),r=[],s=[];return e.forEach(e=>{var t,i;try{const s=n.value.vault().ciphers().decrypt(e.toSdkCipher()),o=RO.fromSdkCipherView(s);if(o.type===nx.Login&&(null===(i=null===(t=s.login)||void 0===t?void 0:t.fido2Credentials)||void 0===i?void 0:i.length)){const e=n.value.vault().ciphers().decrypt_fido2_credentials(s),t=n.value.vault().ciphers().decrypt_fido2_private_key(s);o.login.fido2Credentials=e.map(e=>{const i=SO.fromSdkFido2CredentialView(e);return i.keyValue=t,i}).filter(e=>void 0!==e)}r.push(o)}catch(t){this.logService.error(`Failed to decrypt cipher ${e.id}: ${t}`);const i=new RO(e);i.name="[error: cannot decrypt]",i.decryptionFailure=!0,s.push(i)}}),[r,s]}catch(e){i.error=e,i.hasError=!0}finally{lae(i)}}),(0,Ed.W)(e=>(this.logService.error(`Failed to decrypt ciphers: ${e}`),Wp.w))))}decryptManyWithFailures(e,t){return oae(this,void 0,void 0,function*(){return(0,bo._)(this.sdkService.userClient$(t).pipe((0,l.T)(t=>{const i={stack:[],error:void 0,hasError:!1};try{if(!t)throw new Error("SDK is undefined");const n=aae(i,t.take(),!1).value.vault().ciphers().decrypt_list_with_failures(e.map(e=>e.toSdkCipher())),r=n.successes;return[r,n.failures.map(e=>AN.fromSdkCipher(e)).filter(e=>void 0!==e)]}catch(e){i.error=e,i.hasError=!0}finally{lae(i)}})))})}decryptAttachmentContent(e,t,i,n){return oae(this,void 0,void 0,function*(){return(0,bo._)(this.sdkService.userClient$(n).pipe((0,l.T)(n=>{const r={stack:[],error:void 0,hasError:!1};try{if(!n)throw new Error("SDK is undefined");return aae(r,n.take(),!1).value.vault().attachments().decrypt_buffer(e.toSdkCipher(),t.toSdkAttachmentView(),i)}catch(e){r.error=e,r.hasError=!0}finally{lae(r)}}),(0,Ed.W)(e=>(this.logService.error(`Failed to decrypt cipher buffer: ${e}`),Wp.w))))})}toSdkCipherView(e,t){var i,n;let r=e.toSdkCipherView();if(e.type===nx.Login&&(null===(i=e.login)||void 0===i?void 0:i.hasFido2Credentials)){const i=null===(n=e.login.fido2Credentials)||void 0===n?void 0:n.map(e=>e.toSdkFido2CredentialFullView());r=t.vault().ciphers().set_fido2_credentials(r,i)}return r}},deps:[Jk,Za]},{provide:RH,useClass:BH,deps:[Bp,lte,Yb]},{provide:Mae,useClass:class{constructor(e,t,i,n,r,s,o,a,c,u){this.syncService=e,this.accountService=t,this.stateProvider=i,this.encryptedMigrator=n,this.authService=r,this.logService=s,this.dialogService=o,this.toastService=a,this.i18nService=c,this.router=u,this.isMigrating=!1,this.url$=this.router.events.pipe((0,Eo.p)(e=>e instanceof Fd.wF),(0,l.T)(e=>e.url)),this.accountService.accounts$.pipe((0,go.n)(e=>{const t=Object.keys(e);return 0===t.length?(0,Go.of)([]):(0,jo.z)(t.map(e=>(0,jo.z)([this.authService.authStatusFor$(e),this.syncService.lastSync$(e).pipe((0,Eo.p)(e=>null!=e)),this.url$]).pipe((0,Eo.p)(([e,t,i])=>e===Pd.Unlocked&&Uae.includes(i)),(0,To.H)(()=>this.runMigrationsIfNeeded(e)))))})).subscribe()}runMigrationsIfNeeded(e){return $ae(this,void 0,void 0,function*(){if((yield(0,bo._)(this.authService.authStatusFor$(e)))===Pd.Unlocked)if(this.isMigrating||this.encryptedMigrator.isRunningMigrations())this.logService.info(`[EncryptedMigrationsScheduler] Skipping migration check for user ${e} because migrations are already in progress`);else{switch(this.isMigrating=!0,yield this.encryptedMigrator.needsMigrations(e)){case"noMigrationNeeded":this.logService.info(`[EncryptedMigrationsScheduler] No migrations needed for user ${e}`);break;case"needsMigrationWithMasterPassword":this.logService.info(`[EncryptedMigrationsScheduler] User ${e} needs migrations with master password`),yield this.runMigrationsWithInteraction(e);break;case"needsMigration":this.logService.info(`[EncryptedMigrationsScheduler] User ${e} needs migrations with master password`),yield this.runMigrationsWithoutInteraction(e)}this.isMigrating=!1}})}runMigrationsWithoutInteraction(e){return $ae(this,void 0,void 0,function*(){try{yield this.encryptedMigrator.runMigrations(e,null)}catch(e){this.logService.error("[EncryptedMigrationsScheduler] Error during migration without interaction",e)}})}runMigrationsWithInteraction(e){return $ae(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.stateProvider.getUser(e,Oae).state$);if(null!=t){if(((new Date).getTime()-t.getTime())/36e5<24)return void this.logService.info("[EncryptedMigrationsScheduler] Migration prompt dismissed recently, skipping for now.")}try{const t=Eae.open(this.dialogService),i=yield(0,bo._)(t.closed);bd.isNullOrWhitespace(i)?yield this.stateProvider.setUserState(Oae,new Date,e):yield this.encryptedMigrator.runMigrations(e,void 0===i?null:i)}catch(e){this.logService.error("[EncryptedMigrationsScheduler] Error during migration prompt",e),this.toastService.showToast({variant:"error",message:this.i18nService.t("migrationsFailed")})}})}},deps:[qx,Zk,u,EA,Rd,Za,lh,qb,Ul,Fd.Ix]},{provide:Fl.hnV,useFactory:e=>()=>{},deps:[Mae],multi:!0},{provide:ck,useClass:class{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,v){this.accountService=e,this.biometricService=t,this.vaultTimeoutSettingsService=i,this.logoutService=n,this.messagingService=r,this.searchService=s,this.folderService=o,this.masterPasswordService=a,this.stateEventRunnerService=l,this.cipherService=c,this.authService=u,this.systemService=d,this.processReloadService=h,this.logService=p,this.keyService=v}lockAll(){return lk(this,void 0,void 0,function*(){const e=yield(0,bo._)((0,jo.z)([this.accountService.activeAccount$,this.accountService.accounts$]).pipe((0,l.T)(([e,t])=>{const i=Object.keys(t);return null==e?{activeAccount:null,otherAccounts:i}:{activeAccount:e.id,otherAccounts:i.filter(t=>t!==e.id)}})));for(const t of e.otherAccounts)yield this.lock(t);null!=e.activeAccount&&(yield this.lock(e.activeAccount))})}lock(e){return lk(this,void 0,void 0,function*(){if(ak(e,"userId","LockService"),this.logService.info(`[LockService] Locking user ${e}`),(yield(0,bo._)(this.authService.authStatusFor$(e)))!==Pd.LoggedOut){if(!(yield this.vaultTimeoutSettingsService.canLock(e)))return yield this.logoutService.logout(e,"vaultTimeout"),void this.logService.info(`[LockService] User ${e} cannot lock, logging out instead.`);yield this.wipeDecryptedState(e),yield this.waitForLockedStatus(e),yield this.systemService.clearPendingClipboard(),yield this.runPlatformOnLockActions(),this.logService.info(`[LockService] Locked user ${e}`),yield this.biometricService.setShouldAutopromptNow(!1),this.messagingService.send("locked",{userId:e}),yield this.processReloadService.startProcessReload()}})}wipeDecryptedState(e){return lk(this,void 0,void 0,function*(){yield this.searchService.clearIndex(e),yield this.folderService.clearDecryptedFolderState(e),yield this.masterPasswordService.clearMasterKey(e),yield this.cipherService.clearCache(e),yield this.keyService.clearStoredUserKey(e),yield this.stateEventRunnerService.handleEvent("lock",e)})}waitForLockedStatus(e){return lk(this,void 0,void 0,function*(){yield(0,bo._)(this.authService.authStatusFor$(e).pipe((0,Eo.p)(e=>e===Pd.Locked),(0,wo.w)({first:5e3,with:()=>{throw new Error("The lock process did not complete in a reasonable amount of time.")}})))})}runPlatformOnLockActions(){return lk(this,void 0,void 0,function*(){})}},deps:[Zk,Vp,qp,Nw,bk,sQ,UM,Yb,I,_b,Rd,class{},class{},Za,Bp]},{provide:$V,useClass:sae,deps:[_b,eI,T$,Kb]},{provide:class{},useClass:class{constructor(e,t){this.keyService=e,this.encryptService=t}createKeySet(e,t){return Mne(this,void 0,void 0,function*(){if(!e)throw new Error("failed to create key set: upstreamKey is required");if(!t)throw new Error("failed to create key set: downstreamKey is required");const[i,n]=yield this.keyService.makeKeyPair(e),r=bd.fromB64ToArray(i),s=yield this.encryptService.encapsulateKeyUnsigned(t,r),o=yield this.encryptService.wrapEncapsulationKey(r,t);return new Kte(s,o,n)})}rotateKeySet(e,t,i){return Mne(this,void 0,void 0,function*(){if(!e)throw new Error("failed to rotate key set: keySet is required");if(!t)throw new Error("failed to rotate key set: oldDownstreamKey is required");if(!i)throw new Error("failed to rotate key set: newDownstreamKey is required");const n=yield this.encryptService.unwrapEncapsulationKey(e.encryptedPublicKey,t);if(null==n)throw new Error("failed to rotate key set: could not decrypt public key");const r=yield this.encryptService.wrapEncapsulationKey(n,i),s=yield this.encryptService.encapsulateKeyUnsigned(i,n);return new Kte(s,r,e.encryptedPrivateKey)})}},deps:[Bp,$G]},{provide:kF,useClass:FF,deps:[]},{provide:Pre,useClass:Pre,deps:[u]},{provide:aD,useClass:class{constructor(e){this.apiService=e}getConfirmationDetails(e){return Pne(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/accounts/key-connector/confirmation-details/"+encodeURIComponent(e),null,!0,!0);return new Tne(t)})}},deps:[eI]},{provide:wC,useClass:Aae,deps:[]}];class Hae{}Hae.ɵfac=function(e){return new(e||Hae)},Hae.ɵmod=Fl.$C({type:Hae}),Hae.ɵinj=a.G2t({providers:Yae});const Jae=Object.freeze({AuthRequest:"authRequest"});var Zae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Qae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const ele=new k(te,"enablePhishingDetection",{deserializer:e=>null==e||e,clearOn:[]});class tle{constructor(e,t){this.keyService=e,this.encryptService=t}attachToGlobal(e){e.bitwardenContainerService||(e.bitwardenContainerService=this)}getKeyService(){if(null==this.keyService)throw new Error("ContainerService.keyService not initialized.");return this.keyService}getEncryptService(){if(null==this.encryptService)throw new Error("ContainerService.encryptService not initialized.");return this.encryptService}}var ile=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class nle{createSdkClient(...e){return ile(this,void 0,void 0,function*(){return Promise.resolve(new nm.cPU(...e))})}}class rle{createSdkClient(...e){return Promise.reject(new Error("SDK not available"))}}var sle=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class ole{constructor(e,t){if(this.primaryStorageService=e,this.secondaryStorageService=t,this.updates$=this.primaryStorageService.updates$,e.valuesRequireDeserialization!==t.valuesRequireDeserialization)throw new Error("Differing values for valuesRequireDeserialization between storage services is not supported.")}get valuesRequireDeserialization(){return this.primaryStorageService.valuesRequireDeserialization}get(e,t){return sle(this,void 0,void 0,function*(){const i=yield this.primaryStorageService.get(e,t);return null==i?yield this.secondaryStorageService.get(e,t):i})}has(e,t){return sle(this,void 0,void 0,function*(){return(yield this.primaryStorageService.has(e,t))||(yield this.secondaryStorageService.has(e,t))})}save(e,t,i){return sle(this,void 0,void 0,function*(){yield Promise.allSettled([this.primaryStorageService.save(e,t,i),this.secondaryStorageService.save(e,t,i)])})}remove(e,t){return sle(this,void 0,void 0,function*(){yield Promise.allSettled([this.primaryStorageService.remove(e,t),this.secondaryStorageService.remove(e,t)])})}}var ale=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class lle{constructor(e){this.storage=e,this.updatesSubject=new Co.B,this.updates$=this.updatesSubject.asObservable()}get valuesRequireDeserialization(){return!0}get(e,t){const i=this.storage.getItem(e);return null!=i?Promise.resolve(JSON.parse(i)):Promise.resolve(null)}has(e,t){return ale(this,void 0,void 0,function*(){return null!=(yield this.get(e,t))})}save(e,t,i){if(null==t)return this.remove(e,i);t instanceof Set&&(t=Array.from(t)),this.storage.setItem(e,JSON.stringify(t)),this.updatesSubject.next({key:e,updateType:"save"})}remove(e,t){return this.storage.removeItem(e),this.updatesSubject.next({key:e,updateType:"remove"}),Promise.resolve()}getKeys(){return Object.keys(this.storage)}}var cle=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const ule=new wk("lockAllFinished"),dle=new wk("lockAll"),hle=new wk("lockUserFinished"),ple=new wk("lockUser");class vle extends Iae{constructor(){super(...arguments),this.anonLayoutWrapperDataSubject=new Co.B}setAnonLayoutWrapperData(e){this.anonLayoutWrapperDataSubject.next(e)}anonLayoutWrapperData$(){return this.anonLayoutWrapperDataSubject.asObservable()}}var fle=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class mle extends zk{constructor(e,t,i,n,r,s,o){super(e,t,i,n,r),this.extensionAnonLayoutWrapperDataService=s,this.ssoUrlService=o}redirectToSso(e,t,i,n){return fle(this,void 0,void 0,function*(){const r=(yield(0,bo._)(this.environmentService.environment$)).getWebVaultUrl(),s=r+"/sso-connector.html",o=this.ssoUrlService.buildSsoUrl(r,this.clientType,s,t,i,e,n);this.platformUtilsService.launchUri(o)})}showBackButton(e){this.extensionAnonLayoutWrapperDataService.setAnonLayoutWrapperData({showBackButton:e})}isLoginWithPasskeySupported(){return this.platformUtilsService.isChromium()}}mle.ɵfac=function(e){return new(e||mle)(a.KVO(FI),a.KVO(mk),a.KVO(gf),a.KVO(Hb),a.KVO(xk),a.KVO(vle),a.KVO(dk))},mle.ɵprov=a.jDH({token:mle,factory:mle.ɵfac});var gle=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class yle extends PT{constructor(e,t,i,n,r){super(),this.syncService=e,this.authService=t,this.environmentService=i,this.i18nService=n,this.logService=r}closeWindow(){return gle(this,void 0,void 0,function*(){window.close()})}}yle.ɵfac=function(e){return new(e||yle)(a.KVO(qx),a.KVO(Rd),a.KVO(mk),a.KVO(Ul),a.KVO(Za))},yle.ɵprov=a.jDH({token:yle,factory:yle.ɵfac});var ble=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var wle=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Sle="auth_ssoAuthResult",kle="auth_twoFactorAuthWebAuthn",Ile="auth_twoFactorAuthEmail",Cle="auth_twoFactorAuthDuo";new Set([chrome.runtime.getURL("popup/index.html#/lock"),chrome.runtime.getURL("popup/index.html#/login")]);var Tle=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Ple=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Fle=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Rle=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var xle=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Ale=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Dle=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Ele{constructor(e,t){this.logService=e,this.platformUtilsService=t}openPopup(){return Dle(this,void 0,void 0,function*(){const e=this.platformUtilsService.getDevice();try{switch(e){case Ea.FirefoxExtension:case Ea.ChromeExtension:{const t=ul.getBrowserAction();if("openPopup"in t&&"function"==typeof t.openPopup)return void(yield t.openPopup());this.logService.warning(`No openPopup function found on browser actions. On browser: ${Ea[e]} and manifest version: ${ul.manifestVersion}`);break}case Ea.SafariExtension:return void(yield Ja.sendMessageToApp("showPopover",null,!0));default:this.logService.warning(`Tried to open the popup from an unsupported device type: ${Ea[e]}`)}}catch(t){this.logService.error(`Failed to open the popup on ${Ea[e]} with manifest ${ul.manifestVersion} and error: ${t}`)}})}}const $le={"Could not establish connection. Receiving end does not exist.":(e,t)=>e.debug(`Receiving end didn't exist for command '${t}'`),"The message port closed before a response was received.":(e,t)=>e.debug(`Port was closed for command '${t}'`)};class Ole{constructor(e){this.logService=e}send(e,t={}){const i=kk(e);chrome.runtime.sendMessage(Object.assign(t,{command:i}),()=>{if(chrome.runtime.lastError){const e=$le[chrome.runtime.lastError.message];if(null!=e)return void e(this.logService,i);this.logService.warning(`Unhandled error while sending message with command '${i}': ${chrome.runtime.lastError.message}`)}})}}class Ule{}var Mle=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Nle{get blobOptions(){var e;const t=null!==(e=this._request.blobOptions)&&void 0!==e?e:{};return null==t.type&&(t.type=this.fileType),t}get blob(){return null!=this.blobOptions?new Blob([this._request.blobData],this.blobOptions):new Blob([this._request.blobData])}get downloadMethod(){return null!=this._request.downloadMethod?this._request.downloadMethod:"application/pdf"!=this.fileType?"save":"open"}get fileType(){const e=this._request.fileName.toLowerCase();return e.endsWith(".pdf")?"application/pdf":e.endsWith(".xlsx")?"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":e.endsWith(".docx")?"application/vnd.openxmlformats-officedocument.wordprocessingml.document":e.endsWith(".pptx")?"application/vnd.openxmlformats-officedocument.presentationml.presentation":e.endsWith(".csv")?"text/csv":e.endsWith(".png")?"image/png":e.endsWith(".jpg")||e.endsWith(".jpeg")?"image/jpeg":e.endsWith(".gif")?"image/gif":null}constructor(e){this._request=e}}var Vle=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Ble{download(e){const t=new Nle(e);if(ul.isSafariApi)this.downloadSafari(e,t);else{const i=window.document.createElement("a");i.href=URL.createObjectURL(t.blob),i.download=e.fileName,window.document.body.appendChild(i),i.click(),window.document.body.removeChild(i)}}downloadSafari(e,t){return Vle(this,void 0,void 0,function*(){let i=null;if("text/plain"===t.blobOptions.type&&"string"==typeof e.blobData)i=e.blobData;else if(e.blobData instanceof Blob){const t=yield e.blobData.arrayBuffer();i=bd.fromBufferToB64(t)}else i=bd.fromBufferToB64(e.blobData);yield Ja.sendMessageToApp("downloadFile",JSON.stringify({blobData:i,blobOptions:e.blobOptions,fileName:e.fileName}),!0)})}}Ble.ɵfac=function(e){return new(e||Ble)},Ble.ɵprov=a.jDH({token:Ble,factory:Ble.ɵfac});class jle{}var Gle=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Lle extends tse{constructor(e,t,i,n=[]){super(t,i,n),this.logService=e}hasManagedEnvironment(){return Gle(this,void 0,void 0,function*(){try{return null!=(yield this.getManagedEnvironment())}catch(e){return this.logService.error(e),!1}})}settingsHaveChanged(){return Gle(this,void 0,void 0,function*(){if(!(yield this.hasManagedEnvironment()))return!1;const e=yield this.getManagedEnvironment(),t=(yield(0,bo._)(this.environment$)).getUrls();return e.base!=t.base||e.webVault!=t.webVault||e.api!=t.api||e.identity!=t.identity||e.icons!=t.icons||e.notifications!=t.notifications||e.events!=t.events})}getManagedEnvironment(){return new Promise((e,t)=>{if(null==chrome.storage.managed)return e(null);chrome.storage.managed.get("environment",i=>{if(chrome.runtime.lastError)return t(chrome.runtime.lastError);e(i.environment)})})}setUrlsToManagedEnvironment(){return Gle(this,void 0,void 0,function*(){const e=yield this.getManagedEnvironment();yield this.setEnvironment(hk.SelfHosted,{base:e.base,webVault:e.webVault,api:e.api,identity:e.identity,icons:e.icons,notifications:e.notifications,events:e.events})})}}var zle=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const _le="__json__";class Kle{constructor(e){this.chromeStorageApi=e,this.updates$=xF(this.chromeStorageApi.onChanged).pipe((0,Eo.p)(([e])=>1===Object.keys(e).length),(0,Xx.Z)(([e])=>Object.entries(e).map(([e,t])=>({key:e,updateType:"newValue"in t?"save":"remove"}))))}get valuesRequireDeserialization(){return!0}get(e){return zle(this,void 0,void 0,function*(){return new Promise((t,i)=>{this.chromeStorageApi.get(e,n=>{if(chrome.runtime.lastError)return i(chrome.runtime.lastError);null==n||null==n[e]?t(null):t(this.processGetObject(n[e]))})})})}has(e){return zle(this,void 0,void 0,function*(){return null!=(yield this.get(e))})}save(e,t){return zle(this,void 0,void 0,function*(){if(null==(t=(e=>null==e?null:(e instanceof Set&&(e=Array.from(e)),{[_le]:!0,value:JSON.stringify(e)}))(t)))return this.remove(e);const i={[e]:t};return new Promise((e,t)=>{this.chromeStorageApi.set(i,()=>{if(chrome.runtime.lastError)return t(chrome.runtime.lastError);e()})})})}remove(e){return zle(this,void 0,void 0,function*(){return new Promise((t,i)=>{this.chromeStorageApi.remove(e,()=>{if(chrome.runtime.lastError)return i(chrome.runtime.lastError);t()})})})}processGetObject(e){return this.isSerialized(e)&&(e=JSON.parse(e.value)),e}isSerialized(e){const t=e;return null!=t&&t[_le]&&"string"==typeof t.value}}var Xle=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class qle extends Kle{constructor(){super(chrome.storage.session)}}var Wle=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};var Yle=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Hle{constructor(e,t,i){this.systemLanguage=e,this.localesDirectory=t,this.getLocalesJson=i,this.supportedTranslationLocales=["en"],this.defaultLocale="en",this.localeNames=new Map([["af","Afrikaans"],["ar","العربية الفصحى"],["az","Azərbaycanca"],["be","Беларуская"],["bg","български"],["bn","বাংলা"],["bs","bosanski jezik"],["ca","català"],["cs","čeština"],["cy","Cymraeg, y Gymraeg"],["da","dansk"],["de","Deutsch"],["el","Ελληνικά"],["en","English"],["en-GB","English (British)"],["en-IN","English (India)"],["eo","Esperanto"],["es","español"],["et","eesti"],["eu","euskara"],["fa","فارسی"],["fi","suomi"],["fil","Wikang Filipino"],["fr","français"],["gl","galego"],["he","עברית"],["hi","हिन्दी"],["hr","hrvatski"],["hu","magyar"],["id","Bahasa Indonesia"],["it","italiano"],["ja","日本語"],["ka","ქართული"],["km","ខ្មែរ, ខេមរភាសា, ភាសាខ្មែរ"],["kn","ಕನ್ನಡ"],["ko","한국어"],["lt","lietuvių kalba"],["lv","Latvietis"],["me","црногорски"],["ml","മലയാളം"],["mr","मराठी"],["my","ဗမာစကား"],["nb","norsk (bokmål)"],["ne","नेपाली"],["nl","Nederlands"],["nn","Norsk Nynorsk"],["or","ଓଡ଼ିଆ"],["pl","polski"],["pt-BR","português do Brasil"],["pt-PT","português"],["ro","română"],["ru","русский"],["si","සිංහල"],["sk","slovenčina"],["sl","Slovenski jezik, Slovenščina"],["sr","Српски"],["sv","svenska"],["ta","தமிழ்"],["te","తెలుగు"],["th","ไทย"],["tr","Türkçe"],["uk","українська"],["vi","Tiếng Việt"],["zh-CN","中文(中国大陆)"],["zh-TW","中文(台灣)"]]),this.defaultMessages={},this.localeMessages={},this.systemLanguage=e.replace("_","-")}init(e){return Yle(this,void 0,void 0,function*(){if(this.inited)throw new Error("i18n already initialized.");if(null==this.supportedTranslationLocales||0===this.supportedTranslationLocales.length)throw new Error("supportedTranslationLocales not set.");this.inited=!0,this.translationLocale=null!=e?e:this.systemLanguage;try{this.collator=new Intl.Collator(this.translationLocale,{numeric:!0,sensitivity:"base"})}catch(e){this.collator=null}-1===this.supportedTranslationLocales.indexOf(this.translationLocale)&&(this.translationLocale=this.translationLocale.slice(0,2),-1===this.supportedTranslationLocales.indexOf(this.translationLocale)&&(this.translationLocale=this.defaultLocale)),null!=this.localesDirectory&&(yield this.loadMessages(this.translationLocale,this.localeMessages),this.translationLocale!==this.defaultLocale&&(yield this.loadMessages(this.defaultLocale,this.defaultMessages)))})}t(e,t,i,n){return this.translate(e,t,i,n)}translate(e,t,i,n){let r;return r=this.localeMessages.hasOwnProperty(e)&&this.localeMessages[e]?this.localeMessages[e]:this.defaultMessages.hasOwnProperty(e)&&this.defaultMessages[e]?this.defaultMessages[e]:"",""!==r&&(null!=t&&(r=r.split("__$1__").join(t.toString())),null!=i&&(r=r.split("__$2__").join(i.toString())),null!=n&&(r=r.split("__$3__").join(n.toString()))),r}loadMessages(e,t){return Yle(this,void 0,void 0,function*(){const i=e.replace("-","_"),n=yield this.getLocalesJson(i);for(const e in n)if(n.hasOwnProperty(e)&&(t[e]=n[e].message,n[e].placeholders))for(const i in n[e].placeholders){if(!n[e].placeholders.hasOwnProperty(i)||!n[e].placeholders[i].content)continue;const r="\\$"+i.toUpperCase()+"\\$";let s=n[e].placeholders[i].content;"$1"!==s&&"$2"!==s&&"$3"!==s||(s="__$"+s+"__"),t[e]=t[e].replace(new RegExp(r,"g"),s)}})}}var Jle=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Zle=new m(ue,"locale",{deserializer:e=>e});class Qle extends Hle{constructor(e,t,i,n){super(e,t,i),this.systemLanguage=e,this.localesDirectory=t,this.getLocalesJson=i,this.translationLocaleState=n.get(Zle),this.userSetLocale$=this.translationLocaleState.state$,this.locale$=this.userSetLocale$.pipe((0,l.T)(e=>null!=e?e:this.translationLocale))}setLocale(e){return Jle(this,void 0,void 0,function*(){yield this.translationLocaleState.update(()=>e)})}init(){const e=Object.create(null,{init:{get:()=>super.init}});return Jle(this,void 0,void 0,function*(){const t=yield(0,bo._)(this.translationLocaleState.state$);yield e.init.call(this,t)})}}var ece=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class tce extends Qle{constructor(e,t){super(e,null,e=>ece(this,void 0,void 0,function*(){const t=yield fetch(this.localesDirectory+e+"/messages.json");return yield t.json()}),t),this.supportedTranslationLocales=["en","ar","az","be","bg","bn","bs","ca","cs","cy","da","de","el","en-GB","en-IN","es","et","eu","fa","fi","fil","fr","gl","he","hi","hr","hu","id","it","ja","ka","km","kn","ko","lt","lv","ml","mr","my","nb","ne","nl","nn","or","pl","pt-BR","pt-PT","ro","ru","si","sk","sl","sr","sv","ta","te","th","tr","uk","vi","zh-CN","zh-TW"]}t(e,t,i,n){return this.translate(e,t,i,n)}translate(e,t,i,n){if(null==this.localesDirectory){const r=[];return null!=t&&r.push(t),null!=i&&r.push(i),null!=n&&r.push(n),r.length?chrome.i18n.getMessage(e,r):chrome.i18n.getMessage(e)}return super.translate(e,t,i,n)}}class ice extends sl{constructor(e,t,i,n){super(t,i,n),this.toastService=e}showToast(e,t,i,n){this.toastService._showToast({type:e,title:t,text:i,options:n})}}var nce=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const rce=(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}return!1})();let sce;ul.isManifestVersion(3)&&(rce?(console.info("WebAssembly is supported in this environment"),sce=i.e(635).then(i.bind(i,20635))):sce=new Promise((e,t)=>{t(new Error("WebAssembly is not supported in this environment"))}));const oce="setTimeout",ace="setInterval";var lce=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const cce=new m(he,"activeAlarms",{deserializer:e=>null!=e?e:[]});class uce extends Ka{constructor(e,t){super(e),this.stateProvider=t,this.handleOnAlarm=e=>lce(this,void 0,void 0,function*(){const{name:t,periodInMinutes:i}=e;yield this.triggerTask(t,i)}),this.activeAlarmsState=this.stateProvider.getGlobal(cce),this.activeAlarms$=this.activeAlarmsState.state$.pipe((0,l.T)(e=>null!=e?e:[])),this.setupOnAlarmListener()}setTimeout(e,t){let i;this.validateRegisteredTask(e);const n=t/1e3/60;return this.scheduleAlarm(e,{delayInMinutes:this.getUpperBoundDelayInMinutes(n)}).catch(e=>this.logService.error("Failed to schedule alarm",e)),n<this.getUpperBoundDelayInMinutes(n)&&(i=globalThis.setTimeout(()=>lce(this,void 0,void 0,function*(){yield this.clearScheduledAlarm(e),yield this.triggerTask(e)}),t)),new za.yU(()=>{i&&globalThis.clearTimeout(i),this.clearScheduledAlarm(e).catch(e=>this.logService.error("Failed to clear alarm",e))})}setInterval(e,t,i){this.validateRegisteredTask(e);const n=t/1e3/60,r=i?i/1e3/60:n;return n<this.getUpperBoundDelayInMinutes(n)?this.setupSteppedIntervalAlarms(e,t):(this.scheduleAlarm(e,{periodInMinutes:this.getUpperBoundDelayInMinutes(n),delayInMinutes:this.getUpperBoundDelayInMinutes(r)}).catch(e=>this.logService.error("Failed to schedule alarm",e)),new za.yU(()=>this.clearScheduledAlarm(e).catch(e=>this.logService.error("Failed to clear alarm",e))))}setupSteppedIntervalAlarms(e,t){const i=this.getAlarmMinDelayInMinutes(),n=t/1e3/60,r=Math.ceil(Math.ceil(1/n)/2)+1,s=i+n,o=[];for(let t=0;t<r;t++){const r=`${e}__${t}`;o.push(r);const a=this.getUpperBoundDelayInMinutes(i+n*t);this.clearScheduledAlarm(r).then(()=>this.scheduleAlarm(r,{periodInMinutes:s,delayInMinutes:a}).catch(e=>this.logService.error("Failed to schedule alarm",e))).catch(e=>this.logService.error("Failed to clear alarm",e))}let a=0;const l=globalThis.setInterval(()=>lce(this,void 0,void 0,function*(){a+=t;a/1e3/60>=i?globalThis.clearInterval(l):yield this.triggerTask(e,n)}),t);return new za.yU(()=>{l&&globalThis.clearInterval(l),o.forEach(e=>this.clearScheduledAlarm(e).catch(e=>this.logService.error("Failed to clear alarm",e)))})}clearAllScheduledTasks(){return lce(this,void 0,void 0,function*(){yield this.clearAllAlarms(),yield this.updateActiveAlarms([])})}verifyAlarmsState(){return lce(this,void 0,void 0,function*(){const e=Date.now(),t=yield this.getActiveAlarms();for(const i of t){const{alarmName:t,startTime:n,createInfo:r}=i;if(yield this.getAlarm(t))continue;const s=r.when&&r.when<e,o=!r.periodInMinutes&&r.delayInMinutes&&n+60*r.delayInMinutes*1e3<e;s||o?yield this.triggerTask(t):this.scheduleAlarm(t,r).catch(e=>this.logService.error("Failed to schedule alarm",e))}})}scheduleAlarm(e,t){return lce(this,void 0,void 0,function*(){(yield this.getAlarm(e))?this.logService.debug(`Alarm ${e} already exists. Skipping creation.`):(yield this.createAlarm(e,t),yield this.setActiveAlarm(e,t))})}getActiveAlarms(){return lce(this,void 0,void 0,function*(){return yield(0,bo._)(this.activeAlarms$)})}setActiveAlarm(e,t){return lce(this,void 0,void 0,function*(){const i=(yield this.getActiveAlarms()).filter(t=>t.alarmName!==e);i.push({alarmName:e,startTime:Date.now(),createInfo:t}),yield this.updateActiveAlarms(i)})}deleteActiveAlarm(e){return lce(this,void 0,void 0,function*(){const t=(yield this.getActiveAlarms()).filter(t=>t.alarmName!==e);yield this.updateActiveAlarms(t||[])})}clearScheduledAlarm(e){return lce(this,void 0,void 0,function*(){(yield this.clearAlarm(e))&&(yield this.deleteActiveAlarm(e))})}updateActiveAlarms(e){return lce(this,void 0,void 0,function*(){yield this.activeAlarmsState.update(()=>e)})}setupOnAlarmListener(){ul.addListener(chrome.alarms.onAlarm,this.handleOnAlarm)}triggerTask(e,t){return lce(this,void 0,void 0,function*(){const i=this.getTaskFromAlarmName(e),n=this.taskHandlers.get(i);t||(yield this.deleteActiveAlarm(e)),n&&n()})}getTaskFromAlarmName(e){return e.split("__")[0]}clearAlarm(e){return lce(this,void 0,void 0,function*(){return this.isNonChromeEnvironment()?browser.alarms.clear(e):new Promise(t=>chrome.alarms.clear(e,t))})}clearAllAlarms(){return this.isNonChromeEnvironment()?browser.alarms.clearAll():new Promise(e=>chrome.alarms.clearAll(e))}createAlarm(e,t){return lce(this,void 0,void 0,function*(){return this.isNonChromeEnvironment()?browser.alarms.create(e,t):new Promise(i=>chrome.alarms.create(e,t,i))})}getAlarm(e){return this.isNonChromeEnvironment()?browser.alarms.get(e):new Promise(t=>chrome.alarms.get(e,t))}isNonChromeEnvironment(){return"undefined"!=typeof browser&&!!browser.alarms}getAlarmMinDelayInMinutes(){return this.isNonChromeEnvironment()?1:.5}getUpperBoundDelayInMinutes(e){return Math.max(this.getAlarmMinDelayInMinutes(),e)}}class dce extends uce{constructor(e,t){super(e,t),this.port=chrome.runtime.connect({name:"browser-task-scheduler-port"})}setTimeout(e,t){return this.sendPortMessage({action:oce,taskName:e,delayInMs:t}),super.setTimeout(e,t)}setInterval(e,t,i){return this.sendPortMessage({action:ace,taskName:e,intervalInMs:t}),super.setInterval(e,t,i)}sendPortMessage(e){this.port.postMessage(e)}}var hce=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class pce extends yp{get valuesRequireDeserialization(){return!0}constructor(e){super(),this.partitionName=e,this.updatesSubject=new Co.B,this.updates$=this.updatesSubject.asObservable();let t=function(e){switch(e){case chrome.storage.local:return"local";case chrome.storage.sync:return"sync";case chrome.storage.session:return"session";default:throw new Error("Unknown storage location")}}(chrome.storage.session);this.partitionName&&(t=`${t}_${this.partitionName}`),this._port=chrome.runtime.connect({name:t}),this._backgroundResponses$=xF(this._port.onMessage).pipe((0,l.T)(([e])=>e),(0,Eo.p)(e=>"background"===e.originator)),this._backgroundResponses$.pipe((0,Eo.p)(e=>"subject_update"===e.action||"initialization"===e.action)).subscribe(e=>{switch(e.action){case"initialization":this.handleInitialize(e.data);break;case"subject_update":this.handleSubjectUpdate(e.data);break;default:throw new Error(`Unknown action: ${e.action}`)}})}get(e){return hce(this,void 0,void 0,function*(){return yield this.delegateToBackground("get",e)})}has(e){return hce(this,void 0,void 0,function*(){return yield this.delegateToBackground("has",e)})}save(e,t){return hce(this,void 0,void 0,function*(){yield this.delegateToBackground("save",e,t)})}remove(e){return hce(this,void 0,void 0,function*(){yield this.delegateToBackground("remove",e)})}delegateToBackground(e,t,i){return hce(this,void 0,void 0,function*(){const n=bd.newGuid(),r=(0,bo._)(this._backgroundResponses$.pipe((0,Eo.p)(e=>e.id===n),(0,l.T)(e=>{var t;return JSON.parse(null!==(t=e.data)&&void 0!==t?t:null)})));this.sendMessage({id:n,key:t,action:e,data:JSON.stringify(i)});return yield r})}sendMessage(e){this._port.postMessage(Object.assign(Object.assign({},e),{originator:"foreground"}))}handleInitialize(e){e.forEach(e=>{this.updatesSubject.next({key:e,updateType:"save"})})}handleSubjectUpdate(e){this.updatesSubject.next(e)}}const vce=new wk("fullSyncFinished");var fce=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const mce=new wk("doFullSync");var gce=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class yce{constructor(e){this.platformUtilsService=e,this.notificationClicked$=(0,Po.h)(xF(chrome.notifications.onButtonClicked).pipe((0,l.T)(([e,t])=>({id:e,buttonIdentifier:t}))),xF(chrome.notifications.onClicked).pipe((0,l.T)(([e])=>({id:e,buttonIdentifier:Kse.NotificationButton}))))}create(e){return gce(this,void 0,void 0,function*(){return new Promise(t=>{const i=this.platformUtilsService.getDevice(),n={iconUrl:chrome.runtime.getURL("images/icon128.png"),message:e.body,type:"basic",title:e.title,buttons:e.buttons.map(e=>({title:e.title}))};i===Ea.FirefoxExtension&&delete n.buttons,null!=e.id?chrome.notifications.create(e.id,n,e=>t(e)):chrome.notifications.create(n,e=>t(e))})})}clear(e){return gce(this,void 0,void 0,function*(){yield chrome.notifications.clear(e.id)})}isSupported(){return"notifications"in chrome}}const bce=()=>xF(chrome.runtime.onMessage).pipe((0,l.T)(([e,t])=>(null!=e||(e={}),"webExtSender"in e||(e.webExtSender=t),e)),(0,l.T)(e=>Object.assign(e,{[Sk]:!0})),(0,Fo.u)());var wce=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Sce extends fx{nudgeStatus$(e,t){return super.nudgeStatus$(e,t).pipe((0,go.n)(e=>wce(this,void 0,void 0,function*(){const t=ul.getBrowserClientVendor(window)!==Fa&&(yield ul.browserAutofillSettingsOverridden());return{hasBadgeDismissed:e.hasBadgeDismissed||t,hasSpotlightDismissed:e.hasSpotlightDismissed||t}})))}}Sce.ɵfac=(()=>{let e;return function(t){return(e||(e=Fl.xGo(Sce)))(t||Sce)}})(),Sce.ɵprov=a.jDH({token:Sce,factory:Sce.ɵfac});var kce=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class Ice{constructor(e,t,i,n,r,s,o,l,c,u){this.platformUtilsService=e,this.i18nService=t,this.stateService=i,this.twoFactorService=n,this.logService=r,this.themingService=s,this.sdkLoadService=o,this.viewCacheService=l,this.migrationRunner=c,this.document=u,this.sizeService=(0,a.WQX)(ml)}init(){return()=>kce(this,void 0,void 0,function*(){yield this.sdkLoadService.loadAndInit(),yield this.migrationRunner.waitForCompletion(),yield this.i18nService.init(),this.twoFactorService.init(),yield this.viewCacheService.init(),yield this.sizeService.init();const e=window.document.documentElement;this.themingService.applyThemeChangesTo(this.document),e.classList.add("locale_"+this.i18nService.translationLocale),this.platformUtilsService.isChrome()&&navigator.platform.indexOf("Mac")>-1&&pl.inPopup(window)&&(window.screenLeft<0||window.screenTop<0||window.screenLeft>window.screen.width||window.screenTop>window.screen.height)&&(e.classList.add("force_redraw"),this.logService.info("Force redraw is on")),this.setupVaultPopupHeartbeat()})}setupVaultPopupHeartbeat(){ul.messageListener("vaultPopupHeartbeat",(e,t,i)=>{"checkVaultPopupHeartbeat"===(null==e?void 0:e.command)&&i(!0)})}}Ice.ɵfac=function(e){return new(e||Ice)(a.KVO(Hb),a.KVO(Ul),a.KVO(fo),a.KVO(nP),a.KVO(Za),a.KVO(Vae),a.KVO(om),a.KVO(Z4),a.KVO(fse),a.KVO(a.qQL))},Ice.ɵprov=a.jDH({token:Ice,factory:Ice.ɵfac});const Cce=new vc("OBSERVABLE_LARGE_OBJECT_MEMORY_STORAGE"),Tce=new vc("DISK_BACKUP_LOCAL_STORAGE"),Pce=[Ice,M9,lh,v4,b8,{provide:LT,useValue:fv},{provide:Fl.hnV,useFactory:e=>e.init(),deps:[Ice],multi:!0},{provide:FI,useFactory:()=>new ane(window),deps:[]},{provide:Za,useFactory:()=>new el(!1),deps:[]},{provide:mk,useExisting:Lle},{provide:Lle,useClass:Lle,deps:[Za,u,Zk,XT]},{provide:Ul,useFactory:e=>new tce(ul.getUILanguage(),e),deps:[d]},{provide:kre,useClass:Ele,deps:[Za,Hb]},{provide:Bp,useFactory:(e,t,i,n,r,s,o,a,l,c,u)=>{const d=new Vv(e,t,i,n,r,s,o,a,l,c,u);return new tle(d,n).attachToGlobal(self),d},deps:[Yb,jz,FI,$G,Hb,Za,fo,Zk,u,_v,oI]},{provide:C$,useClass:gae,deps:[Jk]},{provide:Ule,useClass:class{constructor(e){this.logService=e,this.workerCount=0}offscreenApiSupported(){return void 0!==chrome.offscreen}withDocument(e,t,i){return Mle(this,void 0,void 0,function*(){this.workerCount++;try{return(yield this.documentExists())||(yield this.create(e,t)),yield i()}finally{this.workerCount--,0===this.workerCount&&(yield this.close())}})}create(e,t){return Mle(this,void 0,void 0,function*(){try{yield chrome.offscreen.createDocument({url:"offscreen-document/index.html",reasons:e,justification:t})}catch(e){if("Only a single offscreen document may be created."===e.message)return void this.logService.info("Ignoring offscreen document creation error.");throw e}})}close(){return Mle(this,void 0,void 0,function*(){yield chrome.offscreen.closeDocument()})}documentExists(){return Mle(this,void 0,void 0,function*(){return yield chrome.offscreen.hasDocument()})}},deps:[Za]},{provide:Hb,useFactory:(e,t)=>new ice(e,(e,t)=>{ul.sendMessage("clearClipboard",{clipboardValue:e,clearMs:t})},window,t),deps:[qb,Ule]},{provide:Vp,useClass:class extends Vp{constructor(e){super(),this.platformUtilsService=e,this.shouldAutopromptNow=!0}authenticateWithBiometrics(){return Fle(this,void 0,void 0,function*(){const e=yield ul.sendMessageWithResponse(Op.AuthenticateWithBiometrics);if(!e.result)throw e.error;return e.result})}getBiometricsStatus(){return Fle(this,void 0,void 0,function*(){return(yield ul.sendMessageWithResponse(Op.GetBiometricsStatus)).result})}unlockWithBiometricsForUser(e){return Fle(this,void 0,void 0,function*(){const t=yield ul.sendMessageWithResponse(Op.UnlockWithBiometricsForUser,{userId:e});return t.result?Dv.fromString(t.result.keyB64):null})}getBiometricsStatusForUser(e){return Fle(this,void 0,void 0,function*(){const t=yield ul.sendMessageWithResponse(Op.GetBiometricsStatusForUser,{userId:e});return null!=t?t.result:$p.DesktopDisconnected})}getShouldAutopromptNow(){return Fle(this,void 0,void 0,function*(){return this.shouldAutopromptNow})}setShouldAutopromptNow(e){return Fle(this,void 0,void 0,function*(){this.shouldAutopromptNow=e})}canEnableBiometricUnlock(){return Fle(this,void 0,void 0,function*(){return!(yield ul.permissionsGranted(["nativeMessaging"]))&&!this.platformUtilsService.isSafari()||(yield ul.sendMessageWithResponse(Op.CanEnableBiometricUnlock)).result})}},deps:[Hb]},{provide:qx,useClass:class extends zse{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p){super(e,t,i,n,r,s,o,a,l,c,u,d,p),this.messageListener=h}fullSync(e,t){return fce(this,void 0,void 0,function*(){var i,n;this.syncInProgress=!0;try{const r="boolean"==typeof t?{allowThrowOnError:t,skipTokenRefresh:!1}:{allowThrowOnError:null!==(i=null==t?void 0:t.allowThrowOnError)&&void 0!==i&&i,skipTokenRefresh:null!==(n=null==t?void 0:t.skipTokenRefresh)&&void 0!==n&&n},s=bd.newGuid(),o=(0,bo._)(this.messageListener.messages$(vce).pipe((0,Eo.p)(e=>e.requestId===s),(0,wo.w)({first:3e4,with:()=>(this.logService.warning("ForegroundSyncService did not receive a message back in a reasonable time."),(0,Go.of)({successfully:!1,errorMessage:"Sync timed out."}))})));this.messageSender.send(mce,{forceSync:e,options:r,requestId:s});const a=yield o;if(r.allowThrowOnError&&null!=a.errorMessage)throw new Error(a.errorMessage);return a.successfully}finally{this.syncInProgress=!1}})}},deps:[iee,MM,BL,bk,Za,_b,uR,eI,Zk,Rd,Y0,F0,gk,u]},{provide:YE,useClass:HE,deps:[u,Jb,Zk]},{provide:yp,useClass:class extends Kle{constructor(e){super(chrome.storage.local),this.logService=e}get(e){return Xle(this,void 0,void 0,function*(){return yield this.getWithRetries(e,0)})}getKeys(){return Xle(this,void 0,void 0,function*(){return"getKeys"in this.chromeStorageApi?this.chromeStorageApi.getKeys():[]})}getWithRetries(e,t){return Xle(this,void 0,void 0,function*(){const i=yield this.getStore(e);if(null==i){if(t>=5)throw new Error(`Failed to get a value for key '${e}', see logs for more details.`);return t++,this.logService.warning(`Retrying attempt to get value for key '${e}' in 200ms`),yield new Promise(e=>setTimeout(e,200)),yield this.getWithRetries(e,t)}return this.processGetObject(i[e])})}getStore(e){return Xle(this,void 0,void 0,function*(){return null==this.chromeStorageApi?(this.logService.warning(`chrome.storage.local was not initialized while retrieving key '${e}'.`),null):new Promise(t=>{this.chromeStorageApi.get(e,i=>chrome.runtime.lastError?(this.logService.warning(`Failed to get value for key '${e}'`,chrome.runtime.lastError),void t(null)):null==i?(this.logService.warning(`Store was empty while retrieving value for key '${e}'`),void t(null)):void t(i))})})}fillBuffer(){return Xle(this,void 0,void 0,function*(){const e="0".repeat(1048576);yield new Promise((t,i)=>{this.chromeStorageApi.set({fake_data_1:e,fake_data_2:e,fake_data_3:e,fake_data_4:e},()=>{if(chrome.runtime.lastError)return i(chrome.runtime.lastError);t()})}),yield new Promise((e,t)=>{this.chromeStorageApi.remove(["fake_data_1","fake_data_2","fake_data_3","fake_data_4"],()=>{if(chrome.runtime.lastError)return t(chrome.runtime.lastError);e()})})})}},deps:[Za]},{provide:r8,useExisting:y8},{provide:II,useExisting:Z4,deps:[]},{provide:y8,deps:[_b,BE,C$,I$,Za,YE,NC,T$,jle,Zk,Rd,Kb,WY,gk]},{provide:jle,useClass:class extends jle{constructor(e,t,i){super(),this.domainSettingsService=e,this.platformUtilsService=t,this.logService=i,this.blockedDomains=null}inject(e){return Wle(this,void 0,void 0,function*(){var t;const{tabId:i,injectDetails:n,mv3Details:r}=e,s=this.getScriptFile(e);if(!s)throw new Error("No file specified for script injection");const o=i&&(yield ul.getTab(i));let a=!0;const l=yield(0,bo._)(this.domainSettingsService.blockedInteractionsUris$);if(l&&(null==o?void 0:o.url)&&(a=!Y$(null==o?void 0:o.url,l)),!a)return void this.logService.warning(`${n.file} was not injected because ${(null==o?void 0:o.url)||"the tab URL"} is on the user's blocked domains list.`);const c=this.buildInjectionDetails(n,s);if(ul.isManifestVersion(3))try{yield ul.executeScriptInTab(i,c,{world:null!==(t=null==r?void 0:r.world)&&void 0!==t?t:chrome.scripting.ExecutionWorld.ISOLATED})}catch(e){if("Cannot access contents of the page. Extension manifest must request permission to access the respective host."!==e.message)throw e;this.platformUtilsService.isDev()&&this.logService.warning(`BrowserApi.executeScriptInTab exception for ${n.file} in tab ${i}: ${e.message}`)}else yield ul.executeScriptInTab(i,c)})}getScriptFile(e){var t,i;const{injectDetails:n,mv2Details:r,mv3Details:s}=e;return ul.isManifestVersion(3)?null!==(t=null==s?void 0:s.file)&&void 0!==t?t:null==n?void 0:n.file:null!==(i=null==r?void 0:r.file)&&void 0!==i?i:null==n?void 0:n.file}buildInjectionDetails(e,t){const{frame:i,runAt:n}=e,r={file:t};return n&&(r.runAt=n),i?"all_frames"!==i?Object.assign(Object.assign({},r),{frameId:i}):Object.assign(Object.assign({},r),{allFrames:!0}):Object.assign(Object.assign({},r),{frameId:0})}},deps:[YE,Hb,Za]},{provide:Fv,useClass:class{constructor(e){this.messagingService=e}checkVaultTimeout(){return Ale(this,void 0,void 0,function*(){})}},deps:[bk]},{provide:UT,useExisting:yp},{provide:OT,useFactory:e=>e,deps:[ET]},{provide:ET,useFactory:()=>ul.isManifestVersion(2)?new pce:new qle,deps:[]},{provide:Cce,useFactory:e=>ul.isManifestVersion(2)?e:new pce,deps:[ET]},{provide:$T,useExisting:yp},{provide:xO,useClass:Ble,deps:[]},{provide:GT,useFactory:e=>{const t=ul.getBackgroundPage();return e.isSafari()&&t?(0,Go.of)(dee.getSystemThemeFromWindow(t)):dee.createSystemThemeFromWindow(window)},deps:[Hb]},{provide:c,useClass:class{get(e,t,i){return new qo(e,t,i)}},deps:[]},{provide:see,useClass:class extends Mte{constructor(e,t,i,n,r,s,o,a,l,c){super(e,t,i,n,r),this.accountService=e,this.authService=t,this.masterPasswordService=i,this.messagingService=n,this.pendingAuthRequestsState=r,this.actionService=s,this.i18nService=o,this.platformUtilsService=a,this.systemNotificationsService=l,this.logService=c}receivedPendingAuthRequest(e,t){return Zae(this,void 0,void 0,function*(){if(!e)throw new Error("authRequestUserId required");if(!t)throw new Error("authRequestId required");yield this.pendingAuthRequestsState.add(e);if(yield this.activeUserMeetsConditionsToShowApprovalDialog(e))this.messagingService.send("openLoginApproval",{notificationId:t});else{const i=(yield(0,bo._)(this.accountService.accounts$))[e];if(!i)return void this.logService.error("Account not found for authRequestUserId");const n=i.email;yield this.systemNotificationsService.create({id:`${Jae.AuthRequest}_${t}`,title:this.i18nService.t("accountAccessRequested"),body:this.i18nService.t("confirmAccessAttempt",n),buttons:[]})}})}activeUserMeetsConditionsToShowApprovalDialog(e){const t=Object.create(null,{activeUserMeetsConditionsToShowApprovalDialog:{get:()=>super.activeUserMeetsConditionsToShowApprovalDialog}});return Zae(this,void 0,void 0,function*(){const i=yield t.activeUserMeetsConditionsToShowApprovalDialog.call(this,e),n=yield this.platformUtilsService.isPopupOpen();return i&&n})}handleAuthRequestNotificationClicked(e){return Zae(this,void 0,void 0,function*(){e.buttonIdentifier===Kse.NotificationButton&&(yield this.systemNotificationsService.clear({id:`${e.id}`}),yield this.actionService.openPopup())})}},deps:[Zk,Rd,Wb,bk,nZ,kre,Ul,Hb,Xse,Za]},{provide:BE,useClass:jE,deps:[u,Jb,Zk,r$]},{provide:WY,useClass:class{constructor(e){this.stateProvider=e,this.enableAddedLoginPromptState=this.stateProvider.getGlobal(XY),this.enableAddedLoginPrompt$=this.enableAddedLoginPromptState.state$.pipe((0,l.T)(e=>null==e||e)),this.enableChangedPasswordPromptState=this.stateProvider.getGlobal(qY),this.enableChangedPasswordPrompt$=this.enableChangedPasswordPromptState.state$.pipe((0,l.T)(e=>null==e||e))}setEnableAddedLoginPrompt(e){return KY(this,void 0,void 0,function*(){yield this.enableAddedLoginPromptState.update(()=>e)})}setEnableChangedPasswordPrompt(e){return KY(this,void 0,void 0,function*(){yield this.enableChangedPasswordPromptState.update(()=>e)})}},deps:[u]},{provide:pE,useClass:class{constructor(e,t,i,n,r,s,o){this.accountService=e,this.billingService=t,this.configService=i,this.logService=n,this.organizationService=r,this.platformService=s,this.stateProvider=o,this.logService.debug("[PhishingDetectionSettingsService] Initializing service..."),this.available$=this.buildAvailablePipeline$().pipe((0,mo.F)(),(0,Oo.M)(e=>this.logService.debug(`[PhishingDetectionSettingsService] Phishing detection available: ${e}`)),(0,Gp.t)({bufferSize:1,refCount:!0})),this.enabled$=this.buildEnabledPipeline$().pipe((0,mo.F)(),(0,Oo.M)(e=>this.logService.debug(`[PhishingDetectionSettingsService] Phishing detection enabled: ${{enabled:e}}`)),(0,Gp.t)({bufferSize:1,refCount:!0})),this.on$=(0,jo.z)([this.available$,this.enabled$]).pipe((0,l.T)(([e,t])=>e&&t),(0,mo.F)(),(0,Oo.M)(e=>this.logService.debug(`[PhishingDetectionSettingsService] Phishing detection is on: ${{on:e}}`)),(0,Gp.t)({bufferSize:1,refCount:!1}))}setEnabled(e,t){return Qae(this,void 0,void 0,function*(){this.logService.debug(`[PhishingDetectionSettingsService] Setting phishing detection enabled: ${{enabled:t,userId:e}}`),yield this.stateProvider.getUser(e,ele).update(()=>t)})}buildAvailablePipeline$(){return this.platformService.isSafari()?(this.logService.warning("[PhishingDetectionSettingsService] Phishing detection is unavailable on Safari due to platform limitations"),(0,Go.of)(!1)):(0,jo.z)([this.accountService.activeAccount$,this.configService.getFeatureFlag$(Wv.PhishingDetection)]).pipe((0,go.n)(([e,t])=>e&&t?(0,jo.z)([this.billingService.hasPremiumPersonally$(e.id).pipe((0,Ed.W)(()=>(0,Go.of)(!1))),this.organizationService.organizations$(e.id).pipe((0,Ed.W)(()=>(0,Go.of)([])))]).pipe((0,l.T)(([e,t])=>e||this.orgGrantsAccess(t)),(0,Ed.W)(()=>(0,Go.of)(!1))):(0,Go.of)(!1)))}buildEnabledPipeline$(){return this.accountService.activeAccount$.pipe((0,go.n)(e=>e?(this.logService.debug("[PhishingDetectionSettingsService] Refreshing phishing detection enabled state"),this.stateProvider.getUserState$(ele,e.id)):(0,Go.of)(!1)),(0,l.T)(e=>null==e||e))}orgGrantsAccess(e){return e.some(e=>!!(e.canAccess&&e.isMember&&e.usersGetPremium)&&(e.productTierType===M$.Families||e.productTierType===M$.Enterprise&&e.usePhishingBlocker))}},deps:[Zk,T$,Kb,Za,WF,Hb,u]},{provide:gk,useFactory:(e,t)=>new gk((0,Po.h)(e.asObservable(),bce().pipe(UZ(t)))),deps:[zT,Fl.SKi]},{provide:bk,useFactory:(e,t)=>bk.combine(new Ik(e),new Ole(t)),deps:[zT,Za]},{provide:zT,useFactory:()=>new Co.B,deps:[]},{provide:Tce,useFactory:e=>new ole(e,new lle(self.localStorage)),deps:[$T]},{provide:kp,useClass:class extends kp{constructor(e,t,i,n){super(e,t),this.largeObjectMemoryStorageService=i,this.diskBackupLocalStorage=n}get(e,t){var i;const n=null!==(i=t.browser)&&void 0!==i?i:e;switch(n){case"memory-large-object":return["memory-large-object",this.largeObjectMemoryStorageService];case"disk-backup-local-storage":return["disk-backup-local-storage",this.diskBackupLocalStorage];default:return super.get(n,t)}}},deps:[$T,ET,Cce,Tce]},{provide:_T,useValue:Da.Browser},{provide:wA,useClass:class{constructor(e,t,i,n,r,s){this.userDecryptionOptionsService=e,this.biometricsService=t,this.pinService=i,this.biometricStateService=n,this.routerService=r,this.webAuthnPrfUnlockService=s}getPreviousUrl(){var e;return null!==(e=this.routerService.getPreviousUrl())&&void 0!==e?e:null}getBiometricsError(e){const t=VD[null==e?void 0:e.message];return t?t.description:null}popOutBrowserExtension(){return Rle(this,void 0,void 0,function*(){pl.inPopout(i.g.window)||pl.inSidebar(i.g.window)||(yield pl.openCurrentPagePopout(i.g.window))})}closeBrowserExtensionPopout(){pl.inPopout(i.g.window)&&ul.closePopup(i.g.window)}isWindowVisible(){return Rle(this,void 0,void 0,function*(){throw new Error("Method not implemented.")})}getBiometricsUnlockBtnText(){return"unlockWithBiometrics"}getAvailableUnlockOptions$(e){return(0,jo.z)([(0,$o.v)(()=>Rle(this,void 0,void 0,function*(){if(yield(0,bo._)(this.biometricStateService.biometricUnlockEnabled$(e))){return yield Promise.race([this.biometricsService.getBiometricsStatusForUser(e),new Promise(e=>setTimeout(()=>e($p.DesktopDisconnected),1e3))])}return $p.NotEnabledLocally})),this.userDecryptionOptionsService.userDecryptionOptionsById$(e),(0,$o.v)(()=>this.pinService.isPinDecryptionAvailable(e)),(0,$o.v)(()=>Rle(this,void 0,void 0,function*(){return{available:yield this.webAuthnPrfUnlockService.isPrfUnlockAvailable(e)}}))]).pipe((0,l.T)(([e,t,i,n])=>({masterPassword:{enabled:null==t?void 0:t.hasMasterPassword},pin:{enabled:i},biometrics:{enabled:e===$p.Available,biometricsStatus:e},prf:{enabled:n.available}})))}},deps:[$w,Vp,HF,Mp,ZJ,kA]},{provide:FT,useClass:class extends RT{constructor(e){super(),this.window=e}shouldCheckForWebAuthnQueryParamResponse(){return!0}extendPopupWidthIfRequired(e){return Tle(this,void 0,void 0,function*(){const t=yield this.isLinux();e===oS.WebAuthn&&t&&document.body.classList.add("linux-webauthn")})}removePopupWidthExtension(){document.body.classList.remove("linux-webauthn")}reloadOpenWindows(){ul.reloadOpenWindows(!0)}closeSingleActionPopouts(){return Tle(this,void 0,void 0,function*(){if(pl.inSingleActionPopout(this.window,Sle))return yield function(){return wle(this,void 0,void 0,function*(){yield pl.closeSingleActionPopout(Sle)})}(),!0;if(pl.inSingleActionPopout(this.window,kle))return yield function(){return wle(this,void 0,void 0,function*(){yield pl.closeSingleActionPopout(kle)})}(),!0;if(pl.inSingleActionPopout(this.window,Ile))return yield function(){return wle(this,void 0,void 0,function*(){yield pl.closeSingleActionPopout(Ile)})}(),!0;return!!pl.inSingleActionPopout(this.window,Cle)&&(yield function(){return wle(this,void 0,void 0,function*(){yield pl.closeSingleActionPopout(Cle)})}(),!0)})}isLinux(){return Tle(this,void 0,void 0,function*(){return"linux"===(yield ul.getPlatformInfo()).os})}determineDuoLaunchAction(){const e=pl.inSingleActionPopout(this.window,Cle),t=pl.inPopout(this.window);return e||t?ST.DIRECT_LAUNCH:ST.SINGLE_ACTION_POPOUT}},deps:[AT]},{provide:FP,useClass:class extends SF{shouldOpenWebAuthnInNewTab(){return!0}},deps:[]},{provide:mP,useClass:class{constructor(e,t,i,n){this.browserMessagingApi=e,this.environmentService=t,this.i18nService=i,this.platformUtilsService=n}listenForDuo2faResult$(){return this.browserMessagingApi.messageListener$().pipe((0,Eo.p)(e=>"duoResult"===e.command),(0,l.T)(e=>({code:e.code,state:e.state,token:`${e.code}|${e.state}`})))}launchDuoFrameless(e){return Ple(this,void 0,void 0,function*(){const t={title:this.i18nService.t("youSuccessfullyLoggedIn"),message:this.i18nService.t("youMayCloseThisWindow"),isCountdown:!1},i=(yield(0,bo._)(this.environmentService.environment$)).getWebVaultUrl()+"/duo-redirect-connector.html?duoFramelessUrl="+encodeURIComponent(e)+"&handOffMessage="+encodeURIComponent(JSON.stringify(t));this.platformUtilsService.launchUri(i)})}openTwoFactorAuthDuoPopout(){return Ple(this,void 0,void 0,function*(){yield function(){return wle(this,void 0,void 0,function*(){yield pl.openPopout("popup/index.html#/2fa",{singleActionKey:Cle})})}()})}},deps:[MZ,mk,Ul,Hb]},{provide:kre,useClass:Ele,deps:[Za,Hb]},{provide:Xse,useFactory:e=>"notifications"in chrome&&null!=chrome.notifications?new yce(e):new Wse,deps:[Hb]},{provide:_Z,useClass:_Z,deps:[k$,$w,lh,Zk]},{provide:kA,useClass:class{constructor(e,t,i,n,r,s,o,a,l){this.webAuthnLoginPrfKeyService=e,this.keyService=t,this.userDecryptionOptionsService=i,this.encryptService=n,this.environmentService=r,this.platformUtilsService=s,this.window=o,this.logService=a,this.configService=l,this.navigatorCredentials=this.window.navigator.credentials}isPrfUnlockAvailable(e){return WA(this,void 0,void 0,function*(){try{if(!(yield this.configService.getFeatureFlag(Wv.PasskeyUnlock)))return!1;if(!this.navigatorCredentials||!this.navigatorCredentials.get)return!1;const t=this.platformUtilsService.getClientType();if(t===Da.Browser&&!this.platformUtilsService.isChromium())return!1;if(t!==Da.Web&&t!==Da.Browser)return!1;return 0!==(yield this.getPrfUnlockCredentials(e)).length}catch(e){return this.logService.error("Error checking PRF unlock availability:",e),!1}})}getPrfUnlockCredentials(e){return WA(this,void 0,void 0,function*(){try{const t=yield this.getUserDecryptionOptions(e);return(null==t?void 0:t.webAuthnPrfOptions)?t.webAuthnPrfOptions.map(e=>({credentialId:e.credentialId,transports:e.transports})):[]}catch(e){return this.logService.error("Error getting PRF unlock credentials:",e),[]}})}unlockVaultWithPrf(e){return WA(this,void 0,void 0,function*(){const t=yield this.getPrfUnlockCredentials(e);if(0===t.length)throw new Error("No PRF credentials available for unlock");const i=yield this.performWebAuthnGetWithPrf(t,e),n=yield this.createPrfKeyFromResponse(i),r=yield this.getPrfOptionForCredential(i.id,e),s=yield this.encryptService.unwrapDecapsulationKey(new Pp(r.encryptedPrivateKey),n),o=yield this.encryptService.decapsulateKeyUnsigned(new Pp(r.encryptedUserKey),s);if(!o)throw new Error("Failed to decrypt user key from private key");return o})}performWebAuthnGetWithPrf(e,t){return WA(this,void 0,void 0,function*(){const i=yield this.getRpIdForUser(t),n=yield this.getUnlockWithPrfSalt(),r={publicKey:{challenge:new Uint8Array(32),allowCredentials:e.map(({credentialId:e,transports:t})=>({type:"public-key",id:qA.stringToBuffer(e),transports:t||[]})),rpId:i,userVerification:"preferred",extensions:{prf:{eval:{first:n}}}}},s=yield this.navigatorCredentials.get(r);if(!s)throw new Error("WebAuthn get() returned null/undefined");if(!(s instanceof PublicKeyCredential))throw new Error("Failed to get PRF credential for unlock");return s})}createPrfKeyFromResponse(e){return WA(this,void 0,void 0,function*(){var t,i;const n=null===(i=null===(t=e.getClientExtensionResults().prf)||void 0===t?void 0:t.results)||void 0===i?void 0:i.first;if(!n)throw new Error("No PRF result received from authenticator");try{return yield this.webAuthnLoginPrfKeyService.createSymmetricKeyFromPrf(n)}catch(e){throw this.logService.error("Failed to create unlock key from PRF:",e),e}})}getPrfOptionForCredential(e,t){return WA(this,void 0,void 0,function*(){const i=yield this.getUserDecryptionOptions(t);if(!(null==i?void 0:i.webAuthnPrfOptions)||0===i.webAuthnPrfOptions.length)throw new Error("No WebAuthn PRF option found for user - cannot perform PRF unlock");const n=i.webAuthnPrfOptions.find(t=>t.credentialId===e);if(!n)throw new Error("No matching WebAuthn PRF option found for this credential");return n})}getUnlockWithPrfSalt(){return WA(this,void 0,void 0,function*(){try{return yield this.webAuthnLoginPrfKeyService.getLoginWithPrfSalt()}catch(e){throw this.logService.error("Error getting unlock PRF salt:",e),e}})}getUserDecryptionOptions(e){return WA(this,void 0,void 0,function*(){try{return yield(0,bo._)(this.userDecryptionOptionsService.userDecryptionOptionsById$(e))}catch(e){return this.logService.error("Error getting user decryption options:",e),null}})}getRpIdForUser(e){return WA(this,void 0,void 0,function*(){try{const t=yield(0,bo._)(this.environmentService.getEnvironment$(e)),i=bd.getHost(t.getWebVaultUrl());if(!i)return;const n=new URL(`https://${i}`);return n.hostname}catch(e){return void this.logService.error("Error getting rpId",e)}})}},deps:[dte,Bp,$w,$G,mk,Hb,AT,Za,Kb]},{provide:x5,useClass:class{constructor(e,t=!0){this.globalStateProvider=e,this.defaultEnableRoutingAnimation=t,this.enableRoutingAnimationState=this.globalStateProvider.get(A5),this.enableRoutingAnimation$=this.enableRoutingAnimationState.state$.pipe((0,l.T)(e=>null!=e?e:this.defaultEnableRoutingAnimation))}setEnableRoutingAnimation(e){return R5(this,void 0,void 0,function*(){yield this.enableRoutingAnimationState.update(()=>e,{shouldUpdate:t=>t!==e})})}},deps:[d]},{provide:La,useExisting:dce},{provide:dce,useClass:dce,deps:[Za,u]},{provide:Ck,useExisting:vle,deps:[]},{provide:dk,useClass:dk,deps:[]},{provide:Rk,useClass:mle,deps:[FI,mk,gf,Hb,xk,vle,dk]},{provide:ck,useClass:class{constructor(e,t){this.messageSender=e,this.messageListener=t}lockAll(){return cle(this,void 0,void 0,function*(){const e=y(),t=(0,bo._)(this.messageListener.messages$(ule).pipe((0,Eo.p)(t=>t.requestId===e)));this.messageSender.send(dle,{requestId:e}),yield t})}lock(e){return cle(this,void 0,void 0,function*(){const t=y(),i=(0,bo._)(this.messageListener.messages$(hle).pipe((0,Eo.p)(e=>e.requestId===t)));this.messageSender.send(ple,{requestId:t,userId:e}),yield i})}runPlatformOnLockActions(){return cle(this,void 0,void 0,function*(){})}},deps:[bk,gk]},{provide:om,useClass:class extends om{constructor(e){super(),this.logService=e}load(){return nce(this,void 0,void 0,function*(){const e=performance.now();yield function(){return nce(this,void 0,void 0,function*(){if(ul.isManifestVersion(3))yield sce;else{if(!rce)throw new Error("WebAssembly is not supported in this environment");console.info("WebAssembly is supported in this environment"),yield i.e(635).then(i.bind(i,20635))}return globalThis.initSdk})}().then(e=>e());const t=performance.now();this.logService.info(`WASM SDK loaded in ${Math.round(t-e)}ms`)})}},deps:[Za]},{provide:Sre,useFactory:()=>zne("sdk")?new nle:new rle,deps:[]},{provide:Qw,useClass:Qw,deps:[Zk,Rd,u]},{provide:vle,useClass:vle,deps:[]},{provide:Nw,useClass:class extends vk{constructor(e,t){super(e),this.messagingService=e,this.accountSwitcherService=t}logout(e,t){return ble(this,void 0,void 0,function*(){const i=this.accountSwitcherService.listenForSwitchAccountFinish(null);this.messagingService.send("logout",{userId:e,logoutReason:t});const n=yield i;if(n)return{userId:n.userId,authenticationStatus:n.authenticationStatus}})}},deps:[bk,EF]},{provide:w6,useExisting:$5,deps:[]},{provide:bT,useClass:yle,deps:[qx,Rd,mk,Ul,Za]},{provide:EB,useClass:ZW,deps:[lh,qb,Hb,Ul]},{provide:RH,useClass:class extends BH{constructor(e,t,i,n){super(e,t,i),this.keyService=e,this.masterPasswordApiService=t,this.masterPasswordService=i,this.win=n}closeBrowserExtensionPopout(){pl.inPopout(this.win)&&ul.closePopup(this.win)}},deps:[Bp,lte,Yb,AT]},{provide:Rre,useClass:class{constructor(e){this.logService=e,this.notifications$=new aa.c(e=>{this.logService.warning("Notifications will never emit from browser foreground, you will need to listen to messages from `DefaultNotificationsService.processNotification`"),e.complete()})}startListening(){throw new Error("startListening should never be called from browser foreground.")}reconnectFromActivity(){throw new Error("Activity should not be managed from browser foreground.")}disconnectFromInactivity(){throw new Error("Activity should not be managed from browser foreground.")}},deps:[Za]},{provide:RZ,useClass:class{showHeaderInformation(){return!1}},deps:[]},{provide:$V,useClass:sae,deps:[_b,eI,T$,Kb]},{provide:kF,useClass:class extends FF{showBackButton(){return!1}},deps:[]},{provide:mD,useClass:class{constructor(e){this.platformUtilsService=e}isAvailable(e){return xle(this,void 0,void 0,function*(){switch(e){case wv:case fv:case vv:case bv:return!0;case mv:return!(this.platformUtilsService.isFirefox()||this.platformUtilsService.isSafari()||this.platformUtilsService.isOpera()&&"MacIntel"===navigator.platform);default:if(Iv(e))return!0}return!1})}getOrPromoteToAvailable(e){return xle(this,void 0,void 0,function*(){return(yield this.isAvailable(e))?e:fv})}},deps:[Hb]},{provide:fD,useClass:class extends fD{constructor(e,t,i,n){super(e,t,i),this.messagingService=n}onTimeoutSave(e){e===vv&&this.messagingService.send("bgReseedStorage")}},deps:[Ul,mD,Jb,bk]},{provide:yx,useClass:Sce,deps:[u,XF,Za]},{provide:bx,useClass:aR,deps:[u,tR]}];class Fce{}Fce.ɵfac=function(e){return new(e||Fce)},Fce.ɵmod=Fl.$C({type:Fce}),Fce.ɵinj=a.G2t({providers:Pce,imports:[Hae,yL]});var Rce=i(52981),xce=i(67819),Ace=i(91267),Dce=i(32661),Ece=i(34067),$ce=i(45524),Oce=i(46215),Uce=i(51728),Mce=i(2570),Nce=i(85096),Vce=i(53011),Bce=i(34423),jce=i(56773),Gce=i(26293),Lce=i(62263),zce=i(64008),_ce=i(60573),Kce=i(11006),Xce=i(25367),qce=i(90973),Wce=i(56693),Yce=i(63757),Hce=i(39140),Jce=i(99911),Zce=i(32435),Qce=i(19711),eue=i(98330),tue=i(18371),iue=i(83049),nue=i(97369),rue=i(6433),sue=i(11128),oue=i(85884),aue=i(92837),lue=i(62118),cue=i(41528),uue=i(87970),due=i(15069),hue=i(9799),pue=i(77058),vue=i(79516),fue=i(11625),mue=i(58146),gue=i(85528),yue=i(74341),bue=i(70860),wue=i(17476),Sue=i(41829),kue=i(93323),Iue=i(5205),Cue=i(89672),Tue=i(65906),Pue=i(21819),Fue=i(50121),Rue=i(82437),xue=i(52611),Aue=i(95175),Due=i(64068),Eue=i(12854),$ue=i(28416),Oue=i(97413),Uue=i(37447),Mue=i(60294);(0,Rce.EO)(xce.A,"ar"),(0,Rce.EO)(Ace.A,"az"),(0,Rce.EO)(Dce.A,"be"),(0,Rce.EO)(Ece.A,"bg"),(0,Rce.EO)($ce.A,"bn"),(0,Rce.EO)(Oce.A,"bs"),(0,Rce.EO)(Uce.A,"ca"),(0,Rce.EO)(Mce.A,"cs"),(0,Rce.EO)(Nce.A,"cy"),(0,Rce.EO)(Vce.A,"da"),(0,Rce.EO)(Bce.A,"de"),(0,Rce.EO)(jce.A,"el"),(0,Rce.EO)(Gce.A,"en-GB"),(0,Rce.EO)(Lce.A,"en-IN"),(0,Rce.EO)(zce.A,"es"),(0,Rce.EO)(_ce.A,"et"),(0,Rce.EO)(Kce.A,"eu"),(0,Rce.EO)(qce.A,"fa"),(0,Rce.EO)(Wce.A,"fi"),(0,Rce.EO)(Yce.A,"fil"),(0,Rce.EO)(Hce.A,"fr"),(0,Rce.EO)(Jce.A,"gl"),(0,Rce.EO)(Zce.A,"he"),(0,Rce.EO)(Qce.A,"hi"),(0,Rce.EO)(eue.A,"hr"),(0,Rce.EO)(tue.A,"hu"),(0,Rce.EO)(iue.A,"id"),(0,Rce.EO)(nue.A,"it"),(0,Rce.EO)(rue.A,"ja"),(0,Rce.EO)(sue.A,"ka"),(0,Rce.EO)(oue.A,"km"),(0,Rce.EO)(aue.A,"kn"),(0,Rce.EO)(lue.A,"ko"),(0,Rce.EO)(cue.A,"lt"),(0,Rce.EO)(uue.A,"lv"),(0,Rce.EO)(due.A,"ml"),(0,Rce.EO)(hue.A,"mr"),(0,Rce.EO)(pue.A,"my"),(0,Rce.EO)(vue.A,"nb"),(0,Rce.EO)(fue.A,"ne"),(0,Rce.EO)(mue.A,"nl"),(0,Rce.EO)(gue.A,"nn"),(0,Rce.EO)(yue.A,"or"),(0,Rce.EO)(bue.A,"pl"),(0,Rce.EO)(wue.A,"pt-BR"),(0,Rce.EO)(Sue.A,"pt-PT"),(0,Rce.EO)(kue.A,"ro"),(0,Rce.EO)(Iue.A,"ru"),(0,Rce.EO)(Cue.A,"si"),(0,Rce.EO)(Tue.A,"sk"),(0,Rce.EO)(Pue.A,"sl"),(0,Rce.EO)(Fue.A,"sr"),(0,Rce.EO)(Rue.A,"sv"),(0,Rce.EO)(xue.A,"ta"),(0,Rce.EO)(Aue.A,"te"),(0,Rce.EO)(Due.A,"th"),(0,Rce.EO)(Eue.A,"tr"),(0,Rce.EO)($ue.A,"uk"),(0,Rce.EO)(Oue.A,"vi"),(0,Rce.EO)(Uue.A,"zh-CN"),(0,Rce.EO)(Mue.A,"zh-TW",Xce.A);class Nue{}Nue.ɵfac=function(e){return new(e||Nue)},Nue.ɵmod=Fl.$C({type:Nue,bootstrap:[uee]}),Nue.ɵinj=a.G2t({providers:[kl.oe,kl.vh],imports:[gl.Pd,Y9,_Y,FE,dc.forRoot({maxOpened:2,autoDismiss:!0,closeButton:!0,positionClass:"toast-top-full-width"}),Cl.wb,s.Bb,yl.ad,Il.YN,sf,bl.RH,wl.z_,Il.X1,Sl.E9,Fce,Fh,RF,jF,id,HY,GD,tE,tH,aE,gT,_F,Gu,$9,dd,Hh,dd]});i(3095);ml.initBodyWidthFromLocalStorage(),sl.shouldApplySafariHeightFix(window)&&document.documentElement.classList.add("safari_height_fix"),(0,o.SmG)(),s.sG().bootstrapModule(Nue)},86973:function(){}},c={};function u(e){var t=c[e];if(void 0!==t)return t.exports;var i=c[e]={id:e,loaded:!1,exports:{}};return l[e].call(i.exports,i,i.exports,u),i.loaded=!0,i.exports}u.m=l,e="function"==typeof Symbol,t=e?Symbol("webpack queues"):"__webpack_queues__",i=e?Symbol("webpack exports"):"__webpack_exports__",n=e?Symbol("webpack error"):"__webpack_error__",r=function(e){e&&e.d<1&&(e.d=1,e.forEach(function(e){e.r--}),e.forEach(function(e){e.r--?e.r++:e()}))},u.a=function(e,s,o){var a;o&&((a=[]).d=-1);var l,c,u,d=new Set,h=e.exports,p=new Promise(function(e,t){u=t,c=e});p[i]=h,p[t]=function(e){a&&e(a),d.forEach(e),p.catch(function(){})},e.exports=p,s(function(e){var s;l=function(e){return e.map(function(e){if(null!==e&&"object"==typeof e){if(e[t])return e;if(e.then){var s=[];s.d=0,e.then(function(e){o[i]=e,r(s)},function(e){o[n]=e,r(s)});var o={};return o[t]=function(e){e(s)},o}}var a={};return a[t]=function(){},a[i]=e,a})}(e);var o=function(){return l.map(function(e){if(e[n])throw e[n];return e[i]})},c=new Promise(function(e){(s=function(){e(o)}).r=0;var i=function(e){e!==a&&!d.has(e)&&(d.add(e),e&&!e.d&&(s.r++,e.push(s)))};l.map(function(e){e[t](i)})});return s.r?c:o()},function(e){e?u(p[n]=e):c(h),r(a)}),a&&a.d<0&&(a.d=0)},s=[],u.O=function(e,t,i,n){if(!t){var r=1/0;for(c=0;c<s.length;c++){t=s[c][0],i=s[c][1],n=s[c][2];for(var o=!0,a=0;a<t.length;a++)(!1&n||r>=n)&&Object.keys(u.O).every(function(e){return u.O[e](t[a])})?t.splice(a--,1):(o=!1,n<r&&(r=n));if(o){s.splice(c--,1);var l=i();void 0!==l&&(e=l)}}return e}n=n||0;for(var c=s.length;c>0&&s[c-1][2]>n;c--)s[c]=s[c-1];s[c]=[t,i,n]},u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,{a:t}),t},u.d=function(e,t){for(var i in t)u.o(t,i)&&!u.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},u.f={},u.e=function(e){return Promise.all(Object.keys(u.f).reduce(function(t,i){return u.f[i](e,t),t},[]))},u.u=function(e){return"assets/"+e+".js"},u.miniCssF=function(e){},u.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),u.hmd=function(e){return(e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:function(){throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o={},a="@bitwarden/browser:",u.l=function(e,t,i,n){if(o[e])o[e].push(t);else{var r,s;if(void 0!==i)for(var l=document.getElementsByTagName("script"),c=0;c<l.length;c++){var d=l[c];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==a+i){r=d;break}}r||(s=!0,(r=document.createElement("script")).charset="utf-8",u.nc&&r.setAttribute("nonce",u.nc),r.setAttribute("data-webpack",a+i),r.src=e),o[e]=[t];var h=function(t,i){r.onerror=r.onload=null,clearTimeout(p);var n=o[e];if(delete o[e],r.parentNode&&r.parentNode.removeChild(r),n&&n.forEach(function(e){return e(i)}),t)return t(i)},p=setTimeout(h.bind(null,void 0,{type:"timeout",target:r}),12e4);r.onerror=h.bind(null,r.onerror),r.onload=h.bind(null,r.onload),s&&document.head.appendChild(r)}},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},u.v=function(e,t,i,n){var r=fetch(u.p+"assets/"+i+".wasm"),s=function(){return r.then(function(e){return e.arrayBuffer()}).then(function(e){return WebAssembly.instantiate(e,n)}).then(function(t){return Object.assign(e,t.instance.exports)})};return r.then(function(t){return"function"==typeof WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(t,n).then(function(t){return Object.assign(e,t.instance.exports)},function(e){if("application/wasm"!==t.headers.get("Content-Type"))return console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",e),s();throw e}):s()})},function(){var e;u.g.importScripts&&(e=u.g.location+"");var t=u.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var i=t.getElementsByTagName("script");if(i.length)for(var n=i.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=i[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),u.p=e+"../"}(),function(){var e={133:0};u.f.j=function(t,i){var n=u.o(e,t)?e[t]:void 0;if(0!==n)if(n)i.push(n[2]);else{var r=new Promise(function(i,r){n=e[t]=[i,r]});i.push(n[2]=r);var s=u.p+u.u(t),o=new Error;u.l(s,function(i){if(u.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var r=i&&("load"===i.type?"missing":i.type),s=i&&i.target&&i.target.src;o.message="Loading chunk "+t+" failed.\n("+r+": "+s+")",o.name="ChunkLoadError",o.type=r,o.request=s,n[1](o)}},"chunk-"+t,t)}},u.O.j=function(t){return 0===e[t]};var t=function(t,i){var n,r,s=i[0],o=i[1],a=i[2],l=0;if(s.some(function(t){return 0!==e[t]})){for(n in o)u.o(o,n)&&(u.m[n]=o[n]);if(a)var c=a(u)}for(t&&t(i);l<s.length;l++)r=s[l],u.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return u.O(c)},i=self.webpackChunk_bitwarden_browser=self.webpackChunk_bitwarden_browser||[];i.forEach(t.bind(null,0)),i.push=t.bind(null,i.push.bind(i))}();var d=u.O(void 0,[132,621],function(){return u(80369)});d=u.O(d)}();
//# sourceMappingURL=main.js.map